spec-cat 0.1.12 → 0.1.13
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/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{CG1pdqEM.js → ASOk6VwA.js} +1 -1
- package/.output/public/_nuxt/B24bRLVA.js +1 -0
- package/.output/public/_nuxt/{DZfSmUhR.js → B3SzeM5g.js} +1 -1
- package/.output/public/_nuxt/{wF8_ZCpc.js → CPqjerP3.js} +1 -1
- package/.output/public/_nuxt/D3Ay6Tay.js +126 -0
- package/.output/public/_nuxt/{BGX7vZ2E.js → DN_vgzh9.js} +1 -1
- package/.output/public/_nuxt/{CJ5aKHH_.js → Djrn6aq0.js} +2 -2
- package/.output/public/_nuxt/{BgAW4X6A.js → DqCsQSnP.js} +1 -1
- package/.output/public/_nuxt/{Bo0qwvIG.js → afuUTAOf.js} +1 -1
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/a94a9679-4171-4043-b507-a48b9a35f087.json +1 -0
- package/.output/public/_nuxt/{BRNtaPwh.js → dYG8t45S.js} +1 -1
- package/.output/public/_nuxt/entry.qjEvbHpP.css +1 -0
- package/.output/server/chunks/_/chat.mjs +8 -2
- package/.output/server/chunks/_/chat.mjs.map +1 -1
- package/.output/server/chunks/_/codexProvider.mjs +62 -102
- package/.output/server/chunks/_/codexProvider.mjs.map +1 -1
- package/.output/server/chunks/_/providerProcessError.mjs.map +1 -1
- package/.output/server/chunks/_/validateWorktree.mjs +1 -1
- package/.output/server/chunks/build/client.precomputed.mjs +1 -1
- package/.output/server/chunks/build/client.precomputed.mjs.map +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +813 -795
- package/.output/server/chunks/routes/_ws.mjs +346 -256
- package/.output/server/chunks/routes/_ws.mjs.map +1 -1
- package/.output/server/chunks/routes/api/chat/finalize.post.mjs +8 -6
- package/.output/server/chunks/routes/api/chat/finalize.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/chat/generate-commit-message.post.mjs +1 -1
- package/.output/server/chunks/routes/api/chat/preview.post.mjs +1 -1
- package/.output/server/chunks/routes/api/chat/preview.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/chat/rebase.post.mjs +1 -1
- package/.output/server/chunks/routes/api/chat/worktree.post.mjs +3 -3
- package/.output/server/chunks/routes/api/chat/worktree.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/conversations/archives/_archiveId/restore.post.mjs +3 -7
- package/.output/server/chunks/routes/api/conversations/archives/_archiveId/restore.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/conversations/update.post.mjs +59 -0
- package/.output/server/chunks/routes/api/conversations/update.post.mjs.map +1 -0
- package/.output/server/chunks/routes/api/rebase/continue-sync.post.mjs +1 -1
- package/.output/server/chunks/routes/api/rebase/continue.post.mjs +8 -6
- package/.output/server/chunks/routes/api/rebase/continue.post.mjs.map +1 -1
- package/.output/server/package.json +1 -1
- package/package.json +1 -1
- package/.output/public/_nuxt/CQT7IgVF.js +0 -1
- package/.output/public/_nuxt/CWTghksz.js +0 -128
- package/.output/public/_nuxt/builds/meta/83cad684-1ef2-41bf-8031-41fb1a7c2996.json +0 -1
- package/.output/public/_nuxt/entry.CA9G_QPQ.css +0 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./B3SzeM5g.js","./Djrn6aq0.js","./entry.qjEvbHpP.css","./DqCsQSnP.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{y as i,z as u,A as r,d as Be,C as Y,G as o,P as Le,R as Ct,Q as We,S as ve,E as Ae,B as w,O as D,g as k,U as Ie,V as hn,k as R,W as Et,H as ke,L as he,o as vt,X as wt,Y as Vo,K as De,Z as Yt,T as Xt,_ as In,M as pn,D as nt,N as yt,$ as Ds,I as xr,a0 as Ce,a1 as _n,a2 as Ut,a3 as Bn,a4 as Lr,a5 as Is,a6 as go,a7 as Wo,a8 as Ls,q as Ns,a9 as Fs,x as Hs,aa as xo}from"./Djrn6aq0.js";import{r as $t,c as vn,b as br,a as Tn}from"./dYG8t45S.js";import{_ as yr}from"./DlAUqK2U.js";import{S as mr,i as Os,c as Us,P as js,W as bo,M as yo,d as wo,e as ko,g as hr,f as Go,D as qo,h as Ko,j as zs,u as Hn,b as On,k as Pn,l as Vs,a as Nr,m as Dn,n as or,_ as Ws}from"./B3SzeM5g.js";function Gs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"})])}function qs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5m8.25 3v6.75m0 0-3-3m3 3 3-3M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"})])}function Fr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m20.25 7.5-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5M10 11.25h4M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"})])}function Ks(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 8.25H7.5a2.25 2.25 0 0 0-2.25 2.25v9a2.25 2.25 0 0 0 2.25 2.25h9a2.25 2.25 0 0 0 2.25-2.25v-9a2.25 2.25 0 0 0-2.25-2.25H15M9 12l3 3m0 0 3-3m-3 3V2.25"})])}function Zs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12m4.5 4.5V3"})])}function Ys(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"})])}function Zo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 12c0-1.232-.046-2.453-.138-3.662a4.006 4.006 0 0 0-3.7-3.7 48.678 48.678 0 0 0-7.324 0 4.006 4.006 0 0 0-3.7 3.7c-.017.22-.032.441-.046.662M19.5 12l3-3m-3 3-3-3m-12 3c0 1.232.046 2.453.138 3.662a4.006 4.006 0 0 0 3.7 3.7 48.656 48.656 0 0 0 7.324 0 4.006 4.006 0 0 0 3.7-3.7c.017-.22.032-.441.046-.662M4.5 12l3 3m-3-3-3 3"})])}function Yo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"})])}function Xo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 15 3 9m0 0 6-6M3 9h12a6 6 0 0 1 0 12h-3"})])}function Qo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 9V4.5M9 9H4.5M9 9 3.75 3.75M9 15v4.5M9 15H4.5M9 15l-5.25 5.25M15 9h4.5M15 9V4.5M15 9l5.25-5.25M15 15h4.5M15 15v4.5m0-4.5 5.25 5.25"})])}function Jo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})])}function es(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"})])}function Xs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.75 3.104v5.714a2.25 2.25 0 0 1-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 0 1 4.5 0m0 0v5.714c0 .597.237 1.17.659 1.591L19.8 15.3M14.25 3.104c.251.023.501.05.75.082M19.8 15.3l-1.57.393A9.065 9.065 0 0 1 12 15a9.065 9.065 0 0 0-6.23-.693L5 14.5m14.8.8 1.402 1.402c1.232 1.232.65 3.318-1.067 3.611A48.309 48.309 0 0 1 12 21c-2.773 0-5.491-.235-8.135-.687-1.718-.293-2.3-2.379-1.067-3.61L5 14.5"})])}function Zr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m3.75 13.5 10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75Z"})])}function Qs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 12.75c1.148 0 2.278.08 3.383.237 1.037.146 1.866.966 1.866 2.013 0 3.728-2.35 6.75-5.25 6.75S6.75 18.728 6.75 15c0-1.046.83-1.867 1.866-2.013A24.204 24.204 0 0 1 12 12.75Zm0 0c2.883 0 5.647.508 8.207 1.44a23.91 23.91 0 0 1-1.152 6.06M12 12.75c-2.883 0-5.647.508-8.208 1.44.125 2.104.52 4.136 1.153 6.06M12 12.75a2.25 2.25 0 0 0 2.248-2.354M12 12.75a2.25 2.25 0 0 1-2.248-2.354M12 8.25c.995 0 1.971-.08 2.922-.236.403-.066.74-.358.795-.762a3.778 3.778 0 0 0-.399-2.25M12 8.25c-.995 0-1.97-.08-2.922-.236-.402-.066-.74-.358-.795-.762a3.734 3.734 0 0 1 .4-2.253M12 8.25a2.25 2.25 0 0 0-2.248 2.146M12 8.25a2.25 2.25 0 0 1 2.248 2.146M8.683 5a6.032 6.032 0 0 1-1.155-1.002c.07-.63.27-1.222.574-1.747m.581 2.749A3.75 3.75 0 0 1 15.318 5m0 0c.427-.283.815-.62 1.155-.999a4.471 4.471 0 0 0-.575-1.752M4.921 6a24.048 24.048 0 0 0-.392 3.314c1.668.546 3.416.914 5.223 1.082M19.08 6c.205 1.08.337 2.187.392 3.314a23.882 23.882 0 0 1-5.223 1.082"})])}function Js(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M20.25 8.511c.884.284 1.5 1.128 1.5 2.097v4.286c0 1.136-.847 2.1-1.98 2.193-.34.027-.68.052-1.02.072v3.091l-3-3c-1.354 0-2.694-.055-4.02-.163a2.115 2.115 0 0 1-.825-.242m9.345-8.334a2.126 2.126 0 0 0-.476-.095 48.64 48.64 0 0 0-8.048 0c-1.131.094-1.976 1.057-1.976 2.192v4.286c0 .837.46 1.58 1.155 1.951m9.345-8.334V6.637c0-1.621-1.152-3.026-2.76-3.235A48.455 48.455 0 0 0 11.25 3c-2.115 0-4.198.137-6.24.402-1.608.209-2.76 1.614-2.76 3.235v6.226c0 1.621 1.152 3.026 2.76 3.235.577.075 1.157.14 1.74.194V21l4.155-4.155"})])}function ts(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.25 12.76c0 1.6 1.123 2.994 2.707 3.227 1.087.16 2.185.283 3.293.369V21l4.076-4.076a1.526 1.526 0 0 1 1.037-.443 48.282 48.282 0 0 0 5.68-.494c1.584-.233 2.707-1.626 2.707-3.228V6.741c0-1.602-1.123-2.995-2.707-3.228A48.394 48.394 0 0 0 12 3c-2.392 0-4.744.175-7.043.513C3.373 3.746 2.25 5.14 2.25 6.741v6.018Z"})])}function wr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})])}function Yr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 12.75 6 6 9-13.5"})])}function ea(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})])}function Xr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m8.25 4.5 7.5 7.5-7.5 7.5"})])}function Qr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 15 12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9"})])}function ta(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m4.5 15.75 7.5-7.5 7.5 7.5"})])}function Jr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25ZM6.75 12h.008v.008H6.75V12Zm0 3h.008v.008H6.75V15Zm0 3h.008v.008H6.75V18Z"})])}function Ln(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 7.5V6.108c0-1.135.845-2.098 1.976-2.192.373-.03.748-.057 1.123-.08M15.75 18H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08M15.75 18.75v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5A3.375 3.375 0 0 0 6.375 7.5H5.25m11.9-3.664A2.251 2.251 0 0 0 15 2.25h-1.5a2.251 2.251 0 0 0-2.15 1.586m5.8 0c.065.21.1.433.1.664v.75h-6V4.5c0-.231.035-.454.1-.664M6.75 7.5H4.875c-.621 0-1.125.504-1.125 1.125v12c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V16.5a9 9 0 0 0-9-9Z"})])}function ns(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})])}function rs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9.75v6.75m0 0-3-3m3 3 3-3m-8.25 6a4.5 4.5 0 0 1-1.41-8.775 5.25 5.25 0 0 1 10.233-2.33 3 3 0 0 1 3.758 3.848A3.752 3.752 0 0 1 18 19.5H6.75Z"})])}function Hr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M17.25 6.75 22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3-4.5 16.5"})])}function os(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function na(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z"})])}function ss(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 0 0 2.25-2.25V6.75a2.25 2.25 0 0 0-2.25-2.25H6.75A2.25 2.25 0 0 0 4.5 6.75v10.5a2.25 2.25 0 0 0 2.25 2.25Zm.75-12h9v9h-9v-9Z"})])}function ra(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10.125 2.25h-4.5c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125v-9M10.125 2.25h.375a9 9 0 0 1 9 9v.375M10.125 2.25A3.375 3.375 0 0 1 13.5 5.625v1.5c0 .621.504 1.125 1.125 1.125h1.5a3.375 3.375 0 0 1 3.375 3.375M9 15l2.25 2.25L15 12"})])}function oa(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75"})])}function sa(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m5.231 13.481L15 17.25m-4.5-15H5.625c-.621 0-1.125.504-1.125 1.125v16.5c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Zm3.75 11.625a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z"})])}function Nn(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"})])}function Un(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z"})])}function wn(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})])}function aa(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88"})])}function as(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})])}function ia(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 0 0-1.883 2.542l.857 6a2.25 2.25 0 0 0 2.227 1.932H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-1.883-2.542m-16.5 0V6A2.25 2.25 0 0 1 6 3.75h3.879a1.5 1.5 0 0 1 1.06.44l2.122 2.12a1.5 1.5 0 0 0 1.06.44H18A2.25 2.25 0 0 1 20.25 9v.776"})])}function Or(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M2.25 12.75V12A2.25 2.25 0 0 1 4.5 9.75h15A2.25 2.25 0 0 1 21.75 12v.75m-8.69-6.44-2.12-2.12a1.5 1.5 0 0 0-1.061-.44H4.5A2.25 2.25 0 0 0 2.25 6v12a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 18V9a2.25 2.25 0 0 0-2.25-2.25h-5.379a1.5 1.5 0 0 1-1.06-.44Z"})])}function la(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 3c2.755 0 5.455.232 8.083.678.533.09.917.556.917 1.096v1.044a2.25 2.25 0 0 1-.659 1.591l-5.432 5.432a2.25 2.25 0 0 0-.659 1.591v2.927a2.25 2.25 0 0 1-1.244 2.013L9.75 21v-6.568a2.25 2.25 0 0 0-.659-1.591L3.659 7.409A2.25 2.25 0 0 1 3 5.818V4.774c0-.54.384-1.006.917-1.096A48.32 48.32 0 0 1 12 3Z"})])}function ca(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5-3.9 19.5m-2.1-19.5-3.9 19.5"})])}function ua(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"})])}function da(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 18v-5.25m0 0a6.01 6.01 0 0 0 1.5-.189m-1.5.189a6.01 6.01 0 0 1-1.5-.189m3.75 7.478a12.06 12.06 0 0 1-4.5 0m3.75 2.383a14.406 14.406 0 0 1-3 0M14.25 18v-.192c0-.983.658-1.823 1.508-2.316a7.5 7.5 0 1 0-7.517 0c.85.493 1.509 1.333 1.509 2.316V18"})])}function is(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0ZM3.75 12h.007v.008H3.75V12Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm-.375 5.25h.007v.008H3.75v-.008Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"})])}function Mn(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"})])}function fa(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 12h14"})])}function ma(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M21.752 15.002A9.72 9.72 0 0 1 18 15.75c-5.385 0-9.75-4.365-9.75-9.75 0-1.33.266-2.597.748-3.752A9.753 9.753 0 0 0 3 11.25C3 16.635 7.365 21 12.75 21a9.753 9.753 0 0 0 9.002-5.998Z"})])}function ha(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13"})])}function eo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10"})])}function ls(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8.8-2.685a4.5 4.5 0 0 1 1.13-1.897L16.863 4.487Zm0 0L19.5 7.125"})])}function pa(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"})])}function Co(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.96.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z"})])}function to(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 5.25h.008v.008H12v-.008Z"})])}function cs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"})])}function no(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3.75m0-10.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.75c0 5.592 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.57-.598-3.75h-.152c-3.196 0-6.1-1.25-8.25-3.286Zm0 13.036h.008v.008H12v-.008Z"})])}function kr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 0 0-2.456 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z"})])}function va(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 3v2.25m6.364.386-1.591 1.591M21 12h-2.25m-.386 6.364-1.591-1.591M12 18.75V21m-4.773-4.227-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0Z"})])}function ro(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9.568 3H5.25A2.25 2.25 0 0 0 3 5.25v4.318c0 .597.237 1.17.659 1.591l9.581 9.581c.699.699 1.78.872 2.607.33a18.095 18.095 0 0 0 5.223-5.223c.542-.827.369-1.908-.33-2.607L11.16 3.66A2.25 2.25 0 0 0 9.568 3Z"}),r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 6h.008v.008H6V6Z"})])}function Ur(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15.75 6a3.75 3.75 0 1 1-7.5 0 3.75 3.75 0 0 1 7.5 0ZM4.501 20.118a7.5 7.5 0 0 1 14.998 0A17.933 17.933 0 0 1 12 21.75c-2.676 0-5.216-.584-7.499-1.632Z"})])}function ga(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M11.42 15.17 17.25 21A2.652 2.652 0 0 0 21 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 1 1-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 0 0 4.486-6.336l-3.276 3.277a3.004 3.004 0 0 1-2.25-2.25l3.276-3.276a4.5 4.5 0 0 0-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437 1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008Z"})])}const xa={class:"flex items-center gap-1.5 px-2 py-1.5 bg-retro-panel border-b border-retro-border"},ba={class:"relative flex-1 min-w-0"},ya={key:0,class:"text-[11px] text-retro-muted flex-shrink-0 min-w-[60px] text-center"},wa=["disabled"],ka=["disabled"],Ca=Be({__name:"GitFindWidget",props:{resultCount:{},currentIndex:{}},emits:["search","next","prev","close"],setup(e,{expose:n,emit:t}){const a=t,s=k(""),l=k(null);let c=null;function d(){c&&clearTimeout(c),c=setTimeout(()=>{a("search",s.value)},200)}function h(S){S.key==="Escape"?(S.preventDefault(),a("close")):S.key==="Enter"&&(S.preventDefault(),S.shiftKey?a("prev"):a("next"))}function m(){l.value?.focus(),l.value?.select()}return n({focus:m}),(S,$)=>(i(),u("div",xa,[Y(o(Mn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("div",ba,[Le(r("input",{ref_key:"inputRef",ref:l,"onUpdate:modelValue":$[0]||($[0]=x=>We(s)?s.value=x:null),type:"text",placeholder:"Find in commits...","aria-label":"Search commits",class:"w-full px-2 py-1 text-sm bg-retro-dark border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",onInput:d,onKeydown:h},null,544),[[Ct,o(s)]])]),o(s)?(i(),u("span",ya,[e.resultCount>0?(i(),u(ve,{key:0},[Ae(w(e.currentIndex+1)+" of "+w(e.resultCount),1)],64)):(i(),u(ve,{key:1},[Ae(" No results ")],64))])):D("",!0),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors",disabled:e.resultCount===0,"aria-label":"Previous result",title:"Previous (Shift+Enter)",onClick:$[1]||($[1]=x=>a("prev"))},[Y(o(ta),{class:"w-4 h-4"})],8,wa),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text disabled:opacity-30 disabled:cursor-not-allowed transition-colors",disabled:e.resultCount===0,"aria-label":"Next result",title:"Next (Enter)",onClick:$[2]||($[2]=x=>a("next"))},[Y(o(ea),{class:"w-4 h-4"})],8,ka),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors","aria-label":"Close find widget",title:"Close (Escape)",onClick:$[3]||($[3]=x=>a("close"))},[Y(o($t),{class:"w-4 h-4"})])]))}}),$a={class:"flex flex-col bg-retro-dark border border-retro-border rounded shadow-lg max-w-md w-full"},Sa={class:"flex items-center justify-between px-3 py-2 border-b border-retro-border"},_a={class:"flex-1 overflow-auto max-h-[300px]"},Ma={class:"font-semibold text-retro-cyan flex-shrink-0 min-w-[60px]"},Ta=["onKeyup"],Aa=["onClick"],Ba={class:"text-retro-muted truncate flex-1 font-mono"},Ea=["onClick"],Ra=["onClick"],Pa={key:0,class:"px-3 py-4 text-center text-retro-muted text-xs"},Da={key:0,class:"px-3 py-2 border-t border-retro-border space-y-2"},Ia={class:"flex gap-2 justify-end"},La=["disabled"],Na={key:1,class:"px-3 py-2 border-t border-retro-border"},Fa=Be({__name:"GitRemoteManager",props:{remotes:{},loading:{type:Boolean}},emits:["add","edit","delete","close"],setup(e,{emit:n}){const t=n,a=k(!1),s=k(""),l=k(""),c=k(null),d=k("");function h(){a.value=!0,s.value="",l.value=""}function m(){!s.value.trim()||!l.value.trim()||(t("add",{name:s.value.trim(),url:l.value.trim()}),a.value=!1)}function S(b){c.value=b.name,d.value=b.fetchUrl}function $(b){d.value.trim()&&(t("edit",{name:b,newUrl:d.value.trim()}),c.value=null)}function x(){c.value=null}return(b,y)=>(i(),u("div",$a,[r("div",Sa,[y[5]||(y[5]=r("h3",{class:"text-sm font-semibold text-retro-text"},"Remote Repositories",-1)),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",onClick:y[0]||(y[0]=_=>t("close"))},[Y(o($t),{class:"w-4 h-4"})])]),r("div",_a,[(i(!0),u(ve,null,Ie(e.remotes,_=>(i(),u("div",{key:_.name,class:"flex items-center gap-2 px-3 py-2 border-b border-retro-border/50 text-xs"},[r("span",Ma,w(_.name),1),o(c)===_.name?(i(),u(ve,{key:0},[Le(r("input",{"onUpdate:modelValue":y[1]||(y[1]=W=>We(d)?d.value=W:null),type:"text",class:"flex-1 px-2 py-1 text-xs bg-retro-panel border border-retro-border rounded text-retro-text focus:outline-none focus:border-retro-cyan",onKeyup:[hn(W=>$(_.name),["enter"]),hn(x,["escape"])]},null,40,Ta),[[Ct,o(d)]]),r("button",{class:"p-0.5 text-retro-green hover:text-retro-green/80",onClick:W=>$(_.name)},[Y(o(Yr),{class:"w-3.5 h-3.5"})],8,Aa),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",onClick:x},[Y(o($t),{class:"w-3.5 h-3.5"})])],64)):(i(),u(ve,{key:1},[r("span",Ba,w(_.fetchUrl),1),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",title:"Edit",onClick:W=>S(_)},[Y(o(eo),{class:"w-3.5 h-3.5"})],8,Ea),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-red",title:"Delete",onClick:W=>t("delete",_.name)},[Y(o(vn),{class:"w-3.5 h-3.5"})],8,Ra)],64))]))),128)),e.remotes.length===0?(i(),u("div",Pa," No remotes configured ")):D("",!0)]),o(a)?(i(),u("div",Da,[Le(r("input",{"onUpdate:modelValue":y[2]||(y[2]=_=>We(s)?s.value=_:null),type:"text",placeholder:"Remote name (e.g., origin)",class:"w-full px-2 py-1 text-xs bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan"},null,512),[[Ct,o(s)]]),Le(r("input",{"onUpdate:modelValue":y[3]||(y[3]=_=>We(l)?l.value=_:null),type:"text",placeholder:"Remote URL",class:"w-full px-2 py-1 text-xs bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",onKeyup:hn(m,["enter"])},null,544),[[Ct,o(l)]]),r("div",Ia,[r("button",{class:"px-2 py-1 text-xs text-retro-muted hover:text-retro-text transition-colors",onClick:y[4]||(y[4]=_=>a.value=!1)}," Cancel "),r("button",{class:"px-2 py-1 text-xs bg-retro-cyan/20 text-retro-cyan border border-retro-cyan/40 rounded hover:bg-retro-cyan/30 transition-colors",disabled:!o(s).trim()||!o(l).trim(),onClick:m}," Add Remote ",8,La)])])):D("",!0),o(a)?D("",!0):(i(),u("div",Na,[r("button",{class:"flex items-center gap-1 text-xs text-retro-cyan hover:text-retro-cyan/80 transition-colors",onClick:h},[Y(o(br),{class:"w-3.5 h-3.5"}),y[6]||(y[6]=Ae(" Add Remote ",-1))])]))]))}}),Cr={NODE_RADIUS:4,ROW_HEIGHT:32,COLUMN_WIDTH:20,PADDING:10,VISIBLE_BUFFER:10},sr=["#3B82F6","#EF4444","#10B981","#F59E0B","#8B5CF6","#EC4899","#14B8A6","#F97316","#06B6D4","#84CC16","#F43F5E","#A855F7"],Fn={A:{label:"Added",colorClass:"text-retro-green"},M:{label:"Modified",colorClass:"text-retro-yellow"},D:{label:"Deleted",colorClass:"text-retro-red"},R:{label:"Renamed",colorClass:"text-retro-blue"},C:{label:"Copied",colorClass:"text-retro-purple"},U:{label:"Unmerged",colorClass:"text-retro-cyan"}},Ha=["width","height"],Oa=["d","stroke","stroke-dasharray"],Ua={key:0},ja=["cx","r"],za=["cx","r","fill"],Va=["cx","r","stroke"],Wa=["cx","r","fill"],Ga=["cx","r","stroke"],qa=["cx","r","fill"],Ka=["cx","r"],Za=["cx","r","fill"],us=Be({__name:"GitGraphSvg",props:{rowData:{},maxLane:{default:4},highlightBranches:{},tooltipText:{}},setup(e){const n=e,{COLUMN_WIDTH:t,ROW_HEIGHT:a,NODE_RADIUS:s,PADDING:l}=Cr,c=R(()=>l*2+(n.maxLane+1)*t),d=a,h=a/2;function m(x){return l+x*t}function S(x){const b=m(x.fromLane),y=m(x.toLane);if(x.type==="vertical")return`M ${b} 0 L ${y} ${d}`;if(x.type==="vertical-top")return`M ${b} 0 L ${b} ${h}`;if(x.type==="vertical-bottom")return`M ${b} ${h} L ${b} ${d}`;if(x.style==="rounded")return`M ${b} ${h} C ${b} ${d}, ${y} ${d}, ${y} ${d}`;{const _=d*.75;return`M ${b} ${h} L ${b} ${_} L ${y} ${d}`}}const $=R(()=>n.rowData?m(n.rowData.lane):l);return(x,b)=>(i(),u("svg",{width:o(c),height:o(d),class:"block flex-shrink-0","aria-hidden":"true"},[e.rowData?(i(),u(ve,{key:0},[(i(!0),u(ve,null,Ie(e.rowData.connections,(y,_)=>(i(),u("path",{key:_,d:S(y),stroke:y.color,"stroke-width":"2",fill:"none","stroke-dasharray":y.type.startsWith("merge")?"4 3":"none"},null,8,Oa))),128)),r("g",null,[e.tooltipText?(i(),u("title",Ua,w(e.tooltipText),1)):D("",!0),e.rowData.nodeType==="head"?(i(),u(ve,{key:1},[r("circle",{cx:o($),cy:h,r:o(s)+2,fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-cyan"},null,8,ja),r("circle",{cx:o($),cy:h,r:o(s),fill:e.rowData.color},null,8,za)],64)):e.rowData.nodeType==="merge"?(i(),u(ve,{key:2},[r("circle",{cx:o($),cy:h,r:o(s)+1,fill:"none",stroke:e.rowData.color,"stroke-width":"1.5"},null,8,Va),r("circle",{cx:o($),cy:h,r:o(s)-1,fill:e.rowData.color},null,8,Wa)],64)):e.rowData.nodeType==="stash"?(i(),u(ve,{key:3},[r("circle",{cx:o($),cy:h,r:o(s),fill:"none",stroke:e.rowData.color,"stroke-width":"2"},null,8,Ga),r("circle",{cx:o($),cy:h,r:o(s)-2,fill:e.rowData.color},null,8,qa)],64)):e.rowData.nodeType==="uncommitted"?(i(),u("circle",{key:4,cx:o($),cy:h,r:o(s),fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-yellow","stroke-dasharray":"3 2"},null,8,Ka)):(i(),u("circle",{key:5,cx:o($),cy:h,r:o(s),fill:e.rowData.color},null,8,Za))])],64)):D("",!0)],8,Ha))}}),Ya=["aria-selected","aria-label"],Xa={key:1,class:"flex gap-1 flex-shrink-0"},Qa=["title","onContextmenu"],Ja={key:2,class:"flex gap-1 flex-shrink-0"},ei=["onContextmenu"],ti={class:"text-retro-text text-xs truncate flex-1"},ni={key:5,class:"flex-shrink-0 text-retro-muted text-[10px] hidden sm:inline"},ri={key:6,class:"flex-shrink-0 text-retro-muted text-[10px]"},oi=Be({__name:"GitCommitRow",props:{commit:{},index:{},isSelected:{type:Boolean},isHighlighted:{type:Boolean},isBranchHighlighted:{type:Boolean},isFeatureHighlighted:{type:Boolean},isPreviewHighlighted:{type:Boolean},isMuted:{type:Boolean},currentBranchName:{},localBranchNames:{},graphRowData:{},maxLane:{},columnVisibility:{}},emits:["click","keydown","branchContextMenu","commitContextMenu","tagContextMenu"],setup(e,{emit:n}){const t=e,a=n,s=R(()=>{const x=t.commit.branches;if(x.length===0)return[];const b=t.localBranchNames,y=[],_=[];for(const E of x)b.has(E)?y.push(E):_.push(E);const W=new Set(y),B=new Map,z=[];for(const E of _){const oe=E.indexOf("/");if(oe>0){const ce=E.substring(oe+1),de=E.substring(0,oe);W.has(ce)?(B.has(ce)||B.set(ce,[]),B.get(ce).push(de)):z.push(E)}else z.push(E)}const V=[];for(const E of y){const oe=B.get(E)||[];oe.length>0?V.push({displayName:`${E}/${oe.join(",")}`,originalBranches:[E,...oe.map(ce=>`${ce}/${E}`)],isLocal:!0}):V.push({displayName:E,originalBranches:[E],isLocal:!0})}for(const E of z)V.push({displayName:E,originalBranches:[E],isLocal:!1});return V});function l(x,b){x.preventDefault(),x.stopPropagation();const y=b.originalBranches[0];a("branchContextMenu",{branch:y,x:x.clientX,y:x.clientY,isCurrentBranch:b.isLocal&&b.originalBranches.includes(t.currentBranchName??""),isLocal:b.isLocal})}function c(x,b){x.preventDefault(),x.stopPropagation(),a("tagContextMenu",{tag:b,x:x.clientX,y:x.clientY})}function d(x){x.preventDefault(),x.stopPropagation(),a("commitContextMenu",{x:x.clientX,y:x.clientY})}const{ROW_HEIGHT:h}=Cr,m=R(()=>{const x=[t.commit.shortHash];return t.commit.branches.length>0&&x.push(t.commit.branches.join(", ")),t.commit.tags.length>0&&x.push(t.commit.tags.map(b=>`tag: ${b}`).join(", ")),x.join(" — ")});function S(x){const y=Date.now()/1e3-x;return y<60?"just now":y<3600?`${Math.floor(y/60)}m ago`:y<86400?`${Math.floor(y/3600)}h ago`:y<604800?`${Math.floor(y/86400)}d ago`:y<2592e3?`${Math.floor(y/604800)}w ago`:new Date(x*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function $(x){const b=x.split(`
|
|
3
|
+
`)[0];return b.length>72?b.substring(0,69)+"...":b}return(x,b)=>{const y=us;return i(),u("div",{class:ke(["flex items-center cursor-pointer group focus:outline-none focus:ring-1 focus:ring-retro-cyan/50 focus:ring-inset",{"opacity-40":e.isMuted,"bg-retro-red/10":e.isPreviewHighlighted,"bg-retro-yellow/20":e.isFeatureHighlighted&&!e.isPreviewHighlighted}]),style:Et({height:`${o(h)}px`}),role:"row",tabindex:"0","aria-selected":e.isSelected,"aria-label":`Commit ${e.commit.shortHash} by ${e.commit.author}: ${e.commit.message.split(`
|
|
4
|
+
`)[0]}`,onClick:b[0]||(b[0]=_=>a("click",_)),onKeydown:b[1]||(b[1]=_=>a("keydown",_)),onContextmenu:d},[Y(y,{rowData:e.graphRowData,maxLane:e.maxLane,tooltipText:o(m)},null,8,["rowData","maxLane","tooltipText"]),r("div",{class:ke(["flex-1 flex items-center gap-2 px-2 min-w-0 rounded-r transition-colors",{"bg-retro-red/10 border-l-2 border-retro-red/40":e.isPreviewHighlighted,"bg-retro-yellow/30 border-l-2 border-retro-yellow":e.isFeatureHighlighted&&!e.isPreviewHighlighted,"bg-retro-cyan/15":e.isSelected&&!e.isFeatureHighlighted&&!e.isPreviewHighlighted,"bg-retro-yellow/10":e.isHighlighted&&!e.isSelected&&!e.isFeatureHighlighted&&!e.isPreviewHighlighted,"bg-retro-cyan/5":e.isBranchHighlighted&&!e.isSelected&&!e.isHighlighted&&!e.isFeatureHighlighted&&!e.isPreviewHighlighted,"group-hover:bg-retro-panel/50":!e.isSelected&&!e.isHighlighted&&!e.isFeatureHighlighted&&!e.isPreviewHighlighted&&!e.isBranchHighlighted}]),style:Et({height:`${o(h)-4}px`})},[!e.columnVisibility||e.columnVisibility.commit!==!1?(i(),u("span",{key:0,class:ke(["flex-shrink-0 font-mono text-[11px]",e.commit.isHead?"text-retro-cyan font-semibold":"text-retro-muted"])},w(e.commit.shortHash),3)):D("",!0),o(s).length>0?(i(),u("div",Xa,[(i(!0),u(ve,null,Ie(o(s),_=>(i(),u("span",{key:_.displayName,class:ke(["px-1.5 py-0.5 text-[10px] rounded font-semibold leading-none cursor-context-menu hover:ring-1 hover:ring-retro-cyan/50",e.commit.isHead&&_.isLocal?"bg-retro-cyan/20 text-retro-cyan border border-retro-cyan/40":e.isPreviewHighlighted?"bg-retro-red/10 text-retro-red border border-retro-red/40":e.isFeatureHighlighted?"bg-retro-yellow/15 text-retro-yellow border border-retro-yellow/30":e.isBranchHighlighted?"bg-retro-cyan/15 text-retro-cyan/80 border border-retro-cyan/30":_.isLocal?"bg-retro-green/15 text-retro-green border border-retro-green/30":"bg-retro-orange/15 text-retro-orange border border-retro-orange/30"]),title:_.originalBranches.join(", "),onContextmenu:W=>l(W,_)},w(_.displayName),43,Qa))),128))])):D("",!0),e.commit.tags.length>0?(i(),u("div",Ja,[(i(!0),u(ve,null,Ie(e.commit.tags,_=>(i(),u("span",{key:_,class:"px-1 py-0.5 text-[10px] rounded-sm bg-retro-yellow/15 text-retro-yellow border border-retro-yellow/25 flex items-center gap-0.5 leading-none cursor-context-menu hover:ring-1 hover:ring-retro-yellow/50",onContextmenu:W=>c(W,_)},[Y(o(ro),{class:"w-2.5 h-2.5"}),Ae(" "+w(_),1)],40,ei))),128))])):D("",!0),r("span",ti,w($(e.commit.message)),1),e.commit.signatureStatus==="good"?(i(),he(o(cs),{key:3,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-green",title:"Verified signature"})):e.commit.signatureStatus==="bad"?(i(),he(o(no),{key:4,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-red",title:"Bad signature"})):D("",!0),!e.columnVisibility||e.columnVisibility.author!==!1?(i(),u("span",ni,w(e.commit.author),1)):D("",!0),!e.columnVisibility||e.columnVisibility.date!==!1?(i(),u("span",ri,w(S(e.commit.timestamp)),1)):D("",!0)],6)],46,Ya)}}});function si(){const{COLUMN_WIDTH:e,ROW_HEIGHT:n,NODE_RADIUS:t,PADDING:a}=Cr;function s(h){let m=0;for(let S=0;S<h.length;S++){const $=h.charCodeAt(S);m=(m<<5)-m+$,m=m&m}return Math.abs(m)}function l(h){const m=s(h)%sr.length;return sr[m]}function c(h,m="rounded"){const S=new Map;if(h.length===0)return S;const $=new Set,x=new Map;for(const V of h)x.set(V.hash,V);const b=h.find(V=>V.isHead)||h[0];if(b){let V=b;for(;V;){$.add(V.hash);const E=V.parents?.[0];V=E?x.get(E):void 0}}const y=new Map,_=new Map,W=new Map,B=new Map,z=new Map;for(let V=0;V<h.length;V++){const E=h[V];z.set(E.hash,V);const oe=$.has(E.hash);let ce,de;if(B.has(E.hash)){const G=B.get(E.hash);ce=G.lane,de=G.color,B.delete(E.hash)}else if(oe)ce=0,de=sr[0];else{for(ce=1;W.has(ce);)ce++;de=l(E.hash.substring(0,7))}y.set(E.hash,ce),_.set(E.hash,de),W.set(ce,E.hash);const ge=E.isMerge||E.parents&&E.parents.length>1;let X="regular";E.isHead?X="head":ge&&(X="merge"),S.set(E.hash,{commitHash:E.hash,lane:ce,color:de,nodeType:X,isMainline:$.has(E.hash),connections:[]});const Z=E.parents||[];for(let G=0;G<Z.length;G++){const H=Z[G];if(y.has(H)||B.has(H))continue;const K=$.has(H);let I,v;if(G===0)I=ce,v=de;else if(K)I=0,v=sr[0];else{for(I=1;W.has(I)||I===ce;)I++;v=l(H.substring(0,7))}B.set(H,{lane:I,color:v,childHash:E.hash})}const O=Z[0];if(!O)W.delete(ce);else{const G=y.get(O),H=B.get(O),K=G??H?.lane;K!==void 0&&K!==ce&&W.delete(ce)}}for(let V=0;V<h.length;V++){const E=h[V],oe=S.get(E.hash);if(!oe)continue;const ce=E.parents||[];for(let de=0;de<ce.length;de++){const ge=ce[de],X=y.get(ge),Z=z.get(ge);if(X===void 0)continue;const O=oe.lane,G=X,H=de===0?oe.color:_.get(ge)||l(ge.substring(0,7));if(O===G?oe.connections.push({type:"vertical-bottom",fromLane:O,toLane:G,color:H,style:m}):de>0?oe.connections.push({type:O<G?"merge-out":"merge-in",fromLane:O,toLane:G,color:H,style:m}):oe.connections.push({type:O<G?"branch-out":"branch-in",fromLane:O,toLane:G,color:H,style:m}),Z!==void 0&&Z>V+1)for(let K=V+1;K<Z;K++){const I=h[K],v=S.get(I.hash);v&&v.connections.push({type:"vertical",fromLane:G,toLane:G,color:H,style:m})}if(Z!==void 0){const K=S.get(ge);K&&K.connections.push({type:"vertical-top",fromLane:G,toLane:G,color:H,style:m})}}}return S}function d(h){let m=0;for(const S of h.values()){S.lane>m&&(m=S.lane);for(const $ of S.connections)$.fromLane>m&&(m=$.fromLane),$.toLane>m&&(m=$.toLane)}return m}return{computeGraphRows:c,computeMaxLane:d,getBranchColor:l,COLUMN_WIDTH:e,ROW_HEIGHT:n,NODE_RADIUS:t,PADDING:a}}const ai=["aria-selected"],ii={class:"text-retro-yellow text-xs font-medium"},li={key:1,class:"flex items-center justify-center gap-2 p-2 text-retro-muted text-sm"},ci={key:2,class:"p-2 text-center text-retro-muted/50 text-xs"},ui=Be({__name:"GitCommitList",props:{commits:{},stashes:{},selectedCommit:{},hasMore:{type:Boolean},loading:{type:Boolean},loadingMore:{type:Boolean},searchQuery:{},uncommittedChangesCount:{},isUncommittedChangesSelected:{type:Boolean},highlightBranches:{},featureHighlightBranches:{},featureMergeBases:{},previewHighlightBranches:{},previewMergeBases:{},currentBranchName:{},localBranchNames:{},graphStyle:{default:"rounded"},muteNonAncestral:{type:Boolean},columnVisibility:{}},emits:["select","compareSelect","loadMore","branchContextMenu","commitContextMenu","tagContextMenu","stashContextMenu","selectUncommittedChanges","scrollStart","scrollEnd"],setup(e,{expose:n,emit:t}){const a=e,s=t;function l(){s("selectUncommittedChanges")}function c(j){(j.key==="Enter"||j.key===" ")&&(j.preventDefault(),s("selectUncommittedChanges"))}const d=R(()=>a.searchQuery?.toLowerCase()??""),h=R(()=>new Set(a.highlightBranches??[])),m=R(()=>h.value.size>0),S=R(()=>{const j=d.value;if(!j)return new Set;const L=new Set;for(const ee of a.commits)(ee.message.toLowerCase().includes(j)||ee.author.toLowerCase().includes(j)||ee.shortHash.toLowerCase().includes(j)||ee.hash.toLowerCase().includes(j)||ee.branches.some(re=>re.toLowerCase().includes(j))||ee.tags.some(re=>re.toLowerCase().includes(j)))&&L.add(ee.hash);return L}),$=R(()=>{if(!m.value)return new Set;const j=new Set;for(const L of a.commits)L.branches.some(ee=>h.value.has(ee))&&j.add(L.hash);return j}),x=R(()=>{if(!a.featureHighlightBranches||a.featureHighlightBranches.length===0)return new Set;const j=a.featureMergeBases??{},L=new Map;for(const re of a.commits)L.set(re.hash,re);const ee=new Set;for(const re of a.featureHighlightBranches){const J=a.commits.find(Se=>Se.branches.includes(re));if(!J)continue;const ne=j[re]??null;if(!ne)continue;let se=J;for(;se&&se.hash!==ne;)ee.add(se.hash),se=se.parents?.[0]?L.get(se.parents[0]):void 0}return ee}),b=R(()=>{if(!a.previewHighlightBranches||a.previewHighlightBranches.length===0)return new Set;const j=a.previewMergeBases??{},L=new Map;for(const re of a.commits)L.set(re.hash,re);const ee=new Set;for(const re of a.previewHighlightBranches){const J=a.commits.find(Se=>Se.branches.includes(re));if(!J)continue;const ne=j[re]??null;if(!ne)continue;let se=J;for(;se&&se.hash!==ne;)ee.add(se.hash),se=se.parents?.[0]?L.get(se.parents[0]):void 0}return ee});function y(j,L){s("branchContextMenu",{...L,commitHash:j.hash})}function _(j,L){s("commitContextMenu",{commit:j,...L})}function W(j,L){s("tagContextMenu",{...L,commitHash:j.hash})}const{ROW_HEIGHT:B,VISIBLE_BUFFER:z}=Cr,{computeGraphRows:V,computeMaxLane:E}=si(),oe=R(()=>V([...a.commits],a.graphStyle)),ce=R(()=>E(oe.value)),de=R(()=>{const j=a.stashes||[];if(j.length===0)return a.commits.map((J,ne)=>({type:"commit",commit:J,commitIndex:ne}));const L=[],ee=[...j].sort((J,ne)=>new Date(ne.date).getTime()-new Date(J.date).getTime());let re=0;for(let J=0;J<a.commits.length;J++){const ne=a.commits[J],se=ne.timestamp*1e3;for(;re<ee.length&&new Date(ee[re].date).getTime()>=se;)L.push({type:"stash",stash:ee[re]}),re++;L.push({type:"commit",commit:ne,commitIndex:J})}for(;re<ee.length;)L.push({type:"stash",stash:ee[re]}),re++;return L}),ge=k(null),X=k(0),Z=k(400);let O=null;const G=R(()=>{const j=z,L=de.value.length,ee=Math.max(0,Math.floor(X.value/B)-j),re=Math.min(L,Math.ceil((X.value+Z.value)/B)+j);return{startIndex:ee,endIndex:re}}),H=R(()=>{const{startIndex:j,endIndex:L}=G.value;return de.value.slice(j,L).map((ee,re)=>({row:ee,index:j+re,graphRow:ee.type==="commit"&&oe.value.get(ee.commit.hash)||null,isHighlighted:ee.type==="commit"?S.value.has(ee.commit.hash):!1,isBranchHighlighted:ee.type==="commit"?$.value.has(ee.commit.hash):!1,isFeatureHighlighted:ee.type==="commit"?x.value.has(ee.commit.hash):!1,isPreviewHighlighted:ee.type==="commit"?b.value.has(ee.commit.hash):!1,isMuted:ee.type==="commit"&&a.muteNonAncestral?!(oe.value.get(ee.commit.hash)?.isMainline??!1):!1}))}),K=R(()=>de.value.length*B),I=R(()=>G.value.startIndex*B);function v(j){const L=j.target;X.value=L.scrollTop,O||s("scrollStart"),O&&clearTimeout(O),O=setTimeout(()=>{O=null,s("scrollEnd")},150),a.hasMore&&!a.loading&&!a.loadingMore&&L.scrollTop+L.clientHeight>=L.scrollHeight-200&&s("loadMore")}function g(j,L){L.ctrlKey||L.metaKey?s("compareSelect",j):s("select",j)}function T(j,L,ee){if(j.key==="Enter"||j.key===" ")j.preventDefault(),s("select",L);else if(j.key==="ArrowDown"){j.preventDefault();for(let re=ee+1;re<de.value.length;re++){const J=de.value[re];if(J.type==="commit"){s("select",J.commit),U(re);break}}}else if(j.key==="ArrowUp"){j.preventDefault();for(let re=ee-1;re>=0;re--){const J=de.value[re];if(J.type==="commit"){s("select",J.commit),U(re);break}}}}function U(j){if(!ge.value)return;const L=j*B,ee=ge.value.scrollTop,re=ee+ge.value.clientHeight;L<ee?ge.value.scrollTop=L:L+B>re&&(ge.value.scrollTop=L+B-ge.value.clientHeight)}vt(()=>{if(ge.value){Z.value=ge.value.clientHeight;const j=new ResizeObserver(L=>{for(const ee of L)Z.value=ee.contentRect.height});j.observe(ge.value),wt(()=>j.disconnect())}});function ae(){return ge.value?.scrollTop??0}function N(j){ge.value&&(ge.value.scrollTop=j)}return n({getScrollPosition:ae,setScrollPosition:N,scrollToIndex:U}),(j,L)=>{const ee=us,re=oi;return i(),u("div",{ref_key:"containerRef",ref:ge,class:"h-full overflow-auto",role:"list","aria-label":"Commit history",onScroll:v},[e.uncommittedChangesCount&&e.uncommittedChangesCount>0?(i(),u("div",{key:0,class:"flex items-center cursor-pointer group sticky top-0 z-10 bg-retro-dark border-b border-retro-border",style:Et({height:`${o(B)}px`}),role:"button",tabindex:"0","aria-selected":e.isUncommittedChangesSelected,onClick:l,onKeydown:c},[Y(ee,{rowData:{commitHash:"uncommitted",lane:0,color:"#F59E0B",nodeType:"uncommitted",isMainline:!1,connections:[]},maxLane:o(ce)},null,8,["maxLane"]),r("div",{class:ke(["flex-1 flex items-center gap-2 px-2 min-w-0 rounded-r transition-colors",{"bg-retro-yellow/15":e.isUncommittedChangesSelected,"group-hover:bg-retro-panel/50":!e.isUncommittedChangesSelected}]),style:Et({height:`${o(B)-4}px`})},[Y(o(Un),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),r("span",ii," Uncommitted Changes ("+w(e.uncommittedChangesCount)+") ",1),L[1]||(L[1]=r("span",{class:"flex-1"},null,-1)),L[2]||(L[2]=r("span",{class:"text-retro-muted text-[10px]"},"Working tree",-1))],6)],44,ai)):D("",!0),r("div",{class:"relative",style:Et({height:`${o(K)}px`})},[r("div",{class:"absolute left-0 right-0",style:Et({transform:`translateY(${o(I)}px)`})},[(i(!0),u(ve,null,Ie(o(H),({row:J,index:ne,graphRow:se,isHighlighted:Se,isBranchHighlighted:je,isFeatureHighlighted:pe,isPreviewHighlighted:ue,isMuted:_e})=>(i(),u(ve,{key:J.type==="commit"?J.commit.hash:`stash-${J.stash.index}`},[J.type==="commit"?Vo([J.commit.hash,J.commit.message,J.commit.timestamp,J.commit.branches.join("|"),J.commit.tags.join("|"),e.selectedCommit?.hash===J.commit.hash,Se,je,pe,ue,_e,a.currentBranchName||"",a.columnVisibility?.date!==!1,a.columnVisibility?.author!==!1,a.columnVisibility?.commit!==!1],()=>(i(),he(re,{key:0,commit:J.commit,index:J.commitIndex,isSelected:e.selectedCommit?.hash===J.commit.hash,isHighlighted:Se,isBranchHighlighted:je,isFeatureHighlighted:pe,isPreviewHighlighted:ue,isMuted:_e,currentBranchName:a.currentBranchName,localBranchNames:a.localBranchNames,graphRowData:se,maxLane:o(ce),columnVisibility:a.columnVisibility,onClick:Pe=>g(J.commit,Pe),onKeydown:Pe=>T(Pe,J.commit,ne),onBranchContextMenu:Pe=>y(J.commit,Pe),onCommitContextMenu:Pe=>_(J.commit,Pe),onTagContextMenu:Pe=>W(J.commit,Pe)},null,8,["commit","index","isSelected","isHighlighted","isBranchHighlighted","isFeatureHighlighted","isPreviewHighlighted","isMuted","currentBranchName","localBranchNames","graphRowData","maxLane","columnVisibility","onClick","onKeydown","onBranchContextMenu","onCommitContextMenu","onTagContextMenu"])),L,0):D("",!0)],64))),128))],4)],4),(e.loading||e.loadingMore)&&e.commits.length>0?(i(),u("div",li,[...L[3]||(L[3]=[r("div",{class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),Ae(" Loading more commits... ",-1)])])):D("",!0),!e.hasMore&&e.commits.length>0&&!e.loading?(i(),u("div",ci,w(e.commits.length)+" commits loaded ",1)):D("",!0)],544)}}});function di(e){const n=e.charAt(0).toUpperCase();return n in Fn?n:"M"}function ar(e,n){if(e&&typeof e=="object"){const t=e;if(typeof t.data?.message=="string"&&t.data.message.trim())return t.data.message;if(typeof t.statusMessage=="string"&&t.statusMessage.trim())return t.statusMessage;if(typeof t.message=="string"&&t.message.trim())return t.message}return e instanceof Error&&e.message?e.message:n}function $o(e,n){const t=n.trim().toLowerCase();return t?e.filter(a=>a.message.toLowerCase().includes(t)||a.author.toLowerCase().includes(t)||a.shortHash.includes(t)||a.hash.includes(t)||a.branches.some(s=>s.toLowerCase().includes(t))||a.tags.some(s=>s.toLowerCase().includes(t))):[...e]}function fi(e,n){return n.size===0?[...e]:e.filter(t=>t.branches.some(a=>n.has(a)))}const mi={class:"flex flex-col h-full border-t border-retro-border bg-retro-dark"},hi={class:"flex items-center justify-between p-2 border-b border-retro-border flex-shrink-0"},pi={class:"flex items-center gap-2 text-xs min-w-0"},vi={class:"font-mono text-retro-cyan"},gi={class:"font-mono text-retro-cyan"},xi={key:0,class:"px-3 py-1.5 text-xs text-retro-muted border-b border-retro-border flex-shrink-0"},bi={class:"text-retro-green"},yi={class:"text-retro-red"},wi={key:1,class:"flex-1 flex items-center justify-center"},ki={key:2,class:"flex-1 overflow-auto"},Ci={class:"text-retro-text truncate flex-1"},$i={class:"text-retro-muted"},Si={key:0,class:"flex-shrink-0 text-[10px] font-mono"},_i={key:0,class:"text-retro-green"},Mi={key:1,class:"text-retro-red ml-1"},Ti={key:1,class:"flex-shrink-0 text-[10px] text-retro-muted italic"},Ai={key:3,class:"flex-1 flex items-center justify-center text-retro-muted text-sm"},Bi=Be({__name:"GitComparisonView",props:{fromCommit:{},toCommit:{},files:{},stats:{},loading:{type:Boolean}},emits:["close"],setup(e,{emit:n}){const t=n;function a(s){const l=di(s);return Fn[l]||Fn.M}return(s,l)=>(i(),u("div",mi,[r("div",hi,[r("div",pi,[l[1]||(l[1]=r("span",{class:"text-retro-muted"},"Comparing",-1)),r("span",vi,w(e.fromCommit.shortHash),1),l[2]||(l[2]=r("span",{class:"text-retro-muted"},"→",-1)),r("span",gi,w(e.toCommit.shortHash),1)]),r("button",{class:"p-1 text-retro-muted hover:text-retro-text transition-colors flex-shrink-0","aria-label":"Close comparison",onClick:l[0]||(l[0]=c=>t("close"))},[Y(o($t),{class:"w-4 h-4"})])]),e.stats?(i(),u("div",xi,[Ae(w(e.stats.filesChanged)+" file"+w(e.stats.filesChanged!==1?"s":"")+" changed, ",1),r("span",bi,"+"+w(e.stats.additions),1),r("span",yi," -"+w(e.stats.deletions),1)])):D("",!0),e.loading?(i(),u("div",wi,[...l[3]||(l[3]=[r("div",{class:"flex items-center gap-2 text-retro-muted text-sm"},[r("div",{class:"w-4 h-4 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"}),Ae(" Loading comparison... ")],-1)])])):e.files&&e.files.length>0?(i(),u("div",ki,[(i(!0),u(ve,null,Ie(e.files,c=>(i(),u("div",{key:c.path,class:"flex items-center gap-2 px-3 py-1.5 hover:bg-retro-panel/50 text-xs border-b border-retro-border/50"},[r("span",{class:ke(["flex-shrink-0 w-4 text-center font-semibold text-[10px]",a(c.status).colorClass])},w(c.status.charAt(0)),3),r("span",Ci,[c.oldPath&&c.status.startsWith("R")?(i(),u(ve,{key:0},[r("span",$i,w(c.oldPath),1),l[4]||(l[4]=r("span",{class:"text-retro-muted mx-1"},"→",-1))],64)):D("",!0),Ae(" "+w(c.path),1)]),c.binary?(i(),u("span",Ti,"binary")):(i(),u("span",Si,[c.additions>0?(i(),u("span",_i,"+"+w(c.additions),1)):D("",!0),c.deletions>0?(i(),u("span",Mi,"-"+w(c.deletions),1)):D("",!0)]))]))),128))])):e.files&&e.files.length===0?(i(),u("div",Ai," No differences between these commits ")):D("",!0)]))}});function oo(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var En=oo();function ds(e){En=e}var Qn={exec:()=>null};function Ye(e,n=""){let t=typeof e=="string"?e:e.source;const a={replace:(s,l)=>{let c=typeof l=="string"?l:l.source;return c=c.replace(Rt.caret,"$1"),t=t.replace(s,c),a},getRegex:()=>new RegExp(t,n)};return a}var Rt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>new RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}#`),htmlBeginRegex:e=>new RegExp(`^ {0,${Math.min(3,e-1)}}<(?:[a-z].*>|!--)`,"i")},Ei=/^(?:[ \t]*(?:\n|$))+/,Ri=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Pi=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Jn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Di=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,so=/(?:[*+-]|\d{1,9}[.)])/,fs=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,ms=Ye(fs).replace(/bull/g,so).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Ii=Ye(fs).replace(/bull/g,so).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),ao=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Li=/^[^\n]+/,io=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Ni=Ye(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",io).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Fi=Ye(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,so).getRegex(),$r="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",lo=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Hi=Ye("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",lo).replace("tag",$r).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),hs=Ye(ao).replace("hr",Jn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$r).getRegex(),Oi=Ye(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",hs).getRegex(),co={blockquote:Oi,code:Ri,def:Ni,fences:Pi,heading:Di,hr:Jn,html:Hi,lheading:ms,list:Fi,newline:Ei,paragraph:hs,table:Qn,text:Li},So=Ye("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Jn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$r).getRegex(),Ui={...co,lheading:Ii,table:So,paragraph:Ye(ao).replace("hr",Jn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",So).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",$r).getRegex()},ji={...co,html:Ye(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",lo).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Qn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ye(ao).replace("hr",Jn).replace("heading",` *#{1,6} *[^
|
|
5
|
+
]`).replace("lheading",ms).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},zi=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Vi=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,ps=/^( {2,}|\\)\n(?!\s*$)/,Wi=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Sr=/[\p{P}\p{S}]/u,uo=/[\s\p{P}\p{S}]/u,vs=/[^\s\p{P}\p{S}]/u,Gi=Ye(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,uo).getRegex(),gs=/(?!~)[\p{P}\p{S}]/u,qi=/(?!~)[\s\p{P}\p{S}]/u,Ki=/(?:[^\s\p{P}\p{S}]|~)/u,Zi=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,xs=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Yi=Ye(xs,"u").replace(/punct/g,Sr).getRegex(),Xi=Ye(xs,"u").replace(/punct/g,gs).getRegex(),bs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Qi=Ye(bs,"gu").replace(/notPunctSpace/g,vs).replace(/punctSpace/g,uo).replace(/punct/g,Sr).getRegex(),Ji=Ye(bs,"gu").replace(/notPunctSpace/g,Ki).replace(/punctSpace/g,qi).replace(/punct/g,gs).getRegex(),el=Ye("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,vs).replace(/punctSpace/g,uo).replace(/punct/g,Sr).getRegex(),tl=Ye(/\\(punct)/,"gu").replace(/punct/g,Sr).getRegex(),nl=Ye(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),rl=Ye(lo).replace("(?:-->|$)","-->").getRegex(),ol=Ye("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",rl).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),pr=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,sl=Ye(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",pr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ys=Ye(/^!?\[(label)\]\[(ref)\]/).replace("label",pr).replace("ref",io).getRegex(),ws=Ye(/^!?\[(ref)\](?:\[\])?/).replace("ref",io).getRegex(),al=Ye("reflink|nolink(?!\\()","g").replace("reflink",ys).replace("nolink",ws).getRegex(),fo={_backpedal:Qn,anyPunctuation:tl,autolink:nl,blockSkip:Zi,br:ps,code:Vi,del:Qn,emStrongLDelim:Yi,emStrongRDelimAst:Qi,emStrongRDelimUnd:el,escape:zi,link:sl,nolink:ws,punctuation:Gi,reflink:ys,reflinkSearch:al,tag:ol,text:Wi,url:Qn},il={...fo,link:Ye(/^!?\[(label)\]\((.*?)\)/).replace("label",pr).getRegex(),reflink:Ye(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",pr).getRegex()},jr={...fo,emStrongRDelimAst:Ji,emStrongLDelim:Xi,url:Ye(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},ll={...jr,br:Ye(ps).replace("{2,}","*").getRegex(),text:Ye(jr.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ir={normal:co,gfm:Ui,pedantic:ji},Wn={normal:fo,gfm:jr,breaks:ll,pedantic:il},cl={"&":"&","<":"<",">":">",'"':""","'":"'"},_o=e=>cl[e];function sn(e,n){if(n){if(Rt.escapeTest.test(e))return e.replace(Rt.escapeReplace,_o)}else if(Rt.escapeTestNoEncode.test(e))return e.replace(Rt.escapeReplaceNoEncode,_o);return e}function Mo(e){try{e=encodeURI(e).replace(Rt.percentDecode,"%")}catch{return null}return e}function To(e,n){const t=e.replace(Rt.findPipe,(l,c,d)=>{let h=!1,m=c;for(;--m>=0&&d[m]==="\\";)h=!h;return h?"|":" |"}),a=t.split(Rt.splitPipe);let s=0;if(a[0].trim()||a.shift(),a.length>0&&!a.at(-1)?.trim()&&a.pop(),n)if(a.length>n)a.splice(n);else for(;a.length<n;)a.push("");for(;s<a.length;s++)a[s]=a[s].trim().replace(Rt.slashPipe,"|");return a}function Gn(e,n,t){const a=e.length;if(a===0)return"";let s=0;for(;s<a&&e.charAt(a-s-1)===n;)s++;return e.slice(0,a-s)}function ul(e,n){if(e.indexOf(n[1])===-1)return-1;let t=0;for(let a=0;a<e.length;a++)if(e[a]==="\\")a++;else if(e[a]===n[0])t++;else if(e[a]===n[1]&&(t--,t<0))return a;return t>0?-2:-1}function Ao(e,n,t,a,s){const l=n.href,c=n.title||null,d=e[1].replace(s.other.outputLinkReplace,"$1");a.state.inLink=!0;const h={type:e[0].charAt(0)==="!"?"image":"link",raw:t,href:l,title:c,text:d,tokens:a.inlineTokens(d)};return a.state.inLink=!1,h}function dl(e,n,t){const a=e.match(t.other.indentCodeCompensation);if(a===null)return n;const s=a[1];return n.split(`
|
|
6
|
+
`).map(l=>{const c=l.match(t.other.beginningSpace);if(c===null)return l;const[d]=c;return d.length>=s.length?l.slice(s.length):l}).join(`
|
|
7
|
+
`)}var vr=class{options;rules;lexer;constructor(e){this.options=e||En}space(e){const n=this.rules.block.newline.exec(e);if(n&&n[0].length>0)return{type:"space",raw:n[0]}}code(e){const n=this.rules.block.code.exec(e);if(n){const t=n[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?t:Gn(t,`
|
|
8
|
+
`)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const t=n[0],a=dl(t,n[3]||"",this.rules);return{type:"code",raw:t,lang:n[2]?n[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):n[2],text:a}}}heading(e){const n=this.rules.block.heading.exec(e);if(n){let t=n[2].trim();if(this.rules.other.endingHash.test(t)){const a=Gn(t,"#");(this.options.pedantic||!a||this.rules.other.endingSpaceChar.test(a))&&(t=a.trim())}return{type:"heading",raw:n[0],depth:n[1].length,text:t,tokens:this.lexer.inline(t)}}}hr(e){const n=this.rules.block.hr.exec(e);if(n)return{type:"hr",raw:Gn(n[0],`
|
|
9
|
+
`)}}blockquote(e){const n=this.rules.block.blockquote.exec(e);if(n){let t=Gn(n[0],`
|
|
10
|
+
`).split(`
|
|
11
|
+
`),a="",s="";const l=[];for(;t.length>0;){let c=!1;const d=[];let h;for(h=0;h<t.length;h++)if(this.rules.other.blockquoteStart.test(t[h]))d.push(t[h]),c=!0;else if(!c)d.push(t[h]);else break;t=t.slice(h);const m=d.join(`
|
|
12
|
+
`),S=m.replace(this.rules.other.blockquoteSetextReplace,`
|
|
13
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
|
|
14
|
+
${m}`:m,s=s?`${s}
|
|
15
|
+
${S}`:S;const $=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(S,l,!0),this.lexer.state.top=$,t.length===0)break;const x=l.at(-1);if(x?.type==="code")break;if(x?.type==="blockquote"){const b=x,y=b.raw+`
|
|
16
|
+
`+t.join(`
|
|
17
|
+
`),_=this.blockquote(y);l[l.length-1]=_,a=a.substring(0,a.length-b.raw.length)+_.raw,s=s.substring(0,s.length-b.text.length)+_.text;break}else if(x?.type==="list"){const b=x,y=b.raw+`
|
|
18
|
+
`+t.join(`
|
|
19
|
+
`),_=this.list(y);l[l.length-1]=_,a=a.substring(0,a.length-x.raw.length)+_.raw,s=s.substring(0,s.length-b.raw.length)+_.raw,t=y.substring(l.at(-1).raw.length).split(`
|
|
20
|
+
`);continue}}return{type:"blockquote",raw:a,tokens:l,text:s}}}list(e){let n=this.rules.block.list.exec(e);if(n){let t=n[1].trim();const a=t.length>1,s={type:"list",raw:"",ordered:a,start:a?+t.slice(0,-1):"",loose:!1,items:[]};t=a?`\\d{1,9}\\${t.slice(-1)}`:`\\${t}`,this.options.pedantic&&(t=a?t:"[*+-]");const l=this.rules.other.listItemRegex(t);let c=!1;for(;e;){let h=!1,m="",S="";if(!(n=l.exec(e))||this.rules.block.hr.test(e))break;m=n[0],e=e.substring(m.length);let $=n[2].split(`
|
|
21
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,B=>" ".repeat(3*B.length)),x=e.split(`
|
|
22
|
+
`,1)[0],b=!$.trim(),y=0;if(this.options.pedantic?(y=2,S=$.trimStart()):b?y=n[1].length+1:(y=n[2].search(this.rules.other.nonSpaceChar),y=y>4?1:y,S=$.slice(y),y+=n[1].length),b&&this.rules.other.blankLine.test(x)&&(m+=x+`
|
|
23
|
+
`,e=e.substring(x.length+1),h=!0),!h){const B=this.rules.other.nextBulletRegex(y),z=this.rules.other.hrRegex(y),V=this.rules.other.fencesBeginRegex(y),E=this.rules.other.headingBeginRegex(y),oe=this.rules.other.htmlBeginRegex(y);for(;e;){const ce=e.split(`
|
|
24
|
+
`,1)[0];let de;if(x=ce,this.options.pedantic?(x=x.replace(this.rules.other.listReplaceNesting," "),de=x):de=x.replace(this.rules.other.tabCharGlobal," "),V.test(x)||E.test(x)||oe.test(x)||B.test(x)||z.test(x))break;if(de.search(this.rules.other.nonSpaceChar)>=y||!x.trim())S+=`
|
|
25
|
+
`+de.slice(y);else{if(b||$.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||V.test($)||E.test($)||z.test($))break;S+=`
|
|
26
|
+
`+x}!b&&!x.trim()&&(b=!0),m+=ce+`
|
|
27
|
+
`,e=e.substring(ce.length+1),$=de.slice(y)}}s.loose||(c?s.loose=!0:this.rules.other.doubleBlankLine.test(m)&&(c=!0));let _=null,W;this.options.gfm&&(_=this.rules.other.listIsTask.exec(S),_&&(W=_[0]!=="[ ] ",S=S.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:m,task:!!_,checked:W,loose:!1,text:S,tokens:[]}),s.raw+=m}const d=s.items.at(-1);if(d)d.raw=d.raw.trimEnd(),d.text=d.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let h=0;h<s.items.length;h++)if(this.lexer.state.top=!1,s.items[h].tokens=this.lexer.blockTokens(s.items[h].text,[]),!s.loose){const m=s.items[h].tokens.filter($=>$.type==="space"),S=m.length>0&&m.some($=>this.rules.other.anyLine.test($.raw));s.loose=S}if(s.loose)for(let h=0;h<s.items.length;h++)s.items[h].loose=!0;return s}}html(e){const n=this.rules.block.html.exec(e);if(n)return{type:"html",block:!0,raw:n[0],pre:n[1]==="pre"||n[1]==="script"||n[1]==="style",text:n[0]}}def(e){const n=this.rules.block.def.exec(e);if(n){const t=n[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),a=n[2]?n[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=n[3]?n[3].substring(1,n[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):n[3];return{type:"def",tag:t,raw:n[0],href:a,title:s}}}table(e){const n=this.rules.block.table.exec(e);if(!n||!this.rules.other.tableDelimiter.test(n[2]))return;const t=To(n[1]),a=n[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=n[3]?.trim()?n[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
28
|
+
`):[],l={type:"table",raw:n[0],header:[],align:[],rows:[]};if(t.length===a.length){for(const c of a)this.rules.other.tableAlignRight.test(c)?l.align.push("right"):this.rules.other.tableAlignCenter.test(c)?l.align.push("center"):this.rules.other.tableAlignLeft.test(c)?l.align.push("left"):l.align.push(null);for(let c=0;c<t.length;c++)l.header.push({text:t[c],tokens:this.lexer.inline(t[c]),header:!0,align:l.align[c]});for(const c of s)l.rows.push(To(c,l.header.length).map((d,h)=>({text:d,tokens:this.lexer.inline(d),header:!1,align:l.align[h]})));return l}}lheading(e){const n=this.rules.block.lheading.exec(e);if(n)return{type:"heading",raw:n[0],depth:n[2].charAt(0)==="="?1:2,text:n[1],tokens:this.lexer.inline(n[1])}}paragraph(e){const n=this.rules.block.paragraph.exec(e);if(n){const t=n[1].charAt(n[1].length-1)===`
|
|
29
|
+
`?n[1].slice(0,-1):n[1];return{type:"paragraph",raw:n[0],text:t,tokens:this.lexer.inline(t)}}}text(e){const n=this.rules.block.text.exec(e);if(n)return{type:"text",raw:n[0],text:n[0],tokens:this.lexer.inline(n[0])}}escape(e){const n=this.rules.inline.escape.exec(e);if(n)return{type:"escape",raw:n[0],text:n[1]}}tag(e){const n=this.rules.inline.tag.exec(e);if(n)return!this.lexer.state.inLink&&this.rules.other.startATag.test(n[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(n[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(n[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(n[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:n[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:n[0]}}link(e){const n=this.rules.inline.link.exec(e);if(n){const t=n[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(t)){if(!this.rules.other.endAngleBracket.test(t))return;const l=Gn(t.slice(0,-1),"\\");if((t.length-l.length)%2===0)return}else{const l=ul(n[2],"()");if(l===-2)return;if(l>-1){const d=(n[0].indexOf("!")===0?5:4)+n[1].length+l;n[2]=n[2].substring(0,l),n[0]=n[0].substring(0,d).trim(),n[3]=""}}let a=n[2],s="";if(this.options.pedantic){const l=this.rules.other.pedanticHrefTitle.exec(a);l&&(a=l[1],s=l[3])}else s=n[3]?n[3].slice(1,-1):"";return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(t)?a=a.slice(1):a=a.slice(1,-1)),Ao(n,{href:a&&a.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},n[0],this.lexer,this.rules)}}reflink(e,n){let t;if((t=this.rules.inline.reflink.exec(e))||(t=this.rules.inline.nolink.exec(e))){const a=(t[2]||t[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=n[a.toLowerCase()];if(!s){const l=t[0].charAt(0);return{type:"text",raw:l,text:l}}return Ao(t,s,t[0],this.lexer,this.rules)}}emStrong(e,n,t=""){let a=this.rules.inline.emStrongLDelim.exec(e);if(!a||a[3]&&t.match(this.rules.other.unicodeAlphaNumeric))return;if(!(a[1]||a[2]||"")||!t||this.rules.inline.punctuation.exec(t)){const l=[...a[0]].length-1;let c,d,h=l,m=0;const S=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(S.lastIndex=0,n=n.slice(-1*e.length+l);(a=S.exec(n))!=null;){if(c=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!c)continue;if(d=[...c].length,a[3]||a[4]){h+=d;continue}else if((a[5]||a[6])&&l%3&&!((l+d)%3)){m+=d;continue}if(h-=d,h>0)continue;d=Math.min(d,d+h+m);const $=[...a[0]][0].length,x=e.slice(0,l+a.index+$+d);if(Math.min(l,d)%2){const y=x.slice(1,-1);return{type:"em",raw:x,text:y,tokens:this.lexer.inlineTokens(y)}}const b=x.slice(2,-2);return{type:"strong",raw:x,text:b,tokens:this.lexer.inlineTokens(b)}}}}codespan(e){const n=this.rules.inline.code.exec(e);if(n){let t=n[2].replace(this.rules.other.newLineCharGlobal," ");const a=this.rules.other.nonSpaceChar.test(t),s=this.rules.other.startingSpaceChar.test(t)&&this.rules.other.endingSpaceChar.test(t);return a&&s&&(t=t.substring(1,t.length-1)),{type:"codespan",raw:n[0],text:t}}}br(e){const n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}}del(e){const n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2],tokens:this.lexer.inlineTokens(n[2])}}autolink(e){const n=this.rules.inline.autolink.exec(e);if(n){let t,a;return n[2]==="@"?(t=n[1],a="mailto:"+t):(t=n[1],a=t),{type:"link",raw:n[0],text:t,href:a,tokens:[{type:"text",raw:t,text:t}]}}}url(e){let n;if(n=this.rules.inline.url.exec(e)){let t,a;if(n[2]==="@")t=n[0],a="mailto:"+t;else{let s;do s=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])?.[0]??"";while(s!==n[0]);t=n[0],n[1]==="www."?a="http://"+n[0]:a=n[0]}return{type:"link",raw:n[0],text:t,href:a,tokens:[{type:"text",raw:t,text:t}]}}}inlineText(e){const n=this.rules.inline.text.exec(e);if(n){const t=this.lexer.state.inRawBlock;return{type:"text",raw:n[0],text:n[0],escaped:t}}}},fn=class zr{tokens;options;state;tokenizer;inlineQueue;constructor(n){this.tokens=[],this.tokens.links=Object.create(null),this.options=n||En,this.options.tokenizer=this.options.tokenizer||new vr,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={other:Rt,block:ir.normal,inline:Wn.normal};this.options.pedantic?(t.block=ir.pedantic,t.inline=Wn.pedantic):this.options.gfm&&(t.block=ir.gfm,this.options.breaks?t.inline=Wn.breaks:t.inline=Wn.gfm),this.tokenizer.rules=t}static get rules(){return{block:ir,inline:Wn}}static lex(n,t){return new zr(t).lex(n)}static lexInline(n,t){return new zr(t).inlineTokens(n)}lex(n){n=n.replace(Rt.carriageReturn,`
|
|
30
|
+
`),this.blockTokens(n,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){const a=this.inlineQueue[t];this.inlineTokens(a.src,a.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(n,t=[],a=!1){for(this.options.pedantic&&(n=n.replace(Rt.tabCharGlobal," ").replace(Rt.spaceLine,""));n;){let s;if(this.options.extensions?.block?.some(c=>(s=c.call({lexer:this},n,t))?(n=n.substring(s.raw.length),t.push(s),!0):!1))continue;if(s=this.tokenizer.space(n)){n=n.substring(s.raw.length);const c=t.at(-1);s.raw.length===1&&c!==void 0?c.raw+=`
|
|
31
|
+
`:t.push(s);continue}if(s=this.tokenizer.code(n)){n=n.substring(s.raw.length);const c=t.at(-1);c?.type==="paragraph"||c?.type==="text"?(c.raw+=`
|
|
32
|
+
`+s.raw,c.text+=`
|
|
33
|
+
`+s.text,this.inlineQueue.at(-1).src=c.text):t.push(s);continue}if(s=this.tokenizer.fences(n)){n=n.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(n)){n=n.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(n)){n=n.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(n)){n=n.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(n)){n=n.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(n)){n=n.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(n)){n=n.substring(s.raw.length);const c=t.at(-1);c?.type==="paragraph"||c?.type==="text"?(c.raw+=`
|
|
34
|
+
`+s.raw,c.text+=`
|
|
35
|
+
`+s.raw,this.inlineQueue.at(-1).src=c.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(n)){n=n.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(n)){n=n.substring(s.raw.length),t.push(s);continue}let l=n;if(this.options.extensions?.startBlock){let c=1/0;const d=n.slice(1);let h;this.options.extensions.startBlock.forEach(m=>{h=m.call({lexer:this},d),typeof h=="number"&&h>=0&&(c=Math.min(c,h))}),c<1/0&&c>=0&&(l=n.substring(0,c+1))}if(this.state.top&&(s=this.tokenizer.paragraph(l))){const c=t.at(-1);a&&c?.type==="paragraph"?(c.raw+=`
|
|
36
|
+
`+s.raw,c.text+=`
|
|
37
|
+
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(s),a=l.length!==n.length,n=n.substring(s.raw.length);continue}if(s=this.tokenizer.text(n)){n=n.substring(s.raw.length);const c=t.at(-1);c?.type==="text"?(c.raw+=`
|
|
38
|
+
`+s.raw,c.text+=`
|
|
39
|
+
`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=c.text):t.push(s);continue}if(n){const c="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return this.state.top=!0,t}inline(n,t=[]){return this.inlineQueue.push({src:n,tokens:t}),t}inlineTokens(n,t=[]){let a=n,s=null;if(this.tokens.links){const d=Object.keys(this.tokens.links);if(d.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)d.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,s.index)+"++"+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let l=!1,c="";for(;n;){l||(c=""),l=!1;let d;if(this.options.extensions?.inline?.some(m=>(d=m.call({lexer:this},n,t))?(n=n.substring(d.raw.length),t.push(d),!0):!1))continue;if(d=this.tokenizer.escape(n)){n=n.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.tag(n)){n=n.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.link(n)){n=n.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(d.raw.length);const m=t.at(-1);d.type==="text"&&m?.type==="text"?(m.raw+=d.raw,m.text+=d.text):t.push(d);continue}if(d=this.tokenizer.emStrong(n,a,c)){n=n.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.codespan(n)){n=n.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.br(n)){n=n.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.del(n)){n=n.substring(d.raw.length),t.push(d);continue}if(d=this.tokenizer.autolink(n)){n=n.substring(d.raw.length),t.push(d);continue}if(!this.state.inLink&&(d=this.tokenizer.url(n))){n=n.substring(d.raw.length),t.push(d);continue}let h=n;if(this.options.extensions?.startInline){let m=1/0;const S=n.slice(1);let $;this.options.extensions.startInline.forEach(x=>{$=x.call({lexer:this},S),typeof $=="number"&&$>=0&&(m=Math.min(m,$))}),m<1/0&&m>=0&&(h=n.substring(0,m+1))}if(d=this.tokenizer.inlineText(h)){n=n.substring(d.raw.length),d.raw.slice(-1)!=="_"&&(c=d.raw.slice(-1)),l=!0;const m=t.at(-1);m?.type==="text"?(m.raw+=d.raw,m.text+=d.text):t.push(d);continue}if(n){const m="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return t}},gr=class{options;parser;constructor(e){this.options=e||En}space(e){return""}code({text:e,lang:n,escaped:t}){const a=(n||"").match(Rt.notSpaceStart)?.[0],s=e.replace(Rt.endingNewline,"")+`
|
|
40
|
+
`;return a?'<pre><code class="language-'+sn(a)+'">'+(t?s:sn(s,!0))+`</code></pre>
|
|
41
|
+
`:"<pre><code>"+(t?s:sn(s,!0))+`</code></pre>
|
|
42
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
43
|
+
${this.parser.parse(e)}</blockquote>
|
|
44
|
+
`}html({text:e}){return e}heading({tokens:e,depth:n}){return`<h${n}>${this.parser.parseInline(e)}</h${n}>
|
|
45
|
+
`}hr(e){return`<hr>
|
|
46
|
+
`}list(e){const n=e.ordered,t=e.start;let a="";for(let c=0;c<e.items.length;c++){const d=e.items[c];a+=this.listitem(d)}const s=n?"ol":"ul",l=n&&t!==1?' start="'+t+'"':"";return"<"+s+l+`>
|
|
47
|
+
`+a+"</"+s+`>
|
|
48
|
+
`}listitem(e){let n="";if(e.task){const t=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=t+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=t+" "+sn(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:t+" ",text:t+" ",escaped:!0}):n+=t+" "}return n+=this.parser.parse(e.tokens,!!e.loose),`<li>${n}</li>
|
|
49
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
50
|
+
`}table(e){let n="",t="";for(let s=0;s<e.header.length;s++)t+=this.tablecell(e.header[s]);n+=this.tablerow({text:t});let a="";for(let s=0;s<e.rows.length;s++){const l=e.rows[s];t="";for(let c=0;c<l.length;c++)t+=this.tablecell(l[c]);a+=this.tablerow({text:t})}return a&&(a=`<tbody>${a}</tbody>`),`<table>
|
|
51
|
+
<thead>
|
|
52
|
+
`+n+`</thead>
|
|
53
|
+
`+a+`</table>
|
|
54
|
+
`}tablerow({text:e}){return`<tr>
|
|
55
|
+
${e}</tr>
|
|
56
|
+
`}tablecell(e){const n=this.parser.parseInline(e.tokens),t=e.header?"th":"td";return(e.align?`<${t} align="${e.align}">`:`<${t}>`)+n+`</${t}>
|
|
57
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${sn(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:n,tokens:t}){const a=this.parser.parseInline(t),s=Mo(e);if(s===null)return a;e=s;let l='<a href="'+e+'"';return n&&(l+=' title="'+sn(n)+'"'),l+=">"+a+"</a>",l}image({href:e,title:n,text:t,tokens:a}){a&&(t=this.parser.parseInline(a,this.parser.textRenderer));const s=Mo(e);if(s===null)return sn(t);e=s;let l=`<img src="${e}" alt="${t}"`;return n&&(l+=` title="${sn(n)}"`),l+=">",l}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:sn(e.text)}},mo=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},mn=class Vr{options;renderer;textRenderer;constructor(n){this.options=n||En,this.options.renderer=this.options.renderer||new gr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new mo}static parse(n,t){return new Vr(t).parse(n)}static parseInline(n,t){return new Vr(t).parseInline(n)}parse(n,t=!0){let a="";for(let s=0;s<n.length;s++){const l=n[s];if(this.options.extensions?.renderers?.[l.type]){const d=l,h=this.options.extensions.renderers[d.type].call({parser:this},d);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(d.type)){a+=h||"";continue}}const c=l;switch(c.type){case"space":{a+=this.renderer.space(c);continue}case"hr":{a+=this.renderer.hr(c);continue}case"heading":{a+=this.renderer.heading(c);continue}case"code":{a+=this.renderer.code(c);continue}case"table":{a+=this.renderer.table(c);continue}case"blockquote":{a+=this.renderer.blockquote(c);continue}case"list":{a+=this.renderer.list(c);continue}case"html":{a+=this.renderer.html(c);continue}case"paragraph":{a+=this.renderer.paragraph(c);continue}case"text":{let d=c,h=this.renderer.text(d);for(;s+1<n.length&&n[s+1].type==="text";)d=n[++s],h+=`
|
|
58
|
+
`+this.renderer.text(d);t?a+=this.renderer.paragraph({type:"paragraph",raw:h,text:h,tokens:[{type:"text",raw:h,text:h,escaped:!0}]}):a+=h;continue}default:{const d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return a}parseInline(n,t=this.renderer){let a="";for(let s=0;s<n.length;s++){const l=n[s];if(this.options.extensions?.renderers?.[l.type]){const d=this.options.extensions.renderers[l.type].call({parser:this},l);if(d!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){a+=d||"";continue}}const c=l;switch(c.type){case"escape":{a+=t.text(c);break}case"html":{a+=t.html(c);break}case"link":{a+=t.link(c);break}case"image":{a+=t.image(c);break}case"strong":{a+=t.strong(c);break}case"em":{a+=t.em(c);break}case"codespan":{a+=t.codespan(c);break}case"br":{a+=t.br(c);break}case"del":{a+=t.del(c);break}case"text":{a+=t.text(c);break}default:{const d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return a}},dr=class{options;block;constructor(e){this.options=e||En}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?fn.lex:fn.lexInline}provideParser(){return this.block?mn.parse:mn.parseInline}},fl=class{defaults=oo();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=mn;Renderer=gr;TextRenderer=mo;Lexer=fn;Tokenizer=vr;Hooks=dr;constructor(...e){this.use(...e)}walkTokens(e,n){let t=[];for(const a of e)switch(t=t.concat(n.call(this,a)),a.type){case"table":{const s=a;for(const l of s.header)t=t.concat(this.walkTokens(l.tokens,n));for(const l of s.rows)for(const c of l)t=t.concat(this.walkTokens(c.tokens,n));break}case"list":{const s=a;t=t.concat(this.walkTokens(s.items,n));break}default:{const s=a;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(l=>{const c=s[l].flat(1/0);t=t.concat(this.walkTokens(c,n))}):s.tokens&&(t=t.concat(this.walkTokens(s.tokens,n)))}}return t}use(...e){const n=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(t=>{const a={...t};if(a.async=this.defaults.async||a.async||!1,t.extensions&&(t.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const l=n.renderers[s.name];l?n.renderers[s.name]=function(...c){let d=s.renderer.apply(this,c);return d===!1&&(d=l.apply(this,c)),d}:n.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const l=n[s.level];l?l.unshift(s.tokenizer):n[s.level]=[s.tokenizer],s.start&&(s.level==="block"?n.startBlock?n.startBlock.push(s.start):n.startBlock=[s.start]:s.level==="inline"&&(n.startInline?n.startInline.push(s.start):n.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(n.childTokens[s.name]=s.childTokens)}),a.extensions=n),t.renderer){const s=this.defaults.renderer||new gr(this.defaults);for(const l in t.renderer){if(!(l in s))throw new Error(`renderer '${l}' does not exist`);if(["options","parser"].includes(l))continue;const c=l,d=t.renderer[c],h=s[c];s[c]=(...m)=>{let S=d.apply(s,m);return S===!1&&(S=h.apply(s,m)),S||""}}a.renderer=s}if(t.tokenizer){const s=this.defaults.tokenizer||new vr(this.defaults);for(const l in t.tokenizer){if(!(l in s))throw new Error(`tokenizer '${l}' does not exist`);if(["options","rules","lexer"].includes(l))continue;const c=l,d=t.tokenizer[c],h=s[c];s[c]=(...m)=>{let S=d.apply(s,m);return S===!1&&(S=h.apply(s,m)),S}}a.tokenizer=s}if(t.hooks){const s=this.defaults.hooks||new dr;for(const l in t.hooks){if(!(l in s))throw new Error(`hook '${l}' does not exist`);if(["options","block"].includes(l))continue;const c=l,d=t.hooks[c],h=s[c];dr.passThroughHooks.has(l)?s[c]=m=>{if(this.defaults.async)return Promise.resolve(d.call(s,m)).then($=>h.call(s,$));const S=d.call(s,m);return h.call(s,S)}:s[c]=(...m)=>{let S=d.apply(s,m);return S===!1&&(S=h.apply(s,m)),S}}a.hooks=s}if(t.walkTokens){const s=this.defaults.walkTokens,l=t.walkTokens;a.walkTokens=function(c){let d=[];return d.push(l.call(this,c)),s&&(d=d.concat(s.call(this,c))),d}}this.defaults={...this.defaults,...a}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return fn.lex(e,n??this.defaults)}parser(e,n){return mn.parse(e,n??this.defaults)}parseMarkdown(e){return(t,a)=>{const s={...a},l={...this.defaults,...s},c=this.onError(!!l.silent,!!l.async);if(this.defaults.async===!0&&s.async===!1)return c(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return c(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return c(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));l.hooks&&(l.hooks.options=l,l.hooks.block=e);const d=l.hooks?l.hooks.provideLexer():e?fn.lex:fn.lexInline,h=l.hooks?l.hooks.provideParser():e?mn.parse:mn.parseInline;if(l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(t):t).then(m=>d(m,l)).then(m=>l.hooks?l.hooks.processAllTokens(m):m).then(m=>l.walkTokens?Promise.all(this.walkTokens(m,l.walkTokens)).then(()=>m):m).then(m=>h(m,l)).then(m=>l.hooks?l.hooks.postprocess(m):m).catch(c);try{l.hooks&&(t=l.hooks.preprocess(t));let m=d(t,l);l.hooks&&(m=l.hooks.processAllTokens(m)),l.walkTokens&&this.walkTokens(m,l.walkTokens);let S=h(m,l);return l.hooks&&(S=l.hooks.postprocess(S)),S}catch(m){return c(m)}}}onError(e,n){return t=>{if(t.message+=`
|
|
59
|
+
Please report this to https://github.com/markedjs/marked.`,e){const a="<p>An error occurred:</p><pre>"+sn(t.message+"",!0)+"</pre>";return n?Promise.resolve(a):a}if(n)return Promise.reject(t);throw t}}},An=new fl;function Ze(e,n){return An.parse(e,n)}Ze.options=Ze.setOptions=function(e){return An.setOptions(e),Ze.defaults=An.defaults,ds(Ze.defaults),Ze};Ze.getDefaults=oo;Ze.defaults=En;Ze.use=function(...e){return An.use(...e),Ze.defaults=An.defaults,ds(Ze.defaults),Ze};Ze.walkTokens=function(e,n){return An.walkTokens(e,n)};Ze.parseInline=An.parseInline;Ze.Parser=mn;Ze.parser=mn.parse;Ze.Renderer=gr;Ze.TextRenderer=mo;Ze.Lexer=fn;Ze.lexer=fn.lex;Ze.Tokenizer=vr;Ze.Hooks=dr;Ze.parse=Ze;Ze.options;Ze.setOptions;Ze.use;Ze.walkTokens;Ze.parseInline;mn.parse;fn.lex;const{entries:ks,setPrototypeOf:Bo,isFrozen:ml,getPrototypeOf:hl,getOwnPropertyDescriptor:pl}=Object;let{freeze:Pt,seal:qt,create:Wr}=Object,{apply:Gr,construct:qr}=typeof Reflect<"u"&&Reflect;Pt||(Pt=function(n){return n});qt||(qt=function(n){return n});Gr||(Gr=function(n,t){for(var a=arguments.length,s=new Array(a>2?a-2:0),l=2;l<a;l++)s[l-2]=arguments[l];return n.apply(t,s)});qr||(qr=function(n){for(var t=arguments.length,a=new Array(t>1?t-1:0),s=1;s<t;s++)a[s-1]=arguments[s];return new n(...a)});const lr=Dt(Array.prototype.forEach),vl=Dt(Array.prototype.lastIndexOf),Eo=Dt(Array.prototype.pop),qn=Dt(Array.prototype.push),gl=Dt(Array.prototype.splice),fr=Dt(String.prototype.toLowerCase),Ar=Dt(String.prototype.toString),Br=Dt(String.prototype.match),Kn=Dt(String.prototype.replace),xl=Dt(String.prototype.indexOf),bl=Dt(String.prototype.trim),Zt=Dt(Object.prototype.hasOwnProperty),Bt=Dt(RegExp.prototype.test),Zn=yl(TypeError);function Dt(e){return function(n){n instanceof RegExp&&(n.lastIndex=0);for(var t=arguments.length,a=new Array(t>1?t-1:0),s=1;s<t;s++)a[s-1]=arguments[s];return Gr(e,n,a)}}function yl(e){return function(){for(var n=arguments.length,t=new Array(n),a=0;a<n;a++)t[a]=arguments[a];return qr(e,t)}}function Ue(e,n){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:fr;Bo&&Bo(e,null);let a=n.length;for(;a--;){let s=n[a];if(typeof s=="string"){const l=t(s);l!==s&&(ml(n)||(n[a]=l),s=l)}e[s]=!0}return e}function wl(e){for(let n=0;n<e.length;n++)Zt(e,n)||(e[n]=null);return e}function an(e){const n=Wr(null);for(const[t,a]of ks(e))Zt(e,t)&&(Array.isArray(a)?n[t]=wl(a):a&&typeof a=="object"&&a.constructor===Object?n[t]=an(a):n[t]=a);return n}function Yn(e,n){for(;e!==null;){const a=pl(e,n);if(a){if(a.get)return Dt(a.get);if(typeof a.value=="function")return Dt(a.value)}e=hl(e)}function t(){return null}return t}const Ro=Pt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),Er=Pt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Rr=Pt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),kl=Pt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Pr=Pt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Cl=Pt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Po=Pt(["#text"]),Do=Pt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Dr=Pt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Io=Pt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),cr=Pt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),$l=qt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Sl=qt(/<%[\w\W]*|[\w\W]*%>/gm),_l=qt(/\$\{[\w\W]*/gm),Ml=qt(/^data-[\-\w.\u00B7-\uFFFF]+$/),Tl=qt(/^aria-[\-\w]+$/),Cs=qt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Al=qt(/^(?:\w+script|data):/i),Bl=qt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$s=qt(/^html$/i),El=qt(/^[a-z][.\w]*(-[.\w]+)+$/i);var Lo=Object.freeze({__proto__:null,ARIA_ATTR:Tl,ATTR_WHITESPACE:Bl,CUSTOM_ELEMENT:El,DATA_ATTR:Ml,DOCTYPE_NAME:$s,ERB_EXPR:Sl,IS_ALLOWED_URI:Cs,IS_SCRIPT_OR_DATA:Al,MUSTACHE_EXPR:$l,TMPLIT_EXPR:_l});const Xn={element:1,text:3,progressingInstruction:7,comment:8,document:9},Rl=function(){return typeof window>"u"?null:window},Pl=function(n,t){if(typeof n!="object"||typeof n.createPolicy!="function")return null;let a=null;const s="data-tt-policy-suffix";t&&t.hasAttribute(s)&&(a=t.getAttribute(s));const l="dompurify"+(a?"#"+a:"");try{return n.createPolicy(l,{createHTML(c){return c},createScriptURL(c){return c}})}catch{return console.warn("TrustedTypes policy "+l+" could not be created."),null}},No=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Ss(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Rl();const n=we=>Ss(we);if(n.version="3.3.1",n.removed=[],!e||!e.document||e.document.nodeType!==Xn.document||!e.Element)return n.isSupported=!1,n;let{document:t}=e;const a=t,s=a.currentScript,{DocumentFragment:l,HTMLTemplateElement:c,Node:d,Element:h,NodeFilter:m,NamedNodeMap:S=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:$,DOMParser:x,trustedTypes:b}=e,y=h.prototype,_=Yn(y,"cloneNode"),W=Yn(y,"remove"),B=Yn(y,"nextSibling"),z=Yn(y,"childNodes"),V=Yn(y,"parentNode");if(typeof c=="function"){const we=t.createElement("template");we.content&&we.content.ownerDocument&&(t=we.content.ownerDocument)}let E,oe="";const{implementation:ce,createNodeIterator:de,createDocumentFragment:ge,getElementsByTagName:X}=t,{importNode:Z}=a;let O=No();n.isSupported=typeof ks=="function"&&typeof V=="function"&&ce&&ce.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:G,ERB_EXPR:H,TMPLIT_EXPR:K,DATA_ATTR:I,ARIA_ATTR:v,IS_SCRIPT_OR_DATA:g,ATTR_WHITESPACE:T,CUSTOM_ELEMENT:U}=Lo;let{IS_ALLOWED_URI:ae}=Lo,N=null;const j=Ue({},[...Ro,...Er,...Rr,...Pr,...Po]);let L=null;const ee=Ue({},[...Do,...Dr,...Io,...cr]);let re=Object.seal(Wr(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),J=null,ne=null;const se=Object.seal(Wr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Se=!0,je=!0,pe=!1,ue=!0,_e=!1,Pe=!0,Fe=!1,qe=!1,Qe=!1,Je=!1,kt=!1,jt=!1,Qt=!0,st=!1;const Lt="user-content-";let St=!0,_t=!1,Nt={},gt=null;const Ot=Ue({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Mt=null;const Ft=Ue({},["audio","video","img","source","image","track"]);let q=null;const fe=Ue({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),te="http://www.w3.org/1998/Math/MathML",me="http://www.w3.org/2000/svg",be="http://www.w3.org/1999/xhtml";let Me=be,Ee=!1,Oe=null;const kn=Ue({},[te,me,be],Ar);let Jt=Ue({},["mi","mo","mn","ms","mtext"]),en=Ue({},["annotation-xml"]);const Cn=Ue({},["title","style","font","a","script"]);let Kt=null;const mt=["application/xhtml+xml","text/html"],$n="text/html";let He=null,zt=null;const lt=t.createElement("form"),gn=function(A){return A instanceof RegExp||A instanceof Function},et=function(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(zt&&zt===A)){if((!A||typeof A!="object")&&(A={}),A=an(A),Kt=mt.indexOf(A.PARSER_MEDIA_TYPE)===-1?$n:A.PARSER_MEDIA_TYPE,He=Kt==="application/xhtml+xml"?Ar:fr,N=Zt(A,"ALLOWED_TAGS")?Ue({},A.ALLOWED_TAGS,He):j,L=Zt(A,"ALLOWED_ATTR")?Ue({},A.ALLOWED_ATTR,He):ee,Oe=Zt(A,"ALLOWED_NAMESPACES")?Ue({},A.ALLOWED_NAMESPACES,Ar):kn,q=Zt(A,"ADD_URI_SAFE_ATTR")?Ue(an(fe),A.ADD_URI_SAFE_ATTR,He):fe,Mt=Zt(A,"ADD_DATA_URI_TAGS")?Ue(an(Ft),A.ADD_DATA_URI_TAGS,He):Ft,gt=Zt(A,"FORBID_CONTENTS")?Ue({},A.FORBID_CONTENTS,He):Ot,J=Zt(A,"FORBID_TAGS")?Ue({},A.FORBID_TAGS,He):an({}),ne=Zt(A,"FORBID_ATTR")?Ue({},A.FORBID_ATTR,He):an({}),Nt=Zt(A,"USE_PROFILES")?A.USE_PROFILES:!1,Se=A.ALLOW_ARIA_ATTR!==!1,je=A.ALLOW_DATA_ATTR!==!1,pe=A.ALLOW_UNKNOWN_PROTOCOLS||!1,ue=A.ALLOW_SELF_CLOSE_IN_ATTR!==!1,_e=A.SAFE_FOR_TEMPLATES||!1,Pe=A.SAFE_FOR_XML!==!1,Fe=A.WHOLE_DOCUMENT||!1,Je=A.RETURN_DOM||!1,kt=A.RETURN_DOM_FRAGMENT||!1,jt=A.RETURN_TRUSTED_TYPE||!1,Qe=A.FORCE_BODY||!1,Qt=A.SANITIZE_DOM!==!1,st=A.SANITIZE_NAMED_PROPS||!1,St=A.KEEP_CONTENT!==!1,_t=A.IN_PLACE||!1,ae=A.ALLOWED_URI_REGEXP||Cs,Me=A.NAMESPACE||be,Jt=A.MATHML_TEXT_INTEGRATION_POINTS||Jt,en=A.HTML_INTEGRATION_POINTS||en,re=A.CUSTOM_ELEMENT_HANDLING||{},A.CUSTOM_ELEMENT_HANDLING&&gn(A.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(re.tagNameCheck=A.CUSTOM_ELEMENT_HANDLING.tagNameCheck),A.CUSTOM_ELEMENT_HANDLING&&gn(A.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(re.attributeNameCheck=A.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),A.CUSTOM_ELEMENT_HANDLING&&typeof A.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(re.allowCustomizedBuiltInElements=A.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),_e&&(je=!1),kt&&(Je=!0),Nt&&(N=Ue({},Po),L=[],Nt.html===!0&&(Ue(N,Ro),Ue(L,Do)),Nt.svg===!0&&(Ue(N,Er),Ue(L,Dr),Ue(L,cr)),Nt.svgFilters===!0&&(Ue(N,Rr),Ue(L,Dr),Ue(L,cr)),Nt.mathMl===!0&&(Ue(N,Pr),Ue(L,Io),Ue(L,cr))),A.ADD_TAGS&&(typeof A.ADD_TAGS=="function"?se.tagCheck=A.ADD_TAGS:(N===j&&(N=an(N)),Ue(N,A.ADD_TAGS,He))),A.ADD_ATTR&&(typeof A.ADD_ATTR=="function"?se.attributeCheck=A.ADD_ATTR:(L===ee&&(L=an(L)),Ue(L,A.ADD_ATTR,He))),A.ADD_URI_SAFE_ATTR&&Ue(q,A.ADD_URI_SAFE_ATTR,He),A.FORBID_CONTENTS&&(gt===Ot&&(gt=an(gt)),Ue(gt,A.FORBID_CONTENTS,He)),A.ADD_FORBID_CONTENTS&&(gt===Ot&&(gt=an(gt)),Ue(gt,A.ADD_FORBID_CONTENTS,He)),St&&(N["#text"]=!0),Fe&&Ue(N,["html","head","body"]),N.table&&(Ue(N,["tbody"]),delete J.tbody),A.TRUSTED_TYPES_POLICY){if(typeof A.TRUSTED_TYPES_POLICY.createHTML!="function")throw Zn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof A.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Zn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=A.TRUSTED_TYPES_POLICY,oe=E.createHTML("")}else E===void 0&&(E=Pl(b,s)),E!==null&&typeof oe=="string"&&(oe=E.createHTML(""));Pt&&Pt(A),zt=A}},ln=Ue({},[...Er,...Rr,...kl]),ct=Ue({},[...Pr,...Cl]),xt=function(A){let ie=V(A);(!ie||!ie.tagName)&&(ie={namespaceURI:Me,tagName:"template"});const xe=fr(A.tagName),Ge=fr(ie.tagName);return Oe[A.namespaceURI]?A.namespaceURI===me?ie.namespaceURI===be?xe==="svg":ie.namespaceURI===te?xe==="svg"&&(Ge==="annotation-xml"||Jt[Ge]):!!ln[xe]:A.namespaceURI===te?ie.namespaceURI===be?xe==="math":ie.namespaceURI===me?xe==="math"&&en[Ge]:!!ct[xe]:A.namespaceURI===be?ie.namespaceURI===me&&!en[Ge]||ie.namespaceURI===te&&!Jt[Ge]?!1:!ct[xe]&&(Cn[xe]||!ln[xe]):!!(Kt==="application/xhtml+xml"&&Oe[A.namespaceURI]):!1},ze=function(A){qn(n.removed,{element:A});try{V(A).removeChild(A)}catch{W(A)}},Ht=function(A,ie){try{qn(n.removed,{attribute:ie.getAttributeNode(A),from:ie})}catch{qn(n.removed,{attribute:null,from:ie})}if(ie.removeAttribute(A),A==="is")if(Je||kt)try{ze(ie)}catch{}else try{ie.setAttribute(A,"")}catch{}},ot=function(A){let ie=null,xe=null;if(Qe)A="<remove></remove>"+A;else{const Ke=Br(A,/^[\r\n\t ]+/);xe=Ke&&Ke[0]}Kt==="application/xhtml+xml"&&Me===be&&(A='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+A+"</body></html>");const Ge=E?E.createHTML(A):A;if(Me===be)try{ie=new x().parseFromString(Ge,Kt)}catch{}if(!ie||!ie.documentElement){ie=ce.createDocument(Me,"template",null);try{ie.documentElement.innerHTML=Ee?oe:Ge}catch{}}const Ve=ie.body||ie.documentElement;return A&&xe&&Ve.insertBefore(t.createTextNode(xe),Ve.childNodes[0]||null),Me===be?X.call(ie,Fe?"html":"body")[0]:Fe?ie.documentElement:Ve},tn=function(A){return de.call(A.ownerDocument||A,A,m.SHOW_ELEMENT|m.SHOW_COMMENT|m.SHOW_TEXT|m.SHOW_PROCESSING_INSTRUCTION|m.SHOW_CDATA_SECTION,null)},at=function(A){return A instanceof $&&(typeof A.nodeName!="string"||typeof A.textContent!="string"||typeof A.removeChild!="function"||!(A.attributes instanceof S)||typeof A.removeAttribute!="function"||typeof A.setAttribute!="function"||typeof A.namespaceURI!="string"||typeof A.insertBefore!="function"||typeof A.hasChildNodes!="function")},cn=function(A){return typeof d=="function"&&A instanceof d};function Xe(we,A,ie){lr(we,xe=>{xe.call(n,A,ie,zt)})}const xn=function(A){let ie=null;if(Xe(O.beforeSanitizeElements,A,null),at(A))return ze(A),!0;const xe=He(A.nodeName);if(Xe(O.uponSanitizeElement,A,{tagName:xe,allowedTags:N}),Pe&&A.hasChildNodes()&&!cn(A.firstElementChild)&&Bt(/<[/\w!]/g,A.innerHTML)&&Bt(/<[/\w!]/g,A.textContent)||A.nodeType===Xn.progressingInstruction||Pe&&A.nodeType===Xn.comment&&Bt(/<[/\w]/g,A.data))return ze(A),!0;if(!(se.tagCheck instanceof Function&&se.tagCheck(xe))&&(!N[xe]||J[xe])){if(!J[xe]&&nn(xe)&&(re.tagNameCheck instanceof RegExp&&Bt(re.tagNameCheck,xe)||re.tagNameCheck instanceof Function&&re.tagNameCheck(xe)))return!1;if(St&&!gt[xe]){const Ge=V(A)||A.parentNode,Ve=z(A)||A.childNodes;if(Ve&&Ge){const Ke=Ve.length;for(let ht=Ke-1;ht>=0;--ht){const rt=_(Ve[ht],!0);rt.__removalCount=(A.__removalCount||0)+1,Ge.insertBefore(rt,B(A))}}}return ze(A),!0}return A instanceof h&&!xt(A)||(xe==="noscript"||xe==="noembed"||xe==="noframes")&&Bt(/<\/no(script|embed|frames)/i,A.innerHTML)?(ze(A),!0):(_e&&A.nodeType===Xn.text&&(ie=A.textContent,lr([G,H,K],Ge=>{ie=Kn(ie,Ge," ")}),A.textContent!==ie&&(qn(n.removed,{element:A.cloneNode()}),A.textContent=ie)),Xe(O.afterSanitizeElements,A,null),!1)},ut=function(A,ie,xe){if(Qt&&(ie==="id"||ie==="name")&&(xe in t||xe in lt))return!1;if(!(je&&!ne[ie]&&Bt(I,ie))){if(!(Se&&Bt(v,ie))){if(!(se.attributeCheck instanceof Function&&se.attributeCheck(ie,A))){if(!L[ie]||ne[ie]){if(!(nn(A)&&(re.tagNameCheck instanceof RegExp&&Bt(re.tagNameCheck,A)||re.tagNameCheck instanceof Function&&re.tagNameCheck(A))&&(re.attributeNameCheck instanceof RegExp&&Bt(re.attributeNameCheck,ie)||re.attributeNameCheck instanceof Function&&re.attributeNameCheck(ie,A))||ie==="is"&&re.allowCustomizedBuiltInElements&&(re.tagNameCheck instanceof RegExp&&Bt(re.tagNameCheck,xe)||re.tagNameCheck instanceof Function&&re.tagNameCheck(xe))))return!1}else if(!q[ie]){if(!Bt(ae,Kn(xe,T,""))){if(!((ie==="src"||ie==="xlink:href"||ie==="href")&&A!=="script"&&xl(xe,"data:")===0&&Mt[A])){if(!(pe&&!Bt(g,Kn(xe,T,"")))){if(xe)return!1}}}}}}}return!0},nn=function(A){return A!=="annotation-xml"&&Br(A,U)},dt=function(A){Xe(O.beforeSanitizeAttributes,A,null);const{attributes:ie}=A;if(!ie||at(A))return;const xe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:L,forceKeepAttr:void 0};let Ge=ie.length;for(;Ge--;){const Ve=ie[Ge],{name:Ke,namespaceURI:ht,value:rt}=Ve,Vt=He(Ke),ft=rt;let it=Ke==="value"?ft:bl(ft);if(xe.attrName=Vt,xe.attrValue=it,xe.keepAttr=!0,xe.forceKeepAttr=void 0,Xe(O.uponSanitizeAttribute,A,xe),it=xe.attrValue,st&&(Vt==="id"||Vt==="name")&&(Ht(Ke,A),it=Lt+it),Pe&&Bt(/((--!?|])>)|<\/(style|title|textarea)/i,it)){Ht(Ke,A);continue}if(Vt==="attributename"&&Br(it,"href")){Ht(Ke,A);continue}if(xe.forceKeepAttr)continue;if(!xe.keepAttr){Ht(Ke,A);continue}if(!ue&&Bt(/\/>/i,it)){Ht(Ke,A);continue}_e&&lr([G,H,K],Gt=>{it=Kn(it,Gt," ")});const Wt=He(A.nodeName);if(!ut(Wt,Vt,it)){Ht(Ke,A);continue}if(E&&typeof b=="object"&&typeof b.getAttributeType=="function"&&!ht)switch(b.getAttributeType(Wt,Vt)){case"TrustedHTML":{it=E.createHTML(it);break}case"TrustedScriptURL":{it=E.createScriptURL(it);break}}if(it!==ft)try{ht?A.setAttributeNS(ht,Ke,it):A.setAttribute(Ke,it),at(A)?ze(A):Eo(n.removed)}catch{Ht(Ke,A)}}Xe(O.afterSanitizeAttributes,A,null)},Sn=function we(A){let ie=null;const xe=tn(A);for(Xe(O.beforeSanitizeShadowDOM,A,null);ie=xe.nextNode();)Xe(O.uponSanitizeShadowNode,ie,null),xn(ie),dt(ie),ie.content instanceof l&&we(ie.content);Xe(O.afterSanitizeShadowDOM,A,null)};return n.sanitize=function(we){let A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ie=null,xe=null,Ge=null,Ve=null;if(Ee=!we,Ee&&(we="<!-->"),typeof we!="string"&&!cn(we))if(typeof we.toString=="function"){if(we=we.toString(),typeof we!="string")throw Zn("dirty is not a string, aborting")}else throw Zn("toString is not a function");if(!n.isSupported)return we;if(qe||et(A),n.removed=[],typeof we=="string"&&(_t=!1),_t){if(we.nodeName){const rt=He(we.nodeName);if(!N[rt]||J[rt])throw Zn("root node is forbidden and cannot be sanitized in-place")}}else if(we instanceof d)ie=ot("<!---->"),xe=ie.ownerDocument.importNode(we,!0),xe.nodeType===Xn.element&&xe.nodeName==="BODY"||xe.nodeName==="HTML"?ie=xe:ie.appendChild(xe);else{if(!Je&&!_e&&!Fe&&we.indexOf("<")===-1)return E&&jt?E.createHTML(we):we;if(ie=ot(we),!ie)return Je?null:jt?oe:""}ie&&Qe&&ze(ie.firstChild);const Ke=tn(_t?we:ie);for(;Ge=Ke.nextNode();)xn(Ge),dt(Ge),Ge.content instanceof l&&Sn(Ge.content);if(_t)return we;if(Je){if(kt)for(Ve=ge.call(ie.ownerDocument);ie.firstChild;)Ve.appendChild(ie.firstChild);else Ve=ie;return(L.shadowroot||L.shadowrootmode)&&(Ve=Z.call(a,Ve,!0)),Ve}let ht=Fe?ie.outerHTML:ie.innerHTML;return Fe&&N["!doctype"]&&ie.ownerDocument&&ie.ownerDocument.doctype&&ie.ownerDocument.doctype.name&&Bt($s,ie.ownerDocument.doctype.name)&&(ht="<!DOCTYPE "+ie.ownerDocument.doctype.name+`>
|
|
60
|
+
`+ht),_e&&lr([G,H,K],rt=>{ht=Kn(ht,rt," ")}),E&&jt?E.createHTML(ht):ht},n.setConfig=function(){let we=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};et(we),qe=!0},n.clearConfig=function(){zt=null,qe=!1},n.isValidAttribute=function(we,A,ie){zt||et({});const xe=He(we),Ge=He(A);return ut(xe,Ge,ie)},n.addHook=function(we,A){typeof A=="function"&&qn(O[we],A)},n.removeHook=function(we,A){if(A!==void 0){const ie=vl(O[we],A);return ie===-1?void 0:gl(O[we],ie,1)[0]}return Eo(O[we])},n.removeHooks=function(we){O[we]=[]},n.removeAllHooks=function(){O=No()},n}var _s=Ss();const Dl={":art:":"🎨",":zap:":"⚡",":fire:":"🔥",":bug:":"🐛",":ambulance:":"🚑",":sparkles:":"✨",":memo:":"📝",":rocket:":"🚀",":lipstick:":"💄",":tada:":"🎉",":white_check_mark:":"✅",":lock:":"🔒",":closed_lock_with_key:":"🔐",":bookmark:":"🔖",":rotating_light:":"🚨",":construction:":"🚧",":green_heart:":"💚",":arrow_down:":"⬇️",":arrow_up:":"⬆️",":pushpin:":"📌",":construction_worker:":"👷",":chart_with_upwards_trend:":"📈",":recycle:":"♻️",":heavy_plus_sign:":"➕",":heavy_minus_sign:":"➖",":wrench:":"🔧",":hammer:":"🔨",":globe_with_meridians:":"🌐",":pencil2:":"✏️",":poop:":"💩",":rewind:":"⏪",":twisted_rightwards_arrows:":"🔀",":package:":"📦",":alien:":"👽",":truck:":"🚚",":page_facing_up:":"📄",":boom:":"💥",":bento:":"🍱",":wheelchair:":"♿",":bulb:":"💡",":beers:":"🍻",":speech_balloon:":"💬",":card_file_box:":"🗃️",":loud_sound:":"🔊",":mute:":"🔇",":busts_in_silhouette:":"👥",":children_crossing:":"🚸",":building_construction:":"🏗️",":iphone:":"📱",":clown_face:":"🤡",":egg:":"🥚",":see_no_evil:":"🙈",":camera_flash:":"📸",":alembic:":"⚗️",":mag:":"🔍",":label:":"🏷️",":seedling:":"🌱",":triangular_flag_on_post:":"🚩",":goal_net:":"🥅",":dizzy:":"💫",":wastebasket:":"🗑️",":passport_control:":"🛂",":adhesive_bandage:":"🩹",":monocle_face:":"🧐",":coffin:":"⚰️",":test_tube:":"🧪",":necktie:":"👔",":stethoscope:":"🩺",":bricks:":"🧱",":technologist:":"🧑💻",":money_with_wings:":"💸",":thread:":"🧵",":safety_vest:":"🦺"},Il=/https?:\/\/[^\s<>)"']+/g;function Ll(e){return e.replace(Il,n=>`<a href="${n}" target="_blank" rel="noopener noreferrer" class="text-retro-blue hover:underline">${n}</a>`)}function Nl(e){return e.replace(/:[a-z0-9_]+:/g,n=>Dl[n]||n)}function Fl(e){if(!e)return"";let n=Nl(e);return n=Ze.parse(n),n=Ll(n),n=_s.sanitize(n,{ALLOWED_TAGS:["a","strong","em","code","b","i","br","p","ul","ol","li","pre","blockquote","h1","h2","h3"],ALLOWED_ATTR:["href","target","rel","class"]}),n}const Hl={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},Ol={class:"flex items-center gap-2 min-w-0"},Ul={class:"text-retro-cyan font-mono text-sm"},jl={class:"text-retro-muted text-sm truncate"},zl={class:"flex items-center gap-1 flex-shrink-0"},Vl=["aria-label","title"],Wl={class:"flex-1 overflow-auto p-4 space-y-4"},Gl={class:"space-y-2"},ql={class:"flex items-center gap-2 text-sm"},Kl={class:"text-retro-text font-mono text-xs bg-retro-panel px-2 py-1 rounded"},Zl={class:"flex items-center gap-2 text-sm"},Yl={class:"text-retro-text"},Xl={class:"text-retro-muted"},Ql={key:0,class:"flex items-center gap-2 text-sm"},Jl={class:"text-retro-text"},ec={class:"text-retro-muted"},tc={class:"flex items-center gap-2 text-sm"},nc={class:"text-retro-text"},rc={key:1,class:"flex items-start gap-2 text-sm"},oc={class:"flex flex-wrap gap-1"},sc=["onClick","title"],ac={key:2,class:"flex items-start gap-2 text-sm"},ic={class:"flex flex-wrap gap-1"},lc={key:3,class:"flex items-start gap-2 text-sm"},cc={class:"flex flex-wrap gap-1"},uc={class:"space-y-1"},dc={class:"text-retro-text text-sm font-mono bg-retro-panel p-3 rounded"},fc={key:0,class:"space-y-1"},mc=["innerHTML"],hc={key:1,class:"space-y-2"},pc={class:"flex items-center gap-2 text-sm"},vc={class:"text-retro-muted"},gc={key:0,class:"flex items-center gap-2"},xc={class:"text-retro-green text-xs font-mono"},bc={class:"flex-1 h-2 rounded overflow-hidden bg-retro-panel flex"},yc={class:"text-retro-red text-xs font-mono"},wc={key:2,class:"space-y-2"},kc={class:"flex items-center justify-between"},Cc={class:"text-retro-muted text-xs uppercase tracking-wide"},$c={class:"flex items-center gap-1"},Sc={key:0,class:"text-retro-muted text-sm py-2"},_c={key:1,class:"space-y-0.5"},Mc=["onClick"],Tc=["title"],Ac={class:"text-retro-text font-mono text-xs truncate flex-1"},Bc={class:"text-retro-muted"},Ec={class:"text-retro-text"},Rc={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},Pc={key:0,class:"text-retro-green"},Dc={key:1,class:"text-retro-red"},Ic={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},Lc={key:2,class:"space-y-0"},Nc=["onClick"],Fc={class:"text-retro-text font-mono text-xs"},Hc=["title"],Oc={class:"text-retro-text font-mono text-xs truncate flex-1"},Uc={class:"text-retro-muted"},jc={class:"text-retro-text"},zc={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},Vc={key:0,class:"text-retro-green"},Wc={key:1,class:"text-retro-red"},Gc={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},qc={key:3,class:"flex items-center gap-2 text-retro-muted text-sm py-2"},Kc={key:4,class:"text-retro-muted text-sm py-2"},Zc=Be({__name:"GitCommitDetail",props:{commit:{},files:{},stats:{},loading:{type:Boolean,default:!1},committer:{},committerEmail:{},detailPosition:{default:"inline"}},emits:["close","navigateToCommit","togglePosition","navigatePrev","navigateNext","openFileDiff"],setup(e,{emit:n}){const t=e,a=n,s=k(null),l=k("flat"),c=k(new Set),d=R(()=>!t.committer||!t.committerEmail?!1:t.committer!==t.commit.author||t.committerEmail!==t.commit.email),h=R(()=>{const O=t.commit.body;return O?Fl(O):""}),m=R(()=>{if(!t.stats)return"";const{filesChanged:O,additions:G,deletions:H}=t.stats,I=[`${O} ${O===1?"file":"files"} changed`];return G>0&&I.push(`+${G} insertion${G===1?"":"s"}`),H>0&&I.push(`-${H} deletion${H===1?"":"s"}`),I.join(", ")});function S(O){const G=[];for(const H of O){const K=H.path.split("/");let I=G;for(let v=0;v<K.length;v++){const g=K[v],T=v===K.length-1,U=K.slice(0,v+1).join("/");let ae=I.find(N=>N.name===g&&N.isDirectory===!T);ae||(ae={name:g,fullPath:U,isDirectory:!T,children:[],file:T?H:void 0},I.push(ae)),T||(I=ae.children)}}return $(G),G}function $(O){for(const G of O)if(G.isDirectory)for($(G.children);G.children.length===1&&G.children[0].isDirectory;){const H=G.children[0];G.name=`${G.name}/${H.name}`,G.fullPath=H.fullPath,G.children=H.children}}function x(O){return[...O].sort((G,H)=>G.isDirectory&&!H.isDirectory?-1:!G.isDirectory&&H.isDirectory?1:G.name.localeCompare(H.name))}function b(O,G,H){const K=[];for(const I of x(O)){const v=H.size===0?!0:H.has(I.fullPath);K.push({key:I.fullPath,depth:G,isDirectory:I.isDirectory,name:I.name,fullPath:I.fullPath,expanded:I.isDirectory?v:!1,file:I.file}),I.isDirectory&&v&&K.push(...b(I.children,G+1,H))}return K}const y=R(()=>!t.files||t.files.length===0?[]:S(t.files)),_=R(()=>b(y.value,0,c.value));function W(O){c.value.has(O)?c.value.delete(O):c.value.add(O),c.value=new Set(c.value)}function B(){const O=G=>{const H=[];for(const K of G)K.isDirectory&&(H.push(K.fullPath),H.push(...O(K.children)));return H};c.value=new Set(O(y.value))}function z(){c.value=new Set}De(l,O=>{O==="tree"&&B()});function V(O){return new Date(O*1e3).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0})}function E(O){return Fn[O]||{label:O,colorClass:"text-retro-muted"}}const oe=R(()=>{if(!t.stats)return{addPct:0,delPct:0};const O=t.stats.additions+t.stats.deletions;return O===0?{addPct:50,delPct:50}:{addPct:Math.round(t.stats.additions/O*100),delPct:Math.round(t.stats.deletions/O*100)}});function ce(O){O.key==="ArrowUp"?(O.preventDefault(),a("navigatePrev")):O.key==="ArrowDown"?(O.preventDefault(),a("navigateNext")):O.key==="Escape"&&(O.preventDefault(),a("close"))}vt(()=>{Yt(()=>{s.value?.focus()})}),De(()=>t.commit.hash,()=>{Yt(()=>{s.value?.focus()})});function de(){a("close")}function ge(O){a("navigateToCommit",O)}function X(){a("togglePosition")}function Z(O){a("openFileDiff",O)}return(O,G)=>(i(),u("section",{ref_key:"containerRef",ref:s,tabindex:0,onKeydown:ce,class:"flex-1 min-h-0 flex flex-col border-t border-retro-border bg-retro-dark focus:outline-none","aria-label":"Commit details",role:"region"},[r("div",Hl,[r("div",Ol,[r("span",Ul,w(e.commit.shortHash),1),r("span",jl,w(e.commit.message.split(`
|
|
61
|
+
`)[0]),1)]),r("div",zl,[r("button",{onClick:X,class:"p-1 hover:bg-retro-dark rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":e.detailPosition==="inline"?"Dock detail to bottom":"Show detail inline",title:e.detailPosition==="inline"?"Dock to bottom":"Show inline"},[e.detailPosition==="inline"?(i(),he(o(Jo),{key:0,class:"w-4 h-4 text-retro-muted hover:text-retro-text"})):(i(),he(o(Qo),{key:1,class:"w-4 h-4 text-retro-muted hover:text-retro-text"}))],8,Vl),r("button",{onClick:de,class:"p-1 hover:bg-retro-dark rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":"Close commit details"},[Y(o($t),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])])]),r("div",Wl,[r("div",Gl,[r("div",ql,[G[2]||(G[2]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Hash:",-1)),r("code",Kl,w(e.commit.hash),1)]),r("div",Zl,[Y(o(Ur),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",Yl,w(e.commit.author),1),r("span",Xl,"<"+w(e.commit.email)+">",1)]),d.value?(i(),u("div",Ql,[Y(o(Ur),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),G[3]||(G[3]=r("span",{class:"text-retro-muted text-xs uppercase mr-1"},"Committer:",-1)),r("span",Jl,w(e.committer),1),r("span",ec,"<"+w(e.committerEmail)+">",1)])):D("",!0),r("div",tc,[Y(o(ns),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",nc,w(V(e.commit.timestamp)),1)]),e.commit.parents?.length>0?(i(),u("div",rc,[G[4]||(G[4]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Parents:",-1)),r("div",oc,[(i(!0),u(ve,null,Ie(e.commit.parents,H=>(i(),u("button",{key:H,onClick:K=>ge(H),class:"text-retro-cyan font-mono text-xs bg-retro-panel px-2 py-0.5 rounded hover:bg-retro-dark hover:text-retro-text transition-colors cursor-pointer focus:outline-none focus:ring-2 focus:ring-retro-cyan",title:`Navigate to parent ${H.substring(0,7)}`},w(H.substring(0,7)),9,sc))),128))])])):D("",!0),e.commit.branches?.length>0?(i(),u("div",ac,[G[5]||(G[5]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Branches:",-1)),r("div",ic,[(i(!0),u(ve,null,Ie(e.commit.branches,H=>(i(),u("span",{key:H,class:"text-retro-green font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},w(H),1))),128))])])):D("",!0),e.commit.tags?.length>0?(i(),u("div",lc,[G[6]||(G[6]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Tags:",-1)),r("div",cc,[(i(!0),u(ve,null,Ie(e.commit.tags,H=>(i(),u("span",{key:H,class:"text-retro-yellow font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},w(H),1))),128))])])):D("",!0)]),r("div",uc,[G[7]||(G[7]=r("h4",{class:"text-retro-muted text-xs uppercase tracking-wide"}," Message ",-1)),r("div",dc,w(e.commit.message.split(`
|
|
62
|
+
`)[0]),1)]),e.commit.body?(i(),u("div",fc,[G[8]||(G[8]=r("h4",{class:"text-retro-muted text-xs uppercase tracking-wide"}," Body ",-1)),r("div",{class:"text-retro-text text-sm font-mono bg-retro-panel p-3 rounded commit-body-rendered",innerHTML:h.value},null,8,mc)])):D("",!0),e.stats?(i(),u("div",hc,[r("div",pc,[r("span",vc,w(m.value),1)]),e.stats.additions>0||e.stats.deletions>0?(i(),u("div",gc,[r("span",xc,"+"+w(e.stats.additions),1),r("div",bc,[r("div",{class:"bg-retro-green h-full transition-all",style:Et({width:oe.value.addPct+"%"})},null,4),r("div",{class:"bg-retro-red h-full transition-all",style:Et({width:oe.value.delPct+"%"})},null,4)]),r("span",yc,"-"+w(e.stats.deletions),1)])):D("",!0)])):D("",!0),e.files?(i(),u("div",wc,[r("div",kc,[r("h4",Cc," Files Changed ("+w(e.files.length)+") ",1),r("div",$c,[r("button",{onClick:G[0]||(G[0]=H=>l.value="flat"),class:ke(["p-1 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan",l.value==="flat"?"bg-retro-panel text-retro-cyan":"text-retro-muted hover:text-retro-text"]),"aria-label":"Flat file list",title:"Flat file list"},[Y(o(is),{class:"w-4 h-4"})],2),r("button",{onClick:G[1]||(G[1]=H=>l.value="tree"),class:ke(["p-1 rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan",l.value==="tree"?"bg-retro-panel text-retro-cyan":"text-retro-muted hover:text-retro-text"]),"aria-label":"Tree file view",title:"Tree file view"},[Y(o(Or),{class:"w-4 h-4"})],2)])]),e.files.length===0?(i(),u("div",Sc," No files changed in this commit. ")):l.value==="flat"?(i(),u("ul",_c,[(i(!0),u(ve,null,Ie(e.files,H=>(i(),u("li",{key:H.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group cursor-pointer",onClick:K=>Z(H)},[r("span",{class:ke(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",E(H.status).colorClass]),title:E(H.status).label},w(H.status),11,Tc),Y(o(Nn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",Ac,[H.status==="R"&&H.oldPath?(i(),u(ve,{key:0},[r("span",Bc,w(H.oldPath),1),G[9]||(G[9]=r("span",{class:"text-retro-yellow mx-1"},"→",-1)),r("span",Ec,w(H.path),1)],64)):(i(),u(ve,{key:1},[Ae(w(H.path),1)],64))]),!H.binary&&(H.additions>0||H.deletions>0)?(i(),u("span",Rc,[H.additions>0?(i(),u("span",Pc,"+"+w(H.additions),1)):D("",!0),H.deletions>0?(i(),u("span",Dc,"-"+w(H.deletions),1)):D("",!0)])):H.binary?(i(),u("span",Ic,"binary")):D("",!0)],8,Mc))),128))])):(i(),u("div",Lc,[r("div",{class:"flex items-center gap-2 mb-1"},[r("button",{onClick:B,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Expand all "),G[10]||(G[10]=r("span",{class:"text-retro-muted text-xs"},"|",-1)),r("button",{onClick:z,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Collapse all ")]),(i(!0),u(ve,null,Ie(_.value,H=>(i(),u("div",{key:H.key,class:ke(["flex items-center gap-1 py-0.5 px-1 hover:bg-retro-panel rounded text-sm cursor-pointer",{"select-none":H.isDirectory}]),style:Et({paddingLeft:H.depth*16+4+"px"}),onClick:K=>H.isDirectory?W(H.fullPath):H.file?Z(H.file):void 0},[H.isDirectory?(i(),u(ve,{key:0},[Y(o(Xr),{class:ke(["w-3 h-3 text-retro-muted transition-transform flex-shrink-0",{"rotate-90":H.expanded}])},null,8,["class"]),Y(o(Or),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),r("span",Fc,w(H.name),1)],64)):H.file?(i(),u(ve,{key:1},[r("span",{class:ke(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",E(H.file.status).colorClass]),title:E(H.file.status).label},w(H.file.status),11,Hc),Y(o(Nn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",Oc,[H.file.status==="R"&&H.file.oldPath?(i(),u(ve,{key:0},[r("span",Uc,w(H.file.oldPath.split("/").pop()),1),G[11]||(G[11]=r("span",{class:"text-retro-yellow mx-1"},"→",-1)),r("span",jc,w(H.name),1)],64)):(i(),u(ve,{key:1},[Ae(w(H.name),1)],64))]),!H.file.binary&&(H.file.additions>0||H.file.deletions>0)?(i(),u("span",zc,[H.file.additions>0?(i(),u("span",Vc,"+"+w(H.file.additions),1)):D("",!0),H.file.deletions>0?(i(),u("span",Wc,"-"+w(H.file.deletions),1)):D("",!0)])):H.file.binary?(i(),u("span",Gc,"binary")):D("",!0)],64)):D("",!0)],14,Nc))),128))]))])):e.loading?(i(),u("div",qc,[...G[12]||(G[12]=[r("div",{class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),Ae(" Loading file changes... ",-1)])])):(i(),u("div",Kc," Failed to load file changes. "))])],544))}}),Yc=yr(Zc,[["__scopeId","data-v-29f450ea"]]),Xc={class:"flex-1 min-h-0 flex flex-col border-t border-retro-border bg-retro-dark","aria-label":"Uncommitted changes details"},Qc={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},Jc={class:"flex items-center gap-2 min-w-0"},eu={class:"text-retro-muted text-sm"},tu={key:0,class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin",title:"Staging..."},nu={class:"flex-1 overflow-auto p-4 space-y-3"},ru={class:"space-y-2"},ou=["disabled"],su={class:"space-y-1"},au={class:"flex items-center justify-between"},iu={class:"text-retro-green text-xs uppercase tracking-wide font-semibold"},lu={key:0,class:"text-retro-muted text-xs py-1"},cu={key:1,class:"space-y-0.5"},uu=["aria-label","onClick"],du={class:"text-retro-text font-mono text-xs truncate"},fu={class:"space-y-1"},mu={class:"flex items-center justify-between"},hu={class:"text-retro-yellow text-xs uppercase tracking-wide font-semibold"},pu={key:0,class:"text-retro-muted text-xs py-1"},vu={key:1,class:"space-y-0.5"},gu=["aria-label","onClick"],xu={class:"text-retro-text font-mono text-xs truncate"},bu=Be({__name:"GitUncommittedDetail",props:{stagedFiles:{default:()=>[]},unstagedFiles:{default:()=>[]},isStaging:{type:Boolean,default:!1},isCommitting:{type:Boolean,default:!1}},emits:["close","stageFiles","unstageFiles","stageAll","unstageAll","commit"],setup(e,{emit:n}){const t=e,a=n,s=k(""),l=k(!1),c=R(()=>s.value.trim().length>0&&t.stagedFiles.length>0&&!l.value&&!t.isCommitting);function d(_){return Fn[_]||{label:_,colorClass:"text-retro-muted"}}function h(){a("close")}function m(_){a("stageFiles",[_.path])}function S(_){a("unstageFiles",[_.path])}function $(){a("stageAll")}function x(){a("unstageAll")}async function b(){c.value&&(l.value=!0,a("commit",s.value.trim()),s.value="",l.value=!1)}function y(_){(_.metaKey||_.ctrlKey)&&_.key==="Enter"&&(_.preventDefault(),b())}return(_,W)=>(i(),u("section",Xc,[r("div",Qc,[r("div",Jc,[Y(o(Un),{class:"w-4 h-4 text-retro-yellow"}),W[1]||(W[1]=r("span",{class:"text-retro-yellow font-semibold text-sm"},"Uncommitted Changes",-1)),r("span",eu,"("+w(e.stagedFiles.length+e.unstagedFiles.length)+" files)",1),t.isStaging?(i(),u("div",tu)):D("",!0)]),r("button",{onClick:h,class:"p-1 hover:bg-retro-dark rounded transition-colors focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":"Close uncommitted changes details"},[Y(o($t),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])]),r("div",nu,[r("div",ru,[Le(r("textarea",{"onUpdate:modelValue":W[0]||(W[0]=B=>We(s)?s.value=B:null),placeholder:"Commit message...",rows:"3",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan resize-none font-mono",onKeydown:y},null,544),[[Ct,o(s)]]),r("button",{disabled:!o(c),class:ke(["w-full px-3 py-1.5 text-sm font-semibold rounded transition-colors disabled:opacity-40 disabled:cursor-not-allowed",o(c)?"bg-retro-green text-retro-dark hover:bg-retro-green/90":"bg-retro-green/30 text-retro-dark"]),onClick:b},w(o(l)||t.isCommitting?"Committing...":`Commit (${e.stagedFiles.length} staged)`),11,ou)]),r("div",su,[r("div",au,[r("h4",iu," Staged Changes ("+w(e.stagedFiles.length)+") ",1),e.stagedFiles.length>0?(i(),u("button",{key:0,class:"text-[11px] text-retro-muted hover:text-retro-text transition-colors",onClick:x}," Unstage All ")):D("",!0)]),e.stagedFiles.length===0?(i(),u("div",lu," No staged files. Stage files below to commit. ")):(i(),u("ul",cu,[(i(!0),u(ve,null,Ie(e.stagedFiles,B=>(i(),u("li",{key:"staged-"+B.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group"},[r("button",{class:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded hover:bg-retro-red/20 transition-colors opacity-60 group-hover:opacity-100",title:"Unstage file","aria-label":`Unstage ${B.path}`,onClick:z=>S(B)},[Y(o(fa),{class:"w-3.5 h-3.5 text-retro-red"})],8,uu),r("span",{class:ke(["flex-shrink-0 w-4 text-center text-xs font-bold",d(B.status).colorClass])},w(B.status),3),Y(o(Nn),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),r("span",du,w(B.oldPath?`${B.oldPath} → ${B.path}`:B.path),1)]))),128))]))]),r("div",fu,[r("div",mu,[r("h4",hu," Unstaged Changes ("+w(e.unstagedFiles.length)+") ",1),e.unstagedFiles.length>0?(i(),u("button",{key:0,class:"text-[11px] text-retro-muted hover:text-retro-text transition-colors",onClick:$}," Stage All ")):D("",!0)]),e.unstagedFiles.length===0?(i(),u("div",pu," No unstaged changes. ")):(i(),u("ul",vu,[(i(!0),u(ve,null,Ie(e.unstagedFiles,B=>(i(),u("li",{key:"unstaged-"+B.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group"},[r("button",{class:"flex-shrink-0 w-5 h-5 flex items-center justify-center rounded hover:bg-retro-green/20 transition-colors opacity-60 group-hover:opacity-100",title:"Stage file","aria-label":`Stage ${B.path}`,onClick:z=>m(B)},[Y(o(br),{class:"w-3.5 h-3.5 text-retro-green"})],8,gu),r("span",{class:ke(["flex-shrink-0 w-4 text-center text-xs font-bold",d(B.status).colorClass])},w(B.status),3),Y(o(Nn),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),r("span",xu,w(B.oldPath?`${B.oldPath} → ${B.path}`:B.path),1)]))),128))]))])])]))}}),yu=["aria-label"],wu={key:0,class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border truncate font-mono"},ku={key:0,class:"my-1 border-t border-retro-border",role:"separator"},Cu=["aria-disabled","onClick","onMouseenter"],$u={key:1,class:"w-4 h-4 flex-shrink-0"},er=Be({__name:"GitContextMenu",props:{items:{},x:{},y:{},title:{}},emits:["close","action"],setup(e,{emit:n}){const t=e,a=n,s=k(null),l=k(-1),c=R(()=>t.items.map((b,y)=>({item:b,i:y})).filter(({item:b})=>!b.disabled).map(({i:b})=>b));let d=!1;function h(b){d&&s.value&&!s.value.contains(b.target)&&a("close")}vt(()=>{requestAnimationFrame(()=>{d=!0}),document.addEventListener("mousedown",h),document.addEventListener("contextmenu",h),Yt(()=>{s.value?.focus()})}),wt(()=>{d=!1,document.removeEventListener("mousedown",h),document.removeEventListener("contextmenu",h)});function m(b){const y=c.value;if(y.length===0)return;if(l.value===-1){l.value=b===1?y[0]:y[y.length-1];return}const _=y.indexOf(l.value);if(_===-1){l.value=b===1?y[0]:y[y.length-1];return}const W=_+b;W>=0&&W<y.length&&(l.value=y[W])}function S(b){switch(b.key){case"Escape":b.preventDefault(),a("close");break;case"ArrowDown":b.preventDefault(),m(1);break;case"ArrowUp":b.preventDefault(),m(-1);break;case"Enter":{b.preventDefault();const y=t.items[l.value];y&&!y.disabled&&(a("action",y.key),a("close"));break}}}function $(b){b.disabled||(a("action",b.key),a("close"))}const x=R(()=>{const y=t.title?29:0,_=t.items.filter(oe=>oe.separator).length,W=t.items.length*36+_*9+8,B=y+W,z=8;let V=t.x,E=t.y;return typeof window<"u"&&(V+220>window.innerWidth-z&&(V=window.innerWidth-220-z),V<z&&(V=z),E+B>window.innerHeight-z&&(E=window.innerHeight-B-z),E<z&&(E=z)),{left:`${V}px`,top:`${E}px`}});return(b,y)=>(i(),he(Xt,{to:"body"},[r("div",{ref_key:"menuRef",ref:s,class:"fixed z-50 bg-retro-panel border border-retro-border rounded shadow-lg py-1 min-w-[220px]",style:Et(o(x)),role:"menu","aria-label":e.title??"Context menu",tabindex:"-1",onKeydown:S},[e.title?(i(),u("div",wu,w(e.title),1)):D("",!0),(i(!0),u(ve,null,Ie(e.items,(_,W)=>(i(),u(ve,{key:_.key},[_.separator?(i(),u("div",ku)):D("",!0),r("button",{class:ke(["w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors focus:outline-none",[_.disabled?"text-retro-muted/50 cursor-not-allowed":_.danger?["text-retro-red hover:bg-retro-red/10 focus:bg-retro-red/10",o(l)===W?"bg-retro-red/10":""]:["text-retro-text hover:bg-retro-cyan/10 focus:bg-retro-cyan/10",o(l)===W?"bg-retro-cyan/10":""]]]),role:"menuitem","aria-disabled":_.disabled||void 0,tabindex:-1,onClick:B=>$(_),onMouseenter:B=>l.value=_.disabled?o(l):W,onMouseleave:y[0]||(y[0]=B=>l.value=-1)},[_.icon?(i(),he(In(_.icon),{key:0,class:ke(["w-4 h-4 flex-shrink-0",_.disabled?"opacity-50":_.danger?"":"text-retro-muted"])},null,8,["class"])):(i(),u("span",$u)),Ae(" "+w(_.label),1)],42,Cu)],64))),128))],44,yu)]))}}),Su=Be({__name:"GitBranchMenu",props:{branchName:{},isCurrentBranch:{type:Boolean},isLocal:{type:Boolean},x:{},y:{}},emits:["close","checkout","createBranch","deleteBranch","rename","merge","rebase","push","pull","fetch","copyName"],setup(e,{emit:n}){const t=e,a=n,s=R(()=>[{key:"checkout",label:"Checkout",icon:Tn,disabled:t.isCurrentBranch},{key:"rename",label:"Rename",icon:ls,separator:!0},{key:"deleteBranch",label:"Delete",icon:vn,danger:!0,disabled:t.isCurrentBranch},{key:"merge",label:"Merge into Current",icon:es,separator:!0,disabled:t.isCurrentBranch},{key:"rebase",label:"Rebase Current Onto",icon:Zo,disabled:t.isCurrentBranch},{key:"push",label:"Push",icon:Yo,separator:!0},{key:"copyName",label:"Copy Branch Name",icon:Ln,separator:!0}]),l=R(()=>[{key:"checkout",label:"Checkout",icon:Tn},{key:"deleteBranch",label:"Delete Remote Branch",icon:vn,separator:!0,danger:!0},{key:"fetch",label:"Fetch",icon:rs,separator:!0},{key:"pull",label:"Pull into Current",icon:Zs},{key:"copyName",label:"Copy Branch Name",icon:Ln,separator:!0}]),c=R(()=>t.isLocal?s.value:l.value),d={checkout:()=>a("checkout"),createBranch:()=>a("createBranch"),deleteBranch:()=>a("deleteBranch"),rename:()=>a("rename"),merge:()=>a("merge"),rebase:()=>a("rebase"),push:()=>a("push"),pull:()=>a("pull"),fetch:()=>a("fetch"),copyName:()=>a("copyName")};function h(m){const S=d[m];S&&S(),a("close")}return(m,S)=>{const $=er;return i(),he($,{items:o(c),x:e.x,y:e.y,title:e.branchName,onAction:h,onClose:S[0]||(S[0]=x=>a("close"))},null,8,["items","x","y","title"])}}}),_u=Be({__name:"GitCommitMenu",props:{commit:{},x:{},y:{}},emits:["close","addTag","createBranch","checkout","cherryPick","revert","mergeInto","reset","copyHash","copySubject"],setup(e,{emit:n}){const t=n,a=R(()=>[{key:"addTag",label:"Add Tag",icon:ro},{key:"createBranch",label:"Create Branch",icon:br},{key:"checkout",label:"Checkout (detached HEAD)",icon:Tn,separator:!0},{key:"cherryPick",label:"Cherry Pick",icon:oa},{key:"revert",label:"Revert",icon:Xo},{key:"mergeInto",label:"Merge into Current",icon:es,separator:!0},{key:"reset",label:"Reset Current Branch to Here",icon:Zo,danger:!0},{key:"copyHash",label:"Copy Commit Hash",icon:Ln,separator:!0},{key:"copySubject",label:"Copy Commit Subject",icon:Ln}]),s={addTag:()=>t("addTag"),createBranch:()=>t("createBranch"),checkout:()=>t("checkout"),cherryPick:()=>t("cherryPick"),revert:()=>t("revert"),mergeInto:()=>t("mergeInto"),reset:()=>t("reset"),copyHash:()=>t("copyHash"),copySubject:()=>t("copySubject")};function l(c){const d=s[c];d&&d(),t("close")}return(c,d)=>{const h=er;return i(),he(h,{items:o(a),x:e.x,y:e.y,title:e.commit.shortHash,onAction:l,onClose:d[0]||(d[0]=m=>t("close"))},null,8,["items","x","y","title"])}}}),Mu=Be({__name:"GitTagMenu",props:{tagName:{},x:{},y:{}},emits:["close","viewDetails","deleteTag","pushTag","copyName"],setup(e,{emit:n}){const t=n,a=[{key:"viewDetails",label:"View Details",icon:ro},{key:"deleteTag",label:"Delete Tag",icon:vn,separator:!0,danger:!0},{key:"pushTag",label:"Push Tag",icon:Yo},{key:"copyName",label:"Copy Tag Name",icon:Ln,separator:!0}];function s(l){switch(l){case"viewDetails":t("viewDetails");break;case"deleteTag":t("deleteTag");break;case"pushTag":t("pushTag");break;case"copyName":t("copyName");break}}return(l,c)=>{const d=er;return i(),he(d,{items:a,x:e.x,y:e.y,title:e.tagName,onClose:c[0]||(c[0]=h=>t("close")),onAction:s},null,8,["x","y","title"])}}}),Tu=Be({__name:"GitStashMenu",props:{stashIndex:{},stashMessage:{},x:{},y:{}},emits:["close","apply","pop","drop","createBranch","copyName","copyHash"],setup(e,{emit:n}){const t=n,a=[{key:"apply",label:"Apply Stash",icon:Ks},{key:"pop",label:"Pop Stash",icon:Xo},{key:"createBranch",label:"Create Branch from Stash",icon:Hr,separator:!0},{key:"drop",label:"Drop Stash",icon:vn,separator:!0,danger:!0},{key:"copyName",label:"Copy Stash Reference",icon:Ln,separator:!0},{key:"copyHash",label:"Copy Stash Hash",icon:ca}];function s(l){switch(l){case"apply":t("apply");break;case"pop":t("pop");break;case"drop":t("drop");break;case"createBranch":t("createBranch");break;case"copyName":t("copyName");break;case"copyHash":t("copyHash");break}}return(l,c)=>{const d=er;return i(),he(d,{items:a,x:e.x,y:e.y,title:e.stashMessage,onClose:c[0]||(c[0]=h=>t("close")),onAction:s},null,8,["x","y","title"])}}}),Au=Be({__name:"GitUncommittedMenu",props:{x:{},y:{}},emits:["close","stash","reset","clean"],setup(e,{emit:n}){const t=n,a=[{key:"stash",label:"Stash Uncommitted Changes",icon:qs},{key:"reset",label:"Reset Working Directory",icon:Tn,separator:!0,danger:!0},{key:"clean",label:"Clean Untracked Files",icon:vn,danger:!0}];function s(l){switch(l){case"stash":t("stash");break;case"reset":t("reset");break;case"clean":t("clean");break}}return(l,c)=>{const d=er;return i(),he(d,{items:a,x:e.x,y:e.y,title:"Uncommitted Changes",onClose:c[0]||(c[0]=h=>t("close")),onAction:s},null,8,["x","y"])}}}),Bu={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},Eu={class:"flex items-center justify-between px-4 py-3 border-b border-retro-border"},Ru={class:"text-sm font-mono text-retro-text"},Pu={class:"p-4"},Du={key:0,class:"mb-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},Iu={class:"flex justify-end gap-2 px-4 py-3 border-t border-retro-border"},Lu=["disabled"],Nu=["disabled"],It=Be({__name:"GitDialog",props:{title:{},visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null},confirmLabel:{default:"Confirm"},confirmDanger:{type:Boolean,default:!1},cancelLabel:{default:"Cancel"}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n;function s(l){l.key==="Escape"&&a("close"),l.key==="Enter"&&!t.loading&&(l.preventDefault(),a("confirm"))}return De(()=>t.visible,l=>{l?document.addEventListener("keydown",s):document.removeEventListener("keydown",s)}),wt(()=>{document.removeEventListener("keydown",s)}),(l,c)=>(i(),he(Xt,{to:"body"},[Y(pn,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:nt(()=>[e.visible?(i(),u("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",role:"dialog","aria-modal":"true",onClick:c[3]||(c[3]=yt(d=>a("close"),["self"]))},[r("div",Bu,[r("div",Eu,[r("h3",Ru,w(e.title),1),r("button",{type:"button",class:"p-1 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close",onClick:c[0]||(c[0]=d=>a("close"))},[Y(o($t),{class:"h-4 w-4"})])]),r("div",Pu,[e.error?(i(),u("div",Du,w(e.error),1)):D("",!0),Ds(l.$slots,"default")]),r("div",Iu,[r("button",{type:"button",class:"px-3 py-1.5 text-xs font-mono text-retro-muted hover:text-retro-text bg-retro-panel hover:bg-retro-border rounded transition-colors",disabled:e.loading,onClick:c[1]||(c[1]=d=>a("close"))},w(e.cancelLabel),9,Lu),r("button",{type:"button",class:ke(["px-3 py-1.5 text-xs font-mono rounded transition-colors disabled:opacity-50 disabled:cursor-not-allowed",[e.confirmDanger?"text-retro-red bg-retro-red/10 border border-retro-red/30 hover:bg-retro-red/20":"text-retro-black bg-retro-cyan hover:bg-retro-cyan/80"]]),disabled:e.loading,onClick:c[2]||(c[2]=d=>a("confirm"))},w(e.loading?"Loading...":e.confirmLabel),11,Nu)])])])):D("",!0)]),_:3})]))}}),_r=xr("gitGraph",()=>{const e=k([]),n=k([]),t=k([]),a=k(new Set),s=k([]),l=k([]),c=k(0),d=k(!1),h=k(null),m=k(null),S=k(null),$=k(!1),x=k(null),b=k(!1),y=k(0),_=k(""),W=k([]),B=k(null),z=k(!1),V=k(!1),E=k(!1),oe=k(!1),ce=k(null);let de=null;function ge(F){ce.value=F,de&&clearTimeout(de),de=setTimeout(()=>{ce.value=null},8e3)}function X(){ce.value=null,de&&(clearTimeout(de),de=null)}async function Z(F,Q,$e,Tt){if(!B.value)return{success:!1,error:"No working directory set"};try{const rn=await $fetch(F,{method:Tt?.method??"POST",body:{workingDirectory:B.value,...Q}});return(Tt?.reloadGraph??!0)&&await Lt(B.value),{success:!0,data:rn}}catch(rn){const on=ar(rn,$e);return ge(on),{success:!1,error:on}}}const O=k(null),G=k(!1),H=k(!1),K=k(null),I=k([]),v=k([]),g=k(null),T=k(null),U=k(null),ae=k("inline"),N=k("list"),j=k("rounded"),L=k(!1),ee=k({date:!0,author:!0,commit:!0}),re=k(0),J=k(0),ne=k(null),se=k(null),Se=k(null),je=k(null),pe=k(null),ue=k(null),_e=k(null),Pe=k(null),Fe=k(null),qe=k(null),Qe=k(null),Je=k(!1),kt=new Map,jt=10,Qt=R(()=>{if(!_.value&&W.value.length===0)return e.value;let F=e.value;if(_.value){const Q=_.value.toLowerCase(),$e=`${Q}:${e.value.length}`;if(kt.has($e))F=kt.get($e);else{if(F=$o(F,Q),kt.size>=jt){const Tt=kt.keys().next().value;Tt&&kt.delete(Tt)}kt.set($e,F)}}if(W.value.length>0){const Q=new Set(W.value);F=fi(F,Q)}return F}),st=R(()=>n.value.find(F=>F.isHead)||null);async function Lt(F){B.value=F,$.value=!0,x.value=null;try{const[Q,$e,Tt,rn,on]=await Promise.all([$fetch("/api/git/log",{query:{workingDirectory:F}}),$fetch("/api/git/status",{query:{workingDirectory:F}}),$fetch("/api/git/stash",{query:{workingDirectory:F}}).then(bn=>bn.stashes).catch(()=>[]),$fetch("/api/git/remotes",{query:{workingDirectory:F}}).then(bn=>bn.remotes).catch(()=>[]),$fetch("/api/git/state",{query:{workingDirectory:F}}).then(bn=>bn.state).catch(()=>null)]);e.value=Q.commits,n.value=Q.branches,t.value=Q.tags,a.value=new Set(Q.localBranches??[]),b.value=Q.hasMore,y.value=Q.totalCount,s.value=$e.stagedFiles??[],l.value=$e.unstagedFiles??[],c.value=($e.stagedCount??0)+($e.unstagedCount??0),I.value=Tt,v.value=rn,K.value=on,O.value=Date.now(),await C()}catch(Q){const $e=Q instanceof Error?Q.message:"Failed to load git graph";x.value=$e,e.value=[],n.value=[],t.value=[],s.value=[],l.value=[],c.value=0,I.value=[],v.value=[]}finally{$.value=!1}}async function St(){if(B.value)try{const F=await $fetch("/api/git/status",{query:{workingDirectory:B.value}});s.value=F.stagedFiles??[],l.value=F.unstagedFiles??[],c.value=(F.stagedCount??0)+(F.unstagedCount??0)}catch(F){console.error("Failed to refresh uncommitted changes:",F)}}const _t=k(!1);async function Nt(){if(!(!B.value||!b.value||$.value||_t.value)){_t.value=!0;try{const F=await $fetch("/api/git/log",{query:{workingDirectory:B.value,offset:e.value.length}});e.value=[...e.value,...F.commits],b.value=F.hasMore}catch(F){console.error("Failed to load more commits:",F)}finally{_t.value=!1}}}async function gt(F){if(h.value=F,m.value=null,S.value=null,d.value=!1,z.value=!0,!B.value){z.value=!1;return}try{const Q=await $fetch("/api/git/show",{query:{workingDirectory:B.value,hash:F.hash}});m.value=Q.files,S.value=Q.stats}catch(Q){console.error("Failed to load commit details:",Q),m.value=[],S.value={additions:0,deletions:0,filesChanged:0},ge("Failed to load commit details")}finally{z.value=!1}}function Ot(){h.value=null,m.value=null,S.value=null,d.value=!1}function Mt(){h.value=null,S.value=null,m.value=null,d.value=!0}function Ft(F){_.value=F,re.value=0,fe()}const q=R(()=>_.value?$o(e.value,_.value).map(F=>F.hash):[]);function fe(){J.value=q.value.length}function te(){q.value.length!==0&&(re.value=(re.value+1)%q.value.length,fe(),be())}function me(){q.value.length!==0&&(re.value=re.value<=0?q.value.length-1:re.value-1,fe(),be())}function be(){const F=q.value[re.value];if(F){const Q=e.value.find($e=>$e.hash===F);Q&>(Q)}}function Me(F){const Q=W.value.indexOf(F);Q===-1?W.value.push(F):W.value.splice(Q,1)}function Ee(){_.value="",W.value=[]}async function Oe(F){if(!B.value)return{success:!1,error:"No working directory set"};oe.value=!0;try{const Q=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:B.value,branchName:F}});return Q.success&&await Lt(B.value),{success:Q.success,error:Q.error}}catch(Q){const $e=Q instanceof Error?Q.message:"Failed to checkout branch";return ge($e),{success:!1,error:$e}}finally{oe.value=!1}}async function kn(F,Q){if(!B.value)return{success:!1,error:"No working directory set"};try{const $e=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:B.value,branchName:F,createBranch:!0,fromCommit:Q}});return $e.success&&await Lt(B.value),{success:$e.success,error:$e.error}}catch($e){return{success:!1,error:$e instanceof Error?$e.message:"Failed to create branch"}}}async function Jt(F,Q=!1){return Z("/api/git/branch",{branchName:F,force:Q},"Failed to delete branch",{method:"DELETE"})}async function en(F){return Z("/api/git/branch",{branchName:F,remote:!0},"Failed to delete remote branch",{method:"DELETE"})}async function Cn(F){if(!B.value)return{success:!1,error:"No working directory set"};V.value=!0;try{return await $fetch("/api/git/stage",{method:"POST",body:{workingDirectory:B.value,files:F}}),await St(),{success:!0}}catch(Q){const $e=Q instanceof Error?Q.message:"Failed to stage files";return ge($e),{success:!1,error:$e}}finally{V.value=!1}}async function Kt(F){if(!B.value)return{success:!1,error:"No working directory set"};V.value=!0;try{return await $fetch("/api/git/unstage",{method:"POST",body:{workingDirectory:B.value,files:F}}),await St(),{success:!0}}catch(Q){const $e=Q instanceof Error?Q.message:"Failed to unstage files";return ge($e),{success:!1,error:$e}}finally{V.value=!1}}async function mt(F){if(!B.value)return{success:!1,error:"No working directory set"};E.value=!0;try{return await $fetch("/api/git/commit",{method:"POST",body:{workingDirectory:B.value,message:F}}),await Lt(B.value),{success:!0}}catch(Q){const $e=Q instanceof Error?Q.message:"Failed to commit changes";return ge($e),{success:!1,error:$e}}finally{E.value=!1}}async function $n(F,Q){return Z("/api/git/branch-rename",{oldName:F,newName:Q},"Failed to rename branch")}async function He(F,Q){return Z("/api/git/merge",{branch:F,...Q},"Failed to merge branch")}async function zt(F){return Z("/api/git/rebase",{onto:F},"Failed to rebase branch")}async function lt(F,Q,$e,Tt){return Z("/api/git/push",{branch:F,remote:Q,force:$e,forceWithLease:Tt},"Failed to push branch")}async function gn(F,Q,$e,Tt){return Z("/api/git/pull",{branch:F,remote:Q,noFastForward:$e,squash:Tt},"Failed to pull branch")}async function et(F,Q,$e){return Z("/api/git/fetch",{branch:F,remote:Q,...$e},"Failed to fetch")}async function ln(F,Q,$e){return Z("/api/git/cherry-pick",{hash:F,recordOrigin:Q,noCommit:$e},"Failed to cherry-pick commit")}async function ct(F){return Z("/api/git/revert",{hash:F},"Failed to revert commit")}async function xt(F,Q){return Z("/api/git/reset",{hash:F,mode:Q},"Failed to reset to commit")}async function ze(F){if(!B.value)return{success:!1,error:"No working directory set"};try{return await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:B.value,branchName:F}}),await Lt(B.value),{success:!0}}catch(Q){const $e=Q?.data?.message||Q?.statusMessage||Q?.message||"Failed to checkout commit";return ge($e),{success:!1,error:$e}}}async function Ht(F){try{const Q=F.message.split(`
|
|
63
|
+
`)[0];return await jn(Q),{success:!0}}catch(Q){const $e=Q?.message||"Failed to copy commit subject";return ge($e),{success:!1,error:$e}}}async function ot(F,Q,$e,Tt,rn){return Z("/api/git/tag",{name:F,hash:Q,annotated:$e,message:Tt,pushToRemote:rn},"Failed to create tag")}async function tn(F,Q){return Z("/api/git/tag",{name:F,deleteFromRemote:Q},"Failed to delete tag",{method:"DELETE"})}async function at(F,Q){return Z("/api/git/tag-push",{name:F,remote:Q},"Failed to push tag")}async function cn(F){if(!B.value)return{success:!1,error:"No working directory set"};try{return{success:!0,data:await $fetch(`/api/git/tag/${encodeURIComponent(F)}`,{query:{workingDirectory:B.value}})}}catch(Q){const $e=ar(Q,"Failed to get tag detail");return ge($e),{success:!1,error:$e}}}async function Xe(F){try{return await jn(F),{success:!0}}catch(Q){const $e=Q?.message||"Failed to copy tag name";return ge($e),{success:!1,error:$e}}}async function xn(){if(!B.value)return{success:!1,error:"No working directory set"};try{const F=await $fetch("/api/git/stash",{query:{workingDirectory:B.value}});return I.value=F.stashes,{success:!0}}catch(F){const Q=ar(F,"Failed to load stashes");return ge(Q),{success:!1,error:Q}}}async function ut(F,Q){return Z("/api/git/stash-apply",{index:F,reinstateIndex:Q},"Failed to apply stash")}async function nn(F,Q){return Z("/api/git/stash-pop",{index:F,reinstateIndex:Q},"Failed to pop stash")}async function dt(F){return Z("/api/git/stash-drop",{index:F},"Failed to drop stash")}async function Sn(F,Q){return Z("/api/git/stash-branch",{index:F,branchName:Q},"Failed to create branch from stash")}async function we(F,Q){return Z("/api/git/stash",{message:F,includeUntracked:Q},"Failed to stash changes")}async function A(){if(!B.value)return{success:!1,error:"No working directory set"};try{const F=await $fetch("/api/git/remotes",{query:{workingDirectory:B.value}});return v.value=F.remotes,{success:!0}}catch(F){const Q=ar(F,"Failed to load remotes");return ge(Q),{success:!1,error:Q}}}async function ie(F,Q){return Z("/api/git/remote",{name:F,url:Q},"Failed to add remote")}async function xe(F,Q){return Z("/api/git/remote",{name:F,newUrl:Q},"Failed to edit remote",{method:"PUT"})}async function Ge(F){return Z("/api/git/remote",{name:F},"Failed to delete remote",{method:"DELETE"})}async function Ve(F,Q){return Z("/api/git/fetch",{all:!0,prune:F,pruneTags:Q},"Failed to fetch all")}function Ke(){ae.value=ae.value==="inline"?"bottom":"inline"}function ht(){N.value=N.value==="list"?"tree":"list"}function rt(F){j.value=F}function Vt(){L.value=!L.value}function ft(F){ee.value={...ee.value,[F]:!ee.value[F]}}async function it(F){if(ne.value=F,se.value=null,F&&B.value)try{const Q=await $fetch("/api/git/merge-base",{params:{workingDirectory:B.value,branch:F}});se.value=Q.mergeBase}catch{se.value=null}}async function Wt(F,Q){if(Se.value=F,je.value=null,pe.value=Q??null,F&&B.value)try{const $e=await $fetch("/api/git/merge-base",{params:{workingDirectory:B.value,branch:F,baseBranch:Q??void 0}});je.value=$e.mergeBase}catch{je.value=null}}async function Gt(F,Q){if(ue.value=F,_e.value=null,Pe.value=Q??null,F&&B.value)try{const $e=await $fetch("/api/git/merge-base",{params:{workingDirectory:B.value,branch:F,baseBranch:Q??void 0}});_e.value=$e.mergeBase}catch{_e.value=null}}async function C(){if(!B.value)return;const F=[];ne.value&&F.push((async()=>{try{const Q=await $fetch("/api/git/merge-base",{params:{workingDirectory:B.value,branch:ne.value}});se.value=Q.mergeBase}catch{se.value=null}})()),Se.value&&F.push((async()=>{try{const Q=await $fetch("/api/git/merge-base",{params:{workingDirectory:B.value,branch:Se.value,baseBranch:pe.value??void 0}});je.value=Q.mergeBase}catch{je.value=null}})()),ue.value&&F.push((async()=>{try{const Q=await $fetch("/api/git/merge-base",{params:{workingDirectory:B.value,branch:ue.value,baseBranch:Pe.value??void 0}});_e.value=Q.mergeBase}catch{_e.value=null}})()),F.length>0&&await Promise.all(F)}function P(F){const Q=e.value.find($e=>$e.hash===F||$e.shortHash===F);Q&>(Q)}async function M(F){return Z("/api/git/reset",{hash:"HEAD",mode:F},"Failed to reset working directory")}async function f(){return Z("/api/git/clean",{},"Failed to clean untracked files")}function p(F){T.value=F}function le(){T.value=null}function ye(F){U.value=F}function Te(){U.value=null}const Ne=k(null),tt=k(null),bt=k(!1),tr=R(()=>!!g.value&&!!h.value);function un(F){g.value=F,F&&h.value&&nr()}function Tr(){g.value=null,Ne.value=null,tt.value=null,bt.value=!1}async function nr(){if(!(!B.value||!h.value||!g.value)){bt.value=!0;try{const F=g.value.hash,Q=h.value.hash,$e=await $fetch("/api/git/diff",{query:{workingDirectory:B.value,from:F,to:Q}});Ne.value=$e.files,tt.value=$e.stats}catch(F){console.error("Failed to load comparison:",F),ge("Failed to load commit comparison"),Ne.value=null,tt.value=null}finally{bt.value=!1}}}async function jn(F){navigator?.clipboard&&await navigator.clipboard.writeText(F)}async function zn(F,Q){Fe.value=Q,qe.value=F,Qe.value=null,Je.value=!0,await Vn()}function Re(){Fe.value=null,qe.value=null,Qe.value=null,Je.value=!1}async function Vn(){if(!B.value||!qe.value||!Fe.value){Je.value=!1;return}Je.value=!0;try{const F=await $fetch("/api/git/file-diff",{query:{workingDirectory:B.value,commitHash:qe.value,filePath:Fe.value.path}});Qe.value=F}catch(F){console.error("Failed to load file diff:",F),ge("Failed to load file diff"),Qe.value=null}finally{Je.value=!1}}function Rn(){e.value=[],n.value=[],t.value=[],a.value=new Set,s.value=[],l.value=[],c.value=0,d.value=!1,h.value=null,m.value=null,S.value=null,$.value=!1,x.value=null,b.value=!1,y.value=0,_.value="",W.value=[],B.value=null,O.value=null,G.value=!1,H.value=!1,K.value=null,_t.value=!1,z.value=!1,V.value=!1,E.value=!1,oe.value=!1,I.value=[],v.value=[],g.value=null,Ne.value=null,tt.value=null,bt.value=!1,T.value=null,U.value=null,ae.value="inline",N.value="list",j.value="rounded",L.value=!1,ee.value={date:!0,author:!0,commit:!0},re.value=0,J.value=0,ne.value=null,Se.value=null,je.value=null,pe.value=null,ue.value=null,_e.value=null,Pe.value=null,Fe.value=null,qe.value=null,Qe.value=null,Je.value=!1,X(),kt.clear()}async function vo(){if(!B.value||H.value||$.value)return!1;H.value=!0;try{const F=(await $fetch("/api/git/state",{query:{workingDirectory:B.value}})).state,Q=K.value;if(K.value=F,O.value=Date.now(),!Q)return!1;const $e=Q.headCommit!==F.headCommit||Q.branchListHash!==F.branchListHash,Tt=Q.workingTreeHash!==F.workingTreeHash,rn=Q.stashListHash!==F.stashListHash;if($e){const[yn,rr,Rs]=await Promise.all([$fetch("/api/git/log",{query:{workingDirectory:B.value}}),$fetch("/api/git/status",{query:{workingDirectory:B.value}}),$fetch("/api/git/stash",{query:{workingDirectory:B.value}}).then(Ps=>Ps.stashes).catch(()=>[])]);return e.value=yn.commits,n.value=yn.branches,t.value=yn.tags,a.value=new Set(yn.localBranches??[]),b.value=yn.hasMore,y.value=yn.totalCount,s.value=rr.stagedFiles??[],l.value=rr.unstagedFiles??[],c.value=(rr.stagedCount??0)+(rr.unstagedCount??0),I.value=Rs,await C(),!0}if(!Tt&&!rn)return!1;const[on,bn]=await Promise.all([Tt?$fetch("/api/git/status",{query:{workingDirectory:B.value}}):Promise.resolve(null),rn?$fetch("/api/git/stash",{query:{workingDirectory:B.value}}).then(yn=>yn.stashes).catch(()=>[]):Promise.resolve(null)]);return on&&(s.value=on.stagedFiles??[],l.value=on.unstagedFiles??[],c.value=(on.stagedCount??0)+(on.unstagedCount??0)),bn&&(I.value=bn),!0}catch(F){return console.error("Failed to refresh git graph:",F),!1}finally{H.value=!1}}function Bs(){G.value=!0}function Es(){G.value=!1}return{commits:Ce(e),branches:Ce(n),tags:Ce(t),localBranchNames:Ce(a),stagedFiles:Ce(s),unstagedFiles:Ce(l),uncommittedChangesCount:Ce(c),isUncommittedChangesSelected:Ce(d),selectedCommit:Ce(h),selectedCommitFiles:Ce(m),selectedCommitStats:Ce(S),loading:Ce($),loadingMore:Ce(_t),error:Ce(x),hasMore:Ce(b),totalCount:Ce(y),searchQuery:Ce(_),filteredBranches:Ce(W),workingDirectory:Ce(B),stashes:Ce(I),remotes:Ce(v),comparisonCommit:Ce(g),comparisonFiles:Ce(Ne),comparisonStats:Ce(tt),comparisonLoading:Ce(bt),isComparing:tr,activeDialog:Ce(T),activeContextMenu:Ce(U),detailViewPosition:Ce(ae),fileViewMode:Ce(N),graphStyle:Ce(j),muteNonAncestral:Ce(L),columnVisibility:Ce(ee),searchResultIndex:Ce(re),searchResultCount:Ce(J),selectedFeatureId:Ce(ne),featureMergeBase:Ce(se),conversationBranch:Ce(Se),conversationMergeBase:Ce(je),conversationBaseBranch:Ce(pe),previewBranch:Ce(ue),previewMergeBase:Ce(_e),previewBaseBranch:Ce(Pe),diffViewerFile:Ce(Fe),diffViewerCommitHash:Ce(qe),diffViewerContent:Ce(Qe),diffViewerLoading:Ce(Je),lastRefreshTime:Ce(O),isPollingActive:Ce(G),isRefreshing:Ce(H),isLoadingDetails:Ce(z),isStaging:Ce(V),isCommitting:Ce(E),isCheckingOut:Ce(oe),operationError:Ce(ce),filteredCommits:Qt,currentBranch:st,searchResultHashes:q,loadGitGraph:Lt,loadMoreCommits:Nt,refreshUncommittedChanges:St,selectCommit:gt,selectUncommittedChanges:Mt,clearSelection:Ot,setSearchQuery:Ft,toggleBranchFilter:Me,clearFilters:Ee,nextSearchResult:te,prevSearchResult:me,checkoutBranch:Oe,createBranch:kn,deleteLocalBranch:Jt,deleteRemoteBranch:en,stageFiles:Cn,unstageFiles:Kt,commitChanges:mt,reset:Rn,clearOperationError:X,renameBranch:$n,mergeBranch:He,rebaseBranch:zt,pushBranch:lt,pullBranch:gn,fetchBranch:et,cherryPickCommit:ln,revertCommit:ct,resetToCommit:xt,checkoutCommit:ze,copyCommitSubject:Ht,createTag:ot,deleteTag:tn,pushTag:at,getTagDetail:cn,copyTagName:Xe,loadStashes:xn,applyStash:ut,popStash:nn,dropStash:dt,stashBranch:Sn,stashChanges:we,loadRemotes:A,addRemote:ie,editRemote:xe,deleteRemote:Ge,fetchAll:Ve,setActiveDialog:p,clearActiveDialog:le,setActiveContextMenu:ye,clearActiveContextMenu:Te,selectComparisonCommit:un,clearComparison:Tr,loadComparisonData:nr,copyToClipboard:jn,toggleDetailViewPosition:Ke,toggleFileViewMode:ht,setGraphStyle:rt,toggleMuteNonAncestral:Vt,toggleColumnVisibility:ft,navigateToCommit:P,resetWorking:M,cleanUntracked:f,setSelectedFeatureId:it,setConversationBranch:Wt,setPreviewBranch:Gt,openFileDiff:zn,closeFileDiff:Re,checkAndRefresh:vo,startPolling:Bs,stopPolling:Es}});async function Fu(){if(typeof window>"u")return{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0};try{const e=await $fetch("/api/conversations");if(!e||!Array.isArray(e.conversations))return console.warn("[conversationStorage] Invalid data structure from server"),{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0};e.version!==mr&&console.warn(`[conversationStorage] Storage version mismatch: ${e.version} vs ${mr}`);const n=e.conversations.map(h=>{if(!h||typeof h!="object")return h;const m=h;return"claudeSessionId"in m&&!("providerSessionId"in m)?{...m,providerSessionId:m.claudeSessionId}:h}),a=(Array.isArray(e.archivedConversations)?e.archivedConversations:[]).map(h=>{if(!h||typeof h!="object")return h;const m=h;return"claudeSessionId"in m&&!("providerSessionId"in m)?{...m,providerSessionId:m.claudeSessionId}:h}),s=n.filter(Os),l=a.filter(Us),c=n.length-s.length,d=a.length-l.length;return c>0&&console.warn(`[conversationStorage] Discarded ${c} corrupted active conversation(s)`),d>0&&console.warn(`[conversationStorage] Discarded ${d} corrupted archive conversation(s)`),{conversations:s,archivedConversations:l,discardedConversations:c,discardedArchives:d}}catch(e){return console.error("[conversationStorage] Failed to load conversations:",e),{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0}}}async function Hu(e,n=[]){if(typeof window>"u")return!1;try{return await $fetch("/api/conversations",{method:"POST",body:{version:mr,conversations:e,archivedConversations:n}}),!0}catch(t){return console.error("Failed to save conversations:",t),!1}}async function Fo(e){if(typeof window>"u")return!1;try{return await $fetch("/api/conversations/update",{method:"POST",body:{version:mr,conversation:e}}),!0}catch(n){return console.error("Failed to save conversation:",n),!1}}function Ou(e){return e?e.map(n=>{switch(n.type){case"text":return n.text;case"tool_use":return`[${n.name}] ${n.inputSummary}`;case"tool_result":return n.isError?`Error: ${n.content.slice(0,100)}`:"";case"thinking":case"result_summary":case"session_init":return"";default:return""}}).filter(Boolean).join(`
|
|
64
|
+
`):""}const At=xr("chat",()=>{const e=k(!1),n=k(js),t=k("ask"),a=k(""),s=k([]),l=k([]),c=k(null),d=k("active"),h=k(new Set),m=new Map,S=k(!1),$=k(0),x=new Map,b=1200,y=k(null),_=k(null);function W(C){return C?m.get(C)??null:null}function B(C){let P=m.get(C);return P||(P={session:null,pendingPermission:null,pendingPlanApproval:null,lastError:null,debugEvents:[]},m.set(C,P)),P}const z=R(()=>s.value.find(C=>C.id===c.value)||null),V=R(()=>z.value?.messages??[]),E=R(()=>($.value,W(c.value)?.session??null)),oe=R(()=>($.value,W(c.value)?.pendingPermission??null)),ce=R(()=>($.value,W(c.value)?.pendingPlanApproval??null)),de=R(()=>($.value,W(c.value)?.lastError??null)),ge=R(()=>($.value,W(c.value)?.debugEvents??[])),X=R(()=>E.value?.status==="streaming"),Z=R(()=>z.value?.providerSessionId??""),O=R(()=>V.value.length>0),G=R(()=>V.value[V.value.length-1]||null);function H(C){return h.value.has(C)}const K=R(()=>c.value?h.value.has(c.value):!1),I=R(()=>s.value.length>0),v=R(()=>l.value.length>0),g=R(()=>s.value.length),T=R(()=>g.value>=bo),U=R(()=>s.value),ae=R(()=>l.value),N=R(()=>y.value&&s.value.find(C=>C.id===y.value)||null);function j(C){return y.value===C}function L(C){d.value=C}async function ee(C){if(!(!C?.previewBranch||!C.worktreePath))try{const P=await $fetch("/api/chat/preview-sync",{method:"POST",body:{previewBranch:C.previewBranch,worktreePath:C.worktreePath}});if(!P.success)throw new Error(P.error||"Unknown preview sync failure")}catch(P){console.warn("[chat] Failed to sync preview branch after worktree update",{conversationId:C.id,previewBranch:C.previewBranch,worktreePath:C.worktreePath,error:P instanceof Error?P.message:String(P)})}}async function re(C){if(H(C))return{success:!1,error:"Cannot archive while this conversation is streaming"};if(s.value.findIndex(M=>M.id===C)===-1)return{success:!1,error:"Conversation not found"};try{const M=await $fetch(`/api/conversations/${C}/archive`,{method:"POST"});if(M.success&&M.archived){const f=x.get(C);return f&&(clearTimeout(f),x.delete(C)),m.delete(C),s.value=Array.isArray(M.conversations)?M.conversations:s.value.filter(p=>p.id!==C),l.value=Array.isArray(M.archivedConversations)?M.archivedConversations:[M.archived,...l.value],tn(),y.value===C&&(y.value=null),c.value===C&&(c.value=s.value[0]?.id??null),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:c.value}}).catch(p=>{console.error("Failed to save active conversation:",p)}),{success:!0}}return{success:!1,error:"Failed to archive conversation"}}catch(M){return{success:!1,error:M instanceof Error?M.message:"Failed to archive conversation"}}}async function J(C,P){if(ft().atLimit)return{success:!1,error:`Cannot restore. Active conversations reached ${yo}.`};if(!l.value.some(f=>f.id===C))return{success:!1,error:"Archived conversation not found"};try{const f=await $fetch(`/api/conversations/archives/${C}/restore`,{method:"POST",body:{baseBranch:P}});return f.success&&f.conversation?(s.value=Array.isArray(f.conversations)?f.conversations:[f.conversation,...s.value],Array.isArray(f.archivedConversations)?l.value=f.archivedConversations:l.value=l.value.filter(p=>p.id!==C),d.value="active",cn(f.conversation.id),ot(),xt(),{success:!0,conversationId:f.conversation.id}):{success:!1,error:"Failed to restore archived conversation"}}catch(f){return{success:!1,error:f instanceof Error?f.message:"Failed to restore archived conversation"}}}async function ne(C){const P=l.value.findIndex(M=>M.id===C);if(P===-1)return{success:!1,error:"Archived conversation not found"};try{const M=await $fetch(`/api/conversations/archives/${C}`,{method:"DELETE"});return M.success?(Array.isArray(M.archivedConversations)?l.value=M.archivedConversations:l.value.splice(P,1),tn(),{success:!0}):{success:!1,error:"Failed to delete archived conversation"}}catch{return l.value.splice(P,1),xt(),{success:!0}}}async function se(){if(!(typeof window>"u"))try{const C=await $fetch("/api/settings");if(C){if(typeof C.panelWidth=="number"){const f=C.panelWidth;f>=wo&&f<=ko&&(n.value=f)}typeof C.isPanelOpen=="boolean"&&(e.value=C.isPanelOpen),typeof C.activeConversationId=="string"&&(c.value=C.activeConversationId);const{useSettingsStore:P}=await _n(async()=>{const{useSettingsStore:f}=await import("./B3SzeM5g.js").then(p=>p.s);return{useSettingsStore:f}},__vite__mapDeps([0,1,2]),import.meta.url),M=P();await M.hydrate(),t.value=M.permissionMode}}catch(C){console.error("Failed to load chat settings:",C)}}function Se(C){t.value=C,typeof window<"u"&&_n(async()=>{const{useSettingsStore:P}=await import("./B3SzeM5g.js").then(M=>M.s);return{useSettingsStore:P}},__vite__mapDeps([0,1,2]),import.meta.url).then(({useSettingsStore:P})=>{P().setPermissionMode(C)})}function je(C,P){const M=P??c.value;if(!M)return;const f=B(M);f.pendingPermission=C,$.value++}function pe(C){const P=C??c.value;if(!P)return;const M=m.get(P);M&&(M.pendingPermission=null,$.value++)}function ue(C,P){const M=P??c.value;if(!M)return;const f=B(M);f.pendingPlanApproval=C,$.value++}function _e(C){const P=C??c.value;if(!P)return;const M=m.get(P);M&&(M.pendingPlanApproval=null,$.value++)}function Pe(){e.value=!e.value,Qe()}function Fe(){e.value=!0,Qe()}function qe(){e.value=!1,Qe()}function Qe(){typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{isPanelOpen:e.value}}).catch(C=>{console.error("Failed to save panel state:",C)})}function Je(C){const P=Math.max(wo,Math.min(ko,C));n.value=P,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{panelWidth:P}}).catch(M=>{console.error("Failed to save panel width:",M)})}function kt(C){a.value=C}function jt(C,P){const M=P??c.value;if(!M)return;const f=s.value.find(p=>p.id===M);f&&(f.providerSessionId=C)}function Qt(C,P){const M=s.value.find(f=>f.id===C);M&&(M.worktreeBranch=P,M.lastCommitTime=new Date().toISOString())}async function st(C){const P=s.value.find(f=>f.id===C);if(!P?.worktreeBranch)return null;const M=P.worktreeBranch.trim();if(!M)return null;try{const p=(await $fetch("/api/specs/features")).features.find(le=>le.id===M);return p?(P.featureId!==p.id&&(P.featureId=p.id,P.updatedAt=new Date().toISOString(),xt()),p.id):null}catch(f){return console.warn("[chat] Failed to map branch to feature",{conversationId:C,branchName:M,error:f instanceof Error?f.message:String(f)}),null}}function Lt(C,P,M){const f=s.value.find(p=>p.id===C);f&&(f.providerId=P,f.providerModelKey=M)}function St(C){const P=C??c.value;if(!P)return;const M=s.value.find(f=>f.id===P);M&&(M.providerSessionId="")}function _t(C){return s.value.find(M=>M.id===C)?.providerSessionId??""}function Nt(C){h.value.add(C)}function gt(C){h.value.delete(C)}function Ot(C,P){const M=P??c.value;if(!M)return;const f=s.value.find(p=>p.id===M);f&&f.messages.push(C)}function Mt(C,P,M){const f={id:hr(),role:"user",content:C,attachments:M&&M.length>0?M:void 0,timestamp:new Date().toISOString()};return Ot(f,P),f}function Ft(C){const P={id:hr(),role:"assistant",content:"",timestamp:new Date().toISOString(),status:"streaming"};return Ot(P,C),P}function q(C,P,M){const f=M??c.value;if(!f)return;const p=s.value.find(ye=>ye.id===f);if(!p)return;const le=p.messages.findIndex(ye=>ye.id===C);le!==-1&&(p.messages[le]={...p.messages[le],...P})}function fe(C,P,M){const f=M??c.value;if(!f)return;const p=s.value.find(ye=>ye.id===f);if(!p)return;const le=p.messages.findIndex(ye=>ye.id===C);le!==-1&&(p.messages[le].content+=P)}function te(C,P,M){const f=M??c.value;if(!f)return;const p=s.value.find(ye=>ye.id===f);if(!p)return;const le=p.messages.findIndex(ye=>ye.id===C);if(le!==-1){const ye=p.messages[le],Te=ye.tools?[...ye.tools,P]:[P];p.messages[le]={...ye,tools:Te}}}function me(C,P,M,f){const p=f??c.value;if(!p)return;const le=s.value.find(Te=>Te.id===p);if(!le)return;const ye=le.messages.findIndex(Te=>Te.id===C);if(ye!==-1){const Te=le.messages[ye];if(Te.tools){const Ne=Te.tools.findIndex(tt=>tt.id===P);if(Ne!==-1){const tt=[...Te.tools];tt[Ne]={...tt[Ne],...M},le.messages[ye]={...Te,tools:tt}}}}ze(p,!1)}function be(C){C.contentBlocks&&(C.content=Ou(C.contentBlocks))}function Me(C,P){if(C.type!==P.type)return!0;switch(P.type){case"text":return C.text!==P.text;case"tool_use":{const M=C;return M.name!==P.name||M.inputSummary!==P.inputSummary}case"tool_result":{const M=C;return M.content!==P.content||M.isError!==P.isError}default:return!1}}function Ee(C,P){const M=P??c.value;if(!M)return;const f=s.value.find(le=>le.id===M);if(!f)return;const p=f.messages.find(le=>le.id===C);p&&!p.contentBlocks&&(p.contentBlocks=[])}function Oe(C,P,M){const f=M??c.value;if(!f)return;const p=s.value.find(ye=>ye.id===f);if(!p)return;const le=p.messages.find(ye=>ye.id===C);le&&(le.contentBlocks||(le.contentBlocks=[]),le.contentBlocks.push(P),be(le))}function kn(C,P,M,f){const p=f??c.value;if(!p)return;const le=s.value.find(bt=>bt.id===p);if(!le)return;const ye=le.messages.find(bt=>bt.id===C);if(!ye?.contentBlocks)return;const Te=ye.contentBlocks.findIndex(bt=>bt.id===P);if(Te===-1)return;const tt={...ye.contentBlocks[Te]};M(tt),ye.contentBlocks[Te]=tt}function Jt(C,P,M,f,p){const le=f??c.value;if(!le)return;const ye=s.value.find(un=>un.id===le);if(!ye)return;const Te=ye.messages.find(un=>un.id===C);if(!Te?.contentBlocks)return;const Ne=Te.contentBlocks.findIndex(un=>un.id===P);if(Ne===-1)return;const tt=Te.contentBlocks[Ne],bt={...tt};M(bt),Te.contentBlocks[Ne]=bt,p?.syncContent!==!1&&Me(tt,bt)&&be(Te),ze(le,!1)}function en(C,P,M){const f=M??c.value;if(!f)return;const p=s.value.find(ye=>ye.id===f);if(!p)return;const le=p.messages.find(ye=>ye.id===C);le&&(le.contentBlocks||(le.contentBlocks=[]),le.contentBlocks.push(P),be(le),ze(f,!1))}function Cn(C,P,M){const f=M??c.value;if(!f)return null;const p=s.value.find(ye=>ye.id===f);if(!p)return null;const le=p.messages.find(ye=>ye.id===C);return le?.contentBlocks?le.contentBlocks.find(ye=>ye.type==="tool_use"&&ye.toolUseId===P)??null:null}function Kt(C,P){const M=P??c.value;if(!M)return;const f=m.get(M);f?.session&&(f.session.status=C,$.value++)}function mt(C,P){const M=P??c.value;if(!M)return;const f=B(M);f.session={sessionId:C,cwd:a.value,status:"streaming",startedAt:new Date().toISOString()},f.lastError=null,$.value++}function $n(C){const P=C??c.value;if(!P)return;const M=m.get(P);M?.session&&(M.session.status="idle",$.value++)}function He(C,P){const M=P??c.value;if(!M)return;const f=B(M);f.session&&(f.session.status="error",f.session.error=C),f.lastError=C,$.value++}function zt(C,P){if(!S.value)return;const M=P??c.value;if(!M)return;const f=B(M),p=(()=>{if(typeof C.payload=="string")return C.payload;try{return JSON.stringify(C.payload,null,2)}catch{return String(C.payload)}})(),le=8e3,ye=300,Te=p.length>le?`${p.slice(0,le)}
|
|
65
|
+
... (truncated)`:p;f.debugEvents.push({id:`dbg-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,timestamp:new Date().toISOString(),direction:C.direction,channel:C.channel,eventType:C.eventType||"unknown",payload:Te}),f.debugEvents.length>ye&&f.debugEvents.splice(0,f.debugEvents.length-ye),$.value++}function lt(C){S.value=C}function gn(C){const P=C??c.value;if(!P)return;const M=m.get(P);M&&(M.debugEvents=[],$.value++)}function et(){if(!c.value)return;const C=s.value.find(M=>M.id===c.value);C&&(C.messages=[]);const P=c.value;m.delete(P),$.value++}function ln(C){const P=C??c.value;if(!P)return;const M=m.get(P);M&&(M.lastError=null,M.session&&(M.session.error=void 0),$.value++)}async function ct(){const C=await Fu();if(s.value=C.conversations,l.value=C.archivedConversations,C.discardedArchives>0&&console.warn(`[chat] Skipped ${C.discardedArchives} corrupted archived conversation(s)`),ot(),tn(),!y.value){const P=s.value.find(M=>!!M.previewBranch&&!M.finalized);P&&(y.value=P.id)}if(c.value){const P=s.value.find(M=>M.id===c.value);P&&P.cwd?a.value=P.cwd:P||(c.value=null,e.value=!1)}}function xt(){Hu(s.value,l.value)}function ze(C,P=!1){const M=s.value.find(f=>f.id===C);if(M)if(P){const f=x.get(C);f&&(clearTimeout(f),x.delete(C)),M.updatedAt=new Date().toISOString(),Fo(M)}else{if(x.get(C))return;const p=setTimeout(()=>{M.updatedAt=new Date().toISOString(),Fo(M),x.delete(C)},b);x.set(C,p)}}function Ht(C=!1){c.value&&ze(c.value,C)}function ot(){s.value.sort((C,P)=>new Date(P.createdAt).getTime()-new Date(C.createdAt).getTime())}function tn(){l.value.sort((C,P)=>new Date(P.archivedAt).getTime()-new Date(C.archivedAt).getTime())}async function at(C){if(ft().atLimit)return"";const M=Go();let f=null;if(C?.featureId){const Te=await $fetch("/api/chat/worktree",{method:"POST",body:{conversationId:M,featureId:C.featureId,baseBranch:C.baseBranch}});if(!Te.success&&Te.error)throw new Error(Te.error);f=Te}let p=null;if(typeof window<"u")try{const{useSettingsStore:Te}=await _n(async()=>{const{useSettingsStore:tt}=await import("./B3SzeM5g.js").then(bt=>bt.s);return{useSettingsStore:tt}},__vite__mapDeps([0,1,2]),import.meta.url),Ne=Te();await Ne.hydrate(),p=Ne.providerSelection}catch(Te){console.warn("[chat] Failed to load provider selection for new conversation",Te)}const le=p||{providerId:Ko,modelKey:qo},ye={id:M,title:"New Conversation",messages:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),cwd:a.value||process.cwd?.()||"",featureId:C?.featureId,providerId:le.providerId,providerModelKey:le.modelKey};if(f?.success&&f.worktreePath&&f.branch&&(ye.worktreePath=f.worktreePath,ye.worktreeBranch=f.branch,ye.cwd=f.worktreePath,ye.hasWorktree=!0,f.baseBranch&&(ye.baseBranch=f.baseBranch),f.providerSessionId&&(ye.providerSessionId=f.providerSessionId)),s.value.unshift(ye),c.value=M,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:M}}).catch(Te=>{console.error("Failed to save active conversation:",Te)}),!C?.featureId)try{const Te=await $fetch("/api/chat/worktree",{method:"POST",body:{conversationId:M,baseBranch:C?.baseBranch}});if(Te.success&&Te.worktreePath&&Te.branch){const Ne=s.value.find(tt=>tt.id===M);Ne&&(Ne.worktreePath=Te.worktreePath,Ne.worktreeBranch=Te.branch,Ne.cwd=Te.worktreePath,Ne.hasWorktree=!0,Te.baseBranch&&(Ne.baseBranch=Te.baseBranch))}}catch(Te){console.warn("[chat] Failed to create worktree for conversation",M,Te)}return xt(),M}function cn(C){const P=s.value.find(M=>M.id===C);P&&(c.value=C,e.value=!0,P.cwd&&(a.value=P.cwd),!P.featureId&&P.worktreeBranch&&st(C),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:C,isPanelOpen:!0}}).catch(M=>{console.error("Failed to save active conversation:",M)}))}async function Xe(C){const P=s.value.findIndex(p=>p.id===C);if(P===-1)return;const M=s.value[P];if(y.value===C&&(y.value=null),M.hasWorktree&&M.worktreePath&&M.worktreeBranch)try{await $fetch("/api/chat/worktree",{method:"DELETE",body:{worktreePath:M.worktreePath,branch:M.worktreeBranch}})}catch(p){console.warn("[chat] Failed to clean up worktree for conversation",C,p)}s.value.splice(P,1),m.delete(C);const f=x.get(C);f&&(clearTimeout(f),x.delete(C)),c.value===C&&(c.value=null,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:null}}).catch(p=>{console.error("Failed to clear active conversation:",p)})),xt()}async function xn(C,P,M){const f=s.value.find(le=>le.id===C);if(!f)return{success:!1,error:"Conversation not found"};if(!f.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const p=M||f.baseBranch;try{const le=await $fetch("/api/chat/finalize",{method:"POST",body:{conversationId:C,commitMessage:P,baseBranch:p,worktreePath:f.worktreePath,worktreeBranch:f.worktreeBranch,previewBranch:f.previewBranch}});return le.success?(y.value===C&&(y.value=null),f.worktreePath=void 0,f.worktreeBranch=void 0,f.hasWorktree=!1,f.baseBranch=void 0,f.previewBranch=void 0,f.finalized=!0,f.updatedAt=new Date().toISOString(),xt()):le.rebaseInProgress&&le.conflictFiles?.length&&await nn(C,f.worktreePath,p||"main",P),le}catch(le){return{success:!1,error:le instanceof Error?le.message:String(le)}}}async function ut(C,P){const M=s.value.find(p=>p.id===C);if(!M)return{success:!1,error:"Conversation not found"};if(!M.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const f=P||M.baseBranch;try{const p=await $fetch("/api/chat/rebase",{method:"POST",body:{conversationId:C,baseBranch:f,worktreePath:M.worktreePath}});return p.rebaseInProgress&&p.conflictFiles?.length?await nn(C,M.worktreePath,f||"main","","sync"):p.success&&(await ee(M),M.baseBranch=f,xt()),p}catch(p){return{success:!1,error:p instanceof Error?p.message:String(p)}}}async function nn(C,P,M,f,p="finalize"){_.value={conversationId:C,worktreePath:P,baseBranch:M,commitMessage:f,files:[],resolvedFiles:new Set,loading:!0,error:null,mode:p};try{const le=await $fetch("/api/rebase/conflicts",{params:{worktreePath:P}});_.value&&(_.value.files=le.files,_.value.loading=!1)}catch(le){_.value&&(_.value.error=le instanceof Error?le.message:String(le),_.value.loading=!1)}}async function dt(C,P){if(!_.value)return!1;try{const M=await $fetch("/api/rebase/resolve",{method:"PUT",body:{worktreePath:_.value.worktreePath,filePath:C,content:P}});return M.success&&_.value&&_.value.resolvedFiles.add(C),M.success}catch{return!1}}async function Sn(){if(!_.value)return{success:!1,error:"No conflict resolution in progress"};const{conversationId:C,commitMessage:P,baseBranch:M,mode:f,worktreePath:p}=_.value,le=f==="sync"?"/api/rebase/continue-sync":"/api/rebase/continue";try{const ye=s.value.find(Ne=>Ne.id===C),Te=await $fetch(le,{method:"POST",body:{conversationId:C,commitMessage:P,baseBranch:M,worktreePath:p,worktreeBranch:ye?.worktreeBranch,previewBranch:ye?.previewBranch}});if(Te.success){if(f==="finalize"){y.value===C&&(y.value=null);const Ne=s.value.find(tt=>tt.id===C);Ne&&(Ne.worktreePath=void 0,Ne.worktreeBranch=void 0,Ne.hasWorktree=!1,Ne.baseBranch=void 0,Ne.previewBranch=void 0,Ne.finalized=!0,Ne.updatedAt=new Date().toISOString(),xt())}else if(f==="sync"){const Ne=s.value.find(tt=>tt.id===C);Ne&&(await ee(Ne),Ne.baseBranch=M,Ne.updatedAt=new Date().toISOString(),xt())}_.value=null}else Te.rebaseInProgress&&Te.conflictFiles?.length&&await nn(C,p,M,P,f);return Te}catch(ye){return{success:!1,error:ye instanceof Error?ye.message:String(ye)}}}async function we(){if(!_.value)return!1;try{const C=await $fetch("/api/rebase/abort",{method:"POST",body:{worktreePath:_.value.worktreePath}});return _.value=null,C.success}catch{return _.value=null,!1}}async function A(C){if(!_.value)return!1;const P=_.value.files.find(M=>M.path===C);if(!P)return!1;try{const M=await $fetch("/api/rebase/ai-resolve",{method:"POST",body:{worktreePath:_.value.worktreePath,filePath:C,conflictContent:P.content}});return M.success&&M.resolvedContent!==void 0?(P.content=M.resolvedContent,await dt(C,M.resolvedContent)):!1}catch{return!1}}async function ie(){if(!_.value)return;const C=_.value.files.filter(P=>!_.value.resolvedFiles.has(P.path));for(const P of C)await A(P.path)}async function xe(C){const P=s.value.find(M=>M.id===C);if(!P)return{success:!1,error:"Conversation not found"};if(!P.hasWorktree||!P.worktreePath||!P.baseBranch)return{success:!1,error:"No worktree to preview"};try{const M=await $fetch("/api/chat/preview",{method:"POST",body:{conversationId:C,worktreePath:P.worktreePath,baseBranch:P.baseBranch}});return M.success&&M.previewBranch&&(P.previewBranch=M.previewBranch,y.value=C,P.updatedAt=new Date().toISOString(),xt()),{success:M.success,error:M.error}}catch(M){return{success:!1,error:M instanceof Error?M.message:String(M)}}}async function Ge(C){const P=s.value.find(M=>M.id===C);if(!P)return{success:!1,error:"Conversation not found"};if(!P.previewBranch||!P.baseBranch)return y.value=null,{success:!1,error:"No active preview"};try{const M=await $fetch("/api/chat/preview",{method:"DELETE",body:{previewBranch:P.previewBranch,baseBranch:P.baseBranch}});return M.success&&(P.previewBranch=void 0,y.value=null,P.updatedAt=new Date().toISOString(),xt()),{success:M.success,error:M.error}}catch(M){return{success:!1,error:M instanceof Error?M.message:String(M)}}}async function Ve(C){if(y.value===C)return await Ge(C);if(y.value){const P=await Ge(y.value);if(!P.success)return{success:!1,error:`Failed to end previous preview: ${P.error}`}}return await xe(C)}function Ke(C){const P=C.trim();if(!P)return null;const M=s.value.filter(f=>f.featureId===P?!0:f.worktreeBranch?.trim()===P);return M.length===0?null:M.sort((f,p)=>new Date(p.updatedAt).getTime()-new Date(f.updatedAt).getTime())[0]||null}function ht(C){s.value.unshift(C),ot(),xt()}function rt(C,P){const M=s.value.find(f=>f.id===C);M&&(M.title=P.trim(),M.updatedAt=new Date().toISOString(),ot(),xt())}function Vt(C){const P=c.value;if(!P)return;const M=s.value.find(p=>p.id===P);if(!M||M.title!=="New Conversation")return;const f=M.messages.find(p=>p.role==="user");f&&(f.content.trim().length>0?M.title=zs(f.content):f.attachments&&f.attachments.length>0&&(M.title=f.attachments.length===1?"[Image] New Conversation":`[${f.attachments.length} Images] New Conversation`))}function ft(){const C=s.value.length;return{atLimit:C>=yo,nearLimit:C>=bo,count:C}}async function it(C,P){c.value||await at();const M=Mt(C,void 0,P);return Vt(),Ht(!0),M}function Wt(C,P,M){const f=M??c.value;fe(C,P,f??void 0),f&&ze(f,!1)}function Gt(C,P){const M=P??c.value;q(C,{status:"complete"},M??void 0),M&&ze(M,!0)}return{messages:V,session:E,isPanelOpen:e,panelWidth:Ce(n),permissionMode:Ce(t),pendingPermission:oe,pendingPlanApproval:ce,cwd:Ce(a),lastError:de,debugEvents:ge,debugStreamEnabled:Ce(S),providerSessionId:Z,conversations:Ce(s),archivedConversations:Ce(l),activeConversationId:Ce(c),conversationViewMode:Ce(d),conflictState:Ce(_),previewingConversationId:Ce(y),isStreaming:X,hasMessages:O,lastMessage:G,isActiveConversationStreaming:K,hasConversations:I,hasArchivedConversations:v,activeConversation:z,conversationCount:g,isNearStorageLimit:T,sortedConversations:U,sortedArchivedConversations:ae,previewingConversation:N,streamingConversations:Ce(h),initialize:se,togglePanel:Pe,openPanel:Fe,closePanel:qe,setPanelWidth:Je,setPermissionMode:Se,setPendingPermission:je,clearPendingPermission:pe,setPendingPlanApproval:ue,clearPendingPlanApproval:_e,setCwd:kt,setProviderSessionId:jt,clearProviderSession:St,getProviderSessionId:_t,updateWorktreeBranch:Qt,setConversationProviderSelection:Lt,startConversationStreaming:Nt,endConversationStreaming:gt,isConversationStreaming:H,addMessage:Ot,addUserMessage:Mt,addAssistantMessage:Ft,updateMessage:q,appendToMessage:fe,addToolToMessage:te,updateToolInMessage:me,initContentBlocks:Ee,appendContentBlock:Oe,appendContentBlockWithSave:en,updateBlockById:kn,updateBlockWithSave:Jt,findToolUseBlock:Cn,syncContentFromBlocks:be,setSessionStatus:Kt,startSession:mt,endSession:$n,setSessionError:He,setDebugStreamEnabled:lt,pushDebugEvent:zt,clearDebugEvents:gn,clearMessages:et,clearError:ln,loadConversations:ct,saveAllConversations:xt,saveCurrentConversation:Ht,saveConversation:ze,createConversation:at,selectConversation:cn,deleteConversation:Xe,archiveConversation:re,restoreArchivedConversation:J,deleteArchivedConversation:ne,setConversationViewMode:L,findConversationByFeature:Ke,syncConversationFeatureFromBranch:st,addAutoModeConversation:ht,renameConversation:rt,checkStorageLimits:ft,finalizeConversation:xn,rebaseConversation:ut,resolveConflictFile:dt,continueRebase:Sn,abortRebase:we,aiResolveConflictFile:A,aiResolveAllConflicts:ie,previewConversation:xe,unpreviewConversation:Ge,togglePreview:Ve,isConversationPreviewing:j,addUserMessageWithConversation:it,appendToMessageWithSave:Wt,completeMessageWithSave:Gt}});function Uu(e={}){const n=_r(),t=300,a=5e3,s=250;let l=null,c=null,d=null,h=null,m=null,S=!1,$=!1;const x=k(!1),b=k(!1);let y=e;function _(G){y=G}async function W(){const G=y.getScrollPosition?.()??0,H=await n.checkAndRefresh();return H&&y.setScrollPosition&&(await Yt(),y.setScrollPosition(G)),H}function B(){return x.value||!!n.activeContextMenu||!!n.activeDialog}async function z(){if(B()){b.value=!0;return}E()}async function V(){if(S){$=!0;return}S=!0;try{await W()}finally{S=!1,$&&($=!1,E())}}function E(){c&&clearTimeout(c),c=setTimeout(()=>{c=null,V()},s)}function oe(G){if(typeof window>"u")return;if(d&&d.readyState===WebSocket.OPEN){d.send(JSON.stringify({type:"watch",workingDirectory:G}));return}h&&(clearTimeout(h),h=null);const K=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/git-watcher-ws`;d=new WebSocket(K),d.onopen=()=>{d.send(JSON.stringify({type:"watch",workingDirectory:G}))},d.onmessage=I=>{try{JSON.parse(I.data).type==="git_changed"&&z()}catch{}},d.onclose=()=>{d=null,n.isPollingActive&&m&&(h=setTimeout(()=>{m&&oe(m)},a))},d.onerror=()=>{}}function ce(){h&&(clearTimeout(h),h=null),d&&(d.close(),d=null)}function de(G){G&&(m=G),!n.isPollingActive&&(n.startPolling(),m&&oe(m))}function ge(){ce(),n.stopPolling()}function X(){x.value=!0,l&&(clearTimeout(l),l=null)}function Z(){l&&clearTimeout(l),l=setTimeout(async()=>{x.value=!1,b.value&&(b.value=!1,E())},t)}function O(){ge(),l&&(clearTimeout(l),l=null),c&&(clearTimeout(c),c=null),S=!1,$=!1,m=null}return De(()=>[n.activeContextMenu,n.activeDialog],()=>{!n.activeContextMenu&&!n.activeDialog&&b.value&&!x.value&&(b.value=!1,E())}),{isUserInteracting:Ce(x),isDeferredRefresh:Ce(b),startPolling:de,stopPolling:ge,startInteraction:X,endInteraction:Z,cleanup:O,setScrollCallbacks:_}}function ju(e){function n(s){if((s.ctrlKey||s.metaKey)&&s.key==="h"){s.preventDefault(),e.onScrollToHead();return}if(s.key==="Escape"){s.preventDefault(),e.onEscape();return}}function t(){document.addEventListener("keydown",n)}function a(){document.removeEventListener("keydown",n)}return{start:t,stop:a}}const zu={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Vu={class:"text-sm font-mono text-retro-cyan"},Wu={class:"text-xs font-mono text-retro-text mt-1 truncate"},Gu={class:"space-y-3"},qu={class:"flex items-start gap-2 cursor-pointer group"},Ku={class:"flex items-start gap-2 cursor-pointer group"},Zu=Be({__name:"CherryPickDialog",props:{visible:{type:Boolean},commitHash:{},commitMessage:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=n,a=k(!1),s=k(!1);function l(){t("confirm",{recordOrigin:a.value,noCommit:s.value})}function c(){a.value=!1,s.value=!1,t("close")}return(d,h)=>(i(),he(It,{title:"Cherry-Pick Commit",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Cherry-Pick",onClose:c,onConfirm:l},{default:nt(()=>[r("div",zu,[h[2]||(h[2]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Commit",-1)),r("div",Vu,w(e.commitHash.slice(0,7)),1),r("div",Wu,w(e.commitMessage.split(`
|
|
66
|
+
`)[0]),1)]),r("div",Gu,[r("label",qu,[Le(r("input",{"onUpdate:modelValue":h[0]||(h[0]=m=>We(a)?a.value=m:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Ut,o(a)]]),h[3]||(h[3]=r("div",null,[r("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Record origin (-x) "),r("p",{class:"text-xs font-mono text-retro-muted mt-0.5"},' Append "(cherry picked from commit ...)" to the commit message ')],-1))]),r("label",Ku,[Le(r("input",{"onUpdate:modelValue":h[1]||(h[1]=m=>We(s)?s.value=m:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Ut,o(s)]]),h[4]||(h[4]=r("div",null,[r("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," No commit "),r("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Apply changes to the working directory without committing ")],-1))])])]),_:1},8,["visible","loading","error"]))}}),Yu={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Xu={class:"text-sm font-mono text-retro-cyan"},Qu={class:"mb-4"},Ju={class:"flex items-start gap-2 cursor-pointer group"},ed=Be({__name:"CreateBranchDialog",props:{visible:{type:Boolean},fromCommit:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=n,a=k(""),s=k(!0),l=R(()=>a.value.trim().length>0);function c(){l.value&&t("confirm",{name:a.value.trim(),checkout:s.value})}function d(){a.value="",s.value=!0,t("close")}return(h,m)=>(i(),he(It,{title:"Create Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Create Branch",onClose:d,onConfirm:c},{default:nt(()=>[r("div",Yu,[m[2]||(m[2]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"From",-1)),r("div",Xu,w(e.fromCommit.slice(0,7)),1)]),r("div",Qu,[m[3]||(m[3]=r("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Branch name",-1)),Le(r("input",{"onUpdate:modelValue":m[0]||(m[0]=S=>We(a)?a.value=S:null),type:"text",placeholder:"feature/my-branch",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan"},null,512),[[Ct,o(a)]])]),r("label",Ju,[Le(r("input",{"onUpdate:modelValue":m[1]||(m[1]=S=>We(s)?s.value=S:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Ut,o(s)]]),m[4]||(m[4]=r("div",null,[r("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Switch to new branch "),r("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Checkout the branch after creating it ")],-1))])]),_:1},8,["visible","loading","error"]))}}),td=Be({__name:"CleanUntrackedDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=n;return(a,s)=>(i(),he(It,{title:"Clean Untracked Files",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Clean","confirm-danger":"",onClose:s[0]||(s[0]=l=>t("close")),onConfirm:s[1]||(s[1]=l=>t("confirm"))},{default:nt(()=>[...s[2]||(s[2]=[r("div",{class:"space-y-3"},[r("p",{class:"text-retro-text text-sm font-mono"}," Remove all untracked files and directories from the working tree. "),r("p",{class:"text-retro-muted text-xs font-mono"},[Ae(" This runs "),r("code",null,"git clean -fd"),Ae(" and cannot be undone. ")])],-1)])]),_:1},8,["visible","loading","error"]))}}),nd={class:"text-retro-text text-sm font-mono mb-2"},rd={class:"text-retro-cyan"},od={class:"space-y-3 mt-4"},sd={class:"flex items-center gap-2 cursor-pointer"},ad=Be({__name:"DeleteBranchDialog",props:{visible:{type:Boolean},branchName:{},isLocal:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,s=k(!1);function l(){a("confirm",{force:s.value})}return De(()=>t.visible,c=>{c&&(s.value=!1)}),(c,d)=>(i(),he(It,{title:"Delete Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Delete","confirm-danger":!0,onClose:d[1]||(d[1]=h=>a("close")),onConfirm:l},{default:nt(()=>[d[4]||(d[4]=r("div",{class:"mb-4 p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"}," This action is permanent and cannot be undone. ",-1)),r("p",nd,[Ae(" Delete "+w(e.isLocal?"local":"remote")+" branch ",1),r("span",rd,w(e.branchName),1),d[2]||(d[2]=Ae("? ",-1))]),r("div",od,[r("label",sd,[Le(r("input",{"onUpdate:modelValue":d[0]||(d[0]=h=>We(s)?s.value=h:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ut,o(s)]]),d[3]||(d[3]=r("span",{class:"text-retro-muted text-sm"},"Force delete (even if not fully merged)",-1))])])]),_:1},8,["visible","loading","error"]))}}),id={class:"text-retro-text text-sm font-mono mb-4"},ld={class:"text-retro-cyan"},cd={class:"space-y-3"},ud={class:"flex items-center gap-2 cursor-pointer"},dd={class:"flex items-center gap-2 cursor-pointer"},fd={class:"flex items-center gap-2 cursor-pointer"},md=Be({__name:"MergeDialog",props:{visible:{type:Boolean},branchName:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,s=k(!1),l=k(!1),c=k(!1);function d(){a("confirm",{noCommit:s.value,noFastForward:l.value,squash:c.value})}return De(()=>t.visible,h=>{h&&(s.value=!1,l.value=!1,c.value=!1)}),(h,m)=>(i(),he(It,{title:"Merge Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Merge",onClose:m[3]||(m[3]=S=>a("close")),onConfirm:d},{default:nt(()=>[r("p",id,[m[4]||(m[4]=Ae(" Merge ",-1)),r("span",ld,w(e.branchName),1),m[5]||(m[5]=Ae(" into current branch ",-1))]),r("div",cd,[r("label",ud,[Le(r("input",{"onUpdate:modelValue":m[0]||(m[0]=S=>We(s)?s.value=S:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ut,o(s)]]),m[6]||(m[6]=r("span",{class:"text-retro-muted text-sm"},"No commit (stage changes only)",-1))]),r("label",dd,[Le(r("input",{"onUpdate:modelValue":m[1]||(m[1]=S=>We(l)?l.value=S:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ut,o(l)]]),m[7]||(m[7]=r("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),r("label",fd,[Le(r("input",{"onUpdate:modelValue":m[2]||(m[2]=S=>We(c)?c.value=S:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ut,o(c)]]),m[8]||(m[8]=r("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),hd={class:"text-retro-text text-sm font-mono mb-4"},pd={class:"text-retro-cyan"},vd={class:"space-y-3"},gd=["value"],xd={class:"flex items-center gap-2 cursor-pointer"},bd={class:"flex items-center gap-2 cursor-pointer"},yd=Be({__name:"PullDialog",props:{visible:{type:Boolean},branchName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,s=k("origin"),l=k(!1),c=k(!1);function d(){a("confirm",{remote:s.value,noFastForward:l.value,squash:c.value})}return De(()=>t.visible,h=>{h&&(s.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",l.value=!1,c.value=!1)}),(h,m)=>(i(),he(It,{title:"Pull Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Pull",onClose:m[3]||(m[3]=S=>a("close")),onConfirm:d},{default:nt(()=>[r("p",hd,[m[4]||(m[4]=Ae(" Pull ",-1)),r("span",pd,w(e.branchName),1),m[5]||(m[5]=Ae(" from remote ",-1))]),r("div",vd,[r("div",null,[m[6]||(m[6]=r("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),Le(r("select",{"onUpdate:modelValue":m[0]||(m[0]=S=>We(s)?s.value=S:null),class:"w-full bg-retro-panel border border-retro-border rounded text-retro-text text-sm px-2 py-1.5 font-mono focus:outline-none focus:border-retro-cyan"},[(i(!0),u(ve,null,Ie(e.remotes,S=>(i(),u("option",{key:S,value:S},w(S),9,gd))),128))],512),[[Bn,o(s)]])]),r("label",xd,[Le(r("input",{"onUpdate:modelValue":m[1]||(m[1]=S=>We(l)?l.value=S:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ut,o(l)]]),m[7]||(m[7]=r("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),r("label",bd,[Le(r("input",{"onUpdate:modelValue":m[2]||(m[2]=S=>We(c)?c.value=S:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ut,o(c)]]),m[8]||(m[8]=r("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),wd={class:"text-retro-text text-sm font-mono mb-4"},kd={class:"text-retro-cyan"},Cd={class:"space-y-3"},$d=["value"],Sd={class:"flex items-center gap-2 cursor-pointer"},_d=["checked"],Md={class:"flex items-center gap-2 cursor-pointer"},Td=["checked"],Ad={key:0,class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},Bd=Be({__name:"PushDialog",props:{visible:{type:Boolean},branchName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,s=k("origin"),l=k(!1),c=k(!1);function d(S){l.value=S,S&&(c.value=!1)}function h(S){c.value=S,S&&(l.value=!1)}function m(){a("confirm",{remote:s.value,force:l.value,forceWithLease:c.value})}return De(()=>t.visible,S=>{S&&(s.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",l.value=!1,c.value=!1)}),(S,$)=>(i(),he(It,{title:"Push Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Push",onClose:$[3]||($[3]=x=>a("close")),onConfirm:m},{default:nt(()=>[r("p",wd,[$[4]||($[4]=Ae(" Push ",-1)),r("span",kd,w(e.branchName),1),$[5]||($[5]=Ae(" to remote ",-1))]),r("div",Cd,[r("div",null,[$[6]||($[6]=r("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),Le(r("select",{"onUpdate:modelValue":$[0]||($[0]=x=>We(s)?s.value=x:null),class:"w-full bg-retro-panel border border-retro-border rounded text-retro-text text-sm px-2 py-1.5 font-mono focus:outline-none focus:border-retro-cyan"},[(i(!0),u(ve,null,Ie(e.remotes,x=>(i(),u("option",{key:x,value:x},w(x),9,$d))),128))],512),[[Bn,o(s)]])]),r("label",Sd,[r("input",{checked:o(l),type:"checkbox",class:"accent-retro-cyan",onChange:$[1]||($[1]=x=>d(x.target.checked))},null,40,_d),$[7]||($[7]=r("span",{class:"text-retro-muted text-sm"},"Force push",-1))]),r("label",Md,[r("input",{checked:o(c),type:"checkbox",class:"accent-retro-cyan",onChange:$[2]||($[2]=x=>h(x.target.checked))},null,40,Td),$[8]||($[8]=r("span",{class:"text-retro-muted text-sm"},"Force with lease (safer force push)",-1))]),o(l)||o(c)?(i(),u("div",Ad,w(o(l)?"Force push will overwrite remote history. Use with caution.":"Force with lease will reject the push if the remote has been updated since your last fetch."),1)):D("",!0)])]),_:1},8,["visible","loading","error"]))}}),Ed={class:"text-retro-text text-sm font-mono mb-4"},Rd={class:"text-retro-cyan"},Pd={class:"text-retro-cyan"},Dd={class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},Id={class:"text-retro-cyan"},Ld={class:"text-retro-cyan"},Nd=Be({__name:"RebaseDialog",props:{visible:{type:Boolean},branchName:{},ontoBranch:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=n;return(a,s)=>(i(),he(It,{title:"Rebase Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Rebase",onClose:s[0]||(s[0]=l=>t("close")),onConfirm:s[1]||(s[1]=l=>t("confirm"))},{default:nt(()=>[r("p",Ed,[s[2]||(s[2]=Ae(" Rebase ",-1)),r("span",Rd,w(e.branchName),1),s[3]||(s[3]=Ae(" onto ",-1)),r("span",Pd,w(e.ontoBranch),1)]),r("div",Dd,[s[4]||(s[4]=Ae(" This will rewrite commit history. Commits from ",-1)),r("span",Id,w(e.branchName),1),s[5]||(s[5]=Ae(" will be replayed on top of ",-1)),r("span",Ld,w(e.ontoBranch),1),s[6]||(s[6]=Ae(". ",-1))])]),_:1},8,["visible","loading","error"]))}}),Fd={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Hd={class:"text-sm font-mono text-retro-cyan"},Od={class:"text-xs font-mono text-retro-text mt-1 truncate"},Ud={class:"space-y-2"},jd=["value"],zd={key:0,class:"mt-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},Vd=Be({__name:"ResetDialog",props:{visible:{type:Boolean},commitHash:{},commitMessage:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=n,a=k("mixed"),s=[{value:"soft",label:"Soft",description:"Move HEAD, keep staged changes and working directory"},{value:"mixed",label:"Mixed",description:"Move HEAD, reset staging area, keep working directory"},{value:"hard",label:"Hard",description:"Move HEAD, reset staging area and working directory (DESTRUCTIVE)"}];function l(){t("confirm",{mode:a.value})}function c(){a.value="mixed",t("close")}return(d,h)=>(i(),he(It,{title:"Reset to Commit",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Reset","confirm-danger":o(a)==="hard",onClose:c,onConfirm:l},{default:nt(()=>[r("div",Fd,[h[1]||(h[1]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Reset to",-1)),r("div",Hd,w(e.commitHash.slice(0,7)),1),r("div",Od,w(e.commitMessage.split(`
|
|
67
|
+
`)[0]),1)]),r("div",Ud,[h[2]||(h[2]=r("div",{class:"text-xs font-mono text-retro-muted mb-2"},"Reset mode",-1)),(i(),u(ve,null,Ie(s,m=>r("label",{key:m.value,class:ke(["flex items-start gap-2 p-2 rounded cursor-pointer group border transition-colors",[o(a)===m.value?"border-retro-cyan bg-retro-cyan/5":"border-transparent hover:bg-retro-panel"]])},[Le(r("input",{"onUpdate:modelValue":h[0]||(h[0]=S=>We(a)?a.value=S:null),type:"radio",name:"reset-mode",value:m.value,class:"mt-0.5 accent-retro-cyan"},null,8,jd),[[Lr,o(a)]]),r("div",null,[r("span",{class:ke(["text-sm font-mono transition-colors",[m.value==="hard"?"text-retro-red":"text-retro-text",o(a)===m.value?"text-retro-cyan":""]])},w(m.label),3),r("p",{class:ke(["text-xs font-mono mt-0.5",m.value==="hard"?"text-retro-red/70":"text-retro-muted"])},w(m.description),3)])],2)),64))]),o(a)==="hard"?(i(),u("div",zd," Warning: Hard reset will permanently discard all uncommitted changes in your working directory and staging area. This action cannot be undone. ")):D("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),Wd={class:"space-y-3"},Gd={class:"flex items-start gap-2 cursor-pointer"},qd={class:"flex items-start gap-2 cursor-pointer"},Kd={key:0,class:"mt-4 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},Zd=Be({__name:"ResetWorkingDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,s=k("mixed"),l=R(()=>s.value==="hard");function c(){a("confirm",{mode:s.value})}return De(()=>t.visible,d=>{d&&(s.value="mixed")}),(d,h)=>(i(),he(It,{title:"Reset Working Directory",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Reset","confirm-danger":o(l),onClose:h[2]||(h[2]=m=>a("close")),onConfirm:c},{default:nt(()=>[h[5]||(h[5]=r("p",{class:"text-retro-text text-sm font-mono mb-4"}," Reset the working directory to HEAD. ",-1)),r("div",Wd,[r("label",Gd,[Le(r("input",{"onUpdate:modelValue":h[0]||(h[0]=m=>We(s)?s.value=m:null),type:"radio",value:"mixed",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[Lr,o(s)]]),h[3]||(h[3]=r("div",null,[r("span",{class:"text-retro-text text-sm font-mono"},"Mixed"),r("p",{class:"text-retro-muted text-xs font-mono mt-0.5"}," Reset staging area, keep working directory ")],-1))]),r("label",qd,[Le(r("input",{"onUpdate:modelValue":h[1]||(h[1]=m=>We(s)?s.value=m:null),type:"radio",value:"hard",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[Lr,o(s)]]),h[4]||(h[4]=r("div",null,[r("span",{class:"text-retro-text text-sm font-mono"},"Hard"),r("p",{class:"text-retro-muted text-xs font-mono mt-0.5"}," Reset staging area AND working directory (DESTRUCTIVE) ")],-1))])]),o(l)?(i(),u("div",Kd," WARNING: Hard reset will permanently discard all uncommitted changes. This cannot be undone. ")):D("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),Yd={class:"space-y-4"},Xd={class:"flex items-center gap-2 cursor-pointer"},Qd=Be({__name:"StashDialog",props:{visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,s=k(""),l=k(!1);function c(){a("confirm",{message:s.value.trim()||void 0,includeUntracked:l.value})}return De(()=>t.visible,d=>{d&&(s.value="",l.value=!1)}),(d,h)=>(i(),he(It,{title:"Stash Changes",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Stash",onClose:h[2]||(h[2]=m=>a("close")),onConfirm:c},{default:nt(()=>[h[5]||(h[5]=r("p",{class:"text-retro-text text-sm font-mono mb-4"}," Save uncommitted changes to the stash. ",-1)),r("div",Yd,[r("div",null,[h[3]||(h[3]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message (optional)",-1)),Le(r("input",{"onUpdate:modelValue":h[0]||(h[0]=m=>We(s)?s.value=m:null),type:"text",placeholder:"Stash description...",class:"w-full px-2 py-1.5 text-sm font-mono bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted/50 focus:outline-none focus:border-retro-cyan"},null,512),[[Ct,o(s)]])]),r("label",Xd,[Le(r("input",{"onUpdate:modelValue":h[1]||(h[1]=m=>We(l)?l.value=m:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ut,o(l)]]),h[4]||(h[4]=r("span",{class:"text-retro-muted text-sm"},"Include untracked files",-1))])])]),_:1},8,["visible","loading","error"]))}}),Jd={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},ef={class:"text-sm font-mono text-retro-cyan"},tf={class:"mb-4"},nf={class:"mb-3"},rf={class:"flex items-start gap-2 cursor-pointer group"},of={key:0,class:"mb-4"},sf={class:"space-y-2"},af={class:"flex items-start gap-2 cursor-pointer group"},lf=["disabled"],cf={key:0,class:"ml-6"},uf=["value"],df=Be({__name:"TagCreateDialog",props:{visible:{type:Boolean},commitHash:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=n,a=k(""),s=k(!1),l=k(""),c=k(!1),d=k(""),h=R(()=>a.value.trim().length>0);function m(){if(!h.value)return;const $={name:a.value.trim(),annotated:s.value};s.value&&l.value.trim()&&($.message=l.value.trim()),c.value&&d.value&&($.pushToRemote=d.value),t("confirm",$)}function S(){a.value="",s.value=!1,l.value="",c.value=!1,d.value="",t("close")}return De(()=>s.value,$=>{$||(l.value="")}),($,x)=>(i(),he(It,{title:"Create Tag",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Create Tag",onClose:S,onConfirm:m},{default:nt(()=>[r("div",Jd,[x[5]||(x[5]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"At commit",-1)),r("div",ef,w(e.commitHash.slice(0,7)),1)]),r("div",tf,[x[6]||(x[6]=r("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag name",-1)),Le(r("input",{"onUpdate:modelValue":x[0]||(x[0]=b=>We(a)?a.value=b:null),type:"text",placeholder:"v1.0.0",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan"},null,512),[[Ct,o(a)]])]),r("div",nf,[r("label",rf,[Le(r("input",{"onUpdate:modelValue":x[1]||(x[1]=b=>We(s)?s.value=b:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Ut,o(s)]]),x[7]||(x[7]=r("div",null,[r("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," Annotated tag "),r("p",{class:"text-xs font-mono text-retro-muted mt-0.5"}," Create a full tag object with message and tagger info ")],-1))])]),o(s)?(i(),u("div",of,[x[8]||(x[8]=r("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag message",-1)),Le(r("textarea",{"onUpdate:modelValue":x[2]||(x[2]=b=>We(l)?l.value=b:null),rows:"3",placeholder:"Release description...",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan resize-none"},null,512),[[Ct,o(l)]])])):D("",!0),r("div",sf,[r("label",af,[Le(r("input",{"onUpdate:modelValue":x[3]||(x[3]=b=>We(c)?c.value=b:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan",disabled:e.remotes.length===0},null,8,lf),[[Ut,o(c)]]),r("div",null,[r("span",{class:ke(["text-sm font-mono transition-colors",e.remotes.length===0?"text-retro-muted":"text-retro-text group-hover:text-retro-cyan"])}," Push to remote ",2)])]),o(c)&&e.remotes.length>0?(i(),u("div",cf,[Le(r("select",{"onUpdate:modelValue":x[4]||(x[4]=b=>We(d)?d.value=b:null),class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text focus:outline-none focus:border-retro-cyan"},[x[9]||(x[9]=r("option",{value:"",disabled:"",class:"text-retro-muted"},"Select remote",-1)),(i(!0),u(ve,null,Ie(e.remotes,b=>(i(),u("option",{key:b,value:b},w(b),9,uf))),128))],512),[[Bn,o(d)]])])):D("",!0)])]),_:1},8,["visible","loading","error"]))}}),ff={class:"text-retro-text text-sm font-mono mb-2"},mf={class:"text-retro-cyan"},hf={class:"space-y-3 mt-4"},pf={class:"flex items-center gap-2 cursor-pointer"},vf={key:0,class:"ml-6"},gf=["value"],xf=Be({__name:"TagDeleteDialog",props:{visible:{type:Boolean},tagName:{},remotes:{},loading:{type:Boolean,default:!1},error:{default:null}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n,s=k(!1),l=k("origin");function c(){a("confirm",{deleteFromRemote:s.value,remote:s.value?l.value:void 0})}return De(()=>t.visible,d=>{d&&(s.value=!1,l.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin")}),(d,h)=>(i(),he(It,{title:"Delete Tag",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Delete","confirm-danger":!0,onClose:h[2]||(h[2]=m=>a("close")),onConfirm:c},{default:nt(()=>[h[7]||(h[7]=r("div",{class:"mb-4 p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"}," This action is permanent and cannot be undone. ",-1)),r("p",ff,[h[3]||(h[3]=Ae(" Delete tag ",-1)),r("span",mf,w(e.tagName),1),h[4]||(h[4]=Ae("? ",-1))]),r("div",hf,[r("label",pf,[Le(r("input",{"onUpdate:modelValue":h[0]||(h[0]=m=>We(s)?s.value=m:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Ut,o(s)]]),h[5]||(h[5]=r("span",{class:"text-retro-muted text-sm"},"Also delete from remote",-1))]),o(s)?(i(),u("div",vf,[h[6]||(h[6]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Remote",-1)),Le(r("select",{"onUpdate:modelValue":h[1]||(h[1]=m=>We(l)?l.value=m:null),class:"w-full px-2 py-1.5 text-sm font-mono bg-retro-panel border border-retro-border rounded text-retro-text focus:outline-none focus:border-retro-cyan"},[(i(!0),u(ve,null,Ie(e.remotes,m=>(i(),u("option",{key:m,value:m},w(m),9,gf))),128))],512),[[Bn,o(l)]])])):D("",!0)])]),_:1},8,["visible","loading","error"]))}}),bf={class:"mb-4"},yf={class:"text-retro-cyan text-sm font-mono"},wf={class:"mb-4"},kf={class:"text-retro-text text-sm font-mono"},Cf={class:"mb-4"},$f={class:"text-retro-text text-sm font-mono break-all select-all"},Sf={class:"mb-4"},_f={class:"text-retro-text text-sm font-mono"},Mf={class:"text-retro-muted"},Tf={class:"mb-4"},Af={class:"text-retro-text text-sm font-mono"},Bf={key:1,class:"mb-2"},Ef={class:"p-2 text-sm font-mono text-retro-text bg-retro-panel border border-retro-border rounded whitespace-pre-wrap"},Rf={key:1,class:"text-retro-muted text-sm font-mono text-center py-4"},Pf=Be({__name:"TagDetailDialog",props:{visible:{type:Boolean},tagName:{},tagDetail:{},loading:{type:Boolean,default:!1}},emits:["close"],setup(e,{emit:n}){const t=n;return(a,s)=>(i(),he(It,{title:"Tag Details",visible:e.visible,loading:e.loading,"confirm-label":"Close","cancel-label":"Close",onClose:s[0]||(s[0]=l=>t("close")),onConfirm:s[1]||(s[1]=l=>t("close"))},{default:nt(()=>[r("div",bf,[s[2]||(s[2]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tag",-1)),r("p",yf,w(e.tagName),1)]),e.tagDetail?(i(),u(ve,{key:0},[r("div",wf,[s[3]||(s[3]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Type",-1)),r("p",kf,w(e.tagDetail.isAnnotated?"Annotated":"Lightweight"),1)]),r("div",Cf,[s[4]||(s[4]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Hash",-1)),r("p",$f,w(e.tagDetail.hash),1)]),e.tagDetail.tagger?(i(),u(ve,{key:0},[r("div",Sf,[s[5]||(s[5]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tagger",-1)),r("p",_f,[Ae(w(e.tagDetail.tagger.name)+" ",1),r("span",Mf,"<"+w(e.tagDetail.tagger.email)+">",1)])]),r("div",Tf,[s[6]||(s[6]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Date",-1)),r("p",Af,w(e.tagDetail.tagger.date),1)])],64)):D("",!0),e.tagDetail.message?(i(),u("div",Bf,[s[7]||(s[7]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message",-1)),r("div",Ef,w(e.tagDetail.message),1)])):D("",!0)],64)):e.loading?(i(),u("div",Rf," Loading tag details... ")):D("",!0)]),_:1},8,["visible","loading"]))}}),ho=globalThis.setInterval,Df={class:"h-full flex flex-col bg-retro-dark",role:"region","aria-label":"Git Graph"},If={key:0,class:"flex-1 flex flex-col items-center justify-center gap-3"},Lf={key:1,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},Nf={key:2,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},Ff={class:"text-retro-red text-sm mb-4"},Hf={key:3,class:"flex-1 flex items-center justify-center p-4"},Of={class:"flex-shrink-0 flex items-center gap-2 p-2 border-b border-retro-border"},Uf={class:"relative"},jf={key:0,class:"absolute left-0 top-full mt-1 z-10 bg-retro-panel border border-retro-border rounded shadow-lg py-2 min-w-[200px]"},zf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Vf=["checked"],Wf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Gf=["checked"],qf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Kf=["checked"],Zf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Yf=["checked"],Xf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Qf=["checked"],Jf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},em=["checked"],tm={class:"relative"},nm=["aria-expanded"],rm={key:0,class:"text-xs"},om={key:0,class:"absolute right-0 top-full mt-1 z-10 bg-retro-panel border border-retro-border rounded shadow-lg py-1 min-w-[220px] max-h-[400px] overflow-auto"},sm=["checked","onChange"],am={class:"text-sm text-retro-text truncate"},im={key:0,class:"text-[10px] text-retro-cyan"},lm={class:"px-3 py-1 text-[10px] text-retro-orange font-semibold uppercase tracking-wider mt-1"},cm=["checked","onChange"],um={class:"text-sm text-retro-text truncate"},dm={class:"relative"},fm={key:0,class:"absolute right-0 top-full mt-1 z-20"},mm=["title"],hm={class:"text-retro-muted text-sm"},pm={class:"text-retro-cyan font-mono"},vm={class:"space-y-3"},gm={class:"text-retro-muted text-sm"},xm={class:"text-retro-cyan font-mono"},bm={class:"space-y-3"},ym={class:"text-retro-muted text-sm"},wm={class:"text-retro-magenta font-mono"},km={key:0,class:"fixed bottom-4 right-4 z-50 flex items-center gap-2 px-4 py-2.5 text-sm bg-retro-red/90 text-white rounded-lg shadow-lg max-w-sm",role:"alert"},Cm={class:"flex-1"},$m=Be({__name:"GitGraph",props:{workingDirectory:{},isActive:{type:Boolean,default:!0}},setup(e){const n=e,t=_r(),a=At(),s=Uu(),l=R(()=>{const f=a.activeConversation?.worktreeBranch;return f?[f]:[]}),c=R(()=>{const f=[],p=t.selectedFeatureId;p&&f.push(p);const le=t.conversationBranch;return le&&!f.includes(le)&&f.push(le),f});De(()=>[a.activeConversation?.worktreeBranch,a.activeConversation?.baseBranch],([f,p])=>{t.setConversationBranch(f??null,p??null)},{immediate:!0});const d=R(()=>{const f=t.previewBranch;return f?[f]:[]});De(()=>[a.previewingConversation?.worktreeBranch,a.previewingConversation?.baseBranch],([f,p])=>{t.setPreviewBranch(f??null,p??null)},{immediate:!0});const h=R(()=>{const f={};return t.previewBranch&&t.previewMergeBase&&(f[t.previewBranch]=t.previewMergeBase),f}),m=R(()=>{const f={};return t.selectedFeatureId&&t.featureMergeBase&&(f[t.selectedFeatureId]=t.featureMergeBase),t.conversationBranch&&t.conversationMergeBase&&(f[t.conversationBranch]=t.conversationMergeBase),f}),S=R(()=>t.remotes.map(f=>f.name)),$=k(null);De(()=>n.workingDirectory,async f=>{if(f){await t.loadGitGraph(f);const p=a.previewingConversation?.worktreeBranch;p&&await t.setPreviewBranch(p,a.previewingConversation?.baseBranch??null);const le=a.activeConversation?.worktreeBranch;le&&await t.setConversationBranch(le,a.activeConversation?.baseBranch??null)}},{immediate:!0}),De(()=>n.isActive,f=>{f&&t.commits.length>0&&!t.error?s.startPolling(n.workingDirectory):s.stopPolling()},{immediate:!0}),De(()=>t.commits.length,f=>{f>0&&n.isActive&&!t.error&&s.startPolling(n.workingDirectory)}),De(()=>$.value,f=>{f&&s.setScrollCallbacks({getScrollPosition:()=>f.getScrollPosition(),setScrollPosition:p=>f.setScrollPosition(p)})}),wt(()=>{s.cleanup(),t.reset()});const x=R(()=>t.error?.includes("Not a Git repository")),b=k(Date.now());let y=null;const _=()=>{y||(y=ho(()=>{b.value=Date.now()},5e3))},W=()=>{y&&(clearInterval(y),y=null)};vt(()=>{De(()=>n.isActive,f=>{f?(b.value=Date.now(),_()):W()},{immediate:!0})}),wt(()=>{W()});const B=R(()=>{const f=t.lastRefreshTime;if(!f)return null;const p=Math.floor((b.value-f)/1e3);return t.isRefreshing?"Syncing...":p<5?"Just now":p<60?`${p}s ago`:`${Math.floor(p/60)}m ago`}),z=k(!1),V=k(!1),E=k(null);function oe(){z.value=!0,Yt(()=>E.value?.focus())}function ce(){z.value=!1,t.setSearchQuery("")}function de(f){t.setSearchQuery(f)}const ge=ju({onScrollToHead:()=>{const f=t.commits.find(p=>p.isHead);f&&t.selectCommit(f)},onEscape:()=>{X.value?X.value=!1:V.value?V.value=!1:Z.value?Z.value=!1:z.value?ce():t.isComparing?t.clearComparison():(t.selectedCommit||t.isUncommittedChangesSelected)&&t.clearSelection()}});vt(()=>{ge.start()}),wt(()=>{ge.stop()});const X=k(!1),Z=k(!1);async function O(){await t.fetchAll(!0)}async function G(f){await t.addRemote(f.name,f.url)}async function H(f){await t.editRemote(f.name,f.newUrl)}async function K(f){await t.deleteRemote(f)}const I=R(()=>{const f=[],p={};for(const le of t.branches)if(t.localBranchNames.has(le.name))f.push(le);else{const ye=le.name.indexOf("/");if(ye>0){const Te=le.name.substring(0,ye);p[Te]||(p[Te]=[]),p[Te].push(le)}else f.push(le)}return{local:f,remotes:p}}),v=k({visible:!1,branch:"",x:0,y:0,isCurrentBranch:!1,isLocal:!0,commitHash:""});function g(f){v.value={visible:!0,...f},t.setActiveContextMenu({type:"branch",props:f,position:{x:f.x,y:f.y}})}function T(){v.value.visible=!1,t.clearActiveContextMenu()}function U(){T(),mt.value={visible:!0,branchName:v.value.branch,loading:!1,error:null}}function ae(){const f=v.value.branch;T(),et.value={visible:!0,branchName:f,newName:f,loading:!1,error:null}}function N(){const{branch:f,isLocal:p}=v.value;T(),lt.value={visible:!0,branchName:f,isLocal:p,force:!1,loading:!1,error:null}}function j(){const f=v.value.branch;T(),ct.value={visible:!0,branchName:f,loading:!1,error:null}}function L(){const f=v.value.branch;T(),ze.value={visible:!0,branchName:f,loading:!1,error:null}}function ee(){const f=v.value.branch;T(),ot.value={visible:!0,branchName:f,loading:!1,error:null}}function re(){const f=v.value.branch;T(),at.value={visible:!0,branchName:f,loading:!1,error:null}}async function J(){const f=v.value.branch;T(),await t.fetchBranch(f)}async function ne(){const f=v.value.branch;T(),await t.copyToClipboard(f),Gt(v.value.x,v.value.y)}function se(){T(),He.value={visible:!0,fromCommit:v.value.commitHash,loading:!1,error:null}}const Se=k({visible:!1,commit:null,x:0,y:0});function je(f){Se.value={visible:!0,commit:f.commit,x:f.x,y:f.y},t.setActiveContextMenu({type:"commit",props:f,position:{x:f.x,y:f.y}})}function pe(){Se.value.visible=!1,t.clearActiveContextMenu()}function ue(f){const p=Se.value.commit;if(!p)return!1;pe();const le=f(p);return le&&typeof le.then=="function"?le.then(()=>!0):!0}function _e(){ue(f=>{dt.value={visible:!0,commitHash:f.hash,loading:!1,error:null}})}function Pe(){ue(f=>{He.value={visible:!0,fromCommit:f.hash,loading:!1,error:null}})}function Fe(){ue(f=>{mt.value={visible:!0,branchName:f.hash,loading:!1,error:null}})}function qe(){ue(f=>{Xe.value={visible:!0,commitHash:f.hash,commitMessage:f.message,loading:!1,error:null}})}async function Qe(){await ue(f=>t.revertCommit(f.hash))}function Je(){ue(f=>{ct.value={visible:!0,branchName:f.shortHash,loading:!1,error:null}})}function kt(){ue(f=>{ut.value={visible:!0,commitHash:f.hash,commitMessage:f.message,loading:!1,error:null}})}async function jt(){const{x:f,y:p}=Se.value;await ue(ye=>t.copyToClipboard(ye.hash))&&Gt(f,p)}async function Qt(){await ue(f=>t.copyCommitSubject(f))}const st=k({visible:!1,tag:"",x:0,y:0,commitHash:""});function Lt(f){st.value={visible:!0,...f},t.setActiveContextMenu({type:"tag",props:f,position:{x:f.x,y:f.y}})}function St(){st.value.visible=!1,t.clearActiveContextMenu()}async function _t(){const f=st.value.tag;St(),ie.value={visible:!0,tagName:f,loading:!0,tagDetail:null};const p=await t.getTagDetail(f);ie.value.loading=!1,p.success&&p.data&&(ie.value.tagDetail=p.data)}function Nt(){const f=st.value.tag;St(),we.value={visible:!0,tagName:f,loading:!1,error:null}}async function gt(){const f=st.value.tag;St(),await t.pushTag(f)}async function Ot(){const f=st.value.tag;St(),await t.copyToClipboard(f),Gt(st.value.x,st.value.y)}const Mt=k({visible:!1,x:0,y:0});function Ft(){Mt.value.visible=!1,t.clearActiveContextMenu()}function q(){Ft(),xe.value={visible:!0,loading:!1,error:null}}function fe(){Ft(),rt.value={visible:!0,loading:!1,error:null}}async function te(){Ft(),ft.value={visible:!0,loading:!1,error:null}}const me=k({visible:!1,stash:null,x:0,y:0});function be(f){me.value={visible:!0,stash:f.stash,x:f.x,y:f.y},t.setActiveContextMenu({type:"stash",props:f,position:{x:f.x,y:f.y}})}function Me(){me.value.visible=!1,t.clearActiveContextMenu()}function Ee(f){const p=me.value.stash;if(!p)return!1;Me();const le=f(p);return le&&typeof le.then=="function"?le.then(()=>!0):!0}async function Oe(){await Ee(f=>t.applyStash(f.index))}async function kn(){await Ee(f=>t.popStash(f.index))}async function Jt(){await Ee(f=>t.dropStash(f.index))}function en(){Ee(f=>{Ve.value={visible:!0,stashIndex:f.index,loading:!1,error:null}})}async function Cn(){const{x:f,y:p}=me.value;await Ee(ye=>t.copyToClipboard(`stash@{${ye.index}}`))&&Gt(f,p)}async function Kt(){const{x:f,y:p}=me.value;await Ee(ye=>t.copyToClipboard(ye.hash))&&Gt(f,p)}const mt=k({visible:!1,branchName:"",loading:!1,error:null});async function $n(){mt.value.loading=!0,mt.value.error=null;const f=await t.checkoutBranch(mt.value.branchName);mt.value.loading=!1,f.success?mt.value.visible=!1:mt.value.error=f.error||"Unknown error"}const He=k({visible:!1,fromCommit:"",loading:!1,error:null});async function zt(f){He.value.loading=!0,He.value.error=null;const p=await t.createBranch(f.name,He.value.fromCommit);He.value.loading=!1,p.success?(f.checkout&&await t.checkoutBranch(f.name),He.value.visible=!1):He.value.error=p.error||"Unknown error"}const lt=k({visible:!1,branchName:"",isLocal:!0,force:!1,loading:!1,error:null});async function gn(f){lt.value.loading=!0,lt.value.error=null;const{branchName:p,isLocal:le}=lt.value,ye=f?.force??lt.value.force,Te=le?await t.deleteLocalBranch(p,ye):await t.deleteRemoteBranch(p);lt.value.loading=!1,Te.success?lt.value.visible=!1:lt.value.error=Te.error||"Unknown error"}const et=k({visible:!1,branchName:"",newName:"",loading:!1,error:null});async function ln(){if(!et.value.newName.trim()){et.value.error="Branch name is required";return}et.value.loading=!0,et.value.error=null;const f=await t.renameBranch(et.value.branchName,et.value.newName.trim());et.value.loading=!1,f.success?et.value.visible=!1:et.value.error=f.error||"Unknown error"}const ct=k({visible:!1,branchName:"",loading:!1,error:null});async function xt(f){ct.value.loading=!0,ct.value.error=null;const p=await t.mergeBranch(ct.value.branchName,f);ct.value.loading=!1,p.success?ct.value.visible=!1:ct.value.error=p.error||"Unknown error"}const ze=k({visible:!1,branchName:"",loading:!1,error:null});async function Ht(){ze.value.loading=!0,ze.value.error=null;const f=await t.rebaseBranch(ze.value.branchName);ze.value.loading=!1,f.success?ze.value.visible=!1:ze.value.error=f.error||"Unknown error"}const ot=k({visible:!1,branchName:"",loading:!1,error:null});async function tn(f){ot.value.loading=!0,ot.value.error=null;const p=await t.pushBranch(ot.value.branchName,f.remote,f.force,f.forceWithLease);ot.value.loading=!1,p.success?ot.value.visible=!1:ot.value.error=p.error||"Unknown error"}const at=k({visible:!1,branchName:"",loading:!1,error:null});async function cn(f){at.value.loading=!0,at.value.error=null;const p=await t.pullBranch(at.value.branchName,f.remote,f.noFastForward,f.squash);at.value.loading=!1,p.success?at.value.visible=!1:at.value.error=p.error||"Unknown error"}const Xe=k({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function xn(f){Xe.value.loading=!0,Xe.value.error=null;const p=await t.cherryPickCommit(Xe.value.commitHash,f.recordOrigin,f.noCommit);Xe.value.loading=!1,p.success?Xe.value.visible=!1:Xe.value.error=p.error||"Unknown error"}const ut=k({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function nn(f){ut.value.loading=!0,ut.value.error=null;const p=await t.resetToCommit(ut.value.commitHash,f.mode);ut.value.loading=!1,p.success?ut.value.visible=!1:ut.value.error=p.error||"Unknown error"}const dt=k({visible:!1,commitHash:"",loading:!1,error:null});async function Sn(f){dt.value.loading=!0,dt.value.error=null;const p=await t.createTag(f.name,dt.value.commitHash,f.annotated,f.message,f.pushToRemote);dt.value.loading=!1,p.success?dt.value.visible=!1:dt.value.error=p.error||"Unknown error"}const we=k({visible:!1,tagName:"",loading:!1,error:null});async function A(f){we.value.loading=!0,we.value.error=null;const p=await t.deleteTag(we.value.tagName,f.deleteFromRemote?f.remote||"origin":void 0);we.value.loading=!1,p.success?we.value.visible=!1:we.value.error=p.error||"Unknown error"}const ie=k({visible:!1,tagName:"",loading:!1,tagDetail:null}),xe=k({visible:!1,loading:!1,error:null});async function Ge(f){xe.value.loading=!0,xe.value.error=null;const p=await t.stashChanges(f.message,f.includeUntracked);xe.value.loading=!1,p.success?xe.value.visible=!1:xe.value.error=p.error||"Unknown error"}const Ve=k({visible:!1,stashIndex:0,loading:!1,error:null}),Ke=k("");async function ht(f){Ve.value.loading=!0,Ve.value.error=null;const p=await t.stashBranch(Ve.value.stashIndex,f);Ve.value.loading=!1,p.success?Ve.value.visible=!1:Ve.value.error=p.error||"Unknown error"}const rt=k({visible:!1,loading:!1,error:null});async function Vt(f){rt.value.loading=!0,rt.value.error=null;const p=await t.resetWorking(f.mode);rt.value.loading=!1,p.success?rt.value.visible=!1:rt.value.error=p.error||"Unknown error"}const ft=k({visible:!1,loading:!1,error:null});async function it(){ft.value.loading=!0,ft.value.error=null;const f=await t.cleanUntracked();ft.value.loading=!1,f.success?ft.value.visible=!1:ft.value.error=f.error||"Unknown error"}const Wt=k({visible:!1,x:0,y:0});function Gt(f,p){Wt.value={visible:!0,x:f,y:p},setTimeout(()=>{Wt.value.visible=!1},1500)}const C=R(()=>mt.value.visible||He.value.visible||lt.value.visible||et.value.visible||ct.value.visible||ze.value.visible||ot.value.visible||at.value.visible||Xe.value.visible||ut.value.visible||dt.value.visible||we.value.visible||ie.value.visible||xe.value.visible||Ve.value.visible||rt.value.visible||ft.value.visible);De(C,f=>{f?t.setActiveDialog({type:"generic",props:{}}):t.clearActiveDialog()});function P(f){t.selectedCommit?t.selectComparisonCommit(f):t.selectCommit(f)}function M(f){t.navigateToCommit(f)}return(f,p)=>{const le=Ca,ye=Fa,Te=ui,Ne=Bi,tt=Yc,bt=bu,tr=Su,un=_u,Tr=Mu,nr=Tu,jn=Au,zn=It;return i(),u("div",Df,[o(t).loading&&o(t).commits.length===0?(i(),u("div",If,[...p[42]||(p[42]=[r("div",{class:"w-6 h-6 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),r("div",{class:"text-retro-muted text-sm"},"Loading git history...",-1)])])):o(x)?(i(),u("div",Lf,[Y(o(wn),{class:"w-12 h-12 text-retro-yellow mb-4"}),p[43]||(p[43]=r("h3",{class:"text-retro-text font-semibold mb-2"},"Not a Git Repository",-1)),p[44]||(p[44]=r("p",{class:"text-retro-muted text-sm max-w-xs"},[Ae(" This directory is not initialized as a Git repository. Run "),r("code",{class:"text-retro-cyan"},"git init"),Ae(" to get started. ")],-1))])):o(t).error?(i(),u("div",Nf,[Y(o(wn),{class:"w-10 h-10 text-retro-red mb-3"}),r("p",Ff,w(o(t).error),1),r("button",{class:"flex items-center gap-2 px-3 py-1.5 text-sm text-retro-text border border-retro-border rounded hover:border-retro-cyan hover:text-retro-cyan transition-colors",onClick:p[0]||(p[0]=Re=>o(t).loadGitGraph(n.workingDirectory))},[Y(o(Tn),{class:"w-4 h-4"}),p[45]||(p[45]=Ae(" Retry ",-1))])])):o(t).commits.length===0?(i(),u("div",Hf,[...p[46]||(p[46]=[r("div",{class:"text-retro-muted text-center"},[r("p",null,"No commits found in this repository.")],-1)])])):(i(),u(ve,{key:4},[o(z)?(i(),he(le,{key:0,ref_key:"findWidgetRef",ref:E,resultCount:o(t).searchResultHashes.length,currentIndex:o(t).searchResultIndex,onSearch:de,onNext:o(t).nextSearchResult,onPrev:o(t).prevSearchResult,onClose:ce},null,8,["resultCount","currentIndex","onNext","onPrev"])):D("",!0),r("div",Of,[r("button",{class:ke(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",o(z)?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Find",title:"Find",onClick:p[1]||(p[1]=Re=>o(z)?ce():oe())},[Y(o(Mn),{class:"w-4 h-4"})],2),r("div",Uf,[r("button",{class:ke(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",o(X)?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Graph settings",title:"Settings",onClick:p[2]||(p[2]=Re=>X.value=!o(X))},[Y(o(Gs),{class:"w-4 h-4"})],2),o(X)?(i(),u("div",jf,[p[53]||(p[53]=r("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mb-1"}," Graph Style ",-1)),r("label",zf,[r("input",{type:"radio",name:"graphStyle",value:"rounded",checked:o(t).graphStyle==="rounded",class:"accent-retro-cyan",onChange:p[3]||(p[3]=Re=>o(t).setGraphStyle("rounded"))},null,40,Vf),p[47]||(p[47]=r("span",{class:"text-sm text-retro-text"},"Rounded",-1))]),r("label",Wf,[r("input",{type:"radio",name:"graphStyle",value:"angular",checked:o(t).graphStyle==="angular",class:"accent-retro-cyan",onChange:p[4]||(p[4]=Re=>o(t).setGraphStyle("angular"))},null,40,Gf),p[48]||(p[48]=r("span",{class:"text-sm text-retro-text"},"Angular",-1))]),p[54]||(p[54]=r("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mt-2 mb-1"}," Display ",-1)),r("label",qf,[r("input",{type:"checkbox",checked:o(t).muteNonAncestral,class:"accent-retro-cyan",onChange:p[5]||(p[5]=Re=>o(t).toggleMuteNonAncestral())},null,40,Kf),p[49]||(p[49]=r("span",{class:"text-sm text-retro-text"},"Mute non-ancestral",-1))]),p[55]||(p[55]=r("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border mt-2 mb-1"}," Columns ",-1)),r("label",Zf,[r("input",{type:"checkbox",checked:o(t).columnVisibility.commit!==!1,class:"accent-retro-cyan",onChange:p[6]||(p[6]=Re=>o(t).toggleColumnVisibility("commit"))},null,40,Yf),p[50]||(p[50]=r("span",{class:"text-sm text-retro-text"},"Hash",-1))]),r("label",Xf,[r("input",{type:"checkbox",checked:o(t).columnVisibility.author!==!1,class:"accent-retro-cyan",onChange:p[7]||(p[7]=Re=>o(t).toggleColumnVisibility("author"))},null,40,Qf),p[51]||(p[51]=r("span",{class:"text-sm text-retro-text"},"Author",-1))]),r("label",Jf,[r("input",{type:"checkbox",checked:o(t).columnVisibility.date!==!1,class:"accent-retro-cyan",onChange:p[8]||(p[8]=Re=>o(t).toggleColumnVisibility("date"))},null,40,em),p[52]||(p[52]=r("span",{class:"text-sm text-retro-text"},"Date",-1))])])):D("",!0)]),p[58]||(p[58]=r("span",{class:"flex-1"},null,-1)),r("div",tm,[r("button",{class:ke(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",o(V)||o(t).filteredBranches.length>0?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Filter by branch","aria-expanded":o(V),onClick:p[9]||(p[9]=Re=>V.value=!o(V))},[Y(o(la),{class:"w-4 h-4"}),o(t).filteredBranches.length>0?(i(),u("span",rm," ("+w(o(t).filteredBranches.length)+") ",1)):D("",!0)],10,nm),o(V)?(i(),u("div",om,[p[57]||(p[57]=r("div",{class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border"}," Filter by Branch ",-1)),o(t).filteredBranches.length>0?(i(),u("button",{key:0,class:"w-full text-left px-3 py-1.5 text-sm text-retro-cyan hover:bg-retro-cyan/10",onClick:p[10]||(p[10]=Re=>o(t).clearFilters())}," Clear All Filters ")):D("",!0),o(I).local.length>0?(i(),u(ve,{key:1},[p[56]||(p[56]=r("div",{class:"px-3 py-1 text-[10px] text-retro-green font-semibold uppercase tracking-wider mt-1"}," Local ",-1)),(i(!0),u(ve,null,Ie(o(I).local,Re=>(i(),u("label",{key:Re.name,class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},[r("input",{type:"checkbox",checked:o(t).filteredBranches.includes(Re.name),class:"accent-retro-cyan",onChange:Vn=>o(t).toggleBranchFilter(Re.name)},null,40,sm),r("span",am,w(Re.name),1),Re.isHead?(i(),u("span",im,"(HEAD)")):D("",!0)]))),128))],64)):D("",!0),(i(!0),u(ve,null,Ie(o(I).remotes,(Re,Vn)=>(i(),u(ve,{key:Vn},[r("div",lm,w(Vn),1),(i(!0),u(ve,null,Ie(Re,Rn=>(i(),u("label",{key:Rn.name,class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},[r("input",{type:"checkbox",checked:o(t).filteredBranches.includes(Rn.name),class:"accent-retro-cyan",onChange:vo=>o(t).toggleBranchFilter(Rn.name)},null,40,cm),r("span",um,w(Rn.name),1)]))),128))],64))),128))])):D("",!0)]),r("button",{class:ke(["flex items-center gap-1 px-2 py-1.5 text-sm border border-retro-border text-retro-muted rounded hover:text-retro-text hover:border-retro-text transition-colors",{"animate-spin":o(t).isRefreshing}]),"aria-label":"Refresh",title:"Refresh",onClick:p[11]||(p[11]=Re=>o(t).loadGitGraph(n.workingDirectory))},[Y(o(Tn),{class:"w-4 h-4"})],2),r("button",{class:"flex items-center gap-1 px-2 py-1.5 text-sm border border-retro-border text-retro-muted rounded hover:text-retro-text hover:border-retro-text transition-colors","aria-label":"Fetch all remotes",title:"Fetch All",onClick:O},[Y(o(rs),{class:"w-4 h-4"})]),r("div",dm,[r("button",{class:ke(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",o(Z)?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text"]),"aria-label":"Manage remotes",title:"Remotes",onClick:p[12]||(p[12]=Re=>Z.value=!o(Z))},[Y(o(os),{class:"w-4 h-4"})],2),o(Z)?(i(),u("div",fm,[Y(ye,{remotes:o(t).remotes,onAdd:G,onEdit:H,onDelete:K,onClose:p[13]||(p[13]=Re=>Z.value=!1)},null,8,["remotes"])])):D("",!0)]),o(B)&&n.isActive?(i(),u("div",{key:0,class:ke(["flex items-center text-[10px] text-retro-muted",{"text-retro-cyan":o(t).isRefreshing}]),title:o(t).lastRefreshTime?`Last checked: ${new Date(o(t).lastRefreshTime).toLocaleTimeString()}`:"","aria-live":"polite","aria-atomic":"true"},[r("span",{class:ke(["inline-block w-1.5 h-1.5 rounded-full mr-1",o(t).isRefreshing?"bg-retro-cyan animate-pulse":"bg-retro-muted/50"]),"aria-hidden":"true"},null,2),Ae(" "+w(o(B)),1)],10,mm)):D("",!0)]),r("div",{class:ke(["flex-1 min-h-0 overflow-hidden",{"max-h-[50%]":o(t).selectedCommit||o(t).isUncommittedChangesSelected}])},[Y(Te,{ref_key:"commitListRef",ref:$,commits:o(t).filteredCommits,stashes:o(t).stashes,selectedCommit:o(t).selectedCommit,hasMore:o(t).hasMore,loading:o(t).loading,loadingMore:o(t).loadingMore,searchQuery:o(t).searchQuery,uncommittedChangesCount:o(t).uncommittedChangesCount,isUncommittedChangesSelected:o(t).isUncommittedChangesSelected,highlightBranches:o(l),featureHighlightBranches:o(c),featureMergeBases:o(m),previewHighlightBranches:o(d),previewMergeBases:o(h),currentBranchName:o(t).currentBranch?.name,localBranchNames:o(t).localBranchNames,graphStyle:o(t).graphStyle,muteNonAncestral:o(t).muteNonAncestral,columnVisibility:o(t).columnVisibility,onSelect:o(t).selectCommit,onLoadMore:o(t).loadMoreCommits,onBranchContextMenu:g,onCommitContextMenu:je,onTagContextMenu:Lt,onStashContextMenu:be,onCompareSelect:P,onSelectUncommittedChanges:o(t).selectUncommittedChanges,onScrollStart:o(s).startInteraction,onScrollEnd:o(s).endInteraction},null,8,["commits","stashes","selectedCommit","hasMore","loading","loadingMore","searchQuery","uncommittedChangesCount","isUncommittedChangesSelected","highlightBranches","featureHighlightBranches","featureMergeBases","previewHighlightBranches","previewMergeBases","currentBranchName","localBranchNames","graphStyle","muteNonAncestral","columnVisibility","onSelect","onLoadMore","onSelectUncommittedChanges","onScrollStart","onScrollEnd"])],2),o(t).isComparing&&o(t).selectedCommit&&o(t).comparisonCommit?(i(),he(Ne,{key:1,fromCommit:o(t).comparisonCommit,toCommit:o(t).selectedCommit,files:o(t).comparisonFiles,stats:o(t).comparisonStats,loading:o(t).comparisonLoading,onClose:o(t).clearComparison},null,8,["fromCommit","toCommit","files","stats","loading","onClose"])):o(t).selectedCommit?(i(),he(tt,{key:2,commit:o(t).selectedCommit,files:o(t).selectedCommitFiles,stats:o(t).selectedCommitStats,loading:o(t).isLoadingDetails,detailPosition:o(t).detailViewPosition,onClose:o(t).clearSelection,onNavigateToCommit:M,onTogglePosition:o(t).toggleDetailViewPosition,onOpenFileDiff:p[14]||(p[14]=Re=>o(t).selectedCommit&&o(t).openFileDiff(o(t).selectedCommit.hash,Re))},null,8,["commit","files","stats","loading","detailPosition","onClose","onTogglePosition"])):D("",!0),o(t).isUncommittedChangesSelected?(i(),he(bt,{key:3,stagedFiles:o(t).stagedFiles,unstagedFiles:o(t).unstagedFiles,isStaging:o(t).isStaging,isCommitting:o(t).isCommitting,onClose:o(t).clearSelection,onStageFiles:p[15]||(p[15]=Re=>o(t).stageFiles(Re)),onUnstageFiles:p[16]||(p[16]=Re=>o(t).unstageFiles(Re)),onStageAll:p[17]||(p[17]=()=>o(t).stageFiles([])),onUnstageAll:p[18]||(p[18]=()=>o(t).unstageFiles([])),onCommit:p[19]||(p[19]=Re=>o(t).commitChanges(Re))},null,8,["stagedFiles","unstagedFiles","isStaging","isCommitting","onClose"])):D("",!0)],64)),o(v).visible?(i(),he(tr,{key:5,branchName:o(v).branch,isCurrentBranch:o(v).isCurrentBranch,isLocal:o(v).isLocal,x:o(v).x,y:o(v).y,onClose:T,onCheckout:U,onCreateBranch:se,onDeleteBranch:N,onRename:ae,onMerge:j,onRebase:L,onPush:ee,onPull:re,onFetch:J,onCopyName:ne},null,8,["branchName","isCurrentBranch","isLocal","x","y"])):D("",!0),o(Se).visible&&o(Se).commit?(i(),he(un,{key:6,commit:o(Se).commit,x:o(Se).x,y:o(Se).y,onClose:pe,onAddTag:_e,onCreateBranch:Pe,onCheckout:Fe,onCherryPick:qe,onRevert:Qe,onMergeInto:Je,onReset:kt,onCopyHash:jt,onCopySubject:Qt},null,8,["commit","x","y"])):D("",!0),o(st).visible?(i(),he(Tr,{key:7,tagName:o(st).tag,x:o(st).x,y:o(st).y,onClose:St,onViewDetails:_t,onDeleteTag:Nt,onPushTag:gt,onCopyName:Ot},null,8,["tagName","x","y"])):D("",!0),o(me).visible&&o(me).stash?(i(),he(nr,{key:8,stashIndex:o(me).stash.index,stashMessage:o(me).stash.message,x:o(me).x,y:o(me).y,onClose:Me,onApply:Oe,onPop:kn,onDrop:Jt,onCreateBranch:en,onCopyName:Cn,onCopyHash:Kt},null,8,["stashIndex","stashMessage","x","y"])):D("",!0),o(Mt).visible?(i(),he(jn,{key:9,x:o(Mt).x,y:o(Mt).y,onClose:Ft,onStash:q,onReset:fe,onClean:te},null,8,["x","y"])):D("",!0),o(mt).visible?(i(),he(zn,{key:10,title:"Checkout",visible:o(mt).visible,loading:o(mt).loading,error:o(mt).error,confirmLabel:"Checkout",onClose:p[20]||(p[20]=Re=>o(mt).visible=!1),onConfirm:$n},{default:nt(()=>[r("p",hm,[p[59]||(p[59]=Ae(" Are you sure you want to checkout ",-1)),r("span",pm,w(o(mt).branchName),1),p[60]||(p[60]=Ae("? ",-1))])]),_:1},8,["visible","loading","error"])):D("",!0),o(et).visible?(i(),he(zn,{key:11,title:"Rename Branch",visible:o(et).visible,loading:o(et).loading,error:o(et).error,confirmLabel:"Rename",onClose:p[22]||(p[22]=Re=>o(et).visible=!1),onConfirm:ln},{default:nt(()=>[r("div",vm,[r("p",gm,[p[61]||(p[61]=Ae(" Rename ",-1)),r("span",xm,w(o(et).branchName),1)]),Le(r("input",{"onUpdate:modelValue":p[21]||(p[21]=Re=>o(et).newName=Re),type:"text",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",placeholder:"New branch name",onKeyup:hn(ln,["enter"])},null,544),[[Ct,o(et).newName]])])]),_:1},8,["visible","loading","error"])):D("",!0),o(ct).visible?(i(),he(md,{key:12,visible:o(ct).visible,branchName:o(ct).branchName,loading:o(ct).loading,error:o(ct).error,onClose:p[23]||(p[23]=Re=>o(ct).visible=!1),onConfirm:xt},null,8,["visible","branchName","loading","error"])):D("",!0),o(lt).visible?(i(),he(ad,{key:13,visible:o(lt).visible,branchName:o(lt).branchName,isLocal:o(lt).isLocal,loading:o(lt).loading,error:o(lt).error,onClose:p[24]||(p[24]=Re=>o(lt).visible=!1),onConfirm:gn},null,8,["visible","branchName","isLocal","loading","error"])):D("",!0),o(ot).visible?(i(),he(Bd,{key:14,visible:o(ot).visible,branchName:o(ot).branchName,remotes:o(S),loading:o(ot).loading,error:o(ot).error,onClose:p[25]||(p[25]=Re=>o(ot).visible=!1),onConfirm:tn},null,8,["visible","branchName","remotes","loading","error"])):D("",!0),o(at).visible?(i(),he(yd,{key:15,visible:o(at).visible,branchName:o(at).branchName,remotes:o(S),loading:o(at).loading,error:o(at).error,onClose:p[26]||(p[26]=Re=>o(at).visible=!1),onConfirm:cn},null,8,["visible","branchName","remotes","loading","error"])):D("",!0),o(ze).visible?(i(),he(Nd,{key:16,visible:o(ze).visible,branchName:o(t).currentBranch?.name||"HEAD",ontoBranch:o(ze).branchName,loading:o(ze).loading,error:o(ze).error,onClose:p[27]||(p[27]=Re=>o(ze).visible=!1),onConfirm:Ht},null,8,["visible","branchName","ontoBranch","loading","error"])):D("",!0),o(Xe).visible?(i(),he(Zu,{key:17,visible:o(Xe).visible,commitHash:o(Xe).commitHash,commitMessage:o(Xe).commitMessage,loading:o(Xe).loading,error:o(Xe).error,onClose:p[28]||(p[28]=Re=>o(Xe).visible=!1),onConfirm:xn},null,8,["visible","commitHash","commitMessage","loading","error"])):D("",!0),o(ut).visible?(i(),he(Vd,{key:18,visible:o(ut).visible,commitHash:o(ut).commitHash,commitMessage:o(ut).commitMessage,loading:o(ut).loading,error:o(ut).error,onClose:p[29]||(p[29]=Re=>o(ut).visible=!1),onConfirm:nn},null,8,["visible","commitHash","commitMessage","loading","error"])):D("",!0),o(dt).visible?(i(),he(df,{key:19,visible:o(dt).visible,commitHash:o(dt).commitHash,remotes:o(S),loading:o(dt).loading,error:o(dt).error,onClose:p[30]||(p[30]=Re=>o(dt).visible=!1),onConfirm:Sn},null,8,["visible","commitHash","remotes","loading","error"])):D("",!0),o(we).visible?(i(),he(xf,{key:20,visible:o(we).visible,tagName:o(we).tagName,remotes:o(S),loading:o(we).loading,error:o(we).error,onClose:p[31]||(p[31]=Re=>o(we).visible=!1),onConfirm:A},null,8,["visible","tagName","remotes","loading","error"])):D("",!0),o(ie).visible?(i(),he(Pf,{key:21,visible:o(ie).visible,tagName:o(ie).tagName,tagDetail:o(ie).tagDetail,loading:o(ie).loading,onClose:p[32]||(p[32]=Re=>o(ie).visible=!1)},null,8,["visible","tagName","tagDetail","loading"])):D("",!0),o(He).visible?(i(),he(ed,{key:22,visible:o(He).visible,fromCommit:o(He).fromCommit,loading:o(He).loading,error:o(He).error,onClose:p[33]||(p[33]=Re=>o(He).visible=!1),onConfirm:zt},null,8,["visible","fromCommit","loading","error"])):D("",!0),o(Ve).visible?(i(),he(zn,{key:23,title:"Create Branch from Stash",visible:o(Ve).visible,loading:o(Ve).loading,error:o(Ve).error,confirmLabel:"Create Branch",onClose:p[36]||(p[36]=Re=>o(Ve).visible=!1),onConfirm:p[37]||(p[37]=Re=>ht(o(Ke)))},{default:nt(()=>[r("div",bm,[r("p",ym,[p[62]||(p[62]=Ae(" Create a new branch from ",-1)),r("span",wm,"stash@"+w("{")+w(o(Ve).stashIndex)+w("}"),1)]),Le(r("input",{"onUpdate:modelValue":p[34]||(p[34]=Re=>We(Ke)?Ke.value=Re:null),type:"text",class:"w-full px-3 py-2 text-sm bg-retro-panel border border-retro-border rounded text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan",placeholder:"Branch name",onKeyup:p[35]||(p[35]=hn(Re=>ht(o(Ke)),["enter"]))},null,544),[[Ct,o(Ke)]])])]),_:1},8,["visible","loading","error"])):D("",!0),o(xe).visible?(i(),he(Qd,{key:24,visible:o(xe).visible,loading:o(xe).loading,error:o(xe).error,onClose:p[38]||(p[38]=Re=>o(xe).visible=!1),onConfirm:Ge},null,8,["visible","loading","error"])):D("",!0),o(rt).visible?(i(),he(Zd,{key:25,visible:o(rt).visible,loading:o(rt).loading,error:o(rt).error,onClose:p[39]||(p[39]=Re=>o(rt).visible=!1),onConfirm:Vt},null,8,["visible","loading","error"])):D("",!0),o(ft).visible?(i(),he(td,{key:26,visible:o(ft).visible,loading:o(ft).loading,error:o(ft).error,onClose:p[40]||(p[40]=Re=>o(ft).visible=!1),onConfirm:it},null,8,["visible","loading","error"])):D("",!0),(i(),he(Xt,{to:"body"},[Y(pn,{name:"fade"},{default:nt(()=>[o(Wt).visible?(i(),u("div",{key:0,class:"fixed z-50 px-3 py-1.5 text-sm bg-retro-green text-retro-dark rounded shadow-lg",style:Et({left:`${o(Wt).x}px`,top:`${o(Wt).y-40}px`})}," Copied! ",4)):D("",!0)]),_:1})])),(i(),he(Xt,{to:"body"},[Y(pn,{name:"fade"},{default:nt(()=>[o(t).operationError?(i(),u("div",km,[Y(o(wn),{class:"w-4 h-4 flex-shrink-0"}),r("span",Cm,w(o(t).operationError),1),r("button",{class:"flex-shrink-0 p-0.5 hover:bg-white/20 rounded transition-colors",onClick:p[41]||(p[41]=Re=>o(t).clearOperationError()),"aria-label":"Dismiss error"},[Y(o($t),{class:"w-3.5 h-3.5"})])])):D("",!0)]),_:1})]))])}}}),Sm=yr($m,[["__scopeId","data-v-7f64563b"]]),_m=Is("/app-logo.svg");function Mm(e){return/^\/speckit\.(clarify|plan|tasks|implement)(\s|$)/.test(e)}function Tm(e=Date.now,n=Math.random){return`req-${e()}-${n().toString(36).slice(2,8)}`}function Ho(e=Date.now){return`session-${e()}`}function Ir(e,n=!1){const t={};return(!n||e?.hasWorktree)&&e?.worktreePath&&(t.cwd=e.worktreePath,t.worktreeBranch=e.worktreeBranch),e?.featureId&&(t.featureId=e.featureId),Object.keys(t).length>0?t:void 0}function Ms(e){if(e.file_path)return String(e.file_path);if(e.path)return String(e.path);if(e.command)return String(e.command).slice(0,50);if(e.pattern)return String(e.pattern);for(const n of Object.values(e))if(typeof n=="string"&&n.length<100)return n;return""}function Oo(e,n="Permission"){const t=e||"",a=t.match(/write to (.+?)(?:[\s,?]|$)/i),s=t.match(/read (.+?)(?:[\s,?]|$)/i),l=t.match(/run (.+?)(?:[?,]|$)/i);return a?.[1]?{tool:"Write",description:t,filePath:a[1].trim()}:s?.[1]?{tool:"Read",description:t,filePath:s[1].trim()}:l?.[1]?{tool:"Bash",description:t,command:l[1].trim()}:{tool:n,description:t}}const Ts=xr("autoMode",()=>{const e=k(!1),n=k(null),t=k(!1),a=k(null);let s=null,l=null;const c=new Map,d=R(()=>n.value?.state==="active"),h=R(()=>n.value?.tasks??[]),m=R(()=>h.value.filter(X=>X.state==="queued").length),S=R(()=>h.value.find(X=>X.state==="running")??null),$=R(()=>h.value.filter(X=>X.state==="completed").length),x=R(()=>h.value.filter(X=>X.state==="failed").length),b=R(()=>h.value.length);async function y(){if(typeof window<"u")try{(await $fetch("/api/settings"))?.autoModeEnabled===!0&&(e.value=!0)}catch{}try{const X=await $fetch("/api/auto-mode/status");e.value=X.enabled,n.value=X.session}catch{}ce()}async function _(){t.value=!0,a.value=null;try{const Z=Hn().autoModeConcurrency,O=await $fetch("/api/auto-mode/toggle",{method:"POST",body:{enabled:!e.value,concurrency:Z}});O.success?(e.value=O.enabled,ge(O.enabled)):a.value=O.error||"Toggle failed"}catch(X){a.value=X instanceof Error?X.message:String(X)}finally{t.value=!1}}function W(X){switch(X.type){case"auto_mode_status":e.value=X.enabled,n.value=X.session,ge(X.enabled);break;case"auto_mode_task_update":if(n.value){const Z=n.value.tasks.findIndex(O=>O.featureId===X.task.featureId);Z>=0&&(n.value.tasks[Z]=X.task)}X.task.state==="running"&&X.task.worktreePath&&X.task.worktreeBranch&&oe(X.task);break;case"auto_mode_error":a.value=X.error;break;case"auto_mode_step_start":z(X.featureId,X.step);break;case"auto_mode_step_complete":V(X.featureId);break;case"auto_mode_message":E(X.featureId,X.sdkMessage);break}}function B(X){return At().findConversationByFeature(X)}function z(X,Z){if(typeof window>"u")return;const O=At(),G=B(X);if(!G)return;const H={id:hr(),role:"user",content:`/speckit.${Z} ${X}`,timestamp:new Date().toISOString()};O.addMessage(H,G.id);const K={id:hr(),role:"assistant",content:"",timestamp:new Date().toISOString(),status:"streaming"};O.addMessage(K,G.id),c.set(X,K.id),O.startConversationStreaming(G.id),O.saveConversation(G.id,!1)}function V(X){if(typeof window>"u")return;const Z=At(),O=B(X);if(!O)return;const G=c.get(X);G&&(Z.updateMessage(G,{status:"complete"},O.id),c.delete(X)),Z.endConversationStreaming(O.id),Z.saveConversation(O.id,!0)}function E(X,Z){if(typeof window>"u")return;const O=At(),G=B(X);if(!G)return;const H=c.get(X);if(H){if(Z.type==="assistant"&&Z.message?.content){for(const K of Z.message.content)if(K.type==="text"&&K.text)O.appendToMessageWithSave(H,K.text,G.id);else if(K.type==="tool_use"&&K.name){const I=K.input?Ms(K.input):"",v=`
|
|
68
|
+
|
|
69
|
+
▶ **${K.name}** ${I}
|
|
70
|
+
`;O.appendToMessageWithSave(H,v,G.id)}}if(Z.type==="tool_result"||Z.type==="user"){const K=Z.message?.content||Z.content;if(Array.isArray(K)){for(const I of K)if(I.type==="tool_result"&&I.content){const v=typeof I.content=="string"?I.content:Array.isArray(I.content)?I.content.filter(g=>g.type==="text").map(g=>g.text).join(""):"";if(v){const g=v.slice(0,300),T=v.length>300?"...":"",U=I.is_error?"✗ Error:":"✓";O.appendToMessageWithSave(H,`${U} ${g}${T}
|
|
71
|
+
`,G.id)}}}}}}function oe(X){if(typeof window>"u")return;const Z=At(),O=Z.findConversationByFeature(X.featureId);if(O){const K=Z.conversations.find(I=>I.id===O.id);K&&(K.autoMode||(K.autoMode=!0),X.worktreePath&&!K.worktreePath&&(K.worktreePath=X.worktreePath,K.worktreeBranch=X.worktreeBranch,K.baseBranch=X.baseBranch,K.cwd=X.worktreePath,K.hasWorktree=!0),Z.saveAllConversations());return}const H={id:Go(),title:`Auto: ${X.featureId}`,messages:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),cwd:X.worktreePath||"",featureId:X.featureId,autoMode:!0,worktreePath:X.worktreePath,worktreeBranch:X.worktreeBranch,baseBranch:X.baseBranch,hasWorktree:!0};Z.addAutoModeConversation(H)}function ce(){if(typeof window>"u"||s&&s.readyState===WebSocket.OPEN)return;l&&(clearTimeout(l),l=null);const Z=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/auto-mode-ws`;s=new WebSocket(Z),s.onmessage=O=>{try{const G=JSON.parse(O.data);W(G)}catch{}},s.onclose=()=>{s=null,l=setTimeout(()=>ce(),5e3)},s.onerror=()=>{}}function de(){l&&(clearTimeout(l),l=null),s&&(s.close(),s=null)}function ge(X){typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{autoModeEnabled:X}}).catch(Z=>{console.error("Failed to persist autoModeEnabled:",Z)})}return{enabled:e,session:n,loading:t,error:a,isActive:d,tasks:h,queuedCount:m,runningTask:S,completedCount:$,failedCount:x,totalCount:b,initialize:y,toggle:_,disconnectWebSocket:de}}),Am=["disabled"],Bm=Be({__name:"AutoModeToggle",setup(e){const n=Ts();return vt(()=>{n.initialize()}),(t,a)=>(i(),u("button",{type:"button",class:ke(["relative p-1.5 rounded transition-colors",o(n).enabled?"bg-retro-yellow/20 text-retro-yellow hover:bg-retro-yellow/30":"text-retro-muted hover:text-retro-text hover:bg-retro-panel"]),disabled:o(n).loading,title:"Toggle Auto Mode — background spec processing",onClick:a[0]||(a[0]=s=>o(n).toggle())},[Y(o(Zr),{class:ke(["h-4 w-4",{"animate-pulse":o(n).isActive}])},null,8,["class"]),o(n).enabled?(i(),u("span",{key:0,class:ke(["absolute right-0.5 top-0.5 inline-block w-1.5 h-1.5 rounded-full bg-retro-yellow",{"animate-pulse":o(n).isActive}])},null,2)):D("",!0)],10,Am))}}),Em={class:"flex items-start justify-between gap-2"},Rm={class:"flex-1 min-w-0"},Pm={class:"flex items-center gap-2"},Dm={class:"font-mono text-sm text-retro-text truncate"},Im={class:"text-sm font-mono text-retro-muted mt-1 truncate"},Lm={class:"flex items-center gap-1 flex-shrink-0"},Nm={key:0,class:"text-[11px] font-mono text-retro-muted mr-1",title:"Completed tasks / total tasks"},Fm={key:1,class:"w-2 h-2 rounded-full bg-retro-green",title:"spec"},Hm={key:2,class:"w-2 h-2 rounded-full bg-retro-cyan",title:"plan"},Om={key:3,class:"w-2 h-2 rounded-full bg-retro-yellow",title:"tasks"},Um={class:"flex flex-wrap items-center justify-between gap-1 mt-2"},jm={key:0,class:"flex items-center gap-1"},zm=["title","disabled","onClick"],Vm=Be({__name:"FeatureCard",props:{feature:{},skills:{},isActive:{type:Boolean}},emits:["select","cascade","openChat","skill"],setup(e,{emit:n}){const t={DocumentCheckIcon:ra,PuzzlePieceIcon:Co,DocumentMagnifyingGlassIcon:sa,WrenchScrewdriverIcon:ga,SparklesIcon:kr,BeakerIcon:Xs,ShieldCheckIcon:cs,CommandLineIcon:na,CpuChipIcon:ss,LightBulbIcon:da},a=e,s=n,l=At();function c(x){return t[x]||Co}function d(x){return x.prerequisites.every(b=>a.feature.files.some(y=>y.filename===b))}function h(x){return x.prerequisites.filter(b=>!a.feature.files.some(y=>y.filename===b))}function m(x){return d(x)?`${x.name} (Shift+click: new conversation)`:`Requires: ${h(x).join(", ")}`}const S=R(()=>{const x=l.findConversationByFeature(a.feature.id);return x?l.isConversationStreaming(x.id):!1}),$=R(()=>a.isActive?["border-retro-cyan shadow-retro","feature-card-active","dark:bg-gradient-to-br dark:from-retro-cyan/10 dark:via-retro-panel dark:to-retro-magenta/5"]:["border-retro-border","feature-card-light","hover:border-retro-muted","dark:bg-gradient-to-br","dark:from-retro-panel dark:via-retro-panel dark:to-retro-cyan/5","dark:hover:from-retro-cyan/5 dark:hover:via-retro-panel dark:hover:to-retro-magenta/5"]);return(x,b)=>(i(),u("button",{type:"button",class:ke(["w-full p-3 text-left rounded-lg border transition-all duration-200 group",o($)]),onClick:b[5]||(b[5]=y=>s("select",e.feature.id))},[r("div",Em,[r("div",Rm,[r("div",Pm,[Y(o(Nn),{class:ke(["h-4 w-4 flex-shrink-0 transition-colors duration-200",e.isActive?"text-retro-cyan":"text-retro-muted group-hover:text-retro-cyan"])},null,8,["class"]),r("span",Dm,w(e.feature.id),1)]),r("p",Im,w(e.feature.name),1)]),r("div",Lm,[e.feature.hasTasks?(i(),u("span",Nm,w(e.feature.completedTasks)+"/"+w(e.feature.totalTasks),1)):D("",!0),e.feature.hasSpec?(i(),u("span",Fm)):D("",!0),e.feature.hasPlan?(i(),u("span",Hm)):D("",!0),e.feature.hasTasks?(i(),u("span",Om)):D("",!0)])]),r("div",Um,[e.feature.hasSpec?(i(),u("div",jm,[r("button",{type:"button",class:"flex items-center justify-center p-1 bg-retro-cyan/20 text-retro-cyan rounded hover:bg-retro-cyan/30 transition-colors",title:"Clarify spec (Shift+click: new conversation)",onClick:b[0]||(b[0]=yt(y=>s("cascade",y,e.feature.id,"clarify"),["stop"]))},[Y(o(to),{class:"h-3.5 w-3.5"})]),r("button",{type:"button",class:"flex items-center justify-center p-1 bg-retro-cyan/20 text-retro-cyan rounded hover:bg-retro-cyan/30 transition-colors",title:"Plan → Tasks → Implement (Shift+click: new conversation)",onClick:b[1]||(b[1]=yt(y=>s("cascade",y,e.feature.id,"plan"),["stop"]))},[Y(o(Jr),{class:"h-3.5 w-3.5"})]),e.feature.hasPlan?(i(),u("button",{key:0,type:"button",class:"flex items-center justify-center p-1 bg-retro-yellow/20 text-retro-yellow rounded hover:bg-retro-yellow/30 transition-colors",title:"Tasks → Implement (Shift+click: new conversation)",onClick:b[2]||(b[2]=yt(y=>s("cascade",y,e.feature.id,"tasks"),["stop"]))},[Y(o(is),{class:"h-3.5 w-3.5"})])):D("",!0),e.feature.hasTasks?(i(),u("button",{key:1,type:"button",class:"flex items-center justify-center p-1 bg-retro-magenta/20 text-retro-magenta rounded hover:bg-retro-magenta/30 transition-colors",title:"Implement (Shift+click: new conversation)",onClick:b[3]||(b[3]=yt(y=>s("cascade",y,e.feature.id,"implement"),["stop"]))},[Y(o(pa),{class:"h-3.5 w-3.5"})])):D("",!0),e.skills.length>0?(i(),u(ve,{key:2},[b[6]||(b[6]=r("div",{class:"w-px h-4 bg-retro-border mx-0.5"},null,-1)),(i(!0),u(ve,null,Ie(e.skills,y=>(i(),u("button",{key:y.id,type:"button",class:ke(["flex items-center justify-center p-1 rounded transition-colors",[d(y)&&!o(S)?"bg-retro-pink/20 text-retro-pink hover:bg-retro-pink/30":"bg-retro-subtle/10 text-retro-subtle cursor-not-allowed",o(S)?"animate-pulse":""]]),title:m(y),disabled:!d(y)||o(S),onClick:yt(_=>s("skill",_,e.feature.id,y.id),["stop"])},[(i(),he(In(c(y.icon)),{class:"h-3.5 w-3.5"}))],10,zm))),128))],64)):D("",!0)])):D("",!0),e.feature.hasSpec?(i(),u("button",{key:1,type:"button",class:"flex items-center justify-center p-1 bg-retro-green/20 text-retro-green rounded hover:bg-retro-green/30 transition-colors",title:"Open new chat linked to this spec",onClick:b[4]||(b[4]=yt(y=>s("openChat",y,e.feature.id),["stop"]))},[Y(o(ts),{class:"h-3.5 w-3.5"})])):D("",!0)])],2))}});function Mr(){function e(n){const t=Ze.parse(n);return _s.sanitize(t)}return{renderMarkdown:e}}const Wm={class:"fixed inset-0 z-50 flex items-center justify-center"},Gm={class:"relative w-[96vw] h-[94vh] bg-retro-black border border-retro-border rounded-lg shadow-2xl flex flex-col overflow-hidden"},qm={class:"flex-shrink-0 flex items-center justify-between px-4 h-12 border-b border-retro-border bg-retro-dark"},Km={class:"flex items-center gap-3 min-w-0"},Zm={class:"text-sm font-mono font-bold text-retro-cyan truncate"},Ym={class:"text-xs font-mono text-retro-subtle"},Xm={class:"flex items-center gap-2"},Qm=["disabled"],Jm={key:0,class:"flex-shrink-0 flex items-center gap-0 border-b border-retro-border bg-retro-dark overflow-x-auto"},eh=["onClick"],th={class:"flex-1 min-h-0 overflow-y-auto"},nh={key:0,class:"flex items-center justify-center py-12"},rh={key:1,class:"flex flex-col items-center justify-center py-12 text-center px-4"},oh={class:"text-sm font-mono text-retro-red"},sh={key:2,class:"flex flex-col items-center justify-center py-12 text-center"},ah={key:3,class:"h-full flex flex-col"},ih=["innerHTML"],lh=Be({__name:"SpecViewerModal",props:{feature:{}},emits:["close"],setup(e,{emit:n}){const t=e,a=n,s=On(),{renderMarkdown:l}=Mr(),c=k(t.feature.files[0]?.filename||""),d=k(""),h=k(!1),m=k(null),S=k(!1),$=k(""),x=k(!1);async function b(){if(c.value){h.value=!0,m.value=null;try{const E=`/api/specs/${t.feature.id}/${c.value}`,oe=await $fetch(E);d.value=oe.content}catch{m.value="Failed to load file",d.value=""}finally{h.value=!1}}}const y=R(()=>d.value?l(d.value):"");function _(E){S.value&&(S.value=!1),c.value=E,b()}function W(){$.value=d.value,S.value=!0}function B(){S.value=!1,$.value=""}async function z(){x.value=!0;try{const E=`/api/specs/${t.feature.id}/${c.value}`;await $fetch(E,{method:"PUT",body:{content:$.value}}),d.value=$.value,S.value=!1,s.success("Saved")}catch{s.error("Failed to save")}finally{x.value=!1}}function V(E){E.key==="Escape"&&(S.value?B():a("close"))}return vt(()=>{window.addEventListener("keydown",V),b()}),wt(()=>{window.removeEventListener("keydown",V)}),(E,oe)=>(i(),he(Xt,{to:"body"},[r("div",Wm,[r("div",{class:"absolute inset-0 bg-black/80",onClick:oe[0]||(oe[0]=ce=>a("close"))}),r("div",Gm,[r("div",qm,[r("div",Km,[r("span",Zm,w(e.feature.name),1),r("span",Ym,w(e.feature.id),1)]),r("div",Xm,[o(S)?(i(),u(ve,{key:0},[r("button",{type:"button",class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-muted transition-colors",onClick:B}," Cancel "),r("button",{type:"button",class:"px-3 py-1 text-xs font-mono rounded border border-retro-cyan text-retro-cyan hover:bg-retro-cyan/10 transition-colors disabled:opacity-50",disabled:o(x),onClick:z},w(o(x)?"Saving...":"Save"),9,Qm)],64)):o(d)&&!o(h)&&!o(m)?(i(),u("button",{key:1,type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Edit",onClick:W},[Y(o(eo),{class:"h-4 w-4"})])):D("",!0),r("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close (ESC)",onClick:oe[1]||(oe[1]=ce=>a("close"))},[Y(o($t),{class:"h-4 w-4"})])])]),e.feature.files.length>0?(i(),u("div",Jm,[(i(!0),u(ve,null,Ie(e.feature.files,ce=>(i(),u("button",{key:ce.filename,type:"button",class:ke(["px-4 py-2 text-xs font-mono border-b-2 transition-colors whitespace-nowrap",[o(c)===ce.filename?"border-retro-cyan text-retro-cyan bg-retro-black":"border-transparent text-retro-muted hover:text-retro-text hover:bg-retro-panel"]]),onClick:de=>_(ce.filename)},w(ce.label),11,eh))),128))])):D("",!0),r("div",th,[o(h)?(i(),u("div",nh,[...oe[3]||(oe[3]=[r("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading...",-1)])])):o(m)?(i(),u("div",rh,[r("p",oh,w(o(m)),1),r("button",{type:"button",class:"mt-3 px-3 py-1.5 text-xs font-mono bg-retro-panel border border-retro-border rounded text-retro-muted hover:text-retro-cyan hover:border-retro-cyan transition-colors",onClick:b}," Retry ")])):e.feature.files.length===0?(i(),u("div",sh,[...oe[4]||(oe[4]=[r("p",{class:"text-sm font-mono text-retro-muted"},"No spec files found",-1),r("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," This feature directory has no .md files ",-1)])])):o(S)?(i(),u("div",ah,[Le(r("textarea",{"onUpdate:modelValue":oe[2]||(oe[2]=ce=>We($)?$.value=ce:null),class:"flex-1 w-full p-4 bg-retro-black text-sm font-mono text-retro-text resize-none focus:outline-none",spellcheck:"false"},null,512),[[Ct,o($)]])])):(i(),u("div",{key:4,class:"spec-markdown p-6 text-sm font-mono text-retro-text max-w-4xl mx-auto",innerHTML:o(y)},null,8,ih))])])])]))}}),ch={class:"w-full max-w-2xl rounded-xl border border-retro-border/80 bg-retro-black shadow-[0_24px_70px_rgba(0,0,0,0.55)] overflow-hidden"},uh={class:"flex items-center justify-between px-4 py-2 border-b border-retro-border/60 bg-retro-dark/70"},dh={class:"flex items-center gap-2 px-4 py-3 border-b border-retro-border/60"},fh={class:"flex items-center justify-between px-4 py-1.5 border-b border-retro-border/40 bg-retro-dark/30 text-[10px] font-mono text-retro-subtle"},mh={class:"flex items-center gap-3"},hh={class:"inline-flex items-center gap-1"},ph={key:0},vh={key:0,class:"truncate max-w-[42%]"},gh={class:"max-h-[58vh] overflow-y-auto"},xh={key:0,class:"px-4 py-3 text-xs font-mono text-retro-subtle animate-pulse"},bh={key:1,class:"px-4 py-4 text-xs font-mono text-retro-subtle"},yh={key:2,class:"px-4 py-4 text-xs font-mono text-retro-subtle"},wh={key:3,class:"px-4 py-3 text-xs font-mono text-retro-red"},kh={key:4,class:"py-2 px-2 space-y-2"},Ch=["onMouseenter","onClick"],$h={class:"flex items-center justify-between gap-3 text-[10px] font-mono"},Sh={class:"text-retro-cyan/90"},_h={class:"text-retro-subtle truncate"},Mh=["innerHTML"],Th={key:5,class:"px-4 py-3 text-xs font-mono text-retro-subtle"},Ah={class:"flex items-center justify-between gap-3 px-4 py-2 border-t border-retro-border/60 bg-retro-dark/50 text-[11px] font-mono text-retro-subtle"},Bh={key:0,class:"text-retro-yellow"},Eh={key:0,class:"px-4 pb-3 text-xs font-mono text-retro-red flex items-center gap-2"},Rh=400,Ph=Be({__name:"FeatureSearchModal",props:{availableFeatureIds:{}},emits:["close","select"],setup(e,{emit:n}){const t=e,a=n,{renderMarkdown:s}=Mr(),l=k(""),c=k(!1),d=k(!1),h=k(null),m=k(null),S=k(null),$=k(null),x=k([]),b=k(-1),y=k(null),_=k([]);let W=null,B=0;const z=R(()=>l.value.trim()),V=R(()=>{const I=z.value.toLowerCase().split(/\s+/).map(v=>v.trim()).filter(v=>v.length>=2);return Array.from(new Set(I)).slice(0,8)}),E=R(()=>h.value||m.value?"error":!z.value&&d.value?"empty-query":x.value.length>0?"results":d.value&&!c.value?"no-results":"idle");function oe(I){return{featureId:I.chunk.featureId,sourcePath:I.chunk.sourcePath,headingHierarchy:I.chunk.headingHierarchy,snippet:I.chunk.content,matchType:I.matchType,score:I.score,lineStart:I.chunk.lineStart,lineEnd:I.chunk.lineEnd}}async function ce(){const I=z.value;if(m.value=null,!I){d.value=!0,S.value=null,$.value=null,h.value=null,x.value=[],b.value=-1;return}const v=++B;d.value=!0,h.value=null,c.value=!0;try{const g=await $fetch("/api/specs/search",{query:{q:I,mode:"keyword",limit:20}});if(v!==B)return;S.value=g.warning??null,$.value=g.searchTime,x.value=g.results.map(oe),b.value=x.value.length>0?0:-1}catch(g){if(v!==B)return;const T=g instanceof Error?g.message:"Failed to search specs";h.value=T,$.value=null,x.value=[],b.value=-1}finally{v===B&&(c.value=!1)}}De(l,()=>{h.value=null,m.value=null,W&&clearTimeout(W),W=setTimeout(()=>{ce()},Rh)}),De(x,()=>{_.value=[]}),De(b,async I=>{I<0||(await Yt(),_.value[I]?.scrollIntoView({block:"nearest"}))});function de(){a("close")}function ge(I){const v=x.value[I];if(v){if(!t.availableFeatureIds.includes(v.featureId)){m.value="Feature unavailable";return}a("select",v.featureId),a("close")}}function X(I){if(x.value.length===0)return;if(b.value<0){b.value=0;return}const v=b.value+I;if(v<0){b.value=x.value.length-1;return}if(v>=x.value.length){b.value=0;return}b.value=v}function Z(I){if(I.key==="ArrowDown"){I.preventDefault(),X(1);return}if(I.key==="ArrowUp"){I.preventDefault(),X(-1);return}if(I.key==="Enter"){I.preventDefault(),b.value>=0&&ge(b.value);return}I.key==="Escape"&&(I.preventDefault(),de())}function O(I){I.target===I.currentTarget&&de()}function G(I,v){if(!v){_.value[I]=null;return}if(v instanceof HTMLElement){_.value[I]=v;return}const g=v.$el;_.value[I]=g instanceof HTMLElement?g:null}function H(){ce()}function K(I){const v=I.trim();if(!v)return"";const g=v.length>700?`${v.slice(0,700)}...`:v,T=s(g);if(V.value.length===0)return T;const U=V.value.map(N=>N.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),ae=new RegExp(`(${U.join("|")})`,"gi");return T.split(/(<[^>]+>)/g).map(N=>N.startsWith("<")?N:N.replace(ae,"<mark>$1</mark>")).join("")}return vt(()=>{Yt(()=>{y.value?.focus()})}),wt(()=>{W&&clearTimeout(W)}),(I,v)=>(i(),he(Xt,{to:"body"},[Y(pn,{appear:"","enter-active-class":"transition duration-150 ease-out","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition duration-120 ease-in","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:nt(()=>[r("div",{class:"fixed inset-0 z-50 flex items-start justify-center pt-16 px-4 bg-black/75 backdrop-blur-[1px]",onClick:O},[Y(pn,{appear:"","enter-active-class":"transition duration-150 ease-out","enter-from-class":"opacity-0 translate-y-2 scale-[0.99]","enter-to-class":"opacity-100 translate-y-0 scale-100","leave-active-class":"transition duration-120 ease-in","leave-from-class":"opacity-100 translate-y-0 scale-100","leave-to-class":"opacity-0 translate-y-1 scale-[0.995]"},{default:nt(()=>[r("div",ch,[r("div",uh,[v[1]||(v[1]=r("div",{class:"flex items-center gap-2"},[r("span",{class:"inline-flex items-center rounded px-2 py-0.5 text-[10px] font-mono border border-retro-cyan/50 text-retro-cyan bg-retro-cyan/10"}," Command Palette "),r("span",{class:"text-[10px] font-mono text-retro-subtle"},"Global spec search")],-1)),r("button",{type:"button",class:"p-1 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close (Escape)",onClick:de},[Y(o($t),{class:"h-4 w-4"})])]),r("div",dh,[Y(o(Mn),{class:"h-4 w-4 text-retro-cyan"}),Le(r("input",{ref_key:"inputRef",ref:y,"onUpdate:modelValue":v[0]||(v[0]=g=>We(l)?l.value=g:null),type:"text",placeholder:"Search specs across all features...",class:"flex-1 bg-transparent text-sm font-mono text-retro-text placeholder:text-retro-subtle focus:outline-none",onKeydown:Z},null,544),[[Ct,o(l)]]),v[2]||(v[2]=r("span",{class:"text-[10px] font-mono text-retro-subtle border border-retro-border/60 rounded px-1.5 py-0.5"},"400ms",-1))]),r("div",fh,[r("div",mh,[r("span",hh,[Y(o(Nn),{class:"h-3.5 w-3.5"}),Ae(" "+w(o(x).length)+" results ",1)]),o($)!==null?(i(),u("span",ph,w(o($))+"ms",1)):D("",!0)]),o(z)?(i(),u("span",vh,"“"+w(o(z))+"”",1)):D("",!0)]),r("div",gh,[o(c)?(i(),u("div",xh," Searching... ")):o(E)==="empty-query"?(i(),u("div",bh," Enter a search term to search across all feature specs. ")):o(E)==="no-results"?(i(),u("div",yh," No matching features found. ")):o(E)==="error"?(i(),u("div",wh,[r("p",null,w(o(m)||o(h)),1),o(h)?(i(),u("button",{key:0,type:"button",class:"mt-2 px-2 py-1 rounded border border-retro-border text-retro-muted hover:text-retro-cyan hover:border-retro-cyan transition-colors",onClick:H}," Retry ")):D("",!0)])):o(x).length>0?(i(),u("ul",kh,[(i(!0),u(ve,null,Ie(o(x),(g,T)=>(i(),u("li",{key:`${g.featureId}:${g.sourcePath}:${T}`},[r("button",{type:"button",ref_for:!0,ref:U=>G(T,U),class:ke(["w-full text-left px-4 py-3 min-h-[132px] rounded-lg border border-retro-border/40 border-l-2 transition-colors",T===o(b)?"border-retro-cyan bg-retro-panel/95 text-retro-text shadow-[0_0_0_1px_rgba(34,211,238,0.18)]":"text-retro-muted hover:text-retro-text hover:bg-retro-panel/90"]),onMouseenter:U=>b.value=T,onClick:U=>ge(T)},[r("div",$h,[r("span",Sh,w(g.featureId),1),r("span",_h,w(g.sourcePath)+":"+w(g.lineStart)+"-"+w(g.lineEnd),1)]),r("div",{class:"snippet-markdown mt-2 max-h-20 overflow-hidden text-xs text-retro-text",innerHTML:K(g.snippet)},null,8,Mh),v[3]||(v[3]=r("div",{class:"mt-2 text-[10px] font-mono text-retro-subtle"}," Select feature ",-1))],42,Ch)]))),128))])):(i(),u("div",Th," Start typing to search. "))]),r("div",Ah,[v[4]||(v[4]=r("div",{class:"flex items-center gap-2"},[r("span",{class:"border border-retro-border/70 rounded px-1.5 py-0.5"},"↑↓ move"),r("span",{class:"border border-retro-border/70 rounded px-1.5 py-0.5"},"Enter select"),r("span",{class:"border border-retro-border/70 rounded px-1.5 py-0.5"},"Esc close")],-1)),o(S)?(i(),u("span",Bh,w(o(S)),1)):D("",!0)]),o(m)?(i(),u("div",Eh,[Y(o(wn),{class:"h-3.5 w-3.5"}),r("span",null,w(o(m)),1)])):D("",!0)])]),_:1})])]),_:1})]))}}),Dh=yr(Ph,[["__scopeId","data-v-5199b408"]]),pt=new Map,dn=new Map,ur=new Set,Ih=3e4,Lh=18e4;function Nh(e){switch(e){case 1e3:return"Normal closure";case 1001:return"Endpoint is going away (server shutdown or page navigation)";case 1002:return"Protocol error";case 1003:return"Unsupported data";case 1005:return"No status code received from peer (close frame had no code)";case 1006:return"Abnormal closure (connection dropped without close frame)";case 1007:return"Invalid payload data";case 1008:return"Policy violation";case 1009:return"Message too big";case 1010:return"Missing required extension";case 1011:return"Internal server error";case 1012:return"Service restart";case 1013:return"Try again later (temporary overload)";case 1015:return"TLS handshake failure";default:return e>=4e3&&e<=4999?"Application-specific close code":"Unknown close code"}}function Fh(e,n){const t=[];return e.reason?t.push(e.reason):t.push(Nh(e.code)),n?.lastServerError?t.push(`Last server error: ${n.lastServerError}`):n?.lastSocketError&&t.push(`Last socket error: ${n.lastSocketError}`),t.push(`wasClean: ${e.wasClean?"yes":"no"}`),t.join(" | ")}function po(){const e=At(),n=Hn();function t(){return typeof document>"u"||typeof document.hasFocus!="function"?!1:document.visibilityState==="visible"&&document.hasFocus()}function a(v){const T=e.conversations.find(U=>U.id===v)?.title?.trim()||"Chat";return new Notification("Spec Cat",{body:`${T} response completed.`,tag:`chat-complete-${v}`})}async function s(v){if(!(typeof window>"u"||typeof Notification>"u")&&!t()){if(Notification.permission==="granted"){a(v);return}if(Notification.permission==="default")try{await Notification.requestPermission()==="granted"&&a(v)}catch(g){console.warn("[useChatStream] Failed to request browser notification permission:",g)}}}function l(){return typeof window>"u"?"":`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/_ws`}function c(v){v.healthCheckInterval&&(clearInterval(v.healthCheckInterval),v.healthCheckInterval=null)}function d(v){c(v),v.lastMessageTime=Date.now(),v.healthCheckInterval=ho(()=>{const g=v.conversationId;if(v.ws.readyState!==WebSocket.OPEN){console.warn(`[useChatStream] Health check: WebSocket not open for ${g}`),c(v),e.isConversationStreaming(g)&&($(v.currentMessageId,g,"error"),e.updateMessage(v.currentMessageId,{status:"error"},g),e.setSessionError("Connection lost during streaming",g),e.endSession(g),e.endConversationStreaming(g)),pt.delete(g);return}if(e.isConversationStreaming(g)){const T=Date.now()-v.lastMessageTime;T>Lh&&(console.warn(`[useChatStream] Health check: streaming timeout for ${g} (${Math.round(T/1e3)}s)`),c(v),$(v.currentMessageId,g,"error"),e.updateMessage(v.currentMessageId,{status:"error"},g),e.setSessionError("Streaming timed out — no response from server for 3 minutes",g),e.endSession(g),e.endConversationStreaming(g),v.ws.close(),pt.delete(g))}},Ih)}function h(v,g){return e.conversations.find(U=>U.id===v)?.messages.find(U=>U.id===g)?.status}function m(v,g=!0){const T=pt.get(v);T&&(c(T),g&&T.ws.readyState===WebSocket.OPEN&&T.ws.close(),pt.delete(v))}function S(v,g,T){!T||!v.currentTextBlockId||(e.updateBlockWithSave(v.currentMessageId,v.currentTextBlockId,U=>{U.type==="text"&&(U.text+=T)},g,{syncContent:!1}),e.appendToMessage(v.currentMessageId,T,g))}function $(v,g,T){const ae=e.conversations.find(N=>N.id===g)?.messages.find(N=>N.id===v);if(ae?.contentBlocks)for(const N of ae.contentBlocks)N.type==="tool_use"&&(N.status==="running"||N.status==="pending")&&e.updateBlockById(v,N.id,j=>{j.type==="tool_use"&&(j.status=T)},g)}async function x(v){try{(await b(v)).send(JSON.stringify({type:"reset_context"})),e.clearProviderSession(v),console.log("[useChatStream] Context reset requested for conversation:",v)}catch(g){throw console.error("[useChatStream] Failed to reset context:",g),g}}function b(v){return new Promise((g,T)=>{const U=pt.get(v);if(U&&U.ws.readyState===WebSocket.OPEN){g(U.ws);return}U&&(U.ws.close(),pt.delete(v));const ae=l(),N=new WebSocket(ae),j={ws:N,currentMessageId:"",conversationId:v,activeTools:new Map,currentTextBlockId:null,currentThinkingBlockId:null,healthCheckInterval:null,lastMessageTime:Date.now(),lastServerError:null,lastSocketError:null};pt.set(v,j),N.onopen=()=>{g(N)},N.onerror=L=>{console.error(`[useChatStream] WebSocket error for conversation ${v}:`,L);const ee=pt.get(v);ee&&(ee.lastSocketError="Browser reported a WebSocket transport error (network/proxy/server)"),e.isConversationStreaming(v)&&(ee?.currentMessageId&&($(ee.currentMessageId,v,"error"),e.updateMessage(ee.currentMessageId,{status:"error"},v)),e.setSessionError("Connection error during streaming",v),e.endSession(v),e.endConversationStreaming(v)),pt.delete(v),T(new Error("WebSocket connection failed. Server may be unavailable."))},N.onclose=L=>{const ee=pt.get(v);if(ee&&c(ee),pt.delete(v),dn.delete(v),e.isConversationStreaming(v)){ee?.currentMessageId&&($(ee.currentMessageId,v,"error"),e.updateMessage(ee.currentMessageId,{status:"error"},v));const re=Fh(L,ee);e.setSessionError(`Connection closed: ${re} (code: ${L.code})`,v),e.endSession(v),e.endConversationStreaming(v)}},N.onmessage=L=>{B(L.data,v)}})}async function y(v,g=3){for(let T=0;T<g;T++){const U=e.conversations.find(ae=>ae.id===v);if(U)return U;T<g-1&&await new Promise(ae=>setTimeout(ae,100))}console.error("[useChatStream] Conversation not found after retries:",v)}function _(v,g){return`${v}:${g}`}function W(v,g){const T=e.conversations.find(ae=>ae.id===v);if(!T)return null;const U=T.messages.findIndex(ae=>ae.id===g);if(U<=0)return null;for(let ae=U-1;ae>=0;ae--){const N=T.messages[ae];if(N.role==="user"&&N.content.trim().length>0)return N.content}return null}async function B(v,g){const T=pt.get(g);if(T){T.lastMessageTime=Date.now();try{e.pushDebugEvent({direction:"in",channel:"ws",eventType:"ws.raw",payload:v},g);const U=JSON.parse(v);if(e.pushDebugEvent({direction:"in",channel:"ws",eventType:U.type,payload:U},g),U.type==="error"){console.error(`[useChatStream] Server error for ${g}:`,U.error);const ae=U.error||"Unknown server error";T.lastServerError=ae;const N=/codex cannot access session files|failed to clean up stale arg0 temp dirs: Permission denied|failed to initialize rollout recorder: Permission denied|failed to create session: Permission denied|\/\.codex\/.*permission denied/i.test(ae);if(/state db missing rollout path for thread/i.test(ae)&&!N){const L=_(g,T.currentMessageId);if(!ur.has(L)){const ee=W(g,T.currentMessageId);if(ee){ur.add(L),e.setProviderSessionId("",g),E(T.currentMessageId,`
|
|
72
|
+
|
|
73
|
+
> **Session Reset**: Codex resume state was corrupted. Retrying once with a fresh session...
|
|
74
|
+
|
|
75
|
+
`,g);try{const re=e.conversations.find(ne=>ne.id===g),J=Ir(re);await ce(ee,T.currentMessageId,g,J);return}catch(re){console.error(`[useChatStream] Rollout-path recovery retry failed for ${g}:`,re)}}}}c(T),$(T.currentMessageId,g,"error"),e.updateMessage(T.currentMessageId,{status:"error"},g),/state db missing rollout path for thread/i.test(ae)&&e.setProviderSessionId("",g),ur.delete(_(g,T.currentMessageId)),e.setSessionError(ae,g),e.endSession(g),e.endConversationStreaming(g),X(g),e.saveConversation(g,!0),m(g);return}if(U.type==="done"){c(T);const ae=h(g,T.currentMessageId);if(ur.delete(_(g,T.currentMessageId)),U.denied){$(T.currentMessageId,g,"error"),e.updateMessage(T.currentMessageId,{status:"stopped"},g),e.endSession(g),e.endConversationStreaming(g),X(g),e.clearPendingPermission(g),T.activeTools.clear(),e.saveConversation(g,!0),m(g);return}if(ae==="error"||ae==="stopped"){$(T.currentMessageId,g,"error"),e.endSession(g),e.endConversationStreaming(g),X(g),e.clearPendingPermission(g),T.activeTools.clear(),e.saveConversation(g,!0),m(g);return}$(T.currentMessageId,g,"complete"),e.completeMessageWithSave(T.currentMessageId,g),e.endSession(g),e.endConversationStreaming(g),s(g);const N=await y(g),j=N?.hasWorktree&&N.worktreePath?$fetch("/api/chat/worktree-commit",{method:"POST",body:{worktreePath:N.worktreePath,conversationId:g,previousBranch:N.worktreeBranch}}).then(ee=>N.previewBranch&&N.worktreePath?$fetch("/api/chat/preview-sync",{method:"POST",body:{previewBranch:N.previewBranch,worktreePath:N.worktreePath}}).then(re=>{if(!re.success)throw new Error(re.error||"Unknown preview sync failure");return ee}):ee).then(async ee=>{if(ee?.success&&ee.currentBranch!==N.worktreeBranch){const re=N.worktreeBranch||"unknown";e.updateWorktreeBranch(g,ee.currentBranch);const J=await e.syncConversationFeatureFromBranch(g),ne=ee.deletedPreviousBranch?` and deleted \`${re}\``:"",se=J?` and linked to feature \`${J}\``:"";E(T.currentMessageId,`
|
|
76
|
+
|
|
77
|
+
> **Branch changed**: AI switched from \`${re}\` to \`${ee.currentBranch}\`${ne}${se}
|
|
78
|
+
|
|
79
|
+
`,g)}else ee?.success&&N.worktreeBranch&&e.updateWorktreeBranch(g,N.worktreeBranch);return e.saveConversation(g,!1),ee}).catch(ee=>{console.warn("[useChatStream] Auto-commit/preview-sync failed:",ee)}):Promise.resolve(),L=dn.get(g);if(L&&L.queue.length>0){const ee=L.queue.shift(),re=L.featureId;j.then(()=>{setTimeout(()=>{Z(g,re,ee)},1500)}),L.queue.length===0&&dn.delete(g)}e.clearPendingPermission(g),e.saveConversation(g,!0),T.activeTools.clear(),m(g),dn.delete(g);return}if(U.type==="pong")return;if(U.type==="session_reset"){console.warn(`[useChatStream] Session reset for ${g}:`,U.reason),e.setProviderSessionId("",g),E(T.currentMessageId,`
|
|
80
|
+
|
|
81
|
+
> **Session Reset**: Previous session could not be resumed. Retrying with a fresh session...
|
|
82
|
+
|
|
83
|
+
`,g);return}if(U.type==="worktree_recovered"){console.log(`[useChatStream] Worktree recovered for ${g}`),E(T.currentMessageId,`
|
|
84
|
+
|
|
85
|
+
> **Worktree recovered**: The work directory was restored after a system restart.
|
|
86
|
+
|
|
87
|
+
`,g);return}if(U.type==="context_reset"){console.log(`[useChatStream] Context reset confirmed for ${g}`);return}if(U.type==="aborted"){console.log(`[useChatStream] Abort confirmed for ${g}`);return}if(U.type==="permission_request"){c(T),e.endConversationStreaming(g);const ae=Oo(U.description||"",U.tool||"Permission");e.setPendingPermission(ae,g);let N=`
|
|
88
|
+
|
|
89
|
+
**Permission Required**: ${ae.tool}`;ae.filePath&&(N+=` - ${ae.filePath}`),E(T.currentMessageId,N+`
|
|
90
|
+
`,g);return}if(U.type==="permission_prompt"&&U.text){c(T),e.endConversationStreaming(g);const ae=Oo(U.text,"Permission");e.setPendingPermission(ae,g);const N=`
|
|
91
|
+
|
|
92
|
+
**${ae.tool}**: ${ae.filePath||ae.command||ae.description}
|
|
93
|
+
`;E(T.currentMessageId,N,g);return}U.type==="ui_event"&&U.event?z(U.event,g):U.type==="provider_json"&&U.data}catch(U){console.error(`[useChatStream] Failed to parse WebSocket message for ${g}:`,U,"Raw data:",v?.slice(0,200)),$(T.currentMessageId,g,"error"),e.updateMessage(T.currentMessageId,{status:"error"},g),e.setSessionError(`Failed to parse server response: ${U instanceof Error?U.message:"Invalid JSON"}`,g),e.endSession(g),e.endConversationStreaming(g),X(g),e.saveConversation(g,!0),m(g)}}}function z(v,g){const T=pt.get(g);if(T)switch(e.pushDebugEvent({direction:"in",channel:"ui",eventType:v.type,payload:v},g),v.sessionId&&e.setProviderSessionId(v.sessionId,g),v.type){case"session_init":{V(T.currentMessageId,g);const U={id:Pn(),type:"session_init",model:v.model,tools:v.tools,permissionMode:v.permissionMode,cwd:v.cwd};e.appendContentBlockWithSave(T.currentMessageId,U,g);break}case"block_start":{V(T.currentMessageId,g);const U=v.blockId||Pn();if(v.blockType==="text"){const ae={id:U,type:"text",text:v.text||""};e.appendContentBlockWithSave(T.currentMessageId,ae,g),T.currentTextBlockId=U}else if(v.blockType==="thinking"){const ae={id:U,type:"thinking",thinking:v.thinking||""};e.appendContentBlockWithSave(T.currentMessageId,ae,g),T.currentThinkingBlockId=U}else if(v.blockType==="tool_use"&&v.toolUseId&&v.name){const ae={id:U,type:"tool_use",toolUseId:v.toolUseId,name:v.name,input:{},inputSummary:"",status:"running"};e.appendContentBlockWithSave(T.currentMessageId,ae,g),T.activeTools.set(v.index??0,{blockId:U,toolUseId:v.toolUseId,name:v.name,inputJson:""})}break}case"block_delta":{if(v.text&&T.currentTextBlockId&&S(T,g,v.text),v.thinking&&T.currentThinkingBlockId&&e.updateBlockWithSave(T.currentMessageId,T.currentThinkingBlockId,U=>{U.type==="thinking"&&(U.thinking+=v.thinking)},g,{syncContent:!1}),v.partialJson&&v.index!==void 0){const U=T.activeTools.get(v.index);U&&(U.inputJson+=v.partialJson)}break}case"block_end":{if(T.currentTextBlockId&&(T.currentTextBlockId=null),T.currentThinkingBlockId&&(T.currentThinkingBlockId=null),v.index!==void 0){const U=T.activeTools.get(v.index);if(U){let ae={};try{ae=JSON.parse(U.inputJson)}catch{}if(U.name==="ExitPlanMode"){const N={allowedPrompts:ae.allowedPrompts};e.setPendingPlanApproval(N,g)}e.updateBlockWithSave(T.currentMessageId,U.blockId,N=>{if(N.type==="tool_use"){const j=N;j.input=ae,j.inputSummary=Ms(ae),j.status="pending"}},g)}}break}case"tool_result":{V(T.currentMessageId,g);const U=e.findToolUseBlock(T.currentMessageId,v.toolUseId,g);U&&U.type==="tool_use"&&e.updateBlockById(T.currentMessageId,U.id,N=>{N.type==="tool_use"&&(N.status=v.isError?"error":"complete")},g);const ae={id:Pn(),type:"tool_result",toolUseId:v.toolUseId,content:v.content||"",isError:!!v.isError};e.appendContentBlockWithSave(T.currentMessageId,ae,g);break}case"permission_request":{c(T),e.endConversationStreaming(g);const U={tool:v.tool,description:v.description,input:v.input,tools:v.tools};e.setPendingPermission(U,g);let ae=`
|
|
94
|
+
|
|
95
|
+
**Permission Required**: ${U.tool}`;E(T.currentMessageId,ae+`
|
|
96
|
+
`,g);break}case"turn_result":{if(v.subtype!=="success"&&(e.updateMessage(T.currentMessageId,{status:"error"},g),X(g),v.subtype==="max_turns"&&e.setSessionError("Maximum conversation turns reached. Please start a new conversation.",g)),v.subtype==="success"&&v.usage){V(T.currentMessageId,g);const U={id:Pn(),type:"result_summary",totalCostUsd:v.totalCostUsd??0,durationMs:v.durationMs??0,numTurns:v.numTurns??0,usage:v.usage};e.appendContentBlockWithSave(T.currentMessageId,U,g)}break}case"error":{e.updateMessage(T.currentMessageId,{status:"error"},g),e.setSessionError(v.error,g);break}}}function V(v,g){e.initContentBlocks(v,g)}function E(v,g,T){V(v,T);const U={id:Pn(),type:"text",text:g};e.appendContentBlockWithSave(v,U,T)}function oe(v,g){return!!e.conversations.find(ae=>ae.id===g)?.messages.find(ae=>ae.id===v)?.contentBlocks?.some(ae=>ae.type==="session_init")}async function ce(v,g,T,U){if(typeof window>"u")return;const ae=Tm();try{const N=await b(T),j=pt.get(T);j&&(j.currentMessageId=g,j.activeTools.clear(),j.currentTextBlockId=null,j.currentThinkingBlockId=null,d(j)),Mm(v)&&e.setProviderSessionId("",T);const ee=e.getProviderSessionId(T),re=e.conversations.find(Se=>Se.id===T),J=re?.providerId||n.providerSelection.providerId||Ko,ne=re?.providerModelKey||n.providerSelection.modelKey||qo;re&&(!re.providerId||!re.providerModelKey)&&(e.setConversationProviderSelection(T,J,ne),e.saveConversation(T,!0));const se={type:"chat",message:v,attachments:U?.attachments,requestId:ae,sessionId:ee||void 0,permissionMode:e.permissionMode,conversationId:T,cwd:U?.cwd,worktreeBranch:U?.worktreeBranch,featureId:U?.featureId,providerId:J,providerModelKey:ne};if(J==="codex"&&!oe(g,T)){V(g,T);const Se=e.permissionMode==="bypass"||e.permissionMode==="auto",pe={id:Pn(),type:"session_init",model:ne,tools:Array.from({length:32},(ue,_e)=>`tool-${_e+1}`),permissionMode:Se?"bypassPermissions":e.permissionMode,cwd:U?.cwd||re?.cwd||""};e.appendContentBlockWithSave(g,pe,T)}e.pushDebugEvent({direction:"out",channel:"ws",eventType:"chat",payload:se},T),N.send(JSON.stringify(se))}catch(N){e.updateMessage(g,{status:"error"},T),e.setSessionError(N.message||"Connection failed",T),e.endSession(T),e.endConversationStreaming(T),e.saveConversation(T,!0),m(T)}}function de(v,g){const T=g??e.activeConversationId;if(!T)return;const U=pt.get(T);if(!U||U.ws.readyState!==WebSocket.OPEN)return;const ae={type:"permission_response",allow:v};e.pushDebugEvent({direction:"out",channel:"ws",eventType:"permission_response",payload:ae},T),U.ws.send(JSON.stringify(ae)),v&&(e.startConversationStreaming(T),d(U));const N=v?"Allowed":"Denied";E(U.currentMessageId,`${N}
|
|
97
|
+
`,T),e.clearPendingPermission(T)}function ge(v,g,T){dn.set(g,{featureId:v,queue:[...T]})}function X(v){v?dn.delete(v):dn.clear()}async function Z(v,g,T){e.activeConversationId!==v&&e.selectConversation(v);let U;if(T.startsWith("skill:")){const L=T.replace("skill:","");try{U=(await $fetch(`/api/skills/${L}/prompt`,{method:"POST",body:{featureId:g}})).prompt}catch(ee){console.error(`[useChatStream] Failed to render skill prompt for ${L}:`,ee);return}}else U=`/speckit.${T} ${g}`;e.addUserMessage(U,v),e.saveConversation(v,!0);const ae=e.conversations.find(L=>L.id===v),N=e.addAssistantMessage(v);e.startSession(Ho(),v),e.startConversationStreaming(v);const j=Ir(ae);await ce(U,N.id,v,j)}function O(v){const g=v??e.activeConversationId;if(!g)return;const T=pt.get(g);if(T){if(T.ws.readyState===WebSocket.OPEN){const U={type:"abort"};e.pushDebugEvent({direction:"out",channel:"ws",eventType:"abort",payload:U},g),T.ws.send(JSON.stringify(U)),T.ws.close()}T.currentMessageId&&($(T.currentMessageId,g,"error"),e.updateMessage(T.currentMessageId,{status:"stopped"},g),e.endSession(g),e.saveConversation(g,!0)),pt.delete(g)}e.endConversationStreaming(g),e.clearPendingPermission(g),X(g)}function G(v){const g=pt.get(v);g&&(c(g),g.ws.close(),pt.delete(v)),dn.delete(v)}function H(){for(const[v,g]of pt)c(g),g.ws.close(),pt.delete(v);dn.clear()}async function K(v){const g=v??e.activeConversationId;if(!g)return;e.clearPendingPlanApproval(g),e.setPermissionMode("auto");const T="Approved. Proceed with the implementation.";e.addUserMessage(T,g),e.saveConversation(g,!0);const U=e.addAssistantMessage(g);e.startSession(Ho(),g),e.startConversationStreaming(g);const ae=e.conversations.find(j=>j.id===g),N=Ir(ae,!0);await ce(T,U.id,g,N)}function I(v){const g=v??e.activeConversationId;g&&e.clearPendingPlanApproval(g)}return wt(()=>{H()}),{sendMessage:ce,sendPermissionResponse:de,approvePlan:K,rejectPlan:I,abort:O,disconnect:H,disconnectConversation:G,enableCascade:ge,disableCascade:X,resetContext:x}}const Hh={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},Oh={class:"px-4 py-3 border-b border-retro-border flex items-center justify-between"},Uh=["disabled"],jh={class:"px-4 py-4 space-y-3"},zh={class:"relative"},Vh=["disabled"],Wh={key:0,value:""},Gh=["value"],qh={key:0,class:"text-xs font-mono text-retro-red"},Kh={key:1,class:"text-xs font-mono text-retro-muted"},Zh={class:"px-4 py-3 border-t border-retro-border flex items-center gap-2 justify-end"},Yh=["disabled"],Xh=["disabled"],Kr=Be({__name:"NewConversationModal",props:{show:{type:Boolean},creating:{type:Boolean}},emits:["close","create"],setup(e,{emit:n}){const t=e,a=n,s=k([]),l=k(""),c=k(!1),d=k(""),h=R(()=>!c.value&&!t.creating&&l.value.length>0&&s.value.length>0);async function m(){c.value=!0,d.value="";try{const $=await $fetch("/api/git/branches"),x=$.branches.filter(y=>!y.isRemote&&!y.name.startsWith("sc/")).map(y=>y.name);if(s.value=x,!x.length){l.value="",d.value="No local branches available for chat creation.";return}const b=($.current&&x.includes($.current)?$.current:"")||(x.includes("main")?"main":"")||(x.includes("master")?"master":"")||x[0];l.value=b}catch($){s.value=[],l.value="",d.value=$ instanceof Error?$.message:"Failed to load branches"}finally{c.value=!1}}De(()=>t.show,$=>{$&&m()});function S(){h.value&&a("create",l.value)}return($,x)=>(i(),he(Xt,{to:"body"},[Y(pn,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:nt(()=>[e.show?(i(),u("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:x[3]||(x[3]=yt(b=>a("close"),["self"]))},[r("div",Hh,[r("div",Oh,[x[4]||(x[4]=r("h3",{class:"text-sm font-mono text-retro-text font-semibold"},"New Conversation",-1)),r("button",{type:"button",class:"p-1 text-retro-muted hover:text-retro-text transition-colors",disabled:e.creating,onClick:x[0]||(x[0]=b=>a("close"))},[Y(o($t),{class:"w-4 h-4"})],8,Uh)]),r("div",jh,[x[5]||(x[5]=r("label",{class:"block text-xs font-mono text-retro-muted"},"Base Branch",-1)),r("div",zh,[Le(r("select",{"onUpdate:modelValue":x[1]||(x[1]=b=>l.value=b),disabled:c.value||e.creating||s.value.length===0,class:"w-full appearance-none bg-retro-black border border-retro-border rounded px-2 py-1.5 pr-7 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan disabled:opacity-40"},[c.value?(i(),u("option",Wh,"Loading branches...")):D("",!0),(i(!0),u(ve,null,Ie(s.value,b=>(i(),u("option",{key:b,value:b},w(b),9,Gh))),128))],8,Vh),[[Bn,l.value]]),Y(o(Qr),{class:"absolute right-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})]),d.value?(i(),u("p",qh,w(d.value),1)):(i(),u("p",Kh," The conversation worktree will be created from the selected branch. "))]),r("div",Zh,[r("button",{type:"button",class:"px-3 py-1.5 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",disabled:e.creating,onClick:x[2]||(x[2]=b=>a("close"))}," Cancel ",8,Yh),r("button",{type:"button",disabled:!h.value,class:"px-3 py-1.5 text-xs font-mono rounded border bg-retro-cyan/10 border-retro-cyan/50 text-retro-cyan hover:bg-retro-cyan/20 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",onClick:S},w(e.creating?"Creating...":"Create"),9,Xh)])])])):D("",!0)]),_:1})]))}}),Qh={class:"h-full flex flex-col bg-retro-black"},Jh={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border"},ep={class:"flex items-center gap-2 min-w-0"},tp={class:"flex items-center gap-1"},np={class:"flex-shrink-0 px-3 pt-3"},rp={class:"relative"},op={class:"flex-1 overflow-y-auto p-3"},sp={class:"space-y-2"},ap={key:0,class:"flex items-center justify-center py-12"},ip={key:1,class:"flex flex-col items-center justify-center py-12 text-center"},lp={key:2,class:"flex flex-col items-center justify-center py-12 text-center"},cp=Be({__name:"FeaturesPanel",setup(e){const n=At(),t=_r(),{sendMessage:a,enableCascade:s}=po(),l=On(),c=k("features"),d=k(null),h=k(null),m=k([]),S=k([]),$=k(!1),x=k(!1),b=k(null),y=k(!1),_=k(!1),W=k(!1),B=k(null),z=k(""),V=k("");let E=null;De(z,pe=>{E&&clearTimeout(E),E=setTimeout(()=>{V.value=pe},300)});const oe=R(()=>{const pe=V.value.trim().toLowerCase();return pe?m.value.filter(ue=>ue.name.toLowerCase().includes(pe)||ue.id.toLowerCase().includes(pe)):m.value}),ce=k({}),de=R(()=>{const pe=n.activeConversation;if(!pe)return null;if(pe.featureId)return pe.featureId;const ue=pe.worktreeBranch?.trim();return ue&&m.value.some(_e=>_e.id===ue)?ue:null}),ge=R(()=>d.value||de.value);De(()=>n.activeConversationId,()=>{const pe=de.value;pe&&Yt(()=>{const ue=ce.value[pe];ue&&ue.scrollIntoView({behavior:"auto",block:"nearest"})})}),De(d,pe=>{pe&&Yt(()=>{const ue=ce.value[pe];ue&&ue.scrollIntoView({behavior:"auto",block:"nearest"})})});async function X(){$.value=!0;try{const pe=await $fetch("/api/specs/features");m.value=pe.features}catch{l.error("Failed to load features"),m.value=[]}finally{$.value=!1}}async function Z(){try{const pe=await $fetch("/api/skills");S.value=pe.skills}catch{S.value=[]}}vt(()=>{X(),Z(),window.addEventListener("keydown",H)}),wt(()=>{window.removeEventListener("keydown",H)});function O(pe,ue={}){if(d.value=pe,h.value=null,c.value="files",t.setSelectedFeatureId(pe),ue.openViewer!==!1){const _e=m.value.find(Pe=>Pe.id===pe);_e&&(b.value=_e,x.value=!0)}}function G(){x.value=!1,b.value=null}function H(pe){(pe.ctrlKey||pe.metaKey)&&pe.key.toLowerCase()==="k"&&(pe.preventDefault(),y.value||(y.value=!0))}function K(){y.value=!1}function I(pe){O(pe,{openViewer:!1}),y.value=!1}function v(){y.value=!0}const g=R(()=>m.value.map(pe=>pe.id)),T={plan:["tasks","implement"],tasks:["implement"],implement:[],clarify:[],analyze:[]},U={analyze:["skill:better-spec"]};async function ae(pe,ue){if(pe.startsWith("skill:")){const _e=pe.replace("skill:","");return(await $fetch(`/api/skills/${_e}/prompt`,{method:"POST",body:{featureId:ue}})).prompt}return`/speckit.${pe} ${ue}`}function N(pe,ue){if(ue)return null;const _e=n.findConversationByFeature(pe);return _e&&!n.isConversationStreaming(_e.id)?(n.selectConversation(_e.id),_e.id):null}async function j(pe,ue,_e){const Pe=await n.createConversation({featureId:pe,baseBranch:_e});if(!Pe)throw new Error("Failed to create conversation");return n.renameConversation(Pe,ue),n.selectConversation(Pe),Pe}async function L(pe,ue){n.addUserMessage(ue,pe),n.saveConversation(pe,!0);const _e=n.conversations.find(qe=>qe.id===pe),Pe=n.addAssistantMessage(pe);n.startSession(`session-${Date.now()}`,pe),n.startConversationStreaming(pe);const Fe={};_e?.worktreePath&&(Fe.cwd=_e.worktreePath,Fe.worktreeBranch=_e.worktreeBranch),_e?.featureId&&(Fe.featureId=_e.featureId),await a(ue,Pe.id,pe,Object.keys(Fe).length>0?Fe:void 0)}async function ee(pe,ue,_e){const Pe=U[ue];let Fe;if(Pe&&Pe.length>0){const qe=[...Pe.slice(1),ue,...T[ue]||[]];s(pe,_e,qe);const Qe=Pe[0];try{Fe=await ae(Qe,pe)}catch(Je){l.error(Je instanceof Error?Je.message:"Failed to resolve prerequisite step");return}}else{const qe=T[ue]||[];qe.length>0&&s(pe,_e,qe),Fe=`/speckit.${ue} ${pe}`}await L(_e,Fe)}async function re(pe,ue,_e){const Pe=pe.shiftKey,Fe=N(ue,Pe);if(Fe){try{await ee(ue,_e,Fe)}catch(qe){l.error(qe instanceof Error?qe.message:"Failed to run cascade action")}return}B.value={type:"cascade",featureId:ue,command:_e,title:`${_e}: ${ue}`},_.value=!0}async function J(pe,ue){B.value={type:"open-chat",featureId:ue,title:`spec: ${ue}`},_.value=!0}async function ne(pe,ue,_e){let Pe;try{Pe=await $fetch(`/api/skills/${ue}/prompt`,{method:"POST",body:{featureId:pe}})}catch(Fe){throw new Error(Fe instanceof Error?Fe.message:"Failed to render skill prompt")}await L(_e,Pe.prompt)}async function se(pe,ue,_e){const Pe=pe.shiftKey,Fe=N(ue,Pe);if(Fe){try{await ne(ue,_e,Fe)}catch(qe){l.error(qe instanceof Error?qe.message:"Failed to run skill")}return}B.value={type:"skill",featureId:ue,skillId:_e,title:`skill: ${_e} — ${ue}`},_.value=!0}function Se(){_.value=!1,B.value=null}async function je(pe){if(B.value){W.value=!0;try{const ue=B.value,_e=await j(ue.featureId,ue.title,pe);ue.type==="cascade"?await ee(ue.featureId,ue.command,_e):ue.type==="skill"&&await ne(ue.featureId,ue.skillId,_e),_.value=!1,B.value=null}catch(ue){l.error(ue instanceof Error?ue.message:"Failed to create conversation")}finally{W.value=!1}}}return(pe,ue)=>{const _e=Bm,Pe=Vm,Fe=lh,qe=Dh;return i(),u("div",Qh,[r("div",Jh,[r("div",ep,[Y(_e)]),r("div",tp,[r("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Search (Ctrl/Cmd+K)",onClick:v},[Y(o(Mn),{class:"h-4 w-4"})]),r("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Refresh",onClick:X},[Y(o(Tn),{class:ke(["h-4 w-4",{"animate-spin":o($)}])},null,8,["class"])])])]),r("div",np,[r("div",rp,[Y(o(Mn),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-retro-subtle"}),Le(r("input",{"onUpdate:modelValue":ue[0]||(ue[0]=Qe=>We(z)?z.value=Qe:null),type:"text",placeholder:"Search features...",class:"w-full pl-8 pr-3 py-1.5 text-xs font-mono rounded border border-retro-border bg-retro-panel text-retro-text placeholder:text-retro-subtle focus:outline-none focus:border-retro-cyan transition-colors"},null,512),[[Ct,o(z)]])])]),r("div",op,[r("div",sp,[(i(!0),u(ve,null,Ie(o(oe),Qe=>(i(),u("div",{key:Qe.id,ref_for:!0,ref:Je=>{o(ce)[Qe.id]=Je}},[Y(Pe,{feature:Qe,skills:o(S),"is-active":o(ge)===Qe.id,onSelect:ue[1]||(ue[1]=Je=>O(Je,{openViewer:!0})),onCascade:re,onOpenChat:J,onSkill:se},null,8,["feature","skills","is-active"])]))),128))]),o($)&&o(m).length===0?(i(),u("div",ap,[...ue[2]||(ue[2]=[r("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading features...",-1)])])):D("",!0),!o($)&&o(m).length>0&&o(oe).length===0?(i(),u("div",ip,[Y(o(Mn),{class:"h-10 w-10 text-retro-subtle mb-3"}),ue[3]||(ue[3]=r("p",{class:"text-sm font-mono text-retro-muted"},"No matching features",-1)),ue[4]||(ue[4]=r("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," Try a different search term ",-1))])):D("",!0),!o($)&&o(m).length===0?(i(),u("div",lp,[Y(o(ia),{class:"h-10 w-10 text-retro-subtle mb-3"}),ue[5]||(ue[5]=r("p",{class:"text-sm font-mono text-retro-muted"},"No features found",-1)),ue[6]||(ue[6]=r("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," Create a feature in specs/ to get started ",-1))])):D("",!0)]),o(x)&&o(b)?(i(),he(Fe,{key:0,feature:o(b),onClose:G},null,8,["feature"])):D("",!0),o(y)?(i(),he(qe,{key:1,"available-feature-ids":o(g),onClose:K,onSelect:I},null,8,["available-feature-ids"])):D("",!0),Y(Kr,{show:o(_),creating:o(W),onClose:Se,onCreate:je},null,8,["show","creating"])])}}}),up={class:"flex items-start justify-between gap-2"},dp={class:"flex-1 min-w-0"},fp={key:1,class:"flex items-center gap-2"},mp={key:0,class:"flex-shrink-0 relative"},hp={class:"text-sm font-mono text-retro-text truncate"},pp={key:2,class:"text-xs font-mono text-retro-green bg-retro-green/10 px-1.5 py-0.5 rounded flex-shrink-0"},vp={key:5,class:"text-xs font-mono text-retro-yellow bg-retro-yellow/10 px-1.5 py-0.5 rounded flex-shrink-0"},gp={key:6,class:"text-xs font-mono text-retro-cyan bg-retro-cyan/10 px-1.5 py-0.5 rounded flex-shrink-0"},xp=["title"],bp={class:"text-xs text-retro-muted mt-1 truncate pl-6"},yp={class:"text-xs text-retro-muted/60 mt-1 pl-6"},wp={class:"truncate"},kp={class:"truncate"},Cp={class:"truncate"},$p=Be({__name:"ConversationItem",props:{conversation:{},isActive:{type:Boolean},isStreaming:{type:Boolean},isPreviewing:{type:Boolean},autoModeTask:{}},emits:["select","archive","rename"],setup(e,{emit:n}){const t=e,a=n,s=k(!1),l=k("");function c(){l.value=t.conversation.title,s.value=!0}function d(){const b=l.value.trim();b&&b!==t.conversation.title&&a("rename",b),s.value=!1}function h(){s.value=!1}const m=On();async function S(b){try{await navigator.clipboard.writeText(b),m.success("Copied to clipboard",1500)}catch{m.error("Failed to copy")}}const $=R(()=>{const b=t.conversation.messages;if(!b.length)return"No messages";const y=b[b.length-1],_=y.content.slice(0,60);return _.length<y.content.length?_+"...":_}),x=R(()=>{const b=new Date(t.conversation.updatedAt),_=new Date().getTime()-b.getTime(),W=Math.floor(_/(1e3*60*60*24));return W===0?b.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):W===1?"Yesterday":W<7?`${W} days ago`:b.toLocaleDateString()});return(b,y)=>(i(),u("div",{class:ke(["p-3 rounded border cursor-pointer transition-colors",[e.isPreviewing&&e.isActive?"border-retro-red bg-retro-red/20 ring-1 ring-retro-red/60 shadow-[0_0_0_1px_rgba(248,113,113,0.35)]":e.isPreviewing?"border-retro-red/40 bg-retro-red/10":e.isActive?"border-retro-cyan bg-retro-cyan/10":"border-retro-border hover:border-retro-cyan/50"]]),onClick:y[8]||(y[8]=_=>a("select"))},[r("div",up,[r("div",dp,[s.value?(i(),u("div",{key:0,class:"flex gap-2",onClick:y[1]||(y[1]=yt(()=>{},["stop"]))},[Le(r("input",{"onUpdate:modelValue":y[0]||(y[0]=_=>l.value=_),onKeyup:[hn(d,["enter"]),hn(h,["escape"])],onBlur:d,class:"flex-1 px-2 py-1 text-sm font-mono bg-retro-black border border-retro-cyan rounded text-retro-text focus:outline-none focus:ring-1 focus:ring-retro-cyan",autofocus:""},null,544),[[Ct,l.value]])])):(i(),u("div",fp,[e.isStreaming?(i(),u("div",mp,[...y[9]||(y[9]=[r("div",{class:"w-4 h-4 rounded-full bg-retro-cyan/30 animate-pulse"},null,-1),r("div",{class:"absolute inset-0 flex items-center justify-center"},[r("div",{class:"w-2 h-2 rounded-full bg-retro-cyan animate-ping"})],-1)])])):(i(),he(o(ts),{key:1,class:"w-4 h-4 text-retro-muted flex-shrink-0 -translate-y-px"})),r("h3",hp,w(e.conversation.title),1),e.conversation.finalized?(i(),u("span",pp," finalized ")):e.isPreviewing?(i(),u("span",{key:3,class:ke(["text-xs font-mono px-1.5 py-0.5 rounded flex-shrink-0",e.isActive?"text-retro-red bg-retro-red/20 border border-retro-red/40":"text-retro-red bg-retro-red/10"])}," previewing ",2)):D("",!0),e.conversation.autoMode&&e.autoModeTask?(i(),u("span",{key:4,class:ke(["text-xs font-mono px-1.5 py-0.5 rounded flex-shrink-0",{"text-retro-yellow bg-retro-yellow/10":e.autoModeTask.state==="running"||e.autoModeTask.state==="queued","text-retro-green bg-retro-green/10":e.autoModeTask.state==="completed","text-retro-red bg-retro-red/10":e.autoModeTask.state==="failed","text-retro-muted bg-retro-muted/10":e.autoModeTask.state==="skipped"}])},[e.autoModeTask.state==="running"&&e.autoModeTask.currentStep?(i(),u(ve,{key:0},[Ae(w(e.autoModeTask.currentStep),1)],64)):e.autoModeTask.state==="queued"?(i(),u(ve,{key:1},[Ae("queued")],64)):e.autoModeTask.state==="completed"?(i(),u(ve,{key:2},[Ae("done")],64)):e.autoModeTask.state==="failed"?(i(),u(ve,{key:3},[Ae("failed")],64)):e.autoModeTask.state==="skipped"?(i(),u(ve,{key:4},[Ae("skipped")],64)):(i(),u(ve,{key:5},[Ae("auto")],64))],2)):e.conversation.autoMode?(i(),u("span",vp," auto ")):D("",!0),e.isStreaming?(i(),u("span",gp," streaming ")):D("",!0)])),e.autoModeTask?.state==="failed"&&e.autoModeTask.error?(i(),u("p",{key:2,class:"text-xs text-retro-red mt-1 truncate pl-6",title:e.autoModeTask.error},w(e.autoModeTask.error),9,xp)):D("",!0),r("p",bp,w($.value),1),r("p",yp,w(x.value),1),e.conversation.worktreeBranch||e.conversation.baseBranch?(i(),u("div",{key:3,class:"mt-1.5 pl-6 flex flex-wrap gap-1",onClick:y[5]||(y[5]=yt(()=>{},["stop"]))},[e.conversation.baseBranch?(i(),u("button",{key:0,onClick:y[2]||(y[2]=_=>S(e.conversation.baseBranch)),class:"inline-flex items-center gap-1 px-1.5 py-0.5 text-xs font-mono rounded border border-retro-cyan/30 text-retro-cyan hover:border-retro-cyan hover:bg-retro-cyan/10 transition-colors max-w-full",title:"Click to copy base branch"},[Y(o(Hr),{class:"w-3 h-3 flex-shrink-0"}),r("span",wp,"base: "+w(e.conversation.baseBranch),1)])):D("",!0),r("button",{onClick:y[3]||(y[3]=_=>S(e.conversation.worktreeBranch)),class:"inline-flex items-center gap-1 px-1.5 py-0.5 text-xs font-mono rounded border border-retro-green/30 text-retro-green hover:border-retro-green hover:bg-retro-green/10 transition-colors max-w-full",title:"Click to copy branch"},[Y(o(Hr),{class:"w-3 h-3 flex-shrink-0"}),r("span",kp,w(e.conversation.worktreeBranch),1)]),e.conversation.worktreePath?(i(),u("button",{key:1,onClick:y[4]||(y[4]=_=>S(e.conversation.worktreePath)),class:"inline-flex items-center gap-1 px-1.5 py-0.5 text-xs font-mono rounded border border-retro-muted/30 text-retro-muted hover:border-retro-muted hover:bg-retro-muted/10 transition-colors max-w-full",title:"Click to copy path"},[Y(o(Or),{class:"w-3 h-3 flex-shrink-0"}),r("span",Cp,w(e.conversation.worktreePath),1)])):D("",!0)])):D("",!0)]),r("div",{class:"flex gap-1 flex-shrink-0",onClick:y[7]||(y[7]=yt(()=>{},["stop"]))},[r("button",{onClick:c,class:"p-1 hover:bg-retro-panel rounded transition-colors",title:"Rename conversation"},[Y(o(ls),{class:"w-4 h-4 text-retro-muted hover:text-retro-cyan"})]),r("button",{onClick:y[6]||(y[6]=_=>a("archive")),class:"p-1 hover:bg-retro-cyan/20 rounded transition-colors",title:"Archive conversation"},[Y(o(Fr),{class:"w-4 h-4 text-retro-muted hover:text-retro-cyan"})])])])],2))}}),Sp={class:"h-full flex flex-col bg-retro-black"},_p={class:"flex-shrink-0 px-3 py-2 border-b border-retro-border space-y-2"},Mp={class:"flex items-center justify-between gap-2"},Tp={class:"flex items-center gap-1"},Ap={class:"relative"},Bp=["placeholder"],Ep={key:0,class:"flex-shrink-0 flex items-center gap-2 px-3 py-2 bg-retro-yellow/10 border-b border-retro-yellow/30 text-xs"},Rp={class:"text-retro-yellow font-mono"},Pp={class:"flex-1 overflow-y-auto p-2"},Dp={key:0,class:"space-y-1"},Ip={key:1,class:"text-center py-6 text-retro-muted"},Lp={class:"font-mono text-xs"},Np={key:1,class:"text-center py-8 text-retro-muted"},Fp={key:0,class:"space-y-2"},Hp={class:"flex items-start justify-between gap-2"},Op={class:"min-w-0"},Up={class:"text-sm font-mono text-retro-text truncate"},jp={class:"text-xs text-retro-muted mt-1 truncate"},zp={class:"text-xs text-retro-muted/70 mt-1"},Vp={class:"text-xs text-retro-muted/70"},Wp={class:"flex items-center gap-1 flex-shrink-0"},Gp=["onClick"],qp=["onClick"],Kp={key:1,class:"text-center py-6 text-retro-muted"},Zp={class:"font-mono text-xs"},Yp={key:1,class:"text-center py-8 text-retro-muted"},Xp=Be({__name:"ConversationsPanel",setup(e){const n=At(),t=Ts(),a=On(),s=R(()=>{const N=new Map;for(const j of t.tasks)N.set(j.featureId,j);return N}),l=R(()=>{const N=new Map;for(const j of t.tasks)N.set(j.featureId,`${j.state}|${j.currentStep||""}|${j.error||""}`);return N});function c(N){if(N)return s.value.get(N)}function d(N){return N&&l.value.get(N)||""}const h=k(""),m=k(""),S=k(!1),$=k(!1),x=k(!1),b=k(!1),y=k(null);let _=null;De(h,N=>{_&&clearTimeout(_),_=setTimeout(()=>{m.value=N},180)},{immediate:!0}),wt(()=>{_&&(clearTimeout(_),_=null)});const W=new Map,B=new Map;De(()=>n.sortedConversations.map(N=>N.id),N=>{const j=new Set(N);for(const L of W.keys())j.has(L)||W.delete(L)},{immediate:!0}),De(()=>n.sortedArchivedConversations.map(N=>N.id),N=>{const j=new Set(N);for(const L of B.keys())j.has(L)||B.delete(L)},{immediate:!0});function z(N){const j=N.messages[N.messages.length-1];return[N.updatedAt,N.title,N.messages.length,j?.id||"",j?.content?.length||0].join("|")}function V(N){const j=N.messages[N.messages.length-1];return[N.updatedAt,N.archivedAt,N.title,N.messages.length,j?.id||"",j?.content?.length||0].join("|")}function E(N){const j=z(N),L=W.get(N.id);if(L&&L.signature===j)return L.text;const ee=[N.title,...N.messages.map(re=>re.content||"")].join(`
|
|
98
|
+
`).toLowerCase();return W.set(N.id,{signature:j,text:ee}),ee}function oe(N){const j=V(N),L=B.get(N.id);if(L&&L.signature===j)return L.text;const ee=[N.title,...N.messages.map(re=>re.content||"")].join(`
|
|
99
|
+
`).toLowerCase();return B.set(N.id,{signature:j,text:ee}),ee}const ce=R(()=>n.conversationViewMode==="archive"),de=R(()=>{const N=n.sortedConversations;if(!m.value.trim())return N;const j=m.value.toLowerCase().trim();return N.filter(L=>E(L).includes(j))}),ge=R(()=>{const N=n.sortedArchivedConversations;if(!m.value.trim())return N;const j=m.value.toLowerCase().trim();return N.filter(L=>oe(L).includes(j))}),X=R(()=>n.previewingConversationId);async function Z(){if(n.checkStorageLimits().atLimit){a.error("Delete or archive a conversation first (limit: 100).");return}S.value=!0}async function O(N){$.value=!0;try{if(!await n.createConversation({baseBranch:N})){a.error("Failed to create conversation");return}S.value=!1}catch(j){a.error(j instanceof Error?j.message:"Failed to create conversation")}finally{$.value=!1}}function G(N){n.selectConversation(N),n.setConversationViewMode("active")}async function H(N){const j=await n.archiveConversation(N);if(!j.success){a.error(j.error||"Failed to archive conversation");return}a.success("Conversation archived")}async function K(N){y.value=N,x.value=!0}function I(){x.value=!1,y.value=null}async function v(N){if(y.value){b.value=!0;try{const j=await n.restoreArchivedConversation(y.value,N);if(!j.success){a.error(j.error||"Failed to restore archived conversation");return}a.success("Archived conversation restored"),x.value=!1,y.value=null}finally{b.value=!1}}}async function g(N){const j=await n.deleteArchivedConversation(N);if(!j.success){a.error(j.error||"Failed to delete archived conversation");return}a.success("Archived conversation deleted")}function T(N,j){n.renameConversation(N,j)}function U(N){return new Date(N).toLocaleString()}function ae(N){if(!N.length)return"No messages";const L=(N[N.length-1].content||"").trim();return L?L.length>80?`${L.slice(0,80)}...`:L:"No messages"}return(N,j)=>(i(),u("div",Sp,[r("div",_p,[r("div",Mp,[r("button",{onClick:Z,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"New conversation","aria-label":"New conversation"},[Y(o(br),{class:"w-4 h-4"})]),r("div",Tp,[r("button",{onClick:j[0]||(j[0]=L=>o(n).setConversationViewMode("active")),class:ke(["p-1.5 rounded transition-colors",ce.value?"text-retro-muted hover:text-retro-cyan hover:bg-retro-panel":"text-retro-cyan bg-retro-cyan/10"]),title:"Active conversations","aria-label":"Active conversations"},[Y(o(Js),{class:"w-4 h-4"})],2),r("button",{onClick:j[1]||(j[1]=L=>o(n).setConversationViewMode("archive")),class:ke(["p-1.5 rounded transition-colors",ce.value?"text-retro-cyan bg-retro-cyan/10":"text-retro-muted hover:text-retro-cyan hover:bg-retro-panel"]),title:"Archived conversations","aria-label":"Archived conversations"},[Y(o(Fr),{class:"w-4 h-4"})],2)])]),r("div",Ap,[Y(o(Mn),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted"}),Le(r("input",{"onUpdate:modelValue":j[2]||(j[2]=L=>h.value=L),type:"text",placeholder:ce.value?"Search archive...":"Search conversations...",class:"w-full pl-8 pr-3 py-1.5 text-xs font-mono bg-retro-black border border-retro-border rounded focus:border-retro-cyan focus:outline-none focus:ring-1 focus:ring-retro-cyan text-retro-text placeholder-retro-muted"},null,8,Bp),[[Ct,h.value]])])]),o(n).isNearStorageLimit?(i(),u("div",Ep,[Y(o(wn),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),r("p",Rp,w(o(n).conversationCount)+" active conversations. Limit is 100. ",1)])):D("",!0),r("div",Pp,[ce.value?(i(),u(ve,{key:1},[o(n).hasArchivedConversations?(i(),u("div",Fp,[ge.value.length>0?(i(!0),u(ve,{key:0},Ie(ge.value,(L,ee,re,J)=>{const ne=[L.id,L.title,L.updatedAt,L.archivedAt,L.messages.length];if(J&&J.key===L.id&&go(J,ne))return J;const se=(i(),u("div",{key:L.id,onClick:Se=>K(L.id),onKeydown:[hn(yt(Se=>K(L.id),["prevent"]),["enter"]),hn(yt(Se=>K(L.id),["prevent"]),["space"])],class:"w-full text-left p-3 rounded border border-retro-border hover:border-retro-cyan/50 hover:bg-retro-cyan/5 transition-colors",role:"button",tabindex:"0"},[r("div",Hp,[r("div",Op,[r("h3",Up,w(L.title),1),r("p",jp,w(ae(L.messages)),1),r("p",zp," Archived: "+w(U(L.archivedAt)),1),r("p",Vp," Updated: "+w(U(L.updatedAt)),1)]),r("div",Wp,[r("button",{onClick:yt(Se=>K(L.id),["stop"]),class:"inline-flex items-center gap-1 px-2 py-1 text-xs font-mono border border-retro-cyan/40 text-retro-cyan rounded hover:bg-retro-cyan/10 transition-colors",title:"Restore archived conversation"},[Y(o(Fr),{class:"w-3.5 h-3.5"}),j[9]||(j[9]=Ae(" Restore ",-1))],8,Gp),r("button",{onClick:yt(Se=>g(L.id),["stop"]),class:"inline-flex items-center gap-1 px-2 py-1 text-xs font-mono border border-red-400/40 text-red-300 rounded hover:bg-red-500/10 transition-colors",title:"Delete archived conversation"},[Y(o(vn),{class:"w-3.5 h-3.5"}),j[10]||(j[10]=Ae(" Delete ",-1))],8,qp)])])],40,["onClick","onKeydown"]));return se.memo=ne,se},j,5),128)):(i(),u("div",Kp,[r("p",Zp,'No archived results for "'+w(h.value)+'"',1)]))])):(i(),u("div",Yp,[...j[11]||(j[11]=[r("p",{class:"font-mono text-sm"},"No archived conversations",-1),r("p",{class:"text-xs mt-1"},"Archived conversations will appear here",-1)])]))],64)):(i(),u(ve,{key:0},[o(n).hasConversations?(i(),u("div",Dp,[de.value.length>0?(i(!0),u(ve,{key:0},Ie(de.value,(L,ee,re,J)=>{const ne=[L.id,L.title,L.updatedAt,L.messages.length,L.finalized,L.id===o(n).activeConversationId,o(n).isConversationStreaming(L.id),X.value===L.id,d(L.featureId)];if(J&&J.key===L.id&&go(J,ne))return J;const se=(i(),u("div",{key:L.id},[Y($p,{conversation:L,"is-active":L.id===o(n).activeConversationId,"is-streaming":o(n).isConversationStreaming(L.id),"is-previewing":X.value===L.id,"auto-mode-task":L.autoMode?c(L.featureId):void 0,onSelect:Se=>G(L.id),onArchive:Se=>H(L.id),onRename:Se=>T(L.id,Se)},null,8,["conversation","is-active","is-streaming","is-previewing","auto-mode-task","onSelect","onArchive","onRename"])]));return se.memo=ne,se},j,3),128)):(i(),u("div",Ip,[r("p",Lp,'No results for "'+w(h.value)+'"',1)]))])):(i(),u("div",Np,[...j[8]||(j[8]=[r("p",{class:"font-mono text-sm"},"No conversations",-1),r("p",{class:"text-xs mt-1"},'Click "New" to start',-1)])]))],64))]),Y(Kr,{show:S.value,creating:$.value,onClose:j[7]||(j[7]=L=>S.value=!1),onCreate:O},null,8,["show","creating"]),Y(Kr,{show:x.value,creating:b.value,onClose:I,onCreate:v},null,8,["show","creating"])]))}}),Qp={mobile:768,tablet:1024};function Jp(e,n){return e<n.mobile?"mobile":e<n.tablet?"tablet":"desktop"}const As=xr("layout",{state:()=>({currentViewport:"desktop",chatFullscreen:!1}),getters:{isMobile:e=>e.currentViewport==="mobile",isTablet:e=>e.currentViewport==="tablet",isDesktop:e=>e.currentViewport==="desktop",isChatFullscreen:e=>e.chatFullscreen},actions:{updateViewport(e){this.currentViewport=Jp(e,Qp)},toggleChatFullscreen(){this.chatFullscreen=!this.chatFullscreen},setChatFullscreen(e){this.chatFullscreen=e}}});function ev(){const e=k(null),n=k(!0);let t=null,a="smooth";const s=50;function l(){const x=e.value;return x?x.scrollHeight-x.scrollTop-x.clientHeight<s:!0}function c(){n.value=l()}function d(x="smooth"){if(a=x,t!==null)return;t=(typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):y=>setTimeout(()=>y(Date.now()),16))(()=>{t=null,Yt(()=>{const y=e.value;y&&y.scrollTo({top:y.scrollHeight,behavior:a})})})}function h(x="smooth"){d(x),n.value=!0}function m(x="smooth"){n.value&&d(x)}function S(){n.value=!0}function $(){n.value=!1}return{containerRef:e,shouldAutoScroll:Ce(n),onScroll:c,scrollToBottom:d,forceScrollToBottom:h,maybeScrollToBottom:m,enableAutoScroll:S,disableAutoScroll:$}}function tv(e){if(!e)return null;if(e instanceof HTMLElement)return e;if(typeof e=="object"&&"$el"in e){const n=e.$el;return n instanceof HTMLElement?n:null}return null}function nv(e){const{allMessages:n,containerRef:t,estimateItemHeight:a=120,overscan:s=6}=e,l=k(0),c=k(0),d=k(new Map),h=new Map;let m=null;function S(z,V){if(!Number.isFinite(V)||V<=0)return;const E=Math.ceil(V);if(d.value.get(z)===E)return;const oe=new Map(d.value);oe.set(z,E),d.value=oe}function $(z,V){S(z,V.getBoundingClientRect().height)}function x(z,V){const E=h.get(z);E&&m&&m.unobserve(E),E&&delete E.dataset.virtualMessageId,h.delete(z);const oe=tv(V);oe&&(oe.dataset.virtualMessageId=z,h.set(z,oe),$(z,oe),m&&m.observe(oe))}function b(){const z=t.value;z&&(l.value=z.scrollTop)}const y=R(()=>{const z=n.value,V=new Array(z.length);let E=0;for(let oe=0;oe<z.length;oe++)V[oe]=E,E+=d.value.get(z[oe].id)??a;return{offsets:V,totalHeight:E}});function _(z,V){let E=0,oe=z.length-1,ce=z.length;for(;E<=oe;){const de=Math.floor((E+oe)/2);z[de]>=V?(ce=de,oe=de-1):E=de+1}return ce===z.length?Math.max(0,z.length-1):ce}const W=R(()=>{const z=n.value;if(z.length===0)return[];const{offsets:V}=y.value,E=l.value,oe=E+Math.max(c.value,1),ce=_(V,Math.max(0,E-a));let de=ce;for(;de<z.length&&V[de]<oe;)de++;const ge=Math.max(0,ce-s),X=Math.min(z.length,de+s),Z=[];for(let O=ge;O<X;O++)Z.push({message:z[O],index:O,top:V[O]});return Z}),B=R(()=>y.value.totalHeight);return vt(()=>{const z=t.value;z&&(c.value=z.clientHeight,l.value=z.scrollTop),m=new ResizeObserver(V=>{for(const E of V){const oe=E.target;if(t.value&&oe===t.value){c.value=E.contentRect.height;continue}const ce=oe.dataset.virtualMessageId;ce&&S(ce,E.contentRect.height)}}),t.value&&m.observe(t.value);for(const[V,E]of h)E.dataset.virtualMessageId=V,m.observe(E),$(V,E)}),wt(()=>{m&&(m.disconnect(),m=null),h.clear()}),{visibleItems:W,totalHeight:B,onVirtualScroll:b,setItemRef:x}}const rv=["innerHTML"],ov=Be({__name:"ChatTextBlock",props:{block:{}},setup(e){const n=e,{renderMarkdown:t}=Mr(),a=R(()=>t(n.block.text));return(s,l)=>e.block.text.trim()?(i(),u("div",{key:0,class:"text-sm font-mono text-retro-text break-words chat-markdown",innerHTML:o(a)},null,8,rv)):D("",!0)}}),sv={class:"my-1 border border-retro-border/30 rounded bg-retro-dark/30"},av={key:0,class:"text-retro-muted/80 truncate min-w-0"},iv={class:"ml-auto text-retro-muted/60 text-[10px]"},lv={key:0,class:"px-3 pb-2 text-xs font-mono text-retro-muted whitespace-pre-wrap max-h-60 overflow-y-auto scrollbar-custom border-t border-retro-border/20"},cv=Be({__name:"ChatThinkingBlock",props:{block:{}},setup(e){const n=e,t=k(!1),a=R(()=>n.block.thinking.split(`
|
|
100
|
+
`).length),s=R(()=>n.block.thinking.length>0&&n.block.thinking.length<=240&&a.value<=6),l=R(()=>{const c=n.block.thinking.replace(/\s+/g," ").trim();return c?c.length>140?`${c.slice(0,140)}...`:c:""});return De(()=>n.block.id,()=>{t.value=s.value},{immediate:!0}),(c,d)=>(i(),u("div",sv,[r("button",{class:"flex items-center gap-2 w-full px-3 py-1.5 text-xs font-mono text-retro-muted hover:text-retro-yellow transition-colors",onClick:d[0]||(d[0]=h=>t.value=!o(t))},[Y(o(Xr),{class:ke(["w-3 h-3 transition-transform flex-shrink-0",{"rotate-90":o(t)}])},null,8,["class"]),d[1]||(d[1]=r("span",{class:"text-retro-yellow"},"Thinking",-1)),!o(t)&&o(l)?(i(),u("span",av,w(o(l)),1)):D("",!0),r("span",iv,w(o(a))+" lines · "+w(e.block.thinking.length)+" chars ",1)]),o(t)?(i(),u("div",lv,w(e.block.thinking),1)):D("",!0)]))}}),uv={class:"my-2 border border-retro-border/40 rounded bg-retro-dark/30"},dv={key:0,class:"w-3 h-3 border-2 border-retro-yellow border-t-transparent rounded-full animate-spin flex-shrink-0"},fv={class:"text-retro-muted"},mv={class:"text-retro-cyan font-bold"},hv={class:"text-retro-muted truncate"},pv={key:0,class:"px-3 pb-2 border-t border-retro-border/20"},vv={key:0,class:"mt-2"},gv={class:"text-xs font-mono text-retro-muted bg-retro-panel p-2 rounded overflow-x-auto max-h-36 overflow-y-auto scrollbar-custom whitespace-pre-wrap"},xv={class:"text-xs font-mono text-retro-muted space-y-2 mt-2"},bv={key:0,class:"flex items-start gap-2"},yv={class:"text-retro-cyan break-all"},wv={key:1,class:"flex items-start gap-2"},kv={class:"text-retro-cyan break-all whitespace-pre-wrap"},Cv={key:2,class:"flex items-start gap-2"},$v={key:1,class:"mt-2"},Sv={class:"text-xs font-mono text-retro-muted bg-retro-panel p-2 rounded overflow-x-auto max-h-52 overflow-y-auto scrollbar-custom whitespace-pre-wrap"},_v={key:0,class:"text-[10px] text-retro-muted mt-1"},Mv={key:2,class:"mt-2"},Tv={class:"text-xs font-mono text-retro-muted bg-retro-panel p-2 rounded overflow-x-auto max-h-40 overflow-y-auto scrollbar-custom whitespace-pre-wrap"},Av={key:0,class:"text-[10px] text-retro-muted mt-1"},Bv={key:3,class:"mt-2"},Ev={class:"text-xs font-mono text-retro-muted bg-retro-panel p-2 rounded overflow-x-auto max-h-40 overflow-y-auto scrollbar-custom whitespace-pre-wrap"},Rv={key:0,class:"text-[10px] text-retro-muted mt-1"},Pv={class:"mt-2"},Dv={class:"text-xs font-mono text-retro-muted bg-retro-panel p-2 rounded mt-1 overflow-x-auto max-h-40 overflow-y-auto scrollbar-custom"},Iv={key:4,class:"mt-3"},Lv={class:"space-y-2"},Nv={key:0,class:"text-[11px] font-mono text-retro-yellow mb-1"},Fv={key:1,class:"text-xs font-mono text-retro-text whitespace-pre-wrap"},Hv={key:2,class:"mt-2 space-y-1"},Ov={key:0,class:"text-retro-muted/80"},Uv={key:1,class:"px-3 pb-2 border-t border-retro-border/20"},jv={class:"mb-1 text-[10px] text-retro-muted"},zv={class:"text-retro-green"},Vv={class:"text-retro-red"},Wv={class:"space-y-0.5"},Gv={class:"whitespace-pre-wrap"},qv={class:"whitespace-pre-wrap"},Kv=Be({__name:"ChatToolBlock",props:{block:{},result:{}},setup(e){const n=e,t=k(!1),a=k(!1);function s(J,ne){for(const se of ne){const Se=J[se];if(typeof Se=="string"&&Se.trim())return Se}return""}function l(J,ne){for(const se of ne){const Se=J[se];if(typeof Se=="number"&&Number.isFinite(Se))return Se;if(typeof Se=="string"&&Se.trim()){const je=Number(Se);if(Number.isFinite(je))return je}}return null}function c(J,ne=14,se=1400){if(!J)return{text:"",truncated:!1};const Se=J.split(`
|
|
101
|
+
`);let je=Se.slice(0,ne).join(`
|
|
102
|
+
`),pe=Se.length>ne;return je.length>se&&(je=je.slice(0,se),pe=!0),{text:je,truncated:pe}}const d=R(()=>n.block.name.toLowerCase()),h=R(()=>d.value.replace(/[^a-z0-9]/g,"")),m=R(()=>h.value==="requestuserinput"||h.value==="askuserquestion"),S=R(()=>d.value==="read"),$=R(()=>d.value==="write"),x=R(()=>d.value==="edit"||d.value==="multiedit"),b=R(()=>["bash","exec","execcommand","runcommand"].includes(d.value)),y=R(()=>n.block.status==="running"||n.block.status==="error"||$.value||x.value||m.value),_=R(()=>{if(!m.value)return[];const J=n.block.input.questions;if(Array.isArray(J))return J.map(se=>se&&typeof se=="object"?se:null).filter(se=>!!se);const ne={header:s(n.block.input,["header","title"]),id:s(n.block.input,["id"]),question:s(n.block.input,["question"]),prompt:s(n.block.input,["prompt"]),message:s(n.block.input,["message","text","description"]),options:Array.isArray(n.block.input.options)?n.block.input.options:void 0};return!ne.question&&!ne.prompt&&!ne.message&&!ne.header?[]:[ne]});function W(J,ne=120){const se=J.replace(/\s+/g," ").trim();return se?se.length>ne?`${se.slice(0,ne)}...`:se:""}const B=R(()=>{const J=_.value[0];return J?W(J.question||J.prompt||J.message||J.header||""):""}),z=R(()=>s(n.block.input,["file_path","path","file","filepath","target_file"])),V=R(()=>{const J=l(n.block.input,["offset","start_line","line"]),ne=l(n.block.input,["limit","lines","line_count"]),se=l(n.block.input,["end_line"]);return J!==null&&ne!==null?`from line ${J}, ${ne} lines`:J!==null&&se!==null?`lines ${J}-${se}`:J!==null?`from line ${J}`:ne!==null?`${ne} lines`:""}),E=R(()=>s(n.block.input,["content","text","new_content"])),oe=R(()=>s(n.block.input,["old_string","oldText","old"])),ce=R(()=>s(n.block.input,["new_string","newText","new","replacement"])),de=R(()=>s(n.block.input,["cmd","command","script","chars"])),ge=R(()=>c(E.value)),X=R(()=>c(oe.value,10,1e3)),Z=R(()=>c(ce.value,10,1e3)),O=R(()=>{if(m.value)return B.value||"Prompting user for clarification";if(S.value){if(z.value&&V.value)return`Read ${z.value} (${V.value})`;if(z.value)return`Read ${z.value}`}return $.value&&z.value?`Write ${z.value}`:x.value&&z.value?`Edit ${z.value}`:b.value&&de.value?`$ ${de.value}`:n.block.inputSummary}),G=R(()=>{switch(n.block.status){case"running":return"[RUN]";case"pending":return"[WAIT]";case"complete":return"[OK]";case"error":return"[ERR]"}}),H=R(()=>Object.entries(n.block.input).filter(([ne,se])=>se==null||typeof se=="string"&&(!se.trim()||se.length>90)?!1:!["content","new_content","text","old_string","new_string"].includes(ne)).slice(0,6).map(([ne,se])=>`${ne}=${JSON.stringify(se)}`)),K=R(()=>{switch(n.block.status){case"running":return"text-retro-yellow";case"pending":return"text-retro-muted";case"complete":return"text-retro-green";case"error":return"text-retro-red"}}),I=R(()=>n.result?.content??""),v=R(()=>n.result?.isError??!1),g=R(()=>I.value.length),T=R(()=>I.value.split(`
|
|
103
|
+
`)),U=R(()=>a.value?T.value:T.value.slice(0,6)),ae=R(()=>!I.value||!/^diff --git\s|\+\+\+\s|---\s|@@\s/m.test(I.value)?!1:/^[+\- ]/.test(T.value.find(ne=>ne.length>0)||"")||T.value.some(ne=>ne.startsWith("@@"))),N=R(()=>{if(!ae.value)return{added:0,removed:0};let J=0,ne=0;for(const se of T.value)se.startsWith("+++")||se.startsWith("---")||(se.startsWith("+")&&(J+=1),se.startsWith("-")&&(ne+=1));return{added:J,removed:ne}}),j=R(()=>I.value?I.value.split(`
|
|
104
|
+
`).slice(0,3).join(`
|
|
105
|
+
`):""),L=R(()=>I.value?T.value.length>6||I.value.length>320:!1),ee=R(()=>I.value.trim().length>0);function re(J){return J.startsWith("@@")?"text-retro-cyan bg-retro-cyan/10":J.startsWith("+")&&!J.startsWith("+++")?"text-retro-green bg-retro-green/10":J.startsWith("-")&&!J.startsWith("---")?"text-retro-red bg-retro-red/10":J.startsWith("diff --git")||J.startsWith("index ")||J.startsWith("---")||J.startsWith("+++")?"text-retro-yellow":"text-retro-muted"}return De(()=>n.block.id,()=>{t.value=y.value,a.value=!1},{immediate:!0}),De(()=>n.block.status,J=>{(J==="running"||J==="error")&&(t.value=!0)}),(J,ne)=>(i(),u("div",uv,[r("button",{class:"flex items-center gap-2 w-full px-3 py-2 text-xs font-mono hover:bg-retro-dark/40 transition-colors text-left",onClick:ne[0]||(ne[0]=se=>t.value=!o(t))},[e.block.status==="running"?(i(),u("span",dv)):e.block.status==="pending"?(i(),he(o(ns),{key:1,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-muted animate-pulse"})):e.block.status==="complete"?(i(),he(o(wr),{key:2,class:ke(["w-3.5 h-3.5 flex-shrink-0",o(K)])},null,8,["class"])):(i(),he(o(Un),{key:3,class:ke(["w-3.5 h-3.5 flex-shrink-0",o(K)])},null,8,["class"])),r("span",fv,w(o(G)),1),r("span",mv,w(e.block.name),1),r("span",hv,w(o(O)||e.block.inputSummary),1),Y(o(Xr),{class:ke(["w-3 h-3 ml-auto transition-transform text-retro-muted flex-shrink-0",{"rotate-90":o(t)}])},null,8,["class"])]),o(t)?(i(),u("div",pv,[o(H).length>0?(i(),u("div",vv,[ne[5]||(ne[5]=r("div",{class:"text-[11px] font-mono text-retro-cyan mb-1"},"Args",-1)),r("pre",gv,w(o(H).join(`
|
|
106
|
+
`)),1)])):D("",!0),r("div",xv,[o(z)?(i(),u("div",bv,[ne[6]||(ne[6]=r("span",{class:"text-retro-muted/80 min-w-12"},"File",-1)),r("code",yv,w(o(z)),1)])):D("",!0),o(b)&&o(de)?(i(),u("div",wv,[ne[7]||(ne[7]=r("span",{class:"text-retro-muted/80 min-w-12"},"Cmd",-1)),r("code",kv,w(o(de)),1)])):D("",!0),o(S)&&o(V)?(i(),u("div",Cv,[ne[8]||(ne[8]=r("span",{class:"text-retro-muted/80 min-w-12"},"Range",-1)),r("span",null,w(o(V)),1)])):D("",!0)]),o($)&&o(ge).text?(i(),u("div",$v,[ne[9]||(ne[9]=r("div",{class:"text-[11px] font-mono text-retro-cyan mb-1"},"New Content",-1)),r("pre",Sv,w(o(ge).text),1),o(ge).truncated?(i(),u("div",_v,"Truncated preview")):D("",!0)])):D("",!0),o(x)&&o(X).text?(i(),u("div",Mv,[ne[10]||(ne[10]=r("div",{class:"text-[11px] font-mono text-retro-yellow mb-1"},"Before",-1)),r("pre",Tv,w(o(X).text),1),o(X).truncated?(i(),u("div",Av,"Truncated preview")):D("",!0)])):D("",!0),o(x)&&o(Z).text?(i(),u("div",Bv,[ne[11]||(ne[11]=r("div",{class:"text-[11px] font-mono text-retro-green mb-1"},"After",-1)),r("pre",Ev,w(o(Z).text),1),o(Z).truncated?(i(),u("div",Rv,"Truncated preview")):D("",!0)])):D("",!0),r("details",Pv,[ne[12]||(ne[12]=r("summary",{class:"text-[11px] font-mono text-retro-muted cursor-pointer hover:text-retro-cyan"},"Raw input JSON",-1)),r("pre",Dv,w(JSON.stringify(e.block.input,null,2)),1)]),o(m)&&o(_).length>0?(i(),u("div",Iv,[ne[13]||(ne[13]=r("div",{class:"text-[11px] font-mono text-retro-cyan mb-1"},"Clarification Prompt",-1)),r("div",Lv,[(i(!0),u(ve,null,Ie(o(_),(se,Se)=>(i(),u("div",{key:`${se.id||"q"}-${Se}`,class:"rounded border border-retro-border/30 bg-retro-panel/40 p-2"},[se.header?(i(),u("div",Nv,w(se.header),1)):D("",!0),se.question||se.prompt||se.message?(i(),u("div",Fv,w(se.question||se.prompt||se.message),1)):D("",!0),Array.isArray(se.options)&&se.options.length>0?(i(),u("div",Hv,[(i(!0),u(ve,null,Ie(se.options,(je,pe)=>(i(),u("div",{key:`${se.id||"q"}-opt-${pe}`,class:"text-xs font-mono text-retro-muted"},[Ae(w(je.label||`Option ${pe+1}`)+" ",1),je.description?(i(),u("span",Ov," - "+w(je.description),1)):D("",!0)]))),128))])):D("",!0)]))),128))])])):D("",!0)])):D("",!0),o(ee)?(i(),u("div",Uv,[r("div",{class:ke(["text-xs font-mono rounded p-2 mt-1 overflow-y-auto scrollbar-custom border",o(v)?"text-retro-red bg-retro-red/5 border-retro-red/40":"text-retro-muted bg-retro-panel/60 border-retro-border/30"]),style:Et(o(a)?"max-height: 20rem":"")},[o(ae)?(i(),u(ve,{key:0},[r("div",jv,[ne[14]||(ne[14]=Ae(" Diff · ",-1)),r("span",zv,"+"+w(o(N).added),1),ne[15]||(ne[15]=Ae(" / ",-1)),r("span",Vv,"-"+w(o(N).removed),1)]),r("div",Wv,[(i(!0),u(ve,null,Ie(o(U),(se,Se)=>(i(),u("div",{key:`diff-${Se}`,class:ke(["px-1 rounded whitespace-pre-wrap break-all",re(se)])},w(se||" "),3))),128))]),!o(a)&&o(L)?(i(),u("button",{key:0,class:"text-retro-cyan hover:underline mt-1 text-[10px]",onClick:ne[1]||(ne[1]=yt(se=>a.value=!0,["stop"]))}," Show full diff ("+w(o(g))+" chars) ",1)):o(L)?(i(),u("button",{key:1,class:"text-retro-cyan hover:underline mt-1 text-[10px]",onClick:ne[2]||(ne[2]=yt(se=>a.value=!1,["stop"]))}," Collapse diff ")):D("",!0)],64)):!o(a)&&o(L)?(i(),u(ve,{key:1},[r("pre",Gv,w(o(j)),1),r("button",{class:"text-retro-cyan hover:underline mt-1 text-[10px]",onClick:ne[3]||(ne[3]=yt(se=>a.value=!0,["stop"]))}," Show full ("+w(o(g))+" chars) ",1)],64)):(i(),u(ve,{key:2},[r("pre",qv,w(o(I)),1),o(L)?(i(),u("button",{key:0,class:"text-retro-cyan hover:underline mt-1 text-[10px]",onClick:ne[4]||(ne[4]=yt(se=>a.value=!1,["stop"]))}," Collapse ")):D("",!0)],64))],6)])):D("",!0)]))}}),Zv={class:"mt-2 pt-2 border-t border-retro-border/20 flex flex-wrap items-center gap-x-4 gap-y-1 text-[10px] font-mono text-retro-muted"},Yv={class:"flex items-center gap-1"},Xv={class:"flex items-center gap-1"},Qv=Be({__name:"ChatResultSummary",props:{block:{}},setup(e){const n=e,t=R(()=>{const l=Math.round(n.block.durationMs/1e3);return l<60?`${l}s`:`${Math.floor(l/60)}m ${l%60}s`}),a=R(()=>`$${n.block.totalCostUsd.toFixed(4)}`),s=R(()=>{const{inputTokens:l,outputTokens:c}=n.block.usage;return`${l.toLocaleString()} in / ${c.toLocaleString()} out`});return(l,c)=>(i(),u("div",Zv,[r("span",Yv,[c[0]||(c[0]=r("span",{class:"text-retro-muted/60"},"time",-1)),Ae(" "+w(o(t)),1)]),r("span",Xv,[c[1]||(c[1]=r("span",{class:"text-retro-muted/60"},"cost",-1)),Ae(" "+w(o(a)),1)]),r("span",null,w(o(s)),1),r("span",null,w(e.block.numTurns)+" turn"+w(e.block.numTurns!==1?"s":""),1)]))}}),Jv={class:"px-2 py-1 text-[10px] font-mono text-retro-muted border-b border-retro-border/20 mb-1 flex items-center gap-2"},eg={class:"text-retro-cyan"},tg={key:0,class:"text-retro-border"},ng={key:1},rg=Be({__name:"ChatSessionInit",props:{block:{}},setup(e){return(n,t)=>(i(),u("div",Jv,[r("span",eg,w(e.block.model),1),t[0]||(t[0]=r("span",{class:"text-retro-border"},"|",-1)),r("span",null,w(e.block.tools.length)+" tools",1),e.block.permissionMode?(i(),u("span",tg,"|")):D("",!0),e.block.permissionMode?(i(),u("span",ng,w(e.block.permissionMode),1)):D("",!0)]))}}),og=Be({__name:"ChatContentBlock",props:{block:{},toolResultsByUseId:{}},setup(e){const n=e,t=R(()=>{if(n.block.type==="tool_use")return n.toolResultsByUseId.get(n.block.toolUseId)});return(a,s)=>{const l=ov,c=cv,d=Kv,h=Qv,m=rg;return e.block.type==="text"?(i(),he(l,{key:0,block:e.block},null,8,["block"])):e.block.type==="thinking"?(i(),he(c,{key:1,block:e.block},null,8,["block"])):e.block.type==="tool_use"?(i(),he(d,{key:2,block:e.block,result:o(t)},null,8,["block","result"])):e.block.type==="result_summary"?(i(),he(h,{key:3,block:e.block},null,8,["block"])):e.block.type==="session_init"?(i(),he(m,{key:4,block:e.block},null,8,["block"])):D("",!0)}}}),sg={class:"flex-1 min-w-0"},ag={class:"flex items-center gap-2 mb-1"},ig={class:"text-xs font-mono text-retro-muted"},lg={key:0,class:"text-xs font-mono text-retro-yellow animate-pulse"},cg={key:1,class:"text-xs font-mono text-retro-muted"},ug={key:2,class:"text-xs font-mono text-retro-red"},dg={key:1,class:"mb-2 flex flex-wrap gap-2"},fg=["href","download"],mg=["src","alt"],hg={class:"mt-1 truncate text-[10px] font-mono text-retro-muted"},pg=["innerHTML"],vg={key:3,class:"text-xs font-mono text-retro-muted italic"},gg={key:4,class:"inline-block w-2 h-4 bg-retro-cyan animate-pulse ml-0.5"},xg=Be({__name:"ChatMessage",props:{message:{}},setup(e){const n=e,{renderMarkdown:t}=Mr(),a=R(()=>n.message.role==="user"),s=R(()=>n.message.status==="streaming"),l=R(()=>n.message.status==="error"),c=R(()=>n.message.status==="stopped"),d=R(()=>Vs(n.message)),h=R(()=>{const _=new Map;for(const W of n.message.contentBlocks??[])W.type==="tool_result"&&_.set(W.toolUseId,W);return _}),m=R(()=>{if(!n.message.contentBlocks)return[];const _=n.message.contentBlocks.filter(B=>B.type!=="tool_result"),W=[];for(const B of _){const z=W.length>0?W[W.length-1]:null;if(z?.type==="text"&&B.type==="text"){const V=z.text||"",E=B.text||"";z.text=`${V}${E}`;continue}if(z?.type==="thinking"&&B.type==="thinking"){const V=z.thinking||"",E=B.thinking||"";z.thinking=`${V}${E}`;continue}W.push({...B})}return W}),S=R(()=>d.value&&m.value.length>0),$=R(()=>n.message.content.trim().length>0),x=R(()=>n.message.attachments??[]),b=_=>new Date(_).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"}),y=R(()=>t(n.message.content));return(_,W)=>{const B=og;return i(),u("div",{class:ke(["flex gap-3 p-3",[o(a)?"bg-retro-dark/50":"bg-transparent",o(l)?"border-l-2 border-retro-red":""]])},[r("div",{class:ke(["flex-shrink-0 w-6 h-6 rounded flex items-center justify-center",o(a)?"bg-retro-cyan/20":"bg-retro-green/20"])},[o(a)?(i(),he(o(Ur),{key:0,class:"w-4 h-4 text-retro-cyan"})):(i(),he(o(ss),{key:1,class:"w-4 h-4 text-retro-green"}))],2),r("div",sg,[r("div",ag,[r("span",{class:ke(["text-xs font-mono",o(a)?"text-retro-cyan":"text-retro-green"])},w(o(a)?"You":"Assistant"),3),r("span",ig,w(b(e.message.timestamp)),1),o(s)?(i(),u("span",lg," typing... ")):D("",!0),o(c)?(i(),u("span",cg," (stopped) ")):D("",!0),o(l)?(i(),u("span",ug," (error) ")):D("",!0)]),o(S)?(i(!0),u(ve,{key:0},Ie(o(m),z=>(i(),he(B,{key:z.id,block:z,"tool-results-by-use-id":o(h)},null,8,["block","tool-results-by-use-id"]))),128)):D("",!0),o(a)&&o(x).length>0?(i(),u("div",dg,[(i(!0),u(ve,null,Ie(o(x),z=>(i(),u("a",{key:z.id,href:z.dataUrl,download:z.name,target:"_blank",rel:"noopener noreferrer",class:"w-28 rounded border border-retro-border/70 bg-retro-black/70 p-1 hover:border-retro-cyan/60"},[r("img",{src:z.dataUrl,alt:z.name,class:"h-20 w-full rounded object-cover"},null,8,mg),r("div",hg,w(z.name),1)],8,fg))),128))])):D("",!0),!o(S)&&o($)?(i(),u("div",{key:2,class:"text-sm font-mono text-retro-text break-words chat-markdown",innerHTML:o(y)},null,8,pg)):D("",!0),!o(S)&&!o($)&&!o(a)&&!o(s)?(i(),u("div",vg," (no visible response content) ")):D("",!0),o(s)?(i(),u("span",gg)):D("",!0)])],2)}}}),bg={key:0,class:"flex flex-col items-center justify-center h-full p-8 text-center"},yg={key:1,class:"relative"},wg={class:"sticky bottom-0"},kg={key:0,class:"px-4 py-2 bg-retro-dark/90 border-t border-retro-border/50 backdrop-blur-sm"},Cg={key:1,class:"px-4 py-2.5 bg-retro-red/20 border-t border-retro-red/50"},$g={class:"flex items-start gap-2"},Sg={class:"flex-1 min-w-0"},_g={class:"flex items-center justify-between gap-2 mb-0.5"},Mg={class:"text-xs font-mono text-retro-red/80 break-words whitespace-pre-wrap"},Tg={key:2,class:"px-4 py-2 bg-retro-dark/90 border-t border-retro-border/50"},Ag=Be({__name:"ChatMessages",setup(e){const n=At(),{containerRef:t,onScroll:a,maybeScrollToBottom:s,scrollToBottom:l,forceScrollToBottom:c}=ev(),{visibleItems:d,totalHeight:h,onVirtualScroll:m,setItemRef:S}=nv({allMessages:R(()=>n.messages),containerRef:t});function $(){a(),m()}const x=R(()=>n.isActiveConversationStreaming),b=R(()=>{const z=n.lastMessage;return!z||z.role!=="assistant"?null:z.status}),y=k(!1);function _(z){const V=z.contentBlocks;return!V||V.length===0?"":V.map(E=>{switch(E.type){case"tool_use":return`u:${E.id}:${E.status}:${E.inputSummary}`;case"tool_result":return`r:${E.id}:${E.toolUseId}:${E.isError?1:0}:${E.content.length}`;case"text":return`t:${E.id}:${E.text.length}`;case"thinking":return`k:${E.id}:${E.thinking.length}`;case"result_summary":return`s:${E.id}:${E.numTurns}:${E.durationMs}`;case"session_init":return`i:${E.id}:${E.model}:${E.tools.length}`;default:return""}}).join("|")}const W=k(null);function B(){if(W.value&&(W.value(),W.value=null),!t.value||typeof ResizeObserver>"u")return;const z=new ResizeObserver(()=>{s("instant")});z.observe(t.value),W.value=()=>{z.disconnect()}}return vt(()=>{l("instant"),B()}),wt(()=>{W.value&&W.value()}),De(()=>n.activeConversationId,()=>{y.value=!1,l("instant")}),De(t,()=>{B()}),De(()=>[n.activeConversationId,n.messages.length],([z,V])=>{!z||V===0||y.value||(y.value=!0,c("instant"))},{immediate:!0}),De(()=>n.messages.length,()=>{s("instant")}),De(()=>n.lastMessage?.content,()=>{s("instant")}),De([x,()=>n.lastError],()=>{s("instant")}),De(h,()=>{s("instant")}),(z,V)=>(i(),u("div",{ref_key:"containerRef",ref:t,class:"flex-1 overflow-y-auto",onScroll:$},[o(n).hasMessages?(i(),u("div",yg,[r("div",{class:"relative",style:Et({height:`${o(h)}px`})},[(i(!0),u(ve,null,Ie(o(d),E=>(i(),u("div",{key:E.message.id,class:"absolute left-0 right-0 border-b border-retro-border/30",style:Et({transform:`translateY(${E.top}px)`})},[r("div",{ref_for:!0,ref:oe=>o(S)(E.message.id,oe)},[Vo([E.message.id,E.message.status,E.message.content,E.message.contentBlocks?.length||0,_(E.message),E.message.tools?.length||0],()=>Y(xg,{message:E.message},null,8,["message"]),V,0)],512)],4))),128))],4)])):(i(),u("div",bg,[...V[2]||(V[2]=[r("div",{class:"text-retro-muted text-sm font-mono mb-2"}," No messages yet ",-1),r("div",{class:"text-retro-muted text-xs font-mono"}," Send a message to start chatting ",-1)])])),r("div",wg,[o(x)&&!o(n).lastError?(i(),u("div",kg,[...V[3]||(V[3]=[Wo('<div class="flex items-center gap-2"><div class="flex gap-1"><span class="w-1.5 h-1.5 rounded-full bg-retro-cyan animate-bounce" style="animation-delay:0ms;"></span><span class="w-1.5 h-1.5 rounded-full bg-retro-cyan animate-bounce" style="animation-delay:150ms;"></span><span class="w-1.5 h-1.5 rounded-full bg-retro-cyan animate-bounce" style="animation-delay:300ms;"></span></div><span class="text-xs font-mono text-retro-muted">Processing...</span></div>',1)])])):D("",!0),o(n).lastError?(i(),u("div",Cg,[r("div",$g,[Y(o(Un),{class:"w-4 h-4 text-retro-red flex-shrink-0 mt-0.5"}),r("div",Sg,[r("div",_g,[V[4]||(V[4]=r("p",{class:"text-xs font-mono font-semibold text-retro-red"},"Error",-1)),r("button",{class:"text-xs font-mono text-retro-red/60 hover:text-retro-red underline",onClick:V[1]||(V[1]=E=>o(n).clearError())}," Dismiss ")]),r("p",Mg,w(o(n).lastError),1),V[5]||(V[5]=r("p",{class:"text-xs font-mono text-retro-muted mt-1"}," Check browser console (F12) for more details ",-1))])])])):o(b)==="stopped"?(i(),u("div",Tg,[...V[6]||(V[6]=[r("div",{class:"flex items-center gap-2"},[r("span",{class:"w-2 h-2 rounded-full bg-retro-muted"}),r("span",{class:"text-xs font-mono text-retro-muted"},"Stopped")],-1)])])):D("",!0)])],544))}});function Bg(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"fill-rule":"evenodd",d:"M4.755 10.059a7.5 7.5 0 0 1 12.548-3.364l1.903 1.903h-3.183a.75.75 0 1 0 0 1.5h4.992a.75.75 0 0 0 .75-.75V4.356a.75.75 0 0 0-1.5 0v3.18l-1.9-1.9A9 9 0 0 0 3.306 9.67a.75.75 0 1 0 1.45.388Zm15.408 3.352a.75.75 0 0 0-.919.53 7.5 7.5 0 0 1-12.548 3.364l-1.902-1.903h3.183a.75.75 0 0 0 0-1.5H2.984a.75.75 0 0 0-.75.75v4.992a.75.75 0 0 0 1.5 0v-3.18l1.9 1.9a9 9 0 0 0 15.059-4.035.75.75 0 0 0-.53-.918Z","clip-rule":"evenodd"})])}function Uo(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"fill-rule":"evenodd",d:"M12.53 16.28a.75.75 0 0 1-1.06 0l-7.5-7.5a.75.75 0 0 1 1.06-1.06L12 14.69l6.97-6.97a.75.75 0 1 1 1.06 1.06l-7.5 7.5Z","clip-rule":"evenodd"})])}function Eg(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{d:"M3.478 2.404a.75.75 0 0 0-.926.941l2.432 7.905H13.5a.75.75 0 0 1 0 1.5H4.984l-2.432 7.905a.75.75 0 0 0 .926.94 60.519 60.519 0 0 0 18.445-8.986.75.75 0 0 0 0-1.218A60.517 60.517 0 0 0 3.478 2.404Z"})])}function Rg(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"fill-rule":"evenodd",d:"M4.5 7.5a3 3 0 0 1 3-3h9a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3h-9a3 3 0 0 1-3-3v-9Z","clip-rule":"evenodd"})])}const Pg={class:"flex-shrink-0 flex-grow-0 border-t border-retro-border bg-retro-dark p-3"},Dg={class:"flex items-center gap-2 mb-2"},Ig={class:"relative min-w-0 flex-1 max-w-[154px] model-selector"},Lg=["disabled"],Ng={class:"truncate text-left"},Fg={key:0,class:"absolute bottom-full left-0 mb-1 py-1 bg-retro-dark border border-retro-border rounded shadow-lg z-10 min-w-[220px] max-w-[280px]"},Hg={key:0,class:"px-3 py-1.5 text-xs font-mono text-retro-muted"},Og={class:"px-3 py-1 text-[11px] font-mono uppercase tracking-wide text-retro-cyan/80 select-none"},Ug=["disabled","onClick"],jg={class:"truncate"},zg={class:"relative mode-selector"},Vg={key:0,class:"absolute bottom-full left-0 mb-1 py-1 bg-retro-dark border border-retro-border rounded shadow-lg z-10 min-w-[140px]"},Wg=["onClick"],Gg={class:"text-xs font-mono text-retro-muted"},qg={key:0,class:"mb-3 p-3 bg-retro-yellow/10 border border-retro-yellow/50 rounded"},Kg={class:"flex items-center justify-between gap-3"},Zg={class:"flex-1 min-w-0"},Yg={class:"text-xs font-mono text-retro-text truncate"},Xg={class:"text-retro-cyan"},Qg={key:0,class:"text-retro-muted"},Jg={key:1,class:"text-retro-muted"},e1={key:1,class:"mb-3 p-3 bg-retro-cyan/10 border border-retro-cyan/50 rounded"},t1={key:2,class:"mb-2 flex flex-wrap gap-2"},n1=["src","alt"],r1={class:"mt-1 truncate text-[10px] font-mono text-retro-muted"},o1={class:"truncate text-[10px] font-mono text-retro-muted/80"},s1=["onClick"],a1={class:"flex gap-2 items-start"},i1=["disabled"],l1={class:"flex-1 relative min-h-[40px]"},c1=["disabled","placeholder"],u1=["disabled"],jo=4,d1=5*1024*1024,f1=Be({__name:"ChatInput",props:{disabled:{type:Boolean}},setup(e){const n=e,t=At(),a=Hn(),{sendMessage:s,sendPermissionResponse:l,approvePlan:c,rejectPlan:d,abort:h,resetContext:m}=po(),S=k(""),$=k(null),x=k(null),b=k(!1),y=k(!1),_=k(!1),W=k([]);let B=null;const z=k(null),{data:V,pending:E}=Nr("chat-input-ai-providers",()=>$fetch("/api/ai/providers"),{server:!1,default:()=>({providers:[]})}),oe=R(()=>V.value?.providers??[]),ce=R(()=>t.permissionMode==="ask"||t.permissionMode==="plan"),de=R(()=>{const q=new Map;for(const te of oe.value)for(const me of te.models)q.set(me.label,(q.get(me.label)??0)+1);return oe.value.flatMap(te=>te.models.map(me=>{const be=te.capabilities.streaming&&(!ce.value||te.capabilities.permissions),Me=(q.get(me.label)??0)>1;return{key:`${te.id}::${me.key}`,providerId:te.id,providerName:te.name,modelKey:me.key,modelLabel:me.label,label:Me?`${me.label} · ${te.name}`:me.label,compatible:be}})).sort((te,me)=>te.modelLabel.localeCompare(me.modelLabel,void 0,{sensitivity:"base"})||te.providerName.localeCompare(me.providerName,void 0,{sensitivity:"base"}))}),ge=R(()=>{const q=new Map;for(const me of de.value){const be=q.get(me.providerId);if(be){be.options.push(me);continue}q.set(me.providerId,{providerId:me.providerId,providerName:me.providerName,options:[me]})}const fe=new Map([["codex",0],["claude",1]]),te=Array.from(q.values());return te.sort((me,be)=>{const Me=fe.get(me.providerId)??99,Ee=fe.get(be.providerId)??99;return Me!==Ee?Me-Ee:me.providerName.localeCompare(be.providerName,void 0,{sensitivity:"base"})}),te});function X(q){return`${q.providerId}::${q.modelKey}`}const Z=R(()=>{const q=t.activeConversation;return q?.providerId&&q.providerModelKey?{providerId:q.providerId,modelKey:q.providerModelKey}:z.value?z.value:a.providerSelection}),O=R(()=>X(Z.value)),G=R(()=>de.value.find(q=>q.key===O.value)||null),H=R(()=>G.value?.label||"Select model");function K(q,fe){t.setConversationProviderSelection(q,fe.providerId,fe.modelKey),t.clearProviderSession(q),t.saveConversation(q,!0)}function I(q){z.value&&(K(q,z.value),z.value=null)}function v(q){if(!q||!q.compatible)return;const fe={providerId:q.providerId,modelKey:q.modelKey},te=t.activeConversationId;if(te){K(te,fe),z.value=null,_.value=!1;return}z.value=fe,_.value=!1}const g={plan:Jr,ask:to,auto:Zr,bypass:no},T={plan:"text-retro-cyan",ask:"text-retro-green",auto:"text-retro-yellow",bypass:"text-retro-red"};function U(q){t.setPermissionMode(q),y.value=!1}function ae(q){const fe=q.target;fe.closest(".mode-selector")||(y.value=!1),fe.closest(".model-selector")||(_.value=!1)}vt(()=>{document.addEventListener("click",ae),a.hydrate()}),wt(()=>{document.removeEventListener("click",ae),B!==null&&typeof window<"u"&&typeof window.cancelAnimationFrame=="function"&&(window.cancelAnimationFrame(B),B=null)});const N=R(()=>(S.value.trim().length>0||W.value.length>0)&&!t.isActiveConversationStreaming&&!b.value&&!t.pendingPermission&&!ee.value),j=R(()=>t.isActiveConversationStreaming&&!t.pendingPermission),L=R(()=>t.pendingPermission!==null),ee=R(()=>t.pendingPlanApproval!==null);function re(){l(!0,t.activeConversationId)}function J(){l(!1,t.activeConversationId)}function ne(){c(t.activeConversationId)}function se(){d(t.activeConversationId)}function Se(){W.value=[],x.value&&(x.value.value="")}function je(q){W.value=W.value.filter(fe=>fe.id!==q)}function pe(q){return q<1024?`${q} B`:q<1024*1024?`${(q/1024).toFixed(1)} KB`:`${(q/(1024*1024)).toFixed(1)} MB`}function ue(q){return new Promise((fe,te)=>{const me=new FileReader;me.onload=()=>{typeof me.result=="string"?fe(me.result):te(new Error("Failed to read image"))},me.onerror=()=>te(me.error||new Error("Failed to read image")),me.readAsDataURL(q)})}async function _e(q){const fe=q.target,te=fe.files?Array.from(fe.files):[];if(te.length===0)return;const{useToast:me}=await _n(async()=>{const{useToast:Ee}=await import("./B3SzeM5g.js").then(Oe=>Oe.o);return{useToast:Ee}},__vite__mapDeps([0,1,2]),import.meta.url),be=me();let Me=jo-W.value.length;if(Me<=0){be.warning(`You can attach up to ${jo} images per message.`),fe.value="";return}for(const Ee of te){if(Me<=0)break;if(!Ee.type.startsWith("image/")){be.warning(`Skipped "${Ee.name}": only image files are supported.`);continue}if(Ee.size>d1){be.warning(`Skipped "${Ee.name}": max size is 5 MB.`);continue}try{const Oe=await ue(Ee);W.value.push({id:`att-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:Ee.name,mimeType:Ee.type,size:Ee.size,dataUrl:Oe}),Me--}catch{be.error(`Failed to attach "${Ee.name}".`)}}fe.value=""}const Pe=R(()=>{if(t.isActiveConversationStreaming||b.value)return!1;const q=t.lastMessage;return q?.role==="assistant"&&q?.status==="error"});function Fe(q){const fe=q.instructionFiles.length>0?q.instructionFiles.map(me=>{const be=me.source==="cwd"?"cwd":"ancestor",Me=me.mtime?` (mtime: ${me.mtime})`:"";return`- \`${me.path}\` [${be}] - ${me.hint}${Me}`}):["- (none detected from current cwd ancestry)"],te=q.specContext.files.length>0?q.specContext.files.map(me=>`- \`${me}\``):["- (none)"];return["## Context Snapshot","",`- Time: ${q.generatedAt}`,`- Session state: **${q.sessionState}**`,`- Provider session ID: \`${q.providerSessionId??"(empty)"}\``,`- Provider: \`${q.providerId}\` / \`${q.providerModelKey}\``,`- Permission mode: \`${q.permissionMode}\``,`- CWD (requested): \`${q.requestedCwd}\``,`- CWD (effective): \`${q.effectiveCwd}\``,`- Feature: \`${q.featureId??"(none)"}\``,"","### Spec Context Injection",`- Active on next turn: **${q.specContext.active?"yes":"no"}**`,`- Reason: ${q.specContext.reason}`,...te,"","### Detected Instruction Files",...fe].join(`
|
|
107
|
+
`)}function qe(q){return(q.match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(te=>te.startsWith('"')&&te.endsWith('"')||te.startsWith("'")&&te.endsWith("'")?te.slice(1,-1):te)}function Qe(q){const fe=q.match(/^\/(?:spec-search|specsearch)\b(.*)$/i);if(!fe)return null;const te=qe(fe[1]?.trim()??""),me=[],be={q:""};for(let Me=0;Me<te.length;Me++){const Ee=te[Me];if(Ee==="--mode"&&te[Me+1]){const Oe=te[++Me];(Oe==="keyword"||Oe==="semantic"||Oe==="hybrid")&&(be.mode=Oe);continue}if(Ee.startsWith("--mode=")){const Oe=Ee.slice(7);(Oe==="keyword"||Oe==="semantic"||Oe==="hybrid")&&(be.mode=Oe);continue}if(Ee==="--feature"&&te[Me+1]){be.featureId=te[++Me];continue}if(Ee.startsWith("--feature=")){be.featureId=Ee.slice(10);continue}if(Ee==="--file-type"&&te[Me+1]){be.fileType=te[++Me];continue}if(Ee.startsWith("--file-type=")){be.fileType=Ee.slice(12);continue}if(Ee==="--limit"&&te[Me+1]){const Oe=Number.parseInt(te[++Me],10);Number.isFinite(Oe)&&Oe>0&&(be.limit=Oe);continue}if(Ee.startsWith("--limit=")){const Oe=Number.parseInt(Ee.slice(8),10);Number.isFinite(Oe)&&Oe>0&&(be.limit=Oe);continue}me.push(Ee)}return be.q=me.join(" ").trim(),be}function Je(q,fe=1400){const te=q.trim();return te.length<=fe?te:`${te.slice(0,fe)}
|
|
108
|
+
...`}function kt(q,fe){const te=[];if(te.push("## Spec Search Results"),te.push(""),te.push(`- Query: \`${q.q}\``),te.push(`- Mode: \`${fe.mode}\``),q.featureId&&te.push(`- Feature filter: \`${q.featureId}\``),q.fileType&&te.push(`- File type filter: \`${q.fileType}\``),te.push(`- Hits: **${fe.totalCount}** (${fe.searchTime}ms)`),fe.warning&&te.push(`- Warning: ${fe.warning}`),fe.results.length===0)return te.push(""),te.push("No matching indexed chunks were found."),te.join(`
|
|
109
|
+
`);te.push("");for(const[me,be]of fe.results.entries()){const Me=be.chunk;te.push(`### ${me+1}. \`${Me.sourcePath}:${Me.lineStart}\``),te.push(`- Match: \`${be.matchType}\` (score: ${be.score.toFixed(3)})`),Me.headingHierarchy.length>0&&te.push(`- Headings: ${Me.headingHierarchy.join(" > ")}`),te.push(""),te.push(Je(Me.content)),te.push("")}return te.join(`
|
|
110
|
+
`)}async function jt(q){const fe=t.activeConversationId??await t.createConversation(),te=t.addAssistantMessage(fe);if(!q.q){t.updateMessage(te.id,{content:["Usage: `/spec-search <query> [--mode keyword|semantic|hybrid] [--feature <feature-id>] [--file-type <type>] [--limit <n>]`","","Examples:","- `/spec-search FR-001`",'- `/spec-search "indexing indicator" --mode hybrid --feature 008-spec-search --limit 5`'].join(`
|
|
111
|
+
`),status:"complete"},fe);return}const me=t.activeConversation,be={q:q.q,mode:q.mode??"hybrid",featureId:q.featureId??me?.featureId,fileType:q.fileType,limit:String(q.limit??5)};try{const Me=await $fetch("/api/specs/search",{query:be});t.updateMessage(te.id,{content:kt({...q,mode:be.mode,featureId:be.featureId},Me),status:"complete"},fe)}catch(Me){const Ee=Me instanceof Error?Me.message:"Failed to run spec search";t.updateMessage(te.id,{content:`Spec search failed: ${Ee}`,status:"error"},fe)}}async function Qt(){const q=t.activeConversation,fe={permissionMode:t.permissionMode};q?.hasWorktree&&q.worktreePath?fe.cwd=q.worktreePath:q?.cwd&&(fe.cwd=q.cwd),q?.featureId&&(fe.featureId=q.featureId),q?.providerId&&(fe.providerId=q.providerId),q?.providerModelKey&&(fe.providerModelKey=q.providerModelKey),q?.providerSessionId&&(fe.providerSessionId=q.providerSessionId);const te=await $fetch("/api/chat/context",{query:fe}),me=t.activeConversationId??await t.createConversation(),be=t.addAssistantMessage(me);t.updateMessage(be.id,{content:Fe(te),status:"complete"},me)}async function st(){const q=S.value.trim(),fe=[...W.value];if(q.length===0&&fe.length===0||t.isActiveConversationStreaming||b.value||n.disabled)return;const te=!!t.activeConversationId;if(q==="/reset"||q==="/reset-context"){await St();return}if(q==="/context"||q==="/ctx"){await Qt(),S.value="",Se(),Mt();return}const me=Qe(q);if(me){await jt(me),S.value="",Se(),Mt();return}b.value=!0,S.value="",Se(),Mt();try{await t.addUserMessageWithConversation(q,fe);const be=t.activeConversationId;te||I(be);const Me=t.addAssistantMessage();t.startSession(`session-${Date.now()}`),t.startConversationStreaming(be);const Ee=t.activeConversation,Oe={};Ee?.hasWorktree&&Ee.worktreePath&&(Oe.cwd=Ee.worktreePath,Oe.worktreeBranch=Ee.worktreeBranch),Ee?.featureId&&(Oe.featureId=Ee.featureId),fe.length>0&&(Oe.attachments=fe),await s(q,Me.id,be,Object.keys(Oe).length>0?Oe:void 0)}catch(be){const Me=be instanceof Error?be.message:"Failed to send message";t.setSessionError(Me);const Ee=t.lastMessage;Ee&&Ee.role==="assistant"&&t.updateMessage(Ee.id,{status:"error"}),t.activeConversationId&&(t.endSession(t.activeConversationId),t.endConversationStreaming(t.activeConversationId))}finally{b.value=!1}}async function Lt(){try{h(t.activeConversationId)}catch{}}async function St(){if(t.activeConversationId){S.value="",Se(),Mt(),b.value=!0;try{await m(t.activeConversationId);const q=t.addAssistantMessage(t.activeConversationId);t.updateMessage(q.id,{content:"✨ **Context cleared** — The AI conversation context has been reset. Starting fresh from here.",status:"complete"},t.activeConversationId);const{useToast:fe}=await _n(async()=>{const{useToast:me}=await import("./B3SzeM5g.js").then(be=>be.o);return{useToast:me}},__vite__mapDeps([0,1,2]),import.meta.url);fe().success("AI context has been reset. The conversation will start fresh.")}catch(q){console.error("Failed to reset context:",q);const{useToast:fe}=await _n(async()=>{const{useToast:me}=await import("./B3SzeM5g.js").then(be=>be.o);return{useToast:me}},__vite__mapDeps([0,1,2]),import.meta.url);fe().error("Failed to reset context. Please try again.")}finally{b.value=!1}}}async function _t(){const q=t.messages;let fe=null;for(let me=q.length-1;me>=0;me--)if(q[me].role==="user"){fe={content:q[me].content,attachments:q[me].attachments??[]};break}if(!fe||!t.activeConversationId)return;const te=t.activeConversationId;t.clearError(),b.value=!0;try{const me=t.addAssistantMessage();t.startSession(`session-${Date.now()}`),t.startConversationStreaming(te);const be=t.activeConversation,Me={};be?.hasWorktree&&be.worktreePath&&(Me.cwd=be.worktreePath,Me.worktreeBranch=be.worktreeBranch),be?.featureId&&(Me.featureId=be.featureId),fe.attachments.length>0&&(Me.attachments=fe.attachments),await s(fe.content,me.id,te,Object.keys(Me).length>0?Me:void 0)}catch(me){const be=me instanceof Error?me.message:"Failed to retry message";t.setSessionError(be);const Me=t.lastMessage;Me&&Me.role==="assistant"&&t.updateMessage(Me.id,{status:"error"}),t.endSession(te),t.endConversationStreaming(te)}finally{b.value=!1}}function Nt(q){q.key==="Enter"&&!q.shiftKey&&(q.preventDefault(),st())}function gt(){const q=$.value;if(q){if(!S.value.trim()){q.style.height="";return}q.style.height="auto",q.style.height=Math.min(q.scrollHeight,200)+"px"}}function Ot(){if(B!==null)return;B=(typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):fe=>setTimeout(()=>fe(Date.now()),16))(()=>{B=null,gt()})}function Mt(){const q=$.value;q&&(q.style.height="")}function Ft(){Yt(()=>{$.value?.focus()})}return De(S,Ot),De(()=>t.isActiveConversationStreaming,(q,fe)=>{fe&&!q&&Ft()}),De(()=>t.activeConversationId,()=>{t.activeConversationId&&(z.value=null),Se(),Ft()}),(q,fe)=>(i(),u("div",Pg,[r("div",Dg,[r("div",Ig,[r("button",{disabled:e.disabled||o(t).isActiveConversationStreaming||o(L)||o(ee)||o(E)||o(de).length===0,class:"flex items-center justify-between gap-1.5 w-full px-2 py-1 rounded border border-retro-border/50 hover:border-retro-border text-xs font-mono text-retro-muted transition-colors disabled:opacity-60 disabled:cursor-not-allowed",onClick:fe[0]||(fe[0]=te=>_.value=!o(_))},[r("span",Ng,w(o(H)),1),Y(o(Uo),{class:"w-3 h-3 flex-shrink-0"})],8,Lg),o(_)?(i(),u("div",Fg,[o(de).length===0?(i(),u("div",Hg," Loading models... ")):D("",!0),(i(!0),u(ve,null,Ie(o(ge),te=>(i(),u("div",{key:te.providerId,class:"py-0.5"},[r("div",Og,w(te.providerName),1),(i(!0),u(ve,null,Ie(te.options,me=>(i(),u("button",{key:me.key,disabled:!me.compatible,class:ke(["flex items-center gap-2 w-full px-3 py-1.5 text-xs font-mono text-left hover:bg-retro-panel transition-colors disabled:opacity-50 disabled:cursor-not-allowed",o(O)===me.key?"bg-retro-panel text-retro-text":"text-retro-muted"]),onClick:be=>v(me)},[r("span",jg,w(me.modelLabel)+w(me.compatible?"":" (unsupported for current permission mode)"),1)],10,Ug))),128))]))),128))])):D("",!0)]),r("div",zg,[r("button",{class:ke(["flex items-center gap-1.5 px-2 py-1 rounded border border-retro-border/50 hover:border-retro-border text-xs font-mono transition-colors",T[o(t).permissionMode]]),onClick:fe[1]||(fe[1]=te=>y.value=!o(y))},[(i(),he(In(g[o(t).permissionMode]),{class:"w-4 h-4"})),r("span",null,w(o(Dn)[o(t).permissionMode]),1),Y(o(Uo),{class:"w-3 h-3"})],2),o(y)?(i(),u("div",Vg,[(i(),u(ve,null,Ie(["plan","ask","auto","bypass"],te=>r("button",{key:te,class:ke(["flex items-center gap-2 w-full px-3 py-1.5 text-xs font-mono text-left hover:bg-retro-panel transition-colors",[T[te],o(t).permissionMode===te?"bg-retro-panel":""]]),onClick:me=>U(te)},[(i(),he(In(g[te]),{class:"w-4 h-4"})),r("span",null,w(o(Dn)[te]),1)],10,Wg)),64))])):D("",!0)]),r("span",Gg,w(o(t).permissionMode==="plan"?"Plan only":o(t).permissionMode==="ask"?"Ask before actions":o(t).permissionMode==="auto"?"Auto approve":"All permissions"),1)]),o(L)?(i(),u("div",qg,[r("div",Kg,[r("div",Zg,[fe[4]||(fe[4]=r("div",{class:"text-xs font-mono text-retro-yellow font-bold mb-1"}," Permission Required ",-1)),r("div",Yg,[r("span",Xg,w(o(t).pendingPermission?.tool),1),o(t).pendingPermission?.filePath?(i(),u("span",Qg," - "+w(o(t).pendingPermission.filePath),1)):o(t).pendingPermission?.command?(i(),u("span",Jg," - "+w(o(t).pendingPermission.command),1)):D("",!0)])]),r("div",{class:"flex gap-2 flex-shrink-0"},[r("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-green/20 text-retro-green border border-retro-green/50 hover:bg-retro-green/30 transition-colors",onClick:re}," Allow "),r("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-red/20 text-retro-red border border-retro-red/50 hover:bg-retro-red/30 transition-colors",onClick:J}," Deny ")])])])):D("",!0),o(ee)?(i(),u("div",e1,[r("div",{class:"flex items-center justify-between gap-3"},[fe[5]||(fe[5]=r("div",{class:"flex-1 min-w-0"},[r("div",{class:"text-xs font-mono text-retro-cyan font-bold mb-1"}," Plan Ready for Review "),r("div",{class:"text-xs font-mono text-retro-muted"}," Approve to switch to Auto mode and start implementation. ")],-1)),r("div",{class:"flex gap-2 flex-shrink-0"},[r("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-green/20 text-retro-green border border-retro-green/50 hover:bg-retro-green/30 transition-colors",onClick:ne}," Approve & Implement "),r("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-red/20 text-retro-red border border-retro-red/50 hover:bg-retro-red/30 transition-colors",onClick:se}," Reject ")])])])):D("",!0),o(W).length>0?(i(),u("div",t1,[(i(!0),u(ve,null,Ie(o(W),te=>(i(),u("div",{key:te.id,class:"relative w-24 rounded border border-retro-border/70 bg-retro-black/80 p-1"},[r("img",{src:te.dataUrl,alt:te.name,class:"h-16 w-full rounded object-cover"},null,8,n1),r("div",r1,w(te.name),1),r("div",o1,w(pe(te.size)),1),r("button",{class:"absolute -right-2 -top-2 rounded-full border border-retro-border bg-retro-panel p-0.5 text-retro-red hover:bg-retro-red/20",type:"button",onClick:me=>je(te.id)},[Y(o($t),{class:"h-3 w-3"})],8,s1)]))),128))])):D("",!0),r("div",a1,[r("input",{ref_key:"fileInputRef",ref:x,type:"file",accept:"image/*",multiple:"",class:"hidden",onChange:_e},null,544),r("button",{class:"flex-shrink-0 h-10 w-10 inline-flex items-center justify-center p-0 rounded bg-retro-panel/70 text-retro-muted hover:text-retro-cyan hover:bg-retro-panel disabled:opacity-50 disabled:cursor-not-allowed transition-colors",type:"button",title:"Attach images",disabled:e.disabled||o(t).isActiveConversationStreaming||o(L)||o(ee),onClick:fe[2]||(fe[2]=te=>o(x)?.click())},[Y(o(ha),{class:"w-5 h-5"})],8,i1),r("div",l1,[Le(r("textarea",{ref_key:"inputRef",ref:$,"onUpdate:modelValue":fe[3]||(fe[3]=te=>We(S)?S.value=te:null),disabled:e.disabled||o(t).isActiveConversationStreaming||o(L)||o(ee),placeholder:e.disabled?"This conversation is finalized (read-only)":"Type a message...",rows:"1",class:"w-full h-full min-h-[40px] px-3 py-2 bg-retro-black border border-retro-border rounded text-sm font-mono text-retro-text placeholder-retro-muted focus:outline-none focus:border-retro-cyan disabled:opacity-50 disabled:cursor-not-allowed resize-none overflow-hidden",onKeydown:Nt},null,40,c1),[[Ct,o(S)]])]),o(Pe)?(i(),u("button",{key:0,class:"flex-shrink-0 h-10 w-10 inline-flex items-center justify-center p-0 rounded bg-retro-yellow/20 text-retro-yellow hover:bg-retro-yellow/30 transition-colors",title:"Retry last message",onClick:_t},[Y(o(Bg),{class:"w-5 h-5"})])):D("",!0),!o(j)&&!o(L)?(i(),u("button",{key:1,disabled:!o(N),class:"flex-shrink-0 h-10 w-10 inline-flex items-center justify-center p-0 rounded bg-retro-cyan/20 text-retro-cyan hover:bg-retro-cyan/30 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",onClick:st},[Y(o(Eg),{class:"w-5 h-5"})],8,u1)):o(j)?(i(),u("button",{key:2,class:"flex-shrink-0 h-10 w-10 inline-flex items-center justify-center p-0 rounded bg-retro-red/20 text-retro-red hover:bg-retro-red/30 transition-colors",onClick:Lt},[Y(o(Rg),{class:"w-5 h-5"})])):D("",!0)]),fe[6]||(fe[6]=r("div",{class:"mt-1 text-xs font-mono text-retro-muted"}," Press Enter to send, Shift+Enter for new line. Slash commands: `/context`, `/reset`, `/spec-search`. You can attach up to 4 images (5 MB each). ",-1))]))}}),m1={class:"h-64 border-t border-retro-border bg-retro-dark/50 flex flex-col"},h1={class:"h-9 flex items-center justify-between px-3 border-b border-retro-border/40"},p1={key:0,class:"flex-1 flex items-center justify-center text-xs font-mono text-retro-muted"},v1={key:1,class:"flex-1 overflow-y-auto scrollbar-custom"},g1={class:"flex items-center gap-2 text-[10px] font-mono"},x1={class:"text-retro-muted"},b1={class:"text-retro-muted"},y1={class:"text-retro-green truncate"},w1={class:"mt-1 text-[11px] font-mono text-retro-text whitespace-pre-wrap break-words"},k1=Be({__name:"ChatDebugPanel",setup(e){const n=At(),{debugEvents:t}=Ls(n);function a(l){return new Date(l).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"})}function s(l){return l==="in"?"text-retro-cyan":l==="out"?"text-retro-yellow":"text-retro-muted"}return(l,c)=>(i(),u("div",m1,[r("div",h1,[c[1]||(c[1]=r("div",{class:"text-[11px] font-mono text-retro-text"}," Debug Stream (CLI/Provider) ",-1)),r("button",{class:"p-1 rounded hover:bg-retro-panel transition-colors",title:"Clear debug events",onClick:c[0]||(c[0]=d=>o(n).clearDebugEvents())},[Y(o(vn),{class:"w-3.5 h-3.5 text-retro-muted"})])]),o(t).length===0?(i(),u("div",p1," No debug events yet ")):(i(),u("div",v1,[(i(!0),u(ve,null,Ie(o(t),d=>(i(),u("div",{key:d.id,class:"px-3 py-2 border-b border-retro-border/20"},[r("div",g1,[r("span",x1,w(a(d.timestamp)),1),r("span",{class:ke(s(d.direction))},w(d.direction.toUpperCase()),3),r("span",b1,w(d.channel),1),r("span",y1,w(d.eventType),1)]),r("pre",w1,w(d.payload),1)]))),128))]))]))}}),C1={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},$1={class:"flex items-center justify-between"},S1={class:"space-y-1 text-xs font-mono"},_1={class:"flex items-center gap-2"},M1={class:"relative"},T1=["disabled"],A1=["value"],B1=["value"],E1={class:"flex items-center gap-2"},R1={class:"text-retro-text"},P1={class:"relative"},D1=["disabled"],I1=["disabled"],L1={class:"flex items-center gap-2"},N1=["disabled"],F1=["disabled"],H1=Be({__name:"FinalizeConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(e,{emit:n}){const t=e,a=n,s=k(""),l=k(null),c=k(!1),d=k(!1),h=k(t.baseBranch),m=k([]),S=k(!1);async function $(){d.value=!0;try{const b=await $fetch("/api/chat/generate-commit-message",{method:"POST",body:{conversationId:t.worktreePath.split("/").pop()?.replace("sc-","")||"",worktreePath:t.worktreePath}});b.success&&b.message&&(s.value=b.message)}catch{}finally{d.value=!1}}vt(async()=>{const b=(async()=>{try{const _=t.worktreePath.split("/").pop()||"",W=await $fetch(`/api/commits/${encodeURIComponent(_)}`,{params:{workingDirectory:t.worktreePath}});l.value=W.aheadCount}catch{l.value=null}})(),y=(async()=>{S.value=!0;try{const _=await $fetch("/api/git/branches");m.value=_.branches.filter(W=>!W.isRemote&&!W.name.startsWith("sc/")).map(W=>W.name),m.value.length>0&&!m.value.includes(h.value)&&(h.value=m.value.includes("main")?"main":m.value.includes("master")?"master":m.value[0])}catch{m.value=[]}finally{S.value=!1}})();await Promise.all([b,y])});function x(){s.value.trim()&&(c.value=!0,a("confirm",s.value.trim(),h.value))}return(b,y)=>(i(),u("div",C1,[r("div",$1,[y[4]||(y[4]=r("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Finalize ",-1)),r("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:y[0]||(y[0]=_=>a("cancel"))},[Y(o($t),{class:"w-4 h-4"})])]),r("div",S1,[r("div",_1,[y[5]||(y[5]=r("span",{class:"text-retro-muted"},"target:",-1)),r("div",M1,[Le(r("select",{"onUpdate:modelValue":y[1]||(y[1]=_=>h.value=_),disabled:c.value||S.value,class:"appearance-none bg-retro-black border border-retro-border rounded px-2 py-0.5 pr-6 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan cursor-pointer disabled:opacity-40"},[S.value?(i(),u("option",{key:0,value:e.baseBranch},w(e.baseBranch),9,A1)):D("",!0),(i(!0),u(ve,null,Ie(m.value,_=>(i(),u("option",{key:_,value:_},w(_),9,B1))),128))],8,T1),[[Bn,h.value]]),Y(o(Qr),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),r("div",E1,[y[6]||(y[6]=r("span",{class:"text-retro-muted"},"commits:",-1)),r("span",R1,w(l.value!==null?l.value:"..."),1)])]),r("div",P1,[Le(r("textarea",{"onUpdate:modelValue":y[2]||(y[2]=_=>s.value=_),placeholder:"Squash commit message...",rows:"2",class:"w-full px-2 py-1.5 pr-8 text-xs font-mono bg-retro-black border border-retro-border rounded text-retro-text placeholder-retro-subtle focus:outline-none focus:border-retro-cyan resize-none",disabled:c.value||d.value},null,8,D1),[[Ct,s.value]]),r("button",{type:"button",disabled:c.value||d.value,class:"absolute right-1.5 top-1.5 p-0.5 rounded text-retro-muted hover:text-retro-cyan transition-colors disabled:opacity-40",title:"Generate commit message",onClick:$},[Y(o(kr),{class:ke(["w-4 h-4",{"animate-spin":d.value}])},null,8,["class"])],8,I1)]),r("div",L1,[r("button",{type:"button",disabled:!s.value.trim()||c.value,class:"flex items-center gap-1 px-3 py-1 text-xs font-mono rounded border transition-colors bg-retro-green/10 border-retro-green/50 text-retro-green hover:bg-retro-green/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:x},[Y(o(Yr),{class:"w-3.5 h-3.5"}),Ae(" "+w(c.value?"Finalizing...":"Confirm"),1)],8,N1),r("button",{type:"button",disabled:c.value,class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",onClick:y[3]||(y[3]=_=>a("cancel"))}," Cancel ",8,F1)])]))}}),O1={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},U1={class:"flex items-center justify-between"},j1={class:"space-y-1 text-xs font-mono"},z1={class:"flex items-center gap-2"},V1={class:"text-retro-cyan"},W1={class:"flex items-center gap-2"},G1={class:"relative"},q1=["disabled"],K1=["value"],Z1=["value"],Y1={class:"flex items-center gap-2"},X1={class:"text-retro-text"},Q1={class:"flex items-center gap-2"},J1=["disabled"],ex=["disabled"],tx=Be({__name:"RebaseConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(e,{emit:n}){const t=e,a=n,s=k(null),l=k(!1),c=k(t.baseBranch),d=k([]),h=k(!1);async function m($){try{const x=await $fetch("/api/chat/compare",{params:{worktreePath:t.worktreePath,baseBranch:$}});s.value=x.ahead}catch{s.value=null}}vt(async()=>{const $=m(c.value),x=(async()=>{h.value=!0;try{const b=await $fetch("/api/git/branches");d.value=b.branches.filter(y=>!y.isRemote&&!y.name.startsWith("sc/")).map(y=>y.name),d.value.length>0&&!d.value.includes(c.value)&&(c.value=d.value.includes("main")?"main":d.value.includes("master")?"master":d.value[0])}catch{d.value=[]}finally{h.value=!1}})();await Promise.all([$,x])}),De(c,$=>{m($)});function S(){l.value=!0,a("confirm",c.value)}return($,x)=>(i(),u("div",O1,[r("div",U1,[x[3]||(x[3]=r("span",{class:"text-xs font-mono text-retro-text font-semibold uppercase tracking-wide"}," Rebase Worktree ",-1)),r("button",{type:"button",class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors",title:"Cancel",onClick:x[0]||(x[0]=b=>a("cancel"))},[Y(o($t),{class:"w-4 h-4"})])]),r("div",j1,[r("div",z1,[x[4]||(x[4]=r("span",{class:"text-retro-muted"},"worktree:",-1)),r("span",V1,w(e.worktreeBranch),1)]),r("div",W1,[x[5]||(x[5]=r("span",{class:"text-retro-muted"},"target:",-1)),r("div",G1,[Le(r("select",{"onUpdate:modelValue":x[1]||(x[1]=b=>c.value=b),disabled:l.value||h.value,class:"appearance-none bg-retro-black border border-retro-border rounded px-2 py-0.5 pr-6 text-xs font-mono text-retro-cyan focus:outline-none focus:border-retro-cyan cursor-pointer disabled:opacity-40"},[h.value?(i(),u("option",{key:0,value:e.baseBranch},w(e.baseBranch),9,K1)):D("",!0),(i(!0),u(ve,null,Ie(d.value,b=>(i(),u("option",{key:b,value:b},w(b),9,Z1))),128))],8,q1),[[Bn,c.value]]),Y(o(Qr),{class:"absolute right-1 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})])]),r("div",Y1,[x[6]||(x[6]=r("span",{class:"text-retro-muted"},"commits ahead:",-1)),r("span",X1,w(s.value!==null?s.value:"..."),1)])]),r("div",Q1,[r("button",{type:"button",disabled:l.value,class:"flex items-center gap-1 px-3 py-1 text-xs font-mono rounded border transition-colors bg-retro-cyan/10 border-retro-cyan/50 text-retro-cyan hover:bg-retro-cyan/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:S},[Y(o(Yr),{class:"w-3.5 h-3.5"}),Ae(" "+w(l.value?"Rebasing...":"Confirm"),1)],8,J1),r("button",{type:"button",disabled:l.value,class:"px-3 py-1 text-xs font-mono rounded border border-retro-border text-retro-muted hover:text-retro-text hover:border-retro-text/30 transition-colors disabled:opacity-40",onClick:x[2]||(x[2]=b=>a("cancel"))}," Cancel ",8,ex)])]))}}),nx={class:"flex-1 flex flex-col overflow-hidden"},rx={class:"flex-shrink-0 px-4 py-2 border-b border-retro-border flex items-center justify-between bg-retro-dark"},ox={class:"text-xs font-mono text-retro-text truncate"},sx={class:"flex items-center gap-2 flex-shrink-0"},ax=["title"],ix=["disabled"],lx=["disabled"],cx={key:5,class:"text-xs font-mono text-retro-green"},ux={key:6,class:"text-[11px] font-mono text-retro-muted"},dx={key:0,class:"flex items-center justify-center h-full text-retro-muted text-xs font-mono"},fx=["innerHTML"],mx=["value","readonly"],hx={key:2,class:"flex-shrink-0 px-4 py-2 border-t border-retro-border bg-retro-yellow/10 text-retro-yellow text-xs font-mono"},px=Be({__name:"ConflictFileEditor",props:{file:{},resolved:{type:Boolean},aiResolving:{type:Boolean}},emits:["resolve","aiResolve"],setup(e,{emit:n}){const t=e,a=n,s=k(t.file.content),l=k(!1),c=k(""),d=k(!1);De(()=>t.file.path,()=>{s.value=t.file.content,l.value=!1,b()}),De(()=>t.file.content,()=>{l.value||(s.value=t.file.content,b())});const h=/^<{7}\s.*\n([\s\S]*?)^={7}\n([\s\S]*?)^>{7}\s.*\n/gm,m=/^<{7}[^\n]*\n([\s\S]*?)^={7}[^\n]*\n([\s\S]*?)^>{7}[^\n]*\n?/gm,S=R(()=>/^<{7}\s/m.test(s.value)),$=R(()=>B(s.value).length);function x(Z){const O=Z.split(".").pop()?.toLowerCase()||"";return{ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",vue:"vue",html:"html",css:"css",scss:"scss",less:"less",json:"json",yaml:"yaml",yml:"yaml",md:"markdown",py:"python",rb:"ruby",go:"go",rs:"rust",java:"java",kt:"kotlin",swift:"swift",sh:"bash",zsh:"bash",sql:"sql",graphql:"graphql",xml:"xml",svg:"xml",toml:"toml",ini:"ini",dockerfile:"dockerfile"}[O]||"text"}async function b(){d.value=!0;try{const{codeToHtml:Z}=await _n(async()=>{const{codeToHtml:U}=await import("./DqCsQSnP.js");return{codeToHtml:U}},__vite__mapDeps([3,1,2]),import.meta.url),O=x(t.file.path),H=s.value.split(`
|
|
112
|
+
`);let K="",I=!1,v=!1,g=0,T=-1;for(const U of H){g++;const ae=/^<{7}\s/.test(U),N=/^={7}$/.test(U),j=/^>{7}\s/.test(U);if(ae){T++,I=!0,v=!1,K+=`<div class="conflict-line conflict-marker-line" data-line="${g}"><span class="line-number">${g}</span><span class="line-content conflict-marker">${y(U)}</span></div>
|
|
113
|
+
`,t.resolved||(K+=E(T));continue}if(N&&I){I=!1,v=!0,K+=`<div class="conflict-line conflict-marker-line" data-line="${g}"><span class="line-number">${g}</span><span class="line-content conflict-marker">${y(U)}</span></div>
|
|
114
|
+
`;continue}if(j){v=!1,K+=`<div class="conflict-line conflict-marker-line" data-line="${g}"><span class="line-number">${g}</span><span class="line-content conflict-marker">${y(U)}</span></div>
|
|
115
|
+
`;continue}let L=y(U);try{const J=(await Z(U||" ",{lang:O,theme:"vitesse-dark"})).match(/<code[^>]*><span class="line">(.*?)<\/span><\/code>/s);J&&(L=J[1])}catch{}let ee="";I?ee="conflict-ours":v&&(ee="conflict-theirs"),K+=`<div class="conflict-line ${ee}" data-line="${g}"><span class="line-number">${g}</span><span class="line-content">${L}</span></div>
|
|
116
|
+
`}c.value=K}catch{const Z=s.value.split(`
|
|
117
|
+
`);c.value=Z.map((O,G)=>{const H=G+1;return`<div class="conflict-line" data-line="${H}"><span class="line-number">${H}</span><span class="line-content">${y(O)}</span></div>`}).join(`
|
|
118
|
+
`)}finally{d.value=!1}}function y(Z){return Z.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function _(){V("ours")}function W(){V("theirs")}function B(Z){const O=[],G=new RegExp(m.source,m.flags);let H=null,K=0;for(;(H=G.exec(Z))!==null;)O.push({index:K,start:H.index,end:G.lastIndex,ours:H[1]??"",theirs:H[2]??""}),K++;return O}function z(Z,O){return Z?O?Z.endsWith(`
|
|
119
|
+
`)||O.startsWith(`
|
|
120
|
+
`)?`${Z}${O}`:`${Z}
|
|
121
|
+
${O}`:Z:O}function V(Z,O){const G=s.value,H=B(G);if(H.length){if(typeof O=="number"){const K=H.find(v=>v.index===O);if(!K)return;const I=Z==="ours"?K.ours:Z==="theirs"?K.theirs:z(K.ours,K.theirs);s.value=G.slice(0,K.start)+I+G.slice(K.end)}else s.value=G.replace(h,(K,I,v)=>Z==="ours"?I:Z==="theirs"?v:z(I,v));b()}}function E(Z){return`<div class="conflict-inline-actions" data-conflict-controls="${Z}">
|
|
122
|
+
<button type="button" class="conflict-inline-button conflict-inline-button-ours" data-conflict-index="${Z}" data-conflict-action="ours">Accept Ours</button>
|
|
123
|
+
<button type="button" class="conflict-inline-button conflict-inline-button-theirs" data-conflict-index="${Z}" data-conflict-action="theirs">Accept Theirs</button>
|
|
124
|
+
<button type="button" class="conflict-inline-button conflict-inline-button-both" data-conflict-index="${Z}" data-conflict-action="both">Accept Both</button>
|
|
125
|
+
</div>
|
|
126
|
+
`}function oe(Z){const O=Z.target?.closest("button[data-conflict-action]");if(!O||t.resolved)return;const G=O.dataset.conflictAction,H=O.dataset.conflictIndex;if(!G||H===void 0)return;const K=Number.parseInt(H,10);Number.isNaN(K)||V(G,K)}function ce(){S.value||a("resolve",t.file.path,s.value)}function de(){a("aiResolve",t.file.path)}function ge(){l.value=!l.value,l.value||b()}function X(Z){const O=Z.target;s.value=O.value}return vt(()=>{b()}),(Z,O)=>(i(),u("div",nx,[r("div",rx,[r("span",ox,w(e.file.path),1),r("div",sx,[e.resolved?D("",!0):(i(),u("button",{key:0,type:"button",class:ke(["px-2 py-0.5 text-xs font-mono rounded border transition-colors",l.value?"border-retro-yellow/50 text-retro-yellow hover:bg-retro-yellow/10":"border-retro-subtle/50 text-retro-muted hover:bg-retro-subtle/10"]),title:l.value?"Switch to highlighted view":"Switch to edit mode",onClick:ge},[l.value?(i(),he(o(as),{key:0,class:"w-3.5 h-3.5 inline-block"})):(i(),he(o(eo),{key:1,class:"w-3.5 h-3.5 inline-block"}))],10,ax)),!e.resolved&&S.value?(i(),u("button",{key:1,type:"button",disabled:e.aiResolving,class:"flex items-center gap-1 px-2 py-0.5 text-xs font-mono rounded border border-retro-orange/50 text-retro-orange hover:bg-retro-orange/10 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",onClick:de},[Y(o(kr),{class:"w-3.5 h-3.5"}),Ae(" "+w(e.aiResolving?"Resolving...":"AI Resolve"),1)],8,ix)):D("",!0),!e.resolved&&S.value?(i(),u("button",{key:2,type:"button",class:"px-2 py-0.5 text-xs font-mono rounded border border-retro-cyan/50 text-retro-cyan hover:bg-retro-cyan/10 transition-colors",onClick:_}," Accept All Ours ")):D("",!0),!e.resolved&&S.value?(i(),u("button",{key:3,type:"button",class:"px-2 py-0.5 text-xs font-mono rounded border border-retro-magenta/50 text-retro-magenta hover:bg-retro-magenta/10 transition-colors",onClick:W}," Accept All Theirs ")):D("",!0),e.resolved?D("",!0):(i(),u("button",{key:4,type:"button",disabled:S.value,class:"px-2 py-0.5 text-xs font-mono rounded border border-retro-green/50 text-retro-green hover:bg-retro-green/10 transition-colors disabled:opacity-40 disabled:cursor-not-allowed",onClick:ce}," Mark Resolved ",8,lx)),e.resolved?(i(),u("span",cx," Resolved ")):$.value>0?(i(),u("span",ux,w($.value)+" conflict "+w($.value===1?"block":"blocks"),1)):D("",!0)])]),l.value?D("",!0):(i(),u("div",{key:0,class:ke(["flex-1 overflow-auto bg-retro-black conflict-viewer",{"opacity-60":e.resolved}]),onClick:oe},[d.value?(i(),u("div",dx," Highlighting... ")):(i(),u("div",{key:1,class:"conflict-code",innerHTML:c.value},null,8,fx))],2)),l.value?(i(),u("textarea",{key:1,value:s.value,readonly:e.resolved,class:ke(["flex-1 w-full p-4 font-mono text-xs bg-retro-black text-retro-text resize-none focus:outline-none leading-relaxed",{"opacity-60":e.resolved}]),spellcheck:"false",onInput:X},null,42,mx)):D("",!0),S.value&&!e.resolved?(i(),u("div",hx," File still contains conflict markers. Remove all <<<<<<<, =======, >>>>>>> markers to resolve. ")):D("",!0)]))}}),vx={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60"},gx={class:"w-full max-w-5xl mx-4 my-8 h-[80vh] bg-retro-dark border border-retro-border rounded-lg shadow-xl flex flex-col overflow-hidden"},xx={class:"flex-shrink-0 px-4 py-3 border-b border-retro-border flex items-center justify-between"},bx={class:"flex items-center gap-3"},yx={class:"text-xs font-mono text-retro-muted"},wx={class:"flex items-center gap-2"},kx=["disabled"],Cx=["disabled"],$x=["disabled"],Sx={key:0,class:"flex-1 flex items-center justify-center text-retro-muted text-sm font-mono"},_x={key:1,class:"flex-1 flex items-center justify-center text-retro-red text-sm font-mono"},Mx={key:2,class:"flex-1 flex overflow-hidden"},Tx={class:"w-64 flex-shrink-0 border-r border-retro-border overflow-y-auto bg-retro-dark"},Ax={class:"py-1"},Bx=["onClick"],Ex={key:1,class:"flex-1 flex items-center justify-center text-retro-muted text-sm font-mono"},Rx=Be({__name:"ConflictResolutionModal",emits:["close"],setup(e,{emit:n}){const t=n,a=At(),s=k(null),l=k(!1),c=k(!1),d=k(null),h=k(!1),m=R(()=>a.conflictState?.files??[]),S=R(()=>a.conflictState?.resolvedFiles??new Set),$=R(()=>m.value.length),x=R(()=>S.value.size),b=R(()=>$.value>0&&x.value>=$.value),y=R(()=>$.value-x.value),_=R(()=>s.value?m.value.find(de=>de.path===s.value)??null:null);function W(de){return S.value.has(de)}function B(de){s.value=de}async function z(de,ge){await a.resolveConflictFile(de,ge)}async function V(de){d.value=de,await a.aiResolveConflictFile(de),d.value=null}async function E(){h.value=!0,await a.aiResolveAllConflicts(),h.value=!1}async function oe(){l.value=!0;const de=await a.continueRebase();l.value=!1,de.success&&t("close")}async function ce(){c.value=!0,await a.abortRebase(),c.value=!1,t("close")}return(de,ge)=>(i(),he(Xt,{to:"body"},[Y(pn,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:nt(()=>[o(a).conflictState?(i(),u("div",vx,[r("div",gx,[r("div",xx,[r("div",bx,[Y(o(wn),{class:"w-5 h-5 text-retro-yellow"}),ge[0]||(ge[0]=r("h3",{class:"text-sm font-mono text-retro-text font-semibold"},"Resolve Rebase Conflicts",-1)),r("span",yx,w(x.value)+"/"+w($.value)+" resolved ",1)]),r("div",wx,[y.value>0?(i(),u("button",{key:0,type:"button",disabled:h.value||l.value||c.value,class:"flex items-center gap-1 px-3 py-1.5 text-xs font-mono rounded border transition-colors bg-retro-orange/10 border-retro-orange/50 text-retro-orange hover:bg-retro-orange/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:E},[Y(o(kr),{class:"w-3.5 h-3.5"}),Ae(" "+w(h.value?"AI Resolving...":`AI Resolve All (${y.value})`),1)],8,kx)):D("",!0),r("button",{type:"button",disabled:!b.value||l.value||c.value,class:"flex items-center gap-1 px-3 py-1.5 text-xs font-mono rounded border transition-colors bg-retro-green/10 border-retro-green/50 text-retro-green hover:bg-retro-green/20 disabled:opacity-40 disabled:cursor-not-allowed",onClick:oe},w(l.value?"Continuing...":"Continue Rebase"),9,Cx),r("button",{type:"button",disabled:l.value||c.value,class:"px-3 py-1.5 text-xs font-mono rounded border border-retro-red/50 text-retro-red hover:bg-retro-red/10 transition-colors disabled:opacity-40",onClick:ce},w(c.value?"Aborting...":"Abort"),9,$x)])]),o(a).conflictState?.loading?(i(),u("div",Sx," Loading conflict files... ")):o(a).conflictState?.error?(i(),u("div",_x,w(o(a).conflictState.error),1)):(i(),u("div",Mx,[r("div",Tx,[r("div",Ax,[(i(!0),u(ve,null,Ie(m.value,X=>(i(),u("button",{key:X.path,type:"button",class:ke(["w-full text-left px-3 py-2 text-xs font-mono flex items-center gap-2 transition-colors hover:bg-retro-panel",{"bg-retro-panel":s.value===X.path}]),onClick:Z=>B(X.path)},[W(X.path)?(i(),he(o(wr),{key:0,class:"w-3.5 h-3.5 text-retro-green flex-shrink-0"})):(i(),he(o(Un),{key:1,class:"w-3.5 h-3.5 text-retro-yellow flex-shrink-0"})),r("span",{class:ke(["truncate",W(X.path)?"text-retro-green":"text-retro-yellow"])},w(X.path),3)],10,Bx))),128))])]),_.value?(i(),he(px,{key:0,file:_.value,resolved:W(_.value.path),"ai-resolving":d.value===_.value.path||h.value,onResolve:z,onAiResolve:V},null,8,["file","resolved","ai-resolving"])):(i(),u("div",Ex," Select a file to resolve "))]))])])):D("",!0)]),_:1})]))}}),Px={key:0,class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},Dx={class:"flex items-center justify-between p-4 border-b border-retro-border"},Ix={class:"flex items-center gap-2"},Lx={class:"p-4"},Nx={class:"mt-2 text-sm text-retro-text font-mono truncate"},Fx={class:"flex justify-end gap-3 p-4 border-t border-retro-border"},Hx=Be({__name:"DeleteConfirmModal",props:{show:{type:Boolean},title:{}},emits:["confirm","cancel"],setup(e,{emit:n}){const t=n;function a(s){s.target===s.currentTarget&&t("cancel")}return(s,l)=>(i(),he(Xt,{to:"body"},[Y(pn,{"enter-active-class":"transition-opacity duration-200","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-active-class":"transition-opacity duration-200","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:nt(()=>[e.show?(i(),u("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:a},[Y(pn,{"enter-active-class":"transition-all duration-200","enter-from-class":"opacity-0 scale-95","enter-to-class":"opacity-100 scale-100","leave-active-class":"transition-all duration-200","leave-from-class":"opacity-100 scale-100","leave-to-class":"opacity-0 scale-95"},{default:nt(()=>[e.show?(i(),u("div",Px,[r("div",Dx,[r("div",Ix,[Y(o(wn),{class:"w-5 h-5 text-retro-red"}),l[3]||(l[3]=r("h3",{class:"text-lg font-mono text-retro-text"},"Delete Conversation",-1))]),r("button",{onClick:l[0]||(l[0]=c=>t("cancel")),class:"p-1 hover:bg-retro-panel rounded transition-colors"},[Y(o($t),{class:"w-5 h-5 text-retro-muted"})])]),r("div",Lx,[l[4]||(l[4]=r("p",{class:"text-sm text-retro-muted font-mono"}," Are you sure you want to delete this conversation? ",-1)),r("p",Nx,' "'+w(e.title)+'" ',1),l[5]||(l[5]=r("p",{class:"mt-3 text-xs text-retro-muted"}," This action cannot be undone. ",-1))]),r("div",Fx,[r("button",{onClick:l[1]||(l[1]=c=>t("cancel")),class:"px-4 py-2 text-sm font-mono text-retro-muted border border-retro-border rounded hover:bg-retro-panel transition-colors"}," Cancel "),r("button",{onClick:l[2]||(l[2]=c=>t("confirm")),class:"px-4 py-2 text-sm font-mono text-white bg-retro-red/80 border border-retro-red rounded hover:bg-retro-red transition-colors"}," Delete ")])])):D("",!0)]),_:1})])):D("",!0)]),_:1})]))}}),Ox={class:"h-full flex flex-col bg-retro-black"},Ux={class:"flex-shrink-0 h-12 flex items-center justify-between px-4 border-b border-retro-border bg-retro-dark"},jx={class:"flex items-center gap-2 min-w-0"},zx={class:"text-xs font-mono text-retro-text truncate"},Vx={class:"flex items-center gap-1"},Wx=["disabled","title"],Gx=["title"],qx=["title"],Kx=["disabled"],Zx={key:4,class:"flex-shrink-0 px-4 py-2 border-b border-retro-border bg-retro-green/10 text-retro-green text-xs font-mono text-center"},Yx={class:"flex-1 min-h-0 flex flex-col"},Xx=Be({__name:"ChatPanel",setup(e){const n=At(),t=As(),{disconnectConversation:a}=po();vt(async()=>{try{const g=await $fetch("/api/cwd");n.setCwd(g.cwd)}catch{}});const s=R(()=>n.activeConversation?.title||"New Chat"),l=k(!1),c=R(()=>t.isChatFullscreen),d=k(!1);De(d,g=>{n.setDebugStreamEnabled(g)}),wt(()=>{n.setDebugStreamEnabled(!1)});function h(){t.toggleChatFullscreen()}async function m(){l.value=!1;const g=n.activeConversationId;g&&(a(g),await n.deleteConversation(g)),n.clearMessages()}function S(){n.hasMessages&&(l.value=!0)}function $(){l.value=!1}const x=k(!1),b=k(null),y=R(()=>n.activeConversation?.finalized===!0),_=R(()=>y.value),W=k(null),B=k(!1);async function z(){const g=n.activeConversation;if(!g?.worktreePath||!g?.baseBranch){W.value=null;return}B.value=!0;try{const T=await $fetch("/api/chat/compare",{params:{worktreePath:g.worktreePath,baseBranch:g.baseBranch}});W.value=T}catch{W.value=null}finally{B.value=!1}}De(()=>[n.activeConversationId,n.activeConversation?.worktreePath,n.activeConversation?.baseBranch,n.activeConversation?.lastCommitTime],()=>{z()},{immediate:!0});const V=R(()=>W.value?W.value.ahead===0&&W.value.behind===0:!1),E=R(()=>{const g=n.activeConversation;return g?.hasWorktree&&!g?.finalized&&!n.isActiveConversationStreaming}),oe=R(()=>E.value&&!V.value);function ce(){x.value=!0,b.value=null}async function de(g,T){const U=n.activeConversationId;if(!U)return;const ae=await n.finalizeConversation(U,g,T);if(x.value=!1,ae.success)b.value={type:"success",message:`Merged to ${T}`},setTimeout(()=>{b.value=null},5e3);else if(ae.rebaseInProgress)b.value=null;else{const N=ae.conflictFiles?.length?`Conflict in: ${ae.conflictFiles.join(", ")}`:ae.error||"Finalize failed";b.value={type:"error",message:N}}}function ge(){x.value=!1}function X(){if(!n.conflictState&&n.activeConversation?.hasWorktree){const g=n.activeConversation?.baseBranch||"main";b.value={type:"success",message:`Rebased onto ${g}`},setTimeout(()=>{b.value=null},5e3)}else b.value=null}const Z=k(!1),O=R(()=>!!n.activeConversation?.previewBranch);async function G(){const g=n.activeConversationId;if(!g)return;Z.value=!0,b.value=null;const T=O.value,U=await n.togglePreview(g);if(U.success){const ae=T?`Switched back to ${n.activeConversation?.baseBranch}`:"Preview active — main worktree updated";b.value={type:"success",message:ae},setTimeout(()=>{b.value=null},3e3)}else b.value={type:"error",message:U.error||"Preview toggle failed"};Z.value=!1}const H=k(!1);function K(){H.value=!0,b.value=null}async function I(g){const T=n.activeConversationId;if(!T)return;const U=await n.rebaseConversation(T,g);H.value=!1,U.success?(b.value={type:"success",message:`Rebased onto ${g}`},setTimeout(()=>{b.value=null},5e3)):U.rebaseInProgress?b.value=null:b.value={type:"error",message:U.error||"Rebase failed"}}function v(){H.value=!1}return(g,T)=>(i(),u("div",Ox,[r("div",Ux,[r("div",jx,[r("span",zx,w(o(s)),1)]),r("div",Vx,[o(E)?(i(),u("button",{key:0,disabled:o(Z),class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors disabled:opacity-40 disabled:cursor-not-allowed",title:o(O)?"End preview: switch back to base branch":"Preview: test worktree changes in main worktree",onClick:G},[o(O)?(i(),he(o(aa),{key:0,class:"w-4 h-4 text-retro-cyan"})):(i(),he(o(as),{key:1,class:"w-4 h-4"}))],8,Wx)):D("",!0),o(oe)?(i(),u("button",{key:1,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Rebase: sync worktree onto target base branch",onClick:K},[...T[2]||(T[2]=[Wo('<svg class="w-4 h-4" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><circle cx="7" cy="4.5" r="1.5" fill="currentColor"></circle><circle cx="18" cy="20" r="1.5" fill="currentColor"></circle><circle cx="12" cy="7" r="1.4" fill="currentColor" opacity="0.9"></circle><path d="M7 6V16M7 16L4.5 13.5M7 16L9.5 13.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path><path d="M8.4 7H12.5C15.5376 7 18 9.46243 18 12.5V18.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path><path d="M15.5 16L18 18.5L20.5 16" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path></svg>',1)])])):D("",!0),o(oe)?(i(),u("button",{key:2,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:"Finalize: squash & merge to base branch",onClick:ce},[Y(o(wr),{class:"w-4 h-4"})])):D("",!0),r("button",{class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:o(c)?"Exit fullscreen chat":"Fullscreen chat",onClick:h},[o(c)?(i(),he(o(Qo),{key:0,class:"w-4 h-4"})):(i(),he(o(Jo),{key:1,class:"w-4 h-4"}))],8,Gx),r("button",{class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel transition-colors",title:o(d)?"Hide debug stream":"Show debug stream",onClick:T[0]||(T[0]=U=>d.value=!o(d))},[Y(o(Qs),{class:ke(["w-4 h-4",o(d)?"text-retro-cyan":""])},null,8,["class"])],8,qx),r("button",{disabled:!o(n).hasMessages,class:"p-1.5 rounded text-retro-muted hover:text-retro-cyan hover:bg-retro-panel disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:"New conversation",onClick:S},[Y(o(vn),{class:"w-4 h-4"})],8,Kx)])]),Y(Hx,{show:o(l),title:o(s),onConfirm:m,onCancel:$},null,8,["show","title"]),o(x)&&o(n).activeConversation?.hasWorktree?(i(),he(H1,{key:0,"base-branch":o(n).activeConversation.baseBranch||"main","worktree-branch":o(n).activeConversation.worktreeBranch||"","worktree-path":o(n).activeConversation.worktreePath||"",onConfirm:de,onCancel:ge},null,8,["base-branch","worktree-branch","worktree-path"])):D("",!0),o(H)&&o(n).activeConversation?.hasWorktree?(i(),he(tx,{key:1,"base-branch":o(n).activeConversation.baseBranch||"main","worktree-branch":o(n).activeConversation.worktreeBranch||"","worktree-path":o(n).activeConversation.worktreePath||"",onConfirm:I,onCancel:v},null,8,["base-branch","worktree-branch","worktree-path"])):D("",!0),o(n).conflictState?(i(),he(Rx,{key:2,onClose:X})):D("",!0),o(b)?(i(),u("div",{key:3,class:ke(["flex-shrink-0 px-4 py-2 border-b border-retro-border text-xs font-mono",o(b).type==="success"?"bg-retro-green/10 text-retro-green":"bg-retro-red/10 text-retro-red"])},[Ae(w(o(b).message)+" ",1),o(b).type==="error"?(i(),u("button",{key:0,class:"ml-2 underline hover:no-underline",onClick:T[1]||(T[1]=U=>b.value=null)}," dismiss ")):D("",!0)],2)):D("",!0),o(y)?(i(),u("div",Zx," This conversation has been finalized and is read-only. ")):D("",!0),r("div",Yx,[Y(Ag,{class:"flex-1 overflow-hidden"}),o(d)?(i(),he(k1,{key:0})):D("",!0)]),Y(f1,{disabled:o(_)},null,8,["disabled"])]))}}),Qx={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},Jx={class:"flex items-center gap-2 min-w-0"},e0=["title"],t0={class:"text-retro-text font-mono text-sm truncate"},n0={class:"text-retro-muted"},r0={class:"text-retro-text"},o0={class:"text-retro-muted font-mono text-xs flex-shrink-0"},s0={class:"flex-1 overflow-auto"},a0={key:0,class:"flex items-center justify-center gap-2 text-retro-muted text-sm py-8"},i0={key:1,class:"flex items-center justify-center text-retro-muted text-sm py-8"},l0={key:2,class:"flex items-center justify-center text-retro-muted text-sm py-8"},c0={key:3,class:"w-full text-xs font-mono border-collapse diff-table"},u0={key:0,class:"diff-warning"},d0={key:0,colspan:"3",class:"diff-hunk-header px-4 py-1"},f0={class:"diff-line-num select-none text-right px-2 w-12"},m0={class:"diff-line-num select-none text-right px-2 w-12 border-r border-retro-border"},h0={class:"diff-line-content px-3 whitespace-pre-wrap break-all"},p0={key:0,class:"diff-sign"},v0={key:1,class:"diff-sign"},g0={key:2,class:"diff-sign"},x0={key:4,class:"flex items-center justify-center text-retro-muted text-sm py-8"},b0=Be({__name:"GitFileDiffViewer",props:{file:{},commitHash:{},content:{},loading:{type:Boolean}},emits:["close"],setup(e,{emit:n}){const t=e,a=n,s=k(null),l=R(()=>t.commitHash.substring(0,7)),c=R(()=>Fn[t.file.status]||{label:t.file.status,colorClass:"text-retro-muted"}),d=R(()=>t.file.status==="R"&&t.file.oldPath);function h(m){m.key==="Escape"&&(m.preventDefault(),m.stopPropagation(),a("close"))}return vt(()=>{s.value?.focus()}),wt(()=>{}),(m,S)=>(i(),u("div",{ref_key:"containerRef",ref:s,tabindex:0,onKeydown:h,class:"flex flex-col h-full bg-retro-dark focus:outline-none","aria-label":"File diff viewer",role:"region"},[r("div",Qx,[r("div",Jx,[r("span",{class:ke(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",c.value.colorClass]),title:c.value.label},w(e.file.status),11,e0),r("span",t0,[d.value&&e.file.oldPath?(i(),u(ve,{key:0},[r("span",n0,w(e.file.oldPath),1),S[1]||(S[1]=r("span",{class:"text-retro-yellow mx-1"},"→",-1)),r("span",r0,w(e.file.path),1)],64)):(i(),u(ve,{key:1},[Ae(w(e.file.path),1)],64))]),r("span",o0," @ "+w(l.value),1)]),r("button",{onClick:S[0]||(S[0]=$=>a("close")),class:"p-1 hover:bg-retro-dark rounded transition-colors flex-shrink-0 focus:outline-none focus:ring-2 focus:ring-retro-cyan","aria-label":"Close diff viewer",title:"Close (Esc)"},[Y(o($t),{class:"w-5 h-5 text-retro-muted hover:text-retro-text"})])]),r("div",s0,[e.loading?(i(),u("div",a0,[...S[2]||(S[2]=[r("div",{class:"w-4 h-4 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),Ae(" Loading diff... ",-1)])])):e.content&&e.content.binary?(i(),u("div",i0,[...S[3]||(S[3]=[r("span",{class:"bg-retro-panel px-4 py-2 rounded font-mono"}," Binary file — cannot display diff ",-1)])])):e.content&&e.content.lines.length===0?(i(),u("div",l0,[...S[4]||(S[4]=[r("span",{class:"bg-retro-panel px-4 py-2 rounded font-mono"}," No changes in this file ",-1)])])):e.content?(i(),u("table",c0,[r("tbody",null,[e.content.truncated?(i(),u("tr",u0,[...S[5]||(S[5]=[r("td",{colspan:"3",class:"px-4 py-2 text-retro-yellow bg-retro-panel text-center"}," Diff truncated — file has more than 10,000 lines ",-1)])])):D("",!0),(i(!0),u(ve,null,Ie(e.content.lines,($,x)=>(i(),u("tr",{key:x,class:ke({"diff-add":$.type==="add","diff-delete":$.type==="delete","diff-context":$.type==="context","diff-header":$.type==="header"})},[$.type==="header"?(i(),u("td",d0,w($.content),1)):(i(),u(ve,{key:1},[r("td",f0,w($.oldLineNumber??""),1),r("td",m0,w($.newLineNumber??""),1),r("td",h0,[$.type==="add"?(i(),u("span",p0,"+")):$.type==="delete"?(i(),u("span",v0,"-")):(i(),u("span",g0," ")),Ae(" "+w($.content),1)])],64))],2))),128))])])):(i(),u("div",x0," Failed to load diff content. "))])],544))}}),y0=yr(b0,[["__scopeId","data-v-c726b0c5"]]),w0={class:"fixed inset-0 z-50 flex items-center justify-center"},k0={class:"relative w-[90vw] max-w-lg bg-retro-black border border-retro-border rounded-lg shadow-2xl flex flex-col overflow-hidden"},C0={class:"flex-shrink-0 h-12 flex items-center justify-between px-4 border-b border-retro-border bg-retro-dark"},$0={class:"flex items-center gap-2"},S0={class:"text-sm font-mono text-retro-text"},_0={class:"p-6 overflow-y-auto max-h-[70vh] space-y-6"},M0={key:0},T0={class:"space-y-6"},A0={class:"space-y-1.5"},B0=["value","checked","onChange"],E0={class:"flex-1"},R0={class:"text-sm font-mono text-retro-text"},P0={class:"text-xs text-retro-muted leading-tight"},D0={class:"text-xs font-mono text-retro-muted"},I0={class:"text-xs text-retro-muted mb-3"},L0=["disabled"],N0={class:"space-y-1.5"},F0=["value","checked","onChange"],H0={class:"flex-1"},O0={class:"text-sm font-mono text-retro-text"},U0={class:"text-xs text-retro-muted leading-tight"},j0={class:"flex items-center gap-4 px-3 py-2 rounded border border-retro-border bg-retro-panel"},z0=["value"],V0={class:"font-mono text-retro-cyan text-sm w-6 text-center"},W0={key:1,class:"space-y-4"},G0={class:"space-y-1.5"},q0=["checked"],K0=["checked"],Z0={class:"flex items-center justify-between px-3 py-2 rounded border border-retro-border bg-retro-panel"},Y0={class:"text-xs font-mono text-retro-cyan"},X0=Be({__name:"SettingsModal",emits:["close"],setup(e,{emit:n}){const t=n,a=Hn(),s=Ns(),l=On(),c=k("main"),d=k(!1),h=R(()=>s.public.appVersion||"unknown"),m=[{value:"dark",label:"Dark",description:"Retro terminal theme with dark backgrounds"},{value:"light",label:"Light",description:"Bright theme for well-lit environments"}],S=[{value:"plan",label:Dn.plan,description:or.plan,icon:Jr,color:"text-retro-cyan"},{value:"ask",label:Dn.ask,description:or.ask,icon:to,color:"text-retro-green"},{value:"auto",label:Dn.auto,description:or.auto,icon:Zr,color:"text-retro-yellow"},{value:"bypass",label:Dn.bypass,description:or.bypass,icon:no,color:"text-retro-red"}],{data:$,pending:x,error:b}=Nr("ai-providers",()=>$fetch("/api/ai/providers"),{server:!1}),y=R(()=>$.value?.providers??[]),_=R(()=>{const K=b.value;return K?K instanceof Error?K.message:String(K):null}),{data:W,refresh:B}=Nr("spec-search-status",()=>$fetch("/api/specs/status"),{server:!1,default:()=>null}),z=R(()=>{const K=W.value;return K?K.isIndexing?`Indexing (${K.currentJob||"running"})`:K.schedulerActive?`Indexed ${K.fileCount} files / ${K.chunkCount} chunks`:"Scheduler inactive":"Status unavailable"});vt(()=>{a.hydrate()});const V=K=>{a.setProviderSelection(K),l.success("Settings saved")},E=()=>{c.value="provider"},oe=()=>{c.value="main"},ce=K=>{a.setTheme(K),l.success("Settings saved")},de=K=>{a.setPermissionMode(K),l.success("Settings saved")},ge=K=>{const I=parseInt(K.target.value,10);isNaN(I)||(a.setAutoModeConcurrency(I),l.success("Settings saved"))},X=K=>{a.setAutoGenerateCommitMessages(K),l.success("Settings saved")},Z=()=>{t("close")},O=async()=>{if(!d.value){d.value=!0;try{const K=await $fetch("/api/specs/reindex",{method:"POST",body:{}});!K.success&&K.status==="already-indexing"?l.info("Spec index is already running"):l.success("Spec reindex started"),await B()}catch(K){l.error(K instanceof Error?K.message:"Failed to start spec reindex")}finally{d.value=!1}}},G=K=>{K.key==="Escape"&&t("close")};vt(()=>{window.addEventListener("keydown",G)}),wt(()=>{window.removeEventListener("keydown",G)});let H=null;return vt(()=>{H=ho(()=>{B()},5e3)}),wt(()=>{H&&clearInterval(H)}),(K,I)=>(i(),he(Xt,{to:"body"},[r("div",w0,[r("div",{class:"absolute inset-0 bg-black/70",onClick:Z}),r("div",k0,[r("div",C0,[r("div",$0,[c.value==="provider"?(i(),u("button",{key:0,type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Back",onClick:oe},[Y(o(Ys),{class:"h-4 w-4"})])):D("",!0),r("h2",S0,w(c.value==="provider"?"AI Provider Settings":"Settings"),1)]),r("button",{type:"button",class:"p-1.5 rounded text-retro-muted hover:text-retro-text hover:bg-retro-panel transition-colors",title:"Close",onClick:I[0]||(I[0]=v=>t("close"))},[Y(o($t),{class:"h-4 w-4"})])]),r("div",_0,[c.value==="main"?(i(),u("section",M0,[r("div",T0,[r("section",null,[I[3]||(I[3]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Theme",-1)),I[4]||(I[4]=r("p",{class:"text-xs text-retro-muted mb-3"}," Choose between dark and light appearance. ",-1)),r("div",A0,[(i(),u(ve,null,Ie(m,v=>r("label",{key:v.value,class:ke(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[o(a).theme===v.value?"border-retro-cyan bg-retro-cyan/10":"border-retro-border bg-retro-panel hover:border-retro-muted"]])},[r("input",{type:"radio",name:"theme",value:v.value,checked:o(a).theme===v.value,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:g=>ce(v.value)},null,40,B0),r("div",E0,[r("div",R0,w(v.label),1),r("div",P0,w(v.description),1)])],2)),64))])]),I[14]||(I[14]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[I[6]||(I[6]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"AI Provider",-1)),I[7]||(I[7]=r("p",{class:"text-xs text-retro-muted mb-3"}," Configure provider and model settings for new conversations. ",-1)),r("button",{type:"button",class:"w-full flex items-center justify-between px-3 py-2 rounded border border-retro-border bg-retro-panel hover:border-retro-muted transition-colors",onClick:E},[I[5]||(I[5]=r("span",{class:"text-sm font-mono text-retro-text"},"Provider Settings",-1)),r("span",D0,w(o(a).providerSelection.providerId)+" / "+w(o(a).providerSelection.modelKey),1)])]),I[15]||(I[15]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[I[8]||(I[8]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Spec Search Index",-1)),r("p",I0,w(z.value),1),r("button",{type:"button",class:"w-full flex items-center justify-center px-3 py-2 rounded border border-retro-border bg-retro-panel text-retro-text hover:border-retro-muted transition-colors disabled:opacity-60",disabled:d.value||o(W)?.isIndexing,onClick:O},w(d.value?"Starting reindex...":"Reindex Specs"),9,L0)]),I[16]||(I[16]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[I[9]||(I[9]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Default Permission Mode",-1)),I[10]||(I[10]=r("p",{class:"text-xs text-retro-muted mb-3"}," Set the default permission mode for all new chat conversations. ",-1)),r("div",N0,[(i(),u(ve,null,Ie(S,v=>r("label",{key:v.value,class:ke(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[o(a).permissionMode===v.value?"border-retro-cyan bg-retro-cyan/10":"border-retro-border bg-retro-panel hover:border-retro-muted"]])},[r("input",{type:"radio",name:"permission-mode",value:v.value,checked:o(a).permissionMode===v.value,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:g=>de(v.value)},null,40,F0),(i(),he(In(v.icon),{class:ke(["w-4 h-4 flex-shrink-0",v.color])},null,8,["class"])),r("div",H0,[r("div",O0,w(v.label),1),r("div",U0,w(v.description),1)])],2)),64))])]),I[17]||(I[17]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[I[12]||(I[12]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Auto Mode",-1)),I[13]||(I[13]=r("p",{class:"text-xs text-retro-muted mb-3"}," Configure how many spec cascades can run in parallel during Auto Mode. ",-1)),r("div",j0,[I[11]||(I[11]=r("label",{class:"font-mono text-retro-text text-sm whitespace-nowrap",for:"concurrency-modal"}," Concurrency ",-1)),r("input",{id:"concurrency-modal",type:"range",min:"1",max:"10",step:"1",value:o(a).autoModeConcurrency,class:"flex-1 accent-retro-cyan",onChange:ge},null,40,z0),r("span",V0,w(o(a).autoModeConcurrency),1)])])])])):(i(),u("section",W0,[I[18]||(I[18]=r("div",null,[r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"AI Provider"),r("p",{class:"text-xs text-retro-muted mb-3"}," Choose which registered provider and model powers new conversations. ")],-1)),Y(Ws,{providers:y.value,selected:o(a).providerSelection,permissionMode:o(a).permissionMode,pending:o(x),errorMessage:_.value,onSelect:V},null,8,["providers","selected","permissionMode","pending","errorMessage"])])),I[26]||(I[26]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[I[21]||(I[21]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Commit Messages",-1)),I[22]||(I[22]=r("p",{class:"text-xs text-retro-muted mb-3"}," Choose whether to use AI to generate commit messages automatically. ",-1)),r("div",G0,[r("label",{class:ke(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[o(a).autoGenerateCommitMessages?"border-retro-border bg-retro-panel hover:border-retro-muted":"border-retro-cyan bg-retro-cyan/10"]])},[r("input",{type:"radio",name:"commit-messages",value:!1,checked:!o(a).autoGenerateCommitMessages,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:I[1]||(I[1]=v=>X(!1))},null,40,q0),I[19]||(I[19]=r("div",{class:"flex-1"},[r("div",{class:"text-sm font-mono text-retro-text"},"Template (Recommended)"),r("div",{class:"text-xs text-retro-muted leading-tight"},"Simple template-based messages. No token usage.")],-1))],2),r("label",{class:ke(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[o(a).autoGenerateCommitMessages?"border-retro-cyan bg-retro-cyan/10":"border-retro-border bg-retro-panel hover:border-retro-muted"]])},[r("input",{type:"radio",name:"commit-messages",value:!0,checked:o(a).autoGenerateCommitMessages,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:I[2]||(I[2]=v=>X(!0))},null,40,K0),I[20]||(I[20]=r("div",{class:"flex-1"},[r("div",{class:"text-sm font-mono text-retro-text"},"AI-Generated"),r("div",{class:"text-xs text-retro-muted leading-tight"},"Uses Claude Haiku to create meaningful commit messages. ~300-500 tokens per commit.")],-1))],2)])]),I[27]||(I[27]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[I[24]||(I[24]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Spec-Cat",-1)),I[25]||(I[25]=r("p",{class:"text-xs text-retro-muted mb-3"}," Application version. ",-1)),r("div",Z0,[I[23]||(I[23]=r("span",{class:"text-sm font-mono text-retro-text"},"Version",-1)),r("span",Y0,w(h.value),1)])])])])])]))}}),Q0={class:"fixed top-4 right-4 z-50 flex flex-col gap-2 max-w-sm"},J0={class:"flex-1 text-sm font-mono text-retro-text"},eb=["onClick"],tb=Be({__name:"ToastContainer",setup(e){const{toasts:n,remove:t}=On(),a={success:{bg:"bg-retro-green/20",icon:"text-retro-green",border:"border-retro-green/50"},error:{bg:"bg-retro-red/20",icon:"text-retro-red",border:"border-retro-red/50"},info:{bg:"bg-retro-cyan/20",icon:"text-retro-cyan",border:"border-retro-cyan/50"},warning:{bg:"bg-retro-yellow/20",icon:"text-retro-yellow",border:"border-retro-yellow/50"}},s=l=>{switch(l){case"success":return wr;case"error":return Un;case"warning":return wn;default:return ua}};return(l,c)=>(i(),he(Xt,{to:"body"},[r("div",Q0,[Y(Fs,{"enter-active-class":"transition-all duration-300 ease-out","leave-active-class":"transition-all duration-200 ease-in","enter-from-class":"opacity-0 translate-x-4","enter-to-class":"opacity-100 translate-x-0","leave-from-class":"opacity-100 translate-x-0","leave-to-class":"opacity-0 translate-x-4"},{default:nt(()=>[(i(!0),u(ve,null,Ie(o(n),d=>(i(),u("div",{key:d.id,class:ke(["flex items-start gap-3 p-3 rounded-lg border shadow-lg",[a[d.type].bg,a[d.type].border]])},[(i(),he(In(s(d.type)),{class:ke(["h-5 w-5 flex-shrink-0 mt-0.5",a[d.type].icon])},null,8,["class"])),r("p",J0,w(d.message),1),r("button",{type:"button",class:"p-0.5 rounded text-retro-muted hover:text-retro-text transition-colors",onClick:h=>o(t)(d.id)},[Y(o($t),{class:"h-4 w-4"})],8,eb)],2))),128))]),_:1})])]))}});function zo(e){typeof document>"u"||(e==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),document.cookie=`spec-cat-theme=${e};path=/;SameSite=Lax`)}function nb(){const e=Hn(),n=R(()=>e.theme),t=R(()=>e.theme==="dark");function a(){const s=e.theme==="dark"?"light":"dark";e.setTheme(s),zo(s)}return De(()=>e.theme,s=>{zo(s)},{immediate:!0}),{theme:n,isDark:t,toggleTheme:a}}const rb={class:"flex h-screen min-w-[320px] overflow-x-auto bg-retro-black text-retro-text"},ob={class:"flex flex-col overflow-hidden",style:{flex:"3"}},sb={class:"flex-shrink-0 h-14 flex items-center justify-between px-4 border-b border-retro-border bg-retro-panel"},ab={class:"flex items-center gap-2 min-w-0"},ib={key:0,class:"text-xs text-retro-muted font-mono truncate"},lb={class:"flex items-center gap-1"},cb=["title"],ub={class:"flex-1 min-h-0 overflow-y-auto"},db={class:"relative flex min-w-0",style:{flex:"7"}},fb={class:"flex flex-col overflow-hidden border-l border-retro-border",style:{flex:"2"}},mb={class:"flex flex-col overflow-hidden border-l border-retro-border",style:{flex:"2"}},hb={key:0,class:"absolute inset-0 z-30 flex flex-col overflow-hidden border-l border-retro-border bg-retro-black"},bb=Be({__name:"default",setup(e){const n=As(),t=Hn(),a=At(),s=_r(),{isDark:l,toggleTheme:c}=nb(),d=R(()=>s.diffViewerFile!==null),h=R(()=>n.isChatFullscreen),m=R(()=>h.value),S=R(()=>h.value?7:3),$=k(!1),x=k(""),b=R(()=>{if(!x.value)return"";const W=x.value.replace(/\/+$/,"").split("/");return W[W.length-1]||""}),y=R(()=>b.value?`spec cat :: ${b.value}`:"spec cat");Hs(()=>({title:y.value}));const _=()=>{typeof window<"u"&&n.updateViewport(window.innerWidth)};return vt(async()=>{typeof window<"u"&&(n.updateViewport(window.innerWidth),window.addEventListener("resize",_)),await t.hydrate(),await a.initialize(),await a.loadConversations();try{const W=await $fetch("/api/cwd");x.value=W.cwd}catch{x.value=""}}),wt(()=>{typeof window<"u"&&window.removeEventListener("resize",_)}),(W,B)=>{const z=Sm;return i(),u("div",rb,[r("div",ob,[r("div",sb,[r("div",ab,[B[4]||(B[4]=r("img",{alt:"SpecCat",src:_m,class:"w-5 h-5 text-retro-cyan mb-1"},null,-1)),B[5]||(B[5]=r("span",{class:"text-sm font-bold text-retro-cyan font-mono uppercase tracking-wider flex-shrink-0"},"SPECCAT",-1)),b.value?(i(),u("span",ib,"/ "+w(b.value),1)):D("",!0)]),r("div",lb,[r("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-panel",title:o(l)?"Switch to light theme":"Switch to dark theme",onClick:B[0]||(B[0]=(...V)=>o(c)&&o(c)(...V))},[o(l)?(i(),he(o(va),{key:0,class:"w-5 h-5"})):(i(),he(o(ma),{key:1,class:"w-5 h-5"}))],8,cb),r("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-panel",title:"Settings",onClick:B[1]||(B[1]=V=>$.value=!0)},[Y(o(os),{class:"w-5 h-5"})])])]),r("div",ub,[Y(z,{"working-directory":x.value},null,8,["working-directory"])])]),r("div",db,[Le(r("div",fb,[Y(cp)],512),[[xo,!m.value]]),Le(r("div",mb,[Y(Xp)],512),[[xo,!m.value]]),r("div",{class:"flex flex-col overflow-hidden border-l border-retro-border",style:Et({flex:S.value})},[Y(Xx)],4),d.value?(i(),u("div",hb,[Y(y0,{file:o(s).diffViewerFile,"commit-hash":o(s).diffViewerCommitHash,content:o(s).diffViewerContent,loading:o(s).diffViewerLoading,onClose:B[2]||(B[2]=V=>o(s).closeFileDiff())},null,8,["file","commit-hash","content","loading"])])):D("",!0)]),$.value?(i(),he(X0,{key:0,onClose:B[3]||(B[3]=V=>$.value=!1)})):D("",!0),Y(tb)])}}});export{bb as default};
|