codexui-android 0.1.90 → 0.1.91

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codexui-android",
3
- "version": "0.1.90",
3
+ "version": "0.1.91",
4
4
  "description": "A lightweight web interface for Codex that runs on top of the Codex app-server, allowing remote access from any browser",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,40 +0,0 @@
1
- import{_ as Bt,o as r,c as l,a as d,d as Xs,u as Js,r as x,w as V,n as Pt,b as Qs,e as Ys,t as h,f as g,F as v,g as b,h as C,i as ei,j as Rn,k as ti,l as It,m as te,I as ni,p as si,q as Wn,s as Ke,v as At,x as ne,T as ii,y as L,z as oi,A as ai}from"./index-_ysyd6_H.js";const ri={},li={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function ci(T,q){return r(),l("svg",li,[...q[0]||(q[0]=[d("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 ui=Bt(ri,[["render",ci]]),di={},fi={xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24","aria-hidden":"true"};function hi(T,q){return r(),l("svg",fi,[...q[0]||(q[0]=[d("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 pi=Bt(di,[["render",hi]]),mi={key:0,class:"conversation-loading"},vi={key:1,class:"conversation-empty"},ki={key:0,class:"conversation-load-more"},gi=["disabled"],yi=["data-role","data-message-type"],_i={key:0,class:"message-row","data-role":"system"},wi={class:"message-stack","data-role":"system"},bi=["onClick"],xi={class:"cmd-group-label"},Ci={class:"cmd-status"},$i={class:"cmd-group-inner"},Li=["onClick"],Ti={class:"cmd-label"},Mi={class:"cmd-status"},Si={class:"cmd-output-inner"},Pi=["textContent"],Ii=["onClick"],Ai={class:"cmd-label"},Fi={class:"cmd-status"},Bi={class:"cmd-output-inner"},Ei=["textContent"],Ri=["data-role","data-message-type"],Wi=["data-role"],zi=["data-role"],Oi={key:0,class:"file-change-summary-block"},Hi=["onClick"],ji={class:"file-change-summary-label"},Di={class:"file-change-summary-status"},Ui=["data-tone"],Ni={class:"file-change-panel-inner"},Vi={class:"file-change-list"},qi=["data-operation"],Ki=["title","onClick"],Zi={key:0,class:"file-change-arrow"},Gi=["title","onClick"],Xi={key:2,class:"file-change-delta"},Ji=["data-tone"],Qi=["data-role","data-message-type"],Yi=["data-role"],eo=["data-role"],to=["data-role"],no=["onClick"],so=["src"],io={key:1,class:"message-file-attachments"},oo=["href","title"],ao=["data-role"],ro={key:0,class:"worked-separator-wrap","aria-live":"polite"},lo=["onClick"],co={class:"worked-separator-text"},uo={key:0,class:"worked-details"},fo=["onClick"],ho={class:"cmd-label"},po={class:"cmd-status"},mo={class:"cmd-output-inner"},vo=["textContent"],ko=["data-streaming"],go={class:"plan-card-header"},yo={key:0,class:"plan-card-badge"},_o=["innerHTML"],wo={key:1,class:"plan-step-list"},bo=["data-status"],xo=["data-status"],Co=["innerHTML"],$o=["innerHTML"],Lo={key:2,class:"message-text-flow"},To={key:0,class:"message-text"},Mo={key:0},So={key:1,class:"message-bold-text"},Po={key:2,class:"message-italic-text"},Io={key:3,class:"message-strikethrough-text"},Ao=["href","title"],Fo={key:1},Bo=["href","title"],Eo={key:6,class:"message-inline-code"},Ro={key:0},Wo={key:1,class:"message-bold-text"},zo={key:2,class:"message-italic-text"},Oo={key:3,class:"message-strikethrough-text"},Ho=["href","title"],jo={key:1},Do=["href","title"],Uo={key:6,class:"message-inline-code"},No={key:2,class:"message-blockquote"},Vo={key:0},qo={key:1,class:"message-bold-text"},Ko={key:2,class:"message-italic-text"},Zo={key:3,class:"message-strikethrough-text"},Go=["href","title"],Xo={key:1},Jo=["href","title"],Qo={key:6,class:"message-inline-code"},Yo={key:3,class:"message-list message-list-unordered"},ea=["innerHTML"],ta={key:4,class:"message-list message-task-list"},na=["data-checked"],sa={class:"message-list-item-text"},ia={key:0},oa={key:1,class:"message-bold-text"},aa={key:2,class:"message-italic-text"},ra={key:3,class:"message-strikethrough-text"},la=["href","title"],ca={key:1},ua=["href","title"],da={key:6,class:"message-inline-code"},fa=["start"],ha=["innerHTML"],pa={key:6,class:"message-table-wrap"},ma={class:"message-table"},va={key:0},ka={key:1,class:"message-bold-text"},ga={key:2,class:"message-italic-text"},ya={key:3,class:"message-strikethrough-text"},_a=["href","title"],wa={key:1},ba=["href","title"],xa={key:6,class:"message-inline-code"},Ca={key:0},$a={key:0},La={key:1,class:"message-bold-text"},Ta={key:2,class:"message-italic-text"},Ma={key:3,class:"message-strikethrough-text"},Sa=["href","title"],Pa={key:1},Ia=["href","title"],Aa={key:6,class:"message-inline-code"},Fa={key:7,class:"message-code-block"},Ba={key:0,class:"message-code-language"},Ea={class:"message-code-pre"},Ra=["innerHTML"],Wa={key:8,class:"message-divider"},za={key:9,class:"message-text"},Oa=["onClick"],Ha=["src","alt","onError"],ja={key:3,class:"file-change-summary-block file-change-summary-block-inline"},Da=["onClick"],Ua={class:"file-change-summary-label"},Na={class:"file-change-summary-status"},Va=["data-tone"],qa={class:"file-change-panel-inner"},Ka={class:"file-change-list"},Za=["data-operation"],Ga=["title","onClick"],Xa={key:0,class:"file-change-arrow"},Ja=["title","onClick"],Qa={key:2,class:"file-change-delta"},Ya=["data-tone"],er=["data-role"],tr=["onClick"],nr=["onClick"],sr=["data-copied","aria-label","title","onClick"],ir={class:"message-copy-label"},or={key:1,class:"conversation-item conversation-item-overlay"},ar={class:"message-row"},rr={class:"message-stack"},lr={class:"live-overlay-inline","aria-live":"polite"},cr={class:"live-overlay-label"},ur={key:0,class:"live-overlay-reasoning"},dr={key:1,class:"live-overlay-error"},fr=["src"],hr={key:0,class:"diff-viewer-sidebar"},pr={class:"diff-viewer-sidebar-header"},mr={class:"diff-viewer-sidebar-count"},vr={class:"diff-viewer-sidebar-list"},kr=["data-active","onClick"],gr=["data-operation"],yr={class:"diff-viewer-file-label"},_r={key:0,class:"diff-viewer-file-delta"},wr={class:"diff-viewer-main"},br={class:"diff-viewer-toolbar"},xr={class:"diff-viewer-title-wrap"},Cr={class:"diff-viewer-title"},$r={class:"diff-viewer-subtitle"},Lr={key:0},Tr={class:"diff-viewer-toolbar-actions"},Mr={key:0,class:"diff-viewer-empty"},Sr={key:1,class:"diff-viewer-panel"},Pr={class:"diff-viewer-meta"},Ir={class:"diff-viewer-language"},Ar={class:"diff-viewer-lines"},Fr=["data-kind"],Br={class:"diff-viewer-line-number"},Er={class:"diff-viewer-line-number"},Rr={class:"diff-viewer-line-marker"},Wr=["innerHTML"],zr={class:"diff-viewer-mobile-sheet-header"},Or={class:"diff-viewer-sidebar-count"},Hr={class:"diff-viewer-mobile-sheet-list"},jr=["data-active","onClick"],Dr=["data-operation"],Ur={class:"diff-viewer-file-label"},Nr={key:0,class:"diff-viewer-file-delta"},Vr=16,Ft=50,qr=30,Kr=200,Zr=15e3,Gr=Xs({__name:"ThreadConversation",props:{messages:{},pendingRequests:{},liveOverlay:{},isLoading:{type:Boolean},activeThreadId:{},cwd:{},scrollState:{}},emits:["updateScrollState","forkThread","rollback","respondServerRequest"],setup(T,{expose:q,emit:zn}){var En;const ue=x(new Set),O=x(new Set),de=x(new Set),Ze=x(new Set),fe=x(new Set),Ge=x(null),we=x(""),K=x(!1),Et=x(null),he=x(!1),Rt=x(0),Wt=x(0),Xe=x(""),Je=x(""),pe=x({}),{isMobile:be}=Js();function On(e){var i;const n=e.replace(/\r\n/g,`
2
- `).trim();if(!n)return null;const t=[],s=[];for(const a of n.split(`
3
- `)){const u=a.trim();if(!u){t.length===0&&s.push("");continue}const o=u.match(/^[-*]\s+\[([ xX~>|-])\]\s+(.+)$/);if(o){const f=(o[1]??" ").toLowerCase();let c="pending";f==="x"&&(c="completed"),(f==="~"||f===">"||f==="-")&&(c="inProgress"),t.push({step:((i=o[2])==null?void 0:i.trim())??"",status:c});continue}s.push(u)}return t.length===0?null:{explanation:s.join(`
4
- `).trim(),steps:t.filter(a=>a.step.length>0)}}function Qe(e){var n;return e.plan&&e.plan.steps.length>0?{explanation:((n=e.plan.explanation)==null?void 0:n.trim())??"",steps:e.plan.steps}:On(e.text)}function F(e){return e.messageType==="commandExecution"&&!!e.commandExecution}function Ye(e){return e.messageType==="plan"||e.messageType==="plan.live"}function et(e){return e.messageType==="fileChange"&&e.fileChangeStatus==="completed"&&Array.isArray(e.fileChanges)&&e.fileChanges.length>0}function me(e){return e.role==="assistant"&&!F(e)&&e.messageType!=="worked"&&!(e.messageType??"").endsWith(".live")}const tt=L(()=>{var e;for(let n=k.messages.length-1;n>=0;n-=1){const t=k.messages[n];if(t.messageType==="commandExecution"&&((e=t.commandExecution)==null?void 0:e.status)==="inProgress")return t.id}return""}),zt=L(()=>k.messages.some(e=>e.role==="assistant"&&e.messageType==="agentMessage.live"&&e.text.trim().length>0)),Ot=L(()=>!!k.liveOverlay||tt.value.length>0||zt.value),nt=L(()=>{const e={};for(let n=0;n<k.messages.length;){const t=k.messages[n];if(!F(t)){n+=1;continue}const s=[];for(;n<k.messages.length&&F(k.messages[n]);)s.push(k.messages[n]),n+=1;if(s.length<=1)continue;const i=s[s.length-1];e[i.id]=s.slice(0,-1)}return e}),Hn=L(()=>{const e=new Set;for(const n of Object.values(nt.value))for(const t of n)e.add(t.id);return e});function st(e){var n;return((n=Qe(e))==null?void 0:n.explanation)??""}function it(e){var n;return((n=Qe(e))==null?void 0:n.steps)??[]}function jn(e){switch(e){case"completed":return"✓";case"inProgress":return"•";default:return"○"}}function Ht(e){return!zt.value&&e.id===tt.value}function B(e){return F(e)?ue.value.has(e.id)||!O.value.has(e.id)&&Ht(e):!1}function ot(e){return F(e)&&Ot.value}function at(e){var n;return F(e)&&(Ot.value||((n=e.commandExecution)==null?void 0:n.status)==="inProgress")}function rt(e){if(!F(e))return;const n=new Set(ue.value),t=new Set(O.value),s=Ht(e);n.has(e.id)?(n.delete(e.id),s&&t.add(e.id)):s&&!t.has(e.id)?t.add(e.id):(n.add(e.id),t.delete(e.id)),ue.value=n,O.value=t}function xe(e){return nt.value[e.id]??[]}function jt(e){return F(e)?[...xe(e),e]:[]}function Dn(e){if(xe(e).length===0)return;const t=new Set(de.value);t.has(e.id)?t.delete(e.id):t.add(e.id),de.value=t}function lt(e){return de.value.has(e.id)}function Un(e){var a,u;const t=jt(e).length,s=((u=(a=e.commandExecution)==null?void 0:a.command)==null?void 0:u.trim())||"(command)";return`${t===1?"1 command":`${t} commands`} · latest: ${s}`}function Nn(e){return $e(e)}function Vn(e){const n=new Set(Ze.value);n.has(e.id)?n.delete(e.id):n.add(e.id),Ze.value=n}function Dt(e){return Ze.value.has(e.id)}function Ut(e){const n=new Set(fe.value);n.has(e.id)?n.delete(e.id):n.add(e.id),fe.value=n}function se(e){return fe.value.has(e.id)}function M(e){return`${e.path}\0${e.movedToPath??""}`}function Ce(e,n){e&&(Ge.value=e,we.value=M(n),K.value=!1)}function Nt(){Ge.value=null,we.value="",K.value=!1}function qn(){K.value=!K.value}function Kn(){K.value=!1}function Vt(e){we.value=M(e),be.value&&(K.value=!1)}function $e(e){const n=e.commandExecution;if(!n)return"";const t=ot(e);switch(n.status){case"inProgress":return t?"Running":"⟳ Running";case"completed":return n.exitCode===0?t?"Done":"✓ Completed":`Exit ${n.exitCode??"?"}`;case"failed":return t?"Failed":"✗ Failed";case"declined":return t?"Declined":"⊘ Declined";case"interrupted":return t?"Stopped":"⊘ Interrupted";default:return""}}function Le(e){var t,s;const n=(t=e.commandExecution)==null?void 0:t.status;return n==="inProgress"?"cmd-status-running":n==="completed"&&((s=e.commandExecution)==null?void 0:s.exitCode)===0?"cmd-status-ok":"cmd-status-error"}function Te(e,n){if(e.size===0)return e;const t=new Set;for(const s of e)n.has(s)&&t.add(s);return t.size===e.size?e:t}function Zn(e,n){const t=[];for(let s=n-1;s>=0;s--){const i=e[s];if(i.messageType==="commandExecution")t.unshift(i);else if(i.role==="user"||i.messageType==="worked")break}return t}const k=T,ct=zn,Z=x(null),qt=x(null),ve=x(""),G=x(""),Gn=x(null),H=x(((En=k.scrollState)==null?void 0:En.isAtBottom)!==!1),Kt={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"};let ie=0,E=0,Me=0,oe=null;const Zt=new WeakSet,Se=x(null);let Pe=null;const Ie=new Map,Ae=new Set;let ut=0;const R=x(0),X=x(!1),Gt=L(()=>k.messages.slice(R.value)),dt=L(()=>R.value>0),Xn=L(()=>!H.value&&(k.messages.length>0||k.pendingRequests.length>0||!!k.liveOverlay));function Jn(){return Se.value?Promise.resolve():(Pe||(Pe=oi(()=>import("./common-BeuopZEI.js"),[]).then(e=>{Se.value=e.default}).finally(()=>{Pe=null})),Pe)}function Qn(e){if(!e||/[\r\n]/u.test(e)||e.endsWith("/")||e.endsWith("\\")||/^[A-Za-z][A-Za-z0-9+.-]*:\/\//u.test(e))return!1;const n=e.startsWith("/"),t=/^[A-Za-z]:[\\/]/u.test(e),s=e.startsWith("./")||e.startsWith("../")||e.startsWith("~/");return n||t||s?!0:/^[A-Za-z0-9._@() -]+(?:[\\/][A-Za-z0-9._@() -]+)+$/u.test(e)}function Fe(e){return e.replace(/\\/gu,"/").split("/").filter(Boolean).pop()||e}function j(e){return e.replace(/\\/gu,"/")}function ft(e){if(!e.startsWith("file://"))return e;let n=e.replace(/^file:\/\//u,"");try{n=decodeURIComponent(n)}catch{}return/^\/[A-Za-z]:\//u.test(n)&&(n=n.slice(1)),n}function Yn(e){const n=j(e),t=n.match(/^\/Users\/([^/]+)/u);if(t)return`/Users/${t[1]}`;const s=n.match(/^\/home\/([^/]+)/u);return s?`/home/${s[1]}`:""}function D(e){const n=j(e);if(!n)return n;let t="",s=n;const i=s.match(/^([A-Za-z]:)(\/.*)?$/u);i?(t=`${i[1]}/`,s=(i[2]??"").replace(/^\/+/u,"")):s.startsWith("/")&&(t="/",s=s.slice(1));const a=s.split("/").filter(Boolean),u=[];for(const f of a)if(f!=="."){if(f===".."){u.length>0&&u.pop();continue}u.push(f)}const o=u.join("/");return t?`${t}${o}`.replace(/\/+$/u,"")||t:o||n}function ht(e,n){const t=j(ft(e.trim()));if(!t)return"";if(t.startsWith("/")||/^[A-Za-z]:\//u.test(t))return D(t);if(t.startsWith("~/")){const a=Yn(n);if(a)return D(`${a}/${t.slice(2)}`)}const i=j(n.trim());return D(i?`${i.replace(/\/+$/u,"")}/${t}`:t)}function Be(e){const n=Number(e);return Number.isInteger(n)&&n>0?n:null}function ke(e){if(!e)return null;let n=e.trim();n=Ee(n).core.trim();let s=null,i=null;const a=n.match(/^(.*)#L(\d+)(?:C(\d+))?$/u);if(a)n=a[1],s=Be(a[2]),i=Be(a[3]);else{const u=n.match(/^(.*?):(\d+)(?::(\d+))?$/u);u&&(n=u[1],s=Be(u[2]),i=Be(u[3]))}return n=ft(n),Qn(n)?{path:n,line:s,column:i}:null}function Ee(e){let n=e,t="",s="";for(;/^[('"`[{<“‘]/u.test(n);)t+=n[0],n=n.slice(1);for(;/[)"'`\]}>”’]$/u.test(n);)s=n.slice(-1)+s,n=n.slice(0,-1);return{core:n,leading:t,trailing:s}}function pt(e){const n=e.trim();if(!n.startsWith("[")||!n.endsWith(")"))return null;const t=n.indexOf("]");if(t<=1||n[t+1]!=="(")return null;const s=n.slice(1,t).trim(),i=n.slice(t+2,-1).trim();if(s.includes(`
5
- `)||i.includes(`
6
- `))return null;const a=Ee(s).core.trim()||s,u=Ee(i).core.trim();return u?{label:a,target:u}:null}function Xt(e){const n=Math.min(6,Math.max(1,Math.trunc(e)));return`h${String(n)}`}function Jt(e){switch(Math.min(6,Math.max(1,Math.trunc(e)))){case 1:return"message-heading-h1";case 2:return"message-heading-h2";case 3:return"message-heading-h3";case 4:return"message-heading-h4";case 5:return"message-heading-h5";default:return"message-heading-h6"}}function es(e){switch(e){case"completed":return"[x]";case"inProgress":return"[~]";default:return"[ ]"}}function ts(e){var s;const n=Qe(e);if(!n)return"";const t=[];return(s=n.explanation)!=null&&s.trim()&&t.push(n.explanation.trim()),n.steps.length>0&&t.push(n.steps.map(i=>`- ${es(i.status)} ${i.step}`.trim()).join(`
7
- `)),t.join(`
8
-
9
- `).trim()}function ns(e){const n=[],t=e.text.trim()||ts(e),s=Ye(e)&&t?`Plan
10
- ${t}`:t;s&&n.push(s);const i=(e.fileAttachments??[]).map(u=>u.path.trim()).filter(u=>u.length>0);i.length>0&&n.push(`Files:
11
- ${i.join(`
12
- `)}`);const a=(e.images??[]).map(u=>u.trim()).filter(u=>u.length>0);return a.length>0&&n.push(`Images:
13
- ${a.join(`
14
- `)}`),n.join(`
15
-
16
- `).trim()}const Qt=L(()=>{var t;const e=new Map;for(const s of k.messages){if(!me(s))continue;const i=ns(s);if(!i)continue;const a=typeof s.turnIndex=="number"?`turn:${s.turnIndex}`:`message:${s.id}`,u=e.get(a);if(u){u.anchorMessageId=s.id,u.parts.push(i);continue}e.set(a,{anchorMessageId:s.id,parts:[i]})}const n={};for(const s of e.values()){const i=s.parts.join(`
17
-
18
- `).trim();i&&(n[s.anchorMessageId]=i)}for(const[s,i]of Object.entries(Re.value)){if(i.source!=="metadata")continue;const a=cs(i);if(!a)continue;const u=(t=n[s])==null?void 0:t.trim();n[s]=u?`${u}
19
-
20
- ${a}`:a}return n}),Yt=L(()=>{const e=new Map;for(const t of k.messages){if(!me(t)||typeof t.turnIndex!="number")continue;const s=`turn:${t.turnIndex}`,i=e.get(s);if(i){i.anchorMessageId=t.id,i.turnIndex=t.turnIndex;continue}e.set(s,{anchorMessageId:t.id,turnIndex:t.turnIndex})}const n={};for(const t of e.values())n[t.anchorMessageId]=t.turnIndex;return n});function en(e){return typeof Qt.value[e.id]=="string"}function ss(e){return typeof Yt.value[e.id]=="number"}function is(e,n){return e?!n||e===n?e:`${e}
21
- ${n}`.trim():n}function os(e,n){const t=e.operation==="add"||n.operation==="add"?"add":e.operation==="delete"||n.operation==="delete"?"delete":"update";return{path:n.path||e.path,operation:t,movedToPath:n.movedToPath??e.movedToPath??null,diff:is(e.diff,n.diff),addedLineCount:e.addedLineCount+n.addedLineCount,removedLineCount:e.removedLineCount+n.removedLineCount}}function as(e,n){const t=e.operation==="add"?0:e.operation==="update"?1:2,s=n.operation==="add"?0:n.operation==="update"?1:2;if(t!==s)return t-s;const i=`${e.path}\0${e.movedToPath??""}`,a=`${n.path}\0${n.movedToPath??""}`;return i.localeCompare(a)}function mt(e){const n=new Map;for(const t of e){const s=`${t.path}\0${t.movedToPath??""}`,i=n.get(s);n.set(s,i?os(i,t):{...t})}return Array.from(n.values()).sort(as)}const Re=L(()=>{const e=new Map,n=new Map,t=new Map;for(const i of k.messages){if(me(i)&&typeof i.turnIndex=="number"&&(e.set(`turn:${i.turnIndex}`,i.id),Array.isArray(i.fileChanges)&&i.fileChanges.length>0&&n.set(i.id,{changes:mt(i.fileChanges),sourceMessageIds:[],source:"assistant"})),!et(i))continue;const a=typeof i.turnIndex=="number"?`turn:${i.turnIndex}`:`message:${i.id}`,u=t.get(a);u?u.push(i):t.set(a,[i])}const s={};for(const[i,a]of t.entries()){const u=e.get(i);u&&(s[u]={changes:mt(a.flatMap(o=>o.fileChanges??[])),sourceMessageIds:a.map(o=>o.id),source:"metadata"})}for(const[i,a]of n.entries())s[i]||(s[i]=a);return s}),vt=L(()=>{const e=new Map,n=new Map;for(const s of k.messages){if(me(s)&&typeof s.turnIndex=="number"&&e.set(`turn:${s.turnIndex}`,s.id),!et(s))continue;const i=typeof s.turnIndex=="number"?`turn:${s.turnIndex}`:`message:${s.id}`,a=n.get(i);a?a.push(s):n.set(i,[s])}const t={};for(const[s,i]of n.entries()){if(e.has(s))continue;const a=i[i.length-1];a&&(t[a.id]={changes:mt(i.flatMap(u=>u.fileChanges??[])),sourceMessageIds:i.map(u=>u.id),source:"metadata"})}return t}),rs=L(()=>{const e=new Set;for(const n of Object.values(Re.value))for(const t of n.sourceMessageIds)e.add(t);for(const[n,t]of Object.entries(vt.value))for(const s of t.sourceMessageIds)s!==n&&e.add(s);return e});function ae(e){return Re.value[e.id]??null}function re(e){return vt.value[e.id]??null}function le(e){return e.operation==="update"&&e.movedToPath?e.addedLineCount>0||e.removedLineCount>0?"Moved + edited":"Moved":e.operation==="add"?"Added":e.operation==="delete"?"Deleted":"Edited"}function We(e){return e.operation==="update"&&e.movedToPath?"move":e.operation}function J(e){const n=[];return e.addedLineCount>0&&n.push(`+${e.addedLineCount}`),e.removedLineCount>0&&n.push(`-${e.removedLineCount}`),n.join(" ")}function tn(e,n,t=""){const s=[];return e>0&&s.push({tone:"add",label:`+${e}`}),n>0&&s.push({tone:"remove",label:`-${n}`}),s.length>0?s:t?[{tone:"neutral",label:t}]:[]}function nn(e){return tn(e.addedLineCount,e.removedLineCount)}function ze(e){return e===1?"1 file changed":`${e} files changed`}function ls(e){if(!e||e.changes.length===0)return"";let n=0,t=0,s=0,i=0;for(const u of e.changes){if(u.operation==="add"){n+=1;continue}if(u.operation==="delete"){t+=1;continue}if(u.movedToPath){i+=1;continue}s+=1}const a=[];return s>0&&a.push(`${s} edited`),n>0&&a.push(`${n} added`),t>0&&a.push(`${t} deleted`),i>0&&a.push(`${i} moved`),a.join(", ")}function sn(e){if(!e||e.changes.length===0)return"Modified files";const n=ze(e.changes.length),t=ls(e);return t?`${n} · ${t}`:n}function on(e){if(!e||e.changes.length===0)return[];const n=e.changes.reduce((i,a)=>i+a.addedLineCount,0),t=e.changes.reduce((i,a)=>i+a.removedLineCount,0),s=e.changes.some(i=>i.movedToPath)?"Moved":"Ready";return tn(n,t,s)}function P(e){const n=ht(e,k.cwd),t=D(j(k.cwd.trim())),s=D(j(n));return t&&s.startsWith(`${t}/`)?s.slice(t.length+1):e}function cs(e){return!e||e.changes.length===0?"":`Modified files:
22
- ${e.changes.map(t=>{const s=P(t.path),i=t.movedToPath?` -> ${P(t.movedToPath)}`:"",a=J(t);return`- ${le(t)}: ${s}${i}${a?` (${a})`:""}`}).join(`
23
- `)}`.trim()}const ce=L(()=>{var e;return((e=Ge.value)==null?void 0:e.changes)??[]}),I=L(()=>{const e=ce.value;return e.length===0?null:e.find(n=>M(n)===we.value)??e[0]});function us(e){var s;const t=((s=(e.movedToPath||e.path).split(".").pop())==null?void 0:s.toLowerCase())??"";return Kt[t]??t??""}function ds(e){return e.operation==="update"&&/^diff --git |^@@ |^--- |^\+\+\+ |^[ +-]|^\*\*\* (Move to:|End of File)/mu.test(e.diff)}function fs(e){const n=e.diff.replace(/\r\n/g,`
24
- `),t=n.length>0?n.split(`
25
- `):[];return t.length>0&&t[t.length-1]===""&&t.pop(),t.map((s,i)=>({key:`${M(e)}:synthetic:${i}`,kind:e.operation==="delete"?"remove":"add",oldLine:e.operation==="delete"?i+1:null,newLine:e.operation==="delete"?null:i+1,text:s}))}function hs(e){const n=e.diff.replace(/\r\n/g,`
26
- `),t=n.length>0?n.split(`
27
- `):[];t.length>0&&t[t.length-1]===""&&t.pop();const s=[];let i=0,a=0;for(const[u,o]of t.entries()){const f=o.match(/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/u);if(f){i=Number(f[1]),a=Number(f[2]),s.push({key:`${M(e)}:hunk:${u}`,kind:"hunk",oldLine:null,newLine:null,text:o});continue}if(o.startsWith("+")&&!o.startsWith("+++")){s.push({key:`${M(e)}:add:${u}`,kind:"add",oldLine:null,newLine:a,text:o.slice(1)}),a+=1;continue}if(o.startsWith("-")&&!o.startsWith("---")){s.push({key:`${M(e)}:remove:${u}`,kind:"remove",oldLine:i,newLine:null,text:o.slice(1)}),i+=1;continue}if(o.startsWith(" ")){s.push({key:`${M(e)}:context:${u}`,kind:"context",oldLine:i,newLine:a,text:o.slice(1)}),i+=1,a+=1;continue}s.push({key:`${M(e)}:meta:${u}`,kind:"meta",oldLine:null,newLine:null,text:o})}return s}function ps(e){return!e||!e.diff.trim()?[]:ds(e)?hs(e):fs(e)}const ms=L(()=>ps(I.value));function vs(e){return!!(e!=null&&e.diff.trim())}function ks(e){return e.kind==="add"?"+":e.kind==="remove"?"-":e.kind==="hunk"?"@@":""}function gs(e){if(typeof document>"u")return!1;const n=document.createElement("textarea");n.value=e,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.left="-9999px",n.style.opacity="0",n.style.pointerEvents="none",document.body.appendChild(n),n.focus(),n.select(),n.setSelectionRange(0,e.length);try{return document.execCommand("copy")}catch{return!1}finally{document.body.removeChild(n)}}async function ys(e){var s;const n=Qt.value[e]??"";if(!n)return;let t=!1;if(typeof navigator<"u"&&((s=navigator.clipboard)!=null&&s.writeText))try{await navigator.clipboard.writeText(n),t=!0}catch{t=!1}t||(t=gs(n)),t&&(G.value=e,oe&&clearTimeout(oe),oe=setTimeout(()=>{G.value===e&&(G.value=""),oe=null},1800))}function _s(e){const n=Yt.value[e];typeof n=="number"&&k.activeThreadId&&ct("forkThread",{threadId:k.activeThreadId,turnIndex:n})}const an=L(()=>{const e=new Map;for(const t of k.messages){if(!me(t)||typeof t.turnIndex!="number")continue;const s=typeof t.turnId=="string"&&t.turnId.length>0?t.turnId:"";if(!s)continue;const i=`turn:${t.turnIndex}`,a=e.get(i);if(a){a.anchorMessageId=t.id,a.turnId=s;continue}e.set(i,{anchorMessageId:t.id,turnId:s})}const n={};for(const t of e.values())n[t.anchorMessageId]=t.turnId;return n});function rn(e){return typeof an.value[e.id]=="string"}function ws(e){const n=an.value[e];n&&ct("rollback",{turnId:n})}function kt(e){const n=[],t=new RegExp("https?:\\/\\/[^\\s<>\"'`,。;:!?、()[\\]{}「」『』《》]+|file:\\/\\/[^\\n<>\"'`,。;:!?、[\\]{}「」『』《》]+|(?:[A-Za-z]:[\\\\/]|~\\/|\\.{1,2}\\/)[^\\n<>\"'`,。;:!?、[\\]{}「」『』《》]+|(?<![\\p{L}\\p{N}_-])\\/[^\\n<>\"'`,。;:!?、[\\]{}「」『』《》]+|[A-Za-z0-9._@() -]+(?:[\\\\/][A-Za-z0-9._@() -]+)+(?:#L\\d+(?:C\\d+)?|:\\d+(?::\\d+)?)?","gu");let s=0;for(const i of e.matchAll(t)){if(typeof i.index!="number")continue;const a=i.index,u=a+i[0].length;a>s&&n.push({kind:"text",value:e.slice(s,a)});let o=i[0],f="";for(;/[.,;:!?,。;:!?、]$/u.test(o);)f=o.slice(-1)+f,o=o.slice(0,-1);const c=Ee(o);o=c.core;const m=c.leading,p=c.trailing+f;if(m&&n.push({kind:"text",value:m}),o.startsWith("**")&&o.endsWith("**")&&o.length>4)n.push({kind:"bold",value:o.slice(2,-2)}),p&&n.push({kind:"text",value:p});else if(/^https?:\/\//u.test(o))n.push({kind:"url",value:o,href:o}),p&&n.push({kind:"text",value:p});else{const y=ke(o);y?(n.push({kind:"file",value:o,path:y.path,line:y.line,column:y.column,displayPath:o,fallbackText:o,downloadName:Fe(y.path)}),p&&n.push({kind:"text",value:p})):n.push({kind:"text",value:i[0]})}s=u}return s<e.length&&n.push({kind:"text",value:e.slice(s)}),bs(n)}function gt(e,n){const t=[];let s=!1,i="";const a=u=>{u&&t.push({kind:"text",value:u})};for(const u of e){if(u.kind!=="text"){s&&(a(`${n.marker}${i}`),s=!1,i=""),t.push(u);continue}let o=u.value;for(;o.length>0;){const f=o.indexOf(n.marker);if(f<0){s?i+=o:a(o);break}const c=o.slice(0,f);if(s?i+=c:a(c),o=o.slice(f+n.marker.length),s){const m=i;m.length>0&&(!n.isValidContent||n.isValidContent(m))?t.push({kind:n.kind,value:m}):a(`${n.marker}${m}${n.marker}`),i="",s=!1}else s=!0}}return s&&a(`${n.marker}${i}`),t}function bs(e){const n=s=>s.trim().length>0&&!/^\s/u.test(s)&&!/\s$/u.test(s);let t=gt(e,{marker:"**",kind:"bold",isValidContent:n});return t=gt(t,{marker:"~~",kind:"strikethrough",isValidContent:n}),t=gt(t,{marker:"*",kind:"italic",isValidContent:n}),t}function ln(e,n){const t=e.trim(),s=n.trim();return t?!s||t===s?t:`${t} (${s})`:s}function Oe(e){const n=[];let t=0,s=0;const i=(a,u)=>{let o=a.indexOf("[",u);for(;o>=0;){const f=a.indexOf("]",o+1);if(f<0)return null;if(a[f+1]!=="("){o=a.indexOf("[",o+1);continue}let c=1,m=f+2,p=!1;for(;m<a.length;){const y=a[m];if(y===`
28
- `){p=!0;break}if(y==="("&&(c+=1),y===")"&&(c-=1,c===0)){const _=a.slice(o,m+1);if(pt(_))return{start:o,end:m+1,token:_};break}m+=1}if(p){o=a.indexOf("[",o+1);continue}o=a.indexOf("[",o+1)}return null};for(;s<e.length;){const a=i(e,s);if(!a)break;const{start:u,end:o,token:f}=a;u>t&&n.push(...kt(e.slice(t,u)));const c=pt(f);if(!c){n.push(...kt(e.slice(u,o))),t=o,s=o;continue}const m=c.label,p=c.target;if(/^https?:\/\//u.test(p))n.push({kind:"url",value:m||p,href:p});else{const y=ke(p);if(y){const _=m||p;n.push({kind:"file",value:p,path:y.path,line:y.line,column:y.column,displayPath:_,fallbackText:ln(_,p),downloadName:Fe(y.path)})}else n.push({kind:"text",value:f})}t=o,s=o}return t<e.length&&n.push(...kt(e.slice(t))),n}function U(e){if(e.includes("](")){const i=Oe(e);if(i.some(a=>a.kind==="file"||a.kind==="url"))return i}if(!e.includes("`"))return Oe(e);const n=[];let t=0,s=0;for(;t<e.length;){if(e[t]!=="`"){t+=1;continue}let i=1;for(;t+i<e.length&&e[t+i]==="`";)i+=1;const a="`".repeat(i);let u=t+i,o=-1;for(;u<e.length;){const c=e.indexOf(a,u);if(c<0)break;const m=c>0&&e[c-1]==="`",p=c+i<e.length&&e[c+i]==="`",y=e.slice(t+i,c).includes(`
29
- `);if(!m&&!p&&!y){o=c;break}u=c+1}if(o<0){t+=i;continue}t>s&&n.push(...Oe(e.slice(s,t)));const f=e.slice(t+i,o);if(f.length>0){const c=pt(f);if(c)if(/^https?:\/\//u.test(c.target))n.push({kind:"url",value:c.label||c.target,href:c.target});else{const m=ke(c.target);if(m){const p=c.label||c.target;n.push({kind:"file",value:c.target,path:m.path,line:m.line,column:m.column,displayPath:p,fallbackText:ln(p,c.target),downloadName:Fe(m.path)})}else n.push({kind:"code",value:f})}else if(/^https?:\/\/[^\s]+$/u.test(f))n.push({kind:"url",value:f,href:f});else{const m=ke(f);if(m){const p=m.line?`${m.path}:${String(m.line)}${m.column?`:${String(m.column)}`:""}`:m.path;n.push({kind:"file",value:f,path:m.path,line:m.line,column:m.column,displayPath:p,fallbackText:p,downloadName:Fe(m.path)})}else n.push({kind:"code",value:f})}}else n.push({kind:"text",value:`${a}${a}`});t=o+i,s=t}return s<e.length&&n.push(...Oe(e.slice(s))),n}function cn(e){const n=e.trim();if(!n)return"";const t=ke(n),s=(t==null?void 0:t.path)??n,i=D(j(ht(s,k.cwd)));return i&&(i.startsWith("/")||/^[A-Za-z]:\//u.test(i))?i:""}function yt(e){const n=e.trim();if(!n)return"";const t=D(j(ht(ft(n),k.cwd)));return t&&(t.startsWith("/")||/^[A-Za-z]:\//u.test(t))?t:""}function xs(e){const n=e.trim();if(!n)return"";if(n.startsWith("data:")||n.startsWith("blob:")||n.startsWith("http://")||n.startsWith("https://")||n.startsWith("/codex-local-image?"))return n;if(n.startsWith("file://"))return`/codex-local-image?path=${encodeURIComponent(n)}`;const t=n.startsWith("/"),s=/^[A-Za-z]:[\\/]/u.test(n);return t||s?`/codex-local-image?path=${encodeURIComponent(n)}`:n}function _t(e,n=null,t=null){const s=e.startsWith("/")?e:`/${e}`,i=new URLSearchParams;n&&i.set("line",String(n)),t&&i.set("column",String(t));const a=i.toString();return`/codex-local-browse${encodeURI(s)}${a?`?${a}`:""}`}function Cs(e){const n=yt(e);return n?_t(n):"#"}function $s(e,n=null,t=null,s=e){const i=yt(s),a=cn(e);return i&&i!==a&&pe.value[i]===!0?_t(i):!a||pe.value[a]!==!0?"":_t(a,n,t)}function S(e){return $s(e.path,e.line,e.column,e.value)}function Q(e){return e.value.trim()||e.path}const Ls=L(()=>({left:`${String(Rt.value)}px`,top:`${String(Wt.value)}px`}));function Ts(e){const n=e.trim();if(!n)return"";try{const t=new URL(n,window.location.href);return t.pathname.startsWith("/codex-local-browse")?`${`/codex-local-edit${t.pathname.slice(19)}`}${t.search}${t.hash}`:""}catch{return""}}function Ms(e){const n=e.target;if(!(n instanceof Element))return;const t=n.closest("a.message-file-link");if(!(t instanceof HTMLAnchorElement))return;const s=(t.getAttribute("href")??"").trim();!s||s==="#"||(e.preventDefault(),e.stopPropagation(),Xe.value=s,Je.value=Ts(s),Rt.value=e.clientX,Wt.value=e.clientY,he.value=!0)}function Y(){he.value&&(he.value=!1)}function Ss(){const e=Xe.value;Y(),!(!e||e==="#")&&window.open(e,"_blank","noopener,noreferrer")}function Ps(){const e=Je.value;Y(),!(!e||e==="#")&&window.open(e,"_blank","noopener,noreferrer")}async function Is(){const e=Xe.value;if(Y(),!(!e||e==="#"))try{await navigator.clipboard.writeText(e)}catch{const n=document.createElement("textarea");n.value=e,n.setAttribute("readonly","true"),n.style.position="fixed",n.style.opacity="0",document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n)}}function un(e){if(!he.value)return;const n=Et.value;if(!n){Y();return}const t=e.target;t instanceof Node&&n.contains(t)||Y()}function dn(){Y()}function fn(e){e.key==="Escape"&&Y()}function hn(e){return e.replace(/\r\n/gu,`
30
- `)}function W(e){var t;return(((t=e.match(/^\s*/u))==null?void 0:t[0])??"").replace(/\t/gu," ").length}function pn(e,n){if(n<=0)return e.trimStart();let t=0,s=0;for(;t<e.length&&s<n;){const i=e[t];s+=i===" "?4:1,t+=1}return e.slice(t)}function z(e){return e.trim().length===0}function wt(e){const n=e.match(/^\s{0,3}(#{1,6})\s+(.+)$/u);return n?{level:n[1].length,value:n[2].trim()}:null}function He(e){const n=e.match(/^\s{0,3}>\s?(.*)$/u);return n?n[1]??"":null}function ge(e){var t;const n=e.match(/^\s*[-*+]\s+(.+)$/u);return((t=n==null?void 0:n[1])==null?void 0:t.trim())??null}function As(e){var t;const n=e.match(/^(\s*)[-*+]\s+(.+)$/u);return n?{indent:W(n[1]??""),text:((t=n[2])==null?void 0:t.trim())??""}:null}function ye(e){var t;const n=e.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.+)$/u);return n?{checked:(n[1]??" ").toLowerCase()==="x",text:((t=n[2])==null?void 0:t.trim())??""}:null}function mn(e){var t;const n=e.match(/^(\s*)[-*+]\s+\[([ xX])\]\s+(.+)$/u);return n?{indent:W(n[1]??""),item:{checked:(n[2]??" ").toLowerCase()==="x",text:((t=n[3])==null?void 0:t.trim())??""}}:null}function vn(e){var t;const n=e.match(/^(\s*)(\d+)[.)]\s+(.+)$/u);return n?{indent:W(n[1]??""),start:Number.parseInt(n[2]??"1",10)||1,text:((t=n[3])==null?void 0:t.trim())??""}:null}function bt(e){var n;return((n=vn(e))==null?void 0:n.text)??null}function kn(e){return vn(e)}function xt(e){const n=e.trim();if(!n.includes("|"))return null;let t=n;t.startsWith("|")&&(t=t.slice(1)),t.endsWith("|")&&(t=t.slice(0,-1));const s=[];let i="",a=0;for(let u=0;u<t.length;u+=1){const o=t[u];if(o==="\\"&&t[u+1]==="|"){i+="|",u+=1;continue}if(o==="`"){let f=1;for(;t[u+f]==="`";)f+=1;i+=t.slice(u,u+f),a===0?a=f:a===f&&(a=0),u+=f-1;continue}if(o==="|"&&a===0){s.push(i.trim()),i="";continue}i+=o}return s.push(i.trim()),s.some(u=>u.length>0)?s:null}function Fs(e){const n=xt(e);if(!n||n.length===0)return null;const t=n.map(s=>{const i=s.replace(/\s+/gu,"");if(!/^:?-{3,}:?$/u.test(i))return null;const a=i.startsWith(":"),u=i.endsWith(":");return a&&u?"center":u?"right":a?"left":null});return t.every((s,i)=>s!==null||/^-+$/u.test(n[i].replace(/\s+/gu,"")))?t:null}function gn(e,n){return e.length===n?e:e.length>n?e.slice(0,n):[...e,...Array.from({length:n-e.length},()=>"")]}function yn(e,n){var m;if(n+1>=e.length)return null;const t=e[n],s=e[n+1],i=xt(t),a=Fs(s);if(!i||!a||i.length!==a.length)return null;const u=t.trim();if(!u.startsWith("|")&&(((m=u.match(/\|/gu))==null?void 0:m.length)??0)<2)return null;const o=i.length,f=[];let c=n+2;for(;c<e.length&&!z(e[c]);){const p=xt(e[c]);if(!p)break;f.push(gn(p,o)),c+=1}return{kind:"table",headers:gn(i,o),rows:f,alignments:a}}function Bs(e){return z(e)||je(e)!==null||Ct(e)||wt(e)!==null||He(e)!==null||ye(e)!==null||ge(e)!==null||bt(e)!==null}function Es(e,n,t=-1){const s=[];let i=n;for(;i<e.length&&!(Bs(e[i])||t>=0&&W(e[i])<=t);)s.push(t>=0?pn(e[i],t+1):e[i]),i+=1;const a=s.join(`
31
- `).trim();return a?{value:a,nextIndex:i}:null}function _n(e,n){for(let t=n;t<e.length;t+=1)if(!z(e[t]))return t;return-1}function Rs(e,n,t,s=null,i=!1){const a=[];let u=n;for(;u<e.length;){const o=e[u];if(z(o)){const p=_n(e,u+1);if(p===-1){a.push(""),u=e.length;break}const y=s==null?void 0:s(e[p]);if(y&&y.indent===t||W(e[p])<=t)break;a.push(""),u+=1;continue}const f=s==null?void 0:s(o);if(f&&f.indent===t)break;const c=W(o),m=i&&(ye(o)!==null||ge(o)!==null);if(c<=t&&!m)break;a.push(c>t?pn(o,t+1):o.trimStart()),u+=1}for(;a.length>0&&z(a[0]);)a.shift();for(;a.length>0&&z(a[a.length-1]);)a.pop();return a.length===0?null:{blocks:De(a.join(`
32
- `)),nextIndex:u}}function wn(e,n,t,s=!1){const i=[];let a=n;const u=t(e[n]);if(!u)return null;const o=u.indent;for(;a<e.length;){const f=t(e[a]);if(f===null||f.indent!==o)break;const c=[f.text],m=[];for(a+=1;a<e.length;){if(z(e[a])){const w=_n(e,a+1);if(w===-1){a=e.length;break}const A=t(e[w]);if(A&&A.indent===o){a=w;break}if(W(e[w])<=o){a=w;break}a+=1;continue}const p=t(e[a]);if(p&&p.indent===o)break;const y=W(e[a])>o,_=s&&(ye(e[a])!==null||ge(e[a])!==null);if(y||_){const w=Rs(e,a,o,t,s);if(w){m.push(...w.blocks),a=w.nextIndex;continue}}if(W(e[a])<=o)break;const N=Es(e,a,o);if(!N)break;c.push(N.value),a=N.nextIndex}i.push(m.length>0?{paragraphs:c,children:m}:{paragraphs:c})}return i.length>0?{items:i,nextIndex:a}:null}function Ct(e){return/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/u.test(e.trim())}function je(e){const n=e.match(/^\s{0,3}(```+|~~~+)\s*([^\s`~][^`]*)?\s*$/u);return n?{marker:n[1],language:(n[2]??"").trim()}:null}function De(e){var a;const t=hn(e).split(`
33
- `),s=[];let i=0;for(;i<t.length;){if(z(t[i])){i+=1;continue}const u=je(t[i]);if(u){i+=1;const w=[];for(;i<t.length;){if(t[i].trim()===u.marker){i+=1;break}w.push(t[i]),i+=1}s.push({kind:"codeBlock",language:u.language,value:w.join(`
34
- `)});continue}if(Ct(t[i])){s.push({kind:"thematicBreak"}),i+=1;continue}const o=wt(t[i]);if(o){s.push({kind:"heading",level:o.level,value:o.value}),i+=1;continue}if(He(t[i])!==null){const w=[];for(;i<t.length;){const A=He(t[i]);if(A===null)break;w.push(A),i+=1}s.push({kind:"blockquote",value:w.join(`
35
- `).trim()});continue}const c=yn(t,i);if(c){s.push(c),i+=2+c.rows.length;continue}if(ye(t[i])!==null){const w=[],A=((a=mn(t[i]))==null?void 0:a.indent)??0;for(;i<t.length;){const St=mn(t[i]);if(St===null||St.indent!==A)break;w.push(St.item),i+=1}if(w.length>0){s.push({kind:"taskList",items:w});continue}}const p=ge(t[i]);if(p!==null){const w=wn(t,i,As);if(w){s.push({kind:"unorderedList",items:w.items}),i=w.nextIndex;continue}if(p.length>0){s.push({kind:"unorderedList",items:[{paragraphs:[p]}]}),i+=1;continue}}const y=bt(t[i]);if(y!==null){const w=kn(t[i]),A=wn(t,i,kn,!0);if(A){s.push({kind:"orderedList",items:A.items,start:(w==null?void 0:w.start)??1}),i=A.nextIndex;continue}if(y.length>0){s.push({kind:"orderedList",items:[{paragraphs:[y]}],start:(w==null?void 0:w.start)??1}),i+=1;continue}}const _=[];for(;i<t.length&&!(z(t[i])||je(t[i])||Ct(t[i])||wt(t[i])||yn(t,i)||He(t[i])!==null||ye(t[i])!==null||ge(t[i])!==null||bt(t[i])!==null);)_.push(t[i]),i+=1;const N=_.join(`
36
- `).trim();N&&s.push({kind:"paragraph",value:N})}return s}function Ws(e){if(!e.includes("![")||!e.includes("]("))return De(e);const n=[],t=/!\[([^\]]*)\]\(([^)\n]+)\)/gu;let s=0;for(const i of e.matchAll(t)){const[a,u,o]=i;if(typeof i.index!="number")continue;const f=i.index,c=f+a.length,m=xs(o.trim());m&&(f>s&&n.push(...De(e.slice(s,f))),n.push({kind:"image",url:m,alt:u.trim(),markdown:a}),s=c)}return s<e.length&&n.push(...De(e.slice(s))),n}function $t(e){const t=hn(e).split(`
37
- `),s=[];let i=0,a=0;const u=o=>{if(o<=a)return;const f=t.slice(a,o).join(`
38
- `);s.push(...Ws(f))};for(;i<t.length;){const o=je(t[i]);if(!o){i+=1;continue}u(i),i+=1;const f=[];for(;i<t.length;){if(t[i].trim()===o.marker){i+=1;break}f.push(t[i]),i+=1}s.push({kind:"codeBlock",language:o.language,value:f.join(`
39
- `)}),a=i}return u(t.length),s.length>0?s:[{kind:"paragraph",value:e}]}function _e(e,n){for(const t of U(e)){if(t.kind!=="file")continue;const s=yt(t.value),i=cn(t.path);s&&n.add(s),i&&i!==s&&n.add(i)}}function zs(e,n){for(const t of e.paragraphs)_e(t,n);for(const t of e.children??[])bn(t,n)}function bn(e,n){if(e.kind==="paragraph"||e.kind==="heading"||e.kind==="blockquote"){_e(e.value,n);return}if(e.kind==="unorderedList"||e.kind==="orderedList"){for(const t of e.items)zs(t,n);return}if(e.kind==="taskList"){for(const t of e.items)_e(t.text,n);return}if(e.kind==="table"){for(const t of e.headers)_e(t,n);for(const t of e.rows)for(const s of t)_e(s,n)}}function Os(e,n){const t=s=>{if(s.trim())for(const i of $t(s))bn(i,n)};if(Ye(e)){const s=st(e),i=it(e);if(s&&t(s),i.length>0){for(const a of i)a.step&&t(a.step);return}t(e.text);return}t(e.text)}const Hs=L(()=>{const e=new Set;for(const n of Gt.value)Os(n,e);return Array.from(e)});async function js(e){const n=ut,t=Date.now(),s=e.filter(i=>{if(Ae.has(i))return!1;const a=Ie.get(i)??0;return t-a>Zr});if(s.length!==0){for(const i of s)Ae.add(i);try{const i=await ai(s);if(n!==ut)return;const a={...pe.value},u=new Set,o=Date.now();for(const f of i)a[f.path]=f.exists,Ie.set(f.path,o),u.add(f.path);for(const f of s)u.has(f)||(a[f]=!1,Ie.set(f,o));pe.value=a}catch{}finally{for(const i of s)Ae.delete(i)}}}function $(e){return e.replace(/&/gu,"&amp;").replace(/</gu,"&lt;").replace(/>/gu,"&gt;").replace(/"/gu,"&quot;").replace(/'/gu,"&#39;")}function Ds(e){var t;const n=((t=e.trim().split(/\s+/u)[0])==null?void 0:t.toLowerCase())??"";return n?Kt[n]??n:""}function xn(e,n){const t=Ds(e);if(!t)return $(n);const s=Se.value;if(!s)return $(n);try{if(s.getLanguage(t))return s.highlight(n,{language:t,ignoreIllegals:!0}).value}catch{}return $(n)}function ee(e){return U(e).map(n=>{if(n.kind==="text")return $(n.value);if(n.kind==="bold")return`<strong class="message-bold-text">${$(n.value)}</strong>`;if(n.kind==="italic")return`<em class="message-italic-text">${$(n.value)}</em>`;if(n.kind==="strikethrough")return`<s class="message-strikethrough-text">${$(n.value)}</s>`;if(n.kind==="file"){const t=S(n);return t?`<a class="message-file-link" href="${$(t)}" target="_blank" rel="noopener noreferrer" title="${$(Q(n))}">${$(n.displayPath)}</a>`:$(n.fallbackText)}return n.kind==="url"?`<a class="message-file-link" href="${$(n.href)}" target="_blank" rel="noopener noreferrer" title="${$(n.href)}">${$(n.value)}</a>`:`<code class="message-inline-code">${$(n.value)}</code>`}).join("")}function Us(e){return e.paragraphs.map(n=>`<div class="message-list-item-text message-list-item-paragraph">${ee(n)}</div>`).join("")}function Ue(e){var s;const n=Us(e),t=((s=e.children)==null?void 0:s.map(i=>$n(i)).join(""))??"";return n+t}function Cn(e){return e?` style="text-align:${e}"`:""}function $n(e){if(e.kind==="paragraph")return`<p class="message-text">${ee(e.value)}</p>`;if(e.kind==="heading"){const n=Math.min(6,Math.max(1,Math.trunc(e.level))),t=Xt(n),s=`message-heading ${Jt(n)}`;return`<${t} class="${s}">${ee(e.value)}</${t}>`}if(e.kind==="blockquote")return`<blockquote class="message-blockquote">${ee(e.value)}</blockquote>`;if(e.kind==="unorderedList")return`<ul class="message-list message-list-unordered">${e.items.map(t=>`<li class="message-list-item"><div class="message-list-item-content">${Ue(t)}</div></li>`).join("")}</ul>`;if(e.kind==="taskList")return`<ul class="message-list message-task-list">${e.items.map(t=>`<li class="message-task-item"><span class="message-task-checkbox" data-checked="${t.checked?"true":"false"}">${t.checked?"☑":"☐"}</span><div class="message-list-item-text">${ee(t.text)}</div></li>`).join("")}</ul>`;if(e.kind==="orderedList"){const n=e.items.map(t=>`<li class="message-list-item"><div class="message-list-item-content">${Ue(t)}</div></li>`).join("");return`<ol class="message-list message-list-ordered" start="${e.start}">${n}</ol>`}if(e.kind==="table"){const n=e.headers.map((i,a)=>`<th class="message-table-head-cell"${Cn(e.alignments[a]??null)}>${ee(i)}</th>`).join(""),t=e.rows.map(i=>'<tr class="message-table-body-row">'+i.map((a,u)=>`<td class="message-table-cell"${Cn(e.alignments[u]??null)}>${ee(a)}</td>`).join("")+"</tr>").join(""),s=t?`<tbody>${t}</tbody>`:"";return`<div class="message-table-wrap"><table class="message-table"><thead><tr>${n}</tr></thead>${s}</table></div>`}return e.kind==="codeBlock"?`<div class="message-code-block">${e.language?`<div class="message-code-language">${$(e.language)}</div>`:""}<pre class="message-code-pre"><code class="hljs">${xn(e.language,e.value)}</code></pre></div>`:e.kind==="thematicBreak"?'<hr class="message-divider">':`<img class="message-image-preview message-markdown-image" src="${$(e.url)}" alt="${$(e.alt||"Embedded message image")}" loading="lazy">`}function Lt(e){return $t(e).map(n=>$n(n)).join("")}function Ns(){const e=Z.value,n=qt.value;!e||!n||(e.scrollTop=e.scrollHeight,n.scrollIntoView({block:"end"}))}function Ln(e){return e.scrollHeight-(e.scrollTop+e.clientHeight)<=Vr}function Ne(e){if(!k.activeThreadId)return;const n=Math.max(e.scrollHeight-e.clientHeight,0),t=n>0?Math.min(Math.max(e.scrollTop/n,0),1):1;ct("updateScrollState",{threadId:k.activeThreadId,state:{scrollTop:e.scrollTop,isAtBottom:Ln(e),scrollRatio:t}})}function Vs(){const e=Z.value;if(!e)return;if(H.value){Ve();return}const n=k.scrollState;if(!n||n.isAtBottom){Ne(e);return}const t=Math.max(e.scrollHeight-e.clientHeight,0),s=n.scrollTop;e.scrollTop=Math.min(Math.max(s,0),t),Ne(e)}function Ve(){const e=Z.value;e&&(Ns(),Ne(e))}function Tt(){return H.value}function Tn(){if(!Tt()){Me=0,E=0;return}if(Ve(),Me-=1,Me<=0){E=0;return}E=requestAnimationFrame(Tn)}function qe(e=6){Tt()&&(E&&(cancelAnimationFrame(E),E=0),Me=Math.max(e,1),E=requestAnimationFrame(Tn))}function Mn(){qe(3)}function Sn(){H.value=!0,Ve(),qe(4)}async function Pn(){const e=Z.value;if(!e||!dt.value||X.value)return;X.value=!0;const n=k.activeThreadId,t=e.scrollHeight,s=e.scrollTop;R.value=Math.max(0,R.value-qr),await Pt(),k.activeThreadId===n&&(e.scrollTop=s+(e.scrollHeight-t),X.value=!1)}q({jumpToLatest:Sn});function qs(){if(!Tt())return;const e=Z.value;if(!e)return;const n=e.querySelectorAll("img.message-image-preview");for(const t of n)t.complete||Zt.has(t)||(Zt.add(t),t.addEventListener("load",Mn,{once:!0}),t.addEventListener("error",Mn,{once:!0}))}async function Mt(){await Pt(),ie&&cancelAnimationFrame(ie),ie=requestAnimationFrame(()=>{ie=0,Vs(),qs(),qe()})}V(()=>k.messages,async e=>{if(k.isLoading)return;const n=new Set(e.filter(t=>t.messageType==="commandExecution"&&t.commandExecution).map(t=>t.id));ue.value=Te(ue.value,n),O.value=Te(O.value,n),de.value=Te(de.value,new Set(Object.keys(nt.value))),fe.value=Te(fe.value,new Set([...Object.keys(Re.value),...Object.keys(vt.value)])),H.value?R.value=Math.max(0,e.length-Ft):R.value=Math.min(R.value,Math.max(0,e.length-1)),await Mt()}),V(()=>k.messages.some(e=>e.text.includes("```")),e=>{!e||Se.value||Jn()},{immediate:!0}),V(Hs,e=>{js(e)},{immediate:!0}),V(tt,(e,n)=>{if(!n||n===e||!O.value.has(n))return;const t=new Set(O.value);t.delete(n),O.value=t}),V(()=>k.pendingRequests,async()=>{k.isLoading||await Mt()},{deep:!0}),V(()=>k.liveOverlay,async e=>{e&&H.value&&(await Pt(),Ve(),qe(8))},{deep:!0}),V(()=>k.isLoading,async e=>{e||(R.value=Math.max(0,k.messages.length-Ft),await Mt())}),V(()=>k.activeThreadId,()=>{Gn.value=null,H.value=!0,ve.value="",X.value=!1,ut+=1,pe.value={},Ie.clear(),Ae.clear(),R.value=Math.max(0,k.messages.length-Ft)},{flush:"post"});function Ks(){const e=Z.value;!e||k.isLoading||(H.value=Ln(e),Ne(e),dt.value&&!X.value&&e.scrollTop<Kr&&Pn())}const In=x(new Set);function An(e,n){return`${e}:${n}`}function Zs(e,n){return In.value.has(An(e,n))}function Gs(e,n){In.value.add(An(e,n))}function Fn(e){ve.value=e}function Bn(){ve.value=""}return Qs(()=>{window.addEventListener("pointerdown",un),window.addEventListener("blur",dn),window.addEventListener("keydown",fn)}),Ys(()=>{ie&&cancelAnimationFrame(ie),E&&cancelAnimationFrame(E),oe&&clearTimeout(oe),window.removeEventListener("pointerdown",un),window.removeEventListener("blur",dn),window.removeEventListener("keydown",fn)}),(e,n)=>(r(),l("section",{class:"conversation-root",onContextmenuCapture:Ms},[T.isLoading?(r(),l("p",mi,"Loading messages...")):T.messages.length===0&&T.pendingRequests.length===0&&!T.liveOverlay?(r(),l("p",vi," No messages in this thread yet. ")):(r(),l("ul",{key:2,ref_key:"conversationListRef",ref:Z,class:"conversation-list",onScroll:Ks},[dt.value?(r(),l("li",ki,[d("button",{type:"button",class:"load-more-button",disabled:X.value,onClick:Pn},h(X.value?"Loading…":"Load earlier messages"),9,gi)])):g("",!0),(r(!0),l(v,null,b(Gt.value,t=>{var s,i,a,u;return r(),l(v,{key:t.id},[!Hn.value.has(t.id)&&!rs.value.has(t.id)?(r(),l("li",{key:0,class:"conversation-item","data-role":t.role,"data-message-type":t.messageType||""},[F(t)?(r(),l("div",_i,[d("div",wi,[xe(t).length>0?(r(),l("button",{key:0,type:"button",class:C(["cmd-row cmd-row-group cmd-compact",[Le(t),{"cmd-expanded":lt(t)}]]),onClick:o=>Dn(t)},[d("span",{class:C(["cmd-chevron",{"cmd-chevron-open":lt(t)}])},"▶",2),d("span",xi,h(Un(t)),1),d("span",Ci,h(Nn(t)),1)],10,bi)):g("",!0),xe(t).length>0?(r(),l("div",{key:1,class:C(["cmd-group-wrap",{"cmd-group-visible":lt(t)}])},[d("div",$i,[(r(!0),l(v,null,b(jt(t),o=>{var f,c;return r(),l("div",{key:`grouped-cmd-${o.id}`,class:"worked-cmd-item"},[d("button",{type:"button",class:C(["cmd-row",[Le(o),{"cmd-expanded":B(o),"cmd-compact":!0}]]),onClick:m=>rt(o)},[d("span",{class:C(["cmd-chevron",{"cmd-chevron-open":B(o)}])},"▶",2),d("code",Ti,h(((f=o.commandExecution)==null?void 0:f.command)||"(command)"),1),d("span",Mi,h($e(o)),1)],10,Li),d("div",{class:C(["cmd-output-wrap",{"cmd-output-visible":B(o)}])},[d("div",Si,[d("pre",{class:C(["cmd-output",{"cmd-output-condensed":at(o)}]),textContent:h(((c=o.commandExecution)==null?void 0:c.aggregatedOutput)||"(no output)")},null,10,Pi)])],2)])}),128))])],2)):(r(),l(v,{key:2},[d("button",{type:"button",class:C(["cmd-row",[Le(t),{"cmd-expanded":B(t),"cmd-compact":ot(t)}]]),onClick:o=>rt(t)},[d("span",{class:C(["cmd-chevron",{"cmd-chevron-open":B(t)}])},"▶",2),d("code",Ai,h(((s=t.commandExecution)==null?void 0:s.command)||"(command)"),1),d("span",Fi,h($e(t)),1)],10,Ii),d("div",{class:C(["cmd-output-wrap",{"cmd-output-visible":B(t)}])},[d("div",Bi,[d("pre",{class:C(["cmd-output",{"cmd-output-condensed":at(t)}]),textContent:h(((i=t.commandExecution)==null?void 0:i.aggregatedOutput)||"(no output)")},null,10,Ei)])],2)],64))])])):et(t)?(r(),l("div",{key:1,class:"message-row","data-role":t.role,"data-message-type":t.messageType||""},[d("div",{class:"message-stack","data-role":t.role},[d("article",{class:"message-body","data-role":t.role},[re(t)?(r(),l("section",Oi,[d("button",{type:"button",class:C(["cmd-row cmd-row-group cmd-compact file-change-summary-row",{"cmd-expanded":se(t)}]),onClick:o=>Ut(t)},[d("span",{class:C(["cmd-chevron",{"cmd-chevron-open":se(t)}])},"▶",2),d("span",ji,h(sn(re(t))),1),d("span",Di,[(r(!0),l(v,null,b(on(re(t)),o=>(r(),l("span",{key:`summary-status:${t.id}:${o.tone}:${o.label}`,class:"file-change-signed-count","data-tone":o.tone},h(o.label),9,Ui))),128))])],10,Hi),d("div",{class:C(["cmd-group-wrap",{"cmd-group-visible":se(t)}])},[d("div",Ni,[d("ul",Vi,[(r(!0),l(v,null,b(((a=re(t))==null?void 0:a.changes)??[],o=>(r(),l("li",{key:`file-change:${t.id}:${o.path}:${o.movedToPath||""}`,class:"file-change-item"},[d("span",{class:"file-change-badge","data-operation":We(o)},h(le(o)),9,qi),d("button",{type:"button",class:"file-change-path-button",title:o.path,onClick:f=>Ce(re(t),o)},h(P(o.path)),9,Ki),o.movedToPath?(r(),l("span",Zi,"→")):g("",!0),o.movedToPath?(r(),l("button",{key:1,type:"button",class:"file-change-path-button",title:o.movedToPath,onClick:f=>Ce(re(t),o)},h(P(o.movedToPath)),9,Gi)):g("",!0),o.addedLineCount>0||o.removedLineCount>0?(r(),l("span",Xi,[(r(!0),l(v,null,b(nn(o),f=>(r(),l("span",{key:`change-delta:${t.id}:${o.path}:${f.tone}:${f.label}`,class:"file-change-signed-count","data-tone":f.tone},h(f.label),9,Ji))),128))])):g("",!0)]))),128))])])],2)])):g("",!0)],8,zi)],8,Wi)],8,Ri)):(r(),l("div",{key:2,class:"message-row","data-role":t.role,"data-message-type":t.messageType||""},[d("div",{class:"message-stack","data-role":t.role},[d("article",{class:"message-body","data-role":t.role},[t.images&&t.images.length>0?(r(),l("ul",{key:0,class:"message-image-list","data-role":t.role},[(r(!0),l(v,null,b(t.images,o=>(r(),l("li",{key:o,class:"message-image-item"},[d("button",{class:"message-image-button",type:"button",onClick:f=>Fn(o)},[d("img",{class:"message-image-preview",src:o,alt:"Message image preview",loading:"lazy"},null,8,so)],8,no)]))),128))],8,to)):g("",!0),t.fileAttachments&&t.fileAttachments.length>0?(r(),l("div",io,[(r(!0),l(v,null,b(t.fileAttachments,o=>(r(),l("span",{key:`${t.id}:${o.path}`,class:"message-file-chip"},[n[4]||(n[4]=d("span",{class:"message-file-chip-icon"},"📄",-1)),d("a",{class:"message-file-link message-file-chip-name",href:Cs(o.path),target:"_blank",rel:"noopener noreferrer",title:o.path},h(o.label),9,oo)]))),128))])):g("",!0),t.text.length>0?(r(),l("article",{key:2,class:"message-card","data-role":t.role},[t.messageType==="worked"?(r(),l("div",ro,[d("button",{type:"button",class:"worked-separator",onClick:o=>Vn(t)},[n[5]||(n[5]=d("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1)),d("span",{class:C(["worked-chevron",{"worked-chevron-open":Dt(t)}])},"▶",2),d("p",co,h(t.text),1),n[6]||(n[6]=d("span",{class:"worked-separator-line","aria-hidden":"true"},null,-1))],8,lo),Dt(t)?(r(),l("div",uo,[(r(!0),l(v,null,b(Zn(T.messages,T.messages.indexOf(t)),o=>{var f,c;return r(),l("div",{key:`worked-cmd-${o.id}`,class:"worked-cmd-item"},[d("button",{type:"button",class:C(["cmd-row",[Le(o),{"cmd-expanded":B(o),"cmd-compact":ot(o)}]]),onClick:m=>rt(o)},[d("span",{class:C(["cmd-chevron",{"cmd-chevron-open":B(o)}])},"▶",2),d("code",ho,h(((f=o.commandExecution)==null?void 0:f.command)||"(command)"),1),d("span",po,h($e(o)),1)],10,fo),d("div",{class:C(["cmd-output-wrap",{"cmd-output-visible":B(o)}])},[d("div",mo,[d("pre",{class:C(["cmd-output",{"cmd-output-condensed":at(o)}]),textContent:h(((c=o.commandExecution)==null?void 0:c.aggregatedOutput)||"(no output)")},null,10,vo)])],2)])}),128))])):g("",!0)])):Ye(t)?(r(),l("div",{key:1,class:"plan-card","data-streaming":t.messageType==="plan.live"},[d("div",go,[n[7]||(n[7]=d("p",{class:"plan-card-title"},"Plan",-1)),t.messageType==="plan.live"?(r(),l("span",yo,"Updating")):g("",!0)]),st(t)?(r(),l("div",{key:0,class:"plan-card-explanation plan-card-markdown",innerHTML:Lt(st(t))},null,8,_o)):g("",!0),it(t).length>0?(r(),l("ol",wo,[(r(!0),l(v,null,b(it(t),(o,f)=>(r(),l("li",{key:`${t.id}:plan-step:${f}`,class:"plan-step-item","data-status":o.status},[d("span",{class:"plan-step-status","data-status":o.status},h(jn(o.status)),9,xo),d("div",{class:"plan-step-text plan-card-markdown",innerHTML:Lt(o.step)},null,8,Co)],8,bo))),128))])):(r(),l("div",{key:2,class:"plan-card-markdown",innerHTML:Lt(t.text)},null,8,$o))],8,ko)):(r(),l("div",Lo,[(r(!0),l(v,null,b($t(t.text),(o,f)=>(r(),l(v,{key:`block-${f}`},[o.kind==="paragraph"?(r(),l("p",To,[(r(!0),l(v,null,b(U(o.value),(c,m)=>(r(),l(v,{key:`seg-${f}-${m}`},[c.kind==="text"?(r(),l("span",Mo,h(c.value),1)):c.kind==="bold"?(r(),l("strong",So,h(c.value),1)):c.kind==="italic"?(r(),l("em",Po,h(c.value),1)):c.kind==="strikethrough"?(r(),l("s",Io,h(c.value),1)):c.kind==="file"?(r(),l(v,{key:4},[S(c)?(r(),l("a",{key:0,class:"message-file-link",href:S(c),target:"_blank",rel:"noopener noreferrer",title:Q(c)},h(c.displayPath),9,Ao)):(r(),l("span",Fo,h(c.fallbackText),1))],64)):c.kind==="url"?(r(),l("a",{key:5,class:"message-file-link",href:c.href,target:"_blank",rel:"noopener noreferrer",title:c.href},h(c.value),9,Bo)):(r(),l("code",Eo,h(c.value),1))],64))),128))])):o.kind==="heading"?(r(),ei(ti(Xt(o.level)),{key:1,class:C(["message-heading",Jt(o.level)])},{default:Rn(()=>[(r(!0),l(v,null,b(U(o.value),(c,m)=>(r(),l(v,{key:`heading-seg-${f}-${m}`},[c.kind==="text"?(r(),l("span",Ro,h(c.value),1)):c.kind==="bold"?(r(),l("strong",Wo,h(c.value),1)):c.kind==="italic"?(r(),l("em",zo,h(c.value),1)):c.kind==="strikethrough"?(r(),l("s",Oo,h(c.value),1)):c.kind==="file"?(r(),l(v,{key:4},[S(c)?(r(),l("a",{key:0,class:"message-file-link",href:S(c),target:"_blank",rel:"noopener noreferrer",title:Q(c)},h(c.displayPath),9,Ho)):(r(),l("span",jo,h(c.fallbackText),1))],64)):c.kind==="url"?(r(),l("a",{key:5,class:"message-file-link",href:c.href,target:"_blank",rel:"noopener noreferrer",title:c.href},h(c.value),9,Do)):(r(),l("code",Uo,h(c.value),1))],64))),128))]),_:2},1032,["class"])):o.kind==="blockquote"?(r(),l("blockquote",No,[(r(!0),l(v,null,b(U(o.value),(c,m)=>(r(),l(v,{key:`quote-seg-${f}-${m}`},[c.kind==="text"?(r(),l("span",Vo,h(c.value),1)):c.kind==="bold"?(r(),l("strong",qo,h(c.value),1)):c.kind==="italic"?(r(),l("em",Ko,h(c.value),1)):c.kind==="strikethrough"?(r(),l("s",Zo,h(c.value),1)):c.kind==="file"?(r(),l(v,{key:4},[S(c)?(r(),l("a",{key:0,class:"message-file-link",href:S(c),target:"_blank",rel:"noopener noreferrer",title:Q(c)},h(c.displayPath),9,Go)):(r(),l("span",Xo,h(c.fallbackText),1))],64)):c.kind==="url"?(r(),l("a",{key:5,class:"message-file-link",href:c.href,target:"_blank",rel:"noopener noreferrer",title:c.href},h(c.value),9,Jo)):(r(),l("code",Qo,h(c.value),1))],64))),128))])):o.kind==="unorderedList"?(r(),l("ul",Yo,[(r(!0),l(v,null,b(o.items,(c,m)=>(r(),l("li",{key:`ul-${f}-${m}`,class:"message-list-item"},[d("div",{class:"message-list-item-content",innerHTML:Ue(c)},null,8,ea)]))),128))])):o.kind==="taskList"?(r(),l("ul",ta,[(r(!0),l(v,null,b(o.items,(c,m)=>(r(),l("li",{key:`task-${f}-${m}`,class:"message-task-item"},[d("span",{class:"message-task-checkbox","data-checked":c.checked},h(c.checked?"☑":"☐"),9,na),d("div",sa,[(r(!0),l(v,null,b(U(c.text),(p,y)=>(r(),l(v,{key:`task-seg-${f}-${m}-${y}`},[p.kind==="text"?(r(),l("span",ia,h(p.value),1)):p.kind==="bold"?(r(),l("strong",oa,h(p.value),1)):p.kind==="italic"?(r(),l("em",aa,h(p.value),1)):p.kind==="strikethrough"?(r(),l("s",ra,h(p.value),1)):p.kind==="file"?(r(),l(v,{key:4},[S(p)?(r(),l("a",{key:0,class:"message-file-link",href:S(p),target:"_blank",rel:"noopener noreferrer",title:Q(p)},h(p.displayPath),9,la)):(r(),l("span",ca,h(p.fallbackText),1))],64)):p.kind==="url"?(r(),l("a",{key:5,class:"message-file-link",href:p.href,target:"_blank",rel:"noopener noreferrer",title:p.href},h(p.value),9,ua)):(r(),l("code",da,h(p.value),1))],64))),128))])]))),128))])):o.kind==="orderedList"?(r(),l("ol",{key:5,class:"message-list message-list-ordered",start:o.start},[(r(!0),l(v,null,b(o.items,(c,m)=>(r(),l("li",{key:`ol-${f}-${m}`,class:"message-list-item"},[d("div",{class:"message-list-item-content",innerHTML:Ue(c)},null,8,ha)]))),128))],8,fa)):o.kind==="table"?(r(),l("div",pa,[d("table",ma,[d("thead",null,[d("tr",null,[(r(!0),l(v,null,b(o.headers,(c,m)=>(r(),l("th",{key:`th-${f}-${m}`,class:"message-table-head-cell",style:It({textAlign:o.alignments[m]??"left"})},[(r(!0),l(v,null,b(U(c),(p,y)=>(r(),l(v,{key:`th-seg-${f}-${m}-${y}`},[p.kind==="text"?(r(),l("span",va,h(p.value),1)):p.kind==="bold"?(r(),l("strong",ka,h(p.value),1)):p.kind==="italic"?(r(),l("em",ga,h(p.value),1)):p.kind==="strikethrough"?(r(),l("s",ya,h(p.value),1)):p.kind==="file"?(r(),l(v,{key:4},[S(p)?(r(),l("a",{key:0,class:"message-file-link",href:S(p),target:"_blank",rel:"noopener noreferrer",title:Q(p)},h(p.displayPath),9,_a)):(r(),l("span",wa,h(p.fallbackText),1))],64)):p.kind==="url"?(r(),l("a",{key:5,class:"message-file-link",href:p.href,target:"_blank",rel:"noopener noreferrer",title:p.href},h(p.value),9,ba)):(r(),l("code",xa,h(p.value),1))],64))),128))],4))),128))])]),o.rows.length>0?(r(),l("tbody",Ca,[(r(!0),l(v,null,b(o.rows,(c,m)=>(r(),l("tr",{key:`tr-${f}-${m}`,class:"message-table-body-row"},[(r(!0),l(v,null,b(c,(p,y)=>(r(),l("td",{key:`td-${f}-${m}-${y}`,class:"message-table-cell",style:It({textAlign:o.alignments[y]??"left"})},[(r(!0),l(v,null,b(U(p),(_,N)=>(r(),l(v,{key:`td-seg-${f}-${m}-${y}-${N}`},[_.kind==="text"?(r(),l("span",$a,h(_.value),1)):_.kind==="bold"?(r(),l("strong",La,h(_.value),1)):_.kind==="italic"?(r(),l("em",Ta,h(_.value),1)):_.kind==="strikethrough"?(r(),l("s",Ma,h(_.value),1)):_.kind==="file"?(r(),l(v,{key:4},[S(_)?(r(),l("a",{key:0,class:"message-file-link",href:S(_),target:"_blank",rel:"noopener noreferrer",title:Q(_)},h(_.displayPath),9,Sa)):(r(),l("span",Pa,h(_.fallbackText),1))],64)):_.kind==="url"?(r(),l("a",{key:5,class:"message-file-link",href:_.href,target:"_blank",rel:"noopener noreferrer",title:_.href},h(_.value),9,Ia)):(r(),l("code",Aa,h(_.value),1))],64))),128))],4))),128))]))),128))])):g("",!0)])])):o.kind==="codeBlock"?(r(),l("div",Fa,[o.language?(r(),l("div",Ba,h(o.language),1)):g("",!0),d("pre",Ea,[d("code",{class:"hljs",innerHTML:xn(o.language,o.value)},null,8,Ra)])])):o.kind==="thematicBreak"?(r(),l("hr",Wa)):Zs(t.id,f)?(r(),l("p",za,h(o.markdown),1)):(r(),l("button",{key:10,class:"message-image-button",type:"button",onClick:c=>Fn(o.url)},[d("img",{class:"message-image-preview message-markdown-image",src:o.url,alt:o.alt||"Embedded message image",loading:"lazy",onError:c=>Gs(t.id,f)},null,40,Ha)],8,Oa))],64))),128))]))],8,ao)):g("",!0),ae(t)?(r(),l("section",ja,[d("button",{type:"button",class:C(["cmd-row cmd-row-group cmd-compact file-change-summary-row",{"cmd-expanded":se(t)}]),onClick:o=>Ut(t)},[d("span",{class:C(["cmd-chevron",{"cmd-chevron-open":se(t)}])},"▶",2),d("span",Ua,h(sn(ae(t))),1),d("span",Na,[(r(!0),l(v,null,b(on(ae(t)),o=>(r(),l("span",{key:`summary-status:${t.id}:${o.tone}:${o.label}`,class:"file-change-signed-count","data-tone":o.tone},h(o.label),9,Va))),128))])],10,Da),d("div",{class:C(["cmd-group-wrap",{"cmd-group-visible":se(t)}])},[d("div",qa,[d("ul",Ka,[(r(!0),l(v,null,b(((u=ae(t))==null?void 0:u.changes)??[],o=>(r(),l("li",{key:`file-change:inline:${t.id}:${o.path}:${o.movedToPath||""}`,class:"file-change-item"},[d("span",{class:"file-change-badge","data-operation":We(o)},h(le(o)),9,Za),d("button",{type:"button",class:"file-change-path-button",title:o.path,onClick:f=>Ce(ae(t),o)},h(P(o.path)),9,Ga),o.movedToPath?(r(),l("span",Xa,"→")):g("",!0),o.movedToPath?(r(),l("button",{key:1,type:"button",class:"file-change-path-button",title:o.movedToPath,onClick:f=>Ce(ae(t),o)},h(P(o.movedToPath)),9,Ja)):g("",!0),o.addedLineCount>0||o.removedLineCount>0?(r(),l("span",Qa,[(r(!0),l(v,null,b(nn(o),f=>(r(),l("span",{key:`change-delta:inline:${t.id}:${o.path}:${f.tone}:${f.label}`,class:"file-change-signed-count","data-tone":f.tone},h(f.label),9,Ya))),128))])):g("",!0)]))),128))])])],2)])):g("",!0),en(t)||rn(t)?(r(),l("div",{key:4,class:"message-toolbar","data-role":t.role},[rn(t)?(r(),l("button",{key:0,type:"button",class:"message-rollback-button","aria-label":"Rollback to this response",title:"Rollback to this response",onClick:o=>ws(t.id)},[te(ui,{class:"icon-svg message-rollback-icon"}),n[8]||(n[8]=d("span",{class:"message-rollback-label"},"Rollback",-1))],8,tr)):g("",!0),ss(t)?(r(),l("button",{key:1,type:"button",class:"message-fork-button","aria-label":"Fork thread from this response",title:"Fork thread from this response",onClick:o=>_s(t.id)},[te(ni,{class:"icon-svg message-fork-icon"}),n[9]||(n[9]=d("span",{class:"message-fork-label"},"Fork",-1))],8,nr)):g("",!0),en(t)?(r(),l("button",{key:2,type:"button",class:"message-copy-button","data-copied":G.value===t.id,"aria-label":G.value===t.id?"Response copied":"Copy response",title:G.value===t.id?"Response copied":"Copy response",onClick:o=>ys(t.id)},[te(pi,{class:"icon-svg message-copy-icon"}),d("span",ir,h(G.value===t.id?"Copied":"Copy"),1)],8,sr)):g("",!0)],8,er)):g("",!0)],8,eo)],8,Yi)],8,Qi))],8,yi)):g("",!0)],64)}),128)),T.liveOverlay?(r(),l("li",or,[d("div",ar,[d("div",rr,[d("article",lr,[d("p",cr,h(T.liveOverlay.activityLabel),1),T.liveOverlay.reasoningText?(r(),l("p",ur,h(T.liveOverlay.reasoningText),1)):g("",!0),T.liveOverlay.errorText?(r(),l("p",dr,h(T.liveOverlay.errorText),1)):g("",!0)])])])])):g("",!0),d("li",{ref_key:"bottomAnchorRef",ref:qt,class:"conversation-bottom-anchor"},null,512)],544)),Xn.value?(r(),l("button",{key:3,type:"button",class:"jump-to-latest-button",title:"Jump to latest","aria-label":"Jump to latest output",onClick:Sn},[te(si,{class:"icon-svg jump-to-latest-icon"})])):g("",!0),ve.value.length>0?(r(),l("div",{key:4,class:"image-modal-backdrop",onClick:Bn},[d("div",{class:"image-modal-content",onClick:n[0]||(n[0]=Ke(()=>{},["stop"]))},[d("button",{class:"image-modal-close",type:"button","aria-label":"Close image preview",onClick:Bn},[te(Wn,{class:"icon-svg"})]),d("img",{class:"image-modal-image",src:ve.value,alt:"Expanded message image"},null,8,fr)])])):g("",!0),he.value?(r(),l("div",{key:5,ref_key:"fileLinkContextMenuRef",ref:Et,class:"file-link-context-menu",style:It(Ls.value),onClick:n[1]||(n[1]=Ke(()=>{},["stop"]))},[d("button",{type:"button",class:"file-link-context-menu-item",onClick:Ss}," Open link "),d("button",{type:"button",class:"file-link-context-menu-item",onClick:Is}," Copy link "),Je.value?(r(),l("button",{key:0,type:"button",class:"file-link-context-menu-item",onClick:Ps}," Edit file ")):g("",!0)],4)):g("",!0),I.value?(r(),l("div",{key:6,class:"diff-viewer-backdrop",onClick:Nt},[d("div",{class:"diff-viewer-shell",onClick:n[3]||(n[3]=Ke(()=>{},["stop"]))},[At(be)?g("",!0):(r(),l("aside",hr,[d("div",pr,[n[10]||(n[10]=d("p",{class:"diff-viewer-sidebar-title"},"Changed files",-1)),d("p",mr,h(ze(ce.value.length)),1)]),d("div",vr,[(r(!0),l(v,null,b(ce.value,t=>(r(),l("button",{key:`diff-viewer:${M(t)}`,type:"button",class:"diff-viewer-file-button","data-active":M(t)===M(I.value),onClick:s=>Vt(t)},[d("span",{class:"file-change-badge","data-operation":We(t)},h(le(t)),9,gr),d("span",yr,[ne(h(P(t.path))+" ",1),t.movedToPath?(r(),l(v,{key:0},[ne(" → "+h(P(t.movedToPath)),1)],64)):g("",!0)]),J(t)?(r(),l("span",_r,h(J(t)),1)):g("",!0)],8,kr))),128))])])),d("section",wr,[d("div",br,[d("div",xr,[d("p",Cr,[ne(h(P(I.value.path))+" ",1),I.value.movedToPath?(r(),l(v,{key:0},[ne(" → "+h(P(I.value.movedToPath)),1)],64)):g("",!0)]),d("p",$r,[ne(h(le(I.value))+" ",1),J(I.value)?(r(),l("span",Lr," · "+h(J(I.value)),1)):g("",!0)])]),d("div",Tr,[At(be)?(r(),l("button",{key:0,type:"button",class:"diff-viewer-mobile-files-button",onClick:qn},h(ze(ce.value.length)),1)):g("",!0),d("button",{class:"image-modal-close diff-viewer-close",type:"button","aria-label":"Close diff viewer",onClick:Nt},[te(Wn,{class:"icon-svg"})])])]),vs(I.value)?(r(),l("div",Sr,[d("div",Pr,[d("span",Ir,h(us(I.value)||"diff"),1)]),d("div",Ar,[(r(!0),l(v,null,b(ms.value,t=>(r(),l("div",{key:t.key,class:"diff-viewer-line","data-kind":t.kind},[d("span",Br,h(t.oldLine??""),1),d("span",Er,h(t.newLine??""),1),d("span",Rr,h(ks(t)),1),d("code",{class:"diff-viewer-line-code",innerHTML:$(t.text)||" "},null,8,Wr)],8,Fr))),128))])])):(r(),l("div",Mr,[...n[11]||(n[11]=[d("p",{class:"diff-viewer-empty-title"},"No diff available",-1),d("p",{class:"diff-viewer-empty-text"},"This summary was restored from the final answer text, but the thread history does not include patch diff content for this file.",-1)])]))]),te(ii,{name:"diff-viewer-sheet"},{default:Rn(()=>[At(be)&&K.value?(r(),l("div",{key:0,class:"diff-viewer-mobile-sheet-backdrop",onClick:Kn},[d("div",{class:"diff-viewer-mobile-sheet",onClick:n[2]||(n[2]=Ke(()=>{},["stop"]))},[n[13]||(n[13]=d("div",{class:"diff-viewer-mobile-sheet-handle","aria-hidden":"true"},null,-1)),d("div",zr,[n[12]||(n[12]=d("p",{class:"diff-viewer-sidebar-title"},"Changed files",-1)),d("p",Or,h(ze(ce.value.length)),1)]),d("div",Hr,[(r(!0),l(v,null,b(ce.value,t=>(r(),l("button",{key:`diff-viewer-sheet:${M(t)}`,type:"button",class:"diff-viewer-file-button","data-active":M(t)===M(I.value),onClick:s=>Vt(t)},[d("span",{class:"file-change-badge","data-operation":We(t)},h(le(t)),9,Dr),d("span",Ur,[ne(h(P(t.path))+" ",1),t.movedToPath?(r(),l(v,{key:0},[ne(" → "+h(P(t.movedToPath)),1)],64)):g("",!0)]),J(t)?(r(),l("span",Nr,h(J(t)),1)):g("",!0)],8,jr))),128))])])])):g("",!0)]),_:1})])])):g("",!0)],32))}}),Jr=Bt(Gr,[["__scopeId","data-v-5b087fc8"]]);export{Jr as default};
40
- //# sourceMappingURL=ThreadConversation-BPPi3GXY.js.map