!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._posthogChunkIds=e._posthogChunkIds||{},e._posthogChunkIds[n]="01a08d90-2378-7b63-8998-5121f21e4eca")}catch(e){}}();(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,349056,(e,t,n)=>{e.e,t.exports=function(){var t=function(e,n){return(t=Object.setPrototypeOf||(({__proto__:[]})instanceof Array?function(e,t){e.__proto__=t}:function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}))(e,n)},n=function(){return(n=Object.assign||function(e){for(var t,n=1,r=arguments.length;ntypeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:e.g,i=Object.keys,s=Array.isArray;function a(e,t){return"object"==typeof t&&i(t).forEach(function(n){e[n]=t[n]}),e}"u"typeof Symbol?Symbol.iterator:"@@iterator",O="symbol"==typeof R?function(e){var t;return null!=e&&(t=e[R])&&t.apply(e)}:function(){return null};function I(e,t){0<=(t=e.indexOf(t))&&e.splice(t,1)}var D={};function M(e){var t,n,r,o;if(1==arguments.length){if(s(e))return e.slice();if(this===D&&"string"==typeof e)return[e];if(o=O(e))for(n=[];!(r=o.next()).done;)n.push(r.value);else{if(null==e||"number"!=typeof(t=e.length))return[e];for(n=Array(t);t--;)n[t]=e[t]}}else for(t=arguments.length,n=Array(t);t--;)n[t]=arguments[t];return n}var F="u">typeof Symbol?function(e){return"AsyncFunction"===e[Symbol.toStringTag]}:function(){return!1},N=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],K=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"].concat(N),B={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function q(e,t){this.name=e,this.message=t}function z(e,t){return e+". Errors: "+Object.keys(t).map(function(e){return t[e].toString()}).filter(function(e,t,n){return n.indexOf(e)===t}).join("\n")}function L(e,t,n,r){this.failures=t,this.failedKeys=r,this.successCount=n,this.message=z(e,t)}function W(e,t){this.name="BulkError",this.failures=Object.keys(t).map(function(e){return t[e]}),this.failuresByPos=t,this.message=z(e,this.failures)}m(q).from(Error).extend({toString:function(){return this.name+": "+this.message}}),m(L).from(q),m(W).from(q);var $=K.reduce(function(e,t){return e[t]=t+"Error",e},{}),U=K.reduce(function(e,t){var n=t+"Error";function r(e,r){this.name=n,e?"string"==typeof e?(this.message="".concat(e).concat(r?"\n "+r:""),this.inner=r||null):"object"==typeof e&&(this.message="".concat(e.name," ").concat(e.message),this.inner=e):(this.message=B[t]||n,this.inner=null)}return m(r).from(q),e[t]=r,e},{}),V=(U.Syntax=SyntaxError,U.Type=TypeError,U.Range=RangeError,N.reduce(function(e,t){return e[t+"Error"]=U[t],e},{}));function G(){}function H(e){return e}function Y(e,t){return null==e||e===H?t:function(n){return t(e(n))}}function Q(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function X(e,t){return e===G?t:function(){var n=e.apply(this,arguments),r=(void 0!==n&&(arguments[0]=n),this.onsuccess),o=this.onerror,i=(this.onsuccess=null,this.onerror=null,t.apply(this,arguments));return r&&(this.onsuccess=this.onsuccess?Q(r,this.onsuccess):r),o&&(this.onerror=this.onerror?Q(o,this.onerror):o),void 0!==i?i:n}}function Z(e,t){return e===G?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?Q(n,this.onsuccess):n),r&&(this.onerror=this.onerror?Q(r,this.onerror):r)}}function J(e,t){return e===G?t:function(n){var r=e.apply(this,arguments),n=(a(n,r),this.onsuccess),o=this.onerror,i=(this.onsuccess=null,this.onerror=null,t.apply(this,arguments));return n&&(this.onsuccess=this.onsuccess?Q(n,this.onsuccess):n),o&&(this.onerror=this.onerror?Q(o,this.onerror):o),void 0===r?void 0===i?void 0:i:a(r,i)}}function ee(e,t){return e===G?t:function(){return!1!==t.apply(this,arguments)&&e.apply(this,arguments)}}function et(e,t){return e===G?t:function(){var n=e.apply(this,arguments);if(n&&"function"==typeof n.then){for(var r=this,o=arguments.length,i=Array(o);o--;)i[o]=arguments[o];return n.then(function(){return t.apply(r,i)})}return t.apply(this,arguments)}}(N=K.reduce(function(e,t){return -1===["Syntax","Type","Range"].indexOf(t)&&(e[t+"Error"]=U[t]),e},{})).ModifyError=L,N.DexieError=q,N.BulkError=W;var en="u">typeof location&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href),er={},eo="u"typeof crypto&&crypto.subtle?[eo=crypto.subtle.digest("SHA-512",new Uint8Array([0])),u(eo),K]:[K,u(K),K]),K=eo[0],ei=eo[1],ei=ei&&ei.then,es=K&&K.constructor,ea=!!eo[2],eu=function(e,t){ey.push([e,t]),ec&&(queueMicrotask(eN),ec=!1)},el=!0,ec=!0,ed=[],ef=[],eh=H,em={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:G,pgp:!1,env:{},finalize:G},ep=em,ey=[],eg=0,ev=[];function eb(e){if("object"!=typeof this)throw TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var t=this._PSD=ep;if("function"!=typeof e){if(e!==er)throw TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],!1===this._state&&e_(this,this._value)}else this._state=null,this._value=null,++t.ref,function e(t,n){try{n(function(n){if(null===t._state){if(n===t)throw TypeError("A promise cannot be resolved with itself.");var r=t._lib&&eC();n&&"function"==typeof n.then?e(t,function(e,t){n instanceof eb?n._then(e,t):n.then(e,t)}):(t._state=!0,t._value=n,eS(t)),r&&eE()}},e_.bind(null,t))}catch(e){e_(t,e)}}(this,e)}var ex={get:function(){var e=ep,t=eM;function n(n,r){var o=this,i=!e.global&&(e!==ep||t!==eM),s=i&&!eq(),a=new eb(function(t,a){ek(o,new ew(eV(n,e,i,s),eV(r,e,i,s),t,a,e))});return this._consoleTask&&(a._consoleTask=this._consoleTask),a}return n.prototype=er,n},set:function(e){h(this,"then",e&&e.prototype===er?ex:{get:function(){return e},set:ex.set})}};function ew(e,t,n,r,o){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.resolve=n,this.reject=r,this.psd=o}function e_(e,t){var n;ef.push(t),null===e._state&&(n=e._lib&&eC(),t=eh(t),e._state=!1,e._value=t,ed.some(function(t){return t._value===e._value})||ed.push(e),eS(e),n)&&eE()}function eS(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n{for(var t=ed.length;t;)if(ed[--t]._value===e._value)return ed.splice(t,1)})(t),n.resolve(r)}catch(e){n.reject(e)}finally{0==--eg&&eP(),--n.psd.ref||n.psd.finalize()}}function eN(){eU(em,function(){eC()&&eE()})}function eC(){var e=el;return ec=el=!1,e}function eE(){var e,t,n;do for(;0typeof Symbol&&Symbol.toStringTag&&h(eb.prototype,Symbol.toStringTag,"Dexie.Promise"),em.env=e$(),d(eb,{all:function(){var e=M.apply(null,arguments).map(ez);return new eb(function(t,n){0===e.length&&t([]);var r=e.length;e.forEach(function(o,i){return eb.resolve(o).then(function(n){e[i]=n,--r||t(e)},n)})})},resolve:function(e){return e instanceof eb?e:e&&"function"==typeof e.then?new eb(function(t,n){e.then(t,n)}):new eb(er,!0,e)},reject:eA,race:function(){var e=M.apply(null,arguments).map(ez);return new eb(function(t,n){e.map(function(e){return eb.resolve(e).then(t,n)})})},PSD:{get:function(){return ep},set:function(e){return ep=e}},totalEchoes:{get:function(){return eM}},newPSD:eK,usePSD:eU,scheduler:{get:function(){return eu},set:function(e){eu=e}},rejectionMapper:{get:function(){return eh},set:function(e){eh=e}},follow:function(e,t){return new eb(function(n,r){return eK(function(t,n){var r=ep;r.unhandleds=[],r.onunhandled=n,r.finalize=Q(function(){var e,r=this;e=function(){0===r.unhandleds.length?t():n(r.unhandleds[0])},ev.push(function t(){e(),ev.splice(ev.indexOf(t),1)}),++eg,eu(function(){0==--eg&&eP()},[])},r.finalize),e()},t,n,r)})}}),es&&(es.allSettled&&h(eb,"allSettled",function(){var e=M.apply(null,arguments).map(ez);return new eb(function(t){0===e.length&&t([]);var n=e.length,r=Array(n);e.forEach(function(e,o){return eb.resolve(e).then(function(e){return r[o]={status:"fulfilled",value:e}},function(e){return r[o]={status:"rejected",reason:e}}).then(function(){return--n||t(r)})})})}),es.any&&"u">typeof AggregateError&&h(eb,"any",function(){var e=M.apply(null,arguments).map(ez);return new eb(function(t,n){0===e.length&&n(AggregateError([]));var r=e.length,o=Array(r);e.forEach(function(e,i){return eb.resolve(e).then(function(e){return t(e)},function(e){o[i]=e,--r||n(AggregateError(o))})})})}),es.withResolvers)&&(eb.withResolvers=es.withResolvers);var eR={awaits:0,echoes:0,id:0},eO=0,eI=[],eD=0,eM=0,eF=0;function eK(e,t,n,r){var o=ep,i=Object.create(o),t=(i.parent=o,i.ref=0,i.global=!1,i.id=++eF,em.env,i.env=ea?{Promise:eb,PromiseProp:{value:eb,configurable:!0,writable:!0},all:eb.all,race:eb.race,allSettled:eb.allSettled,any:eb.any,resolve:eb.resolve,reject:eb.reject}:{},t&&a(i,t),++o.ref,i.finalize=function(){--this.parent.ref||this.parent.finalize()},eU(i,e,n,r));return 0===i.ref&&i.finalize(),t}function eB(){return eR.id||(eR.id=++eO),++eR.awaits,eR.echoes+=100,eR.id}function eq(){return!!eR.awaits&&(0==--eR.awaits&&(eR.id=0),eR.echoes=100*eR.awaits,!0)}function ez(e){return eR.echoes&&e&&e.constructor===es?(eB(),e.then(function(e){return eq(),e},function(e){return eq(),eH(e)})):e}function eL(){var e=eI[eI.length-1];eI.pop(),eW(e,!1)}function eW(e,t){var n,r,i=ep;(t?!eR.echoes||eD++&&e===ep:!eD||--eD&&e===ep)||queueMicrotask(t?(function(e){++eM,eR.echoes&&0!=--eR.echoes||(eR.echoes=eR.awaits=eR.id=0),eI.push(ep),eW(e,!0)}).bind(null,e):eL),e!==ep&&(ep=e,i===em&&(em.env=e$()),ea)&&(n=em.env.Promise,r=e.env,i.global||e.global)&&(Object.defineProperty(o,"Promise",r.PromiseProp),n.all=r.all,n.race=r.race,n.resolve=r.resolve,n.reject=r.reject,r.allSettled&&(n.allSettled=r.allSettled),r.any)&&(n.any=r.any)}function e$(){var e=o.Promise;return ea?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(o,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject}:{}}function eU(e,t,n,r,o){var i=ep;try{return eW(e,!0),t(n,r,o)}finally{eW(i,!1)}}function eV(e,t,n,r){return"function"!=typeof e?e:function(){var o=ep;n&&eB(),eW(t,!0);try{return e.apply(this,arguments)}finally{eW(o,!1),r&&queueMicrotask(eq)}}}function eG(e){Promise===es&&0===eR.echoes?0===eD?e():enqueueNativeMicroTask(e):setTimeout(e,0)}-1===(""+ei).indexOf("[native code]")&&(eB=eq=G);var eH=eb.reject,eY=String.fromCharCode(65535),eQ="Invalid key provided. Keys must be of type string, number, Date or Array.",eX="String expected.",eZ=[],eJ="__dbnames",e0="readonly",e1="readwrite";function e2(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var e3={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function e5(e){return"string"!=typeof e||/\./.test(e)?function(e){return e}:function(t){return void 0===t[e]&&e in t&&delete(t=P(t))[e],t}}function e4(){throw U.Type("Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.")}function e6(e,t){try{var n=e7(e),r=e7(t);if(n!==r)return"Array"===n?1:"Array"===r?-1:"binary"===n?1:"binary"===r?-1:"string"===n?1:"string"===r?-1:"Date"===n?1:"Date"!==r?NaN:-1;switch(n){case"number":case"Date":case"string":return ttypeof console&&console.createTask&&console.createTask("Dexie: ".concat("readonly"===e?"read":"write"," ").concat(this.name));function s(e,n,r){if(r.schema[o])return t(r.idbtrans,r);throw new U.NotFound("Table "+o+" not part of transaction")}var a=eC();try{var u=r&&r.db._novip===this.db._novip?r===ep.trans?r._promise(e,s,n):eK(function(){return r._promise(e,s,n)},{trans:r,transless:ep.transless||ep}):function e(t,n,r,o){if(t.idbdb&&(t._state.openComplete||ep.letThrough||t._vip)){var i=t._createTransaction(n,r,t._dbSchema);try{i.create(),t._state.PR1398_maxLoop=3}catch(i){return i.name===$.InvalidState&&t.isOpen()&&0<--t._state.PR1398_maxLoop?(console.warn("Dexie: Need to reopen db"),t.close({disableAutoOpen:!1}),t.open().then(function(){return e(t,n,r,o)})):eH(i)}return i._promise(n,function(e,t){return eK(function(){return ep.trans=i,o(e,t,i)})}).then(function(e){if("readwrite"===n)try{i.idbtrans.commit()}catch(e){}return"readonly"===n?e:i._completion.then(function(){return e})})}if(t._state.openComplete)return eH(new U.DatabaseClosed(t._state.dbOpenError));if(!t._state.isBeingOpened){if(!t._state.autoOpen)return eH(new U.DatabaseClosed);t.open().catch(G)}return t._state.dbReadyPromise.then(function(){return e(t,n,r,o)})}(this.db,e,[this.name],s);return i&&(u._consoleTask=i,u=u.catch(function(e){return console.trace(e),eH(e)})),u}finally{a&&eE()}},tn.prototype.get=function(e,t){var n=this;return e&&e.constructor===Object?this.where(e).first(t):null==e?eH(new U.Type("Invalid argument to Table.get()")):this._trans("readonly",function(t){return n.core.get({trans:t,key:e}).then(function(e){return n.hook.reading.fire(e)})}).then(t)},tn.prototype.where=function(e){if("string"==typeof e)return new this.db.WhereClause(this,e);if(s(e))return new this.db.WhereClause(this,"[".concat(e.join("+"),"]"));var t=i(e);if(1===t.length)return this.where(t[0]).equals(e[t[0]]);var n=this.schema.indexes.concat(this.schema.primKey).filter(function(e){if(e.compound&&t.every(function(t){return 0<=e.keyPath.indexOf(t)})){for(var n=0;n{if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function o(){this.constructor=i}function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o),Object.defineProperty(i.prototype,"db",{get:function(){return n},enumerable:!1,configurable:!0}),i.prototype.table=function(){return r},i})(e)),new Set),i=e.prototype;i;i=u(i))Object.getOwnPropertyNames(i).forEach(function(e){return o.add(e)});function s(t){if(!t)return t;var n,r=Object.create(e.prototype);for(n in t)if(!o.has(n))try{r[n]=t[n]}catch(e){}return r}return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=s,this.hook("reading",s),e},tn.prototype.defineClass=function(){return this.mapToClass(function(e){a(this,e)})},tn.prototype.add=function(e,t){var n=this,r=this.schema.primKey,o=r.auto,i=r.keyPath,s=e;return i&&o&&(s=e5(i)(e)),this._trans("readwrite",function(e){return n.core.mutate({trans:e,type:"add",keys:null!=t?[t]:null,values:[s]})}).then(function(e){return e.numFailures?eb.reject(e.failures[0]):e.lastResult}).then(function(t){if(i)try{_(e,i,t)}catch(e){}return t})},tn.prototype.upsert=function(e,t){var n=this,r=this.schema.primKey.keyPath;return this._trans("readwrite",function(o){return n.core.get({trans:o,key:e}).then(function(i){var s=null!=i?i:{};return tt(s,t),r&&_(s,r,e),n.core.mutate({trans:o,type:"put",values:[s],keys:[e],upsert:!0,updates:{keys:[e],changeSpecs:[t]}}).then(function(e){return e.numFailures?eb.reject(e.failures[0]):!!i})})})},tn.prototype.update=function(e,t){return"object"!=typeof e||s(e)?this.where(":id").equals(e).modify(t):void 0===(e=w(e,this.schema.primKey.keyPath))?eH(new U.InvalidArgument("Given object does not contain its primary key")):this.where(":id").equals(e).modify(t)},tn.prototype.put=function(e,t){var n=this,r=this.schema.primKey,o=r.auto,i=r.keyPath,s=e;return i&&o&&(s=e5(i)(e)),this._trans("readwrite",function(e){return n.core.mutate({trans:e,type:"put",values:[s],keys:null!=t?[t]:null})}).then(function(e){return e.numFailures?eb.reject(e.failures[0]):e.lastResult}).then(function(t){if(i)try{_(e,i,t)}catch(e){}return t})},tn.prototype.delete=function(e){var t=this;return this._trans("readwrite",function(n){return t.core.mutate({trans:n,type:"delete",keys:[e]}).then(function(n){return e9(t,[e],n)}).then(function(e){return e.numFailures?eb.reject(e.failures[0]):void 0})})},tn.prototype.clear=function(){var e=this;return this._trans("readwrite",function(t){return e.core.mutate({trans:t,type:"deleteRange",range:e3}).then(function(t){return e9(e,null,t)})}).then(function(e){return e.numFailures?eb.reject(e.failures[0]):void 0})},tn.prototype.bulkGet=function(e){var t=this;return this._trans("readonly",function(n){return t.core.getMany({keys:e,trans:n}).then(function(e){return e.map(function(e){return t.hook.reading.fire(e)})})})},tn.prototype.bulkAdd=function(e,t,n){var r=this,o=Array.isArray(t)?t:void 0,i=(n=n||(o?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",function(t){var n=r.schema.primKey,s=n.auto,n=n.keyPath;if(n&&o)throw new U.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new U.InvalidArgument("Arguments objects and keys must have the same length");var a=e.length,s=n&&s?e.map(e5(n)):e;return r.core.mutate({trans:t,type:"add",keys:o,values:s,wantResults:i}).then(function(e){var t=e.numFailures,n=e.failures;if(0===t)return i?e.results:e.lastResult;throw new W("".concat(r.name,".bulkAdd(): ").concat(t," of ").concat(a," operations failed"),n)})})},tn.prototype.bulkPut=function(e,t,n){var r=this,o=Array.isArray(t)?t:void 0,i=(n=n||(o?void 0:t))?n.allKeys:void 0;return this._trans("readwrite",function(t){var n=r.schema.primKey,s=n.auto,n=n.keyPath;if(n&&o)throw new U.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(o&&o.length!==e.length)throw new U.InvalidArgument("Arguments objects and keys must have the same length");var a=e.length,s=n&&s?e.map(e5(n)):e;return r.core.mutate({trans:t,type:"put",keys:o,values:s,wantResults:i}).then(function(e){var t=e.numFailures,n=e.failures;if(0===t)return i?e.results:e.lastResult;throw new W("".concat(r.name,".bulkPut(): ").concat(t," of ").concat(a," operations failed"),n)})})},tn.prototype.bulkUpdate=function(e){var t=this,n=this.core,r=e.map(function(e){return e.key}),o=e.map(function(e){return e.changes}),i=[];return this._trans("readwrite",function(s){return n.getMany({trans:s,keys:r,cache:"clone"}).then(function(a){var u=[],l=[],c=(e.forEach(function(e,n){var r=e.key,o=e.changes,s=a[n];if(s){for(var c=0,d=Object.keys(o);cf+h&&u(f+d)})})})(0).then(function(){if(0{for(var s=Math.min(e.length,r.length),a=-1,u=0;uo(e[u],n[u])?e.substr(0,u)+n[u]+n.substr(u+1):0>o(e[u],r[u])?e.substr(0,u)+r[u]+n.substr(u+1):0<=a?e.substr(0,a)+t[a]+n.substr(a+1):null;0>o(e[u],l)&&(a=u)}return s=o(e[0],e[1])}))return ty(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",U.InvalidArgument);var u,l=!t||!1!==t.includeLowers,c=t&&!0===t.includeUppers,d=o;function f(e,t){return d(e[0],t[0])}try{(u=e.reduce(function(e,t){for(var n=0,o=e.length;nr(t[0],i[1])&&0typeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)},i=n.schema,a=n.hasGetAll,n=i.tables.map(function(e){var t=e.name;return{name:t,schema:e,mutate:function(e){var n=e.trans,o=e.type,i=e.keys,s=e.values,a=e.range;return new Promise(function(e,u){e=eT(e);var l=n.objectStore(t),c=null==l.keyPath,d="put"===o||"add"===o;if(!d&&"delete"!==o&&"deleteRange"!==o)throw Error("Invalid operation type: "+o);var f,h=(i||s||{length:1}).length;if(i&&s&&i.length!==s.length)throw Error("Given keys array must have same length as given values array.");if(0===h)return e({numFailures:0,failures:{},results:[],lastResult:void 0});function m(e){++g,tk(e)}var p=[],y=[],g=0;if("deleteRange"===o){if(4===a.type)return e({numFailures:g,failures:y,results:[],lastResult:void 0});3===a.type?p.push(f=l.clear()):p.push(f=l.delete(r(a)))}else{var c=d?c?[s,i]:[s,null]:[i,null],v=c[0],b=c[1];if(d)for(var x=0;xtypeof navigator&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&o.WorkerGlobalScope&&o instanceof o.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(e._hasGetAll=!1)}function tH(e){return e.split(",").map(function(e,t){var n=e.split(":"),r=null==(r=n[1])?void 0:r.trim(),n=(e=n[0].trim()).replace(/([&*]|\+\+)/g,""),o=/^\[/.test(n)?n.match(/^\[(.*)\]$/)[1].split("+"):n;return tA(n,o||null,/\&/.test(e),/\*/.test(e),/\+\+/.test(e),s(o),0===t,r)})}function tY(){}function tQ(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new n_(eJ,{addons:[],indexedDB:e,IDBKeyRange:t})).version(1).stores({dbnames:"name"}),n.table("dbnames")}function tX(e){return e&&"function"==typeof e.databases}function tZ(e){return eK(function(){return ep.letThrough=!0,e()})}function tJ(e){return!("from"in e)}tY.prototype._createTableSchema=tR,tY.prototype._parseIndexSyntax=tH,tY.prototype._parseStoresSpec=function(e,t){var n=this;i(e).forEach(function(r){if(null!==e[r]){var o=n._parseIndexSyntax(e[r]),i=o.shift();if(!i)throw new U.Schema("Invalid schema for table "+r+": "+e[r]);if(i.unique=!0,i.multi)throw new U.Schema("Primary key cannot be multiEntry*");o.forEach(function(e){if(e.auto)throw new U.Schema("Only primary key can be marked as autoIncrement (++)");if(!e.keyPath)throw new U.Schema("Index must have a name and cannot be an empty string")}),i=n._createTableSchema(r,i,o),t[r]=i}})},tY.prototype.stores=function(e){var t=this.db,e=(this._cfg.storesSource=this._cfg.storesSource?a(this._cfg.storesSource,e):e,t._versions),n={},r={};return e.forEach(function(e){a(n,e._cfg.storesSource),r=e._cfg.dbschema={},e._parseStoresSpec(n,r)}),t._dbSchema=r,tq(t,[t._allTables,t,t.Transaction.prototype]),tB(t,[t._allTables,t,t.Transaction.prototype,this._cfg.tables],i(r),r),t._storeNames=i(r),this},tY.prototype.upgrade=function(e){return this._cfg.contentUpgrade=et(this._cfg.contentUpgrade||G,e),this};var t0=function(e,t){var n;if(!this)return n=new t0,e&&"d"in e&&a(n,e),n;a(this,arguments.length?{d:1,from:e,to:1e6(n,e.from))return r?t1(r,t,n):e.l={from:t,to:n,d:1,l:null,r:null},t4(e);if(0e6(t,e.from)&&(e.from=t,e.l=null,e.d=o?o.d+1:1),0=e6(a.from,o.to)&&0<=e6(a.to,o.from))return!0;0>e6(o.from,a.from)?o=(r=n.next(a.from)).value:a=(s=i.next(o.from)).value}return!1}function t5(e){var t=tJ(e)?null:{s:0,n:e};return{next:function(e){for(var n=0e6(e,t.n.from);)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!n||0>=e6(e,t.n.to))return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function t4(e){var t,r,o,i=((null==(i=e.r)?void 0:i.d)||0)-((null==(i=e.l)?void 0:i.d)||0),i=1=e6(t.from,e)&&0<=e6(t.to,e)}})[R]=function(){return t5(this)},K));var t9={},ne={},nt=!1;function nn(e){t7(ne,e),nt||(nt=!0,setTimeout(function(){nt=!1,nr(ne,(ne={},!1))},0))}function nr(e,t){void 0===t&&(t=!1);var n=new Set;if(e.all)for(var r=0,o=Object.values(t9);re6(n,r.upper):0>=e6(n,r.upper)))}function nv(e,t,n,r,o,i){var a,u,l,c,d,f;return n&&0!==n.length&&(u=(a=t.query.index).multiEntry,l=t.query.range,c=r.schema.primaryKey.extractKey,d=a.extractKey,f=(a.lowLevelIndex||a).extractKey,(r=n.reduce(function(e,n){var r=e,o=[];if("add"===n.type||"put"===n.type)for(var i=new t0,a=n.values.length-1;0<=a;--a){var f,h=n.values[a],m=c(h);!i.hasKey(m)&&(f=d(h),u&&s(f)?f.some(function(e){return ng(e,l)}):ng(f,l))&&(i.addKey(m),o.push(h))}switch(n.type){case"add":var p=(new t0).addKeys(t.values?e.map(function(e){return c(e)}):e),r=e.concat(t.values?o.filter(function(e){return e=c(e),!p.hasKey(e)&&(p.addKey(e),!0)}):o.map(function(e){return c(e)}).filter(function(e){return!p.hasKey(e)&&(p.addKey(e),!0)}));break;case"put":var y=(new t0).addKeys(n.values.map(function(e){return c(e)}));r=e.filter(function(e){return!y.hasKey(t.values?c(e):e)}).concat(t.values?o:o.map(function(e){return c(e)}));break;case"delete":var g=(new t0).addKeys(n.keys);r=e.filter(function(e){return!g.hasKey(t.values?c(e):e)});break;case"deleteRange":var v=n.range;r=e.filter(function(e){return!ng(c(e),v)})}return r},e))!==e)?(r.sort(function(e,t){return e6(f(e),f(t))||e6(c(e),c(t))}),t.limit&&t.limit<1/0&&(r.length>t.limit?r.length=t.limit:e.length===t.limit&&r.length{var o=t9["idb://".concat(e,"/").concat(t)];if(!o)return[];if(!(e=o.queries[n]))return[null,!1,o,null];var i=e[(r.query?r.query.index.name:null)||""];if(!i)return[null,!1,o,null];switch(n){case"query":var s=i.find(function(e){return e.req.limit===r.limit&&e.req.values===r.values&&nb(e.req.query.range,r.query.range)});return s?[s,!0,o,i]:[i.find(function(e){var t,n;return("limit"in e.req?e.req.limit:1/0)>=r.limit&&(!r.values||e.req.values)&&(t=e.req.query.range,n=r.query.range,0>=((e,t,n,r)=>{if(void 0===e)return void 0!==t?-1:0;if(void 0===t)return 1;if(0===(e=e6(e,t))){if(n&&r)return 0;if(n)return 1;if(r)return -1}return e})(t.lower,n.lower,t.lowerOpen,n.lowerOpen)&&0<=((e,t,n,r)=>{if(void 0===e)return+(void 0!==t);if(void 0===t)return -1;if(0===(e=e6(e,t))){if(n&&r)return 0;if(n)return -1;if(r)return 1}return e})(t.upper,n.upper,t.upperOpen,n.upperOpen))}),!1,o,i];case"count":return[s=i.find(function(e){return nb(e.req.query.range,r.query.range)}),!!s,o,i]}})(t,r,"query",e))[0],a=l[2],u=l[3],c&&l[1]?c.obsSet=e.obsSet:(l=o.query(e).then(function(e){var t=e.result;if(c&&(c.res=t),n){for(var r=0,o=t.length;r0x4000000000000000?0:r.oldVersion)<1,e.idbdb=h.result,s&&function(e,t){t$(e._dbSchema,t),t.db.version%10!=0||t.objectStoreNames.contains("$meta")||t.db.createObjectStore("$meta").add(Math.ceil(t.db.version/10-1),"version");var n=tV(0,e.idbdb,t);tG(e,e._dbSchema,t);for(var r=0,o=tL(n,e._dbSchema).change;r{if(e.change.length||e.recreate)return console.warn("Unable to patch indexes of table ".concat(e.name," because it has changes on the type of index or primary key.")),{value:void 0};var n=t.objectStore(e.name);e.add.forEach(function(t){en&&console.debug("Dexie upgrade patch: Creating missing index ".concat(e.name,".").concat(t.src)),tU(n,t)})})(o[r]);if("object"==typeof i)return i.value}}(e,c),a=o/10,u=c,m=e._dbSchema,(u.objectStoreNames.contains("$meta")&&!m.$meta&&(m.$meta=tR("$meta",tH("")[0],[]),e._storeNames.push("$meta")),p=e._createTransaction("readwrite",e._storeNames,m)).create(u),p._completion.catch(l),y=p._reject.bind(p),g=ep.transless||ep,eK(function(){if(ep.trans=p,ep.transless=g,0!==a)return tK(e,u),(p.storeNames.includes("$meta")?p.table("$meta").get("version").then(function(e){return null!=e?e:a}):eb.resolve(a)).then(function(t){var n=t,r=[],t=e._versions,o=e._dbSchema=tV(0,e.idbdb,u);return 0===(t=t.filter(function(e){return e._cfg.version>=n})).length?eb.resolve():(t.forEach(function(t){r.push(function(){var r,s,a,l=o,c=t._cfg.dbschema,d=(tG(e,l,u),tG(e,c,u),o=e._dbSchema=c,tL(l,c)),f=(d.add.forEach(function(e){tW(u,e[0],e[1].primKey,e[1].indexes)}),d.change.forEach(function(e){if(e.recreate)throw new U.Upgrade("Not yet support for changing primary key");var t=u.objectStore(e.name);e.add.forEach(function(e){return tU(t,e)}),e.change.forEach(function(e){t.deleteIndex(e.name),tU(t,e)}),e.del.forEach(function(e){return t.deleteIndex(e)})}),t._cfg.contentUpgrade);if(f&&t._cfg.version>n)return tK(e,u),p._memoizedTables={},r=S(c),d.del.forEach(function(e){r[e]=l[e]}),tq(e,[e.Transaction.prototype]),tB(e,[e.Transaction.prototype],i(r),r),p.schema=r,(s=F(f))&&eB(),c=eb.follow(function(){var e;(a=f(p))&&s&&(e=eq.bind(null,null),a.then(e,e))}),a&&"function"==typeof a.then?eb.resolve(a):c.then(function(){return a})}),r.push(function(n){var r=t._cfg.dbschema;[].slice.call(n.db.objectStoreNames).forEach(function(e){return null==r[e]&&n.db.deleteObjectStore(e)}),tq(e,[e.Transaction.prototype]),tB(e,[e.Transaction.prototype],e._storeNames,e._dbSchema),p.schema=e._dbSchema}),r.push(function(n){e.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(e.idbdb.version/10)===t._cfg.version?(e.idbdb.deleteObjectStore("$meta"),delete e._dbSchema.$meta,e._storeNames=e._storeNames.filter(function(e){return"$meta"!==e})):n.objectStore("$meta").put(t._cfg.version,"version"))})}),(function e(){return r.length?eb.resolve(r.shift()(p.idbtrans)).then(e):eb.resolve()})().then(function(){t$(o,u)}))}).catch(y);i(m).forEach(function(e){tW(u,e,m[e].primKey,m[e].indexes)}),tK(e,u),eb.follow(function(){return e.on.populate.fire(p)}).catch(y)}))},l),h.onsuccess=eT(function(){c=null;var n,a,l,m,p=e.idbdb=h.result,y=g(p.objectStoreNames);if(0e6(e,t)?e:t},this._IDBKeyRange=a._deps.IDBKeyRange,!this._IDBKeyRange)throw new U.MissingAPI})),this.on("versionchange",function(e){0typeof Symbol&&"observable"in Symbol?Symbol.observable:"@@observable",nj=(nN.prototype.subscribe=function(e,t,n){return this._subscribe(e&&"function"!=typeof e?e:{next:e,error:t,complete:n})},nN.prototype[ei]=function(){return this},nN);function nN(e){this._subscribe=e}try{nk={indexedDB:o.indexedDB||o.mozIndexedDB||o.webkitIndexedDB||o.msIndexedDB,IDBKeyRange:o.IDBKeyRange||o.webkitIDBKeyRange}}catch(e){nk={indexedDB:null,IDBKeyRange:null}}function nC(e){var t,n=!1,r=new nj(function(r){var o,i=F(e),s=!1,a={},u={},l={get closed(){return s},unsubscribe:function(){s||(s=!0,o&&o.abort(),d&&tC.storagemutated.unsubscribe(h))}},d=(r.start&&r.start(l),!1),f=function(){return eG(m)},h=function(e){t7(a,e),t8(u,a)&&f()},m=function(){var l,m;!s&&nk.indexedDB&&(a={},l={},o&&o.abort(),Promise.resolve((t=>{var n=eC();try{i&&eB();var r=eK(e,t);return r=i?r.finally(eq):r}finally{n&&eE()}})(m={subscr:l,signal:(o=new AbortController).signal,requery:f,querier:e,trans:null})).then(function(e){n=!0,t=e,s||m.signal.aborted||(a={},(e=>{for(var t in e)if(c(e,t))return;return 1})(u=l)||d||(tC(tj,h),d=!0),eG(function(){return!s&&r.next&&r.next(e)}))},function(e){n=!1,["DatabaseClosedError","AbortError"].includes(null==e?void 0:e.name)||s||eG(function(){s||r.error&&r.error(e)})}))};return setTimeout(f,0),l});return r.hasValue=function(){return n},r.getValue=function(){return t},r}function nE(e){var t=nA;try{nA=!0,tC.storagemutated.fire(e),nr(e,!0)}finally{nA=t}}d(n_,n(n({},N),{delete:function(e){return new n_(e,{addons:[]}).delete()},exists:function(e){return new n_(e,{addons:[]}).open().then(function(e){return e.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){var t,n;try{return n=(t=n_.dependencies).indexedDB,t=t.IDBKeyRange,(tX(n)?Promise.resolve(n.databases()).then(function(e){return e.map(function(e){return e.name}).filter(function(e){return e!==eJ})}):tQ(n,t).toCollection().primaryKeys()).then(e)}catch(e){return eH(new U.MissingAPI)}},defineClass:function(){return function(e){a(this,e)}},ignoreTransaction:function(e){return ep.trans?eU(ep.transless,e):e()},vip:tZ,async:function(e){return function(){try{var t=ni(e.apply(this,arguments));return t&&"function"==typeof t.then?t:eb.resolve(t)}catch(e){return eH(e)}}},spawn:function(e,t,n){try{var r=ni(e.apply(n,t||[]));return r&&"function"==typeof r.then?r:eb.resolve(r)}catch(e){return eH(e)}},currentTransaction:{get:function(){return ep.trans||null}},waitFor:function(e,t){return e=eb.resolve("function"==typeof e?n_.ignoreTransaction(e):e).timeout(t||6e4),ep.trans?ep.trans.waitFor(e):e},Promise:eb,debug:{get:function(){return en},set:function(e){en=e}},derive:m,extend:a,props:d,override:v,Events:tr,on:tC,liveQuery:nC,extendObservabilitySet:t7,getByKeyPath:w,setByKeyPath:_,delByKeyPath:function(e,t){"string"==typeof t?_(e,t,void 0):"length"in t&&[].map.call(t,function(t){_(e,t,void 0)})},shallowClone:S,deepClone:P,getObjectDiff:nu,cmp:e6,asap:x,minKey:-1/0,addons:[],connections:eZ,errnames:$,dependencies:nk,cache:t9,semVer:"4.3.0",version:"4.3.0".split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/Math.pow(10,2*n)})})),n_.maxKey=tO(n_.dependencies.IDBKeyRange),"u">typeof dispatchEvent&&"u">typeof addEventListener&&(tC(tj,function(e){nA||(e=new CustomEvent(tN,{detail:e}),nA=!0,dispatchEvent(e),nA=!1)}),addEventListener(tN,function(e){e=e.detail,nA||nE(e)}));var nP,nA=!1,nT=function(){};return"u">typeof BroadcastChannel&&((nT=function(){(nP=new BroadcastChannel(tN)).onmessage=function(e){return e.data&&nE(e.data)}})(),"function"==typeof nP.unref&&nP.unref(),tC(tj,function(e){nA||nP.postMessage(e)})),"u">typeof addEventListener&&(addEventListener("pagehide",function(e){if(!n_.disableBfCache&&e.persisted){en&&console.debug("Dexie: handling persisted pagehide"),null!=nP&&nP.close();for(var t=0;t{"use strict";var t=e.i(252358);e.i(81174);var n=e.i(112272);let r="019cfd11-9232-0000-ed38-3cc8663b8948";e.s(["FusionEvent",0,{Compare:"compare",Rerun:"rerun",TryAnother:"try_another",SelectModelSet:"select_model_set",SelectSynthesizer:"select_synthesizer",ToggleWebSearch:"toggle_web_search",ImprovePrompt:"improve_prompt",ImprovePromptApply:"improve_prompt_apply",AddAttachment:"add_attachment",StopRun:"stop_run",DownloadMarkdown:"download_markdown"},"captureSurveyResponse",0,function(e){return t.posthogClient.capture("survey sent",{$survey_id:r,$survey_response:e}),!0},"isFeedbackSurveyConfigured",0,!!r,"trackFusionEvent",0,function(e,r){let o,i;o=`model_fusion:${e}`,i=Object.fromEntries(Object.entries(r??{}).map(([e,t])=>[(0,n.snakeCase)(e),t])),t.posthogClient.capture(o,i)}])},757062,e=>{"use strict";var t=e.i(505962),n=e.i(81174),r=e.i(349056);let o=Symbol.for("Dexie"),i=globalThis[o]||(globalThis[o]=r.default);if(r.default.semVer!==i.semVer)throw Error(`Two different versions of Dexie loaded in the same app: ${r.default.semVer} and ${i.semVer}`);let{liveQuery:s,mergeRanges:a,rangesOverlap:u,RangeSet:l,cmp:c,Entity:d,PropModification:f,replacePrefix:h,add:m,remove:p,DexieYProvider:y}=i,g=i;var v=e.i(270401),b=e.i(784814);class x extends g{runs;presets;constructor(){super("MixtureDatabase"),this.version(1).stores({runs:"++id, createdAt"}),this.version(2).stores({runs:"++id, createdAt",presets:"++id, label, createdAt"}),this.version(3).stores({runs:"++id, createdAt",presets:"++id, label, createdAt"}),this.version(4).stores({runs:"++id, createdAt",presets:"++id, label, createdAt"})}}let w=null;function _(){return w||(w=new x),w}let S={get runs(){return _().runs},get modelSets(){return _().presets}};async function k(e){return S.runs.add(e)}async function j(e){return S.runs.orderBy("createdAt").reverse().filter(t=>(0,b.isInWorkspacePartition)(t,e)).toArray()}async function N(e){return S.modelSets.orderBy("createdAt").filter(t=>(0,b.isInWorkspacePartition)(t,e)).toArray()}async function C(e,t){await S.runs.update(e,t)}async function E(e){await S.runs.delete(e)}async function P(e){return S.modelSets.add(e)}async function A(e){await S.modelSets.delete(e)}class T{values=new Map;get(e){return this.values.get(e)}set(e,t){this.values.set(e,t)}}function R(e){return(0,n.wLog)("Dexie live query error",{error:e})}e.s(["LiveQueryCache",0,T,"deleteModelSet",0,A,"deleteRun",0,E,"deserializeResponses",0,function(e){let t={};for(let[n,r]of Object.entries(e))t[n]={...r,reasoning:r.reasoning??"",isLoading:!1};return t},"fusionDb",0,S,"listModelSetsForPartition",0,N,"listRunsForPartition",0,j,"saveModelSet",0,P,"saveRun",0,k,"serializeResponses",0,function(e){let t={};for(let[n,r]of Object.entries(e))t[n]={content:r.content,reasoning:r.reasoning,error:r.error,errorStatus:r.errorStatus,totalTime:r.totalTime,tokenCount:r.tokenCount};return t},"updateRun",0,C,"useLiveQuery",0,function(e){let n,r,o=(0,t.c)(8),{querier:i,deps:a,defaultValue:u,cache:l,cacheKey:c}=e;o[0]!==l||o[1]!==c||o[2]!==u?(n=()=>(function({cache:e,cacheKey:t,defaultValue:n}){return void 0===e||void 0===t?n:e.get(t)??n})({cache:l,cacheKey:c,defaultValue:u}),o[0]=l,o[1]=c,o[2]=u,o[3]=n):n=o[3];let[d,f]=(0,v.useState)(n);return o[4]!==l||o[5]!==c||o[6]!==i?(r=()=>{let e=s(i).subscribe({next:e=>{void 0!==l&&void 0!==c&&l.set(c,e),f(e)},error:R});return()=>e.unsubscribe()},o[4]=l,o[5]=c,o[6]=i,o[7]=r):r=o[7],(0,v.useEffect)(r,a),d}],757062)},88689,120765,925204,665898,426431,250141,e=>{"use strict";var t=e.i(215370),n=e.i(719929),r=e.i(748151),o=e.i(81174),i=e.i(80125),s=e.i(706527),a=e.i(217631),u=e.i(693697),l=e.i(948810),c=e.i(639241),d=e.i(624621),f=e.i(624665),h=e.i(679728),m=e.i(757062),p=e.i(60628),y=e.i(981895),g=e.i(568728),v=e.i(596504),b=e.i(958969),x=e.i(12822),w=e.i(462904),_=e.i(678130);async function*S(e){for await(let t of(0,_.processSSE)(e)){if((0,u.isErr)(t))return void(yield(0,w.errT)({status:n.HTTPStatus.S502_Bad_Gateway,rawError:t.error,location:"processStream:sse"}));if(t.data===x.sseDoneSentinel)break;let e=(0,u.wrap)(()=>JSON.parse(t.data));if((0,u.isErr)(e))return void(yield(0,w.errT)({status:n.HTTPStatus.S502_Bad_Gateway,rawError:e.error,location:"processStream:json-parse"}));let r=e.data;if("error"===r.type||(0,w.isErrorResponse)(r)){let e=r.error??r.message??"Unknown streaming error";yield(0,w.errT)({rawError:e,location:"processStream:streaming",metadata:r.error?.metadata});return}yield(0,u.ok)(r)}}async function k(e){let{config:t,callbacks:n,signal:r,reject:i}=e,s={content:{},reasoning:{},analysis:null,synthesis:"",didCompleteFusionCall:!1,didCompleteSynthesis:!1,preFusionText:"",responses:[],failedModels:[]};try{var a,l,c;let e,d=await fetch("/api/v1/responses",{method:"POST",headers:{"Content-Type":"application/json",...function(e){let{origin:t,pathname:n}=window.location;return{"HTTP-Referer":`${t}${n}`,"X-OpenRouter-Title":e}}("OpenRouter: Fusion")},body:JSON.stringify((a=t,e=[{type:"input_text",text:a.prompt},...a.contentParts??[]],{model:b.RouterModel.Fusion,stream:!0,tool_choice:"required",...void 0!==a.maxCompletionTokens?{max_output_tokens:a.maxCompletionTokens}:{},input:[{role:"user",content:e}],tools:[{type:p.OpenRouterServerToolType.OpenRouterFusion,parameters:{analysis_models:a.analysisModels,model:a.analystModel,...a.reasoning?{reasoning:a.reasoning}:{},...void 0!==a.temperature?{temperature:a.temperature}:{},...void 0!==a.maxCompletionTokens?{max_completion_tokens:a.maxCompletionTokens}:{},...void 0!==a.webSearchEnabled?{web_search:a.webSearchEnabled}:{}}}]})),signal:r});if(!d.ok){let e,t=await d.text();n.onError({message:(l=t,e=(0,v.safeParseJson)(l),null!==e&&"object"==typeof e&&e.error?.metadata?.code===g.NO_ACTIVE_WORKSPACE_ERROR_CODE)?g.NO_ACTIVE_WORKSPACE_USER_MESSAGE:t||`HTTP ${d.status}`,stage:"connection",reason:"http_error"});return}if(!d.body)return void n.onError({message:"Empty response body",stage:"connection",reason:"empty_body"});let f=!1,h={...n,onDone:e=>{f=!0,n.onDone(e)},onError:e=>{f=!0,n.onError(e)}};for await(let e of S(d.body)){if(r?.aborted)break;if((0,u.isErr)(e)){return void h.onError({message:(0,y.isNoActiveWorkspaceError)(e.error)?g.NO_ACTIVE_WORKSPACE_USER_MESSAGE:(c=e.error,"string"==typeof c?c:c instanceof Error||null!==c&&"object"==typeof c&&"message"in c&&"string"==typeof c.message?c.message:"Fusion stream failed"),stage:"stream",reason:"stream_error"})}!function(e){let{event:t,accumulator:n,callbacks:r}=e;switch(t.type){case"response.fusion_call.panel.added":n.content[t.model]="",n.reasoning[t.model]="",r.onPanelDelta(t.model,{content:"",reasoning:"",isLoading:!0,error:null});return;case"response.fusion_call.panel.delta":n.content[t.model]=(n.content[t.model]??"")+t.delta,r.onPanelDelta(t.model,{content:n.content[t.model]??"",reasoning:n.reasoning[t.model]??"",isLoading:!0,error:null});return;case"response.fusion_call.panel.reasoning.delta":n.reasoning[t.model]=(n.reasoning[t.model]??"")+t.delta,r.onPanelDelta(t.model,{content:n.content[t.model]??"",reasoning:n.reasoning[t.model]??"",isLoading:!0,error:null});return;case"response.fusion_call.panel.completed":n.content[t.model]=t.content,n.responses.push({model:t.model,content:t.content}),r.onPanelComplete({model:t.model,content:t.content,reasoning:n.reasoning[t.model]??""});return;case"response.fusion_call.panel.failed":n.failedModels.push({model:t.model,error:t.error,...void 0!==t.status_code?{status_code:t.status_code}:{}}),r.onPanelError({model:t.model,error:t.error,statusCode:t.status_code});return;case"response.fusion_call.analysis.in_progress":return r.onAnalysisStarted();case"response.fusion_call.analysis.completed":n.analysis=t.analysis,r.onAnalysisComplete(t.analysis);return;case"response.fusion_call.completed":n.didCompleteFusionCall=!0;return;case"response.output_text.delta":if(!n.didCompleteFusionCall){n.preFusionText+=t.delta;return}n.synthesis+=t.delta,r.onSynthesisDelta(n.synthesis);return;case"response.output_text.done":n.didCompleteFusionCall&&""!==n.synthesis&&(n.didCompleteSynthesis=!0);return;case"response.completed":case"response.incomplete":n.didCompleteFusionCall||""!==n.synthesis||""===n.preFusionText||(n.synthesis=n.preFusionText,r.onSynthesisDelta(n.synthesis)),r.onDone({analysis:n.analysis??j,responses:n.responses,failed_models:n.failedModels});return;case"response.failed":if(n.didCompleteSynthesis){(0,o.wLog)("fusion synthesis completed but stream emitted a trailing response.failed",{error_message:t.response.error?.message??null,error_code:t.response.error?.code??null}),r.onDone({analysis:n.analysis??j,responses:n.responses,failed_models:n.failedModels});return}r.onError({message:t.response.error?.message??"Fusion run failed before completion",stage:"server",reason:t.response.error?.code??"response_failed"})}}({event:e.data,accumulator:s,callbacks:h})}f||i(r?.aborted?{message:"Aborted",stage:"connection",reason:"aborted"}:{message:"Stream ended without completion event",stage:"connection",reason:"unexpected_end"})}catch(e){if(r?.aborted)return void i({message:"Aborted",stage:"connection",reason:"aborted"});n.onError({message:e instanceof Error?e.message:"Stream connection failed",stage:"connection",reason:"fetch_error"})}}e.s(["processResponseStream",0,S],120765);let j={consensus:[],contradictions:[],partial_coverage:[],unique_insights:[],blind_spots:[]};var N=e.i(505962),C=e.i(270401),E=e.i(789836);let P={runs:{}},A=new Map,T=new Map,R=new Map,O=new Map,I=new Map,D=new Map;function M(e,t){let n=e.runs[t];if(n)return n;let r={responses:{},analysisContent:null,synthesisContent:null};return e.runs[t]=r,r}let F=(0,l.create)()((0,E.mutative)(e=>({...P,setResponses:(t,n)=>{e(e=>{M(e,t).responses=n})},queueResponseUpdate:({runId:t,slug:n,response:r})=>{let o=A.get(t);if(o||(o=new Map,A.set(t,o)),o.set(n,r),!T.has(t)){let n=setTimeout(()=>{let n=A.get(t);n&&0!==n.size?e(e=>{let r=M(e,t);for(let[e,t]of n)r.responses[e]=t;n.clear(),T.delete(t)}):T.delete(t)},100);T.set(t,n)}},setAnalysisContent:(t,n)=>{if(null===n){R.delete(t);let n=O.get(t);n&&(clearTimeout(n),O.delete(t)),e(e=>{M(e,t).analysisContent=null});return}if(R.set(t,{value:n}),!O.has(t)){let n=setTimeout(()=>{let n=R.get(t);e(e=>{n&&(M(e,t).analysisContent=n.value),R.delete(t),O.delete(t)})},100);O.set(t,n)}},setSynthesisContent:(t,n)=>{if(null===n||""===n){I.delete(t);let r=D.get(t);r&&(clearTimeout(r),D.delete(t)),e(e=>{M(e,t).synthesisContent=n});return}if(I.set(t,{value:n}),!D.has(t)){let n=setTimeout(()=>{let n=I.get(t);e(e=>{n&&(M(e,t).synthesisContent=n.value),I.delete(t),D.delete(t)})},100);D.set(t,n)}},flushPending:t=>{let n=A.get(t),r=R.get(t),o=I.get(t),i=void 0!==n&&n.size>0,s=void 0!==r,a=void 0!==o;(i||s||a)&&e(e=>{let u=M(e,t);if(i&&n){for(let[e,t]of n)u.responses[e]=t;n.clear();let e=T.get(t);e&&(clearTimeout(e),T.delete(t))}if(s&&r){u.analysisContent=r.value,R.delete(t);let e=O.get(t);e&&(clearTimeout(e),O.delete(t))}if(a&&o){u.synthesisContent=o.value,I.delete(t);let e=D.get(t);e&&(clearTimeout(e),D.delete(t))}})},clearRun:t=>{let n,r,o,i;(n=A.get(t))&&(n.clear(),A.delete(t)),(r=T.get(t))&&(clearTimeout(r),T.delete(t)),R.delete(t),(o=O.get(t))&&(clearTimeout(o),O.delete(t)),I.delete(t),(i=D.get(t))&&(clearTimeout(i),D.delete(t)),e(e=>{delete e.runs[t]})}})));function K(e,t){return null===t?{}:e.runs[t]?.responses??{}}function B(e,t){return null===t?null:e.runs[t]?.analysisContent??null}function q(e,t){return null===t?null:e.runs[t]?.synthesisContent??null}e.s(["getRunAnalysisContent",0,B,"getRunResponses",0,K,"getRunSynthesisContent",0,q,"useAnalysisContent",0,function(e){let t,n=(0,N.c)(2);return n[0]!==e?(t=t=>B(t,e),n[0]=e,n[1]=t):t=n[1],F(t)},"useFusionStreamingStore",0,F,"useModelResponse",0,function(e,t){let n,r=(0,N.c)(3);return r[0]!==e||r[1]!==t?(n=n=>null!==e?n.runs[e]?.responses[t]:void 0,r[0]=e,r[1]=t,r[2]=n):n=r[2],F(n)},"useSynthesisContent",0,function(e){let t,n=(0,N.c)(2);return n[0]!==e?(t=t=>q(t,e),n[0]=e,n[1]=t):t=n[1],F(t)}],925204);let z="Insufficient credits to run models.";function L(e,t){return null!==e&&"object"==typeof e&&"message"in e&&e.message===g.NO_ACTIVE_WORKSPACE_USER_MESSAGE?g.NO_ACTIVE_WORKSPACE_USER_MESSAGE:Object.values(t).some(e=>e.errorStatus===n.HTTPStatus.S402_Payment_Required)?z:"Fusion failed. You can retry from the results view."}e.s(["PAYMENT_ERROR_MESSAGE",0,z,"getFirstPassErrorMessage",0,L],665898);let W=new Map;function $(e){return W.has(e)}function U(e){let t=W.get(e);t&&(t.abort(),W.delete(e))}function V(e){W.delete(e)}let G={phase:"idle",isAnalyzing:!1,error:null,startTime:null,endTime:null},H={phase:"idle",prompt:"",isAnalyzing:!1,startTime:null,endTime:null,error:null,attachmentContentParts:[],resetGeneration:0,currentRunDbId:null},Y=(0,l.create)()((0,c.persist)((e,t)=>{let l=(n,r)=>{let{runLifecycles:o}=t(),i={...o[n]??G,...r},s={runLifecycles:{...o,[n]:i}};n===t().currentRunDbId&&(void 0!==r.phase&&(s.phase=r.phase),void 0!==r.isAnalyzing&&(s.isAnalyzing=r.isAnalyzing),void 0!==r.error&&(s.error=r.error),void 0!==r.startTime&&(s.startTime=r.startTime),void 0!==r.endTime&&(s.endTime=r.endTime)),e(s)},c=async(r,i)=>{let c,h=(U(r),c=new AbortController,W.set(r,c),c),p=await (0,u.wrap)(async()=>{let c=Date.now();l(r,{phase:"streaming",isAnalyzing:!1,startTime:c,endTime:null,error:null}),e({currentRunDbId:r,phase:"streaming",isAnalyzing:!1,startTime:c,endTime:null,error:null});let p=(e,t)=>{h.signal.aborted||F.getState().queueResponseUpdate({runId:r,slug:e,response:t})},y=i.synthesizerSlug;y||(y=(0,s.getModelVariantSlug)(i.selectedModels[0])),i.synthesizerSlug=y;let g=await (0,u.wrap)(()=>{var e,o,u;return e={prompt:i.prompt,analysisModels:i.selectedModels.map(e=>(0,s.getModelVariantSlug)(e)),analystModel:y,maxCompletionTokens:i.maxCompletionTokens??void 0,reasoning:i.reasoningEffort?{effort:i.reasoningEffort}:void 0,temperature:i.temperature??void 0,webSearchEnabled:i.isWebSearchEnabled,contentParts:i.attachmentContentParts.length>0?i.attachmentContentParts:void 0},o={onPanelDelta:(e,t)=>{p(e,t)},onPanelComplete:({model:e,content:t,reasoning:n})=>{p(e,{content:t,reasoning:n,isLoading:!1,error:null})},onPanelError:({model:e,error:t,statusCode:r})=>{p(e,{content:"",reasoning:"",isLoading:!1,error:t,errorStatus:(0,a.isMember)(r,n.HTTPStatus)?r:null})},onAnalysisStarted:()=>{l(r,{isAnalyzing:!0})},onAnalysisComplete:e=>{F.getState().setAnalysisContent(r,e),l(r,{isAnalyzing:!1,phase:"all-complete"})},onSynthesisDelta:e=>{h.signal.aborted||(t().runLifecycles[r]?.phase!=="synthesizing"&&l(r,{phase:"synthesizing",error:null}),F.getState().setSynthesisContent(r,e))},onDone:()=>{},onError:()=>{}},u=h.signal,new Promise((t,n)=>{k({config:e,callbacks:{...o,onDone:e=>{o.onDone(e),t(e)},onError:e=>{o.onError(e),n(e)}},signal:u,reject:n})})});if(h.signal.aborted)return;if((0,u.isErr)(g)){F.getState().flushPending(r);let e=K(F.getState(),r);if(r>0){let t=F.getState(),n=await (0,u.wrap)(()=>(0,m.updateRun)(r,{responses:(0,m.serializeResponses)(e),analysisContent:B(t,r),synthesisContent:q(t,r)??null,synthesizerSlug:y}));(0,u.isErr)(n)&&(0,o.wLog)("Failed to persist partial fusion run after error",{error:n.error})}return l(r,{phase:"all-complete",isAnalyzing:!1,error:L(g.error,e)}),V(r),d.useChatroomStore.getState().isChatNotificationsEnabled&&(0,f.showFusionCompletionNotification)("first-pass-error"),r>0?r:void 0}F.getState().flushPending(r);let v=K(F.getState(),r),b=q(F.getState(),r);if(r===t().currentRunDbId&&e({synthesizerSlug:y}),r>0){let e=await (0,u.wrap)(()=>(0,m.updateRun)(r,{responses:(0,m.serializeResponses)(v),analysisContent:g.data.analysis,synthesisContent:b??null,isSynthesized:!!b,synthesizerSlug:y,isComplete:!0}));(0,u.isErr)(e)&&(0,o.wLog)("Failed to update fusion run in Dexie",{error:e.error})}return l(r,{phase:"complete",isAnalyzing:!1,endTime:Date.now()}),V(r),d.useChatroomStore.getState().isChatNotificationsEnabled&&(0,f.showFusionCompletionNotification)("final-pass"),r>0?r:void 0});if((0,u.isErr)(p)){let e=h.signal.aborted;e||(0,o.wLog)("Unexpected error in fusion run",{error:p.error}),V(r),e||l(r,{phase:"idle",error:"Something went wrong. Please try again."});return}return p.data};return{...H,runLifecycles:{},workspacePartitionId:null,didResolveWorkspacePartition:!1,selectedModelSet:r.DEFAULT_MODEL_SET_ID,selectedModels:[],isSidebarOpen:!0,synthesizerSlug:r.DEFAULT_FUSION_ANALYST_SLUG,isWebSearchEnabled:!0,reasoningEffort:i.CompletionRequestReasoningEffort.High,temperature:null,maxCompletionTokens:null,setPrompt:t=>e({prompt:t}),selectModelSet:(t,n)=>{e({selectedModelSet:t,selectedModels:n}),"custom"!==t&&"number"!=typeof t&&(0,h.trackFusionEvent)(h.FusionEvent.SelectModelSet,{modelSetId:t})},setSelectedModels:t=>e({selectedModels:t}),toggleCustomModel:n=>{let{selectedModels:r}=t(),o=(0,s.getModelVariantSlug)(n);r.some(e=>(0,s.getModelVariantSlug)(e)===o)?e({selectedModels:r.filter(e=>(0,s.getModelVariantSlug)(e)!==o)}):e({selectedModels:[...r,n]})},removeModel:n=>{let{selectedModels:r}=t();e({selectedModelSet:"custom",selectedModels:r.filter(e=>(0,s.getModelVariantSlug)(e)!==n)})},setSynthesizerSlug:t=>{e({synthesizerSlug:t}),t&&(0,h.trackFusionEvent)(h.FusionEvent.SelectSynthesizer,{})},setWebSearchEnabled:t=>{e({isWebSearchEnabled:t}),(0,h.trackFusionEvent)(h.FusionEvent.ToggleWebSearch)},setReasoningEffort:t=>e({reasoningEffort:t}),setTemperature:t=>e({temperature:t}),setMaxCompletionTokens:t=>e({maxCompletionTokens:t}),setAttachmentContentParts:t=>e({attachmentContentParts:t}),compare:async()=>{let n,{prompt:r,selectedModels:i,didResolveWorkspacePartition:a}=t();if(!a||!r.trim()||i.length<2)return;(0,f.requestNotificationPermission)().catch(()=>{});let l={prompt:r,selectedModels:[...i],synthesizerSlug:t().synthesizerSlug,isWebSearchEnabled:t().isWebSearchEnabled,reasoningEffort:t().reasoningEffort,temperature:t().temperature,maxCompletionTokens:t().maxCompletionTokens,attachmentContentParts:[...t().attachmentContentParts]},{selectedModelSet:d}=t(),p=i.map(e=>(0,s.getModelVariantSlug)(e));(0,h.trackFusionEvent)(h.FusionEvent.Compare,{modelCount:i.length,promptLength:r.length}),e({phase:"streaming",isAnalyzing:!1,error:null});let y=await (0,u.wrap)(()=>(0,m.saveRun)({createdAt:new Date,prompt:r,presetId:d,modelSlugs:p,responses:{},isSynthesized:!1,synthesizerSlug:null,synthesisContent:null,analysisContent:null,isWebSearchEnabled:l.isWebSearchEnabled,isComplete:!1,workspaceId:t().workspacePartitionId??void 0}));return(0,u.isErr)(y)?((0,o.wLog)("Failed to save run to Dexie",{error:y.error}),n=-Date.now()):(n=y.data,window.history.replaceState(null,"",`/fusion/${n}`)),c(n,l)},rerun:async()=>{let{prompt:e,selectedModels:n,currentRunDbId:r}=t();if(null===r||!e.trim()||n.length<2)return;(0,f.requestNotificationPermission)().catch(()=>{});let i={prompt:e,selectedModels:[...n],synthesizerSlug:t().synthesizerSlug,isWebSearchEnabled:t().isWebSearchEnabled,reasoningEffort:t().reasoningEffort,temperature:t().temperature,maxCompletionTokens:t().maxCompletionTokens,attachmentContentParts:[...t().attachmentContentParts]};if((0,h.trackFusionEvent)(h.FusionEvent.Rerun,{modelCount:n.length,promptLength:e.length}),U(r),F.getState().clearRun(r),l(r,{phase:"streaming",isAnalyzing:!1,error:null}),r>0){let e=await (0,u.wrap)(()=>(0,m.updateRun)(r,{responses:{},analysisContent:null,synthesisContent:null,isSynthesized:!1,isComplete:!1}));(0,u.isErr)(e)&&(0,o.wLog)("Failed to reset fusion run before rerun",{error:e.error})}await c(r,i)},tryAnother:()=>{(0,h.trackFusionEvent)(h.FusionEvent.TryAnother,{}),t().resetWorkspace()},stopRun:e=>{let n=e??t().currentRunDbId;if(null===n||!W.has(n))return;(0,h.trackFusionEvent)(h.FusionEvent.StopRun,{}),U(n),F.getState().setSynthesisContent(n,null),F.getState().flushPending(n);let r=t().runLifecycles[n];r&&"complete"!==r.phase&&"idle"!==r.phase&&l(n,{phase:"all-complete",isAnalyzing:!1,error:null,endTime:Date.now()})},resetWorkspace:()=>{e({...H,resetGeneration:t().resetGeneration+1})},setWorkspacePartition:n=>{let{workspacePartitionId:o,didResolveWorkspacePartition:i,resetGeneration:s}=t();if(!i)return void e({workspacePartitionId:n,didResolveWorkspacePartition:!0});if(o===n)return;let{selectedModelSet:a}=t();e({...H,workspacePartitionId:n,resetGeneration:s+1,..."number"==typeof a?{selectedModelSet:r.DEFAULT_MODEL_SET_ID,selectedModels:[]}:{}})},initializeFromRun:(n,r)=>{e({...H,resetGeneration:t().resetGeneration+1,prompt:n,selectedModelSet:r})},loadPastRun:(n,r)=>{let o=(0,m.deserializeResponses)(n.responses),i=n.modelSlugs[0]??null,s=n.id??null;if(null!==s&&!$(s)){let e=F.getState();e.setResponses(s,o),e.setAnalysisContent(s,n.analysisContent??null),e.setSynthesisContent(s,n.synthesisContent),e.flushPending(s)}let a=null!==s?t().runLifecycles[s]:void 0,u=a?.phase??(n.isSynthesized?"complete":"all-complete"),l=a?.isAnalyzing??!1,c=a?.error??null,d=a?.startTime??n.createdAt.getTime(),f=a?.endTime??n.createdAt.getTime();e({resetGeneration:t().resetGeneration+1,phase:u,prompt:n.prompt,selectedModelSet:n.presetId,selectedModels:r??[],synthesizerSlug:n.synthesizerSlug??i,isWebSearchEnabled:n.isWebSearchEnabled??!1,isAnalyzing:l,startTime:d,endTime:f,error:c,attachmentContentParts:[],currentRunDbId:s})},deleteRun:async n=>{U(n),F.getState().clearRun(n);let{runLifecycles:r}=t(),{[n]:i,...s}=r;n===t().currentRunDbId?e({...H,runLifecycles:s,resetGeneration:t().resetGeneration+1}):e({runLifecycles:s});let a=await (0,u.wrap)(()=>(0,m.deleteRun)(n));(0,u.isErr)(a)&&(0,o.wLog)("Failed to delete run from Dexie",{error:a.error})},toggleSidebar:()=>{let{isSidebarOpen:n}=t();e({isSidebarOpen:!n})},saveModelSet:async n=>{let{selectedModels:r,didResolveWorkspacePartition:i}=t();if(!i)return;let a=r.map(e=>(0,s.getModelVariantSlug)(e)),l=await (0,u.wrap)(()=>(0,m.saveModelSet)({label:n,modelSlugs:a,createdAt:new Date,workspaceId:t().workspacePartitionId??void 0}));(0,u.isErr)(l)?(0,o.wLog)("Failed to save model set to Dexie",{error:l.error}):e({selectedModelSet:l.data})},deleteUserModelSet:async n=>{let{selectedModelSet:r}=t(),i=await (0,u.wrap)(()=>(0,m.deleteModelSet)(n));(0,u.isErr)(i)?(0,o.wLog)("Failed to delete model set from Dexie",{error:i.error}):r===n&&e({selectedModelSet:"custom"})}}},{name:"openrouter:mixture-settings",version:2,storage:(0,c.createJSONStorage)(()=>localStorage),partialize:e=>({synthesizerSlug:e.synthesizerSlug,isWebSearchEnabled:e.isWebSearchEnabled,maxCompletionTokens:e.maxCompletionTokens,reasoningEffort:e.reasoningEffort,temperature:e.temperature,prompt:e.prompt,selectedModelSet:e.selectedModelSet,modelSlugs:e.selectedModels.map(s.getModelVariantSlug)}),migrate:(e,t)=>{if(0===t&&null!=e&&"object"==typeof e&&"selectedPreset"in e){let{selectedPreset:t,...n}=e;return{...n,selectedModelSet:t,synthesizerSlug:r.DEFAULT_FUSION_ANALYST_SLUG}}return t<=1&&null!=e&&"object"==typeof e&&"synthesizerSlug"in e&&null===e.synthesizerSlug?{...e,synthesizerSlug:r.DEFAULT_FUSION_ANALYST_SLUG}:e}}));function Q(e){return e.didResolveWorkspacePartition}function X(e){return e.workspacePartitionId}e.s(["isRunActive",0,$,"useFusionStore",0,Y],426431),e.s(["useIsWorkspacePartitionCurrent",0,function(){let e=(0,t.useActiveWorkspacePartition)(),n=Y(X);return Y(Q)&&e.isReady&&e.partitionId===n}],88689);var Z=e.i(612960);function J(e){return e.setWorkspacePartition}e.s(["useWorkspacePartitionSync",0,function(){let e,n,r=(0,N.c)(6),o=(0,t.useActiveWorkspacePartition)(),i=Y(J),s=(0,Z.useLocalizedRouter)();r[0]!==o.isReady||r[1]!==o.partitionId||r[2]!==s||r[3]!==i?(e=()=>{if(!o.isReady)return;let{didResolveWorkspacePartition:e,workspacePartitionId:t}=Y.getState(),n=e&&t!==o.partitionId;i(o.partitionId),n&&window.location.pathname.startsWith("/fusion/")&&s.replace("/fusion")},n=[o.isReady,o.partitionId,i,s],r[0]=o.isReady,r[1]=o.partitionId,r[2]=s,r[3]=i,r[4]=e,r[5]=n):(e=r[4],n=r[5]),(0,C.useEffect)(e,n)}],250141)},411349,e=>{"use strict";var t=e.i(222666),n=e.i(505962),r=e.i(435954),o=e.i(665155),i=e.i(527315),s=e.i(133256),a=e.i(152533),u=e.i(270401);let l=u.forwardRef(function({title:e,titleId:t,...n},r){return u.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?u.createElement("title",{id:t},e):null,u.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 3v17.25m0 0c-1.472 0-2.882.265-4.185.75M12 20.25c1.472 0 2.882.265 4.185.75M18.75 4.97A48.416 48.416 0 0 0 12 4.5c-2.291 0-4.545.16-6.75.47m13.5 0c1.01.143 2.01.317 3 .52m-3-.52 2.62 10.726c.122.499-.106 1.028-.589 1.202a5.988 5.988 0 0 1-2.031.352 5.988 5.988 0 0 1-2.031-.352c-.483-.174-.711-.703-.59-1.202L18.75 4.971Zm-16.5.52c.99-.203 1.99-.377 3-.52m0 0 2.62 10.726c.122.499-.106 1.028-.589 1.202a5.989 5.989 0 0 1-2.031.352 5.989 5.989 0 0 1-2.031-.352c-.483-.174-.711-.703-.59-1.202L5.25 4.971Z"}))});var c=e.i(452473),d=e.i(557225),f=e.i(706527),h=e.i(426431),m=e.i(925204),p=e.i(277281);function y(e){var r;let o,i,s,a,l,f,h,m,y,v,b,x,w=(0,n.c)(25),{models:_,className:S}=e,[k,j]=(0,u.useState)(0);(w[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{j(g)},w[0]=o):o=w[0],(0,p.useInterval)(o,1e3),w[1]!==k||w[2]!==_.length)?(s=Math.min(Math.floor(k/4),(i=[(r=_.length)>0?`Reading ${r} model ${1===r?"response":"responses"}`:"Reading every model response","Comparing answers side by side","Finding where the models agree","Spotting contradictions and trade-offs","Surfacing unique insights and blind spots","Writing up the analysis"]).length-1),w[1]=k,w[2]=_.length,w[3]=i,w[4]=s):(i=w[3],s=w[4]);let N=s,C=i[N]??i[0],E=0===N&&_.length>0?k%_.length:-1;if(w[5]!==S?(a=(0,c.cn)("flex flex-col gap-3",S),w[5]=S,w[6]=a):a=w[6],w[7]===Symbol.for("react.memo_cache_sentinel")?(l=(0,t.jsx)("div",{className:"h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent text-muted-foreground"}),w[7]=l):l=w[7],w[8]!==C?(f=(0,t.jsx)("span",{className:"text-sm font-medium text-foreground",children:C}),w[8]=C,w[9]=f):f=w[9],w[10]!==k){let e,t;e=Math.floor(k/60),t=Math.floor(k%60),h=`${e}:${t.toString().padStart(2,"0")}`,w[10]=k,w[11]=h}else h=w[11];return w[12]!==h?(m=(0,t.jsx)("span",{className:"ml-auto text-xs tabular-nums text-muted-foreground",children:h}),w[12]=h,w[13]=m):m=w[13],w[14]!==f||w[15]!==m?(y=(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[l,f,m]}),w[14]=f,w[15]=m,w[16]=y):y=w[16],w[17]!==E||w[18]!==_?(v=_.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:_.map((e,n)=>(0,t.jsxs)("span",{className:(0,c.cn)("inline-flex items-center gap-1.5 rounded-md border px-2 py-1 text-xs transition-colors",n===E?"border-border bg-muted text-foreground":"border-border/60 text-muted-foreground"),children:[(0,t.jsx)(d.AuthorIcon,{author:e.author,className:"!size-3.5 shrink-0 !border-0 !p-0 !shadow-none"}),e.name]},`${e.author}-${e.name}`))}),w[17]=E,w[18]=_,w[19]=v):v=w[19],w[20]===Symbol.for("react.memo_cache_sentinel")?(b=(0,t.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"We’re gathering and comparing every response, which can take up to a minute. The full analysis will appear once done."}),w[20]=b):b=w[20],w[21]!==a||w[22]!==y||w[23]!==v?(x=(0,t.jsxs)("div",{role:"status","aria-live":"polite",className:a,children:[y,v,b]}),w[21]=a,w[22]=y,w[23]=v,w[24]=x):x=w[24],x}function g(e){return e+1}let v=[{key:"consensus",label:"Agreement",icon:r.CheckCircleIcon,color:"text-muted-foreground"},{key:"contradictions",label:"Key Differences",icon:l,color:"text-muted-foreground"},{key:"partial_coverage",label:"Partial Coverage",icon:a.MagnifyingGlassIcon,color:"text-muted-foreground"},{key:"unique_insights",label:"Unique Insights",icon:s.LightBulbIcon,color:"text-muted-foreground"},{key:"blind_spots",label:"Blind Spots",icon:i.ExclamationTriangleIcon,color:"text-muted-foreground"}];function b(e){let r,o,i=(0,n.c)(4),{items:s}=e;return i[0]!==s?(r=s.map(x),i[0]=s,i[1]=r):r=i[1],i[2]!==r?(o=(0,t.jsx)("ul",{className:"pl-5",children:r}),i[2]=r,i[3]=o):o=i[3],o}function x(e){return(0,t.jsx)("li",{className:"mt-1.5 first:mt-0 text-sm text-foreground/85 leading-relaxed list-disc marker:text-muted-foreground/40",children:e},e)}function w(e){let r,o,i=(0,n.c)(5),{modelName:s,author:a}=e;return i[0]!==a?(r=a&&(0,t.jsx)(d.AuthorIcon,{author:a,className:"!size-3.5 !border-0 !shadow-none !p-0 shrink-0"}),i[0]=a,i[1]=r):r=i[1],i[2]!==s||i[3]!==r?(o=(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 shrink-0 text-2xs font-medium text-muted-foreground bg-muted px-1.5 py-px rounded-sm",children:[r,s]}),i[2]=s,i[3]=r,i[4]=o):o=i[4],o}function _(e){let r,o,i=(0,n.c)(7),{items:s,authorMap:a}=e;if(i[0]!==a||i[1]!==s){let e;i[3]!==a?(e=e=>(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-sm font-medium text-foreground/90 mb-1",children:e.topic}),(0,t.jsx)("div",{className:"flex flex-col gap-y-1 pl-3 border-l-2 border-border",children:e.stances.map(e=>(0,t.jsxs)("div",{className:"flex items-baseline gap-2 text-sm",children:[(0,t.jsx)(w,{modelName:e.model,author:a.get(e.model)}),(0,t.jsx)("span",{className:"text-foreground/75",children:e.stance})]},`${e.model}-${e.stance}`))})]},e.topic),i[3]=a,i[4]=e):e=i[4],r=s.map(e),i[0]=a,i[1]=s,i[2]=r}else r=i[2];return i[5]!==r?(o=(0,t.jsx)("div",{className:"flex flex-col gap-y-3",children:r}),i[5]=r,i[6]=o):o=i[6],o}function S(e){let r,o,i=(0,n.c)(7),{items:s,authorMap:a}=e;if(i[0]!==a||i[1]!==s){let e;i[3]!==a?(e=e=>(0,t.jsxs)("li",{className:"mt-1.5 first:mt-0 text-sm text-foreground/85 leading-relaxed list-disc marker:text-muted-foreground/40",children:[e.point,e.models.length>0&&(0,t.jsx)("span",{className:"inline-flex gap-1 ml-1.5 align-middle",children:e.models.map(e=>(0,t.jsx)(w,{modelName:e,author:a.get(e)},e))})]},e.point),i[3]=a,i[4]=e):e=i[4],r=s.map(e),i[0]=a,i[1]=s,i[2]=r}else r=i[2];return i[5]!==r?(o=(0,t.jsx)("ul",{className:"pl-5",children:r}),i[5]=r,i[6]=o):o=i[6],o}function k(e){let r,o,i=(0,n.c)(7),{items:s,authorMap:a}=e;if(i[0]!==a||i[1]!==s){let e;i[3]!==a?(e=e=>(0,t.jsxs)("li",{className:"mt-1.5 first:mt-0 text-sm text-foreground/85 leading-relaxed list-disc marker:text-muted-foreground/40",children:[e.insight,(0,t.jsx)("span",{className:"inline-flex ml-1.5 align-middle",children:(0,t.jsx)(w,{modelName:e.model,author:a.get(e.model)})})]},`${e.model}-${e.insight}`),i[3]=a,i[4]=e):e=i[4],r=s.map(e),i[0]=a,i[1]=s,i[2]=r}else r=i[2];return i[5]!==r?(o=(0,t.jsx)("ul",{className:"pl-5",children:r}),i[5]=r,i[6]=o):o=i[6],o}function j(e){let r,o,i=(0,n.c)(4),{items:s}=e;return i[0]!==s?(r=s.map(N),i[0]=s,i[1]=r):r=i[1],i[2]!==r?(o=(0,t.jsx)("ul",{className:"pl-5",children:r}),i[2]=r,i[3]=o):o=i[3],o}function N(e){return(0,t.jsx)("li",{className:"mt-1.5 first:mt-0 text-sm text-foreground/85 leading-relaxed list-disc marker:text-muted-foreground/40",children:e},e)}function C(e){let r=(0,n.c)(13),{analysis:o,dimensionKey:i,authorMap:s}=e;switch(i){case"consensus":{let e;return r[0]!==o.consensus?(e=(0,t.jsx)(b,{items:o.consensus}),r[0]=o.consensus,r[1]=e):e=r[1],e}case"contradictions":{let e;return r[2]!==o.contradictions||r[3]!==s?(e=(0,t.jsx)(_,{items:o.contradictions,authorMap:s}),r[2]=o.contradictions,r[3]=s,r[4]=e):e=r[4],e}case"partial_coverage":{let e;return r[5]!==o.partial_coverage||r[6]!==s?(e=(0,t.jsx)(S,{items:o.partial_coverage,authorMap:s}),r[5]=o.partial_coverage,r[6]=s,r[7]=e):e=r[7],e}case"unique_insights":{let e;return r[8]!==o.unique_insights||r[9]!==s?(e=(0,t.jsx)(k,{items:o.unique_insights,authorMap:s}),r[8]=o.unique_insights,r[9]=s,r[10]=e):e=r[10],e}case"blind_spots":{let e;return r[11]!==o.blind_spots?(e=(0,t.jsx)(j,{items:o.blind_spots}),r[11]=o.blind_spots,r[12]=e):e=r[12],e}default:return null}}function E(e){let r,i,s,a,l,d,f,h,m,p,y,g,v,b,x,w=(0,n.c)(42),{config:_,analysis:S,authorMap:k}=e,[j,N]=(0,u.useState)(!1);w[0]!==S||w[1]!==_.key?(r=function(e,t){switch(t){case"consensus":return e.consensus.length;case"contradictions":return e.contradictions.length;case"partial_coverage":return e.partial_coverage.length;case"unique_insights":return e.unique_insights.length;case"blind_spots":return e.blind_spots.length;default:return 0}}(S,_.key),w[0]=S,w[1]=_.key,w[2]=r):r=w[2];let E=r;if(0===E)return null;if(w[3]!==S||w[4]!==_.key){let e=function(e,t){switch(t){case"consensus":return e.consensus[0]??"";case"contradictions":return e.contradictions.map(e=>e.topic).join(", ");case"partial_coverage":return e.partial_coverage.map(e=>e.point).join(", ");case"unique_insights":return e.unique_insights.map(e=>e.insight).join(", ");case"blind_spots":return e.blind_spots[0]??"";default:return""}}(S,_.key);i=e.length>120?`${e.slice(0,120)}…`:e,w[3]=S,w[4]=_.key,w[5]=i}else i=w[5];let A=i,T=_.icon,R=j?"border-border bg-background":"border-border bg-background hover:bg-muted/50";w[6]!==R?(s=(0,c.cn)("rounded-lg border transition-colors",R),w[6]=R,w[7]=s):s=w[7],w[8]===Symbol.for("react.memo_cache_sentinel")?(a=()=>N(P),w[8]=a):a=w[8],w[9]!==_.color?(l=(0,c.cn)("h-4 w-4 shrink-0",_.color),w[9]=_.color,w[10]=l):l=w[10],w[11]!==T||w[12]!==l?(d=(0,t.jsx)(T,{className:l}),w[11]=T,w[12]=l,w[13]=d):d=w[13],w[14]!==_.label?(f=(0,t.jsx)("span",{className:"text-sm font-medium text-foreground flex-1 truncate",children:_.label}),w[14]=_.label,w[15]=f):f=w[15],w[16]!==E?(h=(0,t.jsx)("span",{className:"text-xs text-muted-foreground tabular-nums shrink-0",children:E}),w[16]=E,w[17]=h):h=w[17];let O=j&&"rotate-180";return w[18]!==O?(m=(0,c.cn)("h-3.5 w-3.5 text-muted-foreground transition-transform shrink-0",O),w[18]=O,w[19]=m):m=w[19],w[20]!==m?(p=(0,t.jsx)(o.ChevronDownIcon,{className:m}),w[20]=m,w[21]=p):p=w[21],w[22]!==p||w[23]!==d||w[24]!==f||w[25]!==h?(y=(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[d,f,h,p]}),w[22]=p,w[23]=d,w[24]=f,w[25]=h,w[26]=y):y=w[26],w[27]!==j||w[28]!==A?(g=!j&&A&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1.5 line-clamp-2 leading-relaxed pl-7",children:A}),w[27]=j,w[28]=A,w[29]=g):g=w[29],w[30]!==y||w[31]!==g?(v=(0,t.jsxs)("button",{type:"button",onClick:a,className:"w-full text-left px-4 py-3",children:[y,g]}),w[30]=y,w[31]=g,w[32]=v):v=w[32],w[33]!==S||w[34]!==k||w[35]!==_.key||w[36]!==j?(b=j&&(0,t.jsx)("div",{className:"px-4 pb-3",children:(0,t.jsx)(C,{analysis:S,dimensionKey:_.key,authorMap:k})}),w[33]=S,w[34]=k,w[35]=_.key,w[36]=j,w[37]=b):b=w[37],w[38]!==v||w[39]!==b||w[40]!==s?(x=(0,t.jsxs)("div",{className:s,children:[v,b]}),w[38]=v,w[39]=b,w[40]=s,w[41]=x):x=w[41],x}function P(e){return!e}function A(e){let r,o,i,s,a=(0,n.c)(10),{isAnalyzing:u}=e,l=(0,h.useFusionStore)(R),c=(0,m.useAnalysisContent)(l),d=(0,h.useFusionStore)(T);if(a[0]!==d){for(let e of(r=new Map,d))r.set(e.short_name,e.author),r.set((0,f.getModelVariantSlug)(e),e.author);a[0]=d,a[1]=r}else r=a[1];let p=r;return c&&(c.consensus.length>0||c.contradictions.length>0||c.partial_coverage.length>0||c.unique_insights.length>0||c.blind_spots.length>0)?(a[2]!==c||a[3]!==p?(o=v.map(e=>(0,t.jsx)(E,{config:e,analysis:c,authorMap:p},e.key)),a[2]=c,a[3]=p,a[4]=o):o=a[4],a[5]!==u?(i=u&&(0,t.jsxs)("div",{className:"flex items-center gap-2 text-muted-foreground py-2 px-4",children:[(0,t.jsx)("div",{className:"h-3 w-3 rounded-full border-2 border-current border-t-transparent animate-spin"}),(0,t.jsx)("span",{className:"text-xs",children:"Loading more sections..."})]}),a[5]=u,a[6]=i):i=a[6],a[7]!==o||a[8]!==i?(s=(0,t.jsxs)("div",{className:"flex flex-col gap-y-2",children:[o,i]}),a[7]=o,a[8]=i,a[9]=s):s=a[9],s):null}function T(e){return e.selectedModels}function R(e){return e.currentRunDbId}function O(){let e,r,o,i=(0,n.c)(9),s=(0,h.useFusionStore)(M),a=(0,h.useFusionStore)(D);i[0]!==s?(e=e=>(0,m.getRunResponses)(e,s),i[0]=s,i[1]=e):e=i[1];let u=(0,m.useFusionStreamingStore)(e);if(i[2]!==u||i[3]!==a){let e;i[5]!==u?(e=e=>{let t=u[(0,f.getModelVariantSlug)(e)];return void 0!==t&&!t.isLoading&&!t.error},i[5]=u,i[6]=e):e=i[6],r=a.filter(e).map(I),i[2]=u,i[3]=a,i[4]=r}else r=i[4];let l=r;return i[7]!==l?(o=(0,t.jsx)(y,{models:l}),i[7]=l,i[8]=o):o=i[8],o}function I(e){return{name:e.short_name,author:e.author}}function D(e){return e.selectedModels}function M(e){return e.currentRunDbId}function F(e){return e.currentRunDbId}function K(e){return e.isAnalyzing}e.s(["AnalysisCard",0,function(){let e,r,o,i,s=(0,n.c)(10),a=(0,h.useFusionStore)(K),u=(0,h.useFusionStore)(F);s[0]!==u?(e=e=>null!==(0,m.getRunAnalysisContent)(e,u),s[0]=u,s[1]=e):e=s[1];let l=(0,m.useFusionStreamingStore)(e);return s[2]!==l||s[3]!==a?(r=a&&!l&&(0,t.jsx)(O,{}),s[2]=l,s[3]=a,s[4]=r):r=s[4],s[5]!==a?(o=(0,t.jsx)(A,{isAnalyzing:a}),s[5]=a,s[6]=o):o=s[6],s[7]!==r||s[8]!==o?(i=(0,t.jsxs)("div",{className:"ph-no-capture","data-dd-privacy":"hidden",children:[r,o]}),s[7]=r,s[8]=o,s[9]=i):i=s[9],i},"DIMENSIONS",0,v,"DimensionRow",0,E],411349)},895394,214872,677453,894686,e=>{"use strict";var t=e.i(222666),n=e.i(505962),r=e.i(270401);let o=r.forwardRef(function({title:e,titleId:t,...n},o){return r.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:o,"aria-labelledby":t},n),e?r.createElement("title",{id:t},e):null,r.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.625 9.75a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0H8.25m4.125 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0H12m4.125 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm0 0h-.375m-13.5 3.01c0 1.6 1.123 2.994 2.707 3.227 1.087.16 2.185.283 3.293.369V21l4.184-4.183a1.14 1.14 0 0 1 .778-.332 48.294 48.294 0 0 0 5.83-.498c1.585-.233 2.708-1.626 2.708-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z"}))});var i=e.i(528164),s=e.i(778084),a=e.i(823634),u=e.i(648156),l=e.i(679728);e.s(["FeedbackWidget",0,function(){let e,c,d,f,h,m,p,y,g=(0,n.c)(16),[v,b]=(0,r.useState)(""),[x,w]=(0,r.useState)(!1),[_,S]=(0,r.useState)(!1),k=(0,r.useRef)(void 0);if(g[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>()=>clearTimeout(k.current),c=[],g[0]=e,g[1]=c):(e=g[0],c=g[1]),(0,r.useEffect)(e,c),!l.isFeedbackSurveyConfigured)return null;g[2]===Symbol.for("react.memo_cache_sentinel")?(d=e=>{clearTimeout(k.current),w(e),e||S(!1)},g[2]=d):d=g[2];let j=d;g[3]!==v?(f=()=>{let e=v.trim();e&&((0,l.captureSurveyResponse)(e),b(""),S(!0),k.current=setTimeout(()=>{w(!1),S(!1)},1500))},g[3]=v,g[4]=f):f=g[4];let N=f,C=x?void 0:"Send feedback";return g[5]===Symbol.for("react.memo_cache_sentinel")?(h=(0,t.jsx)(s.PopoverTrigger,{render:(0,t.jsx)("button",{type:"button",className:"inline-flex items-center justify-center h-10 w-10 rounded-lg bg-muted/80 text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:(0,t.jsx)(o,{className:"h-5 w-5"})})}),g[5]=h):h=g[5],g[6]!==C?(m=(0,t.jsx)(u.Tooltip,{content:C,children:h}),g[6]=C,g[7]=m):m=g[7],g[8]!==_||g[9]!==v||g[10]!==N?(p=(0,t.jsx)(s.PopoverContent,{side:"top",align:"end",className:"w-80 p-3",children:_?(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-2",children:"Thanks for your feedback!"}):(0,t.jsxs)("div",{className:"flex flex-col gap-y-2",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:"What can we do to improve Model Fusion?"}),(0,t.jsx)(a.Textarea,{value:v,onChange:e=>b(e.target.value),placeholder:"Share bugs, ideas, or general feedback",className:"min-h-[80px] text-sm resize-none",maxLength:2e3}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(i.Button,{size:"sm",onClick:N,disabled:!v.trim(),children:"Submit"})})]})}),g[8]=_,g[9]=v,g[10]=N,g[11]=p):p=g[11],g[12]!==x||g[13]!==m||g[14]!==p?(y=(0,t.jsxs)(s.Popover,{open:x,onOpenChange:j,children:[m,p]}),g[12]=x,g[13]=m,g[14]=p,g[15]=y):y=g[15],y}],895394);var c=e.i(452473),d=e.i(394333);function f(){let e,r,o,i,s,a=(0,n.c)(5);return a[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,c.cn)("flex h-full w-[260px] shrink-0 flex-col gap-2","bg-background border-r border-border","p-2"),a[0]=e):e=a[0],a[1]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsxs)("div",{className:"flex items-center justify-between px-1",children:[(0,t.jsx)(d.Skeleton,{className:"h-5 w-16"}),(0,t.jsx)(d.Skeleton,{className:"size-7 rounded-md"})]}),o=(0,t.jsx)(d.Skeleton,{className:"h-8 w-full rounded-md"}),i=(0,t.jsx)(d.Skeleton,{className:"h-8 w-full rounded-md"}),a[1]=r,a[2]=o,a[3]=i):(r=a[1],o=a[2],i=a[3]),a[4]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsxs)("div",{className:e,children:[r,o,i,(0,t.jsx)("div",{className:"shrink-0 -mx-2 py-4",children:(0,t.jsx)("div",{className:"h-px bg-border"})}),(0,t.jsx)(d.Skeleton,{className:"ml-3 h-3 w-12"}),(0,t.jsx)(d.VerticalSkeletonGroup,{className:"mt-1",count:8,skeletonClassName:"h-8 w-full rounded-md"})]}),a[4]=s):s=a[4],s}function h(){let e,r,o,i=(0,n.c)(3);return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(d.Skeleton,{className:"h-7 w-64"}),r=(0,t.jsx)(d.Skeleton,{className:"h-36 w-full rounded-xl"}),i[0]=e,i[1]=r):(e=i[0],r=i[1]),i[2]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)("div",{className:"flex-1 flex flex-col justify-center",children:(0,t.jsxs)("div",{className:"w-full max-w-3xl mx-auto px-4 py-8 flex flex-col gap-4",children:[e,r,(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(d.Skeleton,{className:"h-8 w-32 rounded-md"}),(0,t.jsx)(d.Skeleton,{className:"h-8 w-24 rounded-md"}),(0,t.jsx)(d.Skeleton,{className:"ml-auto size-8 rounded-full"})]})]})}),i[2]=o):o=i[2],o}function m(){let e,r,o,i=(0,n.c)(3);return i[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsxs)("div",{className:"flex flex-col gap-3 rounded-lg border border-border p-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(d.Skeleton,{className:"h-4 w-24"}),(0,t.jsx)(d.Skeleton,{className:"h-4 w-16"})]}),(0,t.jsx)(d.Skeleton,{className:"h-3 w-full"}),(0,t.jsx)(d.Skeleton,{className:"h-3 w-2/3"})]}),i[0]=e):e=i[0],i[1]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsxs)(p,{children:[(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(d.Skeleton,{className:"h-8 w-28 rounded-md"}),(0,t.jsx)(d.Skeleton,{className:"h-8 w-28 rounded-md"}),(0,t.jsx)(d.Skeleton,{className:"h-8 w-28 rounded-md"})]}),(0,t.jsx)(y,{})]}),i[1]=r):r=i[1],i[2]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsxs)("div",{className:"w-full max-w-3xl mx-auto px-4 pt-8 pb-12 flex flex-col gap-y-6",children:[e,r,(0,t.jsx)(p,{children:(0,t.jsx)(y,{})})]}),i[2]=o):o=i[2],o}function p(e){let r,o,i=(0,n.c)(3),{children:s}=e;return i[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)(d.Skeleton,{className:"h-4 w-20"}),(0,t.jsx)(d.Skeleton,{className:"h-3 w-8"})]}),i[0]=r):r=i[0],i[1]!==s?(o=(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[r,s]}),i[1]=s,i[2]=o):o=i[2],o}function y(){let e,r=(0,n.c)(1);return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,t.jsx)(d.Skeleton,{className:"h-3 w-full"}),(0,t.jsx)(d.Skeleton,{className:"h-3 w-full"}),(0,t.jsx)(d.Skeleton,{className:"h-3 w-full"}),(0,t.jsx)(d.Skeleton,{className:"h-3 w-1/2"})]}),r[0]=e):e=r[0],e}e.s(["FusionPageSkeleton",0,function(e){let r,o,i,s,a=(0,n.c)(5),{variant:u}=e;return a[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,c.cn)("fixed inset-x-0 bottom-0 top-[calc(var(--navbar-top,0px)+3.5rem)] flex flex-col md:flex-row","w-full text-foreground","overflow-hidden","bg-background","border-t border-border"),a[0]=r):r=a[0],a[1]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)("div",{className:"h-full min-h-0 hidden md:block",children:(0,t.jsx)(f,{})}),i=(0,c.cn)("flex flex-1 flex-col min-w-0","min-h-0 h-full overflow-hidden"),a[1]=o,a[2]=i):(o=a[1],i=a[2]),a[3]!==u?(s=(0,t.jsxs)("div",{role:"status","aria-label":"Loading Fusion",className:r,children:[o,(0,t.jsx)("div",{className:i,children:"composer"===u?(0,t.jsx)(h,{}):(0,t.jsx)(m,{})})]}),a[3]=u,a[4]=s):s=a[4],s},"FusionRunContentSkeleton",0,function(){let e,r=(0,n.c)(1);return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("div",{role:"status","aria-label":"Loading run",children:(0,t.jsx)(m,{})}),r[0]=e):e=r[0],e}],214872);var g=e.i(797738),v=e.i(749509),b=e.i(524268),x=e.i(612960),w=e.i(426431),_=e.i(57965),S=e.i(649896),k=e.i(936927),j=e.i(757062),N=e.i(239718),C=e.i(53375),E=e.i(543019),P=e.i(120612);e.i(406201);var A=e.i(806024);function T(e){let r,o,i,s,a=(0,n.c)(16),{run:u}=e,l=(0,w.useFusionStore)(I),c=(0,w.useFusionStore)(O),d=(0,w.useFusionStore)(R),f=(0,x.useLocalizedRouter)(),h=(0,v.useParams)(),m=h?.runId?Number(h.runId):null,p=m?u.id===m:u.id===l;a[0]!==u.id?(r=e=>{if(void 0===u.id)return!1;let t=e.runLifecycles[u.id];return t?"streaming"===t.phase||"synthesizing"===t.phase||t.isAnalyzing:(0,w.isRunActive)(u.id)},a[0]=u.id,a[1]=r):r=a[1];let y=(0,w.useFusionStore)(r);a[2]!==c||a[3]!==p||a[4]!==f||a[5]!==u.id?(o=async()=>{void 0!==u.id&&(await c(u.id),p&&f.push("/fusion"))},a[2]=c,a[3]=p,a[4]=f,a[5]=u.id,a[6]=o):o=a[6];let g=o;a[7]!==u.id||a[8]!==d?(i=()=>{void 0!==u.id&&d(u.id)},a[7]=u.id,a[8]=d,a[9]=i):i=a[9];let b=i;return a[10]!==g||a[11]!==b||a[12]!==p||a[13]!==y||a[14]!==u?(s=(0,t.jsx)(D,{run:u,isActive:p,isInProgress:y,onDelete:g,onStop:b}),a[10]=g,a[11]=b,a[12]=p,a[13]=y,a[14]=u,a[15]=s):s=a[15],s}function R(e){return e.stopRun}function O(e){return e.deleteRun}function I(e){return e.currentRunDbId}function D(e){let o,a,l,d,f,h,m,p,y,g,v,b,x,w,_,S,k,j,T=(0,n.c)(43),{run:R,isActive:O,isInProgress:I,onDelete:D,onStop:M}=e,[F,K]=(0,r.useState)(!1),[B,q]=(0,r.useState)(!1);T[0]!==R.prompt?(o=R.prompt.length>40?`${R.prompt.slice(0,40)}…`:R.prompt,T[0]=R.prompt,T[1]=o):o=T[1];let z=o,L=`/fusion/${R.id}`,W=O?"bg-accent text-accent-foreground":"hover:bg-card-hover";T[2]!==W?(a=(0,c.cn)("ph-no-capture group relative flex h-9 w-full items-center rounded-lg pr-1 transition-colors",W),T[2]=W,T[3]=a):a=T[3];let $=O&&"text-accent-foreground";T[4]!==$?(l=(0,c.cn)("flex h-full min-w-0 flex-1 items-center gap-2 pl-3 pr-2 text-sm font-medium","text-muted-foreground hover:text-accent-foreground",$),T[4]=$,T[5]=l):l=T[5],T[6]!==I?(d=I&&(0,t.jsxs)("span",{className:"relative flex h-2 w-2 shrink-0",children:[(0,t.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-primary/60"}),(0,t.jsx)("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-primary"})]}),T[6]=I,T[7]=d):d=T[7];let U=z||"Empty prompt";T[8]!==U?(f=(0,t.jsx)("span",{className:"truncate text-sm",children:U}),T[8]=U,T[9]=f):f=T[9],T[10]!==R.prompt||T[11]!==L||T[12]!==l||T[13]!==d||T[14]!==f?(h=(0,t.jsxs)(A.Link,{href:L,className:l,title:R.prompt,children:[d,f]}),T[10]=R.prompt,T[11]=L,T[12]=l,T[13]=d,T[14]=f,T[15]=h):h=T[15],T[16]!==I||T[17]!==M?(m=I&&(0,t.jsx)(u.Tooltip,{content:"Stop this fusion",children:(0,t.jsx)(i.Button,{variant:"ghost",size:"icon-sm",onClick:e=>{e.stopPropagation(),e.preventDefault(),M()},className:"h-7 w-7 text-muted-foreground hover:text-foreground","aria-label":"Stop run",children:(0,t.jsx)(C.StopIcon,{className:"h-4 w-4"})})}),T[16]=I,T[17]=M,T[18]=m):m=T[18];let V=O&&"opacity-100";return T[19]!==V?(p=(0,c.cn)("h-7 w-7 group-hover:opacity-100 focus-visible:opacity-100 md:opacity-0","data-[state=open]:opacity-100",V,"hover:bg-transparent dark:hover:bg-transparent"),T[19]=V,T[20]=p):p=T[20],T[21]===Symbol.for("react.memo_cache_sentinel")?(y=(0,t.jsx)(N.EllipsisHorizontalIcon,{className:"size-5"}),T[21]=y):y=T[21],T[22]!==p?(g=(0,t.jsx)(s.PopoverTrigger,{render:(0,t.jsx)(i.Button,{variant:"ghost",size:"icon-sm",className:p,"aria-label":"Run actions",children:y})}),T[22]=p,T[23]=g):g=T[23],T[24]===Symbol.for("react.memo_cache_sentinel")?(v=(0,t.jsx)(s.PopoverContent,{side:"right",className:"w-48 p-1.5 text-xs",children:(0,t.jsxs)(i.Button,{size:"sm",variant:"ghost",className:"w-full justify-start text-negative hover:text-negative",onClick:()=>{K(!1),q(!0)},children:[(0,t.jsx)(E.TrashIcon,{className:"size-4"})," Delete"]})}),T[24]=v):v=T[24],T[25]!==F||T[26]!==g?(b=(0,t.jsxs)(s.Popover,{open:F,onOpenChange:K,children:[g,v]}),T[25]=F,T[26]=g,T[27]=b):b=T[27],T[28]!==m||T[29]!==b?(x=(0,t.jsxs)("div",{className:"flex items-center",children:[m,b]}),T[28]=m,T[29]=b,T[30]=x):x=T[30],T[31]===Symbol.for("react.memo_cache_sentinel")?(w=(0,t.jsxs)(P.AlertDialogHeader,{children:[(0,t.jsx)(P.AlertDialogTitle,{children:"Delete fusion"}),(0,t.jsx)(P.AlertDialogDescription,{children:"This will permanently delete this fusion. This action cannot be undone."})]}),T[31]=w):w=T[31],T[32]===Symbol.for("react.memo_cache_sentinel")?(_=(0,t.jsx)(P.AlertDialogCancel,{children:"Cancel"}),T[32]=_):_=T[32],T[33]!==D?(S=(0,t.jsxs)(P.AlertDialogContent,{children:[w,(0,t.jsxs)(P.AlertDialogFooter,{children:[_,(0,t.jsx)(P.AlertDialogAction,{render:(0,t.jsx)(i.Button,{variant:"destructive",onClick:D,children:"Delete"})})]})]}),T[33]=D,T[34]=S):S=T[34],T[35]!==B||T[36]!==S?(k=(0,t.jsx)(P.AlertDialog,{open:B,onOpenChange:q,children:S}),T[35]=B,T[36]=S,T[37]=k):k=T[37],T[38]!==x||T[39]!==k||T[40]!==a||T[41]!==h?(j=(0,t.jsxs)("div",{className:a,"data-dd-privacy":"hidden",children:[h,x,k]}),T[38]=x,T[39]=k,T[40]=a,T[41]=h,T[42]=j):j=T[42],j}let M=[],F=new j.LiveQueryCache;function K(){let e,o,i,s,a,u,l,c,d,f,h,m,p,y=(0,n.c)(29),[g,v]=(0,r.useState)(""),[b,x]=(0,r.useState)(g),N=(0,w.useFusionStore)(z),C=(0,w.useFusionStore)(q);y[0]!==g?(e=()=>{let e=setTimeout(()=>{x(g)},250);return()=>clearTimeout(e)},o=[g],y[0]=g,y[1]=e,y[2]=o):(e=y[1],o=y[2]),(0,r.useEffect)(e,o),y[3]!==C||y[4]!==N?(i=()=>C?(0,j.listRunsForPartition)(N):Promise.resolve(M),s=[N,C],y[3]=C,y[4]=N,y[5]=i,y[6]=s):(i=y[5],s=y[6]);let E=`fusion-runs:${N??"legacy"}`;y[7]!==i||y[8]!==s||y[9]!==E?(a={querier:i,deps:s,defaultValue:M,cache:F,cacheKey:E},y[7]=i,y[8]=s,y[9]=E,y[10]=a):a=y[10];let P=(0,j.useLiveQuery)(a);y[11]!==b||y[12]!==P?(l=(u=b.trim().toLowerCase())?P.filter(e=>e.prompt.toLowerCase().includes(u)):P,y[11]=b,y[12]=P,y[13]=u,y[14]=l):(u=y[13],l=y[14]);let A=l;y[15]!==g?(c=(0,t.jsx)(S.HistorySidebarSearchRow,{placeholder:"Search runs...",value:g,onValueChange:v}),y[15]=g,y[16]=c):c=y[16],y[17]===Symbol.for("react.memo_cache_sentinel")?(d=(0,t.jsx)("div",{"aria-hidden":"true",className:"shrink-0 -mx-2 py-4",children:(0,t.jsx)("div",{className:"h-px bg-border"})}),y[17]=d):d=y[17];let T=1===A.length?"run":"runs";return y[18]!==T||y[19]!==A.length?(f=(0,t.jsx)("div",{className:"flex h-7 shrink-0 items-center",children:(0,t.jsxs)("span",{className:"inline-flex h-7 items-center pl-3 text-xs font-medium text-muted-foreground",children:[A.length," ",T]})}),y[18]=T,y[19]=A.length,y[20]=f):f=y[20],y[21]!==u||y[22]!==A?(h=(0,t.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto scrollbar-hide",children:0===A.length?(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:u?"No matching runs.":"No runs yet."}):(0,t.jsx)("div",{className:"flex flex-col gap-y-0.5",children:A.map(B)})}),y[21]=u,y[22]=A,y[23]=h):h=y[23],y[24]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)(k.WorkspaceSwitcher,{className:"mb-2",surface:_.WorkspaceSwitchSurface.Fusion}),y[24]=m):m=y[24],y[25]!==f||y[26]!==h||y[27]!==c?(p=(0,t.jsxs)("div",{className:"flex h-full min-h-0 w-full flex-col gap-2",children:[c,d,f,h,m]}),y[25]=f,y[26]=h,y[27]=c,y[28]=p):p=y[28],p}function B(e){return(0,t.jsx)(T,{run:e},e.id)}function q(e){return e.didResolveWorkspacePartition}function z(e){return e.workspacePartitionId}function L(e){return e.prompt}function W(e){return e.resetWorkspace}e.s(["RunHistoryContent",0,K],677453),e.s(["MobileRunDrawer",0,function(){let e,o,i,s,a,u,l,d,f,h,m=(0,n.c)(22),[p,y]=(0,r.useState)(!1),_=(0,w.useFusionStore)(W),S=(0,w.useFusionStore)(L),k=(0,x.useLocalizedRouter)(),j=(0,v.useParams)(),N=j?.runId,C=(0,r.useRef)(N);m[0]!==N?(e=()=>{N!==C.current&&(C.current=N,y(!1))},o=[N],m[0]=N,m[1]=e,m[2]=o):(e=m[1],o=m[2]),(0,r.useEffect)(e,o),m[3]!==_||m[4]!==k?(i=()=>{_(),k.push("/fusion")},m[3]=_,m[4]=k,m[5]=i):i=m[5];let E=i;m[6]!==S?(s=S.trim(),m[6]=S,m[7]=s):s=m[7];let P=s;m[8]!==E?(a={label:"New fusion",icon:g.PlusIcon,onClick:E},m[8]=E,m[9]=a):a=m[9],m[10]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)(K,{}),m[10]=u):u=m[10],m[11]!==p||m[12]!==a?(l=(0,t.jsx)(b.HistorySidebarDrawer,{title:"Runs",triggerAriaLabel:"Open runs",isOpen:p,onOpenChange:y,newAction:a,children:u}),m[11]=p,m[12]=a,m[13]=l):l=m[13];let A=!P&&"italic text-faint";m[14]!==A?(d=(0,c.cn)("ph-no-capture truncate text-sm font-medium text-foreground",A),m[14]=A,m[15]=d):d=m[15];let T=P||"New fusion";return m[16]!==d||m[17]!==T?(f=(0,t.jsx)("span",{className:d,"data-dd-privacy":"hidden",children:T}),m[16]=d,m[17]=T,m[18]=f):f=m[18],m[19]!==f||m[20]!==l?(h=(0,t.jsxs)("div",{className:"md:hidden flex items-center gap-1 px-2 py-2 border-b bg-background shrink-0",children:[l,f]}),m[19]=f,m[20]=l,m[21]=h):h=m[21],h}],894686)},547670,816443,e=>{"use strict";var t=e.i(222666),n=e.i(505962),r=e.i(109917),o=e.i(173037),i=e.i(270401);let s=i.forwardRef(function({title:e,titleId:t,...n},r){return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?i.createElement("title",{id:t},e):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 8.25h9m-9 3H12m-9.75 1.51c0 1.6 1.123 2.994 2.707 3.227 1.129.166 2.27.293 3.423.379.35.026.67.21.865.501L12 21l2.755-4.133a1.14 1.14 0 0 1 .865-.501 48.172 48.172 0 0 0 3.423-.379c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z"}))});var a=e.i(239718),u=e.i(528164),l=e.i(389097),c=e.i(682566),d=e.i(612960);e.i(530023);var f=e.i(612774),h=e.i(117738),m=e.i(784510),p=e.i(81174),y=e.i(693697),g=e.i(733442),v=e.i(295654),b=e.i(447680),x=e.i(227327),w=e.i(911585),_=e.i(22422),S=e.i(624621),k=e.i(735961),j=e.i(978567),N=e.i(426431),C=e.i(925204);async function E(e,{router:t,getModelInfoByVariantSlug:n,storageInstanceId:r}){var o;let i,s,a=(s=[{role:"user",content:e.prompt},{role:"user",content:(o=e.responses,i=Object.entries(o).filter(([,e])=>e.content.trim().length>0&&!e.error).map(([e,t])=>{let r=n(e),o=r?.short_name??e;return`### ${o} ${t.content}`}),`## Model Responses ${i.join("\n\n")}`)}],e.analysisContent&&s.push({role:"user",content:function(e){let t=[];if(e.consensus.length>0&&t.push(`### Agreement ${e.consensus.map(e=>`- ${e}`).join("\n")}`),e.contradictions.length>0){let n=e.contradictions.map(e=>{let t=e.stances.map(e=>` - ${e.model}: ${e.stance}`).join("\n");return`- ${e.topic} ${t}`});t.push(`### Key Differences ${n.join("\n")}`)}if(e.partial_coverage.length>0){let n=e.partial_coverage.map(e=>`- ${e.point} (raised by: ${e.models.join(", ")})`);t.push(`### Partial Coverage ${n.join("\n")}`)}if(e.unique_insights.length>0){let n=e.unique_insights.map(e=>`- ${e.insight} (from: ${e.model})`);t.push(`### Unique Insights ${n.join("\n")}`)}return e.blind_spots.length>0&&t.push(`### Blind Spots ${e.blind_spots.map(e=>`- ${e}`).join("\n")}`),`## Analysis ${t.join("\n\n")}`}(e.analysisContent)}),s.push({role:"assistant",content:e.synthesisContent}),s),u=(0,x.getCharacterMap)({getModelInfoByVariantSlug:n,variantSlugs:[e.synthesizerSlug]});await _.chatroomStoreActions.initStore({payload:{storageInstanceId:r}});let l=(0,w.getChatroomTitle)(e.prompt),c=await _.chatroomStoreActions.createChatroom({payload:{title:l,characters:u}}),d=Object.keys(c.characters).find(e=>!(0,v.checkUser)(e))??null;if(!d)return void t.push(`/chat?room=${c.id}`);let{messages:f,items:h,systemPrompt:m}=(0,j.convertChatMessagesToPlayground)(a,d);m&&await _.chatroomStoreActions.updateCharacter({payload:{roomId:c.id,characterId:d,partialCharacter:{description:m,includeDefaultSystemPrompt:!1}}}),await _.chatroomStoreActions.addMessages({payload:{roomId:c.id,messages:f}}),k.useItemStore.getState().actions.loadItems(h);let p=S.useChatroomStore.getState().storageInstanceId;p&&await b.persistence.saveItems(p,c.id,Object.values(h)),t.push(`/chat?room=${c.id}`)}function P(e){return e.resetWorkspace}function A(e){return e.phase}e.s(["NewFusionButton",0,function(){let e,v,b,x,w,_,S,k,j,T,R,O,I,D,M,F,K,B,q=(0,n.c)(37),z=(0,N.useFusionStore)(A),L=(0,N.useFusionStore)(P),W=(0,d.useLocalizedRouter)(),$=function(){let e,t=(0,n.c)(4),r=(0,d.useLocalizedRouter)(),{getModelInfoByVariantSlug:o}=(0,m.useGlobal)(),{clerkOrg:i}=(0,h.useEntity)();return t[0]!==i?.id||t[1]!==o||t[2]!==r?(e=async()=>{var e;let t=function(){let{prompt:e,synthesizerSlug:t,currentRunDbId:n}=N.useFusionStore.getState(),r=C.useFusionStreamingStore.getState(),o=(0,C.getRunResponses)(r,n),i=(0,C.getRunAnalysisContent)(r,n),s=(0,C.getRunSynthesisContent)(r,n);return e&&s&&t?{prompt:e,synthesizerSlug:t,responses:o,analysisContent:i,synthesisContent:s}:null}();if(!t)return;let n=(e=i?.id)?`${g.BASE_NAMESPACE}:${e}:${g.NAMESPACE_VERSION}`:`${g.BASE_NAMESPACE}:${g.NAMESPACE_VERSION}`,s=await (0,y.wrap)(()=>E(t,{router:r,getModelInfoByVariantSlug:o,storageInstanceId:n}));(0,y.isErr)(s)&&((0,p.eLog)("Failed to continue fusion in chat",{error:s.error}),(0,f.toast)({title:"Failed to open chat",variant:"destructive"}))},t[0]=i?.id,t[1]=o,t[2]=r,t[3]=e):e=t[3],i?.id,e}(),[U,V]=(0,i.useState)(null);if("complete"!==z)return null;q[0]!==L||q[1]!==W?(e=()=>{L(),W.push("/fusion")},q[0]=L,q[1]=W,q[2]=e):e=q[2];let G=e;q[3]!==G||q[4]!==U?(v=()=>{"refuse"===U?N.useFusionStore.getState().rerun():"new-fusion"===U&&G(),V(null)},q[3]=G,q[4]=U,q[5]=v):v=q[5];let H=v,Y="refuse"===U;q[6]===Symbol.for("react.memo_cache_sentinel")?(b=(0,t.jsx)(s,{className:"h-4 w-4"}),q[6]=b):b=q[6],q[7]!==$?(x=(0,t.jsxs)(u.Button,{size:"sm",onClick:$,children:[b,"Continue in Chat"]}),q[7]=$,q[8]=x):x=q[8],q[9]===Symbol.for("react.memo_cache_sentinel")?(w=(0,t.jsx)(c.DropdownMenuTrigger,{render:(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",className:"w-8 p-0",title:"More actions",children:(0,t.jsx)(a.EllipsisHorizontalIcon,{className:"h-4 w-4 text-muted-foreground"})})}),q[9]=w):w=q[9],q[10]===Symbol.for("react.memo_cache_sentinel")?(_=(0,t.jsxs)(c.DropdownMenuItem,{onClick:()=>V("refuse"),children:[(0,t.jsx)(o.BeakerIcon,{className:"h-4 w-4"}),"Re-fuse"]}),S=(0,t.jsx)(c.DropdownMenuSeparator,{}),q[10]=_,q[11]=S):(_=q[10],S=q[11]),q[12]===Symbol.for("react.memo_cache_sentinel")?(k=(0,t.jsxs)(c.DropdownMenu,{children:[w,(0,t.jsxs)(c.DropdownMenuContent,{align:"center",children:[_,S,(0,t.jsxs)(c.DropdownMenuItem,{onClick:()=>V("new-fusion"),children:[(0,t.jsx)(r.ArrowPathIcon,{className:"h-4 w-4"}),"New Fusion"]})]})]}),q[12]=k):k=q[12],q[13]!==x?(j=(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 pt-2",children:[x,k]}),q[13]=x,q[14]=j):j=q[14];let Q=null!==U;q[15]===Symbol.for("react.memo_cache_sentinel")?(T=e=>{e||V(null)},q[15]=T):T=q[15];let X=Y?"Re-fuse synthesis?":"Start a new fusion?";q[16]!==X?(R=(0,t.jsx)(l.DialogTitle,{children:X}),q[16]=X,q[17]=R):R=q[17];let Z=Y?"This will re-run the whole fusion with the same prompt and models, replacing the current responses and synthesis.":"This will open a fresh workspace. The current run stays in your history — click it in the sidebar any time to come back.";q[18]!==Z?(O=(0,t.jsx)(l.DialogDescription,{children:Z}),q[18]=Z,q[19]=O):O=q[19],q[20]!==R||q[21]!==O?(I=(0,t.jsxs)(l.DialogHeader,{children:[R,O]}),q[20]=R,q[21]=O,q[22]=I):I=q[22],q[23]===Symbol.for("react.memo_cache_sentinel")?(D=(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",onClick:()=>V(null),children:"Cancel"}),q[23]=D):D=q[23];let J=Y?"default":"destructive",ee=Y?"Re-fuse":"New Fusion";return q[24]!==H||q[25]!==J||q[26]!==ee?(M=(0,t.jsxs)(l.DialogFooter,{children:[D,(0,t.jsx)(u.Button,{variant:J,size:"sm",onClick:H,children:ee})]}),q[24]=H,q[25]=J,q[26]=ee,q[27]=M):M=q[27],q[28]!==I||q[29]!==M?(F=(0,t.jsxs)(l.DialogContent,{showCloseButton:!1,children:[I,M]}),q[28]=I,q[29]=M,q[30]=F):F=q[30],q[31]!==F||q[32]!==Q?(K=(0,t.jsx)(l.Dialog,{open:Q,onOpenChange:T,children:F}),q[31]=F,q[32]=Q,q[33]=K):K=q[33],q[34]!==K||q[35]!==j?(B=(0,t.jsxs)(t.Fragment,{children:[j,K]}),q[34]=K,q[35]=j,q[36]=B):B=q[36],B}],547670);let T=i.forwardRef(function({title:e,titleId:t,...n},r){return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?i.createElement("title",{id:t},e):null,i.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0v-7.5A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5"}))});var R=e.i(665155),O=e.i(82544),I=e.i(948992),D=e.i(53375),M=e.i(143566),F=e.i(452473);e.i(810810);var K=e.i(702378),B=e.i(648156);function q(e){return e.stopPropagation()}function z(e){return e.stopPropagation()}function L(e){return e.stopPropagation()}function W(e){return e.stopPropagation()}function $(e){return e.stopPropagation()}function U(e){return e.stopPropagation()}function V(e){return!e}e.s(["PromptCard",0,function(e){let o,s,a,l,c,d,f,h,m,p,y,g,v,b,x,w,_,S,k,j,N,C,E,P,A,G,H,Y=(0,n.c)(66),{prompt:Q,modelSetLabel:X,timestamp:Z,defaultCollapsed:J,isWebSearchEnabled:ee,onRerun:et,onStop:en}=e,er=void 0!==ee&&ee,eo=(0,i.useRef)(null),[ei,es]=(0,i.useState)(!(void 0!==J&&J)),[ea,eu]=(0,i.useState)(!1);Y[0]===Symbol.for("react.memo_cache_sentinel")?(o=()=>{let e=eo.current;e&&eu(e.scrollHeight>120)},Y[0]=o):o=Y[0];let el=o;Y[1]===Symbol.for("react.memo_cache_sentinel")?(s=()=>{el()},Y[1]=s):s=Y[1],Y[2]!==Q?(a=[Q,el],Y[2]=Q,Y[3]=a):a=Y[3],(0,i.useEffect)(s,a);let ec=ea&&!ei;Y[4]===Symbol.for("react.memo_cache_sentinel")?(l=()=>es(V),Y[4]=l):l=Y[4];let ed=l,ef=ea?"button":void 0,eh=ea?0:void 0,em=ea&&"cursor-pointer";Y[5]!==em?(c=(0,F.cn)("flex items-center justify-between px-5 py-3 border-b bg-muted/30",em),Y[5]=em,Y[6]=c):c=Y[6];let ep=ea?ed:void 0;Y[7]!==ea?(d=ea?e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),ed())}:void 0,Y[7]=ea,Y[8]=d):d=Y[8],Y[9]===Symbol.for("react.memo_cache_sentinel")?(f=(0,t.jsx)("span",{className:"text-sm font-semibold text-foreground",children:"Prompt"}),Y[9]=f):f=Y[9],Y[10]===Symbol.for("react.memo_cache_sentinel")?(h=(0,t.jsx)(M.TagIcon,{className:"h-3 w-3 text-muted-foreground"}),Y[10]=h):h=Y[10],Y[11]!==X?(m=(0,t.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-muted/60 border border-border/50 shrink-0",children:[h,(0,t.jsx)("span",{className:"text-2xs font-medium text-muted-foreground whitespace-nowrap",children:X})]}),Y[11]=X,Y[12]=m):m=Y[12],Y[13]===Symbol.for("react.memo_cache_sentinel")?(p=(0,t.jsx)(T,{className:"h-3 w-3 text-muted-foreground"}),Y[13]=p):p=Y[13],Y[14]!==Z?(y=(0,t.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-muted/60 border border-border/50 shrink-0",children:[p,(0,t.jsx)("span",{className:"text-2xs font-medium text-muted-foreground whitespace-nowrap",children:Z})]}),Y[14]=Z,Y[15]=y):y=Y[15],Y[16]!==er?(g=er&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-primary/10 border border-primary/20 shrink-0",children:[(0,t.jsx)(I.GlobeAltIcon,{className:"h-3 w-3 text-primary"}),(0,t.jsx)("span",{className:"text-2xs font-medium text-primary whitespace-nowrap",children:"Web Search"})]}),Y[16]=er,Y[17]=g):g=Y[17],Y[18]!==m||Y[19]!==y||Y[20]!==g?(v=(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[f,m,y,g]}),Y[18]=m,Y[19]=y,Y[20]=g,Y[21]=v):v=Y[21],Y[22]!==en?(b=en&&(0,t.jsx)("div",{role:"presentation",onClick:U,onKeyDown:$,children:(0,t.jsx)(B.Tooltip,{content:"Stop this fusion",children:(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-muted-foreground hover:text-foreground",onClick:en,"aria-label":"Stop fusion",children:(0,t.jsx)(D.StopIcon,{className:"h-4 w-4"})})})}),Y[22]=en,Y[23]=b):b=Y[23],Y[24]!==Q?(x=(0,t.jsx)("div",{role:"presentation",onClick:W,onKeyDown:L,children:(0,t.jsx)(B.Tooltip,{content:"Copy prompt",children:(0,t.jsx)(K.CopyToClipboardButton,{text:Q,size:"sm",variant:"ghost",className:"h-8 w-8 text-muted-foreground hover:text-foreground",hideCopyText:!0})})}),Y[24]=Q,Y[25]=x):x=Y[25],Y[26]!==et?(w=et&&(0,t.jsx)("div",{role:"presentation",className:"flex items-center gap-1",onClick:z,onKeyDown:q,children:(0,t.jsx)(B.Tooltip,{content:"Rerun",children:(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-muted-foreground hover:text-foreground",onClick:et,children:(0,t.jsx)(r.ArrowPathIcon,{className:"h-4 w-4"})})})}),Y[26]=et,Y[27]=w):w=Y[27],Y[28]!==ei||Y[29]!==ea?(_=ea&&(ei?(0,t.jsx)(O.ChevronUpIcon,{className:"h-4 w-4 text-muted-foreground"}):(0,t.jsx)(R.ChevronDownIcon,{className:"h-4 w-4 text-muted-foreground"})),Y[28]=ei,Y[29]=ea,Y[30]=_):_=Y[30],Y[31]!==b||Y[32]!==x||Y[33]!==w||Y[34]!==_?(S=(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[b,x,w,_]}),Y[31]=b,Y[32]=x,Y[33]=w,Y[34]=_,Y[35]=S):S=Y[35],Y[36]!==c||Y[37]!==ep||Y[38]!==d||Y[39]!==v||Y[40]!==S||Y[41]!==ef||Y[42]!==eh?(k=(0,t.jsxs)("div",{role:ef,tabIndex:eh,className:c,onClick:ep,onKeyDown:d,children:[v,S]}),Y[36]=c,Y[37]=ep,Y[38]=d,Y[39]=v,Y[40]=S,Y[41]=ef,Y[42]=eh,Y[43]=k):k=Y[43];let ey=ec?"overflow-hidden":"max-h-[40vh] overflow-y-auto";return Y[44]!==ey?(j=(0,F.cn)("px-6 py-6",ey),Y[44]=ey,Y[45]=j):j=Y[45],Y[46]!==ec?(N=ec?{maxHeight:120}:void 0,Y[46]=ec,Y[47]=N):N=Y[47],Y[48]!==Q?(C=(0,t.jsx)("p",{className:"text-sm text-foreground whitespace-pre-wrap leading-relaxed",children:Q}),Y[48]=Q,Y[49]=C):C=Y[49],Y[50]!==j||Y[51]!==N||Y[52]!==C?(E=(0,t.jsx)("div",{ref:eo,className:j,style:N,children:C}),Y[50]=j,Y[51]=N,Y[52]=C,Y[53]=E):E=Y[53],Y[54]!==ec?(P=ec&&(0,t.jsx)("div",{className:"absolute bottom-0 inset-x-0 h-16 bg-gradient-to-t from-background to-transparent pointer-events-none"}),Y[54]=ec,Y[55]=P):P=Y[55],Y[56]!==E||Y[57]!==P?(A=(0,t.jsxs)("div",{className:"relative",children:[E,P]}),Y[56]=E,Y[57]=P,Y[58]=A):A=Y[58],Y[59]!==ei||Y[60]!==ea?(G=ea&&(0,t.jsx)(u.Button,{variant:"ghost",size:"sm",onClick:ed,className:"flex items-center justify-center gap-1.5 w-full rounded-none py-2.5 text-xs font-medium text-muted-foreground hover:text-foreground border-t",children:ei?(0,t.jsxs)(t.Fragment,{children:["Show less",(0,t.jsx)(O.ChevronUpIcon,{className:"h-3 w-3"})]}):(0,t.jsxs)(t.Fragment,{children:["Show more",(0,t.jsx)(R.ChevronDownIcon,{className:"h-3 w-3"})]})}),Y[59]=ei,Y[60]=ea,Y[61]=G):G=Y[61],Y[62]!==k||Y[63]!==A||Y[64]!==G?(H=(0,t.jsxs)("div",{className:"ph-no-capture rounded-xl border border-border bg-background shadow-sm overflow-hidden","data-dd-privacy":"hidden",children:[k,A,G]}),Y[62]=k,Y[63]=A,Y[64]=G,Y[65]=H):H=Y[65],H}],816443)},565043,e=>{"use strict";var t=e.i(222666),n=e.i(505962),r=e.i(19379),o=e.i(84117),i=e.i(404142),s=e.i(612960),a=e.i(426431),u=e.i(677453);function l(e){return!!e?.key&&"/"===e.key.toLowerCase()&&(e.metaKey||e.ctrlKey)}function c(e){return e.resetWorkspace}function d(e){return e.toggleSidebar}function f(e){return e.isSidebarOpen}e.s(["RunHistorySidebar",0,function(){let e,h,m,p,y,g=(0,n.c)(12),v=(0,a.useFusionStore)(f),b=(0,a.useFusionStore)(d),x=(0,a.useFusionStore)(c),w=(0,s.useLocalizedRouter)();g[0]!==x||g[1]!==w?(e=()=>{x(),w.push("/fusion")},g[0]=x,g[1]=w,g[2]=e):e=g[2];let _=e;g[3]!==_?(h=e=>{e?.preventDefault(),_()},g[3]=_,g[4]=h):h=g[4],(0,r.useKeydown)(l,h);let S=!v;return g[5]!==_?(m={label:"New fusion",ariaLabel:"New Fusion (⌘ /)",icon:o.Plus,onClick:_,shortcutHint:"⌘/"},g[5]=_,g[6]=m):m=g[6],g[7]===Symbol.for("react.memo_cache_sentinel")?(p=(0,t.jsx)(u.RunHistoryContent,{}),g[7]=p):p=g[7],g[8]!==S||g[9]!==m||g[10]!==b?(y=(0,t.jsx)(i.HistorySidebar,{title:"Fusion",isCollapsed:S,onToggle:b,newAction:m,containerClassName:"min-h-0",children:p}),g[8]=S,g[9]=m,g[10]=b,g[11]=y):y=g[11],y}])},791092,665996,397847,596807,e=>{"use strict";var t=e.i(222666),n=e.i(505962);function r(e){let r,o,i,s,a,u=(0,n.c)(9),{label:l,progress:c}=e;return u[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)("div",{className:"w-px h-4 bg-border"}),u[0]=r):r=u[0],u[1]!==c?(o=c&&(0,t.jsxs)("div",{className:"flex items-center justify-center px-2 h-6 rounded-full bg-muted text-2xs font-bold text-muted-foreground border border-border shrink-0 uppercase tracking-wider tabular-nums",children:["Step ",c]}),u[1]=c,u[2]=o):o=u[2],u[3]!==l?(i=(0,t.jsx)("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider whitespace-nowrap",children:l}),u[3]=l,u[4]=i):i=u[4],u[5]===Symbol.for("react.memo_cache_sentinel")?(s=(0,t.jsx)("div",{className:"h-px flex-1 bg-border"}),u[5]=s):s=u[5],u[6]!==o||u[7]!==i?(a=(0,t.jsxs)("div",{className:"flex items-center gap-3 py-4",children:[r,o,i,s]}),u[6]=o,u[7]=i,u[8]=a):a=u[8],a}e.s(["SectionDivider",0,r],791092);var o=e.i(649188),i=e.i(536652),s=e.i(534390),a=e.i(665155),u=e.i(152533),l=e.i(558200),c=e.i(452473),d=e.i(965542);e.i(810810);var f=e.i(702378),h=e.i(557225),m=e.i(779100),p=e.i(150049),y=e.i(784510),g=e.i(270401),v=e.i(214857),b=e.i(660298),x=e.i(679728),w=e.i(426431),_=e.i(925204),S=e.i(551673),k=e.i(411349),j=e.i(435954),N=e.i(699511),C=e.i(43596),E=e.i(870401),P=e.i(980351),A=e.i(193975);function T(e,t){return`${(0,A.formatNativeFixed)(t/1e3,{locale:e,fractionDigits:1})??"—"}s`}function R(){return(0,w.useFusionStore)(O)}function O(e){return e.currentRunDbId}let I="fusion-layout",D=(0,c.cn)("[&_h1]:text-lg [&_h2]:text-base [&_h3]:text-sm [&_h4]:text-sm [&_h5]:text-sm [&_h6]:text-xs","[&_h1]:mt-4 [&_h1]:mb-2 [&_h2]:mt-4 [&_h2]:mb-2 [&_h3]:mt-3 [&_h3]:mb-1.5");function M(e){let r=(0,n.c)(17),{slug:o}=e,i=(0,m.useLocale)(),s=R(),a=(0,_.useModelResponse)(s,o),u=a?.isLoading,l=!!a?.error,c=a&&!a.isLoading&&!l,d=!!a?.content,f=!!a?.reasoning;if(u){let e,n,o;r[0]!==d?(e=d?(0,t.jsxs)("span",{className:"flex gap-0.5 shrink-0",children:[(0,t.jsx)("span",{className:"h-1 w-1 rounded-full bg-primary animate-bounce [animation-delay:0ms]"}),(0,t.jsx)("span",{className:"h-1 w-1 rounded-full bg-primary animate-bounce [animation-delay:150ms]"}),(0,t.jsx)("span",{className:"h-1 w-1 rounded-full bg-primary animate-bounce [animation-delay:300ms]"})]}):(0,t.jsx)("div",{className:"h-3.5 w-3.5 rounded-full border-2 border-muted-foreground/30 border-t-primary animate-spin shrink-0"}),r[0]=d,r[1]=e):e=r[1];let i=e,s="Processing";return d?s="Generating":f&&(s="Thinking"),r[2]!==s?(n=(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:s}),r[2]=s,r[3]=n):n=r[3],r[4]!==i||r[5]!==n?(o=(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mt-1",children:[i,n]}),r[4]=i,r[5]=n,r[6]=o):o=r[6],o}if(c){let e,n,o,s,u=a.tokenCount?`${a.tokenCount} tokens`:null;r[7]!==i||r[8]!==a.totalTime?(e=a.totalTime?T(i,a.totalTime):null,r[7]=i,r[8]=a.totalTime,r[9]=e):e=r[9],r[10]!==u||r[11]!==e?(n=[u,e].filter(Boolean),r[10]=u,r[11]=e,r[12]=n):n=r[12];let l=n;r[13]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(j.CheckCircleIcon,{className:"h-3.5 w-3.5 text-success shrink-0"}),r[13]=o):o=r[13];let c=l.length>0?` (${l.join(", ")})`:"";return r[14]!==c?(s=(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mt-1",children:[o,(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:["Complete",c]})]}),r[14]=c,r[15]=s):s=r[15],s}if(l){let e;return r[16]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mt-1",children:[(0,t.jsx)(E.ExclamationCircleIcon,{className:"h-3.5 w-3.5 text-destructive shrink-0"}),(0,t.jsx)("span",{className:"text-xs text-destructive/80",children:"Error occurred"})]}),r[16]=e):e=r[16],e}return null}function F(e){let r,o,i,s=(0,n.c)(10),{slug:a}=e,u=R(),l=(0,_.useModelResponse)(u,a);if(!l)return null;let c=l.isLoading&&!!l.content,f=!!l.error,h=!!l.content&&!f;return s[0]!==h||s[1]!==c||s[2]!==l.content?(r=h&&(0,t.jsxs)("div",{className:"text-sm leading-relaxed",children:[(0,t.jsx)(d.ChatroomMarkdownContainer,{className:D,children:l.content}),c&&(0,t.jsx)("div",{className:"flex items-center gap-1.5 mt-3 text-muted-foreground",children:(0,t.jsxs)("span",{className:"flex gap-0.5",children:[(0,t.jsx)("span",{className:"h-1 w-1 rounded-full bg-primary animate-bounce [animation-delay:0ms]"}),(0,t.jsx)("span",{className:"h-1 w-1 rounded-full bg-primary animate-bounce [animation-delay:150ms]"}),(0,t.jsx)("span",{className:"h-1 w-1 rounded-full bg-primary animate-bounce [animation-delay:300ms]"})]})})]}),s[0]=h,s[1]=c,s[2]=l.content,s[3]=r):r=s[3],s[4]!==f||s[5]!==l.error?(o=f&&(0,t.jsxs)("div",{className:"rounded-md bg-destructive/5 border border-destructive/20 p-3",children:[(0,t.jsx)("p",{className:"text-sm text-destructive font-medium",children:"Response unavailable"}),(0,t.jsx)("p",{className:"text-xs text-destructive/80 mt-1",children:l.error})]}),s[4]=f,s[5]=l.error,s[6]=o):o=s[6],s[7]!==r||s[8]!==o?(i=(0,t.jsxs)(t.Fragment,{children:[r,o]}),s[7]=r,s[8]=o,s[9]=i):i=s[9],i}function K(e){let r,o,i,s=(0,n.c)(8),{slug:a}=e,u=(0,m.useLocale)(),l=R(),c=(0,_.useModelResponse)(l,a);return c?.tokenCount||c?.totalTime?(s[0]!==c.tokenCount?(r=c.tokenCount?(0,t.jsxs)("span",{children:[c.tokenCount," tokens"]}):null,s[0]=c.tokenCount,s[1]=r):r=s[1],s[2]!==u||s[3]!==c.totalTime?(o=c.totalTime?(0,t.jsx)("span",{children:T(u,c.totalTime)}):null,s[2]=u,s[3]=c.totalTime,s[4]=o):o=s[4],s[5]!==r||s[6]!==o?(i=(0,t.jsxs)("div",{className:"flex items-center gap-3 px-5 py-2.5 border-t text-xs text-muted-foreground shrink-0",children:[r,o]}),s[5]=r,s[6]=o,s[7]=i):i=s[7],i):null}function B(e){let r,o,i,s,a,u,l,d,f=(0,n.c)(19),{tab:m,isSelected:p,onClick:y}=e,g=p?"border-primary/40 bg-primary/5 ring-1 ring-primary/20":"border-border bg-background";return f[0]!==g?(r=(0,c.cn)("w-full text-left px-4 py-3 rounded-lg border transition-colors","hover:bg-muted/50",g),f[0]=g,f[1]=r):r=f[1],f[2]!==m.author?(o=m.author&&(0,t.jsx)(h.AuthorIcon,{author:m.author,className:"!size-5 shrink-0"}),f[2]=m.author,f[3]=o):o=f[3],f[4]!==m.name?(i=(0,t.jsx)("span",{className:"text-sm font-medium text-foreground truncate block",children:m.name}),f[4]=m.name,f[5]=i):i=f[5],f[6]!==m.key?(s=(0,t.jsx)(M,{slug:m.key}),f[6]=m.key,f[7]=s):s=f[7],f[8]!==i||f[9]!==s?(a=(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[i,s]}),f[8]=i,f[9]=s,f[10]=a):a=f[10],f[11]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)(C.ChevronRightIcon,{className:"h-4 w-4 text-muted-foreground/50 shrink-0"}),f[11]=u):u=f[11],f[12]!==o||f[13]!==a?(l=(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[o,a,u]}),f[12]=o,f[13]=a,f[14]=l):l=f[14],f[15]!==y||f[16]!==r||f[17]!==l?(d=(0,t.jsx)("button",{type:"button",onClick:y,className:r,children:l}),f[15]=y,f[16]=r,f[17]=l,f[18]=d):d=f[18],d}function q(e){let r,o,s,a,u,d,f,m,p,y,g,v,b,x,w,_,S,k,j,E,P,A=(0,n.c)(53),{tabs:T,activeKey:R,onSelectTab:O,onClose:I,onExpand:D}=e;A[0]!==R?(r=e=>e.key===R,A[0]=R,A[1]=r):r=A[1];let M=T.findIndex(r),B=T[M];if(!B)return null;let q=M>0,z=M{q&&O(T[M-1].key)},A[2]=M,A[3]=q,A[4]=O,A[5]=T,A[6]=o):o=A[6];let L=o;A[7]!==M||A[8]!==z||A[9]!==O||A[10]!==T?(s=()=>{z&&O(T[M+1].key)},A[7]=M,A[8]=z,A[9]=O,A[10]=T,A[11]=s):s=A[11];let W=s;A[12]===Symbol.for("react.memo_cache_sentinel")?(a=(0,c.cn)("ph-no-capture absolute top-0 right-0 bottom-0 z-40","flex flex-col","border-l border-border bg-background shadow-xl","w-[560px] max-w-full"),A[12]=a):a=A[12];let $=!q;A[13]===Symbol.for("react.memo_cache_sentinel")?(u=(0,t.jsx)(N.ChevronLeftIcon,{className:"h-4 w-4"}),A[13]=u):u=A[13],A[14]!==L||A[15]!==$?(d=(0,t.jsx)("button",{type:"button",onClick:L,disabled:$,className:"p-1.5 rounded-md hover:bg-muted disabled:opacity-30 disabled:cursor-not-allowed text-muted-foreground",title:"Previous model",children:u}),A[14]=L,A[15]=$,A[16]=d):d=A[16];let U=!z;A[17]===Symbol.for("react.memo_cache_sentinel")?(f=(0,t.jsx)(C.ChevronRightIcon,{className:"h-4 w-4"}),A[17]=f):f=A[17],A[18]!==W||A[19]!==U?(m=(0,t.jsx)("button",{type:"button",onClick:W,disabled:U,className:"p-1.5 rounded-md hover:bg-muted disabled:opacity-30 disabled:cursor-not-allowed text-muted-foreground",title:"Next model",children:f}),A[18]=W,A[19]=U,A[20]=m):m=A[20],A[21]!==m||A[22]!==d?(p=(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[d,m]}),A[21]=m,A[22]=d,A[23]=p):p=A[23],A[24]!==B.author?(y=B.author&&(0,t.jsx)(h.AuthorIcon,{author:B.author,className:"!size-5 shrink-0"}),A[24]=B.author,A[25]=y):y=A[25],A[26]!==B.name?(g=(0,t.jsx)("span",{className:"text-sm font-medium text-foreground truncate",children:B.name}),A[26]=B.name,A[27]=g):g=A[27];let V=M+1;return A[28]!==V||A[29]!==T.length?(v=(0,t.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums shrink-0",children:[V,"/",T.length]}),A[28]=V,A[29]=T.length,A[30]=v):v=A[30],A[31]!==y||A[32]!==g||A[33]!==v?(b=(0,t.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[y,g,v]}),A[31]=y,A[32]=g,A[33]=v,A[34]=b):b=A[34],A[35]===Symbol.for("react.memo_cache_sentinel")?(x=(0,t.jsx)(i.ArrowsPointingOutIcon,{className:"h-4 w-4"}),A[35]=x):x=A[35],A[36]!==D?(w=(0,t.jsx)("button",{type:"button",onClick:D,className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground shrink-0",title:"Compare all side by side",children:x}),A[36]=D,A[37]=w):w=A[37],A[38]===Symbol.for("react.memo_cache_sentinel")?(_=(0,t.jsx)(l.XMarkIcon,{className:"h-4 w-4"}),A[38]=_):_=A[38],A[39]!==I?(S=(0,t.jsx)("button",{type:"button",onClick:I,className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground shrink-0",title:"Close panel",children:_}),A[39]=I,A[40]=S):S=A[40],A[41]!==p||A[42]!==b||A[43]!==w||A[44]!==S?(k=(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b shrink-0",children:[p,b,w,S]}),A[41]=p,A[42]=b,A[43]=w,A[44]=S,A[45]=k):k=A[45],A[46]!==B.key?(j=(0,t.jsx)("div",{className:"flex-1 overflow-y-auto overflow-x-hidden px-5 py-5",children:(0,t.jsx)("div",{className:"max-w-full overflow-hidden",children:(0,t.jsx)(F,{slug:B.key})})}),E=(0,t.jsx)(K,{slug:B.key}),A[46]=B.key,A[47]=j,A[48]=E):(j=A[47],E=A[48]),A[49]!==k||A[50]!==j||A[51]!==E?(P=(0,t.jsxs)("aside",{className:a,"data-dd-privacy":"hidden",children:[k,j,E]}),A[49]=k,A[50]=j,A[51]=E,A[52]=P):P=A[52],P}function z(e){let r,o,i,s,a,u,l,d,f=(0,n.c)(20),{tab:m,isLast:p}=e,y=!p&&"border-r";return f[0]!==y?(r=(0,c.cn)("flex flex-col h-full flex-1 min-w-[350px]",y),f[0]=y,f[1]=r):r=f[1],f[2]!==m.author?(o=m.author&&(0,t.jsx)(h.AuthorIcon,{author:m.author,className:"!size-5 shrink-0"}),f[2]=m.author,f[3]=o):o=f[3],f[4]!==m.name?(i=(0,t.jsx)("span",{className:"text-sm font-medium text-foreground truncate",children:m.name}),f[4]=m.name,f[5]=i):i=f[5],f[6]!==m.key?(s=(0,t.jsx)(M,{slug:m.key}),f[6]=m.key,f[7]=s):s=f[7],f[8]!==o||f[9]!==i||f[10]!==s?(a=(0,t.jsxs)("div",{className:"flex items-center gap-2.5 px-5 py-3 border-b bg-muted/20 shrink-0",children:[o,i,s]}),f[8]=o,f[9]=i,f[10]=s,f[11]=a):a=f[11],f[12]!==m.key?(u=(0,t.jsx)("div",{className:"flex-1 overflow-y-auto overflow-x-hidden px-5 py-5",children:(0,t.jsx)(F,{slug:m.key})}),l=(0,t.jsx)(K,{slug:m.key}),f[12]=m.key,f[13]=u,f[14]=l):(u=f[13],l=f[14]),f[15]!==r||f[16]!==a||f[17]!==u||f[18]!==l?(d=(0,t.jsxs)("div",{className:r,children:[a,u,l]}),f[15]=r,f[16]=a,f[17]=u,f[18]=l,f[19]=d):d=f[19],d}function L(e){let r,o,i,s,a,u,c,d=(0,n.c)(16),{tabs:f,onClose:h}=e;d[0]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)("span",{className:"text-sm font-medium text-foreground flex-1",children:"All Model Responses"}),d[0]=r):r=d[0],d[1]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(l.XMarkIcon,{className:"h-4 w-4"}),d[1]=o):o=d[1],d[2]!==h?(i=(0,t.jsxs)("div",{className:"flex items-center gap-3 px-5 py-3 border-b shrink-0",children:[r,(0,t.jsx)("button",{type:"button",onClick:h,className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground",title:"Close comparison",children:o})]}),d[2]=h,d[3]=i):i=d[3];let m=`${400*f.length}px`;if(d[4]!==m?(s={minWidth:m},d[4]=m,d[5]=s):s=d[5],d[6]!==f){let e;d[8]!==f.length?(e=(e,n)=>(0,t.jsx)(z,{tab:e,isLast:n===f.length-1},e.key),d[8]=f.length,d[9]=e):e=d[9],a=f.map(e),d[6]=f,d[7]=a}else a=d[7];return d[10]!==s||d[11]!==a?(u=(0,t.jsx)("div",{className:"flex-1 overflow-x-auto overflow-y-hidden",children:(0,t.jsx)("div",{className:"flex h-full",style:s,children:a})}),d[10]=s,d[11]=a,d[12]=u):u=d[12],d[13]!==i||d[14]!==u?(c=(0,t.jsxs)("div",{className:"ph-no-capture fixed inset-0 z-modal bg-background flex flex-col","data-dd-privacy":"hidden",children:[i,u]}),d[13]=i,d[14]=u,d[15]=c):c=d[15],c}function W({onOverflowChange:e}){let n=(0,w.useFusionStore)(e=>e.currentRunDbId),r=(0,_.useSynthesisContent)(n),o=(0,g.useRef)(null),i=!!r&&r.length>0,s=(0,g.useRef)(!1),a=(0,g.useRef)(0);if(r&&r.length!==a.current&&(a.current=r.length,s.current||queueMicrotask(()=>{let t=o.current;t&&t.scrollHeight>200&&(s.current=!0,e(!0))})),!i)return null;let u=r.length>800?r.slice(0,800):r;return(0,t.jsx)("div",{ref:o,className:"px-6 py-6 overflow-hidden",style:{maxHeight:200},children:(0,t.jsx)("div",{className:"max-w-none text-sm leading-relaxed",children:(0,t.jsx)(d.ChatroomMarkdownContainer,{className:D,children:u})})})}function $(){let e,r,o=(0,n.c)(3),i=(0,w.useFusionStore)(U),s=(0,_.useSynthesisContent)(i);o[0]===Symbol.for("react.memo_cache_sentinel")?(e={contentVisibility:"auto"},o[0]=e):e=o[0];let a=s??"";return o[1]!==a?(r=(0,t.jsx)("div",{className:"px-6 py-6",style:e,children:(0,t.jsx)("div",{className:"max-w-none text-sm leading-relaxed",children:(0,t.jsx)(d.ChatroomMarkdownContainer,{className:D,children:a})})}),o[1]=a,o[2]=r):r=o[2],r}function U(e){return e.currentRunDbId}function V(){let e,r=(0,n.c)(1);return r[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(f.CopyToClipboardButton,{getText:G,size:"sm",variant:"ghost",className:"h-8 w-8 text-muted-foreground hover:text-foreground",hideCopyText:!0}),r[0]=e):e=r[0],e}function G(){let e=w.useFusionStore.getState().currentRunDbId;return(0,_.getRunSynthesisContent)(_.useFusionStreamingStore.getState(),e)??""}function H(e,t){return function(e,t,n,r){let o=n.trim(),i=o;if(o.length>40){let e=o.lastIndexOf(" ",40);i=e>0?o.slice(0,e):o.slice(0,40)}let s=i.replaceAll(/[/\\:*?"<>|\r\n\t]/g,"-").replaceAll(/-{2,}/g,"-");return{name:s?`Fusion - ${s} -`:"Fusion -",date:(0,S.formatFilenameTimestamp)(r,{locale:e,timeZone:t})??"—"}}(e,t,w.useFusionStore.getState().prompt,new Date)}function Y(){let e,r,i,s=(0,n.c)(6),a=(0,m.useLocale)(),u=(0,p.useResolvedDisplayTimeZone)();s[0]!==a||s[1]!==u?(e=()=>{let e=w.useFusionStore.getState().currentRunDbId,t=(0,_.getRunSynthesisContent)(_.useFusionStreamingStore.getState(),e)??"";if(!t)return;(0,x.trackFusionEvent)(x.FusionEvent.DownloadMarkdown);let{name:n,date:r}=H(a,u);(0,b.downloadMarkdown)(t,{name:n,date:r})},s[0]=a,s[1]=u,s[2]=e):e=s[2];let l=e;return s[3]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(o.ArrowDownTrayIcon,{className:"h-4 w-4"}),s[3]=r):r=s[3],s[4]!==l?(i=(0,t.jsx)("button",{type:"button",onClick:l,className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"Download as Markdown",children:r}),s[4]=l,s[5]=i):i=s[5],i}function Q(e){let r,i,s,a=(0,n.c)(7),{currentRunDbId:u}=e,l=(0,m.useLocale)(),c=(0,p.useResolvedDisplayTimeZone)();a[0]!==u||a[1]!==l||a[2]!==c?(r=()=>{let e=(0,_.getRunSynthesisContent)(_.useFusionStreamingStore.getState(),u)??"";if(!e)return;(0,x.trackFusionEvent)(x.FusionEvent.DownloadMarkdown);let{name:t,date:n}=H(l,c);(0,b.downloadMarkdown)(e,{name:t,date:n})},a[0]=u,a[1]=l,a[2]=c,a[3]=r):r=a[3];let d=r;return a[4]===Symbol.for("react.memo_cache_sentinel")?(i=(0,t.jsx)(o.ArrowDownTrayIcon,{className:"h-4 w-4"}),a[4]=i):i=a[4],a[5]!==d?(s=(0,t.jsx)("button",{type:"button",onClick:d,className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",title:"Download as Markdown",children:i}),a[5]=d,a[6]=s):s=a[6],s}function X(){let e,r,o,i,u,l,d,f=(0,n.c)(13),h=(0,w.useFusionStore)(J),[m,p]=(0,g.useState)(!1);if(!h)return null;f[0]===Symbol.for("react.memo_cache_sentinel")?(e=()=>p(Z),f[0]=e):e=f[0],f[1]===Symbol.for("react.memo_cache_sentinel")?(r=(0,t.jsx)(s.ChatBubbleLeftIcon,{className:"h-4 w-4 text-muted-foreground shrink-0"}),o=(0,t.jsx)("span",{className:"text-xs font-medium text-muted-foreground flex-1",children:"Prompt"}),f[1]=r,f[2]=o):(r=f[1],o=f[2]);let y=m&&"rotate-180";return f[3]!==y?(i=(0,c.cn)("h-3.5 w-3.5 text-muted-foreground transition-transform shrink-0",y),f[3]=y,f[4]=i):i=f[4],f[5]!==i?(u=(0,t.jsxs)("button",{type:"button",onClick:e,className:"flex items-center gap-2.5 w-full px-6 py-3 text-left",children:[r,o,(0,t.jsx)(a.ChevronDownIcon,{className:i})]}),f[5]=i,f[6]=u):u=f[6],f[7]!==m||f[8]!==h?(l=m&&(0,t.jsx)("div",{className:"px-6 pb-4 text-sm text-foreground/80 leading-relaxed whitespace-pre-wrap",children:h}),f[7]=m,f[8]=h,f[9]=l):l=f[9],f[10]!==u||f[11]!==l?(d=(0,t.jsxs)("div",{className:"border-b",children:[u,l]}),f[10]=u,f[11]=l,f[12]=d):d=f[12],d}function Z(e){return!e}function J(e){return e.prompt}function ee(){let e,r,o,i,s,l,d,f,h=(0,n.c)(16),[m]=(0,g.useState)(er),p=(0,w.useFusionStore)(en);if(h[0]!==p){for(let t of(e=new Map,p))e.set(t.short_name,t.author);h[0]=p,h[1]=e}else e=h[1];let y=e,[v,b]=(0,g.useState)(!1);if(!m||!(m.consensus.length>0||m.contradictions.length>0||m.partial_coverage.length>0||m.unique_insights.length>0||m.blind_spots.length>0))return null;h[2]===Symbol.for("react.memo_cache_sentinel")?(r=()=>b(et),h[2]=r):r=h[2],h[3]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(u.MagnifyingGlassIcon,{className:"h-4 w-4 text-muted-foreground shrink-0"}),i=(0,t.jsx)("span",{className:"text-xs font-medium text-muted-foreground flex-1",children:"Analysis"}),h[3]=o,h[4]=i):(o=h[3],i=h[4]);let x=v&&"rotate-180";return h[5]!==x?(s=(0,c.cn)("h-3.5 w-3.5 text-muted-foreground transition-transform shrink-0",x),h[5]=x,h[6]=s):s=h[6],h[7]!==s?(l=(0,t.jsxs)("button",{type:"button",onClick:r,className:"flex items-center gap-2.5 w-full px-6 py-3 text-left",children:[o,i,(0,t.jsx)(a.ChevronDownIcon,{className:s})]}),h[7]=s,h[8]=l):l=h[8],h[9]!==m||h[10]!==y||h[11]!==v?(d=v&&(0,t.jsx)("div",{className:"px-6 pb-4 flex flex-col gap-y-2",children:k.DIMENSIONS.map(e=>(0,t.jsx)(k.DimensionRow,{config:e,analysis:m,authorMap:y},e.key))}),h[9]=m,h[10]=y,h[11]=v,h[12]=d):d=h[12],h[13]!==l||h[14]!==d?(f=(0,t.jsxs)("div",{className:"border-b",children:[l,d]}),h[13]=l,h[14]=d,h[15]=f):f=h[15],f}function et(e){return!e}function en(e){return e.selectedModels}function er(){let e=w.useFusionStore.getState().currentRunDbId;return null!==e?_.useFusionStreamingStore.getState().runs[e]?.analysisContent??null:null}function eo(e){let r,o,i,s,a,u,c,d,f,m,p,y,b,x,w,_,S=(0,n.c)(29),{onClose:k,displayName:j,displayAuthor:N,sourceModels:C}=e;return S[0]!==k?(r=()=>{let e=e=>{"Escape"===e.key&&k()};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},o=[k],S[0]=k,S[1]=r,S[2]=o):(r=S[1],o=S[2]),(0,g.useEffect)(r,o),S[3]===Symbol.for("react.memo_cache_sentinel")?(i=[],S[3]=i):i=S[3],(0,g.useEffect)(eu,i),S[4]===Symbol.for("react.memo_cache_sentinel")?(s={backgroundColor:"oklch(0.15 0 0 / 0.85)"},S[4]=s):s=S[4],S[5]!==N?(a=N&&(0,t.jsx)(h.AuthorIcon,{author:N,className:"!size-5 shrink-0"}),S[5]=N,S[6]=a):a=S[6],S[7]!==j?(u=(0,t.jsx)("span",{className:"text-sm font-semibold text-foreground truncate",children:j}),S[7]=j,S[8]=u):u=S[8],S[9]!==C?(c=C.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-muted/60 border border-border/50 shrink-0",children:[(0,t.jsx)("div",{className:"flex items-center",children:C.map(ei)}),(0,t.jsx)("span",{className:"text-2xs font-medium text-muted-foreground whitespace-nowrap",children:"Fused"})]}),S[9]=C,S[10]=c):c=S[10],S[11]!==a||S[12]!==u||S[13]!==c?(d=(0,t.jsxs)("div",{className:"flex items-center gap-2 min-w-0 flex-wrap",children:[a,u,c]}),S[11]=a,S[12]=u,S[13]=c,S[14]=d):d=S[14],S[15]===Symbol.for("react.memo_cache_sentinel")?(m=(0,t.jsx)(V,{}),f=(0,t.jsx)(Y,{}),S[15]=f,S[16]=m):(f=S[15],m=S[16]),S[17]===Symbol.for("react.memo_cache_sentinel")?(p=(0,t.jsx)(l.XMarkIcon,{className:"h-4 w-4"}),S[17]=p):p=S[17],S[18]!==k?(y=(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[m,f,(0,t.jsx)("button",{type:"button",onClick:k,className:"p-1.5 rounded-md hover:bg-muted text-muted-foreground transition-colors",children:p})]}),S[18]=k,S[19]=y):y=S[19],S[20]!==y||S[21]!==d?(b=(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 py-3 sm:px-5 border-b bg-muted/30 shrink-0 sm:rounded-t-xl",children:[d,y]}),S[20]=y,S[21]=d,S[22]=b):b=S[22],S[23]===Symbol.for("react.memo_cache_sentinel")?(x=(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto overflow-x-hidden",children:[(0,t.jsx)(X,{}),(0,t.jsx)(ee,{}),(0,t.jsx)($,{})]}),S[23]=x):x=S[23],S[24]!==b?(w=(0,t.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Full synthesis response",className:"w-full max-w-3xl flex flex-col bg-background shadow-2xl animate-in zoom-in-[0.98] slide-in-from-bottom-2 duration-200 h-full sm:h-auto sm:max-h-[85vh] sm:my-[7.5vh] sm:mx-4 sm:rounded-xl sm:border sm:border-border",onClick:ea,onKeyDown:es,children:[b,x]}),S[24]=b,S[25]=w):w=S[25],S[26]!==k||S[27]!==w?(_=(0,v.createPortal)((0,t.jsx)("div",{role:"presentation",className:"ph-no-capture fixed inset-0 z-modal flex items-start justify-center backdrop-blur-xs animate-in fade-in duration-200","data-dd-privacy":"hidden",style:s,onClick:k,children:w}),document.body),S[26]=k,S[27]=w,S[28]=_):_=S[28],_}function ei(e){return(0,t.jsx)("div",{className:"size-3.5 min-w-[14px] min-h-[14px] ring-1 ring-background rounded-full bg-background shrink-0 -me-1 last:me-0",children:(0,t.jsx)(h.AuthorIcon,{author:e.author,className:"!size-3.5 !min-w-[14px] !min-h-[14px] !p-0.5"})},e.key)}function es(e){"Escape"!==e.key&&e.stopPropagation()}function ea(e){return e.stopPropagation()}function eu(){return document.body.style.overflow="hidden",el}function el(){document.body.style.overflow=""}function ec(e){return e.stopPropagation()}function ed(e){return e.stopPropagation()}function ef(e){return(0,t.jsx)("div",{className:"size-3.5 min-w-[14px] min-h-[14px] ring-1 ring-background rounded-full bg-background shrink-0 -me-1 last:me-0",children:(0,t.jsx)(h.AuthorIcon,{author:e.author,className:"!size-3.5 !min-w-[14px] !min-h-[14px] !p-0.5"})},e.key)}function eh(e){return{key:e.slug,author:e.author}}function em(e){return e.selectedModels}function ep(e){return e.synthesizerSlug}function ey(e){return e.currentRunDbId}function eg(e){return e.phase}e.s(["FUSION_LAYOUT_ID",0,I,"FUSION_MARKDOWN_CLASS",0,D,"TabbedResponses",0,function(e){let o,i,s,a,u,l,d,f,h,m,p,y,b,x=(0,n.c)(37),{tabs:w,label:_,progress:S}=e,[k,j]=(0,g.useState)("cards"),[N,C]=(0,g.useState)(null),E=(0,P.useHydrated)()?document.querySelector(`#${I}`):null;x[0]!==N||x[1]!==k?(o=e=>{"panel"===k&&N===e?(j("cards"),C(null)):(C(e),j("panel"))},x[0]=N,x[1]=k,x[2]=o):o=x[2];let A=o;x[3]===Symbol.for("react.memo_cache_sentinel")?(i=()=>{j("cards"),C(null)},x[3]=i):i=x[3];let T=i;x[4]===Symbol.for("react.memo_cache_sentinel")?(s=()=>{j("fullscreen")},x[4]=s):s=x[4];let R=s;x[5]===Symbol.for("react.memo_cache_sentinel")?(a=()=>{j("panel")},x[5]=a):a=x[5];let O=a;if(x[6]!==k?(u=()=>{let e=e=>{"Escape"===e.key&&("fullscreen"===k?j("panel"):"panel"===k&&(j("cards"),C(null)))};return"cards"!==k&&document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},l=[k],x[6]=k,x[7]=u,x[8]=l):(u=x[7],l=x[8]),(0,g.useEffect)(u,l),0===w.length)return null;x[9]!==_||x[10]!==S?(d=_&&(0,t.jsx)(r,{label:_,progress:S}),x[9]=_,x[10]=S,x[11]=d):d=x[11];let D=_&&"mt-4";if(x[12]!==D?(f=(0,c.cn)("flex flex-col gap-y-2",D),x[12]=D,x[13]=f):f=x[13],x[14]!==A||x[15]!==N||x[16]!==w||x[17]!==k){let e;x[19]!==A||x[20]!==N||x[21]!==k?(e=e=>(0,t.jsx)(B,{tab:e,isSelected:"panel"===k&&e.key===N,onClick:()=>A(e.key)},e.key),x[19]=A,x[20]=N,x[21]=k,x[22]=e):e=x[22],h=w.map(e),x[14]=A,x[15]=N,x[16]=w,x[17]=k,x[18]=h}else h=x[18];x[23]!==h||x[24]!==f?(m=(0,t.jsx)("div",{className:f,children:h}),x[23]=h,x[24]=f,x[25]=m):m=x[25],x[26]!==m||x[27]!==d?(p=(0,t.jsxs)("div",{className:"ph-no-capture","data-dd-privacy":"hidden",children:[d,m]}),x[26]=m,x[27]=d,x[28]=p):p=x[28];let M="panel"===k&&N&&E&&(0,v.createPortal)((0,t.jsx)(q,{tabs:w,activeKey:N,onSelectTab:C,onClose:T,onExpand:R}),E);return x[29]!==O||x[30]!==w||x[31]!==k?(y="fullscreen"===k&&(0,v.createPortal)((0,t.jsx)(L,{tabs:w,onClose:O}),document.body),x[29]=O,x[30]=w,x[31]=k,x[32]=y):y=x[32],x[33]!==p||x[34]!==M||x[35]!==y?(b=(0,t.jsxs)(t.Fragment,{children:[p,M,y]}),x[33]=p,x[34]=M,x[35]=y,x[36]=b):b=x[36],b}],665996),e.s(["SynthesisCard",0,function(e){let r,o,s,a,u,l,d,m,p,v,b,x,S,k,j,N,C,E,P,A,T,R,O,I,D,M,F,K=(0,n.c)(77),{overrides:B}=e,q=(0,w.useFusionStore)(eg),z=(0,w.useFusionStore)(ey);K[0]!==z?(r=e=>{let t=(0,_.getRunSynthesisContent)(e,z);return!!t&&t.length>0},K[0]=z,K[1]=r):r=K[1];let L=(0,_.useFusionStreamingStore)(r),$=(0,w.useFusionStore)(ep),U=(0,w.useFusionStore)(em),V=(0,y.useGlobal)(),G=V?.getModelInfoByVariantSlug;K[2]!==G||K[3]!==$?(o=$&&G?G($):null,K[2]=G,K[3]=$,K[4]=o):o=K[4];let H=o;K[5]!==B?.sourceModels||K[6]!==U?(s=B?.sourceModels??U.map(eh),K[5]=B?.sourceModels,K[6]=U,K[7]=s):s=K[7];let Y=s,X=B?.synthesizerAuthor??H?.author,Z=B?.synthesizerName??H?.short_name??"Fused Answer",J="synthesizing"===q,ee=B?.isComplete??"complete"===q,[et,en]=(0,g.useState)(!1),[er,ei]=(0,g.useState)(!1);K[8]===Symbol.for("react.memo_cache_sentinel")?(a=e=>{en(e)},K[8]=a):a=K[8];let es=a;K[9]!==z?(u=()=>(0,_.getRunSynthesisContent)(_.useFusionStreamingStore.getState(),z)??"",K[9]=z,K[10]=u):u=K[10];let ea=u;K[11]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{ei(!0)},K[11]=l):l=K[11];let eu=l;K[12]===Symbol.for("react.memo_cache_sentinel")?(d=()=>{ei(!1)},K[12]=d):d=K[12];let el=d,ev=et?"button":void 0,eb=et?0:void 0,ex=et&&"cursor-pointer";K[13]!==ex?(m=(0,c.cn)("flex items-center justify-between px-5 py-3 border-b bg-muted/30",ex),K[13]=ex,K[14]=m):m=K[14];let ew=et?eu:void 0;K[15]!==et?(p=et?e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),eu())}:void 0,K[15]=et,K[16]=p):p=K[16],K[17]!==X?(v=X&&(0,t.jsx)(h.AuthorIcon,{author:X,className:"!size-5 shrink-0"}),K[17]=X,K[18]=v):v=K[18],K[19]!==Z?(b=(0,t.jsx)("span",{className:"text-sm font-semibold text-foreground",children:Z}),K[19]=Z,K[20]=b):b=K[20],K[21]!==Y?(x=Y.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-muted/60 border border-border/50 shrink-0",children:[(0,t.jsx)("div",{className:"flex items-center",children:Y.map(ef)}),(0,t.jsx)("span",{className:"text-2xs font-medium text-muted-foreground whitespace-nowrap",children:"Fused"})]}),K[21]=Y,K[22]=x):x=K[22],K[23]!==J?(S=J&&(0,t.jsx)("span",{className:"flex items-center gap-1.5 ml-1 text-xs text-muted-foreground",children:(0,t.jsxs)("span",{className:"flex gap-0.5",children:[(0,t.jsx)("span",{className:"h-1 w-1 rounded-full bg-foreground/50 animate-bounce [animation-delay:0ms]"}),(0,t.jsx)("span",{className:"h-1 w-1 rounded-full bg-foreground/50 animate-bounce [animation-delay:150ms]"}),(0,t.jsx)("span",{className:"h-1 w-1 rounded-full bg-foreground/50 animate-bounce [animation-delay:300ms]"})]})}),K[23]=J,K[24]=S):S=K[24],K[25]!==v||K[26]!==b||K[27]!==x||K[28]!==S?(k=(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[v,b,x,S]}),K[25]=v,K[26]=b,K[27]=x,K[28]=S,K[29]=k):k=K[29],K[30]!==z||K[31]!==ea||K[32]!==L||K[33]!==ee?(j=ee&&L&&(0,t.jsxs)("div",{role:"presentation",className:"flex items-center gap-1",onClick:ed,onKeyDown:ec,children:[(0,t.jsx)(f.CopyToClipboardButton,{getText:ea,size:"sm",variant:"ghost",className:"h-8 w-8 text-muted-foreground hover:text-foreground",hideCopyText:!0}),(0,t.jsx)(Q,{currentRunDbId:z})]}),K[30]=z,K[31]=ea,K[32]=L,K[33]=ee,K[34]=j):j=K[34],K[35]!==j?(N=(0,t.jsx)("div",{className:"flex items-center gap-1",children:j}),K[35]=j,K[36]=N):N=K[36],K[37]!==m||K[38]!==ew||K[39]!==p||K[40]!==k||K[41]!==N||K[42]!==ev||K[43]!==eb?(C=(0,t.jsxs)("div",{role:ev,tabIndex:eb,className:m,onClick:ew,onKeyDown:p,children:[k,N]}),K[37]=m,K[38]=ew,K[39]=p,K[40]=k,K[41]=N,K[42]=ev,K[43]=eb,K[44]=C):C=K[44];let e_=et?"button":void 0,eS=et?0:void 0,ek=et&&"cursor-pointer";K[45]!==ek?(E=(0,c.cn)("relative",ek),K[45]=ek,K[46]=E):E=K[46];let ej=et?eu:void 0;return K[47]!==et?(P=et?e=>{("Enter"===e.key||" "===e.key)&&(e.preventDefault(),eu())}:void 0,K[47]=et,K[48]=P):P=K[48],K[49]!==L||K[50]!==J?(A=J&&!L&&(0,t.jsxs)("div",{className:"flex items-center justify-center gap-3 text-muted-foreground py-12 animate-pulse px-6",children:[(0,t.jsx)("div",{className:"h-4 w-4 rounded-full border-2 border-current border-t-transparent animate-spin"}),(0,t.jsx)("span",{className:"text-sm",children:"Fusing responses..."})]}),K[49]=L,K[50]=J,K[51]=A):A=K[51],K[52]===Symbol.for("react.memo_cache_sentinel")?(T=(0,t.jsx)(W,{onOverflowChange:es}),K[52]=T):T=K[52],K[53]!==et?(R=et&&(0,t.jsx)("div",{className:"absolute bottom-0 inset-x-0 h-16 bg-gradient-to-t from-background to-transparent pointer-events-none"}),K[53]=et,K[54]=R):R=K[54],K[55]!==e_||K[56]!==eS||K[57]!==E||K[58]!==ej||K[59]!==P||K[60]!==A||K[61]!==R?(O=(0,t.jsxs)("div",{role:e_,tabIndex:eS,className:E,onClick:ej,onKeyDown:P,children:[A,T,R]}),K[55]=e_,K[56]=eS,K[57]=E,K[58]=ej,K[59]=P,K[60]=A,K[61]=R,K[62]=O):O=K[62],K[63]!==et?(I=et&&(0,t.jsxs)("button",{type:"button",onClick:eu,className:"flex items-center justify-center gap-1.5 w-full py-2.5 text-xs font-medium text-muted-foreground hover:text-foreground border-t transition-colors",children:["Read full response",(0,t.jsx)(i.ArrowsPointingOutIcon,{className:"h-3 w-3"})]}),K[63]=et,K[64]=I):I=K[64],K[65]!==C||K[66]!==O||K[67]!==I?(D=(0,t.jsxs)("div",{className:"ph-no-capture rounded-xl border border-border bg-background shadow-sm overflow-hidden animate-in fade-in zoom-in-[0.98] duration-500","data-dd-privacy":"hidden",children:[C,O,I]}),K[65]=C,K[66]=O,K[67]=I,K[68]=D):D=K[68],K[69]!==X||K[70]!==Z||K[71]!==er||K[72]!==Y?(M=er&&(0,t.jsx)(eo,{onClose:el,displayName:Z,displayAuthor:X,sourceModels:Y}),K[69]=X,K[70]=Z,K[71]=er,K[72]=Y,K[73]=M):M=K[73],K[74]!==D||K[75]!==M?(F=(0,t.jsxs)(t.Fragment,{children:[D,M]}),K[74]=D,K[75]=M,K[76]=F):F=K[76],F}],397847);var ev=e.i(671910);e.s(["useFusionTimestamp",0,function(e){let t,r=(0,n.c)(6),o=(0,ev.useRelativeFormatter)(void 0,"expiration");if("live"===e.kind){let t;return r[0]!==e.startTime||r[1]!==o?(t=e.startTime?o(e.startTime)??"":"",r[0]=e.startTime,r[1]=o,r[2]=t):t=r[2],t}return r[3]!==e.createdAt||r[4]!==o?(t=o(e.createdAt)??"",r[3]=e.createdAt,r[4]=o,r[5]=t):t=r[5],t}],596807)}]); //# sourceMappingURL=11ddkxm7a-_au.js.map //# chunkId=01a08d90-2378-7b63-8998-5121f21e4eca