@vantaloom/runtime-win32-x64 0.6.26 → 0.6.28
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/VERSION +1 -1
- package/bin/vantaloom-agent.exe +0 -0
- package/bin/vantaloom-api.exe +0 -0
- package/bin/vantaloomctl.exe +0 -0
- package/cli/package.json +1 -1
- package/manifest.json +2 -2
- package/package.json +1 -1
- package/web/404.html +1 -1
- package/web/__next.__PAGE__.txt +2 -2
- package/web/__next._full.txt +3 -3
- package/web/__next._head.txt +1 -1
- package/web/__next._index.txt +2 -2
- package/web/__next._tree.txt +2 -2
- package/web/_next/static/chunks/7d2466f352c97a53.css +2 -0
- package/web/_next/static/chunks/{abe42fb0ee1f5994.js → d56c26021e089951.js} +1 -1
- package/web/_not-found/__next._full.txt +2 -2
- package/web/_not-found/__next._head.txt +1 -1
- package/web/_not-found/__next._index.txt +2 -2
- package/web/_not-found/__next._not-found/__PAGE__.txt +1 -1
- package/web/_not-found/__next._not-found.txt +1 -1
- package/web/_not-found/__next._tree.txt +2 -2
- package/web/_not-found.html +1 -1
- package/web/_not-found.txt +2 -2
- package/web/index.html +1 -1
- package/web/index.txt +3 -3
- package/web/_next/static/chunks/d5e1c203cd6d5224.css +0 -2
- /package/web/_next/static/{xmOWde8m5dQnoCnChFiyb → -rDU19pzrsFnix1-5FxDr}/_buildManifest.js +0 -0
- /package/web/_next/static/{xmOWde8m5dQnoCnChFiyb → -rDU19pzrsFnix1-5FxDr}/_clientMiddlewareManifest.json +0 -0
- /package/web/_next/static/{xmOWde8m5dQnoCnChFiyb → -rDU19pzrsFnix1-5FxDr}/_ssgManifest.js +0 -0
|
@@ -49,4 +49,4 @@ ${e.detail}`:e.title;async function o(){try{await navigator.clipboard.writeText(
|
|
|
49
49
|
border-radius: 9999px;
|
|
50
50
|
background-clip: content-box;
|
|
51
51
|
}
|
|
52
|
-
</style>`,/<\/head>/i.test(t)?t.replace(/<\/head>/i,`${n}</head>`):`${n}${t}`},[r,t]);return(0,ey.jsx)("iframe",{title:e,sandbox:"allow-scripts",srcDoc:a,className:(0,eI.cn)("size-full border-0 bg-background",n)})}function KC({file:e,value:t,labels:n}){let r=ew.useMemo(()=>{let n=e.bytes??(t?new TextEncoder().encode(t):[]),r=Math.min(n.length,4096),a=[];for(let e=0;e<r;e+=16){let t=Array.from({length:Math.min(16,r-e)},(t,r)=>n[e+r]??0);a.push({offset:e.toString(16).padStart(8,"0"),hex:t.map(e=>e.toString(16).padStart(2,"0")).join(" "),ascii:t.map(e=>e>=32&&e<=126?String.fromCharCode(e):".").join("")})}return a},[e.bytes,t]);return 0===r.length?(0,ey.jsx)("div",{className:"ui-text-body grid size-full place-items-center p-6 text-center text-muted-foreground",children:n.noContent}):(0,ey.jsx)("div",{className:"size-full overflow-auto bg-background p-3 ui-text-code",children:(0,ey.jsx)("div",{className:"grid min-w-max grid-cols-[5.5rem_30rem_1fr] gap-x-4",children:r.map(e=>(0,ey.jsxs)(ew.Fragment,{children:[(0,ey.jsx)("span",{className:"text-muted-foreground",children:e.offset}),(0,ey.jsx)("span",{className:"font-mono text-foreground",children:e.hex}),(0,ey.jsx)("span",{className:"font-mono text-muted-foreground",children:e.ascii})]},e.offset))})})}function KN({file:e,labels:t,onApprove:n}){return(0,ey.jsx)("div",{className:"grid size-full place-items-center bg-muted/20 p-6",children:(0,ey.jsxs)("div",{className:"grid max-w-md justify-items-center gap-3 text-center",children:[(0,ey.jsx)("div",{className:"grid size-10 place-items-center rounded-full border bg-background text-muted-foreground",children:(0,ey.jsx)(Ks,{className:"size-4"})}),(0,ey.jsxs)("div",{className:"grid gap-1",children:[(0,ey.jsx)("h3",{className:"ui-text-body font-medium text-foreground",children:t.binaryTitle}),(0,ey.jsx)("p",{className:"ui-text-body text-muted-foreground",children:t.binaryDescription})]}),(0,ey.jsxs)("div",{className:"flex items-center gap-2",children:[Kx(e.size)&&(0,ey.jsx)(FC,{variant:"outline",children:Kx(e.size)}),(0,ey.jsx)(eA.Button,{type:"button",size:"sm",variant:"outline",onClick:n,children:t.renderAnyway})]})]})})}function KM({labels:e}){return(0,ey.jsx)("div",{className:"ui-text-body grid size-full place-items-center p-6 text-center text-muted-foreground",children:e.unsupportedPreview})}function KE({file:e,value:t,labels:n,renderPreview:r,className:a}){let i=Kg(e),o=e.src?e.src:t&&"svg"===Kg(e)?`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`:void 0,l=r?.(e,t);return void 0!==l?(0,ey.jsx)("div",{"data-slot":"file-tab-custom-preview",className:(0,eI.cn)("size-full",a),children:l}):"html"===i||"richtext"===i?(0,ey.jsx)(KS,{title:e.name,value:e.previewContent??t,className:a}):"markdown"===i?(0,ey.jsx)("div",{"data-slot":"file-tab-markdown-preview",className:(0,eI.cn)("size-full overflow-auto bg-background",a),children:(0,ey.jsx)(Kk,{value:t})}):"svg"===i&&o?(0,ey.jsx)("div",{"data-slot":"file-tab-svg-preview",className:(0,eI.cn)("grid size-full place-items-center overflow-auto bg-muted/20 p-6",a),children:(0,ey.jsx)("img",{src:o,alt:e.name,className:"max-h-full max-w-full rounded-lg border bg-background p-4"})}):"image"===i&&o?(0,ey.jsx)("div",{"data-slot":"file-tab-image-preview",className:(0,eI.cn)("grid size-full place-items-center overflow-auto bg-muted/20 p-6",a),children:(0,ey.jsx)("img",{src:o,alt:e.name,className:"max-h-full max-w-full rounded-md"})}):"video"===i&&o?(0,ey.jsx)("div",{"data-slot":"file-tab-video-preview",className:(0,eI.cn)("grid size-full place-items-center bg-muted/20 p-6",a),children:(0,ey.jsx)("video",{src:o,controls:!0,preload:"none",className:"max-h-full max-w-full rounded-md border bg-background"})}):(0,ey.jsx)(KM,{labels:n})}function KO({open:e,labels:t,currentView:n,currentMode:r,saving:a,modified:i,canSwitchView:o,canSwitchMode:l,canSave:s,canOpenHistory:c,onOpenChange:u,onToggleView:d,onToggleMode:f,onSave:h,onHistory:p}){let m=[o?{key:"view",label:"code"===n?t.preview:t.code,onClick:d,icon:"code"===n?(0,ey.jsx)(V9,{className:"size-4"}):(0,ey.jsx)(dn,{className:"size-4"})}:void 0,l?{key:"mode",label:"review"===r?t.edit:t.review,onClick:f,icon:"review"===r?(0,ey.jsx)(Kc,{className:"size-4"}):(0,ey.jsx)(eS,{className:"size-4"})}:void 0,s?{key:"save",label:a?t.saving:t.save,onClick:h,disabled:a||!i,icon:(0,ey.jsx)(Kh,{className:"size-4"})}:void 0,c?{key:"history",label:t.history,onClick:p,icon:(0,ey.jsx)(Ku,{className:"size-4"})}:void 0].filter(e=>void 0!==e);return 0===m.length?null:(0,ey.jsx)("div",{"data-slot":"file-tab-floating-actions",className:"absolute right-3 bottom-3 z-20",children:(0,ey.jsxs)("div",{className:"relative size-8",children:[m.map((t,n)=>(0,ey.jsx)(eA.Button,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.label,disabled:t.disabled,onClick:()=>{t.disabled||t.onClick()},className:(0,eI.cn)("absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur transition-[opacity,transform] duration-150 ease-out",e?"pointer-events-auto opacity-100":"pointer-events-none translate-y-1 opacity-0",t.disabled&&"opacity-45"),style:{transform:e?`translateY(-${(n+1)*42}px)`:void 0},children:t.icon},t.key)),(0,ey.jsx)(eA.Button,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.actions,"aria-expanded":e,onClick:()=>u(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,ey.jsx)(lF,{className:(0,eI.cn)("size-4 transition-transform",e&&"rotate-90")})})]})})}function KP({file:e,value:t,defaultValue:n,onValueChange:r,mode:a,defaultMode:i="review",onModeChange:o,view:l,defaultView:s="code",onViewChange:c,modified:u=!1,onSave:d,onSaveError:f,largeBinaryThreshold:h=2097152,showHeader:p=!0,wrapLines:m=!1,renderPreview:g,onHistory:v,labels:x,className:y,editorClassName:b,previewClassName:w,headerClassName:j,...k}){var S;let C,N,M=ew.useMemo(()=>({...Kp,...x}),[x]),[E,O]=ew.useState(n??e.content??""),[P,A]=ew.useState(i),[I,z]=ew.useState(s),[_,D]=ew.useState(!1),[R,T]=ew.useState(!1),[L,$]=ew.useState(!1),F=ew.useRef(null),B=t??E,V=a??P,H=(S=l??I,(C=Ky(e)).includes(S)?S:C[0]),W=Kg(e),U=Ky(e).length>1,q=!e.readOnly&&["text","code","html","markdown","richtext","svg"].includes(Kg(e)),K=!!d&&q&&"code"===H&&(u||L),G="review"===V||!0===e.readOnly,X="binary"===(N=Kg(e))||"image"!==N&&"video"!==N&&!!(e.size&&e.size>h&&!e.content),Y=(e.path??e.name).split(/[\\/]+/).filter(Boolean),Z=Kx(e.size??B.length);async function J(){if(d&&!L){$(!0);try{await d(B),T(!1)}catch(e){f?.(e)}finally{$(!1)}}}return ew.useEffect(()=>{void 0===t&&O(n??e.content??""),D(!1),T(!1)},[n,e,t]),ew.useEffect(()=>{if(R)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Node&&F.current?.contains(t)||T(!1)}},[R]),(0,ey.jsxs)("div",{ref:F,"data-slot":"file-tab-viewer","data-mode":V,"data-view":H,className:(0,eI.cn)("vtl-surface-panel relative grid min-h-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",p?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",y),...k,children:[p&&(0,ey.jsxs)("div",{"data-slot":"file-tab-viewer-header",className:(0,eI.cn)("flex min-w-0 items-center gap-2 border-b bg-muted/35 px-3 py-2",j),children:[(0,ey.jsx)("span",{className:"grid size-5 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:"image"===W?(0,ey.jsx)(Kd,{className:"size-3.5"}):"video"===W?(0,ey.jsx)(Kf,{className:"size-3.5"}):"binary"===W?(0,ey.jsx)(Ks,{className:"size-3.5"}):(0,ey.jsx)(xp,{className:"size-3.5"})}),(0,ey.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 ui-text-kbd",children:Y.map((e,t)=>(0,ey.jsxs)(ew.Fragment,{children:[t>0&&(0,ey.jsx)("span",{className:"text-muted-foreground",children:M.pathSeparator}),(0,ey.jsx)("span",{className:(0,eI.cn)("truncate",t===Y.length-1?"font-medium text-foreground":"text-muted-foreground"),children:e})]},`${e}-${t}`))}),(0,ey.jsxs)("div",{className:"hidden shrink-0 items-center gap-1.5 sm:flex",children:[Z&&(0,ey.jsx)(FC,{variant:"outline",children:Z}),q&&"code"===H&&(G?(0,ey.jsxs)(FC,{variant:"secondary",children:[(0,ey.jsx)(lT,{className:"size-3"}),M.review]}):(0,ey.jsxs)(FC,{variant:"outline",children:[(0,ey.jsx)(Kc,{className:"size-3"}),M.edit]}))]})]}),(0,ey.jsx)("div",{"data-slot":"file-tab-viewer-body",className:"min-h-0 overflow-hidden",children:X&&!_?(0,ey.jsx)(KN,{file:e,labels:M,onApprove:()=>D(!0)}):"preview"===H?(0,ey.jsx)(KE,{file:e,value:B,labels:M,renderPreview:g,className:w}):"hex"===H?(0,ey.jsx)(KC,{file:e,value:B,labels:M}):(0,ey.jsx)(Kj,{file:e,value:B,readOnly:G,onValueChange:function(e){void 0===t&&O(e),r?.(e)},wrapLines:m,className:b})}),(0,ey.jsx)(KO,{open:R,labels:M,currentView:H,currentMode:V,saving:L,modified:u,canSwitchView:U,canSwitchMode:q&&"code"===H,canSave:K,canOpenHistory:!!(v&&e.path),onOpenChange:T,onToggleView:function(){var e;e="code"===H?"preview":"code",void 0===l&&z(e),c?.(e)},onToggleMode:function(){var e;e="review"===V?"edit":"review",void 0===a&&A(e),o?.(e)},onSave:J,onHistory:()=>{T(!1),v?.(e)}})]})}function KA(e,t){return e[Math.max(0,t-1)]?.id??e[0]?.id}function KI(e){return"string"==typeof e||"number"==typeof e?String(e):void 0}function Kz(e,t,n){let r=[...e],a=r[t],i=r[n];return a&&i&&(r[t]=i,r[n]=a),r}function K_({tabs:e,defaultTabs:t=[],activeTabId:n,defaultActiveTabId:r,onActiveTabChange:a,onTabsChange:i,onCreateTab:o,onCloseTab:l,onTabReorder:s,onTabDetach:c,onExternalTabDrop:u,createActions:d=[],tabActions:f=[],reorderable:h=!0,detachable:p=!1,externalDropTypes:m=[],createLabel:g="New tab",moreLabel:v="More tab actions",closeLabel:x="Close tab",scrollLeftLabel:y="Scroll tabs left",scrollRightLabel:b="Scroll tabs right",tabListLabel:w="Open tabs",emptyContent:j,renderContent:k,showContent:S=!0,className:C,tabListClassName:N,contentClassName:M}){let[E,O]=ew.useState(t),P=ew.useRef(null),A=ew.useRef(null),[I,z]=ew.useState(),[_,D]=ew.useState(void 0),R=ew.useRef(void 0),[T,L]=ew.useState(void 0),[$,F]=ew.useState(!1),B=ew.useRef(void 0),V=ew.useRef(void 0),H=ew.useRef(!1),[W,U]=ew.useState(!1),[q,K]=ew.useState(!1),[G,X]=ew.useState(),Y=e??E,Z=Y.find(e=>!e.disabled),[J,Q]=ew.useState(r??Z?.id),ee=n??J,et=Y.find(e=>e.id===ee&&!e.disabled)??Z;ew.useEffect(()=>{!et&&Z&&void 0===n&&Q(Z.id)},[et,n,Z]);let en=ew.useCallback(t=>{void 0===e&&O(t),i?.(t)},[i,e]),er=ew.useCallback(e=>{R.current=e,D(e)},[]),ea=ew.useCallback(()=>{let e=A.current,t=new Map;if(!e)return t;for(let n of e.querySelectorAll("[data-tab-id]")){let e=n.getBoundingClientRect(),r=n.dataset.tabId;r&&t.set(r,{left:e.left,top:e.top})}return t},[]),ei=ew.useCallback((e,t=!0)=>{t&&(V.current=ea()),B.current=e,L(e)},[ea]),eo=ew.useCallback(()=>{let e=A.current;if(!e){U(!1),K(!1);return}let t=e.scrollWidth-e.clientWidth;U(e.scrollLeft>1),K(e.scrollLeft<t-1)},[]);function el(e){let t=A.current;if(!t)return;let n=Math.max(.7*t.clientWidth,160);t.scrollLeft+="left"===e?-n:n,window.requestAnimationFrame(eo)}ew.useEffect(()=>{F(!0)},[]),ew.useEffect(()=>{eo();let e=A.current;if(!e)return;let t=new ResizeObserver(eo);return t.observe(e),window.addEventListener("resize",eo),()=>{t.disconnect(),window.removeEventListener("resize",eo)}},[Y.length,eo]),ew.useLayoutEffect(()=>{let e=V.current,t=A.current;if(e&&t)for(let n of(V.current=void 0,t.querySelectorAll("[data-tab-id]"))){let t=n.dataset.tabId;if(!t)continue;let r=e.get(t);if(!r)continue;let a=n.getBoundingClientRect(),i=r.left-a.left,o=r.top-a.top;1>Math.abs(i)&&1>Math.abs(o)||n.animate([{transform:`translate(${i}px, ${o}px)`},{transform:"translate(0, 0)"}],{duration:150,easing:"cubic-bezier(0.2, 0, 0, 1)"})}},[T]);let es=ew.useCallback(e=>{let t=A.current;if(t)return Array.from(t.querySelectorAll("[data-tab-id]")).find(t=>t.dataset.tabId===e)},[]),ec=ew.useCallback((e,t)=>{let n=B.current??Y,r=n.findIndex(t=>t.id===e.tabId);if(-1===r)return;let a=t-e.offsetX,i=a+e.width,o=t>=e.currentX,l=n[r+1],s=n[r-1];if(o&&l&&!l.disabled){let e=es(l.id),t=e?.getBoundingClientRect();t&&i>=t.left+.7*t.width&&ei(Kz(n,r,r+1));return}if(!o&&s&&!s.disabled){let e=es(s.id),t=e?.getBoundingClientRect();t&&a<=t.right-.7*t.width&&ei(Kz(n,r,r-1))}},[es,Y,ei]);function eu(e){if(!u||0===m.length)return!1;let t=Array.from(e.dataTransfer.types);return m.some(e=>t.includes(e))}function ed(e){let t=A.current;if(!t)return{index:Y.length,left:0};let n=t.getBoundingClientRect(),r=Array.from(t.querySelectorAll("[data-tab-id]"));if(0===r.length)return{index:0,left:t.scrollLeft+8};for(let[a,i]of r.entries()){let r=i.getBoundingClientRect();if(e.clientX<r.left+r.width/2)return{index:a,left:r.left-n.left+t.scrollLeft}}let a=r[r.length-1].getBoundingClientRect();return{index:r.length,left:a.right-n.left+t.scrollLeft}}ew.useEffect(()=>{if(_)return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t,{once:!0}),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t)};function e(e){let t=R.current;if(!t)return;let n=e.clientX-t.startX,r=e.clientY-t.startY,a=t.dragging||Math.abs(n)>4||Math.abs(r)>4;a&&(e.preventDefault(),ec(t,e.clientX)),er({...t,currentX:e.clientX,currentY:e.clientY,dragging:a})}function t(e){let t=R.current;if(t?.dragging){e.preventDefault(),H.current=!0;let r=Y.find(e=>e.id===t.tabId),i=P.current?.getBoundingClientRect(),o=!!i&&(e.clientX<i.left||e.clientX>i.right||e.clientY<i.top||e.clientY>i.bottom);if(p&&c&&r&&o&&function(e,t){if(e.pinned)return!1;let r=Y.findIndex(t=>t.id===e.id);if(c?.(e,{tabs:Y,clientX:t.clientX,clientY:t.clientY,nativeEvent:t})===!1)return!1;let i=Y.filter(t=>t.id!==e.id);if(en(i),e.id===ee){let e=KA(i,r);void 0===n&&Q(e),e&&a?.(e)}return!0}(r,e)){z(void 0),er(void 0),ei(void 0,!1);return}let l=B.current;l&&!(l.length===Y.length&&l.every((e,t)=>e.id===Y[t]?.id))&&(en(l),s?.(l))}z(void 0),er(void 0),ei(void 0,!1)}});let ef=et&&(k?.(et)??et.content??(0,ey.jsx)("div",{className:"grid min-h-44 place-items-center bg-muted/30 p-6 text-center text-muted-foreground",children:et.title})),eh=_?.dragging&&T?T:Y,ep=_?.dragging?Y.find(e=>e.id===_.tabId):void 0,em=_?.dragging&&ep&&$?(0,is.createPortal)((0,ey.jsxs)("div",{"data-slot":"multi-tab-drag-preview","aria-hidden":"true",className:"pointer-events-none fixed z-[100] flex h-9 min-w-0 items-center gap-1 rounded-t-lg border border-border bg-background px-2.5 text-foreground shadow-lg",style:{left:_.currentX-_.offsetX,top:_.top,width:_.width},children:[ep.icon&&(0,ey.jsx)("span",{className:"grid size-4 shrink-0 place-items-center text-muted-foreground [&_svg]:size-3.5",children:ep.icon}),(0,ey.jsx)("span",{className:"truncate ui-text-control font-medium",children:ep.title}),ep.modified&&(0,ey.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-foreground/70"})]}),document.body):null;return(0,ey.jsxs)("div",{ref:P,"data-slot":"multi-tab-system",className:(0,eI.cn)("vtl-surface-panel grid min-h-0 grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-[var(--surface-panel-radius)] border",C),children:[(0,ey.jsxs)("div",{className:"relative flex min-w-0 shrink-0 items-end gap-1 border-b bg-muted/35 px-1.5 pt-1.5",children:[W&&(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":y,onClick:()=>el("left"),className:"mb-1 shrink-0",children:(0,ey.jsx)(pS,{})}),(0,ey.jsxs)("div",{ref:A,role:"tablist","aria-label":w,"data-slot":"multi-tab-list",className:(0,eI.cn)("relative flex min-w-0 flex-1 items-end overflow-x-auto [scrollbar-width:none] data-[overflow=both]:[mask-image:linear-gradient(90deg,transparent,black_24px,black_calc(100%-24px),transparent)] data-[overflow=left]:[mask-image:linear-gradient(90deg,transparent,black_24px)] data-[overflow=right]:[mask-image:linear-gradient(90deg,black_calc(100%-24px),transparent)] [&::-webkit-scrollbar]:hidden",N),"data-overflow":W&&q?"both":W?"left":q?"right":void 0,onScroll:eo,onDragOver:function(e){eu(e)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move",X(ed(e)))},onDragLeave:function(e){if(!eu(e))return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||X(void 0)},onDrop:function(e){if(!eu(e))return;e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move";let t=ed(e);X(void 0),u?.({tabs:Y,insertIndex:t.index,nativeEvent:e})},children:[eh.map((e,t)=>{let r=e.id===et?.id,i=eh[t+1],o=_?.dragging&&I===e.id,s=!r&&!o&&void 0!==i&&i.id!==et?.id&&i.id!==I;return(0,ey.jsxs)(ew.Fragment,{children:[(0,ey.jsxs)("div",{onPointerDown:t=>(function(e,t){if(!h||e.disabled||0!==t.button)return;let n=t.currentTarget.getBoundingClientRect();z(e.id),ei(Y,!1),er({tabId:e.id,startX:t.clientX,startY:t.clientY,offsetX:t.clientX-n.left,top:n.top,width:n.width,currentX:t.clientX,currentY:t.clientY,dragging:!1})})(e,t),"data-slot":"multi-tab","data-tab-id":e.id,"data-state":r?"active":"inactive","data-dragging":I===e.id?"true":void 0,"data-modified":e.modified?"true":void 0,className:(0,eI.cn)("group/tab relative flex h-9 min-w-0 max-w-52 shrink-0 items-center gap-1 rounded-t-lg border border-b-0 px-2.5 transition-[border-color,background-color,color,box-shadow,outline-color] duration-150 ease-out",h&&!e.disabled&&"cursor-grab active:cursor-grabbing",r?"border-border bg-background text-foreground shadow-[0_-1px_0_var(--background)_inset]":"border-transparent bg-transparent text-muted-foreground hover:bg-background/70 hover:text-foreground",o&&"border-dashed border-border bg-muted/45 text-transparent shadow-none outline outline-1 outline-ring/30 [&_*]:opacity-0",e.disabled&&"pointer-events-none opacity-50"),children:[(0,ey.jsx)("button",{type:"button",role:"tab","aria-label":KI(e.title),"aria-selected":r,disabled:e.disabled,onClick:t=>{var r;let i;if(H.current){H.current=!1,t.preventDefault();return}r=e.id,(i=Y.find(e=>e.id===r))&&!i.disabled&&(void 0===n&&Q(r),a?.(r))},className:"absolute inset-0 rounded-t-lg outline-none focus-visible:ring-2 focus-visible:ring-ring/50"}),(0,ey.jsxs)("div",{"aria-hidden":"true",className:"pointer-events-none relative z-10 flex min-w-0 flex-1 items-center gap-1.5",children:[e.icon&&(0,ey.jsx)("span",{className:"grid size-4 shrink-0 place-items-center text-muted-foreground [&_svg]:size-3.5",children:e.icon}),(0,ey.jsx)("span",{className:"truncate ui-text-control font-medium",children:e.title}),e.meta&&(0,ey.jsx)("span",{className:"shrink-0 ui-text-kbd text-muted-foreground",children:e.meta}),e.modified&&(0,ey.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-foreground/70"})]}),!e.pinned&&(0,ey.jsx)("button",{type:"button",draggable:!1,onPointerDown:e=>e.stopPropagation(),"aria-label":e.closeLabel??(KI(e.title)?`${x}: ${KI(e.title)}`:x),onClick:()=>(function(e){if(e.pinned)return;let t=Y.findIndex(t=>t.id===e.id),r=Y.filter(t=>t.id!==e.id);if(en(r),l?.(e),e.id===ee){let e=KA(r,t);void 0===n&&Q(e),e&&a?.(e)}})(e),className:(0,eI.cn)("relative z-20 grid size-5 shrink-0 place-items-center rounded-md text-muted-foreground opacity-0 transition-all hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none group-hover/tab:opacity-100",r&&"opacity-100"),children:(0,ey.jsx)(d3.XIcon,{className:"size-3.5"})})]}),s&&(0,ey.jsx)("span",{"aria-hidden":"true",className:"mb-2 h-4 w-px shrink-0 bg-border/80"})]},e.id)}),G?(0,ey.jsxs)("span",{"data-slot":"multi-tab-external-insert","aria-hidden":"true",className:"pointer-events-none absolute top-2 bottom-1 z-30 flex w-0 -translate-x-1/2 items-center justify-center",style:{left:G.left},children:[(0,ey.jsx)("span",{className:"h-full w-px rounded-full bg-foreground/80"}),(0,ey.jsx)("span",{className:"absolute top-0 size-1.5 rounded-full bg-foreground"})]}):null]}),(0,ey.jsxs)("div",{className:"mb-1 flex shrink-0 items-center gap-1",children:[q&&(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":b,onClick:()=>el("right"),children:(0,ey.jsx)(pC,{})}),d.length>0?(0,ey.jsxs)(y2,{children:[(0,ey.jsx)(y4,{asChild:!0,children:(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":g,children:(0,ey.jsx)(lV,{})})}),(0,ey.jsx)(bl,{align:"end",className:"w-52",children:d.map((e,t)=>(0,ey.jsxs)(ew.Fragment,{children:[e.separatorBefore&&(0,ey.jsx)(bd,{}),(0,ey.jsxs)(bs,{disabled:e.disabled,onSelect:e.onSelect,children:[e.icon,e.label,e.shortcut&&(0,ey.jsx)(bf,{children:e.shortcut})]})]},t))})]}):(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":g,onClick:function(){let e=o?.();e&&(en([...Y,e]),e.disabled||(void 0===n&&Q(e.id),a?.(e.id)))},children:(0,ey.jsx)(lV,{})}),f.length>0&&(0,ey.jsxs)(y2,{children:[(0,ey.jsx)(y4,{asChild:!0,children:(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":v,children:(0,ey.jsx)(lF,{})})}),(0,ey.jsx)(bl,{align:"end",className:"w-52",children:f.map((e,t)=>(0,ey.jsxs)(ew.Fragment,{children:[e.separatorBefore&&(0,ey.jsx)(bd,{}),(0,ey.jsxs)(bs,{disabled:e.disabled,onSelect:e.onSelect,children:[e.icon,e.label,e.shortcut&&(0,ey.jsx)(bf,{children:e.shortcut})]})]},t))})]})]})]}),em,S&&(0,ey.jsx)("div",{"data-slot":"multi-tab-content",className:(0,eI.cn)("min-h-0 overflow-hidden",M),children:ef??j??(0,ey.jsx)("div",{"aria-hidden":"true",className:"min-h-44 rounded-lg border border-dashed bg-muted/30"})})]})}let KD="application/vnd.vantaloom.canvas-node",KR="application/vnd.vantaloom.canvas-tab",KT="application/vnd.vantaloom.dashboard-widget",KL="application/vnd.vantaloom.workspace-card",K$=[{policyNumber:3,name:"Allow HTTP Traffic",sourceZone:"Trust",sourceIPs:["192.168.1.0/24","10.0.0.0/8"],destinationZone:"Trust",destinationIPs:["192.168.2.0/24"],tags:["Web Access","Internal"],action:"allow",description:"Permits HTTP traffic from internal network"},{policyNumber:5,name:"Block Suspicious IPs",sourceZone:"Untrust",sourceIPs:["203.0.113.0/24","198.51.100.0/24"],destinationZone:"Trust",destinationIPs:["Any"],tags:["Blocking","Security"],action:"deny",description:"Blocks known malicious IP ranges"},{policyNumber:9,name:"SSH Access Control",sourceZone:"Trust",sourceIPs:["172.16.0.0/12"],destinationZone:"Trust",destinationIPs:["10.50.0.0/16"],tags:["Admin Access","VPN"],action:"allow",description:"Restricted SSH access for admin network"},{policyNumber:12,name:"Database Port Protection",sourceZone:"Untrust",sourceIPs:["0.0.0.0/0"],destinationZone:"Trust",destinationIPs:["10.100.0.0/24"],tags:["Blocking","Database"],action:"deny",description:"Blocks external access to database ports"},{policyNumber:15,name:"API Gateway Access",sourceZone:"Trust",sourceIPs:["192.168.100.0/24","192.168.101.0/24"],destinationZone:"Trust",destinationIPs:["10.200.0.5"],tags:["API","VDI Env"],action:"allow",description:"Allows traffic to API gateway from specific subnets"},{policyNumber:18,name:"Drop Legacy SMB",sourceZone:"Trust",sourceIPs:["Any"],destinationZone:"Trust",destinationIPs:["10.20.0.0/16"],tags:["Legacy","Internal"],action:"drop",description:"Drops SMBv1 probes across workstation networks"},{policyNumber:22,name:"Agent Runtime Mesh",sourceZone:"Trust",sourceIPs:["10.10.4.0/24"],destinationZone:"Trust",destinationIPs:["10.10.8.0/24","10.10.12.0/24"],tags:["Agent","Runtime"],action:"allow",description:"Allows managed agent runtime channels between worker pools"},{policyNumber:27,name:"Block Public Admin Ports",sourceZone:"Untrust",sourceIPs:["0.0.0.0/0"],destinationZone:"Trust",destinationIPs:["Any"],tags:["Blocking","Admin Access"],action:"deny",description:"Denies public access to SSH, RDP, and database admin ports"},{policyNumber:31,name:"Build Cache Access",sourceZone:"Trust",sourceIPs:["10.30.0.0/16"],destinationZone:"Trust",destinationIPs:["10.60.12.20"],tags:["Build","Internal"],action:"allow",description:"Allows build workers to reach shared cache storage"},{policyNumber:36,name:"Relay Egress",sourceZone:"Trust",sourceIPs:["10.40.0.0/16"],destinationZone:"Untrust",destinationIPs:["198.18.0.0/15"],tags:["Relay","Agent"],action:"allow",description:"Permits relay service egress to managed edge addresses"},{policyNumber:41,name:"Quarantine Subnet",sourceZone:"Quarantine",sourceIPs:["10.250.0.0/24"],destinationZone:"Trust",destinationIPs:["Any"],tags:["Security","Blocking"],action:"deny",description:"Blocks quarantined hosts from internal services"},{policyNumber:48,name:"Observability Intake",sourceZone:"Trust",sourceIPs:["10.0.0.0/8"],destinationZone:"Trust",destinationIPs:["10.80.4.10"],tags:["Telemetry","Internal"],action:"allow",description:"Allows metrics and logs to the observability intake"}],KF=Array.from(new Set(K$.flatMap(e=>e.tags))).sort(),KB=[["10.10.4.0/24","Agent workers","Trust","18"],["10.20.0.0/16","Workstations","Trust","41"],["10.250.0.0/24","Quarantine","Quarantine","03"],["198.18.0.0/15","Relay edge","Untrust","12"]],KV=[["Database Port Protection","2026-06-12","Security"],["Relay Egress","2026-06-28","Network"],["Build Cache Access","2026-07-04","Build"],["Observability Intake","2026-07-18","Ops"]];function KH({className:e,...t}){return(0,ey.jsx)("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:(0,eI.cn)("mx-auto flex w-full justify-center",e),...t})}function KW({className:e,...t}){return(0,ey.jsx)("ul",{"data-slot":"pagination-content",className:(0,eI.cn)("flex flex-row items-center gap-1",e),...t})}function KU({...e}){return(0,ey.jsx)("li",{"data-slot":"pagination-item",...e})}function Kq({className:e,isActive:t,size:n="icon",...r}){return(0,ey.jsx)("a",{"aria-current":t?"page":void 0,"data-slot":"pagination-link","data-active":t,className:(0,eI.cn)((0,eA.buttonVariants)({variant:t?"outline":"ghost",size:n}),e),...r})}function KK({className:e,previousLabel:t="Previous",...n}){return(0,ey.jsxs)(Kq,{"aria-label":t,size:"default",className:(0,eI.cn)("gap-1 px-2.5 sm:pl-2",e),...n,children:[(0,ey.jsx)(pS,{}),(0,ey.jsx)("span",{className:"hidden sm:block",children:t})]})}function KG({className:e,nextLabel:t="Next",...n}){return(0,ey.jsxs)(Kq,{"aria-label":t,size:"default",className:(0,eI.cn)("gap-1 px-2.5 sm:pr-2",e),...n,children:[(0,ey.jsx)("span",{className:"hidden sm:block",children:t}),(0,ey.jsx)(pC,{})]})}function KX({className:e,moreLabel:t="More pages",...n}){return(0,ey.jsxs)("span",{"aria-hidden":!0,"data-slot":"pagination-ellipsis",className:(0,eI.cn)("flex size-8 items-center justify-center",e),...n,children:[(0,ey.jsx)(lF,{className:"size-4"}),(0,ey.jsx)("span",{className:"sr-only",children:t})]})}function KY({title:e}){return(0,ey.jsx)("h2",{className:"h-7 text-sm font-semibold tracking-normal",children:e})}function KZ(){let[e,t]=ew.useState(""),[n,r]=ew.useState("all"),[a,i]=ew.useState({allow:!1,drop:!1,deny:!1}),[o,l]=ew.useState(1),s=ew.useMemo(()=>["allow","drop","deny"].filter(e=>a[e]),[a]),c=ew.useMemo(()=>[{id:"policyNumber",header:"策略 #",accessorKey:"policyNumber",align:"right",width:84},{id:"name",header:"名称",accessorKey:"name",width:180,className:"font-medium"},{id:"sourceZone",header:"源区域",accessorKey:"sourceZone",width:112,cell:({row:e})=>(0,ey.jsx)(K0,{zone:e.sourceZone})},{id:"sourceIPs",header:"源 IP",accessorKey:"sourceIPs",width:250,cell:({row:e})=>(0,ey.jsx)(KQ,{items:e.sourceIPs,variant:"outline"}),copyValue:({row:e})=>e.sourceIPs.join(", ")},{id:"destinationZone",header:"目标区域",accessorKey:"destinationZone",width:112,cell:({row:e})=>(0,ey.jsx)(K0,{zone:e.destinationZone})},{id:"destinationIPs",header:"目标 IP",accessorKey:"destinationIPs",width:250,cell:({row:e})=>(0,ey.jsx)(KQ,{items:e.destinationIPs,variant:"outline"}),copyValue:({row:e})=>e.destinationIPs.join(", ")},{id:"tags",header:"标签",accessorKey:"tags",width:220,cell:({row:e})=>(0,ey.jsx)(KQ,{items:e.tags,variant:"secondary"}),copyValue:({row:e})=>e.tags.join(", ")},{id:"action",header:"动作",accessorKey:"action",width:96,cell:({row:e})=>(0,ey.jsx)(K1,{action:e.action})}],[]),u=ew.useMemo(()=>{let t=e.trim().toLowerCase();return K$.filter(e=>{let r=0===t.length||e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.sourceIPs.some(e=>e.toLowerCase().includes(t))||e.destinationIPs.some(e=>e.toLowerCase().includes(t)),i="all"===n||e.tags.includes(n),o=!(a.allow||a.drop||a.deny)||a.allow&&"allow"===e.action||a.drop&&"drop"===e.action||a.deny&&"deny"===e.action;return r&&i&&o})},[a,e,n]),d=Math.max(1,Math.ceil(u.length/8)),f=Math.min(o,d),h=u.slice((f-1)*8,8*f);return ew.useEffect(()=>{l(1)},[a,e,n]),(0,ey.jsxs)("div",{className:"flex h-full min-h-0 flex-col p-3",children:[(0,ey.jsxs)("div",{className:"mb-3 flex shrink-0 items-center justify-between gap-3",children:[(0,ey.jsx)(KY,{title:"防火墙策略"}),(0,ey.jsxs)(eA.Button,{size:"sm",children:[(0,ey.jsx)(lV,{className:"size-4"}),"新增策略"]})]}),(0,ey.jsxs)("div",{className:"mb-3 grid shrink-0 grid-cols-1 items-end gap-3 sm:grid-cols-[minmax(12rem,1fr)_10rem_auto]",children:[(0,ey.jsxs)("label",{className:"grid gap-1",children:[(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"搜索"}),(0,ey.jsxs)("span",{className:"relative",children:[(0,ey.jsx)(vN,{className:"pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground"}),(0,ey.jsx)(ez,{value:e,onChange:e=>t(e.target.value),placeholder:"搜索策略...",className:"pl-8"})]})]}),(0,ey.jsxs)("label",{className:"grid gap-1",children:[(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"标签"}),(0,ey.jsxs)(go,{value:n,onValueChange:r,children:[(0,ey.jsx)(gX,{className:"w-full",children:(0,ey.jsx)(gu,{placeholder:"全部标签"})}),(0,ey.jsxs)(gJ,{children:[(0,ey.jsx)(gQ,{value:"all",children:"全部标签"}),KF.map(e=>(0,ey.jsx)(gQ,{value:e,children:e},e))]})]})]}),(0,ey.jsxs)("div",{className:"grid gap-1",children:[(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"动作"}),(0,ey.jsxs)(pb,{type:"multiple",variant:"outline",value:s,onValueChange:function(e){e.includes("clear")?(t(""),r("all"),i({allow:!1,drop:!1,deny:!1}),l(1)):i({allow:e.includes("allow"),drop:e.includes("drop"),deny:e.includes("deny")})},children:[(0,ey.jsx)(pw,{value:"allow",children:"允许"}),(0,ey.jsx)(pw,{value:"drop",children:"丢弃"}),(0,ey.jsx)(pw,{value:"deny",children:"拒绝"}),(0,ey.jsx)(pw,{value:"clear",children:"全部"})]})]})]}),(0,ey.jsx)(WS,{rows:h,columns:c,rowId:"policyNumber",showHeader:!1,showToolbar:!1,rowHeight:40,className:"min-h-0 flex-1 rounded-lg shadow-none",labels:{noRows:"没有匹配的策略。",selectAllRows:"选择当前页策略",selectRow:e=>`选择第 ${e+1} 条策略`,resizeColumn:"调整列宽",sortAsc:"升序",sortDesc:"降序",sortClear:"取消排序",copyCell:"复制单元格",copied:"已复制"}}),(0,ey.jsx)(KJ,{page:f,totalPages:d,onPageChange:function(e){l(Math.min(d,Math.max(1,e)))}})]})}function KJ({page:e,totalPages:t,onPageChange:n}){let r=ew.useMemo(()=>t<=3?Array.from({length:t},(e,t)=>t+1):e<=2?[1,2,3]:e>=t-1?[t-2,t-1,t]:[e-1,e,e+1],[e,t]),a=r[0]??1,i=r[r.length-1]??t;function o(e,t){e.preventDefault(),n(t)}return(0,ey.jsx)(KH,{className:"mt-3 shrink-0",children:(0,ey.jsxs)(KW,{className:"gap-1 sm:gap-2",children:[(0,ey.jsx)(KU,{children:(0,ey.jsx)(KK,{href:"#",previousLabel:"上一页","aria-disabled":1===e,className:(0,eI.cn)(1===e&&"pointer-events-none opacity-40"),onClick:t=>o(t,e-1)})}),a>1?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(KU,{children:(0,ey.jsx)(Kq,{href:"#",size:"icon",onClick:e=>o(e,1),children:"1"})}),a>2?(0,ey.jsx)(KU,{children:(0,ey.jsx)(KX,{moreLabel:"更多页"})}):null]}):null,r.map(t=>(0,ey.jsx)(KU,{children:(0,ey.jsx)(Kq,{href:"#",size:"icon",isActive:e===t,onClick:e=>o(e,t),children:t})},t)),i<t?(0,ey.jsxs)(ey.Fragment,{children:[i<t-1?(0,ey.jsx)(KU,{children:(0,ey.jsx)(KX,{moreLabel:"更多页"})}):null,(0,ey.jsx)(KU,{children:(0,ey.jsx)(Kq,{href:"#",size:"icon",onClick:e=>o(e,t),children:t})})]}):null,(0,ey.jsx)(KU,{children:(0,ey.jsx)(KG,{href:"#",nextLabel:"下一页","aria-disabled":e===t,className:(0,eI.cn)(e===t&&"pointer-events-none opacity-40"),onClick:t=>o(t,e+1)})})]})})}function KQ({items:e,variant:t}){return(0,ey.jsx)("div",{className:"flex min-w-48 flex-wrap gap-1",children:e.map(e=>(0,ey.jsx)(FC,{variant:t,children:e},e))})}function K0({zone:e}){return(0,ey.jsx)(FC,{variant:"Trust"===e?"secondary":"outline",children:e})}function K1({action:e}){return(0,ey.jsx)(FC,{variant:"allow"===e?"default":"destructive",children:{allow:"允许",drop:"丢弃",deny:"拒绝"}[e]})}function K2({className:e,...t}){return(0,ey.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:(0,ey.jsx)("table",{"data-slot":"table",className:(0,eI.cn)("w-full caption-bottom text-sm",e),...t})})}function K5({className:e,...t}){return(0,ey.jsx)("thead",{"data-slot":"table-header",className:(0,eI.cn)("[&_tr]:border-b",e),...t})}function K4({className:e,...t}){return(0,ey.jsx)("tbody",{"data-slot":"table-body",className:(0,eI.cn)("[&_tr:last-child]:border-0",e),...t})}function K3({className:e,...t}){return(0,ey.jsx)("tr",{"data-slot":"table-row",className:(0,eI.cn)("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function K6({className:e,...t}){return(0,ey.jsx)("th",{"data-slot":"table-head",className:(0,eI.cn)("h-9 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-0.5",e),...t})}function K8({className:e,...t}){return(0,ey.jsx)("td",{"data-slot":"table-cell",className:(0,eI.cn)("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-0.5",e),...t})}function K7({title:e}){return(0,ey.jsx)("h2",{className:"h-7 text-sm font-semibold tracking-normal",children:e})}function K9({title:e,headers:t,rows:n}){return(0,ey.jsxs)("div",{className:"flex h-full min-h-0 flex-col p-3",children:[(0,ey.jsx)(K7,{title:e}),(0,ey.jsx)("div",{className:"mt-3 min-h-0 flex-1 overflow-auto",children:(0,ey.jsxs)(K2,{children:[(0,ey.jsx)(K5,{children:(0,ey.jsx)(K3,{children:t.map(e=>(0,ey.jsx)(K6,{children:e},e))})}),(0,ey.jsx)(K4,{children:n.map(e=>(0,ey.jsx)(K3,{children:e.map((e,t)=>(0,ey.jsx)(K8,{className:0===t?"font-medium":"text-muted-foreground",children:e},`${e}-${t}`))},e.join("-")))})]})})]})}function Ge(){return(0,ey.jsxs)("div",{className:"grid h-full min-h-0 content-start gap-3 p-3",children:[(0,ey.jsx)(K7,{title:"策略申请"}),(0,ey.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,ey.jsx)(ez,{placeholder:"策略名称"}),(0,ey.jsx)(ez,{placeholder:"负责人"}),(0,ey.jsx)(ez,{placeholder:"源 CIDR"}),(0,ey.jsx)(ez,{placeholder:"目标 CIDR"})]}),(0,ey.jsx)("textarea",{placeholder:"用途",className:"min-h-32 resize-none rounded-lg border border-input bg-transparent px-2.5 py-2 text-sm outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50"}),(0,ey.jsx)("div",{children:(0,ey.jsxs)(eA.Button,{size:"sm",children:[(0,ey.jsx)(lV,{className:"size-4"}),"提交申请"]})})]})}function Gt(){return(0,ey.jsxs)(hQ,{defaultValue:"policies",className:"vtl-firewall-workspace flex h-full min-h-0 flex-col",children:[(0,ey.jsx)("div",{className:"shrink-0 overflow-x-auto px-3 pt-3 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:(0,ey.jsxs)(h7,{className:"h-8 w-max min-w-full",children:[(0,ey.jsx)(h9,{value:"policies",children:"防火墙策略"}),(0,ey.jsx)(h9,{value:"ip-addresses",children:"IP 地址"}),(0,ey.jsx)(h9,{value:"renewals",children:"续期"}),(0,ey.jsx)(h9,{value:"policy-request",children:"策略申请"}),(0,ey.jsx)(h9,{value:"user-settings",children:"用户设置"})]})}),(0,ey.jsx)(pe,{value:"policies",className:"mt-3 min-h-0 flex-1 border-t",children:(0,ey.jsx)(KZ,{})}),(0,ey.jsx)(pe,{value:"ip-addresses",className:"mt-3 min-h-0 flex-1 border-t",children:(0,ey.jsx)(K9,{title:"IP 地址",headers:["地址","名称","区域","策略"],rows:KB})}),(0,ey.jsx)(pe,{value:"renewals",className:"mt-3 min-h-0 flex-1 border-t",children:(0,ey.jsx)(K9,{title:"续期",headers:["策略","续期时间","负责人"],rows:KV})}),(0,ey.jsx)(pe,{value:"policy-request",className:"mt-3 min-h-0 flex-1 border-t",children:(0,ey.jsx)(Ge,{})}),(0,ey.jsx)(pe,{value:"user-settings",className:"mt-3 min-h-0 flex-1 border-t",children:(0,ey.jsx)(K9,{title:"用户设置",headers:["设置","值"],rows:[["默认区域","Trust"],["审核提醒","14 天"],["申请审批","安全负责人"],["策略导出","已开启"]]})})]})}function Gn(e){return e.map(e=>{var t;return{id:e.id,name:e.name,path:e.path,kind:"folder"===(t=e.kind)?"folder":"image"===t?"image":"archive"===t?"archive":"text"===t?"text":"code"===t?"code":"executable"===t?"config":"unknown",hasChildren:"folder"===e.kind,readonly:e.readonly,disabled:e.disabled}})}async function Gr(e,t){let n=t.machineId||"local";return Gn((await dN(n,e.path)).items)}function Ga({className:e,onOpenFile:t}){let[n,r]=ew.useState([]),[a,i]=ew.useState(!1),[o,l]=ew.useState(0),s=ew.useCallback(async()=>{i(!0);try{let e=await dC();r(e.roots.map(e=>({id:e.id,machineId:e.machineId,name:e.name,path:e.path,platform:e.platform,children:Gn(e.children)}))),l(e=>e+1)}catch{r([]),l(e=>e+1)}finally{i(!1)}},[]);return ew.useEffect(()=>{s()},[s]),ew.useEffect(()=>{function e(){s()}return window.addEventListener("vantaloom:file-system-changed",e),()=>window.removeEventListener("vantaloom:file-system-changed",e)},[s]),(0,ey.jsx)(VD,{className:e,compact:!0,openFilesOnSingleClick:!1,allowCreateFile:!1,allowCreateFolder:!1,allowRename:!1,allowDelete:!1,allowDragAndDrop:!1,allowBoxSelect:!1,defaultRoots:n,defaultExpandedIds:n.map(e=>e.id),loadingIds:a?n.map(e=>e.id):[],labels:{title:"Explorer",refresh:"刷新",collapseAll:"折叠",empty:"没有文件",noResults:"没有匹配文件",loading:"读取中..."},onLoadChildren:Gr,onOpenNode:(e,n)=>{"folder"!==e.kind&&t?.({machineId:n.machineId||"local",path:e.path})},onRefresh:()=>{s()}},o)}function Gi({open:e,onOpenChange:t,onSelectFile:n}){return(0,ey.jsx)(uo,{open:e,onOpenChange:t,children:(0,ey.jsxs)(d8,{className:"h-[min(42rem,calc(100svh-2rem))] max-w-2xl gap-0 overflow-hidden p-0",children:[(0,ey.jsx)(d9,{className:"sr-only",children:"选择文件"}),(0,ey.jsx)(fe,{className:"sr-only",children:"选择本机可访问文件。"}),(0,ey.jsx)(Ga,{className:"size-full max-w-none rounded-none border-0",onOpenFile:e=>{n(e),t(!1)}})]})})}function Go(){let e=ew.useRef(null),[t,n]=ew.useState({width:0,height:0});return ew.useLayoutEffect(()=>{let t=e.current;if(!t)return;function r(){let e=t.getBoundingClientRect();n({width:e.width,height:e.height})}r();let a=new ResizeObserver(r);return a.observe(t),()=>a.disconnect()},[]),[e,t]}let Gl=(0,ek.default)("shield-off",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);function Gs({open:e,placement:t="viewport",movePermissionGranted:n,onOpenChange:r,onAdd:a,onMovePermissionGrantedChange:i}){let o=[{key:"move-permission",label:n?"取消放行权限":"放行权限",icon:n?(0,ey.jsx)(wY,{className:"size-4"}):(0,ey.jsx)(Gl,{className:"size-4"}),pressed:n,onClick:()=>i(!n)},{key:"add",label:"新建文件窗口",icon:(0,ey.jsx)(lV,{className:"size-4"}),pressed:void 0,onClick:a}];return(0,ey.jsx)("div",{className:(0,eI.cn)("right-5 z-50","viewport"===t?"fixed bottom-5 max-md:bottom-20":"absolute bottom-5"),children:(0,ey.jsxs)("div",{className:"relative size-8",children:[o.map((t,n)=>(0,ey.jsx)(eA.Button,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.label,"aria-pressed":t.pressed,title:t.label,onClick:t.onClick,className:(0,eI.cn)("absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur transition-[opacity,transform] duration-150 ease-out",e?"pointer-events-auto opacity-100":"pointer-events-none translate-y-1 opacity-0",t.pressed&&"border-foreground bg-foreground text-background hover:bg-foreground/90 hover:text-background"),style:{transform:e?`translateY(-${(n+1)*42}px)`:void 0},children:t.icon},t.key)),(0,ey.jsx)(eA.Button,{type:"button",variant:"outline",size:"icon-sm","aria-label":"文件窗口操作","aria-expanded":e,onClick:()=>r(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,ey.jsx)(lF,{className:(0,eI.cn)("size-4 transition-transform",e&&"rotate-90")})})]})})}let Gc=[];function Gu(e,t){return`${e} / ${t.replace(/\\/g," / ").replace(/\//g," / ")}`}function Gd(e,t){for(let n of e){if(n.id===t)return n;let e=n.children?Gd(n.children,t):void 0;if(e)return e}}function Gf(e,t){return e.replace(/\\/g,"/").toLowerCase()===t.replace(/\\/g,"/").toLowerCase()}function Gh(e,t){let n=e.replace(/\\/g,"/").replace(/\/+/g,"/");return"windows"===t?n.toLowerCase():n}function Gp(e){return e.map(e=>({...e,children:e.children?Gp(e.children):void 0}))}let Gm=(0,ek.default)("move-right",[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]),Gg=(0,ek.default)("octagon-alert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]),Gv=(0,ek.default)("clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]),Gx={title:"Clipboard",empty:"No clips",dragHandle:"Drag clip"};function Gy({items:e,expanded:t,defaultExpanded:n=!1,expansionDirection:r="down-left",title:a,labels:i,maxCollapsedItems:o=10,maxExpandedHeight:l=360,acceptExternalDrops:s=!1,removeOnExternalDrop:c=!1,className:u,onExpandedChange:d,onItemDragStart:f,onItemDragEnd:h,onItemDuplicate:p,onItemsRemove:m,onItemsReorder:g,onExternalDrop:v,onMouseEnter:x,onMouseLeave:y,...b}){let w={...Gx,...i},[j,k]=ew.useState(n),[S,C]=ew.useState(),[N,M]=ew.useState(),[E,O]=ew.useState(n),[P,A]=ew.useState(),[I,z]=ew.useState({canScrollDown:!1,canScrollUp:!1}),[_,D]=ew.useState(!1),[R,T]=ew.useState(!1),L=ew.useRef(0),$=ew.useRef(void 0),F=ew.useRef(!1),B=ew.useRef(null),V=ew.useRef(null),H=void 0!==t,W=(H?t:j)||void 0!==S,U=Math.min(o,10),q=W?e:e.slice(0,U),K=E?N:void 0,G=44*q.length+18,X=Math.min(G,l),Y=W&&G>X,Z=0===e.length?"h-24":W?`${X}px`:"h-28",J=W&&Y?14:0;ew.useEffect(()=>{if(!W){O(!1),z({canScrollDown:!1,canScrollUp:!1});return}O(!1),window.requestAnimationFrame(()=>{V.current&&(V.current.scrollTop=0)}),z({canScrollUp:!1,canScrollDown:G>X});let e=window.setTimeout(()=>{O(!0)},260);return()=>window.clearTimeout(e)},[G,X,W]),ew.useEffect(()=>()=>{void 0!==$.current&&window.clearTimeout($.current)},[]);let Q=ew.useCallback(e=>{H||k(e),d?.(e)},[H,d]);function ee(e,t=0){let n=e.currentTarget.getBoundingClientRect();return e.clientX>=n.left-t&&e.clientX<=n.right+t&&e.clientY>=n.top-t&&e.clientY<=n.bottom+t}function et(e){if(!W||!V.current)return 0;let t=Array.from(V.current.querySelectorAll('[data-slot="clipboard-stack-card"]'));if(0===t.length)return 0;for(let[n,r]of t.entries()){let t=r.getBoundingClientRect();if(e.clientY<t.top+t.height/2)return n}return t.length}function en(e){return void 0!==S||Array.from(e.dataTransfer.types).includes("application/vnd.vantaloom.clip-id")}return ew.useEffect(()=>{if(0===e.length||W)return;let t=window.requestAnimationFrame(()=>{B.current?.matches(":hover")&&(void 0!==$.current&&(window.clearTimeout($.current),$.current=void 0),D(!1),Q(!0))});return()=>window.cancelAnimationFrame(t)},[e.length,Q,W]),ew.useEffect(()=>{if(!W||!Y||!K||!V.current)return;let e=q.findIndex(e=>e.id===K);if(e<0)return;let t=V.current,n=44*e-8,r=44*e+(q[e]?.expandedHeight??220)+12,a=t.scrollTop,i=a+t.clientHeight;n<a?t.scrollTo({top:Math.max(0,n),behavior:"smooth"}):r>i&&t.scrollTo({top:r-t.clientHeight,behavior:"smooth"})},[K,Y,q,W]),(0,ey.jsxs)("div",{ref:B,"data-slot":"clipboard-stack","data-expanded":W,"data-closing":_,"data-external-dragging":R,"data-expansion-direction":r,className:(0,eI.cn)("group/clipboard relative w-80 max-w-full overflow-visible py-2",u),onMouseEnter:function(e){x?.(e),ee(e)&&(void 0!==$.current&&(window.clearTimeout($.current),$.current=void 0),D(!1),Q(!0))},onMouseMove:function(e){if(!W){ee(e,12)&&(void 0!==$.current&&(window.clearTimeout($.current),$.current=void 0),D(!1),Q(!0));return}!W||S||ee(e,12)||(M(void 0),A(void 0),Q(!1),D(!0),void 0!==$.current&&window.clearTimeout($.current),$.current=window.setTimeout(()=>{D(!1),$.current=void 0},320))},onMouseLeave:function(e){y?.(e),S||(M(void 0),A(void 0),D(!0),Q(!1),void 0!==$.current&&window.clearTimeout($.current),$.current=window.setTimeout(()=>{D(!1),$.current=void 0},320))},onDragEnter:function(e){!s||en(e)||(L.current+=1,T(!0),D(!1))},onDragLeave:function(e){!s||en(e)||(L.current=Math.max(0,L.current-1),0===L.current&&(T(!1),A(void 0)))},onDragOver:function(e){!s||en(e)||(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy",T(!0),W?A(et(e)):A(0))},onDrop:function(t){if(!s||en(t))return;t.preventDefault(),t.stopPropagation();let n=P??et(t);L.current=0,T(!1),A(void 0),v?.({insertIndex:n,items:e,nativeEvent:t})},...b,children:[(0,ey.jsxs)("div",{"data-slot":"clipboard-stack-header",className:(0,eI.cn)("mb-2 flex h-8 items-center gap-2 px-1 text-sm font-medium text-foreground transition-[opacity,transform] duration-200","down-left"===r&&"justify-end",W?"opacity-100":"translate-y-1 opacity-0"),children:[(0,ey.jsx)("span",{className:"inline-flex size-6 items-center justify-center rounded-lg border bg-background text-muted-foreground",children:(0,ey.jsx)(Gv,{className:"size-3.5"})}),(0,ey.jsx)("span",{children:a??w.title}),(0,ey.jsx)("span",{className:"ml-auto tabular-nums text-muted-foreground",children:e.length})]}),(0,ey.jsxs)("div",{"data-slot":"clipboard-stack-list",className:(0,eI.cn)("relative transition-[height] duration-300 ease-[cubic-bezier(.2,.8,.2,1)]"),style:{height:Z},children:[e.length>0&&"down-left"===r?(0,ey.jsx)("span",{"data-slot":"clipboard-stack-pivot","aria-hidden":"true",className:(0,eI.cn)("pointer-events-none absolute top-3 right-[34px] z-50 size-2.5 rounded-full bg-foreground shadow-sm transition-[opacity,transform] duration-200 dark:bg-background",W?"scale-75 opacity-0":"opacity-100")}):null,s&&R?(0,ey.jsxs)("span",{"data-slot":"clipboard-stack-external-ghost","aria-hidden":"true",className:(0,eI.cn)("pointer-events-none absolute right-0 z-[70] h-14 w-[88%] rounded-xl border bg-background shadow-md shadow-black/10","clipboard-stack-external-ghost"),children:[(0,ey.jsx)("span",{className:"absolute top-3 right-[34px] size-2 rounded-full bg-foreground dark:bg-background"}),(0,ey.jsx)("span",{className:"absolute top-4 left-3 h-2 w-24 rounded-full bg-foreground/18"}),(0,ey.jsx)("span",{className:"absolute top-8 left-3 h-1.5 w-14 rounded-full bg-foreground/10"})]}):null,0===e.length?(0,ey.jsx)("div",{className:"flex h-24 items-center justify-center rounded-xl border border-dashed bg-muted/35 text-sm text-muted-foreground",children:w.empty}):(0,ey.jsxs)("div",{"data-slot":"clipboard-stack-scroll-frame",className:"relative h-full",children:[(0,ey.jsx)("div",{"data-slot":"clipboard-stack-scroll",ref:V,className:(0,eI.cn)("relative h-full overflow-x-visible",W&&Y?"clipboard-stack-scrollbar-hidden overflow-y-auto pt-2 pr-1 pb-3":"overflow-visible"),onScroll:e=>{let t=e.currentTarget;z({canScrollUp:t.scrollTop>1,canScrollDown:t.scrollTop+t.clientHeight<t.scrollHeight-1})},onDragOver:function(e){W&&S&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move")},onDrop:function(t){if(!W||!S||void 0===P)return;t.preventDefault(),t.stopPropagation(),F.current=!0;let n=e.findIndex(e=>e.id===S),r=e[n];if(n<0||!r)return;let a=e.filter(e=>e.id!==S),i=Math.max(0,Math.min(P>n?P-1:P,a.length));a.splice(i,0,r),A(void 0),M(void 0),i!==n&&g?.(a,{item:r,fromIndex:n,toIndex:i,items:a})},children:(0,ey.jsxs)("div",{"data-slot":"clipboard-stack-scroll-content",className:"relative",style:{width:W&&Y?`calc(100% - ${J}px)`:void 0,marginLeft:W&&Y?`${J}px`:void 0,height:W&&Y?G+28:W?G:"100%"},children:[void 0!==P?(0,ey.jsxs)("span",{"data-slot":"clipboard-stack-insert-line","aria-hidden":"true",className:"pointer-events-none absolute right-0 left-0 z-[80] flex items-center",style:{top:44*P-2},children:[(0,ey.jsx)("span",{className:"h-px flex-1 bg-foreground/70"}),(0,ey.jsx)("span",{className:"mx-1 size-1.5 rounded-full bg-foreground"}),(0,ey.jsx)("span",{className:"h-px flex-1 bg-foreground/70"})]}):null,q.map((t,n)=>(0,ey.jsx)(Gb,{item:t,index:n,count:q.length,expanded:W,active:W&&t.id===K,top:W?44*n:void 0,expansionDirection:r,labels:w,onHover:()=>M(t.id),onDuplicate:()=>{let n=e.findIndex(e=>e.id===t.id);n<0||p?.(e,{item:t,index:n,items:e})},onDragOver:e=>{if(W&&S&&S!==t.id){let t=e.currentTarget.getBoundingClientRect();A(e.clientY<t.top+t.height/2?n:n+1)}},onDragStart:e=>{C(e.item.id),M(void 0),F.current=!1,f?.(e)},onDragEnd:t=>{let n=t.nativeEvent.dataTransfer.dropEffect,r=t.item.id,a=e.findIndex(e=>e.id===r),i=c&&!F.current&&"none"!==n&&a>=0;if(C(void 0),A(void 0),M(void 0),F.current?F.current=!1:Q(!1),i){let n=e.filter(e=>e.id!==r);m?.(n,{item:t.item,index:a,items:n})}h?.(t)}},t.id))]})}),Y&&I.canScrollUp?(0,ey.jsx)("span",{"data-slot":"clipboard-stack-scroll-mask-top","aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 top-0 z-[90] h-8 bg-gradient-to-b from-background to-transparent"}):null,Y&&I.canScrollDown?(0,ey.jsx)("span",{"data-slot":"clipboard-stack-scroll-mask-bottom","aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 bottom-0 z-[90] h-8 bg-gradient-to-t from-background to-transparent"}):null]})]})]})}function Gb({item:e,index:t,count:n,expanded:r,active:a,top:i,expansionDirection:o,labels:l,onHover:s,onDuplicate:c,onDragOver:u,onDragStart:d,onDragEnd:f}){let h=Math.min(t,9),p="down-left"===o?-(4.5*h):[-4,2,-1,4][h]??0,m=r?a?n+20:n-t:n+t;return(0,ey.jsx)("article",{"data-slot":"clipboard-stack-card",draggable:!e.disabled,"aria-disabled":e.disabled,className:(0,eI.cn)("absolute right-0 min-h-16 w-full cursor-grab select-none rounded-xl border bg-background p-2.5 text-foreground shadow-sm shadow-black/5 outline-none transition-[top,transform,opacity,box-shadow,border-color] duration-300 ease-[cubic-bezier(.2,.8,.2,1)] active:cursor-grabbing","hover:border-foreground/35 hover:shadow-md hover:shadow-black/10 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/40",r&&"min-h-0 overflow-hidden py-2 transition-[top,transform,max-height,opacity,box-shadow,border-color] duration-300",r&&!a&&"max-h-11",e.disabled&&"cursor-not-allowed opacity-50"),style:{top:r?i??44*t:"down-left"===o?0:9*h,zIndex:m,maxHeight:r&&a?e.expandedHeight??220:void 0,transformOrigin:"down-left"===o?"calc(100% - 34px) 14px":"100% 0",transform:r?a?"translate3d(-10px, -6px, 0) rotate(0deg)":"translate3d(0, 0, 0) rotate(0deg)":`translate3d(${"down-left"===o?0:4*h}px, 0, 0) rotate(${p}deg)`},tabIndex:e.disabled?-1:0,onMouseDown:function(t){1!==t.button||e.disabled||t.preventDefault()},onMouseEnter:s,onFocus:s,onAuxClick:function(t){1!==t.button||e.disabled||(t.preventDefault(),c?.())},onDragOver:u,onDragStart:function(t){for(let[n,r]of(t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setData("text/plain",e.title),t.dataTransfer.setData("application/vnd.vantaloom.clip-id",e.id),Object.entries(e.dragData??{})))t.dataTransfer.setData(n,r);d?.({item:e,nativeEvent:t})},onDragEnd:function(t){f?.({item:e,nativeEvent:t})},children:(0,ey.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,ey.jsx)("div",{"data-slot":"clipboard-stack-card-media",className:"flex size-8 shrink-0 items-center justify-center rounded-lg border bg-muted text-muted-foreground",children:e.icon??(0,ey.jsx)(Gv,{className:"size-4"})}),(0,ey.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ey.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,ey.jsx)("p",{className:"truncate text-sm font-medium",children:e.title}),e.meta?(0,ey.jsx)("span",{className:"ml-auto shrink-0 text-xs tabular-nums text-muted-foreground",children:e.meta}):null]}),e.description?(0,ey.jsx)("p",{className:(0,eI.cn)("mt-0.5 text-xs leading-5 text-muted-foreground transition-[max-height,opacity,transform] duration-200",a?"max-h-40 translate-y-0 opacity-100":"max-h-0 -translate-y-1 overflow-hidden opacity-0"),children:e.description}):null,e.content?(0,ey.jsx)("div",{className:(0,eI.cn)("mt-2 text-xs text-muted-foreground transition-[max-height,opacity,transform] duration-200",a?"max-h-80 translate-y-0 opacity-100":"max-h-0 -translate-y-1 overflow-hidden opacity-0"),children:e.content}):null]}),(0,ey.jsx)("span",{"aria-label":l.dragHandle,className:"mt-1 inline-flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground",children:(0,ey.jsx)(ft,{className:"size-3.5"})})]})})}function Gw({transfers:e}){let t=e.slice(0,10);if(0===t.length)return null;let n=t.map(e=>{var t,n,r;let a,i,o;return{id:e.id,title:(a="copy"===(t=e).mode?"复制":"移动",i=t.sources.length,o=t.sources[0],`${a} ${i>1?`${i} 项`:Gk(o?.path??"")}`),description:(n=e).message?n.message:`${n.sources[0]?.machineId??"local"} -> ${n.target.machineId}`,meta:function(e){switch(e.status){case"completed":return"完成";case"failed":return"失败";case"queued":return"排队";default:return`${Math.round(e.progress?.percent??0)}%`}}(e),icon:"completed"===(r=e).status?(0,ey.jsx)(eO,{className:"size-4"}):"failed"===r.status?(0,ey.jsx)(Gg,{className:"size-4"}):"running"===r.status?(0,ey.jsx)(eM,{className:"size-4 animate-spin"}):"copy"===r.mode?(0,ey.jsx)(l_,{className:"size-4"}):(0,ey.jsx)(Gm,{className:"size-4"}),expandedHeight:132,content:(0,ey.jsx)(Gj,{transfer:e})}});return(0,ey.jsx)("div",{className:"pointer-events-auto fixed top-4 right-4 z-50 w-80 max-w-[calc(100vw-2rem)] max-md:left-4 max-md:right-auto max-md:w-auto max-md:max-w-[16rem]",children:(0,ey.jsx)(Gy,{items:n,title:"传输",labels:{empty:"暂无传输",dragHandle:"传输任务"},expansionDirection:"down-left",maxExpandedHeight:420})})}function Gj({transfer:e}){let t=Math.max(0,Math.min(100,e.progress?.percent??0));return(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)("div",{className:"h-1.5 overflow-hidden rounded-full bg-border",children:(0,ey.jsx)("div",{className:"h-full rounded-full bg-foreground transition-[width] duration-300",style:{width:`${t}%`}})}),(0,ey.jsxs)("div",{className:"grid gap-1 tabular-nums",children:[(0,ey.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[(0,ey.jsx)("span",{className:"truncate",children:Gk(e.target.path)}),(0,ey.jsxs)("span",{children:[Math.round(t),"%"]})]}),(0,ey.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2 text-muted-foreground",children:[(0,ey.jsxs)("span",{className:"truncate",children:[GS(e.progress.bytesDone)," /"," ",GS(e.progress.bytesTotal)]}),(0,ey.jsxs)("span",{children:[e.progress.entriesDone,"/",e.progress.entriesTotal]})]}),e.progress.currentPath?(0,ey.jsx)("div",{className:"truncate text-muted-foreground",children:Gk(e.progress.currentPath)}):null]})]})}function Gk(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function GS(e){if(!e)return"0 B";let t=["B","KB","MB","GB","TB"],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10||0===r?Math.round(n):n.toFixed(1)} ${t[r]}`}let GC=(0,ek.default)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);function GN({windowLayout:e,roots:t,active:n,zIndex:r,boardSize:a,onActivate:i,onClose:o,onMinimize:l,onWindowChange:s,onNavigate:c,onRootsChange:u,onCreateFolder:d,onRenameItem:f,onDeleteItems:h,onMoveItems:p}){return(0,ey.jsxs)("section",{className:(0,eI.cn)("absolute overflow-hidden rounded-xl border bg-card shadow-lg transition-[box-shadow,border-color] duration-150","vtl-file-manager-window",n&&"border-foreground shadow-xl"),style:{left:e.x,top:e.y,width:e.w,height:e.h,zIndex:r},onPointerDown:i,children:[(0,ey.jsxs)("div",{className:"grid h-9 cursor-grab grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 border-b bg-muted/35 px-2 active:cursor-grabbing",onPointerDown:function(t){t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),i();let n=t.clientX,r=t.clientY;function a(t){let a=Math.max(0,e.x+t.clientX-n),i=Math.max(0,e.y+t.clientY-r);s({...e,x:a,y:i})}window.addEventListener("pointermove",a),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",a),window.removeEventListener("pointerup",e)})},children:[(0,ey.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ey.jsx)(eA.Button,{type:"button",size:"icon-sm",variant:"ghost","aria-label":"关闭窗口",onPointerDown:e=>e.stopPropagation(),onClick:o,children:(0,ey.jsx)(d3.XIcon,{})}),(0,ey.jsx)(eA.Button,{type:"button",size:"icon-sm",variant:"ghost","aria-label":"缩小到剪切板",onPointerDown:e=>e.stopPropagation(),onClick:l,children:(0,ey.jsx)(GC,{})})]}),(0,ey.jsx)("div",{className:"truncate text-center ui-text-control",children:e.title}),(0,ey.jsx)("div",{className:"w-14"})]}),(0,ey.jsx)(wr,{roots:t,variant:"full",currentRootId:e.rootId,currentPath:e.path,draggableItems:!0,onNavigate:c,onRootsChange:e=>u(e),onCreateFolder:d,onRenameItem:f,onDeleteItems:h,onItemDrop:({sourceRootId:e,sourceItemIds:t,targetRoot:n,target:r})=>p({sourceRootId:e,sourceItemIds:t,targetRoot:n,target:r}),labels:{title:"文件管理",search:"搜索文件",newFolder:"新建",upload:"上传",refresh:"刷新",sort:"排序",view:"视图"},className:"vtl-file-window-explorer min-h-0 rounded-none border-0 shadow-none",contentClassName:"min-h-0",style:{height:"calc(100% - 2.25rem)",minHeight:0}}),(0,ey.jsx)("button",{type:"button","aria-label":"调整窗口大小",className:"absolute right-0 bottom-0 size-5 cursor-nwse-resize rounded-tl-md border-t border-l bg-background/80",onPointerDown:function(t){t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture(t.pointerId),i();let n=t.clientX,r=t.clientY;function o(t){let i=Math.max(420,Math.min(Math.max(420,a.width-e.x),e.w+t.clientX-n)),o=Math.max(320,e.h+t.clientY-r);s({...e,w:i,h:o})}window.addEventListener("pointermove",o),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",o),window.removeEventListener("pointerup",e)})}})]})}function GM({clipboardItems:e=[],onClipboardItemsChange:t,className:n,minBoardHeight:r=520,actionsPlacement:a="container"}){let[i,o]=Go(),[l,s]=ew.useState([]),[c,u]=ew.useState(Gc),[d,f]=ew.useState(Gc[0]?.id),[h,p]=ew.useState([]),[m,g]=ew.useState(!1),[v,x]=ew.useState(!1),[y,b]=ew.useState(),w=ew.useRef(Gc.length),j=ew.useRef(!1),k=ew.useRef(new Set),S=ew.useCallback(async(e,t,n)=>{let r=await dN(e,n);s(n=>{var a;return a={...r,root:{...r.root,id:t,machineId:e}},n.map(e=>e.id!==a.root.id?e:Gf(e.path,a.path)?{...e,children:Gp(a.items)}:{...e,children:function(e,t,n,r,a){let i=function(e,t,n){let r=Gh(e,n),a=Gh(t,n);if(r===a)return[];let i=r.endsWith("/")?r:`${r}/`;return a.startsWith(i)?a.slice(i.length).split("/").filter(Boolean):[]}(t,n,r);if(0===i.length)return Gp(a);let o="windows"===r?"\\":"/";return function e(t,n,r){let l=i[r];if(!l)return Gp(a);let s=n===o?`${o}${l}`:`${n.replace(/[\\/]+$/,"")}${o}${l}`,c=t.findIndex(e=>Gf(e.path,s)),u=t[c],d={...u??{id:`synthetic-${s}`,name:l,kind:"folder",path:s,children:[]},kind:"folder",children:e(u?.children??[],s,r+1)};if(c<0)return[...t,d];let f=[...t];return f[c]=d,f}(e,t,0)}(e.children,e.path,a.path,e.platform,a.items)})})},[]),C=ew.useCallback(async()=>{let e=GP((await dz()).transfers);return p(e),e},[]),N=ew.useCallback(e=>{p(t=>GP([e,...t.filter(t=>t.id!==e.id)]))},[]),M=ew.useCallback(e=>{dI({mode:"move",sources:e.sources.map(e=>({machineId:e.machineId,path:e.path})),target:{machineId:e.target.machineId,path:e.target.path}}).then(N).catch(()=>{})},[N]),E=ew.useCallback(()=>{for(let e of c)S(e.machineId,e.rootId,e.path)},[S,c]);function O(e,t){u(n=>n.map(n=>n.id===e?t(n):n))}function P(e){let t=l[0];if(!t&&!e?.rootId)return;w.current+=1;let n=`files-window-${w.current}`,r=i.current?.getBoundingClientRect(),a=r?.width??o.width,s=r?.height??o.height,c=e?.w??680,d=e?.h??460,h=Math.max(0,(a-c)/2),p=Math.max(0,(s-d)/2),m={id:n,title:e?.title??Gu(t?.name??"local",t?.path??""),machineId:e?.machineId??t?.machineId??"local",rootId:e?.rootId??t?.id??"local",path:e?.path??t?.path??"",x:e?.x??h+12*w.current,y:e?.y??p+12*w.current,w:c,h:d};u(e=>[...e,m]),f(n),S(m.machineId,m.rootId,m.path)}ew.useEffect(()=>{let e=!0;return(async function(){let t=await dC();if(e&&(s(t.roots),!j.current&&t.roots[0])){j.current=!0;let e=function(e,t=0){return{id:`files-${e.id.replace(/[^a-z0-9_-]/gi,"-")}-${t}`,title:Gu(e.name,e.path),machineId:e.machineId,rootId:e.id,path:e.path,x:28+24*t,y:28+24*t,w:720,h:480}}(t.roots[0]);u([e]),f(e.id),S(e.machineId,e.rootId,e.path)}})().catch(()=>{}),C().catch(()=>{}),()=>{e=!1}},[S,C]),ew.useEffect(()=>{if(!h.some(e=>"pending"===e.status||"running"===e.status||"queued"===e.status))return;let e=window.setInterval(async()=>{let e=(await C().catch(()=>h)).filter(e=>"completed"===e.status&&!k.current.has(e.id));if(e.length>0){for(let t of e)k.current.add(t.id);E()}},1e3);return()=>window.clearInterval(e)},[E,C,h]);let A=su(),I=c.find(e=>e.id===d);function z(e){return{onNavigate:({rootId:t,path:n})=>{let r=l.find(e=>e.id===t),a=r?.machineId??e.machineId;O(e.id,e=>({...e,machineId:a,rootId:t,path:n,title:Gu(r?.name??a,n)})),S(a,t,n)},onRootsChange:s,onCreateFolder:(t,n)=>{dO({machineId:e.machineId,path:t.path,name:n}).then(()=>S(e.machineId,e.rootId,e.path)).catch(()=>{})},onRenameItem:(t,n)=>{dP({machineId:e.machineId,path:t.path,name:n}).then(()=>S(e.machineId,e.rootId,e.path)).catch(()=>{})},onDeleteItems:t=>{dA({machineId:e.machineId,paths:t.map(e=>e.path)}).then(()=>S(e.machineId,e.rootId,e.path)).catch(()=>{})},onMoveItems:({sourceRootId:e,sourceItemIds:t,targetRoot:n,target:r})=>{let a=l.find(t=>t.id===e);if(!a)return;let i=t.flatMap(e=>{let t=Gd(a.children,e);return t?[{machineId:a.machineId,path:t.path,name:t.name}]:[]});if(0===i.length)return;let o={sources:i,target:{machineId:n.machineId,path:r.path,name:r.name}};v?M(o):b(o)}}}return A?(0,ey.jsxs)("div",{className:(0,eI.cn)("flex h-full min-h-0 w-full flex-col",n),children:[c.length>1?(0,ey.jsx)("div",{className:"flex shrink-0 items-center gap-1 overflow-x-auto border-b px-2 py-1.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:c.map(e=>(0,ey.jsx)("button",{type:"button",className:(0,eI.cn)("shrink-0 rounded-md px-2.5 py-1 text-xs transition-colors",e.id===d?"bg-foreground text-background":"text-muted-foreground hover:bg-muted"),onClick:()=>f(e.id),children:e.title},e.id))}):null,(0,ey.jsx)("div",{className:"min-h-0 flex-1",children:I?(0,ey.jsx)(GE,{windowLayout:I,roots:l,...z(I)}):(0,ey.jsx)("div",{className:"grid h-full place-items-center text-sm text-muted-foreground",children:"暂无打开的文件窗口"})}),(0,ey.jsx)(Gw,{transfers:h}),(0,ey.jsx)(Gs,{open:m,placement:a,movePermissionGranted:v,onOpenChange:g,onMovePermissionGrantedChange:x,onAdd:()=>{g(!1),P()}}),(0,ey.jsx)(GO,{move:y,onCancel:()=>b(void 0),onConfirm:e=>{b(void 0),M(e)}})]}):(0,ey.jsxs)("div",{ref:i,className:(0,eI.cn)("relative h-full min-h-0 w-full overflow-hidden rounded-[inherit]",n),onDragOver:e=>{Array.from(e.dataTransfer.types).includes("application/vnd.vantaloom.file-window")&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},onDrop:function(e){let t=e.dataTransfer.getData("application/vnd.vantaloom.file-window");if(t)try{let n=JSON.parse(t),r=i.current?.getBoundingClientRect();e.preventDefault(),e.stopPropagation(),P({...n,x:r?e.clientX-r.left-160:n.x,y:r?e.clientY-r.top-24:n.y})}catch{return}},children:[(0,ey.jsx)("div",{className:"relative h-full min-h-0",style:{minHeight:Math.max(r,o.height-48)},children:c.map((n,r)=>(0,ey.jsx)(GN,{windowLayout:n,roots:l,active:d===n.id,zIndex:20+r+20*(d===n.id),boardSize:o,onActivate:()=>f(n.id),onClose:()=>u(e=>e.filter(e=>e.id!==n.id)),onMinimize:()=>{t?.([{id:`clip-${n.id}`,title:n.title,description:"文件管理窗口",meta:`${Math.round(n.w)}x${Math.round(n.h)}`,payloads:{"application/vnd.vantaloom.file-window":{...n}},dragData:{"application/vnd.vantaloom.clip-kind":"file-window","application/vnd.vantaloom.file-window":JSON.stringify(n)}},...e.filter(e=>e.id!==`clip-${n.id}`)]),u(e=>e.filter(e=>e.id!==n.id))},onWindowChange:e=>O(n.id,()=>e),...z(n),onNavigate:({rootId:e,path:t})=>{let r=l.find(t=>t.id===e),a=r?.machineId??n.machineId;O(n.id,n=>({...n,machineId:a,rootId:e,path:t,title:Gu(r?.name??a,t)})),S(a,e,t)},onRootsChange:s,onCreateFolder:(e,t)=>{dO({machineId:n.machineId,path:e.path,name:t}).then(()=>S(n.machineId,n.rootId,n.path)).catch(()=>{})},onRenameItem:(e,t)=>{dP({machineId:n.machineId,path:e.path,name:t}).then(()=>S(n.machineId,n.rootId,n.path)).catch(()=>{})},onDeleteItems:e=>{dA({machineId:n.machineId,paths:e.map(e=>e.path)}).then(()=>S(n.machineId,n.rootId,n.path)).catch(()=>{})},onMoveItems:({sourceRootId:e,sourceItemIds:t,targetRoot:n,target:r})=>{let a=l.find(t=>t.id===e);if(!a)return;let i=t.flatMap(e=>{let t=Gd(a.children,e);return t?[{machineId:a.machineId,path:t.path,name:t.name}]:[]});if(0===i.length)return;let o={sources:i,target:{machineId:n.machineId,path:r.path,name:r.name}};v?M(o):b(o)}},n.id))}),(0,ey.jsx)(Gw,{transfers:h}),(0,ey.jsx)(Gs,{open:m,placement:a,movePermissionGranted:v,onOpenChange:g,onMovePermissionGrantedChange:x,onAdd:()=>{g(!1),P()}}),(0,ey.jsx)(GO,{move:y,onCancel:()=>b(void 0),onConfirm:e=>{b(void 0),M(e)}})]})}function GE({windowLayout:e,roots:t,onNavigate:n,onRootsChange:r,onCreateFolder:a,onRenameItem:i,onDeleteItems:o,onMoveItems:l}){return(0,ey.jsx)(wr,{roots:t,variant:"full",currentRootId:e.rootId,currentPath:e.path,onNavigate:n,onRootsChange:e=>r(e),onCreateFolder:a,onRenameItem:i,onDeleteItems:o,onItemDrop:({sourceRootId:e,sourceItemIds:t,targetRoot:n,target:r})=>l({sourceRootId:e,sourceItemIds:t,targetRoot:n,target:r}),labels:{title:"文件管理",search:"搜索文件",newFolder:"新建",upload:"上传",refresh:"刷新",sort:"排序",view:"视图"},className:"h-full min-h-0 rounded-none border-0 shadow-none",contentClassName:"min-h-0"})}function GO({move:e,onCancel:t,onConfirm:n}){var r;let a=e?.sources??[],i=Math.max(0,a.length-4);return(0,ey.jsx)(uL,{open:void 0!==e,onOpenChange:e=>{e||t()},children:(0,ey.jsxs)(u2,{children:[(0,ey.jsxs)(u5,{children:[(0,ey.jsx)(u3,{children:"确认移动"}),(0,ey.jsx)(u6,{children:e?`将 ${1===(r=a).length?r[0]?GA(r[0]):"0 项":`${r.length} 项`} 移动到 ${GA(e.target)}`:""})]}),e?(0,ey.jsxs)("div",{className:"grid gap-2 rounded-lg border bg-muted/20 p-3 ui-text-body",children:[(0,ey.jsxs)("div",{className:"grid gap-1",children:[(0,ey.jsx)("span",{className:"text-muted-foreground ui-text-kbd",children:"移动内容"}),(0,ey.jsxs)("div",{className:"grid gap-1",children:[a.slice(0,4).map(e=>(0,ey.jsx)("span",{className:"truncate",children:GA(e)},`${e.machineId}:${e.path}`)),i>0?(0,ey.jsxs)("span",{className:"text-muted-foreground",children:["另有 ",i," 项"]}):null]})]}),(0,ey.jsxs)("div",{className:"grid gap-1",children:[(0,ey.jsx)("span",{className:"text-muted-foreground ui-text-kbd",children:"目标位置"}),(0,ey.jsx)("span",{className:"truncate",children:GA(e.target)})]})]}):null,(0,ey.jsxs)(u4,{children:[(0,ey.jsx)(u7,{children:"取消"}),(0,ey.jsx)(u8,{onClick:()=>{e&&n(e)},children:"确认移动"})]})]})})}function GP(e){return e.slice(0,10)}function GA(e){let t=e.path.replace(/\\/g,"/");return`${e.machineId} / ${e.name||t}`}function GI({className:e}){return(0,ey.jsx)(GM,{className:(0,eI.cn)("h-full min-h-0 w-full rounded-[inherit] border-0 shadow-none",e),minBoardHeight:360,actionsPlacement:"container"})}var Gz=ew;function G_(){return(G_=Object.assign.bind()).apply(null,arguments)}var GD=e=>{var{cx:t,cy:n,r,className:a}=e,i=(0,w1.clsx)("recharts-dot",a);return jI(t)&&jI(n)&&jI(r)?ew.createElement("circle",G_({},A5(e),IE(e),{className:i,cx:t,cy:n,r:r})):null},GR=["points"];function GT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function GL(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?GT(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GT(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function G$(){return(G$=Object.assign.bind()).apply(null,arguments)}function GF(e){var{option:t,dotProps:n,className:r}=e;if((0,ew.isValidElement)(t))return(0,ew.cloneElement)(t,n);if("function"==typeof t)return t(n);var a=(0,w1.clsx)(r,"boolean"!=typeof t?t.className:""),i=null!=n?n:{},{points:o}=i,l=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(i,GR);return ew.createElement(GD,G$({},l,{className:a}))}function GB(e){var{points:t,dot:n,className:r,dotClassName:a,dataKey:i,baseProps:o,needClip:l,clipPathId:s,zIndex:c=Nn.scatter}=e;if(null==t||!n&&1!==t.length)return null;var u=zg(n),d=null==n?null:(0,ew.isValidElement)(n)?A3(n.props):"object"!=typeof n||Array.isArray(n)?null:A3(n),f=t.map((e,r)=>{var l,s,c=GL(GL(GL({r:3},o),d),{},{index:r,cx:null!=(l=e.x)?l:void 0,cy:null!=(s=e.y)?s:void 0,dataKey:i,value:e.value,payload:e.payload,points:t});return ew.createElement(GF,{key:"dot-".concat(r),option:n,dotProps:c,className:a})}),h={};return l&&null!=s&&(h.clipPath="url(#clipPath-".concat(u?"":"dots-").concat(s,")")),ew.createElement(R3,{zIndex:c},ew.createElement(A7,G$({className:r},h),f))}function GV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function GH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?GV(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GV(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var GW=e=>{var t,{point:n,childIndex:r,mainColor:a,activeDot:i,dataKey:o,clipPath:l}=e;if(!1===i||null==n.x||null==n.y)return null;var s=GH(GH(GH({},{index:r,dataKey:o,cx:n.x,cy:n.y,r:4,fill:null!=a?a:"none",strokeWidth:2,stroke:"#fff",payload:n.payload,value:n.value}),A4(i)),IE(i));return t=(0,ew.isValidElement)(i)?(0,ew.cloneElement)(i,s):"function"==typeof i?i(s):ew.createElement(GD,s),ew.createElement(A7,{className:"recharts-active-dot",clipPath:l},t)};function GU(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:a,clipPath:i,zIndex:o=Nn.activeDot}=e,l=kv(Rm),s=kv(RS);if(null==t||null==s)return null;var c=t.find(e=>s.includes(e.payload));return null==c?null:ew.createElement(R3,{zIndex:o},ew.createElement(GW,{point:c,childIndex:Number(l),mainColor:n,dataKey:a,activeDot:r,clipPath:i}))}function Gq(e,t){var n,r,a=kv(t=>O0(t,e)),i=kv(e=>O5(e,t)),o=null!=(n=null==a?void 0:a.allowDataOverflow)?n:OJ.allowDataOverflow,l=null!=(r=null==i?void 0:i.allowDataOverflow)?r:O1.allowDataOverflow;return{needClip:o||l,needClipX:o,needClipY:l}}function GK(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,a=kv(Fc),{needClipX:i,needClipY:o,needClip:l}=Gq(t,n);if(!l||!a)return null;var{x:s,y:c,width:u,height:d}=a;return ew.createElement("clipPath",{id:"clipPath-".concat(r)},ew.createElement("rect",{x:i?s:s-u/2,y:o?c:c-d/2,width:i?u:2*u,height:o?d:2*d}))}function GG(e,t){var n,r;return null!=(n=null==(r=e.graphicalItems.cartesianItems.find(e=>e.id===t))?void 0:r.xAxisId)?n:0}function GX(e,t){var n,r;return null!=(n=null==(r=e.graphicalItems.cartesianItems.find(e=>e.id===t))?void 0:r.yAxisId)?n:0}var GY=(e,t,n)=>AE(e,"xAxis",GG(e,t),n),GZ=(e,t,n)=>AM(e,"xAxis",GG(e,t),n),GJ=(e,t,n)=>AE(e,"yAxis",GX(e,t),n),GQ=(e,t,n)=>AM(e,"yAxis",GX(e,t),n),G0=jc([CT,GY,GJ,GZ,GQ],(e,t,n,r,a)=>jX(e,"xAxis")?j4(t,r,!1):j4(n,a,!1)),G1=jc([Pe,(e,t)=>t],(e,t)=>e.filter(e=>"area"===e.type).find(e=>e.id===t)),G2=e=>jX(CT(e),"xAxis")?"yAxis":"xAxis",G5=jc([G1,(e,t,n)=>PC(e,G2(e),"yAxis"===G2(e)?GX(e,t):GG(e,t),n)],(e,t)=>{if(null!=e&&null!=t){var n,{stackId:r}=e,a=Nj(e);if(null!=r&&null!=a){var i=null==(n=t[r])?void 0:n.stackedData,o=null==i?void 0:i.find(e=>e.key===a);if(null!=o)return o.map(e=>[e[0],e[1]])}}}),G4=jc([CT,GY,GJ,GZ,GQ,G5,jp,G0,G1,e=>e.rootProps.baseValue],(e,t,n,r,a,i,o,l,s,c)=>{var u,{chartData:d,dataStartIndex:f,dataEndIndex:h}=o;if(null!=s&&("horizontal"===e||"vertical"===e)&&null!=t&&null!=n&&null!=r&&null!=a&&0!==r.length&&0!==a.length&&null!=l){var{data:p}=s;if(null!=(u=p&&p.length>0?p:null==d?void 0:d.slice(f,h+1)))return function(e){var t,{areaSettings:{connectNulls:n,baseValue:r,dataKey:a},stackedData:i,layout:o,chartBaseValue:l,xAxis:s,yAxis:c,displayedData:u,dataStartIndex:d,xAxisTicks:f,yAxisTicks:h,bandSize:p}=e,m=i&&i.length,g=((e,t,n,r,a)=>{var i=null!=n?n:t;if(jI(i))return i;var o="horizontal"===e?a:r,l=o.scale.domain();if("number"===o.type){var s=Math.max(l[0],l[1]),c=Math.min(l[0],l[1]);return"dataMin"===i?c:"dataMax"===i||s<0?s:Math.max(Math.min(l[0],l[1]),0)}return"dataMin"===i?l[0]:"dataMax"===i?l[1]:l[0]})(o,l,r,s,c),v="horizontal"===o,x=!1,y=u.map((e,t)=>{if(m)u=i[d+t];else{var r,o,l,u,y,b=jG(e,a);Array.isArray(b)?(u=b,x=!0):u=[g,b]}var w=null!=(r=null==(o=u)?void 0:o[1])?r:null,j=null==w||m&&!n&&null==jG(e,a);return v?{x:j0({axis:s,ticks:f,bandSize:p,entry:e,index:t}),y:j?null:null!=(y=c.scale.map(w))?y:null,value:u,payload:e}:{x:j?null:null!=(l=s.scale.map(w))?l:null,y:j0({axis:c,ticks:h,bandSize:p,entry:e,index:t}),value:u,payload:e}});return t=m||x?y.map(e=>{var t,n,r=Array.isArray(e.value)?e.value[0]:null;return v?{x:e.x,y:null!=r&&null!=e.y&&null!=(n=c.scale.map(r))?n:null,payload:e.payload}:{x:null!=r&&null!=(t=s.scale.map(r))?t:null,y:e.y,payload:e.payload}}):v?c.scale.map(g):s.scale.map(g),{points:y,baseLine:null!=t?t:0,isRange:x}}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:a,dataStartIndex:f,areaSettings:s,stackedData:i,displayedData:u,chartBaseValue:c,bandSize:l})}});function G3(e){var t=A4(e);if(null!=t){var{r:n,strokeWidth:r}=t,a=Number(n),i=Number(r);return(Number.isNaN(a)||a<0)&&(a=3),(Number.isNaN(i)||i<0)&&(i=2),{r:a,strokeWidth:i}}return{r:3,strokeWidth:2}}var G6=["id"],G8=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function G7(){return(G7=Object.assign.bind()).apply(null,arguments)}function G9(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Xe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Xt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Xe(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Xn(e,t){return e&&"none"!==e?e:t}var Xr=Gz.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:a,fill:i,name:o,hide:l,unit:s,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,getPosition:jV,settings:{stroke:r,strokeWidth:a,fill:i,dataKey:t,nameKey:void 0,name:j6(o,t),hide:l,type:c,color:Xn(r,i),unit:s,graphicalItemId:u}};return Gz.createElement(Dw,{tooltipEntrySettings:d})});function Xa(e){var{clipPathId:t,points:n,props:r}=e,{needClip:a,dot:i,dataKey:o}=r,l=A5(r);return Gz.createElement(GB,{points:n,dot:i,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:l,needClip:a,clipPathId:t})}function Xi(e){var{showLabels:t,children:n,points:r}=e,a=r.map(e=>{var t,n,r={x:null!=(t=e.x)?t:0,y:null!=(n=e.y)?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Xt(Xt({},r),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:r,fill:void 0})});return Gz.createElement(Ty,{value:t?a:void 0},n)}function Xo(e){var{points:t,baseLine:n,needClip:r,clipPathId:a,props:i}=e,{layout:o,type:l,stroke:s,connectNulls:c,isRange:u}=i,{id:d}=i,f=G9(i,G6),h=A5(f),p=A3(f);return Gz.createElement(Gz.Fragment,null,(null==t?void 0:t.length)>1&&Gz.createElement(A7,{clipPath:r?"url(#clipPath-".concat(a,")"):void 0},Gz.createElement(IL,G7({},p,{id:d,points:t,connectNulls:c,type:l,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),"none"!==s&&Gz.createElement(IL,G7({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:c,fill:"none",points:t})),"none"!==s&&u&&Array.isArray(n)&&Gz.createElement(IL,G7({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:c,fill:"none",points:n}))),Gz.createElement(Xa,{points:t,props:f,clipPathId:a}))}function Xl(e){var t,n,{alpha:r,baseLine:a,points:i,strokeWidth:o}=e,l=null==(t=i[0])?void 0:t.y,s=null==(n=i[i.length-1])?void 0:n.y;if(!jW(l)||!jW(s))return null;var c=r*Math.abs(l-s),u=Math.max(...i.map(e=>e.x||0));return(jI(a)?u=Math.max(a,u):a&&Array.isArray(a)&&a.length&&(u=Math.max(...a.map(e=>e.x||0),u)),jI(u))?Gz.createElement("rect",{x:0,y:l<s?l:l-c,width:u+(o?parseInt("".concat(o),10):1),height:Math.floor(c)}):null}function Xs(e){var t,n,{alpha:r,baseLine:a,points:i,strokeWidth:o}=e,l=null==(t=i[0])?void 0:t.x,s=null==(n=i[i.length-1])?void 0:n.x;if(!jW(l)||!jW(s))return null;var c=r*Math.abs(l-s),u=Math.max(...i.map(e=>e.y||0));return(jI(a)?u=Math.max(a,u):a&&Array.isArray(a)&&a.length&&(u=Math.max(...a.map(e=>e.y||0),u)),jI(u))?Gz.createElement("rect",{x:l<s?l:l-c,y:0,width:c,height:Math.floor(u+(o?parseInt("".concat(o),10):1))}):null}function Xc(e){var{alpha:t,layout:n,points:r,baseLine:a,strokeWidth:i}=e;return"vertical"===n?Gz.createElement(Xl,{alpha:t,points:r,baseLine:a,strokeWidth:i}):Gz.createElement(Xs,{alpha:t,points:r,baseLine:a,strokeWidth:i})}function Xu(e){var{needClip:t,clipPathId:n,props:r,previousPointsRef:a,previousBaselineRef:i}=e,{points:o,baseLine:l,isAnimationActive:s,animationBegin:c,animationDuration:u,animationEasing:d,onAnimationStart:f,onAnimationEnd:h}=r,p=zF((0,Gz.useMemo)(()=>({points:o,baseLine:l}),[o,l]),"recharts-area-"),m=CL(),[g,v]=(0,Gz.useState)(!1),x=(0,Gz.useCallback)(()=>{"function"==typeof h&&h(),v(!1)},[h]),y=(0,Gz.useCallback)(()=>{"function"==typeof f&&f(),v(!0)},[f]);if(null==m)return null;var b=a.current,w=i.current;return Gz.createElement(Xi,{showLabels:!g,points:o},r.children,Gz.createElement(z$,{animationId:p,begin:c,duration:u,isActive:s,easing:d,onAnimationEnd:x,onAnimationStart:y,key:p},e=>{if(b){var c,u=b.length/o.length,d=1===e?o:o.map((t,n)=>{var r=Math.floor(n*u);if(b[r]){var a=b[r];return Xt(Xt({},t),{},{x:jL(a.x,t.x,e),y:jL(a.y,t.y,e)})}return t});if(jI(l))c=jL(w,l,e);else c=null==l||jP(l)?jL(w,0,e):l.map((t,n)=>{var r=Math.floor(n*u);if(Array.isArray(w)&&w[r]){var a=w[r];return Xt(Xt({},t),{},{x:jL(a.x,t.x,e),y:jL(a.y,t.y,e)})}return t});return e>0&&(a.current=d,i.current=c),Gz.createElement(Xo,{points:d,baseLine:c,needClip:t,clipPathId:n,props:r})}return e>0&&(a.current=o,i.current=l),Gz.createElement(A7,null,s&&Gz.createElement("defs",null,Gz.createElement("clipPath",{id:"animationClipPath-".concat(n)},Gz.createElement(Xc,{alpha:e,points:o,baseLine:l,layout:m,strokeWidth:r.strokeWidth}))),Gz.createElement(A7,{clipPath:"url(#animationClipPath-".concat(n,")")},Gz.createElement(Xo,{points:o,baseLine:l,needClip:t,clipPathId:n,props:r})))}),Gz.createElement(Tk,{label:r.label}))}function Xd(e){var{needClip:t,clipPathId:n,props:r}=e,a=(0,Gz.useRef)(null),i=(0,Gz.useRef)();return Gz.createElement(Xu,{needClip:t,clipPathId:n,props:r,previousPointsRef:a,previousBaselineRef:i})}class Xf extends Gz.PureComponent{render(){var{hide:e,dot:t,points:n,className:r,top:a,left:i,needClip:o,xAxisId:l,yAxisId:s,width:c,height:u,id:d,baseLine:f,zIndex:h}=this.props;if(e)return null;var p=(0,w1.clsx)("recharts-area",r),{r:m,strokeWidth:g}=G3(t),v=zg(t),x=2*m+g,y=o?"url(#clipPath-".concat(v?"":"dots-").concat(d,")"):void 0;return Gz.createElement(R3,{zIndex:h},Gz.createElement(A7,{className:p},o&&Gz.createElement("defs",null,Gz.createElement(GK,{clipPathId:d,xAxisId:l,yAxisId:s}),!v&&Gz.createElement("clipPath",{id:"clipPath-dots-".concat(d)},Gz.createElement("rect",{x:i-x/2,y:a-x/2,width:c+x,height:u+x}))),Gz.createElement(Xd,{needClip:o,clipPathId:d,props:this.props})),Gz.createElement(GU,{points:n,mainColor:Xn(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:y}),this.props.isRange&&Array.isArray(f)&&Gz.createElement(GU,{points:f,mainColor:Xn(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:y}))}}var Xh={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:Nn.area};function Xp(e){var t,{activeDot:n,animationBegin:r,animationDuration:a,animationEasing:i,connectNulls:o,dot:l,fill:s,fillOpacity:c,hide:u,isAnimationActive:d,legendType:f,stroke:h,xAxisId:p,yAxisId:m}=e,g=G9(e,G8),v=kv(CT),x=kv(C5),{needClip:y}=Gq(p,m),b=Cf(),{points:w,isRange:j,baseLine:k}=null!=(t=kv(t=>G4(t,e.id,b)))?t:{},S=kv(Fc);if("horizontal"!==v&&"vertical"!==v||null==S||"AreaChart"!==x&&"ComposedChart"!==x)return null;var{height:C,width:N,x:M,y:E}=S;return w&&w.length?Gz.createElement(Xf,G7({},g,{activeDot:n,animationBegin:r,animationDuration:a,animationEasing:i,baseLine:k,connectNulls:o,dot:l,fill:s,fillOpacity:c,height:C,hide:u,layout:v,isAnimationActive:d,isRange:j,legendType:f,needClip:y,points:w,stroke:h,width:N,left:M,top:E,xAxisId:p,yAxisId:m})):null}var Xm=Gz.memo(function(e){var t=I4(e,Xh),n=Cf();return Gz.createElement(RR,{id:t.id,type:"area"},e=>Gz.createElement(Gz.Fragment,null,Gz.createElement(RI,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,fill:a,legendType:i,hide:o}=e;return[{inactive:o,dataKey:t,type:i,color:Xn(r,a),value:j6(n,t),payload:e}]})(t)}),Gz.createElement(Xr,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),Gz.createElement(RU,{type:"area",id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:jQ(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),Gz.createElement(Xp,G7({},t,{id:e}))))},$T);function Xg(){return(Xg=Object.assign.bind()).apply(null,arguments)}function Xv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}Xm.displayName="Area";var Xx=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Xv(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xv(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:{top:5,right:5,bottom:5,left:5},responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},$C),Xy=(0,ew.forwardRef)(function(e,t){var n,r=I4(e.categoricalChartProps,Xx),{chartName:a,defaultTooltipEventType:i,validateTooltipEventTypes:o,tooltipPayloadSearcher:l,categoricalChartProps:s}=e;return ew.createElement($_,{preloadedState:{options:{chartName:a,defaultTooltipEventType:i,validateTooltipEventTypes:o,tooltipPayloadSearcher:l,eventEmitter:void 0}},reduxStoreName:null!=(n=s.id)?n:a},ew.createElement($D,{chartData:s.data}),ew.createElement($L,{layout:r.layout,margin:r.margin}),ew.createElement($F,{throttleDelay:r.throttleDelay,throttledEvents:r.throttledEvents}),ew.createElement($$,{baseValue:r.baseValue,accessibilityLayer:r.accessibilityLayer,barCategoryGap:r.barCategoryGap,maxBarSize:r.maxBarSize,stackOffset:r.stackOffset,barGap:r.barGap,barSize:r.barSize,syncId:r.syncId,syncMethod:r.syncMethod,className:r.className,reverseStackOrder:r.reverseStackOrder}),ew.createElement(Fh,Xg({},r,{ref:t})))}),Xb=["axis"],Xw=(0,ew.forwardRef)((e,t)=>ew.createElement(Xy,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Xb,tooltipPayloadSearcher:TH,categoricalChartProps:e,ref:t})),Xj=function(e){var{width:t,height:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(r%180+180)%180*Math.PI/180,i=Math.atan(n/t);return Math.abs(a>i&&a<Math.PI-i?n/Math.sin(a):t/Math.cos(a))};function Xk(e,t){if(t<1)return[];if(1===t)return e;for(var n=[],r=0;r<e.length;r+=t){var a=e[r];void 0!==a&&n.push(a)}return n}function XS(e,t,n,r,a){if(e*t<e*r||e*t>e*a)return!1;var i=n();return e*(t-e*i/2-r)>=0&&e*(t+e*i/2-a)<=0}function XC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function XN(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?XC(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XC(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function XM(e,t,n){var r,{tick:a,ticks:i,viewBox:o,minTickGap:l,orientation:s,interval:c,tickFormatter:u,unit:d,angle:f}=e;if(!i||!i.length||!a)return[];if(jI(c)||I$.isSsr)return null!=(r=Xk(i,(jI(c)?c:0)+1))?r:[];var h="top"===s||"bottom"===s?"width":"height",p=d&&"width"===h?Iq(d,{fontSize:t,letterSpacing:n}):{width:0,height:0},m=(e,r)=>{var a,i="function"==typeof u?u(e.value,r):e.value;return"width"===h?(a=Iq(i,{fontSize:t,letterSpacing:n}),Xj({width:a.width+p.width,height:a.height+p.height},f)):Iq(i,{fontSize:t,letterSpacing:n})[h]},g=i[0],v=i[1],x=i.length>=2&&null!=g&&null!=v?jO(v.coordinate-g.coordinate):1,y=function(e,t,n){var r="width"===n,{x:a,y:i,width:o,height:l}=e;return 1===t?{start:r?a:i,end:r?a+o:i+l}:{start:r?a+o:i+l,end:r?a:i}}(o,x,h);return"equidistantPreserveStart"===c?function(e,t,n,r,a){for(var i,o=(r||[]).slice(),{start:l,end:s}=t,c=0,u=1,d=l;u<=o.length;)if(i=function(){var t,i=null==r?void 0:r[c];if(void 0===i)return{v:Xk(r,u)};var o=c,f=()=>(void 0===t&&(t=n(i,o)),t),h=i.coordinate,p=0===c||XS(e,h,f,d,s);p||(c=0,d=l,u+=1),p&&(d=h+e*(f()/2+a),c+=u)}())return i.v;return[]}(x,y,m,i,l):"equidistantPreserveEnd"===c?function(e,t,n,r,a){var i=(r||[]).slice().length;if(0===i)return[];for(var{start:o,end:l}=t,s=1;s<=i;s++){for(var c,u=(i-1)%s,d=o,f=!0,h=u;h<i&&(0===(c=function(){var t,i=r[h];if(null==i)return 0;var o=h,s=()=>(void 0===t&&(t=n(i,o)),t),c=i.coordinate,p=h===u||XS(e,c,s,d,l);if(!p)return f=!1,1;p&&(d=c+e*(s()/2+a))}())||1!==c);h+=s);if(f){for(var p=[],m=u;m<i;m+=s){var g=r[m];null!=g&&p.push(g)}return p}}return[]}(x,y,m,i,l):("preserveStart"===c||"preserveStartEnd"===c?function(e,t,n,r,a,i){var o=(r||[]).slice(),l=o.length,{start:s,end:c}=t;if(i){var u=r[l-1];if(null!=u){var d=n(u,l-1),f=e*(u.coordinate+e*d/2-c);o[l-1]=u=XN(XN({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),null!=u.tickCoord&&XS(e,u.tickCoord,()=>d,s,c)&&(c=u.tickCoord-e*(d/2+a),o[l-1]=XN(XN({},u),{},{isShow:!0}))}}for(var h=i?l-1:l,p=function(t){var r,i=o[t];if(null==i)return 1;var l=i,u=()=>(void 0===r&&(r=n(i,t)),r);if(0===t){var d=e*(l.coordinate-e*u()/2-s);o[t]=l=XN(XN({},l),{},{tickCoord:d<0?l.coordinate-d*e:l.coordinate})}else o[t]=l=XN(XN({},l),{},{tickCoord:l.coordinate});null!=l.tickCoord&&XS(e,l.tickCoord,u,s,c)&&(s=l.tickCoord+e*(u()/2+a),o[t]=XN(XN({},l),{},{isShow:!0}))},m=0;m<h;m++)if(p(m))continue;return o}(x,y,m,i,l,"preserveStartEnd"===c):function(e,t,n,r,a){for(var i=(r||[]).slice(),o=i.length,{start:l}=t,{end:s}=t,c=function(t){var r,c=i[t];if(null==c)return 1;var u=c,d=()=>(void 0===r&&(r=n(c,t)),r);if(t===o-1){var f=e*(u.coordinate+e*d()/2-s);i[t]=u=XN(XN({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate})}else i[t]=u=XN(XN({},u),{},{tickCoord:u.coordinate});null!=u.tickCoord&&XS(e,u.tickCoord,d,l,s)&&(s=u.tickCoord-e*(d()/2+a),i[t]=XN(XN({},u),{},{isShow:!0}))},u=o-1;u>=0;u--)if(c(u))continue;return i}(x,y,m,i,l)).filter(e=>e.isShow)}var XE=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function XO(){return(XO=Object.assign.bind()).apply(null,arguments)}function XP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function XA(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?XP(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var XI={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:Nn.axis};function Xz(e){var{x:t,y:n,width:r,height:a,orientation:i,mirror:o,axisLine:l,otherSvgProps:s}=e;if(!l)return null;var c=XA(XA(XA({},s),A5(l)),{},{fill:"none"});if("top"===i||"bottom"===i){var u=+("top"===i&&!o||"bottom"===i&&o);c=XA(XA({},c),{},{x1:t,y1:n+u*a,x2:t+r,y2:n+u*a})}else{var d=+("left"===i&&!o||"right"===i&&o);c=XA(XA({},c),{},{x1:t+d*r,y1:n,x2:t+d*r,y2:n+a})}return ew.createElement("line",XO({},c,{className:(0,w1.clsx)("recharts-cartesian-axis-line",(0,w0.default)(l,"className"))}))}function X_(e){var t,{option:n,tickProps:r,value:a}=e,i=(0,w1.clsx)(r.className,"recharts-cartesian-axis-tick-value");if(ew.isValidElement(n))t=ew.cloneElement(n,XA(XA({},r),{},{className:i}));else if("function"==typeof n)t=n(XA(XA({},r),{},{className:i}));else{var o="recharts-cartesian-axis-tick-value";"boolean"!=typeof n&&(o=(0,w1.clsx)(o,TS(n))),t=ew.createElement(zs,XO({},r,{className:o}),a)}return t}function XD(e){var{ticks:t,axisType:n,axisId:r}=e,a=kh();return(0,ew.useEffect)(()=>null==r||null==n?jV:(a($P({ticks:t.map(e=>({value:e.value,coordinate:e.coordinate,offset:e.offset,index:e.index})),axisId:r,axisType:n})),()=>{a($A({axisId:r,axisType:n}))}),[a,t,r,n]),null}var XR=(0,ew.forwardRef)((e,t)=>{var{ticks:n=[],tick:r,tickLine:a,stroke:i,tickFormatter:o,unit:l,padding:s,tickTextProps:c,orientation:u,mirror:d,x:f,y:h,width:p,height:m,tickSize:g,tickMargin:v,fontSize:x,letterSpacing:y,getTicksConfig:b,events:w,axisType:j,axisId:k}=e,S=XM(XA(XA({},b),{},{ticks:n}),x,y),C=A5(b),N=A4(r),M=zt(C.textAnchor)?C.textAnchor:function(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}(u,d),E=function(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}(u,d),O={};"object"==typeof a&&(O=a);var P=XA(XA({},C),{},{fill:"none"},O),A=S.map(e=>XA({entry:e},function(e,t,n,r,a,i,o,l,s){var c,u,d,f,h,p,m=l?-1:1,g=e.tickSize||o,v=jI(e.tickCoord)?e.tickCoord:e.coordinate;switch(i){case"top":c=u=e.coordinate,p=(d=(f=n+!l*a)-m*g)-m*s,h=v;break;case"left":d=f=e.coordinate,h=(c=(u=t+!l*r)-m*g)-m*s,p=v;break;case"right":d=f=e.coordinate,h=(c=(u=t+l*r)+m*g)+m*s,p=v;break;default:c=u=e.coordinate,p=(d=(f=n+l*a)+m*g)+m*s,h=v}return{line:{x1:c,y1:d,x2:u,y2:f},tick:{x:h,y:p}}}(e,f,h,p,m,u,g,d,v))),I=A.map(e=>{var{entry:t,line:n}=e;return ew.createElement(A7,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(t.value,"-").concat(t.coordinate,"-").concat(t.tickCoord)},a&&ew.createElement("line",XO({},P,n,{className:(0,w1.clsx)("recharts-cartesian-axis-tick-line",(0,w0.default)(a,"className"))})))}),z=A.map((e,t)=>{var n,a,{entry:u,tick:d}=e,f=XA(XA(XA(XA({verticalAnchor:E},C),{},{textAnchor:M,stroke:"none",fill:i},d),{},{index:t,payload:u,visibleTicksCount:S.length,tickFormatter:o,padding:s},c),{},{angle:null!=(n=null!=(a=null==c?void 0:c.angle)?a:C.angle)?n:0}),h=XA(XA({},f),N);return ew.createElement(A7,XO({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(u.value,"-").concat(u.coordinate,"-").concat(u.tickCoord)},IO(w,u,t)),r&&ew.createElement(X_,{option:r,tickProps:h,value:"".concat("function"==typeof o?o(u.value,t):u.value).concat(l||"")}))});return ew.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(j,"-ticks")},ew.createElement(XD,{ticks:S,axisId:k,axisType:j}),z.length>0&&ew.createElement(R3,{zIndex:Nn.label},ew.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(j,"-tick-labels"),ref:t},z)),I.length>0&&ew.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(j,"-tick-lines")},I))}),XT=(0,ew.forwardRef)((e,t)=>{var{axisLine:n,width:r,height:a,className:i,hide:o,ticks:l,axisType:s,axisId:c}=e,u=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,XE),[d,f]=(0,ew.useState)(""),[h,p]=(0,ew.useState)(""),m=(0,ew.useRef)(null);(0,ew.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>{var t;return(e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:a=0,tickMargin:i=0}=e,o=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>o&&(o=t.width)}});var l=n?n.getBoundingClientRect().width:0;return Math.round(o+(a+i)+l+(n?r:0))}return 0})({ticks:m.current,label:null==(t=e.labelRef)?void 0:t.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var g=(0,ew.useCallback)(e=>{if(e){var t=e.getElementsByClassName("recharts-cartesian-axis-tick-value");m.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),a=r.fontSize,i=r.letterSpacing;(a!==d||i!==h)&&(f(a),p(i))}}},[d,h]);return o||null!=r&&r<=0||null!=a&&a<=0?null:ew.createElement(R3,{zIndex:e.zIndex},ew.createElement(A7,{className:(0,w1.clsx)("recharts-cartesian-axis",i)},ew.createElement(Xz,{x:e.x,y:e.y,width:r,height:a,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:A5(e)}),ew.createElement(XR,{ref:g,axisType:s,events:u,fontSize:d,getTicksConfig:e,height:e.height,letterSpacing:h,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:l,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:c}),ew.createElement(Ti,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},ew.createElement(Tf,{label:e.label,labelRef:e.labelRef}),e.children)))}),XL=ew.forwardRef((e,t)=>{var n=I4(e,XI);return ew.createElement(XT,XO({},n,{ref:t}))});XL.displayName="CartesianAxis";var X$=["x1","y1","x2","y2","key"],XF=["offset"],XB=["xAxisId","yAxisId"],XV=["xAxisId","yAxisId"];function XH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function XW(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?XH(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XH(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function XU(){return(XU=Object.assign.bind()).apply(null,arguments)}function Xq(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var XK=e=>{var{fill:t}=e;if(!t||"none"===t)return null;var{fillOpacity:n,x:r,y:a,width:i,height:o,ry:l}=e;return ew.createElement("rect",{x:r,y:a,ry:l,width:i,height:o,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function XG(e){var{option:t,lineItemProps:n}=e;if(ew.isValidElement(t))r=ew.cloneElement(t,n);else if("function"==typeof t)r=t(n);else{var r,a,{x1:i,y1:o,x2:l,y2:s,key:c}=n,u=null!=(a=A5(Xq(n,X$)))?a:{},{offset:d}=u,f=Xq(u,XF);r=ew.createElement("line",XU({},f,{x1:i,y1:o,x2:l,y2:s,fill:"none",key:c}))}return r}function XX(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:a}=e;if(!r||!a||!a.length)return null;var{xAxisId:i,yAxisId:o}=e,l=Xq(e,XB),s=a.map((e,a)=>{var i=XW(XW({},l),{},{x1:t,y1:e,x2:t+n,y2:e,key:"line-".concat(a),index:a});return ew.createElement(XG,{key:"line-".concat(a),option:r,lineItemProps:i})});return ew.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function XY(e){var{y:t,height:n,vertical:r=!0,verticalPoints:a}=e;if(!r||!a||!a.length)return null;var{xAxisId:i,yAxisId:o}=e,l=Xq(e,XV),s=a.map((e,a)=>{var i=XW(XW({},l),{},{x1:e,y1:t,x2:e,y2:t+n,key:"line-".concat(a),index:a});return ew.createElement(XG,{option:r,lineItemProps:i,key:"line-".concat(a)})});return ew.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function XZ(e){var{horizontalFill:t,fillOpacity:n,x:r,y:a,width:i,height:o,horizontalPoints:l,horizontal:s=!0}=e;if(!s||!t||!t.length||null==l)return null;var c=l.map(e=>Math.round(e+a-a)).sort((e,t)=>e-t);a!==c[0]&&c.unshift(0);var u=c.map((e,l)=>{var s=c[l+1],u=null==s?a+o-e:s-e;if(u<=0)return null;var d=l%t.length;return ew.createElement("rect",{key:"react-".concat(l),y:e,x:r,height:u,width:i,stroke:"none",fill:t[d],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return ew.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},u)}function XJ(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:a,y:i,width:o,height:l,verticalPoints:s}=e;if(!t||!n||!n.length)return null;var c=s.map(e=>Math.round(e+a-a)).sort((e,t)=>e-t);a!==c[0]&&c.unshift(0);var u=c.map((e,t)=>{var s=c[t+1],u=null==s?a+o-e:s-e;if(u<=0)return null;var d=t%n.length;return ew.createElement("rect",{key:"react-".concat(t),x:e,y:i,width:u,height:l,stroke:"none",fill:n[d],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return ew.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},u)}var XQ=(e,t)=>{var{xAxis:n,width:r,height:a,offset:i}=e;return jY(XM(XW(XW(XW({},XI),n),{},{ticks:jZ(n,!0),viewBox:{x:0,y:0,width:r,height:a}})),i.left,i.left+i.width,t)},X0=(e,t)=>{var{yAxis:n,width:r,height:a,offset:i}=e;return jY(XM(XW(XW(XW({},XI),n),{},{ticks:jZ(n,!0),viewBox:{x:0,y:0,width:r,height:a}})),i.top,i.top+i.height,t)},X1={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Nn.grid};function X2(e){var t=kv(j8),n=kv(j7),r=CR(),a=XW(XW({},I4(e,X1)),{},{x:jI(e.x)?e.x:r.left,y:jI(e.y)?e.y:r.top,width:jI(e.width)?e.width:r.width,height:jI(e.height)?e.height:r.height}),{xAxisId:i,yAxisId:o,x:l,y:s,width:c,height:u,syncWithTicks:d,horizontalValues:f,verticalValues:h}=a,p=Cf(),m=kv(e=>AC(e,"xAxis",i,p)),g=kv(e=>AC(e,"yAxis",o,p));if(!jU(c)||!jU(u)||!jI(l)||!jI(s))return null;var v=a.verticalCoordinatesGenerator||XQ,x=a.horizontalCoordinatesGenerator||X0,{horizontalPoints:y,verticalPoints:b}=a;if((!y||!y.length)&&"function"==typeof x){var w=f&&f.length,j=x({yAxis:g?XW(XW({},g),{},{ticks:w?f:g.ticks}):void 0,width:null!=t?t:c,height:null!=n?n:u,offset:r},!!w||d);Cg(Array.isArray(j),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof j,"]")),Array.isArray(j)&&(y=j)}if((!b||!b.length)&&"function"==typeof v){var k=h&&h.length,S=v({xAxis:m?XW(XW({},m),{},{ticks:k?h:m.ticks}):void 0,width:null!=t?t:c,height:null!=n?n:u,offset:r},!!k||d);Cg(Array.isArray(S),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof S,"]")),Array.isArray(S)&&(b=S)}return ew.createElement(R3,{zIndex:a.zIndex},ew.createElement("g",{className:"recharts-cartesian-grid"},ew.createElement(XK,{fill:a.fill,fillOpacity:a.fillOpacity,x:a.x,y:a.y,width:a.width,height:a.height,ry:a.ry}),ew.createElement(XZ,XU({},a,{horizontalPoints:y})),ew.createElement(XJ,XU({},a,{verticalPoints:b})),ew.createElement(XX,XU({},a,{offset:r,horizontalPoints:y,xAxis:m,yAxis:g})),ew.createElement(XY,XU({},a,{offset:r,verticalPoints:b,xAxis:m,yAxis:g}))))}X2.displayName="CartesianGrid";var X5=["domain","range"],X4=["domain","range"];function X3(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function X6(e,t){return e===t||!!(Array.isArray(e)&&2===e.length&&Array.isArray(t))&&2===t.length&&e[0]===t[0]&&e[1]===t[1]}function X8(e,t){if(e===t)return!0;var{domain:n,range:r}=e,a=X3(e,X5),{domain:i,range:o}=t,l=X3(t,X4);return!!X6(n,i)&&!!X6(r,o)&&$T(a,l)}var X7=["type"],X9=["dangerouslySetInnerHTML","ticks","scale"],Ye=["id","scale"];function Yt(){return(Yt=Object.assign.bind()).apply(null,arguments)}function Yn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Yr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yn(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ya(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Yi(e){var t=kh(),n=(0,ew.useRef)(null),r=CL(),{type:a}=e,i=Ya(e,X7),o=No(r,"xAxis",a),l=(0,ew.useMemo)(()=>{if(null!=o)return Yr(Yr({},i),{},{type:o})},[i,o]);return(0,ew.useLayoutEffect)(()=>{null!=l&&(null===n.current?t(LM(l)):n.current!==l&&t(LE({prev:n.current,next:l})),n.current=l)},[l,t]),(0,ew.useLayoutEffect)(()=>()=>{n.current&&(t(LO(n.current)),n.current=null)},[t]),null}var Yo=e=>{var{xAxisId:t,className:n}=e,r=kv(kc),a=Cf(),i="xAxis",o=kv(e=>AN(e,i,t,a)),l=kv(e=>Ag(e,t)),s=kv(e=>Ay(e,t)),c=kv(e=>OQ(e,t));if(null==l||null==s||null==c)return null;var{dangerouslySetInnerHTML:u,ticks:d,scale:f}=e,h=Ya(e,X9),{id:p,scale:m}=c,g=Ya(c,Ye);return ew.createElement(XL,Yt({},h,g,{x:s.x,y:s.y,width:l.width,height:l.height,className:(0,w1.clsx)("recharts-".concat(i," ").concat(i),n),viewBox:r,ticks:o,axisType:i,axisId:t}))},Yl={allowDataOverflow:OJ.allowDataOverflow,allowDecimals:OJ.allowDecimals,allowDuplicatedCategory:OJ.allowDuplicatedCategory,angle:OJ.angle,axisLine:XI.axisLine,height:OJ.height,hide:!1,includeHidden:OJ.includeHidden,interval:OJ.interval,label:!1,minTickGap:OJ.minTickGap,mirror:OJ.mirror,orientation:OJ.orientation,padding:OJ.padding,reversed:OJ.reversed,scale:OJ.scale,tick:OJ.tick,tickCount:OJ.tickCount,tickLine:XI.tickLine,tickSize:XI.tickSize,type:OJ.type,niceTicks:OJ.niceTicks,xAxisId:0},Ys=ew.memo(e=>{var t=I4(e,Yl);return ew.createElement(ew.Fragment,null,ew.createElement(Yi,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),ew.createElement(Yo,t))},X8);Ys.displayName="XAxis";var Yc=["type"],Yu=["dangerouslySetInnerHTML","ticks","scale"],Yd=["id","scale"];function Yf(){return(Yf=Object.assign.bind()).apply(null,arguments)}function Yh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Yp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yh(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ym(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Yg(e){var t=kh(),n=(0,ew.useRef)(null),r=CL(),{type:a}=e,i=Ym(e,Yc),o=No(r,"yAxis",a),l=(0,ew.useMemo)(()=>{if(null!=o)return Yp(Yp({},i),{},{type:o})},[o,i]);return(0,ew.useLayoutEffect)(()=>{null!=l&&(null===n.current?t(LP(l)):n.current!==l&&t(LA({prev:n.current,next:l})),n.current=l)},[l,t]),(0,ew.useLayoutEffect)(()=>()=>{n.current&&(t(LI(n.current)),n.current=null)},[t]),null}function Yv(e){var{yAxisId:t,className:n,width:r,label:a}=e,i=(0,ew.useRef)(null),o=(0,ew.useRef)(null),l=kv(kc),s=Cf(),c=kh(),u="yAxis",d=kv(e=>Aw(e,t)),f=kv(e=>Ab(e,t)),h=kv(e=>AN(e,u,t,s)),p=kv(e=>O2(e,t));if((0,ew.useLayoutEffect)(()=>{if(!("auto"!==r||!d||Ts(a)||(0,ew.isValidElement)(a))&&null!=p){var e=i.current;if(e){var n=e.getCalculatedWidth();Math.round(d.width)!==Math.round(n)&&c(LR({id:t,width:n}))}}},[h,d,c,a,t,r,p]),null==d||null==f||null==p)return null;var{dangerouslySetInnerHTML:m,ticks:g,scale:v}=e,x=Ym(e,Yu),{id:y,scale:b}=p,w=Ym(p,Yd);return ew.createElement(XL,Yf({},x,w,{ref:i,labelRef:o,x:f.x,y:f.y,tickTextProps:"auto"===r?{width:void 0}:{width:r},width:d.width,height:d.height,className:(0,w1.clsx)("recharts-".concat(u," ").concat(u),n),viewBox:l,ticks:h,axisType:u,axisId:t}))}var Yx={allowDataOverflow:O1.allowDataOverflow,allowDecimals:O1.allowDecimals,allowDuplicatedCategory:O1.allowDuplicatedCategory,angle:O1.angle,axisLine:XI.axisLine,hide:!1,includeHidden:O1.includeHidden,interval:O1.interval,label:!1,minTickGap:O1.minTickGap,mirror:O1.mirror,orientation:O1.orientation,padding:O1.padding,reversed:O1.reversed,scale:O1.scale,tick:O1.tick,tickCount:O1.tickCount,tickLine:XI.tickLine,tickSize:XI.tickSize,type:O1.type,niceTicks:O1.niceTicks,width:O1.width,yAxisId:0},Yy=ew.memo(e=>{var t=I4(e,Yx);return ew.createElement(ew.Fragment,null,ew.createElement(Yg,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),ew.createElement(Yv,t))},X8);function Yb({machines:e,defaultMachineId:t,className:n,...r}){let[a,i]=ew.useState(t??e[0]?.id),o=e.find(e=>e.id===a)??e[0],[l,s]=ew.useState({});if(!o)return null;let c=l[o.id]??o.selectedMetricId??o.metrics[0]?.id,u=o.metrics.find(e=>e.id===c)??o.metrics[0];return(0,ey.jsxs)("div",{className:(0,eI.cn)("vtl-surface-card flex h-full min-h-0 flex-col rounded-[var(--surface-card-radius)] border","vtl-performance-monitor",n),...r,children:[(0,ey.jsx)(hQ,{value:o.id,onValueChange:i,className:"shrink-0 px-3 pt-3",children:(0,ey.jsx)(h7,{className:"h-8",children:e.map(e=>(0,ey.jsx)(h9,{value:e.id,children:e.name},e.id))})}),(0,ey.jsxs)("div",{className:"mt-3 grid min-h-0 flex-1 grid-cols-[14rem_minmax(0,1fr)] border-t",children:[(0,ey.jsx)("div",{className:"min-h-0 overflow-auto border-r p-2",children:o.metrics.map(e=>(0,ey.jsxs)("button",{type:"button",onClick:()=>s(t=>({...t,[o.id]:e.id})),className:(0,eI.cn)("grid w-full grid-cols-[3.75rem_minmax(0,1fr)] gap-3 px-2 py-2 text-left transition-colors",e.id===c&&"bg-muted"),children:[(0,ey.jsx)(YN,{data:e.data,color:e.color}),(0,ey.jsxs)("span",{className:"min-w-0",children:[(0,ey.jsx)("span",{className:"block truncate text-base leading-tight",children:e.label}),(0,ey.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.value}),e.detail?(0,ey.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.detail}):null]})]},e.id))}),(0,ey.jsxs)("div",{className:"min-h-0 overflow-auto p-5",children:[(0,ey.jsxs)("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] items-start gap-5",children:[(0,ey.jsxs)("div",{children:[(0,ey.jsx)("h2",{className:"text-4xl leading-none font-semibold tracking-normal",children:u?.title}),u?.subtitle?(0,ey.jsx)("p",{className:"mt-1 text-base text-muted-foreground",children:u.subtitle}):null]}),(0,ey.jsx)("div",{className:"text-right text-sm text-muted-foreground",children:u?.detail})]}),u?(0,ey.jsx)(Yw,{metric:u}):null]})]})]})}function Yw({metric:e}){return"cpu"===e.kind?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(Yj,{panel:{id:"cpu",title:"% 利用率",value:"100%",data:e.data,span:"full"},size:"large"}),(0,ey.jsx)(Yk,{}),(0,ey.jsx)(YC,{details:e.details,columns:4})]}):"memory"===e.kind?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(Yj,{panel:{id:"memory",title:"内存使用量",value:e.detail,data:e.data,span:"full"},size:"large"}),(0,ey.jsx)(Yk,{}),(0,ey.jsx)(YS,{segments:e.composition}),(0,ey.jsx)(YC,{details:e.details,columns:3})]}):"disk"===e.kind?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(Yj,{panel:{id:"disk-active",title:"活动时间",value:"100%",data:e.data,span:"full"},size:"large"}),(0,ey.jsx)(Yk,{}),(0,ey.jsx)(Yj,{panel:{id:"disk-rate",title:"磁盘传输速率",value:"500 KB/秒",data:e.panels?.[0]?.data??e.data,span:"full"},size:"short"}),(0,ey.jsx)(Yk,{}),(0,ey.jsx)(YC,{details:e.details,columns:4})]}):"network"===e.kind?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(Yj,{panel:{id:"network",title:"吞吐量",value:"100 Kbps",data:e.data,span:"full",color:"danger"},size:"tall"}),(0,ey.jsx)(Yk,{}),(0,ey.jsx)(YC,{details:e.details,columns:2})]}):(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("div",{className:"mt-5 grid grid-cols-2 gap-3",children:(e.panels??[]).map(e=>(0,ey.jsx)(Yj,{panel:e},e.id))}),(0,ey.jsx)(YC,{details:e.details,columns:3})]})}function Yj({panel:e,size:t="normal"}){let n={short:"h-[4rem]",normal:"full"===e.span?"h-20":"h-24",large:"h-[17.5rem]",tall:"h-[21.5rem]"}[t];return(0,ey.jsxs)("div",{className:(0,eI.cn)("mt-5","full"===e.span&&"col-span-2"),children:[(0,ey.jsxs)("div",{className:"mb-1 flex items-center justify-between text-sm",children:[(0,ey.jsx)("span",{className:"text-muted-foreground",children:e.title}),e.value?(0,ey.jsx)("span",{className:"text-muted-foreground tabular-nums",children:e.value}):null]}),(0,ey.jsx)(YM,{data:e.data,color:e.color,className:(0,eI.cn)("w-full",n)})]})}function Yk(){return(0,ey.jsxs)("div",{className:"mt-1 flex justify-between text-xs text-muted-foreground",children:[(0,ey.jsx)("span",{children:"60 秒"}),(0,ey.jsx)("span",{children:"0"})]})}function YS({segments:e}){let t=e&&e.length>0?e:[{label:"used",value:64},{label:"available",value:36}];return(0,ey.jsxs)("div",{className:"mt-5",children:[(0,ey.jsx)("div",{className:"mb-1 text-sm text-muted-foreground",children:"内存组合"}),(0,ey.jsx)("div",{className:"flex h-[3.25rem] w-full overflow-hidden border border-primary/75 bg-background",children:t.map((e,n)=>(0,ey.jsx)("div",{className:(0,eI.cn)("h-full border-r border-primary/75 last:border-r-0",0===n?"bg-primary/20":n===t.length-1?"bg-background":"bg-primary/8"),style:{width:`${Math.max(0,e.value)}%`}},`${e.label}-${n}`))})]})}function YC({details:e,columns:t}){return e?.length?(0,ey.jsx)("div",{className:(0,eI.cn)("mt-5 grid gap-x-10 gap-y-4",2===t&&"grid-cols-2",3===t&&"grid-cols-3",4===t&&"grid-cols-4"),children:e.map(([e,t])=>(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("div",{className:"text-xs text-muted-foreground",children:e}),(0,ey.jsx)("div",{className:"truncate text-2xl leading-tight tabular-nums",children:t})]},e))}):null}function YN({data:e,color:t}){return(0,ey.jsx)(YM,{data:e,color:t,className:"h-10 w-full",strokeWidth:1.4,compact:!0})}function YM({data:e,color:t="default",className:n,strokeWidth:r=1.6,compact:a=!1}){let i=ew.useMemo(()=>(e.length>1?e:[0,0]).map((e,t)=>({index:t,value:Math.max(0,Math.min(100,e))})),[e]),o=ew.useMemo(()=>({value:{label:"Value",color:"danger"===t?"var(--destructive)":"var(--foreground)"}}),[t]);return(0,ey.jsx)(Bg,{config:o,className:(0,eI.cn)("aspect-auto border bg-background text-muted-foreground",n),initialDimension:{width:a?96:640,height:a?40:220},children:(0,ey.jsxs)(Xw,{data:i,margin:{top:a?2:6,right:0,bottom:0,left:0},children:[a?null:(0,ey.jsx)(X2,{strokeDasharray:"0",stroke:"var(--border)",strokeOpacity:.7}),(0,ey.jsx)(Ys,{dataKey:"index",hide:!0,domain:["dataMin","dataMax"]}),(0,ey.jsx)(Yy,{hide:!0,domain:[0,100]}),a?null:(0,ey.jsx)(Bx,{cursor:!1,content:(0,ey.jsx)(By,{hideLabel:!0,indicator:"line"})}),(0,ey.jsx)(Xm,{dataKey:"value",type:"monotone",fill:"var(--color-value)",fillOpacity:"danger"===t?.16:.12,stroke:"var(--color-value)",strokeWidth:r,isAnimationActive:!1,dot:!1,activeDot:!1})]})})}Yy.displayName="YAxis";let YE=(0,ek.default)("badge-alert",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),YO=(0,ek.default)("circle-pause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]),YP={name:"名称",cpu:"CPU",memoryMb:"内存",diskMbps:"磁盘",networkMbps:"网络"};function YA({machines:e,defaultMachineId:t,className:n,...r}){let[a,i]=ew.useState(t??e[0]?.id),[o,l]=ew.useState("cpu"),[s,c]=ew.useState("desc"),[u,d]=ew.useState({}),f=e.find(e=>e.id===a)??e[0],h=ew.useMemo(()=>{if(!f)return[];let e=[...function(e){let t=new Map,n=new Map;for(let t of e)void 0!==t.pid&&n.set(t.pid,t);for(let a of e){var r;let e=function e(t,n,r=new Set){void 0!==t.pid&&r.add(t.pid);let a=void 0!==t.parentPid?n.get(t.parentPid):void 0;return!a||void 0===a.pid||r.has(a.pid)||["bash","containerd","dockerd","explorer","init","kernel_task","launchd","services","sh","smss","svchost","system","systemd","wininit","winlogon","zsh"].includes(YT(a))?t:e(a,n,r)}(a,n),i=YT(e),o=t.get(i)??{kind:"group",id:i,name:(r=e,r.appName?.trim()||r.name.trim().replace(/\.(exe|com)$/i,"")||r.id),children:[],status:[],cpu:0,memoryMb:0,diskMbps:0,networkMbps:0};o.children.push(a),o.cpu+=a.cpu,o.memoryMb+=a.memoryMb,o.diskMbps+=a.diskMbps,o.networkMbps+=a.networkMbps,o.status=function(e,t){let n=new Set(e??[]);for(let e of t??[])n.add(e);return Array.from(n)}(o.status,a.status),t.set(i,o)}return Array.from(t.values()).map(e=>({...e,cpu:Y$(Math.min(100,e.cpu)),memoryMb:Y$(e.memoryMb),diskMbps:Y$(e.diskMbps),networkMbps:Y$(e.networkMbps)}))}(f.processes)].sort((e,t)=>YL(e,t,o,s)),t=[];for(let n of e){if(n.children.length<=1){let e=n.children[0];e&&t.push(YR(e,0));continue}if(t.push(n),u[n.id])for(let e of[...n.children].sort((e,t)=>YL(e,t,o,s)))t.push(YR(e,1))}return t},[f,u,s,o]),p=ew.useMemo(()=>h.map(e=>({memoryMb:e.memoryMb,diskMbps:e.diskMbps,networkMbps:e.networkMbps})),[h]);function m(e){e===o?c(e=>"asc"===e?"desc":"asc"):(l(e),c("name"===e?"asc":"desc"))}return f?(0,ey.jsxs)("div",{className:(0,eI.cn)("vtl-surface-card flex h-full min-h-0 flex-col rounded-[var(--surface-card-radius)] border","vtl-process-monitor",n),...r,children:[(0,ey.jsx)(hQ,{value:f.id,onValueChange:i,className:"shrink-0 px-3 pt-3",children:(0,ey.jsx)(h7,{className:"h-8",children:e.map(e=>(0,ey.jsx)(h9,{value:e.id,children:e.name},e.id))})}),(0,ey.jsxs)("div",{className:"mt-3 grid h-14 shrink-0 grid-cols-[minmax(12rem,1fr)_6.25rem_repeat(4,minmax(5rem,7rem))] border-y text-sm",children:[(0,ey.jsxs)("button",{type:"button",onClick:()=>m("name"),className:"flex items-end px-3 pb-2 text-left text-muted-foreground",children:["名称",(0,ey.jsx)(YI,{active:"name"===o,direction:s})]}),(0,ey.jsx)("div",{className:"flex items-end px-3 pb-2 text-muted-foreground",children:"状态"}),["cpu","memoryMb","diskMbps","networkMbps"].map(e=>{var t,n;return(0,ey.jsxs)("button",{type:"button",onClick:()=>m(e),className:"grid content-end border-l px-3 pb-2 text-right",children:[(0,ey.jsx)("span",{className:"text-lg leading-none text-foreground",children:(t=f.totals,"cpu"===(n=e)?`${Math.round(t.cpu)}%`:"memoryMb"===n?`${Math.round(t.memory)}%`:"diskMbps"===n?`${Math.round(t.disk)}%`:"networkMbps"===n?`${Math.round(t.network)}%`:"")}),(0,ey.jsxs)("span",{className:"mt-1 text-xs text-muted-foreground",children:[YP[e],(0,ey.jsx)(YI,{active:o===e,direction:s,className:"ml-1 inline-flex"})]})]},e)})]}),(0,ey.jsx)("div",{className:"vtl-scrollbar-hidden min-h-0 flex-1 overflow-auto",children:h.map(e=>{var t;return(0,ey.jsxs)("div",{className:(0,eI.cn)("grid min-h-9 grid-cols-[minmax(12rem,1fr)_6.25rem_repeat(4,minmax(5rem,7rem))] items-center text-sm","group"===e.kind&&"bg-muted/35"),children:[(0,ey.jsx)(Yz,{row:e,expanded:"group"===e.kind&&!!u[e.id],onToggle:()=>{"group"===e.kind&&d(t=>({...t,[e.id]:!t[e.id]}))}}),(0,ey.jsx)(Y_,{platform:f.platform,status:e.status}),(0,ey.jsx)(YD,{value:e.cpu,max:100,label:`${e.cpu.toFixed(1)}%`}),(0,ey.jsx)(YD,{value:e.memoryMb,max:YF(p,"memoryMb"),label:(t=e.memoryMb)>=1024?`${YB(t/1024)} GB`:`${YB(t)} MB`}),(0,ey.jsx)(YD,{value:e.diskMbps,max:Math.max(1,YF(p,"diskMbps")),label:`${YB(e.diskMbps)} MB/秒`}),(0,ey.jsx)(YD,{value:e.networkMbps,max:Math.max(1,YF(p,"networkMbps")),label:`${YB(e.networkMbps)} Mbps`})]},`${e.kind}-${e.id}`)})})]}):null}function YI({active:e,direction:t,className:n}){return e?(0,ey.jsx)("asc"===t?wK:Wn,{className:(0,eI.cn)("ml-1 size-3",n)}):null}function Yz({row:e,expanded:t,onToggle:n}){if("group"===e.kind){let r=t?gK:pC;return(0,ey.jsxs)("button",{type:"button","aria-expanded":t,onClick:n,className:"flex h-full min-w-0 items-center gap-2 px-3 text-left outline-none transition-colors hover:bg-muted/55 focus-visible:ring-[3px] focus-visible:ring-ring/20",children:[(0,ey.jsx)(r,{className:"size-4 shrink-0 text-muted-foreground"}),(0,ey.jsx)("span",{className:"size-2 rounded-sm bg-foreground/65"}),(0,ey.jsxs)("span",{className:"min-w-0 truncate font-medium",children:[e.name," (",e.children.length,")"]})]})}return(0,ey.jsxs)("div",{className:"flex min-w-0 items-center gap-2 px-3",style:{paddingLeft:e.depth>0?34:void 0},children:[e.depth>0?(0,ey.jsx)("span",{className:"size-1.5 rounded-full bg-muted-foreground/70"}):(0,ey.jsx)("span",{className:"size-1.5 rounded-full bg-foreground/65"}),(0,ey.jsx)("span",{className:(0,eI.cn)("truncate",0===e.depth&&"font-medium"),children:e.name}),e.process.pid?(0,ey.jsx)("span",{className:"shrink-0 ui-text-kbd text-muted-foreground",children:e.process.pid}):null]})}function Y_({platform:e,status:t}){return t?.length?(0,ey.jsxs)("div",{className:"flex items-center gap-1.5 px-3 text-muted-foreground",children:[t.includes("suspended")?(0,ey.jsx)(YO,{"aria-label":"linux"===e?"挂起进程":"挂起",className:"size-4"}):null,t.includes("auto-restart")?(0,ey.jsx)(lH,{"aria-label":"linux"===e?"自动重启进程":"自动重启",className:"size-4"}):null,t.includes("running")?(0,ey.jsx)(YE,{"aria-label":"运行",className:"size-4 text-primary"}):null]}):(0,ey.jsx)("div",{className:"px-3"})}function YD({value:e,max:t,label:n}){let r=Math.min(1,Math.max(0,e/Math.max(1,t))),a=r>.78,i=a?`color-mix(in oklch, var(--destructive) ${Math.round(18+42*r)}%, var(--background))`:`color-mix(in oklch, var(--foreground) ${Math.round(5+20*r)}%, var(--background))`;return(0,ey.jsx)("div",{className:"vtl-process-heat-cell h-full border-l px-3 text-right tabular-nums","data-hot":a?"":void 0,style:{background:i},children:(0,ey.jsx)("span",{className:(0,eI.cn)("leading-9",a&&"text-destructive"),children:n})})}function YR(e,t){return{kind:"process",id:e.id,process:e,depth:t,name:e.appName&&0===t?e.appName:e.name,status:e.status,cpu:e.cpu,memoryMb:e.memoryMb,diskMbps:e.diskMbps,networkMbps:e.networkMbps}}function YT(e){return e.appId?.trim().toLowerCase()||e.appName?.trim().toLowerCase()||e.name.trim().toLowerCase().replace(/\.(exe|com)$/i,"")||e.id}function YL(e,t,n,r){let a="asc"===r?1:-1;return"name"===n?e.name.localeCompare(t.name)*a:(e[n]-t[n])*a}function Y$(e){return Math.round(10*e)/10}function YF(e,t){return e.reduce((e,n)=>Math.max(e,n[t]),0)}function YB(e){return new Intl.NumberFormat("zh-CN",{maximumFractionDigits:+(e<10)}).format(e)}function YV({className:e}){let t=YW("/api/local/machines/processes"),n=YU("/machines/processes"),r=ew.useMemo(()=>[...t,...n],[t,n]);return(0,ey.jsx)(YA,{machines:r,className:(0,eI.cn)("h-full min-h-0 w-full",e)})}function YH({className:e}){let t=YW("/api/local/machines/performance"),n=YU("/machines/performance"),r=ew.useMemo(()=>[...t,...n],[t,n]);return(0,ey.jsx)(Yb,{machines:r,className:(0,eI.cn)("h-full min-h-0 w-full",e)})}function YW(e){let[t,n]=ew.useState([]);return ew.useEffect(()=>{let t=!0,r=!1;async function a(){if(!r){r=!0;try{let r=await fetch(eD(e),{cache:"no-store"});if(!r.ok)return;let a=await r.json();t&&n(a.machines)}catch{t&&n([])}finally{r=!1}}}a();let i=window.setInterval(a,2e3);return()=>{t=!1,window.clearInterval(i)}},[e]),t}function YU(e){let{machines:t}=g4(),[n,r]=ew.useState([]),a=ew.useMemo(()=>t.filter(e=>!e.isLocal&&"online"===e.status).map(e=>e.id),[t]);return ew.useEffect(()=>{if(0===a.length)return void r([]);let t=!0,n=!1;async function i(){if(!n){n=!0;try{let n=await Promise.all(a.map(async t=>{try{return(await sf(t,e)).machines??[]}catch{return[]}}));t&&r(n.flat())}finally{n=!1}}}i();let o=window.setInterval(i,5e3);return()=>{t=!1,window.clearInterval(o)}},[a,e]),n}let Yq=(0,ek.default)("circle-play",[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),YK=(0,ek.default)("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),YG={loading:"Starting terminal...",newTerminal:"New terminal",closeTerminal:e=>`Close ${e}`,terminalList:"Terminal sessions",status:{idle:"Idle",running:"Running",success:"Succeeded",error:"Failed"}},YX=[{id:"powershell",title:"PowerShell",shell:"PowerShell",cwd:"D:\\Projects\\Vantaloom-ui",status:"idle",initialOutput:"PowerShell 7.6.1\r\nPS D:\\Projects\\Vantaloom-ui> "}];function YY(e,t,n){return e.getPropertyValue(t).trim()||n}function YZ(e,t=!1){let n=getComputedStyle(e),r=YY(n,"--foreground","#18181b"),a=YY(n,"--terminal-background",YY(n,"--background","#ffffff")),i="transparent"===a?YY(n,"--background","#ffffff"):a,o=YY(n,"--muted-foreground","#71717a"),l=YY(n,"--border","#e4e4e7"),s=YY(n,"--selection","#18181b");return{background:a,foreground:r,cursor:t?"transparent":r,cursorAccent:t?"transparent":i,selectionBackground:`color-mix(in oklch, ${s} 18%, transparent)`,selectionForeground:YY(n,"--selection-foreground","#ffffff"),scrollbarSliderBackground:`color-mix(in oklch, ${l} 78%, transparent)`,scrollbarSliderHoverBackground:l,black:r,red:YY(n,"--terminal-red","#bf616a"),green:YY(n,"--terminal-green","#5e8c61"),yellow:YY(n,"--terminal-yellow","#b06f3c"),blue:YY(n,"--terminal-blue","#5e81ac"),magenta:YY(n,"--terminal-magenta","#b48ead"),cyan:YY(n,"--terminal-cyan","#4c8da8"),white:a,brightBlack:o,brightRed:YY(n,"--terminal-bright-red","#d06f79"),brightGreen:YY(n,"--terminal-bright-green","#6b9a70"),brightYellow:YY(n,"--terminal-bright-yellow","#c2824b"),brightBlue:YY(n,"--terminal-bright-blue","#6f91ba"),brightMagenta:YY(n,"--terminal-bright-magenta","#c19ac0"),brightCyan:YY(n,"--terminal-bright-cyan","#5aa0b8"),brightWhite:r}}function YJ(e){return void 0===e?[]:Array.isArray(e)?e:[e]}function YQ({initialOutput:t,data:n,dataKey:r,options:a,readOnly:i=!1,autoFocus:o=!1,localEcho:l=!1,onData:s,onResize:c,onReady:u,labels:d,className:f,terminalClassName:h,...p}){let m=ew.useMemo(()=>({loading:YG.loading,...d}),[d]),g=ew.useRef(null),v=ew.useRef(null),x=ew.useRef(void 0),y=ew.useRef(s),b=ew.useRef(c),w=ew.useRef(u),j=ew.useRef(a),k=ew.useRef(i),S=ew.useRef(l),C=ew.useRef(!1),N=ew.useRef(void 0),M=ew.useRef(!1),[E,O]=ew.useState(!1);return ew.useEffect(()=>{y.current=s,b.current=c,w.current=u,j.current=a,k.current=i,S.current=l},[l,s,u,c,a,i]),ew.useEffect(()=>{let n,r=!1,a=[];!async function(){var i;let l,s,c,u,d;if(!g.current||M.current)return;M.current=!0;let[{Terminal:f},{FitAddon:h},{SearchAddon:p},{WebLinksAddon:m}]=await Promise.all([e.A(93626),e.A(16118),e.A(24306),e.A(46866)]);if(r||!g.current)return;let N=new f({convertEol:!1,cursorBlink:!0,cursorStyle:"block",drawBoldTextInBrightColors:!1,fontFamily:(l=getComputedStyle(i=g.current),d=(c=YY(l,"--font-family-mono",s='"Cascadia Mono", "Cascadia Code", Consolas, "SFMono-Regular", "Liberation Mono", monospace'),u=getComputedStyle(i),c.replace(/var\((--[a-zA-Z0-9-_]+)(?:,[^)]+)?\)/g,(e,t)=>u.getPropertyValue(t).trim()||"")).trim(),`"Cascadia Mono", "Cascadia Code", Consolas, ${d||s}`),fontSize:13,letterSpacing:0,lineHeight:1.25,macOptionIsMeta:!0,minimumContrastRatio:4.5,scrollback:5e3,theme:YZ(g.current),...j.current,allowTransparency:!0}),E=new h,P=new p,A=new m;function I(){try{E.fit(),b.current?.({cols:N.cols,rows:N.rows})}catch{}}for(let e of(N.loadAddon(E),N.loadAddon(P),N.loadAddon(A),N.open(g.current),v.current=N,x.current=E,O(!0),requestAnimationFrame(I),(n=new ResizeObserver(I)).observe(g.current),a.push(N.onData(e=>{k.current||(S.current&&("\r"===e?N.write("\r\n"):""===e?N.write("\b \b"):N.write(e)),y.current?.(e))})),YJ(t)))N.write(e);w.current?.({terminal:N,fitAddon:E,searchAddon:P,webLinksAddon:A,fit:I,focus:()=>N.focus(),clear:()=>N.clear(),setCursorSuppressed:function(e){let t=g.current;t&&(C.current=e,t.toggleAttribute("data-vtl-terminal-cursor-suppressed",e),N.options.theme=YZ(t,e))},write:(e,t)=>N.write(e,t),writeln:e=>N.writeln(e)}),o&&N.focus()}();let i=new MutationObserver(()=>{let e=v.current,t=g.current;e&&t&&(e.options.theme=YZ(t,C.current))});return i.observe(document.documentElement,{attributeFilter:["class","style"],attributes:!0}),()=>{for(let e of(r=!0,i.disconnect(),n?.disconnect(),a))e.dispose();v.current?.dispose(),v.current=null,x.current=void 0,C.current=!1,M.current=!1,O(!1)}},[o,t]),ew.useEffect(()=>{let e=v.current;if(e&&N.current!==r)for(let t of(N.current=r,YJ(n)))e.write(t)},[n,r]),(0,ey.jsxs)("div",{"data-slot":"terminal-tab-surface",className:(0,eI.cn)("relative size-full min-h-0 overflow-hidden bg-background text-foreground",f),...p,children:[(0,ey.jsx)("div",{ref:g,className:(0,eI.cn)("vtl-terminal-xterm size-full overflow-hidden p-1.5 font-mono","[&_.xterm]:h-full [&_.xterm]:p-0 [&_.xterm-viewport]:!bg-transparent","[&_.xterm-screen]:!bg-transparent [&_.xterm-helper-textarea]:!outline-none","[&[data-vtl-terminal-cursor-suppressed]_.xterm-cursor]:!opacity-0","[&_.xterm-viewport::-webkit-scrollbar]:w-2.5 [&_.xterm-viewport::-webkit-scrollbar-track]:bg-transparent","[&_.xterm-viewport::-webkit-scrollbar-thumb]:rounded-full [&_.xterm-viewport::-webkit-scrollbar-thumb]:border-[3px]","[&_.xterm-viewport::-webkit-scrollbar-thumb]:border-transparent [&_.xterm-viewport::-webkit-scrollbar-thumb]:bg-border [&_.xterm-viewport::-webkit-scrollbar-thumb]:bg-clip-content",h)}),!E&&(0,ey.jsx)("div",{className:"pointer-events-none absolute inset-0 grid place-items-center text-muted-foreground ui-text-code",children:m.loading})]})}function Y0({status:e="idle"}){return"running"===e?(0,ey.jsx)(Yq,{className:"size-3.5 text-foreground"}):"success"===e?(0,ey.jsx)(eO,{className:"size-3.5 text-foreground"}):"error"===e?(0,ey.jsx)(eE,{className:"size-3.5 text-destructive"}):(0,ey.jsx)(yq,{className:"size-3.5 text-muted-foreground"})}function Y1({session:e}){return e.aiControlled?(0,ey.jsx)(YK,{className:"size-3.5 text-destructive"}):(0,ey.jsx)(Y0,{status:e.status})}function Y2({sessions:e,defaultSessions:t=YX,activeSessionId:n,defaultActiveSessionId:r,onActiveSessionChange:a,onSessionsChange:i,onCreateSession:o,onCloseSession:l,onSessionData:s,onSessionResize:c,onSessionReady:u,showTabs:d=!0,allowCreateSession:f=!0,readOnly:h=!1,localEcho:p=!1,terminalOptions:m,labels:g,className:v,tabListClassName:x,terminalClassName:y,...b}){let w=ew.useMemo(()=>({...YG,...g,status:{...YG.status,...g?.status}}),[g]),[j,k]=ew.useState(t),S=e??j,C=S[0],[N,M]=ew.useState(r??C?.id),E=n??(S.some(e=>e.id===N)?N:C?.id),O=S.find(e=>e.id===E)??C;function P(t){void 0===e&&k(t),i?.(t)}function A(e){e.disabled||(void 0===n&&M(e.id),a?.(e.id,e))}return(0,ey.jsxs)("div",{"data-slot":"terminal-tab-group",className:(0,eI.cn)("vtl-surface-panel grid min-h-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",d?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",v),...b,children:[d&&(0,ey.jsxs)("div",{"data-slot":"terminal-tab-list",role:"tablist","aria-label":w.terminalList,className:(0,eI.cn)("flex min-w-0 items-center gap-1 border-b bg-muted/35 px-2 py-1.5",x),children:[(0,ey.jsx)(ds,{className:"ml-1 size-4 shrink-0 text-muted-foreground"}),(0,ey.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:S.map(e=>{let t=e.id===O?.id;return(0,ey.jsxs)("div",{className:(0,eI.cn)("group flex h-7 min-w-0 shrink-0 items-center rounded-md border border-transparent ui-text-control","transition-colors hover:bg-background/80",t?"bg-background text-foreground shadow-xs":"text-muted-foreground",e.disabled&&"pointer-events-none opacity-50"),children:[(0,ey.jsxs)("button",{type:"button",role:"tab","aria-selected":t,"aria-controls":`terminal-panel-${e.id}`,disabled:e.disabled,onClick:()=>A(e),className:"flex h-full min-w-0 items-center gap-1.5 rounded-md px-2 text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/20",children:[(0,ey.jsx)(Y1,{session:e}),(0,ey.jsx)("span",{className:"max-w-36 truncate",children:e.title}),e.shell&&(0,ey.jsx)("span",{className:"hidden text-muted-foreground ui-text-kbd sm:inline",children:e.shell})]}),e.closable&&(0,ey.jsx)("button",{type:"button","aria-label":w.closeTerminal(e.title),onClick:t=>{t.stopPropagation();l?.(e.id,e);let n=S.filter(t=>t.id!==e.id);if(P(n),e.id===E){let e=n.at(-1);e&&A(e)}},className:"mr-1 grid size-4 place-items-center rounded-sm text-muted-foreground opacity-0 outline-none transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/20 group-hover:opacity-100",children:(0,ey.jsx)(d3.XIcon,{className:"size-3"})})]},e.id)})}),f&&(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-xs","aria-label":w.newTerminal,onClick:function(){let e=o?.()??{id:`terminal-${Date.now()}`,title:`Terminal ${S.length+1}`,status:"idle",initialOutput:"",closable:!0};P([...S,e]),A(e)},className:"size-7 shrink-0",children:(0,ey.jsx)(lV,{className:"size-3.5"})})]}),(0,ey.jsx)("div",{"data-slot":"terminal-tab-panels",className:"relative min-h-0 overflow-hidden",children:S.map(e=>{let t=e.id===O?.id;return(0,ey.jsx)(Y5,{session:e,selected:t,terminalOptions:m,readOnly:h,localEcho:p,onSessionData:s,onSessionResize:c,onSessionReady:u,labels:w,terminalClassName:y},e.id)})})]})}function Y5({session:e,selected:t,terminalOptions:n,readOnly:r,localEcho:a,onSessionData:i,onSessionResize:o,onSessionReady:l,labels:s,terminalClassName:c}){let u=ew.useRef(null),d=ew.useRef(t);return ew.useEffect(()=>{if(t&&!d.current&&u.current){let e=u.current;requestAnimationFrame(()=>{e&&(e.fit(),e.terminal.refresh(0,e.terminal.rows-1),e.terminal.focus())})}d.current=t},[t]),(0,ey.jsx)("div",{id:`terminal-panel-${e.id}`,role:"tabpanel","aria-hidden":!t,"data-active":t,className:"absolute inset-0 min-h-0",style:{display:t?"block":"none"},children:(0,ey.jsx)(YQ,{initialOutput:e.initialOutput,options:{...n,...e.options},readOnly:r||e.disabled,localEcho:a,autoFocus:t,onData:t=>i?.(e.id,t),onResize:t=>o?.(e.id,t),onReady:t=>{u.current=t,l?.(e.id,t)},labels:s,terminalClassName:c})})}function Y4({className:e,scopeId:t,state:n,onStateChange:r}){let[a,i]=ew.useState([]),[o,l]=ew.useState([]),[s,c]=ew.useState(),[u,d]=ew.useState("local"),[f,h]=ew.useState(),[p,m]=ew.useState(!1),[g,v]=ew.useState(!1),x=ew.useRef(new Map),y=ew.useRef(new Map),b=ew.useRef(new Map),w=ew.useRef(new Map),j=ew.useRef(new Map),k=ew.useRef(new Map),S=ew.useRef(new Map),C=ew.useRef(new Map),N=ew.useRef(!1),M=ew.useRef(n?.autoStart===!1),E=ew.useRef(n),O=ew.useRef(r),P=Array.isArray(n?.sessionIds)?n.sessionIds.join("\0"):"__all__",A=t?.trim()||void 0,I=A??"__unscoped__";ew.useEffect(()=>{E.current=n},[n]),ew.useEffect(()=>{O.current=r},[r]);let z=a.find(e=>e.id===u)??a[0],_=z?.shells?.find(e=>e.id===f)??z?.shells?.[0],D=ew.useMemo(()=>o.map(e=>e.id),[o]),R=ew.useMemo(()=>o.filter(e=>e.aiControlled).map(e=>e.id),[o]),T=D.join("\0"),L=R.join("\0"),$=ew.useCallback((e,t)=>{let n=y.current.get(e);if(t){let t=j.current.get(e);void 0!==t&&(window.clearTimeout(t),j.current.delete(e))}n?.setCursorSuppressed(t)},[]),F=ew.useCallback(e=>{let t=j.current.get(e);void 0!==t&&window.clearTimeout(t);let n=window.setTimeout(()=>{j.current.delete(e),$(e,!1)},90);j.current.set(e,n)},[$]),B=ew.useCallback(e=>{let t=w.current.get(e),n=y.current.get(e);if(!t||!n||t.writing)return;if(!t.buffer){w.current.delete(e),F(e);return}void 0!==t.drainTimer&&(window.clearTimeout(t.drainTimer),t.drainTimer=void 0);let r=t.buffer.slice(0,65536);t.buffer=t.buffer.slice(r.length),t.writing=!0,$(e,!0);try{n.write(r,()=>{(t.writing=!1,y.current.has(e))?t.buffer?t.drainTimer=window.setTimeout(()=>B(e),0):(w.current.delete(e),F(e)):w.current.delete(e)})}catch{t.writing=!1,w.current.delete(e),F(e)}},[F,$]),V=ew.useCallback((e,t)=>{if(!t)return;if(!y.current.get(e))return void b.current.set(e,`${b.current.get(e)??""}${t}`);let n=w.current.get(e);(n||(n={buffer:"",writing:!1},w.current.set(e,n)),n.buffer+=t,$(e,!0),n.buffer.length>=65536)?B(e):n.writing||void 0!==n.drainTimer||(n.drainTimer=window.setTimeout(()=>B(e),8))},[B,$]),H=ew.useCallback((e,t)=>{(k.current.set(e,t.sequence),"output"===t.type&&t.data)?V(e,t.data):"status"===t.type&&t.status&&l(n=>n.map(n=>n.id===e?{...n,status:t.status??n.status,updatedAt:t.createdAt}:n))},[V]),W=ew.useCallback(e=>{if(x.current.has(e))return;let t=new EventSource(function(e,t=0){let n=new URLSearchParams;t>0&&n.set("after",String(t));let r=n.toString();return eD(`/api/local/terminals/sessions/${encodeURIComponent(e)}/events${r?`?${r}`:""}`)}(e,k.current.get(e)??0));t.onmessage=t=>{try{H(e,JSON.parse(t.data))}catch{return}},x.current.set(e,t)},[H]),U=ew.useCallback(async()=>{if(z&&!p){M.current=!1,m(!0);try{let e=await d0({machineId:z.id,scopeId:A,shell:_?.id,cwd:z.defaultCwd,cols:100,rows:30});l(t=>t.some(t=>t.id===e.id)?t:[...t,e]),c(e.id),W(e.id)}catch{return}finally{m(!1)}}},[p,W,z,_,A]);function q(e){let t=S.current.get(e);return t||(t={buffer:"",inFlight:!1},S.current.set(e,t)),t}return ew.useEffect(()=>{let e=!0;return v(!1),async function(){try{let t=E.current,n=t?.sessionIds,r=Array.isArray(n)?new Set(n):void 0,[a,o]=await Promise.all([dJ(),dQ(A)]);if(!e)return;let s=r?o.sessions.filter(e=>r.has(e.id)):o.sessions;N.current=!1,M.current=t?.autoStart===!1,i(a.machines),l(s),c(e=>{let n=t?.activeSessionId??e;return n&&s.some(e=>e.id===n)?n:s[0]?.id});let u=a.machines[0];if(u){let e=a.machines.find(e=>e.id===t?.selectedMachineId)??u;d(e.id),h(n=>t?.selectedShellId&&e.shells?.some(e=>e.id===t.selectedShellId)?t.selectedShellId:n&&e.shells?.some(e=>e.id===n)?n:e.shells?.[0]?.id)}}finally{e&&v(!0)}}(),()=>{e=!1}},[P,A,I]),ew.useEffect(()=>{g&&O.current?.({sessionIds:D,activeSessionId:s,selectedMachineId:u,selectedShellId:f,autoStart:!M.current,aiControlledSessionIds:R})},[s,R,L,g,u,f,D,T]),ew.useEffect(()=>{let e=new Set(D);for(let e of o)W(e.id);for(let[t,n]of x.current)e.has(t)||(n.close(),x.current.delete(t))},[W,D,o]),ew.useEffect(()=>{!g||N.current||M.current||o.length>0||0===a.length||(N.current=!0,U())},[U,g,a.length,o.length]),ew.useEffect(()=>()=>{for(let e of x.current.values())e.close();for(let e of S.current.values())void 0!==e.timer&&window.clearTimeout(e.timer);for(let e of w.current.values())void 0!==e.drainTimer&&window.clearTimeout(e.drainTimer);for(let[e,t]of j.current)window.clearTimeout(t),$(e,!1);S.current.clear(),w.current.clear(),j.current.clear()},[$]),(0,ey.jsxs)("div",{className:(0,eI.cn)("grid h-full min-h-0 w-full grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-[inherit] border bg-card",e),children:[(0,ey.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 border-b bg-muted/35 px-2 py-1.5",children:[(0,ey.jsxs)(go,{value:z?.id,onValueChange:e=>{d(e);let t=a.find(t=>t.id===e);h(t?.shells?.[0]?.id)},children:[(0,ey.jsxs)(gX,{size:"sm",className:"max-w-44",children:[(0,ey.jsx)(xw,{className:"size-3.5"}),(0,ey.jsx)(gu,{placeholder:"机器"})]}),(0,ey.jsx)(gJ,{align:"start",children:a.filter(e=>"online"===e.status).map(e=>(0,ey.jsx)(gQ,{value:e.id,children:e.name},e.id))})]}),(0,ey.jsxs)(go,{value:_?.id,onValueChange:h,children:[(0,ey.jsx)(gX,{size:"sm",className:"max-w-44",children:(0,ey.jsx)(gu,{placeholder:"Shell"})}),(0,ey.jsx)(gJ,{align:"start",children:z?.shells?.map(e=>(0,ey.jsx)(gQ,{value:e.id,children:e.name},e.id))})]}),(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"新建终端",disabled:!z||p,onClick:()=>void U(),className:"ml-auto",children:(0,ey.jsx)(lV,{className:"size-4"})})]}),(0,ey.jsx)(Y2,{sessions:o.map(Y3),activeSessionId:s,allowCreateSession:!1,localEcho:!1,labels:{loading:"启动终端...",terminalList:"终端会话",closeTerminal:e=>`关闭 ${e}`},onActiveSessionChange:e=>c(e),onCloseSession:e=>{let t,n,r;return x.current.get(e)?.close(),x.current.delete(e),y.current.delete(e),b.current.delete(e),t=w.current.get(e),t?.drainTimer!==void 0&&window.clearTimeout(t.drainTimer),w.current.delete(e),k.current.delete(e),void 0!==(n=j.current.get(e))&&(window.clearTimeout(n),j.current.delete(e)),r=S.current.get(e),void(r?.timer!==void 0&&window.clearTimeout(r.timer),S.current.delete(e),C.current.delete(e),l(t=>{let n=t.filter(t=>t.id!==e);return 0===n.length&&(M.current=!0),c(t=>t&&t!==e&&n.some(e=>e.id===t)?t:n[0]?.id),n}),d1(e).catch(()=>{}))},onSessionData:function(e,t){let n=q(e);n.buffer+=t,function e(t){let n=q(t);n.inFlight||void 0!==n.timer||(n.timer=window.setTimeout(()=>{n.timer=void 0,function(t){let n=S.current.get(t);if(!n||n.inFlight)return;let r=n.buffer;if(n.buffer="",!r){void 0===n.timer&&S.current.delete(t);return}n.inFlight=!0,d2(t,r).catch(()=>{}).finally(()=>{let n=S.current.get(t);n&&(n.inFlight=!1,n.buffer?e(t):void 0===n.timer&&S.current.delete(t))})}(t)},6))}(e)},onSessionResize:function(e,t){let n=`${t.cols}x${t.rows}`;C.current.get(e)!==n&&(C.current.set(e,n),d5(e,t).then(e=>{l(t=>t.map(t=>t.id===e.id?{...t,...e}:t))}).catch(()=>{}))},onSessionReady:function(e,t){y.current.set(e,t);let n=b.current.get(e);n&&(b.current.delete(e),V(e,n))},className:"min-h-0 rounded-none border-0"})]})}function Y3(e){return{id:e.id,title:e.title,shell:e.ordinal?`T${e.ordinal}`:"",cwd:e.cwd,status:function(e){switch(e){case"running":return"running";case"exited":case"closed":return"success";case"failed":return"error";default:return"idle"}}(e.status),closable:!0,initialOutput:"",aiControlled:e.aiControlled,controller:e.controller}}function Y6(e,t={}){let n="h-full min-h-0 w-full overflow-hidden rounded-[inherit]";switch(e.kind){case"file-tab-viewer":{let r=dj("file-tab-viewer"),a=e.file;if(!a&&t.onRequestFileTab)return(0,ey.jsx)(VY,{className:n,onChooseFile:t.onRequestFileTab});return(0,ey.jsx)(KP,{className:`${n} border-0`,file:a??r.file,value:e.defaultValue??r.defaultValue??"",defaultValue:e.defaultValue??r.defaultValue,view:e.defaultView,mode:e.defaultMode,modified:e.modified,onValueChange:n=>t.onTabChange?.({...e,defaultValue:n,modified:!0}),onViewChange:n=>t.onTabChange?.({...e,defaultView:n}),onModeChange:n=>t.onTabChange?.({...e,defaultMode:n}),onSave:t.onSaveFileTab?n=>t.onSaveFileTab?.(e,n):void 0,onHistory:()=>t.onOpenFileHistory?.(e),labels:{review:"审阅",edit:"编辑",view:"视图",code:"代码",preview:"预览",hex:"十六进制",actions:"文件菜单",save:"保存",saving:"保存中",history:"历史版本"}})}case"browser-tab-viewer":return(0,ey.jsx)(Hc,{className:`${n} border-0`,defaultUrl:e.defaultUrl??dj("browser-tab-viewer").defaultUrl});case"diff-tab-viewer":{let t=dj("diff-tab-viewer");return(0,ey.jsx)(WD,{className:`${n} border-0`,file:e.file??t.file,diff:e.diff??t.diff??""})}case"data-table-tab-viewer":{let r=dj("data-table-tab-viewer"),a=e.file;if(!a&&t.onRequestFileTab)return(0,ey.jsx)(VY,{className:n,onChooseFile:t.onRequestFileTab});return(0,ey.jsx)(WS,{className:`${n} border-0`,file:{name:a?.name??r.file?.name??"data",path:a?.path??r.file?.path,type:Y8(e)},source:void 0!==e.defaultValue?{type:Y8(e),content:e.defaultValue}:void 0,data:e.tableData??r.tableData??[]})}case"terminal-tab-group":return(0,ey.jsx)(Y4,{className:`${n} border-0`,scopeId:t.terminalScopeId,state:e.terminal??t.terminalState,onStateChange:t.onTerminalStateChange})}}function Y8(e){return`${e.file?.mimeType??""} ${e.file?.path??e.file?.name??""}`.toLowerCase().includes("json")?"json":"csv"}function Y7(e,t={}){let n="h-full min-h-0 w-full overflow-hidden rounded-[inherit]";switch(e){case"multi-tab-system":{let e=t.nodeId,r=void 0!==t.tabs?t.tabs:[];return(0,ey.jsx)(K_,{className:n,contentClassName:"min-h-0",tabs:r.map(n=>({id:n.id,title:n.title,meta:n.meta,modified:n.modified,icon:dw(n.kind),content:Y6(n,{terminalScopeId:e?`${t.terminalScopeId??`canvas:node:${e}`}:tab:${n.id}`:t.terminalScopeId,terminalState:n.terminal,onTerminalStateChange:r=>e?t.onTabChange?.(e,{...n,terminal:r}):void 0,onRequestFileTab:()=>t.onRequestFileTab?.({nodeId:e,insertIndex:r.length}),onTabChange:n=>{e&&t.onTabChange?.(e,n)},onSaveFileTab:(n,r)=>e?t.onSaveFileTab?.(e,n,r):void 0,onOpenFileHistory:n=>e?t.onOpenFileHistory?.(e,n):void 0})})),activeTabId:t.activeTabId,detachable:!0,externalDropTypes:[KR],createLabel:"打开文件",emptyContent:(0,ey.jsx)(VY,{onChooseFile:()=>t.onRequestFileTab?.({nodeId:e,insertIndex:r.length})}),onCreateTab:()=>{t.onRequestFileTab?.({nodeId:e,insertIndex:r.length})},onActiveTabChange:n=>{e&&t.onActiveTabChange?.(e,n)},onTabsChange:n=>{if(!e)return;let a=n.map(e=>r.find(t=>t.id===e.id)).filter(e=>!!e);t.onTabsChange?.(e,a)},onTabDetach:(n,a)=>{if(!e)return!1;let i=r.find(e=>e.id===n.id);return!!i&&t.onTabDetach?.(e,i,{clientX:a.clientX,clientY:a.clientY})},onExternalTabDrop:({insertIndex:n,nativeEvent:r})=>{e&&t.onExternalTabDrop?.(e,n,r)}})}case"file-tree-panel":if(t.workspaceFolders)return(0,ey.jsx)(VG,{folders:t.workspaceFolders,className:`${n} max-w-none`,onOpenFile:t.onOpenWorkspaceFile});return(0,ey.jsx)(Ga,{className:`${n} max-w-none`,onOpenFile:t.onOpenWorkspaceFile});case"process-management":return(0,ey.jsx)(YV,{className:`${n} rounded-[inherit] border-0`});case"machine-performance":return(0,ey.jsx)(YH,{className:`${n} rounded-[inherit] border-0`});case"firewall-policy-workspace":return(0,ey.jsx)("div",{className:`${n} bg-card`,children:(0,ey.jsx)(Gt,{})});case"machine-file-management":return(0,ey.jsx)(GI,{className:`${n} bg-card`});case"agent-conversation-panel":return(0,ey.jsx)(Vv,{className:`${n} vtl-canvas-agent-conversation-node`,composerClassName:"max-w-[42rem]"});case"file-tab-viewer":case"browser-tab-viewer":case"diff-tab-viewer":case"data-table-tab-viewer":case"terminal-tab-group":return Y6(t.tab??dj(e,`${e}-tab`),{terminalState:t.terminalState,terminalScopeId:t.terminalScopeId,onTerminalStateChange:t.onTerminalStateChange,onRequestFileTab:()=>t.onRequestFileTab?.({nodeId:t.nodeId}),onTabChange:e=>{t.nodeId&&t.onTabChange?.(t.nodeId,e)},onSaveFileTab:(e,n)=>t.nodeId?t.onSaveFileTab?.(t.nodeId,e,n):void 0,onOpenFileHistory:e=>t.nodeId?t.onOpenFileHistory?.(t.nodeId,e):void 0})}}function Y9({kind:e,...t}){return Y7(e,t)}let Ze="application/vnd.vantaloom.agent-pane-shredder",Zt="application/vnd.vantaloom.agent-pane-cutter";function Zn(e,t){return(e?.activeSessionId??"")===(t.activeSessionId??"")&&(e?.selectedMachineId??"")===(t.selectedMachineId??"")&&(e?.selectedShellId??"")===(t.selectedShellId??"")&&(e?.autoStart??!0)===(t.autoStart??!0)&&(e?.sessionIds??[]).join("\0")===t.sessionIds.join("\0")&&(e?.aiControlledSessionIds??[]).join("\0")===(t.aiControlledSessionIds??[]).join("\0")}let Zr=[{id:"quad",label:"四分",slots:4,icon:(0,ey.jsx)(xb,{})},{id:"vertical-split",label:"上下二分",slots:2,icon:(0,ey.jsx)(V9,{})},{id:"horizontal-split",label:"左右二分",slots:2,icon:(0,ey.jsx)(V5,{})},{id:"left-two-right-one",label:"左二右一",slots:3,icon:(0,ey.jsx)(sW,{})},{id:"left-one-right-two",label:"左一右二",slots:3,icon:(0,ey.jsx)(sU,{})},{id:"top-two-bottom-one",label:"上二下一",slots:3,icon:(0,ey.jsx)(V9,{})},{id:"top-one-bottom-two",label:"上一下二",slots:3,icon:(0,ey.jsx)(V7,{})},{id:"single",label:"整窗口",slots:1,icon:(0,ey.jsx)(V8,{})}];function Za(e,t,n=[50,50]){let r=e?.[t],a=r?.[0],i=r?.[1];return["number"==typeof a&&a>0?a:n[0],"number"==typeof i&&i>0?i:n[1]]}function Zi(e,t){return{[e[0]]:t[0],[e[1]]:t[1]}}function Zo(e,t){return[e[t[0]]??50,e[t[1]]??50]}function Zl({mode:e,sizes:t,onSizeGroupChange:n,children:r}){if("single"===e)return(0,ey.jsx)("div",{className:"size-full min-h-0",children:r[0]});if("horizontal-split"===e){let e=Za(t,"outer"),a=["pane-0","pane-1"];return(0,ey.jsxs)(ht,{direction:"horizontal",defaultLayout:Zi(a,e),onLayoutChanged:e=>n?.("outer",Zo(e,a)),children:[(0,ey.jsx)(hn,{id:a[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:a[1],defaultSize:e[1],minSize:24,children:r[1]})]})}if("vertical-split"===e){let e=Za(t,"outer"),a=["pane-0","pane-1"];return(0,ey.jsxs)(ht,{direction:"vertical",defaultLayout:Zi(a,e),onLayoutChanged:e=>n?.("outer",Zo(e,a)),children:[(0,ey.jsx)(hn,{id:a[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:a[1],defaultSize:e[1],minSize:24,children:r[1]})]})}if("left-two-right-one"===e){let e=Za(t,"outer",[58,42]),a=Za(t,"left"),i=["left","right"],o=["pane-0","pane-1"];return(0,ey.jsxs)(ht,{direction:"horizontal",defaultLayout:Zi(i,e),onLayoutChanged:e=>n?.("outer",Zo(e,i)),children:[(0,ey.jsx)(hn,{id:i[0],defaultSize:e[0],minSize:24,children:(0,ey.jsxs)(ht,{direction:"vertical",defaultLayout:Zi(o,a),onLayoutChanged:e=>n?.("left",Zo(e,o)),children:[(0,ey.jsx)(hn,{id:o[0],defaultSize:a[0],minSize:20,children:r[0]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:o[1],defaultSize:a[1],minSize:20,children:r[1]})]})}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:i[1],defaultSize:e[1],minSize:24,children:r[2]})]})}if("left-one-right-two"===e){let e=Za(t,"outer",[42,58]),a=Za(t,"right"),i=["left","right"],o=["pane-1","pane-2"];return(0,ey.jsxs)(ht,{direction:"horizontal",defaultLayout:Zi(i,e),onLayoutChanged:e=>n?.("outer",Zo(e,i)),children:[(0,ey.jsx)(hn,{id:i[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:i[1],defaultSize:e[1],minSize:24,children:(0,ey.jsxs)(ht,{direction:"vertical",defaultLayout:Zi(o,a),onLayoutChanged:e=>n?.("right",Zo(e,o)),children:[(0,ey.jsx)(hn,{id:o[0],defaultSize:a[0],minSize:20,children:r[1]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:o[1],defaultSize:a[1],minSize:20,children:r[2]})]})})]})}if("top-two-bottom-one"===e){let e=Za(t,"outer",[58,42]),a=Za(t,"top"),i=["top","bottom"],o=["pane-0","pane-1"];return(0,ey.jsxs)(ht,{direction:"vertical",defaultLayout:Zi(i,e),onLayoutChanged:e=>n?.("outer",Zo(e,i)),children:[(0,ey.jsx)(hn,{id:i[0],defaultSize:e[0],minSize:24,children:(0,ey.jsxs)(ht,{direction:"horizontal",defaultLayout:Zi(o,a),onLayoutChanged:e=>n?.("top",Zo(e,o)),children:[(0,ey.jsx)(hn,{id:o[0],defaultSize:a[0],minSize:24,children:r[0]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:o[1],defaultSize:a[1],minSize:24,children:r[1]})]})}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:i[1],defaultSize:e[1],minSize:24,children:r[2]})]})}if("top-one-bottom-two"===e){let e=Za(t,"outer",[42,58]),a=Za(t,"bottom"),i=["top","bottom"],o=["pane-1","pane-2"];return(0,ey.jsxs)(ht,{direction:"vertical",defaultLayout:Zi(i,e),onLayoutChanged:e=>n?.("outer",Zo(e,i)),children:[(0,ey.jsx)(hn,{id:i[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:i[1],defaultSize:e[1],minSize:24,children:(0,ey.jsxs)(ht,{direction:"horizontal",defaultLayout:Zi(o,a),onLayoutChanged:e=>n?.("bottom",Zo(e,o)),children:[(0,ey.jsx)(hn,{id:o[0],defaultSize:a[0],minSize:24,children:r[1]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:o[1],defaultSize:a[1],minSize:24,children:r[2]})]})})]})}let a=Za(t,"outer"),i=Za(t,"left"),o=Za(t,"right"),l=["left","right"],s=["pane-0","pane-2"],c=["pane-1","pane-3"];return(0,ey.jsxs)(ht,{direction:"horizontal",defaultLayout:Zi(l,a),onLayoutChanged:e=>n?.("outer",Zo(e,l)),children:[(0,ey.jsx)(hn,{id:l[0],defaultSize:a[0],minSize:24,children:(0,ey.jsxs)(ht,{direction:"vertical",defaultLayout:Zi(s,i),onLayoutChanged:e=>n?.("left",Zo(e,s)),children:[(0,ey.jsx)(hn,{id:s[0],defaultSize:i[0],minSize:20,children:r[0]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:s[1],defaultSize:i[1],minSize:20,children:r[2]})]})}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:l[1],defaultSize:a[1],minSize:24,children:(0,ey.jsxs)(ht,{direction:"vertical",defaultLayout:Zi(c,o),onLayoutChanged:e=>n?.("right",Zo(e,c)),children:[(0,ey.jsx)(hn,{id:c[0],defaultSize:o[0],minSize:20,children:r[1]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:c[1],defaultSize:o[1],minSize:20,children:r[3]})]})})]})}function Zs({conversationId:e,index:t,content:n,clipboardItems:r,clipboardDraggingId:a,onAdd:i,onPanelDrop:o,onContentChange:l,onClear:s,onCut:c,workspaceFolders:u,onRequestFileTab:d,onOpenWorkspaceFile:f,onSaveFileTab:h,onOpenFileHistory:p}){let[m,g]=ew.useState();return(0,ey.jsx)("div",{"data-agent-pane":t,className:(0,eI.cn)("relative size-full min-h-0 min-w-0 overflow-hidden",n?.kind!=="subagent-conversation-panel"&&"bg-background","vtl-agent-workspace-pane",n?.kind==="subagent-conversation-panel"&&"vtl-agent-workspace-conversation-pane bg-transparent","panel"===m&&"ring-2 ring-foreground/60 ring-inset","shredder"===m&&"ring-2 ring-destructive/70 ring-inset","cutter"===m&&"ring-2 ring-amber-500/70 ring-inset"),onDragOver:e=>{let t=Array.from(e.dataTransfer.types);if(t.includes(Zt)){e.preventDefault(),e.dataTransfer.dropEffect="move",g("cutter");return}if(t.includes(Ze)){e.preventDefault(),e.dataTransfer.dropEffect="move",g("shredder");return}t.includes(wU)&&(e.preventDefault(),e.dataTransfer.dropEffect="move",g("panel"))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||g(void 0)},onDrop:e=>{if(Array.from(e.dataTransfer.types).includes(Zt)){e.preventDefault(),e.stopPropagation(),g(void 0),c(t);return}if(Array.from(e.dataTransfer.types).includes(Ze)){e.preventDefault(),e.stopPropagation(),g(void 0),s(t);return}let n=function(e){let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id"),n=r.find(e=>e.id===t),a=n?n.payloads?.[wU]:void 0;if(n&&a)return{item:n,content:a.content};let i=e.dataTransfer.getData(wU);if(i)try{let e=JSON.parse(i);return n&&e.content?{item:n,content:e.content}:void 0}catch{return}}(e);n&&(e.preventDefault(),e.stopPropagation(),g(void 0),o(t,n.item,n.content))},children:n?(0,ey.jsx)("div",{className:(0,eI.cn)("size-full min-h-0 min-w-0 overflow-hidden rounded-none","vtl-agent-pane-content","subagent-conversation-panel"===n.kind&&"vtl-agent-pane-conversation-content",a&&"pointer-events-none"),children:wW(n)?Y7(n.kind,{tab:n.tab,terminalScopeId:e?`agent:${e}:pane:${n.id}`:void 0,terminalState:n.terminal,onTerminalStateChange:e=>{Zn(n.terminal,e)||l(t,{...n,terminal:e})},workspaceFolders:u,nodeId:n.id,tabs:n.tabs,activeTabId:n.activeTabId,onRequestFileTab:({insertIndex:e})=>d?.(t,e),onOpenWorkspaceFile:f,onTabsChange:(e,r)=>{l(t,{...n,tabs:r,activeTabId:r.some(e=>e.id===n.activeTabId)?n.activeTabId:r[0]?.id})},onTabChange:(e,r)=>{"multi-tab-system"===n.kind?l(t,{...n,tabs:(n.tabs??[]).map(e=>e.id===r.id?r:e),activeTabId:r.id}):l(t,{...n,title:r.title,tab:r})},onSaveFileTab:(e,n,r)=>h?.(t,n,r),onOpenFileHistory:(e,n)=>p?.(t,n),onActiveTabChange:(e,r)=>{l(t,{...n,activeTabId:r})}}):(0,ey.jsx)(Vv,{className:"size-full min-h-0",composerClassName:"max-w-[42.5rem]",initialEvents:n.events},n.id)},n.id):(0,ey.jsx)("div",{className:"vtl-agent-pane-empty grid size-full place-items-center p-4",children:(0,ey.jsxs)(eA.Button,{type:"button",variant:"outline",size:"sm",className:"rounded-full bg-background/90",onClick:i,"data-tour":"pane-add",children:[(0,ey.jsx)(lV,{className:"size-4"}),"添加"]})})})}function Zc({open:e,onOpenChange:t,onAdd:n}){return(0,ey.jsx)(vE,{open:e,onOpenChange:t,title:"添加工作区组件",description:"选择一个组件填入当前窗口。",className:"top-1/2 max-w-xl -translate-y-1/2",children:(0,ey.jsxs)(vM,{loop:!0,children:[(0,ey.jsx)(vO,{placeholder:"搜索组件..."}),(0,ey.jsxs)(vP,{children:[(0,ey.jsx)(vA,{children:"没有匹配组件。"}),(0,ey.jsx)(vI,{heading:"可放入窗口",children:wB.map(e=>(0,ey.jsxs)(vz,{"data-tour":`pane-template-${e.id}`,value:`${e.title} ${e.description} ${e.keywords}`,onSelect:()=>n(e.id),children:[(0,ey.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg border bg-background text-muted-foreground",children:e.icon}),(0,ey.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,ey.jsx)("span",{className:"block truncate text-sm font-medium",children:e.title}),(0,ey.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,ey.jsx)(v_,{children:"添加"})]},e.id))})]})]})})}function Zu({content:e,index:t,conversationId:n,workspaceFolders:r,onContentChange:a,onOpenWorkspaceFile:i,onSaveFileTab:o,onOpenFileHistory:l,onRequestFileTab:s}){return wW(e)?Y7(e.kind,{tab:e.tab,terminalScopeId:n?`agent:${n}:pane:${e.id}`:void 0,terminalState:e.terminal,onTerminalStateChange:n=>{Zn(e.terminal,n)||a(t,{...e,terminal:n})},workspaceFolders:r,nodeId:e.id,tabs:e.tabs,activeTabId:e.activeTabId,onRequestFileTab:({insertIndex:e})=>s?.(t,e),onOpenWorkspaceFile:i,onTabsChange:(n,r)=>{a(t,{...e,tabs:r,activeTabId:r.some(t=>t.id===e.activeTabId)?e.activeTabId:r[0]?.id})},onTabChange:(n,r)=>{"multi-tab-system"===e.kind?a(t,{...e,tabs:(e.tabs??[]).map(e=>e.id===r.id?r:e),activeTabId:r.id}):a(t,{...e,title:r.title,tab:r})},onSaveFileTab:(e,n,r)=>o?.(t,n,r),onOpenFileHistory:(e,n)=>l?.(t,n),onActiveTabChange:(n,r)=>{a(t,{...e,activeTabId:r})}}):(0,ey.jsx)(Vv,{className:"size-full min-h-0",composerClassName:"max-w-[42.5rem]",initialEvents:e.events},e.id)}let Zd=[{kind:"browser-tab-viewer",label:"预览窗口",icon:(0,ey.jsx)(V6,{})},{kind:"diff-tab-viewer",label:"Diff 栏",icon:(0,ey.jsx)(V4,{})},{kind:"terminal-tab-group",label:"终端窗口",icon:(0,ey.jsx)(ds,{})},{kind:"file-tree-panel",label:"文件树",icon:(0,ey.jsx)(V3,{})},{kind:"file-tab-viewer",label:"文件窗口",icon:(0,ey.jsx)(xg,{})}];function Zf({conversationId:e,panes:t,agentSide:n,columns:r,heights:a,onColumnsChange:i,onHeightsChange:o,onAddCard:l,onContentChange:s,onClear:c,workspaceFolders:u,onOpenWorkspaceFile:d,onSaveFileTab:f,onOpenFileHistory:h,onRequestFileTab:p}){let m=t.map((e,t)=>({content:e,index:t})).filter(e=>!!e.content),g=new Map(m.map(e=>[e.content.id,e])),v=m.map(e=>e.content.id).join("|"),x="left"===n,y=ew.useRef(0);0===y.current&&r.length>0&&(y.current=r.reduce((e,t)=>{let n=/^col-(\d+)/.exec(t.key);return n?Math.max(e,Number(n[1])):e},0));let b=ew.useCallback(()=>`col-${y.current+=1}`,[]),w=e=>i("function"==typeof e?e(r):e),[j,k]=ew.useState(null),[S,C]=ew.useState(null);ew.useEffect(()=>{w(e=>{let t=new Set(m.map(e=>e.content.id)),n=e.map(e=>({...e,cardIds:e.cardIds.filter(e=>t.has(e))})).filter(e=>e.cardIds.length>0),r=new Set(n.flatMap(e=>e.cardIds)),a=m.map(e=>e.content.id).filter(e=>!r.has(e));return a.length>0&&(n=0===n.length?[{key:b(),width:360,cardIds:[...a]}]:n.map((e,t)=>0===t?{...e,cardIds:[...e.cardIds,...a]}:e)),!function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){let r=e[n],a=t[n];if(!r||!a||r.key!==a.key||r.width!==a.width||r.cardIds.length!==a.cardIds.length)return!1;for(let e=0;e<r.cardIds.length;e+=1)if(r.cardIds[e]!==a.cardIds[e])return!1}return!0}(e,n)?n:e})},[v,b]);let N=e=>a[e]??320;function M(e,t){k(null),C(null),j&&j!==e&&w(n=>{let r=n.map(e=>({...e,cardIds:[...e.cardIds]}));for(let e of r){let t=e.cardIds.indexOf(j);t>=0&&e.cardIds.splice(t,1)}let a=-1,i=-1;r.forEach((t,n)=>{let r=t.cardIds.indexOf(e);r>=0&&(a=n,i=r)});let o=r[a];if(!o)return n;if("top"===t||"bottom"===t)o.cardIds.splice("top"===t?i:i+1,0,j);else{let e=(x?"right"===t:"left"===t)?a:a+1;r.splice(e,0,{key:b(),width:r[a]?.width??360,cardIds:[j]})}return r.filter(e=>e.cardIds.length>0)})}let E=r.map((e,t)=>({column:e,realIndex:t}));x&&E.reverse();let O=(0,ey.jsx)("div",{className:(0,eI.cn)("flex shrink-0 px-3 py-2",x?"justify-end":"justify-start"),children:(0,ey.jsxs)(y2,{children:[(0,ey.jsx)(y4,{asChild:!0,children:(0,ey.jsxs)(eA.Button,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",children:[(0,ey.jsx)(lV,{className:"size-4"}),"添加窗口",(0,ey.jsx)(gK,{className:"size-3.5 text-muted-foreground"})]})}),(0,ey.jsx)(bl,{align:x?"end":"start",sideOffset:6,className:"min-w-40",children:Zd.map(e=>(0,ey.jsxs)(bs,{onSelect:()=>l(e.kind),children:[e.icon,(0,ey.jsx)("span",{className:"flex-1",children:e.label})]},e.kind))})]})});return 0===m.length?(0,ey.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[O,(0,ey.jsx)("div",{className:"grid flex-1 place-items-center px-4 pb-6",children:(0,ey.jsx)("p",{className:"max-w-[15rem] text-center text-sm text-muted-foreground",children:"从“添加窗口”放入预览、Diff、终端、文件树或文件窗口; Agent 编辑/阅读文件或运行终端时也会自动填入对应卡片。"})})]}):(0,ey.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[O,(0,ey.jsx)("div",{className:"min-h-0 flex-1 overflow-auto px-3 pb-3",children:(0,ey.jsx)("div",{className:"flex min-h-full items-start gap-3",children:E.map(({column:t})=>{let n=t.cardIds[t.cardIds.length-1];return(0,ey.jsxs)("div",{className:"group/col relative flex shrink-0 flex-col gap-3",style:{width:t.width},children:[t.cardIds.map(t=>{let n=g.get(t);if(!n)return null;let{content:r,index:i}=n;return(0,ey.jsxs)("div",{style:{height:N(r.id)},className:(0,eI.cn)("group/card relative flex w-full shrink-0 flex-col overflow-hidden rounded-xl border border-border bg-background shadow-sm",j===r.id?"opacity-50":"opacity-100"),children:[(0,ey.jsxs)("div",{draggable:!0,onDragStart:e=>{k(r.id),e.dataTransfer.effectAllowed="move",e.dataTransfer.setData("text/plain",r.id)},onDragEnd:()=>{k(null),C(null)},className:"flex shrink-0 cursor-grab items-center justify-between gap-2 border-b border-border/60 px-2.5 py-1.5 active:cursor-grabbing",children:[(0,ey.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,ey.jsx)(ft,{className:"size-3.5 shrink-0 text-muted-foreground/60"}),(0,ey.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:r.title})]}),(0,ey.jsx)("button",{type:"button",onClick:()=>c(i),"aria-label":"关闭窗口",title:"关闭窗口",className:"grid size-5 shrink-0 place-items-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground [&_svg]:size-3.5",children:(0,ey.jsx)(d3.XIcon,{})})]}),(0,ey.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:(0,ey.jsx)(Zu,{content:r,index:i,conversationId:e,workspaceFolders:u,onContentChange:s,onOpenWorkspaceFile:d,onSaveFileTab:f,onOpenFileHistory:h,onRequestFileTab:p})}),(0,ey.jsx)("div",{onPointerDown:e=>(function(e,t){t.preventDefault(),t.stopPropagation();let n=t.clientY,r=N(e);function i(t){let i,l=Math.max(140,r+(t.clientY-n));o("function"==typeof(i=t=>({...t,[e]:l}))?i(a):i)}window.addEventListener("pointermove",i),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",e)})})(r.id,e),"aria-hidden":!0,className:"absolute inset-x-0 bottom-0 z-10 flex h-3 translate-y-1/2 cursor-ns-resize items-center justify-center",children:(0,ey.jsx)("span",{className:"h-1 w-10 rounded-full bg-primary/50 opacity-0 transition-opacity group-hover/card:opacity-100"})}),j&&j!==r.id?(0,ey.jsxs)("div",{className:"absolute inset-0 z-20",children:[["top","bottom","left","right"].map(e=>(0,ey.jsx)("div",{onDragOver:t=>{t.preventDefault(),C({id:r.id,edge:e})},onDrop:t=>{t.preventDefault(),t.stopPropagation(),M(r.id,e)},className:(0,eI.cn)("absolute","top"===e&&"inset-x-0 top-0 h-1/3","bottom"===e&&"inset-x-0 bottom-0 h-1/3","left"===e&&"bottom-1/3 left-0 top-1/3 w-1/3","right"===e&&"bottom-1/3 right-0 top-1/3 w-1/3")},e)),S?.id===r.id?(0,ey.jsx)("div",{"aria-hidden":!0,className:(0,eI.cn)("pointer-events-none absolute rounded bg-primary/70","top"===S.edge&&"inset-x-2 top-1 h-1.5","bottom"===S.edge&&"inset-x-2 bottom-1 h-1.5","left"===S.edge&&"inset-y-2 left-1 w-1.5","right"===S.edge&&"inset-y-2 right-1 w-1.5")}):null]}):null]},r.id)}),j&&n?(0,ey.jsx)("div",{onDragOver:e=>{e.preventDefault(),C({id:n,edge:"bottom"})},onDrop:e=>{e.preventDefault(),M(n,"bottom")},className:"min-h-16 rounded-lg border border-dashed border-primary/40"}):null,(0,ey.jsx)("div",{onPointerDown:e=>(function(e,t){t.preventDefault(),t.stopPropagation();let n=t.clientX,a=r.find(t=>t.key===e)?.width??360,i=x?-1:1;function o(t){let r=Math.min(760,Math.max(240,a+(t.clientX-n)*i));w(t=>t.map(t=>t.key===e?{...t,width:r}:t))}window.addEventListener("pointermove",o),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",o),window.removeEventListener("pointerup",e)})})(t.key,e),"aria-hidden":!0,className:(0,eI.cn)("absolute top-0 z-10 flex h-full w-3 cursor-ew-resize items-center justify-center",x?"left-0 -translate-x-1/2":"right-0 translate-x-1/2"),children:(0,ey.jsx)("span",{className:"h-10 w-1 rounded-full bg-primary/50 opacity-0 transition-opacity group-hover/col:opacity-100"})})]},t.key)})})})]})}let Zh="vtl:workspace-layout-mode",Zp="vtl:workspace-agent-side",Zm="vtl:workspace-layout-changed",Zg={mode:"pane",agentSide:"left"};function Zv(){let e=Zg.mode,t=Zg.agentSide;try{let n=window.localStorage.getItem(Zh);("pane"===n||"card"===n||"control-room"===n)&&(e=n);let r=window.localStorage.getItem(Zp);("left"===r||"right"===r)&&(t=r)}catch{}return{mode:e,agentSide:t}}function Zx(e){try{e.mode&&window.localStorage.setItem(Zh,e.mode),e.agentSide&&window.localStorage.setItem(Zp,e.agentSide)}catch{}window.dispatchEvent(new CustomEvent(Zm))}function Zy({stack:e,rootTitle:t,rootOwnerMachineId:n,onNavigateRoot:r,onNavigateIndex:a,onOpenSubagent:i}){let o=e[e.length-1],[l,s]=ew.useState(null);if(ew.useEffect(()=>{let e;if(!o)return;let t=!1;async function r(){try{let a=await sw(o.id,n);if(t)return;s(a);let i="working"===a.conversation.status||!!a.conversation.running;e=window.setTimeout(r,i?900:5e3)}catch{if(t)return;e=window.setTimeout(r,3e3)}}return s(null),r(),()=>{t=!0,e&&window.clearTimeout(e)}},[o,n]),!o)return null;let c=l?.conversation.status??"working",u="working"===c||!!l?.conversation.running;return(0,ey.jsxs)("div",{className:"absolute inset-0 z-30 flex flex-col bg-background",children:[(0,ey.jsxs)("div",{className:"flex h-9 shrink-0 items-center gap-1 overflow-x-auto border-b px-2 text-xs",children:[(0,ey.jsx)("button",{type:"button",className:"shrink-0 rounded px-1.5 py-0.5 text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",onClick:r,children:t||"主对话"}),e.map((t,n)=>{let r=Vi(t.subagentType),i=n===e.length-1,o=r.Icon;return(0,ey.jsxs)(ew.Fragment,{children:[(0,ey.jsx)(pC,{className:"size-3 shrink-0 text-muted-foreground/60"}),(0,ey.jsxs)("button",{type:"button",className:(0,eI.cn)("flex shrink-0 items-center gap-1 rounded px-1.5 py-0.5 transition-colors hover:bg-accent/50",i?"font-medium text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>a(n),children:[(0,ey.jsx)(o,{className:(0,eI.cn)("size-3",r.color)}),(0,ey.jsx)("span",{className:"max-w-[10rem] truncate",children:t.name||`${r.label}子代理`})]})]},t.id)}),(0,ey.jsx)("span",{className:"ml-auto shrink-0 pl-2",children:u?(0,ey.jsxs)("span",{className:"flex items-center gap-1 text-muted-foreground",children:[(0,ey.jsx)(eM,{className:"size-3 animate-spin"}),"运行中"]}):"paused"===c?(0,ey.jsxs)("span",{className:"flex items-center gap-1 text-destructive",children:[(0,ey.jsx)(ho,{className:"size-3"}),"已暂停"]}):(0,ey.jsxs)("span",{className:"flex items-center gap-1 text-emerald-600 dark:text-emerald-500",children:[(0,ey.jsx)(eO,{className:"size-3"}),"完成"]})})]}),(0,ey.jsx)("div",{className:"relative min-h-0 flex-1",children:l?(0,ey.jsx)(BQ,{events:l.events,bottomInset:16,contentClassName:"max-w-[42.5rem]",onOpenSubagent:e=>i(e),labels:{recall:"召回",branch:"分支",expand:"展开",collapse:"收起",completed:"完成",thinking:"运行中"}}):(0,ey.jsxs)("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:[(0,ey.jsx)(eM,{className:"mr-2 size-4 animate-spin"}),"正在打开子代理对话…"]})})]})}let Zb=[],Zw="vantaloom:file-system-changed";function Zj(e){var t;let n=(t=e?.layoutMode,Zr.some(e=>e.id===t)?t:"quad"),r="right"===e?.agentPosition?"right":"left",a=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return{};let t=e.shell&&"object"==typeof e.shell&&!Array.isArray(e.shell)?e.shell:void 0,n={};for(let e of["agent","panes"]){let r=t?.[e];"number"==typeof r&&Number.isFinite(r)&&r>0&&(n[e]=r)}return{...Object.keys(n).length?{shell:n}:{},outer:Zk(e.outer),left:Zk(e.left),right:Zk(e.right),top:Zk(e.top),bottom:Zk(e.bottom)}}(e?.sizes),i=Array.from({length:Math.max(4,Zr.find(e=>e.id===n)?.slots??4)},()=>void 0);for(let[t,n]of(e?.panes??[]).entries()){let e=Number.isInteger(n.slot)?n.slot:t;e<0||e>=i.length||(i[e]=function(e,t){var n,r;let a=e.paneId||`${e.kind}-${t+1}`,i=!(n=e.props)||"object"!=typeof n||Array.isArray(n)?{}:n;if("subagent-conversation-panel"===e.kind)return{id:a,kind:"subagent-conversation-panel",title:ZC(i.title)??"Subagent",subagentId:ZC(i.subagentId)??a,events:Array.isArray(i.events)?i.events:[]};if(!wV(e.kind))return;let o=i.tab&&"object"==typeof i.tab?i.tab:void 0,l=Array.isArray(i.tabs)?i.tabs.filter(e=>db(e?.kind)):void 0,s=wV(e.kind);return{id:a,kind:e.kind,title:ZC(i.title)??o?.title??s?.title??"组件",tab:o,tabs:l,activeTabId:ZC(i.activeTabId),terminal:"terminal-tab-group"===e.kind?!(r=i.terminal)||"object"!=typeof r||Array.isArray(r)?{sessionIds:[]}:{sessionIds:Array.isArray(r.sessionIds)?r.sessionIds.filter(e=>"string"==typeof e):[],activeSessionId:ZC(r.activeSessionId),selectedMachineId:ZC(r.selectedMachineId),selectedShellId:ZC(r.selectedShellId),autoStart:"boolean"==typeof r.autoStart?r.autoStart:void 0,aiControlledSessionIds:Array.isArray(r.aiControlledSessionIds)?r.aiControlledSessionIds.filter(e=>"string"==typeof e):void 0}:void 0}}(n,t))}return{layoutMode:n,agentPosition:r,layoutSizes:a,panes:i,cardColumns:Array.isArray(e?.cardLayout?.columns)?e.cardLayout.columns.filter(e=>e&&"string"==typeof e.key&&Array.isArray(e.cardIds)).map(e=>({key:e.key,width:"number"==typeof e.width&&e.width>0?e.width:360,cardIds:e.cardIds.filter(e=>"string"==typeof e)})):[],cardHeights:e?.cardLayout?.heights&&"object"==typeof e.cardLayout.heights?e.cardLayout.heights:{}}}function Zk(e){if(!Array.isArray(e))return;let t=e.filter(e=>"number"==typeof e&&Number.isFinite(e)&&e>0);return t.length?t:void 0}function ZS(e){return e.filter(e=>"number"==typeof e&&Number.isFinite(e)&&e>0)}function ZC(e){return"string"==typeof e&&e.trim()?e:void 0}function ZN(e){let t=e?.id.match(/-(\d+)$/);return t?Number(t[1]):0}function ZM(e){return e.reduce((e,t)=>Math.max(e,ZN(t)),0)}function ZE({conversation:e,clipboardItems:t,clipboardDraggingId:n,onClipboardItemsChange:r,onClipboardDraggingChange:a,onOverlayOpenChange:i,onConversationCreated:o,onCancelDraft:l,subagentStack:s=[],onSubagentStackChange:c,subagentTree:u=[],mobileView:d="conversation",onMobilePaneCountChange:f}){let h=su(),p=ew.useRef(null),m=Zj(e?.panes),[g,v]=ew.useState(m.layoutMode),[x,y]=ew.useState(m.agentPosition),b=function(){let[e,t]=ew.useState(Zg);return ew.useEffect(()=>{t(Zv());let e=()=>t(Zv());return window.addEventListener(Zm,e),window.addEventListener("storage",e),()=>{window.removeEventListener(Zm,e),window.removeEventListener("storage",e)}},[]),e}(),w="card"===b.mode,[j,k]=ew.useState(!1),[S,C]=ew.useState(m.layoutSizes),[N,M]=ew.useState(()=>m.panes),[E,O]=ew.useState(()=>m.cardColumns),[P,A]=ew.useState(()=>m.cardHeights),[I,z]=ew.useState(()=>e?.events??[]),[_,D]=ew.useState(new Set),[R,T]=ew.useState(void 0),[L,$]=ew.useState(()=>V2(e?.conversation.id)),F=ew.useCallback(t=>{$(t),function(e,t){if(e)try{if(!t)return void window.localStorage.removeItem(V1(e));window.localStorage.setItem(V1(e),t.slice(0,1e5))}catch{}}(e?.conversation.id,t)},[e?.conversation.id]),[B,V]=ew.useState([]),[H,W]=ew.useState(void 0),[U,q]=ew.useState(!1),[K,G]=ew.useState(!1),[X,Y]=ew.useState(""),[Z,J]=ew.useState(e?.conversation.status==="working"),[Q,ee]=ew.useState(e?.conversation.status??"idle"),[et,en]=ew.useState(e?.conversation.settings?.permissionMode??"acceptEdits"),[er,ea]=ew.useState([]),[ei,eo]=ew.useState(e?.conversation.tokens??0),[el,es]=ew.useState(e?.conversation.runUsage),[ec,eu]=ew.useState(e?.conversation.contextTokens??0),[ed,ef]=ew.useState(!1),eh=ew.useRef(Q),[ep,em]=ew.useState(),[eg,ev]=ew.useState(),[ex,eb]=ew.useState(),ej=ew.useRef(ZM(m.panes)),ek=ew.useRef(0),eS=ew.useRef(""),eC=Zr.find(e=>e.id===g)?.slots??4,eN=e?.conversation.settings.folders??Zb,{models:eM}=xa(),eE=ew.useMemo(()=>{let t=e?.conversation.settings.mainModels??[];return t.length?eM.filter(e=>t.includes(e.value)).map(e=>({id:e.value,label:e.label})):[]},[eM,e?.conversation.settings.mainModels]),eO=wS(e?.conversation.settings.engine),eP=ew.useMemo(()=>{if(eO){let t,n=e?.conversation.settings.ccModel;return[{id:n&&""!==n?n:"__cc_model__",label:(t=n&&""!==n?n:wj,wk.find(e=>e.value===t)?.label??n??""),disabled:!0}]}return eE},[eO,e?.conversation.settings.ccModel,eE]),eI=!eO&&0===eE.length,ez=Z||"working"===Q,e_=ew.useCallback(async t=>{if(!e||ed)return;let n=e.conversation.id,r=e.conversation.ownerMachineId;if(eO){if(ez)return void await s$(n,"请执行 /compact 压缩上下文。",r);J(!0),ee("working");try{let e=await sA(n,{message:"/compact",modelRef:"",mode:"agent"},r);z(e.events),ee(e.conversation.status)}catch(e){J(!1),ee("idle"),hx.error(e instanceof Error?e.message:"压缩请求失败")}return}if(ez)return void await s$(n,"precise"===t?"请在完成当前小任务后进行精确压缩(去除冗余文件读取和旧工具输出)。":"请在完成当前小任务后进行极致压缩(AI摘要),以便继续工作。",r);ef(!0);try{await sF(n,t,void 0,r);let e=await sw(n,r);if(e){let t=sB(e);z(t.events),eo(t.conversation.tokens??0),es(t.conversation.runUsage),eu(t.conversation.contextTokens??0)}}catch{}finally{ef(!1)}},[e,ed,ez,eO]),eT=ew.useMemo(()=>{if(!e)return;let t=eM.find(e=>e.value===X),n=t?.contextLength||200,r=el?.inputTokens??0,a=el?.outputTokens??0,i=r>0?r:ec;return{used:i>0?i+a:ei,total:1e3*n,toolCalls:i>0?i:ei,userMessages:a,other:void 0,onCompressPrecise:()=>e_("precise"),onCompressExtreme:()=>e_("extreme"),compressing:ed}},[e,eM,X,ei,el,ec,e_,ed]),eL=ew.useCallback(e=>{let t=e.anchorEventId??I.find(t=>t.id.startsWith(`${e.runId}-`))?.id??I.find(t=>t.id===e.runId)?.id;t&&p.current?.scrollToEvent(t)},[I]),e$=ew.useCallback(t=>{if(!t)return void T(void 0);let n=(e?.conversation.rounds??[]).find(e=>t===e.runId||t.startsWith(`${e.runId}-`));T(n?.runId)},[e?.conversation.rounds]),eF=ew.useCallback(async e=>{if("file-tab-viewer"!==e.kind||e.modified||e.file?.readOnly)return e;try{var t,n;let r=await dV(e);return(t=e,n=r,t.defaultValue!==n.defaultValue||t.title!==n.title||t.file?.size!==n.file?.size||t.file?.mimeType!==n.file?.mimeType||t.file?.previewContent!==n.file?.previewContent||t.file?.src!==n.file?.src||t.file?.truncated!==n.file?.truncated)?r:e}catch{return e}},[]),eB=ew.useCallback(async e=>{if(!e||!wW(e))return e;if("multi-tab-system"===e.kind){var t,n;let r=e.tabs??[],a=await Promise.all(r.map(eF));return(t=r,n=a,t.length!==n.length||t.some((e,t)=>e!==n[t]))?{...e,tabs:a}:e}if("file-tab-viewer"===e.kind&&e.tab){let t=await eF(e.tab);return t!==e.tab?{...e,title:t.title,tab:t}:e}return e},[eF]),eV=ew.useCallback(async()=>{var e,t;let n=await Promise.all(N.map(async e=>eB(e)));e=N,t=n,(e.length!==t.length||e.some((e,n)=>e!==t[n]))&&M(n)},[N,eB]);function eH(e){if(!e.length)return;let t=e.map(wq);r(e=>[...t,...e.filter(e=>!t.some(t=>t.id===e.id))])}function eW(e,t,n){if(!e||!wW(e))return e;if("multi-tab-system"===e.kind){var r;let a,i;return{...e,tabs:(r=e.tabs??[],a=r.filter(e=>e.id!==t.id),i=void 0===n?a.length:Math.min(Math.max(n,0),a.length),a.splice(i,0,t),a),activeTabId:t.id}}return"file-tab-viewer"===e.kind?{...e,title:t.title,tab:t}:e}function eU(e,t){return e&&wW(e)?"multi-tab-system"===e.kind?{...e,tabs:(e.tabs??[]).map(e=>e.id===t.id?t:e),activeTabId:t.id}:"file-tab-viewer"===e.kind?{...e,title:t.title,tab:t}:e:e}function eq(e){M(t=>{let n=t.findIndex(e=>void 0===e);return n>=0?t.map((t,r)=>r===n?e:t):[...t,e]})}ew.useEffect(()=>{i?.(void 0!==ep||void 0!==eg||void 0!==ex)},[eg,ex,i,ep]),ew.useEffect(()=>{z(e?.events??[])},[e?.conversation.id,e?.events]),ew.useEffect(()=>{$(V2(e?.conversation.id)),V([]),W(void 0),D(new Set)},[e?.conversation.id]),ew.useEffect(()=>{J(e?.conversation.status==="working"),ee(e?.conversation.status??"idle")},[e?.conversation.id,e?.conversation.status]),ew.useEffect(()=>{eo(e?.conversation.tokens??0),es(e?.conversation.runUsage),eu(e?.conversation.contextTokens??0)},[e?.conversation.id,e?.conversation.tokens,e?.conversation.runUsage,e?.conversation.contextTokens]),ew.useEffect(()=>{el?.inputTokens&&eu(el.inputTokens)},[el?.inputTokens]),ew.useEffect(()=>{en(e?.conversation.settings?.permissionMode??"acceptEdits")},[e?.conversation.id,e?.conversation.settings?.permissionMode]),ew.useEffect(()=>{let e=eE[0]?.id??"";Y(t=>eE.some(e=>e.id===t)?t:e)},[eE]),ew.useEffect(()=>{let t=Zj(e?.panes);v(t.layoutMode),y(t.agentPosition),C(t.layoutSizes),M(t.panes),O(t.cardColumns),A(t.cardHeights),ej.current=ZM(t.panes)},[e?.conversation.id,e?.panes]),ew.useEffect(()=>{let t,n=e?.conversation.id,r=e?.conversation.ownerMachineId;if(!n||!ez)return;let a=!1,i=e=>{z(e.events),ee(e.conversation.status),eo(e.conversation.tokens??0),es(e.conversation.runUsage);let t=Zj(e.panes);v(t.layoutMode),y(t.agentPosition),C(t.layoutSizes),M(t.panes),O(t.cardColumns),A(t.cardHeights)},o=e=>{void 0===t&&(t=window.setInterval(async()=>{try{let e=await sw(n,r);if(a)return;i(e),"working"!==e.conversation.status&&(J(!1),void 0!==t&&(window.clearInterval(t),t=void 0))}catch{return}},e))};if(r&&"local"!==r)return o(600),()=>{a=!0,void 0!==t&&window.clearInterval(t)};let l=new EventSource(eD(`/api/local/agent/conversations/${encodeURIComponent(n)}/events/stream`));return l.addEventListener("detail",e=>{try{let t=sB(JSON.parse(e.data));i(t),"working"!==t.conversation.status&&(J(!1),l.close())}catch{return}}),l.onerror=()=>{l.close(),o(350)},()=>{a=!0,l.close(),void 0!==t&&window.clearInterval(t)}},[e?.conversation.id,e?.conversation.ownerMachineId,ez]),ew.useEffect(()=>{if(!e?.conversation.id)return;let t=window.setInterval(()=>{eV()},3e3);return()=>window.clearInterval(t)},[e?.conversation.id,eV]),ew.useEffect(()=>{let t=e?.conversation.id,n=e?.conversation.ownerMachineId;if(!t)return;let r=!1;sC(t,n);let a=window.setInterval(()=>{r||sC(t,n)},3e4);return()=>{r=!0,window.clearInterval(a),sN(t,n)}},[e?.conversation.id,e?.conversation.ownerMachineId]),ew.useEffect(()=>{let e=I.filter(e=>"change"===e.kind).map(e=>`${e.id}:${e.status??""}:${e.isStreaming?"1":"0"}`).join("|");e&&e!==eS.current&&(eS.current=e,window.dispatchEvent(new CustomEvent(Zw)),eV())},[I,eV]),ew.useEffect(()=>{let t=e?.conversation.id;if(!t)return;let n=window.setTimeout(()=>{var n;let r;sP(t,(n={columns:E,heights:P},r=[],N.forEach((e,t)=>{if(e){if(wW(e))return void r.push({paneId:e.id,slot:t,kind:e.kind,machineId:e.terminal?.selectedMachineId,resourceId:e.terminal?.activeSessionId,props:{title:e.title,tab:e.tab,tabs:e.tabs,activeTabId:e.activeTabId,terminal:e.terminal}});r.push({paneId:e.id,slot:t,kind:e.kind,props:{title:e.title,subagentId:e.subagentId,events:e.events}})}}),{layoutMode:g,agentPosition:x,sizes:S,cardLayout:n,panes:r}),e?.conversation.ownerMachineId)},300);return()=>window.clearTimeout(n)},[x,E,P,e?.conversation.id,g,S,N]);let eK=ew.useCallback(e=>{M(t=>{let n=t.findIndex(e=>e?.kind==="browser-tab-viewer");if(n>=0){let r=t[n];return r&&wW(r)&&r.tab&&(!r.tab.defaultUrl||r.tab.defaultUrl.startsWith("https://vantaloom.local"))?t.map((t,a)=>a===n&&r.tab?{...r,tab:{...r.tab,defaultUrl:e}}:t):t}ej.current+=1;let r=wH("browser-tab-viewer",`browser-tab-viewer-${ej.current}`),a=void 0!==r.tab?{...r,tab:{...r.tab,defaultUrl:e}}:r,i=t.findIndex(e=>void 0===e);return i>=0?t.map((e,t)=>t===i?a:e):w?[...t,a]:t})},[w]),eG=ew.useRef(!1);function eX(e,t){M(n=>{let r=n.findIndex(t=>t?.kind===e);if(r>=0)return n.map((n,a)=>a===r&&n?{id:n.id,kind:e,title:t.title,tab:t}:n);ej.current+=1;let a={id:`${e}-${ej.current}`,kind:e,title:t.title,tab:t},i=n.findIndex(e=>void 0===e);return i>=0?n.map((e,t)=>t===i?a:e):[...n,a]})}async function eY(e,t,n){try{let r=await dF(e);if(w)return void eX("file-tab-viewer",r);M(e=>e.map((e,a)=>a===t?eW(e,r,n):e))}catch{hx.error("文件预览打开失败")}}function eZ(e){if(w)return void eY(e,-1);let t=N.slice(0,eC).findIndex(e=>e?.kind==="multi-tab-system");t<0?hx.warning("请先放入一个多标签页组件"):eY(e,t)}function eJ(e){let t=e.path?.trim()||e.name.trim();("diff"===e.kind||"diff"===e.meta)&&e.diff?function(e){let t=e.path?.trim()||e.name.trim(),n={id:function(e,t){let n=0x811c9dc5;for(let e=0;e<t.length;e+=1)n^=t.charCodeAt(e),n=Math.imul(n,0x1000193);return`${e}-${(n>>>0).toString(36)}`}("diff",`${e.mutationId??""}|${e.machineId??"local"}|${t}|${e.diff??""}`),kind:"diff-tab-viewer",title:`Diff ${e.name}`,file:{name:e.name,path:t,machineId:e.machineId??"local",kind:"code"},diff:e.diff};if(w)return eX("diff-tab-viewer",n);let r=N.slice(0,eC).findIndex(e=>e?.kind==="multi-tab-system");r<0?hx.warning("请先放入一个多标签页组件"):M(e=>e.map((e,t)=>t===r?eW(e,n):e))}(e):!t||e.meta?.toLowerCase().startsWith("depth")||eZ({machineId:e.machineId??"local",path:t})}async function eQ(e,t,n){let r=t.file?.path,a=t.file?.machineId??"local";if(!r)throw hx.error("文件路径不可用"),Error("file path is unavailable");try{let i=await dE({machineId:a,path:r,content:n}),o={...await dB(i,{id:t.id,title:t.title,defaultView:t.defaultView,defaultMode:t.defaultMode}),modified:!1};M(t=>t.map((t,n)=>n===e?eU(t,o):t)),window.dispatchEvent(new CustomEvent(Zw)),hx.success("文件已保存")}catch(e){throw hx.error("文件保存失败"),e}}async function e0(t){let n=e?.conversation.id,r=ex?.tab.file?.path,a=ex?.tab.file?.machineId??"local";if(ex&&n&&r)try{let i=await sR(n,{machineId:a,path:r,mutationId:t.mutationId,state:t.state},e?.conversation.ownerMachineId),o=await dB(i,{id:ex.tab.id,title:`${i.name} @ ${ZP(t.mutationId)} ${"before"===t.state?"before":"after"}`,readOnly:!0,defaultView:ex.tab.defaultView,defaultMode:"review"});M(e=>e.map((e,t)=>t===ex.paneIndex?eU(e,o):e)),eb(void 0)}catch{hx.error("历史版本打开失败")}}function e1(e,t,n){let i=N[e];ej.current=Math.max(ej.current,ZN(n)),M(t=>t.map((t,r)=>r===e?n:t)),r(e=>{let n=e.filter(e=>e.id!==t.id);if(!i)return n;let r=wq(i);return[r,...n.filter(e=>e.id!==r.id)]}),a?.(void 0)}function e2(e,t){M(n=>n.map((n,r)=>r===e?t:n))}function e5(t){return{id:t.id,ownerMachineId:t.ownerMachineId??e?.conversation.ownerMachineId,name:t.name,subagentType:t.subagentType}}function e4(e){var t=N[e];if(t&&wW(t)&&"terminal-tab-group"===t.kind)for(let e of t.terminal?.sessionIds??[])d1(e).catch(()=>{});M(t=>t.map((t,n)=>n===e?void 0:t))}function e3(e){let t=N[e];t&&eH([t]),M(t=>t.map((t,n)=>n===e?void 0:t))}async function e6(t,n="chat",r=[]){let a=e?.conversation.id,i=eO?"":X||eE[0]?.id||"";if(!a)return;if(!eO&&!i)return void hx.error("请先在代理模型配置里选择模型");D(function e(t,n=new Set){for(let r of t)n.add(r.id),e(r.children??[],n);return n}(u));let o=r.map(e=>"image"===e.kind?{kind:"image",name:e.name,mimeType:e.mimeType,data:e.dataUrl?.split(",")[1]??""}:{kind:"file",name:e.name,mimeType:e.mimeType,text:e.text??""}).filter(e=>"image"===e.kind?""!==e.data:(e.text??"")!=="");J(!0),ee("working");try{let r=await sA(a,{message:t,modelRef:i,mode:n,attachments:o.length>0?o:void 0},e?.conversation.ownerMachineId);z(r.events),ee(r.conversation.status)}catch(e){J(!1),ee("idle"),hx.error(e instanceof Error?e.message:"对话请求失败")}}async function e8(t){let n=e?.conversation.id,r="string"==typeof t.modelRef?t.modelRef.trim():"",a=eO?"":r||X||eE[0]?.id||"",i="agent"===t.mode?"agent":"chat";if(n){if(!eO&&!a)return void hx.error("请先在代理模型配置里选择模型");J(!0),ee("working"),z(e=>e.map(e=>e.id===t.id?{...e,status:"retried"}:e));try{let r=await sI(n,{modelRef:a,mode:i,retryEventId:t.id},e?.conversation.ownerMachineId);z(r.events),ee(r.conversation.status)}catch(e){z(e=>e.map(e=>e.id===t.id?t:e)),J(!1),ee("idle"),hx.error(e instanceof Error?e.message:"对话重试失败")}}}function e7(e){ez?hx.error("对话正在运行,请先停止后再回退"):W(e)}async function e9(){let t=e?.conversation.id;if(!H||!t)return void W(void 0);q(!0);try{let n=await sz(t,H.id,e?.conversation.ownerMachineId);z(n.detail.events),ee(n.detail.conversation.status),J(!1),F(n.prompt),c?.([]);let r=[];n.revertedFiles>0&&r.push(`恢复 ${n.revertedFiles} 个文件`),n.deletedFiles>0&&r.push(`删除 ${n.deletedFiles} 个新增文件`),n.archivedSubagents>0&&r.push(`归档 ${n.archivedSubagents} 个子代理`),hx.success(r.length?`已回退:${r.join(",")}`:"已回退到此处"),n.skippedRemote&&n.skippedRemote.length>0&&hx.warning(`${n.skippedRemote.length} 个远程文件未自动回退,请在对应机器手动处理`)}catch(e){hx.error(e instanceof Error?e.message:"回退失败")}finally{q(!1),W(void 0)}}async function te(t){let n=e?.conversation.id;if(n&&!K){G(!0);try{let r=await s_(n,t.id,e?.conversation.ownerMachineId);o?.(r),hx.success("已创建分支对话")}catch(e){hx.error(e instanceof Error?e.message:"创建分支失败")}finally{G(!1)}}}async function tt(t){let n=e?.conversation.id;if(n)try{let r=e?.conversation.settings??{};await sE(n,{settings:{...r,...t}},e?.conversation.ownerMachineId)}catch(e){hx.error(e instanceof Error?e.message:"设置更新失败")}}async function tn(t,n){let r=e?.conversation.id;if(r)try{await sT(r,t,n,void 0,e?.conversation.ownerMachineId)}catch(e){hx.error(e instanceof Error?e.message:"审批操作失败")}}async function tr(){let t=e?.conversation.id;if(t){try{await sL(t,e?.conversation.ownerMachineId)}catch{}J(!1),ee("idle")}}function ta(){e6("继续","agent")}async function ti(t){let n=e?.conversation.id;if(!n)return;let r=er.find(e=>e.id===t);if(!r)return;let a="string"==typeof r.content?r.content:String(r.content??"");if(a.trim()){ea(e=>e.filter(e=>e.id!==t));try{await s$(n,a.trim(),e?.conversation.ownerMachineId)}catch{}}}ew.useEffect(()=>{let t=e?.conversation.id,n=e?.conversation.ownerMachineId;if(!t||n&&"local"!==n)return;eG.current=!1;let r=!1,a=async()=>{if(!r&&!eG.current)try{let e=(await eR())[0];if(r||eG.current||!e)return;eG.current=!0,eK(e)}catch{}};a();let i=window.setInterval(a,3e3);return()=>{r=!0,window.clearInterval(i)}},[e?.conversation.id,e?.conversation.ownerMachineId,eK]),ew.useEffect(()=>{let e=eh.current;if(eh.current=Q,"working"===e&&"idle"===Q&&er.length>0){let e=er[0];if(e){ea(er.slice(1));let t="string"==typeof e.content?e.content:String(e.content??"");t.trim()&&e6(t.trim(),"agent")}}},[Q]);let to=Array.from({length:eC},(r,a)=>(0,ey.jsx)(Zs,{conversationId:e?.conversation.id,index:a,content:N[a],clipboardItems:t,clipboardDraggingId:n,onAdd:()=>em(a),onPanelDrop:e1,onContentChange:e2,onClear:e4,onCut:e3,workspaceFolders:eN,onRequestFileTab:(e,t)=>ev({paneIndex:e,insertIndex:t}),onOpenWorkspaceFile:eZ,onSaveFileTab:eQ,onOpenFileHistory:(e,t)=>eb({paneIndex:e,tab:t})},a)),tl=N.slice(0,eC).some(e=>e?.kind==="subagent-conversation-panel"),ts=S.shell?.agent??42,tc=S.shell?.panes??58,tu=b.agentSide,td="control-room"===b.mode||j,tf=(0,ey.jsxs)(pb,{type:"single",value:td?"hidden":tu,variant:"outline",size:"sm","data-tour":"control-room-toggle","aria-label":"Agent 面板位置",onValueChange:e=>{"left"===e||"right"===e?(k(!1),y(e),Zx({mode:w?"card":"pane",agentSide:e})):"hidden"===e&&(k(!0),Zx({mode:"control-room"}))},children:[(0,ey.jsx)(pw,{value:"left","aria-label":"Agent 在左",title:"Agent 在左",className:"h-7 w-9 px-0 [&_svg]:size-4",children:(0,ey.jsx)(sW,{})}),(0,ey.jsx)(pw,{value:"hidden","aria-label":"隐藏面板,居中对话",title:"隐藏面板,居中对话",className:"h-7 w-9 px-0 [&_svg]:size-4",children:(0,ey.jsx)(sq,{})}),(0,ey.jsx)(pw,{value:"right","aria-label":"Agent 在右",title:"Agent 在右",className:"h-7 w-9 px-0 [&_svg]:size-4",children:(0,ey.jsx)(sU,{})})]}),th=(0,ey.jsxs)("div",{className:"relative flex size-full min-h-0 min-w-0 flex-col",children:[e?(0,ey.jsx)(Vy,{ownerMachineId:e.conversation.ownerMachineId,title:e.conversation.title,className:"pr-12"}):null,e?(0,ey.jsx)("div",{className:"pointer-events-none absolute left-1 top-9 z-30 flex justify-start pt-1.5",children:(0,ey.jsx)("div",{className:"pointer-events-auto",children:(0,ey.jsx)(Vb,{rounds:e.conversation.rounds,onJumpToRound:eL,activeRunId:R})})}):null,(0,ey.jsx)("div",{className:"min-h-0 flex-1 pl-10",children:(0,ey.jsx)(Vv,{ref:p,events:e?I:void 0,models:e?eP:void 0,modelId:eO?eP[0]?.id:X,permissionModeId:et,onPermissionModeChange:t=>{en(t),e?.conversation.id&&tt({permissionMode:t})},running:ez,disabled:!!e&&eI,onModelChange:Y,onSubmit:e?e=>{e6(e.value,"agent",e.attachments??[])}:void 0,onStop:tr,onOpenFile:eJ,onOpenSubagent:function(e){e.id&&c?.([e5(e)])},onRetry:e8,onApprovalDecision:tn,onContinue:ta,onRecallUserMessage:e7,onBranchAssistantMessage:te,onActiveEventChange:e$,composerValue:L,onComposerValueChange:F,attachments:B,onAttachmentsChange:V,queuedMessages:er,onQueuedMessagesChange:ea,onNudge:ti,contextUsage:eT})}),s.length>0&&e?(0,ey.jsx)(Zy,{stack:s,rootTitle:e.conversation.title,rootOwnerMachineId:e.conversation.ownerMachineId,onNavigateRoot:()=>c?.([]),onNavigateIndex:e=>c?.(s.slice(0,e+1)),onOpenSubagent:function(e){e.id&&c?.([...s,e5(e)])}}):null]}),tp=(0,ey.jsx)(hn,{id:"agent",defaultSize:ts,minSize:28,children:th},"agent-conversation"),tm=(0,ey.jsx)(hn,{id:"panes",defaultSize:tc,minSize:32,children:(0,ey.jsxs)("section",{className:"vtl-agent-workspace-panel flex size-full min-h-0 min-w-0 flex-col bg-transparent","data-has-conversation-pane":tl?"true":void 0,children:[(0,ey.jsx)("div",{className:"flex h-11 shrink-0 items-center border-b px-3","data-tour":"pane-toolbar",children:(0,ey.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,ey.jsx)(hQ,{value:g,onValueChange:e=>{let t,n;return t=Zr.find(t=>t.id===e)?.slots??4,void((n=N.slice(t).filter(e=>!!e)).length&&eH(n),M(Array.from({length:Math.max(4,t)},(e,n)=>n<t?N[n]:void 0)),v(e))},children:(0,ey.jsx)(h7,{children:Zr.map(e=>(0,ey.jsx)(h9,{value:e.id,"aria-label":e.label,title:e.label,className:"h-7 w-10 px-0 [&_svg]:size-4",children:e.icon},e.id))})}),tf,(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm",draggable:!0,"aria-label":"剪切窗口内容",title:"拖拽到窗口以剪切到剪切板",className:"h-7 w-10 cursor-grab rounded-md text-muted-foreground active:cursor-grabbing [&_svg]:size-4",onDragStart:e=>{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(Zt,"cut")},children:(0,ey.jsx)(lW,{})}),(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm",draggable:!0,"aria-label":"粉碎窗口内容",title:"拖拽到窗口以清空",className:"h-7 w-10 cursor-grab rounded-md text-muted-foreground active:cursor-grabbing [&_svg]:size-4",onDragStart:e=>{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(Ze,"clear")},children:(0,ey.jsx)(sK,{})})]})}),(0,ey.jsx)("div",{className:"min-h-0 flex-1",children:(0,ey.jsx)(Zl,{mode:g,sizes:S,onSizeGroupChange:function(e,t){let n=ZS(t);C(t=>{var r;return(r=t[e],(r?.length??0)===(n?.length??0)&&(r??[]).every((e,t)=>.01>Math.abs(e-(n?.[t]??0))))?t:{...t,[e]:n}})},children:to},`${e?.conversation.id??"empty"}-${g}`)})]})},"agent-panes"),tg=(0,ey.jsx)(Zf,{conversationId:e?.conversation.id,panes:N,agentSide:tu,columns:E,heights:P,onColumnsChange:O,onHeightsChange:A,onAddCard:function(e){ej.current+=1;let t=wH(e,`${e}-${ej.current}`);if("browser-tab-viewer"===e&&t.tab){let e=t.tab;eR().then(n=>{eq(n.length>0?{...t,tab:{...e,defaultUrl:n[0]}}:t)});return}eq(t)},onContentChange:e2,onClear:e4,workspaceFolders:eN,onOpenWorkspaceFile:eZ,onSaveFileTab:eQ,onOpenFileHistory:(e,t)=>eb({paneIndex:e,tab:t}),onRequestFileTab:(e,t)=>ev({paneIndex:e,insertIndex:t})}),tv=(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(Zc,{open:void 0!==ep,onOpenChange:e=>{e||em(void 0)},onAdd:function(e){if(void 0===ep)return;ej.current+=1;let t=wH(e,`${e}-${ej.current}`),n=N[ep];n&&eH([n]),M(e=>e.map((e,n)=>n===ep?t:e)),em(void 0)}}),(0,ey.jsx)(VX,{open:void 0!==eg,folders:eN,onOpenChange:e=>{e||ev(void 0)},onSelectFile:e=>{eg&&eY(e,eg.paneIndex,eg.insertIndex),ev(void 0)}}),(0,ey.jsx)(ZO,{open:void 0!==ex,conversationId:e?.conversation.id,ownerMachineId:e?.conversation.ownerMachineId,tab:ex?.tab,onOpenChange:e=>{e||eb(void 0)},onSelectVersion:e=>{e0(e)}}),(0,ey.jsx)(uL,{open:void 0!==H,onOpenChange:e=>{e||U||W(void 0)},children:(0,ey.jsxs)(u2,{children:[(0,ey.jsxs)(u5,{children:[(0,ey.jsx)(u3,{children:"回退对话到此处?"}),(0,ey.jsx)(u6,{children:"此操作会归档此处之后的所有对话记录,并把这期间(含子代理)对文件的修改全部还原到当前这条消息发送前的状态。该用户消息会回到输入框。回退无法撤销。"})]}),(0,ey.jsxs)(u4,{children:[(0,ey.jsx)(u7,{disabled:U,children:"取消"}),(0,ey.jsx)(u8,{variant:"destructive",disabled:U,onClick:e=>{e.preventDefault(),e9()},children:U?"回退中…":"确认回退"})]})]})})]});return e?h?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(w$,{view:d,onPaneCountChange:f,conversationPanel:(0,ey.jsx)(Vv,{flowContentClassName:"pl-10",events:e?I:void 0,models:e?eP:void 0,modelId:eO?eP[0]?.id:X,permissionModeId:et,onPermissionModeChange:t=>{en(t),e?.conversation.id&&tt({permissionMode:t})},running:ez,disabled:!!e&&eI,onModelChange:Y,onSubmit:e?e=>{e6(e.value,"agent",e.attachments??[])}:void 0,onStop:tr,onOpenFile:eJ,onOpenSubagent:function(e){var t;let n=N.slice(0,eC),r=n.findIndex(e=>!e),a=n.findIndex(e=>e?.kind==="subagent-conversation-panel"),i=r>=0?r:a;if(i<0)return void hx.warning("请释放一个窗口再选中浏览");ek.current+=1;let o={id:t=`subagent-${e.id}-${ek.current}`,kind:"subagent-conversation-panel",title:e.title,subagentId:e.id,events:e.events?.length?e.events:[{id:`${t}-status`,kind:"done",title:e.detail??e.status??e.activity??e.title}]};M(e=>e.map((e,t)=>t===i?o:e))},onRetry:e8,onApprovalDecision:tn,onContinue:ta,onRecallUserMessage:e7,onBranchAssistantMessage:te,onActiveEventChange:e$,composerValue:L,onComposerValueChange:F,attachments:B,onAttachmentsChange:V,queuedMessages:er,onQueuedMessagesChange:ea,onNudge:ti,contextUsage:eT}),paneElements:to,panes:N,activeSlotCount:eC,onOpenPalette:em,timeline:(0,ey.jsx)(Vb,{rounds:e.conversation.rounds,onJumpToRound:eL,activeRunId:R})}),tv,(0,ey.jsx)(hS,{position:"top-center"})]}):(0,ey.jsxs)("div",{className:"vtl-app-background vtl-agent-conversation-workspace relative h-full min-h-0",children:[td?(0,ey.jsxs)("div",{className:"relative flex h-full min-h-0",children:[(0,ey.jsx)("div",{className:"pointer-events-none absolute inset-0 -z-10 opacity-0","aria-hidden":!0,children:(0,ey.jsx)(ht,{direction:"horizontal",children:tm})}),(0,ey.jsxs)("div",{className:"relative flex h-full min-h-0 min-w-0 basis-[58%] shrink-0 flex-col",children:[(0,ey.jsx)(ht,{direction:"horizontal",children:tp}),(0,ey.jsx)("div",{className:"absolute right-3 top-1.5 z-20",children:tf})]}),(0,ey.jsx)("div",{className:"relative min-h-0 min-w-0 flex-1",children:(0,ey.jsx)(V0,{conversationTitle:e.conversation.title,rootEvents:I,rootOwnerMachineId:e.conversation.ownerMachineId,running:ez,subagentTree:u,baselineSubagentIds:_,activeSubagentPath:s,onSelectMain:()=>c?.([]),onSelectSubagent:e=>c?.([e])})})]}):w?(0,ey.jsx)("div",{className:"flex h-full min-h-0 overflow-x-auto",children:"left"===tu?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("div",{className:"relative flex h-full min-h-0 min-w-[20rem] flex-1 flex-col",children:th}),(0,ey.jsx)("div",{className:"flex h-full min-h-0 shrink-0 flex-col",children:tg})]}):(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("div",{className:"flex h-full min-h-0 shrink-0 flex-col",children:tg}),(0,ey.jsx)("div",{className:"relative flex h-full min-h-0 min-w-[20rem] flex-1 flex-col",children:th})]})}):(0,ey.jsxs)(ht,{direction:"horizontal",defaultLayout:{agent:ts,panes:tc},onLayoutChanged:e=>{let t=e.agent??ts,n=e.panes??tc;!function(e){let t=ZS(e),n=t[0],r=t[1];if(void 0===n||void 0===r)return;let a="left"===x?{agent:n,panes:r}:{agent:r,panes:n};C(e=>{let t=e.shell?.agent,n=e.shell?.panes;return .01>Math.abs((t??0)-a.agent)&&.01>Math.abs((n??0)-a.panes)?e:{...e,shell:{...e.shell,...a}}})}("left"===tu?[t,n]:[n,t])},children:["left"===tu?tp:tm,(0,ey.jsx)(hr,{withHandle:!0}),"left"===tu?tm:tp]},`${e?.conversation.id??"empty"}-${tu}`),tv,(0,ey.jsx)(hS,{position:"top-right"})]}):(0,ey.jsx)(w_,{onCreated:e=>o?.(e),onCancel:l})}function ZO({open:e,conversationId:t,ownerMachineId:n,tab:r,onOpenChange:a,onSelectVersion:i}){let[o,l]=ew.useState([]),[s,c]=ew.useState(!1),u=r?.file?.path,d=r?.file?.machineId??"local";return ew.useEffect(()=>{if(!e||!t||!u)return void l([]);let r=!1;return c(!0),sD(t,{machineId:d,path:u},n).then(e=>{r||l(e.versions)}).catch(()=>{r||l([])}).finally(()=>{r||c(!1)}),()=>{r=!0}},[t,n,d,e,u]),(0,ey.jsx)(uo,{open:e,onOpenChange:a,children:(0,ey.jsxs)(d8,{className:"max-w-xl gap-0 overflow-hidden p-0",children:[(0,ey.jsx)(d9,{className:"sr-only",children:"历史版本"}),(0,ey.jsx)(fe,{className:"sr-only",children:"浏览当前文件在此 Agent 会话中的修改历史。"}),(0,ey.jsxs)("div",{className:"border-b px-4 py-3",children:[(0,ey.jsx)("div",{className:"truncate text-sm font-medium",children:r?.file?.name??r?.title??"文件"}),u?(0,ey.jsxs)("div",{className:"mt-0.5 truncate ui-text-kbd text-muted-foreground",children:[d,":",u]}):null]}),(0,ey.jsx)("div",{className:"max-h-[28rem] overflow-auto p-2",children:s?(0,ey.jsx)("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:"正在读取历史版本"}):0===o.length?(0,ey.jsx)("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:"还没有记录到这个文件的修改历史"}):(0,ey.jsx)("div",{className:"grid gap-1",children:o.map(e=>{var t;let n;return(0,ey.jsxs)("button",{type:"button",className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-md px-3 py-2 text-left transition-colors hover:bg-muted/70",onClick:()=>i(e),children:[(0,ey.jsxs)("span",{className:"min-w-0",children:[(0,ey.jsxs)("span",{className:"block truncate text-sm font-medium",children:[ZP(e.mutationId)," ·"," ","before"===e.state?"修改前":"修改后"]}),(0,ey.jsx)("span",{className:"mt-0.5 block truncate ui-text-kbd text-muted-foreground",children:Number.isFinite(n=Date.parse(t=e.createdAt))?new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(n):t})]}),(0,ey.jsxs)("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,ey.jsxs)("b",{className:"font-medium text-emerald-600",children:["+",e.additions??0]}),(0,ey.jsxs)("b",{className:"font-medium text-rose-600",children:["-",e.deletions??0]})]})]},e.id)})})})]})})}function ZP(e){return e.replace(/^mut-/,"").slice(0,16)}let ZA=[{id:"models",label:"模型"},{id:"tools",label:"工具权限"},{id:"commands",label:"禁止命令"},{id:"folders",label:"工作区文件夹"},{id:"hosts",label:"可访问主机"}];function ZI({conversation:e,mainModels:t,ccModel:n="",sessionSettings:r,onMainModelsChange:a,onCcModelChange:i,onSessionSettingsChange:o,onClose:l,onEnterConversation:s}){let[c,u]=ew.useState("models"),d=wS(e.settings.engine);return(0,ey.jsxs)("div",{className:"vtl-app-background flex h-full min-h-0 flex-col text-foreground",children:[(0,ey.jsxs)("header",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon","aria-label":"关闭设置",onClick:l,className:"shrink-0",children:(0,ey.jsx)(d3.XIcon,{className:"size-5"})}),(0,ey.jsxs)("button",{type:"button",className:"min-w-0 flex-1 rounded-lg px-2 py-1 text-left transition-colors hover:bg-muted/60",title:"返回该对话",onClick:()=>s?.(e),children:[(0,ey.jsxs)("div",{className:"text-[11px] text-muted-foreground",children:[e.agent," · 会话设置"]}),(0,ey.jsx)("div",{className:"truncate text-sm font-semibold",children:e.title})]})]}),(0,ey.jsx)("nav",{className:"flex shrink-0 gap-1 overflow-x-auto border-b px-3 py-2 vtl-scrollbar-hidden",children:ZA.map(e=>(0,ey.jsx)("button",{type:"button",onClick:()=>u(e.id),className:(0,eI.cn)("shrink-0 rounded-lg px-3 py-1.5 text-[13px] transition-colors",c===e.id?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:e.label},e.id))}),(0,ey.jsx)("div",{className:"min-h-0 flex-1 overflow-auto p-4 pb-[max(1.25rem,env(safe-area-inset-bottom))]",children:(0,ey.jsxs)("div",{className:"mx-auto w-full max-w-2xl",children:["models"===c?(0,ey.jsxs)("div",{className:"grid gap-4",children:[(0,ey.jsxs)("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-center gap-3 rounded-lg border bg-card px-3 py-2.5",children:[(0,ey.jsx)("span",{className:"text-sm text-muted-foreground",children:"运行引擎"}),(0,ey.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:function(e){switch(e){case"claude-code":return"Claude Code";case"reclaude":return"reclaude";default:return"Vantaloom"}}(e.settings.engine)})]}),d?(0,ey.jsxs)("div",{className:"grid gap-3",children:[(0,ey.jsx)("label",{htmlFor:"conversation-cc-model",className:"text-base font-semibold tracking-normal text-foreground",children:"Claude Code 模型"}),(0,ey.jsxs)(go,{value:""===n?wj:n,onValueChange:e=>i?.(e===wj?"":e),children:[(0,ey.jsx)(gX,{id:"conversation-cc-model",className:"w-full",children:(0,ey.jsx)(gu,{placeholder:"选择 Claude Code 模型"})}),(0,ey.jsx)(gJ,{children:wk.map(e=>(0,ey.jsx)(gQ,{value:e.value,children:e.label},e.value))})]}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"模型由 Claude Code 提供,不走 Vantaloom 模型路由。"})]}):(0,ey.jsx)(xi,{conversation:e,mainModels:t,onMainModelsChange:a})]}):null,"tools"===c?(0,ey.jsx)(wh,{value:r.allowedTools,onChange:e=>o({...r,allowedTools:e,deniedTools:[]})}):null,"commands"===c?(0,ey.jsx)(wp,{value:r.blockedCommands,onChange:e=>o({...r,blockedCommands:e})}):null,"folders"===c?(0,ey.jsxs)("div",{className:"grid gap-3",children:[(0,ey.jsx)(wm,{title:"可访问的工作区文件夹",value:r.folders,onValueChange:e=>o({...r,folders:d?e.slice(-1):e})}),d?(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"Claude Code 仅支持单个工作目录(作为会话的工作根目录)。"}):null]}):null,"hosts"===c?(0,ey.jsx)(ww,{value:r.hosts,onValueChange:e=>o({...r,hosts:e}),disabled:d,hint:d?"Claude Code 的工具锁定在所选 owner 机器本地,可访问主机已锁定。":void 0}):null]})})]})}function Zz({conversationId:e,ownerMachineId:t,open:n,onOpenChange:r,onEnterConversation:a}){let[i,o]=ew.useState(),[l,s]=ew.useState([]),[c,u]=ew.useState(""),[d,f]=ew.useState({folders:[],blockedCommands:[],allowedTools:[],deniedTools:[],plugins:[],hosts:[]});async function h(e){if(!i)return;let n=e.session??d,r=e.mainModels??l,a=e.ccModel??c,s={subagents:i.settings.subagents??[],mainModels:r,folders:n.folders,blockedCommands:n.blockedCommands,allowedTools:n.allowedTools,deniedTools:n.deniedTools,plugins:n.plugins,hosts:n.hosts,permissionMode:n.permissionMode??i.settings.permissionMode,engine:i.settings.engine,ccModel:i.settings.engine?a:void 0};try{let e=await sE(i.id,{settings:s},t);o(e.conversation)}catch{}}function p(){o(void 0),r(!1)}return(ew.useEffect(()=>{if(!n||!e)return;let r=!0;return async function(){try{let n=await sw(e,t);if(!r)return;let a=n.conversation;o(a),s(a.settings.mainModels),u(a.settings.ccModel??""),f({folders:a.settings.folders,blockedCommands:a.settings.blockedCommands,allowedTools:a.settings.allowedTools,deniedTools:a.settings.deniedTools,plugins:a.settings.plugins,hosts:a.settings.hosts})}catch{}}(),()=>{r=!1}},[e,n,t]),n&&i)?(0,ey.jsx)(ZI,{conversation:i,mainModels:l,ccModel:c,sessionSettings:d,onMainModelsChange:e=>{s(e),h({mainModels:e})},onCcModelChange:e=>{u(e),h({ccModel:e})},onSessionSettingsChange:e=>{f(e),h({session:e})},onClose:p,onEnterConversation:e=>{p(),a?.(e.id,t)}}):null}let Z_="local";async function ZD(e){return((await ZH(e,"")).canvases??[]).map(t=>ZV(t,e))}async function ZR(e,t){return ZB(await ZH(t,`/${encodeURIComponent(e)}`),t)}async function ZT(e,t){return ZB(await ZH(t,"",{method:"POST",body:JSON.stringify({title:e.title,nodes:e.nodes.map(dk),edges:e.edges.map(dS)})}),t)}async function ZL(e,t,n){return ZB(await ZH(n,`/${encodeURIComponent(e)}/save`,{method:"PUT",body:JSON.stringify({nodes:t.nodes.map(dk),edges:t.edges.map(dS),nodeIds:t.nodeIds})}),n)}async function Z$(e,t){return ZB(await ZH(t,`/${encodeURIComponent(e)}/open`,{method:"POST"}),t)}async function ZF(){let e={[Z_]:"本机"},t=[],n=[];try{n=await ZD(void 0)}catch{n=[]}let r=[];try{let{machines:e}=await sd();r=(e??[]).filter(e=>!e.isLocal&&"online"===e.status).map(e=>({id:e.id,name:e.name}))}catch{r=[]}let a=await Promise.all(r.map(async n=>{e[n.id]=n.name;try{return await ZD(n.id)}catch{return t.push(n.id),[]}})),i=new Map;for(let e of[...n,...a.flat()]){let t=i.get(e.id);(!t||e.updatedAt>t.updatedAt)&&i.set(e.id,e)}let o=Array.from(i.values());return o.sort((e,t)=>t.updatedAt>e.updatedAt?1:-1),{canvases:o,machineNames:e,unreachable:t}}function ZB(e,t){return{canvas:ZV(e.canvas,t),nodes:e.nodes??[],edges:e.edges??[]}}function ZV(e,t){let n=t&&t!==Z_?t:e.ownerMachineId??"local";return{id:e.id,title:e.title||"新画布",ownerMachineId:n,nodeCount:e.nodeCount??0,running:e.running??!1,createdAt:e.createdAt,updatedAt:e.updatedAt,lastOpenedAt:e.lastOpenedAt}}async function ZH(e,t,n,r){let a=await fetch(eD(!e||e===Z_?`/api/local/canvas${t}`:`/v1/remote/${e}/canvas${t}`),{cache:"no-store",...n,headers:{...n?.body?{"Content-Type":"application/json"}:{},...n?.headers}});if(r?.allowNotFound&&404===a.status)return;let i=await a.json().catch(()=>({}));if(!a.ok)throw Error("string"==typeof i?.error?i.error:"canvas api failed");return i}let ZW=(0,ek.default)("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),ZU=(0,ek.default)("lock-keyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]),Zq=(0,ek.default)("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),ZK=(0,ek.default)("plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]),ZG=(0,ek.default)("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),ZX=(0,ek.default)("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]),ZY={done:"Done",current:"Current",queued:"Queued",blocked:"Blocked"};function ZZ(e,t,n){return Math.min(Math.max(e,t),n)}function ZJ({items:e,currentId:t,labels:n,scrollCurrentIntoView:r=!0,className:a,viewportClassName:i,itemClassName:o,extendLineToViewport:l=!1,...s}){let c={...ZY,...n},u=ew.useRef(null),d=ew.useRef(null),f=ew.useRef(null),h=ew.useRef(0),p=ew.useRef(void 0),[m,g]=ew.useState(0),v=t??e.find(e=>"current"===e.status)?.id,x=ew.useCallback(()=>{void 0!==p.current&&(cancelAnimationFrame(p.current),p.current=void 0)},[]),y=ew.useCallback((e,t=340)=>{let n=u.current,r=d.current;if(!n||!r)return;x();let a=Math.max(0,n.scrollHeight-n.clientHeight),i=n.scrollTop,o=ZZ(e,0,a),l=performance.now();h.current=o;let s=e=>{let r=ZZ((e-l)/t,0,1);if(n.scrollTop=i+(o-i)*(1-Math.pow(1-r,3)),r<1){p.current=requestAnimationFrame(s);return}n.scrollTop=o,p.current=void 0};p.current=requestAnimationFrame(s)},[x]),b=ew.useCallback(e=>{let t=u.current,n=d.current;if(!t||!n)return;let r=Math.max(0,t.scrollHeight-t.clientHeight);if(r<=0)return;e.preventDefault();let a=void 0===p.current?t.scrollTop:h.current,i=1===e.deltaMode?32*e.deltaY:2===e.deltaMode?e.deltaY*e.currentTarget.clientHeight:e.deltaY,o=Math.sign(i);if(0===o)return;let l=Array.from(n.querySelectorAll("[data-slot='roadmap-item']")).map(e=>e.offsetTop),s=ZZ(Math.ceil(Math.abs(i)/160),1,3),c=a;for(let e=0;e<s;e+=1)c=function(e,t,n,r){if(0===e.length)return t;if(n>0)return e.find(e=>e>t+1)??r;for(let n=e.length-1;n>=0;n-=1){let r=e[n];if(void 0!==r&&r<t-1)return r}return 0}(l,c,o,r);y(c)},[y]);return ew.useLayoutEffect(()=>{if(!r)return;let e=u.current,t=d.current,n=f.current;if(!e||!t||!n)return void g(0);let a=n.offsetTop,i=t.scrollHeight-m,o=Math.max(0,e.clientHeight-(i-a));g(e=>Math.abs(e-o)>.5?o:e),requestAnimationFrame(()=>{e.scrollTop=a,h.current=a})},[m,e,v,r]),ew.useEffect(()=>x,[x]),(0,ey.jsx)("div",{"data-slot":"roadmap",className:(0,eI.cn)("min-w-0 text-foreground",a),...s,children:(0,ey.jsx)("div",{"data-slot":"roadmap-viewport",ref:u,onWheel:b,className:(0,eI.cn)("max-h-72 overflow-y-auto overscroll-contain pr-2",i),children:(0,ey.jsxs)("div",{ref:d,className:(0,eI.cn)("relative",l&&"min-h-full"),children:[(0,ey.jsx)("span",{"aria-hidden":"true",className:"absolute top-0 bottom-0 left-[0.3125rem] w-px bg-border"}),e.map(e=>{let t=e.id===v?"current":e.status??"queued";return(0,ey.jsxs)("div",{ref:"current"===t?f:void 0,"data-slot":"roadmap-item","data-status":t,"aria-label":c[t],className:(0,eI.cn)("relative grid grid-cols-[1.5rem_minmax(0,1fr)_auto] items-start gap-2 py-2.5",o),children:[(0,ey.jsx)("span",{"aria-hidden":"true","data-slot":"roadmap-marker",className:(0,eI.cn)("relative z-10 mt-1 size-2.5 rounded-full border bg-background","done"===t&&"border-muted-foreground bg-muted-foreground","current"===t&&"border-primary bg-primary","queued"===t&&"border-border","blocked"===t&&"border-destructive bg-destructive")}),(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("div",{"data-slot":"roadmap-title",className:(0,eI.cn)("text-sm leading-5","queued"===t&&"text-muted-foreground","blocked"===t&&"text-destructive"),children:e.title}),e.description?(0,ey.jsx)("div",{"data-slot":"roadmap-description",className:"mt-0.5 text-xs leading-5 text-muted-foreground",children:e.description}):null]}),e.meta?(0,ey.jsx)("div",{"data-slot":"roadmap-meta",className:"pt-0.5 text-right ui-text-kbd text-muted-foreground",children:e.meta}):null]},e.id)}),m>0?(0,ey.jsx)("div",{"aria-hidden":"true","data-slot":"roadmap-bottom-spacer",style:{height:m}}):null]})})})}let ZQ="/themes/jelly/bg1.png",Z0="/themes/jelly/bg2.png",Z1="/themes/jelly/bg3.png",Z2="/themes/jelly/bg4.png";function Z5({image:e,position:t="center",opacity:n=.72,blur:r="10px"}){return{"--vtl-jelly-card-image":`url("${e}")`,"--vtl-jelly-card-position":t,"--vtl-jelly-card-opacity":String(n),"--vtl-jelly-card-blur":r}}function Z4({title:e}){return(0,ey.jsx)("h2",{className:"h-7 text-sm font-semibold tracking-normal",children:e})}let Z3={product:"Vantaloom",overview:"运维总览",subtitle:"本机服务、工作组机器和 Agent 运行状态。",workgroup:"工作组",health:"系统健康",cost:"今日消耗",activeRuns:"运行中",queue:"排队任务",machineStatus:"机器状态",resourceTrend:"资源趋势",runMix:"运行构成",schedule:"日程提醒",incidents:"关注事项",online:"在线",local:"本机",p2p:"P2P",direct:"直连",sleeping:"休眠",memory:"内存",cpu:"CPU",gpu:"GPU",disk:"磁盘",theme:"主题"},Z6={search:"搜索控制台...",dashboard:"仪表盘",canvas:"画布",machines:"机器",schedules:"日程",settings:"设置",overview:"总览",runs:"运行",telemetry:"遥测",canvasRecent:"打开最近画布",canvasNew:"新建画布",canvasAll:"浏览所有画布",conversationRecent:"打开最近对话",conversationNew:"新建 Agent 对话",conversationAll:"浏览所有对话",fleet:"机器组",access:"访问控制",calendar:"计划任务",billing:"用量与账单"};Z3.local,Z3.direct,Z3.online,Z3.p2p,Z3.online,Z3.direct,Z3.sleeping,Z3.cpu,Z3.memory,Z3.activeRuns;function Z8(e){return e.reduce((e,t)=>Math.max(e,t.y+t.h),0)}function Z7({children:e}){return(0,ey.jsx)("section",{className:"vtl-app-background flex h-full min-h-0 flex-col pb-14 md:pb-0 text-foreground",children:(0,ey.jsx)(bQ,{className:"min-h-0 flex-1",children:e})})}function Z9(e){return Math.max(0,...e.map(e=>e.y+e.h))}function Je(e,t,n){return t.some(t=>t.id!==n&&e.x<t.x+t.w&&e.x+e.w>t.x&&e.y<t.y+t.h&&e.y+e.h>t.y)}function Jt(e){let t=Math.max(2,Math.min(12,e.w)),n=Math.max(1,e.h),r=Math.max(0,Math.min(12-t,e.x)),a=Math.max(0,e.y);return{...e,x:r,y:a,w:t,h:n}}function Jn(e,t,n,r,a){for(let i=0;i<Z9(e)+8;i+=1)for(let o=0;o<=12-r;o+=1){let l={id:t,kind:n,x:o,y:i,w:r,h:a};if(!Je(l,e))return l}return{id:t,kind:n,x:0,y:Z9(e)+2,w:r,h:a}}function Jr(e){return{...e.defaultConfig}}function Ja(e){return e.payloads?.[KL]}function Ji({open:e,definitions:t,title:n="添加卡片",description:r="搜索并选择要添加到当前页面的卡片。",groupTitle:a="可添加卡片",onOpenChange:i,onAdd:o}){return(0,ey.jsx)(vE,{open:e,onOpenChange:i,title:n,description:r,className:"top-1/2 max-w-xl -translate-y-1/2",children:(0,ey.jsxs)(vM,{loop:!0,children:[(0,ey.jsx)(vO,{placeholder:"搜索可添加卡片..."}),(0,ey.jsxs)(vP,{className:"max-h-[420px]",children:[(0,ey.jsx)(vA,{children:"没有找到可添加的卡片。"}),(0,ey.jsx)(vI,{heading:a,children:t.map(e=>(0,ey.jsxs)(vz,{value:`${e.title} ${e.description}`,keywords:[e.id,e.defaultConfig.dataSource,e.defaultConfig.title],onSelect:()=>o(e.id),className:"min-h-14 items-start py-2",children:[(0,ey.jsx)("span",{className:"mt-0.5 grid size-8 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:e.icon}),(0,ey.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,ey.jsx)("span",{className:"block truncate font-medium",children:e.title}),(0,ey.jsx)("span",{className:"mt-0.5 block truncate ui-text-kbd text-muted-foreground",children:e.description})]}),(0,ey.jsxs)(v_,{children:[e.defaultSize.w,"x",e.defaultSize.h]})]},e.id))})]})]})})}function Jo({open:e,dragMode:t,label:n="页面卡片操作",onOpenChange:r,onAdd:a,onDragModeChange:i}){let o=[{key:"add",label:"添加卡片",icon:(0,ey.jsx)(lV,{className:"size-4"}),onClick:a,pressed:!1},{key:"drag",label:"拖拽排版",icon:(0,ey.jsx)(lR,{className:"size-4"}),onClick:()=>i(!t),pressed:t}];return(0,ey.jsx)("div",{className:"fixed right-5 bottom-5 z-30",children:(0,ey.jsxs)("div",{className:"relative size-8",children:[o.map((t,n)=>(0,ey.jsx)(eA.Button,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.label,"aria-pressed":t.pressed,onClick:t.onClick,className:(0,eI.cn)("absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur transition-[opacity,transform] duration-150 ease-out",t.pressed&&"border-foreground bg-foreground text-background shadow-lg ring-1 ring-background/50 hover:bg-foreground hover:text-background dark:bg-primary dark:text-primary-foreground dark:hover:bg-primary",e?"pointer-events-auto opacity-100":"pointer-events-none translate-y-1 opacity-0"),style:{transform:e?`translateY(-${(n+1)*42}px)`:void 0},children:t.icon},t.key)),(0,ey.jsx)(eA.Button,{type:"button",variant:"outline",size:"icon-sm","aria-label":n,"aria-expanded":e,onClick:()=>r(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,ey.jsx)(lF,{className:(0,eI.cn)("size-4 transition-transform",e&&"rotate-90")})})]})})}let Jl=(0,ek.default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);function Js({layout:e,layouts:t,cellSize:n,cellHeight:r,dragMode:a,selected:i,resizing:o,onSelect:l,onMove:s,onCut:c,onCopy:u,onSettingsOpen:d,onResizeStart:f,onResizeEnd:h,children:p}){let[m,g]=ew.useState(!1),v=r??n,x=e.x*(n+12),y=e.y*(v+12),b=e.w*n+(e.w-1)*12,w=e.h*v+(e.h-1)*12;return(0,ey.jsxs)("div",{"data-editable-card":e.id,className:(0,eI.cn)("absolute rounded-lg p-1 transition-[left,top,width,height,box-shadow] duration-200 ease-out",a&&"cursor-grab active:cursor-grabbing",m&&"duration-150",i&&!o&&"z-20 shadow-sm",o&&"z-30 transition-none"),style:{left:x,top:y,width:b,height:w},onPointerDown:function(r){if(!a||o)return;let i=r.target;if(i instanceof HTMLElement&&i.closest("[data-editable-card-action]"))return;r.preventDefault(),r.currentTarget.setPointerCapture(r.pointerId),l();let c=r.clientX,u=r.clientY;function d(r){let a=Jt({...e,x:e.x+Math.round((r.clientX-c)/(n+12)),y:e.y+Math.round((r.clientY-u)/(n+12))});Je(a,t,e.id)||s(a)}g(!0),window.addEventListener("pointermove",d),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",d),window.removeEventListener("pointerup",e),g(!1)})},onClick:()=>{a&&l()},children:[(0,ey.jsx)("div",{className:(0,eI.cn)("size-full",a&&"pointer-events-none"),children:p}),i&&a&&!o?(0,ey.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-1 rounded-lg border-2 border-foreground"}):null,i&&a&&!o?(0,ey.jsx)(Jc,{onSettingsOpen:d,onCut:c,onCopy:u,onResizeStart:f}):null,o?(0,ey.jsx)(Ju,{layout:e,layouts:t,cellSize:n,onResize:s,onResizeEnd:h}):null]})}function Jc({onSettingsOpen:e,onCut:t,onCopy:n,onResizeStart:r}){return(0,ey.jsx)(lG,{"data-editable-card-action":!0,placement:"inline",size:"sm","aria-label":"卡片操作",className:"!absolute top-full left-1/2 z-40 mt-2 -translate-x-1/2 rounded-lg bg-popover/95 p-1 shadow-md",onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:(0,ey.jsxs)(lX,{children:[(0,ey.jsx)(lY,{type:"button","aria-label":"调整大小",onClick:r,children:(0,ey.jsx)(l$,{className:"size-4"})}),(0,ey.jsx)(lY,{type:"button","aria-label":"卡片设置",onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),e()},onClick:e=>e.stopPropagation(),children:(0,ey.jsx)(Jl,{className:"size-4"})}),(0,ey.jsx)(lY,{type:"button","aria-label":"复制",onClick:n,children:(0,ey.jsx)(l_,{className:"size-4"})}),(0,ey.jsx)(lY,{type:"button","aria-label":"剪切",onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),t()},onClick:e=>e.stopPropagation(),children:(0,ey.jsx)(lW,{className:"size-4"})})]})})}function Ju({layout:e,layouts:t,cellSize:n,onResize:r,onResizeEnd:a}){return(0,ey.jsx)("div",{"data-editable-card-action":!0,className:"pointer-events-none absolute inset-1 z-40 border-2 border-foreground",children:[{id:"top-left",className:"top-0 left-0 -translate-x-1/2 -translate-y-1/2 cursor-nwse-resize"},{id:"top",className:"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 cursor-ns-resize"},{id:"top-right",className:"top-0 right-0 translate-x-1/2 -translate-y-1/2 cursor-nesw-resize"},{id:"right",className:"top-1/2 right-0 translate-x-1/2 -translate-y-1/2 cursor-ew-resize"},{id:"bottom-right",className:"right-0 bottom-0 translate-x-1/2 translate-y-1/2 cursor-nwse-resize"},{id:"bottom",className:"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2 cursor-ns-resize"},{id:"bottom-left",className:"bottom-0 left-0 -translate-x-1/2 translate-y-1/2 cursor-nesw-resize"},{id:"left",className:"top-1/2 left-0 -translate-x-1/2 -translate-y-1/2 cursor-ew-resize"}].map(i=>(0,ey.jsx)("button",{type:"button","aria-label":`调整 ${i.id}`,className:(0,eI.cn)("pointer-events-auto absolute size-2.5 border border-foreground bg-background shadow-sm",i.className),onPointerDown:o=>(function(i,o){i.preventDefault(),i.stopPropagation(),i.currentTarget.setPointerCapture(i.pointerId);let l=i.clientX,s=i.clientY;function c(a){let i=Math.round((a.clientX-l)/(n+12)),c=Math.round((a.clientY-s)/(n+12)),u={...e};o.includes("right")&&(u.w=e.w+i),o.includes("bottom")&&(u.h=e.h+c),o.includes("left")&&(u.x=e.x+i,u.w=e.w-i),o.includes("top")&&(u.y=e.y+c,u.h=e.h-c),Je(u=Jt(u),t,e.id)||r(u)}window.addEventListener("pointermove",c),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",e),a()})})(o,i.id)},i.id))})}function Jd({className:e,...t}){return(0,ey.jsx)(up,{"data-slot":"sheet-overlay",className:(0,eI.cn)("vtl-overlay fixed inset-0 z-50 animate-in fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",e),...t})}function Jf({className:e,children:t,side:n="right",showCloseButton:r=!0,...a}){return(0,ey.jsxs)(uf,{children:[(0,ey.jsx)(Jd,{}),(0,ey.jsxs)(ux,{"data-slot":"sheet-content","data-side":n,className:(0,eI.cn)("vtl-surface-modal fixed z-50 flex flex-col gap-4 border transition ease-in-out outline-none data-[state=closed]:animate-out data-[state=closed]:duration-200 data-[state=open]:animate-in data-[state=open]:duration-300","right"===n&&"inset-y-0 right-0 h-full w-3/4 border-r-0 data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm","left"===n&&"inset-y-0 left-0 h-full w-3/4 border-l-0 data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm","top"===n&&"inset-x-0 top-0 h-auto border-t-0 data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top","bottom"===n&&"inset-x-0 bottom-0 h-auto border-b-0 data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",e),...a,children:[t,r&&(0,ey.jsxs)(uM,{className:"absolute top-3 right-3 inline-flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none disabled:pointer-events-none",children:[(0,ey.jsx)(d3.XIcon,{className:"size-4"}),(0,ey.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function Jh({className:e,...t}){return(0,ey.jsx)("div",{"data-slot":"sheet-header",className:(0,eI.cn)("grid gap-1.5 p-4 text-left",e),...t})}function Jp({className:e,...t}){return(0,ey.jsx)(uk,{"data-slot":"sheet-title",className:(0,eI.cn)("text-base leading-none font-semibold text-foreground",e),...t})}function Jm({className:e,...t}){return(0,ey.jsx)(uC,{"data-slot":"sheet-description",className:(0,eI.cn)("text-sm text-muted-foreground",e),...t})}function Jg({open:e,layout:t,definition:n,config:r,cellSize:a,onOpenChange:i,onConfigChange:o}){let l=t&&a>0?t.w*a+(t.w-1)*12:320,s=t&&a>0?t.h*a+(t.h-1)*12:180;return(0,ey.jsx)(uo,{open:e,onOpenChange:i,children:(0,ey.jsx)(Jf,{side:"right",className:"w-screen gap-0 border-0 bg-transparent p-0 shadow-none sm:max-w-none",children:t&&n&&r?(0,ey.jsxs)("div",{className:"grid h-full min-w-0 grid-cols-1 lg:grid-cols-[minmax(0,1fr)_24rem]",children:[(0,ey.jsx)(Jv,{width:l,height:s,className:"hidden lg:grid",children:n.render(r)}),(0,ey.jsxs)("div",{className:"animate-in slide-in-from-right-4 flex h-full w-full flex-col border-y-0 border-r-0 bg-background text-foreground shadow-lg duration-300",children:[(0,ey.jsxs)(Jh,{className:"border-b",children:[(0,ey.jsx)(Jp,{children:"卡片设置"}),(0,ey.jsxs)(Jm,{children:[n.title," · ",t.w,"x",t.h]})]}),(0,ey.jsxs)("div",{className:"grid flex-1 content-start gap-4 overflow-y-auto p-4",children:[(0,ey.jsxs)("label",{className:"grid gap-1.5",children:[(0,ey.jsx)("span",{className:"ui-text-control font-medium",children:"显示标题"}),(0,ey.jsx)(ez,{value:r.title,onChange:e=>o({title:e.currentTarget.value})})]}),(0,ey.jsxs)("label",{className:"grid gap-1.5",children:[(0,ey.jsx)("span",{className:"ui-text-control font-medium",children:"数据来源"}),(0,ey.jsx)(ez,{value:r.dataSource,onChange:e=>o({dataSource:e.currentTarget.value})})]}),(0,ey.jsxs)("label",{className:"grid gap-1.5",children:[(0,ey.jsx)("span",{className:"ui-text-control font-medium",children:"刷新间隔"}),(0,ey.jsx)(ez,{value:r.refreshRate,onChange:e=>o({refreshRate:e.currentTarget.value})})]}),(0,ey.jsxs)("label",{className:"grid gap-1.5",children:[(0,ey.jsx)("span",{className:"ui-text-control font-medium",children:"备注"}),(0,ey.jsx)("textarea",{value:r.note,rows:4,className:"min-h-24 resize-none rounded-lg border border-input bg-transparent px-2.5 py-2 ui-text-control transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",onChange:e=>o({note:e.currentTarget.value})})]}),(0,ey.jsxs)("div",{className:"rounded-lg border bg-muted/20 p-3",children:[(0,ey.jsx)("div",{className:"ui-text-control font-medium",children:"当前绑定"}),(0,ey.jsxs)("div",{className:"mt-2 grid gap-1 ui-text-kbd text-muted-foreground",children:[(0,ey.jsxs)("span",{children:["类型:",n.id]}),(0,ey.jsxs)("span",{children:["来源:",r.dataSource]}),(0,ey.jsxs)("span",{children:["刷新:",r.refreshRate]})]})]})]})]})]}):null})})}function Jv({width:e,height:t,className:n,children:r}){let[a,i]=Go(),o=i.width>0&&i.height>0?Math.min(1,(i.width-32)/e,(i.height-32)/t):1;return(0,ey.jsx)("div",{ref:a,className:(0,eI.cn)("min-h-0 min-w-0 place-items-center overflow-hidden p-4",n),children:(0,ey.jsx)("div",{className:"animate-in fade-in-0 zoom-in-95 origin-center rounded-lg duration-300",style:{width:e,height:t,transform:`scale(${Math.max(.1,o)})`},children:r})})}function Jx({boardId:e,definitions:t,initialLayouts:n,clipboardItems:r=[],minRows:a=9,className:i,actionLabel:o,paletteGroupTitle:l,onClipboardItemsChange:s,onOverlayOpenChange:c}){var u;let[d,f]=ew.useState(!1),[h,p]=ew.useState(!1),[m,g]=ew.useState(!1),[v,x]=ew.useState(()=>n),[y,b]=ew.useState({}),[w,j]=ew.useState(),[k,S]=ew.useState(),[C,N]=ew.useState(),M=ew.useRef(0),E=ew.useRef(0),[O,P]=Go(),A=P.width>0?(u=P.width)<480?2:u<768?4:12:12,I=function(e,t){if(t>=12)return e;let n=[...e].sort((e,t)=>e.y!==t.y?e.y-t.y:e.x-t.x),r=[];for(let e of n){let n=Math.max(2,Math.min(t,Math.round(e.w*t/12))),a=e.h,i=!1;for(let o=0;o<Z8(r)+8&&!i;o+=1)for(let l=0;l<=t-n&&!i;l+=1){let t={...e,x:l,y:o,w:n,h:a};!function(e,t){return t.some(t=>e.x<t.x+t.w&&e.x+e.w>t.x&&e.y<t.y+t.h&&e.y+e.h>t.y)}(t,r)&&(r.push(t),i=!0)}i||r.push({...e,x:0,y:Z8(r),w:n,h:a})}return r}(v,A),z=P.width>0?(P.width-12*(A-1))/A:96,_=A<12?72:z,D=Math.max(a,Z9(I)+2),R=D*_+(D-1)*12,T=ew.useMemo(()=>new Map(t.map(e=>[e.id,e])),[t]);function L(e){let t=T.get(e.kind);return y[e.id]??(t?Jr(t):void 0)}function $(e){x(t=>{let n=Jt(e);return Je(n,t,n.id)?t:t.map(e=>e.id===n.id?n:e)})}function F(e){let t=T.get(e);if(!t)return;E.current+=1;let n=`${e}-added-${E.current}`,r=Jn(v,n,e,t.defaultSize.w,t.defaultSize.h);x(e=>[...e,r]),b(e=>({...e,[n]:Jr(t)})),j(n),S(void 0),p(!1)}function B(e,t){let n=v.find(t=>t.id===e),r=n?T.get(n.kind):void 0;n&&r&&b(n=>({...n,[e]:{...n[e]??Jr(r),...t}}))}ew.useEffect(()=>{c?.(h||!!C)},[h,c,C]),ew.useEffect(()=>()=>c?.(!1),[c]),ew.useEffect(()=>{m||(j(void 0),S(void 0))},[m]),ew.useEffect(()=>{if(k)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof HTMLElement&&t.closest("[data-editable-card-action]")||(j(k),S(void 0))}},[k]);let V=A<12,H=C?v.find(e=>e.id===C):void 0,W=H?T.get(H.kind):void 0,U=H?L(H):void 0;if(V){let n=[...I].sort((e,t)=>e.y-t.y||e.x-t.x),r=Object.fromEntries(v.map(e=>[e.id,e.w]));return(0,ey.jsxs)(Z7,{children:[(0,ey.jsx)("div",{ref:O,"data-editable-card-board":e,className:(0,eI.cn)("mx-auto max-w-7xl p-3",i),children:(0,ey.jsx)("div",{className:"grid grid-cols-2 gap-3",children:n.map(e=>{let t=T.get(e.kind);if(!t)return null;let n=L(e);if(!n)return null;let a=(r[e.id]??e.w)>6;return(0,ey.jsx)("div",{className:(0,eI.cn)("min-w-0 overflow-hidden rounded-lg",a&&"col-span-2"),style:{minHeight:a?200:120},children:t.render(n)},e.id)})})}),(0,ey.jsx)(Jo,{open:d,dragMode:!1,label:o,onOpenChange:f,onAdd:()=>{f(!1),p(!0)},onDragModeChange:g}),(0,ey.jsx)(Ji,{open:h,definitions:t,groupTitle:l,onOpenChange:p,onAdd:F}),(0,ey.jsx)(Jg,{open:!!(H&&W&&U),layout:H,definition:W,config:U,cellSize:z,onOpenChange:e=>{e||N(void 0)},onConfigChange:e=>{H&&B(H.id,e)}})]})}return(0,ey.jsxs)(Z7,{children:[(0,ey.jsx)("div",{ref:O,"data-editable-card-board":e,className:(0,eI.cn)("relative mx-auto max-w-7xl p-4 lg:p-6",m&&"select-none",i),style:{minHeight:R+48},onDragOver:e=>{Array.from(e.dataTransfer.types).includes(KL)&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},onDrop:function(e){let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id");if(!t)return;let n=r.find(e=>e.id===t),a=n&&Ja(n);if(!n||!a||!T.has(a.kind))return;e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move";let i=O.current,o=i?.getBoundingClientRect();!function(e,t){let n=Ja(e);if(!n||!T.has(n.kind))return;E.current+=1;let r=`${n.kind}-clip-${E.current}`,a=Jt({id:r,kind:n.kind,x:t?.x??0,y:t?.y??Z9(v),w:n.w,h:n.h}),i=t&&!Je(a,v)?a:Jn(v,r,n.kind,n.w,n.h);x(e=>[...e,i]),b(e=>({...e,[r]:{...n.config}})),j(r),S(void 0)}(n,{x:o&&z>0?Math.round((e.clientX-o.left-24)/(z+12)):0,y:o&&z>0?Math.round((e.clientY-o.top-24)/(z+12)):Z9(v)})},onPointerDown:e=>{e.target===e.currentTarget&&(j(void 0),m||S(void 0))},children:(0,ey.jsx)("div",{className:"relative",style:{height:R},children:I.map(t=>{let n=T.get(t.kind);if(!n)return null;let r=L(t);return r?(0,ey.jsx)(Js,{layout:t,layouts:I,cellSize:z,cellHeight:_,dragMode:m,selected:w===t.id,resizing:k===t.id,onSelect:()=>{m&&j(t.id)},onMove:$,onCut:()=>(function(t){let n=v.find(e=>e.id===t),r=n?T.get(n.kind):void 0,a=n?L(n):void 0;if(!n||!r||!a)return;let i=function({boardId:e,layout:t,definition:n,config:r}){let a={boardId:e,kind:t.kind,w:t.w,h:t.h,config:{...r}};return{id:`clip-${e}-${t.id}`,title:r.title||n.title,description:n.description,meta:`${t.w}x${t.h}`,icon:n.icon,dragData:{"application/vnd.vantaloom.clip-kind":"workspace-card","application/vnd.vantaloom.workspace-card-board":e,"application/vnd.vantaloom.workspace-card-kind":t.kind,"application/vnd.vantaloom.workspace-card-width":String(t.w),"application/vnd.vantaloom.workspace-card-height":String(t.h),"application/vnd.vantaloom.workspace-card-config":JSON.stringify(r),[KL]:JSON.stringify(a)},payloads:{[KL]:a}}}({boardId:e,layout:n,definition:r,config:a});s?.(e=>[i,...e.filter(e=>e.id!==i.id)]),x(e=>e.filter(e=>e.id!==t)),b(e=>{let n={...e};return delete n[t],n}),j(void 0),S(void 0),N(e=>e===t?void 0:e)})(t.id),onCopy:()=>(function(e){let t=v.find(t=>t.id===e),n=t?T.get(t.kind):void 0;if(!t||!n)return;M.current+=1;let r=`${e}-copy-${M.current}`,a=Jn(v,r,t.kind,t.w,t.h);x(e=>[...e,a]),b(t=>({...t,[r]:t[e]??Jr(n)})),j(r)})(t.id),onSettingsOpen:()=>N(t.id),onResizeStart:()=>{j(void 0),S(t.id)},onResizeEnd:()=>{j(t.id),S(void 0)},children:n.render(r)},t.id):null})})}),(0,ey.jsx)(Jo,{open:d,dragMode:m,label:o,onOpenChange:f,onAdd:()=>{f(!1),p(!0)},onDragModeChange:g}),(0,ey.jsx)(Ji,{open:h,definitions:t,groupTitle:l,onOpenChange:p,onAdd:F}),(0,ey.jsx)(Jg,{open:!!(H&&W&&U),layout:H,definition:W,config:U,cellSize:z,onOpenChange:e=>{e||N(void 0)},onConfigChange:e=>{H&&B(H.id,e)}})]})}function Jy({parts:e}){return(0,ey.jsx)(ey.Fragment,{children:e.map((e,t)=>(0,ey.jsx)("span",{className:e.small?"text-[0.55em]":void 0,children:e.text},`${e.text}-${t}`))})}function Jb({value:e,minSize:t=24,maxSize:n=180,className:r,...a}){let i=ew.useRef(null),o=ew.useRef(null),[l,s]=ew.useState(t),c=function(e){let t=e.trim();if(/^[$¥€]\s*\d/.test(t))return[{text:t.replace(/^[$¥€]\s*/,""),small:!1},{text:t[0]??"",small:!0}];let n=t.match(/^(.+?)\s*\/\s*(.+)$/);if(n)return[{text:n[1]??"",small:!1},{text:"/",small:!0},{text:n[2]??"",small:!1}];let r=t.match(/^(.+?)([%a-zA-Z$¥€]+)$/);return r?[{text:r[1]??t,small:!1},{text:r[2]??"",small:!0}]:[{text:t,small:!1}]}(e);return ew.useLayoutEffect(()=>{let e=i.current,r=o.current;if(!e||!r)return;function a(e,r){let a=e.clientWidth,i=e.clientHeight;if(a<=0||i<=0)return;let o=t,l=n,c=t;for(;o<=l;){let e=Math.floor((o+l)/2);r.style.fontSize=`${e}px`,r.getBoundingClientRect().width<=a&&r.getBoundingClientRect().height<=i?(c=e,o=e+1):l=e-1}s(c)}a(e,r);let l=new ResizeObserver(()=>a(e,r));return l.observe(e),()=>l.disconnect()},[n,t,e]),(0,ey.jsxs)("div",{ref:i,className:(0,eI.cn)("relative min-h-0 min-w-0 overflow-hidden",r),...a,children:[(0,ey.jsx)("span",{ref:o,"aria-hidden":"true",className:"pointer-events-none invisible absolute right-0 bottom-0 flex items-baseline whitespace-nowrap font-semibold leading-none tracking-normal",children:(0,ey.jsx)(Jy,{parts:c})}),(0,ey.jsx)("span",{className:"absolute right-0 bottom-0 flex max-w-full items-baseline whitespace-nowrap font-semibold leading-none tracking-normal text-foreground",style:{fontSize:l},children:(0,ey.jsx)(Jy,{parts:c})})]})}function Jw(e){return/^\d+$/.test(e)&&1===e.length?`0${e}`:/^\d+(?:\.\d+)?%$/.test(e)?`${Number.parseFloat(e).toFixed(1)}%`:e}function Jj({label:e,value:t,minSize:n=42,maxSize:r=180,valueClassName:a="absolute right-0 bottom-0 h-2/3 w-full"}){return(0,ey.jsxs)("div",{className:"relative h-full min-h-0",children:[(0,ey.jsx)("div",{className:"text-xl font-semibold tracking-normal",children:e}),(0,ey.jsx)(Jb,{value:Jw(t),minSize:n,maxSize:r,className:a})]})}function Jk(e){return Math.max(0,Math.min(100,Math.round(e)))}function JS({className:e,value:t=0,...n}){let r=Jk(t);return(0,ey.jsx)("div",{"data-slot":"progress",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r,className:(0,eI.cn)("relative h-1.5 w-full overflow-hidden rounded-full bg-muted",e),...n,children:(0,ey.jsx)("div",{"data-slot":"progress-indicator",className:"h-full rounded-full bg-primary transition-all",style:{width:`${r}%`}})})}function JC({className:e,value:t=0,label:n,showValue:r=!0,...a}){let i=Jk(t),o=2*Math.PI*39;return(0,ey.jsxs)("div",{"data-slot":"progress-ring","aria-label":n?`${n} ${i}%`:`${i}%`,role:"img",className:(0,eI.cn)("relative grid size-24 place-items-center",e),...a,children:[(0,ey.jsxs)("svg",{"aria-hidden":"true","data-slot":"progress-ring-svg",viewBox:"0 0 100 100",className:"absolute inset-0 size-full overflow-visible",children:[(0,ey.jsx)("circle",{cx:"50",cy:"50",r:39,fill:"none",stroke:"var(--muted)",strokeWidth:12}),i>0&&(0,ey.jsx)("circle",{cx:"50",cy:"50",r:39,fill:"none",stroke:"var(--primary)",strokeDasharray:o,strokeDashoffset:o-i/100*o,strokeLinecap:"round",strokeWidth:12,className:"origin-center -rotate-90 transition-all"})]}),(0,ey.jsx)("div",{"data-slot":"progress-ring-center",className:"relative z-10 grid size-16 place-items-center rounded-full bg-card",children:r&&(0,ey.jsxs)("span",{className:"ui-text-control font-medium tabular-nums",children:[i,"%"]})})]})}(0,ek.default)("timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);let JN=(0,ek.default)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);function JM({canvases:e,mode:t="active",scrollable:n=!1,onSelect:r}){let a=ew.useMemo(()=>e.map(e=>{var n;return{id:e.id,status:"live"===(n=e).status?"current":"review"===n.status?"blocked":"done",title:(0,ey.jsx)(JE,{canvas:e,mode:t,onClick:()=>r(e)})}}),[e,t,r]);return(0,ey.jsx)(ZJ,{items:a,scrollCurrentIntoView:!1,className:(0,eI.cn)("mt-2",n&&"min-h-0 flex-1"),viewportClassName:(0,eI.cn)("max-h-none pr-0",n?"h-full overflow-y-auto":"overflow-visible"),itemClassName:"py-2"})}function JE({canvas:e,onClick:t,mode:n}){return(0,ey.jsxs)("button",{type:"button",className:(0,eI.cn)("grid w-full items-center gap-4 rounded-lg px-2 py-0 text-left transition-colors hover:bg-muted/50","active"===n?"grid-cols-[minmax(0,1fr)_8rem_1.75rem]":"grid-cols-[minmax(0,1fr)_7rem_7rem_8rem]"),onClick:t,children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("div",{className:"truncate text-sm font-medium",children:e.title}),(0,ey.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:"active"===n?e.purpose:`${e.nodes} nodes`})]}),"active"===n?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(JS,{value:e.progress,className:"h-1.5"}),(0,ey.jsx)("span",{"aria-label":e.progress>=100?"Canvas complete":"Canvas incomplete",className:(0,eI.cn)("size-2.5 rounded-full",e.progress>=100?"bg-primary":"bg-border")})]}):(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(JO,{icon:(0,ey.jsx)(BT,{}),value:`${e.snapshots}`}),(0,ey.jsx)(JO,{icon:(0,ey.jsx)(JN,{}),value:e.runtime}),(0,ey.jsx)("div",{className:"text-right ui-text-kbd text-muted-foreground",children:e.lastOpened})]})]})}function JO({icon:e,value:t}){return(0,ey.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,ey.jsx)("span",{className:"[&_svg]:size-3.5",children:e}),(0,ey.jsx)("span",{className:"tabular-nums",children:t})]})}let JP=(0,ek.default)("memory-stick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]),JA=(0,ek.default)("radio-tower",[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]]),JI=(0,ek.default)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);(0,ek.default)("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);var Jz=ew;function J_(){return(J_=Object.assign.bind()).apply(null,arguments)}function JD(e){return ew.createElement(_N,J_({shapeType:"rectangle",activeClassName:"recharts-active-bar",inActiveClassName:"recharts-inactive-bar"},e))}var JR=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(n,r)=>{if(jI(e))return e;var a=jI(n)||null==n;return a?e(n,r):(a||function(e,t){if(!e)throw Error("Invariant failed")}(!1,"minPointSize callback function received a value with type of ".concat(typeof n,". Currently only numbers or null/undefined are supported.")),t)}},JT=["children"],JL=(0,ew.createContext)({data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function J$(e){var{children:t}=e,n=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,JT);return ew.createElement(JL.Provider,{value:n},t)}var JF=(e,t,n)=>{var r=null!=n?n:e;if(null!=r)return jR(r,t,0)};function JB(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function JV(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?JB(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):JB(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var JH=jc([Pe,(e,t)=>t],(e,t)=>e.filter(e=>"bar"===e.type).find(e=>e.id===t)),JW=jc([JH],e=>null==e?void 0:e.maxBarSize),JU=jc([CT,Pe,GG,GX,(e,t,n)=>n],(e,t,n,r,a)=>t.filter(t=>"horizontal"===e?t.xAxisId===n:t.yAxisId===r).filter(e=>e.isPanorama===a).filter(e=>!1===e.hide).filter(e=>"bar"===e.type)),Jq=jc([JU,e=>e.rootProps.barSize,(e,t)=>{var n=CT(e),r=GG(e,t),a=GX(e,t);if(null!=r&&null!=a)return"horizontal"===n?Aj(e,"xAxis",r):Aj(e,"yAxis",a)}],(e,t,n)=>{var r=e.filter(NS),a=e.filter(e=>null==e.stackId);return[...Object.entries(r.reduce((e,t)=>{var n=e[t.stackId];return null==n&&(n=[]),n.push(t),e[t.stackId]=n,e},{})).map(e=>{var r,[a,i]=e;return{stackId:a,dataKeys:i.map(e=>e.dataKey),barSize:JF(t,n,null==(r=i[0])?void 0:r.barSize)}}),...a.map(e=>({stackId:void 0,dataKeys:[e.dataKey].filter(e=>null!=e),barSize:JF(t,n,e.barSize)}))]}),JK=(e,t,n)=>{var r,a,i=CT(e),o=GG(e,t),l=GX(e,t);if(null!=o&&null!=l)return"horizontal"===i?(r=AE(e,"xAxis",o,n),a=AM(e,"xAxis",o,n)):(r=AE(e,"yAxis",l,n),a=AM(e,"yAxis",l,n)),j4(r,a)},JG=jc([Jq,CQ,e=>e.rootProps.barGap,C0,(e,t,n)=>{var r,a,i,o,l=JH(e,t);if(null==l)return 0;var s=GG(e,t),c=GX(e,t);if(null==s||null==c)return 0;var u=CT(e),d=CQ(e),{maxBarSize:f}=l;return"horizontal"===u?(i=AE(e,"xAxis",s,n),o=AM(e,"xAxis",s,n)):(i=AE(e,"yAxis",c,n),o=AM(e,"yAxis",c,n)),null!=(r=null!=(a=j4(i,o,!0))?a:null==f?d:f)?r:0},JK,JW],(e,t,n,r,a,i,o)=>{var l=function(e,t,n,r,a){var i,o,l=r.length;if(!(l<1)){var s=jR(e,n,0,!0),c=[];if(jW(null==(i=r[0])?void 0:i.barSize)){var u=!1,d=n/l,f=r.reduce((e,t)=>e+(t.barSize||0),0);(f+=(l-1)*s)>=n&&(f-=(l-1)*s,s=0),f>=n&&d>0&&(u=!0,d*=.9,f=l*d);var h={offset:((n-f)/2|0)-s,size:0};o=r.reduce((e,t)=>{var n,r={stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:h.offset+h.size+s,size:u?d:null!=(n=t.barSize)?n:0}},a=[...e,r];return h=r.position,a},c)}else{var p=jR(t,n,0,!0);n-2*p-(l-1)*s<=0&&(s=0);var m=(n-2*p-(l-1)*s)/l;m>1&&(m>>=0);var g=jW(a)?Math.min(m,a):m;o=r.reduce((e,t,n)=>[...e,{stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:p+(m+s)*n+(m-g)/2,size:g}}],c)}return o}}(n,r,a!==i?a:i,e,null==o?t:o);return a!==i&&null!=l&&(l=l.map(e=>JV(JV({},e),{},{position:JV(JV({},e.position),{},{offset:e.position.offset-a/2})}))),l}),JX=jc([JG,JH],(e,t)=>{if(null!=e&&null!=t){var n=e.find(e=>e.stackId===t.stackId&&null!=t.dataKey&&e.dataKeys.includes(t.dataKey));if(null!=n)return n.position}}),JY=jc([(e,t,n)=>{var r=CT(e),a=GG(e,t),i=GX(e,t);if(null!=a&&null!=i)return"horizontal"===r?PC(e,"yAxis",i,n):PC(e,"xAxis",a,n)},JH],(e,t)=>{var n=Nj(t);if(!e||null==n||null==t)return;var{stackId:r}=t;if(null!=r){var a=e[r];if(a){var{stackedData:i}=a;if(i)return i.find(e=>e.key===n)}}}),JZ=jc([kl,kc,(e,t,n)=>{var r=GG(e,t);if(null!=r)return AE(e,"xAxis",r,n)},(e,t,n)=>{var r=GX(e,t);if(null!=r)return AE(e,"yAxis",r,n)},(e,t,n)=>{var r=GG(e,t);if(null!=r)return AM(e,"xAxis",r,n)},(e,t,n)=>{var r=GX(e,t);if(null!=r)return AM(e,"yAxis",r,n)},JX,CT,jp,JK,JY,JH,(e,t,n,r)=>r],(e,t,n,r,a,i,o,l,s,c,u,d,f)=>{var h,{chartData:p,dataStartIndex:m,dataEndIndex:g}=s;if(null!=d&&null!=o&&null!=t&&("horizontal"===l||"vertical"===l)&&null!=n&&null!=r&&null!=a&&null!=i&&null!=c){var{data:v}=d;if(null!=(h=null!=v&&v.length>0?v:null==p?void 0:p.slice(m,g+1)))return function(e){var{layout:t,barSettings:{dataKey:n,minPointSize:r,hasCustomShape:a},pos:i,bandSize:o,xAxis:l,yAxis:s,xAxisTicks:c,yAxisTicks:u,stackedData:d,displayedData:f,offset:h,cells:p,parentViewBox:m,dataStartIndex:g}=e,v="horizontal"===t?s:l,x=d?v.scale.domain():null,y=(e=>{var{numericAxis:t}=e,n=t.scale.domain();if("number"===t.type){var r=Math.min(n[0],n[1]),a=Math.max(n[0],n[1]);return r<=0&&a>=0?0:a<0?a:r}return n[0]})({numericAxis:v}),b=v.scale.map(y);return f.map((e,f)=>{if(d){var v=d[f+g];if(null==v)return null;j=((e,t)=>{if(!t||2!==t.length||!jI(t[0])||!jI(t[1]))return e;var n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),a=[e[0],e[1]];return(!jI(e[0])||e[0]<n)&&(a[0]=n),(!jI(e[1])||e[1]>r)&&(a[1]=r),a[0]>r&&(a[0]=r),a[1]<n&&(a[1]=n),a})(v,x)}else Array.isArray(j=jG(e,n))||(j=[y,j]);var w=JR(r,0)(j[1],f);if("horizontal"===t){var j,k,S,C,N,M,E,O=s.scale.map(j[0]),P=s.scale.map(j[1]);if(null==O||null==P)return null;k=j1({axis:l,ticks:c,bandSize:o,offset:i.offset,entry:e,index:f}),S=null!=(E=null!=P?P:O)?E:void 0,C=i.size;var A=O-P;if(N=jP(A)?0:A,M={x:k,y:h.top,width:C,height:h.height},Math.abs(w)>0&&Math.abs(N)<Math.abs(w)){var I=jO(N||w)*(Math.abs(w)-Math.abs(N));S-=I,N+=I}}else{var z=l.scale.map(j[0]),_=l.scale.map(j[1]);if(null==z||null==_)return null;if(k=z,S=j1({axis:s,ticks:u,bandSize:o,offset:i.offset,entry:e,index:f}),C=_-z,N=i.size,M={x:h.left,y:S,width:h.width,height:N},Math.abs(w)>0&&Math.abs(C)<Math.abs(w)){var D=jO(C||w)*(Math.abs(w)-Math.abs(C));C+=D}}return null!=k&&null!=S&&null!=C&&null!=N&&(a||0!==C&&0!==N)?Qa(Qa({},e),{},{stackedBarStart:b,x:k,y:S,width:C,height:N,value:d?j:j[1],payload:e,background:M,tooltipPosition:{x:k+C/2,y:S+N/2},parentViewBox:m,originalDataIndex:f},p&&p[f]&&p[f].props):null}).filter(Boolean)}({layout:l,barSettings:d,pos:o,parentViewBox:t,bandSize:c,xAxis:n,yAxis:r,xAxisTicks:a,yAxisTicks:i,stackedData:u,displayedData:h,offset:e,cells:f,dataStartIndex:m})}}),JJ=(e,t)=>t,JQ=(e,t,n)=>n,J0=jc([JJ,Pe,JQ],(e,t,n)=>t.filter(e=>"bar"===e.type).filter(t=>t.stackId===e).filter(e=>e.isPanorama===n).filter(e=>!e.hide)),J1=jc([J0],e=>e.map(e=>e.id)),J2=jc([e=>e,JJ,JQ],(e,t,n)=>{var r=J1(e,t,n),a=[];return r.forEach(t=>{var r=JZ(e,t,n,void 0);null==r||r.forEach(e=>{var t=e.originalDataIndex;a[t]=((e,t)=>{if(!e)return t;if(!t)return e;var n=Math.min(e.x,e.x+e.width,t.x,t.x+t.width),r=Math.min(e.y,e.y+e.height,t.y,t.y+t.height);return{x:n,y:r,width:Math.max(e.x,e.x+e.width,t.x,t.x+t.width)-n,height:Math.max(e.y,e.y+e.height,t.y,t.y+t.height)-r}})(a[t],e)})}),a}),J5=["index"];function J4(){return(J4=Object.assign.bind()).apply(null,arguments)}var J3=(0,ew.createContext)(void 0),J6=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),J8=e=>{var{index:t}=e,n=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,J5),r=(e=>{var t=(0,ew.useContext)(J3);if(null!=t){var{stackId:n}=t;return"url(#".concat(J6(n,e),")")}})(t);return ew.createElement(A7,J4({className:"recharts-bar-stack-layer",clipPath:r},n))},J7=["onMouseEnter","onMouseLeave","onClick"],J9=["value","background","tooltipPosition"],Qe=["id"],Qt=["onMouseEnter","onClick","onMouseLeave"];function Qn(){return(Qn=Object.assign.bind()).apply(null,arguments)}function Qr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Qa(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qr(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qr(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Qi(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var Qo=Jz.memo(e=>{var{dataKey:t,stroke:n,strokeWidth:r,fill:a,name:i,hide:o,unit:l,tooltipType:s,id:c}=e,u={dataDefinedOnItem:void 0,getPosition:jV,settings:{stroke:n,strokeWidth:r,fill:a,dataKey:t,nameKey:void 0,name:j6(i,t),hide:o,type:s,color:a,unit:l,graphicalItemId:c}};return Jz.createElement(Dw,{tooltipEntrySettings:u})});function Ql(e){var t,n=kv(Rm),{data:r,dataKey:a,background:i,allOtherBarProps:o}=e,{onMouseEnter:l,onMouseLeave:s,onClick:c}=o,u=Qi(o,J7),d=Dx(l,a,o.id),f=Dy(s),h=Db(c,a,o.id);if(!i||null==r)return null;var p=A4(i);return Jz.createElement(R3,{zIndex:(t=Nn.barBackground,i&&"object"==typeof i&&"zIndex"in i&&"number"==typeof i.zIndex&&jW(i.zIndex)?i.zIndex:t)},r.map((e,t)=>{var{value:r,background:o,tooltipPosition:l}=e,s=Qi(e,J9);if(!o)return null;var c=d(e,t),m=f(e,t),g=h(e,t),v=Qa(Qa(Qa(Qa(Qa({option:i,isActive:String(t)===n},s),{},{fill:"#eee"},o),p),IO(u,e,t)),{},{onMouseEnter:c,onMouseLeave:m,onClick:g,dataKey:a,index:t,className:"recharts-bar-background-rectangle"});return Jz.createElement(JD,Qn({key:"background-bar-".concat(t)},v))}))}function Qs(e){var{showLabels:t,children:n,rects:r}=e,a=null==r?void 0:r.map(e=>{var t={x:e.x,y:e.y,width:e.width,lowerWidth:e.width,upperWidth:e.width,height:e.height};return Qa(Qa({},t),{},{value:e.value,payload:e.payload,parentViewBox:e.parentViewBox,viewBox:t,fill:e.fill})});return Jz.createElement(Ty,{value:t?a:void 0},n)}function Qc(e){var t,{shape:n,activeBar:r,baseProps:a,entry:i,index:o,dataKey:l}=e,s=kv(Rm),c=kv(Rv),u=r&&String(i.originalDataIndex)===s&&(null==c||l===c),[d,f]=(0,Jz.useState)(!1),[h,p]=(0,Jz.useState)(!1);(0,Jz.useEffect)(()=>{var e;return u?(f(!0),e=requestAnimationFrame(()=>{p(!0)})):p(!1),()=>{cancelAnimationFrame(e)}},[u]);var m=(0,Jz.useCallback)(()=>{u||f(!1)},[u]),g=u&&h,v=u||d;t=u?!0===r?n:r:n;var x=Jz.createElement(JD,Qn({},a,{name:String(a.name)},i,{isActive:g,option:t,index:o,dataKey:l,onTransitionEnd:m}));return v?Jz.createElement(R3,{zIndex:Nn.activeBar},Jz.createElement(J8,{index:i.originalDataIndex},x)):x}function Qu(e){var{shape:t,baseProps:n,entry:r,index:a,dataKey:i}=e;return Jz.createElement(JD,Qn({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:a,dataKey:i}))}function Qd(e){var t,{data:n,props:r}=e,a=null!=(t=A5(r))?t:{},{id:i}=a,o=Qi(a,Qe),{shape:l,dataKey:s,activeBar:c}=r,{onMouseEnter:u,onClick:d,onMouseLeave:f}=r,h=Qi(r,Qt),p=Dx(u,s,i),m=Dy(f),g=Db(d,s,i);return n?Jz.createElement(Jz.Fragment,null,n.map((e,t)=>Jz.createElement(J8,Qn({index:e.originalDataIndex,key:"rectangle-".concat(null==e?void 0:e.x,"-").concat(null==e?void 0:e.y,"-").concat(null==e?void 0:e.value,"-").concat(t),className:"recharts-bar-rectangle"},IO(h,e,t),{onMouseEnter:p(e,t),onMouseLeave:m(e,t),onClick:g(e,t)}),c?Jz.createElement(Qc,{shape:l,activeBar:c,baseProps:o,entry:e,index:t,dataKey:s}):Jz.createElement(Qu,{shape:l,baseProps:o,entry:e,index:t,dataKey:s})))):null}function Qf(e){var{props:t,previousRectanglesRef:n}=e,{data:r,layout:a,isAnimationActive:i,animationBegin:o,animationDuration:l,animationEasing:s,onAnimationEnd:c,onAnimationStart:u}=t,d=n.current,f=zF(t,"recharts-bar-"),[h,p]=(0,Jz.useState)(!1),m=(0,Jz.useCallback)(()=>{"function"==typeof c&&c(),p(!1)},[c]),g=(0,Jz.useCallback)(()=>{"function"==typeof u&&u(),p(!0)},[u]);return Jz.createElement(Qs,{showLabels:!h,rects:r},Jz.createElement(z$,{animationId:f,begin:o,duration:l,isActive:i,easing:s,onAnimationEnd:m,onAnimationStart:g,key:f},e=>{var i=1===e?r:null==r?void 0:r.map((t,n)=>{var r=d&&d[n];if(r)return Qa(Qa({},t),{},{x:jL(r.x,t.x,e),y:jL(r.y,t.y,e),width:jL(r.width,t.width,e),height:jL(r.height,t.height,e)});if("horizontal"===a){var i=jL(0,t.height,e),o=jL(t.stackedBarStart,t.y,e);return Qa(Qa({},t),{},{y:o,height:i})}var l=jL(0,t.width,e),s=jL(t.stackedBarStart,t.x,e);return Qa(Qa({},t),{},{width:l,x:s})});return(e>0&&(n.current=null!=i?i:null),null==i)?null:Jz.createElement(A7,null,Jz.createElement(Qd,{props:t,data:i}))}),Jz.createElement(Tk,{label:t.label}),t.children)}function Qh(e){var t=(0,Jz.useRef)(null);return Jz.createElement(Qf,{previousRectanglesRef:t,props:e})}var Qp=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:jG(e,t)}};class Qm extends Jz.PureComponent{render(){var{hide:e,data:t,dataKey:n,className:r,xAxisId:a,yAxisId:i,needClip:o,background:l,id:s}=this.props;if(e||null==t)return null;var c=(0,w1.clsx)("recharts-bar",r);return Jz.createElement(A7,{className:c,id:s},o&&Jz.createElement("defs",null,Jz.createElement(GK,{clipPathId:s,xAxisId:a,yAxisId:i})),Jz.createElement(A7,{className:"recharts-bar-rectangles",clipPath:o?"url(#clipPath-".concat(s,")"):void 0},Jz.createElement(Ql,{data:t,dataKey:n,background:l,allOtherBarProps:this.props}),Jz.createElement(Qh,this.props)))}}var Qg={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:0,xAxisId:0,yAxisId:0,zIndex:Nn.bar};function Qv(e){var t,{xAxisId:n,yAxisId:r,hide:a,legendType:i,minPointSize:o,activeBar:l,animationBegin:s,animationDuration:c,animationEasing:u,isAnimationActive:d}=e,{needClip:f}=Gq(n,r),h=kv(CT),p=Cf(),m=zm(e.children,zc),g=kv(t=>JZ(t,e.id,p,m));if("vertical"!==h&&"horizontal"!==h)return null;var v=null==g?void 0:g[0];return t=null==v||null==v.height||null==v.width?0:"vertical"===h?v.height/2:v.width/2,Jz.createElement(J$,{xAxisId:n,yAxisId:r,data:g,dataPointFormatter:Qp,errorBarOffset:t},Jz.createElement(Qm,Qn({},e,{layout:h,needClip:f,data:g,xAxisId:n,yAxisId:r,hide:a,legendType:i,minPointSize:o,activeBar:l,animationBegin:s,animationDuration:c,animationEasing:u,isAnimationActive:d})))}Jz.memo(function(e){var t,n,r=I4(e,Qg),a=(t=r.stackId,null!=(n=(0,ew.useContext)(J3))?n.stackId:null!=t?jQ(t):void 0),i=Cf();return Jz.createElement(RR,{id:r.id,type:"bar"},e=>Jz.createElement(Jz.Fragment,null,Jz.createElement(RI,{legendPayload:(e=>{var{dataKey:t,name:n,fill:r,legendType:a,hide:i}=e;return[{inactive:i,dataKey:t,type:a,color:r,value:j6(n,t),payload:e}]})(r)}),Jz.createElement(Qo,{dataKey:r.dataKey,stroke:r.stroke,strokeWidth:r.strokeWidth,fill:r.fill,name:r.name,hide:r.hide,unit:r.unit,tooltipType:r.tooltipType,id:e}),Jz.createElement(RU,{type:"bar",id:e,data:void 0,xAxisId:r.xAxisId,yAxisId:r.yAxisId,zAxisId:0,dataKey:r.dataKey,stackId:a,hide:r.hide,barSize:r.barSize,minPointSize:r.minPointSize,maxBarSize:r.maxBarSize,isPanorama:i,hasCustomShape:null!=r.shape}),Jz.createElement(R3,{zIndex:r.zIndex},Jz.createElement(Qv,Qn({},r,{id:e})))))},$T).displayName="Bar";let Qx=(0,ek.default)("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);function Qy({className:e,orientation:t="horizontal",...n}){return(0,ey.jsx)("div",{role:"separator","aria-orientation":t,"data-slot":"separator","data-orientation":t,className:(0,eI.cn)("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",e),...n})}function Qb({label:e,description:t,value:n}){return(0,ey.jsxs)("div",{className:"relative h-full min-h-0",children:[(0,ey.jsxs)("div",{children:[(0,ey.jsx)("div",{className:"text-xl font-semibold tracking-normal",children:e}),(0,ey.jsx)("div",{className:"mt-1 text-sm leading-5 text-muted-foreground",children:t})]}),(0,ey.jsx)(Jb,{value:Jw(n),minSize:48,maxSize:220,className:"absolute right-0 bottom-0 h-2/3 w-full"})]})}(0,ek.default)("calendar-clock",[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);var Qw=ew,Qj=(e,t,n,r)=>AE(e,"xAxis",t,r),Qk=(e,t,n,r)=>AM(e,"xAxis",t,r),QS=(e,t,n,r)=>AE(e,"yAxis",n,r),QC=(e,t,n,r)=>AM(e,"yAxis",n,r),QN=jc([CT,Qj,QS,Qk,QC],(e,t,n,r,a)=>jX(e,"xAxis")?j4(t,r,!1):j4(n,a,!1));function QM(e){return"line"===e.type}var QE=jc([Pe,(e,t,n,r,a)=>a],(e,t)=>e.filter(QM).find(e=>e.id===t)),QO=jc([CT,Qj,QS,Qk,QC,QE,QN,jh],(e,t,n,r,a,i,o,l)=>{var s,{chartData:c,dataStartIndex:u,dataEndIndex:d}=l;if(null!=i&&null!=t&&null!=n&&null!=r&&null!=a&&0!==r.length&&0!==a.length&&null!=o&&("horizontal"===e||"vertical"===e)){var{dataKey:f,data:h}=i;if(null!=(s=null!=h&&h.length>0?h:null==c?void 0:c.slice(u,d+1)))return function(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:a,yAxisTicks:i,dataKey:o,bandSize:l,displayedData:s}=e;return s.map((e,s)=>{var c=jG(e,o);if("horizontal"===t){var u=j0({axis:n,ticks:a,bandSize:l,entry:e,index:s}),d=null==c?null:r.scale.map(c);return{x:u,y:null!=d?d:null,value:c,payload:e}}var f=null==c?null:n.scale.map(c),h=j0({axis:r,ticks:i,bandSize:l,entry:e,index:s});return null==f||null==h?null:{x:f,y:h,value:c,payload:e}}).filter(Boolean)}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:a,dataKey:f,bandSize:o,displayedData:s})}}),QP=["id"],QA=["type","layout","connectNulls","needClip","shape"],QI=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function Qz(){return(Qz=Object.assign.bind()).apply(null,arguments)}function Q_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function QD(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Q_(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Q_(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function QR(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var QT=Qw.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:a,fill:i,name:o,hide:l,unit:s,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,getPosition:jV,settings:{stroke:r,strokeWidth:a,fill:i,dataKey:t,nameKey:void 0,name:j6(o,t),hide:l,type:c,color:r,unit:s,graphicalItemId:u}};return Qw.createElement(Dw,{tooltipEntrySettings:d})}),QL=(e,t)=>"".concat(t,"px ").concat(e,"px");function Q$(e){var{clipPathId:t,points:n,props:r}=e,{dot:a,dataKey:i,needClip:o}=r,{id:l}=r,s=A5(QR(r,QP));return Qw.createElement(GB,{points:n,dot:a,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:i,baseProps:s,needClip:o,clipPathId:t})}function QF(e){var{showLabels:t,children:n,points:r}=e,a=(0,Qw.useMemo)(()=>null==r?void 0:r.map(e=>{var t,n,r={x:null!=(t=e.x)?t:0,y:null!=(n=e.y)?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return QD(QD({},r),{},{value:e.value,payload:e.payload,viewBox:r,parentViewBox:void 0,fill:void 0})}),[r]);return Qw.createElement(Ty,{value:t?a:void 0},n)}function QB(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:a,props:i}=e,{type:o,layout:l,connectNulls:s,needClip:c,shape:u}=i,d=QD(QD({},A3(QR(i,QA))),{},{fill:"none",className:"recharts-line-curve",clipPath:c?"url(#clipPath-".concat(t,")"):void 0,points:r,type:o,layout:l,connectNulls:s,strokeDasharray:null!=a?a:i.strokeDasharray});return Qw.createElement(Qw.Fragment,null,(null==r?void 0:r.length)>1&&Qw.createElement(_N,Qz({shapeType:"curve",option:u},d,{pathRef:n})),Qw.createElement(Q$,{points:r,clipPathId:t,props:i}))}function QV(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:a,longestAnimatedLengthRef:i}=e,{points:o,strokeDasharray:l,isAnimationActive:s,animationBegin:c,animationDuration:u,animationEasing:d,animateNewValues:f,width:h,height:p,onAnimationEnd:m,onAnimationStart:g}=n,v=a.current,x=zF(o,"recharts-line-"),y=(0,Qw.useRef)(x),[b,w]=(0,Qw.useState)(!1),j=(0,Qw.useCallback)(()=>{"function"==typeof m&&m(),w(!1)},[m]),k=(0,Qw.useCallback)(()=>{"function"==typeof g&&g(),w(!0)},[g]),S=function(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch(e){return 0}}(r.current),C=(0,Qw.useRef)(0);y.current!==x&&(C.current=i.current,y.current=x);var N=C.current;return Qw.createElement(QF,{points:o,showLabels:!b},n.children,Qw.createElement(z$,{animationId:x,begin:c,duration:u,isActive:s,easing:d,onAnimationEnd:j,onAnimationStart:k,key:x},e=>{var c,u=Math.min(jL(N,S+N,e),S);if(c=s?l?((e,t,n)=>{var r=n.reduce((e,t)=>e+t,0);if(!r)return QL(t,e);for(var a=Math.floor(e/r),i=e%r,o=[],l=0,s=0;l<n.length;s+=null!=(c=n[l])?c:0,++l){var c,u=n[l];if(null!=u&&s+u>i){o=[...n.slice(0,l),i-s];break}}var d=o.length%2==0?[0,t]:[t];return[...function(e,t){for(var n=e.length%2!=0?[...e,0]:e,r=[],a=0;a<t;++a)r.push(...n);return r}(n,a),...o,...d].map(e=>"".concat(e,"px")).join(", ")})(u,S,"".concat(l).split(/[,\s]+/gim).map(e=>parseFloat(e))):QL(S,u):null==l?void 0:String(l),e>0&&S>0&&(a.current=o,i.current=Math.max(i.current,u)),v){var d=v.length/o.length,m=1===e?o:o.map((t,n)=>{var r=Math.floor(n*d);if(v[r]){var a=v[r];return QD(QD({},t),{},{x:jL(a.x,t.x,e),y:jL(a.y,t.y,e)})}return f?QD(QD({},t),{},{x:jL(2*h,t.x,e),y:jL(p/2,t.y,e)}):QD(QD({},t),{},{x:t.x,y:t.y})});return a.current=m,Qw.createElement(QB,{props:n,points:m,clipPathId:t,pathRef:r,strokeDasharray:c})}return Qw.createElement(QB,{props:n,points:o,clipPathId:t,pathRef:r,strokeDasharray:c})}),Qw.createElement(Tk,{label:n.label}))}function QH(e){var{clipPathId:t,props:n}=e,r=(0,Qw.useRef)(null),a=(0,Qw.useRef)(0),i=(0,Qw.useRef)(null);return Qw.createElement(QV,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:a,pathRef:i})}var QW=(e,t)=>{var n,r;return{x:null!=(n=e.x)?n:void 0,y:null!=(r=e.y)?r:void 0,value:e.value,errorVal:jG(e.payload,t)}};class QU extends Qw.Component{render(){var{hide:e,dot:t,points:n,className:r,xAxisId:a,yAxisId:i,top:o,left:l,width:s,height:c,id:u,needClip:d,zIndex:f}=this.props;if(e)return null;var h=(0,w1.clsx)("recharts-line",r),{r:p,strokeWidth:m}=G3(t),g=zg(t),v=2*p+m,x=d?"url(#clipPath-".concat(g?"":"dots-").concat(u,")"):void 0;return Qw.createElement(R3,{zIndex:f},Qw.createElement(A7,{className:h},d&&Qw.createElement("defs",null,Qw.createElement(GK,{clipPathId:u,xAxisId:a,yAxisId:i}),!g&&Qw.createElement("clipPath",{id:"clipPath-dots-".concat(u)},Qw.createElement("rect",{x:l-v/2,y:o-v/2,width:s+v,height:c+v}))),Qw.createElement(J$,{xAxisId:a,yAxisId:i,data:n,dataPointFormatter:QW,errorBarOffset:0},Qw.createElement(QH,{props:this.props,clipPathId:u}))),Qw.createElement(GU,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:x}))}}var Qq={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Nn.line,type:"linear"};function QK(e){var t=I4(e,Qq),{activeDot:n,animateNewValues:r,animationBegin:a,animationDuration:i,animationEasing:o,connectNulls:l,dot:s,hide:c,isAnimationActive:u,label:d,legendType:f,xAxisId:h,yAxisId:p,id:m}=t,g=QR(t,QI),{needClip:v}=Gq(h,p),x=kv(Fc),y=kv(CT),b=Cf(),w=kv(e=>QO(e,h,p,b,m));if("horizontal"!==y&&"vertical"!==y||null==w||null==x)return null;var{height:j,width:k,x:S,y:C}=x;return Qw.createElement(QU,Qz({},g,{id:m,connectNulls:l,dot:s,activeDot:n,animateNewValues:r,animationBegin:a,animationDuration:i,animationEasing:o,isAnimationActive:u,hide:c,label:d,legendType:f,xAxisId:h,yAxisId:p,points:w,layout:y,height:j,width:k,left:S,top:C,needClip:v}))}var QG=Qw.memo(function(e){var t=I4(e,Qq),n=Cf();return Qw.createElement(RR,{id:t.id,type:"line"},e=>Qw.createElement(Qw.Fragment,null,Qw.createElement(RI,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,legendType:a,hide:i}=e;return[{inactive:i,dataKey:t,type:a,color:r,value:j6(n,t),payload:e}]})(t)}),Qw.createElement(QT,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),Qw.createElement(RU,{type:"line",id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),Qw.createElement(QK,Qz({},t,{id:e}))))},$T);QG.displayName="Line";var QX=["axis"],QY=(0,ew.forwardRef)((e,t)=>ew.createElement(Xy,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:QX,tooltipPayloadSearcher:TH,categoricalChartProps:e,ref:t}));function QZ({title:e,count:t}){return(0,ey.jsxs)("div",{className:"flex h-7 shrink-0 items-center justify-between",children:[(0,ey.jsx)("h2",{className:"text-sm font-semibold tracking-normal",children:e}),(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:t})]})}function QJ({items:e}){return(0,ey.jsx)("div",{className:"mt-2 grid",children:e.map((e,t)=>(0,ey.jsxs)("div",{className:(0,eI.cn)("px-2 py-2",t>0&&"border-t"),children:[(0,ey.jsx)("div",{className:"truncate text-sm font-medium",children:e.title}),(0,ey.jsx)("div",{className:(0,eI.cn)("mt-1 truncate ui-text-kbd text-muted-foreground","warning"===e.tone&&"text-destructive"),children:e.meta})]},e.id))})}function QQ({items:e}){let t=ew.useMemo(()=>e.map(([e,t,n,r])=>({id:`${e}-${n}`,status:"完成"===r?"done":"运行中"===r?"current":"失败"===r?"blocked":"queued",title:(0,ey.jsxs)("div",{className:"grid w-full grid-cols-[3.25rem_8rem_minmax(0,1fr)_4rem] items-center gap-3",children:[(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:e}),(0,ey.jsx)("span",{className:"truncate ui-text-kbd text-muted-foreground",children:t}),(0,ey.jsx)("span",{className:"truncate",children:n}),(0,ey.jsx)("span",{className:"text-right ui-text-kbd text-muted-foreground",children:r})]})})),[e]);return(0,ey.jsx)(ZJ,{items:t,scrollCurrentIntoView:!1,extendLineToViewport:!0,className:"mt-2 min-h-0 flex-1",viewportClassName:"h-full max-h-none overflow-y-auto pr-0",itemClassName:"py-1.5"})}function Q0({items:e}){let t=ew.useMemo(()=>e.map(e=>{var t;return{id:e.id,status:"running"===(t=e.state)?"current":"blocked"===t||"failed"===t?"blocked":"queued",title:(0,ey.jsx)(Q1,{item:e})}}),[e]);return(0,ey.jsx)(ZJ,{items:t,scrollCurrentIntoView:!1,extendLineToViewport:!0,className:"mt-2 min-h-0 flex-1",viewportClassName:"h-full max-h-none overflow-y-auto pr-0",itemClassName:"py-2"})}function Q1({item:e}){return(0,ey.jsxs)("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_7.5rem_5rem] items-center gap-3",children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("div",{className:"truncate text-sm font-medium",children:e.title}),(0,ey.jsxs)("div",{className:"mt-1 truncate ui-text-kbd text-muted-foreground",children:[e.machine," · ",e.agent," · ",e.started]})]}),(0,ey.jsxs)("div",{className:"grid gap-1",children:[(0,ey.jsx)(JS,{value:e.progress,className:"h-1.5"}),(0,ey.jsx)("div",{className:"ui-text-kbd text-muted-foreground",children:e.runtime})]}),(0,ey.jsxs)("div",{className:"grid gap-1",children:[(0,ey.jsx)(JS,{value:e.load,className:"h-1.5"}),(0,ey.jsx)("div",{className:"text-right ui-text-kbd text-muted-foreground",children:"load"})]})]})}function Q2({workers:e}){return(0,ey.jsx)("div",{className:"mt-2 grid min-h-0 flex-1 content-start overflow-hidden",children:e.map((e,t)=>(0,ey.jsx)(Q5,{worker:e,divided:t>0},e.id))})}function Q5({worker:e,divided:t}){return(0,ey.jsxs)("div",{className:(0,eI.cn)("grid min-h-24 grid-cols-[minmax(0,1fr)_2.5rem_auto] items-center gap-4 px-2 py-2",t&&"border-t"),children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("div",{className:"truncate text-lg font-semibold tracking-normal",children:e.machine}),(0,ey.jsx)("div",{className:"mt-0.5 truncate ui-text-kbd text-muted-foreground",children:e.role})]}),(0,ey.jsxs)("div",{className:"text-right text-sm font-medium tabular-nums",children:[e.active,"/",e.capacity]}),(0,ey.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ey.jsx)(Q4,{label:"CPU",value:e.cpu}),(0,ey.jsx)(Q4,{label:"MEM",value:e.memory})]})]})}function Q4({label:e,value:t}){return(0,ey.jsxs)("div",{className:"grid justify-items-center gap-1",children:[(0,ey.jsx)(JC,{value:t,label:e,className:"size-16 [&_[data-slot=progress-ring-center]]:size-10 [&_[data-slot=progress-ring-center]]:bg-background [&_[data-slot=progress-ring-center]_span]:text-xs"}),(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:e})]})}function Q3({events:e}){let t=ew.useMemo(()=>e.map(([e,t],n)=>({id:`${e}-${t}`,status:0===n?"current":"done",title:(0,ey.jsxs)("div",{className:"grid w-full grid-cols-[3.25rem_minmax(0,1fr)] items-center gap-2",children:[(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:e}),(0,ey.jsx)("span",{className:"truncate",children:t})]})})),[e]);return(0,ey.jsx)(ZJ,{items:t,scrollCurrentIntoView:!1,extendLineToViewport:!0,className:"mt-2 min-h-0 flex-1",viewportClassName:"h-full max-h-none overflow-y-auto pr-0",itemClassName:"py-1.5"})}function Q6({machines:e}){return(0,ey.jsx)("div",{className:"mt-2 grid min-h-0 flex-1 content-start overflow-hidden",children:e.map((e,t)=>(0,ey.jsx)(Q8,{machine:e,divided:t>0},e.id))})}function Q8({machine:e,divided:t}){return(0,ey.jsxs)("div",{className:(0,eI.cn)("grid min-h-20 grid-cols-[minmax(0,1fr)_minmax(0,1.45fr)] items-center gap-4 px-2 py-2",t&&"border-t"),children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ey.jsx)(Q9,{status:e.status}),(0,ey.jsx)("span",{className:"truncate text-sm font-medium",children:e.name})]}),(0,ey.jsxs)("div",{className:"mt-1 truncate ui-text-kbd text-muted-foreground",children:[e.os," · ",e.link," · heartbeat ",e.heartbeat]})]}),(0,ey.jsxs)("div",{className:"grid gap-2 sm:grid-cols-4",children:[(0,ey.jsx)(Q7,{icon:(0,ey.jsx)(dr,{}),label:"CPU",value:e.cpu}),(0,ey.jsx)(Q7,{icon:(0,ey.jsx)(JP,{}),label:"MEM",value:e.memory}),(0,ey.jsx)(Q7,{icon:(0,ey.jsx)(da,{}),label:"DISK",value:e.disk}),(0,ey.jsx)(Q7,{icon:(0,ey.jsx)(JA,{}),label:"NET",value:e.network})]})]})}function Q7({icon:e,label:t,value:n}){return(0,ey.jsxs)("div",{className:"grid gap-1",children:[(0,ey.jsxs)("div",{className:"flex justify-between gap-1 ui-text-kbd text-muted-foreground",children:[(0,ey.jsxs)("span",{className:"flex items-center gap-1 [&_svg]:size-3",children:[e,t]}),(0,ey.jsxs)("span",{children:[n,"%"]})]}),(0,ey.jsx)(JS,{value:n,className:"h-1.5"})]})}function Q9({status:e}){return(0,ey.jsx)("span",{className:(0,eI.cn)("size-2 rounded-full bg-border","online"===e&&"bg-primary")})}function eee({links:e}){let t=ew.useMemo(()=>e.map(([e,t,n,r,a])=>({id:`${e}-${t}`,status:"Relay fallback"===n?"blocked":"current",title:(0,ey.jsxs)("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_5rem_4rem_3.5rem] items-center gap-3",children:[(0,ey.jsxs)("span",{className:"truncate",children:[e," / ",t]}),(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:n}),(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:r}),(0,ey.jsx)("span",{className:"text-right ui-text-kbd text-muted-foreground",children:a})]})})),[e]);return(0,ey.jsx)(ZJ,{items:t,scrollCurrentIntoView:!1,extendLineToViewport:!0,className:"mt-2 min-h-0 flex-1",viewportClassName:"h-full max-h-none overflow-y-auto pr-0",itemClassName:"py-2"})}function eet({config:e,data:t}){return(0,ey.jsx)(Bg,{config:e,className:"mt-2 min-h-0 flex-1",children:(0,ey.jsxs)(Xw,{data:t,margin:{left:8,right:8},children:[(0,ey.jsx)(X2,{vertical:!1}),(0,ey.jsx)(Ys,{dataKey:"time",tickLine:!1,axisLine:!1,tickMargin:8}),(0,ey.jsx)(Bx,{content:(0,ey.jsx)(By,{indicator:"line"})}),(0,ey.jsx)(Xm,{dataKey:"cpu",type:"monotone",fill:"var(--color-cpu)",fillOpacity:.11,stroke:"var(--color-cpu)",strokeWidth:2}),(0,ey.jsx)(Xm,{dataKey:"memory",type:"monotone",fill:"var(--color-memory)",fillOpacity:.1,stroke:"var(--color-memory)",strokeWidth:2}),(0,ey.jsx)(Xm,{dataKey:"network",type:"monotone",fill:"var(--color-network)",fillOpacity:.08,stroke:"var(--color-network)",strokeWidth:2})]})})}function een({services:e}){let[t,n]=Go(),r=Math.max(1,Math.floor((Math.max(0,n.width-192-64-32)+5)/12)),a=Math.max(48,n.height>0?Math.floor((n.height-0*Math.max(0,e.length-1))/e.length):48),i=Math.max(28,a-22);return(0,ey.jsx)("div",{ref:t,className:"mt-2 min-h-0 flex-1",children:e.map((e,t)=>(0,ey.jsx)(eer,{service:e,divided:t>0,rowHeight:a,sampleCount:r,sampleHeight:i},e.id))})}function eer({service:e,divided:t,rowHeight:n,sampleCount:r,sampleHeight:a}){let i=ew.useMemo(()=>{var t,n;return t=e.samples,n=r,t.length>=n?t.slice(t.length-n):Array.from({length:n},(e,n)=>{let r=n%t.length;return t[r]??0})},[r,e.samples]);return(0,ey.jsxs)("div",{className:(0,eI.cn)("grid grid-cols-[12rem_minmax(0,1fr)_4rem] items-center gap-4 px-2",t&&"border-t"),style:{height:n},children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("div",{className:"truncate text-sm font-medium",children:e.name}),(0,ey.jsx)("div",{className:(0,eI.cn)("mt-0.5 truncate ui-text-kbd text-muted-foreground","告警"===e.state&&"text-destructive"),children:e.state})]}),(0,ey.jsx)("div",{"aria-label":`${e.name} 30 minute stability samples`,className:"flex min-w-0 items-center overflow-hidden",style:{gap:5},children:i.map((t,n)=>{var r;return(0,ey.jsx)("span",{className:(0,eI.cn)("shrink-0 rounded-[2px]",(r=t)<60?"bg-destructive":r<72?"bg-destructive/55":r<84?"bg-primary/35":r<92?"bg-primary/60":"bg-primary"),style:{width:7,height:a},title:`${t}%`},`${e.id}-${n}`)})}),(0,ey.jsxs)("div",{className:"text-right text-sm font-medium tabular-nums",children:[e.samples.at(-1),"%"]})]})}let eea=[{id:"canvas-vantaloom-base",title:"Vantaloom 基座设计",status:"live",purpose:"承载多标签系统、文件树、终端和 Agent 会话节点。",nodes:18,agents:3,progress:64,health:91,runtime:"3h 12m",tokenUsage:62e4,lastOpened:"刚刚",snapshots:14,unsavedChanges:3,roadmap:[{title:"接入节点模板选择",state:"done"},{title:"处理节点吸附与连线遮挡",state:"done"},{title:"合并多标签页拖拽",state:"running"},{title:"沉淀真实项目模板",state:"queued"}],settings:{nodeTemplates:["多标签页系统","文件管理树","终端标签组","Agent 对话"],defaultLayout:["默认缩放 0.72","节点内容 2x","定位点 24px"],folders:["D:/Projects/Vantaloom-ui","D:/Projects/Vantaloom-ui/apps"],sharing:["工作组管理员可编辑","成员可审阅","访客不可访问"],autosave:["每 45 秒保存","节点拖拽结束保存","切换工作区保存"],snapshots:["保留最近 30 个","发布前创建检查点"],hosts:["Studio-PC","Linux-runner-02"],plugins:["Browser","Git checkpoint"]}},{id:"canvas-agent-lab",title:"Agent 编排实验",status:"live",purpose:"验证多 Agent 对话、工具窗口和剪切板在画布中的协同。",nodes:11,agents:4,progress:41,health:78,runtime:"1h 36m",tokenUsage:308e3,lastOpened:"8 分钟前",snapshots:9,unsavedChanges:1,roadmap:[{title:"四分工作区布局",state:"done"},{title:"面板替换进剪切板",state:"done"},{title:"会话浏览页",state:"running"},{title:"会话节点化",state:"queued"}],settings:{nodeTemplates:["Agent 对话","数据表标签","浏览器标签"],defaultLayout:["默认双栏","右侧可调整","剪切板常驻"],folders:["D:/Projects/Vantaloom-ui/apps/vantaloom"],sharing:["仅本机管理员可编辑"],autosave:["每 60 秒保存"],snapshots:["保留最近 12 个"],hosts:["Studio-PC"],plugins:["Browser"]}},{id:"canvas-release-map",title:"发布路线图",status:"review",purpose:"梳理组件库、主应用和文档的发布前检查。",nodes:9,agents:1,progress:83,health:86,runtime:"42m",tokenUsage:144e3,lastOpened:"今天 15:02",snapshots:7,unsavedChanges:0,roadmap:[{title:"组件清单",state:"done"},{title:"风险列表",state:"done"},{title:"最终检查",state:"running"}],settings:{nodeTemplates:["Diff 标签","数据表标签","文件预览标签"],defaultLayout:["审阅模式默认开启"],folders:["D:/Projects/Vantaloom-ui/docs"],sharing:["工作组可审阅"],autosave:["手动保存"],snapshots:["里程碑保留"],hosts:["Studio-PC"],plugins:[]}},{id:"canvas-browser-matrix",title:"浏览器预览矩阵",status:"idle",purpose:"检查不同 UA、比例和内嵌预览模式的表现。",nodes:6,agents:0,progress:100,health:94,runtime:"28m",tokenUsage:78e3,lastOpened:"昨天 18:44",snapshots:5,unsavedChanges:0,roadmap:[{title:"自适应模式",state:"done"},{title:"长宽比菜单",state:"done"},{title:"导航按钮",state:"done"}],settings:{nodeTemplates:["浏览器标签","多标签页系统"],defaultLayout:["自适应预览"],folders:["D:/Projects/Vantaloom-ui/packages/ui"],sharing:["仅自己"],autosave:["关闭"],snapshots:["保留最近 5 个"],hosts:["Studio-PC"],plugins:["Browser"]}},{id:"canvas-ops-topology",title:"工作组拓扑",status:"idle",purpose:"记录机器、服务和工作组连接关系。",nodes:15,agents:0,progress:100,health:89,runtime:"1h 04m",tokenUsage:92e3,lastOpened:"周四 11:30",snapshots:11,unsavedChanges:0,roadmap:[{title:"机器节点整理",state:"done"},{title:"连接策略标注",state:"done"},{title:"访问权限检查",state:"done"}],settings:{nodeTemplates:["数据表标签","浏览器标签","终端标签组"],defaultLayout:["视口吸附开启","节点吸附开启"],folders:["D:/Projects/Vantaloom-ui/ops"],sharing:["管理员可编辑","成员可查看"],autosave:["每 2 分钟保存"],snapshots:["每日保留"],hosts:["Studio-PC","Linux-runner-02","MacBook-build"],plugins:[]}}];function eei(e,t,n,r,a,i,o){return{id:e,title:t,status:"idle",purpose:n,nodes:r,agents:0,progress:100,health:90,runtime:a,tokenUsage:i,lastOpened:o,snapshots:Math.max(3,Math.round(r/2)),unsavedChanges:0,roadmap:[{title:"整理节点结构",state:"done"},{title:"检查连接关系",state:"done"},{title:"保存最终快照",state:"done"}],settings:{nodeTemplates:["多标签页系统","文件预览标签"],defaultLayout:["默认缩放 0.72","节点吸附开启"],folders:["D:/Projects/Vantaloom-ui"],sharing:["仅自己"],autosave:["关闭"],snapshots:["保留最近 5 个"],hosts:["Studio-PC"],plugins:[]}}}eea.push(eei("canvas-terminal-layout","终端工作台草图","记录终端标签组、日志表和命令区的组合方式。",7,"36m",84e3,"昨天 15:21"),eei("canvas-file-review","文件审阅流程","沉淀文件树、diff 预览和文件标签之间的拖拽关系。",12,"58m",126e3,"周五 20:10"),eei("canvas-settings-ia","设置导航结构","整理设置菜单面板的主菜单、子菜单和搜索入口。",8,"24m",61e3,"周五 16:42"),eei("canvas-auth-access","本机账户接入","记录本机用户、工作组加入和可用机器列表关系。",10,"47m",112e3,"周四 22:05"),eei("canvas-data-ops","运维数据面板","对齐数据表标签、机器状态卡片和运行记录列表。",14,"1h 18m",172e3,"周三 19:48"));let eeo=eea.filter(e=>"idle"!==e.status),eel=eea.filter(e=>"idle"===e.status);function ees(e,t,n=""){return{title:e,dataSource:t,refreshRate:"30s",note:n}}function eec(e,t){return(0,ey.jsx)("section",{className:(0,eI.cn)("size-full rounded-xl border bg-card p-5","vtl-jelly-image-card vtl-jelly-image-card-shadowless"),style:Z5({image:t,opacity:.88,blur:"0px"}),children:e})}let eeu=[{id:"metric-active",kind:"metric-active",x:0,y:0,w:3,h:3},{id:"metric-nodes",kind:"metric-nodes",x:3,y:0,w:3,h:3},{id:"metric-unsaved",kind:"metric-unsaved",x:6,y:0,w:3,h:3},{id:"metric-snapshots",kind:"metric-snapshots",x:9,y:0,w:3,h:3},{id:"active",kind:"active",x:0,y:3,w:12,h:3},{id:"recent",kind:"recent",x:0,y:6,w:12,h:Math.max(3,Math.ceil(.75*eel.length)+1)}];function eed({open:e,title:t,description:n,eyebrow:r,panels:a,defaultPanelId:i="overview",onOpenChange:o}){let l=su(),[s,c]=ew.useState(i),u=a.find(e=>e.id===s)??a[0];return ew.useEffect(()=>{e&&c(i)},[i,e]),(0,ey.jsx)(uo,{open:e,onOpenChange:o,children:(0,ey.jsxs)(d8,{hideClose:!0,className:(0,eI.cn)("gap-0 overflow-hidden p-0",l?"inset-0 h-svh w-full max-w-none translate-x-0 translate-y-0 rounded-none border-0":"h-[min(44rem,calc(100svh-2rem))] max-w-5xl"),children:[(0,ey.jsx)(d9,{className:"sr-only",children:t}),(0,ey.jsxs)(fe,{className:"sr-only",children:[r?(0,ey.jsxs)(ey.Fragment,{children:[r,". "]}):null,n??t]}),l?(0,ey.jsxs)("div",{className:"flex h-full flex-col",children:[(0,ey.jsxs)("header",{className:"flex shrink-0 items-center gap-3 border-b px-4 py-3",children:[(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"关闭",onClick:()=>o(!1),children:(0,ey.jsx)(d3.XIcon,{className:"size-4"})}),(0,ey.jsxs)("div",{className:"min-w-0 flex-1",children:[r?(0,ey.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:r}):null,(0,ey.jsx)("div",{className:"truncate text-sm font-semibold",children:t})]})]}),(0,ey.jsx)("nav",{className:"shrink-0 overflow-x-auto border-b [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:(0,ey.jsx)("div",{className:"flex gap-1.5 px-4 py-2",children:a.map(e=>(0,ey.jsxs)("button",{type:"button",className:(0,eI.cn)("inline-flex shrink-0 items-center gap-1.5 rounded-full px-3 py-1.5 text-xs font-medium transition-colors",u?.id===e.id?"bg-foreground text-background":"bg-muted text-muted-foreground"),onClick:()=>c(e.id),children:[e.icon?(0,ey.jsx)("span",{className:"[&_svg]:size-3.5",children:e.icon}):null,(0,ey.jsx)("span",{children:e.label}),e.badge?(0,ey.jsx)(FC,{variant:"outline",className:"h-4 px-1 ui-text-kbd",children:e.badge}):null]},e.id))})}),(0,ey.jsx)(bQ,{className:"min-h-0 flex-1",children:(0,ey.jsx)("div",{className:"p-4",children:u?.content})})]}):(0,ey.jsxs)("div",{className:"grid size-full min-h-0 grid-cols-[15rem_minmax(0,1fr)]",children:[(0,ey.jsx)("aside",{"data-slot":"resource-management-dialog-sidebar",className:"min-h-0 border-r bg-muted/20",children:(0,ey.jsx)(bQ,{className:"h-full",children:(0,ey.jsx)("div",{className:"space-y-1 p-2",children:a.map(e=>(0,ey.jsxs)(eA.Button,{"data-slot":"resource-management-dialog-nav-item",type:"button",variant:"ghost",className:(0,eI.cn)("h-9 w-full justify-start px-2.5 text-left font-medium",u?.id===e.id?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/70 hover:text-foreground"),onClick:()=>c(e.id),children:[e.icon?(0,ey.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center [&_svg]:size-4",children:e.icon}):null,(0,ey.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.label}),e.badge?(0,ey.jsx)(FC,{variant:"outline",className:"h-5 px-1.5 ui-text-kbd",children:e.badge}):null]},e.id))})})}),(0,ey.jsx)(bQ,{className:"min-h-0 bg-background",children:(0,ey.jsx)("div",{className:"p-5 pr-9",children:u?.content})})]})]})})}function eef({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){let[r,a]=ew.useState(),i=ew.useMemo(()=>(function({onSelect:e}){return[{id:"metric-active",title:"活跃画布",description:"当前正在编辑的画布数量。",icon:(0,ey.jsx)(dc,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:ees("活跃画布","画布列表"),render:e=>eec((0,ey.jsx)(Qb,{label:e.title,description:"当前正在编辑的画布数量",value:String(eeo.length)}),ZQ)},{id:"metric-nodes",title:"运行节点",description:"所有活跃画布内的节点。",icon:(0,ey.jsx)(BT,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:ees("运行节点","画布节点"),render:e=>eec((0,ey.jsx)(Qb,{label:e.title,description:"所有活跃画布内的节点",value:"38"}),Z0)},{id:"metric-unsaved",title:"未保存",description:"等待写入的画布变更。",icon:(0,ey.jsx)(wZ,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:ees("未保存","画布保存状态"),render:e=>eec((0,ey.jsx)(Qb,{label:e.title,description:"等待写入的画布变更",value:"4"}),Z1)},{id:"metric-snapshots",title:"快照",description:"可回退的历史存档。",icon:(0,ey.jsx)(Ku,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:ees("快照","画布快照"),render:e=>eec((0,ey.jsx)(Qb,{label:e.title,description:"可回退的历史存档",value:"46"}),Z2)},{id:"active",title:"正在使用的画布",description:"活跃画布 Roadmap。",icon:(0,ey.jsx)(dc,{className:"size-4"}),defaultSize:{w:12,h:3},defaultConfig:ees("正在使用的画布","画布列表"),render:t=>(0,ey.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,ey.jsx)(QZ,{title:t.title,count:eeo.length}),(0,ey.jsx)(JM,{canvases:eeo,scrollable:!0,onSelect:e})]})},{id:"recent",title:"最近画布",description:"最近打开的画布。",icon:(0,ey.jsx)(pN,{className:"size-4"}),defaultSize:{w:12,h:Math.max(3,Math.ceil(.75*eel.length)+1)},defaultConfig:ees("最近画布","画布列表"),render:t=>(0,ey.jsxs)("section",{className:"flex size-full flex-col",children:[(0,ey.jsx)(QZ,{title:t.title,count:eel.length}),(0,ey.jsx)(JM,{canvases:eel,mode:"archive",onSelect:e})]})}]})({onSelect:a}),[]);return(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(Jx,{boardId:"canvas-library",definitions:i,initialLayouts:eeu,clipboardItems:e,actionLabel:"画布库页面卡片操作",paletteGroupTitle:"画布库页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n}),(0,ey.jsx)(eep,{canvas:r,onOpenChange:e=>{e||a(void 0)}})]})}function eeh({icon:e,value:t}){return(0,ey.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,ey.jsx)("span",{className:"[&_svg]:size-3.5",children:e}),(0,ey.jsx)("span",{className:"tabular-nums",children:t})]})}function eep({canvas:e,onOpenChange:t}){return e?(0,ey.jsx)(eed,{open:!!e,onOpenChange:t,title:e.title,eyebrow:"画布管理",description:e.purpose,panels:[{id:"overview",label:"首页",icon:(0,ey.jsx)(BL,{}),content:(0,ey.jsx)(eem,{canvas:e})},{id:"templates",label:"节点模板",icon:(0,ey.jsx)(ZW,{}),badge:e.settings.nodeTemplates.length,content:(0,ey.jsx)(eev,{title:"可用节点模板",items:e.settings.nodeTemplates})},{id:"layout",label:"默认布局",icon:(0,ey.jsx)(ZX,{}),content:(0,ey.jsx)(eev,{title:"默认布局参数",items:e.settings.defaultLayout})},{id:"folders",label:"工作区绑定",icon:(0,ey.jsx)(pN,{}),content:(0,ey.jsx)(eev,{title:"绑定的工作区文件夹",items:e.settings.folders})},{id:"sharing",label:"共享权限",icon:(0,ey.jsx)(ZG,{}),content:(0,ey.jsx)(eev,{title:"共享与权限",items:e.settings.sharing})},{id:"autosave",label:"自动保存",icon:(0,ey.jsx)(Kh,{}),content:(0,ey.jsx)(eev,{title:"自动保存策略",items:e.settings.autosave})},{id:"snapshots",label:"快照和版本",icon:(0,ey.jsx)(Ku,{}),content:(0,ey.jsx)(eev,{title:"快照和版本策略",items:e.settings.snapshots})},{id:"hosts",label:"可访问主机",icon:(0,ey.jsx)(Zq,{}),content:(0,ey.jsx)(eev,{title:"可访问主机",items:e.settings.hosts})},{id:"plugins",label:"插件",icon:(0,ey.jsx)(ZK,{}),content:(0,ey.jsx)(eev,{title:"画布插件",items:e.settings.plugins,empty:"未加载插件"})}]}):null}function eem({canvas:e}){return(0,ey.jsxs)("div",{className:"grid gap-5",children:[(0,ey.jsxs)("button",{type:"button",className:"group relative grid min-h-72 rounded-[2rem] border bg-card p-7 text-left transition-colors hover:bg-muted/35",children:[(0,ey.jsxs)("div",{className:"grid gap-5",children:[(0,ey.jsxs)("div",{className:"max-w-2xl",children:[(0,ey.jsx)("h3",{className:"text-3xl font-semibold tracking-normal",children:e.title}),(0,ey.jsx)("p",{className:"mt-4 text-sm leading-6 text-muted-foreground",children:e.purpose})]}),(0,ey.jsxs)("div",{className:"grid max-w-56 gap-2",children:[(0,ey.jsx)(eeg,{label:"Nodes",value:`${e.nodes}`}),(0,ey.jsx)(eeg,{label:"Agent",value:`${e.agents}`}),(0,ey.jsx)(eeg,{label:"Snapshots",value:`${e.snapshots}`})]})]}),(0,ey.jsx)("span",{className:"absolute right-7 bottom-7 text-sm font-medium text-foreground transition-opacity group-hover:opacity-70",children:"进入"})]}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)("span",{className:"text-sm font-medium",children:"Roadmap"}),(0,ey.jsx)(eeh,{icon:(0,ey.jsx)(BT,{}),value:e.runtime})]}),(0,ey.jsx)(ZJ,{items:e.roadmap.map(e=>({id:e.title,title:e.title,status:"running"===e.state?"current":"done"===e.state?"done":"queued"})),viewportClassName:"max-h-64"})]})]})}function eeg({label:e,value:t}){return(0,ey.jsxs)("span",{className:"grid min-w-0 gap-0.5 py-0.5",children:[(0,ey.jsx)("span",{className:"truncate ui-text-kbd text-muted-foreground",children:e}),(0,ey.jsx)("span",{className:"min-w-0 truncate text-sm font-semibold tracking-normal",children:t})]})}function eev({title:e,items:t,empty:n="暂无内容"}){return(0,ey.jsxs)("div",{className:"grid gap-3",children:[(0,ey.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:e}),(0,ey.jsx)("div",{className:"overflow-hidden rounded-xl border bg-card",children:t.length>0?t.map((e,t)=>(0,ey.jsxs)("div",{className:(0,eI.cn)("flex min-h-10 items-center gap-2 px-3 text-sm",t>0&&"border-t"),children:[(0,ey.jsx)(ZU,{className:"size-4 text-muted-foreground"}),(0,ey.jsx)("span",{className:"min-w-0 truncate",children:e})]},e)):(0,ey.jsx)("div",{className:"px-3 py-6 text-sm text-muted-foreground",children:n})})]})}function eex({open:e,onOpenChange:t,onAdd:n}){return(0,ey.jsx)(vE,{open:e,onOpenChange:t,title:"添加节点",description:"搜索并选择要放入画布的可用节点。",className:"top-1/2 max-w-xl -translate-y-1/2",children:(0,ey.jsxs)(vM,{loop:!0,children:[(0,ey.jsx)(vO,{placeholder:"搜索节点..."}),(0,ey.jsxs)(vP,{children:[(0,ey.jsx)(vA,{children:"没有匹配节点。"}),(0,ey.jsx)(vI,{heading:"可用节点",children:dv.map(e=>(0,ey.jsxs)(vz,{value:`${e.title} ${e.description} ${e.keywords}`,onSelect:()=>n(e),children:[(0,ey.jsx)("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg border bg-background text-muted-foreground",children:e.icon}),(0,ey.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,ey.jsx)("span",{className:"block truncate text-sm font-medium",children:e.title}),(0,ey.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,ey.jsxs)(v_,{children:[e.size.width,"x",e.size.height]})]},e.id))})]})]})})}function eey({nodes:e,edges:t,selectedNodeId:n,clipboardItems:r,onNodesChange:a,onEdgesChange:i,onNodesSet:o,onEdgesSet:l,onSelectedNodeChange:s,onClipboardItemsChange:c}){let u=ew.useRef(null),{addPaletteOpen:d,addTemplateNode:f,handleAddPaletteOpenChange:h,handleCanvasAction:p,handleCanvasDragOver:m,handleCanvasDrop:g,handleNodeCanvasConnect:v,handleNodeCanvasEdgeAction:x,handleNodeCanvasNodeAction:y,filePickerDialog:b,renderedCanvasNodes:w}=function({workspaceRef:e,nodes:t,clipboardItems:n,onNodesSet:r,onEdgesSet:a,onSelectedNodeChange:i,onClipboardItemsChange:o}){let l=ew.useRef(0),s=ew.useRef(0),[c,u]=ew.useState(!1),[d,f]=ew.useState(),[h,p]=ew.useState(),m=ew.useCallback((t,n)=>{let r,a,i,o,l,s,c,u;return r=e.current,a=r?.querySelector(".react-flow__viewport"),i=r?.getBoundingClientRect(),l="none"!==(o=a?getComputedStyle(a).transform:"none")?new DOMMatrixReadOnly(o):void 0,s=l?.a&&Number.isFinite(l.a)?l.a:1,c=l?.e??0,u=l?.f??0,{x:(t-(i?.left??0)-c)/s,y:(n-(i?.top??0)-u)/s}},[e]),g=ew.useCallback((e,t)=>{r(n=>n.map(n=>{let r,a;return n.id===e?(a="string"==typeof(r=n.data??{}).activeTabId&&t.some(e=>e.id===r.activeTabId)?r.activeTabId:t[0]?.id,{...n,data:{...r,tabs:t,activeTabId:a}}):n}))},[r]),v=ew.useCallback((e,t)=>{r(n=>n.map(n=>n.id===e?{...n,data:{...n.data??{},activeTabId:t}}:n))},[r]),x=ew.useCallback((e,t)=>{r(n=>n.map(n=>n.id===e?function(e,t){let n=e.data??{};if("multi-tab-system"===n.kind){let r=Array.isArray(n.tabs)?n.tabs:[];return{...e,data:{...n,tabs:r.map(e=>e.id===t.id?t:e),activeTabId:t.id}}}return db(n.kind)?{...e,data:{...n,tab:t}}:e}(n,t):n))},[r]),y=ew.useCallback((e,t)=>{r(n=>n.map(n=>n.id===e?{...n,data:{...n.data??{},terminal:t}}:n))},[r]),b=ew.useCallback((e,t)=>{var n;let a=(n=e.kind,dv.find(e=>e.id===n)?.size??df({width:480,height:320}));s.current+=1;let o=`${e.kind}-detached-${s.current}`;r(n=>[...n,function({tab:e,nodeId:t,center:n,size:r}){return{id:t,type:"blank",position:dm(n,r),data:{contentScale:2,kind:e.kind,tab:{...e,id:`${t}-tab`}},width:r.width,height:r.height,style:dh(r)}}({tab:e,nodeId:o,center:t,size:a})]),i(o)},[r,i]),w=ew.useCallback(async(e,n)=>{try{let a,i=n?.nodeId?t.find(e=>e.id===n.nodeId):void 0,o=i?(i.data??{}).kind:void 0,l="data-table-tab-viewer"===o?await dH(e):await dF(e),s=void 0!==i&&(a=i.data??{},"multi-tab-system"===a.kind||"file-tab-viewer"===a.kind||"data-table-tab-viewer"===a.kind);n?.nodeId&&s&&r(e=>e.map(e=>e.id===n.nodeId?function(e,t,n){let r=e.data??{};if("multi-tab-system"===r.kind){let a,i,o=Array.isArray(r.tabs)?r.tabs:[];return{...e,data:{...r,tabs:(a=o.filter(e=>e.id!==t.id),i=void 0===n?a.length:Math.min(Math.max(n,0),a.length),a.splice(i,0,t),a),activeTabId:t.id}}}return"file-tab-viewer"===r.kind||"data-table-tab-viewer"===r.kind&&"data-table-tab-viewer"===t.kind?{...e,data:{...r,tab:t}}:e}(e,l,n.insertIndex):e)),n?.nodeId&&s||b(l,d??{x:496,y:336})}catch{hx.error("文件预览打开失败")}},[b,t,r,d]),j=ew.useCallback(e=>{let n=t.find(e=>"multi-tab-system"===(e.data??{}).kind);w(e,n?{nodeId:n.id}:void 0)},[t,w]),k=ew.useCallback(async(e,t,n)=>{let r=t.file?.path,a=t.file?.machineId??"local";if(!r)throw hx.error("文件路径不可用"),Error("file path is unavailable");try{let i=await dE({machineId:a,path:r,content:n}),o={...t,title:i.name,modified:!1,defaultValue:"utf-8"===i.encoding?i.content:n,file:{...t.file,name:i.name,path:i.path,machineId:i.machine.id,mimeType:i.mimeType,kind:t.file?.kind,size:i.size,truncated:i.truncated}};x(e,o),hx.success("文件已保存")}catch(e){throw hx.error("文件保存失败"),e}},[x]),S=ew.useCallback((e,t,n)=>{b(t,m(n.clientX,n.clientY))},[b,m]),C=ew.useCallback(e=>{let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id"),r=n.find(e=>e.id===t),a=r?r.payloads?.[KR]:void 0;if(a)return a;let i=e.dataTransfer.getData(KR);if(i)try{return JSON.parse(i)}catch{return}},[n]),N=ew.useCallback((e,t,n)=>{r(r=>r.map(r=>r.id!==e?r:function(e,t,n){let r=e.data??{},a=Array.isArray(r.tabs)?r.tabs:[],i=new Set(a.map(e=>e.id)),o=n.tab.id,l=2;for(;i.has(o);)o=`${n.tab.id}-${l}`,l+=1;let s=[...a];return s.splice(Math.max(0,Math.min(t,s.length)),0,{...n.tab,id:o}),{...e,data:{...r,tabs:s,activeTabId:o}}}(r,t,n)))},[r]),M=ew.useCallback((e,t,n)=>{let r=C(n);r&&N(e,t,r)},[C,N]),E=ew.useCallback(e=>(function(e,t){for(let n of[...e].reverse()){if("multi-tab-system"!==(n.data??{}).kind)continue;let e=function(e){let t="number"==typeof e.width?e.width:"number"==typeof e.style?.width?e.style.width:"string"==typeof e.style?.width?Number.parseFloat(e.style.width):192,n="number"==typeof e.height?e.height:"number"==typeof e.style?.height?e.style.height:"string"==typeof e.style?.height?Number.parseFloat(e.style.height):112;return{width:Number.isFinite(t)?t:192,height:Number.isFinite(n)?n:112}}(n),r=t.x>=n.position.x&&t.x<=n.position.x+e.width,a=t.y>=n.position.y&&t.y<=n.position.y+e.height;if(r&&a)return n}})(t,e),[t]),O=ew.useCallback((t,n,r)=>(function(e,t,n,r){let a=Array.from(e.current?.querySelectorAll(".react-flow__node")??[]).find(e=>e.getAttribute("data-id")===t),i=a?.querySelector('[data-slot="multi-tab-list"]');if(!i)return r;let o=Array.from(i.querySelectorAll("[data-tab-id]"));for(let[e,t]of o.entries()){let r=t.getBoundingClientRect();if(n<r.left+r.width/2)return e}return o.length})(e,t,n,r),[e]),P=function({nodes:e,onTabsChange:t,onActiveTabChange:n,onRequestFileTab:r,onOpenWorkspaceFile:a,onTabChange:i,onSaveFileTab:o,onTerminalStateChange:l,onTabDetach:s,onExternalTabDrop:c}){return ew.useMemo(()=>e.map(e=>{let u=e.data??{},d=(e.data??{}).kind;return d?{...e,data:{...u,content:(0,ey.jsx)(Y9,{kind:d,nodeId:e.id,tab:u.tab,tabs:u.tabs,activeTabId:u.activeTabId,terminalScopeId:`canvas:node:${e.id}`,terminalState:u.terminal,onTerminalStateChange:t=>l(e.id,t),onRequestFileTab:r,onOpenWorkspaceFile:a,onTabsChange:t,onTabChange:i,onSaveFileTab:o,onActiveTabChange:n,onTabDetach:s,onExternalTabDrop:c})}}:e}),[e,n,c,a,r,o,i,s,l,t])}({nodes:t,onTabsChange:g,onActiveTabChange:v,onRequestFileTab:p,onOpenWorkspaceFile:j,onTabChange:x,onSaveFileTab:k,onTerminalStateChange:y,onTabDetach:S,onExternalTabDrop:M}),A=ew.useCallback(e=>{s.current+=1;let n=`${e.id}-${t.length+s.current}`;r(t=>[...t,function({template:e,nodeId:t,center:n}){let r={contentScale:2,kind:e.id};return"multi-tab-system"===e.id?r.tabs=[]:db(e.id)&&(r.tab=dj(e.id,`${t}-tab`)),{id:t,type:"blank",position:dm(n,e.size),data:r,width:e.size.width,height:e.size.height,style:dh(e.size)}}({template:e,nodeId:n,center:d??{x:496,y:336}})]),i(void 0),u(!1),f(void 0)},[t.length,r,i,d]),I=ew.useCallback(e=>{let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id");if(!t)return;let a=n.find(e=>e.id===t),o=m(e.clientX,e.clientY),s=C(e),c=s?E(o):void 0;if(s&&c){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move";let t=c.data??{},n=Array.isArray(t.tabs)?t.tabs:[],r=O(c.id,e.clientX,n.length);N(c.id,r,s),i(void 0);return}let u=a?a.payloads?.[KD]:void 0;if(!a||!u)return;e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move",l.current+=1;let d=`${u.node.id}-drop-${l.current}`;r(e=>[...e,function({source:e,nodeId:t,center:n}){let r={width:e.width??192,height:e.height??112};return{...e,id:t,position:dm(n,r),style:e.style??dh(r),selected:!1,data:{...e.data??{},resizing:!1}}}({source:u.node,nodeId:d,center:o})]),i(d)},[n,E,C,m,O,N,r,i]),z=ew.useCallback(e=>{Array.from(e.dataTransfer.types).some(e=>[KD,KR].includes(e))&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},[]),_=ew.useCallback((e,{flowPosition:t})=>{"add"===e&&(f(t),u(!0))},[]),D=ew.useCallback(e=>{a(t=>{if(t.find(t=>t.source===e.source&&t.target===e.target))return t;let n=t.find(t=>t.source===e.target&&t.target===e.source);return n?t.map(e=>e.id===n.id?{...e,data:{...e.data??{},bidirectional:!0}}:e):[...t,{id:`edge-${e.source}-${e.target}-${t.length+1}`,type:"connection",source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle,data:{anchors:[]}}]})},[a]),R=ew.useCallback((e,t,n)=>{"cut-edge"===e?a(e=>e.filter(e=>e.id!==t)):a(r=>r.map(r=>{if(r.id!==t)return r;let a=[...r.data?.anchors??[]];return"add-anchor"===e&&n.anchor&&a.splice(n.anchorIndex??a.length,0,n.anchor),"move-anchor"===e&&n.anchor&&void 0!==n.anchorIndex&&(a[n.anchorIndex]=n.anchor),"delete-anchor"===e&&void 0!==n.anchorIndex&&a.splice(n.anchorIndex,1),{...r,data:{...r.data??{},anchors:a}}}))},[a]),T=ew.useCallback((e,n,{snappedPosition:l})=>{if("copy"===e)return void r(e=>{let t=e.find(e=>e.id===n);if(!t)return e;let r=`${t.id}-copy-${e.length+1}`;return i(r),[...e,{...t,id:r,position:l,selected:!1,data:{...t.data??{},resizing:!1}}]});if("cut"===e){let e,l,s,c,u,d=t.find(e=>e.id===n);if(!d)return;let f=(s=(l=function(e){let t=e.data??{},n=t.tab;if(n?.id&&db(n.kind))return n;let r=t.kind;if(db(r))return dj(r,e.id)}(e=dk(d)))?{tab:l,sourceNodeId:d.id}:void 0,c={[KD]:{node:e}},u={"application/vnd.vantaloom.clip-kind":l?"canvas-tab":"canvas-node",[KD]:d.id},s&&(c[KR]=s,u[KR]=JSON.stringify(s)),{id:`clip-${d.id}`,title:l?.title??"画布节点",description:l?"来自画布的独立标签页。":"来自节点画布的空白节点。",meta:`${Math.round(d.width??192)}x${Math.round(d.height??112)}`,icon:l?dw(l.kind):(0,ey.jsx)(dt,{className:"size-4"}),dragData:u,payloads:c});o(e=>[f,...e.filter(e=>e.id!==f.id)]),r(e=>e.filter(e=>e.id!==n)),a(e=>e.filter(e=>e.source!==n&&e.target!==n)),i(void 0)}},[t,o,a,r,i]);return{addPaletteOpen:c,addTemplateNode:A,filePickerDialog:(0,ey.jsx)(Gi,{open:void 0!==h,onOpenChange:e=>{e||p(void 0)},onSelectFile:e=>{p(void 0),w(e,h)}}),handleAddPaletteOpenChange:function(e){u(e),e||f(void 0)},handleCanvasAction:_,handleCanvasDragOver:z,handleCanvasDrop:I,handleNodeCanvasConnect:D,handleNodeCanvasEdgeAction:R,handleNodeCanvasNodeAction:T,renderedCanvasNodes:P}}({workspaceRef:u,nodes:e,clipboardItems:r,onNodesChange:a,onEdgesChange:i,onNodesSet:o,onEdgesSet:l,onSelectedNodeChange:s,onClipboardItemsChange:c});return(0,ey.jsxs)("div",{ref:u,className:"vtl-app-background vtl-canvas-workspace relative h-full w-full overflow-hidden",onDragOver:m,onDrop:g,children:[(0,ey.jsx)(sc,{"aria-label":"新建画布",className:"h-full min-h-0 rounded-none border-0",viewportClassName:"h-full",nodes:w,edges:t,nodeTypes:du,edgeTypes:dd,onNodesChange:a,onEdgesChange:i,selectedNodeId:n,onSelectedNodeChange:s,defaultViewport:{x:0,y:0,zoom:.5},labels:{actions:"画布操作",add:"添加节点",select:"普通鼠标",connect:"连接工具",cut:"剪刀工具",drag:"拖拽工具",modeTools:"模式工具",resetZoom:"重置缩放",viewportTools:"视口工具",lockViewport:"锁定视口",visualSnap:"视觉吸附",nodeSnap:"节点吸附",snapTools:"吸附工具",nodeActions:"节点操作",resizeNode:"调整大小",copyNode:"复制节点",cutNode:"剪切节点"},onCanvasAction:p,onNodeCanvasConnect:v,onNodeCanvasEdgeAction:x,onNodeCanvasNodeAction:y}),(0,ey.jsx)(eex,{open:d,onOpenChange:h,onAdd:f}),b,(0,ey.jsx)(hS,{position:"top-right"})]})}g5.length;let eeb={delete:"Delete",empty:"Drop here",title:"Trash"};function eew({active:e=!1,items:t=[],labels:n,className:r,onDrop:a,onDelete:i,onItemRestore:o,...l}){let s={...eeb,...n},[c,u]=ew.useState(!1),d=ew.useRef(0),f=e||c||t.length>0;return ew.useEffect(()=>{e||(d.current=0,u(!1))},[e]),(0,ey.jsx)("div",{"data-slot":"trash-drop-zone","data-visible":f,"data-drag-inside":c,className:(0,eI.cn)("fixed top-4 left-1/2 z-50 -translate-x-1/2 transition-[opacity,transform] duration-300 ease-[cubic-bezier(.2,.8,.2,1)]",f?"pointer-events-auto translate-y-0 opacity-100":"pointer-events-none -translate-y-5 opacity-0",r),onDragEnter:function(e){e.preventDefault(),d.current+=1,u(!0)},onDragLeave:function(){d.current=Math.max(0,d.current-1),0===d.current&&u(!1)},onDragOver:function(e){e.preventDefault(),e.dataTransfer.dropEffect="move",u(!0)},onDrop:function(e){e.preventDefault(),e.stopPropagation(),d.current=0,u(!1);let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id")||e.dataTransfer.getData("text/plain"),n=e.dataTransfer.getData("text/plain")||t||"Dropped item",r=e.dataTransfer.getData("application/vnd.vantaloom.clip-kind");t&&a?.({id:t,title:n,meta:r,nativeEvent:e})},...l,children:(0,ey.jsx)("div",{className:(0,eI.cn)("min-w-12 overflow-hidden rounded-xl border-2 border-background bg-destructive text-destructive-foreground shadow-lg shadow-black/15 transition-[width,min-height,background-color,border-color,padding,box-shadow] duration-300","dark:border-destructive dark:bg-background dark:text-destructive",c||t.length>0?"w-64 border-dashed bg-destructive/12 p-2 text-destructive dark:bg-destructive/8":"flex size-12 items-center justify-center p-0"),children:c||t.length>0?(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsxs)("div",{className:"flex min-h-14 items-center justify-center gap-2 rounded-lg border border-dashed border-destructive/55 bg-destructive/8 px-3 text-sm font-medium text-destructive",children:[(0,ey.jsx)(xC,{className:"size-4"}),(0,ey.jsx)("span",{children:s.empty})]}),t.length>0?(0,ey.jsx)("div",{className:"grid max-h-36 gap-1 overflow-y-auto pr-1",children:t.map(e=>(0,ey.jsxs)("div",{className:"flex h-8 items-center gap-2 rounded-md border border-destructive/25 bg-background/80 px-2 text-foreground",children:[(0,ey.jsx)("button",{type:"button","aria-label":`Restore ${e.title}`,className:"flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive",onClick:()=>o?.(e),children:(0,ey.jsx)(d3.XIcon,{className:"size-3.5"})}),(0,ey.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:e.title}),e.meta?(0,ey.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:e.meta}):null]},e.id))}):null,t.length>0?(0,ey.jsx)("button",{type:"button",className:"h-8 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition-colors hover:bg-destructive/90 dark:border dark:border-destructive dark:bg-background dark:text-destructive dark:hover:bg-destructive/10",onClick:()=>i?.(t),children:s.delete}):null]}):(0,ey.jsx)(xC,{className:"size-5"})})})}function eej({hidden:e,items:t,trashItems:n,trashClipboardItems:r,draggingId:a,onDraggingChange:i,onItemsChange:o,onTrashItemsChange:l,onTrashClipboardItemsChange:s}){let c=ew.useRef(0),[u,d]=ew.useState(!1);return(ew.useEffect(()=>{d(!0)},[]),u)?(0,is.createPortal)((0,ey.jsxs)("div",{className:(0,eI.cn)("pointer-events-none fixed inset-0 z-40 overflow-visible transition-opacity duration-200",e&&"opacity-0"),children:[(0,ey.jsx)(eew,{active:!e&&void 0!==a,items:e?[]:n,className:(0,eI.cn)(e&&"pointer-events-none"),labels:{delete:"删除",empty:"拖入暂存"},onDrop:({id:e,title:n,meta:r})=>{let a=t.find(t=>t.id===e);a&&(s(t=>({...t,[e]:a})),l(t=>t.some(t=>t.id===e)?t:[...t,{id:e,title:n,meta:r,icon:a.icon}]))},onDelete:e=>{let t=new Set(e.map(e=>e.id));l(e=>e.filter(e=>!t.has(e.id))),s(e=>{let n={...e};for(let e of t)delete n[e];return n})},onItemRestore:e=>{let n=r[e.id];n&&o([n,...t.filter(e=>e.id!==n.id)]),l(t=>t.filter(t=>t.id!==e.id)),s(t=>{let n={...t};return delete n[e.id],n})}}),t.length>0?(0,ey.jsx)("div",{className:(0,eI.cn)("pointer-events-auto absolute top-4 right-4 w-80 max-w-[calc(100vw-2rem)] transition-[opacity,transform] duration-200",e&&"pointer-events-none -translate-y-2 opacity-0"),children:(0,ey.jsx)(Gy,{items:t,title:"剪切板",labels:{empty:"剪切板为空",dragHandle:"拖拽卡片"},expansionDirection:"down-left",removeOnExternalDrop:!0,maxExpandedHeight:420,onItemDuplicate:(e,{item:n,index:r})=>{let a,i,l,s,u;return c.current+=1,a=n.payloads?.[KT],i=n.payloads?{...n.payloads}:void 0,l=n.payloads?.[KL],a&&i&&(i[KT]={...a,config:{...a.config}}),l&&i&&(i[KL]={...l,config:l.config?{...l.config}:l.config}),s={...n,id:`${n.id}-copy-${c.current}`,title:`${n.title} copy`,payloads:i,dragData:{...n.dragData,...a?{"application/vnd.vantaloom.dashboard-widget-config":JSON.stringify(a.config)}:{}}},void((u=[...t]).splice(r+1,0,s),o(u))},onItemsRemove:e=>o(e),onItemsReorder:e=>o(e),onItemDragStart:({item:e})=>i(e.id),onItemDragEnd:()=>i(void 0)})}):null]}),document.body):null}let eek=(0,ek.default)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),eeS=(0,ek.default)("languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]),eeC=(0,ek.default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]),eeN=(0,ek.default)("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]),eeM=(0,ek.default)("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),eeE=(0,ek.default)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),eeO=(0,ek.default)("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),eeP=(0,ek.default)("users-round",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]);var eeA="Collapsible",[eeI,eez]=sG(eeA),[ee_,eeD]=eeI(eeA),eeR=ew.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:a,disabled:i,onOpenChange:o,...l}=e,[s,c]=s2({prop:r,defaultProp:a??!1,onChange:o,caller:eeA});return(0,ey.jsx)(ee_,{scope:n,disabled:i,contentId:s0(),open:s,onOpenToggle:ew.useCallback(()=>c(e=>!e),[c]),children:(0,ey.jsx)(s6.div,{"data-state":eeV(s),"data-disabled":i?"":void 0,...l,ref:t})})});eeR.displayName=eeA;var eeT="CollapsibleTrigger",eeL=ew.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,a=eeD(eeT,n);return(0,ey.jsx)(s6.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":eeV(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...r,ref:t,onClick:sY(e.onClick,a.onOpenToggle)})});eeL.displayName=eeT;var ee$="CollapsibleContent",eeF=ew.forwardRef((e,t)=>{let{forceMount:n,...r}=e,a=eeD(ee$,e.__scopeCollapsible);return(0,ey.jsx)(cp,{present:n||a.open,children:({present:e})=>(0,ey.jsx)(eeB,{...r,ref:t,present:e})})});eeF.displayName=ee$;var eeB=ew.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:a,...i}=e,o=eeD(ee$,n),[l,s]=ew.useState(r),c=ew.useRef(null),u=(0,sX.useComposedRefs)(t,c),d=ew.useRef(0),f=d.current,h=ew.useRef(0),p=h.current,m=o.open||l,g=ew.useRef(m),v=ew.useRef(void 0);return ew.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),sZ(()=>{let e=c.current;if(e){v.current=v.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();d.current=t.height,h.current=t.width,g.current||(e.style.transitionDuration=v.current.transitionDuration,e.style.animationName=v.current.animationName),s(r)}},[o.open,r]),(0,ey.jsx)(s6.div,{"data-state":eeV(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!m,...i,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":p?`${p}px`:void 0,...e.style},children:m&&a})});function eeV(e){return e?"open":"closed"}var eeH=e.i(91e3);let eeW={"new-canvas":"canvas","all-canvases":"canvas","open-recent-canvas":"canvas","new-agent-conversation":"agent","open-recent-conversation":"agent",preferences:"settings","preferences-model-routes":"settings","preferences-agent-config":"settings","preferences-subagent-config":"settings","preferences-cc-engine-config":"settings","preferences-layout":"settings","check-update":"settings",account:"settings"};function eeU({navItems:e,contents:t,activeWorkspace:n,activeConversationId:r,activeCanvasId:a,onItemSelect:i,onOpenConversation:o,onOpenCanvas:l,onOpenConversationSettings:s,onOpenCanvasSettings:c,onConversationDeleted:u,onAccountSettings:d,subagentTree:f,activeSubagentPath:h,onOpenSubagent:p,hideCanvas:m,className:g}){let v=eeW[n]??(m?"agent":"canvas");m&&"canvas"===v&&(v="agent");let[x,y]=ew.useState(v);ew.useEffect(()=>{y(v)},[v]);let b=m?e.filter(e=>"canvas"!==e.id):e,w=t.find(e=>e.id===x);return(0,ey.jsxs)("aside",{"data-slot":"flat-sidebar",className:(0,eI.cn)("flex h-full w-72 flex-col rounded-xl border border-border bg-sidebar p-3 text-sidebar-foreground shadow-sm",g),children:[(0,ey.jsx)("nav",{className:"mb-5 flex gap-1 rounded-lg bg-muted/70 p-1",children:b.map(e=>{let t=e.id===x;return(0,ey.jsxs)("button",{type:"button",onClick:()=>y(e.id),className:(0,eI.cn)("flex flex-1 items-center justify-center gap-1.5 rounded-md py-1.5 text-[13px] font-medium transition-colors [&_svg]:size-4",t?"border border-border/50 bg-background text-foreground shadow-sm":"text-muted-foreground hover:bg-background/50 hover:text-foreground"),children:[e.icon,(0,ey.jsx)("span",{className:"truncate",children:e.label})]},e.id)})}),"canvas"===x?(0,ey.jsx)(eeq,{activeCanvasId:a,onItemSelect:i,onOpenCanvas:l,onOpenCanvasSettings:c}):"agent"===x?(0,ey.jsx)(eeY,{activeConversationId:r,onItemSelect:i,onOpenConversation:o,onOpenConversationSettings:s,onConversationDeleted:u,subagentTree:f,activeSubagentPath:h,onOpenSubagent:p}):(0,ey.jsx)(ee4,{content:w,activeWorkspace:n,onItemSelect:i}),(0,ey.jsx)(ete,{onItemSelect:i,onAccountSettings:d})]})}function eeq({activeCanvasId:e,onItemSelect:t,onOpenCanvas:n,onOpenCanvasSettings:r}){let{recents:a,loading:i}=function(){let[e,t]=ew.useState([]),[n,r]=ew.useState(!0);return ew.useEffect(()=>{let e=!0;async function n(){try{let{canvases:n}=await ZF();if(!e)return;let r=[...n].sort((e,t)=>t.updatedAt>e.updatedAt?1:-1);t(r)}catch{}finally{e&&r(!1)}}n();let a=setInterval(()=>void n(),1e4);return()=>{e=!1,clearInterval(a)}},[]),{recents:e,loading:n}}(),o=a.filter(e=>!0===e.running),l=a.filter(e=>!0!==e.running),s=i&&0===a.length;return(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("div",{className:"mb-6 space-y-0.5",children:(0,ey.jsx)(ee8,{icon:eeE,label:Z6.canvasNew,onClick:()=>t({item:{id:"new-canvas"}})})}),(0,ey.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto vtl-scrollbar-hidden pr-1",children:[o.length>0?(0,ey.jsxs)("div",{className:"mb-4",children:[(0,ey.jsxs)("div",{className:"mb-2 flex items-center gap-2 px-3",children:[(0,ey.jsx)("span",{className:"size-1.5 shrink-0 rounded-full bg-green-500"}),(0,ey.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"正在运行"})]}),(0,ey.jsx)("div",{className:"space-y-0.5",children:o.map(t=>(0,ey.jsx)(eeK,{canvas:t,active:t.id===e,onOpenCanvas:n,onOpenCanvasSettings:r},t.id))})]}):null,(0,ey.jsx)("div",{className:"mb-2 flex items-center justify-between px-3",children:(0,ey.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"最近"})}),(0,ey.jsx)("div",{className:"space-y-0.5",children:s?(0,ey.jsx)(ee7,{}):0===l.length?(0,ey.jsx)("p",{className:"px-3 py-1.5 text-[13px] text-muted-foreground/60",children:"暂无画布"}):l.map(t=>(0,ey.jsx)(eeK,{canvas:t,active:t.id===e,onOpenCanvas:n,onOpenCanvasSettings:r},t.id))})]})]})}function eeK({canvas:e,active:t,onOpenCanvas:n,onOpenCanvasSettings:r}){let a=!0===e.running;return(0,ey.jsx)(ee2,{title:a?`${e.title} \xb7 运行中`:e.title,label:e.title,active:t,running:a,onOpen:()=>n(e.id,e.ownerMachineId),onOpenSettings:r?()=>r(e.id,e.ownerMachineId):void 0})}let eeG="__all__",eeX={status:"all",location:eeG,sort:"recent"};function eeY({activeConversationId:e,onItemSelect:t,onOpenConversation:n,onOpenConversationSettings:r,onConversationDeleted:a,subagentTree:i,activeSubagentPath:o,onOpenSubagent:l}){let{recents:s,refresh:c,loading:u,machineNames:d}=function(){let[e,t]=ew.useState([]),[n,r]=ew.useState(!0),[a,i]=ew.useState({}),o=ew.useRef(!0),l=ew.useCallback(async()=>{try{let{conversations:e,machineNames:n}=await sy();if(!o.current)return;let r=[...e].sort((e,t)=>t.updatedAt>e.updatedAt?1:-1);t(r),i(n)}catch{}finally{o.current&&r(!1)}},[]);return ew.useEffect(()=>{o.current=!0,l();let e=setInterval(()=>void l(),1e4);return()=>{o.current=!1,clearInterval(e)}},[l]),{recents:e,refresh:()=>void l(),loading:n,machineNames:a}}(),[f,h]=ew.useState(eeX),p=ew.useMemo(()=>{let e=new Set;for(let t of s)e.add(t.ownerMachineId||sm);return Array.from(e)},[s]),m=ew.useCallback(e=>sg(e)?"本机":d[e]??e,[d]),g=ew.useMemo(()=>{let e=s.filter(e=>{let t=!0===e.running;return("running"!==f.status||!!t)&&("idle"!==f.status||!t)&&(f.location===eeG||(e.ownerMachineId||sm)===f.location)});return"name"===f.sort?e.sort((e,t)=>e.title.localeCompare(t.title,"zh-CN",{sensitivity:"base"})):e.sort((e,t)=>t.updatedAt>e.updatedAt?1:-1),e},[s,f]),v=g.filter(e=>!0===e.running),x=g.filter(e=>!0!==e.running),y=f.status!==eeX.status||f.location!==eeX.location||f.sort!==eeX.sort,b=u&&0===s.length,w=ew.useCallback(async e=>{try{await sO(e.id,e.ownerMachineId)}catch{}a?.(e.id),c()},[a,c]),j=ew.useCallback(async e=>{try{let t=await s_(e.id,void 0,e.ownerMachineId);await c(),n(t.conversation.id,t.conversation.ownerMachineId)}catch{}},[c,n]),k=ew.useMemo(()=>new Set((o??[]).map(e=>e.id)),[o]),S=o?.[o.length-1]?.id,C=t=>{let a=new Map(t.map(e=>[e.id,e])),o=new Map,s=[];for(let e of t){let t=e.forkOriginId;if(t&&a.has(t)){let n=o.get(t)??[];n.push(e),o.set(t,n)}else s.push(e)}let c=(t,a)=>{let s=t.id!==e||(i?.length??0)===0?null:(0,ey.jsx)(eeZ,{nodes:i??[],depth:0,ancestors:[],activeIds:k,activeLeafId:S,onOpen:l});return(0,ey.jsxs)(ew.Fragment,{children:[(0,ey.jsx)(ee1,{conversation:t,depth:a,active:t.id===e,onOpenConversation:n,onOpenConversationSettings:r,onDelete:w,onFork:j}),s?(0,ey.jsx)("div",{style:a>0?{marginLeft:14*a}:void 0,children:s}):null,(o.get(t.id)??[]).map(e=>c(e,a+1))]},t.id)};return s.map(e=>c(e,0))};return(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("div",{className:"mb-6 space-y-0.5","data-tour":"new-conversation",children:(0,ey.jsx)(ee8,{icon:e9,label:Z6.conversationNew,onClick:()=>t({item:{id:"new-agent-conversation"}})})}),(0,ey.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto vtl-scrollbar-hidden pr-1",children:[v.length>0?(0,ey.jsxs)("div",{className:"mb-4",children:[(0,ey.jsxs)("div",{className:"mb-2 flex items-center gap-2 px-3",children:[(0,ey.jsx)("span",{className:"size-1.5 shrink-0 rounded-full bg-green-500"}),(0,ey.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"正在运行"})]}),(0,ey.jsx)("div",{className:"space-y-0.5",children:C(v)})]}):null,(0,ey.jsxs)("div",{className:"mb-2 flex items-center justify-between px-3",children:[(0,ey.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"最近"}),(0,ey.jsx)(eeQ,{filter:f,onChange:h,active:y,locations:p,locationLabel:m})]}),(0,ey.jsx)("div",{className:"space-y-0.5",children:b?(0,ey.jsx)(ee7,{}):0===x.length?(0,ey.jsx)("p",{className:"px-3 py-1.5 text-[13px] text-muted-foreground/60",children:y?"没有符合筛选条件的对话":"暂无对话"}):C(x)})]})]})}function eeZ({nodes:e,depth:t,ancestors:n,activeIds:r,activeLeafId:a,onOpen:i}){let o=e.filter(e=>(function e(t,n){return!!(t.running||n.has(t.id))||(t.children??[]).some(t=>e(t,n))})(e,r));return 0===o.length?null:(0,ey.jsx)("div",{className:"space-y-0.5",children:o.map(e=>{let o=Vi(e.subagentType),l=o.Icon,s=[...n,{id:e.id,ownerMachineId:e.ownerMachineId,name:e.subagentName,subagentType:e.subagentType}],c=e.id===a;return(0,ey.jsxs)("div",{children:[(0,ey.jsxs)("button",{type:"button",className:(0,eI.cn)("flex w-full items-center gap-1.5 rounded-md py-1 pr-2 text-left text-xs transition-colors",c?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),style:{paddingLeft:18+14*t},onClick:()=>i?.(s),title:e.subagentName||o.label,children:[(0,ey.jsx)("span",{className:"shrink-0 text-muted-foreground/40",children:"└"}),(0,ey.jsx)(l,{className:(0,eI.cn)("size-3.5 shrink-0",o.color)}),(0,ey.jsx)("span",{className:"truncate",children:e.subagentName||`${o.label}子代理`}),e.running?(0,ey.jsx)(eM,{className:"ml-auto size-3 shrink-0 animate-spin text-muted-foreground"}):null]}),(0,ey.jsx)(eeZ,{nodes:e.children??[],depth:t+1,ancestors:s,activeIds:r,activeLeafId:a,onOpen:i})]},e.id)})})}let eeJ={all:"全部",running:"运行中",idle:"空闲"};function eeQ({filter:e,onChange:t,active:n,locations:r,locationLabel:a}){let i=e.location===eeG?"全部":a(e.location);return(0,ey.jsxs)(y2,{children:[(0,ey.jsx)(y4,{asChild:!0,children:(0,ey.jsxs)("button",{type:"button",title:"筛选","aria-label":"筛选",className:(0,eI.cn)("relative rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground",n&&"text-foreground"),children:[(0,ey.jsx)(ZX,{className:"size-4"}),n?(0,ey.jsx)("span",{className:"absolute -right-0.5 -top-0.5 size-2 rounded-full border border-sidebar bg-primary"}):null]})}),(0,ey.jsxs)(bl,{align:"end",sideOffset:4,className:"min-w-56",children:[(0,ey.jsx)(bu,{children:"筛选与排序"}),(0,ey.jsxs)(bo,{children:[(0,ey.jsxs)(bh,{children:[(0,ey.jsx)("span",{className:"flex-1",children:"状态"}),(0,ey.jsx)("span",{className:"text-xs text-muted-foreground",children:eeJ[e.status]})]}),(0,ey.jsx)(bp,{children:(0,ey.jsxs)(be,{value:e.status,onValueChange:n=>t({...e,status:n}),children:[(0,ey.jsx)(bc,{value:"all",children:"全部"}),(0,ey.jsx)(bc,{value:"running",children:"运行中"}),(0,ey.jsx)(bc,{value:"idle",children:"空闲"})]})})]}),(0,ey.jsxs)(bo,{children:[(0,ey.jsxs)(bh,{children:[(0,ey.jsx)("span",{className:"flex-1",children:"运行位置"}),(0,ey.jsx)("span",{className:"max-w-24 truncate text-xs text-muted-foreground",children:i})]}),(0,ey.jsx)(bp,{className:"max-h-72 overflow-y-auto",children:(0,ey.jsxs)(be,{value:e.location,onValueChange:n=>t({...e,location:n}),children:[(0,ey.jsx)(bc,{value:eeG,children:"全部"}),r.map(e=>(0,ey.jsx)(bc,{value:e,children:(0,ey.jsx)("span",{className:"truncate",children:a(e)})},e))]})})]}),(0,ey.jsx)(bd,{}),(0,ey.jsx)(bu,{children:"排序"}),(0,ey.jsxs)(be,{value:e.sort,onValueChange:n=>t({...e,sort:n}),children:[(0,ey.jsx)(bc,{value:"recent",children:"最近活动"}),(0,ey.jsx)(bc,{value:"name",children:"名称"})]}),n?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(bd,{}),(0,ey.jsx)(bs,{onSelect:()=>t(eeX),children:(0,ey.jsx)("span",{className:"flex-1",children:"重置筛选"})})]}):null]})]})}function ee0({engine:e}){if("vantaloom"===e)return null;let t="claude-code"===e;return(0,ey.jsxs)("span",{title:t?"Claude Code":"reclaude",className:(0,eI.cn)("relative inline-flex shrink-0 select-none items-center justify-center rounded px-1 py-px text-[9px] font-semibold leading-none tracking-wide",t?"bg-violet-500/15 text-violet-600 dark:bg-violet-400/20 dark:text-violet-300":"bg-sky-500/15 text-sky-600 dark:bg-sky-400/20 dark:text-sky-300"),children:[t?"CC":"RC",!t&&(0,ey.jsx)("span",{className:"absolute -right-0.5 -top-0.5 size-1.5 rounded-full bg-sky-400 dark:bg-sky-300"})]})}function ee1({conversation:e,active:t,depth:n=0,onOpenConversation:r,onOpenConversationSettings:a,onDelete:i,onFork:o}){let l=!0===e.running,s=e.settings?.engine??"vantaloom",c="vantaloom"!==s?(0,ey.jsxs)("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden",children:[(0,ey.jsx)(ee0,{engine:s}),(0,ey.jsx)("span",{className:"truncate",children:e.title})]}):void 0;return(0,ey.jsx)(ee2,{title:l?`${e.title} \xb7 运行中`:e.title,label:e.title,labelNode:c,active:t,running:l,depth:n,onOpen:()=>r(e.id,e.ownerMachineId),onOpenSettings:a?()=>a(e.id,e.ownerMachineId):void 0,onDelete:i?()=>i(e):void 0,onFork:o?()=>o(e):void 0,deleteLabel:"删除会话"})}function ee2({title:e,label:t,labelNode:n,active:r,running:a,depth:i=0,onOpen:o,onOpenSettings:l,onDelete:s,onFork:c,deleteLabel:u="删除"}){let[d,f]=ew.useState(!1),h=i>0;return(0,ey.jsxs)("div",{className:(0,eI.cn)("group relative flex items-center rounded-lg text-[13px] transition-colors",r?"bg-muted text-foreground":"text-foreground/80 hover:bg-muted hover:text-foreground"),style:h?{marginLeft:14*i}:void 0,children:[(0,ey.jsxs)("button",{type:"button",title:e,onClick:o,className:"flex min-w-0 flex-1 items-center gap-3 rounded-lg px-3 py-2 text-left",children:[h?(0,ey.jsx)("span",{"aria-hidden":!0,className:"h-4 w-0.5 shrink-0 rounded-full bg-primary/40"}):null,a?(0,ey.jsx)("span",{className:"size-1.5 shrink-0 rounded-full bg-green-500","aria-label":"运行中"}):(0,ey.jsx)(ee9,{active:r}),n??(0,ey.jsx)("span",{className:"min-w-0 flex-1 truncate",children:t})]}),l||s||c?(0,ey.jsxs)(y2,{children:[(0,ey.jsx)(y4,{asChild:!0,children:(0,ey.jsx)("button",{type:"button","aria-label":"更多操作",className:"mr-1 shrink-0 rounded-md p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-background/70 hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100 aria-expanded:opacity-100",children:(0,ey.jsx)(lF,{className:"size-4"})})}),(0,ey.jsxs)(bl,{align:"end",sideOffset:4,className:"min-w-44",children:[l?(0,ey.jsxs)(bs,{onSelect:()=>l(),children:[(0,ey.jsx)(Jl,{}),(0,ey.jsx)("span",{className:"flex-1",children:"打开设置界面"})]}):null,c?(0,ey.jsxs)(bs,{onSelect:()=>c(),children:[(0,ey.jsx)(BT,{}),(0,ey.jsx)("span",{className:"flex-1",children:"分支对话"})]}):null,s?(0,ey.jsxs)(bs,{variant:"destructive",onSelect:()=>f(!0),children:[(0,ey.jsx)(xC,{}),(0,ey.jsx)("span",{className:"flex-1",children:u})]}):null]})]}):null,s?(0,ey.jsx)(uL,{open:d,onOpenChange:f,children:(0,ey.jsxs)(u2,{children:[(0,ey.jsxs)(u5,{children:[(0,ey.jsx)(u3,{children:u}),(0,ey.jsxs)(u6,{children:["确认删除「",t,"」?此操作无法撤销。"]})]}),(0,ey.jsxs)(u4,{children:[(0,ey.jsx)(u7,{children:"取消"}),(0,ey.jsx)(u8,{variant:"destructive",onClick:()=>s(),children:"删除"})]})]})}):null]})}let ee5=["preferences","preferences-model-routes","preferences-agent-config","preferences-subagent-config","preferences-cc-engine-config","preferences-layout"];function ee4({content:e,activeWorkspace:t,onItemSelect:n}){let r=(e?.sections??[]).flatMap(e=>e.items);return(0,ey.jsx)(bQ,{className:"min-h-0 flex-1",viewportClassName:"pr-1",children:(0,ey.jsx)("div",{className:"space-y-0.5",children:r.map(e=>"preferences"===e.id?(0,ey.jsx)(ee6,{activeWorkspace:t,onItemSelect:n},e.id):(0,ey.jsx)(ee3,{id:e.id,icon:e.icon,label:e.label,active:e.id===t,onItemSelect:n},e.id))})})}function ee3({id:e,icon:t,label:n,active:r,onItemSelect:a}){return(0,ey.jsxs)("button",{type:"button",onClick:()=>a({item:{id:e}}),className:(0,eI.cn)("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[13px] transition-colors [&_svg]:size-4 [&_svg]:shrink-0",r?"bg-muted text-foreground [&_svg]:text-foreground":"text-foreground/80 hover:bg-muted hover:text-foreground [&_svg]:text-muted-foreground"),children:[t,(0,ey.jsx)("span",{className:"min-w-0 flex-1 truncate",children:n}),r&&(0,ey.jsx)(ee9,{active:!0})]})}function ee6({activeWorkspace:e,onItemSelect:t}){let n=ee5.includes(e),[r,a]=ew.useState(!0),i=[{id:"preferences-model-routes",label:"模型路由",icon:(0,ey.jsx)(pj,{})},{id:"preferences-agent-config",label:"代理配置",icon:(0,ey.jsx)(de,{})},{id:"preferences-subagent-config",label:"子代理配置",icon:(0,ey.jsx)(eeP,{})},{id:"preferences-cc-engine-config",label:"CC 引擎",icon:(0,ey.jsx)(dr,{})},{id:"preferences-layout",label:"布局排版",icon:(0,ey.jsx)(eeC,{})}];return(0,ey.jsxs)(eeR,{open:r,onOpenChange:a,children:[(0,ey.jsx)(eeL,{asChild:!0,children:(0,ey.jsxs)("button",{type:"button",className:(0,eI.cn)("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[13px] transition-colors [&_svg]:size-4 [&_svg]:shrink-0",n?"text-foreground [&>svg:first-child]:text-foreground":"text-foreground/80 hover:bg-muted hover:text-foreground [&>svg:first-child]:text-muted-foreground"),children:[(0,ey.jsx)(Jl,{}),(0,ey.jsx)("span",{className:"min-w-0 flex-1 truncate",children:"偏好设置"}),(0,ey.jsx)(gK,{className:(0,eI.cn)("text-muted-foreground transition-transform",r?"rotate-0":"-rotate-90")})]})}),(0,ey.jsx)(eeF,{className:"mt-0.5 space-y-0.5",children:i.map(n=>{let r=n.id===e;return(0,ey.jsxs)("button",{type:"button",onClick:()=>t({item:{id:n.id}}),className:(0,eI.cn)("flex w-full items-center gap-3 rounded-lg py-2 pl-9 pr-3 text-left text-[13px] transition-colors [&_svg]:size-4 [&_svg]:shrink-0",r?"bg-muted text-foreground [&_svg]:text-foreground":"text-foreground/80 hover:bg-muted hover:text-foreground [&_svg]:text-muted-foreground"),children:[n.icon,(0,ey.jsx)("span",{className:"min-w-0 flex-1 truncate",children:n.label}),r&&(0,ey.jsx)(ee9,{active:!0})]},n.id)})})]})}function ee8({icon:e,label:t,onClick:n}){return(0,ey.jsxs)("button",{type:"button",onClick:n,className:"flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm text-foreground transition-colors hover:bg-muted",children:[(0,ey.jsx)(e,{className:"size-4 shrink-0 text-muted-foreground"}),(0,ey.jsx)("span",{className:"min-w-0 flex-1 truncate",children:t})]})}function ee7(){return(0,ey.jsxs)("div",{className:"flex items-center justify-center gap-2 px-3 py-3 text-[13px] text-muted-foreground/70",role:"status","aria-live":"polite",children:[(0,ey.jsx)(eM,{className:"size-4 animate-spin"}),(0,ey.jsx)("span",{children:"加载中…"})]})}function ee9({active:e}){return(0,ey.jsx)("span",{className:(0,eI.cn)("size-1.5 shrink-0 rounded-full",e?"bg-primary":"border border-muted-foreground/50 bg-transparent")})}function ete({onItemSelect:e,onAccountSettings:t}){let{user:n}=e8(),r=n?.name??Z3.product,a=(n?.name??"V").slice(0,1).toUpperCase();return(0,ey.jsx)("div",{className:"mt-auto pt-3",children:(0,ey.jsxs)(y2,{children:[(0,ey.jsx)(y4,{asChild:!0,children:(0,ey.jsxs)("button",{type:"button","data-tour":"account-button",className:"flex w-full items-center justify-between rounded-xl p-2 transition-colors hover:bg-muted",children:[(0,ey.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,ey.jsx)("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-full border border-border/60 bg-muted text-[10px] font-semibold text-foreground",children:a}),(0,ey.jsx)("span",{className:"truncate text-sm text-foreground",children:r})]}),(0,ey.jsx)(pC,{className:"size-4 shrink-0 -rotate-90 text-muted-foreground"})]})}),(0,ey.jsxs)(bl,{side:"top",align:"start",sideOffset:8,className:"w-[var(--radix-dropdown-menu-trigger-width)] min-w-60",children:[n?.email&&(0,ey.jsx)(bu,{className:"truncate font-normal text-muted-foreground",children:n.email}),(0,ey.jsxs)(bs,{onSelect:()=>e({item:{id:"preferences"}}),children:[(0,ey.jsx)(Jl,{}),(0,ey.jsx)("span",{className:"flex-1",children:"设置"}),(0,ey.jsx)("span",{className:"text-xs text-muted-foreground",children:"Ctrl,"})]}),(0,ey.jsxs)(bs,{disabled:!0,children:[(0,ey.jsx)(eeS,{}),(0,ey.jsx)("span",{className:"flex-1",children:"语言"}),(0,ey.jsx)("span",{className:"text-xs text-muted-foreground",children:"中文"})]}),(0,ey.jsxs)(bs,{disabled:!0,children:[(0,ey.jsx)(eek,{}),(0,ey.jsx)("span",{className:"flex-1",children:"获取帮助"})]}),(0,ey.jsx)(bd,{}),(0,ey.jsxs)(bs,{onSelect:()=>{t?t():e({item:{id:"account"}})},children:[(0,ey.jsx)(Ku,{}),(0,ey.jsx)("span",{className:"flex-1",children:"Hub 账户"})]}),(0,ey.jsx)(etn,{}),n&&(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(bd,{}),(0,ey.jsx)(etr,{})]})]})]})})}let ett=["light","dark","jelly"];function etn(){let{resolvedTheme:e,setTheme:t}=(0,hl.useTheme)(),[n,r]=ew.useState(eeH.defaultAppearanceTheme);ew.useEffect(()=>{let e=window.localStorage.getItem(eeH.appearanceThemeStorageKey)??eeH.defaultAppearanceTheme;r(e),(0,eeH.applyAppearanceTheme)({theme:e})},[]);let a=n===eeH.jellyAppearanceTheme?"jelly":"dark"===e?"dark":"light",i=ett[(ett.indexOf(a)+1)%ett.length]??"light";function o(e){r(e),window.localStorage.setItem(eeH.appearanceThemeStorageKey,e),(0,eeH.applyAppearanceTheme)({theme:e})}let l="dark"===a?eeM:eeO;return(0,ey.jsxs)(bs,{onSelect:e=>{e.preventDefault(),function(){if("jelly"===i){t("dark"),o(eeH.jellyAppearanceTheme);return}o(eeH.defaultAppearanceTheme),t(i)}()},children:[(0,ey.jsx)(l,{}),(0,ey.jsx)("span",{className:"flex-1",children:Z3.theme}),(0,ey.jsx)("span",{className:"text-xs capitalize text-muted-foreground",children:a})]})}function etr(){let{logout:e}=e8();return(0,ey.jsxs)(bs,{variant:"destructive",onSelect:()=>{e().then(()=>{window.location.reload()})},children:[(0,ey.jsx)(eeN,{}),(0,ey.jsx)("span",{className:"flex-1",children:"退出登录"})]})}let eta=ew.default.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),eti=()=>{let e=ew.default.useContext(eta);if(!e)throw Error("useDrawerContext must be used within a Drawer.Root");return e};function eto(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function etl(){return ets(/^iPhone/)||ets(/^iPad/)||ets(/^Mac/)&&navigator.maxTouchPoints>1}function ets(e){return"u">typeof window&&null!=window.navigator?e.test(window.navigator.platform):void 0}!function(e){if(!e||"u"<typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}("[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(\n[data-state=closed]\n){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}");let etc="u">typeof window?ew.useLayoutEffect:ew.useEffect;function etu(...e){return(...t)=>{for(let n of e)"function"==typeof n&&n(...t)}}let etd="u">typeof document&&window.visualViewport;function etf(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function eth(e){for(etf(e)&&(e=e.parentElement);e&&!etf(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}let etp=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),etm=0;function etg(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function etv(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=eth(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let n=t.getBoundingClientRect().top,r=e.getBoundingClientRect().top;e.getBoundingClientRect().bottom>t.getBoundingClientRect().bottom+24&&(t.scrollTop+=r-n)}e=t.parentElement}}function etx(e){return e instanceof HTMLInputElement&&!etp.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function ety(...e){return ew.useCallback(function(...e){return t=>e.forEach(e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)})}(...e),e)}let etb=new WeakMap;function etw(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([t,n])=>{t.startsWith("--")?e.style.setProperty(t,n):(r[t]=e.style[t],e.style[t]=n)}),n||etb.set(e,r)}let etj=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function etk(e,t){if(!e)return null;let n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform,a=r.match(/^matrix3d\((.+)\)$/);return a?parseFloat(a[1].split(", ")[etj(t)?13:12]):(a=r.match(/^matrix\((.+)\)$/))?parseFloat(a[1].split(", ")[etj(t)?5:4]):null}function etS(e,t){if(!e)return()=>{};let n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}let etC=[.32,.72,0,1],etN="vaul-dragging";function etM(e){let t=ew.default.useRef(e);return ew.default.useEffect(()=>{t.current=e}),ew.default.useMemo(()=>(...e)=>null==t.current?void 0:t.current.call(t,...e),[])}function etE({prop:e,defaultProp:t,onChange:n=()=>{}}){let[r,a]=function({defaultProp:e,onChange:t}){let n=ew.default.useState(e),[r]=n,a=ew.default.useRef(r),i=etM(t);return ew.default.useEffect(()=>{a.current!==r&&(i(r),a.current=r)},[r,a,i]),n}({defaultProp:t,onChange:n}),i=void 0!==e,o=i?e:r,l=etM(n);return[o,ew.default.useCallback(t=>{if(i){let n="function"==typeof t?t(e):t;n!==e&&l(n)}else a(t)},[i,e,a,l])]}let etO=()=>()=>{},etP=null,etA=ew.default.forwardRef(function({...e},t){let{overlayRef:n,snapPoints:r,onRelease:a,shouldFade:i,isOpen:o,modal:l,shouldAnimate:s}=eti(),c=ety(t,n),u=r&&r.length>0;if(!l)return null;let d=ew.default.useCallback(e=>a(e),[a]);return ew.default.createElement(up,{onMouseUp:d,ref:c,"data-vaul-overlay":"","data-vaul-snap-points":o&&u?"true":"false","data-vaul-snap-points-overlay":o&&i?"true":"false","data-vaul-animate":(null==s?void 0:s.current)?"true":"false",...e})});etA.displayName="Drawer.Overlay";let etI=ew.default.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},a){let{drawerRef:i,onPress:o,onRelease:l,onDrag:s,keyboardIsOpen:c,snapPointsOffset:u,activeSnapPointIndex:d,modal:f,isOpen:h,direction:p,snapPoints:m,container:g,handleOnly:v,shouldAnimate:x,autoFocus:y}=eti(),[b,w]=ew.default.useState(!1),j=ety(a,i),k=ew.default.useRef(null),S=ew.default.useRef(null),C=ew.default.useRef(!1),N=m&&m.length>0;function M(e){k.current=null,C.current=!1,l(e)}return!function(){let{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:a}=eti(),i=ew.default.useRef(null),o=(0,ew.useMemo)(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-26)/window.innerWidth}ew.default.useEffect(()=>{if(t&&n){i.current&&clearTimeout(i.current);let t=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!t)return;!function(...e){}(r&&!a?etS(document.body,{background:"black"}):etO,etS(t,{transformOrigin:etj(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:"0.5s",transitionTimingFunction:`cubic-bezier(${etC.join(",")})`}));let n=etS(t,{borderRadius:"8px",overflow:"hidden",...etj(e)?{transform:`scale(${l()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${l()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{n(),i.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty("background")},500)}}},[t,n,o])}(),ew.default.useEffect(()=>{N&&window.requestAnimationFrame(()=>{w(!0)})},[]),ew.default.createElement(ux,{"data-vaul-drawer-direction":p,"data-vaul-drawer":"","data-vaul-delayed-snap-points":b?"true":"false","data-vaul-snap-points":h&&N?"true":"false","data-vaul-custom-container":g?"true":"false","data-vaul-animate":(null==x?void 0:x.current)?"true":"false",...r,ref:j,style:u&&u.length>0?{"--snap-point-height":`${u[null!=d?d:0]}px`,...t}:t,onPointerDown:e=>{v||(null==r.onPointerDown||r.onPointerDown.call(r,e),k.current={x:e.pageX,y:e.pageY},o(e))},onOpenAutoFocus:e=>{null==n||n(e),y||e.preventDefault()},onPointerDownOutside:t=>{(null==e||e(t),!f||t.defaultPrevented)?t.preventDefault():c.current&&(c.current=!1)},onFocusOutside:e=>{if(!f)return void e.preventDefault()},onPointerMove:e=>{if(S.current=e,v||(null==r.onPointerMove||r.onPointerMove.call(r,e),!k.current))return;let t=e.pageY-k.current.y,n=e.pageX-k.current.x,a="touch"===e.pointerType?10:2;((e,t,n=0)=>{if(C.current)return!0;let r=Math.abs(e.y),a=Math.abs(e.x),i=a>r,o=["bottom","right"].includes(t)?1:-1;if("left"===t||"right"===t){if(!(e.x*o<0)&&a>=0&&a<=n)return i}else if(!(e.y*o<0)&&r>=0&&r<=n)return!i;return C.current=!0,!0})({x:n,y:t},p,a)?s(e):(Math.abs(n)>a||Math.abs(t)>a)&&(k.current=null)},onPointerUp:e=>{null==r.onPointerUp||r.onPointerUp.call(r,e),k.current=null,C.current=!1,l(e)},onPointerOut:e=>{null==r.onPointerOut||r.onPointerOut.call(r,e),M(S.current)},onContextMenu:e=>{null==r.onContextMenu||r.onContextMenu.call(r,e),S.current&&M(S.current)}})});etI.displayName="Drawer.Content",ew.default.forwardRef(function({preventCycle:e=!1,children:t,...n},r){let{closeDrawer:a,isDragging:i,snapPoints:o,activeSnapPoint:l,setActiveSnapPoint:s,dismissible:c,handleOnly:u,isOpen:d,onPress:f,onDrag:h}=eti(),p=ew.default.useRef(null),m=ew.default.useRef(!1);function g(){p.current&&window.clearTimeout(p.current),m.current=!1}return ew.default.createElement("div",{onClick:function(){m.current?g():window.setTimeout(()=>{!function(){if(i||e||m.current)return g();if(g(),!o||0===o.length){c||a();return}if(l===o[o.length-1]&&c)return a();let t=o.findIndex(e=>e===l);-1===t||s(o[t+1])}()},120)},onPointerCancel:g,onPointerDown:e=>{u&&f(e),p.current=window.setTimeout(()=>{m.current=!0},250)},onPointerMove:e=>{u&&h(e)},ref:r,"data-vaul-drawer-visible":d?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},ew.default.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))}).displayName="Drawer.Handle";let etz=function({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:a,snapPoints:i,shouldScaleBackground:l=!1,setBackgroundColorOnScale:s=!0,closeThreshold:c=.25,scrollLockTimeout:u=100,dismissible:d=!0,handleOnly:f=!1,fadeFromIndex:h=i&&i.length-1,activeSnapPoint:p,setActiveSnapPoint:m,fixed:g,modal:v=!0,onClose:x,nested:y,noBodyStyles:b=!1,direction:w="bottom",defaultOpen:j=!1,disablePreventScroll:k=!0,snapToSequentialPoint:S=!1,preventScrollRestoration:C=!1,repositionInputs:N=!0,onAnimationEnd:M,container:E,autoFocus:O=!1}){var P,A;let[I=!1,z]=etE({defaultProp:j,prop:e,onChange:e=>{null==t||t(e),e||y||eu(),setTimeout(()=>{null==M||M(e)},500),e&&!v&&"u">typeof window&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),e||(document.body.style.pointerEvents="auto")}}),[_,D]=ew.default.useState(!1),[R,T]=ew.default.useState(!1),[L,$]=ew.default.useState(!1),F=ew.default.useRef(null),B=ew.default.useRef(null),V=ew.default.useRef(null),H=ew.default.useRef(null),W=ew.default.useRef(null),U=ew.default.useRef(!1),q=ew.default.useRef(null),K=ew.default.useRef(0),G=ew.default.useRef(!1),X=ew.default.useRef(!j),Y=ew.default.useRef(0),Z=ew.default.useRef(null),J=ew.default.useRef((null==(P=Z.current)?void 0:P.getBoundingClientRect().height)||0),Q=ew.default.useRef((null==(A=Z.current)?void 0:A.getBoundingClientRect().width)||0),ee=ew.default.useRef(0),et=ew.default.useCallback(e=>{i&&e===eo.length-1&&(B.current=new Date)},[]),{activeSnapPoint:en,activeSnapPointIndex:er,setActiveSnapPoint:ea,onRelease:ei,snapPointsOffset:eo,onDrag:el,shouldFade:es,getPercentageDragged:ec}=function({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:a,fadeFromIndex:i,onSnapPointChange:o,direction:l="bottom",container:s,snapToSequentialPoint:c}){let[u,d]=etE({prop:e,defaultProp:null==n?void 0:n[0],onChange:t}),[f,h]=ew.default.useState("u">typeof window?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);ew.default.useEffect(()=>{function e(){h({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let p=ew.default.useMemo(()=>u===(null==n?void 0:n[n.length-1])||null,[n,u]),m=ew.default.useMemo(()=>{var e;return null!=(e=null==n?void 0:n.findIndex(e=>e===u))?e:null},[n,u]),g=n&&n.length>0&&(i||0===i)&&!Number.isNaN(i)&&n[i]===u||!n,v=ew.default.useMemo(()=>{var e;let t=s?{width:s.getBoundingClientRect().width,height:s.getBoundingClientRect().height}:"u">typeof window?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};return null!=(e=null==n?void 0:n.map(e=>{let n="string"==typeof e,r=0;if(n&&(r=parseInt(e,10)),etj(l)){let a=n?r:f?e*t.height:0;return f?"bottom"===l?t.height-a:-t.height+a:a}let a=n?r:f?e*t.width:0;return f?"right"===l?t.width-a:-t.width+a:a}))?e:[]},[n,f,s]),x=ew.default.useMemo(()=>null!==m?null==v?void 0:v[m]:null,[v,m]),y=ew.default.useCallback(e=>{var t;let s=null!=(t=null==v?void 0:v.findIndex(t=>t===e))?t:null;o(s),etw(r.current,{transition:`transform 0.5s cubic-bezier(${etC.join(",")})`,transform:etj(l)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),v&&s!==v.length-1&&void 0!==i&&s!==i&&s<i?etw(a.current,{transition:`opacity 0.5s cubic-bezier(${etC.join(",")})`,opacity:"0"}):etw(a.current,{transition:`opacity 0.5s cubic-bezier(${etC.join(",")})`,opacity:"1"}),d(null==n?void 0:n[Math.max(s,0)])},[r.current,n,v,i,a,d]);return ew.default.useEffect(()=>{if(u||e){var t;let r=null!=(t=null==n?void 0:n.findIndex(t=>t===e||t===u))?t:-1;v&&-1!==r&&"number"==typeof v[r]&&y(v[r])}},[u,e,n,v,y]),{isLastSnapPoint:p,activeSnapPoint:u,shouldFade:g,getPercentageDragged:function(e,t){if(!n||"number"!=typeof m||!v||void 0===i)return null;let r=m===i-1;if(m>=i&&t)return 0;if(r&&!t)return 1;if(!g&&!r)return null;let a=r?m+1:m-1,o=e/Math.abs(r?v[a]-v[a-1]:v[a+1]-v[a]);return r?1-o:o},setActiveSnapPoint:d,activeSnapPointIndex:m,onRelease:function({draggedDistance:e,closeDrawer:t,velocity:r,dismissible:o}){if(void 0===i)return;let s="bottom"===l||"right"===l?(null!=x?x:0)-e:(null!=x?x:0)+e,u=m===i-1,d=0===m,f=e>0;if(u&&etw(a.current,{transition:`opacity 0.5s cubic-bezier(${etC.join(",")})`}),!c&&r>2&&!f)return void(o?t():y(v[0]));if(!c&&r>2&&f&&v&&n)return void y(v[n.length-1]);let h=null==v?void 0:v.reduce((e,t)=>"number"!=typeof e||"number"!=typeof t?e:Math.abs(t-s)<Math.abs(e-s)?t:e),g=etj(l)?window.innerHeight:window.innerWidth;if(r>.4&&Math.abs(e)<.4*g){let e=f?1:-1;return e>0&&p&&n?void y(v[n.length-1]):void(d&&e<0&&o&&t(),null===m||y(v[m+e]))}y(h)},onDrag:function({draggedDistance:e}){if(null===x)return;let t="bottom"===l||"right"===l?x-e:x+e;("bottom"===l||"right"===l)&&t<v[v.length-1]||("top"===l||"left"===l)&&t>v[v.length-1]||etw(r.current,{transform:etj(l)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})},snapPointsOffset:v}}({snapPoints:i,activeSnapPointProp:p,setActiveSnapPointProp:m,drawerRef:Z,fadeFromIndex:h,overlayRef:F,onSnapPointChange:et,direction:w,container:E,snapToSequentialPoint:S});!function(e={}){let{isDisabled:t}=e;etc(()=>{if(!t){var e,n,r;let t,a,i,l,s,c,u;return 1==++etm&&etl()&&(i=0,l=window.pageXOffset,s=window.pageYOffset,c=etu((e=document.documentElement,n="paddingRight",r=`${window.innerWidth-document.documentElement.clientWidth}px`,t=e.style[n],e.style[n]=r,()=>{e.style[n]=t})),window.scrollTo(0,0),u=etu(etg(document,"touchstart",e=>{((a=eth(e.target))!==document.documentElement||a!==document.body)&&(i=e.changedTouches[0].pageY)},{passive:!1,capture:!0}),etg(document,"touchmove",e=>{if(!a||a===document.documentElement||a===document.body)return void e.preventDefault();let t=e.changedTouches[0].pageY,n=a.scrollTop,r=a.scrollHeight-a.clientHeight;0!==r&&((n<=0&&t>i||n>=r&&t<i)&&e.preventDefault(),i=t)},{passive:!1,capture:!0}),etg(document,"touchend",e=>{let t=e.target;etx(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform="translateY(-2000px)",t.focus(),requestAnimationFrame(()=>{t.style.transform=""}))},{passive:!1,capture:!0}),etg(document,"focus",e=>{let t=e.target;etx(t)&&(t.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{t.style.transform="",etd&&(etd.height<window.innerHeight?requestAnimationFrame(()=>{etv(t)}):etd.addEventListener("resize",()=>etv(t),{once:!0}))}))},!0),etg(window,"scroll",()=>{window.scrollTo(0,0)})),o=()=>{c(),u(),window.scrollTo(l,s)}),()=>{0==--etm&&(null==o||o())}}},[t])}({isDisabled:!I||R||!v||L||!_||!N||!k});let{restorePositionSetting:eu}=function({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:a,noBodyStyles:i}){let[o,l]=ew.default.useState(()=>"u">typeof window?window.location.href:""),s=ew.default.useRef(0),c=ew.default.useCallback(()=>{if(eto()&&null===etP&&e&&!i){etP={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};let{scrollX:e,innerHeight:t}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-s.current}px`,left:`${-e}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{let e=t-window.innerHeight;e&&s.current>=t&&(document.body.style.top=`${-(s.current+e)}px`)}),300)}},[e]),u=ew.default.useCallback(()=>{if(eto()&&null!==etP&&!i){let e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,etP),window.requestAnimationFrame(()=>{a&&o!==window.location.href?l(window.location.href):window.scrollTo(t,e)}),etP=null}},[o]);return ew.default.useEffect(()=>{function e(){s.current=window.scrollY}return e(),window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}},[]),ew.default.useEffect(()=>{if(t)return()=>{"u"<typeof document||document.querySelector("[data-vaul-drawer]")||u()}},[t,u]),ew.default.useEffect(()=>{!n&&r&&(e?(window.matchMedia("(display-mode: standalone)").matches||c(),t||window.setTimeout(()=>{u()},500)):u())},[e,r,o,t,n,c,u]),{restorePositionSetting:u}}({isOpen:I,modal:v,nested:null!=y&&y,hasBeenOpened:_,preventScrollRestoration:C,noBodyStyles:b});function ed(){return(window.innerWidth-26)/window.innerWidth}function ef(e,t){var n;let r=e,a=null==(n=window.getSelection())?void 0:n.toString(),i=Z.current?etk(Z.current,w):null,o=new Date;if("SELECT"===r.tagName||r.hasAttribute("data-vaul-no-drag")||r.closest("[data-vaul-no-drag]"))return!1;if("right"===w||"left"===w)return!0;if(B.current&&o.getTime()-B.current.getTime()<500)return!1;if(null!==i&&("bottom"===w?i>0:i<0))return!0;if(a&&a.length>0)return!1;if(W.current&&o.getTime()-W.current.getTime()<u&&0===i||t)return W.current=o,!1;for(;r;){if(r.scrollHeight>r.clientHeight){if(0!==r.scrollTop)return W.current=new Date,!1;if("dialog"===r.getAttribute("role"))break}r=r.parentNode}return!0}function eh(e){R&&Z.current&&(Z.current.classList.remove(etN),U.current=!1,T(!1),H.current=new Date),null==x||x(),e||z(!1),setTimeout(()=>{i&&ea(i[0])},500)}function ep(){if(!Z.current)return;let e=document.querySelector("[data-vaul-drawer-wrapper]"),t=etk(Z.current,w);etw(Z.current,{transform:"translate3d(0, 0, 0)",transition:`transform 0.5s cubic-bezier(${etC.join(",")})`}),etw(F.current,{transition:`opacity 0.5s cubic-bezier(${etC.join(",")})`,opacity:"1"}),l&&t&&t>0&&I&&etw(e,{borderRadius:"8px",overflow:"hidden",...etj(w)?{transform:`scale(${ed()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${ed()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:"0.5s",transitionTimingFunction:`cubic-bezier(${etC.join(",")})`},!0)}return ew.default.useEffect(()=>{window.requestAnimationFrame(()=>{X.current=!0})},[]),ew.default.useEffect(()=>{var e;function t(){if(Z.current&&N&&(etx(document.activeElement)||G.current)){var e;let t=(null==(e=window.visualViewport)?void 0:e.height)||0,n=window.innerHeight,r=n-t,a=Z.current.getBoundingClientRect().height||0;ee.current||(ee.current=a);let o=Z.current.getBoundingClientRect().top;if(Math.abs(Y.current-r)>60&&(G.current=!G.current),i&&i.length>0&&eo&&er&&(r+=eo[er]||0),Y.current=r,a>t||G.current){let e=Z.current.getBoundingClientRect().height,i=e;e>t&&(i=t-(a>.8*n?o:26)),g?Z.current.style.height=`${e-Math.max(r,0)}px`:Z.current.style.height=`${Math.max(i,t-o)}px`}else{let e;e=navigator.userAgent,"u">typeof window&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))||(Z.current.style.height=`${ee.current}px`)}i&&i.length>0&&!G.current?Z.current.style.bottom="0px":Z.current.style.bottom=`${Math.max(r,0)}px`}}return null==(e=window.visualViewport)||e.addEventListener("resize",t),()=>{var e;return null==(e=window.visualViewport)?void 0:e.removeEventListener("resize",t)}},[er,i,eo]),ew.default.useEffect(()=>(I&&(etw(document.documentElement,{scrollBehavior:"auto"}),B.current=new Date),()=>{!function(e,t){if(!e||!(e instanceof HTMLElement))return;let n=etb.get(e);n&&(e.style[t]=n[t])}(document.documentElement,"scrollBehavior")}),[I]),ew.default.useEffect(()=>{v||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[v]),ew.default.createElement(uo,{defaultOpen:j,onOpenChange:e=>{(d||e)&&(e?D(!0):eh(!0),z(e))},open:I},ew.default.createElement(eta.Provider,{value:{activeSnapPoint:en,snapPoints:i,setActiveSnapPoint:ea,drawerRef:Z,overlayRef:F,onOpenChange:t,onPress:function(e){var t,n;!d&&!i||(!Z.current||Z.current.contains(e.target))&&(J.current=(null==(t=Z.current)?void 0:t.getBoundingClientRect().height)||0,Q.current=(null==(n=Z.current)?void 0:n.getBoundingClientRect().width)||0,T(!0),V.current=new Date,etl()&&window.addEventListener("touchend",()=>U.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),K.current=etj(w)?e.pageY:e.pageX)},onRelease:function(e){var t,n;if(!R||!Z.current)return;Z.current.classList.remove(etN),U.current=!1,T(!1),H.current=new Date;let r=etk(Z.current,w);if(!e||!ef(e.target,!1)||!r||Number.isNaN(r)||null===V.current)return;let o=H.current.getTime()-V.current.getTime(),l=K.current-(etj(w)?e.pageY:e.pageX),s=Math.abs(l)/o;if(s>.05&&($(!0),setTimeout(()=>{$(!1)},200)),i){ei({draggedDistance:l*("bottom"===w||"right"===w?1:-1),closeDrawer:eh,velocity:s,dismissible:d}),null==a||a(e,!0);return}if("bottom"===w||"right"===w?l>0:l<0){ep(),null==a||a(e,!0);return}if(s>.4){eh(),null==a||a(e,!1);return}let u=Math.min(null!=(t=Z.current.getBoundingClientRect().height)?t:0,window.innerHeight),f=Math.min(null!=(n=Z.current.getBoundingClientRect().width)?n:0,window.innerWidth);if(Math.abs(r)>=("left"===w||"right"===w?f:u)*c){eh(),null==a||a(e,!1);return}null==a||a(e,!0),ep()},onDrag:function(e){if(Z.current&&R){let t="bottom"===w||"right"===w?1:-1,n=(K.current-(etj(w)?e.pageY:e.pageX))*t,a=n>0,o=i&&!d&&!a;if(o&&0===er)return;let s=Math.abs(n),c=document.querySelector("[data-vaul-drawer-wrapper]"),u=s/("bottom"===w||"top"===w?J.current:Q.current),f=ec(s,a);if(null!==f&&(u=f),o&&u>=1||!U.current&&!ef(e.target,a))return;if(Z.current.classList.add(etN),U.current=!0,etw(Z.current,{transition:"none"}),etw(F.current,{transition:"none"}),i&&el({draggedDistance:n}),a&&!i){let e=Math.min(-(8*(Math.log(n+1)-2)*1),0)*t;etw(Z.current,{transform:etj(w)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`});return}let p=1-u;if((es||h&&er===h-1)&&(null==r||r(e,u),etw(F.current,{opacity:`${p}`,transition:"none"},!0)),c&&F.current&&l){let e=Math.min(ed()+u*(1-ed()),1),t=8-8*u,n=Math.max(0,14-14*u);etw(c,{borderRadius:`${t}px`,transform:etj(w)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:"none"},!0)}if(!i){let e=s*t;etw(Z.current,{transform:etj(w)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}},dismissible:d,shouldAnimate:X,handleOnly:f,isOpen:I,isDragging:R,shouldFade:es,closeDrawer:eh,onNestedDrag:function(e,t){if(t<0)return;let n=(window.innerWidth-16)/window.innerWidth,r=n+t*(1-n),a=-16+16*t;etw(Z.current,{transform:etj(w)?`scale(${r}) translate3d(0, ${a}px, 0)`:`scale(${r}) translate3d(${a}px, 0, 0)`,transition:"none"})},onNestedOpenChange:function(e){let t=e?(window.innerWidth-16)/window.innerWidth:1,n=e?-16:0;q.current&&window.clearTimeout(q.current),etw(Z.current,{transition:`transform 0.5s cubic-bezier(${etC.join(",")})`,transform:etj(w)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&Z.current&&(q.current=setTimeout(()=>{let e=etk(Z.current,w);etw(Z.current,{transition:"none",transform:etj(w)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))},onNestedRelease:function(e,t){let n=etj(w)?window.innerHeight:window.innerWidth,r=t?(n-16)/n:1,a=t?-16:0;t&&etw(Z.current,{transition:`transform 0.5s cubic-bezier(${etC.join(",")})`,transform:etj(w)?`scale(${r}) translate3d(0, ${a}px, 0)`:`scale(${r}) translate3d(${a}px, 0, 0)`})},keyboardIsOpen:G,modal:v,snapPointsOffset:eo,activeSnapPointIndex:er,direction:w,shouldScaleBackground:l,setBackgroundColorOnScale:s,noBodyStyles:b,container:E,autoFocus:O}},n))},et_=function(e){let t=eti(),{container:n=t.container,...r}=e;return ew.default.createElement(uf,{container:n,...r})};function etD({className:e,...t}){return(0,ey.jsx)(etA,{"data-slot":"drawer-overlay",className:(0,eI.cn)("vtl-overlay fixed inset-0 z-50 animate-in fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",e),...t})}function etR({className:e,children:t,...n}){return(0,ey.jsxs)(et_,{"data-slot":"drawer-portal",children:[(0,ey.jsx)(etD,{}),(0,ey.jsxs)(etI,{"data-slot":"drawer-content",className:(0,eI.cn)("vtl-surface-modal group/drawer-content fixed z-50 flex h-auto flex-col border outline-none","data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-xl data-[vaul-drawer-direction=top]:border-t-0","data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-xl data-[vaul-drawer-direction=bottom]:border-b-0","data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-r-0 data-[vaul-drawer-direction=right]:sm:max-w-sm","data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-l-0 data-[vaul-drawer-direction=left]:sm:max-w-sm",e),...n,children:[(0,ey.jsx)("div",{className:"mx-auto mt-3 hidden h-1.5 w-16 shrink-0 rounded-full bg-muted group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),t]})]})}function etT({className:e,...t}){return(0,ey.jsx)(uk,{"data-slot":"drawer-title",className:(0,eI.cn)("text-base leading-none font-semibold text-foreground",e),...t})}function etL({navItems:e,contents:t,activeWorkspace:n,activeConversationId:r,onItemSelect:a,onOpenConversation:i,onOpenConversationSettings:o,onConversationDeleted:l,onAccountSettings:s,subagentTree:c,activeSubagentPath:u,onOpenSubagent:d,title:f,trailing:h}){let[p,m]=ew.useState(!1),g=ew.useCallback(()=>m(!1),[]),v=ew.useCallback(e=>{g(),a(e)},[g,a]),x=ew.useCallback((e,t)=>{g(),i(e,t)},[g,i]),y=ew.useCallback(e=>{g(),d?.(e)},[g,d]);return(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(et$,{onMenuClick:()=>m(!0),title:f,trailing:h}),(0,ey.jsx)(etz,{open:p,onOpenChange:m,direction:"left",children:(0,ey.jsxs)(etR,{className:"w-[85vw] max-w-xs",children:[(0,ey.jsx)(etT,{className:"sr-only",children:"导航"}),(0,ey.jsx)(eeU,{hideCanvas:!0,navItems:e,contents:t,activeWorkspace:n,activeConversationId:r,onItemSelect:v,onOpenConversation:x,onOpenCanvas:()=>{},onOpenConversationSettings:(e,t)=>{g(),o?.(e,t)},onConversationDeleted:l,onAccountSettings:()=>{g(),s?.()},subagentTree:c,activeSubagentPath:u,onOpenSubagent:y,className:"h-full w-full rounded-none border-0 p-3 pt-[max(0.75rem,env(safe-area-inset-top))] shadow-none"})]})})]})}function et$({onMenuClick:e,title:t,trailing:n,className:r}){return(0,ey.jsxs)("header",{className:(0,eI.cn)("fixed inset-x-0 top-0 z-40 flex h-12 items-center gap-1 border-b border-border bg-sidebar/95 px-1.5 pt-[env(safe-area-inset-top)] backdrop-blur",r),style:{height:"calc(3rem + env(safe-area-inset-top))"},children:[(0,ey.jsx)("button",{type:"button","aria-label":"展开导航",onClick:e,className:"flex size-9 shrink-0 items-center justify-center rounded-lg text-foreground/80 transition-colors hover:bg-muted hover:text-foreground [&_svg]:size-5",children:(0,ey.jsx)(sW,{})}),t?(0,ey.jsx)("div",{className:"min-w-0 flex-1 truncate text-center text-sm font-medium text-foreground",children:t}):(0,ey.jsx)("div",{className:"min-w-0 flex-1"}),(0,ey.jsx)("div",{className:"flex shrink-0 items-center",children:n})]})}let etF=(0,ek.default)("message-square-text",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]),etB=[{id:"canvas",label:Z6.canvas,icon:(0,ey.jsx)(dt,{})},{id:"agent",label:"智能体",icon:(0,ey.jsx)(de,{})},{id:"settings",label:Z6.settings,icon:(0,ey.jsx)(Jl,{})}],etV=[{id:"canvas",title:Z6.canvas,description:"节点画布工作区。",sections:[{id:"canvases",title:Z6.canvas,items:[{id:"open-recent-canvas",label:Z6.canvasRecent,icon:(0,ey.jsx)(dt,{})},{id:"new-canvas",label:Z6.canvasNew,icon:(0,ey.jsx)(lV,{})},{id:"all-canvases",label:Z6.canvasAll,icon:(0,ey.jsx)(da,{})}]}]},{id:"agent",title:"智能体",description:"Agent 对话工作区。",sections:[{id:"conversations",title:"Agent 对话",items:[{id:"open-recent-conversation",label:Z6.conversationRecent,icon:(0,ey.jsx)(etF,{})},{id:"new-agent-conversation",label:Z6.conversationNew,icon:(0,ey.jsx)(de,{})}]}]},{id:"settings",title:Z6.settings,description:"系统、工作组和用量配置。",sections:[{id:"settings",items:[{id:"preferences",label:"偏好设置",icon:(0,ey.jsx)(Jl,{})},{id:"check-update",label:"检查更新",icon:(0,ey.jsx)(xS,{})}]},{id:"hub",title:"Hub",items:[{id:"account",label:"Hub 账户",icon:(0,ey.jsx)(eN,{})}]}]}],etH=(0,ek.default)("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]),etW=(0,ek.default)("unplug",[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]]),etU=(0,ek.default)("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]),etq=(0,ek.default)("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);function etK(){let{user:e,machine:t,logout:n,unbind:r,refreshUser:a}=e8(),[i,o]=ew.useState(!1),[l,s]=ew.useState(!1),[c,u]=ew.useState(t),[d,f]=ew.useState(!1),[h,p]=ew.useState(""),[m,g]=ew.useState(!1),[v,x]=ew.useState(null);async function y(){o(!0);try{await eJ("online");let e=eU();u(e),await a()}catch{}finally{o(!1)}}async function b(){let e=h.trim();if(!e)return void x("名称不能为空");g(!0),x(null);try{let t=await e0(e);u(e=>e?{...e,name:t}:e),f(!1)}catch(e){x(e instanceof Error?e.message:"重命名失败")}finally{g(!1)}}async function w(){s(!0);try{await r()}catch{s(!1)}}async function j(){await n()}return ew.useEffect(()=>{u(t)},[t]),e?(0,ey.jsx)("div",{className:"vtl-app-background h-full min-h-0 overflow-auto p-6 pb-14 text-foreground md:pb-6",children:(0,ey.jsx)("div",{className:"mx-auto w-full max-w-3xl",children:(0,ey.jsxs)("div",{className:"grid gap-6",children:[(0,ey.jsx)("div",{className:"flex items-center justify-between gap-3","data-tour":"hub-account",children:(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:"Vantaloom Hub 账户"}),(0,ey.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"管理你的 Hub 连接和设备绑定"})]})}),(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4",children:[(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"账户信息"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"你的 Vantaloom Hub 账户详情。"}),(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,ey.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,ey.jsx)("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-full bg-primary/10",children:(0,ey.jsx)("span",{className:"text-base font-semibold text-primary",children:e.name.charAt(0).toUpperCase()})}),(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("p",{className:"truncate text-sm font-medium",children:e.name}),(0,ey.jsx)("p",{className:"truncate text-xs text-muted-foreground",children:e.email})]})]}),(0,ey.jsxs)(FC,{variant:"outline",className:"shrink-0",children:[(0,ey.jsx)(wY,{className:"mr-1 size-3"}),"已验证"]})]}),(0,ey.jsx)(Qy,{}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)("span",{className:"text-sm text-muted-foreground",children:"用户 ID"}),(0,ey.jsxs)("code",{className:"rounded bg-muted px-2 py-0.5 font-mono text-xs",children:[e.id.slice(0,8),"..."]})]}),(0,ey.jsx)(Qy,{}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)("span",{className:"text-sm text-muted-foreground",children:"注册时间"}),(0,ey.jsx)("span",{className:"text-sm",children:new Date(e.createdAt).toLocaleDateString("zh-CN")})]})]}),(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4",children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"设备绑定"}),(0,ey.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"此设备已自动注册到你的 Hub 账户。"})]}),c?(0,ey.jsxs)(eA.Button,{variant:"outline",size:"sm",className:"shrink-0",onClick:y,disabled:i,children:[i?(0,ey.jsx)(eM,{className:"animate-spin"}):(0,ey.jsx)(xS,{}),i?"刷新中...":"刷新状态"]}):null]}),c?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ey.jsxs)("div",{className:"min-w-0 flex-1",children:[d?(0,ey.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ey.jsx)(ez,{value:h,onChange:e=>p(e.target.value),maxLength:64,autoFocus:!0,placeholder:"机器名称",className:"h-8 text-sm",onKeyDown:e=>{"Enter"===e.key&&b(),"Escape"===e.key&&f(!1)}}),(0,ey.jsx)(eA.Button,{size:"icon-sm",variant:"ghost",className:"size-8 shrink-0",onClick:()=>void b(),disabled:m,"aria-label":"保存名称",children:m?(0,ey.jsx)(eM,{className:"animate-spin"}):(0,ey.jsx)(pk,{})}),(0,ey.jsx)(eA.Button,{size:"icon-sm",variant:"ghost",className:"size-8 shrink-0",onClick:()=>f(!1),disabled:m,"aria-label":"取消",children:(0,ey.jsx)(d3.XIcon,{})})]}):(0,ey.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ey.jsx)("p",{className:"truncate text-sm font-medium",children:c.name}),(0,ey.jsx)("button",{type:"button",onClick:function(){p(c?.name??""),x(null),f(!0)},title:"重命名",className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:(0,ey.jsx)(Vj,{className:"size-3.5"})})]}),(0,ey.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[c.platform," / ",c.arch]})]}),(0,ey.jsxs)(FC,{variant:"online"===c.status?"default":"secondary",className:"shrink-0 gap-1",children:["online"===c.status?(0,ey.jsx)(etU,{className:"size-3"}):(0,ey.jsx)(etq,{className:"size-3"}),"online"===c.status?"在线":"离线"]})]}),v?(0,ey.jsx)("p",{className:"text-xs text-destructive",children:v}):null,(0,ey.jsx)(Qy,{}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)("span",{className:"text-sm text-muted-foreground",children:"设备 ID"}),(0,ey.jsxs)("code",{className:"rounded bg-muted px-2 py-0.5 font-mono text-xs",children:[c.id.slice(0,8),"..."]})]}),(0,ey.jsx)(Qy,{}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)("span",{className:"text-sm text-muted-foreground",children:"连接方式"}),(0,ey.jsx)("span",{className:"text-sm",children:c.connectivity||"直连"})]}),(0,ey.jsx)(Qy,{}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)("span",{className:"text-sm text-muted-foreground",children:"本机 IP"}),(0,ey.jsx)("code",{className:"rounded bg-muted px-2 py-0.5 font-mono text-xs",children:c.localIp})]}),(0,ey.jsx)(Qy,{}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)("span",{className:"text-sm text-muted-foreground",children:"最后心跳"}),(0,ey.jsx)("span",{className:"text-sm",children:new Date(c.lastHeartbeat).toLocaleString("zh-CN")})]}),(0,ey.jsx)(Qy,{}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)("span",{className:"text-sm text-muted-foreground",children:"注册时间"}),(0,ey.jsx)("span",{className:"text-sm",children:new Date(c.createdAt).toLocaleString("zh-CN")})]})]}):(0,ey.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6 text-center",children:[(0,ey.jsx)(etq,{className:"size-8 text-muted-foreground/40"}),(0,ey.jsxs)("div",{children:[(0,ey.jsx)("p",{className:"text-sm font-medium",children:"设备未绑定"}),(0,ey.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"设备注册异常,请尝试重新登录"})]})]})]}),(0,ey.jsx)(etG,{}),(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4","data-tour":"hub-account-danger",children:[(0,ey.jsx)("h4",{className:"text-sm font-semibold text-destructive",children:"危险操作"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"以下操作不可逆,请谨慎执行。"}),(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("p",{className:"text-sm font-medium",children:"解除设备绑定"}),(0,ey.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"将此设备从你的 Hub 账户中移除,并退出登录。设备数据不会受到影响。"})]}),(0,ey.jsxs)(uL,{children:[(0,ey.jsx)(u$,{asChild:!0,children:(0,ey.jsxs)(eA.Button,{variant:"destructive",size:"sm",className:"shrink-0",children:[(0,ey.jsx)(etW,{}),"解除绑定"]})}),(0,ey.jsxs)(u2,{children:[(0,ey.jsxs)(u5,{children:[(0,ey.jsx)(u3,{children:"确认解除设备绑定?"}),(0,ey.jsx)(u6,{children:"此操作将从你的 Hub 账户中移除当前设备,并退出登录。你可以随时重新登录并绑定设备。"})]}),(0,ey.jsxs)(u4,{children:[(0,ey.jsx)(u7,{children:"取消"}),(0,ey.jsx)(u8,{onClick:w,disabled:l,className:"bg-destructive text-white hover:bg-destructive/90",children:l?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(eM,{className:"animate-spin"}),"处理中..."]}):"确认解除"})]})]})]})]}),(0,ey.jsx)(Qy,{}),(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("p",{className:"text-sm font-medium",children:"退出登录"}),(0,ey.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"退出当前 Hub 账户但保留设备在云端的注册。下次登录时无需重新绑定。"})]}),(0,ey.jsxs)(eA.Button,{variant:"outline",size:"sm",className:"shrink-0",onClick:j,children:[(0,ey.jsx)(eeN,{}),"退出登录"]})]})]})]})})}):null}function etG(){let[e,t]=ew.useState(""),[n,r]=ew.useState(""),[a,i]=ew.useState(""),[o,l]=ew.useState(!1),[s,c]=ew.useState(null);async function u(){if(c(null),n.length<8)return void c({kind:"err",text:"新密码至少 8 位"});if(n!==a)return void c({kind:"err",text:"两次输入的新密码不一致"});l(!0);try{await e1(e,n),c({kind:"ok",text:"密码已更新"}),t(""),r(""),i("")}catch(e){c({kind:"err",text:e instanceof Error?e.message:"修改失败,请重试"})}finally{l(!1)}}return(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4",children:[(0,ey.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ey.jsx)(etH,{className:"size-4 text-muted-foreground"}),(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"修改密码"})]}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"更改你的 Vantaloom Hub 登录密码。"}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(ez,{type:"password",placeholder:"当前密码",autoComplete:"current-password",value:e,onChange:e=>t(e.target.value)}),(0,ey.jsx)(ez,{type:"password",placeholder:"新密码(至少 8 位)",autoComplete:"new-password",value:n,onChange:e=>r(e.target.value)}),(0,ey.jsx)(ez,{type:"password",placeholder:"确认新密码",autoComplete:"new-password",value:a,onChange:e=>i(e.target.value)})]}),s?(0,ey.jsx)("p",{className:"ok"===s.kind?"text-xs text-primary":"text-xs text-destructive",children:s.text}):null,(0,ey.jsx)("div",{className:"flex justify-end",children:(0,ey.jsx)(eA.Button,{size:"sm",onClick:u,disabled:o||!e||!n,children:o?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(eM,{className:"animate-spin"}),"保存中..."]}):"更新密码"})})]})}let etX=(0,lq.cva)("vtl-surface-card relative w-full rounded-[var(--surface-card-radius)] border px-4 py-3 text-sm [&>svg]:absolute [&>svg]:top-3.5 [&>svg]:left-4 [&>svg~*]:pl-7",{variants:{variant:{default:"border-border",muted:"border-border bg-muted/40",destructive:"border-destructive/35 bg-destructive/10 text-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}});function etY({className:e,variant:t,...n}){return(0,ey.jsx)("div",{role:"alert","data-slot":"alert",className:(0,eI.cn)(etX({variant:t}),e),...n})}function etZ({className:e,...t}){return(0,ey.jsx)("div",{"data-slot":"alert-title",className:(0,eI.cn)("mb-1 leading-none font-medium",e),...t})}function etJ({className:e,...t}){return(0,ey.jsx)("div",{"data-slot":"alert-description",className:(0,eI.cn)("text-muted-foreground [&_p]:leading-relaxed",e),...t})}var etQ=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=(0,lU.createSlot)(`Primitive.${t}`),r=ew.forwardRef((e,r)=>{let{asChild:a,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ey.jsx)(a?n:t,{...i,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),et0=ew.forwardRef((e,t)=>(0,ey.jsx)(etQ.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));function et1({className:e,...t}){return(0,ey.jsx)(et0,{"data-slot":"label",className:(0,eI.cn)("flex w-fit items-center gap-2 text-sm font-medium leading-snug peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]/field:opacity-50",e),...t})}et0.displayName="Label";var et2=["PageUp","PageDown"],et5=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],et4={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},et3="Slider",[et6,et8,et7]=hC(et3),[et9,ene]=sG(et3,[et7]),[ent,enn]=et9(et3),enr=ew.forwardRef((e,t)=>{let{name:n,min:r=0,max:a=100,step:i=1,orientation:o="horizontal",disabled:l=!1,minStepsBetweenThumbs:s=0,defaultValue:c=[r],value:u,onValueChange:d=()=>{},onValueCommit:f=()=>{},inverted:h=!1,form:p,...m}=e,g=ew.useRef(new Set),v=ew.useRef(0),x="horizontal"===o,[y=[],b]=s2({prop:u,defaultProp:c,onChange:e=>{let t=[...g.current];t[v.current]?.focus(),d(e)}}),w=ew.useRef(y);function j(e,t,{commit:n}={commit:!1}){let o,l=(String(i).split(".")[1]||"").length,c=pE(Math.round((Math.round((e-r)/i)*i+r)*(o=Math.pow(10,l)))/o,[r,a]);b((e=[])=>{let r=function(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}(e,c,t);if(!function(e,t){if(t>0)return Math.min(...e.slice(0,-1).map((t,n)=>e[n+1]-t))>=t;return!0}(r,s*i))return e;{v.current=r.indexOf(c);let t=String(r)!==String(e);return t&&n&&f(r),t?r:e}})}return(0,ey.jsx)(ent,{scope:e.__scopeSlider,name:n,disabled:l,min:r,max:a,valueIndexToChangeRef:v,thumbs:g.current,values:y,orientation:o,form:p,children:(0,ey.jsx)(et6.Provider,{scope:e.__scopeSlider,children:(0,ey.jsx)(et6.Slot,{scope:e.__scopeSlider,children:(0,ey.jsx)(x?eno:enl,{"aria-disabled":l,"data-disabled":l?"":void 0,...m,ref:t,onPointerDown:sY(m.onPointerDown,()=>{l||(w.current=y)}),min:r,max:a,inverted:h,onSlideStart:l?void 0:function(e){let t=function(e,t){if(1===e.length)return 0;let n=e.map(e=>Math.abs(e-t)),r=Math.min(...n);return n.indexOf(r)}(y,e);j(e,t)},onSlideMove:l?void 0:function(e){j(e,v.current)},onSlideEnd:l?void 0:function(){let e=w.current[v.current];y[v.current]!==e&&f(y)},onHomeKeyDown:()=>!l&&j(r,0,{commit:!0}),onEndKeyDown:()=>!l&&j(a,y.length-1,{commit:!0}),onStepKeyDown:({event:e,direction:t})=>{if(!l){let n=et2.includes(e.key)||e.shiftKey&&et5.includes(e.key),r=v.current;j(y[r]+i*(n?10:1)*t,r,{commit:!0})}}})})})})});enr.displayName=et3;var[ena,eni]=et9(et3,{startEdge:"left",endEdge:"right",size:"width",direction:1}),eno=ew.forwardRef((e,t)=>{let{min:n,max:r,dir:a,inverted:i,onSlideStart:o,onSlideMove:l,onSlideEnd:s,onStepKeyDown:c,...u}=e,[d,f]=ew.useState(null),h=(0,sX.useComposedRefs)(t,e=>f(e)),p=ew.useRef(void 0),m=hP(a),g="ltr"===m,v=g&&!i||!g&&i;function x(e){let t=p.current||d.getBoundingClientRect(),a=enx([0,t.width],v?[n,r]:[r,n]);return p.current=t,a(e-t.left)}return(0,ey.jsx)(ena,{scope:e.__scopeSlider,startEdge:v?"left":"right",endEdge:v?"right":"left",direction:v?1:-1,size:"width",children:(0,ey.jsx)(ens,{dir:m,"data-orientation":"horizontal",...u,ref:h,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:e=>{let t=x(e.clientX);o?.(t)},onSlideMove:e=>{let t=x(e.clientX);l?.(t)},onSlideEnd:()=>{p.current=void 0,s?.()},onStepKeyDown:e=>{let t=et4[v?"from-left":"from-right"].includes(e.key);c?.({event:e,direction:t?-1:1})}})})}),enl=ew.forwardRef((e,t)=>{let{min:n,max:r,inverted:a,onSlideStart:i,onSlideMove:o,onSlideEnd:l,onStepKeyDown:s,...c}=e,u=ew.useRef(null),d=(0,sX.useComposedRefs)(t,u),f=ew.useRef(void 0),h=!a;function p(e){let t=f.current||u.current.getBoundingClientRect(),a=enx([0,t.height],h?[r,n]:[n,r]);return f.current=t,a(e-t.top)}return(0,ey.jsx)(ena,{scope:e.__scopeSlider,startEdge:h?"bottom":"top",endEdge:h?"top":"bottom",size:"height",direction:h?1:-1,children:(0,ey.jsx)(ens,{"data-orientation":"vertical",...c,ref:d,style:{...c.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:e=>{let t=p(e.clientY);i?.(t)},onSlideMove:e=>{let t=p(e.clientY);o?.(t)},onSlideEnd:()=>{f.current=void 0,l?.()},onStepKeyDown:e=>{let t=et4[h?"from-bottom":"from-top"].includes(e.key);s?.({event:e,direction:t?-1:1})}})})}),ens=ew.forwardRef((e,t)=>{let{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:l,onStepKeyDown:s,...c}=e,u=enn(et3,n);return(0,ey.jsx)(s6.span,{...c,ref:t,onKeyDown:sY(e.onKeyDown,e=>{"Home"===e.key?(o(e),e.preventDefault()):"End"===e.key?(l(e),e.preventDefault()):et2.concat(et5).includes(e.key)&&(s(e),e.preventDefault())}),onPointerDown:sY(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),u.thumbs.has(t)?t.focus():r(e)}),onPointerMove:sY(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&a(e)}),onPointerUp:sY(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),i(e))})})}),enc="SliderTrack",enu=ew.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,a=enn(enc,n);return(0,ey.jsx)(s6.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:t})});enu.displayName=enc;var end="SliderRange",enf=ew.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,a=enn(end,n),i=eni(end,n),o=ew.useRef(null),l=(0,sX.useComposedRefs)(t,o),s=a.values.length,c=a.values.map(e=>env(e,a.min,a.max)),u=s>1?Math.min(...c):0,d=100-Math.max(...c);return(0,ey.jsx)(s6.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:l,style:{...e.style,[i.startEdge]:u+"%",[i.endEdge]:d+"%"}})});enf.displayName=end;var enh="SliderThumb",enp=ew.forwardRef((e,t)=>{let n=et8(e.__scopeSlider),[r,a]=ew.useState(null),i=(0,sX.useComposedRefs)(t,e=>a(e)),o=ew.useMemo(()=>r?n().findIndex(e=>e.ref.current===r):-1,[n,r]);return(0,ey.jsx)(enm,{...e,ref:i,index:o})}),enm=ew.forwardRef((e,t)=>{var n,r,a,i,o;let l,s,{__scopeSlider:c,index:u,name:d,...f}=e,h=enn(enh,c),p=eni(enh,c),[m,g]=ew.useState(null),v=(0,sX.useComposedRefs)(t,e=>g(e)),x=!m||h.form||!!m.closest("form"),y=mR(m),b=h.values[u],w=void 0===b?0:env(b,h.min,h.max),j=(n=u,(r=h.values.length)>2?`Value ${n+1} of ${r}`:2===r?["Minimum","Maximum"][n]:void 0),k=y?.[p.size],S=k?(a=k,i=w,o=p.direction,s=enx([0,50],[0,l=a/2]),(l-s(i)*o)*o):0;return ew.useEffect(()=>{if(m)return h.thumbs.add(m),()=>{h.thumbs.delete(m)}},[m,h.thumbs]),(0,ey.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[p.startEdge]:`calc(${w}% + ${S}px)`},children:[(0,ey.jsx)(et6.ItemSlot,{scope:e.__scopeSlider,children:(0,ey.jsx)(s6.span,{role:"slider","aria-label":e["aria-label"]||j,"aria-valuemin":h.min,"aria-valuenow":b,"aria-valuemax":h.max,"aria-orientation":h.orientation,"data-orientation":h.orientation,"data-disabled":h.disabled?"":void 0,tabIndex:h.disabled?void 0:0,...f,ref:v,style:void 0===b?{display:"none"}:e.style,onFocus:sY(e.onFocus,()=>{h.valueIndexToChangeRef.current=u})})}),x&&(0,ey.jsx)(eng,{name:d??(h.name?h.name+(h.values.length>1?"[]":""):void 0),form:h.form,value:b},u)]})});enp.displayName=enh;var eng=ew.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{let a=ew.useRef(null),i=(0,sX.useComposedRefs)(a,r),o=m1(t);return ew.useEffect(()=>{let e=a.current;if(!e)return;let n=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set;if(o!==t&&n){let r=new Event("input",{bubbles:!0});n.call(e,t),e.dispatchEvent(r)}},[o,t]),(0,ey.jsx)(s6.input,{style:{display:"none"},...n,ref:i,defaultValue:t})});function env(e,t,n){return pE(100/(n-t)*(e-t),[0,100])}function enx(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function eny(e){return Array.isArray(e)?e:"number"==typeof e?[e]:void 0}function enb({className:e,defaultValue:t,value:n,min:r=0,max:a=100,...i}){let o=ew.useMemo(()=>eny(n)??eny(t)??[r,a],[t,a,r,n]);return(0,ey.jsxs)(enr,{"data-slot":"slider",defaultValue:eny(t),value:eny(n),min:r,max:a,className:(0,eI.cn)("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-40 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",e),...i,children:[(0,ey.jsx)(enu,{"data-slot":"slider-track",className:"relative grow overflow-hidden rounded-full bg-muted data-[orientation=horizontal]:h-1 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1",children:(0,ey.jsx)(enf,{"data-slot":"slider-range",className:"absolute bg-primary data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"})}),o.map((e,t)=>(0,ey.jsx)(enp,{"data-slot":"slider-thumb",className:"relative block size-3 shrink-0 rounded-full border border-ring bg-white shadow-sm transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 hover:ring-ring/50 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-hidden active:ring-3 active:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 dark:bg-primary-foreground"},t))]})}function enw(e){return{compression:{...e.compression},summary:{...e.summary},approval:{...e.approval}}}function enj(){let[e,t]=ew.useState(null),[n,r]=ew.useState([]),[a,i]=ew.useState(!0),[o,l]=ew.useState(!1),[s,c]=ew.useState(""),[u,d]=ew.useState(!1);function f(e,n){t(t=>t?{...t,[e]:{...t[e],...n}}:t),d(!0)}async function h(){if(e&&!o){l(!0),c("");try{let n=await wN({compression:e.compression,summary:e.summary,approval:e.approval});t(enw(n)),d(!1)}catch(e){c(e instanceof Error?e.message:"Save failed")}finally{l(!1)}}}return(ew.useEffect(()=>{!async function(){try{let[e,n]=await Promise.all([wC(),v9()]);t(enw(e)),r(n.models)}catch(e){c(e instanceof Error?e.message:"Failed to load config")}finally{i(!1)}}()},[]),a)?(0,ey.jsx)("div",{className:"rounded-lg border border-dashed px-3 py-6 text-sm text-muted-foreground",children:"正在读取代理配置"}):e?(0,ey.jsxs)("div",{className:"grid gap-6",children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,ey.jsx)("div",{className:"min-w-0",children:(0,ey.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:"代理配置"})}),u&&(0,ey.jsxs)(eA.Button,{type:"button",size:"sm",onClick:()=>void h(),disabled:o,children:[(0,ey.jsx)(Kh,{className:"size-4"}),o?"保存中":"保存"]})]}),s?(0,ey.jsxs)(etY,{variant:"destructive",children:[(0,ey.jsx)(eE,{}),(0,ey.jsx)(etZ,{children:"错误"}),(0,ey.jsx)(etJ,{children:s})]}):null,(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4","data-tour":"agent-config-compression",children:[(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"压缩上下文"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"当对话 token 达到模型上下文窗口的指定百分比时自动压缩。"}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)(et1,{className:"text-sm",children:"自动压缩阈值"}),(0,ey.jsxs)("span",{className:"text-sm tabular-nums text-muted-foreground",children:[e.compression.autoThresholdPercent,"%"]})]}),(0,ey.jsx)(enb,{value:[e.compression.autoThresholdPercent],onValueChange:([e])=>f("compression",{autoThresholdPercent:e}),min:0,max:100,step:5}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"0% 表示禁用自动压缩。建议设为 70%-85%。"})]}),(0,ey.jsx)(Qy,{}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et1,{className:"text-sm",children:"压缩模型"}),(0,ey.jsx)(enk,{models:n,value:e.compression.modelRef,onValueChange:e=>f("compression",{modelRef:e}),placeholder:"使用主模型"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"用于执行上下文压缩的模型。留空则使用当前对话主模型。"})]})]}),(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4","data-tour":"agent-config-summary",children:[(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"对话摘要"}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsxs)("div",{className:"min-w-0 space-y-0.5",children:[(0,ey.jsx)(et1,{className:"text-sm",children:"对话标题摘要"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"每轮对话结束后自动更新对话标题。"})]}),(0,ey.jsx)(xo,{checked:e.summary.enableTitleSummary,onCheckedChange:e=>f("summary",{enableTitleSummary:e})})]}),(0,ey.jsx)(Qy,{}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsxs)("div",{className:"min-w-0 space-y-0.5",children:[(0,ey.jsx)(et1,{className:"text-sm",children:"轮次标题摘要"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"为每轮 agent 操作生成摘要标题。"})]}),(0,ey.jsx)(xo,{checked:e.summary.enableRoundSummary,onCheckedChange:e=>f("summary",{enableRoundSummary:e})})]}),(0,ey.jsx)(Qy,{}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et1,{className:"text-sm",children:"摘要模型"}),(0,ey.jsx)(enk,{models:n,value:e.summary.modelRef,onValueChange:e=>f("summary",{modelRef:e}),placeholder:"使用主模型"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"用于生成对话摘要的模型。留空则使用当前对话主模型。"})]})]}),(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4","data-tour":"agent-config-approval",children:[(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"命令审批"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"在 Auto 权限模式下,使用 AI 模型审批 Agent 发起的命令是否可以自动执行。"}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et1,{className:"text-sm",children:"审批模型"}),(0,ey.jsx)(enk,{models:n,value:e.approval.modelRef,onValueChange:e=>f("approval",{modelRef:e}),placeholder:"未配置(全部放行)"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"留空表示 Auto 模式下不进行 AI 审批,所有非危险命令自动放行。"})]}),(0,ey.jsx)(Qy,{}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et1,{className:"text-sm",children:"审批提示词"}),(0,ey.jsx)(bm,{value:e.approval.prompt,onChange:e=>f("approval",{prompt:e.currentTarget.value}),placeholder:"可选:给审批模型的额外指导,例如允许哪些操作、拒绝哪些操作",rows:4,className:"resize-none text-sm"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"与系统提示词一起发送给审批模型,帮助它判断命令是否安全。"})]})]})]}):(0,ey.jsxs)(etY,{variant:"destructive",children:[(0,ey.jsx)(eE,{}),(0,ey.jsx)(etZ,{children:"读取失败"}),(0,ey.jsx)(etJ,{children:s||"无法加载代理配置"})]})}function enk({models:e,value:t,onValueChange:n,placeholder:r}){return(0,ey.jsxs)(go,{value:t||"__none__",onValueChange:e=>n("__none__"===e?"":e),children:[(0,ey.jsx)(gX,{className:"w-full",children:(0,ey.jsx)(gu,{placeholder:r})}),(0,ey.jsxs)(gJ,{children:[(0,ey.jsx)(gQ,{value:"__none__",children:r}),e.map(e=>(0,ey.jsx)(gQ,{value:e.id,children:e.label},e.id))]})]})}eng.displayName="RadioBubbleInput";let enS=(0,ek.default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var enC="Accordion",enN=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[enM,enE,enO]=hC(enC),[enP,enA]=sG(enC,[enO,eez]),enI=eez(),enz=ew.default.forwardRef((e,t)=>{let{type:n,...r}=e;return(0,ey.jsx)(enM.Provider,{scope:e.__scopeAccordion,children:"multiple"===n?(0,ey.jsx)(en$,{...r,ref:t}):(0,ey.jsx)(enL,{...r,ref:t})})});enz.displayName=enC;var[en_,enD]=enP(enC),[enR,enT]=enP(enC,{collapsible:!1}),enL=ew.default.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:a=()=>{},collapsible:i=!1,...o}=e,[l,s]=s2({prop:n,defaultProp:r??"",onChange:a,caller:enC});return(0,ey.jsx)(en_,{scope:e.__scopeAccordion,value:ew.default.useMemo(()=>l?[l]:[],[l]),onItemOpen:s,onItemClose:ew.default.useCallback(()=>i&&s(""),[i,s]),children:(0,ey.jsx)(enR,{scope:e.__scopeAccordion,collapsible:i,children:(0,ey.jsx)(enV,{...o,ref:t})})})}),en$=ew.default.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:a=()=>{},...i}=e,[o,l]=s2({prop:n,defaultProp:r??[],onChange:a,caller:enC}),s=ew.default.useCallback(e=>l((t=[])=>[...t,e]),[l]),c=ew.default.useCallback(e=>l((t=[])=>t.filter(t=>t!==e)),[l]);return(0,ey.jsx)(en_,{scope:e.__scopeAccordion,value:o,onItemOpen:s,onItemClose:c,children:(0,ey.jsx)(enR,{scope:e.__scopeAccordion,collapsible:!0,children:(0,ey.jsx)(enV,{...i,ref:t})})})}),[enF,enB]=enP(enC),enV=ew.default.forwardRef((e,t)=>{let{__scopeAccordion:n,disabled:r,dir:a,orientation:i="vertical",...o}=e,l=ew.default.useRef(null),s=(0,sX.useComposedRefs)(l,t),c=enE(n),u="ltr"===hP(a),d=sY(e.onKeyDown,e=>{if(!enN.includes(e.key))return;let t=e.target,n=c().filter(e=>!e.ref.current?.disabled),r=n.findIndex(e=>e.ref.current===t),a=n.length;if(-1===r)return;e.preventDefault();let o=r,l=a-1,s=()=>{(o=r+1)>l&&(o=0)},d=()=>{(o=r-1)<0&&(o=l)};switch(e.key){case"Home":o=0;break;case"End":o=l;break;case"ArrowRight":"horizontal"===i&&(u?s():d());break;case"ArrowDown":"vertical"===i&&s();break;case"ArrowLeft":"horizontal"===i&&(u?d():s());break;case"ArrowUp":"vertical"===i&&d()}let f=o%a;n[f].ref.current?.focus()});return(0,ey.jsx)(enF,{scope:n,disabled:r,direction:a,orientation:i,children:(0,ey.jsx)(enM.Slot,{scope:n,children:(0,ey.jsx)(s6.div,{...o,"data-orientation":i,ref:s,onKeyDown:r?void 0:d})})})}),enH="AccordionItem",[enW,enU]=enP(enH),enq=ew.default.forwardRef((e,t)=>{let{__scopeAccordion:n,value:r,...a}=e,i=enB(enH,n),o=enD(enH,n),l=enI(n),s=s0(),c=r&&o.value.includes(r)||!1,u=i.disabled||e.disabled;return(0,ey.jsx)(enW,{scope:n,open:c,disabled:u,triggerId:s,children:(0,ey.jsx)(eeR,{"data-orientation":i.orientation,"data-state":enQ(c),...l,...a,ref:t,disabled:u,open:c,onOpenChange:e=>{e?o.onItemOpen(r):o.onItemClose(r)}})})});enq.displayName=enH;var enK="AccordionHeader",enG=ew.default.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,a=enB(enC,n),i=enU(enK,n);return(0,ey.jsx)(s6.h3,{"data-orientation":a.orientation,"data-state":enQ(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});enG.displayName=enK;var enX="AccordionTrigger",enY=ew.default.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,a=enB(enC,n),i=enU(enX,n),o=enT(enX,n),l=enI(n);return(0,ey.jsx)(enM.ItemSlot,{scope:n,children:(0,ey.jsx)(eeL,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":a.orientation,id:i.triggerId,...l,...r,ref:t})})});enY.displayName=enX;var enZ="AccordionContent",enJ=ew.default.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,a=enB(enC,n),i=enU(enZ,n),o=enI(n);return(0,ey.jsx)(eeF,{role:"region","aria-labelledby":i.triggerId,"data-orientation":a.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});function enQ(e){return e?"open":"closed"}function en0({...e}){return(0,ey.jsx)(enz,{"data-slot":"accordion",...e})}function en1({className:e,...t}){return(0,ey.jsx)(enq,{"data-slot":"accordion-item",className:(0,eI.cn)("border-b last:border-b-0",e),...t})}function en2({className:e,children:t,...n}){return(0,ey.jsx)(enG,{className:"flex",children:(0,ey.jsxs)(enY,{"data-slot":"accordion-trigger",className:(0,eI.cn)("flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium outline-none transition-all hover:underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,(0,ey.jsx)(gK,{className:"pointer-events-none size-4 shrink-0 translate-y-0.5 text-muted-foreground transition-transform duration-200"})]})})}function en5({className:e,children:t,...n}){return(0,ey.jsx)(enJ,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-[state=closed]:animate-out data-[state=open]:animate-in",...n,children:(0,ey.jsx)("div",{className:(0,eI.cn)("pb-4 pt-0 text-muted-foreground",e),children:t})})}enJ.displayName=enZ;let en4={vantaloom:"Vantaloom","claude-code":"Claude Code",reclaude:"reclaude"};function en3(e){return{...e.claudeCode??{}}}function en6(e,t){if(e.reclaudeExecutable)return e;let n=t.find(e=>"reclaude"===e.engine);return n?.available&&n.detail?{...e,reclaudeExecutable:n.detail}:e}function en8(){let[e,t]=ew.useState(null),[n,r]=ew.useState([]),[a,i]=ew.useState([]),[o,l]=ew.useState(!0),[s,c]=ew.useState(!1),[u,d]=ew.useState(!1),[f,h]=ew.useState(""),[p,m]=ew.useState(!1);async function g(){if(!u){d(!0),h("");try{let e=(await wE()).engines??[];r(e),t(t=>t?en6(t,e):t)}catch(e){h(e instanceof Error?e.message:"适配器安装失败")}finally{d(!1)}}}function v(e){t(t=>t?{...t,...e}:t),m(!0)}ew.useEffect(()=>{!async function(){try{let[e,n,a]=await Promise.all([wC(),wM(),v9()]),o=n.engines??[];t(en6(en3(e),o)),r(o),i(a.models)}catch(e){h(e instanceof Error?e.message:"Failed to load config")}finally{l(!1)}}()},[]);let x=e?.adapterArgs?.[0]??"";async function y(){if(e&&!s){c(!0),h("");try{let n=await wN({claudeCode:e});t(en3(n)),m(!1)}catch(e){h(e instanceof Error?e.message:"Save failed")}finally{c(!1)}}}return o?(0,ey.jsx)("div",{className:"rounded-lg border border-dashed px-3 py-6 text-sm text-muted-foreground",children:"正在读取引擎配置"}):e?(0,ey.jsxs)("div",{className:"grid gap-6",children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:"CC 引擎"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"配置 Claude Code / reclaude 引擎。展开下方分组按需修改,留空项将自动发现。"})]}),p&&(0,ey.jsxs)(eA.Button,{type:"button",size:"sm",onClick:()=>void y(),disabled:s,children:[(0,ey.jsx)(Kh,{className:"size-4"}),s?"保存中":"保存"]})]}),f?(0,ey.jsxs)(etY,{variant:"destructive",children:[(0,ey.jsx)(eE,{}),(0,ey.jsx)(etZ,{children:"错误"}),(0,ey.jsx)(etJ,{children:f})]}):null,(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4",children:[(0,ey.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"检测到的引擎"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"本机当前可用的 Agent 运行引擎。不可用的引擎会说明原因。"})]}),(0,ey.jsxs)(eA.Button,{type:"button",variant:"outline",size:"sm",className:"shrink-0",onClick:()=>void g(),disabled:u,children:[u?(0,ey.jsx)(eM,{className:"size-4 animate-spin"}):(0,ey.jsx)(xu,{className:"size-4"}),u?"安装中…":"下载/安装适配器"]})]}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground/80",children:"Claude Code / reclaude 需要 ACP 适配器。运行时不再内置它(以减小体积), 点击上方按钮即可在后台静默下载安装;安装后无需手填路径即可使用。"}),(0,ey.jsx)("div",{className:"grid gap-2",children:0===n.length?(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"未检测到引擎信息。"}):n.map(e=>(0,ey.jsxs)("div",{className:"grid gap-1 rounded-md border bg-background p-3",children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ey.jsx)("span",{className:"text-sm font-medium",children:en4[e.engine]??e.engine}),(0,ey.jsxs)("span",{className:(0,eI.cn)("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium [&_svg]:size-3",e.available?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400":"bg-destructive/10 text-destructive"),children:[e.available?(0,ey.jsx)(eO,{}):(0,ey.jsx)(enS,{}),e.available?"可用":"不可用"]})]}),e.reason?(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:e.reason}):null,e.detail?(0,ey.jsx)("p",{className:"text-xs text-muted-foreground/80",children:e.detail}):null]},e.engine))})]}),(0,ey.jsx)("section",{className:"rounded-lg border bg-card px-4",children:(0,ey.jsxs)(en0,{type:"multiple",className:"w-full",children:[(0,ey.jsxs)(en1,{value:"adapter",children:[(0,ey.jsx)(en2,{children:"适配器"}),(0,ey.jsxs)(en5,{className:"grid gap-4 text-foreground",children:[(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et1,{className:"text-sm",children:"适配器命令"}),(0,ey.jsx)(ez,{value:e.adapterCommand??"",onChange:e=>v({adapterCommand:e.currentTarget.value}),placeholder:"node"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"留空则自动使用 node 运行适配器。"})]}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et1,{className:"text-sm",children:"适配器入口 (…/@zed-industries/claude-code-acp/dist/index.js)"}),(0,ey.jsx)(ez,{value:x,onChange:e=>{let t=e.currentTarget.value;v({adapterArgs:t?[t]:[]})},placeholder:"…/@zed-industries/claude-code-acp/dist/index.js"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"留空则自动发现(随运行时安装或环境变量 VANTALOOM_CC_ADAPTER)。"})]}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et1,{className:"text-sm",children:"Git Bash 路径"}),(0,ey.jsx)(ez,{value:e.gitBashPath??"",onChange:e=>v({gitBashPath:e.currentTarget.value}),placeholder:"C:\\\\Program Files\\\\Git\\\\bin\\\\bash.exe"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"Windows 专用,留空自动发现。"})]}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et1,{className:"text-sm",children:"reclaude 可执行文件"}),(0,ey.jsx)(ez,{value:e.reclaudeExecutable??"",onChange:e=>v({reclaudeExecutable:e.currentTarget.value}),placeholder:"reclaude"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"reclaude 可执行文件(或 node shim)路径;自动发现到 reclaude 时会自动填入, 会通过内置 shim 启动。留空则自动发现。"})]})]})]}),(0,ey.jsxs)(en1,{value:"auth",children:[(0,ey.jsx)(en2,{children:"认证"}),(0,ey.jsxs)(en5,{className:"grid gap-4 text-foreground",children:[(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et1,{className:"text-sm",children:"API Key"}),(0,ey.jsx)(ez,{type:"password",autoComplete:"off",value:e.apiKey??"",onChange:e=>v({apiKey:e.currentTarget.value}),placeholder:"claude-code 引擎用;留空可用 claude /login"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"claude-code 引擎用;留空可使用 claude /login 登录。"})]}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et1,{className:"text-sm",children:"OAuth Token"}),(0,ey.jsx)(ez,{type:"password",autoComplete:"off",value:e.oauthToken??"",onChange:e=>v({oauthToken:e.currentTarget.value}),placeholder:"留空使用其它认证方式"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"可选的 OAuth Token,作为 API Key 之外的认证方式。"})]})]})]}),(0,ey.jsxs)(en1,{value:"summary",children:[(0,ey.jsx)(en2,{children:"摘要模型"}),(0,ey.jsx)(en5,{className:"grid gap-4 text-foreground",children:(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et1,{className:"text-sm",children:"摘要模型"}),(0,ey.jsx)(en7,{models:a,value:e.summaryModelRef??"",onValueChange:e=>v({summaryModelRef:e}),placeholder:"使用默认"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"CC 会话标题/摘要用的 Vantaloom 模型路由。"})]})})]})]})})]}):(0,ey.jsxs)(etY,{variant:"destructive",children:[(0,ey.jsx)(eE,{}),(0,ey.jsx)(etZ,{children:"读取失败"}),(0,ey.jsx)(etJ,{children:f||"无法加载引擎配置"})]})}function en7({models:e,value:t,onValueChange:n,placeholder:r}){return(0,ey.jsxs)(go,{value:t||"__none__",onValueChange:e=>n("__none__"===e?"":e),children:[(0,ey.jsx)(gX,{className:"w-full",children:(0,ey.jsx)(gu,{placeholder:r})}),(0,ey.jsxs)(gJ,{children:[(0,ey.jsx)(gQ,{value:"__none__",children:r}),e.map(e=>(0,ey.jsx)(gQ,{value:e.id,children:e.label},e.id))]})]})}let en9=[{id:"card",label:"卡片布局",description:"圆角卡片自由排布,右上角下拉菜单按需添加单窗口。",icon:(0,ey.jsx)(eeC,{})},{id:"pane",label:"分屏布局",description:"传统多窗格 + 顶部分屏预设,可拖拽分割线调整。",icon:(0,ey.jsx)(V5,{})},{id:"control-room",label:"导播台视角",description:"隐藏窗格,右侧以监视器墙并排查看主代理与各子代理。",icon:(0,ey.jsx)(eP,{})}],ere=[{id:"left",label:"Agent 在左",icon:(0,ey.jsx)(sW,{})},{id:"right",label:"Agent 在右",icon:(0,ey.jsx)(sU,{})}];function ert(){let[e,t]=ew.useState("pane"),[n,r]=ew.useState("left");return ew.useEffect(()=>{let e=Zv();t(e.mode),r(e.agentSide)},[]),(0,ey.jsxs)("div",{className:"grid gap-6",children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:"布局排版"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"仅电脑端生效。切换 Agent 工作区的窗口布局与 Agent 对话的位置,设置即时应用到所有会话。"})]}),(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4",children:[(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"布局模式"}),(0,ey.jsx)("div",{className:"grid gap-2 sm:grid-cols-3",children:en9.map(n=>{let r=e===n.id;return(0,ey.jsxs)("button",{type:"button",onClick:()=>{var e;t(e=n.id),Zx({mode:e})},className:(0,eI.cn)("flex flex-col gap-2 rounded-lg border p-3 text-left transition-colors [&_svg]:size-5",r?"border-primary bg-primary/5 text-foreground":"border-border bg-background text-muted-foreground hover:bg-muted/60 hover:text-foreground"),"aria-pressed":r,children:[(0,ey.jsx)("span",{className:(0,eI.cn)("grid size-9 place-items-center rounded-md",r?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:n.icon}),(0,ey.jsx)("span",{className:"text-sm font-medium text-foreground",children:n.label}),(0,ey.jsx)("span",{className:"text-xs text-muted-foreground",children:n.description})]},n.id)})})]}),(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4",children:[(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"Agent 对话位置"}),(0,ey.jsx)("div",{className:"flex flex-wrap gap-2",children:ere.map(e=>{let t=n===e.id;return(0,ey.jsxs)("button",{type:"button",onClick:()=>{var t;r(t=e.id),Zx({agentSide:t})},className:(0,eI.cn)("inline-flex items-center gap-2 rounded-lg border px-3 py-2 text-sm transition-colors [&_svg]:size-4",t?"border-primary bg-primary/5 text-foreground":"border-border bg-background text-muted-foreground hover:bg-muted/60 hover:text-foreground"),"aria-pressed":t,children:[e.icon,e.label]},e.id)})})]})]})}let ern=[{value:"openai-v1",label:"OpenAI v1"},{value:"anthropic",label:"Anthropic"},{value:"openai-responses",label:"OpenAI Responses"}];function err(e){return{id:e.id,providerName:e.providerName,protocol:e.protocol,endpointUrl:e.endpointUrl,apiKey:"",models:e.models,selectedModelIds:e.selectedModelIds,loadingModels:!1,saving:!1,error:e.lastError??"",savedKeyAvailable:!0,editing:!1}}function era(){let[e,t]=ew.useState([]),[n,r]=ew.useState(!0),[a,i]=ew.useState(""),o=ew.useCallback(async()=>{i("");try{let e=await v9();t(e.routes.map(err))}catch(e){i(e instanceof Error?e.message:"模型路由读取失败")}finally{r(!1)}},[]);function l(e,n){t(t=>t.map((t,r)=>r===e?n(t):t))}async function s(t){let n=e[t];if(n&&!n.saving){l(t,e=>({...e,saving:!0,error:""}));try{let e=await xt({id:n.id,providerName:n.providerName,protocol:n.protocol,endpointUrl:n.endpointUrl,apiKey:n.apiKey,models:n.models,selectedModelIds:n.selectedModelIds});l(t,()=>err(e))}catch(e){l(t,t=>({...t,saving:!1,error:e instanceof Error?e.message:"保存失败"}))}}}async function c(n){let r=e[n];if(r&&!r.saving){if(!r.id)return void t(e=>e.filter((e,t)=>t!==n));l(n,e=>({...e,saving:!0,error:""}));try{await xn(r.id),t(e=>e.filter((e,t)=>t!==n))}catch(e){l(n,t=>({...t,saving:!1,error:e instanceof Error?e.message:"删除失败"}))}}}return ew.useEffect(()=>{o()},[o]),(0,ey.jsxs)("div",{className:"grid gap-4",children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,ey.jsx)("div",{className:"min-w-0",children:(0,ey.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:"模型路由"})}),(0,ey.jsxs)(eA.Button,{type:"button",size:"sm",onClick:function(){t(e=>[{providerName:"",protocol:"openai-v1",endpointUrl:"",apiKey:"",models:[],selectedModelIds:[],loadingModels:!1,saving:!1,error:"",editing:!0},...e])},"data-tour":"add-model-route",children:[(0,ey.jsx)(lV,{className:"size-4"}),"添加模型路由"]})]}),a?(0,ey.jsxs)(etY,{variant:"destructive",children:[(0,ey.jsx)(eE,{}),(0,ey.jsx)(etZ,{children:"读取失败"}),(0,ey.jsx)(etJ,{children:a})]}):null,n?(0,ey.jsx)("div",{className:"rounded-lg border border-dashed px-3 py-6 text-sm text-muted-foreground",children:"正在读取模型路由"}):0===e.length?(0,ey.jsx)("div",{className:"rounded-lg border border-dashed px-3 py-6 text-sm text-muted-foreground",children:"还没有模型路由。"}):(0,ey.jsx)("div",{className:"grid gap-3",children:e.map((e,t)=>(0,ey.jsx)(eri,{draft:e,onDraftChange:e=>l(t,()=>e),onSave:()=>{s(t)},onDelete:()=>{c(t)}},e.id??`draft-${t}`))})]})}function eri({draft:e,onDraftChange:t,onSave:n,onDelete:r}){let a=ew.useRef(e),i=ew.useRef(t),o=[e.providerName,e.protocol,e.endpointUrl,e.apiKey||(e.savedKeyAvailable?"saved":"")].join("\n"),l=e.providerName.trim()&&e.endpointUrl.trim()&&e.apiKey.trim(),s=e.providerName.trim()&&e.endpointUrl.trim()&&(e.apiKey.trim()||e.savedKeyAvailable)&&e.selectedModelIds.length>0&&!e.saving;function c(n){t({...e,...n})}if(ew.useEffect(()=>{a.current=e,i.current=t},[e,t]),ew.useEffect(()=>{if(!l)return;let e=window.setTimeout(async()=>{let e=a.current;i.current({...e,loadingModels:!0,error:""});try{let t=await xe({providerName:e.providerName,protocol:e.protocol,endpointUrl:e.endpointUrl,apiKey:e.apiKey}),n=e.selectedModelIds.filter(e=>t.models.some(t=>t.id===e));i.current({...e,models:t.models,selectedModelIds:n,loadingModels:!1,error:""})}catch(t){i.current({...e,loadingModels:!1,error:t instanceof Error?t.message:"模型拉取失败"})}},650);return()=>window.clearTimeout(e)},[l,o]),!e.editing){let t=e.selectedModelIds.map(t=>e.models.find(e=>e.id===t)?.displayName||t).filter(Boolean),n=ern.find(t=>t.value===e.protocol)?.label??e.protocol;return(0,ey.jsxs)("section",{className:"grid min-h-16 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-lg border bg-card px-3 py-2.5",children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[(0,ey.jsx)("span",{className:"truncate text-sm font-medium",children:e.providerName}),(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:n})]}),(0,ey.jsx)("div",{className:"mt-1 truncate text-xs text-muted-foreground",children:t.length>0?t.join(", "):"未选择模型"})]}),(0,ey.jsxs)(eA.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>c({editing:!0}),children:[(0,ey.jsx)(Vj,{className:"size-4"}),"编辑"]})]})}return(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-3","data-tour":"model-route-form",children:[(0,ey.jsxs)("div",{className:"grid gap-2 md:grid-cols-[minmax(0,1fr)_11rem]",children:[(0,ey.jsx)(ez,{value:e.providerName,placeholder:"提供商名称",onChange:e=>c({providerName:e.currentTarget.value})}),(0,ey.jsxs)(go,{value:e.protocol,onValueChange:e=>c({protocol:e}),children:[(0,ey.jsx)(gX,{className:"w-full",children:(0,ey.jsx)(gu,{})}),(0,ey.jsx)(gJ,{children:ern.map(e=>(0,ey.jsx)(gQ,{value:e.value,children:e.label},e.value))})]})]}),(0,ey.jsxs)("div",{className:"grid gap-2 md:grid-cols-[minmax(0,1fr)_minmax(0,18rem)]",children:[(0,ey.jsx)(ez,{value:e.endpointUrl,placeholder:"API 端点 URL,例如 https://api.openai.com/v1",onChange:e=>c({endpointUrl:e.currentTarget.value})}),(0,ey.jsx)(ez,{value:e.apiKey,type:"password",placeholder:e.savedKeyAvailable?"已保存,留空沿用":"API Key",onChange:e=>c({apiKey:e.currentTarget.value})})]}),(0,ey.jsx)(Qy,{}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsxs)("div",{className:"flex min-h-6 items-center justify-between gap-2",children:[(0,ey.jsxs)("div",{className:"flex min-w-0 items-center gap-2 text-sm font-medium",children:[(0,ey.jsx)(pj,{className:"size-4 text-muted-foreground"}),"可用模型"]}),e.loadingModels?(0,ey.jsx)("span",{className:"text-xs text-muted-foreground",children:"拉取中"}):null]}),e.models.length>0?(0,ey.jsx)("div",{className:"grid max-h-64 gap-1 overflow-auto pr-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:e.models.map(t=>{let n=e.selectedModelIds.includes(t.id);return(0,ey.jsxs)("div",{className:(0,eI.cn)("grid min-h-8 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 rounded-md px-2 text-sm hover:bg-muted/60",n&&"bg-muted/70"),children:[(0,ey.jsxs)("label",{className:"flex cursor-pointer items-center gap-2",children:[(0,ey.jsx)(Wy,{checked:n,onCheckedChange:n=>{var r;return r=t.id,void c({selectedModelIds:!0===n?[...e.selectedModelIds,r]:e.selectedModelIds.filter(e=>e!==r)})}}),(0,ey.jsx)("span",{className:"truncate",children:t.displayName||t.id})]}),(0,ey.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ey.jsx)(ez,{type:"number",className:"h-6 w-16 px-1.5 text-center text-xs tabular-nums",value:t.contextLength||200,min:1,max:1e4,onChange:n=>{var r,a;return r=t.id,a=Number.parseInt(n.currentTarget.value,10)||0,void c({models:e.models.map(e=>e.id===r?{...e,contextLength:a>0?a:void 0}:e)})}}),(0,ey.jsx)("span",{className:"text-xs text-muted-foreground",children:"k"})]})]},t.id)})}):(0,ey.jsx)("div",{className:"rounded-md border border-dashed px-3 py-4 text-sm text-muted-foreground",children:"填写端点和密钥后会自动拉取模型。"})]}),e.error?(0,ey.jsxs)(etY,{variant:"destructive",children:[(0,ey.jsx)(eE,{}),(0,ey.jsx)(etZ,{children:"模型路由错误"}),(0,ey.jsx)(etJ,{className:"break-words",children:e.error})]}):null,(0,ey.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,ey.jsxs)(eA.Button,{type:"button",variant:"destructive",onClick:r,disabled:e.saving,children:[(0,ey.jsx)(xC,{className:"size-4"}),"删除"]}),(0,ey.jsx)(eA.Button,{type:"button",onClick:n,disabled:!s,children:e.saving?"保存中":"保存"})]})]})}async function ero(){return ers("/api/local/subagent-config")}async function erl(e){return ers("/api/local/subagent-config",{method:"PUT",body:JSON.stringify(e)})}async function ers(e,t){let n=await fetch(eD(e),{cache:"no-store",...t,headers:{...t?.body?{"Content-Type":"application/json"}:{},...t?.headers}}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error("string"==typeof r?.error?r.error:"subagent config api failed");return r}function erc(e){return{explore:{...e.explore},workflow:{...e.workflow},operator:{...e.operator},custom:{...e.custom,models:[...e.custom.models??[]]}}}let eru={explore:{title:"探索子代理",icon:(0,ey.jsx)(BR,{className:"size-4"}),tint:"text-sky-600 dark:text-sky-400",description:"只读的代码库探索/调研专家。彻底阅读、搜索代码库,返回带文件路径+行号引用的完整结论,替主 agent 节省上下文。",tools:"仅阅读(vantaloom_read)"},workflow:{title:"工作流子代理",icon:(0,ey.jsx)(dc,{className:"size-4"}),tint:"text-violet-600 dark:text-violet-400",description:"按 workflow-*.yml 严格执行可重复的多步流程,并把其中确定性的步骤自动固化为脚本、给 yml 添加批注。",tools:"阅读 / 编辑 / 终端(vantaloom_read · vantaloom_edit · vantaloom_shell)"},operator:{title:"操作员子代理",icon:(0,ey.jsx)(ds,{className:"size-4"}),tint:"text-pink-600 dark:text-pink-400",description:"专门驱动交互式终端(未来含浏览器)。执行大量终端操作并把结果回报给主 agent。",tools:"阅读 / 终端(vantaloom_read · vantaloom_shell)"}};function erd(){let[e,t]=ew.useState(null),{models:n,loading:r}=xa(),[a,i]=ew.useState(!0),[o,l]=ew.useState(!1),[s,c]=ew.useState(""),[u,d]=ew.useState(!1);async function f(){if(e&&!o){l(!0),c("");try{let n=await erl({explore:e.explore,workflow:e.workflow,operator:e.operator,custom:e.custom});t(erc(n)),d(!1)}catch(e){c(e instanceof Error?e.message:"Save failed")}finally{l(!1)}}}return ew.useEffect(()=>{!async function(){try{let e=await ero();t(erc(e))}catch(e){c(e instanceof Error?e.message:"Failed to load config")}finally{i(!1)}}()},[]),a?(0,ey.jsx)("div",{className:"rounded-lg border border-dashed px-3 py-6 text-sm text-muted-foreground",children:"正在读取子代理配置"}):e?(0,ey.jsxs)("div",{className:"grid gap-6",children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:"子代理配置"}),(0,ey.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"主 agent 可以派发这些子代理来分担任务。每个子代理拥有独立上下文与受限工具集,完成后只把结果汇报给主 agent。"})]}),u&&(0,ey.jsxs)(eA.Button,{type:"button",size:"sm",onClick:()=>void f(),disabled:o,children:[(0,ey.jsx)(Kh,{className:"size-4"}),o?"保存中":"保存"]})]}),s?(0,ey.jsxs)(etY,{variant:"destructive",children:[(0,ey.jsx)(eE,{}),(0,ey.jsx)(etZ,{children:"错误"}),(0,ey.jsx)(etJ,{children:s})]}):null,["explore","workflow","operator"].map(a=>(0,ey.jsx)(erf,{tourId:`subagent-${a}`,meta:eru[a],value:e[a],models:n,modelsLoading:r,onChange:e=>{t(t=>t?{...t,[a]:{...t[a],...e}}:t),d(!0)}},a)),(0,ey.jsx)(erh,{value:e.custom,models:n,modelsLoading:r,onChange:function(e){t(t=>t?{...t,custom:{...t.custom,...e}}:t),d(!0)}})]}):(0,ey.jsxs)(etY,{variant:"destructive",children:[(0,ey.jsx)(eE,{}),(0,ey.jsx)(etZ,{children:"读取失败"}),(0,ey.jsx)(etJ,{children:s||"无法加载子代理配置"})]})}function erf({meta:e,value:t,models:n,modelsLoading:r,onChange:a,tourId:i}){return(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4","data-tour":i,children:[(0,ey.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ey.jsx)("span",{className:e.tint,children:e.icon}),(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:e.title})]}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:e.description}),(0,ey.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,ey.jsx)("span",{className:"text-foreground/70",children:"可用工具:"}),e.tools,(0,ey.jsx)("span",{className:"ml-1 text-muted-foreground/70",children:"(固定,不可更改)"})]}),(0,ey.jsx)(Qy,{}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et1,{className:"text-sm",children:"使用模型"}),(0,ey.jsx)(erp,{models:n,value:t.modelRef,onValueChange:e=>a({modelRef:e}),placeholder:r?"读取模型中":"继承上级模型"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"留空则继承派发它的上级 agent 当前使用的模型。"})]}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsxs)("div",{className:"min-w-0 space-y-0.5",children:[(0,ey.jsx)(et1,{className:"text-sm",children:"允许上级指定模型"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"开启后,上级 agent 可在派发时动态指定该子代理使用的模型。"})]}),(0,ey.jsx)(xo,{checked:t.allowCallerModel,onCheckedChange:e=>a({allowCallerModel:e})})]}),(0,ey.jsx)(Qy,{}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)(et1,{className:"text-sm",children:"系统提示词"}),t.promptOverride?(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>a({promptOverride:""}),children:"恢复默认"}):null]}),(0,ey.jsx)(bm,{value:t.promptOverride,onChange:e=>a({promptOverride:e.currentTarget.value}),placeholder:"留空使用内置默认提示词;在此输入将覆盖默认提示词(环境/工具说明仍会自动附加)。",rows:t.promptOverride?10:3,className:"resize-y text-sm"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"覆盖该官方子代理的预设系统提示词。派发时还会自动附加工作区、操作系统与工具使用说明。"})]})]})}function erh({value:e,models:t,modelsLoading:n,onChange:r}){let a=ew.useCallback(e=>t.find(t=>t.value===e)?.label??e,[t]);return(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4","data-tour":"subagent-custom",children:[(0,ey.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ey.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:(0,ey.jsx)(de,{className:"size-4"})}),(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"自定义子代理"})]}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"主 agent 可以自取名字、从下面的模型池中选一个模型来召唤自定义子代理,并可选择是否继承当前对话上下文。自定义子代理拥有完整工具集,还能进一步派发上面三种官方子代理。"}),(0,ey.jsx)(Qy,{}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et1,{className:"text-sm",children:"可用模型池"}),(0,ey.jsx)(v7,{variant:"list-combobox",value:e.models,onValueChange:e=>r({models:e}),options:t,placeholder:n?"读取模型中":"选择可供自定义子代理使用的模型",searchPlaceholder:"搜索模型...",emptyText:"没有可用模型",renderItem:a}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"主 agent 召唤自定义子代理时会从这个池中选择一个模型。留空则沿用上级 agent 的模型。"})]})]})}function erp({models:e,value:t,onValueChange:n,placeholder:r}){return(0,ey.jsxs)(go,{value:t||"__none__",onValueChange:e=>n("__none__"===e?"":e),children:[(0,ey.jsx)(gX,{className:"w-full",children:(0,ey.jsx)(gu,{placeholder:r})}),(0,ey.jsxs)(gJ,{children:[(0,ey.jsx)(gQ,{value:"__none__",children:r}),e.map(e=>(0,ey.jsx)(gQ,{value:e.value,children:e.label},e.value))]})]})}function erm({section:e}={}){return(0,ey.jsx)("div",{className:"vtl-app-background h-full min-h-0 overflow-auto p-6 pb-14 text-foreground md:pb-6",children:(0,ey.jsx)("div",{className:"mx-auto w-full max-w-3xl","data-tour":`preferences-${e??"model-routes"}`,children:"agent-config"===e?(0,ey.jsx)(enj,{}):"subagent-config"===e?(0,ey.jsx)(erd,{}):"cc-engine-config"===e?(0,ey.jsx)(en8,{}):"layout"===e?(0,ey.jsx)(ert,{}):(0,ey.jsx)(era,{})})})}let erg=(0,ek.default)("circle-arrow-up",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);function erv(e,t){if(e.isLocal)return eD(t);let n=t.replace(/^\/v1(?=\/)/,"");return eD(`/v1/remote/${e.id}${n}`)}async function erx(e){try{let t=await fetch(`https://registry.npmjs.org/@vantaloom/runtime-${e}`,{headers:{Accept:"application/vnd.npm.install-v1+json"},cache:"no-store"});if(!t.ok)return;let n=await t.json();return n?.["dist-tags"]?.latest}catch{return}}function ery(){let[e,t]=ew.useState([]),[n,r]=ew.useState(!0),a=ew.useRef(!0),i=ew.useCallback((e,n)=>{t(t=>t.map(t=>t.machine.id===e?{...t,...n}:t))},[]),o=ew.useCallback(async()=>{r(!0);let e=[];try{let t=await fetch(eD("/v1/remote/machines"),{cache:"no-store"});e=(await t.json()).machines??[]}catch{e=[]}a.current&&(t(e.map(e=>({machine:e,loading:!0}))),r(!1),await Promise.all(e.map(async e=>{if(!e.isLocal&&"online"!==e.status){a.current&&i(e.id,{loading:!1,error:"离线"});return}try{let t,n=await fetch(erv(e,"/v1/runtime/info"),{cache:"no-store"});if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.text();try{t=JSON.parse(r)}catch{throw Error("该机器运行时过旧,不支持版本检测")}let o=await erx(t.platform);a.current&&i(e.id,{info:t,latest:o,loading:!1})}catch(t){a.current&&i(e.id,{loading:!1,error:t instanceof Error?t.message:"无法获取版本"})}})))},[i]);async function l(e){if(e.info&&!e.updating){i(e.machine.id,{updating:!0});try{await fetch(erv(e.machine,"/v1/runtime/update"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({version:e.latest})})}catch{}window.setTimeout(()=>{a.current&&o()},25e3)}}return ew.useEffect(()=>(a.current=!0,o(),()=>{a.current=!1}),[o]),(0,ey.jsx)("div",{className:"h-full overflow-auto px-6 py-8","data-tour":"check-update",children:(0,ey.jsxs)("div",{className:"mx-auto flex max-w-3xl flex-col gap-5",children:[(0,ey.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,ey.jsxs)("div",{children:[(0,ey.jsx)("h1",{className:"text-xl font-semibold",children:"检查更新"}),(0,ey.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"工作组内各机器的运行时版本与可用更新。点击「立即更新」可让对应机器自动更新(该机器会短暂重启)。"})]}),(0,ey.jsxs)(eA.Button,{variant:"outline",size:"sm",onClick:()=>void o(),disabled:n,children:[(0,ey.jsx)(xS,{className:(0,eI.cn)("size-4",n&&"animate-spin")}),"刷新"]})]}),n&&0===e.length?(0,ey.jsxs)("div",{className:"flex items-center justify-center gap-2 rounded-xl border bg-card p-8 text-sm text-muted-foreground",children:[(0,ey.jsx)(eM,{className:"size-4 animate-spin"})," 正在获取机器列表…"]}):0===e.length?(0,ey.jsx)("div",{className:"rounded-xl border bg-card p-8 text-center text-sm text-muted-foreground",children:"暂无可用机器。"}):(0,ey.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>{let t=!!e.info&&!!e.latest&&e.latest!==e.info.version;return(0,ey.jsxs)("div",{className:"flex items-center gap-4 rounded-xl border bg-card px-4 py-3",children:[(0,ey.jsx)(eP,{className:"size-5 shrink-0 text-muted-foreground"}),(0,ey.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ey.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ey.jsx)("span",{className:"truncate text-sm font-medium",children:e.machine.name}),e.machine.isLocal?(0,ey.jsx)("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:"本机"}):null]}),(0,ey.jsx)("div",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:e.loading?"读取版本中…":e.error?(0,ey.jsx)("span",{className:"text-amber-600",children:e.error}):(0,ey.jsxs)(ey.Fragment,{children:[function(e){switch(e){case"windows":return"Windows";case"darwin":return"macOS";case"linux":return"Linux";case"android":return"Android";default:return e||"未知"}}(e.info?.os??e.machine.platform??"")," · 当前 ",(0,ey.jsx)("span",{className:"font-mono",children:e.info?.version??"?"}),e.latest?(0,ey.jsxs)(ey.Fragment,{children:[" · 最新 ",(0,ey.jsx)("span",{className:"font-mono",children:e.latest})]}):null,e.info?.updatedAt?(0,ey.jsxs)(ey.Fragment,{children:[" · 更新于 ",function(e){if(!e)return"—";let t=Date.parse(e);return Number.isFinite(t)?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t):"—"}(e.info.updatedAt)]}):null]})})]}),e.loading?(0,ey.jsx)(eM,{className:"size-4 animate-spin text-muted-foreground"}):e.updating?(0,ey.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-primary",children:[(0,ey.jsx)(eM,{className:"size-4 animate-spin"})," 更新中…"]}):t?(0,ey.jsxs)(eA.Button,{size:"sm",onClick:()=>void l(e),children:[(0,ey.jsx)(erg,{className:"size-4"})," 立即更新"]}):e.info?(0,ey.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,ey.jsx)(eO,{className:"size-4 text-emerald-500"})," 已是最新"]}):null]},e.machine.id)})}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground/70",children:"最新版本号来自 npm(@vantaloom/runtime-<平台>)。更新过程中该机器会停止并重启运行时, 若你的手机正连着它会短暂断开,更新完成后重新连接即可。"})]})})}let erb=["light","dark","jelly"],erw={light:{label:"Light",icon:eeO,className:"text-sidebar-foreground/60"},dark:{label:"Dark",icon:eeM,className:"text-sidebar-foreground/60"},jelly:{label:"Jelly",icon:function(e){return(0,ey.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[(0,ey.jsx)("path",{d:"M6.5 11.5C6.5 8 8.7 5.5 12 5.5s5.5 2.5 5.5 6v.6c0 .8-.6 1.4-1.4 1.4H7.9c-.8 0-1.4-.6-1.4-1.4v-.6Z"}),(0,ey.jsx)("path",{d:"M7.8 13.5c.4 1 1.1 1.5 2 1.5s1.6-.5 2-1.5c.4 1 1.1 1.5 2 1.5s1.6-.5 2-1.5"}),(0,ey.jsx)("path",{d:"M9 15.5c0 1.4-1.2 1.4-1.2 2.8 0 .7.3 1.2.8 1.7"}),(0,ey.jsx)("path",{d:"M12 15.5c0 1.6-1.4 1.6-1.4 3.2 0 .7.3 1.2.8 1.8"}),(0,ey.jsx)("path",{d:"M15 15.5c0 1.4 1.2 1.4 1.2 2.8 0 .7-.3 1.2-.8 1.7"})]})},className:"text-primary"}};function erj(){let{resolvedTheme:e,setTheme:t}=(0,hl.useTheme)(),[n,r]=ew.useState(eeH.defaultAppearanceTheme);ew.useEffect(()=>{let e=window.localStorage.getItem(eeH.appearanceThemeStorageKey)??eeH.defaultAppearanceTheme;r(e),(0,eeH.applyAppearanceTheme)({theme:e})},[]);let a=n===eeH.jellyAppearanceTheme?"jelly":"dark"===e?"dark":"light",i=erb.indexOf(a),o=erb[(i+1)%erb.length]??"light",{icon:l,label:s,className:c}=erw[a];function u(e){r(e),window.localStorage.setItem(eeH.appearanceThemeStorageKey,e),(0,eeH.applyAppearanceTheme)({theme:e})}return(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm",className:(0,eI.cn)("size-10 hover:bg-muted hover:text-sidebar-foreground",c),"aria-label":`${Z3.theme}: ${s}`,title:`${Z3.theme}: ${s}`,onClick:function(){if("jelly"===o){t("dark"),u(eeH.jellyAppearanceTheme);return}u(eeH.defaultAppearanceTheme),t(o)},children:(0,ey.jsx)(l,{})})}let erk=(0,ek.default)("chart-area",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z",key:"q0gr47"}]]);(0,ek.default)("layout-dashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);let erS=(0,ek.default)("list-checks",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]]),erC=((0,ek.default)("route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]),(0,ek.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]])),erN=[{id:"run-ui-polish",title:"组件库视觉回归检查",machine:"Studio-PC",agent:"UI Polish",state:"running",started:"14:08",runtime:"22m",progress:68,load:54},{id:"run-runner-build",title:"Linux runner 镜像构建",machine:"Linux-runner-02",agent:"Build Agent",state:"running",started:"14:15",runtime:"15m",progress:41,load:86},{id:"run-access-audit",title:"工作组权限审阅",machine:"Studio-PC",agent:"Access Agent",state:"blocked",started:"14:21",runtime:"9m",progress:37,load:18},{id:"run-docs",title:"发布说明摘要",machine:"MacBook-build",agent:"Docs Agent",state:"queued",started:"等待",runtime:"0m",progress:0,load:0},{id:"run-cache-clean",title:"缓存清理策略验证",machine:"Linux-runner-02",agent:"Ops Sentinel",state:"failed",started:"13:54",runtime:"6m",progress:28,load:12}],erM=[{id:"worker-studio",machine:"Studio-PC",role:"local coordinator",active:3,capacity:6,cpu:42,memory:68},{id:"worker-runner",machine:"Linux-runner-02",role:"gpu worker",active:4,capacity:5,cpu:76,memory:81},{id:"worker-mac",machine:"MacBook-build",role:"build host",active:0,capacity:3,cpu:8,memory:24}],erE=[{id:"confirm-shell",title:"Studio-PC 请求执行发布前文件写入",meta:"UI Polish · apply_patch",tone:"normal"},{id:"confirm-service",title:"Linux-runner-02 请求重启 runner 服务",meta:"Ops Sentinel · Restart-Service",tone:"warning"},{id:"confirm-token",title:"工作组 token 加入新机器",meta:"Access Agent · admin required",tone:"normal"}],erO=[["14:29","Studio-PC","pnpm --filter vantaloom-app lint","完成"],["14:27","Linux-runner-02","docker build agent-runtime","运行中"],["14:22","Studio-PC","apply_patch agent settings","完成"],["14:17","MacBook-build","pnpm typecheck","排队"],["14:03","Linux-runner-02","cache prune dry-run","失败"]],erP={cpu:{label:"CPU",color:"var(--chart-1)"},memory:{label:"Memory",color:"var(--chart-3)"},network:{label:"Network",color:"var(--chart-5)"}};function erA(e,t,n=42,r){return(0,ey.jsx)("section",{className:(0,eI.cn)("size-full rounded-xl border bg-card p-5",r&&"vtl-jelly-image-card",r&&r.includes("/bg")&&"vtl-jelly-image-card-shadowless"),style:r?Z5({image:r,opacity:.74,blur:"8px"}):void 0,children:(0,ey.jsx)(Jj,{label:e,value:t,minSize:n})})}function erI(e,t,n=""){return{title:e,dataSource:t,refreshRate:"10s",note:n}}let erz={metrics:{online:2,health:88.4,latency:"38ms",events:17},machines:[{id:"studio",name:"Studio-PC",os:"Windows",status:"online",link:"direct",heartbeat:"3s",cpu:42,memory:68,disk:71,network:24},{id:"runner",name:"Linux-runner-02",os:"Linux",status:"online",link:"p2p",heartbeat:"5s",cpu:76,memory:81,disk:62,network:43},{id:"mac",name:"MacBook-build",os:"macOS",status:"sleeping",link:"direct",heartbeat:"2m",cpu:8,memory:24,disk:48,network:6}],trend:[{time:"09:00",cpu:36,memory:54,network:24},{time:"10:00",cpu:48,memory:61,network:29},{time:"11:00",cpu:44,memory:58,network:34},{time:"12:00",cpu:63,memory:72,network:41},{time:"13:00",cpu:58,memory:69,network:37},{time:"14:00",cpu:71,memory:76,network:46}],networkLinks:[["Studio-PC","Linux-runner-02","P2P","38ms","0.3%"],["Studio-PC","MacBook-build","Direct","12ms","0.0%"],["Linux-runner-02","MacBook-build","Relay fallback","84ms","1.1%"]],events:[["14:31","Linux-runner-02 心跳延迟升高"],["14:28","Studio-PC 完成 2 个工具调用"],["14:19","MacBook-build 进入睡眠状态"],["14:12","工作组权限策略同步完成"],["14:04","P2P 链路切换到备用路径"]],serviceHealth:[{id:"local-service",name:"Local service",state:"正常",samples:[96,98,97,95,96,94,97,98,96,95,97,96]},{id:"agent-runtime",name:"Agent runtime",state:"正常",samples:[91,93,94,90,88,92,94,93,91,89,92,94]},{id:"p2p-mesh",name:"P2P mesh",state:"波动",samples:[78,82,76,73,68,71,74,79,83,80,77,72]},{id:"plugin-bridge",name:"Plugin bridge",state:"告警",samples:[88,86,84,82,79,74,63,54,48,52,67,76]}]},er_=[{id:"metric-runs",title:"运行中",description:"当前正在执行的运行数量。",icon:(0,ey.jsx)(dc,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:erI("运行中","运行队列"),render:e=>erA(e.title,"07",44,ZQ)},{id:"metric-queued",title:"排队",description:"等待调度的任务数量。",icon:(0,ey.jsx)(u9,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:erI("排队","调度器"),render:e=>erA(e.title,"04",44,Z0)},{id:"metric-blocked",title:"待确认",description:"等待人工确认的任务数量。",icon:(0,ey.jsx)(erC,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:erI("待确认","确认队列"),render:e=>erA(e.title,"03",44,Z1)},{id:"metric-workers",title:"Worker",description:"当前可调度 worker 数量。",icon:(0,ey.jsx)(JI,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:erI("Worker","Agent worker"),render:e=>erA(e.title,"14",44,Z2)},{id:"queue",title:"任务队列",description:"运行队列 Roadmap。",icon:(0,ey.jsx)(erS,{className:"size-4"}),defaultSize:{w:7,h:5},defaultConfig:erI("任务队列","运行队列"),render:e=>(0,ey.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,ey.jsx)(Z4,{title:e.title}),(0,ey.jsx)(Q0,{items:erN})]})},{id:"workers",title:"Agent worker",description:"各 worker 的负载和容量。",icon:(0,ey.jsx)(JI,{className:"size-4"}),defaultSize:{w:5,h:5},defaultConfig:erI("Agent worker","Worker 状态"),render:e=>(0,ey.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,ey.jsx)(Z4,{title:e.title}),(0,ey.jsx)(Q2,{workers:erM})]})},{id:"log",title:"最近执行",description:"最近执行记录 Roadmap。",icon:(0,ey.jsx)(JN,{className:"size-4"}),defaultSize:{w:7,h:4},defaultConfig:erI("最近执行","执行日志"),render:e=>(0,ey.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,ey.jsx)(Z4,{title:e.title}),(0,ey.jsx)(QQ,{items:erO})]})},{id:"confirmations",title:"待确认",description:"等待人工确认的事项。",icon:(0,ey.jsx)(Qx,{className:"size-4"}),defaultSize:{w:5,h:4},defaultConfig:erI("待确认","确认队列"),render:e=>(0,ey.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,ey.jsx)(Z4,{title:e.title}),(0,ey.jsx)(QJ,{items:erE})]})}],erD=[{id:"metric-runs",kind:"metric-runs",x:0,y:0,w:3,h:2},{id:"metric-queued",kind:"metric-queued",x:3,y:0,w:3,h:2},{id:"metric-blocked",kind:"metric-blocked",x:6,y:0,w:3,h:2},{id:"metric-workers",kind:"metric-workers",x:9,y:0,w:3,h:2},{id:"queue",kind:"queue",x:0,y:2,w:7,h:5},{id:"workers",kind:"workers",x:7,y:2,w:5,h:5},{id:"log",kind:"log",x:0,y:7,w:7,h:4},{id:"confirmations",kind:"confirmations",x:7,y:7,w:5,h:4}];function erR(e=erz){return[{id:"metric-online",title:"在线机器",description:"当前在线机器数量。",icon:(0,ey.jsx)(eP,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:erI("在线机器","机器心跳"),render:t=>erA(t.title,String(e.metrics.online),44,ZQ)},{id:"metric-health",title:"健康度",description:"工作组整体健康度。",icon:(0,ey.jsx)(eO,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:erI("健康度","服务遥测"),render:t=>erA(t.title,`${e.metrics.health}%`,44,Z0)},{id:"metric-latency",title:"平均延迟",description:"机器连接平均延迟。",icon:(0,ey.jsx)(JA,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:erI("平均延迟","网络遥测"),render:t=>erA(t.title,e.metrics.latency,44,Z1)},{id:"metric-events",title:"事件",description:"最近事件数量。",icon:(0,ey.jsx)(Qx,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:erI("事件","事件流"),render:t=>erA(t.title,String(e.metrics.events),44,Z2)},{id:"machines",title:"机器健康矩阵",description:"各机器资源和心跳状态。",icon:(0,ey.jsx)(eP,{className:"size-4"}),defaultSize:{w:7,h:5},defaultConfig:erI("机器健康矩阵","机器遥测"),render:t=>(0,ey.jsxs)("section",{className:"vtl-jelly-image-card flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",style:Z5({image:"/themes/jelly/card1.png",opacity:.88,blur:"10px"}),children:[(0,ey.jsx)(Z4,{title:t.title}),(0,ey.jsx)(Q6,{machines:e.machines})]})},{id:"trend",title:"资源趋势",description:"CPU、内存和网络趋势。",icon:(0,ey.jsx)(erk,{className:"size-4"}),defaultSize:{w:5,h:5},defaultConfig:erI("资源趋势","机器遥测"),render:t=>(0,ey.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,ey.jsx)(Z4,{title:t.title}),(0,ey.jsx)(eet,{config:erP,data:e.trend})]})},{id:"network",title:"网络连接",description:"机器之间连接状态。",icon:(0,ey.jsx)(Zq,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:erI("网络连接","网络遥测"),render:t=>(0,ey.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,ey.jsx)(Z4,{title:t.title}),(0,ey.jsx)(eee,{links:e.networkLinks})]})},{id:"events",title:"事件流",description:"最近遥测事件。",icon:(0,ey.jsx)(Qx,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:erI("事件流","事件流"),render:t=>(0,ey.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,ey.jsx)(Z4,{title:t.title}),(0,ey.jsx)(Q3,{events:e.events})]})},{id:"services",title:"服务健康",description:"服务 30 分钟粒度健康条。",icon:(0,ey.jsx)(JI,{className:"size-4"}),defaultSize:{w:12,h:3},defaultConfig:erI("服务健康","服务遥测"),render:t=>(0,ey.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,ey.jsx)(Z4,{title:t.title}),(0,ey.jsx)(een,{services:e.serviceHealth})]})}]}erR();let erT=[{id:"metric-online",kind:"metric-online",x:0,y:0,w:3,h:2},{id:"metric-health",kind:"metric-health",x:3,y:0,w:3,h:2},{id:"metric-latency",kind:"metric-latency",x:6,y:0,w:3,h:2},{id:"metric-events",kind:"metric-events",x:9,y:0,w:3,h:2},{id:"machines",kind:"machines",x:0,y:2,w:7,h:5},{id:"trend",kind:"trend",x:7,y:2,w:5,h:5},{id:"network",kind:"network",x:0,y:7,w:6,h:4},{id:"events",kind:"events",x:6,y:7,w:6,h:4},{id:"services",kind:"services",x:0,y:11,w:12,h:3}],erL={totals:{machines:4,online:2,runtime:3,tokens:7},machines:[{id:"studio",name:"Studio-PC",role:"本机",group:"Core",os:"Windows 11",runtime:"0.16.4",state:"online",tags:["admin","shell","files","scheduler"],agent:"6/8",cpu:42,memory:68,version:"Agent runtime 0.16.4",admin:"Allay"},{id:"runner",name:"Linux-runner-02",role:"GPU worker",group:"Compute",os:"Ubuntu 24.04",runtime:"0.16.3",state:"online",tags:["gpu","agent","files"],agent:"4/6",cpu:76,memory:81,version:"Agent runtime 0.16.3",admin:"Ops"},{id:"mac",name:"MacBook-build",role:"构建机",group:"Build",os:"macOS 15.4",runtime:"0.15.9",state:"sleeping",tags:["build","readonly"],agent:"0/3",cpu:8,memory:24,version:"Agent runtime 0.15.9",admin:"Allay"},{id:"observer",name:"Observer-01",role:"只读观测节点",group:"Edge",os:"Debian 13",runtime:"0.16.2",state:"warning",tags:["readonly","audit"],agent:"1/2",cpu:18,memory:36,version:"Agent runtime 0.16.2",admin:"Security"}],topology:{nodes:[{id:"studio",label:"Studio-PC",meta:"本机",x:50,y:18},{id:"runner",label:"Linux-runner-02",meta:"GPU worker",x:22,y:60},{id:"mac",label:"MacBook-build",meta:"构建机",x:76,y:58,state:"warning"},{id:"observer",label:"Observer-01",meta:"只读观测",x:50,y:82,state:"warning"}],links:[{id:"sr",from:"studio",to:"runner",kind:"p2p",label:"P2P",meta:"38ms / 0.3%"},{id:"sm",from:"studio",to:"mac",kind:"direct",label:"Direct",meta:"12ms / 0%"},{id:"ro",from:"runner",to:"observer",kind:"relay",label:"Relay",meta:"84ms / 1.1%"},{id:"mo",from:"mac",to:"observer",kind:"down",label:"Down",meta:"lost"}]},pathTotals:{direct:1,p2p:1,relay:1,broken:1},latency:[{time:"09:00",p2p:42,direct:12,relay:96},{time:"10:00",p2p:39,direct:12,relay:88},{time:"11:00",p2p:44,direct:14,relay:91},{time:"12:00",p2p:38,direct:12,relay:84},{time:"13:00",p2p:36,direct:11,relay:86},{time:"14:00",p2p:41,direct:13,relay:93}],candidates:[["Studio-PC","Linux-runner-02","P2P","symmetric NAT","38ms","0.3%"],["Studio-PC","MacBook-build","Direct","open port 4178","12ms","0.0%"],["Linux-runner-02","Observer-01","Relay","udp blocked","84ms","1.1%"],["MacBook-build","Observer-01","Interrupted","sleep","-","-"]]};function er$({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){return(0,ey.jsx)(Jx,{boardId:"runtime-operations",definitions:er_,initialLayouts:erD,clipboardItems:e,actionLabel:"运行页面卡片操作",paletteGroupTitle:"运行页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}!function(e=erL){erI("机器","机器组"),erI("在线","机器心跳"),erI("Runtime","Agent runtime"),erI("Token","机器注册"),erI("机器组","机器组"),erI("拓扑图","网络拓扑"),erI("直连","网络拓扑"),erI("P2P","网络拓扑"),erI("Relay","网络拓扑"),erI("中断","网络拓扑"),erI("延迟","网络遥测"),erI("候选路径","网络候选路径")}(),erI("日志与审计","审计事件"),erI("筛选","审计筛选"),erI("拒绝事件","审计事件"),erI("事件趋势","审计事件");let erF={metrics:{online:0,health:0,latency:"local",events:0},machines:[],trend:[],networkLinks:[],events:[],serviceHealth:[]};function erB({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){let r=function(e,t){let[n,r]=ew.useState(t);return ew.useEffect(()=>{let n=!0,a=!1;async function i(){if(!a){a=!0;try{let t=await fetch(eD(e),{cache:"no-store"});if(!t.ok)return;let a=await t.json();n&&r(a)}catch{n&&r(t)}finally{a=!1}}}i();let o=window.setInterval(i,2e3);return()=>{n=!1,window.clearInterval(o)}},[t,e]),n}("/api/local/machines/telemetry",erF),a=ew.useMemo(()=>erR(r),[r]);return(0,ey.jsx)(Jx,{boardId:"telemetry",definitions:a,initialLayouts:erT,clipboardItems:e,actionLabel:"遥测页面卡片操作",paletteGroupTitle:"遥测页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}function erV({className:e,title:t="Vantaloom"}){return(0,ey.jsxs)("svg",{viewBox:"180 350 1130 260",fill:"currentColor",role:"img","aria-label":t,className:(0,eI.cn)("[[data-vtl-theme=jelly]_&]:opacity-70",e),children:[(0,ey.jsx)("path",{d:"m658 393 2 1v47l57 1v1l-12 2-45 5v89l2 14 4 7 6 3h12l8-2-5-10-1-4v-11l3-8 4-6 7-7 14-8 16-6 33-9h3l-1-16-4-8-6-5-10-3h-15l-13 3-16 7-7 5 1-4 8-8 14-8 12-4 7-1h23l16 4 9 6 4 5 4 9 1 5 1 69 2 11 3 5 7 5v1h-28l-6-4-4-11v-7h-2l-2 4-7 8-11 8-10 4-4 1h-21l-9-4-7-5-14 7-7 2h-18l-11-4-6-5-5-10-1-4-1-33v-61l1-4-26 3-9-7-4-3 4-1 34-2v-34l2-5zm107 104-19 6-17 8-10 9-4 8-1 4v11l3 8 8 7 7 2h8l10-3 10-7 6-7 1-2v-44z"}),(0,ey.jsx)("path",{d:"m1147 452h15l11 3 10 9 5 10v3h2l2-5 10-10 12-7 11-3h18l10 3 6 4 7 8 4 12 1 9 1 62 3 12 4 5 3 3h-38l-1-86-2-9-5-7-7-3h-12l-10 3-9 6-7 8-1 88h-26l-1-88-3-9-5-6-6-2h-11l-9 3-9 7-4 6-1 89h-34l6-14 4-19 1-10v-28l-3-19-6-18-4-9h28l3 8 3 13 7-8 8-7 10-5z"}),(0,ey.jsx)("path",{d:"m556 449h19l13 4 10 9 4 9 2 13 1 67 3 10 4 5 5 4h-40l-1-85-3-12-4-6-7-4-3-1h-14l-11 4-10 7-5 8-1 6-1 83h-25l-1-99-2-17 1-1h24l2 6 2 13 9-10 12-8 11-4z"}),(0,ey.jsx)("path",{d:"m409 450h22l16 4 9 6 6 9 3 11 1 71 2 9 3 5 6 4v1h-27l-6-4-3-7-2-9-11 12-13 8-9 3-7 1h-13l-12-3-10-7-6-10-1-4v-13l5-12 4-5 12-9 18-8 35-10 6-2v-14l-3-8-5-5-7-3-4-1h-15l-13 3-20 10 6-9 10-7 13-5zm27 47-23 8-13 7-8 7-5 9-1 4v11l5 10 5 4 8 3h10l11-4 8-6 5-6 1-4v-43z"}),(0,ey.jsx)("path",{d:"m918 450h22l15 3 16 8 12 11 7 8 7 14 3 11v21l-3 12-4 8-5-5-8-17-11-33-7-13-9-10-10-6-7-2h-12l-11 4-8 7-7 10-4 13-1 7v18l3 14 4 10 6 8 9 8 10 4 6 1h9l9-2 7-4 5 1 5 5v2l-10 5-13 3h-22l-15-4-16-8-10-9-6-7-7-14-3-14v-16l3-13 6-12 8-10 12-9 12-5z"}),(0,ey.jsx)("path",{d:"m224 442h17l15 3 10 5 10 9 9 13 14 29 13 28 6 14v2h2l1-5 16-39 17-40 4-8h9l-2 6-18 42-11 26-17 40-9 21-3-1-29-58-10-19-12-23-8-11-9-10-9-7-10-4-5-1h-19l-15 3 4-4 13-6 16-4z"}),(0,ey.jsx)("path",{d:"m1010 450h19l17 4 13 7 12 11 7 11 5 13 2 11v10l-3 16-4 10-9 12-8 7-12 7-13 4-7 1h-25l-16-4-13-7-11-9-7-9-7-14-2-9v-17l3-12 5-10 3-1 7 18 11 33 8 14 8 9 8 5 12 3h8l12-3 10-7 6-8 5-12 2-11v-19l-3-14-5-12-8-10-10-6-7-2h-13l-11 4-6 4-4-2-6-5 3-3 10-5z"}),(0,ey.jsx)("path",{d:"m848 371h1l1 171 2 9 4 6 6 5 19 5 6 2v1h-65l-1-188z"})]})}function erH(e){return()=>new Promise(t=>{e(),window.setTimeout(t,60)})}function erW(e){return"u"<typeof document?null:document.querySelector(e)}function erU(){return null!=erW('[role="menu"]')}function erq(){return null!=erW('[data-tour="init-wizard"]')}function erK(){let e=erW('[data-tour="init-wizard"] [aria-current="step"]'),t=e?.getAttribute("aria-label")?.match(/第\s*(\d+)/);return t?Number(t[1]):0}var erG=e.i(64990);function erX(){let e=su(),[t,n]=ew.useState(!1);ew.useEffect(()=>{try{n("1"===window.localStorage.getItem("vtl:sidebar-collapsed"))}catch{}},[]);let r=ew.useCallback(()=>{n(e=>{let t=!e;try{window.localStorage.setItem("vtl:sidebar-collapsed",t?"1":"0")}catch{}return t})},[]),[a,i]=ew.useState("home"),[o,l]=ew.useState(!1),[s,c]=ew.useState(),[u,d]=ew.useState([]),[f,h]=ew.useState([]),[p,m]=ew.useState("conversation"),[g,v]=ew.useState(0),x=s?.conversation.id,y=s?.conversation.ownerMachineId;ew.useEffect(()=>{d([]),h([]),m("conversation")},[x]),ew.useEffect(()=>{let e;if(!x||"new-agent-conversation"!==a)return void h([]);let t=!1,n=async()=>{let r=await sj(x,y);t||(h(r),e=window.setTimeout(n,!function e(t){return t.some(t=>t.running||e(t.children??[]))}(r)?6e3:2e3))};return n(),()=>{t=!0,e&&window.clearTimeout(e)}},[x,y,a]);let[b,w]=ew.useState(),[j,k]=ew.useState(!1),[S,C]=ew.useState([]),[N,M]=ew.useState([]),[E,O]=ew.useState({}),[P,A]=ew.useState(),[I,z]=ew.useState(dg),[_,D]=ew.useState([]),[R,T]=ew.useState(),[L,$]=ew.useState(),[F,B]=ew.useState(),V=ew.useRef(!1),H=ew.useCallback(e=>{z(t=>iH(e,t))},[]),W=ew.useCallback(e=>{D(t=>iH(e,t))},[]),U=ew.useCallback(async(e,t)=>{try{let n=await sS(e,t);c(n),i("new-agent-conversation")}catch(n){if(n instanceof sh){let r=n.openedBy?.displayName||"另一台设备";window.confirm(`此对话正在「${r}」上打开,无法同时操作。是否强制接管(对方将被踢出)?`)&&(c(await sS(e,t,{force:!0})),i("new-agent-conversation"));return}throw n}},[]),q=ew.useCallback(async(e,t)=>{d([]),await U(e,t)},[U]),K=ew.useCallback(()=>{c(void 0),i("new-agent-conversation")},[]),G=ew.useCallback(async()=>{let e=await sb();e?await U(e.conversation.id,e.conversation.ownerMachineId):K()},[U,K]),X=ew.useCallback(async()=>{V.current=!0,z(dg),D([]),i("new-canvas");try{let e=await ZT({title:"新画布",nodes:dg,edges:[]});$(e.canvas.id),B("local")}catch{$(void 0),B(void 0),V.current=!1}},[]),Y=ew.useCallback(async(e,t)=>{try{await Z$(e,t);let n=await ZR(e,t);V.current=!0,z(n.nodes),D(n.edges),$(n.canvas.id),B(n.canvas.ownerMachineId),i("new-canvas")}catch{}},[]);ew.useEffect(()=>{if(!L)return;if(V.current){V.current=!1;return}let e=window.setTimeout(()=>{ZL(L,{nodes:I,edges:_,nodeIds:I.map(e=>e.id)},F).catch(()=>{})},800);return()=>window.clearTimeout(e)},[I,_,L,F]);let Z=ew.useCallback(({item:t})=>{if(!e||"new-canvas"!==t.id&&"all-canvases"!==t.id&&"open-recent-canvas"!==t.id){if("new-canvas"===t.id)return void X();if("all-canvases"===t.id)return void i("all-canvases");if("new-agent-conversation"===t.id)return void K();if("open-recent-conversation"===t.id)return void G();if("runs"===t.id)return void i("runs");if("telemetry"===t.id)return void i("telemetry");("preferences"===t.id||"preferences-model-routes"===t.id||"preferences-agent-config"===t.id||"preferences-subagent-config"===t.id||"preferences-cc-engine-config"===t.id||"preferences-layout"===t.id||"check-update"===t.id||"account"===t.id)&&i(t.id)}},[X,e,G,K]),{start:J}=(0,erG.useTour)(),Q=ew.useCallback(()=>{var e;J((e={select:e=>Z({item:{id:e}}),startNewConversation:K,goHome:()=>{i("home"),c(void 0)}},{id:"product-tour",steps:[{id:"intro",centered:!0,title:"欢迎使用 Vantaloom 👋",body:(0,ey.jsxs)(ey.Fragment,{children:["这是一份手把手向导,会高亮关键位置并在需要时",(0,ey.jsx)("b",{children:"请你亲自操作"}),"(没做完不会出现「下一步」)。 全程界面都可正常点击;随时按 ",(0,ey.jsx)("kbd",{children:"Esc"})," 或右上角 ✕ 退出。"]})},{id:"theme",before:erH(()=>e.goHome()),target:()=>erW('[role="menu"]')??erW('[data-tour="account-button"]'),gate:erU,gateHint:"点击用户名按钮展开菜单",padding:6,title:"切换主题",body:(0,ey.jsxs)(ey.Fragment,{children:["点击左下角的 ",(0,ey.jsx)("b",{children:"用户名按钮"})," 打开菜单。展开后,里面的 ",(0,ey.jsx)("b",{children:"外观 / 主题"})," 项每点一次就在"," ",(0,ey.jsx)("b",{children:"浅色 → 深色 → 果冻"})," 之间循环。"]})},{id:"model-routes-add",before:erH(()=>e.select("preferences-model-routes")),target:()=>erW('[data-tour="model-route-form"]')??erW('[data-tour="add-model-route"]'),gate:()=>null!=erW('[data-tour="model-route-form"]'),gateHint:"点击「添加模型路由」",title:"配置模型渠道(1/2)",body:(0,ey.jsxs)(ey.Fragment,{children:["进入 ",(0,ey.jsx)("b",{children:"设置 → 模型路由"}),"。请点 ",(0,ey.jsx)("b",{children:"添加模型路由"})," 新增一个第三方渠道(任何 OpenAI / Anthropic 兼容 API 都行)。"]})},{id:"model-routes-fields",before:erH(()=>e.select("preferences-model-routes")),target:'[data-tour="model-route-form"]',waitForTarget:2500,title:"配置模型渠道(2/2)",body:(0,ey.jsxs)(ey.Fragment,{children:["表单各项:",(0,ey.jsx)("b",{children:"提供商名称"})," 仅作标识;",(0,ey.jsx)("b",{children:"协议"})," 选 OpenAI / Anthropic 风格;",(0,ey.jsx)("b",{children:"Endpoint URL"})," 填到 ",(0,ey.jsx)("code",{children:"/v1"})," 这一级;",(0,ey.jsx)("b",{children:"API Key"})," 是密钥;",(0,ey.jsx)("b",{children:"可用模型"})," 勾选启用并可设上下文长度。",(0,ey.jsx)("br",{}),"⚠️ 填完",(0,ey.jsx)("b",{children:"务必点「保存」"}),",否则不生效。"]})},{id:"agent-config-compression",before:erH(()=>e.select("preferences-agent-config")),target:'[data-tour="agent-config-compression"]',title:"代理配置 · 压缩上下文",body:(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("b",{children:"设置 → 代理配置"})," 的第一块:当对话 token 接近模型上下文窗口的设定百分比时,自动用",(0,ey.jsx)("b",{children:"压缩模型"})," 压缩历史。阈值 0% 表示关闭,建议 70%-85%。"]})},{id:"agent-config-summary",before:erH(()=>e.select("preferences-agent-config")),target:'[data-tour="agent-config-summary"]',title:"代理配置 · 对话摘要",body:(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("b",{children:"对话摘要"}),":开启后用",(0,ey.jsx)("b",{children:"摘要模型"}),"自动生成 / 更新对话标题与每轮的轮次标题,方便在侧边栏 与时间轴里快速辨认。"]})},{id:"agent-config-approval",before:erH(()=>e.select("preferences-agent-config")),target:'[data-tour="agent-config-approval"]',title:"代理配置 · 命令审批",body:(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("b",{children:"命令审批"}),":在 Auto 权限模式下,用",(0,ey.jsx)("b",{children:"审批模型"})," + ",(0,ey.jsx)("b",{children:"审批提示词"})," 判断 Agent 发起的命令 是否自动放行。留空则非危险命令全部放行。改完记得 ",(0,ey.jsx)("b",{children:"保存"}),"。"]})},{id:"subagent-explore",before:erH(()=>e.select("preferences-subagent-config")),target:'[data-tour="subagent-explore"]',title:"子代理 · 探索",body:(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("b",{children:"设置 → 子代理配置"}),"。",(0,ey.jsx)("b",{children:"探索"})," 子代理擅长只读检索代码 / 资料。可单独设它的",(0,ey.jsx)("b",{children:"使用模型"}),"(留空则继承上级)与",(0,ey.jsx)("b",{children:"系统提示词"}),"。"]})},{id:"subagent-workflow",before:erH(()=>e.select("preferences-subagent-config")),target:'[data-tour="subagent-workflow"]',title:"子代理 · 工作流",body:(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("b",{children:"工作流"})," 子代理负责多步骤任务编排,同样可单独配模型与提示词。"]})},{id:"subagent-operator",before:erH(()=>e.select("preferences-subagent-config")),target:'[data-tour="subagent-operator"]',title:"子代理 · 操作",body:(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("b",{children:"操作"})," 子代理执行写文件 / 跑命令等动手类任务,工具集固定。"]})},{id:"subagent-custom",before:erH(()=>e.select("preferences-subagent-config")),target:'[data-tour="subagent-custom"]',title:"子代理 · 自定义",body:(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("b",{children:"自定义子代理"}),":主 Agent 可自取名字、从你设的",(0,ey.jsx)("b",{children:"可用模型池"}),"里挑模型来召唤,拥有完整 工具集,还能再派发上面三种官方子代理。"]})},{id:"check-update",before:erH(()=>e.select("check-update")),target:'[data-tour="check-update"]',title:"检查更新",body:(0,ey.jsxs)(ey.Fragment,{children:["这里查看各机器的运行时版本并 ",(0,ey.jsx)("b",{children:"立即更新"}),"。原理:从 npm 拉取最新运行时包、就地替换二进制与 前端,",(0,ey.jsx)("b",{children:"无需重装"}),";P2P mesh 未变时更新还",(0,ey.jsx)("b",{children:"不需要管理员权限"}),"。"]})},{id:"hub-account",before:erH(()=>e.select("account")),target:'[data-tour="hub-account"]',title:"Hub 账户",body:(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("b",{children:"设置 → Hub 账户"}),"。上方是你的",(0,ey.jsx)("b",{children:"账户信息"}),"与",(0,ey.jsx)("b",{children:"设备绑定"}),"状态——Hub 负责多机互联、组网 下发与云端身份。"]})},{id:"hub-account-danger",before:erH(()=>e.select("account")),target:'[data-tour="hub-account-danger"]',title:"Hub 账户 · 危险操作",body:(0,ey.jsxs)(ey.Fragment,{children:["下方的 ",(0,ey.jsx)("b",{children:"危险操作"})," 区可",(0,ey.jsx)("b",{children:"解除设备绑定"}),"或",(0,ey.jsx)("b",{children:"退出登录"}),"。这些操作不可逆,会把本机移出 账户,请谨慎。"]})},{id:"new-conversation",before:erH(()=>e.goHome()),target:'[data-tour="home-new-conversation"]',gate:erq,gateHint:"点击「新建对话」继续",title:"创建新对话",body:(0,ey.jsxs)(ey.Fragment,{children:["回到主页,请点 ",(0,ey.jsx)("b",{children:"新建对话"})," 进入初始化向导(侧边栏顶部也有同样入口)。"]})},{id:"wizard-1",target:'[data-tour="init-wizard"]',placement:"left",padding:4,waitForTarget:5e3,gate:()=>!erq()||erK()>=2,gateHint:"配好运行环境后点向导的「下一步」",title:"向导 ① 运行环境与引擎",body:(0,ey.jsxs)(ey.Fragment,{children:["先选在",(0,ey.jsx)("b",{children:"哪台机器"}),"上运行;本机运行时还能选 ",(0,ey.jsx)("b",{children:"运行引擎"}),"——",(0,ey.jsx)("b",{children:"Vantaloom"})," / ",(0,ey.jsx)("b",{children:"Claude Code"})," / ",(0,ey.jsx)("b",{children:"reclaude"}),"(Claude Code 仅限本机)。 整个向导区域已高亮,配好后点向导自己的 ",(0,ey.jsx)("b",{children:"下一步"}),"。"]})},{id:"wizard-2",target:'[data-tour="init-wizard"]',placement:"left",padding:4,gate:()=>!erq()||erK()>=3,gateHint:"选好工作目录后点向导的「下一步」",title:"向导 ② 选择工作目录",body:(0,ey.jsxs)(ey.Fragment,{children:["先给对话",(0,ey.jsx)("b",{children:"起个名字"}),",再选 ",(0,ey.jsx)("b",{children:"工作目录"}),"——这是智能体能读写的根目录 (Claude Code 用单个目录作为工作根目录)。选好后点向导的「下一步」。"]})},{id:"wizard-3",target:'[data-tour="init-wizard"]',placement:"left",padding:4,gate:()=>!erq()||erK()>=4,gateHint:"配好模型后点向导的「下一步」",title:"向导 ③ 模型设置",body:(0,ey.jsxs)(ey.Fragment,{children:["选择这段对话使用的",(0,ey.jsx)("b",{children:"模型"}),"——",(0,ey.jsx)("b",{children:"Vantaloom"})," 用你刚配置的模型路由,",(0,ey.jsx)("b",{children:"Claude Code"})," 则由其自身提供模型。选好后点向导的「下一步」。"]})},{id:"wizard-4",target:'[data-tour="init-wizard"]',placement:"left",padding:4,gate:()=>!erq(),gateHint:"点向导的「确认开始」创建对话",title:"向导 ④ 确认开始",body:(0,ey.jsxs)(ey.Fragment,{children:["核对无误后,点向导右下角的 ",(0,ey.jsx)("b",{children:"确认开始"})," 创建对话。创建成功后会自动进入对话界面。"]})},{id:"composer-toolbar",target:'[data-slot="agent-input-composer-toolbar"]',waitForTarget:6e3,title:"输入框下方的按钮",body:(0,ey.jsxs)(ey.Fragment,{children:["输入框下面一排:",(0,ey.jsx)("b",{children:"权限模式"}),"(工具调用是否需审批)、",(0,ey.jsx)("b",{children:"模型选择"}),"、右侧 ",(0,ey.jsx)("b",{children:"发送 / 停止"}),"按钮(运行中变停止),以及 ",(0,ey.jsx)("b",{children:"上下文用量"})," 指示。"]})},{id:"queue-stack",target:'[data-slot="agent-input-composer-textarea"]',waitForTarget:3e3,title:"待发送栈(Tab 键)",body:(0,ey.jsxs)(ey.Fragment,{children:["输入内容后按 ",(0,ey.jsx)("kbd",{children:"Tab"})," 可把它压入",(0,ey.jsx)("b",{children:"待发送栈"}),"而不立即发送,便于排队多条指令。栈里每条都能 点击:用 ",(0,ey.jsx)("b",{children:"引导"})," 在合适时机插入对话,或删除。"]})},{id:"pane-toolbar",target:'[data-tour="pane-toolbar"]',waitForTarget:3e3,title:"工作区顶栏",body:(0,ey.jsxs)(ey.Fragment,{children:["右侧工作区最上面一排:左边 ",(0,ey.jsx)("b",{children:"布局标签"})," 切换分屏预设,中间 ",(0,ey.jsx)("b",{children:"位置切换"})," 控制对话面板在左 / 居中 / 在右。"]})},{id:"pane-split",target:'[aria-label="上下二分"]',waitForTarget:4e3,gate:()=>null!=erW('[aria-label="上下二分"][data-state="active"]'),gateHint:"点「上下二分」分栏",title:"动手 · 上下分栏",body:(0,ey.jsxs)(ey.Fragment,{children:["在布局标签里点 ",(0,ey.jsx)("b",{children:"上下二分"}),"(顶部面板图标),把右侧工作区分成上下两块。"]})},{id:"pane-add-top",target:'[data-tour="pane-add"]',waitForTarget:3e3,gate:()=>null!=erW('[placeholder="搜索组件..."]')||null!=erW('[data-slot="multi-tab-list"]'),gateHint:"点上面板的「添加」",autoAdvance:!0,title:"动手 · 添加上面板组件",body:(0,ey.jsxs)(ey.Fragment,{children:["点",(0,ey.jsx)("b",{children:"上面板"}),"中间的 ",(0,ey.jsx)("b",{children:"添加"})," 按钮,打开组件选择面板。"]})},{id:"pane-pick-multitab",target:'[data-tour="pane-template-multi-tab-system"]',waitForTarget:3e3,gate:()=>null!=erW('[data-slot="multi-tab-list"]'),gateHint:"选择「多标签页系统」",title:"动手 · 选多文件标签组件",body:(0,ey.jsxs)(ey.Fragment,{children:["在弹出面板里找到 ",(0,ey.jsx)("b",{children:"多标签页系统"}),"(即多文件标签组件)并点击添加,它会填入上面板。"]})},{id:"multi-tab",target:'[data-slot="multi-tab-list"]',waitForTarget:3e3,title:"多文件标签组件",body:(0,ey.jsxs)(ey.Fragment,{children:["顶部是",(0,ey.jsx)("b",{children:"多文件标签条"}),":点 ",(0,ey.jsx)("b",{children:"+"})," 新增标签、点标签切换文件、",(0,ey.jsx)("b",{children:"×"})," 关闭。单文件内还能在",(0,ey.jsx)("b",{children:"查看 / 编辑"})," 与 ",(0,ey.jsx)("b",{children:"代码 / 预览 / 十六进制"})," 间切换,编辑后记得保存。"]})},{id:"pane-add-bottom",target:'[data-tour="pane-add"]',waitForTarget:3e3,gate:()=>null!=erW('[placeholder="搜索组件..."]')||null!=erW('[data-slot="terminal-tab-group"]'),gateHint:"点下面板的「添加」",autoAdvance:!0,title:"动手 · 添加下面板组件",body:(0,ey.jsxs)(ey.Fragment,{children:["现在点",(0,ey.jsx)("b",{children:"下面板"}),"的 ",(0,ey.jsx)("b",{children:"添加"})," 按钮,再次打开组件选择面板。"]})},{id:"pane-pick-terminal",target:'[data-tour="pane-template-terminal-tab-group"]',waitForTarget:3e3,gate:()=>null!=erW('[data-slot="terminal-tab-group"]'),gateHint:"选择「终端标签组」",title:"动手 · 选终端",body:(0,ey.jsxs)(ey.Fragment,{children:["在面板里找到 ",(0,ey.jsx)("b",{children:"终端标签组"})," 并点击添加,它会填入下面板。"]})},{id:"terminal",target:'[data-slot="terminal-tab-group"]',waitForTarget:3e3,title:"终端组件",body:(0,ey.jsxs)(ey.Fragment,{children:["终端支持多会话标签:点 ",(0,ey.jsx)("b",{children:"+"})," 新开会话、点标签切换、",(0,ey.jsx)("b",{children:"×"})," 关闭。直接输入命令即可,输出实时回显,与本机真实 shell 一致。"]})},{id:"pane-cut-clear",target:'[aria-label="剪切窗口内容"]',waitForTarget:3e3,title:"剪切与粉碎",body:(0,ey.jsxs)(ey.Fragment,{children:["顶栏的 ",(0,ey.jsx)("b",{children:"剪切"}),"(剪刀)把窗口内容移动到别处;",(0,ey.jsx)("b",{children:"粉碎"}),"(碎纸机)清空该窗口。均对单个 pane 生效。"]})},{id:"control-room",target:'[data-tour="control-room-toggle"]',waitForTarget:3e3,title:"导播台视角",body:(0,ey.jsxs)(ey.Fragment,{children:["点位置切换中间的 ",(0,ey.jsx)("b",{children:"「隐藏面板」"}),"(矩形图标)进入",(0,ey.jsx)("b",{children:"导播台"}),":对话偏左,右侧悬浮显示主 Agent 与各子 Agent 的实时预览小窗,点小窗即可切换主面板。"]})},{id:"outro",centered:!0,title:"完成 🎉",body:(0,ey.jsxs)(ey.Fragment,{children:["你已走过核心功能。随时可从空白页的 ",(0,ey.jsx)("b",{children:"使用教程"})," 重新打开本向导。开始创造吧!"]})}]}))},[Z,K,J]),ee=ew.useCallback(()=>{i("account")},[]);return(0,ey.jsxs)("main",{className:"vtl-app-background relative flex h-svh overflow-hidden text-foreground",children:[e?(0,ey.jsx)(etL,{navItems:etB,contents:etV,activeWorkspace:a,activeConversationId:s?.conversation.id,onItemSelect:Z,onOpenConversation:(e,t)=>{q(e,t)},onOpenConversationSettings:(e,t)=>{w({id:e,owner:t})},onConversationDeleted:e=>{s?.conversation.id===e&&(c(void 0),i("home")),w(t=>t?.id===e?void 0:t)},onAccountSettings:ee,subagentTree:f,activeSubagentPath:u,onOpenSubagent:e=>d(e),title:"new-agent-conversation"===a&&s?s.conversation.title?.trim()||"新 Agent 对话":Z3.product,trailing:"new-agent-conversation"===a&&s?(0,ey.jsx)(wF,{view:p,onViewChange:m,paneCount:g}):(0,ey.jsx)(erj,{})}):(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("div",{className:(0,eI.cn)("relative hidden h-svh shrink-0 overflow-hidden p-3 transition-[width,padding] duration-300 ease-out md:block",t?"w-0 p-0":"w-[19.5rem]"),children:(0,ey.jsx)(eeU,{navItems:etB,contents:etV,activeWorkspace:a,activeConversationId:s?.conversation.id,activeCanvasId:L,onItemSelect:Z,onOpenConversation:(e,t)=>{q(e,t)},onOpenCanvas:(e,t)=>{Y(e,t)},onOpenConversationSettings:(e,t)=>{w({id:e,owner:t})},onConversationDeleted:e=>{s?.conversation.id===e&&(c(void 0),i("home")),w(t=>t?.id===e?void 0:t)},onAccountSettings:ee,subagentTree:f,activeSubagentPath:u,onOpenSubagent:e=>d(e)})}),(0,ey.jsx)("div",{className:(0,eI.cn)("group/sb-handle absolute inset-y-0 z-30 hidden w-8 md:block","transition-[left] duration-300 ease-out",t?"left-0":"left-[18.5rem]"),children:(0,ey.jsx)("button",{type:"button",onClick:r,"aria-label":t?"展开侧边栏":"收起侧边栏",title:t?"展开侧边栏":"收起侧边栏",className:"absolute top-1/2 left-0 flex h-14 w-6 -translate-y-1/2 items-center justify-center rounded-r-md border border-l-0 border-border bg-background/85 text-muted-foreground opacity-0 shadow-md backdrop-blur transition-opacity duration-200 hover:text-foreground focus-visible:opacity-100 group-hover/sb-handle:opacity-100",children:t?(0,ey.jsx)(tt,{className:"size-4"}):(0,ey.jsx)(te,{className:"size-4"})})})]}),(0,ey.jsxs)("section",{className:(0,eI.cn)("relative h-full min-w-0 flex-1 overflow-hidden",e&&"pt-[calc(3rem+env(safe-area-inset-top))]"),children:["runs"===a?(0,ey.jsx)(er$,{clipboardItems:S,onClipboardItemsChange:C,onOverlayOpenChange:k}):"telemetry"===a?(0,ey.jsx)(erB,{clipboardItems:S,onClipboardItemsChange:C,onOverlayOpenChange:k}):"preferences-model-routes"===a?(0,ey.jsx)(erm,{section:"model-routes"}):"preferences-agent-config"===a?(0,ey.jsx)(erm,{section:"agent-config"}):"preferences-subagent-config"===a?(0,ey.jsx)(erm,{section:"subagent-config"}):"preferences-cc-engine-config"===a?(0,ey.jsx)(erm,{section:"cc-engine-config"}):"preferences-layout"===a?(0,ey.jsx)(erm,{section:"layout"}):"preferences"===a?(0,ey.jsx)(erm,{}):"check-update"===a?(0,ey.jsx)(ery,{}):"account"===a?(0,ey.jsx)(etK,{}):e||"new-canvas"!==a?e||"all-canvases"!==a?"new-agent-conversation"===a?(0,ey.jsx)(ZE,{conversation:s,clipboardItems:S,clipboardDraggingId:P,onClipboardItemsChange:C,onClipboardDraggingChange:A,onOverlayOpenChange:l,onConversationCreated:e=>{c(e)},onCancelDraft:()=>i("home"),subagentStack:u,onSubagentStackChange:d,subagentTree:f,mobileView:p,onMobilePaneCountChange:v}):e?(0,ey.jsx)(erZ,{activeConversationId:s?.conversation.id,onItemSelect:Z,onOpenConversation:(e,t)=>{q(e,t)},onOpenConversationSettings:(e,t)=>{w({id:e,owner:t})},onConversationDeleted:e=>{w(t=>t?.id===e?void 0:t)}}):(0,ey.jsx)(erY,{onNewConversation:K,onStartTour:Q}):(0,ey.jsx)(eef,{clipboardItems:S,onClipboardItemsChange:C,onOverlayOpenChange:k}):(0,ey.jsx)(eey,{nodes:I,edges:_,selectedNodeId:R,clipboardItems:S,onNodesChange:H,onEdgesChange:W,onNodesSet:z,onEdgesSet:D,onSelectedNodeChange:T,onClipboardItemsChange:C}),b?(0,ey.jsx)("div",{className:(0,eI.cn)("absolute inset-0 z-30",e&&"pt-[calc(3rem+env(safe-area-inset-top))]"),children:(0,ey.jsx)(Zz,{conversationId:b.id,ownerMachineId:b.owner,open:!0,onOpenChange:e=>{e||w(void 0)},onEnterConversation:(e,t)=>{q(e,t)}})}):null,(0,ey.jsx)(eej,{hidden:!!b||("new-agent-conversation"===a?o:j),items:S,trashItems:N,draggingId:P,onDraggingChange:A,onItemsChange:C,onTrashItemsChange:M,onTrashClipboardItemsChange:O,trashClipboardItems:E})]})]})}function erY({onNewConversation:e,onStartTour:t}){return(0,ey.jsxs)("div",{className:"vtl-app-background flex h-full min-h-0 flex-col items-center justify-center gap-5 px-6 text-center",children:[(0,ey.jsx)(erV,{className:"h-20 w-auto max-w-[78vw] text-foreground"}),(0,ey.jsx)("p",{className:"max-w-sm text-sm text-muted-foreground",children:"从左侧选择一个会话,或新建对话"}),(0,ey.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-3",children:[(0,ey.jsxs)(eA.Button,{type:"button",onClick:e,"data-tour":"home-new-conversation",children:[(0,ey.jsx)(e9,{className:"size-4"}),"新建对话"]}),(0,ey.jsxs)(eA.Button,{type:"button",variant:"outline",onClick:t,children:[(0,ey.jsx)(e7,{className:"size-4"}),"使用教程"]})]})]})}function erZ({activeConversationId:e,onItemSelect:t,onOpenConversation:n,onOpenConversationSettings:r,onConversationDeleted:a}){return(0,ey.jsx)("div",{className:"vtl-app-background flex h-full min-h-0 flex-col px-3 pt-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]",children:(0,ey.jsx)(eeY,{activeConversationId:e,onItemSelect:t,onOpenConversation:n,onOpenConversationSettings:r,onConversationDeleted:a})})}function erJ(){let{ready:e,user:t,logout:n}=e8();return e?t?(0,ey.jsx)(erX,{}):(0,ey.jsx)(e4,{onComplete:()=>{window.location.reload()}}):(0,ey.jsx)("main",{className:"grid min-h-svh place-items-center bg-background",children:(0,ey.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,ey.jsx)("div",{className:"size-8 animate-spin rounded-full border-2 border-muted-foreground/20 border-t-primary"}),(0,ey.jsx)("span",{className:"text-sm text-muted-foreground",children:"连接中..."})]})})}function erQ(){return(0,ey.jsx)(e6,{children:(0,ey.jsx)(erJ,{})})}e.s(["default",()=>erQ],66204)}]);
|
|
52
|
+
</style>`,/<\/head>/i.test(t)?t.replace(/<\/head>/i,`${n}</head>`):`${n}${t}`},[r,t]);return(0,ey.jsx)("iframe",{title:e,sandbox:"allow-scripts",srcDoc:a,className:(0,eI.cn)("size-full border-0 bg-background",n)})}function KC({file:e,value:t,labels:n}){let r=ew.useMemo(()=>{let n=e.bytes??(t?new TextEncoder().encode(t):[]),r=Math.min(n.length,4096),a=[];for(let e=0;e<r;e+=16){let t=Array.from({length:Math.min(16,r-e)},(t,r)=>n[e+r]??0);a.push({offset:e.toString(16).padStart(8,"0"),hex:t.map(e=>e.toString(16).padStart(2,"0")).join(" "),ascii:t.map(e=>e>=32&&e<=126?String.fromCharCode(e):".").join("")})}return a},[e.bytes,t]);return 0===r.length?(0,ey.jsx)("div",{className:"ui-text-body grid size-full place-items-center p-6 text-center text-muted-foreground",children:n.noContent}):(0,ey.jsx)("div",{className:"size-full overflow-auto bg-background p-3 ui-text-code",children:(0,ey.jsx)("div",{className:"grid min-w-max grid-cols-[5.5rem_30rem_1fr] gap-x-4",children:r.map(e=>(0,ey.jsxs)(ew.Fragment,{children:[(0,ey.jsx)("span",{className:"text-muted-foreground",children:e.offset}),(0,ey.jsx)("span",{className:"font-mono text-foreground",children:e.hex}),(0,ey.jsx)("span",{className:"font-mono text-muted-foreground",children:e.ascii})]},e.offset))})})}function KN({file:e,labels:t,onApprove:n}){return(0,ey.jsx)("div",{className:"grid size-full place-items-center bg-muted/20 p-6",children:(0,ey.jsxs)("div",{className:"grid max-w-md justify-items-center gap-3 text-center",children:[(0,ey.jsx)("div",{className:"grid size-10 place-items-center rounded-full border bg-background text-muted-foreground",children:(0,ey.jsx)(Ks,{className:"size-4"})}),(0,ey.jsxs)("div",{className:"grid gap-1",children:[(0,ey.jsx)("h3",{className:"ui-text-body font-medium text-foreground",children:t.binaryTitle}),(0,ey.jsx)("p",{className:"ui-text-body text-muted-foreground",children:t.binaryDescription})]}),(0,ey.jsxs)("div",{className:"flex items-center gap-2",children:[Kx(e.size)&&(0,ey.jsx)(FC,{variant:"outline",children:Kx(e.size)}),(0,ey.jsx)(eA.Button,{type:"button",size:"sm",variant:"outline",onClick:n,children:t.renderAnyway})]})]})})}function KM({labels:e}){return(0,ey.jsx)("div",{className:"ui-text-body grid size-full place-items-center p-6 text-center text-muted-foreground",children:e.unsupportedPreview})}function KE({file:e,value:t,labels:n,renderPreview:r,className:a}){let i=Kg(e),o=e.src?e.src:t&&"svg"===Kg(e)?`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`:void 0,l=r?.(e,t);return void 0!==l?(0,ey.jsx)("div",{"data-slot":"file-tab-custom-preview",className:(0,eI.cn)("size-full",a),children:l}):"html"===i||"richtext"===i?(0,ey.jsx)(KS,{title:e.name,value:e.previewContent??t,className:a}):"markdown"===i?(0,ey.jsx)("div",{"data-slot":"file-tab-markdown-preview",className:(0,eI.cn)("size-full overflow-auto bg-background",a),children:(0,ey.jsx)(Kk,{value:t})}):"svg"===i&&o?(0,ey.jsx)("div",{"data-slot":"file-tab-svg-preview",className:(0,eI.cn)("grid size-full place-items-center overflow-auto bg-muted/20 p-6",a),children:(0,ey.jsx)("img",{src:o,alt:e.name,className:"max-h-full max-w-full rounded-lg border bg-background p-4"})}):"image"===i&&o?(0,ey.jsx)("div",{"data-slot":"file-tab-image-preview",className:(0,eI.cn)("grid size-full place-items-center overflow-auto bg-muted/20 p-6",a),children:(0,ey.jsx)("img",{src:o,alt:e.name,className:"max-h-full max-w-full rounded-md"})}):"video"===i&&o?(0,ey.jsx)("div",{"data-slot":"file-tab-video-preview",className:(0,eI.cn)("grid size-full place-items-center bg-muted/20 p-6",a),children:(0,ey.jsx)("video",{src:o,controls:!0,preload:"none",className:"max-h-full max-w-full rounded-md border bg-background"})}):(0,ey.jsx)(KM,{labels:n})}function KO({open:e,labels:t,currentView:n,currentMode:r,saving:a,modified:i,canSwitchView:o,canSwitchMode:l,canSave:s,canOpenHistory:c,onOpenChange:u,onToggleView:d,onToggleMode:f,onSave:h,onHistory:p}){let m=[o?{key:"view",label:"code"===n?t.preview:t.code,onClick:d,icon:"code"===n?(0,ey.jsx)(V9,{className:"size-4"}):(0,ey.jsx)(dn,{className:"size-4"})}:void 0,l?{key:"mode",label:"review"===r?t.edit:t.review,onClick:f,icon:"review"===r?(0,ey.jsx)(Kc,{className:"size-4"}):(0,ey.jsx)(eS,{className:"size-4"})}:void 0,s?{key:"save",label:a?t.saving:t.save,onClick:h,disabled:a||!i,icon:(0,ey.jsx)(Kh,{className:"size-4"})}:void 0,c?{key:"history",label:t.history,onClick:p,icon:(0,ey.jsx)(Ku,{className:"size-4"})}:void 0].filter(e=>void 0!==e);return 0===m.length?null:(0,ey.jsx)("div",{"data-slot":"file-tab-floating-actions",className:"absolute right-3 bottom-3 z-20",children:(0,ey.jsxs)("div",{className:"relative size-8",children:[m.map((t,n)=>(0,ey.jsx)(eA.Button,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.label,disabled:t.disabled,onClick:()=>{t.disabled||t.onClick()},className:(0,eI.cn)("absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur transition-[opacity,transform] duration-150 ease-out",e?"pointer-events-auto opacity-100":"pointer-events-none translate-y-1 opacity-0",t.disabled&&"opacity-45"),style:{transform:e?`translateY(-${(n+1)*42}px)`:void 0},children:t.icon},t.key)),(0,ey.jsx)(eA.Button,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.actions,"aria-expanded":e,onClick:()=>u(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,ey.jsx)(lF,{className:(0,eI.cn)("size-4 transition-transform",e&&"rotate-90")})})]})})}function KP({file:e,value:t,defaultValue:n,onValueChange:r,mode:a,defaultMode:i="review",onModeChange:o,view:l,defaultView:s="code",onViewChange:c,modified:u=!1,onSave:d,onSaveError:f,largeBinaryThreshold:h=2097152,showHeader:p=!0,wrapLines:m=!1,renderPreview:g,onHistory:v,labels:x,className:y,editorClassName:b,previewClassName:w,headerClassName:j,...k}){var S;let C,N,M=ew.useMemo(()=>({...Kp,...x}),[x]),[E,O]=ew.useState(n??e.content??""),[P,A]=ew.useState(i),[I,z]=ew.useState(s),[_,D]=ew.useState(!1),[R,T]=ew.useState(!1),[L,$]=ew.useState(!1),F=ew.useRef(null),B=t??E,V=a??P,H=(S=l??I,(C=Ky(e)).includes(S)?S:C[0]),W=Kg(e),U=Ky(e).length>1,q=!e.readOnly&&["text","code","html","markdown","richtext","svg"].includes(Kg(e)),K=!!d&&q&&"code"===H&&(u||L),G="review"===V||!0===e.readOnly,X="binary"===(N=Kg(e))||"image"!==N&&"video"!==N&&!!(e.size&&e.size>h&&!e.content),Y=(e.path??e.name).split(/[\\/]+/).filter(Boolean),Z=Kx(e.size??B.length);async function J(){if(d&&!L){$(!0);try{await d(B),T(!1)}catch(e){f?.(e)}finally{$(!1)}}}return ew.useEffect(()=>{void 0===t&&O(n??e.content??""),D(!1),T(!1)},[n,e,t]),ew.useEffect(()=>{if(R)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Node&&F.current?.contains(t)||T(!1)}},[R]),(0,ey.jsxs)("div",{ref:F,"data-slot":"file-tab-viewer","data-mode":V,"data-view":H,className:(0,eI.cn)("vtl-surface-panel relative grid min-h-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",p?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",y),...k,children:[p&&(0,ey.jsxs)("div",{"data-slot":"file-tab-viewer-header",className:(0,eI.cn)("flex min-w-0 items-center gap-2 border-b bg-muted/35 px-3 py-2",j),children:[(0,ey.jsx)("span",{className:"grid size-5 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:"image"===W?(0,ey.jsx)(Kd,{className:"size-3.5"}):"video"===W?(0,ey.jsx)(Kf,{className:"size-3.5"}):"binary"===W?(0,ey.jsx)(Ks,{className:"size-3.5"}):(0,ey.jsx)(xp,{className:"size-3.5"})}),(0,ey.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 ui-text-kbd",children:Y.map((e,t)=>(0,ey.jsxs)(ew.Fragment,{children:[t>0&&(0,ey.jsx)("span",{className:"text-muted-foreground",children:M.pathSeparator}),(0,ey.jsx)("span",{className:(0,eI.cn)("truncate",t===Y.length-1?"font-medium text-foreground":"text-muted-foreground"),children:e})]},`${e}-${t}`))}),(0,ey.jsxs)("div",{className:"hidden shrink-0 items-center gap-1.5 sm:flex",children:[Z&&(0,ey.jsx)(FC,{variant:"outline",children:Z}),q&&"code"===H&&(G?(0,ey.jsxs)(FC,{variant:"secondary",children:[(0,ey.jsx)(lT,{className:"size-3"}),M.review]}):(0,ey.jsxs)(FC,{variant:"outline",children:[(0,ey.jsx)(Kc,{className:"size-3"}),M.edit]}))]})]}),(0,ey.jsx)("div",{"data-slot":"file-tab-viewer-body",className:"min-h-0 overflow-hidden",children:X&&!_?(0,ey.jsx)(KN,{file:e,labels:M,onApprove:()=>D(!0)}):"preview"===H?(0,ey.jsx)(KE,{file:e,value:B,labels:M,renderPreview:g,className:w}):"hex"===H?(0,ey.jsx)(KC,{file:e,value:B,labels:M}):(0,ey.jsx)(Kj,{file:e,value:B,readOnly:G,onValueChange:function(e){void 0===t&&O(e),r?.(e)},wrapLines:m,className:b})}),(0,ey.jsx)(KO,{open:R,labels:M,currentView:H,currentMode:V,saving:L,modified:u,canSwitchView:U,canSwitchMode:q&&"code"===H,canSave:K,canOpenHistory:!!(v&&e.path),onOpenChange:T,onToggleView:function(){var e;e="code"===H?"preview":"code",void 0===l&&z(e),c?.(e)},onToggleMode:function(){var e;e="review"===V?"edit":"review",void 0===a&&A(e),o?.(e)},onSave:J,onHistory:()=>{T(!1),v?.(e)}})]})}function KA(e,t){return e[Math.max(0,t-1)]?.id??e[0]?.id}function KI(e){return"string"==typeof e||"number"==typeof e?String(e):void 0}function Kz(e,t,n){let r=[...e],a=r[t],i=r[n];return a&&i&&(r[t]=i,r[n]=a),r}function K_({tabs:e,defaultTabs:t=[],activeTabId:n,defaultActiveTabId:r,onActiveTabChange:a,onTabsChange:i,onCreateTab:o,onCloseTab:l,onTabReorder:s,onTabDetach:c,onExternalTabDrop:u,createActions:d=[],tabActions:f=[],reorderable:h=!0,detachable:p=!1,externalDropTypes:m=[],createLabel:g="New tab",moreLabel:v="More tab actions",closeLabel:x="Close tab",scrollLeftLabel:y="Scroll tabs left",scrollRightLabel:b="Scroll tabs right",tabListLabel:w="Open tabs",emptyContent:j,renderContent:k,showContent:S=!0,className:C,tabListClassName:N,contentClassName:M}){let[E,O]=ew.useState(t),P=ew.useRef(null),A=ew.useRef(null),[I,z]=ew.useState(),[_,D]=ew.useState(void 0),R=ew.useRef(void 0),[T,L]=ew.useState(void 0),[$,F]=ew.useState(!1),B=ew.useRef(void 0),V=ew.useRef(void 0),H=ew.useRef(!1),[W,U]=ew.useState(!1),[q,K]=ew.useState(!1),[G,X]=ew.useState(),Y=e??E,Z=Y.find(e=>!e.disabled),[J,Q]=ew.useState(r??Z?.id),ee=n??J,et=Y.find(e=>e.id===ee&&!e.disabled)??Z;ew.useEffect(()=>{!et&&Z&&void 0===n&&Q(Z.id)},[et,n,Z]);let en=ew.useCallback(t=>{void 0===e&&O(t),i?.(t)},[i,e]),er=ew.useCallback(e=>{R.current=e,D(e)},[]),ea=ew.useCallback(()=>{let e=A.current,t=new Map;if(!e)return t;for(let n of e.querySelectorAll("[data-tab-id]")){let e=n.getBoundingClientRect(),r=n.dataset.tabId;r&&t.set(r,{left:e.left,top:e.top})}return t},[]),ei=ew.useCallback((e,t=!0)=>{t&&(V.current=ea()),B.current=e,L(e)},[ea]),eo=ew.useCallback(()=>{let e=A.current;if(!e){U(!1),K(!1);return}let t=e.scrollWidth-e.clientWidth;U(e.scrollLeft>1),K(e.scrollLeft<t-1)},[]);function el(e){let t=A.current;if(!t)return;let n=Math.max(.7*t.clientWidth,160);t.scrollLeft+="left"===e?-n:n,window.requestAnimationFrame(eo)}ew.useEffect(()=>{F(!0)},[]),ew.useEffect(()=>{eo();let e=A.current;if(!e)return;let t=new ResizeObserver(eo);return t.observe(e),window.addEventListener("resize",eo),()=>{t.disconnect(),window.removeEventListener("resize",eo)}},[Y.length,eo]),ew.useLayoutEffect(()=>{let e=V.current,t=A.current;if(e&&t)for(let n of(V.current=void 0,t.querySelectorAll("[data-tab-id]"))){let t=n.dataset.tabId;if(!t)continue;let r=e.get(t);if(!r)continue;let a=n.getBoundingClientRect(),i=r.left-a.left,o=r.top-a.top;1>Math.abs(i)&&1>Math.abs(o)||n.animate([{transform:`translate(${i}px, ${o}px)`},{transform:"translate(0, 0)"}],{duration:150,easing:"cubic-bezier(0.2, 0, 0, 1)"})}},[T]);let es=ew.useCallback(e=>{let t=A.current;if(t)return Array.from(t.querySelectorAll("[data-tab-id]")).find(t=>t.dataset.tabId===e)},[]),ec=ew.useCallback((e,t)=>{let n=B.current??Y,r=n.findIndex(t=>t.id===e.tabId);if(-1===r)return;let a=t-e.offsetX,i=a+e.width,o=t>=e.currentX,l=n[r+1],s=n[r-1];if(o&&l&&!l.disabled){let e=es(l.id),t=e?.getBoundingClientRect();t&&i>=t.left+.7*t.width&&ei(Kz(n,r,r+1));return}if(!o&&s&&!s.disabled){let e=es(s.id),t=e?.getBoundingClientRect();t&&a<=t.right-.7*t.width&&ei(Kz(n,r,r-1))}},[es,Y,ei]);function eu(e){if(!u||0===m.length)return!1;let t=Array.from(e.dataTransfer.types);return m.some(e=>t.includes(e))}function ed(e){let t=A.current;if(!t)return{index:Y.length,left:0};let n=t.getBoundingClientRect(),r=Array.from(t.querySelectorAll("[data-tab-id]"));if(0===r.length)return{index:0,left:t.scrollLeft+8};for(let[a,i]of r.entries()){let r=i.getBoundingClientRect();if(e.clientX<r.left+r.width/2)return{index:a,left:r.left-n.left+t.scrollLeft}}let a=r[r.length-1].getBoundingClientRect();return{index:r.length,left:a.right-n.left+t.scrollLeft}}ew.useEffect(()=>{if(_)return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t,{once:!0}),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t)};function e(e){let t=R.current;if(!t)return;let n=e.clientX-t.startX,r=e.clientY-t.startY,a=t.dragging||Math.abs(n)>4||Math.abs(r)>4;a&&(e.preventDefault(),ec(t,e.clientX)),er({...t,currentX:e.clientX,currentY:e.clientY,dragging:a})}function t(e){let t=R.current;if(t?.dragging){e.preventDefault(),H.current=!0;let r=Y.find(e=>e.id===t.tabId),i=P.current?.getBoundingClientRect(),o=!!i&&(e.clientX<i.left||e.clientX>i.right||e.clientY<i.top||e.clientY>i.bottom);if(p&&c&&r&&o&&function(e,t){if(e.pinned)return!1;let r=Y.findIndex(t=>t.id===e.id);if(c?.(e,{tabs:Y,clientX:t.clientX,clientY:t.clientY,nativeEvent:t})===!1)return!1;let i=Y.filter(t=>t.id!==e.id);if(en(i),e.id===ee){let e=KA(i,r);void 0===n&&Q(e),e&&a?.(e)}return!0}(r,e)){z(void 0),er(void 0),ei(void 0,!1);return}let l=B.current;l&&!(l.length===Y.length&&l.every((e,t)=>e.id===Y[t]?.id))&&(en(l),s?.(l))}z(void 0),er(void 0),ei(void 0,!1)}});let ef=et&&(k?.(et)??et.content??(0,ey.jsx)("div",{className:"grid min-h-44 place-items-center bg-muted/30 p-6 text-center text-muted-foreground",children:et.title})),eh=_?.dragging&&T?T:Y,ep=_?.dragging?Y.find(e=>e.id===_.tabId):void 0,em=_?.dragging&&ep&&$?(0,is.createPortal)((0,ey.jsxs)("div",{"data-slot":"multi-tab-drag-preview","aria-hidden":"true",className:"pointer-events-none fixed z-[100] flex h-9 min-w-0 items-center gap-1 rounded-t-lg border border-border bg-background px-2.5 text-foreground shadow-lg",style:{left:_.currentX-_.offsetX,top:_.top,width:_.width},children:[ep.icon&&(0,ey.jsx)("span",{className:"grid size-4 shrink-0 place-items-center text-muted-foreground [&_svg]:size-3.5",children:ep.icon}),(0,ey.jsx)("span",{className:"truncate ui-text-control font-medium",children:ep.title}),ep.modified&&(0,ey.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-foreground/70"})]}),document.body):null;return(0,ey.jsxs)("div",{ref:P,"data-slot":"multi-tab-system",className:(0,eI.cn)("vtl-surface-panel grid min-h-0 grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-[var(--surface-panel-radius)] border",C),children:[(0,ey.jsxs)("div",{className:"relative flex min-w-0 shrink-0 items-end gap-1 border-b bg-muted/35 px-1.5 pt-1.5",children:[W&&(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":y,onClick:()=>el("left"),className:"mb-1 shrink-0",children:(0,ey.jsx)(pS,{})}),(0,ey.jsxs)("div",{ref:A,role:"tablist","aria-label":w,"data-slot":"multi-tab-list",className:(0,eI.cn)("relative flex min-w-0 flex-1 items-end overflow-x-auto [scrollbar-width:none] data-[overflow=both]:[mask-image:linear-gradient(90deg,transparent,black_24px,black_calc(100%-24px),transparent)] data-[overflow=left]:[mask-image:linear-gradient(90deg,transparent,black_24px)] data-[overflow=right]:[mask-image:linear-gradient(90deg,black_calc(100%-24px),transparent)] [&::-webkit-scrollbar]:hidden",N),"data-overflow":W&&q?"both":W?"left":q?"right":void 0,onScroll:eo,onDragOver:function(e){eu(e)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move",X(ed(e)))},onDragLeave:function(e){if(!eu(e))return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||X(void 0)},onDrop:function(e){if(!eu(e))return;e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move";let t=ed(e);X(void 0),u?.({tabs:Y,insertIndex:t.index,nativeEvent:e})},children:[eh.map((e,t)=>{let r=e.id===et?.id,i=eh[t+1],o=_?.dragging&&I===e.id,s=!r&&!o&&void 0!==i&&i.id!==et?.id&&i.id!==I;return(0,ey.jsxs)(ew.Fragment,{children:[(0,ey.jsxs)("div",{onPointerDown:t=>(function(e,t){if(!h||e.disabled||0!==t.button)return;let n=t.currentTarget.getBoundingClientRect();z(e.id),ei(Y,!1),er({tabId:e.id,startX:t.clientX,startY:t.clientY,offsetX:t.clientX-n.left,top:n.top,width:n.width,currentX:t.clientX,currentY:t.clientY,dragging:!1})})(e,t),"data-slot":"multi-tab","data-tab-id":e.id,"data-state":r?"active":"inactive","data-dragging":I===e.id?"true":void 0,"data-modified":e.modified?"true":void 0,className:(0,eI.cn)("group/tab relative flex h-9 min-w-0 max-w-52 shrink-0 items-center gap-1 rounded-t-lg border border-b-0 px-2.5 transition-[border-color,background-color,color,box-shadow,outline-color] duration-150 ease-out",h&&!e.disabled&&"cursor-grab active:cursor-grabbing",r?"border-border bg-background text-foreground shadow-[0_-1px_0_var(--background)_inset]":"border-transparent bg-transparent text-muted-foreground hover:bg-background/70 hover:text-foreground",o&&"border-dashed border-border bg-muted/45 text-transparent shadow-none outline outline-1 outline-ring/30 [&_*]:opacity-0",e.disabled&&"pointer-events-none opacity-50"),children:[(0,ey.jsx)("button",{type:"button",role:"tab","aria-label":KI(e.title),"aria-selected":r,disabled:e.disabled,onClick:t=>{var r;let i;if(H.current){H.current=!1,t.preventDefault();return}r=e.id,(i=Y.find(e=>e.id===r))&&!i.disabled&&(void 0===n&&Q(r),a?.(r))},className:"absolute inset-0 rounded-t-lg outline-none focus-visible:ring-2 focus-visible:ring-ring/50"}),(0,ey.jsxs)("div",{"aria-hidden":"true",className:"pointer-events-none relative z-10 flex min-w-0 flex-1 items-center gap-1.5",children:[e.icon&&(0,ey.jsx)("span",{className:"grid size-4 shrink-0 place-items-center text-muted-foreground [&_svg]:size-3.5",children:e.icon}),(0,ey.jsx)("span",{className:"truncate ui-text-control font-medium",children:e.title}),e.meta&&(0,ey.jsx)("span",{className:"shrink-0 ui-text-kbd text-muted-foreground",children:e.meta}),e.modified&&(0,ey.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-foreground/70"})]}),!e.pinned&&(0,ey.jsx)("button",{type:"button",draggable:!1,onPointerDown:e=>e.stopPropagation(),"aria-label":e.closeLabel??(KI(e.title)?`${x}: ${KI(e.title)}`:x),onClick:()=>(function(e){if(e.pinned)return;let t=Y.findIndex(t=>t.id===e.id),r=Y.filter(t=>t.id!==e.id);if(en(r),l?.(e),e.id===ee){let e=KA(r,t);void 0===n&&Q(e),e&&a?.(e)}})(e),className:(0,eI.cn)("relative z-20 grid size-5 shrink-0 place-items-center rounded-md text-muted-foreground opacity-0 transition-all hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none group-hover/tab:opacity-100",r&&"opacity-100"),children:(0,ey.jsx)(d3.XIcon,{className:"size-3.5"})})]}),s&&(0,ey.jsx)("span",{"aria-hidden":"true",className:"mb-2 h-4 w-px shrink-0 bg-border/80"})]},e.id)}),G?(0,ey.jsxs)("span",{"data-slot":"multi-tab-external-insert","aria-hidden":"true",className:"pointer-events-none absolute top-2 bottom-1 z-30 flex w-0 -translate-x-1/2 items-center justify-center",style:{left:G.left},children:[(0,ey.jsx)("span",{className:"h-full w-px rounded-full bg-foreground/80"}),(0,ey.jsx)("span",{className:"absolute top-0 size-1.5 rounded-full bg-foreground"})]}):null]}),(0,ey.jsxs)("div",{className:"mb-1 flex shrink-0 items-center gap-1",children:[q&&(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":b,onClick:()=>el("right"),children:(0,ey.jsx)(pC,{})}),d.length>0?(0,ey.jsxs)(y2,{children:[(0,ey.jsx)(y4,{asChild:!0,children:(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":g,children:(0,ey.jsx)(lV,{})})}),(0,ey.jsx)(bl,{align:"end",className:"w-52",children:d.map((e,t)=>(0,ey.jsxs)(ew.Fragment,{children:[e.separatorBefore&&(0,ey.jsx)(bd,{}),(0,ey.jsxs)(bs,{disabled:e.disabled,onSelect:e.onSelect,children:[e.icon,e.label,e.shortcut&&(0,ey.jsx)(bf,{children:e.shortcut})]})]},t))})]}):(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":g,onClick:function(){let e=o?.();e&&(en([...Y,e]),e.disabled||(void 0===n&&Q(e.id),a?.(e.id)))},children:(0,ey.jsx)(lV,{})}),f.length>0&&(0,ey.jsxs)(y2,{children:[(0,ey.jsx)(y4,{asChild:!0,children:(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":v,children:(0,ey.jsx)(lF,{})})}),(0,ey.jsx)(bl,{align:"end",className:"w-52",children:f.map((e,t)=>(0,ey.jsxs)(ew.Fragment,{children:[e.separatorBefore&&(0,ey.jsx)(bd,{}),(0,ey.jsxs)(bs,{disabled:e.disabled,onSelect:e.onSelect,children:[e.icon,e.label,e.shortcut&&(0,ey.jsx)(bf,{children:e.shortcut})]})]},t))})]})]})]}),em,S&&(0,ey.jsx)("div",{"data-slot":"multi-tab-content",className:(0,eI.cn)("min-h-0 overflow-hidden",M),children:ef??j??(0,ey.jsx)("div",{"aria-hidden":"true",className:"min-h-44 rounded-lg border border-dashed bg-muted/30"})})]})}let KD="application/vnd.vantaloom.canvas-node",KR="application/vnd.vantaloom.canvas-tab",KT="application/vnd.vantaloom.dashboard-widget",KL="application/vnd.vantaloom.workspace-card",K$=[{policyNumber:3,name:"Allow HTTP Traffic",sourceZone:"Trust",sourceIPs:["192.168.1.0/24","10.0.0.0/8"],destinationZone:"Trust",destinationIPs:["192.168.2.0/24"],tags:["Web Access","Internal"],action:"allow",description:"Permits HTTP traffic from internal network"},{policyNumber:5,name:"Block Suspicious IPs",sourceZone:"Untrust",sourceIPs:["203.0.113.0/24","198.51.100.0/24"],destinationZone:"Trust",destinationIPs:["Any"],tags:["Blocking","Security"],action:"deny",description:"Blocks known malicious IP ranges"},{policyNumber:9,name:"SSH Access Control",sourceZone:"Trust",sourceIPs:["172.16.0.0/12"],destinationZone:"Trust",destinationIPs:["10.50.0.0/16"],tags:["Admin Access","VPN"],action:"allow",description:"Restricted SSH access for admin network"},{policyNumber:12,name:"Database Port Protection",sourceZone:"Untrust",sourceIPs:["0.0.0.0/0"],destinationZone:"Trust",destinationIPs:["10.100.0.0/24"],tags:["Blocking","Database"],action:"deny",description:"Blocks external access to database ports"},{policyNumber:15,name:"API Gateway Access",sourceZone:"Trust",sourceIPs:["192.168.100.0/24","192.168.101.0/24"],destinationZone:"Trust",destinationIPs:["10.200.0.5"],tags:["API","VDI Env"],action:"allow",description:"Allows traffic to API gateway from specific subnets"},{policyNumber:18,name:"Drop Legacy SMB",sourceZone:"Trust",sourceIPs:["Any"],destinationZone:"Trust",destinationIPs:["10.20.0.0/16"],tags:["Legacy","Internal"],action:"drop",description:"Drops SMBv1 probes across workstation networks"},{policyNumber:22,name:"Agent Runtime Mesh",sourceZone:"Trust",sourceIPs:["10.10.4.0/24"],destinationZone:"Trust",destinationIPs:["10.10.8.0/24","10.10.12.0/24"],tags:["Agent","Runtime"],action:"allow",description:"Allows managed agent runtime channels between worker pools"},{policyNumber:27,name:"Block Public Admin Ports",sourceZone:"Untrust",sourceIPs:["0.0.0.0/0"],destinationZone:"Trust",destinationIPs:["Any"],tags:["Blocking","Admin Access"],action:"deny",description:"Denies public access to SSH, RDP, and database admin ports"},{policyNumber:31,name:"Build Cache Access",sourceZone:"Trust",sourceIPs:["10.30.0.0/16"],destinationZone:"Trust",destinationIPs:["10.60.12.20"],tags:["Build","Internal"],action:"allow",description:"Allows build workers to reach shared cache storage"},{policyNumber:36,name:"Relay Egress",sourceZone:"Trust",sourceIPs:["10.40.0.0/16"],destinationZone:"Untrust",destinationIPs:["198.18.0.0/15"],tags:["Relay","Agent"],action:"allow",description:"Permits relay service egress to managed edge addresses"},{policyNumber:41,name:"Quarantine Subnet",sourceZone:"Quarantine",sourceIPs:["10.250.0.0/24"],destinationZone:"Trust",destinationIPs:["Any"],tags:["Security","Blocking"],action:"deny",description:"Blocks quarantined hosts from internal services"},{policyNumber:48,name:"Observability Intake",sourceZone:"Trust",sourceIPs:["10.0.0.0/8"],destinationZone:"Trust",destinationIPs:["10.80.4.10"],tags:["Telemetry","Internal"],action:"allow",description:"Allows metrics and logs to the observability intake"}],KF=Array.from(new Set(K$.flatMap(e=>e.tags))).sort(),KB=[["10.10.4.0/24","Agent workers","Trust","18"],["10.20.0.0/16","Workstations","Trust","41"],["10.250.0.0/24","Quarantine","Quarantine","03"],["198.18.0.0/15","Relay edge","Untrust","12"]],KV=[["Database Port Protection","2026-06-12","Security"],["Relay Egress","2026-06-28","Network"],["Build Cache Access","2026-07-04","Build"],["Observability Intake","2026-07-18","Ops"]];function KH({className:e,...t}){return(0,ey.jsx)("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:(0,eI.cn)("mx-auto flex w-full justify-center",e),...t})}function KW({className:e,...t}){return(0,ey.jsx)("ul",{"data-slot":"pagination-content",className:(0,eI.cn)("flex flex-row items-center gap-1",e),...t})}function KU({...e}){return(0,ey.jsx)("li",{"data-slot":"pagination-item",...e})}function Kq({className:e,isActive:t,size:n="icon",...r}){return(0,ey.jsx)("a",{"aria-current":t?"page":void 0,"data-slot":"pagination-link","data-active":t,className:(0,eI.cn)((0,eA.buttonVariants)({variant:t?"outline":"ghost",size:n}),e),...r})}function KK({className:e,previousLabel:t="Previous",...n}){return(0,ey.jsxs)(Kq,{"aria-label":t,size:"default",className:(0,eI.cn)("gap-1 px-2.5 sm:pl-2",e),...n,children:[(0,ey.jsx)(pS,{}),(0,ey.jsx)("span",{className:"hidden sm:block",children:t})]})}function KG({className:e,nextLabel:t="Next",...n}){return(0,ey.jsxs)(Kq,{"aria-label":t,size:"default",className:(0,eI.cn)("gap-1 px-2.5 sm:pr-2",e),...n,children:[(0,ey.jsx)("span",{className:"hidden sm:block",children:t}),(0,ey.jsx)(pC,{})]})}function KX({className:e,moreLabel:t="More pages",...n}){return(0,ey.jsxs)("span",{"aria-hidden":!0,"data-slot":"pagination-ellipsis",className:(0,eI.cn)("flex size-8 items-center justify-center",e),...n,children:[(0,ey.jsx)(lF,{className:"size-4"}),(0,ey.jsx)("span",{className:"sr-only",children:t})]})}function KY({title:e}){return(0,ey.jsx)("h2",{className:"h-7 text-sm font-semibold tracking-normal",children:e})}function KZ(){let[e,t]=ew.useState(""),[n,r]=ew.useState("all"),[a,i]=ew.useState({allow:!1,drop:!1,deny:!1}),[o,l]=ew.useState(1),s=ew.useMemo(()=>["allow","drop","deny"].filter(e=>a[e]),[a]),c=ew.useMemo(()=>[{id:"policyNumber",header:"策略 #",accessorKey:"policyNumber",align:"right",width:84},{id:"name",header:"名称",accessorKey:"name",width:180,className:"font-medium"},{id:"sourceZone",header:"源区域",accessorKey:"sourceZone",width:112,cell:({row:e})=>(0,ey.jsx)(K0,{zone:e.sourceZone})},{id:"sourceIPs",header:"源 IP",accessorKey:"sourceIPs",width:250,cell:({row:e})=>(0,ey.jsx)(KQ,{items:e.sourceIPs,variant:"outline"}),copyValue:({row:e})=>e.sourceIPs.join(", ")},{id:"destinationZone",header:"目标区域",accessorKey:"destinationZone",width:112,cell:({row:e})=>(0,ey.jsx)(K0,{zone:e.destinationZone})},{id:"destinationIPs",header:"目标 IP",accessorKey:"destinationIPs",width:250,cell:({row:e})=>(0,ey.jsx)(KQ,{items:e.destinationIPs,variant:"outline"}),copyValue:({row:e})=>e.destinationIPs.join(", ")},{id:"tags",header:"标签",accessorKey:"tags",width:220,cell:({row:e})=>(0,ey.jsx)(KQ,{items:e.tags,variant:"secondary"}),copyValue:({row:e})=>e.tags.join(", ")},{id:"action",header:"动作",accessorKey:"action",width:96,cell:({row:e})=>(0,ey.jsx)(K1,{action:e.action})}],[]),u=ew.useMemo(()=>{let t=e.trim().toLowerCase();return K$.filter(e=>{let r=0===t.length||e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.sourceIPs.some(e=>e.toLowerCase().includes(t))||e.destinationIPs.some(e=>e.toLowerCase().includes(t)),i="all"===n||e.tags.includes(n),o=!(a.allow||a.drop||a.deny)||a.allow&&"allow"===e.action||a.drop&&"drop"===e.action||a.deny&&"deny"===e.action;return r&&i&&o})},[a,e,n]),d=Math.max(1,Math.ceil(u.length/8)),f=Math.min(o,d),h=u.slice((f-1)*8,8*f);return ew.useEffect(()=>{l(1)},[a,e,n]),(0,ey.jsxs)("div",{className:"flex h-full min-h-0 flex-col p-3",children:[(0,ey.jsxs)("div",{className:"mb-3 flex shrink-0 items-center justify-between gap-3",children:[(0,ey.jsx)(KY,{title:"防火墙策略"}),(0,ey.jsxs)(eA.Button,{size:"sm",children:[(0,ey.jsx)(lV,{className:"size-4"}),"新增策略"]})]}),(0,ey.jsxs)("div",{className:"mb-3 grid shrink-0 grid-cols-1 items-end gap-3 sm:grid-cols-[minmax(12rem,1fr)_10rem_auto]",children:[(0,ey.jsxs)("label",{className:"grid gap-1",children:[(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"搜索"}),(0,ey.jsxs)("span",{className:"relative",children:[(0,ey.jsx)(vN,{className:"pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground"}),(0,ey.jsx)(ez,{value:e,onChange:e=>t(e.target.value),placeholder:"搜索策略...",className:"pl-8"})]})]}),(0,ey.jsxs)("label",{className:"grid gap-1",children:[(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"标签"}),(0,ey.jsxs)(go,{value:n,onValueChange:r,children:[(0,ey.jsx)(gX,{className:"w-full",children:(0,ey.jsx)(gu,{placeholder:"全部标签"})}),(0,ey.jsxs)(gJ,{children:[(0,ey.jsx)(gQ,{value:"all",children:"全部标签"}),KF.map(e=>(0,ey.jsx)(gQ,{value:e,children:e},e))]})]})]}),(0,ey.jsxs)("div",{className:"grid gap-1",children:[(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"动作"}),(0,ey.jsxs)(pb,{type:"multiple",variant:"outline",value:s,onValueChange:function(e){e.includes("clear")?(t(""),r("all"),i({allow:!1,drop:!1,deny:!1}),l(1)):i({allow:e.includes("allow"),drop:e.includes("drop"),deny:e.includes("deny")})},children:[(0,ey.jsx)(pw,{value:"allow",children:"允许"}),(0,ey.jsx)(pw,{value:"drop",children:"丢弃"}),(0,ey.jsx)(pw,{value:"deny",children:"拒绝"}),(0,ey.jsx)(pw,{value:"clear",children:"全部"})]})]})]}),(0,ey.jsx)(WS,{rows:h,columns:c,rowId:"policyNumber",showHeader:!1,showToolbar:!1,rowHeight:40,className:"min-h-0 flex-1 rounded-lg shadow-none",labels:{noRows:"没有匹配的策略。",selectAllRows:"选择当前页策略",selectRow:e=>`选择第 ${e+1} 条策略`,resizeColumn:"调整列宽",sortAsc:"升序",sortDesc:"降序",sortClear:"取消排序",copyCell:"复制单元格",copied:"已复制"}}),(0,ey.jsx)(KJ,{page:f,totalPages:d,onPageChange:function(e){l(Math.min(d,Math.max(1,e)))}})]})}function KJ({page:e,totalPages:t,onPageChange:n}){let r=ew.useMemo(()=>t<=3?Array.from({length:t},(e,t)=>t+1):e<=2?[1,2,3]:e>=t-1?[t-2,t-1,t]:[e-1,e,e+1],[e,t]),a=r[0]??1,i=r[r.length-1]??t;function o(e,t){e.preventDefault(),n(t)}return(0,ey.jsx)(KH,{className:"mt-3 shrink-0",children:(0,ey.jsxs)(KW,{className:"gap-1 sm:gap-2",children:[(0,ey.jsx)(KU,{children:(0,ey.jsx)(KK,{href:"#",previousLabel:"上一页","aria-disabled":1===e,className:(0,eI.cn)(1===e&&"pointer-events-none opacity-40"),onClick:t=>o(t,e-1)})}),a>1?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(KU,{children:(0,ey.jsx)(Kq,{href:"#",size:"icon",onClick:e=>o(e,1),children:"1"})}),a>2?(0,ey.jsx)(KU,{children:(0,ey.jsx)(KX,{moreLabel:"更多页"})}):null]}):null,r.map(t=>(0,ey.jsx)(KU,{children:(0,ey.jsx)(Kq,{href:"#",size:"icon",isActive:e===t,onClick:e=>o(e,t),children:t})},t)),i<t?(0,ey.jsxs)(ey.Fragment,{children:[i<t-1?(0,ey.jsx)(KU,{children:(0,ey.jsx)(KX,{moreLabel:"更多页"})}):null,(0,ey.jsx)(KU,{children:(0,ey.jsx)(Kq,{href:"#",size:"icon",onClick:e=>o(e,t),children:t})})]}):null,(0,ey.jsx)(KU,{children:(0,ey.jsx)(KG,{href:"#",nextLabel:"下一页","aria-disabled":e===t,className:(0,eI.cn)(e===t&&"pointer-events-none opacity-40"),onClick:t=>o(t,e+1)})})]})})}function KQ({items:e,variant:t}){return(0,ey.jsx)("div",{className:"flex min-w-48 flex-wrap gap-1",children:e.map(e=>(0,ey.jsx)(FC,{variant:t,children:e},e))})}function K0({zone:e}){return(0,ey.jsx)(FC,{variant:"Trust"===e?"secondary":"outline",children:e})}function K1({action:e}){return(0,ey.jsx)(FC,{variant:"allow"===e?"default":"destructive",children:{allow:"允许",drop:"丢弃",deny:"拒绝"}[e]})}function K2({className:e,...t}){return(0,ey.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:(0,ey.jsx)("table",{"data-slot":"table",className:(0,eI.cn)("w-full caption-bottom text-sm",e),...t})})}function K5({className:e,...t}){return(0,ey.jsx)("thead",{"data-slot":"table-header",className:(0,eI.cn)("[&_tr]:border-b",e),...t})}function K4({className:e,...t}){return(0,ey.jsx)("tbody",{"data-slot":"table-body",className:(0,eI.cn)("[&_tr:last-child]:border-0",e),...t})}function K3({className:e,...t}){return(0,ey.jsx)("tr",{"data-slot":"table-row",className:(0,eI.cn)("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function K6({className:e,...t}){return(0,ey.jsx)("th",{"data-slot":"table-head",className:(0,eI.cn)("h-9 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-0.5",e),...t})}function K8({className:e,...t}){return(0,ey.jsx)("td",{"data-slot":"table-cell",className:(0,eI.cn)("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-0.5",e),...t})}function K7({title:e}){return(0,ey.jsx)("h2",{className:"h-7 text-sm font-semibold tracking-normal",children:e})}function K9({title:e,headers:t,rows:n}){return(0,ey.jsxs)("div",{className:"flex h-full min-h-0 flex-col p-3",children:[(0,ey.jsx)(K7,{title:e}),(0,ey.jsx)("div",{className:"mt-3 min-h-0 flex-1 overflow-auto",children:(0,ey.jsxs)(K2,{children:[(0,ey.jsx)(K5,{children:(0,ey.jsx)(K3,{children:t.map(e=>(0,ey.jsx)(K6,{children:e},e))})}),(0,ey.jsx)(K4,{children:n.map(e=>(0,ey.jsx)(K3,{children:e.map((e,t)=>(0,ey.jsx)(K8,{className:0===t?"font-medium":"text-muted-foreground",children:e},`${e}-${t}`))},e.join("-")))})]})})]})}function Ge(){return(0,ey.jsxs)("div",{className:"grid h-full min-h-0 content-start gap-3 p-3",children:[(0,ey.jsx)(K7,{title:"策略申请"}),(0,ey.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,ey.jsx)(ez,{placeholder:"策略名称"}),(0,ey.jsx)(ez,{placeholder:"负责人"}),(0,ey.jsx)(ez,{placeholder:"源 CIDR"}),(0,ey.jsx)(ez,{placeholder:"目标 CIDR"})]}),(0,ey.jsx)("textarea",{placeholder:"用途",className:"min-h-32 resize-none rounded-lg border border-input bg-transparent px-2.5 py-2 text-sm outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50"}),(0,ey.jsx)("div",{children:(0,ey.jsxs)(eA.Button,{size:"sm",children:[(0,ey.jsx)(lV,{className:"size-4"}),"提交申请"]})})]})}function Gt(){return(0,ey.jsxs)(hQ,{defaultValue:"policies",className:"vtl-firewall-workspace flex h-full min-h-0 flex-col",children:[(0,ey.jsx)("div",{className:"shrink-0 overflow-x-auto px-3 pt-3 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:(0,ey.jsxs)(h7,{className:"h-8 w-max min-w-full",children:[(0,ey.jsx)(h9,{value:"policies",children:"防火墙策略"}),(0,ey.jsx)(h9,{value:"ip-addresses",children:"IP 地址"}),(0,ey.jsx)(h9,{value:"renewals",children:"续期"}),(0,ey.jsx)(h9,{value:"policy-request",children:"策略申请"}),(0,ey.jsx)(h9,{value:"user-settings",children:"用户设置"})]})}),(0,ey.jsx)(pe,{value:"policies",className:"mt-3 min-h-0 flex-1 border-t",children:(0,ey.jsx)(KZ,{})}),(0,ey.jsx)(pe,{value:"ip-addresses",className:"mt-3 min-h-0 flex-1 border-t",children:(0,ey.jsx)(K9,{title:"IP 地址",headers:["地址","名称","区域","策略"],rows:KB})}),(0,ey.jsx)(pe,{value:"renewals",className:"mt-3 min-h-0 flex-1 border-t",children:(0,ey.jsx)(K9,{title:"续期",headers:["策略","续期时间","负责人"],rows:KV})}),(0,ey.jsx)(pe,{value:"policy-request",className:"mt-3 min-h-0 flex-1 border-t",children:(0,ey.jsx)(Ge,{})}),(0,ey.jsx)(pe,{value:"user-settings",className:"mt-3 min-h-0 flex-1 border-t",children:(0,ey.jsx)(K9,{title:"用户设置",headers:["设置","值"],rows:[["默认区域","Trust"],["审核提醒","14 天"],["申请审批","安全负责人"],["策略导出","已开启"]]})})]})}function Gn(e){return e.map(e=>{var t;return{id:e.id,name:e.name,path:e.path,kind:"folder"===(t=e.kind)?"folder":"image"===t?"image":"archive"===t?"archive":"text"===t?"text":"code"===t?"code":"executable"===t?"config":"unknown",hasChildren:"folder"===e.kind,readonly:e.readonly,disabled:e.disabled}})}async function Gr(e,t){let n=t.machineId||"local";return Gn((await dN(n,e.path)).items)}function Ga({className:e,onOpenFile:t}){let[n,r]=ew.useState([]),[a,i]=ew.useState(!1),[o,l]=ew.useState(0),s=ew.useCallback(async()=>{i(!0);try{let e=await dC();r(e.roots.map(e=>({id:e.id,machineId:e.machineId,name:e.name,path:e.path,platform:e.platform,children:Gn(e.children)}))),l(e=>e+1)}catch{r([]),l(e=>e+1)}finally{i(!1)}},[]);return ew.useEffect(()=>{s()},[s]),ew.useEffect(()=>{function e(){s()}return window.addEventListener("vantaloom:file-system-changed",e),()=>window.removeEventListener("vantaloom:file-system-changed",e)},[s]),(0,ey.jsx)(VD,{className:e,compact:!0,openFilesOnSingleClick:!1,allowCreateFile:!1,allowCreateFolder:!1,allowRename:!1,allowDelete:!1,allowDragAndDrop:!1,allowBoxSelect:!1,defaultRoots:n,defaultExpandedIds:n.map(e=>e.id),loadingIds:a?n.map(e=>e.id):[],labels:{title:"Explorer",refresh:"刷新",collapseAll:"折叠",empty:"没有文件",noResults:"没有匹配文件",loading:"读取中..."},onLoadChildren:Gr,onOpenNode:(e,n)=>{"folder"!==e.kind&&t?.({machineId:n.machineId||"local",path:e.path})},onRefresh:()=>{s()}},o)}function Gi({open:e,onOpenChange:t,onSelectFile:n}){return(0,ey.jsx)(uo,{open:e,onOpenChange:t,children:(0,ey.jsxs)(d8,{className:"h-[min(42rem,calc(100svh-2rem))] max-w-2xl gap-0 overflow-hidden p-0",children:[(0,ey.jsx)(d9,{className:"sr-only",children:"选择文件"}),(0,ey.jsx)(fe,{className:"sr-only",children:"选择本机可访问文件。"}),(0,ey.jsx)(Ga,{className:"size-full max-w-none rounded-none border-0",onOpenFile:e=>{n(e),t(!1)}})]})})}function Go(){let e=ew.useRef(null),[t,n]=ew.useState({width:0,height:0});return ew.useLayoutEffect(()=>{let t=e.current;if(!t)return;function r(){let e=t.getBoundingClientRect();n({width:e.width,height:e.height})}r();let a=new ResizeObserver(r);return a.observe(t),()=>a.disconnect()},[]),[e,t]}let Gl=(0,ek.default)("shield-off",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);function Gs({open:e,placement:t="viewport",movePermissionGranted:n,onOpenChange:r,onAdd:a,onMovePermissionGrantedChange:i}){let o=[{key:"move-permission",label:n?"取消放行权限":"放行权限",icon:n?(0,ey.jsx)(wY,{className:"size-4"}):(0,ey.jsx)(Gl,{className:"size-4"}),pressed:n,onClick:()=>i(!n)},{key:"add",label:"新建文件窗口",icon:(0,ey.jsx)(lV,{className:"size-4"}),pressed:void 0,onClick:a}];return(0,ey.jsx)("div",{className:(0,eI.cn)("right-5 z-50","viewport"===t?"fixed bottom-5 max-md:bottom-20":"absolute bottom-5"),children:(0,ey.jsxs)("div",{className:"relative size-8",children:[o.map((t,n)=>(0,ey.jsx)(eA.Button,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.label,"aria-pressed":t.pressed,title:t.label,onClick:t.onClick,className:(0,eI.cn)("absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur transition-[opacity,transform] duration-150 ease-out",e?"pointer-events-auto opacity-100":"pointer-events-none translate-y-1 opacity-0",t.pressed&&"border-foreground bg-foreground text-background hover:bg-foreground/90 hover:text-background"),style:{transform:e?`translateY(-${(n+1)*42}px)`:void 0},children:t.icon},t.key)),(0,ey.jsx)(eA.Button,{type:"button",variant:"outline",size:"icon-sm","aria-label":"文件窗口操作","aria-expanded":e,onClick:()=>r(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,ey.jsx)(lF,{className:(0,eI.cn)("size-4 transition-transform",e&&"rotate-90")})})]})})}let Gc=[];function Gu(e,t){return`${e} / ${t.replace(/\\/g," / ").replace(/\//g," / ")}`}function Gd(e,t){for(let n of e){if(n.id===t)return n;let e=n.children?Gd(n.children,t):void 0;if(e)return e}}function Gf(e,t){return e.replace(/\\/g,"/").toLowerCase()===t.replace(/\\/g,"/").toLowerCase()}function Gh(e,t){let n=e.replace(/\\/g,"/").replace(/\/+/g,"/");return"windows"===t?n.toLowerCase():n}function Gp(e){return e.map(e=>({...e,children:e.children?Gp(e.children):void 0}))}let Gm=(0,ek.default)("move-right",[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]),Gg=(0,ek.default)("octagon-alert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]),Gv=(0,ek.default)("clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]),Gx={title:"Clipboard",empty:"No clips",dragHandle:"Drag clip"};function Gy({items:e,expanded:t,defaultExpanded:n=!1,expansionDirection:r="down-left",title:a,labels:i,maxCollapsedItems:o=10,maxExpandedHeight:l=360,acceptExternalDrops:s=!1,removeOnExternalDrop:c=!1,className:u,onExpandedChange:d,onItemDragStart:f,onItemDragEnd:h,onItemDuplicate:p,onItemsRemove:m,onItemsReorder:g,onExternalDrop:v,onMouseEnter:x,onMouseLeave:y,...b}){let w={...Gx,...i},[j,k]=ew.useState(n),[S,C]=ew.useState(),[N,M]=ew.useState(),[E,O]=ew.useState(n),[P,A]=ew.useState(),[I,z]=ew.useState({canScrollDown:!1,canScrollUp:!1}),[_,D]=ew.useState(!1),[R,T]=ew.useState(!1),L=ew.useRef(0),$=ew.useRef(void 0),F=ew.useRef(!1),B=ew.useRef(null),V=ew.useRef(null),H=void 0!==t,W=(H?t:j)||void 0!==S,U=Math.min(o,10),q=W?e:e.slice(0,U),K=E?N:void 0,G=44*q.length+18,X=Math.min(G,l),Y=W&&G>X,Z=0===e.length?"h-24":W?`${X}px`:"h-28",J=W&&Y?14:0;ew.useEffect(()=>{if(!W){O(!1),z({canScrollDown:!1,canScrollUp:!1});return}O(!1),window.requestAnimationFrame(()=>{V.current&&(V.current.scrollTop=0)}),z({canScrollUp:!1,canScrollDown:G>X});let e=window.setTimeout(()=>{O(!0)},260);return()=>window.clearTimeout(e)},[G,X,W]),ew.useEffect(()=>()=>{void 0!==$.current&&window.clearTimeout($.current)},[]);let Q=ew.useCallback(e=>{H||k(e),d?.(e)},[H,d]);function ee(e,t=0){let n=e.currentTarget.getBoundingClientRect();return e.clientX>=n.left-t&&e.clientX<=n.right+t&&e.clientY>=n.top-t&&e.clientY<=n.bottom+t}function et(e){if(!W||!V.current)return 0;let t=Array.from(V.current.querySelectorAll('[data-slot="clipboard-stack-card"]'));if(0===t.length)return 0;for(let[n,r]of t.entries()){let t=r.getBoundingClientRect();if(e.clientY<t.top+t.height/2)return n}return t.length}function en(e){return void 0!==S||Array.from(e.dataTransfer.types).includes("application/vnd.vantaloom.clip-id")}return ew.useEffect(()=>{if(0===e.length||W)return;let t=window.requestAnimationFrame(()=>{B.current?.matches(":hover")&&(void 0!==$.current&&(window.clearTimeout($.current),$.current=void 0),D(!1),Q(!0))});return()=>window.cancelAnimationFrame(t)},[e.length,Q,W]),ew.useEffect(()=>{if(!W||!Y||!K||!V.current)return;let e=q.findIndex(e=>e.id===K);if(e<0)return;let t=V.current,n=44*e-8,r=44*e+(q[e]?.expandedHeight??220)+12,a=t.scrollTop,i=a+t.clientHeight;n<a?t.scrollTo({top:Math.max(0,n),behavior:"smooth"}):r>i&&t.scrollTo({top:r-t.clientHeight,behavior:"smooth"})},[K,Y,q,W]),(0,ey.jsxs)("div",{ref:B,"data-slot":"clipboard-stack","data-expanded":W,"data-closing":_,"data-external-dragging":R,"data-expansion-direction":r,className:(0,eI.cn)("group/clipboard relative w-80 max-w-full overflow-visible py-2",u),onMouseEnter:function(e){x?.(e),ee(e)&&(void 0!==$.current&&(window.clearTimeout($.current),$.current=void 0),D(!1),Q(!0))},onMouseMove:function(e){if(!W){ee(e,12)&&(void 0!==$.current&&(window.clearTimeout($.current),$.current=void 0),D(!1),Q(!0));return}!W||S||ee(e,12)||(M(void 0),A(void 0),Q(!1),D(!0),void 0!==$.current&&window.clearTimeout($.current),$.current=window.setTimeout(()=>{D(!1),$.current=void 0},320))},onMouseLeave:function(e){y?.(e),S||(M(void 0),A(void 0),D(!0),Q(!1),void 0!==$.current&&window.clearTimeout($.current),$.current=window.setTimeout(()=>{D(!1),$.current=void 0},320))},onDragEnter:function(e){!s||en(e)||(L.current+=1,T(!0),D(!1))},onDragLeave:function(e){!s||en(e)||(L.current=Math.max(0,L.current-1),0===L.current&&(T(!1),A(void 0)))},onDragOver:function(e){!s||en(e)||(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy",T(!0),W?A(et(e)):A(0))},onDrop:function(t){if(!s||en(t))return;t.preventDefault(),t.stopPropagation();let n=P??et(t);L.current=0,T(!1),A(void 0),v?.({insertIndex:n,items:e,nativeEvent:t})},...b,children:[(0,ey.jsxs)("div",{"data-slot":"clipboard-stack-header",className:(0,eI.cn)("mb-2 flex h-8 items-center gap-2 px-1 text-sm font-medium text-foreground transition-[opacity,transform] duration-200","down-left"===r&&"justify-end",W?"opacity-100":"translate-y-1 opacity-0"),children:[(0,ey.jsx)("span",{className:"inline-flex size-6 items-center justify-center rounded-lg border bg-background text-muted-foreground",children:(0,ey.jsx)(Gv,{className:"size-3.5"})}),(0,ey.jsx)("span",{children:a??w.title}),(0,ey.jsx)("span",{className:"ml-auto tabular-nums text-muted-foreground",children:e.length})]}),(0,ey.jsxs)("div",{"data-slot":"clipboard-stack-list",className:(0,eI.cn)("relative transition-[height] duration-300 ease-[cubic-bezier(.2,.8,.2,1)]"),style:{height:Z},children:[e.length>0&&"down-left"===r?(0,ey.jsx)("span",{"data-slot":"clipboard-stack-pivot","aria-hidden":"true",className:(0,eI.cn)("pointer-events-none absolute top-3 right-[34px] z-50 size-2.5 rounded-full bg-foreground shadow-sm transition-[opacity,transform] duration-200 dark:bg-background",W?"scale-75 opacity-0":"opacity-100")}):null,s&&R?(0,ey.jsxs)("span",{"data-slot":"clipboard-stack-external-ghost","aria-hidden":"true",className:(0,eI.cn)("pointer-events-none absolute right-0 z-[70] h-14 w-[88%] rounded-xl border bg-background shadow-md shadow-black/10","clipboard-stack-external-ghost"),children:[(0,ey.jsx)("span",{className:"absolute top-3 right-[34px] size-2 rounded-full bg-foreground dark:bg-background"}),(0,ey.jsx)("span",{className:"absolute top-4 left-3 h-2 w-24 rounded-full bg-foreground/18"}),(0,ey.jsx)("span",{className:"absolute top-8 left-3 h-1.5 w-14 rounded-full bg-foreground/10"})]}):null,0===e.length?(0,ey.jsx)("div",{className:"flex h-24 items-center justify-center rounded-xl border border-dashed bg-muted/35 text-sm text-muted-foreground",children:w.empty}):(0,ey.jsxs)("div",{"data-slot":"clipboard-stack-scroll-frame",className:"relative h-full",children:[(0,ey.jsx)("div",{"data-slot":"clipboard-stack-scroll",ref:V,className:(0,eI.cn)("relative h-full overflow-x-visible",W&&Y?"clipboard-stack-scrollbar-hidden overflow-y-auto pt-2 pr-1 pb-3":"overflow-visible"),onScroll:e=>{let t=e.currentTarget;z({canScrollUp:t.scrollTop>1,canScrollDown:t.scrollTop+t.clientHeight<t.scrollHeight-1})},onDragOver:function(e){W&&S&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move")},onDrop:function(t){if(!W||!S||void 0===P)return;t.preventDefault(),t.stopPropagation(),F.current=!0;let n=e.findIndex(e=>e.id===S),r=e[n];if(n<0||!r)return;let a=e.filter(e=>e.id!==S),i=Math.max(0,Math.min(P>n?P-1:P,a.length));a.splice(i,0,r),A(void 0),M(void 0),i!==n&&g?.(a,{item:r,fromIndex:n,toIndex:i,items:a})},children:(0,ey.jsxs)("div",{"data-slot":"clipboard-stack-scroll-content",className:"relative",style:{width:W&&Y?`calc(100% - ${J}px)`:void 0,marginLeft:W&&Y?`${J}px`:void 0,height:W&&Y?G+28:W?G:"100%"},children:[void 0!==P?(0,ey.jsxs)("span",{"data-slot":"clipboard-stack-insert-line","aria-hidden":"true",className:"pointer-events-none absolute right-0 left-0 z-[80] flex items-center",style:{top:44*P-2},children:[(0,ey.jsx)("span",{className:"h-px flex-1 bg-foreground/70"}),(0,ey.jsx)("span",{className:"mx-1 size-1.5 rounded-full bg-foreground"}),(0,ey.jsx)("span",{className:"h-px flex-1 bg-foreground/70"})]}):null,q.map((t,n)=>(0,ey.jsx)(Gb,{item:t,index:n,count:q.length,expanded:W,active:W&&t.id===K,top:W?44*n:void 0,expansionDirection:r,labels:w,onHover:()=>M(t.id),onDuplicate:()=>{let n=e.findIndex(e=>e.id===t.id);n<0||p?.(e,{item:t,index:n,items:e})},onDragOver:e=>{if(W&&S&&S!==t.id){let t=e.currentTarget.getBoundingClientRect();A(e.clientY<t.top+t.height/2?n:n+1)}},onDragStart:e=>{C(e.item.id),M(void 0),F.current=!1,f?.(e)},onDragEnd:t=>{let n=t.nativeEvent.dataTransfer.dropEffect,r=t.item.id,a=e.findIndex(e=>e.id===r),i=c&&!F.current&&"none"!==n&&a>=0;if(C(void 0),A(void 0),M(void 0),F.current?F.current=!1:Q(!1),i){let n=e.filter(e=>e.id!==r);m?.(n,{item:t.item,index:a,items:n})}h?.(t)}},t.id))]})}),Y&&I.canScrollUp?(0,ey.jsx)("span",{"data-slot":"clipboard-stack-scroll-mask-top","aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 top-0 z-[90] h-8 bg-gradient-to-b from-background to-transparent"}):null,Y&&I.canScrollDown?(0,ey.jsx)("span",{"data-slot":"clipboard-stack-scroll-mask-bottom","aria-hidden":"true",className:"pointer-events-none absolute inset-x-0 bottom-0 z-[90] h-8 bg-gradient-to-t from-background to-transparent"}):null]})]})]})}function Gb({item:e,index:t,count:n,expanded:r,active:a,top:i,expansionDirection:o,labels:l,onHover:s,onDuplicate:c,onDragOver:u,onDragStart:d,onDragEnd:f}){let h=Math.min(t,9),p="down-left"===o?-(4.5*h):[-4,2,-1,4][h]??0,m=r?a?n+20:n-t:n+t;return(0,ey.jsx)("article",{"data-slot":"clipboard-stack-card",draggable:!e.disabled,"aria-disabled":e.disabled,className:(0,eI.cn)("absolute right-0 min-h-16 w-full cursor-grab select-none rounded-xl border bg-background p-2.5 text-foreground shadow-sm shadow-black/5 outline-none transition-[top,transform,opacity,box-shadow,border-color] duration-300 ease-[cubic-bezier(.2,.8,.2,1)] active:cursor-grabbing","hover:border-foreground/35 hover:shadow-md hover:shadow-black/10 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/40",r&&"min-h-0 overflow-hidden py-2 transition-[top,transform,max-height,opacity,box-shadow,border-color] duration-300",r&&!a&&"max-h-11",e.disabled&&"cursor-not-allowed opacity-50"),style:{top:r?i??44*t:"down-left"===o?0:9*h,zIndex:m,maxHeight:r&&a?e.expandedHeight??220:void 0,transformOrigin:"down-left"===o?"calc(100% - 34px) 14px":"100% 0",transform:r?a?"translate3d(-10px, -6px, 0) rotate(0deg)":"translate3d(0, 0, 0) rotate(0deg)":`translate3d(${"down-left"===o?0:4*h}px, 0, 0) rotate(${p}deg)`},tabIndex:e.disabled?-1:0,onMouseDown:function(t){1!==t.button||e.disabled||t.preventDefault()},onMouseEnter:s,onFocus:s,onAuxClick:function(t){1!==t.button||e.disabled||(t.preventDefault(),c?.())},onDragOver:u,onDragStart:function(t){for(let[n,r]of(t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setData("text/plain",e.title),t.dataTransfer.setData("application/vnd.vantaloom.clip-id",e.id),Object.entries(e.dragData??{})))t.dataTransfer.setData(n,r);d?.({item:e,nativeEvent:t})},onDragEnd:function(t){f?.({item:e,nativeEvent:t})},children:(0,ey.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,ey.jsx)("div",{"data-slot":"clipboard-stack-card-media",className:"flex size-8 shrink-0 items-center justify-center rounded-lg border bg-muted text-muted-foreground",children:e.icon??(0,ey.jsx)(Gv,{className:"size-4"})}),(0,ey.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ey.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,ey.jsx)("p",{className:"truncate text-sm font-medium",children:e.title}),e.meta?(0,ey.jsx)("span",{className:"ml-auto shrink-0 text-xs tabular-nums text-muted-foreground",children:e.meta}):null]}),e.description?(0,ey.jsx)("p",{className:(0,eI.cn)("mt-0.5 text-xs leading-5 text-muted-foreground transition-[max-height,opacity,transform] duration-200",a?"max-h-40 translate-y-0 opacity-100":"max-h-0 -translate-y-1 overflow-hidden opacity-0"),children:e.description}):null,e.content?(0,ey.jsx)("div",{className:(0,eI.cn)("mt-2 text-xs text-muted-foreground transition-[max-height,opacity,transform] duration-200",a?"max-h-80 translate-y-0 opacity-100":"max-h-0 -translate-y-1 overflow-hidden opacity-0"),children:e.content}):null]}),(0,ey.jsx)("span",{"aria-label":l.dragHandle,className:"mt-1 inline-flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground",children:(0,ey.jsx)(ft,{className:"size-3.5"})})]})})}function Gw({transfers:e}){let t=e.slice(0,10);if(0===t.length)return null;let n=t.map(e=>{var t,n,r;let a,i,o;return{id:e.id,title:(a="copy"===(t=e).mode?"复制":"移动",i=t.sources.length,o=t.sources[0],`${a} ${i>1?`${i} 项`:Gk(o?.path??"")}`),description:(n=e).message?n.message:`${n.sources[0]?.machineId??"local"} -> ${n.target.machineId}`,meta:function(e){switch(e.status){case"completed":return"完成";case"failed":return"失败";case"queued":return"排队";default:return`${Math.round(e.progress?.percent??0)}%`}}(e),icon:"completed"===(r=e).status?(0,ey.jsx)(eO,{className:"size-4"}):"failed"===r.status?(0,ey.jsx)(Gg,{className:"size-4"}):"running"===r.status?(0,ey.jsx)(eM,{className:"size-4 animate-spin"}):"copy"===r.mode?(0,ey.jsx)(l_,{className:"size-4"}):(0,ey.jsx)(Gm,{className:"size-4"}),expandedHeight:132,content:(0,ey.jsx)(Gj,{transfer:e})}});return(0,ey.jsx)("div",{className:"pointer-events-auto fixed top-4 right-4 z-50 w-80 max-w-[calc(100vw-2rem)] max-md:left-4 max-md:right-auto max-md:w-auto max-md:max-w-[16rem]",children:(0,ey.jsx)(Gy,{items:n,title:"传输",labels:{empty:"暂无传输",dragHandle:"传输任务"},expansionDirection:"down-left",maxExpandedHeight:420})})}function Gj({transfer:e}){let t=Math.max(0,Math.min(100,e.progress?.percent??0));return(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)("div",{className:"h-1.5 overflow-hidden rounded-full bg-border",children:(0,ey.jsx)("div",{className:"h-full rounded-full bg-foreground transition-[width] duration-300",style:{width:`${t}%`}})}),(0,ey.jsxs)("div",{className:"grid gap-1 tabular-nums",children:[(0,ey.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[(0,ey.jsx)("span",{className:"truncate",children:Gk(e.target.path)}),(0,ey.jsxs)("span",{children:[Math.round(t),"%"]})]}),(0,ey.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2 text-muted-foreground",children:[(0,ey.jsxs)("span",{className:"truncate",children:[GS(e.progress.bytesDone)," /"," ",GS(e.progress.bytesTotal)]}),(0,ey.jsxs)("span",{children:[e.progress.entriesDone,"/",e.progress.entriesTotal]})]}),e.progress.currentPath?(0,ey.jsx)("div",{className:"truncate text-muted-foreground",children:Gk(e.progress.currentPath)}):null]})]})}function Gk(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function GS(e){if(!e)return"0 B";let t=["B","KB","MB","GB","TB"],n=e,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n>=10||0===r?Math.round(n):n.toFixed(1)} ${t[r]}`}let GC=(0,ek.default)("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);function GN({windowLayout:e,roots:t,active:n,zIndex:r,boardSize:a,onActivate:i,onClose:o,onMinimize:l,onWindowChange:s,onNavigate:c,onRootsChange:u,onCreateFolder:d,onRenameItem:f,onDeleteItems:h,onMoveItems:p}){return(0,ey.jsxs)("section",{className:(0,eI.cn)("absolute overflow-hidden rounded-xl border bg-card shadow-lg transition-[box-shadow,border-color] duration-150","vtl-file-manager-window",n&&"border-foreground shadow-xl"),style:{left:e.x,top:e.y,width:e.w,height:e.h,zIndex:r},onPointerDown:i,children:[(0,ey.jsxs)("div",{className:"grid h-9 cursor-grab grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 border-b bg-muted/35 px-2 active:cursor-grabbing",onPointerDown:function(t){t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),i();let n=t.clientX,r=t.clientY;function a(t){let a=Math.max(0,e.x+t.clientX-n),i=Math.max(0,e.y+t.clientY-r);s({...e,x:a,y:i})}window.addEventListener("pointermove",a),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",a),window.removeEventListener("pointerup",e)})},children:[(0,ey.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ey.jsx)(eA.Button,{type:"button",size:"icon-sm",variant:"ghost","aria-label":"关闭窗口",onPointerDown:e=>e.stopPropagation(),onClick:o,children:(0,ey.jsx)(d3.XIcon,{})}),(0,ey.jsx)(eA.Button,{type:"button",size:"icon-sm",variant:"ghost","aria-label":"缩小到剪切板",onPointerDown:e=>e.stopPropagation(),onClick:l,children:(0,ey.jsx)(GC,{})})]}),(0,ey.jsx)("div",{className:"truncate text-center ui-text-control",children:e.title}),(0,ey.jsx)("div",{className:"w-14"})]}),(0,ey.jsx)(wr,{roots:t,variant:"full",currentRootId:e.rootId,currentPath:e.path,draggableItems:!0,onNavigate:c,onRootsChange:e=>u(e),onCreateFolder:d,onRenameItem:f,onDeleteItems:h,onItemDrop:({sourceRootId:e,sourceItemIds:t,targetRoot:n,target:r})=>p({sourceRootId:e,sourceItemIds:t,targetRoot:n,target:r}),labels:{title:"文件管理",search:"搜索文件",newFolder:"新建",upload:"上传",refresh:"刷新",sort:"排序",view:"视图"},className:"vtl-file-window-explorer min-h-0 rounded-none border-0 shadow-none",contentClassName:"min-h-0",style:{height:"calc(100% - 2.25rem)",minHeight:0}}),(0,ey.jsx)("button",{type:"button","aria-label":"调整窗口大小",className:"absolute right-0 bottom-0 size-5 cursor-nwse-resize rounded-tl-md border-t border-l bg-background/80",onPointerDown:function(t){t.preventDefault(),t.stopPropagation(),t.currentTarget.setPointerCapture(t.pointerId),i();let n=t.clientX,r=t.clientY;function o(t){let i=Math.max(420,Math.min(Math.max(420,a.width-e.x),e.w+t.clientX-n)),o=Math.max(320,e.h+t.clientY-r);s({...e,w:i,h:o})}window.addEventListener("pointermove",o),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",o),window.removeEventListener("pointerup",e)})}})]})}function GM({clipboardItems:e=[],onClipboardItemsChange:t,className:n,minBoardHeight:r=520,actionsPlacement:a="container"}){let[i,o]=Go(),[l,s]=ew.useState([]),[c,u]=ew.useState(Gc),[d,f]=ew.useState(Gc[0]?.id),[h,p]=ew.useState([]),[m,g]=ew.useState(!1),[v,x]=ew.useState(!1),[y,b]=ew.useState(),w=ew.useRef(Gc.length),j=ew.useRef(!1),k=ew.useRef(new Set),S=ew.useCallback(async(e,t,n)=>{let r=await dN(e,n);s(n=>{var a;return a={...r,root:{...r.root,id:t,machineId:e}},n.map(e=>e.id!==a.root.id?e:Gf(e.path,a.path)?{...e,children:Gp(a.items)}:{...e,children:function(e,t,n,r,a){let i=function(e,t,n){let r=Gh(e,n),a=Gh(t,n);if(r===a)return[];let i=r.endsWith("/")?r:`${r}/`;return a.startsWith(i)?a.slice(i.length).split("/").filter(Boolean):[]}(t,n,r);if(0===i.length)return Gp(a);let o="windows"===r?"\\":"/";return function e(t,n,r){let l=i[r];if(!l)return Gp(a);let s=n===o?`${o}${l}`:`${n.replace(/[\\/]+$/,"")}${o}${l}`,c=t.findIndex(e=>Gf(e.path,s)),u=t[c],d={...u??{id:`synthetic-${s}`,name:l,kind:"folder",path:s,children:[]},kind:"folder",children:e(u?.children??[],s,r+1)};if(c<0)return[...t,d];let f=[...t];return f[c]=d,f}(e,t,0)}(e.children,e.path,a.path,e.platform,a.items)})})},[]),C=ew.useCallback(async()=>{let e=GP((await dz()).transfers);return p(e),e},[]),N=ew.useCallback(e=>{p(t=>GP([e,...t.filter(t=>t.id!==e.id)]))},[]),M=ew.useCallback(e=>{dI({mode:"move",sources:e.sources.map(e=>({machineId:e.machineId,path:e.path})),target:{machineId:e.target.machineId,path:e.target.path}}).then(N).catch(()=>{})},[N]),E=ew.useCallback(()=>{for(let e of c)S(e.machineId,e.rootId,e.path)},[S,c]);function O(e,t){u(n=>n.map(n=>n.id===e?t(n):n))}function P(e){let t=l[0];if(!t&&!e?.rootId)return;w.current+=1;let n=`files-window-${w.current}`,r=i.current?.getBoundingClientRect(),a=r?.width??o.width,s=r?.height??o.height,c=e?.w??680,d=e?.h??460,h=Math.max(0,(a-c)/2),p=Math.max(0,(s-d)/2),m={id:n,title:e?.title??Gu(t?.name??"local",t?.path??""),machineId:e?.machineId??t?.machineId??"local",rootId:e?.rootId??t?.id??"local",path:e?.path??t?.path??"",x:e?.x??h+12*w.current,y:e?.y??p+12*w.current,w:c,h:d};u(e=>[...e,m]),f(n),S(m.machineId,m.rootId,m.path)}ew.useEffect(()=>{let e=!0;return(async function(){let t=await dC();if(e&&(s(t.roots),!j.current&&t.roots[0])){j.current=!0;let e=function(e,t=0){return{id:`files-${e.id.replace(/[^a-z0-9_-]/gi,"-")}-${t}`,title:Gu(e.name,e.path),machineId:e.machineId,rootId:e.id,path:e.path,x:28+24*t,y:28+24*t,w:720,h:480}}(t.roots[0]);u([e]),f(e.id),S(e.machineId,e.rootId,e.path)}})().catch(()=>{}),C().catch(()=>{}),()=>{e=!1}},[S,C]),ew.useEffect(()=>{if(!h.some(e=>"pending"===e.status||"running"===e.status||"queued"===e.status))return;let e=window.setInterval(async()=>{let e=(await C().catch(()=>h)).filter(e=>"completed"===e.status&&!k.current.has(e.id));if(e.length>0){for(let t of e)k.current.add(t.id);E()}},1e3);return()=>window.clearInterval(e)},[E,C,h]);let A=su(),I=c.find(e=>e.id===d);function z(e){return{onNavigate:({rootId:t,path:n})=>{let r=l.find(e=>e.id===t),a=r?.machineId??e.machineId;O(e.id,e=>({...e,machineId:a,rootId:t,path:n,title:Gu(r?.name??a,n)})),S(a,t,n)},onRootsChange:s,onCreateFolder:(t,n)=>{dO({machineId:e.machineId,path:t.path,name:n}).then(()=>S(e.machineId,e.rootId,e.path)).catch(()=>{})},onRenameItem:(t,n)=>{dP({machineId:e.machineId,path:t.path,name:n}).then(()=>S(e.machineId,e.rootId,e.path)).catch(()=>{})},onDeleteItems:t=>{dA({machineId:e.machineId,paths:t.map(e=>e.path)}).then(()=>S(e.machineId,e.rootId,e.path)).catch(()=>{})},onMoveItems:({sourceRootId:e,sourceItemIds:t,targetRoot:n,target:r})=>{let a=l.find(t=>t.id===e);if(!a)return;let i=t.flatMap(e=>{let t=Gd(a.children,e);return t?[{machineId:a.machineId,path:t.path,name:t.name}]:[]});if(0===i.length)return;let o={sources:i,target:{machineId:n.machineId,path:r.path,name:r.name}};v?M(o):b(o)}}}return A?(0,ey.jsxs)("div",{className:(0,eI.cn)("flex h-full min-h-0 w-full flex-col",n),children:[c.length>1?(0,ey.jsx)("div",{className:"flex shrink-0 items-center gap-1 overflow-x-auto border-b px-2 py-1.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:c.map(e=>(0,ey.jsx)("button",{type:"button",className:(0,eI.cn)("shrink-0 rounded-md px-2.5 py-1 text-xs transition-colors",e.id===d?"bg-foreground text-background":"text-muted-foreground hover:bg-muted"),onClick:()=>f(e.id),children:e.title},e.id))}):null,(0,ey.jsx)("div",{className:"min-h-0 flex-1",children:I?(0,ey.jsx)(GE,{windowLayout:I,roots:l,...z(I)}):(0,ey.jsx)("div",{className:"grid h-full place-items-center text-sm text-muted-foreground",children:"暂无打开的文件窗口"})}),(0,ey.jsx)(Gw,{transfers:h}),(0,ey.jsx)(Gs,{open:m,placement:a,movePermissionGranted:v,onOpenChange:g,onMovePermissionGrantedChange:x,onAdd:()=>{g(!1),P()}}),(0,ey.jsx)(GO,{move:y,onCancel:()=>b(void 0),onConfirm:e=>{b(void 0),M(e)}})]}):(0,ey.jsxs)("div",{ref:i,className:(0,eI.cn)("relative h-full min-h-0 w-full overflow-hidden rounded-[inherit]",n),onDragOver:e=>{Array.from(e.dataTransfer.types).includes("application/vnd.vantaloom.file-window")&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},onDrop:function(e){let t=e.dataTransfer.getData("application/vnd.vantaloom.file-window");if(t)try{let n=JSON.parse(t),r=i.current?.getBoundingClientRect();e.preventDefault(),e.stopPropagation(),P({...n,x:r?e.clientX-r.left-160:n.x,y:r?e.clientY-r.top-24:n.y})}catch{return}},children:[(0,ey.jsx)("div",{className:"relative h-full min-h-0",style:{minHeight:Math.max(r,o.height-48)},children:c.map((n,r)=>(0,ey.jsx)(GN,{windowLayout:n,roots:l,active:d===n.id,zIndex:20+r+20*(d===n.id),boardSize:o,onActivate:()=>f(n.id),onClose:()=>u(e=>e.filter(e=>e.id!==n.id)),onMinimize:()=>{t?.([{id:`clip-${n.id}`,title:n.title,description:"文件管理窗口",meta:`${Math.round(n.w)}x${Math.round(n.h)}`,payloads:{"application/vnd.vantaloom.file-window":{...n}},dragData:{"application/vnd.vantaloom.clip-kind":"file-window","application/vnd.vantaloom.file-window":JSON.stringify(n)}},...e.filter(e=>e.id!==`clip-${n.id}`)]),u(e=>e.filter(e=>e.id!==n.id))},onWindowChange:e=>O(n.id,()=>e),...z(n),onNavigate:({rootId:e,path:t})=>{let r=l.find(t=>t.id===e),a=r?.machineId??n.machineId;O(n.id,n=>({...n,machineId:a,rootId:e,path:t,title:Gu(r?.name??a,t)})),S(a,e,t)},onRootsChange:s,onCreateFolder:(e,t)=>{dO({machineId:n.machineId,path:e.path,name:t}).then(()=>S(n.machineId,n.rootId,n.path)).catch(()=>{})},onRenameItem:(e,t)=>{dP({machineId:n.machineId,path:e.path,name:t}).then(()=>S(n.machineId,n.rootId,n.path)).catch(()=>{})},onDeleteItems:e=>{dA({machineId:n.machineId,paths:e.map(e=>e.path)}).then(()=>S(n.machineId,n.rootId,n.path)).catch(()=>{})},onMoveItems:({sourceRootId:e,sourceItemIds:t,targetRoot:n,target:r})=>{let a=l.find(t=>t.id===e);if(!a)return;let i=t.flatMap(e=>{let t=Gd(a.children,e);return t?[{machineId:a.machineId,path:t.path,name:t.name}]:[]});if(0===i.length)return;let o={sources:i,target:{machineId:n.machineId,path:r.path,name:r.name}};v?M(o):b(o)}},n.id))}),(0,ey.jsx)(Gw,{transfers:h}),(0,ey.jsx)(Gs,{open:m,placement:a,movePermissionGranted:v,onOpenChange:g,onMovePermissionGrantedChange:x,onAdd:()=>{g(!1),P()}}),(0,ey.jsx)(GO,{move:y,onCancel:()=>b(void 0),onConfirm:e=>{b(void 0),M(e)}})]})}function GE({windowLayout:e,roots:t,onNavigate:n,onRootsChange:r,onCreateFolder:a,onRenameItem:i,onDeleteItems:o,onMoveItems:l}){return(0,ey.jsx)(wr,{roots:t,variant:"full",currentRootId:e.rootId,currentPath:e.path,onNavigate:n,onRootsChange:e=>r(e),onCreateFolder:a,onRenameItem:i,onDeleteItems:o,onItemDrop:({sourceRootId:e,sourceItemIds:t,targetRoot:n,target:r})=>l({sourceRootId:e,sourceItemIds:t,targetRoot:n,target:r}),labels:{title:"文件管理",search:"搜索文件",newFolder:"新建",upload:"上传",refresh:"刷新",sort:"排序",view:"视图"},className:"h-full min-h-0 rounded-none border-0 shadow-none",contentClassName:"min-h-0"})}function GO({move:e,onCancel:t,onConfirm:n}){var r;let a=e?.sources??[],i=Math.max(0,a.length-4);return(0,ey.jsx)(uL,{open:void 0!==e,onOpenChange:e=>{e||t()},children:(0,ey.jsxs)(u2,{children:[(0,ey.jsxs)(u5,{children:[(0,ey.jsx)(u3,{children:"确认移动"}),(0,ey.jsx)(u6,{children:e?`将 ${1===(r=a).length?r[0]?GA(r[0]):"0 项":`${r.length} 项`} 移动到 ${GA(e.target)}`:""})]}),e?(0,ey.jsxs)("div",{className:"grid gap-2 rounded-lg border bg-muted/20 p-3 ui-text-body",children:[(0,ey.jsxs)("div",{className:"grid gap-1",children:[(0,ey.jsx)("span",{className:"text-muted-foreground ui-text-kbd",children:"移动内容"}),(0,ey.jsxs)("div",{className:"grid gap-1",children:[a.slice(0,4).map(e=>(0,ey.jsx)("span",{className:"truncate",children:GA(e)},`${e.machineId}:${e.path}`)),i>0?(0,ey.jsxs)("span",{className:"text-muted-foreground",children:["另有 ",i," 项"]}):null]})]}),(0,ey.jsxs)("div",{className:"grid gap-1",children:[(0,ey.jsx)("span",{className:"text-muted-foreground ui-text-kbd",children:"目标位置"}),(0,ey.jsx)("span",{className:"truncate",children:GA(e.target)})]})]}):null,(0,ey.jsxs)(u4,{children:[(0,ey.jsx)(u7,{children:"取消"}),(0,ey.jsx)(u8,{onClick:()=>{e&&n(e)},children:"确认移动"})]})]})})}function GP(e){return e.slice(0,10)}function GA(e){let t=e.path.replace(/\\/g,"/");return`${e.machineId} / ${e.name||t}`}function GI({className:e}){return(0,ey.jsx)(GM,{className:(0,eI.cn)("h-full min-h-0 w-full rounded-[inherit] border-0 shadow-none",e),minBoardHeight:360,actionsPlacement:"container"})}var Gz=ew;function G_(){return(G_=Object.assign.bind()).apply(null,arguments)}var GD=e=>{var{cx:t,cy:n,r,className:a}=e,i=(0,w1.clsx)("recharts-dot",a);return jI(t)&&jI(n)&&jI(r)?ew.createElement("circle",G_({},A5(e),IE(e),{className:i,cx:t,cy:n,r:r})):null},GR=["points"];function GT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function GL(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?GT(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GT(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function G$(){return(G$=Object.assign.bind()).apply(null,arguments)}function GF(e){var{option:t,dotProps:n,className:r}=e;if((0,ew.isValidElement)(t))return(0,ew.cloneElement)(t,n);if("function"==typeof t)return t(n);var a=(0,w1.clsx)(r,"boolean"!=typeof t?t.className:""),i=null!=n?n:{},{points:o}=i,l=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(i,GR);return ew.createElement(GD,G$({},l,{className:a}))}function GB(e){var{points:t,dot:n,className:r,dotClassName:a,dataKey:i,baseProps:o,needClip:l,clipPathId:s,zIndex:c=Nn.scatter}=e;if(null==t||!n&&1!==t.length)return null;var u=zg(n),d=null==n?null:(0,ew.isValidElement)(n)?A3(n.props):"object"!=typeof n||Array.isArray(n)?null:A3(n),f=t.map((e,r)=>{var l,s,c=GL(GL(GL({r:3},o),d),{},{index:r,cx:null!=(l=e.x)?l:void 0,cy:null!=(s=e.y)?s:void 0,dataKey:i,value:e.value,payload:e.payload,points:t});return ew.createElement(GF,{key:"dot-".concat(r),option:n,dotProps:c,className:a})}),h={};return l&&null!=s&&(h.clipPath="url(#clipPath-".concat(u?"":"dots-").concat(s,")")),ew.createElement(R3,{zIndex:c},ew.createElement(A7,G$({className:r},h),f))}function GV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function GH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?GV(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):GV(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var GW=e=>{var t,{point:n,childIndex:r,mainColor:a,activeDot:i,dataKey:o,clipPath:l}=e;if(!1===i||null==n.x||null==n.y)return null;var s=GH(GH(GH({},{index:r,dataKey:o,cx:n.x,cy:n.y,r:4,fill:null!=a?a:"none",strokeWidth:2,stroke:"#fff",payload:n.payload,value:n.value}),A4(i)),IE(i));return t=(0,ew.isValidElement)(i)?(0,ew.cloneElement)(i,s):"function"==typeof i?i(s):ew.createElement(GD,s),ew.createElement(A7,{className:"recharts-active-dot",clipPath:l},t)};function GU(e){var{points:t,mainColor:n,activeDot:r,itemDataKey:a,clipPath:i,zIndex:o=Nn.activeDot}=e,l=kv(Rm),s=kv(RS);if(null==t||null==s)return null;var c=t.find(e=>s.includes(e.payload));return null==c?null:ew.createElement(R3,{zIndex:o},ew.createElement(GW,{point:c,childIndex:Number(l),mainColor:n,dataKey:a,activeDot:r,clipPath:i}))}function Gq(e,t){var n,r,a=kv(t=>O0(t,e)),i=kv(e=>O5(e,t)),o=null!=(n=null==a?void 0:a.allowDataOverflow)?n:OJ.allowDataOverflow,l=null!=(r=null==i?void 0:i.allowDataOverflow)?r:O1.allowDataOverflow;return{needClip:o||l,needClipX:o,needClipY:l}}function GK(e){var{xAxisId:t,yAxisId:n,clipPathId:r}=e,a=kv(Fc),{needClipX:i,needClipY:o,needClip:l}=Gq(t,n);if(!l||!a)return null;var{x:s,y:c,width:u,height:d}=a;return ew.createElement("clipPath",{id:"clipPath-".concat(r)},ew.createElement("rect",{x:i?s:s-u/2,y:o?c:c-d/2,width:i?u:2*u,height:o?d:2*d}))}function GG(e,t){var n,r;return null!=(n=null==(r=e.graphicalItems.cartesianItems.find(e=>e.id===t))?void 0:r.xAxisId)?n:0}function GX(e,t){var n,r;return null!=(n=null==(r=e.graphicalItems.cartesianItems.find(e=>e.id===t))?void 0:r.yAxisId)?n:0}var GY=(e,t,n)=>AE(e,"xAxis",GG(e,t),n),GZ=(e,t,n)=>AM(e,"xAxis",GG(e,t),n),GJ=(e,t,n)=>AE(e,"yAxis",GX(e,t),n),GQ=(e,t,n)=>AM(e,"yAxis",GX(e,t),n),G0=jc([CT,GY,GJ,GZ,GQ],(e,t,n,r,a)=>jX(e,"xAxis")?j4(t,r,!1):j4(n,a,!1)),G1=jc([Pe,(e,t)=>t],(e,t)=>e.filter(e=>"area"===e.type).find(e=>e.id===t)),G2=e=>jX(CT(e),"xAxis")?"yAxis":"xAxis",G5=jc([G1,(e,t,n)=>PC(e,G2(e),"yAxis"===G2(e)?GX(e,t):GG(e,t),n)],(e,t)=>{if(null!=e&&null!=t){var n,{stackId:r}=e,a=Nj(e);if(null!=r&&null!=a){var i=null==(n=t[r])?void 0:n.stackedData,o=null==i?void 0:i.find(e=>e.key===a);if(null!=o)return o.map(e=>[e[0],e[1]])}}}),G4=jc([CT,GY,GJ,GZ,GQ,G5,jp,G0,G1,e=>e.rootProps.baseValue],(e,t,n,r,a,i,o,l,s,c)=>{var u,{chartData:d,dataStartIndex:f,dataEndIndex:h}=o;if(null!=s&&("horizontal"===e||"vertical"===e)&&null!=t&&null!=n&&null!=r&&null!=a&&0!==r.length&&0!==a.length&&null!=l){var{data:p}=s;if(null!=(u=p&&p.length>0?p:null==d?void 0:d.slice(f,h+1)))return function(e){var t,{areaSettings:{connectNulls:n,baseValue:r,dataKey:a},stackedData:i,layout:o,chartBaseValue:l,xAxis:s,yAxis:c,displayedData:u,dataStartIndex:d,xAxisTicks:f,yAxisTicks:h,bandSize:p}=e,m=i&&i.length,g=((e,t,n,r,a)=>{var i=null!=n?n:t;if(jI(i))return i;var o="horizontal"===e?a:r,l=o.scale.domain();if("number"===o.type){var s=Math.max(l[0],l[1]),c=Math.min(l[0],l[1]);return"dataMin"===i?c:"dataMax"===i||s<0?s:Math.max(Math.min(l[0],l[1]),0)}return"dataMin"===i?l[0]:"dataMax"===i?l[1]:l[0]})(o,l,r,s,c),v="horizontal"===o,x=!1,y=u.map((e,t)=>{if(m)u=i[d+t];else{var r,o,l,u,y,b=jG(e,a);Array.isArray(b)?(u=b,x=!0):u=[g,b]}var w=null!=(r=null==(o=u)?void 0:o[1])?r:null,j=null==w||m&&!n&&null==jG(e,a);return v?{x:j0({axis:s,ticks:f,bandSize:p,entry:e,index:t}),y:j?null:null!=(y=c.scale.map(w))?y:null,value:u,payload:e}:{x:j?null:null!=(l=s.scale.map(w))?l:null,y:j0({axis:c,ticks:h,bandSize:p,entry:e,index:t}),value:u,payload:e}});return t=m||x?y.map(e=>{var t,n,r=Array.isArray(e.value)?e.value[0]:null;return v?{x:e.x,y:null!=r&&null!=e.y&&null!=(n=c.scale.map(r))?n:null,payload:e.payload}:{x:null!=r&&null!=(t=s.scale.map(r))?t:null,y:e.y,payload:e.payload}}):v?c.scale.map(g):s.scale.map(g),{points:y,baseLine:null!=t?t:0,isRange:x}}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:a,dataStartIndex:f,areaSettings:s,stackedData:i,displayedData:u,chartBaseValue:c,bandSize:l})}});function G3(e){var t=A4(e);if(null!=t){var{r:n,strokeWidth:r}=t,a=Number(n),i=Number(r);return(Number.isNaN(a)||a<0)&&(a=3),(Number.isNaN(i)||i<0)&&(i=2),{r:a,strokeWidth:i}}return{r:3,strokeWidth:2}}var G6=["id"],G8=["activeDot","animationBegin","animationDuration","animationEasing","connectNulls","dot","fill","fillOpacity","hide","isAnimationActive","legendType","stroke","xAxisId","yAxisId"];function G7(){return(G7=Object.assign.bind()).apply(null,arguments)}function G9(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Xe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Xt(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Xe(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Xn(e,t){return e&&"none"!==e?e:t}var Xr=Gz.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:a,fill:i,name:o,hide:l,unit:s,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,getPosition:jV,settings:{stroke:r,strokeWidth:a,fill:i,dataKey:t,nameKey:void 0,name:j6(o,t),hide:l,type:c,color:Xn(r,i),unit:s,graphicalItemId:u}};return Gz.createElement(Dw,{tooltipEntrySettings:d})});function Xa(e){var{clipPathId:t,points:n,props:r}=e,{needClip:a,dot:i,dataKey:o}=r,l=A5(r);return Gz.createElement(GB,{points:n,dot:i,className:"recharts-area-dots",dotClassName:"recharts-area-dot",dataKey:o,baseProps:l,needClip:a,clipPathId:t})}function Xi(e){var{showLabels:t,children:n,points:r}=e,a=r.map(e=>{var t,n,r={x:null!=(t=e.x)?t:0,y:null!=(n=e.y)?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return Xt(Xt({},r),{},{value:e.value,payload:e.payload,parentViewBox:void 0,viewBox:r,fill:void 0})});return Gz.createElement(Ty,{value:t?a:void 0},n)}function Xo(e){var{points:t,baseLine:n,needClip:r,clipPathId:a,props:i}=e,{layout:o,type:l,stroke:s,connectNulls:c,isRange:u}=i,{id:d}=i,f=G9(i,G6),h=A5(f),p=A3(f);return Gz.createElement(Gz.Fragment,null,(null==t?void 0:t.length)>1&&Gz.createElement(A7,{clipPath:r?"url(#clipPath-".concat(a,")"):void 0},Gz.createElement(IL,G7({},p,{id:d,points:t,connectNulls:c,type:l,baseLine:n,layout:o,stroke:"none",className:"recharts-area-area"})),"none"!==s&&Gz.createElement(IL,G7({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:c,fill:"none",points:t})),"none"!==s&&u&&Array.isArray(n)&&Gz.createElement(IL,G7({},h,{className:"recharts-area-curve",layout:o,type:l,connectNulls:c,fill:"none",points:n}))),Gz.createElement(Xa,{points:t,props:f,clipPathId:a}))}function Xl(e){var t,n,{alpha:r,baseLine:a,points:i,strokeWidth:o}=e,l=null==(t=i[0])?void 0:t.y,s=null==(n=i[i.length-1])?void 0:n.y;if(!jW(l)||!jW(s))return null;var c=r*Math.abs(l-s),u=Math.max(...i.map(e=>e.x||0));return(jI(a)?u=Math.max(a,u):a&&Array.isArray(a)&&a.length&&(u=Math.max(...a.map(e=>e.x||0),u)),jI(u))?Gz.createElement("rect",{x:0,y:l<s?l:l-c,width:u+(o?parseInt("".concat(o),10):1),height:Math.floor(c)}):null}function Xs(e){var t,n,{alpha:r,baseLine:a,points:i,strokeWidth:o}=e,l=null==(t=i[0])?void 0:t.x,s=null==(n=i[i.length-1])?void 0:n.x;if(!jW(l)||!jW(s))return null;var c=r*Math.abs(l-s),u=Math.max(...i.map(e=>e.y||0));return(jI(a)?u=Math.max(a,u):a&&Array.isArray(a)&&a.length&&(u=Math.max(...a.map(e=>e.y||0),u)),jI(u))?Gz.createElement("rect",{x:l<s?l:l-c,y:0,width:c,height:Math.floor(u+(o?parseInt("".concat(o),10):1))}):null}function Xc(e){var{alpha:t,layout:n,points:r,baseLine:a,strokeWidth:i}=e;return"vertical"===n?Gz.createElement(Xl,{alpha:t,points:r,baseLine:a,strokeWidth:i}):Gz.createElement(Xs,{alpha:t,points:r,baseLine:a,strokeWidth:i})}function Xu(e){var{needClip:t,clipPathId:n,props:r,previousPointsRef:a,previousBaselineRef:i}=e,{points:o,baseLine:l,isAnimationActive:s,animationBegin:c,animationDuration:u,animationEasing:d,onAnimationStart:f,onAnimationEnd:h}=r,p=zF((0,Gz.useMemo)(()=>({points:o,baseLine:l}),[o,l]),"recharts-area-"),m=CL(),[g,v]=(0,Gz.useState)(!1),x=(0,Gz.useCallback)(()=>{"function"==typeof h&&h(),v(!1)},[h]),y=(0,Gz.useCallback)(()=>{"function"==typeof f&&f(),v(!0)},[f]);if(null==m)return null;var b=a.current,w=i.current;return Gz.createElement(Xi,{showLabels:!g,points:o},r.children,Gz.createElement(z$,{animationId:p,begin:c,duration:u,isActive:s,easing:d,onAnimationEnd:x,onAnimationStart:y,key:p},e=>{if(b){var c,u=b.length/o.length,d=1===e?o:o.map((t,n)=>{var r=Math.floor(n*u);if(b[r]){var a=b[r];return Xt(Xt({},t),{},{x:jL(a.x,t.x,e),y:jL(a.y,t.y,e)})}return t});if(jI(l))c=jL(w,l,e);else c=null==l||jP(l)?jL(w,0,e):l.map((t,n)=>{var r=Math.floor(n*u);if(Array.isArray(w)&&w[r]){var a=w[r];return Xt(Xt({},t),{},{x:jL(a.x,t.x,e),y:jL(a.y,t.y,e)})}return t});return e>0&&(a.current=d,i.current=c),Gz.createElement(Xo,{points:d,baseLine:c,needClip:t,clipPathId:n,props:r})}return e>0&&(a.current=o,i.current=l),Gz.createElement(A7,null,s&&Gz.createElement("defs",null,Gz.createElement("clipPath",{id:"animationClipPath-".concat(n)},Gz.createElement(Xc,{alpha:e,points:o,baseLine:l,layout:m,strokeWidth:r.strokeWidth}))),Gz.createElement(A7,{clipPath:"url(#animationClipPath-".concat(n,")")},Gz.createElement(Xo,{points:o,baseLine:l,needClip:t,clipPathId:n,props:r})))}),Gz.createElement(Tk,{label:r.label}))}function Xd(e){var{needClip:t,clipPathId:n,props:r}=e,a=(0,Gz.useRef)(null),i=(0,Gz.useRef)();return Gz.createElement(Xu,{needClip:t,clipPathId:n,props:r,previousPointsRef:a,previousBaselineRef:i})}class Xf extends Gz.PureComponent{render(){var{hide:e,dot:t,points:n,className:r,top:a,left:i,needClip:o,xAxisId:l,yAxisId:s,width:c,height:u,id:d,baseLine:f,zIndex:h}=this.props;if(e)return null;var p=(0,w1.clsx)("recharts-area",r),{r:m,strokeWidth:g}=G3(t),v=zg(t),x=2*m+g,y=o?"url(#clipPath-".concat(v?"":"dots-").concat(d,")"):void 0;return Gz.createElement(R3,{zIndex:h},Gz.createElement(A7,{className:p},o&&Gz.createElement("defs",null,Gz.createElement(GK,{clipPathId:d,xAxisId:l,yAxisId:s}),!v&&Gz.createElement("clipPath",{id:"clipPath-dots-".concat(d)},Gz.createElement("rect",{x:i-x/2,y:a-x/2,width:c+x,height:u+x}))),Gz.createElement(Xd,{needClip:o,clipPathId:d,props:this.props})),Gz.createElement(GU,{points:n,mainColor:Xn(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:y}),this.props.isRange&&Array.isArray(f)&&Gz.createElement(GU,{points:f,mainColor:Xn(this.props.stroke,this.props.fill),itemDataKey:this.props.dataKey,activeDot:this.props.activeDot,clipPath:y}))}}var Xh={activeDot:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!1,fill:"#3182bd",fillOpacity:.6,hide:!1,isAnimationActive:"auto",legendType:"line",stroke:"#3182bd",strokeWidth:1,type:"linear",label:!1,xAxisId:0,yAxisId:0,zIndex:Nn.area};function Xp(e){var t,{activeDot:n,animationBegin:r,animationDuration:a,animationEasing:i,connectNulls:o,dot:l,fill:s,fillOpacity:c,hide:u,isAnimationActive:d,legendType:f,stroke:h,xAxisId:p,yAxisId:m}=e,g=G9(e,G8),v=kv(CT),x=kv(C5),{needClip:y}=Gq(p,m),b=Cf(),{points:w,isRange:j,baseLine:k}=null!=(t=kv(t=>G4(t,e.id,b)))?t:{},S=kv(Fc);if("horizontal"!==v&&"vertical"!==v||null==S||"AreaChart"!==x&&"ComposedChart"!==x)return null;var{height:C,width:N,x:M,y:E}=S;return w&&w.length?Gz.createElement(Xf,G7({},g,{activeDot:n,animationBegin:r,animationDuration:a,animationEasing:i,baseLine:k,connectNulls:o,dot:l,fill:s,fillOpacity:c,height:C,hide:u,layout:v,isAnimationActive:d,isRange:j,legendType:f,needClip:y,points:w,stroke:h,width:N,left:M,top:E,xAxisId:p,yAxisId:m})):null}var Xm=Gz.memo(function(e){var t=I4(e,Xh),n=Cf();return Gz.createElement(RR,{id:t.id,type:"area"},e=>Gz.createElement(Gz.Fragment,null,Gz.createElement(RI,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,fill:a,legendType:i,hide:o}=e;return[{inactive:o,dataKey:t,type:i,color:Xn(r,a),value:j6(n,t),payload:e}]})(t)}),Gz.createElement(Xr,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),Gz.createElement(RU,{type:"area",id:e,data:t.data,dataKey:t.dataKey,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,stackId:jQ(t.stackId),hide:t.hide,barSize:void 0,baseValue:t.baseValue,isPanorama:n,connectNulls:t.connectNulls}),Gz.createElement(Xp,G7({},t,{id:e}))))},$T);function Xg(){return(Xg=Object.assign.bind()).apply(null,arguments)}function Xv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}Xm.displayName="Area";var Xx=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Xv(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Xv(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:{top:5,right:5,bottom:5,left:5},responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},$C),Xy=(0,ew.forwardRef)(function(e,t){var n,r=I4(e.categoricalChartProps,Xx),{chartName:a,defaultTooltipEventType:i,validateTooltipEventTypes:o,tooltipPayloadSearcher:l,categoricalChartProps:s}=e;return ew.createElement($_,{preloadedState:{options:{chartName:a,defaultTooltipEventType:i,validateTooltipEventTypes:o,tooltipPayloadSearcher:l,eventEmitter:void 0}},reduxStoreName:null!=(n=s.id)?n:a},ew.createElement($D,{chartData:s.data}),ew.createElement($L,{layout:r.layout,margin:r.margin}),ew.createElement($F,{throttleDelay:r.throttleDelay,throttledEvents:r.throttledEvents}),ew.createElement($$,{baseValue:r.baseValue,accessibilityLayer:r.accessibilityLayer,barCategoryGap:r.barCategoryGap,maxBarSize:r.maxBarSize,stackOffset:r.stackOffset,barGap:r.barGap,barSize:r.barSize,syncId:r.syncId,syncMethod:r.syncMethod,className:r.className,reverseStackOrder:r.reverseStackOrder}),ew.createElement(Fh,Xg({},r,{ref:t})))}),Xb=["axis"],Xw=(0,ew.forwardRef)((e,t)=>ew.createElement(Xy,{chartName:"AreaChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:Xb,tooltipPayloadSearcher:TH,categoricalChartProps:e,ref:t})),Xj=function(e){var{width:t,height:n}=e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,a=(r%180+180)%180*Math.PI/180,i=Math.atan(n/t);return Math.abs(a>i&&a<Math.PI-i?n/Math.sin(a):t/Math.cos(a))};function Xk(e,t){if(t<1)return[];if(1===t)return e;for(var n=[],r=0;r<e.length;r+=t){var a=e[r];void 0!==a&&n.push(a)}return n}function XS(e,t,n,r,a){if(e*t<e*r||e*t>e*a)return!1;var i=n();return e*(t-e*i/2-r)>=0&&e*(t+e*i/2-a)<=0}function XC(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function XN(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?XC(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XC(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function XM(e,t,n){var r,{tick:a,ticks:i,viewBox:o,minTickGap:l,orientation:s,interval:c,tickFormatter:u,unit:d,angle:f}=e;if(!i||!i.length||!a)return[];if(jI(c)||I$.isSsr)return null!=(r=Xk(i,(jI(c)?c:0)+1))?r:[];var h="top"===s||"bottom"===s?"width":"height",p=d&&"width"===h?Iq(d,{fontSize:t,letterSpacing:n}):{width:0,height:0},m=(e,r)=>{var a,i="function"==typeof u?u(e.value,r):e.value;return"width"===h?(a=Iq(i,{fontSize:t,letterSpacing:n}),Xj({width:a.width+p.width,height:a.height+p.height},f)):Iq(i,{fontSize:t,letterSpacing:n})[h]},g=i[0],v=i[1],x=i.length>=2&&null!=g&&null!=v?jO(v.coordinate-g.coordinate):1,y=function(e,t,n){var r="width"===n,{x:a,y:i,width:o,height:l}=e;return 1===t?{start:r?a:i,end:r?a+o:i+l}:{start:r?a+o:i+l,end:r?a:i}}(o,x,h);return"equidistantPreserveStart"===c?function(e,t,n,r,a){for(var i,o=(r||[]).slice(),{start:l,end:s}=t,c=0,u=1,d=l;u<=o.length;)if(i=function(){var t,i=null==r?void 0:r[c];if(void 0===i)return{v:Xk(r,u)};var o=c,f=()=>(void 0===t&&(t=n(i,o)),t),h=i.coordinate,p=0===c||XS(e,h,f,d,s);p||(c=0,d=l,u+=1),p&&(d=h+e*(f()/2+a),c+=u)}())return i.v;return[]}(x,y,m,i,l):"equidistantPreserveEnd"===c?function(e,t,n,r,a){var i=(r||[]).slice().length;if(0===i)return[];for(var{start:o,end:l}=t,s=1;s<=i;s++){for(var c,u=(i-1)%s,d=o,f=!0,h=u;h<i&&(0===(c=function(){var t,i=r[h];if(null==i)return 0;var o=h,s=()=>(void 0===t&&(t=n(i,o)),t),c=i.coordinate,p=h===u||XS(e,c,s,d,l);if(!p)return f=!1,1;p&&(d=c+e*(s()/2+a))}())||1!==c);h+=s);if(f){for(var p=[],m=u;m<i;m+=s){var g=r[m];null!=g&&p.push(g)}return p}}return[]}(x,y,m,i,l):("preserveStart"===c||"preserveStartEnd"===c?function(e,t,n,r,a,i){var o=(r||[]).slice(),l=o.length,{start:s,end:c}=t;if(i){var u=r[l-1];if(null!=u){var d=n(u,l-1),f=e*(u.coordinate+e*d/2-c);o[l-1]=u=XN(XN({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),null!=u.tickCoord&&XS(e,u.tickCoord,()=>d,s,c)&&(c=u.tickCoord-e*(d/2+a),o[l-1]=XN(XN({},u),{},{isShow:!0}))}}for(var h=i?l-1:l,p=function(t){var r,i=o[t];if(null==i)return 1;var l=i,u=()=>(void 0===r&&(r=n(i,t)),r);if(0===t){var d=e*(l.coordinate-e*u()/2-s);o[t]=l=XN(XN({},l),{},{tickCoord:d<0?l.coordinate-d*e:l.coordinate})}else o[t]=l=XN(XN({},l),{},{tickCoord:l.coordinate});null!=l.tickCoord&&XS(e,l.tickCoord,u,s,c)&&(s=l.tickCoord+e*(u()/2+a),o[t]=XN(XN({},l),{},{isShow:!0}))},m=0;m<h;m++)if(p(m))continue;return o}(x,y,m,i,l,"preserveStartEnd"===c):function(e,t,n,r,a){for(var i=(r||[]).slice(),o=i.length,{start:l}=t,{end:s}=t,c=function(t){var r,c=i[t];if(null==c)return 1;var u=c,d=()=>(void 0===r&&(r=n(c,t)),r);if(t===o-1){var f=e*(u.coordinate+e*d()/2-s);i[t]=u=XN(XN({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate})}else i[t]=u=XN(XN({},u),{},{tickCoord:u.coordinate});null!=u.tickCoord&&XS(e,u.tickCoord,d,l,s)&&(s=u.tickCoord-e*(d()/2+a),i[t]=XN(XN({},u),{},{isShow:!0}))},u=o-1;u>=0;u--)if(c(u))continue;return i}(x,y,m,i,l)).filter(e=>e.isShow)}var XE=["axisLine","width","height","className","hide","ticks","axisType","axisId"];function XO(){return(XO=Object.assign.bind()).apply(null,arguments)}function XP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function XA(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?XP(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var XI={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:Nn.axis};function Xz(e){var{x:t,y:n,width:r,height:a,orientation:i,mirror:o,axisLine:l,otherSvgProps:s}=e;if(!l)return null;var c=XA(XA(XA({},s),A5(l)),{},{fill:"none"});if("top"===i||"bottom"===i){var u=+("top"===i&&!o||"bottom"===i&&o);c=XA(XA({},c),{},{x1:t,y1:n+u*a,x2:t+r,y2:n+u*a})}else{var d=+("left"===i&&!o||"right"===i&&o);c=XA(XA({},c),{},{x1:t+d*r,y1:n,x2:t+d*r,y2:n+a})}return ew.createElement("line",XO({},c,{className:(0,w1.clsx)("recharts-cartesian-axis-line",(0,w0.default)(l,"className"))}))}function X_(e){var t,{option:n,tickProps:r,value:a}=e,i=(0,w1.clsx)(r.className,"recharts-cartesian-axis-tick-value");if(ew.isValidElement(n))t=ew.cloneElement(n,XA(XA({},r),{},{className:i}));else if("function"==typeof n)t=n(XA(XA({},r),{},{className:i}));else{var o="recharts-cartesian-axis-tick-value";"boolean"!=typeof n&&(o=(0,w1.clsx)(o,TS(n))),t=ew.createElement(zs,XO({},r,{className:o}),a)}return t}function XD(e){var{ticks:t,axisType:n,axisId:r}=e,a=kh();return(0,ew.useEffect)(()=>null==r||null==n?jV:(a($P({ticks:t.map(e=>({value:e.value,coordinate:e.coordinate,offset:e.offset,index:e.index})),axisId:r,axisType:n})),()=>{a($A({axisId:r,axisType:n}))}),[a,t,r,n]),null}var XR=(0,ew.forwardRef)((e,t)=>{var{ticks:n=[],tick:r,tickLine:a,stroke:i,tickFormatter:o,unit:l,padding:s,tickTextProps:c,orientation:u,mirror:d,x:f,y:h,width:p,height:m,tickSize:g,tickMargin:v,fontSize:x,letterSpacing:y,getTicksConfig:b,events:w,axisType:j,axisId:k}=e,S=XM(XA(XA({},b),{},{ticks:n}),x,y),C=A5(b),N=A4(r),M=zt(C.textAnchor)?C.textAnchor:function(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}(u,d),E=function(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}(u,d),O={};"object"==typeof a&&(O=a);var P=XA(XA({},C),{},{fill:"none"},O),A=S.map(e=>XA({entry:e},function(e,t,n,r,a,i,o,l,s){var c,u,d,f,h,p,m=l?-1:1,g=e.tickSize||o,v=jI(e.tickCoord)?e.tickCoord:e.coordinate;switch(i){case"top":c=u=e.coordinate,p=(d=(f=n+!l*a)-m*g)-m*s,h=v;break;case"left":d=f=e.coordinate,h=(c=(u=t+!l*r)-m*g)-m*s,p=v;break;case"right":d=f=e.coordinate,h=(c=(u=t+l*r)+m*g)+m*s,p=v;break;default:c=u=e.coordinate,p=(d=(f=n+l*a)+m*g)+m*s,h=v}return{line:{x1:c,y1:d,x2:u,y2:f},tick:{x:h,y:p}}}(e,f,h,p,m,u,g,d,v))),I=A.map(e=>{var{entry:t,line:n}=e;return ew.createElement(A7,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(t.value,"-").concat(t.coordinate,"-").concat(t.tickCoord)},a&&ew.createElement("line",XO({},P,n,{className:(0,w1.clsx)("recharts-cartesian-axis-tick-line",(0,w0.default)(a,"className"))})))}),z=A.map((e,t)=>{var n,a,{entry:u,tick:d}=e,f=XA(XA(XA(XA({verticalAnchor:E},C),{},{textAnchor:M,stroke:"none",fill:i},d),{},{index:t,payload:u,visibleTicksCount:S.length,tickFormatter:o,padding:s},c),{},{angle:null!=(n=null!=(a=null==c?void 0:c.angle)?a:C.angle)?n:0}),h=XA(XA({},f),N);return ew.createElement(A7,XO({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(u.value,"-").concat(u.coordinate,"-").concat(u.tickCoord)},IO(w,u,t)),r&&ew.createElement(X_,{option:r,tickProps:h,value:"".concat("function"==typeof o?o(u.value,t):u.value).concat(l||"")}))});return ew.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(j,"-ticks")},ew.createElement(XD,{ticks:S,axisId:k,axisType:j}),z.length>0&&ew.createElement(R3,{zIndex:Nn.label},ew.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(j,"-tick-labels"),ref:t},z)),I.length>0&&ew.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(j,"-tick-lines")},I))}),XT=(0,ew.forwardRef)((e,t)=>{var{axisLine:n,width:r,height:a,className:i,hide:o,ticks:l,axisType:s,axisId:c}=e,u=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,XE),[d,f]=(0,ew.useState)(""),[h,p]=(0,ew.useState)(""),m=(0,ew.useRef)(null);(0,ew.useImperativeHandle)(t,()=>({getCalculatedWidth:()=>{var t;return(e=>{var{ticks:t,label:n,labelGapWithTick:r=5,tickSize:a=0,tickMargin:i=0}=e,o=0;if(t){Array.from(t).forEach(e=>{if(e){var t=e.getBoundingClientRect();t.width>o&&(o=t.width)}});var l=n?n.getBoundingClientRect().width:0;return Math.round(o+(a+i)+l+(n?r:0))}return 0})({ticks:m.current,label:null==(t=e.labelRef)?void 0:t.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var g=(0,ew.useCallback)(e=>{if(e){var t=e.getElementsByClassName("recharts-cartesian-axis-tick-value");m.current=t;var n=t[0];if(n){var r=window.getComputedStyle(n),a=r.fontSize,i=r.letterSpacing;(a!==d||i!==h)&&(f(a),p(i))}}},[d,h]);return o||null!=r&&r<=0||null!=a&&a<=0?null:ew.createElement(R3,{zIndex:e.zIndex},ew.createElement(A7,{className:(0,w1.clsx)("recharts-cartesian-axis",i)},ew.createElement(Xz,{x:e.x,y:e.y,width:r,height:a,orientation:e.orientation,mirror:e.mirror,axisLine:n,otherSvgProps:A5(e)}),ew.createElement(XR,{ref:g,axisType:s,events:u,fontSize:d,getTicksConfig:e,height:e.height,letterSpacing:h,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:l,unit:e.unit,width:e.width,x:e.x,y:e.y,axisId:c}),ew.createElement(Ti,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},ew.createElement(Tf,{label:e.label,labelRef:e.labelRef}),e.children)))}),XL=ew.forwardRef((e,t)=>{var n=I4(e,XI);return ew.createElement(XT,XO({},n,{ref:t}))});XL.displayName="CartesianAxis";var X$=["x1","y1","x2","y2","key"],XF=["offset"],XB=["xAxisId","yAxisId"],XV=["xAxisId","yAxisId"];function XH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function XW(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?XH(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XH(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function XU(){return(XU=Object.assign.bind()).apply(null,arguments)}function Xq(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var XK=e=>{var{fill:t}=e;if(!t||"none"===t)return null;var{fillOpacity:n,x:r,y:a,width:i,height:o,ry:l}=e;return ew.createElement("rect",{x:r,y:a,ry:l,width:i,height:o,stroke:"none",fill:t,fillOpacity:n,className:"recharts-cartesian-grid-bg"})};function XG(e){var{option:t,lineItemProps:n}=e;if(ew.isValidElement(t))r=ew.cloneElement(t,n);else if("function"==typeof t)r=t(n);else{var r,a,{x1:i,y1:o,x2:l,y2:s,key:c}=n,u=null!=(a=A5(Xq(n,X$)))?a:{},{offset:d}=u,f=Xq(u,XF);r=ew.createElement("line",XU({},f,{x1:i,y1:o,x2:l,y2:s,fill:"none",key:c}))}return r}function XX(e){var{x:t,width:n,horizontal:r=!0,horizontalPoints:a}=e;if(!r||!a||!a.length)return null;var{xAxisId:i,yAxisId:o}=e,l=Xq(e,XB),s=a.map((e,a)=>{var i=XW(XW({},l),{},{x1:t,y1:e,x2:t+n,y2:e,key:"line-".concat(a),index:a});return ew.createElement(XG,{key:"line-".concat(a),option:r,lineItemProps:i})});return ew.createElement("g",{className:"recharts-cartesian-grid-horizontal"},s)}function XY(e){var{y:t,height:n,vertical:r=!0,verticalPoints:a}=e;if(!r||!a||!a.length)return null;var{xAxisId:i,yAxisId:o}=e,l=Xq(e,XV),s=a.map((e,a)=>{var i=XW(XW({},l),{},{x1:e,y1:t,x2:e,y2:t+n,key:"line-".concat(a),index:a});return ew.createElement(XG,{option:r,lineItemProps:i,key:"line-".concat(a)})});return ew.createElement("g",{className:"recharts-cartesian-grid-vertical"},s)}function XZ(e){var{horizontalFill:t,fillOpacity:n,x:r,y:a,width:i,height:o,horizontalPoints:l,horizontal:s=!0}=e;if(!s||!t||!t.length||null==l)return null;var c=l.map(e=>Math.round(e+a-a)).sort((e,t)=>e-t);a!==c[0]&&c.unshift(0);var u=c.map((e,l)=>{var s=c[l+1],u=null==s?a+o-e:s-e;if(u<=0)return null;var d=l%t.length;return ew.createElement("rect",{key:"react-".concat(l),y:e,x:r,height:u,width:i,stroke:"none",fill:t[d],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return ew.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},u)}function XJ(e){var{vertical:t=!0,verticalFill:n,fillOpacity:r,x:a,y:i,width:o,height:l,verticalPoints:s}=e;if(!t||!n||!n.length)return null;var c=s.map(e=>Math.round(e+a-a)).sort((e,t)=>e-t);a!==c[0]&&c.unshift(0);var u=c.map((e,t)=>{var s=c[t+1],u=null==s?a+o-e:s-e;if(u<=0)return null;var d=t%n.length;return ew.createElement("rect",{key:"react-".concat(t),x:e,y:i,width:u,height:l,stroke:"none",fill:n[d],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return ew.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},u)}var XQ=(e,t)=>{var{xAxis:n,width:r,height:a,offset:i}=e;return jY(XM(XW(XW(XW({},XI),n),{},{ticks:jZ(n,!0),viewBox:{x:0,y:0,width:r,height:a}})),i.left,i.left+i.width,t)},X0=(e,t)=>{var{yAxis:n,width:r,height:a,offset:i}=e;return jY(XM(XW(XW(XW({},XI),n),{},{ticks:jZ(n,!0),viewBox:{x:0,y:0,width:r,height:a}})),i.top,i.top+i.height,t)},X1={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Nn.grid};function X2(e){var t=kv(j8),n=kv(j7),r=CR(),a=XW(XW({},I4(e,X1)),{},{x:jI(e.x)?e.x:r.left,y:jI(e.y)?e.y:r.top,width:jI(e.width)?e.width:r.width,height:jI(e.height)?e.height:r.height}),{xAxisId:i,yAxisId:o,x:l,y:s,width:c,height:u,syncWithTicks:d,horizontalValues:f,verticalValues:h}=a,p=Cf(),m=kv(e=>AC(e,"xAxis",i,p)),g=kv(e=>AC(e,"yAxis",o,p));if(!jU(c)||!jU(u)||!jI(l)||!jI(s))return null;var v=a.verticalCoordinatesGenerator||XQ,x=a.horizontalCoordinatesGenerator||X0,{horizontalPoints:y,verticalPoints:b}=a;if((!y||!y.length)&&"function"==typeof x){var w=f&&f.length,j=x({yAxis:g?XW(XW({},g),{},{ticks:w?f:g.ticks}):void 0,width:null!=t?t:c,height:null!=n?n:u,offset:r},!!w||d);Cg(Array.isArray(j),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof j,"]")),Array.isArray(j)&&(y=j)}if((!b||!b.length)&&"function"==typeof v){var k=h&&h.length,S=v({xAxis:m?XW(XW({},m),{},{ticks:k?h:m.ticks}):void 0,width:null!=t?t:c,height:null!=n?n:u,offset:r},!!k||d);Cg(Array.isArray(S),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof S,"]")),Array.isArray(S)&&(b=S)}return ew.createElement(R3,{zIndex:a.zIndex},ew.createElement("g",{className:"recharts-cartesian-grid"},ew.createElement(XK,{fill:a.fill,fillOpacity:a.fillOpacity,x:a.x,y:a.y,width:a.width,height:a.height,ry:a.ry}),ew.createElement(XZ,XU({},a,{horizontalPoints:y})),ew.createElement(XJ,XU({},a,{verticalPoints:b})),ew.createElement(XX,XU({},a,{offset:r,horizontalPoints:y,xAxis:m,yAxis:g})),ew.createElement(XY,XU({},a,{offset:r,verticalPoints:b,xAxis:m,yAxis:g}))))}X2.displayName="CartesianGrid";var X5=["domain","range"],X4=["domain","range"];function X3(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function X6(e,t){return e===t||!!(Array.isArray(e)&&2===e.length&&Array.isArray(t))&&2===t.length&&e[0]===t[0]&&e[1]===t[1]}function X8(e,t){if(e===t)return!0;var{domain:n,range:r}=e,a=X3(e,X5),{domain:i,range:o}=t,l=X3(t,X4);return!!X6(n,i)&&!!X6(r,o)&&$T(a,l)}var X7=["type"],X9=["dangerouslySetInnerHTML","ticks","scale"],Ye=["id","scale"];function Yt(){return(Yt=Object.assign.bind()).apply(null,arguments)}function Yn(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Yr(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yn(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yn(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ya(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Yi(e){var t=kh(),n=(0,ew.useRef)(null),r=CL(),{type:a}=e,i=Ya(e,X7),o=No(r,"xAxis",a),l=(0,ew.useMemo)(()=>{if(null!=o)return Yr(Yr({},i),{},{type:o})},[i,o]);return(0,ew.useLayoutEffect)(()=>{null!=l&&(null===n.current?t(LM(l)):n.current!==l&&t(LE({prev:n.current,next:l})),n.current=l)},[l,t]),(0,ew.useLayoutEffect)(()=>()=>{n.current&&(t(LO(n.current)),n.current=null)},[t]),null}var Yo=e=>{var{xAxisId:t,className:n}=e,r=kv(kc),a=Cf(),i="xAxis",o=kv(e=>AN(e,i,t,a)),l=kv(e=>Ag(e,t)),s=kv(e=>Ay(e,t)),c=kv(e=>OQ(e,t));if(null==l||null==s||null==c)return null;var{dangerouslySetInnerHTML:u,ticks:d,scale:f}=e,h=Ya(e,X9),{id:p,scale:m}=c,g=Ya(c,Ye);return ew.createElement(XL,Yt({},h,g,{x:s.x,y:s.y,width:l.width,height:l.height,className:(0,w1.clsx)("recharts-".concat(i," ").concat(i),n),viewBox:r,ticks:o,axisType:i,axisId:t}))},Yl={allowDataOverflow:OJ.allowDataOverflow,allowDecimals:OJ.allowDecimals,allowDuplicatedCategory:OJ.allowDuplicatedCategory,angle:OJ.angle,axisLine:XI.axisLine,height:OJ.height,hide:!1,includeHidden:OJ.includeHidden,interval:OJ.interval,label:!1,minTickGap:OJ.minTickGap,mirror:OJ.mirror,orientation:OJ.orientation,padding:OJ.padding,reversed:OJ.reversed,scale:OJ.scale,tick:OJ.tick,tickCount:OJ.tickCount,tickLine:XI.tickLine,tickSize:XI.tickSize,type:OJ.type,niceTicks:OJ.niceTicks,xAxisId:0},Ys=ew.memo(e=>{var t=I4(e,Yl);return ew.createElement(ew.Fragment,null,ew.createElement(Yi,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,niceTicks:t.niceTicks}),ew.createElement(Yo,t))},X8);Ys.displayName="XAxis";var Yc=["type"],Yu=["dangerouslySetInnerHTML","ticks","scale"],Yd=["id","scale"];function Yf(){return(Yf=Object.assign.bind()).apply(null,arguments)}function Yh(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Yp(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Yh(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Yh(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ym(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Yg(e){var t=kh(),n=(0,ew.useRef)(null),r=CL(),{type:a}=e,i=Ym(e,Yc),o=No(r,"yAxis",a),l=(0,ew.useMemo)(()=>{if(null!=o)return Yp(Yp({},i),{},{type:o})},[o,i]);return(0,ew.useLayoutEffect)(()=>{null!=l&&(null===n.current?t(LP(l)):n.current!==l&&t(LA({prev:n.current,next:l})),n.current=l)},[l,t]),(0,ew.useLayoutEffect)(()=>()=>{n.current&&(t(LI(n.current)),n.current=null)},[t]),null}function Yv(e){var{yAxisId:t,className:n,width:r,label:a}=e,i=(0,ew.useRef)(null),o=(0,ew.useRef)(null),l=kv(kc),s=Cf(),c=kh(),u="yAxis",d=kv(e=>Aw(e,t)),f=kv(e=>Ab(e,t)),h=kv(e=>AN(e,u,t,s)),p=kv(e=>O2(e,t));if((0,ew.useLayoutEffect)(()=>{if(!("auto"!==r||!d||Ts(a)||(0,ew.isValidElement)(a))&&null!=p){var e=i.current;if(e){var n=e.getCalculatedWidth();Math.round(d.width)!==Math.round(n)&&c(LR({id:t,width:n}))}}},[h,d,c,a,t,r,p]),null==d||null==f||null==p)return null;var{dangerouslySetInnerHTML:m,ticks:g,scale:v}=e,x=Ym(e,Yu),{id:y,scale:b}=p,w=Ym(p,Yd);return ew.createElement(XL,Yf({},x,w,{ref:i,labelRef:o,x:f.x,y:f.y,tickTextProps:"auto"===r?{width:void 0}:{width:r},width:d.width,height:d.height,className:(0,w1.clsx)("recharts-".concat(u," ").concat(u),n),viewBox:l,ticks:h,axisType:u,axisId:t}))}var Yx={allowDataOverflow:O1.allowDataOverflow,allowDecimals:O1.allowDecimals,allowDuplicatedCategory:O1.allowDuplicatedCategory,angle:O1.angle,axisLine:XI.axisLine,hide:!1,includeHidden:O1.includeHidden,interval:O1.interval,label:!1,minTickGap:O1.minTickGap,mirror:O1.mirror,orientation:O1.orientation,padding:O1.padding,reversed:O1.reversed,scale:O1.scale,tick:O1.tick,tickCount:O1.tickCount,tickLine:XI.tickLine,tickSize:XI.tickSize,type:O1.type,niceTicks:O1.niceTicks,width:O1.width,yAxisId:0},Yy=ew.memo(e=>{var t=I4(e,Yx);return ew.createElement(ew.Fragment,null,ew.createElement(Yg,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter,niceTicks:t.niceTicks}),ew.createElement(Yv,t))},X8);function Yb({machines:e,defaultMachineId:t,className:n,...r}){let[a,i]=ew.useState(t??e[0]?.id),o=e.find(e=>e.id===a)??e[0],[l,s]=ew.useState({});if(!o)return null;let c=l[o.id]??o.selectedMetricId??o.metrics[0]?.id,u=o.metrics.find(e=>e.id===c)??o.metrics[0];return(0,ey.jsxs)("div",{className:(0,eI.cn)("vtl-surface-card flex h-full min-h-0 flex-col rounded-[var(--surface-card-radius)] border","vtl-performance-monitor",n),...r,children:[(0,ey.jsx)(hQ,{value:o.id,onValueChange:i,className:"shrink-0 px-3 pt-3",children:(0,ey.jsx)(h7,{className:"h-8",children:e.map(e=>(0,ey.jsx)(h9,{value:e.id,children:e.name},e.id))})}),(0,ey.jsxs)("div",{className:"mt-3 grid min-h-0 flex-1 grid-cols-[14rem_minmax(0,1fr)] border-t",children:[(0,ey.jsx)("div",{className:"min-h-0 overflow-auto border-r p-2",children:o.metrics.map(e=>(0,ey.jsxs)("button",{type:"button",onClick:()=>s(t=>({...t,[o.id]:e.id})),className:(0,eI.cn)("grid w-full grid-cols-[3.75rem_minmax(0,1fr)] gap-3 px-2 py-2 text-left transition-colors",e.id===c&&"bg-muted"),children:[(0,ey.jsx)(YN,{data:e.data,color:e.color}),(0,ey.jsxs)("span",{className:"min-w-0",children:[(0,ey.jsx)("span",{className:"block truncate text-base leading-tight",children:e.label}),(0,ey.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.value}),e.detail?(0,ey.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.detail}):null]})]},e.id))}),(0,ey.jsxs)("div",{className:"min-h-0 overflow-auto p-5",children:[(0,ey.jsxs)("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] items-start gap-5",children:[(0,ey.jsxs)("div",{children:[(0,ey.jsx)("h2",{className:"text-4xl leading-none font-semibold tracking-normal",children:u?.title}),u?.subtitle?(0,ey.jsx)("p",{className:"mt-1 text-base text-muted-foreground",children:u.subtitle}):null]}),(0,ey.jsx)("div",{className:"text-right text-sm text-muted-foreground",children:u?.detail})]}),u?(0,ey.jsx)(Yw,{metric:u}):null]})]})]})}function Yw({metric:e}){return"cpu"===e.kind?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(Yj,{panel:{id:"cpu",title:"% 利用率",value:"100%",data:e.data,span:"full"},size:"large"}),(0,ey.jsx)(Yk,{}),(0,ey.jsx)(YC,{details:e.details,columns:4})]}):"memory"===e.kind?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(Yj,{panel:{id:"memory",title:"内存使用量",value:e.detail,data:e.data,span:"full"},size:"large"}),(0,ey.jsx)(Yk,{}),(0,ey.jsx)(YS,{segments:e.composition}),(0,ey.jsx)(YC,{details:e.details,columns:3})]}):"disk"===e.kind?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(Yj,{panel:{id:"disk-active",title:"活动时间",value:"100%",data:e.data,span:"full"},size:"large"}),(0,ey.jsx)(Yk,{}),(0,ey.jsx)(Yj,{panel:{id:"disk-rate",title:"磁盘传输速率",value:"500 KB/秒",data:e.panels?.[0]?.data??e.data,span:"full"},size:"short"}),(0,ey.jsx)(Yk,{}),(0,ey.jsx)(YC,{details:e.details,columns:4})]}):"network"===e.kind?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(Yj,{panel:{id:"network",title:"吞吐量",value:"100 Kbps",data:e.data,span:"full",color:"danger"},size:"tall"}),(0,ey.jsx)(Yk,{}),(0,ey.jsx)(YC,{details:e.details,columns:2})]}):(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("div",{className:"mt-5 grid grid-cols-2 gap-3",children:(e.panels??[]).map(e=>(0,ey.jsx)(Yj,{panel:e},e.id))}),(0,ey.jsx)(YC,{details:e.details,columns:3})]})}function Yj({panel:e,size:t="normal"}){let n={short:"h-[4rem]",normal:"full"===e.span?"h-20":"h-24",large:"h-[17.5rem]",tall:"h-[21.5rem]"}[t];return(0,ey.jsxs)("div",{className:(0,eI.cn)("mt-5","full"===e.span&&"col-span-2"),children:[(0,ey.jsxs)("div",{className:"mb-1 flex items-center justify-between text-sm",children:[(0,ey.jsx)("span",{className:"text-muted-foreground",children:e.title}),e.value?(0,ey.jsx)("span",{className:"text-muted-foreground tabular-nums",children:e.value}):null]}),(0,ey.jsx)(YM,{data:e.data,color:e.color,className:(0,eI.cn)("w-full",n)})]})}function Yk(){return(0,ey.jsxs)("div",{className:"mt-1 flex justify-between text-xs text-muted-foreground",children:[(0,ey.jsx)("span",{children:"60 秒"}),(0,ey.jsx)("span",{children:"0"})]})}function YS({segments:e}){let t=e&&e.length>0?e:[{label:"used",value:64},{label:"available",value:36}];return(0,ey.jsxs)("div",{className:"mt-5",children:[(0,ey.jsx)("div",{className:"mb-1 text-sm text-muted-foreground",children:"内存组合"}),(0,ey.jsx)("div",{className:"flex h-[3.25rem] w-full overflow-hidden border border-primary/75 bg-background",children:t.map((e,n)=>(0,ey.jsx)("div",{className:(0,eI.cn)("h-full border-r border-primary/75 last:border-r-0",0===n?"bg-primary/20":n===t.length-1?"bg-background":"bg-primary/8"),style:{width:`${Math.max(0,e.value)}%`}},`${e.label}-${n}`))})]})}function YC({details:e,columns:t}){return e?.length?(0,ey.jsx)("div",{className:(0,eI.cn)("mt-5 grid gap-x-10 gap-y-4",2===t&&"grid-cols-2",3===t&&"grid-cols-3",4===t&&"grid-cols-4"),children:e.map(([e,t])=>(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("div",{className:"text-xs text-muted-foreground",children:e}),(0,ey.jsx)("div",{className:"truncate text-2xl leading-tight tabular-nums",children:t})]},e))}):null}function YN({data:e,color:t}){return(0,ey.jsx)(YM,{data:e,color:t,className:"h-10 w-full",strokeWidth:1.4,compact:!0})}function YM({data:e,color:t="default",className:n,strokeWidth:r=1.6,compact:a=!1}){let i=ew.useMemo(()=>(e.length>1?e:[0,0]).map((e,t)=>({index:t,value:Math.max(0,Math.min(100,e))})),[e]),o=ew.useMemo(()=>({value:{label:"Value",color:"danger"===t?"var(--destructive)":"var(--foreground)"}}),[t]);return(0,ey.jsx)(Bg,{config:o,className:(0,eI.cn)("aspect-auto border bg-background text-muted-foreground",n),initialDimension:{width:a?96:640,height:a?40:220},children:(0,ey.jsxs)(Xw,{data:i,margin:{top:a?2:6,right:0,bottom:0,left:0},children:[a?null:(0,ey.jsx)(X2,{strokeDasharray:"0",stroke:"var(--border)",strokeOpacity:.7}),(0,ey.jsx)(Ys,{dataKey:"index",hide:!0,domain:["dataMin","dataMax"]}),(0,ey.jsx)(Yy,{hide:!0,domain:[0,100]}),a?null:(0,ey.jsx)(Bx,{cursor:!1,content:(0,ey.jsx)(By,{hideLabel:!0,indicator:"line"})}),(0,ey.jsx)(Xm,{dataKey:"value",type:"monotone",fill:"var(--color-value)",fillOpacity:"danger"===t?.16:.12,stroke:"var(--color-value)",strokeWidth:r,isAnimationActive:!1,dot:!1,activeDot:!1})]})})}Yy.displayName="YAxis";let YE=(0,ek.default)("badge-alert",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),YO=(0,ek.default)("circle-pause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]),YP={name:"名称",cpu:"CPU",memoryMb:"内存",diskMbps:"磁盘",networkMbps:"网络"};function YA({machines:e,defaultMachineId:t,className:n,...r}){let[a,i]=ew.useState(t??e[0]?.id),[o,l]=ew.useState("cpu"),[s,c]=ew.useState("desc"),[u,d]=ew.useState({}),f=e.find(e=>e.id===a)??e[0],h=ew.useMemo(()=>{if(!f)return[];let e=[...function(e){let t=new Map,n=new Map;for(let t of e)void 0!==t.pid&&n.set(t.pid,t);for(let a of e){var r;let e=function e(t,n,r=new Set){void 0!==t.pid&&r.add(t.pid);let a=void 0!==t.parentPid?n.get(t.parentPid):void 0;return!a||void 0===a.pid||r.has(a.pid)||["bash","containerd","dockerd","explorer","init","kernel_task","launchd","services","sh","smss","svchost","system","systemd","wininit","winlogon","zsh"].includes(YT(a))?t:e(a,n,r)}(a,n),i=YT(e),o=t.get(i)??{kind:"group",id:i,name:(r=e,r.appName?.trim()||r.name.trim().replace(/\.(exe|com)$/i,"")||r.id),children:[],status:[],cpu:0,memoryMb:0,diskMbps:0,networkMbps:0};o.children.push(a),o.cpu+=a.cpu,o.memoryMb+=a.memoryMb,o.diskMbps+=a.diskMbps,o.networkMbps+=a.networkMbps,o.status=function(e,t){let n=new Set(e??[]);for(let e of t??[])n.add(e);return Array.from(n)}(o.status,a.status),t.set(i,o)}return Array.from(t.values()).map(e=>({...e,cpu:Y$(Math.min(100,e.cpu)),memoryMb:Y$(e.memoryMb),diskMbps:Y$(e.diskMbps),networkMbps:Y$(e.networkMbps)}))}(f.processes)].sort((e,t)=>YL(e,t,o,s)),t=[];for(let n of e){if(n.children.length<=1){let e=n.children[0];e&&t.push(YR(e,0));continue}if(t.push(n),u[n.id])for(let e of[...n.children].sort((e,t)=>YL(e,t,o,s)))t.push(YR(e,1))}return t},[f,u,s,o]),p=ew.useMemo(()=>h.map(e=>({memoryMb:e.memoryMb,diskMbps:e.diskMbps,networkMbps:e.networkMbps})),[h]);function m(e){e===o?c(e=>"asc"===e?"desc":"asc"):(l(e),c("name"===e?"asc":"desc"))}return f?(0,ey.jsxs)("div",{className:(0,eI.cn)("vtl-surface-card flex h-full min-h-0 flex-col rounded-[var(--surface-card-radius)] border","vtl-process-monitor",n),...r,children:[(0,ey.jsx)(hQ,{value:f.id,onValueChange:i,className:"shrink-0 px-3 pt-3",children:(0,ey.jsx)(h7,{className:"h-8",children:e.map(e=>(0,ey.jsx)(h9,{value:e.id,children:e.name},e.id))})}),(0,ey.jsxs)("div",{className:"mt-3 grid h-14 shrink-0 grid-cols-[minmax(12rem,1fr)_6.25rem_repeat(4,minmax(5rem,7rem))] border-y text-sm",children:[(0,ey.jsxs)("button",{type:"button",onClick:()=>m("name"),className:"flex items-end px-3 pb-2 text-left text-muted-foreground",children:["名称",(0,ey.jsx)(YI,{active:"name"===o,direction:s})]}),(0,ey.jsx)("div",{className:"flex items-end px-3 pb-2 text-muted-foreground",children:"状态"}),["cpu","memoryMb","diskMbps","networkMbps"].map(e=>{var t,n;return(0,ey.jsxs)("button",{type:"button",onClick:()=>m(e),className:"grid content-end border-l px-3 pb-2 text-right",children:[(0,ey.jsx)("span",{className:"text-lg leading-none text-foreground",children:(t=f.totals,"cpu"===(n=e)?`${Math.round(t.cpu)}%`:"memoryMb"===n?`${Math.round(t.memory)}%`:"diskMbps"===n?`${Math.round(t.disk)}%`:"networkMbps"===n?`${Math.round(t.network)}%`:"")}),(0,ey.jsxs)("span",{className:"mt-1 text-xs text-muted-foreground",children:[YP[e],(0,ey.jsx)(YI,{active:o===e,direction:s,className:"ml-1 inline-flex"})]})]},e)})]}),(0,ey.jsx)("div",{className:"vtl-scrollbar-hidden min-h-0 flex-1 overflow-auto",children:h.map(e=>{var t;return(0,ey.jsxs)("div",{className:(0,eI.cn)("grid min-h-9 grid-cols-[minmax(12rem,1fr)_6.25rem_repeat(4,minmax(5rem,7rem))] items-center text-sm","group"===e.kind&&"bg-muted/35"),children:[(0,ey.jsx)(Yz,{row:e,expanded:"group"===e.kind&&!!u[e.id],onToggle:()=>{"group"===e.kind&&d(t=>({...t,[e.id]:!t[e.id]}))}}),(0,ey.jsx)(Y_,{platform:f.platform,status:e.status}),(0,ey.jsx)(YD,{value:e.cpu,max:100,label:`${e.cpu.toFixed(1)}%`}),(0,ey.jsx)(YD,{value:e.memoryMb,max:YF(p,"memoryMb"),label:(t=e.memoryMb)>=1024?`${YB(t/1024)} GB`:`${YB(t)} MB`}),(0,ey.jsx)(YD,{value:e.diskMbps,max:Math.max(1,YF(p,"diskMbps")),label:`${YB(e.diskMbps)} MB/秒`}),(0,ey.jsx)(YD,{value:e.networkMbps,max:Math.max(1,YF(p,"networkMbps")),label:`${YB(e.networkMbps)} Mbps`})]},`${e.kind}-${e.id}`)})})]}):null}function YI({active:e,direction:t,className:n}){return e?(0,ey.jsx)("asc"===t?wK:Wn,{className:(0,eI.cn)("ml-1 size-3",n)}):null}function Yz({row:e,expanded:t,onToggle:n}){if("group"===e.kind){let r=t?gK:pC;return(0,ey.jsxs)("button",{type:"button","aria-expanded":t,onClick:n,className:"flex h-full min-w-0 items-center gap-2 px-3 text-left outline-none transition-colors hover:bg-muted/55 focus-visible:ring-[3px] focus-visible:ring-ring/20",children:[(0,ey.jsx)(r,{className:"size-4 shrink-0 text-muted-foreground"}),(0,ey.jsx)("span",{className:"size-2 rounded-sm bg-foreground/65"}),(0,ey.jsxs)("span",{className:"min-w-0 truncate font-medium",children:[e.name," (",e.children.length,")"]})]})}return(0,ey.jsxs)("div",{className:"flex min-w-0 items-center gap-2 px-3",style:{paddingLeft:e.depth>0?34:void 0},children:[e.depth>0?(0,ey.jsx)("span",{className:"size-1.5 rounded-full bg-muted-foreground/70"}):(0,ey.jsx)("span",{className:"size-1.5 rounded-full bg-foreground/65"}),(0,ey.jsx)("span",{className:(0,eI.cn)("truncate",0===e.depth&&"font-medium"),children:e.name}),e.process.pid?(0,ey.jsx)("span",{className:"shrink-0 ui-text-kbd text-muted-foreground",children:e.process.pid}):null]})}function Y_({platform:e,status:t}){return t?.length?(0,ey.jsxs)("div",{className:"flex items-center gap-1.5 px-3 text-muted-foreground",children:[t.includes("suspended")?(0,ey.jsx)(YO,{"aria-label":"linux"===e?"挂起进程":"挂起",className:"size-4"}):null,t.includes("auto-restart")?(0,ey.jsx)(lH,{"aria-label":"linux"===e?"自动重启进程":"自动重启",className:"size-4"}):null,t.includes("running")?(0,ey.jsx)(YE,{"aria-label":"运行",className:"size-4 text-primary"}):null]}):(0,ey.jsx)("div",{className:"px-3"})}function YD({value:e,max:t,label:n}){let r=Math.min(1,Math.max(0,e/Math.max(1,t))),a=r>.78,i=a?`color-mix(in oklch, var(--destructive) ${Math.round(18+42*r)}%, var(--background))`:`color-mix(in oklch, var(--foreground) ${Math.round(5+20*r)}%, var(--background))`;return(0,ey.jsx)("div",{className:"vtl-process-heat-cell h-full border-l px-3 text-right tabular-nums","data-hot":a?"":void 0,style:{background:i},children:(0,ey.jsx)("span",{className:(0,eI.cn)("leading-9",a&&"text-destructive"),children:n})})}function YR(e,t){return{kind:"process",id:e.id,process:e,depth:t,name:e.appName&&0===t?e.appName:e.name,status:e.status,cpu:e.cpu,memoryMb:e.memoryMb,diskMbps:e.diskMbps,networkMbps:e.networkMbps}}function YT(e){return e.appId?.trim().toLowerCase()||e.appName?.trim().toLowerCase()||e.name.trim().toLowerCase().replace(/\.(exe|com)$/i,"")||e.id}function YL(e,t,n,r){let a="asc"===r?1:-1;return"name"===n?e.name.localeCompare(t.name)*a:(e[n]-t[n])*a}function Y$(e){return Math.round(10*e)/10}function YF(e,t){return e.reduce((e,n)=>Math.max(e,n[t]),0)}function YB(e){return new Intl.NumberFormat("zh-CN",{maximumFractionDigits:+(e<10)}).format(e)}function YV({className:e}){let t=YW("/api/local/machines/processes"),n=YU("/machines/processes"),r=ew.useMemo(()=>[...t,...n],[t,n]);return(0,ey.jsx)(YA,{machines:r,className:(0,eI.cn)("h-full min-h-0 w-full",e)})}function YH({className:e}){let t=YW("/api/local/machines/performance"),n=YU("/machines/performance"),r=ew.useMemo(()=>[...t,...n],[t,n]);return(0,ey.jsx)(Yb,{machines:r,className:(0,eI.cn)("h-full min-h-0 w-full",e)})}function YW(e){let[t,n]=ew.useState([]);return ew.useEffect(()=>{let t=!0,r=!1;async function a(){if(!r){r=!0;try{let r=await fetch(eD(e),{cache:"no-store"});if(!r.ok)return;let a=await r.json();t&&n(a.machines)}catch{t&&n([])}finally{r=!1}}}a();let i=window.setInterval(a,2e3);return()=>{t=!1,window.clearInterval(i)}},[e]),t}function YU(e){let{machines:t}=g4(),[n,r]=ew.useState([]),a=ew.useMemo(()=>t.filter(e=>!e.isLocal&&"online"===e.status).map(e=>e.id),[t]);return ew.useEffect(()=>{if(0===a.length)return void r([]);let t=!0,n=!1;async function i(){if(!n){n=!0;try{let n=await Promise.all(a.map(async t=>{try{return(await sf(t,e)).machines??[]}catch{return[]}}));t&&r(n.flat())}finally{n=!1}}}i();let o=window.setInterval(i,5e3);return()=>{t=!1,window.clearInterval(o)}},[a,e]),n}let Yq=(0,ek.default)("circle-play",[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),YK=(0,ek.default)("radio",[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]),YG={loading:"Starting terminal...",newTerminal:"New terminal",closeTerminal:e=>`Close ${e}`,terminalList:"Terminal sessions",status:{idle:"Idle",running:"Running",success:"Succeeded",error:"Failed"}},YX=[{id:"powershell",title:"PowerShell",shell:"PowerShell",cwd:"D:\\Projects\\Vantaloom-ui",status:"idle",initialOutput:"PowerShell 7.6.1\r\nPS D:\\Projects\\Vantaloom-ui> "}];function YY(e,t,n){return e.getPropertyValue(t).trim()||n}function YZ(e,t=!1){let n=getComputedStyle(e),r=YY(n,"--foreground","#18181b"),a=YY(n,"--terminal-background",YY(n,"--background","#ffffff")),i="transparent"===a?YY(n,"--background","#ffffff"):a,o=YY(n,"--muted-foreground","#71717a"),l=YY(n,"--border","#e4e4e7"),s=YY(n,"--selection","#18181b");return{background:a,foreground:r,cursor:t?"transparent":r,cursorAccent:t?"transparent":i,selectionBackground:`color-mix(in oklch, ${s} 18%, transparent)`,selectionForeground:YY(n,"--selection-foreground","#ffffff"),scrollbarSliderBackground:`color-mix(in oklch, ${l} 78%, transparent)`,scrollbarSliderHoverBackground:l,black:r,red:YY(n,"--terminal-red","#bf616a"),green:YY(n,"--terminal-green","#5e8c61"),yellow:YY(n,"--terminal-yellow","#b06f3c"),blue:YY(n,"--terminal-blue","#5e81ac"),magenta:YY(n,"--terminal-magenta","#b48ead"),cyan:YY(n,"--terminal-cyan","#4c8da8"),white:a,brightBlack:o,brightRed:YY(n,"--terminal-bright-red","#d06f79"),brightGreen:YY(n,"--terminal-bright-green","#6b9a70"),brightYellow:YY(n,"--terminal-bright-yellow","#c2824b"),brightBlue:YY(n,"--terminal-bright-blue","#6f91ba"),brightMagenta:YY(n,"--terminal-bright-magenta","#c19ac0"),brightCyan:YY(n,"--terminal-bright-cyan","#5aa0b8"),brightWhite:r}}function YJ(e){return void 0===e?[]:Array.isArray(e)?e:[e]}function YQ({initialOutput:t,data:n,dataKey:r,options:a,readOnly:i=!1,autoFocus:o=!1,localEcho:l=!1,onData:s,onResize:c,onReady:u,labels:d,className:f,terminalClassName:h,...p}){let m=ew.useMemo(()=>({loading:YG.loading,...d}),[d]),g=ew.useRef(null),v=ew.useRef(null),x=ew.useRef(void 0),y=ew.useRef(s),b=ew.useRef(c),w=ew.useRef(u),j=ew.useRef(a),k=ew.useRef(i),S=ew.useRef(l),C=ew.useRef(!1),N=ew.useRef(void 0),M=ew.useRef(!1),[E,O]=ew.useState(!1);return ew.useEffect(()=>{y.current=s,b.current=c,w.current=u,j.current=a,k.current=i,S.current=l},[l,s,u,c,a,i]),ew.useEffect(()=>{let n,r=!1,a=[];!async function(){var i;let l,s,c,u,d;if(!g.current||M.current)return;M.current=!0;let[{Terminal:f},{FitAddon:h},{SearchAddon:p},{WebLinksAddon:m}]=await Promise.all([e.A(93626),e.A(16118),e.A(24306),e.A(46866)]);if(r||!g.current)return;let N=new f({convertEol:!1,cursorBlink:!0,cursorStyle:"block",drawBoldTextInBrightColors:!1,fontFamily:(l=getComputedStyle(i=g.current),d=(c=YY(l,"--font-family-mono",s='"Cascadia Mono", "Cascadia Code", Consolas, "SFMono-Regular", "Liberation Mono", monospace'),u=getComputedStyle(i),c.replace(/var\((--[a-zA-Z0-9-_]+)(?:,[^)]+)?\)/g,(e,t)=>u.getPropertyValue(t).trim()||"")).trim(),`"Cascadia Mono", "Cascadia Code", Consolas, ${d||s}`),fontSize:13,letterSpacing:0,lineHeight:1.25,macOptionIsMeta:!0,minimumContrastRatio:4.5,scrollback:5e3,theme:YZ(g.current),...j.current,allowTransparency:!0}),E=new h,P=new p,A=new m;function I(){try{E.fit(),b.current?.({cols:N.cols,rows:N.rows})}catch{}}for(let e of(N.loadAddon(E),N.loadAddon(P),N.loadAddon(A),N.open(g.current),v.current=N,x.current=E,O(!0),requestAnimationFrame(I),(n=new ResizeObserver(I)).observe(g.current),a.push(N.onData(e=>{k.current||(S.current&&("\r"===e?N.write("\r\n"):""===e?N.write("\b \b"):N.write(e)),y.current?.(e))})),YJ(t)))N.write(e);w.current?.({terminal:N,fitAddon:E,searchAddon:P,webLinksAddon:A,fit:I,focus:()=>N.focus(),clear:()=>N.clear(),setCursorSuppressed:function(e){let t=g.current;t&&(C.current=e,t.toggleAttribute("data-vtl-terminal-cursor-suppressed",e),N.options.theme=YZ(t,e))},write:(e,t)=>N.write(e,t),writeln:e=>N.writeln(e)}),o&&N.focus()}();let i=new MutationObserver(()=>{let e=v.current,t=g.current;e&&t&&(e.options.theme=YZ(t,C.current))});return i.observe(document.documentElement,{attributeFilter:["class","style"],attributes:!0}),()=>{for(let e of(r=!0,i.disconnect(),n?.disconnect(),a))e.dispose();v.current?.dispose(),v.current=null,x.current=void 0,C.current=!1,M.current=!1,O(!1)}},[o,t]),ew.useEffect(()=>{let e=v.current;if(e&&N.current!==r)for(let t of(N.current=r,YJ(n)))e.write(t)},[n,r]),(0,ey.jsxs)("div",{"data-slot":"terminal-tab-surface",className:(0,eI.cn)("relative size-full min-h-0 overflow-hidden bg-background text-foreground",f),...p,children:[(0,ey.jsx)("div",{ref:g,className:(0,eI.cn)("vtl-terminal-xterm size-full overflow-hidden p-1.5 font-mono","[&_.xterm]:h-full [&_.xterm]:p-0 [&_.xterm-viewport]:!bg-transparent","[&_.xterm-screen]:!bg-transparent [&_.xterm-helper-textarea]:!outline-none","[&[data-vtl-terminal-cursor-suppressed]_.xterm-cursor]:!opacity-0","[&_.xterm-viewport::-webkit-scrollbar]:w-2.5 [&_.xterm-viewport::-webkit-scrollbar-track]:bg-transparent","[&_.xterm-viewport::-webkit-scrollbar-thumb]:rounded-full [&_.xterm-viewport::-webkit-scrollbar-thumb]:border-[3px]","[&_.xterm-viewport::-webkit-scrollbar-thumb]:border-transparent [&_.xterm-viewport::-webkit-scrollbar-thumb]:bg-border [&_.xterm-viewport::-webkit-scrollbar-thumb]:bg-clip-content",h)}),!E&&(0,ey.jsx)("div",{className:"pointer-events-none absolute inset-0 grid place-items-center text-muted-foreground ui-text-code",children:m.loading})]})}function Y0({status:e="idle"}){return"running"===e?(0,ey.jsx)(Yq,{className:"size-3.5 text-foreground"}):"success"===e?(0,ey.jsx)(eO,{className:"size-3.5 text-foreground"}):"error"===e?(0,ey.jsx)(eE,{className:"size-3.5 text-destructive"}):(0,ey.jsx)(yq,{className:"size-3.5 text-muted-foreground"})}function Y1({session:e}){return e.aiControlled?(0,ey.jsx)(YK,{className:"size-3.5 text-destructive"}):(0,ey.jsx)(Y0,{status:e.status})}function Y2({sessions:e,defaultSessions:t=YX,activeSessionId:n,defaultActiveSessionId:r,onActiveSessionChange:a,onSessionsChange:i,onCreateSession:o,onCloseSession:l,onSessionData:s,onSessionResize:c,onSessionReady:u,showTabs:d=!0,allowCreateSession:f=!0,readOnly:h=!1,localEcho:p=!1,terminalOptions:m,labels:g,className:v,tabListClassName:x,terminalClassName:y,...b}){let w=ew.useMemo(()=>({...YG,...g,status:{...YG.status,...g?.status}}),[g]),[j,k]=ew.useState(t),S=e??j,C=S[0],[N,M]=ew.useState(r??C?.id),E=n??(S.some(e=>e.id===N)?N:C?.id),O=S.find(e=>e.id===E)??C;function P(t){void 0===e&&k(t),i?.(t)}function A(e){e.disabled||(void 0===n&&M(e.id),a?.(e.id,e))}return(0,ey.jsxs)("div",{"data-slot":"terminal-tab-group",className:(0,eI.cn)("vtl-surface-panel grid min-h-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",d?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",v),...b,children:[d&&(0,ey.jsxs)("div",{"data-slot":"terminal-tab-list",role:"tablist","aria-label":w.terminalList,className:(0,eI.cn)("flex min-w-0 items-center gap-1 border-b bg-muted/35 px-2 py-1.5",x),children:[(0,ey.jsx)(ds,{className:"ml-1 size-4 shrink-0 text-muted-foreground"}),(0,ey.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1 overflow-x-auto",children:S.map(e=>{let t=e.id===O?.id;return(0,ey.jsxs)("div",{className:(0,eI.cn)("group flex h-7 min-w-0 shrink-0 items-center rounded-md border border-transparent ui-text-control","transition-colors hover:bg-background/80",t?"bg-background text-foreground shadow-xs":"text-muted-foreground",e.disabled&&"pointer-events-none opacity-50"),children:[(0,ey.jsxs)("button",{type:"button",role:"tab","aria-selected":t,"aria-controls":`terminal-panel-${e.id}`,disabled:e.disabled,onClick:()=>A(e),className:"flex h-full min-w-0 items-center gap-1.5 rounded-md px-2 text-left outline-none focus-visible:ring-[3px] focus-visible:ring-ring/20",children:[(0,ey.jsx)(Y1,{session:e}),(0,ey.jsx)("span",{className:"max-w-36 truncate",children:e.title}),e.shell&&(0,ey.jsx)("span",{className:"hidden text-muted-foreground ui-text-kbd sm:inline",children:e.shell})]}),e.closable&&(0,ey.jsx)("button",{type:"button","aria-label":w.closeTerminal(e.title),onClick:t=>{t.stopPropagation();l?.(e.id,e);let n=S.filter(t=>t.id!==e.id);if(P(n),e.id===E){let e=n.at(-1);e&&A(e)}},className:"mr-1 grid size-4 place-items-center rounded-sm text-muted-foreground opacity-0 outline-none transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/20 group-hover:opacity-100",children:(0,ey.jsx)(d3.XIcon,{className:"size-3"})})]},e.id)})}),f&&(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-xs","aria-label":w.newTerminal,onClick:function(){let e=o?.()??{id:`terminal-${Date.now()}`,title:`Terminal ${S.length+1}`,status:"idle",initialOutput:"",closable:!0};P([...S,e]),A(e)},className:"size-7 shrink-0",children:(0,ey.jsx)(lV,{className:"size-3.5"})})]}),(0,ey.jsx)("div",{"data-slot":"terminal-tab-panels",className:"relative min-h-0 overflow-hidden",children:S.map(e=>{let t=e.id===O?.id;return(0,ey.jsx)(Y5,{session:e,selected:t,terminalOptions:m,readOnly:h,localEcho:p,onSessionData:s,onSessionResize:c,onSessionReady:u,labels:w,terminalClassName:y},e.id)})})]})}function Y5({session:e,selected:t,terminalOptions:n,readOnly:r,localEcho:a,onSessionData:i,onSessionResize:o,onSessionReady:l,labels:s,terminalClassName:c}){let u=ew.useRef(null),d=ew.useRef(t);return ew.useEffect(()=>{if(t&&!d.current&&u.current){let e=u.current;requestAnimationFrame(()=>{e&&(e.fit(),e.terminal.refresh(0,e.terminal.rows-1),e.terminal.focus())})}d.current=t},[t]),(0,ey.jsx)("div",{id:`terminal-panel-${e.id}`,role:"tabpanel","aria-hidden":!t,"data-active":t,className:"absolute inset-0 min-h-0",style:{display:t?"block":"none"},children:(0,ey.jsx)(YQ,{initialOutput:e.initialOutput,options:{...n,...e.options},readOnly:r||e.disabled,localEcho:a,autoFocus:t,onData:t=>i?.(e.id,t),onResize:t=>o?.(e.id,t),onReady:t=>{u.current=t,l?.(e.id,t)},labels:s,terminalClassName:c})})}function Y4({className:e,scopeId:t,state:n,onStateChange:r}){let[a,i]=ew.useState([]),[o,l]=ew.useState([]),[s,c]=ew.useState(),[u,d]=ew.useState("local"),[f,h]=ew.useState(),[p,m]=ew.useState(!1),[g,v]=ew.useState(!1),x=ew.useRef(new Map),y=ew.useRef(new Map),b=ew.useRef(new Map),w=ew.useRef(new Map),j=ew.useRef(new Map),k=ew.useRef(new Map),S=ew.useRef(new Map),C=ew.useRef(new Map),N=ew.useRef(!1),M=ew.useRef(n?.autoStart===!1),E=ew.useRef(n),O=ew.useRef(r),P=Array.isArray(n?.sessionIds)?n.sessionIds.join("\0"):"__all__",A=t?.trim()||void 0,I=A??"__unscoped__";ew.useEffect(()=>{E.current=n},[n]),ew.useEffect(()=>{O.current=r},[r]);let z=a.find(e=>e.id===u)??a[0],_=z?.shells?.find(e=>e.id===f)??z?.shells?.[0],D=ew.useMemo(()=>o.map(e=>e.id),[o]),R=ew.useMemo(()=>o.filter(e=>e.aiControlled).map(e=>e.id),[o]),T=D.join("\0"),L=R.join("\0"),$=ew.useCallback((e,t)=>{let n=y.current.get(e);if(t){let t=j.current.get(e);void 0!==t&&(window.clearTimeout(t),j.current.delete(e))}n?.setCursorSuppressed(t)},[]),F=ew.useCallback(e=>{let t=j.current.get(e);void 0!==t&&window.clearTimeout(t);let n=window.setTimeout(()=>{j.current.delete(e),$(e,!1)},90);j.current.set(e,n)},[$]),B=ew.useCallback(e=>{let t=w.current.get(e),n=y.current.get(e);if(!t||!n||t.writing)return;if(!t.buffer){w.current.delete(e),F(e);return}void 0!==t.drainTimer&&(window.clearTimeout(t.drainTimer),t.drainTimer=void 0);let r=t.buffer.slice(0,65536);t.buffer=t.buffer.slice(r.length),t.writing=!0,$(e,!0);try{n.write(r,()=>{(t.writing=!1,y.current.has(e))?t.buffer?t.drainTimer=window.setTimeout(()=>B(e),0):(w.current.delete(e),F(e)):w.current.delete(e)})}catch{t.writing=!1,w.current.delete(e),F(e)}},[F,$]),V=ew.useCallback((e,t)=>{if(!t)return;if(!y.current.get(e))return void b.current.set(e,`${b.current.get(e)??""}${t}`);let n=w.current.get(e);(n||(n={buffer:"",writing:!1},w.current.set(e,n)),n.buffer+=t,$(e,!0),n.buffer.length>=65536)?B(e):n.writing||void 0!==n.drainTimer||(n.drainTimer=window.setTimeout(()=>B(e),8))},[B,$]),H=ew.useCallback((e,t)=>{(k.current.set(e,t.sequence),"output"===t.type&&t.data)?V(e,t.data):"status"===t.type&&t.status&&l(n=>n.map(n=>n.id===e?{...n,status:t.status??n.status,updatedAt:t.createdAt}:n))},[V]),W=ew.useCallback(e=>{if(x.current.has(e))return;let t=new EventSource(function(e,t=0){let n=new URLSearchParams;t>0&&n.set("after",String(t));let r=n.toString();return eD(`/api/local/terminals/sessions/${encodeURIComponent(e)}/events${r?`?${r}`:""}`)}(e,k.current.get(e)??0));t.onmessage=t=>{try{H(e,JSON.parse(t.data))}catch{return}},x.current.set(e,t)},[H]),U=ew.useCallback(async()=>{if(z&&!p){M.current=!1,m(!0);try{let e=await d0({machineId:z.id,scopeId:A,shell:_?.id,cwd:z.defaultCwd,cols:100,rows:30});l(t=>t.some(t=>t.id===e.id)?t:[...t,e]),c(e.id),W(e.id)}catch{return}finally{m(!1)}}},[p,W,z,_,A]);function q(e){let t=S.current.get(e);return t||(t={buffer:"",inFlight:!1},S.current.set(e,t)),t}return ew.useEffect(()=>{let e=!0;return v(!1),async function(){try{let t=E.current,n=t?.sessionIds,r=Array.isArray(n)?new Set(n):void 0,[a,o]=await Promise.all([dJ(),dQ(A)]);if(!e)return;let s=r?o.sessions.filter(e=>r.has(e.id)):o.sessions;N.current=!1,M.current=t?.autoStart===!1,i(a.machines),l(s),c(e=>{let n=t?.activeSessionId??e;return n&&s.some(e=>e.id===n)?n:s[0]?.id});let u=a.machines[0];if(u){let e=a.machines.find(e=>e.id===t?.selectedMachineId)??u;d(e.id),h(n=>t?.selectedShellId&&e.shells?.some(e=>e.id===t.selectedShellId)?t.selectedShellId:n&&e.shells?.some(e=>e.id===n)?n:e.shells?.[0]?.id)}}finally{e&&v(!0)}}(),()=>{e=!1}},[P,A,I]),ew.useEffect(()=>{g&&O.current?.({sessionIds:D,activeSessionId:s,selectedMachineId:u,selectedShellId:f,autoStart:!M.current,aiControlledSessionIds:R})},[s,R,L,g,u,f,D,T]),ew.useEffect(()=>{let e=new Set(D);for(let e of o)W(e.id);for(let[t,n]of x.current)e.has(t)||(n.close(),x.current.delete(t))},[W,D,o]),ew.useEffect(()=>{!g||N.current||M.current||o.length>0||0===a.length||(N.current=!0,U())},[U,g,a.length,o.length]),ew.useEffect(()=>()=>{for(let e of x.current.values())e.close();for(let e of S.current.values())void 0!==e.timer&&window.clearTimeout(e.timer);for(let e of w.current.values())void 0!==e.drainTimer&&window.clearTimeout(e.drainTimer);for(let[e,t]of j.current)window.clearTimeout(t),$(e,!1);S.current.clear(),w.current.clear(),j.current.clear()},[$]),(0,ey.jsxs)("div",{className:(0,eI.cn)("grid h-full min-h-0 w-full grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-[inherit] border bg-card",e),children:[(0,ey.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 border-b bg-muted/35 px-2 py-1.5",children:[(0,ey.jsxs)(go,{value:z?.id,onValueChange:e=>{d(e);let t=a.find(t=>t.id===e);h(t?.shells?.[0]?.id)},children:[(0,ey.jsxs)(gX,{size:"sm",className:"max-w-44",children:[(0,ey.jsx)(xw,{className:"size-3.5"}),(0,ey.jsx)(gu,{placeholder:"机器"})]}),(0,ey.jsx)(gJ,{align:"start",children:a.filter(e=>"online"===e.status).map(e=>(0,ey.jsx)(gQ,{value:e.id,children:e.name},e.id))})]}),(0,ey.jsxs)(go,{value:_?.id,onValueChange:h,children:[(0,ey.jsx)(gX,{size:"sm",className:"max-w-44",children:(0,ey.jsx)(gu,{placeholder:"Shell"})}),(0,ey.jsx)(gJ,{align:"start",children:z?.shells?.map(e=>(0,ey.jsx)(gQ,{value:e.id,children:e.name},e.id))})]}),(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"新建终端",disabled:!z||p,onClick:()=>void U(),className:"ml-auto",children:(0,ey.jsx)(lV,{className:"size-4"})})]}),(0,ey.jsx)(Y2,{sessions:o.map(Y3),activeSessionId:s,allowCreateSession:!1,localEcho:!1,labels:{loading:"启动终端...",terminalList:"终端会话",closeTerminal:e=>`关闭 ${e}`},onActiveSessionChange:e=>c(e),onCloseSession:e=>{let t,n,r;return x.current.get(e)?.close(),x.current.delete(e),y.current.delete(e),b.current.delete(e),t=w.current.get(e),t?.drainTimer!==void 0&&window.clearTimeout(t.drainTimer),w.current.delete(e),k.current.delete(e),void 0!==(n=j.current.get(e))&&(window.clearTimeout(n),j.current.delete(e)),r=S.current.get(e),void(r?.timer!==void 0&&window.clearTimeout(r.timer),S.current.delete(e),C.current.delete(e),l(t=>{let n=t.filter(t=>t.id!==e);return 0===n.length&&(M.current=!0),c(t=>t&&t!==e&&n.some(e=>e.id===t)?t:n[0]?.id),n}),d1(e).catch(()=>{}))},onSessionData:function(e,t){let n=q(e);n.buffer+=t,function e(t){let n=q(t);n.inFlight||void 0!==n.timer||(n.timer=window.setTimeout(()=>{n.timer=void 0,function(t){let n=S.current.get(t);if(!n||n.inFlight)return;let r=n.buffer;if(n.buffer="",!r){void 0===n.timer&&S.current.delete(t);return}n.inFlight=!0,d2(t,r).catch(()=>{}).finally(()=>{let n=S.current.get(t);n&&(n.inFlight=!1,n.buffer?e(t):void 0===n.timer&&S.current.delete(t))})}(t)},6))}(e)},onSessionResize:function(e,t){let n=`${t.cols}x${t.rows}`;C.current.get(e)!==n&&(C.current.set(e,n),d5(e,t).then(e=>{l(t=>t.map(t=>t.id===e.id?{...t,...e}:t))}).catch(()=>{}))},onSessionReady:function(e,t){y.current.set(e,t);let n=b.current.get(e);n&&(b.current.delete(e),V(e,n))},className:"min-h-0 rounded-none border-0"})]})}function Y3(e){return{id:e.id,title:e.title,shell:e.ordinal?`T${e.ordinal}`:"",cwd:e.cwd,status:function(e){switch(e){case"running":return"running";case"exited":case"closed":return"success";case"failed":return"error";default:return"idle"}}(e.status),closable:!0,initialOutput:"",aiControlled:e.aiControlled,controller:e.controller}}function Y6(e,t={}){let n="h-full min-h-0 w-full overflow-hidden rounded-[inherit]";switch(e.kind){case"file-tab-viewer":{let r=dj("file-tab-viewer"),a=e.file;if(!a&&t.onRequestFileTab)return(0,ey.jsx)(VY,{className:n,onChooseFile:t.onRequestFileTab});return(0,ey.jsx)(KP,{className:`${n} border-0`,file:a??r.file,value:e.defaultValue??r.defaultValue??"",defaultValue:e.defaultValue??r.defaultValue,view:e.defaultView,mode:e.defaultMode,modified:e.modified,onValueChange:n=>t.onTabChange?.({...e,defaultValue:n,modified:!0}),onViewChange:n=>t.onTabChange?.({...e,defaultView:n}),onModeChange:n=>t.onTabChange?.({...e,defaultMode:n}),onSave:t.onSaveFileTab?n=>t.onSaveFileTab?.(e,n):void 0,onHistory:()=>t.onOpenFileHistory?.(e),labels:{review:"审阅",edit:"编辑",view:"视图",code:"代码",preview:"预览",hex:"十六进制",actions:"文件菜单",save:"保存",saving:"保存中",history:"历史版本"}})}case"browser-tab-viewer":return(0,ey.jsx)(Hc,{className:`${n} border-0`,defaultUrl:e.defaultUrl??dj("browser-tab-viewer").defaultUrl});case"diff-tab-viewer":{let t=dj("diff-tab-viewer");return(0,ey.jsx)(WD,{className:`${n} border-0`,file:e.file??t.file,diff:e.diff??t.diff??""})}case"data-table-tab-viewer":{let r=dj("data-table-tab-viewer"),a=e.file;if(!a&&t.onRequestFileTab)return(0,ey.jsx)(VY,{className:n,onChooseFile:t.onRequestFileTab});return(0,ey.jsx)(WS,{className:`${n} border-0`,file:{name:a?.name??r.file?.name??"data",path:a?.path??r.file?.path,type:Y8(e)},source:void 0!==e.defaultValue?{type:Y8(e),content:e.defaultValue}:void 0,data:e.tableData??r.tableData??[]})}case"terminal-tab-group":return(0,ey.jsx)(Y4,{className:`${n} border-0`,scopeId:t.terminalScopeId,state:e.terminal??t.terminalState,onStateChange:t.onTerminalStateChange})}}function Y8(e){return`${e.file?.mimeType??""} ${e.file?.path??e.file?.name??""}`.toLowerCase().includes("json")?"json":"csv"}function Y7(e,t={}){let n="h-full min-h-0 w-full overflow-hidden rounded-[inherit]";switch(e){case"multi-tab-system":{let e=t.nodeId,r=void 0!==t.tabs?t.tabs:[];return(0,ey.jsx)(K_,{className:n,contentClassName:"min-h-0",tabs:r.map(n=>({id:n.id,title:n.title,meta:n.meta,modified:n.modified,icon:dw(n.kind),content:Y6(n,{terminalScopeId:e?`${t.terminalScopeId??`canvas:node:${e}`}:tab:${n.id}`:t.terminalScopeId,terminalState:n.terminal,onTerminalStateChange:r=>e?t.onTabChange?.(e,{...n,terminal:r}):void 0,onRequestFileTab:()=>t.onRequestFileTab?.({nodeId:e,insertIndex:r.length}),onTabChange:n=>{e&&t.onTabChange?.(e,n)},onSaveFileTab:(n,r)=>e?t.onSaveFileTab?.(e,n,r):void 0,onOpenFileHistory:n=>e?t.onOpenFileHistory?.(e,n):void 0})})),activeTabId:t.activeTabId,detachable:!0,externalDropTypes:[KR],createLabel:"打开文件",emptyContent:(0,ey.jsx)(VY,{onChooseFile:()=>t.onRequestFileTab?.({nodeId:e,insertIndex:r.length})}),onCreateTab:()=>{t.onRequestFileTab?.({nodeId:e,insertIndex:r.length})},onActiveTabChange:n=>{e&&t.onActiveTabChange?.(e,n)},onTabsChange:n=>{if(!e)return;let a=n.map(e=>r.find(t=>t.id===e.id)).filter(e=>!!e);t.onTabsChange?.(e,a)},onTabDetach:(n,a)=>{if(!e)return!1;let i=r.find(e=>e.id===n.id);return!!i&&t.onTabDetach?.(e,i,{clientX:a.clientX,clientY:a.clientY})},onExternalTabDrop:({insertIndex:n,nativeEvent:r})=>{e&&t.onExternalTabDrop?.(e,n,r)}})}case"file-tree-panel":if(t.workspaceFolders)return(0,ey.jsx)(VG,{folders:t.workspaceFolders,className:`${n} max-w-none`,onOpenFile:t.onOpenWorkspaceFile});return(0,ey.jsx)(Ga,{className:`${n} max-w-none`,onOpenFile:t.onOpenWorkspaceFile});case"process-management":return(0,ey.jsx)(YV,{className:`${n} rounded-[inherit] border-0`});case"machine-performance":return(0,ey.jsx)(YH,{className:`${n} rounded-[inherit] border-0`});case"firewall-policy-workspace":return(0,ey.jsx)("div",{className:`${n} bg-card`,children:(0,ey.jsx)(Gt,{})});case"machine-file-management":return(0,ey.jsx)(GI,{className:`${n} bg-card`});case"agent-conversation-panel":return(0,ey.jsx)(Vv,{className:`${n} vtl-canvas-agent-conversation-node`,composerClassName:"max-w-[42rem]"});case"file-tab-viewer":case"browser-tab-viewer":case"diff-tab-viewer":case"data-table-tab-viewer":case"terminal-tab-group":return Y6(t.tab??dj(e,`${e}-tab`),{terminalState:t.terminalState,terminalScopeId:t.terminalScopeId,onTerminalStateChange:t.onTerminalStateChange,onRequestFileTab:()=>t.onRequestFileTab?.({nodeId:t.nodeId}),onTabChange:e=>{t.nodeId&&t.onTabChange?.(t.nodeId,e)},onSaveFileTab:(e,n)=>t.nodeId?t.onSaveFileTab?.(t.nodeId,e,n):void 0,onOpenFileHistory:e=>t.nodeId?t.onOpenFileHistory?.(t.nodeId,e):void 0})}}function Y9({kind:e,...t}){return Y7(e,t)}let Ze="application/vnd.vantaloom.agent-pane-shredder",Zt="application/vnd.vantaloom.agent-pane-cutter";function Zn(e,t){return(e?.activeSessionId??"")===(t.activeSessionId??"")&&(e?.selectedMachineId??"")===(t.selectedMachineId??"")&&(e?.selectedShellId??"")===(t.selectedShellId??"")&&(e?.autoStart??!0)===(t.autoStart??!0)&&(e?.sessionIds??[]).join("\0")===t.sessionIds.join("\0")&&(e?.aiControlledSessionIds??[]).join("\0")===(t.aiControlledSessionIds??[]).join("\0")}let Zr=[{id:"quad",label:"四分",slots:4,icon:(0,ey.jsx)(xb,{})},{id:"vertical-split",label:"上下二分",slots:2,icon:(0,ey.jsx)(V9,{})},{id:"horizontal-split",label:"左右二分",slots:2,icon:(0,ey.jsx)(V5,{})},{id:"left-two-right-one",label:"左二右一",slots:3,icon:(0,ey.jsx)(sW,{})},{id:"left-one-right-two",label:"左一右二",slots:3,icon:(0,ey.jsx)(sU,{})},{id:"top-two-bottom-one",label:"上二下一",slots:3,icon:(0,ey.jsx)(V9,{})},{id:"top-one-bottom-two",label:"上一下二",slots:3,icon:(0,ey.jsx)(V7,{})},{id:"single",label:"整窗口",slots:1,icon:(0,ey.jsx)(V8,{})}];function Za(e,t,n=[50,50]){let r=e?.[t],a=r?.[0],i=r?.[1];return["number"==typeof a&&a>0?a:n[0],"number"==typeof i&&i>0?i:n[1]]}function Zi(e,t){return{[e[0]]:t[0],[e[1]]:t[1]}}function Zo(e,t){return[e[t[0]]??50,e[t[1]]??50]}function Zl({mode:e,sizes:t,onSizeGroupChange:n,children:r}){if("single"===e)return(0,ey.jsx)("div",{className:"size-full min-h-0",children:r[0]});if("horizontal-split"===e){let e=Za(t,"outer"),a=["pane-0","pane-1"];return(0,ey.jsxs)(ht,{direction:"horizontal",defaultLayout:Zi(a,e),onLayoutChanged:e=>n?.("outer",Zo(e,a)),children:[(0,ey.jsx)(hn,{id:a[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:a[1],defaultSize:e[1],minSize:24,children:r[1]})]})}if("vertical-split"===e){let e=Za(t,"outer"),a=["pane-0","pane-1"];return(0,ey.jsxs)(ht,{direction:"vertical",defaultLayout:Zi(a,e),onLayoutChanged:e=>n?.("outer",Zo(e,a)),children:[(0,ey.jsx)(hn,{id:a[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:a[1],defaultSize:e[1],minSize:24,children:r[1]})]})}if("left-two-right-one"===e){let e=Za(t,"outer",[58,42]),a=Za(t,"left"),i=["left","right"],o=["pane-0","pane-1"];return(0,ey.jsxs)(ht,{direction:"horizontal",defaultLayout:Zi(i,e),onLayoutChanged:e=>n?.("outer",Zo(e,i)),children:[(0,ey.jsx)(hn,{id:i[0],defaultSize:e[0],minSize:24,children:(0,ey.jsxs)(ht,{direction:"vertical",defaultLayout:Zi(o,a),onLayoutChanged:e=>n?.("left",Zo(e,o)),children:[(0,ey.jsx)(hn,{id:o[0],defaultSize:a[0],minSize:20,children:r[0]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:o[1],defaultSize:a[1],minSize:20,children:r[1]})]})}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:i[1],defaultSize:e[1],minSize:24,children:r[2]})]})}if("left-one-right-two"===e){let e=Za(t,"outer",[42,58]),a=Za(t,"right"),i=["left","right"],o=["pane-1","pane-2"];return(0,ey.jsxs)(ht,{direction:"horizontal",defaultLayout:Zi(i,e),onLayoutChanged:e=>n?.("outer",Zo(e,i)),children:[(0,ey.jsx)(hn,{id:i[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:i[1],defaultSize:e[1],minSize:24,children:(0,ey.jsxs)(ht,{direction:"vertical",defaultLayout:Zi(o,a),onLayoutChanged:e=>n?.("right",Zo(e,o)),children:[(0,ey.jsx)(hn,{id:o[0],defaultSize:a[0],minSize:20,children:r[1]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:o[1],defaultSize:a[1],minSize:20,children:r[2]})]})})]})}if("top-two-bottom-one"===e){let e=Za(t,"outer",[58,42]),a=Za(t,"top"),i=["top","bottom"],o=["pane-0","pane-1"];return(0,ey.jsxs)(ht,{direction:"vertical",defaultLayout:Zi(i,e),onLayoutChanged:e=>n?.("outer",Zo(e,i)),children:[(0,ey.jsx)(hn,{id:i[0],defaultSize:e[0],minSize:24,children:(0,ey.jsxs)(ht,{direction:"horizontal",defaultLayout:Zi(o,a),onLayoutChanged:e=>n?.("top",Zo(e,o)),children:[(0,ey.jsx)(hn,{id:o[0],defaultSize:a[0],minSize:24,children:r[0]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:o[1],defaultSize:a[1],minSize:24,children:r[1]})]})}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:i[1],defaultSize:e[1],minSize:24,children:r[2]})]})}if("top-one-bottom-two"===e){let e=Za(t,"outer",[42,58]),a=Za(t,"bottom"),i=["top","bottom"],o=["pane-1","pane-2"];return(0,ey.jsxs)(ht,{direction:"vertical",defaultLayout:Zi(i,e),onLayoutChanged:e=>n?.("outer",Zo(e,i)),children:[(0,ey.jsx)(hn,{id:i[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:i[1],defaultSize:e[1],minSize:24,children:(0,ey.jsxs)(ht,{direction:"horizontal",defaultLayout:Zi(o,a),onLayoutChanged:e=>n?.("bottom",Zo(e,o)),children:[(0,ey.jsx)(hn,{id:o[0],defaultSize:a[0],minSize:24,children:r[1]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:o[1],defaultSize:a[1],minSize:24,children:r[2]})]})})]})}let a=Za(t,"outer"),i=Za(t,"left"),o=Za(t,"right"),l=["left","right"],s=["pane-0","pane-2"],c=["pane-1","pane-3"];return(0,ey.jsxs)(ht,{direction:"horizontal",defaultLayout:Zi(l,a),onLayoutChanged:e=>n?.("outer",Zo(e,l)),children:[(0,ey.jsx)(hn,{id:l[0],defaultSize:a[0],minSize:24,children:(0,ey.jsxs)(ht,{direction:"vertical",defaultLayout:Zi(s,i),onLayoutChanged:e=>n?.("left",Zo(e,s)),children:[(0,ey.jsx)(hn,{id:s[0],defaultSize:i[0],minSize:20,children:r[0]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:s[1],defaultSize:i[1],minSize:20,children:r[2]})]})}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:l[1],defaultSize:a[1],minSize:24,children:(0,ey.jsxs)(ht,{direction:"vertical",defaultLayout:Zi(c,o),onLayoutChanged:e=>n?.("right",Zo(e,c)),children:[(0,ey.jsx)(hn,{id:c[0],defaultSize:o[0],minSize:20,children:r[1]}),(0,ey.jsx)(hr,{withHandle:!0}),(0,ey.jsx)(hn,{id:c[1],defaultSize:o[1],minSize:20,children:r[3]})]})})]})}function Zs({conversationId:e,index:t,content:n,clipboardItems:r,clipboardDraggingId:a,onAdd:i,onPanelDrop:o,onContentChange:l,onClear:s,onCut:c,workspaceFolders:u,onRequestFileTab:d,onOpenWorkspaceFile:f,onSaveFileTab:h,onOpenFileHistory:p}){let[m,g]=ew.useState();return(0,ey.jsx)("div",{"data-agent-pane":t,className:(0,eI.cn)("relative size-full min-h-0 min-w-0 overflow-hidden",n?.kind!=="subagent-conversation-panel"&&"bg-background","vtl-agent-workspace-pane",n?.kind==="subagent-conversation-panel"&&"vtl-agent-workspace-conversation-pane bg-transparent","panel"===m&&"ring-2 ring-foreground/60 ring-inset","shredder"===m&&"ring-2 ring-destructive/70 ring-inset","cutter"===m&&"ring-2 ring-amber-500/70 ring-inset"),onDragOver:e=>{let t=Array.from(e.dataTransfer.types);if(t.includes(Zt)){e.preventDefault(),e.dataTransfer.dropEffect="move",g("cutter");return}if(t.includes(Ze)){e.preventDefault(),e.dataTransfer.dropEffect="move",g("shredder");return}t.includes(wU)&&(e.preventDefault(),e.dataTransfer.dropEffect="move",g("panel"))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||g(void 0)},onDrop:e=>{if(Array.from(e.dataTransfer.types).includes(Zt)){e.preventDefault(),e.stopPropagation(),g(void 0),c(t);return}if(Array.from(e.dataTransfer.types).includes(Ze)){e.preventDefault(),e.stopPropagation(),g(void 0),s(t);return}let n=function(e){let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id"),n=r.find(e=>e.id===t),a=n?n.payloads?.[wU]:void 0;if(n&&a)return{item:n,content:a.content};let i=e.dataTransfer.getData(wU);if(i)try{let e=JSON.parse(i);return n&&e.content?{item:n,content:e.content}:void 0}catch{return}}(e);n&&(e.preventDefault(),e.stopPropagation(),g(void 0),o(t,n.item,n.content))},children:n?(0,ey.jsx)("div",{className:(0,eI.cn)("size-full min-h-0 min-w-0 overflow-hidden rounded-none","vtl-agent-pane-content","subagent-conversation-panel"===n.kind&&"vtl-agent-pane-conversation-content",a&&"pointer-events-none"),children:wW(n)?Y7(n.kind,{tab:n.tab,terminalScopeId:e?`agent:${e}:pane:${n.id}`:void 0,terminalState:n.terminal,onTerminalStateChange:e=>{Zn(n.terminal,e)||l(t,{...n,terminal:e})},workspaceFolders:u,nodeId:n.id,tabs:n.tabs,activeTabId:n.activeTabId,onRequestFileTab:({insertIndex:e})=>d?.(t,e),onOpenWorkspaceFile:f,onTabsChange:(e,r)=>{l(t,{...n,tabs:r,activeTabId:r.some(e=>e.id===n.activeTabId)?n.activeTabId:r[0]?.id})},onTabChange:(e,r)=>{"multi-tab-system"===n.kind?l(t,{...n,tabs:(n.tabs??[]).map(e=>e.id===r.id?r:e),activeTabId:r.id}):l(t,{...n,title:r.title,tab:r})},onSaveFileTab:(e,n,r)=>h?.(t,n,r),onOpenFileHistory:(e,n)=>p?.(t,n),onActiveTabChange:(e,r)=>{l(t,{...n,activeTabId:r})}}):(0,ey.jsx)(Vv,{className:"size-full min-h-0",composerClassName:"max-w-[42.5rem]",initialEvents:n.events},n.id)},n.id):(0,ey.jsx)("div",{className:"vtl-agent-pane-empty grid size-full place-items-center p-4",children:(0,ey.jsxs)(eA.Button,{type:"button",variant:"outline",size:"sm",className:"rounded-full bg-background/90",onClick:i,"data-tour":"pane-add",children:[(0,ey.jsx)(lV,{className:"size-4"}),"添加"]})})})}function Zc({open:e,onOpenChange:t,onAdd:n}){return(0,ey.jsx)(vE,{open:e,onOpenChange:t,title:"添加工作区组件",description:"选择一个组件填入当前窗口。",className:"top-1/2 max-w-xl -translate-y-1/2",children:(0,ey.jsxs)(vM,{loop:!0,children:[(0,ey.jsx)(vO,{placeholder:"搜索组件..."}),(0,ey.jsxs)(vP,{children:[(0,ey.jsx)(vA,{children:"没有匹配组件。"}),(0,ey.jsx)(vI,{heading:"可放入窗口",children:wB.map(e=>(0,ey.jsxs)(vz,{"data-tour":`pane-template-${e.id}`,value:`${e.title} ${e.description} ${e.keywords}`,onSelect:()=>n(e.id),children:[(0,ey.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg border bg-background text-muted-foreground",children:e.icon}),(0,ey.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,ey.jsx)("span",{className:"block truncate text-sm font-medium",children:e.title}),(0,ey.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,ey.jsx)(v_,{children:"添加"})]},e.id))})]})]})})}function Zu({content:e,index:t,conversationId:n,workspaceFolders:r,onContentChange:a,onOpenWorkspaceFile:i,onSaveFileTab:o,onOpenFileHistory:l,onRequestFileTab:s}){return wW(e)?Y7(e.kind,{tab:e.tab,terminalScopeId:n?`agent:${n}:pane:${e.id}`:void 0,terminalState:e.terminal,onTerminalStateChange:n=>{Zn(e.terminal,n)||a(t,{...e,terminal:n})},workspaceFolders:r,nodeId:e.id,tabs:e.tabs,activeTabId:e.activeTabId,onRequestFileTab:({insertIndex:e})=>s?.(t,e),onOpenWorkspaceFile:i,onTabsChange:(n,r)=>{a(t,{...e,tabs:r,activeTabId:r.some(t=>t.id===e.activeTabId)?e.activeTabId:r[0]?.id})},onTabChange:(n,r)=>{"multi-tab-system"===e.kind?a(t,{...e,tabs:(e.tabs??[]).map(e=>e.id===r.id?r:e),activeTabId:r.id}):a(t,{...e,title:r.title,tab:r})},onSaveFileTab:(e,n,r)=>o?.(t,n,r),onOpenFileHistory:(e,n)=>l?.(t,n),onActiveTabChange:(n,r)=>{a(t,{...e,activeTabId:r})}}):(0,ey.jsx)(Vv,{className:"size-full min-h-0",composerClassName:"max-w-[42.5rem]",initialEvents:e.events},e.id)}let Zd=[{kind:"browser-tab-viewer",label:"预览窗口",icon:(0,ey.jsx)(V6,{})},{kind:"diff-tab-viewer",label:"Diff 栏",icon:(0,ey.jsx)(V4,{})},{kind:"terminal-tab-group",label:"终端窗口",icon:(0,ey.jsx)(ds,{})},{kind:"file-tree-panel",label:"文件树",icon:(0,ey.jsx)(V3,{})},{kind:"file-tab-viewer",label:"文件窗口",icon:(0,ey.jsx)(xg,{})}];function Zf(e,t,n){return Math.min(n,Math.max(t,e))}function Zh({conversationId:e,panes:t,agentSide:n,columns:r,heights:a,onColumnsChange:i,onHeightsChange:o,onAddCard:l,onContentChange:s,onClear:c,workspaceFolders:u,onOpenWorkspaceFile:d,onSaveFileTab:f,onOpenFileHistory:h,onRequestFileTab:p}){let m=t.map((e,t)=>({content:e,index:t})).filter(e=>!!e.content),g=new Map(m.map(e=>[e.content.id,e])),v=m.map(e=>e.content.id).join("|"),x="left"===n,y=ew.useRef(0);0===y.current&&r.length>0&&(y.current=r.reduce((e,t)=>{let n=/^col-(\d+)/.exec(t.key);return n?Math.max(e,Number(n[1])):e},0));let b=ew.useCallback(()=>`col-${y.current+=1}`,[]),w=e=>i("function"==typeof e?e(r):e),j=e=>o("function"==typeof e?e(a):e),[k,S]=ew.useState(null),[C,N]=ew.useState(null),[M,E]=ew.useState(null),O=ew.useRef(null),P=ew.useRef(null),A=ew.useRef(null),I=ew.useRef(null);ew.useEffect(()=>{w(e=>{let t=new Set(m.map(e=>e.content.id)),n=e.map(e=>({...e,cardIds:e.cardIds.filter(e=>t.has(e))})).filter(e=>e.cardIds.length>0),r=new Set(n.flatMap(e=>e.cardIds)),a=m.map(e=>e.content.id).filter(e=>!r.has(e));return a.length>0&&(n=0===n.length?[{key:b(),width:360,cardIds:[...a]}]:n.map((e,t)=>0===t?{...e,cardIds:[...e.cardIds,...a]}:e)),!function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1){let r=e[n],a=t[n];if(!r||!a||r.key!==a.key||r.width!==a.width||r.cardIds.length!==a.cardIds.length)return!1;for(let e=0;e<r.cardIds.length;e+=1)if(r.cardIds[e]!==a.cardIds[e])return!1}return!0}(e,n)?n:e})},[v,b]);let z=e=>a[e]??320;ew.useEffect(()=>{if(!k)return;let e=e=>{P.current?function(e,t){let n=O.current,r=P.current;if(!n||!r)return;let a=Array.from(n.querySelectorAll("[data-card-id]")),i=null,o=null,l=1/0;for(let n of a){let a=n.dataset.cardId;if(!a||a===r)continue;let s=n.getBoundingClientRect(),c=Math.max(s.left-e,0,e-s.right),u=Math.max(s.top-t,0,t-s.bottom),d=c*c+u*u;d<l&&(l=d,i=a,o=s)}if(!i||!o){A.current=null,E(null);return}let s=e-o.left,c=o.right-e,u=t-o.top,d=o.bottom-t,f=Math.min(s,c,u,d),h=f===u?"top":f===d?"bottom":f===s?"left":"right";A.current={id:i,edge:h};let p=n.getBoundingClientRect();E(function(e,t){switch(t){case"top":return{left:e.left,top:e.top-6-2,width:e.width,height:4};case"bottom":return{left:e.left,top:e.top+e.height+6-2,width:e.width,height:4};case"left":return{left:e.left-6-2,top:e.top,width:4,height:e.height};case"right":return{left:e.left+e.width+6-2,top:e.top,width:4,height:e.height}}}({left:o.left-p.left,top:o.top-p.top,width:o.width,height:o.height},h))}(e.clientX,e.clientY):I.current&&function(e,t){let n=I.current;if(!n)return;if("width"===n.kind){let t=Zf(n.startWidth+(e-n.startX)*n.factor,240,760);w(e=>e.map(e=>e.key===n.columnKey?{...e,width:t}:e));return}if("growHeight"===n.kind){let e=Math.max(140,n.h0+(t-n.startY));j(t=>({...t,[n.cardId]:e}));return}let r=n.hA+n.hB,a=Zf(n.hA+(t-n.startY),140,r-140);j(e=>({...e,[n.aboveId]:a,[n.belowId]:r-a}))}(e.clientX,e.clientY)},t=()=>(function(){let e=P.current;if(e){var t,n;let r=A.current;P.current=null,A.current=null,N(null),E(null),S(null),r&&(t=r.id,n=r.edge,e&&e!==t&&w(r=>{let a=r.map(e=>({...e,cardIds:[...e.cardIds]}));for(let t of a){let n=t.cardIds.indexOf(e);n>=0&&t.cardIds.splice(n,1)}let i=-1,o=-1;a.forEach((e,n)=>{let r=e.cardIds.indexOf(t);r>=0&&(i=n,o=r)});let l=a[i];if(!l)return r;if("top"===n||"bottom"===n)l.cardIds.splice("top"===n?o:o+1,0,e);else{let t=(x?"right"===n:"left"===n)?i:i+1;a.splice(t,0,{key:b(),width:a[i]?.width??360,cardIds:[e]})}return a.filter(e=>e.cardIds.length>0)}));return}I.current&&(I.current=null,S(null))})();return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t),window.addEventListener("pointercancel",t),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t),window.removeEventListener("pointercancel",t)}},[k]);let _=r.map((e,t)=>({column:e,realIndex:t}));x&&_.reverse();let D=(0,ey.jsx)("div",{className:(0,eI.cn)("flex shrink-0 px-3 py-2",x?"justify-end":"justify-start"),children:(0,ey.jsxs)(y2,{children:[(0,ey.jsx)(y4,{asChild:!0,children:(0,ey.jsxs)(eA.Button,{type:"button",variant:"outline",size:"sm",className:"gap-1.5",children:[(0,ey.jsx)(lV,{className:"size-4"}),"添加窗口",(0,ey.jsx)(gK,{className:"size-3.5 text-muted-foreground"})]})}),(0,ey.jsx)(bl,{align:x?"end":"start",sideOffset:6,className:"min-w-40",children:Zd.map(e=>(0,ey.jsxs)(bs,{onSelect:()=>l(e.kind),children:[e.icon,(0,ey.jsx)("span",{className:"flex-1",children:e.label})]},e.kind))})]})});return 0===m.length?(0,ey.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[D,(0,ey.jsx)("div",{className:"grid flex-1 place-items-center px-4 pb-6",children:(0,ey.jsx)("p",{className:"max-w-[15rem] text-center text-sm text-muted-foreground",children:"从“添加窗口”放入预览、Diff、终端、文件树或文件窗口; Agent 编辑/阅读文件或运行终端时也会自动填入对应卡片。"})})]}):(0,ey.jsxs)("div",{className:"relative flex h-full min-h-0 flex-col",children:[D,(0,ey.jsx)("div",{className:"min-h-0 flex-1 overflow-auto px-3 pb-3",children:(0,ey.jsxs)("div",{ref:O,className:"relative flex min-h-full items-start gap-3",children:[_.map(({column:t})=>{let n=[],a=0;for(let e=0;e<t.cardIds.length;e+=1)a+=z(t.cardIds[e]),e<t.cardIds.length-1&&(n.push(a+6),a+=12);let i=a,o=t.cardIds[t.cardIds.length-1];return(0,ey.jsxs)("div",{className:"relative flex shrink-0 flex-col gap-3",style:{width:t.width},children:[t.cardIds.map(t=>{let n=g.get(t);if(!n)return null;let{content:r,index:a}=n;return(0,ey.jsxs)("div",{"data-card-id":r.id,style:{height:z(r.id)},className:(0,eI.cn)("group/card relative flex w-full shrink-0 flex-col overflow-hidden rounded-xl border border-border bg-background shadow-sm",C===r.id?"opacity-40":"opacity-100"),children:[(0,ey.jsxs)("div",{onPointerDown:e=>{var t;return t=r.id,void(0===e.button&&(e.preventDefault(),e.stopPropagation(),P.current=t,A.current=null,N(t),E(null),S("drag")))},className:"flex shrink-0 cursor-grab touch-none select-none items-center justify-between gap-2 border-b border-border/60 px-2.5 py-1.5 active:cursor-grabbing",children:[(0,ey.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,ey.jsx)(ft,{className:"size-3.5 shrink-0 text-muted-foreground/60"}),(0,ey.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:r.title})]}),(0,ey.jsx)("button",{type:"button",onPointerDown:e=>e.stopPropagation(),onClick:()=>c(a),"aria-label":"关闭窗口",title:"关闭窗口",className:"grid size-5 shrink-0 place-items-center rounded text-muted-foreground transition-colors hover:bg-muted hover:text-foreground [&_svg]:size-3.5",children:(0,ey.jsx)(d3.XIcon,{})})]}),(0,ey.jsx)("div",{className:"min-h-0 flex-1 overflow-hidden",children:(0,ey.jsx)(Zu,{content:r,index:a,conversationId:e,workspaceFolders:u,onContentChange:s,onOpenWorkspaceFile:d,onSaveFileTab:f,onOpenFileHistory:h,onRequestFileTab:p})})]},r.id)}),t.cardIds.slice(0,-1).map((e,r)=>(0,ey.jsx)("div",{"aria-hidden":!0,onPointerDown:n=>{var a;return a=t.cardIds[r+1],void(0===n.button&&(n.preventDefault(),n.stopPropagation(),I.current={kind:"height",aboveId:e,belowId:a,startY:n.clientY,hA:z(e),hB:z(a)},S("resize")))},style:{top:n[r]??0},className:"group/hbar absolute inset-x-0 z-10 flex h-3 -translate-y-1/2 cursor-ns-resize items-center justify-center",children:(0,ey.jsx)("span",{className:"h-1 w-12 rounded-full bg-muted-foreground/40 opacity-0 transition-opacity group-hover/hbar:opacity-100"})},`hbar-${e}`)),o?(0,ey.jsx)("div",{"aria-hidden":!0,onPointerDown:e=>{0===e.button&&(e.preventDefault(),e.stopPropagation(),I.current={kind:"growHeight",cardId:o,startY:e.clientY,h0:z(o)},S("resize"))},style:{top:i+6},className:"group/hbar absolute inset-x-0 z-10 flex h-3 -translate-y-1/2 cursor-ns-resize items-center justify-center",children:(0,ey.jsx)("span",{className:"h-1 w-12 rounded-full bg-muted-foreground/40 opacity-0 transition-opacity group-hover/hbar:opacity-100"})}):null,(0,ey.jsx)("div",{"aria-hidden":!0,onPointerDown:e=>(function(e,t){if(0!==t.button)return;t.preventDefault(),t.stopPropagation();let n=r.find(t=>t.key===e)?.width??360;I.current={kind:"width",columnKey:e,startX:t.clientX,startWidth:n,factor:x?-1:1},S("resize")})(t.key,e),style:x?{left:-6}:{right:-6},className:(0,eI.cn)("group/wbar absolute inset-y-0 z-10 flex w-3 cursor-ew-resize items-center justify-center",x?"-translate-x-1/2":"translate-x-1/2"),children:(0,ey.jsx)("span",{className:"h-12 w-1 rounded-full bg-muted-foreground/40 opacity-0 transition-opacity group-hover/wbar:opacity-100"})})]},t.key)}),M?(0,ey.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute z-40 rounded-full bg-muted-foreground/70",style:{left:M.left,top:M.top,width:M.width,height:M.height}}):null]})}),k?(0,ey.jsx)("div",{"aria-hidden":!0,className:"absolute inset-0 z-50",style:{cursor:"drag"===k?"grabbing":I.current?.kind==="width"?"ew-resize":"ns-resize"}}):null]})}let Zp="vtl:workspace-layout-mode",Zm="vtl:workspace-agent-side",Zg="vtl:workspace-layout-changed",Zv={mode:"pane",agentSide:"left"};function Zx(){let e=Zv.mode,t=Zv.agentSide;try{let n=window.localStorage.getItem(Zp);("pane"===n||"card"===n||"control-room"===n)&&(e=n);let r=window.localStorage.getItem(Zm);("left"===r||"right"===r)&&(t=r)}catch{}return{mode:e,agentSide:t}}function Zy(e){try{e.mode&&window.localStorage.setItem(Zp,e.mode),e.agentSide&&window.localStorage.setItem(Zm,e.agentSide)}catch{}window.dispatchEvent(new CustomEvent(Zg))}function Zb({stack:e,rootTitle:t,rootOwnerMachineId:n,onNavigateRoot:r,onNavigateIndex:a,onOpenSubagent:i}){let o=e[e.length-1],[l,s]=ew.useState(null);if(ew.useEffect(()=>{let e;if(!o)return;let t=!1;async function r(){try{let a=await sw(o.id,n);if(t)return;s(a);let i="working"===a.conversation.status||!!a.conversation.running;e=window.setTimeout(r,i?900:5e3)}catch{if(t)return;e=window.setTimeout(r,3e3)}}return s(null),r(),()=>{t=!0,e&&window.clearTimeout(e)}},[o,n]),!o)return null;let c=l?.conversation.status??"working",u="working"===c||!!l?.conversation.running;return(0,ey.jsxs)("div",{className:"absolute inset-0 z-30 flex flex-col bg-background",children:[(0,ey.jsxs)("div",{className:"flex h-9 shrink-0 items-center gap-1 overflow-x-auto border-b px-2 text-xs",children:[(0,ey.jsx)("button",{type:"button",className:"shrink-0 rounded px-1.5 py-0.5 text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground",onClick:r,children:t||"主对话"}),e.map((t,n)=>{let r=Vi(t.subagentType),i=n===e.length-1,o=r.Icon;return(0,ey.jsxs)(ew.Fragment,{children:[(0,ey.jsx)(pC,{className:"size-3 shrink-0 text-muted-foreground/60"}),(0,ey.jsxs)("button",{type:"button",className:(0,eI.cn)("flex shrink-0 items-center gap-1 rounded px-1.5 py-0.5 transition-colors hover:bg-accent/50",i?"font-medium text-foreground":"text-muted-foreground hover:text-foreground"),onClick:()=>a(n),children:[(0,ey.jsx)(o,{className:(0,eI.cn)("size-3",r.color)}),(0,ey.jsx)("span",{className:"max-w-[10rem] truncate",children:t.name||`${r.label}子代理`})]})]},t.id)}),(0,ey.jsx)("span",{className:"ml-auto shrink-0 pl-2",children:u?(0,ey.jsxs)("span",{className:"flex items-center gap-1 text-muted-foreground",children:[(0,ey.jsx)(eM,{className:"size-3 animate-spin"}),"运行中"]}):"paused"===c?(0,ey.jsxs)("span",{className:"flex items-center gap-1 text-destructive",children:[(0,ey.jsx)(ho,{className:"size-3"}),"已暂停"]}):(0,ey.jsxs)("span",{className:"flex items-center gap-1 text-emerald-600 dark:text-emerald-500",children:[(0,ey.jsx)(eO,{className:"size-3"}),"完成"]})})]}),(0,ey.jsx)("div",{className:"relative min-h-0 flex-1",children:l?(0,ey.jsx)(BQ,{events:l.events,bottomInset:16,contentClassName:"max-w-[42.5rem]",onOpenSubagent:e=>i(e),labels:{recall:"召回",branch:"分支",expand:"展开",collapse:"收起",completed:"完成",thinking:"运行中"}}):(0,ey.jsxs)("div",{className:"flex h-full items-center justify-center text-sm text-muted-foreground",children:[(0,ey.jsx)(eM,{className:"mr-2 size-4 animate-spin"}),"正在打开子代理对话…"]})})]})}let Zw=[],Zj="vantaloom:file-system-changed";function Zk(e){var t;let n=(t=e?.layoutMode,Zr.some(e=>e.id===t)?t:"quad"),r="right"===e?.agentPosition?"right":"left",a=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return{};let t=e.shell&&"object"==typeof e.shell&&!Array.isArray(e.shell)?e.shell:void 0,n={};for(let e of["agent","panes"]){let r=t?.[e];"number"==typeof r&&Number.isFinite(r)&&r>0&&(n[e]=r)}return{...Object.keys(n).length?{shell:n}:{},outer:ZS(e.outer),left:ZS(e.left),right:ZS(e.right),top:ZS(e.top),bottom:ZS(e.bottom)}}(e?.sizes),i=Array.from({length:Math.max(4,Zr.find(e=>e.id===n)?.slots??4)},()=>void 0);for(let[t,n]of(e?.panes??[]).entries()){let e=Number.isInteger(n.slot)?n.slot:t;e<0||e>=i.length||(i[e]=function(e,t){var n,r;let a=e.paneId||`${e.kind}-${t+1}`,i=!(n=e.props)||"object"!=typeof n||Array.isArray(n)?{}:n;if("subagent-conversation-panel"===e.kind)return{id:a,kind:"subagent-conversation-panel",title:ZN(i.title)??"Subagent",subagentId:ZN(i.subagentId)??a,events:Array.isArray(i.events)?i.events:[]};if(!wV(e.kind))return;let o=i.tab&&"object"==typeof i.tab?i.tab:void 0,l=Array.isArray(i.tabs)?i.tabs.filter(e=>db(e?.kind)):void 0,s=wV(e.kind);return{id:a,kind:e.kind,title:ZN(i.title)??o?.title??s?.title??"组件",tab:o,tabs:l,activeTabId:ZN(i.activeTabId),terminal:"terminal-tab-group"===e.kind?!(r=i.terminal)||"object"!=typeof r||Array.isArray(r)?{sessionIds:[]}:{sessionIds:Array.isArray(r.sessionIds)?r.sessionIds.filter(e=>"string"==typeof e):[],activeSessionId:ZN(r.activeSessionId),selectedMachineId:ZN(r.selectedMachineId),selectedShellId:ZN(r.selectedShellId),autoStart:"boolean"==typeof r.autoStart?r.autoStart:void 0,aiControlledSessionIds:Array.isArray(r.aiControlledSessionIds)?r.aiControlledSessionIds.filter(e=>"string"==typeof e):void 0}:void 0}}(n,t))}return{layoutMode:n,agentPosition:r,layoutSizes:a,panes:i,cardColumns:Array.isArray(e?.cardLayout?.columns)?e.cardLayout.columns.filter(e=>e&&"string"==typeof e.key&&Array.isArray(e.cardIds)).map(e=>({key:e.key,width:"number"==typeof e.width&&e.width>0?e.width:360,cardIds:e.cardIds.filter(e=>"string"==typeof e)})):[],cardHeights:e?.cardLayout?.heights&&"object"==typeof e.cardLayout.heights?e.cardLayout.heights:{}}}function ZS(e){if(!Array.isArray(e))return;let t=e.filter(e=>"number"==typeof e&&Number.isFinite(e)&&e>0);return t.length?t:void 0}function ZC(e){return e.filter(e=>"number"==typeof e&&Number.isFinite(e)&&e>0)}function ZN(e){return"string"==typeof e&&e.trim()?e:void 0}function ZM(e){let t=e?.id.match(/-(\d+)$/);return t?Number(t[1]):0}function ZE(e){return e.reduce((e,t)=>Math.max(e,ZM(t)),0)}function ZO({conversation:e,clipboardItems:t,clipboardDraggingId:n,onClipboardItemsChange:r,onClipboardDraggingChange:a,onOverlayOpenChange:i,onConversationCreated:o,onCancelDraft:l,subagentStack:s=[],onSubagentStackChange:c,subagentTree:u=[],mobileView:d="conversation",onMobilePaneCountChange:f}){let h=su(),p=ew.useRef(null),m=Zk(e?.panes),[g,v]=ew.useState(m.layoutMode),[x,y]=ew.useState(m.agentPosition),b=function(){let[e,t]=ew.useState(Zv);return ew.useEffect(()=>{t(Zx());let e=()=>t(Zx());return window.addEventListener(Zg,e),window.addEventListener("storage",e),()=>{window.removeEventListener(Zg,e),window.removeEventListener("storage",e)}},[]),e}(),w="card"===b.mode,[j,k]=ew.useState(!1),[S,C]=ew.useState(m.layoutSizes),[N,M]=ew.useState(()=>m.panes),[E,O]=ew.useState(()=>m.cardColumns),[P,A]=ew.useState(()=>m.cardHeights),[I,z]=ew.useState(()=>e?.events??[]),[_,D]=ew.useState(new Set),[R,T]=ew.useState(void 0),[L,$]=ew.useState(()=>V2(e?.conversation.id)),F=ew.useCallback(t=>{$(t),function(e,t){if(e)try{if(!t)return void window.localStorage.removeItem(V1(e));window.localStorage.setItem(V1(e),t.slice(0,1e5))}catch{}}(e?.conversation.id,t)},[e?.conversation.id]),[B,V]=ew.useState([]),[H,W]=ew.useState(void 0),[U,q]=ew.useState(!1),[K,G]=ew.useState(!1),[X,Y]=ew.useState(""),[Z,J]=ew.useState(e?.conversation.status==="working"),[Q,ee]=ew.useState(e?.conversation.status??"idle"),[et,en]=ew.useState(e?.conversation.settings?.permissionMode??"acceptEdits"),[er,ea]=ew.useState([]),[ei,eo]=ew.useState(e?.conversation.tokens??0),[el,es]=ew.useState(e?.conversation.runUsage),[ec,eu]=ew.useState(e?.conversation.contextTokens??0),[ed,ef]=ew.useState(!1),eh=ew.useRef(Q),[ep,em]=ew.useState(),[eg,ev]=ew.useState(),[ex,eb]=ew.useState(),ej=ew.useRef(ZE(m.panes)),ek=ew.useRef(0),eS=ew.useRef(""),eC=Zr.find(e=>e.id===g)?.slots??4,eN=e?.conversation.settings.folders??Zw,{models:eM}=xa(),eE=ew.useMemo(()=>{let t=e?.conversation.settings.mainModels??[];return t.length?eM.filter(e=>t.includes(e.value)).map(e=>({id:e.value,label:e.label})):[]},[eM,e?.conversation.settings.mainModels]),eO=wS(e?.conversation.settings.engine),eP=ew.useMemo(()=>{if(eO){let t,n=e?.conversation.settings.ccModel;return[{id:n&&""!==n?n:"__cc_model__",label:(t=n&&""!==n?n:wj,wk.find(e=>e.value===t)?.label??n??""),disabled:!0}]}return eE},[eO,e?.conversation.settings.ccModel,eE]),eI=!eO&&0===eE.length,ez=Z||"working"===Q,e_=ew.useCallback(async t=>{if(!e||ed)return;let n=e.conversation.id,r=e.conversation.ownerMachineId;if(eO){if(ez)return void await s$(n,"请执行 /compact 压缩上下文。",r);J(!0),ee("working");try{let e=await sA(n,{message:"/compact",modelRef:"",mode:"agent"},r);z(e.events),ee(e.conversation.status)}catch(e){J(!1),ee("idle"),hx.error(e instanceof Error?e.message:"压缩请求失败")}return}if(ez)return void await s$(n,"precise"===t?"请在完成当前小任务后进行精确压缩(去除冗余文件读取和旧工具输出)。":"请在完成当前小任务后进行极致压缩(AI摘要),以便继续工作。",r);ef(!0);try{await sF(n,t,void 0,r);let e=await sw(n,r);if(e){let t=sB(e);z(t.events),eo(t.conversation.tokens??0),es(t.conversation.runUsage),eu(t.conversation.contextTokens??0)}}catch{}finally{ef(!1)}},[e,ed,ez,eO]),eT=ew.useMemo(()=>{if(!e)return;let t=eM.find(e=>e.value===X),n=t?.contextLength||200,r=el?.inputTokens??0,a=el?.outputTokens??0,i=r>0?r:ec;return{used:i>0?i+a:ei,total:1e3*n,toolCalls:i>0?i:ei,userMessages:a,other:void 0,onCompressPrecise:()=>e_("precise"),onCompressExtreme:()=>e_("extreme"),compressing:ed}},[e,eM,X,ei,el,ec,e_,ed]),eL=ew.useCallback(e=>{let t=e.anchorEventId??I.find(t=>t.id.startsWith(`${e.runId}-`))?.id??I.find(t=>t.id===e.runId)?.id;t&&p.current?.scrollToEvent(t)},[I]),e$=ew.useCallback(t=>{if(!t)return void T(void 0);let n=(e?.conversation.rounds??[]).find(e=>t===e.runId||t.startsWith(`${e.runId}-`));T(n?.runId)},[e?.conversation.rounds]),eF=ew.useCallback(async e=>{if("file-tab-viewer"!==e.kind||e.modified||e.file?.readOnly)return e;try{var t,n;let r=await dV(e);return(t=e,n=r,t.defaultValue!==n.defaultValue||t.title!==n.title||t.file?.size!==n.file?.size||t.file?.mimeType!==n.file?.mimeType||t.file?.previewContent!==n.file?.previewContent||t.file?.src!==n.file?.src||t.file?.truncated!==n.file?.truncated)?r:e}catch{return e}},[]),eB=ew.useCallback(async e=>{if(!e||!wW(e))return e;if("multi-tab-system"===e.kind){var t,n;let r=e.tabs??[],a=await Promise.all(r.map(eF));return(t=r,n=a,t.length!==n.length||t.some((e,t)=>e!==n[t]))?{...e,tabs:a}:e}if("file-tab-viewer"===e.kind&&e.tab){let t=await eF(e.tab);return t!==e.tab?{...e,title:t.title,tab:t}:e}return e},[eF]),eV=ew.useCallback(async()=>{var e,t;let n=await Promise.all(N.map(async e=>eB(e)));e=N,t=n,(e.length!==t.length||e.some((e,n)=>e!==t[n]))&&M(n)},[N,eB]);function eH(e){if(!e.length)return;let t=e.map(wq);r(e=>[...t,...e.filter(e=>!t.some(t=>t.id===e.id))])}function eW(e,t,n){if(!e||!wW(e))return e;if("multi-tab-system"===e.kind){var r;let a,i;return{...e,tabs:(r=e.tabs??[],a=r.filter(e=>e.id!==t.id),i=void 0===n?a.length:Math.min(Math.max(n,0),a.length),a.splice(i,0,t),a),activeTabId:t.id}}return"file-tab-viewer"===e.kind?{...e,title:t.title,tab:t}:e}function eU(e,t){return e&&wW(e)?"multi-tab-system"===e.kind?{...e,tabs:(e.tabs??[]).map(e=>e.id===t.id?t:e),activeTabId:t.id}:"file-tab-viewer"===e.kind?{...e,title:t.title,tab:t}:e:e}function eq(e){M(t=>{let n=t.findIndex(e=>void 0===e);return n>=0?t.map((t,r)=>r===n?e:t):[...t,e]})}ew.useEffect(()=>{i?.(void 0!==ep||void 0!==eg||void 0!==ex)},[eg,ex,i,ep]),ew.useEffect(()=>{z(e?.events??[])},[e?.conversation.id,e?.events]),ew.useEffect(()=>{$(V2(e?.conversation.id)),V([]),W(void 0),D(new Set)},[e?.conversation.id]),ew.useEffect(()=>{J(e?.conversation.status==="working"),ee(e?.conversation.status??"idle")},[e?.conversation.id,e?.conversation.status]),ew.useEffect(()=>{eo(e?.conversation.tokens??0),es(e?.conversation.runUsage),eu(e?.conversation.contextTokens??0)},[e?.conversation.id,e?.conversation.tokens,e?.conversation.runUsage,e?.conversation.contextTokens]),ew.useEffect(()=>{el?.inputTokens&&eu(el.inputTokens)},[el?.inputTokens]),ew.useEffect(()=>{en(e?.conversation.settings?.permissionMode??"acceptEdits")},[e?.conversation.id,e?.conversation.settings?.permissionMode]),ew.useEffect(()=>{let e=eE[0]?.id??"";Y(t=>eE.some(e=>e.id===t)?t:e)},[eE]),ew.useEffect(()=>{let t=Zk(e?.panes);v(t.layoutMode),y(t.agentPosition),C(t.layoutSizes),M(t.panes),O(t.cardColumns),A(t.cardHeights),ej.current=ZE(t.panes)},[e?.conversation.id,e?.panes]),ew.useEffect(()=>{let t,n=e?.conversation.id,r=e?.conversation.ownerMachineId;if(!n||!ez)return;let a=!1,i=e=>{z(e.events),ee(e.conversation.status),eo(e.conversation.tokens??0),es(e.conversation.runUsage);let t=Zk(e.panes);v(t.layoutMode),y(t.agentPosition),C(t.layoutSizes),M(t.panes),O(t.cardColumns),A(t.cardHeights)},o=e=>{void 0===t&&(t=window.setInterval(async()=>{try{let e=await sw(n,r);if(a)return;i(e),"working"!==e.conversation.status&&(J(!1),void 0!==t&&(window.clearInterval(t),t=void 0))}catch{return}},e))};if(r&&"local"!==r)return o(600),()=>{a=!0,void 0!==t&&window.clearInterval(t)};let l=new EventSource(eD(`/api/local/agent/conversations/${encodeURIComponent(n)}/events/stream`));return l.addEventListener("detail",e=>{try{let t=sB(JSON.parse(e.data));i(t),"working"!==t.conversation.status&&(J(!1),l.close())}catch{return}}),l.onerror=()=>{l.close(),o(350)},()=>{a=!0,l.close(),void 0!==t&&window.clearInterval(t)}},[e?.conversation.id,e?.conversation.ownerMachineId,ez]),ew.useEffect(()=>{if(!e?.conversation.id)return;let t=window.setInterval(()=>{eV()},3e3);return()=>window.clearInterval(t)},[e?.conversation.id,eV]),ew.useEffect(()=>{let t=e?.conversation.id,n=e?.conversation.ownerMachineId;if(!t)return;let r=!1;sC(t,n);let a=window.setInterval(()=>{r||sC(t,n)},3e4);return()=>{r=!0,window.clearInterval(a),sN(t,n)}},[e?.conversation.id,e?.conversation.ownerMachineId]),ew.useEffect(()=>{let e=I.filter(e=>"change"===e.kind).map(e=>`${e.id}:${e.status??""}:${e.isStreaming?"1":"0"}`).join("|");e&&e!==eS.current&&(eS.current=e,window.dispatchEvent(new CustomEvent(Zj)),eV())},[I,eV]),ew.useEffect(()=>{let t=e?.conversation.id;if(!t)return;let n=window.setTimeout(()=>{var n;let r;sP(t,(n={columns:E,heights:P},r=[],N.forEach((e,t)=>{if(e){if(wW(e))return void r.push({paneId:e.id,slot:t,kind:e.kind,machineId:e.terminal?.selectedMachineId,resourceId:e.terminal?.activeSessionId,props:{title:e.title,tab:e.tab,tabs:e.tabs,activeTabId:e.activeTabId,terminal:e.terminal}});r.push({paneId:e.id,slot:t,kind:e.kind,props:{title:e.title,subagentId:e.subagentId,events:e.events}})}}),{layoutMode:g,agentPosition:x,sizes:S,cardLayout:n,panes:r}),e?.conversation.ownerMachineId)},300);return()=>window.clearTimeout(n)},[x,E,P,e?.conversation.id,g,S,N]);let eK=ew.useCallback(e=>{M(t=>{let n=t.findIndex(e=>e?.kind==="browser-tab-viewer");if(n>=0){let r=t[n];return r&&wW(r)&&r.tab&&(!r.tab.defaultUrl||r.tab.defaultUrl.startsWith("https://vantaloom.local"))?t.map((t,a)=>a===n&&r.tab?{...r,tab:{...r.tab,defaultUrl:e}}:t):t}ej.current+=1;let r=wH("browser-tab-viewer",`browser-tab-viewer-${ej.current}`),a=void 0!==r.tab?{...r,tab:{...r.tab,defaultUrl:e}}:r,i=t.findIndex(e=>void 0===e);return i>=0?t.map((e,t)=>t===i?a:e):w?[...t,a]:t})},[w]),eG=ew.useRef(!1);function eX(e,t){M(n=>{let r=n.findIndex(t=>t?.kind===e);if(r>=0)return n.map((n,a)=>a===r&&n?{id:n.id,kind:e,title:t.title,tab:t}:n);ej.current+=1;let a={id:`${e}-${ej.current}`,kind:e,title:t.title,tab:t},i=n.findIndex(e=>void 0===e);return i>=0?n.map((e,t)=>t===i?a:e):[...n,a]})}async function eY(e,t,n){try{let r=await dF(e);if(w)return void eX("file-tab-viewer",r);M(e=>e.map((e,a)=>a===t?eW(e,r,n):e))}catch{hx.error("文件预览打开失败")}}function eZ(e){if(w)return void eY(e,-1);let t=N.slice(0,eC).findIndex(e=>e?.kind==="multi-tab-system");t<0?hx.warning("请先放入一个多标签页组件"):eY(e,t)}function eJ(e){let t=e.path?.trim()||e.name.trim();("diff"===e.kind||"diff"===e.meta)&&e.diff?function(e){let t=e.path?.trim()||e.name.trim(),n={id:function(e,t){let n=0x811c9dc5;for(let e=0;e<t.length;e+=1)n^=t.charCodeAt(e),n=Math.imul(n,0x1000193);return`${e}-${(n>>>0).toString(36)}`}("diff",`${e.mutationId??""}|${e.machineId??"local"}|${t}|${e.diff??""}`),kind:"diff-tab-viewer",title:`Diff ${e.name}`,file:{name:e.name,path:t,machineId:e.machineId??"local",kind:"code"},diff:e.diff};if(w)return eX("diff-tab-viewer",n);let r=N.slice(0,eC).findIndex(e=>e?.kind==="multi-tab-system");r<0?hx.warning("请先放入一个多标签页组件"):M(e=>e.map((e,t)=>t===r?eW(e,n):e))}(e):!t||e.meta?.toLowerCase().startsWith("depth")||eZ({machineId:e.machineId??"local",path:t})}async function eQ(e,t,n){let r=t.file?.path,a=t.file?.machineId??"local";if(!r)throw hx.error("文件路径不可用"),Error("file path is unavailable");try{let i=await dE({machineId:a,path:r,content:n}),o={...await dB(i,{id:t.id,title:t.title,defaultView:t.defaultView,defaultMode:t.defaultMode}),modified:!1};M(t=>t.map((t,n)=>n===e?eU(t,o):t)),window.dispatchEvent(new CustomEvent(Zj)),hx.success("文件已保存")}catch(e){throw hx.error("文件保存失败"),e}}async function e0(t){let n=e?.conversation.id,r=ex?.tab.file?.path,a=ex?.tab.file?.machineId??"local";if(ex&&n&&r)try{let i=await sR(n,{machineId:a,path:r,mutationId:t.mutationId,state:t.state},e?.conversation.ownerMachineId),o=await dB(i,{id:ex.tab.id,title:`${i.name} @ ${ZA(t.mutationId)} ${"before"===t.state?"before":"after"}`,readOnly:!0,defaultView:ex.tab.defaultView,defaultMode:"review"});M(e=>e.map((e,t)=>t===ex.paneIndex?eU(e,o):e)),eb(void 0)}catch{hx.error("历史版本打开失败")}}function e1(e,t,n){let i=N[e];ej.current=Math.max(ej.current,ZM(n)),M(t=>t.map((t,r)=>r===e?n:t)),r(e=>{let n=e.filter(e=>e.id!==t.id);if(!i)return n;let r=wq(i);return[r,...n.filter(e=>e.id!==r.id)]}),a?.(void 0)}function e2(e,t){M(n=>n.map((n,r)=>r===e?t:n))}function e5(t){return{id:t.id,ownerMachineId:t.ownerMachineId??e?.conversation.ownerMachineId,name:t.name,subagentType:t.subagentType}}function e4(e){var t=N[e];if(t&&wW(t)&&"terminal-tab-group"===t.kind)for(let e of t.terminal?.sessionIds??[])d1(e).catch(()=>{});M(t=>t.map((t,n)=>n===e?void 0:t))}function e3(e){let t=N[e];t&&eH([t]),M(t=>t.map((t,n)=>n===e?void 0:t))}async function e6(t,n="chat",r=[]){let a=e?.conversation.id,i=eO?"":X||eE[0]?.id||"";if(!a)return;if(!eO&&!i)return void hx.error("请先在代理模型配置里选择模型");D(function e(t,n=new Set){for(let r of t)n.add(r.id),e(r.children??[],n);return n}(u));let o=r.map(e=>"image"===e.kind?{kind:"image",name:e.name,mimeType:e.mimeType,data:e.dataUrl?.split(",")[1]??""}:{kind:"file",name:e.name,mimeType:e.mimeType,text:e.text??""}).filter(e=>"image"===e.kind?""!==e.data:(e.text??"")!=="");J(!0),ee("working");try{let r=await sA(a,{message:t,modelRef:i,mode:n,attachments:o.length>0?o:void 0},e?.conversation.ownerMachineId);z(r.events),ee(r.conversation.status)}catch(e){J(!1),ee("idle"),hx.error(e instanceof Error?e.message:"对话请求失败")}}async function e8(t){let n=e?.conversation.id,r="string"==typeof t.modelRef?t.modelRef.trim():"",a=eO?"":r||X||eE[0]?.id||"",i="agent"===t.mode?"agent":"chat";if(n){if(!eO&&!a)return void hx.error("请先在代理模型配置里选择模型");J(!0),ee("working"),z(e=>e.map(e=>e.id===t.id?{...e,status:"retried"}:e));try{let r=await sI(n,{modelRef:a,mode:i,retryEventId:t.id},e?.conversation.ownerMachineId);z(r.events),ee(r.conversation.status)}catch(e){z(e=>e.map(e=>e.id===t.id?t:e)),J(!1),ee("idle"),hx.error(e instanceof Error?e.message:"对话重试失败")}}}function e7(e){ez?hx.error("对话正在运行,请先停止后再回退"):W(e)}async function e9(){let t=e?.conversation.id;if(!H||!t)return void W(void 0);q(!0);try{let n=await sz(t,H.id,e?.conversation.ownerMachineId);z(n.detail.events),ee(n.detail.conversation.status),J(!1),F(n.prompt),c?.([]);let r=[];n.revertedFiles>0&&r.push(`恢复 ${n.revertedFiles} 个文件`),n.deletedFiles>0&&r.push(`删除 ${n.deletedFiles} 个新增文件`),n.archivedSubagents>0&&r.push(`归档 ${n.archivedSubagents} 个子代理`),hx.success(r.length?`已回退:${r.join(",")}`:"已回退到此处"),n.skippedRemote&&n.skippedRemote.length>0&&hx.warning(`${n.skippedRemote.length} 个远程文件未自动回退,请在对应机器手动处理`)}catch(e){hx.error(e instanceof Error?e.message:"回退失败")}finally{q(!1),W(void 0)}}async function te(t){let n=e?.conversation.id;if(n&&!K){G(!0);try{let r=await s_(n,t.id,e?.conversation.ownerMachineId);o?.(r),hx.success("已创建分支对话")}catch(e){hx.error(e instanceof Error?e.message:"创建分支失败")}finally{G(!1)}}}async function tt(t){let n=e?.conversation.id;if(n)try{let r=e?.conversation.settings??{};await sE(n,{settings:{...r,...t}},e?.conversation.ownerMachineId)}catch(e){hx.error(e instanceof Error?e.message:"设置更新失败")}}async function tn(t,n){let r=e?.conversation.id;if(r)try{await sT(r,t,n,void 0,e?.conversation.ownerMachineId)}catch(e){hx.error(e instanceof Error?e.message:"审批操作失败")}}async function tr(){let t=e?.conversation.id;if(t){try{await sL(t,e?.conversation.ownerMachineId)}catch{}J(!1),ee("idle")}}function ta(){e6("继续","agent")}async function ti(t){let n=e?.conversation.id;if(!n)return;let r=er.find(e=>e.id===t);if(!r)return;let a="string"==typeof r.content?r.content:String(r.content??"");if(a.trim()){ea(e=>e.filter(e=>e.id!==t));try{await s$(n,a.trim(),e?.conversation.ownerMachineId)}catch{}}}ew.useEffect(()=>{let t=e?.conversation.id,n=e?.conversation.ownerMachineId;if(!t||n&&"local"!==n)return;eG.current=!1;let r=!1,a=async()=>{if(!r&&!eG.current)try{let e=(await eR())[0];if(r||eG.current||!e)return;eG.current=!0,eK(e)}catch{}};a();let i=window.setInterval(a,3e3);return()=>{r=!0,window.clearInterval(i)}},[e?.conversation.id,e?.conversation.ownerMachineId,eK]),ew.useEffect(()=>{let e=eh.current;if(eh.current=Q,"working"===e&&"idle"===Q&&er.length>0){let e=er[0];if(e){ea(er.slice(1));let t="string"==typeof e.content?e.content:String(e.content??"");t.trim()&&e6(t.trim(),"agent")}}},[Q]);let to=Array.from({length:eC},(r,a)=>(0,ey.jsx)(Zs,{conversationId:e?.conversation.id,index:a,content:N[a],clipboardItems:t,clipboardDraggingId:n,onAdd:()=>em(a),onPanelDrop:e1,onContentChange:e2,onClear:e4,onCut:e3,workspaceFolders:eN,onRequestFileTab:(e,t)=>ev({paneIndex:e,insertIndex:t}),onOpenWorkspaceFile:eZ,onSaveFileTab:eQ,onOpenFileHistory:(e,t)=>eb({paneIndex:e,tab:t})},a)),tl=N.slice(0,eC).some(e=>e?.kind==="subagent-conversation-panel"),ts=S.shell?.agent??42,tc=S.shell?.panes??58,tu=b.agentSide,td="control-room"===b.mode||j,tf=(0,ey.jsxs)(pb,{type:"single",value:td?"hidden":tu,variant:"outline",size:"sm","data-tour":"control-room-toggle","aria-label":"Agent 面板位置",onValueChange:e=>{"left"===e||"right"===e?(k(!1),y(e),Zy({mode:w?"card":"pane",agentSide:e})):"hidden"===e&&(k(!0),Zy({mode:"control-room"}))},children:[(0,ey.jsx)(pw,{value:"left","aria-label":"Agent 在左",title:"Agent 在左",className:"h-7 w-9 px-0 [&_svg]:size-4",children:(0,ey.jsx)(sW,{})}),(0,ey.jsx)(pw,{value:"hidden","aria-label":"隐藏面板,居中对话",title:"隐藏面板,居中对话",className:"h-7 w-9 px-0 [&_svg]:size-4",children:(0,ey.jsx)(sq,{})}),(0,ey.jsx)(pw,{value:"right","aria-label":"Agent 在右",title:"Agent 在右",className:"h-7 w-9 px-0 [&_svg]:size-4",children:(0,ey.jsx)(sU,{})})]}),th=(0,ey.jsxs)("div",{className:"relative flex size-full min-h-0 min-w-0 flex-col",children:[e?(0,ey.jsx)(Vy,{ownerMachineId:e.conversation.ownerMachineId,title:e.conversation.title,className:"pr-12"}):null,e?(0,ey.jsx)("div",{className:"pointer-events-none absolute left-1 top-9 z-30 flex justify-start pt-1.5",children:(0,ey.jsx)("div",{className:"pointer-events-auto",children:(0,ey.jsx)(Vb,{rounds:e.conversation.rounds,onJumpToRound:eL,activeRunId:R})})}):null,(0,ey.jsx)("div",{className:"min-h-0 flex-1 pl-10",children:(0,ey.jsx)(Vv,{ref:p,events:e?I:void 0,models:e?eP:void 0,modelId:eO?eP[0]?.id:X,permissionModeId:et,onPermissionModeChange:t=>{en(t),e?.conversation.id&&tt({permissionMode:t})},running:ez,disabled:!!e&&eI,onModelChange:Y,onSubmit:e?e=>{e6(e.value,"agent",e.attachments??[])}:void 0,onStop:tr,onOpenFile:eJ,onOpenSubagent:function(e){e.id&&c?.([e5(e)])},onRetry:e8,onApprovalDecision:tn,onContinue:ta,onRecallUserMessage:e7,onBranchAssistantMessage:te,onActiveEventChange:e$,composerValue:L,onComposerValueChange:F,attachments:B,onAttachmentsChange:V,queuedMessages:er,onQueuedMessagesChange:ea,onNudge:ti,contextUsage:eT})}),s.length>0&&e?(0,ey.jsx)(Zb,{stack:s,rootTitle:e.conversation.title,rootOwnerMachineId:e.conversation.ownerMachineId,onNavigateRoot:()=>c?.([]),onNavigateIndex:e=>c?.(s.slice(0,e+1)),onOpenSubagent:function(e){e.id&&c?.([...s,e5(e)])}}):null]}),tp=(0,ey.jsx)(hn,{id:"agent",defaultSize:ts,minSize:28,children:th},"agent-conversation"),tm=(0,ey.jsx)(hn,{id:"panes",defaultSize:tc,minSize:32,children:(0,ey.jsxs)("section",{className:"vtl-agent-workspace-panel flex size-full min-h-0 min-w-0 flex-col bg-transparent","data-has-conversation-pane":tl?"true":void 0,children:[(0,ey.jsx)("div",{className:"flex h-11 shrink-0 items-center border-b px-3","data-tour":"pane-toolbar",children:(0,ey.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,ey.jsx)(hQ,{value:g,onValueChange:e=>{let t,n;return t=Zr.find(t=>t.id===e)?.slots??4,void((n=N.slice(t).filter(e=>!!e)).length&&eH(n),M(Array.from({length:Math.max(4,t)},(e,n)=>n<t?N[n]:void 0)),v(e))},children:(0,ey.jsx)(h7,{children:Zr.map(e=>(0,ey.jsx)(h9,{value:e.id,"aria-label":e.label,title:e.label,className:"h-7 w-10 px-0 [&_svg]:size-4",children:e.icon},e.id))})}),tf,(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm",draggable:!0,"aria-label":"剪切窗口内容",title:"拖拽到窗口以剪切到剪切板",className:"h-7 w-10 cursor-grab rounded-md text-muted-foreground active:cursor-grabbing [&_svg]:size-4",onDragStart:e=>{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(Zt,"cut")},children:(0,ey.jsx)(lW,{})}),(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm",draggable:!0,"aria-label":"粉碎窗口内容",title:"拖拽到窗口以清空",className:"h-7 w-10 cursor-grab rounded-md text-muted-foreground active:cursor-grabbing [&_svg]:size-4",onDragStart:e=>{e.dataTransfer.effectAllowed="move",e.dataTransfer.setData(Ze,"clear")},children:(0,ey.jsx)(sK,{})})]})}),(0,ey.jsx)("div",{className:"min-h-0 flex-1",children:(0,ey.jsx)(Zl,{mode:g,sizes:S,onSizeGroupChange:function(e,t){let n=ZC(t);C(t=>{var r;return(r=t[e],(r?.length??0)===(n?.length??0)&&(r??[]).every((e,t)=>.01>Math.abs(e-(n?.[t]??0))))?t:{...t,[e]:n}})},children:to},`${e?.conversation.id??"empty"}-${g}`)})]})},"agent-panes"),tg=(0,ey.jsx)(Zh,{conversationId:e?.conversation.id,panes:N,agentSide:tu,columns:E,heights:P,onColumnsChange:O,onHeightsChange:A,onAddCard:function(e){ej.current+=1;let t=wH(e,`${e}-${ej.current}`);if("browser-tab-viewer"===e&&t.tab){let e=t.tab;eR().then(n=>{eq(n.length>0?{...t,tab:{...e,defaultUrl:n[0]}}:t)});return}eq(t)},onContentChange:e2,onClear:e4,workspaceFolders:eN,onOpenWorkspaceFile:eZ,onSaveFileTab:eQ,onOpenFileHistory:(e,t)=>eb({paneIndex:e,tab:t}),onRequestFileTab:(e,t)=>ev({paneIndex:e,insertIndex:t})}),tv=(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(Zc,{open:void 0!==ep,onOpenChange:e=>{e||em(void 0)},onAdd:function(e){if(void 0===ep)return;ej.current+=1;let t=wH(e,`${e}-${ej.current}`),n=N[ep];n&&eH([n]),M(e=>e.map((e,n)=>n===ep?t:e)),em(void 0)}}),(0,ey.jsx)(VX,{open:void 0!==eg,folders:eN,onOpenChange:e=>{e||ev(void 0)},onSelectFile:e=>{eg&&eY(e,eg.paneIndex,eg.insertIndex),ev(void 0)}}),(0,ey.jsx)(ZP,{open:void 0!==ex,conversationId:e?.conversation.id,ownerMachineId:e?.conversation.ownerMachineId,tab:ex?.tab,onOpenChange:e=>{e||eb(void 0)},onSelectVersion:e=>{e0(e)}}),(0,ey.jsx)(uL,{open:void 0!==H,onOpenChange:e=>{e||U||W(void 0)},children:(0,ey.jsxs)(u2,{children:[(0,ey.jsxs)(u5,{children:[(0,ey.jsx)(u3,{children:"回退对话到此处?"}),(0,ey.jsx)(u6,{children:"此操作会归档此处之后的所有对话记录,并把这期间(含子代理)对文件的修改全部还原到当前这条消息发送前的状态。该用户消息会回到输入框。回退无法撤销。"})]}),(0,ey.jsxs)(u4,{children:[(0,ey.jsx)(u7,{disabled:U,children:"取消"}),(0,ey.jsx)(u8,{variant:"destructive",disabled:U,onClick:e=>{e.preventDefault(),e9()},children:U?"回退中…":"确认回退"})]})]})})]});return e?h?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(w$,{view:d,onPaneCountChange:f,conversationPanel:(0,ey.jsx)(Vv,{flowContentClassName:"pl-10",events:e?I:void 0,models:e?eP:void 0,modelId:eO?eP[0]?.id:X,permissionModeId:et,onPermissionModeChange:t=>{en(t),e?.conversation.id&&tt({permissionMode:t})},running:ez,disabled:!!e&&eI,onModelChange:Y,onSubmit:e?e=>{e6(e.value,"agent",e.attachments??[])}:void 0,onStop:tr,onOpenFile:eJ,onOpenSubagent:function(e){var t;let n=N.slice(0,eC),r=n.findIndex(e=>!e),a=n.findIndex(e=>e?.kind==="subagent-conversation-panel"),i=r>=0?r:a;if(i<0)return void hx.warning("请释放一个窗口再选中浏览");ek.current+=1;let o={id:t=`subagent-${e.id}-${ek.current}`,kind:"subagent-conversation-panel",title:e.title,subagentId:e.id,events:e.events?.length?e.events:[{id:`${t}-status`,kind:"done",title:e.detail??e.status??e.activity??e.title}]};M(e=>e.map((e,t)=>t===i?o:e))},onRetry:e8,onApprovalDecision:tn,onContinue:ta,onRecallUserMessage:e7,onBranchAssistantMessage:te,onActiveEventChange:e$,composerValue:L,onComposerValueChange:F,attachments:B,onAttachmentsChange:V,queuedMessages:er,onQueuedMessagesChange:ea,onNudge:ti,contextUsage:eT}),paneElements:to,panes:N,activeSlotCount:eC,onOpenPalette:em,timeline:(0,ey.jsx)(Vb,{rounds:e.conversation.rounds,onJumpToRound:eL,activeRunId:R})}),tv,(0,ey.jsx)(hS,{position:"top-center"})]}):(0,ey.jsxs)("div",{className:"vtl-app-background vtl-agent-conversation-workspace relative h-full min-h-0",children:[td?(0,ey.jsxs)("div",{className:"relative flex h-full min-h-0",children:[(0,ey.jsx)("div",{className:"pointer-events-none absolute inset-0 -z-10 opacity-0","aria-hidden":!0,children:(0,ey.jsx)(ht,{direction:"horizontal",children:tm})}),(0,ey.jsxs)("div",{className:"relative flex h-full min-h-0 min-w-0 basis-[58%] shrink-0 flex-col",children:[(0,ey.jsx)(ht,{direction:"horizontal",children:tp}),(0,ey.jsx)("div",{className:"absolute right-3 top-1.5 z-20",children:tf})]}),(0,ey.jsx)("div",{className:"relative min-h-0 min-w-0 flex-1",children:(0,ey.jsx)(V0,{conversationTitle:e.conversation.title,rootEvents:I,rootOwnerMachineId:e.conversation.ownerMachineId,running:ez,subagentTree:u,baselineSubagentIds:_,activeSubagentPath:s,onSelectMain:()=>c?.([]),onSelectSubagent:e=>c?.([e])})})]}):w?(0,ey.jsx)("div",{className:"flex h-full min-h-0 overflow-x-auto",children:"left"===tu?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("div",{className:"relative flex h-full min-h-0 min-w-[20rem] flex-1 flex-col",children:th}),(0,ey.jsx)("div",{className:"flex h-full min-h-0 shrink-0 flex-col",children:tg})]}):(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("div",{className:"flex h-full min-h-0 shrink-0 flex-col",children:tg}),(0,ey.jsx)("div",{className:"relative flex h-full min-h-0 min-w-[20rem] flex-1 flex-col",children:th})]})}):(0,ey.jsxs)(ht,{direction:"horizontal",defaultLayout:{agent:ts,panes:tc},onLayoutChanged:e=>{let t=e.agent??ts,n=e.panes??tc;!function(e){let t=ZC(e),n=t[0],r=t[1];if(void 0===n||void 0===r)return;let a="left"===x?{agent:n,panes:r}:{agent:r,panes:n};C(e=>{let t=e.shell?.agent,n=e.shell?.panes;return .01>Math.abs((t??0)-a.agent)&&.01>Math.abs((n??0)-a.panes)?e:{...e,shell:{...e.shell,...a}}})}("left"===tu?[t,n]:[n,t])},children:["left"===tu?tp:tm,(0,ey.jsx)(hr,{withHandle:!0}),"left"===tu?tm:tp]},`${e?.conversation.id??"empty"}-${tu}`),tv,(0,ey.jsx)(hS,{position:"top-right"})]}):(0,ey.jsx)(w_,{onCreated:e=>o?.(e),onCancel:l})}function ZP({open:e,conversationId:t,ownerMachineId:n,tab:r,onOpenChange:a,onSelectVersion:i}){let[o,l]=ew.useState([]),[s,c]=ew.useState(!1),u=r?.file?.path,d=r?.file?.machineId??"local";return ew.useEffect(()=>{if(!e||!t||!u)return void l([]);let r=!1;return c(!0),sD(t,{machineId:d,path:u},n).then(e=>{r||l(e.versions)}).catch(()=>{r||l([])}).finally(()=>{r||c(!1)}),()=>{r=!0}},[t,n,d,e,u]),(0,ey.jsx)(uo,{open:e,onOpenChange:a,children:(0,ey.jsxs)(d8,{className:"max-w-xl gap-0 overflow-hidden p-0",children:[(0,ey.jsx)(d9,{className:"sr-only",children:"历史版本"}),(0,ey.jsx)(fe,{className:"sr-only",children:"浏览当前文件在此 Agent 会话中的修改历史。"}),(0,ey.jsxs)("div",{className:"border-b px-4 py-3",children:[(0,ey.jsx)("div",{className:"truncate text-sm font-medium",children:r?.file?.name??r?.title??"文件"}),u?(0,ey.jsxs)("div",{className:"mt-0.5 truncate ui-text-kbd text-muted-foreground",children:[d,":",u]}):null]}),(0,ey.jsx)("div",{className:"max-h-[28rem] overflow-auto p-2",children:s?(0,ey.jsx)("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:"正在读取历史版本"}):0===o.length?(0,ey.jsx)("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:"还没有记录到这个文件的修改历史"}):(0,ey.jsx)("div",{className:"grid gap-1",children:o.map(e=>{var t;let n;return(0,ey.jsxs)("button",{type:"button",className:"grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-md px-3 py-2 text-left transition-colors hover:bg-muted/70",onClick:()=>i(e),children:[(0,ey.jsxs)("span",{className:"min-w-0",children:[(0,ey.jsxs)("span",{className:"block truncate text-sm font-medium",children:[ZA(e.mutationId)," ·"," ","before"===e.state?"修改前":"修改后"]}),(0,ey.jsx)("span",{className:"mt-0.5 block truncate ui-text-kbd text-muted-foreground",children:Number.isFinite(n=Date.parse(t=e.createdAt))?new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(n):t})]}),(0,ey.jsxs)("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(0,ey.jsxs)("b",{className:"font-medium text-emerald-600",children:["+",e.additions??0]}),(0,ey.jsxs)("b",{className:"font-medium text-rose-600",children:["-",e.deletions??0]})]})]},e.id)})})})]})})}function ZA(e){return e.replace(/^mut-/,"").slice(0,16)}let ZI=[{id:"models",label:"模型"},{id:"tools",label:"工具权限"},{id:"commands",label:"禁止命令"},{id:"folders",label:"工作区文件夹"},{id:"hosts",label:"可访问主机"}];function Zz({conversation:e,mainModels:t,ccModel:n="",sessionSettings:r,onMainModelsChange:a,onCcModelChange:i,onSessionSettingsChange:o,onClose:l,onEnterConversation:s}){let[c,u]=ew.useState("models"),d=wS(e.settings.engine);return(0,ey.jsxs)("div",{className:"vtl-app-background flex h-full min-h-0 flex-col text-foreground",children:[(0,ey.jsxs)("header",{className:"flex items-center gap-2 border-b px-3 py-2.5",children:[(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon","aria-label":"关闭设置",onClick:l,className:"shrink-0",children:(0,ey.jsx)(d3.XIcon,{className:"size-5"})}),(0,ey.jsxs)("button",{type:"button",className:"min-w-0 flex-1 rounded-lg px-2 py-1 text-left transition-colors hover:bg-muted/60",title:"返回该对话",onClick:()=>s?.(e),children:[(0,ey.jsxs)("div",{className:"text-[11px] text-muted-foreground",children:[e.agent," · 会话设置"]}),(0,ey.jsx)("div",{className:"truncate text-sm font-semibold",children:e.title})]})]}),(0,ey.jsx)("nav",{className:"flex shrink-0 gap-1 overflow-x-auto border-b px-3 py-2 vtl-scrollbar-hidden",children:ZI.map(e=>(0,ey.jsx)("button",{type:"button",onClick:()=>u(e.id),className:(0,eI.cn)("shrink-0 rounded-lg px-3 py-1.5 text-[13px] transition-colors",c===e.id?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:e.label},e.id))}),(0,ey.jsx)("div",{className:"min-h-0 flex-1 overflow-auto p-4 pb-[max(1.25rem,env(safe-area-inset-bottom))]",children:(0,ey.jsxs)("div",{className:"mx-auto w-full max-w-2xl",children:["models"===c?(0,ey.jsxs)("div",{className:"grid gap-4",children:[(0,ey.jsxs)("div",{className:"grid grid-cols-[5rem_minmax(0,1fr)] items-center gap-3 rounded-lg border bg-card px-3 py-2.5",children:[(0,ey.jsx)("span",{className:"text-sm text-muted-foreground",children:"运行引擎"}),(0,ey.jsx)("span",{className:"truncate text-sm font-medium text-foreground",children:function(e){switch(e){case"claude-code":return"Claude Code";case"reclaude":return"reclaude";default:return"Vantaloom"}}(e.settings.engine)})]}),d?(0,ey.jsxs)("div",{className:"grid gap-3",children:[(0,ey.jsx)("label",{htmlFor:"conversation-cc-model",className:"text-base font-semibold tracking-normal text-foreground",children:"Claude Code 模型"}),(0,ey.jsxs)(go,{value:""===n?wj:n,onValueChange:e=>i?.(e===wj?"":e),children:[(0,ey.jsx)(gX,{id:"conversation-cc-model",className:"w-full",children:(0,ey.jsx)(gu,{placeholder:"选择 Claude Code 模型"})}),(0,ey.jsx)(gJ,{children:wk.map(e=>(0,ey.jsx)(gQ,{value:e.value,children:e.label},e.value))})]}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"模型由 Claude Code 提供,不走 Vantaloom 模型路由。"})]}):(0,ey.jsx)(xi,{conversation:e,mainModels:t,onMainModelsChange:a})]}):null,"tools"===c?(0,ey.jsx)(wh,{value:r.allowedTools,onChange:e=>o({...r,allowedTools:e,deniedTools:[]})}):null,"commands"===c?(0,ey.jsx)(wp,{value:r.blockedCommands,onChange:e=>o({...r,blockedCommands:e})}):null,"folders"===c?(0,ey.jsxs)("div",{className:"grid gap-3",children:[(0,ey.jsx)(wm,{title:"可访问的工作区文件夹",value:r.folders,onValueChange:e=>o({...r,folders:d?e.slice(-1):e})}),d?(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"Claude Code 仅支持单个工作目录(作为会话的工作根目录)。"}):null]}):null,"hosts"===c?(0,ey.jsx)(ww,{value:r.hosts,onValueChange:e=>o({...r,hosts:e}),disabled:d,hint:d?"Claude Code 的工具锁定在所选 owner 机器本地,可访问主机已锁定。":void 0}):null]})})]})}function Z_({conversationId:e,ownerMachineId:t,open:n,onOpenChange:r,onEnterConversation:a}){let[i,o]=ew.useState(),[l,s]=ew.useState([]),[c,u]=ew.useState(""),[d,f]=ew.useState({folders:[],blockedCommands:[],allowedTools:[],deniedTools:[],plugins:[],hosts:[]});async function h(e){if(!i)return;let n=e.session??d,r=e.mainModels??l,a=e.ccModel??c,s={subagents:i.settings.subagents??[],mainModels:r,folders:n.folders,blockedCommands:n.blockedCommands,allowedTools:n.allowedTools,deniedTools:n.deniedTools,plugins:n.plugins,hosts:n.hosts,permissionMode:n.permissionMode??i.settings.permissionMode,engine:i.settings.engine,ccModel:i.settings.engine?a:void 0};try{let e=await sE(i.id,{settings:s},t);o(e.conversation)}catch{}}function p(){o(void 0),r(!1)}return(ew.useEffect(()=>{if(!n||!e)return;let r=!0;return async function(){try{let n=await sw(e,t);if(!r)return;let a=n.conversation;o(a),s(a.settings.mainModels),u(a.settings.ccModel??""),f({folders:a.settings.folders,blockedCommands:a.settings.blockedCommands,allowedTools:a.settings.allowedTools,deniedTools:a.settings.deniedTools,plugins:a.settings.plugins,hosts:a.settings.hosts})}catch{}}(),()=>{r=!1}},[e,n,t]),n&&i)?(0,ey.jsx)(Zz,{conversation:i,mainModels:l,ccModel:c,sessionSettings:d,onMainModelsChange:e=>{s(e),h({mainModels:e})},onCcModelChange:e=>{u(e),h({ccModel:e})},onSessionSettingsChange:e=>{f(e),h({session:e})},onClose:p,onEnterConversation:e=>{p(),a?.(e.id,t)}}):null}let ZD="local";async function ZR(e){return((await ZW(e,"")).canvases??[]).map(t=>ZH(t,e))}async function ZT(e,t){return ZV(await ZW(t,`/${encodeURIComponent(e)}`),t)}async function ZL(e,t){return ZV(await ZW(t,"",{method:"POST",body:JSON.stringify({title:e.title,nodes:e.nodes.map(dk),edges:e.edges.map(dS)})}),t)}async function Z$(e,t,n){return ZV(await ZW(n,`/${encodeURIComponent(e)}/save`,{method:"PUT",body:JSON.stringify({nodes:t.nodes.map(dk),edges:t.edges.map(dS),nodeIds:t.nodeIds})}),n)}async function ZF(e,t){return ZV(await ZW(t,`/${encodeURIComponent(e)}/open`,{method:"POST"}),t)}async function ZB(){let e={[ZD]:"本机"},t=[],n=[];try{n=await ZR(void 0)}catch{n=[]}let r=[];try{let{machines:e}=await sd();r=(e??[]).filter(e=>!e.isLocal&&"online"===e.status).map(e=>({id:e.id,name:e.name}))}catch{r=[]}let a=await Promise.all(r.map(async n=>{e[n.id]=n.name;try{return await ZR(n.id)}catch{return t.push(n.id),[]}})),i=new Map;for(let e of[...n,...a.flat()]){let t=i.get(e.id);(!t||e.updatedAt>t.updatedAt)&&i.set(e.id,e)}let o=Array.from(i.values());return o.sort((e,t)=>t.updatedAt>e.updatedAt?1:-1),{canvases:o,machineNames:e,unreachable:t}}function ZV(e,t){return{canvas:ZH(e.canvas,t),nodes:e.nodes??[],edges:e.edges??[]}}function ZH(e,t){let n=t&&t!==ZD?t:e.ownerMachineId??"local";return{id:e.id,title:e.title||"新画布",ownerMachineId:n,nodeCount:e.nodeCount??0,running:e.running??!1,createdAt:e.createdAt,updatedAt:e.updatedAt,lastOpenedAt:e.lastOpenedAt}}async function ZW(e,t,n,r){let a=await fetch(eD(!e||e===ZD?`/api/local/canvas${t}`:`/v1/remote/${e}/canvas${t}`),{cache:"no-store",...n,headers:{...n?.body?{"Content-Type":"application/json"}:{},...n?.headers}});if(r?.allowNotFound&&404===a.status)return;let i=await a.json().catch(()=>({}));if(!a.ok)throw Error("string"==typeof i?.error?i.error:"canvas api failed");return i}let ZU=(0,ek.default)("layout-template",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]),Zq=(0,ek.default)("lock-keyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]),ZK=(0,ek.default)("network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]),ZG=(0,ek.default)("plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]),ZX=(0,ek.default)("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]),ZY=(0,ek.default)("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]),ZZ={done:"Done",current:"Current",queued:"Queued",blocked:"Blocked"};function ZJ(e,t,n){return Math.min(Math.max(e,t),n)}function ZQ({items:e,currentId:t,labels:n,scrollCurrentIntoView:r=!0,className:a,viewportClassName:i,itemClassName:o,extendLineToViewport:l=!1,...s}){let c={...ZZ,...n},u=ew.useRef(null),d=ew.useRef(null),f=ew.useRef(null),h=ew.useRef(0),p=ew.useRef(void 0),[m,g]=ew.useState(0),v=t??e.find(e=>"current"===e.status)?.id,x=ew.useCallback(()=>{void 0!==p.current&&(cancelAnimationFrame(p.current),p.current=void 0)},[]),y=ew.useCallback((e,t=340)=>{let n=u.current,r=d.current;if(!n||!r)return;x();let a=Math.max(0,n.scrollHeight-n.clientHeight),i=n.scrollTop,o=ZJ(e,0,a),l=performance.now();h.current=o;let s=e=>{let r=ZJ((e-l)/t,0,1);if(n.scrollTop=i+(o-i)*(1-Math.pow(1-r,3)),r<1){p.current=requestAnimationFrame(s);return}n.scrollTop=o,p.current=void 0};p.current=requestAnimationFrame(s)},[x]),b=ew.useCallback(e=>{let t=u.current,n=d.current;if(!t||!n)return;let r=Math.max(0,t.scrollHeight-t.clientHeight);if(r<=0)return;e.preventDefault();let a=void 0===p.current?t.scrollTop:h.current,i=1===e.deltaMode?32*e.deltaY:2===e.deltaMode?e.deltaY*e.currentTarget.clientHeight:e.deltaY,o=Math.sign(i);if(0===o)return;let l=Array.from(n.querySelectorAll("[data-slot='roadmap-item']")).map(e=>e.offsetTop),s=ZJ(Math.ceil(Math.abs(i)/160),1,3),c=a;for(let e=0;e<s;e+=1)c=function(e,t,n,r){if(0===e.length)return t;if(n>0)return e.find(e=>e>t+1)??r;for(let n=e.length-1;n>=0;n-=1){let r=e[n];if(void 0!==r&&r<t-1)return r}return 0}(l,c,o,r);y(c)},[y]);return ew.useLayoutEffect(()=>{if(!r)return;let e=u.current,t=d.current,n=f.current;if(!e||!t||!n)return void g(0);let a=n.offsetTop,i=t.scrollHeight-m,o=Math.max(0,e.clientHeight-(i-a));g(e=>Math.abs(e-o)>.5?o:e),requestAnimationFrame(()=>{e.scrollTop=a,h.current=a})},[m,e,v,r]),ew.useEffect(()=>x,[x]),(0,ey.jsx)("div",{"data-slot":"roadmap",className:(0,eI.cn)("min-w-0 text-foreground",a),...s,children:(0,ey.jsx)("div",{"data-slot":"roadmap-viewport",ref:u,onWheel:b,className:(0,eI.cn)("max-h-72 overflow-y-auto overscroll-contain pr-2",i),children:(0,ey.jsxs)("div",{ref:d,className:(0,eI.cn)("relative",l&&"min-h-full"),children:[(0,ey.jsx)("span",{"aria-hidden":"true",className:"absolute top-0 bottom-0 left-[0.3125rem] w-px bg-border"}),e.map(e=>{let t=e.id===v?"current":e.status??"queued";return(0,ey.jsxs)("div",{ref:"current"===t?f:void 0,"data-slot":"roadmap-item","data-status":t,"aria-label":c[t],className:(0,eI.cn)("relative grid grid-cols-[1.5rem_minmax(0,1fr)_auto] items-start gap-2 py-2.5",o),children:[(0,ey.jsx)("span",{"aria-hidden":"true","data-slot":"roadmap-marker",className:(0,eI.cn)("relative z-10 mt-1 size-2.5 rounded-full border bg-background","done"===t&&"border-muted-foreground bg-muted-foreground","current"===t&&"border-primary bg-primary","queued"===t&&"border-border","blocked"===t&&"border-destructive bg-destructive")}),(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("div",{"data-slot":"roadmap-title",className:(0,eI.cn)("text-sm leading-5","queued"===t&&"text-muted-foreground","blocked"===t&&"text-destructive"),children:e.title}),e.description?(0,ey.jsx)("div",{"data-slot":"roadmap-description",className:"mt-0.5 text-xs leading-5 text-muted-foreground",children:e.description}):null]}),e.meta?(0,ey.jsx)("div",{"data-slot":"roadmap-meta",className:"pt-0.5 text-right ui-text-kbd text-muted-foreground",children:e.meta}):null]},e.id)}),m>0?(0,ey.jsx)("div",{"aria-hidden":"true","data-slot":"roadmap-bottom-spacer",style:{height:m}}):null]})})})}let Z0="/themes/jelly/bg1.png",Z1="/themes/jelly/bg2.png",Z2="/themes/jelly/bg3.png",Z5="/themes/jelly/bg4.png";function Z4({image:e,position:t="center",opacity:n=.72,blur:r="10px"}){return{"--vtl-jelly-card-image":`url("${e}")`,"--vtl-jelly-card-position":t,"--vtl-jelly-card-opacity":String(n),"--vtl-jelly-card-blur":r}}function Z3({title:e}){return(0,ey.jsx)("h2",{className:"h-7 text-sm font-semibold tracking-normal",children:e})}let Z6={product:"Vantaloom",overview:"运维总览",subtitle:"本机服务、工作组机器和 Agent 运行状态。",workgroup:"工作组",health:"系统健康",cost:"今日消耗",activeRuns:"运行中",queue:"排队任务",machineStatus:"机器状态",resourceTrend:"资源趋势",runMix:"运行构成",schedule:"日程提醒",incidents:"关注事项",online:"在线",local:"本机",p2p:"P2P",direct:"直连",sleeping:"休眠",memory:"内存",cpu:"CPU",gpu:"GPU",disk:"磁盘",theme:"主题"},Z8={search:"搜索控制台...",dashboard:"仪表盘",canvas:"画布",machines:"机器",schedules:"日程",settings:"设置",overview:"总览",runs:"运行",telemetry:"遥测",canvasRecent:"打开最近画布",canvasNew:"新建画布",canvasAll:"浏览所有画布",conversationRecent:"打开最近对话",conversationNew:"新建 Agent 对话",conversationAll:"浏览所有对话",fleet:"机器组",access:"访问控制",calendar:"计划任务",billing:"用量与账单"};Z6.local,Z6.direct,Z6.online,Z6.p2p,Z6.online,Z6.direct,Z6.sleeping,Z6.cpu,Z6.memory,Z6.activeRuns;function Z7(e){return e.reduce((e,t)=>Math.max(e,t.y+t.h),0)}function Z9({children:e}){return(0,ey.jsx)("section",{className:"vtl-app-background flex h-full min-h-0 flex-col pb-14 md:pb-0 text-foreground",children:(0,ey.jsx)(bQ,{className:"min-h-0 flex-1",children:e})})}function Je(e){return Math.max(0,...e.map(e=>e.y+e.h))}function Jt(e,t,n){return t.some(t=>t.id!==n&&e.x<t.x+t.w&&e.x+e.w>t.x&&e.y<t.y+t.h&&e.y+e.h>t.y)}function Jn(e){let t=Math.max(2,Math.min(12,e.w)),n=Math.max(1,e.h),r=Math.max(0,Math.min(12-t,e.x)),a=Math.max(0,e.y);return{...e,x:r,y:a,w:t,h:n}}function Jr(e,t,n,r,a){for(let i=0;i<Je(e)+8;i+=1)for(let o=0;o<=12-r;o+=1){let l={id:t,kind:n,x:o,y:i,w:r,h:a};if(!Jt(l,e))return l}return{id:t,kind:n,x:0,y:Je(e)+2,w:r,h:a}}function Ja(e){return{...e.defaultConfig}}function Ji(e){return e.payloads?.[KL]}function Jo({open:e,definitions:t,title:n="添加卡片",description:r="搜索并选择要添加到当前页面的卡片。",groupTitle:a="可添加卡片",onOpenChange:i,onAdd:o}){return(0,ey.jsx)(vE,{open:e,onOpenChange:i,title:n,description:r,className:"top-1/2 max-w-xl -translate-y-1/2",children:(0,ey.jsxs)(vM,{loop:!0,children:[(0,ey.jsx)(vO,{placeholder:"搜索可添加卡片..."}),(0,ey.jsxs)(vP,{className:"max-h-[420px]",children:[(0,ey.jsx)(vA,{children:"没有找到可添加的卡片。"}),(0,ey.jsx)(vI,{heading:a,children:t.map(e=>(0,ey.jsxs)(vz,{value:`${e.title} ${e.description}`,keywords:[e.id,e.defaultConfig.dataSource,e.defaultConfig.title],onSelect:()=>o(e.id),className:"min-h-14 items-start py-2",children:[(0,ey.jsx)("span",{className:"mt-0.5 grid size-8 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:e.icon}),(0,ey.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,ey.jsx)("span",{className:"block truncate font-medium",children:e.title}),(0,ey.jsx)("span",{className:"mt-0.5 block truncate ui-text-kbd text-muted-foreground",children:e.description})]}),(0,ey.jsxs)(v_,{children:[e.defaultSize.w,"x",e.defaultSize.h]})]},e.id))})]})]})})}function Jl({open:e,dragMode:t,label:n="页面卡片操作",onOpenChange:r,onAdd:a,onDragModeChange:i}){let o=[{key:"add",label:"添加卡片",icon:(0,ey.jsx)(lV,{className:"size-4"}),onClick:a,pressed:!1},{key:"drag",label:"拖拽排版",icon:(0,ey.jsx)(lR,{className:"size-4"}),onClick:()=>i(!t),pressed:t}];return(0,ey.jsx)("div",{className:"fixed right-5 bottom-5 z-30",children:(0,ey.jsxs)("div",{className:"relative size-8",children:[o.map((t,n)=>(0,ey.jsx)(eA.Button,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.label,"aria-pressed":t.pressed,onClick:t.onClick,className:(0,eI.cn)("absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur transition-[opacity,transform] duration-150 ease-out",t.pressed&&"border-foreground bg-foreground text-background shadow-lg ring-1 ring-background/50 hover:bg-foreground hover:text-background dark:bg-primary dark:text-primary-foreground dark:hover:bg-primary",e?"pointer-events-auto opacity-100":"pointer-events-none translate-y-1 opacity-0"),style:{transform:e?`translateY(-${(n+1)*42}px)`:void 0},children:t.icon},t.key)),(0,ey.jsx)(eA.Button,{type:"button",variant:"outline",size:"icon-sm","aria-label":n,"aria-expanded":e,onClick:()=>r(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,ey.jsx)(lF,{className:(0,eI.cn)("size-4 transition-transform",e&&"rotate-90")})})]})})}let Js=(0,ek.default)("settings",[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);function Jc({layout:e,layouts:t,cellSize:n,cellHeight:r,dragMode:a,selected:i,resizing:o,onSelect:l,onMove:s,onCut:c,onCopy:u,onSettingsOpen:d,onResizeStart:f,onResizeEnd:h,children:p}){let[m,g]=ew.useState(!1),v=r??n,x=e.x*(n+12),y=e.y*(v+12),b=e.w*n+(e.w-1)*12,w=e.h*v+(e.h-1)*12;return(0,ey.jsxs)("div",{"data-editable-card":e.id,className:(0,eI.cn)("absolute rounded-lg p-1 transition-[left,top,width,height,box-shadow] duration-200 ease-out",a&&"cursor-grab active:cursor-grabbing",m&&"duration-150",i&&!o&&"z-20 shadow-sm",o&&"z-30 transition-none"),style:{left:x,top:y,width:b,height:w},onPointerDown:function(r){if(!a||o)return;let i=r.target;if(i instanceof HTMLElement&&i.closest("[data-editable-card-action]"))return;r.preventDefault(),r.currentTarget.setPointerCapture(r.pointerId),l();let c=r.clientX,u=r.clientY;function d(r){let a=Jn({...e,x:e.x+Math.round((r.clientX-c)/(n+12)),y:e.y+Math.round((r.clientY-u)/(n+12))});Jt(a,t,e.id)||s(a)}g(!0),window.addEventListener("pointermove",d),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",d),window.removeEventListener("pointerup",e),g(!1)})},onClick:()=>{a&&l()},children:[(0,ey.jsx)("div",{className:(0,eI.cn)("size-full",a&&"pointer-events-none"),children:p}),i&&a&&!o?(0,ey.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-1 rounded-lg border-2 border-foreground"}):null,i&&a&&!o?(0,ey.jsx)(Ju,{onSettingsOpen:d,onCut:c,onCopy:u,onResizeStart:f}):null,o?(0,ey.jsx)(Jd,{layout:e,layouts:t,cellSize:n,onResize:s,onResizeEnd:h}):null]})}function Ju({onSettingsOpen:e,onCut:t,onCopy:n,onResizeStart:r}){return(0,ey.jsx)(lG,{"data-editable-card-action":!0,placement:"inline",size:"sm","aria-label":"卡片操作",className:"!absolute top-full left-1/2 z-40 mt-2 -translate-x-1/2 rounded-lg bg-popover/95 p-1 shadow-md",onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:(0,ey.jsxs)(lX,{children:[(0,ey.jsx)(lY,{type:"button","aria-label":"调整大小",onClick:r,children:(0,ey.jsx)(l$,{className:"size-4"})}),(0,ey.jsx)(lY,{type:"button","aria-label":"卡片设置",onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),e()},onClick:e=>e.stopPropagation(),children:(0,ey.jsx)(Js,{className:"size-4"})}),(0,ey.jsx)(lY,{type:"button","aria-label":"复制",onClick:n,children:(0,ey.jsx)(l_,{className:"size-4"})}),(0,ey.jsx)(lY,{type:"button","aria-label":"剪切",onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),t()},onClick:e=>e.stopPropagation(),children:(0,ey.jsx)(lW,{className:"size-4"})})]})})}function Jd({layout:e,layouts:t,cellSize:n,onResize:r,onResizeEnd:a}){return(0,ey.jsx)("div",{"data-editable-card-action":!0,className:"pointer-events-none absolute inset-1 z-40 border-2 border-foreground",children:[{id:"top-left",className:"top-0 left-0 -translate-x-1/2 -translate-y-1/2 cursor-nwse-resize"},{id:"top",className:"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2 cursor-ns-resize"},{id:"top-right",className:"top-0 right-0 translate-x-1/2 -translate-y-1/2 cursor-nesw-resize"},{id:"right",className:"top-1/2 right-0 translate-x-1/2 -translate-y-1/2 cursor-ew-resize"},{id:"bottom-right",className:"right-0 bottom-0 translate-x-1/2 translate-y-1/2 cursor-nwse-resize"},{id:"bottom",className:"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2 cursor-ns-resize"},{id:"bottom-left",className:"bottom-0 left-0 -translate-x-1/2 translate-y-1/2 cursor-nesw-resize"},{id:"left",className:"top-1/2 left-0 -translate-x-1/2 -translate-y-1/2 cursor-ew-resize"}].map(i=>(0,ey.jsx)("button",{type:"button","aria-label":`调整 ${i.id}`,className:(0,eI.cn)("pointer-events-auto absolute size-2.5 border border-foreground bg-background shadow-sm",i.className),onPointerDown:o=>(function(i,o){i.preventDefault(),i.stopPropagation(),i.currentTarget.setPointerCapture(i.pointerId);let l=i.clientX,s=i.clientY;function c(a){let i=Math.round((a.clientX-l)/(n+12)),c=Math.round((a.clientY-s)/(n+12)),u={...e};o.includes("right")&&(u.w=e.w+i),o.includes("bottom")&&(u.h=e.h+c),o.includes("left")&&(u.x=e.x+i,u.w=e.w-i),o.includes("top")&&(u.y=e.y+c,u.h=e.h-c),Jt(u=Jn(u),t,e.id)||r(u)}window.addEventListener("pointermove",c),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",e),a()})})(o,i.id)},i.id))})}function Jf({className:e,...t}){return(0,ey.jsx)(up,{"data-slot":"sheet-overlay",className:(0,eI.cn)("vtl-overlay fixed inset-0 z-50 animate-in fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",e),...t})}function Jh({className:e,children:t,side:n="right",showCloseButton:r=!0,...a}){return(0,ey.jsxs)(uf,{children:[(0,ey.jsx)(Jf,{}),(0,ey.jsxs)(ux,{"data-slot":"sheet-content","data-side":n,className:(0,eI.cn)("vtl-surface-modal fixed z-50 flex flex-col gap-4 border transition ease-in-out outline-none data-[state=closed]:animate-out data-[state=closed]:duration-200 data-[state=open]:animate-in data-[state=open]:duration-300","right"===n&&"inset-y-0 right-0 h-full w-3/4 border-r-0 data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm","left"===n&&"inset-y-0 left-0 h-full w-3/4 border-l-0 data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm","top"===n&&"inset-x-0 top-0 h-auto border-t-0 data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top","bottom"===n&&"inset-x-0 bottom-0 h-auto border-b-0 data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",e),...a,children:[t,r&&(0,ey.jsxs)(uM,{className:"absolute top-3 right-3 inline-flex size-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none disabled:pointer-events-none",children:[(0,ey.jsx)(d3.XIcon,{className:"size-4"}),(0,ey.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})}function Jp({className:e,...t}){return(0,ey.jsx)("div",{"data-slot":"sheet-header",className:(0,eI.cn)("grid gap-1.5 p-4 text-left",e),...t})}function Jm({className:e,...t}){return(0,ey.jsx)(uk,{"data-slot":"sheet-title",className:(0,eI.cn)("text-base leading-none font-semibold text-foreground",e),...t})}function Jg({className:e,...t}){return(0,ey.jsx)(uC,{"data-slot":"sheet-description",className:(0,eI.cn)("text-sm text-muted-foreground",e),...t})}function Jv({open:e,layout:t,definition:n,config:r,cellSize:a,onOpenChange:i,onConfigChange:o}){let l=t&&a>0?t.w*a+(t.w-1)*12:320,s=t&&a>0?t.h*a+(t.h-1)*12:180;return(0,ey.jsx)(uo,{open:e,onOpenChange:i,children:(0,ey.jsx)(Jh,{side:"right",className:"w-screen gap-0 border-0 bg-transparent p-0 shadow-none sm:max-w-none",children:t&&n&&r?(0,ey.jsxs)("div",{className:"grid h-full min-w-0 grid-cols-1 lg:grid-cols-[minmax(0,1fr)_24rem]",children:[(0,ey.jsx)(Jx,{width:l,height:s,className:"hidden lg:grid",children:n.render(r)}),(0,ey.jsxs)("div",{className:"animate-in slide-in-from-right-4 flex h-full w-full flex-col border-y-0 border-r-0 bg-background text-foreground shadow-lg duration-300",children:[(0,ey.jsxs)(Jp,{className:"border-b",children:[(0,ey.jsx)(Jm,{children:"卡片设置"}),(0,ey.jsxs)(Jg,{children:[n.title," · ",t.w,"x",t.h]})]}),(0,ey.jsxs)("div",{className:"grid flex-1 content-start gap-4 overflow-y-auto p-4",children:[(0,ey.jsxs)("label",{className:"grid gap-1.5",children:[(0,ey.jsx)("span",{className:"ui-text-control font-medium",children:"显示标题"}),(0,ey.jsx)(ez,{value:r.title,onChange:e=>o({title:e.currentTarget.value})})]}),(0,ey.jsxs)("label",{className:"grid gap-1.5",children:[(0,ey.jsx)("span",{className:"ui-text-control font-medium",children:"数据来源"}),(0,ey.jsx)(ez,{value:r.dataSource,onChange:e=>o({dataSource:e.currentTarget.value})})]}),(0,ey.jsxs)("label",{className:"grid gap-1.5",children:[(0,ey.jsx)("span",{className:"ui-text-control font-medium",children:"刷新间隔"}),(0,ey.jsx)(ez,{value:r.refreshRate,onChange:e=>o({refreshRate:e.currentTarget.value})})]}),(0,ey.jsxs)("label",{className:"grid gap-1.5",children:[(0,ey.jsx)("span",{className:"ui-text-control font-medium",children:"备注"}),(0,ey.jsx)("textarea",{value:r.note,rows:4,className:"min-h-24 resize-none rounded-lg border border-input bg-transparent px-2.5 py-2 ui-text-control transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50",onChange:e=>o({note:e.currentTarget.value})})]}),(0,ey.jsxs)("div",{className:"rounded-lg border bg-muted/20 p-3",children:[(0,ey.jsx)("div",{className:"ui-text-control font-medium",children:"当前绑定"}),(0,ey.jsxs)("div",{className:"mt-2 grid gap-1 ui-text-kbd text-muted-foreground",children:[(0,ey.jsxs)("span",{children:["类型:",n.id]}),(0,ey.jsxs)("span",{children:["来源:",r.dataSource]}),(0,ey.jsxs)("span",{children:["刷新:",r.refreshRate]})]})]})]})]})]}):null})})}function Jx({width:e,height:t,className:n,children:r}){let[a,i]=Go(),o=i.width>0&&i.height>0?Math.min(1,(i.width-32)/e,(i.height-32)/t):1;return(0,ey.jsx)("div",{ref:a,className:(0,eI.cn)("min-h-0 min-w-0 place-items-center overflow-hidden p-4",n),children:(0,ey.jsx)("div",{className:"animate-in fade-in-0 zoom-in-95 origin-center rounded-lg duration-300",style:{width:e,height:t,transform:`scale(${Math.max(.1,o)})`},children:r})})}function Jy({boardId:e,definitions:t,initialLayouts:n,clipboardItems:r=[],minRows:a=9,className:i,actionLabel:o,paletteGroupTitle:l,onClipboardItemsChange:s,onOverlayOpenChange:c}){var u;let[d,f]=ew.useState(!1),[h,p]=ew.useState(!1),[m,g]=ew.useState(!1),[v,x]=ew.useState(()=>n),[y,b]=ew.useState({}),[w,j]=ew.useState(),[k,S]=ew.useState(),[C,N]=ew.useState(),M=ew.useRef(0),E=ew.useRef(0),[O,P]=Go(),A=P.width>0?(u=P.width)<480?2:u<768?4:12:12,I=function(e,t){if(t>=12)return e;let n=[...e].sort((e,t)=>e.y!==t.y?e.y-t.y:e.x-t.x),r=[];for(let e of n){let n=Math.max(2,Math.min(t,Math.round(e.w*t/12))),a=e.h,i=!1;for(let o=0;o<Z7(r)+8&&!i;o+=1)for(let l=0;l<=t-n&&!i;l+=1){let t={...e,x:l,y:o,w:n,h:a};!function(e,t){return t.some(t=>e.x<t.x+t.w&&e.x+e.w>t.x&&e.y<t.y+t.h&&e.y+e.h>t.y)}(t,r)&&(r.push(t),i=!0)}i||r.push({...e,x:0,y:Z7(r),w:n,h:a})}return r}(v,A),z=P.width>0?(P.width-12*(A-1))/A:96,_=A<12?72:z,D=Math.max(a,Je(I)+2),R=D*_+(D-1)*12,T=ew.useMemo(()=>new Map(t.map(e=>[e.id,e])),[t]);function L(e){let t=T.get(e.kind);return y[e.id]??(t?Ja(t):void 0)}function $(e){x(t=>{let n=Jn(e);return Jt(n,t,n.id)?t:t.map(e=>e.id===n.id?n:e)})}function F(e){let t=T.get(e);if(!t)return;E.current+=1;let n=`${e}-added-${E.current}`,r=Jr(v,n,e,t.defaultSize.w,t.defaultSize.h);x(e=>[...e,r]),b(e=>({...e,[n]:Ja(t)})),j(n),S(void 0),p(!1)}function B(e,t){let n=v.find(t=>t.id===e),r=n?T.get(n.kind):void 0;n&&r&&b(n=>({...n,[e]:{...n[e]??Ja(r),...t}}))}ew.useEffect(()=>{c?.(h||!!C)},[h,c,C]),ew.useEffect(()=>()=>c?.(!1),[c]),ew.useEffect(()=>{m||(j(void 0),S(void 0))},[m]),ew.useEffect(()=>{if(k)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof HTMLElement&&t.closest("[data-editable-card-action]")||(j(k),S(void 0))}},[k]);let V=A<12,H=C?v.find(e=>e.id===C):void 0,W=H?T.get(H.kind):void 0,U=H?L(H):void 0;if(V){let n=[...I].sort((e,t)=>e.y-t.y||e.x-t.x),r=Object.fromEntries(v.map(e=>[e.id,e.w]));return(0,ey.jsxs)(Z9,{children:[(0,ey.jsx)("div",{ref:O,"data-editable-card-board":e,className:(0,eI.cn)("mx-auto max-w-7xl p-3",i),children:(0,ey.jsx)("div",{className:"grid grid-cols-2 gap-3",children:n.map(e=>{let t=T.get(e.kind);if(!t)return null;let n=L(e);if(!n)return null;let a=(r[e.id]??e.w)>6;return(0,ey.jsx)("div",{className:(0,eI.cn)("min-w-0 overflow-hidden rounded-lg",a&&"col-span-2"),style:{minHeight:a?200:120},children:t.render(n)},e.id)})})}),(0,ey.jsx)(Jl,{open:d,dragMode:!1,label:o,onOpenChange:f,onAdd:()=>{f(!1),p(!0)},onDragModeChange:g}),(0,ey.jsx)(Jo,{open:h,definitions:t,groupTitle:l,onOpenChange:p,onAdd:F}),(0,ey.jsx)(Jv,{open:!!(H&&W&&U),layout:H,definition:W,config:U,cellSize:z,onOpenChange:e=>{e||N(void 0)},onConfigChange:e=>{H&&B(H.id,e)}})]})}return(0,ey.jsxs)(Z9,{children:[(0,ey.jsx)("div",{ref:O,"data-editable-card-board":e,className:(0,eI.cn)("relative mx-auto max-w-7xl p-4 lg:p-6",m&&"select-none",i),style:{minHeight:R+48},onDragOver:e=>{Array.from(e.dataTransfer.types).includes(KL)&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},onDrop:function(e){let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id");if(!t)return;let n=r.find(e=>e.id===t),a=n&&Ji(n);if(!n||!a||!T.has(a.kind))return;e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move";let i=O.current,o=i?.getBoundingClientRect();!function(e,t){let n=Ji(e);if(!n||!T.has(n.kind))return;E.current+=1;let r=`${n.kind}-clip-${E.current}`,a=Jn({id:r,kind:n.kind,x:t?.x??0,y:t?.y??Je(v),w:n.w,h:n.h}),i=t&&!Jt(a,v)?a:Jr(v,r,n.kind,n.w,n.h);x(e=>[...e,i]),b(e=>({...e,[r]:{...n.config}})),j(r),S(void 0)}(n,{x:o&&z>0?Math.round((e.clientX-o.left-24)/(z+12)):0,y:o&&z>0?Math.round((e.clientY-o.top-24)/(z+12)):Je(v)})},onPointerDown:e=>{e.target===e.currentTarget&&(j(void 0),m||S(void 0))},children:(0,ey.jsx)("div",{className:"relative",style:{height:R},children:I.map(t=>{let n=T.get(t.kind);if(!n)return null;let r=L(t);return r?(0,ey.jsx)(Jc,{layout:t,layouts:I,cellSize:z,cellHeight:_,dragMode:m,selected:w===t.id,resizing:k===t.id,onSelect:()=>{m&&j(t.id)},onMove:$,onCut:()=>(function(t){let n=v.find(e=>e.id===t),r=n?T.get(n.kind):void 0,a=n?L(n):void 0;if(!n||!r||!a)return;let i=function({boardId:e,layout:t,definition:n,config:r}){let a={boardId:e,kind:t.kind,w:t.w,h:t.h,config:{...r}};return{id:`clip-${e}-${t.id}`,title:r.title||n.title,description:n.description,meta:`${t.w}x${t.h}`,icon:n.icon,dragData:{"application/vnd.vantaloom.clip-kind":"workspace-card","application/vnd.vantaloom.workspace-card-board":e,"application/vnd.vantaloom.workspace-card-kind":t.kind,"application/vnd.vantaloom.workspace-card-width":String(t.w),"application/vnd.vantaloom.workspace-card-height":String(t.h),"application/vnd.vantaloom.workspace-card-config":JSON.stringify(r),[KL]:JSON.stringify(a)},payloads:{[KL]:a}}}({boardId:e,layout:n,definition:r,config:a});s?.(e=>[i,...e.filter(e=>e.id!==i.id)]),x(e=>e.filter(e=>e.id!==t)),b(e=>{let n={...e};return delete n[t],n}),j(void 0),S(void 0),N(e=>e===t?void 0:e)})(t.id),onCopy:()=>(function(e){let t=v.find(t=>t.id===e),n=t?T.get(t.kind):void 0;if(!t||!n)return;M.current+=1;let r=`${e}-copy-${M.current}`,a=Jr(v,r,t.kind,t.w,t.h);x(e=>[...e,a]),b(t=>({...t,[r]:t[e]??Ja(n)})),j(r)})(t.id),onSettingsOpen:()=>N(t.id),onResizeStart:()=>{j(void 0),S(t.id)},onResizeEnd:()=>{j(t.id),S(void 0)},children:n.render(r)},t.id):null})})}),(0,ey.jsx)(Jl,{open:d,dragMode:m,label:o,onOpenChange:f,onAdd:()=>{f(!1),p(!0)},onDragModeChange:g}),(0,ey.jsx)(Jo,{open:h,definitions:t,groupTitle:l,onOpenChange:p,onAdd:F}),(0,ey.jsx)(Jv,{open:!!(H&&W&&U),layout:H,definition:W,config:U,cellSize:z,onOpenChange:e=>{e||N(void 0)},onConfigChange:e=>{H&&B(H.id,e)}})]})}function Jb({parts:e}){return(0,ey.jsx)(ey.Fragment,{children:e.map((e,t)=>(0,ey.jsx)("span",{className:e.small?"text-[0.55em]":void 0,children:e.text},`${e.text}-${t}`))})}function Jw({value:e,minSize:t=24,maxSize:n=180,className:r,...a}){let i=ew.useRef(null),o=ew.useRef(null),[l,s]=ew.useState(t),c=function(e){let t=e.trim();if(/^[$¥€]\s*\d/.test(t))return[{text:t.replace(/^[$¥€]\s*/,""),small:!1},{text:t[0]??"",small:!0}];let n=t.match(/^(.+?)\s*\/\s*(.+)$/);if(n)return[{text:n[1]??"",small:!1},{text:"/",small:!0},{text:n[2]??"",small:!1}];let r=t.match(/^(.+?)([%a-zA-Z$¥€]+)$/);return r?[{text:r[1]??t,small:!1},{text:r[2]??"",small:!0}]:[{text:t,small:!1}]}(e);return ew.useLayoutEffect(()=>{let e=i.current,r=o.current;if(!e||!r)return;function a(e,r){let a=e.clientWidth,i=e.clientHeight;if(a<=0||i<=0)return;let o=t,l=n,c=t;for(;o<=l;){let e=Math.floor((o+l)/2);r.style.fontSize=`${e}px`,r.getBoundingClientRect().width<=a&&r.getBoundingClientRect().height<=i?(c=e,o=e+1):l=e-1}s(c)}a(e,r);let l=new ResizeObserver(()=>a(e,r));return l.observe(e),()=>l.disconnect()},[n,t,e]),(0,ey.jsxs)("div",{ref:i,className:(0,eI.cn)("relative min-h-0 min-w-0 overflow-hidden",r),...a,children:[(0,ey.jsx)("span",{ref:o,"aria-hidden":"true",className:"pointer-events-none invisible absolute right-0 bottom-0 flex items-baseline whitespace-nowrap font-semibold leading-none tracking-normal",children:(0,ey.jsx)(Jb,{parts:c})}),(0,ey.jsx)("span",{className:"absolute right-0 bottom-0 flex max-w-full items-baseline whitespace-nowrap font-semibold leading-none tracking-normal text-foreground",style:{fontSize:l},children:(0,ey.jsx)(Jb,{parts:c})})]})}function Jj(e){return/^\d+$/.test(e)&&1===e.length?`0${e}`:/^\d+(?:\.\d+)?%$/.test(e)?`${Number.parseFloat(e).toFixed(1)}%`:e}function Jk({label:e,value:t,minSize:n=42,maxSize:r=180,valueClassName:a="absolute right-0 bottom-0 h-2/3 w-full"}){return(0,ey.jsxs)("div",{className:"relative h-full min-h-0",children:[(0,ey.jsx)("div",{className:"text-xl font-semibold tracking-normal",children:e}),(0,ey.jsx)(Jw,{value:Jj(t),minSize:n,maxSize:r,className:a})]})}function JS(e){return Math.max(0,Math.min(100,Math.round(e)))}function JC({className:e,value:t=0,...n}){let r=JS(t);return(0,ey.jsx)("div",{"data-slot":"progress",role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r,className:(0,eI.cn)("relative h-1.5 w-full overflow-hidden rounded-full bg-muted",e),...n,children:(0,ey.jsx)("div",{"data-slot":"progress-indicator",className:"h-full rounded-full bg-primary transition-all",style:{width:`${r}%`}})})}function JN({className:e,value:t=0,label:n,showValue:r=!0,...a}){let i=JS(t),o=2*Math.PI*39;return(0,ey.jsxs)("div",{"data-slot":"progress-ring","aria-label":n?`${n} ${i}%`:`${i}%`,role:"img",className:(0,eI.cn)("relative grid size-24 place-items-center",e),...a,children:[(0,ey.jsxs)("svg",{"aria-hidden":"true","data-slot":"progress-ring-svg",viewBox:"0 0 100 100",className:"absolute inset-0 size-full overflow-visible",children:[(0,ey.jsx)("circle",{cx:"50",cy:"50",r:39,fill:"none",stroke:"var(--muted)",strokeWidth:12}),i>0&&(0,ey.jsx)("circle",{cx:"50",cy:"50",r:39,fill:"none",stroke:"var(--primary)",strokeDasharray:o,strokeDashoffset:o-i/100*o,strokeLinecap:"round",strokeWidth:12,className:"origin-center -rotate-90 transition-all"})]}),(0,ey.jsx)("div",{"data-slot":"progress-ring-center",className:"relative z-10 grid size-16 place-items-center rounded-full bg-card",children:r&&(0,ey.jsxs)("span",{className:"ui-text-control font-medium tabular-nums",children:[i,"%"]})})]})}(0,ek.default)("timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);let JM=(0,ek.default)("clock",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);function JE({canvases:e,mode:t="active",scrollable:n=!1,onSelect:r}){let a=ew.useMemo(()=>e.map(e=>{var n;return{id:e.id,status:"live"===(n=e).status?"current":"review"===n.status?"blocked":"done",title:(0,ey.jsx)(JO,{canvas:e,mode:t,onClick:()=>r(e)})}}),[e,t,r]);return(0,ey.jsx)(ZQ,{items:a,scrollCurrentIntoView:!1,className:(0,eI.cn)("mt-2",n&&"min-h-0 flex-1"),viewportClassName:(0,eI.cn)("max-h-none pr-0",n?"h-full overflow-y-auto":"overflow-visible"),itemClassName:"py-2"})}function JO({canvas:e,onClick:t,mode:n}){return(0,ey.jsxs)("button",{type:"button",className:(0,eI.cn)("grid w-full items-center gap-4 rounded-lg px-2 py-0 text-left transition-colors hover:bg-muted/50","active"===n?"grid-cols-[minmax(0,1fr)_8rem_1.75rem]":"grid-cols-[minmax(0,1fr)_7rem_7rem_8rem]"),onClick:t,children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("div",{className:"truncate text-sm font-medium",children:e.title}),(0,ey.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:"active"===n?e.purpose:`${e.nodes} nodes`})]}),"active"===n?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(JC,{value:e.progress,className:"h-1.5"}),(0,ey.jsx)("span",{"aria-label":e.progress>=100?"Canvas complete":"Canvas incomplete",className:(0,eI.cn)("size-2.5 rounded-full",e.progress>=100?"bg-primary":"bg-border")})]}):(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(JP,{icon:(0,ey.jsx)(BT,{}),value:`${e.snapshots}`}),(0,ey.jsx)(JP,{icon:(0,ey.jsx)(JM,{}),value:e.runtime}),(0,ey.jsx)("div",{className:"text-right ui-text-kbd text-muted-foreground",children:e.lastOpened})]})]})}function JP({icon:e,value:t}){return(0,ey.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,ey.jsx)("span",{className:"[&_svg]:size-3.5",children:e}),(0,ey.jsx)("span",{className:"tabular-nums",children:t})]})}let JA=(0,ek.default)("memory-stick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]),JI=(0,ek.default)("radio-tower",[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]]),Jz=(0,ek.default)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);(0,ek.default)("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);var J_=ew;function JD(){return(JD=Object.assign.bind()).apply(null,arguments)}function JR(e){return ew.createElement(_N,JD({shapeType:"rectangle",activeClassName:"recharts-active-bar",inActiveClassName:"recharts-inactive-bar"},e))}var JT=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(n,r)=>{if(jI(e))return e;var a=jI(n)||null==n;return a?e(n,r):(a||function(e,t){if(!e)throw Error("Invariant failed")}(!1,"minPointSize callback function received a value with type of ".concat(typeof n,". Currently only numbers or null/undefined are supported.")),t)}},JL=["children"],J$=(0,ew.createContext)({data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function JF(e){var{children:t}=e,n=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,JL);return ew.createElement(J$.Provider,{value:n},t)}var JB=(e,t,n)=>{var r=null!=n?n:e;if(null!=r)return jR(r,t,0)};function JV(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function JH(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?JV(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):JV(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var JW=jc([Pe,(e,t)=>t],(e,t)=>e.filter(e=>"bar"===e.type).find(e=>e.id===t)),JU=jc([JW],e=>null==e?void 0:e.maxBarSize),Jq=jc([CT,Pe,GG,GX,(e,t,n)=>n],(e,t,n,r,a)=>t.filter(t=>"horizontal"===e?t.xAxisId===n:t.yAxisId===r).filter(e=>e.isPanorama===a).filter(e=>!1===e.hide).filter(e=>"bar"===e.type)),JK=jc([Jq,e=>e.rootProps.barSize,(e,t)=>{var n=CT(e),r=GG(e,t),a=GX(e,t);if(null!=r&&null!=a)return"horizontal"===n?Aj(e,"xAxis",r):Aj(e,"yAxis",a)}],(e,t,n)=>{var r=e.filter(NS),a=e.filter(e=>null==e.stackId);return[...Object.entries(r.reduce((e,t)=>{var n=e[t.stackId];return null==n&&(n=[]),n.push(t),e[t.stackId]=n,e},{})).map(e=>{var r,[a,i]=e;return{stackId:a,dataKeys:i.map(e=>e.dataKey),barSize:JB(t,n,null==(r=i[0])?void 0:r.barSize)}}),...a.map(e=>({stackId:void 0,dataKeys:[e.dataKey].filter(e=>null!=e),barSize:JB(t,n,e.barSize)}))]}),JG=(e,t,n)=>{var r,a,i=CT(e),o=GG(e,t),l=GX(e,t);if(null!=o&&null!=l)return"horizontal"===i?(r=AE(e,"xAxis",o,n),a=AM(e,"xAxis",o,n)):(r=AE(e,"yAxis",l,n),a=AM(e,"yAxis",l,n)),j4(r,a)},JX=jc([JK,CQ,e=>e.rootProps.barGap,C0,(e,t,n)=>{var r,a,i,o,l=JW(e,t);if(null==l)return 0;var s=GG(e,t),c=GX(e,t);if(null==s||null==c)return 0;var u=CT(e),d=CQ(e),{maxBarSize:f}=l;return"horizontal"===u?(i=AE(e,"xAxis",s,n),o=AM(e,"xAxis",s,n)):(i=AE(e,"yAxis",c,n),o=AM(e,"yAxis",c,n)),null!=(r=null!=(a=j4(i,o,!0))?a:null==f?d:f)?r:0},JG,JU],(e,t,n,r,a,i,o)=>{var l=function(e,t,n,r,a){var i,o,l=r.length;if(!(l<1)){var s=jR(e,n,0,!0),c=[];if(jW(null==(i=r[0])?void 0:i.barSize)){var u=!1,d=n/l,f=r.reduce((e,t)=>e+(t.barSize||0),0);(f+=(l-1)*s)>=n&&(f-=(l-1)*s,s=0),f>=n&&d>0&&(u=!0,d*=.9,f=l*d);var h={offset:((n-f)/2|0)-s,size:0};o=r.reduce((e,t)=>{var n,r={stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:h.offset+h.size+s,size:u?d:null!=(n=t.barSize)?n:0}},a=[...e,r];return h=r.position,a},c)}else{var p=jR(t,n,0,!0);n-2*p-(l-1)*s<=0&&(s=0);var m=(n-2*p-(l-1)*s)/l;m>1&&(m>>=0);var g=jW(a)?Math.min(m,a):m;o=r.reduce((e,t,n)=>[...e,{stackId:t.stackId,dataKeys:t.dataKeys,position:{offset:p+(m+s)*n+(m-g)/2,size:g}}],c)}return o}}(n,r,a!==i?a:i,e,null==o?t:o);return a!==i&&null!=l&&(l=l.map(e=>JH(JH({},e),{},{position:JH(JH({},e.position),{},{offset:e.position.offset-a/2})}))),l}),JY=jc([JX,JW],(e,t)=>{if(null!=e&&null!=t){var n=e.find(e=>e.stackId===t.stackId&&null!=t.dataKey&&e.dataKeys.includes(t.dataKey));if(null!=n)return n.position}}),JZ=jc([(e,t,n)=>{var r=CT(e),a=GG(e,t),i=GX(e,t);if(null!=a&&null!=i)return"horizontal"===r?PC(e,"yAxis",i,n):PC(e,"xAxis",a,n)},JW],(e,t)=>{var n=Nj(t);if(!e||null==n||null==t)return;var{stackId:r}=t;if(null!=r){var a=e[r];if(a){var{stackedData:i}=a;if(i)return i.find(e=>e.key===n)}}}),JJ=jc([kl,kc,(e,t,n)=>{var r=GG(e,t);if(null!=r)return AE(e,"xAxis",r,n)},(e,t,n)=>{var r=GX(e,t);if(null!=r)return AE(e,"yAxis",r,n)},(e,t,n)=>{var r=GG(e,t);if(null!=r)return AM(e,"xAxis",r,n)},(e,t,n)=>{var r=GX(e,t);if(null!=r)return AM(e,"yAxis",r,n)},JY,CT,jp,JG,JZ,JW,(e,t,n,r)=>r],(e,t,n,r,a,i,o,l,s,c,u,d,f)=>{var h,{chartData:p,dataStartIndex:m,dataEndIndex:g}=s;if(null!=d&&null!=o&&null!=t&&("horizontal"===l||"vertical"===l)&&null!=n&&null!=r&&null!=a&&null!=i&&null!=c){var{data:v}=d;if(null!=(h=null!=v&&v.length>0?v:null==p?void 0:p.slice(m,g+1)))return function(e){var{layout:t,barSettings:{dataKey:n,minPointSize:r,hasCustomShape:a},pos:i,bandSize:o,xAxis:l,yAxis:s,xAxisTicks:c,yAxisTicks:u,stackedData:d,displayedData:f,offset:h,cells:p,parentViewBox:m,dataStartIndex:g}=e,v="horizontal"===t?s:l,x=d?v.scale.domain():null,y=(e=>{var{numericAxis:t}=e,n=t.scale.domain();if("number"===t.type){var r=Math.min(n[0],n[1]),a=Math.max(n[0],n[1]);return r<=0&&a>=0?0:a<0?a:r}return n[0]})({numericAxis:v}),b=v.scale.map(y);return f.map((e,f)=>{if(d){var v=d[f+g];if(null==v)return null;j=((e,t)=>{if(!t||2!==t.length||!jI(t[0])||!jI(t[1]))return e;var n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),a=[e[0],e[1]];return(!jI(e[0])||e[0]<n)&&(a[0]=n),(!jI(e[1])||e[1]>r)&&(a[1]=r),a[0]>r&&(a[0]=r),a[1]<n&&(a[1]=n),a})(v,x)}else Array.isArray(j=jG(e,n))||(j=[y,j]);var w=JT(r,0)(j[1],f);if("horizontal"===t){var j,k,S,C,N,M,E,O=s.scale.map(j[0]),P=s.scale.map(j[1]);if(null==O||null==P)return null;k=j1({axis:l,ticks:c,bandSize:o,offset:i.offset,entry:e,index:f}),S=null!=(E=null!=P?P:O)?E:void 0,C=i.size;var A=O-P;if(N=jP(A)?0:A,M={x:k,y:h.top,width:C,height:h.height},Math.abs(w)>0&&Math.abs(N)<Math.abs(w)){var I=jO(N||w)*(Math.abs(w)-Math.abs(N));S-=I,N+=I}}else{var z=l.scale.map(j[0]),_=l.scale.map(j[1]);if(null==z||null==_)return null;if(k=z,S=j1({axis:s,ticks:u,bandSize:o,offset:i.offset,entry:e,index:f}),C=_-z,N=i.size,M={x:h.left,y:S,width:h.width,height:N},Math.abs(w)>0&&Math.abs(C)<Math.abs(w)){var D=jO(C||w)*(Math.abs(w)-Math.abs(C));C+=D}}return null!=k&&null!=S&&null!=C&&null!=N&&(a||0!==C&&0!==N)?Qi(Qi({},e),{},{stackedBarStart:b,x:k,y:S,width:C,height:N,value:d?j:j[1],payload:e,background:M,tooltipPosition:{x:k+C/2,y:S+N/2},parentViewBox:m,originalDataIndex:f},p&&p[f]&&p[f].props):null}).filter(Boolean)}({layout:l,barSettings:d,pos:o,parentViewBox:t,bandSize:c,xAxis:n,yAxis:r,xAxisTicks:a,yAxisTicks:i,stackedData:u,displayedData:h,offset:e,cells:f,dataStartIndex:m})}}),JQ=(e,t)=>t,J0=(e,t,n)=>n,J1=jc([JQ,Pe,J0],(e,t,n)=>t.filter(e=>"bar"===e.type).filter(t=>t.stackId===e).filter(e=>e.isPanorama===n).filter(e=>!e.hide)),J2=jc([J1],e=>e.map(e=>e.id)),J5=jc([e=>e,JQ,J0],(e,t,n)=>{var r=J2(e,t,n),a=[];return r.forEach(t=>{var r=JJ(e,t,n,void 0);null==r||r.forEach(e=>{var t=e.originalDataIndex;a[t]=((e,t)=>{if(!e)return t;if(!t)return e;var n=Math.min(e.x,e.x+e.width,t.x,t.x+t.width),r=Math.min(e.y,e.y+e.height,t.y,t.y+t.height);return{x:n,y:r,width:Math.max(e.x,e.x+e.width,t.x,t.x+t.width)-n,height:Math.max(e.y,e.y+e.height,t.y,t.y+t.height)-r}})(a[t],e)})}),a}),J4=["index"];function J3(){return(J3=Object.assign.bind()).apply(null,arguments)}var J6=(0,ew.createContext)(void 0),J8=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),J7=e=>{var{index:t}=e,n=function(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,J4),r=(e=>{var t=(0,ew.useContext)(J6);if(null!=t){var{stackId:n}=t;return"url(#".concat(J8(n,e),")")}})(t);return ew.createElement(A7,J3({className:"recharts-bar-stack-layer",clipPath:r},n))},J9=["onMouseEnter","onMouseLeave","onClick"],Qe=["value","background","tooltipPosition"],Qt=["id"],Qn=["onMouseEnter","onClick","onMouseLeave"];function Qr(){return(Qr=Object.assign.bind()).apply(null,arguments)}function Qa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Qi(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Qa(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Qa(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Qo(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var Ql=J_.memo(e=>{var{dataKey:t,stroke:n,strokeWidth:r,fill:a,name:i,hide:o,unit:l,tooltipType:s,id:c}=e,u={dataDefinedOnItem:void 0,getPosition:jV,settings:{stroke:n,strokeWidth:r,fill:a,dataKey:t,nameKey:void 0,name:j6(i,t),hide:o,type:s,color:a,unit:l,graphicalItemId:c}};return J_.createElement(Dw,{tooltipEntrySettings:u})});function Qs(e){var t,n=kv(Rm),{data:r,dataKey:a,background:i,allOtherBarProps:o}=e,{onMouseEnter:l,onMouseLeave:s,onClick:c}=o,u=Qo(o,J9),d=Dx(l,a,o.id),f=Dy(s),h=Db(c,a,o.id);if(!i||null==r)return null;var p=A4(i);return J_.createElement(R3,{zIndex:(t=Nn.barBackground,i&&"object"==typeof i&&"zIndex"in i&&"number"==typeof i.zIndex&&jW(i.zIndex)?i.zIndex:t)},r.map((e,t)=>{var{value:r,background:o,tooltipPosition:l}=e,s=Qo(e,Qe);if(!o)return null;var c=d(e,t),m=f(e,t),g=h(e,t),v=Qi(Qi(Qi(Qi(Qi({option:i,isActive:String(t)===n},s),{},{fill:"#eee"},o),p),IO(u,e,t)),{},{onMouseEnter:c,onMouseLeave:m,onClick:g,dataKey:a,index:t,className:"recharts-bar-background-rectangle"});return J_.createElement(JR,Qr({key:"background-bar-".concat(t)},v))}))}function Qc(e){var{showLabels:t,children:n,rects:r}=e,a=null==r?void 0:r.map(e=>{var t={x:e.x,y:e.y,width:e.width,lowerWidth:e.width,upperWidth:e.width,height:e.height};return Qi(Qi({},t),{},{value:e.value,payload:e.payload,parentViewBox:e.parentViewBox,viewBox:t,fill:e.fill})});return J_.createElement(Ty,{value:t?a:void 0},n)}function Qu(e){var t,{shape:n,activeBar:r,baseProps:a,entry:i,index:o,dataKey:l}=e,s=kv(Rm),c=kv(Rv),u=r&&String(i.originalDataIndex)===s&&(null==c||l===c),[d,f]=(0,J_.useState)(!1),[h,p]=(0,J_.useState)(!1);(0,J_.useEffect)(()=>{var e;return u?(f(!0),e=requestAnimationFrame(()=>{p(!0)})):p(!1),()=>{cancelAnimationFrame(e)}},[u]);var m=(0,J_.useCallback)(()=>{u||f(!1)},[u]),g=u&&h,v=u||d;t=u?!0===r?n:r:n;var x=J_.createElement(JR,Qr({},a,{name:String(a.name)},i,{isActive:g,option:t,index:o,dataKey:l,onTransitionEnd:m}));return v?J_.createElement(R3,{zIndex:Nn.activeBar},J_.createElement(J7,{index:i.originalDataIndex},x)):x}function Qd(e){var{shape:t,baseProps:n,entry:r,index:a,dataKey:i}=e;return J_.createElement(JR,Qr({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:a,dataKey:i}))}function Qf(e){var t,{data:n,props:r}=e,a=null!=(t=A5(r))?t:{},{id:i}=a,o=Qo(a,Qt),{shape:l,dataKey:s,activeBar:c}=r,{onMouseEnter:u,onClick:d,onMouseLeave:f}=r,h=Qo(r,Qn),p=Dx(u,s,i),m=Dy(f),g=Db(d,s,i);return n?J_.createElement(J_.Fragment,null,n.map((e,t)=>J_.createElement(J7,Qr({index:e.originalDataIndex,key:"rectangle-".concat(null==e?void 0:e.x,"-").concat(null==e?void 0:e.y,"-").concat(null==e?void 0:e.value,"-").concat(t),className:"recharts-bar-rectangle"},IO(h,e,t),{onMouseEnter:p(e,t),onMouseLeave:m(e,t),onClick:g(e,t)}),c?J_.createElement(Qu,{shape:l,activeBar:c,baseProps:o,entry:e,index:t,dataKey:s}):J_.createElement(Qd,{shape:l,baseProps:o,entry:e,index:t,dataKey:s})))):null}function Qh(e){var{props:t,previousRectanglesRef:n}=e,{data:r,layout:a,isAnimationActive:i,animationBegin:o,animationDuration:l,animationEasing:s,onAnimationEnd:c,onAnimationStart:u}=t,d=n.current,f=zF(t,"recharts-bar-"),[h,p]=(0,J_.useState)(!1),m=(0,J_.useCallback)(()=>{"function"==typeof c&&c(),p(!1)},[c]),g=(0,J_.useCallback)(()=>{"function"==typeof u&&u(),p(!0)},[u]);return J_.createElement(Qc,{showLabels:!h,rects:r},J_.createElement(z$,{animationId:f,begin:o,duration:l,isActive:i,easing:s,onAnimationEnd:m,onAnimationStart:g,key:f},e=>{var i=1===e?r:null==r?void 0:r.map((t,n)=>{var r=d&&d[n];if(r)return Qi(Qi({},t),{},{x:jL(r.x,t.x,e),y:jL(r.y,t.y,e),width:jL(r.width,t.width,e),height:jL(r.height,t.height,e)});if("horizontal"===a){var i=jL(0,t.height,e),o=jL(t.stackedBarStart,t.y,e);return Qi(Qi({},t),{},{y:o,height:i})}var l=jL(0,t.width,e),s=jL(t.stackedBarStart,t.x,e);return Qi(Qi({},t),{},{width:l,x:s})});return(e>0&&(n.current=null!=i?i:null),null==i)?null:J_.createElement(A7,null,J_.createElement(Qf,{props:t,data:i}))}),J_.createElement(Tk,{label:t.label}),t.children)}function Qp(e){var t=(0,J_.useRef)(null);return J_.createElement(Qh,{previousRectanglesRef:t,props:e})}var Qm=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:jG(e,t)}};class Qg extends J_.PureComponent{render(){var{hide:e,data:t,dataKey:n,className:r,xAxisId:a,yAxisId:i,needClip:o,background:l,id:s}=this.props;if(e||null==t)return null;var c=(0,w1.clsx)("recharts-bar",r);return J_.createElement(A7,{className:c,id:s},o&&J_.createElement("defs",null,J_.createElement(GK,{clipPathId:s,xAxisId:a,yAxisId:i})),J_.createElement(A7,{className:"recharts-bar-rectangles",clipPath:o?"url(#clipPath-".concat(s,")"):void 0},J_.createElement(Qs,{data:t,dataKey:n,background:l,allOtherBarProps:this.props}),J_.createElement(Qp,this.props)))}}var Qv={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:0,xAxisId:0,yAxisId:0,zIndex:Nn.bar};function Qx(e){var t,{xAxisId:n,yAxisId:r,hide:a,legendType:i,minPointSize:o,activeBar:l,animationBegin:s,animationDuration:c,animationEasing:u,isAnimationActive:d}=e,{needClip:f}=Gq(n,r),h=kv(CT),p=Cf(),m=zm(e.children,zc),g=kv(t=>JJ(t,e.id,p,m));if("vertical"!==h&&"horizontal"!==h)return null;var v=null==g?void 0:g[0];return t=null==v||null==v.height||null==v.width?0:"vertical"===h?v.height/2:v.width/2,J_.createElement(JF,{xAxisId:n,yAxisId:r,data:g,dataPointFormatter:Qm,errorBarOffset:t},J_.createElement(Qg,Qr({},e,{layout:h,needClip:f,data:g,xAxisId:n,yAxisId:r,hide:a,legendType:i,minPointSize:o,activeBar:l,animationBegin:s,animationDuration:c,animationEasing:u,isAnimationActive:d})))}J_.memo(function(e){var t,n,r=I4(e,Qv),a=(t=r.stackId,null!=(n=(0,ew.useContext)(J6))?n.stackId:null!=t?jQ(t):void 0),i=Cf();return J_.createElement(RR,{id:r.id,type:"bar"},e=>J_.createElement(J_.Fragment,null,J_.createElement(RI,{legendPayload:(e=>{var{dataKey:t,name:n,fill:r,legendType:a,hide:i}=e;return[{inactive:i,dataKey:t,type:a,color:r,value:j6(n,t),payload:e}]})(r)}),J_.createElement(Ql,{dataKey:r.dataKey,stroke:r.stroke,strokeWidth:r.strokeWidth,fill:r.fill,name:r.name,hide:r.hide,unit:r.unit,tooltipType:r.tooltipType,id:e}),J_.createElement(RU,{type:"bar",id:e,data:void 0,xAxisId:r.xAxisId,yAxisId:r.yAxisId,zAxisId:0,dataKey:r.dataKey,stackId:a,hide:r.hide,barSize:r.barSize,minPointSize:r.minPointSize,maxBarSize:r.maxBarSize,isPanorama:i,hasCustomShape:null!=r.shape}),J_.createElement(R3,{zIndex:r.zIndex},J_.createElement(Qx,Qr({},r,{id:e})))))},$T).displayName="Bar";let Qy=(0,ek.default)("bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);function Qb({className:e,orientation:t="horizontal",...n}){return(0,ey.jsx)("div",{role:"separator","aria-orientation":t,"data-slot":"separator","data-orientation":t,className:(0,eI.cn)("shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:self-stretch",e),...n})}function Qw({label:e,description:t,value:n}){return(0,ey.jsxs)("div",{className:"relative h-full min-h-0",children:[(0,ey.jsxs)("div",{children:[(0,ey.jsx)("div",{className:"text-xl font-semibold tracking-normal",children:e}),(0,ey.jsx)("div",{className:"mt-1 text-sm leading-5 text-muted-foreground",children:t})]}),(0,ey.jsx)(Jw,{value:Jj(n),minSize:48,maxSize:220,className:"absolute right-0 bottom-0 h-2/3 w-full"})]})}(0,ek.default)("calendar-clock",[["path",{d:"M16 14v2.2l1.6 1",key:"fo4ql5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);var Qj=ew,Qk=(e,t,n,r)=>AE(e,"xAxis",t,r),QS=(e,t,n,r)=>AM(e,"xAxis",t,r),QC=(e,t,n,r)=>AE(e,"yAxis",n,r),QN=(e,t,n,r)=>AM(e,"yAxis",n,r),QM=jc([CT,Qk,QC,QS,QN],(e,t,n,r,a)=>jX(e,"xAxis")?j4(t,r,!1):j4(n,a,!1));function QE(e){return"line"===e.type}var QO=jc([Pe,(e,t,n,r,a)=>a],(e,t)=>e.filter(QE).find(e=>e.id===t)),QP=jc([CT,Qk,QC,QS,QN,QO,QM,jh],(e,t,n,r,a,i,o,l)=>{var s,{chartData:c,dataStartIndex:u,dataEndIndex:d}=l;if(null!=i&&null!=t&&null!=n&&null!=r&&null!=a&&0!==r.length&&0!==a.length&&null!=o&&("horizontal"===e||"vertical"===e)){var{dataKey:f,data:h}=i;if(null!=(s=null!=h&&h.length>0?h:null==c?void 0:c.slice(u,d+1)))return function(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:a,yAxisTicks:i,dataKey:o,bandSize:l,displayedData:s}=e;return s.map((e,s)=>{var c=jG(e,o);if("horizontal"===t){var u=j0({axis:n,ticks:a,bandSize:l,entry:e,index:s}),d=null==c?null:r.scale.map(c);return{x:u,y:null!=d?d:null,value:c,payload:e}}var f=null==c?null:n.scale.map(c),h=j0({axis:r,ticks:i,bandSize:l,entry:e,index:s});return null==f||null==h?null:{x:f,y:h,value:c,payload:e}}).filter(Boolean)}({layout:e,xAxis:t,yAxis:n,xAxisTicks:r,yAxisTicks:a,dataKey:f,bandSize:o,displayedData:s})}}),QA=["id"],QI=["type","layout","connectNulls","needClip","shape"],Qz=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function Q_(){return(Q_=Object.assign.bind()).apply(null,arguments)}function QD(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function QR(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?QD(Object(n),!0).forEach(function(t){var r,a,i;r=e,a=t,i=n[t],(a=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(a))in r?Object.defineProperty(r,a,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[a]=i}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QD(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function QT(e,t){if(null==e)return{};var n,r,a=function(e,t){if(null==e)return{};var n={};for(var r in e)if(({}).hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var QL=Qj.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:a,fill:i,name:o,hide:l,unit:s,tooltipType:c,id:u}=e,d={dataDefinedOnItem:n,getPosition:jV,settings:{stroke:r,strokeWidth:a,fill:i,dataKey:t,nameKey:void 0,name:j6(o,t),hide:l,type:c,color:r,unit:s,graphicalItemId:u}};return Qj.createElement(Dw,{tooltipEntrySettings:d})}),Q$=(e,t)=>"".concat(t,"px ").concat(e,"px");function QF(e){var{clipPathId:t,points:n,props:r}=e,{dot:a,dataKey:i,needClip:o}=r,{id:l}=r,s=A5(QT(r,QA));return Qj.createElement(GB,{points:n,dot:a,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:i,baseProps:s,needClip:o,clipPathId:t})}function QB(e){var{showLabels:t,children:n,points:r}=e,a=(0,Qj.useMemo)(()=>null==r?void 0:r.map(e=>{var t,n,r={x:null!=(t=e.x)?t:0,y:null!=(n=e.y)?n:0,width:0,lowerWidth:0,upperWidth:0,height:0};return QR(QR({},r),{},{value:e.value,payload:e.payload,viewBox:r,parentViewBox:void 0,fill:void 0})}),[r]);return Qj.createElement(Ty,{value:t?a:void 0},n)}function QV(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:a,props:i}=e,{type:o,layout:l,connectNulls:s,needClip:c,shape:u}=i,d=QR(QR({},A3(QT(i,QI))),{},{fill:"none",className:"recharts-line-curve",clipPath:c?"url(#clipPath-".concat(t,")"):void 0,points:r,type:o,layout:l,connectNulls:s,strokeDasharray:null!=a?a:i.strokeDasharray});return Qj.createElement(Qj.Fragment,null,(null==r?void 0:r.length)>1&&Qj.createElement(_N,Q_({shapeType:"curve",option:u},d,{pathRef:n})),Qj.createElement(QF,{points:r,clipPathId:t,props:i}))}function QH(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:a,longestAnimatedLengthRef:i}=e,{points:o,strokeDasharray:l,isAnimationActive:s,animationBegin:c,animationDuration:u,animationEasing:d,animateNewValues:f,width:h,height:p,onAnimationEnd:m,onAnimationStart:g}=n,v=a.current,x=zF(o,"recharts-line-"),y=(0,Qj.useRef)(x),[b,w]=(0,Qj.useState)(!1),j=(0,Qj.useCallback)(()=>{"function"==typeof m&&m(),w(!1)},[m]),k=(0,Qj.useCallback)(()=>{"function"==typeof g&&g(),w(!0)},[g]),S=function(e){try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch(e){return 0}}(r.current),C=(0,Qj.useRef)(0);y.current!==x&&(C.current=i.current,y.current=x);var N=C.current;return Qj.createElement(QB,{points:o,showLabels:!b},n.children,Qj.createElement(z$,{animationId:x,begin:c,duration:u,isActive:s,easing:d,onAnimationEnd:j,onAnimationStart:k,key:x},e=>{var c,u=Math.min(jL(N,S+N,e),S);if(c=s?l?((e,t,n)=>{var r=n.reduce((e,t)=>e+t,0);if(!r)return Q$(t,e);for(var a=Math.floor(e/r),i=e%r,o=[],l=0,s=0;l<n.length;s+=null!=(c=n[l])?c:0,++l){var c,u=n[l];if(null!=u&&s+u>i){o=[...n.slice(0,l),i-s];break}}var d=o.length%2==0?[0,t]:[t];return[...function(e,t){for(var n=e.length%2!=0?[...e,0]:e,r=[],a=0;a<t;++a)r.push(...n);return r}(n,a),...o,...d].map(e=>"".concat(e,"px")).join(", ")})(u,S,"".concat(l).split(/[,\s]+/gim).map(e=>parseFloat(e))):Q$(S,u):null==l?void 0:String(l),e>0&&S>0&&(a.current=o,i.current=Math.max(i.current,u)),v){var d=v.length/o.length,m=1===e?o:o.map((t,n)=>{var r=Math.floor(n*d);if(v[r]){var a=v[r];return QR(QR({},t),{},{x:jL(a.x,t.x,e),y:jL(a.y,t.y,e)})}return f?QR(QR({},t),{},{x:jL(2*h,t.x,e),y:jL(p/2,t.y,e)}):QR(QR({},t),{},{x:t.x,y:t.y})});return a.current=m,Qj.createElement(QV,{props:n,points:m,clipPathId:t,pathRef:r,strokeDasharray:c})}return Qj.createElement(QV,{props:n,points:o,clipPathId:t,pathRef:r,strokeDasharray:c})}),Qj.createElement(Tk,{label:n.label}))}function QW(e){var{clipPathId:t,props:n}=e,r=(0,Qj.useRef)(null),a=(0,Qj.useRef)(0),i=(0,Qj.useRef)(null);return Qj.createElement(QH,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:a,pathRef:i})}var QU=(e,t)=>{var n,r;return{x:null!=(n=e.x)?n:void 0,y:null!=(r=e.y)?r:void 0,value:e.value,errorVal:jG(e.payload,t)}};class Qq extends Qj.Component{render(){var{hide:e,dot:t,points:n,className:r,xAxisId:a,yAxisId:i,top:o,left:l,width:s,height:c,id:u,needClip:d,zIndex:f}=this.props;if(e)return null;var h=(0,w1.clsx)("recharts-line",r),{r:p,strokeWidth:m}=G3(t),g=zg(t),v=2*p+m,x=d?"url(#clipPath-".concat(g?"":"dots-").concat(u,")"):void 0;return Qj.createElement(R3,{zIndex:f},Qj.createElement(A7,{className:h},d&&Qj.createElement("defs",null,Qj.createElement(GK,{clipPathId:u,xAxisId:a,yAxisId:i}),!g&&Qj.createElement("clipPath",{id:"clipPath-dots-".concat(u)},Qj.createElement("rect",{x:l-v/2,y:o-v/2,width:s+v,height:c+v}))),Qj.createElement(JF,{xAxisId:a,yAxisId:i,data:n,dataPointFormatter:QU,errorBarOffset:0},Qj.createElement(QW,{props:this.props,clipPathId:u}))),Qj.createElement(GU,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:x}))}}var QK={activeDot:!0,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",connectNulls:!1,dot:!0,fill:"#fff",hide:!1,isAnimationActive:"auto",label:!1,legendType:"line",stroke:"#3182bd",strokeWidth:1,xAxisId:0,yAxisId:0,zIndex:Nn.line,type:"linear"};function QG(e){var t=I4(e,QK),{activeDot:n,animateNewValues:r,animationBegin:a,animationDuration:i,animationEasing:o,connectNulls:l,dot:s,hide:c,isAnimationActive:u,label:d,legendType:f,xAxisId:h,yAxisId:p,id:m}=t,g=QT(t,Qz),{needClip:v}=Gq(h,p),x=kv(Fc),y=kv(CT),b=Cf(),w=kv(e=>QP(e,h,p,b,m));if("horizontal"!==y&&"vertical"!==y||null==w||null==x)return null;var{height:j,width:k,x:S,y:C}=x;return Qj.createElement(Qq,Q_({},g,{id:m,connectNulls:l,dot:s,activeDot:n,animateNewValues:r,animationBegin:a,animationDuration:i,animationEasing:o,isAnimationActive:u,hide:c,label:d,legendType:f,xAxisId:h,yAxisId:p,points:w,layout:y,height:j,width:k,left:S,top:C,needClip:v}))}var QX=Qj.memo(function(e){var t=I4(e,QK),n=Cf();return Qj.createElement(RR,{id:t.id,type:"line"},e=>Qj.createElement(Qj.Fragment,null,Qj.createElement(RI,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,legendType:a,hide:i}=e;return[{inactive:i,dataKey:t,type:a,color:r,value:j6(n,t),payload:e}]})(t)}),Qj.createElement(QL,{dataKey:t.dataKey,data:t.data,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:e}),Qj.createElement(RU,{type:"line",id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),Qj.createElement(QG,Q_({},t,{id:e}))))},$T);QX.displayName="Line";var QY=["axis"],QZ=(0,ew.forwardRef)((e,t)=>ew.createElement(Xy,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:QY,tooltipPayloadSearcher:TH,categoricalChartProps:e,ref:t}));function QJ({title:e,count:t}){return(0,ey.jsxs)("div",{className:"flex h-7 shrink-0 items-center justify-between",children:[(0,ey.jsx)("h2",{className:"text-sm font-semibold tracking-normal",children:e}),(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:t})]})}function QQ({items:e}){return(0,ey.jsx)("div",{className:"mt-2 grid",children:e.map((e,t)=>(0,ey.jsxs)("div",{className:(0,eI.cn)("px-2 py-2",t>0&&"border-t"),children:[(0,ey.jsx)("div",{className:"truncate text-sm font-medium",children:e.title}),(0,ey.jsx)("div",{className:(0,eI.cn)("mt-1 truncate ui-text-kbd text-muted-foreground","warning"===e.tone&&"text-destructive"),children:e.meta})]},e.id))})}function Q0({items:e}){let t=ew.useMemo(()=>e.map(([e,t,n,r])=>({id:`${e}-${n}`,status:"完成"===r?"done":"运行中"===r?"current":"失败"===r?"blocked":"queued",title:(0,ey.jsxs)("div",{className:"grid w-full grid-cols-[3.25rem_8rem_minmax(0,1fr)_4rem] items-center gap-3",children:[(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:e}),(0,ey.jsx)("span",{className:"truncate ui-text-kbd text-muted-foreground",children:t}),(0,ey.jsx)("span",{className:"truncate",children:n}),(0,ey.jsx)("span",{className:"text-right ui-text-kbd text-muted-foreground",children:r})]})})),[e]);return(0,ey.jsx)(ZQ,{items:t,scrollCurrentIntoView:!1,extendLineToViewport:!0,className:"mt-2 min-h-0 flex-1",viewportClassName:"h-full max-h-none overflow-y-auto pr-0",itemClassName:"py-1.5"})}function Q1({items:e}){let t=ew.useMemo(()=>e.map(e=>{var t;return{id:e.id,status:"running"===(t=e.state)?"current":"blocked"===t||"failed"===t?"blocked":"queued",title:(0,ey.jsx)(Q2,{item:e})}}),[e]);return(0,ey.jsx)(ZQ,{items:t,scrollCurrentIntoView:!1,extendLineToViewport:!0,className:"mt-2 min-h-0 flex-1",viewportClassName:"h-full max-h-none overflow-y-auto pr-0",itemClassName:"py-2"})}function Q2({item:e}){return(0,ey.jsxs)("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_7.5rem_5rem] items-center gap-3",children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("div",{className:"truncate text-sm font-medium",children:e.title}),(0,ey.jsxs)("div",{className:"mt-1 truncate ui-text-kbd text-muted-foreground",children:[e.machine," · ",e.agent," · ",e.started]})]}),(0,ey.jsxs)("div",{className:"grid gap-1",children:[(0,ey.jsx)(JC,{value:e.progress,className:"h-1.5"}),(0,ey.jsx)("div",{className:"ui-text-kbd text-muted-foreground",children:e.runtime})]}),(0,ey.jsxs)("div",{className:"grid gap-1",children:[(0,ey.jsx)(JC,{value:e.load,className:"h-1.5"}),(0,ey.jsx)("div",{className:"text-right ui-text-kbd text-muted-foreground",children:"load"})]})]})}function Q5({workers:e}){return(0,ey.jsx)("div",{className:"mt-2 grid min-h-0 flex-1 content-start overflow-hidden",children:e.map((e,t)=>(0,ey.jsx)(Q4,{worker:e,divided:t>0},e.id))})}function Q4({worker:e,divided:t}){return(0,ey.jsxs)("div",{className:(0,eI.cn)("grid min-h-24 grid-cols-[minmax(0,1fr)_2.5rem_auto] items-center gap-4 px-2 py-2",t&&"border-t"),children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("div",{className:"truncate text-lg font-semibold tracking-normal",children:e.machine}),(0,ey.jsx)("div",{className:"mt-0.5 truncate ui-text-kbd text-muted-foreground",children:e.role})]}),(0,ey.jsxs)("div",{className:"text-right text-sm font-medium tabular-nums",children:[e.active,"/",e.capacity]}),(0,ey.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,ey.jsx)(Q3,{label:"CPU",value:e.cpu}),(0,ey.jsx)(Q3,{label:"MEM",value:e.memory})]})]})}function Q3({label:e,value:t}){return(0,ey.jsxs)("div",{className:"grid justify-items-center gap-1",children:[(0,ey.jsx)(JN,{value:t,label:e,className:"size-16 [&_[data-slot=progress-ring-center]]:size-10 [&_[data-slot=progress-ring-center]]:bg-background [&_[data-slot=progress-ring-center]_span]:text-xs"}),(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:e})]})}function Q6({events:e}){let t=ew.useMemo(()=>e.map(([e,t],n)=>({id:`${e}-${t}`,status:0===n?"current":"done",title:(0,ey.jsxs)("div",{className:"grid w-full grid-cols-[3.25rem_minmax(0,1fr)] items-center gap-2",children:[(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:e}),(0,ey.jsx)("span",{className:"truncate",children:t})]})})),[e]);return(0,ey.jsx)(ZQ,{items:t,scrollCurrentIntoView:!1,extendLineToViewport:!0,className:"mt-2 min-h-0 flex-1",viewportClassName:"h-full max-h-none overflow-y-auto pr-0",itemClassName:"py-1.5"})}function Q8({machines:e}){return(0,ey.jsx)("div",{className:"mt-2 grid min-h-0 flex-1 content-start overflow-hidden",children:e.map((e,t)=>(0,ey.jsx)(Q7,{machine:e,divided:t>0},e.id))})}function Q7({machine:e,divided:t}){return(0,ey.jsxs)("div",{className:(0,eI.cn)("grid min-h-20 grid-cols-[minmax(0,1fr)_minmax(0,1.45fr)] items-center gap-4 px-2 py-2",t&&"border-t"),children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ey.jsx)(eee,{status:e.status}),(0,ey.jsx)("span",{className:"truncate text-sm font-medium",children:e.name})]}),(0,ey.jsxs)("div",{className:"mt-1 truncate ui-text-kbd text-muted-foreground",children:[e.os," · ",e.link," · heartbeat ",e.heartbeat]})]}),(0,ey.jsxs)("div",{className:"grid gap-2 sm:grid-cols-4",children:[(0,ey.jsx)(Q9,{icon:(0,ey.jsx)(dr,{}),label:"CPU",value:e.cpu}),(0,ey.jsx)(Q9,{icon:(0,ey.jsx)(JA,{}),label:"MEM",value:e.memory}),(0,ey.jsx)(Q9,{icon:(0,ey.jsx)(da,{}),label:"DISK",value:e.disk}),(0,ey.jsx)(Q9,{icon:(0,ey.jsx)(JI,{}),label:"NET",value:e.network})]})]})}function Q9({icon:e,label:t,value:n}){return(0,ey.jsxs)("div",{className:"grid gap-1",children:[(0,ey.jsxs)("div",{className:"flex justify-between gap-1 ui-text-kbd text-muted-foreground",children:[(0,ey.jsxs)("span",{className:"flex items-center gap-1 [&_svg]:size-3",children:[e,t]}),(0,ey.jsxs)("span",{children:[n,"%"]})]}),(0,ey.jsx)(JC,{value:n,className:"h-1.5"})]})}function eee({status:e}){return(0,ey.jsx)("span",{className:(0,eI.cn)("size-2 rounded-full bg-border","online"===e&&"bg-primary")})}function eet({links:e}){let t=ew.useMemo(()=>e.map(([e,t,n,r,a])=>({id:`${e}-${t}`,status:"Relay fallback"===n?"blocked":"current",title:(0,ey.jsxs)("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_5rem_4rem_3.5rem] items-center gap-3",children:[(0,ey.jsxs)("span",{className:"truncate",children:[e," / ",t]}),(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:n}),(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:r}),(0,ey.jsx)("span",{className:"text-right ui-text-kbd text-muted-foreground",children:a})]})})),[e]);return(0,ey.jsx)(ZQ,{items:t,scrollCurrentIntoView:!1,extendLineToViewport:!0,className:"mt-2 min-h-0 flex-1",viewportClassName:"h-full max-h-none overflow-y-auto pr-0",itemClassName:"py-2"})}function een({config:e,data:t}){return(0,ey.jsx)(Bg,{config:e,className:"mt-2 min-h-0 flex-1",children:(0,ey.jsxs)(Xw,{data:t,margin:{left:8,right:8},children:[(0,ey.jsx)(X2,{vertical:!1}),(0,ey.jsx)(Ys,{dataKey:"time",tickLine:!1,axisLine:!1,tickMargin:8}),(0,ey.jsx)(Bx,{content:(0,ey.jsx)(By,{indicator:"line"})}),(0,ey.jsx)(Xm,{dataKey:"cpu",type:"monotone",fill:"var(--color-cpu)",fillOpacity:.11,stroke:"var(--color-cpu)",strokeWidth:2}),(0,ey.jsx)(Xm,{dataKey:"memory",type:"monotone",fill:"var(--color-memory)",fillOpacity:.1,stroke:"var(--color-memory)",strokeWidth:2}),(0,ey.jsx)(Xm,{dataKey:"network",type:"monotone",fill:"var(--color-network)",fillOpacity:.08,stroke:"var(--color-network)",strokeWidth:2})]})})}function eer({services:e}){let[t,n]=Go(),r=Math.max(1,Math.floor((Math.max(0,n.width-192-64-32)+5)/12)),a=Math.max(48,n.height>0?Math.floor((n.height-0*Math.max(0,e.length-1))/e.length):48),i=Math.max(28,a-22);return(0,ey.jsx)("div",{ref:t,className:"mt-2 min-h-0 flex-1",children:e.map((e,t)=>(0,ey.jsx)(eea,{service:e,divided:t>0,rowHeight:a,sampleCount:r,sampleHeight:i},e.id))})}function eea({service:e,divided:t,rowHeight:n,sampleCount:r,sampleHeight:a}){let i=ew.useMemo(()=>{var t,n;return t=e.samples,n=r,t.length>=n?t.slice(t.length-n):Array.from({length:n},(e,n)=>{let r=n%t.length;return t[r]??0})},[r,e.samples]);return(0,ey.jsxs)("div",{className:(0,eI.cn)("grid grid-cols-[12rem_minmax(0,1fr)_4rem] items-center gap-4 px-2",t&&"border-t"),style:{height:n},children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("div",{className:"truncate text-sm font-medium",children:e.name}),(0,ey.jsx)("div",{className:(0,eI.cn)("mt-0.5 truncate ui-text-kbd text-muted-foreground","告警"===e.state&&"text-destructive"),children:e.state})]}),(0,ey.jsx)("div",{"aria-label":`${e.name} 30 minute stability samples`,className:"flex min-w-0 items-center overflow-hidden",style:{gap:5},children:i.map((t,n)=>{var r;return(0,ey.jsx)("span",{className:(0,eI.cn)("shrink-0 rounded-[2px]",(r=t)<60?"bg-destructive":r<72?"bg-destructive/55":r<84?"bg-primary/35":r<92?"bg-primary/60":"bg-primary"),style:{width:7,height:a},title:`${t}%`},`${e.id}-${n}`)})}),(0,ey.jsxs)("div",{className:"text-right text-sm font-medium tabular-nums",children:[e.samples.at(-1),"%"]})]})}let eei=[{id:"canvas-vantaloom-base",title:"Vantaloom 基座设计",status:"live",purpose:"承载多标签系统、文件树、终端和 Agent 会话节点。",nodes:18,agents:3,progress:64,health:91,runtime:"3h 12m",tokenUsage:62e4,lastOpened:"刚刚",snapshots:14,unsavedChanges:3,roadmap:[{title:"接入节点模板选择",state:"done"},{title:"处理节点吸附与连线遮挡",state:"done"},{title:"合并多标签页拖拽",state:"running"},{title:"沉淀真实项目模板",state:"queued"}],settings:{nodeTemplates:["多标签页系统","文件管理树","终端标签组","Agent 对话"],defaultLayout:["默认缩放 0.72","节点内容 2x","定位点 24px"],folders:["D:/Projects/Vantaloom-ui","D:/Projects/Vantaloom-ui/apps"],sharing:["工作组管理员可编辑","成员可审阅","访客不可访问"],autosave:["每 45 秒保存","节点拖拽结束保存","切换工作区保存"],snapshots:["保留最近 30 个","发布前创建检查点"],hosts:["Studio-PC","Linux-runner-02"],plugins:["Browser","Git checkpoint"]}},{id:"canvas-agent-lab",title:"Agent 编排实验",status:"live",purpose:"验证多 Agent 对话、工具窗口和剪切板在画布中的协同。",nodes:11,agents:4,progress:41,health:78,runtime:"1h 36m",tokenUsage:308e3,lastOpened:"8 分钟前",snapshots:9,unsavedChanges:1,roadmap:[{title:"四分工作区布局",state:"done"},{title:"面板替换进剪切板",state:"done"},{title:"会话浏览页",state:"running"},{title:"会话节点化",state:"queued"}],settings:{nodeTemplates:["Agent 对话","数据表标签","浏览器标签"],defaultLayout:["默认双栏","右侧可调整","剪切板常驻"],folders:["D:/Projects/Vantaloom-ui/apps/vantaloom"],sharing:["仅本机管理员可编辑"],autosave:["每 60 秒保存"],snapshots:["保留最近 12 个"],hosts:["Studio-PC"],plugins:["Browser"]}},{id:"canvas-release-map",title:"发布路线图",status:"review",purpose:"梳理组件库、主应用和文档的发布前检查。",nodes:9,agents:1,progress:83,health:86,runtime:"42m",tokenUsage:144e3,lastOpened:"今天 15:02",snapshots:7,unsavedChanges:0,roadmap:[{title:"组件清单",state:"done"},{title:"风险列表",state:"done"},{title:"最终检查",state:"running"}],settings:{nodeTemplates:["Diff 标签","数据表标签","文件预览标签"],defaultLayout:["审阅模式默认开启"],folders:["D:/Projects/Vantaloom-ui/docs"],sharing:["工作组可审阅"],autosave:["手动保存"],snapshots:["里程碑保留"],hosts:["Studio-PC"],plugins:[]}},{id:"canvas-browser-matrix",title:"浏览器预览矩阵",status:"idle",purpose:"检查不同 UA、比例和内嵌预览模式的表现。",nodes:6,agents:0,progress:100,health:94,runtime:"28m",tokenUsage:78e3,lastOpened:"昨天 18:44",snapshots:5,unsavedChanges:0,roadmap:[{title:"自适应模式",state:"done"},{title:"长宽比菜单",state:"done"},{title:"导航按钮",state:"done"}],settings:{nodeTemplates:["浏览器标签","多标签页系统"],defaultLayout:["自适应预览"],folders:["D:/Projects/Vantaloom-ui/packages/ui"],sharing:["仅自己"],autosave:["关闭"],snapshots:["保留最近 5 个"],hosts:["Studio-PC"],plugins:["Browser"]}},{id:"canvas-ops-topology",title:"工作组拓扑",status:"idle",purpose:"记录机器、服务和工作组连接关系。",nodes:15,agents:0,progress:100,health:89,runtime:"1h 04m",tokenUsage:92e3,lastOpened:"周四 11:30",snapshots:11,unsavedChanges:0,roadmap:[{title:"机器节点整理",state:"done"},{title:"连接策略标注",state:"done"},{title:"访问权限检查",state:"done"}],settings:{nodeTemplates:["数据表标签","浏览器标签","终端标签组"],defaultLayout:["视口吸附开启","节点吸附开启"],folders:["D:/Projects/Vantaloom-ui/ops"],sharing:["管理员可编辑","成员可查看"],autosave:["每 2 分钟保存"],snapshots:["每日保留"],hosts:["Studio-PC","Linux-runner-02","MacBook-build"],plugins:[]}}];function eeo(e,t,n,r,a,i,o){return{id:e,title:t,status:"idle",purpose:n,nodes:r,agents:0,progress:100,health:90,runtime:a,tokenUsage:i,lastOpened:o,snapshots:Math.max(3,Math.round(r/2)),unsavedChanges:0,roadmap:[{title:"整理节点结构",state:"done"},{title:"检查连接关系",state:"done"},{title:"保存最终快照",state:"done"}],settings:{nodeTemplates:["多标签页系统","文件预览标签"],defaultLayout:["默认缩放 0.72","节点吸附开启"],folders:["D:/Projects/Vantaloom-ui"],sharing:["仅自己"],autosave:["关闭"],snapshots:["保留最近 5 个"],hosts:["Studio-PC"],plugins:[]}}}eei.push(eeo("canvas-terminal-layout","终端工作台草图","记录终端标签组、日志表和命令区的组合方式。",7,"36m",84e3,"昨天 15:21"),eeo("canvas-file-review","文件审阅流程","沉淀文件树、diff 预览和文件标签之间的拖拽关系。",12,"58m",126e3,"周五 20:10"),eeo("canvas-settings-ia","设置导航结构","整理设置菜单面板的主菜单、子菜单和搜索入口。",8,"24m",61e3,"周五 16:42"),eeo("canvas-auth-access","本机账户接入","记录本机用户、工作组加入和可用机器列表关系。",10,"47m",112e3,"周四 22:05"),eeo("canvas-data-ops","运维数据面板","对齐数据表标签、机器状态卡片和运行记录列表。",14,"1h 18m",172e3,"周三 19:48"));let eel=eei.filter(e=>"idle"!==e.status),ees=eei.filter(e=>"idle"===e.status);function eec(e,t,n=""){return{title:e,dataSource:t,refreshRate:"30s",note:n}}function eeu(e,t){return(0,ey.jsx)("section",{className:(0,eI.cn)("size-full rounded-xl border bg-card p-5","vtl-jelly-image-card vtl-jelly-image-card-shadowless"),style:Z4({image:t,opacity:.88,blur:"0px"}),children:e})}let eed=[{id:"metric-active",kind:"metric-active",x:0,y:0,w:3,h:3},{id:"metric-nodes",kind:"metric-nodes",x:3,y:0,w:3,h:3},{id:"metric-unsaved",kind:"metric-unsaved",x:6,y:0,w:3,h:3},{id:"metric-snapshots",kind:"metric-snapshots",x:9,y:0,w:3,h:3},{id:"active",kind:"active",x:0,y:3,w:12,h:3},{id:"recent",kind:"recent",x:0,y:6,w:12,h:Math.max(3,Math.ceil(.75*ees.length)+1)}];function eef({open:e,title:t,description:n,eyebrow:r,panels:a,defaultPanelId:i="overview",onOpenChange:o}){let l=su(),[s,c]=ew.useState(i),u=a.find(e=>e.id===s)??a[0];return ew.useEffect(()=>{e&&c(i)},[i,e]),(0,ey.jsx)(uo,{open:e,onOpenChange:o,children:(0,ey.jsxs)(d8,{hideClose:!0,className:(0,eI.cn)("gap-0 overflow-hidden p-0",l?"inset-0 h-svh w-full max-w-none translate-x-0 translate-y-0 rounded-none border-0":"h-[min(44rem,calc(100svh-2rem))] max-w-5xl"),children:[(0,ey.jsx)(d9,{className:"sr-only",children:t}),(0,ey.jsxs)(fe,{className:"sr-only",children:[r?(0,ey.jsxs)(ey.Fragment,{children:[r,". "]}):null,n??t]}),l?(0,ey.jsxs)("div",{className:"flex h-full flex-col",children:[(0,ey.jsxs)("header",{className:"flex shrink-0 items-center gap-3 border-b px-4 py-3",children:[(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"关闭",onClick:()=>o(!1),children:(0,ey.jsx)(d3.XIcon,{className:"size-4"})}),(0,ey.jsxs)("div",{className:"min-w-0 flex-1",children:[r?(0,ey.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:r}):null,(0,ey.jsx)("div",{className:"truncate text-sm font-semibold",children:t})]})]}),(0,ey.jsx)("nav",{className:"shrink-0 overflow-x-auto border-b [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:(0,ey.jsx)("div",{className:"flex gap-1.5 px-4 py-2",children:a.map(e=>(0,ey.jsxs)("button",{type:"button",className:(0,eI.cn)("inline-flex shrink-0 items-center gap-1.5 rounded-full px-3 py-1.5 text-xs font-medium transition-colors",u?.id===e.id?"bg-foreground text-background":"bg-muted text-muted-foreground"),onClick:()=>c(e.id),children:[e.icon?(0,ey.jsx)("span",{className:"[&_svg]:size-3.5",children:e.icon}):null,(0,ey.jsx)("span",{children:e.label}),e.badge?(0,ey.jsx)(FC,{variant:"outline",className:"h-4 px-1 ui-text-kbd",children:e.badge}):null]},e.id))})}),(0,ey.jsx)(bQ,{className:"min-h-0 flex-1",children:(0,ey.jsx)("div",{className:"p-4",children:u?.content})})]}):(0,ey.jsxs)("div",{className:"grid size-full min-h-0 grid-cols-[15rem_minmax(0,1fr)]",children:[(0,ey.jsx)("aside",{"data-slot":"resource-management-dialog-sidebar",className:"min-h-0 border-r bg-muted/20",children:(0,ey.jsx)(bQ,{className:"h-full",children:(0,ey.jsx)("div",{className:"space-y-1 p-2",children:a.map(e=>(0,ey.jsxs)(eA.Button,{"data-slot":"resource-management-dialog-nav-item",type:"button",variant:"ghost",className:(0,eI.cn)("h-9 w-full justify-start px-2.5 text-left font-medium",u?.id===e.id?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/70 hover:text-foreground"),onClick:()=>c(e.id),children:[e.icon?(0,ey.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center [&_svg]:size-4",children:e.icon}):null,(0,ey.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.label}),e.badge?(0,ey.jsx)(FC,{variant:"outline",className:"h-5 px-1.5 ui-text-kbd",children:e.badge}):null]},e.id))})})}),(0,ey.jsx)(bQ,{className:"min-h-0 bg-background",children:(0,ey.jsx)("div",{className:"p-5 pr-9",children:u?.content})})]})]})})}function eeh({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){let[r,a]=ew.useState(),i=ew.useMemo(()=>(function({onSelect:e}){return[{id:"metric-active",title:"活跃画布",description:"当前正在编辑的画布数量。",icon:(0,ey.jsx)(dc,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:eec("活跃画布","画布列表"),render:e=>eeu((0,ey.jsx)(Qw,{label:e.title,description:"当前正在编辑的画布数量",value:String(eel.length)}),Z0)},{id:"metric-nodes",title:"运行节点",description:"所有活跃画布内的节点。",icon:(0,ey.jsx)(BT,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:eec("运行节点","画布节点"),render:e=>eeu((0,ey.jsx)(Qw,{label:e.title,description:"所有活跃画布内的节点",value:"38"}),Z1)},{id:"metric-unsaved",title:"未保存",description:"等待写入的画布变更。",icon:(0,ey.jsx)(wZ,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:eec("未保存","画布保存状态"),render:e=>eeu((0,ey.jsx)(Qw,{label:e.title,description:"等待写入的画布变更",value:"4"}),Z2)},{id:"metric-snapshots",title:"快照",description:"可回退的历史存档。",icon:(0,ey.jsx)(Ku,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:eec("快照","画布快照"),render:e=>eeu((0,ey.jsx)(Qw,{label:e.title,description:"可回退的历史存档",value:"46"}),Z5)},{id:"active",title:"正在使用的画布",description:"活跃画布 Roadmap。",icon:(0,ey.jsx)(dc,{className:"size-4"}),defaultSize:{w:12,h:3},defaultConfig:eec("正在使用的画布","画布列表"),render:t=>(0,ey.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,ey.jsx)(QJ,{title:t.title,count:eel.length}),(0,ey.jsx)(JE,{canvases:eel,scrollable:!0,onSelect:e})]})},{id:"recent",title:"最近画布",description:"最近打开的画布。",icon:(0,ey.jsx)(pN,{className:"size-4"}),defaultSize:{w:12,h:Math.max(3,Math.ceil(.75*ees.length)+1)},defaultConfig:eec("最近画布","画布列表"),render:t=>(0,ey.jsxs)("section",{className:"flex size-full flex-col",children:[(0,ey.jsx)(QJ,{title:t.title,count:ees.length}),(0,ey.jsx)(JE,{canvases:ees,mode:"archive",onSelect:e})]})}]})({onSelect:a}),[]);return(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(Jy,{boardId:"canvas-library",definitions:i,initialLayouts:eed,clipboardItems:e,actionLabel:"画布库页面卡片操作",paletteGroupTitle:"画布库页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n}),(0,ey.jsx)(eem,{canvas:r,onOpenChange:e=>{e||a(void 0)}})]})}function eep({icon:e,value:t}){return(0,ey.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,ey.jsx)("span",{className:"[&_svg]:size-3.5",children:e}),(0,ey.jsx)("span",{className:"tabular-nums",children:t})]})}function eem({canvas:e,onOpenChange:t}){return e?(0,ey.jsx)(eef,{open:!!e,onOpenChange:t,title:e.title,eyebrow:"画布管理",description:e.purpose,panels:[{id:"overview",label:"首页",icon:(0,ey.jsx)(BL,{}),content:(0,ey.jsx)(eeg,{canvas:e})},{id:"templates",label:"节点模板",icon:(0,ey.jsx)(ZU,{}),badge:e.settings.nodeTemplates.length,content:(0,ey.jsx)(eex,{title:"可用节点模板",items:e.settings.nodeTemplates})},{id:"layout",label:"默认布局",icon:(0,ey.jsx)(ZY,{}),content:(0,ey.jsx)(eex,{title:"默认布局参数",items:e.settings.defaultLayout})},{id:"folders",label:"工作区绑定",icon:(0,ey.jsx)(pN,{}),content:(0,ey.jsx)(eex,{title:"绑定的工作区文件夹",items:e.settings.folders})},{id:"sharing",label:"共享权限",icon:(0,ey.jsx)(ZX,{}),content:(0,ey.jsx)(eex,{title:"共享与权限",items:e.settings.sharing})},{id:"autosave",label:"自动保存",icon:(0,ey.jsx)(Kh,{}),content:(0,ey.jsx)(eex,{title:"自动保存策略",items:e.settings.autosave})},{id:"snapshots",label:"快照和版本",icon:(0,ey.jsx)(Ku,{}),content:(0,ey.jsx)(eex,{title:"快照和版本策略",items:e.settings.snapshots})},{id:"hosts",label:"可访问主机",icon:(0,ey.jsx)(ZK,{}),content:(0,ey.jsx)(eex,{title:"可访问主机",items:e.settings.hosts})},{id:"plugins",label:"插件",icon:(0,ey.jsx)(ZG,{}),content:(0,ey.jsx)(eex,{title:"画布插件",items:e.settings.plugins,empty:"未加载插件"})}]}):null}function eeg({canvas:e}){return(0,ey.jsxs)("div",{className:"grid gap-5",children:[(0,ey.jsxs)("button",{type:"button",className:"group relative grid min-h-72 rounded-[2rem] border bg-card p-7 text-left transition-colors hover:bg-muted/35",children:[(0,ey.jsxs)("div",{className:"grid gap-5",children:[(0,ey.jsxs)("div",{className:"max-w-2xl",children:[(0,ey.jsx)("h3",{className:"text-3xl font-semibold tracking-normal",children:e.title}),(0,ey.jsx)("p",{className:"mt-4 text-sm leading-6 text-muted-foreground",children:e.purpose})]}),(0,ey.jsxs)("div",{className:"grid max-w-56 gap-2",children:[(0,ey.jsx)(eev,{label:"Nodes",value:`${e.nodes}`}),(0,ey.jsx)(eev,{label:"Agent",value:`${e.agents}`}),(0,ey.jsx)(eev,{label:"Snapshots",value:`${e.snapshots}`})]})]}),(0,ey.jsx)("span",{className:"absolute right-7 bottom-7 text-sm font-medium text-foreground transition-opacity group-hover:opacity-70",children:"进入"})]}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)("span",{className:"text-sm font-medium",children:"Roadmap"}),(0,ey.jsx)(eep,{icon:(0,ey.jsx)(BT,{}),value:e.runtime})]}),(0,ey.jsx)(ZQ,{items:e.roadmap.map(e=>({id:e.title,title:e.title,status:"running"===e.state?"current":"done"===e.state?"done":"queued"})),viewportClassName:"max-h-64"})]})]})}function eev({label:e,value:t}){return(0,ey.jsxs)("span",{className:"grid min-w-0 gap-0.5 py-0.5",children:[(0,ey.jsx)("span",{className:"truncate ui-text-kbd text-muted-foreground",children:e}),(0,ey.jsx)("span",{className:"min-w-0 truncate text-sm font-semibold tracking-normal",children:t})]})}function eex({title:e,items:t,empty:n="暂无内容"}){return(0,ey.jsxs)("div",{className:"grid gap-3",children:[(0,ey.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:e}),(0,ey.jsx)("div",{className:"overflow-hidden rounded-xl border bg-card",children:t.length>0?t.map((e,t)=>(0,ey.jsxs)("div",{className:(0,eI.cn)("flex min-h-10 items-center gap-2 px-3 text-sm",t>0&&"border-t"),children:[(0,ey.jsx)(Zq,{className:"size-4 text-muted-foreground"}),(0,ey.jsx)("span",{className:"min-w-0 truncate",children:e})]},e)):(0,ey.jsx)("div",{className:"px-3 py-6 text-sm text-muted-foreground",children:n})})]})}function eey({open:e,onOpenChange:t,onAdd:n}){return(0,ey.jsx)(vE,{open:e,onOpenChange:t,title:"添加节点",description:"搜索并选择要放入画布的可用节点。",className:"top-1/2 max-w-xl -translate-y-1/2",children:(0,ey.jsxs)(vM,{loop:!0,children:[(0,ey.jsx)(vO,{placeholder:"搜索节点..."}),(0,ey.jsxs)(vP,{children:[(0,ey.jsx)(vA,{children:"没有匹配节点。"}),(0,ey.jsx)(vI,{heading:"可用节点",children:dv.map(e=>(0,ey.jsxs)(vz,{value:`${e.title} ${e.description} ${e.keywords}`,onSelect:()=>n(e),children:[(0,ey.jsx)("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg border bg-background text-muted-foreground",children:e.icon}),(0,ey.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,ey.jsx)("span",{className:"block truncate text-sm font-medium",children:e.title}),(0,ey.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,ey.jsxs)(v_,{children:[e.size.width,"x",e.size.height]})]},e.id))})]})]})})}function eeb({nodes:e,edges:t,selectedNodeId:n,clipboardItems:r,onNodesChange:a,onEdgesChange:i,onNodesSet:o,onEdgesSet:l,onSelectedNodeChange:s,onClipboardItemsChange:c}){let u=ew.useRef(null),{addPaletteOpen:d,addTemplateNode:f,handleAddPaletteOpenChange:h,handleCanvasAction:p,handleCanvasDragOver:m,handleCanvasDrop:g,handleNodeCanvasConnect:v,handleNodeCanvasEdgeAction:x,handleNodeCanvasNodeAction:y,filePickerDialog:b,renderedCanvasNodes:w}=function({workspaceRef:e,nodes:t,clipboardItems:n,onNodesSet:r,onEdgesSet:a,onSelectedNodeChange:i,onClipboardItemsChange:o}){let l=ew.useRef(0),s=ew.useRef(0),[c,u]=ew.useState(!1),[d,f]=ew.useState(),[h,p]=ew.useState(),m=ew.useCallback((t,n)=>{let r,a,i,o,l,s,c,u;return r=e.current,a=r?.querySelector(".react-flow__viewport"),i=r?.getBoundingClientRect(),l="none"!==(o=a?getComputedStyle(a).transform:"none")?new DOMMatrixReadOnly(o):void 0,s=l?.a&&Number.isFinite(l.a)?l.a:1,c=l?.e??0,u=l?.f??0,{x:(t-(i?.left??0)-c)/s,y:(n-(i?.top??0)-u)/s}},[e]),g=ew.useCallback((e,t)=>{r(n=>n.map(n=>{let r,a;return n.id===e?(a="string"==typeof(r=n.data??{}).activeTabId&&t.some(e=>e.id===r.activeTabId)?r.activeTabId:t[0]?.id,{...n,data:{...r,tabs:t,activeTabId:a}}):n}))},[r]),v=ew.useCallback((e,t)=>{r(n=>n.map(n=>n.id===e?{...n,data:{...n.data??{},activeTabId:t}}:n))},[r]),x=ew.useCallback((e,t)=>{r(n=>n.map(n=>n.id===e?function(e,t){let n=e.data??{};if("multi-tab-system"===n.kind){let r=Array.isArray(n.tabs)?n.tabs:[];return{...e,data:{...n,tabs:r.map(e=>e.id===t.id?t:e),activeTabId:t.id}}}return db(n.kind)?{...e,data:{...n,tab:t}}:e}(n,t):n))},[r]),y=ew.useCallback((e,t)=>{r(n=>n.map(n=>n.id===e?{...n,data:{...n.data??{},terminal:t}}:n))},[r]),b=ew.useCallback((e,t)=>{var n;let a=(n=e.kind,dv.find(e=>e.id===n)?.size??df({width:480,height:320}));s.current+=1;let o=`${e.kind}-detached-${s.current}`;r(n=>[...n,function({tab:e,nodeId:t,center:n,size:r}){return{id:t,type:"blank",position:dm(n,r),data:{contentScale:2,kind:e.kind,tab:{...e,id:`${t}-tab`}},width:r.width,height:r.height,style:dh(r)}}({tab:e,nodeId:o,center:t,size:a})]),i(o)},[r,i]),w=ew.useCallback(async(e,n)=>{try{let a,i=n?.nodeId?t.find(e=>e.id===n.nodeId):void 0,o=i?(i.data??{}).kind:void 0,l="data-table-tab-viewer"===o?await dH(e):await dF(e),s=void 0!==i&&(a=i.data??{},"multi-tab-system"===a.kind||"file-tab-viewer"===a.kind||"data-table-tab-viewer"===a.kind);n?.nodeId&&s&&r(e=>e.map(e=>e.id===n.nodeId?function(e,t,n){let r=e.data??{};if("multi-tab-system"===r.kind){let a,i,o=Array.isArray(r.tabs)?r.tabs:[];return{...e,data:{...r,tabs:(a=o.filter(e=>e.id!==t.id),i=void 0===n?a.length:Math.min(Math.max(n,0),a.length),a.splice(i,0,t),a),activeTabId:t.id}}}return"file-tab-viewer"===r.kind||"data-table-tab-viewer"===r.kind&&"data-table-tab-viewer"===t.kind?{...e,data:{...r,tab:t}}:e}(e,l,n.insertIndex):e)),n?.nodeId&&s||b(l,d??{x:496,y:336})}catch{hx.error("文件预览打开失败")}},[b,t,r,d]),j=ew.useCallback(e=>{let n=t.find(e=>"multi-tab-system"===(e.data??{}).kind);w(e,n?{nodeId:n.id}:void 0)},[t,w]),k=ew.useCallback(async(e,t,n)=>{let r=t.file?.path,a=t.file?.machineId??"local";if(!r)throw hx.error("文件路径不可用"),Error("file path is unavailable");try{let i=await dE({machineId:a,path:r,content:n}),o={...t,title:i.name,modified:!1,defaultValue:"utf-8"===i.encoding?i.content:n,file:{...t.file,name:i.name,path:i.path,machineId:i.machine.id,mimeType:i.mimeType,kind:t.file?.kind,size:i.size,truncated:i.truncated}};x(e,o),hx.success("文件已保存")}catch(e){throw hx.error("文件保存失败"),e}},[x]),S=ew.useCallback((e,t,n)=>{b(t,m(n.clientX,n.clientY))},[b,m]),C=ew.useCallback(e=>{let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id"),r=n.find(e=>e.id===t),a=r?r.payloads?.[KR]:void 0;if(a)return a;let i=e.dataTransfer.getData(KR);if(i)try{return JSON.parse(i)}catch{return}},[n]),N=ew.useCallback((e,t,n)=>{r(r=>r.map(r=>r.id!==e?r:function(e,t,n){let r=e.data??{},a=Array.isArray(r.tabs)?r.tabs:[],i=new Set(a.map(e=>e.id)),o=n.tab.id,l=2;for(;i.has(o);)o=`${n.tab.id}-${l}`,l+=1;let s=[...a];return s.splice(Math.max(0,Math.min(t,s.length)),0,{...n.tab,id:o}),{...e,data:{...r,tabs:s,activeTabId:o}}}(r,t,n)))},[r]),M=ew.useCallback((e,t,n)=>{let r=C(n);r&&N(e,t,r)},[C,N]),E=ew.useCallback(e=>(function(e,t){for(let n of[...e].reverse()){if("multi-tab-system"!==(n.data??{}).kind)continue;let e=function(e){let t="number"==typeof e.width?e.width:"number"==typeof e.style?.width?e.style.width:"string"==typeof e.style?.width?Number.parseFloat(e.style.width):192,n="number"==typeof e.height?e.height:"number"==typeof e.style?.height?e.style.height:"string"==typeof e.style?.height?Number.parseFloat(e.style.height):112;return{width:Number.isFinite(t)?t:192,height:Number.isFinite(n)?n:112}}(n),r=t.x>=n.position.x&&t.x<=n.position.x+e.width,a=t.y>=n.position.y&&t.y<=n.position.y+e.height;if(r&&a)return n}})(t,e),[t]),O=ew.useCallback((t,n,r)=>(function(e,t,n,r){let a=Array.from(e.current?.querySelectorAll(".react-flow__node")??[]).find(e=>e.getAttribute("data-id")===t),i=a?.querySelector('[data-slot="multi-tab-list"]');if(!i)return r;let o=Array.from(i.querySelectorAll("[data-tab-id]"));for(let[e,t]of o.entries()){let r=t.getBoundingClientRect();if(n<r.left+r.width/2)return e}return o.length})(e,t,n,r),[e]),P=function({nodes:e,onTabsChange:t,onActiveTabChange:n,onRequestFileTab:r,onOpenWorkspaceFile:a,onTabChange:i,onSaveFileTab:o,onTerminalStateChange:l,onTabDetach:s,onExternalTabDrop:c}){return ew.useMemo(()=>e.map(e=>{let u=e.data??{},d=(e.data??{}).kind;return d?{...e,data:{...u,content:(0,ey.jsx)(Y9,{kind:d,nodeId:e.id,tab:u.tab,tabs:u.tabs,activeTabId:u.activeTabId,terminalScopeId:`canvas:node:${e.id}`,terminalState:u.terminal,onTerminalStateChange:t=>l(e.id,t),onRequestFileTab:r,onOpenWorkspaceFile:a,onTabsChange:t,onTabChange:i,onSaveFileTab:o,onActiveTabChange:n,onTabDetach:s,onExternalTabDrop:c})}}:e}),[e,n,c,a,r,o,i,s,l,t])}({nodes:t,onTabsChange:g,onActiveTabChange:v,onRequestFileTab:p,onOpenWorkspaceFile:j,onTabChange:x,onSaveFileTab:k,onTerminalStateChange:y,onTabDetach:S,onExternalTabDrop:M}),A=ew.useCallback(e=>{s.current+=1;let n=`${e.id}-${t.length+s.current}`;r(t=>[...t,function({template:e,nodeId:t,center:n}){let r={contentScale:2,kind:e.id};return"multi-tab-system"===e.id?r.tabs=[]:db(e.id)&&(r.tab=dj(e.id,`${t}-tab`)),{id:t,type:"blank",position:dm(n,e.size),data:r,width:e.size.width,height:e.size.height,style:dh(e.size)}}({template:e,nodeId:n,center:d??{x:496,y:336}})]),i(void 0),u(!1),f(void 0)},[t.length,r,i,d]),I=ew.useCallback(e=>{let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id");if(!t)return;let a=n.find(e=>e.id===t),o=m(e.clientX,e.clientY),s=C(e),c=s?E(o):void 0;if(s&&c){e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move";let t=c.data??{},n=Array.isArray(t.tabs)?t.tabs:[],r=O(c.id,e.clientX,n.length);N(c.id,r,s),i(void 0);return}let u=a?a.payloads?.[KD]:void 0;if(!a||!u)return;e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move",l.current+=1;let d=`${u.node.id}-drop-${l.current}`;r(e=>[...e,function({source:e,nodeId:t,center:n}){let r={width:e.width??192,height:e.height??112};return{...e,id:t,position:dm(n,r),style:e.style??dh(r),selected:!1,data:{...e.data??{},resizing:!1}}}({source:u.node,nodeId:d,center:o})]),i(d)},[n,E,C,m,O,N,r,i]),z=ew.useCallback(e=>{Array.from(e.dataTransfer.types).some(e=>[KD,KR].includes(e))&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},[]),_=ew.useCallback((e,{flowPosition:t})=>{"add"===e&&(f(t),u(!0))},[]),D=ew.useCallback(e=>{a(t=>{if(t.find(t=>t.source===e.source&&t.target===e.target))return t;let n=t.find(t=>t.source===e.target&&t.target===e.source);return n?t.map(e=>e.id===n.id?{...e,data:{...e.data??{},bidirectional:!0}}:e):[...t,{id:`edge-${e.source}-${e.target}-${t.length+1}`,type:"connection",source:e.source,target:e.target,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle,data:{anchors:[]}}]})},[a]),R=ew.useCallback((e,t,n)=>{"cut-edge"===e?a(e=>e.filter(e=>e.id!==t)):a(r=>r.map(r=>{if(r.id!==t)return r;let a=[...r.data?.anchors??[]];return"add-anchor"===e&&n.anchor&&a.splice(n.anchorIndex??a.length,0,n.anchor),"move-anchor"===e&&n.anchor&&void 0!==n.anchorIndex&&(a[n.anchorIndex]=n.anchor),"delete-anchor"===e&&void 0!==n.anchorIndex&&a.splice(n.anchorIndex,1),{...r,data:{...r.data??{},anchors:a}}}))},[a]),T=ew.useCallback((e,n,{snappedPosition:l})=>{if("copy"===e)return void r(e=>{let t=e.find(e=>e.id===n);if(!t)return e;let r=`${t.id}-copy-${e.length+1}`;return i(r),[...e,{...t,id:r,position:l,selected:!1,data:{...t.data??{},resizing:!1}}]});if("cut"===e){let e,l,s,c,u,d=t.find(e=>e.id===n);if(!d)return;let f=(s=(l=function(e){let t=e.data??{},n=t.tab;if(n?.id&&db(n.kind))return n;let r=t.kind;if(db(r))return dj(r,e.id)}(e=dk(d)))?{tab:l,sourceNodeId:d.id}:void 0,c={[KD]:{node:e}},u={"application/vnd.vantaloom.clip-kind":l?"canvas-tab":"canvas-node",[KD]:d.id},s&&(c[KR]=s,u[KR]=JSON.stringify(s)),{id:`clip-${d.id}`,title:l?.title??"画布节点",description:l?"来自画布的独立标签页。":"来自节点画布的空白节点。",meta:`${Math.round(d.width??192)}x${Math.round(d.height??112)}`,icon:l?dw(l.kind):(0,ey.jsx)(dt,{className:"size-4"}),dragData:u,payloads:c});o(e=>[f,...e.filter(e=>e.id!==f.id)]),r(e=>e.filter(e=>e.id!==n)),a(e=>e.filter(e=>e.source!==n&&e.target!==n)),i(void 0)}},[t,o,a,r,i]);return{addPaletteOpen:c,addTemplateNode:A,filePickerDialog:(0,ey.jsx)(Gi,{open:void 0!==h,onOpenChange:e=>{e||p(void 0)},onSelectFile:e=>{p(void 0),w(e,h)}}),handleAddPaletteOpenChange:function(e){u(e),e||f(void 0)},handleCanvasAction:_,handleCanvasDragOver:z,handleCanvasDrop:I,handleNodeCanvasConnect:D,handleNodeCanvasEdgeAction:R,handleNodeCanvasNodeAction:T,renderedCanvasNodes:P}}({workspaceRef:u,nodes:e,clipboardItems:r,onNodesChange:a,onEdgesChange:i,onNodesSet:o,onEdgesSet:l,onSelectedNodeChange:s,onClipboardItemsChange:c});return(0,ey.jsxs)("div",{ref:u,className:"vtl-app-background vtl-canvas-workspace relative h-full w-full overflow-hidden",onDragOver:m,onDrop:g,children:[(0,ey.jsx)(sc,{"aria-label":"新建画布",className:"h-full min-h-0 rounded-none border-0",viewportClassName:"h-full",nodes:w,edges:t,nodeTypes:du,edgeTypes:dd,onNodesChange:a,onEdgesChange:i,selectedNodeId:n,onSelectedNodeChange:s,defaultViewport:{x:0,y:0,zoom:.5},labels:{actions:"画布操作",add:"添加节点",select:"普通鼠标",connect:"连接工具",cut:"剪刀工具",drag:"拖拽工具",modeTools:"模式工具",resetZoom:"重置缩放",viewportTools:"视口工具",lockViewport:"锁定视口",visualSnap:"视觉吸附",nodeSnap:"节点吸附",snapTools:"吸附工具",nodeActions:"节点操作",resizeNode:"调整大小",copyNode:"复制节点",cutNode:"剪切节点"},onCanvasAction:p,onNodeCanvasConnect:v,onNodeCanvasEdgeAction:x,onNodeCanvasNodeAction:y}),(0,ey.jsx)(eey,{open:d,onOpenChange:h,onAdd:f}),b,(0,ey.jsx)(hS,{position:"top-right"})]})}g5.length;let eew={delete:"Delete",empty:"Drop here",title:"Trash"};function eej({active:e=!1,items:t=[],labels:n,className:r,onDrop:a,onDelete:i,onItemRestore:o,...l}){let s={...eew,...n},[c,u]=ew.useState(!1),d=ew.useRef(0),f=e||c||t.length>0;return ew.useEffect(()=>{e||(d.current=0,u(!1))},[e]),(0,ey.jsx)("div",{"data-slot":"trash-drop-zone","data-visible":f,"data-drag-inside":c,className:(0,eI.cn)("fixed top-4 left-1/2 z-50 -translate-x-1/2 transition-[opacity,transform] duration-300 ease-[cubic-bezier(.2,.8,.2,1)]",f?"pointer-events-auto translate-y-0 opacity-100":"pointer-events-none -translate-y-5 opacity-0",r),onDragEnter:function(e){e.preventDefault(),d.current+=1,u(!0)},onDragLeave:function(){d.current=Math.max(0,d.current-1),0===d.current&&u(!1)},onDragOver:function(e){e.preventDefault(),e.dataTransfer.dropEffect="move",u(!0)},onDrop:function(e){e.preventDefault(),e.stopPropagation(),d.current=0,u(!1);let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id")||e.dataTransfer.getData("text/plain"),n=e.dataTransfer.getData("text/plain")||t||"Dropped item",r=e.dataTransfer.getData("application/vnd.vantaloom.clip-kind");t&&a?.({id:t,title:n,meta:r,nativeEvent:e})},...l,children:(0,ey.jsx)("div",{className:(0,eI.cn)("min-w-12 overflow-hidden rounded-xl border-2 border-background bg-destructive text-destructive-foreground shadow-lg shadow-black/15 transition-[width,min-height,background-color,border-color,padding,box-shadow] duration-300","dark:border-destructive dark:bg-background dark:text-destructive",c||t.length>0?"w-64 border-dashed bg-destructive/12 p-2 text-destructive dark:bg-destructive/8":"flex size-12 items-center justify-center p-0"),children:c||t.length>0?(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsxs)("div",{className:"flex min-h-14 items-center justify-center gap-2 rounded-lg border border-dashed border-destructive/55 bg-destructive/8 px-3 text-sm font-medium text-destructive",children:[(0,ey.jsx)(xC,{className:"size-4"}),(0,ey.jsx)("span",{children:s.empty})]}),t.length>0?(0,ey.jsx)("div",{className:"grid max-h-36 gap-1 overflow-y-auto pr-1",children:t.map(e=>(0,ey.jsxs)("div",{className:"flex h-8 items-center gap-2 rounded-md border border-destructive/25 bg-background/80 px-2 text-foreground",children:[(0,ey.jsx)("button",{type:"button","aria-label":`Restore ${e.title}`,className:"flex size-5 shrink-0 items-center justify-center rounded-sm text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive",onClick:()=>o?.(e),children:(0,ey.jsx)(d3.XIcon,{className:"size-3.5"})}),(0,ey.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:e.title}),e.meta?(0,ey.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:e.meta}):null]},e.id))}):null,t.length>0?(0,ey.jsx)("button",{type:"button",className:"h-8 rounded-md bg-destructive px-3 text-xs font-medium text-destructive-foreground transition-colors hover:bg-destructive/90 dark:border dark:border-destructive dark:bg-background dark:text-destructive dark:hover:bg-destructive/10",onClick:()=>i?.(t),children:s.delete}):null]}):(0,ey.jsx)(xC,{className:"size-5"})})})}function eek({hidden:e,items:t,trashItems:n,trashClipboardItems:r,draggingId:a,onDraggingChange:i,onItemsChange:o,onTrashItemsChange:l,onTrashClipboardItemsChange:s}){let c=ew.useRef(0),[u,d]=ew.useState(!1);return(ew.useEffect(()=>{d(!0)},[]),u)?(0,is.createPortal)((0,ey.jsxs)("div",{className:(0,eI.cn)("pointer-events-none fixed inset-0 z-40 overflow-visible transition-opacity duration-200",e&&"opacity-0"),children:[(0,ey.jsx)(eej,{active:!e&&void 0!==a,items:e?[]:n,className:(0,eI.cn)(e&&"pointer-events-none"),labels:{delete:"删除",empty:"拖入暂存"},onDrop:({id:e,title:n,meta:r})=>{let a=t.find(t=>t.id===e);a&&(s(t=>({...t,[e]:a})),l(t=>t.some(t=>t.id===e)?t:[...t,{id:e,title:n,meta:r,icon:a.icon}]))},onDelete:e=>{let t=new Set(e.map(e=>e.id));l(e=>e.filter(e=>!t.has(e.id))),s(e=>{let n={...e};for(let e of t)delete n[e];return n})},onItemRestore:e=>{let n=r[e.id];n&&o([n,...t.filter(e=>e.id!==n.id)]),l(t=>t.filter(t=>t.id!==e.id)),s(t=>{let n={...t};return delete n[e.id],n})}}),t.length>0?(0,ey.jsx)("div",{className:(0,eI.cn)("pointer-events-auto absolute top-4 right-4 w-80 max-w-[calc(100vw-2rem)] transition-[opacity,transform] duration-200",e&&"pointer-events-none -translate-y-2 opacity-0"),children:(0,ey.jsx)(Gy,{items:t,title:"剪切板",labels:{empty:"剪切板为空",dragHandle:"拖拽卡片"},expansionDirection:"down-left",removeOnExternalDrop:!0,maxExpandedHeight:420,onItemDuplicate:(e,{item:n,index:r})=>{let a,i,l,s,u;return c.current+=1,a=n.payloads?.[KT],i=n.payloads?{...n.payloads}:void 0,l=n.payloads?.[KL],a&&i&&(i[KT]={...a,config:{...a.config}}),l&&i&&(i[KL]={...l,config:l.config?{...l.config}:l.config}),s={...n,id:`${n.id}-copy-${c.current}`,title:`${n.title} copy`,payloads:i,dragData:{...n.dragData,...a?{"application/vnd.vantaloom.dashboard-widget-config":JSON.stringify(a.config)}:{}}},void((u=[...t]).splice(r+1,0,s),o(u))},onItemsRemove:e=>o(e),onItemsReorder:e=>o(e),onItemDragStart:({item:e})=>i(e.id),onItemDragEnd:()=>i(void 0)})}):null]}),document.body):null}let eeS=(0,ek.default)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]),eeC=(0,ek.default)("languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]),eeN=(0,ek.default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]),eeM=(0,ek.default)("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]),eeE=(0,ek.default)("moon",[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]]),eeO=(0,ek.default)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),eeP=(0,ek.default)("sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]),eeA=(0,ek.default)("users-round",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]);var eeI="Collapsible",[eez,ee_]=sG(eeI),[eeD,eeR]=eez(eeI),eeT=ew.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:a,disabled:i,onOpenChange:o,...l}=e,[s,c]=s2({prop:r,defaultProp:a??!1,onChange:o,caller:eeI});return(0,ey.jsx)(eeD,{scope:n,disabled:i,contentId:s0(),open:s,onOpenToggle:ew.useCallback(()=>c(e=>!e),[c]),children:(0,ey.jsx)(s6.div,{"data-state":eeH(s),"data-disabled":i?"":void 0,...l,ref:t})})});eeT.displayName=eeI;var eeL="CollapsibleTrigger",ee$=ew.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,a=eeR(eeL,n);return(0,ey.jsx)(s6.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":eeH(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...r,ref:t,onClick:sY(e.onClick,a.onOpenToggle)})});ee$.displayName=eeL;var eeF="CollapsibleContent",eeB=ew.forwardRef((e,t)=>{let{forceMount:n,...r}=e,a=eeR(eeF,e.__scopeCollapsible);return(0,ey.jsx)(cp,{present:n||a.open,children:({present:e})=>(0,ey.jsx)(eeV,{...r,ref:t,present:e})})});eeB.displayName=eeF;var eeV=ew.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:a,...i}=e,o=eeR(eeF,n),[l,s]=ew.useState(r),c=ew.useRef(null),u=(0,sX.useComposedRefs)(t,c),d=ew.useRef(0),f=d.current,h=ew.useRef(0),p=h.current,m=o.open||l,g=ew.useRef(m),v=ew.useRef(void 0);return ew.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),sZ(()=>{let e=c.current;if(e){v.current=v.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration="0s",e.style.animationName="none";let t=e.getBoundingClientRect();d.current=t.height,h.current=t.width,g.current||(e.style.transitionDuration=v.current.transitionDuration,e.style.animationName=v.current.animationName),s(r)}},[o.open,r]),(0,ey.jsx)(s6.div,{"data-state":eeH(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!m,...i,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":p?`${p}px`:void 0,...e.style},children:m&&a})});function eeH(e){return e?"open":"closed"}var eeW=e.i(91e3);let eeU={"new-canvas":"canvas","all-canvases":"canvas","open-recent-canvas":"canvas","new-agent-conversation":"agent","open-recent-conversation":"agent",preferences:"settings","preferences-model-routes":"settings","preferences-agent-config":"settings","preferences-subagent-config":"settings","preferences-cc-engine-config":"settings","preferences-layout":"settings","check-update":"settings",account:"settings"};function eeq({navItems:e,contents:t,activeWorkspace:n,activeConversationId:r,activeCanvasId:a,onItemSelect:i,onOpenConversation:o,onOpenCanvas:l,onOpenConversationSettings:s,onOpenCanvasSettings:c,onConversationDeleted:u,onAccountSettings:d,subagentTree:f,activeSubagentPath:h,onOpenSubagent:p,hideCanvas:m,className:g}){let v=eeU[n]??(m?"agent":"canvas");m&&"canvas"===v&&(v="agent");let[x,y]=ew.useState(v);ew.useEffect(()=>{y(v)},[v]);let b=m?e.filter(e=>"canvas"!==e.id):e,w=t.find(e=>e.id===x);return(0,ey.jsxs)("aside",{"data-slot":"flat-sidebar",className:(0,eI.cn)("flex h-full w-72 flex-col rounded-xl border border-border bg-sidebar p-3 text-sidebar-foreground shadow-sm",g),children:[(0,ey.jsx)("nav",{className:"mb-5 flex gap-1 rounded-lg bg-muted/70 p-1",children:b.map(e=>{let t=e.id===x;return(0,ey.jsxs)("button",{type:"button",onClick:()=>y(e.id),className:(0,eI.cn)("flex flex-1 items-center justify-center gap-1.5 rounded-md py-1.5 text-[13px] font-medium transition-colors [&_svg]:size-4",t?"border border-border/50 bg-background text-foreground shadow-sm":"text-muted-foreground hover:bg-background/50 hover:text-foreground"),children:[e.icon,(0,ey.jsx)("span",{className:"truncate",children:e.label})]},e.id)})}),"canvas"===x?(0,ey.jsx)(eeK,{activeCanvasId:a,onItemSelect:i,onOpenCanvas:l,onOpenCanvasSettings:c}):"agent"===x?(0,ey.jsx)(eeZ,{activeConversationId:r,onItemSelect:i,onOpenConversation:o,onOpenConversationSettings:s,onConversationDeleted:u,subagentTree:f,activeSubagentPath:h,onOpenSubagent:p}):(0,ey.jsx)(ee3,{content:w,activeWorkspace:n,onItemSelect:i}),(0,ey.jsx)(ett,{onItemSelect:i,onAccountSettings:d})]})}function eeK({activeCanvasId:e,onItemSelect:t,onOpenCanvas:n,onOpenCanvasSettings:r}){let{recents:a,loading:i}=function(){let[e,t]=ew.useState([]),[n,r]=ew.useState(!0);return ew.useEffect(()=>{let e=!0;async function n(){try{let{canvases:n}=await ZB();if(!e)return;let r=[...n].sort((e,t)=>t.updatedAt>e.updatedAt?1:-1);t(r)}catch{}finally{e&&r(!1)}}n();let a=setInterval(()=>void n(),1e4);return()=>{e=!1,clearInterval(a)}},[]),{recents:e,loading:n}}(),o=a.filter(e=>!0===e.running),l=a.filter(e=>!0!==e.running),s=i&&0===a.length;return(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("div",{className:"mb-6 space-y-0.5",children:(0,ey.jsx)(ee7,{icon:eeO,label:Z8.canvasNew,onClick:()=>t({item:{id:"new-canvas"}})})}),(0,ey.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto vtl-scrollbar-hidden pr-1",children:[o.length>0?(0,ey.jsxs)("div",{className:"mb-4",children:[(0,ey.jsxs)("div",{className:"mb-2 flex items-center gap-2 px-3",children:[(0,ey.jsx)("span",{className:"size-1.5 shrink-0 rounded-full bg-green-500"}),(0,ey.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"正在运行"})]}),(0,ey.jsx)("div",{className:"space-y-0.5",children:o.map(t=>(0,ey.jsx)(eeG,{canvas:t,active:t.id===e,onOpenCanvas:n,onOpenCanvasSettings:r},t.id))})]}):null,(0,ey.jsx)("div",{className:"mb-2 flex items-center justify-between px-3",children:(0,ey.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"最近"})}),(0,ey.jsx)("div",{className:"space-y-0.5",children:s?(0,ey.jsx)(ee9,{}):0===l.length?(0,ey.jsx)("p",{className:"px-3 py-1.5 text-[13px] text-muted-foreground/60",children:"暂无画布"}):l.map(t=>(0,ey.jsx)(eeG,{canvas:t,active:t.id===e,onOpenCanvas:n,onOpenCanvasSettings:r},t.id))})]})]})}function eeG({canvas:e,active:t,onOpenCanvas:n,onOpenCanvasSettings:r}){let a=!0===e.running;return(0,ey.jsx)(ee5,{title:a?`${e.title} \xb7 运行中`:e.title,label:e.title,active:t,running:a,onOpen:()=>n(e.id,e.ownerMachineId),onOpenSettings:r?()=>r(e.id,e.ownerMachineId):void 0})}let eeX="__all__",eeY={status:"all",location:eeX,sort:"recent"};function eeZ({activeConversationId:e,onItemSelect:t,onOpenConversation:n,onOpenConversationSettings:r,onConversationDeleted:a,subagentTree:i,activeSubagentPath:o,onOpenSubagent:l}){let{recents:s,refresh:c,loading:u,machineNames:d}=function(){let[e,t]=ew.useState([]),[n,r]=ew.useState(!0),[a,i]=ew.useState({}),o=ew.useRef(!0),l=ew.useCallback(async()=>{try{let{conversations:e,machineNames:n}=await sy();if(!o.current)return;let r=[...e].sort((e,t)=>t.updatedAt>e.updatedAt?1:-1);t(r),i(n)}catch{}finally{o.current&&r(!1)}},[]);return ew.useEffect(()=>{o.current=!0,l();let e=setInterval(()=>void l(),1e4);return()=>{o.current=!1,clearInterval(e)}},[l]),{recents:e,refresh:()=>void l(),loading:n,machineNames:a}}(),[f,h]=ew.useState(eeY),p=ew.useMemo(()=>{let e=new Set;for(let t of s)e.add(t.ownerMachineId||sm);return Array.from(e)},[s]),m=ew.useCallback(e=>sg(e)?"本机":d[e]??e,[d]),g=ew.useMemo(()=>{let e=s.filter(e=>{let t=!0===e.running;return("running"!==f.status||!!t)&&("idle"!==f.status||!t)&&(f.location===eeX||(e.ownerMachineId||sm)===f.location)});return"name"===f.sort?e.sort((e,t)=>e.title.localeCompare(t.title,"zh-CN",{sensitivity:"base"})):e.sort((e,t)=>t.updatedAt>e.updatedAt?1:-1),e},[s,f]),v=g.filter(e=>!0===e.running),x=g.filter(e=>!0!==e.running),y=f.status!==eeY.status||f.location!==eeY.location||f.sort!==eeY.sort,b=u&&0===s.length,w=ew.useCallback(async e=>{try{await sO(e.id,e.ownerMachineId)}catch{}a?.(e.id),c()},[a,c]),j=ew.useCallback(async e=>{try{let t=await s_(e.id,void 0,e.ownerMachineId);await c(),n(t.conversation.id,t.conversation.ownerMachineId)}catch{}},[c,n]),k=ew.useMemo(()=>new Set((o??[]).map(e=>e.id)),[o]),S=o?.[o.length-1]?.id,C=t=>{let a=new Map(t.map(e=>[e.id,e])),o=new Map,s=[];for(let e of t){let t=e.forkOriginId;if(t&&a.has(t)){let n=o.get(t)??[];n.push(e),o.set(t,n)}else s.push(e)}let c=(t,a)=>{let s=t.id!==e||(i?.length??0)===0?null:(0,ey.jsx)(eeJ,{nodes:i??[],depth:0,ancestors:[],activeIds:k,activeLeafId:S,onOpen:l});return(0,ey.jsxs)(ew.Fragment,{children:[(0,ey.jsx)(ee2,{conversation:t,depth:a,active:t.id===e,onOpenConversation:n,onOpenConversationSettings:r,onDelete:w,onFork:j}),s?(0,ey.jsx)("div",{style:a>0?{marginLeft:14*a}:void 0,children:s}):null,(o.get(t.id)??[]).map(e=>c(e,a+1))]},t.id)};return s.map(e=>c(e,0))};return(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("div",{className:"mb-6 space-y-0.5","data-tour":"new-conversation",children:(0,ey.jsx)(ee7,{icon:e9,label:Z8.conversationNew,onClick:()=>t({item:{id:"new-agent-conversation"}})})}),(0,ey.jsxs)("div",{className:"min-h-0 flex-1 overflow-y-auto vtl-scrollbar-hidden pr-1",children:[v.length>0?(0,ey.jsxs)("div",{className:"mb-4",children:[(0,ey.jsxs)("div",{className:"mb-2 flex items-center gap-2 px-3",children:[(0,ey.jsx)("span",{className:"size-1.5 shrink-0 rounded-full bg-green-500"}),(0,ey.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"正在运行"})]}),(0,ey.jsx)("div",{className:"space-y-0.5",children:C(v)})]}):null,(0,ey.jsxs)("div",{className:"mb-2 flex items-center justify-between px-3",children:[(0,ey.jsx)("span",{className:"text-[13px] text-muted-foreground",children:"最近"}),(0,ey.jsx)(ee0,{filter:f,onChange:h,active:y,locations:p,locationLabel:m})]}),(0,ey.jsx)("div",{className:"space-y-0.5",children:b?(0,ey.jsx)(ee9,{}):0===x.length?(0,ey.jsx)("p",{className:"px-3 py-1.5 text-[13px] text-muted-foreground/60",children:y?"没有符合筛选条件的对话":"暂无对话"}):C(x)})]})]})}function eeJ({nodes:e,depth:t,ancestors:n,activeIds:r,activeLeafId:a,onOpen:i}){let o=e.filter(e=>(function e(t,n){return!!(t.running||n.has(t.id))||(t.children??[]).some(t=>e(t,n))})(e,r));return 0===o.length?null:(0,ey.jsx)("div",{className:"space-y-0.5",children:o.map(e=>{let o=Vi(e.subagentType),l=o.Icon,s=[...n,{id:e.id,ownerMachineId:e.ownerMachineId,name:e.subagentName,subagentType:e.subagentType}],c=e.id===a;return(0,ey.jsxs)("div",{children:[(0,ey.jsxs)("button",{type:"button",className:(0,eI.cn)("flex w-full items-center gap-1.5 rounded-md py-1 pr-2 text-left text-xs transition-colors",c?"bg-accent text-accent-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),style:{paddingLeft:18+14*t},onClick:()=>i?.(s),title:e.subagentName||o.label,children:[(0,ey.jsx)("span",{className:"shrink-0 text-muted-foreground/40",children:"└"}),(0,ey.jsx)(l,{className:(0,eI.cn)("size-3.5 shrink-0",o.color)}),(0,ey.jsx)("span",{className:"truncate",children:e.subagentName||`${o.label}子代理`}),e.running?(0,ey.jsx)(eM,{className:"ml-auto size-3 shrink-0 animate-spin text-muted-foreground"}):null]}),(0,ey.jsx)(eeJ,{nodes:e.children??[],depth:t+1,ancestors:s,activeIds:r,activeLeafId:a,onOpen:i})]},e.id)})})}let eeQ={all:"全部",running:"运行中",idle:"空闲"};function ee0({filter:e,onChange:t,active:n,locations:r,locationLabel:a}){let i=e.location===eeX?"全部":a(e.location);return(0,ey.jsxs)(y2,{children:[(0,ey.jsx)(y4,{asChild:!0,children:(0,ey.jsxs)("button",{type:"button",title:"筛选","aria-label":"筛选",className:(0,eI.cn)("relative rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground",n&&"text-foreground"),children:[(0,ey.jsx)(ZY,{className:"size-4"}),n?(0,ey.jsx)("span",{className:"absolute -right-0.5 -top-0.5 size-2 rounded-full border border-sidebar bg-primary"}):null]})}),(0,ey.jsxs)(bl,{align:"end",sideOffset:4,className:"min-w-56",children:[(0,ey.jsx)(bu,{children:"筛选与排序"}),(0,ey.jsxs)(bo,{children:[(0,ey.jsxs)(bh,{children:[(0,ey.jsx)("span",{className:"flex-1",children:"状态"}),(0,ey.jsx)("span",{className:"text-xs text-muted-foreground",children:eeQ[e.status]})]}),(0,ey.jsx)(bp,{children:(0,ey.jsxs)(be,{value:e.status,onValueChange:n=>t({...e,status:n}),children:[(0,ey.jsx)(bc,{value:"all",children:"全部"}),(0,ey.jsx)(bc,{value:"running",children:"运行中"}),(0,ey.jsx)(bc,{value:"idle",children:"空闲"})]})})]}),(0,ey.jsxs)(bo,{children:[(0,ey.jsxs)(bh,{children:[(0,ey.jsx)("span",{className:"flex-1",children:"运行位置"}),(0,ey.jsx)("span",{className:"max-w-24 truncate text-xs text-muted-foreground",children:i})]}),(0,ey.jsx)(bp,{className:"max-h-72 overflow-y-auto",children:(0,ey.jsxs)(be,{value:e.location,onValueChange:n=>t({...e,location:n}),children:[(0,ey.jsx)(bc,{value:eeX,children:"全部"}),r.map(e=>(0,ey.jsx)(bc,{value:e,children:(0,ey.jsx)("span",{className:"truncate",children:a(e)})},e))]})})]}),(0,ey.jsx)(bd,{}),(0,ey.jsx)(bu,{children:"排序"}),(0,ey.jsxs)(be,{value:e.sort,onValueChange:n=>t({...e,sort:n}),children:[(0,ey.jsx)(bc,{value:"recent",children:"最近活动"}),(0,ey.jsx)(bc,{value:"name",children:"名称"})]}),n?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(bd,{}),(0,ey.jsx)(bs,{onSelect:()=>t(eeY),children:(0,ey.jsx)("span",{className:"flex-1",children:"重置筛选"})})]}):null]})]})}function ee1({engine:e}){if("vantaloom"===e)return null;let t="claude-code"===e;return(0,ey.jsxs)("span",{title:t?"Claude Code":"reclaude",className:(0,eI.cn)("relative inline-flex shrink-0 select-none items-center justify-center rounded px-1 py-px text-[9px] font-semibold leading-none tracking-wide",t?"bg-violet-500/15 text-violet-600 dark:bg-violet-400/20 dark:text-violet-300":"bg-sky-500/15 text-sky-600 dark:bg-sky-400/20 dark:text-sky-300"),children:[t?"CC":"RC",!t&&(0,ey.jsx)("span",{className:"absolute -right-0.5 -top-0.5 size-1.5 rounded-full bg-sky-400 dark:bg-sky-300"})]})}function ee2({conversation:e,active:t,depth:n=0,onOpenConversation:r,onOpenConversationSettings:a,onDelete:i,onFork:o}){let l=!0===e.running,s=e.settings?.engine??"vantaloom",c="vantaloom"!==s?(0,ey.jsxs)("span",{className:"flex min-w-0 flex-1 items-center gap-1.5 overflow-hidden",children:[(0,ey.jsx)(ee1,{engine:s}),(0,ey.jsx)("span",{className:"truncate",children:e.title})]}):void 0;return(0,ey.jsx)(ee5,{title:l?`${e.title} \xb7 运行中`:e.title,label:e.title,labelNode:c,active:t,running:l,depth:n,onOpen:()=>r(e.id,e.ownerMachineId),onOpenSettings:a?()=>a(e.id,e.ownerMachineId):void 0,onDelete:i?()=>i(e):void 0,onFork:o?()=>o(e):void 0,deleteLabel:"删除会话"})}function ee5({title:e,label:t,labelNode:n,active:r,running:a,depth:i=0,onOpen:o,onOpenSettings:l,onDelete:s,onFork:c,deleteLabel:u="删除"}){let[d,f]=ew.useState(!1),h=i>0;return(0,ey.jsxs)("div",{className:(0,eI.cn)("group relative flex items-center rounded-lg text-[13px] transition-colors",r?"bg-muted text-foreground":"text-foreground/80 hover:bg-muted hover:text-foreground"),style:h?{marginLeft:14*i}:void 0,children:[(0,ey.jsxs)("button",{type:"button",title:e,onClick:o,className:"flex min-w-0 flex-1 items-center gap-3 rounded-lg px-3 py-2 text-left",children:[h?(0,ey.jsx)("span",{"aria-hidden":!0,className:"h-4 w-0.5 shrink-0 rounded-full bg-primary/40"}):null,a?(0,ey.jsx)("span",{className:"size-1.5 shrink-0 rounded-full bg-green-500","aria-label":"运行中"}):(0,ey.jsx)(ete,{active:r}),n??(0,ey.jsx)("span",{className:"min-w-0 flex-1 truncate",children:t})]}),l||s||c?(0,ey.jsxs)(y2,{children:[(0,ey.jsx)(y4,{asChild:!0,children:(0,ey.jsx)("button",{type:"button","aria-label":"更多操作",className:"mr-1 shrink-0 rounded-md p-1 text-muted-foreground opacity-0 transition-opacity hover:bg-background/70 hover:text-foreground focus-visible:opacity-100 group-hover:opacity-100 aria-expanded:opacity-100",children:(0,ey.jsx)(lF,{className:"size-4"})})}),(0,ey.jsxs)(bl,{align:"end",sideOffset:4,className:"min-w-44",children:[l?(0,ey.jsxs)(bs,{onSelect:()=>l(),children:[(0,ey.jsx)(Js,{}),(0,ey.jsx)("span",{className:"flex-1",children:"打开设置界面"})]}):null,c?(0,ey.jsxs)(bs,{onSelect:()=>c(),children:[(0,ey.jsx)(BT,{}),(0,ey.jsx)("span",{className:"flex-1",children:"分支对话"})]}):null,s?(0,ey.jsxs)(bs,{variant:"destructive",onSelect:()=>f(!0),children:[(0,ey.jsx)(xC,{}),(0,ey.jsx)("span",{className:"flex-1",children:u})]}):null]})]}):null,s?(0,ey.jsx)(uL,{open:d,onOpenChange:f,children:(0,ey.jsxs)(u2,{children:[(0,ey.jsxs)(u5,{children:[(0,ey.jsx)(u3,{children:u}),(0,ey.jsxs)(u6,{children:["确认删除「",t,"」?此操作无法撤销。"]})]}),(0,ey.jsxs)(u4,{children:[(0,ey.jsx)(u7,{children:"取消"}),(0,ey.jsx)(u8,{variant:"destructive",onClick:()=>s(),children:"删除"})]})]})}):null]})}let ee4=["preferences","preferences-model-routes","preferences-agent-config","preferences-subagent-config","preferences-cc-engine-config","preferences-layout"];function ee3({content:e,activeWorkspace:t,onItemSelect:n}){let r=(e?.sections??[]).flatMap(e=>e.items);return(0,ey.jsx)(bQ,{className:"min-h-0 flex-1",viewportClassName:"pr-1",children:(0,ey.jsx)("div",{className:"space-y-0.5",children:r.map(e=>"preferences"===e.id?(0,ey.jsx)(ee8,{activeWorkspace:t,onItemSelect:n},e.id):(0,ey.jsx)(ee6,{id:e.id,icon:e.icon,label:e.label,active:e.id===t,onItemSelect:n},e.id))})})}function ee6({id:e,icon:t,label:n,active:r,onItemSelect:a}){return(0,ey.jsxs)("button",{type:"button",onClick:()=>a({item:{id:e}}),className:(0,eI.cn)("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[13px] transition-colors [&_svg]:size-4 [&_svg]:shrink-0",r?"bg-muted text-foreground [&_svg]:text-foreground":"text-foreground/80 hover:bg-muted hover:text-foreground [&_svg]:text-muted-foreground"),children:[t,(0,ey.jsx)("span",{className:"min-w-0 flex-1 truncate",children:n}),r&&(0,ey.jsx)(ete,{active:!0})]})}function ee8({activeWorkspace:e,onItemSelect:t}){let n=ee4.includes(e),[r,a]=ew.useState(!0),i=[{id:"preferences-model-routes",label:"模型路由",icon:(0,ey.jsx)(pj,{})},{id:"preferences-agent-config",label:"代理配置",icon:(0,ey.jsx)(de,{})},{id:"preferences-subagent-config",label:"子代理配置",icon:(0,ey.jsx)(eeA,{})},{id:"preferences-cc-engine-config",label:"CC 引擎",icon:(0,ey.jsx)(dr,{})},{id:"preferences-layout",label:"布局排版",icon:(0,ey.jsx)(eeN,{})}];return(0,ey.jsxs)(eeT,{open:r,onOpenChange:a,children:[(0,ey.jsx)(ee$,{asChild:!0,children:(0,ey.jsxs)("button",{type:"button",className:(0,eI.cn)("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[13px] transition-colors [&_svg]:size-4 [&_svg]:shrink-0",n?"text-foreground [&>svg:first-child]:text-foreground":"text-foreground/80 hover:bg-muted hover:text-foreground [&>svg:first-child]:text-muted-foreground"),children:[(0,ey.jsx)(Js,{}),(0,ey.jsx)("span",{className:"min-w-0 flex-1 truncate",children:"偏好设置"}),(0,ey.jsx)(gK,{className:(0,eI.cn)("text-muted-foreground transition-transform",r?"rotate-0":"-rotate-90")})]})}),(0,ey.jsx)(eeB,{className:"mt-0.5 space-y-0.5",children:i.map(n=>{let r=n.id===e;return(0,ey.jsxs)("button",{type:"button",onClick:()=>t({item:{id:n.id}}),className:(0,eI.cn)("flex w-full items-center gap-3 rounded-lg py-2 pl-9 pr-3 text-left text-[13px] transition-colors [&_svg]:size-4 [&_svg]:shrink-0",r?"bg-muted text-foreground [&_svg]:text-foreground":"text-foreground/80 hover:bg-muted hover:text-foreground [&_svg]:text-muted-foreground"),children:[n.icon,(0,ey.jsx)("span",{className:"min-w-0 flex-1 truncate",children:n.label}),r&&(0,ey.jsx)(ete,{active:!0})]},n.id)})})]})}function ee7({icon:e,label:t,onClick:n}){return(0,ey.jsxs)("button",{type:"button",onClick:n,className:"flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm text-foreground transition-colors hover:bg-muted",children:[(0,ey.jsx)(e,{className:"size-4 shrink-0 text-muted-foreground"}),(0,ey.jsx)("span",{className:"min-w-0 flex-1 truncate",children:t})]})}function ee9(){return(0,ey.jsxs)("div",{className:"flex items-center justify-center gap-2 px-3 py-3 text-[13px] text-muted-foreground/70",role:"status","aria-live":"polite",children:[(0,ey.jsx)(eM,{className:"size-4 animate-spin"}),(0,ey.jsx)("span",{children:"加载中…"})]})}function ete({active:e}){return(0,ey.jsx)("span",{className:(0,eI.cn)("size-1.5 shrink-0 rounded-full",e?"bg-primary":"border border-muted-foreground/50 bg-transparent")})}function ett({onItemSelect:e,onAccountSettings:t}){let{user:n}=e8(),r=n?.name??Z6.product,a=(n?.name??"V").slice(0,1).toUpperCase();return(0,ey.jsx)("div",{className:"mt-auto pt-3",children:(0,ey.jsxs)(y2,{children:[(0,ey.jsx)(y4,{asChild:!0,children:(0,ey.jsxs)("button",{type:"button","data-tour":"account-button",className:"flex w-full items-center justify-between rounded-xl p-2 transition-colors hover:bg-muted",children:[(0,ey.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,ey.jsx)("span",{className:"flex size-6 shrink-0 items-center justify-center rounded-full border border-border/60 bg-muted text-[10px] font-semibold text-foreground",children:a}),(0,ey.jsx)("span",{className:"truncate text-sm text-foreground",children:r})]}),(0,ey.jsx)(pC,{className:"size-4 shrink-0 -rotate-90 text-muted-foreground"})]})}),(0,ey.jsxs)(bl,{side:"top",align:"start",sideOffset:8,className:"w-[var(--radix-dropdown-menu-trigger-width)] min-w-60",children:[n?.email&&(0,ey.jsx)(bu,{className:"truncate font-normal text-muted-foreground",children:n.email}),(0,ey.jsxs)(bs,{onSelect:()=>e({item:{id:"preferences"}}),children:[(0,ey.jsx)(Js,{}),(0,ey.jsx)("span",{className:"flex-1",children:"设置"}),(0,ey.jsx)("span",{className:"text-xs text-muted-foreground",children:"Ctrl,"})]}),(0,ey.jsxs)(bs,{disabled:!0,children:[(0,ey.jsx)(eeC,{}),(0,ey.jsx)("span",{className:"flex-1",children:"语言"}),(0,ey.jsx)("span",{className:"text-xs text-muted-foreground",children:"中文"})]}),(0,ey.jsxs)(bs,{disabled:!0,children:[(0,ey.jsx)(eeS,{}),(0,ey.jsx)("span",{className:"flex-1",children:"获取帮助"})]}),(0,ey.jsx)(bd,{}),(0,ey.jsxs)(bs,{onSelect:()=>{t?t():e({item:{id:"account"}})},children:[(0,ey.jsx)(Ku,{}),(0,ey.jsx)("span",{className:"flex-1",children:"Hub 账户"})]}),(0,ey.jsx)(etr,{}),n&&(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(bd,{}),(0,ey.jsx)(eta,{})]})]})]})})}let etn=["light","dark","jelly"];function etr(){let{resolvedTheme:e,setTheme:t}=(0,hl.useTheme)(),[n,r]=ew.useState(eeW.defaultAppearanceTheme);ew.useEffect(()=>{let e=window.localStorage.getItem(eeW.appearanceThemeStorageKey)??eeW.defaultAppearanceTheme;r(e),(0,eeW.applyAppearanceTheme)({theme:e})},[]);let a=n===eeW.jellyAppearanceTheme?"jelly":"dark"===e?"dark":"light",i=etn[(etn.indexOf(a)+1)%etn.length]??"light";function o(e){r(e),window.localStorage.setItem(eeW.appearanceThemeStorageKey,e),(0,eeW.applyAppearanceTheme)({theme:e})}let l="dark"===a?eeE:eeP;return(0,ey.jsxs)(bs,{onSelect:e=>{e.preventDefault(),function(){if("jelly"===i){t("dark"),o(eeW.jellyAppearanceTheme);return}o(eeW.defaultAppearanceTheme),t(i)}()},children:[(0,ey.jsx)(l,{}),(0,ey.jsx)("span",{className:"flex-1",children:Z6.theme}),(0,ey.jsx)("span",{className:"text-xs capitalize text-muted-foreground",children:a})]})}function eta(){let{logout:e}=e8();return(0,ey.jsxs)(bs,{variant:"destructive",onSelect:()=>{e().then(()=>{window.location.reload()})},children:[(0,ey.jsx)(eeM,{}),(0,ey.jsx)("span",{className:"flex-1",children:"退出登录"})]})}let eti=ew.default.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),eto=()=>{let e=ew.default.useContext(eti);if(!e)throw Error("useDrawerContext must be used within a Drawer.Root");return e};function etl(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function ets(){return etc(/^iPhone/)||etc(/^iPad/)||etc(/^Mac/)&&navigator.maxTouchPoints>1}function etc(e){return"u">typeof window&&null!=window.navigator?e.test(window.navigator.platform):void 0}!function(e){if(!e||"u"<typeof document)return;let t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}("[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(\n[data-state=closed]\n){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}");let etu="u">typeof window?ew.useLayoutEffect:ew.useEffect;function etd(...e){return(...t)=>{for(let n of e)"function"==typeof n&&n(...t)}}let etf="u">typeof document&&window.visualViewport;function eth(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function etp(e){for(eth(e)&&(e=e.parentElement);e&&!eth(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}let etm=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]),etg=0;function etv(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function etx(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let t=etp(e);if(t!==document.documentElement&&t!==document.body&&t!==e){let n=t.getBoundingClientRect().top,r=e.getBoundingClientRect().top;e.getBoundingClientRect().bottom>t.getBoundingClientRect().bottom+24&&(t.scrollTop+=r-n)}e=t.parentElement}}function ety(e){return e instanceof HTMLInputElement&&!etm.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function etb(...e){return ew.useCallback(function(...e){return t=>e.forEach(e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)})}(...e),e)}let etw=new WeakMap;function etj(e,t,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(t).forEach(([t,n])=>{t.startsWith("--")?e.style.setProperty(t,n):(r[t]=e.style[t],e.style[t]=n)}),n||etw.set(e,r)}let etk=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function etS(e,t){if(!e)return null;let n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform,a=r.match(/^matrix3d\((.+)\)$/);return a?parseFloat(a[1].split(", ")[etk(t)?13:12]):(a=r.match(/^matrix\((.+)\)$/))?parseFloat(a[1].split(", ")[etk(t)?5:4]):null}function etC(e,t){if(!e)return()=>{};let n=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=n}}let etN=[.32,.72,0,1],etM="vaul-dragging";function etE(e){let t=ew.default.useRef(e);return ew.default.useEffect(()=>{t.current=e}),ew.default.useMemo(()=>(...e)=>null==t.current?void 0:t.current.call(t,...e),[])}function etO({prop:e,defaultProp:t,onChange:n=()=>{}}){let[r,a]=function({defaultProp:e,onChange:t}){let n=ew.default.useState(e),[r]=n,a=ew.default.useRef(r),i=etE(t);return ew.default.useEffect(()=>{a.current!==r&&(i(r),a.current=r)},[r,a,i]),n}({defaultProp:t,onChange:n}),i=void 0!==e,o=i?e:r,l=etE(n);return[o,ew.default.useCallback(t=>{if(i){let n="function"==typeof t?t(e):t;n!==e&&l(n)}else a(t)},[i,e,a,l])]}let etP=()=>()=>{},etA=null,etI=ew.default.forwardRef(function({...e},t){let{overlayRef:n,snapPoints:r,onRelease:a,shouldFade:i,isOpen:o,modal:l,shouldAnimate:s}=eto(),c=etb(t,n),u=r&&r.length>0;if(!l)return null;let d=ew.default.useCallback(e=>a(e),[a]);return ew.default.createElement(up,{onMouseUp:d,ref:c,"data-vaul-overlay":"","data-vaul-snap-points":o&&u?"true":"false","data-vaul-snap-points-overlay":o&&i?"true":"false","data-vaul-animate":(null==s?void 0:s.current)?"true":"false",...e})});etI.displayName="Drawer.Overlay";let etz=ew.default.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:n,...r},a){let{drawerRef:i,onPress:o,onRelease:l,onDrag:s,keyboardIsOpen:c,snapPointsOffset:u,activeSnapPointIndex:d,modal:f,isOpen:h,direction:p,snapPoints:m,container:g,handleOnly:v,shouldAnimate:x,autoFocus:y}=eto(),[b,w]=ew.default.useState(!1),j=etb(a,i),k=ew.default.useRef(null),S=ew.default.useRef(null),C=ew.default.useRef(!1),N=m&&m.length>0;function M(e){k.current=null,C.current=!1,l(e)}return!function(){let{direction:e,isOpen:t,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:a}=eto(),i=ew.default.useRef(null),o=(0,ew.useMemo)(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-26)/window.innerWidth}ew.default.useEffect(()=>{if(t&&n){i.current&&clearTimeout(i.current);let t=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!t)return;!function(...e){}(r&&!a?etC(document.body,{background:"black"}):etP,etC(t,{transformOrigin:etk(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:"0.5s",transitionTimingFunction:`cubic-bezier(${etN.join(",")})`}));let n=etC(t,{borderRadius:"8px",overflow:"hidden",...etk(e)?{transform:`scale(${l()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${l()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{n(),i.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty("background")},500)}}},[t,n,o])}(),ew.default.useEffect(()=>{N&&window.requestAnimationFrame(()=>{w(!0)})},[]),ew.default.createElement(ux,{"data-vaul-drawer-direction":p,"data-vaul-drawer":"","data-vaul-delayed-snap-points":b?"true":"false","data-vaul-snap-points":h&&N?"true":"false","data-vaul-custom-container":g?"true":"false","data-vaul-animate":(null==x?void 0:x.current)?"true":"false",...r,ref:j,style:u&&u.length>0?{"--snap-point-height":`${u[null!=d?d:0]}px`,...t}:t,onPointerDown:e=>{v||(null==r.onPointerDown||r.onPointerDown.call(r,e),k.current={x:e.pageX,y:e.pageY},o(e))},onOpenAutoFocus:e=>{null==n||n(e),y||e.preventDefault()},onPointerDownOutside:t=>{(null==e||e(t),!f||t.defaultPrevented)?t.preventDefault():c.current&&(c.current=!1)},onFocusOutside:e=>{if(!f)return void e.preventDefault()},onPointerMove:e=>{if(S.current=e,v||(null==r.onPointerMove||r.onPointerMove.call(r,e),!k.current))return;let t=e.pageY-k.current.y,n=e.pageX-k.current.x,a="touch"===e.pointerType?10:2;((e,t,n=0)=>{if(C.current)return!0;let r=Math.abs(e.y),a=Math.abs(e.x),i=a>r,o=["bottom","right"].includes(t)?1:-1;if("left"===t||"right"===t){if(!(e.x*o<0)&&a>=0&&a<=n)return i}else if(!(e.y*o<0)&&r>=0&&r<=n)return!i;return C.current=!0,!0})({x:n,y:t},p,a)?s(e):(Math.abs(n)>a||Math.abs(t)>a)&&(k.current=null)},onPointerUp:e=>{null==r.onPointerUp||r.onPointerUp.call(r,e),k.current=null,C.current=!1,l(e)},onPointerOut:e=>{null==r.onPointerOut||r.onPointerOut.call(r,e),M(S.current)},onContextMenu:e=>{null==r.onContextMenu||r.onContextMenu.call(r,e),S.current&&M(S.current)}})});etz.displayName="Drawer.Content",ew.default.forwardRef(function({preventCycle:e=!1,children:t,...n},r){let{closeDrawer:a,isDragging:i,snapPoints:o,activeSnapPoint:l,setActiveSnapPoint:s,dismissible:c,handleOnly:u,isOpen:d,onPress:f,onDrag:h}=eto(),p=ew.default.useRef(null),m=ew.default.useRef(!1);function g(){p.current&&window.clearTimeout(p.current),m.current=!1}return ew.default.createElement("div",{onClick:function(){m.current?g():window.setTimeout(()=>{!function(){if(i||e||m.current)return g();if(g(),!o||0===o.length){c||a();return}if(l===o[o.length-1]&&c)return a();let t=o.findIndex(e=>e===l);-1===t||s(o[t+1])}()},120)},onPointerCancel:g,onPointerDown:e=>{u&&f(e),p.current=window.setTimeout(()=>{m.current=!0},250)},onPointerMove:e=>{u&&h(e)},ref:r,"data-vaul-drawer-visible":d?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},ew.default.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))}).displayName="Drawer.Handle";let et_=function({open:e,onOpenChange:t,children:n,onDrag:r,onRelease:a,snapPoints:i,shouldScaleBackground:l=!1,setBackgroundColorOnScale:s=!0,closeThreshold:c=.25,scrollLockTimeout:u=100,dismissible:d=!0,handleOnly:f=!1,fadeFromIndex:h=i&&i.length-1,activeSnapPoint:p,setActiveSnapPoint:m,fixed:g,modal:v=!0,onClose:x,nested:y,noBodyStyles:b=!1,direction:w="bottom",defaultOpen:j=!1,disablePreventScroll:k=!0,snapToSequentialPoint:S=!1,preventScrollRestoration:C=!1,repositionInputs:N=!0,onAnimationEnd:M,container:E,autoFocus:O=!1}){var P,A;let[I=!1,z]=etO({defaultProp:j,prop:e,onChange:e=>{null==t||t(e),e||y||eu(),setTimeout(()=>{null==M||M(e)},500),e&&!v&&"u">typeof window&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),e||(document.body.style.pointerEvents="auto")}}),[_,D]=ew.default.useState(!1),[R,T]=ew.default.useState(!1),[L,$]=ew.default.useState(!1),F=ew.default.useRef(null),B=ew.default.useRef(null),V=ew.default.useRef(null),H=ew.default.useRef(null),W=ew.default.useRef(null),U=ew.default.useRef(!1),q=ew.default.useRef(null),K=ew.default.useRef(0),G=ew.default.useRef(!1),X=ew.default.useRef(!j),Y=ew.default.useRef(0),Z=ew.default.useRef(null),J=ew.default.useRef((null==(P=Z.current)?void 0:P.getBoundingClientRect().height)||0),Q=ew.default.useRef((null==(A=Z.current)?void 0:A.getBoundingClientRect().width)||0),ee=ew.default.useRef(0),et=ew.default.useCallback(e=>{i&&e===eo.length-1&&(B.current=new Date)},[]),{activeSnapPoint:en,activeSnapPointIndex:er,setActiveSnapPoint:ea,onRelease:ei,snapPointsOffset:eo,onDrag:el,shouldFade:es,getPercentageDragged:ec}=function({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:n,drawerRef:r,overlayRef:a,fadeFromIndex:i,onSnapPointChange:o,direction:l="bottom",container:s,snapToSequentialPoint:c}){let[u,d]=etO({prop:e,defaultProp:null==n?void 0:n[0],onChange:t}),[f,h]=ew.default.useState("u">typeof window?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);ew.default.useEffect(()=>{function e(){h({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let p=ew.default.useMemo(()=>u===(null==n?void 0:n[n.length-1])||null,[n,u]),m=ew.default.useMemo(()=>{var e;return null!=(e=null==n?void 0:n.findIndex(e=>e===u))?e:null},[n,u]),g=n&&n.length>0&&(i||0===i)&&!Number.isNaN(i)&&n[i]===u||!n,v=ew.default.useMemo(()=>{var e;let t=s?{width:s.getBoundingClientRect().width,height:s.getBoundingClientRect().height}:"u">typeof window?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};return null!=(e=null==n?void 0:n.map(e=>{let n="string"==typeof e,r=0;if(n&&(r=parseInt(e,10)),etk(l)){let a=n?r:f?e*t.height:0;return f?"bottom"===l?t.height-a:-t.height+a:a}let a=n?r:f?e*t.width:0;return f?"right"===l?t.width-a:-t.width+a:a}))?e:[]},[n,f,s]),x=ew.default.useMemo(()=>null!==m?null==v?void 0:v[m]:null,[v,m]),y=ew.default.useCallback(e=>{var t;let s=null!=(t=null==v?void 0:v.findIndex(t=>t===e))?t:null;o(s),etj(r.current,{transition:`transform 0.5s cubic-bezier(${etN.join(",")})`,transform:etk(l)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`}),v&&s!==v.length-1&&void 0!==i&&s!==i&&s<i?etj(a.current,{transition:`opacity 0.5s cubic-bezier(${etN.join(",")})`,opacity:"0"}):etj(a.current,{transition:`opacity 0.5s cubic-bezier(${etN.join(",")})`,opacity:"1"}),d(null==n?void 0:n[Math.max(s,0)])},[r.current,n,v,i,a,d]);return ew.default.useEffect(()=>{if(u||e){var t;let r=null!=(t=null==n?void 0:n.findIndex(t=>t===e||t===u))?t:-1;v&&-1!==r&&"number"==typeof v[r]&&y(v[r])}},[u,e,n,v,y]),{isLastSnapPoint:p,activeSnapPoint:u,shouldFade:g,getPercentageDragged:function(e,t){if(!n||"number"!=typeof m||!v||void 0===i)return null;let r=m===i-1;if(m>=i&&t)return 0;if(r&&!t)return 1;if(!g&&!r)return null;let a=r?m+1:m-1,o=e/Math.abs(r?v[a]-v[a-1]:v[a+1]-v[a]);return r?1-o:o},setActiveSnapPoint:d,activeSnapPointIndex:m,onRelease:function({draggedDistance:e,closeDrawer:t,velocity:r,dismissible:o}){if(void 0===i)return;let s="bottom"===l||"right"===l?(null!=x?x:0)-e:(null!=x?x:0)+e,u=m===i-1,d=0===m,f=e>0;if(u&&etj(a.current,{transition:`opacity 0.5s cubic-bezier(${etN.join(",")})`}),!c&&r>2&&!f)return void(o?t():y(v[0]));if(!c&&r>2&&f&&v&&n)return void y(v[n.length-1]);let h=null==v?void 0:v.reduce((e,t)=>"number"!=typeof e||"number"!=typeof t?e:Math.abs(t-s)<Math.abs(e-s)?t:e),g=etk(l)?window.innerHeight:window.innerWidth;if(r>.4&&Math.abs(e)<.4*g){let e=f?1:-1;return e>0&&p&&n?void y(v[n.length-1]):void(d&&e<0&&o&&t(),null===m||y(v[m+e]))}y(h)},onDrag:function({draggedDistance:e}){if(null===x)return;let t="bottom"===l||"right"===l?x-e:x+e;("bottom"===l||"right"===l)&&t<v[v.length-1]||("top"===l||"left"===l)&&t>v[v.length-1]||etj(r.current,{transform:etk(l)?`translate3d(0, ${t}px, 0)`:`translate3d(${t}px, 0, 0)`})},snapPointsOffset:v}}({snapPoints:i,activeSnapPointProp:p,setActiveSnapPointProp:m,drawerRef:Z,fadeFromIndex:h,overlayRef:F,onSnapPointChange:et,direction:w,container:E,snapToSequentialPoint:S});!function(e={}){let{isDisabled:t}=e;etu(()=>{if(!t){var e,n,r;let t,a,i,l,s,c,u;return 1==++etg&&ets()&&(i=0,l=window.pageXOffset,s=window.pageYOffset,c=etd((e=document.documentElement,n="paddingRight",r=`${window.innerWidth-document.documentElement.clientWidth}px`,t=e.style[n],e.style[n]=r,()=>{e.style[n]=t})),window.scrollTo(0,0),u=etd(etv(document,"touchstart",e=>{((a=etp(e.target))!==document.documentElement||a!==document.body)&&(i=e.changedTouches[0].pageY)},{passive:!1,capture:!0}),etv(document,"touchmove",e=>{if(!a||a===document.documentElement||a===document.body)return void e.preventDefault();let t=e.changedTouches[0].pageY,n=a.scrollTop,r=a.scrollHeight-a.clientHeight;0!==r&&((n<=0&&t>i||n>=r&&t<i)&&e.preventDefault(),i=t)},{passive:!1,capture:!0}),etv(document,"touchend",e=>{let t=e.target;ety(t)&&t!==document.activeElement&&(e.preventDefault(),t.style.transform="translateY(-2000px)",t.focus(),requestAnimationFrame(()=>{t.style.transform=""}))},{passive:!1,capture:!0}),etv(document,"focus",e=>{let t=e.target;ety(t)&&(t.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{t.style.transform="",etf&&(etf.height<window.innerHeight?requestAnimationFrame(()=>{etx(t)}):etf.addEventListener("resize",()=>etx(t),{once:!0}))}))},!0),etv(window,"scroll",()=>{window.scrollTo(0,0)})),o=()=>{c(),u(),window.scrollTo(l,s)}),()=>{0==--etg&&(null==o||o())}}},[t])}({isDisabled:!I||R||!v||L||!_||!N||!k});let{restorePositionSetting:eu}=function({isOpen:e,modal:t,nested:n,hasBeenOpened:r,preventScrollRestoration:a,noBodyStyles:i}){let[o,l]=ew.default.useState(()=>"u">typeof window?window.location.href:""),s=ew.default.useRef(0),c=ew.default.useCallback(()=>{if(etl()&&null===etA&&e&&!i){etA={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};let{scrollX:e,innerHeight:t}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-s.current}px`,left:`${-e}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{let e=t-window.innerHeight;e&&s.current>=t&&(document.body.style.top=`${-(s.current+e)}px`)}),300)}},[e]),u=ew.default.useCallback(()=>{if(etl()&&null!==etA&&!i){let e=-parseInt(document.body.style.top,10),t=-parseInt(document.body.style.left,10);Object.assign(document.body.style,etA),window.requestAnimationFrame(()=>{a&&o!==window.location.href?l(window.location.href):window.scrollTo(t,e)}),etA=null}},[o]);return ew.default.useEffect(()=>{function e(){s.current=window.scrollY}return e(),window.addEventListener("scroll",e),()=>{window.removeEventListener("scroll",e)}},[]),ew.default.useEffect(()=>{if(t)return()=>{"u"<typeof document||document.querySelector("[data-vaul-drawer]")||u()}},[t,u]),ew.default.useEffect(()=>{!n&&r&&(e?(window.matchMedia("(display-mode: standalone)").matches||c(),t||window.setTimeout(()=>{u()},500)):u())},[e,r,o,t,n,c,u]),{restorePositionSetting:u}}({isOpen:I,modal:v,nested:null!=y&&y,hasBeenOpened:_,preventScrollRestoration:C,noBodyStyles:b});function ed(){return(window.innerWidth-26)/window.innerWidth}function ef(e,t){var n;let r=e,a=null==(n=window.getSelection())?void 0:n.toString(),i=Z.current?etS(Z.current,w):null,o=new Date;if("SELECT"===r.tagName||r.hasAttribute("data-vaul-no-drag")||r.closest("[data-vaul-no-drag]"))return!1;if("right"===w||"left"===w)return!0;if(B.current&&o.getTime()-B.current.getTime()<500)return!1;if(null!==i&&("bottom"===w?i>0:i<0))return!0;if(a&&a.length>0)return!1;if(W.current&&o.getTime()-W.current.getTime()<u&&0===i||t)return W.current=o,!1;for(;r;){if(r.scrollHeight>r.clientHeight){if(0!==r.scrollTop)return W.current=new Date,!1;if("dialog"===r.getAttribute("role"))break}r=r.parentNode}return!0}function eh(e){R&&Z.current&&(Z.current.classList.remove(etM),U.current=!1,T(!1),H.current=new Date),null==x||x(),e||z(!1),setTimeout(()=>{i&&ea(i[0])},500)}function ep(){if(!Z.current)return;let e=document.querySelector("[data-vaul-drawer-wrapper]"),t=etS(Z.current,w);etj(Z.current,{transform:"translate3d(0, 0, 0)",transition:`transform 0.5s cubic-bezier(${etN.join(",")})`}),etj(F.current,{transition:`opacity 0.5s cubic-bezier(${etN.join(",")})`,opacity:"1"}),l&&t&&t>0&&I&&etj(e,{borderRadius:"8px",overflow:"hidden",...etk(w)?{transform:`scale(${ed()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${ed()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:"0.5s",transitionTimingFunction:`cubic-bezier(${etN.join(",")})`},!0)}return ew.default.useEffect(()=>{window.requestAnimationFrame(()=>{X.current=!0})},[]),ew.default.useEffect(()=>{var e;function t(){if(Z.current&&N&&(ety(document.activeElement)||G.current)){var e;let t=(null==(e=window.visualViewport)?void 0:e.height)||0,n=window.innerHeight,r=n-t,a=Z.current.getBoundingClientRect().height||0;ee.current||(ee.current=a);let o=Z.current.getBoundingClientRect().top;if(Math.abs(Y.current-r)>60&&(G.current=!G.current),i&&i.length>0&&eo&&er&&(r+=eo[er]||0),Y.current=r,a>t||G.current){let e=Z.current.getBoundingClientRect().height,i=e;e>t&&(i=t-(a>.8*n?o:26)),g?Z.current.style.height=`${e-Math.max(r,0)}px`:Z.current.style.height=`${Math.max(i,t-o)}px`}else{let e;e=navigator.userAgent,"u">typeof window&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))||(Z.current.style.height=`${ee.current}px`)}i&&i.length>0&&!G.current?Z.current.style.bottom="0px":Z.current.style.bottom=`${Math.max(r,0)}px`}}return null==(e=window.visualViewport)||e.addEventListener("resize",t),()=>{var e;return null==(e=window.visualViewport)?void 0:e.removeEventListener("resize",t)}},[er,i,eo]),ew.default.useEffect(()=>(I&&(etj(document.documentElement,{scrollBehavior:"auto"}),B.current=new Date),()=>{!function(e,t){if(!e||!(e instanceof HTMLElement))return;let n=etw.get(e);n&&(e.style[t]=n[t])}(document.documentElement,"scrollBehavior")}),[I]),ew.default.useEffect(()=>{v||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[v]),ew.default.createElement(uo,{defaultOpen:j,onOpenChange:e=>{(d||e)&&(e?D(!0):eh(!0),z(e))},open:I},ew.default.createElement(eti.Provider,{value:{activeSnapPoint:en,snapPoints:i,setActiveSnapPoint:ea,drawerRef:Z,overlayRef:F,onOpenChange:t,onPress:function(e){var t,n;!d&&!i||(!Z.current||Z.current.contains(e.target))&&(J.current=(null==(t=Z.current)?void 0:t.getBoundingClientRect().height)||0,Q.current=(null==(n=Z.current)?void 0:n.getBoundingClientRect().width)||0,T(!0),V.current=new Date,ets()&&window.addEventListener("touchend",()=>U.current=!1,{once:!0}),e.target.setPointerCapture(e.pointerId),K.current=etk(w)?e.pageY:e.pageX)},onRelease:function(e){var t,n;if(!R||!Z.current)return;Z.current.classList.remove(etM),U.current=!1,T(!1),H.current=new Date;let r=etS(Z.current,w);if(!e||!ef(e.target,!1)||!r||Number.isNaN(r)||null===V.current)return;let o=H.current.getTime()-V.current.getTime(),l=K.current-(etk(w)?e.pageY:e.pageX),s=Math.abs(l)/o;if(s>.05&&($(!0),setTimeout(()=>{$(!1)},200)),i){ei({draggedDistance:l*("bottom"===w||"right"===w?1:-1),closeDrawer:eh,velocity:s,dismissible:d}),null==a||a(e,!0);return}if("bottom"===w||"right"===w?l>0:l<0){ep(),null==a||a(e,!0);return}if(s>.4){eh(),null==a||a(e,!1);return}let u=Math.min(null!=(t=Z.current.getBoundingClientRect().height)?t:0,window.innerHeight),f=Math.min(null!=(n=Z.current.getBoundingClientRect().width)?n:0,window.innerWidth);if(Math.abs(r)>=("left"===w||"right"===w?f:u)*c){eh(),null==a||a(e,!1);return}null==a||a(e,!0),ep()},onDrag:function(e){if(Z.current&&R){let t="bottom"===w||"right"===w?1:-1,n=(K.current-(etk(w)?e.pageY:e.pageX))*t,a=n>0,o=i&&!d&&!a;if(o&&0===er)return;let s=Math.abs(n),c=document.querySelector("[data-vaul-drawer-wrapper]"),u=s/("bottom"===w||"top"===w?J.current:Q.current),f=ec(s,a);if(null!==f&&(u=f),o&&u>=1||!U.current&&!ef(e.target,a))return;if(Z.current.classList.add(etM),U.current=!0,etj(Z.current,{transition:"none"}),etj(F.current,{transition:"none"}),i&&el({draggedDistance:n}),a&&!i){let e=Math.min(-(8*(Math.log(n+1)-2)*1),0)*t;etj(Z.current,{transform:etk(w)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`});return}let p=1-u;if((es||h&&er===h-1)&&(null==r||r(e,u),etj(F.current,{opacity:`${p}`,transition:"none"},!0)),c&&F.current&&l){let e=Math.min(ed()+u*(1-ed()),1),t=8-8*u,n=Math.max(0,14-14*u);etj(c,{borderRadius:`${t}px`,transform:etk(w)?`scale(${e}) translate3d(0, ${n}px, 0)`:`scale(${e}) translate3d(${n}px, 0, 0)`,transition:"none"},!0)}if(!i){let e=s*t;etj(Z.current,{transform:etk(w)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})}}},dismissible:d,shouldAnimate:X,handleOnly:f,isOpen:I,isDragging:R,shouldFade:es,closeDrawer:eh,onNestedDrag:function(e,t){if(t<0)return;let n=(window.innerWidth-16)/window.innerWidth,r=n+t*(1-n),a=-16+16*t;etj(Z.current,{transform:etk(w)?`scale(${r}) translate3d(0, ${a}px, 0)`:`scale(${r}) translate3d(${a}px, 0, 0)`,transition:"none"})},onNestedOpenChange:function(e){let t=e?(window.innerWidth-16)/window.innerWidth:1,n=e?-16:0;q.current&&window.clearTimeout(q.current),etj(Z.current,{transition:`transform 0.5s cubic-bezier(${etN.join(",")})`,transform:etk(w)?`scale(${t}) translate3d(0, ${n}px, 0)`:`scale(${t}) translate3d(${n}px, 0, 0)`}),!e&&Z.current&&(q.current=setTimeout(()=>{let e=etS(Z.current,w);etj(Z.current,{transition:"none",transform:etk(w)?`translate3d(0, ${e}px, 0)`:`translate3d(${e}px, 0, 0)`})},500))},onNestedRelease:function(e,t){let n=etk(w)?window.innerHeight:window.innerWidth,r=t?(n-16)/n:1,a=t?-16:0;t&&etj(Z.current,{transition:`transform 0.5s cubic-bezier(${etN.join(",")})`,transform:etk(w)?`scale(${r}) translate3d(0, ${a}px, 0)`:`scale(${r}) translate3d(${a}px, 0, 0)`})},keyboardIsOpen:G,modal:v,snapPointsOffset:eo,activeSnapPointIndex:er,direction:w,shouldScaleBackground:l,setBackgroundColorOnScale:s,noBodyStyles:b,container:E,autoFocus:O}},n))},etD=function(e){let t=eto(),{container:n=t.container,...r}=e;return ew.default.createElement(uf,{container:n,...r})};function etR({className:e,...t}){return(0,ey.jsx)(etI,{"data-slot":"drawer-overlay",className:(0,eI.cn)("vtl-overlay fixed inset-0 z-50 animate-in fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0",e),...t})}function etT({className:e,children:t,...n}){return(0,ey.jsxs)(etD,{"data-slot":"drawer-portal",children:[(0,ey.jsx)(etR,{}),(0,ey.jsxs)(etz,{"data-slot":"drawer-content",className:(0,eI.cn)("vtl-surface-modal group/drawer-content fixed z-50 flex h-auto flex-col border outline-none","data-[vaul-drawer-direction=top]:inset-x-0 data-[vaul-drawer-direction=top]:top-0 data-[vaul-drawer-direction=top]:mb-24 data-[vaul-drawer-direction=top]:max-h-[80vh] data-[vaul-drawer-direction=top]:rounded-b-xl data-[vaul-drawer-direction=top]:border-t-0","data-[vaul-drawer-direction=bottom]:inset-x-0 data-[vaul-drawer-direction=bottom]:bottom-0 data-[vaul-drawer-direction=bottom]:mt-24 data-[vaul-drawer-direction=bottom]:max-h-[80vh] data-[vaul-drawer-direction=bottom]:rounded-t-xl data-[vaul-drawer-direction=bottom]:border-b-0","data-[vaul-drawer-direction=right]:inset-y-0 data-[vaul-drawer-direction=right]:right-0 data-[vaul-drawer-direction=right]:w-3/4 data-[vaul-drawer-direction=right]:border-r-0 data-[vaul-drawer-direction=right]:sm:max-w-sm","data-[vaul-drawer-direction=left]:inset-y-0 data-[vaul-drawer-direction=left]:left-0 data-[vaul-drawer-direction=left]:w-3/4 data-[vaul-drawer-direction=left]:border-l-0 data-[vaul-drawer-direction=left]:sm:max-w-sm",e),...n,children:[(0,ey.jsx)("div",{className:"mx-auto mt-3 hidden h-1.5 w-16 shrink-0 rounded-full bg-muted group-data-[vaul-drawer-direction=bottom]/drawer-content:block"}),t]})]})}function etL({className:e,...t}){return(0,ey.jsx)(uk,{"data-slot":"drawer-title",className:(0,eI.cn)("text-base leading-none font-semibold text-foreground",e),...t})}function et$({navItems:e,contents:t,activeWorkspace:n,activeConversationId:r,onItemSelect:a,onOpenConversation:i,onOpenConversationSettings:o,onConversationDeleted:l,onAccountSettings:s,subagentTree:c,activeSubagentPath:u,onOpenSubagent:d,title:f,trailing:h}){let[p,m]=ew.useState(!1),g=ew.useCallback(()=>m(!1),[]),v=ew.useCallback(e=>{g(),a(e)},[g,a]),x=ew.useCallback((e,t)=>{g(),i(e,t)},[g,i]),y=ew.useCallback(e=>{g(),d?.(e)},[g,d]);return(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(etF,{onMenuClick:()=>m(!0),title:f,trailing:h}),(0,ey.jsx)(et_,{open:p,onOpenChange:m,direction:"left",children:(0,ey.jsxs)(etT,{className:"w-[85vw] max-w-xs",children:[(0,ey.jsx)(etL,{className:"sr-only",children:"导航"}),(0,ey.jsx)(eeq,{hideCanvas:!0,navItems:e,contents:t,activeWorkspace:n,activeConversationId:r,onItemSelect:v,onOpenConversation:x,onOpenCanvas:()=>{},onOpenConversationSettings:(e,t)=>{g(),o?.(e,t)},onConversationDeleted:l,onAccountSettings:()=>{g(),s?.()},subagentTree:c,activeSubagentPath:u,onOpenSubagent:y,className:"h-full w-full rounded-none border-0 p-3 pt-[max(0.75rem,env(safe-area-inset-top))] shadow-none"})]})})]})}function etF({onMenuClick:e,title:t,trailing:n,className:r}){return(0,ey.jsxs)("header",{className:(0,eI.cn)("fixed inset-x-0 top-0 z-40 flex h-12 items-center gap-1 border-b border-border bg-sidebar/95 px-1.5 pt-[env(safe-area-inset-top)] backdrop-blur",r),style:{height:"calc(3rem + env(safe-area-inset-top))"},children:[(0,ey.jsx)("button",{type:"button","aria-label":"展开导航",onClick:e,className:"flex size-9 shrink-0 items-center justify-center rounded-lg text-foreground/80 transition-colors hover:bg-muted hover:text-foreground [&_svg]:size-5",children:(0,ey.jsx)(sW,{})}),t?(0,ey.jsx)("div",{className:"min-w-0 flex-1 truncate text-center text-sm font-medium text-foreground",children:t}):(0,ey.jsx)("div",{className:"min-w-0 flex-1"}),(0,ey.jsx)("div",{className:"flex shrink-0 items-center",children:n})]})}let etB=(0,ek.default)("message-square-text",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M7 11h10",key:"1twpyw"}],["path",{d:"M7 15h6",key:"d9of3u"}],["path",{d:"M7 7h8",key:"af5zfr"}]]),etV=[{id:"canvas",label:Z8.canvas,icon:(0,ey.jsx)(dt,{})},{id:"agent",label:"智能体",icon:(0,ey.jsx)(de,{})},{id:"settings",label:Z8.settings,icon:(0,ey.jsx)(Js,{})}],etH=[{id:"canvas",title:Z8.canvas,description:"节点画布工作区。",sections:[{id:"canvases",title:Z8.canvas,items:[{id:"open-recent-canvas",label:Z8.canvasRecent,icon:(0,ey.jsx)(dt,{})},{id:"new-canvas",label:Z8.canvasNew,icon:(0,ey.jsx)(lV,{})},{id:"all-canvases",label:Z8.canvasAll,icon:(0,ey.jsx)(da,{})}]}]},{id:"agent",title:"智能体",description:"Agent 对话工作区。",sections:[{id:"conversations",title:"Agent 对话",items:[{id:"open-recent-conversation",label:Z8.conversationRecent,icon:(0,ey.jsx)(etB,{})},{id:"new-agent-conversation",label:Z8.conversationNew,icon:(0,ey.jsx)(de,{})}]}]},{id:"settings",title:Z8.settings,description:"系统、工作组和用量配置。",sections:[{id:"settings",items:[{id:"preferences",label:"偏好设置",icon:(0,ey.jsx)(Js,{})},{id:"check-update",label:"检查更新",icon:(0,ey.jsx)(xS,{})}]},{id:"hub",title:"Hub",items:[{id:"account",label:"Hub 账户",icon:(0,ey.jsx)(eN,{})}]}]}],etW=(0,ek.default)("key-round",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]),etU=(0,ek.default)("unplug",[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]]),etq=(0,ek.default)("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]),etK=(0,ek.default)("wifi-off",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);function etG(){let{user:e,machine:t,logout:n,unbind:r,refreshUser:a}=e8(),[i,o]=ew.useState(!1),[l,s]=ew.useState(!1),[c,u]=ew.useState(t),[d,f]=ew.useState(!1),[h,p]=ew.useState(""),[m,g]=ew.useState(!1),[v,x]=ew.useState(null);async function y(){o(!0);try{await eJ("online");let e=eU();u(e),await a()}catch{}finally{o(!1)}}async function b(){let e=h.trim();if(!e)return void x("名称不能为空");g(!0),x(null);try{let t=await e0(e);u(e=>e?{...e,name:t}:e),f(!1)}catch(e){x(e instanceof Error?e.message:"重命名失败")}finally{g(!1)}}async function w(){s(!0);try{await r()}catch{s(!1)}}async function j(){await n()}return ew.useEffect(()=>{u(t)},[t]),e?(0,ey.jsx)("div",{className:"vtl-app-background h-full min-h-0 overflow-auto p-6 pb-14 text-foreground md:pb-6",children:(0,ey.jsx)("div",{className:"mx-auto w-full max-w-3xl",children:(0,ey.jsxs)("div",{className:"grid gap-6",children:[(0,ey.jsx)("div",{className:"flex items-center justify-between gap-3","data-tour":"hub-account",children:(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:"Vantaloom Hub 账户"}),(0,ey.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"管理你的 Hub 连接和设备绑定"})]})}),(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4",children:[(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"账户信息"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"你的 Vantaloom Hub 账户详情。"}),(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,ey.jsxs)("div",{className:"flex min-w-0 items-center gap-3",children:[(0,ey.jsx)("div",{className:"flex size-10 shrink-0 items-center justify-center rounded-full bg-primary/10",children:(0,ey.jsx)("span",{className:"text-base font-semibold text-primary",children:e.name.charAt(0).toUpperCase()})}),(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("p",{className:"truncate text-sm font-medium",children:e.name}),(0,ey.jsx)("p",{className:"truncate text-xs text-muted-foreground",children:e.email})]})]}),(0,ey.jsxs)(FC,{variant:"outline",className:"shrink-0",children:[(0,ey.jsx)(wY,{className:"mr-1 size-3"}),"已验证"]})]}),(0,ey.jsx)(Qb,{}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)("span",{className:"text-sm text-muted-foreground",children:"用户 ID"}),(0,ey.jsxs)("code",{className:"rounded bg-muted px-2 py-0.5 font-mono text-xs",children:[e.id.slice(0,8),"..."]})]}),(0,ey.jsx)(Qb,{}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)("span",{className:"text-sm text-muted-foreground",children:"注册时间"}),(0,ey.jsx)("span",{className:"text-sm",children:new Date(e.createdAt).toLocaleDateString("zh-CN")})]})]}),(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4",children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"设备绑定"}),(0,ey.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"此设备已自动注册到你的 Hub 账户。"})]}),c?(0,ey.jsxs)(eA.Button,{variant:"outline",size:"sm",className:"shrink-0",onClick:y,disabled:i,children:[i?(0,ey.jsx)(eM,{className:"animate-spin"}):(0,ey.jsx)(xS,{}),i?"刷新中...":"刷新状态"]}):null]}),c?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ey.jsxs)("div",{className:"min-w-0 flex-1",children:[d?(0,ey.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ey.jsx)(ez,{value:h,onChange:e=>p(e.target.value),maxLength:64,autoFocus:!0,placeholder:"机器名称",className:"h-8 text-sm",onKeyDown:e=>{"Enter"===e.key&&b(),"Escape"===e.key&&f(!1)}}),(0,ey.jsx)(eA.Button,{size:"icon-sm",variant:"ghost",className:"size-8 shrink-0",onClick:()=>void b(),disabled:m,"aria-label":"保存名称",children:m?(0,ey.jsx)(eM,{className:"animate-spin"}):(0,ey.jsx)(pk,{})}),(0,ey.jsx)(eA.Button,{size:"icon-sm",variant:"ghost",className:"size-8 shrink-0",onClick:()=>f(!1),disabled:m,"aria-label":"取消",children:(0,ey.jsx)(d3.XIcon,{})})]}):(0,ey.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,ey.jsx)("p",{className:"truncate text-sm font-medium",children:c.name}),(0,ey.jsx)("button",{type:"button",onClick:function(){p(c?.name??""),x(null),f(!0)},title:"重命名",className:"shrink-0 rounded p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:(0,ey.jsx)(Vj,{className:"size-3.5"})})]}),(0,ey.jsxs)("p",{className:"truncate text-xs text-muted-foreground",children:[c.platform," / ",c.arch]})]}),(0,ey.jsxs)(FC,{variant:"online"===c.status?"default":"secondary",className:"shrink-0 gap-1",children:["online"===c.status?(0,ey.jsx)(etq,{className:"size-3"}):(0,ey.jsx)(etK,{className:"size-3"}),"online"===c.status?"在线":"离线"]})]}),v?(0,ey.jsx)("p",{className:"text-xs text-destructive",children:v}):null,(0,ey.jsx)(Qb,{}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)("span",{className:"text-sm text-muted-foreground",children:"设备 ID"}),(0,ey.jsxs)("code",{className:"rounded bg-muted px-2 py-0.5 font-mono text-xs",children:[c.id.slice(0,8),"..."]})]}),(0,ey.jsx)(Qb,{}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)("span",{className:"text-sm text-muted-foreground",children:"连接方式"}),(0,ey.jsx)("span",{className:"text-sm",children:c.connectivity||"直连"})]}),(0,ey.jsx)(Qb,{}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)("span",{className:"text-sm text-muted-foreground",children:"本机 IP"}),(0,ey.jsx)("code",{className:"rounded bg-muted px-2 py-0.5 font-mono text-xs",children:c.localIp})]}),(0,ey.jsx)(Qb,{}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)("span",{className:"text-sm text-muted-foreground",children:"最后心跳"}),(0,ey.jsx)("span",{className:"text-sm",children:new Date(c.lastHeartbeat).toLocaleString("zh-CN")})]}),(0,ey.jsx)(Qb,{}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)("span",{className:"text-sm text-muted-foreground",children:"注册时间"}),(0,ey.jsx)("span",{className:"text-sm",children:new Date(c.createdAt).toLocaleString("zh-CN")})]})]}):(0,ey.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6 text-center",children:[(0,ey.jsx)(etK,{className:"size-8 text-muted-foreground/40"}),(0,ey.jsxs)("div",{children:[(0,ey.jsx)("p",{className:"text-sm font-medium",children:"设备未绑定"}),(0,ey.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"设备注册异常,请尝试重新登录"})]})]})]}),(0,ey.jsx)(etX,{}),(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4","data-tour":"hub-account-danger",children:[(0,ey.jsx)("h4",{className:"text-sm font-semibold text-destructive",children:"危险操作"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"以下操作不可逆,请谨慎执行。"}),(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("p",{className:"text-sm font-medium",children:"解除设备绑定"}),(0,ey.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"将此设备从你的 Hub 账户中移除,并退出登录。设备数据不会受到影响。"})]}),(0,ey.jsxs)(uL,{children:[(0,ey.jsx)(u$,{asChild:!0,children:(0,ey.jsxs)(eA.Button,{variant:"destructive",size:"sm",className:"shrink-0",children:[(0,ey.jsx)(etU,{}),"解除绑定"]})}),(0,ey.jsxs)(u2,{children:[(0,ey.jsxs)(u5,{children:[(0,ey.jsx)(u3,{children:"确认解除设备绑定?"}),(0,ey.jsx)(u6,{children:"此操作将从你的 Hub 账户中移除当前设备,并退出登录。你可以随时重新登录并绑定设备。"})]}),(0,ey.jsxs)(u4,{children:[(0,ey.jsx)(u7,{children:"取消"}),(0,ey.jsx)(u8,{onClick:w,disabled:l,className:"bg-destructive text-white hover:bg-destructive/90",children:l?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(eM,{className:"animate-spin"}),"处理中..."]}):"确认解除"})]})]})]})]}),(0,ey.jsx)(Qb,{}),(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("p",{className:"text-sm font-medium",children:"退出登录"}),(0,ey.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"退出当前 Hub 账户但保留设备在云端的注册。下次登录时无需重新绑定。"})]}),(0,ey.jsxs)(eA.Button,{variant:"outline",size:"sm",className:"shrink-0",onClick:j,children:[(0,ey.jsx)(eeM,{}),"退出登录"]})]})]})]})})}):null}function etX(){let[e,t]=ew.useState(""),[n,r]=ew.useState(""),[a,i]=ew.useState(""),[o,l]=ew.useState(!1),[s,c]=ew.useState(null);async function u(){if(c(null),n.length<8)return void c({kind:"err",text:"新密码至少 8 位"});if(n!==a)return void c({kind:"err",text:"两次输入的新密码不一致"});l(!0);try{await e1(e,n),c({kind:"ok",text:"密码已更新"}),t(""),r(""),i("")}catch(e){c({kind:"err",text:e instanceof Error?e.message:"修改失败,请重试"})}finally{l(!1)}}return(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4",children:[(0,ey.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ey.jsx)(etW,{className:"size-4 text-muted-foreground"}),(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"修改密码"})]}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"更改你的 Vantaloom Hub 登录密码。"}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(ez,{type:"password",placeholder:"当前密码",autoComplete:"current-password",value:e,onChange:e=>t(e.target.value)}),(0,ey.jsx)(ez,{type:"password",placeholder:"新密码(至少 8 位)",autoComplete:"new-password",value:n,onChange:e=>r(e.target.value)}),(0,ey.jsx)(ez,{type:"password",placeholder:"确认新密码",autoComplete:"new-password",value:a,onChange:e=>i(e.target.value)})]}),s?(0,ey.jsx)("p",{className:"ok"===s.kind?"text-xs text-primary":"text-xs text-destructive",children:s.text}):null,(0,ey.jsx)("div",{className:"flex justify-end",children:(0,ey.jsx)(eA.Button,{size:"sm",onClick:u,disabled:o||!e||!n,children:o?(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)(eM,{className:"animate-spin"}),"保存中..."]}):"更新密码"})})]})}let etY=(0,lq.cva)("vtl-surface-card relative w-full rounded-[var(--surface-card-radius)] border px-4 py-3 text-sm [&>svg]:absolute [&>svg]:top-3.5 [&>svg]:left-4 [&>svg~*]:pl-7",{variants:{variant:{default:"border-border",muted:"border-border bg-muted/40",destructive:"border-destructive/35 bg-destructive/10 text-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}});function etZ({className:e,variant:t,...n}){return(0,ey.jsx)("div",{role:"alert","data-slot":"alert",className:(0,eI.cn)(etY({variant:t}),e),...n})}function etJ({className:e,...t}){return(0,ey.jsx)("div",{"data-slot":"alert-title",className:(0,eI.cn)("mb-1 leading-none font-medium",e),...t})}function etQ({className:e,...t}){return(0,ey.jsx)("div",{"data-slot":"alert-description",className:(0,eI.cn)("text-muted-foreground [&_p]:leading-relaxed",e),...t})}var et0=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,t)=>{let n=(0,lU.createSlot)(`Primitive.${t}`),r=ew.forwardRef((e,r)=>{let{asChild:a,...i}=e;return"u">typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,ey.jsx)(a?n:t,{...i,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),et1=ew.forwardRef((e,t)=>(0,ey.jsx)(et0.label,{...e,ref:t,onMouseDown:t=>{t.target.closest("button, input, select, textarea")||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));function et2({className:e,...t}){return(0,ey.jsx)(et1,{"data-slot":"label",className:(0,eI.cn)("flex w-fit items-center gap-2 text-sm font-medium leading-snug peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]/field:opacity-50",e),...t})}et1.displayName="Label";var et5=["PageUp","PageDown"],et4=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],et3={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},et6="Slider",[et8,et7,et9]=hC(et6),[ene,ent]=sG(et6,[et9]),[enn,enr]=ene(et6),ena=ew.forwardRef((e,t)=>{let{name:n,min:r=0,max:a=100,step:i=1,orientation:o="horizontal",disabled:l=!1,minStepsBetweenThumbs:s=0,defaultValue:c=[r],value:u,onValueChange:d=()=>{},onValueCommit:f=()=>{},inverted:h=!1,form:p,...m}=e,g=ew.useRef(new Set),v=ew.useRef(0),x="horizontal"===o,[y=[],b]=s2({prop:u,defaultProp:c,onChange:e=>{let t=[...g.current];t[v.current]?.focus(),d(e)}}),w=ew.useRef(y);function j(e,t,{commit:n}={commit:!1}){let o,l=(String(i).split(".")[1]||"").length,c=pE(Math.round((Math.round((e-r)/i)*i+r)*(o=Math.pow(10,l)))/o,[r,a]);b((e=[])=>{let r=function(e=[],t,n){let r=[...e];return r[n]=t,r.sort((e,t)=>e-t)}(e,c,t);if(!function(e,t){if(t>0)return Math.min(...e.slice(0,-1).map((t,n)=>e[n+1]-t))>=t;return!0}(r,s*i))return e;{v.current=r.indexOf(c);let t=String(r)!==String(e);return t&&n&&f(r),t?r:e}})}return(0,ey.jsx)(enn,{scope:e.__scopeSlider,name:n,disabled:l,min:r,max:a,valueIndexToChangeRef:v,thumbs:g.current,values:y,orientation:o,form:p,children:(0,ey.jsx)(et8.Provider,{scope:e.__scopeSlider,children:(0,ey.jsx)(et8.Slot,{scope:e.__scopeSlider,children:(0,ey.jsx)(x?enl:ens,{"aria-disabled":l,"data-disabled":l?"":void 0,...m,ref:t,onPointerDown:sY(m.onPointerDown,()=>{l||(w.current=y)}),min:r,max:a,inverted:h,onSlideStart:l?void 0:function(e){let t=function(e,t){if(1===e.length)return 0;let n=e.map(e=>Math.abs(e-t)),r=Math.min(...n);return n.indexOf(r)}(y,e);j(e,t)},onSlideMove:l?void 0:function(e){j(e,v.current)},onSlideEnd:l?void 0:function(){let e=w.current[v.current];y[v.current]!==e&&f(y)},onHomeKeyDown:()=>!l&&j(r,0,{commit:!0}),onEndKeyDown:()=>!l&&j(a,y.length-1,{commit:!0}),onStepKeyDown:({event:e,direction:t})=>{if(!l){let n=et5.includes(e.key)||e.shiftKey&&et4.includes(e.key),r=v.current;j(y[r]+i*(n?10:1)*t,r,{commit:!0})}}})})})})});ena.displayName=et6;var[eni,eno]=ene(et6,{startEdge:"left",endEdge:"right",size:"width",direction:1}),enl=ew.forwardRef((e,t)=>{let{min:n,max:r,dir:a,inverted:i,onSlideStart:o,onSlideMove:l,onSlideEnd:s,onStepKeyDown:c,...u}=e,[d,f]=ew.useState(null),h=(0,sX.useComposedRefs)(t,e=>f(e)),p=ew.useRef(void 0),m=hP(a),g="ltr"===m,v=g&&!i||!g&&i;function x(e){let t=p.current||d.getBoundingClientRect(),a=eny([0,t.width],v?[n,r]:[r,n]);return p.current=t,a(e-t.left)}return(0,ey.jsx)(eni,{scope:e.__scopeSlider,startEdge:v?"left":"right",endEdge:v?"right":"left",direction:v?1:-1,size:"width",children:(0,ey.jsx)(enc,{dir:m,"data-orientation":"horizontal",...u,ref:h,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:e=>{let t=x(e.clientX);o?.(t)},onSlideMove:e=>{let t=x(e.clientX);l?.(t)},onSlideEnd:()=>{p.current=void 0,s?.()},onStepKeyDown:e=>{let t=et3[v?"from-left":"from-right"].includes(e.key);c?.({event:e,direction:t?-1:1})}})})}),ens=ew.forwardRef((e,t)=>{let{min:n,max:r,inverted:a,onSlideStart:i,onSlideMove:o,onSlideEnd:l,onStepKeyDown:s,...c}=e,u=ew.useRef(null),d=(0,sX.useComposedRefs)(t,u),f=ew.useRef(void 0),h=!a;function p(e){let t=f.current||u.current.getBoundingClientRect(),a=eny([0,t.height],h?[r,n]:[n,r]);return f.current=t,a(e-t.top)}return(0,ey.jsx)(eni,{scope:e.__scopeSlider,startEdge:h?"bottom":"top",endEdge:h?"top":"bottom",size:"height",direction:h?1:-1,children:(0,ey.jsx)(enc,{"data-orientation":"vertical",...c,ref:d,style:{...c.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:e=>{let t=p(e.clientY);i?.(t)},onSlideMove:e=>{let t=p(e.clientY);o?.(t)},onSlideEnd:()=>{f.current=void 0,l?.()},onStepKeyDown:e=>{let t=et3[h?"from-bottom":"from-top"].includes(e.key);s?.({event:e,direction:t?-1:1})}})})}),enc=ew.forwardRef((e,t)=>{let{__scopeSlider:n,onSlideStart:r,onSlideMove:a,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:l,onStepKeyDown:s,...c}=e,u=enr(et6,n);return(0,ey.jsx)(s6.span,{...c,ref:t,onKeyDown:sY(e.onKeyDown,e=>{"Home"===e.key?(o(e),e.preventDefault()):"End"===e.key?(l(e),e.preventDefault()):et5.concat(et4).includes(e.key)&&(s(e),e.preventDefault())}),onPointerDown:sY(e.onPointerDown,e=>{let t=e.target;t.setPointerCapture(e.pointerId),e.preventDefault(),u.thumbs.has(t)?t.focus():r(e)}),onPointerMove:sY(e.onPointerMove,e=>{e.target.hasPointerCapture(e.pointerId)&&a(e)}),onPointerUp:sY(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&(t.releasePointerCapture(e.pointerId),i(e))})})}),enu="SliderTrack",end=ew.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,a=enr(enu,n);return(0,ey.jsx)(s6.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...r,ref:t})});end.displayName=enu;var enf="SliderRange",enh=ew.forwardRef((e,t)=>{let{__scopeSlider:n,...r}=e,a=enr(enf,n),i=eno(enf,n),o=ew.useRef(null),l=(0,sX.useComposedRefs)(t,o),s=a.values.length,c=a.values.map(e=>enx(e,a.min,a.max)),u=s>1?Math.min(...c):0,d=100-Math.max(...c);return(0,ey.jsx)(s6.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...r,ref:l,style:{...e.style,[i.startEdge]:u+"%",[i.endEdge]:d+"%"}})});enh.displayName=enf;var enp="SliderThumb",enm=ew.forwardRef((e,t)=>{let n=et7(e.__scopeSlider),[r,a]=ew.useState(null),i=(0,sX.useComposedRefs)(t,e=>a(e)),o=ew.useMemo(()=>r?n().findIndex(e=>e.ref.current===r):-1,[n,r]);return(0,ey.jsx)(eng,{...e,ref:i,index:o})}),eng=ew.forwardRef((e,t)=>{var n,r,a,i,o;let l,s,{__scopeSlider:c,index:u,name:d,...f}=e,h=enr(enp,c),p=eno(enp,c),[m,g]=ew.useState(null),v=(0,sX.useComposedRefs)(t,e=>g(e)),x=!m||h.form||!!m.closest("form"),y=mR(m),b=h.values[u],w=void 0===b?0:enx(b,h.min,h.max),j=(n=u,(r=h.values.length)>2?`Value ${n+1} of ${r}`:2===r?["Minimum","Maximum"][n]:void 0),k=y?.[p.size],S=k?(a=k,i=w,o=p.direction,s=eny([0,50],[0,l=a/2]),(l-s(i)*o)*o):0;return ew.useEffect(()=>{if(m)return h.thumbs.add(m),()=>{h.thumbs.delete(m)}},[m,h.thumbs]),(0,ey.jsxs)("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[p.startEdge]:`calc(${w}% + ${S}px)`},children:[(0,ey.jsx)(et8.ItemSlot,{scope:e.__scopeSlider,children:(0,ey.jsx)(s6.span,{role:"slider","aria-label":e["aria-label"]||j,"aria-valuemin":h.min,"aria-valuenow":b,"aria-valuemax":h.max,"aria-orientation":h.orientation,"data-orientation":h.orientation,"data-disabled":h.disabled?"":void 0,tabIndex:h.disabled?void 0:0,...f,ref:v,style:void 0===b?{display:"none"}:e.style,onFocus:sY(e.onFocus,()=>{h.valueIndexToChangeRef.current=u})})}),x&&(0,ey.jsx)(env,{name:d??(h.name?h.name+(h.values.length>1?"[]":""):void 0),form:h.form,value:b},u)]})});enm.displayName=enp;var env=ew.forwardRef(({__scopeSlider:e,value:t,...n},r)=>{let a=ew.useRef(null),i=(0,sX.useComposedRefs)(a,r),o=m1(t);return ew.useEffect(()=>{let e=a.current;if(!e)return;let n=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value").set;if(o!==t&&n){let r=new Event("input",{bubbles:!0});n.call(e,t),e.dispatchEvent(r)}},[o,t]),(0,ey.jsx)(s6.input,{style:{display:"none"},...n,ref:i,defaultValue:t})});function enx(e,t,n){return pE(100/(n-t)*(e-t),[0,100])}function eny(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function enb(e){return Array.isArray(e)?e:"number"==typeof e?[e]:void 0}function enw({className:e,defaultValue:t,value:n,min:r=0,max:a=100,...i}){let o=ew.useMemo(()=>enb(n)??enb(t)??[r,a],[t,a,r,n]);return(0,ey.jsxs)(ena,{"data-slot":"slider",defaultValue:enb(t),value:enb(n),min:r,max:a,className:(0,eI.cn)("relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-40 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",e),...i,children:[(0,ey.jsx)(end,{"data-slot":"slider-track",className:"relative grow overflow-hidden rounded-full bg-muted data-[orientation=horizontal]:h-1 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1",children:(0,ey.jsx)(enh,{"data-slot":"slider-range",className:"absolute bg-primary data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"})}),o.map((e,t)=>(0,ey.jsx)(enm,{"data-slot":"slider-thumb",className:"relative block size-3 shrink-0 rounded-full border border-ring bg-white shadow-sm transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 hover:ring-ring/50 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-hidden active:ring-3 active:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 dark:bg-primary-foreground"},t))]})}function enj(e){return{compression:{...e.compression},summary:{...e.summary},approval:{...e.approval}}}function enk(){let[e,t]=ew.useState(null),[n,r]=ew.useState([]),[a,i]=ew.useState(!0),[o,l]=ew.useState(!1),[s,c]=ew.useState(""),[u,d]=ew.useState(!1);function f(e,n){t(t=>t?{...t,[e]:{...t[e],...n}}:t),d(!0)}async function h(){if(e&&!o){l(!0),c("");try{let n=await wN({compression:e.compression,summary:e.summary,approval:e.approval});t(enj(n)),d(!1)}catch(e){c(e instanceof Error?e.message:"Save failed")}finally{l(!1)}}}return(ew.useEffect(()=>{!async function(){try{let[e,n]=await Promise.all([wC(),v9()]);t(enj(e)),r(n.models)}catch(e){c(e instanceof Error?e.message:"Failed to load config")}finally{i(!1)}}()},[]),a)?(0,ey.jsx)("div",{className:"rounded-lg border border-dashed px-3 py-6 text-sm text-muted-foreground",children:"正在读取代理配置"}):e?(0,ey.jsxs)("div",{className:"grid gap-6",children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,ey.jsx)("div",{className:"min-w-0",children:(0,ey.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:"代理配置"})}),u&&(0,ey.jsxs)(eA.Button,{type:"button",size:"sm",onClick:()=>void h(),disabled:o,children:[(0,ey.jsx)(Kh,{className:"size-4"}),o?"保存中":"保存"]})]}),s?(0,ey.jsxs)(etZ,{variant:"destructive",children:[(0,ey.jsx)(eE,{}),(0,ey.jsx)(etJ,{children:"错误"}),(0,ey.jsx)(etQ,{children:s})]}):null,(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4","data-tour":"agent-config-compression",children:[(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"压缩上下文"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"当对话 token 达到模型上下文窗口的指定百分比时自动压缩。"}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)(et2,{className:"text-sm",children:"自动压缩阈值"}),(0,ey.jsxs)("span",{className:"text-sm tabular-nums text-muted-foreground",children:[e.compression.autoThresholdPercent,"%"]})]}),(0,ey.jsx)(enw,{value:[e.compression.autoThresholdPercent],onValueChange:([e])=>f("compression",{autoThresholdPercent:e}),min:0,max:100,step:5}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"0% 表示禁用自动压缩。建议设为 70%-85%。"})]}),(0,ey.jsx)(Qb,{}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et2,{className:"text-sm",children:"压缩模型"}),(0,ey.jsx)(enS,{models:n,value:e.compression.modelRef,onValueChange:e=>f("compression",{modelRef:e}),placeholder:"使用主模型"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"用于执行上下文压缩的模型。留空则使用当前对话主模型。"})]})]}),(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4","data-tour":"agent-config-summary",children:[(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"对话摘要"}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsxs)("div",{className:"min-w-0 space-y-0.5",children:[(0,ey.jsx)(et2,{className:"text-sm",children:"对话标题摘要"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"每轮对话结束后自动更新对话标题。"})]}),(0,ey.jsx)(xo,{checked:e.summary.enableTitleSummary,onCheckedChange:e=>f("summary",{enableTitleSummary:e})})]}),(0,ey.jsx)(Qb,{}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsxs)("div",{className:"min-w-0 space-y-0.5",children:[(0,ey.jsx)(et2,{className:"text-sm",children:"轮次标题摘要"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"为每轮 agent 操作生成摘要标题。"})]}),(0,ey.jsx)(xo,{checked:e.summary.enableRoundSummary,onCheckedChange:e=>f("summary",{enableRoundSummary:e})})]}),(0,ey.jsx)(Qb,{}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et2,{className:"text-sm",children:"摘要模型"}),(0,ey.jsx)(enS,{models:n,value:e.summary.modelRef,onValueChange:e=>f("summary",{modelRef:e}),placeholder:"使用主模型"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"用于生成对话摘要的模型。留空则使用当前对话主模型。"})]})]}),(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4","data-tour":"agent-config-approval",children:[(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"命令审批"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"在 Auto 权限模式下,使用 AI 模型审批 Agent 发起的命令是否可以自动执行。"}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et2,{className:"text-sm",children:"审批模型"}),(0,ey.jsx)(enS,{models:n,value:e.approval.modelRef,onValueChange:e=>f("approval",{modelRef:e}),placeholder:"未配置(全部放行)"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"留空表示 Auto 模式下不进行 AI 审批,所有非危险命令自动放行。"})]}),(0,ey.jsx)(Qb,{}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et2,{className:"text-sm",children:"审批提示词"}),(0,ey.jsx)(bm,{value:e.approval.prompt,onChange:e=>f("approval",{prompt:e.currentTarget.value}),placeholder:"可选:给审批模型的额外指导,例如允许哪些操作、拒绝哪些操作",rows:4,className:"resize-none text-sm"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"与系统提示词一起发送给审批模型,帮助它判断命令是否安全。"})]})]})]}):(0,ey.jsxs)(etZ,{variant:"destructive",children:[(0,ey.jsx)(eE,{}),(0,ey.jsx)(etJ,{children:"读取失败"}),(0,ey.jsx)(etQ,{children:s||"无法加载代理配置"})]})}function enS({models:e,value:t,onValueChange:n,placeholder:r}){return(0,ey.jsxs)(go,{value:t||"__none__",onValueChange:e=>n("__none__"===e?"":e),children:[(0,ey.jsx)(gX,{className:"w-full",children:(0,ey.jsx)(gu,{placeholder:r})}),(0,ey.jsxs)(gJ,{children:[(0,ey.jsx)(gQ,{value:"__none__",children:r}),e.map(e=>(0,ey.jsx)(gQ,{value:e.id,children:e.label},e.id))]})]})}env.displayName="RadioBubbleInput";let enC=(0,ek.default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);var enN="Accordion",enM=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[enE,enO,enP]=hC(enN),[enA,enI]=sG(enN,[enP,ee_]),enz=ee_(),en_=ew.default.forwardRef((e,t)=>{let{type:n,...r}=e;return(0,ey.jsx)(enE.Provider,{scope:e.__scopeAccordion,children:"multiple"===n?(0,ey.jsx)(enF,{...r,ref:t}):(0,ey.jsx)(en$,{...r,ref:t})})});en_.displayName=enN;var[enD,enR]=enA(enN),[enT,enL]=enA(enN,{collapsible:!1}),en$=ew.default.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:a=()=>{},collapsible:i=!1,...o}=e,[l,s]=s2({prop:n,defaultProp:r??"",onChange:a,caller:enN});return(0,ey.jsx)(enD,{scope:e.__scopeAccordion,value:ew.default.useMemo(()=>l?[l]:[],[l]),onItemOpen:s,onItemClose:ew.default.useCallback(()=>i&&s(""),[i,s]),children:(0,ey.jsx)(enT,{scope:e.__scopeAccordion,collapsible:i,children:(0,ey.jsx)(enH,{...o,ref:t})})})}),enF=ew.default.forwardRef((e,t)=>{let{value:n,defaultValue:r,onValueChange:a=()=>{},...i}=e,[o,l]=s2({prop:n,defaultProp:r??[],onChange:a,caller:enN}),s=ew.default.useCallback(e=>l((t=[])=>[...t,e]),[l]),c=ew.default.useCallback(e=>l((t=[])=>t.filter(t=>t!==e)),[l]);return(0,ey.jsx)(enD,{scope:e.__scopeAccordion,value:o,onItemOpen:s,onItemClose:c,children:(0,ey.jsx)(enT,{scope:e.__scopeAccordion,collapsible:!0,children:(0,ey.jsx)(enH,{...i,ref:t})})})}),[enB,enV]=enA(enN),enH=ew.default.forwardRef((e,t)=>{let{__scopeAccordion:n,disabled:r,dir:a,orientation:i="vertical",...o}=e,l=ew.default.useRef(null),s=(0,sX.useComposedRefs)(l,t),c=enO(n),u="ltr"===hP(a),d=sY(e.onKeyDown,e=>{if(!enM.includes(e.key))return;let t=e.target,n=c().filter(e=>!e.ref.current?.disabled),r=n.findIndex(e=>e.ref.current===t),a=n.length;if(-1===r)return;e.preventDefault();let o=r,l=a-1,s=()=>{(o=r+1)>l&&(o=0)},d=()=>{(o=r-1)<0&&(o=l)};switch(e.key){case"Home":o=0;break;case"End":o=l;break;case"ArrowRight":"horizontal"===i&&(u?s():d());break;case"ArrowDown":"vertical"===i&&s();break;case"ArrowLeft":"horizontal"===i&&(u?d():s());break;case"ArrowUp":"vertical"===i&&d()}let f=o%a;n[f].ref.current?.focus()});return(0,ey.jsx)(enB,{scope:n,disabled:r,direction:a,orientation:i,children:(0,ey.jsx)(enE.Slot,{scope:n,children:(0,ey.jsx)(s6.div,{...o,"data-orientation":i,ref:s,onKeyDown:r?void 0:d})})})}),enW="AccordionItem",[enU,enq]=enA(enW),enK=ew.default.forwardRef((e,t)=>{let{__scopeAccordion:n,value:r,...a}=e,i=enV(enW,n),o=enR(enW,n),l=enz(n),s=s0(),c=r&&o.value.includes(r)||!1,u=i.disabled||e.disabled;return(0,ey.jsx)(enU,{scope:n,open:c,disabled:u,triggerId:s,children:(0,ey.jsx)(eeT,{"data-orientation":i.orientation,"data-state":en0(c),...l,...a,ref:t,disabled:u,open:c,onOpenChange:e=>{e?o.onItemOpen(r):o.onItemClose(r)}})})});enK.displayName=enW;var enG="AccordionHeader",enX=ew.default.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,a=enV(enN,n),i=enq(enG,n);return(0,ey.jsx)(s6.h3,{"data-orientation":a.orientation,"data-state":en0(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:t})});enX.displayName=enG;var enY="AccordionTrigger",enZ=ew.default.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,a=enV(enN,n),i=enq(enY,n),o=enL(enY,n),l=enz(n);return(0,ey.jsx)(enE.ItemSlot,{scope:n,children:(0,ey.jsx)(ee$,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":a.orientation,id:i.triggerId,...l,...r,ref:t})})});enZ.displayName=enY;var enJ="AccordionContent",enQ=ew.default.forwardRef((e,t)=>{let{__scopeAccordion:n,...r}=e,a=enV(enN,n),i=enq(enJ,n),o=enz(n);return(0,ey.jsx)(eeB,{role:"region","aria-labelledby":i.triggerId,"data-orientation":a.orientation,...o,...r,ref:t,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...e.style}})});function en0(e){return e?"open":"closed"}function en1({...e}){return(0,ey.jsx)(en_,{"data-slot":"accordion",...e})}function en2({className:e,...t}){return(0,ey.jsx)(enK,{"data-slot":"accordion-item",className:(0,eI.cn)("border-b last:border-b-0",e),...t})}function en5({className:e,children:t,...n}){return(0,ey.jsx)(enX,{className:"flex",children:(0,ey.jsxs)(enZ,{"data-slot":"accordion-trigger",className:(0,eI.cn)("flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium outline-none transition-all hover:underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",e),...n,children:[t,(0,ey.jsx)(gK,{className:"pointer-events-none size-4 shrink-0 translate-y-0.5 text-muted-foreground transition-transform duration-200"})]})})}function en4({className:e,children:t,...n}){return(0,ey.jsx)(enQ,{"data-slot":"accordion-content",className:"overflow-hidden text-sm data-[state=closed]:animate-out data-[state=open]:animate-in",...n,children:(0,ey.jsx)("div",{className:(0,eI.cn)("pb-4 pt-0 text-muted-foreground",e),children:t})})}enQ.displayName=enJ;let en3={vantaloom:"Vantaloom","claude-code":"Claude Code",reclaude:"reclaude"};function en6(e){return{...e.claudeCode??{}}}function en8(e,t){if(e.reclaudeExecutable)return e;let n=t.find(e=>"reclaude"===e.engine);return n?.available&&n.detail?{...e,reclaudeExecutable:n.detail}:e}function en7(){let[e,t]=ew.useState(null),[n,r]=ew.useState([]),[a,i]=ew.useState([]),[o,l]=ew.useState(!0),[s,c]=ew.useState(!1),[u,d]=ew.useState(!1),[f,h]=ew.useState(""),[p,m]=ew.useState(!1);async function g(){if(!u){d(!0),h("");try{let e=(await wE()).engines??[];r(e),t(t=>t?en8(t,e):t)}catch(e){h(e instanceof Error?e.message:"适配器安装失败")}finally{d(!1)}}}function v(e){t(t=>t?{...t,...e}:t),m(!0)}ew.useEffect(()=>{!async function(){try{let[e,n,a]=await Promise.all([wC(),wM(),v9()]),o=n.engines??[];t(en8(en6(e),o)),r(o),i(a.models)}catch(e){h(e instanceof Error?e.message:"Failed to load config")}finally{l(!1)}}()},[]);let x=e?.adapterArgs?.[0]??"";async function y(){if(e&&!s){c(!0),h("");try{let n=await wN({claudeCode:e});t(en6(n)),m(!1)}catch(e){h(e instanceof Error?e.message:"Save failed")}finally{c(!1)}}}return o?(0,ey.jsx)("div",{className:"rounded-lg border border-dashed px-3 py-6 text-sm text-muted-foreground",children:"正在读取引擎配置"}):e?(0,ey.jsxs)("div",{className:"grid gap-6",children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:"CC 引擎"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"配置 Claude Code / reclaude 引擎。展开下方分组按需修改,留空项将自动发现。"})]}),p&&(0,ey.jsxs)(eA.Button,{type:"button",size:"sm",onClick:()=>void y(),disabled:s,children:[(0,ey.jsx)(Kh,{className:"size-4"}),s?"保存中":"保存"]})]}),f?(0,ey.jsxs)(etZ,{variant:"destructive",children:[(0,ey.jsx)(eE,{}),(0,ey.jsx)(etJ,{children:"错误"}),(0,ey.jsx)(etQ,{children:f})]}):null,(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4",children:[(0,ey.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"检测到的引擎"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"本机当前可用的 Agent 运行引擎。不可用的引擎会说明原因。"})]}),(0,ey.jsxs)(eA.Button,{type:"button",variant:"outline",size:"sm",className:"shrink-0",onClick:()=>void g(),disabled:u,children:[u?(0,ey.jsx)(eM,{className:"size-4 animate-spin"}):(0,ey.jsx)(xu,{className:"size-4"}),u?"安装中…":"下载/安装适配器"]})]}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground/80",children:"Claude Code / reclaude 需要 ACP 适配器。运行时不再内置它(以减小体积), 点击上方按钮即可在后台静默下载安装;安装后无需手填路径即可使用。"}),(0,ey.jsx)("div",{className:"grid gap-2",children:0===n.length?(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"未检测到引擎信息。"}):n.map(e=>(0,ey.jsxs)("div",{className:"grid gap-1 rounded-md border bg-background p-3",children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,ey.jsx)("span",{className:"text-sm font-medium",children:en3[e.engine]??e.engine}),(0,ey.jsxs)("span",{className:(0,eI.cn)("inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium [&_svg]:size-3",e.available?"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400":"bg-destructive/10 text-destructive"),children:[e.available?(0,ey.jsx)(eO,{}):(0,ey.jsx)(enC,{}),e.available?"可用":"不可用"]})]}),e.reason?(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:e.reason}):null,e.detail?(0,ey.jsx)("p",{className:"text-xs text-muted-foreground/80",children:e.detail}):null]},e.engine))})]}),(0,ey.jsx)("section",{className:"rounded-lg border bg-card px-4",children:(0,ey.jsxs)(en1,{type:"multiple",className:"w-full",children:[(0,ey.jsxs)(en2,{value:"adapter",children:[(0,ey.jsx)(en5,{children:"适配器"}),(0,ey.jsxs)(en4,{className:"grid gap-4 text-foreground",children:[(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et2,{className:"text-sm",children:"适配器命令"}),(0,ey.jsx)(ez,{value:e.adapterCommand??"",onChange:e=>v({adapterCommand:e.currentTarget.value}),placeholder:"node"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"留空则自动使用 node 运行适配器。"})]}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et2,{className:"text-sm",children:"适配器入口 (…/@zed-industries/claude-code-acp/dist/index.js)"}),(0,ey.jsx)(ez,{value:x,onChange:e=>{let t=e.currentTarget.value;v({adapterArgs:t?[t]:[]})},placeholder:"…/@zed-industries/claude-code-acp/dist/index.js"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"留空则自动发现(随运行时安装或环境变量 VANTALOOM_CC_ADAPTER)。"})]}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et2,{className:"text-sm",children:"Git Bash 路径"}),(0,ey.jsx)(ez,{value:e.gitBashPath??"",onChange:e=>v({gitBashPath:e.currentTarget.value}),placeholder:"C:\\\\Program Files\\\\Git\\\\bin\\\\bash.exe"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"Windows 专用,留空自动发现。"})]}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et2,{className:"text-sm",children:"reclaude 可执行文件"}),(0,ey.jsx)(ez,{value:e.reclaudeExecutable??"",onChange:e=>v({reclaudeExecutable:e.currentTarget.value}),placeholder:"reclaude"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"reclaude 可执行文件(或 node shim)路径;自动发现到 reclaude 时会自动填入, 会通过内置 shim 启动。留空则自动发现。"})]})]})]}),(0,ey.jsxs)(en2,{value:"auth",children:[(0,ey.jsx)(en5,{children:"认证"}),(0,ey.jsxs)(en4,{className:"grid gap-4 text-foreground",children:[(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et2,{className:"text-sm",children:"API Key"}),(0,ey.jsx)(ez,{type:"password",autoComplete:"off",value:e.apiKey??"",onChange:e=>v({apiKey:e.currentTarget.value}),placeholder:"claude-code 引擎用;留空可用 claude /login"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"claude-code 引擎用;留空可使用 claude /login 登录。"})]}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et2,{className:"text-sm",children:"OAuth Token"}),(0,ey.jsx)(ez,{type:"password",autoComplete:"off",value:e.oauthToken??"",onChange:e=>v({oauthToken:e.currentTarget.value}),placeholder:"留空使用其它认证方式"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"可选的 OAuth Token,作为 API Key 之外的认证方式。"})]})]})]}),(0,ey.jsxs)(en2,{value:"summary",children:[(0,ey.jsx)(en5,{children:"摘要模型"}),(0,ey.jsx)(en4,{className:"grid gap-4 text-foreground",children:(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et2,{className:"text-sm",children:"摘要模型"}),(0,ey.jsx)(en9,{models:a,value:e.summaryModelRef??"",onValueChange:e=>v({summaryModelRef:e}),placeholder:"使用默认"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"CC 会话标题/摘要用的 Vantaloom 模型路由。"})]})})]})]})})]}):(0,ey.jsxs)(etZ,{variant:"destructive",children:[(0,ey.jsx)(eE,{}),(0,ey.jsx)(etJ,{children:"读取失败"}),(0,ey.jsx)(etQ,{children:f||"无法加载引擎配置"})]})}function en9({models:e,value:t,onValueChange:n,placeholder:r}){return(0,ey.jsxs)(go,{value:t||"__none__",onValueChange:e=>n("__none__"===e?"":e),children:[(0,ey.jsx)(gX,{className:"w-full",children:(0,ey.jsx)(gu,{placeholder:r})}),(0,ey.jsxs)(gJ,{children:[(0,ey.jsx)(gQ,{value:"__none__",children:r}),e.map(e=>(0,ey.jsx)(gQ,{value:e.id,children:e.label},e.id))]})]})}let ere=[{id:"card",label:"卡片布局",description:"圆角卡片自由排布,右上角下拉菜单按需添加单窗口。",icon:(0,ey.jsx)(eeN,{})},{id:"pane",label:"分屏布局",description:"传统多窗格 + 顶部分屏预设,可拖拽分割线调整。",icon:(0,ey.jsx)(V5,{})},{id:"control-room",label:"导播台视角",description:"隐藏窗格,右侧以监视器墙并排查看主代理与各子代理。",icon:(0,ey.jsx)(eP,{})}],ert=[{id:"left",label:"Agent 在左",icon:(0,ey.jsx)(sW,{})},{id:"right",label:"Agent 在右",icon:(0,ey.jsx)(sU,{})}];function ern(){let[e,t]=ew.useState("pane"),[n,r]=ew.useState("left");return ew.useEffect(()=>{let e=Zx();t(e.mode),r(e.agentSide)},[]),(0,ey.jsxs)("div",{className:"grid gap-6",children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:"布局排版"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"仅电脑端生效。切换 Agent 工作区的窗口布局与 Agent 对话的位置,设置即时应用到所有会话。"})]}),(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4",children:[(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"布局模式"}),(0,ey.jsx)("div",{className:"grid gap-2 sm:grid-cols-3",children:ere.map(n=>{let r=e===n.id;return(0,ey.jsxs)("button",{type:"button",onClick:()=>{var e;t(e=n.id),Zy({mode:e})},className:(0,eI.cn)("flex flex-col gap-2 rounded-lg border p-3 text-left transition-colors [&_svg]:size-5",r?"border-primary bg-primary/5 text-foreground":"border-border bg-background text-muted-foreground hover:bg-muted/60 hover:text-foreground"),"aria-pressed":r,children:[(0,ey.jsx)("span",{className:(0,eI.cn)("grid size-9 place-items-center rounded-md",r?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:n.icon}),(0,ey.jsx)("span",{className:"text-sm font-medium text-foreground",children:n.label}),(0,ey.jsx)("span",{className:"text-xs text-muted-foreground",children:n.description})]},n.id)})})]}),(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4",children:[(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"Agent 对话位置"}),(0,ey.jsx)("div",{className:"flex flex-wrap gap-2",children:ert.map(e=>{let t=n===e.id;return(0,ey.jsxs)("button",{type:"button",onClick:()=>{var t;r(t=e.id),Zy({agentSide:t})},className:(0,eI.cn)("inline-flex items-center gap-2 rounded-lg border px-3 py-2 text-sm transition-colors [&_svg]:size-4",t?"border-primary bg-primary/5 text-foreground":"border-border bg-background text-muted-foreground hover:bg-muted/60 hover:text-foreground"),"aria-pressed":t,children:[e.icon,e.label]},e.id)})})]})]})}let err=[{value:"openai-v1",label:"OpenAI v1"},{value:"anthropic",label:"Anthropic"},{value:"openai-responses",label:"OpenAI Responses"}];function era(e){return{id:e.id,providerName:e.providerName,protocol:e.protocol,endpointUrl:e.endpointUrl,apiKey:"",models:e.models,selectedModelIds:e.selectedModelIds,loadingModels:!1,saving:!1,error:e.lastError??"",savedKeyAvailable:!0,editing:!1}}function eri(){let[e,t]=ew.useState([]),[n,r]=ew.useState(!0),[a,i]=ew.useState(""),o=ew.useCallback(async()=>{i("");try{let e=await v9();t(e.routes.map(era))}catch(e){i(e instanceof Error?e.message:"模型路由读取失败")}finally{r(!1)}},[]);function l(e,n){t(t=>t.map((t,r)=>r===e?n(t):t))}async function s(t){let n=e[t];if(n&&!n.saving){l(t,e=>({...e,saving:!0,error:""}));try{let e=await xt({id:n.id,providerName:n.providerName,protocol:n.protocol,endpointUrl:n.endpointUrl,apiKey:n.apiKey,models:n.models,selectedModelIds:n.selectedModelIds});l(t,()=>era(e))}catch(e){l(t,t=>({...t,saving:!1,error:e instanceof Error?e.message:"保存失败"}))}}}async function c(n){let r=e[n];if(r&&!r.saving){if(!r.id)return void t(e=>e.filter((e,t)=>t!==n));l(n,e=>({...e,saving:!0,error:""}));try{await xn(r.id),t(e=>e.filter((e,t)=>t!==n))}catch(e){l(n,t=>({...t,saving:!1,error:e instanceof Error?e.message:"删除失败"}))}}}return ew.useEffect(()=>{o()},[o]),(0,ey.jsxs)("div",{className:"grid gap-4",children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,ey.jsx)("div",{className:"min-w-0",children:(0,ey.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:"模型路由"})}),(0,ey.jsxs)(eA.Button,{type:"button",size:"sm",onClick:function(){t(e=>[{providerName:"",protocol:"openai-v1",endpointUrl:"",apiKey:"",models:[],selectedModelIds:[],loadingModels:!1,saving:!1,error:"",editing:!0},...e])},"data-tour":"add-model-route",children:[(0,ey.jsx)(lV,{className:"size-4"}),"添加模型路由"]})]}),a?(0,ey.jsxs)(etZ,{variant:"destructive",children:[(0,ey.jsx)(eE,{}),(0,ey.jsx)(etJ,{children:"读取失败"}),(0,ey.jsx)(etQ,{children:a})]}):null,n?(0,ey.jsx)("div",{className:"rounded-lg border border-dashed px-3 py-6 text-sm text-muted-foreground",children:"正在读取模型路由"}):0===e.length?(0,ey.jsx)("div",{className:"rounded-lg border border-dashed px-3 py-6 text-sm text-muted-foreground",children:"还没有模型路由。"}):(0,ey.jsx)("div",{className:"grid gap-3",children:e.map((e,t)=>(0,ey.jsx)(ero,{draft:e,onDraftChange:e=>l(t,()=>e),onSave:()=>{s(t)},onDelete:()=>{c(t)}},e.id??`draft-${t}`))})]})}function ero({draft:e,onDraftChange:t,onSave:n,onDelete:r}){let a=ew.useRef(e),i=ew.useRef(t),o=[e.providerName,e.protocol,e.endpointUrl,e.apiKey||(e.savedKeyAvailable?"saved":"")].join("\n"),l=e.providerName.trim()&&e.endpointUrl.trim()&&e.apiKey.trim(),s=e.providerName.trim()&&e.endpointUrl.trim()&&(e.apiKey.trim()||e.savedKeyAvailable)&&e.selectedModelIds.length>0&&!e.saving;function c(n){t({...e,...n})}if(ew.useEffect(()=>{a.current=e,i.current=t},[e,t]),ew.useEffect(()=>{if(!l)return;let e=window.setTimeout(async()=>{let e=a.current;i.current({...e,loadingModels:!0,error:""});try{let t=await xe({providerName:e.providerName,protocol:e.protocol,endpointUrl:e.endpointUrl,apiKey:e.apiKey}),n=e.selectedModelIds.filter(e=>t.models.some(t=>t.id===e));i.current({...e,models:t.models,selectedModelIds:n,loadingModels:!1,error:""})}catch(t){i.current({...e,loadingModels:!1,error:t instanceof Error?t.message:"模型拉取失败"})}},650);return()=>window.clearTimeout(e)},[l,o]),!e.editing){let t=e.selectedModelIds.map(t=>e.models.find(e=>e.id===t)?.displayName||t).filter(Boolean),n=err.find(t=>t.value===e.protocol)?.label??e.protocol;return(0,ey.jsxs)("section",{className:"grid min-h-16 grid-cols-[minmax(0,1fr)_auto] items-center gap-3 rounded-lg border bg-card px-3 py-2.5",children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1",children:[(0,ey.jsx)("span",{className:"truncate text-sm font-medium",children:e.providerName}),(0,ey.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:n})]}),(0,ey.jsx)("div",{className:"mt-1 truncate text-xs text-muted-foreground",children:t.length>0?t.join(", "):"未选择模型"})]}),(0,ey.jsxs)(eA.Button,{type:"button",variant:"outline",size:"sm",onClick:()=>c({editing:!0}),children:[(0,ey.jsx)(Vj,{className:"size-4"}),"编辑"]})]})}return(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-3","data-tour":"model-route-form",children:[(0,ey.jsxs)("div",{className:"grid gap-2 md:grid-cols-[minmax(0,1fr)_11rem]",children:[(0,ey.jsx)(ez,{value:e.providerName,placeholder:"提供商名称",onChange:e=>c({providerName:e.currentTarget.value})}),(0,ey.jsxs)(go,{value:e.protocol,onValueChange:e=>c({protocol:e}),children:[(0,ey.jsx)(gX,{className:"w-full",children:(0,ey.jsx)(gu,{})}),(0,ey.jsx)(gJ,{children:err.map(e=>(0,ey.jsx)(gQ,{value:e.value,children:e.label},e.value))})]})]}),(0,ey.jsxs)("div",{className:"grid gap-2 md:grid-cols-[minmax(0,1fr)_minmax(0,18rem)]",children:[(0,ey.jsx)(ez,{value:e.endpointUrl,placeholder:"API 端点 URL,例如 https://api.openai.com/v1",onChange:e=>c({endpointUrl:e.currentTarget.value})}),(0,ey.jsx)(ez,{value:e.apiKey,type:"password",placeholder:e.savedKeyAvailable?"已保存,留空沿用":"API Key",onChange:e=>c({apiKey:e.currentTarget.value})})]}),(0,ey.jsx)(Qb,{}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsxs)("div",{className:"flex min-h-6 items-center justify-between gap-2",children:[(0,ey.jsxs)("div",{className:"flex min-w-0 items-center gap-2 text-sm font-medium",children:[(0,ey.jsx)(pj,{className:"size-4 text-muted-foreground"}),"可用模型"]}),e.loadingModels?(0,ey.jsx)("span",{className:"text-xs text-muted-foreground",children:"拉取中"}):null]}),e.models.length>0?(0,ey.jsx)("div",{className:"grid max-h-64 gap-1 overflow-auto pr-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:e.models.map(t=>{let n=e.selectedModelIds.includes(t.id);return(0,ey.jsxs)("div",{className:(0,eI.cn)("grid min-h-8 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-2 rounded-md px-2 text-sm hover:bg-muted/60",n&&"bg-muted/70"),children:[(0,ey.jsxs)("label",{className:"flex cursor-pointer items-center gap-2",children:[(0,ey.jsx)(Wy,{checked:n,onCheckedChange:n=>{var r;return r=t.id,void c({selectedModelIds:!0===n?[...e.selectedModelIds,r]:e.selectedModelIds.filter(e=>e!==r)})}}),(0,ey.jsx)("span",{className:"truncate",children:t.displayName||t.id})]}),(0,ey.jsxs)("div",{className:"flex items-center gap-1",children:[(0,ey.jsx)(ez,{type:"number",className:"h-6 w-16 px-1.5 text-center text-xs tabular-nums",value:t.contextLength||200,min:1,max:1e4,onChange:n=>{var r,a;return r=t.id,a=Number.parseInt(n.currentTarget.value,10)||0,void c({models:e.models.map(e=>e.id===r?{...e,contextLength:a>0?a:void 0}:e)})}}),(0,ey.jsx)("span",{className:"text-xs text-muted-foreground",children:"k"})]})]},t.id)})}):(0,ey.jsx)("div",{className:"rounded-md border border-dashed px-3 py-4 text-sm text-muted-foreground",children:"填写端点和密钥后会自动拉取模型。"})]}),e.error?(0,ey.jsxs)(etZ,{variant:"destructive",children:[(0,ey.jsx)(eE,{}),(0,ey.jsx)(etJ,{children:"模型路由错误"}),(0,ey.jsx)(etQ,{className:"break-words",children:e.error})]}):null,(0,ey.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,ey.jsxs)(eA.Button,{type:"button",variant:"destructive",onClick:r,disabled:e.saving,children:[(0,ey.jsx)(xC,{className:"size-4"}),"删除"]}),(0,ey.jsx)(eA.Button,{type:"button",onClick:n,disabled:!s,children:e.saving?"保存中":"保存"})]})]})}async function erl(){return erc("/api/local/subagent-config")}async function ers(e){return erc("/api/local/subagent-config",{method:"PUT",body:JSON.stringify(e)})}async function erc(e,t){let n=await fetch(eD(e),{cache:"no-store",...t,headers:{...t?.body?{"Content-Type":"application/json"}:{},...t?.headers}}),r=await n.json().catch(()=>({}));if(!n.ok)throw Error("string"==typeof r?.error?r.error:"subagent config api failed");return r}function eru(e){return{explore:{...e.explore},workflow:{...e.workflow},operator:{...e.operator},custom:{...e.custom,models:[...e.custom.models??[]]}}}let erd={explore:{title:"探索子代理",icon:(0,ey.jsx)(BR,{className:"size-4"}),tint:"text-sky-600 dark:text-sky-400",description:"只读的代码库探索/调研专家。彻底阅读、搜索代码库,返回带文件路径+行号引用的完整结论,替主 agent 节省上下文。",tools:"仅阅读(vantaloom_read)"},workflow:{title:"工作流子代理",icon:(0,ey.jsx)(dc,{className:"size-4"}),tint:"text-violet-600 dark:text-violet-400",description:"按 workflow-*.yml 严格执行可重复的多步流程,并把其中确定性的步骤自动固化为脚本、给 yml 添加批注。",tools:"阅读 / 编辑 / 终端(vantaloom_read · vantaloom_edit · vantaloom_shell)"},operator:{title:"操作员子代理",icon:(0,ey.jsx)(ds,{className:"size-4"}),tint:"text-pink-600 dark:text-pink-400",description:"专门驱动交互式终端(未来含浏览器)。执行大量终端操作并把结果回报给主 agent。",tools:"阅读 / 终端(vantaloom_read · vantaloom_shell)"}};function erf(){let[e,t]=ew.useState(null),{models:n,loading:r}=xa(),[a,i]=ew.useState(!0),[o,l]=ew.useState(!1),[s,c]=ew.useState(""),[u,d]=ew.useState(!1);async function f(){if(e&&!o){l(!0),c("");try{let n=await ers({explore:e.explore,workflow:e.workflow,operator:e.operator,custom:e.custom});t(eru(n)),d(!1)}catch(e){c(e instanceof Error?e.message:"Save failed")}finally{l(!1)}}}return ew.useEffect(()=>{!async function(){try{let e=await erl();t(eru(e))}catch(e){c(e instanceof Error?e.message:"Failed to load config")}finally{i(!1)}}()},[]),a?(0,ey.jsx)("div",{className:"rounded-lg border border-dashed px-3 py-6 text-sm text-muted-foreground",children:"正在读取子代理配置"}):e?(0,ey.jsxs)("div",{className:"grid gap-6",children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,ey.jsxs)("div",{className:"min-w-0",children:[(0,ey.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:"子代理配置"}),(0,ey.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"主 agent 可以派发这些子代理来分担任务。每个子代理拥有独立上下文与受限工具集,完成后只把结果汇报给主 agent。"})]}),u&&(0,ey.jsxs)(eA.Button,{type:"button",size:"sm",onClick:()=>void f(),disabled:o,children:[(0,ey.jsx)(Kh,{className:"size-4"}),o?"保存中":"保存"]})]}),s?(0,ey.jsxs)(etZ,{variant:"destructive",children:[(0,ey.jsx)(eE,{}),(0,ey.jsx)(etJ,{children:"错误"}),(0,ey.jsx)(etQ,{children:s})]}):null,["explore","workflow","operator"].map(a=>(0,ey.jsx)(erh,{tourId:`subagent-${a}`,meta:erd[a],value:e[a],models:n,modelsLoading:r,onChange:e=>{t(t=>t?{...t,[a]:{...t[a],...e}}:t),d(!0)}},a)),(0,ey.jsx)(erp,{value:e.custom,models:n,modelsLoading:r,onChange:function(e){t(t=>t?{...t,custom:{...t.custom,...e}}:t),d(!0)}})]}):(0,ey.jsxs)(etZ,{variant:"destructive",children:[(0,ey.jsx)(eE,{}),(0,ey.jsx)(etJ,{children:"读取失败"}),(0,ey.jsx)(etQ,{children:s||"无法加载子代理配置"})]})}function erh({meta:e,value:t,models:n,modelsLoading:r,onChange:a,tourId:i}){return(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4","data-tour":i,children:[(0,ey.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ey.jsx)("span",{className:e.tint,children:e.icon}),(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:e.title})]}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:e.description}),(0,ey.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(0,ey.jsx)("span",{className:"text-foreground/70",children:"可用工具:"}),e.tools,(0,ey.jsx)("span",{className:"ml-1 text-muted-foreground/70",children:"(固定,不可更改)"})]}),(0,ey.jsx)(Qb,{}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et2,{className:"text-sm",children:"使用模型"}),(0,ey.jsx)(erm,{models:n,value:t.modelRef,onValueChange:e=>a({modelRef:e}),placeholder:r?"读取模型中":"继承上级模型"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"留空则继承派发它的上级 agent 当前使用的模型。"})]}),(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsxs)("div",{className:"min-w-0 space-y-0.5",children:[(0,ey.jsx)(et2,{className:"text-sm",children:"允许上级指定模型"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"开启后,上级 agent 可在派发时动态指定该子代理使用的模型。"})]}),(0,ey.jsx)(xo,{checked:t.allowCallerModel,onCheckedChange:e=>a({allowCallerModel:e})})]}),(0,ey.jsx)(Qb,{}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsxs)("div",{className:"flex items-center justify-between",children:[(0,ey.jsx)(et2,{className:"text-sm",children:"系统提示词"}),t.promptOverride?(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:()=>a({promptOverride:""}),children:"恢复默认"}):null]}),(0,ey.jsx)(bm,{value:t.promptOverride,onChange:e=>a({promptOverride:e.currentTarget.value}),placeholder:"留空使用内置默认提示词;在此输入将覆盖默认提示词(环境/工具说明仍会自动附加)。",rows:t.promptOverride?10:3,className:"resize-y text-sm"}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"覆盖该官方子代理的预设系统提示词。派发时还会自动附加工作区、操作系统与工具使用说明。"})]})]})}function erp({value:e,models:t,modelsLoading:n,onChange:r}){let a=ew.useCallback(e=>t.find(t=>t.value===e)?.label??e,[t]);return(0,ey.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-4","data-tour":"subagent-custom",children:[(0,ey.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ey.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:(0,ey.jsx)(de,{className:"size-4"})}),(0,ey.jsx)("h4",{className:"text-sm font-semibold",children:"自定义子代理"})]}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"主 agent 可以自取名字、从下面的模型池中选一个模型来召唤自定义子代理,并可选择是否继承当前对话上下文。自定义子代理拥有完整工具集,还能进一步派发上面三种官方子代理。"}),(0,ey.jsx)(Qb,{}),(0,ey.jsxs)("div",{className:"grid gap-2",children:[(0,ey.jsx)(et2,{className:"text-sm",children:"可用模型池"}),(0,ey.jsx)(v7,{variant:"list-combobox",value:e.models,onValueChange:e=>r({models:e}),options:t,placeholder:n?"读取模型中":"选择可供自定义子代理使用的模型",searchPlaceholder:"搜索模型...",emptyText:"没有可用模型",renderItem:a}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground",children:"主 agent 召唤自定义子代理时会从这个池中选择一个模型。留空则沿用上级 agent 的模型。"})]})]})}function erm({models:e,value:t,onValueChange:n,placeholder:r}){return(0,ey.jsxs)(go,{value:t||"__none__",onValueChange:e=>n("__none__"===e?"":e),children:[(0,ey.jsx)(gX,{className:"w-full",children:(0,ey.jsx)(gu,{placeholder:r})}),(0,ey.jsxs)(gJ,{children:[(0,ey.jsx)(gQ,{value:"__none__",children:r}),e.map(e=>(0,ey.jsx)(gQ,{value:e.value,children:e.label},e.value))]})]})}function erg({section:e}={}){return(0,ey.jsx)("div",{className:"vtl-app-background h-full min-h-0 overflow-auto p-6 pb-14 text-foreground md:pb-6",children:(0,ey.jsx)("div",{className:"mx-auto w-full max-w-3xl","data-tour":`preferences-${e??"model-routes"}`,children:"agent-config"===e?(0,ey.jsx)(enk,{}):"subagent-config"===e?(0,ey.jsx)(erf,{}):"cc-engine-config"===e?(0,ey.jsx)(en7,{}):"layout"===e?(0,ey.jsx)(ern,{}):(0,ey.jsx)(eri,{})})})}let erv=(0,ek.default)("circle-arrow-up",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);function erx(e,t){if(e.isLocal)return eD(t);let n=t.replace(/^\/v1(?=\/)/,"");return eD(`/v1/remote/${e.id}${n}`)}async function ery(e){try{let t=await fetch(`https://registry.npmjs.org/@vantaloom/runtime-${e}`,{headers:{Accept:"application/vnd.npm.install-v1+json"},cache:"no-store"});if(!t.ok)return;let n=await t.json();return n?.["dist-tags"]?.latest}catch{return}}function erb(){let[e,t]=ew.useState([]),[n,r]=ew.useState(!0),a=ew.useRef(!0),i=ew.useCallback((e,n)=>{t(t=>t.map(t=>t.machine.id===e?{...t,...n}:t))},[]),o=ew.useCallback(async()=>{r(!0);let e=[];try{let t=await fetch(eD("/v1/remote/machines"),{cache:"no-store"});e=(await t.json()).machines??[]}catch{e=[]}a.current&&(t(e.map(e=>({machine:e,loading:!0}))),r(!1),await Promise.all(e.map(async e=>{if(!e.isLocal&&"online"!==e.status){a.current&&i(e.id,{loading:!1,error:"离线"});return}try{let t,n=await fetch(erx(e,"/v1/runtime/info"),{cache:"no-store"});if(!n.ok)throw Error(`HTTP ${n.status}`);let r=await n.text();try{t=JSON.parse(r)}catch{throw Error("该机器运行时过旧,不支持版本检测")}let o=await ery(t.platform);a.current&&i(e.id,{info:t,latest:o,loading:!1})}catch(t){a.current&&i(e.id,{loading:!1,error:t instanceof Error?t.message:"无法获取版本"})}})))},[i]);async function l(e){if(e.info&&!e.updating){i(e.machine.id,{updating:!0});try{await fetch(erx(e.machine,"/v1/runtime/update"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({version:e.latest})})}catch{}window.setTimeout(()=>{a.current&&o()},25e3)}}return ew.useEffect(()=>(a.current=!0,o(),()=>{a.current=!1}),[o]),(0,ey.jsx)("div",{className:"h-full overflow-auto px-6 py-8","data-tour":"check-update",children:(0,ey.jsxs)("div",{className:"mx-auto flex max-w-3xl flex-col gap-5",children:[(0,ey.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,ey.jsxs)("div",{children:[(0,ey.jsx)("h1",{className:"text-xl font-semibold",children:"检查更新"}),(0,ey.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"工作组内各机器的运行时版本与可用更新。点击「立即更新」可让对应机器自动更新(该机器会短暂重启)。"})]}),(0,ey.jsxs)(eA.Button,{variant:"outline",size:"sm",onClick:()=>void o(),disabled:n,children:[(0,ey.jsx)(xS,{className:(0,eI.cn)("size-4",n&&"animate-spin")}),"刷新"]})]}),n&&0===e.length?(0,ey.jsxs)("div",{className:"flex items-center justify-center gap-2 rounded-xl border bg-card p-8 text-sm text-muted-foreground",children:[(0,ey.jsx)(eM,{className:"size-4 animate-spin"})," 正在获取机器列表…"]}):0===e.length?(0,ey.jsx)("div",{className:"rounded-xl border bg-card p-8 text-center text-sm text-muted-foreground",children:"暂无可用机器。"}):(0,ey.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>{let t=!!e.info&&!!e.latest&&e.latest!==e.info.version;return(0,ey.jsxs)("div",{className:"flex items-center gap-4 rounded-xl border bg-card px-4 py-3",children:[(0,ey.jsx)(eP,{className:"size-5 shrink-0 text-muted-foreground"}),(0,ey.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,ey.jsxs)("div",{className:"flex items-center gap-2",children:[(0,ey.jsx)("span",{className:"truncate text-sm font-medium",children:e.machine.name}),e.machine.isLocal?(0,ey.jsx)("span",{className:"rounded bg-muted px-1.5 py-0.5 text-[10px] text-muted-foreground",children:"本机"}):null]}),(0,ey.jsx)("div",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:e.loading?"读取版本中…":e.error?(0,ey.jsx)("span",{className:"text-amber-600",children:e.error}):(0,ey.jsxs)(ey.Fragment,{children:[function(e){switch(e){case"windows":return"Windows";case"darwin":return"macOS";case"linux":return"Linux";case"android":return"Android";default:return e||"未知"}}(e.info?.os??e.machine.platform??"")," · 当前 ",(0,ey.jsx)("span",{className:"font-mono",children:e.info?.version??"?"}),e.latest?(0,ey.jsxs)(ey.Fragment,{children:[" · 最新 ",(0,ey.jsx)("span",{className:"font-mono",children:e.latest})]}):null,e.info?.updatedAt?(0,ey.jsxs)(ey.Fragment,{children:[" · 更新于 ",function(e){if(!e)return"—";let t=Date.parse(e);return Number.isFinite(t)?new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(t):"—"}(e.info.updatedAt)]}):null]})})]}),e.loading?(0,ey.jsx)(eM,{className:"size-4 animate-spin text-muted-foreground"}):e.updating?(0,ey.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-primary",children:[(0,ey.jsx)(eM,{className:"size-4 animate-spin"})," 更新中…"]}):t?(0,ey.jsxs)(eA.Button,{size:"sm",onClick:()=>void l(e),children:[(0,ey.jsx)(erv,{className:"size-4"})," 立即更新"]}):e.info?(0,ey.jsxs)("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,ey.jsx)(eO,{className:"size-4 text-emerald-500"})," 已是最新"]}):null]},e.machine.id)})}),(0,ey.jsx)("p",{className:"text-xs text-muted-foreground/70",children:"最新版本号来自 npm(@vantaloom/runtime-<平台>)。更新过程中该机器会停止并重启运行时, 若你的手机正连着它会短暂断开,更新完成后重新连接即可。"})]})})}let erw=["light","dark","jelly"],erj={light:{label:"Light",icon:eeP,className:"text-sidebar-foreground/60"},dark:{label:"Dark",icon:eeE,className:"text-sidebar-foreground/60"},jelly:{label:"Jelly",icon:function(e){return(0,ey.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[(0,ey.jsx)("path",{d:"M6.5 11.5C6.5 8 8.7 5.5 12 5.5s5.5 2.5 5.5 6v.6c0 .8-.6 1.4-1.4 1.4H7.9c-.8 0-1.4-.6-1.4-1.4v-.6Z"}),(0,ey.jsx)("path",{d:"M7.8 13.5c.4 1 1.1 1.5 2 1.5s1.6-.5 2-1.5c.4 1 1.1 1.5 2 1.5s1.6-.5 2-1.5"}),(0,ey.jsx)("path",{d:"M9 15.5c0 1.4-1.2 1.4-1.2 2.8 0 .7.3 1.2.8 1.7"}),(0,ey.jsx)("path",{d:"M12 15.5c0 1.6-1.4 1.6-1.4 3.2 0 .7.3 1.2.8 1.8"}),(0,ey.jsx)("path",{d:"M15 15.5c0 1.4 1.2 1.4 1.2 2.8 0 .7-.3 1.2-.8 1.7"})]})},className:"text-primary"}};function erk(){let{resolvedTheme:e,setTheme:t}=(0,hl.useTheme)(),[n,r]=ew.useState(eeW.defaultAppearanceTheme);ew.useEffect(()=>{let e=window.localStorage.getItem(eeW.appearanceThemeStorageKey)??eeW.defaultAppearanceTheme;r(e),(0,eeW.applyAppearanceTheme)({theme:e})},[]);let a=n===eeW.jellyAppearanceTheme?"jelly":"dark"===e?"dark":"light",i=erw.indexOf(a),o=erw[(i+1)%erw.length]??"light",{icon:l,label:s,className:c}=erj[a];function u(e){r(e),window.localStorage.setItem(eeW.appearanceThemeStorageKey,e),(0,eeW.applyAppearanceTheme)({theme:e})}return(0,ey.jsx)(eA.Button,{type:"button",variant:"ghost",size:"icon-sm",className:(0,eI.cn)("size-10 hover:bg-muted hover:text-sidebar-foreground",c),"aria-label":`${Z6.theme}: ${s}`,title:`${Z6.theme}: ${s}`,onClick:function(){if("jelly"===o){t("dark"),u(eeW.jellyAppearanceTheme);return}u(eeW.defaultAppearanceTheme),t(o)},children:(0,ey.jsx)(l,{})})}let erS=(0,ek.default)("chart-area",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z",key:"q0gr47"}]]);(0,ek.default)("layout-dashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);let erC=(0,ek.default)("list-checks",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}]]),erN=((0,ek.default)("route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]),(0,ek.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]])),erM=[{id:"run-ui-polish",title:"组件库视觉回归检查",machine:"Studio-PC",agent:"UI Polish",state:"running",started:"14:08",runtime:"22m",progress:68,load:54},{id:"run-runner-build",title:"Linux runner 镜像构建",machine:"Linux-runner-02",agent:"Build Agent",state:"running",started:"14:15",runtime:"15m",progress:41,load:86},{id:"run-access-audit",title:"工作组权限审阅",machine:"Studio-PC",agent:"Access Agent",state:"blocked",started:"14:21",runtime:"9m",progress:37,load:18},{id:"run-docs",title:"发布说明摘要",machine:"MacBook-build",agent:"Docs Agent",state:"queued",started:"等待",runtime:"0m",progress:0,load:0},{id:"run-cache-clean",title:"缓存清理策略验证",machine:"Linux-runner-02",agent:"Ops Sentinel",state:"failed",started:"13:54",runtime:"6m",progress:28,load:12}],erE=[{id:"worker-studio",machine:"Studio-PC",role:"local coordinator",active:3,capacity:6,cpu:42,memory:68},{id:"worker-runner",machine:"Linux-runner-02",role:"gpu worker",active:4,capacity:5,cpu:76,memory:81},{id:"worker-mac",machine:"MacBook-build",role:"build host",active:0,capacity:3,cpu:8,memory:24}],erO=[{id:"confirm-shell",title:"Studio-PC 请求执行发布前文件写入",meta:"UI Polish · apply_patch",tone:"normal"},{id:"confirm-service",title:"Linux-runner-02 请求重启 runner 服务",meta:"Ops Sentinel · Restart-Service",tone:"warning"},{id:"confirm-token",title:"工作组 token 加入新机器",meta:"Access Agent · admin required",tone:"normal"}],erP=[["14:29","Studio-PC","pnpm --filter vantaloom-app lint","完成"],["14:27","Linux-runner-02","docker build agent-runtime","运行中"],["14:22","Studio-PC","apply_patch agent settings","完成"],["14:17","MacBook-build","pnpm typecheck","排队"],["14:03","Linux-runner-02","cache prune dry-run","失败"]],erA={cpu:{label:"CPU",color:"var(--chart-1)"},memory:{label:"Memory",color:"var(--chart-3)"},network:{label:"Network",color:"var(--chart-5)"}};function erI(e,t,n=42,r){return(0,ey.jsx)("section",{className:(0,eI.cn)("size-full rounded-xl border bg-card p-5",r&&"vtl-jelly-image-card",r&&r.includes("/bg")&&"vtl-jelly-image-card-shadowless"),style:r?Z4({image:r,opacity:.74,blur:"8px"}):void 0,children:(0,ey.jsx)(Jk,{label:e,value:t,minSize:n})})}function erz(e,t,n=""){return{title:e,dataSource:t,refreshRate:"10s",note:n}}let er_={metrics:{online:2,health:88.4,latency:"38ms",events:17},machines:[{id:"studio",name:"Studio-PC",os:"Windows",status:"online",link:"direct",heartbeat:"3s",cpu:42,memory:68,disk:71,network:24},{id:"runner",name:"Linux-runner-02",os:"Linux",status:"online",link:"p2p",heartbeat:"5s",cpu:76,memory:81,disk:62,network:43},{id:"mac",name:"MacBook-build",os:"macOS",status:"sleeping",link:"direct",heartbeat:"2m",cpu:8,memory:24,disk:48,network:6}],trend:[{time:"09:00",cpu:36,memory:54,network:24},{time:"10:00",cpu:48,memory:61,network:29},{time:"11:00",cpu:44,memory:58,network:34},{time:"12:00",cpu:63,memory:72,network:41},{time:"13:00",cpu:58,memory:69,network:37},{time:"14:00",cpu:71,memory:76,network:46}],networkLinks:[["Studio-PC","Linux-runner-02","P2P","38ms","0.3%"],["Studio-PC","MacBook-build","Direct","12ms","0.0%"],["Linux-runner-02","MacBook-build","Relay fallback","84ms","1.1%"]],events:[["14:31","Linux-runner-02 心跳延迟升高"],["14:28","Studio-PC 完成 2 个工具调用"],["14:19","MacBook-build 进入睡眠状态"],["14:12","工作组权限策略同步完成"],["14:04","P2P 链路切换到备用路径"]],serviceHealth:[{id:"local-service",name:"Local service",state:"正常",samples:[96,98,97,95,96,94,97,98,96,95,97,96]},{id:"agent-runtime",name:"Agent runtime",state:"正常",samples:[91,93,94,90,88,92,94,93,91,89,92,94]},{id:"p2p-mesh",name:"P2P mesh",state:"波动",samples:[78,82,76,73,68,71,74,79,83,80,77,72]},{id:"plugin-bridge",name:"Plugin bridge",state:"告警",samples:[88,86,84,82,79,74,63,54,48,52,67,76]}]},erD=[{id:"metric-runs",title:"运行中",description:"当前正在执行的运行数量。",icon:(0,ey.jsx)(dc,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:erz("运行中","运行队列"),render:e=>erI(e.title,"07",44,Z0)},{id:"metric-queued",title:"排队",description:"等待调度的任务数量。",icon:(0,ey.jsx)(u9,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:erz("排队","调度器"),render:e=>erI(e.title,"04",44,Z1)},{id:"metric-blocked",title:"待确认",description:"等待人工确认的任务数量。",icon:(0,ey.jsx)(erN,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:erz("待确认","确认队列"),render:e=>erI(e.title,"03",44,Z2)},{id:"metric-workers",title:"Worker",description:"当前可调度 worker 数量。",icon:(0,ey.jsx)(Jz,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:erz("Worker","Agent worker"),render:e=>erI(e.title,"14",44,Z5)},{id:"queue",title:"任务队列",description:"运行队列 Roadmap。",icon:(0,ey.jsx)(erC,{className:"size-4"}),defaultSize:{w:7,h:5},defaultConfig:erz("任务队列","运行队列"),render:e=>(0,ey.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,ey.jsx)(Z3,{title:e.title}),(0,ey.jsx)(Q1,{items:erM})]})},{id:"workers",title:"Agent worker",description:"各 worker 的负载和容量。",icon:(0,ey.jsx)(Jz,{className:"size-4"}),defaultSize:{w:5,h:5},defaultConfig:erz("Agent worker","Worker 状态"),render:e=>(0,ey.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,ey.jsx)(Z3,{title:e.title}),(0,ey.jsx)(Q5,{workers:erE})]})},{id:"log",title:"最近执行",description:"最近执行记录 Roadmap。",icon:(0,ey.jsx)(JM,{className:"size-4"}),defaultSize:{w:7,h:4},defaultConfig:erz("最近执行","执行日志"),render:e=>(0,ey.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,ey.jsx)(Z3,{title:e.title}),(0,ey.jsx)(Q0,{items:erP})]})},{id:"confirmations",title:"待确认",description:"等待人工确认的事项。",icon:(0,ey.jsx)(Qy,{className:"size-4"}),defaultSize:{w:5,h:4},defaultConfig:erz("待确认","确认队列"),render:e=>(0,ey.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,ey.jsx)(Z3,{title:e.title}),(0,ey.jsx)(QQ,{items:erO})]})}],erR=[{id:"metric-runs",kind:"metric-runs",x:0,y:0,w:3,h:2},{id:"metric-queued",kind:"metric-queued",x:3,y:0,w:3,h:2},{id:"metric-blocked",kind:"metric-blocked",x:6,y:0,w:3,h:2},{id:"metric-workers",kind:"metric-workers",x:9,y:0,w:3,h:2},{id:"queue",kind:"queue",x:0,y:2,w:7,h:5},{id:"workers",kind:"workers",x:7,y:2,w:5,h:5},{id:"log",kind:"log",x:0,y:7,w:7,h:4},{id:"confirmations",kind:"confirmations",x:7,y:7,w:5,h:4}];function erT(e=er_){return[{id:"metric-online",title:"在线机器",description:"当前在线机器数量。",icon:(0,ey.jsx)(eP,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:erz("在线机器","机器心跳"),render:t=>erI(t.title,String(e.metrics.online),44,Z0)},{id:"metric-health",title:"健康度",description:"工作组整体健康度。",icon:(0,ey.jsx)(eO,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:erz("健康度","服务遥测"),render:t=>erI(t.title,`${e.metrics.health}%`,44,Z1)},{id:"metric-latency",title:"平均延迟",description:"机器连接平均延迟。",icon:(0,ey.jsx)(JI,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:erz("平均延迟","网络遥测"),render:t=>erI(t.title,e.metrics.latency,44,Z2)},{id:"metric-events",title:"事件",description:"最近事件数量。",icon:(0,ey.jsx)(Qy,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:erz("事件","事件流"),render:t=>erI(t.title,String(e.metrics.events),44,Z5)},{id:"machines",title:"机器健康矩阵",description:"各机器资源和心跳状态。",icon:(0,ey.jsx)(eP,{className:"size-4"}),defaultSize:{w:7,h:5},defaultConfig:erz("机器健康矩阵","机器遥测"),render:t=>(0,ey.jsxs)("section",{className:"vtl-jelly-image-card flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",style:Z4({image:"/themes/jelly/card1.png",opacity:.88,blur:"10px"}),children:[(0,ey.jsx)(Z3,{title:t.title}),(0,ey.jsx)(Q8,{machines:e.machines})]})},{id:"trend",title:"资源趋势",description:"CPU、内存和网络趋势。",icon:(0,ey.jsx)(erS,{className:"size-4"}),defaultSize:{w:5,h:5},defaultConfig:erz("资源趋势","机器遥测"),render:t=>(0,ey.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,ey.jsx)(Z3,{title:t.title}),(0,ey.jsx)(een,{config:erA,data:e.trend})]})},{id:"network",title:"网络连接",description:"机器之间连接状态。",icon:(0,ey.jsx)(ZK,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:erz("网络连接","网络遥测"),render:t=>(0,ey.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,ey.jsx)(Z3,{title:t.title}),(0,ey.jsx)(eet,{links:e.networkLinks})]})},{id:"events",title:"事件流",description:"最近遥测事件。",icon:(0,ey.jsx)(Qy,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:erz("事件流","事件流"),render:t=>(0,ey.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,ey.jsx)(Z3,{title:t.title}),(0,ey.jsx)(Q6,{events:e.events})]})},{id:"services",title:"服务健康",description:"服务 30 分钟粒度健康条。",icon:(0,ey.jsx)(Jz,{className:"size-4"}),defaultSize:{w:12,h:3},defaultConfig:erz("服务健康","服务遥测"),render:t=>(0,ey.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,ey.jsx)(Z3,{title:t.title}),(0,ey.jsx)(eer,{services:e.serviceHealth})]})}]}erT();let erL=[{id:"metric-online",kind:"metric-online",x:0,y:0,w:3,h:2},{id:"metric-health",kind:"metric-health",x:3,y:0,w:3,h:2},{id:"metric-latency",kind:"metric-latency",x:6,y:0,w:3,h:2},{id:"metric-events",kind:"metric-events",x:9,y:0,w:3,h:2},{id:"machines",kind:"machines",x:0,y:2,w:7,h:5},{id:"trend",kind:"trend",x:7,y:2,w:5,h:5},{id:"network",kind:"network",x:0,y:7,w:6,h:4},{id:"events",kind:"events",x:6,y:7,w:6,h:4},{id:"services",kind:"services",x:0,y:11,w:12,h:3}],er$={totals:{machines:4,online:2,runtime:3,tokens:7},machines:[{id:"studio",name:"Studio-PC",role:"本机",group:"Core",os:"Windows 11",runtime:"0.16.4",state:"online",tags:["admin","shell","files","scheduler"],agent:"6/8",cpu:42,memory:68,version:"Agent runtime 0.16.4",admin:"Allay"},{id:"runner",name:"Linux-runner-02",role:"GPU worker",group:"Compute",os:"Ubuntu 24.04",runtime:"0.16.3",state:"online",tags:["gpu","agent","files"],agent:"4/6",cpu:76,memory:81,version:"Agent runtime 0.16.3",admin:"Ops"},{id:"mac",name:"MacBook-build",role:"构建机",group:"Build",os:"macOS 15.4",runtime:"0.15.9",state:"sleeping",tags:["build","readonly"],agent:"0/3",cpu:8,memory:24,version:"Agent runtime 0.15.9",admin:"Allay"},{id:"observer",name:"Observer-01",role:"只读观测节点",group:"Edge",os:"Debian 13",runtime:"0.16.2",state:"warning",tags:["readonly","audit"],agent:"1/2",cpu:18,memory:36,version:"Agent runtime 0.16.2",admin:"Security"}],topology:{nodes:[{id:"studio",label:"Studio-PC",meta:"本机",x:50,y:18},{id:"runner",label:"Linux-runner-02",meta:"GPU worker",x:22,y:60},{id:"mac",label:"MacBook-build",meta:"构建机",x:76,y:58,state:"warning"},{id:"observer",label:"Observer-01",meta:"只读观测",x:50,y:82,state:"warning"}],links:[{id:"sr",from:"studio",to:"runner",kind:"p2p",label:"P2P",meta:"38ms / 0.3%"},{id:"sm",from:"studio",to:"mac",kind:"direct",label:"Direct",meta:"12ms / 0%"},{id:"ro",from:"runner",to:"observer",kind:"relay",label:"Relay",meta:"84ms / 1.1%"},{id:"mo",from:"mac",to:"observer",kind:"down",label:"Down",meta:"lost"}]},pathTotals:{direct:1,p2p:1,relay:1,broken:1},latency:[{time:"09:00",p2p:42,direct:12,relay:96},{time:"10:00",p2p:39,direct:12,relay:88},{time:"11:00",p2p:44,direct:14,relay:91},{time:"12:00",p2p:38,direct:12,relay:84},{time:"13:00",p2p:36,direct:11,relay:86},{time:"14:00",p2p:41,direct:13,relay:93}],candidates:[["Studio-PC","Linux-runner-02","P2P","symmetric NAT","38ms","0.3%"],["Studio-PC","MacBook-build","Direct","open port 4178","12ms","0.0%"],["Linux-runner-02","Observer-01","Relay","udp blocked","84ms","1.1%"],["MacBook-build","Observer-01","Interrupted","sleep","-","-"]]};function erF({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){return(0,ey.jsx)(Jy,{boardId:"runtime-operations",definitions:erD,initialLayouts:erR,clipboardItems:e,actionLabel:"运行页面卡片操作",paletteGroupTitle:"运行页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}!function(e=er$){erz("机器","机器组"),erz("在线","机器心跳"),erz("Runtime","Agent runtime"),erz("Token","机器注册"),erz("机器组","机器组"),erz("拓扑图","网络拓扑"),erz("直连","网络拓扑"),erz("P2P","网络拓扑"),erz("Relay","网络拓扑"),erz("中断","网络拓扑"),erz("延迟","网络遥测"),erz("候选路径","网络候选路径")}(),erz("日志与审计","审计事件"),erz("筛选","审计筛选"),erz("拒绝事件","审计事件"),erz("事件趋势","审计事件");let erB={metrics:{online:0,health:0,latency:"local",events:0},machines:[],trend:[],networkLinks:[],events:[],serviceHealth:[]};function erV({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){let r=function(e,t){let[n,r]=ew.useState(t);return ew.useEffect(()=>{let n=!0,a=!1;async function i(){if(!a){a=!0;try{let t=await fetch(eD(e),{cache:"no-store"});if(!t.ok)return;let a=await t.json();n&&r(a)}catch{n&&r(t)}finally{a=!1}}}i();let o=window.setInterval(i,2e3);return()=>{n=!1,window.clearInterval(o)}},[t,e]),n}("/api/local/machines/telemetry",erB),a=ew.useMemo(()=>erT(r),[r]);return(0,ey.jsx)(Jy,{boardId:"telemetry",definitions:a,initialLayouts:erL,clipboardItems:e,actionLabel:"遥测页面卡片操作",paletteGroupTitle:"遥测页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}function erH({className:e,title:t="Vantaloom"}){return(0,ey.jsxs)("svg",{viewBox:"180 350 1130 260",fill:"currentColor",role:"img","aria-label":t,className:(0,eI.cn)("[[data-vtl-theme=jelly]_&]:opacity-70",e),children:[(0,ey.jsx)("path",{d:"m658 393 2 1v47l57 1v1l-12 2-45 5v89l2 14 4 7 6 3h12l8-2-5-10-1-4v-11l3-8 4-6 7-7 14-8 16-6 33-9h3l-1-16-4-8-6-5-10-3h-15l-13 3-16 7-7 5 1-4 8-8 14-8 12-4 7-1h23l16 4 9 6 4 5 4 9 1 5 1 69 2 11 3 5 7 5v1h-28l-6-4-4-11v-7h-2l-2 4-7 8-11 8-10 4-4 1h-21l-9-4-7-5-14 7-7 2h-18l-11-4-6-5-5-10-1-4-1-33v-61l1-4-26 3-9-7-4-3 4-1 34-2v-34l2-5zm107 104-19 6-17 8-10 9-4 8-1 4v11l3 8 8 7 7 2h8l10-3 10-7 6-7 1-2v-44z"}),(0,ey.jsx)("path",{d:"m1147 452h15l11 3 10 9 5 10v3h2l2-5 10-10 12-7 11-3h18l10 3 6 4 7 8 4 12 1 9 1 62 3 12 4 5 3 3h-38l-1-86-2-9-5-7-7-3h-12l-10 3-9 6-7 8-1 88h-26l-1-88-3-9-5-6-6-2h-11l-9 3-9 7-4 6-1 89h-34l6-14 4-19 1-10v-28l-3-19-6-18-4-9h28l3 8 3 13 7-8 8-7 10-5z"}),(0,ey.jsx)("path",{d:"m556 449h19l13 4 10 9 4 9 2 13 1 67 3 10 4 5 5 4h-40l-1-85-3-12-4-6-7-4-3-1h-14l-11 4-10 7-5 8-1 6-1 83h-25l-1-99-2-17 1-1h24l2 6 2 13 9-10 12-8 11-4z"}),(0,ey.jsx)("path",{d:"m409 450h22l16 4 9 6 6 9 3 11 1 71 2 9 3 5 6 4v1h-27l-6-4-3-7-2-9-11 12-13 8-9 3-7 1h-13l-12-3-10-7-6-10-1-4v-13l5-12 4-5 12-9 18-8 35-10 6-2v-14l-3-8-5-5-7-3-4-1h-15l-13 3-20 10 6-9 10-7 13-5zm27 47-23 8-13 7-8 7-5 9-1 4v11l5 10 5 4 8 3h10l11-4 8-6 5-6 1-4v-43z"}),(0,ey.jsx)("path",{d:"m918 450h22l15 3 16 8 12 11 7 8 7 14 3 11v21l-3 12-4 8-5-5-8-17-11-33-7-13-9-10-10-6-7-2h-12l-11 4-8 7-7 10-4 13-1 7v18l3 14 4 10 6 8 9 8 10 4 6 1h9l9-2 7-4 5 1 5 5v2l-10 5-13 3h-22l-15-4-16-8-10-9-6-7-7-14-3-14v-16l3-13 6-12 8-10 12-9 12-5z"}),(0,ey.jsx)("path",{d:"m224 442h17l15 3 10 5 10 9 9 13 14 29 13 28 6 14v2h2l1-5 16-39 17-40 4-8h9l-2 6-18 42-11 26-17 40-9 21-3-1-29-58-10-19-12-23-8-11-9-10-9-7-10-4-5-1h-19l-15 3 4-4 13-6 16-4z"}),(0,ey.jsx)("path",{d:"m1010 450h19l17 4 13 7 12 11 7 11 5 13 2 11v10l-3 16-4 10-9 12-8 7-12 7-13 4-7 1h-25l-16-4-13-7-11-9-7-9-7-14-2-9v-17l3-12 5-10 3-1 7 18 11 33 8 14 8 9 8 5 12 3h8l12-3 10-7 6-8 5-12 2-11v-19l-3-14-5-12-8-10-10-6-7-2h-13l-11 4-6 4-4-2-6-5 3-3 10-5z"}),(0,ey.jsx)("path",{d:"m848 371h1l1 171 2 9 4 6 6 5 19 5 6 2v1h-65l-1-188z"})]})}function erW(e){return()=>new Promise(t=>{e(),window.setTimeout(t,60)})}function erU(e){return"u"<typeof document?null:document.querySelector(e)}function erq(){return null!=erU('[role="menu"]')}function erK(){return null!=erU('[data-tour="init-wizard"]')}function erG(){let e=erU('[data-tour="init-wizard"] [aria-current="step"]'),t=e?.getAttribute("aria-label")?.match(/第\s*(\d+)/);return t?Number(t[1]):0}var erX=e.i(64990);function erY(){let e=su(),[t,n]=ew.useState(!1);ew.useEffect(()=>{try{n("1"===window.localStorage.getItem("vtl:sidebar-collapsed"))}catch{}},[]);let r=ew.useCallback(()=>{n(e=>{let t=!e;try{window.localStorage.setItem("vtl:sidebar-collapsed",t?"1":"0")}catch{}return t})},[]),[a,i]=ew.useState("home"),[o,l]=ew.useState(!1),[s,c]=ew.useState(),[u,d]=ew.useState([]),[f,h]=ew.useState([]),[p,m]=ew.useState("conversation"),[g,v]=ew.useState(0),x=s?.conversation.id,y=s?.conversation.ownerMachineId;ew.useEffect(()=>{d([]),h([]),m("conversation")},[x]),ew.useEffect(()=>{let e;if(!x||"new-agent-conversation"!==a)return void h([]);let t=!1,n=async()=>{let r=await sj(x,y);t||(h(r),e=window.setTimeout(n,!function e(t){return t.some(t=>t.running||e(t.children??[]))}(r)?6e3:2e3))};return n(),()=>{t=!0,e&&window.clearTimeout(e)}},[x,y,a]);let[b,w]=ew.useState(),[j,k]=ew.useState(!1),[S,C]=ew.useState([]),[N,M]=ew.useState([]),[E,O]=ew.useState({}),[P,A]=ew.useState(),[I,z]=ew.useState(dg),[_,D]=ew.useState([]),[R,T]=ew.useState(),[L,$]=ew.useState(),[F,B]=ew.useState(),V=ew.useRef(!1),H=ew.useCallback(e=>{z(t=>iH(e,t))},[]),W=ew.useCallback(e=>{D(t=>iH(e,t))},[]),U=ew.useCallback(async(e,t)=>{try{let n=await sS(e,t);c(n),i("new-agent-conversation")}catch(n){if(n instanceof sh){let r=n.openedBy?.displayName||"另一台设备";window.confirm(`此对话正在「${r}」上打开,无法同时操作。是否强制接管(对方将被踢出)?`)&&(c(await sS(e,t,{force:!0})),i("new-agent-conversation"));return}throw n}},[]),q=ew.useCallback(async(e,t)=>{d([]),await U(e,t)},[U]),K=ew.useCallback(()=>{c(void 0),i("new-agent-conversation")},[]),G=ew.useCallback(async()=>{let e=await sb();e?await U(e.conversation.id,e.conversation.ownerMachineId):K()},[U,K]),X=ew.useCallback(async()=>{V.current=!0,z(dg),D([]),i("new-canvas");try{let e=await ZL({title:"新画布",nodes:dg,edges:[]});$(e.canvas.id),B("local")}catch{$(void 0),B(void 0),V.current=!1}},[]),Y=ew.useCallback(async(e,t)=>{try{await ZF(e,t);let n=await ZT(e,t);V.current=!0,z(n.nodes),D(n.edges),$(n.canvas.id),B(n.canvas.ownerMachineId),i("new-canvas")}catch{}},[]);ew.useEffect(()=>{if(!L)return;if(V.current){V.current=!1;return}let e=window.setTimeout(()=>{Z$(L,{nodes:I,edges:_,nodeIds:I.map(e=>e.id)},F).catch(()=>{})},800);return()=>window.clearTimeout(e)},[I,_,L,F]);let Z=ew.useCallback(({item:t})=>{if(!e||"new-canvas"!==t.id&&"all-canvases"!==t.id&&"open-recent-canvas"!==t.id){if("new-canvas"===t.id)return void X();if("all-canvases"===t.id)return void i("all-canvases");if("new-agent-conversation"===t.id)return void K();if("open-recent-conversation"===t.id)return void G();if("runs"===t.id)return void i("runs");if("telemetry"===t.id)return void i("telemetry");("preferences"===t.id||"preferences-model-routes"===t.id||"preferences-agent-config"===t.id||"preferences-subagent-config"===t.id||"preferences-cc-engine-config"===t.id||"preferences-layout"===t.id||"check-update"===t.id||"account"===t.id)&&i(t.id)}},[X,e,G,K]),{start:J}=(0,erX.useTour)(),Q=ew.useCallback(()=>{var e;J((e={select:e=>Z({item:{id:e}}),startNewConversation:K,goHome:()=>{i("home"),c(void 0)}},{id:"product-tour",steps:[{id:"intro",centered:!0,title:"欢迎使用 Vantaloom 👋",body:(0,ey.jsxs)(ey.Fragment,{children:["这是一份手把手向导,会高亮关键位置并在需要时",(0,ey.jsx)("b",{children:"请你亲自操作"}),"(没做完不会出现「下一步」)。 全程界面都可正常点击;随时按 ",(0,ey.jsx)("kbd",{children:"Esc"})," 或右上角 ✕ 退出。"]})},{id:"theme",before:erW(()=>e.goHome()),target:()=>erU('[role="menu"]')??erU('[data-tour="account-button"]'),gate:erq,gateHint:"点击用户名按钮展开菜单",padding:6,title:"切换主题",body:(0,ey.jsxs)(ey.Fragment,{children:["点击左下角的 ",(0,ey.jsx)("b",{children:"用户名按钮"})," 打开菜单。展开后,里面的 ",(0,ey.jsx)("b",{children:"外观 / 主题"})," 项每点一次就在"," ",(0,ey.jsx)("b",{children:"浅色 → 深色 → 果冻"})," 之间循环。"]})},{id:"model-routes-add",before:erW(()=>e.select("preferences-model-routes")),target:()=>erU('[data-tour="model-route-form"]')??erU('[data-tour="add-model-route"]'),gate:()=>null!=erU('[data-tour="model-route-form"]'),gateHint:"点击「添加模型路由」",title:"配置模型渠道(1/2)",body:(0,ey.jsxs)(ey.Fragment,{children:["进入 ",(0,ey.jsx)("b",{children:"设置 → 模型路由"}),"。请点 ",(0,ey.jsx)("b",{children:"添加模型路由"})," 新增一个第三方渠道(任何 OpenAI / Anthropic 兼容 API 都行)。"]})},{id:"model-routes-fields",before:erW(()=>e.select("preferences-model-routes")),target:'[data-tour="model-route-form"]',waitForTarget:2500,title:"配置模型渠道(2/2)",body:(0,ey.jsxs)(ey.Fragment,{children:["表单各项:",(0,ey.jsx)("b",{children:"提供商名称"})," 仅作标识;",(0,ey.jsx)("b",{children:"协议"})," 选 OpenAI / Anthropic 风格;",(0,ey.jsx)("b",{children:"Endpoint URL"})," 填到 ",(0,ey.jsx)("code",{children:"/v1"})," 这一级;",(0,ey.jsx)("b",{children:"API Key"})," 是密钥;",(0,ey.jsx)("b",{children:"可用模型"})," 勾选启用并可设上下文长度。",(0,ey.jsx)("br",{}),"⚠️ 填完",(0,ey.jsx)("b",{children:"务必点「保存」"}),",否则不生效。"]})},{id:"agent-config-compression",before:erW(()=>e.select("preferences-agent-config")),target:'[data-tour="agent-config-compression"]',title:"代理配置 · 压缩上下文",body:(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("b",{children:"设置 → 代理配置"})," 的第一块:当对话 token 接近模型上下文窗口的设定百分比时,自动用",(0,ey.jsx)("b",{children:"压缩模型"})," 压缩历史。阈值 0% 表示关闭,建议 70%-85%。"]})},{id:"agent-config-summary",before:erW(()=>e.select("preferences-agent-config")),target:'[data-tour="agent-config-summary"]',title:"代理配置 · 对话摘要",body:(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("b",{children:"对话摘要"}),":开启后用",(0,ey.jsx)("b",{children:"摘要模型"}),"自动生成 / 更新对话标题与每轮的轮次标题,方便在侧边栏 与时间轴里快速辨认。"]})},{id:"agent-config-approval",before:erW(()=>e.select("preferences-agent-config")),target:'[data-tour="agent-config-approval"]',title:"代理配置 · 命令审批",body:(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("b",{children:"命令审批"}),":在 Auto 权限模式下,用",(0,ey.jsx)("b",{children:"审批模型"})," + ",(0,ey.jsx)("b",{children:"审批提示词"})," 判断 Agent 发起的命令 是否自动放行。留空则非危险命令全部放行。改完记得 ",(0,ey.jsx)("b",{children:"保存"}),"。"]})},{id:"subagent-explore",before:erW(()=>e.select("preferences-subagent-config")),target:'[data-tour="subagent-explore"]',title:"子代理 · 探索",body:(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("b",{children:"设置 → 子代理配置"}),"。",(0,ey.jsx)("b",{children:"探索"})," 子代理擅长只读检索代码 / 资料。可单独设它的",(0,ey.jsx)("b",{children:"使用模型"}),"(留空则继承上级)与",(0,ey.jsx)("b",{children:"系统提示词"}),"。"]})},{id:"subagent-workflow",before:erW(()=>e.select("preferences-subagent-config")),target:'[data-tour="subagent-workflow"]',title:"子代理 · 工作流",body:(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("b",{children:"工作流"})," 子代理负责多步骤任务编排,同样可单独配模型与提示词。"]})},{id:"subagent-operator",before:erW(()=>e.select("preferences-subagent-config")),target:'[data-tour="subagent-operator"]',title:"子代理 · 操作",body:(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("b",{children:"操作"})," 子代理执行写文件 / 跑命令等动手类任务,工具集固定。"]})},{id:"subagent-custom",before:erW(()=>e.select("preferences-subagent-config")),target:'[data-tour="subagent-custom"]',title:"子代理 · 自定义",body:(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("b",{children:"自定义子代理"}),":主 Agent 可自取名字、从你设的",(0,ey.jsx)("b",{children:"可用模型池"}),"里挑模型来召唤,拥有完整 工具集,还能再派发上面三种官方子代理。"]})},{id:"check-update",before:erW(()=>e.select("check-update")),target:'[data-tour="check-update"]',title:"检查更新",body:(0,ey.jsxs)(ey.Fragment,{children:["这里查看各机器的运行时版本并 ",(0,ey.jsx)("b",{children:"立即更新"}),"。原理:从 npm 拉取最新运行时包、就地替换二进制与 前端,",(0,ey.jsx)("b",{children:"无需重装"}),";P2P mesh 未变时更新还",(0,ey.jsx)("b",{children:"不需要管理员权限"}),"。"]})},{id:"hub-account",before:erW(()=>e.select("account")),target:'[data-tour="hub-account"]',title:"Hub 账户",body:(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("b",{children:"设置 → Hub 账户"}),"。上方是你的",(0,ey.jsx)("b",{children:"账户信息"}),"与",(0,ey.jsx)("b",{children:"设备绑定"}),"状态——Hub 负责多机互联、组网 下发与云端身份。"]})},{id:"hub-account-danger",before:erW(()=>e.select("account")),target:'[data-tour="hub-account-danger"]',title:"Hub 账户 · 危险操作",body:(0,ey.jsxs)(ey.Fragment,{children:["下方的 ",(0,ey.jsx)("b",{children:"危险操作"})," 区可",(0,ey.jsx)("b",{children:"解除设备绑定"}),"或",(0,ey.jsx)("b",{children:"退出登录"}),"。这些操作不可逆,会把本机移出 账户,请谨慎。"]})},{id:"new-conversation",before:erW(()=>e.goHome()),target:'[data-tour="home-new-conversation"]',gate:erK,gateHint:"点击「新建对话」继续",title:"创建新对话",body:(0,ey.jsxs)(ey.Fragment,{children:["回到主页,请点 ",(0,ey.jsx)("b",{children:"新建对话"})," 进入初始化向导(侧边栏顶部也有同样入口)。"]})},{id:"wizard-1",target:'[data-tour="init-wizard"]',placement:"left",padding:4,waitForTarget:5e3,gate:()=>!erK()||erG()>=2,gateHint:"配好运行环境后点向导的「下一步」",title:"向导 ① 运行环境与引擎",body:(0,ey.jsxs)(ey.Fragment,{children:["先选在",(0,ey.jsx)("b",{children:"哪台机器"}),"上运行;本机运行时还能选 ",(0,ey.jsx)("b",{children:"运行引擎"}),"——",(0,ey.jsx)("b",{children:"Vantaloom"})," / ",(0,ey.jsx)("b",{children:"Claude Code"})," / ",(0,ey.jsx)("b",{children:"reclaude"}),"(Claude Code 仅限本机)。 整个向导区域已高亮,配好后点向导自己的 ",(0,ey.jsx)("b",{children:"下一步"}),"。"]})},{id:"wizard-2",target:'[data-tour="init-wizard"]',placement:"left",padding:4,gate:()=>!erK()||erG()>=3,gateHint:"选好工作目录后点向导的「下一步」",title:"向导 ② 选择工作目录",body:(0,ey.jsxs)(ey.Fragment,{children:["先给对话",(0,ey.jsx)("b",{children:"起个名字"}),",再选 ",(0,ey.jsx)("b",{children:"工作目录"}),"——这是智能体能读写的根目录 (Claude Code 用单个目录作为工作根目录)。选好后点向导的「下一步」。"]})},{id:"wizard-3",target:'[data-tour="init-wizard"]',placement:"left",padding:4,gate:()=>!erK()||erG()>=4,gateHint:"配好模型后点向导的「下一步」",title:"向导 ③ 模型设置",body:(0,ey.jsxs)(ey.Fragment,{children:["选择这段对话使用的",(0,ey.jsx)("b",{children:"模型"}),"——",(0,ey.jsx)("b",{children:"Vantaloom"})," 用你刚配置的模型路由,",(0,ey.jsx)("b",{children:"Claude Code"})," 则由其自身提供模型。选好后点向导的「下一步」。"]})},{id:"wizard-4",target:'[data-tour="init-wizard"]',placement:"left",padding:4,gate:()=>!erK(),gateHint:"点向导的「确认开始」创建对话",title:"向导 ④ 确认开始",body:(0,ey.jsxs)(ey.Fragment,{children:["核对无误后,点向导右下角的 ",(0,ey.jsx)("b",{children:"确认开始"})," 创建对话。创建成功后会自动进入对话界面。"]})},{id:"composer-toolbar",target:'[data-slot="agent-input-composer-toolbar"]',waitForTarget:6e3,title:"输入框下方的按钮",body:(0,ey.jsxs)(ey.Fragment,{children:["输入框下面一排:",(0,ey.jsx)("b",{children:"权限模式"}),"(工具调用是否需审批)、",(0,ey.jsx)("b",{children:"模型选择"}),"、右侧 ",(0,ey.jsx)("b",{children:"发送 / 停止"}),"按钮(运行中变停止),以及 ",(0,ey.jsx)("b",{children:"上下文用量"})," 指示。"]})},{id:"queue-stack",target:'[data-slot="agent-input-composer-textarea"]',waitForTarget:3e3,title:"待发送栈(Tab 键)",body:(0,ey.jsxs)(ey.Fragment,{children:["输入内容后按 ",(0,ey.jsx)("kbd",{children:"Tab"})," 可把它压入",(0,ey.jsx)("b",{children:"待发送栈"}),"而不立即发送,便于排队多条指令。栈里每条都能 点击:用 ",(0,ey.jsx)("b",{children:"引导"})," 在合适时机插入对话,或删除。"]})},{id:"pane-toolbar",target:'[data-tour="pane-toolbar"]',waitForTarget:3e3,title:"工作区顶栏",body:(0,ey.jsxs)(ey.Fragment,{children:["右侧工作区最上面一排:左边 ",(0,ey.jsx)("b",{children:"布局标签"})," 切换分屏预设,中间 ",(0,ey.jsx)("b",{children:"位置切换"})," 控制对话面板在左 / 居中 / 在右。"]})},{id:"pane-split",target:'[aria-label="上下二分"]',waitForTarget:4e3,gate:()=>null!=erU('[aria-label="上下二分"][data-state="active"]'),gateHint:"点「上下二分」分栏",title:"动手 · 上下分栏",body:(0,ey.jsxs)(ey.Fragment,{children:["在布局标签里点 ",(0,ey.jsx)("b",{children:"上下二分"}),"(顶部面板图标),把右侧工作区分成上下两块。"]})},{id:"pane-add-top",target:'[data-tour="pane-add"]',waitForTarget:3e3,gate:()=>null!=erU('[placeholder="搜索组件..."]')||null!=erU('[data-slot="multi-tab-list"]'),gateHint:"点上面板的「添加」",autoAdvance:!0,title:"动手 · 添加上面板组件",body:(0,ey.jsxs)(ey.Fragment,{children:["点",(0,ey.jsx)("b",{children:"上面板"}),"中间的 ",(0,ey.jsx)("b",{children:"添加"})," 按钮,打开组件选择面板。"]})},{id:"pane-pick-multitab",target:'[data-tour="pane-template-multi-tab-system"]',waitForTarget:3e3,gate:()=>null!=erU('[data-slot="multi-tab-list"]'),gateHint:"选择「多标签页系统」",title:"动手 · 选多文件标签组件",body:(0,ey.jsxs)(ey.Fragment,{children:["在弹出面板里找到 ",(0,ey.jsx)("b",{children:"多标签页系统"}),"(即多文件标签组件)并点击添加,它会填入上面板。"]})},{id:"multi-tab",target:'[data-slot="multi-tab-list"]',waitForTarget:3e3,title:"多文件标签组件",body:(0,ey.jsxs)(ey.Fragment,{children:["顶部是",(0,ey.jsx)("b",{children:"多文件标签条"}),":点 ",(0,ey.jsx)("b",{children:"+"})," 新增标签、点标签切换文件、",(0,ey.jsx)("b",{children:"×"})," 关闭。单文件内还能在",(0,ey.jsx)("b",{children:"查看 / 编辑"})," 与 ",(0,ey.jsx)("b",{children:"代码 / 预览 / 十六进制"})," 间切换,编辑后记得保存。"]})},{id:"pane-add-bottom",target:'[data-tour="pane-add"]',waitForTarget:3e3,gate:()=>null!=erU('[placeholder="搜索组件..."]')||null!=erU('[data-slot="terminal-tab-group"]'),gateHint:"点下面板的「添加」",autoAdvance:!0,title:"动手 · 添加下面板组件",body:(0,ey.jsxs)(ey.Fragment,{children:["现在点",(0,ey.jsx)("b",{children:"下面板"}),"的 ",(0,ey.jsx)("b",{children:"添加"})," 按钮,再次打开组件选择面板。"]})},{id:"pane-pick-terminal",target:'[data-tour="pane-template-terminal-tab-group"]',waitForTarget:3e3,gate:()=>null!=erU('[data-slot="terminal-tab-group"]'),gateHint:"选择「终端标签组」",title:"动手 · 选终端",body:(0,ey.jsxs)(ey.Fragment,{children:["在面板里找到 ",(0,ey.jsx)("b",{children:"终端标签组"})," 并点击添加,它会填入下面板。"]})},{id:"terminal",target:'[data-slot="terminal-tab-group"]',waitForTarget:3e3,title:"终端组件",body:(0,ey.jsxs)(ey.Fragment,{children:["终端支持多会话标签:点 ",(0,ey.jsx)("b",{children:"+"})," 新开会话、点标签切换、",(0,ey.jsx)("b",{children:"×"})," 关闭。直接输入命令即可,输出实时回显,与本机真实 shell 一致。"]})},{id:"pane-cut-clear",target:'[aria-label="剪切窗口内容"]',waitForTarget:3e3,title:"剪切与粉碎",body:(0,ey.jsxs)(ey.Fragment,{children:["顶栏的 ",(0,ey.jsx)("b",{children:"剪切"}),"(剪刀)把窗口内容移动到别处;",(0,ey.jsx)("b",{children:"粉碎"}),"(碎纸机)清空该窗口。均对单个 pane 生效。"]})},{id:"control-room",target:'[data-tour="control-room-toggle"]',waitForTarget:3e3,title:"导播台视角",body:(0,ey.jsxs)(ey.Fragment,{children:["点位置切换中间的 ",(0,ey.jsx)("b",{children:"「隐藏面板」"}),"(矩形图标)进入",(0,ey.jsx)("b",{children:"导播台"}),":对话偏左,右侧悬浮显示主 Agent 与各子 Agent 的实时预览小窗,点小窗即可切换主面板。"]})},{id:"outro",centered:!0,title:"完成 🎉",body:(0,ey.jsxs)(ey.Fragment,{children:["你已走过核心功能。随时可从空白页的 ",(0,ey.jsx)("b",{children:"使用教程"})," 重新打开本向导。开始创造吧!"]})}]}))},[Z,K,J]),ee=ew.useCallback(()=>{i("account")},[]);return(0,ey.jsxs)("main",{className:"vtl-app-background relative flex h-svh overflow-hidden text-foreground",children:[e?(0,ey.jsx)(et$,{navItems:etV,contents:etH,activeWorkspace:a,activeConversationId:s?.conversation.id,onItemSelect:Z,onOpenConversation:(e,t)=>{q(e,t)},onOpenConversationSettings:(e,t)=>{w({id:e,owner:t})},onConversationDeleted:e=>{s?.conversation.id===e&&(c(void 0),i("home")),w(t=>t?.id===e?void 0:t)},onAccountSettings:ee,subagentTree:f,activeSubagentPath:u,onOpenSubagent:e=>d(e),title:"new-agent-conversation"===a&&s?s.conversation.title?.trim()||"新 Agent 对话":Z6.product,trailing:"new-agent-conversation"===a&&s?(0,ey.jsx)(wF,{view:p,onViewChange:m,paneCount:g}):(0,ey.jsx)(erk,{})}):(0,ey.jsxs)(ey.Fragment,{children:[(0,ey.jsx)("div",{className:(0,eI.cn)("relative hidden h-svh shrink-0 overflow-hidden p-3 transition-[width,padding] duration-300 ease-out md:block",t?"w-0 p-0":"w-[19.5rem]"),children:(0,ey.jsx)(eeq,{navItems:etV,contents:etH,activeWorkspace:a,activeConversationId:s?.conversation.id,activeCanvasId:L,onItemSelect:Z,onOpenConversation:(e,t)=>{q(e,t)},onOpenCanvas:(e,t)=>{Y(e,t)},onOpenConversationSettings:(e,t)=>{w({id:e,owner:t})},onConversationDeleted:e=>{s?.conversation.id===e&&(c(void 0),i("home")),w(t=>t?.id===e?void 0:t)},onAccountSettings:ee,subagentTree:f,activeSubagentPath:u,onOpenSubagent:e=>d(e)})}),(0,ey.jsx)("div",{className:(0,eI.cn)("group/sb-handle absolute inset-y-0 z-30 hidden w-8 md:block","transition-[left] duration-300 ease-out",t?"left-0":"left-[18.5rem]"),children:(0,ey.jsx)("button",{type:"button",onClick:r,"aria-label":t?"展开侧边栏":"收起侧边栏",title:t?"展开侧边栏":"收起侧边栏",className:"absolute top-1/2 left-0 flex h-14 w-6 -translate-y-1/2 items-center justify-center rounded-r-md border border-l-0 border-border bg-background/85 text-muted-foreground opacity-0 shadow-md backdrop-blur transition-opacity duration-200 hover:text-foreground focus-visible:opacity-100 group-hover/sb-handle:opacity-100",children:t?(0,ey.jsx)(tt,{className:"size-4"}):(0,ey.jsx)(te,{className:"size-4"})})})]}),(0,ey.jsxs)("section",{className:(0,eI.cn)("relative h-full min-w-0 flex-1 overflow-hidden",e&&"pt-[calc(3rem+env(safe-area-inset-top))]"),children:["runs"===a?(0,ey.jsx)(erF,{clipboardItems:S,onClipboardItemsChange:C,onOverlayOpenChange:k}):"telemetry"===a?(0,ey.jsx)(erV,{clipboardItems:S,onClipboardItemsChange:C,onOverlayOpenChange:k}):"preferences-model-routes"===a?(0,ey.jsx)(erg,{section:"model-routes"}):"preferences-agent-config"===a?(0,ey.jsx)(erg,{section:"agent-config"}):"preferences-subagent-config"===a?(0,ey.jsx)(erg,{section:"subagent-config"}):"preferences-cc-engine-config"===a?(0,ey.jsx)(erg,{section:"cc-engine-config"}):"preferences-layout"===a?(0,ey.jsx)(erg,{section:"layout"}):"preferences"===a?(0,ey.jsx)(erg,{}):"check-update"===a?(0,ey.jsx)(erb,{}):"account"===a?(0,ey.jsx)(etG,{}):e||"new-canvas"!==a?e||"all-canvases"!==a?"new-agent-conversation"===a?(0,ey.jsx)(ZO,{conversation:s,clipboardItems:S,clipboardDraggingId:P,onClipboardItemsChange:C,onClipboardDraggingChange:A,onOverlayOpenChange:l,onConversationCreated:e=>{c(e)},onCancelDraft:()=>i("home"),subagentStack:u,onSubagentStackChange:d,subagentTree:f,mobileView:p,onMobilePaneCountChange:v}):e?(0,ey.jsx)(erJ,{activeConversationId:s?.conversation.id,onItemSelect:Z,onOpenConversation:(e,t)=>{q(e,t)},onOpenConversationSettings:(e,t)=>{w({id:e,owner:t})},onConversationDeleted:e=>{w(t=>t?.id===e?void 0:t)}}):(0,ey.jsx)(erZ,{onNewConversation:K,onStartTour:Q}):(0,ey.jsx)(eeh,{clipboardItems:S,onClipboardItemsChange:C,onOverlayOpenChange:k}):(0,ey.jsx)(eeb,{nodes:I,edges:_,selectedNodeId:R,clipboardItems:S,onNodesChange:H,onEdgesChange:W,onNodesSet:z,onEdgesSet:D,onSelectedNodeChange:T,onClipboardItemsChange:C}),b?(0,ey.jsx)("div",{className:(0,eI.cn)("absolute inset-0 z-30",e&&"pt-[calc(3rem+env(safe-area-inset-top))]"),children:(0,ey.jsx)(Z_,{conversationId:b.id,ownerMachineId:b.owner,open:!0,onOpenChange:e=>{e||w(void 0)},onEnterConversation:(e,t)=>{q(e,t)}})}):null,(0,ey.jsx)(eek,{hidden:!!b||("new-agent-conversation"===a?o:j),items:S,trashItems:N,draggingId:P,onDraggingChange:A,onItemsChange:C,onTrashItemsChange:M,onTrashClipboardItemsChange:O,trashClipboardItems:E})]})]})}function erZ({onNewConversation:e,onStartTour:t}){return(0,ey.jsxs)("div",{className:"vtl-app-background flex h-full min-h-0 flex-col items-center justify-center gap-5 px-6 text-center",children:[(0,ey.jsx)(erH,{className:"h-20 w-auto max-w-[78vw] text-foreground"}),(0,ey.jsx)("p",{className:"max-w-sm text-sm text-muted-foreground",children:"从左侧选择一个会话,或新建对话"}),(0,ey.jsxs)("div",{className:"flex flex-wrap items-center justify-center gap-3",children:[(0,ey.jsxs)(eA.Button,{type:"button",onClick:e,"data-tour":"home-new-conversation",children:[(0,ey.jsx)(e9,{className:"size-4"}),"新建对话"]}),(0,ey.jsxs)(eA.Button,{type:"button",variant:"outline",onClick:t,children:[(0,ey.jsx)(e7,{className:"size-4"}),"使用教程"]})]})]})}function erJ({activeConversationId:e,onItemSelect:t,onOpenConversation:n,onOpenConversationSettings:r,onConversationDeleted:a}){return(0,ey.jsx)("div",{className:"vtl-app-background flex h-full min-h-0 flex-col px-3 pt-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]",children:(0,ey.jsx)(eeZ,{activeConversationId:e,onItemSelect:t,onOpenConversation:n,onOpenConversationSettings:r,onConversationDeleted:a})})}function erQ(){let{ready:e,user:t,logout:n}=e8();return e?t?(0,ey.jsx)(erY,{}):(0,ey.jsx)(e4,{onComplete:()=>{window.location.reload()}}):(0,ey.jsx)("main",{className:"grid min-h-svh place-items-center bg-background",children:(0,ey.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,ey.jsx)("div",{className:"size-8 animate-spin rounded-full border-2 border-muted-foreground/20 border-t-primary"}),(0,ey.jsx)("span",{className:"text-sm text-muted-foreground",children:"连接中..."})]})})}function er0(){return(0,ey.jsx)(e6,{children:(0,ey.jsx)(erQ,{})})}e.s(["default",()=>er0],66204)}]);
|