@deslop/workbench 0.0.344 → 0.0.357

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 (39) hide show
  1. package/dist/client/assets/-workbench-terminal-DyfxJcjD.js +145 -0
  2. package/dist/client/assets/agent-CA1IdfRT.js +1 -0
  3. package/dist/client/assets/agent-COvRE6oy.js +2 -0
  4. package/dist/client/assets/button-Dz6Az3h_.js +16 -0
  5. package/dist/client/assets/{diff-BwOj6t_o.js → diff-BqnMP7Ys.js} +44 -44
  6. package/dist/client/assets/{diff-COOvYjfB.js → diff-CLnQZZVT.js} +2 -2
  7. package/dist/client/assets/{external-link-DR7_wu3r.js → external-link-DPI4TAq4.js} +1 -1
  8. package/dist/client/assets/{fallbacks-D-9MltuA.js → fallbacks-uU4M5NOw.js} +1 -1
  9. package/dist/client/assets/{index-DCRiD9Nz.js → index-Mo4bEjHb.js} +3 -3
  10. package/dist/client/assets/input-group-1-P7Y_75.js +153 -0
  11. package/dist/client/assets/loader-circle-BxillczB.js +1 -0
  12. package/dist/client/assets/{portless-nerboxiJ.js → portless-ClPWjTC4.js} +1 -1
  13. package/dist/client/assets/portless-QJD7ZmA9.js +2 -0
  14. package/dist/client/assets/{resizable-ChkQg6Mj.js → resizable-BaJ5ba6-.js} +1 -1
  15. package/dist/client/assets/route-C-L2dkin.js +45 -0
  16. package/dist/client/assets/route-b5JXfzPO.js +2 -0
  17. package/dist/client/assets/run-C0ukWbxF.js +2 -0
  18. package/dist/client/assets/run-cjBxZ3gl.js +1 -0
  19. package/dist/client/assets/state-CVjPP5QG.js +2 -0
  20. package/dist/client/assets/terminal-B5ko1jIG.js +2 -0
  21. package/dist/client/assets/terminal-CA1dMT3m.js +1 -0
  22. package/dist/client/assets/{triangle-alert-CQsOhrGn.js → triangle-alert-CTEZG9zF.js} +1 -1
  23. package/dist/client/index.html +11 -11
  24. package/dist/server.js +519 -1553
  25. package/package.json +2 -4
  26. package/dist/client/assets/agent-BATV5D0O.js +0 -1
  27. package/dist/client/assets/agent-K-v27T1K.js +0 -2
  28. package/dist/client/assets/button-f42ZKq6E.js +0 -16
  29. package/dist/client/assets/input-group-mMwtG03E.js +0 -153
  30. package/dist/client/assets/loader-circle-DEYAvEPU.js +0 -1
  31. package/dist/client/assets/portless-C8dLcQQw.js +0 -2
  32. package/dist/client/assets/route-DAz8IJkt.js +0 -2
  33. package/dist/client/assets/route-GFqYSDK4.js +0 -45
  34. package/dist/client/assets/run-B16WQaws.js +0 -2
  35. package/dist/client/assets/run-BHEbhvk3.js +0 -1
  36. package/dist/client/assets/state-BOj5tZ-Q.js +0 -2
  37. package/dist/client/assets/terminal-B410vkZ0.js +0 -1
  38. package/dist/client/assets/terminal-BQ9AR6VK.js +0 -145
  39. package/dist/client/assets/terminal-Br297Oa8.js +0 -2
