spec-cat 0.1.7 → 0.1.9

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 (34) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/_nuxt/{ymLFov2M.js → 16DJBABF.js} +2 -2
  3. package/.output/public/_nuxt/B9VVEfqz.js +1 -0
  4. package/.output/public/_nuxt/{D7Dly49a.js → BMzDNyt_.js} +1 -1
  5. package/.output/public/_nuxt/{BUjDUFuw.js → BrvVRCvW.js} +1 -1
  6. package/.output/public/_nuxt/{BcYWiiNs.js → CB28b492.js} +1 -1
  7. package/.output/public/_nuxt/{DLG4eq4n.js → CNLJybmU.js} +1 -1
  8. package/.output/public/_nuxt/{D4X_t_YQ.js → DoJp1he7.js} +1 -1
  9. package/.output/public/_nuxt/{Cz-IlgtO.js → VEW4-VYH.js} +1 -1
  10. package/.output/public/_nuxt/builds/latest.json +1 -1
  11. package/.output/public/_nuxt/builds/meta/ea9f9aa8-a63e-4ca0-adb0-e8a1986a938e.json +1 -0
  12. package/.output/public/_nuxt/entry.CPII2zAK.css +1 -0
  13. package/.output/public/_nuxt/{c8QbnNfR.js → gxOWhtvS.js} +1 -1
  14. package/.output/public/_nuxt/jLcAlJI2.js +128 -0
  15. package/.output/server/chunks/_/chat.mjs.map +1 -1
  16. package/.output/server/chunks/_/codexProvider.mjs +61 -13
  17. package/.output/server/chunks/_/codexProvider.mjs.map +1 -1
  18. package/.output/server/chunks/_/providerProcessError.mjs +46 -2
  19. package/.output/server/chunks/_/providerProcessError.mjs.map +1 -1
  20. package/.output/server/chunks/build/client.precomputed.mjs +1 -1
  21. package/.output/server/chunks/build/client.precomputed.mjs.map +1 -1
  22. package/.output/server/chunks/nitro/nitro.mjs +663 -663
  23. package/.output/server/chunks/routes/_ws.mjs +68 -2
  24. package/.output/server/chunks/routes/_ws.mjs.map +1 -1
  25. package/.output/server/chunks/routes/api/chat/worktree-commit.post.mjs +32 -5
  26. package/.output/server/chunks/routes/api/chat/worktree-commit.post.mjs.map +1 -1
  27. package/.output/server/chunks/routes/api/chat.post.mjs +15 -0
  28. package/.output/server/chunks/routes/api/chat.post.mjs.map +1 -1
  29. package/.output/server/package.json +1 -1
  30. package/package.json +1 -1
  31. package/.output/public/_nuxt/BY-imOix.js +0 -126
  32. package/.output/public/_nuxt/CBcR5Zlt.js +0 -1
  33. package/.output/public/_nuxt/builds/meta/0e85c7cb-ccac-4f90-97dc-76fc0bfba3ec.json +0 -1
  34. package/.output/public/_nuxt/entry.CzWCoGku.css +0 -1
@@ -0,0 +1,128 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./BMzDNyt_.js","./16DJBABF.js","./entry.CPII2zAK.css","./BrvVRCvW.js"])))=>i.map(i=>d[i]);
2
+ import{y as i,z as u,A as r,d as Me,C as Q,G as o,P as Pe,R as pt,Q as He,S as me,E as _e,B as S,O as N,g as C,U as Ee,V as sn,k as U,W as kt,H as ge,L as ce,o as ut,X as $t,Y as jo,K as De,Z as vn,T as Jt,_ as En,M as Sn,D as Ke,N as ft,$ as As,I as hr,a0 as Ce,a1 as Cn,a2 as Dt,a3 as Tn,a4 as Dr,a5 as Bs,a6 as go,a7 as Es,a8 as Rs,a9 as Ps,x as Ds,aa as xo}from"./16DJBABF.js";import{r as vt,c as an,b as pr,a as gn}from"./CB28b492.js";import{_ as qr}from"./DlAUqK2U.js";import{S as Ir,i as Is,c as Ls,P as Ns,W as bo,M as yo,d as wo,e as ko,g as ur,f as zo,D as Vo,h as Wo,j as Fs,u as Kn,b as Dn,k as pn,l as Hs,m as Bn,n as tr,a as Co,_ as Os}from"./BMzDNyt_.js";function Us(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 js(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m20.25 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 Lr(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 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:"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 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:"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 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:"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 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.75 3.104v5.714a2.25 2.25 0 0 1-.659 1.591L5 14.5M9.75 3.104c-.251.023-.501.05-.75.082m.75-.082a24.301 24.301 0 0 1 4.5 0m0 0v5.714c0 .597.237 1.17.659 1.591L19.8 15.3M14.25 3.104c.251.023.501.05.75.082M19.8 15.3l-1.57.393A9.065 9.065 0 0 1 12 15a9.065 9.065 0 0 0-6.23-.693L5 14.5m14.8.8 1.402 1.402c1.232 1.232.65 3.318-1.067 3.611A48.309 48.309 0 0 1 12 21c-2.773 0-5.491-.235-8.135-.687-1.718-.293-2.3-2.379-1.067-3.61L5 14.5"})])}function Zr(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m3.75 13.5 10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75Z"})])}function qs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 12.75c1.148 0 2.278.08 3.383.237 1.037.146 1.866.966 1.866 2.013 0 3.728-2.35 6.75-5.25 6.75S6.75 18.728 6.75 15c0-1.046.83-1.867 1.866-2.013A24.204 24.204 0 0 1 12 12.75Zm0 0c2.883 0 5.647.508 8.207 1.44a23.91 23.91 0 0 1-1.152 6.06M12 12.75c-2.883 0-5.647.508-8.208 1.44.125 2.104.52 4.136 1.153 6.06M12 12.75a2.25 2.25 0 0 0 2.248-2.354M12 12.75a2.25 2.25 0 0 1-2.248-2.354M12 8.25c.995 0 1.971-.08 2.922-.236.403-.066.74-.358.795-.762a3.778 3.778 0 0 0-.399-2.25M12 8.25c-.995 0-1.97-.08-2.922-.236-.402-.066-.74-.358-.795-.762a3.734 3.734 0 0 1 .4-2.253M12 8.25a2.25 2.25 0 0 0-2.248 2.146M12 8.25a2.25 2.25 0 0 1 2.248 2.146M8.683 5a6.032 6.032 0 0 1-1.155-1.002c.07-.63.27-1.222.574-1.747m.581 2.749A3.75 3.75 0 0 1 15.318 5m0 0c.427-.283.815-.62 1.155-.999a4.471 4.471 0 0 0-.575-1.752M4.921 6a24.048 24.048 0 0 0-.392 3.314c1.668.546 3.416.914 5.223 1.082M19.08 6c.205 1.08.337 2.187.392 3.314a23.882 23.882 0 0 1-5.223 1.082"})])}function Zs(e,n){return i(),u("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor","aria-hidden":"true","data-slot":"icon"},[r("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M3 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 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:"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 vr(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 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:"m4.5 12.75 6 6 9-13.5"})])}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:"m19.5 8.25-7.5 7.5-7.5-7.5"})])}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:"m8.25 4.5 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 15 12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9"})])}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:"m4.5 15.75 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:"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 Rn(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 Nr(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 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:"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 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:"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 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:"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 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:"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 qn(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 In(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 $n(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 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:"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 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:"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 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:"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 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:"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 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:"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 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:"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 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 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 Zn(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 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 12h14"})])}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:"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 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:"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 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:"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 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.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 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:"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 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:"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 gr(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 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:"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 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:"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 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:"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 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:"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 ha={class:"flex items-center gap-1.5 px-2 py-1.5 bg-retro-panel border-b border-retro-border"},pa={class:"relative flex-1 min-w-0"},va={key:0,class:"text-[11px] text-retro-muted flex-shrink-0 min-w-[60px] text-center"},ga=["disabled"],xa=["disabled"],ba=Me({__name:"GitFindWidget",props:{resultCount:{},currentIndex:{}},emits:["search","next","prev","close"],setup(e,{expose:n,emit:t}){const a=t,s=C(""),l=C(null);let c=null;function f(){c&&clearTimeout(c),c=setTimeout(()=>{a("search",s.value)},200)}function m(w){w.key==="Escape"?(w.preventDefault(),a("close")):w.key==="Enter"&&(w.preventDefault(),w.shiftKey?a("prev"):a("next"))}function d(){l.value?.focus(),l.value?.select()}return n({focus:d}),(w,T)=>(i(),u("div",ha,[Q(o(Zn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("div",pa,[Pe(r("input",{ref_key:"inputRef",ref:l,"onUpdate:modelValue":T[0]||(T[0]=g=>He(s)?s.value=g:null),type:"text",placeholder:"Find in commits... (Ctrl+F)","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:f,onKeydown:m},null,544),[[pt,o(s)]])]),o(s)?(i(),u("span",va,[e.resultCount>0?(i(),u(me,{key:0},[_e(S(e.currentIndex+1)+" of "+S(e.resultCount),1)],64)):(i(),u(me,{key:1},[_e(" No results ")],64))])):N("",!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]=g=>a("prev"))},[Q(o(Xs),{class:"w-4 h-4"})],8,ga),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]=g=>a("next"))},[Q(o(Ys),{class:"w-4 h-4"})],8,xa),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]=g=>a("close"))},[Q(o(vt),{class:"w-4 h-4"})])]))}}),ya={class:"flex flex-col bg-retro-dark border border-retro-border rounded shadow-lg max-w-md w-full"},wa={class:"flex items-center justify-between px-3 py-2 border-b border-retro-border"},ka={class:"flex-1 overflow-auto max-h-[300px]"},Ca={class:"font-semibold text-retro-cyan flex-shrink-0 min-w-[60px]"},$a=["onKeyup"],Sa=["onClick"],_a={class:"text-retro-muted truncate flex-1 font-mono"},Ta=["onClick"],Ma=["onClick"],Aa={key:0,class:"px-3 py-4 text-center text-retro-muted text-xs"},Ba={key:0,class:"px-3 py-2 border-t border-retro-border space-y-2"},Ea={class:"flex gap-2 justify-end"},Ra=["disabled"],Pa={key:1,class:"px-3 py-2 border-t border-retro-border"},Da=Me({__name:"GitRemoteManager",props:{remotes:{},loading:{type:Boolean}},emits:["add","edit","delete","close"],setup(e,{emit:n}){const t=n,a=C(!1),s=C(""),l=C(""),c=C(null),f=C("");function m(){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 w(v){c.value=v.name,f.value=v.fetchUrl}function T(v){f.value.trim()&&(t("edit",{name:v,newUrl:f.value.trim()}),c.value=null)}function g(){c.value=null}return(v,h)=>(i(),u("div",ya,[r("div",wa,[h[5]||(h[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:h[0]||(h[0]=P=>t("close"))},[Q(o(vt),{class:"w-4 h-4"})])]),r("div",ka,[(i(!0),u(me,null,Ee(e.remotes,P=>(i(),u("div",{key:P.name,class:"flex items-center gap-2 px-3 py-2 border-b border-retro-border/50 text-xs"},[r("span",Ca,S(P.name),1),o(c)===P.name?(i(),u(me,{key:0},[Pe(r("input",{"onUpdate:modelValue":h[1]||(h[1]=q=>He(f)?f.value=q: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:[sn(q=>T(P.name),["enter"]),sn(g,["escape"])]},null,40,$a),[[pt,o(f)]]),r("button",{class:"p-0.5 text-retro-green hover:text-retro-green/80",onClick:q=>T(P.name)},[Q(o(Kr),{class:"w-3.5 h-3.5"})],8,Sa),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",onClick:g},[Q(o(vt),{class:"w-3.5 h-3.5"})])],64)):(i(),u(me,{key:1},[r("span",_a,S(P.fetchUrl),1),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-text",title:"Edit",onClick:q=>w(P)},[Q(o(Jr),{class:"w-3.5 h-3.5"})],8,Ta),r("button",{class:"p-0.5 text-retro-muted hover:text-retro-red",title:"Delete",onClick:q=>t("delete",P.name)},[Q(o(an),{class:"w-3.5 h-3.5"})],8,Ma)],64))]))),128)),e.remotes.length===0?(i(),u("div",Aa," No remotes configured ")):N("",!0)]),o(a)?(i(),u("div",Ba,[Pe(r("input",{"onUpdate:modelValue":h[2]||(h[2]=P=>He(s)?s.value=P: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),[[pt,o(s)]]),Pe(r("input",{"onUpdate:modelValue":h[3]||(h[3]=P=>He(l)?l.value=P: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:sn(d,["enter"])},null,544),[[pt,o(l)]]),r("div",Ea,[r("button",{class:"px-2 py-1 text-xs text-retro-muted hover:text-retro-text transition-colors",onClick:h[4]||(h[4]=P=>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,Ra)])])):N("",!0),o(a)?N("",!0):(i(),u("div",Pa,[r("button",{class:"flex items-center gap-1 text-xs text-retro-cyan hover:text-retro-cyan/80 transition-colors",onClick:m},[Q(o(pr),{class:"w-3.5 h-3.5"}),h[6]||(h[6]=_e(" Add Remote ",-1))])]))]))}}),xr={NODE_RADIUS:4,ROW_HEIGHT:32,COLUMN_WIDTH:20,PADDING:10,VISIBLE_BUFFER:10},nr=["#3B82F6","#EF4444","#10B981","#F59E0B","#8B5CF6","#EC4899","#14B8A6","#F97316","#06B6D4","#84CC16","#F43F5E","#A855F7"],Pn={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"}},Ia=["width","height"],La=["d","stroke","stroke-dasharray"],Na={key:0},Fa=["cx","r"],Ha=["cx","r","fill"],Oa=["cx","r","stroke"],Ua=["cx","r","fill"],ja=["cx","r","stroke"],za=["cx","r","fill"],Va=["cx","r"],Wa=["cx","r","fill"],is=Me({__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}=xr,c=U(()=>l*2+(n.maxLane+1)*t),f=a,m=a/2;function d(g){return l+g*t}function w(g){const v=d(g.fromLane),h=d(g.toLane);if(g.type==="vertical")return`M ${v} 0 L ${h} ${f}`;if(g.type==="vertical-top")return`M ${v} 0 L ${v} ${m}`;if(g.type==="vertical-bottom")return`M ${v} ${m} L ${v} ${f}`;if(g.style==="rounded")return`M ${v} ${m} C ${v} ${f}, ${h} ${f}, ${h} ${f}`;{const P=f*.75;return`M ${v} ${m} L ${v} ${P} L ${h} ${f}`}}const T=U(()=>n.rowData?d(n.rowData.lane):l);return(g,v)=>(i(),u("svg",{width:o(c),height:o(f),class:"block flex-shrink-0","aria-hidden":"true"},[e.rowData?(i(),u(me,{key:0},[(i(!0),u(me,null,Ee(e.rowData.connections,(h,P)=>(i(),u("path",{key:P,d:w(h),stroke:h.color,"stroke-width":"2",fill:"none","stroke-dasharray":h.type.startsWith("merge")?"4 3":"none"},null,8,La))),128)),r("g",null,[e.tooltipText?(i(),u("title",Na,S(e.tooltipText),1)):N("",!0),e.rowData.nodeType==="head"?(i(),u(me,{key:1},[r("circle",{cx:o(T),cy:m,r:o(s)+2,fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-cyan"},null,8,Fa),r("circle",{cx:o(T),cy:m,r:o(s),fill:e.rowData.color},null,8,Ha)],64)):e.rowData.nodeType==="merge"?(i(),u(me,{key:2},[r("circle",{cx:o(T),cy:m,r:o(s)+1,fill:"none",stroke:e.rowData.color,"stroke-width":"1.5"},null,8,Oa),r("circle",{cx:o(T),cy:m,r:o(s)-1,fill:e.rowData.color},null,8,Ua)],64)):e.rowData.nodeType==="stash"?(i(),u(me,{key:3},[r("circle",{cx:o(T),cy:m,r:o(s),fill:"none",stroke:e.rowData.color,"stroke-width":"2"},null,8,ja),r("circle",{cx:o(T),cy:m,r:o(s)-2,fill:e.rowData.color},null,8,za)],64)):e.rowData.nodeType==="uncommitted"?(i(),u("circle",{key:4,cx:o(T),cy:m,r:o(s),fill:"none",stroke:"currentColor","stroke-width":"2",class:"text-retro-yellow","stroke-dasharray":"3 2"},null,8,Va)):(i(),u("circle",{key:5,cx:o(T),cy:m,r:o(s),fill:e.rowData.color},null,8,Wa))])],64)):N("",!0)],8,Ia))}}),Ga=["aria-selected","aria-label"],qa={key:1,class:"flex gap-1 flex-shrink-0"},Za=["title","onContextmenu"],Ka={key:2,class:"flex gap-1 flex-shrink-0"},Ya=["onContextmenu"],Xa={class:"text-retro-text text-xs truncate flex-1"},Qa={key:5,class:"flex-shrink-0 text-retro-muted text-[10px] hidden sm:inline"},Ja={key:6,class:"flex-shrink-0 text-retro-muted text-[10px]"},ei=Me({__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=U(()=>{const g=t.commit.branches;if(g.length===0)return[];const v=t.localBranchNames,h=[],P=[];for(const V of g)v.has(V)?h.push(V):P.push(V);const q=new Set(h),A=new Map,ee=[];for(const V of P){const re=V.indexOf("/");if(re>0){const ie=V.substring(re+1),ue=V.substring(0,re);q.has(ie)?(A.has(ie)||A.set(ie,[]),A.get(ie).push(ue)):ee.push(V)}else ee.push(V)}const te=[];for(const V of h){const re=A.get(V)||[];re.length>0?te.push({displayName:`${V}/${re.join(",")}`,originalBranches:[V,...re.map(ie=>`${ie}/${V}`)],isLocal:!0}):te.push({displayName:V,originalBranches:[V],isLocal:!0})}for(const V of ee)te.push({displayName:V,originalBranches:[V],isLocal:!1});return te});function l(g,v){g.preventDefault(),g.stopPropagation();const h=v.originalBranches[0];a("branchContextMenu",{branch:h,x:g.clientX,y:g.clientY,isCurrentBranch:v.isLocal&&v.originalBranches.includes(t.currentBranchName??""),isLocal:v.isLocal})}function c(g,v){g.preventDefault(),g.stopPropagation(),a("tagContextMenu",{tag:v,x:g.clientX,y:g.clientY})}function f(g){g.preventDefault(),g.stopPropagation(),a("commitContextMenu",{x:g.clientX,y:g.clientY})}const{ROW_HEIGHT:m}=xr,d=U(()=>{const g=[t.commit.shortHash];return t.commit.branches.length>0&&g.push(t.commit.branches.join(", ")),t.commit.tags.length>0&&g.push(t.commit.tags.map(v=>`tag: ${v}`).join(", ")),g.join(" — ")});function w(g){const h=Date.now()/1e3-g;return h<60?"just now":h<3600?`${Math.floor(h/60)}m ago`:h<86400?`${Math.floor(h/3600)}h ago`:h<604800?`${Math.floor(h/86400)}d ago`:h<2592e3?`${Math.floor(h/604800)}w ago`:new Date(g*1e3).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function T(g){const v=g.split(`
3
+ `)[0];return v.length>72?v.substring(0,69)+"...":v}return(g,v)=>{const h=is;return i(),u("div",{class:ge(["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:kt({height:`${o(m)}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:v[0]||(v[0]=P=>a("click",P)),onKeydown:v[1]||(v[1]=P=>a("keydown",P)),onContextmenu:f},[Q(h,{rowData:e.graphRowData,maxLane:e.maxLane,tooltipText:o(d)},null,8,["rowData","maxLane","tooltipText"]),r("div",{class:ge(["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:kt({height:`${o(m)-4}px`})},[!e.columnVisibility||e.columnVisibility.commit!==!1?(i(),u("span",{key:0,class:ge(["flex-shrink-0 font-mono text-[11px]",e.commit.isHead?"text-retro-cyan font-semibold":"text-retro-muted"])},S(e.commit.shortHash),3)):N("",!0),o(s).length>0?(i(),u("div",qa,[(i(!0),u(me,null,Ee(o(s),P=>(i(),u("span",{key:P.displayName,class:ge(["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&&P.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":P.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:P.originalBranches.join(", "),onContextmenu:q=>l(q,P)},S(P.displayName),43,Za))),128))])):N("",!0),e.commit.tags.length>0?(i(),u("div",Ka,[(i(!0),u(me,null,Ee(e.commit.tags,P=>(i(),u("span",{key:P,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:q=>c(q,P)},[Q(o(no),{class:"w-2.5 h-2.5"}),_e(" "+S(P),1)],40,Ya))),128))])):N("",!0),r("span",Xa,S(T(e.commit.message)),1),e.commit.signatureStatus==="good"?(i(),ce(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(),ce(o(to),{key:4,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-red",title:"Bad signature"})):N("",!0),!e.columnVisibility||e.columnVisibility.author!==!1?(i(),u("span",Qa,S(e.commit.author),1)):N("",!0),!e.columnVisibility||e.columnVisibility.date!==!1?(i(),u("span",Ja,S(w(e.commit.timestamp)),1)):N("",!0)],6)],46,Ga)}}});function ti(){const{COLUMN_WIDTH:e,ROW_HEIGHT:n,NODE_RADIUS:t,PADDING:a}=xr;function s(m){let d=0;for(let w=0;w<m.length;w++){const T=m.charCodeAt(w);d=(d<<5)-d+T,d=d&d}return Math.abs(d)}function l(m){const d=s(m)%nr.length;return nr[d]}function c(m,d="rounded"){const w=new Map;if(m.length===0)return w;const T=new Set,g=new Map;for(const te of m)g.set(te.hash,te);const v=m.find(te=>te.isHead)||m[0];if(v){let te=v;for(;te;){T.add(te.hash);const V=te.parents?.[0];te=V?g.get(V):void 0}}const h=new Map,P=new Map,q=new Map,A=new Map,ee=new Map;for(let te=0;te<m.length;te++){const V=m[te];ee.set(V.hash,te);const re=T.has(V.hash);let ie,ue;if(A.has(V.hash)){const F=A.get(V.hash);ie=F.lane,ue=F.color,A.delete(V.hash)}else if(re)ie=0,ue=nr[0];else{for(ie=1;q.has(ie);)ie++;ue=l(V.hash.substring(0,7))}h.set(V.hash,ie),P.set(V.hash,ue),q.set(ie,V.hash);const fe=V.isMerge||V.parents&&V.parents.length>1;let ne="regular";V.isHead?ne="head":fe&&(ne="merge"),w.set(V.hash,{commitHash:V.hash,lane:ie,color:ue,nodeType:ne,isMainline:T.has(V.hash),connections:[]});const Z=V.parents||[];for(let F=0;F<Z.length;F++){const B=Z[F];if(h.has(B)||A.has(B))continue;const X=T.has(B);let M,p;if(F===0)M=ie,p=ue;else if(X)M=0,p=nr[0];else{for(M=1;q.has(M)||M===ie;)M++;p=l(B.substring(0,7))}A.set(B,{lane:M,color:p,childHash:V.hash})}const j=Z[0];if(!j)q.delete(ie);else{const F=h.get(j),B=A.get(j),X=F??B?.lane;X!==void 0&&X!==ie&&q.delete(ie)}}for(let te=0;te<m.length;te++){const V=m[te],re=w.get(V.hash);if(!re)continue;const ie=V.parents||[];for(let ue=0;ue<ie.length;ue++){const fe=ie[ue],ne=h.get(fe),Z=ee.get(fe);if(ne===void 0)continue;const j=re.lane,F=ne,B=ue===0?re.color:P.get(fe)||l(fe.substring(0,7));if(j===F?re.connections.push({type:"vertical-bottom",fromLane:j,toLane:F,color:B,style:d}):ue>0?re.connections.push({type:j<F?"merge-out":"merge-in",fromLane:j,toLane:F,color:B,style:d}):re.connections.push({type:j<F?"branch-out":"branch-in",fromLane:j,toLane:F,color:B,style:d}),Z!==void 0&&Z>te+1)for(let X=te+1;X<Z;X++){const M=m[X],p=w.get(M.hash);p&&p.connections.push({type:"vertical",fromLane:F,toLane:F,color:B,style:d})}if(Z!==void 0){const X=w.get(fe);X&&X.connections.push({type:"vertical-top",fromLane:F,toLane:F,color:B,style:d})}}}return w}function f(m){let d=0;for(const w of m.values()){w.lane>d&&(d=w.lane);for(const T of w.connections)T.fromLane>d&&(d=T.fromLane),T.toLane>d&&(d=T.toLane)}return d}return{computeGraphRows:c,computeMaxLane:f,getBranchColor:l,COLUMN_WIDTH:e,ROW_HEIGHT:n,NODE_RADIUS:t,PADDING:a}}const ni=["aria-selected"],ri={class:"text-retro-yellow text-xs font-medium"},oi={key:1,class:"flex items-center justify-center gap-2 p-2 text-retro-muted text-sm"},si={key:2,class:"p-2 text-center text-retro-muted/50 text-xs"},ai=Me({__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(R){(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),s("selectUncommittedChanges"))}const f=U(()=>a.searchQuery?.toLowerCase()??""),m=U(()=>new Set(a.highlightBranches??[])),d=U(()=>m.value.size>0),w=U(()=>{const R=f.value;if(!R)return new Set;const $=new Set;for(const I of a.commits)(I.message.toLowerCase().includes(R)||I.author.toLowerCase().includes(R)||I.shortHash.toLowerCase().includes(R)||I.hash.toLowerCase().includes(R)||I.branches.some(L=>L.toLowerCase().includes(R))||I.tags.some(L=>L.toLowerCase().includes(R)))&&$.add(I.hash);return $}),T=U(()=>{if(!d.value)return new Set;const R=new Set;for(const $ of a.commits)$.branches.some(I=>m.value.has(I))&&R.add($.hash);return R}),g=U(()=>{if(!a.featureHighlightBranches||a.featureHighlightBranches.length===0)return new Set;const R=a.featureMergeBases??{},$=new Map;for(const L of a.commits)$.set(L.hash,L);const I=new Set;for(const L of a.featureHighlightBranches){const K=a.commits.find(Te=>Te.branches.includes(L));if(!K)continue;const ve=R[L]??null;if(!ve)continue;let xe=K;for(;xe&&xe.hash!==ve;)I.add(xe.hash),xe=xe.parents?.[0]?$.get(xe.parents[0]):void 0}return I}),v=U(()=>{if(!a.previewHighlightBranches||a.previewHighlightBranches.length===0)return new Set;const R=a.previewMergeBases??{},$=new Map;for(const L of a.commits)$.set(L.hash,L);const I=new Set;for(const L of a.previewHighlightBranches){const K=a.commits.find(Te=>Te.branches.includes(L));if(!K)continue;const ve=R[L]??null;if(!ve)continue;let xe=K;for(;xe&&xe.hash!==ve;)I.add(xe.hash),xe=xe.parents?.[0]?$.get(xe.parents[0]):void 0}return I});function h(R,$){s("branchContextMenu",{...$,commitHash:R.hash})}function P(R,$){s("commitContextMenu",{commit:R,...$})}function q(R,$){s("tagContextMenu",{...$,commitHash:R.hash})}const{ROW_HEIGHT:A,VISIBLE_BUFFER:ee}=xr,{computeGraphRows:te,computeMaxLane:V}=ti(),re=U(()=>te([...a.commits],a.graphStyle)),ie=U(()=>V(re.value)),ue=U(()=>{const R=a.stashes||[];if(R.length===0)return a.commits.map((K,ve)=>({type:"commit",commit:K,commitIndex:ve}));const $=[],I=[...R].sort((K,ve)=>new Date(ve.date).getTime()-new Date(K.date).getTime());let L=0;for(let K=0;K<a.commits.length;K++){const ve=a.commits[K],xe=ve.timestamp*1e3;for(;L<I.length&&new Date(I[L].date).getTime()>=xe;)$.push({type:"stash",stash:I[L]}),L++;$.push({type:"commit",commit:ve,commitIndex:K})}for(;L<I.length;)$.push({type:"stash",stash:I[L]}),L++;return $}),fe=C(null),ne=C(0),Z=C(400);let j=null;const F=U(()=>{const R=ee,$=ue.value.length,I=Math.max(0,Math.floor(ne.value/A)-R),L=Math.min($,Math.ceil((ne.value+Z.value)/A)+R);return{startIndex:I,endIndex:L}}),B=U(()=>{const{startIndex:R,endIndex:$}=F.value;return ue.value.slice(R,$).map((I,L)=>({row:I,index:R+L,graphRow:I.type==="commit"&&re.value.get(I.commit.hash)||null,isHighlighted:I.type==="commit"?w.value.has(I.commit.hash):!1,isBranchHighlighted:I.type==="commit"?T.value.has(I.commit.hash):!1,isFeatureHighlighted:I.type==="commit"?g.value.has(I.commit.hash):!1,isPreviewHighlighted:I.type==="commit"?v.value.has(I.commit.hash):!1,isMuted:I.type==="commit"&&a.muteNonAncestral?!(re.value.get(I.commit.hash)?.isMainline??!1):!1}))}),X=U(()=>ue.value.length*A),M=U(()=>F.value.startIndex*A);function p(R){const $=R.target;ne.value=$.scrollTop,j||s("scrollStart"),j&&clearTimeout(j),j=setTimeout(()=>{j=null,s("scrollEnd")},150),a.hasMore&&!a.loading&&!a.loadingMore&&$.scrollTop+$.clientHeight>=$.scrollHeight-200&&s("loadMore")}function k(R,$){$.ctrlKey||$.metaKey?s("compareSelect",R):s("select",R)}function H(R,$,I){if(R.key==="Enter"||R.key===" ")R.preventDefault(),s("select",$);else if(R.key==="ArrowDown"){R.preventDefault();for(let L=I+1;L<ue.value.length;L++){const K=ue.value[L];if(K.type==="commit"){s("select",K.commit),W(L);break}}}else if(R.key==="ArrowUp"){R.preventDefault();for(let L=I-1;L>=0;L--){const K=ue.value[L];if(K.type==="commit"){s("select",K.commit),W(L);break}}}}function W(R){if(!fe.value)return;const $=R*A,I=fe.value.scrollTop,L=I+fe.value.clientHeight;$<I?fe.value.scrollTop=$:$+A>L&&(fe.value.scrollTop=$+A-fe.value.clientHeight)}ut(()=>{if(fe.value){Z.value=fe.value.clientHeight;const R=new ResizeObserver($=>{for(const I of $)Z.value=I.contentRect.height});R.observe(fe.value),$t(()=>R.disconnect())}});function ae(){return fe.value?.scrollTop??0}function G(R){fe.value&&(fe.value.scrollTop=R)}return n({getScrollPosition:ae,setScrollPosition:G,scrollToIndex:W}),(R,$)=>{const I=is,L=ei;return i(),u("div",{ref_key:"containerRef",ref:fe,class:"h-full overflow-auto",role:"list","aria-label":"Commit history",onScroll:p},[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:kt({height:`${o(A)}px`}),role:"button",tabindex:"0","aria-selected":e.isUncommittedChangesSelected,onClick:l,onKeydown:c},[Q(I,{rowData:{commitHash:"uncommitted",lane:0,color:"#F59E0B",nodeType:"uncommitted",isMainline:!1,connections:[]},maxLane:o(ie)},null,8,["maxLane"]),r("div",{class:ge(["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:kt({height:`${o(A)-4}px`})},[Q(o(In),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),r("span",ri," Uncommitted Changes ("+S(e.uncommittedChangesCount)+") ",1),$[1]||($[1]=r("span",{class:"flex-1"},null,-1)),$[2]||($[2]=r("span",{class:"text-retro-muted text-[10px]"},"Working tree",-1))],6)],44,ni)):N("",!0),r("div",{class:"relative",style:kt({height:`${o(X)}px`})},[r("div",{class:"absolute left-0 right-0",style:kt({transform:`translateY(${o(M)}px)`})},[(i(!0),u(me,null,Ee(o(B),({row:K,index:ve,graphRow:xe,isHighlighted:Te,isBranchHighlighted:qe,isFeatureHighlighted:Ye,isPreviewHighlighted:Y,isMuted:de})=>(i(),u(me,{key:K.type==="commit"?K.commit.hash:`stash-${K.stash.index}`},[K.type==="commit"?jo([K.commit.hash,K.commit.message,K.commit.timestamp,K.commit.branches.join("|"),K.commit.tags.join("|"),e.selectedCommit?.hash===K.commit.hash,Te,qe,Ye,Y,de,a.currentBranchName||"",a.columnVisibility?.date!==!1,a.columnVisibility?.author!==!1,a.columnVisibility?.commit!==!1],()=>(i(),ce(L,{key:0,commit:K.commit,index:K.commitIndex,isSelected:e.selectedCommit?.hash===K.commit.hash,isHighlighted:Te,isBranchHighlighted:qe,isFeatureHighlighted:Ye,isPreviewHighlighted:Y,isMuted:de,currentBranchName:a.currentBranchName,localBranchNames:a.localBranchNames,graphRowData:xe,maxLane:o(ie),columnVisibility:a.columnVisibility,onClick:oe=>k(K.commit,oe),onKeydown:oe=>H(oe,K.commit,ve),onBranchContextMenu:oe=>h(K.commit,oe),onCommitContextMenu:oe=>P(K.commit,oe),onTagContextMenu:oe=>q(K.commit,oe)},null,8,["commit","index","isSelected","isHighlighted","isBranchHighlighted","isFeatureHighlighted","isPreviewHighlighted","isMuted","currentBranchName","localBranchNames","graphRowData","maxLane","columnVisibility","onClick","onKeydown","onBranchContextMenu","onCommitContextMenu","onTagContextMenu"])),$,0):N("",!0)],64))),128))],4)],4),(e.loading||e.loadingMore)&&e.commits.length>0?(i(),u("div",oi,[...$[3]||($[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)])])):N("",!0),!e.hasMore&&e.commits.length>0&&!e.loading?(i(),u("div",si,S(e.commits.length)+" commits loaded ",1)):N("",!0)],544)}}});function ii(e){const n=e.charAt(0).toUpperCase();return n in Pn?n:"M"}function rr(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 li(e,n){return n.size===0?[...e]:e.filter(t=>t.branches.some(a=>n.has(a)))}const ci={class:"flex flex-col h-full border-t border-retro-border bg-retro-dark"},ui={class:"flex items-center justify-between p-2 border-b border-retro-border flex-shrink-0"},di={class:"flex items-center gap-2 text-xs min-w-0"},fi={class:"font-mono text-retro-cyan"},mi={class:"font-mono text-retro-cyan"},hi={key:0,class:"px-3 py-1.5 text-xs text-retro-muted border-b border-retro-border flex-shrink-0"},pi={class:"text-retro-green"},vi={class:"text-retro-red"},gi={key:1,class:"flex-1 flex items-center justify-center"},xi={key:2,class:"flex-1 overflow-auto"},bi={class:"text-retro-text truncate flex-1"},yi={class:"text-retro-muted"},wi={key:0,class:"flex-shrink-0 text-[10px] font-mono"},ki={key:0,class:"text-retro-green"},Ci={key:1,class:"text-retro-red ml-1"},$i={key:1,class:"flex-shrink-0 text-[10px] text-retro-muted italic"},Si={key:3,class:"flex-1 flex items-center justify-center text-retro-muted text-sm"},_i=Me({__name:"GitComparisonView",props:{fromCommit:{},toCommit:{},files:{},stats:{},loading:{type:Boolean}},emits:["close"],setup(e,{emit:n}){const t=n;function a(s){const l=ii(s);return Pn[l]||Pn.M}return(s,l)=>(i(),u("div",ci,[r("div",ui,[r("div",di,[l[1]||(l[1]=r("span",{class:"text-retro-muted"},"Comparing",-1)),r("span",fi,S(e.fromCommit.shortHash),1),l[2]||(l[2]=r("span",{class:"text-retro-muted"},"→",-1)),r("span",mi,S(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"))},[Q(o(vt),{class:"w-4 h-4"})])]),e.stats?(i(),u("div",hi,[_e(S(e.stats.filesChanged)+" file"+S(e.stats.filesChanged!==1?"s":"")+" changed, ",1),r("span",pi,"+"+S(e.stats.additions),1),r("span",vi," -"+S(e.stats.deletions),1)])):N("",!0),e.loading?(i(),u("div",gi,[...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",xi,[(i(!0),u(me,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:ge(["flex-shrink-0 w-4 text-center font-semibold text-[10px]",a(c.status).colorClass])},S(c.status.charAt(0)),3),r("span",bi,[c.oldPath&&c.status.startsWith("R")?(i(),u(me,{key:0},[r("span",yi,S(c.oldPath),1),l[4]||(l[4]=r("span",{class:"text-retro-muted mx-1"},"→",-1))],64)):N("",!0),_e(" "+S(c.path),1)]),c.binary?(i(),u("span",$i,"binary")):(i(),u("span",wi,[c.additions>0?(i(),u("span",ki,"+"+S(c.additions),1)):N("",!0),c.deletions>0?(i(),u("span",Ci,"-"+S(c.deletions),1)):N("",!0)]))]))),128))])):e.files&&e.files.length===0?(i(),u("div",Si," No differences between these commits ")):N("",!0)]))}});function ro(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Mn=ro();function ls(e){Mn=e}var Gn={exec:()=>null};function Ge(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(Ct.caret,"$1"),t=t.replace(s,c),a},getRegex:()=>new RegExp(t,n)};return a}var Ct={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")},Ti=/^(?:[ \t]*(?:\n|$))+/,Mi=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ai=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Yn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Bi=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,oo=/(?:[*+-]|\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=Ge(cs).replace(/bull/g,oo).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(),Ei=Ge(cs).replace(/bull/g,oo).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(),so=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Ri=/^[^\n]+/,ao=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Pi=Ge(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",ao).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Di=Ge(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,oo).getRegex(),br="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",io=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Ii=Ge("^ {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",io).replace("tag",br).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ds=Ge(so).replace("hr",Yn).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",br).getRegex(),Li=Ge(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",ds).getRegex(),lo={blockquote:Li,code:Mi,def:Pi,fences:Ai,heading:Bi,hr:Yn,html:Ii,lheading:us,list:Di,newline:Ti,paragraph:ds,table:Gn,text:Ri},_o=Ge("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Yn).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",br).getRegex(),Ni={...lo,lheading:Ei,table:_o,paragraph:Ge(so).replace("hr",Yn).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",br).getRegex()},Fi={...lo,html:Ge(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",io).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:Gn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Ge(so).replace("hr",Yn).replace("heading",` *#{1,6} *[^
5
+ ]`).replace("lheading",us).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Hi=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Oi=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,fs=/^( {2,}|\\)\n(?!\s*$)/,Ui=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,yr=/[\p{P}\p{S}]/u,co=/[\s\p{P}\p{S}]/u,ms=/[^\s\p{P}\p{S}]/u,ji=Ge(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,co).getRegex(),hs=/(?!~)[\p{P}\p{S}]/u,zi=/(?!~)[\s\p{P}\p{S}]/u,Vi=/(?:[^\s\p{P}\p{S}]|~)/u,Wi=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,ps=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Gi=Ge(ps,"u").replace(/punct/g,yr).getRegex(),qi=Ge(ps,"u").replace(/punct/g,hs).getRegex(),vs="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Zi=Ge(vs,"gu").replace(/notPunctSpace/g,ms).replace(/punctSpace/g,co).replace(/punct/g,yr).getRegex(),Ki=Ge(vs,"gu").replace(/notPunctSpace/g,Vi).replace(/punctSpace/g,zi).replace(/punct/g,hs).getRegex(),Yi=Ge("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,ms).replace(/punctSpace/g,co).replace(/punct/g,yr).getRegex(),Xi=Ge(/\\(punct)/,"gu").replace(/punct/g,yr).getRegex(),Qi=Ge(/^<(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(),Ji=Ge(io).replace("(?:-->|$)","-->").getRegex(),el=Ge("^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",Ji).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),dr=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,tl=Ge(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",dr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),gs=Ge(/^!?\[(label)\]\[(ref)\]/).replace("label",dr).replace("ref",ao).getRegex(),xs=Ge(/^!?\[(ref)\](?:\[\])?/).replace("ref",ao).getRegex(),nl=Ge("reflink|nolink(?!\\()","g").replace("reflink",gs).replace("nolink",xs).getRegex(),uo={_backpedal:Gn,anyPunctuation:Xi,autolink:Qi,blockSkip:Wi,br:fs,code:Oi,del:Gn,emStrongLDelim:Gi,emStrongRDelimAst:Zi,emStrongRDelimUnd:Yi,escape:Hi,link:tl,nolink:xs,punctuation:ji,reflink:gs,reflinkSearch:nl,tag:el,text:Ui,url:Gn},rl={...uo,link:Ge(/^!?\[(label)\]\((.*?)\)/).replace("label",dr).getRegex(),reflink:Ge(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",dr).getRegex()},Or={...uo,emStrongRDelimAst:Ki,emStrongLDelim:qi,url:Ge(/^((?: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.!#$%&'*+\/=?_`{\|}~-]+@)))/},ol={...Or,br:Ge(fs).replace("{2,}","*").getRegex(),text:Ge(Or.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},or={normal:lo,gfm:Ni,pedantic:Fi},Hn={normal:uo,gfm:Or,breaks:ol,pedantic:rl},sl={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},To=e=>sl[e];function Xt(e,n){if(n){if(Ct.escapeTest.test(e))return e.replace(Ct.escapeReplace,To)}else if(Ct.escapeTestNoEncode.test(e))return e.replace(Ct.escapeReplaceNoEncode,To);return e}function Mo(e){try{e=encodeURI(e).replace(Ct.percentDecode,"%")}catch{return null}return e}function Ao(e,n){const t=e.replace(Ct.findPipe,(l,c,f)=>{let m=!1,d=c;for(;--d>=0&&f[d]==="\\";)m=!m;return m?"|":" |"}),a=t.split(Ct.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(Ct.slashPipe,"|");return a}function On(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 al(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,f=e[1].replace(s.other.outputLinkReplace,"$1");a.state.inLink=!0;const m={type:e[0].charAt(0)==="!"?"image":"link",raw:t,href:l,title:c,text:f,tokens:a.inlineTokens(f)};return a.state.inLink=!1,m}function il(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[f]=c;return f.length>=s.length?l.slice(s.length):l}).join(`
7
+ `)}var fr=class{options;rules;lexer;constructor(e){this.options=e||Mn}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:On(t,`
8
+ `)}}}fences(e){const n=this.rules.block.fences.exec(e);if(n){const t=n[0],a=il(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=On(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:On(n[0],`
9
+ `)}}blockquote(e){const n=this.rules.block.blockquote.exec(e);if(n){let t=On(n[0],`
10
+ `).split(`
11
+ `),a="",s="";const l=[];for(;t.length>0;){let c=!1;const f=[];let m;for(m=0;m<t.length;m++)if(this.rules.other.blockquoteStart.test(t[m]))f.push(t[m]),c=!0;else if(!c)f.push(t[m]);else break;t=t.slice(m);const d=f.join(`
12
+ `),w=d.replace(this.rules.other.blockquoteSetextReplace,`
13
+ $1`).replace(this.rules.other.blockquoteSetextReplace2,"");a=a?`${a}
14
+ ${d}`:d,s=s?`${s}
15
+ ${w}`:w;const T=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(w,l,!0),this.lexer.state.top=T,t.length===0)break;const g=l.at(-1);if(g?.type==="code")break;if(g?.type==="blockquote"){const v=g,h=v.raw+`
16
+ `+t.join(`
17
+ `),P=this.blockquote(h);l[l.length-1]=P,a=a.substring(0,a.length-v.raw.length)+P.raw,s=s.substring(0,s.length-v.text.length)+P.text;break}else if(g?.type==="list"){const v=g,h=v.raw+`
18
+ `+t.join(`
19
+ `),P=this.list(h);l[l.length-1]=P,a=a.substring(0,a.length-g.raw.length)+P.raw,s=s.substring(0,s.length-v.raw.length)+P.raw,t=h.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 m=!1,d="",w="";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,A=>" ".repeat(3*A.length)),g=e.split(`
22
+ `,1)[0],v=!T.trim(),h=0;if(this.options.pedantic?(h=2,w=T.trimStart()):v?h=n[1].length+1:(h=n[2].search(this.rules.other.nonSpaceChar),h=h>4?1:h,w=T.slice(h),h+=n[1].length),v&&this.rules.other.blankLine.test(g)&&(d+=g+`
23
+ `,e=e.substring(g.length+1),m=!0),!m){const A=this.rules.other.nextBulletRegex(h),ee=this.rules.other.hrRegex(h),te=this.rules.other.fencesBeginRegex(h),V=this.rules.other.headingBeginRegex(h),re=this.rules.other.htmlBeginRegex(h);for(;e;){const ie=e.split(`
24
+ `,1)[0];let ue;if(g=ie,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),ue=g):ue=g.replace(this.rules.other.tabCharGlobal," "),te.test(g)||V.test(g)||re.test(g)||A.test(g)||ee.test(g))break;if(ue.search(this.rules.other.nonSpaceChar)>=h||!g.trim())w+=`
25
+ `+ue.slice(h);else{if(v||T.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||te.test(T)||V.test(T)||ee.test(T))break;w+=`
26
+ `+g}!v&&!g.trim()&&(v=!0),d+=ie+`
27
+ `,e=e.substring(ie.length+1),T=ue.slice(h)}}s.loose||(c?s.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(c=!0));let P=null,q;this.options.gfm&&(P=this.rules.other.listIsTask.exec(w),P&&(q=P[0]!=="[ ] ",w=w.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:d,task:!!P,checked:q,loose:!1,text:w,tokens:[]}),s.raw+=d}const f=s.items.at(-1);if(f)f.raw=f.raw.trimEnd(),f.text=f.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let m=0;m<s.items.length;m++)if(this.lexer.state.top=!1,s.items[m].tokens=this.lexer.blockTokens(s.items[m].text,[]),!s.loose){const d=s.items[m].tokens.filter(T=>T.type==="space"),w=d.length>0&&d.some(T=>this.rules.other.anyLine.test(T.raw));s.loose=w}if(s.loose)for(let m=0;m<s.items.length;m++)s.items[m].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((f,m)=>({text:f,tokens:this.lexer.inline(f),header:!1,align:l.align[m]})));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=On(t.slice(0,-1),"\\");if((t.length-l.length)%2===0)return}else{const l=al(n[2],"()");if(l===-2)return;if(l>-1){const f=(n[0].indexOf("!")===0?5:4)+n[1].length+l;n[2]=n[2].substring(0,l),n[0]=n[0].substring(0,f).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,f,m=l,d=0;const w=a[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(w.lastIndex=0,n=n.slice(-1*e.length+l);(a=w.exec(n))!=null;){if(c=a[1]||a[2]||a[3]||a[4]||a[5]||a[6],!c)continue;if(f=[...c].length,a[3]||a[4]){m+=f;continue}else if((a[5]||a[6])&&l%3&&!((l+f)%3)){d+=f;continue}if(m-=f,m>0)continue;f=Math.min(f,f+m+d);const T=[...a[0]][0].length,g=e.slice(0,l+a.index+T+f);if(Math.min(l,f)%2){const h=g.slice(1,-1);return{type:"em",raw:g,text:h,tokens:this.lexer.inlineTokens(h)}}const v=g.slice(2,-2);return{type:"strong",raw:g,text:v,tokens:this.lexer.inlineTokens(v)}}}}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}}}},rn=class Ur{tokens;options;state;tokenizer;inlineQueue;constructor(n){this.tokens=[],this.tokens.links=Object.create(null),this.options=n||Mn,this.options.tokenizer=this.options.tokenizer||new fr,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:Ct,block:or.normal,inline:Hn.normal};this.options.pedantic?(t.block=or.pedantic,t.inline=Hn.pedantic):this.options.gfm&&(t.block=or.gfm,this.options.breaks?t.inline=Hn.breaks:t.inline=Hn.gfm),this.tokenizer.rules=t}static get rules(){return{block:or,inline:Hn}}static lex(n,t){return new Ur(t).lex(n)}static lexInline(n,t){return new Ur(t).inlineTokens(n)}lex(n){n=n.replace(Ct.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(Ct.tabCharGlobal," ").replace(Ct.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 f=n.slice(1);let m;this.options.extensions.startBlock.forEach(d=>{m=d.call({lexer:this},f),typeof m=="number"&&m>=0&&(c=Math.min(c,m))}),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 f=Object.keys(this.tokens.links);if(f.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)f.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 f;if(this.options.extensions?.inline?.some(d=>(f=d.call({lexer:this},n,t))?(n=n.substring(f.raw.length),t.push(f),!0):!1))continue;if(f=this.tokenizer.escape(n)){n=n.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.tag(n)){n=n.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.link(n)){n=n.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.reflink(n,this.tokens.links)){n=n.substring(f.raw.length);const d=t.at(-1);f.type==="text"&&d?.type==="text"?(d.raw+=f.raw,d.text+=f.text):t.push(f);continue}if(f=this.tokenizer.emStrong(n,a,c)){n=n.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.codespan(n)){n=n.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.br(n)){n=n.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.del(n)){n=n.substring(f.raw.length),t.push(f);continue}if(f=this.tokenizer.autolink(n)){n=n.substring(f.raw.length),t.push(f);continue}if(!this.state.inLink&&(f=this.tokenizer.url(n))){n=n.substring(f.raw.length),t.push(f);continue}let m=n;if(this.options.extensions?.startInline){let d=1/0;const w=n.slice(1);let T;this.options.extensions.startInline.forEach(g=>{T=g.call({lexer:this},w),typeof T=="number"&&T>=0&&(d=Math.min(d,T))}),d<1/0&&d>=0&&(m=n.substring(0,d+1))}if(f=this.tokenizer.inlineText(m)){n=n.substring(f.raw.length),f.raw.slice(-1)!=="_"&&(c=f.raw.slice(-1)),l=!0;const d=t.at(-1);d?.type==="text"?(d.raw+=f.raw,d.text+=f.text):t.push(f);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}},mr=class{options;parser;constructor(e){this.options=e||Mn}space(e){return""}code({text:e,lang:n,escaped:t}){const a=(n||"").match(Ct.notSpaceStart)?.[0],s=e.replace(Ct.endingNewline,"")+`
40
+ `;return a?'<pre><code class="language-'+Xt(a)+'">'+(t?s:Xt(s,!0))+`</code></pre>
41
+ `:"<pre><code>"+(t?s:Xt(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 f=e.items[c];a+=this.listitem(f)}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+" "+Xt(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>${Xt(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:n,tokens:t}){const a=this.parser.parseInline(t),s=Mo(e);if(s===null)return a;e=s;let l='<a href="'+e+'"';return n&&(l+=' title="'+Xt(n)+'"'),l+=">"+a+"</a>",l}image({href:e,title:n,text:t,tokens:a}){a&&(t=this.parser.parseInline(a,this.parser.textRenderer));const s=Mo(e);if(s===null)return Xt(t);e=s;let l=`<img src="${e}" alt="${t}"`;return n&&(l+=` title="${Xt(n)}"`),l+=">",l}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Xt(e.text)}},fo=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""}},on=class jr{options;renderer;textRenderer;constructor(n){this.options=n||Mn,this.options.renderer=this.options.renderer||new mr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new fo}static parse(n,t){return new jr(t).parse(n)}static parseInline(n,t){return new jr(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 f=l,m=this.options.extensions.renderers[f.type].call({parser:this},f);if(m!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(f.type)){a+=m||"";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 f=c,m=this.renderer.text(f);for(;s+1<n.length&&n[s+1].type==="text";)f=n[++s],m+=`
58
+ `+this.renderer.text(f);t?a+=this.renderer.paragraph({type:"paragraph",raw:m,text:m,tokens:[{type:"text",raw:m,text:m,escaped:!0}]}):a+=m;continue}default:{const f='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(f),"";throw new Error(f)}}}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 f=this.options.extensions.renderers[l.type].call({parser:this},l);if(f!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){a+=f||"";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 f='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(f),"";throw new Error(f)}}}return a}},lr=class{options;block;constructor(e){this.options=e||Mn}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?rn.lex:rn.lexInline}provideParser(){return this.block?on.parse:on.parseInline}},ll=class{defaults=ro();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=on;Renderer=mr;TextRenderer=fo;Lexer=rn;Tokenizer=fr;Hooks=lr;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 f=s.renderer.apply(this,c);return f===!1&&(f=l.apply(this,c)),f}: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 mr(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,f=t.renderer[c],m=s[c];s[c]=(...d)=>{let w=f.apply(s,d);return w===!1&&(w=m.apply(s,d)),w||""}}a.renderer=s}if(t.tokenizer){const s=this.defaults.tokenizer||new fr(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,f=t.tokenizer[c],m=s[c];s[c]=(...d)=>{let w=f.apply(s,d);return w===!1&&(w=m.apply(s,d)),w}}a.tokenizer=s}if(t.hooks){const s=this.defaults.hooks||new lr;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,f=t.hooks[c],m=s[c];lr.passThroughHooks.has(l)?s[c]=d=>{if(this.defaults.async)return Promise.resolve(f.call(s,d)).then(T=>m.call(s,T));const w=f.call(s,d);return m.call(s,w)}:s[c]=(...d)=>{let w=f.apply(s,d);return w===!1&&(w=m.apply(s,d)),w}}a.hooks=s}if(t.walkTokens){const s=this.defaults.walkTokens,l=t.walkTokens;a.walkTokens=function(c){let f=[];return f.push(l.call(this,c)),s&&(f=f.concat(s.call(this,c))),f}}this.defaults={...this.defaults,...a}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,n){return rn.lex(e,n??this.defaults)}parser(e,n){return on.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 f=l.hooks?l.hooks.provideLexer():e?rn.lex:rn.lexInline,m=l.hooks?l.hooks.provideParser():e?on.parse:on.parseInline;if(l.async)return Promise.resolve(l.hooks?l.hooks.preprocess(t):t).then(d=>f(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=>m(d,l)).then(d=>l.hooks?l.hooks.postprocess(d):d).catch(c);try{l.hooks&&(t=l.hooks.preprocess(t));let d=f(t,l);l.hooks&&(d=l.hooks.processAllTokens(d)),l.walkTokens&&this.walkTokens(d,l.walkTokens);let w=m(d,l);return l.hooks&&(w=l.hooks.postprocess(w)),w}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>"+Xt(t.message+"",!0)+"</pre>";return n?Promise.resolve(a):a}if(n)return Promise.reject(t);throw t}}},_n=new ll;function We(e,n){return _n.parse(e,n)}We.options=We.setOptions=function(e){return _n.setOptions(e),We.defaults=_n.defaults,ls(We.defaults),We};We.getDefaults=ro;We.defaults=Mn;We.use=function(...e){return _n.use(...e),We.defaults=_n.defaults,ls(We.defaults),We};We.walkTokens=function(e,n){return _n.walkTokens(e,n)};We.parseInline=_n.parseInline;We.Parser=on;We.parser=on.parse;We.Renderer=mr;We.TextRenderer=fo;We.Lexer=rn;We.lexer=rn.lex;We.Tokenizer=fr;We.Hooks=lr;We.parse=We;We.options;We.setOptions;We.use;We.walkTokens;We.parseInline;on.parse;rn.lex;const{entries:bs,setPrototypeOf:Eo,isFrozen:cl,getPrototypeOf:ul,getOwnPropertyDescriptor:dl}=Object;let{freeze:St,seal:Ft,create:zr}=Object,{apply:Vr,construct:Wr}=typeof Reflect<"u"&&Reflect;St||(St=function(n){return n});Ft||(Ft=function(n){return n});Vr||(Vr=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)});Wr||(Wr=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 sr=_t(Array.prototype.forEach),fl=_t(Array.prototype.lastIndexOf),Ro=_t(Array.prototype.pop),Un=_t(Array.prototype.push),ml=_t(Array.prototype.splice),cr=_t(String.prototype.toLowerCase),_r=_t(String.prototype.toString),Tr=_t(String.prototype.match),jn=_t(String.prototype.replace),hl=_t(String.prototype.indexOf),pl=_t(String.prototype.trim),jt=_t(Object.prototype.hasOwnProperty),wt=_t(RegExp.prototype.test),zn=vl(TypeError);function _t(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 Vr(e,n,a)}}function vl(e){return function(){for(var n=arguments.length,t=new Array(n),a=0;a<n;a++)t[a]=arguments[a];return Wr(e,t)}}function Le(e,n){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:cr;Eo&&Eo(e,null);let a=n.length;for(;a--;){let s=n[a];if(typeof s=="string"){const l=t(s);l!==s&&(cl(n)||(n[a]=l),s=l)}e[s]=!0}return e}function gl(e){for(let n=0;n<e.length;n++)jt(e,n)||(e[n]=null);return e}function Qt(e){const n=zr(null);for(const[t,a]of bs(e))jt(e,t)&&(Array.isArray(a)?n[t]=gl(a):a&&typeof a=="object"&&a.constructor===Object?n[t]=Qt(a):n[t]=a);return n}function Vn(e,n){for(;e!==null;){const a=dl(e,n);if(a){if(a.get)return _t(a.get);if(typeof a.value=="function")return _t(a.value)}e=ul(e)}function t(){return null}return t}const Po=St(["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"]),Mr=St(["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"]),Ar=St(["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"]),xl=St(["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"]),Br=St(["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"]),bl=St(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Do=St(["#text"]),Io=St(["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"]),Er=St(["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=St(["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"]),ar=St(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),yl=Ft(/\{\{[\w\W]*|[\w\W]*\}\}/gm),wl=Ft(/<%[\w\W]*|[\w\W]*%>/gm),kl=Ft(/\$\{[\w\W]*/gm),Cl=Ft(/^data-[\-\w.\u00B7-\uFFFF]+$/),$l=Ft(/^aria-[\-\w]+$/),ys=Ft(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Sl=Ft(/^(?:\w+script|data):/i),_l=Ft(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ws=Ft(/^html$/i),Tl=Ft(/^[a-z][.\w]*(-[.\w]+)+$/i);var No=Object.freeze({__proto__:null,ARIA_ATTR:$l,ATTR_WHITESPACE:_l,CUSTOM_ELEMENT:Tl,DATA_ATTR:Cl,DOCTYPE_NAME:ws,ERB_EXPR:wl,IS_ALLOWED_URI:ys,IS_SCRIPT_OR_DATA:Sl,MUSTACHE_EXPR:yl,TMPLIT_EXPR:kl});const Wn={element:1,text:3,progressingInstruction:7,comment:8,document:9},Ml=function(){return typeof window>"u"?null:window},Al=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]:Ml();const n=pe=>ks(pe);if(n.version="3.3.1",n.removed=[],!e||!e.document||e.document.nodeType!==Wn.document||!e.Element)return n.isSupported=!1,n;let{document:t}=e;const a=t,s=a.currentScript,{DocumentFragment:l,HTMLTemplateElement:c,Node:f,Element:m,NodeFilter:d,NamedNodeMap:w=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:T,DOMParser:g,trustedTypes:v}=e,h=m.prototype,P=Vn(h,"cloneNode"),q=Vn(h,"remove"),A=Vn(h,"nextSibling"),ee=Vn(h,"childNodes"),te=Vn(h,"parentNode");if(typeof c=="function"){const pe=t.createElement("template");pe.content&&pe.content.ownerDocument&&(t=pe.content.ownerDocument)}let V,re="";const{implementation:ie,createNodeIterator:ue,createDocumentFragment:fe,getElementsByTagName:ne}=t,{importNode:Z}=a;let j=Fo();n.isSupported=typeof bs=="function"&&typeof te=="function"&&ie&&ie.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:F,ERB_EXPR:B,TMPLIT_EXPR:X,DATA_ATTR:M,ARIA_ATTR:p,IS_SCRIPT_OR_DATA:k,ATTR_WHITESPACE:H,CUSTOM_ELEMENT:W}=No;let{IS_ALLOWED_URI:ae}=No,G=null;const R=Le({},[...Po,...Mr,...Ar,...Br,...Do]);let $=null;const I=Le({},[...Io,...Er,...Lo,...ar]);let L=Object.seal(zr(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}})),K=null,ve=null;const xe=Object.seal(zr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Te=!0,qe=!0,Ye=!1,Y=!0,de=!1,oe=!0,be=!1,Se=!1,we=!1,Be=!1,Oe=!1,zt=!1,Mt=!0,at=!1;const Ht="user-content-";let Rt=!0,Pt=!1,It={},dt=null;const Vt=Le({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let mt=null;const At=Le({},["audio","video","img","source","image","track"]);let Wt=null;const ln=Le({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Ot="http://www.w3.org/1998/Math/MathML",Je="http://www.w3.org/2000/svg",xt="http://www.w3.org/1999/xhtml";let Bt=xt,bt=!1,en=null;const xn=Le({},[Ot,Je,xt],_r);let Gt=Le({},["mi","mo","mn","ms","mtext"]),qt=Le({},["annotation-xml"]);const bn=Le({},["title","style","font","a","script"]);let Ut=null;const it=["application/xhtml+xml","text/html"],yn="text/html";let Ie=null,Lt=null;const et=t.createElement("form"),cn=function(E){return E instanceof RegExp||E instanceof Function},Re=function(){let E=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Lt&&Lt===E)){if((!E||typeof E!="object")&&(E={}),E=Qt(E),Ut=it.indexOf(E.PARSER_MEDIA_TYPE)===-1?yn:E.PARSER_MEDIA_TYPE,Ie=Ut==="application/xhtml+xml"?_r:cr,G=jt(E,"ALLOWED_TAGS")?Le({},E.ALLOWED_TAGS,Ie):R,$=jt(E,"ALLOWED_ATTR")?Le({},E.ALLOWED_ATTR,Ie):I,en=jt(E,"ALLOWED_NAMESPACES")?Le({},E.ALLOWED_NAMESPACES,_r):xn,Wt=jt(E,"ADD_URI_SAFE_ATTR")?Le(Qt(ln),E.ADD_URI_SAFE_ATTR,Ie):ln,mt=jt(E,"ADD_DATA_URI_TAGS")?Le(Qt(At),E.ADD_DATA_URI_TAGS,Ie):At,dt=jt(E,"FORBID_CONTENTS")?Le({},E.FORBID_CONTENTS,Ie):Vt,K=jt(E,"FORBID_TAGS")?Le({},E.FORBID_TAGS,Ie):Qt({}),ve=jt(E,"FORBID_ATTR")?Le({},E.FORBID_ATTR,Ie):Qt({}),It=jt(E,"USE_PROFILES")?E.USE_PROFILES:!1,Te=E.ALLOW_ARIA_ATTR!==!1,qe=E.ALLOW_DATA_ATTR!==!1,Ye=E.ALLOW_UNKNOWN_PROTOCOLS||!1,Y=E.ALLOW_SELF_CLOSE_IN_ATTR!==!1,de=E.SAFE_FOR_TEMPLATES||!1,oe=E.SAFE_FOR_XML!==!1,be=E.WHOLE_DOCUMENT||!1,Be=E.RETURN_DOM||!1,Oe=E.RETURN_DOM_FRAGMENT||!1,zt=E.RETURN_TRUSTED_TYPE||!1,we=E.FORCE_BODY||!1,Mt=E.SANITIZE_DOM!==!1,at=E.SANITIZE_NAMED_PROPS||!1,Rt=E.KEEP_CONTENT!==!1,Pt=E.IN_PLACE||!1,ae=E.ALLOWED_URI_REGEXP||ys,Bt=E.NAMESPACE||xt,Gt=E.MATHML_TEXT_INTEGRATION_POINTS||Gt,qt=E.HTML_INTEGRATION_POINTS||qt,L=E.CUSTOM_ELEMENT_HANDLING||{},E.CUSTOM_ELEMENT_HANDLING&&cn(E.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(L.tagNameCheck=E.CUSTOM_ELEMENT_HANDLING.tagNameCheck),E.CUSTOM_ELEMENT_HANDLING&&cn(E.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(L.attributeNameCheck=E.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),E.CUSTOM_ELEMENT_HANDLING&&typeof E.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(L.allowCustomizedBuiltInElements=E.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),de&&(qe=!1),Oe&&(Be=!0),It&&(G=Le({},Do),$=[],It.html===!0&&(Le(G,Po),Le($,Io)),It.svg===!0&&(Le(G,Mr),Le($,Er),Le($,ar)),It.svgFilters===!0&&(Le(G,Ar),Le($,Er),Le($,ar)),It.mathMl===!0&&(Le(G,Br),Le($,Lo),Le($,ar))),E.ADD_TAGS&&(typeof E.ADD_TAGS=="function"?xe.tagCheck=E.ADD_TAGS:(G===R&&(G=Qt(G)),Le(G,E.ADD_TAGS,Ie))),E.ADD_ATTR&&(typeof E.ADD_ATTR=="function"?xe.attributeCheck=E.ADD_ATTR:($===I&&($=Qt($)),Le($,E.ADD_ATTR,Ie))),E.ADD_URI_SAFE_ATTR&&Le(Wt,E.ADD_URI_SAFE_ATTR,Ie),E.FORBID_CONTENTS&&(dt===Vt&&(dt=Qt(dt)),Le(dt,E.FORBID_CONTENTS,Ie)),E.ADD_FORBID_CONTENTS&&(dt===Vt&&(dt=Qt(dt)),Le(dt,E.ADD_FORBID_CONTENTS,Ie)),Rt&&(G["#text"]=!0),be&&Le(G,["html","head","body"]),G.table&&(Le(G,["tbody"]),delete K.tbody),E.TRUSTED_TYPES_POLICY){if(typeof E.TRUSTED_TYPES_POLICY.createHTML!="function")throw zn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof E.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw zn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');V=E.TRUSTED_TYPES_POLICY,re=V.createHTML("")}else V===void 0&&(V=Al(v,s)),V!==null&&typeof re=="string"&&(re=V.createHTML(""));St&&St(E),Lt=E}},yt=Le({},[...Mr,...Ar,...xl]),Xe=Le({},[...Br,...bl]),Zt=function(E){let se=te(E);(!se||!se.tagName)&&(se={namespaceURI:Bt,tagName:"template"});const he=cr(E.tagName),ze=cr(se.tagName);return en[E.namespaceURI]?E.namespaceURI===Je?se.namespaceURI===xt?he==="svg":se.namespaceURI===Ot?he==="svg"&&(ze==="annotation-xml"||Gt[ze]):!!yt[he]:E.namespaceURI===Ot?se.namespaceURI===xt?he==="math":se.namespaceURI===Je?he==="math"&&qt[ze]:!!Xe[he]:E.namespaceURI===xt?se.namespaceURI===Je&&!qt[ze]||se.namespaceURI===Ot&&!Gt[ze]?!1:!Xe[he]&&(bn[he]||!yt[he]):!!(Ut==="application/xhtml+xml"&&en[E.namespaceURI]):!1},Ue=function(E){Un(n.removed,{element:E});try{te(E).removeChild(E)}catch{q(E)}},Et=function(E,se){try{Un(n.removed,{attribute:se.getAttributeNode(E),from:se})}catch{Un(n.removed,{attribute:null,from:se})}if(se.removeAttribute(E),E==="is")if(Be||Oe)try{Ue(se)}catch{}else try{se.setAttribute(E,"")}catch{}},tt=function(E){let se=null,he=null;if(we)E="<remove></remove>"+E;else{const Ve=Tr(E,/^[\r\n\t ]+/);he=Ve&&Ve[0]}Ut==="application/xhtml+xml"&&Bt===xt&&(E='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+E+"</body></html>");const ze=V?V.createHTML(E):E;if(Bt===xt)try{se=new g().parseFromString(ze,Ut)}catch{}if(!se||!se.documentElement){se=ie.createDocument(Bt,"template",null);try{se.documentElement.innerHTML=bt?re:ze}catch{}}const Ne=se.body||se.documentElement;return E&&he&&Ne.insertBefore(t.createTextNode(he),Ne.childNodes[0]||null),Bt===xt?ne.call(se,be?"html":"body")[0]:be?se.documentElement:Ne},un=function(E){return ue.call(E.ownerDocument||E,E,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},nt=function(E){return E instanceof T&&(typeof E.nodeName!="string"||typeof E.textContent!="string"||typeof E.removeChild!="function"||!(E.attributes instanceof w)||typeof E.removeAttribute!="function"||typeof E.setAttribute!="function"||typeof E.namespaceURI!="string"||typeof E.insertBefore!="function"||typeof E.hasChildNodes!="function")},dn=function(E){return typeof f=="function"&&E instanceof f};function je(pe,E,se){sr(pe,he=>{he.call(n,E,se,Lt)})}const tn=function(E){let se=null;if(je(j.beforeSanitizeElements,E,null),nt(E))return Ue(E),!0;const he=Ie(E.nodeName);if(je(j.uponSanitizeElement,E,{tagName:he,allowedTags:G}),oe&&E.hasChildNodes()&&!dn(E.firstElementChild)&&wt(/<[/\w!]/g,E.innerHTML)&&wt(/<[/\w!]/g,E.textContent)||E.nodeType===Wn.progressingInstruction||oe&&E.nodeType===Wn.comment&&wt(/<[/\w]/g,E.data))return Ue(E),!0;if(!(xe.tagCheck instanceof Function&&xe.tagCheck(he))&&(!G[he]||K[he])){if(!K[he]&&fn(he)&&(L.tagNameCheck instanceof RegExp&&wt(L.tagNameCheck,he)||L.tagNameCheck instanceof Function&&L.tagNameCheck(he)))return!1;if(Rt&&!dt[he]){const ze=te(E)||E.parentNode,Ne=ee(E)||E.childNodes;if(Ne&&ze){const Ve=Ne.length;for(let Qe=Ve-1;Qe>=0;--Qe){const Ze=P(Ne[Qe],!0);Ze.__removalCount=(E.__removalCount||0)+1,ze.insertBefore(Ze,A(E))}}}return Ue(E),!0}return E instanceof m&&!Zt(E)||(he==="noscript"||he==="noembed"||he==="noframes")&&wt(/<\/no(script|embed|frames)/i,E.innerHTML)?(Ue(E),!0):(de&&E.nodeType===Wn.text&&(se=E.textContent,sr([F,B,X],ze=>{se=jn(se,ze," ")}),E.textContent!==se&&(Un(n.removed,{element:E.cloneNode()}),E.textContent=se)),je(j.afterSanitizeElements,E,null),!1)},rt=function(E,se,he){if(Mt&&(se==="id"||se==="name")&&(he in t||he in et))return!1;if(!(qe&&!ve[se]&&wt(M,se))){if(!(Te&&wt(p,se))){if(!(xe.attributeCheck instanceof Function&&xe.attributeCheck(se,E))){if(!$[se]||ve[se]){if(!(fn(E)&&(L.tagNameCheck instanceof RegExp&&wt(L.tagNameCheck,E)||L.tagNameCheck instanceof Function&&L.tagNameCheck(E))&&(L.attributeNameCheck instanceof RegExp&&wt(L.attributeNameCheck,se)||L.attributeNameCheck instanceof Function&&L.attributeNameCheck(se,E))||se==="is"&&L.allowCustomizedBuiltInElements&&(L.tagNameCheck instanceof RegExp&&wt(L.tagNameCheck,he)||L.tagNameCheck instanceof Function&&L.tagNameCheck(he))))return!1}else if(!Wt[se]){if(!wt(ae,jn(he,H,""))){if(!((se==="src"||se==="xlink:href"||se==="href")&&E!=="script"&&hl(he,"data:")===0&&mt[E])){if(!(Ye&&!wt(k,jn(he,H,"")))){if(he)return!1}}}}}}}return!0},fn=function(E){return E!=="annotation-xml"&&Tr(E,W)},ot=function(E){je(j.beforeSanitizeAttributes,E,null);const{attributes:se}=E;if(!se||nt(E))return;const he={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:$,forceKeepAttr:void 0};let ze=se.length;for(;ze--;){const Ne=se[ze],{name:Ve,namespaceURI:Qe,value:Ze}=Ne,Nt=Ie(Ve),ct=Ze;let b=Ve==="value"?ct:pl(ct);if(he.attrName=Nt,he.attrValue=b,he.keepAttr=!0,he.forceKeepAttr=void 0,je(j.uponSanitizeAttribute,E,he),b=he.attrValue,at&&(Nt==="id"||Nt==="name")&&(Et(Ve,E),b=Ht+b),oe&&wt(/((--!?|])>)|<\/(style|title|textarea)/i,b)){Et(Ve,E);continue}if(Nt==="attributename"&&Tr(b,"href")){Et(Ve,E);continue}if(he.forceKeepAttr)continue;if(!he.keepAttr){Et(Ve,E);continue}if(!Y&&wt(/\/>/i,b)){Et(Ve,E);continue}de&&sr([F,B,X],_=>{b=jn(b,_," ")});const D=Ie(E.nodeName);if(!rt(D,Nt,b)){Et(Ve,E);continue}if(V&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!Qe)switch(v.getAttributeType(D,Nt)){case"TrustedHTML":{b=V.createHTML(b);break}case"TrustedScriptURL":{b=V.createScriptURL(b);break}}if(b!==ct)try{Qe?E.setAttributeNS(Qe,Ve,b):E.setAttribute(Ve,b),nt(E)?Ue(E):Ro(n.removed)}catch{Et(Ve,E)}}je(j.afterSanitizeAttributes,E,null)},wn=function pe(E){let se=null;const he=un(E);for(je(j.beforeSanitizeShadowDOM,E,null);se=he.nextNode();)je(j.uponSanitizeShadowNode,se,null),tn(se),ot(se),se.content instanceof l&&pe(se.content);je(j.afterSanitizeShadowDOM,E,null)};return n.sanitize=function(pe){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},se=null,he=null,ze=null,Ne=null;if(bt=!pe,bt&&(pe="<!-->"),typeof pe!="string"&&!dn(pe))if(typeof pe.toString=="function"){if(pe=pe.toString(),typeof pe!="string")throw zn("dirty is not a string, aborting")}else throw zn("toString is not a function");if(!n.isSupported)return pe;if(Se||Re(E),n.removed=[],typeof pe=="string"&&(Pt=!1),Pt){if(pe.nodeName){const Ze=Ie(pe.nodeName);if(!G[Ze]||K[Ze])throw zn("root node is forbidden and cannot be sanitized in-place")}}else if(pe instanceof f)se=tt("<!---->"),he=se.ownerDocument.importNode(pe,!0),he.nodeType===Wn.element&&he.nodeName==="BODY"||he.nodeName==="HTML"?se=he:se.appendChild(he);else{if(!Be&&!de&&!be&&pe.indexOf("<")===-1)return V&&zt?V.createHTML(pe):pe;if(se=tt(pe),!se)return Be?null:zt?re:""}se&&we&&Ue(se.firstChild);const Ve=un(Pt?pe:se);for(;ze=Ve.nextNode();)tn(ze),ot(ze),ze.content instanceof l&&wn(ze.content);if(Pt)return pe;if(Be){if(Oe)for(Ne=fe.call(se.ownerDocument);se.firstChild;)Ne.appendChild(se.firstChild);else Ne=se;return($.shadowroot||$.shadowrootmode)&&(Ne=Z.call(a,Ne,!0)),Ne}let Qe=be?se.outerHTML:se.innerHTML;return be&&G["!doctype"]&&se.ownerDocument&&se.ownerDocument.doctype&&se.ownerDocument.doctype.name&&wt(ws,se.ownerDocument.doctype.name)&&(Qe="<!DOCTYPE "+se.ownerDocument.doctype.name+`>
60
+ `+Qe),de&&sr([F,B,X],Ze=>{Qe=jn(Qe,Ze," ")}),V&&zt?V.createHTML(Qe):Qe},n.setConfig=function(){let pe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Re(pe),Se=!0},n.clearConfig=function(){Lt=null,Se=!1},n.isValidAttribute=function(pe,E,se){Lt||Re({});const he=Ie(pe),ze=Ie(E);return rt(he,ze,se)},n.addHook=function(pe,E){typeof E=="function"&&Un(j[pe],E)},n.removeHook=function(pe,E){if(E!==void 0){const se=fl(j[pe],E);return se===-1?void 0:ml(j[pe],se,1)[0]}return Ro(j[pe])},n.removeHooks=function(pe){j[pe]=[]},n.removeAllHooks=function(){j=Fo()},n}var Cs=ks();const Bl={":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:":"🦺"},El=/https?:\/\/[^\s<>)"']+/g;function Rl(e){return e.replace(El,n=>`<a href="${n}" target="_blank" rel="noopener noreferrer" class="text-retro-blue hover:underline">${n}</a>`)}function Pl(e){return e.replace(/:[a-z0-9_]+:/g,n=>Bl[n]||n)}function Dl(e){if(!e)return"";let n=Pl(e);return n=We.parse(n),n=Rl(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 Il={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},Ll={class:"flex items-center gap-2 min-w-0"},Nl={class:"text-retro-cyan font-mono text-sm"},Fl={class:"text-retro-muted text-sm truncate"},Hl={class:"flex items-center gap-1 flex-shrink-0"},Ol=["aria-label","title"],Ul={class:"flex-1 overflow-auto p-4 space-y-4"},jl={class:"space-y-2"},zl={class:"flex items-center gap-2 text-sm"},Vl={class:"text-retro-text font-mono text-xs bg-retro-panel px-2 py-1 rounded"},Wl={class:"flex items-center gap-2 text-sm"},Gl={class:"text-retro-text"},ql={class:"text-retro-muted"},Zl={key:0,class:"flex items-center gap-2 text-sm"},Kl={class:"text-retro-text"},Yl={class:"text-retro-muted"},Xl={class:"flex items-center gap-2 text-sm"},Ql={class:"text-retro-text"},Jl={key:1,class:"flex items-start gap-2 text-sm"},ec={class:"flex flex-wrap gap-1"},tc=["onClick","title"],nc={key:2,class:"flex items-start gap-2 text-sm"},rc={class:"flex flex-wrap gap-1"},oc={key:3,class:"flex items-start gap-2 text-sm"},sc={class:"flex flex-wrap gap-1"},ac={class:"space-y-1"},ic={class:"text-retro-text text-sm font-mono bg-retro-panel p-3 rounded"},lc={key:0,class:"space-y-1"},cc=["innerHTML"],uc={key:1,class:"space-y-2"},dc={class:"flex items-center gap-2 text-sm"},fc={class:"text-retro-muted"},mc={key:0,class:"flex items-center gap-2"},hc={class:"text-retro-green text-xs font-mono"},pc={class:"flex-1 h-2 rounded overflow-hidden bg-retro-panel flex"},vc={class:"text-retro-red text-xs font-mono"},gc={key:2,class:"space-y-2"},xc={class:"flex items-center justify-between"},bc={class:"text-retro-muted text-xs uppercase tracking-wide"},yc={class:"flex items-center gap-1"},wc={key:0,class:"text-retro-muted text-sm py-2"},kc={key:1,class:"space-y-0.5"},Cc=["onClick"],$c=["title"],Sc={class:"text-retro-text font-mono text-xs truncate flex-1"},_c={class:"text-retro-muted"},Tc={class:"text-retro-text"},Mc={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},Ac={key:0,class:"text-retro-green"},Bc={key:1,class:"text-retro-red"},Ec={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},Rc={key:2,class:"space-y-0"},Pc=["onClick"],Dc={class:"text-retro-text font-mono text-xs"},Ic=["title"],Lc={class:"text-retro-text font-mono text-xs truncate flex-1"},Nc={class:"text-retro-muted"},Fc={class:"text-retro-text"},Hc={key:0,class:"flex-shrink-0 font-mono text-xs flex items-center gap-1"},Oc={key:0,class:"text-retro-green"},Uc={key:1,class:"text-retro-red"},jc={key:1,class:"flex-shrink-0 font-mono text-xs text-retro-muted"},zc={key:3,class:"flex items-center gap-2 text-retro-muted text-sm py-2"},Vc={key:4,class:"text-retro-muted text-sm py-2"},Wc=Me({__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=C(null),l=C("flat"),c=C(new Set),f=U(()=>!t.committer||!t.committerEmail?!1:t.committer!==t.commit.author||t.committerEmail!==t.commit.email),m=U(()=>{const j=t.commit.body;return j?Dl(j):""}),d=U(()=>{if(!t.stats)return"";const{filesChanged:j,additions:F,deletions:B}=t.stats,M=[`${j} ${j===1?"file":"files"} changed`];return F>0&&M.push(`+${F} insertion${F===1?"":"s"}`),B>0&&M.push(`-${B} deletion${B===1?"":"s"}`),M.join(", ")});function w(j){const F=[];for(const B of j){const X=B.path.split("/");let M=F;for(let p=0;p<X.length;p++){const k=X[p],H=p===X.length-1,W=X.slice(0,p+1).join("/");let ae=M.find(G=>G.name===k&&G.isDirectory===!H);ae||(ae={name:k,fullPath:W,isDirectory:!H,children:[],file:H?B:void 0},M.push(ae)),H||(M=ae.children)}}return T(F),F}function T(j){for(const F of j)if(F.isDirectory)for(T(F.children);F.children.length===1&&F.children[0].isDirectory;){const B=F.children[0];F.name=`${F.name}/${B.name}`,F.fullPath=B.fullPath,F.children=B.children}}function g(j){return[...j].sort((F,B)=>F.isDirectory&&!B.isDirectory?-1:!F.isDirectory&&B.isDirectory?1:F.name.localeCompare(B.name))}function v(j,F,B){const X=[];for(const M of g(j)){const p=B.size===0?!0:B.has(M.fullPath);X.push({key:M.fullPath,depth:F,isDirectory:M.isDirectory,name:M.name,fullPath:M.fullPath,expanded:M.isDirectory?p:!1,file:M.file}),M.isDirectory&&p&&X.push(...v(M.children,F+1,B))}return X}const h=U(()=>!t.files||t.files.length===0?[]:w(t.files)),P=U(()=>v(h.value,0,c.value));function q(j){c.value.has(j)?c.value.delete(j):c.value.add(j),c.value=new Set(c.value)}function A(){const j=F=>{const B=[];for(const X of F)X.isDirectory&&(B.push(X.fullPath),B.push(...j(X.children)));return B};c.value=new Set(j(h.value))}function ee(){c.value=new Set}De(l,j=>{j==="tree"&&A()});function te(j){return new Date(j*1e3).toLocaleString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",hour12:!0})}function V(j){return Pn[j]||{label:j,colorClass:"text-retro-muted"}}const re=U(()=>{if(!t.stats)return{addPct:0,delPct:0};const j=t.stats.additions+t.stats.deletions;return j===0?{addPct:50,delPct:50}:{addPct:Math.round(t.stats.additions/j*100),delPct:Math.round(t.stats.deletions/j*100)}});function ie(j){j.key==="ArrowUp"?(j.preventDefault(),a("navigatePrev")):j.key==="ArrowDown"?(j.preventDefault(),a("navigateNext")):j.key==="Escape"&&(j.preventDefault(),a("close"))}ut(()=>{vn(()=>{s.value?.focus()})}),De(()=>t.commit.hash,()=>{vn(()=>{s.value?.focus()})});function ue(){a("close")}function fe(j){a("navigateToCommit",j)}function ne(){a("togglePosition")}function Z(j){a("openFileDiff",j)}return(j,F)=>(i(),u("section",{ref_key:"containerRef",ref:s,tabindex:0,onKeydown:ie,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",Il,[r("div",Ll,[r("span",Nl,S(e.commit.shortHash),1),r("span",Fl,S(e.commit.message.split(`
61
+ `)[0]),1)]),r("div",Hl,[r("button",{onClick:ne,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(),ce(o(Yo),{key:0,class:"w-4 h-4 text-retro-muted hover:text-retro-text"})):(i(),ce(o(Ko),{key:1,class:"w-4 h-4 text-retro-muted hover:text-retro-text"}))],8,Ol),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"},[Q(o(vt),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])])]),r("div",Ul,[r("div",jl,[r("div",zl,[F[2]||(F[2]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Hash:",-1)),r("code",Vl,S(e.commit.hash),1)]),r("div",Wl,[Q(o(Hr),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",Gl,S(e.commit.author),1),r("span",ql,"<"+S(e.commit.email)+">",1)]),f.value?(i(),u("div",Zl,[Q(o(Hr),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),F[3]||(F[3]=r("span",{class:"text-retro-muted text-xs uppercase mr-1"},"Committer:",-1)),r("span",Kl,S(e.committer),1),r("span",Yl,"<"+S(e.committerEmail)+">",1)])):N("",!0),r("div",Xl,[Q(o(Jo),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",Ql,S(te(e.commit.timestamp)),1)]),e.commit.parents?.length>0?(i(),u("div",Jl,[F[4]||(F[4]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Parents:",-1)),r("div",ec,[(i(!0),u(me,null,Ee(e.commit.parents,B=>(i(),u("button",{key:B,onClick:X=>fe(B),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 ${B.substring(0,7)}`},S(B.substring(0,7)),9,tc))),128))])])):N("",!0),e.commit.branches?.length>0?(i(),u("div",nc,[F[5]||(F[5]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Branches:",-1)),r("div",rc,[(i(!0),u(me,null,Ee(e.commit.branches,B=>(i(),u("span",{key:B,class:"text-retro-green font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},S(B),1))),128))])])):N("",!0),e.commit.tags?.length>0?(i(),u("div",oc,[F[6]||(F[6]=r("span",{class:"text-retro-muted w-20 flex-shrink-0"},"Tags:",-1)),r("div",sc,[(i(!0),u(me,null,Ee(e.commit.tags,B=>(i(),u("span",{key:B,class:"text-retro-yellow font-mono text-xs bg-retro-panel px-2 py-0.5 rounded"},S(B),1))),128))])])):N("",!0)]),r("div",ac,[F[7]||(F[7]=r("h4",{class:"text-retro-muted text-xs uppercase tracking-wide"}," Message ",-1)),r("div",ic,S(e.commit.message.split(`
62
+ `)[0]),1)]),e.commit.body?(i(),u("div",lc,[F[8]||(F[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:m.value},null,8,cc)])):N("",!0),e.stats?(i(),u("div",uc,[r("div",dc,[r("span",fc,S(d.value),1)]),e.stats.additions>0||e.stats.deletions>0?(i(),u("div",mc,[r("span",hc,"+"+S(e.stats.additions),1),r("div",pc,[r("div",{class:"bg-retro-green h-full transition-all",style:kt({width:re.value.addPct+"%"})},null,4),r("div",{class:"bg-retro-red h-full transition-all",style:kt({width:re.value.delPct+"%"})},null,4)]),r("span",vc,"-"+S(e.stats.deletions),1)])):N("",!0)])):N("",!0),e.files?(i(),u("div",gc,[r("div",xc,[r("h4",bc," Files Changed ("+S(e.files.length)+") ",1),r("div",yc,[r("button",{onClick:F[0]||(F[0]=B=>l.value="flat"),class:ge(["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"},[Q(o(os),{class:"w-4 h-4"})],2),r("button",{onClick:F[1]||(F[1]=B=>l.value="tree"),class:ge(["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"},[Q(o(Fr),{class:"w-4 h-4"})],2)])]),e.files.length===0?(i(),u("div",wc," No files changed in this commit. ")):l.value==="flat"?(i(),u("ul",kc,[(i(!0),u(me,null,Ee(e.files,B=>(i(),u("li",{key:B.path,class:"flex items-center gap-2 text-sm py-1 px-2 hover:bg-retro-panel rounded group cursor-pointer",onClick:X=>Z(B)},[r("span",{class:ge(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",V(B.status).colorClass]),title:V(B.status).label},S(B.status),11,$c),Q(o(qn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",Sc,[B.status==="R"&&B.oldPath?(i(),u(me,{key:0},[r("span",_c,S(B.oldPath),1),F[9]||(F[9]=r("span",{class:"text-retro-yellow mx-1"},"→",-1)),r("span",Tc,S(B.path),1)],64)):(i(),u(me,{key:1},[_e(S(B.path),1)],64))]),!B.binary&&(B.additions>0||B.deletions>0)?(i(),u("span",Mc,[B.additions>0?(i(),u("span",Ac,"+"+S(B.additions),1)):N("",!0),B.deletions>0?(i(),u("span",Bc,"-"+S(B.deletions),1)):N("",!0)])):B.binary?(i(),u("span",Ec,"binary")):N("",!0)],8,Cc))),128))])):(i(),u("div",Rc,[r("div",{class:"flex items-center gap-2 mb-1"},[r("button",{onClick:A,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Expand all "),F[10]||(F[10]=r("span",{class:"text-retro-muted text-xs"},"|",-1)),r("button",{onClick:ee,class:"text-xs text-retro-muted hover:text-retro-text transition-colors"}," Collapse all ")]),(i(!0),u(me,null,Ee(P.value,B=>(i(),u("div",{key:B.key,class:ge(["flex items-center gap-1 py-0.5 px-1 hover:bg-retro-panel rounded text-sm cursor-pointer",{"select-none":B.isDirectory}]),style:kt({paddingLeft:B.depth*16+4+"px"}),onClick:X=>B.isDirectory?q(B.fullPath):B.file?Z(B.file):void 0},[B.isDirectory?(i(),u(me,{key:0},[Q(o(Yr),{class:ge(["w-3 h-3 text-retro-muted transition-transform flex-shrink-0",{"rotate-90":B.expanded}])},null,8,["class"]),Q(o(Fr),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),r("span",Dc,S(B.name),1)],64)):B.file?(i(),u(me,{key:1},[r("span",{class:ge(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",V(B.file.status).colorClass]),title:V(B.file.status).label},S(B.file.status),11,Ic),Q(o(qn),{class:"w-4 h-4 text-retro-muted flex-shrink-0"}),r("span",Lc,[B.file.status==="R"&&B.file.oldPath?(i(),u(me,{key:0},[r("span",Nc,S(B.file.oldPath.split("/").pop()),1),F[11]||(F[11]=r("span",{class:"text-retro-yellow mx-1"},"→",-1)),r("span",Fc,S(B.name),1)],64)):(i(),u(me,{key:1},[_e(S(B.name),1)],64))]),!B.file.binary&&(B.file.additions>0||B.file.deletions>0)?(i(),u("span",Hc,[B.file.additions>0?(i(),u("span",Oc,"+"+S(B.file.additions),1)):N("",!0),B.file.deletions>0?(i(),u("span",Uc,"-"+S(B.file.deletions),1)):N("",!0)])):B.file.binary?(i(),u("span",jc,"binary")):N("",!0)],64)):N("",!0)],14,Pc))),128))]))])):e.loading?(i(),u("div",zc,[...F[12]||(F[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",Vc," Failed to load file changes. "))])],544))}}),Gc=qr(Wc,[["__scopeId","data-v-29f450ea"]]),qc={class:"flex-1 min-h-0 flex flex-col border-t border-retro-border bg-retro-dark","aria-label":"Uncommitted changes details"},Zc={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},Kc={class:"flex items-center gap-2 min-w-0"},Yc={class:"text-retro-muted text-sm"},Xc={key:0,class:"w-3 h-3 border-2 border-retro-muted border-t-retro-cyan rounded-full animate-spin",title:"Staging..."},Qc={class:"flex-1 overflow-auto p-4 space-y-3"},Jc={class:"space-y-2"},eu=["disabled"],tu={class:"space-y-1"},nu={class:"flex items-center justify-between"},ru={class:"text-retro-green text-xs uppercase tracking-wide font-semibold"},ou={key:0,class:"text-retro-muted text-xs py-1"},su={key:1,class:"space-y-0.5"},au=["aria-label","onClick"],iu={class:"text-retro-text font-mono text-xs truncate"},lu={class:"space-y-1"},cu={class:"flex items-center justify-between"},uu={class:"text-retro-yellow text-xs uppercase tracking-wide font-semibold"},du={key:0,class:"text-retro-muted text-xs py-1"},fu={key:1,class:"space-y-0.5"},mu=["aria-label","onClick"],hu={class:"text-retro-text font-mono text-xs truncate"},pu=Me({__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=C(""),l=C(!1),c=U(()=>s.value.trim().length>0&&t.stagedFiles.length>0&&!l.value&&!t.isCommitting);function f(P){return Pn[P]||{label:P,colorClass:"text-retro-muted"}}function m(){a("close")}function d(P){a("stageFiles",[P.path])}function w(P){a("unstageFiles",[P.path])}function T(){a("stageAll")}function g(){a("unstageAll")}async function v(){c.value&&(l.value=!0,a("commit",s.value.trim()),s.value="",l.value=!1)}function h(P){(P.metaKey||P.ctrlKey)&&P.key==="Enter"&&(P.preventDefault(),v())}return(P,q)=>(i(),u("section",qc,[r("div",Zc,[r("div",Kc,[Q(o(In),{class:"w-4 h-4 text-retro-yellow"}),q[1]||(q[1]=r("span",{class:"text-retro-yellow font-semibold text-sm"},"Uncommitted Changes",-1)),r("span",Yc,"("+S(e.stagedFiles.length+e.unstagedFiles.length)+" files)",1),t.isStaging?(i(),u("div",Xc)):N("",!0)]),r("button",{onClick:m,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"},[Q(o(vt),{class:"w-4 h-4 text-retro-muted hover:text-retro-text"})])]),r("div",Qc,[r("div",Jc,[Pe(r("textarea",{"onUpdate:modelValue":q[0]||(q[0]=A=>He(s)?s.value=A: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:h},null,544),[[pt,o(s)]]),r("button",{disabled:!o(c),class:ge(["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:v},S(o(l)||t.isCommitting?"Committing...":`Commit (${e.stagedFiles.length} staged)`),11,eu)]),r("div",tu,[r("div",nu,[r("h4",ru," Staged Changes ("+S(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:g}," Unstage All ")):N("",!0)]),e.stagedFiles.length===0?(i(),u("div",ou," No staged files. Stage files below to commit. ")):(i(),u("ul",su,[(i(!0),u(me,null,Ee(e.stagedFiles,A=>(i(),u("li",{key:"staged-"+A.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 ${A.path}`,onClick:ee=>w(A)},[Q(o(la),{class:"w-3.5 h-3.5 text-retro-red"})],8,au),r("span",{class:ge(["flex-shrink-0 w-4 text-center text-xs font-bold",f(A.status).colorClass])},S(A.status),3),Q(o(qn),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),r("span",iu,S(A.oldPath?`${A.oldPath} → ${A.path}`:A.path),1)]))),128))]))]),r("div",lu,[r("div",cu,[r("h4",uu," Unstaged Changes ("+S(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 ")):N("",!0)]),e.unstagedFiles.length===0?(i(),u("div",du," No unstaged changes. ")):(i(),u("ul",fu,[(i(!0),u(me,null,Ee(e.unstagedFiles,A=>(i(),u("li",{key:"unstaged-"+A.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 ${A.path}`,onClick:ee=>d(A)},[Q(o(pr),{class:"w-3.5 h-3.5 text-retro-green"})],8,mu),r("span",{class:ge(["flex-shrink-0 w-4 text-center text-xs font-bold",f(A.status).colorClass])},S(A.status),3),Q(o(qn),{class:"w-3.5 h-3.5 text-retro-muted flex-shrink-0"}),r("span",hu,S(A.oldPath?`${A.oldPath} → ${A.path}`:A.path),1)]))),128))]))])])]))}}),vu=["aria-label"],gu={key:0,class:"px-3 py-1 text-xs text-retro-muted border-b border-retro-border truncate font-mono"},xu={key:0,class:"my-1 border-t border-retro-border",role:"separator"},bu=["aria-disabled","onClick","onMouseenter"],yu={key:1,class:"w-4 h-4 flex-shrink-0"},Xn=Me({__name:"GitContextMenu",props:{items:{},x:{},y:{},title:{}},emits:["close","action"],setup(e,{emit:n}){const t=e,a=n,s=C(null),l=C(-1),c=U(()=>t.items.map((v,h)=>({item:v,i:h})).filter(({item:v})=>!v.disabled).map(({i:v})=>v));let f=!1;function m(v){f&&s.value&&!s.value.contains(v.target)&&a("close")}ut(()=>{requestAnimationFrame(()=>{f=!0}),document.addEventListener("mousedown",m),document.addEventListener("contextmenu",m),vn(()=>{s.value?.focus()})}),$t(()=>{f=!1,document.removeEventListener("mousedown",m),document.removeEventListener("contextmenu",m)});function d(v){const h=c.value;if(h.length===0)return;if(l.value===-1){l.value=v===1?h[0]:h[h.length-1];return}const P=h.indexOf(l.value);if(P===-1){l.value=v===1?h[0]:h[h.length-1];return}const q=P+v;q>=0&&q<h.length&&(l.value=h[q])}function w(v){switch(v.key){case"Escape":v.preventDefault(),a("close");break;case"ArrowDown":v.preventDefault(),d(1);break;case"ArrowUp":v.preventDefault(),d(-1);break;case"Enter":{v.preventDefault();const h=t.items[l.value];h&&!h.disabled&&(a("action",h.key),a("close"));break}}}function T(v){v.disabled||(a("action",v.key),a("close"))}const g=U(()=>{const h=t.title?29:0,P=t.items.filter(re=>re.separator).length,q=t.items.length*36+P*9+8,A=h+q,ee=8;let te=t.x,V=t.y;return typeof window<"u"&&(te+220>window.innerWidth-ee&&(te=window.innerWidth-220-ee),te<ee&&(te=ee),V+A>window.innerHeight-ee&&(V=window.innerHeight-A-ee),V<ee&&(V=ee)),{left:`${te}px`,top:`${V}px`}});return(v,h)=>(i(),ce(Jt,{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:kt(o(g)),role:"menu","aria-label":e.title??"Context menu",tabindex:"-1",onKeydown:w},[e.title?(i(),u("div",gu,S(e.title),1)):N("",!0),(i(!0),u(me,null,Ee(e.items,(P,q)=>(i(),u(me,{key:P.key},[P.separator?(i(),u("div",xu)):N("",!0),r("button",{class:ge(["w-full flex items-center gap-2 px-3 py-2 text-sm transition-colors focus:outline-none",[P.disabled?"text-retro-muted/50 cursor-not-allowed":P.danger?["text-retro-red hover:bg-retro-red/10 focus:bg-retro-red/10",o(l)===q?"bg-retro-red/10":""]:["text-retro-text hover:bg-retro-cyan/10 focus:bg-retro-cyan/10",o(l)===q?"bg-retro-cyan/10":""]]]),role:"menuitem","aria-disabled":P.disabled||void 0,tabindex:-1,onClick:A=>T(P),onMouseenter:A=>l.value=P.disabled?o(l):q,onMouseleave:h[0]||(h[0]=A=>l.value=-1)},[P.icon?(i(),ce(En(P.icon),{key:0,class:ge(["w-4 h-4 flex-shrink-0",P.disabled?"opacity-50":P.danger?"":"text-retro-muted"])},null,8,["class"])):(i(),u("span",yu)),_e(" "+S(P.label),1)],42,bu)],64))),128))],44,vu)]))}}),wu=Me({__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=U(()=>[{key:"checkout",label:"Checkout",icon:gn,disabled:t.isCurrentBranch},{key:"rename",label:"Rename",icon:ss,separator:!0},{key:"deleteBranch",label:"Delete",icon:an,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:Rn,separator:!0}]),l=U(()=>[{key:"checkout",label:"Checkout",icon:gn},{key:"deleteBranch",label:"Delete Remote Branch",icon:an,separator:!0,danger:!0},{key:"fetch",label:"Fetch",icon:es,separator:!0},{key:"pull",label:"Pull into Current",icon:Vs},{key:"copyName",label:"Copy Branch Name",icon:Rn,separator:!0}]),c=U(()=>t.isLocal?s.value:l.value),f={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 m(d){const w=f[d];w&&w(),a("close")}return(d,w)=>{const T=Xn;return i(),ce(T,{items:o(c),x:e.x,y:e.y,title:e.branchName,onAction:m,onClose:w[0]||(w[0]=g=>a("close"))},null,8,["items","x","y","title"])}}}),ku=Me({__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=U(()=>[{key:"addTag",label:"Add Tag",icon:no},{key:"createBranch",label:"Create Branch",icon:pr},{key:"checkout",label:"Checkout (detached HEAD)",icon:gn,separator:!0},{key:"cherryPick",label:"Cherry Pick",icon:ea},{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:Rn,separator:!0},{key:"copySubject",label:"Copy Commit Subject",icon:Rn}]),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 f=s[c];f&&f(),t("close")}return(c,f)=>{const m=Xn;return i(),ce(m,{items:o(a),x:e.x,y:e.y,title:e.commit.shortHash,onAction:l,onClose:f[0]||(f[0]=d=>t("close"))},null,8,["items","x","y","title"])}}}),Cu=Me({__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:no},{key:"deleteTag",label:"Delete Tag",icon:an,separator:!0,danger:!0},{key:"pushTag",label:"Push Tag",icon:qo},{key:"copyName",label:"Copy Tag Name",icon:Rn,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 f=Xn;return i(),ce(f,{items:a,x:e.x,y:e.y,title:e.tagName,onClose:c[0]||(c[0]=m=>t("close")),onAction:s},null,8,["x","y","title"])}}}),$u=Me({__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:zs},{key:"pop",label:"Pop Stash",icon:Zo},{key:"createBranch",label:"Create Branch from Stash",icon:Nr,separator:!0},{key:"drop",label:"Drop Stash",icon:an,separator:!0,danger:!0},{key:"copyName",label:"Copy Stash Reference",icon:Rn,separator:!0},{key:"copyHash",label:"Copy Stash Hash",icon:sa}];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 f=Xn;return i(),ce(f,{items:a,x:e.x,y:e.y,title:e.stashMessage,onClose:c[0]||(c[0]=m=>t("close")),onAction:s},null,8,["x","y","title"])}}}),Su=Me({__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:js},{key:"reset",label:"Reset Working Directory",icon:gn,separator:!0,danger:!0},{key:"clean",label:"Clean Untracked Files",icon:an,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 f=Xn;return i(),ce(f,{items:a,x:e.x,y:e.y,title:"Uncommitted Changes",onClose:c[0]||(c[0]=m=>t("close")),onAction:s},null,8,["x","y"])}}}),_u={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},Tu={class:"flex items-center justify-between px-4 py-3 border-b border-retro-border"},Mu={class:"text-sm font-mono text-retro-text"},Au={class:"p-4"},Bu={key:0,class:"mb-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},Eu={class:"flex justify-end gap-2 px-4 py-3 border-t border-retro-border"},Ru=["disabled"],Pu=["disabled"],Tt=Me({__name:"GitDialog",props:{title:{},visible:{type:Boolean},loading:{type:Boolean,default:!1},error:{default:null},confirmLabel:{default:"Confirm"},confirmDanger:{type:Boolean,default:!1},cancelLabel:{default:"Cancel"}},emits:["close","confirm"],setup(e,{emit:n}){const t=e,a=n;function s(l){l.key==="Escape"&&a("close"),l.key==="Enter"&&!t.loading&&(l.preventDefault(),a("confirm"))}return De(()=>t.visible,l=>{l?document.addEventListener("keydown",s):document.removeEventListener("keydown",s)}),$t(()=>{document.removeEventListener("keydown",s)}),(l,c)=>(i(),ce(Jt,{to:"body"},[Q(Sn,{"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]=ft(f=>a("close"),["self"]))},[r("div",_u,[r("div",Tu,[r("h3",Mu,S(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]=f=>a("close"))},[Q(o(vt),{class:"h-4 w-4"})])]),r("div",Au,[e.error?(i(),u("div",Bu,S(e.error),1)):N("",!0),As(l.$slots,"default")]),r("div",Eu,[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]=f=>a("close"))},S(e.cancelLabel),9,Ru),r("button",{type:"button",class:ge(["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]=f=>a("confirm"))},S(e.loading?"Loading...":e.confirmLabel),11,Pu)])])])):N("",!0)]),_:3})]))}}),Qn=hr("gitGraph",()=>{const e=C([]),n=C([]),t=C([]),a=C(new Set),s=C([]),l=C([]),c=C(0),f=C(!1),m=C(null),d=C(null),w=C(null),T=C(!1),g=C(null),v=C(!1),h=C(0),P=C(""),q=C([]),A=C(null),ee=C(!1),te=C(!1),V=C(!1),re=C(!1),ie=C(null);let ue=null;function fe(O){ie.value=O,ue&&clearTimeout(ue),ue=setTimeout(()=>{ie.value=null},8e3)}function ne(){ie.value=null,ue&&(clearTimeout(ue),ue=null)}async function Z(O,J,$e,ht){if(!A.value)return{success:!1,error:"No working directory set"};try{const Kt=await $fetch(O,{method:ht?.method??"POST",body:{workingDirectory:A.value,...J}});return(ht?.reloadGraph??!0)&&await Mt(A.value),{success:!0,data:Kt}}catch(Kt){const Yt=rr(Kt,$e);return fe(Yt),{success:!1,error:Yt}}}const j=C(null),F=C(!1),B=C(!1),X=C(null),M=C([]),p=C([]),k=C(null),H=C(null),W=C(null),ae=C("inline"),G=C("list"),R=C("rounded"),$=C(!1),I=C({date:!0,author:!0,commit:!0}),L=C(0),K=C(0),ve=C(null),xe=C(null),Te=C(null),qe=C(null),Ye=C(null),Y=C(null),de=C(null),oe=C(null),be=C(null),Se=C(!1),we=new Map,Be=10,Oe=U(()=>{if(!P.value&&q.value.length===0)return e.value;let O=e.value;if(P.value){const J=P.value.toLowerCase(),$e=`${J}:${e.value.length}`;if(we.has($e))O=we.get($e);else{if(O=So(O,J),we.size>=Be){const ht=we.keys().next().value;ht&&we.delete(ht)}we.set($e,O)}}if(q.value.length>0){const J=new Set(q.value);O=li(O,J)}return O}),zt=U(()=>n.value.find(O=>O.isHead)||null);async function Mt(O){A.value=O,T.value=!0,g.value=null;try{const[J,$e,ht,Kt,Yt]=await Promise.all([$fetch("/api/git/log",{query:{workingDirectory:O}}),$fetch("/api/git/status",{query:{workingDirectory:O}}),$fetch("/api/git/stash",{query:{workingDirectory:O}}).then(mn=>mn.stashes).catch(()=>[]),$fetch("/api/git/remotes",{query:{workingDirectory:O}}).then(mn=>mn.remotes).catch(()=>[]),$fetch("/api/git/state",{query:{workingDirectory:O}}).then(mn=>mn.state).catch(()=>null)]);e.value=J.commits,n.value=J.branches,t.value=J.tags,a.value=new Set(J.localBranches??[]),v.value=J.hasMore,h.value=J.totalCount,s.value=$e.stagedFiles??[],l.value=$e.unstagedFiles??[],c.value=($e.stagedCount??0)+($e.unstagedCount??0),M.value=ht,p.value=Kt,X.value=Yt,j.value=Date.now(),await D()}catch(J){const $e=J instanceof Error?J.message:"Failed to load git graph";g.value=$e,e.value=[],n.value=[],t.value=[],s.value=[],l.value=[],c.value=0,M.value=[],p.value=[]}finally{T.value=!1}}async function at(){if(A.value)try{const O=await $fetch("/api/git/status",{query:{workingDirectory:A.value}});s.value=O.stagedFiles??[],l.value=O.unstagedFiles??[],c.value=(O.stagedCount??0)+(O.unstagedCount??0)}catch(O){console.error("Failed to refresh uncommitted changes:",O)}}const Ht=C(!1);async function Rt(){if(!(!A.value||!v.value||T.value||Ht.value)){Ht.value=!0;try{const O=await $fetch("/api/git/log",{query:{workingDirectory:A.value,offset:e.value.length}});e.value=[...e.value,...O.commits],v.value=O.hasMore}catch(O){console.error("Failed to load more commits:",O)}finally{Ht.value=!1}}}async function Pt(O){if(m.value=O,d.value=null,w.value=null,f.value=!1,ee.value=!0,!A.value){ee.value=!1;return}try{const J=await $fetch("/api/git/show",{query:{workingDirectory:A.value,hash:O.hash}});d.value=J.files,w.value=J.stats}catch(J){console.error("Failed to load commit details:",J),d.value=[],w.value={additions:0,deletions:0,filesChanged:0},fe("Failed to load commit details")}finally{ee.value=!1}}function It(){m.value=null,d.value=null,w.value=null,f.value=!1}function dt(){m.value=null,w.value=null,d.value=null,f.value=!0}function Vt(O){P.value=O,L.value=0,At()}const mt=U(()=>P.value?So(e.value,P.value).map(O=>O.hash):[]);function At(){K.value=mt.value.length}function Wt(){mt.value.length!==0&&(L.value=(L.value+1)%mt.value.length,At(),Ot())}function ln(){mt.value.length!==0&&(L.value=L.value<=0?mt.value.length-1:L.value-1,At(),Ot())}function Ot(){const O=mt.value[L.value];if(O){const J=e.value.find($e=>$e.hash===O);J&&Pt(J)}}function Je(O){const J=q.value.indexOf(O);J===-1?q.value.push(O):q.value.splice(J,1)}function xt(){P.value="",q.value=[]}async function Bt(O){if(!A.value)return{success:!1,error:"No working directory set"};re.value=!0;try{const J=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:A.value,branchName:O}});return J.success&&await Mt(A.value),{success:J.success,error:J.error}}catch(J){const $e=J instanceof Error?J.message:"Failed to checkout branch";return fe($e),{success:!1,error:$e}}finally{re.value=!1}}async function bt(O,J){if(!A.value)return{success:!1,error:"No working directory set"};try{const $e=await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:A.value,branchName:O,createBranch:!0,fromCommit:J}});return $e.success&&await Mt(A.value),{success:$e.success,error:$e.error}}catch($e){return{success:!1,error:$e instanceof Error?$e.message:"Failed to create branch"}}}async function en(O,J=!1){return Z("/api/git/branch",{branchName:O,force:J},"Failed to delete branch",{method:"DELETE"})}async function xn(O){return Z("/api/git/branch",{branchName:O,remote:!0},"Failed to delete remote branch",{method:"DELETE"})}async function Gt(O){if(!A.value)return{success:!1,error:"No working directory set"};te.value=!0;try{return await $fetch("/api/git/stage",{method:"POST",body:{workingDirectory:A.value,files:O}}),await at(),{success:!0}}catch(J){const $e=J instanceof Error?J.message:"Failed to stage files";return fe($e),{success:!1,error:$e}}finally{te.value=!1}}async function qt(O){if(!A.value)return{success:!1,error:"No working directory set"};te.value=!0;try{return await $fetch("/api/git/unstage",{method:"POST",body:{workingDirectory:A.value,files:O}}),await at(),{success:!0}}catch(J){const $e=J instanceof Error?J.message:"Failed to unstage files";return fe($e),{success:!1,error:$e}}finally{te.value=!1}}async function bn(O){if(!A.value)return{success:!1,error:"No working directory set"};V.value=!0;try{return await $fetch("/api/git/commit",{method:"POST",body:{workingDirectory:A.value,message:O}}),await Mt(A.value),{success:!0}}catch(J){const $e=J instanceof Error?J.message:"Failed to commit changes";return fe($e),{success:!1,error:$e}}finally{V.value=!1}}async function Ut(O,J){return Z("/api/git/branch-rename",{oldName:O,newName:J},"Failed to rename branch")}async function it(O,J){return Z("/api/git/merge",{branch:O,...J},"Failed to merge branch")}async function yn(O){return Z("/api/git/rebase",{onto:O},"Failed to rebase branch")}async function Ie(O,J,$e,ht){return Z("/api/git/push",{branch:O,remote:J,force:$e,forceWithLease:ht},"Failed to push branch")}async function Lt(O,J,$e,ht){return Z("/api/git/pull",{branch:O,remote:J,noFastForward:$e,squash:ht},"Failed to pull branch")}async function et(O,J,$e){return Z("/api/git/fetch",{branch:O,remote:J,...$e},"Failed to fetch")}async function cn(O,J,$e){return Z("/api/git/cherry-pick",{hash:O,recordOrigin:J,noCommit:$e},"Failed to cherry-pick commit")}async function Re(O){return Z("/api/git/revert",{hash:O},"Failed to revert commit")}async function yt(O,J){return Z("/api/git/reset",{hash:O,mode:J},"Failed to reset to commit")}async function Xe(O){if(!A.value)return{success:!1,error:"No working directory set"};try{return await $fetch("/api/git/checkout",{method:"POST",body:{workingDirectory:A.value,branchName:O}}),await Mt(A.value),{success:!0}}catch(J){const $e=J?.data?.message||J?.statusMessage||J?.message||"Failed to checkout commit";return fe($e),{success:!1,error:$e}}}async function Zt(O){try{const J=O.message.split(`
63
+ `)[0];return await Ln(J),{success:!0}}catch(J){const $e=J?.message||"Failed to copy commit subject";return fe($e),{success:!1,error:$e}}}async function Ue(O,J,$e,ht,Kt){return Z("/api/git/tag",{name:O,hash:J,annotated:$e,message:ht,pushToRemote:Kt},"Failed to create tag")}async function Et(O,J){return Z("/api/git/tag",{name:O,deleteFromRemote:J},"Failed to delete tag",{method:"DELETE"})}async function tt(O,J){return Z("/api/git/tag-push",{name:O,remote:J},"Failed to push tag")}async function un(O){if(!A.value)return{success:!1,error:"No working directory set"};try{return{success:!0,data:await $fetch(`/api/git/tag/${encodeURIComponent(O)}`,{query:{workingDirectory:A.value}})}}catch(J){const $e=rr(J,"Failed to get tag detail");return fe($e),{success:!1,error:$e}}}async function nt(O){try{return await Ln(O),{success:!0}}catch(J){const $e=J?.message||"Failed to copy tag name";return fe($e),{success:!1,error:$e}}}async function dn(){if(!A.value)return{success:!1,error:"No working directory set"};try{const O=await $fetch("/api/git/stash",{query:{workingDirectory:A.value}});return M.value=O.stashes,{success:!0}}catch(O){const J=rr(O,"Failed to load stashes");return fe(J),{success:!1,error:J}}}async function je(O,J){return Z("/api/git/stash-apply",{index:O,reinstateIndex:J},"Failed to apply stash")}async function tn(O,J){return Z("/api/git/stash-pop",{index:O,reinstateIndex:J},"Failed to pop stash")}async function rt(O){return Z("/api/git/stash-drop",{index:O},"Failed to drop stash")}async function fn(O,J){return Z("/api/git/stash-branch",{index:O,branchName:J},"Failed to create branch from stash")}async function ot(O,J){return Z("/api/git/stash",{message:O,includeUntracked:J},"Failed to stash changes")}async function wn(){if(!A.value)return{success:!1,error:"No working directory set"};try{const O=await $fetch("/api/git/remotes",{query:{workingDirectory:A.value}});return p.value=O.remotes,{success:!0}}catch(O){const J=rr(O,"Failed to load remotes");return fe(J),{success:!1,error:J}}}async function pe(O,J){return Z("/api/git/remote",{name:O,url:J},"Failed to add remote")}async function E(O,J){return Z("/api/git/remote",{name:O,newUrl:J},"Failed to edit remote",{method:"PUT"})}async function se(O){return Z("/api/git/remote",{name:O},"Failed to delete remote",{method:"DELETE"})}async function he(O,J){return Z("/api/git/fetch",{all:!0,prune:O,pruneTags:J},"Failed to fetch all")}function ze(){ae.value=ae.value==="inline"?"bottom":"inline"}function Ne(){G.value=G.value==="list"?"tree":"list"}function Ve(O){R.value=O}function Qe(){$.value=!$.value}function Ze(O){I.value={...I.value,[O]:!I.value[O]}}async function Nt(O){if(ve.value=O,xe.value=null,O&&A.value)try{const J=await $fetch("/api/git/merge-base",{params:{workingDirectory:A.value,branch:O}});xe.value=J.mergeBase}catch{xe.value=null}}async function ct(O){if(Te.value=O,qe.value=null,O&&A.value)try{const J=await $fetch("/api/git/merge-base",{params:{workingDirectory:A.value,branch:O}});qe.value=J.mergeBase}catch{qe.value=null}}async function b(O){if(Ye.value=O,Y.value=null,O&&A.value)try{const J=await $fetch("/api/git/merge-base",{params:{workingDirectory:A.value,branch:O}});Y.value=J.mergeBase}catch{Y.value=null}}async function D(){if(!A.value)return;const O=[];ve.value&&O.push((async()=>{try{const J=await $fetch("/api/git/merge-base",{params:{workingDirectory:A.value,branch:ve.value}});xe.value=J.mergeBase}catch{xe.value=null}})()),Te.value&&O.push((async()=>{try{const J=await $fetch("/api/git/merge-base",{params:{workingDirectory:A.value,branch:Te.value}});qe.value=J.mergeBase}catch{qe.value=null}})()),Ye.value&&O.push((async()=>{try{const J=await $fetch("/api/git/merge-base",{params:{workingDirectory:A.value,branch:Ye.value}});Y.value=J.mergeBase}catch{Y.value=null}})()),O.length>0&&await Promise.all(O)}function _(O){const J=e.value.find($e=>$e.hash===O||$e.shortHash===O);J&&Pt(J)}async function z(O){return Z("/api/git/reset",{hash:"HEAD",mode:O},"Failed to reset working directory")}async function le(){return Z("/api/git/clean",{},"Failed to clean untracked files")}function ye(O){H.value=O}function x(){H.value=null}function y(O){W.value=O}function ke(){W.value=null}const Fe=C(null),st=C(null),kn=C(!1),wr=U(()=>!!k.value&&!!m.value);function kr(O){k.value=O,O&&m.value&&Jn()}function Cr(){k.value=null,Fe.value=null,st.value=null,kn.value=!1}async function Jn(){if(!(!A.value||!m.value||!k.value)){kn.value=!0;try{const O=k.value.hash,J=m.value.hash,$e=await $fetch("/api/git/diff",{query:{workingDirectory:A.value,from:O,to:J}});Fe.value=$e.files,st.value=$e.stats}catch(O){console.error("Failed to load comparison:",O),fe("Failed to load commit comparison"),Fe.value=null,st.value=null}finally{kn.value=!1}}}async function Ln(O){navigator?.clipboard&&await navigator.clipboard.writeText(O)}async function $r(O,J){de.value=J,oe.value=O,be.value=null,Se.value=!0,await Nn()}function Sr(){de.value=null,oe.value=null,be.value=null,Se.value=!1}async function Nn(){if(!A.value||!oe.value||!de.value){Se.value=!1;return}Se.value=!0;try{const O=await $fetch("/api/git/file-diff",{query:{workingDirectory:A.value,commitHash:oe.value,filePath:de.value.path}});be.value=O}catch(O){console.error("Failed to load file diff:",O),fe("Failed to load file diff"),be.value=null}finally{Se.value=!1}}function Ae(){e.value=[],n.value=[],t.value=[],a.value=new Set,s.value=[],l.value=[],c.value=0,f.value=!1,m.value=null,d.value=null,w.value=null,T.value=!1,g.value=null,v.value=!1,h.value=0,P.value="",q.value=[],A.value=null,j.value=null,F.value=!1,B.value=!1,X.value=null,Ht.value=!1,ee.value=!1,te.value=!1,V.value=!1,re.value=!1,M.value=[],p.value=[],k.value=null,Fe.value=null,st.value=null,kn.value=!1,H.value=null,W.value=null,ae.value="inline",G.value="list",R.value="rounded",$.value=!1,I.value={date:!0,author:!0,commit:!0},L.value=0,K.value=0,ve.value=null,Te.value=null,qe.value=null,Ye.value=null,Y.value=null,de.value=null,oe.value=null,be.value=null,Se.value=!1,ne(),we.clear()}async function Fn(){if(!A.value||B.value||T.value)return!1;B.value=!0;try{const O=(await $fetch("/api/git/state",{query:{workingDirectory:A.value}})).state,J=X.value;if(X.value=O,j.value=Date.now(),!J)return!1;const $e=J.headCommit!==O.headCommit||J.branchListHash!==O.branchListHash,ht=J.workingTreeHash!==O.workingTreeHash,Kt=J.stashListHash!==O.stashListHash;if($e){const[hn,er,Ts]=await Promise.all([$fetch("/api/git/log",{query:{workingDirectory:A.value}}),$fetch("/api/git/status",{query:{workingDirectory:A.value}}),$fetch("/api/git/stash",{query:{workingDirectory:A.value}}).then(Ms=>Ms.stashes).catch(()=>[])]);return e.value=hn.commits,n.value=hn.branches,t.value=hn.tags,a.value=new Set(hn.localBranches??[]),v.value=hn.hasMore,h.value=hn.totalCount,s.value=er.stagedFiles??[],l.value=er.unstagedFiles??[],c.value=(er.stagedCount??0)+(er.unstagedCount??0),M.value=Ts,await D(),!0}if(!ht&&!Kt)return!1;const[Yt,mn]=await Promise.all([ht?$fetch("/api/git/status",{query:{workingDirectory:A.value}}):Promise.resolve(null),Kt?$fetch("/api/git/stash",{query:{workingDirectory:A.value}}).then(hn=>hn.stashes).catch(()=>[]):Promise.resolve(null)]);return Yt&&(s.value=Yt.stagedFiles??[],l.value=Yt.unstagedFiles??[],c.value=(Yt.stagedCount??0)+(Yt.unstagedCount??0)),mn&&(M.value=mn),!0}catch(O){return console.error("Failed to refresh git graph:",O),!1}finally{B.value=!1}}function An(){F.value=!0}function vo(){F.value=!1}return{commits:Ce(e),branches:Ce(n),tags:Ce(t),localBranchNames:Ce(a),stagedFiles:Ce(s),unstagedFiles:Ce(l),uncommittedChangesCount:Ce(c),isUncommittedChangesSelected:Ce(f),selectedCommit:Ce(m),selectedCommitFiles:Ce(d),selectedCommitStats:Ce(w),loading:Ce(T),loadingMore:Ce(Ht),error:Ce(g),hasMore:Ce(v),totalCount:Ce(h),searchQuery:Ce(P),filteredBranches:Ce(q),workingDirectory:Ce(A),stashes:Ce(M),remotes:Ce(p),comparisonCommit:Ce(k),comparisonFiles:Ce(Fe),comparisonStats:Ce(st),comparisonLoading:Ce(kn),isComparing:wr,activeDialog:Ce(H),activeContextMenu:Ce(W),detailViewPosition:Ce(ae),fileViewMode:Ce(G),graphStyle:Ce(R),muteNonAncestral:Ce($),columnVisibility:Ce(I),searchResultIndex:Ce(L),searchResultCount:Ce(K),selectedFeatureId:Ce(ve),featureMergeBase:Ce(xe),conversationBranch:Ce(Te),conversationMergeBase:Ce(qe),previewBranch:Ce(Ye),previewMergeBase:Ce(Y),diffViewerFile:Ce(de),diffViewerCommitHash:Ce(oe),diffViewerContent:Ce(be),diffViewerLoading:Ce(Se),lastRefreshTime:Ce(j),isPollingActive:Ce(F),isRefreshing:Ce(B),isLoadingDetails:Ce(ee),isStaging:Ce(te),isCommitting:Ce(V),isCheckingOut:Ce(re),operationError:Ce(ie),filteredCommits:Oe,currentBranch:zt,searchResultHashes:mt,loadGitGraph:Mt,loadMoreCommits:Rt,refreshUncommittedChanges:at,selectCommit:Pt,selectUncommittedChanges:dt,clearSelection:It,setSearchQuery:Vt,toggleBranchFilter:Je,clearFilters:xt,nextSearchResult:Wt,prevSearchResult:ln,checkoutBranch:Bt,createBranch:bt,deleteLocalBranch:en,deleteRemoteBranch:xn,stageFiles:Gt,unstageFiles:qt,commitChanges:bn,reset:Ae,clearOperationError:ne,renameBranch:Ut,mergeBranch:it,rebaseBranch:yn,pushBranch:Ie,pullBranch:Lt,fetchBranch:et,cherryPickCommit:cn,revertCommit:Re,resetToCommit:yt,checkoutCommit:Xe,copyCommitSubject:Zt,createTag:Ue,deleteTag:Et,pushTag:tt,getTagDetail:un,copyTagName:nt,loadStashes:dn,applyStash:je,popStash:tn,dropStash:rt,stashBranch:fn,stashChanges:ot,loadRemotes:wn,addRemote:pe,editRemote:E,deleteRemote:se,fetchAll:he,setActiveDialog:ye,clearActiveDialog:x,setActiveContextMenu:y,clearActiveContextMenu:ke,selectComparisonCommit:kr,clearComparison:Cr,loadComparisonData:Jn,copyToClipboard:Ln,toggleDetailViewPosition:ze,toggleFileViewMode:Ne,setGraphStyle:Ve,toggleMuteNonAncestral:Qe,toggleColumnVisibility:Ze,navigateToCommit:_,resetWorking:z,cleanUntracked:le,setSelectedFeatureId:Nt,setConversationBranch:ct,setPreviewBranch:b,openFileDiff:$r,closeFileDiff:Sr,checkAndRefresh:Fn,startPolling:An,stopPolling:vo}});async function Du(){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!==Ir&&console.warn(`[conversationStorage] Storage version mismatch: ${e.version} vs ${Ir}`);const n=e.conversations.map(m=>{if(!m||typeof m!="object")return m;const d=m;return"claudeSessionId"in d&&!("providerSessionId"in d)?{...d,providerSessionId:d.claudeSessionId}:m}),a=(Array.isArray(e.archivedConversations)?e.archivedConversations:[]).map(m=>{if(!m||typeof m!="object")return m;const d=m;return"claudeSessionId"in d&&!("providerSessionId"in d)?{...d,providerSessionId:d.claudeSessionId}:m}),s=n.filter(Is),l=a.filter(Ls),c=n.length-s.length,f=a.length-l.length;return c>0&&console.warn(`[conversationStorage] Discarded ${c} corrupted active conversation(s)`),f>0&&console.warn(`[conversationStorage] Discarded ${f} corrupted archive conversation(s)`),{conversations:s,archivedConversations:l,discardedConversations:c,discardedArchives:f}}catch(e){return console.error("[conversationStorage] Failed to load conversations:",e),{conversations:[],archivedConversations:[],discardedConversations:0,discardedArchives:0}}}async function Iu(e,n=[]){if(typeof window>"u")return!1;try{return await $fetch("/api/conversations",{method:"POST",body:{version:Ir,conversations:e,archivedConversations:n}}),!0}catch(t){return console.error("Failed to save conversations:",t),!1}}function Lu(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 gt=hr("chat",()=>{const e=C(!1),n=C(Ns),t=C("ask"),a=C(""),s=C([]),l=C([]),c=C(null),f=C("active"),m=C(new Set),d=new Map,w=C(0),T=new Map,g=1200,v=C(null),h=C(null);function P(b){return b?d.get(b)??null:null}function q(b){let D=d.get(b);return D||(D={session:null,pendingPermission:null,pendingPlanApproval:null,lastError:null,debugEvents:[]},d.set(b,D)),D}const A=U(()=>s.value.find(b=>b.id===c.value)||null),ee=U(()=>A.value?.messages??[]),te=U(()=>(w.value,P(c.value)?.session??null)),V=U(()=>(w.value,P(c.value)?.pendingPermission??null)),re=U(()=>(w.value,P(c.value)?.pendingPlanApproval??null)),ie=U(()=>(w.value,P(c.value)?.lastError??null)),ue=U(()=>(w.value,P(c.value)?.debugEvents??[])),fe=U(()=>te.value?.status==="streaming"),ne=U(()=>A.value?.providerSessionId??""),Z=U(()=>ee.value.length>0),j=U(()=>ee.value[ee.value.length-1]||null);function F(b){return m.value.has(b)}const B=U(()=>c.value?m.value.has(c.value):!1),X=U(()=>s.value.length>0),M=U(()=>l.value.length>0),p=U(()=>s.value.length),k=U(()=>p.value>=bo),H=U(()=>s.value),W=U(()=>l.value),ae=U(()=>v.value&&s.value.find(b=>b.id===v.value)||null);function G(b){return v.value===b}function R(b){f.value=b}async function $(b){if(!(!b?.previewBranch||!b.worktreePath))try{const D=await $fetch("/api/chat/preview-sync",{method:"POST",body:{previewBranch:b.previewBranch,worktreePath:b.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:b.id,previewBranch:b.previewBranch,worktreePath:b.worktreePath,error:D instanceof Error?D.message:String(D)})}}async function I(b){if(F(b))return{success:!1,error:"Cannot archive while this conversation is streaming"};if(s.value.findIndex(_=>_.id===b)===-1)return{success:!1,error:"Conversation not found"};try{const _=await $fetch(`/api/conversations/${b}/archive`,{method:"POST"});if(_.success&&_.archived){const z=T.get(b);return z&&(clearTimeout(z),T.delete(b)),d.delete(b),s.value=Array.isArray(_.conversations)?_.conversations:s.value.filter(le=>le.id!==b),l.value=Array.isArray(_.archivedConversations)?_.archivedConversations:[_.archived,...l.value],Ue(),v.value===b&&(v.value=null),c.value===b&&(c.value=s.value[0]?.id??null),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:c.value}}).catch(le=>{console.error("Failed to save active conversation:",le)}),{success:!0}}return{success:!1,error:"Failed to archive conversation"}}catch(_){return{success:!1,error:_ instanceof Error?_.message:"Failed to archive conversation"}}}async function L(b,D){if(Qe().atLimit)return{success:!1,error:`Cannot restore. Active conversations reached ${yo}.`};if(!l.value.some(z=>z.id===b))return{success:!1,error:"Archived conversation not found"};try{const z=await $fetch(`/api/conversations/archives/${b}/restore`,{method:"POST",body:{baseBranch:D}});return z.success&&z.conversation?(s.value=Array.isArray(z.conversations)?z.conversations:[z.conversation,...s.value],Array.isArray(z.archivedConversations)?l.value=z.archivedConversations:l.value=l.value.filter(le=>le.id!==b),f.value="active",tt(z.conversation.id),Zt(),Re(),{success:!0,conversationId:z.conversation.id}):{success:!1,error:"Failed to restore archived conversation"}}catch(z){return{success:!1,error:z instanceof Error?z.message:"Failed to restore archived conversation"}}}async function K(b){const D=l.value.findIndex(_=>_.id===b);if(D===-1)return{success:!1,error:"Archived conversation not found"};try{const _=await $fetch(`/api/conversations/archives/${b}`,{method:"DELETE"});return _.success?(Array.isArray(_.archivedConversations)?l.value=_.archivedConversations:l.value.splice(D,1),Ue(),{success:!0}):{success:!1,error:"Failed to delete archived conversation"}}catch{return l.value.splice(D,1),Re(),{success:!0}}}async function ve(){if(!(typeof window>"u"))try{const b=await $fetch("/api/settings");if(b){if(typeof b.panelWidth=="number"){const z=b.panelWidth;z>=wo&&z<=ko&&(n.value=z)}typeof b.isPanelOpen=="boolean"&&(e.value=b.isPanelOpen),typeof b.activeConversationId=="string"&&(c.value=b.activeConversationId);const{useSettingsStore:D}=await Cn(async()=>{const{useSettingsStore:z}=await import("./BMzDNyt_.js").then(le=>le.s);return{useSettingsStore:z}},__vite__mapDeps([0,1,2]),import.meta.url),_=D();await _.hydrate(),t.value=_.permissionMode}}catch(b){console.error("Failed to load chat settings:",b)}}function xe(b){t.value=b,typeof window<"u"&&Cn(async()=>{const{useSettingsStore:D}=await import("./BMzDNyt_.js").then(_=>_.s);return{useSettingsStore:D}},__vite__mapDeps([0,1,2]),import.meta.url).then(({useSettingsStore:D})=>{D().setPermissionMode(b)})}function Te(b,D){const _=D??c.value;if(!_)return;const z=q(_);z.pendingPermission=b,w.value++}function qe(b){const D=b??c.value;if(!D)return;const _=d.get(D);_&&(_.pendingPermission=null,w.value++)}function Ye(b,D){const _=D??c.value;if(!_)return;const z=q(_);z.pendingPlanApproval=b,w.value++}function Y(b){const D=b??c.value;if(!D)return;const _=d.get(D);_&&(_.pendingPlanApproval=null,w.value++)}function de(){e.value=!e.value,Se()}function oe(){e.value=!0,Se()}function be(){e.value=!1,Se()}function Se(){typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{isPanelOpen:e.value}}).catch(b=>{console.error("Failed to save panel state:",b)})}function we(b){const D=Math.max(wo,Math.min(ko,b));n.value=D,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{panelWidth:D}}).catch(_=>{console.error("Failed to save panel width:",_)})}function Be(b){a.value=b}function Oe(b,D){const _=D??c.value;if(!_)return;const z=s.value.find(le=>le.id===_);z&&(z.providerSessionId=b)}function zt(b,D){const _=s.value.find(z=>z.id===b);_&&(_.worktreeBranch=D,_.lastCommitTime=new Date().toISOString())}async function Mt(b){const D=s.value.find(z=>z.id===b);if(!D?.worktreeBranch)return null;const _=D.worktreeBranch.trim();if(!_)return null;try{const le=(await $fetch("/api/specs/features")).features.find(ye=>ye.id===_);return le?(D.featureId!==le.id&&(D.featureId=le.id,D.updatedAt=new Date().toISOString(),Re()),le.id):null}catch(z){return console.warn("[chat] Failed to map branch to feature",{conversationId:b,branchName:_,error:z instanceof Error?z.message:String(z)}),null}}function at(b,D,_){const z=s.value.find(le=>le.id===b);z&&(z.providerId=D,z.providerModelKey=_)}function Ht(b){const D=b??c.value;if(!D)return;const _=s.value.find(z=>z.id===D);_&&(_.providerSessionId="")}function Rt(b){return s.value.find(_=>_.id===b)?.providerSessionId??""}function Pt(b){m.value.add(b)}function It(b){m.value.delete(b)}function dt(b,D){const _=D??c.value;if(!_)return;const z=s.value.find(le=>le.id===_);z&&z.messages.push(b)}function Vt(b,D,_){const z={id:ur(),role:"user",content:b,attachments:_&&_.length>0?_:void 0,timestamp:new Date().toISOString()};return dt(z,D),z}function mt(b){const D={id:ur(),role:"assistant",content:"",timestamp:new Date().toISOString(),status:"streaming"};return dt(D,b),D}function At(b,D,_){const z=_??c.value;if(!z)return;const le=s.value.find(x=>x.id===z);if(!le)return;const ye=le.messages.findIndex(x=>x.id===b);ye!==-1&&(le.messages[ye]={...le.messages[ye],...D})}function Wt(b,D,_){const z=_??c.value;if(!z)return;const le=s.value.find(x=>x.id===z);if(!le)return;const ye=le.messages.findIndex(x=>x.id===b);ye!==-1&&(le.messages[ye].content+=D)}function ln(b,D,_){const z=_??c.value;if(!z)return;const le=s.value.find(x=>x.id===z);if(!le)return;const ye=le.messages.findIndex(x=>x.id===b);if(ye!==-1){const x=le.messages[ye],y=x.tools?[...x.tools,D]:[D];le.messages[ye]={...x,tools:y}}}function Ot(b,D,_,z){const le=z??c.value;if(!le)return;const ye=s.value.find(y=>y.id===le);if(!ye)return;const x=ye.messages.findIndex(y=>y.id===b);if(x!==-1){const y=ye.messages[x];if(y.tools){const ke=y.tools.findIndex(Fe=>Fe.id===D);if(ke!==-1){const Fe=[...y.tools];Fe[ke]={...Fe[ke],..._},ye.messages[x]={...y,tools:Fe}}}}yt(le,!1)}function Je(b){b.contentBlocks&&(b.content=Lu(b.contentBlocks))}function xt(b,D){const _=D??c.value;if(!_)return;const z=s.value.find(ye=>ye.id===_);if(!z)return;const le=z.messages.find(ye=>ye.id===b);le&&!le.contentBlocks&&(le.contentBlocks=[])}function Bt(b,D,_){const z=_??c.value;if(!z)return;const le=s.value.find(x=>x.id===z);if(!le)return;const ye=le.messages.find(x=>x.id===b);ye&&(ye.contentBlocks||(ye.contentBlocks=[]),ye.contentBlocks.push(D),Je(ye))}function bt(b,D,_,z){const le=z??c.value;if(!le)return;const ye=s.value.find(st=>st.id===le);if(!ye)return;const x=ye.messages.find(st=>st.id===b);if(!x?.contentBlocks)return;const y=x.contentBlocks.findIndex(st=>st.id===D);if(y===-1)return;const Fe={...x.contentBlocks[y]};_(Fe),x.contentBlocks[y]=Fe}function en(b,D,_,z,le){const ye=z??c.value;if(!ye)return;const x=s.value.find(ke=>ke.id===ye);if(!x)return;const y=x.messages.find(ke=>ke.id===b);y&&(bt(b,D,_,ye),le?.syncContent!==!1&&Je(y),yt(ye,!1))}function xn(b,D,_){const z=_??c.value;z&&(Bt(b,D,z),yt(z,!1))}function Gt(b,D,_){const z=_??c.value;if(!z)return null;const le=s.value.find(x=>x.id===z);if(!le)return null;const ye=le.messages.find(x=>x.id===b);return ye?.contentBlocks?ye.contentBlocks.find(x=>x.type==="tool_use"&&x.toolUseId===D)??null:null}function qt(b,D){const _=D??c.value;if(!_)return;const z=d.get(_);z?.session&&(z.session.status=b,w.value++)}function bn(b,D){const _=D??c.value;if(!_)return;const z=q(_);z.session={sessionId:b,cwd:a.value,status:"streaming",startedAt:new Date().toISOString()},z.lastError=null,w.value++}function Ut(b){const D=b??c.value;if(!D)return;const _=d.get(D);_?.session&&(_.session.status="idle",w.value++)}function it(b,D){const _=D??c.value;if(!_)return;const z=q(_);z.session&&(z.session.status="error",z.session.error=b),z.lastError=b,w.value++}function yn(b,D){const _=D??c.value;if(!_)return;const z=q(_),le=(()=>{if(typeof b.payload=="string")return b.payload;try{return JSON.stringify(b.payload,null,2)}catch{return String(b.payload)}})(),ye=8e3,x=300,y=le.length>ye?`${le.slice(0,ye)}
65
+ ... (truncated)`:le;z.debugEvents.push({id:`dbg-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,timestamp:new Date().toISOString(),direction:b.direction,channel:b.channel,eventType:b.eventType||"unknown",payload:y}),z.debugEvents.length>x&&z.debugEvents.splice(0,z.debugEvents.length-x),w.value++}function Ie(b){const D=b??c.value;if(!D)return;const _=d.get(D);_&&(_.debugEvents=[],w.value++)}function Lt(){if(!c.value)return;const b=s.value.find(_=>_.id===c.value);b&&(b.messages=[]);const D=c.value;d.delete(D),w.value++}function et(b){const D=b??c.value;if(!D)return;const _=d.get(D);_&&(_.lastError=null,_.session&&(_.session.error=void 0),w.value++)}async function cn(){const b=await Du();if(s.value=b.conversations,l.value=b.archivedConversations,b.discardedArchives>0&&console.warn(`[chat] Skipped ${b.discardedArchives} corrupted archived conversation(s)`),Zt(),Ue(),!v.value){const D=s.value.find(_=>!!_.previewBranch&&!_.finalized);D&&(v.value=D.id)}if(c.value){const D=s.value.find(_=>_.id===c.value);D&&D.cwd?a.value=D.cwd:D||(c.value=null,e.value=!1)}}function Re(){Iu(s.value,l.value)}function yt(b,D=!1){const _=s.value.find(z=>z.id===b);if(_)if(D){const z=T.get(b);z&&(clearTimeout(z),T.delete(b)),_.updatedAt=new Date().toISOString(),Re()}else{const z=T.get(b);z&&clearTimeout(z);const le=setTimeout(()=>{_.updatedAt=new Date().toISOString(),Re(),T.delete(b)},g);T.set(b,le)}}function Xe(b=!1){c.value&&yt(c.value,b)}function Zt(){s.value.sort((b,D)=>new Date(D.createdAt).getTime()-new Date(b.createdAt).getTime())}function Ue(){l.value.sort((b,D)=>new Date(D.archivedAt).getTime()-new Date(b.archivedAt).getTime())}async function Et(b){if(Qe().atLimit)return"";const _=zo();let z=null;if(b?.featureId){const y=await $fetch("/api/chat/worktree",{method:"POST",body:{conversationId:_,featureId:b.featureId,baseBranch:b.baseBranch}});if(!y.success&&y.error)throw new Error(y.error);z=y}let le=null;if(typeof window<"u")try{const{useSettingsStore:y}=await Cn(async()=>{const{useSettingsStore:Fe}=await import("./BMzDNyt_.js").then(st=>st.s);return{useSettingsStore:Fe}},__vite__mapDeps([0,1,2]),import.meta.url),ke=y();await ke.hydrate(),le=ke.providerSelection}catch(y){console.warn("[chat] Failed to load provider selection for new conversation",y)}const ye=le||{providerId:Wo,modelKey:Vo},x={id:_,title:"New Conversation",messages:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),cwd:a.value||process.cwd?.()||"",featureId:b?.featureId,providerId:ye.providerId,providerModelKey:ye.modelKey};if(z?.success&&z.worktreePath&&z.branch&&(x.worktreePath=z.worktreePath,x.worktreeBranch=z.branch,x.cwd=z.worktreePath,x.hasWorktree=!0,z.baseBranch&&(x.baseBranch=z.baseBranch),z.providerSessionId&&(x.providerSessionId=z.providerSessionId)),s.value.unshift(x),c.value=_,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:_}}).catch(y=>{console.error("Failed to save active conversation:",y)}),!b?.featureId)try{const y=await $fetch("/api/chat/worktree",{method:"POST",body:{conversationId:_,baseBranch:b?.baseBranch}});if(y.success&&y.worktreePath&&y.branch){const ke=s.value.find(Fe=>Fe.id===_);ke&&(ke.worktreePath=y.worktreePath,ke.worktreeBranch=y.branch,ke.cwd=y.worktreePath,ke.hasWorktree=!0,y.baseBranch&&(ke.baseBranch=y.baseBranch))}}catch(y){console.warn("[chat] Failed to create worktree for conversation",_,y)}return Re(),_}function tt(b){const D=s.value.find(_=>_.id===b);D&&(c.value=b,e.value=!0,D.cwd&&(a.value=D.cwd),!D.featureId&&D.worktreeBranch&&Mt(b),typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:b,isPanelOpen:!0}}).catch(_=>{console.error("Failed to save active conversation:",_)}))}async function un(b){const D=s.value.findIndex(le=>le.id===b);if(D===-1)return;const _=s.value[D];if(v.value===b&&(v.value=null),_.hasWorktree&&_.worktreePath&&_.worktreeBranch)try{await $fetch("/api/chat/worktree",{method:"DELETE",body:{worktreePath:_.worktreePath,branch:_.worktreeBranch}})}catch(le){console.warn("[chat] Failed to clean up worktree for conversation",b,le)}s.value.splice(D,1),d.delete(b);const z=T.get(b);z&&(clearTimeout(z),T.delete(b)),c.value===b&&(c.value=null,typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{activeConversationId:null}}).catch(le=>{console.error("Failed to clear active conversation:",le)})),Re()}async function nt(b,D,_){const z=s.value.find(ye=>ye.id===b);if(!z)return{success:!1,error:"Conversation not found"};if(!z.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const le=_||z.baseBranch;try{const ye=await $fetch("/api/chat/finalize",{method:"POST",body:{conversationId:b,commitMessage:D,baseBranch:le,worktreePath:z.worktreePath,worktreeBranch:z.worktreeBranch}});return ye.success?(v.value===b&&(v.value=null),z.worktreePath=void 0,z.worktreeBranch=void 0,z.hasWorktree=!1,z.baseBranch=void 0,z.previewBranch=void 0,z.finalized=!0,z.updatedAt=new Date().toISOString(),Re()):ye.rebaseInProgress&&ye.conflictFiles?.length&&await je(b,z.worktreePath,le||"main",D),ye}catch(ye){return{success:!1,error:ye instanceof Error?ye.message:String(ye)}}}async function dn(b,D){const _=s.value.find(le=>le.id===b);if(!_)return{success:!1,error:"Conversation not found"};if(!_.hasWorktree)return{success:!1,error:"No worktree associated with this conversation"};const z=D||_.baseBranch;try{const le=await $fetch("/api/chat/rebase",{method:"POST",body:{conversationId:b,baseBranch:z,worktreePath:_.worktreePath}});return le.rebaseInProgress&&le.conflictFiles?.length?await je(b,_.worktreePath,z||"main","","sync"):le.success&&(await $(_),_.baseBranch=z,Re()),le}catch(le){return{success:!1,error:le instanceof Error?le.message:String(le)}}}async function je(b,D,_,z,le="finalize"){h.value={conversationId:b,worktreePath:D,baseBranch:_,commitMessage:z,files:[],resolvedFiles:new Set,loading:!0,error:null,mode:le};try{const ye=await $fetch("/api/rebase/conflicts",{params:{worktreePath:D}});h.value&&(h.value.files=ye.files,h.value.loading=!1)}catch(ye){h.value&&(h.value.error=ye instanceof Error?ye.message:String(ye),h.value.loading=!1)}}async function tn(b,D){if(!h.value)return!1;try{const _=await $fetch("/api/rebase/resolve",{method:"PUT",body:{worktreePath:h.value.worktreePath,filePath:b,content:D}});return _.success&&h.value&&h.value.resolvedFiles.add(b),_.success}catch{return!1}}async function rt(){if(!h.value)return{success:!1,error:"No conflict resolution in progress"};const{conversationId:b,commitMessage:D,baseBranch:_,mode:z,worktreePath:le}=h.value,ye=z==="sync"?"/api/rebase/continue-sync":"/api/rebase/continue";try{const x=s.value.find(ke=>ke.id===b),y=await $fetch(ye,{method:"POST",body:{conversationId:b,commitMessage:D,baseBranch:_,worktreePath:le,worktreeBranch:x?.worktreeBranch}});if(y.success){if(z==="finalize"){v.value===b&&(v.value=null);const ke=s.value.find(Fe=>Fe.id===b);ke&&(ke.worktreePath=void 0,ke.worktreeBranch=void 0,ke.hasWorktree=!1,ke.baseBranch=void 0,ke.previewBranch=void 0,ke.finalized=!0,ke.updatedAt=new Date().toISOString(),Re())}else if(z==="sync"){const ke=s.value.find(Fe=>Fe.id===b);ke&&(await $(ke),ke.baseBranch=_,ke.updatedAt=new Date().toISOString(),Re())}h.value=null}else y.rebaseInProgress&&y.conflictFiles?.length&&await je(b,le,_,D,z);return y}catch(x){return{success:!1,error:x instanceof Error?x.message:String(x)}}}async function fn(){if(!h.value)return!1;try{const b=await $fetch("/api/rebase/abort",{method:"POST",body:{worktreePath:h.value.worktreePath}});return h.value=null,b.success}catch{return h.value=null,!1}}async function ot(b){if(!h.value)return!1;const D=h.value.files.find(_=>_.path===b);if(!D)return!1;try{const _=await $fetch("/api/rebase/ai-resolve",{method:"POST",body:{worktreePath:h.value.worktreePath,filePath:b,conflictContent:D.content}});return _.success&&_.resolvedContent!==void 0?(D.content=_.resolvedContent,await tn(b,_.resolvedContent)):!1}catch{return!1}}async function wn(){if(!h.value)return;const b=h.value.files.filter(D=>!h.value.resolvedFiles.has(D.path));for(const D of b)await ot(D.path)}async function pe(b){const D=s.value.find(_=>_.id===b);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 _=await $fetch("/api/chat/preview",{method:"POST",body:{conversationId:b,worktreePath:D.worktreePath,baseBranch:D.baseBranch}});return _.success&&_.previewBranch&&(D.previewBranch=_.previewBranch,v.value=b,D.updatedAt=new Date().toISOString(),Re()),{success:_.success,error:_.error}}catch(_){return{success:!1,error:_ instanceof Error?_.message:String(_)}}}async function E(b){const D=s.value.find(_=>_.id===b);if(!D)return{success:!1,error:"Conversation not found"};if(!D.previewBranch||!D.baseBranch)return v.value=null,{success:!1,error:"No active preview"};try{const _=await $fetch("/api/chat/preview",{method:"DELETE",body:{previewBranch:D.previewBranch,baseBranch:D.baseBranch}});return _.success&&(D.previewBranch=void 0,v.value=null,D.updatedAt=new Date().toISOString(),Re()),{success:_.success,error:_.error}}catch(_){return{success:!1,error:_ instanceof Error?_.message:String(_)}}}async function se(b){if(v.value===b)return await E(b);if(v.value){const D=await E(v.value);if(!D.success)return{success:!1,error:`Failed to end previous preview: ${D.error}`}}return await pe(b)}function he(b){const D=b.trim();if(!D)return null;const _=s.value.filter(z=>z.featureId===D?!0:z.worktreeBranch?.trim()===D);return _.length===0?null:_.sort((z,le)=>new Date(le.updatedAt).getTime()-new Date(z.updatedAt).getTime())[0]||null}function ze(b){s.value.unshift(b),Zt(),Re()}function Ne(b,D){const _=s.value.find(z=>z.id===b);_&&(_.title=D.trim(),_.updatedAt=new Date().toISOString(),Zt(),Re())}function Ve(b){const D=c.value;if(!D)return;const _=s.value.find(le=>le.id===D);if(!_||_.title!=="New Conversation")return;const z=_.messages.find(le=>le.role==="user");z&&(z.content.trim().length>0?_.title=Fs(z.content):z.attachments&&z.attachments.length>0&&(_.title=z.attachments.length===1?"[Image] New Conversation":`[${z.attachments.length} Images] New Conversation`))}function Qe(){const b=s.value.length;return{atLimit:b>=yo,nearLimit:b>=bo,count:b}}async function Ze(b,D){c.value||await Et();const _=Vt(b,void 0,D);return Ve(),Xe(!0),_}function Nt(b,D,_){const z=_??c.value;Wt(b,D,z??void 0),z&&yt(z,!1)}function ct(b,D){const _=D??c.value;At(b,{status:"complete"},_??void 0),_&&yt(_,!0)}return{messages:ee,session:te,isPanelOpen:e,panelWidth:Ce(n),permissionMode:Ce(t),pendingPermission:V,pendingPlanApproval:re,cwd:Ce(a),lastError:ie,debugEvents:ue,providerSessionId:ne,conversations:Ce(s),archivedConversations:Ce(l),activeConversationId:Ce(c),conversationViewMode:Ce(f),conflictState:Ce(h),previewingConversationId:Ce(v),isStreaming:fe,hasMessages:Z,lastMessage:j,isActiveConversationStreaming:B,hasConversations:X,hasArchivedConversations:M,activeConversation:A,conversationCount:p,isNearStorageLimit:k,sortedConversations:H,sortedArchivedConversations:W,previewingConversation:ae,streamingConversations:Ce(m),initialize:ve,togglePanel:de,openPanel:oe,closePanel:be,setPanelWidth:we,setPermissionMode:xe,setPendingPermission:Te,clearPendingPermission:qe,setPendingPlanApproval:Ye,clearPendingPlanApproval:Y,setCwd:Be,setProviderSessionId:Oe,clearProviderSession:Ht,getProviderSessionId:Rt,updateWorktreeBranch:zt,setConversationProviderSelection:at,startConversationStreaming:Pt,endConversationStreaming:It,isConversationStreaming:F,addMessage:dt,addUserMessage:Vt,addAssistantMessage:mt,updateMessage:At,appendToMessage:Wt,addToolToMessage:ln,updateToolInMessage:Ot,initContentBlocks:xt,appendContentBlock:Bt,appendContentBlockWithSave:xn,updateBlockById:bt,updateBlockWithSave:en,findToolUseBlock:Gt,syncContentFromBlocks:Je,setSessionStatus:qt,startSession:bn,endSession:Ut,setSessionError:it,pushDebugEvent:yn,clearDebugEvents:Ie,clearMessages:Lt,clearError:et,loadConversations:cn,saveAllConversations:Re,saveCurrentConversation:Xe,saveConversation:yt,createConversation:Et,selectConversation:tt,deleteConversation:un,archiveConversation:I,restoreArchivedConversation:L,deleteArchivedConversation:K,setConversationViewMode:R,findConversationByFeature:he,syncConversationFeatureFromBranch:Mt,addAutoModeConversation:ze,renameConversation:Ne,checkStorageLimits:Qe,finalizeConversation:nt,rebaseConversation:dn,resolveConflictFile:tn,continueRebase:rt,abortRebase:fn,aiResolveConflictFile:ot,aiResolveAllConflicts:wn,previewConversation:pe,unpreviewConversation:E,togglePreview:se,isConversationPreviewing:G,addUserMessageWithConversation:Ze,appendToMessageWithSave:Nt,completeMessageWithSave:ct}});function Nu(e={}){const n=Qn(),t=300,a=5e3,s=250;let l=null,c=null,f=null,m=null,d=null,w=!1,T=!1;const g=C(!1),v=C(!1);let h=e;function P(F){h=F}async function q(){const F=h.getScrollPosition?.()??0,B=await n.checkAndRefresh();return B&&h.setScrollPosition&&(await vn(),h.setScrollPosition(F)),B}function A(){return g.value||!!n.activeContextMenu||!!n.activeDialog}async function ee(){if(A()){v.value=!0;return}V()}async function te(){if(w){T=!0;return}w=!0;try{await q()}finally{w=!1,T&&(T=!1,V())}}function V(){c&&clearTimeout(c),c=setTimeout(()=>{c=null,te()},s)}function re(F){if(typeof window>"u")return;if(f&&f.readyState===WebSocket.OPEN){f.send(JSON.stringify({type:"watch",workingDirectory:F}));return}m&&(clearTimeout(m),m=null);const X=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/git-watcher-ws`;f=new WebSocket(X),f.onopen=()=>{f.send(JSON.stringify({type:"watch",workingDirectory:F}))},f.onmessage=M=>{try{JSON.parse(M.data).type==="git_changed"&&ee()}catch{}},f.onclose=()=>{f=null,n.isPollingActive&&d&&(m=setTimeout(()=>{d&&re(d)},a))},f.onerror=()=>{}}function ie(){m&&(clearTimeout(m),m=null),f&&(f.close(),f=null)}function ue(F){F&&(d=F),!n.isPollingActive&&(n.startPolling(),d&&re(d))}function fe(){ie(),n.stopPolling()}function ne(){g.value=!0,l&&(clearTimeout(l),l=null)}function Z(){l&&clearTimeout(l),l=setTimeout(async()=>{g.value=!1,v.value&&(v.value=!1,V())},t)}function j(){fe(),l&&(clearTimeout(l),l=null),c&&(clearTimeout(c),c=null),w=!1,T=!1,d=null}return De(()=>[n.activeContextMenu,n.activeDialog],()=>{!n.activeContextMenu&&!n.activeDialog&&v.value&&!g.value&&(v.value=!1,V())}),{isUserInteracting:Ce(g),isDeferredRefresh:Ce(v),startPolling:ue,stopPolling:fe,startInteraction:ne,endInteraction:Z,cleanup:j,setScrollCallbacks:P}}function Fu(e){Qn();function n(s){const l=s.ctrlKey||s.metaKey;if(l&&s.key==="f"){s.preventDefault(),e.onFind();return}if(l&&s.key==="r"){s.preventDefault(),e.onRefresh();return}if(l&&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 Hu={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Ou={class:"text-sm font-mono text-retro-cyan"},Uu={class:"text-xs font-mono text-retro-text mt-1 truncate"},ju={class:"space-y-3"},zu={class:"flex items-start gap-2 cursor-pointer group"},Vu={class:"flex items-start gap-2 cursor-pointer group"},Wu=Me({__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=C(!1),s=C(!1);function l(){t("confirm",{recordOrigin:a.value,noCommit:s.value})}function c(){a.value=!1,s.value=!1,t("close")}return(f,m)=>(i(),ce(Tt,{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",Hu,[m[2]||(m[2]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Commit",-1)),r("div",Ou,S(e.commitHash.slice(0,7)),1),r("div",Uu,S(e.commitMessage.split(`
66
+ `)[0]),1)]),r("div",ju,[r("label",zu,[Pe(r("input",{"onUpdate:modelValue":m[0]||(m[0]=d=>He(a)?a.value=d:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Dt,o(a)]]),m[3]||(m[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",Vu,[Pe(r("input",{"onUpdate:modelValue":m[1]||(m[1]=d=>He(s)?s.value=d:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Dt,o(s)]]),m[4]||(m[4]=r("div",null,[r("span",{class:"text-sm font-mono text-retro-text group-hover:text-retro-cyan transition-colors"}," 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"]))}}),Gu={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},qu={class:"text-sm font-mono text-retro-cyan"},Zu={class:"mb-4"},Ku={class:"flex items-start gap-2 cursor-pointer group"},Yu=Me({__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=C(""),s=C(!0),l=U(()=>a.value.trim().length>0);function c(){l.value&&t("confirm",{name:a.value.trim(),checkout:s.value})}function f(){a.value="",s.value=!0,t("close")}return(m,d)=>(i(),ce(Tt,{title:"Create Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Create Branch",onClose:f,onConfirm:c},{default:Ke(()=>[r("div",Gu,[d[2]||(d[2]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"From",-1)),r("div",qu,S(e.fromCommit.slice(0,7)),1)]),r("div",Zu,[d[3]||(d[3]=r("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Branch name",-1)),Pe(r("input",{"onUpdate:modelValue":d[0]||(d[0]=w=>He(a)?a.value=w: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),[[pt,o(a)]])]),r("label",Ku,[Pe(r("input",{"onUpdate:modelValue":d[1]||(d[1]=w=>He(s)?s.value=w:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Dt,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"]))}}),Xu=Me({__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(),ce(Tt,{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"]))}}),Qu={class:"text-retro-text text-sm font-mono mb-2"},Ju={class:"text-retro-cyan"},ed={class:"space-y-3 mt-4"},td={class:"flex items-center gap-2 cursor-pointer"},nd=Me({__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=C(!1);function l(){a("confirm",{force:s.value})}return De(()=>t.visible,c=>{c&&(s.value=!1)}),(c,f)=>(i(),ce(Tt,{title:"Delete Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Delete","confirm-danger":!0,onClose:f[1]||(f[1]=m=>a("close")),onConfirm:l},{default:Ke(()=>[f[4]||(f[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",Qu,[_e(" Delete "+S(e.isLocal?"local":"remote")+" branch ",1),r("span",Ju,S(e.branchName),1),f[2]||(f[2]=_e("? ",-1))]),r("div",ed,[r("label",td,[Pe(r("input",{"onUpdate:modelValue":f[0]||(f[0]=m=>He(s)?s.value=m:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Dt,o(s)]]),f[3]||(f[3]=r("span",{class:"text-retro-muted text-sm"},"Force delete (even if not fully merged)",-1))])])]),_:1},8,["visible","loading","error"]))}}),rd={class:"text-retro-text text-sm font-mono mb-4"},od={class:"text-retro-cyan"},sd={class:"space-y-3"},ad={class:"flex items-center gap-2 cursor-pointer"},id={class:"flex items-center gap-2 cursor-pointer"},ld={class:"flex items-center gap-2 cursor-pointer"},cd=Me({__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=C(!1),l=C(!1),c=C(!1);function f(){a("confirm",{noCommit:s.value,noFastForward:l.value,squash:c.value})}return De(()=>t.visible,m=>{m&&(s.value=!1,l.value=!1,c.value=!1)}),(m,d)=>(i(),ce(Tt,{title:"Merge Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Merge",onClose:d[3]||(d[3]=w=>a("close")),onConfirm:f},{default:Ke(()=>[r("p",rd,[d[4]||(d[4]=_e(" Merge ",-1)),r("span",od,S(e.branchName),1),d[5]||(d[5]=_e(" into current branch ",-1))]),r("div",sd,[r("label",ad,[Pe(r("input",{"onUpdate:modelValue":d[0]||(d[0]=w=>He(s)?s.value=w:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Dt,o(s)]]),d[6]||(d[6]=r("span",{class:"text-retro-muted text-sm"},"No commit (stage changes only)",-1))]),r("label",id,[Pe(r("input",{"onUpdate:modelValue":d[1]||(d[1]=w=>He(l)?l.value=w:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Dt,o(l)]]),d[7]||(d[7]=r("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),r("label",ld,[Pe(r("input",{"onUpdate:modelValue":d[2]||(d[2]=w=>He(c)?c.value=w:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Dt,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"]))}}),ud={class:"text-retro-text text-sm font-mono mb-4"},dd={class:"text-retro-cyan"},fd={class:"space-y-3"},md=["value"],hd={class:"flex items-center gap-2 cursor-pointer"},pd={class:"flex items-center gap-2 cursor-pointer"},vd=Me({__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=C("origin"),l=C(!1),c=C(!1);function f(){a("confirm",{remote:s.value,noFastForward:l.value,squash:c.value})}return De(()=>t.visible,m=>{m&&(s.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",l.value=!1,c.value=!1)}),(m,d)=>(i(),ce(Tt,{title:"Pull Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Pull",onClose:d[3]||(d[3]=w=>a("close")),onConfirm:f},{default:Ke(()=>[r("p",ud,[d[4]||(d[4]=_e(" Pull ",-1)),r("span",dd,S(e.branchName),1),d[5]||(d[5]=_e(" from remote ",-1))]),r("div",fd,[r("div",null,[d[6]||(d[6]=r("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),Pe(r("select",{"onUpdate:modelValue":d[0]||(d[0]=w=>He(s)?s.value=w: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(me,null,Ee(e.remotes,w=>(i(),u("option",{key:w,value:w},S(w),9,md))),128))],512),[[Tn,o(s)]])]),r("label",hd,[Pe(r("input",{"onUpdate:modelValue":d[1]||(d[1]=w=>He(l)?l.value=w:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Dt,o(l)]]),d[7]||(d[7]=r("span",{class:"text-retro-muted text-sm"},"No fast-forward (always create merge commit)",-1))]),r("label",pd,[Pe(r("input",{"onUpdate:modelValue":d[2]||(d[2]=w=>He(c)?c.value=w:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Dt,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"]))}}),gd={class:"text-retro-text text-sm font-mono mb-4"},xd={class:"text-retro-cyan"},bd={class:"space-y-3"},yd=["value"],wd={class:"flex items-center gap-2 cursor-pointer"},kd=["checked"],Cd={class:"flex items-center gap-2 cursor-pointer"},$d=["checked"],Sd={key:0,class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},_d=Me({__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=C("origin"),l=C(!1),c=C(!1);function f(w){l.value=w,w&&(c.value=!1)}function m(w){c.value=w,w&&(l.value=!1)}function d(){a("confirm",{remote:s.value,force:l.value,forceWithLease:c.value})}return De(()=>t.visible,w=>{w&&(s.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin",l.value=!1,c.value=!1)}),(w,T)=>(i(),ce(Tt,{title:"Push Branch",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Push",onClose:T[3]||(T[3]=g=>a("close")),onConfirm:d},{default:Ke(()=>[r("p",gd,[T[4]||(T[4]=_e(" Push ",-1)),r("span",xd,S(e.branchName),1),T[5]||(T[5]=_e(" to remote ",-1))]),r("div",bd,[r("div",null,[T[6]||(T[6]=r("label",{class:"text-retro-muted text-sm block mb-1"},"Remote",-1)),Pe(r("select",{"onUpdate:modelValue":T[0]||(T[0]=g=>He(s)?s.value=g: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(me,null,Ee(e.remotes,g=>(i(),u("option",{key:g,value:g},S(g),9,yd))),128))],512),[[Tn,o(s)]])]),r("label",wd,[r("input",{checked:o(l),type:"checkbox",class:"accent-retro-cyan",onChange:T[1]||(T[1]=g=>f(g.target.checked))},null,40,kd),T[7]||(T[7]=r("span",{class:"text-retro-muted text-sm"},"Force push",-1))]),r("label",Cd,[r("input",{checked:o(c),type:"checkbox",class:"accent-retro-cyan",onChange:T[2]||(T[2]=g=>m(g.target.checked))},null,40,$d),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",Sd,S(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)):N("",!0)])]),_:1},8,["visible","loading","error"]))}}),Td={class:"text-retro-text text-sm font-mono mb-4"},Md={class:"text-retro-cyan"},Ad={class:"text-retro-cyan"},Bd={class:"p-2 text-xs font-mono text-retro-yellow bg-retro-yellow/10 border border-retro-yellow/30 rounded"},Ed={class:"text-retro-cyan"},Rd={class:"text-retro-cyan"},Pd=Me({__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(),ce(Tt,{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",Td,[s[2]||(s[2]=_e(" Rebase ",-1)),r("span",Md,S(e.branchName),1),s[3]||(s[3]=_e(" onto ",-1)),r("span",Ad,S(e.ontoBranch),1)]),r("div",Bd,[s[4]||(s[4]=_e(" This will rewrite commit history. Commits from ",-1)),r("span",Ed,S(e.branchName),1),s[5]||(s[5]=_e(" will be replayed on top of ",-1)),r("span",Rd,S(e.ontoBranch),1),s[6]||(s[6]=_e(". ",-1))])]),_:1},8,["visible","loading","error"]))}}),Dd={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Id={class:"text-sm font-mono text-retro-cyan"},Ld={class:"text-xs font-mono text-retro-text mt-1 truncate"},Nd={class:"space-y-2"},Fd=["value"],Hd={key:0,class:"mt-3 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},Od=Me({__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=C("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(f,m)=>(i(),ce(Tt,{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",Dd,[m[1]||(m[1]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"Reset to",-1)),r("div",Id,S(e.commitHash.slice(0,7)),1),r("div",Ld,S(e.commitMessage.split(`
67
+ `)[0]),1)]),r("div",Nd,[m[2]||(m[2]=r("div",{class:"text-xs font-mono text-retro-muted mb-2"},"Reset mode",-1)),(i(),u(me,null,Ee(s,d=>r("label",{key:d.value,class:ge(["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"]])},[Pe(r("input",{"onUpdate:modelValue":m[0]||(m[0]=w=>He(a)?a.value=w:null),type:"radio",name:"reset-mode",value:d.value,class:"mt-0.5 accent-retro-cyan"},null,8,Fd),[[Dr,o(a)]]),r("div",null,[r("span",{class:ge(["text-sm font-mono transition-colors",[d.value==="hard"?"text-retro-red":"text-retro-text",o(a)===d.value?"text-retro-cyan":""]])},S(d.label),3),r("p",{class:ge(["text-xs font-mono mt-0.5",d.value==="hard"?"text-retro-red/70":"text-retro-muted"])},S(d.description),3)])],2)),64))]),o(a)==="hard"?(i(),u("div",Hd," Warning: Hard reset will permanently discard all uncommitted changes in your working directory and staging area. This action cannot be undone. ")):N("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),Ud={class:"space-y-3"},jd={class:"flex items-start gap-2 cursor-pointer"},zd={class:"flex items-start gap-2 cursor-pointer"},Vd={key:0,class:"mt-4 p-2 text-xs font-mono text-retro-red bg-retro-red/10 border border-retro-red/30 rounded"},Wd=Me({__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=C("mixed"),l=U(()=>s.value==="hard");function c(){a("confirm",{mode:s.value})}return De(()=>t.visible,f=>{f&&(s.value="mixed")}),(f,m)=>(i(),ce(Tt,{title:"Reset Working Directory",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Reset","confirm-danger":o(l),onClose:m[2]||(m[2]=d=>a("close")),onConfirm:c},{default:Ke(()=>[m[5]||(m[5]=r("p",{class:"text-retro-text text-sm font-mono mb-4"}," Reset the working directory to HEAD. ",-1)),r("div",Ud,[r("label",jd,[Pe(r("input",{"onUpdate:modelValue":m[0]||(m[0]=d=>He(s)?s.value=d:null),type:"radio",value:"mixed",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[Dr,o(s)]]),m[3]||(m[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",zd,[Pe(r("input",{"onUpdate:modelValue":m[1]||(m[1]=d=>He(s)?s.value=d:null),type:"radio",value:"hard",name:"reset-mode",class:"accent-retro-cyan mt-0.5"},null,512),[[Dr,o(s)]]),m[4]||(m[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",Vd," WARNING: Hard reset will permanently discard all uncommitted changes. This cannot be undone. ")):N("",!0)]),_:1},8,["visible","loading","error","confirm-danger"]))}}),Gd={class:"space-y-4"},qd={class:"flex items-center gap-2 cursor-pointer"},Zd=Me({__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=C(""),l=C(!1);function c(){a("confirm",{message:s.value.trim()||void 0,includeUntracked:l.value})}return De(()=>t.visible,f=>{f&&(s.value="",l.value=!1)}),(f,m)=>(i(),ce(Tt,{title:"Stash Changes",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Stash",onClose:m[2]||(m[2]=d=>a("close")),onConfirm:c},{default:Ke(()=>[m[5]||(m[5]=r("p",{class:"text-retro-text text-sm font-mono mb-4"}," Save uncommitted changes to the stash. ",-1)),r("div",Gd,[r("div",null,[m[3]||(m[3]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message (optional)",-1)),Pe(r("input",{"onUpdate:modelValue":m[0]||(m[0]=d=>He(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),[[pt,o(s)]])]),r("label",qd,[Pe(r("input",{"onUpdate:modelValue":m[1]||(m[1]=d=>He(l)?l.value=d:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Dt,o(l)]]),m[4]||(m[4]=r("span",{class:"text-retro-muted text-sm"},"Include untracked files",-1))])])]),_:1},8,["visible","loading","error"]))}}),Kd={class:"mb-4 p-3 bg-retro-panel border border-retro-border rounded"},Yd={class:"text-sm font-mono text-retro-cyan"},Xd={class:"mb-4"},Qd={class:"mb-3"},Jd={class:"flex items-start gap-2 cursor-pointer group"},ef={key:0,class:"mb-4"},tf={class:"space-y-2"},nf={class:"flex items-start gap-2 cursor-pointer group"},rf=["disabled"],of={key:0,class:"ml-6"},sf=["value"],af=Me({__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=C(""),s=C(!1),l=C(""),c=C(!1),f=C(""),m=U(()=>a.value.trim().length>0);function d(){if(!m.value)return;const T={name:a.value.trim(),annotated:s.value};s.value&&l.value.trim()&&(T.message=l.value.trim()),c.value&&f.value&&(T.pushToRemote=f.value),t("confirm",T)}function w(){a.value="",s.value=!1,l.value="",c.value=!1,f.value="",t("close")}return De(()=>s.value,T=>{T||(l.value="")}),(T,g)=>(i(),ce(Tt,{title:"Create Tag",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Create Tag",onClose:w,onConfirm:d},{default:Ke(()=>[r("div",Kd,[g[5]||(g[5]=r("div",{class:"text-xs font-mono text-retro-muted mb-1"},"At commit",-1)),r("div",Yd,S(e.commitHash.slice(0,7)),1)]),r("div",Xd,[g[6]||(g[6]=r("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag name",-1)),Pe(r("input",{"onUpdate:modelValue":g[0]||(g[0]=v=>He(a)?a.value=v: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),[[pt,o(a)]])]),r("div",Qd,[r("label",Jd,[Pe(r("input",{"onUpdate:modelValue":g[1]||(g[1]=v=>He(s)?s.value=v:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan"},null,512),[[Dt,o(s)]]),g[7]||(g[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",ef,[g[8]||(g[8]=r("label",{class:"block text-xs font-mono text-retro-muted mb-1.5"},"Tag message",-1)),Pe(r("textarea",{"onUpdate:modelValue":g[2]||(g[2]=v=>He(l)?l.value=v: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),[[pt,o(l)]])])):N("",!0),r("div",tf,[r("label",nf,[Pe(r("input",{"onUpdate:modelValue":g[3]||(g[3]=v=>He(c)?c.value=v:null),type:"checkbox",class:"mt-0.5 accent-retro-cyan",disabled:e.remotes.length===0},null,8,rf),[[Dt,o(c)]]),r("div",null,[r("span",{class:ge(["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",of,[Pe(r("select",{"onUpdate:modelValue":g[4]||(g[4]=v=>He(f)?f.value=v: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"},[g[9]||(g[9]=r("option",{value:"",disabled:"",class:"text-retro-muted"},"Select remote",-1)),(i(!0),u(me,null,Ee(e.remotes,v=>(i(),u("option",{key:v,value:v},S(v),9,sf))),128))],512),[[Tn,o(f)]])])):N("",!0)])]),_:1},8,["visible","loading","error"]))}}),lf={class:"text-retro-text text-sm font-mono mb-2"},cf={class:"text-retro-cyan"},uf={class:"space-y-3 mt-4"},df={class:"flex items-center gap-2 cursor-pointer"},ff={key:0,class:"ml-6"},mf=["value"],hf=Me({__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=C(!1),l=C("origin");function c(){a("confirm",{deleteFromRemote:s.value,remote:s.value?l.value:void 0})}return De(()=>t.visible,f=>{f&&(s.value=!1,l.value=t.remotes.includes("origin")?"origin":t.remotes[0]??"origin")}),(f,m)=>(i(),ce(Tt,{title:"Delete Tag",visible:e.visible,loading:e.loading,error:e.error,"confirm-label":"Delete","confirm-danger":!0,onClose:m[2]||(m[2]=d=>a("close")),onConfirm:c},{default:Ke(()=>[m[7]||(m[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",lf,[m[3]||(m[3]=_e(" Delete tag ",-1)),r("span",cf,S(e.tagName),1),m[4]||(m[4]=_e("? ",-1))]),r("div",uf,[r("label",df,[Pe(r("input",{"onUpdate:modelValue":m[0]||(m[0]=d=>He(s)?s.value=d:null),type:"checkbox",class:"accent-retro-cyan"},null,512),[[Dt,o(s)]]),m[5]||(m[5]=r("span",{class:"text-retro-muted text-sm"},"Also delete from remote",-1))]),o(s)?(i(),u("div",ff,[m[6]||(m[6]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Remote",-1)),Pe(r("select",{"onUpdate:modelValue":m[1]||(m[1]=d=>He(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(me,null,Ee(e.remotes,d=>(i(),u("option",{key:d,value:d},S(d),9,mf))),128))],512),[[Tn,o(l)]])])):N("",!0)])]),_:1},8,["visible","loading","error"]))}}),pf={class:"mb-4"},vf={class:"text-retro-cyan text-sm font-mono"},gf={class:"mb-4"},xf={class:"text-retro-text text-sm font-mono"},bf={class:"mb-4"},yf={class:"text-retro-text text-sm font-mono break-all select-all"},wf={class:"mb-4"},kf={class:"text-retro-text text-sm font-mono"},Cf={class:"text-retro-muted"},$f={class:"mb-4"},Sf={class:"text-retro-text text-sm font-mono"},_f={key:1,class:"mb-2"},Tf={class:"p-2 text-sm font-mono text-retro-text bg-retro-panel border border-retro-border rounded whitespace-pre-wrap"},Mf={key:1,class:"text-retro-muted text-sm font-mono text-center py-4"},Af=Me({__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(),ce(Tt,{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",pf,[s[2]||(s[2]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tag",-1)),r("p",vf,S(e.tagName),1)]),e.tagDetail?(i(),u(me,{key:0},[r("div",gf,[s[3]||(s[3]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Type",-1)),r("p",xf,S(e.tagDetail.isAnnotated?"Annotated":"Lightweight"),1)]),r("div",bf,[s[4]||(s[4]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Hash",-1)),r("p",yf,S(e.tagDetail.hash),1)]),e.tagDetail.tagger?(i(),u(me,{key:0},[r("div",wf,[s[5]||(s[5]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Tagger",-1)),r("p",kf,[_e(S(e.tagDetail.tagger.name)+" ",1),r("span",Cf,"<"+S(e.tagDetail.tagger.email)+">",1)])]),r("div",$f,[s[6]||(s[6]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Date",-1)),r("p",Sf,S(e.tagDetail.tagger.date),1)])],64)):N("",!0),e.tagDetail.message?(i(),u("div",_f,[s[7]||(s[7]=r("label",{class:"block text-retro-muted text-xs font-mono mb-1"},"Message",-1)),r("div",Tf,S(e.tagDetail.message),1)])):N("",!0)],64)):e.loading?(i(),u("div",Mf," Loading tag details... ")):N("",!0)]),_:1},8,["visible","loading"]))}}),mo=globalThis.setInterval,Bf={class:"h-full flex flex-col bg-retro-dark",role:"region","aria-label":"Git Graph"},Ef={key:0,class:"flex-1 flex flex-col items-center justify-center gap-3"},Rf={key:1,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},Pf={key:2,class:"flex-1 flex flex-col items-center justify-center p-8 text-center"},Df={class:"text-retro-red text-sm mb-4"},If={key:3,class:"flex-1 flex items-center justify-center p-4"},Lf={class:"flex-shrink-0 flex items-center gap-2 p-2 border-b border-retro-border"},Nf={class:"relative"},Ff={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]"},Hf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Of=["checked"],Uf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},jf=["checked"],zf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Vf=["checked"],Wf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Gf=["checked"],qf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Zf=["checked"],Kf={class:"flex items-center gap-2 px-3 py-1 hover:bg-retro-panel/50 cursor-pointer"},Yf=["checked"],Xf={class:"relative"},Qf=["aria-expanded"],Jf={key:0,class:"text-xs"},em={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"},tm=["checked","onChange"],nm={class:"text-sm text-retro-text truncate"},rm={key:0,class:"text-[10px] text-retro-cyan"},om={class:"px-3 py-1 text-[10px] text-retro-orange font-semibold uppercase tracking-wider mt-1"},sm=["checked","onChange"],am={class:"text-sm text-retro-text truncate"},im={class:"relative"},lm={key:0,class:"absolute right-0 top-full mt-1 z-20"},cm=["title"],um={class:"text-retro-muted text-sm"},dm={class:"text-retro-cyan font-mono"},fm={class:"space-y-3"},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-magenta font-mono"},xm={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"},bm={class:"flex-1"},ym=Me({__name:"GitGraph",props:{workingDirectory:{},isActive:{type:Boolean,default:!0}},setup(e){const n=e,t=Qn(),a=gt(),s=Nu(),l=U(()=>{const x=a.activeConversation?.worktreeBranch;return x?[x]:[]}),c=U(()=>{const x=[],y=t.selectedFeatureId;y&&x.push(y);const ke=t.conversationBranch;return ke&&!x.includes(ke)&&x.push(ke),x});De(()=>a.activeConversation?.worktreeBranch,x=>{t.setConversationBranch(x??null)},{immediate:!0});const f=U(()=>{const x=t.previewBranch;return x?[x]:[]});De(()=>a.previewingConversation?.worktreeBranch,x=>{t.setPreviewBranch(x??null)},{immediate:!0});const m=U(()=>{const x={};return t.previewBranch&&t.previewMergeBase&&(x[t.previewBranch]=t.previewMergeBase),x}),d=U(()=>{const x={};return t.selectedFeatureId&&t.featureMergeBase&&(x[t.selectedFeatureId]=t.featureMergeBase),t.conversationBranch&&t.conversationMergeBase&&(x[t.conversationBranch]=t.conversationMergeBase),x}),w=U(()=>t.remotes.map(x=>x.name)),T=C(null);De(()=>n.workingDirectory,async x=>{if(x){await t.loadGitGraph(x);const y=a.previewingConversation?.worktreeBranch;y&&await t.setPreviewBranch(y);const ke=a.activeConversation?.worktreeBranch;ke&&await t.setConversationBranch(ke)}},{immediate:!0}),De(()=>n.isActive,x=>{x&&t.commits.length>0&&!t.error?s.startPolling(n.workingDirectory):s.stopPolling()},{immediate:!0}),De(()=>t.commits.length,x=>{x>0&&n.isActive&&!t.error&&s.startPolling(n.workingDirectory)}),De(()=>T.value,x=>{x&&s.setScrollCallbacks({getScrollPosition:()=>x.getScrollPosition(),setScrollPosition:y=>x.setScrollPosition(y)})}),$t(()=>{s.cleanup(),t.reset()});const g=U(()=>t.error?.includes("Not a Git repository")),v=C(Date.now());let h=null;const P=()=>{h||(h=mo(()=>{v.value=Date.now()},5e3))},q=()=>{h&&(clearInterval(h),h=null)};ut(()=>{De(()=>n.isActive,x=>{x?(v.value=Date.now(),P()):q()},{immediate:!0})}),$t(()=>{q()});const A=U(()=>{const x=t.lastRefreshTime;if(!x)return null;const y=Math.floor((v.value-x)/1e3);return t.isRefreshing?"Syncing...":y<5?"Just now":y<60?`${y}s ago`:`${Math.floor(y/60)}m ago`}),ee=C(!1),te=C(!1),V=C(null);function re(){ee.value=!0,vn(()=>V.value?.focus())}function ie(){ee.value=!1,t.setSearchQuery("")}function ue(x){t.setSearchQuery(x)}const fe=Fu({onFind:()=>re(),onRefresh:async()=>{n.workingDirectory&&await t.loadGitGraph(n.workingDirectory)},onScrollToHead:()=>{const x=t.commits.find(y=>y.isHead);x&&t.selectCommit(x)},onEscape:()=>{ne.value?ne.value=!1:te.value?te.value=!1:Z.value?Z.value=!1:ee.value?ie():t.isComparing?t.clearComparison():(t.selectedCommit||t.isUncommittedChangesSelected)&&t.clearSelection()}});ut(()=>{fe.start()}),$t(()=>{fe.stop()});const ne=C(!1),Z=C(!1);async function j(){await t.fetchAll(!0)}async function F(x){await t.addRemote(x.name,x.url)}async function B(x){await t.editRemote(x.name,x.newUrl)}async function X(x){await t.deleteRemote(x)}const M=U(()=>{const x=[],y={};for(const ke of t.branches)if(t.localBranchNames.has(ke.name))x.push(ke);else{const Fe=ke.name.indexOf("/");if(Fe>0){const st=ke.name.substring(0,Fe);y[st]||(y[st]=[]),y[st].push(ke)}else x.push(ke)}return{local:x,remotes:y}}),p=C({visible:!1,branch:"",x:0,y:0,isCurrentBranch:!1,isLocal:!0,commitHash:""});function k(x){p.value={visible:!0,...x},t.setActiveContextMenu({type:"branch",props:x,position:{x:x.x,y:x.y}})}function H(){p.value.visible=!1,t.clearActiveContextMenu()}function W(){H(),it.value={visible:!0,branchName:p.value.branch,loading:!1,error:null}}function ae(){const x=p.value.branch;H(),Re.value={visible:!0,branchName:x,newName:x,loading:!1,error:null}}function G(){const{branch:x,isLocal:y}=p.value;H(),et.value={visible:!0,branchName:x,isLocal:y,force:!1,loading:!1,error:null}}function R(){const x=p.value.branch;H(),Xe.value={visible:!0,branchName:x,loading:!1,error:null}}function $(){const x=p.value.branch;H(),Ue.value={visible:!0,branchName:x,loading:!1,error:null}}function I(){const x=p.value.branch;H(),tt.value={visible:!0,branchName:x,loading:!1,error:null}}function L(){const x=p.value.branch;H(),nt.value={visible:!0,branchName:x,loading:!1,error:null}}async function K(){const x=p.value.branch;H(),await t.fetchBranch(x)}async function ve(){const x=p.value.branch;H(),await t.copyToClipboard(x),_(p.value.x,p.value.y)}function xe(){H(),Ie.value={visible:!0,fromCommit:p.value.commitHash,loading:!1,error:null}}const Te=C({visible:!1,commit:null,x:0,y:0});function qe(x){Te.value={visible:!0,commit:x.commit,x:x.x,y:x.y},t.setActiveContextMenu({type:"commit",props:x,position:{x:x.x,y:x.y}})}function Ye(){Te.value.visible=!1,t.clearActiveContextMenu()}function Y(x){const y=Te.value.commit;if(!y)return!1;Ye();const ke=x(y);return ke&&typeof ke.then=="function"?ke.then(()=>!0):!0}function de(){Y(x=>{ot.value={visible:!0,commitHash:x.hash,loading:!1,error:null}})}function oe(){Y(x=>{Ie.value={visible:!0,fromCommit:x.hash,loading:!1,error:null}})}function be(){Y(x=>{it.value={visible:!0,branchName:x.hash,loading:!1,error:null}})}function Se(){Y(x=>{je.value={visible:!0,commitHash:x.hash,commitMessage:x.message,loading:!1,error:null}})}async function we(){await Y(x=>t.revertCommit(x.hash))}function Be(){Y(x=>{Xe.value={visible:!0,branchName:x.shortHash,loading:!1,error:null}})}function Oe(){Y(x=>{rt.value={visible:!0,commitHash:x.hash,commitMessage:x.message,loading:!1,error:null}})}async function zt(){const{x,y}=Te.value;await Y(Fe=>t.copyToClipboard(Fe.hash))&&_(x,y)}async function Mt(){await Y(x=>t.copyCommitSubject(x))}const at=C({visible:!1,tag:"",x:0,y:0,commitHash:""});function Ht(x){at.value={visible:!0,...x},t.setActiveContextMenu({type:"tag",props:x,position:{x:x.x,y:x.y}})}function Rt(){at.value.visible=!1,t.clearActiveContextMenu()}async function Pt(){const x=at.value.tag;Rt(),se.value={visible:!0,tagName:x,loading:!0,tagDetail:null};const y=await t.getTagDetail(x);se.value.loading=!1,y.success&&y.data&&(se.value.tagDetail=y.data)}function It(){const x=at.value.tag;Rt(),pe.value={visible:!0,tagName:x,loading:!1,error:null}}async function dt(){const x=at.value.tag;Rt(),await t.pushTag(x)}async function Vt(){const x=at.value.tag;Rt(),await t.copyToClipboard(x),_(at.value.x,at.value.y)}const mt=C({visible:!1,x:0,y:0});function At(){mt.value.visible=!1,t.clearActiveContextMenu()}function Wt(){At(),he.value={visible:!0,loading:!1,error:null}}function ln(){At(),Ze.value={visible:!0,loading:!1,error:null}}async function Ot(){At(),ct.value={visible:!0,loading:!1,error:null}}const Je=C({visible:!1,stash:null,x:0,y:0});function xt(x){Je.value={visible:!0,stash:x.stash,x:x.x,y:x.y},t.setActiveContextMenu({type:"stash",props:x,position:{x:x.x,y:x.y}})}function Bt(){Je.value.visible=!1,t.clearActiveContextMenu()}function bt(x){const y=Je.value.stash;if(!y)return!1;Bt();const ke=x(y);return ke&&typeof ke.then=="function"?ke.then(()=>!0):!0}async function en(){await bt(x=>t.applyStash(x.index))}async function xn(){await bt(x=>t.popStash(x.index))}async function Gt(){await bt(x=>t.dropStash(x.index))}function qt(){bt(x=>{Ne.value={visible:!0,stashIndex:x.index,loading:!1,error:null}})}async function bn(){const{x,y}=Je.value;await bt(Fe=>t.copyToClipboard(`stash@{${Fe.index}}`))&&_(x,y)}async function Ut(){const{x,y}=Je.value;await bt(Fe=>t.copyToClipboard(Fe.hash))&&_(x,y)}const it=C({visible:!1,branchName:"",loading:!1,error:null});async function yn(){it.value.loading=!0,it.value.error=null;const x=await t.checkoutBranch(it.value.branchName);it.value.loading=!1,x.success?it.value.visible=!1:it.value.error=x.error||"Unknown error"}const Ie=C({visible:!1,fromCommit:"",loading:!1,error:null});async function Lt(x){Ie.value.loading=!0,Ie.value.error=null;const y=await t.createBranch(x.name,Ie.value.fromCommit);Ie.value.loading=!1,y.success?(x.checkout&&await t.checkoutBranch(x.name),Ie.value.visible=!1):Ie.value.error=y.error||"Unknown error"}const et=C({visible:!1,branchName:"",isLocal:!0,force:!1,loading:!1,error:null});async function cn(x){et.value.loading=!0,et.value.error=null;const{branchName:y,isLocal:ke}=et.value,Fe=x?.force??et.value.force,st=ke?await t.deleteLocalBranch(y,Fe):await t.deleteRemoteBranch(y);et.value.loading=!1,st.success?et.value.visible=!1:et.value.error=st.error||"Unknown error"}const Re=C({visible:!1,branchName:"",newName:"",loading:!1,error:null});async function yt(){if(!Re.value.newName.trim()){Re.value.error="Branch name is required";return}Re.value.loading=!0,Re.value.error=null;const x=await t.renameBranch(Re.value.branchName,Re.value.newName.trim());Re.value.loading=!1,x.success?Re.value.visible=!1:Re.value.error=x.error||"Unknown error"}const Xe=C({visible:!1,branchName:"",loading:!1,error:null});async function Zt(x){Xe.value.loading=!0,Xe.value.error=null;const y=await t.mergeBranch(Xe.value.branchName,x);Xe.value.loading=!1,y.success?Xe.value.visible=!1:Xe.value.error=y.error||"Unknown error"}const Ue=C({visible:!1,branchName:"",loading:!1,error:null});async function Et(){Ue.value.loading=!0,Ue.value.error=null;const x=await t.rebaseBranch(Ue.value.branchName);Ue.value.loading=!1,x.success?Ue.value.visible=!1:Ue.value.error=x.error||"Unknown error"}const tt=C({visible:!1,branchName:"",loading:!1,error:null});async function un(x){tt.value.loading=!0,tt.value.error=null;const y=await t.pushBranch(tt.value.branchName,x.remote,x.force,x.forceWithLease);tt.value.loading=!1,y.success?tt.value.visible=!1:tt.value.error=y.error||"Unknown error"}const nt=C({visible:!1,branchName:"",loading:!1,error:null});async function dn(x){nt.value.loading=!0,nt.value.error=null;const y=await t.pullBranch(nt.value.branchName,x.remote,x.noFastForward,x.squash);nt.value.loading=!1,y.success?nt.value.visible=!1:nt.value.error=y.error||"Unknown error"}const je=C({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function tn(x){je.value.loading=!0,je.value.error=null;const y=await t.cherryPickCommit(je.value.commitHash,x.recordOrigin,x.noCommit);je.value.loading=!1,y.success?je.value.visible=!1:je.value.error=y.error||"Unknown error"}const rt=C({visible:!1,commitHash:"",commitMessage:"",loading:!1,error:null});async function fn(x){rt.value.loading=!0,rt.value.error=null;const y=await t.resetToCommit(rt.value.commitHash,x.mode);rt.value.loading=!1,y.success?rt.value.visible=!1:rt.value.error=y.error||"Unknown error"}const ot=C({visible:!1,commitHash:"",loading:!1,error:null});async function wn(x){ot.value.loading=!0,ot.value.error=null;const y=await t.createTag(x.name,ot.value.commitHash,x.annotated,x.message,x.pushToRemote);ot.value.loading=!1,y.success?ot.value.visible=!1:ot.value.error=y.error||"Unknown error"}const pe=C({visible:!1,tagName:"",loading:!1,error:null});async function E(x){pe.value.loading=!0,pe.value.error=null;const y=await t.deleteTag(pe.value.tagName,x.deleteFromRemote?x.remote||"origin":void 0);pe.value.loading=!1,y.success?pe.value.visible=!1:pe.value.error=y.error||"Unknown error"}const se=C({visible:!1,tagName:"",loading:!1,tagDetail:null}),he=C({visible:!1,loading:!1,error:null});async function ze(x){he.value.loading=!0,he.value.error=null;const y=await t.stashChanges(x.message,x.includeUntracked);he.value.loading=!1,y.success?he.value.visible=!1:he.value.error=y.error||"Unknown error"}const Ne=C({visible:!1,stashIndex:0,loading:!1,error:null}),Ve=C("");async function Qe(x){Ne.value.loading=!0,Ne.value.error=null;const y=await t.stashBranch(Ne.value.stashIndex,x);Ne.value.loading=!1,y.success?Ne.value.visible=!1:Ne.value.error=y.error||"Unknown error"}const Ze=C({visible:!1,loading:!1,error:null});async function Nt(x){Ze.value.loading=!0,Ze.value.error=null;const y=await t.resetWorking(x.mode);Ze.value.loading=!1,y.success?Ze.value.visible=!1:Ze.value.error=y.error||"Unknown error"}const ct=C({visible:!1,loading:!1,error:null});async function b(){ct.value.loading=!0,ct.value.error=null;const x=await t.cleanUntracked();ct.value.loading=!1,x.success?ct.value.visible=!1:ct.value.error=x.error||"Unknown error"}const D=C({visible:!1,x:0,y:0});function _(x,y){D.value={visible:!0,x,y},setTimeout(()=>{D.value.visible=!1},1500)}const z=U(()=>it.value.visible||Ie.value.visible||et.value.visible||Re.value.visible||Xe.value.visible||Ue.value.visible||tt.value.visible||nt.value.visible||je.value.visible||rt.value.visible||ot.value.visible||pe.value.visible||se.value.visible||he.value.visible||Ne.value.visible||Ze.value.visible||ct.value.visible);De(z,x=>{x?t.setActiveDialog({type:"generic",props:{}}):t.clearActiveDialog()});function le(x){t.selectedCommit?t.selectComparisonCommit(x):t.selectCommit(x)}function ye(x){t.navigateToCommit(x)}return(x,y)=>{const ke=ba,Fe=Da,st=ai,kn=_i,wr=Gc,kr=pu,Cr=wu,Jn=ku,Ln=Cu,$r=$u,Sr=Su,Nn=Tt;return i(),u("div",Bf,[o(t).loading&&o(t).commits.length===0?(i(),u("div",Ef,[...y[42]||(y[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(g)?(i(),u("div",Rf,[Q(o($n),{class:"w-12 h-12 text-retro-yellow mb-4"}),y[43]||(y[43]=r("h3",{class:"text-retro-text font-semibold mb-2"},"Not a Git Repository",-1)),y[44]||(y[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",Pf,[Q(o($n),{class:"w-10 h-10 text-retro-red mb-3"}),r("p",Df,S(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:y[0]||(y[0]=Ae=>o(t).loadGitGraph(n.workingDirectory))},[Q(o(gn),{class:"w-4 h-4"}),y[45]||(y[45]=_e(" Retry ",-1))])])):o(t).commits.length===0?(i(),u("div",If,[...y[46]||(y[46]=[r("div",{class:"text-retro-muted text-center"},[r("p",null,"No commits found in this repository.")],-1)])])):(i(),u(me,{key:4},[o(ee)?(i(),ce(ke,{key:0,ref_key:"findWidgetRef",ref:V,resultCount:o(t).searchResultHashes.length,currentIndex:o(t).searchResultIndex,onSearch:ue,onNext:o(t).nextSearchResult,onPrev:o(t).prevSearchResult,onClose:ie},null,8,["resultCount","currentIndex","onNext","onPrev"])):N("",!0),r("div",Lf,[r("button",{class:ge(["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":"Find (Ctrl+F)",title:"Find (Ctrl+F)",onClick:y[1]||(y[1]=Ae=>o(ee)?ie():re())},[Q(o(Zn),{class:"w-4 h-4"})],2),r("div",Nf,[r("button",{class:ge(["flex items-center gap-1 px-2 py-1.5 text-sm border rounded transition-colors",o(ne)?"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:y[2]||(y[2]=Ae=>ne.value=!o(ne))},[Q(o(Us),{class:"w-4 h-4"})],2),o(ne)?(i(),u("div",Ff,[y[53]||(y[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",Hf,[r("input",{type:"radio",name:"graphStyle",value:"rounded",checked:o(t).graphStyle==="rounded",class:"accent-retro-cyan",onChange:y[3]||(y[3]=Ae=>o(t).setGraphStyle("rounded"))},null,40,Of),y[47]||(y[47]=r("span",{class:"text-sm text-retro-text"},"Rounded",-1))]),r("label",Uf,[r("input",{type:"radio",name:"graphStyle",value:"angular",checked:o(t).graphStyle==="angular",class:"accent-retro-cyan",onChange:y[4]||(y[4]=Ae=>o(t).setGraphStyle("angular"))},null,40,jf),y[48]||(y[48]=r("span",{class:"text-sm text-retro-text"},"Angular",-1))]),y[54]||(y[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",zf,[r("input",{type:"checkbox",checked:o(t).muteNonAncestral,class:"accent-retro-cyan",onChange:y[5]||(y[5]=Ae=>o(t).toggleMuteNonAncestral())},null,40,Vf),y[49]||(y[49]=r("span",{class:"text-sm text-retro-text"},"Mute non-ancestral",-1))]),y[55]||(y[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",Wf,[r("input",{type:"checkbox",checked:o(t).columnVisibility.commit!==!1,class:"accent-retro-cyan",onChange:y[6]||(y[6]=Ae=>o(t).toggleColumnVisibility("commit"))},null,40,Gf),y[50]||(y[50]=r("span",{class:"text-sm text-retro-text"},"Hash",-1))]),r("label",qf,[r("input",{type:"checkbox",checked:o(t).columnVisibility.author!==!1,class:"accent-retro-cyan",onChange:y[7]||(y[7]=Ae=>o(t).toggleColumnVisibility("author"))},null,40,Zf),y[51]||(y[51]=r("span",{class:"text-sm text-retro-text"},"Author",-1))]),r("label",Kf,[r("input",{type:"checkbox",checked:o(t).columnVisibility.date!==!1,class:"accent-retro-cyan",onChange:y[8]||(y[8]=Ae=>o(t).toggleColumnVisibility("date"))},null,40,Yf),y[52]||(y[52]=r("span",{class:"text-sm text-retro-text"},"Date",-1))])])):N("",!0)]),y[58]||(y[58]=r("span",{class:"flex-1"},null,-1)),r("div",Xf,[r("button",{class:ge(["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:y[9]||(y[9]=Ae=>te.value=!o(te))},[Q(o(oa),{class:"w-4 h-4"}),o(t).filteredBranches.length>0?(i(),u("span",Jf," ("+S(o(t).filteredBranches.length)+") ",1)):N("",!0)],10,Qf),o(te)?(i(),u("div",em,[y[57]||(y[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:y[10]||(y[10]=Ae=>o(t).clearFilters())}," Clear All Filters ")):N("",!0),o(M).local.length>0?(i(),u(me,{key:1},[y[56]||(y[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(me,null,Ee(o(M).local,Ae=>(i(),u("label",{key:Ae.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(Ae.name),class:"accent-retro-cyan",onChange:Fn=>o(t).toggleBranchFilter(Ae.name)},null,40,tm),r("span",nm,S(Ae.name),1),Ae.isHead?(i(),u("span",rm,"(HEAD)")):N("",!0)]))),128))],64)):N("",!0),(i(!0),u(me,null,Ee(o(M).remotes,(Ae,Fn)=>(i(),u(me,{key:Fn},[r("div",om,S(Fn),1),(i(!0),u(me,null,Ee(Ae,An=>(i(),u("label",{key:An.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(An.name),class:"accent-retro-cyan",onChange:vo=>o(t).toggleBranchFilter(An.name)},null,40,sm),r("span",am,S(An.name),1)]))),128))],64))),128))])):N("",!0)]),r("button",{class:ge(["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 (Ctrl+R)",title:"Refresh (Ctrl+R)",onClick:y[11]||(y[11]=Ae=>o(t).loadGitGraph(n.workingDirectory))},[Q(o(gn),{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:j},[Q(o(es),{class:"w-4 h-4"})]),r("div",im,[r("button",{class:ge(["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:y[12]||(y[12]=Ae=>Z.value=!o(Z))},[Q(o(ts),{class:"w-4 h-4"})],2),o(Z)?(i(),u("div",lm,[Q(Fe,{remotes:o(t).remotes,onAdd:F,onEdit:B,onDelete:X,onClose:y[13]||(y[13]=Ae=>Z.value=!1)},null,8,["remotes"])])):N("",!0)]),o(A)&&n.isActive?(i(),u("div",{key:0,class:ge(["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:ge(["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(" "+S(o(A)),1)],10,cm)):N("",!0)]),r("div",{class:ge(["flex-1 min-h-0 overflow-hidden",{"max-h-[50%]":o(t).selectedCommit||o(t).isUncommittedChangesSelected}])},[Q(st,{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(f),previewMergeBases:o(m),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:k,onCommitContextMenu:qe,onTagContextMenu:Ht,onStashContextMenu:xt,onCompareSelect:le,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(),ce(kn,{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(),ce(wr,{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:ye,onTogglePosition:o(t).toggleDetailViewPosition,onOpenFileDiff:y[14]||(y[14]=Ae=>o(t).selectedCommit&&o(t).openFileDiff(o(t).selectedCommit.hash,Ae))},null,8,["commit","files","stats","loading","detailPosition","onClose","onTogglePosition"])):N("",!0),o(t).isUncommittedChangesSelected?(i(),ce(kr,{key:3,stagedFiles:o(t).stagedFiles,unstagedFiles:o(t).unstagedFiles,isStaging:o(t).isStaging,isCommitting:o(t).isCommitting,onClose:o(t).clearSelection,onStageFiles:y[15]||(y[15]=Ae=>o(t).stageFiles(Ae)),onUnstageFiles:y[16]||(y[16]=Ae=>o(t).unstageFiles(Ae)),onStageAll:y[17]||(y[17]=()=>o(t).stageFiles([])),onUnstageAll:y[18]||(y[18]=()=>o(t).unstageFiles([])),onCommit:y[19]||(y[19]=Ae=>o(t).commitChanges(Ae))},null,8,["stagedFiles","unstagedFiles","isStaging","isCommitting","onClose"])):N("",!0)],64)),o(p).visible?(i(),ce(Cr,{key:5,branchName:o(p).branch,isCurrentBranch:o(p).isCurrentBranch,isLocal:o(p).isLocal,x:o(p).x,y:o(p).y,onClose:H,onCheckout:W,onCreateBranch:xe,onDeleteBranch:G,onRename:ae,onMerge:R,onRebase:$,onPush:I,onPull:L,onFetch:K,onCopyName:ve},null,8,["branchName","isCurrentBranch","isLocal","x","y"])):N("",!0),o(Te).visible&&o(Te).commit?(i(),ce(Jn,{key:6,commit:o(Te).commit,x:o(Te).x,y:o(Te).y,onClose:Ye,onAddTag:de,onCreateBranch:oe,onCheckout:be,onCherryPick:Se,onRevert:we,onMergeInto:Be,onReset:Oe,onCopyHash:zt,onCopySubject:Mt},null,8,["commit","x","y"])):N("",!0),o(at).visible?(i(),ce(Ln,{key:7,tagName:o(at).tag,x:o(at).x,y:o(at).y,onClose:Rt,onViewDetails:Pt,onDeleteTag:It,onPushTag:dt,onCopyName:Vt},null,8,["tagName","x","y"])):N("",!0),o(Je).visible&&o(Je).stash?(i(),ce($r,{key:8,stashIndex:o(Je).stash.index,stashMessage:o(Je).stash.message,x:o(Je).x,y:o(Je).y,onClose:Bt,onApply:en,onPop:xn,onDrop:Gt,onCreateBranch:qt,onCopyName:bn,onCopyHash:Ut},null,8,["stashIndex","stashMessage","x","y"])):N("",!0),o(mt).visible?(i(),ce(Sr,{key:9,x:o(mt).x,y:o(mt).y,onClose:At,onStash:Wt,onReset:ln,onClean:Ot},null,8,["x","y"])):N("",!0),o(it).visible?(i(),ce(Nn,{key:10,title:"Checkout",visible:o(it).visible,loading:o(it).loading,error:o(it).error,confirmLabel:"Checkout",onClose:y[20]||(y[20]=Ae=>o(it).visible=!1),onConfirm:yn},{default:Ke(()=>[r("p",um,[y[59]||(y[59]=_e(" Are you sure you want to checkout ",-1)),r("span",dm,S(o(it).branchName),1),y[60]||(y[60]=_e("? ",-1))])]),_:1},8,["visible","loading","error"])):N("",!0),o(Re).visible?(i(),ce(Nn,{key:11,title:"Rename Branch",visible:o(Re).visible,loading:o(Re).loading,error:o(Re).error,confirmLabel:"Rename",onClose:y[22]||(y[22]=Ae=>o(Re).visible=!1),onConfirm:yt},{default:Ke(()=>[r("div",fm,[r("p",mm,[y[61]||(y[61]=_e(" Rename ",-1)),r("span",hm,S(o(Re).branchName),1)]),Pe(r("input",{"onUpdate:modelValue":y[21]||(y[21]=Ae=>o(Re).newName=Ae),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:sn(yt,["enter"])},null,544),[[pt,o(Re).newName]])])]),_:1},8,["visible","loading","error"])):N("",!0),o(Xe).visible?(i(),ce(cd,{key:12,visible:o(Xe).visible,branchName:o(Xe).branchName,loading:o(Xe).loading,error:o(Xe).error,onClose:y[23]||(y[23]=Ae=>o(Xe).visible=!1),onConfirm:Zt},null,8,["visible","branchName","loading","error"])):N("",!0),o(et).visible?(i(),ce(nd,{key:13,visible:o(et).visible,branchName:o(et).branchName,isLocal:o(et).isLocal,loading:o(et).loading,error:o(et).error,onClose:y[24]||(y[24]=Ae=>o(et).visible=!1),onConfirm:cn},null,8,["visible","branchName","isLocal","loading","error"])):N("",!0),o(tt).visible?(i(),ce(_d,{key:14,visible:o(tt).visible,branchName:o(tt).branchName,remotes:o(w),loading:o(tt).loading,error:o(tt).error,onClose:y[25]||(y[25]=Ae=>o(tt).visible=!1),onConfirm:un},null,8,["visible","branchName","remotes","loading","error"])):N("",!0),o(nt).visible?(i(),ce(vd,{key:15,visible:o(nt).visible,branchName:o(nt).branchName,remotes:o(w),loading:o(nt).loading,error:o(nt).error,onClose:y[26]||(y[26]=Ae=>o(nt).visible=!1),onConfirm:dn},null,8,["visible","branchName","remotes","loading","error"])):N("",!0),o(Ue).visible?(i(),ce(Pd,{key:16,visible:o(Ue).visible,branchName:o(t).currentBranch?.name||"HEAD",ontoBranch:o(Ue).branchName,loading:o(Ue).loading,error:o(Ue).error,onClose:y[27]||(y[27]=Ae=>o(Ue).visible=!1),onConfirm:Et},null,8,["visible","branchName","ontoBranch","loading","error"])):N("",!0),o(je).visible?(i(),ce(Wu,{key:17,visible:o(je).visible,commitHash:o(je).commitHash,commitMessage:o(je).commitMessage,loading:o(je).loading,error:o(je).error,onClose:y[28]||(y[28]=Ae=>o(je).visible=!1),onConfirm:tn},null,8,["visible","commitHash","commitMessage","loading","error"])):N("",!0),o(rt).visible?(i(),ce(Od,{key:18,visible:o(rt).visible,commitHash:o(rt).commitHash,commitMessage:o(rt).commitMessage,loading:o(rt).loading,error:o(rt).error,onClose:y[29]||(y[29]=Ae=>o(rt).visible=!1),onConfirm:fn},null,8,["visible","commitHash","commitMessage","loading","error"])):N("",!0),o(ot).visible?(i(),ce(af,{key:19,visible:o(ot).visible,commitHash:o(ot).commitHash,remotes:o(w),loading:o(ot).loading,error:o(ot).error,onClose:y[30]||(y[30]=Ae=>o(ot).visible=!1),onConfirm:wn},null,8,["visible","commitHash","remotes","loading","error"])):N("",!0),o(pe).visible?(i(),ce(hf,{key:20,visible:o(pe).visible,tagName:o(pe).tagName,remotes:o(w),loading:o(pe).loading,error:o(pe).error,onClose:y[31]||(y[31]=Ae=>o(pe).visible=!1),onConfirm:E},null,8,["visible","tagName","remotes","loading","error"])):N("",!0),o(se).visible?(i(),ce(Af,{key:21,visible:o(se).visible,tagName:o(se).tagName,tagDetail:o(se).tagDetail,loading:o(se).loading,onClose:y[32]||(y[32]=Ae=>o(se).visible=!1)},null,8,["visible","tagName","tagDetail","loading"])):N("",!0),o(Ie).visible?(i(),ce(Yu,{key:22,visible:o(Ie).visible,fromCommit:o(Ie).fromCommit,loading:o(Ie).loading,error:o(Ie).error,onClose:y[33]||(y[33]=Ae=>o(Ie).visible=!1),onConfirm:Lt},null,8,["visible","fromCommit","loading","error"])):N("",!0),o(Ne).visible?(i(),ce(Nn,{key:23,title:"Create Branch from Stash",visible:o(Ne).visible,loading:o(Ne).loading,error:o(Ne).error,confirmLabel:"Create Branch",onClose:y[36]||(y[36]=Ae=>o(Ne).visible=!1),onConfirm:y[37]||(y[37]=Ae=>Qe(o(Ve)))},{default:Ke(()=>[r("div",pm,[r("p",vm,[y[62]||(y[62]=_e(" Create a new branch from ",-1)),r("span",gm,"stash@"+S("{")+S(o(Ne).stashIndex)+S("}"),1)]),Pe(r("input",{"onUpdate:modelValue":y[34]||(y[34]=Ae=>He(Ve)?Ve.value=Ae: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:y[35]||(y[35]=sn(Ae=>Qe(o(Ve)),["enter"]))},null,544),[[pt,o(Ve)]])])]),_:1},8,["visible","loading","error"])):N("",!0),o(he).visible?(i(),ce(Zd,{key:24,visible:o(he).visible,loading:o(he).loading,error:o(he).error,onClose:y[38]||(y[38]=Ae=>o(he).visible=!1),onConfirm:ze},null,8,["visible","loading","error"])):N("",!0),o(Ze).visible?(i(),ce(Wd,{key:25,visible:o(Ze).visible,loading:o(Ze).loading,error:o(Ze).error,onClose:y[39]||(y[39]=Ae=>o(Ze).visible=!1),onConfirm:Nt},null,8,["visible","loading","error"])):N("",!0),o(ct).visible?(i(),ce(Xu,{key:26,visible:o(ct).visible,loading:o(ct).loading,error:o(ct).error,onClose:y[40]||(y[40]=Ae=>o(ct).visible=!1),onConfirm:b},null,8,["visible","loading","error"])):N("",!0),(i(),ce(Jt,{to:"body"},[Q(Sn,{name:"fade"},{default:Ke(()=>[o(D).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:kt({left:`${o(D).x}px`,top:`${o(D).y-40}px`})}," Copied! ",4)):N("",!0)]),_:1})])),(i(),ce(Jt,{to:"body"},[Q(Sn,{name:"fade"},{default:Ke(()=>[o(t).operationError?(i(),u("div",xm,[Q(o($n),{class:"w-4 h-4 flex-shrink-0"}),r("span",bm,S(o(t).operationError),1),r("button",{class:"flex-shrink-0 p-0.5 hover:bg-white/20 rounded transition-colors",onClick:y[41]||(y[41]=Ae=>o(t).clearOperationError()),"aria-label":"Dismiss error"},[Q(o(vt),{class:"w-3.5 h-3.5"})])])):N("",!0)]),_:1})]))])}}}),wm=qr(ym,[["__scopeId","data-v-100753e7"]]),km=Bs("/app-logo.svg");function Cm(e){return/^\/speckit\.(clarify|plan|tasks|implement)(\s|$)/.test(e)}function $m(e=Date.now,n=Math.random){return`req-${e()}-${n().toString(36).slice(2,8)}`}function Ho(e=Date.now){return`session-${e()}`}function Rr(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 Pr(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=hr("autoMode",()=>{const e=C(!1),n=C(null),t=C(!1),a=C(null);let s=null,l=null;const c=new Map,f=U(()=>n.value?.state==="active"),m=U(()=>n.value?.tasks??[]),d=U(()=>m.value.filter(ne=>ne.state==="queued").length),w=U(()=>m.value.find(ne=>ne.state==="running")??null),T=U(()=>m.value.filter(ne=>ne.state==="completed").length),g=U(()=>m.value.filter(ne=>ne.state==="failed").length),v=U(()=>m.value.length);async function h(){if(typeof window<"u")try{(await $fetch("/api/settings"))?.autoModeEnabled===!0&&(e.value=!0)}catch{}try{const ne=await $fetch("/api/auto-mode/status");e.value=ne.enabled,n.value=ne.session}catch{}ie()}async function P(){t.value=!0,a.value=null;try{const Z=Kn().autoModeConcurrency,j=await $fetch("/api/auto-mode/toggle",{method:"POST",body:{enabled:!e.value,concurrency:Z}});j.success?(e.value=j.enabled,fe(j.enabled)):a.value=j.error||"Toggle failed"}catch(ne){a.value=ne instanceof Error?ne.message:String(ne)}finally{t.value=!1}}function q(ne){switch(ne.type){case"auto_mode_status":e.value=ne.enabled,n.value=ne.session,fe(ne.enabled);break;case"auto_mode_task_update":if(n.value){const Z=n.value.tasks.findIndex(j=>j.featureId===ne.task.featureId);Z>=0&&(n.value.tasks[Z]=ne.task)}ne.task.state==="running"&&ne.task.worktreePath&&ne.task.worktreeBranch&&re(ne.task);break;case"auto_mode_error":a.value=ne.error;break;case"auto_mode_step_start":ee(ne.featureId,ne.step);break;case"auto_mode_step_complete":te(ne.featureId);break;case"auto_mode_message":V(ne.featureId,ne.sdkMessage);break}}function A(ne){return gt().findConversationByFeature(ne)}function ee(ne,Z){if(typeof window>"u")return;const j=gt(),F=A(ne);if(!F)return;const B={id:ur(),role:"user",content:`/speckit.${Z} ${ne}`,timestamp:new Date().toISOString()};j.addMessage(B,F.id);const X={id:ur(),role:"assistant",content:"",timestamp:new Date().toISOString(),status:"streaming"};j.addMessage(X,F.id),c.set(ne,X.id),j.startConversationStreaming(F.id),j.saveConversation(F.id,!1)}function te(ne){if(typeof window>"u")return;const Z=gt(),j=A(ne);if(!j)return;const F=c.get(ne);F&&(Z.updateMessage(F,{status:"complete"},j.id),c.delete(ne)),Z.endConversationStreaming(j.id),Z.saveConversation(j.id,!0)}function V(ne,Z){if(typeof window>"u")return;const j=gt(),F=A(ne);if(!F)return;const B=c.get(ne);if(B){if(Z.type==="assistant"&&Z.message?.content){for(const X of Z.message.content)if(X.type==="text"&&X.text)j.appendToMessageWithSave(B,X.text,F.id);else if(X.type==="tool_use"&&X.name){const M=X.input?$s(X.input):"",p=`
68
+
69
+ ▶ **${X.name}** ${M}
70
+ `;j.appendToMessageWithSave(B,p,F.id)}}if(Z.type==="tool_result"||Z.type==="user"){const X=Z.message?.content||Z.content;if(Array.isArray(X)){for(const M of X)if(M.type==="tool_result"&&M.content){const p=typeof M.content=="string"?M.content:Array.isArray(M.content)?M.content.filter(k=>k.type==="text").map(k=>k.text).join(""):"";if(p){const k=p.slice(0,300),H=p.length>300?"...":"",W=M.is_error?"✗ Error:":"✓";j.appendToMessageWithSave(B,`${W} ${k}${H}
71
+ `,F.id)}}}}}}function re(ne){if(typeof window>"u")return;const Z=gt(),j=Z.findConversationByFeature(ne.featureId);if(j){const X=Z.conversations.find(M=>M.id===j.id);X&&(X.autoMode||(X.autoMode=!0),ne.worktreePath&&!X.worktreePath&&(X.worktreePath=ne.worktreePath,X.worktreeBranch=ne.worktreeBranch,X.baseBranch=ne.baseBranch,X.cwd=ne.worktreePath,X.hasWorktree=!0),Z.saveAllConversations());return}const B={id:zo(),title:`Auto: ${ne.featureId}`,messages:[],createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),cwd:ne.worktreePath||"",featureId:ne.featureId,autoMode:!0,worktreePath:ne.worktreePath,worktreeBranch:ne.worktreeBranch,baseBranch:ne.baseBranch,hasWorktree:!0};Z.addAutoModeConversation(B)}function ie(){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=j=>{try{const F=JSON.parse(j.data);q(F)}catch{}},s.onclose=()=>{s=null,l=setTimeout(()=>ie(),5e3)},s.onerror=()=>{}}function ue(){l&&(clearTimeout(l),l=null),s&&(s.close(),s=null)}function fe(ne){typeof window<"u"&&$fetch("/api/settings",{method:"POST",body:{autoModeEnabled:ne}}).catch(Z=>{console.error("Failed to persist autoModeEnabled:",Z)})}return{enabled:e,session:n,loading:t,error:a,isActive:f,tasks:m,queuedCount:d,runningTask:w,completedCount:T,failedCount:g,totalCount:v,initialize:h,toggle:P,disconnectWebSocket:ue}}),Sm=["disabled"],_m=Me({__name:"AutoModeToggle",setup(e){const n=Ss();return ut(()=>{n.initialize()}),(t,a)=>(i(),u("button",{type:"button",class:ge(["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())},[Q(o(Zr),{class:ge(["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:ge(["inline-block w-1.5 h-1.5 rounded-full bg-retro-yellow",{"animate-pulse":o(n).isActive}])},null,2)):N("",!0)],10,Sm))}}),Tm={class:"flex items-start justify-between gap-2"},Mm={class:"flex-1 min-w-0"},Am={class:"flex items-center gap-2"},Bm={class:"font-mono text-sm text-retro-text truncate"},Em={class:"text-sm font-mono text-retro-muted mt-1 truncate"},Rm={class:"flex items-center gap-1 flex-shrink-0"},Pm={key:0,class:"text-[11px] font-mono text-retro-muted mr-1",title:"Completed tasks / total tasks"},Dm={key:1,class:"w-2 h-2 rounded-full bg-retro-green",title:"spec"},Im={key:2,class:"w-2 h-2 rounded-full bg-retro-cyan",title:"plan"},Lm={key:3,class:"w-2 h-2 rounded-full bg-retro-yellow",title:"tasks"},Nm={class:"flex flex-wrap items-center justify-between gap-1 mt-2"},Fm={key:0,class:"flex items-center gap-1"},Hm=["title","disabled","onClick"],Om=Me({__name:"FeatureCard",props:{feature:{},skills:{},isActive:{type:Boolean}},emits:["select","cascade","openChat","skill"],setup(e,{emit:n}){const t={DocumentCheckIcon:Js,PuzzlePieceIcon:$o,DocumentMagnifyingGlassIcon:ta,WrenchScrewdriverIcon:ma,SparklesIcon:gr,BeakerIcon:Gs,ShieldCheckIcon:as,CommandLineIcon:Qs,CpuChipIcon:ns,LightBulbIcon:ia},a=e,s=n,l=gt();function c(g){return t[g]||$o}function f(g){return g.prerequisites.every(v=>a.feature.files.some(h=>h.filename===v))}function m(g){return g.prerequisites.filter(v=>!a.feature.files.some(h=>h.filename===v))}function d(g){return f(g)?`${g.name} (Shift+click: new conversation)`:`Requires: ${m(g).join(", ")}`}const w=U(()=>{const g=l.findConversationByFeature(a.feature.id);return g?l.isConversationStreaming(g.id):!1}),T=U(()=>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(g,v)=>(i(),u("button",{type:"button",class:ge(["w-full p-3 text-left rounded-lg border transition-all duration-200 group",o(T)]),onClick:v[6]||(v[6]=h=>s("select",e.feature.id))},[r("div",Tm,[r("div",Mm,[r("div",Am,[Q(o(qn),{class:ge(["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",Bm,S(e.feature.id),1)]),r("p",Em,S(e.feature.name),1)]),r("div",Rm,[e.feature.hasTasks?(i(),u("span",Pm,S(e.feature.completedTasks)+"/"+S(e.feature.totalTasks),1)):N("",!0),e.feature.hasSpec?(i(),u("span",Dm)):N("",!0),e.feature.hasPlan?(i(),u("span",Im)):N("",!0),e.feature.hasTasks?(i(),u("span",Lm)):N("",!0)])]),r("div",Nm,[e.feature.hasSpec?(i(),u("div",Fm,[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:v[0]||(v[0]=ft(h=>s("cascade",h,e.feature.id,"clarify"),["stop"]))},[Q(o(eo),{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:v[1]||(v[1]=ft(h=>s("cascade",h,e.feature.id,"plan"),["stop"]))},[Q(o(Qr),{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:v[2]||(v[2]=ft(h=>s("cascade",h,e.feature.id,"tasks"),["stop"]))},[Q(o(os),{class:"h-3.5 w-3.5"})])):N("",!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:v[3]||(v[3]=ft(h=>s("cascade",h,e.feature.id,"implement"),["stop"]))},[Q(o(da),{class:"h-3.5 w-3.5"})])):N("",!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:v[4]||(v[4]=ft(h=>s("cascade",h,e.feature.id,"analyze"),["stop"]))},[Q(o(Zs),{class:"h-3.5 w-3.5"})])):N("",!0),e.skills.length>0?(i(),u(me,{key:3},[v[7]||(v[7]=r("div",{class:"w-px h-4 bg-retro-border mx-0.5"},null,-1)),(i(!0),u(me,null,Ee(e.skills,h=>(i(),u("button",{key:h.id,type:"button",class:ge(["flex items-center justify-center p-1 rounded transition-colors",[f(h)&&!o(w)?"bg-retro-pink/20 text-retro-pink hover:bg-retro-pink/30":"bg-retro-subtle/10 text-retro-subtle cursor-not-allowed",o(w)?"animate-pulse":""]]),title:d(h),disabled:!f(h)||o(w),onClick:ft(P=>s("skill",P,e.feature.id,h.id),["stop"])},[(i(),ce(En(c(h.icon)),{class:"h-3.5 w-3.5"}))],10,Hm))),128))],64)):N("",!0)])):N("",!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:v[5]||(v[5]=ft(h=>s("openChat",h,e.feature.id),["stop"]))},[Q(o(Qo),{class:"h-3.5 w-3.5"})])):N("",!0)])],2))}});function ho(){function e(n){const t=We.parse(n);return Cs.sanitize(t)}return{renderMarkdown:e}}const Um={class:"fixed inset-0 z-50 flex items-center justify-center"},jm={class:"relative w-[96vw] h-[94vh] bg-retro-black border border-retro-border rounded-lg shadow-2xl flex flex-col overflow-hidden"},zm={class:"flex-shrink-0 flex items-center justify-between px-4 h-12 border-b border-retro-border bg-retro-dark"},Vm={class:"flex items-center gap-3 min-w-0"},Wm={class:"text-sm font-mono font-bold text-retro-cyan truncate"},Gm={class:"text-xs font-mono text-retro-subtle"},qm={class:"flex items-center gap-2"},Zm=["disabled"],Km={key:0,class:"flex-shrink-0 flex items-center gap-0 border-b border-retro-border bg-retro-dark overflow-x-auto"},Ym=["onClick"],Xm={class:"flex-1 min-h-0 overflow-y-auto"},Qm={key:0,class:"flex items-center justify-center py-12"},Jm={key:1,class:"flex flex-col items-center justify-center py-12 text-center px-4"},eh={class:"text-sm font-mono text-retro-red"},th={key:2,class:"flex flex-col items-center justify-center py-12 text-center"},nh={key:3,class:"h-full flex flex-col"},rh=["innerHTML"],oh=Me({__name:"SpecViewerModal",props:{feature:{}},emits:["close"],setup(e,{emit:n}){const t=e,a=n,s=Dn(),{renderMarkdown:l}=ho(),c=C(t.feature.files[0]?.filename||""),f=C(""),m=C(!1),d=C(null),w=C(!1),T=C(""),g=C(!1);async function v(){if(c.value){m.value=!0,d.value=null;try{const V=`/api/specs/${t.feature.id}/${c.value}`,re=await $fetch(V);f.value=re.content}catch{d.value="Failed to load file",f.value=""}finally{m.value=!1}}}const h=U(()=>f.value?l(f.value):"");function P(V){w.value&&(w.value=!1),c.value=V,v()}function q(){T.value=f.value,w.value=!0}function A(){w.value=!1,T.value=""}async function ee(){g.value=!0;try{const V=`/api/specs/${t.feature.id}/${c.value}`;await $fetch(V,{method:"PUT",body:{content:T.value}}),f.value=T.value,w.value=!1,s.success("Saved")}catch{s.error("Failed to save")}finally{g.value=!1}}function te(V){V.key==="Escape"&&(w.value?A():a("close"))}return ut(()=>{window.addEventListener("keydown",te),v()}),$t(()=>{window.removeEventListener("keydown",te)}),(V,re)=>(i(),ce(Jt,{to:"body"},[r("div",Um,[r("div",{class:"absolute inset-0 bg-black/80",onClick:re[0]||(re[0]=ie=>a("close"))}),r("div",jm,[r("div",zm,[r("div",Vm,[r("span",Wm,S(e.feature.name),1),r("span",Gm,S(e.feature.id),1)]),r("div",qm,[o(w)?(i(),u(me,{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:A}," 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(g),onClick:ee},S(o(g)?"Saving...":"Save"),9,Zm)],64)):o(f)&&!o(m)&&!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:q},[Q(o(Jr),{class:"h-4 w-4"})])):N("",!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]=ie=>a("close"))},[Q(o(vt),{class:"h-4 w-4"})])])]),e.feature.files.length>0?(i(),u("div",Km,[(i(!0),u(me,null,Ee(e.feature.files,ie=>(i(),u("button",{key:ie.filename,type:"button",class:ge(["px-4 py-2 text-xs font-mono border-b-2 transition-colors whitespace-nowrap",[o(c)===ie.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=>P(ie.filename)},S(ie.label),11,Ym))),128))])):N("",!0),r("div",Xm,[o(m)?(i(),u("div",Qm,[...re[3]||(re[3]=[r("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading...",-1)])])):o(d)?(i(),u("div",Jm,[r("p",eh,S(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:v}," Retry ")])):e.feature.files.length===0?(i(),u("div",th,[...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(w)?(i(),u("div",nh,[Pe(r("textarea",{"onUpdate:modelValue":re[2]||(re[2]=ie=>He(T)?T.value=ie: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),[[pt,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(h)},null,8,rh))])])])]))}});function sh(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,nn=new Map,ir=new Set,ah=3e4,ih=18e4;function lh(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 ch(e,n){const t=[];return e.reason?t.push(e.reason):t.push(lh(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=gt(),n=Kn();function t(){return typeof document>"u"||typeof document.hasFocus!="function"?!1:document.visibilityState==="visible"&&document.hasFocus()}function a(M){const k=e.conversations.find(H=>H.id===M)?.title?.trim()||"Chat";return new Notification("Spec Cat",{body:`${k} response completed.`,tag:`chat-complete-${M}`})}async function s(M){if(!(typeof window>"u"||typeof Notification>"u")&&!t()){if(Notification.permission==="granted"){a(M);return}if(Notification.permission==="default")try{await Notification.requestPermission()==="granted"&&a(M)}catch(p){console.warn("[useChatStream] Failed to request browser notification permission:",p)}}}function l(){return typeof window>"u"?"":`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/_ws`}function c(M){M.healthCheckInterval&&(clearInterval(M.healthCheckInterval),M.healthCheckInterval=null)}function f(M){c(M),M.lastMessageTime=Date.now(),M.healthCheckInterval=mo(()=>{const p=M.conversationId;if(M.ws.readyState!==WebSocket.OPEN){console.warn(`[useChatStream] Health check: WebSocket not open for ${p}`),c(M),e.isConversationStreaming(p)&&(w(M.currentMessageId,p,"error"),e.updateMessage(M.currentMessageId,{status:"error"},p),e.setSessionError("Connection lost during streaming",p),e.endSession(p),e.endConversationStreaming(p)),lt.delete(p);return}if(e.isConversationStreaming(p)){const k=Date.now()-M.lastMessageTime;k>ih&&(console.warn(`[useChatStream] Health check: streaming timeout for ${p} (${Math.round(k/1e3)}s)`),c(M),w(M.currentMessageId,p,"error"),e.updateMessage(M.currentMessageId,{status:"error"},p),e.setSessionError("Streaming timed out — no response from server for 3 minutes",p),e.endSession(p),e.endConversationStreaming(p),M.ws.close(),lt.delete(p))}},ah)}function m(M,p){return e.conversations.find(H=>H.id===M)?.messages.find(H=>H.id===p)?.status}function d(M,p=!0){const k=lt.get(M);k&&(c(k),p&&k.ws.readyState===WebSocket.OPEN&&k.ws.close(),lt.delete(M))}function w(M,p,k){const W=e.conversations.find(ae=>ae.id===p)?.messages.find(ae=>ae.id===M);if(W?.contentBlocks)for(const ae of W.contentBlocks)ae.type==="tool_use"&&(ae.status==="running"||ae.status==="pending")&&e.updateBlockById(M,ae.id,G=>{G.type==="tool_use"&&(G.status=k)},p)}async function T(M){try{(await g(M)).send(JSON.stringify({type:"reset_context"})),e.clearProviderSession(M),console.log("[useChatStream] Context reset requested for conversation:",M)}catch(p){throw console.error("[useChatStream] Failed to reset context:",p),p}}function g(M){return new Promise((p,k)=>{const H=lt.get(M);if(H&&H.ws.readyState===WebSocket.OPEN){p(H.ws);return}H&&(H.ws.close(),lt.delete(M));const W=l(),ae=new WebSocket(W),G={ws:ae,currentMessageId:"",conversationId:M,activeTools:new Map,currentTextBlockId:null,currentThinkingBlockId:null,healthCheckInterval:null,lastMessageTime:Date.now(),lastServerError:null,lastSocketError:null};lt.set(M,G),ae.onopen=()=>{p(ae)},ae.onerror=R=>{console.error(`[useChatStream] WebSocket error for conversation ${M}:`,R);const $=lt.get(M);$&&($.lastSocketError="Browser reported a WebSocket transport error (network/proxy/server)"),e.isConversationStreaming(M)&&($?.currentMessageId&&(w($.currentMessageId,M,"error"),e.updateMessage($.currentMessageId,{status:"error"},M)),e.setSessionError("Connection error during streaming",M),e.endSession(M),e.endConversationStreaming(M)),lt.delete(M),k(new Error("WebSocket connection failed. Server may be unavailable."))},ae.onclose=R=>{const $=lt.get(M);if($&&c($),lt.delete(M),nn.delete(M),e.isConversationStreaming(M)){$?.currentMessageId&&(w($.currentMessageId,M,"error"),e.updateMessage($.currentMessageId,{status:"error"},M));const I=ch(R,$);e.setSessionError(`Connection closed: ${I} (code: ${R.code})`,M),e.endSession(M),e.endConversationStreaming(M)}},ae.onmessage=R=>{q(R.data,M)}})}async function v(M,p=3){for(let k=0;k<p;k++){const H=e.conversations.find(W=>W.id===M);if(H)return H;k<p-1&&await new Promise(W=>setTimeout(W,100))}console.error("[useChatStream] Conversation not found after retries:",M)}function h(M,p){return`${M}:${p}`}function P(M,p){const k=e.conversations.find(W=>W.id===M);if(!k)return null;const H=k.messages.findIndex(W=>W.id===p);if(H<=0)return null;for(let W=H-1;W>=0;W--){const ae=k.messages[W];if(ae.role==="user"&&ae.content.trim().length>0)return ae.content}return null}async function q(M,p){const k=lt.get(p);if(k){k.lastMessageTime=Date.now();try{e.pushDebugEvent({direction:"in",channel:"ws",eventType:"ws.raw",payload:M},p);const H=JSON.parse(M);if(e.pushDebugEvent({direction:"in",channel:"ws",eventType:H.type,payload:H},p),H.type==="error"){console.error(`[useChatStream] Server error for ${p}:`,H.error);const W=H.error||"Unknown server error";k.lastServerError=W;const ae=/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(W);if(/state db missing rollout path for thread/i.test(W)&&!ae){const R=h(p,k.currentMessageId);if(!ir.has(R)){const $=P(p,k.currentMessageId);if($){ir.add(R),e.setProviderSessionId("",p),ee(k.currentMessageId,`
72
+
73
+ > **Session Reset**: Codex resume state was corrupted. Retrying once with a fresh session...
74
+
75
+ `,p);try{const I=e.conversations.find(K=>K.id===p),L=Rr(I);await re($,k.currentMessageId,p,L);return}catch(I){console.error(`[useChatStream] Rollout-path recovery retry failed for ${p}:`,I)}}}}c(k),w(k.currentMessageId,p,"error"),e.updateMessage(k.currentMessageId,{status:"error"},p),/state db missing rollout path for thread/i.test(W)&&e.setProviderSessionId("",p),ir.delete(h(p,k.currentMessageId)),e.setSessionError(W,p),e.endSession(p),e.endConversationStreaming(p),fe(p),e.saveConversation(p,!0),d(p);return}if(H.type==="done"){c(k);const W=m(p,k.currentMessageId);if(ir.delete(h(p,k.currentMessageId)),H.denied){w(k.currentMessageId,p,"error"),e.updateMessage(k.currentMessageId,{status:"stopped"},p),e.endSession(p),e.endConversationStreaming(p),fe(p),e.clearPendingPermission(p),k.activeTools.clear(),e.saveConversation(p,!0),d(p);return}if(W==="error"||W==="stopped"){w(k.currentMessageId,p,"error"),e.endSession(p),e.endConversationStreaming(p),fe(p),e.clearPendingPermission(p),k.activeTools.clear(),e.saveConversation(p,!0),d(p);return}w(k.currentMessageId,p,"complete"),e.completeMessageWithSave(k.currentMessageId,p),e.endSession(p),e.endConversationStreaming(p),s(p);const ae=await v(p),G=ae?.hasWorktree&&ae.worktreePath?$fetch("/api/chat/worktree-commit",{method:"POST",body:{worktreePath:ae.worktreePath,conversationId:p,previousBranch:ae.worktreeBranch}}).then($=>ae.previewBranch&&ae.worktreePath?$fetch("/api/chat/preview-sync",{method:"POST",body:{previewBranch:ae.previewBranch,worktreePath:ae.worktreePath}}).then(I=>{if(!I.success)throw new Error(I.error||"Unknown preview sync failure");return $}):$).then(async $=>{if($?.success&&$.currentBranch!==ae.worktreeBranch){const I=ae.worktreeBranch||"unknown";e.updateWorktreeBranch(p,$.currentBranch);const L=await e.syncConversationFeatureFromBranch(p),K=$.deletedPreviousBranch?` and deleted \`${I}\``:"",ve=L?` and linked to feature \`${L}\``:"";ee(k.currentMessageId,`
76
+
77
+ > **Branch changed**: AI switched from \`${I}\` to \`${$.currentBranch}\`${K}${ve}
78
+
79
+ `,p)}else $?.success&&ae.worktreeBranch&&e.updateWorktreeBranch(p,ae.worktreeBranch);return e.saveConversation(p,!1),$}).catch($=>{console.warn("[useChatStream] Auto-commit/preview-sync failed:",$)}):Promise.resolve(),R=nn.get(p);if(R&&R.queue.length>0){const $=R.queue.shift(),I=R.featureId;G.then(()=>{setTimeout(()=>{ne(p,I,$)},1500)}),R.queue.length===0&&nn.delete(p)}e.clearPendingPermission(p),e.saveConversation(p,!0),k.activeTools.clear(),d(p),nn.delete(p);return}if(H.type==="pong")return;if(H.type==="session_reset"){console.warn(`[useChatStream] Session reset for ${p}:`,H.reason),e.setProviderSessionId("",p),ee(k.currentMessageId,`
80
+
81
+ > **Session Reset**: Previous session could not be resumed. Retrying with a fresh session...
82
+
83
+ `,p);return}if(H.type==="worktree_recovered"){console.log(`[useChatStream] Worktree recovered for ${p}`),ee(k.currentMessageId,`
84
+
85
+ > **Worktree recovered**: The work directory was restored after a system restart.
86
+
87
+ `,p);return}if(H.type==="context_reset"){console.log(`[useChatStream] Context reset confirmed for ${p}`);return}if(H.type==="aborted"){console.log(`[useChatStream] Abort confirmed for ${p}`);return}if(H.type==="permission_request"){c(k),e.endConversationStreaming(p);const W=Pr(H.description||"",H.tool||"Permission");e.setPendingPermission(W,p);let ae=`
88
+
89
+ **Permission Required**: ${W.tool}`;W.filePath&&(ae+=` - ${W.filePath}`),ee(k.currentMessageId,ae+`
90
+ `,p);return}if(H.type==="permission_prompt"&&H.text){c(k),e.endConversationStreaming(p);const W=Pr(H.text,"Permission");e.setPendingPermission(W,p);const ae=`
91
+
92
+ **${W.tool}**: ${W.filePath||W.command||W.description}
93
+ `;ee(k.currentMessageId,ae,p);return}H.type==="provider_json"&&H.data&&V(H.data,p)}catch(H){console.error(`[useChatStream] Failed to parse WebSocket message for ${p}:`,H,"Raw data:",M?.slice(0,200)),w(k.currentMessageId,p,"error"),e.updateMessage(k.currentMessageId,{status:"error"},p),e.setSessionError(`Failed to parse server response: ${H instanceof Error?H.message:"Invalid JSON"}`,p),e.endSession(p),e.endConversationStreaming(p),fe(p),e.saveConversation(p,!0),d(p)}}}function A(M,p){e.initContentBlocks(M,p)}function ee(M,p,k){A(M,k);const H={id:pn(),type:"text",text:p};e.appendContentBlockWithSave(M,H,k)}function te(M,p){return!!e.conversations.find(W=>W.id===p)?.messages.find(W=>W.id===M)?.contentBlocks?.some(W=>W.type==="session_init")}function V(M,p){const k=lt.get(p);if(!k)return;e.pushDebugEvent({direction:"in",channel:"provider",eventType:M.type,payload:M},p);const H=typeof M.type=="string"?M.type.toLowerCase():"",W="subtype"in M&&typeof M.subtype=="string"?String(M.subtype).toLowerCase():"",G=H.includes("error")||H.includes("failed")||W.startsWith("error")?null:sh(M);if(G&&e.setProviderSessionId(G,p),M.type==="permission_request"){const $=M.permission,I={tool:$.tool,filePath:$.file_path||$.path,command:$.command,description:$.description,input:$};e.setPendingPermission(I,p);let L=`
94
+
95
+ **Permission Required**: ${$.tool}`;I.filePath?L+=` - ${I.filePath}`:I.command&&(L+=` - \`${I.command}\``),ee(k.currentMessageId,L+`
96
+ `,p);return}if(M.type==="user"){const R=M,$=R.message?.content||R.content;if($){for(const I of $)if(I.type==="tool_result"&&I.is_error&&I.content){const L=I.content;if(L.includes("requested permissions")||L.includes("haven't granted")){const K=Pr(L,"Permission");e.setPendingPermission(K,p);let ve=`
97
+
98
+ **Permission Required**: ${K.tool}`;K.filePath?ve+=` - ${K.filePath}`:K.command&&(ve+=` - \`${K.command}\``),ee(k.currentMessageId,ve+`
99
+ `,p);return}}}}if(M.type==="system"){const R=M;if(R.subtype==="init"&&R.model){A(k.currentMessageId,p);const $={id:pn(),type:"session_init",model:R.model,tools:R.tools||[],permissionMode:R.permissionMode||"",cwd:R.cwd||""};e.appendContentBlockWithSave(k.currentMessageId,$,p)}return}if(M.type==="stream_event"){const $=M.event;if($.type==="content_block_start"&&$.content_block){const I=$.content_block;if(I.type==="text"){A(k.currentMessageId,p);const L=pn(),K={id:L,type:"text",text:I.text||""};e.appendContentBlockWithSave(k.currentMessageId,K,p),k.currentTextBlockId=L}if(I.type==="thinking"){A(k.currentMessageId,p);const L=pn(),K={id:L,type:"thinking",thinking:I.thinking||""};e.appendContentBlockWithSave(k.currentMessageId,K,p),k.currentThinkingBlockId=L}if((I.type==="tool_use"||I.type==="server_tool_use")&&I.id&&I.name){A(k.currentMessageId,p);const L=pn(),K={id:L,type:"tool_use",toolUseId:I.id,name:I.name,input:{},inputSummary:"",status:"running"};e.appendContentBlockWithSave(k.currentMessageId,K,p),k.activeTools.set($.index??0,{blockId:L,toolUseId:I.id,name:I.name,inputJson:""})}}if($.type==="content_block_delta"&&$.delta&&($.delta.text&&k.currentTextBlockId&&(e.updateBlockWithSave(k.currentMessageId,k.currentTextBlockId,I=>{I.type==="text"&&(I.text+=$.delta.text)},p,{syncContent:!1}),e.appendToMessage(k.currentMessageId,$.delta.text,p)),$.delta.thinking&&k.currentThinkingBlockId&&e.updateBlockWithSave(k.currentMessageId,k.currentThinkingBlockId,I=>{I.type==="thinking"&&(I.thinking+=$.delta.thinking)},p,{syncContent:!1}),$.delta.partial_json&&$.index!==void 0)){const I=k.activeTools.get($.index);I&&(I.inputJson+=$.delta.partial_json)}if($.type==="content_block_stop"&&(k.currentTextBlockId&&(k.currentTextBlockId=null),k.currentThinkingBlockId&&(k.currentThinkingBlockId=null),$.index!==void 0)){const I=k.activeTools.get($.index);if(I){let L={};try{L=JSON.parse(I.inputJson)}catch{}if(I.name==="ExitPlanMode"){const K={allowedPrompts:L.allowedPrompts};e.setPendingPlanApproval(K,p)}e.updateBlockWithSave(k.currentMessageId,I.blockId,K=>{if(K.type==="tool_use"){const ve=K;ve.input=L,ve.inputSummary=$s(L),ve.status="pending"}},p)}}return}if(M.type==="tool_result"){const R=M;A(k.currentMessageId,p);const $=e.findToolUseBlock(k.currentMessageId,R.tool_use_id,p);$&&$.type==="tool_use"&&e.updateBlockById(k.currentMessageId,$.id,L=>{L.type==="tool_use"&&(L.status=R.is_error?"error":"complete")},p);const I={id:pn(),type:"tool_result",toolUseId:R.tool_use_id,content:R.content||"",isError:!!R.is_error};e.appendContentBlockWithSave(k.currentMessageId,I,p),R.is_error&&console.warn("[useChatStream] Tool error:",R.content?.slice(0,500));return}if(M.type==="result"){const R=M;if((R.is_error||R.subtype==="error_max_turns"||R.subtype==="error_during_execution")&&(e.updateMessage(k.currentMessageId,{status:"error"},p),fe(p),R.subtype==="error_max_turns"?e.setSessionError("Maximum conversation turns reached. Please start a new conversation.",p):R.subtype==="error_during_execution"&&e.setSessionError("An error occurred during provider execution.",p),console.error("[useChatStream] Result error:",R.subtype)),R.subtype==="success"&&R.usage){A(k.currentMessageId,p);const $={id:pn(),type:"result_summary",totalCostUsd:R.total_cost_usd??0,durationMs:R.duration_ms??0,numTurns:R.num_turns??0,usage:{inputTokens:R.usage.input_tokens??0,outputTokens:R.usage.output_tokens??0,cacheCreationInputTokens:R.usage.cache_creation_input_tokens??0,cacheReadInputTokens:R.usage.cache_read_input_tokens??0}};e.appendContentBlockWithSave(k.currentMessageId,$,p)}}}async function re(M,p,k,H){if(typeof window>"u")return;const W=$m();try{const ae=await g(k),G=lt.get(k);G&&(G.currentMessageId=p,G.activeTools.clear(),G.currentTextBlockId=null,G.currentThinkingBlockId=null,f(G)),Cm(M)&&e.setProviderSessionId("",k);const $=e.getProviderSessionId(k),I=e.conversations.find(xe=>xe.id===k),L=I?.providerId||n.providerSelection.providerId||Wo,K=I?.providerModelKey||n.providerSelection.modelKey||Vo;I&&(!I.providerId||!I.providerModelKey)&&(e.setConversationProviderSelection(k,L,K),e.saveConversation(k,!0));const ve={type:"chat",message:M,attachments:H?.attachments,requestId:W,sessionId:$||void 0,permissionMode:e.permissionMode,conversationId:k,cwd:H?.cwd,worktreeBranch:H?.worktreeBranch,featureId:H?.featureId,providerId:L,providerModelKey:K};if(L==="codex"&&!te(p,k)){A(p,k);const xe=e.permissionMode==="bypass"||e.permissionMode==="auto",qe={id:pn(),type:"session_init",model:K,tools:Array.from({length:32},(Ye,Y)=>`tool-${Y+1}`),permissionMode:xe?"bypassPermissions":e.permissionMode,cwd:H?.cwd||I?.cwd||""};e.appendContentBlockWithSave(p,qe,k)}e.pushDebugEvent({direction:"out",channel:"ws",eventType:"chat",payload:ve},k),ae.send(JSON.stringify(ve))}catch(ae){e.updateMessage(p,{status:"error"},k),e.setSessionError(ae.message||"Connection failed",k),e.endSession(k),e.endConversationStreaming(k),e.saveConversation(k,!0),d(k)}}function ie(M,p){const k=p??e.activeConversationId;if(!k)return;const H=lt.get(k);if(!H||H.ws.readyState!==WebSocket.OPEN)return;const W={type:"permission_response",allow:M};e.pushDebugEvent({direction:"out",channel:"ws",eventType:"permission_response",payload:W},k),H.ws.send(JSON.stringify(W)),M&&(e.startConversationStreaming(k),f(H));const ae=M?"Allowed":"Denied";ee(H.currentMessageId,`${ae}
100
+ `,k),e.clearPendingPermission(k)}function ue(M,p,k){nn.set(p,{featureId:M,queue:[...k]})}function fe(M){M?nn.delete(M):nn.clear()}async function ne(M,p,k){e.activeConversationId!==M&&e.selectConversation(M);let H;if(k.startsWith("skill:")){const R=k.replace("skill:","");try{H=(await $fetch(`/api/skills/${R}/prompt`,{method:"POST",body:{featureId:p}})).prompt}catch($){console.error(`[useChatStream] Failed to render skill prompt for ${R}:`,$);return}}else H=`/speckit.${k} ${p}`;e.addUserMessage(H,M),e.saveConversation(M,!0);const W=e.conversations.find(R=>R.id===M),ae=e.addAssistantMessage(M);e.startSession(Ho(),M),e.startConversationStreaming(M);const G=Rr(W);await re(H,ae.id,M,G)}function Z(M){const p=M??e.activeConversationId;if(!p)return;const k=lt.get(p);if(k){if(k.ws.readyState===WebSocket.OPEN){const H={type:"abort"};e.pushDebugEvent({direction:"out",channel:"ws",eventType:"abort",payload:H},p),k.ws.send(JSON.stringify(H)),k.ws.close()}k.currentMessageId&&(w(k.currentMessageId,p,"error"),e.updateMessage(k.currentMessageId,{status:"stopped"},p),e.endSession(p),e.saveConversation(p,!0)),lt.delete(p)}e.endConversationStreaming(p),e.clearPendingPermission(p),fe(p)}function j(M){const p=lt.get(M);p&&(c(p),p.ws.close(),lt.delete(M)),nn.delete(M)}function F(){for(const[M,p]of lt)c(p),p.ws.close(),lt.delete(M);nn.clear()}async function B(M){const p=M??e.activeConversationId;if(!p)return;e.clearPendingPlanApproval(p),e.setPermissionMode("auto");const k="Approved. Proceed with the implementation.";e.addUserMessage(k,p),e.saveConversation(p,!0);const H=e.addAssistantMessage(p);e.startSession(Ho(),p),e.startConversationStreaming(p);const W=e.conversations.find(G=>G.id===p),ae=Rr(W,!0);await re(k,H.id,p,ae)}function X(M){const p=M??e.activeConversationId;p&&e.clearPendingPlanApproval(p)}return $t(()=>{F()}),{sendMessage:re,sendPermissionResponse:ie,approvePlan:B,rejectPlan:X,abort:Z,disconnect:F,disconnectConversation:j,enableCascade:ue,disableCascade:fe,resetContext:T}}const uh={class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},dh={class:"px-4 py-3 border-b border-retro-border flex items-center justify-between"},fh=["disabled"],mh={class:"px-4 py-4 space-y-3"},hh={class:"relative"},ph=["disabled"],vh={key:0,value:""},gh=["value"],xh={key:0,class:"text-xs font-mono text-retro-red"},bh={key:1,class:"text-xs font-mono text-retro-muted"},yh={class:"px-4 py-3 border-t border-retro-border flex items-center gap-2 justify-end"},wh=["disabled"],kh=["disabled"],Gr=Me({__name:"NewConversationModal",props:{show:{type:Boolean},creating:{type:Boolean}},emits:["close","create"],setup(e,{emit:n}){const t=e,a=n,s=C([]),l=C(""),c=C(!1),f=C(""),m=U(()=>!c.value&&!t.creating&&l.value.length>0&&s.value.length>0);async function d(){c.value=!0,f.value="";try{const T=await $fetch("/api/git/branches"),g=T.branches.filter(h=>!h.isRemote&&!h.name.startsWith("br/")&&!h.name.startsWith("br/p-")).map(h=>h.name);if(s.value=g,!g.length){l.value="",f.value="No local branches available for chat creation.";return}const v=(T.current&&g.includes(T.current)?T.current:"")||(g.includes("main")?"main":"")||(g.includes("master")?"master":"")||g[0];l.value=v}catch(T){s.value=[],l.value="",f.value=T instanceof Error?T.message:"Failed to load branches"}finally{c.value=!1}}De(()=>t.show,T=>{T&&d()});function w(){m.value&&a("create",l.value)}return(T,g)=>(i(),ce(Jt,{to:"body"},[Q(Sn,{"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:g[3]||(g[3]=ft(v=>a("close"),["self"]))},[r("div",uh,[r("div",dh,[g[4]||(g[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:g[0]||(g[0]=v=>a("close"))},[Q(o(vt),{class:"w-4 h-4"})],8,fh)]),r("div",mh,[g[5]||(g[5]=r("label",{class:"block text-xs font-mono text-retro-muted"},"Base Branch",-1)),r("div",hh,[Pe(r("select",{"onUpdate:modelValue":g[1]||(g[1]=v=>l.value=v),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",vh,"Loading branches...")):N("",!0),(i(!0),u(me,null,Ee(s.value,v=>(i(),u("option",{key:v,value:v},S(v),9,gh))),128))],8,ph),[[Tn,l.value]]),Q(o(Xr),{class:"absolute right-2 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted pointer-events-none"})]),f.value?(i(),u("p",xh,S(f.value),1)):(i(),u("p",bh," The conversation worktree will be created from the selected branch. "))]),r("div",yh,[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:g[2]||(g[2]=v=>a("close"))}," Cancel ",8,wh),r("button",{type:"button",disabled:!m.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:w},S(e.creating?"Creating...":"Create"),9,kh)])])])):N("",!0)]),_:1})]))}}),Ch={class:"h-full flex flex-col bg-retro-black"},$h={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border"},Sh={class:"flex items-center gap-2 min-w-0"},_h={class:"flex-shrink-0 px-3 pt-3"},Th={class:"relative"},Mh={class:"flex-1 overflow-y-auto p-3"},Ah={class:"space-y-2"},Bh={key:0,class:"flex items-center justify-center py-12"},Eh={key:1,class:"flex flex-col items-center justify-center py-12 text-center"},Rh={key:2,class:"flex flex-col items-center justify-center py-12 text-center"},Ph=Me({__name:"FeaturesPanel",setup(e){const n=gt(),t=Qn(),{sendMessage:a,enableCascade:s}=po(),l=Dn(),c=C("features"),f=C(null),m=C(null),d=C([]),w=C([]),T=C(!1),g=C(!1),v=C(null),h=C(!1),P=C(!1),q=C(null),A=C(""),ee=C("");let te=null;De(A,I=>{te&&clearTimeout(te),te=setTimeout(()=>{ee.value=I},300)});const V=U(()=>{const I=ee.value.trim().toLowerCase();return I?d.value.filter(L=>L.name.toLowerCase().includes(I)||L.id.toLowerCase().includes(I)):d.value}),re=C({}),ie=U(()=>{const I=n.activeConversation;if(!I)return null;if(I.featureId)return I.featureId;const L=I.worktreeBranch?.trim();return L&&d.value.some(K=>K.id===L)?L:null});De(()=>n.activeConversationId,()=>{const I=ie.value;I&&vn(()=>{const L=re.value[I];L&&L.scrollIntoView({behavior:"auto",block:"nearest"})})});async function ue(){T.value=!0;try{const I=await $fetch("/api/specs/features");d.value=I.features}catch{l.error("Failed to load features"),d.value=[]}finally{T.value=!1}}async function fe(){try{const I=await $fetch("/api/skills");w.value=I.skills}catch{w.value=[]}}ut(()=>{ue(),fe()});function ne(I){f.value=I,m.value=null,c.value="files",t.setSelectedFeatureId(I);const L=d.value.find(K=>K.id===I);L&&(v.value=L,g.value=!0)}function Z(){g.value=!1,v.value=null}const j={plan:["tasks","implement"],tasks:["implement"],implement:[],clarify:[],analyze:[]},F={analyze:["skill:better-spec"]};async function B(I,L){if(I.startsWith("skill:")){const K=I.replace("skill:","");return(await $fetch(`/api/skills/${K}/prompt`,{method:"POST",body:{featureId:L}})).prompt}return`/speckit.${I} ${L}`}function X(I,L){if(L)return null;const K=n.findConversationByFeature(I);return K&&!n.isConversationStreaming(K.id)?(n.selectConversation(K.id),K.id):null}async function M(I,L,K){const ve=await n.createConversation({featureId:I,baseBranch:K});if(!ve)throw new Error("Failed to create conversation");return n.renameConversation(ve,L),n.selectConversation(ve),ve}async function p(I,L){n.addUserMessage(L,I),n.saveConversation(I,!0);const K=n.conversations.find(Te=>Te.id===I),ve=n.addAssistantMessage(I);n.startSession(`session-${Date.now()}`,I),n.startConversationStreaming(I);const xe={};K?.worktreePath&&(xe.cwd=K.worktreePath,xe.worktreeBranch=K.worktreeBranch),K?.featureId&&(xe.featureId=K.featureId),await a(L,ve.id,I,Object.keys(xe).length>0?xe:void 0)}async function k(I,L,K){const ve=F[L];let xe;if(ve&&ve.length>0){const Te=[...ve.slice(1),L,...j[L]||[]];s(I,K,Te);const qe=ve[0];try{xe=await B(qe,I)}catch(Ye){l.error(Ye instanceof Error?Ye.message:"Failed to resolve prerequisite step");return}}else{const Te=j[L]||[];Te.length>0&&s(I,K,Te),xe=`/speckit.${L} ${I}`}await p(K,xe)}async function H(I,L,K){const ve=I.shiftKey,xe=X(L,ve);if(xe){try{await k(L,K,xe)}catch(Te){l.error(Te instanceof Error?Te.message:"Failed to run cascade action")}return}q.value={type:"cascade",featureId:L,command:K,title:`${K}: ${L}`},h.value=!0}async function W(I,L){q.value={type:"open-chat",featureId:L,title:`spec: ${L}`},h.value=!0}async function ae(I,L,K){let ve;try{ve=await $fetch(`/api/skills/${L}/prompt`,{method:"POST",body:{featureId:I}})}catch(xe){throw new Error(xe instanceof Error?xe.message:"Failed to render skill prompt")}await p(K,ve.prompt)}async function G(I,L,K){const ve=I.shiftKey,xe=X(L,ve);if(xe){try{await ae(L,K,xe)}catch(Te){l.error(Te instanceof Error?Te.message:"Failed to run skill")}return}q.value={type:"skill",featureId:L,skillId:K,title:`skill: ${K} — ${L}`},h.value=!0}function R(){h.value=!1,q.value=null}async function $(I){if(q.value){P.value=!0;try{const L=q.value,K=await M(L.featureId,L.title,I);L.type==="cascade"?await k(L.featureId,L.command,K):L.type==="skill"&&await ae(L.featureId,L.skillId,K),h.value=!1,q.value=null}catch(L){l.error(L instanceof Error?L.message:"Failed to create conversation")}finally{P.value=!1}}}return(I,L)=>{const K=_m,ve=Om,xe=oh;return i(),u("div",Ch,[r("div",$h,[r("div",Sh,[Q(K)]),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:ue},[Q(o(gn),{class:ge(["h-4 w-4",{"animate-spin":o(T)}])},null,8,["class"])])]),r("div",_h,[r("div",Th,[Q(o(Zn),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-retro-subtle"}),Pe(r("input",{"onUpdate:modelValue":L[0]||(L[0]=Te=>He(A)?A.value=Te: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),[[pt,o(A)]])])]),r("div",Mh,[r("div",Ah,[(i(!0),u(me,null,Ee(o(V),Te=>(i(),u("div",{key:Te.id,ref_for:!0,ref:qe=>{o(re)[Te.id]=qe}},[Q(ve,{feature:Te,skills:o(w),"is-active":o(ie)===Te.id,onSelect:ne,onCascade:H,onOpenChat:W,onSkill:G},null,8,["feature","skills","is-active"])]))),128))]),o(T)&&o(d).length===0?(i(),u("div",Bh,[...L[1]||(L[1]=[r("span",{class:"text-sm font-mono text-retro-muted animate-pulse"},"Loading features...",-1)])])):N("",!0),!o(T)&&o(d).length>0&&o(V).length===0?(i(),u("div",Eh,[Q(o(Zn),{class:"h-10 w-10 text-retro-subtle mb-3"}),L[2]||(L[2]=r("p",{class:"text-sm font-mono text-retro-muted"},"No matching features",-1)),L[3]||(L[3]=r("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," Try a different search term ",-1))])):N("",!0),!o(T)&&o(d).length===0?(i(),u("div",Rh,[Q(o(ra),{class:"h-10 w-10 text-retro-subtle mb-3"}),L[4]||(L[4]=r("p",{class:"text-sm font-mono text-retro-muted"},"No features found",-1)),L[5]||(L[5]=r("p",{class:"mt-1 text-xs font-mono text-retro-subtle"}," Create a feature in specs/ to get started ",-1))])):N("",!0)]),o(g)&&o(v)?(i(),ce(xe,{key:0,feature:o(v),onClose:Z},null,8,["feature"])):N("",!0),Q(Gr,{show:o(h),creating:o(P),onClose:R,onCreate:$},null,8,["show","creating"])])}}}),Dh={class:"flex items-start justify-between gap-2"},Ih={class:"flex-1 min-w-0"},Lh={key:1,class:"flex items-center gap-2"},Nh={key:0,class:"flex-shrink-0 relative"},Fh={class:"text-sm font-mono text-retro-text truncate"},Hh={key:2,class:"text-xs font-mono text-retro-green bg-retro-green/10 px-1.5 py-0.5 rounded flex-shrink-0"},Oh={key:5,class:"text-xs font-mono text-retro-yellow bg-retro-yellow/10 px-1.5 py-0.5 rounded flex-shrink-0"},Uh={key:6,class:"text-xs font-mono text-retro-cyan bg-retro-cyan/10 px-1.5 py-0.5 rounded flex-shrink-0"},jh=["title"],zh={class:"text-xs text-retro-muted mt-1 truncate pl-6"},Vh={class:"text-xs text-retro-muted/60 mt-1 pl-6"},Wh={class:"truncate"},Gh={class:"truncate"},qh={class:"truncate"},Zh=Me({__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=C(!1),l=C("");function c(){l.value=t.conversation.title,s.value=!0}function f(){const v=l.value.trim();v&&v!==t.conversation.title&&a("rename",v),s.value=!1}function m(){s.value=!1}const d=Dn();async function w(v){try{await navigator.clipboard.writeText(v),d.success("Copied to clipboard",1500)}catch{d.error("Failed to copy")}}const T=U(()=>{const v=t.conversation.messages;if(!v.length)return"No messages";const h=v[v.length-1],P=h.content.slice(0,60);return P.length<h.content.length?P+"...":P}),g=U(()=>{const v=new Date(t.conversation.updatedAt),P=new Date().getTime()-v.getTime(),q=Math.floor(P/(1e3*60*60*24));return q===0?v.toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"}):q===1?"Yesterday":q<7?`${q} days ago`:v.toLocaleDateString()});return(v,h)=>(i(),u("div",{class:ge(["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:h[8]||(h[8]=P=>a("select"))},[r("div",Dh,[r("div",Ih,[s.value?(i(),u("div",{key:0,class:"flex gap-2",onClick:h[1]||(h[1]=ft(()=>{},["stop"]))},[Pe(r("input",{"onUpdate:modelValue":h[0]||(h[0]=P=>l.value=P),onKeyup:[sn(f,["enter"]),sn(m,["escape"])],onBlur:f,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),[[pt,l.value]])])):(i(),u("div",Lh,[e.isStreaming?(i(),u("div",Nh,[...h[9]||(h[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(),ce(o(Qo),{key:1,class:"w-4 h-4 text-retro-muted flex-shrink-0 -translate-y-px"})),r("h3",Fh,S(e.conversation.title),1),e.conversation.finalized?(i(),u("span",Hh," finalized ")):e.isPreviewing?(i(),u("span",{key:3,class:ge(["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)):N("",!0),e.conversation.autoMode&&e.autoModeTask?(i(),u("span",{key:4,class:ge(["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(me,{key:0},[_e(S(e.autoModeTask.currentStep),1)],64)):e.autoModeTask.state==="queued"?(i(),u(me,{key:1},[_e("queued")],64)):e.autoModeTask.state==="completed"?(i(),u(me,{key:2},[_e("done")],64)):e.autoModeTask.state==="failed"?(i(),u(me,{key:3},[_e("failed")],64)):e.autoModeTask.state==="skipped"?(i(),u(me,{key:4},[_e("skipped")],64)):(i(),u(me,{key:5},[_e("auto")],64))],2)):e.conversation.autoMode?(i(),u("span",Oh," auto ")):N("",!0),e.isStreaming?(i(),u("span",Uh," streaming ")):N("",!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},S(e.autoModeTask.error),9,jh)):N("",!0),r("p",zh,S(T.value),1),r("p",Vh,S(g.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:h[5]||(h[5]=ft(()=>{},["stop"]))},[e.conversation.baseBranch?(i(),u("button",{key:0,onClick:h[2]||(h[2]=P=>w(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"},[Q(o(Nr),{class:"w-3 h-3 flex-shrink-0"}),r("span",Wh,"base: "+S(e.conversation.baseBranch),1)])):N("",!0),r("button",{onClick:h[3]||(h[3]=P=>w(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"},[Q(o(Nr),{class:"w-3 h-3 flex-shrink-0"}),r("span",Gh,S(e.conversation.worktreeBranch),1)]),e.conversation.worktreePath?(i(),u("button",{key:1,onClick:h[4]||(h[4]=P=>w(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"},[Q(o(Fr),{class:"w-3 h-3 flex-shrink-0"}),r("span",qh,S(e.conversation.worktreePath),1)])):N("",!0)])):N("",!0)]),r("div",{class:"flex gap-1 flex-shrink-0",onClick:h[7]||(h[7]=ft(()=>{},["stop"]))},[r("button",{onClick:c,class:"p-1 hover:bg-retro-panel rounded transition-colors",title:"Rename conversation"},[Q(o(ss),{class:"w-4 h-4 text-retro-muted hover:text-retro-cyan"})]),r("button",{onClick:h[6]||(h[6]=P=>a("archive")),class:"p-1 hover:bg-retro-cyan/20 rounded transition-colors",title:"Archive conversation"},[Q(o(Lr),{class:"w-4 h-4 text-retro-muted hover:text-retro-cyan"})])])])],2))}}),Kh={class:"h-full flex flex-col bg-retro-black"},Yh={class:"flex-shrink-0 px-3 py-2 border-b border-retro-border space-y-2"},Xh={class:"flex items-center justify-between gap-2"},Qh={class:"flex items-center gap-1"},Jh={class:"inline-flex items-center gap-1"},ep={class:"inline-flex items-center gap-1"},tp={class:"relative"},np=["placeholder"],rp={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"},op={class:"text-retro-yellow font-mono"},sp={class:"flex-1 overflow-y-auto p-2"},ap={key:0,class:"space-y-1"},ip={key:1,class:"text-center py-6 text-retro-muted"},lp={class:"font-mono text-xs"},cp={key:1,class:"text-center py-8 text-retro-muted"},up={key:0,class:"space-y-2"},dp={class:"flex items-start justify-between gap-2"},fp={class:"min-w-0"},mp={class:"text-sm font-mono text-retro-text truncate"},hp={class:"text-xs text-retro-muted mt-1 truncate"},pp={class:"text-xs text-retro-muted/70 mt-1"},vp={class:"text-xs text-retro-muted/70"},gp={class:"flex items-center gap-1 flex-shrink-0"},xp=["onClick"],bp=["onClick"],yp={key:1,class:"text-center py-6 text-retro-muted"},wp={class:"font-mono text-xs"},kp={key:1,class:"text-center py-8 text-retro-muted"},Cp=Me({__name:"ConversationsPanel",setup(e){const n=gt(),t=Ss(),a=Dn(),s=U(()=>{const G=new Map;for(const R of t.tasks)G.set(R.featureId,R);return G}),l=U(()=>{const G=new Map;for(const R of t.tasks)G.set(R.featureId,`${R.state}|${R.currentStep||""}|${R.error||""}`);return G});function c(G){if(G)return s.value.get(G)}function f(G){return G&&l.value.get(G)||""}const m=C(""),d=C(""),w=C(!1),T=C(!1),g=C(!1),v=C(!1),h=C(null);let P=null;De(m,G=>{P&&clearTimeout(P),P=setTimeout(()=>{d.value=G},180)},{immediate:!0}),$t(()=>{P&&(clearTimeout(P),P=null)});const q=new Map,A=new Map;De(()=>n.sortedConversations.map(G=>G.id),G=>{const R=new Set(G);for(const $ of q.keys())R.has($)||q.delete($)},{immediate:!0}),De(()=>n.sortedArchivedConversations.map(G=>G.id),G=>{const R=new Set(G);for(const $ of A.keys())R.has($)||A.delete($)},{immediate:!0});function ee(G){const R=G.messages[G.messages.length-1];return[G.updatedAt,G.title,G.messages.length,R?.id||"",R?.content?.length||0].join("|")}function te(G){const R=G.messages[G.messages.length-1];return[G.updatedAt,G.archivedAt,G.title,G.messages.length,R?.id||"",R?.content?.length||0].join("|")}function V(G){const R=ee(G),$=q.get(G.id);if($&&$.signature===R)return $.text;const I=[G.title,...G.messages.map(L=>L.content||"")].join(`
101
+ `).toLowerCase();return q.set(G.id,{signature:R,text:I}),I}function re(G){const R=te(G),$=A.get(G.id);if($&&$.signature===R)return $.text;const I=[G.title,...G.messages.map(L=>L.content||"")].join(`
102
+ `).toLowerCase();return A.set(G.id,{signature:R,text:I}),I}const ie=U(()=>n.conversationViewMode==="archive"),ue=U(()=>{const G=n.sortedConversations;if(!d.value.trim())return G;const R=d.value.toLowerCase().trim();return G.filter($=>V($).includes(R))}),fe=U(()=>{const G=n.sortedArchivedConversations;if(!d.value.trim())return G;const R=d.value.toLowerCase().trim();return G.filter($=>re($).includes(R))}),ne=U(()=>n.previewingConversationId);async function Z(){if(n.checkStorageLimits().atLimit){a.error("Delete or archive a conversation first (limit: 100).");return}w.value=!0}async function j(G){T.value=!0;try{if(!await n.createConversation({baseBranch:G})){a.error("Failed to create conversation");return}w.value=!1}catch(R){a.error(R instanceof Error?R.message:"Failed to create conversation")}finally{T.value=!1}}function F(G){n.selectConversation(G),n.setConversationViewMode("active")}async function B(G){const R=await n.archiveConversation(G);if(!R.success){a.error(R.error||"Failed to archive conversation");return}a.success("Conversation archived")}async function X(G){h.value=G,g.value=!0}function M(){g.value=!1,h.value=null}async function p(G){if(h.value){v.value=!0;try{const R=await n.restoreArchivedConversation(h.value,G);if(!R.success){a.error(R.error||"Failed to restore archived conversation");return}a.success("Archived conversation restored"),g.value=!1,h.value=null}finally{v.value=!1}}}async function k(G){const R=await n.deleteArchivedConversation(G);if(!R.success){a.error(R.error||"Failed to delete archived conversation");return}a.success("Archived conversation deleted")}function H(G,R){n.renameConversation(G,R)}function W(G){return new Date(G).toLocaleString()}function ae(G){if(!G.length)return"No messages";const $=(G[G.length-1].content||"").trim();return $?$.length>80?`${$.slice(0,80)}...`:$:"No messages"}return(G,R)=>(i(),u("div",Kh,[r("div",Yh,[r("div",Xh,[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"},[Q(o(pr),{class:"w-3.5 h-3.5"}),R[8]||(R[8]=_e(" New ",-1))]),r("div",Qh,[r("button",{onClick:R[0]||(R[0]=$=>o(n).setConversationViewMode("active")),class:ge(["px-2 py-1 text-xs font-mono rounded border transition-colors",ie.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",Jh,[Q(o(Ks),{class:"w-3.5 h-3.5"}),R[9]||(R[9]=_e(" Active ",-1))])],2),r("button",{onClick:R[1]||(R[1]=$=>o(n).setConversationViewMode("archive")),class:ge(["px-2 py-1 text-xs font-mono rounded border transition-colors",ie.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",ep,[Q(o(Lr),{class:"w-3.5 h-3.5"}),R[10]||(R[10]=_e(" Archive ",-1))])],2)])]),r("div",tp,[Q(o(Zn),{class:"absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-retro-muted"}),Pe(r("input",{"onUpdate:modelValue":R[2]||(R[2]=$=>m.value=$),type:"text",placeholder:ie.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,np),[[pt,m.value]])])]),o(n).isNearStorageLimit?(i(),u("div",rp,[Q(o($n),{class:"w-4 h-4 text-retro-yellow flex-shrink-0"}),r("p",op,S(o(n).conversationCount)+" active conversations. Limit is 100. ",1)])):N("",!0),r("div",sp,[ie.value?(i(),u(me,{key:1},[o(n).hasArchivedConversations?(i(),u("div",up,[fe.value.length>0?(i(!0),u(me,{key:0},Ee(fe.value,($,I,L,K)=>{const ve=[$.id,$.title,$.updatedAt,$.archivedAt,$.messages.length];if(K&&K.key===$.id&&go(K,ve))return K;const xe=(i(),u("div",{key:$.id,onClick:Te=>X($.id),onKeydown:[sn(ft(Te=>X($.id),["prevent"]),["enter"]),sn(ft(Te=>X($.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",dp,[r("div",fp,[r("h3",mp,S($.title),1),r("p",hp,S(ae($.messages)),1),r("p",pp," Archived: "+S(W($.archivedAt)),1),r("p",vp," Updated: "+S(W($.updatedAt)),1)]),r("div",gp,[r("button",{onClick:ft(Te=>X($.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"},[Q(o(Lr),{class:"w-3.5 h-3.5"}),R[12]||(R[12]=_e(" Restore ",-1))],8,xp),r("button",{onClick:ft(Te=>k($.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"},[Q(o(an),{class:"w-3.5 h-3.5"}),R[13]||(R[13]=_e(" Delete ",-1))],8,bp)])])],40,["onClick","onKeydown"]));return xe.memo=ve,xe},R,5),128)):(i(),u("div",yp,[r("p",wp,'No archived results for "'+S(m.value)+'"',1)]))])):(i(),u("div",kp,[...R[14]||(R[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(me,{key:0},[o(n).hasConversations?(i(),u("div",ap,[ue.value.length>0?(i(!0),u(me,{key:0},Ee(ue.value,($,I,L,K)=>{const ve=[$.id,$.title,$.updatedAt,$.messages.length,$.finalized,$.id===o(n).activeConversationId,o(n).isConversationStreaming($.id),ne.value===$.id,f($.featureId)];if(K&&K.key===$.id&&go(K,ve))return K;const xe=(i(),u("div",{key:$.id},[Q(Zh,{conversation:$,"is-active":$.id===o(n).activeConversationId,"is-streaming":o(n).isConversationStreaming($.id),"is-previewing":ne.value===$.id,"auto-mode-task":$.autoMode?c($.featureId):void 0,onSelect:Te=>F($.id),onArchive:Te=>B($.id),onRename:Te=>H($.id,Te)},null,8,["conversation","is-active","is-streaming","is-previewing","auto-mode-task","onSelect","onArchive","onRename"])]));return xe.memo=ve,xe},R,3),128)):(i(),u("div",ip,[r("p",lp,'No results for "'+S(m.value)+'"',1)]))])):(i(),u("div",cp,[...R[11]||(R[11]=[r("p",{class:"font-mono text-sm"},"No conversations",-1),r("p",{class:"text-xs mt-1"},'Click "New" to start',-1)])]))],64))]),Q(Gr,{show:w.value,creating:T.value,onClose:R[7]||(R[7]=$=>w.value=!1),onCreate:j},null,8,["show","creating"]),Q(Gr,{show:g.value,creating:v.value,onClose:M,onCreate:p},null,8,["show","creating"])]))}}),$p={mobile:768,tablet:1024};function Sp(e,n){return e<n.mobile?"mobile":e<n.tablet?"tablet":"desktop"}const _s=hr("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=Sp(e,$p)},toggleChatFullscreen(){this.chatFullscreen=!this.chatFullscreen},setChatFullscreen(e){this.chatFullscreen=e}}});function _p(){const e=C(null),n=C(!0);let t=null,a="smooth";const s=50;function l(){const g=e.value;return g?g.scrollHeight-g.scrollTop-g.clientHeight<s:!0}function c(){n.value=l()}function f(g="smooth"){if(a=g,t!==null)return;t=(typeof window<"u"&&typeof window.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):h=>setTimeout(()=>h(Date.now()),16))(()=>{t=null,vn(()=>{const h=e.value;h&&h.scrollTo({top:h.scrollHeight,behavior:a})})})}function m(g="smooth"){f(g),n.value=!0}function d(g="smooth"){n.value&&f(g)}function w(){n.value=!0}function T(){n.value=!1}return{containerRef:e,shouldAutoScroll:Ce(n),onScroll:c,scrollToBottom:f,forceScrollToBottom:m,maybeScrollToBottom:d,enableAutoScroll:w,disableAutoScroll:T}}function Tp(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 Mp(e){const{allMessages:n,containerRef:t,estimateItemHeight:a=120,overscan:s=6}=e,l=C(0),c=C(0),f=C(new Map),m=new Map;let d=null;function w(ee,te){if(!Number.isFinite(te)||te<=0)return;const V=Math.ceil(te);if(f.value.get(ee)===V)return;const re=new Map(f.value);re.set(ee,V),f.value=re}function T(ee,te){w(ee,te.getBoundingClientRect().height)}function g(ee,te){const V=m.get(ee);V&&d&&d.unobserve(V),V&&delete V.dataset.virtualMessageId,m.delete(ee);const re=Tp(te);re&&(re.dataset.virtualMessageId=ee,m.set(ee,re),T(ee,re),d&&d.observe(re))}function v(){const ee=t.value;ee&&(l.value=ee.scrollTop)}const h=U(()=>{const ee=n.value,te=new Array(ee.length);let V=0;for(let re=0;re<ee.length;re++)te[re]=V,V+=f.value.get(ee[re].id)??a;return{offsets:te,totalHeight:V}});function P(ee,te){let V=0,re=ee.length-1,ie=ee.length;for(;V<=re;){const ue=Math.floor((V+re)/2);ee[ue]>=te?(ie=ue,re=ue-1):V=ue+1}return ie===ee.length?Math.max(0,ee.length-1):ie}const q=U(()=>{const ee=n.value;if(ee.length===0)return[];const{offsets:te}=h.value,V=l.value,re=V+Math.max(c.value,1),ie=P(te,Math.max(0,V-a));let ue=ie;for(;ue<ee.length&&te[ue]<re;)ue++;const fe=Math.max(0,ie-s),ne=Math.min(ee.length,ue+s),Z=[];for(let j=fe;j<ne;j++)Z.push({message:ee[j],index:j,top:te[j]});return Z}),A=U(()=>h.value.totalHeight);return ut(()=>{const ee=t.value;ee&&(c.value=ee.clientHeight,l.value=ee.scrollTop),d=new ResizeObserver(te=>{for(const V of te){const re=V.target;if(t.value&&re===t.value){c.value=V.contentRect.height;continue}const ie=re.dataset.virtualMessageId;ie&&w(ie,V.contentRect.height)}}),t.value&&d.observe(t.value);for(const[te,V]of m)V.dataset.virtualMessageId=te,d.observe(V),T(te,V)}),$t(()=>{d&&(d.disconnect(),d=null),m.clear()}),{visibleItems:q,totalHeight:A,onVirtualScroll:v,setItemRef:g}}const Ap=["innerHTML"],Bp=Me({__name:"ChatTextBlock",props:{block:{}},setup(e){const n=e,{renderMarkdown:t}=ho(),a=U(()=>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,Ap)):N("",!0)}}),Ep={class:"my-1 border border-retro-border/30 rounded bg-retro-dark/30"},Rp={class:"ml-auto text-retro-muted/60 text-[10px]"},Pp={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"},Dp=Me({__name:"ChatThinkingBlock",props:{block:{}},setup(e){const n=C(!1);return(t,a)=>(i(),u("div",Ep,[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))},[Q(o(Yr),{class:ge(["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",Rp,S(e.block.thinking.length)+" chars ",1)]),o(n)?(i(),u("div",Pp,S(e.block.thinking),1)):N("",!0)]))}}),Ip={class:"my-2 border border-retro-border/40 rounded bg-retro-dark/30"},Lp={key:0,class:"w-3 h-3 border-2 border-retro-yellow border-t-transparent rounded-full animate-spin flex-shrink-0"},Np={class:"text-retro-muted"},Fp={class:"text-retro-cyan font-bold"},Hp={class:"text-retro-muted truncate"},Op={key:0,class:"px-3 pb-2 border-t border-retro-border/20"},Up={key:0,class:"mt-2"},jp={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"},zp={class:"text-xs font-mono text-retro-muted space-y-2 mt-2"},Vp={key:0,class:"flex items-start gap-2"},Wp={class:"text-retro-cyan break-all"},Gp={key:1,class:"flex items-start gap-2"},qp={key:1,class:"mt-2"},Zp={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"},Kp={key:0,class:"text-[10px] text-retro-muted mt-1"},Yp={key:2,class:"mt-2"},Xp={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"},Qp={key:0,class:"text-[10px] text-retro-muted mt-1"},Jp={key:3,class:"mt-2"},ev={class:"text-xs font-mono text-retro-muted bg-retro-panel p-2 rounded overflow-x-auto max-h-40 overflow-y-auto scrollbar-custom whitespace-pre-wrap"},tv={key:0,class:"text-[10px] text-retro-muted mt-1"},nv={class:"mt-2"},rv={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"},ov={key:4,class:"mt-3"},sv={class:"space-y-2"},av={key:0,class:"text-[11px] font-mono text-retro-yellow mb-1"},iv={key:1,class:"text-xs font-mono text-retro-text whitespace-pre-wrap"},lv={key:2,class:"mt-2 space-y-1"},cv={key:0,class:"text-retro-muted/80"},uv={key:1,class:"px-3 pb-2 border-t border-retro-border/20"},dv={class:"whitespace-pre-wrap"},fv={class:"whitespace-pre-wrap"},mv=Me({__name:"ChatToolBlock",props:{block:{},result:{}},setup(e){const n=e,t=C(!1),a=C(!1);function s(k,H){for(const W of H){const ae=k[W];if(typeof ae=="string"&&ae.trim())return ae}return""}function l(k,H){for(const W of H){const ae=k[W];if(typeof ae=="number"&&Number.isFinite(ae))return ae;if(typeof ae=="string"&&ae.trim()){const G=Number(ae);if(Number.isFinite(G))return G}}return null}function c(k,H=14,W=1400){if(!k)return{text:"",truncated:!1};const ae=k.split(`
103
+ `);let G=ae.slice(0,H).join(`
104
+ `),R=ae.length>H;return G.length>W&&(G=G.slice(0,W),R=!0),{text:G,truncated:R}}const f=U(()=>n.block.name.toLowerCase()),m=U(()=>f.value.replace(/[^a-z0-9]/g,"")),d=U(()=>m.value==="requestuserinput"||m.value==="askuserquestion"),w=U(()=>f.value==="read"),T=U(()=>f.value==="write"),g=U(()=>f.value==="edit"||f.value==="multiedit"),v=U(()=>["bash","exec","execcommand","runcommand"].includes(f.value)),h=U(()=>{if(!d.value)return[];const k=n.block.input.questions;if(Array.isArray(k))return k.map(W=>W&&typeof W=="object"?W:null).filter(W=>!!W);const H={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!H.question&&!H.prompt&&!H.message&&!H.header?[]:[H]});function P(k,H=120){const W=k.replace(/\s+/g," ").trim();return W?W.length>H?`${W.slice(0,H)}...`:W:""}const q=U(()=>{const k=h.value[0];return k?P(k.question||k.prompt||k.message||k.header||""):""}),A=U(()=>s(n.block.input,["file_path","path","file","filepath","target_file"])),ee=U(()=>{const k=l(n.block.input,["offset","start_line","line"]),H=l(n.block.input,["limit","lines","line_count"]),W=l(n.block.input,["end_line"]);return k!==null&&H!==null?`from line ${k}, ${H} lines`:k!==null&&W!==null?`lines ${k}-${W}`:k!==null?`from line ${k}`:H!==null?`${H} lines`:""}),te=U(()=>s(n.block.input,["content","text","new_content"])),V=U(()=>s(n.block.input,["old_string","oldText","old"])),re=U(()=>s(n.block.input,["new_string","newText","new","replacement"])),ie=U(()=>s(n.block.input,["cmd","command","script","chars"])),ue=U(()=>c(te.value)),fe=U(()=>c(V.value,10,1e3)),ne=U(()=>c(re.value,10,1e3)),Z=U(()=>{if(d.value)return q.value||"Prompting user for clarification";if(w.value){if(A.value&&ee.value)return`Read ${A.value} (${ee.value})`;if(A.value)return`Read ${A.value}`}return T.value&&A.value?`Write ${A.value}`:g.value&&A.value?`Edit ${A.value}`:v.value&&ie.value?`$ ${ie.value}`:n.block.inputSummary}),j=U(()=>{switch(n.block.status){case"running":return"[RUN]";case"pending":return"[WAIT]";case"complete":return"[OK]";case"error":return"[ERR]"}}),F=U(()=>Object.entries(n.block.input).filter(([H,W])=>W==null||typeof W=="string"&&(!W.trim()||W.length>90)?!1:!["content","new_content","text","old_string","new_string"].includes(H)).slice(0,6).map(([H,W])=>`${H}=${JSON.stringify(W)}`)),B=U(()=>{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"}}),X=U(()=>n.result?n.result.content.split(`
105
+ `).slice(0,3).join(`
106
+ `):""),M=U(()=>n.result?n.result.content.split(`
107
+ `).length>3||n.result.content.length>300:!1),p=U(()=>n.result?n.result.content.trim().length>0:!1);return(k,H)=>(i(),u("div",Ip,[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:H[0]||(H[0]=W=>t.value=!o(t))},[e.block.status==="running"?(i(),u("span",Lp)):e.block.status==="pending"?(i(),ce(o(Jo),{key:1,class:"w-3.5 h-3.5 flex-shrink-0 text-retro-muted animate-pulse"})):e.block.status==="complete"?(i(),ce(o(vr),{key:2,class:ge(["w-3.5 h-3.5 flex-shrink-0",o(B)])},null,8,["class"])):(i(),ce(o(In),{key:3,class:ge(["w-3.5 h-3.5 flex-shrink-0",o(B)])},null,8,["class"])),r("span",Np,S(o(j)),1),r("span",Fp,S(e.block.name),1),r("span",Hp,S(o(Z)||e.block.inputSummary),1),Q(o(Yr),{class:ge(["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",Op,[o(F).length>0?(i(),u("div",Up,[H[3]||(H[3]=r("div",{class:"text-[11px] font-mono text-retro-cyan mb-1"},"Args",-1)),r("pre",jp,S(o(F).join(`
108
+ `)),1)])):N("",!0),r("div",zp,[o(A)?(i(),u("div",Vp,[H[4]||(H[4]=r("span",{class:"text-retro-muted/80 min-w-12"},"File",-1)),r("code",Wp,S(o(A)),1)])):N("",!0),o(w)&&o(ee)?(i(),u("div",Gp,[H[5]||(H[5]=r("span",{class:"text-retro-muted/80 min-w-12"},"Range",-1)),r("span",null,S(o(ee)),1)])):N("",!0)]),o(T)&&o(ue).text?(i(),u("div",qp,[H[6]||(H[6]=r("div",{class:"text-[11px] font-mono text-retro-cyan mb-1"},"New Content",-1)),r("pre",Zp,S(o(ue).text),1),o(ue).truncated?(i(),u("div",Kp,"Truncated preview")):N("",!0)])):N("",!0),o(g)&&o(fe).text?(i(),u("div",Yp,[H[7]||(H[7]=r("div",{class:"text-[11px] font-mono text-retro-yellow mb-1"},"Before",-1)),r("pre",Xp,S(o(fe).text),1),o(fe).truncated?(i(),u("div",Qp,"Truncated preview")):N("",!0)])):N("",!0),o(g)&&o(ne).text?(i(),u("div",Jp,[H[8]||(H[8]=r("div",{class:"text-[11px] font-mono text-retro-green mb-1"},"After",-1)),r("pre",ev,S(o(ne).text),1),o(ne).truncated?(i(),u("div",tv,"Truncated preview")):N("",!0)])):N("",!0),r("details",nv,[H[9]||(H[9]=r("summary",{class:"text-[11px] font-mono text-retro-muted cursor-pointer hover:text-retro-cyan"},"Raw input JSON",-1)),r("pre",rv,S(JSON.stringify(e.block.input,null,2)),1)]),o(d)&&o(h).length>0?(i(),u("div",ov,[H[10]||(H[10]=r("div",{class:"text-[11px] font-mono text-retro-cyan mb-1"},"Clarification Prompt",-1)),r("div",sv,[(i(!0),u(me,null,Ee(o(h),(W,ae)=>(i(),u("div",{key:`${W.id||"q"}-${ae}`,class:"rounded border border-retro-border/30 bg-retro-panel/40 p-2"},[W.header?(i(),u("div",av,S(W.header),1)):N("",!0),W.question||W.prompt||W.message?(i(),u("div",iv,S(W.question||W.prompt||W.message),1)):N("",!0),Array.isArray(W.options)&&W.options.length>0?(i(),u("div",lv,[(i(!0),u(me,null,Ee(W.options,(G,R)=>(i(),u("div",{key:`${W.id||"q"}-opt-${R}`,class:"text-xs font-mono text-retro-muted"},[_e(S(G.label||`Option ${R+1}`)+" ",1),G.description?(i(),u("span",cv," - "+S(G.description),1)):N("",!0)]))),128))])):N("",!0)]))),128))])])):N("",!0)])):N("",!0),o(p)?(i(),u("div",uv,[r("div",{class:ge(["text-xs font-mono rounded p-2 mt-1 overflow-y-auto scrollbar-custom border",e.result.isError?"text-retro-red bg-retro-red/5 border-retro-red/40":"text-retro-muted bg-retro-panel/60 border-retro-border/30"]),style:kt(o(a)?"max-height: 20rem":"")},[!o(a)&&o(M)?(i(),u(me,{key:0},[r("pre",dv,S(o(X)),1),r("button",{class:"text-retro-cyan hover:underline mt-1 text-[10px]",onClick:H[1]||(H[1]=ft(W=>a.value=!0,["stop"]))}," Show full ("+S(e.result.content.length)+" chars) ",1)],64)):(i(),u(me,{key:1},[r("pre",fv,S(e.result.content),1),o(M)?(i(),u("button",{key:0,class:"text-retro-cyan hover:underline mt-1 text-[10px]",onClick:H[2]||(H[2]=ft(W=>a.value=!1,["stop"]))}," Collapse ")):N("",!0)],64))],6)])):N("",!0)]))}}),hv={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"},pv={class:"flex items-center gap-1"},vv={class:"flex items-center gap-1"},gv=Me({__name:"ChatResultSummary",props:{block:{}},setup(e){const n=e,t=U(()=>{const l=Math.round(n.block.durationMs/1e3);return l<60?`${l}s`:`${Math.floor(l/60)}m ${l%60}s`}),a=U(()=>`$${n.block.totalCostUsd.toFixed(4)}`),s=U(()=>{const{inputTokens:l,outputTokens:c}=n.block.usage;return`${l.toLocaleString()} in / ${c.toLocaleString()} out`});return(l,c)=>(i(),u("div",hv,[r("span",pv,[c[0]||(c[0]=r("span",{class:"text-retro-muted/60"},"time",-1)),_e(" "+S(o(t)),1)]),r("span",vv,[c[1]||(c[1]=r("span",{class:"text-retro-muted/60"},"cost",-1)),_e(" "+S(o(a)),1)]),r("span",null,S(o(s)),1),r("span",null,S(e.block.numTurns)+" turn"+S(e.block.numTurns!==1?"s":""),1)]))}}),xv={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"},bv={class:"text-retro-cyan"},yv={key:0,class:"text-retro-border"},wv={key:1},kv=Me({__name:"ChatSessionInit",props:{block:{}},setup(e){return(n,t)=>(i(),u("div",xv,[r("span",bv,S(e.block.model),1),t[0]||(t[0]=r("span",{class:"text-retro-border"},"|",-1)),r("span",null,S(e.block.tools.length)+" tools",1),e.block.permissionMode?(i(),u("span",yv,"|")):N("",!0),e.block.permissionMode?(i(),u("span",wv,S(e.block.permissionMode),1)):N("",!0)]))}}),Cv=Me({__name:"ChatContentBlock",props:{block:{},allBlocks:{}},setup(e){const n=e,t=U(()=>{if(n.block.type!=="tool_use")return;const a=n.block.toolUseId;return n.allBlocks.find(s=>s.type==="tool_result"&&s.toolUseId===a)});return(a,s)=>{const l=Bp,c=Dp,f=mv,m=gv,d=kv;return e.block.type==="text"?(i(),ce(l,{key:0,block:e.block},null,8,["block"])):e.block.type==="thinking"?(i(),ce(c,{key:1,block:e.block},null,8,["block"])):e.block.type==="tool_use"?(i(),ce(f,{key:2,block:e.block,result:o(t)},null,8,["block","result"])):e.block.type==="result_summary"?(i(),ce(m,{key:3,block:e.block},null,8,["block"])):e.block.type==="session_init"?(i(),ce(d,{key:4,block:e.block},null,8,["block"])):N("",!0)}}}),$v={class:"flex-1 min-w-0"},Sv={class:"flex items-center gap-2 mb-1"},_v={class:"text-xs font-mono text-retro-muted"},Tv={key:0,class:"text-xs font-mono text-retro-yellow animate-pulse"},Mv={key:1,class:"text-xs font-mono text-retro-muted"},Av={key:2,class:"text-xs font-mono text-retro-red"},Bv={key:1,class:"mb-2 flex flex-wrap gap-2"},Ev=["href","download"],Rv=["src","alt"],Pv={class:"mt-1 truncate text-[10px] font-mono text-retro-muted"},Dv=["innerHTML"],Iv={key:3,class:"text-xs font-mono text-retro-muted italic"},Lv={key:4,class:"inline-block w-2 h-4 bg-retro-cyan animate-pulse ml-0.5"},Nv=Me({__name:"ChatMessage",props:{message:{}},setup(e){const n=e,{renderMarkdown:t}=ho(),a=U(()=>n.message.role==="user"),s=U(()=>n.message.status==="streaming"),l=U(()=>n.message.status==="error"),c=U(()=>n.message.status==="stopped"),f=U(()=>Hs(n.message)),m=U(()=>{if(!n.message.contentBlocks)return[];const h=n.message.contentBlocks.filter(q=>q.type!=="tool_result"),P=[];for(const q of h){const A=P.length>0?P[P.length-1]:null;if(A?.type==="text"&&q.type==="text"){const ee=A.text||"",te=q.text||"";A.text=`${ee}${te}`;continue}P.push({...q})}return P}),d=U(()=>f.value&&m.value.length>0),w=U(()=>n.message.content.trim().length>0),T=U(()=>n.message.attachments??[]),g=h=>new Date(h).toLocaleTimeString("en-US",{hour12:!1,hour:"2-digit",minute:"2-digit"}),v=U(()=>t(n.message.content));return(h,P)=>{const q=Cv;return i(),u("div",{class:ge(["flex gap-3 p-3",[o(a)?"bg-retro-dark/50":"bg-transparent",o(l)?"border-l-2 border-retro-red":""]])},[r("div",{class:ge(["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(),ce(o(Hr),{key:0,class:"w-4 h-4 text-retro-cyan"})):(i(),ce(o(ns),{key:1,class:"w-4 h-4 text-retro-green"}))],2),r("div",$v,[r("div",Sv,[r("span",{class:ge(["text-xs font-mono",o(a)?"text-retro-cyan":"text-retro-green"])},S(o(a)?"You":"Assistant"),3),r("span",_v,S(g(e.message.timestamp)),1),o(s)?(i(),u("span",Tv," typing... ")):N("",!0),o(c)?(i(),u("span",Mv," (stopped) ")):N("",!0),o(l)?(i(),u("span",Av," (error) ")):N("",!0)]),o(d)?(i(!0),u(me,{key:0},Ee(o(m),A=>(i(),ce(q,{key:A.id,block:A,"all-blocks":e.message.contentBlocks},null,8,["block","all-blocks"]))),128)):N("",!0),o(a)&&o(T).length>0?(i(),u("div",Bv,[(i(!0),u(me,null,Ee(o(T),A=>(i(),u("a",{key:A.id,href:A.dataUrl,download:A.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:A.dataUrl,alt:A.name,class:"h-20 w-full rounded object-cover"},null,8,Rv),r("div",Pv,S(A.name),1)],8,Ev))),128))])):N("",!0),!o(d)&&o(w)?(i(),u("div",{key:2,class:"text-sm font-mono text-retro-text break-words chat-markdown",innerHTML:o(v)},null,8,Dv)):N("",!0),!o(d)&&!o(w)&&!o(a)&&!o(s)?(i(),u("div",Iv," (no visible response content) ")):N("",!0),o(s)?(i(),u("span",Lv)):N("",!0)])],2)}}}),Fv={key:0,class:"flex flex-col items-center justify-center h-full p-8 text-center"},Hv={key:1,class:"relative"},Ov={class:"sticky bottom-0"},Uv={key:0,class:"px-4 py-2 bg-retro-dark/90 border-t border-retro-border/50 backdrop-blur-sm"},jv={key:1,class:"px-4 py-2.5 bg-retro-red/20 border-t border-retro-red/50"},zv={class:"flex items-start gap-2"},Vv={class:"flex-1 min-w-0"},Wv={class:"flex items-center justify-between gap-2 mb-0.5"},Gv={class:"text-xs font-mono text-retro-red/80 break-words whitespace-pre-wrap"},qv={key:2,class:"px-4 py-2 bg-retro-dark/90 border-t border-retro-border/50"},Zv=Me({__name:"ChatMessages",setup(e){const n=gt(),{containerRef:t,onScroll:a,maybeScrollToBottom:s,scrollToBottom:l,forceScrollToBottom:c}=_p(),{visibleItems:f,totalHeight:m,onVirtualScroll:d,setItemRef:w}=Mp({allMessages:U(()=>n.messages),containerRef:t});function T(){a(),d()}const g=U(()=>n.isActiveConversationStreaming),v=U(()=>{const P=n.lastMessage;return!P||P.role!=="assistant"?null:P.status}),h=C(!1);return ut(()=>{l("instant")}),De(()=>n.activeConversationId,()=>{h.value=!1,l("instant")}),De(()=>[n.activeConversationId,n.messages.length],([P,q])=>{!P||q===0||h.value||(h.value=!0,c("instant"))},{immediate:!0}),De(()=>n.messages.length,()=>{s("instant")}),De(()=>n.lastMessage?.content,()=>{s("instant")}),De([g,()=>n.lastError],()=>{s("instant")}),De(m,()=>{s("instant")}),(P,q)=>(i(),u("div",{ref_key:"containerRef",ref:t,class:"flex-1 overflow-y-auto",onScroll:T},[o(n).hasMessages?(i(),u("div",Hv,[r("div",{class:"relative",style:kt({height:`${o(m)}px`})},[(i(!0),u(me,null,Ee(o(f),A=>(i(),u("div",{key:A.message.id,class:"absolute left-0 right-0 border-b border-retro-border/30",style:kt({transform:`translateY(${A.top}px)`})},[r("div",{ref_for:!0,ref:ee=>o(w)(A.message.id,ee)},[jo([A.message.id,A.message.status,A.message.content,A.message.contentBlocks?.length||0,A.message.tools?.length||0],()=>Q(Nv,{message:A.message},null,8,["message"]),q,0)],512)],4))),128))],4)])):(i(),u("div",Fv,[...q[2]||(q[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",Ov,[o(g)&&!o(n).lastError?(i(),u("div",Uv,[...q[3]||(q[3]=[Es('<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)])])):N("",!0),o(n).lastError?(i(),u("div",jv,[r("div",zv,[Q(o(In),{class:"w-4 h-4 text-retro-red flex-shrink-0 mt-0.5"}),r("div",Vv,[r("div",Wv,[q[4]||(q[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:q[1]||(q[1]=A=>o(n).clearError())}," Dismiss ")]),r("p",Gv,S(o(n).lastError),1),q[5]||(q[5]=r("p",{class:"text-xs font-mono text-retro-muted mt-1"}," Check browser console (F12) for more details ",-1))])])])):o(v)==="stopped"?(i(),u("div",qv,[...q[6]||(q[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)])])):N("",!0)])],544))}});function Kv(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 Yv(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 Xv(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 Qv(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 Jv={class:"flex-shrink-0 border-t border-retro-border bg-retro-dark p-3"},eg={class:"flex items-center gap-2 mb-2"},tg={class:"relative mode-selector"},ng={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]"},rg=["onClick"],og={class:"text-xs font-mono text-retro-muted"},sg={key:0,class:"mb-3 p-3 bg-retro-yellow/10 border border-retro-yellow/50 rounded"},ag={class:"flex items-center justify-between gap-3"},ig={class:"flex-1 min-w-0"},lg={class:"text-xs font-mono text-retro-text truncate"},cg={class:"text-retro-cyan"},ug={key:0,class:"text-retro-muted"},dg={key:1,class:"text-retro-muted"},fg={key:1,class:"mb-3 p-3 bg-retro-cyan/10 border border-retro-cyan/50 rounded"},mg={key:2,class:"mb-2 flex flex-wrap gap-2"},hg=["src","alt"],pg={class:"mt-1 truncate text-[10px] font-mono text-retro-muted"},vg={class:"truncate text-[10px] font-mono text-retro-muted/80"},gg=["onClick"],xg={class:"flex gap-2 items-end"},bg=["disabled"],yg={class:"flex-1 relative"},wg=["disabled","placeholder"],kg=["disabled"],Oo=4,Cg=5*1024*1024,$g=Me({__name:"ChatInput",props:{disabled:{type:Boolean}},setup(e){const n=e,t=gt(),{sendMessage:a,sendPermissionResponse:s,approvePlan:l,rejectPlan:c,abort:f,resetContext:m}=po(),d=C(""),w=C(null),T=C(null),g=C(!1),v=C(!1),h=C([]),P={plan:Qr,ask:eo,auto:Zr,bypass:to},q={plan:"text-retro-cyan",ask:"text-retro-green",auto:"text-retro-yellow",bypass:"text-retro-red"};function A(Y){t.setPermissionMode(Y),v.value=!1}function ee(Y){Y.target.closest(".mode-selector")||(v.value=!1)}ut(()=>{document.addEventListener("click",ee)}),$t(()=>{document.removeEventListener("click",ee)});const te=U(()=>(d.value.trim().length>0||h.value.length>0)&&!t.isActiveConversationStreaming&&!g.value&&!t.pendingPermission&&!ie.value),V=U(()=>t.isActiveConversationStreaming&&!t.pendingPermission),re=U(()=>t.pendingPermission!==null),ie=U(()=>t.pendingPlanApproval!==null);function ue(){s(!0,t.activeConversationId)}function fe(){s(!1,t.activeConversationId)}function ne(){l(t.activeConversationId)}function Z(){c(t.activeConversationId)}function j(){h.value=[],T.value&&(T.value.value="")}function F(Y){h.value=h.value.filter(de=>de.id!==Y)}function B(Y){return Y<1024?`${Y} B`:Y<1024*1024?`${(Y/1024).toFixed(1)} KB`:`${(Y/(1024*1024)).toFixed(1)} MB`}function X(Y){return new Promise((de,oe)=>{const be=new FileReader;be.onload=()=>{typeof be.result=="string"?de(be.result):oe(new Error("Failed to read image"))},be.onerror=()=>oe(be.error||new Error("Failed to read image")),be.readAsDataURL(Y)})}async function M(Y){const de=Y.target,oe=de.files?Array.from(de.files):[];if(oe.length===0)return;const{useToast:be}=await Cn(async()=>{const{useToast:Be}=await import("./BMzDNyt_.js").then(Oe=>Oe.o);return{useToast:Be}},__vite__mapDeps([0,1,2]),import.meta.url),Se=be();let we=Oo-h.value.length;if(we<=0){Se.warning(`You can attach up to ${Oo} images per message.`),de.value="";return}for(const Be of oe){if(we<=0)break;if(!Be.type.startsWith("image/")){Se.warning(`Skipped "${Be.name}": only image files are supported.`);continue}if(Be.size>Cg){Se.warning(`Skipped "${Be.name}": max size is 5 MB.`);continue}try{const Oe=await X(Be);h.value.push({id:`att-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,name:Be.name,mimeType:Be.type,size:Be.size,dataUrl:Oe}),we--}catch{Se.error(`Failed to attach "${Be.name}".`)}}de.value=""}const p=U(()=>{if(t.isActiveConversationStreaming||g.value)return!1;const Y=t.lastMessage;return Y?.role==="assistant"&&Y?.status==="error"});function k(Y){const de=Y.instructionFiles.length>0?Y.instructionFiles.map(be=>{const Se=be.source==="cwd"?"cwd":"ancestor",we=be.mtime?` (mtime: ${be.mtime})`:"";return`- \`${be.path}\` [${Se}] - ${be.hint}${we}`}):["- (none detected from current cwd ancestry)"],oe=Y.specContext.files.length>0?Y.specContext.files.map(be=>`- \`${be}\``):["- (none)"];return["## Context Snapshot","",`- Time: ${Y.generatedAt}`,`- Session state: **${Y.sessionState}**`,`- Provider session ID: \`${Y.providerSessionId??"(empty)"}\``,`- Provider: \`${Y.providerId}\` / \`${Y.providerModelKey}\``,`- Permission mode: \`${Y.permissionMode}\``,`- CWD (requested): \`${Y.requestedCwd}\``,`- CWD (effective): \`${Y.effectiveCwd}\``,`- Feature: \`${Y.featureId??"(none)"}\``,"","### Spec Context Injection",`- Active on next turn: **${Y.specContext.active?"yes":"no"}**`,`- Reason: ${Y.specContext.reason}`,...oe,"","### Detected Instruction Files",...de].join(`
109
+ `)}function H(Y){return(Y.match(/"[^"]*"|'[^']*'|\S+/g)??[]).map(oe=>oe.startsWith('"')&&oe.endsWith('"')||oe.startsWith("'")&&oe.endsWith("'")?oe.slice(1,-1):oe)}function W(Y){const de=Y.match(/^\/(?:spec-search|specsearch)\b(.*)$/i);if(!de)return null;const oe=H(de[1]?.trim()??""),be=[],Se={q:""};for(let we=0;we<oe.length;we++){const Be=oe[we];if(Be==="--mode"&&oe[we+1]){const Oe=oe[++we];(Oe==="keyword"||Oe==="semantic"||Oe==="hybrid")&&(Se.mode=Oe);continue}if(Be.startsWith("--mode=")){const Oe=Be.slice(7);(Oe==="keyword"||Oe==="semantic"||Oe==="hybrid")&&(Se.mode=Oe);continue}if(Be==="--feature"&&oe[we+1]){Se.featureId=oe[++we];continue}if(Be.startsWith("--feature=")){Se.featureId=Be.slice(10);continue}if(Be==="--file-type"&&oe[we+1]){Se.fileType=oe[++we];continue}if(Be.startsWith("--file-type=")){Se.fileType=Be.slice(12);continue}if(Be==="--limit"&&oe[we+1]){const Oe=Number.parseInt(oe[++we],10);Number.isFinite(Oe)&&Oe>0&&(Se.limit=Oe);continue}if(Be.startsWith("--limit=")){const Oe=Number.parseInt(Be.slice(8),10);Number.isFinite(Oe)&&Oe>0&&(Se.limit=Oe);continue}be.push(Be)}return Se.q=be.join(" ").trim(),Se}function ae(Y,de=1400){const oe=Y.trim();return oe.length<=de?oe:`${oe.slice(0,de)}
110
+ ...`}function G(Y,de){const oe=[];if(oe.push("## Spec Search Results"),oe.push(""),oe.push(`- Query: \`${Y.q}\``),oe.push(`- Mode: \`${de.mode}\``),Y.featureId&&oe.push(`- Feature filter: \`${Y.featureId}\``),Y.fileType&&oe.push(`- File type filter: \`${Y.fileType}\``),oe.push(`- Hits: **${de.totalCount}** (${de.searchTime}ms)`),de.warning&&oe.push(`- Warning: ${de.warning}`),de.results.length===0)return oe.push(""),oe.push("No matching indexed chunks were found."),oe.join(`
111
+ `);oe.push("");for(const[be,Se]of de.results.entries()){const we=Se.chunk;oe.push(`### ${be+1}. \`${we.sourcePath}:${we.lineStart}\``),oe.push(`- Match: \`${Se.matchType}\` (score: ${Se.score.toFixed(3)})`),we.headingHierarchy.length>0&&oe.push(`- Headings: ${we.headingHierarchy.join(" > ")}`),oe.push(""),oe.push(ae(we.content)),oe.push("")}return oe.join(`
112
+ `)}async function R(Y){const de=t.activeConversationId??await t.createConversation(),oe=t.addAssistantMessage(de);if(!Y.q){t.updateMessage(oe.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"},de);return}const be=t.activeConversation,Se={q:Y.q,mode:Y.mode??"hybrid",featureId:Y.featureId??be?.featureId,fileType:Y.fileType,limit:String(Y.limit??5)};try{const we=await $fetch("/api/specs/search",{query:Se});t.updateMessage(oe.id,{content:G({...Y,mode:Se.mode,featureId:Se.featureId},we),status:"complete"},de)}catch(we){const Be=we instanceof Error?we.message:"Failed to run spec search";t.updateMessage(oe.id,{content:`Spec search failed: ${Be}`,status:"error"},de)}}async function $(){const Y=t.activeConversation,de={permissionMode:t.permissionMode};Y?.hasWorktree&&Y.worktreePath?de.cwd=Y.worktreePath:Y?.cwd&&(de.cwd=Y.cwd),Y?.featureId&&(de.featureId=Y.featureId),Y?.providerId&&(de.providerId=Y.providerId),Y?.providerModelKey&&(de.providerModelKey=Y.providerModelKey),Y?.providerSessionId&&(de.providerSessionId=Y.providerSessionId);const oe=await $fetch("/api/chat/context",{query:de}),be=t.activeConversationId??await t.createConversation(),Se=t.addAssistantMessage(be);t.updateMessage(Se.id,{content:k(oe),status:"complete"},be)}async function I(){const Y=d.value.trim(),de=[...h.value];if(Y.length===0&&de.length===0||t.isActiveConversationStreaming||g.value||n.disabled)return;if(Y==="/reset"||Y==="/reset-context"){await K();return}if(Y==="/context"||Y==="/ctx"){await $(),d.value="",j(),qe();return}const oe=W(Y);if(oe){await R(oe),d.value="",j(),qe();return}g.value=!0,d.value="",j(),qe();try{await t.addUserMessageWithConversation(Y,de);const be=t.activeConversationId,Se=t.addAssistantMessage();t.startSession(`session-${Date.now()}`),t.startConversationStreaming(be);const we=t.activeConversation,Be={};we?.hasWorktree&&we.worktreePath&&(Be.cwd=we.worktreePath,Be.worktreeBranch=we.worktreeBranch),we?.featureId&&(Be.featureId=we.featureId),de.length>0&&(Be.attachments=de),await a(Y,Se.id,be,Object.keys(Be).length>0?Be:void 0)}catch(be){const Se=be instanceof Error?be.message:"Failed to send message";t.setSessionError(Se);const we=t.lastMessage;we&&we.role==="assistant"&&t.updateMessage(we.id,{status:"error"}),t.activeConversationId&&(t.endSession(t.activeConversationId),t.endConversationStreaming(t.activeConversationId))}finally{g.value=!1}}async function L(){try{f(t.activeConversationId)}catch{}}async function K(){if(t.activeConversationId){d.value="",j(),qe(),g.value=!0;try{await m(t.activeConversationId);const Y=t.addAssistantMessage(t.activeConversationId);t.updateMessage(Y.id,{content:"✨ **Context cleared** — The AI conversation context has been reset. Starting fresh from here.",status:"complete"},t.activeConversationId);const{useToast:de}=await Cn(async()=>{const{useToast:be}=await import("./BMzDNyt_.js").then(Se=>Se.o);return{useToast:be}},__vite__mapDeps([0,1,2]),import.meta.url);de().success("AI context has been reset. The conversation will start fresh.")}catch(Y){console.error("Failed to reset context:",Y);const{useToast:de}=await Cn(async()=>{const{useToast:be}=await import("./BMzDNyt_.js").then(Se=>Se.o);return{useToast:be}},__vite__mapDeps([0,1,2]),import.meta.url);de().error("Failed to reset context. Please try again.")}finally{g.value=!1}}}async function ve(){const Y=t.messages;let de=null;for(let be=Y.length-1;be>=0;be--)if(Y[be].role==="user"){de={content:Y[be].content,attachments:Y[be].attachments??[]};break}if(!de||!t.activeConversationId)return;const oe=t.activeConversationId;t.clearError(),g.value=!0;try{const be=t.addAssistantMessage();t.startSession(`session-${Date.now()}`),t.startConversationStreaming(oe);const Se=t.activeConversation,we={};Se?.hasWorktree&&Se.worktreePath&&(we.cwd=Se.worktreePath,we.worktreeBranch=Se.worktreeBranch),Se?.featureId&&(we.featureId=Se.featureId),de.attachments.length>0&&(we.attachments=de.attachments),await a(de.content,be.id,oe,Object.keys(we).length>0?we:void 0)}catch(be){const Se=be instanceof Error?be.message:"Failed to retry message";t.setSessionError(Se);const we=t.lastMessage;we&&we.role==="assistant"&&t.updateMessage(we.id,{status:"error"}),t.endSession(oe),t.endConversationStreaming(oe)}finally{g.value=!1}}function xe(Y){Y.key==="Enter"&&!Y.shiftKey&&(Y.preventDefault(),I())}function Te(){const Y=w.value;if(Y){if(!d.value.trim()){Y.style.height="";return}Y.style.height="auto",Y.style.height=Math.min(Y.scrollHeight,200)+"px"}}function qe(){const Y=w.value;Y&&(Y.style.height="")}function Ye(){vn(()=>{w.value?.focus()})}return De(d,Te),De(()=>t.isActiveConversationStreaming,(Y,de)=>{de&&!Y&&Ye()}),De(()=>t.activeConversationId,()=>{j(),Ye()}),(Y,de)=>(i(),u("div",Jv,[r("div",eg,[r("div",tg,[r("button",{class:ge(["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",q[o(t).permissionMode]]),onClick:de[0]||(de[0]=oe=>v.value=!o(v))},[(i(),ce(En(P[o(t).permissionMode]),{class:"w-4 h-4"})),r("span",null,S(o(Bn)[o(t).permissionMode]),1),Q(o(Yv),{class:"w-3 h-3"})],2),o(v)?(i(),u("div",ng,[(i(),u(me,null,Ee(["plan","ask","auto","bypass"],oe=>r("button",{key:oe,class:ge(["flex items-center gap-2 w-full px-3 py-1.5 text-xs font-mono text-left hover:bg-retro-panel transition-colors",[q[oe],o(t).permissionMode===oe?"bg-retro-panel":""]]),onClick:be=>A(oe)},[(i(),ce(En(P[oe]),{class:"w-4 h-4"})),r("span",null,S(o(Bn)[oe]),1)],10,rg)),64))])):N("",!0)]),r("span",og,S(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",sg,[r("div",ag,[r("div",ig,[de[3]||(de[3]=r("div",{class:"text-xs font-mono text-retro-yellow font-bold mb-1"}," Permission Required ",-1)),r("div",lg,[r("span",cg,S(o(t).pendingPermission?.tool),1),o(t).pendingPermission?.filePath?(i(),u("span",ug," - "+S(o(t).pendingPermission.filePath),1)):o(t).pendingPermission?.command?(i(),u("span",dg," - "+S(o(t).pendingPermission.command),1)):N("",!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 ")])])])):N("",!0),o(ie)?(i(),u("div",fg,[r("div",{class:"flex items-center justify-between gap-3"},[de[4]||(de[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:ne}," Approve & Implement "),r("button",{class:"px-3 py-1.5 text-xs font-mono rounded bg-retro-red/20 text-retro-red border border-retro-red/50 hover:bg-retro-red/30 transition-colors",onClick:Z}," Reject ")])])])):N("",!0),o(h).length>0?(i(),u("div",mg,[(i(!0),u(me,null,Ee(o(h),oe=>(i(),u("div",{key:oe.id,class:"relative w-24 rounded border border-retro-border/70 bg-retro-black/80 p-1"},[r("img",{src:oe.dataUrl,alt:oe.name,class:"h-16 w-full rounded object-cover"},null,8,hg),r("div",pg,S(oe.name),1),r("div",vg,S(B(oe.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:be=>F(oe.id)},[Q(o(vt),{class:"h-3 w-3"})],8,gg)]))),128))])):N("",!0),r("div",xg,[r("input",{ref_key:"fileInputRef",ref:T,type:"file",accept:"image/*",multiple:"",class:"hidden",onChange:M},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(ie),onClick:de[1]||(de[1]=oe=>o(T)?.click())},[Q(o(ua),{class:"w-5 h-5"})],8,bg),r("div",yg,[Pe(r("textarea",{ref_key:"inputRef",ref:w,"onUpdate:modelValue":de[2]||(de[2]=oe=>He(d)?d.value=oe:null),disabled:e.disabled||o(t).isActiveConversationStreaming||o(re)||o(ie),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:xe},null,40,wg),[[pt,o(d)]])]),o(p)?(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:ve},[Q(o(Kv),{class:"w-5 h-5"})])):N("",!0),!o(V)&&!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:I},[Q(o(Xv),{class:"w-5 h-5"})],8,kg)):o(V)?(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:L},[Q(o(Qv),{class:"w-5 h-5"})])):N("",!0)]),de[5]||(de[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))]))}}),Sg={class:"h-64 border-t border-retro-border bg-retro-dark/50 flex flex-col"},_g={class:"h-9 flex items-center justify-between px-3 border-b border-retro-border/40"},Tg={key:0,class:"flex-1 flex items-center justify-center text-xs font-mono text-retro-muted"},Mg={key:1,class:"flex-1 overflow-y-auto scrollbar-custom"},Ag={class:"flex items-center gap-2 text-[10px] font-mono"},Bg={class:"text-retro-muted"},Eg={class:"text-retro-muted"},Rg={class:"text-retro-green truncate"},Pg={class:"mt-1 text-[11px] font-mono text-retro-text whitespace-pre-wrap break-words"},Dg=Me({__name:"ChatDebugPanel",setup(e){const n=gt(),{debugEvents:t}=Rs(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",Sg,[r("div",_g,[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]=f=>o(n).clearDebugEvents())},[Q(o(an),{class:"w-3.5 h-3.5 text-retro-muted"})])]),o(t).length===0?(i(),u("div",Tg," No debug events yet ")):(i(),u("div",Mg,[(i(!0),u(me,null,Ee(o(t),f=>(i(),u("div",{key:f.id,class:"px-3 py-2 border-b border-retro-border/20"},[r("div",Ag,[r("span",Bg,S(a(f.timestamp)),1),r("span",{class:ge(s(f.direction))},S(f.direction.toUpperCase()),3),r("span",Eg,S(f.channel),1),r("span",Rg,S(f.eventType),1)]),r("pre",Pg,S(f.payload),1)]))),128))]))]))}}),Ig={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},Lg={class:"flex items-center justify-between"},Ng={class:"space-y-1 text-xs font-mono"},Fg={class:"flex items-center gap-2"},Hg={class:"relative"},Og=["disabled"],Ug=["value"],jg=["value"],zg={class:"flex items-center gap-2"},Vg={class:"text-retro-text"},Wg={class:"relative"},Gg=["disabled"],qg=["disabled"],Zg={class:"flex items-center gap-2"},Kg=["disabled"],Yg=["disabled"],Xg=Me({__name:"FinalizeConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(e,{emit:n}){const t=e,a=n,s=C(""),l=C(null),c=C(!1),f=C(!1),m=C(t.baseBranch),d=C([]),w=C(!1);async function T(){f.value=!0;try{const v=await $fetch("/api/chat/generate-commit-message",{method:"POST",body:{conversationId:t.worktreePath.split("/").pop()?.replace("br-","")||"",worktreePath:t.worktreePath}});v.success&&v.message&&(s.value=v.message)}catch{}finally{f.value=!1}}ut(async()=>{const v=(async()=>{try{const P=t.worktreePath.split("/").pop()||"",q=await $fetch(`/api/commits/${encodeURIComponent(P)}`,{params:{workingDirectory:t.worktreePath}});l.value=q.aheadCount}catch{l.value=null}})(),h=(async()=>{w.value=!0;try{const P=await $fetch("/api/git/branches");d.value=P.branches.filter(q=>!q.isRemote&&!q.name.startsWith("br/")&&!q.name.startsWith("br/p-")).map(q=>q.name),d.value.length>0&&!d.value.includes(m.value)&&(m.value=d.value.includes("main")?"main":d.value.includes("master")?"master":d.value[0])}catch{d.value=[]}finally{w.value=!1}})();await Promise.all([v,h])});function g(){s.value.trim()&&(c.value=!0,a("confirm",s.value.trim(),m.value))}return(v,h)=>(i(),u("div",Ig,[r("div",Lg,[h[4]||(h[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:h[0]||(h[0]=P=>a("cancel"))},[Q(o(vt),{class:"w-4 h-4"})])]),r("div",Ng,[r("div",Fg,[h[5]||(h[5]=r("span",{class:"text-retro-muted"},"target:",-1)),r("div",Hg,[Pe(r("select",{"onUpdate:modelValue":h[1]||(h[1]=P=>m.value=P),disabled:c.value||w.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"},[w.value?(i(),u("option",{key:0,value:e.baseBranch},S(e.baseBranch),9,Ug)):N("",!0),(i(!0),u(me,null,Ee(d.value,P=>(i(),u("option",{key:P,value:P},S(P),9,jg))),128))],8,Og),[[Tn,m.value]]),Q(o(Xr),{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",zg,[h[6]||(h[6]=r("span",{class:"text-retro-muted"},"commits:",-1)),r("span",Vg,S(l.value!==null?l.value:"..."),1)])]),r("div",Wg,[Pe(r("textarea",{"onUpdate:modelValue":h[2]||(h[2]=P=>s.value=P),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||f.value},null,8,Gg),[[pt,s.value]]),r("button",{type:"button",disabled:c.value||f.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},[Q(o(gr),{class:ge(["w-4 h-4",{"animate-spin":f.value}])},null,8,["class"])],8,qg)]),r("div",Zg,[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:g},[Q(o(Kr),{class:"w-3.5 h-3.5"}),_e(" "+S(c.value?"Finalizing...":"Confirm"),1)],8,Kg),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:h[3]||(h[3]=P=>a("cancel"))}," Cancel ",8,Yg)])]))}}),Qg={class:"px-4 py-3 border-b border-retro-border bg-retro-dark/80 space-y-3"},Jg={class:"flex items-center justify-between"},e1={class:"space-y-1 text-xs font-mono"},t1={class:"flex items-center gap-2"},n1={class:"text-retro-cyan"},r1={class:"flex items-center gap-2"},o1={class:"relative"},s1=["disabled"],a1=["value"],i1=["value"],l1={class:"flex items-center gap-2"},c1={class:"text-retro-text"},u1={class:"flex items-center gap-2"},d1=["disabled"],f1=["disabled"],m1=Me({__name:"RebaseConfirm",props:{baseBranch:{},worktreeBranch:{},worktreePath:{}},emits:["confirm","cancel"],setup(e,{emit:n}){const t=e,a=n,s=C(null),l=C(!1),c=C(t.baseBranch),f=C([]),m=C(!1);async function d(T){try{const g=await $fetch("/api/chat/compare",{params:{worktreePath:t.worktreePath,baseBranch:T}});s.value=g.ahead}catch{s.value=null}}ut(async()=>{const T=d(c.value),g=(async()=>{m.value=!0;try{const v=await $fetch("/api/git/branches");f.value=v.branches.filter(h=>!h.isRemote&&!h.name.startsWith("br/")&&!h.name.startsWith("br/p-")).map(h=>h.name),f.value.length>0&&!f.value.includes(c.value)&&(c.value=f.value.includes("main")?"main":f.value.includes("master")?"master":f.value[0])}catch{f.value=[]}finally{m.value=!1}})();await Promise.all([T,g])}),De(c,T=>{d(T)});function w(){l.value=!0,a("confirm",c.value)}return(T,g)=>(i(),u("div",Qg,[r("div",Jg,[g[3]||(g[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:g[0]||(g[0]=v=>a("cancel"))},[Q(o(vt),{class:"w-4 h-4"})])]),r("div",e1,[r("div",t1,[g[4]||(g[4]=r("span",{class:"text-retro-muted"},"worktree:",-1)),r("span",n1,S(e.worktreeBranch),1)]),r("div",r1,[g[5]||(g[5]=r("span",{class:"text-retro-muted"},"target:",-1)),r("div",o1,[Pe(r("select",{"onUpdate:modelValue":g[1]||(g[1]=v=>c.value=v),disabled:l.value||m.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"},[m.value?(i(),u("option",{key:0,value:e.baseBranch},S(e.baseBranch),9,a1)):N("",!0),(i(!0),u(me,null,Ee(f.value,v=>(i(),u("option",{key:v,value:v},S(v),9,i1))),128))],8,s1),[[Tn,c.value]]),Q(o(Xr),{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",l1,[g[6]||(g[6]=r("span",{class:"text-retro-muted"},"commits ahead:",-1)),r("span",c1,S(s.value!==null?s.value:"..."),1)])]),r("div",u1,[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:w},[Q(o(Kr),{class:"w-3.5 h-3.5"}),_e(" "+S(l.value?"Rebasing...":"Confirm"),1)],8,d1),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:g[2]||(g[2]=v=>a("cancel"))}," Cancel ",8,f1)])]))}}),h1={class:"flex-1 flex flex-col overflow-hidden"},p1={class:"flex-shrink-0 px-4 py-2 border-b border-retro-border flex items-center justify-between bg-retro-dark"},v1={class:"text-xs font-mono text-retro-text truncate"},g1={class:"flex items-center gap-2 flex-shrink-0"},x1=["title"],b1=["disabled"],y1=["disabled"],w1={key:5,class:"text-xs font-mono text-retro-green"},k1={key:6,class:"text-[11px] font-mono text-retro-muted"},C1={key:0,class:"flex items-center justify-center h-full text-retro-muted text-xs font-mono"},$1=["innerHTML"],S1=["value","readonly"],_1={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"},T1=Me({__name:"ConflictFileEditor",props:{file:{},resolved:{type:Boolean},aiResolving:{type:Boolean}},emits:["resolve","aiResolve"],setup(e,{emit:n}){const t=e,a=n,s=C(t.file.content),l=C(!1),c=C(""),f=C(!1);De(()=>t.file.path,()=>{s.value=t.file.content,l.value=!1,v()}),De(()=>t.file.content,()=>{l.value||(s.value=t.file.content,v())});const m=/^<{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,w=U(()=>/^<{7}\s/m.test(s.value)),T=U(()=>A(s.value).length);function g(Z){const j=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"}[j]||"text"}async function v(){f.value=!0;try{const{codeToHtml:Z}=await Cn(async()=>{const{codeToHtml:W}=await import("./BrvVRCvW.js");return{codeToHtml:W}},__vite__mapDeps([3,1,2]),import.meta.url),j=g(t.file.path),B=s.value.split(`
114
+ `);let X="",M=!1,p=!1,k=0,H=-1;for(const W of B){k++;const ae=/^<{7}\s/.test(W),G=/^={7}$/.test(W),R=/^>{7}\s/.test(W);if(ae){H++,M=!0,p=!1,X+=`<div class="conflict-line conflict-marker-line" data-line="${k}"><span class="line-number">${k}</span><span class="line-content conflict-marker">${h(W)}</span></div>
115
+ `,t.resolved||(X+=V(H));continue}if(G&&M){M=!1,p=!0,X+=`<div class="conflict-line conflict-marker-line" data-line="${k}"><span class="line-number">${k}</span><span class="line-content conflict-marker">${h(W)}</span></div>
116
+ `;continue}if(R){p=!1,X+=`<div class="conflict-line conflict-marker-line" data-line="${k}"><span class="line-number">${k}</span><span class="line-content conflict-marker">${h(W)}</span></div>
117
+ `;continue}let $=h(W);try{const K=(await Z(W||" ",{lang:j,theme:"vitesse-dark"})).match(/<code[^>]*><span class="line">(.*?)<\/span><\/code>/s);K&&($=K[1])}catch{}let I="";M?I="conflict-ours":p&&(I="conflict-theirs"),X+=`<div class="conflict-line ${I}" data-line="${k}"><span class="line-number">${k}</span><span class="line-content">${$}</span></div>
118
+ `}c.value=X}catch{const Z=s.value.split(`
119
+ `);c.value=Z.map((j,F)=>{const B=F+1;return`<div class="conflict-line" data-line="${B}"><span class="line-number">${B}</span><span class="line-content">${h(j)}</span></div>`}).join(`
120
+ `)}finally{f.value=!1}}function h(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function P(){te("ours")}function q(){te("theirs")}function A(Z){const j=[],F=new RegExp(d.source,d.flags);let B=null,X=0;for(;(B=F.exec(Z))!==null;)j.push({index:X,start:B.index,end:F.lastIndex,ours:B[1]??"",theirs:B[2]??""}),X++;return j}function ee(Z,j){return Z?j?Z.endsWith(`
121
+ `)||j.startsWith(`
122
+ `)?`${Z}${j}`:`${Z}
123
+ ${j}`:Z:j}function te(Z,j){const F=s.value,B=A(F);if(B.length){if(typeof j=="number"){const X=B.find(p=>p.index===j);if(!X)return;const M=Z==="ours"?X.ours:Z==="theirs"?X.theirs:ee(X.ours,X.theirs);s.value=F.slice(0,X.start)+M+F.slice(X.end)}else s.value=F.replace(m,(X,M,p)=>Z==="ours"?M:Z==="theirs"?p:ee(M,p));v()}}function V(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 j=Z.target?.closest("button[data-conflict-action]");if(!j||t.resolved)return;const F=j.dataset.conflictAction,B=j.dataset.conflictIndex;if(!F||B===void 0)return;const X=Number.parseInt(B,10);Number.isNaN(X)||te(F,X)}function ie(){w.value||a("resolve",t.file.path,s.value)}function ue(){a("aiResolve",t.file.path)}function fe(){l.value=!l.value,l.value||v()}function ne(Z){const j=Z.target;s.value=j.value}return ut(()=>{v()}),(Z,j)=>(i(),u("div",h1,[r("div",p1,[r("span",v1,S(e.file.path),1),r("div",g1,[e.resolved?N("",!0):(i(),u("button",{key:0,type:"button",class:ge(["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(),ce(o(rs),{key:0,class:"w-3.5 h-3.5 inline-block"})):(i(),ce(o(Jr),{key:1,class:"w-3.5 h-3.5 inline-block"}))],10,x1)),!e.resolved&&w.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},[Q(o(gr),{class:"w-3.5 h-3.5"}),_e(" "+S(e.aiResolving?"Resolving...":"AI Resolve"),1)],8,b1)):N("",!0),!e.resolved&&w.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:P}," Accept All Ours ")):N("",!0),!e.resolved&&w.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:q}," Accept All Theirs ")):N("",!0),e.resolved?N("",!0):(i(),u("button",{key:4,type:"button",disabled:w.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:ie}," Mark Resolved ",8,y1)),e.resolved?(i(),u("span",w1," Resolved ")):T.value>0?(i(),u("span",k1,S(T.value)+" conflict "+S(T.value===1?"block":"blocks"),1)):N("",!0)])]),l.value?N("",!0):(i(),u("div",{key:0,class:ge(["flex-1 overflow-auto bg-retro-black conflict-viewer",{"opacity-60":e.resolved}]),onClick:re},[f.value?(i(),u("div",C1," Highlighting... ")):(i(),u("div",{key:1,class:"conflict-code",innerHTML:c.value},null,8,$1))],2)),l.value?(i(),u("textarea",{key:1,value:s.value,readonly:e.resolved,class:ge(["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:ne},null,42,S1)):N("",!0),w.value&&!e.resolved?(i(),u("div",_1," File still contains conflict markers. Remove all <<<<<<<, =======, >>>>>>> markers to resolve. ")):N("",!0)]))}}),M1={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/60"},A1={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"},B1={class:"flex-shrink-0 px-4 py-3 border-b border-retro-border flex items-center justify-between"},E1={class:"flex items-center gap-3"},R1={class:"text-xs font-mono text-retro-muted"},P1={class:"flex items-center gap-2"},D1=["disabled"],I1=["disabled"],L1=["disabled"],N1={key:0,class:"flex-1 flex items-center justify-center text-retro-muted text-sm font-mono"},F1={key:1,class:"flex-1 flex items-center justify-center text-retro-red text-sm font-mono"},H1={key:2,class:"flex-1 flex overflow-hidden"},O1={class:"w-64 flex-shrink-0 border-r border-retro-border overflow-y-auto bg-retro-dark"},U1={class:"py-1"},j1=["onClick"],z1={key:1,class:"flex-1 flex items-center justify-center text-retro-muted text-sm font-mono"},V1=Me({__name:"ConflictResolutionModal",emits:["close"],setup(e,{emit:n}){const t=n,a=gt(),s=C(null),l=C(!1),c=C(!1),f=C(null),m=C(!1),d=U(()=>a.conflictState?.files??[]),w=U(()=>a.conflictState?.resolvedFiles??new Set),T=U(()=>d.value.length),g=U(()=>w.value.size),v=U(()=>T.value>0&&g.value>=T.value),h=U(()=>T.value-g.value),P=U(()=>s.value?d.value.find(ue=>ue.path===s.value)??null:null);function q(ue){return w.value.has(ue)}function A(ue){s.value=ue}async function ee(ue,fe){await a.resolveConflictFile(ue,fe)}async function te(ue){f.value=ue,await a.aiResolveConflictFile(ue),f.value=null}async function V(){m.value=!0,await a.aiResolveAllConflicts(),m.value=!1}async function re(){l.value=!0;const ue=await a.continueRebase();l.value=!1,ue.success&&t("close")}async function ie(){c.value=!0,await a.abortRebase(),c.value=!1,t("close")}return(ue,fe)=>(i(),ce(Jt,{to:"body"},[Q(Sn,{"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",M1,[r("div",A1,[r("div",B1,[r("div",E1,[Q(o($n),{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",R1,S(g.value)+"/"+S(T.value)+" resolved ",1)]),r("div",P1,[h.value>0?(i(),u("button",{key:0,type:"button",disabled:m.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:V},[Q(o(gr),{class:"w-3.5 h-3.5"}),_e(" "+S(m.value?"AI Resolving...":`AI Resolve All (${h.value})`),1)],8,D1)):N("",!0),r("button",{type:"button",disabled:!v.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},S(l.value?"Continuing...":"Continue Rebase"),9,I1),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:ie},S(c.value?"Aborting...":"Abort"),9,L1)])]),o(a).conflictState?.loading?(i(),u("div",N1," Loading conflict files... ")):o(a).conflictState?.error?(i(),u("div",F1,S(o(a).conflictState.error),1)):(i(),u("div",H1,[r("div",O1,[r("div",U1,[(i(!0),u(me,null,Ee(d.value,ne=>(i(),u("button",{key:ne.path,type:"button",class:ge(["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===ne.path}]),onClick:Z=>A(ne.path)},[q(ne.path)?(i(),ce(o(vr),{key:0,class:"w-3.5 h-3.5 text-retro-green flex-shrink-0"})):(i(),ce(o(In),{key:1,class:"w-3.5 h-3.5 text-retro-yellow flex-shrink-0"})),r("span",{class:ge(["truncate",q(ne.path)?"text-retro-green":"text-retro-yellow"])},S(ne.path),3)],10,j1))),128))])]),P.value?(i(),ce(T1,{key:0,file:P.value,resolved:q(P.value.path),"ai-resolving":f.value===P.value.path||m.value,onResolve:ee,onAiResolve:te},null,8,["file","resolved","ai-resolving"])):(i(),u("div",z1," Select a file to resolve "))]))])])):N("",!0)]),_:1})]))}}),W1={key:0,class:"w-full max-w-md mx-4 bg-retro-dark border border-retro-border rounded-lg shadow-xl"},G1={class:"flex items-center justify-between p-4 border-b border-retro-border"},q1={class:"flex items-center gap-2"},Z1={class:"p-4"},K1={class:"mt-2 text-sm text-retro-text font-mono truncate"},Y1={class:"flex justify-end gap-3 p-4 border-t border-retro-border"},X1=Me({__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(),ce(Jt,{to:"body"},[Q(Sn,{"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},[Q(Sn,{"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",W1,[r("div",G1,[r("div",q1,[Q(o($n),{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"},[Q(o(vt),{class:"w-5 h-5 text-retro-muted"})])]),r("div",Z1,[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",K1,' "'+S(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",Y1,[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 ")])])):N("",!0)]),_:1})])):N("",!0)]),_:1})]))}}),Q1={class:"h-full flex flex-col bg-retro-black"},J1={class:"flex-shrink-0 h-12 flex items-center justify-between px-4 border-b border-retro-border bg-retro-dark"},ex={class:"flex items-center gap-2 min-w-0"},tx={class:"text-xs font-mono text-retro-text truncate"},nx={class:"flex items-center gap-1"},rx=["disabled","title"],ox=["title"],sx=["title"],ax=["disabled"],ix={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"},lx={class:"flex-1 min-h-0 flex flex-col"},cx=Me({__name:"ChatPanel",setup(e){const n=gt(),t=_s(),{disconnectConversation:a}=po();ut(async()=>{try{const k=await $fetch("/api/cwd");n.setCwd(k.cwd)}catch{}});const s=U(()=>n.activeConversation?.title||"New Chat"),l=C(!1),c=U(()=>t.isChatFullscreen),f=C(!1);function m(){t.toggleChatFullscreen()}async function d(){l.value=!1;const k=n.activeConversationId;k&&(a(k),await n.deleteConversation(k)),n.clearMessages()}function w(){n.hasMessages&&(l.value=!0)}function T(){l.value=!1}const g=C(!1),v=C(null),h=U(()=>n.activeConversation?.finalized===!0),P=U(()=>h.value),q=C(null),A=C(!1);async function ee(){const k=n.activeConversation;if(!k?.worktreePath||!k?.baseBranch){q.value=null;return}A.value=!0;try{const H=await $fetch("/api/chat/compare",{params:{worktreePath:k.worktreePath,baseBranch:k.baseBranch}});q.value=H}catch{q.value=null}finally{A.value=!1}}De(()=>[n.activeConversationId,n.activeConversation?.worktreePath,n.activeConversation?.baseBranch,n.activeConversation?.lastCommitTime],()=>{ee()},{immediate:!0});const te=U(()=>q.value?q.value.ahead===0&&q.value.behind===0:!1),V=U(()=>{const k=n.activeConversation;return k?.hasWorktree&&!k?.finalized&&!n.isActiveConversationStreaming}),re=U(()=>V.value&&!te.value);function ie(){g.value=!0,v.value=null}async function ue(k,H){const W=n.activeConversationId;if(!W)return;const ae=await n.finalizeConversation(W,k,H);if(g.value=!1,ae.success)v.value={type:"success",message:`Merged to ${H}`},setTimeout(()=>{v.value=null},5e3);else if(ae.rebaseInProgress)v.value=null;else{const G=ae.conflictFiles?.length?`Conflict in: ${ae.conflictFiles.join(", ")}`:ae.error||"Finalize failed";v.value={type:"error",message:G}}}function fe(){g.value=!1}function ne(){if(!n.conflictState&&n.activeConversation?.hasWorktree){const k=n.activeConversation?.baseBranch||"main";v.value={type:"success",message:`Rebased onto ${k}`},setTimeout(()=>{v.value=null},5e3)}else v.value=null}const Z=C(!1),j=U(()=>!!n.activeConversation?.previewBranch);async function F(){const k=n.activeConversationId;if(!k)return;Z.value=!0,v.value=null;const H=j.value,W=await n.togglePreview(k);if(W.success){const ae=H?`Switched back to ${n.activeConversation?.baseBranch}`:"Preview active — main worktree updated";v.value={type:"success",message:ae},setTimeout(()=>{v.value=null},3e3)}else v.value={type:"error",message:W.error||"Preview toggle failed"};Z.value=!1}const B=C(!1);function X(){B.value=!0,v.value=null}async function M(k){const H=n.activeConversationId;if(!H)return;const W=await n.rebaseConversation(H,k);B.value=!1,W.success?(v.value={type:"success",message:`Rebased onto ${k}`},setTimeout(()=>{v.value=null},5e3)):W.rebaseInProgress?v.value=null:v.value={type:"error",message:W.error||"Rebase failed"}}function p(){B.value=!1}return(k,H)=>(i(),u("div",Q1,[r("div",J1,[r("div",ex,[r("span",tx,S(o(s)),1)]),r("div",nx,[o(V)?(i(),u("button",{key:0,disabled:o(Z),class:"p-1.5 rounded hover:bg-retro-panel transition-colors disabled:opacity-40",title:o(j)?"End preview: switch back to base branch":"Preview: test worktree changes in main worktree",onClick:F},[o(j)?(i(),ce(o(na),{key:0,class:"w-4 h-4 text-retro-orange"})):(i(),ce(o(rs),{key:1,class:"w-4 h-4 text-retro-cyan"}))],8,rx)):N("",!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:X},[Q(o(gn),{class:"w-4 h-4 text-retro-purple"})])):N("",!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:ie},[Q(o(vr),{class:"w-4 h-4 text-retro-green"})])):N("",!0),r("button",{class:"p-1.5 rounded hover:bg-retro-panel transition-colors",title:o(c)?"Exit fullscreen chat":"Fullscreen chat",onClick:m},[o(c)?(i(),ce(o(Ko),{key:0,class:"w-4 h-4 text-retro-muted"})):(i(),ce(o(Yo),{key:1,class:"w-4 h-4 text-retro-muted"}))],8,ox),r("button",{class:"p-1.5 rounded hover:bg-retro-panel transition-colors",title:o(f)?"Hide debug stream":"Show debug stream",onClick:H[0]||(H[0]=W=>f.value=!o(f))},[Q(o(qs),{class:ge(["w-4 h-4",o(f)?"text-retro-yellow":"text-retro-muted"])},null,8,["class"])],8,sx),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:w},[Q(o(an),{class:"w-4 h-4 text-retro-muted"})],8,ax)])]),Q(X1,{show:o(l),title:o(s),onConfirm:d,onCancel:T},null,8,["show","title"]),o(g)&&o(n).activeConversation?.hasWorktree?(i(),ce(Xg,{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"])):N("",!0),o(B)&&o(n).activeConversation?.hasWorktree?(i(),ce(m1,{key:1,"base-branch":o(n).activeConversation.baseBranch||"main","worktree-branch":o(n).activeConversation.worktreeBranch||"","worktree-path":o(n).activeConversation.worktreePath||"",onConfirm:M,onCancel:p},null,8,["base-branch","worktree-branch","worktree-path"])):N("",!0),o(n).conflictState?(i(),ce(V1,{key:2,onClose:ne})):N("",!0),o(v)?(i(),u("div",{key:3,class:ge(["flex-shrink-0 px-4 py-2 border-b border-retro-border text-xs font-mono",o(v).type==="success"?"bg-retro-green/10 text-retro-green":"bg-retro-red/10 text-retro-red"])},[_e(S(o(v).message)+" ",1),o(v).type==="error"?(i(),u("button",{key:0,class:"ml-2 underline hover:no-underline",onClick:H[1]||(H[1]=W=>v.value=null)}," dismiss ")):N("",!0)],2)):N("",!0),o(h)?(i(),u("div",ix," This conversation has been finalized and is read-only. ")):N("",!0),r("div",lx,[Q(Zv,{class:"flex-1 overflow-hidden"}),o(f)?(i(),ce(Dg,{key:0})):N("",!0)]),Q($g,{disabled:o(P)},null,8,["disabled"])]))}}),ux={class:"flex-shrink-0 flex items-center justify-between px-4 py-2 border-b border-retro-border bg-retro-panel"},dx={class:"flex items-center gap-2 min-w-0"},fx=["title"],mx={class:"text-retro-text font-mono text-sm truncate"},hx={class:"text-retro-muted"},px={class:"text-retro-text"},vx={class:"text-retro-muted font-mono text-xs flex-shrink-0"},gx={class:"flex-1 overflow-auto"},xx={key:0,class:"flex items-center justify-center gap-2 text-retro-muted text-sm py-8"},bx={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"},wx={key:3,class:"w-full text-xs font-mono border-collapse diff-table"},kx={key:0,class:"diff-warning"},Cx={key:0,colspan:"3",class:"diff-hunk-header px-4 py-1"},$x={class:"diff-line-num select-none text-right px-2 w-12"},Sx={class:"diff-line-num select-none text-right px-2 w-12 border-r border-retro-border"},_x={class:"diff-line-content px-3 whitespace-pre-wrap break-all"},Tx={key:0,class:"diff-sign"},Mx={key:1,class:"diff-sign"},Ax={key:2,class:"diff-sign"},Bx={key:4,class:"flex items-center justify-center text-retro-muted text-sm py-8"},Ex=Me({__name:"GitFileDiffViewer",props:{file:{},commitHash:{},content:{},loading:{type:Boolean}},emits:["close"],setup(e,{emit:n}){const t=e,a=n,s=C(null),l=U(()=>t.commitHash.substring(0,7)),c=U(()=>Pn[t.file.status]||{label:t.file.status,colorClass:"text-retro-muted"}),f=U(()=>t.file.status==="R"&&t.file.oldPath);function m(d){d.key==="Escape"&&(d.preventDefault(),d.stopPropagation(),a("close"))}return ut(()=>{s.value?.focus()}),$t(()=>{}),(d,w)=>(i(),u("div",{ref_key:"containerRef",ref:s,tabindex:0,onKeydown:m,class:"flex flex-col h-full bg-retro-dark focus:outline-none","aria-label":"File diff viewer",role:"region"},[r("div",ux,[r("div",dx,[r("span",{class:ge(["flex-shrink-0 w-5 h-5 flex items-center justify-center text-xs font-bold rounded",c.value.colorClass]),title:c.value.label},S(e.file.status),11,fx),r("span",mx,[f.value&&e.file.oldPath?(i(),u(me,{key:0},[r("span",hx,S(e.file.oldPath),1),w[1]||(w[1]=r("span",{class:"text-retro-yellow mx-1"},"→",-1)),r("span",px,S(e.file.path),1)],64)):(i(),u(me,{key:1},[_e(S(e.file.path),1)],64))]),r("span",vx," @ "+S(l.value),1)]),r("button",{onClick:w[0]||(w[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)"},[Q(o(vt),{class:"w-5 h-5 text-retro-muted hover:text-retro-text"})])]),r("div",gx,[e.loading?(i(),u("div",xx,[...w[2]||(w[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",bx,[...w[3]||(w[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,[...w[4]||(w[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",wx,[r("tbody",null,[e.content.truncated?(i(),u("tr",kx,[...w[5]||(w[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)])])):N("",!0),(i(!0),u(me,null,Ee(e.content.lines,(T,g)=>(i(),u("tr",{key:g,class:ge({"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",Cx,S(T.content),1)):(i(),u(me,{key:1},[r("td",$x,S(T.oldLineNumber??""),1),r("td",Sx,S(T.newLineNumber??""),1),r("td",_x,[T.type==="add"?(i(),u("span",Tx,"+")):T.type==="delete"?(i(),u("span",Mx,"-")):(i(),u("span",Ax," ")),_e(" "+S(T.content),1)])],64))],2))),128))])])):(i(),u("div",Bx," Failed to load diff content. "))])],544))}}),Rx=qr(Ex,[["__scopeId","data-v-c726b0c5"]]),Px={class:"fixed inset-0 z-50 flex items-center justify-center"},Dx={class:"relative w-[90vw] max-w-lg bg-retro-black border border-retro-border rounded-lg shadow-2xl flex flex-col overflow-hidden"},Ix={class:"flex-shrink-0 h-12 flex items-center justify-between px-4 border-b border-retro-border bg-retro-dark"},Lx={class:"flex items-center gap-2"},Nx={class:"text-sm font-mono text-retro-text"},Fx={class:"p-6 overflow-y-auto max-h-[70vh] space-y-6"},Hx={key:0},Ox={class:"space-y-6"},Ux={class:"space-y-1.5"},jx=["value","checked","onChange"],zx={class:"flex-1"},Vx={class:"text-sm font-mono text-retro-text"},Wx={class:"text-xs text-retro-muted leading-tight"},Gx={class:"text-xs font-mono text-retro-muted"},qx={class:"text-xs text-retro-muted mb-3"},Zx=["disabled"],Kx={class:"space-y-1.5"},Yx=["value","checked","onChange"],Xx={class:"flex-1"},Qx={class:"text-sm font-mono text-retro-text"},Jx={class:"text-xs text-retro-muted leading-tight"},e0={class:"flex items-center gap-4 px-3 py-2 rounded border border-retro-border bg-retro-panel"},t0=["value"],n0={class:"font-mono text-retro-cyan text-sm w-6 text-center"},r0={key:1,class:"space-y-4"},o0={class:"space-y-1.5"},s0=["checked"],a0=["checked"],i0=Me({__name:"SettingsModal",emits:["close"],setup(e,{emit:n}){const t=n,a=Kn(),s=Dn(),l=C("main"),c=C(!1),f=[{value:"dark",label:"Dark",description:"Retro terminal theme with dark backgrounds"},{value:"light",label:"Light",description:"Bright theme for well-lit environments"}],m=[{value:"plan",label:Bn.plan,description:tr.plan,icon:Qr,color:"text-retro-cyan"},{value:"ask",label:Bn.ask,description:tr.ask,icon:eo,color:"text-retro-green"},{value:"auto",label:Bn.auto,description:tr.auto,icon:Zr,color:"text-retro-yellow"},{value:"bypass",label:Bn.bypass,description:tr.bypass,icon:to,color:"text-retro-red"}],{data:d,pending:w,error:T}=Co("ai-providers",()=>$fetch("/api/ai/providers"),{server:!1}),g=U(()=>d.value?.providers??[]),v=U(()=>{const F=T.value;return F?F instanceof Error?F.message:String(F):null}),{data:h,refresh:P}=Co("spec-search-status",()=>$fetch("/api/specs/status"),{server:!1,default:()=>null}),q=U(()=>{const F=h.value;return F?F.isIndexing?`Indexing (${F.currentJob||"running"})`:F.schedulerActive?`Indexed ${F.fileCount} files / ${F.chunkCount} chunks`:"Scheduler inactive":"Status unavailable"});ut(()=>{a.hydrate()});const A=F=>{a.setProviderSelection(F),s.success("Settings saved")},ee=()=>{l.value="provider"},te=()=>{l.value="main"},V=F=>{a.setTheme(F),s.success("Settings saved")},re=F=>{a.setPermissionMode(F),s.success("Settings saved")},ie=F=>{const B=parseInt(F.target.value,10);isNaN(B)||(a.setAutoModeConcurrency(B),s.success("Settings saved"))},ue=F=>{a.setAutoGenerateCommitMessages(F),s.success("Settings saved")},fe=()=>{t("close")},ne=async()=>{if(!c.value){c.value=!0;try{const F=await $fetch("/api/specs/reindex",{method:"POST",body:{}});!F.success&&F.status==="already-indexing"?s.info("Spec index is already running"):s.success("Spec reindex started"),await P()}catch(F){s.error(F instanceof Error?F.message:"Failed to start spec reindex")}finally{c.value=!1}}},Z=F=>{F.key==="Escape"&&t("close")};ut(()=>{window.addEventListener("keydown",Z)}),$t(()=>{window.removeEventListener("keydown",Z)});let j=null;return ut(()=>{j=mo(()=>{P()},5e3)}),$t(()=>{j&&clearInterval(j)}),(F,B)=>(i(),ce(Jt,{to:"body"},[r("div",Px,[r("div",{class:"absolute inset-0 bg-black/70",onClick:fe}),r("div",Dx,[r("div",Ix,[r("div",Lx,[l.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:te},[Q(o(Ws),{class:"h-4 w-4"})])):N("",!0),r("h2",Nx,S(l.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:B[0]||(B[0]=X=>t("close"))},[Q(o(vt),{class:"h-4 w-4"})])]),r("div",Fx,[l.value==="main"?(i(),u("section",Hx,[r("div",Ox,[r("section",null,[B[3]||(B[3]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Theme",-1)),B[4]||(B[4]=r("p",{class:"text-xs text-retro-muted mb-3"}," Choose between dark and light appearance. ",-1)),r("div",Ux,[(i(),u(me,null,Ee(f,X=>r("label",{key:X.value,class:ge(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[o(a).theme===X.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:X.value,checked:o(a).theme===X.value,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:M=>V(X.value)},null,40,jx),r("div",zx,[r("div",Vx,S(X.label),1),r("div",Wx,S(X.description),1)])],2)),64))])]),B[14]||(B[14]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[B[6]||(B[6]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"AI Provider",-1)),B[7]||(B[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:ee},[B[5]||(B[5]=r("span",{class:"text-sm font-mono text-retro-text"},"Provider Settings",-1)),r("span",Gx,S(o(a).providerSelection.providerId)+" / "+S(o(a).providerSelection.modelKey),1)])]),B[15]||(B[15]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[B[8]||(B[8]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Spec Search Index",-1)),r("p",qx,S(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:c.value||o(h)?.isIndexing,onClick:ne},S(c.value?"Starting reindex...":"Reindex Specs"),9,Zx)]),B[16]||(B[16]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[B[9]||(B[9]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Default Permission Mode",-1)),B[10]||(B[10]=r("p",{class:"text-xs text-retro-muted mb-3"}," Set the default permission mode for all new chat conversations. ",-1)),r("div",Kx,[(i(),u(me,null,Ee(m,X=>r("label",{key:X.value,class:ge(["flex items-center gap-3 px-3 py-2 rounded border cursor-pointer transition-colors",[o(a).permissionMode===X.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:X.value,checked:o(a).permissionMode===X.value,class:"w-3.5 h-3.5 text-retro-cyan accent-retro-cyan",onChange:M=>re(X.value)},null,40,Yx),(i(),ce(En(X.icon),{class:ge(["w-4 h-4 flex-shrink-0",X.color])},null,8,["class"])),r("div",Xx,[r("div",Qx,S(X.label),1),r("div",Jx,S(X.description),1)])],2)),64))])]),B[17]||(B[17]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[B[12]||(B[12]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Auto Mode",-1)),B[13]||(B[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",e0,[B[11]||(B[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:ie},null,40,t0),r("span",n0,S(o(a).autoModeConcurrency),1)])])])])):(i(),u("section",r0,[B[18]||(B[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)),Q(Os,{providers:g.value,selected:o(a).providerSelection,permissionMode:o(a).permissionMode,pending:o(w),errorMessage:v.value,onSelect:A},null,8,["providers","selected","permissionMode","pending","errorMessage"])])),B[23]||(B[23]=r("div",{class:"border-t border-retro-border"},null,-1)),r("section",null,[B[21]||(B[21]=r("h3",{class:"text-sm font-mono font-semibold text-retro-text mb-1"},"Commit Messages",-1)),B[22]||(B[22]=r("p",{class:"text-xs text-retro-muted mb-3"}," Choose whether to use AI to generate commit messages automatically. ",-1)),r("div",o0,[r("label",{class:ge(["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:B[1]||(B[1]=X=>ue(!1))},null,40,s0),B[19]||(B[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:ge(["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:B[2]||(B[2]=X=>ue(!0))},null,40,a0),B[20]||(B[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)])])])])])]))}}),l0={class:"fixed top-4 right-4 z-50 flex flex-col gap-2 max-w-sm"},c0={class:"flex-1 text-sm font-mono text-retro-text"},u0=["onClick"],d0=Me({__name:"ToastContainer",setup(e){const{toasts:n,remove:t}=Dn(),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 vr;case"error":return In;case"warning":return $n;default:return aa}};return(l,c)=>(i(),ce(Jt,{to:"body"},[r("div",l0,[Q(Ps,{"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(me,null,Ee(o(n),f=>(i(),u("div",{key:f.id,class:ge(["flex items-start gap-3 p-3 rounded-lg border shadow-lg",[a[f.type].bg,a[f.type].border]])},[(i(),ce(En(s(f.type)),{class:ge(["h-5 w-5 flex-shrink-0 mt-0.5",a[f.type].icon])},null,8,["class"])),r("p",c0,S(f.message),1),r("button",{type:"button",class:"p-0.5 rounded text-retro-muted hover:text-retro-text transition-colors",onClick:m=>o(t)(f.id)},[Q(o(vt),{class:"h-4 w-4"})],8,u0)],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 f0(){const e=Kn(),n=U(()=>e.theme),t=U(()=>e.theme==="dark");function a(){const s=e.theme==="dark"?"light":"dark";e.setTheme(s),Uo(s)}return De(()=>e.theme,s=>{Uo(s)},{immediate:!0}),{theme:n,isDark:t,toggleTheme:a}}const m0={class:"flex h-screen min-w-[320px] overflow-x-auto bg-retro-black text-retro-text"},h0={class:"flex flex-col overflow-hidden",style:{flex:"3"}},p0={class:"flex-shrink-0 h-14 flex items-center justify-between px-4 border-b border-retro-border bg-retro-panel"},v0={class:"flex items-center gap-2 min-w-0"},g0={key:0,class:"text-xs text-retro-muted font-mono truncate"},x0={class:"flex items-center gap-1"},b0=["title"],y0={class:"flex-1 min-h-0 overflow-y-auto"},w0={class:"relative flex min-w-0",style:{flex:"7"}},k0={class:"flex flex-col overflow-hidden border-l border-retro-border",style:{flex:"2"}},C0={class:"flex flex-col overflow-hidden border-l border-retro-border",style:{flex:"2"}},$0={key:0,class:"absolute inset-0 z-30 flex flex-col overflow-hidden border-l border-retro-border bg-retro-black"},A0=Me({__name:"default",setup(e){const n=_s(),t=Kn(),a=gt(),s=Qn(),{isDark:l,toggleTheme:c}=f0(),f=U(()=>s.diffViewerFile!==null),m=U(()=>n.isChatFullscreen),d=U(()=>m.value),w=U(()=>m.value?7:3),T=C(!1),g=C(""),v=U(()=>{if(!g.value)return"";const q=g.value.replace(/\/+$/,"").split("/");return q[q.length-1]||""}),h=U(()=>v.value?`spec cat :: ${v.value}`:"spec cat");Ds(()=>({title:h.value}));const P=()=>{typeof window<"u"&&n.updateViewport(window.innerWidth)};return ut(async()=>{typeof window<"u"&&(n.updateViewport(window.innerWidth),window.addEventListener("resize",P)),await t.hydrate(),await a.initialize(),await a.loadConversations();try{const q=await $fetch("/api/cwd");g.value=q.cwd}catch{g.value=""}}),$t(()=>{typeof window<"u"&&window.removeEventListener("resize",P)}),(q,A)=>{const ee=wm;return i(),u("div",m0,[r("div",h0,[r("div",p0,[r("div",v0,[A[4]||(A[4]=r("img",{alt:"SpecCat",src:km,class:"w-5 h-5 text-retro-cyan mb-1"},null,-1)),A[5]||(A[5]=r("span",{class:"text-sm font-bold text-retro-cyan font-mono uppercase tracking-wider flex-shrink-0"},"SPECCAT",-1)),v.value?(i(),u("span",g0,"/ "+S(v.value),1)):N("",!0)]),r("div",x0,[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:A[0]||(A[0]=(...te)=>o(c)&&o(c)(...te))},[o(l)?(i(),ce(o(fa),{key:0,class:"w-5 h-5"})):(i(),ce(o(ca),{key:1,class:"w-5 h-5"}))],8,b0),r("button",{type:"button",class:"p-2 rounded transition-colors text-retro-muted hover:text-retro-text hover:bg-retro-panel",title:"Settings",onClick:A[1]||(A[1]=te=>T.value=!0)},[Q(o(ts),{class:"w-5 h-5"})])])]),r("div",y0,[Q(ee,{"working-directory":g.value},null,8,["working-directory"])])]),r("div",w0,[Pe(r("div",k0,[Q(Ph)],512),[[xo,!d.value]]),Pe(r("div",C0,[Q(Cp)],512),[[xo,!d.value]]),r("div",{class:"flex flex-col overflow-hidden border-l border-retro-border",style:kt({flex:w.value})},[Q(cx)],4),f.value?(i(),u("div",$0,[Q(Rx,{file:o(s).diffViewerFile,"commit-hash":o(s).diffViewerCommitHash,content:o(s).diffViewerContent,loading:o(s).diffViewerLoading,onClose:A[2]||(A[2]=te=>o(s).closeFileDiff())},null,8,["file","commit-hash","content","loading"])])):N("",!0)]),T.value?(i(),ce(i0,{key:0,onClose:A[3]||(A[3]=te=>T.value=!1)})):N("",!0),Q(d0)])}}});export{A0 as default};