@madarco/agentbox 0.23.2 → 0.23.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/{_cloud-attach-LP5CIO7S.js → _cloud-attach-BQRWX3J2.js} +3 -3
- package/dist/chunk-G3H2L3O2.js +0 -0
- package/dist/chunk-GGRZ3GZO.js +0 -0
- package/dist/{chunk-C47ZA42C.js → chunk-I6ZRWTPR.js} +25 -3
- package/dist/chunk-I6ZRWTPR.js.map +1 -0
- package/dist/{chunk-AGSLJ3NE.js → chunk-LA4JMS27.js} +10 -2
- package/dist/{chunk-AGSLJ3NE.js.map → chunk-LA4JMS27.js.map} +1 -1
- package/dist/chunk-LK2JT2OO.js +0 -0
- package/dist/chunk-LSQXT5WZ.js +0 -0
- package/dist/{chunk-J3GSZ33V.js → chunk-QEQFZLYR.js} +7 -7
- package/dist/chunk-QT3SHMLY.js +0 -0
- package/dist/{chunk-7D7K4UXW.js → chunk-SFA57TGX.js} +3 -3
- package/dist/{chunk-TZLNJBIM.js → chunk-W3FQPFP7.js} +2 -2
- package/dist/chunk-WJFZJZIM.js +0 -0
- package/dist/cloud-poller-SUNA6ZQC-7M5LJHHE.js +0 -0
- package/dist/dist-2BTJQUJS.js +0 -0
- package/dist/{dist-VMR6UEP2.js → dist-CUKBKS3N.js} +4 -4
- package/dist/{dist-HENU2IVK.js → dist-FXQFTT75.js} +3 -3
- package/dist/{dist-UIOWLT3C.js → dist-QO4CTLAX.js} +4 -4
- package/dist/{dist-OTSXYV6X.js → dist-V235KVEX.js} +3 -3
- package/dist/{dist-NUZ2RMOP.js → dist-Z2NEVV55.js} +4 -2
- package/dist/index.js +44 -53
- package/dist/index.js.map +1 -1
- package/dist/prepared-state-BUO75YLZ-CDTISC2C.js +0 -0
- package/package.json +28 -27
- package/runtime/_shared/agentbox-checkpoint-cleanup +0 -0
- package/runtime/_shared/agentbox-dockerd-start +0 -0
- package/runtime/_shared/agentbox-open +0 -0
- package/runtime/_shared/agentbox-portless-trust +0 -0
- package/runtime/_shared/agentbox-vnc-start +0 -0
- package/runtime/_shared/ctl.cjs +0 -0
- package/runtime/_shared/gh-shim +0 -0
- package/runtime/_shared/git-shim +0 -0
- package/runtime/_shared/linear-shim +0 -0
- package/runtime/_shared/ntn-shim +0 -0
- package/runtime/docker/packages/ctl/dist/bin.cjs +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-checkpoint-cleanup +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-dockerd-start +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-open +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-portless-trust +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-sshd-start +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/agentbox-vnc-start +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/chromium-resolver +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/gh-shim +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/git-shim +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/linear-shim +0 -0
- package/runtime/docker/packages/sandbox-docker/scripts/ntn-shim +0 -0
- package/runtime/e2b/agentbox-checkpoint-cleanup +0 -0
- package/runtime/e2b/agentbox-dockerd-start +0 -0
- package/runtime/e2b/agentbox-open +0 -0
- package/runtime/e2b/agentbox-vnc-start +0 -0
- package/runtime/e2b/ctl.cjs +0 -0
- package/runtime/e2b/gh-shim +0 -0
- package/runtime/e2b/git-shim +0 -0
- package/runtime/e2b/linear-shim +0 -0
- package/runtime/e2b/ntn-shim +0 -0
- package/runtime/e2b/scripts/build-template.sh +0 -0
- package/runtime/hetzner/agentbox-checkpoint-cleanup +0 -0
- package/runtime/hetzner/agentbox-dockerd-start +0 -0
- package/runtime/hetzner/agentbox-open +0 -0
- package/runtime/hetzner/agentbox-portless-trust +0 -0
- package/runtime/hetzner/agentbox-vnc-start +0 -0
- package/runtime/hetzner/ctl.cjs +0 -0
- package/runtime/hetzner/gh-shim +0 -0
- package/runtime/hetzner/git-shim +0 -0
- package/runtime/hetzner/linear-shim +0 -0
- package/runtime/hetzner/ntn-shim +0 -0
- package/runtime/hetzner/scripts/install-box.sh +0 -0
- package/runtime/hub/apps/hub/.next/BUILD_ID +1 -1
- package/runtime/hub/apps/hub/.next/build-manifest.json +3 -3
- package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(auth)/signin/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/approvals/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/boxes/[id]/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/projects/[id]/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error/page.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.html +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/runtime/hub/apps/hub/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__0keu6we._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1bqbkd5._.js +2 -2
- package/runtime/hub/apps/hub/.next/server/chunks/[root-of-the-server]__1qa4a0v._.js +2 -2
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/{09xn_next_dist_0iwlo01._.js → 09xn_next_dist_1uccfbf._.js} +2 -2
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__0vdzfiw._.js +3 -0
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/{[root-of-the-server]__0cpdgd0._.js → [root-of-the-server]__1bd_5o3._.js} +2 -2
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/apps_hub_app_(dashboard)_boxes_[id]_page_tsx_1-j_972._.js +1 -1
- package/runtime/hub/apps/hub/.next/server/middleware-build-manifest.js +3 -3
- package/runtime/hub/apps/hub/.next/server/pages/500.html +1 -1
- package/runtime/hub/apps/hub/.next/static/chunks/000a1sa7te1h8.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/20hq7-0depjid.js +1 -0
- package/runtime/hub/apps/hub/.next/static/chunks/3dfjrxx-dy644.css +3 -0
- package/runtime/hub/apps/hub/{chunk-TS3DHXYG.js → chunk-2Z74R6ZT.js} +9 -1
- package/runtime/hub/apps/hub/{chunk-5C7T5LX3.js → chunk-AR7CEZ2G.js} +24 -2
- package/runtime/hub/apps/hub/{dist-3ILQQGCH.js → dist-LNHEG5P4.js} +2 -2
- package/runtime/hub/apps/hub/{dist-CJHZ37LW.js → dist-LZNRLUYY.js} +2 -2
- package/runtime/hub/apps/hub/{dist-PKOFN4OD.js → dist-Q6G66Z57.js} +2 -2
- package/runtime/hub/apps/hub/{dist-WRKJHF6W.js → dist-SD4G36EP.js} +2 -2
- package/runtime/hub/apps/hub/{dist-6R5YPL5S.js → dist-VV6Z2CQX.js} +3 -1
- package/runtime/hub/apps/hub/package.json +1 -0
- package/runtime/hub/apps/hub/server.js +22 -9
- package/runtime/relay/bin.cjs +0 -0
- package/runtime/vercel/agentbox-checkpoint-cleanup +0 -0
- package/runtime/vercel/agentbox-dockerd-start +0 -0
- package/runtime/vercel/agentbox-open +0 -0
- package/runtime/vercel/agentbox-vnc-start +0 -0
- package/runtime/vercel/ctl.cjs +0 -0
- package/runtime/vercel/gh-shim +0 -0
- package/runtime/vercel/git-shim +0 -0
- package/runtime/vercel/linear-shim +0 -0
- package/runtime/vercel/ntn-shim +0 -0
- package/runtime/vercel/scripts/provision.sh +0 -0
- package/LICENSE +0 -21
- package/dist/chunk-C47ZA42C.js.map +0 -1
- package/runtime/hub/apps/hub/.next/server/chunks/ssr/[root-of-the-server]__1bq2f8q._.js +0 -3
- package/runtime/hub/apps/hub/.next/static/chunks/1py5tlz57h7ra.js +0 -1
- package/runtime/hub/apps/hub/.next/static/chunks/3rm29i8e-lb25.css +0 -3
- /package/dist/{_cloud-attach-LP5CIO7S.js.map → _cloud-attach-BQRWX3J2.js.map} +0 -0
- /package/dist/{chunk-J3GSZ33V.js.map → chunk-QEQFZLYR.js.map} +0 -0
- /package/dist/{chunk-7D7K4UXW.js.map → chunk-SFA57TGX.js.map} +0 -0
- /package/dist/{chunk-TZLNJBIM.js.map → chunk-W3FQPFP7.js.map} +0 -0
- /package/dist/{dist-NUZ2RMOP.js.map → dist-CUKBKS3N.js.map} +0 -0
- /package/dist/{dist-HENU2IVK.js.map → dist-FXQFTT75.js.map} +0 -0
- /package/dist/{dist-UIOWLT3C.js.map → dist-QO4CTLAX.js.map} +0 -0
- /package/dist/{dist-OTSXYV6X.js.map → dist-V235KVEX.js.map} +0 -0
- /package/dist/{dist-VMR6UEP2.js.map → dist-Z2NEVV55.js.map} +0 -0
- /package/runtime/hub/apps/hub/.next/static/{W7Oc_BUsChvL4rrhfKZRY → eVq-z4zld_8DGQudbYogV}/_buildManifest.js +0 -0
- /package/runtime/hub/apps/hub/.next/static/{W7Oc_BUsChvL4rrhfKZRY → eVq-z4zld_8DGQudbYogV}/_clientMiddlewareManifest.js +0 -0
- /package/runtime/hub/apps/hub/.next/static/{W7Oc_BUsChvL4rrhfKZRY → eVq-z4zld_8DGQudbYogV}/_ssgManifest.js +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[58099,a=>{"use strict";var b=a.i(33552),c=a.i(74455),d=a.i(17607),e=a.i(97187),f=a.i(71152),g=a.i(86834);function h({className:a,icon:c,title:d,children:e}){return(0,b.jsxs)("div",{className:(0,g.cn)("relative flex w-full items-start gap-3 rounded-xl border p-4",a),children:[c?(0,b.jsx)(c,{className:"mt-0.5 size-4 flex-none"}):null,(0,b.jsxs)("div",{className:"min-w-0",children:[d?(0,b.jsx)("div",{className:"mb-0.5 text-[13.5px] font-semibold leading-tight",children:d}):null,(0,b.jsx)("div",{className:"text-[12.5px] leading-normal",children:e})]})]})}var i=a.i(87883),j=a.i(80007),k=a.i(60401);function l({boxId:a}){let{state:c}=(0,j.useStore)(),f=c.approvals.filter(b=>b.boxId===a).sort((a,b)=>a.createdAt-b.createdAt);return 0===f.length?null:(0,b.jsxs)("div",{className:"mt-4 overflow-hidden rounded-xl border border-[var(--amber-line)] bg-[var(--amber-soft)]",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 border-b border-[var(--amber-line)] px-4 py-2.5",children:[(0,b.jsx)(e.Icons.shield,{className:"size-4 flex-none text-[var(--amber)]"}),(0,b.jsxs)("span",{className:"text-[13.5px] font-semibold",children:[f.length," pending approval",1===f.length?"":"s"]}),(0,b.jsx)("span",{className:"text-[12.5px] text-muted-foreground",children:"— this box is waiting on you."})]}),(0,b.jsx)("div",{className:"divide-y divide-[var(--amber-line)]",children:f.map(a=>(0,b.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3",children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsx)("div",{className:"truncate font-mono text-[13px] text-secondary-foreground",children:a.command??a.message}),a.detail?(0,b.jsx)("div",{className:"mt-0.5 truncate text-[11.5px] text-muted-foreground",children:a.detail}):null,a.cwd?(0,b.jsx)("div",{className:"mt-0.5 truncate font-mono text-[11px] text-[#a4a9b0]",children:a.cwd}):null,(0,b.jsx)("div",{className:"mt-0.5 font-mono text-[11px] text-[#a4a9b0]",children:(0,b.jsx)(d.Ago,{ms:a.createdAt})})]}),(0,b.jsx)("div",{className:"flex-none pt-0.5",children:(0,b.jsx)(k.ApprovalActions,{id:a.id})})]},a.id))})]})}var m=a.i(50253),n=a.i(18071),o=a.i(3015);let p=[{app:"claude",label:"Claude",icon:"claude"},{app:"codex",label:"Codex",icon:"codex"},{app:"vscode",label:"VS Code",icon:"ext"},{app:"cmux",label:"cmux",icon:"terminal"},{app:"herdr",label:"Herdr",icon:"terminal"},{app:"iterm2",label:"iTerm2",icon:"terminal"},{app:"finder",label:"Finder",icon:"folder"}];function q({url:a}){let[c,d]=(0,m.useState)(!1),f=(0,m.useRef)(null);(0,m.useEffect)(()=>()=>{f.current&&clearTimeout(f.current)},[]);let g=(0,m.useCallback)(async()=>{try{await navigator.clipboard.writeText(a),d(!0),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>d(!1),1500)}catch{}},[a]);return(0,b.jsxs)(n.Button,{variant:"outline",size:"sm",onClick:g,children:[c?(0,b.jsx)(e.Icons.check,{}):(0,b.jsx)(e.Icons.copy,{}),c?"Copied":"Copy URL"]})}function r({box:a}){let{webUrl:c,vncUrl:d}=a,{eligible:f,pending:g,launch:h}=function(a){let[b,c]=(0,m.useState)(null),[d,e]=(0,m.useState)(null);(0,m.useEffect)(()=>{let a=!0;return(async()=>{try{let b=await fetch("/api/v1/open-targets",{credentials:"same-origin"});a&&c(b.ok?await b.json():null)}catch{a&&c(null)}})(),()=>{a=!1}},[]);let f=(0,m.useCallback)(async b=>{e(b);try{let c=await fetch(`/api/v1/boxes/${encodeURIComponent(a.id)}/open`,{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({app:b})});if(!c.ok){let a=await c.json().catch(()=>null);window.alert(`Open in ${b} failed: ${a?.error?.message??`HTTP ${c.status}`}`)}}catch(a){window.alert(`Open in ${b} failed: ${a instanceof Error?a.message:String(a)}`)}finally{e(null)}},[a.id]),g=b?.supported?b.targets:null;return{eligible:g?p.filter(({app:b})=>{let c=g[b];return c.available&&(!c.providers||c.providers.includes(a.provider))}):[],pending:d,launch:f}}(a);return c||d||0!==f.length?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.SectionLabel,{children:"Access"}),(0,b.jsxs)(i.Card,{className:"divide-y divide-border/60 overflow-hidden",children:[c||d?(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-3 px-4.5 p-3.5",children:[(0,b.jsxs)("div",{className:"min-w-[150px] flex-1",children:[(0,b.jsx)("div",{className:"text-[13.5px] font-medium",children:c?"Web":"VNC"}),(0,b.jsx)("div",{className:"mt-0.5 break-all font-mono text-[11.5px] text-muted-foreground",children:c??"Remote desktop"})]}),(0,b.jsxs)("div",{className:"flex flex-none flex-wrap gap-1.5",children:[c?(0,b.jsxs)(n.Button,{variant:"outline",size:"sm",href:c,target:"_blank",rel:"noreferrer",children:[(0,b.jsx)(e.Icons.ext,{}),"Open web"]}):null,c?(0,b.jsx)(q,{url:c}):null,d?(0,b.jsxs)(n.Button,{variant:"outline",size:"sm",href:d,target:"_blank",rel:"noreferrer",children:[(0,b.jsx)(e.Icons.ext,{}),"Open VNC"]}):null]})]}):null,f.length>0?(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-3 px-4.5 p-3.5",children:[(0,b.jsxs)("div",{className:"min-w-[150px] flex-1",children:[(0,b.jsx)("div",{className:"text-[13.5px] font-medium",children:"Apps"}),(0,b.jsx)("div",{className:"mt-0.5 text-[11.5px] text-muted-foreground",children:"Open the box project from the host"})]}),(0,b.jsx)("div",{className:"flex flex-none flex-wrap justify-end gap-1.5",children:f.map(({app:a,label:c,icon:d})=>{let f=e.Icons[d];return(0,b.jsxs)(n.Button,{variant:"outline",size:"sm",disabled:null!==g,onClick:()=>void h(a),children:[(0,b.jsx)(f,{}),c]},a)})})]}):null]})]}):null}var s=a.i(24288),t=a.i(17236),u=a.i(51363);function v({k:a,v:c,mono:d,link:e}){return(0,b.jsxs)("div",{className:"grid grid-cols-[156px_1fr] items-baseline gap-4 px-4.5 p-3 max-sm:grid-cols-1 max-sm:gap-1",children:[(0,b.jsx)("div",{className:"font-mono text-xs text-muted-foreground",children:a}),(0,b.jsx)("div",{className:(0,g.cn)("min-w-0 text-[13.5px]",d?"font-mono text-[13px]":""),children:e?(0,b.jsx)(u.default,{className:"cursor-pointer text-primary",href:e,children:c}):c})]})}var w=a.i(12019),x=a.i(45515),y=a.i(85883),z=a.i(34537),A=a.i(53596),B=a.i(96664);let C=(0,B.createServerReference)("70fd109611adee18e2a11d04af4332c29e796848e9",B.callServer,void 0,B.findSourceMapURL,"gitBranchAction"),D=(0,B.createServerReference)("600e7ece96e4038f118842cef0ebcf51dadf743c9b",B.callServer,void 0,B.findSourceMapURL,"gitCheckoutAction"),E=(0,B.createServerReference)("605f4904ee0814a4a51c0445aa18e7dfbde590c7e5",B.callServer,void 0,B.findSourceMapURL,"gitPullAction"),F=(0,B.createServerReference)("60675b1179af1a57b7c4bb6e4d893805dd8f7b0b66",B.callServer,void 0,B.findSourceMapURL,"gitPushAction"),G=(0,B.createServerReference)("607692631dd5973ad6071d94f3fee9c7da56a766db",B.callServer,void 0,B.findSourceMapURL,"gitPushHostAction"),H=0;function I({toasts:a,dismiss:c}){return(0,b.jsx)("div",{className:"pointer-events-none fixed bottom-5 right-5 z-[60] flex w-[340px] max-w-[calc(100vw-40px)] flex-col gap-2",children:a.map(a=>(0,b.jsxs)("div",{className:"anim-pop pointer-events-auto relative flex items-start gap-3 rounded-xl border border-border bg-card p-3.5 pr-9 shadow-[0_16px_40px_-18px_rgba(20,24,30,.35)]",children:[(0,b.jsx)("span",{className:(0,g.cn)("mt-0.5 grid h-6 w-6 flex-none place-items-center rounded-md border","error"===a.variant?"border-[var(--red-line)] bg-[var(--red-soft)] text-[var(--red)]":"border-[var(--green-line)] bg-accent text-primary"),children:"error"===a.variant?(0,b.jsx)(e.Icons.warn,{className:"size-3.5"}):(0,b.jsx)(e.Icons.check,{className:"size-3.5"})}),(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("div",{className:"text-[13px] font-semibold leading-tight",children:a.title}),a.detail?(0,b.jsx)("div",{className:"mt-0.5 break-words font-mono text-[11.5px] leading-normal text-muted-foreground",children:a.detail}):null]}),(0,b.jsx)("button",{className:"absolute right-2.5 top-2.5 grid h-5 w-5 cursor-pointer place-items-center rounded border-0 bg-transparent text-[#a4a9b0] hover:text-foreground",onClick:()=>c(a.id),"aria-label":"Dismiss",children:(0,b.jsx)(e.Icons.x,{className:"size-3"})})]},a.id))})}function J({label:a,desc:c,children:d}){return(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-3 px-4.5 p-3.5",children:[(0,b.jsxs)("div",{className:"min-w-[150px] flex-1",children:[(0,b.jsx)("div",{className:"text-[13.5px] font-medium",children:a}),(0,b.jsx)("div",{className:"mt-0.5 font-mono text-[11.5px] text-muted-foreground",children:c})]}),(0,b.jsx)("div",{className:"flex flex-none flex-wrap gap-1.5",children:d})]})}function K({icon:a,disabled:c,onRun:d,children:e}){let[f,g]=(0,m.useState)(!1),h=async()=>{g(!0);try{await d()}finally{g(!1)}};return(0,b.jsxs)(n.Button,{variant:"outline",size:"sm",disabled:c||f,onClick:h,children:[f?(0,b.jsx)("span",{className:"spin",style:{width:12,height:12}}):(0,b.jsx)(a,{}),e]})}function L(a,b){let c=(a??"").trim()||(b??"").trim();return c?c.split("\n")[0]:void 0}function M({box:a}){let d=(0,c.useRouter)(),{toasts:f,push:h,dismiss:j}=function(){let[a,b]=(0,m.useState)([]),c=(0,m.useCallback)(a=>b(b=>b.filter(b=>b.id!==a)),[]);return{toasts:a,push:(0,m.useCallback)(a=>{let d=++H;b(b=>[...b,{id:d,...a}]),setTimeout(()=>c(d),4200)},[c]),dismiss:c}}(),[k,l]=(0,m.useState)(null),[o,p]=(0,m.useState)(null),q="running"!==a.status,r=(0,m.useCallback)(async()=>{try{let b=await fetch(`/api/v1/boxes/${encodeURIComponent(a.id)}/git`,{credentials:"same-origin"});l(b.ok?await b.json():null)}catch{l(null)}},[a.id]);(0,m.useEffect)(()=>{r()},[r]);let s=k?.ok&&k.branch?k.branch:a.branch||"—",t=()=>{r(),d.refresh()},u=async(a,b)=>{let c=await b();c.ok?(h({title:a,detail:L(c.stdout,c.stderr)}),t()):h({variant:"error",title:`${a} failed`,detail:c.error})};return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(i.Card,{className:(0,g.cn)("divide-y divide-border/60 overflow-hidden",q?"opacity-90":""),children:[q?(0,b.jsxs)("div",{className:"flex items-center gap-2.5 bg-[var(--amber-soft)] px-4.5 p-2.5 text-[12.5px] text-[var(--amber)]",children:[(0,b.jsx)(e.Icons.warn,{className:"size-3.5 flex-none"}),"Box is ",a.status," — git operations need a running box."]}):null,(0,b.jsxs)(J,{label:"Sync",desc:`origin ↔ ${s}`,children:[(0,b.jsx)(K,{icon:e.Icons.arrowL,disabled:q,onRun:()=>u("Pulled from origin",()=>E(a.id)),children:"Pull"}),(0,b.jsx)(K,{icon:e.Icons.ext,disabled:q,onRun:()=>u("Pushed to origin",()=>F(a.id)),children:"Push"}),(0,b.jsx)(K,{icon:e.Icons.host,disabled:q,onRun:()=>u("Pushed to host",()=>G(a.id)),children:"Push to host"})]}),(0,b.jsxs)(J,{label:"Branch",desc:`currently on ${s}`,children:[(0,b.jsxs)(n.Button,{variant:"outline",size:"sm",disabled:q,onClick:()=>p("change"),children:[(0,b.jsx)(e.Icons.branch,{}),"Change branch"]}),(0,b.jsxs)(n.Button,{variant:"outline",size:"sm",disabled:q,onClick:()=>p("new"),children:[(0,b.jsx)(e.Icons.plus,{}),"New branch"]})]})]}),"change"===o?(0,b.jsx)(P,{box:a,branch:s,onClose:()=>p(null),onDone:h,onRefresh:t}):null,"new"===o?(0,b.jsx)(Q,{box:a,onClose:()=>p(null),onDone:h,onRefresh:t}):null,(0,b.jsx)(I,{toasts:f,dismiss:j})]})}let N="__manual__";function O({boxId:a,value:c,onChange:d,id:e,headLabel:f,currentBranch:g}){let[h,i]=(0,m.useState)(null),[j,k]=(0,m.useState)(g??null),[l,n]=(0,m.useState)(!1);return((0,m.useEffect)(()=>{let b=!1;return(async()=>{try{let c=await fetch(`/api/v1/boxes/${encodeURIComponent(a)}/branches`,{credentials:"same-origin"}),d=c.ok?await c.json():null;if(b)return;d&&Array.isArray(d.branches)&&d.branches.length>0?(i(d.branches),g||"string"!=typeof d.current||k(d.current)):(i([]),n(!0))}catch{b||(i([]),n(!0))}})(),()=>{b=!0}},[a,g]),null===h)?(0,b.jsx)(A.Select,{id:e,value:"",disabled:!0,wrapperClassName:"w-full",children:(0,b.jsx)("option",{value:"",children:"Loading branches…"})}):l?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(y.Input,{id:e,className:"font-mono text-[13px]",autoFocus:!0,value:c,onChange:a=>d(a.target.value),placeholder:f?"HEAD":"feature-x"}),h.length>0?(0,b.jsx)("button",{type:"button",onClick:()=>{n(!1),d("")},className:"mt-1.5 cursor-pointer text-xs text-secondary-foreground underline-offset-2 hover:underline",children:"← Back to branch list"}):null]}):(0,b.jsxs)(A.Select,{id:e,value:c,wrapperClassName:"w-full",onChange:a=>{if(a.target.value===N){n(!0),d("");return}d(a.target.value)},children:[f?(0,b.jsx)("option",{value:"",children:f}):(0,b.jsx)("option",{value:"",disabled:!0,children:"Select a branch…"}),(0,b.jsx)("option",{value:N,children:"Other / type manually…"}),(0,b.jsx)("option",{disabled:!0,children:"────────────"}),h.map(a=>(0,b.jsxs)("option",{value:a,children:[a,a===j?" (current)":""]},a))]})}function P({box:a,branch:c,onClose:d,onDone:f,onRefresh:g}){let[h,i]=(0,m.useState)(""),[j,k]=(0,m.useState)(!1),[l,o]=(0,m.useState)(null),p=h.trim().length>0;return(0,b.jsxs)(x.Dialog,{onClose:d,className:"max-w-[440px]",children:[(0,b.jsxs)(x.DialogHeader,{children:[(0,b.jsx)(x.DialogIcon,{children:(0,b.jsx)(e.Icons.branch,{})}),(0,b.jsxs)("div",{children:[(0,b.jsx)(x.DialogTitle,{children:"Change branch"}),(0,b.jsxs)(x.DialogDescription,{children:[a.id," · currently on ",c]})]})]}),(0,b.jsxs)(x.DialogBody,{children:[(0,b.jsx)(z.Label,{htmlFor:"gb-branch",children:"Branch"}),(0,b.jsx)(O,{boxId:a.id,id:"gb-branch",value:h,onChange:i,currentBranch:c}),(0,b.jsx)("p",{className:"mt-1.5 text-xs text-muted-foreground",children:"The branch must exist and not be checked out in another worktree."}),l?(0,b.jsx)("p",{className:"mt-2 break-words font-mono text-xs text-destructive",children:l}):null]}),(0,b.jsxs)(x.DialogFooter,{children:[(0,b.jsx)(n.Button,{variant:"outline",onClick:d,disabled:j,children:"Cancel"}),(0,b.jsxs)(n.Button,{onClick:()=>{p&&!j&&(k(!0),o(null),(async()=>{let b=await D(a.id,h.trim());b.ok?(f({title:"Branch changed",detail:L(b.stdout,b.stderr)}),d(),g()):(o(b.error),k(!1))})())},disabled:!p||j,children:[j?(0,b.jsx)("span",{className:"spin"}):(0,b.jsx)(e.Icons.check,{}),j?"Checking out…":"Change branch"]})]})]})}function Q({box:a,onClose:c,onDone:d,onRefresh:f}){let[g,h]=(0,m.useState)(""),[i,j]=(0,m.useState)(""),[k,l]=(0,m.useState)(!1),[o,p]=(0,m.useState)(null),q=g.trim().length>0,r=()=>{q&&!k&&(l(!0),p(null),(async()=>{let b=await C(a.id,g.trim(),i.trim()||void 0);b.ok?(d({title:"Branch created",detail:L(b.stdout,b.stderr)}),c(),f()):(p(b.error),l(!1))})())};return(0,b.jsxs)(x.Dialog,{onClose:c,className:"max-w-[440px]",children:[(0,b.jsxs)(x.DialogHeader,{children:[(0,b.jsx)(x.DialogIcon,{children:(0,b.jsx)(e.Icons.branch,{})}),(0,b.jsxs)("div",{children:[(0,b.jsx)(x.DialogTitle,{children:"New branch"}),(0,b.jsxs)(x.DialogDescription,{children:[a.id," · branching in the box workspace"]})]})]}),(0,b.jsxs)(x.DialogBody,{children:[(0,b.jsxs)("div",{className:"mb-4",children:[(0,b.jsx)(z.Label,{htmlFor:"nb-name",children:"Name"}),(0,b.jsx)(y.Input,{id:"nb-name",className:"font-mono text-[13px]",autoFocus:!0,value:g,onChange:a=>h(a.target.value),onKeyDown:a=>{"Enter"===a.key&&r()},placeholder:"my-branch"}),(0,b.jsxs)("p",{className:"mt-1.5 text-xs text-muted-foreground",children:["An ",(0,b.jsx)("span",{className:"font-mono",children:"agentbox/"})," prefix is added when missing."]})]}),(0,b.jsxs)(z.Label,{htmlFor:"nb-from",children:["Base ref ",(0,b.jsx)("span",{className:"font-normal text-[#a4a9b0]",children:"(optional)"})]}),(0,b.jsx)(O,{boxId:a.id,id:"nb-from",value:i,onChange:j,headLabel:"Current HEAD (default)"}),(0,b.jsx)("p",{className:"mt-1.5 text-xs text-muted-foreground",children:"Defaults to the box's current HEAD."}),o?(0,b.jsx)("p",{className:"mt-2 break-words font-mono text-xs text-destructive",children:o}):null]}),(0,b.jsxs)(x.DialogFooter,{children:[(0,b.jsx)(n.Button,{variant:"outline",onClick:c,disabled:k,children:"Cancel"}),(0,b.jsxs)(n.Button,{onClick:r,disabled:!q||k,children:[k?(0,b.jsx)("span",{className:"spin"}):(0,b.jsx)(e.Icons.plus,{}),k?"Creating…":"Create branch"]})]})]})}let R=(0,B.createServerReference)("6096ff4dd5616157cf1da6a977c271641a3ddce491",B.callServer,void 0,B.findSourceMapURL,"restartServiceAction"),S=new Set(["ready","running","done"]),T=new Set(["crashed","unhealthy","backoff","failed"]),U={up:"bg-[var(--green)]",bad:"bg-[var(--red)]",idle:"bg-[var(--amber)]"},V={up:"text-[var(--green-ink)]",bad:"text-[var(--red)]",idle:"text-[var(--amber)]"};function W({svc:a,disabled:c,onRestart:d}){var f;let h=(f=a.state,S.has(f)?"up":T.has(f)?"bad":"idle");return(0,b.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[(0,b.jsx)("span",{className:(0,g.cn)("badge-dot",U[h]),"aria-hidden":!0}),(0,b.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-[13px] text-secondary-foreground",children:a.name}),(0,b.jsx)("span",{className:(0,g.cn)("font-mono text-xs",V[h]),children:a.state}),a.restarts>0?(0,b.jsxs)("span",{className:"font-mono text-[11px] text-muted-foreground",children:["↻",a.restarts]}):null,(0,b.jsx)(n.Button,{variant:"outline",size:"icon-sm",title:`Restart ${a.name}`,disabled:c,onClick:()=>d(a.name),children:(0,b.jsx)(e.Icons.refresh,{})})]})}function X({id:a,running:c}){let[d,f]=(0,m.useState)(null),[g,h]=(0,m.useState)(null),[j,k]=(0,m.useTransition)(),l=(0,m.useCallback)(async()=>{try{let b=await fetch(`/api/v1/boxes/${encodeURIComponent(a)}/services`,{credentials:"same-origin"});if(!b.ok)return void h(`status ${String(b.status)}`);f(await b.json()),h(null)}catch(a){h(a instanceof Error?a.message:String(a))}},[a]);(0,m.useEffect)(()=>{if(l(),!c)return;let a=setInterval(()=>void l(),4e3);return()=>clearInterval(a)},[l,c]);let p=b=>{k(async()=>{let c=await R(a,b);c.ok||window.alert(`Restart failed: ${c.error}`),await l()})},q=d?.services??[],r=q.length>0;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(o.SectionLabel,{right:r?(0,b.jsxs)(n.Button,{variant:"outline",size:"sm",disabled:!c||j,onClick:()=>p(void 0),children:[(0,b.jsx)(e.Icons.refresh,{}),"Restart all"]}):null,children:"Services"}),(0,b.jsx)(i.Card,{className:"divide-y divide-border/60 overflow-hidden",children:d||g?g?(0,b.jsxs)("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:["Could not load services (",g,")."]}):r?(0,b.jsxs)(b.Fragment,{children:[d?.source==="persisted"?(0,b.jsx)("div",{className:"bg-muted/30 px-4 py-1.5 font-mono text-[11px] text-muted-foreground",children:"persisted snapshot — box not running"}):null,q.map(a=>(0,b.jsx)(W,{svc:a,disabled:!c||j,onRestart:a=>p(a)},a.name))]}):(0,b.jsx)("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:d?.source==="unavailable"?"No service status (box not running or no snapshot yet).":"No services declared in agentbox.yaml."}):(0,b.jsx)("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:"Loading…"})})]})}var Y=a.i(82337);a.s(["default",0,function(){let{id:a}=(0,c.useParams)(),{box:g,project:k}=(0,j.useStore)(),m=g(a);if(!m)return(0,b.jsxs)("div",{className:"mx-auto w-full max-w-[1080px] px-8 pb-16 pt-8",children:[(0,b.jsx)(s.BackLink,{to:"/",children:"All boxes"}),(0,b.jsx)(w.EmptyBox,{children:"This box no longer exists — it may have been destroyed."})]});let n=k(m.projectId);return(0,b.jsxs)("div",{className:"mx-auto w-full max-w-[1080px] px-8 pb-16 pt-8 max-sm:px-4",children:[(0,b.jsx)(s.BackLink,{to:"/projects/"+m.projectId,children:n?n.name:"Project"}),(0,b.jsxs)("div",{className:"flex items-start gap-4 max-md:flex-col",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsxs)("h1",{className:"flex flex-wrap items-center gap-3 text-[25px] font-semibold leading-tight tracking-[-0.025em]",children:[m.task,(0,b.jsx)(f.StatusBadge,{status:m.status})]}),(0,b.jsxs)("div",{className:"mt-1.5 text-sm text-muted-foreground",children:[(0,b.jsx)("span",{className:"font-mono text-secondary-foreground",children:m.id})," ·"," ",(0,b.jsx)("span",{className:"font-mono text-secondary-foreground",children:m.repo})," · ",m.host]})]}),(0,b.jsx)("div",{className:"ml-auto flex-none max-md:ml-0",children:(0,b.jsx)(t.BoxActions,{box:m,size:"lg"})})]}),m.error?(0,b.jsx)(h,{className:"mt-4 border-[var(--red-line)] bg-[var(--red-soft)] text-[var(--red)]",icon:e.Icons.warn,title:"Box errored",children:(0,b.jsx)("span",{className:"font-mono text-secondary-foreground",children:m.error})}):null,(0,b.jsx)(l,{boxId:m.id}),(0,b.jsx)(o.SectionLabel,{children:"Overview"}),(0,b.jsxs)(Y.StatGrid,{children:[(0,b.jsx)(Y.Stat,{k:"Status",v:(0,b.jsx)(f.StatusBadge,{status:m.status})}),(0,b.jsx)(Y.Stat,{k:"Agent CLI",v:m.agent,mono:!0}),(0,b.jsx)(Y.Stat,{k:"Commits",v:m.commits??"—",icon:e.Icons.commit}),(0,b.jsx)(Y.Stat,{k:"Files touched",v:m.filesTouched??"—",icon:e.Icons.file}),(0,b.jsx)(Y.Stat,{k:"Last activity",v:(0,b.jsx)(d.Ago,{ms:m.lastActivity}),mono:!0})]}),(0,b.jsx)(r,{box:m}),(0,b.jsx)(o.SectionLabel,{children:"Git operations"}),(0,b.jsx)(M,{box:m}),(0,b.jsx)(X,{id:m.id,running:"running"===m.status}),(0,b.jsx)(o.SectionLabel,{children:"Details"}),(0,b.jsxs)(i.Card,{className:"divide-y divide-border/60 overflow-hidden",children:[(0,b.jsx)(v,{k:"Box ID",v:m.id,mono:!0}),(0,b.jsx)(v,{k:"Project",v:n?n.name:"—",link:n?"/projects/"+m.projectId:null}),(0,b.jsx)(v,{k:"Repository",v:m.repo,mono:!0}),(0,b.jsx)(v,{k:"Branch",v:m.branch,mono:!0}),(0,b.jsx)(v,{k:"Host",v:m.host,mono:!0}),(0,b.jsx)(v,{k:"Created",v:new Date(m.createdAt).toLocaleString(),mono:!0})]})]})}],58099)}];
|
|
1
|
+
module.exports=[58099,a=>{"use strict";let b,c;var d,e=a.i(33552),f=a.i(74455),g=a.i(17607),h=a.i(97187),i=a.i(71152),j=a.i(86834);function k({className:a,icon:b,title:c,children:d}){return(0,e.jsxs)("div",{className:(0,j.cn)("relative flex w-full items-start gap-3 rounded-xl border p-4",a),children:[b?(0,e.jsx)(b,{className:"mt-0.5 size-4 flex-none"}):null,(0,e.jsxs)("div",{className:"min-w-0",children:[c?(0,e.jsx)("div",{className:"mb-0.5 text-[13.5px] font-semibold leading-tight",children:c}):null,(0,e.jsx)("div",{className:"text-[12.5px] leading-normal",children:d})]})]})}var l=a.i(87883),m=a.i(80007),n=a.i(60401);function o({boxId:a}){let{state:b}=(0,m.useStore)(),c=b.approvals.filter(b=>b.boxId===a).sort((a,b)=>a.createdAt-b.createdAt);return 0===c.length?null:(0,e.jsxs)("div",{className:"mt-4 overflow-hidden rounded-xl border border-[var(--amber-line)] bg-[var(--amber-soft)]",children:[(0,e.jsxs)("div",{className:"flex items-center gap-2 border-b border-[var(--amber-line)] px-4 py-2.5",children:[(0,e.jsx)(h.Icons.shield,{className:"size-4 flex-none text-[var(--amber)]"}),(0,e.jsxs)("span",{className:"text-[13.5px] font-semibold",children:[c.length," pending approval",1===c.length?"":"s"]}),(0,e.jsx)("span",{className:"text-[12.5px] text-muted-foreground",children:"— this box is waiting on you."})]}),(0,e.jsx)("div",{className:"divide-y divide-[var(--amber-line)]",children:c.map(a=>(0,e.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3",children:[(0,e.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,e.jsx)("div",{className:"truncate font-mono text-[13px] text-secondary-foreground",children:a.command??a.message}),a.detail?(0,e.jsx)("div",{className:"mt-0.5 truncate text-[11.5px] text-muted-foreground",children:a.detail}):null,a.cwd?(0,e.jsx)("div",{className:"mt-0.5 truncate font-mono text-[11px] text-[#a4a9b0]",children:a.cwd}):null,(0,e.jsx)("div",{className:"mt-0.5 font-mono text-[11px] text-[#a4a9b0]",children:(0,e.jsx)(g.Ago,{ms:a.createdAt})})]}),(0,e.jsx)("div",{className:"flex-none pt-0.5",children:(0,e.jsx)(n.ApprovalActions,{id:a.id})})]},a.id))})]})}var p=a.i(50253),q=a.i(18071);function r(a,b,{checkForDefaultPrevented:c=!0}={}){return function(d){if(a?.(d),!1===c||!d||!d.defaultPrevented)return b?.(d)}}function s(a,b){if("function"==typeof a)return a(b);null!=a&&(a.current=b)}function t(...a){return p.useCallback(function(...a){return b=>{let c=!1,d=a.map(a=>{let d=s(a,b);return c||"function"!=typeof d||(c=!0),d});if(c)return()=>{for(let b=0;b<d.length;b++){let c=d[b];"function"==typeof c?c():s(a[b],null)}}}}(...a),a)}function u(a,b=[]){let c=[],d=()=>{let b=c.map(a=>p.createContext(a));return function(c){let d=c?.[a]||b;return p.useMemo(()=>({[`__scope${a}`]:{...c,[a]:d}}),[c,d])}};return d.scopeName=a,[function(b,d){let f=p.createContext(d);f.displayName=b+"Context";let g=c.length;c=[...c,d];let h=b=>{let{scope:c,children:d,...h}=b,i=c?.[a]?.[g]||f,j=p.useMemo(()=>h,Object.values(h));return(0,e.jsx)(i.Provider,{value:j,children:d})};return h.displayName=b+"Provider",[h,function(c,e,h={}){let{optional:i=!1}=h,j=e?.[a]?.[g]||f,k=p.useContext(j);if(k)return k;if(void 0!==d)return d;if(!i)throw Error(`\`${c}\` must be used within \`${b}\``)}]},function(...a){let b=a[0];if(1===a.length)return b;let c=()=>{let c=a.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(a){let d=c.reduce((b,{useScope:c,scopeName:d})=>{let e=c(a)[`__scope${d}`];return{...b,...e}},{});return p.useMemo(()=>({[`__scope${b.scopeName}`]:d}),[d])}};return c.scopeName=b.scopeName,c}(d,...b)]}var v=a.i(48365),w=Symbol.for("radix.slottable"),x=Symbol.for("react.lazy");function y(a){var b;return null!=a&&"object"==typeof a&&"$$typeof"in a&&a.$$typeof===x&&"_payload"in a&&"object"==typeof(b=a._payload)&&null!==b&&"then"in b}var z=p[" use ".trim().toString()],A=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((a,b)=>{var c;let d,f=(c=`Primitive.${b}`,(d=p.forwardRef((a,b)=>{var d;let e,f,{children:g,...h}=a,i=null,j=!1,k=[];y(g)&&"function"==typeof z&&(g=z(g._payload)),p.Children.forEach(g,a=>{var b;if(b=a,p.isValidElement(b)&&"function"==typeof b.type&&"__radixId"in b.type&&b.type.__radixId===w){j=!0;let b="child"in a.props?a.props.child:a.props.children;y(b)&&"function"==typeof z&&(b=z(b._payload)),i=((a,b)=>{if("child"in a.props){let b=a.props.child;return p.isValidElement(b)?p.cloneElement(b,void 0,a.props.children(b.props.children)):null}return p.isValidElement(b)?b:null})(a,b),k.push(i?.props?.children)}else k.push(a)}),i?i=p.cloneElement(i,void 0,k):!j&&1===p.Children.count(g)&&p.isValidElement(g)&&(i=g);let l=i?(d=i,(f=(e=Object.getOwnPropertyDescriptor(d.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?d.ref:(f=(e=Object.getOwnPropertyDescriptor(d,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?d.props.ref:d.props.ref||d.ref):void 0,m=t(b,l);if(!i){if(g||0===g){let a,b;throw Error(j?(a=c,`${a} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`):(b=c,`${b} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`))}return g}let n=function(a,b){let c={...b};for(let d in b){let e=a[d],f=b[d];/^on[A-Z]/.test(d)?e&&f?c[d]=(...a)=>{let b=f(...a);return e(...a),b}:e&&(c[d]=e):"style"===d?c[d]={...e,...f}:"className"===d&&(c[d]=[e,f].filter(Boolean).join(" "))}return{...a,...c}}(h,i.props??{});return i.type!==p.Fragment&&(n.ref=b?m:l),p.cloneElement(i,n)})).displayName=`${c}.Slot`,d),g=p.forwardRef((a,c)=>{let{asChild:d,...g}=a;return(0,e.jsx)(d?f:b,{...g,ref:c})});return g.displayName=`Primitive.${b}`,{...a,[b]:g}},{});function B(a){let b=p.useRef(a);return p.useEffect(()=>{b.current=a}),p.useMemo(()=>(...a)=>b.current?.(...a),[])}var C="dismissableLayer.update",D=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),E=p.forwardRef((a,b)=>{let{disableOutsidePointerEvents:c=!1,deferPointerDownOutside:f=!1,onEscapeKeyDown:g,onPointerDownOutside:h,onFocusOutside:i,onInteractOutside:j,onDismiss:k,...l}=a,m=p.useContext(D),[n,o]=p.useState(null),q=n?.ownerDocument??globalThis?.document,[,s]=p.useState({}),u=t(b,o),v=Array.from(m.layers),[w]=[...m.layersWithOutsidePointerEventsDisabled].slice(-1),x=w?v.indexOf(w):-1,y=n?v.indexOf(n):-1,z=m.layersWithOutsidePointerEventsDisabled.size>0,E=y>=x,I=p.useRef(!1),J=function(a,b){let{ownerDocument:c=globalThis?.document,deferPointerDownOutside:d=!1,isDeferredPointerDownOutsideRef:e,dismissableSurfaces:f,shouldHandlePointerDownOutside:g=F}=b,h=B(a),i=p.useRef(!1),j=p.useRef(!1),k=p.useRef(new Map),l=p.useRef(()=>{});return p.useEffect(()=>{function a(){j.current=!1,e.current=!1,k.current.clear()}function b(a){if(!j.current)return;let b=a.target;b instanceof Node&&[...f].some(a=>a.contains(b))||k.current.set(a.type,!0),"click"===a.type&&window.setTimeout(()=>{j.current&&l.current()},0)}function m(a){j.current&&k.current.set(a.type,!1)}let n=b=>{if(b.target&&!i.current){let f=function(){c.removeEventListener("click",l.current);let b=Array.from(k.current.values()).some(Boolean);a(),b||H("dismissableLayer.pointerDownOutside",h,m,{discrete:!0})};if(!g(b.target)){c.removeEventListener("click",l.current),a(),i.current=!1;return}let m={originalEvent:b};j.current=!0,e.current=d&&0===b.button,k.current.clear(),d&&0===b.button?(c.removeEventListener("click",l.current),l.current=f,c.addEventListener("click",l.current,{once:!0})):f()}else c.removeEventListener("click",l.current),a();i.current=!1},o=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(let a of o)c.addEventListener(a,b,!0),c.addEventListener(a,m);let p=window.setTimeout(()=>{c.addEventListener("pointerdown",n)},0);return()=>{for(let a of(window.clearTimeout(p),c.removeEventListener("pointerdown",n),c.removeEventListener("click",l.current),o))c.removeEventListener(a,b,!0),c.removeEventListener(a,m)}},[c,h,d,e,f,g]),{onPointerDownCapture:()=>i.current=!0}}(a=>{h?.(a),j?.(a),a.defaultPrevented||k?.()},{ownerDocument:q,deferPointerDownOutside:f,isDeferredPointerDownOutsideRef:I,dismissableSurfaces:m.dismissableSurfaces,shouldHandlePointerDownOutside:p.useCallback(a=>{if(!(a instanceof Node))return!1;let b=[...m.branches].some(b=>b.contains(a));return E&&!b},[m.branches,E])}),K=function(a,b=globalThis?.document){let c=B(a),d=p.useRef(!1);return p.useEffect(()=>{let a=a=>{a.target&&!d.current&&H("dismissableLayer.focusOutside",c,{originalEvent:a},{discrete:!1})};return b.addEventListener("focusin",a),()=>b.removeEventListener("focusin",a)},[b,c]),{onFocusCapture:()=>d.current=!0,onBlurCapture:()=>d.current=!1}}(a=>{if(f&&I.current)return;let b=a.target;![...m.branches].some(a=>a.contains(b))&&(i?.(a),j?.(a),a.defaultPrevented||k?.())},q),L=!!n&&y===v.length-1,M=B(a=>{"Escape"===a.key&&(g?.(a),!a.defaultPrevented&&k&&(a.preventDefault(),k()))});return p.useEffect(()=>{if(L)return q.addEventListener("keydown",M,{capture:!0}),()=>q.removeEventListener("keydown",M,{capture:!0})},[q,L,M]),p.useEffect(()=>{if(n)return c&&(0===m.layersWithOutsidePointerEventsDisabled.size&&(d=q.body.style.pointerEvents,q.body.style.pointerEvents="none"),m.layersWithOutsidePointerEventsDisabled.add(n)),m.layers.add(n),G(),()=>{c&&(m.layersWithOutsidePointerEventsDisabled.delete(n),0===m.layersWithOutsidePointerEventsDisabled.size&&(q.body.style.pointerEvents=d))}},[n,q,c,m]),p.useEffect(()=>()=>{n&&(m.layers.delete(n),m.layersWithOutsidePointerEventsDisabled.delete(n),G())},[n,m]),p.useEffect(()=>{let a=()=>s({});return document.addEventListener(C,a),()=>document.removeEventListener(C,a)},[]),(0,e.jsx)(A.div,{...l,ref:u,style:{pointerEvents:z?E?"auto":"none":void 0,...a.style},onFocusCapture:r(a.onFocusCapture,K.onFocusCapture),onBlurCapture:r(a.onBlurCapture,K.onBlurCapture),onPointerDownCapture:r(a.onPointerDownCapture,J.onPointerDownCapture)})});E.displayName="DismissableLayer",p.forwardRef((a,b)=>{let c=p.useContext(D),d=p.useRef(null),f=t(b,d);return p.useEffect(()=>{let a=d.current;if(a)return c.branches.add(a),()=>{c.branches.delete(a)}},[c.branches]),(0,e.jsx)(A.div,{...a,ref:f})}).displayName="DismissableLayerBranch";var F=()=>!0;function G(){let a=new CustomEvent(C);document.dispatchEvent(a)}function H(a,b,c,{discrete:d}){let e=c.originalEvent.target,f=new CustomEvent(a,{bubbles:!1,cancelable:!0,detail:c});if(b&&e.addEventListener(a,b,{once:!0}),d)e&&v.flushSync(()=>e.dispatchEvent(f));else e.dispatchEvent(f)}var I=globalThis?.document?p.useLayoutEffect:()=>{},J=p[" useId ".trim().toString()]||(()=>void 0),K=0;let L=["top","right","bottom","left"],M=Math.min,N=Math.max,O=Math.round,P=Math.floor,Q=a=>({x:a,y:a}),R={left:"right",right:"left",bottom:"top",top:"bottom"};function S(a,b){return"function"==typeof a?a(b):a}function T(a){return a.split("-")[0]}function U(a){return a.split("-")[1]}function V(a){return"x"===a?"y":"x"}function W(a){return"y"===a?"height":"width"}function X(a){let b=a[0];return"t"===b||"b"===b?"y":"x"}function Y(a){return a.includes("start")?a.replace("start","end"):a.replace("end","start")}let Z=["left","right"],$=["right","left"],_=["top","bottom"],aa=["bottom","top"];function ab(a){let b=T(a);return R[b]+a.slice(b.length)}function ac(a){return"number"!=typeof a?{top:0,right:0,bottom:0,left:0,...a}:{top:a,right:a,bottom:a,left:a}}function ad(a){let{x:b,y:c,width:d,height:e}=a;return{width:d,height:e,top:c,left:b,right:b+d,bottom:c+e,x:b,y:c}}function ae(a,b,c){let d,{reference:e,floating:f}=a,g=X(b),h=V(X(b)),i=W(h),j=T(b),k="y"===g,l=e.x+e.width/2-f.width/2,m=e.y+e.height/2-f.height/2,n=e[i]/2-f[i]/2;switch(j){case"top":d={x:l,y:e.y-f.height};break;case"bottom":d={x:l,y:e.y+e.height};break;case"right":d={x:e.x+e.width,y:m};break;case"left":d={x:e.x-f.width,y:m};break;default:d={x:e.x,y:e.y}}switch(U(b)){case"start":d[h]-=n*(c&&k?-1:1);break;case"end":d[h]+=n*(c&&k?-1:1)}return d}async function af(a,b){var c;void 0===b&&(b={});let{x:d,y:e,platform:f,rects:g,elements:h,strategy:i}=a,{boundary:j="clippingAncestors",rootBoundary:k="viewport",elementContext:l="floating",altBoundary:m=!1,padding:n=0}=S(b,a),o=ac(n),p=h[m?"floating"===l?"reference":"floating":l],q=ad(await f.getClippingRect({element:null==(c=await (null==f.isElement?void 0:f.isElement(p)))||c?p:p.contextElement||await (null==f.getDocumentElement?void 0:f.getDocumentElement(h.floating)),boundary:j,rootBoundary:k,strategy:i})),r="floating"===l?{x:d,y:e,width:g.floating.width,height:g.floating.height}:g.reference,s=await (null==f.getOffsetParent?void 0:f.getOffsetParent(h.floating)),t=await (null==f.isElement?void 0:f.isElement(s))&&await (null==f.getScale?void 0:f.getScale(s))||{x:1,y:1},u=ad(f.convertOffsetParentRelativeRectToViewportRelativeRect?await f.convertOffsetParentRelativeRectToViewportRelativeRect({elements:h,rect:r,offsetParent:s,strategy:i}):r);return{top:(q.top-u.top+o.top)/t.y,bottom:(u.bottom-q.bottom+o.bottom)/t.y,left:(q.left-u.left+o.left)/t.x,right:(u.right-q.right+o.right)/t.x}}let ag=async(a,b,c)=>{let{placement:d="bottom",strategy:e="absolute",middleware:f=[],platform:g}=c,h=g.detectOverflow?g:{...g,detectOverflow:af},i=await (null==g.isRTL?void 0:g.isRTL(b)),j=await g.getElementRects({reference:a,floating:b,strategy:e}),{x:k,y:l}=ae(j,d,i),m=d,n=0,o={};for(let c=0;c<f.length;c++){let p=f[c];if(!p)continue;let{name:q,fn:r}=p,{x:s,y:t,data:u,reset:v}=await r({x:k,y:l,initialPlacement:d,placement:m,strategy:e,middlewareData:o,rects:j,platform:h,elements:{reference:a,floating:b}});k=null!=s?s:k,l=null!=t?t:l,o[q]={...o[q],...u},v&&n<50&&(n++,"object"==typeof v&&(v.placement&&(m=v.placement),v.rects&&(j=!0===v.rects?await g.getElementRects({reference:a,floating:b,strategy:e}):v.rects),{x:k,y:l}=ae(j,m,i)),c=-1)}return{x:k,y:l,placement:m,strategy:e,middlewareData:o}};function ah(a,b){return{top:a.top-b.height,right:a.right-b.width,bottom:a.bottom-b.height,left:a.left-b.width}}function ai(a){return L.some(b=>a[b]>=0)}let aj=new Set(["left","top"]);async function ak(a,b){let{placement:c,platform:d,elements:e}=a,f=await (null==d.isRTL?void 0:d.isRTL(e.floating)),g=T(c),h=U(c),i="y"===X(c),j=aj.has(g)?-1:1,k=f&&i?-1:1,l=S(b,a),{mainAxis:m,crossAxis:n,alignmentAxis:o}="number"==typeof l?{mainAxis:l,crossAxis:0,alignmentAxis:null}:{mainAxis:l.mainAxis||0,crossAxis:l.crossAxis||0,alignmentAxis:l.alignmentAxis};return h&&"number"==typeof o&&(n="end"===h?-1*o:o),i?{x:n*k,y:m*j}:{x:m*j,y:n*k}}function al(a){return function(a){return!1}(a)?(a.nodeName||"").toLowerCase():"#document"}function am(a){var b;return(null==a||null==(b=a.ownerDocument)?void 0:b.defaultView)||window}function an(a){var b;return null==(b=(function(a){return!1}(a)?a.ownerDocument:a.document)||window.document)?void 0:b.documentElement}function ao(a){return!1}function ap(a){let{overflow:b,overflowX:c,overflowY:d,display:e}=ax(a);return/auto|scroll|overlay|hidden|clip/.test(b+d+c)&&"inline"!==e&&"contents"!==e}function aq(a){try{if(a.matches(":popover-open"))return!0}catch(a){}try{return a.matches(":modal")}catch(a){return!1}}let ar=/transform|translate|scale|rotate|perspective|filter/,as=/paint|layout|strict|content/,at=a=>!!a&&"none"!==a;function au(a){let b=a;return at(b.transform)||at(b.translate)||at(b.scale)||at(b.rotate)||at(b.perspective)||!av()&&(at(b.backdropFilter)||at(b.filter))||ar.test(b.willChange||"")||as.test(b.contain||"")}function av(){return null==b&&(b="u">typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),b}function aw(a){return/^(html|body|#document)$/.test(al(a))}function ax(a){return am(a).getComputedStyle(a)}function ay(a){return{scrollLeft:a.scrollX,scrollTop:a.scrollY}}function az(a){if("html"===al(a))return a;let b=a.assignedSlot||a.parentNode||an(a);return b}function aA(a,b,c){var d;void 0===b&&(b=[]),void 0===c&&(c=!0);let e=function a(b){let c=az(b);return aw(c)?b.ownerDocument?b.ownerDocument.body:b.body:a(c)}(a),f=e===(null==(d=a.ownerDocument)?void 0:d.body),g=am(e);if(!f)return b.concat(e,aA(e,[],c));{let a=aB(g);return b.concat(g,g.visualViewport||[],ap(e)?e:[],a&&c?aA(a):[])}}function aB(a){return a.parent&&Object.getPrototypeOf(a.parent)?a.frameElement:null}function aC(a){let b=ax(a),c=parseFloat(b.width)||0,d=parseFloat(b.height)||0,e=c,f=d,g=O(c)!==e||O(d)!==f;return g&&(c=e,d=f),{width:c,height:d,$:g}}function aD(a){return 0,a.contextElement}function aE(a){let b=aD(a);1;return Q(1)}let aF=Q(0);function aG(a){let b=am(a);return av()&&b.visualViewport?{x:b.visualViewport.offsetLeft,y:b.visualViewport.offsetTop}:aF}function aH(a,b,c,d){var e;void 0===b&&(b=!1),void 0===c&&(c=!1);let f=a.getBoundingClientRect(),g=aD(a),h=Q(1);b&&(d||(h=aE(a)));let i=(void 0===(e=c)&&(e=!1),d&&(!e||d===am(g))&&e)?aG(g):Q(0),j=(f.left+i.x)/h.x,k=(f.top+i.y)/h.y,l=f.width/h.x,m=f.height/h.y;if(g){let a=am(g),b=d,c=a,e=aB(c);for(;e&&d&&b!==c;){let a=aE(e),b=e.getBoundingClientRect(),d=ax(e),f=b.left+(e.clientLeft+parseFloat(d.paddingLeft))*a.x,g=b.top+(e.clientTop+parseFloat(d.paddingTop))*a.y;j*=a.x,k*=a.y,l*=a.x,m*=a.y,j+=f,k+=g,e=aB(c=am(e))}}return ad({width:l,height:m,x:j,y:k})}function aI(a,b){let c=ay(a).scrollLeft;return b?b.left+c:aH(an(a)).left+c}function aJ(a,b){let c=a.getBoundingClientRect();return{x:c.left+b.scrollLeft-aI(a,c),y:c.top+b.scrollTop}}function aK(a,b,c){var d;let e;if("viewport"===b)e=function(a,b){let c=am(a),d=an(a),e=c.visualViewport,f=d.clientWidth,g=d.clientHeight,h=0,i=0;if(e){f=e.width,g=e.height;let a=av();(!a||a&&"fixed"===b)&&(h=e.offsetLeft,i=e.offsetTop)}let j=aI(d);if(j<=0){let a=d.ownerDocument,b=a.body,c=getComputedStyle(b),e="CSS1Compat"===a.compatMode&&parseFloat(c.marginLeft)+parseFloat(c.marginRight)||0,g=Math.abs(d.clientWidth-b.clientWidth-e);g<=25&&(f-=g)}else j<=25&&(f+=j);return{width:f,height:g,x:h,y:i}}(a,c);else if("document"===b){let b,c,f,g,h,i,j;d=an(a),b=an(d),c=ay(d),f=d.ownerDocument.body,g=N(b.scrollWidth,b.clientWidth,f.scrollWidth,f.clientWidth),h=N(b.scrollHeight,b.clientHeight,f.scrollHeight,f.clientHeight),i=-c.scrollLeft+aI(d),j=-c.scrollTop,"rtl"===ax(f).direction&&(i+=N(b.clientWidth,f.clientWidth)-g),e={width:g,height:h,x:i,y:j}}else if(1){let c=aG(a);e={x:b.x-c.x,y:b.y-c.y,width:b.width,height:b.height}}else{let a,d,f,g,h,i;d=(a=aH(b,!0,"fixed"===c)).top+b.clientTop,f=a.left+b.clientLeft,g=Q(1),h=b.clientWidth*g.x,i=b.clientHeight*g.y,e={width:h,height:i,x:f*g.x,y:d*g.y}}return ad(e)}function aL(a){return"static"===ax(a).position}function aM(a,b){1;return null}function aN(a,b){var c;let d=am(a);if(aq(a))return d;1;{let b=az(a);for(;b&&!aw(b);){0;b=az(b)}return d}}let aO=async function(a){let b=this.getOffsetParent||aN,c=this.getDimensions,d=await c(a.floating);return{reference:function(a,b,c){let d=an(b),e="fixed"===c,f=aH(a,!0,e,b),g={scrollLeft:0,scrollTop:0},h=Q(0);if(!e)if(("body"!==al(b)||ap(d))&&(g=ay(b)),1)d&&(h.x=aI(d));else{let a=aH(b,!0,e,b);h.x=a.x+b.clientLeft,h.y=a.y+b.clientTop}e&&d&&(h.x=aI(d));let i=!d||e?Q(0):aJ(d,g);return{x:f.left+g.scrollLeft-h.x-i.x,y:f.top+g.scrollTop-h.y-i.y,width:f.width,height:f.height}}(a.reference,await b(a.floating),a.strategy),floating:{x:0,y:0,width:d.width,height:d.height}}},aP={convertOffsetParentRelativeRectToViewportRelativeRect:function(a){let{elements:b,rect:c,offsetParent:d,strategy:e}=a,f="fixed"===e,g=an(d),h=!!b&&aq(b.floating);if(d===g||h&&f)return c;let i={scrollLeft:0,scrollTop:0},j=Q(1),k=Q(0);!f&&(("body"!==al(d)||ap(g))&&(i=ay(d)),0);let l=!g||f?Q(0):aJ(g,i);return{width:c.width*j.x,height:c.height*j.y,x:c.x*j.x-i.scrollLeft*j.x+k.x+l.x,y:c.y*j.y-i.scrollTop*j.y+k.y+l.y}},getDocumentElement:an,getClippingRect:function(a){let{element:b,boundary:c,rootBoundary:d,strategy:e}=a,f=[..."clippingAncestors"===c?aq(b)?[]:function(a,b){let c=b.get(a);if(c)return c;let d=aA(a,[],!1).filter(a=>!1),e="fixed"===ax(a).position,f=e?az(a):a;return b.set(a,d),d}(b,this._c):[].concat(c),d],g=aK(b,f[0],e),h=g.top,i=g.right,j=g.bottom,k=g.left;for(let a=1;a<f.length;a++){let c=aK(b,f[a],e);h=N(c.top,h),i=M(c.right,i),j=M(c.bottom,j),k=N(c.left,k)}return{width:i-k,height:j-h,x:k,y:h}},getOffsetParent:aN,getElementRects:aO,getClientRects:function(a){return Array.from(a.getClientRects())},getDimensions:function(a){let{width:b,height:c}=aC(a);return{width:b,height:c}},getScale:aE,isElement:ao,isRTL:function(a){return"rtl"===ax(a).direction}};function aQ(a,b){return a.x===b.x&&a.y===b.y&&a.width===b.width&&a.height===b.height}let aR=a=>({name:"arrow",options:a,async fn(b){let{x:c,y:d,placement:e,rects:f,platform:g,elements:h,middlewareData:i}=b,{element:j,padding:k=0}=S(a,b)||{};if(null==j)return{};let l=ac(k),m={x:c,y:d},n=V(X(e)),o=W(n),p=await g.getDimensions(j),q="y"===n,r=q?"clientHeight":"clientWidth",s=f.reference[o]+f.reference[n]-m[n]-f.floating[o],t=m[n]-f.reference[n],u=await (null==g.getOffsetParent?void 0:g.getOffsetParent(j)),v=u?u[r]:0;v&&await (null==g.isElement?void 0:g.isElement(u))||(v=h.floating[r]||f.floating[o]);let w=v/2-p[o]/2-1,x=M(l[q?"top":"left"],w),y=M(l[q?"bottom":"right"],w),z=v-p[o]-y,A=v/2-p[o]/2+(s/2-t/2),B=N(x,M(A,z)),C=!i.arrow&&null!=U(e)&&A!==B&&f.reference[o]/2-(A<x?x:y)-p[o]/2<0,D=C?A<x?A-x:A-z:0;return{[n]:m[n]+D,data:{[n]:B,centerOffset:A-B-D,...C&&{alignmentOffset:D}},reset:C}}});var aS="u">typeof document?p.useLayoutEffect:function(){};function aT(a,b){let c,d,e;if(a===b)return!0;if(typeof a!=typeof b)return!1;if("function"==typeof a&&a.toString()===b.toString())return!0;if(a&&b&&"object"==typeof a){if(Array.isArray(a)){if((c=a.length)!==b.length)return!1;for(d=c;0!=d--;)if(!aT(a[d],b[d]))return!1;return!0}if((c=(e=Object.keys(a)).length)!==Object.keys(b).length)return!1;for(d=c;0!=d--;)if(!({}).hasOwnProperty.call(b,e[d]))return!1;for(d=c;0!=d--;){let c=e[d];if(("_owner"!==c||!a.$$typeof)&&!aT(a[c],b[c]))return!1}return!0}return a!=a&&b!=b}function aU(a,b){return Math.round(+b)/1}function aV(a){let b=p.useRef(a);return aS(()=>{b.current=a}),b}var aW=p.forwardRef((a,b)=>{let{children:c,width:d=10,height:f=5,...g}=a;return(0,e.jsx)(A.svg,{...g,ref:b,width:d,height:f,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:a.asChild?c:(0,e.jsx)("polygon",{points:"0,0 30,0 15,10"})})});aW.displayName="Arrow";var aX="Popper",[aY,aZ]=u(aX),[a$,a_]=aY(aX),a0=a=>{let{__scopePopper:b,children:c}=a,[d,f]=p.useState(null),[g,h]=p.useState(void 0);return(0,e.jsx)(a$,{scope:b,anchor:d,onAnchorChange:f,placementState:g,setPlacementState:h,children:c})};a0.displayName=aX;var a1="PopperAnchor",a2=p.forwardRef((a,b)=>{let{__scopePopper:c,virtualRef:d,...f}=a,g=a_(a1,c),h=p.useRef(null),i=g.onAnchorChange,j=t(b,p.useCallback(a=>{h.current=a,a&&i(a)},[i])),k=p.useRef(null);p.useEffect(()=>{if(!d)return;let a=k.current;k.current=d.current,a!==k.current&&i(k.current)});let l=g.placementState&&bc(g.placementState),m=l?.[0],n=l?.[1];return d?null:(0,e.jsx)(A.div,{"data-radix-popper-side":m,"data-radix-popper-align":n,...f,ref:j})});a2.displayName=a1;var a3="PopperContent",[a4,a5]=aY(a3),a6=p.forwardRef((a,b)=>{var c,d,f,g,h,i,j,k,l,m,n,o,q;let r,s,u,w,x,y,{__scopePopper:z,side:C="bottom",sideOffset:D=0,align:E="center",alignOffset:F=0,arrowPadding:G=0,avoidCollisions:H=!0,collisionBoundary:J=[],collisionPadding:K=0,sticky:L="partial",hideWhenDetached:O=!1,updatePositionStrategy:Q="optimized",onPlaced:R,...ac}=a,ad=a_(a3,z),[ae,af]=p.useState(null),al=t(b,af),[am,ao]=p.useState(null),ap=function(a){let[b,c]=p.useState(void 0);return I(()=>{if(a){c({width:a.offsetWidth,height:a.offsetHeight});let b=new ResizeObserver(b=>{let d,e;if(!Array.isArray(b)||!b.length)return;let f=b[0];if("borderBoxSize"in f){let a=f.borderBoxSize,b=Array.isArray(a)?a[0]:a;d=b.inlineSize,e=b.blockSize}else d=a.offsetWidth,e=a.offsetHeight;c({width:d,height:e})});return b.observe(a,{box:"border-box"}),()=>b.unobserve(a)}c(void 0)},[a]),b}(am),aq=ap?.width??0,ar=ap?.height??0,as="number"==typeof K?K:{top:0,right:0,bottom:0,left:0,...K},at=Array.isArray(J)?J:[J],au=at.length>0,av={padding:as,boundary:at.filter(ba),altBoundary:au},{refs:aw,floatingStyles:ax,placement:ay,isPositioned:az,middlewareData:aB}=function(a){void 0===a&&(a={});let{placement:b="bottom",strategy:c="absolute",middleware:d=[],platform:e,elements:{reference:f,floating:g}={},transform:h=!0,whileElementsMounted:i,open:j}=a,[k,l]=p.useState({x:0,y:0,strategy:c,placement:b,middlewareData:{},isPositioned:!1}),[m,n]=p.useState(d);aT(m,d)||n(d);let[o,q]=p.useState(null),[r,s]=p.useState(null),t=p.useCallback(a=>{a!==y.current&&(y.current=a,q(a))},[]),u=p.useCallback(a=>{a!==z.current&&(z.current=a,s(a))},[]),w=f||o,x=g||r,y=p.useRef(null),z=p.useRef(null),A=p.useRef(k),B=null!=i,C=aV(i),D=aV(e),E=aV(j),F=p.useCallback(()=>{var a,d;let e,f,g;if(!y.current||!z.current)return;let h={placement:b,strategy:c,middleware:m};D.current&&(h.platform=D.current),(a=y.current,d=z.current,e=new Map,g={...(f={platform:aP,...h}).platform,_c:e},ag(a,d,{...f,platform:g})).then(a=>{let b={...a,isPositioned:!1!==E.current};G.current&&!aT(A.current,b)&&(A.current=b,v.flushSync(()=>{l(b)}))})},[m,b,c,D,E]);aS(()=>{!1===j&&A.current.isPositioned&&(A.current.isPositioned=!1,l(a=>({...a,isPositioned:!1})))},[j]);let G=p.useRef(!1);aS(()=>(G.current=!0,()=>{G.current=!1}),[]),aS(()=>{if(w&&(y.current=w),x&&(z.current=x),w&&x){if(C.current)return C.current(w,x,F);F()}},[w,x,F,C,B]);let H=p.useMemo(()=>({reference:y,floating:z,setReference:t,setFloating:u}),[t,u]),I=p.useMemo(()=>({reference:w,floating:x}),[w,x]),J=p.useMemo(()=>{let a={position:c,left:0,top:0};if(!I.floating)return a;let b=aU(I.floating,k.x),d=aU(I.floating,k.y);if(h)return{...a,transform:"translate("+b+"px, "+d+"px)",...(I.floating,false)};return{position:c,left:b,top:d}},[c,h,I.floating,k.x,k.y]);return p.useMemo(()=>({...k,update:F,refs:H,elements:I,floatingStyles:J}),[k,F,H,I,J])}({strategy:"fixed",placement:C+("center"!==E?"-"+E:""),whileElementsMounted:(...a)=>(function(a,b,c,d){let e;void 0===d&&(d={});let{ancestorScroll:f=!0,ancestorResize:g=!0,elementResize:h="function"==typeof ResizeObserver,layoutShift:i="function"==typeof IntersectionObserver,animationFrame:j=!1}=d,k=aD(a),l=f||g?[...k?aA(k):[],...b?aA(b):[]]:[];l.forEach(a=>{f&&a.addEventListener("scroll",c,{passive:!0}),g&&a.addEventListener("resize",c)});let m=k&&i?function(a,b){let c,d=null,e=an(a);function f(){var a;clearTimeout(c),null==(a=d)||a.disconnect(),d=null}return!function g(h,i){void 0===h&&(h=!1),void 0===i&&(i=1),f();let j=a.getBoundingClientRect(),{left:k,top:l,width:m,height:n}=j;if(h||b(),!m||!n)return;let o={rootMargin:-P(l)+"px "+-P(e.clientWidth-(k+m))+"px "+-P(e.clientHeight-(l+n))+"px "+-P(k)+"px",threshold:N(0,M(1,i))||1},p=!0;function q(b){let d=b[0].intersectionRatio;if(d!==i){if(!p)return g();d?g(!1,d):c=setTimeout(()=>{g(!1,1e-7)},1e3)}1!==d||aQ(j,a.getBoundingClientRect())||g(),p=!1}try{d=new IntersectionObserver(q,{...o,root:e.ownerDocument})}catch(a){d=new IntersectionObserver(q,o)}d.observe(a)}(!0),f}(k,c):null,n=-1,o=null;h&&(o=new ResizeObserver(a=>{let[d]=a;d&&d.target===k&&o&&b&&(o.unobserve(b),cancelAnimationFrame(n),n=requestAnimationFrame(()=>{var a;null==(a=o)||a.observe(b)})),c()}),k&&!j&&o.observe(k),b&&o.observe(b));let p=j?aH(a):null;return j&&function b(){let d=aH(a);p&&!aQ(p,d)&&c(),p=d,e=requestAnimationFrame(b)}(),c(),()=>{var a;l.forEach(a=>{f&&a.removeEventListener("scroll",c),g&&a.removeEventListener("resize",c)}),null==m||m(),null==(a=o)||a.disconnect(),o=null,j&&cancelAnimationFrame(e)}})(...a,{animationFrame:"always"===Q}),elements:{reference:ad.anchor},middleware:[{name:(r={name:"offset",options:d=c={mainAxis:D+ar,alignmentAxis:F},async fn(a){var b,c;let{x:e,y:f,placement:g,middlewareData:h}=a,i=await ak(a,d);return g===(null==(b=h.offset)?void 0:b.placement)&&null!=(c=h.arrow)&&c.alignmentOffset?{}:{x:e+i.x,y:f+i.y,data:{...i,placement:g}}}}).name,fn:r.fn,options:[c,void 0]},H&&{name:(s={name:"shift",options:h=g={mainAxis:!0,crossAxis:!1,limiter:"partial"===L?{fn:(f=void 0,{options:f={},fn(a){let{x:b,y:c,placement:d,rects:e,middlewareData:g}=a,{offset:h=0,mainAxis:i=!0,crossAxis:j=!0}=S(f,a),k={x:b,y:c},l=X(d),m=V(l),n=k[m],o=k[l],p=S(h,a),q="number"==typeof p?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(i){let a="y"===m?"height":"width",b=e.reference[m]-e.floating[a]+q.mainAxis,c=e.reference[m]+e.reference[a]-q.mainAxis;n<b?n=b:n>c&&(n=c)}if(j){var r,s;let a="y"===m?"width":"height",b=aj.has(T(d)),c=e.reference[l]-e.floating[a]+(b&&(null==(r=g.offset)?void 0:r[l])||0)+(b?0:q.crossAxis),f=e.reference[l]+e.reference[a]+(b?0:(null==(s=g.offset)?void 0:s[l])||0)-(b?q.crossAxis:0);o<c?o=c:o>f&&(o=f)}return{[m]:n,[l]:o}}}).fn,options:[void 0,void 0]}:void 0,...av},async fn(a){let{x:b,y:c,placement:d,platform:e}=a,{mainAxis:f=!0,crossAxis:g=!1,limiter:i={fn:a=>{let{x:b,y:c}=a;return{x:b,y:c}}},...j}=S(h,a),k={x:b,y:c},l=await e.detectOverflow(a,j),m=X(T(d)),n=V(m),o=k[n],p=k[m];if(f){let a="y"===n?"top":"left",b="y"===n?"bottom":"right",c=o+l[a],d=o-l[b];o=N(c,M(o,d))}if(g){let a="y"===m?"top":"left",b="y"===m?"bottom":"right",c=p+l[a],d=p-l[b];p=N(c,M(p,d))}let q=i.fn({...a,[n]:o,[m]:p});return{...q,data:{x:q.x-b,y:q.y-c,enabled:{[n]:f,[m]:g}}}}}).name,fn:s.fn,options:[g,void 0]},H&&{name:(u={name:"flip",options:j=i={...av},async fn(a){var b,c,d,e,f,g,h,i;let k,l,m,{placement:n,middlewareData:o,rects:p,initialPlacement:q,platform:r,elements:s}=a,{mainAxis:t=!0,crossAxis:u=!0,fallbackPlacements:v,fallbackStrategy:w="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:y=!0,...z}=S(j,a);if(null!=(b=o.arrow)&&b.alignmentOffset)return{};let A=T(n),B=X(q),C=T(q)===q,D=await (null==r.isRTL?void 0:r.isRTL(s.floating)),E=v||(C||!y?[ab(q)]:(k=ab(q),[Y(q),k,Y(k)])),F="none"!==x;!v&&F&&E.push(...(l=U(q),m=function(a,b,c){switch(a){case"top":case"bottom":if(c)return b?$:Z;return b?Z:$;case"left":case"right":return b?_:aa;default:return[]}}(T(q),"start"===x,D),l&&(m=m.map(a=>a+"-"+l),y&&(m=m.concat(m.map(Y)))),m));let G=[q,...E],H=await r.detectOverflow(a,z),I=[],J=(null==(c=o.flip)?void 0:c.overflows)||[];if(t&&I.push(H[A]),u){let a,b,c,d,e=(g=n,h=p,void 0===(i=D)&&(i=!1),a=U(g),c=W(b=V(X(g))),d="x"===b?a===(i?"end":"start")?"right":"left":"start"===a?"bottom":"top",h.reference[c]>h.floating[c]&&(d=ab(d)),[d,ab(d)]);I.push(H[e[0]],H[e[1]])}if(J=[...J,{placement:n,overflows:I}],!I.every(a=>a<=0)){let a=((null==(d=o.flip)?void 0:d.index)||0)+1,b=G[a];if(b&&("alignment"!==u||B===X(b)||J.every(a=>X(a.placement)!==B||a.overflows[0]>0)))return{data:{index:a,overflows:J},reset:{placement:b}};let c=null==(e=J.filter(a=>a.overflows[0]<=0).sort((a,b)=>a.overflows[1]-b.overflows[1])[0])?void 0:e.placement;if(!c)switch(w){case"bestFit":{let a=null==(f=J.filter(a=>{if(F){let b=X(a.placement);return b===B||"y"===b}return!0}).map(a=>[a.placement,a.overflows.filter(a=>a>0).reduce((a,b)=>a+b,0)]).sort((a,b)=>a[1]-b[1])[0])?void 0:f[0];a&&(c=a);break}case"initialPlacement":c=q}if(n!==c)return{reset:{placement:c}}}return{}}}).name,fn:u.fn,options:[i,void 0]},{name:(w={name:"size",options:l=k={...av,apply:({elements:a,rects:b,availableWidth:c,availableHeight:d})=>{let{width:e,height:f}=b.reference,g=a.floating.style;g.setProperty("--radix-popper-available-width",`${c}px`),g.setProperty("--radix-popper-available-height",`${d}px`),g.setProperty("--radix-popper-anchor-width",`${e}px`),g.setProperty("--radix-popper-anchor-height",`${f}px`)}},async fn(a){var b,c;let d,e,{placement:f,rects:g,platform:h,elements:i}=a,{apply:j=()=>{},...k}=S(l,a),m=await h.detectOverflow(a,k),n=T(f),o=U(f),p="y"===X(f),{width:q,height:r}=g.floating;"top"===n||"bottom"===n?(d=n,e=o===(await (null==h.isRTL?void 0:h.isRTL(i.floating))?"start":"end")?"left":"right"):(e=n,d="end"===o?"top":"bottom");let s=r-m.top-m.bottom,t=q-m.left-m.right,u=M(r-m[d],s),v=M(q-m[e],t),w=!a.middlewareData.shift,x=u,y=v;if(null!=(b=a.middlewareData.shift)&&b.enabled.x&&(y=t),null!=(c=a.middlewareData.shift)&&c.enabled.y&&(x=s),w&&!o){let a=N(m.left,0),b=N(m.right,0),c=N(m.top,0),d=N(m.bottom,0);p?y=q-2*(0!==a||0!==b?a+b:N(m.left,m.right)):x=r-2*(0!==c||0!==d?c+d:N(m.top,m.bottom))}await j({...a,availableWidth:y,availableHeight:x});let z=await h.getDimensions(i.floating);return q!==z.width||r!==z.height?{reset:{rects:!0}}:{}}}).name,fn:w.fn,options:[k,void 0]},am&&{name:(x={name:"arrow",options:n=m={element:am,padding:G},fn(a){let{element:b,padding:c}="function"==typeof n?n(a):n;return b&&({}).hasOwnProperty.call(b,"current")?null!=b.current?aR({element:b.current,padding:c}).fn(a):{}:b?aR({element:b,padding:c}).fn(a):{}}}).name,fn:x.fn,options:[m,void 0]},bb({arrowWidth:aq,arrowHeight:ar}),O&&{name:(y={name:"hide",options:q=o={strategy:"referenceHidden",...av,boundary:au?av.boundary:void 0},async fn(a){let{rects:b,platform:c}=a,{strategy:d="referenceHidden",...e}=S(q,a);switch(d){case"referenceHidden":{let d=ah(await c.detectOverflow(a,{...e,elementContext:"reference"}),b.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:ai(d)}}}case"escaped":{let d=ah(await c.detectOverflow(a,{...e,altBoundary:!0}),b.floating);return{data:{escapedOffsets:d,escaped:ai(d)}}}default:return{}}}}).name,fn:y.fn,options:[o,void 0]}]}),aC=ad.setPlacementState;I(()=>(aC(ay),()=>{aC(void 0)}),[ay,aC]);let[aE,aF]=bc(ay),aG=B(R);I(()=>{az&&aG?.()},[az,aG]);let aI=aB.arrow?.x,aJ=aB.arrow?.y,aK=aB.arrow?.centerOffset!==0,[aL,aM]=p.useState();return I(()=>{ae&&aM(window.getComputedStyle(ae).zIndex)},[ae]),(0,e.jsx)("div",{ref:aw.setFloating,"data-radix-popper-content-wrapper":"",style:{...ax,transform:az?ax.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:aL,"--radix-popper-transform-origin":[aB.transformOrigin?.x,aB.transformOrigin?.y].join(" "),...aB.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:a.dir,children:(0,e.jsx)(a4,{scope:z,placedSide:aE,placedAlign:aF,onArrowChange:ao,arrowX:aI,arrowY:aJ,shouldHideArrow:aK,children:(0,e.jsx)(A.div,{"data-side":aE,"data-align":aF,...ac,ref:al,style:{...ac.style,animation:az?void 0:"none"}})})})});a6.displayName=a3;var a7="PopperArrow",a8={top:"bottom",right:"left",bottom:"top",left:"right"},a9=p.forwardRef(function(a,b){let{__scopePopper:c,...d}=a,f=a5(a7,c),g=a8[f.placedSide];return(0,e.jsx)("span",{ref:f.onArrowChange,style:{position:"absolute",left:f.arrowX,top:f.arrowY,[g]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[f.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[f.placedSide],visibility:f.shouldHideArrow?"hidden":void 0},children:(0,e.jsx)(aW,{...d,ref:b,style:{...d.style,display:"block"}})})});function ba(a){return null!==a}a9.displayName=a7;var bb=a=>({name:"transformOrigin",options:a,fn(b){let{placement:c,rects:d,middlewareData:e}=b,f=e.arrow?.centerOffset!==0,g=f?0:a.arrowWidth,h=f?0:a.arrowHeight,[i,j]=bc(c),k={start:"0%",center:"50%",end:"100%"}[j],l=(e.arrow?.x??0)+g/2,m=(e.arrow?.y??0)+h/2,n="",o="";return"bottom"===i?(n=f?k:`${l}px`,o=`${-h}px`):"top"===i?(n=f?k:`${l}px`,o=`${d.floating.height+h}px`):"right"===i?(n=`${-h}px`,o=f?k:`${m}px`):"left"===i&&(n=`${d.floating.width+h}px`,o=f?k:`${m}px`),{data:{x:n,y:o}}}});function bc(a){let[b,c="center"]=a.split("-");return[b,c]}var bd=p.forwardRef((a,b)=>{let{container:c,...d}=a,[f,g]=p.useState(!1);I(()=>g(!0),[]);let h=c||f&&globalThis?.document?.body;return h?v.createPortal((0,e.jsx)(A.div,{...d,ref:b}),h):null});bd.displayName="Portal";var be=a=>{var b;let c,d,{present:e,children:f}=a,g=function(a){var b,c;let[d,e]=p.useState(),f=p.useRef(null),g=p.useRef(a),h=p.useRef("none"),i=p.useRef(void 0),[j,k]=(b=a?"mounted":"unmounted",c={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},p.useReducer((a,b)=>c[a][b]??a,b));return p.useEffect(()=>{"mounted"===j?(h.current=i.current??bg(f.current),i.current=void 0):h.current="none"},[j]),I(()=>{let b=f.current,c=g.current;if(c!==a){let d=h.current,e=bg(b);a?(i.current=e,k("MOUNT")):"none"===e||b?.display==="none"?k("UNMOUNT"):c&&d!==e?k("ANIMATION_OUT"):k("UNMOUNT"),g.current=a}},[a,k]),I(()=>{if(d){let a,b=d.ownerDocument.defaultView??window,c=c=>{let e=bg(f.current).includes(CSS.escape(c.animationName));if(c.target===d&&e&&(k("ANIMATION_END"),!g.current)){let c=d.style.animationFillMode;d.style.animationFillMode="forwards",a=b.setTimeout(()=>{"forwards"===d.style.animationFillMode&&(d.style.animationFillMode=c)})}},e=a=>{a.target===d&&(h.current=bg(f.current))};return d.addEventListener("animationstart",e),d.addEventListener("animationcancel",c),d.addEventListener("animationend",c),()=>{b.clearTimeout(a),d.removeEventListener("animationstart",e),d.removeEventListener("animationcancel",c),d.removeEventListener("animationend",c)}}k("ANIMATION_END")},[d,k]),{isPresent:["mounted","unmountSuspended"].includes(j),ref:p.useCallback(a=>{if(a){let b=getComputedStyle(a);f.current=b,i.current=bg(b)}else f.current=null;e(a)},[])}}(e),h="function"==typeof f?f({present:g.isPresent}):p.Children.only(f),i=function(...a){let b=p.useRef(a);return b.current=a,p.useCallback(a=>{let c=b.current,d=!1,e=c.map(b=>{let c=bf(b,a);return d||"function"!=typeof c||(d=!0),c});if(d)return()=>{for(let a=0;a<e.length;a++){let b=e[a];"function"==typeof b?b():bf(c[a],null)}}},[])}(g.ref,(b=h,(d=(c=Object.getOwnPropertyDescriptor(b.props,"ref")?.get)&&"isReactWarning"in c&&c.isReactWarning)?b.ref:(d=(c=Object.getOwnPropertyDescriptor(b,"ref")?.get)&&"isReactWarning"in c&&c.isReactWarning)?b.props.ref:b.props.ref||b.ref));return"function"==typeof f||g.isPresent?p.cloneElement(h,{ref:i}):null};function bf(a,b){if("function"==typeof a)return a(b);null!=a&&(a.current=b)}function bg(a){return a?.animationName||"none"}be.displayName="Presence",p[" useEffectEvent ".trim().toString()],p[" useInsertionEffect ".trim().toString()];var bh=p[" useInsertionEffect ".trim().toString()]||I;Symbol("RADIX:SYNC_STATE");var bi=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),bj=p.forwardRef((a,b)=>(0,e.jsx)(A.span,{...a,ref:b,style:{...bi,...a.style}}));bj.displayName="VisuallyHidden";var[bk,bl]=u("Tooltip",[aZ]),bm=aZ(),bn="TooltipProvider",bo="tooltip.open",[bp,bq]=bk(bn),br=a=>{let{__scopeTooltip:b,delayDuration:c=700,skipDelayDuration:d=300,disableHoverableContent:f=!1,children:g}=a,h=p.useRef(!0),i=p.useRef(!1),j=p.useRef(0);return p.useEffect(()=>{let a=j.current;return()=>window.clearTimeout(a)},[]),(0,e.jsx)(bp,{scope:b,isOpenDelayedRef:h,delayDuration:c,onOpen:p.useCallback(()=>{d<=0||(window.clearTimeout(j.current),h.current=!1)},[d]),onClose:p.useCallback(()=>{d<=0||(window.clearTimeout(j.current),j.current=window.setTimeout(()=>h.current=!0,d))},[d]),isPointerInTransitRef:i,onPointerInTransitChange:p.useCallback(a=>{i.current=a},[]),disableHoverableContent:f,children:g})};br.displayName=bn;var bs="Tooltip",[bt,bu]=bk(bs),bv=a=>{let{__scopeTooltip:b,children:c,open:d,defaultOpen:f,onOpenChange:g,disableHoverableContent:h,delayDuration:i}=a,j=bq(bs,a.__scopeTooltip),k=bm(b),[l,m]=p.useState(null),n=function(){let[a,b]=p.useState(J());return I(()=>{b(a=>a??String(K++))},[void 0]),a?`radix-${a}`:""}(),o=p.useRef(0),q=h??j.disableHoverableContent,r=i??j.delayDuration,s=p.useRef(!1),[t,u]=function({prop:a,defaultProp:b,onChange:c=()=>{},caller:d}){let[e,f,g]=function({defaultProp:a,onChange:b}){let[c,d]=p.useState(a),e=p.useRef(c),f=p.useRef(b);return bh(()=>{f.current=b},[b]),p.useEffect(()=>{e.current!==c&&(f.current?.(c),e.current=c)},[c,e]),[c,d,f]}({defaultProp:b,onChange:c}),h=void 0!==a,i=h?a:e;{let b=p.useRef(void 0!==a);p.useEffect(()=>{let a=b.current;if(a!==h){let b=h?"controlled":"uncontrolled";console.warn(`${d} is changing from ${a?"controlled":"uncontrolled"} to ${b}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}b.current=h},[h,d])}return[i,p.useCallback(b=>{if(h){let c="function"==typeof b?b(a):b;c!==a&&g.current?.(c)}else f(b)},[h,a,f,g])]}({prop:d,defaultProp:f??!1,onChange:a=>{a?(j.onOpen(),document.dispatchEvent(new CustomEvent(bo))):j.onClose(),g?.(a)},caller:bs}),v=p.useMemo(()=>t?s.current?"delayed-open":"instant-open":"closed",[t]),w=p.useCallback(()=>{window.clearTimeout(o.current),o.current=0,s.current=!1,u(!0)},[u]),x=p.useCallback(()=>{window.clearTimeout(o.current),o.current=0,u(!1)},[u]),y=p.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(()=>{s.current=!0,u(!0),o.current=0},r)},[r,u]);return p.useEffect(()=>()=>{o.current&&(window.clearTimeout(o.current),o.current=0)},[]),(0,e.jsx)(a0,{...k,children:(0,e.jsx)(bt,{scope:b,contentId:n,open:t,stateAttribute:v,trigger:l,onTriggerChange:m,onTriggerEnter:p.useCallback(()=>{j.isOpenDelayedRef.current?y():w()},[j.isOpenDelayedRef,y,w]),onTriggerLeave:p.useCallback(()=>{q?x():(window.clearTimeout(o.current),o.current=0)},[x,q]),onOpen:w,onClose:x,disableHoverableContent:q,children:c})})};bv.displayName=bs;var bw="TooltipTrigger",bx=p.forwardRef((a,b)=>{let{__scopeTooltip:c,...d}=a,f=bu(bw,c),g=bq(bw,c),h=bm(c),i=t(b,p.useRef(null),f.onTriggerChange),j=p.useRef(!1),k=p.useRef(!1),l=p.useCallback(()=>j.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",l),[l]),(0,e.jsx)(a2,{asChild:!0,...h,children:(0,e.jsx)(A.button,{"aria-describedby":f.open?f.contentId:void 0,"data-state":f.stateAttribute,...d,ref:i,onPointerMove:r(a.onPointerMove,a=>{"touch"!==a.pointerType&&(k.current||g.isPointerInTransitRef.current||(f.onTriggerEnter(),k.current=!0))}),onPointerLeave:r(a.onPointerLeave,()=>{f.onTriggerLeave(),k.current=!1}),onPointerDown:r(a.onPointerDown,()=>{f.open&&f.onClose(),j.current=!0,document.addEventListener("pointerup",l,{once:!0})}),onFocus:r(a.onFocus,()=>{j.current||f.onOpen()}),onBlur:r(a.onBlur,f.onClose),onClick:r(a.onClick,f.onClose)})})});bx.displayName=bw;var by="TooltipPortal",[bz,bA]=bk(by,{forceMount:void 0}),bB=a=>{let{__scopeTooltip:b,forceMount:c,children:d,container:f}=a,g=bu(by,b);return(0,e.jsx)(bz,{scope:b,forceMount:c,children:(0,e.jsx)(be,{present:c||g.open,children:(0,e.jsx)(bd,{asChild:!0,container:f,children:d})})})};bB.displayName=by;var bC="TooltipContent",bD=p.forwardRef((a,b)=>{let c=bA(bC,a.__scopeTooltip),{forceMount:d=c.forceMount,side:f="top",...g}=a,h=bu(bC,a.__scopeTooltip);return(0,e.jsx)(be,{present:d||h.open,children:h.disableHoverableContent?(0,e.jsx)(bI,{side:f,...g,ref:b}):(0,e.jsx)(bE,{side:f,...g,ref:b})})}),bE=p.forwardRef((a,b)=>{let c=bu(bC,a.__scopeTooltip),d=bq(bC,a.__scopeTooltip),f=p.useRef(null),g=t(b,f),[h,i]=p.useState(null),{trigger:j,onClose:k}=c,l=f.current,{onPointerInTransitChange:m}=d,n=p.useCallback(()=>{i(null),m(!1)},[m]),o=p.useCallback((a,b)=>{let c,d=a.currentTarget,e={x:a.clientX,y:a.clientY},f=function(a,b){let c=Math.abs(b.top-a.y),d=Math.abs(b.bottom-a.y),e=Math.abs(b.right-a.x),f=Math.abs(b.left-a.x);switch(Math.min(c,d,e,f)){case f:return"left";case e:return"right";case c:return"top";case d:return"bottom";default:throw Error("unreachable")}}(e,d.getBoundingClientRect());i(((c=[...function(a,b,c=5){let d=[];switch(b){case"top":d.push({x:a.x-c,y:a.y+c},{x:a.x+c,y:a.y+c});break;case"bottom":d.push({x:a.x-c,y:a.y-c},{x:a.x+c,y:a.y-c});break;case"left":d.push({x:a.x+c,y:a.y-c},{x:a.x+c,y:a.y+c});break;case"right":d.push({x:a.x-c,y:a.y-c},{x:a.x-c,y:a.y+c})}return d}(e,f),...function(a){let{top:b,right:c,bottom:d,left:e}=a;return[{x:e,y:b},{x:c,y:b},{x:c,y:d},{x:e,y:d}]}(b.getBoundingClientRect())].slice()).sort((a,b)=>a.x<b.x?-1:a.x>b.x?1:a.y<b.y?-1:1*!!(a.y>b.y)),function(a){if(a.length<=1)return a.slice();let b=[];for(let c=0;c<a.length;c++){let d=a[c];for(;b.length>=2;){let a=b[b.length-1],c=b[b.length-2];if((a.x-c.x)*(d.y-c.y)>=(a.y-c.y)*(d.x-c.x))b.pop();else break}b.push(d)}b.pop();let c=[];for(let b=a.length-1;b>=0;b--){let d=a[b];for(;c.length>=2;){let a=c[c.length-1],b=c[c.length-2];if((a.x-b.x)*(d.y-b.y)>=(a.y-b.y)*(d.x-b.x))c.pop();else break}c.push(d)}return(c.pop(),1===b.length&&1===c.length&&b[0].x===c[0].x&&b[0].y===c[0].y)?b:b.concat(c)}(c))),m(!0)},[m]);return p.useEffect(()=>()=>n(),[n]),p.useEffect(()=>{if(j&&l){let a=a=>o(a,l),b=a=>o(a,j);return j.addEventListener("pointerleave",a),l.addEventListener("pointerleave",b),()=>{j.removeEventListener("pointerleave",a),l.removeEventListener("pointerleave",b)}}},[j,l,o,n]),p.useEffect(()=>{if(h){let a=a=>{let b=a.target,c={x:a.clientX,y:a.clientY},d=j?.contains(b)||l?.contains(b),e=!function(a,b){let{x:c,y:d}=a,e=!1;for(let a=0,f=b.length-1;a<b.length;f=a++){let g=b[a],h=b[f],i=g.x,j=g.y,k=h.x,l=h.y;j>d!=l>d&&c<(k-i)*(d-j)/(l-j)+i&&(e=!e)}return e}(c,h);d?n():e&&(n(),k())};return document.addEventListener("pointermove",a),()=>document.removeEventListener("pointermove",a)}},[j,l,h,k,n]),(0,e.jsx)(bI,{...a,ref:g})}),[bF,bG]=bk(bs,{isInside:!1}),bH=((c=a=>"child"in a?a.children(a.child):a.children).displayName="TooltipContent.Slottable",c.__radixId=w,c),bI=p.forwardRef((a,b)=>{let{__scopeTooltip:c,children:d,"aria-label":f,onEscapeKeyDown:g,onPointerDownOutside:h,...i}=a,j=bu(bC,c),k=bm(c),{onClose:l}=j;return p.useEffect(()=>(document.addEventListener(bo,l),()=>document.removeEventListener(bo,l)),[l]),p.useEffect(()=>{if(j.trigger){let a=a=>{a.target instanceof Node&&a.target.contains(j.trigger)&&l()};return window.addEventListener("scroll",a,{capture:!0}),()=>window.removeEventListener("scroll",a,{capture:!0})}},[j.trigger,l]),(0,e.jsx)(E,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:g,onPointerDownOutside:h,onFocusOutside:a=>a.preventDefault(),onDismiss:l,children:(0,e.jsxs)(a6,{"data-state":j.stateAttribute,...k,...i,ref:b,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[(0,e.jsx)(bH,{children:d}),(0,e.jsx)(bF,{scope:c,isInside:!0,children:(0,e.jsx)(bj,{id:j.contentId,role:"tooltip",children:f||d})})]})})});bD.displayName=bC;var bJ="TooltipArrow",bK=p.forwardRef((a,b)=>{let{__scopeTooltip:c,...d}=a,f=bm(c);return bG(bJ,c).isInside?null:(0,e.jsx)(a9,{...f,...d,ref:b})});function bL({delayDuration:a=0,...b}){return(0,e.jsx)(br,{delayDuration:a,...b})}function bM(a){return(0,e.jsx)(bL,{children:(0,e.jsx)(bv,{...a})})}function bN(a){return(0,e.jsx)(bx,{...a})}function bO({className:a,sideOffset:b=4,children:c,...d}){return(0,e.jsx)(bB,{children:(0,e.jsxs)(bD,{sideOffset:b,className:(0,j.cn)("z-50 w-fit max-w-64 origin-(--radix-tooltip-content-transform-origin) rounded-md bg-primary px-3 py-1.5 text-xs text-balance text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a),...d,children:[c,(0,e.jsx)(bK,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] fill-primary"})]})})}bK.displayName=bJ;var bP=a.i(3015);let bQ=[{app:"claude",label:"Claude",icon:"claude"},{app:"codex",label:"Codex",icon:"codex"},{app:"vscode",label:"VS Code",icon:"ext"},{app:"cmux",label:"cmux",icon:"terminal"},{app:"herdr",label:"Herdr",icon:"terminal"},{app:"iterm2",label:"iTerm2",icon:"terminal"},{app:"finder",label:"Finder",icon:"folder"}];function bR({url:a}){let[b,c]=(0,p.useState)(!1),d=(0,p.useRef)(null);(0,p.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]);let f=(0,p.useCallback)(async()=>{try{await navigator.clipboard.writeText(a),c(!0),d.current&&clearTimeout(d.current),d.current=setTimeout(()=>c(!1),1500)}catch{}},[a]);return(0,e.jsxs)(q.Button,{variant:"outline",size:"sm",onClick:f,children:[b?(0,e.jsx)(h.Icons.check,{}):(0,e.jsx)(h.Icons.copy,{}),b?"Copied":"Copy URL"]})}function bS({reason:a,children:b}){return a?(0,e.jsxs)(bM,{children:[(0,e.jsx)(bN,{asChild:!0,children:(0,e.jsx)("span",{className:"cursor-not-allowed",children:b})}),(0,e.jsx)(bO,{children:a})]}):(0,e.jsx)(e.Fragment,{children:b})}function bT({box:a}){let{webUrl:b,vncUrl:c}=a,{apps:d,supported:f,pending:g,launch:i}=function(a){let[b,c]=(0,p.useState)(null),[d,e]=(0,p.useState)(null);(0,p.useEffect)(()=>{let a=!0;return(async()=>{try{let b=await fetch("/api/v1/open-targets",{credentials:"same-origin"});a&&c(b.ok?await b.json():null)}catch{a&&c(null)}})(),()=>{a=!1}},[]);let f=(0,p.useCallback)(async b=>{e(b);try{let c=await fetch(`/api/v1/boxes/${encodeURIComponent(a.id)}/open`,{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({app:b})});if(!c.ok){let a=await c.json().catch(()=>null);window.alert(`Open in ${b} failed: ${a?.error?.message??`HTTP ${c.status}`}`)}}catch(a){window.alert(`Open in ${b} failed: ${a instanceof Error?a.message:String(a)}`)}finally{e(null)}},[a.id]),g=b?.supported?b.targets:null;return{apps:g?bQ.map(({app:b,label:c,icon:d})=>{let e=g[b],f=e.available?e.providers&&!e.providers.includes(a.provider)?`Not available for ${a.provider} boxes`:null:e.reason??`${c} is not installed`;return{app:b,label:c,icon:d,disabledReason:f}}):[],supported:null!==g,pending:d,launch:f}}(a),j="paused"===a.status?"Box is paused — resume to access":"stopped"===a.status?"Box is stopped — start to access":null,k=b?null:j??"No web service exposed",m=c?null:!1===a.vncEnabled?"VNC is not enabled for this box":j??"VNC is not available";return f||b||c?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(bP.SectionLabel,{children:"Access"}),(0,e.jsxs)(l.Card,{className:"divide-y divide-border/60 overflow-hidden",children:[(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-3 px-4.5 p-3.5",children:[(0,e.jsxs)("div",{className:"min-w-[150px] flex-1",children:[(0,e.jsx)("div",{className:"text-[13.5px] font-medium",children:b||!c?"Web":"VNC"}),(0,e.jsx)("div",{className:"mt-0.5 break-all font-mono text-[11.5px] text-muted-foreground",children:b??(c?"Remote desktop":k)})]}),(0,e.jsxs)("div",{className:"flex flex-none flex-wrap gap-1.5",children:[b?(0,e.jsxs)(q.Button,{variant:"outline",size:"sm",href:b,target:"_blank",rel:"noreferrer",children:[(0,e.jsx)(h.Icons.ext,{}),"Open web"]}):(0,e.jsx)(bS,{reason:k,children:(0,e.jsxs)(q.Button,{variant:"outline",size:"sm",disabled:!0,children:[(0,e.jsx)(h.Icons.ext,{}),"Open web"]})}),b?(0,e.jsx)(bR,{url:b}):null,c?(0,e.jsxs)(q.Button,{variant:"outline",size:"sm",href:c,target:"_blank",rel:"noreferrer",onClick:()=>{fetch(`/api/v1/boxes/${encodeURIComponent(a.id)}/screen`,{method:"POST",credentials:"same-origin"}).catch(()=>{})},children:[(0,e.jsx)(h.Icons.ext,{}),"Open VNC"]}):(0,e.jsx)(bS,{reason:m,children:(0,e.jsxs)(q.Button,{variant:"outline",size:"sm",disabled:!0,children:[(0,e.jsx)(h.Icons.ext,{}),"Open VNC"]})})]})]}),f?(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-3 px-4.5 p-3.5",children:[(0,e.jsxs)("div",{className:"min-w-[150px] flex-1",children:[(0,e.jsx)("div",{className:"text-[13.5px] font-medium",children:"Apps"}),(0,e.jsx)("div",{className:"mt-0.5 text-[11.5px] text-muted-foreground",children:"Open the box project from the host"})]}),(0,e.jsx)("div",{className:"flex flex-none flex-wrap justify-end gap-1.5",children:d.map(({app:a,label:b,icon:c,disabledReason:d})=>{let f=h.Icons[c];return(0,e.jsx)(bS,{reason:d,children:(0,e.jsxs)(q.Button,{variant:"outline",size:"sm",disabled:null!==d||null!==g,onClick:()=>void i(a),children:[(0,e.jsx)(f,{}),b]})},a)})})]}):null]})]}):null}var bU=a.i(24288),bV=a.i(17236),bW=a.i(51363);function bX({k:a,v:b,mono:c,link:d}){return(0,e.jsxs)("div",{className:"grid grid-cols-[156px_1fr] items-baseline gap-4 px-4.5 p-3 max-sm:grid-cols-1 max-sm:gap-1",children:[(0,e.jsx)("div",{className:"font-mono text-xs text-muted-foreground",children:a}),(0,e.jsx)("div",{className:(0,j.cn)("min-w-0 text-[13.5px]",c?"font-mono text-[13px]":""),children:d?(0,e.jsx)(bW.default,{className:"cursor-pointer text-primary",href:d,children:b}):b})]})}var bY=a.i(12019),bZ=a.i(45515),b$=a.i(85883),b_=a.i(34537),b0=a.i(53596),b1=a.i(96664);let b2=(0,b1.createServerReference)("70fd109611adee18e2a11d04af4332c29e796848e9",b1.callServer,void 0,b1.findSourceMapURL,"gitBranchAction"),b3=(0,b1.createServerReference)("600e7ece96e4038f118842cef0ebcf51dadf743c9b",b1.callServer,void 0,b1.findSourceMapURL,"gitCheckoutAction"),b4=(0,b1.createServerReference)("605f4904ee0814a4a51c0445aa18e7dfbde590c7e5",b1.callServer,void 0,b1.findSourceMapURL,"gitPullAction"),b5=(0,b1.createServerReference)("60675b1179af1a57b7c4bb6e4d893805dd8f7b0b66",b1.callServer,void 0,b1.findSourceMapURL,"gitPushAction"),b6=(0,b1.createServerReference)("607692631dd5973ad6071d94f3fee9c7da56a766db",b1.callServer,void 0,b1.findSourceMapURL,"gitPushHostAction"),b7=0;function b8({toasts:a,dismiss:b}){return(0,e.jsx)("div",{className:"pointer-events-none fixed bottom-5 right-5 z-[60] flex w-[340px] max-w-[calc(100vw-40px)] flex-col gap-2",children:a.map(a=>(0,e.jsxs)("div",{className:"anim-pop pointer-events-auto relative flex items-start gap-3 rounded-xl border border-border bg-card p-3.5 pr-9 shadow-[0_16px_40px_-18px_rgba(20,24,30,.35)]",children:[(0,e.jsx)("span",{className:(0,j.cn)("mt-0.5 grid h-6 w-6 flex-none place-items-center rounded-md border","error"===a.variant?"border-[var(--red-line)] bg-[var(--red-soft)] text-[var(--red)]":"border-[var(--green-line)] bg-accent text-primary"),children:"error"===a.variant?(0,e.jsx)(h.Icons.warn,{className:"size-3.5"}):(0,e.jsx)(h.Icons.check,{className:"size-3.5"})}),(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsx)("div",{className:"text-[13px] font-semibold leading-tight",children:a.title}),a.detail?(0,e.jsx)("div",{className:"mt-0.5 break-words font-mono text-[11.5px] leading-normal text-muted-foreground",children:a.detail}):null]}),(0,e.jsx)("button",{className:"absolute right-2.5 top-2.5 grid h-5 w-5 cursor-pointer place-items-center rounded border-0 bg-transparent text-[#a4a9b0] hover:text-foreground",onClick:()=>b(a.id),"aria-label":"Dismiss",children:(0,e.jsx)(h.Icons.x,{className:"size-3"})})]},a.id))})}function b9({label:a,desc:b,children:c}){return(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-3 px-4.5 p-3.5",children:[(0,e.jsxs)("div",{className:"min-w-[150px] flex-1",children:[(0,e.jsx)("div",{className:"text-[13.5px] font-medium",children:a}),(0,e.jsx)("div",{className:"mt-0.5 font-mono text-[11.5px] text-muted-foreground",children:b})]}),(0,e.jsx)("div",{className:"flex flex-none flex-wrap gap-1.5",children:c})]})}function ca({icon:a,disabled:b,onRun:c,children:d}){let[f,g]=(0,p.useState)(!1),h=async()=>{g(!0);try{await c()}finally{g(!1)}};return(0,e.jsxs)(q.Button,{variant:"outline",size:"sm",disabled:b||f,onClick:h,children:[f?(0,e.jsx)("span",{className:"spin",style:{width:12,height:12}}):(0,e.jsx)(a,{}),d]})}function cb(a,b){let c=(a??"").trim()||(b??"").trim();return c?c.split("\n")[0]:void 0}function cc({box:a}){let b=(0,f.useRouter)(),{toasts:c,push:d,dismiss:g}=function(){let[a,b]=(0,p.useState)([]),c=(0,p.useCallback)(a=>b(b=>b.filter(b=>b.id!==a)),[]);return{toasts:a,push:(0,p.useCallback)(a=>{let d=++b7;b(b=>[...b,{id:d,...a}]),setTimeout(()=>c(d),4200)},[c]),dismiss:c}}(),[i,k]=(0,p.useState)(null),[m,n]=(0,p.useState)(null),o="running"!==a.status,r=(0,p.useCallback)(async()=>{try{let b=await fetch(`/api/v1/boxes/${encodeURIComponent(a.id)}/git`,{credentials:"same-origin"});k(b.ok?await b.json():null)}catch{k(null)}},[a.id]);(0,p.useEffect)(()=>{r()},[r]);let s=i?.ok&&i.branch?i.branch:a.branch||"—",t=()=>{r(),b.refresh()},u=async(a,b)=>{let c=await b();c.ok?(d({title:a,detail:cb(c.stdout,c.stderr)}),t()):d({variant:"error",title:`${a} failed`,detail:c.error})};return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(l.Card,{className:(0,j.cn)("divide-y divide-border/60 overflow-hidden",o?"opacity-90":""),children:[o?(0,e.jsxs)("div",{className:"flex items-center gap-2.5 bg-[var(--amber-soft)] px-4.5 p-2.5 text-[12.5px] text-[var(--amber)]",children:[(0,e.jsx)(h.Icons.warn,{className:"size-3.5 flex-none"}),"Box is ",a.status," — git operations need a running box."]}):null,(0,e.jsxs)(b9,{label:"Sync",desc:`origin ↔ ${s}`,children:[(0,e.jsx)(ca,{icon:h.Icons.arrowL,disabled:o,onRun:()=>u("Pulled from origin",()=>b4(a.id)),children:"Pull"}),(0,e.jsx)(ca,{icon:h.Icons.ext,disabled:o,onRun:()=>u("Pushed to origin",()=>b5(a.id)),children:"Push"}),(0,e.jsx)(ca,{icon:h.Icons.host,disabled:o,onRun:()=>u("Pushed to host",()=>b6(a.id)),children:"Push to host"})]}),(0,e.jsxs)(b9,{label:"Branch",desc:`currently on ${s}`,children:[(0,e.jsxs)(q.Button,{variant:"outline",size:"sm",disabled:o,onClick:()=>n("change"),children:[(0,e.jsx)(h.Icons.branch,{}),"Change branch"]}),(0,e.jsxs)(q.Button,{variant:"outline",size:"sm",disabled:o,onClick:()=>n("new"),children:[(0,e.jsx)(h.Icons.plus,{}),"New branch"]})]})]}),"change"===m?(0,e.jsx)(cf,{box:a,branch:s,onClose:()=>n(null),onDone:d,onRefresh:t}):null,"new"===m?(0,e.jsx)(cg,{box:a,onClose:()=>n(null),onDone:d,onRefresh:t}):null,(0,e.jsx)(b8,{toasts:c,dismiss:g})]})}let cd="__manual__";function ce({boxId:a,value:b,onChange:c,id:d,headLabel:f,currentBranch:g}){let[h,i]=(0,p.useState)(null),[j,k]=(0,p.useState)(g??null),[l,m]=(0,p.useState)(!1);return((0,p.useEffect)(()=>{let b=!1;return(async()=>{try{let c=await fetch(`/api/v1/boxes/${encodeURIComponent(a)}/branches`,{credentials:"same-origin"}),d=c.ok?await c.json():null;if(b)return;d&&Array.isArray(d.branches)&&d.branches.length>0?(i(d.branches),g||"string"!=typeof d.current||k(d.current)):(i([]),m(!0))}catch{b||(i([]),m(!0))}})(),()=>{b=!0}},[a,g]),null===h)?(0,e.jsx)(b0.Select,{id:d,value:"",disabled:!0,wrapperClassName:"w-full",children:(0,e.jsx)("option",{value:"",children:"Loading branches…"})}):l?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(b$.Input,{id:d,className:"font-mono text-[13px]",autoFocus:!0,value:b,onChange:a=>c(a.target.value),placeholder:f?"HEAD":"feature-x"}),h.length>0?(0,e.jsx)("button",{type:"button",onClick:()=>{m(!1),c("")},className:"mt-1.5 cursor-pointer text-xs text-secondary-foreground underline-offset-2 hover:underline",children:"← Back to branch list"}):null]}):(0,e.jsxs)(b0.Select,{id:d,value:b,wrapperClassName:"w-full",onChange:a=>{if(a.target.value===cd){m(!0),c("");return}c(a.target.value)},children:[f?(0,e.jsx)("option",{value:"",children:f}):(0,e.jsx)("option",{value:"",disabled:!0,children:"Select a branch…"}),(0,e.jsx)("option",{value:cd,children:"Other / type manually…"}),(0,e.jsx)("option",{disabled:!0,children:"────────────"}),h.map(a=>(0,e.jsxs)("option",{value:a,children:[a,a===j?" (current)":""]},a))]})}function cf({box:a,branch:b,onClose:c,onDone:d,onRefresh:f}){let[g,i]=(0,p.useState)(""),[j,k]=(0,p.useState)(!1),[l,m]=(0,p.useState)(null),n=g.trim().length>0;return(0,e.jsxs)(bZ.Dialog,{onClose:c,className:"max-w-[440px]",children:[(0,e.jsxs)(bZ.DialogHeader,{children:[(0,e.jsx)(bZ.DialogIcon,{children:(0,e.jsx)(h.Icons.branch,{})}),(0,e.jsxs)("div",{children:[(0,e.jsx)(bZ.DialogTitle,{children:"Change branch"}),(0,e.jsxs)(bZ.DialogDescription,{children:[a.id," · currently on ",b]})]})]}),(0,e.jsxs)(bZ.DialogBody,{children:[(0,e.jsx)(b_.Label,{htmlFor:"gb-branch",children:"Branch"}),(0,e.jsx)(ce,{boxId:a.id,id:"gb-branch",value:g,onChange:i,currentBranch:b}),(0,e.jsx)("p",{className:"mt-1.5 text-xs text-muted-foreground",children:"The branch must exist and not be checked out in another worktree."}),l?(0,e.jsx)("p",{className:"mt-2 break-words font-mono text-xs text-destructive",children:l}):null]}),(0,e.jsxs)(bZ.DialogFooter,{children:[(0,e.jsx)(q.Button,{variant:"outline",onClick:c,disabled:j,children:"Cancel"}),(0,e.jsxs)(q.Button,{onClick:()=>{n&&!j&&(k(!0),m(null),(async()=>{let b=await b3(a.id,g.trim());b.ok?(d({title:"Branch changed",detail:cb(b.stdout,b.stderr)}),c(),f()):(m(b.error),k(!1))})())},disabled:!n||j,children:[j?(0,e.jsx)("span",{className:"spin"}):(0,e.jsx)(h.Icons.check,{}),j?"Checking out…":"Change branch"]})]})]})}function cg({box:a,onClose:b,onDone:c,onRefresh:d}){let[f,g]=(0,p.useState)(""),[i,j]=(0,p.useState)(""),[k,l]=(0,p.useState)(!1),[m,n]=(0,p.useState)(null),o=f.trim().length>0,r=()=>{o&&!k&&(l(!0),n(null),(async()=>{let e=await b2(a.id,f.trim(),i.trim()||void 0);e.ok?(c({title:"Branch created",detail:cb(e.stdout,e.stderr)}),b(),d()):(n(e.error),l(!1))})())};return(0,e.jsxs)(bZ.Dialog,{onClose:b,className:"max-w-[440px]",children:[(0,e.jsxs)(bZ.DialogHeader,{children:[(0,e.jsx)(bZ.DialogIcon,{children:(0,e.jsx)(h.Icons.branch,{})}),(0,e.jsxs)("div",{children:[(0,e.jsx)(bZ.DialogTitle,{children:"New branch"}),(0,e.jsxs)(bZ.DialogDescription,{children:[a.id," · branching in the box workspace"]})]})]}),(0,e.jsxs)(bZ.DialogBody,{children:[(0,e.jsxs)("div",{className:"mb-4",children:[(0,e.jsx)(b_.Label,{htmlFor:"nb-name",children:"Name"}),(0,e.jsx)(b$.Input,{id:"nb-name",className:"font-mono text-[13px]",autoFocus:!0,value:f,onChange:a=>g(a.target.value),onKeyDown:a=>{"Enter"===a.key&&r()},placeholder:"my-branch"}),(0,e.jsxs)("p",{className:"mt-1.5 text-xs text-muted-foreground",children:["An ",(0,e.jsx)("span",{className:"font-mono",children:"agentbox/"})," prefix is added when missing."]})]}),(0,e.jsxs)(b_.Label,{htmlFor:"nb-from",children:["Base ref ",(0,e.jsx)("span",{className:"font-normal text-[#a4a9b0]",children:"(optional)"})]}),(0,e.jsx)(ce,{boxId:a.id,id:"nb-from",value:i,onChange:j,headLabel:"Current HEAD (default)"}),(0,e.jsx)("p",{className:"mt-1.5 text-xs text-muted-foreground",children:"Defaults to the box's current HEAD."}),m?(0,e.jsx)("p",{className:"mt-2 break-words font-mono text-xs text-destructive",children:m}):null]}),(0,e.jsxs)(bZ.DialogFooter,{children:[(0,e.jsx)(q.Button,{variant:"outline",onClick:b,disabled:k,children:"Cancel"}),(0,e.jsxs)(q.Button,{onClick:r,disabled:!o||k,children:[k?(0,e.jsx)("span",{className:"spin"}):(0,e.jsx)(h.Icons.plus,{}),k?"Creating…":"Create branch"]})]})]})}let ch=(0,b1.createServerReference)("6096ff4dd5616157cf1da6a977c271641a3ddce491",b1.callServer,void 0,b1.findSourceMapURL,"restartServiceAction"),ci=new Set(["ready","running","done"]),cj=new Set(["crashed","unhealthy","backoff","failed"]),ck={up:"bg-[var(--green)]",bad:"bg-[var(--red)]",idle:"bg-[var(--amber)]"},cl={up:"text-[var(--green-ink)]",bad:"text-[var(--red)]",idle:"text-[var(--amber)]"};function cm({svc:a,disabled:b,onRestart:c}){var d;let f=(d=a.state,ci.has(d)?"up":cj.has(d)?"bad":"idle");return(0,e.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[(0,e.jsx)("span",{className:(0,j.cn)("badge-dot",ck[f]),"aria-hidden":!0}),(0,e.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-[13px] text-secondary-foreground",children:a.name}),(0,e.jsx)("span",{className:(0,j.cn)("font-mono text-xs",cl[f]),children:a.state}),a.restarts>0?(0,e.jsxs)("span",{className:"font-mono text-[11px] text-muted-foreground",children:["↻",a.restarts]}):null,(0,e.jsx)(q.Button,{variant:"outline",size:"icon-sm",title:`Restart ${a.name}`,disabled:b,onClick:()=>c(a.name),children:(0,e.jsx)(h.Icons.refresh,{})})]})}function cn({id:a,running:b}){let[c,d]=(0,p.useState)(null),[f,g]=(0,p.useState)(null),[i,j]=(0,p.useTransition)(),k=(0,p.useCallback)(async()=>{try{let b=await fetch(`/api/v1/boxes/${encodeURIComponent(a)}/services`,{credentials:"same-origin"});if(!b.ok)return void g(`status ${String(b.status)}`);d(await b.json()),g(null)}catch(a){g(a instanceof Error?a.message:String(a))}},[a]);(0,p.useEffect)(()=>{if(k(),!b)return;let a=setInterval(()=>void k(),4e3);return()=>clearInterval(a)},[k,b]);let m=b=>{j(async()=>{let c=await ch(a,b);c.ok||window.alert(`Restart failed: ${c.error}`),await k()})},n=c?.services??[],o=n.length>0;return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(bP.SectionLabel,{right:o?(0,e.jsxs)(q.Button,{variant:"outline",size:"sm",disabled:!b||i,onClick:()=>m(void 0),children:[(0,e.jsx)(h.Icons.refresh,{}),"Restart all"]}):null,children:"Services"}),(0,e.jsx)(l.Card,{className:"divide-y divide-border/60 overflow-hidden",children:c||f?f?(0,e.jsxs)("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:["Could not load services (",f,")."]}):o?(0,e.jsxs)(e.Fragment,{children:[c?.source==="persisted"?(0,e.jsx)("div",{className:"bg-muted/30 px-4 py-1.5 font-mono text-[11px] text-muted-foreground",children:"persisted snapshot — box not running"}):null,n.map(a=>(0,e.jsx)(cm,{svc:a,disabled:!b||i,onRestart:a=>m(a)},a.name))]}):(0,e.jsx)("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:c?.source==="unavailable"?"No service status (box not running or no snapshot yet).":"No services declared in agentbox.yaml."}):(0,e.jsx)("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:"Loading…"})})]})}var co=a.i(82337);a.s(["default",0,function(){let{id:a}=(0,f.useParams)(),{box:b,project:c}=(0,m.useStore)(),d=b(a);if(!d)return(0,e.jsxs)("div",{className:"mx-auto w-full max-w-[1080px] px-8 pb-16 pt-8",children:[(0,e.jsx)(bU.BackLink,{to:"/",children:"All boxes"}),(0,e.jsx)(bY.EmptyBox,{children:"This box no longer exists — it may have been destroyed."})]});let j=c(d.projectId);return(0,e.jsxs)("div",{className:"mx-auto w-full max-w-[1080px] px-8 pb-16 pt-8 max-sm:px-4",children:[(0,e.jsx)(bU.BackLink,{to:"/projects/"+d.projectId,children:j?j.name:"Project"}),(0,e.jsxs)("div",{className:"flex items-start gap-4 max-md:flex-col",children:[(0,e.jsxs)("div",{className:"min-w-0",children:[(0,e.jsxs)("h1",{className:"flex flex-wrap items-center gap-3 text-[25px] font-semibold leading-tight tracking-[-0.025em]",children:[d.task,(0,e.jsx)(i.StatusBadge,{status:d.status})]}),(0,e.jsxs)("div",{className:"mt-1.5 text-sm text-muted-foreground",children:[(0,e.jsx)("span",{className:"font-mono text-secondary-foreground",children:d.id})," ·"," ",(0,e.jsx)("span",{className:"font-mono text-secondary-foreground",children:d.repo})," · ",d.host]})]}),(0,e.jsx)("div",{className:"ml-auto flex-none max-md:ml-0",children:(0,e.jsx)(bV.BoxActions,{box:d,size:"lg"})})]}),d.error?(0,e.jsx)(k,{className:"mt-4 border-[var(--red-line)] bg-[var(--red-soft)] text-[var(--red)]",icon:h.Icons.warn,title:"Box errored",children:(0,e.jsx)("span",{className:"font-mono text-secondary-foreground",children:d.error})}):null,(0,e.jsx)(o,{boxId:d.id}),(0,e.jsx)(bP.SectionLabel,{children:"Overview"}),(0,e.jsxs)(co.StatGrid,{children:[(0,e.jsx)(co.Stat,{k:"Status",v:(0,e.jsx)(i.StatusBadge,{status:d.status})}),(0,e.jsx)(co.Stat,{k:"Agent CLI",v:d.agent,mono:!0}),(0,e.jsx)(co.Stat,{k:"Commits",v:d.commits??"—",icon:h.Icons.commit}),(0,e.jsx)(co.Stat,{k:"Files touched",v:d.filesTouched??"—",icon:h.Icons.file}),(0,e.jsx)(co.Stat,{k:"Last activity",v:(0,e.jsx)(g.Ago,{ms:d.lastActivity}),mono:!0})]}),(0,e.jsx)(bT,{box:d}),(0,e.jsx)(bP.SectionLabel,{children:"Git operations"}),(0,e.jsx)(cc,{box:d}),(0,e.jsx)(cn,{id:d.id,running:"running"===d.status}),(0,e.jsx)(bP.SectionLabel,{children:"Details"}),(0,e.jsxs)(l.Card,{className:"divide-y divide-border/60 overflow-hidden",children:[(0,e.jsx)(bX,{k:"Box ID",v:d.id,mono:!0}),(0,e.jsx)(bX,{k:"Project",v:j?j.name:"—",link:j?"/projects/"+d.projectId:null}),(0,e.jsx)(bX,{k:"Repository",v:d.repo,mono:!0}),(0,e.jsx)(bX,{k:"Branch",v:d.branch,mono:!0}),(0,e.jsx)(bX,{k:"Host",v:d.host,mono:!0}),(0,e.jsx)(bX,{k:"Created",v:new Date(d.createdAt).toLocaleString(),mono:!0})]})]})}],58099)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=apps_hub_app_%28dashboard%29_boxes_%5Bid%5D_page_tsx_1-j_972._.js.map
|
|
@@ -7,9 +7,9 @@ globalThis.__BUILD_MANIFEST = {
|
|
|
7
7
|
"static/chunks/0cz1d0mv5g_q7.js"
|
|
8
8
|
],
|
|
9
9
|
"lowPriorityFiles": [
|
|
10
|
-
"static/
|
|
11
|
-
"static/
|
|
12
|
-
"static/
|
|
10
|
+
"static/eVq-z4zld_8DGQudbYogV/_buildManifest.js",
|
|
11
|
+
"static/eVq-z4zld_8DGQudbYogV/_ssgManifest.js",
|
|
12
|
+
"static/eVq-z4zld_8DGQudbYogV/_clientMiddlewareManifest.js"
|
|
13
13
|
],
|
|
14
14
|
"rootMainFiles": [
|
|
15
15
|
"static/chunks/1y49eldffr2-_.js",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/1y49eldffr2-_.js"/><script src="/_next/static/chunks/2w65a9zig6ya7.js" async=""></script><script src="/_next/static/chunks/3x8k7so-uoat8.js" async=""></script><script src="/_next/static/chunks/0ptag81psa0nj.js" async=""></script><script src="/_next/static/chunks/turbopack-2x4_cva4cco3h.js" async=""></script><script src="/_next/static/chunks/2x7nfpuaaba_a.js" async=""></script><script src="/_next/static/chunks/3c49t4evjq8hf.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: This page couldn’t load</title><style>:root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }</style><script src="/_next/static/chunks/0cz1d0mv5g_q7.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;display:flex;align-items:center;justify-content:center"><div style="margin-top:-32px;max-width:325px;padding:32px 28px;text-align:left"><svg width="32" height="32" viewBox="-0.2 -1.5 32 32" fill="none" style="margin-bottom:24px"><path d="M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z" fill="var(--next-error-title)"></path></svg><h1 style="font-size:24px;font-weight:500;letter-spacing:-0.02em;line-height:32px;margin:0 0 12px 0;color:var(--next-error-title)">This page couldn’t load</h1><p style="font-size:14px;font-weight:400;line-height:21px;margin:0 0 20px 0;color:var(--next-error-message)">A server error occurred. Reload to try again.</p><form style="margin:0"><button type="submit" style="display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;font-size:14px;font-weight:500;line-height:20px;border-radius:6px;cursor:pointer;color:var(--next-error-btn-text);background:var(--next-error-btn-bg);border:var(--next-error-btn-border)">Reload</button></form></div></div><!--$--><!--/$--><script src="/_next/static/chunks/1y49eldffr2-_.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[20699,[\"/_next/static/chunks/2x7nfpuaaba_a.js\",\"/_next/static/chunks/3c49t4evjq8hf.js\"],\"default\"]\n3:I[92242,[\"/_next/static/chunks/2x7nfpuaaba_a.js\",\"/_next/static/chunks/3c49t4evjq8hf.js\"],\"default\"]\n4:I[43645,[\"/_next/static/chunks/2x7nfpuaaba_a.js\",\"/_next/static/chunks/3c49t4evjq8hf.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n8:I[43645,[\"/_next/static/chunks/2x7nfpuaaba_a.js\",\"/_next/static/chunks/3c49t4evjq8hf.js\"],\"ViewportBoundary\"]\na:I[43645,[\"/_next/static/chunks/2x7nfpuaaba_a.js\",\"/_next/static/chunks/3c49t4evjq8hf.js\"],\"MetadataBoundary\"]\nc:I[17506,[\"/_next/static/chunks/2x7nfpuaaba_a.js\",\"/_next/static/chunks/3c49t4evjq8hf.js\"],\"default\",1]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"title\",null,{\"children\":\"500: This page couldn’t load\"}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\":root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }\"}}]]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"display\":\"flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"marginTop\":\"-32px\",\"maxWidth\":\"325px\",\"padding\":\"32px 28px\",\"textAlign\":\"left\"},\"children\":[[\"$\",\"svg\",null,{\"width\":\"32\",\"height\":\"32\",\"viewBox\":\"-0.2 -1.5 32 32\",\"fill\":\"none\",\"style\":{\"marginBottom\":\"24px\"},\"children\":[\"$\",\"path\",null,{\"d\":\"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z\",\"fill\":\"var(--next-error-title)\"}]}],[\"$\",\"h1\",null,{\"style\":{\"fontSize\":\"24px\",\"fontWeight\":500,\"letterSpacing\":\"-0.02em\",\"lineHeight\":\"32px\",\"margin\":\"0 0 12px 0\",\"color\":\"var(--next-error-title)\"},\"children\":\"This page couldn’t load\"}],[\"$\",\"p\",null,{\"style\":{\"fontSize\":\"14px\",\"fontWeight\":400,\"lineHeight\":\"21px\",\"margin\":\"0 0 20px 0\",\"color\":\"var(--next-error-message)\"},\"children\":\"A server error occurred. Reload to try again.\"}],[\"$\",\"form\",null,{\"style\":{\"margin\":0},\"children\":[\"$\",\"button\",null,{\"type\":\"submit\",\"style\":{\"display\":\"inline-flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\",\"height\":\"32px\",\"padding\":\"0 12px\",\"fontSize\":\"14px\",\"fontWeight\":500,\"lineHeight\":\"20px\",\"borderRadius\":\"6px\",\"cursor\":\"pointer\",\"color\":\"var(--next-error-btn-text)\",\"background\":\"var(--next-error-btn-bg)\",\"border\":\"var(--next-error-btn-border)\"},\"children\":\"Reload\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,null]},null,false,\"$@7\"],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lb\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",[]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"
|
|
1
|
+
<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/1y49eldffr2-_.js"/><script src="/_next/static/chunks/2w65a9zig6ya7.js" async=""></script><script src="/_next/static/chunks/3x8k7so-uoat8.js" async=""></script><script src="/_next/static/chunks/0ptag81psa0nj.js" async=""></script><script src="/_next/static/chunks/turbopack-2x4_cva4cco3h.js" async=""></script><script src="/_next/static/chunks/2x7nfpuaaba_a.js" async=""></script><script src="/_next/static/chunks/3c49t4evjq8hf.js" async=""></script><meta name="next-size-adjust" content=""/><title>500: This page couldn’t load</title><style>:root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }</style><script src="/_next/static/chunks/0cz1d0mv5g_q7.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;display:flex;align-items:center;justify-content:center"><div style="margin-top:-32px;max-width:325px;padding:32px 28px;text-align:left"><svg width="32" height="32" viewBox="-0.2 -1.5 32 32" fill="none" style="margin-bottom:24px"><path d="M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z" fill="var(--next-error-title)"></path></svg><h1 style="font-size:24px;font-weight:500;letter-spacing:-0.02em;line-height:32px;margin:0 0 12px 0;color:var(--next-error-title)">This page couldn’t load</h1><p style="font-size:14px;font-weight:400;line-height:21px;margin:0 0 20px 0;color:var(--next-error-message)">A server error occurred. Reload to try again.</p><form style="margin:0"><button type="submit" style="display:inline-flex;align-items:center;justify-content:center;height:32px;padding:0 12px;font-size:14px;font-weight:500;line-height:20px;border-radius:6px;cursor:pointer;color:var(--next-error-btn-text);background:var(--next-error-btn-bg);border:var(--next-error-btn-border)">Reload</button></form></div></div><!--$--><!--/$--><script src="/_next/static/chunks/1y49eldffr2-_.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[20699,[\"/_next/static/chunks/2x7nfpuaaba_a.js\",\"/_next/static/chunks/3c49t4evjq8hf.js\"],\"default\"]\n3:I[92242,[\"/_next/static/chunks/2x7nfpuaaba_a.js\",\"/_next/static/chunks/3c49t4evjq8hf.js\"],\"default\"]\n4:I[43645,[\"/_next/static/chunks/2x7nfpuaaba_a.js\",\"/_next/static/chunks/3c49t4evjq8hf.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n8:I[43645,[\"/_next/static/chunks/2x7nfpuaaba_a.js\",\"/_next/static/chunks/3c49t4evjq8hf.js\"],\"ViewportBoundary\"]\na:I[43645,[\"/_next/static/chunks/2x7nfpuaaba_a.js\",\"/_next/static/chunks/3c49t4evjq8hf.js\"],\"MetadataBoundary\"]\nc:I[17506,[\"/_next/static/chunks/2x7nfpuaaba_a.js\",\"/_next/static/chunks/3c49t4evjq8hf.js\"],\"default\",1]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[[\"$\",\"title\",null,{\"children\":\"500: This page couldn’t load\"}],[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\":root {--next-error-bg: #fff;--next-error-text: #171717;--next-error-title: #171717;--next-error-message: #171717;--next-error-digest: #666666;--next-error-btn-text: #fff;--next-error-btn-bg: #171717;--next-error-btn-border: none;--next-error-btn-secondary-text: #171717;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(0,0,0,0.08);}@media (prefers-color-scheme: dark) {:root {--next-error-bg: #0a0a0a;--next-error-text: #ededed;--next-error-title: #ededed;--next-error-message: #ededed;--next-error-digest: #a0a0a0;--next-error-btn-text: #0a0a0a;--next-error-btn-bg: #ededed;--next-error-btn-border: none;--next-error-btn-secondary-text: #ededed;--next-error-btn-secondary-bg: transparent;--next-error-btn-secondary-border: 1px solid rgba(255,255,255,0.14);}}body { margin: 0; color: var(--next-error-text); background: var(--next-error-bg); }\"}}]]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"display\":\"flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"marginTop\":\"-32px\",\"maxWidth\":\"325px\",\"padding\":\"32px 28px\",\"textAlign\":\"left\"},\"children\":[[\"$\",\"svg\",null,{\"width\":\"32\",\"height\":\"32\",\"viewBox\":\"-0.2 -1.5 32 32\",\"fill\":\"none\",\"style\":{\"marginBottom\":\"24px\"},\"children\":[\"$\",\"path\",null,{\"d\":\"M16.9328 0C18.0839 0.000116771 19.1334 0.658832 19.634 1.69531L31.4299 26.1309C32.0708 27.4588 31.1036 28.9999 29.6291 29H2.00215C0.527541 29 -0.439628 27.4588 0.201371 26.1309L11.9973 1.69531C12.4979 0.658823 13.5474 7.75066e-05 14.6984 0H16.9328ZM3.59493 26H28.0363L16.9328 3H14.6984L3.59493 26ZM15.8156 19C16.9202 19.0001 17.8156 19.8955 17.8156 21C17.8156 22.1045 16.9202 22.9999 15.8156 23C14.7111 23 13.8156 22.1046 13.8156 21C13.8156 19.8954 14.7111 19 15.8156 19ZM17.3156 16.5H14.3156V8.5H17.3156V16.5Z\",\"fill\":\"var(--next-error-title)\"}]}],[\"$\",\"h1\",null,{\"style\":{\"fontSize\":\"24px\",\"fontWeight\":500,\"letterSpacing\":\"-0.02em\",\"lineHeight\":\"32px\",\"margin\":\"0 0 12px 0\",\"color\":\"var(--next-error-title)\"},\"children\":\"This page couldn’t load\"}],[\"$\",\"p\",null,{\"style\":{\"fontSize\":\"14px\",\"fontWeight\":400,\"lineHeight\":\"21px\",\"margin\":\"0 0 20px 0\",\"color\":\"var(--next-error-message)\"},\"children\":\"A server error occurred. Reload to try again.\"}],[\"$\",\"form\",null,{\"style\":{\"margin\":0},\"children\":[\"$\",\"button\",null,{\"type\":\"submit\",\"style\":{\"display\":\"inline-flex\",\"alignItems\":\"center\",\"justifyContent\":\"center\",\"height\":\"32px\",\"padding\":\"0 12px\",\"fontSize\":\"14px\",\"fontWeight\":500,\"lineHeight\":\"20px\",\"borderRadius\":\"6px\",\"cursor\":\"pointer\",\"color\":\"var(--next-error-btn-text)\",\"background\":\"var(--next-error-btn-bg)\",\"border\":\"var(--next-error-btn-border)\"},\"children\":\"Reload\"}]}]]}]}]}]]}],null,[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,null]},null,false,\"$@7\"],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lb\"}]}]}],[\"$\",\"meta\",null,{\"name\":\"next-size-adjust\",\"content\":\"\"}]]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",[]],\"S\":true,\"h\":null,\"s\":\"$undefined\",\"l\":\"$undefined\",\"p\":\"$undefined\",\"d\":\"$undefined\",\"b\":\"eVq-z4zld_8DGQudbYogV\"}\n"])</script><script>self.__next_f.push([1,"d:[]\n7:\"$Wd\"\n"])</script><script>self.__next_f.push([1,"9:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"6:null\nb:[]\n"])</script></body></html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,77084,e=>{"use strict";let t,n;var r,i=e.i(1262),o=e.i(45971),l=e.i(33789),a=e.i(44344),s=e.i(86892),c=e.i(65232);function u({className:e,icon:t,title:n,children:r}){return(0,i.jsxs)("div",{className:(0,c.cn)("relative flex w-full items-start gap-3 rounded-xl border p-4",e),children:[t?(0,i.jsx)(t,{className:"mt-0.5 size-4 flex-none"}):null,(0,i.jsxs)("div",{className:"min-w-0",children:[n?(0,i.jsx)("div",{className:"mb-0.5 text-[13.5px] font-semibold leading-tight",children:n}):null,(0,i.jsx)("div",{className:"text-[12.5px] leading-normal",children:r})]})]})}var d=e.i(8536),f=e.i(96621),p=e.i(88451);function m({boxId:e}){let{state:t}=(0,f.useStore)(),n=t.approvals.filter(t=>t.boxId===e).sort((e,t)=>e.createdAt-t.createdAt);return 0===n.length?null:(0,i.jsxs)("div",{className:"mt-4 overflow-hidden rounded-xl border border-[var(--amber-line)] bg-[var(--amber-soft)]",children:[(0,i.jsxs)("div",{className:"flex items-center gap-2 border-b border-[var(--amber-line)] px-4 py-2.5",children:[(0,i.jsx)(a.Icons.shield,{className:"size-4 flex-none text-[var(--amber)]"}),(0,i.jsxs)("span",{className:"text-[13.5px] font-semibold",children:[n.length," pending approval",1===n.length?"":"s"]}),(0,i.jsx)("span",{className:"text-[12.5px] text-muted-foreground",children:"— this box is waiting on you."})]}),(0,i.jsx)("div",{className:"divide-y divide-[var(--amber-line)]",children:n.map(e=>(0,i.jsxs)("div",{className:"flex items-start gap-3 px-4 py-3",children:[(0,i.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,i.jsx)("div",{className:"truncate font-mono text-[13px] text-secondary-foreground",children:e.command??e.message}),e.detail?(0,i.jsx)("div",{className:"mt-0.5 truncate text-[11.5px] text-muted-foreground",children:e.detail}):null,e.cwd?(0,i.jsx)("div",{className:"mt-0.5 truncate font-mono text-[11px] text-[#a4a9b0]",children:e.cwd}):null,(0,i.jsx)("div",{className:"mt-0.5 font-mono text-[11px] text-[#a4a9b0]",children:(0,i.jsx)(l.Ago,{ms:e.createdAt})})]}),(0,i.jsx)("div",{className:"flex-none pt-0.5",children:(0,i.jsx)(p.ApprovalActions,{id:e.id})})]},e.id))})]})}var x=e.i(54129),h=e.i(69377);function v(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),!1===n||!r||!r.defaultPrevented)return t?.(r)}}function g(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function b(...e){return x.useCallback(function(...e){return t=>{let n=!1,r=e.map(e=>{let r=g(e,t);return n||"function"!=typeof r||(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];"function"==typeof n?n():g(e[t],null)}}}}(...e),e)}function y(e,t=[]){let n=[],r=()=>{let t=n.map(e=>x.createContext(e));return function(n){let r=n?.[e]||t;return x.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return r.scopeName=e,[function(t,r){let o=x.createContext(r);o.displayName=t+"Context";let l=n.length;n=[...n,r];let a=t=>{let{scope:n,children:r,...a}=t,s=n?.[e]?.[l]||o,c=x.useMemo(()=>a,Object.values(a));return(0,i.jsx)(s.Provider,{value:c,children:r})};return a.displayName=t+"Provider",[a,function(n,i,a={}){let{optional:s=!1}=a,c=i?.[e]?.[l]||o,u=x.useContext(c);if(u)return u;if(void 0!==r)return r;if(!s)throw Error(`\`${n}\` must be used within \`${t}\``)}]},function(...e){let t=e[0];if(1===e.length)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}(r,...t)]}"u">typeof window&&window.document&&window.document.createElement;var w=e.i(94766),j=Symbol.for("radix.slottable"),N=Symbol.for("react.lazy");function C(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===N&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var S=x[" use ".trim().toString()],E=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{var n;let r,o=(n=`Primitive.${t}`,(r=x.forwardRef((e,t)=>{var r;let i,o,{children:l,...a}=e,s=null,c=!1,u=[];C(l)&&"function"==typeof S&&(l=S(l._payload)),x.Children.forEach(l,e=>{var t;if(t=e,x.isValidElement(t)&&"function"==typeof t.type&&"__radixId"in t.type&&t.type.__radixId===j){c=!0;let t="child"in e.props?e.props.child:e.props.children;C(t)&&"function"==typeof S&&(t=S(t._payload)),s=((e,t)=>{if("child"in e.props){let t=e.props.child;return x.isValidElement(t)?x.cloneElement(t,void 0,e.props.children(t.props.children)):null}return x.isValidElement(t)?t:null})(e,t),u.push(s?.props?.children)}else u.push(e)}),s?s=x.cloneElement(s,void 0,u):!c&&1===x.Children.count(l)&&x.isValidElement(l)&&(s=l);let d=s?(r=s,(o=(i=Object.getOwnPropertyDescriptor(r.props,"ref")?.get)&&"isReactWarning"in i&&i.isReactWarning)?r.ref:(o=(i=Object.getOwnPropertyDescriptor(r,"ref")?.get)&&"isReactWarning"in i&&i.isReactWarning)?r.props.ref:r.props.ref||r.ref):void 0,f=b(t,d);if(!s){if(l||0===l){let e,t;throw Error(c?(e=n,`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`):(t=n,`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`))}return l}let p=function(e,t){let n={...t};for(let r in t){let i=e[r],o=t[r];/^on[A-Z]/.test(r)?i&&o?n[r]=(...e)=>{let t=o(...e);return i(...e),t}:i&&(n[r]=i):"style"===r?n[r]={...i,...o}:"className"===r&&(n[r]=[i,o].filter(Boolean).join(" "))}return{...e,...n}}(a,s.props??{});return s.type!==x.Fragment&&(p.ref=t?f:d),x.cloneElement(s,p)})).displayName=`${n}.Slot`,r),l=x.forwardRef((e,n)=>{let{asChild:r,...l}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,i.jsx)(r?o:t,{...l,ref:n})});return l.displayName=`Primitive.${t}`,{...e,[t]:l}},{});function R(e){let t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...e)=>t.current?.(...e),[])}var k="dismissableLayer.update",T=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),L=x.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:s,onInteractOutside:c,onDismiss:u,...d}=e,f=x.useContext(T),[p,m]=x.useState(null),h=p?.ownerDocument??globalThis?.document,[,g]=x.useState({}),y=b(t,m),w=Array.from(f.layers),[j]=[...f.layersWithOutsidePointerEventsDisabled].slice(-1),N=j?w.indexOf(j):-1,C=p?w.indexOf(p):-1,S=f.layersWithOutsidePointerEventsDisabled.size>0,L=C>=N,D=x.useRef(!1),I=function(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:o,shouldHandlePointerDownOutside:l=A}=t,a=R(e),s=x.useRef(!1),c=x.useRef(!1),u=x.useRef(new Map),d=x.useRef(()=>{});return x.useEffect(()=>{function e(){c.current=!1,i.current=!1,u.current.clear()}function t(e){if(!c.current)return;let t=e.target;t instanceof Node&&[...o].some(e=>e.contains(t))||u.current.set(e.type,!0),"click"===e.type&&window.setTimeout(()=>{c.current&&d.current()},0)}function f(e){c.current&&u.current.set(e.type,!1)}let p=t=>{if(t.target&&!s.current){let o=function(){n.removeEventListener("click",d.current);let t=Array.from(u.current.values()).some(Boolean);e(),t||P("dismissableLayer.pointerDownOutside",a,f,{discrete:!0})};if(!l(t.target)){n.removeEventListener("click",d.current),e(),s.current=!1;return}let f={originalEvent:t};c.current=!0,i.current=r&&0===t.button,u.current.clear(),r&&0===t.button?(n.removeEventListener("click",d.current),d.current=o,n.addEventListener("click",d.current,{once:!0})):o()}else n.removeEventListener("click",d.current),e();s.current=!1},m=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(let e of m)n.addEventListener(e,t,!0),n.addEventListener(e,f);let x=window.setTimeout(()=>{n.addEventListener("pointerdown",p)},0);return()=>{for(let e of(window.clearTimeout(x),n.removeEventListener("pointerdown",p),n.removeEventListener("click",d.current),m))n.removeEventListener(e,t,!0),n.removeEventListener(e,f)}},[n,a,r,i,o,l]),{onPointerDownCapture:()=>s.current=!0}}(e=>{a?.(e),c?.(e),e.defaultPrevented||u?.()},{ownerDocument:h,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:D,dismissableSurfaces:f.dismissableSurfaces,shouldHandlePointerDownOutside:x.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...f.branches].some(t=>t.contains(e));return L&&!t},[f.branches,L])}),B=function(e,t=globalThis?.document){let n=R(e),r=x.useRef(!1);return x.useEffect(()=>{let e=e=>{e.target&&!r.current&&P("dismissableLayer.focusOutside",n,{originalEvent:e},{discrete:!1})};return t.addEventListener("focusin",e),()=>t.removeEventListener("focusin",e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}(e=>{if(o&&D.current)return;let t=e.target;![...f.branches].some(e=>e.contains(t))&&(s?.(e),c?.(e),e.defaultPrevented||u?.())},h),$=!!p&&C===w.length-1,M=R(e=>{"Escape"===e.key&&(l?.(e),!e.defaultPrevented&&u&&(e.preventDefault(),u()))});return x.useEffect(()=>{if($)return h.addEventListener("keydown",M,{capture:!0}),()=>h.removeEventListener("keydown",M,{capture:!0})},[h,$,M]),x.useEffect(()=>{if(p)return n&&(0===f.layersWithOutsidePointerEventsDisabled.size&&(r=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),f.layersWithOutsidePointerEventsDisabled.add(p)),f.layers.add(p),O(),()=>{n&&(f.layersWithOutsidePointerEventsDisabled.delete(p),0===f.layersWithOutsidePointerEventsDisabled.size&&(h.body.style.pointerEvents=r))}},[p,h,n,f]),x.useEffect(()=>()=>{p&&(f.layers.delete(p),f.layersWithOutsidePointerEventsDisabled.delete(p),O())},[p,f]),x.useEffect(()=>{let e=()=>g({});return document.addEventListener(k,e),()=>document.removeEventListener(k,e)},[]),(0,i.jsx)(E.div,{...d,ref:y,style:{pointerEvents:S?L?"auto":"none":void 0,...e.style},onFocusCapture:v(e.onFocusCapture,B.onFocusCapture),onBlurCapture:v(e.onBlurCapture,B.onBlurCapture),onPointerDownCapture:v(e.onPointerDownCapture,I.onPointerDownCapture)})});L.displayName="DismissableLayer",x.forwardRef((e,t)=>{let n=x.useContext(T),r=x.useRef(null),o=b(t,r);return x.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,i.jsx)(E.div,{...e,ref:o})}).displayName="DismissableLayerBranch";var A=()=>!0;function O(){let e=new CustomEvent(k);document.dispatchEvent(e)}function P(e,t,n,{discrete:r}){let i=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});if(t&&i.addEventListener(e,t,{once:!0}),r)i&&w.flushSync(()=>i.dispatchEvent(o));else i.dispatchEvent(o)}var D=globalThis?.document?x.useLayoutEffect:()=>{},I=x[" useId ".trim().toString()]||(()=>void 0),B=0;let $=["top","right","bottom","left"],M=Math.min,_=Math.max,F=Math.round,z=Math.floor,H=e=>({x:e,y:e}),W={left:"right",right:"left",bottom:"top",top:"bottom"};function U(e,t){return"function"==typeof e?e(t):e}function V(e){return e.split("-")[0]}function Y(e){return e.split("-")[1]}function X(e){return"x"===e?"y":"x"}function K(e){return"y"===e?"height":"width"}function q(e){let t=e[0];return"t"===t||"b"===t?"y":"x"}function G(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}let J=["left","right"],Z=["right","left"],Q=["top","bottom"],ee=["bottom","top"];function et(e){let t=V(e);return W[t]+e.slice(t.length)}function en(e){return"number"!=typeof e?{top:0,right:0,bottom:0,left:0,...e}:{top:e,right:e,bottom:e,left:e}}function er(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 ei(e,t,n){let r,{reference:i,floating:o}=e,l=q(t),a=X(q(t)),s=K(a),c=V(t),u="y"===l,d=i.x+i.width/2-o.width/2,f=i.y+i.height/2-o.height/2,p=i[s]/2-o[s]/2;switch(c){case"top":r={x:d,y:i.y-o.height};break;case"bottom":r={x:d,y:i.y+i.height};break;case"right":r={x:i.x+i.width,y:f};break;case"left":r={x:i.x-o.width,y:f};break;default:r={x:i.x,y:i.y}}switch(Y(t)){case"start":r[a]-=p*(n&&u?-1:1);break;case"end":r[a]+=p*(n&&u?-1:1)}return r}async function eo(e,t){var n;void 0===t&&(t={});let{x:r,y:i,platform:o,rects:l,elements:a,strategy:s}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:p=0}=U(t,e),m=en(p),x=a[f?"floating"===d?"reference":"floating":d],h=er(await o.getClippingRect({element:null==(n=await (null==o.isElement?void 0:o.isElement(x)))||n?x:x.contextElement||await (null==o.getDocumentElement?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:s})),v="floating"===d?{x:r,y:i,width:l.floating.width,height:l.floating.height}:l.reference,g=await (null==o.getOffsetParent?void 0:o.getOffsetParent(a.floating)),b=await (null==o.isElement?void 0:o.isElement(g))&&await (null==o.getScale?void 0:o.getScale(g))||{x:1,y:1},y=er(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:g,strategy:s}):v);return{top:(h.top-y.top+m.top)/b.y,bottom:(y.bottom-h.bottom+m.bottom)/b.y,left:(h.left-y.left+m.left)/b.x,right:(y.right-h.right+m.right)/b.x}}let el=async(e,t,n)=>{let{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:l}=n,a=l.detectOverflow?l:{...l,detectOverflow:eo},s=await (null==l.isRTL?void 0:l.isRTL(t)),c=await l.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ei(c,r,s),f=r,p=0,m={};for(let n=0;n<o.length;n++){let x=o[n];if(!x)continue;let{name:h,fn:v}=x,{x:g,y:b,data:y,reset:w}=await v({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:c,platform:a,elements:{reference:e,floating:t}});u=null!=g?g:u,d=null!=b?b:d,m[h]={...m[h],...y},w&&p<50&&(p++,"object"==typeof w&&(w.placement&&(f=w.placement),w.rects&&(c=!0===w.rects?await l.getElementRects({reference:e,floating:t,strategy:i}):w.rects),{x:u,y:d}=ei(c,f,s)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}};function ea(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function es(e){return $.some(t=>e[t]>=0)}let ec=new Set(["left","top"]);async function eu(e,t){let{placement:n,platform:r,elements:i}=e,o=await (null==r.isRTL?void 0:r.isRTL(i.floating)),l=V(n),a=Y(n),s="y"===q(n),c=ec.has(l)?-1:1,u=o&&s?-1:1,d=U(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}="number"==typeof d?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&"number"==typeof m&&(p="end"===a?-1*m:m),s?{x:p*u,y:f*c}:{x:f*c,y:p*u}}function ed(){return"u">typeof window}function ef(e){return ex(e)?(e.nodeName||"").toLowerCase():"#document"}function ep(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function em(e){var t;return null==(t=(ex(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function ex(e){return!!ed()&&(e instanceof Node||e instanceof ep(e).Node)}function eh(e){return!!ed()&&(e instanceof Element||e instanceof ep(e).Element)}function ev(e){return!!ed()&&(e instanceof HTMLElement||e instanceof ep(e).HTMLElement)}function eg(e){return!(!ed()||"u"<typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof ep(e).ShadowRoot)}function eb(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=eR(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&"inline"!==i&&"contents"!==i}function ey(e){try{if(e.matches(":popover-open"))return!0}catch(e){}try{return e.matches(":modal")}catch(e){return!1}}let ew=/transform|translate|scale|rotate|perspective|filter/,ej=/paint|layout|strict|content/,eN=e=>!!e&&"none"!==e;function eC(e){let t=eh(e)?eR(e):e;return eN(t.transform)||eN(t.translate)||eN(t.scale)||eN(t.rotate)||eN(t.perspective)||!eS()&&(eN(t.backdropFilter)||eN(t.filter))||ew.test(t.willChange||"")||ej.test(t.contain||"")}function eS(){return null==t&&(t="u">typeof CSS&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),t}function eE(e){return/^(html|body|#document)$/.test(ef(e))}function eR(e){return ep(e).getComputedStyle(e)}function ek(e){return eh(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function eT(e){if("html"===ef(e))return e;let t=e.assignedSlot||e.parentNode||eg(e)&&e.host||em(e);return eg(t)?t.host:t}function eL(e,t,n){var r;void 0===t&&(t=[]),void 0===n&&(n=!0);let i=function e(t){let n=eT(t);return eE(n)?t.ownerDocument?t.ownerDocument.body:t.body:ev(n)&&eb(n)?n:e(n)}(e),o=i===(null==(r=e.ownerDocument)?void 0:r.body),l=ep(i);if(!o)return t.concat(i,eL(i,[],n));{let e=eA(l);return t.concat(l,l.visualViewport||[],eb(i)?i:[],e&&n?eL(e):[])}}function eA(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function eO(e){let t=eR(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=ev(e),o=i?e.offsetWidth:n,l=i?e.offsetHeight:r,a=F(n)!==o||F(r)!==l;return a&&(n=o,r=l),{width:n,height:r,$:a}}function eP(e){return eh(e)?e:e.contextElement}function eD(e){let t=eP(e);if(!ev(t))return H(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:o}=eO(t),l=(o?F(n.width):n.width)/r,a=(o?F(n.height):n.height)/i;return l&&Number.isFinite(l)||(l=1),a&&Number.isFinite(a)||(a=1),{x:l,y:a}}let eI=H(0);function eB(e){let t=ep(e);return eS()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:eI}function e$(e,t,n,r){var i;void 0===t&&(t=!1),void 0===n&&(n=!1);let o=e.getBoundingClientRect(),l=eP(e),a=H(1);t&&(r?eh(r)&&(a=eD(r)):a=eD(e));let s=(void 0===(i=n)&&(i=!1),r&&(!i||r===ep(l))&&i)?eB(l):H(0),c=(o.left+s.x)/a.x,u=(o.top+s.y)/a.y,d=o.width/a.x,f=o.height/a.y;if(l){let e=ep(l),t=r&&eh(r)?ep(r):r,n=e,i=eA(n);for(;i&&r&&t!==n;){let e=eD(i),t=i.getBoundingClientRect(),r=eR(i),o=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,l=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,u*=e.y,d*=e.x,f*=e.y,c+=o,u+=l,i=eA(n=ep(i))}}return er({width:d,height:f,x:c,y:u})}function eM(e,t){let n=ek(e).scrollLeft;return t?t.left+n:e$(em(e)).left+n}function e_(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-eM(e,n),y:n.top+t.scrollTop}}function eF(e,t,n){var r;let i;if("viewport"===t)i=function(e,t){let n=ep(e),r=em(e),i=n.visualViewport,o=r.clientWidth,l=r.clientHeight,a=0,s=0;if(i){o=i.width,l=i.height;let e=eS();(!e||e&&"fixed"===t)&&(a=i.offsetLeft,s=i.offsetTop)}let c=eM(r);if(c<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i="CSS1Compat"===e.compatMode&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,l=Math.abs(r.clientWidth-t.clientWidth-i);l<=25&&(o-=l)}else c<=25&&(o+=c);return{width:o,height:l,x:a,y:s}}(e,n);else if("document"===t){let t,n,o,l,a,s,c;r=em(e),t=em(r),n=ek(r),o=r.ownerDocument.body,l=_(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),a=_(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight),s=-n.scrollLeft+eM(r),c=-n.scrollTop,"rtl"===eR(o).direction&&(s+=_(t.clientWidth,o.clientWidth)-l),i={width:l,height:a,x:s,y:c}}else if(eh(t)){let e,r,o,l,a,s;r=(e=e$(t,!0,"fixed"===n)).top+t.clientTop,o=e.left+t.clientLeft,l=ev(t)?eD(t):H(1),a=t.clientWidth*l.x,s=t.clientHeight*l.y,i={width:a,height:s,x:o*l.x,y:r*l.y}}else{let n=eB(e);i={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return er(i)}function ez(e){return"static"===eR(e).position}function eH(e,t){if(!ev(e)||"fixed"===eR(e).position)return null;if(t)return t(e);let n=e.offsetParent;return em(e)===n&&(n=n.ownerDocument.body),n}function eW(e,t){var n;let r=ep(e);if(ey(e))return r;if(!ev(e)){let t=eT(e);for(;t&&!eE(t);){if(eh(t)&&!ez(t))return t;t=eT(t)}return r}let i=eH(e,t);for(;i&&(n=i,/^(table|td|th)$/.test(ef(n)))&&ez(i);)i=eH(i,t);return i&&eE(i)&&ez(i)&&!eC(i)?r:i||function(e){let t=eT(e);for(;ev(t)&&!eE(t);){if(eC(t))return t;if(ey(t))break;t=eT(t)}return null}(e)||r}let eU=async function(e){let t=this.getOffsetParent||eW,n=this.getDimensions,r=await n(e.floating);return{reference:function(e,t,n){let r=ev(t),i=em(t),o="fixed"===n,l=e$(e,!0,o,t),a={scrollLeft:0,scrollTop:0},s=H(0);if(r||!r&&!o)if(("body"!==ef(t)||eb(i))&&(a=ek(t)),r){let e=e$(t,!0,o,t);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else i&&(s.x=eM(i));o&&!r&&i&&(s.x=eM(i));let c=!i||r||o?H(0):e_(i,a);return{x:l.left+a.scrollLeft-s.x-c.x,y:l.top+a.scrollTop-s.y-c.y,width:l.width,height:l.height}}(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}},eV={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,o="fixed"===i,l=em(r),a=!!t&&ey(t.floating);if(r===l||a&&o)return n;let s={scrollLeft:0,scrollTop:0},c=H(1),u=H(0),d=ev(r);if((d||!d&&!o)&&(("body"!==ef(r)||eb(l))&&(s=ek(r)),d)){let e=e$(r);c=eD(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=!l||d||o?H(0):e_(l,s);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-s.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-s.scrollTop*c.y+u.y+f.y}},getDocumentElement:em,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,o=[..."clippingAncestors"===n?ey(t)?[]:function(e,t){let n=t.get(e);if(n)return n;let r=eL(e,[],!1).filter(e=>eh(e)&&"body"!==ef(e)),i=null,o="fixed"===eR(e).position,l=o?eT(e):e;for(;eh(l)&&!eE(l);){let t=eR(l),n=eC(l);n||"fixed"!==t.position||(i=null),(o?n||i:!(!n&&"static"===t.position&&i&&("absolute"===i.position||"fixed"===i.position)||eb(l)&&!n&&function e(t,n){let r=eT(t);return!(r===n||!eh(r)||eE(r))&&("fixed"===eR(r).position||e(r,n))}(e,l)))?i=t:r=r.filter(e=>e!==l),l=eT(l)}return t.set(e,r),r}(t,this._c):[].concat(n),r],l=eF(t,o[0],i),a=l.top,s=l.right,c=l.bottom,u=l.left;for(let e=1;e<o.length;e++){let n=eF(t,o[e],i);a=_(n.top,a),s=M(n.right,s),c=M(n.bottom,c),u=_(n.left,u)}return{width:s-u,height:c-a,x:u,y:a}},getOffsetParent:eW,getElementRects:eU,getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){let{width:t,height:n}=eO(e);return{width:t,height:n}},getScale:eD,isElement:eh,isRTL:function(e){return"rtl"===eR(e).direction}};function eY(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}let eX=e=>({name:"arrow",options:e,async fn(t){let{x:n,y:r,placement:i,rects:o,platform:l,elements:a,middlewareData:s}=t,{element:c,padding:u=0}=U(e,t)||{};if(null==c)return{};let d=en(u),f={x:n,y:r},p=X(q(i)),m=K(p),x=await l.getDimensions(c),h="y"===p,v=h?"clientHeight":"clientWidth",g=o.reference[m]+o.reference[p]-f[p]-o.floating[m],b=f[p]-o.reference[p],y=await (null==l.getOffsetParent?void 0:l.getOffsetParent(c)),w=y?y[v]:0;w&&await (null==l.isElement?void 0:l.isElement(y))||(w=a.floating[v]||o.floating[m]);let j=w/2-x[m]/2-1,N=M(d[h?"top":"left"],j),C=M(d[h?"bottom":"right"],j),S=w-x[m]-C,E=w/2-x[m]/2+(g/2-b/2),R=_(N,M(E,S)),k=!s.arrow&&null!=Y(i)&&E!==R&&o.reference[m]/2-(E<N?N:C)-x[m]/2<0,T=k?E<N?E-N:E-S:0;return{[p]:f[p]+T,data:{[p]:R,centerOffset:E-R-T,...k&&{alignmentOffset:T}},reset:k}}});var eK="u">typeof document?x.useLayoutEffect:function(){};function eq(e,t){let n,r,i;if(e===t)return!0;if(typeof e!=typeof t)return!1;if("function"==typeof e&&e.toString()===t.toString())return!0;if(e&&t&&"object"==typeof e){if(Array.isArray(e)){if((n=e.length)!==t.length)return!1;for(r=n;0!=r--;)if(!eq(e[r],t[r]))return!1;return!0}if((n=(i=Object.keys(e)).length)!==Object.keys(t).length)return!1;for(r=n;0!=r--;)if(!({}).hasOwnProperty.call(t,i[r]))return!1;for(r=n;0!=r--;){let n=i[r];if(("_owner"!==n||!e.$$typeof)&&!eq(e[n],t[n]))return!1}return!0}return e!=e&&t!=t}function eG(e){return"u"<typeof window?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function eJ(e,t){let n=eG(e);return Math.round(t*n)/n}function eZ(e){let t=x.useRef(e);return eK(()=>{t.current=e}),t}var eQ=x.forwardRef((e,t)=>{let{children:n,width:r=10,height:o=5,...l}=e;return(0,i.jsx)(E.svg,{...l,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:(0,i.jsx)("polygon",{points:"0,0 30,0 15,10"})})});eQ.displayName="Arrow";var e0="Popper",[e1,e5]=y(e0),[e4,e2]=e1(e0),e3=e=>{let{__scopePopper:t,children:n}=e,[r,o]=x.useState(null),[l,a]=x.useState(void 0);return(0,i.jsx)(e4,{scope:t,anchor:r,onAnchorChange:o,placementState:l,setPlacementState:a,children:n})};e3.displayName=e0;var e6="PopperAnchor",e9=x.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...o}=e,l=e2(e6,n),a=x.useRef(null),s=l.onAnchorChange,c=b(t,x.useCallback(e=>{a.current=e,e&&s(e)},[s])),u=x.useRef(null);x.useEffect(()=>{if(!r)return;let e=u.current;u.current=r.current,e!==u.current&&s(u.current)});let d=l.placementState&&ta(l.placementState),f=d?.[0],p=d?.[1];return r?null:(0,i.jsx)(E.div,{"data-radix-popper-side":f,"data-radix-popper-align":p,...o,ref:c})});e9.displayName=e6;var e7="PopperContent",[e8,te]=e1(e7),tt=x.forwardRef((e,t)=>{var n,r,o,l,a,s,c,u,d,f,p,m,h;let v,g,y,j,N,C,{__scopePopper:S,side:k="bottom",sideOffset:T=0,align:L="center",alignOffset:A=0,arrowPadding:O=0,avoidCollisions:P=!0,collisionBoundary:I=[],collisionPadding:B=0,sticky:$="partial",hideWhenDetached:F=!1,updatePositionStrategy:H="optimized",onPlaced:W,...en}=e,er=e2(e7,S),[ei,eo]=x.useState(null),ed=b(t,eo),[ef,ep]=x.useState(null),ex=function(e){let[t,n]=x.useState(void 0);return D(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{let r,i;if(!Array.isArray(t)||!t.length)return;let o=t[0];if("borderBoxSize"in o){let e=o.borderBoxSize,t=Array.isArray(e)?e[0]:e;r=t.inlineSize,i=t.blockSize}else r=e.offsetWidth,i=e.offsetHeight;n({width:r,height:i})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}n(void 0)},[e]),t}(ef),eh=ex?.width??0,ev=ex?.height??0,eg="number"==typeof B?B:{top:0,right:0,bottom:0,left:0,...B},eb=Array.isArray(I)?I:[I],ey=eb.length>0,ew={padding:eg,boundary:eb.filter(to),altBoundary:ey},{refs:ej,floatingStyles:eN,placement:eC,isPositioned:eS,middlewareData:eE}=function(e){void 0===e&&(e={});let{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:o,floating:l}={},transform:a=!0,whileElementsMounted:s,open:c}=e,[u,d]=x.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=x.useState(r);eq(f,r)||p(r);let[m,h]=x.useState(null),[v,g]=x.useState(null),b=x.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=x.useCallback(e=>{e!==S.current&&(S.current=e,g(e))},[]),j=o||m,N=l||v,C=x.useRef(null),S=x.useRef(null),E=x.useRef(u),R=null!=s,k=eZ(s),T=eZ(i),L=eZ(c),A=x.useCallback(()=>{var e,r;let i,o,l;if(!C.current||!S.current)return;let a={placement:t,strategy:n,middleware:f};T.current&&(a.platform=T.current),(e=C.current,r=S.current,i=new Map,l={...(o={platform:eV,...a}).platform,_c:i},el(e,r,{...o,platform:l})).then(e=>{let t={...e,isPositioned:!1!==L.current};O.current&&!eq(E.current,t)&&(E.current=t,w.flushSync(()=>{d(t)}))})},[f,t,n,T,L]);eK(()=>{!1===c&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[c]);let O=x.useRef(!1);eK(()=>(O.current=!0,()=>{O.current=!1}),[]),eK(()=>{if(j&&(C.current=j),N&&(S.current=N),j&&N){if(k.current)return k.current(j,N,A);A()}},[j,N,A,k,R]);let P=x.useMemo(()=>({reference:C,floating:S,setReference:b,setFloating:y}),[b,y]),D=x.useMemo(()=>({reference:j,floating:N}),[j,N]),I=x.useMemo(()=>{let e={position:n,left:0,top:0};if(!D.floating)return e;let t=eJ(D.floating,u.x),r=eJ(D.floating,u.y);return a?{...e,transform:"translate("+t+"px, "+r+"px)",...eG(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:t,top:r}},[n,a,D.floating,u.x,u.y]);return x.useMemo(()=>({...u,update:A,refs:P,elements:D,floatingStyles:I}),[u,A,P,D,I])}({strategy:"fixed",placement:k+("center"!==L?"-"+L:""),whileElementsMounted:(...e)=>(function(e,t,n,r){let i;void 0===r&&(r={});let{ancestorScroll:o=!0,ancestorResize:l=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:s="function"==typeof IntersectionObserver,animationFrame:c=!1}=r,u=eP(e),d=o||l?[...u?eL(u):[],...t?eL(t):[]]:[];d.forEach(e=>{o&&e.addEventListener("scroll",n,{passive:!0}),l&&e.addEventListener("resize",n)});let f=u&&s?function(e,t){let n,r=null,i=em(e);function o(){var e;clearTimeout(n),null==(e=r)||e.disconnect(),r=null}return!function l(a,s){void 0===a&&(a=!1),void 0===s&&(s=1),o();let c=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=c;if(a||t(),!f||!p)return;let m={rootMargin:-z(d)+"px "+-z(i.clientWidth-(u+f))+"px "+-z(i.clientHeight-(d+p))+"px "+-z(u)+"px",threshold:_(0,M(1,s))||1},x=!0;function h(t){let r=t[0].intersectionRatio;if(r!==s){if(!x)return l();r?l(!1,r):n=setTimeout(()=>{l(!1,1e-7)},1e3)}1!==r||eY(c,e.getBoundingClientRect())||l(),x=!1}try{r=new IntersectionObserver(h,{...m,root:i.ownerDocument})}catch(e){r=new IntersectionObserver(h,m)}r.observe(e)}(!0),o}(u,n):null,p=-1,m=null;a&&(m=new ResizeObserver(e=>{let[r]=e;r&&r.target===u&&m&&t&&(m.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var e;null==(e=m)||e.observe(t)})),n()}),u&&!c&&m.observe(u),t&&m.observe(t));let x=c?e$(e):null;return c&&function t(){let r=e$(e);x&&!eY(x,r)&&n(),x=r,i=requestAnimationFrame(t)}(),n(),()=>{var e;d.forEach(e=>{o&&e.removeEventListener("scroll",n),l&&e.removeEventListener("resize",n)}),null==f||f(),null==(e=m)||e.disconnect(),m=null,c&&cancelAnimationFrame(i)}})(...e,{animationFrame:"always"===H}),elements:{reference:er.anchor},middleware:[{name:(v={name:"offset",options:r=n={mainAxis:T+ev,alignmentAxis:A},async fn(e){var t,n;let{x:i,y:o,placement:l,middlewareData:a}=e,s=await eu(e,r);return l===(null==(t=a.offset)?void 0:t.placement)&&null!=(n=a.arrow)&&n.alignmentOffset?{}:{x:i+s.x,y:o+s.y,data:{...s,placement:l}}}}).name,fn:v.fn,options:[n,void 0]},P&&{name:(g={name:"shift",options:a=l={mainAxis:!0,crossAxis:!1,limiter:"partial"===$?{fn:(o=void 0,{options:o={},fn(e){let{x:t,y:n,placement:r,rects:i,middlewareData:l}=e,{offset:a=0,mainAxis:s=!0,crossAxis:c=!0}=U(o,e),u={x:t,y:n},d=q(r),f=X(d),p=u[f],m=u[d],x=U(a,e),h="number"==typeof x?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(s){let e="y"===f?"height":"width",t=i.reference[f]-i.floating[e]+h.mainAxis,n=i.reference[f]+i.reference[e]-h.mainAxis;p<t?p=t:p>n&&(p=n)}if(c){var v,g;let e="y"===f?"width":"height",t=ec.has(V(r)),n=i.reference[d]-i.floating[e]+(t&&(null==(v=l.offset)?void 0:v[d])||0)+(t?0:h.crossAxis),o=i.reference[d]+i.reference[e]+(t?0:(null==(g=l.offset)?void 0:g[d])||0)-(t?h.crossAxis:0);m<n?m=n:m>o&&(m=o)}return{[f]:p,[d]:m}}}).fn,options:[void 0,void 0]}:void 0,...ew},async fn(e){let{x:t,y:n,placement:r,platform:i}=e,{mainAxis:o=!0,crossAxis:l=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=U(a,e),u={x:t,y:n},d=await i.detectOverflow(e,c),f=q(V(r)),p=X(f),m=u[p],x=u[f];if(o){let e="y"===p?"top":"left",t="y"===p?"bottom":"right",n=m+d[e],r=m-d[t];m=_(n,M(m,r))}if(l){let e="y"===f?"top":"left",t="y"===f?"bottom":"right",n=x+d[e],r=x-d[t];x=_(n,M(x,r))}let h=s.fn({...e,[p]:m,[f]:x});return{...h,data:{x:h.x-t,y:h.y-n,enabled:{[p]:o,[f]:l}}}}}).name,fn:g.fn,options:[l,void 0]},P&&{name:(y={name:"flip",options:c=s={...ew},async fn(e){var t,n,r,i,o,l,a,s;let u,d,f,{placement:p,middlewareData:m,rects:x,initialPlacement:h,platform:v,elements:g}=e,{mainAxis:b=!0,crossAxis:y=!0,fallbackPlacements:w,fallbackStrategy:j="bestFit",fallbackAxisSideDirection:N="none",flipAlignment:C=!0,...S}=U(c,e);if(null!=(t=m.arrow)&&t.alignmentOffset)return{};let E=V(p),R=q(h),k=V(h)===h,T=await (null==v.isRTL?void 0:v.isRTL(g.floating)),L=w||(k||!C?[et(h)]:(u=et(h),[G(h),u,G(u)])),A="none"!==N;!w&&A&&L.push(...(d=Y(h),f=function(e,t,n){switch(e){case"top":case"bottom":if(n)return t?Z:J;return t?J:Z;case"left":case"right":return t?Q:ee;default:return[]}}(V(h),"start"===N,T),d&&(f=f.map(e=>e+"-"+d),C&&(f=f.concat(f.map(G)))),f));let O=[h,...L],P=await v.detectOverflow(e,S),D=[],I=(null==(n=m.flip)?void 0:n.overflows)||[];if(b&&D.push(P[E]),y){let e,t,n,r,i=(l=p,a=x,void 0===(s=T)&&(s=!1),e=Y(l),n=K(t=X(q(l))),r="x"===t?e===(s?"end":"start")?"right":"left":"start"===e?"bottom":"top",a.reference[n]>a.floating[n]&&(r=et(r)),[r,et(r)]);D.push(P[i[0]],P[i[1]])}if(I=[...I,{placement:p,overflows:D}],!D.every(e=>e<=0)){let e=((null==(r=m.flip)?void 0:r.index)||0)+1,t=O[e];if(t&&("alignment"!==y||R===q(t)||I.every(e=>q(e.placement)!==R||e.overflows[0]>0)))return{data:{index:e,overflows:I},reset:{placement:t}};let n=null==(i=I.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:i.placement;if(!n)switch(j){case"bestFit":{let e=null==(o=I.filter(e=>{if(A){let t=q(e.placement);return t===R||"y"===t}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])?void 0:o[0];e&&(n=e);break}case"initialPlacement":n=h}if(p!==n)return{reset:{placement:n}}}return{}}}).name,fn:y.fn,options:[s,void 0]},{name:(j={name:"size",options:d=u={...ew,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:o}=t.reference,l=e.floating.style;l.setProperty("--radix-popper-available-width",`${n}px`),l.setProperty("--radix-popper-available-height",`${r}px`),l.setProperty("--radix-popper-anchor-width",`${i}px`),l.setProperty("--radix-popper-anchor-height",`${o}px`)}},async fn(e){var t,n;let r,i,{placement:o,rects:l,platform:a,elements:s}=e,{apply:c=()=>{},...u}=U(d,e),f=await a.detectOverflow(e,u),p=V(o),m=Y(o),x="y"===q(o),{width:h,height:v}=l.floating;"top"===p||"bottom"===p?(r=p,i=m===(await (null==a.isRTL?void 0:a.isRTL(s.floating))?"start":"end")?"left":"right"):(i=p,r="end"===m?"top":"bottom");let g=v-f.top-f.bottom,b=h-f.left-f.right,y=M(v-f[r],g),w=M(h-f[i],b),j=!e.middlewareData.shift,N=y,C=w;if(null!=(t=e.middlewareData.shift)&&t.enabled.x&&(C=b),null!=(n=e.middlewareData.shift)&&n.enabled.y&&(N=g),j&&!m){let e=_(f.left,0),t=_(f.right,0),n=_(f.top,0),r=_(f.bottom,0);x?C=h-2*(0!==e||0!==t?e+t:_(f.left,f.right)):N=v-2*(0!==n||0!==r?n+r:_(f.top,f.bottom))}await c({...e,availableWidth:C,availableHeight:N});let S=await a.getDimensions(s.floating);return h!==S.width||v!==S.height?{reset:{rects:!0}}:{}}}).name,fn:j.fn,options:[u,void 0]},ef&&{name:(N={name:"arrow",options:p=f={element:ef,padding:O},fn(e){let{element:t,padding:n}="function"==typeof p?p(e):p;return t&&({}).hasOwnProperty.call(t,"current")?null!=t.current?eX({element:t.current,padding:n}).fn(e):{}:t?eX({element:t,padding:n}).fn(e):{}}}).name,fn:N.fn,options:[f,void 0]},tl({arrowWidth:eh,arrowHeight:ev}),F&&{name:(C={name:"hide",options:h=m={strategy:"referenceHidden",...ew,boundary:ey?ew.boundary:void 0},async fn(e){let{rects:t,platform:n}=e,{strategy:r="referenceHidden",...i}=U(h,e);switch(r){case"referenceHidden":{let r=ea(await n.detectOverflow(e,{...i,elementContext:"reference"}),t.reference);return{data:{referenceHiddenOffsets:r,referenceHidden:es(r)}}}case"escaped":{let r=ea(await n.detectOverflow(e,{...i,altBoundary:!0}),t.floating);return{data:{escapedOffsets:r,escaped:es(r)}}}default:return{}}}}).name,fn:C.fn,options:[m,void 0]}]}),eR=er.setPlacementState;D(()=>(eR(eC),()=>{eR(void 0)}),[eC,eR]);let[ek,eT]=ta(eC),eA=R(W);D(()=>{eS&&eA?.()},[eS,eA]);let eO=eE.arrow?.x,eD=eE.arrow?.y,eI=eE.arrow?.centerOffset!==0,[eB,eM]=x.useState();return D(()=>{ei&&eM(window.getComputedStyle(ei).zIndex)},[ei]),(0,i.jsx)("div",{ref:ej.setFloating,"data-radix-popper-content-wrapper":"",style:{...eN,transform:eS?eN.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:eB,"--radix-popper-transform-origin":[eE.transformOrigin?.x,eE.transformOrigin?.y].join(" "),...eE.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,i.jsx)(e8,{scope:S,placedSide:ek,placedAlign:eT,onArrowChange:ep,arrowX:eO,arrowY:eD,shouldHideArrow:eI,children:(0,i.jsx)(E.div,{"data-side":ek,"data-align":eT,...en,ref:ed,style:{...en.style,animation:eS?void 0:"none"}})})})});tt.displayName=e7;var tn="PopperArrow",tr={top:"bottom",right:"left",bottom:"top",left:"right"},ti=x.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,o=te(tn,n),l=tr[o.placedSide];return(0,i.jsx)("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:(0,i.jsx)(eQ,{...r,ref:t,style:{...r.style,display:"block"}})})});function to(e){return null!==e}ti.displayName=tn;var tl=e=>({name:"transformOrigin",options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,o=i.arrow?.centerOffset!==0,l=o?0:e.arrowWidth,a=o?0:e.arrowHeight,[s,c]=ta(n),u={start:"0%",center:"50%",end:"100%"}[c],d=(i.arrow?.x??0)+l/2,f=(i.arrow?.y??0)+a/2,p="",m="";return"bottom"===s?(p=o?u:`${d}px`,m=`${-a}px`):"top"===s?(p=o?u:`${d}px`,m=`${r.floating.height+a}px`):"right"===s?(p=`${-a}px`,m=o?u:`${f}px`):"left"===s&&(p=`${r.floating.width+a}px`,m=o?u:`${f}px`),{data:{x:p,y:m}}}});function ta(e){let[t,n="center"]=e.split("-");return[t,n]}var ts=x.forwardRef((e,t)=>{let{container:n,...r}=e,[o,l]=x.useState(!1);D(()=>l(!0),[]);let a=n||o&&globalThis?.document?.body;return a?w.createPortal((0,i.jsx)(E.div,{...r,ref:t}),a):null});ts.displayName="Portal";var tc=e=>{var t;let n,r,{present:i,children:o}=e,l=function(e){var t,n;let[r,i]=x.useState(),o=x.useRef(null),l=x.useRef(e),a=x.useRef("none"),s=x.useRef(void 0),[c,u]=(t=e?"mounted":"unmounted",n={mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}},x.useReducer((e,t)=>n[e][t]??e,t));return x.useEffect(()=>{"mounted"===c?(a.current=s.current??td(o.current),s.current=void 0):a.current="none"},[c]),D(()=>{let t=o.current,n=l.current;if(n!==e){let r=a.current,i=td(t);e?(s.current=i,u("MOUNT")):"none"===i||t?.display==="none"?u("UNMOUNT"):n&&r!==i?u("ANIMATION_OUT"):u("UNMOUNT"),l.current=e}},[e,u]),D(()=>{if(r){let e,t=r.ownerDocument.defaultView??window,n=n=>{let i=td(o.current).includes(CSS.escape(n.animationName));if(n.target===r&&i&&(u("ANIMATION_END"),!l.current)){let n=r.style.animationFillMode;r.style.animationFillMode="forwards",e=t.setTimeout(()=>{"forwards"===r.style.animationFillMode&&(r.style.animationFillMode=n)})}},i=e=>{e.target===r&&(a.current=td(o.current))};return r.addEventListener("animationstart",i),r.addEventListener("animationcancel",n),r.addEventListener("animationend",n),()=>{t.clearTimeout(e),r.removeEventListener("animationstart",i),r.removeEventListener("animationcancel",n),r.removeEventListener("animationend",n)}}u("ANIMATION_END")},[r,u]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:x.useCallback(e=>{if(e){let t=getComputedStyle(e);o.current=t,s.current=td(t)}else o.current=null;i(e)},[])}}(i),a="function"==typeof o?o({present:l.isPresent}):x.Children.only(o),s=function(...e){let t=x.useRef(e);return t.current=e,x.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=tu(t,e);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];"function"==typeof t?t():tu(n[e],null)}}},[])}(l.ref,(t=a,(r=(n=Object.getOwnPropertyDescriptor(t.props,"ref")?.get)&&"isReactWarning"in n&&n.isReactWarning)?t.ref:(r=(n=Object.getOwnPropertyDescriptor(t,"ref")?.get)&&"isReactWarning"in n&&n.isReactWarning)?t.props.ref:t.props.ref||t.ref));return"function"==typeof o||l.isPresent?x.cloneElement(a,{ref:s}):null};function tu(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}function td(e){return e?.animationName||"none"}tc.displayName="Presence",x[" useEffectEvent ".trim().toString()],x[" useInsertionEffect ".trim().toString()];var tf=x[" useInsertionEffect ".trim().toString()]||D;Symbol("RADIX:SYNC_STATE");var tp=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),tm=x.forwardRef((e,t)=>(0,i.jsx)(E.span,{...e,ref:t,style:{...tp,...e.style}}));tm.displayName="VisuallyHidden";var[tx,th]=y("Tooltip",[e5]),tv=e5(),tg="TooltipProvider",tb="tooltip.open",[ty,tw]=tx(tg),tj=e=>{let{__scopeTooltip:t,delayDuration:n=700,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:l}=e,a=x.useRef(!0),s=x.useRef(!1),c=x.useRef(0);return x.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,i.jsx)(ty,{scope:t,isOpenDelayedRef:a,delayDuration:n,onOpen:x.useCallback(()=>{r<=0||(window.clearTimeout(c.current),a.current=!1)},[r]),onClose:x.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>a.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:x.useCallback(e=>{s.current=e},[]),disableHoverableContent:o,children:l})};tj.displayName=tg;var tN="Tooltip",[tC,tS]=tx(tN),tE=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:o,onOpenChange:l,disableHoverableContent:a,delayDuration:s}=e,c=tw(tN,e.__scopeTooltip),u=tv(t),[d,f]=x.useState(null),p=function(){let[e,t]=x.useState(I());return D(()=>{t(e=>e??String(B++))},[void 0]),e?`radix-${e}`:""}(),m=x.useRef(0),h=a??c.disableHoverableContent,v=s??c.delayDuration,g=x.useRef(!1),[b,y]=function({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,o,l]=function({defaultProp:e,onChange:t}){let[n,r]=x.useState(e),i=x.useRef(n),o=x.useRef(t);return tf(()=>{o.current=t},[t]),x.useEffect(()=>{i.current!==n&&(o.current?.(n),i.current=n)},[n,i]),[n,r,o]}({defaultProp:t,onChange:n}),a=void 0!==e,s=a?e:i;{let t=x.useRef(void 0!==e);x.useEffect(()=>{let e=t.current;if(e!==a){let t=a?"controlled":"uncontrolled";console.warn(`${r} is changing from ${e?"controlled":"uncontrolled"} to ${t}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`)}t.current=a},[a,r])}return[s,x.useCallback(t=>{if(a){let n="function"==typeof t?t(e):t;n!==e&&l.current?.(n)}else o(t)},[a,e,o,l])]}({prop:r,defaultProp:o??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(tb))):c.onClose(),l?.(e)},caller:tN}),w=x.useMemo(()=>b?g.current?"delayed-open":"instant-open":"closed",[b]),j=x.useCallback(()=>{window.clearTimeout(m.current),m.current=0,g.current=!1,y(!0)},[y]),N=x.useCallback(()=>{window.clearTimeout(m.current),m.current=0,y(!1)},[y]),C=x.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{g.current=!0,y(!0),m.current=0},v)},[v,y]);return x.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),(0,i.jsx)(e3,{...u,children:(0,i.jsx)(tC,{scope:t,contentId:p,open:b,stateAttribute:w,trigger:d,onTriggerChange:f,onTriggerEnter:x.useCallback(()=>{c.isOpenDelayedRef.current?C():j()},[c.isOpenDelayedRef,C,j]),onTriggerLeave:x.useCallback(()=>{h?N():(window.clearTimeout(m.current),m.current=0)},[N,h]),onOpen:j,onClose:N,disableHoverableContent:h,children:n})})};tE.displayName=tN;var tR="TooltipTrigger",tk=x.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,o=tS(tR,n),l=tw(tR,n),a=tv(n),s=b(t,x.useRef(null),o.onTriggerChange),c=x.useRef(!1),u=x.useRef(!1),d=x.useCallback(()=>c.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),(0,i.jsx)(e9,{asChild:!0,...a,children:(0,i.jsx)(E.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:s,onPointerMove:v(e.onPointerMove,e=>{"touch"!==e.pointerType&&(u.current||l.isPointerInTransitRef.current||(o.onTriggerEnter(),u.current=!0))}),onPointerLeave:v(e.onPointerLeave,()=>{o.onTriggerLeave(),u.current=!1}),onPointerDown:v(e.onPointerDown,()=>{o.open&&o.onClose(),c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:v(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:v(e.onBlur,o.onClose),onClick:v(e.onClick,o.onClose)})})});tk.displayName=tR;var tT="TooltipPortal",[tL,tA]=tx(tT,{forceMount:void 0}),tO=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,l=tS(tT,t);return(0,i.jsx)(tL,{scope:t,forceMount:n,children:(0,i.jsx)(tc,{present:n||l.open,children:(0,i.jsx)(ts,{asChild:!0,container:o,children:r})})})};tO.displayName=tT;var tP="TooltipContent",tD=x.forwardRef((e,t)=>{let n=tA(tP,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...l}=e,a=tS(tP,e.__scopeTooltip);return(0,i.jsx)(tc,{present:r||a.open,children:a.disableHoverableContent?(0,i.jsx)(t_,{side:o,...l,ref:t}):(0,i.jsx)(tI,{side:o,...l,ref:t})})}),tI=x.forwardRef((e,t)=>{let n=tS(tP,e.__scopeTooltip),r=tw(tP,e.__scopeTooltip),o=x.useRef(null),l=b(t,o),[a,s]=x.useState(null),{trigger:c,onClose:u}=n,d=o.current,{onPointerInTransitChange:f}=r,p=x.useCallback(()=>{s(null),f(!1)},[f]),m=x.useCallback((e,t)=>{let n,r=e.currentTarget,i={x:e.clientX,y:e.clientY},o=function(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),o=Math.abs(t.left-e.x);switch(Math.min(n,r,i,o)){case o:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw Error("unreachable")}}(i,r.getBoundingClientRect());s(((n=[...function(e,t,n=5){let r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n})}return r}(i,o),...function(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}(t.getBoundingClientRect())].slice()).sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:1*!!(e.y>t.y)),function(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return(n.pop(),1===t.length&&1===n.length&&t[0].x===n[0].x&&t[0].y===n[0].y)?t:t.concat(n)}(n))),f(!0)},[f]);return x.useEffect(()=>()=>p(),[p]),x.useEffect(()=>{if(c&&d){let e=e=>m(e,d),t=e=>m(e,c);return c.addEventListener("pointerleave",e),d.addEventListener("pointerleave",t),()=>{c.removeEventListener("pointerleave",e),d.removeEventListener("pointerleave",t)}}},[c,d,m,p]),x.useEffect(()=>{if(a){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||d?.contains(t),i=!function(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,o=t.length-1;e<t.length;o=e++){let l=t[e],a=t[o],s=l.x,c=l.y,u=a.x,d=a.y;c>r!=d>r&&n<(u-s)*(r-c)/(d-c)+s&&(i=!i)}return i}(n,a);r?p():i&&(p(),u())};return document.addEventListener("pointermove",e),()=>document.removeEventListener("pointermove",e)}},[c,d,a,u,p]),(0,i.jsx)(t_,{...e,ref:l})}),[tB,t$]=tx(tN,{isInside:!1}),tM=((n=e=>"child"in e?e.children(e.child):e.children).displayName="TooltipContent.Slottable",n.__radixId=j,n),t_=x.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:l,onPointerDownOutside:a,...s}=e,c=tS(tP,n),u=tv(n),{onClose:d}=c;return x.useEffect(()=>(document.addEventListener(tb,d),()=>document.removeEventListener(tb,d)),[d]),x.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&d()};return window.addEventListener("scroll",e,{capture:!0}),()=>window.removeEventListener("scroll",e,{capture:!0})}},[c.trigger,d]),(0,i.jsx)(L,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:e=>e.preventDefault(),onDismiss:d,children:(0,i.jsxs)(tt,{"data-state":c.stateAttribute,...u,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[(0,i.jsx)(tM,{children:r}),(0,i.jsx)(tB,{scope:n,isInside:!0,children:(0,i.jsx)(tm,{id:c.contentId,role:"tooltip",children:o||r})})]})})});tD.displayName=tP;var tF="TooltipArrow",tz=x.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,o=tv(n);return t$(tF,n).isInside?null:(0,i.jsx)(ti,{...o,...r,ref:t})});function tH({delayDuration:e=0,...t}){return(0,i.jsx)(tj,{delayDuration:e,...t})}function tW(e){return(0,i.jsx)(tH,{children:(0,i.jsx)(tE,{...e})})}function tU(e){return(0,i.jsx)(tk,{...e})}function tV({className:e,sideOffset:t=4,children:n,...r}){return(0,i.jsx)(tO,{children:(0,i.jsxs)(tD,{sideOffset:t,className:(0,c.cn)("z-50 w-fit max-w-64 origin-(--radix-tooltip-content-transform-origin) rounded-md bg-primary px-3 py-1.5 text-xs text-balance text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r,children:[n,(0,i.jsx)(tz,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] fill-primary"})]})})}tz.displayName=tF;var tY=e.i(1485);let tX=[{app:"claude",label:"Claude",icon:"claude"},{app:"codex",label:"Codex",icon:"codex"},{app:"vscode",label:"VS Code",icon:"ext"},{app:"cmux",label:"cmux",icon:"terminal"},{app:"herdr",label:"Herdr",icon:"terminal"},{app:"iterm2",label:"iTerm2",icon:"terminal"},{app:"finder",label:"Finder",icon:"folder"}];function tK({url:e}){let[t,n]=(0,x.useState)(!1),r=(0,x.useRef)(null);(0,x.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]);let o=(0,x.useCallback)(async()=>{try{await navigator.clipboard.writeText(e),n(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>n(!1),1500)}catch{}},[e]);return(0,i.jsxs)(h.Button,{variant:"outline",size:"sm",onClick:o,children:[t?(0,i.jsx)(a.Icons.check,{}):(0,i.jsx)(a.Icons.copy,{}),t?"Copied":"Copy URL"]})}function tq({reason:e,children:t}){return e?(0,i.jsxs)(tW,{children:[(0,i.jsx)(tU,{asChild:!0,children:(0,i.jsx)("span",{className:"cursor-not-allowed",children:t})}),(0,i.jsx)(tV,{children:e})]}):(0,i.jsx)(i.Fragment,{children:t})}function tG({box:e}){let{webUrl:t,vncUrl:n}=e,{apps:r,supported:o,pending:l,launch:s}=function(e){let[t,n]=(0,x.useState)(null),[r,i]=(0,x.useState)(null);(0,x.useEffect)(()=>{let e=!0;return(async()=>{try{let t=await fetch("/api/v1/open-targets",{credentials:"same-origin"});e&&n(t.ok?await t.json():null)}catch{e&&n(null)}})(),()=>{e=!1}},[]);let o=(0,x.useCallback)(async t=>{i(t);try{let n=await fetch(`/api/v1/boxes/${encodeURIComponent(e.id)}/open`,{method:"POST",credentials:"same-origin",headers:{"content-type":"application/json"},body:JSON.stringify({app:t})});if(!n.ok){let e=await n.json().catch(()=>null);window.alert(`Open in ${t} failed: ${e?.error?.message??`HTTP ${n.status}`}`)}}catch(e){window.alert(`Open in ${t} failed: ${e instanceof Error?e.message:String(e)}`)}finally{i(null)}},[e.id]),l=t?.supported?t.targets:null;return{apps:l?tX.map(({app:t,label:n,icon:r})=>{let i=l[t],o=i.available?i.providers&&!i.providers.includes(e.provider)?`Not available for ${e.provider} boxes`:null:i.reason??`${n} is not installed`;return{app:t,label:n,icon:r,disabledReason:o}}):[],supported:null!==l,pending:r,launch:o}}(e),c="paused"===e.status?"Box is paused — resume to access":"stopped"===e.status?"Box is stopped — start to access":null,u=t?null:c??"No web service exposed",f=n?null:!1===e.vncEnabled?"VNC is not enabled for this box":c??"VNC is not available";return o||t||n?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(tY.SectionLabel,{children:"Access"}),(0,i.jsxs)(d.Card,{className:"divide-y divide-border/60 overflow-hidden",children:[(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-3 px-4.5 p-3.5",children:[(0,i.jsxs)("div",{className:"min-w-[150px] flex-1",children:[(0,i.jsx)("div",{className:"text-[13.5px] font-medium",children:t||!n?"Web":"VNC"}),(0,i.jsx)("div",{className:"mt-0.5 break-all font-mono text-[11.5px] text-muted-foreground",children:t??(n?"Remote desktop":u)})]}),(0,i.jsxs)("div",{className:"flex flex-none flex-wrap gap-1.5",children:[t?(0,i.jsxs)(h.Button,{variant:"outline",size:"sm",href:t,target:"_blank",rel:"noreferrer",children:[(0,i.jsx)(a.Icons.ext,{}),"Open web"]}):(0,i.jsx)(tq,{reason:u,children:(0,i.jsxs)(h.Button,{variant:"outline",size:"sm",disabled:!0,children:[(0,i.jsx)(a.Icons.ext,{}),"Open web"]})}),t?(0,i.jsx)(tK,{url:t}):null,n?(0,i.jsxs)(h.Button,{variant:"outline",size:"sm",href:n,target:"_blank",rel:"noreferrer",onClick:()=>{fetch(`/api/v1/boxes/${encodeURIComponent(e.id)}/screen`,{method:"POST",credentials:"same-origin"}).catch(()=>{})},children:[(0,i.jsx)(a.Icons.ext,{}),"Open VNC"]}):(0,i.jsx)(tq,{reason:f,children:(0,i.jsxs)(h.Button,{variant:"outline",size:"sm",disabled:!0,children:[(0,i.jsx)(a.Icons.ext,{}),"Open VNC"]})})]})]}),o?(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-3 px-4.5 p-3.5",children:[(0,i.jsxs)("div",{className:"min-w-[150px] flex-1",children:[(0,i.jsx)("div",{className:"text-[13.5px] font-medium",children:"Apps"}),(0,i.jsx)("div",{className:"mt-0.5 text-[11.5px] text-muted-foreground",children:"Open the box project from the host"})]}),(0,i.jsx)("div",{className:"flex flex-none flex-wrap justify-end gap-1.5",children:r.map(({app:e,label:t,icon:n,disabledReason:r})=>{let o=a.Icons[n];return(0,i.jsx)(tq,{reason:r,children:(0,i.jsxs)(h.Button,{variant:"outline",size:"sm",disabled:null!==r||null!==l,onClick:()=>void s(e),children:[(0,i.jsx)(o,{}),t]})},e)})})]}):null]})]}):null}var tJ=e.i(80922),tZ=e.i(30544),tQ=e.i(51096);function t0({k:e,v:t,mono:n,link:r}){return(0,i.jsxs)("div",{className:"grid grid-cols-[156px_1fr] items-baseline gap-4 px-4.5 p-3 max-sm:grid-cols-1 max-sm:gap-1",children:[(0,i.jsx)("div",{className:"font-mono text-xs text-muted-foreground",children:e}),(0,i.jsx)("div",{className:(0,c.cn)("min-w-0 text-[13.5px]",n?"font-mono text-[13px]":""),children:r?(0,i.jsx)(tQ.default,{className:"cursor-pointer text-primary",href:r,children:t}):t})]})}var t1=e.i(31758),t5=e.i(95141),t4=e.i(3060),t2=e.i(16200),t3=e.i(49604),t6=e.i(9383);let t9=(0,t6.createServerReference)("70fd109611adee18e2a11d04af4332c29e796848e9",t6.callServer,void 0,t6.findSourceMapURL,"gitBranchAction"),t7=(0,t6.createServerReference)("600e7ece96e4038f118842cef0ebcf51dadf743c9b",t6.callServer,void 0,t6.findSourceMapURL,"gitCheckoutAction"),t8=(0,t6.createServerReference)("605f4904ee0814a4a51c0445aa18e7dfbde590c7e5",t6.callServer,void 0,t6.findSourceMapURL,"gitPullAction"),ne=(0,t6.createServerReference)("60675b1179af1a57b7c4bb6e4d893805dd8f7b0b66",t6.callServer,void 0,t6.findSourceMapURL,"gitPushAction"),nt=(0,t6.createServerReference)("607692631dd5973ad6071d94f3fee9c7da56a766db",t6.callServer,void 0,t6.findSourceMapURL,"gitPushHostAction"),nn=0;function nr({toasts:e,dismiss:t}){return(0,i.jsx)("div",{className:"pointer-events-none fixed bottom-5 right-5 z-[60] flex w-[340px] max-w-[calc(100vw-40px)] flex-col gap-2",children:e.map(e=>(0,i.jsxs)("div",{className:"anim-pop pointer-events-auto relative flex items-start gap-3 rounded-xl border border-border bg-card p-3.5 pr-9 shadow-[0_16px_40px_-18px_rgba(20,24,30,.35)]",children:[(0,i.jsx)("span",{className:(0,c.cn)("mt-0.5 grid h-6 w-6 flex-none place-items-center rounded-md border","error"===e.variant?"border-[var(--red-line)] bg-[var(--red-soft)] text-[var(--red)]":"border-[var(--green-line)] bg-accent text-primary"),children:"error"===e.variant?(0,i.jsx)(a.Icons.warn,{className:"size-3.5"}):(0,i.jsx)(a.Icons.check,{className:"size-3.5"})}),(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsx)("div",{className:"text-[13px] font-semibold leading-tight",children:e.title}),e.detail?(0,i.jsx)("div",{className:"mt-0.5 break-words font-mono text-[11.5px] leading-normal text-muted-foreground",children:e.detail}):null]}),(0,i.jsx)("button",{className:"absolute right-2.5 top-2.5 grid h-5 w-5 cursor-pointer place-items-center rounded border-0 bg-transparent text-[#a4a9b0] hover:text-foreground",onClick:()=>t(e.id),"aria-label":"Dismiss",children:(0,i.jsx)(a.Icons.x,{className:"size-3"})})]},e.id))})}function ni({label:e,desc:t,children:n}){return(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-3 px-4.5 p-3.5",children:[(0,i.jsxs)("div",{className:"min-w-[150px] flex-1",children:[(0,i.jsx)("div",{className:"text-[13.5px] font-medium",children:e}),(0,i.jsx)("div",{className:"mt-0.5 font-mono text-[11.5px] text-muted-foreground",children:t})]}),(0,i.jsx)("div",{className:"flex flex-none flex-wrap gap-1.5",children:n})]})}function no({icon:e,disabled:t,onRun:n,children:r}){let[o,l]=(0,x.useState)(!1),a=async()=>{l(!0);try{await n()}finally{l(!1)}};return(0,i.jsxs)(h.Button,{variant:"outline",size:"sm",disabled:t||o,onClick:a,children:[o?(0,i.jsx)("span",{className:"spin",style:{width:12,height:12}}):(0,i.jsx)(e,{}),r]})}function nl(e,t){let n=(e??"").trim()||(t??"").trim();return n?n.split("\n")[0]:void 0}function na({box:e}){let t=(0,o.useRouter)(),{toasts:n,push:r,dismiss:l}=function(){let[e,t]=(0,x.useState)([]),n=(0,x.useCallback)(e=>t(t=>t.filter(t=>t.id!==e)),[]);return{toasts:e,push:(0,x.useCallback)(e=>{let r=++nn;t(t=>[...t,{id:r,...e}]),setTimeout(()=>n(r),4200)},[n]),dismiss:n}}(),[s,u]=(0,x.useState)(null),[f,p]=(0,x.useState)(null),m="running"!==e.status,v=(0,x.useCallback)(async()=>{try{let t=await fetch(`/api/v1/boxes/${encodeURIComponent(e.id)}/git`,{credentials:"same-origin"});u(t.ok?await t.json():null)}catch{u(null)}},[e.id]);(0,x.useEffect)(()=>{v()},[v]);let g=s?.ok&&s.branch?s.branch:e.branch||"—",b=()=>{v(),t.refresh()},y=async(e,t)=>{let n=await t();n.ok?(r({title:e,detail:nl(n.stdout,n.stderr)}),b()):r({variant:"error",title:`${e} failed`,detail:n.error})};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(d.Card,{className:(0,c.cn)("divide-y divide-border/60 overflow-hidden",m?"opacity-90":""),children:[m?(0,i.jsxs)("div",{className:"flex items-center gap-2.5 bg-[var(--amber-soft)] px-4.5 p-2.5 text-[12.5px] text-[var(--amber)]",children:[(0,i.jsx)(a.Icons.warn,{className:"size-3.5 flex-none"}),"Box is ",e.status," — git operations need a running box."]}):null,(0,i.jsxs)(ni,{label:"Sync",desc:`origin ↔ ${g}`,children:[(0,i.jsx)(no,{icon:a.Icons.arrowL,disabled:m,onRun:()=>y("Pulled from origin",()=>t8(e.id)),children:"Pull"}),(0,i.jsx)(no,{icon:a.Icons.ext,disabled:m,onRun:()=>y("Pushed to origin",()=>ne(e.id)),children:"Push"}),(0,i.jsx)(no,{icon:a.Icons.host,disabled:m,onRun:()=>y("Pushed to host",()=>nt(e.id)),children:"Push to host"})]}),(0,i.jsxs)(ni,{label:"Branch",desc:`currently on ${g}`,children:[(0,i.jsxs)(h.Button,{variant:"outline",size:"sm",disabled:m,onClick:()=>p("change"),children:[(0,i.jsx)(a.Icons.branch,{}),"Change branch"]}),(0,i.jsxs)(h.Button,{variant:"outline",size:"sm",disabled:m,onClick:()=>p("new"),children:[(0,i.jsx)(a.Icons.plus,{}),"New branch"]})]})]}),"change"===f?(0,i.jsx)(nu,{box:e,branch:g,onClose:()=>p(null),onDone:r,onRefresh:b}):null,"new"===f?(0,i.jsx)(nd,{box:e,onClose:()=>p(null),onDone:r,onRefresh:b}):null,(0,i.jsx)(nr,{toasts:n,dismiss:l})]})}let ns="__manual__";function nc({boxId:e,value:t,onChange:n,id:r,headLabel:o,currentBranch:l}){let[a,s]=(0,x.useState)(null),[c,u]=(0,x.useState)(l??null),[d,f]=(0,x.useState)(!1);return((0,x.useEffect)(()=>{let t=!1;return(async()=>{try{let n=await fetch(`/api/v1/boxes/${encodeURIComponent(e)}/branches`,{credentials:"same-origin"}),r=n.ok?await n.json():null;if(t)return;r&&Array.isArray(r.branches)&&r.branches.length>0?(s(r.branches),l||"string"!=typeof r.current||u(r.current)):(s([]),f(!0))}catch{t||(s([]),f(!0))}})(),()=>{t=!0}},[e,l]),null===a)?(0,i.jsx)(t3.Select,{id:r,value:"",disabled:!0,wrapperClassName:"w-full",children:(0,i.jsx)("option",{value:"",children:"Loading branches…"})}):d?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t4.Input,{id:r,className:"font-mono text-[13px]",autoFocus:!0,value:t,onChange:e=>n(e.target.value),placeholder:o?"HEAD":"feature-x"}),a.length>0?(0,i.jsx)("button",{type:"button",onClick:()=>{f(!1),n("")},className:"mt-1.5 cursor-pointer text-xs text-secondary-foreground underline-offset-2 hover:underline",children:"← Back to branch list"}):null]}):(0,i.jsxs)(t3.Select,{id:r,value:t,wrapperClassName:"w-full",onChange:e=>{if(e.target.value===ns){f(!0),n("");return}n(e.target.value)},children:[o?(0,i.jsx)("option",{value:"",children:o}):(0,i.jsx)("option",{value:"",disabled:!0,children:"Select a branch…"}),(0,i.jsx)("option",{value:ns,children:"Other / type manually…"}),(0,i.jsx)("option",{disabled:!0,children:"────────────"}),a.map(e=>(0,i.jsxs)("option",{value:e,children:[e,e===c?" (current)":""]},e))]})}function nu({box:e,branch:t,onClose:n,onDone:r,onRefresh:o}){let[l,s]=(0,x.useState)(""),[c,u]=(0,x.useState)(!1),[d,f]=(0,x.useState)(null),p=l.trim().length>0;return(0,i.jsxs)(t5.Dialog,{onClose:n,className:"max-w-[440px]",children:[(0,i.jsxs)(t5.DialogHeader,{children:[(0,i.jsx)(t5.DialogIcon,{children:(0,i.jsx)(a.Icons.branch,{})}),(0,i.jsxs)("div",{children:[(0,i.jsx)(t5.DialogTitle,{children:"Change branch"}),(0,i.jsxs)(t5.DialogDescription,{children:[e.id," · currently on ",t]})]})]}),(0,i.jsxs)(t5.DialogBody,{children:[(0,i.jsx)(t2.Label,{htmlFor:"gb-branch",children:"Branch"}),(0,i.jsx)(nc,{boxId:e.id,id:"gb-branch",value:l,onChange:s,currentBranch:t}),(0,i.jsx)("p",{className:"mt-1.5 text-xs text-muted-foreground",children:"The branch must exist and not be checked out in another worktree."}),d?(0,i.jsx)("p",{className:"mt-2 break-words font-mono text-xs text-destructive",children:d}):null]}),(0,i.jsxs)(t5.DialogFooter,{children:[(0,i.jsx)(h.Button,{variant:"outline",onClick:n,disabled:c,children:"Cancel"}),(0,i.jsxs)(h.Button,{onClick:()=>{p&&!c&&(u(!0),f(null),(async()=>{let t=await t7(e.id,l.trim());t.ok?(r({title:"Branch changed",detail:nl(t.stdout,t.stderr)}),n(),o()):(f(t.error),u(!1))})())},disabled:!p||c,children:[c?(0,i.jsx)("span",{className:"spin"}):(0,i.jsx)(a.Icons.check,{}),c?"Checking out…":"Change branch"]})]})]})}function nd({box:e,onClose:t,onDone:n,onRefresh:r}){let[o,l]=(0,x.useState)(""),[s,c]=(0,x.useState)(""),[u,d]=(0,x.useState)(!1),[f,p]=(0,x.useState)(null),m=o.trim().length>0,v=()=>{m&&!u&&(d(!0),p(null),(async()=>{let i=await t9(e.id,o.trim(),s.trim()||void 0);i.ok?(n({title:"Branch created",detail:nl(i.stdout,i.stderr)}),t(),r()):(p(i.error),d(!1))})())};return(0,i.jsxs)(t5.Dialog,{onClose:t,className:"max-w-[440px]",children:[(0,i.jsxs)(t5.DialogHeader,{children:[(0,i.jsx)(t5.DialogIcon,{children:(0,i.jsx)(a.Icons.branch,{})}),(0,i.jsxs)("div",{children:[(0,i.jsx)(t5.DialogTitle,{children:"New branch"}),(0,i.jsxs)(t5.DialogDescription,{children:[e.id," · branching in the box workspace"]})]})]}),(0,i.jsxs)(t5.DialogBody,{children:[(0,i.jsxs)("div",{className:"mb-4",children:[(0,i.jsx)(t2.Label,{htmlFor:"nb-name",children:"Name"}),(0,i.jsx)(t4.Input,{id:"nb-name",className:"font-mono text-[13px]",autoFocus:!0,value:o,onChange:e=>l(e.target.value),onKeyDown:e=>{"Enter"===e.key&&v()},placeholder:"my-branch"}),(0,i.jsxs)("p",{className:"mt-1.5 text-xs text-muted-foreground",children:["An ",(0,i.jsx)("span",{className:"font-mono",children:"agentbox/"})," prefix is added when missing."]})]}),(0,i.jsxs)(t2.Label,{htmlFor:"nb-from",children:["Base ref ",(0,i.jsx)("span",{className:"font-normal text-[#a4a9b0]",children:"(optional)"})]}),(0,i.jsx)(nc,{boxId:e.id,id:"nb-from",value:s,onChange:c,headLabel:"Current HEAD (default)"}),(0,i.jsx)("p",{className:"mt-1.5 text-xs text-muted-foreground",children:"Defaults to the box's current HEAD."}),f?(0,i.jsx)("p",{className:"mt-2 break-words font-mono text-xs text-destructive",children:f}):null]}),(0,i.jsxs)(t5.DialogFooter,{children:[(0,i.jsx)(h.Button,{variant:"outline",onClick:t,disabled:u,children:"Cancel"}),(0,i.jsxs)(h.Button,{onClick:v,disabled:!m||u,children:[u?(0,i.jsx)("span",{className:"spin"}):(0,i.jsx)(a.Icons.plus,{}),u?"Creating…":"Create branch"]})]})]})}let nf=(0,t6.createServerReference)("6096ff4dd5616157cf1da6a977c271641a3ddce491",t6.callServer,void 0,t6.findSourceMapURL,"restartServiceAction"),np=new Set(["ready","running","done"]),nm=new Set(["crashed","unhealthy","backoff","failed"]),nx={up:"bg-[var(--green)]",bad:"bg-[var(--red)]",idle:"bg-[var(--amber)]"},nh={up:"text-[var(--green-ink)]",bad:"text-[var(--red)]",idle:"text-[var(--amber)]"};function nv({svc:e,disabled:t,onRestart:n}){var r;let o=(r=e.state,np.has(r)?"up":nm.has(r)?"bad":"idle");return(0,i.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[(0,i.jsx)("span",{className:(0,c.cn)("badge-dot",nx[o]),"aria-hidden":!0}),(0,i.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-[13px] text-secondary-foreground",children:e.name}),(0,i.jsx)("span",{className:(0,c.cn)("font-mono text-xs",nh[o]),children:e.state}),e.restarts>0?(0,i.jsxs)("span",{className:"font-mono text-[11px] text-muted-foreground",children:["↻",e.restarts]}):null,(0,i.jsx)(h.Button,{variant:"outline",size:"icon-sm",title:`Restart ${e.name}`,disabled:t,onClick:()=>n(e.name),children:(0,i.jsx)(a.Icons.refresh,{})})]})}function ng({id:e,running:t}){let[n,r]=(0,x.useState)(null),[o,l]=(0,x.useState)(null),[s,c]=(0,x.useTransition)(),u=(0,x.useCallback)(async()=>{try{let t=await fetch(`/api/v1/boxes/${encodeURIComponent(e)}/services`,{credentials:"same-origin"});if(!t.ok)return void l(`status ${String(t.status)}`);r(await t.json()),l(null)}catch(e){l(e instanceof Error?e.message:String(e))}},[e]);(0,x.useEffect)(()=>{if(u(),!t)return;let e=setInterval(()=>void u(),4e3);return()=>clearInterval(e)},[u,t]);let f=t=>{c(async()=>{let n=await nf(e,t);n.ok||window.alert(`Restart failed: ${n.error}`),await u()})},p=n?.services??[],m=p.length>0;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(tY.SectionLabel,{right:m?(0,i.jsxs)(h.Button,{variant:"outline",size:"sm",disabled:!t||s,onClick:()=>f(void 0),children:[(0,i.jsx)(a.Icons.refresh,{}),"Restart all"]}):null,children:"Services"}),(0,i.jsx)(d.Card,{className:"divide-y divide-border/60 overflow-hidden",children:n||o?o?(0,i.jsxs)("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:["Could not load services (",o,")."]}):m?(0,i.jsxs)(i.Fragment,{children:[n?.source==="persisted"?(0,i.jsx)("div",{className:"bg-muted/30 px-4 py-1.5 font-mono text-[11px] text-muted-foreground",children:"persisted snapshot — box not running"}):null,p.map(e=>(0,i.jsx)(nv,{svc:e,disabled:!t||s,onRestart:e=>f(e)},e.name))]}):(0,i.jsx)("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:n?.source==="unavailable"?"No service status (box not running or no snapshot yet).":"No services declared in agentbox.yaml."}):(0,i.jsx)("div",{className:"px-4 py-3 text-sm text-muted-foreground",children:"Loading…"})})]})}var nb=e.i(35594);e.s(["default",0,function(){let{id:e}=(0,o.useParams)(),{box:t,project:n}=(0,f.useStore)(),r=t(e);if(!r)return(0,i.jsxs)("div",{className:"mx-auto w-full max-w-[1080px] px-8 pb-16 pt-8",children:[(0,i.jsx)(tJ.BackLink,{to:"/",children:"All boxes"}),(0,i.jsx)(t1.EmptyBox,{children:"This box no longer exists — it may have been destroyed."})]});let c=n(r.projectId);return(0,i.jsxs)("div",{className:"mx-auto w-full max-w-[1080px] px-8 pb-16 pt-8 max-sm:px-4",children:[(0,i.jsx)(tJ.BackLink,{to:"/projects/"+r.projectId,children:c?c.name:"Project"}),(0,i.jsxs)("div",{className:"flex items-start gap-4 max-md:flex-col",children:[(0,i.jsxs)("div",{className:"min-w-0",children:[(0,i.jsxs)("h1",{className:"flex flex-wrap items-center gap-3 text-[25px] font-semibold leading-tight tracking-[-0.025em]",children:[r.task,(0,i.jsx)(s.StatusBadge,{status:r.status})]}),(0,i.jsxs)("div",{className:"mt-1.5 text-sm text-muted-foreground",children:[(0,i.jsx)("span",{className:"font-mono text-secondary-foreground",children:r.id})," ·"," ",(0,i.jsx)("span",{className:"font-mono text-secondary-foreground",children:r.repo})," · ",r.host]})]}),(0,i.jsx)("div",{className:"ml-auto flex-none max-md:ml-0",children:(0,i.jsx)(tZ.BoxActions,{box:r,size:"lg"})})]}),r.error?(0,i.jsx)(u,{className:"mt-4 border-[var(--red-line)] bg-[var(--red-soft)] text-[var(--red)]",icon:a.Icons.warn,title:"Box errored",children:(0,i.jsx)("span",{className:"font-mono text-secondary-foreground",children:r.error})}):null,(0,i.jsx)(m,{boxId:r.id}),(0,i.jsx)(tY.SectionLabel,{children:"Overview"}),(0,i.jsxs)(nb.StatGrid,{children:[(0,i.jsx)(nb.Stat,{k:"Status",v:(0,i.jsx)(s.StatusBadge,{status:r.status})}),(0,i.jsx)(nb.Stat,{k:"Agent CLI",v:r.agent,mono:!0}),(0,i.jsx)(nb.Stat,{k:"Commits",v:r.commits??"—",icon:a.Icons.commit}),(0,i.jsx)(nb.Stat,{k:"Files touched",v:r.filesTouched??"—",icon:a.Icons.file}),(0,i.jsx)(nb.Stat,{k:"Last activity",v:(0,i.jsx)(l.Ago,{ms:r.lastActivity}),mono:!0})]}),(0,i.jsx)(tG,{box:r}),(0,i.jsx)(tY.SectionLabel,{children:"Git operations"}),(0,i.jsx)(na,{box:r}),(0,i.jsx)(ng,{id:r.id,running:"running"===r.status}),(0,i.jsx)(tY.SectionLabel,{children:"Details"}),(0,i.jsxs)(d.Card,{className:"divide-y divide-border/60 overflow-hidden",children:[(0,i.jsx)(t0,{k:"Box ID",v:r.id,mono:!0}),(0,i.jsx)(t0,{k:"Project",v:c?c.name:"—",link:c?"/projects/"+r.projectId:null}),(0,i.jsx)(t0,{k:"Repository",v:r.repo,mono:!0}),(0,i.jsx)(t0,{k:"Branch",v:r.branch,mono:!0}),(0,i.jsx)(t0,{k:"Host",v:r.host,mono:!0}),(0,i.jsx)(t0,{k:"Created",v:new Date(r.createdAt).toLocaleString(),mono:!0})]})]})}],77084)}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,33789,1485,e=>{"use strict";var r=e.i(1262),t=e.i(54129);e.s(["Ago",0,function({ms:e}){let[n,a]=(0,t.useState)(!1);return(0,t.useEffect)(()=>a(!0),[]),(0,r.jsx)("span",{suppressHydrationWarning:!0,children:n?function(e){let r=Math.floor((Date.now()-e)/1e3);if(r<60)return r+"s ago";let t=Math.floor(r/60);if(t<60)return t+"m ago";let n=Math.floor(t/60);return n<24?n+"h ago":Math.floor(n/24)+"d ago"}(e):new Date(e).toLocaleDateString()})}],33789),e.s(["SectionLabel",0,function({children:e,right:t}){return(0,r.jsxs)("div",{className:"mb-3 mt-8 flex items-center gap-2.5 font-mono text-[11px] uppercase tracking-[.1em] text-[#a4a9b0]",children:[e,(0,r.jsx)("span",{className:"h-px flex-1 bg-border"}),t??null]})}],1485)},9383,(e,r,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={callServer:function(){return s.callServer},createServerReference:function(){return i.createServerReference},findSourceMapURL:function(){return o.findSourceMapURL}};for(var a in n)Object.defineProperty(t,a,{enumerable:!0,get:n[a]});let s=e.r(57855),o=e.r(61414),i=e.r(97615)},31758,e=>{"use strict";var r=e.i(1262),t=e.i(44344);e.s(["EmptyBox",0,function({children:e}){return(0,r.jsxs)("div",{className:"rounded-xl border border-dashed border-border bg-card px-5 py-9 text-center text-[13.5px] text-muted-foreground",children:[(0,r.jsx)("div",{className:"mx-auto mb-3 grid h-10 w-10 place-items-center rounded-lg border border-border text-[#a4a9b0]",children:(0,r.jsx)(t.Icons.box,{className:"size-5"})}),e]})}])},88451,e=>{"use strict";var r=e.i(1262),t=e.i(45971),n=e.i(54129),a=e.i(44344),s=e.i(69377),o=e.i(9383);let i=(0,o.createServerReference)("60ff5520393ac26282f15f58e0b073a0c45b3ba7e5",o.callServer,void 0,o.findSourceMapURL,"answerApprovalAction");e.s(["ApprovalActions",0,function({id:e}){let o=(0,t.useRouter)(),[c,l]=(0,n.useTransition)(),d=r=>{l(async()=>{let t=await i(e,r);t.ok||window.alert(`Failed: ${t.error}`),o.refresh()})};return(0,r.jsxs)("div",{className:"flex justify-end gap-1.5",children:[(0,r.jsxs)(s.Button,{variant:"outline",size:"sm",disabled:c,className:"hover:border-[var(--red-line)] hover:bg-[var(--red-soft)] hover:text-[var(--red)]",onClick:()=>d("n"),children:[(0,r.jsx)(a.Icons.x,{}),"Deny"]}),(0,r.jsxs)(s.Button,{size:"sm",disabled:c,onClick:()=>d("y"),children:[(0,r.jsx)(a.Icons.check,{}),"Approve"]})]})}],88451)},16200,e=>{"use strict";var r=e.i(1262),t=e.i(65232);e.s(["Label",0,function({className:e,...n}){return(0,r.jsx)("label",{className:(0,t.cn)("mb-2 block text-[13px] font-medium leading-none",e),...n})}])},8536,e=>{"use strict";var r=e.i(1262),t=e.i(65232);e.s(["Card",0,function({className:e,...n}){return(0,r.jsx)("div",{className:(0,t.cn)("rounded-xl border border-border bg-card text-card-foreground",e),...n})},"CardContent",0,function({className:e,...n}){return(0,r.jsx)("div",{className:(0,t.cn)("p-5 pt-0",e),...n})},"CardDescription",0,function({className:e,...n}){return(0,r.jsx)("div",{className:(0,t.cn)("text-[12.5px] text-muted-foreground",e),...n})},"CardHeader",0,function({className:e,...n}){return(0,r.jsx)("div",{className:(0,t.cn)("flex flex-col space-y-1 p-5",e),...n})},"CardTitle",0,function({className:e,...n}){return(0,r.jsx)("div",{className:(0,t.cn)("text-[15px] font-semibold leading-none tracking-tight",e),...n})}])},3060,e=>{"use strict";var r=e.i(1262),t=e.i(65232);e.s(["Input",0,function({className:e,...n}){return(0,r.jsx)("input",{className:(0,t.cn)("flex h-10 w-full rounded-lg border border-input bg-card px-3 py-1 text-sm shadow-sm transition-[border-color,box-shadow] placeholder:text-muted-foreground focus-visible:outline-none focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/15",e),...n})}])},86892,30544,e=>{"use strict";var r=e.i(1262),t=e.i(64595);let n={running:{label:"running",badgeClass:"badge-run"},paused:{label:"paused",badgeClass:"badge-pause"},stopped:{label:"stopped",badgeClass:"badge-stop"},creating:{label:"creating",badgeClass:"badge-create"},error:{label:"error",badgeClass:"badge-err"}};e.s(["StatusBadge",0,function({status:e}){let a=n[e]??n.stopped;return(0,r.jsxs)(t.Badge,{className:a.badgeClass,children:[(0,r.jsx)("span",{className:"badge-dot"}),a.label]})}],86892);var a=e.i(45971),s=e.i(54129),o=e.i(65232),i=e.i(69377),c=e.i(44344),l=e.i(9383);let d=(0,l.createServerReference)("40f10bede8a5e7505d5875574f7e6fc4a06e8e2cb7",l.callServer,void 0,l.findSourceMapURL,"destroyBoxAction"),u=(0,l.createServerReference)("40ea16199b5abb2d3c1d4cecdd25aac1e3c41f074c",l.callServer,void 0,l.findSourceMapURL,"pauseBoxAction"),x=(0,l.createServerReference)("6096bb2a65e369cd77e8b1dc6cd900a5f1e67287bb",l.callServer,void 0,l.findSourceMapURL,"renameBoxAction"),b=(0,l.createServerReference)("4071308a0e1675de302803bb969800c52d79f11e13",l.callServer,void 0,l.findSourceMapURL,"resumeBoxAction"),p=(0,l.createServerReference)("40e545c7dd69b4a1d410deb9c94101099961d3af7a",l.callServer,void 0,l.findSourceMapURL,"stopBoxAction");e.s(["BoxActions",0,function({box:e,size:t}){let n=(0,a.useRouter)(),[l,f]=(0,s.useTransition)(),m="running"===e.status,v="paused"===e.status,g="stopped"===e.status,h="lg"===t,j=h?"sm":"icon-sm",y=(r,t,a)=>{r.stopPropagation(),(!a||window.confirm(a))&&f(async()=>{let r=await t(e.id);r.ok||window.alert(`Action failed: ${r.error}`),n.refresh()})};return(0,r.jsxs)("div",{className:(0,o.cn)("flex gap-1.5",h?"":"justify-end"),children:[v?(0,r.jsxs)(i.Button,{variant:h?"default":"outline",size:j,title:"Resume",disabled:l,className:h?"":"hover:border-[var(--green)] hover:bg-accent hover:text-[var(--green-ink)]",onClick:e=>y(e,b),children:[(0,r.jsx)(c.Icons.play,{}),h?"Resume":null]}):(0,r.jsxs)(i.Button,{variant:"outline",size:j,disabled:l||!m,title:"Pause",className:h?"":"hover:border-[var(--amber)] hover:bg-[var(--amber-soft)] hover:text-[var(--amber)]",onClick:e=>y(e,u),children:[(0,r.jsx)(c.Icons.pause,{}),h?"Pause":null]}),(0,r.jsxs)(i.Button,{variant:"outline",size:j,disabled:l||g,title:"Stop",onClick:e=>y(e,p),children:[(0,r.jsx)(c.Icons.stop,{}),h?"Stop":null]}),(0,r.jsxs)(i.Button,{variant:"outline",size:j,disabled:l,title:"Rename",onClick:r=>{r.stopPropagation();let t=window.prompt("Rename box (label only — leave blank to reset)",e.displayName??e.task);null!==t&&f(async()=>{let r=await x(e.id,t.trim());r.ok||window.alert(`Rename failed: ${r.error}`),n.refresh()})},children:[(0,r.jsx)(c.Icons.pencil,{}),h?"Rename":null]}),(0,r.jsxs)(i.Button,{variant:"destructive",size:j,title:"Destroy",disabled:l,onClick:r=>y(r,d,`Destroy box ${e.id}? Its workspace volume is discarded. This cannot be undone.`),children:[(0,r.jsx)(c.Icons.trash,{}),h?"Destroy":null]})]})}],30544)},95141,e=>{"use strict";var r=e.i(1262),t=e.i(54129),n=e.i(65232),a=e.i(44344);e.s(["Dialog",0,function({onClose:e,className:s,children:o}){return(0,t.useEffect)(()=>{let r=r=>{"Escape"===r.key&&e()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[e]),(0,r.jsx)("div",{className:"anim-fade fixed inset-0 z-50 grid place-items-center overflow-y-auto bg-[rgba(20,24,30,.42)] p-6 backdrop-blur-[2px]",onClick:e,children:(0,r.jsxs)("div",{role:"dialog","aria-modal":"true",className:(0,n.cn)("anim-pop relative m-auto w-full max-w-[500px] rounded-2xl border border-border bg-card shadow-[0_40px_80px_-30px_rgba(20,24,30,.5)]",s),onClick:e=>e.stopPropagation(),children:[o,(0,r.jsx)("button",{className:"absolute right-4 top-4 grid h-7 w-7 cursor-pointer place-items-center rounded-md border-0 bg-transparent text-[#a4a9b0] transition-colors hover:bg-secondary hover:text-foreground",onClick:e,"aria-label":"Close",children:(0,r.jsx)(a.Icons.x,{style:{width:15,height:15}})})]})})},"DialogBody",0,function({className:e,...t}){return(0,r.jsx)("div",{className:(0,n.cn)("px-5 py-4",e),...t})},"DialogDescription",0,function({className:e,...t}){return(0,r.jsx)("div",{className:(0,n.cn)("mt-1 font-mono text-xs text-muted-foreground",e),...t})},"DialogFooter",0,function({className:e,...t}){return(0,r.jsx)("div",{className:(0,n.cn)("flex justify-end gap-2.5 rounded-b-2xl border-t border-border/70 bg-background px-5 py-3.5",e),...t})},"DialogHeader",0,function({className:e,...t}){return(0,r.jsx)("div",{className:(0,n.cn)("flex items-start gap-3 border-b border-border/70 px-5 pb-4 pt-5",e),...t})},"DialogIcon",0,function({children:e}){return(0,r.jsx)("span",{className:"grid h-9 w-9 flex-none place-items-center rounded-lg border border-[var(--green-line)] bg-accent text-primary [&_svg]:size-[17px]",children:e})},"DialogTitle",0,function({className:e,...t}){return(0,r.jsx)("div",{className:(0,n.cn)("text-base font-semibold leading-tight tracking-tight",e),...t})}])},49604,e=>{"use strict";var r=e.i(1262),t=e.i(65232);e.s(["Select",0,function({wrapperClassName:e,className:n,children:a,...s}){return(0,r.jsxs)("span",{className:(0,t.cn)("relative inline-flex",e),children:[(0,r.jsx)("select",{className:(0,t.cn)("h-9 w-full cursor-pointer appearance-none rounded-lg border border-input bg-card py-1 pl-3 pr-9 text-[13px] shadow-sm focus-visible:outline-none focus-visible:border-primary focus-visible:ring-[3px] focus-visible:ring-primary/15",n),...s,children:a}),(0,r.jsx)("svg",{className:"pointer-events-none absolute right-3 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",children:(0,r.jsx)("path",{d:"m6 9 6 6 6-6"})})]})}])},80922,35594,e=>{"use strict";var r=e.i(1262),t=e.i(51096),n=e.i(44344);e.s(["BackLink",0,function({to:e,children:a}){return(0,r.jsxs)(t.default,{className:"mb-3.5 inline-flex cursor-pointer items-center gap-1.5 border-0 bg-transparent p-0 font-mono text-xs text-muted-foreground hover:text-primary",href:e,children:[(0,r.jsx)(n.Icons.arrowL,{className:"size-[13px]"}),a]})}],80922);var a=e.i(65232),s=e.i(8536);e.s(["Stat",0,function({k:e,v:t,mono:n,icon:s}){return(0,r.jsxs)("div",{className:"px-4.5 p-4",children:[(0,r.jsx)("div",{className:"mb-1.5 font-mono text-[10.5px] uppercase tracking-[.06em] text-[#a4a9b0]",children:e}),(0,r.jsxs)("div",{className:(0,a.cn)("flex items-center gap-2 font-semibold tracking-[-0.01em]",n?"font-mono text-sm font-medium":"text-base"),children:[s?(0,r.jsx)(s,{className:"size-[15px] text-muted-foreground"}):null,t]})]})},"StatGrid",0,function({children:e}){return(0,r.jsx)(s.Card,{className:"grid grid-cols-[repeat(auto-fit,minmax(140px,1fr))] divide-x divide-border/60 overflow-hidden",children:e})}],35594)}]);
|