@@ -0,0 +1 @@
1
+ import{Zo as e}from"./button-Dz6Az3h_.js";var t=e(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]);export{t};
@@ -1 +1 @@
1
- import{r as e}from"./chunk-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-rGeCHUuX.js";import{$o as i,D as a,Ot as o,Ro as s,T as c,V as l,Ws as u,X as d,Y as f,Zo as p,ao as m,dr as h,et as g,ha as _,mt as v,st as y,t as b,vr as x}from"./button-f42ZKq6E.js";import{a as S,n as C,r as w}from"./fallbacks-D-9MltuA.js";import{t as T}from"./triangle-alert-CQsOhrGn.js";import{i as E,n as D,r as O,t as k,y as A}from"./resizable-ChkQg6Mj.js";import{t as j}from"./external-link-DR7_wu3r.js";import{r as M,t as N,y as P}from"./state-BOj5tZ-Q.js";import{t as F}from"./portless-C8dLcQQw.js";var I=i(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),L=i(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),R=i(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),z=i(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),B=i(`file-clock`,[[`path`,{d:`M16 22h2a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v2.85`,key:`ryk6xj`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 14v2.2l1.6 1`,key:`6m4bie`}],[`circle`,{cx:`8`,cy:`16`,r:`6`,key:`10v15b`}]]),V=i(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),H=i(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),U=r(),W=e(n(),1),G=t();function K(e,t){return`${e}${t.startsWith(`/`)?t:`/${t}`}`}function q(e){if(e===``)return`localhost:0000`;try{return new URL(e).host}catch{return e.replace(/^https?:\/\//u,``)}}var J=g([d({deslopBrowserFavicon:l(!0),href:v(f)}),d({deslopBrowserLocation:l(!0),path:v(f)}),d({deslopBrowserLog:l(!0),level:f,message:f})]);function Y(e){return e===`error`?`text-destructive`:e===`warn`?`text-chart-2`:e===`info`?`text-chart-1`:e===`debug`?`text-chart-4`:`text-muted-foreground`}function X(e){let t=(0,U.c)(5);if(e.level===`error`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(I,{className:`size-3.5`}),t[0]=e):e=t[0],e}if(e.level===`warn`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(T,{className:`size-3.5`}),t[1]=e):e=t[1],e}if(e.level===`info`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(S,{className:`size-3.5`}),t[2]=e):e=t[2],e}if(e.level===`debug`){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(z,{className:`size-3.5`}),t[3]=e):e=t[3],e}let n;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(A,{className:`size-2`}),t[4]=n):n=t[4],n}function Z(e){let t=e.toLowerCase();return e.startsWith(`[vite]`)||t.includes(`react scan`)||t.includes(`react-scan`)||t.includes(`react grab`)||t.includes(`react-grab`)}function Q(e){let t=(0,W.useRef)(null),n=(0,W.useRef)(0),r=e.origin??``,[i,l]=(0,W.useState)(()=>r?K(r,`/`):``),[u,d]=(0,W.useState)(0),[f,g]=(0,W.useState)(`/`),[_,v]=(0,W.useState)(),[S,T]=(0,W.useState)(!1),[A,M]=(0,W.useState)(()=>r!==``),[N,P]=(0,W.useState)([]);(0,W.useEffect)(()=>{g(`/`),l(r?K(r,`/`):``),v(void 0),M(r!==``)},[r]),(0,W.useLayoutEffect)(()=>{T(!1);function e(e){e.origin===r&&p(y(J)(e.data),m({onNone:()=>{},onSome:e=>{if(`deslopBrowserFavicon`in e){v(e.href);return}if(`deslopBrowserLocation`in e){g(e.path??`/`);return}ee(e.level,e.message)}}))}return window.addEventListener(`message`,e),T(!0),()=>{window.removeEventListener(`message`,e),T(!1)}},[r]);function F(){if(h(r))return;let e=K(r,x(f)||`/`);P([]),l(e),v(void 0),M(!0)}function I(){P([]),M(!0),d(e=>e+1)}function z(){h(r)||(P([]),t.current?.contentWindow?.postMessage({deslopBrowserClear:!0},r))}function U(){h(i)||window.open(i,`_blank`,`noopener,noreferrer`)}function Q(){try{t.current?.contentWindow?.history.back()}catch{}}function $(){try{t.current?.contentWindow?.history.forward()}catch{}}function ee(e,t){Z(t)||P(r=>[...r.slice(-199),{id:n.current++,level:e,message:t,time:o()}])}return(0,G.jsxs)(`div`,{className:c(`bg-background flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden border`,e.className),children:[(0,G.jsxs)(`form`,{className:`bg-muted/30 flex shrink-0 items-center gap-1 border-b p-2`,onSubmit:e=>{e.preventDefault(),F()},children:[(0,G.jsx)(b,{type:`button`,variant:`outline`,size:`icon`,"aria-label":`Back`,onClick:Q,children:(0,G.jsx)(L,{className:`size-3.5`})}),(0,G.jsx)(b,{type:`button`,variant:`outline`,size:`icon`,"aria-label":`Forward`,onClick:$,children:(0,G.jsx)(R,{className:`size-3.5`})}),(0,G.jsx)(b,{type:`button`,variant:`outline`,size:`icon`,"aria-label":`Reload`,onClick:I,children:(0,G.jsx)(V,{className:`size-3.5`})}),(0,G.jsx)(`div`,{className:`border-border flex h-8 w-8 shrink-0 items-center justify-center border`,children:s(_)&&(0,G.jsx)(`img`,{src:_,alt:``,className:`size-4`})}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1`,children:[(0,G.jsx)(`div`,{className:`border-input bg-secondary text-secondary-foreground/70 flex h-8 min-w-0 shrink items-center border px-2 text-xs`,children:(0,G.jsx)(`span`,{className:`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,children:q(r)})}),(0,G.jsx)(E,{value:f.startsWith(`/`)?f.slice(1):f,placeholder:``,className:`min-w-[7rem] flex-1 text-xs`,onChange:e=>{g(`/${e.currentTarget.value.replace(/^\/+/,``)}`)}})]}),(0,G.jsx)(b,{type:`button`,variant:`outline`,size:`icon`,"aria-label":`Open top-level preview`,onClick:U,children:(0,G.jsx)(j,{className:`size-3.5`})}),r&&(0,G.jsx)(b,{type:`button`,variant:`outline`,size:`icon`,"aria-label":`Clear cookies`,onClick:z,children:(0,G.jsx)(H,{className:`size-3.5`})})]}),(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[r===``?(0,G.jsx)(C,{message:`Start a dev server in this worktree terminal to open a browser preview.`}):(0,G.jsxs)(O,{orientation:`vertical`,className:`min-h-0 flex-1`,children:[(0,G.jsx)(D,{defaultSize:`100%`,minSize:`40%`,children:(0,G.jsxs)(`div`,{className:`relative h-full min-h-0 w-full`,children:[(0,G.jsx)(`iframe`,{ref:t,title:i,src:S?i:void 0,className:`bg-background h-full min-h-0 w-full border-0`,onLoad:()=>{M(!1)}},u),A&&(0,G.jsx)(`div`,{className:`bg-background absolute inset-0 flex`,children:(0,G.jsx)(w,{})})]})}),(0,G.jsx)(k,{}),(0,G.jsx)(D,{collapsible:!0,collapsedSize:0,defaultSize:0,minSize:0,maxSize:`50%`,children:(0,G.jsx)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,children:(0,G.jsx)(`div`,{className:c(`min-h-0 flex-1 overflow-auto font-mono text-xs`,N.length===0&&`hidden`),children:N.map(e=>(0,G.jsxs)(`div`,{className:`grid grid-cols-[8rem_1rem_minmax(0,1fr)] gap-3 px-2 py-1`,children:[(0,G.jsx)(`span`,{className:`overflow-hidden whitespace-nowrap select-none`,children:a(e.time)}),(0,G.jsx)(`span`,{className:c(`flex shrink-0 items-center select-none`,Y(e.level)),title:e.level,children:(0,G.jsx)(X,{level:e.level})}),(0,G.jsx)(`span`,{className:`min-w-0 break-words whitespace-pre-wrap select-text`,children:e.message})]},e.id))})})})]}),(0,G.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center justify-between border-b px-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-xs`,children:[(0,G.jsx)(B,{className:`size-3.5`}),(0,G.jsx)(`span`,{children:N.length})]}),(0,G.jsx)(b,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Clear browser logs`,onClick:()=>{P([])},children:(0,G.jsx)(H,{className:`size-3.5`})})]})]})]})}function $(){let e=(0,U.c)(10),t=F.useParams(),n=F.useSearch(),r;e[0]===t.worktree?r=e[1]:(r=N(t.worktree),e[0]=t.worktree,e[1]=r);let i=P(r),a=i.value.activeWorktree?.root??``,o;e[2]===a?o=e[3]:(o=M(a),e[2]=a,e[3]=o);let c=P(o);if(!i.value.activeWorktree){let t;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(u,{to:`/`,replace:!0}),e[4]=t):t=e[4],t}let l;e[5]!==c||e[6]!==n.origin?(l=s(n.origin)&&p(c.value,_(n.origin))?n.origin:c.value[0],e[5]=c,e[6]=n.origin,e[7]=l):l=e[7];let d=l,f;return e[8]===d?f=e[9]:(f=(0,G.jsx)(`div`,{className:`bg-background h-full min-h-0 min-w-0 p-2`,children:(0,G.jsx)(Q,{className:`h-full min-h-0 w-full min-w-0`,origin:d})}),e[8]=d,e[9]=f),f}export{$ as component};
1
+ import{r as e}from"./chunk-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-rGeCHUuX.js";import{D as i,Hs as a,Io as o,Ot as s,T as c,V as l,X as u,Y as d,Yo as f,Zo as p,_r as m,et as h,ma as g,mt as _,ro as v,st as y,t as b,ur as x}from"./button-Dz6Az3h_.js";import{a as S,n as C,r as w}from"./fallbacks-uU4M5NOw.js";import{t as T}from"./triangle-alert-CTEZG9zF.js";import{i as E,n as D,r as O,t as k,y as A}from"./resizable-BaJ5ba6-.js";import{t as j}from"./external-link-DPI4TAq4.js";import{r as M,t as N,x as P}from"./state-CVjPP5QG.js";import{t as F}from"./portless-QJD7ZmA9.js";var I=p(`circle-alert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),L=p(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),R=p(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),z=p(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),B=p(`file-clock`,[[`path`,{d:`M16 22h2a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v2.85`,key:`ryk6xj`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 14v2.2l1.6 1`,key:`6m4bie`}],[`circle`,{cx:`8`,cy:`16`,r:`6`,key:`10v15b`}]]),V=p(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]),H=p(`trash-2`,[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),U=r(),W=e(n(),1),G=t();function K(e,t){return`${e}${t.startsWith(`/`)?t:`/${t}`}`}function q(e){if(e===``)return`localhost:0000`;try{return new URL(e).host}catch{return e.replace(/^https?:\/\//u,``)}}var J=h([u({deslopBrowserFavicon:l(!0),href:_(d)}),u({deslopBrowserLocation:l(!0),path:_(d)}),u({deslopBrowserLog:l(!0),level:d,message:d})]);function Y(e){return e===`error`?`text-destructive`:e===`warn`?`text-chart-2`:e===`info`?`text-chart-1`:e===`debug`?`text-chart-4`:`text-muted-foreground`}function X(e){let t=(0,U.c)(5);if(e.level===`error`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(I,{className:`size-3.5`}),t[0]=e):e=t[0],e}if(e.level===`warn`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(T,{className:`size-3.5`}),t[1]=e):e=t[1],e}if(e.level===`info`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(S,{className:`size-3.5`}),t[2]=e):e=t[2],e}if(e.level===`debug`){let e;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(z,{className:`size-3.5`}),t[3]=e):e=t[3],e}let n;return t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(A,{className:`size-2`}),t[4]=n):n=t[4],n}function Z(e){let t=e.toLowerCase();return e.startsWith(`[vite]`)||t.includes(`react scan`)||t.includes(`react-scan`)||t.includes(`react grab`)||t.includes(`react-grab`)}function Q(e){let t=(0,W.useRef)(null),n=(0,W.useRef)(0),r=e.origin??``,[a,l]=(0,W.useState)(()=>r?K(r,`/`):``),[u,d]=(0,W.useState)(0),[p,h]=(0,W.useState)(`/`),[g,_]=(0,W.useState)(),[S,T]=(0,W.useState)(!1),[A,M]=(0,W.useState)(()=>r!==``),[N,P]=(0,W.useState)([]);(0,W.useEffect)(()=>{h(`/`),l(r?K(r,`/`):``),_(void 0),M(r!==``)},[r]),(0,W.useLayoutEffect)(()=>{T(!1);function e(e){e.origin===r&&f(y(J)(e.data),v({onNone:()=>{},onSome:e=>{if(`deslopBrowserFavicon`in e){_(e.href);return}if(`deslopBrowserLocation`in e){h(e.path??`/`);return}ee(e.level,e.message)}}))}return window.addEventListener(`message`,e),T(!0),()=>{window.removeEventListener(`message`,e),T(!1)}},[r]);function F(){if(x(r))return;let e=K(r,m(p)||`/`);P([]),l(e),_(void 0),M(!0)}function I(){P([]),M(!0),d(e=>e+1)}function z(){x(r)||(P([]),t.current?.contentWindow?.postMessage({deslopBrowserClear:!0},r))}function U(){x(a)||window.open(a,`_blank`,`noopener,noreferrer`)}function Q(){try{t.current?.contentWindow?.history.back()}catch{}}function $(){try{t.current?.contentWindow?.history.forward()}catch{}}function ee(e,t){Z(t)||P(r=>[...r.slice(-199),{id:n.current++,level:e,message:t,time:s()}])}return(0,G.jsxs)(`div`,{className:c(`bg-background flex h-full min-h-0 w-full min-w-0 flex-col overflow-hidden border`,e.className),children:[(0,G.jsxs)(`form`,{className:`bg-muted/30 flex shrink-0 items-center gap-1 border-b p-2`,onSubmit:e=>{e.preventDefault(),F()},children:[(0,G.jsx)(b,{type:`button`,variant:`outline`,size:`icon`,"aria-label":`Back`,onClick:Q,children:(0,G.jsx)(L,{className:`size-3.5`})}),(0,G.jsx)(b,{type:`button`,variant:`outline`,size:`icon`,"aria-label":`Forward`,onClick:$,children:(0,G.jsx)(R,{className:`size-3.5`})}),(0,G.jsx)(b,{type:`button`,variant:`outline`,size:`icon`,"aria-label":`Reload`,onClick:I,children:(0,G.jsx)(V,{className:`size-3.5`})}),(0,G.jsx)(`div`,{className:`border-border flex h-8 w-8 shrink-0 items-center justify-center border`,children:o(g)&&(0,G.jsx)(`img`,{src:g,alt:``,className:`size-4`})}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1`,children:[(0,G.jsx)(`div`,{className:`border-input bg-secondary text-secondary-foreground/70 flex h-8 min-w-0 shrink items-center border px-2 text-xs`,children:(0,G.jsx)(`span`,{className:`min-w-0 overflow-hidden text-ellipsis whitespace-nowrap`,children:q(r)})}),(0,G.jsx)(E,{value:p.startsWith(`/`)?p.slice(1):p,placeholder:``,className:`min-w-[7rem] flex-1 text-xs`,onChange:e=>{h(`/${e.currentTarget.value.replace(/^\/+/,``)}`)}})]}),(0,G.jsx)(b,{type:`button`,variant:`outline`,size:`icon`,"aria-label":`Open top-level preview`,onClick:U,children:(0,G.jsx)(j,{className:`size-3.5`})}),r&&(0,G.jsx)(b,{type:`button`,variant:`outline`,size:`icon`,"aria-label":`Clear cookies`,onClick:z,children:(0,G.jsx)(H,{className:`size-3.5`})})]}),(0,G.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[r===``?(0,G.jsx)(C,{message:`Start a dev server in this worktree terminal to open a browser preview.`}):(0,G.jsxs)(O,{orientation:`vertical`,className:`min-h-0 flex-1`,children:[(0,G.jsx)(D,{defaultSize:`100%`,minSize:`40%`,children:(0,G.jsxs)(`div`,{className:`relative h-full min-h-0 w-full`,children:[(0,G.jsx)(`iframe`,{ref:t,title:a,src:S?a:void 0,className:`bg-background h-full min-h-0 w-full border-0`,onLoad:()=>{M(!1)}},u),A&&(0,G.jsx)(`div`,{className:`bg-background absolute inset-0 flex`,children:(0,G.jsx)(w,{})})]})}),(0,G.jsx)(k,{}),(0,G.jsx)(D,{collapsible:!0,collapsedSize:0,defaultSize:0,minSize:0,maxSize:`50%`,children:(0,G.jsx)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,children:(0,G.jsx)(`div`,{className:c(`min-h-0 flex-1 overflow-auto font-mono text-xs`,N.length===0&&`hidden`),children:N.map(e=>(0,G.jsxs)(`div`,{className:`grid grid-cols-[8rem_1rem_minmax(0,1fr)] gap-3 px-2 py-1`,children:[(0,G.jsx)(`span`,{className:`overflow-hidden whitespace-nowrap select-none`,children:i(e.time)}),(0,G.jsx)(`span`,{className:c(`flex shrink-0 items-center select-none`,Y(e.level)),title:e.level,children:(0,G.jsx)(X,{level:e.level})}),(0,G.jsx)(`span`,{className:`min-w-0 break-words whitespace-pre-wrap select-text`,children:e.message})]},e.id))})})})]}),(0,G.jsxs)(`div`,{className:`flex h-8 shrink-0 items-center justify-between border-b px-2`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2 font-mono text-xs`,children:[(0,G.jsx)(B,{className:`size-3.5`}),(0,G.jsx)(`span`,{children:N.length})]}),(0,G.jsx)(b,{type:`button`,variant:`ghost`,size:`icon-xs`,"aria-label":`Clear browser logs`,onClick:()=>{P([])},children:(0,G.jsx)(H,{className:`size-3.5`})})]})]})]})}function $(){let e=(0,U.c)(10),t=F.useParams(),n=F.useSearch(),r;e[0]===t.worktree?r=e[1]:(r=N(t.worktree),e[0]=t.worktree,e[1]=r);let i=P(r),s=i.value.activeWorktree?.root??``,c;e[2]===s?c=e[3]:(c=M(s),e[2]=s,e[3]=c);let l=P(c);if(!i.value.activeWorktree){let t;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(a,{to:`/`,replace:!0}),e[4]=t):t=e[4],t}let u;e[5]!==l||e[6]!==n.origin?(u=o(n.origin)&&f(l.value,g(n.origin))?n.origin:l.value[0],e[5]=l,e[6]=n.origin,e[7]=u):u=e[7];let d=u,p;return e[8]===d?p=e[9]:(p=(0,G.jsx)(`div`,{className:`bg-background h-full min-h-0 min-w-0 p-2`,children:(0,G.jsx)(Q,{className:`h-full min-h-0 w-full min-w-0`,origin:d})}),e[8]=d,e[9]=p),p}export{$ as component};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/portless-ClPWjTC4.js","assets/chunk-QTnfLwEv.js","assets/state-CVjPP5QG.js","assets/button-Dz6Az3h_.js","assets/compiler-runtime-rGeCHUuX.js","assets/resizable-BaJ5ba6-.js","assets/external-link-DPI4TAq4.js","assets/fallbacks-uU4M5NOw.js","assets/triangle-alert-CTEZG9zF.js"])))=>i.map(i=>d[i]);
2
+ import{$o as e,X as t,Y as n,es as r,mt as i,vt as a}from"./button-Dz6Az3h_.js";import{t as o}from"./preload-helper-CjdClQve.js";var s=r(`/(home)/$worktree/portless`)({component:e(()=>o(()=>import(`./portless-ClPWjTC4.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8])),`component`),validateSearch:a(t({origin:i(n)}))});export{s as t};
@@ -1 +1 @@
1
- import{r as e}from"./chunk-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-rGeCHUuX.js";import{$o as i,C as a,T as o,c as s,d as c,f as l,i as u,n as d,p as f,r as p,u as m,v as h}from"./button-f42ZKq6E.js";var g=i(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),_=`none`,v=`trigger-press`,y=`trigger-hover`,b=`outside-press`,x=`close-press`,S=`focus-out`,C=`escape-key`,w=`imperative-action`,T=e(n());function E(e,t,n,r){let i=!1,a=!1,o=r??p;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var D=0;function O(e,t=`mui`){let[n,r]=T.useState(e),i=e||n;return T.useEffect(()=>{n??(D+=1,r(`${t}-${D}`))},[n,t]),i}var k=f.useId;function A(e,t){if(k!==void 0){let n=k();return e??(t?`${t}-${n}`:n)}return O(e,t)}function ee(e){return A(e,`base-ui`)}function te(e){return e?.ownerDocument||document}function ne(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function re(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&a(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function ie(e){return`composedPath`in e?e.composedPath()[0]:e.target}var j=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),ae={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},M={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},oe={disabled:!1,...M},se={valid(e){return e===null?null:e?{[j.valid]:``}:{[j.invalid]:``}}},ce={invalid:void 0,name:void 0,validityData:{state:ae,errors:[],error:``,value:``,initialValue:null},setValidityData:u,disabled:void 0,touched:M.touched,setTouched:u,dirty:M.dirty,setDirty:u,filled:M.filled,setFilled:u,focused:M.focused,setFocused:u,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:oe,markedDirtyRef:{current:!1},registerFieldControl:u,validation:{getValidationProps:(e=p)=>e,getInputValidationProps:(e=p)=>e,inputRef:{current:null},commit:async()=>{}}},le=T.createContext(ce);function ue(e=!0){let t=T.useContext(le);if(t.setValidityData===u&&!e)throw Error(s(28));return t}var de=T.createContext({controlId:void 0,registerControlId:u,labelId:void 0,setLabelId:u,messageIds:[],setMessageIds:u,getDescriptionProps:e=>e});function fe(){return T.useContext(de)}function pe({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=T.useRef(e!==void 0),[a,o]=T.useState(t);return[i?e:a,T.useCallback(e=>{i||o(e)},[])]}function me(e,t,n,r,i=!0){let{registerFieldControl:a}=ue(),o=T.useRef(null);o.current||=Symbol(),m(()=>{let s=o.current;if(!(!s||!i))return a(s,{controlRef:e,getValue:r,id:t,value:n}),()=>{a(s,void 0)}},[e,i,r,t,a,n])}function he(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=fe(),o=ee(t),s=n?i:void 0,d=l(()=>Symbol(`labelable-control`)),f=T.useRef(!1),p=T.useRef(t!=null),g=c(()=>{!f.current||a===u||(f.current=!1,a(d.current,void 0))});return m(()=>{if(a===u)return;let e;if(n){let n=r?.current;e=h(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)p.current=!0,e=t;else if(p.current)e=o;else{g();return}if(e===void 0){g();return}f.current=!0,a(d.current,e)},[t,r,s,a,n,o,d,g]),T.useEffect(()=>g,[g]),i??o}var ge=T.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:l,defaultValue:u,autoFocus:f=!1,style:p,...h}=e,{state:g,name:v,disabled:y,setTouched:b,setDirty:x,validityData:S,setFocused:C,setFilled:w,validationMode:D,validation:O}=ue(),k=y||s,A=v??a,ee={...g,disabled:k},{labelId:re}=fe(),ie=he({id:i});m(()=>{let e=o!=null;O.inputRef.current?.value||e&&o!==``?w(!0):e&&o===``&&w(!1)},[O.inputRef,w,o]);let j=T.useRef(null);m(()=>{f&&j.current===ne(te(j.current))&&C(!0)},[f,C]);let[ae]=pe({controlled:o,default:u,name:`FieldControl`,state:`value`}),M=o!==void 0,oe=M?ae:void 0,ce=c(()=>O.inputRef.current?.value);return me(O.inputRef,ie,oe,ce),d(`input`,e,{ref:[t,j],state:ee,props:[{id:ie,disabled:k,name:A,ref:O.inputRef,"aria-labelledby":re,autoFocus:f,...M?{value:oe}:{defaultValue:u},onChange(e){let t=e.currentTarget.value;l?.(t,E(_,e.nativeEvent)),x(t!==S.initialValue),w(t!==``)},onFocus(){C(!0)},onBlur(e){b(!0),C(!1),D===`onBlur`&&O.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(b(!0),O.commit(e.currentTarget.value))}},O.getInputValidationProps(),h],stateAttributesMapping:se})}),N=t(),_e=T.forwardRef(function(e,t){return(0,N.jsx)(ge,{ref:t,...e})}),ve=r();function ye(e){let t=(0,ve.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,type:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=o(`border-input file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 disabled:bg-input/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:disabled:bg-input/80 h-8 w-full min-w-0 rounded-none border bg-transparent px-2.5 py-1 font-normal transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:font-normal focus-visible:ring-1 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-1`,n),t[4]=n,t[5]=a);let s;return t[6]!==r||t[7]!==a||t[8]!==i?(s=(0,N.jsx)(_e,{type:i,"data-slot":`input`,className:a,...r}),t[6]=r,t[7]=a,t[8]=i,t[9]=s):s=t[9],s}function be(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function xe(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function Se(e){return e/100*window.innerHeight}function Ce(e){return e/100*window.innerWidth}function we(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function P({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=we(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=xe(t,i);break;case`em`:r=be(t,i);break;case`vh`:r=Se(i);break;case`vw`:r=Ce(i);break}return r}function F(e){return parseFloat(e.toFixed(3))}function I({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function Te(e){let{panels:t}=e,n=I({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=F(P({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=F(P({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=F(P({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=F(P({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function L(e,t=`Assertion error`){if(!e)throw Error(t)}function Ee(e,t){return Array.from(t).sort(e===`horizontal`?De:Oe)}function De(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Oe(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function ke(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Ae(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function je({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=Ae(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return L(i,`No rect found`),i}var Me;function Ne(){return Me===void 0&&(Me=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Me}function Pe(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Ee(n,Array.from(t.children).filter(ke).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,je({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=Ne()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:I({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var Fe=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},R=new Map,Ie=new Fe;function Le(e){R=new Map(R),R.delete(e)}function Re(e,t){for(let[t]of R)if(t.id===e)return t}function z(e,t){for(let[t,n]of R)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function B(){return R}function ze(e,t){return Ie.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function V(e,t){let n=R.get(e);R=new Map(R),R.set(e,t),Ie.emit(`groupChange`,{group:e,prev:n,next:t})}function Be(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Ae(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function Ve(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function He(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Je(e),b:Je(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();L(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:qe(Ke(n.a)),b:qe(Ke(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var Ue=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function We(e){let t=getComputedStyle(Ye(e)??e).display;return t===`flex`||t===`inline-flex`}function Ge(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||We(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||Ue.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Ke(e){let t=e.length;for(;t--;){let n=e[t];if(L(n,`Missing node`),Ge(n))return n}return null}function qe(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Je(e){let t=[];for(;e;)t.push(e),e=Ye(e);return t}function Ye(e){let{parentNode:t}=e;return Ve(t)?t.host:t}function Xe(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Ze({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!ke(n)||n.contains(e)||e.contains(n))return!0;if(He(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Xe(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Qe(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Pe(r),a=Be(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Ze({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function $e(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function H(e,t,n=0){return Math.abs(F(e)-F(t))<=n}function U(e,t){return H(e,t)?0:e>t?1:-1}function W({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(U(r,c)<0)if(a){let e=(i+c)/2;r=U(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=F(r),r}function G({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(H(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;L(u!=null,`Invalid first pivot index`),L(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];L(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(L(n!=null,`Previous layout not found for panel index ${t}`),H(n,i)){let t=o-n;U(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];L(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(L(n!=null,`Previous layout not found for panel index ${t}`),H(n,o)){let t=n-i;U(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];L(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&U(i,c)<0)if(e>0){let t=c-o,n=t/2;U(i+e,c)<0&&(e=U(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;U(i-e,c)<0&&(e=U(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];L(e!=null,`Previous layout not found for panel index ${r}`);let a=W({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];L(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=W({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!H(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if($e(c,l))return i;{let t=e<0?d:u,r=s[t];L(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=W({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!H(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];L(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=W({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(H(i,s)||(t-=s-i,l[r]=s),H(t,0))break;e>0?r--:r++}}}if(!H(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function K(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||U(e[n],t[n])!==0)return!1;return!0}function q({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!H(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];L(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];L(i!=null,`No layout data found for index ${e}`);let o=r[e];L(o!=null,`No layout data found for index ${e}`);let s=W({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!H(a,0))for(let e=0;e<t.length;e++){let n=r[e];L(n!=null,`No layout data found for index ${e}`);let i=n+a,o=W({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,H(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function et({groupId:e,panelId:t}){let n=()=>{let t=B();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&H(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:F(100-e)}}return G({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=q({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});K(c,u)||V(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&H(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=I({group:t});s(F(P({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function tt(e){e.defaultPrevented||Qe(e,B()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=et({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function nt(e){let t=B();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function rt({groupId:e}){let t=()=>{let t=B();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=q({layout:e,panelConstraints:r});return n?o:(K(o,c)||V(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function J(e,t){let n=nt(e),r=z(n.id,!0),i=n.separators.find(t=>t.element===e);L(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);L(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=rt({groupId:n.id}).getLayout(),c=q({layout:G({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});K(s,c)||V(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function it(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=nt(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&J(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&J(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&J(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&J(t,-5);break;case`End`:e.preventDefault(),J(t,100);break;case`Enter`:{e.preventDefault();let n=nt(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=z(n.id,!0),o=n.separators.find(e=>e.element===t);L(o,`Matching separator not found`);let s=a.get(o);L(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(L(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];J(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=nt(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);L(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),J(t,-100);break}}var Y={cursorFlags:0,state:`inactive`},at=new Fe;function X(){return Y}function ot(e){return at.addListener(`change`,e)}function st(e){let t=Y,n={...Y};n.cursorFlags=e,Y=n,at.emit(`change`,{prev:t,next:n})}function Z(e){let t=Y;Y=e,at.emit(`change`,{prev:t,next:e})}function ct(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=B(),n=Qe(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),Z({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var lt=e=>e,ut=()=>{},dt=1,ft=2,pt=4,mt=8,ht=3,gt=12,_t;function vt(){return _t===void 0&&(_t=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(_t=!0)),_t}function yt({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&vt()){let t=(e&dt)!==0,n=(e&ft)!==0,r=(e&pt)!==0,i=(e&mt)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return vt()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var bt=new WeakMap;function xt(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=bt.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=X();switch(r.state){case`active`:case`hover`:{let e=yt({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}bt.set(e,{prevStyle:t,styleSheet:n})}function St({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=G({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(K(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?dt:ft;break;case`vertical`:s|=d<0?pt:mt;break}}else V(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&ht:c|=s&ht,t.movementY===0?c|=o&gt:c|=s&gt,st(c),xt(e)}function Ct(e){let t=B(),n=X();switch(n.state){case`active`:St({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function wt(e){if(e.defaultPrevented)return;let t=X(),n=B();switch(t.state){case`active`:if(e.buttons===0){Z({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=z(e.group.id,!0);V(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}St({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Qe(e,n);r.length===0?t.state!==`inactive`&&Z({cursorFlags:0,state:`inactive`}):Z({cursorFlags:0,hitRegions:r,state:`hover`}),xt(e.currentTarget);break}}}function Tt(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(X().state){case`hover`:Z({cursorFlags:0,state:`inactive`})}}function Et(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=X();switch(t.state){case`active`:Z({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(xt(e.currentTarget),t.hitRegions.forEach(e=>{let t=z(e.group.id,!0);V(e.group,t)}),e.preventDefault())}}function Dt(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=F(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=F((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Ot(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=I({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:F(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function kt(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function At({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=F(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=F((r[e]??0)/a*l);else{let e=F(l/c.length);for(let t of c)u[t]=e}return u}function jt(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var Q=new Map;function Mt(e){let t=!0;L(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=I({group:e});if(t===0)return;let n=z(e.id);if(!n)return;let r=Te(e),i=n.defaultLayoutDeferred?Dt(r):n.layout,a=q({layout:At({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&K(n.layout,a)&&kt(n.derivedPanelConstraints,r)&&n.groupSize===t)return;V(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Ot(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{L(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=I({group:e}),s=Te(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(jt(e.panels,l)||(l=void 0));let u=q({layout:e.mutableState.layouts[c]??l??Dt(s),panelConstraints:s}),d=e.element.ownerDocument;Q.set(d,(Q.get(d)??0)+1);let f=new Map;return Pe(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),V(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{L(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,it)}),Q.get(d)===1&&(d.addEventListener(`dblclick`,tt,!0),d.addEventListener(`pointerdown`,ct,!0),d.addEventListener(`pointerleave`,Ct),d.addEventListener(`pointermove`,wt),d.addEventListener(`pointerout`,Tt),d.addEventListener(`pointerup`,Et,!0)),function(){t=!1,Q.set(d,Math.max(0,(Q.get(d)??0)-1)),Le(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,it)}),Q.get(d)||(d.removeEventListener(`dblclick`,tt,!0),d.removeEventListener(`pointerdown`,ct,!0),d.removeEventListener(`pointerleave`,Ct),d.removeEventListener(`pointermove`,wt),d.removeEventListener(`pointerout`,Tt),d.removeEventListener(`pointerup`,Et,!0)),a.disconnect()}}function Nt(){let[e,t]=(0,T.useState)({});return[e,(0,T.useCallback)(()=>t({}),[])]}function Pt(e){let t=(0,T.useId)();return`${e??t}`}var $=typeof window<`u`?T.useLayoutEffect:T.useEffect;function Ft(e){let t=(0,T.useRef)(e);return $(()=>{t.current=e},[e]),(0,T.useCallback)((...e)=>t.current?.(...e),[t])}function It(...e){return Ft(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Lt(e){let t=(0,T.useRef)({...e});return $(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Rt=(0,T.createContext)(null);function zt(e,t){let n=(0,T.useRef)({getLayout:()=>({}),setLayout:lt});(0,T.useImperativeHandle)(t,()=>n.current,[]),$(()=>{Object.assign(n.current,rt({groupId:e}))})}function Bt({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,T.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=Ft(e=>{K(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Ft(e=>{K(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Pt(s),v=(0,T.useRef)(null),[y,b]=Nt(),x=(0,T.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=It(v,a);zt(_,o);let C=Ft((e,t)=>{let r=X(),i=Re(e),a=z(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=Lt({defaultLayout:n,disableCursor:r}),E=(0,T.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=Ee(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Ee(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=Re(_),i=z(_);r&&i&&V(r,{...i,derivedPanelConstraints:Te(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),D=(0,T.useRef)(null);return $(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};D.current=r;let a=Mt(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=z(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=ze(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=H(t.collapsedSize,i[t.panelId]),a=H(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=X().state!==`active`;h(i),o&&g(i)});return()=>{D.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,T.useEffect)(()=>{let e=D.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,N.jsx)(Rt.Provider,{value:E,children:(0,N.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}Bt.displayName=`Group`;function Vt(){let e=(0,T.useContext)(Rt);return L(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Ht(e,t){let{id:n}=Vt(),r=(0,T.useRef)({collapse:ut,expand:ut,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ut});(0,T.useImperativeHandle)(t,()=>r.current,[]),$(()=>{Object.assign(r.current,et({groupId:n,panelId:e}))})}function Ut({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=Pt(c),_=Lt({disabled:a}),v=(0,T.useRef)(null),y=It(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Vt(),E=d!==null,D=Ft((e,t,n)=>{d?.(e,c,n)});$(()=>{let e=v.current;if(e!==null)return C({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:E?D:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,E,g,h,l,u,D,C,_]),(0,T.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),Ht(g,f);let O=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},k=(0,T.useSyncExternalStore)(e=>ze(x,e),O,O),A;return A=k?JSON.parse(k):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,N.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...Wt,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...A},children:(0,N.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}Ut.displayName=`Panel`;var Wt={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Gt({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=q({layout:G({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=q({layout:G({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Kt({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Pt(a),l=Lt({disabled:n,disableDoubleClick:r}),[u,d]=(0,T.useState)({}),[f,p]=(0,T.useState)(`inactive`),[m,h]=(0,T.useState)(!1),g=(0,T.useRef)(null),_=It(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=Vt(),C=b===`horizontal`?`vertical`:`horizontal`;$(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=ot(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=ze(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(Gt({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,T.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let E;if(n)E=`disabled`;else switch(f){case`active`:E=`active`;break;default:E=m?`focus`:f}return(0,N.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":E,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}Kt.displayName=`Separator`;function qt(e){let t=(0,ve.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=o(`flex h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,N.jsx)(Bt,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Jt(e){let t=(0,ve.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,N.jsx)(Ut,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function Yt(e){let t=(0,ve.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===n?a=t[5]:(a=o(`bg-border ring-offset-background focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),t[4]=n,t[5]=a);let s;t[6]===i?s=t[7]:(s=i&&(0,N.jsx)(`div`,{className:`bg-border z-10 flex h-6 w-1 shrink-0 rounded-none`}),t[6]=i,t[7]=s);let c;return t[8]!==r||t[9]!==a||t[10]!==s?(c=(0,N.jsx)(Kt,{"data-slot":`resizable-handle`,className:a,...r,children:s}),t[8]=r,t[9]=a,t[10]=s,t[11]=c):c=t[11],c}export{y as _,ne as a,te as c,E as d,x as f,b as g,w as h,ye as i,ee as l,S as m,Jt as n,re as o,C as p,qt as r,ie as s,Yt as t,A as u,v,g as y};
1
+ import{r as e}from"./chunk-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-rGeCHUuX.js";import{C as i,T as a,Zo as o,c as s,d as c,f as l,i as u,n as d,p as f,r as p,u as m,v as h}from"./button-Dz6Az3h_.js";var g=o(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),_=`none`,v=`trigger-press`,y=`trigger-hover`,b=`outside-press`,x=`close-press`,S=`focus-out`,C=`escape-key`,w=`imperative-action`,T=e(n());function E(e,t,n,r){let i=!1,a=!1,o=r??p;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var D=0;function O(e,t=`mui`){let[n,r]=T.useState(e),i=e||n;return T.useEffect(()=>{n??(D+=1,r(`${t}-${D}`))},[n,t]),i}var k=f.useId;function A(e,t){if(k!==void 0){let n=k();return e??(t?`${t}-${n}`:n)}return O(e,t)}function ee(e){return A(e,`base-ui`)}function te(e){return e?.ownerDocument||document}function ne(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function re(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&i(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function ie(e){return`composedPath`in e?e.composedPath()[0]:e.target}var j=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),ae={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},M={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},oe={disabled:!1,...M},se={valid(e){return e===null?null:e?{[j.valid]:``}:{[j.invalid]:``}}},ce={invalid:void 0,name:void 0,validityData:{state:ae,errors:[],error:``,value:``,initialValue:null},setValidityData:u,disabled:void 0,touched:M.touched,setTouched:u,dirty:M.dirty,setDirty:u,filled:M.filled,setFilled:u,focused:M.focused,setFocused:u,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:oe,markedDirtyRef:{current:!1},registerFieldControl:u,validation:{getValidationProps:(e=p)=>e,getInputValidationProps:(e=p)=>e,inputRef:{current:null},commit:async()=>{}}},le=T.createContext(ce);function ue(e=!0){let t=T.useContext(le);if(t.setValidityData===u&&!e)throw Error(s(28));return t}var de=T.createContext({controlId:void 0,registerControlId:u,labelId:void 0,setLabelId:u,messageIds:[],setMessageIds:u,getDescriptionProps:e=>e});function fe(){return T.useContext(de)}function pe({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=T.useRef(e!==void 0),[a,o]=T.useState(t);return[i?e:a,T.useCallback(e=>{i||o(e)},[])]}function me(e,t,n,r,i=!0){let{registerFieldControl:a}=ue(),o=T.useRef(null);o.current||=Symbol(),m(()=>{let s=o.current;if(!(!s||!i))return a(s,{controlRef:e,getValue:r,id:t,value:n}),()=>{a(s,void 0)}},[e,i,r,t,a,n])}function he(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=fe(),o=ee(t),s=n?i:void 0,d=l(()=>Symbol(`labelable-control`)),f=T.useRef(!1),p=T.useRef(t!=null),g=c(()=>{!f.current||a===u||(f.current=!1,a(d.current,void 0))});return m(()=>{if(a===u)return;let e;if(n){let n=r?.current;e=h(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)p.current=!0,e=t;else if(p.current)e=o;else{g();return}if(e===void 0){g();return}f.current=!0,a(d.current,e)},[t,r,s,a,n,o,d,g]),T.useEffect(()=>g,[g]),i??o}var ge=T.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:l,defaultValue:u,autoFocus:f=!1,style:p,...h}=e,{state:g,name:v,disabled:y,setTouched:b,setDirty:x,validityData:S,setFocused:C,setFilled:w,validationMode:D,validation:O}=ue(),k=y||s,A=v??a,ee={...g,disabled:k},{labelId:re}=fe(),ie=he({id:i});m(()=>{let e=o!=null;O.inputRef.current?.value||e&&o!==``?w(!0):e&&o===``&&w(!1)},[O.inputRef,w,o]);let j=T.useRef(null);m(()=>{f&&j.current===ne(te(j.current))&&C(!0)},[f,C]);let[ae]=pe({controlled:o,default:u,name:`FieldControl`,state:`value`}),M=o!==void 0,oe=M?ae:void 0,ce=c(()=>O.inputRef.current?.value);return me(O.inputRef,ie,oe,ce),d(`input`,e,{ref:[t,j],state:ee,props:[{id:ie,disabled:k,name:A,ref:O.inputRef,"aria-labelledby":re,autoFocus:f,...M?{value:oe}:{defaultValue:u},onChange(e){let t=e.currentTarget.value;l?.(t,E(_,e.nativeEvent)),x(t!==S.initialValue),w(t!==``)},onFocus(){C(!0)},onBlur(e){b(!0),C(!1),D===`onBlur`&&O.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(b(!0),O.commit(e.currentTarget.value))}},O.getInputValidationProps(),h],stateAttributesMapping:se})}),N=t(),_e=T.forwardRef(function(e,t){return(0,N.jsx)(ge,{ref:t,...e})}),ve=r();function ye(e){let t=(0,ve.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,type:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let o;t[4]===n?o=t[5]:(o=a(`border-input file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 disabled:bg-input/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 dark:disabled:bg-input/80 h-8 w-full min-w-0 rounded-none border bg-transparent px-2.5 py-1 font-normal transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:font-normal focus-visible:ring-1 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-1`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==o||t[8]!==i?(s=(0,N.jsx)(_e,{type:i,"data-slot":`input`,className:o,...r}),t[6]=r,t[7]=o,t[8]=i,t[9]=s):s=t[9],s}function be(e,t){let n=getComputedStyle(e);return t*parseFloat(n.fontSize)}function xe(e,t){let n=getComputedStyle(e.ownerDocument.documentElement);return t*parseFloat(n.fontSize)}function Se(e){return e/100*window.innerHeight}function Ce(e){return e/100*window.innerWidth}function we(e){switch(typeof e){case`number`:return[e,`px`];case`string`:{let t=parseFloat(e);return e.endsWith(`%`)?[t,`%`]:e.endsWith(`px`)?[t,`px`]:e.endsWith(`rem`)?[t,`rem`]:e.endsWith(`em`)?[t,`em`]:e.endsWith(`vh`)?[t,`vh`]:e.endsWith(`vw`)?[t,`vw`]:[t,`%`]}}}function P({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=we(n);switch(a){case`%`:r=i/100*e;break;case`px`:r=i;break;case`rem`:r=xe(t,i);break;case`em`:r=be(t,i);break;case`vh`:r=Se(i);break;case`vw`:r=Ce(i);break}return r}function F(e){return parseFloat(e.toFixed(3))}function I({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>(e+=t===`horizontal`?n.element.offsetWidth:n.element.offsetHeight,e),0)}function Te(e){let{panels:t}=e,n=I({group:e});return n===0?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:e.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let{element:t,panelConstraints:r}=e,i=0;r.collapsedSize!==void 0&&(i=F(P({groupSize:n,panelElement:t,styleProp:r.collapsedSize})/n*100));let a;r.defaultSize!==void 0&&(a=F(P({groupSize:n,panelElement:t,styleProp:r.defaultSize})/n*100));let o=0;r.minSize!==void 0&&(o=F(P({groupSize:n,panelElement:t,styleProp:r.minSize})/n*100));let s=100;return r.maxSize!==void 0&&(s=F(P({groupSize:n,panelElement:t,styleProp:r.maxSize})/n*100)),{groupResizeBehavior:r.groupResizeBehavior,collapsedSize:i,collapsible:r.collapsible===!0,defaultSize:a,disabled:r.disabled,minSize:o,maxSize:s,panelId:e.id}})}function L(e,t=`Assertion error`){if(!e)throw Error(t)}function Ee(e,t){return Array.from(t).sort(e===`horizontal`?De:Oe)}function De(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return n===0?e.element.offsetWidth-t.element.offsetWidth:n}function Oe(e,t){let n=e.element.offsetTop-t.element.offsetTop;return n===0?e.element.offsetHeight-t.element.offsetHeight:n}function ke(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE}function Ae(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function je({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=Ae(r,n),s=e===`horizontal`?t:o;s<a&&(a=s,i=n)}return L(i,`No rect found`),i}var Me;function Ne(){return Me===void 0&&(Me=typeof matchMedia==`function`?!!matchMedia(`(pointer:coarse)`).matches:!1),Me}function Pe(e){let{element:t,orientation:n,panels:r,separators:i}=e,a=Ee(n,Array.from(t.children).filter(ke).map(e=>({element:e}))).map(({element:e})=>e),o=[],s=!1,c=!1,l=-1,u=-1,d=0,f,p=[];{let e=-1;for(let t of a)t.hasAttribute(`data-panel`)&&(e++,t.hasAttribute(`data-disabled`)||(d++,l===-1&&(l=e),u=e))}if(d>1){let t=-1;for(let d of a)if(d.hasAttribute(`data-panel`)){t++;let i=r.find(e=>e.element===d);if(i){if(f){let r=f.element.getBoundingClientRect(),a=d.getBoundingClientRect(),m;if(c){let e=n===`horizontal`?new DOMRect(r.right,r.top,0,r.height):new DOMRect(r.left,r.bottom,r.width,0),t=n===`horizontal`?new DOMRect(a.left,a.top,0,a.height):new DOMRect(a.left,a.top,a.width,0);switch(p.length){case 0:m=[e,t];break;case 1:{let i=p[0];m=[i,je({orientation:n,rects:[r,a],targetRect:i.element.getBoundingClientRect()})===r?t:e];break}default:m=p;break}}else m=p.length?p:[n===`horizontal`?new DOMRect(r.right,a.top,a.left-r.right,a.height):new DOMRect(a.left,r.bottom,a.width,a.top-r.bottom)];for(let n of m){let r=`width`in n?n:n.element.getBoundingClientRect(),a=Ne()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(r.width<a){let e=a-r.width;r=new DOMRect(r.x-e/2,r.y,r.width+e,r.height)}if(r.height<a){let e=a-r.height;r=new DOMRect(r.x,r.y-e/2,r.width,r.height+e)}!s&&!(t<=l||t>u)&&o.push({group:e,groupSize:I({group:e}),panels:[f,i],separator:`width`in n?void 0:n,rect:r}),s=!1}}c=!1,f=i,p=[]}}else if(d.hasAttribute(`data-separator`)){d.ariaDisabled!==null&&(s=!0);let e=i.find(e=>e.element===d);e?p.push(e):(f=void 0,p=[])}else c=!0}return o}var Fe=class{#e={};addListener(e,t){let n=this.#e[e];return n===void 0?this.#e[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#e[e];if(n!==void 0)if(n.length===1)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){r===null&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#e={}}removeListener(e,t){let n=this.#e[e];if(n!==void 0){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}},R=new Map,Ie=new Fe;function Le(e){R=new Map(R),R.delete(e)}function Re(e,t){for(let[t]of R)if(t.id===e)return t}function z(e,t){for(let[t,n]of R)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function B(){return R}function ze(e,t){return Ie.addListener(`groupChange`,n=>{n.group.id===e&&t(n)})}function V(e,t){let n=R.get(e);R=new Map(R),R.set(e,t),Ie.emit(`groupChange`,{group:e,prev:n,next:t})}function Be(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=Ae(n,a.rect);switch(e){case`horizontal`:t.x<=i.x&&(r=a,i=t);break;case`vertical`:t.y<=i.y&&(r=a,i=t);break}}return r?{distance:i,hitRegion:r}:void 0}function Ve(e){return typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function He(e,t){if(e===t)throw Error(`Cannot compare node with itself`);let n={a:Je(e),b:Je(t)},r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();L(r,`Stacking order can only be calculated for elements with a common ancestor`);let i={a:qe(Ke(n.a)),b:qe(Ke(n.b))};if(i.a===i.b){let e=r.childNodes,t={a:n.a.at(-1),b:n.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return-1}}return Math.sign(i.a-i.b)}var Ue=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function We(e){let t=getComputedStyle(Ye(e)??e).display;return t===`flex`||t===`inline-flex`}function Ge(e){let t=getComputedStyle(e);return!!(t.position===`fixed`||t.zIndex!==`auto`&&(t.position!==`static`||We(e))||+t.opacity<1||`transform`in t&&t.transform!==`none`||`webkitTransform`in t&&t.webkitTransform!==`none`||`mixBlendMode`in t&&t.mixBlendMode!==`normal`||`filter`in t&&t.filter!==`none`||`webkitFilter`in t&&t.webkitFilter!==`none`||`isolation`in t&&t.isolation===`isolate`||Ue.test(t.willChange)||t.webkitOverflowScrolling===`touch`)}function Ke(e){let t=e.length;for(;t--;){let n=e[t];if(L(n,`Missing node`),Ge(n))return n}return null}function qe(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Je(e){let t=[];for(;e;)t.push(e),e=Ye(e);return t}function Ye(e){let{parentNode:t}=e;return Ve(t)?t.host:t}function Xe(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function Ze({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!ke(n)||n.contains(e)||e.contains(n))return!0;if(He(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(Xe(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function Qe(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=Pe(r),a=Be(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&Ze({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function $e(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function H(e,t,n=0){return Math.abs(F(e)-F(t))<=n}function U(e,t){return H(e,t)?0:e>t?1:-1}function W({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:s=100,minSize:c=0}=t;if(o&&!e)return n;if(U(r,c)<0)if(a){let e=(i+c)/2;r=U(r,e)<0?i:c}else r=c;return r=Math.min(s,r),r=F(r),r}function G({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(H(e,0))return t;let o=a===`imperative-api`,s=Object.values(t),c=Object.values(i),l=[...s],[u,d]=r;L(u!=null,`Invalid first pivot index`),L(d!=null,`Invalid second pivot index`);let f=0;switch(a){case`keyboard`:{let t=e<0?d:u,r=n[t];L(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(L(n!=null,`Previous layout not found for panel index ${t}`),H(n,i)){let t=o-n;U(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?u:d,r=n[t];L(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=s[t];if(L(n!=null,`Previous layout not found for panel index ${t}`),H(n,o)){let t=n-i;U(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}break;default:{let t=e<0?d:u,r=n[t];L(r,`Panel constraints not found for index ${t}`);let i=s[t],{collapsible:a,collapsedSize:o,minSize:c}=r;if(a&&U(i,c)<0)if(e>0){let t=c-o,n=t/2;U(i+e,c)<0&&(e=U(e,n)<=0?0:t)}else{let t=c-o,n=100-t/2;U(i-e,c)<0&&(e=U(100+e,n)>0?0:-t)}break}}{let t=e<0?1:-1,r=e<0?d:u,i=0;for(;;){let e=s[r];L(e!=null,`Previous layout not found for panel index ${r}`);let a=W({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e;if(i+=a,r+=t,r<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?u:d;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=s[t];L(i!=null,`Previous layout not found for panel index ${t}`);let a=i-r,c=W({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!H(i,c)&&(f+=i-c,l[t]=c,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if($e(c,l))return i;{let t=e<0?d:u,r=s[t];L(r!=null,`Previous layout not found for panel index ${t}`);let i=r+f,a=W({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(l[t]=a,!H(a,i)){let t=i-a,r=e<0?d:u;for(;r>=0&&r<n.length;){let i=l[r];L(i!=null,`Previous layout not found for panel index ${r}`);let a=i+t,s=W({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(H(i,s)||(t-=s-i,l[r]=s),H(t,0))break;e>0?r--:r++}}}if(!H(Object.values(l).reduce((e,t)=>t+e,0),100,.1))return i;let p=Object.keys(i);return l.reduce((e,t,n)=>(e[p[n]]=t,e),{})}function K(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(t[n]===void 0||U(e[n],t[n])!==0)return!1;return!0}function q({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(`, `)}`);if(!H(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];L(t!=null,`No layout data found for index ${e}`),r[e]=100/i*t}let a=0;for(let e=0;e<t.length;e++){let i=n[e];L(i!=null,`No layout data found for index ${e}`);let o=r[e];L(o!=null,`No layout data found for index ${e}`);let s=W({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=s&&(a+=o-s,r[e]=s)}if(!H(a,0))for(let e=0;e<t.length;e++){let n=r[e];L(n!=null,`No layout data found for index ${e}`);let i=n+a,o=W({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,H(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function et({groupId:e,panelId:t}){let n=()=>{let t=B();for(let[n,{defaultLayoutDeferred:r,derivedPanelConstraints:i,layout:a,groupSize:o,separatorToPanels:s}]of t)if(n.id===e)return{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:n,groupSize:o,layout:a,separatorToPanels:s};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(e!==void 0)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(e!==void 0)return e;throw Error(`Layout not found for Panel ${t}`)},o=({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),s=n.findIndex(e=>e.id===t),c=s===0,l=s===n.length-1;if(l&&e<o&&(c||n.slice(0,s).every((e,t)=>{let n=i[t];return n?.collapsible&&H(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,s).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:F(100-e)}}return G({delta:l?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:l?[s-1,s]:[s,s+1],prevLayout:r,trigger:`imperative-api`})},s=e=>{if(e===a())return;let{defaultLayoutDeferred:t,derivedPanelConstraints:r,group:i,groupSize:s,layout:c,separatorToPanels:l}=n(),u=q({layout:o({nextSize:e,panels:i.panels,prevLayout:c,derivedPanelConstraints:r}),panelConstraints:r});K(c,u)||V(i,{defaultLayoutDeferred:t,derivedPanelConstraints:r,groupSize:s,layout:u,separatorToPanels:l})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),o=a();e&&o!==t&&(n.expandToSize=o,s(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:o}=i(),c=a();if(e&&c===t){let e=o.expandToSize??n;e===0&&(e=1),s(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:e.orientation===`horizontal`?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&H(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=I({group:t});s(F(P({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function tt(e){e.defaultPrevented||Qe(e,B()).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>e.panelConstraints.defaultSize!==void 0);if(n){let r=n.panelConstraints.defaultSize,i=et({groupId:t.group.id,panelId:n.id});i&&r!==void 0&&(i.resize(r),e.preventDefault())}}})}function nt(e){let t=B();for(let[n]of t)if(n.separators.some(t=>t.element===e))return n;throw Error(`Could not find parent Group for separator element`)}function rt({groupId:e}){let t=()=>{let t=B();for(let[n,r]of t)if(n.id===e)return{group:n,...r};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:s}=t(),c=q({layout:e,panelConstraints:r});return n?o:(K(o,c)||V(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:c,separatorToPanels:s}),c)}}}function J(e,t){let n=nt(e),r=z(n.id,!0),i=n.separators.find(t=>t.element===e);L(i,`Matching separator not found`);let a=r.separatorToPanels.get(i);L(a,`Matching panels not found`);let o=a.map(e=>n.panels.indexOf(e)),s=rt({groupId:n.id}).getLayout(),c=q({layout:G({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:s,trigger:`keyboard`}),panelConstraints:r.derivedPanelConstraints});K(s,c)||V(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function it(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=nt(t);if(!n.disabled)switch(e.key){case`ArrowDown`:e.preventDefault(),n.orientation===`vertical`&&J(t,5);break;case`ArrowLeft`:e.preventDefault(),n.orientation===`horizontal`&&J(t,-5);break;case`ArrowRight`:e.preventDefault(),n.orientation===`horizontal`&&J(t,5);break;case`ArrowUp`:e.preventDefault(),n.orientation===`vertical`&&J(t,-5);break;case`End`:e.preventDefault(),J(t,100);break;case`Enter`:{e.preventDefault();let n=nt(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=z(n.id,!0),o=n.separators.find(e=>e.element===t);L(o,`Matching separator not found`);let s=a.get(o);L(s,`Matching panels not found`);let c=s[0],l=r.find(e=>e.panelId===c.id);if(L(l,`Panel metadata not found`),l.collapsible){let e=i[c.id];J(t,(l.collapsedSize===e?n.mutableState.expandedPanelSizes[c.id]??l.minSize:l.collapsedSize)-e)}break}case`F6`:{e.preventDefault();let n=nt(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);L(r!==null,`Index not found`),n[e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0].focus({preventScroll:!0});break}case`Home`:e.preventDefault(),J(t,-100);break}}var Y={cursorFlags:0,state:`inactive`},at=new Fe;function X(){return Y}function ot(e){return at.addListener(`change`,e)}function st(e){let t=Y,n={...Y};n.cursorFlags=e,Y=n,at.emit(`change`,{prev:t,next:n})}function Z(e){let t=Y;Y=e,at.emit(`change`,{prev:t,next:e})}function ct(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=B(),n=Qe(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),Z({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:`active`}),n.length&&e.preventDefault()}var lt=e=>e,ut=()=>{},dt=1,ft=2,pt=4,mt=8,ht=3,gt=12,_t;function vt(){return _t===void 0&&(_t=!1,typeof window<`u`&&(window.navigator.userAgent.includes(`Chrome`)||window.navigator.userAgent.includes(`Firefox`))&&(_t=!0)),_t}function yt({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case`active`:case`hover`:t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case`horizontal`:r++;break;case`vertical`:i++;break}})}if(!(r===0&&i===0)){switch(n){case`active`:if(e&&vt()){let t=(e&dt)!==0,n=(e&ft)!==0,r=(e&pt)!==0,i=(e&mt)!==0;if(t)return r?`se-resize`:i?`ne-resize`:`e-resize`;if(n)return r?`sw-resize`:i?`nw-resize`:`w-resize`;if(r)return`s-resize`;if(i)return`n-resize`}break}return vt()?r>0&&i>0?`move`:r>0?`ew-resize`:`ns-resize`:r>0&&i>0?`grab`:r>0?`col-resize`:`row-resize`}}var bt=new WeakMap;function xt(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=bt.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=X();switch(r.state){case`active`:case`hover`:{let e=yt({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?n.cssRules.length===0?n.insertRule(i):n.replaceSync(i):n.cssRules.length===1&&n.deleteRule(0);break}case`inactive`:t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}bt.set(e,{prevStyle:t,styleSheet:n})}function St({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){let s=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:c,panels:l}=n,{disableCursor:u}=n.mutableState,d=0;d=a?c===`horizontal`?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:c===`horizontal`?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),p=i.get(n);if(!f||!p)return;let{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:_,separatorToPanels:v}=p;if(h&&_&&v){let t=G({delta:d,initialLayout:f,panelConstraints:h,pivotIndices:e.panels.map(e=>l.indexOf(e)),prevLayout:_,trigger:`mouse-or-touch`});if(K(t,_)){if(d!==0&&!u)switch(c){case`horizontal`:s|=d<0?dt:ft;break;case`vertical`:s|=d<0?pt:mt;break}}else V(e.group,{defaultLayoutDeferred:m,derivedPanelConstraints:h,groupSize:g,layout:t,separatorToPanels:v})}});let c=0;t.movementX===0?c|=o&ht:c|=s&ht,t.movementY===0?c|=o&gt:c|=s&gt,st(c),xt(e)}function Ct(e){let t=B(),n=X();switch(n.state){case`active`:St({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function wt(e){if(e.defaultPrevented)return;let t=X(),n=B();switch(t.state){case`active`:if(e.buttons===0){Z({cursorFlags:0,state:`inactive`}),t.hitRegions.forEach(e=>{let t=z(e.group.id,!0);V(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}St({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break;default:{let r=Qe(e,n);r.length===0?t.state!==`inactive`&&Z({cursorFlags:0,state:`inactive`}):Z({cursorFlags:0,hitRegions:r,state:`hover`}),xt(e.currentTarget);break}}}function Tt(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(X().state){case`hover`:Z({cursorFlags:0,state:`inactive`})}}function Et(e){if(e.defaultPrevented||e.pointerType===`mouse`&&e.button>0)return;let t=X();switch(t.state){case`active`:Z({cursorFlags:0,state:`inactive`}),t.hitRegions.length>0&&(xt(e.currentTarget),t.hitRegions.forEach(e=>{let t=z(e.group.id,!0);V(e.group,t)}),e.preventDefault())}}function Dt(e){let t=0,n=0,r={};for(let i of e)if(i.defaultSize!==void 0){t++;let e=F(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(i!==0){let t=F((100-n)/i);for(let n of e)n.defaultSize===void 0&&(r[n.panelId]=t)}return r}function Ot(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=I({group:e}),a=e.orientation===`horizontal`?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,s={asPercentage:F(a/i*100),inPixels:a};r.mutableValues.prevSize=s,r.onResize(s,r.id,o)}function kt(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}function At({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,s=new Map,c=[];for(let l of e.panels){let e=r[l.id]??0;switch(l.panelConstraints.groupResizeBehavior){case`preserve-pixel-size`:{o=!0;let r=F(e/100*n/t*100);s.set(l.id,r),i+=r;break}default:c.push(l.id),a+=e;break}}if(!o||c.length===0)return r;let l=100-i,u={...r};if(s.forEach((e,t)=>{u[t]=e}),a>0)for(let e of c)u[e]=F((r[e]??0)/a*l);else{let e=F(l/c.length);for(let t of c)u[t]=e}return u}function jt(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}var Q=new Map;function Mt(e){let t=!0;L(e.element.ownerDocument.defaultView,`Cannot register an unmounted Group`);let n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,i=new Set,a=new n(n=>{for(let r of n){let{borderBoxSize:n,target:i}=r;if(i===e.element){if(t){let t=I({group:e});if(t===0)return;let n=z(e.id);if(!n)return;let r=Te(e),i=n.defaultLayoutDeferred?Dt(r):n.layout,a=q({layout:At({group:e,nextGroupSize:t,prevGroupSize:n.groupSize,prevLayout:i}),panelConstraints:r});if(!n.defaultLayoutDeferred&&K(n.layout,a)&&kt(n.derivedPanelConstraints,r)&&n.groupSize===t)return;V(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:r,groupSize:t,layout:a,separatorToPanels:n.separatorToPanels})}}else Ot(e,i,n)}});a.observe(e.element),e.panels.forEach(e=>{L(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&a.observe(e.element)});let o=I({group:e}),s=Te(e),c=e.panels.map(({id:e})=>e).join(`,`),l=e.mutableState.defaultLayout;l&&(jt(e.panels,l)||(l=void 0));let u=q({layout:e.mutableState.layouts[c]??l??Dt(s),panelConstraints:s}),d=e.element.ownerDocument;Q.set(d,(Q.get(d)??0)+1);let f=new Map;return Pe(e).forEach(e=>{e.separator&&f.set(e.separator,e.panels)}),V(e,{defaultLayoutDeferred:o===0,derivedPanelConstraints:s,groupSize:o,layout:u,separatorToPanels:f}),e.separators.forEach(e=>{L(!i.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),i.add(e.id),e.element.addEventListener(`keydown`,it)}),Q.get(d)===1&&(d.addEventListener(`dblclick`,tt,!0),d.addEventListener(`pointerdown`,ct,!0),d.addEventListener(`pointerleave`,Ct),d.addEventListener(`pointermove`,wt),d.addEventListener(`pointerout`,Tt),d.addEventListener(`pointerup`,Et,!0)),function(){t=!1,Q.set(d,Math.max(0,(Q.get(d)??0)-1)),Le(e),e.separators.forEach(e=>{e.element.removeEventListener(`keydown`,it)}),Q.get(d)||(d.removeEventListener(`dblclick`,tt,!0),d.removeEventListener(`pointerdown`,ct,!0),d.removeEventListener(`pointerleave`,Ct),d.removeEventListener(`pointermove`,wt),d.removeEventListener(`pointerout`,Tt),d.removeEventListener(`pointerup`,Et,!0)),a.disconnect()}}function Nt(){let[e,t]=(0,T.useState)({});return[e,(0,T.useCallback)(()=>t({}),[])]}function Pt(e){let t=(0,T.useId)();return`${e??t}`}var $=typeof window<`u`?T.useLayoutEffect:T.useEffect;function Ft(e){let t=(0,T.useRef)(e);return $(()=>{t.current=e},[e]),(0,T.useCallback)((...e)=>t.current?.(...e),[t])}function It(...e){return Ft(t=>{e.forEach(e=>{if(e)switch(typeof e){case`function`:e(t);break;case`object`:e.current=t;break}})})}function Lt(e){let t=(0,T.useRef)({...e});return $(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}var Rt=(0,T.createContext)(null);function zt(e,t){let n=(0,T.useRef)({getLayout:()=>({}),setLayout:lt});(0,T.useImperativeHandle)(t,()=>n.current,[]),$(()=>{Object.assign(n.current,rt({groupId:e}))})}function Bt({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:s,onLayoutChange:c,onLayoutChanged:l,orientation:u=`horizontal`,resizeTargetMinimumSize:d={coarse:20,fine:10},style:f,...p}){let m=(0,T.useRef)({onLayoutChange:{},onLayoutChanged:{}}),h=Ft(e=>{K(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,c?.(e))}),g=Ft(e=>{K(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,l?.(e))}),_=Pt(s),v=(0,T.useRef)(null),[y,b]=Nt(),x=(0,T.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:d,separators:[]}),S=It(v,a);zt(_,o);let C=Ft((e,t)=>{let r=X(),i=Re(e),a=z(e);if(a){let e=!1;switch(r.state){case`active`:e=r.hitRegions.some(e=>e.group===i);break}return{flexGrow:a.layout[t]??1,pointerEvents:e?`none`:void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),w=Lt({defaultLayout:n,disableCursor:r}),E=(0,T.useMemo)(()=>({get disableCursor(){return!!w.disableCursor},getPanelStyles:C,id:_,orientation:u,registerPanel:e=>{let t=x.current;return t.panels=Ee(u,[...t.panels,e]),b(),()=>{t.panels=t.panels.filter(t=>t!==e),b()}},registerSeparator:e=>{let t=x.current;return t.separators=Ee(u,[...t.separators,e]),b(),()=>{t.separators=t.separators.filter(t=>t!==e),b()}},updatePanelProps:(e,{disabled:t})=>{let n=x.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=Re(_),i=z(_);r&&i&&V(r,{...i,derivedPanelConstraints:Te(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=x.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[C,_,b,u,w]),D=(0,T.useRef)(null);return $(()=>{let e=v.current;if(e===null)return;let t=x.current,n;if(w.defaultLayout!==void 0&&Object.keys(w.defaultLayout).length===t.panels.length){n={};for(let e of t.panels){let t=w.defaultLayout[e.id];t!==void 0&&(n[e.id]=t)}}let r={disabled:!!i,element:e,id:_,mutableState:{defaultLayout:n,disableCursor:!!w.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:u,panels:t.panels,resizeTargetMinimumSize:t.resizeTargetMinimumSize,separators:t.separators};D.current=r;let a=Mt(r),{defaultLayoutDeferred:o,derivedPanelConstraints:s,layout:c}=z(r.id,!0);!o&&s.length>0&&(h(c),g(c));let l=ze(_,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:i}=e.next;if(t||n.length===0)return;let a=r.panels.map(({id:e})=>e).join(`,`);r.mutableState.layouts[a]=i,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=H(t.collapsedSize,i[t.panelId]),a=H(t.collapsedSize,n[t.panelId]);e&&!a&&(r.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let o=X().state!==`active`;h(i),o&&g(i)});return()=>{D.current=null,a(),l()}},[i,_,g,h,u,y,w]),(0,T.useEffect)(()=>{let e=D.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,N.jsx)(Rt.Provider,{value:E,children:(0,N.jsx)(`div`,{...p,className:t,"data-group":!0,"data-testid":_,id:_,ref:S,style:{height:`100%`,width:`100%`,overflow:`hidden`,...f,display:`flex`,flexDirection:u===`horizontal`?`row`:`column`,flexWrap:`nowrap`,touchAction:u===`horizontal`?`pan-y`:`pan-x`},children:e})})}Bt.displayName=`Group`;function Vt(){let e=(0,T.useContext)(Rt);return L(e,`Group Context not found; did you render a Panel or Separator outside of a Group?`),e}function Ht(e,t){let{id:n}=Vt(),r=(0,T.useRef)({collapse:ut,expand:ut,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:ut});(0,T.useImperativeHandle)(t,()=>r.current,[]),$(()=>{Object.assign(r.current,et({groupId:n,panelId:e}))})}function Ut({children:e,className:t,collapsedSize:n=`0%`,collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:s=`preserve-relative-size`,id:c,maxSize:l=`100%`,minSize:u=`0%`,onResize:d,panelRef:f,style:p,...m}){let h=!!c,g=Pt(c),_=Lt({disabled:a}),v=(0,T.useRef)(null),y=It(v,o),{getPanelStyles:b,id:x,orientation:S,registerPanel:C,updatePanelProps:w}=Vt(),E=d!==null,D=Ft((e,t,n)=>{d?.(e,c,n)});$(()=>{let e=v.current;if(e!==null)return C({element:e,id:g,idIsStable:h,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:E?D:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:i,disabled:_.disabled,maxSize:l,minSize:u}})},[s,n,r,i,E,g,h,l,u,D,C,_]),(0,T.useEffect)(()=>{w(g,{disabled:a})},[a,g,w]),Ht(g,f);let O=()=>{let e=b(x,g);if(e)return JSON.stringify(e)},k=(0,T.useSyncExternalStore)(e=>ze(x,e),O,O),A;return A=k?JSON.parse(k):i===void 0?{flexGrow:1}:{flexGrow:void 0,flexShrink:void 0,flexBasis:i},(0,N.jsx)(`div`,{...m,"data-disabled":a||void 0,"data-panel":!0,"data-testid":g,id:g,ref:y,style:{...Wt,display:`flex`,flexBasis:0,flexShrink:1,overflow:`visible`,...A},children:(0,N.jsx)(`div`,{className:t,style:{maxHeight:`100%`,maxWidth:`100%`,flexGrow:1,overflow:`auto`,...p,touchAction:S===`horizontal`?`pan-y`:`pan-x`},children:e})})}Ut.displayName=`Panel`;var Wt={minHeight:0,maxHeight:`100%`,height:`auto`,minWidth:0,maxWidth:`100%`,width:`auto`,border:`none`,borderWidth:0,padding:0,margin:0};function Gt({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],s=t.find(e=>e.panelId===n);if(s){let c=s.maxSize,l=s.collapsible?s.collapsedSize:s.minSize,u=[r,r+1];a=q({layout:G({delta:l-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n],i=q({layout:G({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:u,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}function Kt({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...s}){let c=Pt(a),l=Lt({disabled:n,disableDoubleClick:r}),[u,d]=(0,T.useState)({}),[f,p]=(0,T.useState)(`inactive`),[m,h]=(0,T.useState)(!1),g=(0,T.useRef)(null),_=It(g,i),{disableCursor:v,id:y,orientation:b,registerSeparator:x,updateSeparatorProps:S}=Vt(),C=b===`horizontal`?`vertical`:`horizontal`;$(()=>{let e=g.current;if(e!==null){let t={disabled:l.disabled,disableDoubleClick:l.disableDoubleClick,element:e,id:c},n=x(t),r=ot(e=>{p(e.next.state!==`inactive`&&e.next.hitRegions.some(e=>e.separator===t)?e.next.state:`inactive`)}),i=ze(y,e=>{let{derivedPanelConstraints:n,layout:r,separatorToPanels:i}=e.next,a=i.get(t);if(a){let e=a[0],t=a.indexOf(e);d(Gt({layout:r,panelConstraints:n,panelId:e.id,panelIndex:t}))}});return()=>{r(),i(),n()}}},[y,c,x,l]),(0,T.useEffect)(()=>{S(c,{disabled:n,disableDoubleClick:r})},[n,r,c,S]);let w;n&&!v&&(w=`not-allowed`);let E;if(n)E=`disabled`;else switch(f){case`active`:E=`active`;break;default:E=m?`focus`:f}return(0,N.jsx)(`div`,{...s,"aria-controls":u.valueControls,"aria-disabled":n||void 0,"aria-orientation":C,"aria-valuemax":u.valueMax,"aria-valuemin":u.valueMin,"aria-valuenow":u.valueNow,children:e,className:t,"data-separator":E,"data-testid":c,id:c,onBlur:()=>h(!1),onFocus:()=>h(!0),ref:_,role:`separator`,style:{flexBasis:`auto`,cursor:w,...o,flexGrow:0,flexShrink:0,touchAction:`none`},tabIndex:n?void 0:0})}Kt.displayName=`Separator`;function qt(e){let t=(0,ve.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=a(`flex h-full w-full aria-[orientation=vertical]:flex-col`,n),t[3]=n,t[4]=i);let o;return t[5]!==r||t[6]!==i?(o=(0,N.jsx)(Bt,{"data-slot":`resizable-panel-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=o):o=t[7],o}function Jt(e){let t=(0,ve.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,N.jsx)(Ut,{"data-slot":`resizable-panel`,...n}),t[2]=n,t[3]=r),r}function Yt(e){let t=(0,ve.c)(12),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({withHandle:i,className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let o;t[4]===n?o=t[5]:(o=a(`bg-border ring-offset-background focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:outline-hidden aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90`,n),t[4]=n,t[5]=o);let s;t[6]===i?s=t[7]:(s=i&&(0,N.jsx)(`div`,{className:`bg-border z-10 flex h-6 w-1 shrink-0 rounded-none`}),t[6]=i,t[7]=s);let c;return t[8]!==r||t[9]!==o||t[10]!==s?(c=(0,N.jsx)(Kt,{"data-slot":`resizable-handle`,className:o,...r,children:s}),t[8]=r,t[9]=o,t[10]=s,t[11]=c):c=t[11],c}export{y as _,ne as a,te as c,E as d,x as f,b as g,w as h,ye as i,ee as l,S as m,Jt as n,re as o,C as p,qt as r,ie as s,Yt as t,A as u,v,g as y};
@@ -0,0 +1,45 @@
1
+ import{r as e}from"./chunk-QTnfLwEv.js";import{n as t,r as n,t as r}from"./compiler-runtime-rGeCHUuX.js";import{$a as i,At as a,Bs as o,E as s,Ia as c,In as l,Io as u,Kt as d,M as f,N as p,Na as m,Oa as h,Ra as g,Sa as _,T as v,Us as y,Yo as b,Zo as x,as as S,ba as C,dr as w,eo as T,fr as E,ga as D,hi as O,hr as ee,j as k,ln as te,lr as A,ma as ne,mr as re,ns as ie,pr as ae,t as oe,ur as se}from"./button-Dz6Az3h_.js";import{r as ce,t as le}from"./route-b5JXfzPO.js";import{T as ue,a as de,c as fe,d as j,f as pe,h as me,l as he,n as ge,o as _e,p as ve,s as ye,t as be,u as xe}from"./input-group-1-P7Y_75.js";import{t as Se}from"./loader-circle-BxillczB.js";import{n as Ce,r as we,t as Te}from"./resizable-BaJ5ba6-.js";import{A as Ee,C as De,T as Oe,a as ke,b as M,c as Ae,d as je,f as Me,i as Ne,k as Pe,l as Fe,n as Ie,t as Le,u as N,v as Re,w as ze,x as P,y as Be}from"./state-CVjPP5QG.js";var F=e(n(),1);function Ve(e){let t=y({warn:e?.router===void 0}),n=e?.router||t,r=(0,F.useRef)(void 0);return S(n.stores.__store,t=>{if(e?.select){if(e.structuralSharing??n.options.defaultStructuralSharing){let n=o(r.current,e.select(t));return r.current=n,n}return e.select(t)}return t})}var He=x(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),Ue=x(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),We=x(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),Ge=x(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Ke=x(`git-branch-plus`,[[`path`,{d:`M6 3v12`,key:`qpgusn`}],[`path`,{d:`M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z`,key:`1d02ji`}],[`path`,{d:`M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z`,key:`chk6ph`}],[`path`,{d:`M15 6a9 9 0 0 0-9 9`,key:`or332x`}],[`path`,{d:`M18 15v6`,key:`9wciyi`}],[`path`,{d:`M21 18h-6`,key:`139f0c`}]]),qe=x(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),Je=x(`panel-top`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M3 9h18`,key:`1pudct`}]]),Ye=x(`play`,[[`path`,{d:`M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z`,key:`10ikf1`}]]),Xe=x(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Ze=x(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Qe=x(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),$e=x(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),et=x(`trash`,[[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]]),I=r(),tt=1,nt=.9,rt=.8,it=.17,at=.1,ot=.999,st=.9999,ct=.99,lt=/[\\\/_+.#"@\[\(\{&]/,ut=/[\\\/_+.#"@\[\(\{&]/g,dt=/[\s-]/,ft=/[\s-]/g;function pt(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?tt:ct;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=pt(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=tt:lt.test(e.charAt(l-1))?(d*=rt,p=e.slice(i,l-1).match(ut),p&&i>0&&(d*=ot**+p.length)):dt.test(e.charAt(l-1))?(d*=nt,m=e.slice(i,l-1).match(ft),m&&i>0&&(d*=ot**+m.length)):(d*=it,i>0&&(d*=ot**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=st)),(d<at&&n.charAt(l-1)===r.charAt(a+1)||r.charAt(a+1)===r.charAt(a)&&n.charAt(l-1)!==r.charAt(a))&&(f=pt(e,t,n,r,l+1,a+2,o),f*at>d&&(d=f*at)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function mt(e){return e.toLowerCase().replace(ft,` `)}function ht(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,pt(e,t,mt(e),mt(t),0,0,{})}typeof window<`u`&&window.document&&window.document.createElement;function L(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function gt(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function R(...e){return t=>{let n=!1,r=e.map(e=>{let r=gt(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():gt(e[t],null)}}}}function z(...e){return F.useCallback(R(...e),e)}var B=t();function _t(e,t){let n=F.createContext(t),r=e=>{let{children:t,...r}=e,i=F.useMemo(()=>r,Object.values(r));return(0,B.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=F.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function vt(e,t=[]){let n=[];function r(t,r){let i=F.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=F.useMemo(()=>o,Object.values(o));return(0,B.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=F.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>F.createContext(e));return function(n){let r=n?.[e]||t;return F.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,yt(i,...t)]}function yt(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return F.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var bt=globalThis?.document?F.useLayoutEffect:()=>{},xt=F.useId||(()=>void 0),St=0;function V(e){let[t,n]=F.useState(xt());return bt(()=>{e||n(e=>e??String(St++))},[e]),e||(t?`radix-${t}`:``)}var Ct=F.useInsertionEffect||bt;function wt({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=Tt({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=F.useRef(e!==void 0);F.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,F.useCallback(t=>{if(s){let n=Et(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function Tt({defaultProp:e,onChange:t}){let[n,r]=F.useState(e),i=F.useRef(n),a=F.useRef(t);return Ct(()=>{a.current=t},[t]),F.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Et(e){return typeof e==`function`}var Dt=e(ie(),1);function Ot(e){let t=kt(e),n=F.forwardRef((e,n)=>{let{children:r,...i}=e,a=F.Children.toArray(r),o=a.find(jt);if(o){let e=o.props.children,r=a.map(t=>t===o?F.Children.count(e)>1?F.Children.only(null):F.isValidElement(e)?e.props.children:null:t);return(0,B.jsx)(t,{...i,ref:n,children:F.isValidElement(e)?F.cloneElement(e,void 0,r):null})}return(0,B.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function kt(e){let t=F.forwardRef((e,t)=>{let{children:n,...r}=e;if(F.isValidElement(n)){let e=Nt(n),i=Mt(r,n.props);return n.type!==F.Fragment&&(i.ref=t?R(t,e):e),F.cloneElement(n,i)}return F.Children.count(n)>1?F.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var At=Symbol(`radix.slottable`);function jt(e){return F.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===At}function Mt(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Nt(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var H=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Ot(`Primitive.${t}`),r=F.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,B.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Pt(e,t){e&&Dt.flushSync(()=>e.dispatchEvent(t))}function Ft(e){let t=F.useRef(e);return F.useEffect(()=>{t.current=e}),F.useMemo(()=>(...e)=>t.current?.(...e),[])}function It(e,t=globalThis?.document){let n=Ft(e);F.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Lt=`DismissableLayer`,Rt=`dismissableLayer.update`,zt=`dismissableLayer.pointerDownOutside`,Bt=`dismissableLayer.focusOutside`,Vt,Ht=F.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ut=F.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=F.useContext(Ht),[u,d]=F.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=F.useState({}),m=z(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=Kt(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=qt(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return It(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),F.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Vt=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Jt(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Vt)}},[u,f,n,l]),F.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Jt())},[u,l]),F.useEffect(()=>{let e=()=>p({});return document.addEventListener(Rt,e),()=>document.removeEventListener(Rt,e)},[]),(0,B.jsx)(H.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:L(e.onFocusCapture,S.onFocusCapture),onBlurCapture:L(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:L(e.onPointerDownCapture,x.onPointerDownCapture)})});Ut.displayName=Lt;var Wt=`DismissableLayerBranch`,Gt=F.forwardRef((e,t)=>{let n=F.useContext(Ht),r=F.useRef(null),i=z(t,r);return F.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,B.jsx)(H.div,{...e,ref:i})});Gt.displayName=Wt;function Kt(e,t=globalThis?.document){let n=Ft(e),r=F.useRef(!1),i=F.useRef(()=>{});return F.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Yt(zt,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function qt(e,t=globalThis?.document){let n=Ft(e),r=F.useRef(!1);return F.useEffect(()=>{let e=e=>{e.target&&!r.current&&Yt(Bt,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Jt(){let e=new CustomEvent(Rt);document.dispatchEvent(e)}function Yt(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Pt(i,a):i.dispatchEvent(a)}var Xt=`focusScope.autoFocusOnMount`,Zt=`focusScope.autoFocusOnUnmount`,Qt={bubbles:!1,cancelable:!0},$t=`FocusScope`,en=F.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=F.useState(null),l=Ft(i),u=Ft(a),d=F.useRef(null),f=z(t,e=>c(e)),p=F.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;F.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:U(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||U(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&U(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),F.useEffect(()=>{if(s){cn.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Xt,Qt);s.addEventListener(Xt,l),s.dispatchEvent(t),t.defaultPrevented||(tn(dn(rn(s)),{select:!0}),document.activeElement===e&&U(s))}return()=>{s.removeEventListener(Xt,l),setTimeout(()=>{let t=new CustomEvent(Zt,Qt);s.addEventListener(Zt,u),s.dispatchEvent(t),t.defaultPrevented||U(e??document.body,{select:!0}),s.removeEventListener(Zt,u),cn.remove(p)},0)}}},[s,l,u,p]);let m=F.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=nn(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&U(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&U(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,B.jsx)(H.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});en.displayName=$t;function tn(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(U(r,{select:t}),document.activeElement!==n)return}function nn(e){let t=rn(e);return[an(t,e),an(t.reverse(),e)]}function rn(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function an(e,t){for(let n of e)if(!on(n,{upTo:t}))return n}function on(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function sn(e){return e instanceof HTMLInputElement&&`select`in e}function U(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&sn(e)&&t&&e.select()}}var cn=ln();function ln(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=un(e,t),e.unshift(t)},remove(t){e=un(e,t),e[0]?.resume()}}}function un(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function dn(e){return e.filter(e=>e.tagName!==`A`)}var fn=`Portal`,pn=F.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=F.useState(!1);bt(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Dt.createPortal((0,B.jsx)(H.div,{...r,ref:t}),o):null});pn.displayName=fn;function mn(e,t){return F.useReducer((e,n)=>t[e][n]??e,e)}var hn=e=>{let{present:t,children:n}=e,r=gn(t),i=typeof n==`function`?n({present:r.isPresent}):F.Children.only(n),a=z(r.ref,vn(i));return typeof n==`function`||r.isPresent?F.cloneElement(i,{ref:a}):null};hn.displayName=`Presence`;function gn(e){let[t,n]=F.useState(),r=F.useRef(null),i=F.useRef(e),a=F.useRef(`none`),[o,s]=mn(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return F.useEffect(()=>{let e=_n(r.current);a.current=o===`mounted`?e:`none`},[o]),bt(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=_n(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),bt(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=_n(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=_n(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:F.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function _n(e){return e?.animationName||`none`}function vn(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var yn=0;function bn(){F.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??xn()),document.body.insertAdjacentElement(`beforeend`,e[1]??xn()),yn++,()=>{yn===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),yn--}},[])}function xn(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var W=function(){return W=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},W.apply(this,arguments)};function Sn(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Cn(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var wn=`right-scroll-bar-position`,Tn=`width-before-scroll-bar`,En=`with-scroll-bars-hidden`,Dn=`--removed-body-scroll-bar-size`;function On(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function kn(e,t){var n=(0,F.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var An=typeof window<`u`?F.useLayoutEffect:F.useEffect,jn=new WeakMap;function Mn(e,t){var n=kn(t||null,function(t){return e.forEach(function(e){return On(e,t)})});return An(function(){var t=jn.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||On(e,null)}),i.forEach(function(e){r.has(e)||On(e,a)})}jn.set(n,e)},[e]),n}function Nn(e){return e}function Pn(e,t){t===void 0&&(t=Nn);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Fn(e){e===void 0&&(e={});var t=Pn(null);return t.options=W({async:!0,ssr:!1},e),t}var In=function(e){var t=e.sideCar,n=Sn(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return F.createElement(r,W({},n))};In.isSideCarExport=!0;function Ln(e,t){return e.useMedium(t),In}var Rn=Fn(),zn=function(){},Bn=F.forwardRef(function(e,t){var n=F.useRef(null),r=F.useState({onScrollCapture:zn,onWheelCapture:zn,onTouchMoveCapture:zn}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=Sn(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=Mn([n,t]),C=W(W({},b),i);return F.createElement(F.Fragment,null,u&&F.createElement(x,{sideCar:Rn,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?F.cloneElement(F.Children.only(s),W(W({},C),{ref:S})):F.createElement(v,W({},C,{className:c,ref:S}),s))});Bn.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Bn.classNames={fullWidth:Tn,zeroRight:wn};var Vn,Hn=function(){if(Vn)return Vn;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Un(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=Hn();return t&&e.setAttribute(`nonce`,t),e}function Wn(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Gn(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Kn=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Un())&&(Wn(t,n),Gn(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},qn=function(){var e=Kn();return function(t,n){F.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Jn=function(){var e=qn();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Yn={left:0,top:0,right:0,gap:0},Xn=function(e){return parseInt(e||``,10)||0},Zn=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[Xn(n),Xn(r),Xn(i)]},Qn=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Yn;var t=Zn(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},$n=Jn(),er=`data-scroll-locked`,tr=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
2
+ .${En} {
3
+ overflow: hidden ${r};
4
+ padding-right: ${s}px ${r};
5
+ }
6
+ body[${er}] {
7
+ overflow: hidden ${r};
8
+ overscroll-behavior: contain;
9
+ ${[t&&`position: relative ${r};`,n===`margin`&&`
10
+ padding-left: ${i}px;
11
+ padding-top: ${a}px;
12
+ padding-right: ${o}px;
13
+ margin-left:0;
14
+ margin-top:0;
15
+ margin-right: ${s}px ${r};
16
+ `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
17
+ }
18
+
19
+ .${wn} {
20
+ right: ${s}px ${r};
21
+ }
22
+
23
+ .${Tn} {
24
+ margin-right: ${s}px ${r};
25
+ }
26
+
27
+ .${wn} .${wn} {
28
+ right: 0 ${r};
29
+ }
30
+
31
+ .${Tn} .${Tn} {
32
+ margin-right: 0 ${r};
33
+ }
34
+
35
+ body[${er}] {
36
+ ${Dn}: ${s}px;
37
+ }
38
+ `},nr=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},rr=function(){F.useEffect(function(){return document.body.setAttribute(er,(nr()+1).toString()),function(){var e=nr()-1;e<=0?document.body.removeAttribute(er):document.body.setAttribute(er,e.toString())}},[])},ir=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;rr();var a=F.useMemo(function(){return Qn(i)},[i]);return F.createElement($n,{styles:tr(a,!t,i,n?``:`!important`)})},ar=!1;if(typeof window<`u`)try{var or=Object.defineProperty({},"passive",{get:function(){return ar=!0,!0}});window.addEventListener(`test`,or,or),window.removeEventListener(`test`,or,or)}catch{ar=!1}var G=ar?{passive:!1}:!1,sr=function(e){return e.tagName===`TEXTAREA`},cr=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!sr(e)&&n[t]===`visible`)},lr=function(e){return cr(e,`overflowY`)},ur=function(e){return cr(e,`overflowX`)},dr=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),mr(e,r)){var i=hr(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},fr=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},pr=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},mr=function(e,t){return e===`v`?lr(t):ur(t)},hr=function(e,t){return e===`v`?fr(t):pr(t)},gr=function(e,t){return e===`h`&&t===`rtl`?-1:1},_r=function(e,t,n,r,i){var a=gr(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=hr(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&mr(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},vr=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},yr=function(e){return[e.deltaX,e.deltaY]},br=function(e){return e&&`current`in e?e.current:e},xr=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Sr=function(e){return`
39
+ .block-interactivity-${e} {pointer-events: none;}
40
+ .allow-interactivity-${e} {pointer-events: all;}
41
+ `},Cr=0,K=[];function wr(e){var t=F.useRef([]),n=F.useRef([0,0]),r=F.useRef(),i=F.useState(Cr++)[0],a=F.useState(Jn)[0],o=F.useRef(e);F.useEffect(function(){o.current=e},[e]),F.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Cn([e.lockRef.current],(e.shards||[]).map(br),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=F.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=vr(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=dr(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=dr(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return _r(h,t,e,h===`h`?s:c,!0)},[]),c=F.useCallback(function(e){var n=e;if(!(!K.length||K[K.length-1]!==a)){var r=`deltaY`in n?yr(n):vr(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&xr(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(br).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=F.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Tr(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=F.useCallback(function(e){n.current=vr(e),r.current=void 0},[]),d=F.useCallback(function(t){l(t.type,yr(t),t.target,s(t,e.lockRef.current))},[]),f=F.useCallback(function(t){l(t.type,vr(t),t.target,s(t,e.lockRef.current))},[]);F.useEffect(function(){return K.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,G),document.addEventListener(`touchmove`,c,G),document.addEventListener(`touchstart`,u,G),function(){K=K.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,G),document.removeEventListener(`touchmove`,c,G),document.removeEventListener(`touchstart`,u,G)}},[]);var p=e.removeScrollBar,m=e.inert;return F.createElement(F.Fragment,null,m?F.createElement(a,{styles:Sr(i)}):null,p?F.createElement(ir,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Tr(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Er=Ln(Rn,wr),Dr=F.forwardRef(function(e,t){return F.createElement(Bn,W({},e,{ref:t,sideCar:Er}))});Dr.classNames=Bn.classNames;var Or=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},q=new WeakMap,kr=new WeakMap,Ar={},jr=0,Mr=function(e){return e&&(e.host||Mr(e.parentNode))},Nr=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Mr(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Pr=function(e,t,n,r){var i=Nr(t,Array.isArray(e)?e:[e]);Ar[n]||(Ar[n]=new WeakMap);var a=Ar[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(q.get(e)||0)+1,l=(a.get(e)||0)+1;q.set(e,c),a.set(e,l),o.push(e),c===1&&i&&kr.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),jr++,function(){o.forEach(function(e){var t=q.get(e)-1,i=a.get(e)-1;q.set(e,t),a.set(e,i),t||(kr.has(e)||e.removeAttribute(r),kr.delete(e)),i||e.removeAttribute(n)}),jr--,jr||(q=new WeakMap,q=new WeakMap,kr=new WeakMap,Ar={})}},Fr=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Or(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Pr(r,i,n,`aria-hidden`)):function(){return null}},Ir=`Dialog`,[Lr,Rr]=vt(Ir),[zr,J]=Lr(Ir),Br=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=F.useRef(null),c=F.useRef(null),[l,u]=wt({prop:r,defaultProp:i??!1,onChange:a,caller:Ir});return(0,B.jsx)(zr,{scope:t,triggerRef:s,contentRef:c,contentId:V(),titleId:V(),descriptionId:V(),open:l,onOpenChange:u,onOpenToggle:F.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};Br.displayName=Ir;var Vr=`DialogTrigger`,Hr=F.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=J(Vr,n),a=z(t,i.triggerRef);return(0,B.jsx)(H.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":si(i.open),...r,ref:a,onClick:L(e.onClick,i.onOpenToggle)})});Hr.displayName=Vr;var Ur=`DialogPortal`,[Wr,Gr]=Lr(Ur,{forceMount:void 0}),Kr=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=J(Ur,t);return(0,B.jsx)(Wr,{scope:t,forceMount:n,children:F.Children.map(r,e=>(0,B.jsx)(hn,{present:n||a.open,children:(0,B.jsx)(pn,{asChild:!0,container:i,children:e})}))})};Kr.displayName=Ur;var qr=`DialogOverlay`,Jr=F.forwardRef((e,t)=>{let n=Gr(qr,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=J(qr,e.__scopeDialog);return a.modal?(0,B.jsx)(hn,{present:r||a.open,children:(0,B.jsx)(Xr,{...i,ref:t})}):null});Jr.displayName=qr;var Yr=Ot(`DialogOverlay.RemoveScroll`),Xr=F.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=J(qr,n);return(0,B.jsx)(Dr,{as:Yr,allowPinchZoom:!0,shards:[i.contentRef],children:(0,B.jsx)(H.div,{"data-state":si(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),Y=`DialogContent`,Zr=F.forwardRef((e,t)=>{let n=Gr(Y,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=J(Y,e.__scopeDialog);return(0,B.jsx)(hn,{present:r||a.open,children:a.modal?(0,B.jsx)(Qr,{...i,ref:t}):(0,B.jsx)($r,{...i,ref:t})})});Zr.displayName=Y;var Qr=F.forwardRef((e,t)=>{let n=J(Y,e.__scopeDialog),r=F.useRef(null),i=z(t,n.contentRef,r);return F.useEffect(()=>{let e=r.current;if(e)return Fr(e)},[]),(0,B.jsx)(ei,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:L(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:L(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:L(e.onFocusOutside,e=>e.preventDefault())})}),$r=F.forwardRef((e,t)=>{let n=J(Y,e.__scopeDialog),r=F.useRef(!1),i=F.useRef(!1);return(0,B.jsx)(ei,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),ei=F.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=J(Y,n),c=F.useRef(null),l=z(t,c);return bn(),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(en,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,B.jsx)(Ut,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":si(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(di,{titleId:s.titleId}),(0,B.jsx)(pi,{contentRef:c,descriptionId:s.descriptionId})]})]})}),ti=`DialogTitle`,ni=F.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=J(ti,n);return(0,B.jsx)(H.h2,{id:i.titleId,...r,ref:t})});ni.displayName=ti;var ri=`DialogDescription`,ii=F.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=J(ri,n);return(0,B.jsx)(H.p,{id:i.descriptionId,...r,ref:t})});ii.displayName=ri;var ai=`DialogClose`,oi=F.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=J(ai,n);return(0,B.jsx)(H.button,{type:`button`,...r,ref:t,onClick:L(e.onClick,()=>i.onOpenChange(!1))})});oi.displayName=ai;function si(e){return e?`open`:`closed`}var ci=`DialogTitleWarning`,[li,ui]=_t(ci,{contentName:Y,titleName:ti,docsSlug:`dialog`}),di=({titleId:e})=>{let t=ui(ci),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
42
+
43
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
44
+
45
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return F.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},fi=`DialogDescriptionWarning`,pi=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${ui(fi).contentName}}.`;return F.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},mi=Br,hi=Kr,gi=Jr,_i=Zr,vi=Symbol.for(`react.lazy`),yi=F.use;function bi(e){return typeof e==`object`&&!!e&&`then`in e}function xi(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===vi&&`_payload`in e&&bi(e._payload)}function Si(e){let t=Ci(e),n=F.forwardRef((e,n)=>{let{children:r,...i}=e;xi(r)&&typeof yi==`function`&&(r=yi(r._payload));let a=F.Children.toArray(r),o=a.find(Ti);if(o){let e=o.props.children,r=a.map(t=>t===o?F.Children.count(e)>1?F.Children.only(null):F.isValidElement(e)?e.props.children:null:t);return(0,B.jsx)(t,{...i,ref:n,children:F.isValidElement(e)?F.cloneElement(e,void 0,r):null})}return(0,B.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Ci(e){let t=F.forwardRef((e,t)=>{let{children:n,...r}=e;if(xi(n)&&typeof yi==`function`&&(n=yi(n._payload)),F.isValidElement(n)){let e=Di(n),i=Ei(r,n.props);return n.type!==F.Fragment&&(i.ref=t?R(t,e):e),F.cloneElement(n,i)}return F.Children.count(n)>1?F.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var wi=Symbol(`radix.slottable`);function Ti(e){return F.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===wi}function Ei(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Di(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var X=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=Si(`Primitive.${t}`),r=F.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,B.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Oi=`[cmdk-group=""]`,ki=`[cmdk-group-items=""]`,Ai=`[cmdk-group-heading=""]`,ji=`[cmdk-item=""]`,Mi=`${ji}:not([aria-disabled="true"])`,Ni=`cmdk-item-select`,Z=`data-value`,Pi=(e,t,n)=>ht(e,t,n),Fi=F.createContext(void 0),Ii=()=>F.useContext(Fi),Li=F.createContext(void 0),Ri=()=>F.useContext(Li),zi=F.createContext(void 0),Bi=F.forwardRef((e,t)=>{let n=$i(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=$i(()=>new Set),i=$i(()=>new Map),a=$i(()=>new Map),o=$i(()=>new Set),s=Qi(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,..._}=e,v=V(),y=V(),b=V(),x=F.useRef(null),S=ta();Q(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,C.emit()}},[u]),Q(()=>{S(6,ee)},[]);let C=F.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)O(),E(),S(1,D);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(b);e?e.focus():(i=document.getElementById(v))==null||i.focus()}if(S(7,()=>{n.current.selectedItemId=k()?.id,C.emit()}),r||S(5,ee),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}C.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),w=F.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,T(t,r)),S(2,()=>{E(),C.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),S(3,()=>{O(),E(),n.current.value||D(),C.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=k();S(4,()=>{O(),t?.getAttribute(`id`)===e&&D(),C.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:v,inputId:b,labelId:y,listInnerRef:x}),[]);function T(e,t){let r=s.current?.filter??Pi;return e?r(e,n.current.search,t):0}function E(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=x.current;te().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(ki);t?t.appendChild(e.parentElement===t?e:e.closest(`${ki} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${ki} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=x.current?.querySelector(`${Oi}[${Z}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function D(){let e=te().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Z);C.setState(`value`,e||void 0)}function O(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=T(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function ee(){var e;let t=k();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Oi)?.querySelector(Ai))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function k(){return x.current?.querySelector(`${ji}[aria-selected="true"]`)}function te(){return Array.from(x.current?.querySelectorAll(Mi)||[])}function A(e){let t=te()[e];t&&C.setState(`value`,t.getAttribute(Z))}function ne(e){var t;let n=k(),r=te(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&C.setState(`value`,a.getAttribute(Z))}function re(e){let t=k()?.closest(Oi),n;for(;t&&!n;)t=e>0?Xi(t,Oi):Zi(t,Oi),n=t?.querySelector(Mi);n?C.setState(`value`,n.getAttribute(Z)):ne(e)}let ie=()=>A(te().length-1),ae=e=>{e.preventDefault(),e.metaKey?ie():e.altKey?re(1):ne(1)},oe=e=>{e.preventDefault(),e.metaKey?A(0):e.altKey?re(-1):ne(-1)};return F.createElement(X.div,{ref:t,tabIndex:-1,..._,"cmdk-root":``,onKeyDown:e=>{var t;(t=_.onKeyDown)==null||t.call(_,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&ae(e);break;case`ArrowDown`:ae(e);break;case`p`:case`k`:g&&e.ctrlKey&&oe(e);break;case`ArrowUp`:oe(e);break;case`Home`:e.preventDefault(),A(0);break;case`End`:e.preventDefault(),ie();break;case`Enter`:{e.preventDefault();let t=k();if(t){let e=new Event(Ni);t.dispatchEvent(e)}}}}},F.createElement(`label`,{"cmdk-label":``,htmlFor:w.inputId,id:w.labelId,style:ia},c),ra(e,e=>F.createElement(Li.Provider,{value:C},F.createElement(Fi.Provider,{value:w},e))))}),Vi=F.forwardRef((e,t)=>{let n=V(),r=F.useRef(null),i=F.useContext(zi),a=Ii(),o=Qi(e),s=o.current?.forceMount??i?.forceMount;Q(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=ea(n,r,[e.value,e.children,r],e.keywords),l=Ri(),u=$(e=>e.value&&e.value===c.current),d=$(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);F.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Ni,f),()=>t.removeEventListener(Ni,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:_,keywords:v,...y}=e;return F.createElement(X.div,{ref:R(r,t),...y,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Hi=F.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=V(),s=F.useRef(null),c=F.useRef(null),l=V(),u=Ii(),d=$(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);Q(()=>u.group(o),[]),ea(o,s,[e.value,e.heading,c]);let f=F.useMemo(()=>({id:o,forceMount:i}),[i]);return F.createElement(X.div,{ref:R(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&F.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),ra(e,e=>F.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},F.createElement(zi.Provider,{value:f},e))))}),Ui=F.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=F.useRef(null),a=$(e=>!e.search);return!n&&!a?null:F.createElement(X.div,{ref:R(i,t),...r,"cmdk-separator":``,role:`separator`})}),Wi=F.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Ri(),o=$(e=>e.search),s=$(e=>e.selectedItemId),c=Ii();return F.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),F.createElement(X.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Gi=F.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=F.useRef(null),o=F.useRef(null),s=$(e=>e.selectedItemId),c=Ii();return F.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),F.createElement(X.div,{ref:R(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},ra(e,e=>F.createElement(`div`,{ref:R(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),Ki=F.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return F.createElement(mi,{open:n,onOpenChange:r},F.createElement(hi,{container:o},F.createElement(gi,{"cmdk-overlay":``,className:i}),F.createElement(_i,{"aria-label":e.label,"cmdk-dialog":``,className:a},F.createElement(Bi,{ref:t,...s}))))}),qi=F.forwardRef((e,t)=>$(e=>e.filtered.count===0)?F.createElement(X.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),Ji=F.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return F.createElement(X.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},ra(e,e=>F.createElement(`div`,{"aria-hidden":!0},e)))}),Yi=Object.assign(Bi,{List:Gi,Item:Vi,Input:Wi,Group:Hi,Separator:Ui,Dialog:Ki,Empty:qi,Loading:Ji});function Xi(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function Zi(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function Qi(e){let t=F.useRef(e);return Q(()=>{t.current=e}),t}var Q=typeof window>`u`?F.useEffect:F.useLayoutEffect;function $i(e){let t=F.useRef();return t.current===void 0&&(t.current=e()),t}function $(e){let t=Ri(),n=()=>e(t.snapshot());return F.useSyncExternalStore(t.subscribe,n,n)}function ea(e,t,n,r=[]){let i=F.useRef(),a=Ii();return Q(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Z,s),i.current=s}),i}var ta=()=>{let[e,t]=F.useState(),n=$i(()=>new Map);return Q(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function na(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function ra({asChild:e,children:t},n){return e&&F.isValidElement(t)?F.cloneElement(na(t),{ref:t.ref},n(t.props.children)):n(t)}var ia={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`};function aa(e){let t=(0,I.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=v(`bg-popover text-popover-foreground flex size-full flex-col overflow-hidden rounded-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,B.jsx)(Yi,{"data-slot":`command`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function oa(e){let t=(0,I.c)(24),n,r,i,a,o,s;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6]):({title:a,description:o,children:n,className:r,showCloseButton:s,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s);let c=a===void 0?`Command Palette`:a,l=o===void 0?`Search for a command to run...`:o,u=s===void 0?!1:s,d;t[7]===c?d=t[8]:(d=(0,B.jsx)(he,{children:c}),t[7]=c,t[8]=d);let f;t[9]===l?f=t[10]:(f=(0,B.jsx)(ye,{children:l}),t[9]=l,t[10]=f);let p;t[11]!==d||t[12]!==f?(p=(0,B.jsxs)(fe,{className:`sr-only`,children:[d,f]}),t[11]=d,t[12]=f,t[13]=p):p=t[13];let m;t[14]===r?m=t[15]:(m=v(`top-1/3 translate-y-0 overflow-hidden rounded-none p-0`,r),t[14]=r,t[15]=m);let h;t[16]!==n||t[17]!==u||t[18]!==m?(h=(0,B.jsx)(_e,{className:m,showCloseButton:u,children:n}),t[16]=n,t[17]=u,t[18]=m,t[19]=h):h=t[19];let g;return t[20]!==i||t[21]!==p||t[22]!==h?(g=(0,B.jsxs)(de,{...i,children:[p,h]}),t[20]=i,t[21]=p,t[22]=h,t[23]=g):g=t[23],g}function sa(e){let t=(0,I.c)(11),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=v(`w-full font-normal outline-hidden disabled:cursor-not-allowed disabled:opacity-50`,n),t[3]=n,t[4]=i);let a;t[5]!==r||t[6]!==i?(a=(0,B.jsx)(Yi.Input,{"data-slot":`command-input`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7];let o;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,B.jsx)(ge,{children:(0,B.jsx)(Ze,{className:`size-3 shrink-0 opacity-50`})}),t[8]=o):o=t[8];let s;return t[9]===a?s=t[10]:(s=(0,B.jsx)(`div`,{"data-slot":`command-input-wrapper`,className:`border-b pb-0`,children:(0,B.jsxs)(be,{className:`border-input/30 bg-input/30 h-8 border-none shadow-none! *:data-[slot=input-group-addon]:pl-2!`,children:[a,o]})}),t[9]=a,t[10]=s),s}function ca(e){let t=(0,I.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=v(`no-scrollbar max-h-72 scroll-py-0 overflow-x-hidden overflow-y-auto outline-none`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,B.jsx)(Yi.List,{"data-slot":`command-list`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function la(e){let t=(0,I.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=v(`py-6 text-center font-normal`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,B.jsx)(Yi.Empty,{"data-slot":`command-empty`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function ua(e){let t=(0,I.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=v(`text-foreground **:[[cmdk-group-heading]]:text-muted-foreground overflow-hidden font-normal **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:font-normal`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,B.jsx)(Yi.Group,{"data-slot":`command-group`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function da(e){let t=(0,I.c)(11),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;t[4]===r?a=t[5]:(a=v(`group/command-item data-selected:bg-muted data-selected:text-foreground data-selected:*:[svg]:text-foreground relative flex cursor-default items-center gap-2 rounded-none px-2 py-2 font-normal outline-hidden select-none in-data-[slot=dialog-content]:rounded-none! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3`,r),t[4]=r,t[5]=a);let o;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,B.jsx)(ue,{className:`ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100`}),t[6]=o):o=t[6];let s;return t[7]!==n||t[8]!==i||t[9]!==a?(s=(0,B.jsxs)(Yi.Item,{"data-slot":`command-item`,className:a,...i,children:[n,o]}),t[7]=n,t[8]=i,t[9]=a,t[10]=s):s=t[10],s}function fa(e){let t=(0,I.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=v(`text-muted-foreground group-data-selected/command-item:text-foreground ml-auto font-normal tracking-widest`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,B.jsx)(`span`,{"data-slot":`command-shortcut`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var pa=[`[&_svg]:text-[oklch(0.74_0.085_50)] [&_.tree-label]:text-[oklch(0.8_0.085_50)]`,`[&_svg]:text-[oklch(0.72_0.075_150)] [&_.tree-label]:text-[oklch(0.78_0.075_150)]`,`[&_svg]:text-[oklch(0.72_0.075_220)] [&_.tree-label]:text-[oklch(0.78_0.075_220)]`,`[&_svg]:text-[oklch(0.72_0.075_285)] [&_.tree-label]:text-[oklch(0.78_0.075_285)]`,`[&_svg]:text-[oklch(0.72_0.075_20)] [&_.tree-label]:text-[oklch(0.78_0.075_20)]`,`[&_svg]:text-[oklch(0.74_0.065_95)] [&_.tree-label]:text-[oklch(0.8_0.065_95)]`],ma=De(e=>ze(N.runtime.atom(d(N,t=>w(e)?t(`projects.branches`,{cwd:e}):l(new Me({branches:[],defaultBranch:`main`}))),{initialValue:new Me({branches:[],defaultBranch:`main`})})));function ha(){let e=(0,I.c)(23),t=le.useNavigate(),n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={select:ga},e[0]=n):n=e[0];let r=Ve(n),i;e[1]===r.activeWorktreeId?i=e[2]:(i=Le(r.activeWorktreeId),e[1]=r.activeWorktreeId,e[2]=i);let a=P(i),o,s,c,l,u;e[3]===t?(o=e[4],s=e[5],c=e[6],l=e[7],u=e[8]):(o=e=>{(0,F.startTransition)(()=>{t({params:{worktree:Fe(e)},to:`/$worktree/diff`})})},s=e=>{(0,F.startTransition)(()=>{t({params:{worktree:Fe(e)},to:`/$worktree/terminal`})})},c=(e,n)=>{(0,F.startTransition)(()=>{t({params:{worktree:Fe(e)},search:{origin:n},to:`/$worktree/portless`})})},l=(e,n)=>{(0,F.startTransition)(()=>{t({params:{worktree:Fe(e)},search:{agentId:n},to:`/$worktree/agent`})})},u=(e,n,r,i,a,o)=>{(0,F.startTransition)(()=>{t({params:{worktree:Fe(e)},search:{command:r,cwd:o,env:a,inactive:i,sessionId:n},to:`/$worktree/run`})})},e[3]=t,e[4]=o,e[5]=s,e[6]=c,e[7]=l,e[8]=u);let d;e[9]!==a.value.activeProject||e[10]!==a.value.activeWorktree||e[11]!==a.value.projects||e[12]!==r.activeView||e[13]!==o||e[14]!==s||e[15]!==c||e[16]!==l||e[17]!==u?(d=(0,B.jsx)(Ce,{defaultSize:`22%`,minSize:`16%`,maxSize:`34%`,children:(0,B.jsx)(Ra,{activeProject:a.value.activeProject,activeWorktree:a.value.activeWorktree,activeView:r.activeView,projects:a.value.projects,selectWorktree:o,selectTerminal:s,selectPortless:c,selectAgent:l,selectRun:u})}),e[9]=a.value.activeProject,e[10]=a.value.activeWorktree,e[11]=a.value.projects,e[12]=r.activeView,e[13]=o,e[14]=s,e[15]=c,e[16]=l,e[17]=u,e[18]=d):d=e[18];let f;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,B.jsx)(Te,{}),e[19]=f):f=e[19];let p;e[20]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,B.jsx)(Ce,{defaultSize:`86%`,minSize:`60%`,children:(0,B.jsx)(`div`,{className:`flex h-full min-h-0 flex-col`,children:(0,B.jsx)(ce,{})})}),e[20]=p):p=e[20];let m;return e[21]===d?m=e[22]:(m=(0,B.jsx)(`div`,{className:`bg-background h-full min-h-0 flex-1 overflow-hidden`,children:(0,B.jsxs)(we,{orientation:`horizontal`,className:`h-full min-h-0 overflow-hidden`,children:[d,f,p]})}),e[21]=d,e[22]=m),m}function ga(e){return{activeView:b(f(e.location.pathname),p(A(`/terminal`),xa),p(A(`/portless`),ba),p(A(`/run`),ya),p(A(`/agent`),va),k(_a)),activeWorktreeId:re(`/`)(e.location.pathname)[1]}}function _a(){return`diff`}function va(){return`agent`}function ya(){return`run`}function ba(){return`portless`}function xa(){return`terminal`}function Sa(e){let t=re(`/`)(e);for(let n=t.length-1;n>=0;--n)if(w(t[n]??``)&&t[n]!==`.`)return t[n]??e;return e}function Ca(e){let t=ee(`/home/`)(e)?b(re(`/`)(e),g(3),h(`/`)):void 0;return u(t)&&ee(`${t}/`)(e)?`~/${ae(E(t)+1)(e)}`:Sa(e)}function wa(e){let t=(0,I.c)(4);if(e.root){let n=e.dirty?`text-amber-500`:`text-current`,r;return t[0]===n?r=t[1]:(r=(0,B.jsx)(Je,{className:n}),t[0]=n,t[1]=r),r}let n=e.dirty?`text-amber-500`:`text-current`,r;return t[2]===n?r=t[3]:(r=(0,B.jsx)(Qe,{className:n}),t[2]=n,t[3]=r),r}function Ta(e){return e.portless===!0?{cwd:e.cwd,sessionId:e.sessionId}:{args:[`-lc`,e.command],command:`sh`,cwd:e.cwd,sessionId:e.sessionId}}function Ea(e){let t=e.service??e.name;return t===`dev`?0:t===`client`?1:t===`server`?2:3}function Da(e){let t=e.service??e.name;return t===`dev`?e.packageFolder:`${e.packageFolder}:${t}`}function Oa(e){return[...e].toSorted((e,t)=>{let n=e.packageFolder.localeCompare(t.packageFolder);if(n!==0)return n;let r=Ea(e)-Ea(t);return r===0?Da(e).localeCompare(Da(t)):r})}var ka=De(e=>Oe(t=>b(b(e,m(e=>t.result(Ae(Ta(e))))),a,te(c(e=>je(e.state)&&e.state!==`idle`)))));function Aa(e){let t=(0,I.c)(36),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=N.mutation(`terminal.restart`),r={mode:`promise`},t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i=M(n,r),a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=N.mutation(`terminal.stop`),o={mode:`promise`},t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s=M(a,o),c;t[4]===e.cwd?c=t[5]:(c=Ne(e.cwd),t[4]=e.cwd,t[5]=c);let l=P(c),u=Oa(l.value),d;t[6]===l.value?d=t[7]:(d=ka(l.value),t[6]=l.value,t[7]=d);let f=P(d);if(l.value.length===0)return null;let p;t[8]!==i||t[9]!==l.value?(p=async function(){for(let e of b(l.value,m(Ta)))await i({payload:e})},t[8]=i,t[9]=l.value,t[10]=p):p=t[10];let h=p,g;t[11]!==l.value||t[12]!==s?(g=async function(){for(let e of b(l.value,m(Ta)))await s({payload:e})},t[11]=l.value,t[12]=s,t[13]=g):g=t[13];let _=g,v;t[14]!==f.value||t[15]!==h||t[16]!==_?(v=e=>{e.stopPropagation(),f.value?_():h()},t[14]=f.value,t[15]=h,t[16]=_,t[17]=v):v=t[17];let y=f.value?`Stop all portless services`:`Start all portless services`,x;t[18]===f.value?x=t[19]:(x=f.value?(0,B.jsx)(Qe,{className:`size-3`}):(0,B.jsx)(Ye,{className:`size-3`}),t[18]=f.value,t[19]=x);let S;t[20]!==y||t[21]!==x||t[22]!==v?(S=(0,B.jsx)(`span`,{className:`flex h-full items-center justify-end`,children:(0,B.jsx)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground flex size-6 items-center justify-center`,onClick:v,title:y,children:x})}),t[20]=y,t[21]=x,t[22]=v,t[23]=S):S=t[23];let C;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,B.jsx)(qe,{}),t[24]=C):C=t[24];let w;t[25]===S?w=t[26]:(w=(0,B.jsx)(j,{actions:S,icon:C,selected:!1,onClick:ja,children:`portless`}),t[25]=S,t[26]=w);let T;t[27]!==e.cwd||t[28]!==e.selectPortless||t[29]!==e.selectRun?(T=t=>(0,B.jsx)(Ma,{cwd:e.cwd,label:Da(t),script:t,selectPortless:e.selectPortless,selectRun:e.selectRun},t.sessionId),t[27]=e.cwd,t[28]=e.selectPortless,t[29]=e.selectRun,t[30]=T):T=t[30];let E=u.map(T),D;t[31]===E?D=t[32]:(D=(0,B.jsx)(`ul`,{className:`border-border/70 ml-[19px] flex flex-col border-l pl-2`,children:E}),t[31]=E,t[32]=D);let O;return t[33]!==w||t[34]!==D?(O=(0,B.jsxs)(`li`,{className:`w-full min-w-0`,children:[w,D]}),t[33]=w,t[34]=D,t[35]=O):O=t[35],O}function ja(){}function Ma(e){let t=(0,I.c)(19),n,r;if(t[0]!==e.script){let i=Ta(e.script);n=P,r=Ae(i),t[0]=e.script,t[1]=n,t[2]=r}else n=t[1],r=t[2];let i=n(r),a;t[3]!==i.value.state||t[4]!==e?(a=t=>{t.stopPropagation(),e.selectRun(e.cwd,e.script.sessionId,void 0,i.value.state===`idle`)},t[3]=i.value.state,t[4]=e,t[5]=a):a=t[5];let o=`Open ${e.label} terminal`,s;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,B.jsx)($e,{className:`size-3`}),t[6]=s):s=t[6];let c;t[7]!==a||t[8]!==o?(c=(0,B.jsx)(`span`,{className:`flex h-full items-center justify-end`,children:(0,B.jsx)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground flex size-6 items-center justify-center`,onClick:a,title:o,children:s})}),t[7]=a,t[8]=o,t[9]=c):c=t[9];let l;t[10]===i.value.state?l=t[11]:(l=(0,B.jsx)(me,{state:i.value.state}),t[10]=i.value.state,t[11]=l);let u;t[12]===e?u=t[13]:(u=()=>{e.selectPortless(e.cwd,e.script.origin)},t[12]=e,t[13]=u);let d;return t[14]!==e.label||t[15]!==c||t[16]!==l||t[17]!==u?(d=(0,B.jsx)(`li`,{className:`w-full min-w-0`,children:(0,B.jsx)(j,{actions:c,icon:l,selected:!1,onClick:u,children:e.label})}),t[14]=e.label,t[15]=c,t[16]=l,t[17]=u,t[18]=d):d=t[18],d}var Na=[{args:[`--model`,`openai/gpt-5.5`],command:`opencode`,icon:`opencode`,label:`opencode`},{args:[`--model`,`gpt-5.5`,`-c`,`model_reasoning_effort=low`,`--dangerously-bypass-approvals-and-sandbox`],command:`codex`,icon:`codex`,label:`codex`},{args:[`--provider`,`openai-codex`,`--model`,`gpt-5.5:low`],command:`pi`,icon:`pi`,label:`pi`}];function Pa(e){let t=(0,I.c)(14),n;t[0]===e?n=t[1]:(n=t=>{t.stopPropagation(),e.onStop()},t[0]=e,t[1]=n);let r=`Stop ${e.session.label}`,i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,B.jsx)(Qe,{className:`size-3`}),t[2]=i):i=t[2];let a;t[3]!==n||t[4]!==r?(a=(0,B.jsx)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground flex size-6 items-center justify-center`,onClick:n,title:r,children:i}),t[3]=n,t[4]=r,t[5]=a):a=t[5];let o;t[6]===e.session.state.state?o=t[7]:(o=(0,B.jsx)(me,{state:e.session.state.state}),t[6]=e.session.state.state,t[7]=o);let s=e.session.state.title?`Title: ${e.session.state.title}`:e.session.label,c=e.session.state.title===``?e.session.label:e.session.state.title,l;return t[8]!==e.onSelect||t[9]!==a||t[10]!==o||t[11]!==s||t[12]!==c?(l=(0,B.jsx)(`li`,{className:`w-full min-w-0`,children:(0,B.jsx)(j,{actions:a,icon:o,selected:!1,title:s,onClick:e.onSelect,children:c})}),t[8]=e.onSelect,t[9]=a,t[10]=o,t[11]=s,t[12]=c,t[13]=l):l=t[13],l}function Fa(e){let t=(0,I.c)(20),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=N.mutation(`agents.create`),r={mode:`promise`},t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i=M(n,r),a,o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=N.mutation(`agents.remove`),o={mode:`promise`},t[2]=a,t[3]=o):(a=t[2],o=t[3]);let s=M(a,o),c;t[4]===e.cwd?c=t[5]:(c=Ie(e.cwd),t[4]=e.cwd,t[5]=c);let l=P(c),u;t[6]!==i||t[7]!==e?(u=async function(t){let n=await i({payload:{...t,cwd:e.cwd}});e.selectAgent(e.cwd,n.uuid)},t[6]=i,t[7]=e,t[8]=u):u=t[8];let d=u,f;t[9]!==e.cwd||t[10]!==s?(f=function(t){s({payload:{cwd:e.cwd,uuid:t.uuid}})},t[9]=e.cwd,t[10]=s,t[11]=f):f=t[11];let p=f,m;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,B.jsx)(j,{icon:(0,B.jsx)(We,{}),selected:!1,onClick:La,children:`agents`}),t[12]=m):m=t[12];let h;t[13]!==e||t[14]!==l||t[15]!==d||t[16]!==p?(h=Na.map(t=>{let n=b(l.value,C(e=>e.command===t.command));return(0,B.jsxs)(`li`,{className:`w-full min-w-0`,children:[(0,B.jsx)(j,{actions:(0,B.jsx)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground flex size-6 items-center justify-center`,onClick:e=>{e.stopPropagation(),d(t)},title:`Start ${t.label}`,children:(0,B.jsx)(Ue,{className:`size-3`})}),icon:(0,B.jsx)(ve,{layer:t.icon}),selected:!1,onClick:Ia,children:t.label}),n.length>0&&(0,B.jsx)(`ul`,{className:`border-border/70 ml-[19px] flex flex-col border-l pl-2`,children:n.map(t=>(0,B.jsx)(Pa,{session:t,onSelect:()=>{e.selectAgent(e.cwd,t.uuid)},onStop:()=>{p(t)}},t.uuid))})]},t.command)}),t[13]=e,t[14]=l,t[15]=d,t[16]=p,t[17]=h):h=t[17];let g;return t[18]===h?g=t[19]:(g=(0,B.jsxs)(`li`,{className:`w-full min-w-0`,children:[m,(0,B.jsx)(`ul`,{className:`border-border/70 ml-[19px] flex flex-col border-l pl-2`,children:h})]}),t[18]=h,t[19]=g),g}function Ia(){}function La(){}function Ra(e){let t=Be(ke),[n,r]=Re(N.mutation(`projects.cleanup`)),a=M(N.mutation(`projects.createWorktree`),{mode:`promise`}),o=M(N.mutation(`projects.deleteWorktree`),{mode:`promise`}),c=(0,F.useState)(``),l=(0,F.useState)(!1),u=(0,F.useState)(e.activeProject?.repository.root),d=(0,F.useState)(``),h=(0,F.useState)(!1),g=b(e.projects,_(e=>e.repository.root===u[0]),i)??e.activeProject,v=P(ma(g?.repository.root??``)),y=b(v.value.branches,C(e=>e.type===`local`),m(e=>e.name)),x=b(v.value.branches,C(e=>w(e.name)),C(e=>e.type===`local`||!ne(y,e.name)),D((e,t)=>e.name===t.name&&e.type===t.type&&e.remote===t.remote),C(e=>!b(g?.worktrees??[],m(e=>e.branch??``),C(w),ne(e.name))));async function S(n){let r=n?.name??c[0];if(se(r)||w(d[0]))return;let i=n===void 0?{_tag:`new`}:f(n).pipe(p({type:`local`},()=>({_tag:`local`})),k(e=>({_tag:`remote`,remote:e.remote??`origin`})));d[1](r);try{let n=await a({payload:{branch:r,cwd:(g??e.activeProject)?.repository.root??``,source:i}});l[1](!1),c[1](``),t(),e.selectWorktree(n)}finally{d[1](``)}}async function E(){if(!(!e.activeWorktree||h[0])){h[1](!0);try{await o({payload:{cwd:e.activeWorktree.root}}),t()}finally{h[1](!1)}}}return(0,B.jsxs)(`div`,{className:`flex h-full flex-col border-r`,children:[(0,B.jsxs)(`div`,{className:`grid h-8 grid-cols-[minmax(0,1fr)_auto] items-center border-b`,children:[(0,B.jsx)(`button`,{type:`button`,className:`text-muted-foreground hover:text-foreground flex h-full min-w-0 items-center px-3 text-left`,onClick:()=>{e.activeWorktree&&navigator.clipboard.writeText(e.activeWorktree.root)},children:(0,B.jsx)(`span`,{className:`min-w-0 truncate`,children:e.activeWorktree?Ca(e.activeWorktree.root):`No worktree selected`})}),e.activeWorktree&&e.activeWorktree.root!==e.activeProject?.repository.root&&(0,B.jsx)(`button`,{type:`button`,className:`text-destructive hover:bg-muted hover:text-destructive flex h-8 w-8 items-center justify-center`,disabled:h[0],onClick:()=>{e.activeWorktree&&confirm(`Delete worktree ${e.activeWorktree.branch??Sa(e.activeWorktree.root)}?`)&&(E(),l[1](!1))},title:`Delete worktree`,children:h[0]?(0,B.jsx)(Se,{className:`size-3 animate-spin`}):(0,B.jsx)(et,{className:`size-3`})})]}),(0,B.jsx)(oa,{open:l[0],onOpenChange:l[1],title:`Create worktree`,description:`Create or open a worktree branch.`,className:`sm:max-w-2xl`,children:(0,B.jsxs)(aa,{onKeyDown:e=>{e.stopPropagation(),e.key===`Escape`&&l[1](!1)},children:[(0,B.jsx)(sa,{placeholder:`Create in ${g?Sa(g.repository.root):`workspace`}...`,value:c[0],onValueChange:c[1],onKeyDown:e=>{e.key===`Enter`&&w(c[0])&&g&&(e.preventDefault(),S(b(x,_(e=>e.name===c[0]),i)))}}),(0,B.jsxs)(ca,{children:[(0,B.jsx)(la,{children:`No command found.`}),g&&(0,B.jsxs)(ua,{children:[m(x,e=>{let t=d[0]===e.name?(0,B.jsx)(Se,{className:`animate-spin`}):f(e.type).pipe(p(`local`,()=>(0,B.jsx)(Ge,{})),k(()=>(0,B.jsx)(Qe,{})));return(0,B.jsxs)(da,{value:e.name,onSelect:()=>{c[1](e.name),S(e)},children:[t,(0,B.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,B.jsx)(fa,{children:e.type})]},`${e.type}:${e.remote??``}:${e.name}`)}),w(c[0])&&T(_(x,e=>e.name===c[0]))&&(0,B.jsxs)(da,{value:`create ${c[0]}`,onSelect:()=>void S(),children:[d[0]===c[0]?(0,B.jsx)(Se,{className:`animate-spin`}):(0,B.jsx)(Ke,{}),`Create `,c[0],(0,B.jsxs)(fa,{children:[`origin/`,v.value.defaultBranch]})]})]})]})]})}),(0,B.jsx)(xe,{className:`min-h-0 flex-1 overflow-y-auto px-0 py-1`,children:(0,B.jsx)(pe,{children:m(e.projects,(t,a)=>{let o=i(_(t.worktrees,e=>e.root===t.repository.root))??t.worktrees[0];return(0,B.jsxs)(`li`,{className:`min-w-0 py-1 first:pt-0`,children:[(0,B.jsxs)(`div`,{className:`text-foreground grid h-7 w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-2 px-3 pr-2 text-left font-normal hover:bg-transparent ${pa[a%pa.length]}`,children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[(0,B.jsx)(`span`,{className:`flex size-3 shrink-0 items-center justify-center [&_svg]:size-3`,children:(0,B.jsx)(He,{})}),(0,B.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,B.jsx)(`button`,{type:`button`,className:`tree-label flex min-w-0 items-center gap-1.5 text-left`,onClick:()=>{o&&e.selectWorktree(o.root)},children:(0,B.jsx)(`span`,{className:`min-w-0 truncate`,children:Sa(t.repository.root)})})})]}),(0,B.jsxs)(`span`,{className:`flex items-center`,children:[(0,B.jsx)(oe,{variant:`ghost`,size:`icon-xs`,className:`h-5 w-5 rounded-none opacity-70 hover:opacity-100`,disabled:Ee(n),onClick:e=>{e.stopPropagation(),r({payload:{cwd:t.repository.root}})},title:Pe(n)?s(O(n.cause)):`Cleanup project`,children:Ee(n)?(0,B.jsx)(Se,{className:`size-3 animate-spin`}):(0,B.jsx)(Xe,{className:`size-3`})}),(0,B.jsx)(oe,{variant:`ghost`,size:`icon-xs`,className:`h-5 w-5 rounded-none opacity-70 hover:opacity-100`,onClick:e=>{e.stopPropagation(),u[1](t.repository.root),c[1](``),l[1](!0)},title:`Create worktree`,children:(0,B.jsx)(Ke,{className:`size-3`})})]})]}),(0,B.jsx)(`ul`,{className:`border-border/70 ml-[19px] flex flex-col border-l pl-2`,children:m(t.worktrees,n=>(0,B.jsxs)(`li`,{className:`w-full min-w-0`,children:[(0,B.jsx)(j,{icon:(0,B.jsx)(wa,{dirty:n.status?.dirtyTracked??n.status?.untracked??n.status?.unpushedCommits??(n.status?.behind??0)>0,root:n.root===t.repository.root}),selected:e.activeView===`diff`&&e.activeWorktree?.root===n.root,onClick:()=>{e.selectWorktree(n.root)},children:n.branch??Sa(n.root)},n.root),(0,B.jsxs)(`ul`,{className:`border-border/70 ml-[19px] flex flex-col border-l pl-2`,children:[(0,B.jsx)(Fa,{cwd:n.root,selectAgent:e.selectAgent}),(0,B.jsx)(`li`,{className:`w-full min-w-0`,children:(0,B.jsx)(j,{icon:(0,B.jsx)($e,{}),selected:e.activeView===`terminal`&&e.activeWorktree?.root===n.root,onClick:()=>{e.selectTerminal(n.root)},children:`terminal`})}),(0,B.jsx)(Aa,{cwd:n.root,selectPortless:e.selectPortless,selectRun:e.selectRun})]})]},n.root))})]},t.repository.gitDirectory)})})})]})}export{ha as component};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/route-C-L2dkin.js","assets/chunk-QTnfLwEv.js","assets/state-CVjPP5QG.js","assets/button-Dz6Az3h_.js","assets/compiler-runtime-rGeCHUuX.js","assets/input-group-1-P7Y_75.js","assets/preload-helper-CjdClQve.js","assets/resizable-BaJ5ba6-.js","assets/loader-circle-BxillczB.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./chunk-QTnfLwEv.js";import{n as t,r as n}from"./compiler-runtime-rGeCHUuX.js";import{$o as r,As as i,Bs as a,Cs as o,Ds as s,Es as c,Fs as l,Gs as u,Is as d,Ls as f,Ms as p,Os as m,Ps as h,Rs as g,Ss as _,Ts as v,Us as y,Vs as b,X as x,_s as S,as as C,bs as w,cs as T,ds as E,es as D,fs as ee,gs as te,hs as ne,js as O,ks as k,ms as A,ps as re,rs as ie,us as ae,vs as j,vt as oe,ws as se,xs as ce,ys as le,zs as M}from"./button-Dz6Az3h_.js";import{t as ue}from"./preload-helper-CjdClQve.js";function de(e){let t=e;return{get(){return t},set(e){t=h(e,t)}}}function fe(e){return{get(){return e()}}}function pe(e,t){let{createMutableStore:n,createReadonlyStore:r,batch:i,init:a}=t,o=new Map,s=new Map,c=new Map,l=n(e.status),u=n(e.loadedAt),d=n(e.isLoading),f=n(e.isTransitioning),p=n(e.location),m=n(e.resolvedLocation),h=n(e.statusCode),g=n(e.redirect),_=n([]),y=n([]),b=n([]),x=r(()=>N(o,_.get())),S=r(()=>N(s,y.get())),C=r(()=>N(c,b.get())),w=r(()=>_.get()[0]),T=r(()=>_.get().some(e=>o.get(e)?.get().status===`pending`)),E=r(()=>({locationHref:p.get().href,resolvedLocationHref:m.get()?.href,status:l.get()})),D=r(()=>({status:l.get(),loadedAt:u.get(),isLoading:d.get(),isTransitioning:f.get(),matches:x.get(),location:p.get(),resolvedLocation:m.get(),statusCode:h.get(),redirect:g.get()})),ee=v(64);function te(e){let t=ee.get(e);return t||(t=r(()=>{let t=_.get();for(let n of t){let t=o.get(n);if(t&&t.routeId===e)return t.get()}}),ee.set(e,t)),t}let ne={status:l,loadedAt:u,isLoading:d,isTransitioning:f,location:p,resolvedLocation:m,statusCode:h,redirect:g,matchesId:_,pendingIds:y,cachedIds:b,matches:x,pendingMatches:S,cachedMatches:C,firstId:w,hasPending:T,matchRouteDeps:E,matchStores:o,pendingMatchStores:s,cachedMatchStores:c,__store:D,getRouteMatchStore:te,setMatches:O,setPending:k,setCached:A};O(e.matches),a?.(ne);function O(e){P(e,o,_,n,i)}function k(e){P(e,s,y,n,i)}function A(e){P(e,c,b,n,i)}return ne}function N(e,t){let n=[];for(let r of t){let t=e.get(r);t&&n.push(t.get())}return n}function P(e,t,n,r,i){let a=e.map(e=>e.id),o=new Set(a);i(()=>{for(let e of t.keys())o.has(e)||t.delete(e);for(let n of e){let e=t.get(n.id);if(!e){let e=r(n);e.routeId=n.routeId,t.set(n.id,e);continue}e.routeId=n.routeId,e.get()!==n&&e.set(n)}m(n.get(),a)||n.set(a)})}function me(){try{return sessionStorage}catch{return}}var he=`tsr-scroll-restoration-v1_3`,ge=me();function _e(){try{return JSON.parse(ge?.getItem(`tsr-scroll-restoration-v1_3`)||`{}`)}catch{return{}}}function ve(){try{ge?.setItem(he,JSON.stringify(F))}catch{}}var F=_e(),ye=`data-scroll-restoration-id`,be=e=>e.state.__TSR_key||e.href;function xe(e){let t=e.getAttribute(ye);if(t)return`[${ye}="${t}"]`;let n=``,r=e,i;for(;i=r.parentNode;){let e=1,t=r;for(;t=t.previousElementSibling;)e++;let a=`${r.localName}:nth-child(${e})`;n=n?`${a} > ${n}`:a,r=i}return n}var I=!1,L=`window`;function R(e){try{return typeof e==`function`?e():document.querySelector(e)}catch{}}function Se(e){let t=[];for(let n of e){if(n===L)continue;let e=R(n);e&&t.push(e)}return t}function Ce(e,t){if((t??e.options.scrollRestoration)&&(e.isScrollRestoring=!0),e.isScrollRestorationSetup)return;e.isScrollRestorationSetup=!0,I=!1;let n=e.options.getScrollRestorationKey||be,r=new Map,i=(e,t,n)=>{let i=r.get(e)||{};i.scrollX=t,i.scrollY=n,r.set(e,i)};history.scrollRestoration=`manual`;let a=t=>{if(!(I||!e.isScrollRestoring))if(t.target===document)i(L,scrollX,scrollY);else{let e=t.target;i(e,e.scrollLeft,e.scrollTop)}},o=t=>{if(!e.isScrollRestoring)return;let n=F[t]||={};for(let[e,t]of r)e===L?n[L]=t:e.isConnected&&(n[xe(e)]=t)};document.addEventListener(`scroll`,a,!0),e.subscribe(`onBeforeLoad`,e=>{e.fromLocation&&o(n(e.fromLocation)),r.clear()}),addEventListener(`pagehide`,()=>{o(n(e.stores.resolvedLocation.get()??e.stores.location.get())),ve()}),e.subscribe(`onRendered`,t=>{let i=e.options.scrollRestorationBehavior,a=e.options.scrollToTopSelectors,o=e.resetNextScroll,s;if(r.clear(),o||(e.resetNextScroll=!0),typeof e.options.scrollRestoration==`function`&&!e.options.scrollRestoration({location:e.latestLocation}))return;let c=n(t.toLocation),l=t.fromLocation&&n(t.fromLocation);if(e.isScrollRestoring&&l&&l!==c){let e=F[l];if(e){let t=F[c];for(let n in e){if(n===L){if(o)continue}else{let e=R(n);if(!e||o&&a&&(s??=Se(a),s.includes(e)))continue}t||=F[c]={},t[n]??=e[n]}}}I=!0;try{let n=t.toLocation.hash,r=t.toLocation.state.__hashScrollIntoViewOptions??!0,l=!1;if(o){let o=rt.get(t.toLocation),u=n&&r&&(o===`PUSH`||o===`REPLACE`),d=e.isScrollRestoring?F[c]:void 0;if(d)for(let e in d){let{scrollX:t,scrollY:n}=d[e];if(e===L){if(u)continue;scrollTo({top:n,left:t,behavior:i}),l=!0}else{let r=R(e);r&&(r.scrollLeft=t,r.scrollTop=n)}}if(!l&&!n){let e={top:0,left:0,behavior:i};if(scrollTo(e),a){s??=Se(a);for(let t of s)t.scrollTo(e)}}}!l&&n&&r&&document.getElementById(n)?.scrollIntoView(r)}finally{I=!1}})}function we(e,t=String){let n=new URLSearchParams;for(let r in e){let i=e[r];i!==void 0&&n.set(r,t(i))}return n.toString()}function z(e){return e?e===`false`?!1:e===`true`?!0:e*0==0&&+e+``===e?+e:e:``}function Te(e){let t=new URLSearchParams(e),n=Object.create(null);for(let[e,r]of t.entries()){let t=n[e];t==null?n[e]=z(r):Array.isArray(t)?t.push(z(r)):n[e]=[t,z(r)]}return n}var Ee=Oe(JSON.parse),De=ke(JSON.stringify,JSON.parse);function Oe(e){return t=>{t[0]===`?`&&(t=t.substring(1));let n=Te(t);for(let t in n){let r=n[t];if(typeof r==`string`)try{n[t]=e(r)}catch{}}return n}}function ke(e,t){let n=typeof t==`function`;function r(r){if(typeof r==`object`&&r)try{return e(r)}catch{}else if(n&&typeof r==`string`)try{return t(r),e(r)}catch{}return r}return e=>{let t=we(e,r);return t?`?${t}`:``}}var Ae=e=>{if(!e.rendered)return e.rendered=!0,e.onReady?.()},je=e=>e.stores.matchesId.get().some(t=>e.stores.matchStores.get(t)?.get()._forcePending),B=(e,t)=>!!(e.preload&&!e.router.stores.matchStores.has(t)),V=(e,t,n=!0)=>{let r={...e.router.options.context??{}},i=n?t:t-1;for(let t=0;t<=i;t++){let n=e.matches[t];if(!n)continue;let i=e.router.getMatch(n.id);i&&Object.assign(r,i.__routeContext,i.__beforeLoadContext)}return r},Me=(e,t)=>{if(!e.matches.length)return;let n=t.routeId,r=e.matches.findIndex(t=>t.routeId===e.router.routeTree.id),i=r>=0?r:0,a=n?e.matches.findIndex(e=>e.routeId===n):e.firstBadMatchIndex??e.matches.length-1;a<0&&(a=i);for(let t=a;t>=0;t--){let n=e.matches[t];if(e.router.looseRoutesById[n.routeId].options.notFoundComponent)return t}return n?a:i},H=(e,t,n)=>{if(!(!T(n)&&!E(n)))throw T(n)&&n.redirectHandled&&!n.options.reloadDocument?n:(t&&(t._nonReactive.beforeLoadPromise?.resolve(),t._nonReactive.loaderPromise?.resolve(),t._nonReactive.beforeLoadPromise=void 0,t._nonReactive.loaderPromise=void 0,t._nonReactive.error=n,e.updateMatch(t.id,r=>({...r,status:T(n)?`redirected`:E(n)?`notFound`:r.status===`pending`?`success`:r.status,context:V(e,t.index),isFetching:!1,error:n})),E(n)&&!n.routeId&&(n.routeId=t.routeId),t._nonReactive.loadPromise?.resolve()),T(n)&&(e.rendered=!0,n.options._fromLocation=e.location,n.redirectHandled=!0,n=e.router.resolveRedirect(n)),n)},Ne=(e,t)=>{let n=e.router.getMatch(t);return!!(!n||n._nonReactive.dehydrated)},Pe=(e,t,n)=>{let r=V(e,n);e.updateMatch(t,e=>({...e,context:r}))},U=(e,t,n)=>{let{id:r,routeId:i}=e.matches[t],a=e.router.looseRoutesById[i];if(n instanceof Promise)throw n;e.firstBadMatchIndex??=t,H(e,e.router.getMatch(r),n);try{a.options.onError?.(n)}catch(t){n=t,H(e,e.router.getMatch(r),n)}e.updateMatch(r,e=>(e._nonReactive.beforeLoadPromise?.resolve(),e._nonReactive.beforeLoadPromise=void 0,e._nonReactive.loadPromise?.resolve(),{...e,error:n,status:`error`,isFetching:!1,updatedAt:Date.now(),abortController:new AbortController})),!e.preload&&!T(n)&&!E(n)&&(e.serialError??=n)},Fe=(e,t,n,r)=>{if(r._nonReactive.pendingTimeout!==void 0)return;let i=n.options.pendingMs??e.router.options.defaultPendingMs;if(e.onReady&&!B(e,t)&&(n.options.loader||n.options.beforeLoad||Ge(n))&&typeof i==`number`&&i!==1/0&&(n.options.pendingComponent??e.router.options?.defaultPendingComponent)){let t=setTimeout(()=>{Ae(e)},i);r._nonReactive.pendingTimeout=t}},Ie=(e,t,n)=>{let r=e.router.getMatch(t);if(!r._nonReactive.beforeLoadPromise&&!r._nonReactive.loaderPromise)return;Fe(e,t,n,r);let i=()=>{let n=e.router.getMatch(t);n.preload&&(n.status===`redirected`||n.status===`notFound`)&&H(e,n,n.error)};return r._nonReactive.beforeLoadPromise?r._nonReactive.beforeLoadPromise.then(i):i()},Le=(e,t,n,r)=>{let i=e.router.getMatch(t),a=i._nonReactive.loadPromise;i._nonReactive.loadPromise=k(()=>{a?.resolve(),a=void 0});let{paramsError:o,searchError:s}=i;o&&U(e,n,o),s&&U(e,n,s),Fe(e,t,r,i);let c=new AbortController,l=!1,u=()=>{l||(l=!0,e.updateMatch(t,e=>({...e,isFetching:`beforeLoad`,fetchCount:e.fetchCount+1,abortController:c})))},d=()=>{i._nonReactive.beforeLoadPromise?.resolve(),i._nonReactive.beforeLoadPromise=void 0,e.updateMatch(t,e=>({...e,isFetching:!1}))};if(!r.options.beforeLoad){e.router.batch(()=>{u(),d()});return}i._nonReactive.beforeLoadPromise=k();let p={...V(e,n,!1),...i.__routeContext},{search:m,params:h,cause:g}=i,_=B(e,t),v={search:m,abortController:c,params:h,preload:_,context:p,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),buildLocation:e.router.buildLocation,cause:_?`preload`:g,matches:e.matches,routeId:r.id,...e.router.options.additionalContext},y=r=>{if(r===void 0){e.router.batch(()=>{u(),d()});return}(T(r)||E(r))&&(u(),U(e,n,r)),e.router.batch(()=>{u(),e.updateMatch(t,e=>({...e,__beforeLoadContext:r})),d()})},b;try{if(b=r.options.beforeLoad(v),f(b))return u(),b.catch(t=>{U(e,n,t)}).then(y)}catch(t){u(),U(e,n,t)}y(b)},Re=(e,t)=>{let{id:n,routeId:r}=e.matches[t],i=e.router.looseRoutesById[r],a=()=>s(),o=()=>Le(e,n,t,i),s=()=>{if(Ne(e,n))return;let t=Ie(e,n,i);return f(t)?t.then(o):o()};return a()},ze=(e,t,n)=>{let r=e.router.getMatch(t);if(!r||!n.options.head&&!n.options.scripts&&!n.options.headers)return;let i={ssr:e.router.options.ssr,matches:e.matches,match:r,params:r.params,loaderData:r.loaderData};return Promise.all([n.options.head?.(i),n.options.scripts?.(i),n.options.headers?.(i)]).then(([e,t,n])=>({meta:e?.meta,links:e?.links,headScripts:e?.scripts,headers:n,scripts:t,styles:e?.styles}))},Be=(e,t,n,r,i)=>{let a=t[r-1],{params:o,loaderDeps:s,abortController:c,cause:l}=e.router.getMatch(n),u=V(e,r),d=B(e,n);return{params:o,deps:s,preload:!!d,parentMatchPromise:a,abortController:c,context:u,location:e.location,navigate:t=>e.router.navigate({...t,_fromLocation:e.location}),cause:d?`preload`:l,route:i,...e.router.options.additionalContext}},Ve=async(e,t,n,r,i)=>{try{let a=e.router.getMatch(n);try{W(i);let o=i.options.loader,s=typeof o==`function`?o:o?.handler,c=s?.(Be(e,t,n,r,i)),l=!!s&&f(c);if((l||i._lazyPromise||i._componentsPromise||i.options.head||i.options.scripts||i.options.headers||a._nonReactive.minPendingPromise)&&e.updateMatch(n,e=>({...e,isFetching:`loader`})),s){let t=l?await c:c;H(e,e.router.getMatch(n),t),t!==void 0&&e.updateMatch(n,e=>({...e,loaderData:t}))}i._lazyPromise&&await i._lazyPromise;let u=a._nonReactive.minPendingPromise;u&&await u,i._componentsPromise&&await i._componentsPromise,e.updateMatch(n,t=>({...t,error:void 0,context:V(e,r),status:`success`,isFetching:!1,updatedAt:Date.now()}))}catch(t){let o=t;if(o?.name===`AbortError`){if(a.abortController.signal.aborted){a._nonReactive.loaderPromise?.resolve(),a._nonReactive.loaderPromise=void 0;return}e.updateMatch(n,t=>({...t,status:t.status===`pending`?`success`:t.status,isFetching:!1,context:V(e,r)}));return}let s=a._nonReactive.minPendingPromise;s&&await s,E(t)&&await i.options.notFoundComponent?.preload?.(),H(e,e.router.getMatch(n),t);try{i.options.onError?.(t)}catch(t){o=t,H(e,e.router.getMatch(n),t)}!T(o)&&!E(o)&&await W(i,[`errorComponent`]),e.updateMatch(n,t=>({...t,error:o,context:V(e,r),status:`error`,isFetching:!1}))}}catch(t){let r=e.router.getMatch(n);r&&(r._nonReactive.loaderPromise=void 0),H(e,r,t)}},He=async(e,t,n)=>{async function r(r,a,c,l,d){let f=Date.now()-a.updatedAt,p=r?d.options.preloadStaleTime??e.router.options.defaultPreloadStaleTime??3e4:d.options.staleTime??e.router.options.defaultStaleTime??0,m=d.options.shouldReload,h=typeof m==`function`?m(Be(e,t,i,n,d)):m,{status:g,invalid:_}=l,v=f>=p&&(!!e.forceStaleReload||l.cause===`enter`||c!==void 0&&c!==l.id);o=g===`success`&&(_||(h??v)),r&&d.options.preload===!1||(o&&!e.sync&&u?(s=!0,(async()=>{try{await Ve(e,t,i,n,d);let r=e.router.getMatch(i);r._nonReactive.loaderPromise?.resolve(),r._nonReactive.loadPromise?.resolve(),r._nonReactive.loaderPromise=void 0,r._nonReactive.loadPromise=void 0}catch(t){T(t)&&await e.router.navigate(t.options)}})()):g!==`success`||o?await Ve(e,t,i,n,d):Pe(e,i,n))}let{id:i,routeId:a}=e.matches[n],o=!1,s=!1,c=e.router.looseRoutesById[a],l=c.options.loader,u=((typeof l==`function`?void 0:l?.staleReloadMode)??e.router.options.defaultStaleReloadMode)!==`blocking`;if(Ne(e,i)){if(!e.router.getMatch(i))return e.matches[n];Pe(e,i,n)}else{let t=e.router.getMatch(i),o=e.router.stores.matchesId.get()[n],s=(o&&e.router.stores.matchStores.get(o)||null)?.routeId===a?o:e.router.stores.matches.get().find(e=>e.routeId===a)?.id,l=B(e,i);if(t._nonReactive.loaderPromise){if(t.status===`success`&&!e.sync&&!t.preload&&u)return t;await t._nonReactive.loaderPromise;let n=e.router.getMatch(i),a=n._nonReactive.error||n.error;a&&H(e,n,a),n.status===`pending`&&await r(l,t,s,n,c)}else{let n=l&&!e.router.stores.matchStores.has(i),a=e.router.getMatch(i);a._nonReactive.loaderPromise=k(),n!==a.preload&&e.updateMatch(i,e=>({...e,preload:n})),await r(l,t,s,a,c)}}let d=e.router.getMatch(i);s||(d._nonReactive.loaderPromise?.resolve(),d._nonReactive.loadPromise?.resolve(),d._nonReactive.loadPromise=void 0),clearTimeout(d._nonReactive.pendingTimeout),d._nonReactive.pendingTimeout=void 0,s||(d._nonReactive.loaderPromise=void 0),d._nonReactive.dehydrated=void 0;let f=s?d.isFetching:!1;return f!==d.isFetching||d.invalid!==!1?(e.updateMatch(i,e=>({...e,isFetching:f,invalid:!1})),e.router.getMatch(i)):d};async function Ue(e){let t=e,n=[];je(t.router)&&Ae(t);let r;for(let e=0;e<t.matches.length;e++){try{let n=Re(t,e);f(n)&&await n}catch(e){if(T(e))throw e;if(E(e))r=e;else if(!t.preload)throw e;break}if(t.serialError||t.firstBadMatchIndex!=null)break}let i=t.firstBadMatchIndex??t.matches.length,a=r&&!t.preload?Me(t,r):void 0,o=r&&t.preload?0:a===void 0?i:Math.min(a+1,i),s,l;for(let e=0;e<o;e++)n.push(He(t,n,e));try{await Promise.all(n)}catch{let e=await Promise.allSettled(n);for(let t of e){if(t.status!==`rejected`)continue;let e=t.reason;if(T(e))throw e;E(e)?s??=e:l??=e}if(l!==void 0)throw l}let u=s??(r&&!t.preload?r:void 0),d=t.firstBadMatchIndex===void 0?t.matches.length-1:t.firstBadMatchIndex;if(!u&&r&&t.preload)return t.matches;if(u){let e=Me(t,u);e===void 0&&c();let n=t.matches[e],r=t.router.looseRoutesById[n.routeId],i=t.router.options?.defaultNotFoundComponent;!r.options.notFoundComponent&&i&&(r.options.notFoundComponent=i),u.routeId=n.routeId;let a=n.routeId===t.router.routeTree.id;t.updateMatch(n.id,e=>({...e,...a?{status:`success`,globalNotFound:!0,error:void 0}:{status:`notFound`,error:u},isFetching:!1})),d=e,await W(r,[`notFoundComponent`])}else if(!t.preload){let e=t.matches[0];e.globalNotFound||t.router.getMatch(e.id)?.globalNotFound&&t.updateMatch(e.id,e=>({...e,globalNotFound:!1,error:void 0}))}if(t.serialError&&t.firstBadMatchIndex!==void 0){let e=t.router.looseRoutesById[t.matches[t.firstBadMatchIndex].routeId];await W(e,[`errorComponent`])}for(let e=0;e<=d;e++){let{id:n,routeId:r}=t.matches[e],i=t.router.looseRoutesById[r];try{let e=ze(t,n,i);if(e){let r=await e;t.updateMatch(n,e=>({...e,...r}))}}catch(e){console.error(`Error executing head for route ${r}:`,e)}}let p=Ae(t);if(f(p)&&await p,u)throw u;if(t.serialError&&!t.preload&&!t.onReady)throw t.serialError;return t.matches}function We(e,t){let n=t.map(t=>e.options[t]?.preload?.()).filter(Boolean);if(n.length!==0)return Promise.all(n)}function W(e,t=G){!e._lazyLoaded&&e._lazyPromise===void 0&&(e.lazyFn?e._lazyPromise=e.lazyFn().then(t=>{let{id:n,...r}=t.options;Object.assign(e.options,r),e._lazyLoaded=!0,e._lazyPromise=void 0}):e._lazyLoaded=!0);let n=()=>e._componentsLoaded?void 0:t===G?(()=>{if(e._componentsPromise===void 0){let t=We(e,G);t?e._componentsPromise=t.then(()=>{e._componentsLoaded=!0,e._componentsPromise=void 0}):e._componentsLoaded=!0}return e._componentsPromise})():We(e,t);return e._lazyPromise?e._lazyPromise.then(n):n()}function Ge(e){for(let t of G)if(e.options[t]?.preload)return!0;return!1}var G=[`component`,`errorComponent`,`pendingComponent`,`notFoundComponent`];function Ke(e){return{input:({url:t})=>{for(let n of e)t=Je(n,t);return t},output:({url:t})=>{for(let n=e.length-1;n>=0;n--)t=Ye(e[n],t);return t}}}function qe(e){let t=S(e.basepath),n=`/${t}`,r=e.caseSensitive?n:n.toLowerCase(),i=`${r}/`;return{input:({url:t})=>{let a=e.caseSensitive?t.pathname:t.pathname.toLowerCase();return a===r?t.pathname=`/`:a.startsWith(i)&&(t.pathname=t.pathname.slice(n.length)),t},output:({url:e})=>(e.pathname=ne([`/`,t,e.pathname]),e)}}function Je(e,t){let n=e?.input?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}function Ye(e,t){let n=e?.output?.({url:t});if(n){if(typeof n==`string`)return new URL(n);if(n instanceof URL)return n}return t}var K=`__TSR_index`,Xe=`popstate`,Ze=`beforeunload`;function Qe(e){let t=e.getLocation(),n=new Set,r=r=>{t=e.getLocation(),n.forEach(e=>e({location:t,action:r}))},i=n=>{e.notifyOnIndexChange??!0?r(n):t=e.getLocation()},a=async({task:n,navigateOpts:r,...i})=>{if(r?.ignoreBlocker??!1){n();return}let a=e.getBlockers?.()??[],o=i.type===`PUSH`||i.type===`REPLACE`;if(typeof document<`u`&&a.length&&o)for(let n of a){let r=q(i.path,i.state);if(await n.blockerFn({currentLocation:t,nextLocation:r,action:i.type})){e.onBlocked?.();return}}n()};return{get location(){return t},get length(){return e.getLength()},subscribers:n,subscribe:e=>(n.add(e),()=>{n.delete(e)}),push:(n,i,o)=>{let s=t.state[K];i=$e(s+1,i),a({task:()=>{e.pushState(n,i),r({type:`PUSH`})},navigateOpts:o,type:`PUSH`,path:n,state:i})},replace:(n,i,o)=>{let s=t.state[K];i=$e(s,i),a({task:()=>{e.replaceState(n,i),r({type:`REPLACE`})},navigateOpts:o,type:`REPLACE`,path:n,state:i})},go:(t,n)=>{a({task:()=>{e.go(t),i({type:`GO`,index:t})},navigateOpts:n,type:`GO`})},back:t=>{a({task:()=>{e.back(t?.ignoreBlocker??!1),i({type:`BACK`})},navigateOpts:t,type:`BACK`})},forward:t=>{a({task:()=>{e.forward(t?.ignoreBlocker??!1),i({type:`FORWARD`})},navigateOpts:t,type:`FORWARD`})},canGoBack:()=>t.state[K]!==0,createHref:t=>e.createHref(t),block:t=>{if(!e.setBlockers)return()=>{};let n=e.getBlockers?.()??[];return e.setBlockers([...n,t]),()=>{let n=e.getBlockers?.()??[];e.setBlockers?.(n.filter(e=>e!==t))}},flush:()=>e.flush?.(),destroy:()=>e.destroy?.(),notify:r}}function $e(e,t){t||={};let n=nt();return{...t,key:n,__TSR_key:n,[K]:e}}function et(e){let t=e?.window??(typeof document<`u`?window:void 0),n=t.history.pushState,r=t.history.replaceState,i=[],a=()=>i,o=e=>i=e,s=e?.createHref??(e=>e),c=e?.parseLocation??(()=>q(`${t.location.pathname}${t.location.search}${t.location.hash}`,t.history.state));if(!t.history.state?.__TSR_key&&!t.history.state?.key){let e=nt();t.history.replaceState({[K]:0,key:e,__TSR_key:e},``)}let l=c(),u,d=!1,f=!1,p=!1,m=!1,h=()=>l,g,_,v=()=>{g&&(C._ignoreSubscribers=!0,(g.isPush?t.history.pushState:t.history.replaceState)(g.state,``,g.href),C._ignoreSubscribers=!1,g=void 0,_=void 0,u=void 0)},y=(e,t,n)=>{let r=s(t);_||(u=l),l=q(t,n),g={href:r,state:n,isPush:g?.isPush||e===`push`},_||=Promise.resolve().then(()=>v())},b=e=>{l=c(),C.notify({type:e})},x=async()=>{if(f){f=!1;return}let e=c(),n=e.state[K]-l.state[K],r=n===1,i=n===-1,o=!r&&!i||d;d=!1;let s=o?`GO`:i?`BACK`:`FORWARD`,u=o?{type:`GO`,index:n}:{type:i?`BACK`:`FORWARD`};if(p)p=!1;else{let n=a();if(typeof document<`u`&&n.length){for(let r of n)if(await r.blockerFn({currentLocation:l,nextLocation:e,action:s})){f=!0,t.history.go(1),C.notify(u);return}}}l=c(),C.notify(u)},S=e=>{if(m){m=!1;return}let t=!1,n=a();if(typeof document<`u`&&n.length)for(let e of n){let n=e.enableBeforeUnload??!0;if(n===!0){t=!0;break}if(typeof n==`function`&&n()===!0){t=!0;break}}if(t)return e.preventDefault(),e.returnValue=``},C=Qe({getLocation:h,getLength:()=>t.history.length,pushState:(e,t)=>y(`push`,e,t),replaceState:(e,t)=>y(`replace`,e,t),back:e=>(e&&(p=!0),m=!0,t.history.back()),forward:e=>{e&&(p=!0),m=!0,t.history.forward()},go:e=>{d=!0,t.history.go(e)},createHref:e=>s(e),flush:v,destroy:()=>{t.history.pushState=n,t.history.replaceState=r,t.removeEventListener(Ze,S,{capture:!0}),t.removeEventListener(Xe,x)},onBlocked:()=>{u&&l!==u&&(l=u)},getBlockers:a,setBlockers:o,notifyOnIndexChange:!1});return t.addEventListener(Ze,S,{capture:!0}),t.addEventListener(Xe,x),t.history.pushState=function(...e){let r=n.apply(t.history,e);return C._ignoreSubscribers||b(`PUSH`),r},t.history.replaceState=function(...e){let n=r.apply(t.history,e);return C._ignoreSubscribers||b(`REPLACE`),n},C}function tt(e){let t=e.replace(/[\x00-\x1f\x7f]/g,``);return t.startsWith(`//`)&&(t=`/`+t.replace(/^\/+/,``)),t}function q(e,t){let n=tt(e),r=n.indexOf(`#`),i=n.indexOf(`?`),a=nt();return{href:n,pathname:n.substring(0,r>0?i>0?Math.min(r,i):r:i>0?i:n.length),hash:r>-1?n.substring(r):``,search:i>-1?n.slice(i,r===-1?void 0:r):``,state:t||{[K]:0,key:a,__TSR_key:a}}}function nt(){return(Math.random()+1).toString(36).substring(7)}function J(e,t){let n=t,r=e;return{fromLocation:n,toLocation:r,pathChanged:n?.pathname!==r.pathname,hrefChanged:n?.href!==r.href,hashChanged:n?.hash!==r.hash}}var rt=new WeakMap,it=class{constructor(e,t){this.tempLocationKey=`${Math.round(Math.random()*1e7)}`,this.resetNextScroll=!0,this.shouldViewTransition=void 0,this.isViewTransitionTypesSupported=void 0,this.subscribers=new Set,this.isScrollRestoring=!1,this.isScrollRestorationSetup=!1,this.routeBranchCache=new WeakMap,this.startTransition=e=>e(),this.update=e=>{let t=this.options,n=this.basepath??t?.basepath??`/`,r=this.basepath===void 0,i=t?.rewrite;if(this.options={...t,...e},this.isServer=this.options.isServer??typeof document>`u`,this.protocolAllowlist=new Set(this.options.protocolAllowlist),this.options.pathParamsAllowedCharacters&&(this.pathParamsDecoder=re(this.options.pathParamsAllowedCharacters)),(!this.history||this.options.history&&this.options.history!==this.history)&&(this.options.history?this.history=this.options.history:this.history=et()),this.origin=this.options.origin,this.origin||(window?.origin&&window.origin!==`null`?this.origin=window.origin:this.origin=`http://localhost`),this.history&&this.updateLatestLocation(),this.options.routeTree!==this.routeTree){this.routeTree=this.options.routeTree;let e;this.resolvePathCache=v(1e3),e=this.buildRouteTree(),this.setRoutes(e)}if(!this.stores&&this.latestLocation){let e=this.getStoreConfig(this);this.batch=e.batch,this.stores=pe(ot(this.latestLocation),e),Ce(this)}let a=!1,o=this.options.basepath??`/`,s=this.options.rewrite;if(r||n!==o||i!==s){this.basepath=o;let e=[],t=S(o);t&&t!==`/`&&e.push(qe({basepath:o})),s&&e.push(s),this.rewrite=e.length===0?void 0:e.length===1?e[0]:Ke(e),this.history&&this.updateLatestLocation(),a=!0}a&&this.stores&&this.stores.location.set(this.latestLocation),typeof window<`u`&&`CSS`in window&&typeof window.CSS?.supports==`function`&&(this.isViewTransitionTypesSupported=window.CSS.supports(`selector(:active-view-transition-type(a))`))},this.updateLatestLocation=()=>{this.latestLocation=this.parseLocation(this.history.location,this.latestLocation)},this.buildRouteTree=()=>{let e=se(this.routeTree,this.options.caseSensitive,(e,t)=>{e.init({originalIndex:t})});return this.options.routeMasks&&o(this.options.routeMasks,e.processedTree),e},this.subscribe=(e,t)=>{let n={eventType:e,fn:t};return this.subscribers.add(n),()=>{this.subscribers.delete(n)}},this.emit=e=>{this.subscribers.forEach(t=>{t.eventType===e.type&&t.fn(e)})},this.parseLocation=(e,t)=>{let n=({pathname:e,search:n,hash:r,href:o,state:s})=>{if(!this.rewrite&&!/[ \x00-\x1f\x7f\u0080-\uffff]/.test(e)){let o=this.options.parseSearch(n),c=this.options.stringifySearch(o);return{href:e+c+r,publicHref:e+c+r,pathname:i(e).path,external:!1,searchStr:c,search:M(t?.search,o),hash:i(r.slice(1)).path,state:a(t?.state,s)}}let c=new URL(o,this.origin),l=Je(this.rewrite,c),u=this.options.parseSearch(l.search),d=this.options.stringifySearch(u);return l.search=d,{href:l.href.replace(l.origin,``),publicHref:o,pathname:i(l.pathname).path,external:!!this.rewrite&&l.origin!==this.origin,searchStr:d,search:M(t?.search,u),hash:i(l.hash.slice(1)).path,state:a(t?.state,s)}},r=n(e),{__tempLocation:o,__tempKey:s}=r.state;if(o&&(!s||s===this.tempLocationKey)){let e=n(o);return e.state.key=r.state.key,e.state.__TSR_key=r.state.__TSR_key,delete e.state.__tempLocation,{...e,maskedLocation:r}}return r},this.resolvePathWithBase=(e,t)=>te({base:e,to:t.includes(`//`)?ee(t):t,trailingSlash:this.options.trailingSlash,cache:this.resolvePathCache}),this.matchRoutes=(e,t,n)=>typeof e==`string`?this.matchRoutesInternal({pathname:e,search:t},n):this.matchRoutesInternal(e,t),this.getMatchedRoutes=e=>st({pathname:e,routesById:this.routesById,processedTree:this.processedTree}),this.cancelMatch=e=>{let t=this.getMatch(e);t&&(t.abortController.abort(),clearTimeout(t._nonReactive.pendingTimeout),t._nonReactive.pendingTimeout=void 0)},this.cancelMatches=()=>{this.stores.pendingIds.get().forEach(e=>{this.cancelMatch(e)}),this.stores.matchesId.get().forEach(e=>{if(this.stores.pendingMatchStores.has(e))return;let t=this.stores.matchStores.get(e)?.get();t&&(t.status===`pending`||t.isFetching===`loader`)&&this.cancelMatch(e)})},this.buildLocation=e=>{let t=(t={})=>{let n=t._fromLocation||this.pendingBuiltLocation||this.latestLocation,r=this.matchRoutesLightweight(n);t.from;let o=t.unsafeRelative===`path`?n.pathname:t.from??r.fullPath,s=t.to?`${t.to}`:void 0,c=r.search,u=Object.assign(Object.create(null),r.params),d=s?.charCodeAt(0)===47?`/`:this.resolvePathWithBase(o,`.`),f=s?this.resolvePathWithBase(d,s):d,m=t.params===!1||t.params===null?Object.create(null):(t.params??!0)===!0?u:Object.assign(u,h(t.params,u)),g=this.routesByPath[j(f)],_;if(g)_=this.getRouteBranch(g);else if(f.includes(`$`))_=[];else{let e=this.getMatchedRoutes(f);_=e.matchedRoutes,this.options.notFoundRoute&&(!e.foundRoute||e.foundRoute.path!==`/`&&e.routeParams[`**`])&&(_=[..._,this.options.notFoundRoute])}if(_.length&&l(m))for(let e of _){let t=e.options.params?.stringify??e.options.stringifyParams;if(t)try{Object.assign(m,t(m))}catch{}}let v=e.leaveParams?f:i(A({path:f,params:m,decoder:this.pathParamsDecoder,server:this.isServer}).interpolatedPath).path,y=c;if(e._includeValidateSearch&&this.options.search?.strict){let e={};_.forEach(t=>{if(t.options.validateSearch)try{Object.assign(e,X(t.options.validateSearch,{...e,...y}))}catch{}}),y=e}y=ct({search:y,dest:t,destRoutes:_,_includeValidateSearch:e._includeValidateSearch}),y=M(c,y);let b=this.options.stringifySearch(y),x=t.hash===!0?n.hash:t.hash?h(t.hash,n.hash):void 0,S=x?`#${x}`:``,C=t.state===!0?n.state:t.state?h(t.state,n.state):{};C=a(n.state,C);let w=`${v}${b}${S}`,T,E,D=!1;if(this.rewrite){let e=new URL(w,this.origin),t=Ye(this.rewrite,e);T=e.href.replace(e.origin,``),t.origin===this.origin?E=t.pathname+t.search+t.hash:(E=t.href,D=!0)}else T=p(w),E=T;return{publicHref:E,href:T,pathname:v,search:y,searchStr:b,state:C,hash:x??``,external:D,unmaskOnReload:t.unmaskOnReload}},n=(n={},r)=>{let i=t(n),a=r?t(r):void 0;if(!a){let n=Object.create(null);if(this.options.routeMasks){let o=w(i.pathname,this.processedTree);if(o){Object.assign(n,o.rawParams);let{from:i,params:s,...c}=o.route,l=s===!1||s===null?Object.create(null):(s??!0)===!0?n:Object.assign(n,h(s,n));r={from:e.from,...c,params:l},a=t(r)}}}return a&&(i.maskedLocation=a),i};return e.mask?n(e,{from:e.from,...e.mask}):n(e)},this.commitLocation=async({viewTransition:e,ignoreBlocker:t,...n})=>{let r,i=()=>{let e=[`key`,`__TSR_key`,`__TSR_index`,`__hashScrollIntoViewOptions`];e.forEach(e=>{n.state[e]=this.latestLocation.state[e]});let t=O(n.state,this.latestLocation.state);return e.forEach(e=>{delete n.state[e]}),t},a=j(this.latestLocation.href)===j(n.href),o=this.commitLocationPromise;if(this.commitLocationPromise=k(()=>{o?.resolve(),o=void 0}),a&&i())this.load();else{let{maskedLocation:i,hashScrollIntoView:a,...o}=n;i&&(o={...i,state:{...i.state,__tempKey:void 0,__tempLocation:{...o,search:o.searchStr,state:{...o.state,__tempKey:void 0,__tempLocation:void 0,__TSR_key:void 0,key:void 0}}}},(o.unmaskOnReload??this.options.unmaskOnReload??!1)&&(o.state.__tempKey=this.tempLocationKey)),o.state.__hashScrollIntoViewOptions=a??this.options.defaultHashScrollIntoView??!0,this.shouldViewTransition=e,r=n.replace?`REPLACE`:`PUSH`,this.history[r===`REPLACE`?`replace`:`push`](o.publicHref,o.state,{ignoreBlocker:t})}return this.resetNextScroll=n.resetScroll??!0,this.history.subscribers.size||this.load(r?{action:{type:r}}:void 0),this.commitLocationPromise},this.buildAndCommitLocation=({replace:e,resetScroll:t,hashScrollIntoView:n,viewTransition:r,ignoreBlocker:i,href:a,...o}={})=>{if(a){let t=this.history.location.state.__TSR_index,n=q(a,{__TSR_index:e?t:t+1}),r=new URL(n.pathname,this.origin);o.to=Je(this.rewrite,r).pathname,o.search=this.options.parseSearch(n.search),o.hash=n.hash.slice(1)}let s=this.buildLocation({...o,_includeValidateSearch:!0});this.pendingBuiltLocation=s;let c=this.commitLocation({...s,viewTransition:r,replace:e,resetScroll:t,hashScrollIntoView:n,ignoreBlocker:i});return Promise.resolve().then(()=>{this.pendingBuiltLocation===s&&(this.pendingBuiltLocation=void 0)}),c},this.navigate=async({to:e,reloadDocument:t,href:n,publicHref:r,...i})=>{let a=!1;if(n)try{new URL(`${n}`),a=!0}catch{}if(a&&!t&&(t=!0),t){if(e!==void 0||!n){let t=this.buildLocation({to:e,...i});n??=t.publicHref,r??=t.publicHref}let t=!a&&r?r:n;if(d(t,this.protocolAllowlist))return Promise.resolve();if(!i.ignoreBlocker){let e=this.history.getBlockers?.()??[];for(let t of e)if(t?.blockerFn&&await t.blockerFn({currentLocation:this.latestLocation,nextLocation:this.latestLocation,action:`PUSH`}))return Promise.resolve()}return i.replace?window.location.replace(t):window.location.href=t,Promise.resolve()}return this.buildAndCommitLocation({...i,href:n,to:e,_isNavigate:!0})},this.beforeLoad=()=>{this.cancelMatches(),this.updateLatestLocation();let e=this.matchRoutes(this.latestLocation),t=this.stores.cachedMatches.get().filter(t=>!e.some(e=>e.id===t.id));this.batch(()=>{this.stores.status.set(`pending`),this.stores.statusCode.set(200),this.stores.isLoading.set(!0),this.stores.location.set(this.latestLocation),this.stores.setPending(e),this.stores.setCached(t)})},this.load=async e=>{let t=e?.action?.type,n,r,i,a=this.stores.resolvedLocation.get()??this.stores.location.get();for(i=new Promise(o=>{this.startTransition(async()=>{try{this.beforeLoad(),t?rt.set(this.latestLocation,t):rt.delete(this.latestLocation);let n=this.latestLocation,r=J(n,this.stores.resolvedLocation.get());this.stores.redirect.get()||this.emit({type:`onBeforeNavigate`,...r}),this.emit({type:`onBeforeLoad`,...r}),await Ue({router:this,sync:e?.sync,forceStaleReload:a.href===n.href,matches:this.stores.pendingMatches.get(),location:n,updateMatch:this.updateMatch,onReady:async()=>{this.startTransition(()=>{this.startViewTransition(async()=>{let e=null,t=null,n=null,r=null;this.batch(()=>{let i=this.stores.pendingMatches.get(),a=i.length,o=this.stores.matches.get();e=a?o.filter(e=>!this.stores.pendingMatchStores.has(e.id)):null;let s=new Set;for(let e of this.stores.pendingMatchStores.values())e.routeId&&s.add(e.routeId);let c=new Set;for(let e of this.stores.matchStores.values())e.routeId&&c.add(e.routeId);t=a?o.filter(e=>!s.has(e.routeId)):null,n=a?i.filter(e=>!c.has(e.routeId)):null,r=a?i.filter(e=>c.has(e.routeId)):o,this.stores.isLoading.set(!1),this.stores.loadedAt.set(Date.now()),a&&(this.stores.setMatches(i),this.stores.setPending([]),this.stores.setCached([...this.stores.cachedMatches.get(),...e.filter(e=>e.status!==`error`&&e.status!==`notFound`&&e.status!==`redirected`)]),this.clearExpiredCache())});for(let[e,i]of[[t,`onLeave`],[n,`onEnter`],[r,`onStay`]])if(e)for(let t of e)this.looseRoutesById[t.routeId].options[i]?.(t)})})}})}catch(e){T(e)?(n=e,this.navigate({...n.options,replace:!0,ignoreBlocker:!0})):E(e)&&(r=e);let t=n?n.status:r?404:this.stores.matches.get().some(e=>e.status===`error`)?500:200;this.batch(()=>{this.stores.statusCode.set(t),this.stores.redirect.set(n)})}this.latestLoadPromise===i&&(this.commitLocationPromise?.resolve(),this.latestLoadPromise=void 0,this.commitLocationPromise=void 0),o()})}),this.latestLoadPromise=i,await i;this.latestLoadPromise&&i!==this.latestLoadPromise;)await this.latestLoadPromise;let o;this.hasNotFoundMatch()?o=404:this.stores.matches.get().some(e=>e.status===`error`)&&(o=500),o!==void 0&&this.stores.statusCode.set(o)},this.startViewTransition=e=>{let t=this.shouldViewTransition??this.options.defaultViewTransition;if(this.shouldViewTransition=void 0,t&&typeof document<`u`&&`startViewTransition`in document&&typeof document.startViewTransition==`function`){let n;if(typeof t==`object`&&this.isViewTransitionTypesSupported){let r=this.latestLocation,i=this.stores.resolvedLocation.get(),a=typeof t.types==`function`?t.types(J(r,i)):t.types;if(a===!1){e();return}n={update:e,types:a}}else n=e;document.startViewTransition(n)}else e()},this.updateMatch=(e,t)=>{this.startTransition(()=>{let n=this.stores.pendingMatchStores.get(e);if(n){n.set(t);return}let r=this.stores.matchStores.get(e);if(r){r.set(t);return}let i=this.stores.cachedMatchStores.get(e);if(i){let n=t(i.get());n.status===`redirected`?this.stores.cachedMatchStores.delete(e)&&this.stores.cachedIds.set(t=>t.filter(t=>t!==e)):i.set(n)}})},this.getMatch=e=>this.stores.cachedMatchStores.get(e)?.get()??this.stores.pendingMatchStores.get(e)?.get()??this.stores.matchStores.get(e)?.get(),this.invalidate=e=>{let t=t=>e?.filter?.(t)??!0?{...t,invalid:!0,...e?.forcePending||t.status===`error`||t.status===`notFound`?{status:`pending`,error:void 0}:void 0}:t;return this.batch(()=>{this.stores.setMatches(this.stores.matches.get().map(t)),this.stores.setCached(this.stores.cachedMatches.get().map(t)),this.stores.setPending(this.stores.pendingMatches.get().map(t))}),this.shouldViewTransition=!1,this.load({sync:e?.sync})},this.getParsedLocationHref=e=>e.publicHref||`/`,this.resolveRedirect=e=>{let t=e.headers.get(`Location`);if(!e.options.href||e.options._builtLocation){let t=e.options._builtLocation??this.buildLocation(e.options),n=this.getParsedLocationHref(t);e.options.href=n,e.headers.set(`Location`,n)}else if(t)try{let n=new URL(t);if(this.origin&&n.origin===this.origin){let t=n.pathname+n.search+n.hash;e.options.href=t,e.headers.set(`Location`,t)}}catch{}if(e.options.href&&!e.options._builtLocation&&d(e.options.href,this.protocolAllowlist))throw Error(`Redirect blocked: unsafe protocol`);return e.headers.get(`Location`)||e.headers.set(`Location`,e.options.href),e},this.clearCache=e=>{let t=e?.filter;t===void 0?this.stores.setCached([]):this.stores.setCached(this.stores.cachedMatches.get().filter(e=>!t(e)))},this.clearExpiredCache=()=>{let e=Date.now();this.clearCache({filter:t=>{let n=this.looseRoutesById[t.routeId];if(!n.options.loader)return!0;let r=(t.preload?n.options.preloadGcTime??this.options.defaultPreloadGcTime:n.options.gcTime??this.options.defaultGcTime)??300*1e3;return t.status===`error`?!0:e-t.updatedAt>=r}})},this.loadRouteChunk=W,this.preloadRoute=async e=>{let t=e._builtLocation??this.buildLocation(e),n=this.matchRoutes(t,{throwOnError:!0,preload:!0,dest:e}),r=new Set([...this.stores.matchesId.get(),...this.stores.pendingIds.get()]),i=new Set([...r,...this.stores.cachedIds.get()]),a=n.filter(e=>!i.has(e.id));if(a.length){let e=this.stores.cachedMatches.get();this.stores.setCached([...e,...a])}try{return n=await Ue({router:this,matches:n,location:t,preload:!0,updateMatch:(e,t)=>{r.has(e)?n=n.map(n=>n.id===e?t(n):n):this.updateMatch(e,t)}}),n}catch(e){if(T(e))return e.options.reloadDocument?void 0:await this.preloadRoute({...e.options,_fromLocation:t});E(e)||console.error(e);return}},this.matchRoute=(e,t)=>{let n={...e,to:e.to?this.resolvePathWithBase(e.from||``,e.to):void 0,params:e.params||{},leaveParams:!0},r=this.buildLocation(n);if(t?.pending&&this.stores.status.get()!==`pending`)return!1;let i=(t?.pending===void 0?!this.stores.isLoading.get():t.pending)?this.latestLocation:this.stores.resolvedLocation.get()||this.stores.location.get(),a=_(r.pathname,t?.caseSensitive??!1,t?.fuzzy??!1,i.pathname,this.processedTree);return!a||e.params&&!O(a.rawParams,e.params,{partial:!0})?!1:t?.includeSearch??!0?O(i.search,r.search,{partial:!0})?a.rawParams:!1:a.rawParams},this.hasNotFoundMatch=()=>this.stores.matches.get().some(e=>e.status===`notFound`||e.globalNotFound),this.getStoreConfig=t,this.update({defaultPreloadDelay:50,defaultPendingMs:1e3,defaultPendingMinMs:500,context:void 0,...e,caseSensitive:e.caseSensitive??!1,notFoundMode:e.notFoundMode??`fuzzy`,stringifySearch:e.stringifySearch??De,parseSearch:e.parseSearch??Ee,protocolAllowlist:e.protocolAllowlist??s}),typeof document<`u`&&(self.__TSR_ROUTER__=this)}isShell(){return!!this.options.isShell}isPrerendering(){return!!this.options.isPrerendering}get state(){return this.stores.__store.get()}setRoutes({routesById:e,routesByPath:t,processedTree:n}){this.routesById=e,this.routesByPath=t,this.processedTree=n;let r=this.options.notFoundRoute;r&&(r.init({originalIndex:99999999999}),this.routesById[r.id]=r)}getRouteBranch(e){let t=this.routeBranchCache.get(e);return t||(t=le(e),this.routeBranchCache.set(e,t)),t}get looseRoutesById(){return this.routesById}getParentContext(e){return e?.id?e.context??this.options.context??void 0:this.options.context??void 0}matchRoutesInternal(e,t){let n=this.getMatchedRoutes(e.pathname),{foundRoute:r,routeParams:i}=n,{matchedRoutes:o}=n,s=!1;(r?r.path!==`/`&&i[`**`]:j(e.pathname))&&(this.options.notFoundRoute?o=[...o,this.options.notFoundRoute]:s=!0);let c=s?ut(this.options.notFoundMode,o):void 0,l=Array(o.length),u=new Map;for(let e of this.stores.matchStores.values())e.routeId&&u.set(e.routeId,e.get());for(let n=0;n<o.length;n++){let r=o[n],s=l[n-1],d,f,p;{let n=s?.search??e.search,i=s?._strictSearch??void 0;try{let e=X(r.options.validateSearch,{...n})??void 0;d={...n,...e},f={...i,...e},p=void 0}catch(e){let r=e;if(e instanceof Y||(r=new Y(e.message,{cause:e})),t?.throwOnError)throw r;d=n,f={},p=r}}let m=r.options.loaderDeps?.({search:d})??``,h=m?JSON.stringify(m):``,{interpolatedPath:g,usedParams:_}=A({path:r.fullPath,params:i,decoder:this.pathParamsDecoder,server:this.isServer}),v=r.id+g+h,y=this.getMatch(v),b=u.get(r.id),x=y?._strictParams??_,S;if(!y)try{dt(r,x)}catch(e){if(S=E(e)||T(e)?e:new at(e.message,{cause:e}),t?.throwOnError)throw S}Object.assign(i,x);let C=b?`stay`:`enter`,w;if(y)w={...y,cause:C,params:b?.params??i,_strictParams:x,search:M(b?b.search:y.search,d),_strictSearch:f};else{let e=r.options.loader||r.options.beforeLoad||r.lazyFn||Ge(r)?`pending`:`success`;w={id:v,ssr:r.options.ssr,index:n,routeId:r.id,params:b?.params??i,_strictParams:x,pathname:g,updatedAt:Date.now(),search:b?M(b.search,d):d,_strictSearch:f,searchError:void 0,status:e,isFetching:!1,error:void 0,paramsError:S,__routeContext:void 0,_nonReactive:{loadPromise:k()},__beforeLoadContext:void 0,context:{},abortController:new AbortController,fetchCount:0,cause:C,loaderDeps:b?a(b.loaderDeps,m):m,invalid:!1,preload:!1,links:void 0,scripts:void 0,headScripts:void 0,meta:void 0,staticData:r.options.staticData||{},fullPath:r.fullPath}}t?.preload||(w.globalNotFound=c===r.id),w.searchError=p;let D=this.getParentContext(s);w.context={...D,...w.__routeContext,...w.__beforeLoadContext},l[n]=w}for(let t=0;t<l.length;t++){let n=l[t],r=this.looseRoutesById[n.routeId],a=this.getMatch(n.id),o=u.get(n.routeId);if(n.params=o?M(o.params,i):i,!a){let i=l[t-1],a=this.getParentContext(i);if(r.options.context){let t={deps:n.loaderDeps,params:n.params,context:a??{},location:e,navigate:t=>this.navigate({...t,_fromLocation:e}),buildLocation:this.buildLocation,cause:n.cause,abortController:n.abortController,preload:!!n.preload,matches:l,routeId:r.id};n.__routeContext=r.options.context(t)??void 0}n.context={...a,...n.__routeContext,...n.__beforeLoadContext}}}return l}matchRoutesLightweight(e){let{matchedRoutes:t,routeParams:n}=this.getMatchedRoutes(e.pathname),r=g(t),i={...e.search};for(let e of t)try{Object.assign(i,X(e.options.validateSearch,i))}catch{}let a=g(this.stores.matchesId.get()),o=a&&this.stores.matchStores.get(a)?.get(),s=o&&o.routeId===r.id&&o.pathname===e.pathname,c;if(s)c=o.params;else{let e=Object.assign(Object.create(null),n);for(let n of t)try{dt(n,e)}catch{}c=e}return{matchedRoutes:t,fullPath:r.fullPath,search:i,params:c}}},Y=class extends Error{},at=class extends Error{};function ot(e){return{loadedAt:0,isLoading:!1,isTransitioning:!1,status:`idle`,resolvedLocation:void 0,location:e,matches:[],statusCode:200}}function X(e,t){if(e==null)return{};if(`~standard`in e){let n=e[`~standard`].validate(t);if(n instanceof Promise)throw new Y(`Async validation not supported`);if(n.issues)throw new Y(JSON.stringify(n.issues,void 0,2),{cause:n});return n.value}return`parse`in e?e.parse(t):typeof e==`function`?e(t):{}}function st({pathname:e,routesById:t,processedTree:n}){let r=Object.create(null),i=j(e),a,o=ce(i,n,!0);return o&&(a=o.route,Object.assign(r,o.rawParams)),{matchedRoutes:o?.branch||[t.__root__],routeParams:r,foundRoute:a}}function ct({search:e,dest:t,destRoutes:n,_includeValidateSearch:r}){return lt(n)(e,t,r??!1)}function lt(e){let t={dest:null,_includeValidateSearch:!1,middlewares:[]};for(let n of e)`search`in n.options?n.options.search?.middlewares&&t.middlewares.push(...n.options.search.middlewares):(n.options.preSearchFilters||n.options.postSearchFilters)&&t.middlewares.push(({search:e,next:t})=>{let r=e;`preSearchFilters`in n.options&&n.options.preSearchFilters&&(r=n.options.preSearchFilters.reduce((e,t)=>t(e),e));let i=t(r);return`postSearchFilters`in n.options&&n.options.postSearchFilters?n.options.postSearchFilters.reduce((e,t)=>t(e),i):i}),n.options.validateSearch&&t.middlewares.push(({search:e,next:r})=>{let i=r(e);if(!t._includeValidateSearch)return i;try{return{...i,...X(n.options.validateSearch,i)??void 0}}catch{return i}});t.middlewares.push(({search:e})=>{let n=t.dest;return n.search?n.search===!0?e:h(n.search,e):{}});let n=(e,t,r)=>{if(e>=r.length)return t;let i=r[e];return i({search:t,next:t=>n(e+1,t,r)})};return function(e,r,i){return t.dest=r,t._includeValidateSearch=i,n(0,e,t.middlewares)}}function ut(e,t){if(e!==`root`)for(let e=t.length-1;e>=0;e--){let n=t[e];if(n.children)return n.id}return ae}function dt(e,t){let n=e.options.params?.parse??e.options.parseParams;if(n){let e=n(t);if(e===!1)throw Error(`Route params.parse returned false for a matched route`);Object.assign(t,e)}}var Z=e(n(),1),Q=t();function ft(e){let t=e.errorComponent??mt;return(0,Q.jsx)(pt,{getResetKey:e.getResetKey,onCatch:e.onCatch,children:({error:n,reset:r})=>n?Z.createElement(t,{error:n,reset:r}):e.children})}var pt=class extends Z.Component{constructor(...e){super(...e),this.state={error:null}}static getDerivedStateFromProps(e,t){let n=e.getResetKey();return t.error&&t.resetKey!==n?{resetKey:n,error:null}:{resetKey:n}}static getDerivedStateFromError(e){return{error:e}}reset(){this.setState({error:null})}componentDidCatch(e,t){this.props.onCatch&&this.props.onCatch(e,t)}render(){return this.props.children({error:this.state.error,reset:()=>{this.reset()}})}};function mt({error:e}){let[t,n]=Z.useState(!1);return(0,Q.jsxs)(`div`,{style:{padding:`.5rem`,maxWidth:`100%`},children:[(0,Q.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`.5rem`},children:[(0,Q.jsx)(`strong`,{style:{fontSize:`1rem`},children:`Something went wrong!`}),(0,Q.jsx)(`button`,{style:{appearance:`none`,fontSize:`.6em`,border:`1px solid currentColor`,padding:`.1rem .2rem`,fontWeight:`bold`,borderRadius:`.25rem`},onClick:()=>n(e=>!e),children:t?`Hide Error`:`Show Error`})]}),(0,Q.jsx)(`div`,{style:{height:`.25rem`}}),t?(0,Q.jsx)(`div`,{children:(0,Q.jsx)(`pre`,{style:{fontSize:`.7em`,border:`1px solid red`,borderRadius:`.25rem`,padding:`.3rem`,color:`red`,overflow:`auto`},children:e.message?(0,Q.jsx)(`code`,{children:e.message}):null})}):null]})}function ht(e){let t=y(),n=`not-found-${C(t.stores.location,e=>e.pathname)}-${C(t.stores.status,e=>e)}`;return(0,Q.jsx)(ft,{getResetKey:()=>n,onCatch:(t,n)=>{if(E(t))e.onCatch?.(t,n);else throw t},errorComponent:({error:t})=>{if(E(t))return e.fallback?.(t);throw t},children:e.children})}function gt(){return(0,Q.jsx)(`p`,{children:`Not Found`})}function $(e){return(0,Q.jsx)(Q.Fragment,{children:e.children})}function _t(e,t,n){return t.options.notFoundComponent?(0,Q.jsx)(t.options.notFoundComponent,{...n}):e.options.defaultNotFoundComponent?(0,Q.jsx)(e.options.defaultNotFoundComponent,{...n}):(0,Q.jsx)(gt,{})}var vt=Z.memo(function({matchId:e}){let t=y(),n=t.stores.matchStores.get(e);n||c();let r=C(t.stores.loadedAt,e=>e),i=C(n,e=>e);return(0,Q.jsx)(yt,{router:t,matchId:e,resetKey:r,matchState:Z.useMemo(()=>{let e=i.routeId,n=t.routesById[e].parentRoute?.id;return{routeId:e,ssr:i.ssr,_displayPending:i._displayPending,parentRouteId:n}},[i._displayPending,i.routeId,i.ssr,t.routesById])})});function yt({router:e,matchId:t,resetKey:n,matchState:r}){let i=e.routesById[r.routeId],a=i.options.pendingComponent??e.options.defaultPendingComponent,o=a?(0,Q.jsx)(a,{}):null,s=i.options.errorComponent??e.options.defaultErrorComponent,c=i.options.onCatch??e.options.defaultOnCatch,l=i.isRoot?i.options.notFoundComponent??e.options.notFoundRoute?.options.component:i.options.notFoundComponent,u=r.ssr===!1||r.ssr===`data-only`,d=(!i.isRoot||i.options.wrapInSuspense||u)&&(i.options.wrapInSuspense??a??(i.options.errorComponent?.preload||u))?Z.Suspense:$,f=s?ft:$,p=l?ht:$;return(0,Q.jsxs)(i.isRoot?i.options.shellComponent??$:$,{children:[(0,Q.jsx)(b.Provider,{value:t,children:(0,Q.jsx)(d,{fallback:o,children:(0,Q.jsx)(f,{getResetKey:()=>n,errorComponent:s||mt,onCatch:(e,t)=>{if(E(e))throw e.routeId??=r.routeId,e;c?.(e,t)},children:(0,Q.jsx)(p,{fallback:e=>{if(e.routeId??=r.routeId,!l||e.routeId&&e.routeId!==r.routeId||!e.routeId&&!i.isRoot)throw e;return Z.createElement(l,e)},children:u||r._displayPending?(0,Q.jsx)(ie,{fallback:o,children:(0,Q.jsx)(xt,{matchId:t})}):(0,Q.jsx)(xt,{matchId:t})})})})}),r.parentRouteId===`__root__`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(bt,{resetKey:n}),(e.options.scrollRestoration,null)]}):null]})}function bt({resetKey:e}){let t=y(),n=Z.useRef(void 0);return u(()=>{let e=t.latestLocation.href;(n.current===void 0||n.current!==e)&&(t.emit({type:`onRendered`,...J(t.stores.location.get(),t.stores.resolvedLocation.get())}),n.current=e)},[t.latestLocation.state.__TSR_key,e,t]),null}var xt=Z.memo(function({matchId:e}){let t=y(),n=(e,n)=>t.getMatch(e.id)?._nonReactive[n]??e._nonReactive[n],r=t.stores.matchStores.get(e);r||c();let i=C(r,e=>e),a=i.routeId,o=t.routesById[a],s=Z.useMemo(()=>{let e=(t.routesById[a].options.remountDeps??t.options.defaultRemountDeps)?.({routeId:a,loaderDeps:i.loaderDeps,params:i._strictParams,search:i._strictSearch});return e?JSON.stringify(e):void 0},[a,i.loaderDeps,i._strictParams,i._strictSearch,t.options.defaultRemountDeps,t.routesById]),l=Z.useMemo(()=>{let e=o.options.component??t.options.defaultComponent;return e?(0,Q.jsx)(e,{},s):(0,Q.jsx)(St,{})},[s,o.options.component,t.options.defaultComponent]);if(i._displayPending)throw n(i,`displayPendingPromise`);if(i._forcePending)throw n(i,`minPendingPromise`);if(i.status===`pending`){let e=o.options.pendingMinMs??t.options.defaultPendingMinMs;if(e){let n=t.getMatch(i.id);if(n&&!n._nonReactive.minPendingPromise){let t=k();n._nonReactive.minPendingPromise=t,setTimeout(()=>{t.resolve(),n._nonReactive.minPendingPromise=void 0},e)}}throw n(i,`loadPromise`)}if(i.status===`notFound`)return E(i.error)||c(),_t(t,o,i.error);if(i.status===`redirected`)throw T(i.error)||c(),n(i,`loadPromise`);if(i.status===`error`)throw i.error;return l}),St=Z.memo(function(){let e=y(),t=Z.useContext(b),n,r=!1,i;{let a=t?e.stores.matchStores.get(t):void 0;[n,r]=C(a,e=>[e?.routeId,e?.globalNotFound??!1]),i=C(e.stores.matchesId,e=>e[e.findIndex(e=>e===t)+1])}let a=n?e.routesById[n]:void 0,o=e.options.defaultPendingComponent?(0,Q.jsx)(e.options.defaultPendingComponent,{}):null;if(r)return a||c(),_t(e,a,void 0);if(!i)return null;let s=(0,Q.jsx)(vt,{matchId:i});return n===`__root__`?(0,Q.jsx)(Z.Suspense,{fallback:o,children:s}):s}),Ct=D(`/(home)`)({component:r(()=>ue(()=>import(`./route-C-L2dkin.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8])),`component`),validateSearch:oe(x({}))});export{ft as a,J as c,$ as i,de as l,vt as n,mt as o,St as r,it as s,Ct as t,fe as u};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/run-cjBxZ3gl.js","assets/state-CVjPP5QG.js","assets/chunk-QTnfLwEv.js","assets/button-Dz6Az3h_.js","assets/compiler-runtime-rGeCHUuX.js","assets/-workbench-terminal-DyfxJcjD.js","assets/fallbacks-uU4M5NOw.js"])))=>i.map(i=>d[i]);
2
+ import{$o as e,F as t,J as n,X as r,Y as i,es as a,mt as o,vt as s}from"./button-Dz6Az3h_.js";import{t as c}from"./preload-helper-CjdClQve.js";var l=a(`/(home)/$worktree/run`)({component:e(()=>c(()=>import(`./run-cjBxZ3gl.js`),__vite__mapDeps([0,1,2,3,4,5,6])),`component`),validateSearch:s(r({command:o(i),cwd:o(i),env:o(n(i,i)),inactive:o(t),sessionId:i}))});export{l as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./compiler-runtime-rGeCHUuX.js";import{Hs as n}from"./button-Dz6Az3h_.js";import{n as r}from"./fallbacks-uU4M5NOw.js";import{t as i,x as a}from"./state-CVjPP5QG.js";import{t as o}from"./run-C0ukWbxF.js";import{t as s}from"./-workbench-terminal-DyfxJcjD.js";var c=t(),l=e();function u(){let e=(0,c.c)(9),t=o.useParams(),s=o.useSearch(),u;e[0]===t.worktree?u=e[1]:(u=i(t.worktree),e[0]=t.worktree,e[1]=u);let f=a(u);if(!f.value.activeWorktree){let t;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,l.jsx)(n,{to:`/`,replace:!0}),e[2]=t):t=e[2],t}if(s.inactive===!0){let t;return e[3]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,l.jsx)(`div`,{className:`bg-background h-full min-h-0 min-w-0 p-2`,children:(0,l.jsx)(r,{message:`This script has not been started yet. Use the play button to start it.`})}),e[3]=t):t=e[3],t}let p=s.cwd??f.value.activeWorktree.root,m;return e[4]!==s.command||e[5]!==s.env||e[6]!==s.sessionId||e[7]!==p?(m=(0,l.jsx)(d,{command:s.command,cwd:p,env:s.env,sessionId:s.sessionId}),e[4]=s.command,e[5]=s.env,e[6]=s.sessionId,e[7]=p,e[8]=m):m=e[8],m}function d(e){let t=(0,c.c)(8),n;t[0]!==e.command||t[1]!==e.cwd||t[2]!==e.env||t[3]!==e.sessionId?(n=e.command===void 0?{cwd:e.cwd,sessionId:e.sessionId}:{args:[`-lc`,e.command],command:`sh`,cwd:e.cwd,env:e.env,sessionId:e.sessionId},t[0]=e.command,t[1]=e.cwd,t[2]=e.env,t[3]=e.sessionId,t[4]=n):n=t[4];let r=n,i;return t[5]!==e.sessionId||t[6]!==r?(i=(0,l.jsx)(`div`,{className:`bg-background h-full min-h-0 min-w-0`,children:(0,l.jsx)(s,{className:`h-full min-h-0 w-full min-w-0 overflow-hidden`,session:r},e.sessionId)}),t[5]=e.sessionId,t[6]=r,t[7]=i):i=t[7],i}export{u as component};