!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-226e-7533-8034-3cf1255960f6")}catch(e){}}();(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,235132,e=>{"use strict";var t=e.i(222666),r=e.i(505962),n=e.i(109917),o=e.i(189511),s=e.i(452473),i=e.i(320347),l=e.i(528164),a=e.i(784510),c=e.i(748151),u=e.i(568728),d=e.i(706527),m=e.i(270401),p=e.i(318875);e.i(406201);var f=e.i(806024),h=e.i(829104),x=e.i(160962),g=e.i(205059),b=e.i(985024),y=e.i(121850),S=e.i(673897),v=e.i(721235),w=e.i(426431);function j(e){return!e.pathname.startsWith("/fusion")}function N(e){return Object.values(e.runLifecycles).some(k)}function k(e){return"streaming"===e.phase||"synthesizing"===e.phase||e.isAnalyzing}function _(e){return e.error}function F(e){return e.synthesizerSlug}function C(e){return e.isAnalyzing}function E(e){return e.phase}var A=e.i(88689),q=e.i(250141),z=e.i(925204),I=e.i(411349),R=e.i(895394),M=e.i(214872);let T=m.forwardRef(function({title:e,titleId:t,...r},n){return m.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:n,"aria-labelledby":t},r),e?m.createElement("title",{id:t},e):null,m.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 13.5V3.75m0 9.75a1.5 1.5 0 0 1 0 3m0-3a1.5 1.5 0 0 0 0 3m0 3.75V16.5m12-3V3.75m0 9.75a1.5 1.5 0 0 1 0 3m0-3a1.5 1.5 0 0 0 0 3m0 3.75V16.5m-6-9V3.75m0 3.75a1.5 1.5 0 0 1 0 3m0-3a1.5 1.5 0 0 0 0 3m0 9.75V10.5"}))});var D=e.i(646013),O=e.i(456343),P=e.i(452447),L=e.i(239718),B=e.i(948992),U=e.i(704318),W=e.i(133256),G=e.i(797738),V=e.i(733288),$=e.i(558200),Y=e.i(531650),K=e.i(970654);e.i(742593);var J=e.i(571236),Q=e.i(778084),X=e.i(738286);e.i(656976);var H=e.i(484994),Z=e.i(823634),ee=e.i(648156),et=e.i(573503),er=e.i(925935),en=e.i(399695),eo=e.i(358058),es=e.i(570655),ei=e.i(624900),el=e.i(705113),ea=e.i(864160),ec=e.i(185473),eu=e.i(80125),ed=e.i(693697),em=e.i(204067),ep=e.i(796805),ef=e.i(621364),eh=e.i(888887),ex=e.i(123215),eg=e.i(979749),eb=e.i(797677),ey=e.i(903121),eS=e.i(679728),ev=e.i(757062),ew=e.i(536652),ej=e.i(389097),eN=e.i(611784),ek=e.i(544678),e_=e.i(462904),eF=e.i(81174),eC=e.i(120765);let eE=ep.z.object({id:ep.z.string(),question:ep.z.string(),type:ep.z.literal("text"),placeholder:ep.z.string()}),eA=ep.z.object({id:ep.z.string(),question:ep.z.string(),type:ep.z.literal("select"),options:ep.z.array(ep.z.string()).min(2)}),eq=ep.z.object({id:ep.z.string(),question:ep.z.string(),type:ep.z.literal("multi_select"),options:ep.z.array(ep.z.string()).min(2)}),ez=ep.z.discriminatedUnion("type",[eE,eA,eq]),eI=ep.z.array(ez).min(2).max(4);function eR(e){return{model:"google/gemini-3-flash-preview-20251217",input:[{type:"message",role:"user",content:e}],stream:!0,provider:{sort:eN.ProviderSort.Throughput}}}async function eM(e){let t="";for await(let r of(0,eC.processResponseStream)(e)){if((0,ed.isErr)(r))break;let e=r.data;if("response.output_text.delta"===e.type&&(t+=e.delta??""),"response.output_text.done"===e.type){t=(e.text??t).trim();break}}return t.trim()}function eT(e){let t=/^```(?:json)?\s*\n?([\s\S]*?)\n?\s*```$/.exec(e.trim());return t?.[1]?.trim()??e.trim()}let eD=`You are a prompt improvement assistant. The user has written a draft prompt that they plan to send to multiple AI models for comparison. Your job is to identify what's missing — constraints, priorities, context, edge cases, what they've already tried — and generate 2-4 targeted clarifying questions. Each question MUST use the best-fit input type: - "text": open-ended answer (use when the answer is freeform, e.g. context, constraints, what they tried). Include a "placeholder" string hinting at the expected answer. - "select": pick exactly one option (use when there's a clear set of mutually exclusive choices, e.g. audience level, output format). Include an "options" array of 2-5 short choices. - "multi_select": pick one or more options (use when multiple choices can apply, e.g. priorities, concerns, requirements). Include an "options" array of 2-6 short choices. Rules: - Each question should surface a specific gap in the prompt - Keep questions short and direct (one sentence) - Give each question a unique lowercase id (e.g. "constraints", "context", "audience", "format") - Do NOT ask generic questions — tailor them to the specific prompt content - Use "select" or "multi_select" whenever the reasonable answers form a finite set — prefer structured input over free text - Return ONLY a raw JSON array, no markdown fences, no explanation Return format (2-4 items): [ {"id": "string", "question": "string", "type": "text", "placeholder": "string"}, {"id": "string", "question": "string", "type": "select", "options": ["A", "B", "C"]}, {"id": "string", "question": "string", "type": "multi_select", "options": ["X", "Y", "Z"]} ] User's draft prompt: `,eO=`You are a prompt improvement assistant. The user has written a draft prompt and already answered some clarifying questions. Based on their answers, generate 2-4 NEW follow-up questions that dig deeper into the specifics revealed by their answers. Each question MUST use the best-fit input type: - "text": open-ended answer (use when the answer is freeform). Include a "placeholder" string hinting at the expected answer. - "select": pick exactly one option (use when there's a clear set of mutually exclusive choices). Include an "options" array of 2-5 short choices. - "multi_select": pick one or more options (use when multiple choices can apply). Include an "options" array of 2-6 short choices. Rules: - Do NOT repeat or rephrase questions that were already asked - Each follow-up should build on what the user already revealed — go deeper, not wider - Keep questions short and direct (one sentence) - Give each question a unique lowercase id that doesn't clash with previous ids - Use "select" or "multi_select" whenever the reasonable answers form a finite set - Return ONLY a raw JSON array, no markdown fences, no explanation Return format (2-4 items): [ {"id": "string", "question": "string", "type": "text", "placeholder": "string"}, {"id": "string", "question": "string", "type": "select", "options": ["A", "B", "C"]}, {"id": "string", "question": "string", "type": "multi_select", "options": ["X", "Y", "Z"]} ] `,eP=`You are a prompt improvement assistant. The user wrote a draft prompt and then answered some clarifying questions. Your job is to rewrite their original prompt incorporating the new information naturally. Rules: - Preserve the user's voice, intent, and tone - Weave in the clarifying answers as additional context or constraints - Do NOT add information the user didn't provide - Do NOT mention that clarifying questions were asked - Keep the prompt concise — don't pad it with filler - Return ONLY the improved prompt text, nothing else Original prompt: `;function eL(e,t){return(0,e_.errT)({rawError:Error(t),location:e})}async function eB(e,t){let r=t??new AbortController,n=await (0,ek.fetchApiResponse)({params:eR(eD+e),abortController:r});if((0,ed.isErr)(n))return(0,eF.wLog)("Failed to fetch clarifying questions",{error:n.error}),(0,e_.errT)({rawError:n.error,location:"prompt-improve:fetch-questions"});if(!n.data.body)return(0,eF.wLog)("Empty response body for clarifying questions"),eL("prompt-improve:fetch-questions","Empty response from model");let o=eT(await eM(n.data.body)),s=(0,ed.wrap)(()=>JSON.parse(o));if((0,ed.isErr)(s))return(0,eF.wLog)("Failed to parse clarifying questions JSON",{content:o.slice(0,200)}),eL("prompt-improve:parse-questions","Failed to parse model response");let i=(0,em.parseSchema)(eI,s.data);return(0,ed.isErr)(i)?((0,eF.wLog)("Clarifying questions failed schema validation",{error:i.error}),eL("prompt-improve:validate-questions","Invalid response format from model")):(0,ed.ok)(i.data)}async function eU({originalPrompt:e,previousQA:t,abortController:r}){let n=t.map(e=>`Q: ${e.question} A: ${e.answer}`).join("\n\n"),o=`${eO}User's draft prompt: ${e} Previous clarifying questions and answers: ${n}`,s=r??new AbortController,i=await (0,ek.fetchApiResponse)({params:eR(o),abortController:s});if((0,ed.isErr)(i))return(0,eF.wLog)("Failed to fetch follow-up questions",{error:i.error}),(0,e_.errT)({rawError:i.error,location:"prompt-improve:fetch-followups"});if(!i.data.body)return(0,eF.wLog)("Empty response body for follow-up questions"),eL("prompt-improve:fetch-followups","Empty response from model");let l=eT(await eM(i.data.body)),a=(0,ed.wrap)(()=>JSON.parse(l));if((0,ed.isErr)(a))return(0,eF.wLog)("Failed to parse follow-up questions JSON",{content:l.slice(0,200)}),eL("prompt-improve:parse-followups","Failed to parse model response");let c=(0,em.parseSchema)(eI,a.data);return(0,ed.isErr)(c)?((0,eF.wLog)("Follow-up questions failed schema validation",{error:c.error}),eL("prompt-improve:validate-followups","Invalid response format from model")):(0,ed.ok)(c.data)}async function eW({originalPrompt:e,answeredQuestions:t,abortController:r}){let n=t.map(e=>`Q: ${e.question} A: ${e.answer}`).join("\n\n"),o=`${eP}${e} Clarifying questions and answers: ${n}`,s=r??new AbortController,i=await (0,ek.fetchApiResponse)({params:eR(o),abortController:s});if((0,ed.isErr)(i))return(0,eF.wLog)("Failed to fetch improved prompt",{error:i.error}),(0,e_.errT)({rawError:i.error,location:"prompt-improve:fetch-rewrite"});if(!i.data.body)return(0,eF.wLog)("Empty response body for improved prompt"),eL("prompt-improve:fetch-rewrite","Empty response from model");let l=await eM(i.data.body);return l?(0,ed.ok)(l):eL("prompt-improve:rewrite-content","Model returned empty content")}let eG={text:{},select:{},multiSelect:{}};function eV(e,t){switch(e.type){case"text":return t.text[e.id]?.trim()||null;case"select":return t.select[e.id]||null;case"multi_select":{let r=t.multiSelect[e.id];if(!r||0===r.size)return null;return[...r].join(", ")}}}function e$({questions:e,answers:t,skippedIds:r}){return e.filter(e=>!r.has(e.id)).map(e=>{let r=eV(e,t);return r?{question:e.question,answer:r}:null}).filter(e=>null!==e)}function eY(e){let n,o,i,l,a,c=(0,r.c)(16),{label:u,isSelected:d,isMulti:m,onClick:p}=e,f=d?"bg-primary/10 text-primary border-primary/30 font-medium":"bg-background text-foreground border-border hover:border-foreground/30 hover:bg-muted/30 font-normal";c[0]!==f?(n=(0,s.cn)("inline-flex items-center gap-2 rounded-md px-3.5 py-2 text-sm transition-all","border",f),c[0]=f,c[1]=n):n=c[1];let h=m?"rounded-xs":"rounded-full",x=d?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30 bg-background";return c[2]!==h||c[3]!==x?(o=(0,s.cn)("flex h-4 w-4 shrink-0 items-center justify-center border transition-colors",h,x),c[2]=h,c[3]=x,c[4]=o):o=c[4],c[5]!==m||c[6]!==d?(i=d&&(m?(0,t.jsx)(P.CheckIcon,{className:"h-3 w-3 stroke-[3]"}):(0,t.jsx)("div",{className:"h-1.5 w-1.5 rounded-full bg-current"})),c[5]=m,c[6]=d,c[7]=i):i=c[7],c[8]!==o||c[9]!==i?(l=(0,t.jsx)("div",{className:o,children:i}),c[8]=o,c[9]=i,c[10]=l):l=c[10],c[11]!==u||c[12]!==p||c[13]!==n||c[14]!==l?(a=(0,t.jsxs)("button",{type:"button",onClick:p,className:n,children:[l,u]}),c[11]=u,c[12]=p,c[13]=n,c[14]=l,c[15]=a):a=c[15],a}function eK(e){let n,o,s,i,l,a=(0,r.c)(12),{question:c,answer:u,index:d}=e,m=d+1;return a[0]!==m?(n=(0,t.jsx)("span",{className:"mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground text-xs font-semibold",children:m}),a[0]=m,a[1]=n):n=a[1],a[2]!==c?(o=(0,t.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:c}),a[2]=c,a[3]=o):o=a[3],a[4]!==u?(s=(0,t.jsx)("p",{className:"text-sm text-foreground/70 mt-1",children:u}),a[4]=u,a[5]=s):s=a[5],a[6]!==o||a[7]!==s?(i=(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[o,s]}),a[6]=o,a[7]=s,a[8]=i):i=a[8],a[9]!==n||a[10]!==i?(l=(0,t.jsxs)("div",{className:"flex items-start gap-4 opacity-60",children:[n,i]}),a[9]=n,a[10]=i,a[11]=l):l=a[11],l}function eJ(e){let n,o,i,l,a,c,u,d,m,p,f,h,x,g=(0,r.c)(46),{question:b,index:y,answers:S,isSkipped:v,onUpdateText:w,onSelectOption:j,onToggleMulti:N,onToggleSkip:k}=e,_=v&&"opacity-40";g[0]!==_?(n=(0,s.cn)("transition-all duration-200",_),g[0]=_,g[1]=n):n=g[1];let F=v?"bg-muted text-muted-foreground line-through":"bg-foreground text-background";g[2]!==F?(o=(0,s.cn)("mt-0.5 flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-xs font-semibold",F),g[2]=F,g[3]=o):o=g[3];let C=y+1;g[4]!==o||g[5]!==C?(i=(0,t.jsx)("span",{className:o,children:C}),g[4]=o,g[5]=C,g[6]=i):i=g[6];let E=`improve-q-${b.id}`,A=v?"text-muted-foreground":"text-foreground";g[7]!==A?(l=(0,s.cn)("text-sm font-medium leading-snug",A),g[7]=A,g[8]=l):l=g[8],g[9]!==v||g[10]!==b.type?(a="multi_select"===b.type&&!v&&(0,t.jsx)("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:"(pick any)"}),g[9]=v,g[10]=b.type,g[11]=a):a=g[11],g[12]!==b.question||g[13]!==a||g[14]!==E||g[15]!==l?(c=(0,t.jsxs)("label",{htmlFor:E,className:l,children:[b.question,a]}),g[12]=b.question,g[13]=a,g[14]=E,g[15]=l,g[16]=c):c=g[16],g[17]!==S||g[18]!==v||g[19]!==j||g[20]!==N||g[21]!==w||g[22]!==b.id||g[23]!==b.options||g[24]!==b.placeholder||g[25]!==b.type?(u=!v&&(0,t.jsxs)("div",{className:"mt-3.5",children:["text"===b.type&&(0,t.jsx)("input",{id:`improve-q-${b.id}`,type:"text",value:S.text[b.id]??"",onChange:e=>w(b.id,e.target.value),placeholder:b.placeholder,className:(0,s.cn)("h-10 w-full rounded-lg border bg-background px-3.5 text-sm","placeholder:text-muted-foreground/50","focus:outline-hidden focus:ring-2 focus:ring-ring/40","transition-all")}),"select"===b.type&&(0,t.jsx)("div",{className:"flex flex-col gap-2",children:b.options.map(e=>(0,t.jsx)(eY,{label:e,isSelected:S.select[b.id]===e,isMulti:!1,onClick:()=>j(b.id,e)},e))}),"multi_select"===b.type&&(0,t.jsx)("div",{className:"flex flex-col gap-2",children:b.options.map(e=>(0,t.jsx)(eY,{label:e,isSelected:S.multiSelect[b.id]?.has(e)??!1,isMulti:!0,onClick:()=>N(b.id,e)},e))})]}),g[17]=S,g[18]=v,g[19]=j,g[20]=N,g[21]=w,g[22]=b.id,g[23]=b.options,g[24]=b.placeholder,g[25]=b.type,g[26]=u):u=g[26],g[27]!==k||g[28]!==b.id?(d=()=>k(b.id),g[27]=k,g[28]=b.id,g[29]=d):d=g[29];let q=v?"text-primary hover:text-primary/80 font-medium":"text-muted-foreground/60 hover:text-muted-foreground";g[30]!==q?(m=(0,s.cn)("mt-3 text-xs transition-colors",q),g[30]=q,g[31]=m):m=g[31];let z=v?"Undo skip":"Not relevant, skip";return g[32]!==d||g[33]!==m||g[34]!==z?(p=(0,t.jsx)("button",{type:"button",onClick:d,className:m,children:z}),g[32]=d,g[33]=m,g[34]=z,g[35]=p):p=g[35],g[36]!==c||g[37]!==u||g[38]!==p?(f=(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[c,u,p]}),g[36]=c,g[37]=u,g[38]=p,g[39]=f):f=g[39],g[40]!==f||g[41]!==i?(h=(0,t.jsxs)("div",{className:"flex items-start gap-4",children:[i,f]}),g[40]=f,g[41]=i,g[42]=h):h=g[42],g[43]!==h||g[44]!==n?(x=(0,t.jsx)("div",{className:n,children:h}),g[43]=h,g[44]=n,g[45]=x):x=g[45],x}function eQ(e){let o,s,i,a,c,u,d,p,f,h,x,g,b,y,S,v,w,j,N,k,_,F,C,E,A,q,z=(0,r.c)(91),{isOpen:I,setIsOpen:R,prompt:M,setPrompt:T}=e,[D,O]=(0,m.useState)("loading");z[0]===Symbol.for("react.memo_cache_sentinel")?(o=[],z[0]=o):o=z[0];let[L,B]=(0,m.useState)(o),[U,W]=(0,m.useState)(eG);z[1]===Symbol.for("react.memo_cache_sentinel")?(s=new Set,z[1]=s):s=z[1];let[G,$]=(0,m.useState)(s);z[2]===Symbol.for("react.memo_cache_sentinel")?(i=[],z[2]=i):i=z[2];let[Y,K]=(0,m.useState)(i),[J,Q]=(0,m.useState)(null),X=(0,m.useRef)(null),H=(0,m.useRef)(M),Z=(0,m.useRef)(null);z[3]!==Y?(a=Y.flatMap(eZ),z[3]=Y,z[4]=a):a=z[4];let ee=a,et=Y.reduce(eH,0);z[5]===Symbol.for("react.memo_cache_sentinel")?(c=async()=>{O("loading"),Q(null),K([]);let e=new AbortController;X.current=e;let t=await eB(H.current,e);e.signal.aborted||((0,ed.isOk)(t)?(B(t.data),W(eG),$(new Set),O("questions")):(Q("Failed to generate questions. Please try again."),O("error")))},z[5]=c):c=z[5];let er=c;z[6]!==I||z[7]!==M?(u=()=>(I&&(H.current=M,er()),()=>{X.current?.abort()}),z[6]=I,z[7]=M,z[8]=u):u=z[8],z[9]!==I?(d=[I,er],z[9]=I,z[10]=d):d=z[10],(0,m.useEffect)(u,d),z[11]!==R?(p=()=>{X.current?.abort(),R(!1)},z[11]=R,z[12]=p):p=z[12];let en=p;z[13]===Symbol.for("react.memo_cache_sentinel")?(f=(e,t)=>{W(r=>({...r,text:{...r.text,[e]:t}}))},z[13]=f):f=z[13];let eo=f;z[14]===Symbol.for("react.memo_cache_sentinel")?(h=(e,t)=>{W(r=>({...r,select:{...r.select,[e]:r.select[e]===t?"":t}}))},z[14]=h):h=z[14];let es=h;z[15]===Symbol.for("react.memo_cache_sentinel")?(x=(e,t)=>{W(r=>{let n=new Set(r.multiSelect[e]);return n.has(t)?n.delete(t):n.add(t),{...r,multiSelect:{...r.multiSelect,[e]:n}}})},z[15]=x):x=z[15];let ei=x;z[16]===Symbol.for("react.memo_cache_sentinel")?(g=e=>{$(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},z[16]=g):g=z[16];let el=g;if(z[17]!==ee||z[18]!==U||z[19]!==Y||z[20]!==J||z[21]!==en||z[22]!==I||z[23]!==D||z[24]!==L||z[25]!==R||z[26]!==T||z[27]!==G||z[28]!==et){let e,r,o,s,i,a,c,u=e$({questions:L,answers:U,skippedIds:G});z[40]!==U||z[41]!==L||z[42]!==G?(e=function({questions:e,answers:t,skippedIds:r}){return e.some(e=>!r.has(e.id)&&null!==eV(e,t))}({questions:L,answers:U,skippedIds:G}),z[40]=U,z[41]=L,z[42]=G,z[43]=e):e=z[43];let d=e,m="confirmed"===D&&(u.length>0||ee.length>0)||ee.length>0;z[44]===Symbol.for("react.memo_cache_sentinel")?(r=()=>{O("confirmed")},z[44]=r):r=z[44];let p=r;z[45]!==ee||z[46]!==U||z[47]!==L||z[48]!==G?(o=async()=>{let e=e$({questions:L,answers:U,skippedIds:G}),t=[...ee,...e];if(0===t.length)return;K(t=>[...t,{questions:L,resolvedAnswers:e}]),O("loading-followups"),Q(null);let r=new AbortController;X.current=r;let n=await eU({originalPrompt:H.current,previousQA:t,abortController:r});r.signal.aborted||((0,ed.isOk)(n)?(B(n.data),W(eG),$(new Set),O("questions"),requestAnimationFrame(()=>{Z.current?.scrollIntoView({behavior:"smooth",block:"nearest"})})):(Q("Failed to generate follow-up questions."),O("confirmed")))},z[45]=ee,z[46]=U,z[47]=L,z[48]=G,z[49]=o):o=z[49];let f=o;z[50]!==ee||z[51]!==U||z[52]!==L||z[53]!==R||z[54]!==T||z[55]!==G?(s=async()=>{let e=[...ee,...e$({questions:L,answers:U,skippedIds:G})];if(0===e.length)return;O("improving"),Q(null);let t=new AbortController;X.current=t;let r=await eW({originalPrompt:H.current,answeredQuestions:e,abortController:t});if(!t.signal.aborted){if((0,ed.isErr)(r)){Q("Failed to improve prompt. Please try again."),O("confirmed");return}(0,eS.trackFusionEvent)(eS.FusionEvent.ImprovePromptApply,{promptLength:r.data.length}),T(r.data),R(!1)}},z[50]=ee,z[51]=U,z[52]=L,z[53]=R,z[54]=T,z[55]=G,z[56]=s):s=z[56];let h=s,x="loading-followups"===D,g="questions"===D,E="confirmed"===D;if(z[57]!==Y.length||z[58]!==E){var ea;ea=Y.length,i=E?"Answers locked in. Dig deeper or apply now.":ea>0?"Digging deeper based on your answers.":"Answer what’s useful, skip what isn’t.",z[57]=Y.length,z[58]=E,z[59]=i}else i=z[59];let A=i;y=ej.Dialog,F=I,C=en,b=ej.DialogContent,S="ph-no-capture max-w-[40rem] p-0",v="hidden",w=!1,z[60]===Symbol.for("react.memo_cache_sentinel")?(a=(0,t.jsxs)("div",{className:"flex items-center gap-3 mb-1.5",children:[(0,t.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-foreground",children:(0,t.jsx)(V.SparklesIcon,{className:"h-4 w-4 text-background"})}),(0,t.jsx)("h3",{className:"text-lg font-semibold text-foreground",children:"Improve your prompt"})]}),z[60]=a):a=z[60],z[61]!==g||z[62]!==E||z[63]!==x||z[64]!==A?(c=(g||E||x)&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground mt-1 ml-[44px]",children:A}),z[61]=g,z[62]=E,z[63]=x,z[64]=A,z[65]=c):c=z[65],z[66]!==c?(j=(0,t.jsxs)("div",{className:"px-6 pt-6 pb-4",children:[a,c]}),z[66]=c,z[67]=j):j=z[67],z[68]!==D?(N="loading"===D&&(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3 py-12 px-6",children:[(0,t.jsx)("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-foreground/20 border-t-foreground"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Analyzing your prompt..."})]}),z[68]=D,z[69]=N):N=z[69],z[70]!==J||z[71]!==en||z[72]!==D?(k="error"===D&&(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4 py-12 px-6",children:[(0,t.jsx)("p",{className:"text-sm text-destructive",children:J}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",onClick:er,children:[(0,t.jsx)(n.ArrowPathIcon,{className:"h-3.5 w-3.5"}),"Retry"]}),(0,t.jsx)(l.Button,{variant:"ghost",size:"sm",onClick:en,children:"Cancel"})]})]}),z[70]=J,z[71]=en,z[72]=D,z[73]=k):k=z[73],_=(g||E||x)&&(0,t.jsxs)("form",{className:"contents",onSubmit:e=>{e.preventDefault(),g&&d&&p()},children:[(0,t.jsx)("div",{className:"border-t"}),(0,t.jsxs)("div",{className:"flex flex-col gap-8 px-6 py-6 max-h-[60vh] overflow-y-auto",children:[Y.flatMap((e,r)=>e.resolvedAnswers.map((e,n)=>{let o=Y.slice(0,r).reduce(eX,0)+n;return(0,t.jsx)(eK,{question:e.question,answer:e.answer,index:o},`prev-${r}-${n}`)})),Y.length>0&&L.length>0&&!x&&!E&&(0,t.jsxs)("div",{className:"flex items-center gap-3 text-xs text-muted-foreground pt-2",children:[(0,t.jsx)("div",{className:"flex-1 border-t"}),(0,t.jsx)("span",{className:"shrink-0",children:"Follow-up questions"}),(0,t.jsx)("div",{className:"flex-1 border-t"})]}),x&&(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6",children:[(0,t.jsx)("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-foreground/20 border-t-foreground"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Generating follow-up questions..."})]}),E&&u.map((e,r)=>(0,t.jsx)(eK,{question:e.question,answer:e.answer,index:et+r},`confirmed-${r}`)),g&&L.map((e,r)=>(0,t.jsx)(eJ,{question:e,index:et+r,answers:U,isSkipped:G.has(e.id),onUpdateText:eo,onSelectOption:es,onToggleMulti:ei,onToggleSkip:el},e.id)),(0,t.jsx)("div",{ref:Z})]}),(0,t.jsxs)("div",{className:"border-t px-6 py-4 flex items-center justify-between bg-muted/10",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:g&&G.size>0&&`${G.size} skipped`}),(0,t.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,t.jsx)(l.Button,{type:"button",variant:"ghost",size:"md",className:"text-sm",onClick:en,children:"Cancel"}),g&&(0,t.jsxs)(l.Button,{type:"submit",size:"md",className:"text-sm px-6",disabled:!d,children:[(0,t.jsx)(P.CheckIcon,{className:"h-4 w-4"}),"Confirm"]}),E&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l.Button,{type:"button",variant:"outline",size:"md",className:"text-sm",onClick:f,children:[(0,t.jsx)(ew.ArrowsPointingOutIcon,{className:"h-4 w-4"}),"Dig deeper"]}),(0,t.jsxs)(l.Button,{type:"button",size:"md",className:"text-sm px-6",disabled:!m,onClick:h,children:[(0,t.jsx)(V.SparklesIcon,{className:"h-4 w-4"}),"Apply"]})]})]})]})]}),z[17]=ee,z[18]=U,z[19]=Y,z[20]=J,z[21]=en,z[22]=I,z[23]=D,z[24]=L,z[25]=R,z[26]=T,z[27]=G,z[28]=et,z[29]=b,z[30]=y,z[31]=S,z[32]=v,z[33]=w,z[34]=j,z[35]=N,z[36]=k,z[37]=_,z[38]=F,z[39]=C}else b=z[29],y=z[30],S=z[31],v=z[32],w=z[33],j=z[34],N=z[35],k=z[36],_=z[37],F=z[38],C=z[39];return z[74]!==D?(E="improving"===D&&(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3 py-12 px-6",children:[(0,t.jsx)("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-foreground/20 border-t-foreground"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Rewriting your prompt..."})]}),z[74]=D,z[75]=E):E=z[75],z[76]!==b||z[77]!==S||z[78]!==v||z[79]!==w||z[80]!==j||z[81]!==N||z[82]!==k||z[83]!==_||z[84]!==E?(A=(0,t.jsxs)(b,{className:S,"data-dd-privacy":v,showCloseButton:w,children:[j,N,k,_,E]}),z[76]=b,z[77]=S,z[78]=v,z[79]=w,z[80]=j,z[81]=N,z[82]=k,z[83]=_,z[84]=E,z[85]=A):A=z[85],z[86]!==y||z[87]!==F||z[88]!==C||z[89]!==A?(q=(0,t.jsx)(y,{open:F,onOpenChange:C,children:A}),z[86]=y,z[87]=F,z[88]=C,z[89]=A,z[90]=q):q=z[90],q}function eX(e,t){return e+t.resolvedAnswers.length}function eH(e,t){return e+t.resolvedAnswers.length}function eZ(e){return e.resolvedAnswers}let e0=ep.z.object({state:ep.z.object({modelSlugs:ep.z.array(ep.z.string()).min(1)})});function e1(e){let n,o,i,a=(0,r.c)(9),{canSubmit:c,isAttachmentLoading:u,isStreaming:d,onRun:m,onSignupIntent:p}=e,f=!c||u||d,h=!c&&"opacity-40";return a[0]!==h?(n=(0,s.cn)("transition-all h-8 w-8",h),a[0]=h,a[1]=n):n=a[1],a[2]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(D.ArrowUpIcon,{className:"h-4 w-4"}),a[2]=o):o=a[2],a[3]!==d||a[4]!==m||a[5]!==p||a[6]!==f||a[7]!==n?(i=(0,t.jsx)(l.Button,{onClick:m,onPointerEnter:p,onPointerDown:p,onTouchStart:p,onFocus:p,disabled:f,isLoading:d,size:"icon",className:n,"aria-label":"Run Fusion",children:o}),a[3]=d,a[4]=m,a[5]=p,a[6]=f,a[7]=n,a[8]=i):i=a[8],i}function e2(){let e,n=(0,r.c)(1);return n[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(m.Suspense,{fallback:null,children:(0,t.jsx)(e3,{})}),n[0]=e):e=n[0],e}function e3(){let e,n,o,i,u,p,f,h,x,g,b,y,S,v,j,N,k,_,F,C,E,q,z,I,R,M,D,er,ep,ew,ej,eN,ek,e_,eF,eC,eE,eA,eq,ez,eI,eR,eM,eT,eD,eO,eP,eL,eB,eU,eW,eG,eV,e$,eY,eK,eJ,eX,eH,eZ,e2,e3,t_,tF,tC,tE,tA,tq,tz,tI,tR,tM,tT,tD,tO,tP,tL,tB,tU,tW,tG,tV,t$,tY,tK,tJ,tQ,tX,tH=(0,r.c)(250),tZ=(0,m.useId)(),t0=(0,w.useFusionStore)(tk),t1=(0,w.useFusionStore)(tN),t2=(0,w.useFusionStore)(tj),t3=(0,w.useFusionStore)(tw),t4=(0,w.useFusionStore)(tv),t5=(0,w.useFusionStore)(tS),t6=(0,w.useFusionStore)(ty),t7=(0,w.useFusionStore)(tb),t8=(0,w.useFusionStore)(tg),t9=(0,w.useFusionStore)(tx),re=(0,w.useFusionStore)(th),rt=(0,w.useFusionStore)(tf),rr=(0,w.useFusionStore)(tp),rn=(0,w.useFusionStore)(tm),ro=(0,w.useFusionStore)(td),rs=(0,w.useFusionStore)(tu),ri=(0,w.useFusionStore)(tc),rl=(0,w.useFusionStore)(ta),ra=(0,w.useFusionStore)(tl),rc=(0,w.useFusionStore)(ti),ru=(0,w.useFusionStore)(ts),rd=(0,w.useFusionStore)(to),rm=(0,eo.useAttachments)(),rp=(0,m.useRef)(null),{isDragging:rf,isValid:rh}=(0,es.useDragDrop)(rp),rx=(0,m.useRef)(rd),rg=(0,m.useRef)(!1);tH[0]!==rm||tH[1]!==rd?(e=()=>{rd!==rx.current&&(rx.current=rd,rm.reset(),rg.current=!1)},n=[rd,rm],tH[0]=rm,tH[1]=rd,tH[2]=e,tH[3]=n):(e=tH[2],n=tH[3]),(0,m.useEffect)(e,n),tH[4]!==rm.list||tH[5]!==ru?(o=()=>{ru(rm.list.map(tn).filter(tr))},i=[rm.list,ru],tH[4]=rm.list,tH[5]=ru,tH[6]=o,tH[7]=i):(o=tH[6],i=tH[7]),(0,m.useEffect)(o,i);let rb=(0,a.useGlobal)(),ry=rb?.getModelInfoByVariantSlug,rS=rb?.getModelInfoByVariantPermaslug;tH[8]===Symbol.for("react.memo_cache_sentinel")?(u={models:ef.parseAsString,prompt:ef.parseAsString},tH[8]=u):u=tH[8];let[rv]=(0,ef.useQueryStates)(u),{models:rw,prompt:rj}=rv,rN=(0,ea.useUserStore)(tt),rk=(0,eg.useSignupIntentPrefetch)(rN),r_=(0,ex.useOpenSignUpWithAttribution)(),[rF,rC]=(0,m.useState)(!1),[rE,rA]=(0,m.useState)(""),[rq,rz]=(0,m.useState)(!1),rI=(0,m.useRef)(!1),rR=(0,m.useRef)(!1);tH[9]!==t0||tH[10]!==rj||tH[11]!==t4?(p=()=>{rj&&"idle"===t0&&!rI.current&&(rI.current=!0,t4(rj))},f=[rj,t0,t4],tH[9]=t0,tH[10]=rj,tH[11]=t4,tH[12]=p,tH[13]=f):(p=tH[12],f=tH[13]),(0,m.useEffect)(p,f);let rM=(0,w.useFusionStore)(te),rT=(0,A.useIsWorkspacePartitionCurrent)();tH[14]!==rT||tH[15]!==rM?(h=()=>rT?(0,ev.listModelSetsForPartition)(rM):Promise.resolve([]),x=[rM,rT],tH[14]=rT,tH[15]=rM,tH[16]=h,tH[17]=x):(h=tH[16],x=tH[17]),tH[18]===Symbol.for("react.memo_cache_sentinel")?(g=[],tH[18]=g):g=tH[18],tH[19]!==h||tH[20]!==x?(b={querier:h,deps:x,defaultValue:g},tH[19]=h,tH[20]=x,tH[21]=b):b=tH[21];let rD=(0,ev.useLiveQuery)(b),rO="idle"===t0,rP="streaming"===t0,rL=rm.loadingKeys.size>0;tH[22]!==rL||tH[23]!==rT||tH[24]!==t1||tH[25]!==t3.length?(y=rT&&!!t1.trim()&&t3.length>=2&&!rL,tH[22]=rL,tH[23]=rT,tH[24]=t1,tH[25]=t3.length,tH[26]=y):y=tH[26];let rB=y;tH[27]!==t9||tH[28]!==rL||tH[29]!==rN||tH[30]!==r_?(S=()=>{if(!rL){if(!rN)return void r_({forceRedirectUrl:"/fusion",signInForceRedirectUrl:"/fusion"});t9()}},tH[27]=t9,tH[28]=rL,tH[29]=rN,tH[30]=r_,tH[31]=S):S=tH[31];let rU=S;tH[32]!==rm?(v=async e=>{if(!e.clipboardData)return;let t=[...e.clipboardData.items].some(e9),r=[...e.clipboardData.items].some(e8);t&&!r&&await rm.handleFiles((0,en.getFilesFromClipboard)(e))},tH[32]=rm,tH[33]=v):v=tH[33];let rW=v;tH[34]!==rS||tH[35]!==ry?(j=(e,t)=>ry&&rS?(0,ec.toNonNullArray)(e.map(e=>t?rS(e)??ry(e):ry(e)??rS(e))):[],tH[34]=rS,tH[35]=ry,tH[36]=j):j=tH[36];let rG=j;tH[37]!==rG||tH[38]!==t6||tH[39]!==rD?(N=e=>{if("number"==typeof e){let t=rD.find(t=>t.id===e);t&&t6(e,rG(t.modelSlugs,!1))}else{let t=c.FUSION_MODEL_SETS.find(t=>t.id===e);t&&t6(e,rG(t.permaslugs,!0))}},tH[37]=rG,tH[38]=t6,tH[39]=rD,tH[40]=N):N=tH[40];let rV=N;tH[41]!==t6?(k=()=>{t6("custom",[])},tH[41]=t6,tH[42]=k):k=tH[42];let r$=k;tH[43]!==rS||tH[44]!==ry||tH[45]!==rw||tH[46]!==t0||tH[47]!==rG||tH[48]!==t6||tH[49]!==t3?(_=()=>{if(!rw||"idle"!==t0||rR.current||!ry||!rS)return;let e=rw.split(",").map(e7).filter(Boolean);if(0===e.length){rR.current=!0;return}let t=rG(e,!1);if(0===t.length)return;rR.current=!0;let r=new Set(t3.map(e6)),n=t.filter(e=>!r.has((0,d.getModelVariantSlug)(e)));n.length>0&&t6("custom",[...t3,...n].slice(0,4))},F=[rw,t0,ry,rS,rG,t6,t3],tH[43]=rS,tH[44]=ry,tH[45]=rw,tH[46]=t0,tH[47]=rG,tH[48]=t6,tH[49]=t3,tH[50]=_,tH[51]=F):(_=tH[50],F=tH[51]),(0,m.useEffect)(_,F),tH[52]!==rT||tH[53]!==rE||tH[54]!==re?(C=async()=>{rT&&rE.trim()&&(await re(rE),rC(!1),rA(""))},tH[52]=rT,tH[53]=rE,tH[54]=re,tH[55]=C):C=tH[55];let rY=C;if(tH[56]!==ry||tH[57]!==rV||tH[58]!==rG||tH[59]!==t2||tH[60]!==t3.length||tH[61]!==t5?(E=()=>{if(!rg.current){if(t3.length>0){rg.current=!0;return}if(ry&&!rR.current){if("custom"===t2){let e=function(e){let t=localStorage.getItem("openrouter:mixture-settings");if(!t)return[];let r=(0,ed.wrap)(()=>JSON.parse(t));if((0,ed.isErr)(r))return[];let n=(0,em.parseSchema)(e0,r.data);return(0,ed.isErr)(n)?[]:e(n.data.state.modelSlugs,!1)}(rG);if(e.length>0){t5(e),rg.current=!0;return}}rV("custom"===t2?c.DEFAULT_MODEL_SET_ID:t2)}}},q=[ry,rV,rG,t5,t3.length,t2],tH[56]=ry,tH[57]=rV,tH[58]=rG,tH[59]=t2,tH[60]=t3.length,tH[61]=t5,tH[62]=E,tH[63]=q):(E=tH[62],q=tH[63]),(0,m.useEffect)(E,q),tH[64]===Symbol.for("react.memo_cache_sentinel")?(z=(0,t.jsxs)("div",{className:"text-center mb-6 md:absolute md:bottom-full md:left-0 md:right-0 md:mb-0 px-4",children:[(0,t.jsxs)("h1",{className:"text-3xl font-bold tracking-tight inline-flex items-center gap-2 justify-center",children:["Model Fusion",(0,t.jsx)(K.Badge,{variant:"promo",size:"md",children:"beta"})]}),(0,t.jsx)("p",{className:"text-muted-foreground mt-2",children:"Run multiple models side-by-side, run an analysis, and fuse into the best result."})]}),tH[64]=z):z=tH[64],tH[65]!==rV||tH[66]!==t2?(I=c.FUSION_MODEL_SETS.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>rV(e.id),className:(0,s.cn)("inline-flex items-center px-3 py-1.5 rounded-full text-xs font-medium transition-colors border",t2===e.id?"bg-foreground text-background border-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted/50 border-transparent bg-muted/30"),children:e.label},e.id)),tH[65]=rV,tH[66]=t2,tH[67]=I):I=tH[67],tH[68]!==rt||tH[69]!==rV||tH[70]!==t2||tH[71]!==rD){let e;tH[73]!==rt||tH[74]!==rV||tH[75]!==t2?(e=e=>(0,t.jsxs)("div",{className:(0,s.cn)("group inline-flex items-center gap-1 rounded-full text-xs font-medium transition-colors border pl-3 pr-1.5 py-1.5",t2===e.id?"bg-foreground text-background border-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted/50 border-transparent bg-muted/30"),children:[(0,t.jsx)("button",{type:"button",onClick:()=>rV(e.id),className:"mr-1",children:e.label}),(0,t.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),rt(e.id)},className:(0,s.cn)("rounded-full p-0.5 opacity-0 group-hover:opacity-100 transition-opacity",t2===e.id?"hover:bg-background/20":"hover:bg-muted-foreground/20"),children:(0,t.jsx)($.XMarkIcon,{className:"h-3 w-3"})})]},e.id),tH[73]=rt,tH[74]=rV,tH[75]=t2,tH[76]=e):e=tH[76],R=rD.map(e),tH[68]=rt,tH[69]=rV,tH[70]=t2,tH[71]=rD,tH[72]=R}else R=tH[72];let rK="custom"===t2?"bg-foreground text-background border-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted/50 border-transparent bg-muted/30";if(tH[77]!==rK?(M=(0,s.cn)("inline-flex items-center px-3 py-1.5 rounded-full text-xs font-medium transition-colors border",rK),tH[77]=rK,tH[78]=M):M=tH[78],tH[79]!==r$||tH[80]!==M?(D=(0,t.jsx)("button",{type:"button",onClick:r$,className:M,children:"Custom"}),tH[79]=r$,tH[80]=M,tH[81]=D):D=tH[81],tH[82]!==rY||tH[83]!==rF||tH[84]!==rE||tH[85]!==t2||tH[86]!==t3.length?(er="custom"===t2&&t3.length>=2&&(0,t.jsx)("div",{className:"flex items-center gap-2 ml-2 border-l pl-2",children:rF?(0,t.jsxs)("div",{className:"flex items-center gap-1 animate-in fade-in slide-in-from-right-2 duration-200",children:[(0,t.jsx)("input",{type:"text",value:rE,onChange:e=>rA(e.target.value),placeholder:"Group name",className:"h-7 w-32 rounded-sm border bg-transparent px-2 text-xs focus:outline-hidden focus:border-focus-border focus:shadow-focus",autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&rY(),"Escape"===e.key&&rC(!1)}}),(0,t.jsx)(l.Button,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:rY,disabled:!rE.trim(),children:(0,t.jsx)(P.CheckIcon,{className:"h-4 w-4"})}),(0,t.jsx)(l.Button,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>rC(!1),children:(0,t.jsx)($.XMarkIcon,{className:"h-4 w-4"})})]}):(0,t.jsxs)(l.Button,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs text-muted-foreground hover:text-foreground",onClick:()=>rC(!0),children:[(0,t.jsx)(O.BookmarkSquareIcon,{className:"h-3.5 w-3.5 mr-1.5"}),"Save Group"]})}),tH[82]=rY,tH[83]=rF,tH[84]=rE,tH[85]=t2,tH[86]=t3.length,tH[87]=er):er=tH[87],tH[88]!==I||tH[89]!==R||tH[90]!==D||tH[91]!==er?(ep=(0,t.jsxs)("div",{className:"flex items-center gap-2 overflow-x-auto no-scrollbar pb-1",children:[I,R,D,er]}),tH[88]=I,tH[89]=R,tH[90]=D,tH[91]=er,tH[92]=ep):ep=tH[92],tH[93]===Symbol.for("react.memo_cache_sentinel")?(ew=(0,t.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:["Models",(0,t.jsx)(ee.Tooltip,{content:"These models each answer your prompt side-by-side",children:(0,t.jsx)("span",{className:"inline-flex",children:(0,t.jsx)(U.InformationCircleIcon,{className:"h-3 w-3 cursor-help text-muted-foreground hover:text-foreground"})})})]}),tH[93]=ew):ew=tH[93],tH[94]!==t8||tH[95]!==t3){let e;tH[97]!==t8?(e=e=>{let r=(0,d.getModelVariantSlug)(e);return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5 bg-muted/50 border rounded-md pl-2.5 pr-1.5 py-1 text-xs font-medium text-foreground",children:[e.short_name,(0,t.jsx)("button",{type:"button",onClick:()=>t8(r),className:"hover:bg-muted-foreground/20 rounded-full p-0.5 text-muted-foreground hover:text-foreground transition-colors",children:(0,t.jsx)($.XMarkIcon,{className:"h-3 w-3"})})]},r)},tH[97]=t8,tH[98]=e):e=tH[98],ej=t3.map(e),tH[94]=t8,tH[95]=t3,tH[96]=ej}else ej=tH[96];tH[99]!==t3||tH[100]!==t7?(eN=t3.length<4&&(0,t.jsx)(eh.ModelSelect,{selectedModelSlugs:t3.map(e5),onDone:t7,closeOnSelect:!1,isDialog:!0,title:"Add Source Model",description:"Choose models to run side-by-side",showGuardrailsWarning:!0,hideUnavailableByDefault:!0,children:(0,t.jsxs)("button",{type:"button",className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground border border-dashed rounded-md px-2.5 py-1 hover:bg-muted/50 transition-colors",children:[(0,t.jsx)(G.PlusIcon,{className:"h-3 w-3"}),"Add Model"]})}),tH[99]=t3,tH[100]=t7,tH[101]=eN):eN=tH[101],tH[102]!==ej||tH[103]!==eN?(ek=(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 min-h-[28px]",children:[ew,ej,eN]}),tH[102]=ej,tH[103]=eN,tH[104]=ek):ek=tH[104],tH[105]===Symbol.for("react.memo_cache_sentinel")?(e_=(0,t.jsxs)("span",{className:"flex shrink-0 items-center gap-1 text-xs text-muted-foreground",children:["Synthesizer",(0,t.jsx)(ee.Tooltip,{content:"This model analyzes all panel responses, then writes the final answer",children:(0,t.jsx)("span",{className:"inline-flex",children:(0,t.jsx)(U.InformationCircleIcon,{className:"h-3 w-3 cursor-help text-muted-foreground hover:text-foreground"})})})]}),tH[105]=e_):e_=tH[105],tH[106]!==ry||tH[107]!==ra?(eF=ra?ry?.(ra)??null:null,tH[106]=ry,tH[107]=ra,tH[108]=eF):eF=tH[108],tH[109]!==rc?(eC=e=>rc((0,d.getModelVariantSlug)(e)),tH[109]=rc,tH[110]=eC):eC=tH[110],tH[111]!==ry||tH[112]!==ra?(eE=ra?ry?.(ra)?.short_name??"Select model":"Select model",tH[111]=ry,tH[112]=ra,tH[113]=eE):eE=tH[113],tH[114]!==eE?(eA=(0,t.jsx)("button",{type:"button",className:"inline-flex items-center gap-1.5 text-xs font-medium text-foreground border border-dashed rounded-md px-2.5 py-1 hover:bg-muted/50 transition-colors",children:eE}),tH[114]=eE,tH[115]=eA):eA=tH[115],tH[116]!==eF||tH[117]!==eC||tH[118]!==eA?(eq=(0,t.jsx)(eh.ModelSelect,{selected:eF,onDone:eC,isDialog:!0,title:"Select Fusion Model",description:"Choose a model to analyze and synthesize the responses",showGuardrailsWarning:!0,hideUnavailableByDefault:!0,children:eA}),tH[116]=eF,tH[117]=eC,tH[118]=eA,tH[119]=eq):eq=tH[119],tH[120]!==rc||tH[121]!==ra?(ez=ra&&ra!==c.DEFAULT_FUSION_ANALYST_SLUG&&(0,t.jsx)("button",{type:"button",onClick:()=>rc(c.DEFAULT_FUSION_ANALYST_SLUG),className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",title:"Reset to default (Claude Opus)",children:(0,t.jsx)($.XMarkIcon,{className:"h-3 w-3"})}),tH[120]=rc,tH[121]=ra,tH[122]=ez):ez=tH[122],tH[123]!==eq||tH[124]!==ez?(eI=(0,t.jsxs)("div",{className:"flex items-center gap-2 min-h-[28px]",children:[e_,eq,ez]}),tH[123]=eq,tH[124]=ez,tH[125]=eI):eI=tH[125],tH[126]!==ep||tH[127]!==ek||tH[128]!==eI?(eR=(0,t.jsxs)("div",{className:"flex flex-col gap-3 px-4 py-3 border-b bg-background",children:[ep,ek,eI]}),tH[126]=ep,tH[127]=ek,tH[128]=eI,tH[129]=eR):eR=tH[129];let rJ=0===rm.list.length&&!rf;tH[130]===Symbol.for("react.memo_cache_sentinel")?(eM=(0,s.cn)("bg-accent/80 flex w-full shadow-inner","p-2"),tH[130]=eM):eM=tH[130];let rQ=rm.list.length,rX=!rf;tH[131]!==rm||tH[132]!==rh?(eT=async e=>{rh&&await rm.handleFiles((0,en.getFilesFromDragDrop)(e))},tH[131]=rm,tH[132]=rh,tH[133]=eT):eT=tH[133],tH[134]!==rh||tH[135]!==eT?(eD=(0,t.jsx)(ey.ComposerDropZone,{isValid:rh,onDrop:eT}),tH[134]=rh,tH[135]=eT,tH[136]=eD):eD=tH[136],tH[137]!==rX||tH[138]!==eD?(eO=(0,t.jsx)(J.Fade,{hidden:rX,children:eD}),tH[137]=rX,tH[138]=eD,tH[139]=eO):eO=tH[139],tH[140]!==rm?(eP=rm.list.map((e,r)=>(0,t.jsx)(el.AttachmentPreview,{attachment:e,onDismiss:()=>rm.remove(e),isLoading:rm.loadingKeys.has((0,ei.getAttachmentKey)(e))},`fusion-attachment-${r}`)),tH[140]=rm,tH[141]=eP):eP=tH[141],tH[142]!==eP?(eL=(0,t.jsx)("div",{className:"flex gap-2",children:eP}),tH[142]=eP,tH[143]=eL):eL=tH[143],tH[144]!==rm.list.length||tH[145]!==eO||tH[146]!==eL?(eB=(0,t.jsxs)(eb.AutoScrollContainer,{className:"rounded-lg",itemCount:rQ,orientation:"horizontal",children:[eO,eL]}),tH[144]=rm.list.length,tH[145]=eO,tH[146]=eL,tH[147]=eB):eB=tH[147],tH[148]!==rJ||tH[149]!==eB?(eU=(0,t.jsx)(J.Fade,{hidden:rJ,inClassName:"h-36 slide-in-from-bottom-12",outClassName:"h-0 slide-out-to-bottom-12",className:eM,children:eB}),tH[148]=rJ,tH[149]=eB,tH[150]=eU):eU=tH[150],tH[151]!==t4?(eW=e=>t4(e.target.value),tH[151]=t4,tH[152]=eW):eW=tH[152],tH[153]!==rB||tH[154]!==rU||tH[155]!==rk||tH[156]!==rP?(eG=e=>{rk(),"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&rB&&!rP&&(e.preventDefault(),rU())},tH[153]=rB,tH[154]=rU,tH[155]=rk,tH[156]=rP,tH[157]=eG):eG=tH[157],tH[158]!==rW||tH[159]!==rk||tH[160]!==t1||tH[161]!==eW||tH[162]!==eG?(eV=(0,t.jsx)(Z.Textarea,{value:t1,onChange:eW,onPaste:rW,onPointerDown:rk,onKeyDown:eG,placeholder:"Ask anything...",className:"ph-no-capture min-h-[160px] text-base border-0 shadow-none focus-visible:ring-0 rounded-none resize-none p-4 leading-relaxed flex-1 bg-muted/40 focus:bg-muted/50 transition-colors","data-dd-privacy":"hidden",inputClassName:"max-h-[40vh] overflow-y-auto",autoFocus:!0}),tH[158]=rW,tH[159]=rk,tH[160]=t1,tH[161]=eW,tH[162]=eG,tH[163]=eV):eV=tH[163];let rH=ro?"Disable Web Search":"Enable Web Search";tH[164]!==ro||tH[165]!==rs?(e$=()=>rs(!ro),tH[164]=ro,tH[165]=rs,tH[166]=e$):e$=tH[166];let rZ=ro?"text-primary bg-primary/14 hover:bg-primary/20":"text-muted-foreground hover:text-foreground";tH[167]!==rZ?(eY=(0,s.cn)("transition-all duration-200 h-8 w-8",rZ),tH[167]=rZ,tH[168]=eY):eY=tH[168];let r0=ro?"Disable Web Search":"Enable Web Search";tH[169]===Symbol.for("react.memo_cache_sentinel")?(eK=(0,t.jsx)(B.GlobeAltIcon,{className:"h-4 w-4"}),tH[169]=eK):eK=tH[169],tH[170]!==e$||tH[171]!==eY||tH[172]!==r0?(eJ=(0,t.jsx)(l.Button,{variant:"ghost",size:"icon",onClick:e$,className:eY,"aria-label":r0,children:eK}),tH[170]=e$,tH[171]=eY,tH[172]=r0,tH[173]=eJ):eJ=tH[173],tH[174]!==rH||tH[175]!==eJ?(eX=(0,t.jsx)(ee.Tooltip,{content:rH,children:eJ}),tH[174]=rH,tH[175]=eJ,tH[176]=eX):eX=tH[176];let r1=`${rm.list.length>=rm.limit?`Maximum ${rm.limit} attachments added.`:`Limit: ${rm.limit} attachments per message.`} Actual limit varies based on model and provider.`,r2=rm.list.length>=rm.limit;tH[177]!==rm?(eH=async()=>{(0,eS.trackFusionEvent)(eS.FusionEvent.AddAttachment),await rm.handleFiles((0,en.getFilesFromSelectDialog)())},tH[177]=rm,tH[178]=eH):eH=tH[178],tH[179]===Symbol.for("react.memo_cache_sentinel")?(eZ=(0,s.cn)("transition-all h-8 w-8","text-muted-foreground hover:text-foreground"),e2=(0,t.jsx)(Y.PaperClipIcon,{className:"h-4 w-4"}),tH[179]=eZ,tH[180]=e2):(eZ=tH[179],e2=tH[180]),tH[181]!==r2||tH[182]!==eH?(e3=(0,t.jsx)("span",{className:"inline-flex",children:(0,t.jsx)(l.Button,{variant:"ghost",size:"icon",disabled:r2,onClick:eH,"aria-label":"Add attachment",className:eZ,children:e2})}),tH[181]=r2,tH[182]=eH,tH[183]=e3):e3=tH[183],tH[184]!==r1||tH[185]!==e3?(t_=(0,t.jsx)(ee.Tooltip,{className:"w-44",content:r1,children:e3}),tH[184]=r1,tH[185]=e3,tH[186]=t_):t_=tH[186],tH[187]!==rO||tH[188]!==rq||tH[189]!==t1?(tF=!t1.trim()||!rO||rq,tH[187]=rO,tH[188]=rq,tH[189]=t1,tH[190]=tF):tF=tH[190],tH[191]!==t1.length?(tC=()=>{(0,eS.trackFusionEvent)(eS.FusionEvent.ImprovePrompt,{promptLength:t1.length}),rz(!0)},tH[191]=t1.length,tH[192]=tC):tC=tH[192],tH[193]===Symbol.for("react.memo_cache_sentinel")?(tE=(0,s.cn)("h-8 w-8 transition-colors","text-muted-foreground hover:text-foreground","disabled:pointer-events-none disabled:opacity-50"),tH[193]=tE):tE=tH[193],tH[194]===Symbol.for("react.memo_cache_sentinel")?(tA=(0,t.jsx)(V.SparklesIcon,{className:"h-4 w-4"}),tH[194]=tA):tA=tH[194],tH[195]!==tF||tH[196]!==tC?(tq=(0,t.jsx)(ee.Tooltip,{content:"Refine your prompt",children:(0,t.jsx)(l.Button,{variant:"ghost",size:"icon",disabled:tF,onClick:tC,className:tE,"aria-label":"Refine your prompt",children:tA})}),tH[195]=tF,tH[196]=tC,tH[197]=tq):tq=tH[197],tH[198]===Symbol.for("react.memo_cache_sentinel")?(tz=(0,t.jsx)(Q.PopoverTrigger,{render:(0,t.jsx)("button",{type:"button",className:"inline-flex items-center justify-center h-8 w-8 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted/50 transition-colors",children:(0,t.jsx)(L.EllipsisHorizontalIcon,{className:"h-4 w-4"})})}),tH[198]=tz):tz=tH[198],tH[199]===Symbol.for("react.memo_cache_sentinel")?(tI=(0,t.jsx)(W.LightBulbIcon,{className:"h-3.5 w-3.5"}),tH[199]=tI):tI=tH[199],tH[200]!==tZ?(tR=(0,t.jsxs)("label",{htmlFor:tZ,className:"flex items-center gap-1.5 text-xs font-medium text-foreground",children:[tI,"Reasoning Effort"]}),tH[200]=tZ,tH[201]=tR):tR=tH[201];let r3=rr??eu.CompletionRequestReasoningEffort.High;tH[202]!==rn?(tM=e=>{let t=(0,em.parseSchema)(eu.CompletionRequestReasoningEffortSchema,e);(0,ed.isOk)(t)&&rn(t.data)},tH[202]=rn,tH[203]=tM):tM=tH[203],tH[204]===Symbol.for("react.memo_cache_sentinel")?(tT=(0,t.jsx)(X.SelectValue,{placeholder:"Select effort"}),tH[204]=tT):tT=tH[204],tH[205]!==tZ?(tD=(0,t.jsx)(X.SelectTrigger,{id:tZ,"aria-label":"Reasoning Effort",className:"h-8",children:tT}),tH[205]=tZ,tH[206]=tD):tD=tH[206],tH[207]===Symbol.for("react.memo_cache_sentinel")?(tO=(0,t.jsx)(X.SelectContent,{children:Object.entries(eu.CompletionRequestReasoningEffort).map(e4)}),tH[207]=tO):tO=tH[207],tH[208]!==r3||tH[209]!==tM||tH[210]!==tD?(tP=(0,t.jsxs)(X.Select,{value:r3,onValueChange:tM,children:[tD,tO]}),tH[208]=r3,tH[209]=tM,tH[210]=tD,tH[211]=tP):tP=tH[211],tH[212]!==tR||tH[213]!==tP?(tL=(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[tR,tP]}),tH[212]=tR,tH[213]=tP,tH[214]=tL):tL=tH[214],tH[215]===Symbol.for("react.memo_cache_sentinel")?(tB=(0,t.jsxs)("label",{htmlFor:"input-temperature",className:"flex items-center gap-1.5 text-xs font-medium text-foreground",children:[(0,t.jsx)(T,{className:"h-3.5 w-3.5"}),"Temperature"]}),tH[215]=tB):tB=tH[215];let r4=ri??1;return tH[216]!==rl?(tU=e=>{rl(1e-9>Math.abs(e-1)?null:e)},tH[216]=rl,tH[217]=tU):tU=tH[217],tH[218]!==r4||tH[219]!==tU?(tW=(0,t.jsxs)("div",{className:"flex flex-col gap-1.5",children:[tB,(0,t.jsx)(H.Slider,{id:"input-temperature",value:r4,min:0,max:2,step:.1,showValue:!0,className:"w-full",onValueChange:tU})]}),tH[218]=r4,tH[219]=tU,tH[220]=tW):tW=tH[220],tH[221]!==tL||tH[222]!==tW?(tG=(0,t.jsxs)(Q.Popover,{children:[tz,(0,t.jsx)(Q.PopoverContent,{side:"top",align:"start",className:"w-64 p-3",children:(0,t.jsxs)("div",{className:"flex flex-col gap-3",children:[tL,tW]})})]}),tH[221]=tL,tH[222]=tW,tH[223]=tG):tG=tH[223],tH[224]===Symbol.for("react.memo_cache_sentinel")?(tV=(0,t.jsx)("div",{className:"flex-1"}),tH[224]=tV):tV=tH[224],tH[225]!==rB||tH[226]!==rU||tH[227]!==rk||tH[228]!==rL||tH[229]!==rP?(t$=(0,t.jsx)(e1,{canSubmit:rB,isAttachmentLoading:rL,isStreaming:rP,onRun:rU,onSignupIntent:rk}),tH[225]=rB,tH[226]=rU,tH[227]=rk,tH[228]=rL,tH[229]=rP,tH[230]=t$):t$=tH[230],tH[231]!==eX||tH[232]!==t_||tH[233]!==tq||tH[234]!==tG||tH[235]!==t$?(tY=(0,t.jsxs)("div",{className:"px-4 py-3 flex items-center gap-2 border-t bg-background",children:[eX,t_,tq,tG,tV,t$]}),tH[231]=eX,tH[232]=t_,tH[233]=tq,tH[234]=tG,tH[235]=t$,tH[236]=tY):tY=tH[236],tH[237]!==eR||tH[238]!==eU||tH[239]!==eV||tH[240]!==tY?(tK=(0,t.jsxs)("div",{ref:rp,className:"rounded-xl border bg-background overflow-hidden flex flex-col transition-all duration-200 focus-within:border-focus-border focus-within:shadow-focus",children:[eR,eU,eV,tY]}),tH[237]=eR,tH[238]=eU,tH[239]=eV,tH[240]=tY,tH[241]=tK):tK=tH[241],tH[242]===Symbol.for("react.memo_cache_sentinel")?(tJ=(0,t.jsx)(et.AiResponseDisclaimer,{}),tH[242]=tJ):tJ=tH[242],tH[243]!==rq||tH[244]!==t1||tH[245]!==t4?(tQ=(0,t.jsx)(eQ,{isOpen:rq,setIsOpen:rz,prompt:t1,setPrompt:t4}),tH[243]=rq,tH[244]=t1,tH[245]=t4,tH[246]=tQ):tQ=tH[246],tH[247]!==tK||tH[248]!==tQ?(tX=(0,t.jsxs)("div",{className:"w-full max-w-3xl mx-auto px-4 py-8 relative",children:[z,tK,tJ,tQ]}),tH[247]=tK,tH[248]=tQ,tH[249]=tX):tX=tH[249],tX}function e4(e){let[r,n]=e;return(0,t.jsx)(X.SelectItem,{value:n,children:r},n)}function e5(e){return(0,d.getModelVariantSlug)(e)}function e6(e){return(0,d.getModelVariantSlug)(e)}function e7(e){return e.trim()}function e8(e){return"string"===e.kind&&"text/plain"===e.type}function e9(e){return"file"===e.kind}function te(e){return e.workspacePartitionId}function tt(e){return e.isSignedIn}function tr(e){return null!==e}function tn(e){return(0,er.getAttachmentContentPart)(e)}function to(e){return e.resetGeneration}function ts(e){return e.setAttachmentContentParts}function ti(e){return e.setSynthesizerSlug}function tl(e){return e.synthesizerSlug}function ta(e){return e.setTemperature}function tc(e){return e.temperature}function tu(e){return e.setWebSearchEnabled}function td(e){return e.isWebSearchEnabled}function tm(e){return e.setReasoningEffort}function tp(e){return e.reasoningEffort}function tf(e){return e.deleteUserModelSet}function th(e){return e.saveModelSet}function tx(e){return e.compare}function tg(e){return e.removeModel}function tb(e){return e.toggleCustomModel}function ty(e){return e.selectModelSet}function tS(e){return e.setSelectedModels}function tv(e){return e.setPrompt}function tw(e){return e.selectedModels}function tj(e){return e.selectedModelSet}function tN(e){return e.prompt}function tk(e){return e.phase}var t_=e.i(894686),tF=e.i(547670),tC=e.i(816443),tE=e.i(565043),tA=e.i(791092),tq=e.i(397847),tz=e.i(665996),tI=e.i(596807),tR=e.i(665898);function tM(){let e,n,o,s,i,l,a,c=(0,r.c)(18),u=(0,w.useFusionStore)(tO),d=u.length;c[0]!==u?(e=u.map(tD),c[0]=u,c[1]=e):e=c[1];let m=e,p=(0,w.useFusionStore)(tT);c[2]!==p||c[3]!==m?(n=e=>{let t=(0,z.getRunResponses)(e,p),r=0;for(let e of m){let n=t[e];n&&!n.isLoading&&r++}return r},c[2]=p,c[3]=m,c[4]=n):n=c[4];let f=(0,z.useFusionStreamingStore)(n);if(f===d||0===d)return null;let h=d-f;c[5]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)("span",{className:"font-medium text-foreground",children:"Generating responses..."}),c[5]=o):o=c[5],c[6]!==f||c[7]!==d?(s=(0,t.jsxs)("div",{className:"flex items-center justify-between text-sm mb-2",children:[o,(0,t.jsxs)("span",{className:"text-xs text-muted-foreground tabular-nums",children:[f," / ",d]})]}),c[6]=f,c[7]=d,c[8]=s):s=c[8];let x=`${f/d*100}%`;c[9]!==x?(i=(0,t.jsx)("div",{className:"h-1.5 w-full bg-muted rounded-full overflow-hidden",children:(0,t.jsx)("div",{className:"h-full bg-primary transition-all duration-500 ease-out",style:{width:x}})}),c[9]=x,c[10]=i):i=c[10];let g=1===h?"":"s";return c[11]!==h||c[12]!==g?(l=(0,t.jsxs)("p",{className:"text-xs text-muted-foreground mt-2 animate-pulse",children:["Waiting for ",h," model",g,"..."]}),c[11]=h,c[12]=g,c[13]=l):l=c[13],c[14]!==s||c[15]!==i||c[16]!==l?(a=(0,t.jsxs)("div",{className:"sticky top-0 z-10 bg-background py-3 border-b mb-6",children:[s,i,l]}),c[14]=s,c[15]=i,c[16]=l,c[17]=a):a=c[17],a}function tT(e){return e.currentRunDbId}function tD(e){return(0,d.getModelVariantSlug)(e)}function tO(e){return e.selectedModels}function tP(){let e,n,o=(0,r.c)(4),s=(0,w.useFusionStore)(tB);o[0]!==s?(e=s.map(tL),o[0]=s,o[1]=e):e=o[1];let i=e;return o[2]!==i?(n=(0,t.jsx)(tz.TabbedResponses,{tabs:i,label:"Sources",progress:"1/3"}),o[2]=i,o[3]=n):n=o[3],n}function tL(e){return{key:(0,d.getModelVariantSlug)(e),name:e.short_name,author:e.author}}function tB(e){return e.selectedModels}function tU(){let e,n,o,s=(0,r.c)(4),i=(0,w.useFusionStore)(tG),l=(0,w.useFusionStore)(tW);s[0]!==l?(e=e=>null!==(0,z.getRunAnalysisContent)(e,l),s[0]=l,s[1]=e):e=s[1];let a=(0,z.useFusionStreamingStore)(e);return i||a?(s[2]===Symbol.for("react.memo_cache_sentinel")?(n=(0,t.jsx)(tA.SectionDivider,{label:"Analysis",progress:"2/3"}),s[2]=n):n=s[2],s[3]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsxs)("div",{children:[n,(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(I.AnalysisCard,{})})]}),s[3]=o):o=s[3],o):null}function tW(e){return e.currentRunDbId}function tG(e){return e.isAnalyzing}function tV(){let e,o,s,c,d,h,x,g,b=(0,r.c)(27),y=(0,w.useFusionStore)(tZ),S=(0,w.useFusionStore)(tH),v=(0,w.useFusionStore)(tX),j=(0,w.useFusionStore)(tQ),N=(0,w.useFusionStore)(tJ),k=(0,w.useFusionStore)(tK),_=S===tR.PAYMENT_ERROR_MESSAGE,[F,C]=(0,m.useState)(!1),{availableTextModels:E}=(0,a.useGlobal)();b[0]!==y?(e=()=>{"streaming"===y&&C(!1)},o=[y],b[0]=y,b[1]=e,b[2]=o):(e=b[1],o=b[2]),(0,m.useEffect)(e,o),b[3]!==E?(s=E??[],b[3]=E,b[4]=s):s=b[4],b[5]!==s?(c=s.filter(tY).slice(0,3),b[5]=s,b[6]=c):c=b[6];let A=c;b[7]!==v||b[8]!==A||b[9]!==k?(d=()=>{A.length>=2&&(k("custom",A),v())},b[7]=v,b[8]=A,b[9]=k,b[10]=d):d=b[10];let q=d,z=(0,w.useFusionStore)(t$);return S?(b[11]!==A||b[12]!==q||b[13]!==F||b[14]!==_?(h=_&&(0,t.jsx)(p.InsufficientCreditsModal,{open:!F,onOpenChange:e=>{e||C(!0)},onContinueWithFreeModels:A.length>=2?q:void 0}),b[11]=A,b[12]=q,b[13]=F,b[14]=_,b[15]=h):h=b[15],b[16]!==v||b[17]!==z||b[18]!==S||b[19]!==F||b[20]!==_||b[21]!==j||b[22]!==N?(x=(!_||F)&&(0,t.jsx)(i.Banner,{variant:"negative",children:(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:S}),(0,t.jsx)("div",{className:"flex items-center gap-3",children:S===u.NO_ACTIVE_WORKSPACE_USER_MESSAGE?(0,t.jsx)(l.Button,{variant:"outline",size:"sm",render:(0,t.jsx)(f.Link,{href:"/workspaces",children:"Go to workspaces"})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",onClick:null===z?()=>void v():()=>void j(),children:[(0,t.jsx)(n.ArrowPathIcon,{className:"h-4 w-4"}),"Try again"]}),(0,t.jsx)(l.Button,{variant:"ghost",size:"sm",onClick:N,children:"Try with different models"})]})})]})}),b[16]=v,b[17]=z,b[18]=S,b[19]=F,b[20]=_,b[21]=j,b[22]=N,b[23]=x):x=b[23],b[24]!==h||b[25]!==x?(g=(0,t.jsxs)(t.Fragment,{children:[h,x]}),b[24]=h,b[25]=x,b[26]=g):g=b[26],g):null}function t$(e){return e.currentRunDbId}function tY(e){return e.endpoint?.is_free||e.slug.endsWith(":free")}function tK(e){return e.selectModelSet}function tJ(e){return e.tryAnother}function tQ(e){return e.rerun}function tX(e){return e.compare}function tH(e){return e.error}function tZ(e){return e.phase}function t0(){let e,n,o,s=(0,r.c)(10),i=(0,w.useFusionStore)(t7),l=(0,w.useFusionStore)(t6),a=(0,w.useFusionStore)(t5),u=(0,w.useFusionStore)(t4),d=(0,w.useFusionStore)(t3),m=(0,w.useFusionStore)(t2),p=(0,w.useFusionStore)(t1);s[0]!==l?(e=c.FUSION_MODEL_SETS.find(e=>e.id===l),s[0]=l,s[1]=e):e=s[1];let f=e,h=f?f.label:"Custom";s[2]!==a?(n={kind:"live",startTime:a},s[2]=a,s[3]=n):n=s[3];let x=(0,tI.useFusionTimestamp)(n),g="streaming"===d||"synthesizing"===d||m?p:void 0;return s[4]!==u||s[5]!==h||s[6]!==i||s[7]!==g||s[8]!==x?(o=(0,t.jsx)(tC.PromptCard,{prompt:i,modelSetLabel:h,timestamp:x,defaultCollapsed:!0,isWebSearchEnabled:u,onStop:g}),s[4]=u,s[5]=h,s[6]=i,s[7]=g,s[8]=x,s[9]=o):o=s[9],o}function t1(e){return e.stopRun}function t2(e){return e.isAnalyzing}function t3(e){return e.phase}function t4(e){return e.isWebSearchEnabled}function t5(e){return e.startTime}function t6(e){return e.selectedModelSet}function t7(e){return e.prompt}function t8(){let e,n,o,s,i,l,a,c,u=(0,r.c)(13),d=(0,w.useFusionStore)(t9);if("idle"===d){let e;return u[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("div",{className:"flex-1 flex flex-col justify-center",children:(0,t.jsx)(e2,{})}),u[0]=e):e=u[0],e}let m="synthesizing"===d||"complete"===d;return u[1]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(t0,{}),u[1]=e):e=u[1],u[2]!==d?(n="streaming"===d&&(0,t.jsx)(tM,{}),u[2]=d,u[3]=n):n=u[3],u[4]===Symbol.for("react.memo_cache_sentinel")?(o=(0,t.jsx)(tP,{}),s=(0,t.jsx)(tU,{}),u[4]=o,u[5]=s):(o=u[4],s=u[5]),u[6]!==m?(i=m&&(0,t.jsxs)("div",{children:[(0,t.jsx)(tA.SectionDivider,{label:"Result",progress:"3/3"}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(tq.SynthesisCard,{})})]}),u[6]=m,u[7]=i):i=u[7],u[8]===Symbol.for("react.memo_cache_sentinel")?(l=(0,t.jsx)(tV,{}),a=(0,t.jsx)(tF.NewFusionButton,{}),u[8]=l,u[9]=a):(l=u[8],a=u[9]),u[10]!==n||u[11]!==i?(c=(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,n,o,s,i,l,a]}),u[10]=n,u[11]=i,u[12]=c):c=u[12],c}function t9(e){return e.phase}e.s(["FusionPage",0,function(){let e,n,i,l,a,c,u,d,m,p,f,k,z,I=(0,r.c)(7);c=(0,r.c)(2),u=(0,w.useFusionStore)(E),d=(0,w.useFusionStore)(C),m=(0,w.useFusionStore)(F),p=(0,w.useFusionStore)(_),f="streaming"===u||"all-complete"===u&&(d||!!m&&!p)||"synthesizing"===u,k=(0,w.useFusionStore)(N),z=f||k,c[0]!==f?(a={shouldGuardUrl:j,isSpaGuardActive:f},c[0]=f,c[1]=a):a=c[1],(0,v.useNavigationGuard)(z,"Your fusion runs are still in progress. If you leave now, they will be interrupted. Are you sure?",a),(0,q.useWorkspacePartitionSync)();let T=(0,g.useNoWorkspaceGate)(),D=(0,b.useWorkspaceCapabilityGate)(o.WorkspaceCapability.Fusion),O=(0,A.useIsWorkspacePartitionCurrent)();if(T!==h.NoWorkspaceGateState.Allowed||D!==y.WorkspaceCapabilityGateState.Allowed||!O){let e;if(T===h.NoWorkspaceGateState.Blocked&&O){let e;return I[0]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("div",{className:(0,s.cn)("flex w-full items-center justify-center","h-[calc(100dvh-56px)]","bg-background text-foreground","border-t border-border"),children:(0,t.jsx)(x.NoWorkspaceState,{surface:"fusion"})}),I[0]=e):e=I[0],e}if(D===y.WorkspaceCapabilityGateState.Blocked&&O){let e;return I[1]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)("div",{className:(0,s.cn)("flex w-full items-center justify-center","h-[calc(100dvh-56px)]","bg-background text-foreground","border-t border-border"),children:(0,t.jsx)(S.WorkspaceCapabilityUnavailableState,{capability:o.WorkspaceCapability.Fusion})}),I[1]=e):e=I[1],e}return I[2]===Symbol.for("react.memo_cache_sentinel")?(e=(0,t.jsx)(M.FusionPageSkeleton,{variant:"composer"}),I[2]=e):e=I[2],e}return I[3]===Symbol.for("react.memo_cache_sentinel")?(e=(0,s.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"),I[3]=e):e=I[3],I[4]===Symbol.for("react.memo_cache_sentinel")?(n=(0,t.jsx)("div",{className:"h-full min-h-0 hidden md:block",children:(0,t.jsx)(tE.RunHistorySidebar,{})}),i=(0,t.jsxs)("div",{className:(0,s.cn)("flex flex-1 flex-col min-w-0","min-h-0 h-full overflow-y-auto"),children:[(0,t.jsx)(t_.MobileRunDrawer,{}),(0,t.jsx)(t8,{})]}),I[4]=n,I[5]=i):(n=I[4],i=I[5]),I[6]===Symbol.for("react.memo_cache_sentinel")?(l=(0,t.jsxs)("div",{id:tz.FUSION_LAYOUT_ID,className:e,children:[n,i,(0,t.jsx)("div",{className:"fixed bottom-4 right-4 z-20 hidden sm:block",children:(0,t.jsx)(R.FeedbackWidget,{})})]}),I[6]=l):l=I[6],l}],235132)}]); //# sourceMappingURL=3ab8mrskmk9uy.js.map //# chunkId=01a08d90-226e-7533-8034-3cf1255960f6