1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,442266,e=>{"use strict";function t(e,t,r,s){if(!function(){try{return"true"===window.localStorage.getItem("evalarena:debug:social-share")}catch{return!1}}())return;let a=`[SocialShareDebug:${t}] ${r}`;void 0===s?console[e](a):console[e](a,s)}function r(e,r,s){t("info",e,r,s)}function s(e,r,s){t("warn",e,r,s)}function a(e,r,s){t("error",e,r,s)}e.s(["errorSocialShareDebug",()=>a,"logSocialShareDebug",()=>r,"warnSocialShareDebug",()=>s])},513088,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(442266);let a=(0,r.createContext)(void 0);e.s(["SocialCanvasProvider",0,({children:e})=>{let[n,i]=(0,r.useState)(!1),[l,o]=(0,r.useState)(null),[d,c]=(0,r.useState)([]),u=(0,r.useRef)(!1),m=(0,r.useRef)(null);(0,r.useEffect)(()=>{m.current=l},[l]);let p=(0,r.useCallback)((e,t)=>{(0,s.logSocialShareDebug)("SocialCanvasContext","openCanvas called",{type:e.type,title:e.title,addToHistory:t?.addToHistory??!1,hasChatData:!!e.chatData,hasMultiModelChatData:!!e.multiModelChatData,hasAgentTraceData:!!e.agentTraceData}),t?.addToHistory&&m.current?c(e=>[...e,m.current]):c([]),o(e),i(!0),window.history.pushState({canvasOpen:!0},"")},[]);(0,r.useEffect)(()=>{let e=e=>{let t,{code:r,language:a,title:n,shareUrl:l,type:d,messages:u,model:p,modelId:x,modelName:h,modelCreator:g,prompt:f,responses:b,models:v,modelCatalog:j,addToHistory:w,content:y,category:k,domain:N,blenderArtifact:A,videoArtifact:_,lastImageUrl:S,lastVideoUrl:M,imageUrl:C,videoUrl:T,generatedArtifactData:I}=e.detail||{};if((0,s.logSocialShareDebug)("SocialCanvasContext","openSocialCanvas event received",{type:d,title:n,shareUrl:l,addToHistory:!!w,messageCount:Array.isArray(u)?u.length:0,responseGroupCount:b?Object.keys(b).length:0}),w&&m.current?c(e=>[...e,m.current]):w||c([]),"prompt"===d)t={type:"prompt",content:y||"",title:n||"Shared Prompt",promptData:{content:y||"",category:k,domain:N,shareUrl:l},isStreaming:!1,index:Date.now()};else if("generated_artifact"===d){let e=I?.kind,r="image"===e?"Image":"video"===e?"Video":"audio"===e?"Audio":"Media";t={type:"generated_artifact",content:"",title:("string"==typeof n&&n.trim().toLowerCase()===`generated ${e}`?r:n)||I?.title||r,generatedArtifactData:I,isStreaming:!1,index:Date.now()}}else if("multi_model_chat"===d)t={type:"multi_model_chat",content:"",title:n||"Multi-Model Chat",multiModelChatData:{messages:u||[],responses:b||{},models:v||[],modelCatalog:j||[],shareUrl:l},lastImageUrl:S||null,lastVideoUrl:M||null,isStreaming:!1,index:Date.now()};else if("chat"===d){let e=p||[...u||[]].reverse().find(e=>e?.role==="assistant"&&e?.modelId)?.modelId;t={type:"chat",content:"",title:n||"Shared Conversation",modelId:e,modelName:e,chatData:{messages:u||[],model:e,shareUrl:l},lastImageUrl:S||null,lastVideoUrl:M||null,isStreaming:!1,index:Date.now()}}else{let e="code",s=a?String(a).toLowerCase():"";"html"===s?e="html":"svg"===s||"xml"===s?e="svg":"markdown"===s||"md"===s?e="markdown":("latex"===s||"tex"===s)&&(e="latex"),t={type:e,language:a||"text",content:r||"",title:n||"Canvas",modelId:x,modelName:h,modelCreator:g,prompt:f,isStreaming:!1,index:Date.now(),blenderArtifact:A,videoArtifact:_,imageUrl:C||null,videoUrl:T||null}}o(t),i(!0),(0,s.logSocialShareDebug)("SocialCanvasContext","canvas content set from event",{type:t.type,title:t.title}),window.history.pushState({canvasOpen:!0},"")};return window.addEventListener("openSocialCanvas",e),()=>window.removeEventListener("openSocialCanvas",e)},[]);let x=(0,r.useCallback)(()=>{if(u.current)u.current=!1;else if(window.history.state?.canvasOpen)return void window.history.back();if(d.length>0){let e=d[d.length-1];c(e=>e.slice(0,-1)),o(e)}else i(!1),setTimeout(()=>o(null),300),c([])},[d]),h=(0,r.useCallback)(()=>{u.current=!1,c([]),i(!1),o(null)},[]);return(0,r.useEffect)(()=>{let e=e=>{if(n)if((0,s.warnSocialShareDebug)("SocialCanvasContext","popstate while canvas open",{historyDepth:d.length,state:window.history.state}),e.preventDefault(),u.current=!0,d.length>0){let e=d[d.length-1];c(e=>e.slice(0,-1)),o(e)}else i(!1),setTimeout(()=>
1o(null),300),c([])};return window.addEventListener("popstate",e),()=>window.removeEventListener("popstate",e)},[n,d]),(0,t.jsx)(a.Provider,{value:{isCanvasOpen:n,canvasContent:l,openCanvas:p,closeCanvas:x,resetCanvas:h},children:e})},"useSocialCanvas",0,()=>{let e=(0,r.useContext)(a);if(!e)throw Error("useSocialCanvas must be used within SocialCanvasProvider");return e}])},39312,e=>{"use strict";let t=(0,e.i(475254).default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);e.s(["Zap",()=>t],39312)},450645,e=>{"use strict";var t=e.i(843476),r=e.i(929899),s=e.i(883309);function a({provenance:e,compact:a=!1,align:n="end"}){if(!e)return null;let i=e.model_display_name||e.model_id||e.model_route_id;return(0,t.jsxs)("div",{className:`flex w-max min-w-full items-center gap-1.5 ${"start"===n?"justify-start":"justify-end"}`,"aria-label":"Built with",children:[i&&(0,t.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5 rounded-md border border-border bg-background/70 px-2 py-1 text-[10px] font-medium text-foreground",title:`Model: ${i}`,children:[(0,t.jsx)(r.ProviderLogo,{creator:e.model_creator,alt:"",className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:a?"max-w-32 truncate":"whitespace-nowrap",children:i})]}),(0,t.jsxs)("span",{className:"inline-flex min-w-0 items-center gap-1.5 rounded-md border border-border bg-background/70 px-2 py-1 text-[10px] font-medium text-foreground",title:`Harness: ${e.harness_display_name}`,children:[(0,t.jsx)(s.HarnessLogo,{binding:e.harness_binding||e.driver_binding,displayName:e.harness_display_name,className:"h-3 w-3"}),(0,t.jsx)("span",{className:a?"max-w-24 truncate":"whitespace-nowrap",children:e.harness_display_name})]})]})}e.s(["PublishedSiteProvenance",()=>a])},348308,e=>{"use strict";let t=(0,e.i(475254).default)("file-play",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z",key:"1tzo1f"}]]);e.s(["FileVideo",()=>t],348308)},680170,e=>{"use strict";let t=(0,e.i(475254).default)("file-headphone",[["path",{d:"M4 6.835V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-.343",key:"1vfytu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M2 19a2 2 0 0 1 4 0v1a2 2 0 0 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 0 1-4 0v-1a2 2 0 0 1 4 0",key:"1etmh7"}]]);e.s(["FileAudio",()=>t],680170)},972698,862749,385044,646318,878824,167506,788712,89128,698125,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(178583),a=e.i(348308),n=e.i(680170),i=e.i(664659),l=e.i(463059),o=e.i(455711),d=e.i(565157),c=e.i(555436),u=e.i(138399),m=e.i(195116),p=e.i(475254);let x=(0,p.default)("plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);var h=e.i(662031),g=e.i(531278);let f=(0,p.default)("file-code-corner",[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]]);e.s(["FileCode2",()=>f],862749);var b=e.i(955716),v=e.i(778917),j=e.i(549838),w=e.i(615736),y=e.i(56090),k=e.i(31572),N=e.i(174080),A=e.i(37727),_=e.i(440160),S=e.i(398361),M=e.i(726336);let C=({isOpen:e,onClose:s,imageUrl:a,prompt:n,size:i,fileName:l="generated-image"})=>{let[o,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(!1),m=(0,r.useCallback)(()=>{d(!1),u(!1),s()},[s]);(0,r.useEffect)(()=>{let t=e=>{"Escape"===e.key&&m()};return e&&(document.addEventListener("keydown",t),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",t),document.body.style.overflow="unset"}},[m,e]);let p=async e=>{e.stopPropagation();try{let e=await fetch(a),t=await e.blob(),r=window.URL.createObjectURL(t),s=document.createElement("a");s.href=r,s.download=`${l}-${Date.now()}.png`,document.body.appendChild(s),s.click(),window.URL.revokeObjectURL(r),document.body.removeChild(s)}catch(e){console.error("Download failed:",e),window.open(a,"_blank")}};return e&&"undefined"!=typeof document?N.default.createPortal((0,t.jsxs)("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center bg-black/95 backdrop-blur-lg animate-in fade-in duration-200",onClick:m,children:[(0,t.jsxs)("div",{className:"absolute right-4 top-4 z-10 flex items-center gap-2",children:[(0,t.jsx)("button",{type:"button",className:"rounded-full bg-white/10 p-2.5 text-white transition-all duration-200 hover:scale-105 hover:bg-white/20",onClick:p,title:"Download image","aria-label":"Download image",children:(0,t.jsx)(_.Download,{size:20})}),(0,t.jsx)("button",{type:"button",className:"rounded-full bg-white/10 p-2.5 text-white transition-all duration-200 hover:scale-105 hover:bg-white/20",onClick:e=>{e.stopPropagation(),d(!o)},"aria-label":o?"Exit fullscreen":"Enter fullscreen",children:o?(0,t.jsx)(M.Minimize2,{size:20}):(0,t.jsx)(S.Maximize2,{size:20})}),(0,t.jsx)("button",{type:"button",className:"rounded-full bg-white/10 p-2.5 text-white transition-all duration-200 hover:scale-105 hover:bg-white/20",onClick:m,"aria-label":"Close",children:(0,t.jsx)(A.X,{size:22,strokeWidth:2})})]}),(0,t.jsxs)("div",{className:(0,j.cn)("relative flex flex-col items-center gap-6 transition-all duration-300 ease-out",o?"h-screen w-screen":"max-h-[90vh] max-w-[92vw]"),onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:(0,j.cn)("relative rounded-lg overflow-hidden shadow-2xl",o?"h-full w-full":"max-h-[calc(90vh-10rem)] max-w-full"),children:[!c&&(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-neutral-900",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,t.jsx)("div",{className:"w-10 h-10 border-3 border-white/20 border-t-white rounded-full animate-spin"}),(0,t.jsx)("p",{className:"text-sm text-white/70",children:"Loading image..."})]})}),(0,t.jsx)("img",{src:a,alt:n||"Generated image",className:(0,j.cn)("object-contain transition-opacity duration-300",o?"h-full w-full":"max-h-[calc(90vh-10rem)] max-w-full",c?"o
1pacity-100":"opacity-0"),onLoad:()=>u(!0)})]}),!o&&c&&(n||i)&&(0,t.jsxs)("div",{className:"flex min-h-16 max-h-32 w-[min(760px,calc(100vw-2rem))] items-start gap-4 overflow-y-auto rounded-2xl border border-white/10 bg-black/70 px-5 py-4 shadow-lg backdrop-blur-md",children:[n&&(0,t.jsx)("p",{className:"min-w-0 flex-1 whitespace-pre-wrap break-words text-sm font-medium leading-5 text-white/90",children:n}),i&&(0,t.jsx)("span",{className:"shrink-0 font-mono text-xs text-white/55",children:i})]})]})]}),document.body):null};e.s(["ImagePreviewModal",0,C],385044);var T=e.i(431343),I=e.i(495242),z=e.i(382373),U=e.i(135116);let $=({isOpen:e,onClose:s,videoUrl:a,prompt:n,size:i,fileName:l="generated-video"})=>{let[o,d]=(0,r.useState)(!1),[c,u]=(0,r.useState)(!1),[m,p]=(0,r.useState)(!1),[x,h]=(0,r.useState)(!1),[g,f]=(0,r.useState)(0),[b,v]=(0,r.useState)(0),[w,y]=(0,r.useState)(1),[k,C]=(0,r.useState)(!1),[$,P]=(0,r.useState)(1),[F,L]=(0,r.useState)(!1),E=(0,r.useRef)(null),R=(0,r.useRef)(null);(0,r.useEffect)(()=>(d(!0),()=>d(!1)),[]),(0,r.useEffect)(()=>{let t=e=>{"Escape"===e.key?s():" "===e.key&&(e.preventDefault(),O())};return e&&(document.addEventListener("keydown",t),document.body.style.overflow="hidden"),()=>{document.removeEventListener("keydown",t),document.body.style.overflow="unset"}},[e,s]),(0,r.useEffect)(()=>{!e&&(u(!1),p(!1),h(!1),f(0),v(0),E.current&&(E.current.pause(),E.current.currentTime=0))},[e]),(0,r.useEffect)(()=>{if(!e)return;let t=E.current;if(!t)return;let r=()=>f(t.currentTime),s=()=>{isNaN(t.duration)||v(t.duration)},a=()=>p(!1);return t.addEventListener("timeupdate",r),t.addEventListener("loadedmetadata",s),t.addEventListener("durationchange",s),t.addEventListener("ended",a),t.readyState>=1&&!isNaN(t.duration)&&v(t.duration),()=>{t.removeEventListener("timeupdate",r),t.removeEventListener("loadedmetadata",s),t.removeEventListener("durationchange",s),t.removeEventListener("ended",a)}},[e]),(0,r.useEffect)(()=>{E.current&&(E.current.playbackRate=$)},[$]),(0,r.useEffect)(()=>{let e=e=>{R.current&&!R.current.contains(e.target)&&L(!1)};return F&&document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[F]);let D=async e=>{e.stopPropagation();try{let e=await fetch(a),t=await e.blob(),r=window.URL.createObjectURL(t),s=document.createElement("a");s.href=r,s.download=`${l}-${Date.now()}.mp4`,document.body.appendChild(s),s.click(),window.URL.revokeObjectURL(r),document.body.removeChild(s)}catch(e){console.error("Download failed:",e),window.open(a,"_blank")}},O=()=>{E.current&&(m?E.current.pause():E.current.play(),p(!m))},V=e=>{if(isNaN(e))return"0:00";let t=Math.floor(e/60),r=Math.floor(e%60);return`${t}:${r.toString().padStart(2,"0")}`},B=b?g/b*100:0;return o&&e?N.default.createPortal((0,t.jsxs)("div",{className:"fixed inset-0 z-[1000] flex items-center justify-center bg-black/95 backdrop-blur-lg animate-in fade-in duration-200",onClick:s,children:[(0,t.jsx)("button",{className:"absolute top-4 right-4 p-2.5 rounded-full bg-white/10 hover:bg-white/20 text-white transition-all duration-200 hover:scale-105 z-10",onClick:s,"aria-label":"Close",children:(0,t.jsx)(A.X,{size:24,strokeWidth:2})}),(0,t.jsx)("button",{className:"absolute top-4 right-20 p-2.5 rounded-full bg-white/10 hover:bg-white/20 text-white transition-all duration-200 hover:scale-105 z-10",onClick:e=>{e.stopPropagation(),u(!c)},"aria-label":c?"Exit fullscreen":"Enter fullscreen",children:c?(0,t.jsx)(M.Minimize2,{size:20}):(0,t.jsx)(S.Maximize2,{size:20})}),(0,t.jsxs)("div",{className:(0,j.cn)("relative flex flex-col items-center gap-4 transition-all duration-300 ease-out",c?"w-screen h-screen":"max-w-[92vw] max-h-[90vh]"),onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)("div",{className:(0,j.cn)("relative group rounded-lg overflow-hidden shadow-2xl bg-black",c?"w-full h-full":"max-w-full max-h-[75vh]"),children:[!x&&(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-neutral-900",children:(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,t.jsx)("div",{className:"w-10 h-10 border-3 border-white/20 border-t-white rounded-full animate-spin"}),(0,t.jsx)("p",{className:"text-sm text-white/70",children:"Loading video..."})]})}),(0,t.jsx)("video",{ref:E,src:a,className:(0,j.cn)("object-contain transition-opacity duration-300 cursor-pointer",c?"w-full h-full":"max-w-full max-h-[75vh]",x?"opacity-100":"opacity-0"),onLoadedData:e=>{h(!0);let t=e.currentTarget;t.duration&&!isNaN(t.duration)&&v(t.duration)},onClick:O,onPlay:()=>p(!0),onPause:()=>
1p(!1),controls:!1,playsInline:!0}),x&&(0,t.jsx)("div",{onClick:O,className:(0,j.cn)("absolute inset-0 flex items-center justify-center transition-opacity duration-200 cursor-pointer",m?"opacity-0 group-hover:opacity-100":"opacity-100"),children:(0,t.jsx)("div",{className:"p-4 rounded-full bg-black/40 backdrop-blur-sm",children:m?(0,t.jsx)(I.Pause,{size:32,className:"text-white fill-white"}):(0,t.jsx)(T.Play,{size:32,className:"text-white fill-white"})})}),x&&(0,t.jsxs)("div",{className:(0,j.cn)("absolute bottom-0 left-0 right-0 px-3 py-2 transition-opacity duration-200","bg-gradient-to-t from-black/80 to-transparent",m?"opacity-0 group-hover:opacity-100":"opacity-100"),onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("div",{className:"mb-2",children:(0,t.jsx)("input",{type:"range",min:"0",max:b||0,step:"0.01",value:g,onChange:e=>{let t=parseFloat(e.target.value);E.current&&(E.current.currentTime=t),f(t)},className:"w-full h-1 rounded-lg appearance-none cursor-pointer",style:{background:`linear-gradient(to right, #ffffff ${B}%, rgba(255,255,255,0.3) ${B}%)`}})}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("button",{onClick:O,className:"flex items-center justify-center w-8 h-8 rounded-full bg-white/20 hover:bg-white/30 text-white transition-colors flex-shrink-0","aria-label":m?"Pause":"Play",children:m?(0,t.jsx)(I.Pause,{size:15,className:"fill-white"}):(0,t.jsx)(T.Play,{size:15,className:"fill-white ml-0.5"})}),(0,t.jsxs)("span",{className:"text-xs text-white/80 font-mono flex-shrink-0",children:[V(g)," / ",V(b)]}),(0,t.jsx)("div",{className:"flex-1"}),(0,t.jsxs)("div",{className:"flex items-center gap-1.5 flex-shrink-0",children:[(0,t.jsx)("button",{onClick:()=>{E.current&&(k?(E.current.volume=w||.5,C(!1)):(E.current.volume=0,C(!0)))},className:"text-white/70 hover:text-white transition-colors p-1","aria-label":k?"Unmute":"Mute",children:k?(0,t.jsx)(U.VolumeX,{size:16}):(0,t.jsx)(z.Volume2,{size:16})}),(0,t.jsx)("input",{type:"range",min:"0",max:"1",step:"0.01",value:k?0:w,onChange:e=>{let t=parseFloat(e.target.value);E.current&&(E.current.volume=t),y(t),C(0===t)},className:"w-16 h-1 rounded-lg appearance-none cursor-pointer",style:{background:`linear-gradient(to right, #ffffff ${(k?0:w)*100}%, rgba(255,255,255,0.3) ${(k?0:w)*100}%)`}})]}),(0,t.jsxs)("div",{className:"relative flex-shrink-0",ref:R,children:[(0,t.jsx)("button",{onClick:()=>L(!F),className:"px-2 py-0.5 rounded bg-white/20 hover:bg-white/30 text-white transition-colors","aria-label":"Playback speed",children:(0,t.jsxs)("span",{className:"text-xs font-medium",children:[$,"x"]})}),F&&(0,t.jsx)("div",{className:"absolute bottom-full right-0 mb-2 bg-neutral-900 border border-white/10 rounded-lg shadow-lg overflow-hidden min-w-[80px] z-10",children:[.5,1,1.5,2].map(e=>(0,t.jsxs)("button",{onClick:()=>{P(e),L(!1)},className:(0,j.cn)("w-full px-3 py-1.5 text-sm text-left hover:bg-white/10 transition-colors text-white/80",$===e&&"text-white font-medium bg-white/10"),children:[e,"x"]},e))})]})]})]})]}),!c&&x&&(0,t.jsxs)("div",{className:"flex items-center gap-4 bg-black/60 backdrop-blur-md px-5 py-3 rounded-full border border-white/10 shadow-lg",children:[n&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-sm text-white/90 max-w-[500px] truncate font-medium",children:n}),(0,t.jsx)("div",{className:"w-px h-5 bg-white/20"})]}),i&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-xs text-white/70 font-mono",children:i}),(0,t.jsx)("div",{className:"w-px h-5 bg-white/20"})]}),(0,t.jsxs)("button",{onClick:D,className:"flex items-center gap-2 text-white/80 hover:text-white hover:bg-white/10 px-3 py-1.5 rounded-full transition-all duration-200 hover:scale-105",title:"Download video",children:[(0,t.jsx)(_.Download,{size:16}),(0,t.jsx)("span",{className:"text-xs font-medium",children:"Download"})]})]})]})]}),document.body):null};var P=e.i(394332),F=e.i(411392),L=e.i(561306),E=e.i(607467),R=e.i(912337),D=e.i(92884);async function O(e,t){let r={};t&&(r.Authorization=`Bearer ${t}`);let s=await fetch(`${D.API_V1_BASE_URL}/media/videos/${encodeURIComponent(e)}`,{headers:r});if(!s.ok)throw Error(await s.text().catch(()=>"")||`Failed to load video job (${s.status})`);return s.json()}e.s(["getVideoJob",()=>O],646318);let V=({kind:e,responseId:t,messageId:r,modelId:s,storagePath:a,publicUrl:n,updatedAt:i,pending:l=!1})=>{let o=[a||"",n||"",i||"",l?"pending":"ready"].join("\x1f");return`${e}:${t||r||s||"unscoped"}:${(e=>{let t=0x811c9dc5;for(let r=0;r<e.length;r+=1)t^=e.charCodeAt(r),t=Math.imul(t,0x1000193);return(t>>>0).toString(36)})(o)}`},B=e=>{if(!e)return 1;let t=e.trim().match(/^(\d+(?:\.\d+)?)\s*[xÃ]\s*(\d+(?:\.\d+)?)$/i);if(!t)return 1;let r=Number(t[1]),s=Number(t[2]);return!Number.isFinite(r)||!Number.isFinite(s)||r<=0||s<=0?1:r/s};e.s(["getGeneratedImageAspectRatio",0,B,"getGeneratedMediaRenderKey",0,V,"getMultiModelResponseRenderId",0,({responseId:e,messageId:t,conversationId:r,modelId:s,orderNumber:a})=>e||t||[r||"conversation",s,a].join(":")],878824);var G=e.i(846696);let q={image:"Image",video:"Video",audio:"Audio",music:"Music"},H=new Set(["code","markdown","rich_markdown","latex","html","svg","chat","multi_model_chat","prompt","transcribe","agent_trace","generated_artifact"]),W=e=>e?e.replace(/^sha256:/,"").slice(0,10):null,K=({artifact:e,onOpenCanvas:r,isShared:s=!1})=>{let a=e.canvas,n=a?.content??"",i=a?.title||e.title||"Patched canvas",l=a?.language||e.language||"code",o=e.lineCount??(n?n.split(/\r\n|\n|\r/).length:0),d=n.split(/\r\n|\n|\r/).slice(0,5).join("\n"),c=!!(r&&a&&"string"==typeof a.content),u=e.addedLines??0,m=e.removedLines??0,p=()=>{let t;if(!r||!a)return;let s=a.language||e.language||void 0;r({type:a.canvas_type&&"code"!==a.canvas_type?(t=a.canvas_type)&&H.has(t)?t:"code":(0,w.detectContentType)(a.content,s||""),content:a.content,canvasId:a.id||e.canvasId||void 0,language:s,title:i,conversationId:a.conversation_id||void 0,messageId:a.message_id||void 0,index:"number"==typeof a.code_index?a.co
1de_index:void 0,modelId:a.model_id||void 0,modelName:a.model_name||void 0,prompt:a.prompt||void 0})};return(0,t.jsxs)("div",{className:(0,j.cn)("overflow-hidden rounded-xl border border-emerald-500/25 bg-emerald-500/[0.035]",s&&"rounded-lg"),children:[(0,t.jsxs)("div",{className:(0,j.cn)("flex items-start gap-3 px-4 py-3",s&&"px-3 py-2"),children:[(0,t.jsx)("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-emerald-500/10 text-emerald-400",children:(0,t.jsx)(b.GitBranch,{size:s?14:16})}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[(0,t.jsx)("div",{className:(0,j.cn)("truncate text-sm font-semibold text-foreground",s&&"text-xs"),children:i}),(0,t.jsx)("span",{className:"rounded-full bg-emerald-500/10 px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.14em] text-emerald-400",children:"Patched"})]}),(0,t.jsxs)("div",{className:(0,j.cn)("mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",s&&"text-[11px]"),children:[(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(f,{size:12}),l||"code"]}),o>0&&(0,t.jsxs)("span",{children:[o," lines"]}),(0,t.jsxs)("span",{className:"text-emerald-400",children:["+",u]}),(0,t.jsxs)("span",{className:"text-red-400",children:["-",m]}),"number"==typeof e.hunkCount&&(0,t.jsxs)("span",{children:[e.hunkCount," hunks"]}),W(e.resultHash)&&(0,t.jsxs)("span",{children:["hash ",W(e.resultHash)]})]})]}),(0,t.jsxs)("button",{type:"button",onClick:p,disabled:!c,className:"inline-flex shrink-0 items-center gap-1 rounded-md border border-border bg-background/70 px-2.5 py-1.5 text-xs font-medium text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-50",title:"Open patched canvas",children:["Open",(0,t.jsx)(v.ExternalLink,{size:12})]})]}),d&&(0,t.jsx)("button",{type:"button",onClick:p,disabled:!c,className:"block w-full border-t border-emerald-500/15 bg-background/35 px-4 py-3 text-left transition-colors hover:bg-background/55 disabled:cursor-default disabled:hover:bg-background/35",children:(0,t.jsx)("pre",{className:"line-clamp-5 overflow-hidden whitespace-pre-wrap break-words font-mono text-xs leading-5 text-muted-foreground",children:d})})]})},X=({onClick:e,isLoading:r,className:s})=>(0,t.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),e()},disabled:r,className:(0,j.cn)("inline-flex items-center justify-center rounded-md bg-black/65 p-1.5 text-white shadow-sm transition-colors hover:bg-black/80 disabled:opacity-60 dark:bg-white/15 dark:hover:bg-white/25",s),title:"Share artifact",children:r?(0,t.jsx)(g.Loader2,{size:14,className:"animate-spin"}):(0,t.jsx)(h.Share2,{size:14})}),J=({toolCall:e,isShared:s=!1})=>{var a;let[n,o]=(0,r.useState)(!1),p="web_search"===(a=e.toolType)||"google_search"===a||"x_search"===a?d.Globe2:a.includes("search")?c.Search:"custom_function"===a?u.Braces:"mcp"===a?x:m.Wrench,h=e.details??[];return(0,t.jsxs)("div",{className:(0,j.cn)("rounded-xl border border-border/70 bg-muted/30 overflow-hidden",s&&"rounded-lg"),children:[(0,t.jsxs)("button",{type:"button",onClick:()=>o(e=>!e),className:(0,j.cn)("flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-muted/40",s&&"px-3 py-2"),children:[(0,t.jsx)(p,{size:s?14:16,className:"shrink-0 text-muted-foreground"}),(0,t.jsx)("div",{className:"min-w-0 flex-1",children:(0,t.jsx)("div",{className:(0,j.cn)("truncate text-sm font-medium text-foreground",s&&"text-xs"),children:e.label})}),(0,t.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,t.jsx)("span",{className:(0,j.cn)("rounded-full px-2 py-0.5 text-[10px] font-medium uppercase tracking-[0.14em]","running"===e.status&&"bg-blue-500/10 text-blue-400","completed"===e.status&&"bg-emerald-500/10 text-emerald-400","failed"===e.status&&"bg-red-500/10 text-red-400"),children:"running"===e.status?"Using":"completed"===e.status?"Done":"Failed"}),n?(0,t.jsx)(i.ChevronDown,{size:s?14:16,className:"text-muted-foreground"}):(0,t.jsx)(l.ChevronRight,{size:s?14:16,className:"text-muted-foreground"})]})]}),n&&(0,t.jsxs)("div",{className:(0,j.cn)("border-t border-border/60 px-4 py-3 text-sm text-muted-foreground",s&&"px-3 py-2 text-xs"),children:[e.summary&&(0,t.jsx)("div",{className:"mb-2 text-foreground
1/85",children:e.summary}),h.length>0&&(0,t.jsx)("div",{className:"space-y-1.5",children:h.map((r,s)=>(0,t.jsx)("div",{className:"break-words whitespace-pre-wrap",children:r},`${e.id}-detail-${s}`))})]})]})},Y=({url:e,onClick:r})=>(0,t.jsx)("div",{className:"w-48 h-48 rounded-lg overflow-hidden border border-border cursor-pointer hover:opacity-90 transition-opacity",onClick:r,children:(0,t.jsx)("img",{src:e,alt:"Uploaded content",className:"w-full h-full object-cover"})}),Z=({url:e,thumbnailUrl:r,title:s,onClick:n})=>(0,t.jsx)("div",{className:"w-48 h-48 rounded-lg overflow-hidden border border-border cursor-pointer hover:opacity-90 transition-opacity bg-black",onClick:n,children:r?(0,t.jsxs)("div",{className:"relative h-full w-full",children:[(0,t.jsx)("img",{src:r,alt:s||"Video attachment",className:"h-full w-full object-cover"}),(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-black/10",children:(0,t.jsx)("span",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-black/70 text-white backdrop-blur-sm",children:(0,t.jsx)(a.FileVideo,{size:19})})})]}):(0,t.jsx)("video",{src:e,className:"w-full h-full object-cover",muted:!0,playsInline:!0,onMouseOver:e=>e.currentTarget.play(),onMouseOut:e=>e.currentTarget.pause()})}),Q=({fileName:e,icon:r,onClick:s})=>(0,t.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-neutral-200 dark:bg-neutral-700 border border-border cursor-pointer hover:bg-neutral-300 dark:hover:bg-neutral-600 transition-colors max-w-[250px]",onClick:s,children:[r,(0,t.jsx)("span",{className:"text-sm truncate",children:e})]}),ee={document:(0,t.jsx)(s.FileText,{size:24,className:"text-neutral-500 dark:text-neutral-400 shrink-0"}),video:(0,t.jsx)(a.FileVideo,{size:24,className:"text-neutral-500 dark:text-neutral-400 shrink-0"}),audio:(0,t.jsx)(n.FileAudio,{size:24,className:"text-neutral-500 dark:text-neutral-400 shrink-0"})},et=({content:e,openPreviewModal:r,onOpenCanvas:s})=>{if(Array.isArray(e)){let s=e.find(e=>"text"===e.type),a=e.filter(e=>["image_url","document","video","video_url","video_ref","audio"].includes(e.type));return(0,t.jsxs)("div",{className:"space-y-3 min-w-0",children:[a.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:a.map((e,s)=>{let a=`user-att-${e.type}-${s}`;if("image_url"===e.type&&e.image_url)return(0,t.jsx)(Y,{url:e.image_url.url,onClick:()=>r?.(e)},a);if("document"===e.type&&e.document)return(0,t.jsx)(Q,{fileName:e.document.fileName,icon:ee.document,onClick:()=>r?.(e)},a);if("video"===e.type&&e.video)return e.video.url?(0,t.jsx)(Z,{url:e.video.url,onClick:()=>r?.(e)},a):(0,t.jsx)(Q,{fileName:e.video.fileName||"Video attachment",icon:ee.video},a);if("video_url"===e.type&&e.video_url)return(0,t.jsx)(Z,{url:e.video_url.url,thumbnailUrl:e.video_url.thumbnailUrl,title:e.video_url.fileName,onClick:()=>r?.(e)},a);if("video_ref"===e.type&&e.video_ref){let s=e.video_ref.canonicalUrl||e.video_ref.sourceUrl;return s?(0,t.jsx)(Z,{url:s,thumbnailUrl:e.video_ref.thumbnailUrl,title:e.video_ref.title,onClick:()=>r?.(e)},a):null}return"audio"===e.type&&e.audio?(0,t.jsx)(Q,{fileName:e.audio.fileName,icon:ee.audio,onClick:()=>r?.(e)},a):null})}),s?.text&&(0,t.jsx)("div",{className:"prose prose-neutral dark:prose-invert max-w-full leading-relaxed break-words min-w-0",children:(0,t.jsx)("div",{className:"whitespace-pre-wrap font-sans",children:s.text})})]})}return(0,t.jsx)("div",{className:"prose prose-neutral dark:prose-invert max-w-full leading-relaxed break-words min-w-0",children:(0,t.jsx)("div",{className:"whitespace-pre-wrap font-sans",children:e})})},er=({content:e,isComplete:s,isExpanded:a,onToggle:n,isShared:d=!1})=>{let c=(0,r.useRef)(null),u=(0,r.useRef)(!0);(0,r.useEffect)(()=>{if(!a||!u.current)return;let e=window.requestAnimationFrame(()=>{let e=c.current;e&&(e.scrollTop=e.scrollHeight)});return()=>window.cancelAnimationFrame(e)},[e,a]);let m=(0,r.useCallback)(()=>{let e=c.current;e&&(u.current=e.scrollHeight-e.scrollTop-e.clientHeight<48)},[]);return(0,t.jsxs)("div",{className:(0,j.cn)("mt-2 mb-3 border border-border rounded-xl overflow-hidden shadow-sm bg-background/60",d&&"mt-1 mb-2 rounded-lg"),children:[(0,t.jsxs)("button",{type:"button",onClick:n,className:(0,j.cn)("flex items-center gap-2 w-full px-4 py-3 bg-muted hover:bg-muted/80 transition-colors text-[13px] font-medium text-foreground sm:text-sm",d&&"px-3 py-2 text-xs"),children:[a?(0,t.jsx)(i.ChevronDown,{size:d?14:16,className:"text-muted-foreground"}):(0,t.jsx)(l.ChevronRight,{size:d?14:16,className:"text-muted-foreground"}),(0,t.jsx)(o.Brain,{size:d?12:14,className:(0,j.cn)("text-muted-foreground",!s&&"text-amber-500")}),(0,t.jsx)("span",{className:"text-foreground",children:s?"Thinking Process":"Thinking..."}),!s&&(0,t.jsx)("span",{className:"w-1.5 h-1.5 rounded-full bg-amber-500 animate-pulse ml-auto"})]}),a&&(0,t.jsx)("div",{ref:c,onScroll:m,className:(0,j.cn)("px-4 py-4 bg-muted/50 border-t border-border/60 text-[13px] sm:text-sm max-h-[400px] overflow-y-auto overscroll-contain [overflow-anchor:none] custom-scrollbar",d&&"px-3 py-2 text-xs max-h-[200px]"),children:s?(0,t.jsx)("div",{className:"prose prose-sm dark:prose-invert max-w-none prose-p:leading-normal prose-pre:my-2 text-foreground overflow-hidden break-words [word-break:break-word]",children:(0,t.jsx)(y.MarkdownRenderer,{content:e,keyPrefix:"thinking"})}):(0,t.jsx)("div",{className:"whitespace-pre-wrap text-foreground break-words [word-break:break-word]",children:e})})]})},es=({isActive:e,reasoningTokens:r})=>(0,t.jsxs)("div",{className:"mt-2 mb-3 overflow-hidden rounded-xl border border-border bg-background/60 shadow-sm","aria-live":"polite",children:[(0,t.jsxs)("div",{className:"flex w-full items-center gap-2 bg-muted px-4 py-3 text-[13px] font-medium text-foreground sm:text-sm",children:[(0,t.jsx)(o.Brain,{size:14,className:(0,j.cn)("text-muted-foreground",e&&"text-amber-500")}),(0,t.jsx)("span",{children:e?"Reasoning...":"Private reasoning"}),e?(0,t.jsx)("span",{className:"ml-auto size-1.5 animate-pulse rounded-full bg-amber-500"}):null!=r&&r>0?(0,t.jsxs)("span",{className:"ml-auto rounded-full border border-border bg-background/60 px-2 py-0.5 text-[11px] font-normal tabular-nums text-muted-foreground",children:[r.toLocaleStr
1ing()," tokens"]}):null]}),e&&(0,t.jsx)("div",{className:"border-t border-border/60 bg-muted/50 px-4 py-3 text-[13px] text-muted-foreground sm:text-sm",children:"The model is working through the prompt. This provider keeps its reasoning text private."})]}),ea=({imageUrl:e,prompt:s,size:a,isGenerating:n,onShare:i,isSharing:l})=>{let[o,d]=(0,r.useState)(null),[c,u]=(0,r.useState)({}),[m,p]=(0,r.useState)(0),x=`${e}:${m}`,h=c[x],g=!!e&&"loaded"===h,f=!!e&&"error"===h,b=o===e,v=B(a),w=(0,r.useCallback)(async e=>{let t=e.currentTarget;try{await t.decode()}catch{}u(e=>({...e,[x]:"loaded"}))},[x]),y=(0,r.useCallback)(()=>{u(e=>({...e,[x]:"error"}))},[x]),k=(0,r.useCallback)(()=>{p(e=>e+1)},[]);return n?(0,t.jsx)("div",{className:"my-3 w-80 aspect-square rounded-xl overflow-hidden border border-border bg-muted/30 flex items-center justify-center",children:(0,t.jsxs)("div",{className:"text-center space-y-2",children:[(0,t.jsx)("div",{className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin mx-auto"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Generating image..."})]})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"my-3 w-fit",children:(0,t.jsxs)("div",{className:(0,j.cn)("relative w-80 max-w-full rounded-xl overflow-hidden border border-border bg-muted/30 transition-shadow duration-200",g&&"cursor-pointer hover:shadow-md"),style:{aspectRatio:v},"aria-busy":!g&&!f,onClick:()=>{g&&d(e)},children:[!g&&!f&&(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-muted/30",role:"status",children:(0,t.jsxs)("div",{className:"text-center space-y-2",children:[(0,t.jsx)("div",{className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin mx-auto"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Loading image..."})]})}),f&&(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-muted/30 px-4",role:"alert",children:(0,t.jsxs)("div",{className:"space-y-2 text-center",children:[(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Image could not be loaded."}),(0,t.jsx)("button",{type:"button",className:"rounded-md border border-border bg-background px-3 py-1.5 text-xs font-medium text-foreground hover:bg-muted",onClick:e=>{e.stopPropagation(),k()},children:"Retry"})]})}),i&&g&&(0,t.jsx)(X,{onClick:i,isLoading:l,className:"absolute right-2 top-2 z-10"}),(0,t.jsx)("img",{src:e,alt:s||"Image",className:(0,j.cn)("h-full w-full object-contain transition-opacity duration-150",g?"opacity-100":"pointer-events-none opacity-0"),onLoad:w,onError:y},x)]})}),(0,t.jsx)(C,{isOpen:b,onClose:()=>d(null),imageUrl:e,prompt:s,size:a})]})},en=({videoUrl:e,prompt:s,size:a,status:n,jobId:i,providerJobId:l,providerStatus:o,errorMessage:d,onShare:c,isSharing:u})=>{let[m,p]=(0,r.useState)(!1),x=e=>e?e.length>18?`${e.slice(0,10)}...${e.slice(-6)}`:e:null;return"generating"===n?(0,t.jsx)("div",{className:"my-3 w-80 aspect-video rounded-xl overflow-hidden border border-border bg-muted/30 flex items-center justify-center",children:(0,t.jsxs)("div",{className:"text-center space-y-2 px-4",children:[(0,t.jsx)("div",{className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin mx-auto"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Generating video..."}),o&&(0,t.jsxs)("p",{className:"text-[10px] text-muted-foreground/80",children:["Provider status: ",o]}),(i||l)&&(0,t.jsxs)("div",{className:"space-y-1 text-[10px] text-muted-foreground/70",children:[i&&(0,t.jsxs)("p",{title:i,children:["Job: ",(0,t.jsx)("span",{className:"font-mono",children:x(i)})]}),l&&(0,t.jsxs)("p",{title:l,children:["Provider job: ",(0,t.jsx)("span",{className:"font-mono",children:x(l)})]})]})]})}):"failed"===n?(0,t.jsx)("div",{className:"my-3 w-80 aspect-video rounded-xl overflow-hidden border border-destructive bg-destructive/10 flex items-center justify-center",children:(0,t.jsxs)("div",{className:"text-center space-y-2 px-4",children:[(0,t.jsx)("p",{className:"text-sm text-destructive",children:"Video generation failed"}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:d||"Please try again"})]})}):e?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"my-3 w-fit",children:[(0,t.jsxs)("div",{className:"relative w-80 aspect-video rounded-xl overflow-hidden border border-border bg-black cursor-pointer hover:shadow-md transition-shadow duration-200",onClick:()=>p(!0),children:[c&&(0,t.jsx)(X,{onClick:c,isLoading:u,className:"absolute right-2 top-2 z-10"}),(0,t.jsx)("video",{src:e,className:"w-full h-full object-cover",muted:!0,playsInl
1ine:!0,onMouseOver:e=>e.currentTarget.play(),onMouseOut:e=>{e.currentTarget.pause(),e.currentTarget.currentTime=0}}),(0,t.jsx)("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 hover:bg-black/20 transition-colors pointer-events-none",children:(0,t.jsx)("div",{className:"w-12 h-12 rounded-full bg-white/90 flex items-center justify-center",children:(0,t.jsx)("div",{className:"w-0 h-0 border-t-[6px] border-t-transparent border-l-[10px] border-l-black border-b-[6px] border-b-transparent ml-1"})})})]}),s&&(0,t.jsx)("div",{className:"mt-2 w-80 px-1",children:(0,t.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed",children:s})})]}),(0,t.jsx)($,{isOpen:m,onClose:()=>p(!1),videoUrl:e,prompt:s,size:a})]}):null},ei=e=>"number"==typeof e&&Number.isFinite(e)?e.toFixed(4):"n/a",el=({title:e,metric:r})=>{var s;return(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-muted/20 p-4",children:[(0,t.jsx)("div",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:e}),(0,t.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"Candidate"}),(0,t.jsx)("div",{className:"mt-1 text-sm font-semibold text-foreground",children:ei(r.candidate_value)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"Clean"}),(0,t.jsx)("div",{className:"mt-1 text-sm font-semibold text-foreground",children:ei(r.clean_value)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"Corrupted"}),(0,t.jsx)("div",{className:"mt-1 text-sm font-semibold text-foreground",children:ei(r.corrupted_value)})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:"Restoration"}),(0,t.jsx)("div",{className:"mt-1 text-sm font-semibold text-foreground",children:"number"==typeof(s=r.restoration_fraction)&&Number.isFinite(s)?`${(100*s).toFixed(1)}%`:"n/a"})]})]}),(r.target_token_text||r.candidate_token_text)&&(0,t.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-xs text-muted-foreground",children:[r.target_token_text&&(0,t.jsxs)("span",{className:"rounded-full border border-border bg-background px-2 py-1",children:["target: ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:r.target_token_text})]}),r.candidate_token_text&&(0,t.jsxs)("span",{className:"rounded-full border border-border bg-background px-2 py-1",children:["top token: ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:r.candidate_token_text})]})]})]})},eo=e=>"number"!=typeof e||Number.isNaN(e)?"n/a":e>=0?`+${e.toFixed(4)}`:e.toFixed(4),ed=({title:e,features:r})=>Array.isArray(r)&&0!==r.length?(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-[11px] uppercase tracking-[0.16em] text-muted-foreground",children:e}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:r.map((r,s)=>(0,t.jsxs)("span",{className:"rounded-full border border-border bg-background px-2.5 py-1 text-xs text-muted-foreground",children:["#",r.index??"?"," ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:eo(r.value)})]},`${e}-${s}-${r.index??s}`))})]}):null,ec=(e,t)=>"string"==typeof e&&e.length>0?eu(e):t,eu=e=>{let t=e.replaceAll("Ä "," ").replaceAll("â"," ").replaceAll("Ä","\n").replaceAll("Ä"," ");return t?t.replaceAll("\n","\\n").replaceAll(" ","\\t").replaceAll(" ","â "):"â
"},em=({rows:e,sourceTokenLabels:s,sourceTokenIndices:a,queryTokenIndices:n})=>Array.isArray(e)&&0!==e.length?(0,t.jsx)("div",{className:"overflow-x-auto rounded-lg border border-border bg-black/20 p-3",children:(0,t.jsxs)("div",{className:"grid gap-1",style:{gridTemplateColumns:`minmax(120px, 160px) repeat(${s.length}, minmax(28px, 1fr))`},children:[(0,t.jsx)("div",{}),s.map((e,r)=>(0,t.jsx)("div",{className:"truncate px-1 text-center text-[10px] uppercase tracking-wide text-muted-foreground",title:`${ec(e,`token ${a[r]??r}`)} @ ${a[r]??r}`,children:ec(e,`t${a[r]??r}`)},`source-token-${r}`)),e.map((e,i)=>(0,t.jsxs)(r.default.Fragment,{children:[(0,t.jsxs)("div",{className:"truncate pr-2 text-xs font-medium text-foreground",children:["query ",n[i]??i]}),e.map((e,r)=>{let l=Math.max(.08,Math.min(.92,Number.isFinite(e)?e:0));return(0,t.jsx)("div",{className:"h-7 rounded-sm border border-black/10",style:{backgroundColor:`rgba(245, 158, 11, ${l})`},title:`query ${n[i]??i} -> ${ec(s[r],`token ${a[r]??r}`)} @ ${a[r]??r}: ${eo(e)}`},`heatmap-cell-${i}-${r}`)})]},`heatmap-row-${i}`))]})}):null,ep=({capture:e})=>{var r;let s=e.preview&&"object"==typeof e.preview?e.preview:{},a=Array.isArray(s.token_summaries)?s.token_summaries:[],n=Array.isArray(r=s.head_averaged_rows)?r.map(e=>Array.isArray(e)?e.map(e=>Number.isFinite(e)?Number(e):0):e&&"object"==typeof e&&Array.isArray(e.values)?e.values.map(e=>Number.isFinite(e)?Number(e):0):null).filter(e=>Array.isArray(e)):[],i=Array.isArray(s.source_token_labels)?s.source_token_labels:[],l=Array.isArray(s.column_indices)?s.column_indices:[],o=Array.isArray(s.row_indices)?s.row_indices:[],d=a[0]&&"object"==typeof a[0]?a[0]:null,c=Array.isArray(d?.top_attended_tokens)?d.top_attended_tokens:[];return(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-background/70 p-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-sm font-semibold text-foreground",children:e.capture_key||e.kind||"Attention Pattern"}),(0,t.jsxs)("div",{className:"mt-1 text-xs text-muted-foreground",children:["shape: ",Array.isArray(e.shape)?e.shape.join(" x "):"n/a"]}),(0,t.jsxs)("div",{className:"mt-2 max-w-3xl text-sm leading-6 text-muted-foreground",children:["Read this as: the selected query token looks back over earlier source tokens. Brighter cells mean stronger average attention across heads.",d&&(0,t.jsxs)(t.Fragment,{children:[" ","Here the query token is"," ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:ec(d.token_label,`token ${d.token_position??0}`)})," ","at position"," ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:d.token_position??0}),"."]})]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 text-xs",children:["number"==typeof s.head_count&&s.head_count>0&&(0,t.jsxs)("span",{className:"rounded-full border border-border bg-background px-2.5 py-1 text-muted-foreground",children:["heads: ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:s.head_count})]}),"number"==typeof s.token_count&&s.token_count>0&&(0,t.jsxs)("span",{className:"rounded-full border border-border bg-background px-2.5 py-1 text-muted-foreground",children:["query tokens: ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:s.token_count})]})]})]}),(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("div",{className:"text-[11px] uppercase tracking-[0.16em] text-muted-foreground",children:"Head-Averaged Attention"}),(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsx)(em,{rows:n,sourceTokenLabels:i,sourceTokenIndices:l,queryTokenIndices:o})}),(0,t.jsxs)("div",{className:"mt-3 text-xs text-muted-foreground",children:["Columns are source tokens in the prompt. Rows are query tokens you selected to inspect. Because this view is head-averaged, it shows the combined pattern across heads rather than a separate map per head.",s.downsampled&&(0,t.jsxs)(t.Fragment,{children:[" ","This view is downsampled, so the labels preserve original prompt positions rather than renumbering the sampled slice."]})]})]}),c.length>0&&(0,t.jsxs)("div",{className:"mt-4 rounded-lg border border-border bg-muted/10 p-3 text-sm text-muted-foreground",children:["Strongest attended tokens:"," ",c.slice(0,3).map((e,r)=>(0,t.jsxs)("span",{className:"mr-2 inline-flex items-center gap-1",children:[(0,t.jsx)("span",{className:"font-medium text-foreground",children:ec(e.label,`#${e.index??"?"}`)}),(0,t.jsxs)("span",{children:["@ ",e.index??"?"]}),(0,t.jsx)("span",{children:eo(e.value)})]},`attention-summary-${r}`))]}),a.length>0&&(0,t.jsx)("div",{className:"mt-4 grid gap-3 lg:grid-cols-2",children:a.slice(0,4).map((e,r)=>(0,t.jsxs)("div",{className:"rounded-lg border border-border bg-muted/10 p-3",children:[(0,t.jsxs)("div",{className:"text-sm font-semibold text-foreground",children:["query token ",e.token_position??r,":"," ",(0,t.jsx)("span",{className:"text-muted-foreground",children:ec(e.token_label,`token ${e.token_position??r}`)})]}),(0,t.jsxs)("div",{className:"mt-2 flex flex-wrap gap-2 text-xs text-muted-foreground",children:[(0,t.jsxs)("span",{children:["mean attention ",eo(e.mean_attention)]}),(0,t.jsxs)("span",{children:["max attention ",eo(e.max_attention)]})]}),(0,t.jsxs)("div",{className:"mt-3",children:[(0,t.jsx)("div",{className:"text-[11px] uppercase tracking-[0.16em] text-muted-foreground",children:"Top Attended Tokens"}),(0,t.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:(Array.isArray(e.top_attended_tokens)?e.top_attended_tokens:[]).map((e,s)=>(0,t.jsxs)("span",{className:"rounded-full border border-border bg-background px-2.5 py-1 text-xs text-muted-foreground",children:[ec(e.label,`#${e.index??"?"}`)," @ ",e.index??"?"," ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:eo(e.value)})]},`top-attended-${r}-${s}`))})]})]},`attention-token-${r}`))})]})},ex=({capture:e})=>{let r=e.preview&&"object"==typeof e.preview?e.preview:{};if("attention_pattern"===r.kind)return(0,t.jsx)(ep,{capture:e});let s=Array.isArray(r.token_summaries)?r.token_summaries:[],a=e.stats&&"object"==typeof e.stats?e.stats:{};return(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-background/70 p-4",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-sm font-semibold text-foreground",children:e.capture_key||e.kind||"Capture"}),(0,t.jsxs)("div",{className:"mt-1 text-xs text-muted-foreground",children:["shape: ",Array.isArray(e.shape)?e.shape.join(" x "):"n/a"]})]}),(0,t.jsxs)("div",{className:"flex flex-wrap gap-2 text-xs",children:["number"==typeof r.feature_width&&r.feature_width>0&&(0,t.jsxs)("span",{className:"rounded-full border border-border bg-background px-2.5 py-1 text-muted-foreground",children:["features: ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:r.feature_width})]}),"number"==typeof r.token_count&&r.token_count>0&&(0,t.jsxs)("span",{className:"rounded-full border border-border bg-background px-2.5 py-1 text-muted-foreground",children:["tokens: ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:r.token_count})]})]})]}),(0,t.jsxs)("div",{className:"mt-4 grid gap-3 sm:grid-cols-2 xl:grid-cols-4",children:[(0,t.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[(0,t.jsx)("div",{className:"text-[11px] uppercase tracking-[0.16em] text-muted-foreground",children:"Mean"}),(0,t.jsx)("div",{className:"mt-2 text-sm font-semibold text-foreground",children:eo(a.mean)})]}),(0,t.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[(0,t.jsx)("div",{className:"text-[11px] uppercase tracking-[0.16em] text-muted-foreground",children:"Std"}),(0,t.jsx)("div",{className:"mt-2 text-sm font-semibold text-foreground",children:eo(a.std)})]}),(0,t.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[(0,t.jsx)("div",{className:"text-[11px] uppercase tracking-[0.16em] text-muted-foreground",children:"Min"}),(0,t.jsx)("div",{className:"mt-2 text-sm font-semibold text-foreground",children:eo(a.min)})]}),(0,t.jsxs)("div",{className:"rounded-lg border border-border bg-muted/20 p-3",children:[(0,t.jsx)("div",{className:"text-[11px] uppercase tracking-[0.16em] text-muted-foreground",children:"Max"}),(0,t.jsx)("div",{className:"mt-2 text-sm font-semibold text-foreground",children:eo(a.max)})]})]}),s.length>0&&(0,t.jsx)("div",{className:"mt-4 space-y-3",children:s.slice(0,3).map((e,r)=>(0,t.jsxs)("div",{className:"rounded-lg border border-border bg-muted/10 p-3",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[(0,t.jsxs)("span",{className:"font-semibold text-foreground",children:["token ",e.token_position??r,e.token_label?`: ${ec(e.token_label,"")}`:""]}),(0,t.jsxs)("span",{className:"text-muted-foreground",children:["L2 ",eo(e.l2_norm)]}),(0,t.jsxs)("span",{className:"text-muted-foreground",children:["mean |x| ",eo(e.mean_abs)]}),(0,t.jsxs)("span",{className:"text-muted-foreground",children:["max |x| ",eo(e.max_abs)]})]}),(0,t.jsxs)("div",{className:"mt-3 grid gap-3 lg:grid-cols-2",children:[(0,t.jsx)(ed,{title:"Top Positive Channels",features:e.top_positive||[]}),(0,t.jsx)(ed,{title:"Top Negative Channels",features:e.top_negative||[]})]})]},`token-summary-${r}`))})]})},eh=({result:e})=>{let r=e.analysis&&"object"==typeof e.analysis?e.analysis:{},s=Array.isArray(e.captures)?e.captures:[],a=Array.isArray(e.artifacts)?e.artifacts:[],n=r.best_cell&&"object"==typeof r.best_cell?r.best_cell:null,i=r.best_head&&"object"==typeof r.best_head?r.best_head:null,l=r.best_scale&&"object"==typeof r.best_scale?r.best_scale:null,d=r.baseline_metric&&"object"==typeof r.baseline_metric?r.baseline_metric:null;return(0,t.jsxs)("div",{className:"rounded-2xl border border-amber-500/20 bg-[linear-gradient(135deg,rgba(245,158,11,0.08),rgba(14,165,233,0.08))] p-4 shadow-sm backdrop-blur-sm",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.18em] text-amber-700 dark:text-amber-300",children:[(0,t.jsx)(o.Brain,{size:14}),"Mechanistic Interpretability"]}),(0,t.jsx)("div",{className:"mt-2 text-base font-semibold text-foreground",children:String(e.kind||"experiment").replaceAll("_"," ")}),e.summaryText&&(0,t.jsx)("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:e.summaryText})]}),e.experimentId&&(0,t.jsx)("div",{className:"rounded-full border border-border bg-background/80 px-3 py-1 text-[11px] font-medium text-muted-foreground",children:e.experimentId})]}),(0,t.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2 text-xs",children:[e.engineId&&(0,t.jsxs)("span",{className:"rounded-full border border-border bg-background/70 px-2.5 py-1 text-muted-foreground",children:["engine: ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:e.engineId})]}),e.variantId&&(0,t.jsxs)("span",{className:"rounded-full border border-border bg-background/70 px-2.5 py-1 text-muted-foreground",children:["variant: ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:e.variantId})]}),s.length>0&&(0,t.jsxs)("span",{className:"rounded-full border border-border bg-background/70 px-2.5 py-1 text-muted-foreground",children:["captures: ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:s.length})]}),a.length>0&&(0,t.jsxs)("span",{className:"rounded-full border border-border bg-background/70 px-2.5 py-1 text-muted-foreground",children:["artifacts: ",(0,t.jsx)("span",{className:"font-medium text-foreground",children:a.length})]})]}),(0,t.jsxs)("div",{className:"mt-4 space-y-3",children:[d&&(0,t.jsx)(el,{title:"Baseline Metric",metric:d}),n&&n.metric&&(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-background/70 p-4",children:[(0,t.jsx)("div",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Best Patch Cell"}),(0,t.jsxs)("div",{className:"mt-2 text-sm text-foreground",children:["Layer ",(0,t.jsx)("span",{className:"font-semibold",children:n.layer}),", token"," ",(0,t.jsx)("span",{className:"font-semibold",children:n.token_position})]}),(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsx)(el,{title:"Cell Metric",metric:n.metric})})]}),i&&i.metric&&(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-background/70 p-4",children:[(0,t.jsx)("div",{className:"text-xs font-semibold upperc
1ase tracking-[0.16em] text-muted-foreground",children:"Best Head"}),(0,t.jsxs)("div",{className:"mt-2 text-sm text-foreground",children:["Layer ",(0,t.jsx)("span",{className:"font-semibold",children:i.layer}),", head"," ",(0,t.jsx)("span",{className:"font-semibold",children:i.head})]}),(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsx)(el,{title:"Head Metric",metric:i.metric})})]}),l&&l.metric&&(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-background/70 p-4",children:[(0,t.jsx)("div",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Best Steering Scale"}),(0,t.jsxs)("div",{className:"mt-2 text-sm text-foreground",children:["Scale ",(0,t.jsx)("span",{className:"font-semibold",children:l.scale})]}),(0,t.jsx)("div",{className:"mt-3",children:(0,t.jsx)(el,{title:"Steered Metric",metric:l.metric})})]}),s.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-xs font-semibold uppercase tracking-[0.16em] text-muted-foreground",children:"Capture Summary"}),(0,t.jsx)("div",{className:"mt-3 space-y-3",children:s.slice(0,3).map((e,r)=>(0,t.jsx)(ex,{capture:e},`capture-${r}-${e.capture_key||r}`))})]}),(0,t.jsxs)("details",{className:"rounded-xl border border-border bg-background/70 p-4",children:[(0,t.jsx)("summary",{className:"cursor-pointer text-sm font-medium text-foreground",children:"Experiment Details"}),(0,t.jsx)("pre",{className:"mt-3 overflow-x-auto whitespace-pre-wrap break-words rounded-lg bg-black/80 p-3 text-xs text-neutral-100",children:JSON.stringify(e,null,2)})]})]})]})},eg=({rawContent:e,reasoningContent:s,reasoningActivity:a,metrics:n,onOpenCanvas:i,isStreaming:l=!1,messageId:o,conversationId:d,editedCodeContent:c,originalCodeContent:u,modelId:m,modelName:p,modelCreator:x,toolCalls:h,prompt:g,responseId:f,isMultiModel:b,messages:v,lastImageUrl:N,lastVideoUrl:A,blenderArtifact:_,videoArtifact:S,audioArtifact:M,imageArtifact:C,canvasPatchArtifact:T,musicArtifact:I,mechInterpResult:z,isGeneratingAudio:U,streamingAudioUrl:$,isGeneratingImage:D,isShared:B=!1,isSocialPreview:H=!1})=>{let{user:W,getAccessToken:Y}=(0,F.useAuth)(),{openCreatePost:Z}=(0,L.useCreatePost)(),[Q,ee]=(0,r.useState)(!1),[et,ei]=(0,r.useState)(!1),[el,eo]=(0,r.useState)(null),[ed,ec]=(0,r.useState)(null),[eu,em]=(0,r.useState)(null);(0,r.useEffect)(()=>{let e=S?.jobId,t=!!(e&&!S?.publicUrl&&S?.status!=="failed");if(!W||B||!e||!t)return;let r=!1,s=async()=>{try{let t=await Y();r||await O(e,t)}catch(e){console.warn("Failed to refresh video job",e)}};s();let a=window.setInterval(s,5e3);return()=>{r=!0,window.clearInterval(a)}},[Y,B,W,S?.jobId,S?.publicUrl,S?.status]);let ep=(0,r.useMemo)(()=>(0,w.extractAssistantContent)(e),[e]),ex=s||ep.thinkingText,eg=ep.mainContent,ef=!!s||ep.isThinkingComplete,eb=!!s&&l,ev=n?.usage?.reasoningOutputTokens,ej=!B&&!ex&&(null!=ev&&ev>0||l&&a?.visibility==="hidden"),ew=(0,r.useMemo)(()=>{if(C?.publicUrl||!eg)return null;let e=null,t=null,r=r=>{let s=r.match(/!\[([^\]]*)\]\(([^)]+)\)/);return!!(s&&((e,t)=>{let r=t.trim();if(!r||!/\[Generated Image\]/i.test(e))return!1;if(r.startsWith("data:image/")||r.startsWith("blob:"))return!0;if(!/^https?:\/\//i.test(r))return!1;try{let e=new URL(r),t=e.pathname.toLowerCase();return/\.(png|jpe?g|webp|gif|avif|svg)$/i.test(t)||e.hostname.includes("firebasestorage.googleapis.com")||e.hostname.includes("storage.googleapis.com")}catch{return!1}})(r,s[2]))&&(t=s[1]||null,e=s[2],!0)};if(Array.isArray(eg)){for(let e of eg)if("text"===e.type&&e.text&&r(e.text))break}return e?{url:e,prompt:t}:null},[eg,C]),ey=(0,r.useMemo)(()=>{if(!eg)return null;let e=!!(C?.publicUrl||ew?.url),t=!!($||M?.publicUrl||U);if(!e&&!t)return eg;if(Array.isArray(eg)){let r=eg.map(r=>{if("text"===r.type&&r.text){let s=r.text;return e&&(s=s.replace(/!\[[^\]]*\]\([^)]+\)/g,"").replace(/\[Generated Image\]/gi,"")),t&&(s=s.replace(/\[Audio:\s*[^\]]*\]/gi,"")),s=s.replace(/^\s*[\r\n]+/gm,"").trim(),{...r,text:s}}return r}).filter(e=>"text"!==e.type||e.text);return r.length>0?r:null}return eg},[M?.publicUrl,ew,C?.publicUrl,U,eg,$]),ek=$||M?.publicUrl,eN=I?.publicUrl,eA=C?.publicUrl||ew?.url,e_=C?.prompt||ew?.prompt||g,eS=C?.size,eM=V({kind:"audio",responseId:f,messageId:o,modelId:m,storagePath:M?.storagePath,publicUrl:ek,updatedAt:M?.updatedAt,pending:!!U}),eC=V({kind:"music",responseId:f,messageId:o,modelId:m,storagePath:I?.storagePath,publicUrl:eN,updatedAt:I?.updatedAt}),eT=V({kind:"image",responseId:f,messageId:o,modelId:m,storagePath:C?.storagePath,publicUrl:eA||void 0,updatedAt:C?.updatedAt,pending:!!D}),eI=V({kind:"video",responseId:f,messageId:o,modelId:m,storagePath:S?.storagePath,publicUrl:S?.publicUrl,updatedAt:S?.updatedAt,pending:S?.status==="generating"}),ez=(0,r.useMemo)(()=>
1{if(S?.publicUrl&&S.storagePath&&S.canvasId)return{publicUrl:S.publicUrl,storagePath:S.storagePath,canvasId:S.canvasId,duration:S.duration,updatedAt:S.updatedAt}},[S]),eU=(0,r.useCallback)(async(e,t,r,s)=>{if(!W?.uid)return void G.toast.error("Please sign in to share media artifacts");if(!t.publicUrl||t.publicUrl.startsWith("blob:")||t.publicUrl.startsWith("data:"))return void G.toast.error("Wait for the artifact to finish uploading before sharing");em(e),ei(!0),eo(null),ec(null);try{let a=await (0,R.createGeneratedArtifactShare)({kind:e,artifact:t,title:s||q[e],prompt:r||g,modelId:m,modelName:p,modelCreator:x,conversationId:d,messageId:o,responseId:f}),n=`${window.location.origin}/share/artifact/${a}`;eo(n),ec({shareId:a,kind:e,artifact:t,title:s||q[e],prompt:r||g,modelId:m,modelName:p,modelCreator:x,originalConversationId:d,originalMessageId:o,originalResponseId:f,sharedAt:new Date().toISOString(),shareUrl:n})}catch(e){console.error("Failed to share generated artifact:",e),G.toast.error("Failed to create artifact share link"),eo(null)}finally{em(null)}},[d,o,x,m,p,g,f,W?.uid]),e$=(0,r.useCallback)(()=>{ed&&(0,E.isSocialEnabled)()&&(ei(!1),Z({type:"generated_artifact",data:ed}))},[Z,ed]),eP=(0,r.useMemo)(()=>h?.length?h.reduce((e,t)=>{if("video_processing"!==t.toolType)return[...e,t];let r=e.findIndex(e=>"video_processing"===e.toolType);if(r<0)return[...e,t];let s=e[r],a=Array.from(new Set([...s.details||[],...t.details||[]]));return e.map((e,n)=>n===r?{...s,...t,id:s.id,...a.length>0?{details:a}:{}}:e)},[]):[],[h]);return(0,t.jsxs)("div",{className:(0,j.cn)("space-y-4",B&&"space-y-2"),children:[ex&&(0,t.jsx)(er,{content:ex,isComplete:ef&&!eb,isExpanded:Q,onToggle:()=>ee(e=>!e),isShared:B}),ej&&(0,t.jsx)(es,{isActive:l&&a?.status==="active",reasoningTokens:ev}),eP.length>0&&(0,t.jsx)("div",{className:(0,j.cn)("space-y-2",B&&"space-y-1"),children:eP.map(e=>(0,t.jsx)(J,{toolCall:e,isShared:B},e.id))}),T&&T.ok&&(0,t.jsx)(K,{artifact:T,onOpenCanvas:i,isShared:B}),(ek||U)&&(0,t.jsx)(k.AudioMessagePlayer,{audioUrl:ek||"",format:M?.format,voiceMode:M?.voiceMode,voice:M?.voice,hideDownload:H,hideFormat:H,isGenerating:U,actions:M?.publicUrl?(0,t.jsx)(X,{onClick:()=>eU("audio",{publicUrl:M.publicUrl,storagePath:M.storagePath,format:M.format,voiceMode:M.voiceMode,voice:M.voice,updatedAt:M.updatedAt},M.inputText||g,"Audio"),isLoading:"audio"===eu,className:"bg-white/10 text-white/60 hover:bg-white/15 hover:text-white dark:bg-white/10 dark:text-white/60 dark:hover:bg-white/15"}):void 0},eM),eN&&(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(k.AudioMessagePlayer,{audioUrl:eN,format:I?.format,label:"Music",actions:(0,t.jsx)(X,{onClick:()=>eU("music",{publicUrl:I.publicUrl,storagePath:I.storagePath,format:I.format,contentType:I.mediaType,updatedAt:I.updatedAt},I.prompt||g,"Music"),isLoading:"music"===eu,className:"bg-white/10 text-white/60 hover:bg-white/15 hover:text-white dark:bg-white/10 dark:text-white/60 dark:hover:bg-white/15"})}),I?.generatedText&&(0,t.jsxs)("details",{className:"rounded-xl border border-border bg-neutral-50 px-4 py-3 text-xs dark:bg-neutral-900/60",children:[(0,t.jsx)("summary",{className:"cursor-pointer font-medium text-foreground",children:"Generated lyrics and structure"}),(0,t.jsx)("div",{className:"mt-2 whitespace-pre-wrap text-muted-foreground",children:I.generatedText})]})]},eC),(eA||D)&&(0,t.jsx)(ea,{imageUrl:eA||"",prompt:e_,size:eS,isGenerating:D,onShare:eA?()=>eU("image",{publicUrl:eA,storagePath:C?.storagePath,size:eS,updatedAt:C?.updatedAt},e_,"Image"):void 0,isSharing:"image"===eu},eT),S&&(0,t.jsx)(en,{videoUrl:S.publicUrl||"",prompt:S.prompt,size:S.size,status:S.status,jobId:S.jobId,providerJobId:S.providerJobId,providerStatus:S.providerStatus,errorMessage:S.errorMessage,onShare:S.publicUrl&&"generating"!==S.status&&"failed"!==S.status?()=>eU("video",{publicUrl:S.publicUrl,storagePath:S.storagePath,duration:S.duration,size:S.size,updatedAt:S.updatedAt},S.prompt||g,"Video"):void 0,isSharing:"video"===eu},eI),z&&(0,t.jsx)(eh,{result:z}),ey&&(0,t.jsx)("div",{className:(0,j.cn)("chat-response-copy prose prose-neutral dark:prose-invert max-w-none break-words [word-break:break-word]",B&&"prose-sm leading-normal"),children:Array.isArray(ey)?ey.map((e,r)=>"text"===e.type?(0,t.jsx)(y.MarkdownRenderer,{content:e.text||"",onOpenCanvas:i,keyPrefix:`main-${r}`,isStreaming:l,messageId:o,conversationId:d,editedCodeContent:c,originalCodeContent:u,modelId:m,modelName:p,prompt:g,responseId:f,isMultiModel:b,messages:v,lastImageUrl:N,lastVideoUrl:A,blenderArtifact:_,videoArtifact:ez,isShared:B},`main-${r}`):null):(0,t.jsx)(y.MarkdownRenderer,{content:ey,onOpenCanvas:i,keyPrefix:"main",isStreaming:l,messageId:o,conversationId:d,editedCodeContent:c,originalCodeContent:u,modelId:m,modelName:p,prompt:g,responseId:f,isMultiModel:b,messages:v,lastImageUrl:N,lastVideoUrl:A,blenderArtifact:_,videoArtifact:ez,isShared:B})}),(0,t.jsx)(P.ShareModal,{isOpen:et,onClose:()=>ei(!1),shareUrl:el,isGenerating:null!==eu&&!el,title:"Share Artifact",type:"artifact",onShareToSocial:(0,E.isSocialEnabled)()&&ed?e$:void 0})]})};e.s(["ChatMessageContent",0,({content:e,role:r,openPreviewModal:s,onOpenCanvas:a,isStreaming:n=!1,messageId:i,conversationId:l,editedCodeContent:o,originalCodeContent:d,modelId:c,reasoningContent:u,reasoningActivity:m,metrics:p,modelName:x,modelCreator:h,toolCalls:g,prompt:f,responseId:b,isMultiModel:v,messages:j,lastImageUrl:w,lastVideoUrl:y,blenderArtifact:k,videoArtifact:N,audioArtifact:A,imageArtifact:_,canvasPatchArtifact:S,musicArtifact:M,mechInterpResult:C,isGeneratingAudio:T,streamingAudioUrl:I,isGeneratingImage:z,isShared:U=!1,isSocialPreview:$=!1})=>"user"===r?(0,t.jsx)(et,{content:e,openPreviewModal:s,onOpenCanvas:a}):(0,t.jsx)(eg,{rawContent:e,reasoningContent:U?void 0:u,reasoningActivity:m,metrics:p,onOpenCanvas:a,isStreaming:n,messageId:i,conversationId:l,editedCodeContent:o,originalCodeContent:d,modelId:c,modelName:x,modelCreator:h,toolCalls:g,prompt:f,responseId:b,isMultiModel:v,messages:j,lastImageUrl:w,lastVideoUrl:y,blenderArtifact:k,videoArtifact:N,audioArtifact:A,imageArtifact:_,canvasPatchArtifact:S,musicArtifact:M,mechInterpResult:C,isGeneratingAudio:T,streamingAudioUrl:I,isGeneratingImage:z,isShared:U,isSocialPreview:$})],972698);let ef=(e,t=2)=>{if(null==e)return"";let r=Math.max(0,Math.min(3,Math.floor(t))),s=Math.max(0,e)/1e3;if(0===r){let e=Math.round(s);if(e>=60){let t=Math.floor(e/60);return`${t}:${(e%60).toString().padStart(2,"0")}`}return`${e}s`}if(!(s>=60))return`${s.toFixed(r)}s`;{let e=Math.floor(s/60),t=(s%60).toFixed(r);return`${e}:${t.padStart(r+3,"0")}`}}
1;e.s(["createTimer",0,e=>{let t=null,r=null,s=!1;return{start:()=>{s||(r=Date.now(),s=!0,e(0),t=setInterval(()=>{s&&null!==r?e(Date.now()-r):t&&(clearInterval(t),t=null)},100))},stop:()=>(t&&(clearInterval(t),t=null),s=!1,r?Date.now()-r:null),reset:()=>{t&&(clearInterval(t),t=null),s=!1,r=null,e(null)}}},"formatMilliseconds",0,ef],167506);let eb=(0,p.default)("circle-dollar-sign",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);e.s(["CircleDollarSign",()=>eb],788712);var ev=e.i(658041);let ej=(0,p.default)("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]),ew=(0,p.default)("timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);var ey=e.i(582458);e.s(["TriangleAlert",()=>ey.default],89128);var ey=ey,ek=e.i(39312);let eN=new Intl.NumberFormat("en-US",{maximumFractionDigits:0}),eA=new Intl.NumberFormat("en-US",{notation:"compact",maximumFractionDigits:1}),e_=e=>(e>=1e4?eA:eN).format(e),eS=e=>{let t=e/1e6;return 0===t?"$0":t<1e-4?`$${t.toFixed(6)}`:t<.01?`$${t.toFixed(4)}`:`$${t.toFixed(2)}`},eM=(e,t)=>e>0&&t>0?`${Math.round(t/e*100)}%`:null,eC=e=>e.replace(/([A-Z])/g," $1").trim().toLowerCase(),eT=({label:e,value:r})=>(0,t.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-3 border-b border-border/60 py-1.5 sm:gap-5 last:border-0",children:[(0,t.jsx)("dt",{className:"shrink-0 text-muted-foreground",children:e}),(0,t.jsx)("dd",{className:"min-w-0 break-words text-right font-mono text-foreground [overflow-wrap:anywhere]",children:r})]});function eI({metrics:e,className:s,align:a="left",interactive:n=!0}){let[i,l]=(0,r.useState)(!1),o=(0,r.useRef)(null);if((0,r.useEffect)(()=>{if(!i)return;let e=e=>{o.current?.contains(e.target)||l(!1)},t=e=>{"Escape"===e.key&&l(!1)};return document.addEventListener("pointerdown",e),document.addEventListener("keydown",t),()=>{document.removeEventListener("pointerdown",e),document.removeEventListener("keydown",t)}},[i]),!e)return null;let{usage:d,timing:c,cost:u}=e,m=Object.entries(e.billableUnits||{}),p=d?eM(d.inputTokens,d.cachedInputTokens):null,x=d?.cacheReadStatus??(d&&d.cachedInputTokens>0?"hit":"unreported"),h=ef(c.totalMs,1),g="inline-flex size-6 items-center justify-center rounded-md border border-border/60 bg-muted/35 p-0 text-[11px] tabular-nums text-muted-foreground transition-colors hover:border-border hover:bg-muted/70 hover:text-foreground sm:h-auto sm:w-auto sm:gap-1.5 sm:px-1.5 sm:py-0.5",f=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ej,{className:"size-3.5 sm:hidden","aria-hidden":"true"}),(0,t.jsxs)("span",{className:"hidden items-center gap-1.5 sm:contents",children:[(0,t.jsx)(ew,{className:"size-3","aria-hidden":"true"}),(0,t.jsx)("span",{children:h}),null!=c.tokensPerSecond?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-border",children:"·"}),(0,t.jsxs)("span",{children:[c.tokensPerSecond.toFixed(1)," tok/s"]})]}):null,p?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-border",children:"·"}),(0,t.jsxs)("span",{children:[p," cached"]})]}):null,u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-border",children:"·"}),(0,t.jsxs)("span",{children:["catalog_estimate"===u.source?"~":"",eS(u.amountMicrousd)]})]}):null,"exact"!==e.usageStatus?(0,t.jsx)(ey.default,{className:"size-3 text-amber-500","aria-label":"partial"===e.usageStatus?"Provider usage is incomplete":"Provider did not report token usage"}):null]})]});return n?(0,t.jsxs)("div",{ref:o,className:(0,j.cn)("relative",i&&"response-metrics-open",s),onClick:e=>e.stopPropagation(),children:[(0,t.jsx)("button",{type:"button",className:(0,j.cn)(g,"cursor-pointer"),"aria-expanded":i,"aria-label":"View response statistics",title:"View response statistics",onClick:()=>l(e=>!e),children:f}),i?(0,t.jsxs)("div",{className:(0,j.cn)("fixed inset-x-3 bottom-[calc(env(safe-area-inset-bottom)+6.25rem)] z-[80] isolate max-h-[min(70dvh,28rem)] w-auto max-w-[calc(100vw-1.5rem)] overflow-y-auto rounded-xl border border-neutral-200 bg-white p-3 text-xs text-neutral-950 shadow-[0_18px_55px_rgba(0,0,0,0.28)] ring-1 ring-black/5 dark:border-neutral-700 dark:bg-neutral-950 dar
1k:text-neutral-50 dark:ring-white/5 sm:absolute sm:inset-x-auto sm:bottom-[calc(100%+0.5rem)] sm:max-h-none sm:w-80 sm:max-w-none sm:overflow-visible","right"===a?"sm:right-0":"sm:left-0"),children:[(0,t.jsxs)("div",{className:"mb-2 flex items-center justify-between border-b border-neutral-200 pb-2 dark:border-neutral-800",children:[(0,t.jsx)("span",{className:"font-semibold",children:"Response statistics"}),(0,t.jsx)("span",{className:(0,j.cn)("rounded-full px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide","exact"===e.usageStatus?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400":"bg-amber-500/10 text-amber-600 dark:text-amber-400"),children:e.usageStatus})]}),(0,t.jsxs)("dl",{children:[(0,t.jsx)(eT,{label:"Total time",value:ef(c.totalMs,2)}),null!=c.ttftMs&&(0,t.jsx)(eT,{label:"Time to first token",value:ef(c.ttftMs,2)}),null!=c.timeToFirstArtifactMs&&(0,t.jsx)(eT,{label:"Time to artifact",value:ef(c.timeToFirstArtifactMs,2)}),null!=c.tokensPerSecond&&(0,t.jsx)(eT,{label:"Visible output speed",value:`${c.tokensPerSecond.toFixed(2)} tok/s`}),e.upstreamProvider&&(0,t.jsx)(eT,{label:"Upstream provider",value:e.upstreamProvider}),d&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eT,{label:"Input tokens",value:`${e_(d.inputTokens)} tok`}),(0,t.jsx)(eT,{label:"Cached input tokens",value:"hit"===x?(0,t.jsxs)("span",{className:"text-emerald-600 dark:text-emerald-400",children:[e_(d.cachedInputTokens)," tok",p?` \xb7 ${p}`:""]}):"miss"===x?(0,t.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"0 tok · miss"}):(0,t.jsx)("span",{className:"text-muted-foreground",children:"Not reported"})}),d.cacheWriteInputTokens>0?(0,t.jsx)(eT,{label:"Cache write tokens",value:`${e_(d.cacheWriteInputTokens)} tok`}):null,(0,t.jsx)(eT,{label:"Output tokens",value:`${e_(d.outputTokens)} tok`}),(0,t.jsx)(eT,{label:"Reasoning output tokens",value:`${e_(d.reasoningOutputTokens)} tok`})]}),m.map(([e,r])=>(0,t.jsx)(eT,{label:eC(e),value:e_(r)},e)),u&&(0,t.jsx)(eT,{label:"provider_reported"===u.source?"Reported cost":"Estimated cost",value:eS(u.amountMicrousd)})]})]}):null]}):(0,t.jsx)("span",{className:(0,j.cn)(g,s),title:"Open this response to inspect full timing, usage, cache, and cost details.",children:f})}function ez({metrics:e,className:r}){let s=(e=>{let t=e.filter(e=>!!e);if(0===t.length)return null;let r=0,s=0,a=0,n=0,i={responses:t.length,totalTokens:0,inputTokens:0,outputTokens:0,cachedInputTokens:0,cacheWriteInputTokens:0,reasoningOutputTokens:0,totalCostMicrousd:0,reportedCostMicrousd:0,estimatedCostMicrousd:0,totalGenerationMs:0,averageTtftMs:null,tokensPerSecond:null,incompleteResponses:0,partialResponses:0,unavailableResponses:0,billableUnits:{}};for(let e of t){i.totalGenerationMs+=e.timing.totalMs;let t=e.usage;for(let[l,o]of(t&&(i.totalTokens+=t.totalTokens,i.inputTokens+=t.inputTokens,i.outputTokens+=t.outputTokens,i.cachedInputTokens+=t.cachedInputTokens,i.cacheWriteInputTokens+=t.cacheWriteInputTokens,i.reasoningOutputTokens+=t.reasoningOutputTokens,e.timing.decodeMs&&t.outputTokens>0&&(a+=e.timing.decodeMs,n+=Math.max(t.outputTokens-t.reasoningOutputTokens,0))),null!=e.timing.ttftMs&&(r+=e.timing.ttftMs,s+=1),e.cost&&(i.totalCostMicrousd+=e.cost.amountMicrousd,"provider_reported"===e.cost.source?i.reportedCostMicrousd+=e.cost.amountMicrousd:i.estimatedCostMicrousd+=e.cost.amountMicrousd),Object.entries(e.billableUnits||{})))i.billableUnits[l]=(i.billableUnits[l]||0)+o;"exact"!==e.usageStatus&&(i.incompleteResponses+=1),"partial"===e.usageStatus&&(i.partialResponses+=1),"unavailable"===e.usageStatus&&(i.unavailableResponses+=1)}return i.averageTtftMs=s>0?r/s:null,i.tokensPerSecond=a>0?n/(a/1e3):null,i})(e);return s?(0,t.jsx)(eU,{session:s,className:r}):null}function eU({session:e,className:r}){let s=eM(e.inputTokens,e.cachedInputTokens),a=0===e.estimatedCostMicrousd?"reported":0===e.reportedCostMicrousd?"estimated":"mixed";return(0,t.jsxs)("div",{className:(0,j.cn)("flex flex-nowrap items-center justify-center gap-x-3 text-[11px] tabular-nums text-muted-foreground sm:flex-wrap sm:gap-y-1",r),children:[(0,t.jsxs)("span",{className:"hidden items-center gap-1 sm:inline-flex",children:[(0,t.jsx)(ej,{className:"size-3"}),e.responses," responses"]}),(0,t.jsxs)("span",{className:"hidden items-center gap-1 sm:inline-flex",children:[(0,t.jsx)(ew,{className:"size-3"}),ef(e.totalGenerationMs,1)," generation"]}),null!=e.tokensPerSecond&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(ek.Zap,{className:"size-3"}),e.tokensPerSecond.toFixed(1)," tok/s"]}),null!=e.averageTtftMs&&(0,t.jsxs)("span",{className:"hidden items-center gap-1 sm:inline-flex",children:[(0,t.jsx)(ew,{className:"size-3"}),ef(e.averageTtftMs,1)," avg TTFT"]}),e.totalTokens>0&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,t.jsx)(ev.Database,{className:"size-3"}),e_(e.totalTokens)," tok",s?(0,t.jsxs)("span",{className:"hidden sm:inline",children:[" · ",s," cached"]}):null]}),Object.entries(e.billableUnits).map(([e,r])=>(0,t.jsxs)("span",{className:"hidden sm:inline",children:[e_(r)," ",eC(e)]},e)),e.totalCostMicrousd>0&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-1",title:"Provider-reported and catalog-estimated costs are tracked separately; this is not a billing statement.",children:[(0,t.jsx)(eb,{className:"size-3"}),eS(e.totalCostMicrousd)," ",a]}),e.partialResponses>0&&(0,t.jsxs)("span",{className:"hidden text-amber-500 sm:inline",children:[e.partialResponses," partial usage"]}),e.unavailableResponses>0&&(0,t.jsxs)("span",{className:"hidden text-amber-500 sm:inline",children:[e.unavailableResponses," without token usage"]})]})}e.s(["ResponseMetrics",()=>eI,"SessionMetricsBar",()=>ez],698125)},256747,107899,e=>{"use strict";var t=e.i(951445);let r=(0,e.i(475254).default)("mouse-pointer-click",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.
1074z",key:"s0h3yz"}]]);function s(e){return"computer_use"===e?{label:"Computer Use",icon:r,iconClassName:"text-fuchsia-600 dark:text-fuchsia-400"}:"browser_use"===e?{label:"Browser Use",icon:t.Monitor,iconClassName:"text-cyan-600 dark:text-cyan-400"}:null}e.s(["MousePointerClick",()=>r],107899),e.s(["getAgentTaskTypeMeta",()=>s],256747)},660279,e=>{"use strict";var t=e.i(387047);function r(e){for(let r=0;r<e.length;r+=1){let s=e[r],a=s.sharedAgentTrace;if("agent_session"===s.type&&a&&Array.isArray(a.frames)&&0!==a.frames.length)return{sessionId:a.sessionId,taskType:a.taskType||s.agentSession?.taskType,status:a.status,modelId:a.modelId||s.modelId||s.agentSession?.modelId,modelName:a.modelName||s.agentSession?.modelName,promptText:a.userGoal?.trim()||function(e,r){for(let s=r-1;s>=0;s-=1){let r=e[s];if("user"!==r.role)continue;let a=(0,t.extractTextFromContent)(r.content)?.trim();if(a)return a}}(e,r),finalAnswer:a.finalAnswer?.trim()||s.agentSession?.finalAnswer?.trim(),elapsedTime:a.elapsedTime??s.agentSession?.elapsedTime??null,frameCount:a.frameCount||a.frames.length,frames:a.frames}}return null}function s(e){for(let t of e)if("agent_session"===t.type){if(t.sharedAgentTrace)return{taskType:t.sharedAgentTrace.taskType||t.agentSession?.taskType,status:t.sharedAgentTrace.status,elapsedTime:t.sharedAgentTrace.elapsedTime??t.agentSession?.elapsedTime??null};if(t.agentSession)return{taskType:t.agentSession.taskType,status:t.agentSession.status,elapsedTime:t.agentSession.elapsedTime??null}}return null}e.s(["getSharedAgentPreviewFromMessages",()=>r,"getSharedAgentSummaryFromMessages",()=>s])},373884,798031,320202,128439,114532,e=>{"use strict";let t=(0,e.i(475254).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);e.s(["default",()=>t],798031),e.s(["XCircle",()=>t],373884);var r=e.i(271645);e.s(["useLiveElapsedTime",0,(e,t,s=!1)=>{let[a,n]=(0,r.useState)(null),i=e&&!!t&&!s;return(0,r.useEffect)(()=>{if(!i||!t)return;let e=()=>{let e=250*Math.floor(Math.max(0,Date.now()-t)/250);n(t=>t===e?t:e)},r=window.setTimeout(e,0),s=window.setInterval(e,250);return()=>{window.clearTimeout(r),window.clearInterval(s)}},[i,t]),i?a:null}],320202);var s=e.i(615736),a=e.i(546022);let n=e=>{if(e.isAgentSession||"error"===e.status||void 0!==e.status&&"completed"!==e.status)return null;let t=(0,s.extractRenderableAssistantText)(e.content||""),r=(0,s.extractFencedCodeBlocks)(t);for(let t=r.length-1;t>=0;t-=1){let n=r[t],i=(0,a.normalizeLanguageId)(n.language),l=(0,s.getStoredCodeBlockContent)(e.editedCodeContent,t)??n.code;if(l.trim()&&"html"===(0,s.detectContentType)(l,i))return{content:l,codeBlockIndex:t}}return null},i=e=>{if(e.isAgentSession||"error"===e.status)return null;let t=n(e);if(t)return{kind:"html",content:t.content,codeBlockIndex:t.codeBlockIndex,status:"completed"};let r=[];return e.imageArtifact?.publicUrl&&r.push({kind:"image",publicUrl:e.imageArtifact.publicUrl,storagePath:e.imageArtifact.storagePath,prompt:e.imageArtifact.prompt,size:e.imageArtifact.size,updatedAt:e.imageArtifact.updatedAt,status:"completed"}),e.videoArtifact&&(e.videoArtifact.publicUrl||"generating"===e.videoArtifact.status||"failed"===e.videoArtifact.status)&&r.push({kind:"video",publicUrl:e.videoArtifact.publicUrl,storagePath:e.videoArtifact.storagePath,prompt:e.videoArtifact.prompt,size:e.videoArtifact.size,updatedAt:e.videoArtifact.updatedAt,status:e.videoArtifact.status||(e.videoArtifact.publicUrl?"completed":"generating"),errorMessage:e.videoArtifact.errorMessage,jobId:e.videoArtifact.jobId,providerJobId:e.videoArtifact.providerJobId,providerStatus:e.videoArtifact.providerStatus}),e.audioArtifact?.publicUrl&&r.push({kind:"audio",publicUrl:e.audioArtifact.publicUrl,storagePath:e.audioArtifact.storagePath,prompt:e.audioArtifact.inputText,format:e.audioArtifact.format,voiceMode:e.audioArtifact.voiceMode,voice:e.audioArtifact.voice,updatedAt:e.audioArtifact.updatedAt,status:"completed"}),e.musicArtifact?.publicUrl&&r.push({kind:"music",publicUrl:e.musicArtifact.publicUrl,storagePath:e.musicArtifact.storagePath,prompt:e.musicArtifact.prompt,format:e.musicArtifact.format,updatedAt:e.musicArtifact.updatedAt,status:"completed"}),1===r.length?r[0]:null};e.s(["findLatestHtmlCanvasResponseEntry",0,e=>{for(let t=e.length-1;t>=0;t-=1){let r=e[t];if(r[1].some(e=>null!==n(e)))return r}}
1,"getInlineMultiModelArtifact",0,i,"getInlineMultiModelArtifactSignature",0,e=>{let t=i(e);return t?[t.kind,t.content||"",String(t.codeBlockIndex??""),t.publicUrl||"",t.storagePath||"",t.updatedAt||"",t.status||"",t.errorMessage||"",t.jobId||"",t.providerJobId||"",t.providerStatus||"",t.prompt||"",t.size||"",t.format||"",t.voiceMode||"",t.voice||""].join("\x1f"):"none"},"getMultiModelResponseDisplayState",0,e=>{let t=e.videoArtifact;if(t?.status==="failed")return{status:"error",label:"Error",error:t.errorMessage||e.error||"Video generation failed."};if("error"===e.status)return{status:"error",label:"Stopped by user"===e.error?"Stopped":"Error",error:e.error};if(t&&!t.publicUrl){let e=t.providerStatus?.toLowerCase();return"queued"===e||"submitted"===e?{status:"streaming",label:"Queued"}:"processing"===e?{status:"streaming",label:"Generating video..."}:"completed"===e||"completed"===t.status?{status:"streaming",label:"Finalizing video..."}:{status:"streaming",label:"Starting video..."}}if(t?.status==="completed"&&t.publicUrl)return{status:"completed",label:"Completed"};switch(e.status){case"pending":return{status:"pending",label:"Waiting..."};case"streaming":return{status:"streaming",label:"Generating..."};case"completed":return{status:"completed",label:"Completed"};default:return{status:"error",label:"Error",error:e.error}}}],128439);var l=e.i(843476),o=e.i(770703),d=e.i(531278),c=e.i(549838),u=e.i(878824),m=e.i(31572),p=e.i(944904),x=e.i(385044);let h=(0,o.default)(()=>e.A(240988).then(e=>e.HtmlPreviewRenderer),{loadableGenerated:{modules:[453359]},ssr:!1,loading:()=>(0,l.jsx)("div",{className:"flex h-full items-center justify-center",role:"status",children:(0,l.jsx)(d.Loader2,{size:22,className:"animate-spin text-white/60"})})}),g={html:"HTML",image:"Image",video:"Video",audio:"Audio",music:"Music"};e.s(["MultiModelArtifactPreview",0,({artifact:e,responseId:t,messageId:s,modelId:a,compact:n=!1,videoPlayback:i="manual",socialPreview:o=!1,onOpen:f})=>{let[b,v]=(0,r.useState)(null),[j,w]=(0,r.useState)({}),y=(0,r.useCallback)(e=>{e.stopPropagation()},[]);if("html"===e.kind)return(0,l.jsx)("button",{type:"button",className:(0,c.cn)("block w-full border-t border-border/70 bg-neutral-950 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/50",n?"aspect-video max-h-52":"h-72"),onClick:e=>{e.stopPropagation(),f?.()},"aria-label":"Open HTML canvas response",children:e.content?(0,l.jsx)(h,{content:e.content,interactionMode:"thumbnail",showPreview:!0}):(0,l.jsx)("span",{className:"flex h-full items-center justify-center px-6 text-center text-xs text-red-300",children:"HTML preview is unavailable."})});let k=g[e.kind],N=(0,u.getGeneratedMediaRenderKey)({kind:e.kind,responseId:t,messageId:s,modelId:a,storagePath:e.storagePath,publicUrl:e.publicUrl,updatedAt:e.updatedAt,pending:"generating"===e.status});if("audio"===e.kind||"music"===e.kind)return(0,l.jsx)("div",{className:"border-t border-border/70 bg-neutral-950",onClick:y,onKeyDown:y,children:(0,l.jsx)(m.AudioMessagePlayer,{audioUrl:e.publicUrl||"",format:e.format,voiceMode:"music"===e.kind?"design":e.voiceMode,voice:e.voice,label:"music"===e.kind?"Music":"Audio",hideDownload:n,hideFormat:n,hideMobileSecondaryControls:o,className:"rounded-none border-0 shadow-none"},N)});let A="generating"===e.status,_="failed"===e.status,S="image"===e.kind&&"loaded"===j[N],M="image"===e.kind&&"error"===j[N],C=e.providerStatus?.toLowerCase(),T="queued"===C||"submitted"===C?"Queued":"processing"===C?"Generating video...":`Starting ${k.toLowerCase()}...`,I=e.jobId&&e.jobId.length>18?`${e.jobId.slice(0,15)}â¦`:e.jobId,z=e.size?(0,u.getGeneratedImageAspectRatio)(e.size):"video"===e.kind?16/9:1,U=n?"h-auto max-h-52 w-full":"h-72";return(0,l.jsxs)("div",{className:(0,c.cn)("relative border-t border-border/70 bg-neutral-950",U),style:n?{aspectRatio:z}:void 0,onClick:y,onKeyDown:y,children:[(A||!e.publicUrl&&!_)&&(0,l.jsxs)("div",{className:"flex h-full flex-col items-center justify-center gap-2 text-white/65",role:"status",children:[(0,l.jsx)(d.Loader2,{size:22,className:"animate-spin"}),(0,l.jsx)("span",{className:"text-xs",children:T}),I&&(0,l.jsxs)("span",{className:"font-mono text-[10px] text-white/35",title:e.jobId,children:["Job ",I]})]}),_&&(0,l.jsx)("div",{className:"flex h-full items-center justify-center px-6 text-center text-xs text-red-300",role:"alert",children:e.errorMessage||`${k} generation failed.`}),"image"===e.kind&&e.publicUrl&&!_&&(0,l.jsxs)(l.Fragment,{children:[!S&&!M&&(0,l.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",role:"status",children:(0,l.jsx)(d.Loader2,{size:22,className:"animate-spin text-white/60"})}),M&&(0,l.jsx)("div",{className:"absolute inset-0 flex items-center justify-center px-6 text-center text-xs text-red-300",role:"alert",children:"Image could not be loaded."}
1),(0,l.jsx)("button",{type:"button",className:(0,c.cn)("h-full w-full",o?"cursor-pointer":"cursor-zoom-in"),onClick:t=>{t.stopPropagation(),S&&v(e.publicUrl||null)},"aria-label":"Open image preview",children:(0,l.jsx)("img",{src:e.publicUrl,alt:e.prompt||"Generated image",className:(0,c.cn)("h-full w-full object-contain transition-opacity duration-200",S?"opacity-100":"opacity-0"),style:{aspectRatio:(0,u.getGeneratedImageAspectRatio)(e.size)},onLoad:()=>{w(e=>({...e,[N]:"loaded"}))},onError:()=>w(e=>({...e,[N]:"error"}))},N)})]}),"video"===e.kind&&e.publicUrl&&!_&&(0,l.jsx)(p.ArtifactVideoPlayer,{src:e.publicUrl,className:"h-full w-full object-contain",mode:i,onClick:y},N),"image"===e.kind&&e.publicUrl&&(0,l.jsx)(x.ImagePreviewModal,{isOpen:b===e.publicUrl,onClose:()=>v(null),imageUrl:e.publicUrl,prompt:e.prompt,size:e.size})]})}],114532)},961663,506363,e=>{"use strict";var t=e.i(271645),r=e.i(411392),s=e.i(709409);let a=new Set(["completed","cancelled","error"]),n=[],i=new Map,l=new Map;function o(e){return[...e].filter(e=>!!e.imageUrl).sort((e,t)=>e.frameIndex-t.frameIndex)}async function d(e,t){let r=l.get(e);if(r)return r;let a=(0,s.getAgentFrames)(e,t).then(t=>{let r=o(t.map(e=>({frameIndex:e.frame_index,stepNumber:e.step_number,url:e.url||null,imageUrl:e.image_url})));return i.set(e,r),r}).finally(()=>{l.delete(e)});return l.set(e,a),a}function c({sessionId:e,initialFrames:s=n,expectedFrameCount:l=0,status:c,enabled:u=!0}){let{getAccessToken:m}=(0,r.useAuth)(),p=(0,t.useMemo)(()=>o(s),[s]),[x,h]=(0,t.useState)(()=>({sessionId:e,frames:e&&i.get(e)||[]}));return((0,t.useEffect)(()=>{if(!u||!e)return;let t=!!c&&a.has(c);if(p.length>0&&(t||p.length>=l))return;let r=!1,s=null,n=async()=>{let a=await m();if(a&&!r){try{let t=await d(e,a);r||h({sessionId:e,frames:t})}catch(e){t&&console.warn("Failed to load agent preview frames:",e)}r||t||(s=window.setTimeout(n,2e3))}};return n(),()=>{r=!0,null!==s&&window.clearTimeout(s)}},[u,l,m,p.length,e,c]),p.length>0)?p:x.sessionId===e?x.frames:e&&i.get(e)||n}e.s(["useAgentPreviewFrames",()=>c],961663);var u=e.i(670578);let m=new Set(["completed","cancelled","error"]),p=[],x=new Map,h=new Map;function g(e){return[...e].sort((e,t)=>e.step_number-t.step_number)}async function f(e,t){let r=h.get(e);if(r)return r;let a=(0,s.getAgentSteps)(e,t).then(t=>{let r=g(t.map(u.mapAgentStepRecord));return x.set(e,r),r}).finally(()=>{h.delete(e)});return h.set(e,a),a}function b({sessionId:e,initialSteps:s=p,expectedStepCount:a=0,status:n,enabled:i=!0}){let{getAccessToken:l}=(0,r.useAuth)(),o=(0,t.useMemo)(()=>g(s),[s]),[d,c]=(0,t.useState)(()=>({sessionId:e,steps:e&&x.get(e)||[]}));return((0,t.useEffect)(()=>{if(!i||!e)return;let t=!!n&&m.has(n);if(o.length>0&&(t||o.length>=a))return;let r=!1,s=null,d=async()=>{let a=await l();if(a&&!r){try{let t=await f(e,a);r||c({sessionId:e,steps:t})}catch(e){t&&console.warn("Failed to load agent preview steps:",e)}r||t||(s=window.setTimeout(d,2e3))}};return d(),()=>{r=!0,null!==s&&window.clearTimeout(s)}},[i,a,l,o.length,e,n]),o.length>0)?o:d.sessionId===e?d.steps:e&&x.get(e)||p}e.s(["useAgentPreviewSteps",()=>b],506363)},860564,e=>{"use strict";var t=e.i(271645);function r(e={}){let{prefetchRootMargin:s="400px 0px",playThreshold:a=.6}=e,n=(0,t.useRef)(null),[i,l]=(0,t.useState)(!1),[o,d]=(0,t.useState)(!1);return(0,t.useEffect)(()=>{let e=n.current;if(!e)return;let t=new IntersectionObserver(([e])=>{l(e.isIntersecting)},{rootMargin:s,threshold:0}),r=new IntersectionObserver(([e])=>{d(e.isIntersecting&&e.intersectionRatio>=a)},{threshold:[0,a]});return t.observe(e),r.observe(e),()=>{t.disconnect(),r.disconnect()}},[a,s]),{containerRef:n,isNearViewport:i,isVisible:o}}e.s(["useSocialAutoplayVisibility",()=>r])},294131,43188,903573,e=>{"use strict";var t=e.i(271645);function r(e,s={}){let{preloadAhead:a=5,preloadBehind:n=2,preloadAll:i=!1}=s,[l,o]=(0,t.useState)(new Map),[d,c]=(0,t.useState)(new Set),[u,m]=(0,t.useState)(new Set),[p,x]=(0,t.useState)(!1),h=(0,t.useRef)(!1),g=(0,t.useRef)(null),f=(0,t.useRef)(new Map),b=(0,t.useRef)(l),v=(0,t.useRef)(d);(0,t.useEffect)(()=>{b.current=l},[l]),(0,t.useEffect)(()=>{v.current=d},[d]);let j=(0,t.useMemo)(()=>{let t=new Map;
1return e.forEach(e=>t.set(e.frameIndex,e.imageUrl)),t},[e]),w=(0,t.useRef)(j);(0,t.useEffect)(()=>{w.current=j},[j]);let y=(0,t.useCallback)(async(e,t)=>{let r=w.current.get(e);if(r&&!(b.current.has(e)||v.current.has(e))){c(t=>t.has(e)?t:new Set([...t,e]));try{let s=await fetch(r,{signal:t,cache:"force-cache"});if(!s.ok)throw Error("Failed to fetch");let a=await s.blob(),n=URL.createObjectURL(a);f.current.set(e,n),o(t=>new Map(t).set(e,n)),m(t=>new Set([...t,e])),c(t=>{let r=new Set(t);return r.delete(e),r})}catch(t){if(t instanceof Error&&"AbortError"===t.name)return;console.warn(`Failed to preload frame ${e}:`,t),c(t=>{let r=new Set(t);return r.delete(e),r})}}},[]),k=(0,t.useCallback)(e=>{let t=[];for(let r=0;r<=a;r++){let s=e+r;w.current.has(s)&&t.push(s)}for(let r=1;r<=n;r++){let s=e-r;w.current.has(s)&&t.push(s)}t.sort((t,r)=>Math.abs(t-e)-Math.abs(r-e)),t.forEach(e=>y(e))},[a,n,y]),N=(0,t.useCallback)(()=>{g.current?.abort(),g.current=new AbortController;let e=g.current.signal,t=Array.from(w.current.keys()).sort((e,t)=>e-t),r=async s=>{if(e.aborted)return;let a=t.slice(s,s+6);await Promise.all(a.map(t=>y(t,e))),s+6<t.length&&!e.aborted&&setTimeout(()=>r(s+6),30)};r(0)},[y]),A=(0,t.useCallback)(e=>{let t=b.current.get(e);return t||(v.current.has(e)||b.current.has(e)||queueMicrotask(()=>{v.current.has(e)||b.current.has(e)||y(e)}),w.current.get(e)||"")},[y]),_=(0,t.useCallback)(e=>u.has(e),[u]),S=(0,t.useMemo)(()=>0===e.length?100:Math.round(u.size/e.length*100),[e.length,u.size]),M=(0,t.useRef)(e.length),C=(0,t.useRef)(p);return(0,t.useEffect)(()=>{C.current=p},[p]),(0,t.useEffect)(()=>{let t=M.current!==e.length;if(M.current=e.length,0===e.length){C.current||x(!0),h.current=!1;return}(!h.current||t)&&(h.current=!0,i?N():k(0))},[e.length,i,N,k]),(0,t.useEffect)(()=>{if(0===e.length)C.current||x(!0);else if(i){let t=u.size===e.length;C.current!==t&&x(t)}else{let e=u.size>0;C.current!==e&&x(e)}},[e.length,u.size,i]),(0,t.useEffect)(()=>{let t=new Set(e.map(e=>e.frameIndex));return f.current.forEach((e,r)=>{t.has(r)||(URL.revokeObjectURL(e),f.current.delete(r))}),()=>{0===e.length&&(g.current?.abort(),f.current.forEach(e=>URL.revokeObjectURL(e)),f.current.clear())}},[e]),{getFrameUrl:A,isFrameLoaded:_,preloadAroundIndex:k,preloadAllFrames:N,loadingProgress:S,loadedCount:u.size,totalCount:e.length,isReady:p}}e.s(["useFrameCache",()=>r],294131);let s=new Set(["click_at","double_click_at","right_click_at","drag","drag_and_drop","move_mouse"]),a=new Set(["dom","accessibility","ocr","semantic"]),n=new Set(["vswarm.element_ref","selector","text","coordinate","dom","accessibility","ocr","semantic"]);function i(e){if(!e||"object"!=typeof e)return null;let t=Number(e.x),r=Number(e.y),s=Number(e.width),a=Number(e.height);return![t,r,s,a].every(Number.isFinite)||s<=0||a<=0?null:{x:t,y:r,width:s,height:a}}function l(e){let t=i(e);return t?`${Math.round(t.x)},${Math.round(t.y)} ⢠${Math.round(t.width)}x${Math.round(t.height)}`:null}function o(e){return e&&"object"==typeof e?Object.entries(e).filter(([,e])=>"number"==typeof e&&Number.isFinite(e)).map(([e,t])=>[e.replace(/_ms$/,"").replace(/_/g," "),`${Math.round(10*t)/10} ms`]):[]}function d(e){if("string"!=typeof e||!e.trim())return null;try{let t=new URL(e,"http://evalarena.invalid");t.hash="";let r=t.href.replace(/\/$/,"");return"http://evalarena.invalid"===t.origin?t.pathname.replace(/\/$/,""):r}catch{return e.trim().replace(/\/$/,"")}}function c(e){let t=Number(e);return Number.isFinite(t)?t:null}function u(e,t){var r;let l,o,u,m=String(e.actionKind||e.target?.action_kind||e.function_name||""),p=function(e){let t=e.visualAnnotation;if(!t||"object"!=typeof t)return null;let r="string"==typeof t.kind?t.kind:"",s=c(t.x),a=c(t.y),n=i(t.bounds),l=s??(n?n.x+n.width/2:null),o=a??(n?n.y+n.height/2:null);if(null===l||null===o)return null;let d="string"==typeof t.direction?t.direction:null,u="string"==typeof t.label?t.label:null,m="string"==typeof t.snippet?t.snippet:null,p="string"==typeof t.heading?t.heading:null;return{x:l,y:o,stepNumber:e.step_number,target:e.target||null,bounds:n,variant:"scroll"===r?"scroll":"evidence",coordinateSpace:"screen"===t.coordinate_space||"normalized"===t.coordinate_space?t.coordinate_space:"browser_viewport",actionKind:e.actionKind||e.function_name,resolved:"boolean"==typeof e.target?.resolved?e.target.resolved:null,success:e.success,direction:d,label:u,detail:m||p,noOp:"boolean"==typeof t.no_op?t.no_op:null,boundary:"boolean"==typeof t.boundary?t.boundary:null,fallbackUsed:"boolean"==typeof t.fallback_used?t.fallback_used:null,offscreen:"boolean"==typeof t.offscreen?t.offscreen:null}}(e);if(p)return p;if("scroll"===e.function_name||"scroll_document"===e.function_name||"scroll_at"===e.function_name){let t=function(e){if(!e.scroll||"object"!=typeof e.scroll)return null;let t=e.scroll.pointer&&"object"==typeof e.scroll.pointer?e.scroll.pointer:null,r=c(t?.x),s=c(t?.y);if(null===r||null===s)return null;let a=Math.round(Math.max(Math.abs(c(e.scroll.actual_delta_y)??0),Math.abs(c(e.scroll.actual_delta_x)??0))),n="string"==typeof e.scroll.actual_direction&&"none"!==e.scroll.actual_direction?e.scroll.actual_direction:"string"==typeof e.scroll.requested_direction?e.scroll.requested_direction:null,l=!0===e.scroll.no_op||a<2,o=!0===e.scroll.boundary;return{x:r,y:s,stepNumber:e.step_number,target:e.target||null,bounds:i(e.scroll.container&&"object"==typeof e.scroll.container?e.scroll.container.bounds:null),variant:"scroll",coordinateSpace:"browser_viewport",actionKind:e.actionKind||e.function_name,resolved:"boolean"==typeof e.target?.resolved?e.target.resolved:null,success:e.success,direction:n,label:o?`Scroll ${n||""}
1: boundary`:l?`Scroll ${n||""}: no movement`:`Scroll ${n||""}: ${a}px`,noOp:l,boundary:o,fallbackUsed:!0===e.scroll.fallback_used}}(e);if(t)return t}if("find_text"===e.function_name||"extract_page"===e.function_name||"extract_section"===e.function_name||"extract_text"===e.function_name){let t=function(e){let t=e.findText||e.extractSection||e.extractPage;if(!t||"object"!=typeof t)return null;let r=Array.isArray(t.matches)&&t.matches[0]&&"object"==typeof t.matches[0]?t.matches[0]:null,s=i(r?.bounds)||i(t.bounds);if(!s)return null;let a=e.function_name,n="string"==typeof t.query?t.query:void 0,l="string"==typeof t.heading?t.heading:void 0,o="find_text"===a?`Find: ${n||r?.match_text||"text"}`:"extract_section"===a?`Extract: ${l||"section"}`:"Extract page",d="string"==typeof r?.context?r.context:"string"==typeof t.snippet?t.snippet:void 0;return{x:s.x+s.width/2,y:s.y+s.height/2,stepNumber:e.step_number,target:e.target||null,bounds:s,variant:"evidence",coordinateSpace:"browser_viewport",actionKind:e.actionKind||e.function_name,resolved:null,success:e.success,label:String(o),detail:d,offscreen:r?.in_viewport===!1}}(e);if(t)return t}if((s.has(e.function_name)||(Array.isArray(e.lowLevelActions)?e.lowLevelActions:[]).some(e=>("string"==typeof e?.name?e.name:"").startsWith("pointer.")))&&e.args?.x!==void 0&&e.args?.y!==void 0){let t=Number(e.args.x),r=Number(e.args.y);if(Number.isFinite(t)&&Number.isFinite(r))return{x:t,y:r,stepNumber:e.step_number,target:e.target||null,bounds:i(e.target?.bounds),variant:"pointer",coordinateSpace:e.args?.normalized===!1?"screen":"normalized",actionKind:m,resolved:"boolean"==typeof e.target?.resolved?e.target.resolved:null,success:e.success}}if(!e.target||!1===e.target.resolved||!function(e,t){if(!e||!t)return!0;let r=String(e.source||e.resolved_by||""),s=!!(e.element_ref||"vswarm.element_ref"===r||"element_ref"===r),a="string"==typeof e.observation_id?e.observation_id:null,n="string"==typeof t.observationId?t.observationId:null;if(a&&n){if(a===n)return!0;if(t.strictObservationId)return!1}if(s){let r=d(e.source_url||e.page_url),s=d(t.url);return r&&s?r===s:!a&&!n}let i=d(e.source_url||e.page_url),l=d(t.url);return!i||!l||i===l}(e.target,t))return null;let x=String(e.routerChannel||e.target.source||"");if(!(n.has(x)||a.has(x)))return null;let h=i(e.target.bounds)||i(e.target.screen_bounds),g=e.target.center&&"object"==typeof e.target.center?e.target.center:null,f=(r=e.target,l=r?.raw_refs,"screen"===(o=r?.coordinate_space||r?.coordinateSpace||(l&&"object"==typeof l?l:null)?.coordinate_space)||"browser_viewport"===o||"normalized"===o?o:r?.source==="dom"?"browser_viewport":"screen"),b="fill"===(u=(m||e.function_name).toLowerCase())||"type_selector"===u||"type_text_at"===u||"select"===u||"select_option"===u?"field":"press"===u||"key_combination"===u?"focus":u.includes("click")||"hover"===u||"drag"===u||"drag_and_drop"===u?"pointer":"semantic";if(h)return{x:h.x+h.width/2,y:h.y+h.height/2,stepNumber:e.step_number,target:e.target,bounds:h,variant:b,coordinateSpace:f,actionKind:m,resolved:"boolean"==typeof e.target.resolved?e.target.resolved:null,success:e.success};if(g&&"number"==typeof g.x&&"number"==typeof g.y)return{x:g.x,y:g.y,stepNumber:e.step_number,target:e.target,bounds:null,variant:b,coordinateSpace:f,actionKind:m,resolved:"boolean"==typeof e.target.resolved?e.target.resolved:null,success:e.success};let v=Number(e.target.x),j=Number(e.target.y);return Number.isFinite(v)&&Number.isFinite(j)?{x:v,y:j,stepNumber:e.step_number,target:e.target,bounds:null,variant:b,coordinateSpace:f,actionKind:m,resolved:"boolean"==typeof e.target.resolved?e.target.resolved:null,success:e.success}:null}function m(e,t){for(let r of[...e].reverse()){let e=u(r,t);if(e)return e}return null}e.s(["actionAnnotationForStep",()=>u,"formatBounds",()=>l,"formatTimingEntries",()=>o,"latestFrameAnnotationForSteps",()=>m],43188);var p=e.i(843476),x=e.i(846932),h=e.i(88653),g=e.i(549838);e.s(["CUAClickAnnotation",0,({x:e,y:r,containerRef:s,viewportWidth:a=999,viewportHeight:n=999,label:i,detail:l,source:o,bounds:d,variant:c="pointer",coordinateSpace:u="normalized",actionKind:m=null,resolved:f=null,success:b=null,direction:v=null,noOp:j=null,boundary:w=null,fallbackUsed:y=null,offscreen:k=null,compact:N=!1})=>{let[A,_]=(0,t.useState)(null),S=(0,t.useRef)(null);if((0,t.useEffect)(()=>{let t=()=>{if(!s.current)return;let t=s.current,i=t.querySelector("img");if(!i)return;let l=i.getBoundingClientRect(),o=t.getBoundingClientRect(),d=l.left-o.left,m=l.top-o.top,p="normalized"===u||"browser_viewport"===u&&999!==a?a:i.naturalWi
1dth||a,x="normalized"===u||"browser_viewport"===u&&999!==n?n:i.naturalHeight||n;if(!Number.isFinite(p)||!Number.isFinite(x)||p<=0||x<=0)return void _(null);let h=l.width/p,g=l.height/x,f=e*h+d,b=r*g+m;_({left:"evidence"===c&&k?Math.min(Math.max(f,d+24),d+l.width-24):f,top:"evidence"===c&&k?r<0?m+24:m+l.height-24:b,scaleX:h,scaleY:g})};t();let i=window.requestAnimationFrame(t);s.current&&(S.current=new ResizeObserver(t),S.current.observe(s.current));let l=s.current?.querySelector("img")??null;return l?.addEventListener("load",t),window.addEventListener("resize",t),()=>{window.cancelAnimationFrame(i),l?.removeEventListener("load",t),S.current?.disconnect(),window.removeEventListener("resize",t)}},[e,r,s,a,n,u,c,k]),!A)return null;let M=(m||"").toLowerCase(),C="scroll"===c,T="evidence"===c,I="field"===c||"fill"===M||"select"===M||"select_option"===M,z="focus"===c||"press"===M,U=!1===b||!1===f||!0===j||!0===w,$=U?"border-amber-100 bg-amber-500":T?"border-emerald-100 bg-emerald-500":I?"border-cyan-100 bg-cyan-500":z?"border-violet-100 bg-violet-500":"border-blue-200 bg-blue-500",P=i?`${o?`${o}: `:""}${i}`:m?`${o?`${o}: `:""}${m}`:"pointer"===c?`(${Math.round(e)}, ${Math.round(r)})`:"target",F="up"===v?180:"left"===v?90:"right"===v?-90:0,L=U?"#f59e0b":"#38bdf8",E=N?20:32,R=E/32,D={x:7.33*R,y:4.28*R},O="pointer"===c?{left:D.x,top:D.y}:{left:"50%",top:"50%"};return(0,p.jsx)(h.AnimatePresence,{children:(0,p.jsxs)(x.motion.div,{initial:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:{scale:0,opacity:0},transition:{duration:.2,ease:"easeOut"},className:"absolute pointer-events-none z-20",style:{left:A.left,top:A.top,transform:"pointer"===c?`translate(${-D.x}px, ${-D.y}px)`:"translate(-50%, -50%)"},children:[d&&"number"==typeof d.x&&"number"==typeof d.y&&"number"==typeof d.width&&"number"==typeof d.height&&(0,p.jsx)("div",{className:(0,g.cn)("absolute rounded shadow-[0_0_0_1px_rgba(0,0,0,0.25)]",N?"border":"border-2",U?"border-amber-400/90 bg-amber-500/10":T?"border-emerald-400/90 bg-emerald-500/10":I?"border-cyan-400/90 bg-cyan-500/10":z?"border-violet-400/90 bg-violet-500/10":"border-blue-400/80 bg-blue-500/10"),style:{left:(d.x-e)*A.scaleX,top:(d.y-r)*A.scaleY,width:Math.max(N?4:6,d.width*A.scaleX),height:Math.max(N?4:6,d.height*A.scaleY)}}),C?(0,p.jsxs)("div",{className:(0,g.cn)("relative flex items-center justify-center",N?"h-12 w-8":"h-24 w-16"),children:[(0,p.jsx)(x.motion.div,{className:(0,g.cn)("absolute rounded-full border",N?"h-10 w-4":"h-20 w-8",U?"border-amber-400/70 bg-amber-500/10":"border-sky-400/70 bg-sky-500/10"),initial:{opacity:.25,scaleY:.85},animate:{opacity:[.25,.65,.25],scaleY:[.85,1,.85]},transition:{duration:1.2,repeat:1/0,ease:"easeInOut"},style:{transform:`rotate(${F}deg)`}}),(0,p.jsxs)(x.motion.svg,{width:N?24:44,height:N?38:72,viewBox:"0 0 44 72",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"drop-shadow-lg",style:{transform:`rotate(${F}deg)`},initial:{y:-8,opacity:.9},animate:{y:[w||j?0:-8,w||j?0:8,w||j?0:-8]},transition:{duration:1.1,repeat:1/0,ease:"easeInOut"},children:[(0,p.jsx)("path",{d:"M22 8v42",stroke:L,strokeWidth:"5",strokeLinecap:"round"}),(0,p.jsx)("path",{d:"M10 42l12 14 12-14",stroke:L,strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"})]})]}):"pointer"===c?(0,p.jsxs)("svg",{width:E,height:E,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"drop-shadow-lg",children:[(0,p.jsx)("defs",{children:(0,p.jsxs)("filter",{id:"glow",x:"-50%",y:"-50%",width:"200%",height:"200%",children:[(0,p.jsx)("feGaussianBlur",{stdDeviation:"2",result:"coloredBlur"}),(0,p.jsxs)("feMerge",{children:[(0,p.jsx)("feMergeNode",{in:"coloredBlur"}),(0,p.jsx)("feMergeNode",{in:"SourceGraphic"})]})]})}),(0,p.jsx)("path",{d:"M5.5 3.21V20.8l4.45-4.19 3.13 6.93 2.66-1.21-3.13-6.93h5.89L5.5 3.21z",fill:"white",stroke:"#3B82F6",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",filter:"url(#glow)"})]}):T?N?(0,p.jsx)("div",{className:(0,g.cn)("size-2 rounded-full border shadow-lg",$)}):(0,p.jsx)("div",{className:(0,g.cn)("rounded-full border px-2.5 py-1 text-[11px] font-medium shadow-lg backdrop-blur",U?"border-amber-300 bg-amber-950/70 text-amber-100":"border-emerald-300/80 bg-emerald-950/75 text-emerald-100"),children:k?"DOM evidence offscreen":"DOM evidence"}):(0,p.jsx)("div",{className:(0,g.cn)("rounded-full shadow-lg",N?"size-2 border":"size-2.5 border-2",$)}),("pointer"===c||"click"===M||"double_click"===M)&&(0,p.jsx)(x.motion.div,{className:(0,g.cn)("absolute rounded-full border-2",U?"border-amber-500":"border-blue-500"),initial:{scale:.5,op
1acity:.8},animate:{scale:[.5,1.5,2],opacity:[.8,.4,0]},transition:{duration:1,repeat:1/0,repeatDelay:.5,ease:"easeOut"},style:{top:O.top,left:O.left,transform:"translate(-50%, -50%)",width:N?16:24,height:N?16:24}}),!N&&(0,p.jsxs)("div",{className:(0,g.cn)("absolute left-0 max-w-[280px] rounded bg-black/75 px-2 py-1 text-xs text-white shadow-lg backdrop-blur",T?"top-9 whitespace-normal font-sans leading-snug":"top-8 whitespace-nowrap font-mono",C&&"top-20"),style:{transform:"pointer"===c?"translateX(-25%)":"translateX(-50%)"},children:[P,y&&(0,p.jsx)("span",{className:"ml-1 text-sky-200",children:"fallback"}),l&&T&&(0,p.jsx)("div",{className:"mt-0.5 line-clamp-2 text-[11px] text-white/70",children:l})]})]})})}],903573)},49432,955089,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(531278),a=e.i(294131),n=e.i(961663),i=e.i(506363),l=e.i(860564),o=e.i(549838);function d(e,t){let r=e<=8?650:e<=16?520:420;return"viewport-loop"===t?Math.round(1.6*r):r}e.s(["getAgentFrameIntervalMs",()=>d],955089);var c=e.i(43188),u=e.i(903573);let m=[],p=[],x=({frames:e,steps:n,mode:i,synchronizedFrameIndex:l,showActionTargets:m,isNearViewport:p,isVisible:x,prefersReducedMotion:h,isTerminal:g,alt:f,className:b,imageClassName:v,containerRef:j})=>{let w=(0,r.useMemo)(()=>e.map(e=>({frameIndex:e.frameIndex,imageUrl:e.imageUrl})),[e]),{getFrameUrl:y,preloadAroundIndex:k,preloadAllFrames:N,isReady:A}=(0,a.useFrameCache)(w,{preloadAhead:6,preloadBehind:3,preloadAll:!1}),[_,S]=(0,r.useState)(0),M=e.length<=18,C=g||"live"!==i?void 0!==l?Math.min(Math.max(0,l),Math.max(0,e.length-1)):Math.min(_,Math.max(0,e.length-1)):Math.max(0,e.length-1);(0,r.useEffect)(()=>{p&&0!==e.length&&(M?N():k(C))},[C,e.length,p,N,k,M]);let T=void 0===l&&!h&&A&&e.length>1&&("viewport-loop"===i?x:g||"autoplay-once"===i);(0,r.useEffect)(()=>{if(!T||"viewport-loop"!==i&&_>=e.length-1)return;let t=window.setTimeout(()=>{S(t=>"viewport-loop"===i?(t+1)%e.length:Math.min(t+1,e.length-1))},d(e.length,i));return()=>window.clearTimeout(t)},[_,e.length,i,T]);let I=e[C]||e[0],z=I?y(I.frameIndex):null,U=(0,r.useMemo)(()=>{if(!m||!I)return null;let e=n.find(e=>e.step_number===I.stepNumber);return e?(0,c.actionAnnotationForStep)({...e,url:e.url||void 0,error:e.error||void 0},{observationId:null,url:I.url}):null},[I,m,n]);return(0,t.jsxs)("div",{ref:j,className:(0,o.cn)("relative flex h-full w-full items-center justify-center overflow-hidden bg-black",b),children:[z?(0,t.jsx)("img",{src:z,alt:f,className:(0,o.cn)("h-full w-full object-contain",v),loading:"lazy"}):(0,t.jsxs)("div",{className:"flex h-full w-full items-center justify-center gap-2 text-xs text-white/55",role:"status",children:[(0,t.jsx)(s.Loader2,{size:16,className:"animate-spin"}),(0,t.jsx)("span",{children:"Waiting for agent frames..."})]}),z&&U&&(0,t.jsx)(u.CUAClickAnnotation,{x:U.x,y:U.y,containerRef:j,label:U.label||String(U.target?.name||U.target?.text||U.target?.label||"")||void 0,detail:U.detail||null,source:"string"==typeof U.target?.source?U.target.source:void 0,bounds:U.bounds||null,variant:U.variant,coordinateSpace:U.coordinateSpace,actionKind:U.actionKind,resolved:U.resolved,success:U.success,direction:U.direction||null,noOp:U.noOp||null,boundary:U.boundary||null,fallbackUsed:U.fallbackUsed||null,offscreen:U.offscreen||null,compact:!0})]})};e.s(["AgentFramePlayback",0,({sessionId:e,frames:s=m,steps:a=p,expectedFrameCount:o=0,expectedStepCount:d=0,status:c,mode:u="autoplay-once",synchronizedFrameIndex:h,showActionTargets:g=!0,alt:f="Agent session replay",className:b,imageClassName:v})=>{let{containerRef:j,isNearViewport:w,isVisible:y}=(0,l.useSocialAutoplayVisibility)({prefetchRootMargin:"400px 0px",playThreshold:.55}),k=function(){let[e,t]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{if("function"!=typeof window.matchMedia)return;let e=window.matchMedia("(prefers-reduced-motion: reduce)"),r=()=>t(e.matches);return r(),e.addEventListener("change",r),()=>e.removeEventListener("change",r)},[]),e}(),N=(0,n.useAgentPreviewFrames)({sessionId:e,initialFrames:s,expectedFrameCount:o,status:c,enabled:"viewport-loop"!==u||w}),A=(0,i.useAgentPreviewSteps)({sessionId:e,initialSteps:a,expectedStepCount:d,status:c,enabled:g&&("viewport-loop"!==u||w)}),_="completed"===c||"cancelled"===c||"error"===c,S="live"!==u||_?"replay":"live";return(0,t.jsx)(x,{frames:N,steps:A,mode:u,synchronizedFrameIndex:k?0:h,showActionTargets:g,isNearViewport:w,isVisible:y,prefersReducedMotion:k,isTerminal:_,alt:f,className:b,imageClassName:v,containerRef:j},`${e||"embedded"}:${u}:${S}`)}],49432)},840789,e=>{"use strict";var t=e.i(843476),r=e.i(271645),s=e.i(549838),a=e.i(929899),n=e.i(531278),i=e.i(595468),l=e.i(373884),o=e.i(167506),d=e.i(551397),c=e.i(320202),u=e.i(128439),m=e.i(114532),p=e.i(49432),x=e.i(698125);let h=r.default.memo(({response:e,model:h,liveSession:g=null,onClick:f,isActive:b=!1,compactArtifact:v=!1,compactPreview:j=!1,videoPlayback:w="manual",agentPlaybackFrameIndex:y})=>{let k=g?.status??e.agentStatus,N=g?Math.max(g.currentStep,e.currentStep??0):e.currentStep,A=g?.maxSteps||e.maxSteps,_=(0,u.getMultiModelResponseDisplayState)(e),S=e.isAgentSession?e.status:_.status,M="pending"===S||"streaming"===S,C=(0,c.useLiveElapsedTime)(M,e.startTime,g?.elapsedTimeMs!==void 0),T=e.elapsedTime??(e.startTime&&e.endTime?Math.max(0,e.endTime-e.startTime):void 0),I=g?.elapsedTimeMs??(M?C:T),z=()=>{if(e.isAgentSession&&k)switch(k){case"initializing":case"running":return(0,t.jsx)(n.Loader2,{size:16,className:"text-blue-500 animate-spin"});case"waiting_confirmation":return(0,t.jsx)(n.Loader2,{size:16,className:"text-yellow-500 animate-spin"});case"completed":return(0,t.jsx)(i.CheckCircle2,{size:16,className:"text-green-500"});case"cancelled":return(0,t.jsx)(l.XCircle,{size:16,className:"text-orange-500"});case"error":return(0,t.jsx)(l.XCircle,{size:16,className:"text-red-500"})}
1switch(S){case"pending":return(0,t.jsx)(n.Loader2,{size:16,className:"text-muted-foreground animate-spin"});case"streaming":return(0,t.jsx)(n.Loader2,{size:16,className:"text-blue-500 animate-spin"});case"completed":return(0,t.jsx)(i.CheckCircle2,{size:16,className:"text-green-500"});case"error":if("Stopped by user"===_.error||"Stopped by user"===e.error)return(0,t.jsx)(l.XCircle,{size:16,className:"text-orange-500"});return(0,t.jsx)(l.XCircle,{size:16,className:"text-red-500"})}},U=()=>{if(e.isAgentSession&&k)switch(k){case"initializing":return"Initializing...";case"running":let t=N&&A?` (${N}/${A})`:"";return`Running${t}`;case"waiting_confirmation":return"Waiting for confirmation";case"completed":return"Agent Completed";case"cancelled":return"Cancelled";case"error":return"Agent Error"}return _.label},$=null!=I?(0,o.formatMilliseconds)(I,2*!j):null,P=(0,d.getDisplayModelName)(h?.name,e.modelId),F=h?.creator||e.modelCreator||(0,d.inferModelCreatorFromId)(e.modelId),{status:L,isAgentSession:E,content:R,editedCodeContent:D,imageArtifact:O,videoArtifact:V,audioArtifact:B,musicArtifact:G}=e,q=r.default.useMemo(()=>(0,u.getInlineMultiModelArtifact)({status:L,isAgentSession:E,content:R,editedCodeContent:D,imageArtifact:O,videoArtifact:V,audioArtifact:B,musicArtifact:G}),[L,E,R,D,O,V,B,G]),H=!!(e.isAgentSession&&(e.sessionId||e.sharedAgentTrace?.sessionId)),W=!!(q||H||e.imageArtifact||e.videoArtifact||e.audioArtifact||e.musicArtifact),K=j&&(W||"completed"===S||"error"===S),X=K&&"error"===S,J=_.error||e.error,Y=!!(e.videoArtifact&&"streaming"===S&&null!=I&&I>=3e5),Z=!!(q&&"html"!==q.kind),Q=(0,s.cn)("flex w-full text-left outline-none",!Z&&"cursor-pointer focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary/50",K?"items-center gap-2 p-2":"items-start gap-3",q&&!K?"p-3":q||K?void 0:"p-4"),ee=(0,t.jsxs)(t.Fragment,{children:[!j&&(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("div",{className:(0,s.cn)("flex items-center justify-center rounded-full border border-neutral-200 bg-neutral-100 font-bold text-neutral-700 shadow-sm dark:border-neutral-700 dark:bg-neutral-800 dark:text-neutral-300",K?"size-6 text-xs":"size-8 text-sm"),children:e.orderNumber})}),(0,t.jsxs)("div",{className:(0,s.cn)("min-w-0 text-left",K?"flex flex-1":"flex-1"),children:[(0,t.jsxs)("div",{className:(0,s.cn)("flex items-center gap-2",K?"min-w-0 flex-1":"mb-1"),children:[F?(0,t.jsx)("div",{className:(0,s.cn)("relative shrink-0",K?"size-4":"size-5"),children:(0,t.jsx)(a.ProviderLogo,{alt:F,creator:F,className:"h-full w-full"})}):null,(0,t.jsx)("span",{className:"truncate text-sm font-semibold text-foreground",children:P})]}),!K&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"mt-1.5 flex items-center gap-2 text-xs",children:[z(),(0,t.jsx)("span",{className:"text-muted-foreground",children:U()})]}),Y&&(0,t.jsx)("div",{className:"mt-1 text-[11px] leading-4 text-amber-600 dark:text-amber-400",children:"Taking longer than usual. You can leave this chat; generation will continue."}),"error"===S&&J&&"Stopped by user"!==J&&(0,t.jsx)("div",{className:"mt-2 line-clamp-2 text-xs text-red-600 dark:text-red-400",children:J})]})]}),(0,t.jsxs)("div",{className:"flex flex-shrink-0 items-center gap-2",children:[$&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground",children:(0,t.jsx)("span",{className:"font-mono",children:$})}),!K&&e.metrics&&(0,t.jsx)(x.ResponseMetrics,{metrics:e.metrics,align:"right",interactive:!1}),K&&"error"===S&&(0,t.jsx)("span",{className:"flex size-4 items-center justify-center",title:U(),"aria-label":U(),children:z()})]})]});return(0,t.jsxs)("article",{onClick:Z&&!j?e=>e.stopPropagation():void 0,className:(0,s.cn)("group/response w-full overflow-hidden text-left transition-colors duration-200",!X&&"h-full",j?"rounded-none border-0 bg-transparent":"rounded-xl border bg-white hover:border-neutral-300 hover:shadow-sm dark:bg-neutral-900 dark:hover:border-neutral-700",!j&&(b?"border-neutral-400 shadow-sm ring-1 ring-neutral-300 dark:border-neutral-600 dar
1k:ring-neutral-700":"border-neutral-200 dark:border-neutral-800"),!j&&"error"===S&&"Stopped by user"===J&&"border-orange-200 dark:border-orange-900/50",!j&&"error"===S&&"Stopped by user"!==J&&"border-red-200 dark:border-red-900"),children:[Z?(0,t.jsx)("div",{className:Q,children:ee}):(0,t.jsx)("button",{type:"button",onClick:f,"aria-label":`Open response from ${P}`,className:Q,children:ee}),q&&!X&&(0,t.jsx)(m.MultiModelArtifactPreview,{artifact:q,responseId:e.responseId,messageId:e.messageId,modelId:e.modelId,compact:v,videoPlayback:w,socialPreview:j,onOpen:f}),H&&!X&&(0,t.jsx)("div",{className:(0,s.cn)("border-t border-border/70 bg-black",v?"h-52":"h-72"),onClick:e=>e.stopPropagation(),children:(0,t.jsx)(p.AgentFramePlayback,{sessionId:e.sessionId||e.sharedAgentTrace?.sessionId,frames:e.sharedAgentTrace?.frames,steps:e.sharedAgentTrace?.steps,expectedFrameCount:g?.frameCount??e.sharedAgentTrace?.frameCount??e.frameCount,expectedStepCount:N??e.sharedAgentTrace?.currentStep??e.currentStep,status:k||e.sharedAgentTrace?.status,mode:"viewport-loop"===w?"viewport-loop":"running"===k||"initializing"===k||"waiting_confirmation"===k?"live":"autoplay-once",synchronizedFrameIndex:y,alt:`${P} agent session replay`})})]})},(e,t)=>{if(e.response.status!==t.response.status||e.response.error!==t.response.error)return!1;let r=e.liveSession?.elapsedTimeMs??e.response.elapsedTime??0;return!(Math.abs((t.liveSession?.elapsedTimeMs??t.response.elapsedTime??0)-r)>100)&&e.isActive===t.isActive&&e.model?.id===t.model?.id&&e.compactArtifact===t.compactArtifact&&e.compactPreview===t.compactPreview&&e.videoPlayback===t.videoPlayback&&e.agentPlaybackFrameIndex===t.agentPlaybackFrameIndex&&(0,u.getInlineMultiModelArtifactSignature)(e.response)===(0,u.getInlineMultiModelArtifactSignature)(t.response)&&e.response.agentStatus===t.response.agentStatus&&e.response.currentStep===t.response.currentStep&&e.response.isAgentSession===t.response.isAgentSession&&e.liveSession?.status===t.liveSession?.status&&e.liveSession?.currentStep===t.liveSession?.currentStep&&e.liveSession?.frameCount===t.liveSession?.frameCount&&e.liveSession?.finalAnswer===t.liveSession?.finalAnswer&&e.response.sessionId===t.response.sessionId&&e.response.frameCount===t.response.frameCount&&e.response.sharedAgentTrace?.frames.length===t.response.sharedAgentTrace?.frames.length&&e.response.sharedAgentTrace?.frames.at(-1)?.imageUrl===t.response.sharedAgentTrace?.frames.at(-1)?.imageUrl&&e.response.sharedAgentTrace?.steps.length===t.response.sharedAgentTrace?.steps.length&&e.response.sharedAgentTrace?.steps.at(-1)?.step_number===t.response.sharedAgentTrace?.steps.at(-1)?.step_number&&!0});e.s(["MultiModelResponseBox",0,h])}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.