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.
Files changed (46) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/_nuxt/{CG1pdqEM.js → ASOk6VwA.js} +1 -1
  3. package/.output/public/_nuxt/B24bRLVA.js +1 -0
  4. package/.output/public/_nuxt/{DZfSmUhR.js → B3SzeM5g.js} +1 -1
  5. package/.output/public/_nuxt/{wF8_ZCpc.js → CPqjerP3.js} +1 -1
  6. package/.output/public/_nuxt/D3Ay6Tay.js +126 -0
  7. package/.output/public/_nuxt/{BGX7vZ2E.js → DN_vgzh9.js} +1 -1
  8. package/.output/public/_nuxt/{CJ5aKHH_.js → Djrn6aq0.js} +2 -2
  9. package/.output/public/_nuxt/{BgAW4X6A.js → DqCsQSnP.js} +1 -1
  10. package/.output/public/_nuxt/{Bo0qwvIG.js → afuUTAOf.js} +1 -1
  11. package/.output/public/_nuxt/builds/latest.json +1 -1
  12. package/.output/public/_nuxt/builds/meta/a94a9679-4171-4043-b507-a48b9a35f087.json +1 -0
  13. package/.output/public/_nuxt/{BRNtaPwh.js → dYG8t45S.js} +1 -1
  14. package/.output/public/_nuxt/entry.qjEvbHpP.css +1 -0
  15. package/.output/server/chunks/_/chat.mjs +8 -2
  16. package/.output/server/chunks/_/chat.mjs.map +1 -1
  17. package/.output/server/chunks/_/codexProvider.mjs +62 -102
  18. package/.output/server/chunks/_/codexProvider.mjs.map +1 -1
  19. package/.output/server/chunks/_/providerProcessError.mjs.map +1 -1
  20. package/.output/server/chunks/_/validateWorktree.mjs +1 -1
  21. package/.output/server/chunks/build/client.precomputed.mjs +1 -1
  22. package/.output/server/chunks/build/client.precomputed.mjs.map +1 -1
  23. package/.output/server/chunks/nitro/nitro.mjs +813 -795
  24. package/.output/server/chunks/routes/_ws.mjs +346 -256
  25. package/.output/server/chunks/routes/_ws.mjs.map +1 -1
  26. package/.output/server/chunks/routes/api/chat/finalize.post.mjs +8 -6
  27. package/.output/server/chunks/routes/api/chat/finalize.post.mjs.map +1 -1
  28. package/.output/server/chunks/routes/api/chat/generate-commit-message.post.mjs +1 -1
  29. package/.output/server/chunks/routes/api/chat/preview.post.mjs +1 -1
  30. package/.output/server/chunks/routes/api/chat/preview.post.mjs.map +1 -1
  31. package/.output/server/chunks/routes/api/chat/rebase.post.mjs +1 -1
  32. package/.output/server/chunks/routes/api/chat/worktree.post.mjs +3 -3
  33. package/.output/server/chunks/routes/api/chat/worktree.post.mjs.map +1 -1
  34. package/.output/server/chunks/routes/api/conversations/archives/_archiveId/restore.post.mjs +3 -7
  35. package/.output/server/chunks/routes/api/conversations/archives/_archiveId/restore.post.mjs.map +1 -1
  36. package/.output/server/chunks/routes/api/conversations/update.post.mjs +59 -0
  37. package/.output/server/chunks/routes/api/conversations/update.post.mjs.map +1 -0
  38. package/.output/server/chunks/routes/api/rebase/continue-sync.post.mjs +1 -1
  39. package/.output/server/chunks/routes/api/rebase/continue.post.mjs +8 -6
  40. package/.output/server/chunks/routes/api/rebase/continue.post.mjs.map +1 -1
  41. package/.output/server/package.json +1 -1
  42. package/package.json +1 -1
  43. package/.output/public/_nuxt/CQT7IgVF.js +0 -1
  44. package/.output/public/_nuxt/CWTghksz.js +0 -128
  45. package/.output/public/_nuxt/builds/meta/83cad684-1ef2-41bf-8031-41fb1a7c2996.json +0 -1
  46. package/.output/public/_nuxt/entry.CA9G_QPQ.css +0 -1
@@ -1,128 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./DZfSmUhR.js","./CJ5aKHH_.js","./entry.CA9G_QPQ.css","./BgAW4X6A.js"])))=>i.map(i=>d[i]);
2
- import{y as i,z as u,A as r,d as _e,C as K,G as o,P as Re,R as vt,Q as Oe,S as he,E as $e,B as _,O as L,g as $,U as Ee,V as mn,k as N,W as St,H as ye,L as le,o as ct,X as gt,Y as jo,K as Be,Z as qt,T as Zt,_ as In,M as hn,D as Ke,N as pt,$ as Es,I as gr,a0 as we,a1 as Tn,a2 as Pt,a3 as En,a4 as Lr,a5 as Rs,a6 as go,a7 as Ps,a8 as Ds,q as Is,a9 as Ls,x as Ns,aa as xo}from"./CJ5aKHH_.js";import{r as xt,c as pn,b as xr,a as Cn}from"./BRNtaPwh.js";import{_ as br}from"./DlAUqK2U.js";import{S as Nr,i as Fs,c as Hs,P as Os,W as bo,M as yo,d as wo,e as ko,g as mr,f as zo,D as Vo,h as Wo,j as Us,u as Qn,b as Hn,k as wn,l as js,m as Dn,n as or,a as Co,_ as zs}from"./DZfSmUhR.js";function Vs(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 Ws(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 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:"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 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:"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 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:"M10.5 19.5 3 12m0 0 7.5-7.5M3 12h18"})])}function Go(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 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:"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 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:"M9 15 3 9m0 0 6-6M3 9h12a6 6 0 0 1 0 12h-3"})])}function Ko(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 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.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 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:"M7.5 21 3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5"})])}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.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 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:"m3.75 13.5 10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75Z"})])}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:"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 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:"M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 0 1 3 19.875v-6.75ZM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V8.625ZM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V4.125Z"})])}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 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 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:"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 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:"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 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:"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 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:"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 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:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})])}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:"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 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:"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 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:"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 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:"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 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:"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 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:"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 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:"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 On(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 kn(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 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:"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 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:"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 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.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 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:"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 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:"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 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:"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 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:"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 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:"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 An(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 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:"M5 12h14"})])}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:"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 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:"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 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:"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 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:"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 $o(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 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:"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 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.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 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:"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 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:"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 ga={class:"flex items-center gap-1.5 px-2 py-1.5 bg-retro-panel border-b border-retro-border"},xa={class:"relative flex-1 min-w-0"},ba={key:0,class:"text-[11px] text-retro-muted flex-shrink-0 min-w-[60px] text-center"},ya=["disabled"],wa=["disabled"],ka=_e({__name:"GitFindWidget",props:{resultCount:{},currentIndex:{}},emits:["search","next","prev","close"],setup(e,{expose:n,emit:t}){const a=t,s=$(""),l=$(null);let c=null;function m(){c&&clearTimeout(c),c=setTimeout(()=>{a("search",s.value)},200)}function p(S){S.key==="Escape"?(S.preventDefault(),a("close")):S.key==="Enter"&&(S.preventDefault(),S.shiftKey?a("prev"):a("next"))}function d(){l.value?.focus(),l.value?.select()}return n({focus:d}),(S,T)=>(i(),u("div",ga,[K(o(An),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("div",xa,[Re(r("input",{ref_key:"inputRef",ref:l,"onUpdate:modelValue":T[0]||(T[0]=b=>Oe(s)?s.value=b: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:m,onKeydown:p},null,544),[[vt,o(s)]])]),o(s)?(i(),u("span",ba,[e.resultCount>0?(i(),u(he,{key:0},[$e(_(e.currentIndex+1)+" of "+_(e.resultCount),1)],64)):(i(),u(he,{key:1},[$e(" No results ")],64))])):L("",!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:T[1]||(T[1]=b=>a("prev"))},[K(o(ea),{class:"w-4 h-4"})],8,ya),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:T[2]||(T[2]=b=>a("next"))},[K(o(Js),{class:"w-4 h-4"})],8,wa),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text transition-colors","aria-label":"Close find widget",title:"Close (Escape)",onClick:T[3]||(T[3]=b=>a("close"))},[K(o(xt),{class:"w-4 h-4"})])]))}}),Ca={class:"flex flex-col bg-retro-dark border border-retro-border rounded shadow-lg max-w-md w-full"},$a={class:"flex items-center justify-between px-3 py-2 border-b border-retro-border"},Sa={class:"flex-1 overflow-auto max-h-[300px]"},_a={class:"font-semibold text-retro-cyan flex-shrink-0 min-w-[60px]"},Ma=["onKeyup"],Ta=["onClick"],Aa={class:"text-retro-muted truncate flex-1 font-mono"},Ba=["onClick"],Ea=["onClick"],Ra={key:0,class:"px-3 py-4 text-center text-retro-muted text-xs"},Pa={key:0,class:"px-3 py-2 border-t border-retro-border space-y-2"},Da={class:"flex gap-2 justify-end"},Ia=["disabled"],La={key:1,class:"px-3 py-2 border-t border-retro-border"},Na=_e({__name:"GitRemoteManager",props:{remotes:{},loading:{type:Boolean}},emits:["add","edit","delete","close"],setup(e,{emit:n}){const t=n,a=$(!1),s=$(""),l=$(""),c=$(null),m=$("");function p(){a.value=!0,s.value="",l.value=""}function d(){!s.value.trim()||!l.value.trim()||(t("add",{name:s.value.trim(),url:l.value.trim()}),a.value=!1)}function S(y){c.value=y.name,m.value=y.fetchUrl}function T(y){m.value.trim()&&(t("edit",{name:y,newUrl:m.value.trim()}),c.value=null)}function b(){c.value=null}return(y,x)=>(i(),u("div",Ca,[r("div",$a,[x[5]||(x[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:x[0]||(x[0]=A=>t("close"))},[K(o(xt),{class:"w-4 h-4"})])]),r("div",Sa,[(i(!0),u(he,null,Ee(e.remotes,A=>(i(),u("div",{key:A.name,class:"flex items-center gap-2 px-3 py-2 border-b border-retro-border/50 text-xs"},[r("span",_a,_(A.name),1),o(c)===A.name?(i(),u(he,{key:0},[Re(r("input",{"onUpdate:modelValue":x[1]||(x[1]=j=>Oe(m)?m.value=j: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:[mn(j=>T(A.name),["enter"]),mn(b,["escape"])]},null,40,Ma),[[vt,o(m)]]),r("button",{class:"p-0.5 text-retro-green hover:text-retro-green/80",onClick:j=>T(A.name)},[K(o(Yr),{class:"w-3.5 h-3.5"})],8,Ta),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",onClick:b},[K(o(xt),{class:"w-3.5 h-3.5"})])],64)):(i(),u(he,{key:1},[r("span",Aa,_(A.fetchUrl),1),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",title:"Edit",onClick:j=>S(A)},[K(o(eo),{class:"w-3.5 h-3.5"})],8,Ba),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-red",title:"Delete",onClick:j=>t("delete",A.name)},[K(o(pn),{class:"w-3.5 h-3.5"})],8,Ea)],64))]))),128)),e.remotes.length===0?(i(),u("div",Ra," No remotes configured ")):L("",!0)]),o(a)?(i(),u("div",Pa,[Re(r("input",{"onUpdate:modelValue":x[2]||(x[2]=A=>Oe(s)?s.value=A: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),[[vt,o(s)]]),Re(r("input",{"onUpdate:modelValue":x[3]||(x[3]=A=>Oe(l)?l.value=A: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:mn(d,["enter"])},null,544),[[vt,o(l)]]),r("div",Da,[r("button",{class:"px-2 py-1 text-xs text-retro-muted hover:text-retro-text transition-colors",onClick:x[4]||(x[4]=A=>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:d}," Add Remote ",8,Ia)])])):L("",!0),o(a)?L("",!0):(i(),u("div",La,[r("button",{class:"flex items-center gap-1 text-xs text-retro-cyan hover:text-retro-cyan/80 transition-colors",onClick:p},[K(o(xr),{class:"w-3.5 h-3.5"}),x[6]||(x[6]=$e(" Add Remote ",-1))])]))]))}}),kr={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"}},Fa=["width","height"],Ha=["d","stroke","stroke-dasharray"],Oa={key:0},Ua=["cx","r"],ja=["cx","r","fill"],za=["cx","r","stroke"],Va=["cx","r","fill"],Wa=["cx","r","stroke"],Ga=["cx","r","fill"],qa=["cx","r"],Za=["cx","r","fill"],is=_e({__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}=kr,c=N(()=>l*2+(n.maxLane+1)*t),m=a,p=a/2;function d(b){return l+b*t}function S(b){const y=d(b.fromLane),x=d(b.toLane);if(b.type==="vertical")return`M ${y} 0 L ${x} ${m}`;if(b.type==="vertical-top")return`M ${y} 0 L ${y} ${p}`;if(b.type==="vertical-bottom")return`M ${y} ${p} L ${y} ${m}`;if(b.style==="rounded")return`M ${y} ${p} C ${y} ${m}, ${x} ${m}, ${x} ${m}`;{const A=m*.75;return`M ${y} ${p} L ${y} ${A} L ${x} ${m}`}}const T=N(()=>n.rowData?d(n.rowData.lane):l);return(b,y)=>(i(),u("svg",{width:o(c),height:o(m),class:"block flex-shrink-0","aria-hidden":"true"},[e.rowData?(i(),u(he,{key:0},[(i(!0),u(he,null,Ee(e.rowData.connections,(x,A)=>(i(),u("path",{key:A,d:S(x),stroke:x.color,"stroke-width":"2",fill:"none","stroke-dasharray":x.type.startsWith("merge")?"4 3":"none"},null,8,Ha))),128)),r("g",null,[e.tooltipText?(i(),u("title",Oa,_(e.tooltipText),1)):L("",!0),e.rowData.nodeType==="head"?(i(),u(he,{key:1},[r("circle",{cx:o(T),cy:p,r:o(s)+2,fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-cyan"},null,8,Ua),r("circle",{cx:o(T),cy:p,r:o(s),fill:e.rowData.color},null,8,ja)],64)):e.rowData.nodeType==="merge"?(i(),u(he,{key:2},[r("circle",{cx:o(T),cy:p,r:o(s)+1,fill:"none",stroke:e.rowData.color,"stroke-width":"1.5"},null,8,za),r("circle",{cx:o(T),cy:p,r:o(s)-1,fill:e.rowData.color},null,8,Va)],64)):e.rowData.nodeType==="stash"?(i(),u(he,{key:3},[r("circle",{cx:o(T),cy:p,r:o(s),fill:"none",stroke:e.rowData.color,"stroke-width":"2"},null,8,Wa),r("circle",{cx:o(T),cy:p,r:o(s)-2,fill:e.rowData.color},null,8,Ga)],64)):e.rowData.nodeType==="uncommitted"?(i(),u("circle",{key:4,cx:o(T),cy:p,r:o(s),fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-yellow","stroke-dasharray":"3 2"},null,8,qa)):(i(),u("circle",{key:5,cx:o(T),cy:p,r:o(s),fill:e.rowData.color},null,8,Za))])],64)):L("",!0)],8,Fa))}}),Ka=["aria-selected","aria-label"],Ya={key:1,class:"flex gap-1 flex-shrink-0"},Xa=["title","onContextmenu"],Qa={key:2,class:"flex gap-1 flex-shrink-0"},Ja=["onContextmenu"],ei={class:"text-retro-text text-xs truncate flex-1"},ti={key:5,class:"flex-shrink-0 text-retro-muted text-[10px] hidden sm:inline"},ni={key:6,class:"flex-shrink-0 text-retro-muted text-[10px]"},ri=_e({__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=N(()=>{const b=t.commit.branches;if(b.length===0)return[];const y=t.localBranchNames,x=[],A=[];for(const U of b)y.has(U)?x.push(U):A.push(U);const j=new Set(x),B=new Map,q=[];for(const U of A){const re=U.indexOf("/");if(re>0){const ae=U.substring(re+1),ue=U.substring(0,re);j.has(ae)?(B.has(ae)||B.set(ae,[]),B.get(ae).push(ue)):q.push(U)}else q.push(U)}const te=[];for(const U of x){const re=B.get(U)||[];re.length>0?te.push({displayName:`${U}/${re.join(",")}`,originalBranches:[U,...re.map(ae=>`${ae}/${U}`)],isLocal:!0}):te.push({displayName:U,originalBranches:[U],isLocal:!0})}for(const U of q)te.push({displayName:U,originalBranches:[U],isLocal:!1});return te});function l(b,y){b.preventDefault(),b.stopPropagation();const x=y.originalBranches[0];a("branchContextMenu",{branch:x,x:b.clientX,y:b.clientY,isCurrentBranch:y.isLocal&&y.originalBranches.includes(t.currentBranchName??""),isLocal:y.isLocal})}function c(b,y){b.preventDefault(),b.stopPropagation(),a("tagContextMenu",{tag:y,x:b.clientX,y:b.clientY})}function m(b){b.preventDefault(),b.stopPropagation(),a("commitContextMenu",{x:b.clientX,y:b.clientY})}const{ROW_HEIGHT:p}=kr,d=N(()=>{const b=[t.commit.shortHash];return t.commit.branches.length>0&&b.push(t.commit.branches.join(", ")),t.commit.tags.length>0&&b.push(t.commit.tags.map(y=>`tag: ${y}`).join(", ")),b.join(" — ")});function S(b){const x=Date.now()/1e3-b;return x<60?"just now":x<3600?`${Math.floor(x/60)}m ago`:x<86400?`${Math.floor(x/3600)}h ago`:x<604800?`${Math.floor(x/86400)}d ago`:x<2592e3?`${Math.floor(x/604800)}w ago`:new Date(b*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function T(b){const y=b.split(`
3
- `)[0];return y.length>72?y.substring(0,69)+"...":y}return(b,y)=>{const x=is;return i(),u("div",{class:ye(["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:St({height:`${o(p)}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:y[0]||(y[0]=A=>a("click",A)),onKeydown:y[1]||(y[1]=A=>a("keydown",A)),onContextmenu:m},[K(x,{rowData:e.graphRowData,maxLane:e.maxLane,tooltipText:o(d)},null,8,["rowData","maxLane","tooltipText"]),r("div",{class:ye(["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:St({height:`${o(p)-4}px`})},[!e.columnVisibility||e.columnVisibility.commit!==!1?(i(),u("span",{key:0,class:ye(["flex-shrink-0 font-mono text-[11px]",e.commit.isHead?"text-retro-cyan font-semibold":"text-retro-muted"])},_(e.commit.shortHash),3)):L("",!0),o(s).length>0?(i(),u("div",Ya,[(i(!0),u(he,null,Ee(o(s),A=>(i(),u("span",{key:A.displayName,class:ye(["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&&A.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":A.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:A.originalBranches.join(", "),onContextmenu:j=>l(j,A)},_(A.displayName),43,Xa))),128))])):L("",!0),e.commit.tags.length>0?(i(),u("div",Qa,[(i(!0),u(he,null,Ee(e.commit.tags,A=>(i(),u("span",{key:A,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:j=>c(j,A)},[K(o(ro),{class:"w-2.5 h-2.5"}),$e(" "+_(A),1)],40,Ja))),128))])):L("",!0),r("span",ei,_(T(e.commit.message)),1),e.commit.signatureStatus==="good"?(i(),le(o(as),{key:3,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-green",title:"Verified signature"})):e.commit.signatureStatus==="bad"?(i(),le(o(no),{key:4,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-red",title:"Bad signature"})):L("",!0),!e.columnVisibility||e.columnVisibility.author!==!1?(i(),u("span",ti,_(e.commit.author),1)):L("",!0),!e.columnVisibility||e.columnVisibility.date!==!1?(i(),u("span",ni,_(S(e.commit.timestamp)),1)):L("",!0)],6)],46,Ka)}}});function oi(){const{COLUMN_WIDTH:e,ROW_HEIGHT:n,NODE_RADIUS:t,PADDING:a}=kr;function s(p){let d=0;for(let S=0;S<p.length;S++){const T=p.charCodeAt(S);d=(d<<5)-d+T,d=d&d}return Math.abs(d)}function l(p){const d=s(p)%sr.length;return sr[d]}function c(p,d="rounded"){const S=new Map;if(p.length===0)return S;const T=new Set,b=new Map;for(const te of p)b.set(te.hash,te);const y=p.find(te=>te.isHead)||p[0];if(y){let te=y;for(;te;){T.add(te.hash);const U=te.parents?.[0];te=U?b.get(U):void 0}}const x=new Map,A=new Map,j=new Map,B=new Map,q=new Map;for(let te=0;te<p.length;te++){const U=p[te];q.set(U.hash,te);const re=T.has(U.hash);let ae,ue;if(B.has(U.hash)){const z=B.get(U.hash);ae=z.lane,ue=z.color,B.delete(U.hash)}else if(re)ae=0,ue=sr[0];else{for(ae=1;j.has(ae);)ae++;ue=l(U.hash.substring(0,7))}x.set(U.hash,ae),A.set(U.hash,ue),j.set(ae,U.hash);const fe=U.isMerge||U.parents&&U.parents.length>1;let ee="regular";U.isHead?ee="head":fe&&(ee="merge"),S.set(U.hash,{commitHash:U.hash,lane:ae,color:ue,nodeType:ee,isMainline:T.has(U.hash),connections:[]});const Z=U.parents||[];for(let z=0;z<Z.length;z++){const O=Z[z];if(x.has(O)||B.has(O))continue;const W=T.has(O);let v,h;if(z===0)v=ae,h=ue;else if(W)v=0,h=sr[0];else{for(v=1;j.has(v)||v===ae;)v++;h=l(O.substring(0,7))}B.set(O,{lane:v,color:h,childHash:U.hash})}const H=Z[0];if(!H)j.delete(ae);else{const z=x.get(H),O=B.get(H),W=z??O?.lane;W!==void 0&&W!==ae&&j.delete(ae)}}for(let te=0;te<p.length;te++){const U=p[te],re=S.get(U.hash);if(!re)continue;const ae=U.parents||[];for(let ue=0;ue<ae.length;ue++){const fe=ae[ue],ee=x.get(fe),Z=q.get(fe);if(ee===void 0)continue;const H=re.lane,z=ee,O=ue===0?re.color:A.get(fe)||l(fe.substring(0,7));if(H===z?re.connections.push({type:"vertical-bottom",fromLane:H,toLane:z,color:O,style:d}):ue>0?re.connections.push({type:H<z?"merge-out":"merge-in",fromLane:H,toLane:z,color:O,style:d}):re.connections.push({type:H<z?"branch-out":"branch-in",fromLane:H,toLane:z,color:O,style:d}),Z!==void 0&&Z>te+1)for(let W=te+1;W<Z;W++){const v=p[W],h=S.get(v.hash);h&&h.connections.push({type:"vertical",fromLane:z,toLane:z,color:O,style:d})}if(Z!==void 0){const W=S.get(fe);W&&W.connections.push({type:"vertical-top",fromLane:z,toLane:z,color:O,style:d})}}}return S}function m(p){let d=0;for(const S of p.values()){S.lane>d&&(d=S.lane);for(const T of S.connections)T.fromLane>d&&(d=T.fromLane),T.toLane>d&&(d=T.toLane)}return d}return{computeGraphRows:c,computeMaxLane:m,getBranchColor:l,COLUMN_WIDTH:e,ROW_HEIGHT:n,NODE_RADIUS:t,PADDING:a}}const si=["aria-selected"],ai={class:"text-retro-yellow text-xs font-medium"},ii={key:1,class:"flex items-center justify-center gap-2 p-2 text-retro-muted text-sm"},li={key:2,class:"p-2 text-center text-retro-muted/50 text-xs"},ci=_e({__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(w){(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),s("selectUncommittedChanges"))}const m=N(()=>a.searchQuery?.toLowerCase()??""),p=N(()=>new Set(a.highlightBranches??[])),d=N(()=>p.value.size>0),S=N(()=>{const w=m.value;if(!w)return new Set;const C=new Set;for(const V of a.commits)(V.message.toLowerCase().includes(w)||V.author.toLowerCase().includes(w)||V.shortHash.toLowerCase().includes(w)||V.hash.toLowerCase().includes(w)||V.branches.some(Q=>Q.toLowerCase().includes(w))||V.tags.some(Q=>Q.toLowerCase().includes(w)))&&C.add(V.hash);return C}),T=N(()=>{if(!d.value)return new Set;const w=new Set;for(const C of a.commits)C.branches.some(V=>p.value.has(V))&&w.add(C.hash);return w}),b=N(()=>{if(!a.featureHighlightBranches||a.featureHighlightBranches.length===0)return new Set;const w=a.featureMergeBases??{},C=new Map;for(const Q of a.commits)C.set(Q.hash,Q);const V=new Set;for(const Q of a.featureHighlightBranches){const ce=a.commits.find(De=>De.branches.includes(Q));if(!ce)continue;const Te=w[Q]??null;if(!Te)continue;let Ae=ce;for(;Ae&&Ae.hash!==Te;)V.add(Ae.hash),Ae=Ae.parents?.[0]?C.get(Ae.parents[0]):void 0}return V}),y=N(()=>{if(!a.previewHighlightBranches||a.previewHighlightBranches.length===0)return new Set;const w=a.previewMergeBases??{},C=new Map;for(const Q of a.commits)C.set(Q.hash,Q);const V=new Set;for(const Q of a.previewHighlightBranches){const ce=a.commits.find(De=>De.branches.includes(Q));if(!ce)continue;const Te=w[Q]??null;if(!Te)continue;let Ae=ce;for(;Ae&&Ae.hash!==Te;)V.add(Ae.hash),Ae=Ae.parents?.[0]?C.get(Ae.parents[0]):void 0}return V});function x(w,C){s("branchContextMenu",{...C,commitHash:w.hash})}function A(w,C){s("commitContextMenu",{commit:w,...C})}function j(w,C){s("tagContextMenu",{...C,commitHash:w.hash})}const{ROW_HEIGHT:B,VISIBLE_BUFFER:q}=kr,{computeGraphRows:te,computeMaxLane:U}=oi(),re=N(()=>te([...a.commits],a.graphStyle)),ae=N(()=>U(re.value)),ue=N(()=>{const w=a.stashes||[];if(w.length===0)return a.commits.map((ce,Te)=>({type:"commit",commit:ce,commitIndex:Te}));const C=[],V=[...w].sort((ce,Te)=>new Date(Te.date).getTime()-new Date(ce.date).getTime());let Q=0;for(let ce=0;ce<a.commits.length;ce++){const Te=a.commits[ce],Ae=Te.timestamp*1e3;for(;Q<V.length&&new Date(V[Q].date).getTime()>=Ae;)C.push({type:"stash",stash:V[Q]}),Q++;C.push({type:"commit",commit:Te,commitIndex:ce})}for(;Q<V.length;)C.push({type:"stash",stash:V[Q]}),Q++;return C}),fe=$(null),ee=$(0),Z=$(400);let H=null;const z=N(()=>{const w=q,C=ue.value.length,V=Math.max(0,Math.floor(ee.value/B)-w),Q=Math.min(C,Math.ceil((ee.value+Z.value)/B)+w);return{startIndex:V,endIndex:Q}}),O=N(()=>{const{startIndex:w,endIndex:C}=z.value;return ue.value.slice(w,C).map((V,Q)=>({row:V,index:w+Q,graphRow:V.type==="commit"&&re.value.get(V.commit.hash)||null,isHighlighted:V.type==="commit"?S.value.has(V.commit.hash):!1,isBranchHighlighted:V.type==="commit"?T.value.has(V.commit.hash):!1,isFeatureHighlighted:V.type==="commit"?b.value.has(V.commit.hash):!1,isPreviewHighlighted:V.type==="commit"?y.value.has(V.commit.hash):!1,isMuted:V.type==="commit"&&a.muteNonAncestral?!(re.value.get(V.commit.hash)?.isMainline??!1):!1}))}),W=N(()=>ue.value.length*B),v=N(()=>z.value.startIndex*B);function h(w){const C=w.target;ee.value=C.scrollTop,H||s("scrollStart"),H&&clearTimeout(H),H=setTimeout(()=>{H=null,s("scrollEnd")},150),a.hasMore&&!a.loading&&!a.loadingMore&&C.scrollTop+C.clientHeight>=C.scrollHeight-200&&s("loadMore")}function M(w,C){C.ctrlKey||C.metaKey?s("compareSelect",w):s("select",w)}function G(w,C,V){if(w.key==="Enter"||w.key===" ")w.preventDefault(),s("select",C);else if(w.key==="ArrowDown"){w.preventDefault();for(let Q=V+1;Q<ue.value.length;Q++){const ce=ue.value[Q];if(ce.type==="commit"){s("select",ce.commit),oe(Q);break}}}else if(w.key==="ArrowUp"){w.preventDefault();for(let Q=V-1;Q>=0;Q--){const ce=ue.value[Q];if(ce.type==="commit"){s("select",ce.commit),oe(Q);break}}}}function oe(w){if(!fe.value)return;const C=w*B,V=fe.value.scrollTop,Q=V+fe.value.clientHeight;C<V?fe.value.scrollTop=C:C+B>Q&&(fe.value.scrollTop=C+B-fe.value.clientHeight)}ct(()=>{if(fe.value){Z.value=fe.value.clientHeight;const w=new ResizeObserver(C=>{for(const V of C)Z.value=V.contentRect.height});w.observe(fe.value),gt(()=>w.disconnect())}});function ne(){return fe.value?.scrollTop??0}function I(w){fe.value&&(fe.value.scrollTop=w)}return n({getScrollPosition:ne,setScrollPosition:I,scrollToIndex:oe}),(w,C)=>{const V=is,Q=ri;return i(),u("div",{ref_key:"containerRef",ref:fe,class:"h-full overflow-auto",role:"list","aria-label":"Commit history",onScroll:h},[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:St({height:`${o(B)}px`}),role:"button",tabindex:"0","aria-selected":e.isUncommittedChangesSelected,onClick:l,onKeydown:c},[K(V,{rowData:{commitHash:"uncommitted",lane:0,color:"#F59E0B",nodeType:"uncommitted",isMainline:!1,connections:[]},maxLane:o(ae)},null,8,["maxLane"]),r("div",{class:ye(["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:St({height:`${o(B)-4}px`})},[K(o(On),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),r("span",ai," Uncommitted Changes ("+_(e.uncommittedChangesCount)+") ",1),C[1]||(C[1]=r("span",{class:"flex-1"},null,-1)),C[2]||(C[2]=r("span",{class:"text-retro-muted text-[10px]"},"Working tree",-1))],6)],44,si)):L("",!0),r("div",{class:"relative",style:St({height:`${o(W)}px`})},[r("div",{class:"absolute left-0 right-0",style:St({transform:`translateY(${o(v)}px)`})},[(i(!0),u(he,null,Ee(o(O),({row:ce,index:Te,graphRow:Ae,isHighlighted:De,isBranchHighlighted:Ge,isFeatureHighlighted:me,isPreviewHighlighted:P,isMuted:X})=>(i(),u(he,{key:ce.type==="commit"?ce.commit.hash:`stash-${ce.stash.index}`},[ce.type==="commit"?jo([ce.commit.hash,ce.commit.message,ce.commit.timestamp,ce.commit.branches.join("|"),ce.commit.tags.join("|"),e.selectedCommit?.hash===ce.commit.hash,De,Ge,me,P,X,a.currentBranchName||"",a.columnVisibility?.date!==!1,a.columnVisibility?.author!==!1,a.columnVisibility?.commit!==!1],()=>(i(),le(Q,{key:0,commit:ce.commit,index:ce.commitIndex,isSelected:e.selectedCommit?.hash===ce.commit.hash,isHighlighted:De,isBranchHighlighted:Ge,isFeatureHighlighted:me,isPreviewHighlighted:P,isMuted:X,currentBranchName:a.currentBranchName,localBranchNames:a.localBranchNames,graphRowData:Ae,maxLane:o(ae),columnVisibility:a.columnVisibility,onClick:Y=>M(ce.commit,Y),onKeydown:Y=>G(Y,ce.commit,Te),onBranchContextMenu:Y=>x(ce.commit,Y),onCommitContextMenu:Y=>A(ce.commit,Y),onTagContextMenu:Y=>j(ce.commit,Y)},null,8,["commit","index","isSelected","isHighlighted","isBranchHighlighted","isFeatureHighlighted","isPreviewHighlighted","isMuted","currentBranchName","localBranchNames","graphRowData","maxLane","columnVisibility","onClick","onKeydown","onBranchContextMenu","onCommitContextMenu","onTagContextMenu"])),C,0):L("",!0)],64))),128))],4)],4),(e.loading||e.loadingMore)&&e.commits.length>0?(i(),u("div",ii,[...C[3]||(C[3]=[r("div",{class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),$e(" Loading more commits... ",-1)])])):L("",!0),!e.hasMore&&e.commits.length>0&&!e.loading?(i(),u("div",li,_(e.commits.length)+" commits loaded ",1)):L("",!0)],544)}}});function ui(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 So(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 di(e,n){return n.size===0?[...e]:e.filter(t=>t.branches.some(a=>n.has(a)))}const fi={class:"flex flex-col h-full border-t border-retro-border bg-retro-dark"},mi={class:"flex items-center justify-between p-2 border-b border-retro-border flex-shrink-0"},hi={class:"flex items-center gap-2 text-xs min-w-0"},pi={class:"font-mono text-retro-cyan"},vi={class:"font-mono text-retro-cyan"},gi={key:0,class:"px-3 py-1.5 text-xs text-retro-muted border-b border-retro-border flex-shrink-0"},xi={class:"text-retro-green"},bi={class:"text-retro-red"},yi={key:1,class:"flex-1 flex items-center justify-center"},wi={key:2,class:"flex-1 overflow-auto"},ki={class:"text-retro-text truncate flex-1"},Ci={class:"text-retro-muted"},$i={key:0,class:"flex-shrink-0 text-[10px] font-mono"},Si={key:0,class:"text-retro-green"},_i={key:1,class:"text-retro-red ml-1"},Mi={key:1,class:"flex-shrink-0 text-[10px] text-retro-muted italic"},Ti={key:3,class:"flex-1 flex items-center justify-center text-retro-muted text-sm"},Ai=_e({__name:"GitComparisonView",props:{fromCommit:{},toCommit:{},files:{},stats:{},loading:{type:Boolean}},emits:["close"],setup(e,{emit:n}){const t=n;function a(s){const l=ui(s);return Fn[l]||Fn.M}return(s,l)=>(i(),u("div",fi,[r("div",mi,[r("div",hi,[l[1]||(l[1]=r("span",{class:"text-retro-muted"},"Comparing",-1)),r("span",pi,_(e.fromCommit.shortHash),1),l[2]||(l[2]=r("span",{class:"text-retro-muted"},"→",-1)),r("span",vi,_(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"))},[K(o(xt),{class:"w-4 h-4"})])]),e.stats?(i(),u("div",gi,[$e(_(e.stats.filesChanged)+" file"+_(e.stats.filesChanged!==1?"s":"")+" changed, ",1),r("span",xi,"+"+_(e.stats.additions),1),r("span",bi," -"+_(e.stats.deletions),1)])):L("",!0),e.loading?(i(),u("div",yi,[...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"}),$e(" Loading comparison... ")],-1)])])):e.files&&e.files.length>0?(i(),u("div",wi,[(i(!0),u(he,null,Ee(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:ye(["flex-shrink-0 w-4 text-center font-semibold text-[10px]",a(c.status).colorClass])},_(c.status.charAt(0)),3),r("span",ki,[c.oldPath&&c.status.startsWith("R")?(i(),u(he,{key:0},[r("span",Ci,_(c.oldPath),1),l[4]||(l[4]=r("span",{class:"text-retro-muted mx-1"},"→",-1))],64)):L("",!0),$e(" "+_(c.path),1)]),c.binary?(i(),u("span",Mi,"binary")):(i(),u("span",$i,[c.additions>0?(i(),u("span",Si,"+"+_(c.additions),1)):L("",!0),c.deletions>0?(i(),u("span",_i,"-"+_(c.deletions),1)):L("",!0)]))]))),128))])):e.files&&e.files.length===0?(i(),u("div",Ti," No differences between these commits ")):L("",!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 Rn=oo();function ls(e){Rn=e}var Xn={exec:()=>null};function Ve(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(_t.caret,"$1"),t=t.replace(s,c),a},getRegex:()=>new RegExp(t,n)};return a}var _t={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")},Bi=/^(?:[ \t]*(?:\n|$))+/,Ei=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ri=/^ {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+|$)/,Pi=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,so=/(?:[*+-]|\d{1,9}[.)])/,cs=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,us=Ve(cs).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(),Di=Ve(cs).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]+)*)/,Ii=/^[^\n]+/,io=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Li=Ve(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",io).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ni=Ve(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,so).getRegex(),Cr="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]*?(?:-->|$))/,Fi=Ve("^ {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",Cr).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ds=Ve(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",Cr).getRegex(),Hi=Ve(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ds).getRegex(),co={blockquote:Hi,code:Ei,def:Li,fences:Ri,heading:Pi,hr:Jn,html:Fi,lheading:us,list:Ni,newline:Bi,paragraph:ds,table:Xn,text:Ii},_o=Ve("^ *([^\\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",Cr).getRegex(),Oi={...co,lheading:Di,table:_o,paragraph:Ve(ao).replace("hr",Jn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",_o).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",Cr).getRegex()},Ui={...co,html:Ve(`^ *(?: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:Xn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ve(ao).replace("hr",Jn).replace("heading",` *#{1,6} *[^
5
- ]`).replace("lheading",us).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},ji=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,zi=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,fs=/^( {2,}|\\)\n(?!\s*$)/,Vi=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,$r=/[\p{P}\p{S}]/u,uo=/[\s\p{P}\p{S}]/u,ms=/[^\s\p{P}\p{S}]/u,Wi=Ve(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,uo).getRegex(),hs=/(?!~)[\p{P}\p{S}]/u,Gi=/(?!~)[\s\p{P}\p{S}]/u,qi=/(?:[^\s\p{P}\p{S}]|~)/u,Zi=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,ps=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Ki=Ve(ps,"u").replace(/punct/g,$r).getRegex(),Yi=Ve(ps,"u").replace(/punct/g,hs).getRegex(),vs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Xi=Ve(vs,"gu").replace(/notPunctSpace/g,ms).replace(/punctSpace/g,uo).replace(/punct/g,$r).getRegex(),Qi=Ve(vs,"gu").replace(/notPunctSpace/g,qi).replace(/punctSpace/g,Gi).replace(/punct/g,hs).getRegex(),Ji=Ve("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ms).replace(/punctSpace/g,uo).replace(/punct/g,$r).getRegex(),el=Ve(/\\(punct)/,"gu").replace(/punct/g,$r).getRegex(),tl=Ve(/^<(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(),nl=Ve(lo).replace("(?:-->|$)","-->").getRegex(),rl=Ve("^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",nl).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),hr=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,ol=Ve(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",hr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),gs=Ve(/^!?\[(label)\]\[(ref)\]/).replace("label",hr).replace("ref",io).getRegex(),xs=Ve(/^!?\[(ref)\](?:\[\])?/).replace("ref",io).getRegex(),sl=Ve("reflink|nolink(?!\\()","g").replace("reflink",gs).replace("nolink",xs).getRegex(),fo={_backpedal:Xn,anyPunctuation:el,autolink:tl,blockSkip:Zi,br:fs,code:zi,del:Xn,emStrongLDelim:Ki,emStrongRDelimAst:Xi,emStrongRDelimUnd:Ji,escape:ji,link:ol,nolink:xs,punctuation:Wi,reflink:gs,reflinkSearch:sl,tag:rl,text:Vi,url:Xn},al={...fo,link:Ve(/^!?\[(label)\]\((.*?)\)/).replace("label",hr).getRegex(),reflink:Ve(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",hr).getRegex()},jr={...fo,emStrongRDelimAst:Qi,emStrongLDelim:Yi,url:Ve(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},il={...jr,br:Ve(fs).replace("{2,}","*").getRegex(),text:Ve(jr.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},ir={normal:co,gfm:Oi,pedantic:Ui},Vn={normal:fo,gfm:jr,breaks:il,pedantic:al},ll={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Mo=e=>ll[e];function rn(e,n){if(n){if(_t.escapeTest.test(e))return e.replace(_t.escapeReplace,Mo)}else if(_t.escapeTestNoEncode.test(e))return e.replace(_t.escapeReplaceNoEncode,Mo);return e}function To(e){try{e=encodeURI(e).replace(_t.percentDecode,"%")}catch{return null}return e}function Ao(e,n){const t=e.replace(_t.findPipe,(l,c,m)=>{let p=!1,d=c;for(;--d>=0&&m[d]==="\\";)p=!p;return p?"|":" |"}),a=t.split(_t.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(_t.slashPipe,"|");return a}function Wn(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 cl(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 Bo(e,n,t,a,s){const l=n.href,c=n.title||null,m=e[1].replace(s.other.outputLinkReplace,"$1");a.state.inLink=!0;const p={type:e[0].charAt(0)==="!"?"image":"link",raw:t,href:l,title:c,text:m,tokens:a.inlineTokens(m)};return a.state.inLink=!1,p}function ul(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[m]=c;return m.length>=s.length?l.slice(s.length):l}).join(`
7
- `)}var pr=class{options;rules;lexer;constructor(e){this.options=e||Rn}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:Wn(t,`
8
- `)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const t=n[0],a=ul(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=Wn(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:Wn(n[0],`
9
- `)}}blockquote(e){const n=this.rules.block.blockquote.exec(e);if(n){let t=Wn(n[0],`
10
- `).split(`
11
- `),a="",s="";const l=[];for(;t.length>0;){let c=!1;const m=[];let p;for(p=0;p<t.length;p++)if(this.rules.other.blockquoteStart.test(t[p]))m.push(t[p]),c=!0;else if(!c)m.push(t[p]);else break;t=t.slice(p);const d=m.join(`
12
- `),S=d.replace(this.rules.other.blockquoteSetextReplace,`
13
- $1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
14
- ${d}`:d,s=s?`${s}
15
- ${S}`:S;const T=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(S,l,!0),this.lexer.state.top=T,t.length===0)break;const b=l.at(-1);if(b?.type==="code")break;if(b?.type==="blockquote"){const y=b,x=y.raw+`
16
- `+t.join(`
17
- `),A=this.blockquote(x);l[l.length-1]=A,a=a.substring(0,a.length-y.raw.length)+A.raw,s=s.substring(0,s.length-y.text.length)+A.text;break}else if(b?.type==="list"){const y=b,x=y.raw+`
18
- `+t.join(`
19
- `),A=this.list(x);l[l.length-1]=A,a=a.substring(0,a.length-b.raw.length)+A.raw,s=s.substring(0,s.length-y.raw.length)+A.raw,t=x.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 p=!1,d="",S="";if(!(n=l.exec(e))||this.rules.block.hr.test(e))break;d=n[0],e=e.substring(d.length);let T=n[2].split(`
21
- `,1)[0].replace(this.rules.other.listReplaceTabs,B=>" ".repeat(3*B.length)),b=e.split(`
22
- `,1)[0],y=!T.trim(),x=0;if(this.options.pedantic?(x=2,S=T.trimStart()):y?x=n[1].length+1:(x=n[2].search(this.rules.other.nonSpaceChar),x=x>4?1:x,S=T.slice(x),x+=n[1].length),y&&this.rules.other.blankLine.test(b)&&(d+=b+`
23
- `,e=e.substring(b.length+1),p=!0),!p){const B=this.rules.other.nextBulletRegex(x),q=this.rules.other.hrRegex(x),te=this.rules.other.fencesBeginRegex(x),U=this.rules.other.headingBeginRegex(x),re=this.rules.other.htmlBeginRegex(x);for(;e;){const ae=e.split(`
24
- `,1)[0];let ue;if(b=ae,this.options.pedantic?(b=b.replace(this.rules.other.listReplaceNesting," "),ue=b):ue=b.replace(this.rules.other.tabCharGlobal," "),te.test(b)||U.test(b)||re.test(b)||B.test(b)||q.test(b))break;if(ue.search(this.rules.other.nonSpaceChar)>=x||!b.trim())S+=`
25
- `+ue.slice(x);else{if(y||T.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||te.test(T)||U.test(T)||q.test(T))break;S+=`
26
- `+b}!y&&!b.trim()&&(y=!0),d+=ae+`
27
- `,e=e.substring(ae.length+1),T=ue.slice(x)}}s.loose||(c?s.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(c=!0));let A=null,j;this.options.gfm&&(A=this.rules.other.listIsTask.exec(S),A&&(j=A[0]!=="[ ] ",S=S.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:d,task:!!A,checked:j,loose:!1,text:S,tokens:[]}),s.raw+=d}const m=s.items.at(-1);if(m)m.raw=m.raw.trimEnd(),m.text=m.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let p=0;p<s.items.length;p++)if(this.lexer.state.top=!1,s.items[p].tokens=this.lexer.blockTokens(s.items[p].text,[]),!s.loose){const d=s.items[p].tokens.filter(T=>T.type==="space"),S=d.length>0&&d.some(T=>this.rules.other.anyLine.test(T.raw));s.loose=S}if(s.loose)for(let p=0;p<s.items.length;p++)s.items[p].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=Ao(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(Ao(c,l.header.length).map((m,p)=>({text:m,tokens:this.lexer.inline(m),header:!1,align:l.align[p]})));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=Wn(t.slice(0,-1),"\\");if((t.length-l.length)%2===0)return}else{const l=cl(n[2],"()");if(l===-2)return;if(l>-1){const m=(n[0].indexOf("!")===0?5:4)+n[1].length+l;n[2]=n[2].substring(0,l),n[0]=n[0].substring(0,m).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)),Bo(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 Bo(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,m,p=l,d=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(m=[...c].length,a[3]||a[4]){p+=m;continue}else if((a[5]||a[6])&&l%3&&!((l+m)%3)){d+=m;continue}if(p-=m,p>0)continue;m=Math.min(m,m+p+d);const T=[...a[0]][0].length,b=e.slice(0,l+a.index+T+m);if(Math.min(l,m)%2){const x=b.slice(1,-1);return{type:"em",raw:b,text:x,tokens:this.lexer.inlineTokens(x)}}const y=b.slice(2,-2);return{type:"strong",raw:b,text:y,tokens:this.lexer.inlineTokens(y)}}}}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}}}},dn=class zr{tokens;options;state;tokenizer;inlineQueue;constructor(n){this.tokens=[],this.tokens.links=Object.create(null),this.options=n||Rn,this.options.tokenizer=this.options.tokenizer||new pr,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:_t,block:ir.normal,inline:Vn.normal};this.options.pedantic?(t.block=ir.pedantic,t.inline=Vn.pedantic):this.options.gfm&&(t.block=ir.gfm,this.options.breaks?t.inline=Vn.breaks:t.inline=Vn.gfm),this.tokenizer.rules=t}static get rules(){return{block:ir,inline:Vn}}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(_t.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(_t.tabCharGlobal," ").replace(_t.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 m=n.slice(1);let p;this.options.extensions.startBlock.forEach(d=>{p=d.call({lexer:this},m),typeof p=="number"&&p>=0&&(c=Math.min(c,p))}),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 m=Object.keys(this.tokens.links);if(m.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)m.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 m;if(this.options.extensions?.inline?.some(d=>(m=d.call({lexer:this},n,t))?(n=n.substring(m.raw.length),t.push(m),!0):!1))continue;if(m=this.tokenizer.escape(n)){n=n.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.tag(n)){n=n.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.link(n)){n=n.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(m.raw.length);const d=t.at(-1);m.type==="text"&&d?.type==="text"?(d.raw+=m.raw,d.text+=m.text):t.push(m);continue}if(m=this.tokenizer.emStrong(n,a,c)){n=n.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.codespan(n)){n=n.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.br(n)){n=n.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.del(n)){n=n.substring(m.raw.length),t.push(m);continue}if(m=this.tokenizer.autolink(n)){n=n.substring(m.raw.length),t.push(m);continue}if(!this.state.inLink&&(m=this.tokenizer.url(n))){n=n.substring(m.raw.length),t.push(m);continue}let p=n;if(this.options.extensions?.startInline){let d=1/0;const S=n.slice(1);let T;this.options.extensions.startInline.forEach(b=>{T=b.call({lexer:this},S),typeof T=="number"&&T>=0&&(d=Math.min(d,T))}),d<1/0&&d>=0&&(p=n.substring(0,d+1))}if(m=this.tokenizer.inlineText(p)){n=n.substring(m.raw.length),m.raw.slice(-1)!=="_"&&(c=m.raw.slice(-1)),l=!0;const d=t.at(-1);d?.type==="text"?(d.raw+=m.raw,d.text+=m.text):t.push(m);continue}if(n){const d="Infinite loop on byte: "+n.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return t}},vr=class{options;parser;constructor(e){this.options=e||Rn}space(e){return""}code({text:e,lang:n,escaped:t}){const a=(n||"").match(_t.notSpaceStart)?.[0],s=e.replace(_t.endingNewline,"")+`
40
- `;return a?'<pre><code class="language-'+rn(a)+'">'+(t?s:rn(s,!0))+`</code></pre>
41
- `:"<pre><code>"+(t?s:rn(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 m=e.items[c];a+=this.listitem(m)}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+" "+rn(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>${rn(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=To(e);if(s===null)return a;e=s;let l='<a href="'+e+'"';return n&&(l+=' title="'+rn(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=To(e);if(s===null)return rn(t);e=s;let l=`<img src="${e}" alt="${t}"`;return n&&(l+=` title="${rn(n)}"`),l+=">",l}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:rn(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""}},fn=class Vr{options;renderer;textRenderer;constructor(n){this.options=n||Rn,this.options.renderer=this.options.renderer||new vr,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 m=l,p=this.options.extensions.renderers[m.type].call({parser:this},m);if(p!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(m.type)){a+=p||"";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 m=c,p=this.renderer.text(m);for(;s+1<n.length&&n[s+1].type==="text";)m=n[++s],p+=`
58
- `+this.renderer.text(m);t?a+=this.renderer.paragraph({type:"paragraph",raw:p,text:p,tokens:[{type:"text",raw:p,text:p,escaped:!0}]}):a+=p;continue}default:{const m='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}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 m=this.options.extensions.renderers[l.type].call({parser:this},l);if(m!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){a+=m||"";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 m='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(m),"";throw new Error(m)}}}return a}},dr=class{options;block;constructor(e){this.options=e||Rn}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?dn.lex:dn.lexInline}provideParser(){return this.block?fn.parse:fn.parseInline}},dl=class{defaults=oo();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=fn;Renderer=vr;TextRenderer=mo;Lexer=dn;Tokenizer=pr;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 m=s.renderer.apply(this,c);return m===!1&&(m=l.apply(this,c)),m}: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 vr(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,m=t.renderer[c],p=s[c];s[c]=(...d)=>{let S=m.apply(s,d);return S===!1&&(S=p.apply(s,d)),S||""}}a.renderer=s}if(t.tokenizer){const s=this.defaults.tokenizer||new pr(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,m=t.tokenizer[c],p=s[c];s[c]=(...d)=>{let S=m.apply(s,d);return S===!1&&(S=p.apply(s,d)),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,m=t.hooks[c],p=s[c];dr.passThroughHooks.has(l)?s[c]=d=>{if(this.defaults.async)return Promise.resolve(m.call(s,d)).then(T=>p.call(s,T));const S=m.call(s,d);return p.call(s,S)}:s[c]=(...d)=>{let S=m.apply(s,d);return S===!1&&(S=p.apply(s,d)),S}}a.hooks=s}if(t.walkTokens){const s=this.defaults.walkTokens,l=t.walkTokens;a.walkTokens=function(c){let m=[];return m.push(l.call(this,c)),s&&(m=m.concat(s.call(this,c))),m}}this.defaults={...this.defaults,...a}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return dn.lex(e,n??this.defaults)}parser(e,n){return fn.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 m=l.hooks?l.hooks.provideLexer():e?dn.lex:dn.lexInline,p=l.hooks?l.hooks.provideParser():e?fn.parse:fn.parseInline;if(l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(t):t).then(d=>m(d,l)).then(d=>l.hooks?l.hooks.processAllTokens(d):d).then(d=>l.walkTokens?Promise.all(this.walkTokens(d,l.walkTokens)).then(()=>d):d).then(d=>p(d,l)).then(d=>l.hooks?l.hooks.postprocess(d):d).catch(c);try{l.hooks&&(t=l.hooks.preprocess(t));let d=m(t,l);l.hooks&&(d=l.hooks.processAllTokens(d)),l.walkTokens&&this.walkTokens(d,l.walkTokens);let S=p(d,l);return l.hooks&&(S=l.hooks.postprocess(S)),S}catch(d){return c(d)}}}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>"+rn(t.message+"",!0)+"</pre>";return n?Promise.resolve(a):a}if(n)return Promise.reject(t);throw t}}},Bn=new dl;function ze(e,n){return Bn.parse(e,n)}ze.options=ze.setOptions=function(e){return Bn.setOptions(e),ze.defaults=Bn.defaults,ls(ze.defaults),ze};ze.getDefaults=oo;ze.defaults=Rn;ze.use=function(...e){return Bn.use(...e),ze.defaults=Bn.defaults,ls(ze.defaults),ze};ze.walkTokens=function(e,n){return Bn.walkTokens(e,n)};ze.parseInline=Bn.parseInline;ze.Parser=fn;ze.parser=fn.parse;ze.Renderer=vr;ze.TextRenderer=mo;ze.Lexer=dn;ze.lexer=dn.lex;ze.Tokenizer=pr;ze.Hooks=dr;ze.parse=ze;ze.options;ze.setOptions;ze.use;ze.walkTokens;ze.parseInline;fn.parse;dn.lex;const{entries:bs,setPrototypeOf:Eo,isFrozen:fl,getPrototypeOf:ml,getOwnPropertyDescriptor:hl}=Object;let{freeze:Mt,seal:Ut,create:Wr}=Object,{apply:Gr,construct:qr}=typeof Reflect<"u"&&Reflect;Mt||(Mt=function(n){return n});Ut||(Ut=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=Tt(Array.prototype.forEach),pl=Tt(Array.prototype.lastIndexOf),Ro=Tt(Array.prototype.pop),Gn=Tt(Array.prototype.push),vl=Tt(Array.prototype.splice),fr=Tt(String.prototype.toLowerCase),Tr=Tt(String.prototype.toString),Ar=Tt(String.prototype.match),qn=Tt(String.prototype.replace),gl=Tt(String.prototype.indexOf),xl=Tt(String.prototype.trim),Gt=Tt(Object.prototype.hasOwnProperty),$t=Tt(RegExp.prototype.test),Zn=bl(TypeError);function Tt(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 bl(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 Ne(e,n){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:fr;Eo&&Eo(e,null);let a=n.length;for(;a--;){let s=n[a];if(typeof s=="string"){const l=t(s);l!==s&&(fl(n)||(n[a]=l),s=l)}e[s]=!0}return e}function yl(e){for(let n=0;n<e.length;n++)Gt(e,n)||(e[n]=null);return e}function on(e){const n=Wr(null);for(const[t,a]of bs(e))Gt(e,t)&&(Array.isArray(a)?n[t]=yl(a):a&&typeof a=="object"&&a.constructor===Object?n[t]=on(a):n[t]=a);return n}function Kn(e,n){for(;e!==null;){const a=hl(e,n);if(a){if(a.get)return Tt(a.get);if(typeof a.value=="function")return Tt(a.value)}e=ml(e)}function t(){return null}return t}const Po=Mt(["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"]),Br=Mt(["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"]),Er=Mt(["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"]),wl=Mt(["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"]),Rr=Mt(["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"]),kl=Mt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Do=Mt(["#text"]),Io=Mt(["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"]),Pr=Mt(["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"]),Lo=Mt(["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=Mt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Cl=Ut(/\{\{[\w\W]*|[\w\W]*\}\}/gm),$l=Ut(/<%[\w\W]*|[\w\W]*%>/gm),Sl=Ut(/\$\{[\w\W]*/gm),_l=Ut(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ml=Ut(/^aria-[\-\w]+$/),ys=Ut(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Tl=Ut(/^(?:\w+script|data):/i),Al=Ut(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ws=Ut(/^html$/i),Bl=Ut(/^[a-z][.\w]*(-[.\w]+)+$/i);var No=Object.freeze({__proto__:null,ARIA_ATTR:Ml,ATTR_WHITESPACE:Al,CUSTOM_ELEMENT:Bl,DATA_ATTR:_l,DOCTYPE_NAME:ws,ERB_EXPR:$l,IS_ALLOWED_URI:ys,IS_SCRIPT_OR_DATA:Tl,MUSTACHE_EXPR:Cl,TMPLIT_EXPR:Sl});const Yn={element:1,text:3,progressingInstruction:7,comment:8,document:9},El=function(){return typeof window>"u"?null:window},Rl=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}},Fo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ks(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:El();const n=be=>ks(be);if(n.version="3.3.1",n.removed=[],!e||!e.document||e.document.nodeType!==Yn.document||!e.Element)return n.isSupported=!1,n;let{document:t}=e;const a=t,s=a.currentScript,{DocumentFragment:l,HTMLTemplateElement:c,Node:m,Element:p,NodeFilter:d,NamedNodeMap:S=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:T,DOMParser:b,trustedTypes:y}=e,x=p.prototype,A=Kn(x,"cloneNode"),j=Kn(x,"remove"),B=Kn(x,"nextSibling"),q=Kn(x,"childNodes"),te=Kn(x,"parentNode");if(typeof c=="function"){const be=t.createElement("template");be.content&&be.content.ownerDocument&&(t=be.content.ownerDocument)}let U,re="";const{implementation:ae,createNodeIterator:ue,createDocumentFragment:fe,getElementsByTagName:ee}=t,{importNode:Z}=a;let H=Fo();n.isSupported=typeof bs=="function"&&typeof te=="function"&&ae&&ae.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:z,ERB_EXPR:O,TMPLIT_EXPR:W,DATA_ATTR:v,ARIA_ATTR:h,IS_SCRIPT_OR_DATA:M,ATTR_WHITESPACE:G,CUSTOM_ELEMENT:oe}=No;let{IS_ALLOWED_URI:ne}=No,I=null;const w=Ne({},[...Po,...Br,...Er,...Rr,...Do]);let C=null;const V=Ne({},[...Io,...Pr,...Lo,...cr]);let Q=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}})),ce=null,Te=null;const Ae=Object.seal(Wr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let De=!0,Ge=!0,me=!1,P=!0,X=!1,Y=!0,de=!1,xe=!1,ve=!1,Se=!1,Le=!1,Kt=!1,vn=!0,ut=!1;const Dt="user-content-";let kt=!0,Ct=!1,It={},ht=null;const jt=Ne({},["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 Lt=null;const zt=Ne({},["audio","video","img","source","image","track"]);let yt=null;const Vt=Ne({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Yt="http://www.w3.org/1998/Math/MathML",dt="http://www.w3.org/2000/svg",ft="http://www.w3.org/1999/xhtml";let Rt=ft,Bt=!1,sn=null;const $n=Ne({},[Yt,dt,ft],Tr);let Xt=Ne({},["mi","mo","mn","ms","mtext"]),Qt=Ne({},["annotation-xml"]);const Sn=Ne({},["title","style","font","a","script"]);let Wt=null;const at=["application/xhtml+xml","text/html"],_n="text/html";let Ie=null,Nt=null;const et=t.createElement("form"),gn=function(R){return R instanceof RegExp||R instanceof Function},qe=function(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Nt&&Nt===R)){if((!R||typeof R!="object")&&(R={}),R=on(R),Wt=at.indexOf(R.PARSER_MEDIA_TYPE)===-1?_n:R.PARSER_MEDIA_TYPE,Ie=Wt==="application/xhtml+xml"?Tr:fr,I=Gt(R,"ALLOWED_TAGS")?Ne({},R.ALLOWED_TAGS,Ie):w,C=Gt(R,"ALLOWED_ATTR")?Ne({},R.ALLOWED_ATTR,Ie):V,sn=Gt(R,"ALLOWED_NAMESPACES")?Ne({},R.ALLOWED_NAMESPACES,Tr):$n,yt=Gt(R,"ADD_URI_SAFE_ATTR")?Ne(on(Vt),R.ADD_URI_SAFE_ATTR,Ie):Vt,Lt=Gt(R,"ADD_DATA_URI_TAGS")?Ne(on(zt),R.ADD_DATA_URI_TAGS,Ie):zt,ht=Gt(R,"FORBID_CONTENTS")?Ne({},R.FORBID_CONTENTS,Ie):jt,ce=Gt(R,"FORBID_TAGS")?Ne({},R.FORBID_TAGS,Ie):on({}),Te=Gt(R,"FORBID_ATTR")?Ne({},R.FORBID_ATTR,Ie):on({}),It=Gt(R,"USE_PROFILES")?R.USE_PROFILES:!1,De=R.ALLOW_ARIA_ATTR!==!1,Ge=R.ALLOW_DATA_ATTR!==!1,me=R.ALLOW_UNKNOWN_PROTOCOLS||!1,P=R.ALLOW_SELF_CLOSE_IN_ATTR!==!1,X=R.SAFE_FOR_TEMPLATES||!1,Y=R.SAFE_FOR_XML!==!1,de=R.WHOLE_DOCUMENT||!1,Se=R.RETURN_DOM||!1,Le=R.RETURN_DOM_FRAGMENT||!1,Kt=R.RETURN_TRUSTED_TYPE||!1,ve=R.FORCE_BODY||!1,vn=R.SANITIZE_DOM!==!1,ut=R.SANITIZE_NAMED_PROPS||!1,kt=R.KEEP_CONTENT!==!1,Ct=R.IN_PLACE||!1,ne=R.ALLOWED_URI_REGEXP||ys,Rt=R.NAMESPACE||ft,Xt=R.MATHML_TEXT_INTEGRATION_POINTS||Xt,Qt=R.HTML_INTEGRATION_POINTS||Qt,Q=R.CUSTOM_ELEMENT_HANDLING||{},R.CUSTOM_ELEMENT_HANDLING&&gn(R.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Q.tagNameCheck=R.CUSTOM_ELEMENT_HANDLING.tagNameCheck),R.CUSTOM_ELEMENT_HANDLING&&gn(R.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Q.attributeNameCheck=R.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),R.CUSTOM_ELEMENT_HANDLING&&typeof R.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=R.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),X&&(Ge=!1),Le&&(Se=!0),It&&(I=Ne({},Do),C=[],It.html===!0&&(Ne(I,Po),Ne(C,Io)),It.svg===!0&&(Ne(I,Br),Ne(C,Pr),Ne(C,cr)),It.svgFilters===!0&&(Ne(I,Er),Ne(C,Pr),Ne(C,cr)),It.mathMl===!0&&(Ne(I,Rr),Ne(C,Lo),Ne(C,cr))),R.ADD_TAGS&&(typeof R.ADD_TAGS=="function"?Ae.tagCheck=R.ADD_TAGS:(I===w&&(I=on(I)),Ne(I,R.ADD_TAGS,Ie))),R.ADD_ATTR&&(typeof R.ADD_ATTR=="function"?Ae.attributeCheck=R.ADD_ATTR:(C===V&&(C=on(C)),Ne(C,R.ADD_ATTR,Ie))),R.ADD_URI_SAFE_ATTR&&Ne(yt,R.ADD_URI_SAFE_ATTR,Ie),R.FORBID_CONTENTS&&(ht===jt&&(ht=on(ht)),Ne(ht,R.FORBID_CONTENTS,Ie)),R.ADD_FORBID_CONTENTS&&(ht===jt&&(ht=on(ht)),Ne(ht,R.ADD_FORBID_CONTENTS,Ie)),kt&&(I["#text"]=!0),de&&Ne(I,["html","head","body"]),I.table&&(Ne(I,["tbody"]),delete ce.tbody),R.TRUSTED_TYPES_POLICY){if(typeof R.TRUSTED_TYPES_POLICY.createHTML!="function")throw Zn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof R.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Zn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');U=R.TRUSTED_TYPES_POLICY,re=U.createHTML("")}else U===void 0&&(U=Rl(y,s)),U!==null&&typeof re=="string"&&(re=U.createHTML(""));Mt&&Mt(R),Nt=R}},an=Ne({},[...Br,...Er,...wl]),tt=Ne({},[...Rr,...kl]),nt=function(R){let se=te(R);(!se||!se.tagName)&&(se={namespaceURI:Rt,tagName:"template"});const pe=fr(R.tagName),Ue=fr(se.tagName);return sn[R.namespaceURI]?R.namespaceURI===dt?se.namespaceURI===ft?pe==="svg":se.namespaceURI===Yt?pe==="svg"&&(Ue==="annotation-xml"||Xt[Ue]):!!an[pe]:R.namespaceURI===Yt?se.namespaceURI===ft?pe==="math":se.namespaceURI===dt?pe==="math"&&Qt[Ue]:!!tt[pe]:R.namespaceURI===ft?se.namespaceURI===dt&&!Qt[Ue]||se.namespaceURI===Yt&&!Xt[Ue]?!1:!tt[pe]&&(Sn[pe]||!an[pe]):!!(Wt==="application/xhtml+xml"&&sn[R.namespaceURI]):!1},Fe=function(R){Gn(n.removed,{element:R});try{te(R).removeChild(R)}catch{j(R)}},Et=function(R,se){try{Gn(n.removed,{attribute:se.getAttributeNode(R),from:se})}catch{Gn(n.removed,{attribute:null,from:se})}if(se.removeAttribute(R),R==="is")if(Se||Le)try{Fe(se)}catch{}else try{se.setAttribute(R,"")}catch{}},Xe=function(R){let se=null,pe=null;if(ve)R="<remove></remove>"+R;else{const je=Ar(R,/^[\r\n\t ]+/);pe=je&&je[0]}Wt==="application/xhtml+xml"&&Rt===ft&&(R='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+R+"</body></html>");const Ue=U?U.createHTML(R):R;if(Rt===ft)try{se=new b().parseFromString(Ue,Wt)}catch{}if(!se||!se.documentElement){se=ae.createDocument(Rt,"template",null);try{se.documentElement.innerHTML=Bt?re:Ue}catch{}}const He=se.body||se.documentElement;return R&&pe&&He.insertBefore(t.createTextNode(pe),He.childNodes[0]||null),Rt===ft?ee.call(se,de?"html":"body")[0]:de?se.documentElement:He},Jt=function(R){return ue.call(R.ownerDocument||R,R,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},Qe=function(R){return R instanceof T&&(typeof R.nodeName!="string"||typeof R.textContent!="string"||typeof R.removeChild!="function"||!(R.attributes instanceof S)||typeof R.removeAttribute!="function"||typeof R.setAttribute!="function"||typeof R.namespaceURI!="string"||typeof R.insertBefore!="function"||typeof R.hasChildNodes!="function")},ln=function(R){return typeof m=="function"&&R instanceof m};function We(be,R,se){lr(be,pe=>{pe.call(n,R,se,Nt)})}const xn=function(R){let se=null;if(We(H.beforeSanitizeElements,R,null),Qe(R))return Fe(R),!0;const pe=Ie(R.nodeName);if(We(H.uponSanitizeElement,R,{tagName:pe,allowedTags:I}),Y&&R.hasChildNodes()&&!ln(R.firstElementChild)&&$t(/<[/\w!]/g,R.innerHTML)&&$t(/<[/\w!]/g,R.textContent)||R.nodeType===Yn.progressingInstruction||Y&&R.nodeType===Yn.comment&&$t(/<[/\w]/g,R.data))return Fe(R),!0;if(!(Ae.tagCheck instanceof Function&&Ae.tagCheck(pe))&&(!I[pe]||ce[pe])){if(!ce[pe]&&en(pe)&&(Q.tagNameCheck instanceof RegExp&&$t(Q.tagNameCheck,pe)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(pe)))return!1;if(kt&&!ht[pe]){const Ue=te(R)||R.parentNode,He=q(R)||R.childNodes;if(He&&Ue){const je=He.length;for(let it=je-1;it>=0;--it){const Ye=A(He[it],!0);Ye.__removalCount=(R.__removalCount||0)+1,Ue.insertBefore(Ye,B(R))}}}return Fe(R),!0}return R instanceof p&&!nt(R)||(pe==="noscript"||pe==="noembed"||pe==="noframes")&&$t(/<\/no(script|embed|frames)/i,R.innerHTML)?(Fe(R),!0):(X&&R.nodeType===Yn.text&&(se=R.textContent,lr([z,O,W],Ue=>{se=qn(se,Ue," ")}),R.textContent!==se&&(Gn(n.removed,{element:R.cloneNode()}),R.textContent=se)),We(H.afterSanitizeElements,R,null),!1)},rt=function(R,se,pe){if(vn&&(se==="id"||se==="name")&&(pe in t||pe in et))return!1;if(!(Ge&&!Te[se]&&$t(v,se))){if(!(De&&$t(h,se))){if(!(Ae.attributeCheck instanceof Function&&Ae.attributeCheck(se,R))){if(!C[se]||Te[se]){if(!(en(R)&&(Q.tagNameCheck instanceof RegExp&&$t(Q.tagNameCheck,R)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(R))&&(Q.attributeNameCheck instanceof RegExp&&$t(Q.attributeNameCheck,se)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(se,R))||se==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&$t(Q.tagNameCheck,pe)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(pe))))return!1}else if(!yt[se]){if(!$t(ne,qn(pe,G,""))){if(!((se==="src"||se==="xlink:href"||se==="href")&&R!=="script"&&gl(pe,"data:")===0&&Lt[R])){if(!(me&&!$t(M,qn(pe,G,"")))){if(pe)return!1}}}}}}}return!0},en=function(R){return R!=="annotation-xml"&&Ar(R,oe)},ot=function(R){We(H.beforeSanitizeAttributes,R,null);const{attributes:se}=R;if(!se||Qe(R))return;const pe={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:C,forceKeepAttr:void 0};let Ue=se.length;for(;Ue--;){const He=se[Ue],{name:je,namespaceURI:it,value:Ye}=He,Ft=Ie(je),st=Ye;let Je=je==="value"?st:xl(st);if(pe.attrName=Ft,pe.attrValue=Je,pe.keepAttr=!0,pe.forceKeepAttr=void 0,We(H.uponSanitizeAttribute,R,pe),Je=pe.attrValue,ut&&(Ft==="id"||Ft==="name")&&(Et(je,R),Je=Dt+Je),Y&&$t(/((--!?|])>)|<\/(style|title|textarea)/i,Je)){Et(je,R);continue}if(Ft==="attributename"&&Ar(Je,"href")){Et(je,R);continue}if(pe.forceKeepAttr)continue;if(!pe.keepAttr){Et(je,R);continue}if(!P&&$t(/\/>/i,Je)){Et(je,R);continue}X&&lr([z,O,W],Ot=>{Je=qn(Je,Ot," ")});const Ht=Ie(R.nodeName);if(!rt(Ht,Ft,Je)){Et(je,R);continue}if(U&&typeof y=="object"&&typeof y.getAttributeType=="function"&&!it)switch(y.getAttributeType(Ht,Ft)){case"TrustedHTML":{Je=U.createHTML(Je);break}case"TrustedScriptURL":{Je=U.createScriptURL(Je);break}}if(Je!==st)try{it?R.setAttributeNS(it,je,Je):R.setAttribute(je,Je),Qe(R)?Fe(R):Ro(n.removed)}catch{Et(je,R)}}We(H.afterSanitizeAttributes,R,null)},Mn=function be(R){let se=null;const pe=Jt(R);for(We(H.beforeSanitizeShadowDOM,R,null);se=pe.nextNode();)We(H.uponSanitizeShadowNode,se,null),xn(se),ot(se),se.content instanceof l&&be(se.content);We(H.afterSanitizeShadowDOM,R,null)};return n.sanitize=function(be){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},se=null,pe=null,Ue=null,He=null;if(Bt=!be,Bt&&(be="<!-->"),typeof be!="string"&&!ln(be))if(typeof be.toString=="function"){if(be=be.toString(),typeof be!="string")throw Zn("dirty is not a string, aborting")}else throw Zn("toString is not a function");if(!n.isSupported)return be;if(xe||qe(R),n.removed=[],typeof be=="string"&&(Ct=!1),Ct){if(be.nodeName){const Ye=Ie(be.nodeName);if(!I[Ye]||ce[Ye])throw Zn("root node is forbidden and cannot be sanitized in-place")}}else if(be instanceof m)se=Xe("<!---->"),pe=se.ownerDocument.importNode(be,!0),pe.nodeType===Yn.element&&pe.nodeName==="BODY"||pe.nodeName==="HTML"?se=pe:se.appendChild(pe);else{if(!Se&&!X&&!de&&be.indexOf("<")===-1)return U&&Kt?U.createHTML(be):be;if(se=Xe(be),!se)return Se?null:Kt?re:""}se&&ve&&Fe(se.firstChild);const je=Jt(Ct?be:se);for(;Ue=je.nextNode();)xn(Ue),ot(Ue),Ue.content instanceof l&&Mn(Ue.content);if(Ct)return be;if(Se){if(Le)for(He=fe.call(se.ownerDocument);se.firstChild;)He.appendChild(se.firstChild);else He=se;return(C.shadowroot||C.shadowrootmode)&&(He=Z.call(a,He,!0)),He}let it=de?se.outerHTML:se.innerHTML;return de&&I["!doctype"]&&se.ownerDocument&&se.ownerDocument.doctype&&se.ownerDocument.doctype.name&&$t(ws,se.ownerDocument.doctype.name)&&(it="<!DOCTYPE "+se.ownerDocument.doctype.name+`>
60
- `+it),X&&lr([z,O,W],Ye=>{it=qn(it,Ye," ")}),U&&Kt?U.createHTML(it):it},n.setConfig=function(){let be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};qe(be),xe=!0},n.clearConfig=function(){Nt=null,xe=!1},n.isValidAttribute=function(be,R,se){Nt||qe({});const pe=Ie(be),Ue=Ie(R);return rt(pe,Ue,se)},n.addHook=function(be,R){typeof R=="function"&&Gn(H[be],R)},n.removeHook=function(be,R){if(R!==void 0){const se=pl(H[be],R);return se===-1?void 0:vl(H[be],se,1)[0]}return Ro(H[be])},n.removeHooks=function(be){H[be]=[]},n.removeAllHooks=function(){H=Fo()},n}var Cs=ks();const Pl={":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:":"🦺"},Dl=/https?:\/\/[^\s<>)"']+/g;function Il(e){return e.replace(Dl,n=>`<a href="${n}" target="_blank" rel="noopener noreferrer" class="text-retro-blue hover:underline">${n}</a>`)}function Ll(e){return e.replace(/:[a-z0-9_]+:/g,n=>Pl[n]||n)}function Nl(e){if(!e)return"";let n=Ll(e);return n=ze.parse(n),n=Il(n),n=Cs.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 Fl={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},Hl={class:"flex items-center gap-2 min-w-0"},Ol={class:"text-retro-cyan font-mono text-sm"},Ul={class:"text-retro-muted text-sm truncate"},jl={class:"flex items-center gap-1 flex-shrink-0"},zl=["aria-label","title"],Vl={class:"flex-1 overflow-auto p-4 space-y-4"},Wl={class:"space-y-2"},Gl={class:"flex items-center gap-2 text-sm"},ql={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"},Kl={class:"text-retro-text"},Yl={class:"text-retro-muted"},Xl={key:0,class:"flex items-center gap-2 text-sm"},Ql={class:"text-retro-text"},Jl={class:"text-retro-muted"},ec={class:"flex items-center gap-2 text-sm"},tc={class:"text-retro-text"},nc={key:1,class:"flex items-start gap-2 text-sm"},rc={class:"flex flex-wrap gap-1"},oc=["onClick","title"],sc={key:2,class:"flex items-start gap-2 text-sm"},ac={class:"flex flex-wrap gap-1"},ic={key:3,class:"flex items-start gap-2 text-sm"},lc={class:"flex flex-wrap gap-1"},cc={class:"space-y-1"},uc={class:"text-retro-text text-sm font-mono bg-retro-panel p-3 rounded"},dc={key:0,class:"space-y-1"},fc=["innerHTML"],mc={key:1,class:"space-y-2"},hc={class:"flex items-center gap-2 text-sm"},pc={class:"text-retro-muted"},vc={key:0,class:"flex items-center gap-2"},gc={class:"text-retro-green text-xs font-mono"},xc={class:"flex-1 h-2 rounded overflow-hidden bg-retro-panel flex"},bc={class:"text-retro-red text-xs font-mono"},yc={key:2,class:"space-y-2"},wc={class:"flex items-center justify-between"},kc={class:"text-retro-muted text-xs uppercase tracking-wide"},Cc={class:"flex items-center gap-1"},$c={key:0,class:"text-retro-muted text-sm py-2"},Sc={key:1,class:"space-y-0.5"},_c=["onClick"],Mc=["title"],Tc={class:"text-retro-text font-mono text-xs truncate flex-1"},Ac={class:"text-retro-muted"},Bc={class:"text-retro-text"},Ec={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},Rc={key:0,class:"text-retro-green"},Pc={key:1,class:"text-retro-red"},Dc={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},Ic={key:2,class:"space-y-0"},Lc=["onClick"],Nc={class:"text-retro-text font-mono text-xs"},Fc=["title"],Hc={class:"text-retro-text font-mono text-xs truncate flex-1"},Oc={class:"text-retro-muted"},Uc={class:"text-retro-text"},jc={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},zc={key:0,class:"text-retro-green"},Vc={key:1,class:"text-retro-red"},Wc={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},Gc={key:3,class:"flex items-center gap-2 text-retro-muted text-sm py-2"},qc={key:4,class:"text-retro-muted text-sm py-2"},Zc=_e({__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=$(null),l=$("flat"),c=$(new Set),m=N(()=>!t.committer||!t.committerEmail?!1:t.committer!==t.commit.author||t.committerEmail!==t.commit.email),p=N(()=>{const H=t.commit.body;return H?Nl(H):""}),d=N(()=>{if(!t.stats)return"";const{filesChanged:H,additions:z,deletions:O}=t.stats,v=[`${H} ${H===1?"file":"files"} changed`];return z>0&&v.push(`+${z} insertion${z===1?"":"s"}`),O>0&&v.push(`-${O} deletion${O===1?"":"s"}`),v.join(", ")});function S(H){const z=[];for(const O of H){const W=O.path.split("/");let v=z;for(let h=0;h<W.length;h++){const M=W[h],G=h===W.length-1,oe=W.slice(0,h+1).join("/");let ne=v.find(I=>I.name===M&&I.isDirectory===!G);ne||(ne={name:M,fullPath:oe,isDirectory:!G,children:[],file:G?O:void 0},v.push(ne)),G||(v=ne.children)}}return T(z),z}function T(H){for(const z of H)if(z.isDirectory)for(T(z.children);z.children.length===1&&z.children[0].isDirectory;){const O=z.children[0];z.name=`${z.name}/${O.name}`,z.fullPath=O.fullPath,z.children=O.children}}function b(H){return[...H].sort((z,O)=>z.isDirectory&&!O.isDirectory?-1:!z.isDirectory&&O.isDirectory?1:z.name.localeCompare(O.name))}function y(H,z,O){const W=[];for(const v of b(H)){const h=O.size===0?!0:O.has(v.fullPath);W.push({key:v.fullPath,depth:z,isDirectory:v.isDirectory,name:v.name,fullPath:v.fullPath,expanded:v.isDirectory?h:!1,file:v.file}),v.isDirectory&&h&&W.push(...y(v.children,z+1,O))}return W}const x=N(()=>!t.files||t.files.length===0?[]:S(t.files)),A=N(()=>y(x.value,0,c.value));function j(H){c.value.has(H)?c.value.delete(H):c.value.add(H),c.value=new Set(c.value)}function B(){const H=z=>{const O=[];for(const W of z)W.isDirectory&&(O.push(W.fullPath),O.push(...H(W.children)));return O};c.value=new Set(H(x.value))}function q(){c.value=new Set}Be(l,H=>{H==="tree"&&B()});function te(H){return new Date(H*1e3).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0})}function U(H){return Fn[H]||{label:H,colorClass:"text-retro-muted"}}const re=N(()=>{if(!t.stats)return{addPct:0,delPct:0};const H=t.stats.additions+t.stats.deletions;return H===0?{addPct:50,delPct:50}:{addPct:Math.round(t.stats.additions/H*100),delPct:Math.round(t.stats.deletions/H*100)}});function ae(H){H.key==="ArrowUp"?(H.preventDefault(),a("navigatePrev")):H.key==="ArrowDown"?(H.preventDefault(),a("navigateNext")):H.key==="Escape"&&(H.preventDefault(),a("close"))}ct(()=>{qt(()=>{s.value?.focus()})}),Be(()=>t.commit.hash,()=>{qt(()=>{s.value?.focus()})});function ue(){a("close")}function fe(H){a("navigateToCommit",H)}function ee(){a("togglePosition")}function Z(H){a("openFileDiff",H)}return(H,z)=>(i(),u("section",{ref_key:"containerRef",ref:s,tabindex:0,onKeydown:ae,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",Fl,[r("div",Hl,[r("span",Ol,_(e.commit.shortHash),1),r("span",Ul,_(e.commit.message.split(`
61
- `)[0]),1)]),r("div",jl,[r("button",{onClick:ee,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(),le(o(Yo),{key:0,class:"w-4 h-4 text-retro-muted hover:text-retro-text"})):(i(),le(o(Ko),{key:1,class:"w-4 h-4 text-retro-muted hover:text-retro-text"}))],8,zl),r("button",{onClick:ue,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"},[K(o(xt),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])])]),r("div",Vl,[r("div",Wl,[r("div",Gl,[z[2]||(z[2]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Hash:",-1)),r("code",ql,_(e.commit.hash),1)]),r("div",Zl,[K(o(Ur),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",Kl,_(e.commit.author),1),r("span",Yl,"<"+_(e.commit.email)+">",1)]),m.value?(i(),u("div",Xl,[K(o(Ur),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),z[3]||(z[3]=r("span",{class:"text-retro-muted text-xs uppercase mr-1"},"Committer:",-1)),r("span",Ql,_(e.committer),1),r("span",Jl,"<"+_(e.committerEmail)+">",1)])):L("",!0),r("div",ec,[K(o(Jo),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",tc,_(te(e.commit.timestamp)),1)]),e.commit.parents?.length>0?(i(),u("div",nc,[z[4]||(z[4]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Parents:",-1)),r("div",rc,[(i(!0),u(he,null,Ee(e.commit.parents,O=>(i(),u("button",{key:O,onClick:W=>fe(O),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 ${O.substring(0,7)}`},_(O.substring(0,7)),9,oc))),128))])])):L("",!0),e.commit.branches?.length>0?(i(),u("div",sc,[z[5]||(z[5]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Branches:",-1)),r("div",ac,[(i(!0),u(he,null,Ee(e.commit.branches,O=>(i(),u("span",{key:O,class:"text-retro-green font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},_(O),1))),128))])])):L("",!0),e.commit.tags?.length>0?(i(),u("div",ic,[z[6]||(z[6]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Tags:",-1)),r("div",lc,[(i(!0),u(he,null,Ee(e.commit.tags,O=>(i(),u("span",{key:O,class:"text-retro-yellow font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},_(O),1))),128))])])):L("",!0)]),r("div",cc,[z[7]||(z[7]=r("h4",{class:"text-retro-muted text-xs uppercase tracking-wide"}," Message ",-1)),r("div",uc,_(e.commit.message.split(`
62
- `)[0]),1)]),e.commit.body?(i(),u("div",dc,[z[8]||(z[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:p.value},null,8,fc)])):L("",!0),e.stats?(i(),u("div",mc,[r("div",hc,[r("span",pc,_(d.value),1)]),e.stats.additions>0||e.stats.deletions>0?(i(),u("div",vc,[r("span",gc,"+"+_(e.stats.additions),1),r("div",xc,[r("div",{class:"bg-retro-green h-full transition-all",style:St({width:re.value.addPct+"%"})},null,4),r("div",{class:"bg-retro-red h-full transition-all",style:St({width:re.value.delPct+"%"})},null,4)]),r("span",bc,"-"+_(e.stats.deletions),1)])):L("",!0)])):L("",!0),e.files?(i(),u("div",yc,[r("div",wc,[r("h4",kc," Files Changed ("+_(e.files.length)+") ",1),r("div",Cc,[r("button",{onClick:z[0]||(z[0]=O=>l.value="flat"),class:ye(["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"},[K(o(os),{class:"w-4 h-4"})],2),r("button",{onClick:z[1]||(z[1]=O=>l.value="tree"),class:ye(["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"},[K(o(Or),{class:"w-4 h-4"})],2)])]),e.files.length===0?(i(),u("div",$c," No files changed in this commit. ")):l.value==="flat"?(i(),u("ul",Sc,[(i(!0),u(he,null,Ee(e.files,O=>(i(),u("li",{key:O.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group cursor-pointer",onClick:W=>Z(O)},[r("span",{class:ye(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",U(O.status).colorClass]),title:U(O.status).label},_(O.status),11,Mc),K(o(Nn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",Tc,[O.status==="R"&&O.oldPath?(i(),u(he,{key:0},[r("span",Ac,_(O.oldPath),1),z[9]||(z[9]=r("span",{class:"text-retro-yellow mx-1"},"→",-1)),r("span",Bc,_(O.path),1)],64)):(i(),u(he,{key:1},[$e(_(O.path),1)],64))]),!O.binary&&(O.additions>0||O.deletions>0)?(i(),u("span",Ec,[O.additions>0?(i(),u("span",Rc,"+"+_(O.additions),1)):L("",!0),O.deletions>0?(i(),u("span",Pc,"-"+_(O.deletions),1)):L("",!0)])):O.binary?(i(),u("span",Dc,"binary")):L("",!0)],8,_c))),128))])):(i(),u("div",Ic,[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 "),z[10]||(z[10]=r("span",{class:"text-retro-muted text-xs"},"|",-1)),r("button",{onClick:q,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Collapse all ")]),(i(!0),u(he,null,Ee(A.value,O=>(i(),u("div",{key:O.key,class:ye(["flex items-center gap-1 py-0.5 px-1 hover:bg-retro-panel rounded text-sm cursor-pointer",{"select-none":O.isDirectory}]),style:St({paddingLeft:O.depth*16+4+"px"}),onClick:W=>O.isDirectory?j(O.fullPath):O.file?Z(O.file):void 0},[O.isDirectory?(i(),u(he,{key:0},[K(o(Xr),{class:ye(["w-3 h-3 text-retro-muted transition-transform flex-shrink-0",{"rotate-90":O.expanded}])},null,8,["class"]),K(o(Or),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),r("span",Nc,_(O.name),1)],64)):O.file?(i(),u(he,{key:1},[r("span",{class:ye(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",U(O.file.status).colorClass]),title:U(O.file.status).label},_(O.file.status),11,Fc),K(o(Nn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",Hc,[O.file.status==="R"&&O.file.oldPath?(i(),u(he,{key:0},[r("span",Oc,_(O.file.oldPath.split("/").pop()),1),z[11]||(z[11]=r("span",{class:"text-retro-yellow mx-1"},"→",-1)),r("span",Uc,_(O.name),1)],64)):(i(),u(he,{key:1},[$e(_(O.name),1)],64))]),!O.file.binary&&(O.file.additions>0||O.file.deletions>0)?(i(),u("span",jc,[O.file.additions>0?(i(),u("span",zc,"+"+_(O.file.additions),1)):L("",!0),O.file.deletions>0?(i(),u("span",Vc,"-"+_(O.file.deletions),1)):L("",!0)])):O.file.binary?(i(),u("span",Wc,"binary")):L("",!0)],64)):L("",!0)],14,Lc))),128))]))])):e.loading?(i(),u("div",Gc,[...z[12]||(z[12]=[r("div",{class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin"},null,-1),$e(" Loading file changes... ",-1)])])):(i(),u("div",qc," Failed to load file changes. "))])],544))}}),Kc=br(Zc,[["__scopeId","data-v-29f450ea"]]),Yc={class:"flex-1 min-h-0 flex flex-col border-t border-retro-border bg-retro-dark","aria-label":"Uncommitted changes details"},Xc={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},Qc={class:"flex items-center gap-2 min-w-0"},Jc={class:"text-retro-muted text-sm"},eu={key:0,class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin",title:"Staging..."},tu={class:"flex-1 overflow-auto p-4 space-y-3"},nu={class:"space-y-2"},ru=["disabled"],ou={class:"space-y-1"},su={class:"flex items-center justify-between"},au={class:"text-retro-green text-xs uppercase tracking-wide font-semibold"},iu={key:0,class:"text-retro-muted text-xs py-1"},lu={key:1,class:"space-y-0.5"},cu=["aria-label","onClick"],uu={class:"text-retro-text font-mono text-xs truncate"},du={class:"space-y-1"},fu={class:"flex items-center justify-between"},mu={class:"text-retro-yellow text-xs uppercase tracking-wide font-semibold"},hu={key:0,class:"text-retro-muted text-xs py-1"},pu={key:1,class:"space-y-0.5"},vu=["aria-label","onClick"],gu={class:"text-retro-text font-mono text-xs truncate"},xu=_e({__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=$(""),l=$(!1),c=N(()=>s.value.trim().length>0&&t.stagedFiles.length>0&&!l.value&&!t.isCommitting);function m(A){return Fn[A]||{label:A,colorClass:"text-retro-muted"}}function p(){a("close")}function d(A){a("stageFiles",[A.path])}function S(A){a("unstageFiles",[A.path])}function T(){a("stageAll")}function b(){a("unstageAll")}async function y(){c.value&&(l.value=!0,a("commit",s.value.trim()),s.value="",l.value=!1)}function x(A){(A.metaKey||A.ctrlKey)&&A.key==="Enter"&&(A.preventDefault(),y())}return(A,j)=>(i(),u("section",Yc,[r("div",Xc,[r("div",Qc,[K(o(On),{class:"w-4 h-4 text-retro-yellow"}),j[1]||(j[1]=r("span",{class:"text-retro-yellow font-semibold text-sm"},"Uncommitted Changes",-1)),r("span",Jc,"("+_(e.stagedFiles.length+e.unstagedFiles.length)+" files)",1),t.isStaging?(i(),u("div",eu)):L("",!0)]),r("button",{onClick:p,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"},[K(o(xt),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])]),r("div",tu,[r("div",nu,[Re(r("textarea",{"onUpdate:modelValue":j[0]||(j[0]=B=>Oe(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:x},null,544),[[vt,o(s)]]),r("button",{disabled:!o(c),class:ye(["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:y},_(o(l)||t.isCommitting?"Committing...":`Commit (${e.stagedFiles.length} staged)`),11,ru)]),r("div",ou,[r("div",su,[r("h4",au," Staged Changes ("+_(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:b}," Unstage All ")):L("",!0)]),e.stagedFiles.length===0?(i(),u("div",iu," No staged files. Stage files below to commit. ")):(i(),u("ul",lu,[(i(!0),u(he,null,Ee(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:q=>S(B)},[K(o(da),{class:"w-3.5 h-3.5 text-retro-red"})],8,cu),r("span",{class:ye(["flex-shrink-0 w-4 text-center text-xs font-bold",m(B.status).colorClass])},_(B.status),3),K(o(Nn),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),r("span",uu,_(B.oldPath?`${B.oldPath} → ${B.path}`:B.path),1)]))),128))]))]),r("div",du,[r("div",fu,[r("h4",mu," Unstaged Changes ("+_(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:T}," Stage All ")):L("",!0)]),e.unstagedFiles.length===0?(i(),u("div",hu," No unstaged changes. ")):(i(),u("ul",pu,[(i(!0),u(he,null,Ee(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:q=>d(B)},[K(o(xr),{class:"w-3.5 h-3.5 text-retro-green"})],8,vu),r("span",{class:ye(["flex-shrink-0 w-4 text-center text-xs font-bold",m(B.status).colorClass])},_(B.status),3),K(o(Nn),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),r("span",gu,_(B.oldPath?`${B.oldPath} → ${B.path}`:B.path),1)]))),128))]))])])]))}}),bu=["aria-label"],yu={key:0,class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border truncate font-mono"},wu={key:0,class:"my-1 border-t border-retro-border",role:"separator"},ku=["aria-disabled","onClick","onMouseenter"],Cu={key:1,class:"w-4 h-4 flex-shrink-0"},er=_e({__name:"GitContextMenu",props:{items:{},x:{},y:{},title:{}},emits:["close","action"],setup(e,{emit:n}){const t=e,a=n,s=$(null),l=$(-1),c=N(()=>t.items.map((y,x)=>({item:y,i:x})).filter(({item:y})=>!y.disabled).map(({i:y})=>y));let m=!1;function p(y){m&&s.value&&!s.value.contains(y.target)&&a("close")}ct(()=>{requestAnimationFrame(()=>{m=!0}),document.addEventListener("mousedown",p),document.addEventListener("contextmenu",p),qt(()=>{s.value?.focus()})}),gt(()=>{m=!1,document.removeEventListener("mousedown",p),document.removeEventListener("contextmenu",p)});function d(y){const x=c.value;if(x.length===0)return;if(l.value===-1){l.value=y===1?x[0]:x[x.length-1];return}const A=x.indexOf(l.value);if(A===-1){l.value=y===1?x[0]:x[x.length-1];return}const j=A+y;j>=0&&j<x.length&&(l.value=x[j])}function S(y){switch(y.key){case"Escape":y.preventDefault(),a("close");break;case"ArrowDown":y.preventDefault(),d(1);break;case"ArrowUp":y.preventDefault(),d(-1);break;case"Enter":{y.preventDefault();const x=t.items[l.value];x&&!x.disabled&&(a("action",x.key),a("close"));break}}}function T(y){y.disabled||(a("action",y.key),a("close"))}const b=N(()=>{const x=t.title?29:0,A=t.items.filter(re=>re.separator).length,j=t.items.length*36+A*9+8,B=x+j,q=8;let te=t.x,U=t.y;return typeof window<"u"&&(te+220>window.innerWidth-q&&(te=window.innerWidth-220-q),te<q&&(te=q),U+B>window.innerHeight-q&&(U=window.innerHeight-B-q),U<q&&(U=q)),{left:`${te}px`,top:`${U}px`}});return(y,x)=>(i(),le(Zt,{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:St(o(b)),role:"menu","aria-label":e.title??"Context menu",tabindex:"-1",onKeydown:S},[e.title?(i(),u("div",yu,_(e.title),1)):L("",!0),(i(!0),u(he,null,Ee(e.items,(A,j)=>(i(),u(he,{key:A.key},[A.separator?(i(),u("div",wu)):L("",!0),r("button",{class:ye(["w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors focus:outline-none",[A.disabled?"text-retro-muted/50 cursor-not-allowed":A.danger?["text-retro-red hover:bg-retro-red/10 focus:bg-retro-red/10",o(l)===j?"bg-retro-red/10":""]:["text-retro-text hover:bg-retro-cyan/10 focus:bg-retro-cyan/10",o(l)===j?"bg-retro-cyan/10":""]]]),role:"menuitem","aria-disabled":A.disabled||void 0,tabindex:-1,onClick:B=>T(A),onMouseenter:B=>l.value=A.disabled?o(l):j,onMouseleave:x[0]||(x[0]=B=>l.value=-1)},[A.icon?(i(),le(In(A.icon),{key:0,class:ye(["w-4 h-4 flex-shrink-0",A.disabled?"opacity-50":A.danger?"":"text-retro-muted"])},null,8,["class"])):(i(),u("span",Cu)),$e(" "+_(A.label),1)],42,ku)],64))),128))],44,bu)]))}}),$u=_e({__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=N(()=>[{key:"checkout",label:"Checkout",icon:Cn,disabled:t.isCurrentBranch},{key:"rename",label:"Rename",icon:ss,separator:!0},{key:"deleteBranch",label:"Delete",icon:pn,danger:!0,disabled:t.isCurrentBranch},{key:"merge",label:"Merge into Current",icon:Xo,separator:!0,disabled:t.isCurrentBranch},{key:"rebase",label:"Rebase Current Onto",icon:Go,disabled:t.isCurrentBranch},{key:"push",label:"Push",icon:qo,separator:!0},{key:"copyName",label:"Copy Branch Name",icon:Ln,separator:!0}]),l=N(()=>[{key:"checkout",label:"Checkout",icon:Cn},{key:"deleteBranch",label:"Delete Remote Branch",icon:pn,separator:!0,danger:!0},{key:"fetch",label:"Fetch",icon:es,separator:!0},{key:"pull",label:"Pull into Current",icon:qs},{key:"copyName",label:"Copy Branch Name",icon:Ln,separator:!0}]),c=N(()=>t.isLocal?s.value:l.value),m={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 p(d){const S=m[d];S&&S(),a("close")}return(d,S)=>{const T=er;return i(),le(T,{items:o(c),x:e.x,y:e.y,title:e.branchName,onAction:p,onClose:S[0]||(S[0]=b=>a("close"))},null,8,["items","x","y","title"])}}}),Su=_e({__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=N(()=>[{key:"addTag",label:"Add Tag",icon:ro},{key:"createBranch",label:"Create Branch",icon:xr},{key:"checkout",label:"Checkout (detached HEAD)",icon:Cn,separator:!0},{key:"cherryPick",label:"Cherry Pick",icon:ra},{key:"revert",label:"Revert",icon:Zo},{key:"mergeInto",label:"Merge into Current",icon:Xo,separator:!0},{key:"reset",label:"Reset Current Branch to Here",icon:Go,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 m=s[c];m&&m(),t("close")}return(c,m)=>{const p=er;return i(),le(p,{items:o(a),x:e.x,y:e.y,title:e.commit.shortHash,onAction:l,onClose:m[0]||(m[0]=d=>t("close"))},null,8,["items","x","y","title"])}}}),_u=_e({__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:pn,separator:!0,danger:!0},{key:"pushTag",label:"Push Tag",icon:qo},{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 m=er;return i(),le(m,{items:a,x:e.x,y:e.y,title:e.tagName,onClose:c[0]||(c[0]=p=>t("close")),onAction:s},null,8,["x","y","title"])}}}),Mu=_e({__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:Gs},{key:"pop",label:"Pop Stash",icon:Zo},{key:"createBranch",label:"Create Branch from Stash",icon:Hr,separator:!0},{key:"drop",label:"Drop Stash",icon:pn,separator:!0,danger:!0},{key:"copyName",label:"Copy Stash Reference",icon:Ln,separator:!0},{key:"copyHash",label:"Copy Stash Hash",icon:la}];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 m=er;return i(),le(m,{items:a,x:e.x,y:e.y,title:e.stashMessage,onClose:c[0]||(c[0]=p=>t("close")),onAction:s},null,8,["x","y","title"])}}}),Tu=_e({__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:Ws},{key:"reset",label:"Reset Working Directory",icon:Cn,separator:!0,danger:!0},{key:"clean",label:"Clean Untracked Files",icon:pn,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 m=er;return i(),le(m,{items:a,x:e.x,y:e.y,title:"Uncommitted Changes",onClose:c[0]||(c[0]=p=>t("close")),onAction:s},null,8,["x","y"])}}}),Au={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},Bu={class:"flex items-center justify-between px-4 py-3 border-b border-retro-border"},Eu={class:"text-sm font-mono text-retro-text"},Ru={class:"p-4"},Pu={key:0,class:"mb-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},Du={class:"flex justify-end gap-2 px-4 py-3 border-t border-retro-border"},Iu=["disabled"],Lu=["disabled"],At=_e({__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 Be(()=>t.visible,l=>{l?document.addEventListener("keydown",s):document.removeEventListener("keydown",s)}),gt(()=>{document.removeEventListener("keydown",s)}),(l,c)=>(i(),le(Zt,{to:"body"},[K(hn,{"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:Ke(()=>[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]=pt(m=>a("close"),["self"]))},[r("div",Au,[r("div",Bu,[r("h3",Eu,_(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]=m=>a("close"))},[K(o(xt),{class:"h-4 w-4"})])]),r("div",Ru,[e.error?(i(),u("div",Pu,_(e.error),1)):L("",!0),Es(l.$slots,"default")]),r("div",Du,[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]=m=>a("close"))},_(e.cancelLabel),9,Iu),r("button",{type:"button",class:ye(["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]=m=>a("confirm"))},_(e.loading?"Loading...":e.confirmLabel),11,Lu)])])])):L("",!0)]),_:3})]))}}),Sr=gr("gitGraph",()=>{const e=$([]),n=$([]),t=$([]),a=$(new Set),s=$([]),l=$([]),c=$(0),m=$(!1),p=$(null),d=$(null),S=$(null),T=$(!1),b=$(null),y=$(!1),x=$(0),A=$(""),j=$([]),B=$(null),q=$(!1),te=$(!1),U=$(!1),re=$(!1),ae=$(null);let ue=null;function fe(F){ae.value=F,ue&&clearTimeout(ue),ue=setTimeout(()=>{ae.value=null},8e3)}function ee(){ae.value=null,ue&&(clearTimeout(ue),ue=null)}async function Z(F,J,ke,bt){if(!B.value)return{success:!1,error:"No working directory set"};try{const tn=await $fetch(F,{method:bt?.method??"POST",body:{workingDirectory:B.value,...J}});return(bt?.reloadGraph??!0)&&await Dt(B.value),{success:!0,data:tn}}catch(tn){const nn=ar(tn,ke);return fe(nn),{success:!1,error:nn}}}const H=$(null),z=$(!1),O=$(!1),W=$(null),v=$([]),h=$([]),M=$(null),G=$(null),oe=$(null),ne=$("inline"),I=$("list"),w=$("rounded"),C=$(!1),V=$({date:!0,author:!0,commit:!0}),Q=$(0),ce=$(0),Te=$(null),Ae=$(null),De=$(null),Ge=$(null),me=$(null),P=$(null),X=$(null),Y=$(null),de=$(null),xe=$(null),ve=$(null),Se=$(!1),Le=new Map,Kt=10,vn=N(()=>{if(!A.value&&j.value.length===0)return e.value;let F=e.value;if(A.value){const J=A.value.toLowerCase(),ke=`${J}:${e.value.length}`;if(Le.has(ke))F=Le.get(ke);else{if(F=So(F,J),Le.size>=Kt){const bt=Le.keys().next().value;bt&&Le.delete(bt)}Le.set(ke,F)}}if(j.value.length>0){const J=new Set(j.value);F=di(F,J)}return F}),ut=N(()=>n.value.find(F=>F.isHead)||null);async function Dt(F){B.value=F,T.value=!0,b.value=null;try{const[J,ke,bt,tn,nn]=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=J.commits,n.value=J.branches,t.value=J.tags,a.value=new Set(J.localBranches??[]),y.value=J.hasMore,x.value=J.totalCount,s.value=ke.stagedFiles??[],l.value=ke.unstagedFiles??[],c.value=(ke.stagedCount??0)+(ke.unstagedCount??0),v.value=bt,h.value=tn,W.value=nn,H.value=Date.now(),await k()}catch(J){const ke=J instanceof Error?J.message:"Failed to load git graph";b.value=ke,e.value=[],n.value=[],t.value=[],s.value=[],l.value=[],c.value=0,v.value=[],h.value=[]}finally{T.value=!1}}async function kt(){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 Ct=$(!1);async function It(){if(!(!B.value||!y.value||T.value||Ct.value)){Ct.value=!0;try{const F=await $fetch("/api/git/log",{query:{workingDirectory:B.value,offset:e.value.length}});e.value=[...e.value,...F.commits],y.value=F.hasMore}catch(F){console.error("Failed to load more commits:",F)}finally{Ct.value=!1}}}async function ht(F){if(p.value=F,d.value=null,S.value=null,m.value=!1,q.value=!0,!B.value){q.value=!1;return}try{const J=await $fetch("/api/git/show",{query:{workingDirectory:B.value,hash:F.hash}});d.value=J.files,S.value=J.stats}catch(J){console.error("Failed to load commit details:",J),d.value=[],S.value={additions:0,deletions:0,filesChanged:0},fe("Failed to load commit details")}finally{q.value=!1}}function jt(){p.value=null,d.value=null,S.value=null,m.value=!1}function Lt(){p.value=null,S.value=null,d.value=null,m.value=!0}function zt(F){A.value=F,Q.value=0,Vt()}const yt=N(()=>A.value?So(e.value,A.value).map(F=>F.hash):[]);function Vt(){ce.value=yt.value.length}function Yt(){yt.value.length!==0&&(Q.value=(Q.value+1)%yt.value.length,Vt(),ft())}function dt(){yt.value.length!==0&&(Q.value=Q.value<=0?yt.value.length-1:Q.value-1,Vt(),ft())}function ft(){const F=yt.value[Q.value];if(F){const J=e.value.find(ke=>ke.hash===F);J&&ht(J)}}function Rt(F){const J=j.value.indexOf(F);J===-1?j.value.push(F):j.value.splice(J,1)}function Bt(){A.value="",j.value=[]}async function sn(F){if(!B.value)return{success:!1,error:"No working directory set"};re.value=!0;try{const J=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:B.value,branchName:F}});return J.success&&await Dt(B.value),{success:J.success,error:J.error}}catch(J){const ke=J instanceof Error?J.message:"Failed to checkout branch";return fe(ke),{success:!1,error:ke}}finally{re.value=!1}}async function $n(F,J){if(!B.value)return{success:!1,error:"No working directory set"};try{const ke=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:B.value,branchName:F,createBranch:!0,fromCommit:J}});return ke.success&&await Dt(B.value),{success:ke.success,error:ke.error}}catch(ke){return{success:!1,error:ke instanceof Error?ke.message:"Failed to create branch"}}}async function Xt(F,J=!1){return Z("/api/git/branch",{branchName:F,force:J},"Failed to delete branch",{method:"DELETE"})}async function Qt(F){return Z("/api/git/branch",{branchName:F,remote:!0},"Failed to delete remote branch",{method:"DELETE"})}async function Sn(F){if(!B.value)return{success:!1,error:"No working directory set"};te.value=!0;try{return await $fetch("/api/git/stage",{method:"POST",body:{workingDirectory:B.value,files:F}}),await kt(),{success:!0}}catch(J){const ke=J instanceof Error?J.message:"Failed to stage files";return fe(ke),{success:!1,error:ke}}finally{te.value=!1}}async function Wt(F){if(!B.value)return{success:!1,error:"No working directory set"};te.value=!0;try{return await $fetch("/api/git/unstage",{method:"POST",body:{workingDirectory:B.value,files:F}}),await kt(),{success:!0}}catch(J){const ke=J instanceof Error?J.message:"Failed to unstage files";return fe(ke),{success:!1,error:ke}}finally{te.value=!1}}async function at(F){if(!B.value)return{success:!1,error:"No working directory set"};U.value=!0;try{return await $fetch("/api/git/commit",{method:"POST",body:{workingDirectory:B.value,message:F}}),await Dt(B.value),{success:!0}}catch(J){const ke=J instanceof Error?J.message:"Failed to commit changes";return fe(ke),{success:!1,error:ke}}finally{U.value=!1}}async function _n(F,J){return Z("/api/git/branch-rename",{oldName:F,newName:J},"Failed to rename branch")}async function Ie(F,J){return Z("/api/git/merge",{branch:F,...J},"Failed to merge branch")}async function Nt(F){return Z("/api/git/rebase",{onto:F},"Failed to rebase branch")}async function et(F,J,ke,bt){return Z("/api/git/push",{branch:F,remote:J,force:ke,forceWithLease:bt},"Failed to push branch")}async function gn(F,J,ke,bt){return Z("/api/git/pull",{branch:F,remote:J,noFastForward:ke,squash:bt},"Failed to pull branch")}async function qe(F,J,ke){return Z("/api/git/fetch",{branch:F,remote:J,...ke},"Failed to fetch")}async function an(F,J,ke){return Z("/api/git/cherry-pick",{hash:F,recordOrigin:J,noCommit:ke},"Failed to cherry-pick commit")}async function tt(F){return Z("/api/git/revert",{hash:F},"Failed to revert commit")}async function nt(F,J){return Z("/api/git/reset",{hash:F,mode:J},"Failed to reset to commit")}async function Fe(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 Dt(B.value),{success:!0}}catch(J){const ke=J?.data?.message||J?.statusMessage||J?.message||"Failed to checkout commit";return fe(ke),{success:!1,error:ke}}}async function Et(F){try{const J=F.message.split(`
63
- `)[0];return await Un(J),{success:!0}}catch(J){const ke=J?.message||"Failed to copy commit subject";return fe(ke),{success:!1,error:ke}}}async function Xe(F,J,ke,bt,tn){return Z("/api/git/tag",{name:F,hash:J,annotated:ke,message:bt,pushToRemote:tn},"Failed to create tag")}async function Jt(F,J){return Z("/api/git/tag",{name:F,deleteFromRemote:J},"Failed to delete tag",{method:"DELETE"})}async function Qe(F,J){return Z("/api/git/tag-push",{name:F,remote:J},"Failed to push tag")}async function ln(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(J){const ke=ar(J,"Failed to get tag detail");return fe(ke),{success:!1,error:ke}}}async function We(F){try{return await Un(F),{success:!0}}catch(J){const ke=J?.message||"Failed to copy tag name";return fe(ke),{success:!1,error:ke}}}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 v.value=F.stashes,{success:!0}}catch(F){const J=ar(F,"Failed to load stashes");return fe(J),{success:!1,error:J}}}async function rt(F,J){return Z("/api/git/stash-apply",{index:F,reinstateIndex:J},"Failed to apply stash")}async function en(F,J){return Z("/api/git/stash-pop",{index:F,reinstateIndex:J},"Failed to pop stash")}async function ot(F){return Z("/api/git/stash-drop",{index:F},"Failed to drop stash")}async function Mn(F,J){return Z("/api/git/stash-branch",{index:F,branchName:J},"Failed to create branch from stash")}async function be(F,J){return Z("/api/git/stash",{message:F,includeUntracked:J},"Failed to stash changes")}async function R(){if(!B.value)return{success:!1,error:"No working directory set"};try{const F=await $fetch("/api/git/remotes",{query:{workingDirectory:B.value}});return h.value=F.remotes,{success:!0}}catch(F){const J=ar(F,"Failed to load remotes");return fe(J),{success:!1,error:J}}}async function se(F,J){return Z("/api/git/remote",{name:F,url:J},"Failed to add remote")}async function pe(F,J){return Z("/api/git/remote",{name:F,newUrl:J},"Failed to edit remote",{method:"PUT"})}async function Ue(F){return Z("/api/git/remote",{name:F},"Failed to delete remote",{method:"DELETE"})}async function He(F,J){return Z("/api/git/fetch",{all:!0,prune:F,pruneTags:J},"Failed to fetch all")}function je(){ne.value=ne.value==="inline"?"bottom":"inline"}function it(){I.value=I.value==="list"?"tree":"list"}function Ye(F){w.value=F}function Ft(){C.value=!C.value}function st(F){V.value={...V.value,[F]:!V.value[F]}}async function Je(F){if(Te.value=F,Ae.value=null,F&&B.value)try{const J=await $fetch("/api/git/merge-base",{params:{workingDirectory:B.value,branch:F}});Ae.value=J.mergeBase}catch{Ae.value=null}}async function Ht(F,J){if(De.value=F,Ge.value=null,me.value=J??null,F&&B.value)try{const ke=await $fetch("/api/git/merge-base",{params:{workingDirectory:B.value,branch:F,baseBranch:J??void 0}});Ge.value=ke.mergeBase}catch{Ge.value=null}}async function Ot(F,J){if(P.value=F,X.value=null,Y.value=J??null,F&&B.value)try{const ke=await $fetch("/api/git/merge-base",{params:{workingDirectory:B.value,branch:F,baseBranch:J??void 0}});X.value=ke.mergeBase}catch{X.value=null}}async function k(){if(!B.value)return;const F=[];Te.value&&F.push((async()=>{try{const J=await $fetch("/api/git/merge-base",{params:{workingDirectory:B.value,branch:Te.value}});Ae.value=J.mergeBase}catch{Ae.value=null}})()),De.value&&F.push((async()=>{try{const J=await $fetch("/api/git/merge-base",{params:{workingDirectory:B.value,branch:De.value,baseBranch:me.value??void 0}});Ge.value=J.mergeBase}catch{Ge.value=null}})()),P.value&&F.push((async()=>{try{const J=await $fetch("/api/git/merge-base",{params:{workingDirectory:B.value,branch:P.value,baseBranch:Y.value??void 0}});X.value=J.mergeBase}catch{X.value=null}})()),F.length>0&&await Promise.all(F)}function D(F){const J=e.value.find(ke=>ke.hash===F||ke.shortHash===F);J&&ht(J)}async function E(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 g(F){G.value=F}function ie(){G.value=null}function ge(F){oe.value=F}function Ce(){oe.value=null}const Pe=$(null),Ze=$(null),mt=$(!1),tr=N(()=>!!M.value&&!!p.value);function cn(F){M.value=F,F&&p.value&&nr()}function Mr(){M.value=null,Pe.value=null,Ze.value=null,mt.value=!1}async function nr(){if(!(!B.value||!p.value||!M.value)){mt.value=!0;try{const F=M.value.hash,J=p.value.hash,ke=await $fetch("/api/git/diff",{query:{workingDirectory:B.value,from:F,to:J}});Pe.value=ke.files,Ze.value=ke.stats}catch(F){console.error("Failed to load comparison:",F),fe("Failed to load commit comparison"),Pe.value=null,Ze.value=null}finally{mt.value=!1}}}async function Un(F){navigator?.clipboard&&await navigator.clipboard.writeText(F)}async function jn(F,J){de.value=J,xe.value=F,ve.value=null,Se.value=!0,await zn()}function Me(){de.value=null,xe.value=null,ve.value=null,Se.value=!1}async function zn(){if(!B.value||!xe.value||!de.value){Se.value=!1;return}Se.value=!0;try{const F=await $fetch("/api/git/file-diff",{query:{workingDirectory:B.value,commitHash:xe.value,filePath:de.value.path}});ve.value=F}catch(F){console.error("Failed to load file diff:",F),fe("Failed to load file diff"),ve.value=null}finally{Se.value=!1}}function Pn(){e.value=[],n.value=[],t.value=[],a.value=new Set,s.value=[],l.value=[],c.value=0,m.value=!1,p.value=null,d.value=null,S.value=null,T.value=!1,b.value=null,y.value=!1,x.value=0,A.value="",j.value=[],B.value=null,H.value=null,z.value=!1,O.value=!1,W.value=null,Ct.value=!1,q.value=!1,te.value=!1,U.value=!1,re.value=!1,v.value=[],h.value=[],M.value=null,Pe.value=null,Ze.value=null,mt.value=!1,G.value=null,oe.value=null,ne.value="inline",I.value="list",w.value="rounded",C.value=!1,V.value={date:!0,author:!0,commit:!0},Q.value=0,ce.value=0,Te.value=null,De.value=null,Ge.value=null,me.value=null,P.value=null,X.value=null,Y.value=null,de.value=null,xe.value=null,ve.value=null,Se.value=!1,ee(),Le.clear()}async function vo(){if(!B.value||O.value||T.value)return!1;O.value=!0;try{const F=(await $fetch("/api/git/state",{query:{workingDirectory:B.value}})).state,J=W.value;if(W.value=F,H.value=Date.now(),!J)return!1;const ke=J.headCommit!==F.headCommit||J.branchListHash!==F.branchListHash,bt=J.workingTreeHash!==F.workingTreeHash,tn=J.stashListHash!==F.stashListHash;if(ke){const[yn,rr,As]=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(Bs=>Bs.stashes).catch(()=>[])]);return e.value=yn.commits,n.value=yn.branches,t.value=yn.tags,a.value=new Set(yn.localBranches??[]),y.value=yn.hasMore,x.value=yn.totalCount,s.value=rr.stagedFiles??[],l.value=rr.unstagedFiles??[],c.value=(rr.stagedCount??0)+(rr.unstagedCount??0),v.value=As,await k(),!0}if(!bt&&!tn)return!1;const[nn,bn]=await Promise.all([bt?$fetch("/api/git/status",{query:{workingDirectory:B.value}}):Promise.resolve(null),tn?$fetch("/api/git/stash",{query:{workingDirectory:B.value}}).then(yn=>yn.stashes).catch(()=>[]):Promise.resolve(null)]);return nn&&(s.value=nn.stagedFiles??[],l.value=nn.unstagedFiles??[],c.value=(nn.stagedCount??0)+(nn.unstagedCount??0)),bn&&(v.value=bn),!0}catch(F){return console.error("Failed to refresh git graph:",F),!1}finally{O.value=!1}}function Ms(){z.value=!0}function Ts(){z.value=!1}return{commits:we(e),branches:we(n),tags:we(t),localBranchNames:we(a),stagedFiles:we(s),unstagedFiles:we(l),uncommittedChangesCount:we(c),isUncommittedChangesSelected:we(m),selectedCommit:we(p),selectedCommitFiles:we(d),selectedCommitStats:we(S),loading:we(T),loadingMore:we(Ct),error:we(b),hasMore:we(y),totalCount:we(x),searchQuery:we(A),filteredBranches:we(j),workingDirectory:we(B),stashes:we(v),remotes:we(h),comparisonCommit:we(M),comparisonFiles:we(Pe),comparisonStats:we(Ze),comparisonLoading:we(mt),isComparing:tr,activeDialog:we(G),activeContextMenu:we(oe),detailViewPosition:we(ne),fileViewMode:we(I),graphStyle:we(w),muteNonAncestral:we(C),columnVisibility:we(V),searchResultIndex:we(Q),searchResultCount:we(ce),selectedFeatureId:we(Te),featureMergeBase:we(Ae),conversationBranch:we(De),conversationMergeBase:we(Ge),conversationBaseBranch:we(me),previewBranch:we(P),previewMergeBase:we(X),previewBaseBranch:we(Y),diffViewerFile:we(de),diffViewerCommitHash:we(xe),diffViewerContent:we(ve),diffViewerLoading:we(Se),lastRefreshTime:we(H),isPollingActive:we(z),isRefreshing:we(O),isLoadingDetails:we(q),isStaging:we(te),isCommitting:we(U),isCheckingOut:we(re),operationError:we(ae),filteredCommits:vn,currentBranch:ut,searchResultHashes:yt,loadGitGraph:Dt,loadMoreCommits:It,refreshUncommittedChanges:kt,selectCommit:ht,selectUncommittedChanges:Lt,clearSelection:jt,setSearchQuery:zt,toggleBranchFilter:Rt,clearFilters:Bt,nextSearchResult:Yt,prevSearchResult:dt,checkoutBranch:sn,createBranch:$n,deleteLocalBranch:Xt,deleteRemoteBranch:Qt,stageFiles:Sn,unstageFiles:Wt,commitChanges:at,reset:Pn,clearOperationError:ee,renameBranch:_n,mergeBranch:Ie,rebaseBranch:Nt,pushBranch:et,pullBranch:gn,fetchBranch:qe,cherryPickCommit:an,revertCommit:tt,resetToCommit:nt,checkoutCommit:Fe,copyCommitSubject:Et,createTag:Xe,deleteTag:Jt,pushTag:Qe,getTagDetail:ln,copyTagName:We,loadStashes:xn,applyStash:rt,popStash:en,dropStash:ot,stashBranch:Mn,stashChanges:be,loadRemotes:R,addRemote:se,editRemote:pe,deleteRemote:Ue,fetchAll:He,setActiveDialog:g,clearActiveDialog:ie,setActiveContextMenu:ge,clearActiveContextMenu:Ce,selectComparisonCommit:cn,clearComparison:Mr,loadComparisonData:nr,copyToClipboard:Un,toggleDetailViewPosition:je,toggleFileViewMode:it,setGraphStyle:Ye,toggleMuteNonAncestral:Ft,toggleColumnVisibility:st,navigateToCommit:D,resetWorking:E,cleanUntracked:f,setSelectedFeatureId:Je,setConversationBranch:Ht,setPreviewBranch:Ot,openFileDiff:jn,closeFileDiff:Me,checkAndRefresh:vo,startPolling:Ms,stopPolling:Ts}});async function Nu(){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!==Nr&&console.warn(`[conversationStorage] Storage version mismatch: ${e.version} vs ${Nr}`);const n=e.conversations.map(p=>{if(!p||typeof p!="object")return p;const d=p;return"claudeSessionId"in d&&!("providerSessionId"in d)?{...d,providerSessionId:d.claudeSessionId}:p}),a=(Array.isArray(e.archivedConversations)?e.archivedConversations:[]).map(p=>{if(!p||typeof p!="object")return p;const d=p;return"claudeSessionId"in d&&!("providerSessionId"in d)?{...d,providerSessionId:d.claudeSessionId}:p}),s=n.filter(Fs),l=a.filter(Hs),c=n.length-s.length,m=a.length-l.length;return c>0&&console.warn(`[conversationStorage] Discarded ${c} corrupted active conversation(s)`),m>0&&console.warn(`[conversationStorage] Discarded ${m} corrupted archive conversation(s)`),{conversations:s,archivedConversations:l,discardedConversations:c,discardedArchives:m}}catch(e){return console.error("[conversationStorage] Failed to load conversations:",e),{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0}}}async function Fu(e,n=[]){if(typeof window>"u")return!1;try{return await $fetch("/api/conversations",{method:"POST",body:{version:Nr,conversations:e,archivedConversations:n}}),!0}catch(t){return console.error("Failed to save conversations:",t),!1}}function Hu(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 wt=gr("chat",()=>{const e=$(!1),n=$(Os),t=$("ask"),a=$(""),s=$([]),l=$([]),c=$(null),m=$("active"),p=$(new Set),d=new Map,S=$(!1),T=$(0),b=new Map,y=1200,x=$(null),A=$(null);function j(k){return k?d.get(k)??null:null}function B(k){let D=d.get(k);return D||(D={session:null,pendingPermission:null,pendingPlanApproval:null,lastError:null,debugEvents:[]},d.set(k,D)),D}const q=N(()=>s.value.find(k=>k.id===c.value)||null),te=N(()=>q.value?.messages??[]),U=N(()=>(T.value,j(c.value)?.session??null)),re=N(()=>(T.value,j(c.value)?.pendingPermission??null)),ae=N(()=>(T.value,j(c.value)?.pendingPlanApproval??null)),ue=N(()=>(T.value,j(c.value)?.lastError??null)),fe=N(()=>(T.value,j(c.value)?.debugEvents??[])),ee=N(()=>U.value?.status==="streaming"),Z=N(()=>q.value?.providerSessionId??""),H=N(()=>te.value.length>0),z=N(()=>te.value[te.value.length-1]||null);function O(k){return p.value.has(k)}const W=N(()=>c.value?p.value.has(c.value):!1),v=N(()=>s.value.length>0),h=N(()=>l.value.length>0),M=N(()=>s.value.length),G=N(()=>M.value>=bo),oe=N(()=>s.value),ne=N(()=>l.value),I=N(()=>x.value&&s.value.find(k=>k.id===x.value)||null);function w(k){return x.value===k}function C(k){m.value=k}async function V(k){if(!(!k?.previewBranch||!k.worktreePath))try{const D=await $fetch("/api/chat/preview-sync",{method:"POST",body:{previewBranch:k.previewBranch,worktreePath:k.worktreePath}});if(!D.success)throw new Error(D.error||"Unknown preview sync failure")}catch(D){console.warn("[chat] Failed to sync preview branch after worktree update",{conversationId:k.id,previewBranch:k.previewBranch,worktreePath:k.worktreePath,error:D instanceof Error?D.message:String(D)})}}async function Q(k){if(O(k))return{success:!1,error:"Cannot archive while this conversation is streaming"};if(s.value.findIndex(E=>E.id===k)===-1)return{success:!1,error:"Conversation not found"};try{const E=await $fetch(`/api/conversations/${k}/archive`,{method:"POST"});if(E.success&&E.archived){const f=b.get(k);return f&&(clearTimeout(f),b.delete(k)),d.delete(k),s.value=Array.isArray(E.conversations)?E.conversations:s.value.filter(g=>g.id!==k),l.value=Array.isArray(E.archivedConversations)?E.archivedConversations:[E.archived,...l.value],Jt(),x.value===k&&(x.value=null),c.value===k&&(c.value=s.value[0]?.id??null),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:c.value}}).catch(g=>{console.error("Failed to save active conversation:",g)}),{success:!0}}return{success:!1,error:"Failed to archive conversation"}}catch(E){return{success:!1,error:E instanceof Error?E.message:"Failed to archive conversation"}}}async function ce(k,D){if(st().atLimit)return{success:!1,error:`Cannot restore. Active conversations reached ${yo}.`};if(!l.value.some(f=>f.id===k))return{success:!1,error:"Archived conversation not found"};try{const f=await $fetch(`/api/conversations/archives/${k}/restore`,{method:"POST",body:{baseBranch:D}});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(g=>g.id!==k),m.value="active",ln(f.conversation.id),Xe(),nt(),{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 Te(k){const D=l.value.findIndex(E=>E.id===k);if(D===-1)return{success:!1,error:"Archived conversation not found"};try{const E=await $fetch(`/api/conversations/archives/${k}`,{method:"DELETE"});return E.success?(Array.isArray(E.archivedConversations)?l.value=E.archivedConversations:l.value.splice(D,1),Jt(),{success:!0}):{success:!1,error:"Failed to delete archived conversation"}}catch{return l.value.splice(D,1),nt(),{success:!0}}}async function Ae(){if(!(typeof window>"u"))try{const k=await $fetch("/api/settings");if(k){if(typeof k.panelWidth=="number"){const f=k.panelWidth;f>=wo&&f<=ko&&(n.value=f)}typeof k.isPanelOpen=="boolean"&&(e.value=k.isPanelOpen),typeof k.activeConversationId=="string"&&(c.value=k.activeConversationId);const{useSettingsStore:D}=await Tn(async()=>{const{useSettingsStore:f}=await import("./DZfSmUhR.js").then(g=>g.s);return{useSettingsStore:f}},__vite__mapDeps([0,1,2]),import.meta.url),E=D();await E.hydrate(),t.value=E.permissionMode}}catch(k){console.error("Failed to load chat settings:",k)}}function De(k){t.value=k,typeof window<"u"&&Tn(async()=>{const{useSettingsStore:D}=await import("./DZfSmUhR.js").then(E=>E.s);return{useSettingsStore:D}},__vite__mapDeps([0,1,2]),import.meta.url).then(({useSettingsStore:D})=>{D().setPermissionMode(k)})}function Ge(k,D){const E=D??c.value;if(!E)return;const f=B(E);f.pendingPermission=k,T.value++}function me(k){const D=k??c.value;if(!D)return;const E=d.get(D);E&&(E.pendingPermission=null,T.value++)}function P(k,D){const E=D??c.value;if(!E)return;const f=B(E);f.pendingPlanApproval=k,T.value++}function X(k){const D=k??c.value;if(!D)return;const E=d.get(D);E&&(E.pendingPlanApproval=null,T.value++)}function Y(){e.value=!e.value,ve()}function de(){e.value=!0,ve()}function xe(){e.value=!1,ve()}function ve(){typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{isPanelOpen:e.value}}).catch(k=>{console.error("Failed to save panel state:",k)})}function Se(k){const D=Math.max(wo,Math.min(ko,k));n.value=D,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{panelWidth:D}}).catch(E=>{console.error("Failed to save panel width:",E)})}function Le(k){a.value=k}function Kt(k,D){const E=D??c.value;if(!E)return;const f=s.value.find(g=>g.id===E);f&&(f.providerSessionId=k)}function vn(k,D){const E=s.value.find(f=>f.id===k);E&&(E.worktreeBranch=D,E.lastCommitTime=new Date().toISOString())}async function ut(k){const D=s.value.find(f=>f.id===k);if(!D?.worktreeBranch)return null;const E=D.worktreeBranch.trim();if(!E)return null;try{const g=(await $fetch("/api/specs/features")).features.find(ie=>ie.id===E);return g?(D.featureId!==g.id&&(D.featureId=g.id,D.updatedAt=new Date().toISOString(),nt()),g.id):null}catch(f){return console.warn("[chat] Failed to map branch to feature",{conversationId:k,branchName:E,error:f instanceof Error?f.message:String(f)}),null}}function Dt(k,D,E){const f=s.value.find(g=>g.id===k);f&&(f.providerId=D,f.providerModelKey=E)}function kt(k){const D=k??c.value;if(!D)return;const E=s.value.find(f=>f.id===D);E&&(E.providerSessionId="")}function Ct(k){return s.value.find(E=>E.id===k)?.providerSessionId??""}function It(k){p.value.add(k)}function ht(k){p.value.delete(k)}function jt(k,D){const E=D??c.value;if(!E)return;const f=s.value.find(g=>g.id===E);f&&f.messages.push(k)}function Lt(k,D,E){const f={id:mr(),role:"user",content:k,attachments:E&&E.length>0?E:void 0,timestamp:new Date().toISOString()};return jt(f,D),f}function zt(k){const D={id:mr(),role:"assistant",content:"",timestamp:new Date().toISOString(),status:"streaming"};return jt(D,k),D}function yt(k,D,E){const f=E??c.value;if(!f)return;const g=s.value.find(ge=>ge.id===f);if(!g)return;const ie=g.messages.findIndex(ge=>ge.id===k);ie!==-1&&(g.messages[ie]={...g.messages[ie],...D})}function Vt(k,D,E){const f=E??c.value;if(!f)return;const g=s.value.find(ge=>ge.id===f);if(!g)return;const ie=g.messages.findIndex(ge=>ge.id===k);ie!==-1&&(g.messages[ie].content+=D)}function Yt(k,D,E){const f=E??c.value;if(!f)return;const g=s.value.find(ge=>ge.id===f);if(!g)return;const ie=g.messages.findIndex(ge=>ge.id===k);if(ie!==-1){const ge=g.messages[ie],Ce=ge.tools?[...ge.tools,D]:[D];g.messages[ie]={...ge,tools:Ce}}}function dt(k,D,E,f){const g=f??c.value;if(!g)return;const ie=s.value.find(Ce=>Ce.id===g);if(!ie)return;const ge=ie.messages.findIndex(Ce=>Ce.id===k);if(ge!==-1){const Ce=ie.messages[ge];if(Ce.tools){const Pe=Ce.tools.findIndex(Ze=>Ze.id===D);if(Pe!==-1){const Ze=[...Ce.tools];Ze[Pe]={...Ze[Pe],...E},ie.messages[ge]={...Ce,tools:Ze}}}}Fe(g,!1)}function ft(k){k.contentBlocks&&(k.content=Hu(k.contentBlocks))}function Rt(k,D){if(k.type!==D.type)return!0;switch(D.type){case"text":return k.text!==D.text;case"tool_use":{const E=k;return E.name!==D.name||E.inputSummary!==D.inputSummary}case"tool_result":{const E=k;return E.content!==D.content||E.isError!==D.isError}default:return!1}}function Bt(k,D){const E=D??c.value;if(!E)return;const f=s.value.find(ie=>ie.id===E);if(!f)return;const g=f.messages.find(ie=>ie.id===k);g&&!g.contentBlocks&&(g.contentBlocks=[])}function sn(k,D,E){const f=E??c.value;if(!f)return;const g=s.value.find(ge=>ge.id===f);if(!g)return;const ie=g.messages.find(ge=>ge.id===k);ie&&(ie.contentBlocks||(ie.contentBlocks=[]),ie.contentBlocks.push(D),ft(ie))}function $n(k,D,E,f){const g=f??c.value;if(!g)return;const ie=s.value.find(mt=>mt.id===g);if(!ie)return;const ge=ie.messages.find(mt=>mt.id===k);if(!ge?.contentBlocks)return;const Ce=ge.contentBlocks.findIndex(mt=>mt.id===D);if(Ce===-1)return;const Ze={...ge.contentBlocks[Ce]};E(Ze),ge.contentBlocks[Ce]=Ze}function Xt(k,D,E,f,g){const ie=f??c.value;if(!ie)return;const ge=s.value.find(cn=>cn.id===ie);if(!ge)return;const Ce=ge.messages.find(cn=>cn.id===k);if(!Ce?.contentBlocks)return;const Pe=Ce.contentBlocks.findIndex(cn=>cn.id===D);if(Pe===-1)return;const Ze=Ce.contentBlocks[Pe],mt={...Ze};E(mt),Ce.contentBlocks[Pe]=mt,g?.syncContent!==!1&&Rt(Ze,mt)&&ft(Ce),Fe(ie,!1)}function Qt(k,D,E){const f=E??c.value;if(!f)return;const g=s.value.find(ge=>ge.id===f);if(!g)return;const ie=g.messages.find(ge=>ge.id===k);ie&&(ie.contentBlocks||(ie.contentBlocks=[]),ie.contentBlocks.push(D),ft(ie),Fe(f,!1))}function Sn(k,D,E){const f=E??c.value;if(!f)return null;const g=s.value.find(ge=>ge.id===f);if(!g)return null;const ie=g.messages.find(ge=>ge.id===k);return ie?.contentBlocks?ie.contentBlocks.find(ge=>ge.type==="tool_use"&&ge.toolUseId===D)??null:null}function Wt(k,D){const E=D??c.value;if(!E)return;const f=d.get(E);f?.session&&(f.session.status=k,T.value++)}function at(k,D){const E=D??c.value;if(!E)return;const f=B(E);f.session={sessionId:k,cwd:a.value,status:"streaming",startedAt:new Date().toISOString()},f.lastError=null,T.value++}function _n(k){const D=k??c.value;if(!D)return;const E=d.get(D);E?.session&&(E.session.status="idle",T.value++)}function Ie(k,D){const E=D??c.value;if(!E)return;const f=B(E);f.session&&(f.session.status="error",f.session.error=k),f.lastError=k,T.value++}function Nt(k,D){if(!S.value)return;const E=D??c.value;if(!E)return;const f=B(E),g=(()=>{if(typeof k.payload=="string")return k.payload;try{return JSON.stringify(k.payload,null,2)}catch{return String(k.payload)}})(),ie=8e3,ge=300,Ce=g.length>ie?`${g.slice(0,ie)}
65
- ... (truncated)`:g;f.debugEvents.push({id:`dbg-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,timestamp:new Date().toISOString(),direction:k.direction,channel:k.channel,eventType:k.eventType||"unknown",payload:Ce}),f.debugEvents.length>ge&&f.debugEvents.splice(0,f.debugEvents.length-ge),T.value++}function et(k){S.value=k}function gn(k){const D=k??c.value;if(!D)return;const E=d.get(D);E&&(E.debugEvents=[],T.value++)}function qe(){if(!c.value)return;const k=s.value.find(E=>E.id===c.value);k&&(k.messages=[]);const D=c.value;d.delete(D),T.value++}function an(k){const D=k??c.value;if(!D)return;const E=d.get(D);E&&(E.lastError=null,E.session&&(E.session.error=void 0),T.value++)}async function tt(){const k=await Nu();if(s.value=k.conversations,l.value=k.archivedConversations,k.discardedArchives>0&&console.warn(`[chat] Skipped ${k.discardedArchives} corrupted archived conversation(s)`),Xe(),Jt(),!x.value){const D=s.value.find(E=>!!E.previewBranch&&!E.finalized);D&&(x.value=D.id)}if(c.value){const D=s.value.find(E=>E.id===c.value);D&&D.cwd?a.value=D.cwd:D||(c.value=null,e.value=!1)}}function nt(){Fu(s.value,l.value)}function Fe(k,D=!1){const E=s.value.find(f=>f.id===k);if(E)if(D){const f=b.get(k);f&&(clearTimeout(f),b.delete(k)),E.updatedAt=new Date().toISOString(),nt()}else{if(b.get(k))return;const g=setTimeout(()=>{E.updatedAt=new Date().toISOString(),nt(),b.delete(k)},y);b.set(k,g)}}function Et(k=!1){c.value&&Fe(c.value,k)}function Xe(){s.value.sort((k,D)=>new Date(D.createdAt).getTime()-new Date(k.createdAt).getTime())}function Jt(){l.value.sort((k,D)=>new Date(D.archivedAt).getTime()-new Date(k.archivedAt).getTime())}async function Qe(k){if(st().atLimit)return"";const E=zo();let f=null;if(k?.featureId){const Ce=await $fetch("/api/chat/worktree",{method:"POST",body:{conversationId:E,featureId:k.featureId,baseBranch:k.baseBranch}});if(!Ce.success&&Ce.error)throw new Error(Ce.error);f=Ce}let g=null;if(typeof window<"u")try{const{useSettingsStore:Ce}=await Tn(async()=>{const{useSettingsStore:Ze}=await import("./DZfSmUhR.js").then(mt=>mt.s);return{useSettingsStore:Ze}},__vite__mapDeps([0,1,2]),import.meta.url),Pe=Ce();await Pe.hydrate(),g=Pe.providerSelection}catch(Ce){console.warn("[chat] Failed to load provider selection for new conversation",Ce)}const ie=g||{providerId:Wo,modelKey:Vo},ge={id:E,title:"New Conversation",messages:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),cwd:a.value||process.cwd?.()||"",featureId:k?.featureId,providerId:ie.providerId,providerModelKey:ie.modelKey};if(f?.success&&f.worktreePath&&f.branch&&(ge.worktreePath=f.worktreePath,ge.worktreeBranch=f.branch,ge.cwd=f.worktreePath,ge.hasWorktree=!0,f.baseBranch&&(ge.baseBranch=f.baseBranch),f.providerSessionId&&(ge.providerSessionId=f.providerSessionId)),s.value.unshift(ge),c.value=E,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:E}}).catch(Ce=>{console.error("Failed to save active conversation:",Ce)}),!k?.featureId)try{const Ce=await $fetch("/api/chat/worktree",{method:"POST",body:{conversationId:E,baseBranch:k?.baseBranch}});if(Ce.success&&Ce.worktreePath&&Ce.branch){const Pe=s.value.find(Ze=>Ze.id===E);Pe&&(Pe.worktreePath=Ce.worktreePath,Pe.worktreeBranch=Ce.branch,Pe.cwd=Ce.worktreePath,Pe.hasWorktree=!0,Ce.baseBranch&&(Pe.baseBranch=Ce.baseBranch))}}catch(Ce){console.warn("[chat] Failed to create worktree for conversation",E,Ce)}return nt(),E}function ln(k){const D=s.value.find(E=>E.id===k);D&&(c.value=k,e.value=!0,D.cwd&&(a.value=D.cwd),!D.featureId&&D.worktreeBranch&&ut(k),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:k,isPanelOpen:!0}}).catch(E=>{console.error("Failed to save active conversation:",E)}))}async function We(k){const D=s.value.findIndex(g=>g.id===k);if(D===-1)return;const E=s.value[D];if(x.value===k&&(x.value=null),E.hasWorktree&&E.worktreePath&&E.worktreeBranch)try{await $fetch("/api/chat/worktree",{method:"DELETE",body:{worktreePath:E.worktreePath,branch:E.worktreeBranch}})}catch(g){console.warn("[chat] Failed to clean up worktree for conversation",k,g)}s.value.splice(D,1),d.delete(k);const f=b.get(k);f&&(clearTimeout(f),b.delete(k)),c.value===k&&(c.value=null,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:null}}).catch(g=>{console.error("Failed to clear active conversation:",g)})),nt()}async function xn(k,D,E){const f=s.value.find(ie=>ie.id===k);if(!f)return{success:!1,error:"Conversation not found"};if(!f.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const g=E||f.baseBranch;try{const ie=await $fetch("/api/chat/finalize",{method:"POST",body:{conversationId:k,commitMessage:D,baseBranch:g,worktreePath:f.worktreePath,worktreeBranch:f.worktreeBranch}});return ie.success?(x.value===k&&(x.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(),nt()):ie.rebaseInProgress&&ie.conflictFiles?.length&&await en(k,f.worktreePath,g||"main",D),ie}catch(ie){return{success:!1,error:ie instanceof Error?ie.message:String(ie)}}}async function rt(k,D){const E=s.value.find(g=>g.id===k);if(!E)return{success:!1,error:"Conversation not found"};if(!E.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const f=D||E.baseBranch;try{const g=await $fetch("/api/chat/rebase",{method:"POST",body:{conversationId:k,baseBranch:f,worktreePath:E.worktreePath}});return g.rebaseInProgress&&g.conflictFiles?.length?await en(k,E.worktreePath,f||"main","","sync"):g.success&&(await V(E),E.baseBranch=f,nt()),g}catch(g){return{success:!1,error:g instanceof Error?g.message:String(g)}}}async function en(k,D,E,f,g="finalize"){A.value={conversationId:k,worktreePath:D,baseBranch:E,commitMessage:f,files:[],resolvedFiles:new Set,loading:!0,error:null,mode:g};try{const ie=await $fetch("/api/rebase/conflicts",{params:{worktreePath:D}});A.value&&(A.value.files=ie.files,A.value.loading=!1)}catch(ie){A.value&&(A.value.error=ie instanceof Error?ie.message:String(ie),A.value.loading=!1)}}async function ot(k,D){if(!A.value)return!1;try{const E=await $fetch("/api/rebase/resolve",{method:"PUT",body:{worktreePath:A.value.worktreePath,filePath:k,content:D}});return E.success&&A.value&&A.value.resolvedFiles.add(k),E.success}catch{return!1}}async function Mn(){if(!A.value)return{success:!1,error:"No conflict resolution in progress"};const{conversationId:k,commitMessage:D,baseBranch:E,mode:f,worktreePath:g}=A.value,ie=f==="sync"?"/api/rebase/continue-sync":"/api/rebase/continue";try{const ge=s.value.find(Pe=>Pe.id===k),Ce=await $fetch(ie,{method:"POST",body:{conversationId:k,commitMessage:D,baseBranch:E,worktreePath:g,worktreeBranch:ge?.worktreeBranch}});if(Ce.success){if(f==="finalize"){x.value===k&&(x.value=null);const Pe=s.value.find(Ze=>Ze.id===k);Pe&&(Pe.worktreePath=void 0,Pe.worktreeBranch=void 0,Pe.hasWorktree=!1,Pe.baseBranch=void 0,Pe.previewBranch=void 0,Pe.finalized=!0,Pe.updatedAt=new Date().toISOString(),nt())}else if(f==="sync"){const Pe=s.value.find(Ze=>Ze.id===k);Pe&&(await V(Pe),Pe.baseBranch=E,Pe.updatedAt=new Date().toISOString(),nt())}A.value=null}else Ce.rebaseInProgress&&Ce.conflictFiles?.length&&await en(k,g,E,D,f);return Ce}catch(ge){return{success:!1,error:ge instanceof Error?ge.message:String(ge)}}}async function be(){if(!A.value)return!1;try{const k=await $fetch("/api/rebase/abort",{method:"POST",body:{worktreePath:A.value.worktreePath}});return A.value=null,k.success}catch{return A.value=null,!1}}async function R(k){if(!A.value)return!1;const D=A.value.files.find(E=>E.path===k);if(!D)return!1;try{const E=await $fetch("/api/rebase/ai-resolve",{method:"POST",body:{worktreePath:A.value.worktreePath,filePath:k,conflictContent:D.content}});return E.success&&E.resolvedContent!==void 0?(D.content=E.resolvedContent,await ot(k,E.resolvedContent)):!1}catch{return!1}}async function se(){if(!A.value)return;const k=A.value.files.filter(D=>!A.value.resolvedFiles.has(D.path));for(const D of k)await R(D.path)}async function pe(k){const D=s.value.find(E=>E.id===k);if(!D)return{success:!1,error:"Conversation not found"};if(!D.hasWorktree||!D.worktreePath||!D.baseBranch)return{success:!1,error:"No worktree to preview"};try{const E=await $fetch("/api/chat/preview",{method:"POST",body:{conversationId:k,worktreePath:D.worktreePath,baseBranch:D.baseBranch}});return E.success&&E.previewBranch&&(D.previewBranch=E.previewBranch,x.value=k,D.updatedAt=new Date().toISOString(),nt()),{success:E.success,error:E.error}}catch(E){return{success:!1,error:E instanceof Error?E.message:String(E)}}}async function Ue(k){const D=s.value.find(E=>E.id===k);if(!D)return{success:!1,error:"Conversation not found"};if(!D.previewBranch||!D.baseBranch)return x.value=null,{success:!1,error:"No active preview"};try{const E=await $fetch("/api/chat/preview",{method:"DELETE",body:{previewBranch:D.previewBranch,baseBranch:D.baseBranch}});return E.success&&(D.previewBranch=void 0,x.value=null,D.updatedAt=new Date().toISOString(),nt()),{success:E.success,error:E.error}}catch(E){return{success:!1,error:E instanceof Error?E.message:String(E)}}}async function He(k){if(x.value===k)return await Ue(k);if(x.value){const D=await Ue(x.value);if(!D.success)return{success:!1,error:`Failed to end previous preview: ${D.error}`}}return await pe(k)}function je(k){const D=k.trim();if(!D)return null;const E=s.value.filter(f=>f.featureId===D?!0:f.worktreeBranch?.trim()===D);return E.length===0?null:E.sort((f,g)=>new Date(g.updatedAt).getTime()-new Date(f.updatedAt).getTime())[0]||null}function it(k){s.value.unshift(k),Xe(),nt()}function Ye(k,D){const E=s.value.find(f=>f.id===k);E&&(E.title=D.trim(),E.updatedAt=new Date().toISOString(),Xe(),nt())}function Ft(k){const D=c.value;if(!D)return;const E=s.value.find(g=>g.id===D);if(!E||E.title!=="New Conversation")return;const f=E.messages.find(g=>g.role==="user");f&&(f.content.trim().length>0?E.title=Us(f.content):f.attachments&&f.attachments.length>0&&(E.title=f.attachments.length===1?"[Image] New Conversation":`[${f.attachments.length} Images] New Conversation`))}function st(){const k=s.value.length;return{atLimit:k>=yo,nearLimit:k>=bo,count:k}}async function Je(k,D){c.value||await Qe();const E=Lt(k,void 0,D);return Ft(),Et(!0),E}function Ht(k,D,E){const f=E??c.value;Vt(k,D,f??void 0),f&&Fe(f,!1)}function Ot(k,D){const E=D??c.value;yt(k,{status:"complete"},E??void 0),E&&Fe(E,!0)}return{messages:te,session:U,isPanelOpen:e,panelWidth:we(n),permissionMode:we(t),pendingPermission:re,pendingPlanApproval:ae,cwd:we(a),lastError:ue,debugEvents:fe,debugStreamEnabled:we(S),providerSessionId:Z,conversations:we(s),archivedConversations:we(l),activeConversationId:we(c),conversationViewMode:we(m),conflictState:we(A),previewingConversationId:we(x),isStreaming:ee,hasMessages:H,lastMessage:z,isActiveConversationStreaming:W,hasConversations:v,hasArchivedConversations:h,activeConversation:q,conversationCount:M,isNearStorageLimit:G,sortedConversations:oe,sortedArchivedConversations:ne,previewingConversation:I,streamingConversations:we(p),initialize:Ae,togglePanel:Y,openPanel:de,closePanel:xe,setPanelWidth:Se,setPermissionMode:De,setPendingPermission:Ge,clearPendingPermission:me,setPendingPlanApproval:P,clearPendingPlanApproval:X,setCwd:Le,setProviderSessionId:Kt,clearProviderSession:kt,getProviderSessionId:Ct,updateWorktreeBranch:vn,setConversationProviderSelection:Dt,startConversationStreaming:It,endConversationStreaming:ht,isConversationStreaming:O,addMessage:jt,addUserMessage:Lt,addAssistantMessage:zt,updateMessage:yt,appendToMessage:Vt,addToolToMessage:Yt,updateToolInMessage:dt,initContentBlocks:Bt,appendContentBlock:sn,appendContentBlockWithSave:Qt,updateBlockById:$n,updateBlockWithSave:Xt,findToolUseBlock:Sn,syncContentFromBlocks:ft,setSessionStatus:Wt,startSession:at,endSession:_n,setSessionError:Ie,setDebugStreamEnabled:et,pushDebugEvent:Nt,clearDebugEvents:gn,clearMessages:qe,clearError:an,loadConversations:tt,saveAllConversations:nt,saveCurrentConversation:Et,saveConversation:Fe,createConversation:Qe,selectConversation:ln,deleteConversation:We,archiveConversation:Q,restoreArchivedConversation:ce,deleteArchivedConversation:Te,setConversationViewMode:C,findConversationByFeature:je,syncConversationFeatureFromBranch:ut,addAutoModeConversation:it,renameConversation:Ye,checkStorageLimits:st,finalizeConversation:xn,rebaseConversation:rt,resolveConflictFile:ot,continueRebase:Mn,abortRebase:be,aiResolveConflictFile:R,aiResolveAllConflicts:se,previewConversation:pe,unpreviewConversation:Ue,togglePreview:He,isConversationPreviewing:w,addUserMessageWithConversation:Je,appendToMessageWithSave:Ht,completeMessageWithSave:Ot}});function Ou(e={}){const n=Sr(),t=300,a=5e3,s=250;let l=null,c=null,m=null,p=null,d=null,S=!1,T=!1;const b=$(!1),y=$(!1);let x=e;function A(z){x=z}async function j(){const z=x.getScrollPosition?.()??0,O=await n.checkAndRefresh();return O&&x.setScrollPosition&&(await qt(),x.setScrollPosition(z)),O}function B(){return b.value||!!n.activeContextMenu||!!n.activeDialog}async function q(){if(B()){y.value=!0;return}U()}async function te(){if(S){T=!0;return}S=!0;try{await j()}finally{S=!1,T&&(T=!1,U())}}function U(){c&&clearTimeout(c),c=setTimeout(()=>{c=null,te()},s)}function re(z){if(typeof window>"u")return;if(m&&m.readyState===WebSocket.OPEN){m.send(JSON.stringify({type:"watch",workingDirectory:z}));return}p&&(clearTimeout(p),p=null);const W=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/git-watcher-ws`;m=new WebSocket(W),m.onopen=()=>{m.send(JSON.stringify({type:"watch",workingDirectory:z}))},m.onmessage=v=>{try{JSON.parse(v.data).type==="git_changed"&&q()}catch{}},m.onclose=()=>{m=null,n.isPollingActive&&d&&(p=setTimeout(()=>{d&&re(d)},a))},m.onerror=()=>{}}function ae(){p&&(clearTimeout(p),p=null),m&&(m.close(),m=null)}function ue(z){z&&(d=z),!n.isPollingActive&&(n.startPolling(),d&&re(d))}function fe(){ae(),n.stopPolling()}function ee(){b.value=!0,l&&(clearTimeout(l),l=null)}function Z(){l&&clearTimeout(l),l=setTimeout(async()=>{b.value=!1,y.value&&(y.value=!1,U())},t)}function H(){fe(),l&&(clearTimeout(l),l=null),c&&(clearTimeout(c),c=null),S=!1,T=!1,d=null}return Be(()=>[n.activeContextMenu,n.activeDialog],()=>{!n.activeContextMenu&&!n.activeDialog&&y.value&&!b.value&&(y.value=!1,U())}),{isUserInteracting:we(b),isDeferredRefresh:we(y),startPolling:ue,stopPolling:fe,startInteraction:ee,endInteraction:Z,cleanup:H,setScrollCallbacks:A}}function Uu(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 ju={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},zu={class:"text-sm font-mono text-retro-cyan"},Vu={class:"text-xs font-mono text-retro-text mt-1 truncate"},Wu={class:"space-y-3"},Gu={class:"flex items-start gap-2 cursor-pointer group"},qu={class:"flex items-start gap-2 cursor-pointer group"},Zu=_e({__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=$(!1),s=$(!1);function l(){t("confirm",{recordOrigin:a.value,noCommit:s.value})}function c(){a.value=!1,s.value=!1,t("close")}return(m,p)=>(i(),le(At,{title:"Cherry-Pick Commit",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Cherry-Pick",onClose:c,onConfirm:l},{default:Ke(()=>[r("div",ju,[p[2]||(p[2]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Commit",-1)),r("div",zu,_(e.commitHash.slice(0,7)),1),r("div",Vu,_(e.commitMessage.split(`
66
- `)[0]),1)]),r("div",Wu,[r("label",Gu,[Re(r("input",{"onUpdate:modelValue":p[0]||(p[0]=d=>Oe(a)?a.value=d:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Pt,o(a)]]),p[3]||(p[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",qu,[Re(r("input",{"onUpdate:modelValue":p[1]||(p[1]=d=>Oe(s)?s.value=d:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Pt,o(s)]]),p[4]||(p[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"]))}}),Ku={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Yu={class:"text-sm font-mono text-retro-cyan"},Xu={class:"mb-4"},Qu={class:"flex items-start gap-2 cursor-pointer group"},Ju=_e({__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=$(""),s=$(!0),l=N(()=>a.value.trim().length>0);function c(){l.value&&t("confirm",{name:a.value.trim(),checkout:s.value})}function m(){a.value="",s.value=!0,t("close")}return(p,d)=>(i(),le(At,{title:"Create Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Create Branch",onClose:m,onConfirm:c},{default:Ke(()=>[r("div",Ku,[d[2]||(d[2]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"From",-1)),r("div",Yu,_(e.fromCommit.slice(0,7)),1)]),r("div",Xu,[d[3]||(d[3]=r("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Branch name",-1)),Re(r("input",{"onUpdate:modelValue":d[0]||(d[0]=S=>Oe(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),[[vt,o(a)]])]),r("label",Qu,[Re(r("input",{"onUpdate:modelValue":d[1]||(d[1]=S=>Oe(s)?s.value=S:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Pt,o(s)]]),d[4]||(d[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"]))}}),ed=_e({__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(),le(At,{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:Ke(()=>[...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"},[$e(" This runs "),r("code",null,"git clean -fd"),$e(" and cannot be undone. ")])],-1)])]),_:1},8,["visible","loading","error"]))}}),td={class:"text-retro-text text-sm font-mono mb-2"},nd={class:"text-retro-cyan"},rd={class:"space-y-3 mt-4"},od={class:"flex items-center gap-2 cursor-pointer"},sd=_e({__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=$(!1);function l(){a("confirm",{force:s.value})}return Be(()=>t.visible,c=>{c&&(s.value=!1)}),(c,m)=>(i(),le(At,{title:"Delete Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Delete","confirm-danger":!0,onClose:m[1]||(m[1]=p=>a("close")),onConfirm:l},{default:Ke(()=>[m[4]||(m[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",td,[$e(" Delete "+_(e.isLocal?"local":"remote")+" branch ",1),r("span",nd,_(e.branchName),1),m[2]||(m[2]=$e("? ",-1))]),r("div",rd,[r("label",od,[Re(r("input",{"onUpdate:modelValue":m[0]||(m[0]=p=>Oe(s)?s.value=p:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Pt,o(s)]]),m[3]||(m[3]=r("span",{class:"text-retro-muted text-sm"},"Force delete (even if not fully merged)",-1))])])]),_:1},8,["visible","loading","error"]))}}),ad={class:"text-retro-text text-sm font-mono mb-4"},id={class:"text-retro-cyan"},ld={class:"space-y-3"},cd={class:"flex items-center gap-2 cursor-pointer"},ud={class:"flex items-center gap-2 cursor-pointer"},dd={class:"flex items-center gap-2 cursor-pointer"},fd=_e({__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=$(!1),l=$(!1),c=$(!1);function m(){a("confirm",{noCommit:s.value,noFastForward:l.value,squash:c.value})}return Be(()=>t.visible,p=>{p&&(s.value=!1,l.value=!1,c.value=!1)}),(p,d)=>(i(),le(At,{title:"Merge Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Merge",onClose:d[3]||(d[3]=S=>a("close")),onConfirm:m},{default:Ke(()=>[r("p",ad,[d[4]||(d[4]=$e(" Merge ",-1)),r("span",id,_(e.branchName),1),d[5]||(d[5]=$e(" into current branch ",-1))]),r("div",ld,[r("label",cd,[Re(r("input",{"onUpdate:modelValue":d[0]||(d[0]=S=>Oe(s)?s.value=S:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Pt,o(s)]]),d[6]||(d[6]=r("span",{class:"text-retro-muted text-sm"},"No commit (stage changes only)",-1))]),r("label",ud,[Re(r("input",{"onUpdate:modelValue":d[1]||(d[1]=S=>Oe(l)?l.value=S:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Pt,o(l)]]),d[7]||(d[7]=r("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),r("label",dd,[Re(r("input",{"onUpdate:modelValue":d[2]||(d[2]=S=>Oe(c)?c.value=S:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Pt,o(c)]]),d[8]||(d[8]=r("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),md={class:"text-retro-text text-sm font-mono mb-4"},hd={class:"text-retro-cyan"},pd={class:"space-y-3"},vd=["value"],gd={class:"flex items-center gap-2 cursor-pointer"},xd={class:"flex items-center gap-2 cursor-pointer"},bd=_e({__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=$("origin"),l=$(!1),c=$(!1);function m(){a("confirm",{remote:s.value,noFastForward:l.value,squash:c.value})}return Be(()=>t.visible,p=>{p&&(s.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",l.value=!1,c.value=!1)}),(p,d)=>(i(),le(At,{title:"Pull Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Pull",onClose:d[3]||(d[3]=S=>a("close")),onConfirm:m},{default:Ke(()=>[r("p",md,[d[4]||(d[4]=$e(" Pull ",-1)),r("span",hd,_(e.branchName),1),d[5]||(d[5]=$e(" from remote ",-1))]),r("div",pd,[r("div",null,[d[6]||(d[6]=r("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),Re(r("select",{"onUpdate:modelValue":d[0]||(d[0]=S=>Oe(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(he,null,Ee(e.remotes,S=>(i(),u("option",{key:S,value:S},_(S),9,vd))),128))],512),[[En,o(s)]])]),r("label",gd,[Re(r("input",{"onUpdate:modelValue":d[1]||(d[1]=S=>Oe(l)?l.value=S:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Pt,o(l)]]),d[7]||(d[7]=r("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),r("label",xd,[Re(r("input",{"onUpdate:modelValue":d[2]||(d[2]=S=>Oe(c)?c.value=S:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Pt,o(c)]]),d[8]||(d[8]=r("span",{class:"text-retro-muted text-sm"},"Squash (combine all commits into one)",-1))])])]),_:1},8,["visible","loading","error"]))}}),yd={class:"text-retro-text text-sm font-mono mb-4"},wd={class:"text-retro-cyan"},kd={class:"space-y-3"},Cd=["value"],$d={class:"flex items-center gap-2 cursor-pointer"},Sd=["checked"],_d={class:"flex items-center gap-2 cursor-pointer"},Md=["checked"],Td={key:0,class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},Ad=_e({__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=$("origin"),l=$(!1),c=$(!1);function m(S){l.value=S,S&&(c.value=!1)}function p(S){c.value=S,S&&(l.value=!1)}function d(){a("confirm",{remote:s.value,force:l.value,forceWithLease:c.value})}return Be(()=>t.visible,S=>{S&&(s.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",l.value=!1,c.value=!1)}),(S,T)=>(i(),le(At,{title:"Push Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Push",onClose:T[3]||(T[3]=b=>a("close")),onConfirm:d},{default:Ke(()=>[r("p",yd,[T[4]||(T[4]=$e(" Push ",-1)),r("span",wd,_(e.branchName),1),T[5]||(T[5]=$e(" to remote ",-1))]),r("div",kd,[r("div",null,[T[6]||(T[6]=r("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),Re(r("select",{"onUpdate:modelValue":T[0]||(T[0]=b=>Oe(s)?s.value=b: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(he,null,Ee(e.remotes,b=>(i(),u("option",{key:b,value:b},_(b),9,Cd))),128))],512),[[En,o(s)]])]),r("label",$d,[r("input",{checked:o(l),type:"checkbox",class:"accent-retro-cyan",onChange:T[1]||(T[1]=b=>m(b.target.checked))},null,40,Sd),T[7]||(T[7]=r("span",{class:"text-retro-muted text-sm"},"Force push",-1))]),r("label",_d,[r("input",{checked:o(c),type:"checkbox",class:"accent-retro-cyan",onChange:T[2]||(T[2]=b=>p(b.target.checked))},null,40,Md),T[8]||(T[8]=r("span",{class:"text-retro-muted text-sm"},"Force with lease (safer force push)",-1))]),o(l)||o(c)?(i(),u("div",Td,_(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)):L("",!0)])]),_:1},8,["visible","loading","error"]))}}),Bd={class:"text-retro-text text-sm font-mono mb-4"},Ed={class:"text-retro-cyan"},Rd={class:"text-retro-cyan"},Pd={class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},Dd={class:"text-retro-cyan"},Id={class:"text-retro-cyan"},Ld=_e({__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(),le(At,{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:Ke(()=>[r("p",Bd,[s[2]||(s[2]=$e(" Rebase ",-1)),r("span",Ed,_(e.branchName),1),s[3]||(s[3]=$e(" onto ",-1)),r("span",Rd,_(e.ontoBranch),1)]),r("div",Pd,[s[4]||(s[4]=$e(" This will rewrite commit history. Commits from ",-1)),r("span",Dd,_(e.branchName),1),s[5]||(s[5]=$e(" will be replayed on top of ",-1)),r("span",Id,_(e.ontoBranch),1),s[6]||(s[6]=$e(". ",-1))])]),_:1},8,["visible","loading","error"]))}}),Nd={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Fd={class:"text-sm font-mono text-retro-cyan"},Hd={class:"text-xs font-mono text-retro-text mt-1 truncate"},Od={class:"space-y-2"},Ud=["value"],jd={key:0,class:"mt-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},zd=_e({__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=$("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(m,p)=>(i(),le(At,{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:Ke(()=>[r("div",Nd,[p[1]||(p[1]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Reset to",-1)),r("div",Fd,_(e.commitHash.slice(0,7)),1),r("div",Hd,_(e.commitMessage.split(`
67
- `)[0]),1)]),r("div",Od,[p[2]||(p[2]=r("div",{class:"text-xs font-mono text-retro-muted mb-2"},"Reset mode",-1)),(i(),u(he,null,Ee(s,d=>r("label",{key:d.value,class:ye(["flex items-start gap-2 p-2 rounded cursor-pointer group border transition-colors",[o(a)===d.value?"border-retro-cyan bg-retro-cyan/5":"border-transparent hover:bg-retro-panel"]])},[Re(r("input",{"onUpdate:modelValue":p[0]||(p[0]=S=>Oe(a)?a.value=S:null),type:"radio",name:"reset-mode",value:d.value,class:"mt-0.5 accent-retro-cyan"},null,8,Ud),[[Lr,o(a)]]),r("div",null,[r("span",{class:ye(["text-sm font-mono transition-colors",[d.value==="hard"?"text-retro-red":"text-retro-text",o(a)===d.value?"text-retro-cyan":""]])},_(d.label),3),r("p",{class:ye(["text-xs font-mono mt-0.5",d.value==="hard"?"text-retro-red/70":"text-retro-muted"])},_(d.description),3)])],2)),64))]),o(a)==="hard"?(i(),u("div",jd," Warning: Hard reset will permanently discard all uncommitted changes in your working directory and staging area. This action cannot be undone. ")):L("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),Vd={class:"space-y-3"},Wd={class:"flex items-start gap-2 cursor-pointer"},Gd={class:"flex items-start gap-2 cursor-pointer"},qd={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=_e({__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=$("mixed"),l=N(()=>s.value==="hard");function c(){a("confirm",{mode:s.value})}return Be(()=>t.visible,m=>{m&&(s.value="mixed")}),(m,p)=>(i(),le(At,{title:"Reset Working Directory",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Reset","confirm-danger":o(l),onClose:p[2]||(p[2]=d=>a("close")),onConfirm:c},{default:Ke(()=>[p[5]||(p[5]=r("p",{class:"text-retro-text text-sm font-mono mb-4"}," Reset the working directory to HEAD. ",-1)),r("div",Vd,[r("label",Wd,[Re(r("input",{"onUpdate:modelValue":p[0]||(p[0]=d=>Oe(s)?s.value=d:null),type:"radio",value:"mixed",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[Lr,o(s)]]),p[3]||(p[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",Gd,[Re(r("input",{"onUpdate:modelValue":p[1]||(p[1]=d=>Oe(s)?s.value=d:null),type:"radio",value:"hard",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[Lr,o(s)]]),p[4]||(p[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",qd," WARNING: Hard reset will permanently discard all uncommitted changes. This cannot be undone. ")):L("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),Kd={class:"space-y-4"},Yd={class:"flex items-center gap-2 cursor-pointer"},Xd=_e({__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=$(""),l=$(!1);function c(){a("confirm",{message:s.value.trim()||void 0,includeUntracked:l.value})}return Be(()=>t.visible,m=>{m&&(s.value="",l.value=!1)}),(m,p)=>(i(),le(At,{title:"Stash Changes",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Stash",onClose:p[2]||(p[2]=d=>a("close")),onConfirm:c},{default:Ke(()=>[p[5]||(p[5]=r("p",{class:"text-retro-text text-sm font-mono mb-4"}," Save uncommitted changes to the stash. ",-1)),r("div",Kd,[r("div",null,[p[3]||(p[3]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message (optional)",-1)),Re(r("input",{"onUpdate:modelValue":p[0]||(p[0]=d=>Oe(s)?s.value=d: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),[[vt,o(s)]])]),r("label",Yd,[Re(r("input",{"onUpdate:modelValue":p[1]||(p[1]=d=>Oe(l)?l.value=d:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Pt,o(l)]]),p[4]||(p[4]=r("span",{class:"text-retro-muted text-sm"},"Include untracked files",-1))])])]),_:1},8,["visible","loading","error"]))}}),Qd={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Jd={class:"text-sm font-mono text-retro-cyan"},ef={class:"mb-4"},tf={class:"mb-3"},nf={class:"flex items-start gap-2 cursor-pointer group"},rf={key:0,class:"mb-4"},of={class:"space-y-2"},sf={class:"flex items-start gap-2 cursor-pointer group"},af=["disabled"],lf={key:0,class:"ml-6"},cf=["value"],uf=_e({__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=$(""),s=$(!1),l=$(""),c=$(!1),m=$(""),p=N(()=>a.value.trim().length>0);function d(){if(!p.value)return;const T={name:a.value.trim(),annotated:s.value};s.value&&l.value.trim()&&(T.message=l.value.trim()),c.value&&m.value&&(T.pushToRemote=m.value),t("confirm",T)}function S(){a.value="",s.value=!1,l.value="",c.value=!1,m.value="",t("close")}return Be(()=>s.value,T=>{T||(l.value="")}),(T,b)=>(i(),le(At,{title:"Create Tag",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Create Tag",onClose:S,onConfirm:d},{default:Ke(()=>[r("div",Qd,[b[5]||(b[5]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"At commit",-1)),r("div",Jd,_(e.commitHash.slice(0,7)),1)]),r("div",ef,[b[6]||(b[6]=r("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag name",-1)),Re(r("input",{"onUpdate:modelValue":b[0]||(b[0]=y=>Oe(a)?a.value=y: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),[[vt,o(a)]])]),r("div",tf,[r("label",nf,[Re(r("input",{"onUpdate:modelValue":b[1]||(b[1]=y=>Oe(s)?s.value=y:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Pt,o(s)]]),b[7]||(b[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",rf,[b[8]||(b[8]=r("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag message",-1)),Re(r("textarea",{"onUpdate:modelValue":b[2]||(b[2]=y=>Oe(l)?l.value=y: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),[[vt,o(l)]])])):L("",!0),r("div",of,[r("label",sf,[Re(r("input",{"onUpdate:modelValue":b[3]||(b[3]=y=>Oe(c)?c.value=y:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan",disabled:e.remotes.length===0},null,8,af),[[Pt,o(c)]]),r("div",null,[r("span",{class:ye(["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",lf,[Re(r("select",{"onUpdate:modelValue":b[4]||(b[4]=y=>Oe(m)?m.value=y: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"},[b[9]||(b[9]=r("option",{value:"",disabled:"",class:"text-retro-muted"},"Select remote",-1)),(i(!0),u(he,null,Ee(e.remotes,y=>(i(),u("option",{key:y,value:y},_(y),9,cf))),128))],512),[[En,o(m)]])])):L("",!0)])]),_:1},8,["visible","loading","error"]))}}),df={class:"text-retro-text text-sm font-mono mb-2"},ff={class:"text-retro-cyan"},mf={class:"space-y-3 mt-4"},hf={class:"flex items-center gap-2 cursor-pointer"},pf={key:0,class:"ml-6"},vf=["value"],gf=_e({__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=$(!1),l=$("origin");function c(){a("confirm",{deleteFromRemote:s.value,remote:s.value?l.value:void 0})}return Be(()=>t.visible,m=>{m&&(s.value=!1,l.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin")}),(m,p)=>(i(),le(At,{title:"Delete Tag",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Delete","confirm-danger":!0,onClose:p[2]||(p[2]=d=>a("close")),onConfirm:c},{default:Ke(()=>[p[7]||(p[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",df,[p[3]||(p[3]=$e(" Delete tag ",-1)),r("span",ff,_(e.tagName),1),p[4]||(p[4]=$e("? ",-1))]),r("div",mf,[r("label",hf,[Re(r("input",{"onUpdate:modelValue":p[0]||(p[0]=d=>Oe(s)?s.value=d:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Pt,o(s)]]),p[5]||(p[5]=r("span",{class:"text-retro-muted text-sm"},"Also delete from remote",-1))]),o(s)?(i(),u("div",pf,[p[6]||(p[6]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Remote",-1)),Re(r("select",{"onUpdate:modelValue":p[1]||(p[1]=d=>Oe(l)?l.value=d: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(he,null,Ee(e.remotes,d=>(i(),u("option",{key:d,value:d},_(d),9,vf))),128))],512),[[En,o(l)]])])):L("",!0)])]),_:1},8,["visible","loading","error"]))}}),xf={class:"mb-4"},bf={class:"text-retro-cyan text-sm font-mono"},yf={class:"mb-4"},wf={class:"text-retro-text text-sm font-mono"},kf={class:"mb-4"},Cf={class:"text-retro-text text-sm font-mono break-all select-all"},$f={class:"mb-4"},Sf={class:"text-retro-text text-sm font-mono"},_f={class:"text-retro-muted"},Mf={class:"mb-4"},Tf={class:"text-retro-text text-sm font-mono"},Af={key:1,class:"mb-2"},Bf={class:"p-2 text-sm font-mono text-retro-text bg-retro-panel border border-retro-border rounded whitespace-pre-wrap"},Ef={key:1,class:"text-retro-muted text-sm font-mono text-center py-4"},Rf=_e({__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(),le(At,{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:Ke(()=>[r("div",xf,[s[2]||(s[2]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tag",-1)),r("p",bf,_(e.tagName),1)]),e.tagDetail?(i(),u(he,{key:0},[r("div",yf,[s[3]||(s[3]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Type",-1)),r("p",wf,_(e.tagDetail.isAnnotated?"Annotated":"Lightweight"),1)]),r("div",kf,[s[4]||(s[4]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Hash",-1)),r("p",Cf,_(e.tagDetail.hash),1)]),e.tagDetail.tagger?(i(),u(he,{key:0},[r("div",$f,[s[5]||(s[5]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tagger",-1)),r("p",Sf,[$e(_(e.tagDetail.tagger.name)+" ",1),r("span",_f,"<"+_(e.tagDetail.tagger.email)+">",1)])]),r("div",Mf,[s[6]||(s[6]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Date",-1)),r("p",Tf,_(e.tagDetail.tagger.date),1)])],64)):L("",!0),e.tagDetail.message?(i(),u("div",Af,[s[7]||(s[7]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message",-1)),r("div",Bf,_(e.tagDetail.message),1)])):L("",!0)],64)):e.loading?(i(),u("div",Ef," Loading tag details... ")):L("",!0)]),_:1},8,["visible","loading"]))}}),ho=globalThis.setInterval,Pf={class:"h-full flex flex-col bg-retro-dark",role:"region","aria-label":"Git Graph"},Df={key:0,class:"flex-1 flex flex-col items-center justify-center gap-3"},If={key:1,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},Lf={key:2,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},Nf={class:"text-retro-red text-sm mb-4"},Ff={key:3,class:"flex-1 flex items-center justify-center p-4"},Hf={class:"flex-shrink-0 flex items-center gap-2 p-2 border-b border-retro-border"},Of={class:"relative"},Uf={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]"},jf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},zf=["checked"],Vf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Wf=["checked"],Gf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},qf=["checked"],Zf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Kf=["checked"],Yf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Xf=["checked"],Qf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Jf=["checked"],em={class:"relative"},tm=["aria-expanded"],nm={key:0,class:"text-xs"},rm={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"},om=["checked","onChange"],sm={class:"text-sm text-retro-text truncate"},am={key:0,class:"text-[10px] text-retro-cyan"},im={class:"px-3 py-1 text-[10px] text-retro-orange font-semibold uppercase tracking-wider mt-1"},lm=["checked","onChange"],cm={class:"text-sm text-retro-text truncate"},um={class:"relative"},dm={key:0,class:"absolute right-0 top-full mt-1 z-20"},fm=["title"],mm={class:"text-retro-muted text-sm"},hm={class:"text-retro-cyan font-mono"},pm={class:"space-y-3"},vm={class:"text-retro-muted text-sm"},gm={class:"text-retro-cyan font-mono"},xm={class:"space-y-3"},bm={class:"text-retro-muted text-sm"},ym={class:"text-retro-magenta font-mono"},wm={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"},km={class:"flex-1"},Cm=_e({__name:"GitGraph",props:{workingDirectory:{},isActive:{type:Boolean,default:!0}},setup(e){const n=e,t=Sr(),a=wt(),s=Ou(),l=N(()=>{const f=a.activeConversation?.worktreeBranch;return f?[f]:[]}),c=N(()=>{const f=[],g=t.selectedFeatureId;g&&f.push(g);const ie=t.conversationBranch;return ie&&!f.includes(ie)&&f.push(ie),f});Be(()=>[a.activeConversation?.worktreeBranch,a.activeConversation?.baseBranch],([f,g])=>{t.setConversationBranch(f??null,g??null)},{immediate:!0});const m=N(()=>{const f=t.previewBranch;return f?[f]:[]});Be(()=>[a.previewingConversation?.worktreeBranch,a.previewingConversation?.baseBranch],([f,g])=>{t.setPreviewBranch(f??null,g??null)},{immediate:!0});const p=N(()=>{const f={};return t.previewBranch&&t.previewMergeBase&&(f[t.previewBranch]=t.previewMergeBase),f}),d=N(()=>{const f={};return t.selectedFeatureId&&t.featureMergeBase&&(f[t.selectedFeatureId]=t.featureMergeBase),t.conversationBranch&&t.conversationMergeBase&&(f[t.conversationBranch]=t.conversationMergeBase),f}),S=N(()=>t.remotes.map(f=>f.name)),T=$(null);Be(()=>n.workingDirectory,async f=>{if(f){await t.loadGitGraph(f);const g=a.previewingConversation?.worktreeBranch;g&&await t.setPreviewBranch(g,a.previewingConversation?.baseBranch??null);const ie=a.activeConversation?.worktreeBranch;ie&&await t.setConversationBranch(ie,a.activeConversation?.baseBranch??null)}},{immediate:!0}),Be(()=>n.isActive,f=>{f&&t.commits.length>0&&!t.error?s.startPolling(n.workingDirectory):s.stopPolling()},{immediate:!0}),Be(()=>t.commits.length,f=>{f>0&&n.isActive&&!t.error&&s.startPolling(n.workingDirectory)}),Be(()=>T.value,f=>{f&&s.setScrollCallbacks({getScrollPosition:()=>f.getScrollPosition(),setScrollPosition:g=>f.setScrollPosition(g)})}),gt(()=>{s.cleanup(),t.reset()});const b=N(()=>t.error?.includes("Not a Git repository")),y=$(Date.now());let x=null;const A=()=>{x||(x=ho(()=>{y.value=Date.now()},5e3))},j=()=>{x&&(clearInterval(x),x=null)};ct(()=>{Be(()=>n.isActive,f=>{f?(y.value=Date.now(),A()):j()},{immediate:!0})}),gt(()=>{j()});const B=N(()=>{const f=t.lastRefreshTime;if(!f)return null;const g=Math.floor((y.value-f)/1e3);return t.isRefreshing?"Syncing...":g<5?"Just now":g<60?`${g}s ago`:`${Math.floor(g/60)}m ago`}),q=$(!1),te=$(!1),U=$(null);function re(){q.value=!0,qt(()=>U.value?.focus())}function ae(){q.value=!1,t.setSearchQuery("")}function ue(f){t.setSearchQuery(f)}const fe=Uu({onScrollToHead:()=>{const f=t.commits.find(g=>g.isHead);f&&t.selectCommit(f)},onEscape:()=>{ee.value?ee.value=!1:te.value?te.value=!1:Z.value?Z.value=!1:q.value?ae():t.isComparing?t.clearComparison():(t.selectedCommit||t.isUncommittedChangesSelected)&&t.clearSelection()}});ct(()=>{fe.start()}),gt(()=>{fe.stop()});const ee=$(!1),Z=$(!1);async function H(){await t.fetchAll(!0)}async function z(f){await t.addRemote(f.name,f.url)}async function O(f){await t.editRemote(f.name,f.newUrl)}async function W(f){await t.deleteRemote(f)}const v=N(()=>{const f=[],g={};for(const ie of t.branches)if(t.localBranchNames.has(ie.name))f.push(ie);else{const ge=ie.name.indexOf("/");if(ge>0){const Ce=ie.name.substring(0,ge);g[Ce]||(g[Ce]=[]),g[Ce].push(ie)}else f.push(ie)}return{local:f,remotes:g}}),h=$({visible:!1,branch:"",x:0,y:0,isCurrentBranch:!1,isLocal:!0,commitHash:""});function M(f){h.value={visible:!0,...f},t.setActiveContextMenu({type:"branch",props:f,position:{x:f.x,y:f.y}})}function G(){h.value.visible=!1,t.clearActiveContextMenu()}function oe(){G(),at.value={visible:!0,branchName:h.value.branch,loading:!1,error:null}}function ne(){const f=h.value.branch;G(),qe.value={visible:!0,branchName:f,newName:f,loading:!1,error:null}}function I(){const{branch:f,isLocal:g}=h.value;G(),et.value={visible:!0,branchName:f,isLocal:g,force:!1,loading:!1,error:null}}function w(){const f=h.value.branch;G(),tt.value={visible:!0,branchName:f,loading:!1,error:null}}function C(){const f=h.value.branch;G(),Fe.value={visible:!0,branchName:f,loading:!1,error:null}}function V(){const f=h.value.branch;G(),Xe.value={visible:!0,branchName:f,loading:!1,error:null}}function Q(){const f=h.value.branch;G(),Qe.value={visible:!0,branchName:f,loading:!1,error:null}}async function ce(){const f=h.value.branch;G(),await t.fetchBranch(f)}async function Te(){const f=h.value.branch;G(),await t.copyToClipboard(f),Ot(h.value.x,h.value.y)}function Ae(){G(),Ie.value={visible:!0,fromCommit:h.value.commitHash,loading:!1,error:null}}const De=$({visible:!1,commit:null,x:0,y:0});function Ge(f){De.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 me(){De.value.visible=!1,t.clearActiveContextMenu()}function P(f){const g=De.value.commit;if(!g)return!1;me();const ie=f(g);return ie&&typeof ie.then=="function"?ie.then(()=>!0):!0}function X(){P(f=>{ot.value={visible:!0,commitHash:f.hash,loading:!1,error:null}})}function Y(){P(f=>{Ie.value={visible:!0,fromCommit:f.hash,loading:!1,error:null}})}function de(){P(f=>{at.value={visible:!0,branchName:f.hash,loading:!1,error:null}})}function xe(){P(f=>{We.value={visible:!0,commitHash:f.hash,commitMessage:f.message,loading:!1,error:null}})}async function ve(){await P(f=>t.revertCommit(f.hash))}function Se(){P(f=>{tt.value={visible:!0,branchName:f.shortHash,loading:!1,error:null}})}function Le(){P(f=>{rt.value={visible:!0,commitHash:f.hash,commitMessage:f.message,loading:!1,error:null}})}async function Kt(){const{x:f,y:g}=De.value;await P(ge=>t.copyToClipboard(ge.hash))&&Ot(f,g)}async function vn(){await P(f=>t.copyCommitSubject(f))}const ut=$({visible:!1,tag:"",x:0,y:0,commitHash:""});function Dt(f){ut.value={visible:!0,...f},t.setActiveContextMenu({type:"tag",props:f,position:{x:f.x,y:f.y}})}function kt(){ut.value.visible=!1,t.clearActiveContextMenu()}async function Ct(){const f=ut.value.tag;kt(),se.value={visible:!0,tagName:f,loading:!0,tagDetail:null};const g=await t.getTagDetail(f);se.value.loading=!1,g.success&&g.data&&(se.value.tagDetail=g.data)}function It(){const f=ut.value.tag;kt(),be.value={visible:!0,tagName:f,loading:!1,error:null}}async function ht(){const f=ut.value.tag;kt(),await t.pushTag(f)}async function jt(){const f=ut.value.tag;kt(),await t.copyToClipboard(f),Ot(ut.value.x,ut.value.y)}const Lt=$({visible:!1,x:0,y:0});function zt(){Lt.value.visible=!1,t.clearActiveContextMenu()}function yt(){zt(),pe.value={visible:!0,loading:!1,error:null}}function Vt(){zt(),Ye.value={visible:!0,loading:!1,error:null}}async function Yt(){zt(),st.value={visible:!0,loading:!1,error:null}}const dt=$({visible:!1,stash:null,x:0,y:0});function ft(f){dt.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 Rt(){dt.value.visible=!1,t.clearActiveContextMenu()}function Bt(f){const g=dt.value.stash;if(!g)return!1;Rt();const ie=f(g);return ie&&typeof ie.then=="function"?ie.then(()=>!0):!0}async function sn(){await Bt(f=>t.applyStash(f.index))}async function $n(){await Bt(f=>t.popStash(f.index))}async function Xt(){await Bt(f=>t.dropStash(f.index))}function Qt(){Bt(f=>{He.value={visible:!0,stashIndex:f.index,loading:!1,error:null}})}async function Sn(){const{x:f,y:g}=dt.value;await Bt(ge=>t.copyToClipboard(`stash@{${ge.index}}`))&&Ot(f,g)}async function Wt(){const{x:f,y:g}=dt.value;await Bt(ge=>t.copyToClipboard(ge.hash))&&Ot(f,g)}const at=$({visible:!1,branchName:"",loading:!1,error:null});async function _n(){at.value.loading=!0,at.value.error=null;const f=await t.checkoutBranch(at.value.branchName);at.value.loading=!1,f.success?at.value.visible=!1:at.value.error=f.error||"Unknown error"}const Ie=$({visible:!1,fromCommit:"",loading:!1,error:null});async function Nt(f){Ie.value.loading=!0,Ie.value.error=null;const g=await t.createBranch(f.name,Ie.value.fromCommit);Ie.value.loading=!1,g.success?(f.checkout&&await t.checkoutBranch(f.name),Ie.value.visible=!1):Ie.value.error=g.error||"Unknown error"}const et=$({visible:!1,branchName:"",isLocal:!0,force:!1,loading:!1,error:null});async function gn(f){et.value.loading=!0,et.value.error=null;const{branchName:g,isLocal:ie}=et.value,ge=f?.force??et.value.force,Ce=ie?await t.deleteLocalBranch(g,ge):await t.deleteRemoteBranch(g);et.value.loading=!1,Ce.success?et.value.visible=!1:et.value.error=Ce.error||"Unknown error"}const qe=$({visible:!1,branchName:"",newName:"",loading:!1,error:null});async function an(){if(!qe.value.newName.trim()){qe.value.error="Branch name is required";return}qe.value.loading=!0,qe.value.error=null;const f=await t.renameBranch(qe.value.branchName,qe.value.newName.trim());qe.value.loading=!1,f.success?qe.value.visible=!1:qe.value.error=f.error||"Unknown error"}const tt=$({visible:!1,branchName:"",loading:!1,error:null});async function nt(f){tt.value.loading=!0,tt.value.error=null;const g=await t.mergeBranch(tt.value.branchName,f);tt.value.loading=!1,g.success?tt.value.visible=!1:tt.value.error=g.error||"Unknown error"}const Fe=$({visible:!1,branchName:"",loading:!1,error:null});async function Et(){Fe.value.loading=!0,Fe.value.error=null;const f=await t.rebaseBranch(Fe.value.branchName);Fe.value.loading=!1,f.success?Fe.value.visible=!1:Fe.value.error=f.error||"Unknown error"}const Xe=$({visible:!1,branchName:"",loading:!1,error:null});async function Jt(f){Xe.value.loading=!0,Xe.value.error=null;const g=await t.pushBranch(Xe.value.branchName,f.remote,f.force,f.forceWithLease);Xe.value.loading=!1,g.success?Xe.value.visible=!1:Xe.value.error=g.error||"Unknown error"}const Qe=$({visible:!1,branchName:"",loading:!1,error:null});async function ln(f){Qe.value.loading=!0,Qe.value.error=null;const g=await t.pullBranch(Qe.value.branchName,f.remote,f.noFastForward,f.squash);Qe.value.loading=!1,g.success?Qe.value.visible=!1:Qe.value.error=g.error||"Unknown error"}const We=$({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function xn(f){We.value.loading=!0,We.value.error=null;const g=await t.cherryPickCommit(We.value.commitHash,f.recordOrigin,f.noCommit);We.value.loading=!1,g.success?We.value.visible=!1:We.value.error=g.error||"Unknown error"}const rt=$({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function en(f){rt.value.loading=!0,rt.value.error=null;const g=await t.resetToCommit(rt.value.commitHash,f.mode);rt.value.loading=!1,g.success?rt.value.visible=!1:rt.value.error=g.error||"Unknown error"}const ot=$({visible:!1,commitHash:"",loading:!1,error:null});async function Mn(f){ot.value.loading=!0,ot.value.error=null;const g=await t.createTag(f.name,ot.value.commitHash,f.annotated,f.message,f.pushToRemote);ot.value.loading=!1,g.success?ot.value.visible=!1:ot.value.error=g.error||"Unknown error"}const be=$({visible:!1,tagName:"",loading:!1,error:null});async function R(f){be.value.loading=!0,be.value.error=null;const g=await t.deleteTag(be.value.tagName,f.deleteFromRemote?f.remote||"origin":void 0);be.value.loading=!1,g.success?be.value.visible=!1:be.value.error=g.error||"Unknown error"}const se=$({visible:!1,tagName:"",loading:!1,tagDetail:null}),pe=$({visible:!1,loading:!1,error:null});async function Ue(f){pe.value.loading=!0,pe.value.error=null;const g=await t.stashChanges(f.message,f.includeUntracked);pe.value.loading=!1,g.success?pe.value.visible=!1:pe.value.error=g.error||"Unknown error"}const He=$({visible:!1,stashIndex:0,loading:!1,error:null}),je=$("");async function it(f){He.value.loading=!0,He.value.error=null;const g=await t.stashBranch(He.value.stashIndex,f);He.value.loading=!1,g.success?He.value.visible=!1:He.value.error=g.error||"Unknown error"}const Ye=$({visible:!1,loading:!1,error:null});async function Ft(f){Ye.value.loading=!0,Ye.value.error=null;const g=await t.resetWorking(f.mode);Ye.value.loading=!1,g.success?Ye.value.visible=!1:Ye.value.error=g.error||"Unknown error"}const st=$({visible:!1,loading:!1,error:null});async function Je(){st.value.loading=!0,st.value.error=null;const f=await t.cleanUntracked();st.value.loading=!1,f.success?st.value.visible=!1:st.value.error=f.error||"Unknown error"}const Ht=$({visible:!1,x:0,y:0});function Ot(f,g){Ht.value={visible:!0,x:f,y:g},setTimeout(()=>{Ht.value.visible=!1},1500)}const k=N(()=>at.value.visible||Ie.value.visible||et.value.visible||qe.value.visible||tt.value.visible||Fe.value.visible||Xe.value.visible||Qe.value.visible||We.value.visible||rt.value.visible||ot.value.visible||be.value.visible||se.value.visible||pe.value.visible||He.value.visible||Ye.value.visible||st.value.visible);Be(k,f=>{f?t.setActiveDialog({type:"generic",props:{}}):t.clearActiveDialog()});function D(f){t.selectedCommit?t.selectComparisonCommit(f):t.selectCommit(f)}function E(f){t.navigateToCommit(f)}return(f,g)=>{const ie=ka,ge=Na,Ce=ci,Pe=Ai,Ze=Kc,mt=xu,tr=$u,cn=Su,Mr=_u,nr=Mu,Un=Tu,jn=At;return i(),u("div",Pf,[o(t).loading&&o(t).commits.length===0?(i(),u("div",Df,[...g[42]||(g[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(b)?(i(),u("div",If,[K(o(kn),{class:"w-12 h-12 text-retro-yellow mb-4"}),g[43]||(g[43]=r("h3",{class:"text-retro-text font-semibold mb-2"},"Not a Git Repository",-1)),g[44]||(g[44]=r("p",{class:"text-retro-muted text-sm max-w-xs"},[$e(" This directory is not initialized as a Git repository. Run "),r("code",{class:"text-retro-cyan"},"git init"),$e(" to get started. ")],-1))])):o(t).error?(i(),u("div",Lf,[K(o(kn),{class:"w-10 h-10 text-retro-red mb-3"}),r("p",Nf,_(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:g[0]||(g[0]=Me=>o(t).loadGitGraph(n.workingDirectory))},[K(o(Cn),{class:"w-4 h-4"}),g[45]||(g[45]=$e(" Retry ",-1))])])):o(t).commits.length===0?(i(),u("div",Ff,[...g[46]||(g[46]=[r("div",{class:"text-retro-muted text-center"},[r("p",null,"No commits found in this repository.")],-1)])])):(i(),u(he,{key:4},[o(q)?(i(),le(ie,{key:0,ref_key:"findWidgetRef",ref:U,resultCount:o(t).searchResultHashes.length,currentIndex:o(t).searchResultIndex,onSearch:ue,onNext:o(t).nextSearchResult,onPrev:o(t).prevSearchResult,onClose:ae},null,8,["resultCount","currentIndex","onNext","onPrev"])):L("",!0),r("div",Hf,[r("button",{class:ye(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",o(q)?"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:g[1]||(g[1]=Me=>o(q)?ae():re())},[K(o(An),{class:"w-4 h-4"})],2),r("div",Of,[r("button",{class:ye(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",o(ee)?"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:g[2]||(g[2]=Me=>ee.value=!o(ee))},[K(o(Vs),{class:"w-4 h-4"})],2),o(ee)?(i(),u("div",Uf,[g[53]||(g[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",jf,[r("input",{type:"radio",name:"graphStyle",value:"rounded",checked:o(t).graphStyle==="rounded",class:"accent-retro-cyan",onChange:g[3]||(g[3]=Me=>o(t).setGraphStyle("rounded"))},null,40,zf),g[47]||(g[47]=r("span",{class:"text-sm text-retro-text"},"Rounded",-1))]),r("label",Vf,[r("input",{type:"radio",name:"graphStyle",value:"angular",checked:o(t).graphStyle==="angular",class:"accent-retro-cyan",onChange:g[4]||(g[4]=Me=>o(t).setGraphStyle("angular"))},null,40,Wf),g[48]||(g[48]=r("span",{class:"text-sm text-retro-text"},"Angular",-1))]),g[54]||(g[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",Gf,[r("input",{type:"checkbox",checked:o(t).muteNonAncestral,class:"accent-retro-cyan",onChange:g[5]||(g[5]=Me=>o(t).toggleMuteNonAncestral())},null,40,qf),g[49]||(g[49]=r("span",{class:"text-sm text-retro-text"},"Mute non-ancestral",-1))]),g[55]||(g[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:g[6]||(g[6]=Me=>o(t).toggleColumnVisibility("commit"))},null,40,Kf),g[50]||(g[50]=r("span",{class:"text-sm text-retro-text"},"Hash",-1))]),r("label",Yf,[r("input",{type:"checkbox",checked:o(t).columnVisibility.author!==!1,class:"accent-retro-cyan",onChange:g[7]||(g[7]=Me=>o(t).toggleColumnVisibility("author"))},null,40,Xf),g[51]||(g[51]=r("span",{class:"text-sm text-retro-text"},"Author",-1))]),r("label",Qf,[r("input",{type:"checkbox",checked:o(t).columnVisibility.date!==!1,class:"accent-retro-cyan",onChange:g[8]||(g[8]=Me=>o(t).toggleColumnVisibility("date"))},null,40,Jf),g[52]||(g[52]=r("span",{class:"text-sm text-retro-text"},"Date",-1))])])):L("",!0)]),g[58]||(g[58]=r("span",{class:"flex-1"},null,-1)),r("div",em,[r("button",{class:ye(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",o(te)||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(te),onClick:g[9]||(g[9]=Me=>te.value=!o(te))},[K(o(ia),{class:"w-4 h-4"}),o(t).filteredBranches.length>0?(i(),u("span",nm," ("+_(o(t).filteredBranches.length)+") ",1)):L("",!0)],10,tm),o(te)?(i(),u("div",rm,[g[57]||(g[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:g[10]||(g[10]=Me=>o(t).clearFilters())}," Clear All Filters ")):L("",!0),o(v).local.length>0?(i(),u(he,{key:1},[g[56]||(g[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(he,null,Ee(o(v).local,Me=>(i(),u("label",{key:Me.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(Me.name),class:"accent-retro-cyan",onChange:zn=>o(t).toggleBranchFilter(Me.name)},null,40,om),r("span",sm,_(Me.name),1),Me.isHead?(i(),u("span",am,"(HEAD)")):L("",!0)]))),128))],64)):L("",!0),(i(!0),u(he,null,Ee(o(v).remotes,(Me,zn)=>(i(),u(he,{key:zn},[r("div",im,_(zn),1),(i(!0),u(he,null,Ee(Me,Pn=>(i(),u("label",{key:Pn.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(Pn.name),class:"accent-retro-cyan",onChange:vo=>o(t).toggleBranchFilter(Pn.name)},null,40,lm),r("span",cm,_(Pn.name),1)]))),128))],64))),128))])):L("",!0)]),r("button",{class:ye(["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:g[11]||(g[11]=Me=>o(t).loadGitGraph(n.workingDirectory))},[K(o(Cn),{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:H},[K(o(es),{class:"w-4 h-4"})]),r("div",um,[r("button",{class:ye(["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:g[12]||(g[12]=Me=>Z.value=!o(Z))},[K(o(ts),{class:"w-4 h-4"})],2),o(Z)?(i(),u("div",dm,[K(ge,{remotes:o(t).remotes,onAdd:z,onEdit:O,onDelete:W,onClose:g[13]||(g[13]=Me=>Z.value=!1)},null,8,["remotes"])])):L("",!0)]),o(B)&&n.isActive?(i(),u("div",{key:0,class:ye(["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:ye(["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),$e(" "+_(o(B)),1)],10,fm)):L("",!0)]),r("div",{class:ye(["flex-1 min-h-0 overflow-hidden",{"max-h-[50%]":o(t).selectedCommit||o(t).isUncommittedChangesSelected}])},[K(Ce,{ref_key:"commitListRef",ref:T,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(d),previewHighlightBranches:o(m),previewMergeBases:o(p),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:M,onCommitContextMenu:Ge,onTagContextMenu:Dt,onStashContextMenu:ft,onCompareSelect:D,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(),le(Pe,{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(),le(Ze,{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:E,onTogglePosition:o(t).toggleDetailViewPosition,onOpenFileDiff:g[14]||(g[14]=Me=>o(t).selectedCommit&&o(t).openFileDiff(o(t).selectedCommit.hash,Me))},null,8,["commit","files","stats","loading","detailPosition","onClose","onTogglePosition"])):L("",!0),o(t).isUncommittedChangesSelected?(i(),le(mt,{key:3,stagedFiles:o(t).stagedFiles,unstagedFiles:o(t).unstagedFiles,isStaging:o(t).isStaging,isCommitting:o(t).isCommitting,onClose:o(t).clearSelection,onStageFiles:g[15]||(g[15]=Me=>o(t).stageFiles(Me)),onUnstageFiles:g[16]||(g[16]=Me=>o(t).unstageFiles(Me)),onStageAll:g[17]||(g[17]=()=>o(t).stageFiles([])),onUnstageAll:g[18]||(g[18]=()=>o(t).unstageFiles([])),onCommit:g[19]||(g[19]=Me=>o(t).commitChanges(Me))},null,8,["stagedFiles","unstagedFiles","isStaging","isCommitting","onClose"])):L("",!0)],64)),o(h).visible?(i(),le(tr,{key:5,branchName:o(h).branch,isCurrentBranch:o(h).isCurrentBranch,isLocal:o(h).isLocal,x:o(h).x,y:o(h).y,onClose:G,onCheckout:oe,onCreateBranch:Ae,onDeleteBranch:I,onRename:ne,onMerge:w,onRebase:C,onPush:V,onPull:Q,onFetch:ce,onCopyName:Te},null,8,["branchName","isCurrentBranch","isLocal","x","y"])):L("",!0),o(De).visible&&o(De).commit?(i(),le(cn,{key:6,commit:o(De).commit,x:o(De).x,y:o(De).y,onClose:me,onAddTag:X,onCreateBranch:Y,onCheckout:de,onCherryPick:xe,onRevert:ve,onMergeInto:Se,onReset:Le,onCopyHash:Kt,onCopySubject:vn},null,8,["commit","x","y"])):L("",!0),o(ut).visible?(i(),le(Mr,{key:7,tagName:o(ut).tag,x:o(ut).x,y:o(ut).y,onClose:kt,onViewDetails:Ct,onDeleteTag:It,onPushTag:ht,onCopyName:jt},null,8,["tagName","x","y"])):L("",!0),o(dt).visible&&o(dt).stash?(i(),le(nr,{key:8,stashIndex:o(dt).stash.index,stashMessage:o(dt).stash.message,x:o(dt).x,y:o(dt).y,onClose:Rt,onApply:sn,onPop:$n,onDrop:Xt,onCreateBranch:Qt,onCopyName:Sn,onCopyHash:Wt},null,8,["stashIndex","stashMessage","x","y"])):L("",!0),o(Lt).visible?(i(),le(Un,{key:9,x:o(Lt).x,y:o(Lt).y,onClose:zt,onStash:yt,onReset:Vt,onClean:Yt},null,8,["x","y"])):L("",!0),o(at).visible?(i(),le(jn,{key:10,title:"Checkout",visible:o(at).visible,loading:o(at).loading,error:o(at).error,confirmLabel:"Checkout",onClose:g[20]||(g[20]=Me=>o(at).visible=!1),onConfirm:_n},{default:Ke(()=>[r("p",mm,[g[59]||(g[59]=$e(" Are you sure you want to checkout ",-1)),r("span",hm,_(o(at).branchName),1),g[60]||(g[60]=$e("? ",-1))])]),_:1},8,["visible","loading","error"])):L("",!0),o(qe).visible?(i(),le(jn,{key:11,title:"Rename Branch",visible:o(qe).visible,loading:o(qe).loading,error:o(qe).error,confirmLabel:"Rename",onClose:g[22]||(g[22]=Me=>o(qe).visible=!1),onConfirm:an},{default:Ke(()=>[r("div",pm,[r("p",vm,[g[61]||(g[61]=$e(" Rename ",-1)),r("span",gm,_(o(qe).branchName),1)]),Re(r("input",{"onUpdate:modelValue":g[21]||(g[21]=Me=>o(qe).newName=Me),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:mn(an,["enter"])},null,544),[[vt,o(qe).newName]])])]),_:1},8,["visible","loading","error"])):L("",!0),o(tt).visible?(i(),le(fd,{key:12,visible:o(tt).visible,branchName:o(tt).branchName,loading:o(tt).loading,error:o(tt).error,onClose:g[23]||(g[23]=Me=>o(tt).visible=!1),onConfirm:nt},null,8,["visible","branchName","loading","error"])):L("",!0),o(et).visible?(i(),le(sd,{key:13,visible:o(et).visible,branchName:o(et).branchName,isLocal:o(et).isLocal,loading:o(et).loading,error:o(et).error,onClose:g[24]||(g[24]=Me=>o(et).visible=!1),onConfirm:gn},null,8,["visible","branchName","isLocal","loading","error"])):L("",!0),o(Xe).visible?(i(),le(Ad,{key:14,visible:o(Xe).visible,branchName:o(Xe).branchName,remotes:o(S),loading:o(Xe).loading,error:o(Xe).error,onClose:g[25]||(g[25]=Me=>o(Xe).visible=!1),onConfirm:Jt},null,8,["visible","branchName","remotes","loading","error"])):L("",!0),o(Qe).visible?(i(),le(bd,{key:15,visible:o(Qe).visible,branchName:o(Qe).branchName,remotes:o(S),loading:o(Qe).loading,error:o(Qe).error,onClose:g[26]||(g[26]=Me=>o(Qe).visible=!1),onConfirm:ln},null,8,["visible","branchName","remotes","loading","error"])):L("",!0),o(Fe).visible?(i(),le(Ld,{key:16,visible:o(Fe).visible,branchName:o(t).currentBranch?.name||"HEAD",ontoBranch:o(Fe).branchName,loading:o(Fe).loading,error:o(Fe).error,onClose:g[27]||(g[27]=Me=>o(Fe).visible=!1),onConfirm:Et},null,8,["visible","branchName","ontoBranch","loading","error"])):L("",!0),o(We).visible?(i(),le(Zu,{key:17,visible:o(We).visible,commitHash:o(We).commitHash,commitMessage:o(We).commitMessage,loading:o(We).loading,error:o(We).error,onClose:g[28]||(g[28]=Me=>o(We).visible=!1),onConfirm:xn},null,8,["visible","commitHash","commitMessage","loading","error"])):L("",!0),o(rt).visible?(i(),le(zd,{key:18,visible:o(rt).visible,commitHash:o(rt).commitHash,commitMessage:o(rt).commitMessage,loading:o(rt).loading,error:o(rt).error,onClose:g[29]||(g[29]=Me=>o(rt).visible=!1),onConfirm:en},null,8,["visible","commitHash","commitMessage","loading","error"])):L("",!0),o(ot).visible?(i(),le(uf,{key:19,visible:o(ot).visible,commitHash:o(ot).commitHash,remotes:o(S),loading:o(ot).loading,error:o(ot).error,onClose:g[30]||(g[30]=Me=>o(ot).visible=!1),onConfirm:Mn},null,8,["visible","commitHash","remotes","loading","error"])):L("",!0),o(be).visible?(i(),le(gf,{key:20,visible:o(be).visible,tagName:o(be).tagName,remotes:o(S),loading:o(be).loading,error:o(be).error,onClose:g[31]||(g[31]=Me=>o(be).visible=!1),onConfirm:R},null,8,["visible","tagName","remotes","loading","error"])):L("",!0),o(se).visible?(i(),le(Rf,{key:21,visible:o(se).visible,tagName:o(se).tagName,tagDetail:o(se).tagDetail,loading:o(se).loading,onClose:g[32]||(g[32]=Me=>o(se).visible=!1)},null,8,["visible","tagName","tagDetail","loading"])):L("",!0),o(Ie).visible?(i(),le(Ju,{key:22,visible:o(Ie).visible,fromCommit:o(Ie).fromCommit,loading:o(Ie).loading,error:o(Ie).error,onClose:g[33]||(g[33]=Me=>o(Ie).visible=!1),onConfirm:Nt},null,8,["visible","fromCommit","loading","error"])):L("",!0),o(He).visible?(i(),le(jn,{key:23,title:"Create Branch from Stash",visible:o(He).visible,loading:o(He).loading,error:o(He).error,confirmLabel:"Create Branch",onClose:g[36]||(g[36]=Me=>o(He).visible=!1),onConfirm:g[37]||(g[37]=Me=>it(o(je)))},{default:Ke(()=>[r("div",xm,[r("p",bm,[g[62]||(g[62]=$e(" Create a new branch from ",-1)),r("span",ym,"stash@"+_("{")+_(o(He).stashIndex)+_("}"),1)]),Re(r("input",{"onUpdate:modelValue":g[34]||(g[34]=Me=>Oe(je)?je.value=Me: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:g[35]||(g[35]=mn(Me=>it(o(je)),["enter"]))},null,544),[[vt,o(je)]])])]),_:1},8,["visible","loading","error"])):L("",!0),o(pe).visible?(i(),le(Xd,{key:24,visible:o(pe).visible,loading:o(pe).loading,error:o(pe).error,onClose:g[38]||(g[38]=Me=>o(pe).visible=!1),onConfirm:Ue},null,8,["visible","loading","error"])):L("",!0),o(Ye).visible?(i(),le(Zd,{key:25,visible:o(Ye).visible,loading:o(Ye).loading,error:o(Ye).error,onClose:g[39]||(g[39]=Me=>o(Ye).visible=!1),onConfirm:Ft},null,8,["visible","loading","error"])):L("",!0),o(st).visible?(i(),le(ed,{key:26,visible:o(st).visible,loading:o(st).loading,error:o(st).error,onClose:g[40]||(g[40]=Me=>o(st).visible=!1),onConfirm:Je},null,8,["visible","loading","error"])):L("",!0),(i(),le(Zt,{to:"body"},[K(hn,{name:"fade"},{default:Ke(()=>[o(Ht).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:St({left:`${o(Ht).x}px`,top:`${o(Ht).y-40}px`})}," Copied! ",4)):L("",!0)]),_:1})])),(i(),le(Zt,{to:"body"},[K(hn,{name:"fade"},{default:Ke(()=>[o(t).operationError?(i(),u("div",wm,[K(o(kn),{class:"w-4 h-4 flex-shrink-0"}),r("span",km,_(o(t).operationError),1),r("button",{class:"flex-shrink-0 p-0.5 hover:bg-white/20 rounded transition-colors",onClick:g[41]||(g[41]=Me=>o(t).clearOperationError()),"aria-label":"Dismiss error"},[K(o(xt),{class:"w-3.5 h-3.5"})])])):L("",!0)]),_:1})]))])}}}),$m=br(Cm,[["__scopeId","data-v-7f64563b"]]),Sm=Rs("/app-logo.svg");function _m(e){return/^\/speckit\.(clarify|plan|tasks|implement)(\s|$)/.test(e)}function Mm(e=Date.now,n=Math.random){return`req-${e()}-${n().toString(36).slice(2,8)}`}function Ho(e=Date.now){return`session-${e()}`}function Dr(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 $s(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 Ir(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 Ss=gr("autoMode",()=>{const e=$(!1),n=$(null),t=$(!1),a=$(null);let s=null,l=null;const c=new Map,m=N(()=>n.value?.state==="active"),p=N(()=>n.value?.tasks??[]),d=N(()=>p.value.filter(ee=>ee.state==="queued").length),S=N(()=>p.value.find(ee=>ee.state==="running")??null),T=N(()=>p.value.filter(ee=>ee.state==="completed").length),b=N(()=>p.value.filter(ee=>ee.state==="failed").length),y=N(()=>p.value.length);async function x(){if(typeof window<"u")try{(await $fetch("/api/settings"))?.autoModeEnabled===!0&&(e.value=!0)}catch{}try{const ee=await $fetch("/api/auto-mode/status");e.value=ee.enabled,n.value=ee.session}catch{}ae()}async function A(){t.value=!0,a.value=null;try{const Z=Qn().autoModeConcurrency,H=await $fetch("/api/auto-mode/toggle",{method:"POST",body:{enabled:!e.value,concurrency:Z}});H.success?(e.value=H.enabled,fe(H.enabled)):a.value=H.error||"Toggle failed"}catch(ee){a.value=ee instanceof Error?ee.message:String(ee)}finally{t.value=!1}}function j(ee){switch(ee.type){case"auto_mode_status":e.value=ee.enabled,n.value=ee.session,fe(ee.enabled);break;case"auto_mode_task_update":if(n.value){const Z=n.value.tasks.findIndex(H=>H.featureId===ee.task.featureId);Z>=0&&(n.value.tasks[Z]=ee.task)}ee.task.state==="running"&&ee.task.worktreePath&&ee.task.worktreeBranch&&re(ee.task);break;case"auto_mode_error":a.value=ee.error;break;case"auto_mode_step_start":q(ee.featureId,ee.step);break;case"auto_mode_step_complete":te(ee.featureId);break;case"auto_mode_message":U(ee.featureId,ee.sdkMessage);break}}function B(ee){return wt().findConversationByFeature(ee)}function q(ee,Z){if(typeof window>"u")return;const H=wt(),z=B(ee);if(!z)return;const O={id:mr(),role:"user",content:`/speckit.${Z} ${ee}`,timestamp:new Date().toISOString()};H.addMessage(O,z.id);const W={id:mr(),role:"assistant",content:"",timestamp:new Date().toISOString(),status:"streaming"};H.addMessage(W,z.id),c.set(ee,W.id),H.startConversationStreaming(z.id),H.saveConversation(z.id,!1)}function te(ee){if(typeof window>"u")return;const Z=wt(),H=B(ee);if(!H)return;const z=c.get(ee);z&&(Z.updateMessage(z,{status:"complete"},H.id),c.delete(ee)),Z.endConversationStreaming(H.id),Z.saveConversation(H.id,!0)}function U(ee,Z){if(typeof window>"u")return;const H=wt(),z=B(ee);if(!z)return;const O=c.get(ee);if(O){if(Z.type==="assistant"&&Z.message?.content){for(const W of Z.message.content)if(W.type==="text"&&W.text)H.appendToMessageWithSave(O,W.text,z.id);else if(W.type==="tool_use"&&W.name){const v=W.input?$s(W.input):"",h=`
68
-
69
- ▶ **${W.name}** ${v}
70
- `;H.appendToMessageWithSave(O,h,z.id)}}if(Z.type==="tool_result"||Z.type==="user"){const W=Z.message?.content||Z.content;if(Array.isArray(W)){for(const v of W)if(v.type==="tool_result"&&v.content){const h=typeof v.content=="string"?v.content:Array.isArray(v.content)?v.content.filter(M=>M.type==="text").map(M=>M.text).join(""):"";if(h){const M=h.slice(0,300),G=h.length>300?"...":"",oe=v.is_error?"✗ Error:":"✓";H.appendToMessageWithSave(O,`${oe} ${M}${G}
71
- `,z.id)}}}}}}function re(ee){if(typeof window>"u")return;const Z=wt(),H=Z.findConversationByFeature(ee.featureId);if(H){const W=Z.conversations.find(v=>v.id===H.id);W&&(W.autoMode||(W.autoMode=!0),ee.worktreePath&&!W.worktreePath&&(W.worktreePath=ee.worktreePath,W.worktreeBranch=ee.worktreeBranch,W.baseBranch=ee.baseBranch,W.cwd=ee.worktreePath,W.hasWorktree=!0),Z.saveAllConversations());return}const O={id:zo(),title:`Auto: ${ee.featureId}`,messages:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),cwd:ee.worktreePath||"",featureId:ee.featureId,autoMode:!0,worktreePath:ee.worktreePath,worktreeBranch:ee.worktreeBranch,baseBranch:ee.baseBranch,hasWorktree:!0};Z.addAutoModeConversation(O)}function ae(){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=H=>{try{const z=JSON.parse(H.data);j(z)}catch{}},s.onclose=()=>{s=null,l=setTimeout(()=>ae(),5e3)},s.onerror=()=>{}}function ue(){l&&(clearTimeout(l),l=null),s&&(s.close(),s=null)}function fe(ee){typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{autoModeEnabled:ee}}).catch(Z=>{console.error("Failed to persist autoModeEnabled:",Z)})}return{enabled:e,session:n,loading:t,error:a,isActive:m,tasks:p,queuedCount:d,runningTask:S,completedCount:T,failedCount:b,totalCount:y,initialize:x,toggle:A,disconnectWebSocket:ue}}),Tm=["disabled"],Am=_e({__name:"AutoModeToggle",setup(e){const n=Ss();return ct(()=>{n.initialize()}),(t,a)=>(i(),u("button",{type:"button",class:ye(["flex items-center gap-1.5 px-2 py-1 rounded text-xs font-mono 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())},[K(o(Kr),{class:ye(["h-4 w-4",{"animate-pulse":o(n).isActive}])},null,8,["class"]),a[1]||(a[1]=r("span",null,"Auto",-1)),o(n).enabled?(i(),u("span",{key:0,class:ye(["inline-block w-1.5 h-1.5 rounded-full bg-retro-yellow",{"animate-pulse":o(n).isActive}])},null,2)):L("",!0)],10,Tm))}}),Bm={class:"flex items-start justify-between gap-2"},Em={class:"flex-1 min-w-0"},Rm={class:"flex items-center gap-2"},Pm={class:"font-mono text-sm text-retro-text truncate"},Dm={class:"text-sm font-mono text-retro-muted mt-1 truncate"},Im={class:"flex items-center gap-1 flex-shrink-0"},Lm={key:0,class:"text-[11px] font-mono text-retro-muted mr-1",title:"Completed tasks / total tasks"},Nm={key:1,class:"w-2 h-2 rounded-full bg-retro-green",title:"spec"},Fm={key:2,class:"w-2 h-2 rounded-full bg-retro-cyan",title:"plan"},Hm={key:3,class:"w-2 h-2 rounded-full bg-retro-yellow",title:"tasks"},Om={class:"flex flex-wrap items-center justify-between gap-1 mt-2"},Um={key:0,class:"flex items-center gap-1"},jm=["title","disabled","onClick"],zm=_e({__name:"FeatureCard",props:{feature:{},skills:{},isActive:{type:Boolean}},emits:["select","cascade","openChat","skill"],setup(e,{emit:n}){const t={DocumentCheckIcon:na,PuzzlePieceIcon:$o,DocumentMagnifyingGlassIcon:oa,WrenchScrewdriverIcon:va,SparklesIcon:wr,BeakerIcon:Ks,ShieldCheckIcon:as,CommandLineIcon:ta,CpuChipIcon:ns,LightBulbIcon:ua},a=e,s=n,l=wt();function c(b){return t[b]||$o}function m(b){return b.prerequisites.every(y=>a.feature.files.some(x=>x.filename===y))}function p(b){return b.prerequisites.filter(y=>!a.feature.files.some(x=>x.filename===y))}function d(b){return m(b)?`${b.name} (Shift+click: new conversation)`:`Requires: ${p(b).join(", ")}`}const S=N(()=>{const b=l.findConversationByFeature(a.feature.id);return b?l.isConversationStreaming(b.id):!1}),T=N(()=>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(b,y)=>(i(),u("button",{type:"button",class:ye(["w-full p-3 text-left rounded-lg border transition-all duration-200 group",o(T)]),onClick:y[6]||(y[6]=x=>s("select",e.feature.id))},[r("div",Bm,[r("div",Em,[r("div",Rm,[K(o(Nn),{class:ye(["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",Pm,_(e.feature.id),1)]),r("p",Dm,_(e.feature.name),1)]),r("div",Im,[e.feature.hasTasks?(i(),u("span",Lm,_(e.feature.completedTasks)+"/"+_(e.feature.totalTasks),1)):L("",!0),e.feature.hasSpec?(i(),u("span",Nm)):L("",!0),e.feature.hasPlan?(i(),u("span",Fm)):L("",!0),e.feature.hasTasks?(i(),u("span",Hm)):L("",!0)])]),r("div",Om,[e.feature.hasSpec?(i(),u("div",Um,[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:y[0]||(y[0]=pt(x=>s("cascade",x,e.feature.id,"clarify"),["stop"]))},[K(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:y[1]||(y[1]=pt(x=>s("cascade",x,e.feature.id,"plan"),["stop"]))},[K(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:y[2]||(y[2]=pt(x=>s("cascade",x,e.feature.id,"tasks"),["stop"]))},[K(o(os),{class:"h-3.5 w-3.5"})])):L("",!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:y[3]||(y[3]=pt(x=>s("cascade",x,e.feature.id,"implement"),["stop"]))},[K(o(ha),{class:"h-3.5 w-3.5"})])):L("",!0),e.feature.hasTasks?(i(),u("button",{key:2,type:"button",class:"flex items-center justify-center p-1 bg-retro-orange/20 text-retro-orange rounded hover:bg-retro-orange/30 transition-colors",title:"Analyze spec/plan/tasks consistency (Shift+click: new conversation)",onClick:y[4]||(y[4]=pt(x=>s("cascade",x,e.feature.id,"analyze"),["stop"]))},[K(o(Xs),{class:"h-3.5 w-3.5"})])):L("",!0),e.skills.length>0?(i(),u(he,{key:3},[y[7]||(y[7]=r("div",{class:"w-px h-4 bg-retro-border mx-0.5"},null,-1)),(i(!0),u(he,null,Ee(e.skills,x=>(i(),u("button",{key:x.id,type:"button",class:ye(["flex items-center justify-center p-1 rounded transition-colors",[m(x)&&!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:d(x),disabled:!m(x)||o(S),onClick:pt(A=>s("skill",A,e.feature.id,x.id),["stop"])},[(i(),le(In(c(x.icon)),{class:"h-3.5 w-3.5"}))],10,jm))),128))],64)):L("",!0)])):L("",!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:y[5]||(y[5]=pt(x=>s("openChat",x,e.feature.id),["stop"]))},[K(o(Qo),{class:"h-3.5 w-3.5"})])):L("",!0)])],2))}});function _r(){function e(n){const t=ze.parse(n);return Cs.sanitize(t)}return{renderMarkdown:e}}const Vm={class:"fixed inset-0 z-50 flex items-center justify-center"},Wm={class:"relative w-[96vw] h-[94vh] bg-retro-black border border-retro-border rounded-lg shadow-2xl flex flex-col overflow-hidden"},Gm={class:"flex-shrink-0 flex items-center justify-between px-4 h-12 border-b border-retro-border bg-retro-dark"},qm={class:"flex items-center gap-3 min-w-0"},Zm={class:"text-sm font-mono font-bold text-retro-cyan truncate"},Km={class:"text-xs font-mono text-retro-subtle"},Ym={class:"flex items-center gap-2"},Xm=["disabled"],Qm={key:0,class:"flex-shrink-0 flex items-center gap-0 border-b border-retro-border bg-retro-dark overflow-x-auto"},Jm=["onClick"],eh={class:"flex-1 min-h-0 overflow-y-auto"},th={key:0,class:"flex items-center justify-center py-12"},nh={key:1,class:"flex flex-col items-center justify-center py-12 text-center px-4"},rh={class:"text-sm font-mono text-retro-red"},oh={key:2,class:"flex flex-col items-center justify-center py-12 text-center"},sh={key:3,class:"h-full flex flex-col"},ah=["innerHTML"],ih=_e({__name:"SpecViewerModal",props:{feature:{}},emits:["close"],setup(e,{emit:n}){const t=e,a=n,s=Hn(),{renderMarkdown:l}=_r(),c=$(t.feature.files[0]?.filename||""),m=$(""),p=$(!1),d=$(null),S=$(!1),T=$(""),b=$(!1);async function y(){if(c.value){p.value=!0,d.value=null;try{const U=`/api/specs/${t.feature.id}/${c.value}`,re=await $fetch(U);m.value=re.content}catch{d.value="Failed to load file",m.value=""}finally{p.value=!1}}}const x=N(()=>m.value?l(m.value):"");function A(U){S.value&&(S.value=!1),c.value=U,y()}function j(){T.value=m.value,S.value=!0}function B(){S.value=!1,T.value=""}async function q(){b.value=!0;try{const U=`/api/specs/${t.feature.id}/${c.value}`;await $fetch(U,{method:"PUT",body:{content:T.value}}),m.value=T.value,S.value=!1,s.success("Saved")}catch{s.error("Failed to save")}finally{b.value=!1}}function te(U){U.key==="Escape"&&(S.value?B():a("close"))}return ct(()=>{window.addEventListener("keydown",te),y()}),gt(()=>{window.removeEventListener("keydown",te)}),(U,re)=>(i(),le(Zt,{to:"body"},[r("div",Vm,[r("div",{class:"absolute inset-0 bg-black/80",onClick:re[0]||(re[0]=ae=>a("close"))}),r("div",Wm,[r("div",Gm,[r("div",qm,[r("span",Zm,_(e.feature.name),1),r("span",Km,_(e.feature.id),1)]),r("div",Ym,[o(S)?(i(),u(he,{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(b),onClick:q},_(o(b)?"Saving...":"Save"),9,Xm)],64)):o(m)&&!o(p)&&!o(d)?(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:j},[K(o(eo),{class:"h-4 w-4"})])):L("",!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:re[1]||(re[1]=ae=>a("close"))},[K(o(xt),{class:"h-4 w-4"})])])]),e.feature.files.length>0?(i(),u("div",Qm,[(i(!0),u(he,null,Ee(e.feature.files,ae=>(i(),u("button",{key:ae.filename,type:"button",class:ye(["px-4 py-2 text-xs font-mono border-b-2 transition-colors whitespace-nowrap",[o(c)===ae.filename?"border-retro-cyan text-retro-cyan bg-retro-black":"border-transparent text-retro-muted hover:text-retro-text hover:bg-retro-panel"]]),onClick:ue=>A(ae.filename)},_(ae.label),11,Jm))),128))])):L("",!0),r("div",eh,[o(p)?(i(),u("div",th,[...re[3]||(re[3]=[r("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading...",-1)])])):o(d)?(i(),u("div",nh,[r("p",rh,_(o(d)),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:y}," Retry ")])):e.feature.files.length===0?(i(),u("div",oh,[...re[4]||(re[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",sh,[Re(r("textarea",{"onUpdate:modelValue":re[2]||(re[2]=ae=>Oe(T)?T.value=ae: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),[[vt,o(T)]])])):(i(),u("div",{key:4,class:"spec-markdown p-6 text-sm font-mono text-retro-text max-w-4xl mx-auto",innerHTML:o(x)},null,8,ah))])])])]))}}),lh={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"},ch={class:"flex items-center justify-between px-4 py-2 border-b border-retro-border/60 bg-retro-dark/70"},uh={class:"flex items-center gap-2 px-4 py-3 border-b border-retro-border/60"},dh={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"},fh={class:"flex items-center gap-3"},mh={class:"inline-flex items-center gap-1"},hh={key:0},ph={key:0,class:"truncate max-w-[42%]"},vh={class:"max-h-[58vh] overflow-y-auto"},gh={key:0,class:"px-4 py-3 text-xs font-mono text-retro-subtle animate-pulse"},xh={key:1,class:"px-4 py-4 text-xs font-mono text-retro-subtle"},bh={key:2,class:"px-4 py-4 text-xs font-mono text-retro-subtle"},yh={key:3,class:"px-4 py-3 text-xs font-mono text-retro-red"},wh={key:4,class:"py-2 px-2 space-y-2"},kh=["onMouseenter","onClick"],Ch={class:"flex items-center justify-between gap-3 text-[10px] font-mono"},$h={class:"text-retro-cyan/90"},Sh={class:"text-retro-subtle truncate"},_h=["innerHTML"],Mh={key:5,class:"px-4 py-3 text-xs font-mono text-retro-subtle"},Th={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"},Ah={key:0,class:"text-retro-yellow"},Bh={key:0,class:"px-4 pb-3 text-xs font-mono text-retro-red flex items-center gap-2"},Eh=400,Rh=_e({__name:"FeatureSearchModal",props:{availableFeatureIds:{}},emits:["close","select"],setup(e,{emit:n}){const t=e,a=n,{renderMarkdown:s}=_r(),l=$(""),c=$(!1),m=$(!1),p=$(null),d=$(null),S=$(null),T=$(null),b=$([]),y=$(-1),x=$(null),A=$([]);let j=null,B=0;const q=N(()=>l.value.trim()),te=N(()=>{const v=q.value.toLowerCase().split(/\s+/).map(h=>h.trim()).filter(h=>h.length>=2);return Array.from(new Set(v)).slice(0,8)}),U=N(()=>p.value||d.value?"error":!q.value&&m.value?"empty-query":b.value.length>0?"results":m.value&&!c.value?"no-results":"idle");function re(v){return{featureId:v.chunk.featureId,sourcePath:v.chunk.sourcePath,headingHierarchy:v.chunk.headingHierarchy,snippet:v.chunk.content,matchType:v.matchType,score:v.score,lineStart:v.chunk.lineStart,lineEnd:v.chunk.lineEnd}}async function ae(){const v=q.value;if(d.value=null,!v){m.value=!0,S.value=null,T.value=null,p.value=null,b.value=[],y.value=-1;return}const h=++B;m.value=!0,p.value=null,c.value=!0;try{const M=await $fetch("/api/specs/search",{query:{q:v,mode:"keyword",limit:20}});if(h!==B)return;S.value=M.warning??null,T.value=M.searchTime,b.value=M.results.map(re),y.value=b.value.length>0?0:-1}catch(M){if(h!==B)return;const G=M instanceof Error?M.message:"Failed to search specs";p.value=G,T.value=null,b.value=[],y.value=-1}finally{h===B&&(c.value=!1)}}Be(l,()=>{p.value=null,d.value=null,j&&clearTimeout(j),j=setTimeout(()=>{ae()},Eh)}),Be(b,()=>{A.value=[]}),Be(y,async v=>{v<0||(await qt(),A.value[v]?.scrollIntoView({block:"nearest"}))});function ue(){a("close")}function fe(v){const h=b.value[v];if(h){if(!t.availableFeatureIds.includes(h.featureId)){d.value="Feature unavailable";return}a("select",h.featureId),a("close")}}function ee(v){if(b.value.length===0)return;if(y.value<0){y.value=0;return}const h=y.value+v;if(h<0){y.value=b.value.length-1;return}if(h>=b.value.length){y.value=0;return}y.value=h}function Z(v){if(v.key==="ArrowDown"){v.preventDefault(),ee(1);return}if(v.key==="ArrowUp"){v.preventDefault(),ee(-1);return}if(v.key==="Enter"){v.preventDefault(),y.value>=0&&fe(y.value);return}v.key==="Escape"&&(v.preventDefault(),ue())}function H(v){v.target===v.currentTarget&&ue()}function z(v,h){if(!h){A.value[v]=null;return}if(h instanceof HTMLElement){A.value[v]=h;return}const M=h.$el;A.value[v]=M instanceof HTMLElement?M:null}function O(){ae()}function W(v){const h=v.trim();if(!h)return"";const M=h.length>700?`${h.slice(0,700)}...`:h,G=s(M);if(te.value.length===0)return G;const oe=te.value.map(I=>I.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),ne=new RegExp(`(${oe.join("|")})`,"gi");return G.split(/(<[^>]+>)/g).map(I=>I.startsWith("<")?I:I.replace(ne,"<mark>$1</mark>")).join("")}return ct(()=>{qt(()=>{x.value?.focus()})}),gt(()=>{j&&clearTimeout(j)}),(v,h)=>(i(),le(Zt,{to:"body"},[K(hn,{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:Ke(()=>[r("div",{class:"fixed inset-0 z-50 flex items-start justify-center pt-16 px-4 bg-black/75 backdrop-blur-[1px]",onClick:H},[K(hn,{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:Ke(()=>[r("div",lh,[r("div",ch,[h[1]||(h[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:ue},[K(o(xt),{class:"h-4 w-4"})])]),r("div",uh,[K(o(An),{class:"h-4 w-4 text-retro-cyan"}),Re(r("input",{ref_key:"inputRef",ref:x,"onUpdate:modelValue":h[0]||(h[0]=M=>Oe(l)?l.value=M: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),[[vt,o(l)]]),h[2]||(h[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",dh,[r("div",fh,[r("span",mh,[K(o(Nn),{class:"h-3.5 w-3.5"}),$e(" "+_(o(b).length)+" results ",1)]),o(T)!==null?(i(),u("span",hh,_(o(T))+"ms",1)):L("",!0)]),o(q)?(i(),u("span",ph,"“"+_(o(q))+"”",1)):L("",!0)]),r("div",vh,[o(c)?(i(),u("div",gh," Searching... ")):o(U)==="empty-query"?(i(),u("div",xh," Enter a search term to search across all feature specs. ")):o(U)==="no-results"?(i(),u("div",bh," No matching features found. ")):o(U)==="error"?(i(),u("div",yh,[r("p",null,_(o(d)||o(p)),1),o(p)?(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:O}," Retry ")):L("",!0)])):o(b).length>0?(i(),u("ul",wh,[(i(!0),u(he,null,Ee(o(b),(M,G)=>(i(),u("li",{key:`${M.featureId}:${M.sourcePath}:${G}`},[r("button",{type:"button",ref_for:!0,ref:oe=>z(G,oe),class:ye(["w-full text-left px-4 py-3 min-h-[132px] rounded-lg border border-retro-border/40 border-l-2 transition-colors",G===o(y)?"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:oe=>y.value=G,onClick:oe=>fe(G)},[r("div",Ch,[r("span",$h,_(M.featureId),1),r("span",Sh,_(M.sourcePath)+":"+_(M.lineStart)+"-"+_(M.lineEnd),1)]),r("div",{class:"snippet-markdown mt-2 max-h-20 overflow-hidden text-xs text-retro-text",innerHTML:W(M.snippet)},null,8,_h),h[3]||(h[3]=r("div",{class:"mt-2 text-[10px] font-mono text-retro-subtle"}," Select feature ",-1))],42,kh)]))),128))])):(i(),u("div",Mh," Start typing to search. "))]),r("div",Th,[h[4]||(h[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",Ah,_(o(S)),1)):L("",!0)]),o(d)?(i(),u("div",Bh,[K(o(kn),{class:"h-3.5 w-3.5"}),r("span",null,_(o(d)),1)])):L("",!0)])]),_:1})])]),_:1})]))}}),Ph=br(Rh,[["__scopeId","data-v-5199b408"]]);function Dh(e){if(!e||typeof e!="object")return null;const n=e,t=["session_id","sessionId","conversation_id","conversationId","thread_id","threadId"];for(const s of t){const l=n[s];if(typeof l=="string"&&l.length>0)return l}const a=n.response;if(a&&typeof a=="object"&&!Array.isArray(a)){const s=a;for(const l of t){const c=s[l];if(typeof c=="string"&&c.length>0)return c}}return null}const lt=new Map,un=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=wt(),n=Qn();function t(){return typeof document>"u"||typeof document.hasFocus!="function"?!1:document.visibilityState==="visible"&&document.hasFocus()}function a(v){const M=e.conversations.find(G=>G.id===v)?.title?.trim()||"Chat";return new Notification("Spec Cat",{body:`${M} 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(h){console.warn("[useChatStream] Failed to request browser notification permission:",h)}}}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 m(v){c(v),v.lastMessageTime=Date.now(),v.healthCheckInterval=ho(()=>{const h=v.conversationId;if(v.ws.readyState!==WebSocket.OPEN){console.warn(`[useChatStream] Health check: WebSocket not open for ${h}`),c(v),e.isConversationStreaming(h)&&(S(v.currentMessageId,h,"error"),e.updateMessage(v.currentMessageId,{status:"error"},h),e.setSessionError("Connection lost during streaming",h),e.endSession(h),e.endConversationStreaming(h)),lt.delete(h);return}if(e.isConversationStreaming(h)){const M=Date.now()-v.lastMessageTime;M>Lh&&(console.warn(`[useChatStream] Health check: streaming timeout for ${h} (${Math.round(M/1e3)}s)`),c(v),S(v.currentMessageId,h,"error"),e.updateMessage(v.currentMessageId,{status:"error"},h),e.setSessionError("Streaming timed out — no response from server for 3 minutes",h),e.endSession(h),e.endConversationStreaming(h),v.ws.close(),lt.delete(h))}},Ih)}function p(v,h){return e.conversations.find(G=>G.id===v)?.messages.find(G=>G.id===h)?.status}function d(v,h=!0){const M=lt.get(v);M&&(c(M),h&&M.ws.readyState===WebSocket.OPEN&&M.ws.close(),lt.delete(v))}function S(v,h,M){const oe=e.conversations.find(ne=>ne.id===h)?.messages.find(ne=>ne.id===v);if(oe?.contentBlocks)for(const ne of oe.contentBlocks)ne.type==="tool_use"&&(ne.status==="running"||ne.status==="pending")&&e.updateBlockById(v,ne.id,I=>{I.type==="tool_use"&&(I.status=M)},h)}async function T(v){try{(await b(v)).send(JSON.stringify({type:"reset_context"})),e.clearProviderSession(v),console.log("[useChatStream] Context reset requested for conversation:",v)}catch(h){throw console.error("[useChatStream] Failed to reset context:",h),h}}function b(v){return new Promise((h,M)=>{const G=lt.get(v);if(G&&G.ws.readyState===WebSocket.OPEN){h(G.ws);return}G&&(G.ws.close(),lt.delete(v));const oe=l(),ne=new WebSocket(oe),I={ws:ne,currentMessageId:"",conversationId:v,activeTools:new Map,currentTextBlockId:null,currentThinkingBlockId:null,healthCheckInterval:null,lastMessageTime:Date.now(),lastServerError:null,lastSocketError:null};lt.set(v,I),ne.onopen=()=>{h(ne)},ne.onerror=w=>{console.error(`[useChatStream] WebSocket error for conversation ${v}:`,w);const C=lt.get(v);C&&(C.lastSocketError="Browser reported a WebSocket transport error (network/proxy/server)"),e.isConversationStreaming(v)&&(C?.currentMessageId&&(S(C.currentMessageId,v,"error"),e.updateMessage(C.currentMessageId,{status:"error"},v)),e.setSessionError("Connection error during streaming",v),e.endSession(v),e.endConversationStreaming(v)),lt.delete(v),M(new Error("WebSocket connection failed. Server may be unavailable."))},ne.onclose=w=>{const C=lt.get(v);if(C&&c(C),lt.delete(v),un.delete(v),e.isConversationStreaming(v)){C?.currentMessageId&&(S(C.currentMessageId,v,"error"),e.updateMessage(C.currentMessageId,{status:"error"},v));const V=Fh(w,C);e.setSessionError(`Connection closed: ${V} (code: ${w.code})`,v),e.endSession(v),e.endConversationStreaming(v)}},ne.onmessage=w=>{j(w.data,v)}})}async function y(v,h=3){for(let M=0;M<h;M++){const G=e.conversations.find(oe=>oe.id===v);if(G)return G;M<h-1&&await new Promise(oe=>setTimeout(oe,100))}console.error("[useChatStream] Conversation not found after retries:",v)}function x(v,h){return`${v}:${h}`}function A(v,h){const M=e.conversations.find(oe=>oe.id===v);if(!M)return null;const G=M.messages.findIndex(oe=>oe.id===h);if(G<=0)return null;for(let oe=G-1;oe>=0;oe--){const ne=M.messages[oe];if(ne.role==="user"&&ne.content.trim().length>0)return ne.content}return null}async function j(v,h){const M=lt.get(h);if(M){M.lastMessageTime=Date.now();try{e.pushDebugEvent({direction:"in",channel:"ws",eventType:"ws.raw",payload:v},h);const G=JSON.parse(v);if(e.pushDebugEvent({direction:"in",channel:"ws",eventType:G.type,payload:G},h),G.type==="error"){console.error(`[useChatStream] Server error for ${h}:`,G.error);const oe=G.error||"Unknown server error";M.lastServerError=oe;const ne=/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(oe);if(/state db missing rollout path for thread/i.test(oe)&&!ne){const w=x(h,M.currentMessageId);if(!ur.has(w)){const C=A(h,M.currentMessageId);if(C){ur.add(w),e.setProviderSessionId("",h),q(M.currentMessageId,`
72
-
73
- > **Session Reset**: Codex resume state was corrupted. Retrying once with a fresh session...
74
-
75
- `,h);try{const V=e.conversations.find(ce=>ce.id===h),Q=Dr(V);await re(C,M.currentMessageId,h,Q);return}catch(V){console.error(`[useChatStream] Rollout-path recovery retry failed for ${h}:`,V)}}}}c(M),S(M.currentMessageId,h,"error"),e.updateMessage(M.currentMessageId,{status:"error"},h),/state db missing rollout path for thread/i.test(oe)&&e.setProviderSessionId("",h),ur.delete(x(h,M.currentMessageId)),e.setSessionError(oe,h),e.endSession(h),e.endConversationStreaming(h),fe(h),e.saveConversation(h,!0),d(h);return}if(G.type==="done"){c(M);const oe=p(h,M.currentMessageId);if(ur.delete(x(h,M.currentMessageId)),G.denied){S(M.currentMessageId,h,"error"),e.updateMessage(M.currentMessageId,{status:"stopped"},h),e.endSession(h),e.endConversationStreaming(h),fe(h),e.clearPendingPermission(h),M.activeTools.clear(),e.saveConversation(h,!0),d(h);return}if(oe==="error"||oe==="stopped"){S(M.currentMessageId,h,"error"),e.endSession(h),e.endConversationStreaming(h),fe(h),e.clearPendingPermission(h),M.activeTools.clear(),e.saveConversation(h,!0),d(h);return}S(M.currentMessageId,h,"complete"),e.completeMessageWithSave(M.currentMessageId,h),e.endSession(h),e.endConversationStreaming(h),s(h);const ne=await y(h),I=ne?.hasWorktree&&ne.worktreePath?$fetch("/api/chat/worktree-commit",{method:"POST",body:{worktreePath:ne.worktreePath,conversationId:h,previousBranch:ne.worktreeBranch}}).then(C=>ne.previewBranch&&ne.worktreePath?$fetch("/api/chat/preview-sync",{method:"POST",body:{previewBranch:ne.previewBranch,worktreePath:ne.worktreePath}}).then(V=>{if(!V.success)throw new Error(V.error||"Unknown preview sync failure");return C}):C).then(async C=>{if(C?.success&&C.currentBranch!==ne.worktreeBranch){const V=ne.worktreeBranch||"unknown";e.updateWorktreeBranch(h,C.currentBranch);const Q=await e.syncConversationFeatureFromBranch(h),ce=C.deletedPreviousBranch?` and deleted \`${V}\``:"",Te=Q?` and linked to feature \`${Q}\``:"";q(M.currentMessageId,`
76
-
77
- > **Branch changed**: AI switched from \`${V}\` to \`${C.currentBranch}\`${ce}${Te}
78
-
79
- `,h)}else C?.success&&ne.worktreeBranch&&e.updateWorktreeBranch(h,ne.worktreeBranch);return e.saveConversation(h,!1),C}).catch(C=>{console.warn("[useChatStream] Auto-commit/preview-sync failed:",C)}):Promise.resolve(),w=un.get(h);if(w&&w.queue.length>0){const C=w.queue.shift(),V=w.featureId;I.then(()=>{setTimeout(()=>{ee(h,V,C)},1500)}),w.queue.length===0&&un.delete(h)}e.clearPendingPermission(h),e.saveConversation(h,!0),M.activeTools.clear(),d(h),un.delete(h);return}if(G.type==="pong")return;if(G.type==="session_reset"){console.warn(`[useChatStream] Session reset for ${h}:`,G.reason),e.setProviderSessionId("",h),q(M.currentMessageId,`
80
-
81
- > **Session Reset**: Previous session could not be resumed. Retrying with a fresh session...
82
-
83
- `,h);return}if(G.type==="worktree_recovered"){console.log(`[useChatStream] Worktree recovered for ${h}`),q(M.currentMessageId,`
84
-
85
- > **Worktree recovered**: The work directory was restored after a system restart.
86
-
87
- `,h);return}if(G.type==="context_reset"){console.log(`[useChatStream] Context reset confirmed for ${h}`);return}if(G.type==="aborted"){console.log(`[useChatStream] Abort confirmed for ${h}`);return}if(G.type==="permission_request"){c(M),e.endConversationStreaming(h);const oe=Ir(G.description||"",G.tool||"Permission");e.setPendingPermission(oe,h);let ne=`
88
-
89
- **Permission Required**: ${oe.tool}`;oe.filePath&&(ne+=` - ${oe.filePath}`),q(M.currentMessageId,ne+`
90
- `,h);return}if(G.type==="permission_prompt"&&G.text){c(M),e.endConversationStreaming(h);const oe=Ir(G.text,"Permission");e.setPendingPermission(oe,h);const ne=`
91
-
92
- **${oe.tool}**: ${oe.filePath||oe.command||oe.description}
93
- `;q(M.currentMessageId,ne,h);return}G.type==="provider_json"&&G.data&&U(G.data,h)}catch(G){console.error(`[useChatStream] Failed to parse WebSocket message for ${h}:`,G,"Raw data:",v?.slice(0,200)),S(M.currentMessageId,h,"error"),e.updateMessage(M.currentMessageId,{status:"error"},h),e.setSessionError(`Failed to parse server response: ${G instanceof Error?G.message:"Invalid JSON"}`,h),e.endSession(h),e.endConversationStreaming(h),fe(h),e.saveConversation(h,!0),d(h)}}}function B(v,h){e.initContentBlocks(v,h)}function q(v,h,M){B(v,M);const G={id:wn(),type:"text",text:h};e.appendContentBlockWithSave(v,G,M)}function te(v,h){return!!e.conversations.find(oe=>oe.id===h)?.messages.find(oe=>oe.id===v)?.contentBlocks?.some(oe=>oe.type==="session_init")}function U(v,h){const M=lt.get(h);if(!M)return;e.pushDebugEvent({direction:"in",channel:"provider",eventType:v.type,payload:v},h);const G=typeof v.type=="string"?v.type.toLowerCase():"",oe="subtype"in v&&typeof v.subtype=="string"?String(v.subtype).toLowerCase():"",I=G.includes("error")||G.includes("failed")||oe.startsWith("error")?null:Dh(v);if(I&&e.setProviderSessionId(I,h),v.type==="permission_request"){const C=v.permission,V={tool:C.tool,filePath:C.file_path||C.path,command:C.command,description:C.description,input:C};e.setPendingPermission(V,h);let Q=`
94
-
95
- **Permission Required**: ${C.tool}`;V.filePath?Q+=` - ${V.filePath}`:V.command&&(Q+=` - \`${V.command}\``),q(M.currentMessageId,Q+`
96
- `,h);return}if(v.type==="user"){const w=v,C=w.message?.content||w.content;if(C){for(const V of C)if(V.type==="tool_result"&&V.is_error&&V.content){const Q=V.content;if(Q.includes("requested permissions")||Q.includes("haven't granted")){const ce=Ir(Q,"Permission");e.setPendingPermission(ce,h);let Te=`
97
-
98
- **Permission Required**: ${ce.tool}`;ce.filePath?Te+=` - ${ce.filePath}`:ce.command&&(Te+=` - \`${ce.command}\``),q(M.currentMessageId,Te+`
99
- `,h);return}}}}if(v.type==="system"){const w=v;if(w.subtype==="init"&&w.model){B(M.currentMessageId,h);const C={id:wn(),type:"session_init",model:w.model,tools:w.tools||[],permissionMode:w.permissionMode||"",cwd:w.cwd||""};e.appendContentBlockWithSave(M.currentMessageId,C,h)}return}if(v.type==="stream_event"){const C=v.event;if(C.type==="content_block_start"&&C.content_block){const V=C.content_block;if(V.type==="text"){B(M.currentMessageId,h);const Q=wn(),ce={id:Q,type:"text",text:V.text||""};e.appendContentBlockWithSave(M.currentMessageId,ce,h),M.currentTextBlockId=Q}if(V.type==="thinking"){B(M.currentMessageId,h);const Q=wn(),ce={id:Q,type:"thinking",thinking:V.thinking||""};e.appendContentBlockWithSave(M.currentMessageId,ce,h),M.currentThinkingBlockId=Q}if((V.type==="tool_use"||V.type==="server_tool_use")&&V.id&&V.name){B(M.currentMessageId,h);const Q=wn(),ce={id:Q,type:"tool_use",toolUseId:V.id,name:V.name,input:{},inputSummary:"",status:"running"};e.appendContentBlockWithSave(M.currentMessageId,ce,h),M.activeTools.set(C.index??0,{blockId:Q,toolUseId:V.id,name:V.name,inputJson:""})}}if(C.type==="content_block_delta"&&C.delta&&(C.delta.text&&M.currentTextBlockId&&(e.updateBlockWithSave(M.currentMessageId,M.currentTextBlockId,V=>{V.type==="text"&&(V.text+=C.delta.text)},h,{syncContent:!1}),e.appendToMessage(M.currentMessageId,C.delta.text,h)),C.delta.thinking&&M.currentThinkingBlockId&&e.updateBlockWithSave(M.currentMessageId,M.currentThinkingBlockId,V=>{V.type==="thinking"&&(V.thinking+=C.delta.thinking)},h,{syncContent:!1}),C.delta.partial_json&&C.index!==void 0)){const V=M.activeTools.get(C.index);V&&(V.inputJson+=C.delta.partial_json)}if(C.type==="content_block_stop"&&(M.currentTextBlockId&&(M.currentTextBlockId=null),M.currentThinkingBlockId&&(M.currentThinkingBlockId=null),C.index!==void 0)){const V=M.activeTools.get(C.index);if(V){let Q={};try{Q=JSON.parse(V.inputJson)}catch{}if(V.name==="ExitPlanMode"){const ce={allowedPrompts:Q.allowedPrompts};e.setPendingPlanApproval(ce,h)}e.updateBlockWithSave(M.currentMessageId,V.blockId,ce=>{if(ce.type==="tool_use"){const Te=ce;Te.input=Q,Te.inputSummary=$s(Q),Te.status="pending"}},h)}}return}if(v.type==="tool_result"){const w=v;B(M.currentMessageId,h);const C=e.findToolUseBlock(M.currentMessageId,w.tool_use_id,h);C&&C.type==="tool_use"&&e.updateBlockById(M.currentMessageId,C.id,Q=>{Q.type==="tool_use"&&(Q.status=w.is_error?"error":"complete")},h);const V={id:wn(),type:"tool_result",toolUseId:w.tool_use_id,content:w.content||"",isError:!!w.is_error};e.appendContentBlockWithSave(M.currentMessageId,V,h),w.is_error&&console.warn("[useChatStream] Tool error:",w.content?.slice(0,500));return}if(v.type==="result"){const w=v;if((w.is_error||w.subtype==="error_max_turns"||w.subtype==="error_during_execution")&&(e.updateMessage(M.currentMessageId,{status:"error"},h),fe(h),w.subtype==="error_max_turns"?e.setSessionError("Maximum conversation turns reached. Please start a new conversation.",h):w.subtype==="error_during_execution"&&e.setSessionError("An error occurred during provider execution.",h),console.error("[useChatStream] Result error:",w.subtype)),w.subtype==="success"&&w.usage){B(M.currentMessageId,h);const C={id:wn(),type:"result_summary",totalCostUsd:w.total_cost_usd??0,durationMs:w.duration_ms??0,numTurns:w.num_turns??0,usage:{inputTokens:w.usage.input_tokens??0,outputTokens:w.usage.output_tokens??0,cacheCreationInputTokens:w.usage.cache_creation_input_tokens??0,cacheReadInputTokens:w.usage.cache_read_input_tokens??0}};e.appendContentBlockWithSave(M.currentMessageId,C,h)}}}async function re(v,h,M,G){if(typeof window>"u")return;const oe=Mm();try{const ne=await b(M),I=lt.get(M);I&&(I.currentMessageId=h,I.activeTools.clear(),I.currentTextBlockId=null,I.currentThinkingBlockId=null,m(I)),_m(v)&&e.setProviderSessionId("",M);const C=e.getProviderSessionId(M),V=e.conversations.find(Ae=>Ae.id===M),Q=V?.providerId||n.providerSelection.providerId||Wo,ce=V?.providerModelKey||n.providerSelection.modelKey||Vo;V&&(!V.providerId||!V.providerModelKey)&&(e.setConversationProviderSelection(M,Q,ce),e.saveConversation(M,!0));const Te={type:"chat",message:v,attachments:G?.attachments,requestId:oe,sessionId:C||void 0,permissionMode:e.permissionMode,conversationId:M,cwd:G?.cwd,worktreeBranch:G?.worktreeBranch,featureId:G?.featureId,providerId:Q,providerModelKey:ce};if(Q==="codex"&&!te(h,M)){B(h,M);const Ae=e.permissionMode==="bypass"||e.permissionMode==="auto",Ge={id:wn(),type:"session_init",model:ce,tools:Array.from({length:32},(me,P)=>`tool-${P+1}`),permissionMode:Ae?"bypassPermissions":e.permissionMode,cwd:G?.cwd||V?.cwd||""};e.appendContentBlockWithSave(h,Ge,M)}e.pushDebugEvent({direction:"out",channel:"ws",eventType:"chat",payload:Te},M),ne.send(JSON.stringify(Te))}catch(ne){e.updateMessage(h,{status:"error"},M),e.setSessionError(ne.message||"Connection failed",M),e.endSession(M),e.endConversationStreaming(M),e.saveConversation(M,!0),d(M)}}function ae(v,h){const M=h??e.activeConversationId;if(!M)return;const G=lt.get(M);if(!G||G.ws.readyState!==WebSocket.OPEN)return;const oe={type:"permission_response",allow:v};e.pushDebugEvent({direction:"out",channel:"ws",eventType:"permission_response",payload:oe},M),G.ws.send(JSON.stringify(oe)),v&&(e.startConversationStreaming(M),m(G));const ne=v?"Allowed":"Denied";q(G.currentMessageId,`${ne}
100
- `,M),e.clearPendingPermission(M)}function ue(v,h,M){un.set(h,{featureId:v,queue:[...M]})}function fe(v){v?un.delete(v):un.clear()}async function ee(v,h,M){e.activeConversationId!==v&&e.selectConversation(v);let G;if(M.startsWith("skill:")){const w=M.replace("skill:","");try{G=(await $fetch(`/api/skills/${w}/prompt`,{method:"POST",body:{featureId:h}})).prompt}catch(C){console.error(`[useChatStream] Failed to render skill prompt for ${w}:`,C);return}}else G=`/speckit.${M} ${h}`;e.addUserMessage(G,v),e.saveConversation(v,!0);const oe=e.conversations.find(w=>w.id===v),ne=e.addAssistantMessage(v);e.startSession(Ho(),v),e.startConversationStreaming(v);const I=Dr(oe);await re(G,ne.id,v,I)}function Z(v){const h=v??e.activeConversationId;if(!h)return;const M=lt.get(h);if(M){if(M.ws.readyState===WebSocket.OPEN){const G={type:"abort"};e.pushDebugEvent({direction:"out",channel:"ws",eventType:"abort",payload:G},h),M.ws.send(JSON.stringify(G)),M.ws.close()}M.currentMessageId&&(S(M.currentMessageId,h,"error"),e.updateMessage(M.currentMessageId,{status:"stopped"},h),e.endSession(h),e.saveConversation(h,!0)),lt.delete(h)}e.endConversationStreaming(h),e.clearPendingPermission(h),fe(h)}function H(v){const h=lt.get(v);h&&(c(h),h.ws.close(),lt.delete(v)),un.delete(v)}function z(){for(const[v,h]of lt)c(h),h.ws.close(),lt.delete(v);un.clear()}async function O(v){const h=v??e.activeConversationId;if(!h)return;e.clearPendingPlanApproval(h),e.setPermissionMode("auto");const M="Approved. Proceed with the implementation.";e.addUserMessage(M,h),e.saveConversation(h,!0);const G=e.addAssistantMessage(h);e.startSession(Ho(),h),e.startConversationStreaming(h);const oe=e.conversations.find(I=>I.id===h),ne=Dr(oe,!0);await re(M,G.id,h,ne)}function W(v){const h=v??e.activeConversationId;h&&e.clearPendingPlanApproval(h)}return gt(()=>{z()}),{sendMessage:re,sendPermissionResponse:ae,approvePlan:O,rejectPlan:W,abort:Z,disconnect:z,disconnectConversation:H,enableCascade:ue,disableCascade:fe,resetContext:T}}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"},Zh={key:1,class:"text-xs font-mono text-retro-muted"},Kh={class:"px-4 py-3 border-t border-retro-border flex items-center gap-2 justify-end"},Yh=["disabled"],Xh=["disabled"],Zr=_e({__name:"NewConversationModal",props:{show:{type:Boolean},creating:{type:Boolean}},emits:["close","create"],setup(e,{emit:n}){const t=e,a=n,s=$([]),l=$(""),c=$(!1),m=$(""),p=N(()=>!c.value&&!t.creating&&l.value.length>0&&s.value.length>0);async function d(){c.value=!0,m.value="";try{const T=await $fetch("/api/git/branches"),b=T.branches.filter(x=>!x.isRemote&&!x.name.startsWith("br/")&&!x.name.startsWith("br/p-")).map(x=>x.name);if(s.value=b,!b.length){l.value="",m.value="No local branches available for chat creation.";return}const y=(T.current&&b.includes(T.current)?T.current:"")||(b.includes("main")?"main":"")||(b.includes("master")?"master":"")||b[0];l.value=y}catch(T){s.value=[],l.value="",m.value=T instanceof Error?T.message:"Failed to load branches"}finally{c.value=!1}}Be(()=>t.show,T=>{T&&d()});function S(){p.value&&a("create",l.value)}return(T,b)=>(i(),le(Zt,{to:"body"},[K(hn,{"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:Ke(()=>[e.show?(i(),u("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:b[3]||(b[3]=pt(y=>a("close"),["self"]))},[r("div",Hh,[r("div",Oh,[b[4]||(b[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:b[0]||(b[0]=y=>a("close"))},[K(o(xt),{class:"w-4 h-4"})],8,Uh)]),r("div",jh,[b[5]||(b[5]=r("label",{class:"block text-xs font-mono text-retro-muted"},"Base Branch",-1)),r("div",zh,[Re(r("select",{"onUpdate:modelValue":b[1]||(b[1]=y=>l.value=y),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...")):L("",!0),(i(!0),u(he,null,Ee(s.value,y=>(i(),u("option",{key:y,value:y},_(y),9,Gh))),128))],8,Vh),[[En,l.value]]),K(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"})]),m.value?(i(),u("p",qh,_(m.value),1)):(i(),u("p",Zh," The conversation worktree will be created from the selected branch. "))]),r("div",Kh,[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:b[2]||(b[2]=y=>a("close"))}," Cancel ",8,Yh),r("button",{type:"button",disabled:!p.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},_(e.creating?"Creating...":"Create"),9,Xh)])])])):L("",!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=_e({__name:"FeaturesPanel",setup(e){const n=wt(),t=Sr(),{sendMessage:a,enableCascade:s}=po(),l=Hn(),c=$("features"),m=$(null),p=$(null),d=$([]),S=$([]),T=$(!1),b=$(!1),y=$(null),x=$(!1),A=$(!1),j=$(!1),B=$(null),q=$(""),te=$("");let U=null;Be(q,me=>{U&&clearTimeout(U),U=setTimeout(()=>{te.value=me},300)});const re=N(()=>{const me=te.value.trim().toLowerCase();return me?d.value.filter(P=>P.name.toLowerCase().includes(me)||P.id.toLowerCase().includes(me)):d.value}),ae=$({}),ue=N(()=>{const me=n.activeConversation;if(!me)return null;if(me.featureId)return me.featureId;const P=me.worktreeBranch?.trim();return P&&d.value.some(X=>X.id===P)?P:null}),fe=N(()=>m.value||ue.value);Be(()=>n.activeConversationId,()=>{const me=ue.value;me&&qt(()=>{const P=ae.value[me];P&&P.scrollIntoView({behavior:"auto",block:"nearest"})})}),Be(m,me=>{me&&qt(()=>{const P=ae.value[me];P&&P.scrollIntoView({behavior:"auto",block:"nearest"})})});async function ee(){T.value=!0;try{const me=await $fetch("/api/specs/features");d.value=me.features}catch{l.error("Failed to load features"),d.value=[]}finally{T.value=!1}}async function Z(){try{const me=await $fetch("/api/skills");S.value=me.skills}catch{S.value=[]}}ct(()=>{ee(),Z(),window.addEventListener("keydown",O)}),gt(()=>{window.removeEventListener("keydown",O)});function H(me,P={}){if(m.value=me,p.value=null,c.value="files",t.setSelectedFeatureId(me),P.openViewer!==!1){const X=d.value.find(Y=>Y.id===me);X&&(y.value=X,b.value=!0)}}function z(){b.value=!1,y.value=null}function O(me){(me.ctrlKey||me.metaKey)&&me.key.toLowerCase()==="k"&&(me.preventDefault(),x.value||(x.value=!0))}function W(){x.value=!1}function v(me){H(me,{openViewer:!1}),x.value=!1}function h(){x.value=!0}const M=N(()=>d.value.map(me=>me.id)),G={plan:["tasks","implement"],tasks:["implement"],implement:[],clarify:[],analyze:[]},oe={analyze:["skill:better-spec"]};async function ne(me,P){if(me.startsWith("skill:")){const X=me.replace("skill:","");return(await $fetch(`/api/skills/${X}/prompt`,{method:"POST",body:{featureId:P}})).prompt}return`/speckit.${me} ${P}`}function I(me,P){if(P)return null;const X=n.findConversationByFeature(me);return X&&!n.isConversationStreaming(X.id)?(n.selectConversation(X.id),X.id):null}async function w(me,P,X){const Y=await n.createConversation({featureId:me,baseBranch:X});if(!Y)throw new Error("Failed to create conversation");return n.renameConversation(Y,P),n.selectConversation(Y),Y}async function C(me,P){n.addUserMessage(P,me),n.saveConversation(me,!0);const X=n.conversations.find(xe=>xe.id===me),Y=n.addAssistantMessage(me);n.startSession(`session-${Date.now()}`,me),n.startConversationStreaming(me);const de={};X?.worktreePath&&(de.cwd=X.worktreePath,de.worktreeBranch=X.worktreeBranch),X?.featureId&&(de.featureId=X.featureId),await a(P,Y.id,me,Object.keys(de).length>0?de:void 0)}async function V(me,P,X){const Y=oe[P];let de;if(Y&&Y.length>0){const xe=[...Y.slice(1),P,...G[P]||[]];s(me,X,xe);const ve=Y[0];try{de=await ne(ve,me)}catch(Se){l.error(Se instanceof Error?Se.message:"Failed to resolve prerequisite step");return}}else{const xe=G[P]||[];xe.length>0&&s(me,X,xe),de=`/speckit.${P} ${me}`}await C(X,de)}async function Q(me,P,X){const Y=me.shiftKey,de=I(P,Y);if(de){try{await V(P,X,de)}catch(xe){l.error(xe instanceof Error?xe.message:"Failed to run cascade action")}return}B.value={type:"cascade",featureId:P,command:X,title:`${X}: ${P}`},A.value=!0}async function ce(me,P){B.value={type:"open-chat",featureId:P,title:`spec: ${P}`},A.value=!0}async function Te(me,P,X){let Y;try{Y=await $fetch(`/api/skills/${P}/prompt`,{method:"POST",body:{featureId:me}})}catch(de){throw new Error(de instanceof Error?de.message:"Failed to render skill prompt")}await C(X,Y.prompt)}async function Ae(me,P,X){const Y=me.shiftKey,de=I(P,Y);if(de){try{await Te(P,X,de)}catch(xe){l.error(xe instanceof Error?xe.message:"Failed to run skill")}return}B.value={type:"skill",featureId:P,skillId:X,title:`skill: ${X} — ${P}`},A.value=!0}function De(){A.value=!1,B.value=null}async function Ge(me){if(B.value){j.value=!0;try{const P=B.value,X=await w(P.featureId,P.title,me);P.type==="cascade"?await V(P.featureId,P.command,X):P.type==="skill"&&await Te(P.featureId,P.skillId,X),A.value=!1,B.value=null}catch(P){l.error(P instanceof Error?P.message:"Failed to create conversation")}finally{j.value=!1}}}return(me,P)=>{const X=Am,Y=zm,de=ih,xe=Ph;return i(),u("div",Qh,[r("div",Jh,[r("div",ep,[K(X)]),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:h},[K(o(An),{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:ee},[K(o(Cn),{class:ye(["h-4 w-4",{"animate-spin":o(T)}])},null,8,["class"])])])]),r("div",np,[r("div",rp,[K(o(An),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-retro-subtle"}),Re(r("input",{"onUpdate:modelValue":P[0]||(P[0]=ve=>Oe(q)?q.value=ve: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),[[vt,o(q)]])])]),r("div",op,[r("div",sp,[(i(!0),u(he,null,Ee(o(re),ve=>(i(),u("div",{key:ve.id,ref_for:!0,ref:Se=>{o(ae)[ve.id]=Se}},[K(Y,{feature:ve,skills:o(S),"is-active":o(fe)===ve.id,onSelect:P[1]||(P[1]=Se=>H(Se,{openViewer:!0})),onCascade:Q,onOpenChat:ce,onSkill:Ae},null,8,["feature","skills","is-active"])]))),128))]),o(T)&&o(d).length===0?(i(),u("div",ap,[...P[2]||(P[2]=[r("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading features...",-1)])])):L("",!0),!o(T)&&o(d).length>0&&o(re).length===0?(i(),u("div",ip,[K(o(An),{class:"h-10 w-10 text-retro-subtle mb-3"}),P[3]||(P[3]=r("p",{class:"text-sm font-mono text-retro-muted"},"No matching features",-1)),P[4]||(P[4]=r("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," Try a different search term ",-1))])):L("",!0),!o(T)&&o(d).length===0?(i(),u("div",lp,[K(o(aa),{class:"h-10 w-10 text-retro-subtle mb-3"}),P[5]||(P[5]=r("p",{class:"text-sm font-mono text-retro-muted"},"No features found",-1)),P[6]||(P[6]=r("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," Create a feature in specs/ to get started ",-1))])):L("",!0)]),o(b)&&o(y)?(i(),le(de,{key:0,feature:o(y),onClose:z},null,8,["feature"])):L("",!0),o(x)?(i(),le(xe,{key:1,"available-feature-ids":o(M),onClose:W,onSelect:v},null,8,["available-feature-ids"])):L("",!0),K(Zr,{show:o(A),creating:o(j),onClose:De,onCreate:Ge},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=_e({__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=$(!1),l=$("");function c(){l.value=t.conversation.title,s.value=!0}function m(){const y=l.value.trim();y&&y!==t.conversation.title&&a("rename",y),s.value=!1}function p(){s.value=!1}const d=Hn();async function S(y){try{await navigator.clipboard.writeText(y),d.success("Copied to clipboard",1500)}catch{d.error("Failed to copy")}}const T=N(()=>{const y=t.conversation.messages;if(!y.length)return"No messages";const x=y[y.length-1],A=x.content.slice(0,60);return A.length<x.content.length?A+"...":A}),b=N(()=>{const y=new Date(t.conversation.updatedAt),A=new Date().getTime()-y.getTime(),j=Math.floor(A/(1e3*60*60*24));return j===0?y.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):j===1?"Yesterday":j<7?`${j} days ago`:y.toLocaleDateString()});return(y,x)=>(i(),u("div",{class:ye(["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:x[8]||(x[8]=A=>a("select"))},[r("div",up,[r("div",dp,[s.value?(i(),u("div",{key:0,class:"flex gap-2",onClick:x[1]||(x[1]=pt(()=>{},["stop"]))},[Re(r("input",{"onUpdate:modelValue":x[0]||(x[0]=A=>l.value=A),onKeyup:[mn(m,["enter"]),mn(p,["escape"])],onBlur:m,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),[[vt,l.value]])])):(i(),u("div",fp,[e.isStreaming?(i(),u("div",mp,[...x[9]||(x[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(),le(o(Qo),{key:1,class:"w-4 h-4 text-retro-muted flex-shrink-0 -translate-y-px"})),r("h3",hp,_(e.conversation.title),1),e.conversation.finalized?(i(),u("span",pp," finalized ")):e.isPreviewing?(i(),u("span",{key:3,class:ye(["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)):L("",!0),e.conversation.autoMode&&e.autoModeTask?(i(),u("span",{key:4,class:ye(["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(he,{key:0},[$e(_(e.autoModeTask.currentStep),1)],64)):e.autoModeTask.state==="queued"?(i(),u(he,{key:1},[$e("queued")],64)):e.autoModeTask.state==="completed"?(i(),u(he,{key:2},[$e("done")],64)):e.autoModeTask.state==="failed"?(i(),u(he,{key:3},[$e("failed")],64)):e.autoModeTask.state==="skipped"?(i(),u(he,{key:4},[$e("skipped")],64)):(i(),u(he,{key:5},[$e("auto")],64))],2)):e.conversation.autoMode?(i(),u("span",vp," auto ")):L("",!0),e.isStreaming?(i(),u("span",gp," streaming ")):L("",!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},_(e.autoModeTask.error),9,xp)):L("",!0),r("p",bp,_(T.value),1),r("p",yp,_(b.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:x[5]||(x[5]=pt(()=>{},["stop"]))},[e.conversation.baseBranch?(i(),u("button",{key:0,onClick:x[2]||(x[2]=A=>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"},[K(o(Hr),{class:"w-3 h-3 flex-shrink-0"}),r("span",wp,"base: "+_(e.conversation.baseBranch),1)])):L("",!0),r("button",{onClick:x[3]||(x[3]=A=>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"},[K(o(Hr),{class:"w-3 h-3 flex-shrink-0"}),r("span",kp,_(e.conversation.worktreeBranch),1)]),e.conversation.worktreePath?(i(),u("button",{key:1,onClick:x[4]||(x[4]=A=>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"},[K(o(Or),{class:"w-3 h-3 flex-shrink-0"}),r("span",Cp,_(e.conversation.worktreePath),1)])):L("",!0)])):L("",!0)]),r("div",{class:"flex gap-1 flex-shrink-0",onClick:x[7]||(x[7]=pt(()=>{},["stop"]))},[r("button",{onClick:c,class:"p-1 hover:bg-retro-panel rounded transition-colors",title:"Rename conversation"},[K(o(ss),{class:"w-4 h-4 text-retro-muted hover:text-retro-cyan"})]),r("button",{onClick:x[6]||(x[6]=A=>a("archive")),class:"p-1 hover:bg-retro-cyan/20 rounded transition-colors",title:"Archive conversation"},[K(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:"inline-flex items-center gap-1"},Bp={class:"inline-flex items-center gap-1"},Ep={class:"relative"},Rp=["placeholder"],Pp={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"},Dp={class:"text-retro-yellow font-mono"},Ip={class:"flex-1 overflow-y-auto p-2"},Lp={key:0,class:"space-y-1"},Np={key:1,class:"text-center py-6 text-retro-muted"},Fp={class:"font-mono text-xs"},Hp={key:1,class:"text-center py-8 text-retro-muted"},Op={key:0,class:"space-y-2"},Up={class:"flex items-start justify-between gap-2"},jp={class:"min-w-0"},zp={class:"text-sm font-mono text-retro-text truncate"},Vp={class:"text-xs text-retro-muted mt-1 truncate"},Wp={class:"text-xs text-retro-muted/70 mt-1"},Gp={class:"text-xs text-retro-muted/70"},qp={class:"flex items-center gap-1 flex-shrink-0"},Zp=["onClick"],Kp=["onClick"],Yp={key:1,class:"text-center py-6 text-retro-muted"},Xp={class:"font-mono text-xs"},Qp={key:1,class:"text-center py-8 text-retro-muted"},Jp=_e({__name:"ConversationsPanel",setup(e){const n=wt(),t=Ss(),a=Hn(),s=N(()=>{const I=new Map;for(const w of t.tasks)I.set(w.featureId,w);return I}),l=N(()=>{const I=new Map;for(const w of t.tasks)I.set(w.featureId,`${w.state}|${w.currentStep||""}|${w.error||""}`);return I});function c(I){if(I)return s.value.get(I)}function m(I){return I&&l.value.get(I)||""}const p=$(""),d=$(""),S=$(!1),T=$(!1),b=$(!1),y=$(!1),x=$(null);let A=null;Be(p,I=>{A&&clearTimeout(A),A=setTimeout(()=>{d.value=I},180)},{immediate:!0}),gt(()=>{A&&(clearTimeout(A),A=null)});const j=new Map,B=new Map;Be(()=>n.sortedConversations.map(I=>I.id),I=>{const w=new Set(I);for(const C of j.keys())w.has(C)||j.delete(C)},{immediate:!0}),Be(()=>n.sortedArchivedConversations.map(I=>I.id),I=>{const w=new Set(I);for(const C of B.keys())w.has(C)||B.delete(C)},{immediate:!0});function q(I){const w=I.messages[I.messages.length-1];return[I.updatedAt,I.title,I.messages.length,w?.id||"",w?.content?.length||0].join("|")}function te(I){const w=I.messages[I.messages.length-1];return[I.updatedAt,I.archivedAt,I.title,I.messages.length,w?.id||"",w?.content?.length||0].join("|")}function U(I){const w=q(I),C=j.get(I.id);if(C&&C.signature===w)return C.text;const V=[I.title,...I.messages.map(Q=>Q.content||"")].join(`
101
- `).toLowerCase();return j.set(I.id,{signature:w,text:V}),V}function re(I){const w=te(I),C=B.get(I.id);if(C&&C.signature===w)return C.text;const V=[I.title,...I.messages.map(Q=>Q.content||"")].join(`
102
- `).toLowerCase();return B.set(I.id,{signature:w,text:V}),V}const ae=N(()=>n.conversationViewMode==="archive"),ue=N(()=>{const I=n.sortedConversations;if(!d.value.trim())return I;const w=d.value.toLowerCase().trim();return I.filter(C=>U(C).includes(w))}),fe=N(()=>{const I=n.sortedArchivedConversations;if(!d.value.trim())return I;const w=d.value.toLowerCase().trim();return I.filter(C=>re(C).includes(w))}),ee=N(()=>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 H(I){T.value=!0;try{if(!await n.createConversation({baseBranch:I})){a.error("Failed to create conversation");return}S.value=!1}catch(w){a.error(w instanceof Error?w.message:"Failed to create conversation")}finally{T.value=!1}}function z(I){n.selectConversation(I),n.setConversationViewMode("active")}async function O(I){const w=await n.archiveConversation(I);if(!w.success){a.error(w.error||"Failed to archive conversation");return}a.success("Conversation archived")}async function W(I){x.value=I,b.value=!0}function v(){b.value=!1,x.value=null}async function h(I){if(x.value){y.value=!0;try{const w=await n.restoreArchivedConversation(x.value,I);if(!w.success){a.error(w.error||"Failed to restore archived conversation");return}a.success("Archived conversation restored"),b.value=!1,x.value=null}finally{y.value=!1}}}async function M(I){const w=await n.deleteArchivedConversation(I);if(!w.success){a.error(w.error||"Failed to delete archived conversation");return}a.success("Archived conversation deleted")}function G(I,w){n.renameConversation(I,w)}function oe(I){return new Date(I).toLocaleString()}function ne(I){if(!I.length)return"No messages";const C=(I[I.length-1].content||"").trim();return C?C.length>80?`${C.slice(0,80)}...`:C:"No messages"}return(I,w)=>(i(),u("div",Sp,[r("div",_p,[r("div",Mp,[r("button",{onClick:Z,class:"flex items-center gap-1 px-2 py-1 text-xs font-mono bg-retro-cyan/10 text-retro-cyan border border-retro-cyan/30 rounded hover:bg-retro-cyan/20 transition-colors"},[K(o(xr),{class:"w-3.5 h-3.5"}),w[8]||(w[8]=$e(" New ",-1))]),r("div",Tp,[r("button",{onClick:w[0]||(w[0]=C=>o(n).setConversationViewMode("active")),class:ye(["px-2 py-1 text-xs font-mono rounded border transition-colors",ae.value?"border-retro-border text-retro-muted hover:text-retro-cyan":"border-retro-cyan text-retro-cyan bg-retro-cyan/10"]),title:"Active conversations"},[r("span",Ap,[K(o(Qs),{class:"w-3.5 h-3.5"}),w[9]||(w[9]=$e(" Active ",-1))])],2),r("button",{onClick:w[1]||(w[1]=C=>o(n).setConversationViewMode("archive")),class:ye(["px-2 py-1 text-xs font-mono rounded border transition-colors",ae.value?"border-retro-cyan text-retro-cyan bg-retro-cyan/10":"border-retro-border text-retro-muted hover:text-retro-cyan"]),title:"Archived conversations"},[r("span",Bp,[K(o(Fr),{class:"w-3.5 h-3.5"}),w[10]||(w[10]=$e(" Archive ",-1))])],2)])]),r("div",Ep,[K(o(An),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted"}),Re(r("input",{"onUpdate:modelValue":w[2]||(w[2]=C=>p.value=C),type:"text",placeholder:ae.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,Rp),[[vt,p.value]])])]),o(n).isNearStorageLimit?(i(),u("div",Pp,[K(o(kn),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),r("p",Dp,_(o(n).conversationCount)+" active conversations. Limit is 100. ",1)])):L("",!0),r("div",Ip,[ae.value?(i(),u(he,{key:1},[o(n).hasArchivedConversations?(i(),u("div",Op,[fe.value.length>0?(i(!0),u(he,{key:0},Ee(fe.value,(C,V,Q,ce)=>{const Te=[C.id,C.title,C.updatedAt,C.archivedAt,C.messages.length];if(ce&&ce.key===C.id&&go(ce,Te))return ce;const Ae=(i(),u("div",{key:C.id,onClick:De=>W(C.id),onKeydown:[mn(pt(De=>W(C.id),["prevent"]),["enter"]),mn(pt(De=>W(C.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",Up,[r("div",jp,[r("h3",zp,_(C.title),1),r("p",Vp,_(ne(C.messages)),1),r("p",Wp," Archived: "+_(oe(C.archivedAt)),1),r("p",Gp," Updated: "+_(oe(C.updatedAt)),1)]),r("div",qp,[r("button",{onClick:pt(De=>W(C.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"},[K(o(Fr),{class:"w-3.5 h-3.5"}),w[12]||(w[12]=$e(" Restore ",-1))],8,Zp),r("button",{onClick:pt(De=>M(C.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"},[K(o(pn),{class:"w-3.5 h-3.5"}),w[13]||(w[13]=$e(" Delete ",-1))],8,Kp)])])],40,["onClick","onKeydown"]));return Ae.memo=Te,Ae},w,5),128)):(i(),u("div",Yp,[r("p",Xp,'No archived results for "'+_(p.value)+'"',1)]))])):(i(),u("div",Qp,[...w[14]||(w[14]=[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(he,{key:0},[o(n).hasConversations?(i(),u("div",Lp,[ue.value.length>0?(i(!0),u(he,{key:0},Ee(ue.value,(C,V,Q,ce)=>{const Te=[C.id,C.title,C.updatedAt,C.messages.length,C.finalized,C.id===o(n).activeConversationId,o(n).isConversationStreaming(C.id),ee.value===C.id,m(C.featureId)];if(ce&&ce.key===C.id&&go(ce,Te))return ce;const Ae=(i(),u("div",{key:C.id},[K($p,{conversation:C,"is-active":C.id===o(n).activeConversationId,"is-streaming":o(n).isConversationStreaming(C.id),"is-previewing":ee.value===C.id,"auto-mode-task":C.autoMode?c(C.featureId):void 0,onSelect:De=>z(C.id),onArchive:De=>O(C.id),onRename:De=>G(C.id,De)},null,8,["conversation","is-active","is-streaming","is-previewing","auto-mode-task","onSelect","onArchive","onRename"])]));return Ae.memo=Te,Ae},w,3),128)):(i(),u("div",Np,[r("p",Fp,'No results for "'+_(p.value)+'"',1)]))])):(i(),u("div",Hp,[...w[11]||(w[11]=[r("p",{class:"font-mono text-sm"},"No conversations",-1),r("p",{class:"text-xs mt-1"},'Click "New" to start',-1)])]))],64))]),K(Zr,{show:S.value,creating:T.value,onClose:w[7]||(w[7]=C=>S.value=!1),onCreate:H},null,8,["show","creating"]),K(Zr,{show:b.value,creating:y.value,onClose:v,onCreate:h},null,8,["show","creating"])]))}}),ev={mobile:768,tablet:1024};function tv(e,n){return e<n.mobile?"mobile":e<n.tablet?"tablet":"desktop"}const _s=gr("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=tv(e,ev)},toggleChatFullscreen(){this.chatFullscreen=!this.chatFullscreen},setChatFullscreen(e){this.chatFullscreen=e}}});function nv(){const e=$(null),n=$(!0);let t=null,a="smooth";const s=50;function l(){const b=e.value;return b?b.scrollHeight-b.scrollTop-b.clientHeight<s:!0}function c(){n.value=l()}function m(b="smooth"){if(a=b,t!==null)return;t=(typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):x=>setTimeout(()=>x(Date.now()),16))(()=>{t=null,qt(()=>{const x=e.value;x&&x.scrollTo({top:x.scrollHeight,behavior:a})})})}function p(b="smooth"){m(b),n.value=!0}function d(b="smooth"){n.value&&m(b)}function S(){n.value=!0}function T(){n.value=!1}return{containerRef:e,shouldAutoScroll:we(n),onScroll:c,scrollToBottom:m,forceScrollToBottom:p,maybeScrollToBottom:d,enableAutoScroll:S,disableAutoScroll:T}}function rv(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 ov(e){const{allMessages:n,containerRef:t,estimateItemHeight:a=120,overscan:s=6}=e,l=$(0),c=$(0),m=$(new Map),p=new Map;let d=null;function S(q,te){if(!Number.isFinite(te)||te<=0)return;const U=Math.ceil(te);if(m.value.get(q)===U)return;const re=new Map(m.value);re.set(q,U),m.value=re}function T(q,te){S(q,te.getBoundingClientRect().height)}function b(q,te){const U=p.get(q);U&&d&&d.unobserve(U),U&&delete U.dataset.virtualMessageId,p.delete(q);const re=rv(te);re&&(re.dataset.virtualMessageId=q,p.set(q,re),T(q,re),d&&d.observe(re))}function y(){const q=t.value;q&&(l.value=q.scrollTop)}const x=N(()=>{const q=n.value,te=new Array(q.length);let U=0;for(let re=0;re<q.length;re++)te[re]=U,U+=m.value.get(q[re].id)??a;return{offsets:te,totalHeight:U}});function A(q,te){let U=0,re=q.length-1,ae=q.length;for(;U<=re;){const ue=Math.floor((U+re)/2);q[ue]>=te?(ae=ue,re=ue-1):U=ue+1}return ae===q.length?Math.max(0,q.length-1):ae}const j=N(()=>{const q=n.value;if(q.length===0)return[];const{offsets:te}=x.value,U=l.value,re=U+Math.max(c.value,1),ae=A(te,Math.max(0,U-a));let ue=ae;for(;ue<q.length&&te[ue]<re;)ue++;const fe=Math.max(0,ae-s),ee=Math.min(q.length,ue+s),Z=[];for(let H=fe;H<ee;H++)Z.push({message:q[H],index:H,top:te[H]});return Z}),B=N(()=>x.value.totalHeight);return ct(()=>{const q=t.value;q&&(c.value=q.clientHeight,l.value=q.scrollTop),d=new ResizeObserver(te=>{for(const U of te){const re=U.target;if(t.value&&re===t.value){c.value=U.contentRect.height;continue}const ae=re.dataset.virtualMessageId;ae&&S(ae,U.contentRect.height)}}),t.value&&d.observe(t.value);for(const[te,U]of p)U.dataset.virtualMessageId=te,d.observe(U),T(te,U)}),gt(()=>{d&&(d.disconnect(),d=null),p.clear()}),{visibleItems:j,totalHeight:B,onVirtualScroll:y,setItemRef:b}}const sv=["innerHTML"],av=_e({__name:"ChatTextBlock",props:{block:{}},setup(e){const n=e,{renderMarkdown:t}=_r(),a=N(()=>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,sv)):L("",!0)}}),iv={class:"my-1 border border-retro-border/30 rounded bg-retro-dark/30"},lv={class:"ml-auto text-retro-muted/60 text-[10px]"},cv={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"},uv=_e({__name:"ChatThinkingBlock",props:{block:{}},setup(e){const n=$(!1);return(t,a)=>(i(),u("div",iv,[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:a[0]||(a[0]=s=>n.value=!o(n))},[K(o(Xr),{class:ye(["w-3 h-3 transition-transform flex-shrink-0",{"rotate-90":o(n)}])},null,8,["class"]),a[1]||(a[1]=r("span",{class:"text-retro-yellow"},"Thinking",-1)),r("span",lv,_(e.block.thinking.length)+" chars ",1)]),o(n)?(i(),u("div",cv,_(e.block.thinking),1)):L("",!0)]))}}),dv={class:"my-2 border border-retro-border/40 rounded bg-retro-dark/30"},fv={key:0,class:"w-3 h-3 border-2 border-retro-yellow border-t-transparent rounded-full animate-spin flex-shrink-0"},mv={class:"text-retro-muted"},hv={class:"text-retro-cyan font-bold"},pv={class:"text-retro-muted truncate"},vv={key:0,class:"px-3 pb-2 border-t border-retro-border/20"},gv={key:0,class:"mt-2"},xv={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"},bv={class:"text-xs font-mono text-retro-muted space-y-2 mt-2"},yv={key:0,class:"flex items-start gap-2"},wv={class:"text-retro-cyan break-all"},kv={key:1,class:"flex items-start gap-2"},Cv={key:1,class:"mt-2"},$v={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"},Sv={key:0,class:"text-[10px] text-retro-muted mt-1"},_v={key:2,class:"mt-2"},Mv={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"},Tv={key:0,class:"text-[10px] text-retro-muted mt-1"},Av={key:3,class:"mt-2"},Bv={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"},Ev={key:0,class:"text-[10px] text-retro-muted mt-1"},Rv={class:"mt-2"},Pv={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"},Dv={key:4,class:"mt-3"},Iv={class:"space-y-2"},Lv={key:0,class:"text-[11px] font-mono text-retro-yellow mb-1"},Nv={key:1,class:"text-xs font-mono text-retro-text whitespace-pre-wrap"},Fv={key:2,class:"mt-2 space-y-1"},Hv={key:0,class:"text-retro-muted/80"},Ov={key:1,class:"px-3 pb-2 border-t border-retro-border/20"},Uv={class:"whitespace-pre-wrap"},jv={class:"whitespace-pre-wrap"},zv=_e({__name:"ChatToolBlock",props:{block:{},result:{}},setup(e){const n=e,t=$(!1),a=$(!1);function s(ne,I){for(const w of I){const C=ne[w];if(typeof C=="string"&&C.trim())return C}return""}function l(ne,I){for(const w of I){const C=ne[w];if(typeof C=="number"&&Number.isFinite(C))return C;if(typeof C=="string"&&C.trim()){const V=Number(C);if(Number.isFinite(V))return V}}return null}function c(ne,I=14,w=1400){if(!ne)return{text:"",truncated:!1};const C=ne.split(`
103
- `);let V=C.slice(0,I).join(`
104
- `),Q=C.length>I;return V.length>w&&(V=V.slice(0,w),Q=!0),{text:V,truncated:Q}}const m=N(()=>n.block.name.toLowerCase()),p=N(()=>m.value.replace(/[^a-z0-9]/g,"")),d=N(()=>p.value==="requestuserinput"||p.value==="askuserquestion"),S=N(()=>m.value==="read"),T=N(()=>m.value==="write"),b=N(()=>m.value==="edit"||m.value==="multiedit"),y=N(()=>["bash","exec","execcommand","runcommand"].includes(m.value)),x=N(()=>{if(!d.value)return[];const ne=n.block.input.questions;if(Array.isArray(ne))return ne.map(w=>w&&typeof w=="object"?w:null).filter(w=>!!w);const I={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!I.question&&!I.prompt&&!I.message&&!I.header?[]:[I]});function A(ne,I=120){const w=ne.replace(/\s+/g," ").trim();return w?w.length>I?`${w.slice(0,I)}...`:w:""}const j=N(()=>{const ne=x.value[0];return ne?A(ne.question||ne.prompt||ne.message||ne.header||""):""}),B=N(()=>s(n.block.input,["file_path","path","file","filepath","target_file"])),q=N(()=>{const ne=l(n.block.input,["offset","start_line","line"]),I=l(n.block.input,["limit","lines","line_count"]),w=l(n.block.input,["end_line"]);return ne!==null&&I!==null?`from line ${ne}, ${I} lines`:ne!==null&&w!==null?`lines ${ne}-${w}`:ne!==null?`from line ${ne}`:I!==null?`${I} lines`:""}),te=N(()=>s(n.block.input,["content","text","new_content"])),U=N(()=>s(n.block.input,["old_string","oldText","old"])),re=N(()=>s(n.block.input,["new_string","newText","new","replacement"])),ae=N(()=>s(n.block.input,["cmd","command","script","chars"])),ue=N(()=>c(te.value)),fe=N(()=>c(U.value,10,1e3)),ee=N(()=>c(re.value,10,1e3)),Z=N(()=>{if(d.value)return j.value||"Prompting user for clarification";if(S.value){if(B.value&&q.value)return`Read ${B.value} (${q.value})`;if(B.value)return`Read ${B.value}`}return T.value&&B.value?`Write ${B.value}`:b.value&&B.value?`Edit ${B.value}`:y.value&&ae.value?`$ ${ae.value}`:n.block.inputSummary}),H=N(()=>{switch(n.block.status){case"running":return"[RUN]";case"pending":return"[WAIT]";case"complete":return"[OK]";case"error":return"[ERR]"}}),z=N(()=>Object.entries(n.block.input).filter(([I,w])=>w==null||typeof w=="string"&&(!w.trim()||w.length>90)?!1:!["content","new_content","text","old_string","new_string"].includes(I)).slice(0,6).map(([I,w])=>`${I}=${JSON.stringify(w)}`)),O=N(()=>{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"}}),W=N(()=>n.result?.content??""),v=N(()=>n.result?.isError??!1),h=N(()=>W.value.length),M=N(()=>W.value?W.value.split(`
105
- `).slice(0,3).join(`
106
- `):""),G=N(()=>W.value?W.value.split(`
107
- `).length>3||W.value.length>300:!1),oe=N(()=>W.value.trim().length>0);return(ne,I)=>(i(),u("div",dv,[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:I[0]||(I[0]=w=>t.value=!o(t))},[e.block.status==="running"?(i(),u("span",fv)):e.block.status==="pending"?(i(),le(o(Jo),{key:1,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-muted animate-pulse"})):e.block.status==="complete"?(i(),le(o(yr),{key:2,class:ye(["w-3.5 h-3.5 flex-shrink-0",o(O)])},null,8,["class"])):(i(),le(o(On),{key:3,class:ye(["w-3.5 h-3.5 flex-shrink-0",o(O)])},null,8,["class"])),r("span",mv,_(o(H)),1),r("span",hv,_(e.block.name),1),r("span",pv,_(o(Z)||e.block.inputSummary),1),K(o(Xr),{class:ye(["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",vv,[o(z).length>0?(i(),u("div",gv,[I[3]||(I[3]=r("div",{class:"text-[11px] font-mono text-retro-cyan mb-1"},"Args",-1)),r("pre",xv,_(o(z).join(`
108
- `)),1)])):L("",!0),r("div",bv,[o(B)?(i(),u("div",yv,[I[4]||(I[4]=r("span",{class:"text-retro-muted/80 min-w-12"},"File",-1)),r("code",wv,_(o(B)),1)])):L("",!0),o(S)&&o(q)?(i(),u("div",kv,[I[5]||(I[5]=r("span",{class:"text-retro-muted/80 min-w-12"},"Range",-1)),r("span",null,_(o(q)),1)])):L("",!0)]),o(T)&&o(ue).text?(i(),u("div",Cv,[I[6]||(I[6]=r("div",{class:"text-[11px] font-mono text-retro-cyan mb-1"},"New Content",-1)),r("pre",$v,_(o(ue).text),1),o(ue).truncated?(i(),u("div",Sv,"Truncated preview")):L("",!0)])):L("",!0),o(b)&&o(fe).text?(i(),u("div",_v,[I[7]||(I[7]=r("div",{class:"text-[11px] font-mono text-retro-yellow mb-1"},"Before",-1)),r("pre",Mv,_(o(fe).text),1),o(fe).truncated?(i(),u("div",Tv,"Truncated preview")):L("",!0)])):L("",!0),o(b)&&o(ee).text?(i(),u("div",Av,[I[8]||(I[8]=r("div",{class:"text-[11px] font-mono text-retro-green mb-1"},"After",-1)),r("pre",Bv,_(o(ee).text),1),o(ee).truncated?(i(),u("div",Ev,"Truncated preview")):L("",!0)])):L("",!0),r("details",Rv,[I[9]||(I[9]=r("summary",{class:"text-[11px] font-mono text-retro-muted cursor-pointer hover:text-retro-cyan"},"Raw input JSON",-1)),r("pre",Pv,_(JSON.stringify(e.block.input,null,2)),1)]),o(d)&&o(x).length>0?(i(),u("div",Dv,[I[10]||(I[10]=r("div",{class:"text-[11px] font-mono text-retro-cyan mb-1"},"Clarification Prompt",-1)),r("div",Iv,[(i(!0),u(he,null,Ee(o(x),(w,C)=>(i(),u("div",{key:`${w.id||"q"}-${C}`,class:"rounded border border-retro-border/30 bg-retro-panel/40 p-2"},[w.header?(i(),u("div",Lv,_(w.header),1)):L("",!0),w.question||w.prompt||w.message?(i(),u("div",Nv,_(w.question||w.prompt||w.message),1)):L("",!0),Array.isArray(w.options)&&w.options.length>0?(i(),u("div",Fv,[(i(!0),u(he,null,Ee(w.options,(V,Q)=>(i(),u("div",{key:`${w.id||"q"}-opt-${Q}`,class:"text-xs font-mono text-retro-muted"},[$e(_(V.label||`Option ${Q+1}`)+" ",1),V.description?(i(),u("span",Hv," - "+_(V.description),1)):L("",!0)]))),128))])):L("",!0)]))),128))])])):L("",!0)])):L("",!0),o(oe)?(i(),u("div",Ov,[r("div",{class:ye(["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:St(o(a)?"max-height: 20rem":"")},[!o(a)&&o(G)?(i(),u(he,{key:0},[r("pre",Uv,_(o(M)),1),r("button",{class:"text-retro-cyan hover:underline mt-1 text-[10px]",onClick:I[1]||(I[1]=pt(w=>a.value=!0,["stop"]))}," Show full ("+_(o(h))+" chars) ",1)],64)):(i(),u(he,{key:1},[r("pre",jv,_(o(W)),1),o(G)?(i(),u("button",{key:0,class:"text-retro-cyan hover:underline mt-1 text-[10px]",onClick:I[2]||(I[2]=pt(w=>a.value=!1,["stop"]))}," Collapse ")):L("",!0)],64))],6)])):L("",!0)]))}}),Vv={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"},Wv={class:"flex items-center gap-1"},Gv={class:"flex items-center gap-1"},qv=_e({__name:"ChatResultSummary",props:{block:{}},setup(e){const n=e,t=N(()=>{const l=Math.round(n.block.durationMs/1e3);return l<60?`${l}s`:`${Math.floor(l/60)}m ${l%60}s`}),a=N(()=>`$${n.block.totalCostUsd.toFixed(4)}`),s=N(()=>{const{inputTokens:l,outputTokens:c}=n.block.usage;return`${l.toLocaleString()} in / ${c.toLocaleString()} out`});return(l,c)=>(i(),u("div",Vv,[r("span",Wv,[c[0]||(c[0]=r("span",{class:"text-retro-muted/60"},"time",-1)),$e(" "+_(o(t)),1)]),r("span",Gv,[c[1]||(c[1]=r("span",{class:"text-retro-muted/60"},"cost",-1)),$e(" "+_(o(a)),1)]),r("span",null,_(o(s)),1),r("span",null,_(e.block.numTurns)+" turn"+_(e.block.numTurns!==1?"s":""),1)]))}}),Zv={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"},Kv={class:"text-retro-cyan"},Yv={key:0,class:"text-retro-border"},Xv={key:1},Qv=_e({__name:"ChatSessionInit",props:{block:{}},setup(e){return(n,t)=>(i(),u("div",Zv,[r("span",Kv,_(e.block.model),1),t[0]||(t[0]=r("span",{class:"text-retro-border"},"|",-1)),r("span",null,_(e.block.tools.length)+" tools",1),e.block.permissionMode?(i(),u("span",Yv,"|")):L("",!0),e.block.permissionMode?(i(),u("span",Xv,_(e.block.permissionMode),1)):L("",!0)]))}}),Jv=_e({__name:"ChatContentBlock",props:{block:{},toolResultsByUseId:{}},setup(e){const n=e,t=N(()=>{if(n.block.type==="tool_use")return n.toolResultsByUseId.get(n.block.toolUseId)});return(a,s)=>{const l=av,c=uv,m=zv,p=qv,d=Qv;return e.block.type==="text"?(i(),le(l,{key:0,block:e.block},null,8,["block"])):e.block.type==="thinking"?(i(),le(c,{key:1,block:e.block},null,8,["block"])):e.block.type==="tool_use"?(i(),le(m,{key:2,block:e.block,result:o(t)},null,8,["block","result"])):e.block.type==="result_summary"?(i(),le(p,{key:3,block:e.block},null,8,["block"])):e.block.type==="session_init"?(i(),le(d,{key:4,block:e.block},null,8,["block"])):L("",!0)}}}),eg={class:"flex-1 min-w-0"},tg={class:"flex items-center gap-2 mb-1"},ng={class:"text-xs font-mono text-retro-muted"},rg={key:0,class:"text-xs font-mono text-retro-yellow animate-pulse"},og={key:1,class:"text-xs font-mono text-retro-muted"},sg={key:2,class:"text-xs font-mono text-retro-red"},ag={key:1,class:"mb-2 flex flex-wrap gap-2"},ig=["href","download"],lg=["src","alt"],cg={class:"mt-1 truncate text-[10px] font-mono text-retro-muted"},ug=["innerHTML"],dg={key:3,class:"text-xs font-mono text-retro-muted italic"},fg={key:4,class:"inline-block w-2 h-4 bg-retro-cyan animate-pulse ml-0.5"},mg=_e({__name:"ChatMessage",props:{message:{}},setup(e){const n=e,{renderMarkdown:t}=_r(),a=N(()=>n.message.role==="user"),s=N(()=>n.message.status==="streaming"),l=N(()=>n.message.status==="error"),c=N(()=>n.message.status==="stopped"),m=N(()=>js(n.message)),p=N(()=>{const A=new Map;for(const j of n.message.contentBlocks??[])j.type==="tool_result"&&A.set(j.toolUseId,j);return A}),d=N(()=>{if(!n.message.contentBlocks)return[];const A=n.message.contentBlocks.filter(B=>B.type!=="tool_result"),j=[];for(const B of A){const q=j.length>0?j[j.length-1]:null;if(q?.type==="text"&&B.type==="text"){const te=q.text||"",U=B.text||"";q.text=`${te}${U}`;continue}j.push({...B})}return j}),S=N(()=>m.value&&d.value.length>0),T=N(()=>n.message.content.trim().length>0),b=N(()=>n.message.attachments??[]),y=A=>new Date(A).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"}),x=N(()=>t(n.message.content));return(A,j)=>{const B=Jv;return i(),u("div",{class:ye(["flex gap-3 p-3",[o(a)?"bg-retro-dark/50":"bg-transparent",o(l)?"border-l-2 border-retro-red":""]])},[r("div",{class:ye(["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(),le(o(Ur),{key:0,class:"w-4 h-4 text-retro-cyan"})):(i(),le(o(ns),{key:1,class:"w-4 h-4 text-retro-green"}))],2),r("div",eg,[r("div",tg,[r("span",{class:ye(["text-xs font-mono",o(a)?"text-retro-cyan":"text-retro-green"])},_(o(a)?"You":"Assistant"),3),r("span",ng,_(y(e.message.timestamp)),1),o(s)?(i(),u("span",rg," typing... ")):L("",!0),o(c)?(i(),u("span",og," (stopped) ")):L("",!0),o(l)?(i(),u("span",sg," (error) ")):L("",!0)]),o(S)?(i(!0),u(he,{key:0},Ee(o(d),q=>(i(),le(B,{key:q.id,block:q,"tool-results-by-use-id":o(p)},null,8,["block","tool-results-by-use-id"]))),128)):L("",!0),o(a)&&o(b).length>0?(i(),u("div",ag,[(i(!0),u(he,null,Ee(o(b),q=>(i(),u("a",{key:q.id,href:q.dataUrl,download:q.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:q.dataUrl,alt:q.name,class:"h-20 w-full rounded object-cover"},null,8,lg),r("div",cg,_(q.name),1)],8,ig))),128))])):L("",!0),!o(S)&&o(T)?(i(),u("div",{key:2,class:"text-sm font-mono text-retro-text break-words chat-markdown",innerHTML:o(x)},null,8,ug)):L("",!0),!o(S)&&!o(T)&&!o(a)&&!o(s)?(i(),u("div",dg," (no visible response content) ")):L("",!0),o(s)?(i(),u("span",fg)):L("",!0)])],2)}}}),hg={key:0,class:"flex flex-col items-center justify-center h-full p-8 text-center"},pg={key:1,class:"relative"},vg={class:"sticky bottom-0"},gg={key:0,class:"px-4 py-2 bg-retro-dark/90 border-t border-retro-border/50 backdrop-blur-sm"},xg={key:1,class:"px-4 py-2.5 bg-retro-red/20 border-t border-retro-red/50"},bg={class:"flex items-start gap-2"},yg={class:"flex-1 min-w-0"},wg={class:"flex items-center justify-between gap-2 mb-0.5"},kg={class:"text-xs font-mono text-retro-red/80 break-words whitespace-pre-wrap"},Cg={key:2,class:"px-4 py-2 bg-retro-dark/90 border-t border-retro-border/50"},$g=_e({__name:"ChatMessages",setup(e){const n=wt(),{containerRef:t,onScroll:a,maybeScrollToBottom:s,scrollToBottom:l,forceScrollToBottom:c}=nv(),{visibleItems:m,totalHeight:p,onVirtualScroll:d,setItemRef:S}=ov({allMessages:N(()=>n.messages),containerRef:t});function T(){a(),d()}const b=N(()=>n.isActiveConversationStreaming),y=N(()=>{const A=n.lastMessage;return!A||A.role!=="assistant"?null:A.status}),x=$(!1);return ct(()=>{l("instant")}),Be(()=>n.activeConversationId,()=>{x.value=!1,l("instant")}),Be(()=>[n.activeConversationId,n.messages.length],([A,j])=>{!A||j===0||x.value||(x.value=!0,c("instant"))},{immediate:!0}),Be(()=>n.messages.length,()=>{s("instant")}),Be(()=>n.lastMessage?.content,()=>{s("instant")}),Be([b,()=>n.lastError],()=>{s("instant")}),Be(p,()=>{s("instant")}),(A,j)=>(i(),u("div",{ref_key:"containerRef",ref:t,class:"flex-1 overflow-y-auto",onScroll:T},[o(n).hasMessages?(i(),u("div",pg,[r("div",{class:"relative",style:St({height:`${o(p)}px`})},[(i(!0),u(he,null,Ee(o(m),B=>(i(),u("div",{key:B.message.id,class:"absolute left-0 right-0 border-b border-retro-border/30",style:St({transform:`translateY(${B.top}px)`})},[r("div",{ref_for:!0,ref:q=>o(S)(B.message.id,q)},[jo([B.message.id,B.message.status,B.message.content,B.message.contentBlocks?.length||0,B.message.tools?.length||0],()=>K(mg,{message:B.message},null,8,["message"]),j,0)],512)],4))),128))],4)])):(i(),u("div",hg,[...j[2]||(j[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",vg,[o(b)&&!o(n).lastError?(i(),u("div",gg,[...j[3]||(j[3]=[Ps('<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)])])):L("",!0),o(n).lastError?(i(),u("div",xg,[r("div",bg,[K(o(On),{class:"w-4 h-4 text-retro-red flex-shrink-0 mt-0.5"}),r("div",yg,[r("div",wg,[j[4]||(j[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:j[1]||(j[1]=B=>o(n).clearError())}," Dismiss ")]),r("p",kg,_(o(n).lastError),1),j[5]||(j[5]=r("p",{class:"text-xs font-mono text-retro-muted mt-1"}," Check browser console (F12) for more details ",-1))])])])):o(y)==="stopped"?(i(),u("div",Cg,[...j[6]||(j[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)])])):L("",!0)])],544))}});function Sg(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 _g(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 Mg(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 Tg(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 Ag={class:"flex-shrink-0 border-t border-retro-border bg-retro-dark p-3"},Bg={class:"flex items-center gap-2 mb-2"},Eg={class:"relative mode-selector"},Rg={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]"},Pg=["onClick"],Dg={class:"text-xs font-mono text-retro-muted"},Ig={key:0,class:"mb-3 p-3 bg-retro-yellow/10 border border-retro-yellow/50 rounded"},Lg={class:"flex items-center justify-between gap-3"},Ng={class:"flex-1 min-w-0"},Fg={class:"text-xs font-mono text-retro-text truncate"},Hg={class:"text-retro-cyan"},Og={key:0,class:"text-retro-muted"},Ug={key:1,class:"text-retro-muted"},jg={key:1,class:"mb-3 p-3 bg-retro-cyan/10 border border-retro-cyan/50 rounded"},zg={key:2,class:"mb-2 flex flex-wrap gap-2"},Vg=["src","alt"],Wg={class:"mt-1 truncate text-[10px] font-mono text-retro-muted"},Gg={class:"truncate text-[10px] font-mono text-retro-muted/80"},qg=["onClick"],Zg={class:"flex gap-2 items-end"},Kg=["disabled"],Yg={class:"flex-1 relative"},Xg=["disabled","placeholder"],Qg=["disabled"],Oo=4,Jg=5*1024*1024,e1=_e({__name:"ChatInput",props:{disabled:{type:Boolean}},setup(e){const n=e,t=wt(),{sendMessage:a,sendPermissionResponse:s,approvePlan:l,rejectPlan:c,abort:m,resetContext:p}=po(),d=$(""),S=$(null),T=$(null),b=$(!1),y=$(!1),x=$([]),A={plan:Jr,ask:to,auto:Kr,bypass:no},j={plan:"text-retro-cyan",ask:"text-retro-green",auto:"text-retro-yellow",bypass:"text-retro-red"};function B(P){t.setPermissionMode(P),y.value=!1}function q(P){P.target.closest(".mode-selector")||(y.value=!1)}ct(()=>{document.addEventListener("click",q)}),gt(()=>{document.removeEventListener("click",q)});const te=N(()=>(d.value.trim().length>0||x.value.length>0)&&!t.isActiveConversationStreaming&&!b.value&&!t.pendingPermission&&!ae.value),U=N(()=>t.isActiveConversationStreaming&&!t.pendingPermission),re=N(()=>t.pendingPermission!==null),ae=N(()=>t.pendingPlanApproval!==null);function ue(){s(!0,t.activeConversationId)}function fe(){s(!1,t.activeConversationId)}function ee(){l(t.activeConversationId)}function Z(){c(t.activeConversationId)}function H(){x.value=[],T.value&&(T.value.value="")}function z(P){x.value=x.value.filter(X=>X.id!==P)}function O(P){return P<1024?`${P} B`:P<1024*1024?`${(P/1024).toFixed(1)} KB`:`${(P/(1024*1024)).toFixed(1)} MB`}function W(P){return new Promise((X,Y)=>{const de=new FileReader;de.onload=()=>{typeof de.result=="string"?X(de.result):Y(new Error("Failed to read image"))},de.onerror=()=>Y(de.error||new Error("Failed to read image")),de.readAsDataURL(P)})}async function v(P){const X=P.target,Y=X.files?Array.from(X.files):[];if(Y.length===0)return;const{useToast:de}=await Tn(async()=>{const{useToast:Se}=await import("./DZfSmUhR.js").then(Le=>Le.o);return{useToast:Se}},__vite__mapDeps([0,1,2]),import.meta.url),xe=de();let ve=Oo-x.value.length;if(ve<=0){xe.warning(`You can attach up to ${Oo} images per message.`),X.value="";return}for(const Se of Y){if(ve<=0)break;if(!Se.type.startsWith("image/")){xe.warning(`Skipped "${Se.name}": only image files are supported.`);continue}if(Se.size>Jg){xe.warning(`Skipped "${Se.name}": max size is 5 MB.`);continue}try{const Le=await W(Se);x.value.push({id:`att-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:Se.name,mimeType:Se.type,size:Se.size,dataUrl:Le}),ve--}catch{xe.error(`Failed to attach "${Se.name}".`)}}X.value=""}const h=N(()=>{if(t.isActiveConversationStreaming||b.value)return!1;const P=t.lastMessage;return P?.role==="assistant"&&P?.status==="error"});function M(P){const X=P.instructionFiles.length>0?P.instructionFiles.map(de=>{const xe=de.source==="cwd"?"cwd":"ancestor",ve=de.mtime?` (mtime: ${de.mtime})`:"";return`- \`${de.path}\` [${xe}] - ${de.hint}${ve}`}):["- (none detected from current cwd ancestry)"],Y=P.specContext.files.length>0?P.specContext.files.map(de=>`- \`${de}\``):["- (none)"];return["## Context Snapshot","",`- Time: ${P.generatedAt}`,`- Session state: **${P.sessionState}**`,`- Provider session ID: \`${P.providerSessionId??"(empty)"}\``,`- Provider: \`${P.providerId}\` / \`${P.providerModelKey}\``,`- Permission mode: \`${P.permissionMode}\``,`- CWD (requested): \`${P.requestedCwd}\``,`- CWD (effective): \`${P.effectiveCwd}\``,`- Feature: \`${P.featureId??"(none)"}\``,"","### Spec Context Injection",`- Active on next turn: **${P.specContext.active?"yes":"no"}**`,`- Reason: ${P.specContext.reason}`,...Y,"","### Detected Instruction Files",...X].join(`
109
- `)}function G(P){return(P.match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(Y=>Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'")?Y.slice(1,-1):Y)}function oe(P){const X=P.match(/^\/(?:spec-search|specsearch)\b(.*)$/i);if(!X)return null;const Y=G(X[1]?.trim()??""),de=[],xe={q:""};for(let ve=0;ve<Y.length;ve++){const Se=Y[ve];if(Se==="--mode"&&Y[ve+1]){const Le=Y[++ve];(Le==="keyword"||Le==="semantic"||Le==="hybrid")&&(xe.mode=Le);continue}if(Se.startsWith("--mode=")){const Le=Se.slice(7);(Le==="keyword"||Le==="semantic"||Le==="hybrid")&&(xe.mode=Le);continue}if(Se==="--feature"&&Y[ve+1]){xe.featureId=Y[++ve];continue}if(Se.startsWith("--feature=")){xe.featureId=Se.slice(10);continue}if(Se==="--file-type"&&Y[ve+1]){xe.fileType=Y[++ve];continue}if(Se.startsWith("--file-type=")){xe.fileType=Se.slice(12);continue}if(Se==="--limit"&&Y[ve+1]){const Le=Number.parseInt(Y[++ve],10);Number.isFinite(Le)&&Le>0&&(xe.limit=Le);continue}if(Se.startsWith("--limit=")){const Le=Number.parseInt(Se.slice(8),10);Number.isFinite(Le)&&Le>0&&(xe.limit=Le);continue}de.push(Se)}return xe.q=de.join(" ").trim(),xe}function ne(P,X=1400){const Y=P.trim();return Y.length<=X?Y:`${Y.slice(0,X)}
110
- ...`}function I(P,X){const Y=[];if(Y.push("## Spec Search Results"),Y.push(""),Y.push(`- Query: \`${P.q}\``),Y.push(`- Mode: \`${X.mode}\``),P.featureId&&Y.push(`- Feature filter: \`${P.featureId}\``),P.fileType&&Y.push(`- File type filter: \`${P.fileType}\``),Y.push(`- Hits: **${X.totalCount}** (${X.searchTime}ms)`),X.warning&&Y.push(`- Warning: ${X.warning}`),X.results.length===0)return Y.push(""),Y.push("No matching indexed chunks were found."),Y.join(`
111
- `);Y.push("");for(const[de,xe]of X.results.entries()){const ve=xe.chunk;Y.push(`### ${de+1}. \`${ve.sourcePath}:${ve.lineStart}\``),Y.push(`- Match: \`${xe.matchType}\` (score: ${xe.score.toFixed(3)})`),ve.headingHierarchy.length>0&&Y.push(`- Headings: ${ve.headingHierarchy.join(" > ")}`),Y.push(""),Y.push(ne(ve.content)),Y.push("")}return Y.join(`
112
- `)}async function w(P){const X=t.activeConversationId??await t.createConversation(),Y=t.addAssistantMessage(X);if(!P.q){t.updateMessage(Y.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(`
113
- `),status:"complete"},X);return}const de=t.activeConversation,xe={q:P.q,mode:P.mode??"hybrid",featureId:P.featureId??de?.featureId,fileType:P.fileType,limit:String(P.limit??5)};try{const ve=await $fetch("/api/specs/search",{query:xe});t.updateMessage(Y.id,{content:I({...P,mode:xe.mode,featureId:xe.featureId},ve),status:"complete"},X)}catch(ve){const Se=ve instanceof Error?ve.message:"Failed to run spec search";t.updateMessage(Y.id,{content:`Spec search failed: ${Se}`,status:"error"},X)}}async function C(){const P=t.activeConversation,X={permissionMode:t.permissionMode};P?.hasWorktree&&P.worktreePath?X.cwd=P.worktreePath:P?.cwd&&(X.cwd=P.cwd),P?.featureId&&(X.featureId=P.featureId),P?.providerId&&(X.providerId=P.providerId),P?.providerModelKey&&(X.providerModelKey=P.providerModelKey),P?.providerSessionId&&(X.providerSessionId=P.providerSessionId);const Y=await $fetch("/api/chat/context",{query:X}),de=t.activeConversationId??await t.createConversation(),xe=t.addAssistantMessage(de);t.updateMessage(xe.id,{content:M(Y),status:"complete"},de)}async function V(){const P=d.value.trim(),X=[...x.value];if(P.length===0&&X.length===0||t.isActiveConversationStreaming||b.value||n.disabled)return;if(P==="/reset"||P==="/reset-context"){await ce();return}if(P==="/context"||P==="/ctx"){await C(),d.value="",H(),Ge();return}const Y=oe(P);if(Y){await w(Y),d.value="",H(),Ge();return}b.value=!0,d.value="",H(),Ge();try{await t.addUserMessageWithConversation(P,X);const de=t.activeConversationId,xe=t.addAssistantMessage();t.startSession(`session-${Date.now()}`),t.startConversationStreaming(de);const ve=t.activeConversation,Se={};ve?.hasWorktree&&ve.worktreePath&&(Se.cwd=ve.worktreePath,Se.worktreeBranch=ve.worktreeBranch),ve?.featureId&&(Se.featureId=ve.featureId),X.length>0&&(Se.attachments=X),await a(P,xe.id,de,Object.keys(Se).length>0?Se:void 0)}catch(de){const xe=de instanceof Error?de.message:"Failed to send message";t.setSessionError(xe);const ve=t.lastMessage;ve&&ve.role==="assistant"&&t.updateMessage(ve.id,{status:"error"}),t.activeConversationId&&(t.endSession(t.activeConversationId),t.endConversationStreaming(t.activeConversationId))}finally{b.value=!1}}async function Q(){try{m(t.activeConversationId)}catch{}}async function ce(){if(t.activeConversationId){d.value="",H(),Ge(),b.value=!0;try{await p(t.activeConversationId);const P=t.addAssistantMessage(t.activeConversationId);t.updateMessage(P.id,{content:"✨ **Context cleared** — The AI conversation context has been reset. Starting fresh from here.",status:"complete"},t.activeConversationId);const{useToast:X}=await Tn(async()=>{const{useToast:de}=await import("./DZfSmUhR.js").then(xe=>xe.o);return{useToast:de}},__vite__mapDeps([0,1,2]),import.meta.url);X().success("AI context has been reset. The conversation will start fresh.")}catch(P){console.error("Failed to reset context:",P);const{useToast:X}=await Tn(async()=>{const{useToast:de}=await import("./DZfSmUhR.js").then(xe=>xe.o);return{useToast:de}},__vite__mapDeps([0,1,2]),import.meta.url);X().error("Failed to reset context. Please try again.")}finally{b.value=!1}}}async function Te(){const P=t.messages;let X=null;for(let de=P.length-1;de>=0;de--)if(P[de].role==="user"){X={content:P[de].content,attachments:P[de].attachments??[]};break}if(!X||!t.activeConversationId)return;const Y=t.activeConversationId;t.clearError(),b.value=!0;try{const de=t.addAssistantMessage();t.startSession(`session-${Date.now()}`),t.startConversationStreaming(Y);const xe=t.activeConversation,ve={};xe?.hasWorktree&&xe.worktreePath&&(ve.cwd=xe.worktreePath,ve.worktreeBranch=xe.worktreeBranch),xe?.featureId&&(ve.featureId=xe.featureId),X.attachments.length>0&&(ve.attachments=X.attachments),await a(X.content,de.id,Y,Object.keys(ve).length>0?ve:void 0)}catch(de){const xe=de instanceof Error?de.message:"Failed to retry message";t.setSessionError(xe);const ve=t.lastMessage;ve&&ve.role==="assistant"&&t.updateMessage(ve.id,{status:"error"}),t.endSession(Y),t.endConversationStreaming(Y)}finally{b.value=!1}}function Ae(P){P.key==="Enter"&&!P.shiftKey&&(P.preventDefault(),V())}function De(){const P=S.value;if(P){if(!d.value.trim()){P.style.height="";return}P.style.height="auto",P.style.height=Math.min(P.scrollHeight,200)+"px"}}function Ge(){const P=S.value;P&&(P.style.height="")}function me(){qt(()=>{S.value?.focus()})}return Be(d,De),Be(()=>t.isActiveConversationStreaming,(P,X)=>{X&&!P&&me()}),Be(()=>t.activeConversationId,()=>{H(),me()}),(P,X)=>(i(),u("div",Ag,[r("div",Bg,[r("div",Eg,[r("button",{class:ye(["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",j[o(t).permissionMode]]),onClick:X[0]||(X[0]=Y=>y.value=!o(y))},[(i(),le(In(A[o(t).permissionMode]),{class:"w-4 h-4"})),r("span",null,_(o(Dn)[o(t).permissionMode]),1),K(o(_g),{class:"w-3 h-3"})],2),o(y)?(i(),u("div",Rg,[(i(),u(he,null,Ee(["plan","ask","auto","bypass"],Y=>r("button",{key:Y,class:ye(["flex items-center gap-2 w-full px-3 py-1.5 text-xs font-mono text-left hover:bg-retro-panel transition-colors",[j[Y],o(t).permissionMode===Y?"bg-retro-panel":""]]),onClick:de=>B(Y)},[(i(),le(In(A[Y]),{class:"w-4 h-4"})),r("span",null,_(o(Dn)[Y]),1)],10,Pg)),64))])):L("",!0)]),r("span",Dg,_(o(t).permissionMode==="plan"?"Plan only":o(t).permissionMode==="ask"?"Ask before actions":o(t).permissionMode==="auto"?"Auto approve":"All permissions"),1)]),o(re)?(i(),u("div",Ig,[r("div",Lg,[r("div",Ng,[X[3]||(X[3]=r("div",{class:"text-xs font-mono text-retro-yellow font-bold mb-1"}," Permission Required ",-1)),r("div",Fg,[r("span",Hg,_(o(t).pendingPermission?.tool),1),o(t).pendingPermission?.filePath?(i(),u("span",Og," - "+_(o(t).pendingPermission.filePath),1)):o(t).pendingPermission?.command?(i(),u("span",Ug," - "+_(o(t).pendingPermission.command),1)):L("",!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:ue}," 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:fe}," Deny ")])])])):L("",!0),o(ae)?(i(),u("div",jg,[r("div",{class:"flex items-center justify-between gap-3"},[X[4]||(X[4]=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:ee}," 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:Z}," Reject ")])])])):L("",!0),o(x).length>0?(i(),u("div",zg,[(i(!0),u(he,null,Ee(o(x),Y=>(i(),u("div",{key:Y.id,class:"relative w-24 rounded border border-retro-border/70 bg-retro-black/80 p-1"},[r("img",{src:Y.dataUrl,alt:Y.name,class:"h-16 w-full rounded object-cover"},null,8,Vg),r("div",Wg,_(Y.name),1),r("div",Gg,_(O(Y.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:de=>z(Y.id)},[K(o(xt),{class:"h-3 w-3"})],8,qg)]))),128))])):L("",!0),r("div",Zg,[r("input",{ref_key:"fileInputRef",ref:T,type:"file",accept:"image/*",multiple:"",class:"hidden",onChange:v},null,544),r("button",{class:"flex-shrink-0 p-2 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(re)||o(ae),onClick:X[1]||(X[1]=Y=>o(T)?.click())},[K(o(ma),{class:"w-5 h-5"})],8,Kg),r("div",Yg,[Re(r("textarea",{ref_key:"inputRef",ref:S,"onUpdate:modelValue":X[2]||(X[2]=Y=>Oe(d)?d.value=Y:null),disabled:e.disabled||o(t).isActiveConversationStreaming||o(re)||o(ae),placeholder:e.disabled?"This conversation is finalized (read-only)":"Type a message...",rows:"1",class:"w-full 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:Ae},null,40,Xg),[[vt,o(d)]])]),o(h)?(i(),u("button",{key:0,class:"flex-shrink-0 p-2 rounded bg-retro-yellow/20 text-retro-yellow hover:bg-retro-yellow/30 transition-colors",title:"Retry last message",onClick:Te},[K(o(Sg),{class:"w-5 h-5"})])):L("",!0),!o(U)&&!o(re)?(i(),u("button",{key:1,disabled:!o(te),class:"flex-shrink-0 p-2 rounded bg-retro-cyan/20 text-retro-cyan hover:bg-retro-cyan/30 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",onClick:V},[K(o(Mg),{class:"w-5 h-5"})],8,Qg)):o(U)?(i(),u("button",{key:2,class:"flex-shrink-0 p-2 rounded bg-retro-red/20 text-retro-red hover:bg-retro-red/30 transition-colors",onClick:Q},[K(o(Tg),{class:"w-5 h-5"})])):L("",!0)]),X[5]||(X[5]=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))]))}}),t1={class:"h-64 border-t border-retro-border bg-retro-dark/50 flex flex-col"},n1={class:"h-9 flex items-center justify-between px-3 border-b border-retro-border/40"},r1={key:0,class:"flex-1 flex items-center justify-center text-xs font-mono text-retro-muted"},o1={key:1,class:"flex-1 overflow-y-auto scrollbar-custom"},s1={class:"flex items-center gap-2 text-[10px] font-mono"},a1={class:"text-retro-muted"},i1={class:"text-retro-muted"},l1={class:"text-retro-green truncate"},c1={class:"mt-1 text-[11px] font-mono text-retro-text whitespace-pre-wrap break-words"},u1=_e({__name:"ChatDebugPanel",setup(e){const n=wt(),{debugEvents:t}=Ds(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",t1,[r("div",n1,[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]=m=>o(n).clearDebugEvents())},[K(o(pn),{class:"w-3.5 h-3.5 text-retro-muted"})])]),o(t).length===0?(i(),u("div",r1," No debug events yet ")):(i(),u("div",o1,[(i(!0),u(he,null,Ee(o(t),m=>(i(),u("div",{key:m.id,class:"px-3 py-2 border-b border-retro-border/20"},[r("div",s1,[r("span",a1,_(a(m.timestamp)),1),r("span",{class:ye(s(m.direction))},_(m.direction.toUpperCase()),3),r("span",i1,_(m.channel),1),r("span",l1,_(m.eventType),1)]),r("pre",c1,_(m.payload),1)]))),128))]))]))}}),d1={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},f1={class:"flex items-center justify-between"},m1={class:"space-y-1 text-xs font-mono"},h1={class:"flex items-center gap-2"},p1={class:"relative"},v1=["disabled"],g1=["value"],x1=["value"],b1={class:"flex items-center gap-2"},y1={class:"text-retro-text"},w1={class:"relative"},k1=["disabled"],C1=["disabled"],$1={class:"flex items-center gap-2"},S1=["disabled"],_1=["disabled"],M1=_e({__name:"FinalizeConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(e,{emit:n}){const t=e,a=n,s=$(""),l=$(null),c=$(!1),m=$(!1),p=$(t.baseBranch),d=$([]),S=$(!1);async function T(){m.value=!0;try{const y=await $fetch("/api/chat/generate-commit-message",{method:"POST",body:{conversationId:t.worktreePath.split("/").pop()?.replace("br-","")||"",worktreePath:t.worktreePath}});y.success&&y.message&&(s.value=y.message)}catch{}finally{m.value=!1}}ct(async()=>{const y=(async()=>{try{const A=t.worktreePath.split("/").pop()||"",j=await $fetch(`/api/commits/${encodeURIComponent(A)}`,{params:{workingDirectory:t.worktreePath}});l.value=j.aheadCount}catch{l.value=null}})(),x=(async()=>{S.value=!0;try{const A=await $fetch("/api/git/branches");d.value=A.branches.filter(j=>!j.isRemote&&!j.name.startsWith("br/")&&!j.name.startsWith("br/p-")).map(j=>j.name),d.value.length>0&&!d.value.includes(p.value)&&(p.value=d.value.includes("main")?"main":d.value.includes("master")?"master":d.value[0])}catch{d.value=[]}finally{S.value=!1}})();await Promise.all([y,x])});function b(){s.value.trim()&&(c.value=!0,a("confirm",s.value.trim(),p.value))}return(y,x)=>(i(),u("div",d1,[r("div",f1,[x[4]||(x[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:x[0]||(x[0]=A=>a("cancel"))},[K(o(xt),{class:"w-4 h-4"})])]),r("div",m1,[r("div",h1,[x[5]||(x[5]=r("span",{class:"text-retro-muted"},"target:",-1)),r("div",p1,[Re(r("select",{"onUpdate:modelValue":x[1]||(x[1]=A=>p.value=A),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},_(e.baseBranch),9,g1)):L("",!0),(i(!0),u(he,null,Ee(d.value,A=>(i(),u("option",{key:A,value:A},_(A),9,x1))),128))],8,v1),[[En,p.value]]),K(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",b1,[x[6]||(x[6]=r("span",{class:"text-retro-muted"},"commits:",-1)),r("span",y1,_(l.value!==null?l.value:"..."),1)])]),r("div",w1,[Re(r("textarea",{"onUpdate:modelValue":x[2]||(x[2]=A=>s.value=A),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||m.value},null,8,k1),[[vt,s.value]]),r("button",{type:"button",disabled:c.value||m.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:T},[K(o(wr),{class:ye(["w-4 h-4",{"animate-spin":m.value}])},null,8,["class"])],8,C1)]),r("div",$1,[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:b},[K(o(Yr),{class:"w-3.5 h-3.5"}),$e(" "+_(c.value?"Finalizing...":"Confirm"),1)],8,S1),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:x[3]||(x[3]=A=>a("cancel"))}," Cancel ",8,_1)])]))}}),T1={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},A1={class:"flex items-center justify-between"},B1={class:"space-y-1 text-xs font-mono"},E1={class:"flex items-center gap-2"},R1={class:"text-retro-cyan"},P1={class:"flex items-center gap-2"},D1={class:"relative"},I1=["disabled"],L1=["value"],N1=["value"],F1={class:"flex items-center gap-2"},H1={class:"text-retro-text"},O1={class:"flex items-center gap-2"},U1=["disabled"],j1=["disabled"],z1=_e({__name:"RebaseConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(e,{emit:n}){const t=e,a=n,s=$(null),l=$(!1),c=$(t.baseBranch),m=$([]),p=$(!1);async function d(T){try{const b=await $fetch("/api/chat/compare",{params:{worktreePath:t.worktreePath,baseBranch:T}});s.value=b.ahead}catch{s.value=null}}ct(async()=>{const T=d(c.value),b=(async()=>{p.value=!0;try{const y=await $fetch("/api/git/branches");m.value=y.branches.filter(x=>!x.isRemote&&!x.name.startsWith("br/")&&!x.name.startsWith("br/p-")).map(x=>x.name),m.value.length>0&&!m.value.includes(c.value)&&(c.value=m.value.includes("main")?"main":m.value.includes("master")?"master":m.value[0])}catch{m.value=[]}finally{p.value=!1}})();await Promise.all([T,b])}),Be(c,T=>{d(T)});function S(){l.value=!0,a("confirm",c.value)}return(T,b)=>(i(),u("div",T1,[r("div",A1,[b[3]||(b[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:b[0]||(b[0]=y=>a("cancel"))},[K(o(xt),{class:"w-4 h-4"})])]),r("div",B1,[r("div",E1,[b[4]||(b[4]=r("span",{class:"text-retro-muted"},"worktree:",-1)),r("span",R1,_(e.worktreeBranch),1)]),r("div",P1,[b[5]||(b[5]=r("span",{class:"text-retro-muted"},"target:",-1)),r("div",D1,[Re(r("select",{"onUpdate:modelValue":b[1]||(b[1]=y=>c.value=y),disabled:l.value||p.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"},[p.value?(i(),u("option",{key:0,value:e.baseBranch},_(e.baseBranch),9,L1)):L("",!0),(i(!0),u(he,null,Ee(m.value,y=>(i(),u("option",{key:y,value:y},_(y),9,N1))),128))],8,I1),[[En,c.value]]),K(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",F1,[b[6]||(b[6]=r("span",{class:"text-retro-muted"},"commits ahead:",-1)),r("span",H1,_(s.value!==null?s.value:"..."),1)])]),r("div",O1,[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},[K(o(Yr),{class:"w-3.5 h-3.5"}),$e(" "+_(l.value?"Rebasing...":"Confirm"),1)],8,U1),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:b[2]||(b[2]=y=>a("cancel"))}," Cancel ",8,j1)])]))}}),V1={class:"flex-1 flex flex-col overflow-hidden"},W1={class:"flex-shrink-0 px-4 py-2 border-b border-retro-border flex items-center justify-between bg-retro-dark"},G1={class:"text-xs font-mono text-retro-text truncate"},q1={class:"flex items-center gap-2 flex-shrink-0"},Z1=["title"],K1=["disabled"],Y1=["disabled"],X1={key:5,class:"text-xs font-mono text-retro-green"},Q1={key:6,class:"text-[11px] font-mono text-retro-muted"},J1={key:0,class:"flex items-center justify-center h-full text-retro-muted text-xs font-mono"},ex=["innerHTML"],tx=["value","readonly"],nx={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"},rx=_e({__name:"ConflictFileEditor",props:{file:{},resolved:{type:Boolean},aiResolving:{type:Boolean}},emits:["resolve","aiResolve"],setup(e,{emit:n}){const t=e,a=n,s=$(t.file.content),l=$(!1),c=$(""),m=$(!1);Be(()=>t.file.path,()=>{s.value=t.file.content,l.value=!1,y()}),Be(()=>t.file.content,()=>{l.value||(s.value=t.file.content,y())});const p=/^<{7}\s.*\n([\s\S]*?)^={7}\n([\s\S]*?)^>{7}\s.*\n/gm,d=/^<{7}[^\n]*\n([\s\S]*?)^={7}[^\n]*\n([\s\S]*?)^>{7}[^\n]*\n?/gm,S=N(()=>/^<{7}\s/m.test(s.value)),T=N(()=>B(s.value).length);function b(Z){const H=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"}[H]||"text"}async function y(){m.value=!0;try{const{codeToHtml:Z}=await Tn(async()=>{const{codeToHtml:oe}=await import("./BgAW4X6A.js");return{codeToHtml:oe}},__vite__mapDeps([3,1,2]),import.meta.url),H=b(t.file.path),O=s.value.split(`
114
- `);let W="",v=!1,h=!1,M=0,G=-1;for(const oe of O){M++;const ne=/^<{7}\s/.test(oe),I=/^={7}$/.test(oe),w=/^>{7}\s/.test(oe);if(ne){G++,v=!0,h=!1,W+=`<div class="conflict-line conflict-marker-line" data-line="${M}"><span class="line-number">${M}</span><span class="line-content conflict-marker">${x(oe)}</span></div>
115
- `,t.resolved||(W+=U(G));continue}if(I&&v){v=!1,h=!0,W+=`<div class="conflict-line conflict-marker-line" data-line="${M}"><span class="line-number">${M}</span><span class="line-content conflict-marker">${x(oe)}</span></div>
116
- `;continue}if(w){h=!1,W+=`<div class="conflict-line conflict-marker-line" data-line="${M}"><span class="line-number">${M}</span><span class="line-content conflict-marker">${x(oe)}</span></div>
117
- `;continue}let C=x(oe);try{const ce=(await Z(oe||" ",{lang:H,theme:"vitesse-dark"})).match(/<code[^>]*><span class="line">(.*?)<\/span><\/code>/s);ce&&(C=ce[1])}catch{}let V="";v?V="conflict-ours":h&&(V="conflict-theirs"),W+=`<div class="conflict-line ${V}" data-line="${M}"><span class="line-number">${M}</span><span class="line-content">${C}</span></div>
118
- `}c.value=W}catch{const Z=s.value.split(`
119
- `);c.value=Z.map((H,z)=>{const O=z+1;return`<div class="conflict-line" data-line="${O}"><span class="line-number">${O}</span><span class="line-content">${x(H)}</span></div>`}).join(`
120
- `)}finally{m.value=!1}}function x(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function A(){te("ours")}function j(){te("theirs")}function B(Z){const H=[],z=new RegExp(d.source,d.flags);let O=null,W=0;for(;(O=z.exec(Z))!==null;)H.push({index:W,start:O.index,end:z.lastIndex,ours:O[1]??"",theirs:O[2]??""}),W++;return H}function q(Z,H){return Z?H?Z.endsWith(`
121
- `)||H.startsWith(`
122
- `)?`${Z}${H}`:`${Z}
123
- ${H}`:Z:H}function te(Z,H){const z=s.value,O=B(z);if(O.length){if(typeof H=="number"){const W=O.find(h=>h.index===H);if(!W)return;const v=Z==="ours"?W.ours:Z==="theirs"?W.theirs:q(W.ours,W.theirs);s.value=z.slice(0,W.start)+v+z.slice(W.end)}else s.value=z.replace(p,(W,v,h)=>Z==="ours"?v:Z==="theirs"?h:q(v,h));y()}}function U(Z){return`<div class="conflict-inline-actions" data-conflict-controls="${Z}">
124
- <button type="button" class="conflict-inline-button conflict-inline-button-ours" data-conflict-index="${Z}" data-conflict-action="ours">Accept Ours</button>
125
- <button type="button" class="conflict-inline-button conflict-inline-button-theirs" data-conflict-index="${Z}" data-conflict-action="theirs">Accept Theirs</button>
126
- <button type="button" class="conflict-inline-button conflict-inline-button-both" data-conflict-index="${Z}" data-conflict-action="both">Accept Both</button>
127
- </div>
128
- `}function re(Z){const H=Z.target?.closest("button[data-conflict-action]");if(!H||t.resolved)return;const z=H.dataset.conflictAction,O=H.dataset.conflictIndex;if(!z||O===void 0)return;const W=Number.parseInt(O,10);Number.isNaN(W)||te(z,W)}function ae(){S.value||a("resolve",t.file.path,s.value)}function ue(){a("aiResolve",t.file.path)}function fe(){l.value=!l.value,l.value||y()}function ee(Z){const H=Z.target;s.value=H.value}return ct(()=>{y()}),(Z,H)=>(i(),u("div",V1,[r("div",W1,[r("span",G1,_(e.file.path),1),r("div",q1,[e.resolved?L("",!0):(i(),u("button",{key:0,type:"button",class:ye(["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:fe},[l.value?(i(),le(o(rs),{key:0,class:"w-3.5 h-3.5 inline-block"})):(i(),le(o(eo),{key:1,class:"w-3.5 h-3.5 inline-block"}))],10,Z1)),!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:ue},[K(o(wr),{class:"w-3.5 h-3.5"}),$e(" "+_(e.aiResolving?"Resolving...":"AI Resolve"),1)],8,K1)):L("",!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:A}," Accept All Ours ")):L("",!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:j}," Accept All Theirs ")):L("",!0),e.resolved?L("",!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:ae}," Mark Resolved ",8,Y1)),e.resolved?(i(),u("span",X1," Resolved ")):T.value>0?(i(),u("span",Q1,_(T.value)+" conflict "+_(T.value===1?"block":"blocks"),1)):L("",!0)])]),l.value?L("",!0):(i(),u("div",{key:0,class:ye(["flex-1 overflow-auto bg-retro-black conflict-viewer",{"opacity-60":e.resolved}]),onClick:re},[m.value?(i(),u("div",J1," Highlighting... ")):(i(),u("div",{key:1,class:"conflict-code",innerHTML:c.value},null,8,ex))],2)),l.value?(i(),u("textarea",{key:1,value:s.value,readonly:e.resolved,class:ye(["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:ee},null,42,tx)):L("",!0),S.value&&!e.resolved?(i(),u("div",nx," File still contains conflict markers. Remove all <<<<<<<, =======, >>>>>>> markers to resolve. ")):L("",!0)]))}}),ox={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60"},sx={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"},ax={class:"flex-shrink-0 px-4 py-3 border-b border-retro-border flex items-center justify-between"},ix={class:"flex items-center gap-3"},lx={class:"text-xs font-mono text-retro-muted"},cx={class:"flex items-center gap-2"},ux=["disabled"],dx=["disabled"],fx=["disabled"],mx={key:0,class:"flex-1 flex items-center justify-center text-retro-muted text-sm font-mono"},hx={key:1,class:"flex-1 flex items-center justify-center text-retro-red text-sm font-mono"},px={key:2,class:"flex-1 flex overflow-hidden"},vx={class:"w-64 flex-shrink-0 border-r border-retro-border overflow-y-auto bg-retro-dark"},gx={class:"py-1"},xx=["onClick"],bx={key:1,class:"flex-1 flex items-center justify-center text-retro-muted text-sm font-mono"},yx=_e({__name:"ConflictResolutionModal",emits:["close"],setup(e,{emit:n}){const t=n,a=wt(),s=$(null),l=$(!1),c=$(!1),m=$(null),p=$(!1),d=N(()=>a.conflictState?.files??[]),S=N(()=>a.conflictState?.resolvedFiles??new Set),T=N(()=>d.value.length),b=N(()=>S.value.size),y=N(()=>T.value>0&&b.value>=T.value),x=N(()=>T.value-b.value),A=N(()=>s.value?d.value.find(ue=>ue.path===s.value)??null:null);function j(ue){return S.value.has(ue)}function B(ue){s.value=ue}async function q(ue,fe){await a.resolveConflictFile(ue,fe)}async function te(ue){m.value=ue,await a.aiResolveConflictFile(ue),m.value=null}async function U(){p.value=!0,await a.aiResolveAllConflicts(),p.value=!1}async function re(){l.value=!0;const ue=await a.continueRebase();l.value=!1,ue.success&&t("close")}async function ae(){c.value=!0,await a.abortRebase(),c.value=!1,t("close")}return(ue,fe)=>(i(),le(Zt,{to:"body"},[K(hn,{"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:Ke(()=>[o(a).conflictState?(i(),u("div",ox,[r("div",sx,[r("div",ax,[r("div",ix,[K(o(kn),{class:"w-5 h-5 text-retro-yellow"}),fe[0]||(fe[0]=r("h3",{class:"text-sm font-mono text-retro-text font-semibold"},"Resolve Rebase Conflicts",-1)),r("span",lx,_(b.value)+"/"+_(T.value)+" resolved ",1)]),r("div",cx,[x.value>0?(i(),u("button",{key:0,type:"button",disabled:p.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:U},[K(o(wr),{class:"w-3.5 h-3.5"}),$e(" "+_(p.value?"AI Resolving...":`AI Resolve All (${x.value})`),1)],8,ux)):L("",!0),r("button",{type:"button",disabled:!y.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:re},_(l.value?"Continuing...":"Continue Rebase"),9,dx),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:ae},_(c.value?"Aborting...":"Abort"),9,fx)])]),o(a).conflictState?.loading?(i(),u("div",mx," Loading conflict files... ")):o(a).conflictState?.error?(i(),u("div",hx,_(o(a).conflictState.error),1)):(i(),u("div",px,[r("div",vx,[r("div",gx,[(i(!0),u(he,null,Ee(d.value,ee=>(i(),u("button",{key:ee.path,type:"button",class:ye(["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===ee.path}]),onClick:Z=>B(ee.path)},[j(ee.path)?(i(),le(o(yr),{key:0,class:"w-3.5 h-3.5 text-retro-green flex-shrink-0"})):(i(),le(o(On),{key:1,class:"w-3.5 h-3.5 text-retro-yellow flex-shrink-0"})),r("span",{class:ye(["truncate",j(ee.path)?"text-retro-green":"text-retro-yellow"])},_(ee.path),3)],10,xx))),128))])]),A.value?(i(),le(rx,{key:0,file:A.value,resolved:j(A.value.path),"ai-resolving":m.value===A.value.path||p.value,onResolve:q,onAiResolve:te},null,8,["file","resolved","ai-resolving"])):(i(),u("div",bx," Select a file to resolve "))]))])])):L("",!0)]),_:1})]))}}),wx={key:0,class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},kx={class:"flex items-center justify-between p-4 border-b border-retro-border"},Cx={class:"flex items-center gap-2"},$x={class:"p-4"},Sx={class:"mt-2 text-sm text-retro-text font-mono truncate"},_x={class:"flex justify-end gap-3 p-4 border-t border-retro-border"},Mx=_e({__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(),le(Zt,{to:"body"},[K(hn,{"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:Ke(()=>[e.show?(i(),u("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60",onClick:a},[K(hn,{"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:Ke(()=>[e.show?(i(),u("div",wx,[r("div",kx,[r("div",Cx,[K(o(kn),{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"},[K(o(xt),{class:"w-5 h-5 text-retro-muted"})])]),r("div",$x,[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",Sx,' "'+_(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",_x,[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 ")])])):L("",!0)]),_:1})])):L("",!0)]),_:1})]))}}),Tx={class:"h-full flex flex-col bg-retro-black"},Ax={class:"flex-shrink-0 h-12 flex items-center justify-between px-4 border-b border-retro-border bg-retro-dark"},Bx={class:"flex items-center gap-2 min-w-0"},Ex={class:"text-xs font-mono text-retro-text truncate"},Rx={class:"flex items-center gap-1"},Px=["disabled","title"],Dx=["title"],Ix=["title"],Lx=["disabled"],Nx={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"},Fx={class:"flex-1 min-h-0 flex flex-col"},Hx=_e({__name:"ChatPanel",setup(e){const n=wt(),t=_s(),{disconnectConversation:a}=po();ct(async()=>{try{const M=await $fetch("/api/cwd");n.setCwd(M.cwd)}catch{}});const s=N(()=>n.activeConversation?.title||"New Chat"),l=$(!1),c=N(()=>t.isChatFullscreen),m=$(!1);Be(m,M=>{n.setDebugStreamEnabled(M)}),gt(()=>{n.setDebugStreamEnabled(!1)});function p(){t.toggleChatFullscreen()}async function d(){l.value=!1;const M=n.activeConversationId;M&&(a(M),await n.deleteConversation(M)),n.clearMessages()}function S(){n.hasMessages&&(l.value=!0)}function T(){l.value=!1}const b=$(!1),y=$(null),x=N(()=>n.activeConversation?.finalized===!0),A=N(()=>x.value),j=$(null),B=$(!1);async function q(){const M=n.activeConversation;if(!M?.worktreePath||!M?.baseBranch){j.value=null;return}B.value=!0;try{const G=await $fetch("/api/chat/compare",{params:{worktreePath:M.worktreePath,baseBranch:M.baseBranch}});j.value=G}catch{j.value=null}finally{B.value=!1}}Be(()=>[n.activeConversationId,n.activeConversation?.worktreePath,n.activeConversation?.baseBranch,n.activeConversation?.lastCommitTime],()=>{q()},{immediate:!0});const te=N(()=>j.value?j.value.ahead===0&&j.value.behind===0:!1),U=N(()=>{const M=n.activeConversation;return M?.hasWorktree&&!M?.finalized&&!n.isActiveConversationStreaming}),re=N(()=>U.value&&!te.value);function ae(){b.value=!0,y.value=null}async function ue(M,G){const oe=n.activeConversationId;if(!oe)return;const ne=await n.finalizeConversation(oe,M,G);if(b.value=!1,ne.success)y.value={type:"success",message:`Merged to ${G}`},setTimeout(()=>{y.value=null},5e3);else if(ne.rebaseInProgress)y.value=null;else{const I=ne.conflictFiles?.length?`Conflict in: ${ne.conflictFiles.join(", ")}`:ne.error||"Finalize failed";y.value={type:"error",message:I}}}function fe(){b.value=!1}function ee(){if(!n.conflictState&&n.activeConversation?.hasWorktree){const M=n.activeConversation?.baseBranch||"main";y.value={type:"success",message:`Rebased onto ${M}`},setTimeout(()=>{y.value=null},5e3)}else y.value=null}const Z=$(!1),H=N(()=>!!n.activeConversation?.previewBranch);async function z(){const M=n.activeConversationId;if(!M)return;Z.value=!0,y.value=null;const G=H.value,oe=await n.togglePreview(M);if(oe.success){const ne=G?`Switched back to ${n.activeConversation?.baseBranch}`:"Preview active — main worktree updated";y.value={type:"success",message:ne},setTimeout(()=>{y.value=null},3e3)}else y.value={type:"error",message:oe.error||"Preview toggle failed"};Z.value=!1}const O=$(!1);function W(){O.value=!0,y.value=null}async function v(M){const G=n.activeConversationId;if(!G)return;const oe=await n.rebaseConversation(G,M);O.value=!1,oe.success?(y.value={type:"success",message:`Rebased onto ${M}`},setTimeout(()=>{y.value=null},5e3)):oe.rebaseInProgress?y.value=null:y.value={type:"error",message:oe.error||"Rebase failed"}}function h(){O.value=!1}return(M,G)=>(i(),u("div",Tx,[r("div",Ax,[r("div",Bx,[r("span",Ex,_(o(s)),1)]),r("div",Rx,[o(U)?(i(),u("button",{key:0,disabled:o(Z),class:"p-1.5 rounded hover:bg-retro-panel transition-colors disabled:opacity-40",title:o(H)?"End preview: switch back to base branch":"Preview: test worktree changes in main worktree",onClick:z},[o(H)?(i(),le(o(sa),{key:0,class:"w-4 h-4 text-retro-orange"})):(i(),le(o(rs),{key:1,class:"w-4 h-4 text-retro-cyan"}))],8,Px)):L("",!0),o(re)?(i(),u("button",{key:1,class:"p-1.5 rounded hover:bg-retro-panel transition-colors",title:"Rebase: sync worktree onto target base branch",onClick:W},[K(o(Cn),{class:"w-4 h-4 text-retro-purple"})])):L("",!0),o(re)?(i(),u("button",{key:2,class:"p-1.5 rounded hover:bg-retro-panel transition-colors",title:"Finalize: squash & merge to base branch",onClick:ae},[K(o(yr),{class:"w-4 h-4 text-retro-green"})])):L("",!0),r("button",{class:"p-1.5 rounded hover:bg-retro-panel transition-colors",title:o(c)?"Exit fullscreen chat":"Fullscreen chat",onClick:p},[o(c)?(i(),le(o(Ko),{key:0,class:"w-4 h-4 text-retro-muted"})):(i(),le(o(Yo),{key:1,class:"w-4 h-4 text-retro-muted"}))],8,Dx),r("button",{class:"p-1.5 rounded hover:bg-retro-panel transition-colors",title:o(m)?"Hide debug stream":"Show debug stream",onClick:G[0]||(G[0]=oe=>m.value=!o(m))},[K(o(Ys),{class:ye(["w-4 h-4",o(m)?"text-retro-yellow":"text-retro-muted"])},null,8,["class"])],8,Ix),r("button",{disabled:!o(n).hasMessages,class:"p-1.5 rounded hover:bg-retro-panel disabled:opacity-30 disabled:cursor-not-allowed transition-colors",title:"New conversation",onClick:S},[K(o(pn),{class:"w-4 h-4 text-retro-muted"})],8,Lx)])]),K(Mx,{show:o(l),title:o(s),onConfirm:d,onCancel:T},null,8,["show","title"]),o(b)&&o(n).activeConversation?.hasWorktree?(i(),le(M1,{key:0,"base-branch":o(n).activeConversation.baseBranch||"main","worktree-branch":o(n).activeConversation.worktreeBranch||"","worktree-path":o(n).activeConversation.worktreePath||"",onConfirm:ue,onCancel:fe},null,8,["base-branch","worktree-branch","worktree-path"])):L("",!0),o(O)&&o(n).activeConversation?.hasWorktree?(i(),le(z1,{key:1,"base-branch":o(n).activeConversation.baseBranch||"main","worktree-branch":o(n).activeConversation.worktreeBranch||"","worktree-path":o(n).activeConversation.worktreePath||"",onConfirm:v,onCancel:h},null,8,["base-branch","worktree-branch","worktree-path"])):L("",!0),o(n).conflictState?(i(),le(yx,{key:2,onClose:ee})):L("",!0),o(y)?(i(),u("div",{key:3,class:ye(["flex-shrink-0 px-4 py-2 border-b border-retro-border text-xs font-mono",o(y).type==="success"?"bg-retro-green/10 text-retro-green":"bg-retro-red/10 text-retro-red"])},[$e(_(o(y).message)+" ",1),o(y).type==="error"?(i(),u("button",{key:0,class:"ml-2 underline hover:no-underline",onClick:G[1]||(G[1]=oe=>y.value=null)}," dismiss ")):L("",!0)],2)):L("",!0),o(x)?(i(),u("div",Nx," This conversation has been finalized and is read-only. ")):L("",!0),r("div",Fx,[K($g,{class:"flex-1 overflow-hidden"}),o(m)?(i(),le(u1,{key:0})):L("",!0)]),K(e1,{disabled:o(A)},null,8,["disabled"])]))}}),Ox={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},Ux={class:"flex items-center gap-2 min-w-0"},jx=["title"],zx={class:"text-retro-text font-mono text-sm truncate"},Vx={class:"text-retro-muted"},Wx={class:"text-retro-text"},Gx={class:"text-retro-muted font-mono text-xs flex-shrink-0"},qx={class:"flex-1 overflow-auto"},Zx={key:0,class:"flex items-center justify-center gap-2 text-retro-muted text-sm py-8"},Kx={key:1,class:"flex items-center justify-center text-retro-muted text-sm py-8"},Yx={key:2,class:"flex items-center justify-center text-retro-muted text-sm py-8"},Xx={key:3,class:"w-full text-xs font-mono border-collapse diff-table"},Qx={key:0,class:"diff-warning"},Jx={key:0,colspan:"3",class:"diff-hunk-header px-4 py-1"},e0={class:"diff-line-num select-none text-right px-2 w-12"},t0={class:"diff-line-num select-none text-right px-2 w-12 border-r border-retro-border"},n0={class:"diff-line-content px-3 whitespace-pre-wrap break-all"},r0={key:0,class:"diff-sign"},o0={key:1,class:"diff-sign"},s0={key:2,class:"diff-sign"},a0={key:4,class:"flex items-center justify-center text-retro-muted text-sm py-8"},i0=_e({__name:"GitFileDiffViewer",props:{file:{},commitHash:{},content:{},loading:{type:Boolean}},emits:["close"],setup(e,{emit:n}){const t=e,a=n,s=$(null),l=N(()=>t.commitHash.substring(0,7)),c=N(()=>Fn[t.file.status]||{label:t.file.status,colorClass:"text-retro-muted"}),m=N(()=>t.file.status==="R"&&t.file.oldPath);function p(d){d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),a("close"))}return ct(()=>{s.value?.focus()}),gt(()=>{}),(d,S)=>(i(),u("div",{ref_key:"containerRef",ref:s,tabindex:0,onKeydown:p,class:"flex flex-col h-full bg-retro-dark focus:outline-none","aria-label":"File diff viewer",role:"region"},[r("div",Ox,[r("div",Ux,[r("span",{class:ye(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",c.value.colorClass]),title:c.value.label},_(e.file.status),11,jx),r("span",zx,[m.value&&e.file.oldPath?(i(),u(he,{key:0},[r("span",Vx,_(e.file.oldPath),1),S[1]||(S[1]=r("span",{class:"text-retro-yellow mx-1"},"→",-1)),r("span",Wx,_(e.file.path),1)],64)):(i(),u(he,{key:1},[$e(_(e.file.path),1)],64))]),r("span",Gx," @ "+_(l.value),1)]),r("button",{onClick:S[0]||(S[0]=T=>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)"},[K(o(xt),{class:"w-5 h-5 text-retro-muted hover:text-retro-text"})])]),r("div",qx,[e.loading?(i(),u("div",Zx,[...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),$e(" Loading diff... ",-1)])])):e.content&&e.content.binary?(i(),u("div",Kx,[...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",Yx,[...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",Xx,[r("tbody",null,[e.content.truncated?(i(),u("tr",Qx,[...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)])])):L("",!0),(i(!0),u(he,null,Ee(e.content.lines,(T,b)=>(i(),u("tr",{key:b,class:ye({"diff-add":T.type==="add","diff-delete":T.type==="delete","diff-context":T.type==="context","diff-header":T.type==="header"})},[T.type==="header"?(i(),u("td",Jx,_(T.content),1)):(i(),u(he,{key:1},[r("td",e0,_(T.oldLineNumber??""),1),r("td",t0,_(T.newLineNumber??""),1),r("td",n0,[T.type==="add"?(i(),u("span",r0,"+")):T.type==="delete"?(i(),u("span",o0,"-")):(i(),u("span",s0," ")),$e(" "+_(T.content),1)])],64))],2))),128))])])):(i(),u("div",a0," Failed to load diff content. "))])],544))}}),l0=br(i0,[["__scopeId","data-v-c726b0c5"]]),c0={class:"fixed inset-0 z-50 flex items-center justify-center"},u0={class:"relative w-[90vw] max-w-lg bg-retro-black border border-retro-border rounded-lg shadow-2xl flex flex-col overflow-hidden"},d0={class:"flex-shrink-0 h-12 flex items-center justify-between px-4 border-b border-retro-border bg-retro-dark"},f0={class:"flex items-center gap-2"},m0={class:"text-sm font-mono text-retro-text"},h0={class:"p-6 overflow-y-auto max-h-[70vh] space-y-6"},p0={key:0},v0={class:"space-y-6"},g0={class:"space-y-1.5"},x0=["value","checked","onChange"],b0={class:"flex-1"},y0={class:"text-sm font-mono text-retro-text"},w0={class:"text-xs text-retro-muted leading-tight"},k0={class:"text-xs font-mono text-retro-muted"},C0={class:"text-xs text-retro-muted mb-3"},$0=["disabled"],S0={class:"space-y-1.5"},_0=["value","checked","onChange"],M0={class:"flex-1"},T0={class:"text-sm font-mono text-retro-text"},A0={class:"text-xs text-retro-muted leading-tight"},B0={class:"flex items-center gap-4 px-3 py-2 rounded border border-retro-border bg-retro-panel"},E0=["value"],R0={class:"font-mono text-retro-cyan text-sm w-6 text-center"},P0={key:1,class:"space-y-4"},D0={class:"space-y-1.5"},I0=["checked"],L0=["checked"],N0={class:"flex items-center justify-between px-3 py-2 rounded border border-retro-border bg-retro-panel"},F0={class:"text-xs font-mono text-retro-cyan"},H0=_e({__name:"SettingsModal",emits:["close"],setup(e,{emit:n}){const t=n,a=Qn(),s=Is(),l=Hn(),c=$("main"),m=$(!1),p=N(()=>s.public.appVersion||"unknown"),d=[{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:Kr,color:"text-retro-yellow"},{value:"bypass",label:Dn.bypass,description:or.bypass,icon:no,color:"text-retro-red"}],{data:T,pending:b,error:y}=Co("ai-providers",()=>$fetch("/api/ai/providers"),{server:!1}),x=N(()=>T.value?.providers??[]),A=N(()=>{const W=y.value;return W?W instanceof Error?W.message:String(W):null}),{data:j,refresh:B}=Co("spec-search-status",()=>$fetch("/api/specs/status"),{server:!1,default:()=>null}),q=N(()=>{const W=j.value;return W?W.isIndexing?`Indexing (${W.currentJob||"running"})`:W.schedulerActive?`Indexed ${W.fileCount} files / ${W.chunkCount} chunks`:"Scheduler inactive":"Status unavailable"});ct(()=>{a.hydrate()});const te=W=>{a.setProviderSelection(W),l.success("Settings saved")},U=()=>{c.value="provider"},re=()=>{c.value="main"},ae=W=>{a.setTheme(W),l.success("Settings saved")},ue=W=>{a.setPermissionMode(W),l.success("Settings saved")},fe=W=>{const v=parseInt(W.target.value,10);isNaN(v)||(a.setAutoModeConcurrency(v),l.success("Settings saved"))},ee=W=>{a.setAutoGenerateCommitMessages(W),l.success("Settings saved")},Z=()=>{t("close")},H=async()=>{if(!m.value){m.value=!0;try{const W=await $fetch("/api/specs/reindex",{method:"POST",body:{}});!W.success&&W.status==="already-indexing"?l.info("Spec index is already running"):l.success("Spec reindex started"),await B()}catch(W){l.error(W instanceof Error?W.message:"Failed to start spec reindex")}finally{m.value=!1}}},z=W=>{W.key==="Escape"&&t("close")};ct(()=>{window.addEventListener("keydown",z)}),gt(()=>{window.removeEventListener("keydown",z)});let O=null;return ct(()=>{O=ho(()=>{B()},5e3)}),gt(()=>{O&&clearInterval(O)}),(W,v)=>(i(),le(Zt,{to:"body"},[r("div",c0,[r("div",{class:"absolute inset-0 bg-black/70",onClick:Z}),r("div",u0,[r("div",d0,[r("div",f0,[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:re},[K(o(Zs),{class:"h-4 w-4"})])):L("",!0),r("h2",m0,_(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:v[0]||(v[0]=h=>t("close"))},[K(o(xt),{class:"h-4 w-4"})])]),r("div",h0,[c.value==="main"?(i(),u("section",p0,[r("div",v0,[r("section",null,[v[3]||(v[3]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Theme",-1)),v[4]||(v[4]=r("p",{class:"text-xs text-retro-muted mb-3"}," Choose between dark and light appearance. ",-1)),r("div",g0,[(i(),u(he,null,Ee(d,h=>r("label",{key:h.value,class:ye(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[o(a).theme===h.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:h.value,checked:o(a).theme===h.value,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:M=>ae(h.value)},null,40,x0),r("div",b0,[r("div",y0,_(h.label),1),r("div",w0,_(h.description),1)])],2)),64))])]),v[14]||(v[14]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[v[6]||(v[6]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"AI Provider",-1)),v[7]||(v[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:U},[v[5]||(v[5]=r("span",{class:"text-sm font-mono text-retro-text"},"Provider Settings",-1)),r("span",k0,_(o(a).providerSelection.providerId)+" / "+_(o(a).providerSelection.modelKey),1)])]),v[15]||(v[15]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[v[8]||(v[8]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Spec Search Index",-1)),r("p",C0,_(q.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:m.value||o(j)?.isIndexing,onClick:H},_(m.value?"Starting reindex...":"Reindex Specs"),9,$0)]),v[16]||(v[16]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[v[9]||(v[9]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Default Permission Mode",-1)),v[10]||(v[10]=r("p",{class:"text-xs text-retro-muted mb-3"}," Set the default permission mode for all new chat conversations. ",-1)),r("div",S0,[(i(),u(he,null,Ee(S,h=>r("label",{key:h.value,class:ye(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[o(a).permissionMode===h.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:h.value,checked:o(a).permissionMode===h.value,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:M=>ue(h.value)},null,40,_0),(i(),le(In(h.icon),{class:ye(["w-4 h-4 flex-shrink-0",h.color])},null,8,["class"])),r("div",M0,[r("div",T0,_(h.label),1),r("div",A0,_(h.description),1)])],2)),64))])]),v[17]||(v[17]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[v[12]||(v[12]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Auto Mode",-1)),v[13]||(v[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",B0,[v[11]||(v[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:fe},null,40,E0),r("span",R0,_(o(a).autoModeConcurrency),1)])])])])):(i(),u("section",P0,[v[18]||(v[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)),K(zs,{providers:x.value,selected:o(a).providerSelection,permissionMode:o(a).permissionMode,pending:o(b),errorMessage:A.value,onSelect:te},null,8,["providers","selected","permissionMode","pending","errorMessage"])])),v[26]||(v[26]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[v[21]||(v[21]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Commit Messages",-1)),v[22]||(v[22]=r("p",{class:"text-xs text-retro-muted mb-3"}," Choose whether to use AI to generate commit messages automatically. ",-1)),r("div",D0,[r("label",{class:ye(["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:v[1]||(v[1]=h=>ee(!1))},null,40,I0),v[19]||(v[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:ye(["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:v[2]||(v[2]=h=>ee(!0))},null,40,L0),v[20]||(v[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)])]),v[27]||(v[27]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[v[24]||(v[24]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Spec-Cat",-1)),v[25]||(v[25]=r("p",{class:"text-xs text-retro-muted mb-3"}," Application version. ",-1)),r("div",N0,[v[23]||(v[23]=r("span",{class:"text-sm font-mono text-retro-text"},"Version",-1)),r("span",F0,_(p.value),1)])])])])])]))}}),O0={class:"fixed top-4 right-4 z-50 flex flex-col gap-2 max-w-sm"},U0={class:"flex-1 text-sm font-mono text-retro-text"},j0=["onClick"],z0=_e({__name:"ToastContainer",setup(e){const{toasts:n,remove:t}=Hn(),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 yr;case"error":return On;case"warning":return kn;default:return ca}};return(l,c)=>(i(),le(Zt,{to:"body"},[r("div",O0,[K(Ls,{"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:Ke(()=>[(i(!0),u(he,null,Ee(o(n),m=>(i(),u("div",{key:m.id,class:ye(["flex items-start gap-3 p-3 rounded-lg border shadow-lg",[a[m.type].bg,a[m.type].border]])},[(i(),le(In(s(m.type)),{class:ye(["h-5 w-5 flex-shrink-0 mt-0.5",a[m.type].icon])},null,8,["class"])),r("p",U0,_(m.message),1),r("button",{type:"button",class:"p-0.5 rounded text-retro-muted hover:text-retro-text transition-colors",onClick:p=>o(t)(m.id)},[K(o(xt),{class:"h-4 w-4"})],8,j0)],2))),128))]),_:1})])]))}});function Uo(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 V0(){const e=Qn(),n=N(()=>e.theme),t=N(()=>e.theme==="dark");function a(){const s=e.theme==="dark"?"light":"dark";e.setTheme(s),Uo(s)}return Be(()=>e.theme,s=>{Uo(s)},{immediate:!0}),{theme:n,isDark:t,toggleTheme:a}}const W0={class:"flex h-screen min-w-[320px] overflow-x-auto bg-retro-black text-retro-text"},G0={class:"flex flex-col overflow-hidden",style:{flex:"3"}},q0={class:"flex-shrink-0 h-14 flex items-center justify-between px-4 border-b border-retro-border bg-retro-panel"},Z0={class:"flex items-center gap-2 min-w-0"},K0={key:0,class:"text-xs text-retro-muted font-mono truncate"},Y0={class:"flex items-center gap-1"},X0=["title"],Q0={class:"flex-1 min-h-0 overflow-y-auto"},J0={class:"relative flex min-w-0",style:{flex:"7"}},eb={class:"flex flex-col overflow-hidden border-l border-retro-border",style:{flex:"2"}},tb={class:"flex flex-col overflow-hidden border-l border-retro-border",style:{flex:"2"}},nb={key:0,class:"absolute inset-0 z-30 flex flex-col overflow-hidden border-l border-retro-border bg-retro-black"},ib=_e({__name:"default",setup(e){const n=_s(),t=Qn(),a=wt(),s=Sr(),{isDark:l,toggleTheme:c}=V0(),m=N(()=>s.diffViewerFile!==null),p=N(()=>n.isChatFullscreen),d=N(()=>p.value),S=N(()=>p.value?7:3),T=$(!1),b=$(""),y=N(()=>{if(!b.value)return"";const j=b.value.replace(/\/+$/,"").split("/");return j[j.length-1]||""}),x=N(()=>y.value?`spec cat :: ${y.value}`:"spec cat");Ns(()=>({title:x.value}));const A=()=>{typeof window<"u"&&n.updateViewport(window.innerWidth)};return ct(async()=>{typeof window<"u"&&(n.updateViewport(window.innerWidth),window.addEventListener("resize",A)),await t.hydrate(),await a.initialize(),await a.loadConversations();try{const j=await $fetch("/api/cwd");b.value=j.cwd}catch{b.value=""}}),gt(()=>{typeof window<"u"&&window.removeEventListener("resize",A)}),(j,B)=>{const q=$m;return i(),u("div",W0,[r("div",G0,[r("div",q0,[r("div",Z0,[B[4]||(B[4]=r("img",{alt:"SpecCat",src:Sm,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)),y.value?(i(),u("span",K0,"/ "+_(y.value),1)):L("",!0)]),r("div",Y0,[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]=(...te)=>o(c)&&o(c)(...te))},[o(l)?(i(),le(o(pa),{key:0,class:"w-5 h-5"})):(i(),le(o(fa),{key:1,class:"w-5 h-5"}))],8,X0),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]=te=>T.value=!0)},[K(o(ts),{class:"w-5 h-5"})])])]),r("div",Q0,[K(q,{"working-directory":b.value},null,8,["working-directory"])])]),r("div",J0,[Re(r("div",eb,[K(cp)],512),[[xo,!d.value]]),Re(r("div",tb,[K(Jp)],512),[[xo,!d.value]]),r("div",{class:"flex flex-col overflow-hidden border-l border-retro-border",style:St({flex:S.value})},[K(Hx)],4),m.value?(i(),u("div",nb,[K(l0,{file:o(s).diffViewerFile,"commit-hash":o(s).diffViewerCommitHash,content:o(s).diffViewerContent,loading:o(s).diffViewerLoading,onClose:B[2]||(B[2]=te=>o(s).closeFileDiff())},null,8,["file","commit-hash","content","loading"])])):L("",!0)]),T.value?(i(),le(H0,{key:0,onClose:B[3]||(B[3]=te=>T.value=!1)})):L("",!0),K(z0)])}}});export{ib as default};