codex-mobile-re 0.1.136 → 0.1.138

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,25 @@
1
+ import{r as No,n as wo,a as ko,c as $,b as N,g as xa,o as $t,d as Ht,e as bo,f as Ct,h as ce,i as a,j as de,k as l,w as et,l as f,t as w,m as oe,p as I,T as qo,_ as se,u as c,F as q,q as z,s as He,v as te,I as Vo,x as $a,y as ct,z as Ce,A as pe,B as Se,C as Wo,D as _a,E as Ge,G as Ta,H as jo,J as cn,K as Ia,L as Co,M as Sa,N as Ma,O as La,P as Uo,Q as Ko,R as Aa,S as xo,U as Ie,V as $o,W as Fa,X as _o,Y as Pa,Z as Ea,$ as Ba,a0 as Da,a1 as To,a2 as Ra,a3 as Ha,a4 as Io,a5 as Oa,a6 as Na,a7 as So,a8 as qa,a9 as Va,aa as Wa,ab as ja,ac as Ua,ad as Ka,ae as Ga,af as za}from"./index-B7NhUyvj.js";import{s as an}from"./sanitizeHtml-Bd3No2dT.js";const Ya=30*60*1e3;function Xa(e,n){const s=new Date(e),r=new Date(n);return s.getFullYear()===r.getFullYear()&&s.getMonth()===r.getMonth()&&s.getDate()===r.getDate()}function Ja(e,n){return typeof n!="number"||!Number.isFinite(n)?!1:e==null||!Number.isFinite(e)||!Xa(e,n)?!0:n-e>=Ya}function Qa(e){const n=new Set;let s=null;for(const r of e){const m=r.timestampMs;typeof m!="number"||!Number.isFinite(m)||Ja(s,m)&&(n.add(r.key),s=m)}return n}function Za(e,n){const s=new Date(e),r=new Date(n),m=new Date(s.getFullYear(),s.getMonth(),s.getDate()).getTime(),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime();return Math.round((i-m)/864e5)}function Dt(e){return String(e).padStart(2,"0")}function ei(e,n={}){if(typeof e!="number"||!Number.isFinite(e))return"";const s=new Date(e);if(Number.isNaN(s.getTime()))return"";const r=n.translate??(p=>p),m=n.now??Date.now(),i=`${Dt(s.getHours())}:${Dt(s.getMinutes())}`,h=Za(e,m);if(h===0)return`${r("Today")} ${i}`;if(h===1)return`${r("Yesterday")} ${i}`;const u=`${Dt(s.getMonth()+1)}-${Dt(s.getDate())}`;return new Date(m).getFullYear()===s.getFullYear()?`${u} ${i}`:`${s.getFullYear()}-${u} ${i}`}const un=16;function xt(e){return Number.isFinite(e)?e:0}function Go(e){const n=xt(e.scrollHeightPx),s=xt(e.clientHeightPx);return Math.max(0,n-s)}function zo(e){const n=xt(e.scrollHeightPx)-xt(e.scrollTopPx)-xt(e.clientHeightPx);return Math.max(0,n)}function ti(e,n=un){const s=Number.isFinite(n)?n:un;return zo(e)<=s}function ni(e,n){return Number.isFinite(n)?Math.min(Go(e),Math.max(0,n)):0}function Mo(e,n){const s=Go(e),r=ni(e,n);return Math.min(s,Math.max(0,s-r))}function Rt(e){return{scrollHeightPx:e.scrollHeight,scrollTopPx:e.scrollTop,clientHeightPx:e.clientHeight}}const Yo={js:"javascript",jsx:"jsx",ts:"typescript",tsx:"tsx",py:"python",rb:"ruby",sh:"bash",shell:"bash",zsh:"bash",yml:"yaml",md:"markdown","c++":"cpp","c#":"csharp",ps1:"powershell"};function ye(e){return`${e.path}\0${e.movedToPath??""}`}function oi(e,n){return e?!n||e===n?e:`${e}
2
+ ${n}`.trim():n}function si(e,n){const s=e.operation==="add"||n.operation==="add"?"add":e.operation==="delete"||n.operation==="delete"?"delete":"update";return{path:n.path||e.path,operation:s,movedToPath:n.movedToPath??e.movedToPath??null,diff:oi(e.diff,n.diff),addedLineCount:e.addedLineCount+n.addedLineCount,removedLineCount:e.removedLineCount+n.removedLineCount}}function ai(e,n){const s=e.operation==="add"?0:e.operation==="update"?1:2,r=n.operation==="add"?0:n.operation==="update"?1:2;if(s!==r)return s-r;const m=`${e.path}\0${e.movedToPath??""}`,i=`${n.path}\0${n.movedToPath??""}`;return m.localeCompare(i)}function rn(e){const n=new Map;for(const s of e){const r=`${s.path}\0${s.movedToPath??""}`,m=n.get(r);n.set(r,m?si(m,s):{...s})}return Array.from(n.values()).sort(ai)}function mn(e,n){return e.operation==="update"&&e.movedToPath?e.addedLineCount>0||e.removedLineCount>0?n("Moved + edited"):n("Moved"):e.operation==="add"?n("Added"):e.operation==="delete"?n("Deleted"):n("Edited")}function ii(e){return e.operation==="update"&&e.movedToPath?"→":e.operation==="add"?"+":e.operation==="delete"?"−":"M"}function dn(e){return e.operation==="update"&&e.movedToPath?"move":e.operation}function Ze(e){const n=[];return e.addedLineCount>0&&n.push(`+${e.addedLineCount}`),e.removedLineCount>0&&n.push(`-${e.removedLineCount}`),n.join(" ")}function Xo(e,n,s=""){const r=[];return e>0&&r.push({tone:"add",label:`+${e}`}),n>0&&r.push({tone:"remove",label:`-${n}`}),r.length>0?r:s?[{tone:"neutral",label:s}]:[]}function ri(e){return Xo(e.addedLineCount,e.removedLineCount)}function Jo(e,n){return e===1?`1 ${n("file changed")}`:`${e} ${n("files changed")}`}function li(e,n){if(!e||e.changes.length===0)return"";let s=0,r=0,m=0,i=0;for(const u of e.changes){if(u.operation==="add"){s+=1;continue}if(u.operation==="delete"){r+=1;continue}if(u.movedToPath){i+=1;continue}m+=1}const h=[];return m>0&&h.push(`${m} ${n("edited")}`),s>0&&h.push(`${s} ${n("added")}`),r>0&&h.push(`${r} ${n("deleted")}`),i>0&&h.push(`${i} ${n("moved")}`),h.join(", ")}function ci(e,n){if(!e||e.changes.length===0)return n("Modified files");const s=Jo(e.changes.length,n),r=li(e,n);return r?`${s} · ${r}`:s}function ui(e){if(!e||e.changes.length===0)return[];const n=e.changes.reduce((m,i)=>m+i.addedLineCount,0),s=e.changes.reduce((m,i)=>m+i.removedLineCount,0),r=e.changes.some(m=>m.movedToPath)?"Moved":"Ready";return Xo(n,s,r)}function ut(e,n){const s=No(e,n),r=wo(ko(n.trim())),m=wo(ko(s));return r&&m.startsWith(`${r}/`)?m.slice(r.length+1):e}function di(e,n,s){if(!e||e.changes.length===0)return"";const r=e.changes.map(m=>{const i=ut(m.path,n),h=m.movedToPath?` -> ${ut(m.movedToPath,n)}`:"",u=Ze(m);return`- ${mn(m,s)}: ${i}${h}${u?` (${u})`:""}`});return`${s("Modified files")}:
3
+ ${r.join(`
4
+ `)}`.trim()}function fi(e){var r;const s=((r=(e.movedToPath||e.path).split(".").pop())==null?void 0:r.toLowerCase())??"";return Yo[s]??s??""}function mi(e){return e.operation==="update"&&/^diff --git |^@@ |^--- |^\+\+\+ |^[ +-]|^\*\*\* (Move to:|End of File)/mu.test(e.diff)}function hi(e){const n=e.diff.replace(/\r\n/g,`
5
+ `),s=n.length>0?n.split(`
6
+ `):[];return s.length>0&&s[s.length-1]===""&&s.pop(),s.map((r,m)=>({key:`${ye(e)}:synthetic:${m}`,kind:e.operation==="delete"?"remove":"add",oldLine:e.operation==="delete"?m+1:null,newLine:e.operation==="delete"?null:m+1,text:r}))}function gi(e){const n=e.diff.replace(/\r\n/g,`
7
+ `),s=n.length>0?n.split(`
8
+ `):[];s.length>0&&s[s.length-1]===""&&s.pop();const r=[];let m=0,i=0;for(const[h,u]of s.entries()){const p=u.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/u);if(p){m=Number(p[1]),i=Number(p[2]),r.push({key:`${ye(e)}:hunk:${h}`,kind:"hunk",oldLine:null,newLine:null,text:u});continue}if(u.startsWith("+")&&!u.startsWith("+++")){r.push({key:`${ye(e)}:add:${h}`,kind:"add",oldLine:null,newLine:i,text:u.slice(1)}),i+=1;continue}if(u.startsWith("-")&&!u.startsWith("---")){r.push({key:`${ye(e)}:remove:${h}`,kind:"remove",oldLine:m,newLine:null,text:u.slice(1)}),m+=1;continue}if(u.startsWith(" ")){r.push({key:`${ye(e)}:context:${h}`,kind:"context",oldLine:m,newLine:i,text:u.slice(1)}),m+=1,i+=1;continue}r.push({key:`${ye(e)}:meta:${h}`,kind:"meta",oldLine:null,newLine:null,text:u})}return r}function vi(e){return!e||!e.diff.trim()?[]:mi(e)?gi(e):hi(e)}function pi(e){return!!(e!=null&&e.diff.trim())}function yi(e){return e.kind==="add"?"+":e.kind==="remove"?"-":e.kind==="hunk"?"@@":""}function wi(e,n){if(e.size===0)return e;const s=new Set;for(const r of e)n.has(r)&&s.add(r);return s.size===e.size?e:s}function ki(e){const{getMessages:n,getLiveTurnId:s,isFileChangeMessage:r,isCopyableAssistantMessage:m,isReasoningMessage:i,isPlanMessage:h,isFoldMember:u,getHiddenGroupedCommandIds:p,isMobile:v}=e,S=N(new Set),y=N(null),F=N(""),M=N(!1),H=$(()=>{var he,$e;const D=new Map,G=new Map,we=new Map,xe=j=>!r(j)&&!i(j)&&!h(j)&&!p().has(j.id)&&!u(j);for(const j of n()){const _e=typeof j.turnIndex=="number"?`turn:${j.turnIndex}`:`message:${j.id}`;if(xe(j)&&D.set(_e,j.id),m(j)&&typeof j.turnIndex=="number"&&Array.isArray(j.fileChanges)&&j.fileChanges.length>0&&G.set(j.id,{changes:rn(j.fileChanges),sourceMessageIds:[],source:"assistant",turnId:j.turnId??""}),!r(j))continue;const Oe=we.get(_e);Oe?Oe.push(j):we.set(_e,[j])}const me={};for(const[j,_e]of we.entries()){const Oe=D.get(j);if(!Oe)continue;const _t=((he=G.get(Oe))==null?void 0:he.turnId)??"";me[Oe]={changes:rn(_e.flatMap(Ne=>Ne.fileChanges??[])),sourceMessageIds:_e.map(Ne=>Ne.id),source:"metadata",turnId:(($e=_e.find(Ne=>typeof Ne.turnId=="string"&&Ne.turnId.length>0))==null?void 0:$e.turnId)??_t}}for(const[j,_e]of G.entries())me[j]||(me[j]=_e);return me}),J=$(()=>{var xe;const D=new Map,G=new Set;for(const me of Object.values(H.value))for(const he of me.sourceMessageIds)G.add(he);for(const me of n()){if(!r(me))continue;const he=typeof me.turnIndex=="number"?`turn:${me.turnIndex}`:`message:${me.id}`,$e=D.get(he);$e?$e.push(me):D.set(he,[me])}const we={};for(const[me,he]of D.entries()){if(he.some(j=>G.has(j.id)))continue;const $e=he[he.length-1];$e&&(we[$e.id]={changes:rn(he.flatMap(j=>j.fileChanges??[])),sourceMessageIds:he.map(j=>j.id),source:"metadata",turnId:$e.turnId??((xe=he.find(j=>typeof j.turnId=="string"&&j.turnId.length>0))==null?void 0:xe.turnId)??""})}return we}),K=$(()=>{const D=new Set;for(const G of Object.values(H.value))for(const we of G.sourceMessageIds)D.add(we);for(const[G,we]of Object.entries(J.value))for(const xe of we.sourceMessageIds)xe!==G&&D.add(xe);return D}),P=$(()=>{var D;return((D=y.value)==null?void 0:D.changes)??[]}),C=$(()=>{const D=P.value;return D.length===0?null:D.find(G=>ye(G)===F.value)??D[0]}),L=$(()=>vi(C.value));function _(D){const G=new Set(S.value);G.has(D.id)?G.delete(D.id):G.add(D.id),S.value=G}function E(D){return S.value.has(D.id)}function B(D,G){D&&(y.value=D,F.value=ye(G),M.value=!1)}function b(){y.value=null,F.value="",M.value=!1}function Y(){M.value=!M.value}function V(){M.value=!1}function ve(D){F.value=ye(D),v()&&(M.value=!1)}function tt(D){return H.value[D]??null}function dt(D){return S.value.has(D)}function T(D){const G=n().find(we=>we.id===D);G&&_(G)}function A(D){return tt(D.id)}function O(D){return J.value[D.id]??null}function Q(D){if(!D)return!1;const G=s();return G?(D.turnId??"")!==G:!0}function fe(){const D=new Set([...Object.keys(H.value),...Object.keys(J.value)]);S.value=wi(S.value,D)}return{anchoredFileChangeSummaryByAnchorId:H,standaloneFileChangeSummaryByMessageId:J,hiddenFileChangeMessageIds:K,isDiffViewerFileListOpen:M,diffViewerChanges:P,activeDiffViewerChange:C,activeDiffViewerLines:L,toggleFileChangeSummary:_,isFileChangeSummaryExpanded:E,openDiffViewer:B,closeDiffViewer:b,toggleDiffViewerFileList:Y,closeDiffViewerFileList:V,selectDiffViewerChange:ve,readAnchoredFileChangeSummaryById:tt,isFileChangeSummaryExpandedById:dt,toggleFileChangeSummaryById:T,readAnchoredFileChangeSummary:A,readStandaloneFileChangeSummary:O,isFileChangeSummaryVisible:Q,pruneFileChangeSummaryIds:fe}}function bi(e){const{getMessages:n,isCopyableAssistantMessage:s,isPlanMessage:r,planStepCopyMarker:m,buildFileChangeCopyText:i,getAnchoredFileChangeSummaries:h}=e,u=N("");let p=null;function v(L){var B;const _=Ct(L);if(!_)return"";const E=[];return(B=_.explanation)!=null&&B.trim()&&E.push(_.explanation.trim()),_.steps.length>0&&E.push(_.steps.map(b=>`- ${m(b.status)} ${b.step}`.trim()).join(`
9
+ `)),E.join(`
10
+
11
+ `).trim()}function S(L){const _=[],E=L.text.trim()||v(L),B=r(L)&&E?`Plan
12
+ ${E}`:E;B&&_.push(B);const b=(L.fileAttachments??[]).map(V=>V.path.trim()).filter(V=>V.length>0);b.length>0&&_.push(`Files:
13
+ ${b.join(`
14
+ `)}`);const Y=(L.images??[]).map(V=>V.trim()).filter(V=>V.length>0);return Y.length>0&&_.push(`Images:
15
+ ${Y.join(`
16
+ `)}`),_.join(`
17
+
18
+ `).trim()}const y=$(()=>{var E;const L=new Map;for(const B of n()){if(!s(B))continue;const b=S(B);if(!b)continue;const Y=typeof B.turnIndex=="number"?`turn:${B.turnIndex}`:`message:${B.id}`,V=L.get(Y);if(V){V.anchorMessageId=B.id,V.parts.push(b);continue}L.set(Y,{anchorMessageId:B.id,parts:[b]})}const _={};for(const B of L.values()){const b=B.parts.join(`
19
+
20
+ `).trim();b&&(_[B.anchorMessageId]=b)}for(const[B,b]of Object.entries(h())){if(b.source!=="metadata")continue;const Y=i(b);if(!Y)continue;const V=(E=_[B])==null?void 0:E.trim();_[B]=V?`${V}
21
+
22
+ ${Y}`:Y}return _}),F=$(()=>{const L=new Map;for(const E of n()){if(!s(E)||typeof E.turnIndex!="number")continue;const B=`turn:${E.turnIndex}`,b=L.get(B);if(b){b.anchorMessageId=E.id,b.turnIndex=E.turnIndex;continue}L.set(B,{anchorMessageId:E.id,turnIndex:E.turnIndex})}const _={};for(const E of L.values())_[E.anchorMessageId]=E.turnIndex;return _});function M(L){return typeof y.value[L.id]=="string"}function H(L){return L.role==="user"&&S(L).length>0}function J(L){u.value=L,p&&clearTimeout(p),p=setTimeout(()=>{u.value===L&&(u.value=""),p=null},1800)}xa()&&$t(()=>{p&&(clearTimeout(p),p=null)});async function K(L){const _=n().find(b=>b.id===L);if(!_)return;const E=S(_);if(!E)return;let B=!1;try{await Ht(E),B=!0}catch{B=!1}B||(B=bo(E)),B&&J(L)}function P(L){return typeof F.value[L.id]=="number"}async function C(L){const _=y.value[L]??"";if(!_)return;let E=!1;try{await Ht(_),E=!0}catch{E=!1}E||(E=bo(_)),E&&J(L)}return{copiedResponseAnchorId:u,copyableResponseContentByAnchorId:y,forkableTurnIndexByAnchorId:F,showCopyResponseButton:M,isCopyableUserMessage:H,copyUserMessage:K,showForkResponseButton:P,copyResponse:C}}function Ci(e){const{getMessages:n,getLiveOverlay:s,isCommandMessage:r}=e,m=N(new Set),i=$(()=>{var L;const C=n();for(let _=C.length-1;_>=0;_-=1){const E=C[_];if(E.messageType==="commandExecution"&&((L=E.commandExecution)==null?void 0:L.status)==="inProgress")return E.id}return""}),h=$(()=>n().some(C=>C.role==="assistant"&&C.messageType==="agentMessage.live"&&C.text.trim().length>0)),u=$(()=>!!s()||i.value.length>0||h.value),p=$(()=>{const C=n(),L={};for(let _=0;_<C.length;){const E=C[_];if(!r(E)){_+=1;continue}const B=[];for(;_<C.length&&r(C[_]);)B.push(C[_]),_+=1;if(B.length<=1)continue;const b=B[B.length-1];L[b.id]=B.slice(0,-1)}return L}),v=$(()=>{const C=new Set;for(const L of Object.values(p.value))for(const _ of L)C.add(_.id);return C});function S(C){return r(C)&&m.value.has(C.id)}function y(C){return r(C)&&u.value}function F(C){var L;return r(C)&&(u.value||((L=C.commandExecution)==null?void 0:L.status)==="inProgress")}function M(C){if(!r(C))return;const L=new Set(m.value);L.has(C.id)?L.delete(C.id):L.add(C.id),m.value=L}function H(C){return p.value[C.id]??[]}function J(C){return r(C)?[...H(C),C]:[]}function K(C,L){if(C.size===0)return C;const _=new Set;for(const E of C)L.has(E)&&_.add(E);return _.size===C.size?C:_}function P(C){m.value=K(m.value,C)}return{expandedCommandIds:m,activeCommandMessageId:i,hasLiveAssistantText:h,isLiveTurnRuntime:u,groupedCommandsByLatestId:p,hiddenGroupedCommandIds:v,isCommandExpanded:S,isCommandCompact:y,isCommandOutputCondensed:F,toggleCommandExpand:M,getGroupedCommandsForLatest:H,getWorkBlockCommands:J,pruneCommandIdSets:P}}function xi(e){const{getActiveThreadId:n,getCwd:s,onFileChangesChanged:r,updateThreadFileChanges:m,t:i}=e,h=N({}),u=N({}),p=N({});function v(P){const C=n();return P!=null&&P.turnId&&C?`thread:${C}:turn:${P.turnId}`:""}function S(P){return v(P).length>0}function y(P){const C=v(P);return C?h.value[C]??"idle":"idle"}function F(P){const C=v(P);return C?u.value[C]??"":""}function M(P){const C=y(P);return C==="undone"||C==="redoing"?"redo":"undo"}function H(P){const C=y(P);return C==="undoing"?i("Undoing"):C==="redoing"?i("Redoing"):M(P)==="redo"?i("Redo"):i("Undo")}async function J(P,C,L){const _=v(P),E=n(),B=s();if(!P||!_||!E||!B)return;const b=y(P),Y=C==="undo"?"undoing":"redoing";h.value={...h.value,[_]:Y},u.value={...u.value,[_]:""};let V;try{const ve=p.value[_]??[];V=await m(E,P.turnId,B,C,ve.length>0?ve:void 0,"single_turn",L)}catch(ve){h.value={...h.value,[_]:b},u.value={...u.value,[_]:ve instanceof Error?ve.message:i("Failed to update file changes.")};return}if(V.errors.length>0){C==="undo"?(p.value={...p.value,[_]:V.revertedPatchIds??[]},h.value={...h.value,[_]:"undone"}):((V.appliedPatchIds??[]).length>0&&(p.value={...p.value,[_]:V.appliedPatchIds??[]}),h.value={...h.value,[_]:"undone"}),u.value={...u.value,[_]:V.errors.join("; ")};return}if((V.changed??0)<=0){h.value={...h.value,[_]:b},u.value={...u.value,[_]:V.message||i(C==="undo"?"No file changes to undo.":"No file changes to redo.")};return}C==="undo"?(p.value={...p.value,[_]:V.revertedPatchIds??[]},h.value={...h.value,[_]:"undone"}):(p.value={...p.value,[_]:V.appliedPatchIds??[]},h.value={...h.value,[_]:"redone"}),r()}function K(){h.value={},u.value={},p.value={}}return{fileChangeActionState:h,fileChangeActionError:u,fileChangeRedoPatchIds:p,fileChangeActionKey:v,isFileChangeActionable:S,fileChangeActionStatus:y,fileChangeActionErrorText:F,fileChangeNextAction:M,fileChangeActionLabel:H,runFileChangeAction:J,resetFileChangeActions:K}}function $i(e){const{toEditUrlFromBrowseHref:n}=e,s=N(!1),r=N(0),m=N(0),i=N(""),h=N("");function u(v){var M,H;const S=v.target,y=(M=S==null?void 0:S.closest)==null?void 0:M.call(S,"a.message-file-link");if(!y)return;const F=(((H=y.getAttribute)==null?void 0:H.call(y,"href"))??"").trim();!F||F==="#"||(v.preventDefault(),v.stopPropagation(),i.value=F,h.value=n(F),r.value=v.clientX,m.value=v.clientY,s.value=!0)}function p(){s.value&&(s.value=!1)}return{isFileLinkContextMenuVisible:s,fileLinkContextMenuX:r,fileLinkContextMenuY:m,fileLinkContextBrowseUrl:i,fileLinkContextEditUrl:h,handleConversationContextMenu:u,closeFileLinkContextMenu:p}}function _i(e){const{isVideo:n}=e,s=N(""),r=N(!1),m=N(0),i=N(new Set);function h(y,F){return`${y}:${F}`}function u(y,F){return i.value.has(h(y,F))}function p(y,F){const M=new Set(i.value);M.add(h(y,F)),i.value=M,m.value+=1}function v(y){s.value=y,r.value=n(y)}function S(){s.value="",r.value=!1}return{modalImageUrl:s,modalIsVideo:r,markdownImageFailureVersion:m,isMarkdownImageFailed:u,onMarkdownImageError:p,openImageModal:v,closeImageModal:S}}const Ti=["aria-label"],Ii={class:"confirm-dialog-title"},Si={class:"confirm-dialog-message"},Mi={class:"confirm-dialog-actions"},Li=ce({__name:"ConfirmDialog",props:{visible:{type:Boolean},title:{},message:{},confirmLabel:{default:""},cancelLabel:{default:""},danger:{type:Boolean,default:!1}},emits:["confirm","cancel"],setup(e){return(n,s)=>(a(),de(qo,{to:"body"},[e.visible?(a(),l("div",{key:0,class:"confirm-dialog-overlay",onClick:s[2]||(s[2]=et(r=>n.$emit("cancel"),["self"]))},[f("div",{class:"confirm-dialog-panel",role:"alertdialog","aria-modal":"true","aria-label":e.title},[f("h3",Ii,w(e.title),1),f("p",Si,w(e.message),1),f("div",Mi,[f("button",{class:"confirm-dialog-btn confirm-dialog-btn-cancel",type:"button",onClick:s[0]||(s[0]=r=>n.$emit("cancel"))},w(e.cancelLabel||"Cancel"),1),f("button",{class:oe(["confirm-dialog-btn confirm-dialog-btn-confirm",{"is-danger":e.danger}]),type:"button",onClick:s[1]||(s[1]=r=>n.$emit("confirm"))},w(e.confirmLabel||"Confirm"),3)])],8,Ti)])):I("",!0)]))}}),Ai=se(Li,[["__scopeId","data-v-860b1449"]]),Fi={key:0,class:"diff-viewer-sidebar"},Pi={class:"diff-viewer-sidebar-header"},Ei={class:"diff-viewer-sidebar-title"},Bi={class:"diff-viewer-sidebar-count"},Di={class:"diff-viewer-sidebar-list"},Ri=["data-active","onClick"],Hi=["data-operation"],Oi={class:"diff-viewer-file-label"},Ni={key:0,class:"diff-viewer-file-delta"},qi={class:"diff-viewer-main"},Vi={class:"diff-viewer-toolbar"},Wi={class:"diff-viewer-title-wrap"},ji={class:"diff-viewer-title"},Ui={class:"diff-viewer-subtitle"},Ki={key:0},Gi={class:"diff-viewer-toolbar-actions"},zi=["aria-label"],Yi={key:0,class:"diff-viewer-empty"},Xi={class:"diff-viewer-empty-title"},Ji={class:"diff-viewer-empty-text"},Qi={key:1,class:"diff-viewer-panel"},Zi={class:"diff-viewer-meta"},er={class:"diff-viewer-language"},tr={class:"diff-viewer-lines"},nr=["data-kind"],or={class:"diff-viewer-line-number"},sr={class:"diff-viewer-line-number"},ar={class:"diff-viewer-line-marker"},ir=["innerHTML"],rr={class:"diff-viewer-mobile-sheet-header"},lr={class:"diff-viewer-sidebar-title"},cr={class:"diff-viewer-sidebar-count"},ur={class:"diff-viewer-mobile-sheet-list"},dr=["data-active","onClick"],fr=["data-operation"],mr={class:"diff-viewer-file-label"},hr={key:0,class:"diff-viewer-file-delta"},gr=ce({__name:"DiffViewer",props:{change:{},changes:{},lines:{},isMobile:{type:Boolean},isFileListOpen:{type:Boolean},cwd:{}},emits:["close","select-change","toggle-file-list","close-file-list"],setup(e){const n=e,{t:s}=Ce();function r(u){return u.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;").replace(/'/gu,"&#39;")}const m=$(()=>u=>mn(u,s)),i=$(()=>u=>Jo(u,s)),h=$(()=>u=>ut(u,n.cwd));return(u,p)=>(a(),de(qo,{to:"body"},[e.change?(a(),l("div",{key:0,class:"diff-viewer-backdrop",onClick:p[5]||(p[5]=v=>u.$emit("close"))},[f("div",{class:"diff-viewer-shell",onClick:p[4]||(p[4]=et(()=>{},["stop"]))},[e.isMobile?I("",!0):(a(),l("aside",Fi,[f("div",Pi,[f("p",Ei,w(c(s)("Changed files")),1),f("p",Bi,w(i.value(e.changes.length)),1)]),f("div",Di,[(a(!0),l(q,null,z(e.changes,v=>(a(),l("button",{key:`diff-viewer:${c(ye)(v)}`,type:"button",class:"diff-viewer-file-button","data-active":c(ye)(v)===c(ye)(e.change),onClick:S=>u.$emit("select-change",v)},[f("span",{class:"file-change-badge","data-operation":c(dn)(v)},w(m.value(v)),9,Hi),f("span",Oi,[He(w(h.value(v.path))+" ",1),v.movedToPath?(a(),l(q,{key:0},[He(" → "+w(h.value(v.movedToPath)),1)],64)):I("",!0)]),c(Ze)(v)?(a(),l("span",Ni,w(c(Ze)(v)),1)):I("",!0)],8,Ri))),128))])])),f("section",qi,[f("div",Vi,[f("div",Wi,[f("p",ji,[He(w(h.value(e.change.path))+" ",1),e.change.movedToPath?(a(),l(q,{key:0},[He(" → "+w(h.value(e.change.movedToPath)),1)],64)):I("",!0)]),f("p",Ui,[He(w(m.value(e.change))+" ",1),c(Ze)(e.change)?(a(),l("span",Ki," · "+w(c(Ze)(e.change)),1)):I("",!0)])]),f("div",Gi,[e.isMobile?(a(),l("button",{key:0,type:"button",class:"diff-viewer-mobile-files-button",onClick:p[0]||(p[0]=v=>u.$emit("toggle-file-list"))},w(i.value(e.changes.length)),1)):I("",!0),f("button",{class:"image-modal-close diff-viewer-close",type:"button","aria-label":c(s)("Close diff viewer"),onClick:p[1]||(p[1]=v=>u.$emit("close"))},[te(Vo,{class:"icon-svg"})],8,zi)])]),c(pi)(e.change)?(a(),l("div",Qi,[f("div",Zi,[f("span",er,w(c(fi)(e.change)||"diff"),1)]),f("div",tr,[(a(!0),l(q,null,z(e.lines,v=>(a(),l("div",{key:v.key,class:"diff-viewer-line","data-kind":v.kind},[f("span",or,w(v.oldLine??""),1),f("span",sr,w(v.newLine??""),1),f("span",ar,w(c(yi)(v)),1),f("code",{class:"diff-viewer-line-code",innerHTML:r(v.text)||" "},null,8,ir)],8,nr))),128))])])):(a(),l("div",Yi,[f("p",Xi,w(c(s)("No diff available")),1),f("p",Ji,w(c(s)("This summary was restored from the final answer text, but the thread history does not include patch diff content for this file.")),1)]))]),te($a,{name:"diff-viewer-sheet"},{default:ct(()=>[e.isMobile&&e.isFileListOpen?(a(),l("div",{key:0,class:"diff-viewer-mobile-sheet-backdrop",onClick:p[3]||(p[3]=v=>u.$emit("close-file-list"))},[f("div",{class:"diff-viewer-mobile-sheet",onClick:p[2]||(p[2]=et(()=>{},["stop"]))},[p[6]||(p[6]=f("div",{class:"diff-viewer-mobile-sheet-handle","aria-hidden":"true"},null,-1)),f("div",rr,[f("p",lr,w(c(s)("Changed files")),1),f("p",cr,w(i.value(e.changes.length)),1)]),f("div",ur,[(a(!0),l(q,null,z(e.changes,v=>(a(),l("button",{key:`diff-viewer-sheet:${c(ye)(v)}`,type:"button",class:"diff-viewer-file-button","data-active":c(ye)(v)===c(ye)(e.change),onClick:S=>u.$emit("select-change",v)},[f("span",{class:"file-change-badge","data-operation":c(dn)(v)},w(m.value(v)),9,fr),f("span",mr,[He(w(h.value(v.path))+" ",1),v.movedToPath?(a(),l(q,{key:0},[He(" → "+w(h.value(v.movedToPath)),1)],64)):I("",!0)]),c(Ze)(v)?(a(),l("span",hr,w(c(Ze)(v)),1)):I("",!0)],8,dr))),128))])])])):I("",!0)]),_:1})])])):I("",!0)]))}}),vr=se(gr,[["__scopeId","data-v-a9ed279d"]]),pr={},yr={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function wr(e,n){return a(),l("svg",yr,[...n[0]||(n[0]=[f("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 14L4 9l5-5m-5 5h11a4 4 0 0 1 0 8H4"},null,-1)])])}const Lo=se(pr,[["render",wr]]),kr={class:"file-change-summary-label"},br={class:"file-change-summary-status"},Cr=["data-tone"],xr={class:"file-change-panel-inner"},$r={class:"file-change-list"},_r=["data-operation","title"],Tr={class:"file-change-path-group"},Ir=["title","onClick"],Sr={key:0,class:"file-change-arrow"},Mr=["title","onClick"],Lr={key:0,class:"file-change-delta"},Ar=["data-tone"],Fr=["title","aria-label","onClick"],Pr={key:0,class:"file-change-actions"},Er={key:0,class:"file-change-action-error"},Br=["disabled","title","aria-label"],Dr=ce({__name:"FileChangeSummaryBlock",props:{summary:{},expanded:{type:Boolean},inline:{type:Boolean},cwd:{},actionable:{type:Boolean},actionStatus:{},actionErrorText:{},nextAction:{},actionLabel:{}},emits:["toggle","open-diff","request-action","request-file-action"],setup(e){const n=e,{t:s}=Ce(),r=$(()=>u=>mn(u,s)),m=$(()=>u=>ci(u,s)),i=$(()=>u=>ut(u,n.cwd)),h=$(()=>u=>`${s("Undo")} ${ut(u.path,n.cwd)}`);return(u,p)=>e.summary?(a(),l("section",{key:0,class:oe(["file-change-summary-block",{"file-change-summary-block-inline":e.inline}])},[f("button",{type:"button",class:oe(["file-change-summary-row",{"file-change-summary-row-expanded":e.expanded}]),onClick:p[0]||(p[0]=v=>u.$emit("toggle"))},[f("span",{class:oe(["file-change-chevron",{"file-change-chevron-open":e.expanded}])},"▶",2),f("span",kr,w(m.value(e.summary)),1),f("span",br,[(a(!0),l(q,null,z(c(ui)(e.summary),v=>(a(),l("span",{key:`summary-status:${e.summary.turnId}:${v.tone}:${v.label}`,class:"file-change-signed-count","data-tone":v.tone},w(v.label),9,Cr))),128))])],2),f("div",{class:oe(["file-change-panel",{"file-change-panel-visible":e.expanded}])},[f("div",xr,[f("ul",$r,[(a(!0),l(q,null,z(e.summary.changes,v=>(a(),l("li",{key:`file-change:${e.summary.turnId}:${v.path}:${v.movedToPath||""}`,class:"file-change-item"},[f("span",{class:"file-change-badge","data-operation":c(dn)(v),title:r.value(v)},w(c(ii)(v)),9,_r),f("span",Tr,[f("button",{type:"button",class:"file-change-path-button",title:v.path,onClick:S=>u.$emit("open-diff",v)},w(i.value(v.path)),9,Ir),v.movedToPath?(a(),l("span",Sr,"→")):I("",!0),v.movedToPath?(a(),l("button",{key:1,type:"button",class:"file-change-path-button",title:v.movedToPath,onClick:S=>u.$emit("open-diff",v)},w(i.value(v.movedToPath)),9,Mr)):I("",!0)]),v.addedLineCount>0||v.removedLineCount>0?(a(),l("span",Lr,[(a(!0),l(q,null,z(c(ri)(v),S=>(a(),l("span",{key:`change-delta:${e.summary.turnId}:${v.path}:${S.tone}:${S.label}`,class:"file-change-signed-count","data-tone":S.tone},w(S.label),9,Ar))),128))])):I("",!0),e.actionable?(a(),l("button",{key:1,type:"button",class:"file-change-file-undo-button",title:h.value(v),"aria-label":h.value(v),onClick:S=>u.$emit("request-file-action",v)},[te(Lo,{class:"icon-svg file-change-action-icon"})],8,Fr)):I("",!0)]))),128))]),e.actionable?(a(),l("div",Pr,[e.actionErrorText?(a(),l("p",Er,w(e.actionErrorText),1)):I("",!0),f("button",{type:"button",class:"file-change-action-button",disabled:e.actionStatus==="undoing"||e.actionStatus==="redoing",title:e.nextAction==="redo"?"Redo file changes from this turn":"Undo file changes from this turn","aria-label":e.nextAction==="redo"?"Redo file changes from this turn":"Undo file changes from this turn",onClick:p[1]||(p[1]=v=>u.$emit("request-action",e.nextAction))},[te(Lo,{class:oe(["icon-svg file-change-action-icon",{"file-change-action-icon-redo":e.nextAction==="redo"}])},null,8,["class"]),He(" "+w(e.actionLabel),1)],8,Br)])):I("",!0)])],2)],2)):I("",!0)}}),Ao=se(Dr,[["__scopeId","data-v-32872c73"]]),Rr=ce({__name:"FileLinkContextMenu",props:{visible:{type:Boolean},x:{},y:{},browseUrl:{},editUrl:{}},emits:["close"],setup(e,{emit:n}){const s=e,r=n,m=N(null),i=$(()=>({left:`${String(s.x)}px`,top:`${String(s.y)}px`}));function h(){r("close")}function u(){const M=s.browseUrl;h(),!(!M||M==="#")&&window.open(M,"_blank","noopener,noreferrer")}function p(){const M=s.editUrl;h(),!(!M||M==="#")&&window.open(M,"_blank","noopener,noreferrer")}async function v(){const M=s.browseUrl;if(h(),!(!M||M==="#"))try{await Ht(M)}catch{}}function S(M){if(!s.visible)return;const H=m.value;if(!H){h();return}const J=M.target;J instanceof Node&&H.contains(J)||h()}function y(){h()}function F(M){M.key==="Escape"&&h()}return pe(()=>s.visible,M=>{M?(window.addEventListener("pointerdown",S,!0),window.addEventListener("blur",y),window.addEventListener("keydown",F,!0)):(window.removeEventListener("pointerdown",S,!0),window.removeEventListener("blur",y),window.removeEventListener("keydown",F,!0))}),$t(()=>{window.removeEventListener("pointerdown",S,!0),window.removeEventListener("blur",y),window.removeEventListener("keydown",F,!0)}),(M,H)=>e.visible?(a(),l("div",{key:0,ref_key:"menuRef",ref:m,class:"file-link-context-menu",style:Se(i.value),onClick:H[0]||(H[0]=et(()=>{},["stop"]))},[f("button",{type:"button",class:"file-link-context-menu-item",onClick:u}," Open link "),f("button",{type:"button",class:"file-link-context-menu-item",onClick:v}," Copy link "),e.editUrl?(a(),l("button",{key:0,type:"button",class:"file-link-context-menu-item",onClick:p}," Edit file ")):I("",!0)],4)):I("",!0)}}),Hr=se(Rr,[["__scopeId","data-v-fa2f389c"]]),Or=12e3,Nr=240;function qr(e,{streaming:n,truncateStreaming:s=!0,maxChars:r=Or,maxLines:m=Nr}){if(!s)return e;let i=e,h=!1;if(r>0&&i.length>r&&(i=i.slice(-r),h=!0),m>0){const u=i.split(/\r?\n/);u.length>m&&(i=u.slice(-m).join(`
23
+ `),h=!0)}return h?`...
24
+ ${i}`:i}const Vr={class:"conversation-item conversation-item-overlay"},Wr={class:"message-row"},jr={class:"message-stack"},Ur={class:"live-overlay-inline","aria-live":"polite"},Kr={class:"live-overlay-title-row"},Gr={key:0,class:"live-overlay-spinner","aria-hidden":"true"},zr=["aria-expanded"],Yr={class:"live-overlay-label"},Xr={class:"live-overlay-toggle","aria-hidden":"true"},Jr={key:2,class:"live-overlay-label"},Qr={key:0,class:"live-overlay-reasoning"},Zr={key:1,class:"live-overlay-error"},el=["href"],tl=ce({__name:"LiveOverlayItem",props:{overlay:{},feedbackMailto:{}},setup(e){const n=e,{buildFeedbackMailto:s,recordVisibleFailure:r}=Wo(),{t:m}=Ce(),i=N(!0);function h(){i.value=!i.value}const u=$(()=>{var v;return qr(((v=n.overlay)==null?void 0:v.reasoningText)??"",{streaming:!0})});function p(v,S){r(S);const y=v.currentTarget;y instanceof HTMLAnchorElement&&(y.href=s())}return(v,S)=>{var y,F,M,H,J,K;return a(),l("li",Vr,[f("div",Wr,[f("div",jr,[f("article",Ur,[f("div",Kr,[(y=e.overlay)!=null&&y.errorText?I("",!0):(a(),l("span",Gr)),(F=e.overlay)!=null&&F.reasoningText?(a(),l("button",{key:1,type:"button",class:"live-overlay-heading","aria-expanded":i.value,onClick:h},[f("span",Yr,w((M=e.overlay)==null?void 0:M.activityLabel),1),f("span",Xr,w(i.value?"▾":"▸"),1)],8,zr)):(a(),l("p",Jr,w((H=e.overlay)==null?void 0:H.activityLabel),1))]),(J=e.overlay)!=null&&J.reasoningText&&i.value?(a(),l("p",Qr,w(u.value),1)):I("",!0),(K=e.overlay)!=null&&K.errorText?(a(),l("div",Zr,[f("span",null,w(e.overlay.errorText),1),f("a",{class:"live-overlay-feedback",href:e.feedbackMailto,onClick:S[0]||(S[0]=P=>p(P,e.overlay.errorText))},w(c(m)("Send feedback")),9,el)])):I("",!0)])])])])}}}),nl=se(tl,[["__scopeId","data-v-edcf19dd"]]),ol=["title"],sl={class:"model-switch-label"},al=ce({__name:"ModelSwitchDivider",props:{from:{},to:{}},setup(e){return(n,s)=>(a(),l("div",{class:"model-switch-divider",title:e.to?`切换模型:${e.from??""} → ${e.to}`:void 0},[s[0]||(s[0]=f("span",{class:"model-switch-track","aria-hidden":"true"},null,-1)),f("span",sl,w(e.from?`${e.from} → `:"")+w(e.to),1),s[1]||(s[1]=f("span",{class:"model-switch-track","aria-hidden":"true"},null,-1))],8,ol))}}),Fo=se(al,[["__scopeId","data-v-1fba0d09"]]),il={class:"time-divider"},rl={class:"time-divider-label"},ll=ce({__name:"TimeDivider",props:{label:{}},setup(e){return(n,s)=>(a(),l("div",il,[f("span",rl,w(e.label),1)]))}}),cl=se(ll,[["__scopeId","data-v-9f8b7bd2"]]),ul={key:0},dl={key:1,class:"message-bold-text"},fl={key:2,class:"message-italic-text"},ml={key:3,class:"message-strikethrough-text"},hl=["href","title"],gl=["href","title"],vl={key:6,class:"message-inline-code"},pl=ce({__name:"MessageInlineContent",props:{segments:{},toBrowseUrl:{type:Function}},setup(e){return(n,s)=>(a(!0),l(q,null,z(e.segments,(r,m)=>(a(),l(q,{key:m},[r.kind==="text"?(a(),l("span",ul,w(r.value),1)):r.kind==="bold"?(a(),l("strong",dl,w(r.value),1)):r.kind==="italic"?(a(),l("em",fl,w(r.value),1)):r.kind==="strikethrough"?(a(),l("s",ml,w(r.value),1)):r.kind==="file"?(a(),l("a",{key:4,class:"message-file-link",href:e.toBrowseUrl(r.path),target:"_blank",rel:"noopener noreferrer",title:r.path},w(r.displayPath),9,hl)):r.kind==="url"?(a(),l("a",{key:5,class:"message-file-link",href:r.href,target:"_blank",rel:"noopener noreferrer",title:r.href},w(r.value),9,gl)):(a(),l("code",vl,w(r.value),1))],64))),128))}}),lt=se(pl,[["__scopeId","data-v-1cf69093"]]),yl={},wl={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function kl(e,n){return a(),l("svg",wl,[...n[0]||(n[0]=[f("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2zm-4 4a2 2 0 0 1-2-2V8m4 8h10"},null,-1)])])}const bl=se(yl,[["render",kl]]),Cl={},xl={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function $l(e,n){return a(),l("svg",xl,[...n[0]||(n[0]=[f("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4"},null,-1),f("path",{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13.5 6.5l4 4"},null,-1)])])}const _l=se(Cl,[["render",$l]]),Tl=["data-role"],Il={key:0,class:"message-timestamp"},Sl=["aria-label","title"],Ml={key:0,class:"message-rollback-label"},Ll=["aria-label","title"],Al={class:"message-fork-label"},Fl=["data-copied","aria-label","title"],Pl={key:0,class:"message-copy-label"},El=ce({__name:"MessageToolbar",props:{role:{},showEdit:{type:Boolean,default:!1},showFork:{type:Boolean,default:!1},showCopy:{type:Boolean,default:!1},copied:{type:Boolean,default:!1},timestamp:{default:""}},emits:["edit","fork","copy"],setup(e){const{t:n}=Ce();return(s,r)=>e.showEdit||e.showFork||e.showCopy||e.timestamp?(a(),l("div",{key:0,class:"message-toolbar","data-role":e.role},[e.timestamp?(a(),l("span",Il,w(e.timestamp),1)):I("",!0),e.showEdit?(a(),l("button",{key:1,type:"button",class:"message-rollback-button","aria-label":c(n)("Edit this message"),title:c(n)("Edit this message"),onClick:r[0]||(r[0]=m=>s.$emit("edit"))},[te(_l,{class:"icon-svg message-rollback-icon"}),e.role!=="user"?(a(),l("span",Ml,w(c(n)("Edit")),1)):I("",!0)],8,Sl)):I("",!0),e.showFork?(a(),l("button",{key:2,type:"button",class:"message-fork-button","aria-label":c(n)("Fork thread from this response"),title:c(n)("Fork thread from this response"),onClick:r[1]||(r[1]=m=>s.$emit("fork"))},[te(_a,{class:"icon-svg message-fork-icon"}),f("span",Al,w(c(n)("Fork")),1)],8,Ll)):I("",!0),e.showCopy?(a(),l("button",{key:3,type:"button",class:"message-copy-button","data-copied":e.copied,"aria-label":e.copied?c(n)("Response copied"):c(n)("Copy response"),title:e.copied?c(n)("Response copied"):c(n)("Copy response"),onClick:r[2]||(r[2]=m=>s.$emit("copy"))},[te(bl,{class:"icon-svg message-copy-icon"}),e.role!=="user"?(a(),l("span",Pl,w(e.copied?"Copied":"Copy"),1)):I("",!0)],8,Fl)):I("",!0)],8,Tl)):I("",!0)}}),Bl=se(El,[["__scopeId","data-v-1f72b6b0"]]),Dl="codex-web-local.process-fold.v1",Po="codex:web-local:process-fold";function ln(){return typeof localStorage>"u"?"auto":localStorage.getItem(Dl)==="expanded"?"expanded":"auto"}function Rl(e){const n=s=>e(s.detail);return window.addEventListener(Po,n),()=>window.removeEventListener(Po,n)}const Hl=["aria-expanded"],Ol={class:"process-fold-label"},Nl={class:"process-fold-toggle","aria-hidden":"true"},ql={key:0,class:"process-fold-body"},Vl=ce({__name:"ProcessFold",props:{label:{},running:{type:Boolean},hasOutsideContent:{type:Boolean}},setup(e){const n=e,s=N(ln()==="expanded"||!n.hasOutsideContent),r=N(!1);let m=!1;const i=Rl(()=>{r.value=!1,ln()==="expanded"?s.value=!0:!n.running&&n.hasOutsideContent&&(s.value=!1)});pe(()=>n.running,u=>{const p=m;m=u,u?(p||(r.value=!1),r.value||(s.value=!0)):p&&!r.value&&n.hasOutsideContent&&ln()!=="expanded"&&(s.value=!1)},{immediate:!0}),$t(()=>i());function h(){r.value=!0,s.value=!s.value}return(u,p)=>(a(),l("div",{class:oe(["process-fold",{"process-fold--open":s.value,"process-fold--running":e.running}])},[f("button",{type:"button",class:"process-fold-header","aria-expanded":s.value,onClick:h},[f("span",Ol,w(e.label),1),f("span",Nl,w(s.value?"▾":"▸"),1)],8,Hl),s.value?(a(),l("div",ql,[Ge(u.$slots,"default",{},void 0)])):I("",!0)],2))}}),Wl=se(Vl,[["__scopeId","data-v-d29a5266"]]),jl=["aria-label"],Ul=["data-turn","aria-label","onClick"],Kl={class:"question-jump-preview-text"},Gl=2,zl=ce({__name:"QuestionJumpBar",props:{anchors:{},activeTurn:{}},emits:["jump"],setup(e,{emit:n}){const s=()=>getComputedStyle(document.documentElement).getPropertyValue("--live").trim()||"#b26a12",r=e,m=n,{t:i}=Ce(),h=N(null),u=N(-1),p=N("0px"),v=$(()=>{const K=u.value;return K<0?null:r.anchors[K]??null});function S(K){var E;const P=r.activeTurn===((E=r.anchors[K])==null?void 0:E.turn),C=s(),L={};if(u.value<0)return L.width=P?"18px":"12px",L.background=P?C:void 0,L;const _=Math.abs(K-u.value);return L.width=_===0?"32px":_===1?"20px":_===2?"14px":P?"18px":"12px",L.background=_===0?C:_===1?C+"99":_===2?C+"59":P?C:void 0,L.transitionDelay=`${_*20}ms`,L}function y(K){const P=h.value;if(!P)return-1;const C=Array.from(P.querySelectorAll(".question-jump-item"));let L=-1,_=Number.POSITIVE_INFINITY;for(let E=0;E<C.length;E+=1){const B=C[E].getBoundingClientRect(),b=B.top+B.height/2,Y=Math.abs(K-b);Y<_&&(_=Y,L=E)}return L}function F(K){var b;const P=y(K.clientY);if(P<0)return;u.value=P;const C=h.value;if(!C)return;const _=(b=Array.from(C.querySelectorAll(".question-jump-item"))[P])==null?void 0:b.getBoundingClientRect(),E=C.getBoundingClientRect();if(!_)return;const B=_.top+_.height/2;p.value=`${B-E.top}px`}function M(){u.value=-1}function H(K){const P=y(K.clientY),C=P>=0?r.anchors[P]:null;C&&m("jump",C.turn)}function J(K){m("jump",K.turn)}return(K,P)=>e.anchors.length>=Gl?(a(),l("nav",{key:0,class:"question-jump-bar","aria-label":c(i)("Question navigation")},[f("div",{ref_key:"trackRef",ref:h,class:"question-jump-track",onMousemove:F,onMouseleave:M,onMousedown:H},[(a(!0),l(q,null,z(e.anchors,(C,L)=>(a(),l("button",{key:C.turn,type:"button",class:"question-jump-item","data-turn":C.turn,"aria-label":c(i)("Jump to question {n}",{n:C.turn+1}),onMousedown:P[0]||(P[0]=et(()=>{},["prevent"])),onClick:_=>J(C)},[f("span",{class:"question-jump-dot",style:Se(S(L))},null,4)],40,Ul))),128))],544),v.value?(a(),l("div",{key:0,class:"question-jump-preview",role:"tooltip",style:Se({top:p.value})},[f("span",Kl,w(v.value.text),1)],4)):I("",!0)],8,jl)):I("",!0)}}),Yl=se(zl,[["__scopeId","data-v-f2cd9065"]]),Xl=["data-state"],Jl=["aria-expanded"],Ql={class:"reasoning-block-title"},Zl={class:"reasoning-block-toggle","aria-hidden":"true"},ec={key:0,class:"reasoning-block-body"},tc={key:0,class:"reasoning-block-summary"},nc=["innerHTML"],oc=ce({__name:"ReasoningBlock",props:{message:{},expanded:{type:Boolean},contentHtml:{}},emits:["toggle"],setup(e){const n=e,{t:s}=Ce(),r=$(()=>{var h;const m=(((h=n.message.reasoning)==null?void 0:h.summary)??[]).map(u=>u.trim()).filter(Boolean).join(`
25
+ `).trim();if(!m)return"";const i=u=>u.replace(/\s+/g," ").trim();return i(m)===i(n.message.text??"")?"":m});return(m,i)=>(a(),l("div",{class:"reasoning-block","data-state":e.expanded?"expanded":"collapsed"},[f("button",{type:"button",class:"reasoning-block-header","aria-expanded":e.expanded,onClick:i[0]||(i[0]=h=>m.$emit("toggle"))},[f("span",Ql,w(c(s)("Thinking process")),1),f("span",Zl,w(e.expanded?"▾":"▸"),1)],8,Jl),e.expanded?(a(),l("div",ec,[r.value?(a(),l("p",tc,w(r.value),1)):I("",!0),f("div",{class:"reasoning-block-content message-card",innerHTML:e.contentHtml},null,8,nc)])):I("",!0)],8,Xl))}}),Eo=se(oc,[["__scopeId","data-v-1e656686"]]),sc=new Set(["read_file","ls","grep","glob","web_fetch","read_skill","code_index","connect_tool_source"]),ac=new Set(["write_file","edit_file","multi_edit","move_file","delete_range","delete_symbol","notebook_edit"]),ic=new Set(["task","run_skill","explore","research","review","security_review"]);function rc(e){var s;const n=((s=e.toolCall)==null?void 0:s.tool)??"";return sc.has(n)?"readonly":ac.has(n)?"modify":ic.has(n)?"delegate":null}const lc=2;function cc(e){var i;const n=[];let s=[],r=null;const m=()=>{if(r!==null&&s.length>=lc)n.push({type:"batch",kind:r,messages:s});else for(const h of s)n.push({type:"tool",message:h});s=[],r=null};for(const h of e){if(h.messageType!=="toolCall"||((i=h.toolCall)==null?void 0:i.status)==="inProgress"){m(),n.push({type:"tool",message:h});continue}const u=rc(h);if(u===null){m(),n.push({type:"tool",message:h});continue}r!==null&&r!==u&&m(),r=u,s.push(h)}return m(),n}function uc(e,n,s){const{t:r}=s;if(e==="readonly"){const m=n.filter(p=>{var v,S;return((v=p.toolCall)==null?void 0:v.tool)==="read_file"||((S=p.toolCall)==null?void 0:S.tool)==="ls"}).length,i=n.filter(p=>{var S;const v=((S=p.toolCall)==null?void 0:S.tool)??"";return v==="grep"||v==="glob"||v==="web_fetch"||v==="code_index"}).length,h=n.length-m-i,u=[];return m>0&&u.push(r("Read {n} files",{n:m})),i>0&&u.push(r("Search {n} files",{n:i})),h>0&&u.push(r("{n} read calls",{n:h})),u.join(" · ")}return e==="modify"?r("Modified {n} files",{n:n.length}):e==="delegate"?r("Delegated {n} tasks",{n:n.length}):r("Explored {n} items",{n:n.length})}const dc={class:"message-row","data-role":"system"},fc={class:"message-stack","data-role":"system"},mc=["title"],hc={class:"tool-call-name"},gc={key:0,class:"tool-call-metric"},vc=ce({__name:"ToolCallRow",props:{message:{}},setup(e){const n=e,{t:s}=Ce(),r=$(()=>{const y=n.message.toolCall;return y?y.server?`${y.server} · ${y.tool}`:y.tool:n.message.text||"(tool)"}),m=$(()=>{var F;const y=(F=n.message.toolCall)==null?void 0:F.durationMs;return typeof y!="number"||y<0?"":y<1e3?`${y}ms`:`${(y/1e3).toFixed(1)}s`}),i=$(()=>{var y;switch((y=n.message.toolCall)==null?void 0:y.status){case"inProgress":return{text:"RUN",cls:"is-live"};case"failed":return{text:"FAIL",cls:"is-alert"};case"completed":return{text:"OK",cls:"is-ok"};default:return{text:"",cls:""}}}),h=$(()=>i.value.text),u=$(()=>i.value.cls),p=$(()=>{const y=n.message.toolCall;if(!y)return"";switch(y.status){case"inProgress":return s("Running");case"failed":return s("Failed");default:return s("Done")}}),v=$(()=>{var y;switch((y=n.message.toolCall)==null?void 0:y.status){case"inProgress":return"tool-call-running";case"failed":return"tool-call-error";default:return"tool-call-ok"}}),S=$(()=>{const y=n.message.toolCall;if(!y)return"";const F=[r.value,p.value];return y.error&&F.push(y.error),typeof y.durationMs=="number"&&y.durationMs>=0&&F.push(`${y.durationMs}ms`),F.join(" · ")});return(y,F)=>(a(),l("div",dc,[f("div",fc,[f("div",{class:oe(["tool-call-block",v.value]),title:S.value},[f("span",{class:oe(["tool-call-pip",u.value]),"aria-hidden":"true"},null,2),f("code",hc,w(r.value),1),m.value?(a(),l("span",gc,w(m.value),1)):I("",!0),h.value?(a(),l("span",{key:1,class:oe(["tool-call-status",u.value])},w(h.value),3)):I("",!0)],10,mc)])]))}}),fn=se(vc,[["__scopeId","data-v-f0b29923"]]),pc=["aria-expanded","title"],yc={class:"tool-batch-toggle","aria-hidden":"true"},wc={class:"tool-batch-label"},kc={class:"tool-batch-count"},bc={key:0,class:"tool-batch-body"},Cc=ce({__name:"ToolBatchBlock",props:{kind:{},messages:{}},setup(e){const n=e,{t:s}=Ce(),r=N(!1),m=$(()=>uc(n.kind,n.messages,{t:s})),i=$(()=>n.messages.map(h=>{var u;return((u=h.toolCall)==null?void 0:u.tool)??""}).join(" · "));return(h,u)=>(a(),l("div",{class:oe(["tool-batch-block",{"tool-batch-block--open":r.value}])},[f("button",{type:"button",class:"tool-batch-head","aria-expanded":r.value,title:i.value,onClick:u[0]||(u[0]=p=>r.value=!r.value)},[f("span",yc,w(r.value?"▾":"▸"),1),u[1]||(u[1]=f("span",{class:"tool-batch-icon","aria-hidden":"true"},"🛠",-1)),f("span",wc,w(m.value),1),f("span",kc,w(e.messages.length),1)],8,pc),r.value?(a(),l("div",bc,[(a(!0),l(q,null,z(e.messages,p=>(a(),de(fn,{key:p.id,message:p},null,8,["message"]))),128))])):I("",!0)],2))}}),xc=se(Cc,[["__scopeId","data-v-7b951bea"]]),$c=["data-turn-key"],_c={key:0,class:"conversation-turn-request","aria-label":"User request"},Tc={class:"conversation-turn-items"},Ic={key:1,class:"conversation-turn-process","aria-label":"Turn process"},Sc=["aria-expanded","aria-label"],Mc={key:2,class:"conversation-turn-time"},Lc={class:"conversation-turn-process-count"},Ac={key:1,class:"conversation-turn-process-heading"},Fc={key:0,class:"conversation-turn-time"},Pc={key:2,class:"conversation-turn-items conversation-turn-process-items"},Ec={key:2,class:"conversation-turn-final","aria-label":"Assistant final response"},Bc={class:"conversation-turn-items"},Dc=ce({__name:"ThreadTurn",props:{turnKey:{},request:{},processItems:{default:()=>[]},finalItem:{},fileChangeAnchorIds:{default:()=>[]},durationMs:{},warm:{},warmItems:{default:()=>[]}},setup(e){const n=e,{t:s}=Ce(),r=N(!0),m=$(()=>n.processItems.length+n.fileChangeAnchorIds.length),i=$(()=>!!n.finalItem);return pe(m,(h,u)=>{h>u&&(r.value=!0)}),(h,u)=>e.warm?(a(),l(q,{key:0},[Ge(h.$slots,"warm-card",{warm:e.warm},void 0),(a(!0),l(q,null,z(e.warmItems,p=>Ge(h.$slots,"default",{key:p.message.id,item:p,section:"warm"},void 0)),128))],64)):(a(),l("li",{key:1,class:"conversation-turn","data-turn-key":e.turnKey},[e.request?(a(),l("section",_c,[f("ol",Tc,[Ge(h.$slots,"default",{item:e.request,section:"request"},void 0)])])):I("",!0),m.value>0?(a(),l("section",Ic,[i.value?(a(),l("button",{key:0,class:"conversation-turn-process-heading conversation-turn-process-toggle",type:"button","aria-expanded":r.value,"aria-label":r.value?c(s)("Collapse turn process"):c(s)("Expand turn process"),onClick:u[0]||(u[0]=p=>r.value=!r.value)},[r.value?(a(),de(Ta,{key:0,class:"conversation-turn-process-toggle-icon"})):(a(),de(jo,{key:1,class:"conversation-turn-process-toggle-icon"})),f("span",null,w(c(s)("Turn process")),1),e.durationMs!=null&&e.durationMs>0?(a(),l("span",Mc,w(c(cn)(e.durationMs)),1)):I("",!0),f("span",Lc,w(c(s)("{n} process items",{n:m.value})),1)],8,Sc)):(a(),l("div",Ac,[He(w(c(s)("Turn process"))+" ",1),e.durationMs!=null&&e.durationMs>0?(a(),l("span",Fc,w(c(cn)(e.durationMs)),1)):I("",!0)])),r.value?(a(),l("ol",Pc,[(a(!0),l(q,null,z(e.processItems,p=>Ge(h.$slots,"default",{key:p.message.id,item:p,section:"process"},void 0)),128)),(a(!0),l(q,null,z(e.fileChangeAnchorIds,p=>(a(),l("li",{key:`file-change-${p}`,class:"conversation-turn-row conversation-turn-file-change"},[Ge(h.$slots,"file-change",{anchorMessageId:p},void 0)]))),128))])):I("",!0)])):I("",!0),e.finalItem?(a(),l("section",Ec,[f("ol",Bc,[Ge(h.$slots,"default",{item:e.finalItem,section:"final"},void 0)])])):I("",!0)],8,$c))}}),Rc=se(Dc,[["__scopeId","data-v-7e124617"]]),Hc=["aria-expanded"],Oc={class:"warm-turn__preview"},Nc={key:0,class:"warm-turn__meta"},qc={class:"warm-turn__content"},Vc={key:1,class:"warm-turn__assistant"},Wc=ce({__name:"WarmTurnCard",props:{userText:{},assistantPreview:{},toolCount:{},expanded:{type:Boolean}},emits:["toggle"],setup(e,{emit:n}){const s=n,{t:r}=Ce();function m(){s("toggle")}return(i,h)=>(a(),l("div",{class:oe(["warm-turn",{"warm-turn--expanded":e.expanded}])},[f("button",{type:"button",class:"warm-turn__head","aria-expanded":e.expanded,onClick:m},[te(jo,{class:oe(["warm-turn__chevron",{"warm-turn__chevron--open":e.expanded}])},null,8,["class"]),f("span",Oc,w(e.userText),1),e.toolCount>0?(a(),l("span",Nc,w(c(r)("{n} tools",{n:e.toolCount})),1)):I("",!0)],8,Hc),f("div",qc,[e.expanded?Ge(i.$slots,"default",{},void 0,!0,0):e.assistantPreview?(a(),l("div",Vc,w(e.assistantPreview),1)):I("",!0)])],2))}}),jc=se(Wc,[["__scopeId","data-v-cda74ec1"]]),Uc=["aria-expanded","aria-label","title"],Kc={class:"work-block-command"},Gc={key:0,class:"work-block-metric"},zc={class:"work-block-output-inner"},Yc=["textContent"],Xc=["textContent"],Jc={key:0,class:"work-block-output-spill",role:"note"},Qc=["disabled"],Zc={key:1},eu={key:0,class:"work-block-permission-hint",role:"note"},tu=ce({__name:"WorkBlockItem",props:{command:{},stepIndex:{},expanded:{type:Boolean},compact:{type:Boolean},outputCondensed:{type:Boolean}},emits:["toggle"],setup(e){const n=e,{t:s}=Ce(),r=$(()=>{var b;return(b=n.command.commandExecution)==null?void 0:b.outputSpill}),m=$(()=>{var b;return((b=r.value)==null?void 0:b.ref)??""}),i=N("idle"),h=N(null),u=$(()=>{const b=r.value;return!!(b&&h.value&&h.value.ref===b.ref)}),p=$(()=>{const b=n.command.commandExecution,Y=b==null?void 0:b.outputSpill,V=h.value;return Y&&V&&V.ref===Y.ref?V.text:(b==null?void 0:b.aggregatedOutput)||"(no output)"});function v(b){return b<1024?`${b} B`:b<1024*1024?`${(b/1024).toFixed(1)} KB`:`${(b/(1024*1024)).toFixed(1)} MB`}const S=$(()=>{const b=r.value;return!b||b.omittedBytes<=0?"":s("Output trimmed: {omitted} omitted of {total}.",{omitted:v(b.omittedBytes),total:v(b.totalBytes)})});async function y(){const b=r.value;if(!(!(b!=null&&b.ref)||i.value==="loading")){i.value="loading";try{h.value={ref:b.ref,text:await Ia(b.ref)},i.value="idle"}catch{i.value="error"}}}const F=$(()=>{var Y,V;const b=(Y=n.command.commandExecution)==null?void 0:Y.status;return b==="inProgress"?"cmd-status-running":b==="completed"&&((V=n.command.commandExecution)==null?void 0:V.exitCode)===0?"cmd-status-ok":"cmd-status-error"}),M=$(()=>{const b=n.command.commandExecution;if(!b)return"";switch(b.status){case"inProgress":return s("Running");case"completed":return b.exitCode===0?s("Done"):`${s("Exit")} ${b.exitCode??"?"}`;case"failed":return s("Failed");case"declined":return s("Declined");case"interrupted":return s("Stopped");default:return""}}),H=$(()=>{var b;return((b=n.command.commandExecution)==null?void 0:b.command)||"(command)"}),J=$(()=>{const b=n.command.commandExecution;return b?b.outputSpill&&b.outputSpill.totalBytes>0?b.outputSpill.totalBytes:b.aggregatedOutput?new TextEncoder().encode(b.aggregatedOutput).length:0:0}),K=$(()=>J.value>0?v(J.value):""),P=$(()=>{const b=n.command.commandExecution;if(!b)return{text:"",cls:""};switch(b.status){case"inProgress":return{text:"RUN",cls:"is-live"};case"completed":return b.exitCode===0?{text:"OK",cls:"is-ok"}:{text:`EXIT ${b.exitCode??"?"}`,cls:"is-alert"};case"failed":return{text:"FAIL",cls:"is-alert"};case"declined":return{text:"SKIP",cls:"is-alert"};case"interrupted":return{text:"STOP",cls:"is-alert"};default:return{text:"",cls:""}}}),C=$(()=>P.value.text),L=$(()=>P.value.cls),_=$(()=>[H.value,M.value,K.value].filter(Boolean).join(" · ")),E=[/access to the path .* is denied/iu,/access is denied/iu,/permission denied/iu,/not permitted/iu,/EACCES|EPERM/iu,/denied access|deny access/iu,/拒绝访问/iu,/没有权限/iu,/权限不足/iu,/要求提权|需要提权|require_escalated/iu],B=$(()=>{const b=n.command.commandExecution;if(!b||!(b.status==="failed"||b.status==="declined"||typeof b.exitCode=="number"&&b.exitCode!==0))return"";const V=b.aggregatedOutput??"";return!V||!E.some(ve=>ve.test(V))?"":s("Command blocked by a permission or sandbox restriction; no approval prompt was shown. Check the approval policy or trusted directories if you expected one.")});return(b,Y)=>{var V;return a(),l("div",{class:oe(["work-block",[F.value,{"work-block-expanded":e.expanded,"work-block-compact":e.compact}]])},[f("button",{type:"button",class:"work-block-header","aria-expanded":e.expanded,"aria-label":_.value,title:_.value,onClick:Y[0]||(Y[0]=ve=>b.$emit("toggle"))},[f("span",{class:oe(["work-block-pip",L.value]),"aria-hidden":"true"},null,2),f("code",Kc,w(H.value),1),K.value?(a(),l("span",Gc,w(K.value),1)):I("",!0),C.value?(a(),l("span",{key:1,class:oe(["work-block-status",L.value])},w(C.value),3)):I("",!0)],8,Uc),f("div",{class:oe(["work-block-output-wrap",{"work-block-output-visible":e.expanded}])},[f("div",zc,[f("pre",{class:"work-block-output-command",textContent:w(((V=e.command.commandExecution)==null?void 0:V.command)||"(command)")},null,8,Yc),f("pre",{class:oe(["work-block-output",{"cmd-output-condensed":e.outputCondensed}]),textContent:w(p.value)},null,10,Xc),S.value?(a(),l("p",Jc,[f("span",null,w(S.value),1),m.value&&!u.value?(a(),l("button",{key:0,type:"button",class:"work-block-output-spill-action",disabled:i.value==="loading",onClick:y},w(i.value==="loading"?c(s)("Loading full output…"):c(s)("Show full output")),9,Qc)):i.value==="error"?(a(),l("span",Zc,w(c(s)("Could not load the full output.")),1)):I("",!0)])):I("",!0)])],2),B.value?(a(),l("p",eu,w(B.value),1)):I("",!0)],2)}}}),Bo=se(tu,[["__scopeId","data-v-daded7af"]]),nu=2;function Do(e){const n=e.messageType;return n==="commandExecution"||n==="toolCall"}function ou(e){var s,r;return(((s=e.commandExecution)==null?void 0:s.status)??"")==="inProgress"||(((r=e.toolCall)==null?void 0:r.status)??"")==="inProgress"?!0:(e.messageType??"").endsWith(".live")}function su(e,n){return e.messages.every(s=>n(s))}function au(e){const n=[];let s=[],r="";const m=()=>{s.length>0&&(n.push(s),s=[])};for(const u of e){const p=u.turnId??"",v=Do(u)&&p!=="";(!v||p!==r)&&(s.length>0&&m(),r=v?p:""),v&&s.push(u)}m();const i=new Map;for(const u of e)u.messageType==="worked"&&u.turnId&&typeof u.durationMs=="number"&&i.set(u.turnId,u.durationMs);const h=[];for(const u of n){if(u.length<nu)continue;const p=u[0].turnId??"";let v=0,S=0,y=0,F=!1;for(const H of u)H.messageType==="toolCall"?v+=1:H.messageType==="reasoning"?S+=1:H.messageType==="commandExecution"&&(y+=1),ou(H)&&(F=!0);const M=e.some(H=>H.turnId===p&&!Do(H));h.push({turnId:p,messages:u,running:F,toolCount:v,thoughtCount:S,commandCount:y,durationMs:i.get(p)??0,hasOutsideContent:M})}return h}function iu(e,n){const{t:s,formatDuration:r}=n,m=[];return e.running?m.push(s("Working…")):e.durationMs>0?m.push(r(e.durationMs)):m.push(s("Processed")),e.toolCount>0&&m.push(s("{n} tools",{n:e.toolCount})),e.thoughtCount>0&&m.push(s("{n} thoughts",{n:e.thoughtCount})),e.commandCount>0&&m.push(s("{n} commands",{n:e.commandCount})),m.join(" · ")}function ru(e){return e.text.length>0||Array.isArray(e.images)&&e.images.length>0||Array.isArray(e.fileAttachments)&&e.fileAttachments.length>0||Array.isArray(e.skills)&&e.skills.length>0||Array.isArray(e.imageAttachmentIds)&&e.imageAttachmentIds.length>0||Array.isArray(e.audioSources)&&e.audioSources.length>0||Array.isArray(e.mentions)&&e.mentions.length>0}function lu(e){return!ru(e)}const cu=68.5,uu=42,du=34,Ro=30,fu=280;function mu(e,n){if(!e.collapsed)return fu;let s=e.hasAssistantPreview?cu:uu;return e.hasTimeDivider&&(s+=du+n),s+=e.leadingModelSwitchCount*(Ro+n),s+=e.trailingModelSwitchCount*(Ro+n),s}function hn(e,n){const s=e.map(i=>mu(i,n)),r=new Array(e.length);let m=0;for(let i=e.length-1;i>=0;i-=1)r[i]=m+s[i],m+=s[i]+n;return{heightsPx:s,topDistancesFromBottomPx:r,bottomDistancesFromBottomPx:r.map((i,h)=>i-s[h]),totalHeightPx:e.length===0?0:m-n}}function hu({gapPx:e,overscanPx:n,specs:s,viewportBottomDistancePx:r,viewportHeightPx:m}){var F;const i=s.length;if(i===0)return{first:0,last:-1};const h=hn(s,e),u=r+m,p=r-n,v=u+n;let S=-1,y=-1;for(let M=0;M<i;M+=1){const H=h.bottomDistancesFromBottomPx[M],J=h.topDistancesFromBottomPx[M];H<=v&&J>=p&&(S<0&&(S=M),y=M)}S<0&&(p>h.totalHeightPx?(S=0,y=0):(S=i-1,y=i-1));for(let M=0;M<i;M+=1)((F=s[M])==null?void 0:F.collapsed)===!1&&(M<S&&(S=M),M>y&&(y=M));return{first:S,last:y}}function gu({gapPx:e,specs:n,window:s}){const r=hn(n,e),m=n.length,{first:i,last:h}=s,u=Math.max(0,i),p=Math.max(0,m-1-h);let v=0;if(u>0){let y=0;for(let F=0;F<u;F+=1)y+=r.heightsPx[F];v=y+u*e}let S=0;if(p>0){let y=0;for(let F=h+1;F<m;F+=1)y+=r.heightsPx[F];S=Math.max(0,y+(p-1)*e)}return{topMarginPx:v,bottomSpacerPx:S,skippedAbove:u,skippedBelow:p}}function vu({gapPx:e,overscanPx:n,specs:s,viewportBottomDistancePx:r,viewportHeightPx:m}){const i=hn(s,e),h=hu({gapPx:e,overscanPx:n,specs:s,viewportBottomDistancePx:r,viewportHeightPx:m}),u=gu({gapPx:e,specs:s,window:h});return{window:h,spacers:u,layout:i}}const pu=280;function gn(e,n){const s=e.map(i=>i.measuredHeightPx??pu),r=new Array(e.length);let m=0;for(let i=e.length-1;i>=0;i-=1)r[i]=m+s[i],m+=s[i]+n;return{heightsPx:s,topDistancesFromBottomPx:r,bottomDistancesFromBottomPx:r.map((i,h)=>i-s[h]),totalHeightPx:e.length===0?0:m-n}}function yu({forcedKeys:e,gapPx:n,overscanPx:s,specs:r,viewportBottomDistancePx:m,viewportHeightPx:i}){const h=r.length;if(h===0)return{first:0,last:-1};const u=gn(r,n),p=m+i,v=m-s,S=p+s;let y=-1,F=-1;for(let M=0;M<h;M+=1){const H=u.bottomDistancesFromBottomPx[M],J=u.topDistancesFromBottomPx[M];H<=S&&J>=v&&(y<0&&(y=M),F=M)}y<0&&(v>u.totalHeightPx?(y=0,F=0):(y=h-1,F=h-1));for(let M=0;M<h;M+=1){const H=r[M];(H.measuredHeightPx===void 0||e!=null&&e.has(H.key))&&(M<y&&(y=M),M>F&&(F=M))}return{first:y,last:F}}function wu({gapPx:e,specs:n,window:s}){const r=gn(n,e),m=n.length,{first:i,last:h}=s,u=Math.max(0,i),p=Math.max(0,m-1-h);let v=0;if(u>0){let y=0;for(let F=0;F<u;F+=1)y+=r.heightsPx[F];v=Math.max(0,y+(u-1)*e)}let S=0;if(p>0){let y=0;for(let F=h+1;F<m;F+=1)y+=r.heightsPx[F];S=Math.max(0,y+(p-1)*e)}return{topSpacerPx:v,bottomSpacerPx:S,skippedAbove:u,skippedBelow:p}}function ku({forcedKeys:e,gapPx:n,overscanPx:s,specs:r,viewportBottomDistancePx:m,viewportHeightPx:i}){const h=gn(r,n),u=yu({forcedKeys:e,gapPx:n,overscanPx:s,specs:r,viewportBottomDistancePx:m,viewportHeightPx:i}),p=wu({gapPx:n,specs:r,window:u});return{window:u,spacers:p,layout:h}}function bu(e){const n={};for(const s of e)s.messageType==="worked"&&s.turnId&&typeof s.durationMs=="number"&&(n[s.turnId]=(n[s.turnId]??0)+s.durationMs);return n}const Cu=300,xu=1200,$u=300,_u=250;function Tu(e){const{getCwd:n,isVideoMediaUrl:s}=e,r=N(null),m=N(0);let i=null;const h=new Map,u=new Map,p=new Map,v=new Map;function S(T,A,O,Q){for(T.has(A)&&T.delete(A),T.set(A,O);T.size>Q;){const fe=T.keys().next().value;if(fe===void 0)break;T.delete(fe)}return O}function y(){return r.value?Promise.resolve():(i||(i=La(()=>import("./common-DEPjExR-.js"),[]).then(T=>{r.value=T.default,v.clear(),p.clear(),m.value+=1}).finally(()=>{i=null})),i)}function F(){return!!r.value}function M(T){const A=u.get(T);return A?(u.delete(T),u.set(T,A),A):S(u,T,Ma(T),xu)}function H(T){const A=T.trim();if(!A)return"#";const O=G=>G.startsWith("/")||/^[A-Za-z]:[\\/]/u.test(G),Q=Sa(A),fe=(Q==null?void 0:Q.path)??A,D=No(fe,n());if(O(D)){const G=D.startsWith("/")?D:`/${D}`;return`/codex-local-browse${encodeURI(G)}`}return"#"}function J(T){const A=T.trim();if(!A)return"";try{const O=new URL(A,window.location.href);return O.pathname.startsWith("/codex-local-browse")?`${`/codex-local-edit${O.pathname.slice(19)}`}${O.search}${O.hash}`:""}catch{return""}}function K(T){const A=h.get(T.id);if(A&&A.text===T.text&&A.cwd===n())return h.delete(T.id),h.set(T.id,A),A.blocks;const O=Co(T.text);return S(h,T.id,{text:T.text,cwd:n(),blocks:O},Cu).blocks}function P(T){return T.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;").replace(/'/gu,"&#39;")}function C(T){var O;const A=((O=T.trim().split(/\s+/u)[0])==null?void 0:O.toLowerCase())??"";return A?Yo[A]??A:""}function L(T,A){const O=C(T);if(!O)return P(A);const Q=r.value;if(!Q)return P(A);try{if(Q.getLanguage(O))return Q.highlight(A,{language:O,ignoreIllegals:!0}).value}catch{}return P(A)}function _(T,A){return an(E(T,A))}function E(T,A){const O=`${m.value}\0${C(T)}\0${T}\0${A}`,Q=v.get(O);return Q!==void 0?(v.delete(O),v.set(O,Q),Q):S(v,O,L(T,A),_u)}function B(T){return M(T).map(A=>A.kind==="text"?P(A.value):A.kind==="bold"?`<strong class="message-bold-text">${P(A.value)}</strong>`:A.kind==="italic"?`<em class="message-italic-text">${P(A.value)}</em>`:A.kind==="strikethrough"?`<s class="message-strikethrough-text">${P(A.value)}</s>`:A.kind==="file"?`<a class="message-file-link" href="${P(H(A.path))}" target="_blank" rel="noopener noreferrer" title="${P(A.path)}">${P(A.displayPath)}</a>`:A.kind==="url"?`<a class="message-file-link" href="${P(A.href)}" target="_blank" rel="noopener noreferrer" title="${P(A.href)}">${P(A.value)}</a>`:`<code class="message-inline-code">${P(A.value)}</code>`).join("")}function b(T){return T.paragraphs.map(A=>`<div class="message-list-item-text message-list-item-paragraph">${B(A)}</div>`).join("")}function Y(T){var Q;const A=b(T),O=((Q=T.children)==null?void 0:Q.map(fe=>ve(fe)).join(""))??"";return an(A+O)}function V(T){return T?` style="text-align:${T}"`:""}function ve(T){if(T.kind==="paragraph")return`<p class="message-text">${B(T.value)}</p>`;if(T.kind==="heading"){const A=Math.min(6,Math.max(1,Math.trunc(T.level))),O=Uo(A),Q=`message-heading ${Ko(A)}`;return`<${O} class="${Q}">${B(T.value)}</${O}>`}if(T.kind==="blockquote")return`<blockquote class="message-blockquote">${B(T.value)}</blockquote>`;if(T.kind==="unorderedList")return`<ul class="message-list message-list-unordered">${T.items.map(O=>`<li class="message-list-item"><div class="message-list-item-content">${Y(O)}</div></li>`).join("")}</ul>`;if(T.kind==="taskList")return`<ul class="message-list message-task-list">${T.items.map(O=>`<li class="message-task-item"><span class="message-task-checkbox" data-checked="${O.checked?"true":"false"}">${O.checked?"☑":"☐"}</span><div class="message-list-item-text">${B(O.text)}</div></li>`).join("")}</ul>`;if(T.kind==="orderedList"){const A=T.items.map(O=>`<li class="message-list-item"><div class="message-list-item-content">${Y(O)}</div></li>`).join("");return`<ol class="message-list message-list-ordered" start="${T.start}">${A}</ol>`}if(T.kind==="table"){const A=T.headers.map((fe,D)=>`<th class="message-table-head-cell"${V(T.alignments[D]??null)}>${B(fe)}</th>`).join(""),O=T.rows.map(fe=>'<tr class="message-table-body-row">'+fe.map((D,G)=>`<td class="message-table-cell"${V(T.alignments[G]??null)}>${B(D)}</td>`).join("")+"</tr>").join(""),Q=O?`<tbody>${O}</tbody>`:"";return`<div class="message-table-wrap"><table class="message-table"><thead><tr>${A}</tr></thead>${Q}</table></div>`}return T.kind==="codeBlock"?`<div class="message-code-block"><div class="message-code-bar">${T.language?`<span class="message-code-language">${P(T.language)}</span>`:""}<span class="message-code-copy" role="button" tabindex="0" data-code-copy>Copy</span></div><pre class="message-code-pre"><code class="hljs">${_(T.language,T.value)}</code></pre></div>`:T.kind==="thematicBreak"?'<hr class="message-divider">':s(T.url)?`<video class="message-image-preview message-video-preview message-markdown-image" src="${P(T.url)}" controls preload="metadata"></video>`:`<img class="message-image-preview message-markdown-image" src="${P(T.url)}" alt="${P(T.alt||"Embedded message image")}" loading="lazy">`}function tt(T){const A=`${n()}\0${m.value}\0${T}`,O=p.get(A);if(O&&O.text===T&&O.cwd===n()&&O.highlightVersion===m.value)return p.delete(A),p.set(A,O),O.html;const Q=Co(T).map(D=>ve(D)).join(""),fe=an(Q);return S(p,A,{text:T,cwd:n(),highlightVersion:m.value,html:fe},$u).html}function dt(){h.clear(),u.clear(),p.clear(),v.clear()}return{highlightCacheVersion:m,hasHighlightLoaded:F,ensureHighlightJsLoaded:y,getInlineSegments:M,toBrowseUrl:H,toEditUrlFromBrowseHref:J,getMessageBlocks:K,renderListItemContentAsHtml:Y,renderCachedHighlightedCodeAsHtml:_,renderMarkdownBlocksAsHtml:tt,clearRenderCaches:dt}}const Iu=["data-thread-id"],Su={key:0,class:"conversation-switching-bar",role:"status"},Mu={key:1,class:"conversation-loading"},Lu={key:2,class:"conversation-loading conversation-loading-slow",role:"status"},Au={key:3,class:"conversation-empty"},Fu={key:0,class:"conversation-load-more"},Pu=["disabled"],Eu={key:1,class:"conversation-load-more conversation-warm-collapse"},Bu=["disabled"],Du={key:0,"aria-hidden":"true",class:"conversation-hot-anchor"},Ru=["data-hot-block"],Hu=["data-hot-block"],Ou=["id"],Nu={class:"message-row","data-role":"system"},qu={class:"message-stack","data-role":"system"},Vu={class:"message-row","data-role":"system","data-message-type":"fileChange"},Wu={class:"message-stack","data-role":"system"},ju={key:0,class:"conversation-item conversation-item-fold","data-role":"system","data-message-type":"processFold"},Uu={class:"message-row","data-role":"system"},Ku={class:"message-stack","data-role":"system"},Gu={key:0,class:"work-block-list"},zu=["id","data-role","data-message-type"],Yu={key:0,class:"message-row thread-compaction-row","data-role":"system"},Xu={class:"thread-compaction-inline thread-compaction-inline--pending",role:"status"},Ju={key:1,class:"message-row thread-compaction-row","data-role":"system"},Qu={class:"thread-compaction-inline thread-compaction-inline--done",role:"status"},Zu={key:2,class:"message-row","data-role":"system"},ed={class:"message-stack","data-role":"system"},td={class:"work-block-list"},nd=["data-role","data-message-type"],od=["data-role"],sd=["data-role"],ad={key:5,class:"message-row","data-role":"system","data-message-type":"plan"},id={class:"message-stack","data-role":"system"},rd={class:"thread-plan-record"},ld={class:"thread-plan-record-header"},cd={key:0,class:"thread-plan-record-explanation"},ud={key:1,class:"thread-plan-record-steps"},dd=["data-status"],fd={class:"thread-plan-record-marker","aria-hidden":"true"},md={key:6,class:"message-row thread-agent-note-row","data-role":"system","data-message-type":"agentNote"},hd={class:"message-stack","data-role":"system"},gd={class:"thread-agent-note"},vd={class:"thread-agent-note-header"},pd=["innerHTML"],yd=["data-role","data-message-type"],wd=["data-role"],kd=["data-role"],bd=["data-role"],Cd=["onClick"],xd=["src"],$d=["src","alt"],_d={key:1,class:"message-file-attachments"},Td=["href","title"],Id={key:2,class:"message-file-attachments"},Sd=["title"],Md={class:"message-file-chip-name"},Ld={key:3,class:"message-skill-attachments"},Ad=["href","title"],Fd={class:"message-skill-chip-prefix"},Pd={class:"message-skill-chip-name"},Ed={key:4,class:"message-audio-attachments"},Bd=["src"],Dd={key:5,class:"message-file-attachments"},Rd=["title"],Hd={class:"message-file-chip-name"},Od=["data-role"],Nd={key:0,class:"automation-message-label"},qd={key:0},Vd={key:1,class:"work-summary-wrap","aria-live":"polite"},Wd={class:"work-summary-text"},jd={key:3,class:"message-inline-editor message-inline-editor-inplace","data-message-inline-editor":""},Ud=["onKeydown"],Kd={class:"message-inline-editor-actions"},Gd=["disabled"],zd={key:0,class:"message-inline-editor-error",role:"alert","data-message-inline-editor-error":""},Yd={class:"message-inline-editor-note"},Xd={key:0,class:"message-text"},Jd={key:2,class:"message-blockquote"},Qd={key:3,class:"message-list message-list-unordered"},Zd=["innerHTML"],ef={key:4,class:"message-list message-task-list"},tf=["data-checked"],nf={class:"message-list-item-text"},of=["start"],sf=["innerHTML"],af={key:6,class:"message-table-wrap"},rf={class:"message-table"},lf={key:0},cf={key:7,class:"message-code-block"},uf={class:"message-code-bar"},df={key:0,class:"message-code-language"},ff={class:"message-code-copy",role:"button",tabindex:"0","data-code-copy":""},mf={class:"message-code-pre"},hf=["innerHTML"],gf={key:8,class:"message-divider"},vf={key:9,class:"message-text"},pf=["onClick"],yf=["src"],wf=["src","alt","onError"],kf=["href","onClick"],bf=["data-hot-block"],Cf=["title","aria-label"],xf=["aria-label"],$f=["src"],_f=["src","alt"],Tf=["tabindex"],Ho=30,Oo=20,If=200,Sf=2e3,Mf=4,Lf=800,Af=800,Ff=ce({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},liveTurnId:{},isLoading:{type:Boolean},isSlowOpen:{type:Boolean},activeThreadId:{},cwd:{},hasMorePersistedAbove:{type:Boolean},isLoadingPersistedAbove:{type:Boolean},loadEarlierMessages:{type:Function},editSaving:{type:Boolean},editFailure:{}},emits:["forkThread","rollback","editMessage","respondServerRequest","fileChangesChanged"],setup(e,{expose:n,emit:s}){function r(t){return di(t,i.cwd,U)}function m(t){return ut(t,i.cwd)}const i=e,h=Tu({getCwd:()=>i.cwd,isVideoMediaUrl:Bt}),{highlightCacheVersion:u,hasHighlightLoaded:p,ensureHighlightJsLoaded:v,getInlineSegments:S,toBrowseUrl:y,toEditUrlFromBrowseHref:F,getMessageBlocks:M,renderListItemContentAsHtml:H,renderCachedHighlightedCodeAsHtml:J,renderMarkdownBlocksAsHtml:K,clearRenderCaches:P}=h,C=Ci({getMessages:()=>i.messages,getLiveOverlay:()=>i.liveOverlay,isCommandMessage:ft}),{hiddenGroupedCommandIds:L,isCommandExpanded:_,isCommandCompact:E,isCommandOutputCondensed:B,toggleCommandExpand:b,getWorkBlockCommands:Y,pruneCommandIdSets:V}=C,ve=$i({toEditUrlFromBrowseHref:F}),{isFileLinkContextMenuVisible:tt,fileLinkContextMenuX:dt,fileLinkContextMenuY:T,fileLinkContextBrowseUrl:A,fileLinkContextEditUrl:O,handleConversationContextMenu:Q,closeFileLinkContextMenu:fe}=ve,{isMobile:D}=Aa(),G=ki({getMessages:()=>i.messages,getLiveTurnId:()=>i.liveTurnId??"",isFileChangeMessage:jt,isCopyableAssistantMessage:$n,isReasoningMessage:qt,isPlanMessage:Nt,isFoldMember:Nn,getHiddenGroupedCommandIds:()=>L.value,isMobile:()=>D.value}),{anchoredFileChangeSummaryByAnchorId:we,hiddenFileChangeMessageIds:xe,isDiffViewerFileListOpen:me,diffViewerChanges:he,activeDiffViewerChange:$e,activeDiffViewerLines:j,toggleFileChangeSummary:_e,isFileChangeSummaryExpanded:Oe,openDiffViewer:_t,closeDiffViewer:Ne,toggleDiffViewerFileList:Qo,closeDiffViewerFileList:Zo,selectDiffViewerChange:es,readAnchoredFileChangeSummaryById:Te,isFileChangeSummaryExpandedById:ts,toggleFileChangeSummaryById:ns,readStandaloneFileChangeSummary:Me,isFileChangeSummaryVisible:vn,pruneFileChangeSummaryIds:os}=G,ss=bi({getMessages:()=>i.messages,isCopyableAssistantMessage:$n,isPlanMessage:Nt,planStepCopyMarker:Gn,buildFileChangeCopyText:r,getAnchoredFileChangeSummaries:()=>we.value}),{copiedResponseAnchorId:as,forkableTurnIndexByAnchorId:is,showCopyResponseButton:rs,isCopyableUserMessage:ls,copyUserMessage:cs,showForkResponseButton:us,copyResponse:ds}=ss,{buildFeedbackMailto:fs,feedbackMailtoBase:ms,recordVisibleFailure:hs}=Wo(),{t:U}=Ce(),pn=ms();function gs(t){if(!t)return"";const o=new Date(t);if(Number.isNaN(o.getTime()))return"";const d=new Date,k=o.getFullYear()===d.getFullYear()&&o.getMonth()===d.getMonth()&&o.getDate()===d.getDate(),R=o.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit",hour12:!1});return k?R:`${o.toLocaleDateString([],{month:"2-digit",day:"2-digit"})} ${R}`}const Ot=new WeakMap;async function yn(t){var g;const o=t.target,d=o==null?void 0:o.closest("[data-code-copy]");if(!d)return;const k=(g=d.closest(".message-code-block"))==null?void 0:g.querySelector("code");if(!k)return;try{await Ht(k.textContent??"")}catch{return}d.textContent=U("Copied"),d.dataset.copied="true";const R=Ot.get(d);R!==void 0&&window.clearTimeout(R),Ot.set(d,window.setTimeout(()=>{d.textContent=U("Copy"),delete d.dataset.copied,Ot.delete(d)},1600))}function vs(t,o){hs(o);const d=t.currentTarget;d instanceof HTMLAnchorElement&&(d.href=fs())}function ft(t){return t.messageType==="commandExecution"&&!!t.commandExecution}function wn(t){return t.messageType==="compaction.pending"}function kn(t){return t.messageType==="compaction.done"}function Nt(t){return t.messageType==="plan"||t.messageType==="plan.live"}function bn(t){return t.messageType==="modelSwitch"}function qt(t){return t.messageType==="reasoning"&&!!t.reasoning}const Vt=N(new Set);function Cn(t){return Vt.value.has(t.id)}function xn(t){const o=new Set(Vt.value);o.has(t.id)?o.delete(t.id):o.add(t.id),Vt.value=o}function Wt(t){return t.messageType==="toolCall"&&!!t.toolCall}function ps(t){return t.messageType==="turnError"}function jt(t){return t.messageType==="fileChange"&&t.fileChangeStatus==="completed"&&Array.isArray(t.fileChanges)&&t.fileChanges.length>0}function ys(t){return ft(t)||Wt(t)||jt(t)||wn(t)||kn(t)||t.messageType==="plan"?!1:lu(t)}function $n(t){return t.role==="assistant"&&!ft(t)&&t.messageType!=="worked"&&!(t.messageType??"").endsWith(".live")}const Ut=s,ae=N(null),Kt=N(null),_n=N(null),Gt=N(-1),ws=_i({isVideo:Bt}),{modalImageUrl:Tt,modalIsVideo:ks,markdownImageFailureVersion:bs,isMarkdownImageFailed:Cs,onMarkdownImageError:xs,openImageModal:Tn,closeImageModal:It}=ws,$s=xi({getActiveThreadId:()=>i.activeThreadId,getCwd:()=>i.cwd,onFileChangesChanged:()=>Ut("fileChangesChanged",i.activeThreadId),updateThreadFileChanges:za,t:U}),{fileChangeActionKey:In,isFileChangeActionable:Sn,fileChangeActionStatus:Mn,fileChangeActionErrorText:Ln,fileChangeNextAction:An,fileChangeActionLabel:Fn,runFileChangeAction:_s,resetFileChangeActions:Ts}=$s,qe=N(null),Is=$(()=>{const t=qe.value;return t?t.action==="undo"?U("Undo file changes?"):U("Redo file changes?"):""}),Ss=$(()=>{const t=qe.value;return t?t.filePathLabel?t.action==="undo"?U("Undo the changes to {file}? This modifies the working tree and Codex cannot revert it automatically.",{file:t.filePathLabel}):U("Redo the changes to {file}? This reapplies the edits to the working tree.",{file:t.filePathLabel}):t.action==="undo"?U("Undo the file changes from this turn? This modifies the working tree and Codex cannot revert it automatically."):U("Redo the file changes from this turn? This reapplies the edits to the working tree."):""}),Pe=N(!0);let ze=0,Le=0,St=0,mt=null;const Pn=new WeakSet,Ve=N(xo(i.activeThreadId)),Mt=$(()=>Ga(Ve.value,i.activeThreadId)),We=N(!1);let En=0,Ee=0,ke=null,Ae=0,ht=0;const nt=N(null);function Ms(t){const o=ae.value;if(!o||i.isLoading||i.activeThreadId!==t||Mt.value.sessionKey!==t||nt.value!=null)return null;const d=Mt.value,k={};for(const[R,g]of Be.value)!R||!Number.isFinite(g)||g<=0||(k[R]=Math.round(g*100)/100);return{coldPage:d.coldPage,expandedWarmTurns:[...d.expandedWarmTurns],distanceFromBottomPx:zo(Rt(o)),hotHeights:k}}function Lt(t=i.activeThreadId){const o=Ms(t);if(!o)return;const d=To();d[t]={v:1,coldPage:o.coldPage,expandedWarmTurns:o.expandedWarmTurns,distanceFromBottomPx:o.distanceFromBottomPx,hotHeights:o.hotHeights,savedAt:Date.now()},Ra(d),En=Date.now()}function Bn(){if(Ee)return;const t=Sf-(Date.now()-En);if(t<=0){ke&&(clearTimeout(ke),ke=null),Ee=requestAnimationFrame(()=>{Ee=0,Lt()});return}ke||(ke=setTimeout(()=>{ke=null,Bn()},t+10))}function Dn(){const t=ae.value,o=nt.value;if(Ae=0,!t||o==null){ht=0;return}const d=Rt(t);d.scrollHeightPx>d.clientHeightPx&&(t.scrollTop=Mo(d,o)),ht-=1,ht>0?Ae=requestAnimationFrame(Dn):nt.value=null}function zt(){nt.value==null||Ae||(ht=Mf,Ae=requestAnimationFrame(Dn))}function At(t){(t==null?void 0:t.type)==="visibilitychange"&&document.visibilityState!=="hidden"||(Ee&&(cancelAnimationFrame(Ee),Ee=0),ke&&(clearTimeout(ke),ke=null),Lt())}const Yt=$(()=>i.messages.filter(t=>!Nt(t)&&!bn(t))),Ye=$(()=>ja(Yt.value)),Xt=$(()=>Ua({turnCount:Ye.value.length,hotTurns:Ho,pageSize:Oo,coldPage:Mt.value.coldPage})),Jt=$(()=>Xt.value.warmStartTurn),ot=$(()=>Xt.value.warmEndTurn),Rn=$(()=>Xt.value.coldTurnCount),Qt=$(()=>Rn.value>0),Zt=$(()=>Mt.value.expandedWarmTurns),en=$(()=>{const t=Yt.value,o=Ye.value,d=[],k=Zt.value;function R(W){const ne=ie=>{var le,vo,po,yo;const Fe=((le=ie.request)==null?void 0:le.message.turnStartedAtIso)??((vo=ie.finalItem)==null?void 0:vo.message.turnStartedAtIso)??(typeof((po=ie.warm)==null?void 0:po.turn)=="number"?(yo=o[ie.warm.turn])==null?void 0:yo.userItem.turnStartedAtIso:void 0);if(!Fe)return null;const Re=Date.parse(Fe);return Number.isFinite(Re)?Re:null},ue=Qa(W.map(ie=>({key:ie.key,timestampMs:ne(ie)})));if(ue.size===0)return W;for(const ie of W){if(!ue.has(ie.key))continue;const Fe=ne(ie);Fe!==null&&(ie.timeDividerLabel=ei(Fe,{translate:U}))}return W}const g=new Map,Z=[];for(const W of i.messages){if(!bn(W))continue;const ne={from:W.modelSwitchFrom,to:W.modelSwitchTo};if(W.modelSwitchInsertAfterId){const ue=g.get(W.modelSwitchInsertAfterId)??[];ue.push(ne),g.set(W.modelSwitchInsertAfterId,ue)}else Z.push(ne)}function re(W){const ne=[];for(const ue of W){const ie=g.get(ue.message.id);ie&&ie.length>0&&(ne.push(...ie),g.delete(ue.message.id))}return ne}for(let W=Jt.value;W<ot.value;W+=1){const ne=o[W];if(!ne)continue;const ue={turn:W,userText:Ha(ne.userItem.text),assistantPreview:ne.assistantPreview,toolCount:ne.toolCount,expanded:k.has(W)},ie=k.has(W)?t.slice(ne.startIdx,ne.endIdx).map(Re=>({message:Re})):[],Fe=re(t.slice(ne.startIdx,Math.min(ne.endIdx,t.length)).map(Re=>({message:Re})));d.push({key:`warm-${W}`,warm:ue,warmItems:ie,processItems:[],fileChangeAnchorIds:[],...Fe.length>0?{dividers:Fe}:{}})}const ge=Io(t,o,ot.value),Qe=ge[0];if(!Qe)return R(d);const x=t.findIndex(W=>W.id===Qe.id),X=x>=0?t.slice(x):ge;for(const W of Oa(X,{liveOverlayActive:i.liveOverlay!==null,liveTurnId:i.liveTurnId})){const ne=W.items.find(le=>le.kind==="user"),ue=W.items.find(le=>le.kind==="final-assistant"),ie=W.items.filter(le=>le!==ne&&le!==ue&&le.message.messageType!=="worked").map(le=>({message:le.message,presentation:le.kind==="plan"?"plan":le.kind==="agent-note"?"agent-note":"process"})),Fe=W.items.map(le=>le.message.id).filter(le=>!!Te(le)),Re=re(W.items);d.push({key:W.key,warmItems:[],request:ne?{message:ne.message}:void 0,processItems:ie,fileChangeAnchorIds:Fe,finalItem:ue?{message:ue.message,presentation:"final-assistant"}:void 0,...Re.length>0?{dividers:Re}:{}})}const ee=[...Z,...g.values()].flat();return ee.length>0&&(d.length>0?d[0]={...d[0],leadingDividers:[...d[0].leadingDividers??[],...ee]}:d.push({key:"leading-divider",warmItems:[],processItems:[],fileChangeAnchorIds:[],leadingDividers:ee})),R(d)}),Ls=$(()=>bu(i.messages));function As(t){var d,k;const o=((d=t.request)==null?void 0:d.message.turnId)??((k=t.finalItem)==null?void 0:k.message.turnId);return o?Ls.value[o]:void 0}function Hn(){const t=ae.value,o=i.activeThreadId;t&&lo(t),Ve.value=Na(Ve.value,i.activeThreadId),t&&uo(o)}function Fs(t){Ve.value=So(Ve.value,i.activeThreadId,t,!Zt.value.has(t))}const On=$(()=>Ye.value.map((t,o)=>({turn:o,text:qa(t.userItem.text)}))),Ps=$(()=>Math.max(0,On.value.length-1)),Es=$(()=>{const t=new Map;return Ye.value.forEach((o,d)=>{t.set(o.userItem.id,d)}),t});function tn(t){return`question-anchor-${t}`}function Bs(t){const o=Es.value.get(t.id);if(o!==void 0&&!(o<ot.value))return tn(o)}function Ds(t){if(t<ot.value){let o=Ve.value;if(t<Jt.value){const d=Va({turn:t,turnCount:Ye.value.length,hotTurns:Ho,pageSize:Oo});o=Wa(o,i.activeThreadId,d)}o=So(o,i.activeThreadId,t,!0),Ve.value=o}else{const o=Ye.value[t];if(o){const d=new Set(yt.value);d.add(`turn-${o.userItem.id}`),yt.value=d}}Pe.value=!1,on(),Un(),Ie().then(()=>{const o=ae.value,d=document.getElementById(tn(t));if(!o||!d)return;const k=d.getBoundingClientRect(),R=o.getBoundingClientRect(),g=o.scrollTop+k.top-R.top-12;o.scrollTo({top:Math.max(0,g),behavior:"smooth"})})}const Rs=$(()=>{const t=Yt.value,o=Ye.value,d=[];for(let Z=Jt.value;Z<ot.value;Z+=1){if(!Zt.value.has(Z))continue;const re=o[Z];re&&d.push(...t.slice(re.startIdx,re.endIdx))}const k=Io(t,o,ot.value),R=k[0];if(!R)return d;const g=t.findIndex(Z=>Z.id===R.id);return d.push(...g>=0?t.slice(g):k),d}),Ft=$(()=>au(Rs.value)),gt=$(()=>{var o;const t=new Map;for(const d of Ft.value){const k=((o=d.messages[0])==null?void 0:o.id)??"";k&&t.set(k,d)}return t}),Hs=$(()=>{const t=new Set;for(const o of Ft.value)for(const d of o.messages)t.add(d.id);return t}),Os=$(()=>{var d;const t=new Set,o=k=>L.value.has(k.id)||xe.value.has(k.id);for(const k of Ft.value)su(k,o)&&t.add(((d=k.messages[0])==null?void 0:d.id)??"");return t}),Ns=$(()=>{const t=new Set;for(const o of Ft.value)t.add(o.turnId);return t});function qs(t){return gt.value.has(t.id)}function Nn(t){return Hs.value.has(t.id)}function Vs(t){var o;return((o=gt.value.get(t.id))==null?void 0:o.messages)??[]}function Ws(t){return cc(Vs(t))}function js(t){var o;return t.type==="batch"?`tool-batch-${t.kind}-${((o=t.messages[0])==null?void 0:o.id)??""}`:t.message.id}function Us(t){const o=gt.value.get(t.id);return o?iu(o,{t:U,formatDuration:cn}):""}function Ks(t){var o;return((o=gt.value.get(t.id))==null?void 0:o.running)??!1}function Gs(t){var o;return((o=gt.value.get(t.id))==null?void 0:o.hasOutsideContent)??!0}function zs(t){return t.messageType==="worked"}const qn=$(()=>i.hasMorePersistedAbove===!0),je=N(null),vt=$(()=>en.value.filter(t=>t.warm!==void 0).map(t=>{var o,d,k;return{turn:t.warm!==void 0?t.warm.turn:-1,collapsed:t.warm!==void 0?!t.warm.expanded:!0,hasTimeDivider:t.timeDividerLabel!==void 0,leadingModelSwitchCount:((o=t.leadingDividers)==null?void 0:o.length)??0,trailingModelSwitchCount:((d=t.dividers)==null?void 0:d.length)??0,hasAssistantPreview:(((k=t.warm)==null?void 0:k.assistantPreview)??"").length>0}})),Ys=$(()=>{const t=je.value;if(!t)return null;const o=vt.value[t.window.first];return o?`warm-${o.turn}`:null}),Xs=$(()=>{const t=je.value;if(!t)return null;const o=vt.value[t.window.last];return o?`warm-${o.turn}`:null}),Js=$(()=>{var t;return((t=je.value)==null?void 0:t.spacers.topMarginPx)??0}),Vn=$(()=>{var t;return((t=je.value)==null?void 0:t.spacers.bottomSpacerPx)??0}),Qs=$(()=>{const t=je.value;if(!t)return null;const o=vt.value,d=new Set;for(let k=t.window.first;k<=t.window.last;k+=1){const R=o[k];R&&d.add(R.turn)}return d});function Zs(t){const o=Qs.value;return o===null||o.has(t)}function nn(t,o){if(!o||t.key!==Ys.value)return;const d=Js.value;if(!(d<=0))return{marginTop:`${d}px`}}let st=0;function pt(){st||(st=requestAnimationFrame(()=>{st=0,on(),Un()}))}function on(){const t=ae.value,o=vt.value;if(!t||o.length===0){je.value=null;return}const d=t.querySelector(".conversation-hot-anchor")??t.querySelector("li.conversation-turn");if(!d){je.value=null;return}const k=t.getBoundingClientRect(),g=d.getBoundingClientRect().top-k.top+t.scrollTop-(t.scrollTop+t.clientHeight),Z=Number.parseFloat(window.getComputedStyle(t).rowGap),re=Number.isFinite(Z)&&Z>0?Z:12;je.value=vu({specs:o,gapPx:re,viewportBottomDistancePx:g,viewportHeightPx:t.clientHeight,overscanPx:Lf})}pe([vt,Qt,qn],()=>{Ie(pt)});const Ue=N(null),Be=N(new Map),yt=N(new Set),Xe=$(()=>en.value.filter(t=>t.warm===void 0).map(t=>({key:t.key,measuredHeightPx:Be.value.get(t.key)}))),ea=$(()=>{var t;return((t=Xe.value[0])==null?void 0:t.key)??null}),ta=$(()=>{const t=Ue.value;if(!t)return null;const o=Xe.value[t.window.first];return o?o.key:null}),na=$(()=>{const t=Ue.value;if(!t)return null;const o=Xe.value[t.window.last];return o?o.key:null}),Wn=$(()=>{var t;return((t=Ue.value)==null?void 0:t.spacers.topSpacerPx)??0}),jn=$(()=>{var t;return((t=Ue.value)==null?void 0:t.spacers.bottomSpacerPx)??0}),oa=$(()=>{const t=Ue.value;if(!t)return null;const o=new Set(yt.value);for(let d=t.window.first;d<=t.window.last;d+=1){const k=Xe.value[d];k&&o.add(k.key)}return o});function sa(t){const o=oa.value;return o===null||o.has(t)}function Un(){const t=ae.value,o=Kt.value,d=Xe.value;if(!t||!o||d.length===0){Ue.value=null;return}const k=t.getBoundingClientRect(),R=o.getBoundingClientRect(),g=Number.parseFloat(window.getComputedStyle(t).rowGap),Z=Number.isFinite(g)&&g>0?g:12,re=R.top-k.top+t.scrollTop-Z;Ue.value=ku({specs:d,gapPx:Z,viewportBottomDistancePx:re-(t.scrollTop+t.clientHeight),viewportHeightPx:t.clientHeight,overscanPx:Af,forcedKeys:yt.value})}function aa(t){const o=ae.value;if(!o)return null;const d=CSS.escape(t),k=Array.from(o.querySelectorAll(`[data-hot-block="${d}"], [data-turn-key="${d}"]`));if(k.length===0)return null;for(const re of k){const ge=re.querySelectorAll("img");for(const Qe of ge)if(!Qe.complete)return null}let R=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY;for(const re of k){const ge=re.getBoundingClientRect();ge.top<R&&(R=ge.top),ge.bottom>g&&(g=ge.bottom)}const Z=g-R;return Number.isFinite(Z)&&Z>0?Z:null}let at=0,it=null;function Kn(t){it||(it=new Set);for(const o of t)it.add(o);at||(at=requestAnimationFrame(()=>{at=0;const o=it;if(it=null,!o||o.size===0)return;const d=ae.value;if(!d)return;const k=new Map(Be.value);let R=!1;for(const g of o){const Z=CSS.escape(g);if(!d.querySelector(`[data-hot-block="${Z}"], [data-turn-key="${Z}"]`))continue;const ge=aa(g);if(ge===null){k.delete(g)&&(R=!0);continue}k.get(g)!==ge&&(k.set(g,ge),R=!0)}R&&(Be.value=k,Ie(pt))}))}pe(Xe,()=>{Ie(pt)}),pe(()=>i.activeThreadId,()=>{Be.value=new Map,yt.value=new Set,Ue.value=null,Ie(pt)});const ia=$(()=>!Pe.value&&(i.messages.length>0||i.pendingRequests.length>0||!!i.liveOverlay));function Gn(t){switch(t){case"completed":return"[x]";case"inProgress":return"[~]";default:return"[ ]"}}function ra(t){const o=is.value[t];typeof o=="number"&&i.activeThreadId&&Ut("forkThread",{threadId:i.activeThreadId,turnIndex:o})}const zn=$(()=>{const t={};for(const o of i.messages){if(!Ka(o)||typeof o.turnIndex!="number")continue;const d=typeof o.turnId=="string"&&o.turnId.length>0?o.turnId:"";!d||o.text.trim().length===0||(t[o.id]=d)}return t});function la(t){return typeof zn.value[t.id]=="string"}const be=N(null),rt=N(null),Yn=N(null);function ca(t){Yn.value=t instanceof HTMLTextAreaElement?t:null}function Xn(t){var o;return((o=be.value)==null?void 0:o.messageId)===t}pe(be,async t=>{if(!t)return;await Ie();const o=Yn.value;o&&(o.focus(),o.setSelectionRange(o.value.length,o.value.length))});function ua(t){const o=zn.value[t];if(!o)return;const d=i.messages.find(k=>k.id===t);!d||d.text.trim().length===0||(be.value={messageId:t,turnId:o,text:d.text})}function Jn(){be.value=null,rt.value=null}function da(){var k;const t=be.value;if(!t)return;const o=t.text.trim(),d=((k=i.messages.find(R=>R.id===t.messageId))==null?void 0:k.text.trim())??"";if(!o||o===d){be.value=null,rt.value=null;return}rt.value={messageId:t.messageId,turnId:t.turnId,text:t.text},Ut("editMessage",{turnId:t.turnId,text:o})}pe(()=>i.editSaving===!0,(t,o)=>{!o||t||i.editFailure||(be.value=null,rt.value=null)});const Qn=$(()=>be.value&&rt.value&&be.value.messageId===rt.value.messageId?i.editFailure??"":"");function Zn(t,o){In(t)&&(qe.value={kind:"file-change",summary:t,action:o})}function eo(t,o){!t||!In(t)||!o.path||(qe.value={kind:"file-change",summary:t,action:"undo",filePaths:[o.path],filePathLabel:m(o.path)})}function fa(){const t=qe.value;qe.value=null,t&&_s(t.summary,t.action,t.filePaths)}function ma(t){if(!t)return null;const o=t.querySelectorAll(".conversation-item-final");if(o.length>0)return o[o.length-1];const d=t.querySelectorAll(".conversation-turn-final");if(d.length>0)return d[d.length-1];const k=t.querySelectorAll("li.conversation-turn");return k.length>0?k[k.length-1]:null}function ha(){const t=ma(ae.value);if(!t)return;const o=t.getAttribute("tabindex");t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0}),t.addEventListener("focusout",()=>{o===null?t.removeAttribute("tabindex"):t.setAttribute("tabindex",o)},{once:!0})}function to(t){t.key==="Tab"&&!t.shiftKey&&!t.defaultPrevented&&(Gt.value=-1)}function no(){const t=_n.value,o=typeof document<"u"?document.activeElement:null;!t||!o||o===t||t.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_FOLLOWING&&(Gt.value=0)}function ga(t,o){t.scrollTop=Mo(Rt(t),o)}function va(){const t=ae.value,o=Kt.value;!t||!o||oo(t)||ga(t,0)}function oo(t){return ti(Rt(t))}function pa(){if(ae.value&&Pe.value){Pt();return}}function Pt(){ae.value&&va()}function Et(){return Pe.value}function so(){if(!Et()){St=0,Le=0;return}if(Pt(),St-=1,St<=0){Le=0;return}Le=requestAnimationFrame(so)}function wt(t=6){Et()&&(Le&&(cancelAnimationFrame(Le),Le=0),St=Math.max(t,1),Le=requestAnimationFrame(so))}function ao(){wt(3)}function io(){Pe.value=!0,Pt(),wt(4)}let Ke=null;function ro(t){return t.querySelector(".conversation-hot-anchor")??t.querySelector("li.conversation-item")}function lo(t){if(Ke)return;const o=ro(t);o&&(Ke={anchor:o,lastTop:o.getBoundingClientRect().top})}function co(){const t=Ke,o=ae.value;if(!t||!o){Ke=null;return}if(!t.anchor.isConnected){const R=ro(o);if(!R){Ke=null;return}Ke={anchor:R,lastTop:R.getBoundingClientRect().top};return}const d=t.anchor.getBoundingClientRect().top,k=d-t.lastTop;k!==0&&(o.scrollTop+=k,t.lastTop=d-k)}function kt(){Ke=null}function uo(t){const o=()=>i.activeThreadId!==t||!Ke;Ie().then(()=>{if(o()){kt();return}co()}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{Ie().then(()=>{if(o()){kt();return}co(),kt()})})})}async function fo(){var d;const t=ae.value;if(!t||!i.hasMorePersistedAbove||We.value||i.isLoadingPersistedAbove===!0)return;We.value=!0;const o=i.activeThreadId;lo(t);try{await((d=i.loadEarlierMessages)==null?void 0:d.call(i,o)),i.activeThreadId===o?(await Ie(),uo(o)):kt()}finally{We.value=!1}}n({jumpToLatest:io});function ya(){if(!Et())return;const t=ae.value;if(!t)return;const o=t.querySelectorAll("img.message-image-preview");for(const d of o)d.complete||Pn.has(d)||(Pn.add(d),d.addEventListener("load",ao,{once:!0}),d.addEventListener("error",ao,{once:!0}))}let De=null,Je=null;function mo(){const t=ae.value;if(!(!t||!De))for(const o of Array.from(t.children))De.observe(o)}function ho(){Et()&&wt(2)}function wa(t){const o=[];for(const d of t){const k=d.target;if(!k.isConnected)continue;if(k===ae.value){Be.value.size>0&&(Be.value=new Map,Kn(Xe.value.map(g=>g.key)));continue}const R=k.dataset.hotBlock??k.dataset.turnKey;R&&o.push(R)}o.length>0&&Kn(o),ho()}function ka(){if(De||Je||typeof ResizeObserver>"u"||typeof MutationObserver>"u")return;const t=ae.value;t&&(De=new ResizeObserver(wa),De.observe(t),mo(),Je=new MutationObserver(()=>{mo(),ho()}),Je.observe(t,{childList:!0}))}function ba(){De==null||De.disconnect(),De=null,Je==null||Je.disconnect(),Je=null}async function bt(){return mt||(mt=Ie().then(()=>new Promise(t=>{ze&&cancelAnimationFrame(ze),ze=requestAnimationFrame(()=>{ze=0,mt=null,pa(),on(),ya(),wt(),t()})})),mt)}pe(()=>i.messages,async t=>{if(i.isLoading)return;const o=new Set(t.filter(d=>d.messageType==="commandExecution"&&d.commandExecution).map(d=>d.id));V(o),os(),await bt(),zt()}),pe(()=>i.messages.some(t=>t.text.includes("```")),t=>{!t||p()||v()},{immediate:!0}),pe(()=>i.pendingRequests,async()=>{i.isLoading||await bt()},{deep:!0}),pe(()=>i.liveOverlay,async t=>{t&&Pe.value&&(await Ie(),Pt(),wt(8))},{deep:!0}),pe(()=>i.isLoading,async()=>{await bt()}),pe(()=>i.activeThreadId,(t,o)=>{o&&o!==i.activeThreadId&&Lt(o)},{flush:"sync"});function go(){Pe.value=!0,Ae&&(cancelAnimationFrame(Ae),Ae=0),ht=0,nt.value=null;let t=null;const o=To()[i.activeThreadId];o&&(t={sessionKey:i.activeThreadId,expandedWarmTurns:new Set(o.expandedWarmTurns),coldPage:o.coldPage},Be.value.size===0&&Object.keys(o.hotHeights).length>0&&(Be.value=new Map(Object.entries(o.hotHeights))),o.distanceFromBottomPx>un&&(nt.value=o.distanceFromBottomPx,Pe.value=!1)),Ve.value=t??xo(i.activeThreadId)}pe(()=>i.activeThreadId,async()=>{Tt.value="",We.value=!1,Ts(),go(),await bt(),zt()},{flush:"post"}),$o(()=>{ka(),go(),bt(),zt(),window.addEventListener("pagehide",At),window.addEventListener("visibilitychange",At)}),$o(()=>{document.addEventListener("keydown",to),document.addEventListener("focusin",no)}),$t(()=>{document.removeEventListener("keydown",to),document.removeEventListener("focusin",no)});function Ca(){const t=ae.value;!t||i.isLoading||(Pe.value=oo(t),pt(),Bn(),t.scrollTop<If&&!We.value&&(Qt.value?Hn():i.hasMorePersistedAbove===!0&&fo()))}const sn=/\.(mp4|m4v|webm|mov|mkv|ogv|ogg|mpeg|avi)$/iu;function Bt(t){const o=t.trim();if(!o)return!1;if(o.startsWith("data:video/"))return!0;try{const d=new URL(o,window.location.href);return sn.test(d.pathname)?!0:d.pathname==="/codex-local-image"?sn.test(d.searchParams.get("path")??""):!1}catch{return sn.test(o)}}return $t(()=>{P(),at&&(cancelAnimationFrame(at),at=0),it=null,ze&&(cancelAnimationFrame(ze),ze=0),st&&(cancelAnimationFrame(st),st=0),Le&&(cancelAnimationFrame(Le),Le=0),kt(),ba(),window.removeEventListener("pagehide",At),window.removeEventListener("visibilitychange",At),Ee&&(cancelAnimationFrame(Ee),Ee=0),ke&&(clearTimeout(ke),ke=null),Ae&&(cancelAnimationFrame(Ae),Ae=0),Lt()}),(t,o)=>(a(),l(q,null,[f("section",{class:"conversation-root","data-thread-id":i.activeThreadId,onContextmenuCapture:o[5]||(o[5]=(...d)=>c(Q)&&c(Q)(...d)),onClick:yn,onKeydown:_o(yn,["enter"])},[e.isLoading&&e.messages.length>0?(a(),l("div",Su,w(c(U)("Loading messages...")),1)):I("",!0),e.isLoading&&e.messages.length===0?(a(),l("p",Mu,w(c(U)("Loading messages...")),1)):I("",!0),e.isSlowOpen?(a(),l("p",Lu,w(c(U)("Still loading — the first open of a large history can take a while.")),1)):I("",!0),e.messages.length===0&&e.pendingRequests.length===0&&!e.liveOverlay&&!e.isSlowOpen?(a(),l("p",Au,w(c(U)("No messages in this thread yet. Type a message below to get started.")),1)):I("",!0),f("ul",{ref_key:"conversationListRef",ref:ae,class:"conversation-list",onScroll:Ca},[qn.value?(a(),l("li",Fu,[f("button",{type:"button",class:"load-more-button",disabled:We.value||e.isLoadingPersistedAbove,onClick:fo},w(We.value||e.isLoadingPersistedAbove?c(U)("Loading…"):c(U)("Load earlier messages")),9,Pu)])):I("",!0),Qt.value?(a(),l("li",Eu,[f("button",{type:"button",class:"load-more-button",disabled:We.value,onClick:Hn},w(c(U)("Load earlier ({n} turns)",{n:Rn.value})),9,Bu)])):I("",!0),(a(!0),l(q,null,z(en.value,d=>(a(),l(q,{key:d.key},[d.warm===void 0&&d.key===ea.value?(a(),l("li",Du)):I("",!0),d.warm===void 0&&d.key===ta.value&&Wn.value>0?(a(),l("li",{key:1,"aria-hidden":"true",class:"conversation-hot-spacer-top",style:Se({height:`${Wn.value}px`})},null,4)):I("",!0),(d.warm?Zs(d.warm.turn):sa(d.key))?(a(),l(q,{key:2},[d.timeDividerLabel?(a(),l("li",{key:0,class:"conversation-item conversation-item-time-divider","data-role":"system","data-message-type":"timeDivider","data-hot-block":d.key,style:Se(nn(d,!0))},[te(cl,{label:d.timeDividerLabel},null,8,["label"])],12,Ru)):I("",!0),(a(!0),l(q,null,z(d.leadingDividers??[],(k,R)=>(a(),l("li",{key:`${d.key}-leading-${k.to??""}-${k.from??""}`,class:"conversation-item conversation-item-model-switch","data-role":"system","data-message-type":"modelSwitch","data-hot-block":d.key,style:Se(nn(d,!d.timeDividerLabel&&R===0))},[te(Fo,{from:k.from,to:k.to},null,8,["from","to"])],12,Hu))),128)),te(Rc,{"turn-key":d.key,warm:d.warm,"warm-items":d.warmItems,request:d.request,"process-items":d.processItems,"final-item":d.finalItem,"file-change-anchor-ids":d.fileChangeAnchorIds,"duration-ms":As(d)},{"warm-card":ct(({warm:k})=>{var R;return[f("li",{id:tn(k.turn),class:"conversation-item conversation-item-warm-card","data-role":"system","data-message-type":"warmTurn",style:Se(nn(d,!d.timeDividerLabel&&!((R=d.leadingDividers)!=null&&R.length)))},[f("div",Nu,[f("div",qu,[te(jc,{"user-text":k.userText,"assistant-preview":k.assistantPreview,"tool-count":k.toolCount,expanded:k.expanded,onToggle:g=>Fs(k.turn)},null,8,["user-text","assistant-preview","tool-count","expanded","onToggle"])])])],12,Ou)]}),"file-change":ct(({anchorMessageId:k})=>[f("div",Vu,[f("div",Wu,[c(vn)(c(Te)(k))?(a(),de(Ao,{key:0,summary:c(Te)(k),expanded:c(ts)(k),cwd:i.cwd,actionable:c(Sn)(c(Te)(k)),"action-status":c(Mn)(c(Te)(k)),"action-error-text":c(Ln)(c(Te)(k)),"next-action":c(An)(c(Te)(k)),"action-label":c(Fn)(c(Te)(k)),onToggle:R=>c(ns)(k),onOpenDiff:R=>c(_t)(c(Te)(k),R),onRequestAction:R=>Zn(c(Te)(k),R),onRequestFileAction:R=>eo(c(Te)(k),R)},null,8,["summary","expanded","cwd","actionable","action-status","action-error-text","next-action","action-label","onToggle","onOpenDiff","onRequestAction","onRequestFileAction"])):I("",!0)])])]),default:ct(({item:k,section:R})=>[(a(!0),l(q,null,z([k.message],g=>{var Z,re,ge,Qe;return a(),l(q,{key:g.id},[qs(g)&&!Os.value.has(g.id)?(a(),l("li",ju,[f("div",Uu,[f("div",Ku,[te(Wl,{label:Us(g),running:Ks(g),"has-outside-content":Gs(g)},{default:ct(()=>[(a(!0),l(q,null,z(Ws(g),x=>(a(),l(q,{key:js(x)},[x.type==="batch"?(a(),de(xc,{key:0,kind:x.kind,messages:x.messages},null,8,["kind","messages"])):(a(!0),l(q,{key:1},z([x.message],X=>(a(),l(q,{key:X.id},[!c(L).has(X.id)&&!c(xe).has(X.id)?(a(),l(q,{key:0},[ft(X)?(a(),l("div",Gu,[(a(!0),l(q,null,z(c(Y)(X),(ee,W)=>(a(),de(Bo,{key:`work-cmd-${ee.id}`,command:ee,"step-index":W,expanded:c(_)(ee),compact:c(E)(ee),"output-condensed":c(B)(ee),onToggle:ne=>c(b)(ee)},null,8,["command","step-index","expanded","compact","output-condensed","onToggle"]))),128))])):Wt(X)?(a(),de(fn,{key:1,message:X},null,8,["message"])):qt(X)?(a(),de(Eo,{key:2,message:X,expanded:Cn(X),"content-html":c(K)(X.text),onToggle:ee=>xn(X)},null,8,["message","expanded","content-html","onToggle"])):I("",!0)],64)):I("",!0)],64))),128))],64))),128))]),_:2},1032,["label","running","has-outside-content"])])])])):!Nn(g)&&!c(L).has(g.id)&&!c(xe).has(g.id)&&!(zs(g)&&Ns.value.has(g.turnId??""))&&!ys(g)?(a(),l("li",{key:1,id:Bs(g),class:oe(["conversation-item",{"conversation-item-request":R==="request","conversation-item-process":R==="process"||k.presentation==="process","conversation-item-final":R==="final"||k.presentation==="final-assistant","conversation-item-plan":k.presentation==="plan"}]),"data-role":g.role,"data-message-type":g.messageType||""},[wn(g)?(a(),l("div",Yu,[f("div",Xu,[o[7]||(o[7]=f("span",{class:"thread-compaction-spinner","aria-hidden":"true"},null,-1)),f("span",null,w(c(U)("Compacting thread context…")),1)])])):kn(g)?(a(),l("div",Ju,[f("div",Qu,w(c(U)("Context compacted")),1)])):ft(g)?(a(),l("div",Zu,[f("div",ed,[f("div",td,[(a(!0),l(q,null,z(c(Y)(g),(x,X)=>(a(),de(Bo,{key:`work-cmd-${x.id}`,command:x,"step-index":X,expanded:c(_)(x),compact:c(E)(x),"output-condensed":c(B)(x),onToggle:ee=>c(b)(x)},null,8,["command","step-index","expanded","compact","output-condensed","onToggle"]))),128))])])])):Wt(g)?(a(),de(fn,{key:3,message:g},null,8,["message"])):jt(g)?(a(),l("div",{key:4,class:"message-row","data-role":g.role,"data-message-type":g.messageType||""},[f("div",{class:"message-stack","data-role":g.role},[f("article",{class:"message-body","data-role":g.role},[c(vn)(c(Me)(g))?(a(),de(Ao,{key:0,summary:c(Me)(g),expanded:c(Oe)(g),cwd:i.cwd,actionable:c(Sn)(c(Me)(g)),"action-status":c(Mn)(c(Me)(g)),"action-error-text":c(Ln)(c(Me)(g)),"next-action":c(An)(c(Me)(g)),"action-label":c(Fn)(c(Me)(g)),onToggle:x=>c(_e)(g),onOpenDiff:x=>c(_t)(c(Me)(g),x),onRequestAction:x=>Zn(c(Me)(g),x),onRequestFileAction:x=>eo(c(Me)(g),x)},null,8,["summary","expanded","cwd","actionable","action-status","action-error-text","next-action","action-label","onToggle","onOpenDiff","onRequestAction","onRequestFileAction"])):I("",!0)],8,sd)],8,od)],8,nd)):k.presentation==="plan"?(a(),l("div",ad,[f("div",id,[f("article",rd,[f("div",ld,w(c(U)("Plan")),1),(Z=c(Ct)(g))!=null&&Z.explanation?(a(),l("p",cd,w((re=c(Ct)(g))==null?void 0:re.explanation),1)):I("",!0),(ge=c(Ct)(g))!=null&&ge.steps.length?(a(),l("ol",ud,[(a(!0),l(q,null,z((Qe=c(Ct)(g))==null?void 0:Qe.steps,(x,X)=>(a(),l("li",{key:`${g.id}-plan-${X}`,"data-status":x.status},[f("span",fd,w(Gn(x.status)),1),f("span",null,w(x.step),1)],8,dd))),128))])):I("",!0)])])])):k.presentation==="agent-note"?(a(),l("div",md,[f("div",hd,[f("article",gd,[f("div",vd,w(c(U)("Agent note")),1),f("div",{class:"thread-agent-note-body",innerHTML:c(K)(g.text)},null,8,pd)])])])):(a(),l("div",{key:7,class:oe(["message-row",{"message-row-final":k.presentation==="final-assistant"}]),"data-role":g.role,"data-message-type":g.messageType||""},[f("div",{class:"message-stack","data-role":g.role},[f("article",{class:"message-body","data-role":g.role},[g.images&&g.images.length>0?(a(),l("ul",{key:0,class:oe(["message-image-list",{"message-generated-image-list":g.messageType==="imageView"}]),"data-role":g.role},[(a(!0),l(q,null,z(g.images,x=>(a(),l("li",{key:x,class:"message-image-item"},[f("button",{class:"message-image-button",type:"button",onClick:X=>c(Tn)(x)},[Bt(x)?(a(),l("video",{key:0,class:oe(["message-image-preview message-video-preview",{"message-generated-image-preview":g.messageType==="imageView"}]),src:x,controls:"",preload:"metadata"},null,10,xd)):(a(),l("img",{key:1,class:oe(["message-image-preview",{"message-generated-image-preview":g.messageType==="imageView"}]),src:x,alt:g.messageType==="imageView"?"Generated image":"Message image preview",loading:"lazy"},null,10,$d))],8,Cd)]))),128))],10,bd)):I("",!0),g.fileAttachments&&g.fileAttachments.length>0?(a(),l("div",_d,[(a(!0),l(q,null,z(g.fileAttachments,x=>(a(),l("span",{key:`${g.id}:${x.path}`,class:"message-file-chip"},[o[8]||(o[8]=f("span",{class:"message-file-chip-icon"},"📄",-1)),f("a",{class:"message-file-link message-file-chip-name",href:c(y)(x.path),target:"_blank",rel:"noopener noreferrer",title:x.path},w(x.label),9,Td)]))),128))])):I("",!0),g.imageAttachmentIds&&g.imageAttachmentIds.length>0?(a(),l("div",Id,[(a(!0),l(q,null,z(g.imageAttachmentIds,x=>(a(),l("span",{key:`${g.id}:${x}`,class:"message-file-chip message-image-attachment-chip",title:x},[o[9]||(o[9]=f("span",{class:"message-file-chip-icon"},"🖼",-1)),f("span",Md,w(c(U)("Image attachment (preview unavailable)")),1)],8,Sd))),128))])):I("",!0),g.skills&&g.skills.length>0?(a(),l("div",Ld,[(a(!0),l(q,null,z(g.skills,x=>(a(),l("a",{key:`${g.id}:${x.path}`,class:"message-skill-chip",href:c(y)(x.path),title:x.path},[f("span",Fd,w(c(U)("Skill")),1),f("span",Pd,w(x.name),1)],8,Ad))),128))])):I("",!0),g.audioSources&&g.audioSources.length>0?(a(),l("div",Ed,[(a(!0),l(q,null,z(g.audioSources,(x,X)=>(a(),l("audio",{key:`${g.id}:audio:${X}`,class:"message-audio-player",controls:"",preload:"metadata",src:x},null,8,Bd))),128))])):I("",!0),g.mentions&&g.mentions.length>0?(a(),l("div",Dd,[(a(!0),l(q,null,z(g.mentions,x=>(a(),l("span",{key:`${g.id}:mention:${x.name}:${x.path}`,class:"message-file-chip message-mention-chip",title:x.path||x.name},[o[10]||(o[10]=f("span",{class:"message-file-chip-icon"},"@",-1)),f("span",Hd,w(x.name),1)],8,Rd))),128))])):I("",!0),g.text.length>0?(a(),l("article",{key:6,class:"message-card","data-role":g.role},[g.isAutomationRun?(a(),l("div",Nd,[o[11]||(o[11]=f("span",null,"Sent via automation",-1)),g.automationDisplayName?(a(),l("code",qd,w(g.automationDisplayName),1)):I("",!0)])):I("",!0),g.messageType==="worked"?(a(),l("div",Vd,[f("p",Wd,w(g.text),1)])):qt(g)?(a(),de(Eo,{key:2,message:g,expanded:Cn(g),"content-html":c(K)(g.text),onToggle:x=>xn(g)},null,8,["message","expanded","content-html","onToggle"])):Xn(g.id)&&be.value?(a(),l("div",jd,[Fa(f("textarea",{ref_for:!0,ref:ca,"onUpdate:modelValue":o[0]||(o[0]=x=>be.value.text=x),class:"message-inline-editor-textarea",rows:"3",onKeydown:_o(et(Jn,["prevent"]),["esc"])},null,40,Ud),[[Pa,be.value.text]]),f("div",Kd,[f("button",{type:"button",class:"message-inline-editor-button message-inline-editor-primary",disabled:e.editSaving,onClick:da},w(e.editSaving?c(U)("Saving…"):c(U)("Save")),9,Gd),f("button",{type:"button",class:"message-inline-editor-button",onClick:Jn},w(c(U)("Cancel")),1)]),Qn.value?(a(),l("p",zd,w(Qn.value),1)):I("",!0),f("p",Yd,w(c(U)("Saving rolls this turn back and resends it with your changes. Later replies will be removed.")),1)])):Ea([g.id,g.text,i.cwd,c(u),c(bs)],()=>(a(),l("div",{key:4,class:"message-text-flow"},[(a(!0),l(q,null,z(c(M)(g),(x,X)=>(a(),l(q,{key:`block-${X}`},[x.kind==="paragraph"?(a(),l("p",Xd,[te(lt,{segments:c(S)(x.value),"to-browse-url":c(y)},null,8,["segments","to-browse-url"])])):x.kind==="heading"?(a(),de(Ba(c(Uo)(x.level)),{key:1,class:oe(["message-heading",c(Ko)(x.level)])},{default:ct(()=>[te(lt,{segments:c(S)(x.value),"to-browse-url":c(y)},null,8,["segments","to-browse-url"])]),_:2},1032,["class"])):x.kind==="blockquote"?(a(),l("blockquote",Jd,[te(lt,{segments:c(S)(x.value),"to-browse-url":c(y)},null,8,["segments","to-browse-url"])])):x.kind==="unorderedList"?(a(),l("ul",Qd,[(a(!0),l(q,null,z(x.items,(ee,W)=>(a(),l("li",{key:`ul-${X}-${W}`,class:"message-list-item"},[f("div",{class:"message-list-item-content",innerHTML:c(H)(ee)},null,8,Zd)]))),128))])):x.kind==="taskList"?(a(),l("ul",ef,[(a(!0),l(q,null,z(x.items,(ee,W)=>(a(),l("li",{key:`task-${X}-${W}`,class:"message-task-item"},[f("span",{class:"message-task-checkbox","data-checked":ee.checked},w(ee.checked?"☑":"☐"),9,tf),f("div",nf,[te(lt,{segments:c(S)(ee.text),"to-browse-url":c(y)},null,8,["segments","to-browse-url"])])]))),128))])):x.kind==="orderedList"?(a(),l("ol",{key:5,class:"message-list message-list-ordered",start:x.start},[(a(!0),l(q,null,z(x.items,(ee,W)=>(a(),l("li",{key:`ol-${X}-${W}`,class:"message-list-item"},[f("div",{class:"message-list-item-content",innerHTML:c(H)(ee)},null,8,sf)]))),128))],8,of)):x.kind==="table"?(a(),l("div",af,[f("table",rf,[f("thead",null,[f("tr",null,[(a(!0),l(q,null,z(x.headers,(ee,W)=>(a(),l("th",{key:`th-${X}-${W}`,class:"message-table-head-cell",style:Se({textAlign:x.alignments[W]??"left"})},[te(lt,{segments:c(S)(ee),"to-browse-url":c(y)},null,8,["segments","to-browse-url"])],4))),128))])]),x.rows.length>0?(a(),l("tbody",lf,[(a(!0),l(q,null,z(x.rows,(ee,W)=>(a(),l("tr",{key:`tr-${X}-${W}`,class:"message-table-body-row"},[(a(!0),l(q,null,z(ee,(ne,ue)=>(a(),l("td",{key:`td-${X}-${W}-${ue}`,class:"message-table-cell",style:Se({textAlign:x.alignments[ue]??"left"})},[te(lt,{segments:c(S)(ne),"to-browse-url":c(y)},null,8,["segments","to-browse-url"])],4))),128))]))),128))])):I("",!0)])])):x.kind==="codeBlock"?(a(),l("div",cf,[f("div",uf,[x.language?(a(),l("span",df,w(x.language),1)):I("",!0),f("span",ff,w(c(U)("Copy")),1)]),f("pre",mf,[f("code",{class:"hljs",innerHTML:c(J)(x.language,x.value)},null,8,hf)])])):x.kind==="thematicBreak"?(a(),l("hr",gf)):c(Cs)(g.id,X)?(a(),l("p",vf,w(x.markdown),1)):(a(),l("button",{key:10,class:"message-image-button",type:"button",onClick:ee=>c(Tn)(x.url)},[Bt(x.url)?(a(),l("video",{key:0,class:"message-image-preview message-video-preview message-markdown-image",src:x.url,controls:"",preload:"metadata"},null,8,yf)):(a(),l("img",{key:1,class:"message-image-preview message-markdown-image",src:x.url,alt:x.alt||"Embedded message image",loading:"lazy",onError:ee=>c(xs)(g.id,X)},null,40,wf))],8,pf))],64))),128))])),o,1),ps(g)?(a(),l("a",{key:5,class:"turn-error-feedback",href:c(pn),onClick:x=>vs(x,g.text)},w(c(U)("Send feedback")),9,kf)):I("",!0)],8,Od)):I("",!0),R!=="process"&&!Xn(g.id)?(a(),de(Bl,{key:7,role:g.role,"show-edit":la(g),"show-fork":c(us)(g),"show-copy":c(rs)(g)||c(ls)(g),copied:c(as)===g.id,timestamp:gs(g.turnStartedAtIso),onEdit:x=>ua(g.id),onFork:x=>ra(g.id),onCopy:x=>g.role==="user"?c(cs)(g.id):c(ds)(g.id)},null,8,["role","show-edit","show-fork","show-copy","copied","timestamp","onEdit","onFork","onCopy"])):I("",!0)],8,kd)],8,wd)],10,yd))],10,zu)):I("",!0)],64)}),128))]),_:2},1032,["turn-key","warm","warm-items","request","process-items","final-item","file-change-anchor-ids","duration-ms"]),(a(!0),l(q,null,z(d.dividers??[],k=>(a(),l("li",{key:`${d.key}-divider-${k.to??""}-${k.from??""}`,class:"conversation-item conversation-item-model-switch","data-role":"system","data-message-type":"modelSwitch","data-hot-block":d.key},[te(Fo,{from:k.from,to:k.to},null,8,["from","to"])],8,bf))),128)),d.key===Xs.value&&Vn.value>0?(a(),l("li",{key:1,class:"conversation-warm-spacer-bottom",style:Se({height:`${Vn.value}px`}),"aria-hidden":"true"},null,4)):I("",!0),d.warm===void 0&&d.key===na.value&&jn.value>0?(a(),l("li",{key:2,"aria-hidden":"true",class:"conversation-hot-spacer-bottom",style:Se({height:`${jn.value}px`})},null,4)):I("",!0)],64)):I("",!0)],64))),128)),e.liveOverlay?(a(),de(nl,{key:2,overlay:e.liveOverlay,"feedback-mailto":c(pn)},null,8,["overlay","feedback-mailto"])):I("",!0),f("li",{ref_key:"bottomAnchorRef",ref:Kt,class:"conversation-bottom-anchor"},null,512)],544),te(Yl,{anchors:On.value,"active-turn":Ps.value,onJump:Ds},null,8,["anchors","active-turn"]),ia.value?(a(),l("button",{key:4,type:"button",class:"jump-to-latest-button",title:c(U)("Jump to latest"),"aria-label":c(U)("Jump to latest output"),onClick:io},[te(Da,{class:"icon-svg jump-to-latest-icon"})],8,Cf)):I("",!0),c(Tt).length>0?(a(),l("div",{key:5,class:"image-modal-backdrop",onClick:o[4]||(o[4]=(...d)=>c(It)&&c(It)(...d))},[f("div",{class:"image-modal-content",onClick:o[3]||(o[3]=et(()=>{},["stop"]))},[f("button",{class:"image-modal-close",type:"button","aria-label":c(U)("Close image preview"),onClick:o[2]||(o[2]=(...d)=>c(It)&&c(It)(...d))},[te(Vo,{class:"icon-svg"})],8,xf),c(ks)?(a(),l("video",{key:0,class:"image-modal-image",src:c(Tt),controls:"",autoplay:""},null,8,$f)):(a(),l("img",{key:1,class:"image-modal-image",src:c(Tt),alt:c(U)("Expanded message image")},null,8,_f))])])):I("",!0),te(Hr,{visible:c(tt),x:c(dt),y:c(T),"browse-url":c(A),"edit-url":c(O),onClose:c(fe)},null,8,["visible","x","y","browse-url","edit-url","onClose"]),te(vr,{change:c($e),changes:c(he),lines:c(j),"is-mobile":c(D),"is-file-list-open":c(me),cwd:i.cwd,onClose:c(Ne),onSelectChange:c(es),onToggleFileList:c(Qo),onCloseFileList:c(Zo)},null,8,["change","changes","lines","is-mobile","is-file-list-open","cwd","onClose","onSelectChange","onToggleFileList","onCloseFileList"]),f("h4",{ref_key:"latestResponseHeadingRef",ref:_n,class:"sr-only m-0 select-none",tabindex:Gt.value,onFocus:ha},w(c(U)("Latest response")),41,Tf)],40,Iu),te(Ai,{visible:qe.value!==null,title:Is.value,message:Ss.value,"confirm-label":"Confirm",danger:"",onConfirm:fa,onCancel:o[6]||(o[6]=d=>qe.value=null)},null,8,["visible","title","message"])],64))}}),Bf=se(Ff,[["__scopeId","data-v-ad57e5e2"]]);export{Bf as default};