@puddle-code/cli 0.0.13 → 0.0.14

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 (25) hide show
  1. package/CHANGELOG.md +45 -6
  2. package/README.md +4 -4
  3. package/dist/index.js +446 -166
  4. package/dist/public/assets/{Dashboard-T4hbzT6P.js → Dashboard-Ct5exI8s.js} +1 -1
  5. package/dist/public/assets/{EditorTabClose-DxU5M-9J.js → EditorTabClose-BhFjRoCZ.js} +1 -1
  6. package/dist/public/assets/{LazyTerminal-Dpk5-lcY.js → LazyTerminal-B0xYs2ul.js} +2 -2
  7. package/dist/public/assets/{ModelRefcount-BGB1nvG5.js → ModelRefcount-BY5Ul0p3.js} +1 -1
  8. package/dist/public/assets/{PaneEditorBody-DX0u3ISF.js → PaneEditorBody-DLMtDiov.js} +1 -1
  9. package/dist/public/assets/{SettingsDialog-58D8eQOa.js → SettingsDialog-WhQXNCmS.js} +1 -1
  10. package/dist/public/assets/{Terminal-DlXSwAG0.js → Terminal-DA8zjtmU.js} +1 -1
  11. package/dist/public/assets/{Workspace-B_eXJKAN.js → Workspace-B0FDl771.js} +2 -2
  12. package/dist/public/assets/{buffer-store-zsL8CNKc.js → buffer-store-BHJ82Nh3.js} +2 -2
  13. package/dist/public/assets/{context-menu-C8MwVsBG.js → context-menu--H5GoapF.js} +1 -1
  14. package/dist/public/assets/{cssMode-Dzho6NMm.js → cssMode-Ctq00nXG.js} +1 -1
  15. package/dist/public/assets/{htmlMode-pj_l07tD.js → htmlMode-pYCLPiZ_.js} +1 -1
  16. package/dist/public/assets/index-CjgsCY-C.css +2 -0
  17. package/dist/public/assets/{index-oAv85qtL.js → index-RvCLpi9M.js} +4 -4
  18. package/dist/public/assets/{jsonMode-Dx2T0LuI.js → jsonMode-Ch5UticT.js} +1 -1
  19. package/dist/public/assets/{session-seed-C8M00YNU.js → session-seed-DBxHPYBK.js} +1 -1
  20. package/dist/public/assets/ssh-mode-eNTVum_C.js +1 -0
  21. package/dist/public/assets/{tsMode-DXWeq4NK.js → tsMode-CeXrzlPn.js} +1 -1
  22. package/dist/public/index.html +3 -3
  23. package/package.json +1 -1
  24. package/dist/public/assets/index-DK5CyY2G.css +0 -2
  25. package/dist/public/assets/ssh-mode-BdHO6hP9.js +0 -1
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{a as r,x as i}from"./api-Bh5IJ30S.js";import{a,g as o,i as s,n as c,o as l,t as u}from"./dialog-B43iKmfK.js";import{L as d,R as f,V as p,W as m,Y as h,et as g,nt as _,o as v,rt as y,s as b,t as x}from"./LazyTerminal-Dpk5-lcY.js";import{t as S}from"./utils-B6KiDbIe.js";import{A as C,O as w,c as T,j as E,k as D,n as O,r as k,t as A}from"./context-menu-C8MwVsBG.js";import{i as j,r as M}from"./dist-VDiYuPKw.js";import{M as N,P,W as F,X as I,ct as L}from"./index-oAv85qtL.js";var R=e(t(),1),z=n(),B=!1;function V(){let[e,t]=(0,R.useState)(B),[n,i]=(0,R.useState)(null);(0,R.useEffect)(()=>{if(!e)return;let t=!1;return P.spawnShell(r).then(e=>{t||i(e)}),()=>{t=!0}},[e]);let a=()=>{B=!1,t(!1),i(null)};return{open:e,term:n,toggle:()=>{e?(n&&P.killShell(r,n),a()):(B=!0,t(!0))},onExit:a}}function H({term:e,onExit:t}){return(0,z.jsx)(`div`,{className:`h-72 shrink-0 pb-6`,children:(0,z.jsx)(`div`,{className:`mx-auto size-full max-w-4xl px-6`,children:e!==null&&(0,z.jsx)(x,{stream:`home`,term:e,onExit:t})})})}var U=[{status:`running`,colour:`bg-running`},{status:`waiting_input`,colour:`bg-waiting`},{status:`interrupted`,colour:`bg-interrupted`}];function W({projectId:e}){let t=g(e),n=(0,R.useMemo)(()=>{let e=new Map;for(let n of t.data??[])e.set(n.status,(e.get(n.status)??0)+1);return e},[t.data]),r=(t.data??[]).filter(e=>e.status!==`archived`).length;return(0,z.jsxs)(`div`,{className:`flex items-center gap-3 text-2xs text-fg-muted tabular-nums`,children:[(0,z.jsxs)(`span`,{children:[r,` session`,r===1?``:`s`]}),U.map(({status:e,colour:t})=>{let r=n.get(e)??0;return r===0?null:(0,z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(`span`,{className:`size-1.5 rounded-full ${t}`}),r,` `,e.replace(`_`,` `)]},e)})]})}function G({icon:e,label:t,onClick:n}){return(0,z.jsx)(`button`,{type:`button`,"aria-label":t,title:t,onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},className:`flex items-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-ground hover:text-fg`,children:(0,z.jsx)(e,{className:`size-4`})})}function K({project:e,repoPath:t,draggable:n,dragging:r,onDragStart:d,onDragEnd:p,onDragOver:m}){let h=f(),[g,v]=(0,R.useState)(!1),[x,w]=(0,R.useState)(e.name),D=t=>h.mutate({id:e.id,archived:t},{onError:e=>i.error(e.message)}),j=()=>{let t=x.trim();if(!t||t===e.name){v(!1);return}h.mutate({id:e.id,name:t},{onSuccess:()=>v(!1),onError:e=>i.error(e.message)})};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(A,{children:[(0,z.jsx)(T,{asChild:!0,children:(0,z.jsxs)(`div`,{draggable:n,onDragStart:d,onDragEnd:p,onDragOver:m,className:S(`group relative transition-opacity`,r&&`opacity-50`),children:[(0,z.jsxs)(L,{draggable:!1,to:`/project/${e.id}`,className:`block rounded-lg bg-surface p-4 transition-colors hover:bg-elevated`,children:[(0,z.jsx)(`h2`,{className:`truncate pr-16 text-base font-semibold text-fg group-hover:text-accent`,children:e.name}),(0,z.jsx)(`p`,{className:`mt-1 truncate font-mono text-2xs text-fg-muted`,children:t??`…`}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(W,{projectId:e.id})})]}),(0,z.jsx)(`div`,{className:`absolute right-2 top-2 hidden gap-0.5 group-hover:flex has-[[data-state=open]]:flex`,children:e.archived?(0,z.jsx)(G,{icon:E,label:`Reopen project`,onClick:()=>D(!1)}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(G,{icon:b,label:`Rename project`,onClick:()=>{w(e.name),v(!0)}}),(0,z.jsx)(G,{icon:C,label:`Archive project`,onClick:()=>D(!0)})]})})]})}),(0,z.jsx)(O,{children:e.archived?(0,z.jsxs)(k,{onSelect:()=>D(!1),children:[(0,z.jsx)(E,{}),` Reopen`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(k,{onSelect:()=>{w(e.name),v(!0)},children:[(0,z.jsx)(b,{}),` Rename`]}),(0,z.jsxs)(k,{onSelect:()=>D(!0),children:[(0,z.jsx)(C,{}),` Archive`]})]})})]}),(0,z.jsx)(u,{open:g,onOpenChange:v,children:(0,z.jsxs)(c,{children:[(0,z.jsx)(a,{children:(0,z.jsx)(l,{children:`Rename project`})}),(0,z.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),j()},children:[(0,z.jsx)(y,{value:x,onChange:e=>w(e.target.value),autoFocus:!0}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsx)(_,{className:`text-fg-muted`,children:`Path`}),(0,z.jsx)(`p`,{className:`truncate font-mono text-2xs text-fg-muted`,children:t??`…`})]}),(0,z.jsxs)(s,{children:[(0,z.jsx)(o,{type:`button`,variant:`ghost`,onClick:()=>v(!1),children:`Cancel`}),(0,z.jsx)(o,{type:`submit`,disabled:!x.trim()||h.isPending,children:`Rename`})]})]})]})})]})}function q({icon:e,label:t,hint:n,onClick:r}){return(0,z.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex flex-col rounded-lg bg-surface p-4 text-left transition-colors hover:bg-elevated`,children:[(0,z.jsxs)(`h2`,{className:`flex items-center gap-2 truncate text-base font-semibold text-fg group-hover:text-accent`,children:[(0,z.jsx)(e,{className:`size-4 shrink-0`}),t]}),(0,z.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:n})]})}function J(){let e=v(),t=m(e??void 0),n=h(),r=p(e??void 0),i=d(e??``),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(!1),f=V(),g=e=>n.data?.find(t=>t.id===e)?.path,_=t.data??[],y=r.data?.projectOrder??[],b=w(_.filter(e=>!e.archived),y),x=_.filter(e=>e.archived),T=(e,t)=>{e!==t&&i.mutate({projectOrder:D(b.map(e=>e.id),e,t)})};return(0,z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,z.jsxs)(`div`,{className:`mx-auto max-w-4xl p-6`,children:[_.length===0&&(0,z.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,z.jsx)(M,{className:`size-8 text-fg-muted`}),(0,z.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`No projects yet — open one below, or press ⌘K.`})]}),(0,z.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[b.map(e=>(0,z.jsx)(K,{project:e,repoPath:g(e.repo_id),draggable:!0,dragging:s===e.id,onDragStart:()=>c(e.id),onDragEnd:()=>c(null),onDragOver:t=>{t.preventDefault(),s&&s!==e.id&&T(s,e.id)}},e.id)),(0,z.jsx)(q,{icon:I,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>o(!0)}),(0,z.jsx)(q,{icon:F,label:f.open?`Close terminal`:`Open terminal`,hint:f.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:f.toggle})]}),x.length>0&&(0,z.jsxs)(`div`,{className:`mt-6`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>u(e=>!e),className:`flex items-center gap-1.5 px-1 py-1.5 text-2xs uppercase tracking-wide text-fg-muted transition-colors hover:text-fg`,children:[(0,z.jsx)(j,{className:S(`size-3 transition-transform`,l&&`rotate-90`)}),(0,z.jsx)(C,{className:`size-3`}),(0,z.jsx)(`span`,{children:`Archived`}),(0,z.jsx)(`span`,{className:`tabular-nums`,children:x.length})]}),l&&(0,z.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:x.map(e=>(0,z.jsx)(K,{project:e,repoPath:g(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),f.open&&(0,z.jsx)(H,{term:f.term,onExit:f.onExit}),e!==null&&(0,z.jsx)(N,{profileId:e,open:a,onOpenChange:o})]})}export{J as Dashboard};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{a as r,x as i}from"./api-Bh5IJ30S.js";import{a,g as o,i as s,n as c,o as l,t as u}from"./dialog-B43iKmfK.js";import{L as d,R as f,V as p,W as m,Y as h,et as g,nt as _,o as v,rt as y,s as b,t as x}from"./LazyTerminal-B0xYs2ul.js";import{t as S}from"./utils-B6KiDbIe.js";import{A as C,O as w,c as T,j as E,k as D,n as O,r as k,t as A}from"./context-menu--H5GoapF.js";import{i as j,r as M}from"./dist-VDiYuPKw.js";import{M as N,P,W as F,X as I,ct as L}from"./index-RvCLpi9M.js";var R=e(t(),1),z=n(),B=!1;function V(){let[e,t]=(0,R.useState)(B),[n,i]=(0,R.useState)(null);(0,R.useEffect)(()=>{if(!e)return;let t=!1;return P.spawnShell(r).then(e=>{t||i(e)}),()=>{t=!0}},[e]);let a=()=>{B=!1,t(!1),i(null)};return{open:e,term:n,toggle:()=>{e?(n&&P.killShell(r,n),a()):(B=!0,t(!0))},onExit:a}}function H({term:e,onExit:t}){return(0,z.jsx)(`div`,{className:`h-72 shrink-0 pb-6`,children:(0,z.jsx)(`div`,{className:`mx-auto size-full max-w-4xl px-6`,children:e!==null&&(0,z.jsx)(x,{stream:`home`,term:e,onExit:t})})})}var U=[{status:`running`,colour:`bg-running`},{status:`waiting_input`,colour:`bg-waiting`},{status:`interrupted`,colour:`bg-interrupted`}];function W({projectId:e}){let t=g(e),n=(0,R.useMemo)(()=>{let e=new Map;for(let n of t.data??[])e.set(n.status,(e.get(n.status)??0)+1);return e},[t.data]),r=(t.data??[]).filter(e=>e.status!==`archived`).length;return(0,z.jsxs)(`div`,{className:`flex items-center gap-3 text-2xs text-fg-muted tabular-nums`,children:[(0,z.jsxs)(`span`,{children:[r,` session`,r===1?``:`s`]}),U.map(({status:e,colour:t})=>{let r=n.get(e)??0;return r===0?null:(0,z.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,z.jsx)(`span`,{className:`size-1.5 rounded-full ${t}`}),r,` `,e.replace(`_`,` `)]},e)})]})}function G({icon:e,label:t,onClick:n}){return(0,z.jsx)(`button`,{type:`button`,"aria-label":t,title:t,onClick:e=>{e.preventDefault(),e.stopPropagation(),n()},className:`flex items-center rounded-md p-1.5 text-fg-muted transition-colors hover:bg-ground hover:text-fg`,children:(0,z.jsx)(e,{className:`size-4`})})}function K({project:e,repoPath:t,draggable:n,dragging:r,onDragStart:d,onDragEnd:p,onDragOver:m}){let h=f(),[g,v]=(0,R.useState)(!1),[x,w]=(0,R.useState)(e.name),D=t=>h.mutate({id:e.id,archived:t},{onError:e=>i.error(e.message)}),j=()=>{let t=x.trim();if(!t||t===e.name){v(!1);return}h.mutate({id:e.id,name:t},{onSuccess:()=>v(!1),onError:e=>i.error(e.message)})};return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(A,{children:[(0,z.jsx)(T,{asChild:!0,children:(0,z.jsxs)(`div`,{draggable:n,onDragStart:d,onDragEnd:p,onDragOver:m,className:S(`group relative transition-opacity`,r&&`opacity-50`),children:[(0,z.jsxs)(L,{draggable:!1,to:`/project/${e.id}`,className:`block rounded-lg bg-surface p-4 transition-colors hover:bg-elevated`,children:[(0,z.jsx)(`h2`,{className:`truncate pr-16 text-base font-semibold text-fg group-hover:text-accent`,children:e.name}),(0,z.jsx)(`p`,{className:`mt-1 truncate font-mono text-2xs text-fg-muted`,children:t??`…`}),(0,z.jsx)(`div`,{className:`mt-3`,children:(0,z.jsx)(W,{projectId:e.id})})]}),(0,z.jsx)(`div`,{className:`absolute right-2 top-2 hidden gap-0.5 group-hover:flex has-[[data-state=open]]:flex`,children:e.archived?(0,z.jsx)(G,{icon:E,label:`Reopen project`,onClick:()=>D(!1)}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(G,{icon:b,label:`Rename project`,onClick:()=>{w(e.name),v(!0)}}),(0,z.jsx)(G,{icon:C,label:`Archive project`,onClick:()=>D(!0)})]})})]})}),(0,z.jsx)(O,{children:e.archived?(0,z.jsxs)(k,{onSelect:()=>D(!1),children:[(0,z.jsx)(E,{}),` Reopen`]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(k,{onSelect:()=>{w(e.name),v(!0)},children:[(0,z.jsx)(b,{}),` Rename`]}),(0,z.jsxs)(k,{onSelect:()=>D(!0),children:[(0,z.jsx)(C,{}),` Archive`]})]})})]}),(0,z.jsx)(u,{open:g,onOpenChange:v,children:(0,z.jsxs)(c,{children:[(0,z.jsx)(a,{children:(0,z.jsx)(l,{children:`Rename project`})}),(0,z.jsxs)(`form`,{className:`flex flex-col gap-3`,onSubmit:e=>{e.preventDefault(),j()},children:[(0,z.jsx)(y,{value:x,onChange:e=>w(e.target.value),autoFocus:!0}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsx)(_,{className:`text-fg-muted`,children:`Path`}),(0,z.jsx)(`p`,{className:`truncate font-mono text-2xs text-fg-muted`,children:t??`…`})]}),(0,z.jsxs)(s,{children:[(0,z.jsx)(o,{type:`button`,variant:`ghost`,onClick:()=>v(!1),children:`Cancel`}),(0,z.jsx)(o,{type:`submit`,disabled:!x.trim()||h.isPending,children:`Rename`})]})]})]})})]})}function q({icon:e,label:t,hint:n,onClick:r}){return(0,z.jsxs)(`button`,{type:`button`,onClick:r,className:`group flex flex-col rounded-lg bg-surface p-4 text-left transition-colors hover:bg-elevated`,children:[(0,z.jsxs)(`h2`,{className:`flex items-center gap-2 truncate text-base font-semibold text-fg group-hover:text-accent`,children:[(0,z.jsx)(e,{className:`size-4 shrink-0`}),t]}),(0,z.jsx)(`p`,{className:`mt-1 truncate text-2xs text-fg-muted`,children:n})]})}function J(){let e=v(),t=m(e??void 0),n=h(),r=p(e??void 0),i=d(e??``),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(null),[l,u]=(0,R.useState)(!1),f=V(),g=e=>n.data?.find(t=>t.id===e)?.path,_=t.data??[],y=r.data?.projectOrder??[],b=w(_.filter(e=>!e.archived),y),x=_.filter(e=>e.archived),T=(e,t)=>{e!==t&&i.mutate({projectOrder:D(b.map(e=>e.id),e,t)})};return(0,z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,z.jsxs)(`div`,{className:`mx-auto max-w-4xl p-6`,children:[_.length===0&&(0,z.jsxs)(`div`,{className:`mb-8 mt-16 flex flex-col items-center gap-3 text-center`,children:[(0,z.jsx)(M,{className:`size-8 text-fg-muted`}),(0,z.jsx)(`p`,{className:`text-sm text-fg-secondary`,children:`No projects yet — open one below, or press ⌘K.`})]}),(0,z.jsxs)(`div`,{className:`grid auto-rows-fr grid-cols-1 gap-3 sm:grid-cols-2`,children:[b.map(e=>(0,z.jsx)(K,{project:e,repoPath:g(e.repo_id),draggable:!0,dragging:s===e.id,onDragStart:()=>c(e.id),onDragEnd:()=>c(null),onDragOver:t=>{t.preventDefault(),s&&s!==e.id&&T(s,e.id)}},e.id)),(0,z.jsx)(q,{icon:I,label:`Open project`,hint:`Point at a repository on this host`,onClick:()=>o(!0)}),(0,z.jsx)(q,{icon:F,label:f.open?`Close terminal`:`Open terminal`,hint:f.open?`End the shell below`:`A shell at ~ for cloning repositories`,onClick:f.toggle})]}),x.length>0&&(0,z.jsxs)(`div`,{className:`mt-6`,children:[(0,z.jsxs)(`button`,{type:`button`,onClick:()=>u(e=>!e),className:`flex items-center gap-1.5 px-1 py-1.5 text-2xs uppercase tracking-wide text-fg-muted transition-colors hover:text-fg`,children:[(0,z.jsx)(j,{className:S(`size-3 transition-transform`,l&&`rotate-90`)}),(0,z.jsx)(C,{className:`size-3`}),(0,z.jsx)(`span`,{children:`Archived`}),(0,z.jsx)(`span`,{className:`tabular-nums`,children:x.length})]}),l&&(0,z.jsx)(`div`,{className:`mt-2 grid grid-cols-1 gap-3 sm:grid-cols-2`,children:x.map(e=>(0,z.jsx)(K,{project:e,repoPath:g(e.repo_id),draggable:!1,dragging:!1,onDragStart:()=>{},onDragEnd:()=>{},onDragOver:()=>{}},e.id))})]})]})}),f.open&&(0,z.jsx)(H,{term:f.term,onExit:f.onExit}),e!==null&&(0,z.jsx)(N,{profileId:e,open:a,onOpenChange:o})]})}export{J as Dashboard};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{a as r,g as i,h as a,i as o,n as s,o as c,r as l,t as u}from"./dialog-B43iKmfK.js";import{t as d}from"./createLucideIcon-DyMAgLa3.js";import{l as f,r as p,t as m}from"./buffer-store-zsL8CNKc.js";import{s as h,t as g}from"./editor-sync-F3Wyveaa.js";var _=d(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),v=e(t(),1),y=n();function b(e,t){let n=m(e,t);return(0,v.useSyncExternalStore)((0,v.useCallback)(e=>f(n,e),[n]),()=>p(n))}function x({session:e,path:t,kind:n,label:d,onClose:f}){let p=b(e,t)&&n!==`commit`,[m,x]=(0,v.useState)(!1),S=()=>p?x(!0):f();return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`button`,{onClick:e=>{e.stopPropagation(),S()},className:`flex size-4 items-center justify-center rounded-sm text-fg-muted transition-colors hover:text-fg`,"aria-label":`Close ${d}`,children:p?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_,{className:`size-2 fill-current group-hover:hidden`}),(0,y.jsx)(a,{className:`hidden size-3 group-hover:block`})]}):(0,y.jsx)(a,{className:`size-3 opacity-0 group-hover:opacity-100`})}),(0,y.jsx)(u,{open:m,onOpenChange:e=>!e&&x(!1),children:(0,y.jsxs)(s,{children:[(0,y.jsxs)(r,{children:[(0,y.jsxs)(c,{children:[`Discard changes to `,d,`?`]}),(0,y.jsx)(l,{children:`This file has unsaved changes. Closing the tab will discard them.`})]}),(0,y.jsxs)(o,{children:[(0,y.jsx)(i,{variant:`ghost`,onClick:()=>x(!1),children:`Keep editing`}),(0,y.jsx)(i,{variant:`danger`,onClick:()=>{h(e,t),g(e,t),x(!1),f()},children:`Discard`})]})]})})]})}export{x as EditorTabClose};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{a as r,g as i,h as a,i as o,n as s,o as c,r as l,t as u}from"./dialog-B43iKmfK.js";import{t as d}from"./createLucideIcon-DyMAgLa3.js";import{l as f,r as p,t as m}from"./buffer-store-BHJ82Nh3.js";import{s as h,t as g}from"./editor-sync-F3Wyveaa.js";var _=d(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),v=e(t(),1),y=n();function b(e,t){let n=m(e,t);return(0,v.useSyncExternalStore)((0,v.useCallback)(e=>f(n,e),[n]),()=>p(n))}function x({session:e,path:t,kind:n,label:d,onClose:f}){let p=b(e,t)&&n!==`commit`,[m,x]=(0,v.useState)(!1),S=()=>p?x(!0):f();return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`button`,{onClick:e=>{e.stopPropagation(),S()},className:`flex size-4 items-center justify-center rounded-sm text-fg-muted transition-colors hover:text-fg`,"aria-label":`Close ${d}`,children:p?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(_,{className:`size-2 fill-current group-hover:hidden`}),(0,y.jsx)(a,{className:`hidden size-3 group-hover:block`})]}):(0,y.jsx)(a,{className:`size-3 opacity-0 group-hover:opacity-100`})}),(0,y.jsx)(u,{open:m,onOpenChange:e=>!e&&x(!1),children:(0,y.jsxs)(s,{children:[(0,y.jsxs)(r,{children:[(0,y.jsxs)(c,{children:[`Discard changes to `,d,`?`]}),(0,y.jsx)(l,{children:`This file has unsaved changes. Closing the tab will discard them.`})]}),(0,y.jsxs)(o,{children:[(0,y.jsx)(i,{variant:`ghost`,onClick:()=>x(!1),children:`Keep editing`}),(0,y.jsx)(i,{variant:`danger`,onClick:()=>{h(e,t),g(e,t),x(!1),f()},children:`Discard`})]})]})})]})}export{x as EditorTabClose};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Terminal-DlXSwAG0.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-ffCh33zF.js","assets/api-Bh5IJ30S.js","assets/utils-B6KiDbIe.js","assets/index-oAv85qtL.js","assets/poll-focus-B7dQPFj6.js","assets/preload-helper-Czpn1I53.js","assets/dialog-B43iKmfK.js","assets/createLucideIcon-DyMAgLa3.js","assets/index-DK5CyY2G.css","assets/ssh-mode-BdHO6hP9.js","assets/Terminal-BrP-ENHg.css"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n,t as r}from"./jsx-runtime-ffCh33zF.js";import{n as i,o as a,r as o,t as s}from"./poll-focus-B7dQPFj6.js";import{t as c}from"./preload-helper-Czpn1I53.js";import{n as l,y as u}from"./api-Bh5IJ30S.js";import{A as d,C as f,O as p,w as m,x as h}from"./dialog-B43iKmfK.js";import{t as g}from"./utils-B6KiDbIe.js";import{t as _}from"./createLucideIcon-DyMAgLa3.js";var v=e(t(),1),y=[`top`,`right`,`bottom`,`left`],b=Math.min,x=Math.max,S=Math.round,C=Math.floor,w=e=>({x:e,y:e}),T={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function E(e,t,n){return x(e,b(t,n))}function D(e,t){return typeof e==`function`?e(t):e}function O(e){return e.split(`-`)[0]}function k(e){return e.split(`-`)[1]}function A(e){return e===`x`?`y`:`x`}function j(e){return e===`y`?`height`:`width`}function M(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function N(e){return A(M(e))}function P(e,t,n){n===void 0&&(n=!1);let r=k(e),i=N(e),a=j(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=B(o)),[o,B(o)]}function F(e){let t=B(e);return[I(e),t,I(t)]}function I(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var L=[`left`,`right`],R=[`right`,`left`],z=[`top`,`bottom`],ee=[`bottom`,`top`];function te(e,t,n){switch(e){case`top`:case`bottom`:return n?t?R:L:t?L:R;case`left`:case`right`:return t?z:ee;default:return[]}}function ne(e,t,n,r){let i=k(e),a=te(O(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(I)))),a}function B(e){let t=O(e);return T[t]+e.slice(t.length)}function re(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ie(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:re(e)}function ae(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function oe(e,t,n){let{reference:r,floating:i}=e,a=M(t),o=N(t),s=j(o),c=O(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=k(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function se(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=D(t,e),p=ie(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=ae(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=ae(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ce=50,le=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:se},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=oe(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ce&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=oe(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ue=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=D(e,t)||{};if(l==null)return{};let d=ie(u),f={x:n,y:r},p=N(i),m=j(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,x=a.reference[m]+a.reference[p]-f[p]-a.floating[m],S=f[p]-a.reference[p],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),w=C?C[y]:0;(!w||!await(o.isElement==null?void 0:o.isElement(C)))&&(w=s.floating[y]||a.floating[m]);let T=x/2-S/2,O=w/2-h[m]/2-1,A=b(d[_],O),M=b(d[v],O),P=w-h[m]-M,F=w/2-h[m]/2+T,I=E(A,F,P),L=!c.arrow&&k(i)!=null&&F!==I&&a.reference[m]/2-(F<A?A:M)-h[m]/2<0,R=L?F<A?F-A:F-P:0;return{[p]:f[p]+R,data:{[p]:I,centerOffset:F-I-R,...L&&{alignmentOffset:R}},reset:L}}}),de=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=D(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=O(r),_=M(o),v=O(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[B(o)]:F(o)),x=p!==`none`;!d&&x&&b.push(...ne(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=P(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==M(t))||T.every(e=>M(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=M(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function fe(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function pe(e){return y.some(t=>e[t]>=0)}var me=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=D(e,t);switch(i){case`referenceHidden`:{let e=fe(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:pe(e)}}}case`escaped`:{let e=fe(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:pe(e)}}}default:return{}}}}},he=new Set([`left`,`top`]);async function ge(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=O(n),s=k(n),c=M(n)===`y`,l=he.has(o)?-1:1,u=a&&c?-1:1,d=D(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var _e=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await ge(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ve=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=D(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=M(i),p=A(f),m=u[p],h=u[f],g=(e,t)=>E(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},ye=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=D(e,t),u={x:n,y:r},d=M(i),f=A(d),p=u[f],m=u[d],h=D(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=he.has(O(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},be=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=D(e,t),c=await i.detectOverflow(t,s),l=O(n),u=k(n),d=M(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=b(p-c[m],g),y=b(f-c[h],_),S=t.middlewareData.shift,C=!S,w=v,T=y;S!=null&&S.enabled.x&&(T=_),S!=null&&S.enabled.y&&(w=g),C&&!u&&(d?T=f-2*x(c.left,c.right):w=p-2*x(c.top,c.bottom)),await o({...t,availableWidth:T,availableHeight:w});let E=await i.getDimensions(a.floating);return f!==E.width||p!==E.height?{reset:{rects:!0}}:{}}}};function xe(){return typeof window<`u`}function V(e){return Se(e)?(e.nodeName||``).toLowerCase():`#document`}function H(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function U(e){return((Se(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Se(e){return xe()?e instanceof Node||e instanceof H(e).Node:!1}function W(e){return xe()?e instanceof Element||e instanceof H(e).Element:!1}function G(e){return xe()?e instanceof HTMLElement||e instanceof H(e).HTMLElement:!1}function Ce(e){return!xe()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof H(e).ShadowRoot}function we(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=J(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Te(e){return/^(table|td|th)$/.test(V(e))}function Ee(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var De=/transform|translate|scale|rotate|perspective|filter/,Oe=/paint|layout|strict|content/,K=e=>!!e&&e!==`none`,ke;function Ae(e){let t=W(e)?J(e):e;return K(t.transform)||K(t.translate)||K(t.scale)||K(t.rotate)||K(t.perspective)||!Me()&&(K(t.backdropFilter)||K(t.filter))||De.test(t.willChange||``)||Oe.test(t.contain||``)}function je(e){let t=Y(e);for(;G(t)&&!q(t);){if(Ae(t))return t;if(Ee(t))return null;t=Y(t)}return null}function Me(){return ke??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ke}function q(e){return/^(html|body|#document)$/.test(V(e))}function J(e){return H(e).getComputedStyle(e)}function Ne(e){return W(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Y(e){if(V(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ce(e)&&e.host||U(e);return Ce(t)?t.host:t}function Pe(e){let t=Y(e);return q(t)?(e.ownerDocument||e).body:G(t)&&we(t)?t:Pe(t)}function Fe(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Pe(e),i=r===e.ownerDocument?.body,a=H(r);if(i){let e=Ie(a);return t.concat(a,a.visualViewport||[],we(r)?r:[],e&&n?Fe(e):[])}else return t.concat(r,Fe(r,[],n))}function Ie(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Le(e){let t=J(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=G(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=S(n)!==a||S(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Re(e){return W(e)?e:e.contextElement}function X(e){let t=Re(e);if(!G(t))return w(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Le(t),o=(a?S(n.width):n.width)/r,s=(a?S(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ze=w(0);function Be(e){let t=H(e);return!Me()||!t.visualViewport?ze:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ve(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===H(e)}function Z(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Re(e),o=w(1);t&&(r?W(r)&&(o=X(r)):o=X(e));let s=Ve(a,n,r)?Be(a):w(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=H(a),t=W(r)?H(r):r,n=e,i=Ie(n);for(;i&&t!==n;){let e=X(i),t=i.getBoundingClientRect(),r=J(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=H(i),i=Ie(n)}}return ae({width:u,height:d,x:c,y:l})}function He(e,t){let n=Ne(e).scrollLeft;return t?t.left+n:Z(U(e)).left+n}function Ue(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-He(e,n),y:n.top+t.scrollTop}}function We(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=U(r),s=t?Ee(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=w(1),u=w(0),d=G(r);if((d||!a)&&((V(r)!==`body`||we(o))&&(c=Ne(r)),d)){let e=Z(r);l=X(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ue(o,c):w(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Ge(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ke(e){let t=Ne(e),n=e.ownerDocument.body,r=x(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=x(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+He(e),o=-t.scrollTop;return J(n).direction===`rtl`&&(a+=x(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var qe=25;function Je(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=H(e),a=U(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Me()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(He(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=qe&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ye(e,t){let n=Z(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=X(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Xe(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Je(e,n,t);else if(t===`document`)r=Ke(U(e));else if(W(t))r=Ye(t,n);else{let n=Be(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ae(r)}function Ze(e,t){let n=t.get(e);if(n)return n;let r=Fe(e,[],!1).filter(e=>W(e)&&V(e)!==`body`),i=null,a=J(e).position===`fixed`,o=a?Y(e):e;for(;W(o)&&!q(o);){let e=J(o),t=Ae(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Y(o)}return t.set(e,r),r}function Qe(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Ee(t)?[]:Ze(t,this._c):[].concat(n),r],o=Xe(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Xe(t,a[e],i);s=x(n.top,s),c=b(n.right,c),l=b(n.bottom,l),u=x(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function $e(e){let{width:t,height:n}=Le(e);return{width:t,height:n}}function et(e,t,n){let r=G(t),i=U(t),a=n===`fixed`,o=Z(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=w(0);if((r||!a)&&((V(t)!==`body`||we(i))&&(s=Ne(t)),r)){let e=Z(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=He(i));let l=i&&!r&&!a?Ue(i,s):w(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function tt(e){return J(e).position===`static`}function nt(e,t){if(!G(e)||J(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return U(e)===n&&(n=n.ownerDocument.body),n}function rt(e,t){let n=H(e);if(Ee(e))return n;if(!G(e)){let t=Y(e);for(;t&&!q(t);){if(W(t)&&!tt(t))return t;t=Y(t)}return n}let r=nt(e,t);for(;r&&Te(r)&&tt(r);)r=nt(r,t);return r&&q(r)&&tt(r)&&!Ae(r)?n:r||je(e)||n}var it=async function(e){let t=this.getOffsetParent||rt,n=this.getDimensions,r=await n(e.floating);return{reference:et(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function at(e){return J(e).direction===`rtl`}var ot={convertOffsetParentRelativeRectToViewportRelativeRect:We,getDocumentElement:U,getClippingRect:Qe,getOffsetParent:rt,getElementRects:it,getClientRects:Ge,getDimensions:$e,getScale:X,isElement:W,isRTL:at};function st(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ct(e,t,n){let r=null,i,a=U(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=C(d),h=C(a.clientWidth-(u+f)),g=C(a.clientHeight-(d+p)),_=C(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:x(0,b(1,c))||1},y=!0;function S(t){let n=t[0].intersectionRatio;if(!st(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(S,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(S,v)}r.observe(e)}let c=H(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function lt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Re(e),u=i||a?[...l?Fe(l):[],...t?Fe(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?ct(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Z(e):null;c&&g();function g(){let t=Z(e);h&&!st(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var ut=_e,dt=ve,ft=de,pt=be,mt=me,ht=ue,gt=ye,_t=(e,t,n)=>{let r=new Map,i=n??{},a={...ot,...i.platform,_c:r};return le(e,t,{...i,platform:a})},vt=e(n(),1),yt=typeof document<`u`?v.useLayoutEffect:function(){};function bt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!bt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!bt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function xt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function St(e,t){let n=xt(e);return Math.round(t*n)/n}function Ct(e){let t=v.useRef(e);return yt(()=>{t.current=e}),t}function wt(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(r);bt(f,r)||p(r);let[m,h]=v.useState(null),[g,_]=v.useState(null),y=v.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=v.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=v.useRef(null),w=v.useRef(null),T=v.useRef(u),E=c!=null,D=Ct(c),O=Ct(i),k=Ct(l),A=v.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),_t(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!bt(T.current,t)&&(T.current=t,vt.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);yt(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=v.useRef(!1);yt(()=>(j.current=!0,()=>{j.current=!1}),[]),yt(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=v.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=v.useMemo(()=>({reference:x,floating:S}),[x,S]),P=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=St(N.floating,u.x),r=St(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...xt(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var Tt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:ht({element:r.current,padding:i}).fn(n):r?ht({element:r,padding:i}).fn(n):{}}}},Et=(e,t)=>{let n=ut(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dt=(e,t)=>{let n=dt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ot=(e,t)=>({fn:gt(e).fn,options:[e,t]}),kt=(e,t)=>{let n=ft(e);return{name:n.name,fn:n.fn,options:[e,t]}},At=(e,t)=>{let n=pt(e);return{name:n.name,fn:n.fn,options:[e,t]}},jt=(e,t)=>{let n=mt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mt=(e,t)=>{let n=Tt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Q=r(),Nt=`Arrow`,Pt=v.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,Q.jsx)(m.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,Q.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Pt.displayName=Nt;var Ft=Pt;function It(e){let[t,n]=v.useState(void 0);return h(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Lt=`Popper`,[Rt,zt]=p(Lt),[Bt,Vt]=Rt(Lt),Ht=e=>{let{__scopePopper:t,children:n}=e,[r,i]=v.useState(null),[a,o]=v.useState(void 0);return(0,Q.jsx)(Bt,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};Ht.displayName=Lt;var Ut=`PopperAnchor`,Wt=v.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Vt(Ut,n),o=v.useRef(null),s=a.onAnchorChange,c=d(t,v.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=v.useRef(null);v.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&en(a.placementState),f=u?.[0],p=u?.[1];return r?null:(0,Q.jsx)(m.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...i,ref:c})});Wt.displayName=Ut;var Gt=`PopperContent`,[Kt,qt]=Rt(Gt),Jt=v.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:p=`partial`,hideWhenDetached:g=!1,updatePositionStrategy:_=`optimized`,onPlaced:y,...b}=e,x=Vt(Gt,n),[S,C]=v.useState(null),w=d(t,C),[T,E]=v.useState(null),D=It(T),O=D?.width??0,k=D?.height??0,A=r+(a===`center`?``:`-`+a),j=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},M=Array.isArray(l)?l:[l],N=M.length>0,P={padding:j,boundary:M.filter(Qt),altBoundary:N},{refs:F,floatingStyles:I,placement:L,isPositioned:R,middlewareData:z}=wt({strategy:`fixed`,placement:A,whileElementsMounted:(...e)=>lt(...e,{animationFrame:_===`always`}),elements:{reference:x.anchor},middleware:[Et({mainAxis:i+k,alignmentAxis:o}),c&&Dt({mainAxis:!0,crossAxis:!1,limiter:p===`partial`?Ot():void 0,...P}),c&&kt({...P}),At({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),T&&Mt({element:T,padding:s}),$t({arrowWidth:O,arrowHeight:k}),g&&jt({strategy:`referenceHidden`,...P,boundary:N?P.boundary:void 0})]}),ee=x.setPlacementState;h(()=>(ee(L),()=>{ee(void 0)}),[L,ee]);let[te,ne]=en(L),B=f(y);h(()=>{R&&B?.()},[R,B]);let re=z.arrow?.x,ie=z.arrow?.y,ae=z.arrow?.centerOffset!==0,[oe,se]=v.useState();return h(()=>{S&&se(window.getComputedStyle(S).zIndex)},[S]),(0,Q.jsx)(`div`,{ref:F.setFloating,"data-radix-popper-content-wrapper":``,style:{...I,transform:R?I.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,Q.jsx)(Kt,{scope:n,placedSide:te,placedAlign:ne,onArrowChange:E,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,Q.jsx)(m.div,{"data-side":te,"data-align":ne,...b,ref:w,style:{...b.style,animation:R?void 0:`none`}})})})});Jt.displayName=Gt;var Yt=`PopperArrow`,Xt={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Zt=v.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=qt(Yt,n),a=Xt[i.placedSide];return(0,Q.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,Q.jsx)(Ft,{...r,ref:t,style:{...r.style,display:`block`}})})});Zt.displayName=Yt;function Qt(e){return e!==null}var $t=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=en(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function en(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var tn=Ht,nn=Wt,rn=Jt,an=Zt,on=`rounded-md bg-border/50 text-sm text-fg placeholder:text-fg-muted transition-colors hover:bg-border/80 focus:bg-border/80 disabled:cursor-not-allowed disabled:opacity-50`,sn=`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-fg outline-none transition-colors`,cn=`data-[highlighted]:bg-action data-[highlighted]:text-action-ink data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,ln=`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`;function un({className:e,type:t,...n}){return(0,Q.jsx)(`input`,{type:t,className:g(`flex h-8 w-full px-2.5`,on,e),...n})}function dn({className:e,...t}){return(0,Q.jsx)(`textarea`,{className:g(`flex min-h-16 w-full px-2.5 py-2`,on,e),...t})}var fn=`Label`,pn=v.forwardRef((e,t)=>(0,Q.jsx)(m.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));pn.displayName=fn;var mn=pn;function hn({className:e,...t}){return(0,Q.jsx)(mn,{className:g(`text-xs font-medium text-fg-secondary peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function gn(){return o({queryKey:[`profiles`],queryFn:()=>l(`GET`,`/api/profiles`)})}function _n(e){return o({queryKey:[`profile-settings`,e],queryFn:()=>l(`GET`,`/api/profiles/${e}/settings`),enabled:e!==void 0})}function vn(e){return o({queryKey:[`accounts`,e],queryFn:()=>l(`GET`,`/api/accounts?profile=${e}`),enabled:e!==void 0})}function yn(e){return o({queryKey:[`account-usage`,e],queryFn:()=>l(`GET`,`/api/accounts/${e}/usage`),enabled:e!==void 0,staleTime:15e3})}function bn(){return o({queryKey:[`repos`],queryFn:()=>l(`GET`,`/api/repos`)})}function xn(e){return o({queryKey:[`projects`,e??`all`],queryFn:()=>l(`GET`,e===void 0?`/api/projects`:`/api/projects?profile=${e}`)})}function Sn(e){return o({queryKey:[`project`,e],queryFn:()=>l(`GET`,`/api/projects/${e}`),enabled:e!==void 0})}function Cn(e){return o({queryKey:[`sessions`,e],queryFn:()=>l(`GET`,`/api/sessions?project=${e}`),enabled:e!==void 0})}function wn(){return o({queryKey:[`sessions`,`all`],queryFn:()=>l(`GET`,`/api/sessions`)})}function Tn(){return o({queryKey:[`config`],queryFn:()=>l(`GET`,`/api/config`)})}function En(e){return o({queryKey:[`repo-branches`,e],queryFn:()=>l(`GET`,`/api/repos/${e}/branches`),enabled:e!==void 0,staleTime:3e4})}function Dn(e){return o({queryKey:[`repo-worktrees`,e],queryFn:()=>l(`GET`,`/api/repos/${e}/worktrees`),enabled:e!==void 0,staleTime:1e4})}function On(e,t){let n=a();return i({mutationFn:t=>l(`DELETE`,`/api/repos/${e}/worktrees?path=${encodeURIComponent(t)}`),onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function kn(e,t){let n=a();return i({mutationFn:({name:t,confirm:n})=>{let r=new URLSearchParams({name:t});return n&&r.set(`confirm`,`1`),l(`DELETE`,`/api/repos/${e}/branches?${r.toString()}`)},onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function An(e){return o({queryKey:[`fs-dirs`,e],queryFn:()=>l(`GET`,`/api/fs/dirs?prefix=${encodeURIComponent(e)}`),enabled:e.startsWith(`/`)||e.startsWith(`~`),placeholderData:e=>e,staleTime:1e4})}function jn(){return o({queryKey:[`version`],queryFn:()=>l(`GET`,`/api/version`),staleTime:1/0})}function Mn(){return o({queryKey:[`host`],queryFn:()=>l(`GET`,`/api/host`),staleTime:1/0})}function Nn(e){return e?e.displayName||e.hostname:void 0}function Pn(){return o({queryKey:[`agents`],queryFn:()=>l(`GET`,`/api/agents`),staleTime:1/0})}function Fn(){let e=a();return i({mutationFn:e=>l(`POST`,`/api/profiles`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function In(e){let t=a();return i({mutationFn:t=>l(`PATCH`,`/api/profiles/${e}/settings`,t),onSuccess:n=>t.setQueryData([`profile-settings`,e],n)})}function Ln(){let e=a();return i({mutationFn:({id:e,...t})=>l(`PATCH`,`/api/profiles/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function Rn(){let e=a();return i({mutationFn:({id:e,...t})=>l(`PATCH`,`/api/accounts/${e}`,t),onSuccess:t=>{e.invalidateQueries({queryKey:[`accounts`,t.profile_id]}),e.invalidateQueries({queryKey:[`account-usage`,t.id]})}})}function zn(){let e=a();return i({mutationFn:e=>l(`DELETE`,`/api/profiles/${e}`),onSuccess:()=>e.clear()})}function Bn(){let e=a();return i({mutationFn:e=>l(`DELETE`,`/api/accounts/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`accounts`]})})}function Vn(){let e=a();return i({mutationFn:e=>l(`POST`,`/api/accounts`,e),onSuccess:t=>void e.invalidateQueries({queryKey:[`accounts`,t.profile_id]})})}function Hn(){return i({mutationFn:e=>l(`POST`,`/api/accounts/${e}/login`)})}function Un(){let e=a();return i({mutationFn:e=>l(`POST`,`/api/repos`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Wn(){let e=a();return i({mutationFn:({id:e,...t})=>l(`PATCH`,`/api/repos/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Gn(){let e=a();return i({mutationFn:e=>l(`POST`,`/api/repos/${e}/fetch`),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Kn(){let e=a();return i({mutationFn:e=>l(`POST`,`/api/projects`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function qn(){let e=a();return i({mutationFn:({id:e,...t})=>l(`PATCH`,`/api/projects/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function Jn(e,t){return o({queryKey:[`scratchpad`,e,t??`none`],queryFn:()=>l(`GET`,`/api/scratchpad?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function Yn(){let e=a();return i({mutationFn:e=>l(`POST`,`/api/scratchpad`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function Xn(){let e=a();return i({mutationFn:({id:e,...t})=>l(`PATCH`,`/api/scratchpad/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function Zn(){let e=a();return i({mutationFn:e=>l(`DELETE`,`/api/scratchpad/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function $(e,t){e.invalidateQueries({queryKey:[`sessions`]}),e.invalidateQueries({queryKey:[`project`,t.project_id]})}function Qn(){let e=a();return i({mutationFn:e=>l(`POST`,`/api/sessions`,e),onSuccess:t=>$(e,t)})}function $n(e){let t=a();return i({mutationFn:t=>l(`POST`,`/api/sessions/${t}/${e}`),onSuccess:e=>$(t,e)})}function er(){let e=a();return i({mutationFn:({sessionId:e,accountId:t})=>l(`POST`,`/api/sessions/${e}/migrate`,{account_id:t}),onSuccess:t=>$(e,t)})}function tr(){let e=a();return i({mutationFn:e=>l(`POST`,`/api/sessions/${e}/archive`),onSuccess:t=>$(e,t)})}function nr(){let e=a();return i({mutationFn:e=>l(`POST`,`/api/sessions/${e}/unarchive`),onSuccess:t=>$(e,t)})}function rr(){let e=a();return i({mutationFn:({sessionId:e,title:t})=>l(`PATCH`,`/api/sessions/${e}`,{title:t}),onSuccess:t=>$(e,t)})}function ir(){let e=a();return i({mutationFn:e=>l(`PATCH`,`/api/config`,e),onSuccess:(t,n)=>{e.setQueryData([`config`],t),`displayName`in n&&e.invalidateQueries({queryKey:[`host`]})}})}async function ar(e){try{return await l(`GET`,`/api/profiles/${e}/state`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`no_state`)return null;throw e}}function or(e,t){return l(`PUT`,`/api/profiles/${e}/state`,{ui_state:t})}function sr(e,t){return o({queryKey:[`ports`,e],queryFn:()=>l(`GET`,`/api/sessions/${e}/ports`),enabled:e!==void 0&&t,refetchInterval:s(5e3),refetchIntervalInBackground:!1})}function cr(e,t){return o({queryKey:[`session-env`,e],queryFn:()=>l(`GET`,`/api/sessions/${e}/env`),enabled:e!==void 0&&t,refetchInterval:s(5e3),refetchIntervalInBackground:!1})}function lr(){let e=a();return i({mutationFn:e=>l(`DELETE`,`/api/sessions/${e}/env`),onSuccess:(t,n)=>{e.setQueryData([`session-env`,n],{vars:[]})}})}var ur=_(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),dr=u(`puddle.profile-id`);function fr(){let e=(0,v.useSyncExternalStore)(dr.subscribe,dr.get);return e!==null&&/^[0-9a-f]{10}$/.test(e)?e:null}function pr(e){dr.set(e)}function mr({id:e,value:t,onValueChange:n,onChoose:r,hints:i,placeholder:a,className:o,hintsClassName:s,autoFocus:c}){let[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(0),p=e=>{n(e.value),r?.(e),u(!1)};return(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(un,{id:e,value:t,onChange:e=>{n(e.target.value),u(!0),f(0)},onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:e=>{if(!(!l||i.length===0))if(e.key===`ArrowDown`)e.preventDefault(),f(e=>(e+1)%i.length);else if(e.key===`ArrowUp`)e.preventDefault(),f(e=>(e-1+i.length)%i.length);else if(e.key===`Enter`||e.key===`Tab`){let t=i[d]??i[0];t&&(e.preventDefault(),p(t))}else e.key===`Escape`&&(e.stopPropagation(),u(!1))},placeholder:a,className:o,autoComplete:`off`,spellCheck:!1,autoFocus:c}),l&&i.length>0&&(0,Q.jsx)(`ul`,{className:g(`absolute top-full z-10 mt-1 max-h-56 overflow-y-auto rounded-md bg-elevated p-1 shadow-xl`,s??`w-full`),children:i.map((e,t)=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),p(e)},onMouseEnter:()=>f(t),className:g(`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-fg outline-none transition-colors`,`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`,`w-full font-mono text-xs`),"data-selected":t===d,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e.label??e.value}),e.badge&&(0,Q.jsx)(`span`,{className:`ml-auto shrink-0 text-2xs opacity-70`,children:e.badge})]})},e.value))})]})}var hr=(0,v.lazy)(()=>c(()=>import(`./Terminal-DlXSwAG0.js`).then(e=>({default:e.Terminal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),gr=null;async function _r(){gr=(await c(()=>import(`./Terminal-DlXSwAG0.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))).Terminal}function vr(e){return gr?(0,Q.jsx)(gr,{...e}):(0,Q.jsx)(v.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`size-full bg-ground`}),children:(0,Q.jsx)(hr,{...e})})}export{sr as $,Gn as A,Xn as B,Qn as C,zn as D,kn as E,ir as F,On as G,gn as H,Ln as I,Dn as J,rr as K,In as L,Hn as M,er as N,Zn as O,Rn as P,cr as Q,qn as R,Yn as S,Bn as T,Sn as U,_n as V,xn as W,Jn as X,bn as Y,$n as Z,Tn as _,pr as a,on as at,Kn as b,ar as c,sn as ct,yn as d,rn as dt,Cn as et,vn as f,tn as ft,lr as g,tr as h,dr as i,dn as it,Mn as j,An as k,Nn as l,nn as lt,wn as m,It as mt,_r as n,hn as nt,fr as o,ln as ot,Pn as p,zt as pt,En as q,mr as r,un as rt,ur as s,cn as st,vr as t,nr as tt,or as u,an as ut,Vn as v,jn as w,Un as x,Fn as y,Wn as z};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Terminal-DA8zjtmU.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-CZI7_Jkm.js","assets/jsx-runtime-ffCh33zF.js","assets/api-Bh5IJ30S.js","assets/utils-B6KiDbIe.js","assets/index-RvCLpi9M.js","assets/poll-focus-B7dQPFj6.js","assets/preload-helper-Czpn1I53.js","assets/dialog-B43iKmfK.js","assets/createLucideIcon-DyMAgLa3.js","assets/index-CjgsCY-C.css","assets/ssh-mode-eNTVum_C.js","assets/Terminal-BrP-ENHg.css"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{n,t as r}from"./jsx-runtime-ffCh33zF.js";import{n as i,o as a,r as o,t as s}from"./poll-focus-B7dQPFj6.js";import{t as c}from"./preload-helper-Czpn1I53.js";import{n as l,y as u}from"./api-Bh5IJ30S.js";import{A as d,C as f,O as p,w as m,x as h}from"./dialog-B43iKmfK.js";import{t as g}from"./utils-B6KiDbIe.js";import{t as _}from"./createLucideIcon-DyMAgLa3.js";var v=e(t(),1),y=[`top`,`right`,`bottom`,`left`],b=Math.min,x=Math.max,S=Math.round,C=Math.floor,w=e=>({x:e,y:e}),T={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function E(e,t,n){return x(e,b(t,n))}function D(e,t){return typeof e==`function`?e(t):e}function O(e){return e.split(`-`)[0]}function k(e){return e.split(`-`)[1]}function A(e){return e===`x`?`y`:`x`}function j(e){return e===`y`?`height`:`width`}function M(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function N(e){return A(M(e))}function P(e,t,n){n===void 0&&(n=!1);let r=k(e),i=N(e),a=j(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=B(o)),[o,B(o)]}function F(e){let t=B(e);return[I(e),t,I(t)]}function I(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var L=[`left`,`right`],R=[`right`,`left`],z=[`top`,`bottom`],ee=[`bottom`,`top`];function te(e,t,n){switch(e){case`top`:case`bottom`:return n?t?R:L:t?L:R;case`left`:case`right`:return t?z:ee;default:return[]}}function ne(e,t,n,r){let i=k(e),a=te(O(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(I)))),a}function B(e){let t=O(e);return T[t]+e.slice(t.length)}function re(e){return{top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0}}function ie(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:re(e)}function ae(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function oe(e,t,n){let{reference:r,floating:i}=e,a=M(t),o=N(t),s=j(o),c=O(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}let m=k(t);return m&&(p[o]+=f*(m===`end`?1:-1)*(n&&l?-1:1)),p}async function se(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=D(t,e),p=ie(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=ae(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=ae(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ce=50,le=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:se},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=oe(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<ce&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=oe(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},ue=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=D(e,t)||{};if(l==null)return{};let d=ie(u),f={x:n,y:r},p=N(i),m=j(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,x=a.reference[m]+a.reference[p]-f[p]-a.floating[m],S=f[p]-a.reference[p],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),w=C?C[y]:0;(!w||!await(o.isElement==null?void 0:o.isElement(C)))&&(w=s.floating[y]||a.floating[m]);let T=x/2-S/2,O=w/2-h[m]/2-1,A=b(d[_],O),M=b(d[v],O),P=w-h[m]-M,F=w/2-h[m]/2+T,I=E(A,F,P),L=!c.arrow&&k(i)!=null&&F!==I&&a.reference[m]/2-(F<A?A:M)-h[m]/2<0,R=L?F<A?F-A:F-P:0;return{[p]:f[p]+R,data:{[p]:I,centerOffset:F-I-R,...L&&{alignmentOffset:R}},reset:L}}}),de=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=D(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=O(r),_=M(o),v=O(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[B(o)]:F(o)),x=p!==`none`;!d&&x&&b.push(...ne(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=P(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==M(t))||T.every(e=>M(e.placement)!==_||e.overflows[0]>0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=M(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function fe(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function pe(e){return y.some(t=>e[t]>=0)}var me=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=D(e,t);switch(i){case`referenceHidden`:{let e=fe(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:pe(e)}}}case`escaped`:{let e=fe(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:pe(e)}}}default:return{}}}}},he=new Set([`left`,`top`]);async function ge(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=O(n),s=k(n),c=M(n)===`y`,l=he.has(o)?-1:1,u=a&&c?-1:1,d=D(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var _e=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await ge(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ve=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=D(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=M(i),p=A(f),m=u[p],h=u[f],g=(e,t)=>E(t+d[e===`y`?`top`:`left`],t,t-d[e===`y`?`bottom`:`right`]);o&&(m=g(p,m)),s&&(h=g(f,h));let _=c.fn({...t,[p]:m,[f]:h});return{..._,data:{x:_.x-n,y:_.y-r,enabled:{[p]:o,[f]:s}}}}}},ye=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=D(e,t),u={x:n,y:r},d=M(i),f=A(d),p=u[f],m=u[d],h=D(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:h.mainAxis??0,crossAxis:h.crossAxis??0};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=he.has(O(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},be=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=D(e,t),c=await i.detectOverflow(t,s),l=O(n),u=k(n),d=M(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=b(p-c[m],g),y=b(f-c[h],_),S=t.middlewareData.shift,C=!S,w=v,T=y;S!=null&&S.enabled.x&&(T=_),S!=null&&S.enabled.y&&(w=g),C&&!u&&(d?T=f-2*x(c.left,c.right):w=p-2*x(c.top,c.bottom)),await o({...t,availableWidth:T,availableHeight:w});let E=await i.getDimensions(a.floating);return f!==E.width||p!==E.height?{reset:{rects:!0}}:{}}}};function xe(){return typeof window<`u`}function V(e){return Se(e)?(e.nodeName||``).toLowerCase():`#document`}function H(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function U(e){return((Se(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Se(e){return xe()?e instanceof Node||e instanceof H(e).Node:!1}function W(e){return xe()?e instanceof Element||e instanceof H(e).Element:!1}function G(e){return xe()?e instanceof HTMLElement||e instanceof H(e).HTMLElement:!1}function Ce(e){return!xe()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof H(e).ShadowRoot}function we(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=J(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Te(e){return/^(table|td|th)$/.test(V(e))}function Ee(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var De=/transform|translate|scale|rotate|perspective|filter/,Oe=/paint|layout|strict|content/,K=e=>!!e&&e!==`none`,ke;function Ae(e){let t=W(e)?J(e):e;return K(t.transform)||K(t.translate)||K(t.scale)||K(t.rotate)||K(t.perspective)||!Me()&&(K(t.backdropFilter)||K(t.filter))||De.test(t.willChange||``)||Oe.test(t.contain||``)}function je(e){let t=Y(e);for(;G(t)&&!q(t);){if(Ae(t))return t;if(Ee(t))return null;t=Y(t)}return null}function Me(){return ke??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ke}function q(e){return/^(html|body|#document)$/.test(V(e))}function J(e){return H(e).getComputedStyle(e)}function Ne(e){return W(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Y(e){if(V(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ce(e)&&e.host||U(e);return Ce(t)?t.host:t}function Pe(e){let t=Y(e);return q(t)?(e.ownerDocument||e).body:G(t)&&we(t)?t:Pe(t)}function Fe(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Pe(e),i=r===e.ownerDocument?.body,a=H(r);if(i){let e=Ie(a);return t.concat(a,a.visualViewport||[],we(r)?r:[],e&&n?Fe(e):[])}else return t.concat(r,Fe(r,[],n))}function Ie(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Le(e){let t=J(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=G(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=S(n)!==a||S(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Re(e){return W(e)?e:e.contextElement}function X(e){let t=Re(e);if(!G(t))return w(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Le(t),o=(a?S(n.width):n.width)/r,s=(a?S(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var ze=w(0);function Be(e){let t=H(e);return!Me()||!t.visualViewport?ze:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ve(e,t,n){return t===void 0&&(t=!1),!!n&&t&&n===H(e)}function Z(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Re(e),o=w(1);t&&(r?W(r)&&(o=X(r)):o=X(e));let s=Ve(a,n,r)?Be(a):w(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a&&r){let e=H(a),t=W(r)?H(r):r,n=e,i=Ie(n);for(;i&&t!==n;){let e=X(i),t=i.getBoundingClientRect(),r=J(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=H(i),i=Ie(n)}}return ae({width:u,height:d,x:c,y:l})}function He(e,t){let n=Ne(e).scrollLeft;return t?t.left+n:Z(U(e)).left+n}function Ue(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-He(e,n),y:n.top+t.scrollTop}}function We(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=U(r),s=t?Ee(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=w(1),u=w(0),d=G(r);if((d||!a)&&((V(r)!==`body`||we(o))&&(c=Ne(r)),d)){let e=Z(r);l=X(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Ue(o,c):w(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Ge(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function Ke(e){let t=Ne(e),n=e.ownerDocument.body,r=x(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),i=x(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight),a=-t.scrollLeft+He(e),o=-t.scrollTop;return J(n).direction===`rtl`&&(a+=x(e.clientWidth,n.clientWidth)-r),{width:r,height:i,x:a,y:o}}var qe=25;function Je(e,t,n){n===void 0&&(n=`viewport`);let r=n===`layoutViewport`,i=H(e),a=U(e),o=i.visualViewport,s=a.clientWidth,c=a.clientHeight,l=0,u=0;if(o){let e=!Me()||t===`fixed`;r?e||(l=-o.offsetLeft,u=-o.offsetTop):(s=o.width,c=o.height,e&&(l=o.offsetLeft,u=o.offsetTop))}if(He(a)<=0){let e=a.ownerDocument,t=e.body,n=getComputedStyle(t),r=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,i=Math.abs(a.clientWidth-t.clientWidth-r),o=getComputedStyle(a).scrollbarGutter===`stable both-edges`?i/2:i;o<=qe&&(s-=o)}return{width:s,height:c,x:l,y:u}}function Ye(e,t){let n=Z(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=X(e);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Xe(e,t,n){let r;if(t===`viewport`||t===`layoutViewport`)r=Je(e,n,t);else if(t===`document`)r=Ke(U(e));else if(W(t))r=Ye(t,n);else{let n=Be(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ae(r)}function Ze(e,t){let n=t.get(e);if(n)return n;let r=Fe(e,[],!1).filter(e=>W(e)&&V(e)!==`body`),i=null,a=J(e).position===`fixed`,o=a?Y(e):e;for(;W(o)&&!q(o);){let e=J(o),t=Ae(o),n=i?i.position:a?`fixed`:``;!t&&(n===`fixed`||n===`absolute`&&e.position===`static`)?r=r.filter(e=>e!==o):i=e,o=Y(o)}return t.set(e,r),r}function Qe(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Ee(t)?[]:Ze(t,this._c):[].concat(n),r],o=Xe(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Xe(t,a[e],i);s=x(n.top,s),c=b(n.right,c),l=b(n.bottom,l),u=x(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function $e(e){let{width:t,height:n}=Le(e);return{width:t,height:n}}function et(e,t,n){let r=G(t),i=U(t),a=n===`fixed`,o=Z(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=w(0);if((r||!a)&&((V(t)!==`body`||we(i))&&(s=Ne(t)),r)){let e=Z(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}!r&&i&&(c.x=He(i));let l=i&&!r&&!a?Ue(i,s):w(0);return{x:o.left+s.scrollLeft-c.x-l.x,y:o.top+s.scrollTop-c.y-l.y,width:o.width,height:o.height}}function tt(e){return J(e).position===`static`}function nt(e,t){if(!G(e)||J(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return U(e)===n&&(n=n.ownerDocument.body),n}function rt(e,t){let n=H(e);if(Ee(e))return n;if(!G(e)){let t=Y(e);for(;t&&!q(t);){if(W(t)&&!tt(t))return t;t=Y(t)}return n}let r=nt(e,t);for(;r&&Te(r)&&tt(r);)r=nt(r,t);return r&&q(r)&&tt(r)&&!Ae(r)?n:r||je(e)||n}var it=async function(e){let t=this.getOffsetParent||rt,n=this.getDimensions,r=await n(e.floating);return{reference:et(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function at(e){return J(e).direction===`rtl`}var ot={convertOffsetParentRelativeRectToViewportRelativeRect:We,getDocumentElement:U,getClippingRect:Qe,getOffsetParent:rt,getElementRects:it,getClientRects:Ge,getDimensions:$e,getScale:X,isElement:W,isRTL:at};function st(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ct(e,t,n){let r=null,i,a=U(e);function o(){var e;clearTimeout(i),(e=r)==null||e.disconnect(),r=null}function s(n,c){n===void 0&&(n=!1),c===void 0&&(c=1),o();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(n||t(),!f||!p)return;let m=C(d),h=C(a.clientWidth-(u+f)),g=C(a.clientHeight-(d+p)),_=C(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:x(0,b(1,c))||1},y=!0;function S(t){let n=t[0].intersectionRatio;if(!st(l,e.getBoundingClientRect()))return s();if(n!==c){if(!y)return s();n?s(!1,n):i=setTimeout(()=>{s(!1,1e-7)},1e3)}y=!1}try{r=new IntersectionObserver(S,{...v,root:a.ownerDocument})}catch{r=new IntersectionObserver(S,v)}r.observe(e)}let c=H(e),l=()=>s(n);return c.addEventListener(`resize`,l),s(!0),()=>{c.removeEventListener(`resize`,l),o()}}function lt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Re(e),u=i||a?[...l?Fe(l):[],...t?Fe(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n),a&&e.addEventListener(`resize`,n)});let d=l&&s?ct(l,n,a):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Z(e):null;c&&g();function g(){let t=Z(e);h&&!st(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var ut=_e,dt=ve,ft=de,pt=be,mt=me,ht=ue,gt=ye,_t=(e,t,n)=>{let r=new Map,i=n??{},a={...ot,...i.platform,_c:r};return le(e,t,{...i,platform:a})},vt=e(n(),1),yt=typeof document<`u`?v.useLayoutEffect:function(){};function bt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!bt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!bt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function xt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function St(e,t){let n=xt(e);return Math.round(t*n)/n}function Ct(e){let t=v.useRef(e);return yt(()=>{t.current=e}),t}function wt(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(r);bt(f,r)||p(r);let[m,h]=v.useState(null),[g,_]=v.useState(null),y=v.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),b=v.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=v.useRef(null),w=v.useRef(null),T=v.useRef(u),E=c!=null,D=Ct(c),O=Ct(i),k=Ct(l),A=v.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),_t(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!bt(T.current,t)&&(T.current=t,vt.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);yt(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=v.useRef(!1);yt(()=>(j.current=!0,()=>{j.current=!1}),[]),yt(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=v.useMemo(()=>({reference:C,floating:w,setReference:y,setFloating:b}),[y,b]),N=v.useMemo(()=>({reference:x,floating:S}),[x,S]),P=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=St(N.floating,u.x),r=St(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...xt(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var Tt=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:ht({element:r.current,padding:i}).fn(n):r?ht({element:r,padding:i}).fn(n):{}}}},Et=(e,t)=>{let n=ut(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dt=(e,t)=>{let n=dt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ot=(e,t)=>({fn:gt(e).fn,options:[e,t]}),kt=(e,t)=>{let n=ft(e);return{name:n.name,fn:n.fn,options:[e,t]}},At=(e,t)=>{let n=pt(e);return{name:n.name,fn:n.fn,options:[e,t]}},jt=(e,t)=>{let n=mt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mt=(e,t)=>{let n=Tt(e);return{name:n.name,fn:n.fn,options:[e,t]}},Q=r(),Nt=`Arrow`,Pt=v.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,Q.jsx)(m.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,Q.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Pt.displayName=Nt;var Ft=Pt;function It(e){let[t,n]=v.useState(void 0);return h(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Lt=`Popper`,[Rt,zt]=p(Lt),[Bt,Vt]=Rt(Lt),Ht=e=>{let{__scopePopper:t,children:n}=e,[r,i]=v.useState(null),[a,o]=v.useState(void 0);return(0,Q.jsx)(Bt,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};Ht.displayName=Lt;var Ut=`PopperAnchor`,Wt=v.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Vt(Ut,n),o=v.useRef(null),s=a.onAnchorChange,c=d(t,v.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=v.useRef(null);v.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&en(a.placementState),f=u?.[0],p=u?.[1];return r?null:(0,Q.jsx)(m.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...i,ref:c})});Wt.displayName=Ut;var Gt=`PopperContent`,[Kt,qt]=Rt(Gt),Jt=v.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:p=`partial`,hideWhenDetached:g=!1,updatePositionStrategy:_=`optimized`,onPlaced:y,...b}=e,x=Vt(Gt,n),[S,C]=v.useState(null),w=d(t,C),[T,E]=v.useState(null),D=It(T),O=D?.width??0,k=D?.height??0,A=r+(a===`center`?``:`-`+a),j=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},M=Array.isArray(l)?l:[l],N=M.length>0,P={padding:j,boundary:M.filter(Qt),altBoundary:N},{refs:F,floatingStyles:I,placement:L,isPositioned:R,middlewareData:z}=wt({strategy:`fixed`,placement:A,whileElementsMounted:(...e)=>lt(...e,{animationFrame:_===`always`}),elements:{reference:x.anchor},middleware:[Et({mainAxis:i+k,alignmentAxis:o}),c&&Dt({mainAxis:!0,crossAxis:!1,limiter:p===`partial`?Ot():void 0,...P}),c&&kt({...P}),At({...P,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),T&&Mt({element:T,padding:s}),$t({arrowWidth:O,arrowHeight:k}),g&&jt({strategy:`referenceHidden`,...P,boundary:N?P.boundary:void 0})]}),ee=x.setPlacementState;h(()=>(ee(L),()=>{ee(void 0)}),[L,ee]);let[te,ne]=en(L),B=f(y);h(()=>{R&&B?.()},[R,B]);let re=z.arrow?.x,ie=z.arrow?.y,ae=z.arrow?.centerOffset!==0,[oe,se]=v.useState();return h(()=>{S&&se(window.getComputedStyle(S).zIndex)},[S]),(0,Q.jsx)(`div`,{ref:F.setFloating,"data-radix-popper-content-wrapper":``,style:{...I,transform:R?I.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(` `),...z.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,Q.jsx)(Kt,{scope:n,placedSide:te,placedAlign:ne,onArrowChange:E,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,Q.jsx)(m.div,{"data-side":te,"data-align":ne,...b,ref:w,style:{...b.style,animation:R?void 0:`none`}})})})});Jt.displayName=Gt;var Yt=`PopperArrow`,Xt={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Zt=v.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=qt(Yt,n),a=Xt[i.placedSide];return(0,Q.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,Q.jsx)(Ft,{...r,ref:t,style:{...r.style,display:`block`}})})});Zt.displayName=Yt;function Qt(e){return e!==null}var $t=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=en(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function en(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var tn=Ht,nn=Wt,rn=Jt,an=Zt,on=`rounded-md bg-border/50 text-sm text-fg placeholder:text-fg-muted transition-colors hover:bg-border/80 focus:bg-border/80 disabled:cursor-not-allowed disabled:opacity-50`,sn=`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-fg outline-none transition-colors`,cn=`data-[highlighted]:bg-action data-[highlighted]:text-action-ink data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,ln=`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`;function un({className:e,type:t,...n}){return(0,Q.jsx)(`input`,{type:t,className:g(`flex h-8 w-full px-2.5`,on,e),...n})}function dn({className:e,...t}){return(0,Q.jsx)(`textarea`,{className:g(`flex min-h-16 w-full px-2.5 py-2`,on,e),...t})}var fn=`Label`,pn=v.forwardRef((e,t)=>(0,Q.jsx)(m.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));pn.displayName=fn;var mn=pn;function hn({className:e,...t}){return(0,Q.jsx)(mn,{className:g(`text-xs font-medium text-fg-secondary peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function gn(){return o({queryKey:[`profiles`],queryFn:()=>l(`GET`,`/api/profiles`)})}function _n(e){return o({queryKey:[`profile-settings`,e],queryFn:()=>l(`GET`,`/api/profiles/${e}/settings`),enabled:e!==void 0})}function vn(e){return o({queryKey:[`accounts`,e],queryFn:()=>l(`GET`,`/api/accounts?profile=${e}`),enabled:e!==void 0})}function yn(e){return o({queryKey:[`account-usage`,e],queryFn:()=>l(`GET`,`/api/accounts/${e}/usage`),enabled:e!==void 0,staleTime:15e3})}function bn(){return o({queryKey:[`repos`],queryFn:()=>l(`GET`,`/api/repos`)})}function xn(e){return o({queryKey:[`projects`,e??`all`],queryFn:()=>l(`GET`,e===void 0?`/api/projects`:`/api/projects?profile=${e}`)})}function Sn(e){return o({queryKey:[`project`,e],queryFn:()=>l(`GET`,`/api/projects/${e}`),enabled:e!==void 0})}function Cn(e){return o({queryKey:[`sessions`,e],queryFn:()=>l(`GET`,`/api/sessions?project=${e}`),enabled:e!==void 0})}function wn(){return o({queryKey:[`sessions`,`all`],queryFn:()=>l(`GET`,`/api/sessions`)})}function Tn(){return o({queryKey:[`config`],queryFn:()=>l(`GET`,`/api/config`)})}function En(e){return o({queryKey:[`repo-branches`,e],queryFn:()=>l(`GET`,`/api/repos/${e}/branches`),enabled:e!==void 0,staleTime:3e4})}function Dn(e){return o({queryKey:[`repo-worktrees`,e],queryFn:()=>l(`GET`,`/api/repos/${e}/worktrees`),enabled:e!==void 0,staleTime:1e4})}function On(e,t){let n=a();return i({mutationFn:t=>l(`DELETE`,`/api/repos/${e}/worktrees?path=${encodeURIComponent(t)}`),onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function kn(e,t){let n=a();return i({mutationFn:({name:t,confirm:n})=>{let r=new URLSearchParams({name:t});return n&&r.set(`confirm`,`1`),l(`DELETE`,`/api/repos/${e}/branches?${r.toString()}`)},onSuccess:r=>{n.setQueryData([`repo-worktrees`,e],r),n.invalidateQueries({queryKey:[`project`,t]})}})}function An(e){return o({queryKey:[`fs-dirs`,e],queryFn:()=>l(`GET`,`/api/fs/dirs?prefix=${encodeURIComponent(e)}`),enabled:e.startsWith(`/`)||e.startsWith(`~`),placeholderData:e=>e,staleTime:1e4})}function jn(){return o({queryKey:[`version`],queryFn:()=>l(`GET`,`/api/version`),staleTime:1/0})}function Mn(){return o({queryKey:[`host`],queryFn:()=>l(`GET`,`/api/host`),staleTime:1/0})}function Nn(e){return e?e.displayName||e.hostname:void 0}function Pn(){return o({queryKey:[`agents`],queryFn:()=>l(`GET`,`/api/agents`),staleTime:1/0})}function Fn(){let e=a();return i({mutationFn:e=>l(`POST`,`/api/profiles`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function In(e){let t=a();return i({mutationFn:t=>l(`PATCH`,`/api/profiles/${e}/settings`,t),onSuccess:n=>t.setQueryData([`profile-settings`,e],n)})}function Ln(){let e=a();return i({mutationFn:({id:e,...t})=>l(`PATCH`,`/api/profiles/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`profiles`]})})}function Rn(){let e=a();return i({mutationFn:({id:e,...t})=>l(`PATCH`,`/api/accounts/${e}`,t),onSuccess:t=>{e.invalidateQueries({queryKey:[`accounts`,t.profile_id]}),e.invalidateQueries({queryKey:[`account-usage`,t.id]})}})}function zn(){let e=a();return i({mutationFn:e=>l(`DELETE`,`/api/profiles/${e}`),onSuccess:()=>e.clear()})}function Bn(){let e=a();return i({mutationFn:e=>l(`DELETE`,`/api/accounts/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`accounts`]})})}function Vn(){let e=a();return i({mutationFn:e=>l(`POST`,`/api/accounts`,e),onSuccess:t=>void e.invalidateQueries({queryKey:[`accounts`,t.profile_id]})})}function Hn(){return i({mutationFn:e=>l(`POST`,`/api/accounts/${e}/login`)})}function Un(){let e=a();return i({mutationFn:e=>l(`POST`,`/api/repos`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Wn(){let e=a();return i({mutationFn:({id:e,...t})=>l(`PATCH`,`/api/repos/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Gn(){let e=a();return i({mutationFn:e=>l(`POST`,`/api/repos/${e}/fetch`),onSuccess:()=>void e.invalidateQueries({queryKey:[`repos`]})})}function Kn(){let e=a();return i({mutationFn:e=>l(`POST`,`/api/projects`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function qn(){let e=a();return i({mutationFn:({id:e,...t})=>l(`PATCH`,`/api/projects/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`projects`]})})}function Jn(e,t){return o({queryKey:[`scratchpad`,e,t??`none`],queryFn:()=>l(`GET`,`/api/scratchpad?profile=${e}${t?`&project=${t}`:``}`),enabled:e!==void 0})}function Yn(){let e=a();return i({mutationFn:e=>l(`POST`,`/api/scratchpad`,e),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function Xn(){let e=a();return i({mutationFn:({id:e,...t})=>l(`PATCH`,`/api/scratchpad/${e}`,t),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function Zn(){let e=a();return i({mutationFn:e=>l(`DELETE`,`/api/scratchpad/${e}`),onSuccess:()=>void e.invalidateQueries({queryKey:[`scratchpad`]})})}function $(e,t){e.invalidateQueries({queryKey:[`sessions`]}),e.invalidateQueries({queryKey:[`project`,t.project_id]})}function Qn(){let e=a();return i({mutationFn:e=>l(`POST`,`/api/sessions`,e),onSuccess:t=>$(e,t)})}function $n(e){let t=a();return i({mutationFn:t=>l(`POST`,`/api/sessions/${t}/${e}`),onSuccess:e=>$(t,e)})}function er(){let e=a();return i({mutationFn:({sessionId:e,accountId:t})=>l(`POST`,`/api/sessions/${e}/migrate`,{account_id:t}),onSuccess:t=>$(e,t)})}function tr(){let e=a();return i({mutationFn:e=>l(`POST`,`/api/sessions/${e}/archive`),onSuccess:t=>$(e,t)})}function nr(){let e=a();return i({mutationFn:e=>l(`POST`,`/api/sessions/${e}/unarchive`),onSuccess:t=>$(e,t)})}function rr(){let e=a();return i({mutationFn:({sessionId:e,title:t})=>l(`PATCH`,`/api/sessions/${e}`,{title:t}),onSuccess:t=>$(e,t)})}function ir(){let e=a();return i({mutationFn:e=>l(`PATCH`,`/api/config`,e),onSuccess:(t,n)=>{e.setQueryData([`config`],t),`displayName`in n&&e.invalidateQueries({queryKey:[`host`]})}})}async function ar(e){try{return await l(`GET`,`/api/profiles/${e}/state`)}catch(e){if(e instanceof Error&&`code`in e&&e.code===`no_state`)return null;throw e}}function or(e,t){return l(`PUT`,`/api/profiles/${e}/state`,{ui_state:t})}function sr(e,t){return o({queryKey:[`ports`,e],queryFn:()=>l(`GET`,`/api/sessions/${e}/ports`),enabled:e!==void 0&&t,refetchInterval:s(5e3),refetchIntervalInBackground:!1})}function cr(e,t){return o({queryKey:[`session-env`,e],queryFn:()=>l(`GET`,`/api/sessions/${e}/env`),enabled:e!==void 0&&t,refetchInterval:s(5e3),refetchIntervalInBackground:!1})}function lr(){let e=a();return i({mutationFn:e=>l(`DELETE`,`/api/sessions/${e}/env`),onSuccess:(t,n)=>{e.setQueryData([`session-env`,n],{vars:[]})}})}var ur=_(`pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),dr=u(`puddle.profile-id`);function fr(){let e=(0,v.useSyncExternalStore)(dr.subscribe,dr.get);return e!==null&&/^[0-9a-f]{10}$/.test(e)?e:null}function pr(e){dr.set(e)}function mr({id:e,value:t,onValueChange:n,onChoose:r,hints:i,placeholder:a,className:o,hintsClassName:s,autoFocus:c}){let[l,u]=(0,v.useState)(!1),[d,f]=(0,v.useState)(0),p=e=>{n(e.value),r?.(e),u(!1)};return(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(un,{id:e,value:t,onChange:e=>{n(e.target.value),u(!0),f(0)},onFocus:()=>u(!0),onBlur:()=>u(!1),onKeyDown:e=>{if(!(!l||i.length===0))if(e.key===`ArrowDown`)e.preventDefault(),f(e=>(e+1)%i.length);else if(e.key===`ArrowUp`)e.preventDefault(),f(e=>(e-1+i.length)%i.length);else if(e.key===`Enter`||e.key===`Tab`){let t=i[d]??i[0];t&&(e.preventDefault(),p(t))}else e.key===`Escape`&&(e.stopPropagation(),u(!1))},placeholder:a,className:o,autoComplete:`off`,spellCheck:!1,autoFocus:c}),l&&i.length>0&&(0,Q.jsx)(`ul`,{className:g(`absolute top-full z-10 mt-1 max-h-56 overflow-y-auto rounded-md bg-elevated p-1 shadow-xl`,s??`w-full`),children:i.map((e,t)=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,onMouseDown:t=>{t.preventDefault(),p(e)},onMouseEnter:()=>f(t),className:g(`relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-fg outline-none transition-colors`,`data-[selected=true]:bg-action data-[selected=true]:text-action-ink data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50`,`w-full font-mono text-xs`),"data-selected":t===d,children:[(0,Q.jsx)(`span`,{className:`truncate`,children:e.label??e.value}),e.badge&&(0,Q.jsx)(`span`,{className:`ml-auto shrink-0 text-2xs opacity-70`,children:e.badge})]})},e.value))})]})}var hr=(0,v.lazy)(()=>c(()=>import(`./Terminal-DA8zjtmU.js`).then(e=>({default:e.Terminal})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))),gr=null;async function _r(){gr=(await c(()=>import(`./Terminal-DA8zjtmU.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13]))).Terminal}function vr(e){return gr?(0,Q.jsx)(gr,{...e}):(0,Q.jsx)(v.Suspense,{fallback:(0,Q.jsx)(`div`,{className:`size-full bg-ground`}),children:(0,Q.jsx)(hr,{...e})})}export{sr as $,Gn as A,Xn as B,Qn as C,zn as D,kn as E,ir as F,On as G,gn as H,Ln as I,Dn as J,rr as K,In as L,Hn as M,er as N,Zn as O,Rn as P,cr as Q,qn as R,Yn as S,Bn as T,Sn as U,_n as V,xn as W,Jn as X,bn as Y,$n as Z,Tn as _,pr as a,on as at,Kn as b,ar as c,sn as ct,yn as d,rn as dt,Cn as et,vn as f,tn as ft,lr as g,tr as h,dr as i,dn as it,Mn as j,An as k,Nn as l,nn as lt,wn as m,It as mt,_r as n,hn as nt,fr as o,ln as ot,Pn as p,zt as pt,En as q,mr as r,un as rt,ur as s,cn as st,vr as t,nr as tt,or as u,an as ut,Vn as v,jn as w,Un as x,Fn as y,Wn as z};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n,s as r,t as i}from"./buffer-store-zsL8CNKc.js";var a=e(t(),1);function o({buffers:e}){let t=(0,a.useRef)(new Set);return(0,a.useEffect)(()=>{let a=new Set(e.map(e=>i(e.session,e.path))),o=t.current;for(let e of a)o.has(e)||(r(e),o.add(e));for(let e of[...o])a.has(e)||(n(e),o.delete(e))},[e]),(0,a.useEffect)(()=>()=>{for(let e of t.current)n(e);t.current.clear()},[]),null}export{o as ModelRefcount};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{a as n,s as r,t as i}from"./buffer-store-BHJ82Nh3.js";var a=e(t(),1);function o({buffers:e}){let t=(0,a.useRef)(new Set);return(0,a.useEffect)(()=>{let a=new Set(e.map(e=>i(e.session,e.path))),o=t.current;for(let e of a)o.has(e)||(r(e),o.add(e));for(let e of[...o])a.has(e)||(n(e),o.delete(e))},[e]),(0,a.useEffect)(()=>()=>{for(let e of t.current)n(e);t.current.clear()},[]),null}export{o as ModelRefcount};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{_ as r,b as i,c as a,g as o,i as s,n as c,o as l,p as u,r as d,t as ee,v as te,y as f}from"./editor-tabs-D0_DZriG.js";import{r as p,t as m,x as ne}from"./api-Bh5IJ30S.js";import{t as re}from"./createLucideIcon-DyMAgLa3.js";import{g as h,h as g,k as _,m as v}from"./index-oAv85qtL.js";import{i as y,r as ie}from"./editor.api2-4X9Vh9Zw.js";import{a as b,c as ae,d as x,f as oe,i as se,l as ce,n as le,o as ue,r as de,s as fe,t as pe,u as S}from"./buffer-store-zsL8CNKc.js";import{a as me,c as he,i as ge,l as _e,n as ve,o as ye,r as be,s as xe}from"./editor-sync-F3Wyveaa.js";import{r as Se}from"./buffer-logic-BrpRsL1b.js";var C=re(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),w=e(t(),1);function T(e){return!e}function Ce(e){let t=e.split(`+`),n=t.pop()??``,r=0;for(let e of t)e===`meta`?r|=y.CtrlCmd:e===`ctrl`?r|=y.WinCtrl:e===`alt`?r|=y.Alt:e===`shift`&&(r|=y.Shift);let i=ie[/^Key[A-Z]$/.test(n)?`Key${n.slice(3)}`:/^Digit[0-9]$/.test(n)?`Digit${n.slice(5)}`:n];return typeof i==`number`?r|i:null}function E(e,t){let n=Ce(_(`editor.save`));n!==null&&e.addCommand(n,()=>t.onSave());let r=Ce(_(`editor.wordWrap`));e.addAction({id:`puddle.toggleWordWrap`,label:`Toggle Word Wrap`,keybindings:r===null?[]:[r],run:()=>g({editorWordWrap:T(v().editorWordWrap)})})}function we(e,t,n){let r=pe(e,t),a=i(e,t),o=te(e),[s,c]=(0,w.useState)(null),[l,u]=(0,w.useState)(!1),d=(0,w.useRef)(!1),ee=(0,w.useRef)(null),f=(0,w.useRef)(null),p=(0,w.useRef)(n);p.current=n;let re=(0,w.useRef)(!1),h=(0,w.useCallback)((e,t)=>{f.current?.cancel(),re.current=!0;try{ue(r,e,t)}finally{re.current=!1}},[r]),g=(0,w.useSyncExternalStore)((0,w.useCallback)(e=>ce(r,e),[r]),()=>de(r)),_=(0,w.useSyncExternalStore)((0,w.useCallback)(e=>ye(r,e),[r]),()=>me(r));(0,w.useEffect)(()=>{let n=a.data;if(!n||n.binary||n.content===null||d.current)return;d.current=!0;let i=ae(r)!==void 0,o=le(e,t,n.content,n.mtime_ms);c(o),!i&&_e(e,t).then(e=>{e&&(e.base_mtime_ms===n.mtime_ms?Se(o,e.content)&&u(!0):ne(`This file has an unsaved draft from an earlier version.`,{description:`The file changed on disk since the draft was saved.`,duration:12e3,action:{label:`Restore draft`,onClick:()=>{Se(o,e.content)&&u(!0)}}}))})},[a.data,r,e,t]),(0,w.useEffect)(()=>{if(!s)return;let n=he(e,t);f.current=n;let i=s.onDidChangeContent(()=>{re.current||(n(s.getValue(),ae(r)??0),ve(e,t))});return()=>{n.flush(),i.dispose(),f.current=null}},[s,r,e,t]),(0,w.useEffect)(()=>{!s||!_.savedElsewhere||de(r)||a.refetch().then(e=>{de(r)||(e.data&&e.data.content!==null&&h(e.data.content,e.data.mtime_ms),ge(r))})},[_.savedElsewhere,s,r]),(0,w.useEffect)(()=>{let e=a.data;!s||!e||e.content===null||!de(r)&&e.mtime_ms!==ae(r)&&h(e.content,e.mtime_ms)},[a.data,s,r]);let v=(0,w.useCallback)((n,i)=>{se(r,n,i),f.current?.cancel(),xe(e,t),be(e,t,i),u(!1)},[r,e,t]),y=(0,w.useCallback)(()=>{a.refetch().then(n=>{n.data&&n.data.content!==null&&h(n.data.content,n.data.mtime_ms),xe(e,t),u(!1)})},[r,e,t,h]),ie=(0,w.useCallback)((e,n)=>{o.mutate({path:t,content:e},{onSuccess:e=>v(n,e.mtime_ms),onError:e=>ne.error(e instanceof Error?e.message:`Overwrite failed`)})},[o,t,v]),b=(0,w.useCallback)(()=>{if(!s||!de(r))return;let e=s.getValue(),n=s.getAlternativeVersionId();o.mutate({path:t,content:e,expected_mtime_ms:ae(r)},{onSuccess:e=>v(n,e.mtime_ms),onError:t=>{t instanceof m&&t.status===409&&t.code===`stale_file`?ne.error(`File changed on disk (probably the agent)`,{duration:1/0,action:{label:`Reload`,onClick:()=>y()},cancel:{label:`Overwrite`,onClick:()=>ie(e,n)}}):ne.error(t instanceof Error?t.message:`Save failed`)}})},[s,r,o,t,v,y,ie]),x=(0,w.useRef)(b);x.current=b;let oe=(0,w.useCallback)(()=>{let n=ee.current,r=p.current;!n||!r||r.session!==e||r.path!==t||(n.revealLineInCenter(r.line),n.setPosition({lineNumber:r.line,column:r.column??1}),n.focus())},[e,t]),fe=(0,w.useCallback)(e=>{ee.current=e,E(e,{onSave:()=>x.current()}),oe()},[oe]);(0,w.useEffect)(()=>{oe()},[n,s,oe]);let S=(0,w.useCallback)(()=>{y()},[y]),C,T=null;a.data?.binary?C=`binary`:a.error?a.error instanceof m&&a.error.status===413?C=`too-large`:(C=`error`,T=a.error instanceof Error?a.error.message:`Failed to load file`):C=s?`ready`:`loading`;let Ce=g&&_.savedElsewhere?`saved-elsewhere`:g&&_.dirtyElsewhere?`dirty-elsewhere`:null;return{status:C,errorMessage:T,model:s,dirty:g,restoredNotice:l,discardRestore:S,peerBadge:Ce,save:b,onMount:fe}}var D=n();function O({message:e,session:t,path:n,download:r}){return(0,D.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 bg-ground text-sm text-fg-muted`,children:[(0,D.jsx)(`span`,{children:e}),r&&(0,D.jsxs)(`button`,{type:`button`,onClick:()=>void u(t,n).catch(e=>ne.error(e instanceof Error?e.message:`Download failed`)),className:`flex items-center gap-1.5 text-fg-secondary transition-colors hover:text-fg`,children:[(0,D.jsx)(C,{className:`size-4`}),`Download`]})]})}function Te({session:e,path:t,reveal:n}){let r=h(),i=we(e,t,n),a=(0,w.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);if(i.status===`binary`)return(0,D.jsx)(O,{message:`Binary file — use Download`,session:e,path:t,download:!0});if(i.status===`too-large`)return(0,D.jsx)(O,{message:`File too large to edit — use Download`,session:e,path:t,download:!0});if(i.status===`error`)return(0,D.jsx)(O,{message:i.errorMessage??`Failed to load file`,session:e,path:t});let o=i.peerBadge===`saved-elsewhere`?`Saved in another window`:i.peerBadge===`dirty-elsewhere`?`Also being edited in another window`:null;return(0,D.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[i.restoredNotice&&(0,D.jsxs)(`div`,{className:`flex items-center gap-3 bg-elevated px-3 py-1.5 text-xs text-fg-secondary`,children:[(0,D.jsx)(`span`,{children:`Restored unsaved changes`}),(0,D.jsx)(`button`,{type:`button`,onClick:i.discardRestore,className:`text-fg-muted transition-colors hover:text-fg`,children:`Discard`})]}),o&&(0,D.jsx)(`div`,{className:`bg-surface px-3 py-1 text-xs text-fg-muted`,children:o}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:i.model&&(0,D.jsx)(x,{path:i.model.uri.toString(),defaultValue:i.model.getValue(),theme:`puddle`,keepCurrentModel:!0,onMount:e=>i.onMount(e),loading:(0,D.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),options:{automaticLayout:!0,fontFamily:a,tabSize:r.editorTabSize,wordWrap:r.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}function k({children:e}){return(0,D.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-xs text-fg-muted`,children:e})}function Ee(e,t){let n=(0,w.useRef)(t);n.current=t,(0,w.useEffect)(()=>(fe(e),()=>{n.current?.(),b(e)}),[e])}function De(e,t,n,r){let i=r.split(`/`).map(encodeURIComponent).join(`/`);return`${e}://${encodeURIComponent(t)}/${encodeURIComponent(n)}/${i}`}function A({session:e,refName:t,path:n,content:r}){let i=(0,w.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,D.jsx)(x,{path:De(`puddle-view`,e,t,n),defaultValue:r,theme:S,loading:(0,D.jsx)(k,{children:`…`}),options:{readOnly:!0,automaticLayout:!0,fontFamily:i,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function j({session:e,against:t,path:n}){let i=r(e,t,n);return i.isPending?(0,D.jsx)(k,{children:`…`}):i.error?(0,D.jsx)(k,{children:i.error instanceof Error?i.error.message:`Failed to load`}):i.data.binary?(0,D.jsx)(k,{children:`Binary file — deleted`}):(0,D.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,D.jsx)(`div`,{className:`bg-surface px-4 py-1 text-xs text-fg-muted`,children:`Deleted`}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,D.jsx)(A,{session:e,refName:t,path:n,content:i.data.content??``})})]})}function Oe({session:e,against:t,path:n,basePath:i}){let a=h(),o=we(e,n,null),s=r(e,t,i),c=(0,w.useRef)(null);Ee(pe(e,n),()=>{let e=c.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),c.current=null});let l=(0,w.useRef)(o.save);l.current=o.save;let u=(0,w.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),d=s.error instanceof m&&s.error.status===404;return o.status===`binary`||s.data?.binary?(0,D.jsx)(k,{children:`Binary file`}):o.status===`too-large`?(0,D.jsx)(k,{children:`File too large to show`}):o.status===`error`?(0,D.jsx)(k,{children:o.errorMessage??`Failed to load file`}):d?(0,D.jsx)(Te,{session:e,path:n,reveal:null}):s.isPending||!o.model?(0,D.jsx)(k,{children:`…`}):s.error?(0,D.jsx)(k,{children:s.error instanceof Error?s.error.message:`Failed to load base`}):(0,D.jsx)(oe,{modifiedModelPath:o.model.uri.toString(),originalModelPath:De(`puddle-base`,e,t,i),original:s.data.content??``,language:o.model.getLanguageId(),theme:S,keepCurrentModifiedModel:!0,loading:(0,D.jsx)(k,{children:`…`}),onMount:e=>{c.current=e,e.onDidDispose(()=>{c.current=null}),e.getModifiedEditor().addCommand(y.CtrlCmd|ie.KeyS,()=>l.current())},options:{readOnly:!1,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:u,wordWrap:a.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function ke({session:e,path:t}){return Ee(pe(e,t)),(0,D.jsx)(Te,{session:e,path:t,reveal:null})}function Ae({session:e,against:t,entry:n}){switch(n.status){case`added`:return(0,D.jsx)(ke,{session:e,path:n.path});case`deleted`:return(0,D.jsx)(j,{session:e,against:t,path:n.path});case`modified`:case`renamed`:return(0,D.jsx)(Oe,{session:e,against:t,path:n.path,basePath:n.old_path??n.path});default:return null}}function je({session:e,sha:t,path:n}){let i=r(e,t,n);return i.isPending?(0,D.jsx)(k,{children:`…`}):i.error?(0,D.jsx)(k,{children:i.error instanceof Error?i.error.message:`Failed to load file`}):i.data.binary?(0,D.jsx)(k,{children:`Binary file`}):(0,D.jsx)(A,{session:e,refName:t,path:n,content:i.data.content??``})}function Me({session:e,originalRef:t,originalPath:n,originalContent:r,modifiedRef:i,modifiedPath:a,modifiedContent:o}){let s=(0,w.useRef)(null),c=(0,w.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,w.useEffect)(()=>()=>{let e=s.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),t?.modified.dispose(),s.current=null},[]),(0,D.jsx)(oe,{originalModelPath:De(`puddle-hist-orig`,e,t,n),modifiedModelPath:De(`puddle-hist-mod`,e,i,a),original:r,modified:o,theme:S,keepCurrentOriginalModel:!0,keepCurrentModifiedModel:!0,loading:(0,D.jsx)(k,{children:`…`}),onMount:e=>{s.current=e,e.onDidDispose(()=>{s.current=null})},options:{readOnly:!0,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:c,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function Ne({session:e,sha:t,path:n,basePath:i}){let a=r(e,`${t}^`,i),o=r(e,t,n);return a.error instanceof m&&a.error.status===404?(0,D.jsx)(je,{session:e,sha:t,path:n}):a.isPending||o.isPending?(0,D.jsx)(k,{children:`…`}):a.error?(0,D.jsx)(k,{children:a.error instanceof Error?a.error.message:`Failed to load original`}):o.error?(0,D.jsx)(k,{children:o.error instanceof Error?o.error.message:`Failed to load file`}):a.data.binary||o.data.binary?(0,D.jsx)(k,{children:`Binary file`}):(0,D.jsx)(Me,{session:e,originalRef:`${t}^`,originalPath:i,originalContent:a.data.content??``,modifiedRef:t,modifiedPath:n,modifiedContent:o.data.content??``})}function Pe({session:e,sha:t,entry:n,isRootCommit:r}){switch(a(n.status,r)){case`added`:return(0,D.jsx)(je,{session:e,sha:t,path:n.path});case`deleted`:return(0,D.jsx)(j,{session:e,against:`${t}^`,path:n.path});case`modified`:case`renamed`:return(0,D.jsx)(Ne,{session:e,sha:t,path:n.path,basePath:n.old_path??n.path});default:return null}}function Fe({session:e,sha:t,path:n}){let r=o(e,t);if(r.isPending)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading commit…`});if(r.error)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:r.error instanceof Error?r.error.message:`Failed to load commit`});let i=r.data.files.find(e=>e.path===n);return i?(0,D.jsx)(`div`,{className:`h-full`,children:(0,D.jsx)(Pe,{session:e,sha:t,entry:i,isRootCommit:r.data.parents.length===0})}):(0,D.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[(0,D.jsx)(`span`,{className:`font-mono`,children:n}),` is not part of `,t.slice(0,7),`.`]})}function Ie({session:e,path:t}){let n=f(e);if(n.isPending)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading diff…`});if(n.error)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:n.error instanceof Error?n.error.message:`Failed to load diff`});let r=n.data.entries.find(e=>e.path===t);return r?(0,D.jsx)(`div`,{className:`h-full`,children:(0,D.jsx)(Ae,{session:e,against:n.data.against,entry:r})}):(0,D.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[`No changes to `,(0,D.jsx)(`span`,{className:`mx-1 font-mono`,children:t}),` against the base.`]})}function Le(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Re(e){if(Array.isArray(e))return e}function ze(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Be(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./react-CZI7_Jkm.js";import{t as n}from"./jsx-runtime-ffCh33zF.js";import{_ as r,b as i,c as a,g as o,i as s,n as c,o as l,p as u,r as d,t as ee,v as te,y as f}from"./editor-tabs-D0_DZriG.js";import{r as p,t as m,x as ne}from"./api-Bh5IJ30S.js";import{t as re}from"./createLucideIcon-DyMAgLa3.js";import{g as h,h as g,k as _,m as v}from"./index-RvCLpi9M.js";import{i as y,r as ie}from"./editor.api2-4X9Vh9Zw.js";import{a as b,c as ae,d as x,f as oe,i as se,l as ce,n as le,o as ue,r as de,s as fe,t as pe,u as S}from"./buffer-store-BHJ82Nh3.js";import{a as me,c as he,i as ge,l as _e,n as ve,o as ye,r as be,s as xe}from"./editor-sync-F3Wyveaa.js";import{r as Se}from"./buffer-logic-BrpRsL1b.js";var C=re(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),w=e(t(),1);function T(e){return!e}function Ce(e){let t=e.split(`+`),n=t.pop()??``,r=0;for(let e of t)e===`meta`?r|=y.CtrlCmd:e===`ctrl`?r|=y.WinCtrl:e===`alt`?r|=y.Alt:e===`shift`&&(r|=y.Shift);let i=ie[/^Key[A-Z]$/.test(n)?`Key${n.slice(3)}`:/^Digit[0-9]$/.test(n)?`Digit${n.slice(5)}`:n];return typeof i==`number`?r|i:null}function E(e,t){let n=Ce(_(`editor.save`));n!==null&&e.addCommand(n,()=>t.onSave());let r=Ce(_(`editor.wordWrap`));e.addAction({id:`puddle.toggleWordWrap`,label:`Toggle Word Wrap`,keybindings:r===null?[]:[r],run:()=>g({editorWordWrap:T(v().editorWordWrap)})})}function we(e,t,n){let r=pe(e,t),a=i(e,t),o=te(e),[s,c]=(0,w.useState)(null),[l,u]=(0,w.useState)(!1),d=(0,w.useRef)(!1),ee=(0,w.useRef)(null),f=(0,w.useRef)(null),p=(0,w.useRef)(n);p.current=n;let re=(0,w.useRef)(!1),h=(0,w.useCallback)((e,t)=>{f.current?.cancel(),re.current=!0;try{ue(r,e,t)}finally{re.current=!1}},[r]),g=(0,w.useSyncExternalStore)((0,w.useCallback)(e=>ce(r,e),[r]),()=>de(r)),_=(0,w.useSyncExternalStore)((0,w.useCallback)(e=>ye(r,e),[r]),()=>me(r));(0,w.useEffect)(()=>{let n=a.data;if(!n||n.binary||n.content===null||d.current)return;d.current=!0;let i=ae(r)!==void 0,o=le(e,t,n.content,n.mtime_ms);c(o),!i&&_e(e,t).then(e=>{e&&(e.base_mtime_ms===n.mtime_ms?Se(o,e.content)&&u(!0):ne(`This file has an unsaved draft from an earlier version.`,{description:`The file changed on disk since the draft was saved.`,duration:12e3,action:{label:`Restore draft`,onClick:()=>{Se(o,e.content)&&u(!0)}}}))})},[a.data,r,e,t]),(0,w.useEffect)(()=>{if(!s)return;let n=he(e,t);f.current=n;let i=s.onDidChangeContent(()=>{re.current||(n(s.getValue(),ae(r)??0),ve(e,t))});return()=>{n.flush(),i.dispose(),f.current=null}},[s,r,e,t]),(0,w.useEffect)(()=>{!s||!_.savedElsewhere||de(r)||a.refetch().then(e=>{de(r)||(e.data&&e.data.content!==null&&h(e.data.content,e.data.mtime_ms),ge(r))})},[_.savedElsewhere,s,r]),(0,w.useEffect)(()=>{let e=a.data;!s||!e||e.content===null||!de(r)&&e.mtime_ms!==ae(r)&&h(e.content,e.mtime_ms)},[a.data,s,r]);let v=(0,w.useCallback)((n,i)=>{se(r,n,i),f.current?.cancel(),xe(e,t),be(e,t,i),u(!1)},[r,e,t]),y=(0,w.useCallback)(()=>{a.refetch().then(n=>{n.data&&n.data.content!==null&&h(n.data.content,n.data.mtime_ms),xe(e,t),u(!1)})},[r,e,t,h]),ie=(0,w.useCallback)((e,n)=>{o.mutate({path:t,content:e},{onSuccess:e=>v(n,e.mtime_ms),onError:e=>ne.error(e instanceof Error?e.message:`Overwrite failed`)})},[o,t,v]),b=(0,w.useCallback)(()=>{if(!s||!de(r))return;let e=s.getValue(),n=s.getAlternativeVersionId();o.mutate({path:t,content:e,expected_mtime_ms:ae(r)},{onSuccess:e=>v(n,e.mtime_ms),onError:t=>{t instanceof m&&t.status===409&&t.code===`stale_file`?ne.error(`File changed on disk (probably the agent)`,{duration:1/0,action:{label:`Reload`,onClick:()=>y()},cancel:{label:`Overwrite`,onClick:()=>ie(e,n)}}):ne.error(t instanceof Error?t.message:`Save failed`)}})},[s,r,o,t,v,y,ie]),x=(0,w.useRef)(b);x.current=b;let oe=(0,w.useCallback)(()=>{let n=ee.current,r=p.current;!n||!r||r.session!==e||r.path!==t||(n.revealLineInCenter(r.line),n.setPosition({lineNumber:r.line,column:r.column??1}),n.focus())},[e,t]),fe=(0,w.useCallback)(e=>{ee.current=e,E(e,{onSave:()=>x.current()}),oe()},[oe]);(0,w.useEffect)(()=>{oe()},[n,s,oe]);let S=(0,w.useCallback)(()=>{y()},[y]),C,T=null;a.data?.binary?C=`binary`:a.error?a.error instanceof m&&a.error.status===413?C=`too-large`:(C=`error`,T=a.error instanceof Error?a.error.message:`Failed to load file`):C=s?`ready`:`loading`;let Ce=g&&_.savedElsewhere?`saved-elsewhere`:g&&_.dirtyElsewhere?`dirty-elsewhere`:null;return{status:C,errorMessage:T,model:s,dirty:g,restoredNotice:l,discardRestore:S,peerBadge:Ce,save:b,onMount:fe}}var D=n();function O({message:e,session:t,path:n,download:r}){return(0,D.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 bg-ground text-sm text-fg-muted`,children:[(0,D.jsx)(`span`,{children:e}),r&&(0,D.jsxs)(`button`,{type:`button`,onClick:()=>void u(t,n).catch(e=>ne.error(e instanceof Error?e.message:`Download failed`)),className:`flex items-center gap-1.5 text-fg-secondary transition-colors hover:text-fg`,children:[(0,D.jsx)(C,{className:`size-4`}),`Download`]})]})}function Te({session:e,path:t,reveal:n}){let r=h(),i=we(e,t,n),a=(0,w.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);if(i.status===`binary`)return(0,D.jsx)(O,{message:`Binary file — use Download`,session:e,path:t,download:!0});if(i.status===`too-large`)return(0,D.jsx)(O,{message:`File too large to edit — use Download`,session:e,path:t,download:!0});if(i.status===`error`)return(0,D.jsx)(O,{message:i.errorMessage??`Failed to load file`,session:e,path:t});let o=i.peerBadge===`saved-elsewhere`?`Saved in another window`:i.peerBadge===`dirty-elsewhere`?`Also being edited in another window`:null;return(0,D.jsxs)(`div`,{className:`flex h-full flex-col bg-ground`,children:[i.restoredNotice&&(0,D.jsxs)(`div`,{className:`flex items-center gap-3 bg-elevated px-3 py-1.5 text-xs text-fg-secondary`,children:[(0,D.jsx)(`span`,{children:`Restored unsaved changes`}),(0,D.jsx)(`button`,{type:`button`,onClick:i.discardRestore,className:`text-fg-muted transition-colors hover:text-fg`,children:`Discard`})]}),o&&(0,D.jsx)(`div`,{className:`bg-surface px-3 py-1 text-xs text-fg-muted`,children:o}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:i.model&&(0,D.jsx)(x,{path:i.model.uri.toString(),defaultValue:i.model.getValue(),theme:`puddle`,keepCurrentModel:!0,onMount:e=>i.onMount(e),loading:(0,D.jsx)(`div`,{className:`p-3 text-xs text-fg-muted`,children:`…`}),options:{automaticLayout:!0,fontFamily:a,tabSize:r.editorTabSize,wordWrap:r.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})})]})}function k({children:e}){return(0,D.jsx)(`div`,{className:`flex h-full items-center justify-center px-4 text-xs text-fg-muted`,children:e})}function Ee(e,t){let n=(0,w.useRef)(t);n.current=t,(0,w.useEffect)(()=>(fe(e),()=>{n.current?.(),b(e)}),[e])}function De(e,t,n,r){let i=r.split(`/`).map(encodeURIComponent).join(`/`);return`${e}://${encodeURIComponent(t)}/${encodeURIComponent(n)}/${i}`}function A({session:e,refName:t,path:n,content:r}){let i=(0,w.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,D.jsx)(x,{path:De(`puddle-view`,e,t,n),defaultValue:r,theme:S,loading:(0,D.jsx)(k,{children:`…`}),options:{readOnly:!0,automaticLayout:!0,fontFamily:i,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function j({session:e,against:t,path:n}){let i=r(e,t,n);return i.isPending?(0,D.jsx)(k,{children:`…`}):i.error?(0,D.jsx)(k,{children:i.error instanceof Error?i.error.message:`Failed to load`}):i.data.binary?(0,D.jsx)(k,{children:`Binary file — deleted`}):(0,D.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,D.jsx)(`div`,{className:`bg-surface px-4 py-1 text-xs text-fg-muted`,children:`Deleted`}),(0,D.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,D.jsx)(A,{session:e,refName:t,path:n,content:i.data.content??``})})]})}function Oe({session:e,against:t,path:n,basePath:i}){let a=h(),o=we(e,n,null),s=r(e,t,i),c=(0,w.useRef)(null);Ee(pe(e,n),()=>{let e=c.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),c.current=null});let l=(0,w.useRef)(o.save);l.current=o.save;let u=(0,w.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]),d=s.error instanceof m&&s.error.status===404;return o.status===`binary`||s.data?.binary?(0,D.jsx)(k,{children:`Binary file`}):o.status===`too-large`?(0,D.jsx)(k,{children:`File too large to show`}):o.status===`error`?(0,D.jsx)(k,{children:o.errorMessage??`Failed to load file`}):d?(0,D.jsx)(Te,{session:e,path:n,reveal:null}):s.isPending||!o.model?(0,D.jsx)(k,{children:`…`}):s.error?(0,D.jsx)(k,{children:s.error instanceof Error?s.error.message:`Failed to load base`}):(0,D.jsx)(oe,{modifiedModelPath:o.model.uri.toString(),originalModelPath:De(`puddle-base`,e,t,i),original:s.data.content??``,language:o.model.getLanguageId(),theme:S,keepCurrentModifiedModel:!0,loading:(0,D.jsx)(k,{children:`…`}),onMount:e=>{c.current=e,e.onDidDispose(()=>{c.current=null}),e.getModifiedEditor().addCommand(y.CtrlCmd|ie.KeyS,()=>l.current())},options:{readOnly:!1,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:u,wordWrap:a.editorWordWrap?`on`:`off`,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function ke({session:e,path:t}){return Ee(pe(e,t)),(0,D.jsx)(Te,{session:e,path:t,reveal:null})}function Ae({session:e,against:t,entry:n}){switch(n.status){case`added`:return(0,D.jsx)(ke,{session:e,path:n.path});case`deleted`:return(0,D.jsx)(j,{session:e,against:t,path:n.path});case`modified`:case`renamed`:return(0,D.jsx)(Oe,{session:e,against:t,path:n.path,basePath:n.old_path??n.path});default:return null}}function je({session:e,sha:t,path:n}){let i=r(e,t,n);return i.isPending?(0,D.jsx)(k,{children:`…`}):i.error?(0,D.jsx)(k,{children:i.error instanceof Error?i.error.message:`Failed to load file`}):i.data.binary?(0,D.jsx)(k,{children:`Binary file`}):(0,D.jsx)(A,{session:e,refName:t,path:n,content:i.data.content??``})}function Me({session:e,originalRef:t,originalPath:n,originalContent:r,modifiedRef:i,modifiedPath:a,modifiedContent:o}){let s=(0,w.useRef)(null),c=(0,w.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue(`--font-mono`).trim()||void 0,[]);return(0,w.useEffect)(()=>()=>{let e=s.current;if(!e)return;let t=e.getModel();e.setModel(null),t?.original.dispose(),t?.modified.dispose(),s.current=null},[]),(0,D.jsx)(oe,{originalModelPath:De(`puddle-hist-orig`,e,t,n),modifiedModelPath:De(`puddle-hist-mod`,e,i,a),original:r,modified:o,theme:S,keepCurrentOriginalModel:!0,keepCurrentModifiedModel:!0,loading:(0,D.jsx)(k,{children:`…`}),onMount:e=>{s.current=e,e.onDidDispose(()=>{s.current=null})},options:{readOnly:!0,originalEditable:!1,renderSideBySide:!0,automaticLayout:!0,fontFamily:c,minimap:{enabled:!1},fixedOverflowWidgets:!0,scrollBeyondLastLine:!1}})}function Ne({session:e,sha:t,path:n,basePath:i}){let a=r(e,`${t}^`,i),o=r(e,t,n);return a.error instanceof m&&a.error.status===404?(0,D.jsx)(je,{session:e,sha:t,path:n}):a.isPending||o.isPending?(0,D.jsx)(k,{children:`…`}):a.error?(0,D.jsx)(k,{children:a.error instanceof Error?a.error.message:`Failed to load original`}):o.error?(0,D.jsx)(k,{children:o.error instanceof Error?o.error.message:`Failed to load file`}):a.data.binary||o.data.binary?(0,D.jsx)(k,{children:`Binary file`}):(0,D.jsx)(Me,{session:e,originalRef:`${t}^`,originalPath:i,originalContent:a.data.content??``,modifiedRef:t,modifiedPath:n,modifiedContent:o.data.content??``})}function Pe({session:e,sha:t,entry:n,isRootCommit:r}){switch(a(n.status,r)){case`added`:return(0,D.jsx)(je,{session:e,sha:t,path:n.path});case`deleted`:return(0,D.jsx)(j,{session:e,against:`${t}^`,path:n.path});case`modified`:case`renamed`:return(0,D.jsx)(Ne,{session:e,sha:t,path:n.path,basePath:n.old_path??n.path});default:return null}}function Fe({session:e,sha:t,path:n}){let r=o(e,t);if(r.isPending)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading commit…`});if(r.error)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:r.error instanceof Error?r.error.message:`Failed to load commit`});let i=r.data.files.find(e=>e.path===n);return i?(0,D.jsx)(`div`,{className:`h-full`,children:(0,D.jsx)(Pe,{session:e,sha:t,entry:i,isRootCommit:r.data.parents.length===0})}):(0,D.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[(0,D.jsx)(`span`,{className:`font-mono`,children:n}),` is not part of `,t.slice(0,7),`.`]})}function Ie({session:e,path:t}){let n=f(e);if(n.isPending)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:`Loading diff…`});if(n.error)return(0,D.jsx)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:n.error instanceof Error?n.error.message:`Failed to load diff`});let r=n.data.entries.find(e=>e.path===t);return r?(0,D.jsx)(`div`,{className:`h-full`,children:(0,D.jsx)(Ae,{session:e,against:n.data.against,entry:r})}):(0,D.jsxs)(`div`,{className:`flex h-full items-center justify-center px-4 text-center text-xs text-fg-muted`,children:[`No changes to `,(0,D.jsx)(`span`,{className:`mx-1 font-mono`,children:t}),` against the base.`]})}function Le(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Re(e){if(Array.isArray(e))return e}function ze(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function Be(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ve(e,t){return Re(e)||ze(e,t)||M(e,t)||Be()}function M(e,t){if(e){if(typeof e==`string`)return Le(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Le(e,t):void 0}}var He=Object.entries,Ue=Object.setPrototypeOf,We=Object.isFrozen,Ge=Object.getPrototypeOf,Ke=Object.getOwnPropertyDescriptor,N=Object.freeze,P=Object.seal,qe=Object.create,Je=typeof Reflect<`u`&&Reflect,Ye=Je.apply,Xe=Je.construct;N||=function(e){return e},P||=function(e){return e},Ye||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},Xe||=function(e){return new e(...[...arguments].slice(1))};var Ze=R(Array.prototype.forEach),Qe=R(Array.prototype.lastIndexOf),$e=R(Array.prototype.pop),et=R(Array.prototype.push),tt=R(Array.prototype.splice),nt=Array.isArray,rt=R(String.prototype.toLowerCase),it=R(String.prototype.toString),at=R(String.prototype.match),ot=R(String.prototype.replace),st=R(String.prototype.indexOf),ct=R(String.prototype.trim),F=R(Number.prototype.toString),lt=R(Boolean.prototype.toString),ut=typeof BigInt>`u`?null:R(BigInt.prototype.toString),dt=typeof Symbol>`u`?null:R(Symbol.prototype.toString),I=R(Object.prototype.hasOwnProperty),ft=R(Object.prototype.toString),L=R(RegExp.prototype.test),pt=mt(TypeError);function R(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Ye(e,t,n)}}function mt(e){return function(){return Xe(e,[...arguments])}}function z(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:rt;if(Ue&&Ue(e,null),!nt(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(We(t)||(t[r]=e),i=e)}e[i]=!0}return e}function ht(e){for(let t=0;t<e.length;t++)I(e,t)||(e[t]=null);return e}function B(e){let t=qe(null);for(let r of He(e)){var n=Ve(r,2);let i=n[0],a=n[1];I(e,i)&&(nt(a)?t[i]=ht(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=B(a):t[i]=a)}return t}function gt(e){switch(typeof e){case`string`:return e;case`number`:return F(e);case`boolean`:return lt(e);case`bigint`:return ut?ut(e):`0`;case`symbol`:return dt?dt(e):`Symbol()`;case`undefined`:return ft(e);case`function`:case`object`:{if(e===null)return ft(e);let t=e,n=V(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:ft(e)}return ft(e)}default:return ft(e)}}function V(e,t){for(;e!==null;){let n=Ke(e,t);if(n){if(n.get)return R(n.get);if(typeof n.value==`function`)return R(n.value)}e=Ge(e)}function n(){return null}return n}function _t(e){try{return L(e,``),!0}catch{return!1}}var vt=N(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),yt=N(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),bt=N([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),xt=N([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),St=N(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Ct=N([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),wt=N([`#text`]),Tt=N(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Et=N(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Dt=N(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Ot=N([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),kt=P(/{{[\w\W]*|^[\w\W]*}}/g),At=P(/<%[\w\W]*|^[\w\W]*%>/g),jt=P(/\${[\w\W]*/g),Mt=P(/^data-[\-\w.\u00B7-\uFFFF]+$/),Nt=P(/^aria-[\-\w]+$/),Pt=P(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Ft=P(/^(?:\w+script|data):/i),It=P(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Lt=P(/^html$/i),Rt=P(/^[a-z][.\w]*(-[.\w]+)+$/i),zt=P(/<[/\w!]/g),Bt=P(/<[/\w]/g),Vt=P(/<\/no(script|embed|frames)/i),Ht=P(/\/>/i),H={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Ut=function(){return typeof window>`u`?null:window},Wt=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},Gt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Kt=function(e,t,n,r){return I(e,t)&&nt(e[t])?z(r.base?B(r.base):{},e[t],r.transform):n};function qt(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Ut(),t=e=>qt(e);if(t.version=`3.4.12`,t.removed=[],!e||!e.document||e.document.nodeType!==H.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,ee=V(d,`cloneNode`),te=V(d,`remove`),f=V(d,`nextSibling`),p=V(d,`childNodes`),m=V(d,`parentNode`),ne=V(d,`shadowRoot`),re=V(d,`attributes`),h=o&&o.prototype?V(o.prototype,`nodeType`):null,g=o&&o.prototype?V(o.prototype,`nodeName`):null;if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let _,v=``,y,ie=!1,b=0,ae=function(){if(b>0)throw pt(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},x=function(e){ae(),b++;try{return _.createHTML(e)}finally{b--}},oe=function(e){ae(),b++;try{return _.createScriptURL(e)}finally{b--}},se=function(){return ie||=(y=Wt(u,i),!0),y},ce=n,le=ce.implementation,ue=ce.createNodeIterator,de=ce.createDocumentFragment,fe=ce.getElementsByTagName,pe=r.importNode,S=Gt();t.isSupported=typeof He==`function`&&typeof m==`function`&&le&&le.createHTMLDocument!==void 0;let me=kt,he=At,ge=jt,_e=Mt,ve=Nt,ye=Ft,be=It,xe=Rt,Se=Pt,C=null,w=z({},[...vt,...yt,...bt,...St,...wt]),T=null,Ce=z({},[...Tt,...Et,...Dt,...Ot]),E=Object.seal(qe(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),we=null,D=null,O=Object.seal(qe(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Te=!0,k=!0,Ee=!1,De=!0,A=!1,j=!0,Oe=!1,ke=!1,Ae=null,je=null,Me=!1,Ne=!1,Pe=!1,Fe=!1,Ie=!0,Le=!1,Re=`user-content-`,ze=!0,Be=!1,Ve={},M=null,Ue=z({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),We=null,Ge=z({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ke=null,Je=z({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ye=`http://www.w3.org/1998/Math/MathML`,Xe=`http://www.w3.org/2000/svg`,F=`http://www.w3.org/1999/xhtml`,lt=F,ut=!1,dt=null,ft=z({},[Ye,Xe,F],it),R=N([`mi`,`mo`,`mn`,`ms`,`mtext`]),mt=z({},R),ht=N([`annotation-xml`]),Jt=z({},ht),Yt=z({},[`title`,`style`,`font`,`a`,`script`]),U=null,Xt=[`application/xhtml+xml`,`text/html`],W=null,G=null,K=n.createElement(`form`),Zt=function(e){return e instanceof RegExp||e instanceof Function},q=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(G&&G===e)return;(!e||typeof e!=`object`)&&(e={}),e=B(e),U=Xt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,W=U===`application/xhtml+xml`?it:rt,C=Kt(e,`ALLOWED_TAGS`,w,{transform:W}),T=Kt(e,`ALLOWED_ATTR`,Ce,{transform:W}),dt=Kt(e,`ALLOWED_NAMESPACES`,ft,{transform:it}),Ke=Kt(e,`ADD_URI_SAFE_ATTR`,Je,{transform:W,base:Je}),We=Kt(e,`ADD_DATA_URI_TAGS`,Ge,{transform:W,base:Ge}),M=Kt(e,`FORBID_CONTENTS`,Ue,{transform:W}),we=Kt(e,`FORBID_TAGS`,B({}),{transform:W}),D=Kt(e,`FORBID_ATTR`,B({}),{transform:W}),Ve=I(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?B(e.USE_PROFILES):e.USE_PROFILES:!1,Te=e.ALLOW_ARIA_ATTR!==!1,k=e.ALLOW_DATA_ATTR!==!1,Ee=e.ALLOW_UNKNOWN_PROTOCOLS||!1,De=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,A=e.SAFE_FOR_TEMPLATES||!1,j=e.SAFE_FOR_XML!==!1,Oe=e.WHOLE_DOCUMENT||!1,Ne=e.RETURN_DOM||!1,Pe=e.RETURN_DOM_FRAGMENT||!1,Fe=e.RETURN_TRUSTED_TYPE||!1,Me=e.FORCE_BODY||!1,Ie=e.SANITIZE_DOM!==!1,Le=e.SANITIZE_NAMED_PROPS||!1,ze=e.KEEP_CONTENT!==!1,Be=e.IN_PLACE||!1,Se=_t(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Pt,lt=typeof e.NAMESPACE==`string`?e.NAMESPACE:F,mt=I(e,`MATHML_TEXT_INTEGRATION_POINTS`)&&e.MATHML_TEXT_INTEGRATION_POINTS&&typeof e.MATHML_TEXT_INTEGRATION_POINTS==`object`?B(e.MATHML_TEXT_INTEGRATION_POINTS):z({},R),Jt=I(e,`HTML_INTEGRATION_POINTS`)&&e.HTML_INTEGRATION_POINTS&&typeof e.HTML_INTEGRATION_POINTS==`object`?B(e.HTML_INTEGRATION_POINTS):z({},ht);let t=I(e,`CUSTOM_ELEMENT_HANDLING`)&&e.CUSTOM_ELEMENT_HANDLING&&typeof e.CUSTOM_ELEMENT_HANDLING==`object`?B(e.CUSTOM_ELEMENT_HANDLING):qe(null);if(E=qe(null),I(t,`tagNameCheck`)&&Zt(t.tagNameCheck)&&(E.tagNameCheck=t.tagNameCheck),I(t,`attributeNameCheck`)&&Zt(t.attributeNameCheck)&&(E.attributeNameCheck=t.attributeNameCheck),I(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(E.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),P(E),A&&(k=!1),Pe&&(Ne=!0),Ve&&(C=z({},wt),T=qe(null),Ve.html===!0&&(z(C,vt),z(T,Tt)),Ve.svg===!0&&(z(C,yt),z(T,Et),z(T,Ot)),Ve.svgFilters===!0&&(z(C,bt),z(T,Et),z(T,Ot)),Ve.mathMl===!0&&(z(C,St),z(T,Dt),z(T,Ot))),O.tagCheck=null,O.attributeCheck=null,I(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?O.tagCheck=e.ADD_TAGS:nt(e.ADD_TAGS)&&(C===w&&(C=B(C)),z(C,e.ADD_TAGS,W))),I(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?O.attributeCheck=e.ADD_ATTR:nt(e.ADD_ATTR)&&(T===Ce&&(T=B(T)),z(T,e.ADD_ATTR,W))),I(e,`ADD_URI_SAFE_ATTR`)&&nt(e.ADD_URI_SAFE_ATTR)&&z(Ke,e.ADD_URI_SAFE_ATTR,W),I(e,`FORBID_CONTENTS`)&&nt(e.FORBID_CONTENTS)&&(M===Ue&&(M=B(M)),z(M,e.FORBID_CONTENTS,W)),I(e,`ADD_FORBID_CONTENTS`)&&nt(e.ADD_FORBID_CONTENTS)&&(M===Ue&&(M=B(M)),z(M,e.ADD_FORBID_CONTENTS,W)),ze&&(C[`#text`]=!0),Oe&&z(C,[`html`,`head`,`body`]),C.table&&(z(C,[`tbody`]),delete we.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw pt(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw pt(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=_;_=e.TRUSTED_TYPES_POLICY;try{v=x(``)}catch(e){throw _=t,e}}else e.TRUSTED_TYPES_POLICY===null?(_=void 0,v=``):(_===void 0&&(_=se()),_&&typeof v==`string`&&(v=x(``)));N&&N(e),G=e},Qt=z({},[...yt,...bt,...xt]),$t=z({},[...St,...Ct]),en=function(e,t,n){return t.namespaceURI===F?e===`svg`:t.namespaceURI===Ye?e===`svg`&&(n===`annotation-xml`||mt[n]):!!Qt[e]},tn=function(e,t,n){return t.namespaceURI===F?e===`math`:t.namespaceURI===Xe?e===`math`&&Jt[n]:!!$t[e]},nn=function(e,t,n){return t.namespaceURI===Xe&&!Jt[n]||t.namespaceURI===Ye&&!mt[n]?!1:!$t[e]&&(Yt[e]||!Qt[e])},rn=function(e){let t=m(e);(!t||!t.tagName)&&(t={namespaceURI:lt,tagName:`template`});let n=rt(e.tagName),r=rt(t.tagName);return dt[e.namespaceURI]?e.namespaceURI===Xe?en(n,t,r):e.namespaceURI===Ye?tn(n,t,r):e.namespaceURI===F?nn(n,t,r):!!(U===`application/xhtml+xml`&&dt[e.namespaceURI]):!1},J=function(e){et(t.removed,{element:e});try{m(e).removeChild(e)}catch{if(te(e),!m(e))throw pt(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},an=function(e){cn(e);let t=p(e);if(t){let e=[];Ze(t,t=>{et(e,t)}),Ze(e,e=>{try{te(e)}catch{}})}let n=re(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;if(typeof i==`string`)try{e.removeAttribute(i)}catch{}}},on=function(e,n){try{et(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch{et(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),e===`is`)if(Ne||Pe)try{J(n)}catch{}else try{n.setAttribute(e,``)}catch{}},sn=function(e){let t=re(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;if(!(typeof i!=`string`||T[W(i)]))try{e.removeAttribute(i)}catch{}}},cn=function(e){let t=[e];for(;t.length>0;){let e=t.pop();(h?h(e):e.nodeType)===H.element&&sn(e);let n=p(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},ln=function(e){if(!j)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=h?h(e):e.nodeType;if(n===H.processingInstruction||n===H.comment&&L(Bt,e.data)){try{te(e)}catch{}continue}if(n===H.element){let t=e,n=W(g?g(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&n!==`label`&&n!==`output`&&t.removeAttribute(`for`)}catch{}}let r=p(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},un=function(e){let t=null,r=null;if(Me)e=`<remove></remove>`+e;else{let t=at(e,/^[\r\n\t ]+/);r=t&&t[0]}U===`application/xhtml+xml`&&lt===F&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=_?x(e):e;if(lt===F)try{t=new l().parseFromString(i,U)}catch{}if(!t||!t.documentElement){t=le.createDocument(lt,`template`,null);try{t.documentElement.innerHTML=ut?v:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),lt===F?fe.call(t,Oe?`html`:`body`)[0]:Oe?t.documentElement:a},dn=function(e){return ue.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},fn=function(e){return e=ot(e,me,` `),e=ot(e,he,` `),e=ot(e,ge,` `),e},pn=function(e){e.normalize();let t=ue.call(e.ownerDocument||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),n=t.nextNode();for(;n;)n.data=fn(n.data),n=t.nextNode();let r=e.querySelectorAll?.call(e,`template`);r&&Ze(r,e=>{hn(e.content)&&pn(e.content)})},mn=function(e){let t=g?g(e):null;return typeof t!=`string`||W(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==re(e)||typeof e.removeAttribute!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==h(e)||e.childNodes!==p(e)},hn=function(e){if(!h||typeof e!=`object`||!e)return!1;try{return h(e)===H.documentFragment}catch{return!1}},gn=function(e){if(!h||typeof e!=`object`||!e)return!1;try{return typeof h(e)==`number`}catch{return!1}};function Y(e,n,r){e.length!==0&&Ze(e,e=>{e.call(t,n,r,G)})}let _n=function(e,t){return!!(j&&e.hasChildNodes()&&!gn(e.firstElementChild)&&L(zt,e.textContent)&&L(zt,e.innerHTML)||j&&e.namespaceURI===F&&t===`style`&&gn(e.firstElementChild)||e.nodeType===H.processingInstruction||j&&e.nodeType===H.comment&&L(Bt,e.data))},vn=function(e,t){if(!we[t]&&Sn(t)&&(E.tagNameCheck instanceof RegExp&&L(E.tagNameCheck,t)||E.tagNameCheck instanceof Function&&E.tagNameCheck(t)))return!1;if(ze&&!M[t]){let t=m(e),n=p(e);if(n&&t){let r=n.length;for(let i=r-1;i>=0;--i){let r=Be?n[i]:ee(n[i],!0);t.insertBefore(r,f(e))}}}return J(e),!0},yn=function(e,n){if(Y(S.beforeSanitizeElements,e,null),e!==n&&m(e)===null)return!0;if(mn(e))return J(e),!0;let r=W(g?g(e):e.nodeName);if(Y(S.uponSanitizeElement,e,{tagName:r,allowedTags:C}),e!==n&&m(e)===null)return!0;if(_n(e,r))return J(e),!0;if(we[r]||!(O.tagCheck instanceof Function&&O.tagCheck(r))&&!C[r]){let t=vn(e,r);return t===!1&&Y(S.afterSanitizeElements,e,null),t}if((h?h(e):e.nodeType)===H.element&&!rn(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&L(Vt,e.innerHTML))return J(e),!0;if(A&&e.nodeType===H.text){let n=fn(e.textContent);e.textContent!==n&&(et(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Y(S.afterSanitizeElements,e,null),!1},bn=function(e,t,r){if(D[t]||j&&t===`patchsrc`||j&&t===`for`&&e!==`label`&&e!==`output`||Ie&&(t===`id`||t===`name`)&&(r in n||r in K))return!1;let i=T[t]||O.attributeCheck instanceof Function&&O.attributeCheck(t,e);if(!(k&&L(_e,t))&&!(Te&&L(ve,t))){if(!i){if(!(Sn(e)&&(E.tagNameCheck instanceof RegExp&&L(E.tagNameCheck,e)||E.tagNameCheck instanceof Function&&E.tagNameCheck(e))&&(E.attributeNameCheck instanceof RegExp&&L(E.attributeNameCheck,t)||E.attributeNameCheck instanceof Function&&E.attributeNameCheck(t,e))||t===`is`&&E.allowCustomizedBuiltInElements&&(E.tagNameCheck instanceof RegExp&&L(E.tagNameCheck,r)||E.tagNameCheck instanceof Function&&E.tagNameCheck(r))))return!1}else if(!Ke[t]&&!L(Se,ot(r,be,``))&&!((t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&st(r,`data:`)===0&&We[e])&&!(Ee&&!L(ye,ot(r,be,``)))&&r)return!1}return!0},xn=z({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Sn=function(e){return!xn[rt(e)]&&L(xe,e)},Cn=function(e,t,n,r){if(_&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return x(r);case`TrustedScriptURL`:return oe(r)}return r},wn=function(e,n,r,i){try{r?e.setAttributeNS(r,n,i):e.setAttribute(n,i),mn(e)?J(e):$e(t.removed)}catch{on(n,e)}},Tn=function(e){Y(S.beforeSanitizeAttributes,e,null);let t=e.attributes;if(!t||mn(e))return;let n={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:T,forceKeepAttr:void 0},r=t.length,i=W(e.nodeName);for(;r--;){let a=t[r],o=a.name,s=a.namespaceURI,c=a.value,l=W(o),u=c,d=o===`value`?u:ct(u);if(n.attrName=l,n.attrValue=d,n.keepAttr=!0,n.forceKeepAttr=void 0,Y(S.uponSanitizeAttribute,e,n),d=n.attrValue,Le&&(l===`id`||l===`name`)&&st(d,Re)!==0&&(on(o,e),d=Re+d),j&&L(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,d)){on(o,e);continue}if(l===`attributename`&&at(d,`href`)){on(o,e);continue}if(!n.forceKeepAttr){if(!n.keepAttr){on(o,e);continue}if(!De&&L(Ht,d)){on(o,e);continue}if(A&&(d=fn(d)),!bn(i,l,d)){on(o,e);continue}d=Cn(i,l,s,d),d!==u&&wn(e,o,s,d)}}Y(S.afterSanitizeAttributes,e,null)},En=function(e){let t=null,n=dn(e);for(Y(S.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Y(S.uponSanitizeShadowNode,t,null),yn(t,e),Tn(t),hn(t.content)&&En(t.content),(h?h(t):t.nodeType)===H.element){let e=ne(t);hn(e)&&(Dn(e),En(e))}Y(S.afterSanitizeShadowDOM,e,null)},Dn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){En(e.shadow);continue}let n=e.node,r=(h?h(n):n.nodeType)===H.element,i=p(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=g?g(n):null;if(typeof e==`string`&&W(e)===`template`){let e=n.content;hn(e)&&t.push({node:e,shadow:null})}}if(r){let e=ne(n);hn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(ut=!e,ut&&(e=`<!-->`),typeof e!=`string`&&!gn(e)&&(e=gt(e),typeof e!=`string`))throw pt(`dirty is not a string, aborting`);if(!t.isSupported)return e;ke?(C=Ae,T=je):q(n),(S.uponSanitizeElement.length>0||S.uponSanitizeAttribute.length>0)&&(C=B(C)),S.uponSanitizeAttribute.length>0&&(T=B(T)),t.removed=[];let c=Be&&typeof e!=`string`&&gn(e);if(c){ln(e);let t=g?g(e):e.nodeName;if(typeof t==`string`){let n=W(t);if(!C[n]||we[n])throw an(e),pt(`root node is forbidden and cannot be sanitized in-place`)}if(mn(e))throw an(e),pt(`root node is clobbered and cannot be sanitized in-place`);try{Dn(e)}catch(t){throw an(e),t}}else if(gn(e))i=un(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===H.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Dn(a);else{if(!Ne&&!A&&!Oe&&e.indexOf(`<`)===-1)return _&&Fe?x(e):e;if(i=un(e),!i)return Ne?null:Fe?v:``}i&&Me&&J(i.firstChild);let l=c?e:i,u=dn(l);try{for(;o=u.nextNode();)yn(o,l),Tn(o),hn(o.content)&&En(o.content)}catch(n){throw c&&(an(e),Ze(t.removed,e=>{e.element&&cn(e.element)})),n}if(c)return Ze(t.removed,e=>{e.element&&cn(e.element)}),A&&pn(e),e;if(Ne){if(A&&pn(i),Pe)for(s=de.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(T.shadowroot||T.shadowrootmode)&&(s=pe.call(r,s,!0)),s}let d=Oe?i.outerHTML:i.innerHTML;return Oe&&C[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&L(Lt,i.ownerDocument.doctype.name)&&(d=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
3
3
  `+d),A&&(d=fn(d)),_&&Fe?x(d):d},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};q(e),ke=!0,Ae=C,je=T},t.clearConfig=function(){G=null,ke=!1,Ae=null,je=null,_=y,v=``},t.isValidAttribute=function(e,t,n){G||q({});let r=W(e),i=W(t);return bn(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&I(S,e)&&et(S[e],t)},t.removeHook=function(e,t){if(I(S,e)){if(t!==void 0){let n=Qe(S[e],t);return n===-1?void 0:tt(S[e],n,1)[0]}return $e(S[e])}},t.removeHooks=function(e){I(S,e)&&(S[e]=[])},t.removeAllHooks=function(){S=Gt()},t}var Jt=qt();function Yt(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var U=Yt();function Xt(e){U=e}var W={exec:()=>null};function G(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function K(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(q.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Zt=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),q={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:G(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:G(e=>RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),fencesBeginRegex:G(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:G(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:G(e=>RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`,`i`)),blockquoteBeginRegex:G(e=>RegExp(`^ {0,${e}}>`))},Qt=/^(?:[ \t]*(?:\n|$))+/,$t=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,en=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,tn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,nn=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,rn=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,J=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,an=K(J).replace(/bull/g,rn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),on=K(J).replace(/bull/g,rn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),sn=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,cn=/^[^\n]+/,ln=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,un=K(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,ln).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),dn=K(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,rn).getRegex(),fn=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,pn=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,mn=K(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,pn).replace(`tag`,fn).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),hn=e=>K(sn).replace(`hr`,tn).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,fn).getRegex(),gn=hn(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),Y=hn(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),_n={blockquote:K(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,Y).getRegex(),code:$t,def:un,fences:en,heading:nn,hr:tn,html:mn,lheading:an,list:dn,newline:Qt,paragraph:gn,table:W,text:cn},vn=K(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,tn).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,fn).getRegex(),yn={..._n,lheading:on,table:vn,paragraph:K(sn).replace(`hr`,tn).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,vn).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,fn).getRegex()},bn={..._n,html:K(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,pn).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:W,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:K(sn).replace(`hr`,tn).replace(`heading`,` *#{1,6} *[^
4
4
  ]`).replace(`lheading`,an).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},xn=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Sn=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Cn=/^( {2,}|\\)\n(?!\s*$)/,wn=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Tn=/[\p{P}\p{S}]/u,En=/[\s\p{P}\p{S}]/u,Dn=/[^\s\p{P}\p{S}]/u,On=K(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,En).getRegex(),kn=/(?!~)[\p{P}\p{S}]/u,An=/(?!~)[\s\p{P}\p{S}]/u,jn=/(?:[^\s\p{P}\p{S}]|~)/u,Mn=K(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Zt?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),Nn=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Pn=K(Nn,`u`).replace(/punct/g,Tn).getRegex(),Fn=K(Nn,`u`).replace(/punct/g,kn).getRegex(),In=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Ln=K(In,`gu`).replace(/notPunctSpace/g,Dn).replace(/punctSpace/g,En).replace(/punct/g,Tn).getRegex(),Rn=K(In,`gu`).replace(/notPunctSpace/g,jn).replace(/punctSpace/g,An).replace(/punct/g,kn).getRegex(),zn=K(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,Dn).replace(/punctSpace/g,En).replace(/punct/g,Tn).getRegex(),Bn=K(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,Tn).getRegex(),Vn=K(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,Dn).replace(/punctSpace/g,En).replace(/punct/g,Tn).getRegex(),Hn=K(/\\(punct)/,`gu`).replace(/punct/g,Tn).getRegex(),Un=K(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Wn=K(pn).replace(`(?:-->|$)`,`-->`).getRegex(),Gn=K(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Wn).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Kn=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,qn=K(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,Kn).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Jn=K(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Kn).replace(`ref`,ln).getRegex(),Yn=K(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,ln).getRegex(),Xn=K(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Jn).replace(`nolink`,Yn).getRegex(),Zn=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Qn={_backpedal:W,anyPunctuation:Hn,autolink:Un,blockSkip:Mn,br:Cn,code:Sn,del:W,delLDelim:W,delRDelim:W,emStrongLDelim:Pn,emStrongRDelimAst:Ln,emStrongRDelimUnd:zn,escape:xn,link:qn,nolink:Yn,punctuation:On,reflink:Jn,reflinkSearch:Xn,tag:Gn,text:wn,url:W},$n={...Qn,link:K(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Kn).getRegex(),reflink:K(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Kn).getRegex()},er={...Qn,emStrongRDelimAst:Rn,emStrongLDelim:Fn,delLDelim:Bn,delRDelim:Vn,url:K(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,Zn).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:K(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,Zn).getRegex()},tr={...er,br:K(Cn).replace(`{2,}`,`*`).getRegex(),text:K(er.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},nr={normal:_n,gfm:yn,pedantic:bn},rr={normal:Qn,gfm:er,breaks:tr,pedantic:$n},ir={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},ar=e=>ir[e];function X(e,t){if(t){if(q.escapeTest.test(e))return e.replace(q.escapeReplace,ar)}else if(q.escapeTestNoEncode.test(e))return e.replace(q.escapeReplaceNoEncode,ar);return e}function or(e){try{e=encodeURI(e).replace(q.percentDecode,`%`)}catch{return null}return e}function sr(e,t){let n=e.replace(q.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(q.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(q.slashPipe,`|`);return n}function cr(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function lr(e){let t=e.split(`