@vantaloom/runtime-linux-x64 0.1.17 → 0.1.18
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 +0 -0
- package/bin/vantaloom-api +0 -0
- package/bin/vantaloomctl +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/{3ffdc0da802a79d3.js → 4950d4997283c964.js} +4 -4
- package/web/_next/static/chunks/{cff85d0d4e4a1b1f.css → 50eaeaad6e6d8caa.css} +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 +2 -2
- package/web/index.txt +3 -3
- /package/web/_next/static/{OunCKQwMWsLiykb4Oalf0 → gShSk6P-D1ehPbGV25rzp}/_buildManifest.js +0 -0
- /package/web/_next/static/{OunCKQwMWsLiykb4Oalf0 → gShSk6P-D1ehPbGV25rzp}/_clientMiddlewareManifest.json +0 -0
- /package/web/_next/static/{OunCKQwMWsLiykb4Oalf0 → gShSk6P-D1ehPbGV25rzp}/_ssgManifest.js +0 -0
|
@@ -13,12 +13,12 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
|
|
|
13
13
|
${r} [data-chart=${e}] {
|
|
14
14
|
${n.map(([e,n])=>{let r=n.theme?.[t]??n.color;return r?` --color-${e}: ${r};`:null}).filter(Boolean).join("\n")}
|
|
15
15
|
}
|
|
16
|
-
`).join("\n")}}):null}let Fj=function(e){var t,n,r,i,a,o,l,s,c,d,u=Cs(e,$B),{active:f,allowEscapeViewBox:h,animationDuration:p,animationEasing:m,content:g,filterNull:v,isAnimationActive:x,offset:y,payloadUniqBy:b,position:w,reverseDirection:j,useTranslate3d:k,wrapperStyle:S,cursor:C,shared:N,trigger:M,defaultIndex:E,portal:O,axisId:P}=u,A=ww(),z="number"==typeof E?String(E):E;(0,ew.useEffect)(()=>{A(_e({shared:N,trigger:M,axisId:P,active:f,defaultIndex:z}))},[A,N,M,P,f,z]);var _=S_(),I=RE(),D=wC(e=>z5(e,N)),{activeIndex:T,isActive:R}=null!=(c=wC(e=>I2(e,D,M,z)))?c:{},L=wC(e=>I1(e,D,M,z)),$=wC(e=>I0(e,D,M,z)),F=wC(e=>IQ(e,D,M,z)),V=(0,ew.useContext)(RK),B=null!=(d=null!=f?f:R)&&d,[H,W]=$s([L,B]),q="axis"===D?$:void 0;t=wC(e=>((e,t,n)=>{if(null!=t){var r=_v(e);return"axis"===t?"hover"===n?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:"hover"===n?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}})(e,D,M)),n=wC(It),r=wC(MB),i=wC(MF),a=wC(MV),l=(null==(o=wC(RH))?void 0:o.sourceViewBox)!=null,s=S_(),(0,ew.useEffect)(()=>{if(!l&&null!=i&&null!=r){var e=_l({active:B,coordinate:F,dataKey:t,index:T,label:"number"==typeof q?String(q):q,sourceViewBox:s,graphicalItemId:n});RF.emit(RV,i,e,r)}},[l,F,t,n,T,q,r,i,a,B,s]);var U=null!=O?O:V;if(null==U||null==_||null==D)return null;var K=null!=L?L:$V;B||(K=$V),v&&K.length&&(K=$l(K.filter(e=>null!=e.value&&(!0!==e.hide||u.includeHidden)),b,$F));var G=K.length>0,Y=$$($$({},u),{},{payload:K,label:q,active:B,activeIndex:T,coordinate:F,accessibilityLayer:I}),X=ew.createElement($a,{allowEscapeViewBox:h,animationDuration:p,animationEasing:m,isAnimationActive:x,active:B,coordinate:F,hasPayload:G,offset:y,position:w,reverseDirection:j,useTranslate3d:k,viewBox:_,wrapperStyle:S,lastBoundingBox:H,innerRef:W,hasPortalFromProps:!!O},ew.isValidElement(g)?ew.cloneElement(g,Y):"function"==typeof g?ew.createElement(g,Y):ew.createElement(L9,Y));return ew.createElement(ew.Fragment,null,(0,t3.createPortal)(X,U),B&&ew.createElement($R,{cursor:C,tooltipEventType:D,coordinate:F,payload:K,index:T}))};function Fk({active:e,payload:t,className:n,indicator:r="dot",hideLabel:i=!1,hideIndicator:a=!1,label:o,labelFormatter:l,labelClassName:s,formatter:c,color:d,nameKey:u,labelKey:f}){let{config:h}=function(){let e=ew.useContext(Fy);if(!e)throw Error("useChart must be used within a <ChartContainer />");return e}(),p=ew.useMemo(()=>{if(i||!t?.length)return null;let[e]=t,n=`${f??e?.dataKey??e?.name??"value"}`,r=FS(h,e,n),a=f||"string"!=typeof o?r?.label:h[o]?.label??o;return l?(0,eb.jsx)("div",{className:tK("font-medium",s),children:l(a,t)}):a?(0,eb.jsx)("div",{className:tK("font-medium",s),children:a}):null},[o,l,t,i,s,h,f]);if(!e||!t?.length)return null;let m=1===t.length&&"dot"!==r;return(0,eb.jsxs)("div",{className:tK("vtl-surface-popover grid min-w-32 items-start gap-1.5 rounded-[var(--surface-popover-radius)] border px-2.5 py-1.5 text-xs",n),children:[m?null:p,(0,eb.jsx)("div",{className:"grid gap-1.5",children:t.filter(e=>"none"!==e.type).map((e,t)=>{let n=`${u??e.name??e.dataKey??"value"}`,i=FS(h,e,n),o=d??e.payload?.fill??e.color;return(0,eb.jsx)("div",{className:tK("flex w-full flex-wrap items-stretch gap-2 [&>svg]:size-2.5 [&>svg]:text-muted-foreground","dot"===r&&"items-center"),children:c&&e?.value!==void 0&&e.name?c(e.value,e.name,e,t,e.payload):(0,eb.jsxs)(eb.Fragment,{children:[i?.icon?(0,eb.jsx)(i.icon,{}):!a&&(0,eb.jsx)("div",{className:tK("shrink-0 rounded-[2px]","dot"===r&&"size-2.5","line"===r&&"w-1","dashed"===r&&"w-0 border-[1.5px] border-dashed bg-transparent",m&&"dashed"===r&&"my-0.5"),style:{backgroundColor:"dashed"===r?"transparent":o,borderColor:o}}),(0,eb.jsxs)("div",{className:tK("flex flex-1 justify-between leading-none",m?"items-end":"items-center"),children:[(0,eb.jsxs)("div",{className:"grid gap-1.5",children:[m?p:null,(0,eb.jsx)("span",{className:"text-muted-foreground",children:i?.label??e.name})]}),null!=e.value&&(0,eb.jsx)("span",{className:"font-mono font-medium text-foreground tabular-nums",children:"number"==typeof e.value?e.value.toLocaleString():String(e.value)})]})]})},t)})})]})}function FS(e,t,n){if("object"!=typeof t||null===t)return;let r="payload"in t&&"object"==typeof t.payload&&null!==t.payload?t.payload:void 0,i=n;return n in t&&"string"==typeof t[n]?i=t[n]:r&&n in r&&"string"==typeof r[n]&&(i=r[n]),i in e?e[i]:e[n]}function FC({config:e,data:t}){return(0,eb.jsx)(Fb,{config:e,className:"mt-2 min-h-0 flex-1",children:(0,eb.jsxs)(Lr,{data:t,margin:{left:8,right:8},children:[(0,eb.jsx)(L$,{vertical:!1}),(0,eb.jsx)(L1,{dataKey:"time",tickLine:!1,axisLine:!1,tickMargin:8}),(0,eb.jsx)(Fj,{content:(0,eb.jsx)(Fk,{indicator:"line"})}),(0,eb.jsx)(Tl,{dataKey:"p2p",type:"monotone",fill:"var(--color-p2p)",fillOpacity:.12,stroke:"var(--color-p2p)",strokeWidth:2}),(0,eb.jsx)(Tl,{dataKey:"relay",type:"monotone",fill:"var(--color-relay)",fillOpacity:.1,stroke:"var(--color-relay)",strokeWidth:2})]})})}let FN=eN("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);function FM({canvases:e,mode:t="active",scrollable:n=!1,onSelect:r}){let i=ew.useMemo(()=>e.map(e=>{var n;return{id:e.id,status:"live"===(n=e).status?"current":"review"===n.status?"blocked":"done",title:(0,eb.jsx)(FE,{canvas:e,mode:t,onClick:()=>r(e)})}}),[e,t,r]);return(0,eb.jsx)(mT,{items:i,scrollCurrentIntoView:!1,className:tK("mt-2",n&&"min-h-0 flex-1"),viewportClassName:tK("max-h-none pr-0",n?"h-full overflow-y-auto":"overflow-visible"),itemClassName:"py-2"})}function FE({canvas:e,onClick:t,mode:n}){return(0,eb.jsxs)("button",{type:"button",className:tK("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,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("div",{className:"truncate text-sm font-medium",children:e.title}),(0,eb.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:"active"===n?e.purpose:`${e.nodes} nodes`})]}),"active"===n?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(mA,{value:e.progress,className:"h-1.5"}),(0,eb.jsx)("span",{"aria-label":e.progress>=100?"Canvas complete":"Canvas incomplete",className:tK("size-2.5 rounded-full",e.progress>=100?"bg-primary":"bg-border")})]}):(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(FO,{icon:(0,eb.jsx)(FN,{}),value:`${e.snapshots}`}),(0,eb.jsx)(FO,{icon:(0,eb.jsx)(g7,{}),value:e.runtime}),(0,eb.jsx)("div",{className:"text-right ui-text-kbd text-muted-foreground",children:e.lastOpened})]})]})}function FO({icon:e,value:t}){return(0,eb.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,eb.jsx)("span",{className:"[&_svg]:size-3.5",children:e}),(0,eb.jsx)("span",{className:"tabular-nums",children:t})]})}let FP=eN("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),FA=eN("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),Fz=eN("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"}]]),F_=eN("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),FI=eN("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"}]]);function FD({title:e=ez.machineStatus}){return(0,eb.jsx)(fe,{title:e,icon:(0,eb.jsx)(eP,{}),className:"size-full",jellyImage:"/themes/jelly/card3.png",jellyImagePosition:"center top",jellyImageOpacity:.88,jellyImageBlur:"5px",children:(0,eb.jsx)("div",{className:"grid gap-2 overflow-hidden",children:fo.map(e=>(0,eb.jsxs)("div",{className:"grid gap-3 rounded-lg border bg-muted/15 p-3 lg:grid-cols-[minmax(12rem,1fr)_minmax(0,1.6fr)]",children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,eb.jsx)("span",{className:"grid size-9 shrink-0 place-items-center rounded-lg border bg-background text-muted-foreground",children:(0,eb.jsx)(F_,{className:"size-4"})}),(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,eb.jsx)("p",{className:"truncate ui-text-control font-medium",children:e.name}),(0,eb.jsx)(cI,{variant:e.status===ez.online?"secondary":"outline",children:e.status})]}),(0,eb.jsxs)("p",{className:"mt-1 truncate ui-text-kbd text-muted-foreground",children:[e.role," · ",e.link]})]})]}),(0,eb.jsxs)("div",{className:"grid gap-2 sm:grid-cols-4",children:[(0,eb.jsx)(FT,{icon:(0,eb.jsx)(FP,{}),label:ez.cpu,value:e.cpu}),(0,eb.jsx)(FT,{icon:(0,eb.jsx)(Fz,{}),label:ez.memory,value:e.memory}),(0,eb.jsx)(FT,{icon:(0,eb.jsx)(FI,{}),label:ez.gpu,value:e.gpu}),(0,eb.jsx)(FT,{icon:(0,eb.jsx)(FA,{}),label:ez.disk,value:e.disk})]})]},e.id))})})}function FT({icon:e,label:t,value:n}){return(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsxs)("div",{className:"flex items-center justify-between gap-2 ui-text-kbd text-muted-foreground",children:[(0,eb.jsxs)("span",{className:"flex items-center gap-1",children:[e,t]}),(0,eb.jsxs)("span",{className:"tabular-nums",children:[n,"%"]})]}),(0,eb.jsx)(mA,{value:n})]})}function FR({label:e,value:t,jellyImage:n,jellyImagePosition:r}){var i;return(0,eb.jsxs)("section",{className:tK("relative size-full overflow-hidden rounded-xl border bg-card p-5",n&&"vtl-jelly-image-card",n&&u7(n)&&"vtl-jelly-image-card-shadowless"),style:n?u9({image:n,position:r,opacity:.76,blur:"8px"}):void 0,children:[(0,eb.jsx)("div",{className:"text-xl font-semibold tracking-normal",children:e}),(0,eb.jsx)(mC,{value:(i=t,/^\d+$/.test(i)&&1===i.length?`0${i}`:i),minSize:42,maxSize:180,className:"absolute right-5 bottom-5 h-2/3 w-[78%]"})]})}let FL=eN("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);function F$({title:e=ez.resourceTrend}){return(0,eb.jsx)(fe,{title:e,icon:(0,eb.jsx)(FL,{}),className:"size-full",children:(0,eb.jsx)(Fb,{config:fc,className:"h-full min-h-0 w-full",children:(0,eb.jsxs)(Lr,{data:fl,margin:{left:8,right:8},children:[(0,eb.jsx)(L$,{vertical:!1}),(0,eb.jsx)(L1,{dataKey:"time",tickLine:!1,axisLine:!1,tickMargin:8}),(0,eb.jsx)(Fj,{content:(0,eb.jsx)(Fk,{indicator:"line"})}),(0,eb.jsx)(Tl,{dataKey:"cpu",type:"monotone",fill:"var(--color-cpu)",fillOpacity:.12,stroke:"var(--color-cpu)",strokeWidth:2}),(0,eb.jsx)(Tl,{dataKey:"memory",type:"monotone",fill:"var(--color-memory)",fillOpacity:.1,stroke:"var(--color-memory)",strokeWidth:2})]})})})}var FF=ew,FV=e=>null;FV.displayName="Cell";var FB=e.i(19003);function FH(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 FW(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?FH(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FH(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Fq(){return(Fq=Object.assign.bind()).apply(null,arguments)}function FU(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var FK=(e,t,n,r,i)=>{var a=n-r;return b8(ep||(ep=FU(["M ",",",""])),e,t)+b8(em||(em=FU(["L ",",",""])),e+n,t)+b8(eg||(eg=FU(["L ",",",""])),e+n-a/2,t+i)+b8(ev||(ev=FU(["L ",",",""])),e+n-a/2-r,t+i)+b8(ex||(ex=FU(["L ",","," Z"])),e,t)},FG={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},FY=e=>{var t=Cs(e,FG),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:l}=t,{animationEasing:s,animationDuration:c,animationBegin:d,isUpdateAnimationActive:u}=t,f=(0,ew.useRef)(null),[h,p]=(0,ew.useState)(-1),m=(0,ew.useRef)(i),g=(0,ew.useRef)(a),v=(0,ew.useRef)(o),x=(0,ew.useRef)(n),y=(0,ew.useRef)(r),b=Dn(e,"trapezoid-");if((0,ew.useEffect)(()=>{if(f.current&&f.current.getTotalLength)try{var e=f.current.getTotalLength();e&&p(e)}catch(e){}},[]),n!==+n||r!==+r||i!==+i||a!==+a||o!==+o||0===i&&0===a||0===o)return null;var w=eH("recharts-trapezoid",l);if(!u)return ew.createElement("g",null,ew.createElement("path",Fq({},SY(t),{className:w,d:FK(n,r,i,a,o)})));var j=m.current,k=g.current,S=v.current,C=x.current,N=y.current,M="0px ".concat(-1===h?1:h,"px"),E="".concat(h,"px ").concat(h,"px"),O=Dx(["strokeDasharray"],c,s);return ew.createElement(DR,{animationId:b,key:b,canBegin:h>0,duration:c,easing:s,isActive:u,begin:d},e=>{var l=wl(j,i,e),s=wl(k,a,e),c=wl(S,o,e),d=wl(C,n,e),u=wl(N,r,e);f.current&&(m.current=l,g.current=s,v.current=c,x.current=d,y.current=u);var h=e>0?{transition:O,strokeDasharray:E}:{strokeDasharray:M};return ew.createElement("path",Fq({},SY(t),{className:w,d:FK(d,u,l,s,c),ref:f,style:FW(FW({},h),t.style)}))})},FX=["option","shapeType","activeClassName","inActiveClassName"];function FZ(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 FJ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?FZ(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FZ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FQ(e){var{shapeType:t,elementProps:n}=e;switch(t){case"rectangle":return ew.createElement($j,n);case"trapezoid":return ew.createElement(FY,n);case"sector":return ew.createElement($O,n);case"symbols":if("symbols"===t)return ew.createElement(Fe,n);break;case"curve":return ew.createElement(SG,n);default:return null}}function F0(e){var t,{option:n,shapeType:r,activeClassName:i="recharts-active-shape",inActiveClassName:a="recharts-shape"}=e,o=function(e,t){if(null==e)return{};var n,r,i=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 a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,FX);if((0,ew.isValidElement)(n))t=(0,ew.cloneElement)(n,FJ(FJ({},o),(0,ew.isValidElement)(n)?n.props:n));else if("function"==typeof n)t=n(o,o.index);else if((0,FB.default)(n)&&"boolean"!=typeof n){var l=FJ(FJ({},o),n);t=ew.createElement(FQ,{shapeType:r,elementProps:l})}else t=ew.createElement(FQ,{shapeType:r,elementProps:o});return o.isActive?ew.createElement(SJ,{className:i},t):ew.createElement(SJ,{className:a},t)}function F1(){return(F1=Object.assign.bind()).apply(null,arguments)}function F2(e){return ew.createElement(F0,F1({shapeType:"rectangle",activeClassName:"recharts-active-bar",inActiveClassName:"recharts-inactive-bar"},e))}var F5=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(n,r)=>{if(wt(e))return e;var i=wt(n)||null==n;return i?e(n,r):(i||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)}},F4=(e,t,n)=>{var r=ww();return(i,a)=>o=>{null==e||e(i,a,o),r(_t({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},F3=e=>{var t=ww();return(n,r)=>i=>{null==e||e(n,r,i),t(_n())}},F6=(e,t,n)=>{var r=ww();return(i,a)=>o=>{null==e||e(i,a,o),r(_i({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},F8=["children"],F7=(0,ew.createContext)({data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function F9(e){var{children:t}=e,n=function(e,t){if(null==e)return{};var n,r,i=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 a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,F8);return ew.createElement(F7.Provider,{value:n},t)}var Ve=(e,t,n)=>{var r=null!=n?n:e;if(null!=r)return wa(r,t,0)};function Vt(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 Vn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vt(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Vr=j$([Aj,(e,t)=>t],(e,t)=>e.filter(e=>"bar"===e.type).find(e=>e.id===t)),Vi=j$([Vr],e=>null==e?void 0:e.maxBarSize),Va=j$([ST,Aj,IA,Iz,(e,t,n)=>n],(e,t,n,r,i)=>t.filter(t=>"horizontal"===e?t.xAxisId===n:t.yAxisId===r).filter(e=>e.isPanorama===i).filter(e=>!1===e.hide).filter(e=>"bar"===e.type)),Vo=j$([Va,e=>e.rootProps.barSize,(e,t)=>{var n=ST(e),r=IA(e,t),i=Iz(e,t);if(null!=r&&null!=i)return"horizontal"===n?zW(e,"xAxis",r):zW(e,"yAxis",i)}],(e,t,n)=>{var r=e.filter(MK),i=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,[i,a]=e;return{stackId:i,dataKeys:a.map(e=>e.dataKey),barSize:Ve(t,n,null==(r=a[0])?void 0:r.barSize)}}),...i.map(e=>({stackId:void 0,dataKeys:[e.dataKey].filter(e=>null!=e),barSize:Ve(t,n,e.barSize)}))]}),Vl=(e,t,n)=>{var r,i,a=ST(e),o=IA(e,t),l=Iz(e,t);if(null!=o&&null!=l)return"horizontal"===a?(r=zX(e,"xAxis",o,n),i=zY(e,"xAxis",o,n)):(r=zX(e,"yAxis",l,n),i=zY(e,"yAxis",l,n)),k4(r,i)},Vs=j$([Vo,MD,e=>e.rootProps.barGap,MT,(e,t,n)=>{var r,i,a,o,l=Vr(e,t);if(null==l)return 0;var s=IA(e,t),c=Iz(e,t);if(null==s||null==c)return 0;var d=ST(e),u=MD(e),{maxBarSize:f}=l;return"horizontal"===d?(a=zX(e,"xAxis",s,n),o=zY(e,"xAxis",s,n)):(a=zX(e,"yAxis",c,n),o=zY(e,"yAxis",c,n)),null!=(r=null!=(i=k4(a,o,!0))?i:null==f?u:f)?r:0},Vl,Vi],(e,t,n,r,i,a,o)=>{var l=function(e,t,n,r,i){var a,o,l=r.length;if(!(l<1)){var s=wa(e,n,0,!0),c=[];if(wf(null==(a=r[0])?void 0:a.barSize)){var d=!1,u=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&&u>0&&(d=!0,u*=.9,f=l*u);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:d?u:null!=(n=t.barSize)?n:0}},i=[...e,r];return h=r.position,i},c)}else{var p=wa(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=wf(i)?Math.min(m,i):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,i!==a?i:a,e,null==o?t:o);return i!==a&&null!=l&&(l=l.map(e=>Vn(Vn({},e),{},{position:Vn(Vn({},e.position),{},{offset:e.position.offset-i/2})}))),l}),Vc=j$([Vs,Vr],(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}}),Vd=j$([(e,t,n)=>{var r=ST(e),i=IA(e,t),a=Iz(e,t);if(null!=i&&null!=a)return"horizontal"===r?AK(e,"yAxis",a,n):AK(e,"xAxis",i,n)},Vr],(e,t)=>{var n=Mq(t);if(!e||null==n||null==t)return;var{stackId:r}=t;if(null!=r){var i=e[r];if(i){var{stackedData:a}=i;if(a)return a.find(e=>e.key===n)}}}),Vu=j$([Sl,Sc,(e,t,n)=>{var r=IA(e,t);if(null!=r)return zX(e,"xAxis",r,n)},(e,t,n)=>{var r=Iz(e,t);if(null!=r)return zX(e,"yAxis",r,n)},(e,t,n)=>{var r=IA(e,t);if(null!=r)return zY(e,"xAxis",r,n)},(e,t,n)=>{var r=Iz(e,t);if(null!=r)return zY(e,"yAxis",r,n)},Vc,ST,My,Vl,Vd,Vr,(e,t,n,r)=>r],(e,t,n,r,i,a,o,l,s,c,d,u,f)=>{var h,{chartData:p,dataStartIndex:m,dataEndIndex:g}=s;if(null!=u&&null!=o&&null!=t&&("horizontal"===l||"vertical"===l)&&null!=n&&null!=r&&null!=i&&null!=a&&null!=c){var{data:v}=u;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:i},pos:a,bandSize:o,xAxis:l,yAxis:s,xAxisTicks:c,yAxisTicks:d,stackedData:u,displayedData:f,offset:h,cells:p,parentViewBox:m,dataStartIndex:g}=e,v="horizontal"===t?s:l,x=u?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]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]})({numericAxis:v}),b=v.scale.map(y);return f.map((e,f)=>{if(u){var v=u[f+g];if(null==v)return null;j=((e,t)=>{if(!t||2!==t.length||!wt(t[0])||!wt(t[1]))return e;var n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!wt(e[0])||e[0]<n)&&(i[0]=n),(!wt(e[1])||e[1]>r)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]<n&&(i[1]=n),i})(v,x)}else Array.isArray(j=kG(e,n))||(j=[y,j]);var w=F5(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=k1({axis:l,ticks:c,bandSize:o,offset:a.offset,entry:e,index:f}),S=null!=(E=null!=P?P:O)?E:void 0,C=a.size;var A=O-P;if(N=b9(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 z=b7(N||w)*(Math.abs(w)-Math.abs(N));S-=z,N+=z}}else{var _=l.scale.map(j[0]),I=l.scale.map(j[1]);if(null==_||null==I)return null;if(k=_,S=k1({axis:s,ticks:d,bandSize:o,offset:a.offset,entry:e,index:f}),C=I-_,N=a.size,M={x:h.left,y:S,width:h.width,height:N},Math.abs(w)>0&&Math.abs(C)<Math.abs(w)){var D=b7(C||w)*(Math.abs(w)-Math.abs(C));C+=D}}return null!=k&&null!=S&&null!=C&&null!=N&&(i||0!==C&&0!==N)?VE(VE({},e),{},{stackedBarStart:b,x:k,y:S,width:C,height:N,value:u?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:u,pos:o,parentViewBox:t,bandSize:c,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,stackedData:d,displayedData:h,offset:e,cells:f,dataStartIndex:m})}}),Vf=(e,t)=>t,Vh=(e,t,n)=>n,Vp=j$([Vf,Aj,Vh],(e,t,n)=>t.filter(e=>"bar"===e.type).filter(t=>t.stackId===e).filter(e=>e.isPanorama===n).filter(e=>!e.hide)),Vm=j$([Vp],e=>e.map(e=>e.id)),Vg=j$([e=>e,Vf,Vh],(e,t,n)=>{var r=Vm(e,t,n),i=[];return r.forEach(t=>{var r=Vu(e,t,n,void 0);null==r||r.forEach(e=>{var t=e.originalDataIndex;i[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}})(i[t],e)})}),i}),Vv=["index"];function Vx(){return(Vx=Object.assign.bind()).apply(null,arguments)}var Vy=(0,ew.createContext)(void 0),Vb=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),Vw=e=>{var{index:t}=e,n=function(e,t){if(null==e)return{};var n,r,i=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 a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Vv),r=(e=>{var t=(0,ew.useContext)(Vy);if(null!=t){var{stackId:n}=t;return"url(#".concat(Vb(n,e),")")}})(t);return ew.createElement(SJ,Vx({className:"recharts-bar-stack-layer",clipPath:r},n))},Vj=["onMouseEnter","onMouseLeave","onClick"],Vk=["value","background","tooltipPosition"],VS=["id"],VC=["onMouseEnter","onClick","onMouseLeave"];function VN(){return(VN=Object.assign.bind()).apply(null,arguments)}function VM(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 VE(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?VM(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function VO(e,t){if(null==e)return{};var n,r,i=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 a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var VP=FF.memo(e=>{var{dataKey:t,stroke:n,strokeWidth:r,fill:i,name:a,hide:o,unit:l,tooltipType:s,id:c}=e,d={dataDefinedOnItem:void 0,getPosition:wu,settings:{stroke:n,strokeWidth:r,fill:i,dataKey:t,nameKey:void 0,name:k6(a,t),hide:o,type:s,color:i,unit:l,graphicalItemId:c}};return FF.createElement(IE,{tooltipEntrySettings:d})});function VA(e){var t,n=wC(_7),{data:r,dataKey:i,background:a,allOtherBarProps:o}=e,{onMouseEnter:l,onMouseLeave:s,onClick:c}=o,d=VO(o,Vj),u=F4(l,i,o.id),f=F3(s),h=F6(c,i,o.id);if(!a||null==r)return null;var p=wx(a);return FF.createElement(ND,{zIndex:(t=CE.barBackground,a&&"object"==typeof a&&"zIndex"in a&&"number"==typeof a.zIndex&&wf(a.zIndex)?a.zIndex:t)},r.map((e,t)=>{var{value:r,background:o,tooltipPosition:l}=e,s=VO(e,Vk);if(!o)return null;var c=u(e,t),m=f(e,t),g=h(e,t),v=VE(VE(VE(VE(VE({option:a,isActive:String(t)===n},s),{},{fill:"#eee"},o),p),b4(d,e,t)),{},{onMouseEnter:c,onMouseLeave:m,onClick:g,dataKey:i,index:t,className:"recharts-bar-background-rectangle"});return FF.createElement(F2,VN({key:"background-bar-".concat(t)},v))}))}function Vz(e){var{showLabels:t,children:n,rects:r}=e,i=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 VE(VE({},t),{},{value:e.value,payload:e.payload,parentViewBox:e.parentViewBox,viewBox:t,fill:e.fill})});return FF.createElement(N3,{value:t?i:void 0},n)}function V_(e){var t,{shape:n,activeBar:r,baseProps:i,entry:a,index:o,dataKey:l}=e,s=wC(_7),c=wC(Ie),d=r&&String(a.originalDataIndex)===s&&(null==c||l===c),[u,f]=(0,FF.useState)(!1),[h,p]=(0,FF.useState)(!1);(0,FF.useEffect)(()=>{var e;return d?(f(!0),e=requestAnimationFrame(()=>{p(!0)})):p(!1),()=>{cancelAnimationFrame(e)}},[d]);var m=(0,FF.useCallback)(()=>{d||f(!1)},[d]),g=d&&h,v=d||u;t=d?!0===r?n:r:n;var x=FF.createElement(F2,VN({},i,{name:String(i.name)},a,{isActive:g,option:t,index:o,dataKey:l,onTransitionEnd:m}));return v?FF.createElement(ND,{zIndex:CE.activeBar},FF.createElement(Vw,{index:a.originalDataIndex},x)):x}function VI(e){var{shape:t,baseProps:n,entry:r,index:i,dataKey:a}=e;return FF.createElement(F2,VN({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:i,dataKey:a}))}function VD(e){var t,{data:n,props:r}=e,i=null!=(t=wv(r))?t:{},{id:a}=i,o=VO(i,VS),{shape:l,dataKey:s,activeBar:c}=r,{onMouseEnter:d,onClick:u,onMouseLeave:f}=r,h=VO(r,VC),p=F4(d,s,a),m=F3(f),g=F6(u,s,a);return n?FF.createElement(FF.Fragment,null,n.map((e,t)=>FF.createElement(Vw,VN({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"},b4(h,e,t),{onMouseEnter:p(e,t),onMouseLeave:m(e,t),onClick:g(e,t)}),c?FF.createElement(V_,{shape:l,activeBar:c,baseProps:o,entry:e,index:t,dataKey:s}):FF.createElement(VI,{shape:l,baseProps:o,entry:e,index:t,dataKey:s})))):null}function VT(e){var{props:t,previousRectanglesRef:n}=e,{data:r,layout:i,isAnimationActive:a,animationBegin:o,animationDuration:l,animationEasing:s,onAnimationEnd:c,onAnimationStart:d}=t,u=n.current,f=Dn(t,"recharts-bar-"),[h,p]=(0,FF.useState)(!1),m=(0,FF.useCallback)(()=>{"function"==typeof c&&c(),p(!1)},[c]),g=(0,FF.useCallback)(()=>{"function"==typeof d&&d(),p(!0)},[d]);return FF.createElement(Vz,{showLabels:!h,rects:r},FF.createElement(DR,{animationId:f,begin:o,duration:l,isActive:a,easing:s,onAnimationEnd:m,onAnimationStart:g,key:f},e=>{var a=1===e?r:null==r?void 0:r.map((t,n)=>{var r=u&&u[n];if(r)return VE(VE({},t),{},{x:wl(r.x,t.x,e),y:wl(r.y,t.y,e),width:wl(r.width,t.width,e),height:wl(r.height,t.height,e)});if("horizontal"===i){var a=wl(0,t.height,e),o=wl(t.stackedBarStart,t.y,e);return VE(VE({},t),{},{y:o,height:a})}var l=wl(0,t.width,e),s=wl(t.stackedBarStart,t.x,e);return VE(VE({},t),{},{width:l,x:s})});return(e>0&&(n.current=null!=a?a:null),null==a)?null:FF.createElement(SJ,null,FF.createElement(VD,{props:t,data:a}))}),FF.createElement(N9,{label:t.label}),t.children)}function VR(e){var t=(0,FF.useRef)(null);return FF.createElement(VT,{previousRectanglesRef:t,props:e})}var VL=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:kG(e,t)}};class V$ extends FF.PureComponent{render(){var{hide:e,data:t,dataKey:n,className:r,xAxisId:i,yAxisId:a,needClip:o,background:l,id:s}=this.props;if(e||null==t)return null;var c=eH("recharts-bar",r);return FF.createElement(SJ,{className:c,id:s},o&&FF.createElement("defs",null,FF.createElement(IP,{clipPathId:s,xAxisId:i,yAxisId:a})),FF.createElement(SJ,{className:"recharts-bar-rectangles",clipPath:o?"url(#clipPath-".concat(s,")"):void 0},FF.createElement(VA,{data:t,dataKey:n,background:l,allOtherBarProps:this.props}),FF.createElement(VR,this.props)))}}var VF={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:CE.bar};function VV(e){var t,{xAxisId:n,yAxisId:r,hide:i,legendType:a,minPointSize:o,activeBar:l,animationBegin:s,animationDuration:c,animationEasing:d,isAnimationActive:u}=e,{needClip:f}=IO(n,r),h=wC(ST),p=Su(),m=Ml(e.children,FV),g=wC(t=>Vu(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,FF.createElement(F9,{xAxisId:n,yAxisId:r,data:g,dataPointFormatter:VL,errorBarOffset:t},FF.createElement(V$,VN({},e,{layout:h,needClip:f,data:g,xAxisId:n,yAxisId:r,hide:i,legendType:a,minPointSize:o,activeBar:l,animationBegin:s,animationDuration:c,animationEasing:d,isAnimationActive:u})))}var VB=FF.memo(function(e){var t,n,r=Cs(e,VF),i=(t=r.stackId,null!=(n=(0,ew.useContext)(Vy))?n.stackId:null!=t?kQ(t):void 0),a=Su();return FF.createElement(Da,{id:r.id,type:"bar"},e=>FF.createElement(FF.Fragment,null,FF.createElement(De,{legendPayload:(e=>{var{dataKey:t,name:n,fill:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:k6(n,t),payload:e}]})(r)}),FF.createElement(VP,{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}),FF.createElement(Dp,{type:"bar",id:e,data:void 0,xAxisId:r.xAxisId,yAxisId:r.yAxisId,zAxisId:0,dataKey:r.dataKey,stackId:i,hide:r.hide,barSize:r.barSize,minPointSize:r.minPointSize,maxBarSize:r.maxBarSize,isPanorama:a,hasCustomShape:null!=r.shape}),FF.createElement(ND,{zIndex:r.zIndex},FF.createElement(VV,VN({},r,{id:e})))))},DZ);VB.displayName="Bar";var VH=["axis","item"],VW=(0,ew.forwardRef)((e,t)=>ew.createElement(Lt,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:VH,tooltipPayloadSearcher:Ts,categoricalChartProps:e,ref:t}));function Vq({x:e,y:t,width:n,height:r,radius:i}){let a=Array.isArray(i)?i[0]:i??5;return n<=0||r<=0?null:(0,eb.jsx)("foreignObject",{x:e,y:t,width:n,height:r,className:"vtl-run-mix-bar-shape",children:(0,eb.jsx)("div",{className:"vtl-run-mix-bar",style:{borderRadius:`${a}px`}})})}function VU({title:e=ez.runMix}){return(0,eb.jsx)(fe,{title:e,icon:(0,eb.jsx)(mR,{}),className:"size-full",jellyImage:"/themes/jelly/card2.png",jellyImagePosition:"62% center",jellyImageOpacity:.88,jellyImageBlur:"5px",children:(0,eb.jsx)(Fb,{config:fc,className:"h-full min-h-0 w-full",children:(0,eb.jsxs)(VW,{data:fs,children:[(0,eb.jsx)(L$,{vertical:!1}),(0,eb.jsx)(L1,{dataKey:"type",tickLine:!1,axisLine:!1,tickMargin:8}),(0,eb.jsx)(Fj,{content:(0,eb.jsx)(Fk,{})}),(0,eb.jsx)(VB,{dataKey:"count",fill:"var(--color-count)",radius:5,shape:e=>(0,eb.jsx)(Vq,{...e})})]})})})}let VK=eN("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"}]]),VG=eN("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"}]]);function VY({className:e,orientation:t="horizontal",...n}){return(0,eb.jsx)("div",{role:"separator","aria-orientation":t,"data-slot":"separator","data-orientation":t,className:tK("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 VX({title:e=ez.schedule}){return(0,eb.jsxs)("div",{className:"grid size-full min-h-0 gap-3",children:[(0,eb.jsx)(fe,{title:e,icon:(0,eb.jsx)(VG,{}),className:"min-h-0",children:(0,eb.jsx)("div",{className:"grid gap-2",children:fd.map(e=>(0,eb.jsxs)("div",{className:"grid grid-cols-[3.5rem_1fr] gap-3 rounded-lg border bg-muted/15 p-2.5",children:[(0,eb.jsx)("span",{className:"ui-text-control font-medium tabular-nums",children:e.time}),(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("p",{className:"truncate ui-text-control font-medium",children:e.title}),(0,eb.jsx)("p",{className:"mt-0.5 truncate ui-text-kbd text-muted-foreground",children:e.meta})]})]},e.time))})}),(0,eb.jsx)(fe,{title:ez.incidents,icon:(0,eb.jsx)(VK,{}),className:"min-h-0",children:(0,eb.jsxs)("div",{className:"grid gap-3",children:[(0,eb.jsxs)("div",{className:"flex items-center justify-center gap-4",children:[(0,eb.jsx)(m_,{value:76,label:"health",className:"size-24"}),(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsx)(mz,{value:82,label:"SLA",mode:"split",size:"sm"}),(0,eb.jsx)(mz,{value:61,label:"队列",mode:"split",size:"sm"})]})]}),(0,eb.jsx)(VY,{}),fu.map(e=>(0,eb.jsx)("div",{className:tK("rounded-lg border p-2.5 ui-text-control","warning"===e.tone?"border-destructive/25 bg-destructive/5 text-destructive":"bg-muted/15"),children:e.title},e.title))]})})]})}function VZ({label:e,description:t,value:n}){return(0,eb.jsxs)("div",{className:"relative h-full min-h-0",children:[(0,eb.jsxs)("div",{children:[(0,eb.jsx)("div",{className:"text-xl font-semibold tracking-normal",children:e}),(0,eb.jsx)("div",{className:"mt-1 text-sm leading-5 text-muted-foreground",children:t})]}),(0,eb.jsx)(mC,{value:mN(n),minSize:48,maxSize:220,className:"absolute right-0 bottom-0 h-2/3 w-full"})]})}function VJ({machines:e}){return(0,eb.jsx)("div",{className:"mt-2 grid min-h-0 flex-1 content-start overflow-hidden",children:e.map((e,t)=>(0,eb.jsxs)("div",{className:tK("grid min-h-14 grid-cols-[minmax(0,1.1fr)_7rem_7rem_13rem] items-center gap-4 px-2 py-1.5",t>0&&"border-t"),children:[(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsxs)("div",{className:"flex items-center gap-2",children:[(0,eb.jsx)(VQ,{state:e.state}),(0,eb.jsx)("span",{className:"truncate text-sm font-medium",children:e.name})]}),(0,eb.jsxs)("div",{className:"mt-1 truncate ui-text-kbd text-muted-foreground",children:[e.os," · ",e.version]})]}),(0,eb.jsxs)("div",{className:"grid gap-0.5",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"Role"}),(0,eb.jsx)("span",{className:"truncate text-sm",children:e.role})]}),(0,eb.jsxs)("div",{className:"grid gap-0.5",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"Agent"}),(0,eb.jsx)("span",{className:"truncate text-sm tabular-nums",children:e.agent})]}),(0,eb.jsx)(V0,{tags:e.tags})]},e.id))})}function VQ({state:e}){return(0,eb.jsx)("span",{className:tK("size-2 rounded-full bg-border","online"===e&&"bg-primary","warning"===e&&"bg-muted-foreground","sleeping"===e&&"bg-border","offline"===e&&"bg-destructive")})}function V0({tags:e}){return(0,eb.jsx)("div",{className:"flex min-w-0 flex-wrap gap-1",children:e.map(e=>(0,eb.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 ui-text-kbd text-muted-foreground",children:e},e))})}var V1=ew,V2=(e,t,n,r)=>zX(e,"xAxis",t,r),V5=(e,t,n,r)=>zY(e,"xAxis",t,r),V4=(e,t,n,r)=>zX(e,"yAxis",n,r),V3=(e,t,n,r)=>zY(e,"yAxis",n,r),V6=j$([ST,V2,V4,V5,V3],(e,t,n,r,i)=>kY(e,"xAxis")?k4(t,r,!1):k4(n,i,!1));function V8(e){return"line"===e.type}var V7=j$([Aj,(e,t,n,r,i)=>i],(e,t)=>e.filter(V8).find(e=>e.id===t)),V9=j$([ST,V2,V4,V5,V3,V7,V6,Mx],(e,t,n,r,i,a,o,l)=>{var s,{chartData:c,dataStartIndex:d,dataEndIndex:u}=l;if(null!=a&&null!=t&&null!=n&&null!=r&&null!=i&&0!==r.length&&0!==i.length&&null!=o&&("horizontal"===e||"vertical"===e)){var{dataKey:f,data:h}=a;if(null!=(s=null!=h&&h.length>0?h:null==c?void 0:c.slice(d,u+1)))return function(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:l,displayedData:s}=e;return s.map((e,s)=>{var c=kG(e,o);if("horizontal"===t){var d=k0({axis:n,ticks:i,bandSize:l,entry:e,index:s}),u=null==c?null:r.scale.map(c);return{x:d,y:null!=u?u:null,value:c,payload:e}}var f=null==c?null:n.scale.map(c),h=k0({axis:r,ticks:a,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:i,dataKey:f,bandSize:o,displayedData:s})}}),Be=["id"],Bt=["type","layout","connectNulls","needClip","shape"],Bn=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function Br(){return(Br=Object.assign.bind()).apply(null,arguments)}function Bi(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 Ba(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bi(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Bo(e,t){if(null==e)return{};var n,r,i=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 a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var Bl=V1.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:l,unit:s,tooltipType:c,id:d}=e,u={dataDefinedOnItem:n,getPosition:wu,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:k6(o,t),hide:l,type:c,color:r,unit:s,graphicalItemId:d}};return V1.createElement(IE,{tooltipEntrySettings:u})}),Bs=(e,t)=>"".concat(t,"px ").concat(e,"px");function Bc(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:a,needClip:o}=r,{id:l}=r,s=wv(Bo(r,Be));return V1.createElement(Mp,{points:n,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:s,needClip:o,clipPathId:t})}function Bd(e){var{showLabels:t,children:n,points:r}=e,i=(0,V1.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 Ba(Ba({},r),{},{value:e.value,payload:e.payload,viewBox:r,parentViewBox:void 0,fill:void 0})}),[r]);return V1.createElement(N3,{value:t?i:void 0},n)}function Bu(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:a}=e,{type:o,layout:l,connectNulls:s,needClip:c,shape:d}=a,u=Ba(Ba({},SY(Bo(a,Bt))),{},{fill:"none",className:"recharts-line-curve",clipPath:c?"url(#clipPath-".concat(t,")"):void 0,points:r,type:o,layout:l,connectNulls:s,strokeDasharray:null!=i?i:a.strokeDasharray});return V1.createElement(V1.Fragment,null,(null==r?void 0:r.length)>1&&V1.createElement(F0,Br({shapeType:"curve",option:d},u,{pathRef:n})),V1.createElement(Bc,{points:r,clipPathId:t,props:a}))}function Bf(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:a}=e,{points:o,strokeDasharray:l,isAnimationActive:s,animationBegin:c,animationDuration:d,animationEasing:u,animateNewValues:f,width:h,height:p,onAnimationEnd:m,onAnimationStart:g}=n,v=i.current,x=Dn(o,"recharts-line-"),y=(0,V1.useRef)(x),[b,w]=(0,V1.useState)(!1),j=(0,V1.useCallback)(()=>{"function"==typeof m&&m(),w(!1)},[m]),k=(0,V1.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,V1.useRef)(0);y.current!==x&&(C.current=a.current,y.current=x);var N=C.current;return V1.createElement(Bd,{points:o,showLabels:!b},n.children,V1.createElement(DR,{animationId:x,begin:c,duration:d,isActive:s,easing:u,onAnimationEnd:j,onAnimationStart:k,key:x},e=>{var c,d=Math.min(wl(N,S+N,e),S);if(c=s?l?((e,t,n)=>{var r=n.reduce((e,t)=>e+t,0);if(!r)return Bs(t,e);for(var i=Math.floor(e/r),a=e%r,o=[],l=0,s=0;l<n.length;s+=null!=(c=n[l])?c:0,++l){var c,d=n[l];if(null!=d&&s+d>a){o=[...n.slice(0,l),a-s];break}}var u=o.length%2==0?[0,t]:[t];return[...function(e,t){for(var n=e.length%2!=0?[...e,0]:e,r=[],i=0;i<t;++i)r.push(...n);return r}(n,i),...o,...u].map(e=>"".concat(e,"px")).join(", ")})(d,S,"".concat(l).split(/[,\s]+/gim).map(e=>parseFloat(e))):Bs(S,d):null==l?void 0:String(l),e>0&&S>0&&(i.current=o,a.current=Math.max(a.current,d)),v){var u=v.length/o.length,m=1===e?o:o.map((t,n)=>{var r=Math.floor(n*u);if(v[r]){var i=v[r];return Ba(Ba({},t),{},{x:wl(i.x,t.x,e),y:wl(i.y,t.y,e)})}return f?Ba(Ba({},t),{},{x:wl(2*h,t.x,e),y:wl(p/2,t.y,e)}):Ba(Ba({},t),{},{x:t.x,y:t.y})});return i.current=m,V1.createElement(Bu,{props:n,points:m,clipPathId:t,pathRef:r,strokeDasharray:c})}return V1.createElement(Bu,{props:n,points:o,clipPathId:t,pathRef:r,strokeDasharray:c})}),V1.createElement(N9,{label:n.label}))}function Bh(e){var{clipPathId:t,props:n}=e,r=(0,V1.useRef)(null),i=(0,V1.useRef)(0),a=(0,V1.useRef)(null);return V1.createElement(Bf,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:a})}var Bp=(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:kG(e.payload,t)}};class Bm extends V1.Component{render(){var{hide:e,dot:t,points:n,className:r,xAxisId:i,yAxisId:a,top:o,left:l,width:s,height:c,id:d,needClip:u,zIndex:f}=this.props;if(e)return null;var h=eH("recharts-line",r),{r:p,strokeWidth:m}=DL(t),g=Ms(t),v=2*p+m,x=u?"url(#clipPath-".concat(g?"":"dots-").concat(d,")"):void 0;return V1.createElement(ND,{zIndex:f},V1.createElement(SJ,{className:h},u&&V1.createElement("defs",null,V1.createElement(IP,{clipPathId:d,xAxisId:i,yAxisId:a}),!g&&V1.createElement("clipPath",{id:"clipPath-dots-".concat(d)},V1.createElement("rect",{x:l-v/2,y:o-v/2,width:s+v,height:c+v}))),V1.createElement(F9,{xAxisId:i,yAxisId:a,data:n,dataPointFormatter:Bp,errorBarOffset:0},V1.createElement(Bh,{props:this.props,clipPathId:d}))),V1.createElement(IM,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:x}))}}var Bg={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:CE.line,type:"linear"};function Bv(e){var t=Cs(e,Bg),{activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:l,dot:s,hide:c,isAnimationActive:d,label:u,legendType:f,xAxisId:h,yAxisId:p,id:m}=t,g=Bo(t,Bn),{needClip:v}=IO(h,p),x=wC(Ik),y=wC(ST),b=Su(),w=wC(e=>V9(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 V1.createElement(Bm,Br({},g,{id:m,connectNulls:l,dot:s,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:d,hide:c,label:u,legendType:f,xAxisId:h,yAxisId:p,points:w,layout:y,height:j,width:k,left:S,top:C,needClip:v}))}var Bx=V1.memo(function(e){var t=Cs(e,Bg),n=Su();return V1.createElement(Da,{id:t.id,type:"line"},e=>V1.createElement(V1.Fragment,null,V1.createElement(De,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:k6(n,t),payload:e}]})(t)}),V1.createElement(Bl,{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}),V1.createElement(Dp,{type:"line",id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),V1.createElement(Bv,Br({},t,{id:e}))))},DZ);Bx.displayName="Line";var By=["axis"],Bb=(0,ew.forwardRef)((e,t)=>ew.createElement(Lt,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:By,tooltipPayloadSearcher:Ts,categoricalChartProps:e,ref:t}));function Bw({config:e,data:t}){return(0,eb.jsx)(Fb,{config:e,className:"mt-2 min-h-0 flex-1",children:(0,eb.jsxs)(Bb,{data:t,margin:{left:8,right:8},children:[(0,eb.jsx)(L$,{vertical:!1}),(0,eb.jsx)(L1,{dataKey:"time",tickLine:!1,axisLine:!1,tickMargin:8}),(0,eb.jsx)(Fj,{content:(0,eb.jsx)(Fk,{indicator:"line"})}),(0,eb.jsx)(Bx,{type:"monotone",dataKey:"p2p",stroke:"var(--color-p2p)",strokeWidth:2,dot:!1}),(0,eb.jsx)(Bx,{type:"monotone",dataKey:"direct",stroke:"var(--color-direct)",strokeWidth:2,dot:!1}),(0,eb.jsx)(Bx,{type:"monotone",dataKey:"relay",stroke:"var(--color-relay)",strokeWidth:2,dot:!1})]})})}function Bj({candidates:e}){return(0,eb.jsx)("div",{className:"mt-2 grid min-h-0 flex-1 content-start overflow-hidden",children:e.map(([e,t,n,r,i,a],o)=>(0,eb.jsxs)("div",{className:tK("grid grid-cols-[minmax(0,1fr)_4.5rem_7rem_3.5rem_3rem] gap-3 px-2 py-2",o>0&&"border-t"),children:[(0,eb.jsxs)("span",{className:"truncate text-sm",children:[e," / ",t]}),(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:n}),(0,eb.jsx)("span",{className:"truncate ui-text-kbd text-muted-foreground",children:r}),(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:i}),(0,eb.jsx)("span",{className:"text-right ui-text-kbd text-muted-foreground",children:a})]},`${e}-${t}`))})}let Bk={online:"bg-foreground",warning:"bg-muted-foreground",offline:"bg-destructive"},BS={direct:"stroke-foreground",p2p:"stroke-foreground",relay:"stroke-muted-foreground",down:"stroke-destructive"},BC={topologyNode:function({data:e}){return(0,eb.jsxs)("div",{className:"vtl-surface-card min-w-36 rounded-[var(--surface-card-radius)] border px-3 py-2",children:[(0,eb.jsx)(lE,{type:"target",position:T.Top,className:"!size-0 !border-0 !bg-transparent"}),(0,eb.jsx)(lE,{type:"source",position:T.Bottom,className:"!size-0 !border-0 !bg-transparent"}),(0,eb.jsx)(lE,{type:"target",position:T.Left,className:"!size-0 !border-0 !bg-transparent"}),(0,eb.jsx)(lE,{type:"source",position:T.Right,className:"!size-0 !border-0 !bg-transparent"}),(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,eb.jsx)("span",{className:tK("size-2.5 shrink-0 rounded-full",Bk[e.state])}),(0,eb.jsx)("span",{className:"min-w-0 truncate text-sm font-medium",children:e.label})]}),e.meta?(0,eb.jsx)("div",{className:"mt-1 truncate ui-text-kbd text-muted-foreground",children:e.meta}):null]})}},BN={topologyEdge:function({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:a,targetPosition:o,data:l}){let[s]=aV({sourcePosition:a,sourceX:t,sourceY:n,targetPosition:o,targetX:r,targetY:i}),{x:c,y:d}=function(e){if("u"<typeof document)return{x:0,y:0};let t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d",e);let n=t.getTotalLength(),r=t.getPointAtLength(n/2);return{x:r.x,y:r.y}}(s),u=l?.kind??"direct";return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(lG,{id:e,path:s,className:tK("fill-none",BS[u],"p2p"===u&&"stroke-dasharray-[8_6]","relay"===u&&"stroke-dasharray-[12_8]"),style:{strokeWidth:"down"===u?3:2.4,strokeLinecap:"round",strokeLinejoin:"round"}}),(l?.label||l?.meta)&&(0,eb.jsx)("foreignObject",{x:c-48,y:d-20,width:96,height:40,className:"overflow-visible",requiredExtensions:"http://www.w3.org/1999/xhtml",children:(0,eb.jsxs)("div",{className:"pointer-events-none grid h-10 w-24 content-center rounded-md border bg-background/95 px-2 py-1 text-center shadow-sm",children:[l.label?(0,eb.jsx)("div",{className:"truncate text-xs font-medium leading-4",children:l.label}):null,l.meta?(0,eb.jsx)("div",{className:"truncate ui-text-kbd text-muted-foreground",children:l.meta}):null]})})]})}};function BM({nodes:e,links:t,className:n,...r}){let i=ew.useMemo(()=>e.map(e=>({id:e.id,data:{label:e.label,meta:e.meta,state:e.state??"online"},position:{x:e.x/100*1e3,y:e.y/100*560},type:"topologyNode"})),[e]),a=ew.useMemo(()=>t.map(e=>({id:e.id,data:{kind:e.kind??"direct",label:e.label,meta:e.meta},source:e.from,target:e.to,type:"topologyEdge"})),[t]);return(0,eb.jsx)("div",{"data-slot":"topology-map",className:tK("h-full min-h-0 overflow-hidden rounded-xl bg-muted/25",n),...r,children:(0,eb.jsx)(sk,{children:(0,eb.jsx)(sN,{nodes:i,edges:a,nodeTypes:BC,edgeTypes:BN,fitView:!0,fitViewOptions:{maxZoom:1.15,minZoom:.45,padding:.22},minZoom:.35,maxZoom:1.5,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnDrag:!1,zoomOnScroll:!1,zoomOnDoubleClick:!1,preventScrolling:!1,proOptions:{hideAttribution:!0},className:"topology-flow text-foreground",children:(0,eb.jsx)(sI,{gap:28,size:1,color:"var(--border)",className:"opacity-80"})})})})}function BE({nodes:e,links:t}){return(0,eb.jsx)(BM,{nodes:e,links:t})}function BO({title:e,count:t}){return(0,eb.jsxs)("div",{className:"flex h-7 shrink-0 items-center justify-between",children:[(0,eb.jsx)("h2",{className:"text-sm font-semibold tracking-normal",children:e}),(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:t})]})}function BP({items:e}){return(0,eb.jsx)("div",{className:"mt-2 grid",children:e.map((e,t)=>(0,eb.jsxs)("div",{className:tK("px-2 py-2",t>0&&"border-t"),children:[(0,eb.jsx)("div",{className:"truncate text-sm font-medium",children:e.title}),(0,eb.jsx)("div",{className:tK("mt-1 truncate ui-text-kbd text-muted-foreground","warning"===e.tone&&"text-destructive"),children:e.meta})]},e.id))})}function BA({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,eb.jsxs)("div",{className:"grid w-full grid-cols-[3.25rem_8rem_minmax(0,1fr)_4rem] items-center gap-3",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:e}),(0,eb.jsx)("span",{className:"truncate ui-text-kbd text-muted-foreground",children:t}),(0,eb.jsx)("span",{className:"truncate",children:n}),(0,eb.jsx)("span",{className:"text-right ui-text-kbd text-muted-foreground",children:r})]})})),[e]);return(0,eb.jsx)(mT,{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 Bz({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,eb.jsx)(B_,{item:e})}}),[e]);return(0,eb.jsx)(mT,{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 B_({item:e}){return(0,eb.jsxs)("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_7.5rem_5rem] items-center gap-3",children:[(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("div",{className:"truncate text-sm font-medium",children:e.title}),(0,eb.jsxs)("div",{className:"mt-1 truncate ui-text-kbd text-muted-foreground",children:[e.machine," · ",e.agent," · ",e.started]})]}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)(mA,{value:e.progress,className:"h-1.5"}),(0,eb.jsx)("div",{className:"ui-text-kbd text-muted-foreground",children:e.runtime})]}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)(mA,{value:e.load,className:"h-1.5"}),(0,eb.jsx)("div",{className:"text-right ui-text-kbd text-muted-foreground",children:"load"})]})]})}function BI({workers:e}){return(0,eb.jsx)("div",{className:"mt-2 grid min-h-0 flex-1 content-start overflow-hidden",children:e.map((e,t)=>(0,eb.jsx)(BD,{worker:e,divided:t>0},e.id))})}function BD({worker:e,divided:t}){return(0,eb.jsxs)("div",{className:tK("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,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("div",{className:"truncate text-lg font-semibold tracking-normal",children:e.machine}),(0,eb.jsx)("div",{className:"mt-0.5 truncate ui-text-kbd text-muted-foreground",children:e.role})]}),(0,eb.jsxs)("div",{className:"text-right text-sm font-medium tabular-nums",children:[e.active,"/",e.capacity]}),(0,eb.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,eb.jsx)(BT,{label:"CPU",value:e.cpu}),(0,eb.jsx)(BT,{label:"MEM",value:e.memory})]})]})}function BT({label:e,value:t}){return(0,eb.jsxs)("div",{className:"grid justify-items-center gap-1",children:[(0,eb.jsx)(m_,{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,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:e})]})}function BR({events:e}){let t=ew.useMemo(()=>e.map(([e,t],n)=>({id:`${e}-${t}`,status:0===n?"current":"done",title:(0,eb.jsxs)("div",{className:"grid w-full grid-cols-[3.25rem_minmax(0,1fr)] items-center gap-2",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:e}),(0,eb.jsx)("span",{className:"truncate",children:t})]})})),[e]);return(0,eb.jsx)(mT,{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 BL({machines:e}){return(0,eb.jsx)("div",{className:"mt-2 grid min-h-0 flex-1 content-start overflow-hidden",children:e.map((e,t)=>(0,eb.jsx)(B$,{machine:e,divided:t>0},e.id))})}function B$({machine:e,divided:t}){return(0,eb.jsxs)("div",{className:tK("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,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsxs)("div",{className:"flex items-center gap-2",children:[(0,eb.jsx)(BV,{status:e.status}),(0,eb.jsx)("span",{className:"truncate text-sm font-medium",children:e.name})]}),(0,eb.jsxs)("div",{className:"mt-1 truncate ui-text-kbd text-muted-foreground",children:[e.os," · ",e.link," · heartbeat ",e.heartbeat]})]}),(0,eb.jsxs)("div",{className:"grid gap-2 sm:grid-cols-4",children:[(0,eb.jsx)(BF,{icon:(0,eb.jsx)(FP,{}),label:"CPU",value:e.cpu}),(0,eb.jsx)(BF,{icon:(0,eb.jsx)(Fz,{}),label:"MEM",value:e.memory}),(0,eb.jsx)(BF,{icon:(0,eb.jsx)(FA,{}),label:"DISK",value:e.disk}),(0,eb.jsx)(BF,{icon:(0,eb.jsx)(FI,{}),label:"NET",value:e.network})]})]})}function BF({icon:e,label:t,value:n}){return(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsxs)("div",{className:"flex justify-between gap-1 ui-text-kbd text-muted-foreground",children:[(0,eb.jsxs)("span",{className:"flex items-center gap-1 [&_svg]:size-3",children:[e,t]}),(0,eb.jsxs)("span",{children:[n,"%"]})]}),(0,eb.jsx)(mA,{value:n,className:"h-1.5"})]})}function BV({status:e}){return(0,eb.jsx)("span",{className:tK("size-2 rounded-full bg-border","online"===e&&"bg-primary")})}function BB({links:e}){let t=ew.useMemo(()=>e.map(([e,t,n,r,i])=>({id:`${e}-${t}`,status:"Relay fallback"===n?"blocked":"current",title:(0,eb.jsxs)("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_5rem_4rem_3.5rem] items-center gap-3",children:[(0,eb.jsxs)("span",{className:"truncate",children:[e," / ",t]}),(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:n}),(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:r}),(0,eb.jsx)("span",{className:"text-right ui-text-kbd text-muted-foreground",children:i})]})})),[e]);return(0,eb.jsx)(mT,{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 BH({config:e,data:t}){return(0,eb.jsx)(Fb,{config:e,className:"mt-2 min-h-0 flex-1",children:(0,eb.jsxs)(Lr,{data:t,margin:{left:8,right:8},children:[(0,eb.jsx)(L$,{vertical:!1}),(0,eb.jsx)(L1,{dataKey:"time",tickLine:!1,axisLine:!1,tickMargin:8}),(0,eb.jsx)(Fj,{content:(0,eb.jsx)(Fk,{indicator:"line"})}),(0,eb.jsx)(Tl,{dataKey:"cpu",type:"monotone",fill:"var(--color-cpu)",fillOpacity:.11,stroke:"var(--color-cpu)",strokeWidth:2}),(0,eb.jsx)(Tl,{dataKey:"memory",type:"monotone",fill:"var(--color-memory)",fillOpacity:.1,stroke:"var(--color-memory)",strokeWidth:2}),(0,eb.jsx)(Tl,{dataKey:"network",type:"monotone",fill:"var(--color-network)",fillOpacity:.08,stroke:"var(--color-network)",strokeWidth:2})]})})}function BW({services:e}){let[t,n]=f3(),r=Math.max(1,Math.floor((Math.max(0,n.width-192-64-32)+5)/12)),i=Math.max(48,n.height>0?Math.floor((n.height-0*Math.max(0,e.length-1))/e.length):48),a=Math.max(28,i-22);return(0,eb.jsx)("div",{ref:t,className:"mt-2 min-h-0 flex-1",children:e.map((e,t)=>(0,eb.jsx)(Bq,{service:e,divided:t>0,rowHeight:i,sampleCount:r,sampleHeight:a},e.id))})}function Bq({service:e,divided:t,rowHeight:n,sampleCount:r,sampleHeight:i}){let a=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,eb.jsxs)("div",{className:tK("grid grid-cols-[12rem_minmax(0,1fr)_4rem] items-center gap-4 px-2",t&&"border-t"),style:{height:n},children:[(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("div",{className:"truncate text-sm font-medium",children:e.name}),(0,eb.jsx)("div",{className:tK("mt-0.5 truncate ui-text-kbd text-muted-foreground","告警"===e.state&&"text-destructive"),children:e.state})]}),(0,eb.jsx)("div",{"aria-label":`${e.name} 30 minute stability samples`,className:"flex min-w-0 items-center overflow-hidden",style:{gap:5},children:a.map((t,n)=>{var r;return(0,eb.jsx)("span",{className:tK("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:i},title:`${t}%`},`${e.id}-${n}`)})}),(0,eb.jsxs)("div",{className:"text-right text-sm font-medium tabular-nums",children:[e.samples.at(-1),"%"]})]})}let BU=eN("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),BK=eN("message-square",[["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"}]]),BG=eN("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),BY=eN("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]),BX=[{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 BZ(e,t,n,r,i,a,o){return{id:e,title:t,status:"idle",purpose:n,nodes:r,agents:0,progress:100,health:90,runtime:i,tokenUsage:a,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:[]}}}BX.push(BZ("canvas-terminal-layout","终端工作台草图","记录终端标签组、日志表和命令区的组合方式。",7,"36m",84e3,"昨天 15:21"),BZ("canvas-file-review","文件审阅流程","沉淀文件树、diff 预览和文件标签之间的拖拽关系。",12,"58m",126e3,"周五 20:10"),BZ("canvas-settings-ia","设置导航结构","整理设置菜单面板的主菜单、子菜单和搜索入口。",8,"24m",61e3,"周五 16:42"),BZ("canvas-auth-access","本机账户接入","记录本机用户、工作组加入和可用机器列表关系。",10,"47m",112e3,"周四 22:05"),BZ("canvas-data-ops","运维数据面板","对齐数据表标签、机器状态卡片和运行记录列表。",14,"1h 18m",172e3,"周三 19:48"));let BJ=BX.filter(e=>"idle"!==e.status),BQ=BX.filter(e=>"idle"===e.status);function B0(e,t,n=""){return{title:e,dataSource:t,refreshRate:"30s",note:n}}function B1(e,t){return(0,eb.jsx)("section",{className:tK("size-full rounded-xl border bg-card p-5","vtl-jelly-image-card vtl-jelly-image-card-shadowless"),style:u9({image:t,opacity:.88,blur:"0px"}),children:e})}function B2({onSelect:e}){return[{id:"metric-active",title:"活跃画布",description:"当前正在编辑的画布数量。",icon:(0,eb.jsx)(BY,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:B0("活跃画布","画布列表"),render:e=>B1((0,eb.jsx)(VZ,{label:e.title,description:"当前正在编辑的画布数量",value:String(BJ.length)}),u4)},{id:"metric-nodes",title:"运行节点",description:"所有活跃画布内的节点。",icon:(0,eb.jsx)(FN,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:B0("运行节点","画布节点"),render:e=>B1((0,eb.jsx)(VZ,{label:e.title,description:"所有活跃画布内的节点",value:"38"}),u3)},{id:"metric-unsaved",title:"未保存",description:"等待写入的画布变更。",icon:(0,eb.jsx)(BG,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:B0("未保存","画布保存状态"),render:e=>B1((0,eb.jsx)(VZ,{label:e.title,description:"等待写入的画布变更",value:"4"}),u6)},{id:"metric-snapshots",title:"快照",description:"可回退的历史存档。",icon:(0,eb.jsx)(BU,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:B0("快照","画布快照"),render:e=>B1((0,eb.jsx)(VZ,{label:e.title,description:"可回退的历史存档",value:"46"}),u8)},{id:"active",title:"正在使用的画布",description:"活跃画布 Roadmap。",icon:(0,eb.jsx)(BY,{className:"size-4"}),defaultSize:{w:12,h:3},defaultConfig:B0("正在使用的画布","画布列表"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(BO,{title:t.title,count:BJ.length}),(0,eb.jsx)(FM,{canvases:BJ,scrollable:!0,onSelect:e})]})},{id:"recent",title:"最近画布",description:"最近打开的画布。",icon:(0,eb.jsx)(mL,{className:"size-4"}),defaultSize:{w:12,h:Math.max(3,Math.ceil(.75*BQ.length)+1)},defaultConfig:B0("最近画布","画布列表"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col",children:[(0,eb.jsx)(BO,{title:t.title,count:BQ.length}),(0,eb.jsx)(FM,{canvases:BQ,mode:"archive",onSelect:e})]})}]}let B5=[{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*BQ.length)+1)}];function B4({onSelect:e,conversations:t=mJ}){let n=t.filter(e=>"idle"!==e.status),r=t.filter(e=>"idle"===e.status).sort((e,t)=>e.lastOpened.localeCompare(t.lastOpened)),i=n.length>0?Math.round(n.reduce((e,t)=>e+t.progress,0)/n.length):0,a=t.reduce((e,t)=>e+t.tokens,0);return[{id:"metric-working",title:"工作中",description:"当前正在运行的对话。",icon:(0,eb.jsx)(BK,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:B0("工作中","Agent 对话"),render:e=>B1((0,eb.jsx)(VZ,{label:e.title,description:"当前正在运行的对话",value:String(n.length)}),u4)},{id:"metric-progress",title:"平均完成",description:"活跃目标的完成度。",icon:(0,eb.jsx)(BY,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:B0("平均完成","Agent 对话"),render:e=>B1((0,eb.jsx)(VZ,{label:e.title,description:"活跃目标的完成度",value:`${i}%`}),u3)},{id:"metric-tokens",title:"今日 Tokens",description:"本日累计上下文消耗。",icon:(0,eb.jsx)(BG,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:B0("今日 Tokens","Agent 对话"),render:e=>{var t;return B1((0,eb.jsx)(VZ,{label:e.title,description:"本日累计上下文消耗",value:(t=a)>=1e6?`${(t/1e6).toFixed(2)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}),u6)}},{id:"metric-handoff",title:"需确认",description:"等待人工接手的事项。",icon:(0,eb.jsx)(mO,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:B0("需确认","Agent 对话"),render:e=>B1((0,eb.jsx)(VZ,{label:e.title,description:"等待人工接手的事项",value:"3"}),u8)},{id:"working",title:"正在工作的 Agent 对话",description:"活跃 Agent 对话 Roadmap。",icon:(0,eb.jsx)(BK,{className:"size-4"}),defaultSize:{w:12,h:3},defaultConfig:B0("正在工作的 Agent 对话","Agent 对话"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(BO,{title:t.title,count:n.length}),(0,eb.jsx)(bx,{conversations:n,scrollable:!0,onSelect:e})]})},{id:"idle",title:"未在工作的 Agent 对话",description:"未运行 Agent 对话列表。",icon:(0,eb.jsx)(BK,{className:"size-4"}),defaultSize:{w:12,h:Math.max(3,Math.ceil(.75*m0.length)+1)},defaultConfig:B0("未在工作的 Agent 对话","Agent 对话"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col",children:[(0,eb.jsx)(BO,{title:t.title,count:r.length}),(0,eb.jsx)(bx,{conversations:r,mode:"archive",onSelect:e})]})}]}let B3=[{id:"metric-working",kind:"metric-working",x:0,y:0,w:3,h:3},{id:"metric-progress",kind:"metric-progress",x:3,y:0,w:3,h:3},{id:"metric-tokens",kind:"metric-tokens",x:6,y:0,w:3,h:3},{id:"metric-handoff",kind:"metric-handoff",x:9,y:0,w:3,h:3},{id:"working",kind:"working",x:0,y:3,w:12,h:3},{id:"idle",kind:"idle",x:0,y:6,w:12,h:Math.max(3,Math.ceil(.75*m0.length)+1)}],B6={subagents:[],mainModels:[],folders:[],blockedCommands:[],allowedTools:["vantaloom_read","shell","apply_patch"],deniedTools:[],plugins:[],hosts:["local"]};async function B8(){return(await Hs("/api/local/agent/conversations")).conversations.map(Hl)}async function B7(){let e=await Hs("/api/local/agent/conversations/recent",void 0,{allowNotFound:!0});return e?Ho(e):void 0}async function B9(e){return Ho(await Hs(`/api/local/agent/conversations/${encodeURIComponent(e)}`))}async function He(e){return Ho(await Hs(`/api/local/agent/conversations/${encodeURIComponent(e)}/open`,{method:"POST"}))}async function Ht(e){return Ho(await Hs("/api/local/agent/conversations",{method:"POST",body:JSON.stringify(e)}))}async function Hn(e,t){return Ho(await Hs(`/api/local/agent/conversations/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)}))}async function Hr(e){await Hs(`/api/local/agent/conversations/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Hi(e,t){return Ho(await Hs(`/api/local/agent/conversations/${encodeURIComponent(e)}/panes`,{method:"PUT",body:JSON.stringify(t)}))}async function Ha(e,t){return Ho(await Hs(`/api/local/agent/conversations/${encodeURIComponent(e)}/chat-runs`,{method:"POST",body:JSON.stringify(t)}))}function Ho(e){return{conversation:Hl(e.conversation),events:e.events??[],panes:e.panes??{layoutMode:"quad",agentPosition:"left",panes:[]}}}function Hl(e){let t=e.runtimeSeconds??0,n={...B6,...e.settings};return{id:e.id,title:e.title||"新 Agent 对话",agent:e.agent||"Local Agent",status:e.status??"idle",goal:e.goal||"",progress:e.progress??0,taskProgress:e.taskProgress?.length?e.taskProgress:[e.progress??0,0,0],runtime:function(e){if(e<=0)return"0m";let t=Math.floor(e/3600),n=Math.floor(e%3600/60);return t>0?`${t}h ${n}m`:`${Math.max(1,n)}m`}(t),runtimeSeconds:t,tokens:e.tokens??0,lastOpened:function(e){let t=Date.parse(e);if(!Number.isFinite(t))return"刚刚";let n=Math.max(0,Math.floor((Date.now()-t)/1e3));if(n<60)return"刚刚";let r=Math.floor(n/60);if(r<60)return`${r} 分钟前`;let i=Math.floor(r/60);if(i<24)return`${i} 小时前`;let a=Math.floor(i/24);return 1===a?"昨天":a<7?`${a} 天前`:new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(t)}(e.lastOpenedAt??e.updatedAt??e.createdAt),roadmap:e.roadmap?.length?e.roadmap:[{title:"配置会话环境",state:"done"},{title:"等待首条消息",state:"queued"}],settings:n,createdAt:e.createdAt,updatedAt:e.updatedAt,lastOpenedAt:e.lastOpenedAt,lastSeq:e.lastSeq??0,ownerMachineId:e.ownerMachineId??"local"}}async function Hs(e,t,n){let r=await fetch(gQ(e),{cache:"no-store",...t,headers:{...t?.body?{"Content-Type":"application/json"}:{},...t?.headers}});if(n?.allowNotFound&&404===r.status)return;let i=await r.json().catch(()=>({}));if(!r.ok)throw Error("string"==typeof i?.error?i.error:"agent conversation api failed");return i}function Hc({clipboardItems:e=[],onClipboardItemsChange:t,onOpenConversation:n,onOverlayOpenChange:r}){let[i,a]=ew.useState(),[o,l]=ew.useState(),[s,c]=ew.useState(),[d,u]=ew.useState(mZ),[f,h]=ew.useState(()=>Object.fromEntries(mJ.map(e=>[e.id,e.settings.mainModels]))),[p,m]=ew.useState(()=>Object.fromEntries(mJ.map(e=>[e.id,e.settings.subagents]))),[g,v]=ew.useState(()=>Object.fromEntries(mJ.map(e=>[e.id,{folders:e.settings.folders,blockedCommands:e.settings.blockedCommands,allowedTools:e.settings.allowedTools,deniedTools:e.settings.deniedTools,plugins:e.settings.plugins,hosts:e.settings.hosts}]))),x=o??mJ,y=i&&o?o.find(e=>e.id===i.id)??i:i;function b(e,t){t.trim()&&(l(n=>(n??x).map(n=>n.id===e?{...n,title:t}:n)),a(n=>n?.id===e?{...n,title:t}:n))}async function w(e,t){let n=t.trim();if(n)try{let t=await Hn(e,{title:n});l(n=>(n??x).map(n=>n.id===e?t.conversation:n)),a(n=>n?.id===e?t.conversation:n)}catch{b(e,n)}}async function j(e,t){let n=x.find(t=>t.id===e);if(!n)return;let r=g[e]??{folders:n.settings.folders,blockedCommands:n.settings.blockedCommands,allowedTools:n.settings.allowedTools,deniedTools:n.settings.deniedTools,plugins:n.settings.plugins,hosts:n.settings.hosts},i={subagents:t.subagents??p[e]??n.settings.subagents,mainModels:t.mainModels??f[e]??n.settings.mainModels,folders:t.folders??r.folders,blockedCommands:t.blockedCommands??r.blockedCommands,allowedTools:t.allowedTools??r.allowedTools,deniedTools:t.deniedTools??r.deniedTools,plugins:t.plugins??r.plugins,hosts:t.hosts??r.hosts};try{let t=await Hn(e,{settings:i});l(n=>(n??x).map(n=>n.id===e?t.conversation:n)),a(n=>n?.id===e?t.conversation:n)}catch{return}}async function k(e){if("working"!==e.status&&!s){c(e.id);try{await Hr(e.id),l(t=>(t??x).filter(t=>t.id!==e.id)),a(t=>t?.id===e.id?void 0:t),h(t=>Hd(t,e.id)),m(t=>Hd(t,e.id)),v(t=>Hd(t,e.id))}catch{return}finally{c(void 0)}}}ew.useEffect(()=>{let e=!0;return async function(){try{let t=await B8();e&&l(t)}catch{e&&l(mJ)}}(),()=>{e=!1}},[]),ew.useEffect(()=>{h(e=>({...Object.fromEntries(x.map(e=>[e.id,e.settings.mainModels])),...e})),m(e=>({...Object.fromEntries(x.map(e=>[e.id,e.settings.subagents])),...e})),v(e=>({...Object.fromEntries(x.map(e=>[e.id,{folders:e.settings.folders,blockedCommands:e.settings.blockedCommands,allowedTools:e.settings.allowedTools,deniedTools:e.settings.deniedTools,plugins:e.settings.plugins,hosts:e.settings.hosts}])),...e}))},[x]);let S=ew.useMemo(()=>B4({onSelect:a,conversations:x}),[x]);return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(mk,{boardId:"agent-conversation-library",definitions:S,initialLayouts:B3,clipboardItems:e,actionLabel:"对话库页面卡片操作",paletteGroupTitle:"对话库页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:r}),(0,eb.jsx)(bv,{conversation:y,sharedSubagents:d,mainModels:i?f[i.id]??i.settings.mainModels:[],enabledSubagentIds:i?p[i.id]??i.settings.subagents:[],sessionSettings:i?g[i.id]??{folders:i.settings.folders,blockedCommands:i.settings.blockedCommands,allowedTools:i.settings.allowedTools,deniedTools:i.settings.deniedTools,plugins:i.settings.plugins,hosts:i.settings.hosts}:{folders:[],blockedCommands:[],allowedTools:[],deniedTools:[],plugins:[],hosts:[]},onMainModelsChange:(e,t)=>{h(n=>({...n,[e]:t})),j(e,{mainModels:t})},onSharedSubagentsChange:u,onEnabledSubagentIdsChange:(e,t)=>{m(n=>({...n,[e]:t})),j(e,{subagents:t})},onSessionSettingsChange:(e,t)=>{v(n=>({...n,[e]:t})),j(e,t)},onConversationTitleChange:b,onConversationTitleCommit:(e,t)=>{w(e,t)},deletingConversation:!!i&&s===i.id,onDeleteConversation:e=>{k(e)},onEnterConversation:e=>{a(void 0),n?.(e.id)},onOpenChange:e=>{e||a(void 0)}})]})}function Hd(e,t){let n={...e};return delete n[t],n}let Hu={folders:[],blockedCommands:[],allowedTools:["vantaloom_read","shell","apply_patch"],deniedTools:[],plugins:[],hosts:["local"]};function Hf(){return`新 Agent 对话 ${new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date)}`}function Hh({open:e,onOpenChange:t,onCreated:n}){let[r,i]=ew.useState("name"),[a,o]=ew.useState(Hf),[l,s]=ew.useState(mZ),[c,d]=ew.useState([]),[u,f]=ew.useState([]),[h,p]=ew.useState(Hu),[m,g]=ew.useState(!1),[v,x]=ew.useState("");ew.useEffect(()=>{e&&(i("name"),o(Hf()),x(""))},[e]);let y=ew.useMemo(()=>({id:"new-agent-conversation",title:a.trim()||"新 Agent 对话",agent:"Local Agent",status:m?"working":"idle",goal:"",progress:0,taskProgress:[100,0],runtime:"0m",tokens:0,lastOpened:"刚刚",roadmap:[{title:"配置会话环境",state:"done"},{title:"等待首条消息",state:"queued"}],settings:{subagents:u,mainModels:c,...h}}),[a,m,u,c,h]),b=ew.useCallback(async()=>{if(!m){g(!0),x("");try{if(!a.trim()){i("name"),x("请填写会话名称");return}let e=await Ht({title:y.title,agent:y.agent,goal:y.goal,ownerMachineId:"local",settings:y.settings});n(e),t(!1)}catch(e){x(e instanceof Error?e.message:"创建对话失败")}finally{g(!1)}}},[y,a,m,n,t]),w=ew.useMemo(()=>[{id:"name",label:"会话名称",content:(0,eb.jsx)(g3,{title:a,onTitleChange:o})},{id:"agent-models",label:"代理模型配置",icon:(0,eb.jsx)(mE,{}),badge:c.length,content:(0,eb.jsx)(g6,{conversation:y,sharedSubagents:l,mainModels:c,enabledSubagentIds:u,onMainModelsChange:d,onSharedSubagentsChange:s})},{id:"subagent-management",label:"子代理管理",icon:(0,eb.jsx)(mR,{}),badge:l.length,content:(0,eb.jsx)(g8,{conversation:y,sharedSubagents:l,enabledSubagentIds:u,onSharedSubagentsChange:s,onEnabledSubagentIdsChange:f})},{id:"folders",label:"工作区文件夹",icon:(0,eb.jsx)(mL,{}),content:(0,eb.jsx)(bm,{title:"可访问的工作区文件夹",value:h.folders,onValueChange:e=>p(t=>({...t,folders:e}))})},{id:"commands",label:"禁止命令",icon:(0,eb.jsx)(mH,{}),content:(0,eb.jsx)(bu,{sharedSubagents:l,enabledSubagentIds:u,mainBlockedCommands:h.blockedCommands,onMainBlockedCommandsChange:e=>p(t=>({...t,blockedCommands:e})),onSharedSubagentsChange:s})},{id:"tools",label:"工具权限",icon:(0,eb.jsx)(mW,{}),content:(0,eb.jsx)(bf,{sharedSubagents:l,enabledSubagentIds:u,mainAllowedTools:h.allowedTools,mainDeniedTools:h.deniedTools,onMainAllowedToolsChange:e=>p(t=>({...t,allowedTools:e})),onMainDeniedToolsChange:e=>p(t=>({...t,deniedTools:e})),onSharedSubagentsChange:s})},{id:"plugins",label:"插件",icon:(0,eb.jsx)(mB,{}),content:(0,eb.jsx)(bg,{title:"已加载插件",value:h.plugins,options:mY,placeholder:"选择插件",onValueChange:e=>p(t=>({...t,plugins:e}))})},{id:"hosts",label:"可访问主机",icon:(0,eb.jsx)(m$,{}),content:(0,eb.jsx)(bg,{title:"可访问的主机",value:h.hosts,options:[{value:"local",label:"local"},...mX],placeholder:"选择主机",onValueChange:e=>p(t=>({...t,hosts:e}))})},{id:"overview",label:"首页",icon:(0,eb.jsx)(mV,{}),content:(0,eb.jsxs)("div",{className:"grid gap-3",children:[(0,eb.jsx)(ve,{conversation:y,onEnter:()=>{b()}}),v?(0,eb.jsx)("div",{className:"text-sm text-destructive",children:v}):null]})}],[y,a,b,u,v,c,h,l]),j=w.find(e=>e.id===r)??w[0];return(0,eb.jsx)(po,{open:e,onOpenChange:t,children:(0,eb.jsxs)(p7,{hideClose:!0,className:"h-[min(44rem,calc(100svh-2rem))] max-w-5xl gap-0 overflow-hidden p-0",children:[(0,eb.jsx)(me,{className:"sr-only",children:"新建 Agent 对话"}),(0,eb.jsx)(mt,{className:"sr-only",children:"逐步配置新 Agent 对话。"}),(0,eb.jsxs)("div",{className:"grid size-full min-h-0 grid-rows-[auto_minmax(0,1fr)]",children:[(0,eb.jsx)("header",{className:"min-w-0 border-b bg-muted/20 px-5 py-4",children:(0,eb.jsx)("ol",{className:"flex max-w-md items-center","aria-label":"新建 Agent 对话步骤",children:w.map((e,t)=>{let n=j?.id===e.id,r=w.findIndex(e=>e.id===j?.id);return(0,eb.jsxs)("li",{className:"flex min-w-0 items-center",children:[(0,eb.jsx)("button",{type:"button","aria-current":n?"step":void 0,"aria-label":`转到${e.label}`,title:"string"==typeof e.label?e.label:void 0,onClick:()=>i(e.id),className:tK("inline-flex size-8 shrink-0 items-center justify-center rounded-full border ui-text-kbd font-medium transition-colors focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none",n?"border-primary bg-primary text-primary-foreground":t<=r?"border-foreground bg-foreground/10 text-foreground":"border-border bg-background text-muted-foreground hover:bg-muted hover:text-foreground"),children:t+1}),t<w.length-1?(0,eb.jsx)("span",{"aria-hidden":"true",className:tK("h-px w-6 shrink-0 bg-border transition-colors sm:w-8",t<r&&"bg-foreground")}):null]},e.id)})})}),(0,eb.jsx)(f1,{className:"min-h-0 bg-background",children:(0,eb.jsx)("div",{className:"p-5 pr-9",children:j?.content})})]})]})})}let Hp=eN("panel-right",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),Hm=eN("shredder",[["path",{d:"M4 13V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5",key:"1eob4r"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 22v-5",key:"sfixh4"}],["path",{d:"M14 19v-2",key:"pdve8j"}],["path",{d:"M18 20v-3",key:"uox2gk"}],["path",{d:"M2 13h20",key:"5evz65"}],["path",{d:"M6 20v-3",key:"c6pdcb"}]]),Hg=eN("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]),Hv=eN("clapperboard",[["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z",key:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]]),Hx=eN("shield",[["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"}]]),Hy={blank:function({id:e,selected:t,data:n}){let r="select"===n.mode,i="number"==typeof n.contentScale&&n.contentScale>0?n.contentScale:1,a="string"==typeof n.kind?n.kind:void 0;return(0,eb.jsxs)("div",{"data-slot":"node-canvas-blank-node","data-node-kind":a,"data-selected":t?"":void 0,"data-resizing":n.resizing?"":void 0,style:{background:"var(--node-canvas-node)",borderColor:t||n.resizing?"color-mix(in oklch, var(--foreground) 72%, var(--border))":"var(--node-canvas-node-border)",borderWidth:t||n.resizing?"calc(2px / var(--node-canvas-zoom, 1))":"calc(1px / var(--node-canvas-zoom, 1))"},className:tK("relative box-border h-full w-full rounded-lg border shadow-sm transition-shadow",n.resizing&&"rounded-none",t&&"shadow-md"),onPointerDown:t=>{"connect"===n.mode&&n.onConnectPointerDown?.(e,t)},onClick:t=>{"drag"===n.mode&&(t.stopPropagation(),n.onSelectNode?.(e))},children:[ch.map(e=>(0,eb.jsxs)(ew.Fragment,{children:[(0,eb.jsx)(lE,{id:`source-${e.id}`,type:"source",position:e.position,isConnectable:!1,className:tK("node-canvas-handle",e.className)}),(0,eb.jsx)(lE,{id:`target-${e.id}`,type:"target",position:e.position,isConnectable:!1,className:tK("node-canvas-handle",e.className)})]},e.id)),n.content?(0,eb.jsx)("div",{"data-slot":"node-canvas-node-content","data-node-kind":a,className:tK("nodrag nopan nowheel absolute inset-0 z-0 h-full min-h-0 w-full overflow-hidden rounded-[inherit]",r?"pointer-events-auto":"pointer-events-none select-none"),children:(0,eb.jsx)("div",{"data-slot":"node-canvas-node-content-scale","data-node-kind":a,className:"node-canvas-content-scale min-h-0 origin-top-left",style:{"--node-canvas-content-scale":String(i)},children:n.content})}):null,n.resizing?cf.map(e=>(0,eb.jsx)(sJ,{position:e,variant:R.Handle,minWidth:96,minHeight:64,autoScale:!1,className:"node-canvas-resize-handle"},e)):null]})}},Hb={connection:function({id:e,source:t,sourceX:n,sourceY:r,sourcePosition:i,target:a,targetX:o,targetY:l,targetPosition:s,data:c,style:d}){let{getNode:u,screenToFlowPosition:f}=ld(),h=ew.useId().replace(/:/g,""),p=Math.max(c?.viewportZoom??1,.1),m=9/p,g=u(t),v=u(a),x=c?.bidirectional,y=ew.useMemo(()=>({x:n,y:r}),[n,r]),b=ew.useMemo(()=>({x:o,y:l}),[o,l]),w=cb(y,i,g),j=cb(b,s,v),k=ew.useMemo(()=>c?.anchors??[],[c?.anchors]),S=ew.useMemo(()=>0===k.length?function({sourceNode:e,targetNode:t}){if(!e||!t)return;let n=cx(e),r=cx(t),i=[],a=cy(n.y,n.bottom,r.y,r.bottom),o=cy(n.x,n.right,r.x,r.right);i.push({axis:"x",crossDistance:a.distance,distance:Math.abs(n.right-r.x),seam:(n.right+r.x)/2,midpoint:a.midpoint,sourcePosition:T.Right,targetPosition:T.Left,direction:1}),i.push({axis:"x",crossDistance:a.distance,distance:Math.abs(n.x-r.right),seam:(n.x+r.right)/2,midpoint:a.midpoint,sourcePosition:T.Left,targetPosition:T.Right,direction:-1}),i.push({axis:"y",crossDistance:o.distance,distance:Math.abs(n.bottom-r.y),seam:(n.bottom+r.y)/2,midpoint:o.midpoint,sourcePosition:T.Bottom,targetPosition:T.Top,direction:1}),i.push({axis:"y",crossDistance:o.distance,distance:Math.abs(n.y-r.bottom),seam:(n.y+r.bottom)/2,midpoint:o.midpoint,sourcePosition:T.Top,targetPosition:T.Bottom,direction:-1});let l=i.filter(e=>e.distance<=64&&e.crossDistance<=80).sort((e,t)=>e.distance+.35*e.crossDistance-(t.distance+.35*t.crossDistance))[0];if(!l)return;if("x"===l.axis){let e={x:l.seam-18*l.direction,y:l.midpoint},t={x:l.seam+18*l.direction,y:l.midpoint};return{path:`M ${e.x} ${e.y} L ${t.x} ${t.y}`,sourcePoint:e,targetPoint:t,terminalPoint:{x:l.seam,y:l.midpoint},sourcePosition:l.sourcePosition,targetPosition:l.targetPosition}}let s={x:l.midpoint,y:l.seam-18*l.direction},c={x:l.midpoint,y:l.seam+18*l.direction};return{path:`M ${s.x} ${s.y} L ${c.x} ${c.y}`,sourcePoint:s,targetPoint:c,terminalPoint:{x:l.midpoint,y:l.seam},sourcePosition:l.sourcePosition,targetPosition:l.targetPosition}}({sourceNode:g,targetNode:v}):void 0,[k.length,g,v]),C=ew.useMemo(()=>S?[S.sourcePoint,S.targetPoint]:[w,...k,j],[k,w,j,S]),N=ew.useMemo(()=>S?.path??function(e,t,n){if(e.length<2)return"";if(2===e.length){let r=e[0],i=e[1],a=cm(t),o=cm(n),l=cg(r,i),s={x:r.x+a.x*l,y:r.y+a.y*l},c={x:i.x+o.x*l,y:i.y+o.y*l};return`M ${r.x} ${r.y} C ${s.x} ${s.y}, ${c.x} ${c.y}, ${i.x} ${i.y}`}let r=e[0],i=[`M ${r.x} ${r.y}`],a=cm(t),o=cm(n);for(let t=0;t<e.length-1;t+=1){let n=e[t],r=e[t-1]??n,l=e[t+1],s=e[t+2]??l,c=0===t,d=t===e.length-2,u=cg(n,l),f=c?{x:n.x+a.x*u,y:n.y+a.y*u}:{x:n.x+(l.x-r.x)/6,y:n.y+(l.y-r.y)/6},h=d?{x:l.x+o.x*u,y:l.y+o.y*u}:{x:l.x-(s.x-n.x)/6,y:l.y-(s.y-n.y)/6};i.push(`C ${f.x} ${f.y}, ${h.x} ${h.y}, ${l.x} ${l.y}`)}return i.join(" ")}(C,i,s),[S?.path,C,i,s]),M=ew.useMemo(()=>cv({point:S?.terminalPoint??w,position:S?.sourcePosition??i}),[w,S?.sourcePosition,S?.terminalPoint,i]),E=ew.useMemo(()=>cv({point:S?.terminalPoint??j,position:S?.targetPosition??s}),[j,S?.targetPosition,S?.terminalPoint,s]),O=ew.useCallback(()=>{if(c?.mode!=="connect")return;let{anchor:t,anchorIndex:n}=function(e){let t=0,n=e.slice(1).map((n,r)=>{let i=e[r],a=Math.hypot(n.x-i.x,n.y-i.y);return t+=a,a}),r=t/2,i=0;for(let t=0;t<n.length;t+=1){let a=n[t],o=i+a;if(r<=o||t===n.length-1){let n=e[t],o=e[t+1],l=0===a?0:(r-i)/a;return{anchor:{x:n.x+(o.x-n.x)*l,y:n.y+(o.y-n.y)*l},anchorIndex:t}}i=o}return{anchor:e[0],anchorIndex:0}}(C);c.onAddAnchor?.(e,t,n)},[c,e,C]);return(0,eb.jsxs)("g",{className:tK("node-canvas-edge",S&&"node-canvas-edge--joined"),children:[(0,eb.jsx)("defs",{children:(0,eb.jsx)("marker",{id:h,viewBox:"0 0 10 10",refX:"8.8",refY:"5",markerWidth:m,markerHeight:m,markerUnits:"userSpaceOnUse",orient:"auto-start-reverse",children:(0,eb.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",className:"node-canvas-edge-arrow"})})}),(0,eb.jsx)(lG,{id:e,path:N,markerStart:x?`url(#${h})`:void 0,markerEnd:`url(#${h})`,interactionWidth:18,style:d,className:"node-canvas-edge-path"}),S?null:(0,eb.jsx)("path",{d:M,className:"node-canvas-edge-terminal"}),S?null:(0,eb.jsx)("path",{d:E,className:"node-canvas-edge-terminal"}),S?(0,eb.jsx)(cj,{route:S,viewportZoom:p}):null,(0,eb.jsx)("path",{d:N,className:"node-canvas-edge-interaction",onClick:e=>{e.stopPropagation(),O()},onPointerEnter:()=>{c?.mode==="cut"&&c.cutActive&&0===k.length&&c.onCutEdge?.(e)}}),k.map((t,n)=>(0,eb.jsx)("circle",{cx:t.x,cy:t.y,r:5,className:"node-canvas-edge-anchor",onPointerDown:t=>(function(t,n){if(t.preventDefault(),t.stopPropagation(),c?.mode==="cut")return void c.onDeleteAnchor?.(e,n);let r=t=>{c?.onMoveAnchor?.(e,n,f({x:t.clientX,y:t.clientY}))},i=()=>{window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",i)};window.addEventListener("pointermove",r),window.addEventListener("pointerup",i,{once:!0})})(t,n),onClick:t=>{t.stopPropagation(),c?.mode==="cut"&&c.onDeleteAnchor?.(e,n)}},`${t.x}-${t.y}-${n}`))]})}};function Hw(e){return{width:2*e.width,height:2*e.height}}function Hj(e){return{width:e.width,height:e.height}}function Hk(e){return 16*Math.round(e/16)}function HS(e,t){return{x:Hk(e.x-t.width/2),y:Hk(e.y-t.height/2)}}let HC=[{id:"blank-1",type:"blank",position:{x:128,y:112},data:{contentScale:2,kind:"multi-tab-system",tabs:[]},width:1280,height:832,style:Hj({width:1280,height:832})},{id:"blank-2",type:"blank",position:{x:1472,y:112},data:{contentScale:2,kind:"file-tree-panel"},width:704,height:992,style:Hj({width:704,height:992})}],HN=[{id:"multi-tab-system",title:"多标签页系统",description:"文件、浏览器、diff 等标签的组合容器。",icon:(0,eb.jsx)(Hv,{className:"size-4"}),size:Hw({width:640,height:416}),keywords:"tabs workspace multi tab system 多标签"},{id:"file-tree-panel",title:"文件管理树",description:"类似 VS Code Explorer 的项目文件树。",icon:(0,eb.jsx)(function(){return(0,eb.jsx)(FA,{className:"size-4"})},{}),size:Hw({width:352,height:496}),keywords:"file tree explorer 文件树"},{id:"process-management",title:"进程管理",description:"按机器查看进程、资源占用和排序状态。",icon:(0,eb.jsx)(Hg,{className:"size-4"}),size:Hw({width:760,height:520}),keywords:"process monitor machine 进程 管理"},{id:"machine-performance",title:"性能监控",description:"机器 CPU、内存、磁盘、网络和 GPU 性能视图。",icon:(0,eb.jsx)(FP,{className:"size-4"}),size:Hw({width:760,height:520}),keywords:"performance monitor cpu memory gpu 性能"},{id:"firewall-policy-workspace",title:"防火墙策略",description:"防火墙策略、IP 地址、续期和申请工作区。",icon:(0,eb.jsx)(Hx,{className:"size-4"}),size:Hw({width:880,height:560}),keywords:"firewall policy security 防火墙 策略"},{id:"machine-file-management",title:"文件管理窗口",description:"单个完整文件管理窗口,支持文件拖拽移动。",icon:(0,eb.jsx)(vx,{className:"size-4"}),size:Hw({width:760,height:520}),keywords:"file manager window explorer 文件 管理 窗口"},{id:"agent-conversation-panel",title:"Agent 对话面板",description:"Agent 对话流和输入框,可作为画布内独立节点。",icon:(0,eb.jsx)(mR,{className:"size-4"}),size:Hw({width:520,height:640}),keywords:"agent chat conversation composer 对话 输入框"},{id:"file-tab-viewer",title:"文件标签",description:"代码、Markdown、HTML 与二进制文件预览。",icon:(0,eb.jsx)(HM,{}),size:Hw({width:672,height:464}),keywords:"file code markdown viewer 文件标签"},{id:"browser-tab-viewer",title:"浏览器标签",description:"地址栏、刷新、前进后退和响应式预览。",icon:(0,eb.jsx)(F_,{className:"size-4"}),size:Hw({width:672,height:464}),keywords:"browser web preview 浏览器"},{id:"diff-tab-viewer",title:"Diff 标签",description:"统一/分栏差异预览和折叠上下文。",icon:(0,eb.jsx)(BY,{className:"size-4"}),size:Hw({width:720,height:464}),keywords:"diff review code 差异"},{id:"data-table-tab-viewer",title:"数据表标签",description:"筛选、排序、选择行和复制单元格。",icon:(0,eb.jsx)(FA,{className:"size-4"}),size:Hw({width:672,height:432}),keywords:"table csv json data 数据表"},{id:"terminal-tab-group",title:"终端标签组",description:"多终端会话和 TUI 友好的等宽渲染。",icon:(0,eb.jsx)(HE,{}),size:Hw({width:672,height:416}),keywords:"terminal shell xterm 终端"}];function HM(){return(0,eb.jsx)(vs,{className:"size-4"})}function HE(){return(0,eb.jsx)(mH,{className:"size-4"})}function HO(e){return"file-tab-viewer"===e||"browser-tab-viewer"===e||"diff-tab-viewer"===e||"data-table-tab-viewer"===e||"terminal-tab-group"===e}function HP(e){switch(e){case"file-tab-viewer":return(0,eb.jsx)(HM,{});case"browser-tab-viewer":return(0,eb.jsx)(F_,{className:"size-4"});case"diff-tab-viewer":return(0,eb.jsx)(BY,{className:"size-4"});case"data-table-tab-viewer":return(0,eb.jsx)(FA,{className:"size-4"});case"terminal-tab-group":return(0,eb.jsx)(HE,{})}}function HA(e,t=e){switch(e){case"file-tab-viewer":return{id:t,kind:e,title:"选择文件",defaultValue:"",defaultMode:"review"};case"browser-tab-viewer":return{id:t,kind:e,title:"Preview",defaultUrl:"https://vantaloom.local/ops"};case"diff-tab-viewer":return{id:t,kind:e,title:"Diff",file:{name:"diff.patch",path:"diff.patch",language:"diff"},diff:""};case"data-table-tab-viewer":return{id:t,kind:e,title:"选择数据表",tableData:[]};case"terminal-tab-group":return{id:t,kind:e,title:"terminal"}}}async function Hz(){return HV("/api/local/files/roots")}async function H_(e,t){let n=new URLSearchParams({machineId:e,path:t});return HV(`/api/local/files/list?${n}`)}async function HI(e,t){let n=new URLSearchParams({machineId:e,path:t});return HV(`/api/local/files/read?${n}`)}async function HD(e){return HV("/api/local/files/write",{method:"PUT",body:JSON.stringify(e)})}async function HT(e){return HV("/api/local/files/directories",{method:"POST",body:JSON.stringify(e)})}async function HR(e){return HV("/api/local/files/entries/rename",{method:"PATCH",body:JSON.stringify(e)})}async function HL(e){await HV("/api/local/files/entries",{method:"DELETE",body:JSON.stringify(e)})}async function H$(e){return HV("/api/local/files/transfers",{method:"POST",body:JSON.stringify(e)})}async function HF(){return HV("/api/local/files/transfers")}async function HV(e,t){let n=await fetch(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:"file api failed");return r}async function HB(){return HG("/api/local/terminals/machines")}async function HH(e){let t=new URLSearchParams;e&&t.set("scopeId",e);let n=t.toString();return HG(`/api/local/terminals/sessions${n?`?${n}`:""}`)}async function HW(e){return HG("/api/local/terminals/sessions",{method:"POST",body:JSON.stringify(e)})}async function Hq(e){await HG(`/api/local/terminals/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}async function HU(e,t){await HG(`/api/local/terminals/sessions/${encodeURIComponent(e)}/input`,{method:"POST",body:JSON.stringify({data:t})})}async function HK(e,t){return HG(`/api/local/terminals/sessions/${encodeURIComponent(e)}/resize`,{method:"POST",body:JSON.stringify(t)})}async function HG(e,t){let n=await fetch(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:"terminal api failed");return r}let HY=eN("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);function HX({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=function(e){switch(typeof e){case"number":return[e,"px"];case"string":{let t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}(n);switch(a){case"%":r=i/100*e;break;case"px":r=i;break;case"rem":r=i*parseFloat(getComputedStyle(t.ownerDocument.body).fontSize);break;case"em":r=i*parseFloat(getComputedStyle(t).fontSize);break;case"vh":r=i/100*window.innerHeight;break;case"vw":r=i/100*window.innerWidth}return r}function HZ(e){return parseFloat(e.toFixed(3))}function HJ({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>e+="horizontal"===t?n.element.offsetWidth:n.element.offsetHeight,0)}function HQ(e){let{panels:t}=e,n=HJ({group:e});return 0===n?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:!0===e.panelConstraints.collapsible,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let t,{element:r,panelConstraints:i}=e,a=0;void 0!==i.collapsedSize&&(a=HZ(HX({groupSize:n,panelElement:r,styleProp:i.collapsedSize})/n*100)),void 0!==i.defaultSize&&(t=HZ(HX({groupSize:n,panelElement:r,styleProp:i.defaultSize})/n*100));let o=0;void 0!==i.minSize&&(o=HZ(HX({groupSize:n,panelElement:r,styleProp:i.minSize})/n*100));let l=100;return void 0!==i.maxSize&&(l=HZ(HX({groupSize:n,panelElement:r,styleProp:i.maxSize})/n*100)),{groupResizeBehavior:i.groupResizeBehavior,collapsedSize:a,collapsible:!0===i.collapsible,defaultSize:t,disabled:i.disabled,minSize:o,maxSize:l,panelId:e.id}})}function H0(e,t="Assertion error"){if(!e)throw Error(t)}function H1(e,t){return Array.from(t).sort("horizontal"===e?H2:H5)}function H2(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return 0!==n?n:e.element.offsetWidth-t.element.offsetWidth}function H5(e,t){let n=e.element.offsetTop-t.element.offsetTop;return 0!==n?n:e.element.offsetHeight-t.element.offsetHeight}function H4(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function H3(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function H6(e){let{element:t,orientation:r,panels:i,separators:a}=e,o=H1(r,Array.from(t.children).filter(H4).map(e=>({element:e}))).map(({element:e})=>e),l=[],s=!1,c=!1,d=-1,u=-1,f=0,h,p=[];{let e=-1;for(let t of o)t.hasAttribute("data-panel")&&(e++,t.hasAttribute("data-disabled")||(f++,-1===d&&(d=e),u=e))}if(f>1){let t=-1;for(let f of o)if(f.hasAttribute("data-panel")){t++;let a=i.find(e=>e.element===f);if(a){if(h){let i,o=h.element.getBoundingClientRect(),m=f.getBoundingClientRect();if(c){let e="horizontal"===r?new DOMRect(o.right,o.top,0,o.height):new DOMRect(o.left,o.bottom,o.width,0),t="horizontal"===r?new DOMRect(m.left,m.top,0,m.height):new DOMRect(m.left,m.top,m.width,0);switch(p.length){case 0:i=[e,t];break;case 1:{let n=p[0],a=function({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=H3(r,n),l="horizontal"===e?t:o;l<a&&(a=l,i=n)}return H0(i,"No rect found"),i}({orientation:r,rects:[o,m],targetRect:n.element.getBoundingClientRect()});i=[n,a===o?t:e];break}default:i=p}}else i=p.length?p:["horizontal"===r?new DOMRect(o.right,m.top,m.left-o.right,m.height):new DOMRect(m.left,o.bottom,m.width,m.top-o.bottom)];for(let r of i){let i="width"in r?r:r.element.getBoundingClientRect(),o=(void 0===n&&(n="function"==typeof matchMedia&&!!matchMedia("(pointer:coarse)").matches),n)?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(i.width<o){let e=o-i.width;i=new DOMRect(i.x-e/2,i.y,i.width+e,i.height)}if(i.height<o){let e=o-i.height;i=new DOMRect(i.x,i.y-e/2,i.width,i.height+e)}let c=t<=d||t>u;s||c||l.push({group:e,groupSize:HJ({group:e}),panels:[h,a],separator:"width"in r?void 0:r,rect:i}),s=!1}}c=!1,h=a,p=[]}}else if(f.hasAttribute("data-separator")){null!==f.ariaDisabled&&(s=!0);let e=a.find(e=>e.element===f);e?p.push(e):(h=void 0,p=[])}else c=!0}return l}class H8{#t={};addListener(e,t){let n=this.#t[e];return void 0===n?this.#t[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#t[e];if(void 0!==n)if(1===n.length)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){null===r&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#t={}}removeListener(e,t){let n=this.#t[e];if(void 0!==n){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}}let H7=new Map,H9=new H8;function We(e,t){for(let[t]of H7)if(t.id===e)return t}function Wt(e,t){for(let[t,n]of H7)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Wn(e,t){return H9.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function Wr(e,t){let n=H7.get(e);(H7=new Map(H7)).set(e,t),H9.emit("groupChange",{group:e,prev:n,next:t})}let Wi=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Wa(e){let t=e.length;for(;t--;){let n=e[t];if(H0(n,"Missing node"),function(e){let t,n=getComputedStyle(e);return!!("fixed"===n.position||"auto"!==n.zIndex&&("static"!==n.position||"flex"===(t=getComputedStyle(Ws(e)??e).display)||"inline-flex"===t)||1>+n.opacity||"transform"in n&&"none"!==n.transform||"webkitTransform"in n&&"none"!==n.webkitTransform||"mixBlendMode"in n&&"normal"!==n.mixBlendMode||"filter"in n&&"none"!==n.filter||"webkitFilter"in n&&"none"!==n.webkitFilter||"isolation"in n&&"isolate"===n.isolation||Wi.test(n.willChange)||"touch"===n.webkitOverflowScrolling)}(n))return n}return null}function Wo(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Wl(e){let t=[];for(;e;)t.push(e),e=Ws(e);return t}function Ws(e){let{parentNode:t}=e;return null!==t&&"object"==typeof t&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t.host:t}function Wc(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=H6(r),a=function(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=H3(n,a.rect);switch(e){case"horizontal":t.x<=i.x&&(r=a,i=t);break;case"vertical":t.y<=i.y&&(r=a,i=t)}}return r?{distance:i,hitRegion:r}:void 0}(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&function({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!H4(n)||n.contains(e)||e.contains(n))return!0;if(function(e,t){let n;if(e===t)throw Error("Cannot compare node with itself");let r={a:Wl(e),b:Wl(t)};for(;r.a.at(-1)===r.b.at(-1);)n=r.a.pop(),r.b.pop();H0(n,"Stacking order can only be calculated for elements with a common ancestor");let i={a:Wo(Wa(r.a)),b:Wo(Wa(r.b))};if(i.a===i.b){let e=n.childNodes,t={a:r.a.at(-1),b:r.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return -1}}return Math.sign(i.a-i.b)}(n,e)>0){let i=n;for(;i;){var r;if(i.contains(e))break;if(r=i.getBoundingClientRect(),r.x<t.x+t.width&&r.x+r.width>t.x&&r.y<t.y+t.height&&r.y+r.height>t.y)return!1;i=i.parentElement}}return!0}({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Wd(e,t,n=0){return Math.abs(HZ(e)-HZ(t))<=n}function Wu(e,t){return Wd(e,t)?0:e>t?1:-1}function Wf({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:l=100,minSize:s=0}=t;return o&&!e?n:(0>Wu(r,s)&&(r=a&&0>Wu(r,(i+s)/2)?i:s),HZ(r=Math.min(l,r)))}function Wh({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Wd(e,0))return t;let o="imperative-api"===a,l=Object.values(t),s=Object.values(i),c=[...l],[d,u]=r;H0(null!=d,"Invalid first pivot index"),H0(null!=u,"Invalid second pivot index");let f=0;if("keyboard"===a){{let t=e<0?u:d,r=n[t];H0(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=l[t];if(H0(null!=n,`Previous layout not found for panel index ${t}`),Wd(n,i)){let t=o-n;Wu(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?d:u,r=n[t];H0(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=l[t];if(H0(null!=n,`Previous layout not found for panel index ${t}`),Wd(n,o)){let t=n-i;Wu(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}else{let t=e<0?u:d,r=n[t];H0(r,`Panel constraints not found for index ${t}`);let i=l[t],{collapsible:a,collapsedSize:o,minSize:s}=r;if(a&&0>Wu(i,s))if(e>0){let t=s-o;0>Wu(i+e,s)&&(e=0>=Wu(e,t/2)?0:t)}else{let t=s-o;0>Wu(i-e,s)&&(e=Wu(100+e,100-t/2)>0?0:-t)}}{let t=e<0?1:-1,r=e<0?u:d,i=0;for(;;){let e=l[r];if(H0(null!=e,`Previous layout not found for panel index ${r}`),i+=Wf({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e,(r+=t)<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?d:u;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=l[t];H0(null!=i,`Previous layout not found for panel index ${t}`);let a=i-r,s=Wf({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Wd(i,s)&&(f+=i-s,c[t]=s,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}(s,c))return i;{let t=e<0?u:d,r=l[t];H0(null!=r,`Previous layout not found for panel index ${t}`);let i=r+f,a=Wf({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(c[t]=a,!Wd(a,i)){let t=i-a,r=e<0?u:d;for(;r>=0&&r<n.length;){let i=c[r];H0(null!=i,`Previous layout not found for panel index ${r}`);let a=i+t,l=Wf({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Wd(i,l)||(t-=l-i,c[r]=l),Wd(t,0))break;e>0?r--:r++}}}if(!Wd(Object.values(c).reduce((e,t)=>t+e,0),100,.1))return i;let h=Object.keys(i);return c.reduce((e,t,n)=>(e[h[n]]=t,e),{})}function Wp(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(void 0===t[n]||0!==Wu(e[n],t[n]))return!1;return!0}function Wm({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(", ")}`);if(!Wd(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];H0(null!=t,`No layout data found for index ${e}`);let n=100/i*t;r[e]=n}let a=0;for(let e=0;e<t.length;e++){let i=n[e];H0(null!=i,`No layout data found for index ${e}`);let o=r[e];H0(null!=o,`No layout data found for index ${e}`);let l=Wf({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=l&&(a+=o-l,r[e]=l)}if(!Wd(a,0))for(let e=0;e<t.length;e++){let n=r[e];H0(null!=n,`No layout data found for index ${e}`);let i=n+a,o=Wf({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Wd(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Wg({groupId:e,panelId:t}){let n=()=>{for(let[t,{defaultLayoutDeferred:n,derivedPanelConstraints:r,layout:i,groupSize:a,separatorToPanels:o}]of H7)if(t.id===e)return{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:t,groupSize:a,layout:i,separatorToPanels:o};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(void 0!==e)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{if(e===a())return;let{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:o,groupSize:l,layout:s,separatorToPanels:c}=n(),d=Wm({layout:(({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),l=n.findIndex(e=>e.id===t),s=0===l,c=l===n.length-1;if(c&&e<o&&(s||n.slice(0,l).every((e,t)=>{let n=i[t];return n?.collapsible&&Wd(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,l).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:HZ(100-e)}}return Wh({delta:c?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:c?[l-1,l]:[l,l+1],prevLayout:r,trigger:"imperative-api"})})({nextSize:e,panels:o.panels,prevLayout:s,derivedPanelConstraints:i}),panelConstraints:i});Wp(s,d)||Wr(o,{defaultLayoutDeferred:r,derivedPanelConstraints:i,groupSize:l,layout:d,separatorToPanels:c})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),l=a();e&&l!==t&&(n.expandToSize=l,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:l}=i(),s=a();if(e&&s===t){let e=l.expandToSize??n;0===e&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:"horizontal"===e.orientation?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Wd(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=HJ({group:t});o(HZ(HX({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Wv(e){e.defaultPrevented||Wc(e,H7).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>void 0!==e.panelConstraints.defaultSize);if(n){let r=n.panelConstraints.defaultSize,i=Wg({groupId:t.group.id,panelId:n.id});i&&void 0!==r&&(i.resize(r),e.preventDefault())}}})}function Wx(e){for(let[t]of H7)if(t.separators.some(t=>t.element===e))return t;throw Error("Could not find parent Group for separator element")}function Wy({groupId:e}){let t=()=>{for(let[t,n]of H7)if(t.id===e)return{group:t,...n};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:l}=t(),s=Wm({layout:e,panelConstraints:r});return n?o:(Wp(o,s)||Wr(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:s,separatorToPanels:l}),s)}}}function Wb(e,t){let n=Wx(e),r=Wt(n.id,!0),i=n.separators.find(t=>t.element===e);H0(i,"Matching separator not found");let a=r.separatorToPanels.get(i);H0(a,"Matching panels not found");let o=a.map(e=>n.panels.indexOf(e)),l=Wy({groupId:n.id}).getLayout(),s=Wm({layout:Wh({delta:t,initialLayout:l,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:l,trigger:"keyboard"}),panelConstraints:r.derivedPanelConstraints});Wp(l,s)||Wr(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:s,separatorToPanels:r.separatorToPanels})}function Ww(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Wx(t);if(!n.disabled)switch(e.key){case"ArrowDown":e.preventDefault(),"vertical"===n.orientation&&Wb(t,5);break;case"ArrowLeft":e.preventDefault(),"horizontal"===n.orientation&&Wb(t,-5);break;case"ArrowRight":e.preventDefault(),"horizontal"===n.orientation&&Wb(t,5);break;case"ArrowUp":e.preventDefault(),"vertical"===n.orientation&&Wb(t,-5);break;case"End":e.preventDefault(),Wb(t,100);break;case"Enter":{e.preventDefault();let n=Wx(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Wt(n.id,!0),o=n.separators.find(e=>e.element===t);H0(o,"Matching separator not found");let l=a.get(o);H0(l,"Matching panels not found");let s=l[0],c=r.find(e=>e.panelId===s.id);if(H0(c,"Panel metadata not found"),c.collapsible){let e=i[s.id];Wb(t,(c.collapsedSize===e?n.mutableState.expandedPanelSizes[s.id]??c.minSize:c.collapsedSize)-e)}break}case"F6":{e.preventDefault();let n=Wx(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);H0(null!==r,"Index not found");let i=e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0;n[i].focus({preventScroll:!0});break}case"Home":e.preventDefault(),Wb(t,-100)}}let Wj={cursorFlags:0,state:"inactive"},Wk=new H8;function WS(e){let t=Wj;Wj=e,Wk.emit("change",{prev:t,next:e})}function WC(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let t=H7,n=Wc(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),WS({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}let WN=e=>e,WM=()=>{};function WE(){return void 0===r&&(r=!1,"u">typeof window&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(r=!0)),r}let WO=new WeakMap;function WP(e){if(null===e.defaultView||void 0===e.defaultView)return;let{prevStyle:t,styleSheet:n}=WO.get(e)??{};void 0===n&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=Wj;switch(r.state){case"active":case"hover":{let e=function({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case"active":case"hover":t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case"horizontal":r++;break;case"vertical":i++}})}if(0!==r||0!==i){if("active"===n&&e&&WE()){let t=(4&e)!=0,n=(8&e)!=0;if((1&e)!=0)return t?"se-resize":n?"ne-resize":"e-resize";if((2&e)!=0)return t?"sw-resize":n?"nw-resize":"w-resize";if(t)return"s-resize";if(n)return"n-resize"}return WE()?r>0&&i>0?"move":r>0?"ew-resize":"ns-resize":r>0&&i>0?"grab":r>0?"col-resize":"row-resize"}}({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?0===n.cssRules.length?n.insertRule(i):n.replaceSync(i):1===n.cssRules.length&&n.deleteRule(0);break}case"inactive":t=void 0,1===n.cssRules.length&&n.deleteRule(0)}WO.set(e,{prevStyle:t,styleSheet:n})}function WA({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){var l;let s,c,d=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:l,panels:s}=n,{disableCursor:c}=n.mutableState,u=0;u=a?"horizontal"===l?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:"horizontal"===l?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),h=i.get(n);if(!f||!h)return;let{defaultLayoutDeferred:p,derivedPanelConstraints:m,groupSize:g,layout:v,separatorToPanels:x}=h;if(m&&v&&x){let t=Wh({delta:u,initialLayout:f,panelConstraints:m,pivotIndices:e.panels.map(e=>s.indexOf(e)),prevLayout:v,trigger:"mouse-or-touch"});if(Wp(t,v)){if(0!==u&&!c)switch(l){case"horizontal":d|=u<0?1:2;break;case"vertical":d|=u<0?4:8}}else Wr(e.group,{defaultLayoutDeferred:p,derivedPanelConstraints:m,groupSize:g,layout:t,separatorToPanels:x})}});let u=0;0===t.movementX?u|=3&o:u|=3&d,0===t.movementY?u|=12&o:u|=12&d,l=u,s=Wj,(c={...Wj}).cursorFlags=l,Wj=c,Wk.emit("change",{prev:s,next:c}),WP(e)}function Wz(e){let t=H7,n=Wj;"active"===n.state&&WA({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}function W_(e){if(e.defaultPrevented)return;let t=Wj,n=H7;if("active"===t.state){if(0===e.buttons){WS({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(e=>{let t=Wt(e.group.id,!0);Wr(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}WA({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags})}else{let r=Wc(e,n);0===r.length?"inactive"!==t.state&&WS({cursorFlags:0,state:"inactive"}):WS({cursorFlags:0,hitRegions:r,state:"hover"}),WP(e.currentTarget)}}function WI(e){e.relatedTarget instanceof HTMLIFrameElement&&"hover"===Wj.state&&WS({cursorFlags:0,state:"inactive"})}function WD(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let t=Wj;"active"===t.state&&(WS({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(WP(e.currentTarget),t.hitRegions.forEach(e=>{let t=Wt(e.group.id,!0);Wr(e.group,t)}),e.preventDefault()))}function WT(e){let t=0,n=0,r={};for(let i of e)if(void 0!==i.defaultSize){t++;let e=HZ(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(0!==i){let t=HZ((100-n)/i);for(let n of e)void 0===n.defaultSize&&(r[n.panelId]=t)}return r}let WR=new Map;function WL(e){let t=(0,ew.useId)();return`${e??t}`}let W$="u">typeof window?ew.useLayoutEffect:ew.useEffect;function WF(e){let t=(0,ew.useRef)(e);return W$(()=>{t.current=e},[e]),(0,ew.useCallback)((...e)=>t.current?.(...e),[t])}function WV(...e){return WF(t=>{e.forEach(e=>{if(e)switch(typeof e){case"function":e(t);break;case"object":e.current=t}})})}function WB(e){let t=(0,ew.useRef)({...e});return W$(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}let WH=(0,ew.createContext)(null);function WW({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:l,onLayoutChange:s,onLayoutChanged:c,orientation:d="horizontal",resizeTargetMinimumSize:u={coarse:20,fine:10},style:f,...h}){let p,m=(0,ew.useRef)({onLayoutChange:{},onLayoutChanged:{}}),g=WF(e=>{Wp(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,s?.(e))}),v=WF(e=>{Wp(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,c?.(e))}),x=WL(l),y=(0,ew.useRef)(null),[b,w]=function(){let[e,t]=(0,ew.useState)({});return[e,(0,ew.useCallback)(()=>t({}),[])]}(),j=(0,ew.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:u,separators:[]}),k=WV(y,a);p=(0,ew.useRef)({getLayout:()=>({}),setLayout:WN}),(0,ew.useImperativeHandle)(o,()=>p.current,[]),W$(()=>{Object.assign(p.current,Wy({groupId:x}))});let S=WF((e,t)=>{let r=Wj,i=We(e),a=Wt(e);if(a){let e=!1;return"active"===r.state&&(e=r.hitRegions.some(e=>e.group===i)),{flexGrow:a.layout[t]??1,pointerEvents:e?"none":void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),C=WB({defaultLayout:n,disableCursor:r}),N=(0,ew.useMemo)(()=>({get disableCursor(){return!!C.disableCursor},getPanelStyles:S,id:x,orientation:d,registerPanel:e=>{let t=j.current;return t.panels=H1(d,[...t.panels,e]),w(),()=>{t.panels=t.panels.filter(t=>t!==e),w()}},registerSeparator:e=>{let t=j.current;return t.separators=H1(d,[...t.separators,e]),w(),()=>{t.separators=t.separators.filter(t=>t!==e),w()}},updatePanelProps:(e,{disabled:t})=>{let n=j.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=We(x),i=Wt(x);r&&i&&Wr(r,{...i,derivedPanelConstraints:HQ(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=j.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[S,x,w,d,C]),M=(0,ew.useRef)(null);return W$(()=>{let e,t,n,r,a,o,l,s,c,u,f,h,p,m=y.current;if(null===m)return;let b=j.current;if(void 0!==C.defaultLayout&&Object.keys(C.defaultLayout).length===b.panels.length)for(let t of(e={},b.panels)){let n=C.defaultLayout[t.id];void 0!==n&&(e[t.id]=n)}let w={disabled:!!i,element:m,id:x,mutableState:{defaultLayout:e,disableCursor:!!C.disableCursor,expandedPanelSizes:j.current.lastExpandedPanelSizes,layouts:j.current.layouts},orientation:d,panels:b.panels,resizeTargetMinimumSize:b.resizeTargetMinimumSize,separators:b.separators};M.current=w;let k=(t=!0,H0(w.element.ownerDocument.defaultView,"Cannot register an unmounted Group"),n=w.element.ownerDocument.defaultView.ResizeObserver,r=new Set,a=new Set,(o=new n(e=>{for(let n of e){let{borderBoxSize:e,target:r}=n;if(r===w.element){if(t){let e=HJ({group:w});if(0===e)return;let t=Wt(w.id);if(!t)return;let n=HQ(w),r=t.defaultLayoutDeferred?WT(n):t.layout,i=Wm({layout:function({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,l=new Map,s=[];for(let c of e.panels){let e=r[c.id]??0;if("preserve-pixel-size"===c.panelConstraints.groupResizeBehavior){o=!0;let r=HZ(e/100*n/t*100);l.set(c.id,r),i+=r}else s.push(c.id),a+=e}if(!o||0===s.length)return r;let c=100-i,d={...r};if(l.forEach((e,t)=>{d[t]=e}),a>0)for(let e of s){let t=r[e]??0;d[e]=HZ(t/a*c)}else{let e=HZ(c/s.length);for(let t of s)d[t]=e}return d}({group:w,nextGroupSize:e,prevGroupSize:t.groupSize,prevLayout:r}),panelConstraints:n});if(!t.defaultLayoutDeferred&&Wp(t.layout,i)&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}(t.derivedPanelConstraints,n)&&t.groupSize===e)return;Wr(w,{defaultLayoutDeferred:!1,derivedPanelConstraints:n,groupSize:e,layout:i,separatorToPanels:t.separatorToPanels})}}else!function(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=HJ({group:e}),a="horizontal"===e.orientation?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,l={asPercentage:HZ(a/i*100),inPixels:a};r.mutableValues.prevSize=l,r.onResize(l,r.id,o)}(w,r,e)}})).observe(w.element),w.panels.forEach(e=>{H0(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&o.observe(e.element)}),l=HJ({group:w}),s=HQ(w),c=w.panels.map(({id:e})=>e).join(","),(u=w.mutableState.defaultLayout)&&(function(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}(w.panels,u)||(u=void 0)),f=Wm({layout:w.mutableState.layouts[c]??u??WT(s),panelConstraints:s}),h=w.element.ownerDocument,WR.set(h,(WR.get(h)??0)+1),p=new Map,H6(w).forEach(e=>{e.separator&&p.set(e.separator,e.panels)}),Wr(w,{defaultLayoutDeferred:0===l,derivedPanelConstraints:s,groupSize:l,layout:f,separatorToPanels:p}),w.separators.forEach(e=>{H0(!a.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),a.add(e.id),e.element.addEventListener("keydown",Ww)}),1===WR.get(h)&&(h.addEventListener("dblclick",Wv,!0),h.addEventListener("pointerdown",WC,!0),h.addEventListener("pointerleave",Wz),h.addEventListener("pointermove",W_),h.addEventListener("pointerout",WI),h.addEventListener("pointerup",WD,!0)),function(){t=!1,WR.set(h,Math.max(0,(WR.get(h)??0)-1)),(H7=new Map(H7)).delete(w),w.separators.forEach(e=>{e.element.removeEventListener("keydown",Ww)}),WR.get(h)||(h.removeEventListener("dblclick",Wv,!0),h.removeEventListener("pointerdown",WC,!0),h.removeEventListener("pointerleave",Wz),h.removeEventListener("pointermove",W_),h.removeEventListener("pointerout",WI),h.removeEventListener("pointerup",WD,!0)),o.disconnect()}),{defaultLayoutDeferred:S,derivedPanelConstraints:N,layout:E}=Wt(w.id,!0);!S&&N.length>0&&(g(E),v(E));let O=Wn(x,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:r}=e.next;if(t||0===n.length)return;let i=w.panels.map(({id:e})=>e).join(",");w.mutableState.layouts[i]=r,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=Wd(t.collapsedSize,r[t.panelId]),i=Wd(t.collapsedSize,n[t.panelId]);e&&!i&&(w.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let a="active"!==Wj.state;g(r),a&&v(r)});return()=>{M.current=null,k(),O()}},[i,x,v,g,d,b,C]),(0,ew.useEffect)(()=>{let e=M.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,eb.jsx)(WH.Provider,{value:N,children:(0,eb.jsx)("div",{...h,className:t,"data-group":!0,"data-testid":x,id:x,ref:k,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:"horizontal"===d?"row":"column",flexWrap:"nowrap",touchAction:"horizontal"===d?"pan-y":"pan-x"},children:e})})}function Wq(){let e=(0,ew.useContext)(WH);return H0(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function WU({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:l="preserve-relative-size",id:s,maxSize:c="100%",minSize:d="0%",onResize:u,panelRef:f,style:h,...p}){let m,g=!!s,v=WL(s),x=WB({disabled:a}),y=(0,ew.useRef)(null),b=WV(y,o),{getPanelStyles:w,id:j,orientation:k,registerPanel:S,updatePanelProps:C}=Wq(),N=null!==u,M=WF((e,t,n)=>{u?.(e,s,n)});W$(()=>{let e=y.current;if(null!==e)return S({element:e,id:v,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:N?M:void 0,panelConstraints:{groupResizeBehavior:l,collapsedSize:n,collapsible:r,defaultSize:i,disabled:x.disabled,maxSize:c,minSize:d}})},[l,n,r,i,N,v,g,c,d,M,S,x]),(0,ew.useEffect)(()=>{C(v,{disabled:a})},[a,v,C]),function(e,t){let{id:n}=Wq(),r=(0,ew.useRef)({collapse:WM,expand:WM,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:WM});(0,ew.useImperativeHandle)(t,()=>r.current,[]),W$(()=>{Object.assign(r.current,Wg({groupId:n,panelId:e}))})}(v,f);let E=()=>{let e=w(j,v);if(e)return JSON.stringify(e)},O=(0,ew.useSyncExternalStore)(e=>Wn(j,e),E,E);return m=O?JSON.parse(O):void 0!==i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,eb.jsx)("div",{...p,"data-disabled":a||void 0,"data-panel":!0,"data-testid":v,id:v,ref:b,style:{...WK,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...m},children:(0,eb.jsx)("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...h,touchAction:"horizontal"===k?"pan-y":"pan-x"},children:e})})}WW.displayName="Group",WU.displayName="Panel";let WK={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function WG({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...l}){let s,c,d=WL(a),u=WB({disabled:n,disableDoubleClick:r}),[f,h]=(0,ew.useState)({}),[p,m]=(0,ew.useState)("inactive"),[g,v]=(0,ew.useState)(!1),x=(0,ew.useRef)(null),y=WV(x,i),{disableCursor:b,id:w,orientation:j,registerSeparator:k,updateSeparatorProps:S}=Wq();return W$(()=>{let e=x.current;if(null!==e){var t;let n={disabled:u.disabled,disableDoubleClick:u.disableDoubleClick,element:e,id:d},r=k(n),i=(t=e=>{m("inactive"!==e.next.state&&e.next.hitRegions.some(e=>e.separator===n)?e.next.state:"inactive")},Wk.addListener("change",t)),a=Wn(w,e=>{let{derivedPanelConstraints:t,layout:r,separatorToPanels:i}=e.next,a=i.get(n);if(a){let e=a[0],n=a.indexOf(e);h(function({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],l=t.find(e=>e.panelId===n);if(l){let s=l.maxSize,c=l.collapsible?l.collapsedSize:l.minSize,d=[r,r+1];a=Wm({layout:Wh({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n],i=Wm({layout:Wh({delta:s-o,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}({layout:r,panelConstraints:t,panelId:e.id,panelIndex:n}))}});return()=>{i(),a(),r()}}},[w,d,k,u]),(0,ew.useEffect)(()=>{S(d,{disabled:n,disableDoubleClick:r})},[n,r,d,S]),n&&!b&&(s="not-allowed"),c=n?"disabled":"active"===p?"active":g?"focus":p,(0,eb.jsx)("div",{...l,"aria-controls":f.valueControls,"aria-disabled":n||void 0,"aria-orientation":"horizontal"===j?"vertical":"horizontal","aria-valuemax":f.valueMax,"aria-valuemin":f.valueMin,"aria-valuenow":f.valueNow,children:e,className:t,"data-separator":c,"data-testid":d,id:d,onBlur:()=>v(!1),onFocus:()=>v(!0),ref:y,role:"separator",style:{flexBasis:"auto",cursor:s,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}function WY({className:e,direction:t,orientation:n,...r}){let i=n??t;return(0,eb.jsx)(WW,{"data-slot":"resizable-panel-group","data-orientation":i??"horizontal",orientation:i,className:tK("flex h-full w-full data-[orientation=vertical]:flex-col",e),...r})}function WX({...e}){return(0,eb.jsx)(WU,{"data-slot":"resizable-panel",...e})}function WZ({withHandle:e,className:t,...n}){return(0,eb.jsx)(WG,{"data-slot":"resizable-handle",className:tK("relative flex w-px items-center justify-center bg-border outline-none after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",t),...n,children:e&&(0,eb.jsx)("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-background",children:(0,eb.jsx)(HY,{className:"size-2.5"})})})}WG.displayName="Separator";let WJ=eN("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),WQ=eN("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),W0=eN("octagon-x",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 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-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),W1=eN("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var W2=e.i(21957);let W5=Array(12).fill(0),W4=({visible:e,className:t})=>ew.default.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ew.default.createElement("div",{className:"sonner-spinner"},W5.map((e,t)=>ew.default.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${t}`})))),W3=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ew.default.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),W6=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ew.default.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),W8=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ew.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),W7=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ew.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),W9=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ew.default.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ew.default.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),qe=1,qt=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,i="number"==typeof(null==e?void 0:e.id)||(null==(t=e.id)?void 0:t.length)>0?e.id:qe++,a=this.toasts.find(e=>e.id===i),o=void 0===e.dismissible||e.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),a?this.toasts=this.toasts.map(t=>t.id===i?(this.publish({...t,...e,id:i,title:n}),{...t,...e,id:i,dismissible:o,title:n}):t):this.addToast({title:n,...r,dismissible:o,id:i}),i},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{let n,r;if(!t)return;void 0!==t.loading&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:"function"!=typeof t.description?t.description:void 0}));let i=Promise.resolve(e instanceof Function?e():e),a=void 0!==r,o=i.then(async e=>{if(n=["resolve",e],ew.default.isValidElement(e))a=!1,this.create({id:r,type:"default",message:e});else if(qn(e)&&!e.ok){a=!1;let n="function"==typeof t.error?await t.error(`HTTP error! status: ${e.status}`):t.error,i="function"==typeof t.description?await t.description(`HTTP error! status: ${e.status}`):t.description,o="object"!=typeof n||ew.default.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:i,...o})}else if(e instanceof Error){a=!1;let n="function"==typeof t.error?await t.error(e):t.error,i="function"==typeof t.description?await t.description(e):t.description,o="object"!=typeof n||ew.default.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:i,...o})}else if(void 0!==t.success){a=!1;let n="function"==typeof t.success?await t.success(e):t.success,i="function"==typeof t.description?await t.description(e):t.description,o="object"!=typeof n||ew.default.isValidElement(n)?{message:n}:n;this.create({id:r,type:"success",description:i,...o})}}).catch(async e=>{if(n=["reject",e],void 0!==t.error){a=!1;let n="function"==typeof t.error?await t.error(e):t.error,i="function"==typeof t.description?await t.description(e):t.description,o="object"!=typeof n||ew.default.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:i,...o})}}).finally(()=>{a&&(this.dismiss(r),r=void 0),null==t.finally||t.finally.call(t)}),l=()=>new Promise((e,t)=>o.then(()=>"reject"===n[0]?t(n[1]):e(n[1])).catch(t));return"string"!=typeof r&&"number"!=typeof r?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(e,t)=>{let n=(null==t?void 0:t.id)||qe++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},qn=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,qr=Object.assign((e,t)=>{let n=(null==t?void 0:t.id)||qe++;return qt.addToast({title:e,...t,id:n}),n},{success:qt.success,info:qt.info,warning:qt.warning,error:qt.error,custom:qt.custom,message:qt.message,promise:qt.promise,dismiss:qt.dismiss,loading:qt.loading},{getHistory:()=>qt.toasts,getToasts:()=>qt.getActiveToasts()});function qi(e){return void 0!==e.label}function qa(...e){return e.filter(Boolean).join(" ")}!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-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");let qo=e=>{var t,n,r,i,a,o,l,s,c,d,u,f,h;let{invert:p,toast:m,unstyled:g,interacting:v,setHeights:x,visibleToasts:y,heights:b,index:w,toasts:j,expanded:k,removeToast:S,defaultRichColors:C,closeButton:N,style:M,cancelButtonStyle:E,actionButtonStyle:O,className:P="",descriptionClassName:A="",duration:z,position:_,gap:I,expandByDefault:D,classNames:T,icons:R,closeButtonAriaLabel:L="Close toast"}=e,[$,F]=ew.default.useState(null),[V,B]=ew.default.useState(null),[H,W]=ew.default.useState(!1),[q,U]=ew.default.useState(!1),[K,G]=ew.default.useState(!1),[Y,X]=ew.default.useState(!1),[Z,J]=ew.default.useState(!1),[Q,ee]=ew.default.useState(0),[et,en]=ew.default.useState(0),er=ew.default.useRef(m.duration||z||4e3),ei=ew.default.useRef(null),ea=ew.default.useRef(null),eo=0===w,el=w+1<=y,es=m.type,ec=!1!==m.dismissible,ed=m.className||"",eu=m.descriptionClassName||"",ef=ew.default.useMemo(()=>b.findIndex(e=>e.toastId===m.id)||0,[b,m.id]),eh=ew.default.useMemo(()=>{var e;return null!=(e=m.closeButton)?e:N},[m.closeButton,N]),ep=ew.default.useMemo(()=>m.duration||z||4e3,[m.duration,z]),em=ew.default.useRef(0),eg=ew.default.useRef(0),ev=ew.default.useRef(0),ex=ew.default.useRef(null),[ey,eb]=_.split("-"),ej=ew.default.useMemo(()=>b.reduce((e,t,n)=>n>=ef?e:e+t.height,0),[b,ef]),ek=(()=>{let[e,t]=ew.default.useState(document.hidden);return ew.default.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",e),()=>window.removeEventListener("visibilitychange",e)},[]),e})(),eS=m.invert||p,eC="loading"===es;eg.current=ew.default.useMemo(()=>ef*I+ej,[ef,ej]),ew.default.useEffect(()=>{er.current=ep},[ep]),ew.default.useEffect(()=>{W(!0)},[]),ew.default.useEffect(()=>{let e=ea.current;if(e){let t=e.getBoundingClientRect().height;return en(t),x(e=>[{toastId:m.id,height:t,position:m.position},...e]),()=>x(e=>e.filter(e=>e.toastId!==m.id))}},[x,m.id]),ew.default.useLayoutEffect(()=>{if(!H)return;let e=ea.current,t=e.style.height;e.style.height="auto";let n=e.getBoundingClientRect().height;e.style.height=t,en(n),x(e=>e.find(e=>e.toastId===m.id)?e.map(e=>e.toastId===m.id?{...e,height:n}:e):[{toastId:m.id,height:n,position:m.position},...e])},[H,m.title,m.description,x,m.id,m.jsx,m.action,m.cancel]);let eN=ew.default.useCallback(()=>{U(!0),ee(eg.current),x(e=>e.filter(e=>e.toastId!==m.id)),setTimeout(()=>{S(m)},200)},[m,S,x,eg]);ew.default.useEffect(()=>{let e;if((!m.promise||"loading"!==es)&&m.duration!==1/0&&"loading"!==m.type){if(k||v||ek){if(ev.current<em.current){let e=new Date().getTime()-em.current;er.current=er.current-e}ev.current=new Date().getTime()}else er.current!==1/0&&(em.current=new Date().getTime(),e=setTimeout(()=>{null==m.onAutoClose||m.onAutoClose.call(m,m),eN()},er.current));return()=>clearTimeout(e)}},[k,v,m,es,ek,eN]),ew.default.useEffect(()=>{m.delete&&(eN(),null==m.onDismiss||m.onDismiss.call(m,m))},[eN,m.delete]);let eM=m.icon||(null==R?void 0:R[es])||(e=>{switch(e){case"success":return W3;case"info":return W8;case"warning":return W6;case"error":return W7;default:return null}})(es);return ew.default.createElement("li",{tabIndex:0,ref:ea,className:qa(P,ed,null==T?void 0:T.toast,null==m||null==(t=m.classNames)?void 0:t.toast,null==T?void 0:T.default,null==T?void 0:T[es],null==m||null==(n=m.classNames)?void 0:n[es]),"data-sonner-toast":"","data-rich-colors":null!=(d=m.richColors)?d:C,"data-styled":!(m.jsx||m.unstyled||g),"data-mounted":H,"data-promise":!!m.promise,"data-swiped":Z,"data-removed":q,"data-visible":el,"data-y-position":ey,"data-x-position":eb,"data-index":w,"data-front":eo,"data-swiping":K,"data-dismissible":ec,"data-type":es,"data-invert":eS,"data-swipe-out":Y,"data-swipe-direction":V,"data-expanded":!!(k||D&&H),"data-testid":m.testId,style:{"--index":w,"--toasts-before":w,"--z-index":j.length-w,"--offset":`${q?Q:eg.current}px`,"--initial-height":D?"auto":`${et}px`,...M,...m.style},onDragEnd:()=>{G(!1),F(null),ex.current=null},onPointerDown:e=>{2===e.button||eC||!ec||(ei.current=new Date,ee(eg.current),e.target.setPointerCapture(e.pointerId),"BUTTON"!==e.target.tagName&&(G(!0),ex.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e,t,n,r,i;if(Y||!ec)return;ex.current=null;let a=Number((null==(e=ea.current)?void 0:e.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),o=Number((null==(t=ea.current)?void 0:t.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),l=new Date().getTime()-(null==(n=ei.current)?void 0:n.getTime()),s="x"===$?a:o,c=Math.abs(s)/l;if(Math.abs(s)>=45||c>.11){ee(eg.current),null==m.onDismiss||m.onDismiss.call(m,m),"x"===$?B(a>0?"right":"left"):B(o>0?"down":"up"),eN(),X(!0);return}null==(r=ea.current)||r.style.setProperty("--swipe-amount-x","0px"),null==(i=ea.current)||i.style.setProperty("--swipe-amount-y","0px"),J(!1),G(!1),F(null)},onPointerMove:t=>{var n,r,i,a;if(!ex.current||!ec||(null==(n=window.getSelection())?void 0:n.toString().length)>0)return;let o=t.clientY-ex.current.y,l=t.clientX-ex.current.x,s=null!=(a=e.swipeDirections)?a:function(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}(_);!$&&(Math.abs(l)>1||Math.abs(o)>1)&&F(Math.abs(l)>Math.abs(o)?"x":"y");let c={x:0,y:0},d=e=>1/(1.5+Math.abs(e)/20);if("y"===$){if(s.includes("top")||s.includes("bottom"))if(s.includes("top")&&o<0||s.includes("bottom")&&o>0)c.y=o;else{let e=o*d(o);c.y=Math.abs(e)<Math.abs(o)?e:o}}else if("x"===$&&(s.includes("left")||s.includes("right")))if(s.includes("left")&&l<0||s.includes("right")&&l>0)c.x=l;else{let e=l*d(l);c.x=Math.abs(e)<Math.abs(l)?e:l}(Math.abs(c.x)>0||Math.abs(c.y)>0)&&J(!0),null==(r=ea.current)||r.style.setProperty("--swipe-amount-x",`${c.x}px`),null==(i=ea.current)||i.style.setProperty("--swipe-amount-y",`${c.y}px`)}},eh&&!m.jsx&&"loading"!==es?ew.default.createElement("button",{"aria-label":L,"data-disabled":eC,"data-close-button":!0,onClick:eC||!ec?()=>{}:()=>{eN(),null==m.onDismiss||m.onDismiss.call(m,m)},className:qa(null==T?void 0:T.closeButton,null==m||null==(r=m.classNames)?void 0:r.closeButton)},null!=(u=null==R?void 0:R.close)?u:W9):null,(es||m.icon||m.promise)&&null!==m.icon&&((null==R?void 0:R[es])!==null||m.icon)?ew.default.createElement("div",{"data-icon":"",className:qa(null==T?void 0:T.icon,null==m||null==(i=m.classNames)?void 0:i.icon)},m.promise||"loading"===m.type&&!m.icon?m.icon||((null==R?void 0:R.loading)?ew.default.createElement("div",{className:qa(null==T?void 0:T.loader,null==m||null==(h=m.classNames)?void 0:h.loader,"sonner-loader"),"data-visible":"loading"===es},R.loading):ew.default.createElement(W4,{className:qa(null==T?void 0:T.loader,null==m||null==(f=m.classNames)?void 0:f.loader),visible:"loading"===es})):null,"loading"!==m.type?eM:null):null,ew.default.createElement("div",{"data-content":"",className:qa(null==T?void 0:T.content,null==m||null==(a=m.classNames)?void 0:a.content)},ew.default.createElement("div",{"data-title":"",className:qa(null==T?void 0:T.title,null==m||null==(o=m.classNames)?void 0:o.title)},m.jsx?m.jsx:"function"==typeof m.title?m.title():m.title),m.description?ew.default.createElement("div",{"data-description":"",className:qa(A,eu,null==T?void 0:T.description,null==m||null==(l=m.classNames)?void 0:l.description)},"function"==typeof m.description?m.description():m.description):null),ew.default.isValidElement(m.cancel)?m.cancel:m.cancel&&qi(m.cancel)?ew.default.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||E,onClick:e=>{!qi(m.cancel)||ec&&(null==m.cancel.onClick||m.cancel.onClick.call(m.cancel,e),eN())},className:qa(null==T?void 0:T.cancelButton,null==m||null==(s=m.classNames)?void 0:s.cancelButton)},m.cancel.label):null,ew.default.isValidElement(m.action)?m.action:m.action&&qi(m.action)?ew.default.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||O,onClick:e=>{!qi(m.action)||(null==m.action.onClick||m.action.onClick.call(m.action,e),e.defaultPrevented||eN())},className:qa(null==T?void 0:T.actionButton,null==m||null==(c=m.classNames)?void 0:c.actionButton)},m.action.label):null)};function ql(){if("u"<typeof window||"u"<typeof document)return"ltr";let e=document.documentElement.getAttribute("dir");return"auto"!==e&&e?e:window.getComputedStyle(document.documentElement).direction}let qs=ew.default.forwardRef(function(e,t){let{id:n,invert:r,position:i="bottom-right",hotkey:a=["altKey","KeyT"],expand:o,closeButton:l,className:s,offset:c,mobileOffset:d,theme:u="light",richColors:f,duration:h,style:p,visibleToasts:m=3,toastOptions:g,dir:v=ql(),gap:x=14,icons:y,containerAriaLabel:b="Notifications"}=e,[w,j]=ew.default.useState([]),k=ew.default.useMemo(()=>n?w.filter(e=>e.toasterId===n):w.filter(e=>!e.toasterId),[w,n]),S=ew.default.useMemo(()=>Array.from(new Set([i].concat(k.filter(e=>e.position).map(e=>e.position)))),[k,i]),[C,N]=ew.default.useState([]),[M,E]=ew.default.useState(!1),[O,P]=ew.default.useState(!1),[A,z]=ew.default.useState("system"!==u?u:"u">typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),_=ew.default.useRef(null),I=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),D=ew.default.useRef(null),T=ew.default.useRef(!1),R=ew.default.useCallback(e=>{j(t=>{var n;return(null==(n=t.find(t=>t.id===e.id))?void 0:n.delete)||qt.dismiss(e.id),t.filter(({id:t})=>t!==e.id)})},[]);return ew.default.useEffect(()=>qt.subscribe(e=>{e.dismiss?requestAnimationFrame(()=>{j(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))}):setTimeout(()=>{t3.default.flushSync(()=>{j(t=>{let n=t.findIndex(t=>t.id===e.id);return -1!==n?[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]:[e,...t]})})})}),[w]),ew.default.useEffect(()=>{if("system"!==u)return void z(u);if("system"===u&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),"u"<typeof window)return;let e=window.matchMedia("(prefers-color-scheme: dark)");try{e.addEventListener("change",({matches:e})=>{e?z("dark"):z("light")})}catch(t){e.addListener(({matches:e})=>{try{e?z("dark"):z("light")}catch(e){console.error(e)}})}},[u]),ew.default.useEffect(()=>{w.length<=1&&E(!1)},[w]),ew.default.useEffect(()=>{let e=e=>{var t,n;a.every(t=>e[t]||e.code===t)&&(E(!0),null==(n=_.current)||n.focus()),"Escape"===e.code&&(document.activeElement===_.current||(null==(t=_.current)?void 0:t.contains(document.activeElement)))&&E(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a]),ew.default.useEffect(()=>{if(_.current)return()=>{D.current&&(D.current.focus({preventScroll:!0}),D.current=null,T.current=!1)}},[_.current]),ew.default.createElement("section",{ref:t,"aria-label":`${b} ${I}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},S.map((t,n)=>{var i;let a,[u,b]=t.split("-");return k.length?ew.default.createElement("ol",{key:t,dir:"auto"===v?ql():v,tabIndex:-1,ref:_,className:s,"data-sonner-toaster":!0,"data-sonner-theme":A,"data-y-position":u,"data-x-position":b,style:{"--front-toast-height":`${(null==(i=C[0])?void 0:i.height)||0}px`,"--width":"356px","--gap":`${x}px`,...p,...(a={},[c,d].forEach((e,t)=>{let n=1===t,r=n?"--mobile-offset":"--offset",i=n?"16px":"24px";function o(e){["top","right","bottom","left"].forEach(t=>{a[`${r}-${t}`]="number"==typeof e?`${e}px`:e})}"number"==typeof e||"string"==typeof e?o(e):"object"==typeof e?["top","right","bottom","left"].forEach(t=>{void 0===e[t]?a[`${r}-${t}`]=i:a[`${r}-${t}`]="number"==typeof e[t]?`${e[t]}px`:e[t]}):o(i)}),a)},onBlur:e=>{T.current&&!e.currentTarget.contains(e.relatedTarget)&&(T.current=!1,D.current&&(D.current.focus({preventScroll:!0}),D.current=null))},onFocus:e=>{!(e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible)&&(T.current||(T.current=!0,D.current=e.relatedTarget))},onMouseEnter:()=>E(!0),onMouseMove:()=>E(!0),onMouseLeave:()=>{O||E(!1)},onDragEnd:()=>E(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||P(!0)},onPointerUp:()=>P(!1)},k.filter(e=>!e.position&&0===n||e.position===t).map((n,i)=>{var a,s;return ew.default.createElement(qo,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:null!=(a=null==g?void 0:g.duration)?a:h,className:null==g?void 0:g.className,descriptionClassName:null==g?void 0:g.descriptionClassName,invert:r,visibleToasts:m,closeButton:null!=(s=null==g?void 0:g.closeButton)?s:l,interacting:O,position:t,style:null==g?void 0:g.style,unstyled:null==g?void 0:g.unstyled,classNames:null==g?void 0:g.classNames,cancelButtonStyle:null==g?void 0:g.cancelButtonStyle,actionButtonStyle:null==g?void 0:g.actionButtonStyle,closeButtonAriaLabel:null==g?void 0:g.closeButtonAriaLabel,removeToast:R,toasts:k.filter(e=>e.position==n.position),heights:C.filter(e=>e.position==n.position),setHeights:N,expandByDefault:o,gap:x,expanded:M,swipeDirections:e.swipeDirections})})):null}))});function qc({className:e,position:t="top-right",closeButton:n=!0,richColors:r=!1,visibleToasts:i=4,toastOptions:a,...o}){let{theme:l="system"}=(0,W2.useTheme)();return(0,eb.jsx)(qs,{theme:l,position:t,closeButton:n,richColors:r,visibleToasts:i,className:tK("toaster group",e),icons:{success:(0,eb.jsx)(WJ,{className:"size-4"}),info:(0,eb.jsx)(vk,{className:"size-4"}),warning:(0,eb.jsx)(W1,{className:"size-4"}),error:(0,eb.jsx)(W0,{className:"size-4"}),loading:(0,eb.jsx)(WQ,{className:"size-4 animate-spin"})},toastOptions:{...a,classNames:{toast:"vtl-surface-popover group toast group-[.toaster]:rounded-[var(--surface-popover-radius)] group-[.toaster]:border group-[.toaster]:gap-3 group-[.toaster]:p-3",title:"group-[.toast]:text-sm group-[.toast]:font-medium",description:"group-[.toast]:text-sm group-[.toast]:text-muted-foreground",icon:"group-[.toast]:text-foreground",actionButton:"group-[.toast]:h-7 group-[.toast]:rounded-md group-[.toast]:bg-primary group-[.toast]:px-2 group-[.toast]:text-xs group-[.toast]:font-medium group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:h-7 group-[.toast]:rounded-md group-[.toast]:border group-[.toast]:border-border group-[.toast]:bg-background group-[.toast]:px-2 group-[.toast]:text-xs group-[.toast]:font-medium group-[.toast]:text-foreground",closeButton:"group-[.toast]:border-border group-[.toast]:bg-background group-[.toast]:text-muted-foreground",success:"group-[.toast]:text-foreground",info:"group-[.toast]:text-foreground",warning:"group-[.toast]:text-foreground",error:"group-[.toast]:text-foreground",loading:"group-[.toast]:text-foreground",...a?.classNames}},style:{"--normal-bg":"var(--surface-popover)","--normal-text":"var(--surface-popover-foreground)","--normal-border":"var(--surface-popover-border)","--border-radius":"var(--surface-popover-radius)"},...o})}var qd="Tabs",[qu,qf]=tX(qd,[vW]),qh=vW(),[qp,qm]=qu(qd),qg=ew.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o="horizontal",dir:l,activationMode:s="automatic",...c}=e,d=fb(l),[u,f]=t0({prop:r,onChange:i,defaultProp:a??"",caller:qd});return(0,eb.jsx)(qp,{scope:n,baseId:cR(),value:u,onValueChange:f,orientation:o,dir:d,activationMode:s,children:(0,eb.jsx)(ne.div,{dir:d,"data-orientation":o,...c,ref:t})})});qg.displayName=qd;var qv="TabsList",qx=ew.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=qm(qv,n),o=qh(n);return(0,eb.jsx)(vK,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,eb.jsx)(ne.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:t})})});qx.displayName=qv;var qy="TabsTrigger",qb=ew.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=qm(qy,n),l=qh(n),s=qk(o.baseId,r),c=qS(o.baseId,r),d=r===o.value;return(0,eb.jsx)(vX,{asChild:!0,...l,focusable:!i,active:d,children:(0,eb.jsx)(ne.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":c,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:s,...a,ref:t,onMouseDown:tZ(e.onMouseDown,e=>{i||0!==e.button||!1!==e.ctrlKey?e.preventDefault():o.onValueChange(r)}),onKeyDown:tZ(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&o.onValueChange(r)}),onFocus:tZ(e.onFocus,()=>{let e="manual"!==o.activationMode;d||i||!e||o.onValueChange(r)})})})});qb.displayName=qy;var qw="TabsContent",qj=ew.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,l=qm(qw,n),s=qk(l.baseId,r),c=qS(l.baseId,r),d=r===l.value,u=ew.useRef(d);return ew.useEffect(()=>{let e=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,eb.jsx)(t5,{present:i||d,children:({present:n})=>(0,eb.jsx)(ne.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":s,hidden:!n,id:c,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:u.current?"0s":void 0},children:n&&a})})});function qk(e,t){return`${e}-trigger-${t}`}function qS(e,t){return`${e}-content-${t}`}function qC({className:e,...t}){return(0,eb.jsx)(qx,{"data-slot":"tabs-list",className:tK("inline-flex h-8 items-center justify-center gap-0.5 rounded-lg bg-muted p-1 text-muted-foreground",e),...t})}function qN({className:e,...t}){return(0,eb.jsx)(qb,{"data-slot":"tabs-trigger",className:tK("inline-flex h-6 shrink-0 items-center justify-center gap-1.5 rounded-md px-2.5 text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-xs [&_svg]:pointer-events-none [&_svg]:size-3.5 [&_svg]:shrink-0",e),...t})}function qM({className:e,...t}){return(0,eb.jsx)(qj,{"data-slot":"tabs-content",className:tK("mt-3 outline-none focus-visible:ring-2 focus-visible:ring-ring/50",e),...t})}qj.displayName=qw;let qE=HN.map(e=>({id:e.id,title:e.title,description:e.description,icon:e.icon,keywords:e.keywords}));function qO(e){return qE.find(t=>t.id===e)}function qP(e){return"subagent-conversation-panel"!==e.kind}let qA="application/vnd.vantaloom.agent-panel";function qz(e){let t=qP(e)?qO(e.kind):void 0,n={content:e};return{id:`agent-panel-${e.id}`,title:e.title,description:t?.description??("subagent-conversation-panel"===e.kind?"子代理运行信息流。":"来自 Agent 工作区的面板。"),meta:"Agent panel",icon:t?.icon,dragData:{"application/vnd.vantaloom.clip-kind":"agent-panel",[qA]:JSON.stringify(n)},payloads:{[qA]:n}}}let q_=eN("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),qI=eN("corner-down-right",[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]),qD=eN("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),qT=eN("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);var qR=e=>e.graphicalItems.polarItems,qL=j$([MH,MW],Aw),q$=j$([qR,Ax,qL],AS),qF=j$([q$],AO),qV=j$([qF,Mv],Az),qB=j$([qV,Ax,q$],AI);j$([qV,Ax,q$],(e,t,n)=>n.length>0?e.flatMap(e=>n.flatMap(n=>{var r;return{value:kG(e,null!=(r=t.dataKey)?r:n.dataKey),errorDomain:[]}})).filter(Boolean):(null==t?void 0:t.dataKey)!=null?e.map(e=>({value:kG(e,t.dataKey),errorDomain:[]})):e.map(e=>({value:e,errorDomain:[]})));var qH=()=>void 0,qW=j$([qV,Ax,q$,A0,MH,Mw],A2),qq=j$([Ax,AZ,AJ,qH,qW,qH,ST,MH],zc),qU=j$([Ax,ST,qV,qB,MR,MH,qq],zf),qK=j$([qU,Ay,zp],zm),qG=j$([Ax,qU,qK,MH],zv);function qY(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 qX(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qY(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qY(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}j$([zp,qG],MJ);var qZ=j$([qR,(e,t)=>t],(e,t)=>e.filter(e=>"pie"===e.type).find(e=>e.id===t)),qJ=[],qQ=(e,t,n)=>(null==n?void 0:n.length)===0?qJ:n,q0=j$([Mv,qZ,qQ],(e,t,n)=>{var r,{chartData:i}=e;if(null!=t&&((r=(null==t?void 0:t.data)!=null&&t.data.length>0?t.data:i)&&r.length||null==n||(r=n.map(e=>qX(qX({},t.presentationProps),e.props))),null!=r))return r}),q1=j$([q0,qZ,qQ],(e,t,n)=>{if(null!=e&&null!=t)return e.map((e,r)=>{var i,a,o=kG(e,t.nameKey,t.name);return a=null!=n&&null!=(i=n[r])&&null!=(i=i.props)&&i.fill?n[r].props.fill:"object"==typeof e&&null!=e&&"fill"in e?e.fill:t.fill,{value:k6(o,t.dataKey),color:a,payload:e,type:t.legendType}})}),q2=j$([q0,qZ,qQ,Sl],(e,t,n,r)=>{if(null!=t&&null!=e)return function(e){var t,n,r,{pieSettings:i,displayedData:a,cells:o,offset:l}=e,{cornerRadius:s,startAngle:c,endAngle:d,dataKey:u,nameKey:f,tooltipType:h}=i,p=Math.abs(i.minAngle),m=b7(d-c)*Math.min(Math.abs(d-c),360),g=Math.abs(m),v=a.length<=1?0:null!=(t=i.paddingAngle)?t:0,x=a.filter(e=>0!==kG(e,u,0)).length,y=a.reduce((e,t)=>{var n=kG(t,u,0);return e+(wt(n)?n:0)},0),b=p>0&&y>0&&a.some(e=>{var t=kG(e,u,0),n=(wt(t)?t:0)/y;return 0!==t&&n*g<p})?p:0,w=g-x*b-(g>=360?x:x-1)*v;return y>0&&(n=a.map((e,t)=>{var n,a=kG(e,u,0),d=kG(e,f,t),p=((e,t,n)=>{var r,{top:i,left:a,width:o,height:l}=t,s=CM(o,l),c=a+wa(e.cx,o,o/2),d=i+wa(e.cy,l,l/2),u=wa(e.innerRadius,s,0);return{cx:c,cy:d,innerRadius:u,outerRadius:(r=e.outerRadius,"function"==typeof r?wa(r(n),s,.8*s):wa(r,s,.8*s)),maxRadius:e.maxRadius||Math.sqrt(o*o+l*l)/2}})(i,l,e),g=(wt(a)?a:0)/y,x=Ue(Ue({},e),o&&o[t]&&o[t].props),j=null!=x&&"fill"in x&&"string"==typeof x.fill?x.fill:i.fill,k=(n=t?r.endAngle+b7(m)*v*(0!==a):c)+b7(m)*((0!==a?b:0)+g*w),S=(n+k)/2,C=(p.innerRadius+p.outerRadius)/2,N=[{name:d,value:a,payload:x,dataKey:u,type:h,color:j,fill:j,graphicalItemId:i.id}],M=CN(p.cx,p.cy,C,S);return r=Ue(Ue(Ue(Ue({},i.presentationProps),{},{percent:g,cornerRadius:"string"==typeof s?parseFloat(s):s,name:d,tooltipPayload:N,midAngle:S,middleRadius:C,tooltipPosition:M},x),p),{},{value:a,dataKey:u,startAngle:n,endAngle:k,payload:x,paddingAngle:0!==a?b7(m)*v:0})})),n}({offset:r,pieSettings:t,displayedData:e,cells:n})}),q5=["key"],q4=["onMouseEnter","onClick","onMouseLeave"],q3=["id"],q6=["id"];function q8(){return(q8=Object.assign.bind()).apply(null,arguments)}function q7(e,t){if(null==e)return{};var n,r,i=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 a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function q9(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 Ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q9(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q9(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ut(e){var t=(0,ew.useMemo)(()=>Ml(e.children,FV),[e.children]),n=wC(n=>q1(n,e.id,t));return null==n?null:ew.createElement(Dt,{legendPayload:n})}var Un=ew.memo(e=>{var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:a,fill:o,name:l,hide:s,tooltipType:c,id:d,activeShape:u}=e,f=function(e){if(null!=e&&"boolean"!=typeof e&&"function"!=typeof e){if(ew.isValidElement(e)){var t,n=null==(t=e.props)?void 0:t.fill;return"string"==typeof n?n:void 0}var{fill:r}=e;return"string"==typeof r?r:void 0}}(u),h={dataDefinedOnItem:r.map(e=>{var t=e.tooltipPayload;return null==f||null==t?t:t.map(e=>Ue(Ue({},e),{},{color:f,fill:f}))}),getPosition:e=>{var t;return null==(t=r[Number(e)])?void 0:t.tooltipPosition},settings:{stroke:i,strokeWidth:a,fill:o,dataKey:t,nameKey:n,name:k6(l,t),hide:s,type:c,color:o,unit:"",graphicalItemId:d}};return ew.createElement(IE,{tooltipEntrySettings:h})});function Ur(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:a,dataKey:o}=n;if(!r||!i||!t)return null;var l=wv(n),s=wx(i),c=wx(a),d="object"==typeof i&&"offsetRadius"in i&&"number"==typeof i.offsetRadius&&i.offsetRadius||20,u=t.map((e,t)=>{var n,r,u=(e.startAngle+e.endAngle)/2,f=CN(e.cx,e.cy,e.outerRadius+d,u),h=Ue(Ue(Ue(Ue({},l),e),{},{stroke:"none"},s),{},{index:t,textAnchor:(n=f.x)>(r=e.cx)?"start":n<r?"end":"middle"},f),p=Ue(Ue(Ue(Ue({},l),e),{},{fill:"none",stroke:e.fill},c),{},{index:t,points:[CN(e.cx,e.cy,e.outerRadius,u),f],key:"line"});return ew.createElement(ND,{zIndex:CE.label,key:"label-".concat(e.startAngle,"-").concat(e.endAngle,"-").concat(e.midAngle,"-").concat(t)},ew.createElement(SJ,null,a&&((e,t)=>{if(ew.isValidElement(e))return ew.cloneElement(e,t);if("function"==typeof e)return e(t);var n=eH("recharts-pie-label-line","boolean"!=typeof e?e.className:""),{key:r}=t,i=q7(t,q5);return ew.createElement(SG,q8({},i,{type:"linear",className:n}))})(a,p),((e,t,n)=>{if(ew.isValidElement(e))return ew.cloneElement(e,t);var r=n;if("function"==typeof e&&(r=e(t),ew.isValidElement(r)))return r;var i=eH("recharts-pie-label-text",Ld(e));return ew.createElement(Cj,q8({},t,{alignmentBaseline:"middle",className:i}),r)})(i,h,kG(e,o))))});return ew.createElement(SJ,{className:"recharts-pie-labels"},u)}function Ui(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return"object"==typeof i&&null!=i&&"position"in i?ew.createElement(N9,{label:i}):ew.createElement(Ur,{sectors:t,props:n,showLabels:r})}function Ua(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i,shape:a,id:o}=e,l=wC(_7),s=wC(Ie),c=wC(It),{onMouseEnter:d,onClick:u,onMouseLeave:f}=i,h=q7(i,q4),p=F4(d,i.dataKey,o),m=F3(f),g=F6(u,i.dataKey,o);return null==t||0===t.length?null:ew.createElement(ew.Fragment,null,t.map((e,d)=>{if((null==e?void 0:e.startAngle)===0&&(null==e?void 0:e.endAngle)===0&&1!==t.length)return null;var u=null==c||c===o,f=String(d)===l&&(null==s||i.dataKey===s)&&u,v=n&&f?n:l?r:null,x=Ue(Ue({},e),{},{stroke:e.stroke,tabIndex:-1,[Sr]:d,[Si]:o});return ew.createElement(SJ,q8({key:"sector-".concat(null==e?void 0:e.startAngle,"-").concat(null==e?void 0:e.endAngle,"-").concat(e.midAngle,"-").concat(d),tabIndex:-1,className:"recharts-pie-sector"},b4(h,e,d),{onMouseEnter:p(e,d),onMouseLeave:m(e,d),onClick:g(e,d)}),ew.createElement(F0,q8({option:null!=a?a:v,index:d,shapeType:"sector",isActive:f},x)))}))}function Uo(e){var{showLabels:t,sectors:n,children:r}=e,i=(0,ew.useMemo)(()=>t&&n?n.map(e=>({value:e.value,payload:e.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:e.cx,cy:e.cy,innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,clockWise:!1},fill:e.fill})):[],[n,t]);return ew.createElement(N8,{value:t?i:void 0},r)}function Ul(e){var{props:t,previousSectorsRef:n,id:r}=e,{sectors:i,isAnimationActive:a,animationBegin:o,animationDuration:l,animationEasing:s,activeShape:c,inactiveShape:d,onAnimationStart:u,onAnimationEnd:f}=t,h=Dn(t,"recharts-pie-"),p=n.current,[m,g]=(0,ew.useState)(!1),v=(0,ew.useCallback)(()=>{"function"==typeof f&&f(),g(!1)},[f]),x=(0,ew.useCallback)(()=>{"function"==typeof u&&u(),g(!0)},[u]);return ew.createElement(Uo,{showLabels:!m,sectors:i},ew.createElement(DR,{animationId:h,begin:o,duration:l,isActive:a,easing:s,onAnimationStart:x,onAnimationEnd:v,key:h},e=>{var a,o=[],l=i&&i[0],s=null!=(a=null==l?void 0:l.startAngle)?a:0;return null==i||i.forEach((t,n)=>{var r=p&&p[n],i=n>0?(0,b3.default)(t,"paddingAngle",0):0;if(r){var a=wl(r.endAngle-r.startAngle,t.endAngle-t.startAngle,e),l=Ue(Ue({},t),{},{startAngle:s+i,endAngle:s+a+i});o.push(l),s=l.endAngle}else{var{endAngle:c,startAngle:d}=t,u=wl(0,c-d,e),f=Ue(Ue({},t),{},{startAngle:s+i,endAngle:s+u+i});o.push(f),s=f.endAngle}}),n.current=o,ew.createElement(SJ,null,ew.createElement(Ua,{sectors:o,activeShape:c,inactiveShape:d,allOtherPieProps:t,shape:t.shape,id:r}))}),ew.createElement(Ui,{showLabels:!m,sectors:i,props:t}),t.children)}var Us={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:CE.area};function Uc(e){var{id:t}=e,n=q7(e,q3),{hide:r,className:i,rootTabIndex:a}=e,o=(0,ew.useMemo)(()=>Ml(e.children,FV),[e.children]),l=wC(e=>q2(e,t,o)),s=(0,ew.useRef)(null),c=eH("recharts-pie",i);return r||null==l?(s.current=null,ew.createElement(SJ,{tabIndex:a,className:c})):ew.createElement(ND,{zIndex:e.zIndex},ew.createElement(Un,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:l,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t,activeShape:e.activeShape}),ew.createElement(SJ,{tabIndex:a,className:c},ew.createElement(Ul,{props:Ue(Ue({},n),{},{sectors:l}),previousSectorsRef:s,id:t})))}var Ud=function(e){var t=Cs(e,Us),{id:n}=t,r=q7(t,q6),i=wv(r);return ew.createElement(Da,{id:n,type:"pie"},e=>ew.createElement(ew.Fragment,null,ew.createElement(Dm,{type:"pie",id:e,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),ew.createElement(Ut,q8({},r,{id:e})),ew.createElement(Uc,q8({},r,{id:e}))))};function Uu(e){var t=ww();return(0,ew.useEffect)(()=>{t(TX(e))},[t,e]),null}Ud.displayName="Pie";var Uf=["layout"];function Uh(){return(Uh=Object.assign.bind()).apply(null,arguments)}function Up(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}var Um=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Up(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Up(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({accessibilityLayer:!0,stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index",layout:"radial",responsive:!1,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"},Rp),Ug=(0,ew.forwardRef)(function(e,t){var n,r=Cs(e.categoricalChartProps,Um),{layout:i}=r,a=function(e,t){if(null==e)return{};var n,r,i=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 a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(r,Uf),{chartName:o,defaultTooltipEventType:l,validateTooltipEventTypes:s,tooltipPayloadSearcher:c}=e;return ew.createElement(Rk,{preloadedState:{options:{chartName:o,defaultTooltipEventType:l,validateTooltipEventTypes:s,tooltipPayloadSearcher:c,eventEmitter:void 0}},reduxStoreName:null!=(n=r.id)?n:o},ew.createElement(RS,{chartData:r.data}),ew.createElement(RC,{layout:i,margin:r.margin}),ew.createElement(RM,{throttleDelay:r.throttleDelay,throttledEvents:r.throttledEvents}),ew.createElement(RN,{baseValue:void 0,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(Uu,{cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius}),ew.createElement(R8,Uh({},a,{ref:t})))});function Uv(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 Ux(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Uv(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Uv(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Uy=["item"],Ub=Ux(Ux({},Um),{},{layout:"centric",startAngle:0,endAngle:360}),Uw=(0,ew.forwardRef)((e,t)=>{var n=Cs(e,Ub);return ew.createElement(Ug,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:Uy,tooltipPayloadSearcher:Ts,categoricalChartProps:n,ref:t})});let Uj={placeholder:"Ask the agent to inspect, change, or explain this workspace...",mode:"Mode",model:"Model",attach:"Attach context",removeChip:"Remove context",queuedMessage:"Queued message",guideQueuedMessage:"Guide",removeQueuedMessage:"Remove queued message",moreQueuedMessageActions:"More queued message actions",contextUsage:"Context usage",contextUsed:"used",contextTokenSummary:"used {used} / {total}",toolCalls:"Tool calls",userMessages:"User messages",otherContext:"Other context",compressContext:"Compress context",send:"Run",stop:"Stop"},Uk=[{id:"agent",label:"Agent",description:"Use tools and make changes.",icon:(0,eb.jsx)(yt,{className:"fill-current"})},{id:"planner",label:"Planner",description:"Plan before changing files.",icon:(0,eb.jsx)(BG,{})},{id:"reviewer",label:"Reviewer",description:"Inspect risks and regressions.",icon:(0,eb.jsx)(mR,{})}],US=[{id:"gpt-5.5",label:"GPT-5.5",description:"Highest quality coding agent."},{id:"gpt-5.4",label:"GPT-5.4",description:"Balanced everyday work."},{id:"gpt-5.4-mini",label:"GPT-5.4 Mini",description:"Fast lightweight passes."}];function UC(e){if(e)return"string"==typeof e.label||"number"==typeof e.label?String(e.label):e.id}function UN({value:e,defaultValue:t,onValueChange:n,modes:r=Uk,modeId:i,defaultModeId:a,onModeChange:o,models:l=US,modelId:s,defaultModelId:c,onModelChange:d,queuedMessages:u,defaultQueuedMessages:f=[],onQueuedMessagesChange:h,onQueueMessage:p,onRemoveQueuedMessage:m,queueOnTab:g=!0,renderQueuedMessageActions:v,contextUsage:x,chips:y=[],actions:b,footer:w,running:j=!1,disabled:k=!1,submitOnEnter:S=!0,minRows:C=2,maxRows:N=7,onSubmit:M,onStop:E,onAttach:O,labels:P,className:A,textareaClassName:z,toolbarClassName:_}){let I={...Uj,...P},D=ew.useRef(null),T=ew.useId(),R=ew.useRef(0),[L,$]=function({value:e,defaultValue:t="",onChange:n}){let[r,i]=ew.useState(t);return[e??r,ew.useCallback(t=>{void 0===e&&i(t),n?.(t)},[n,e])]}({value:e,defaultValue:t,onChange:n}),[F,V]=ew.useState(f),[B,H]=ew.useState(a??r[0]?.id),[W,q]=ew.useState(c??l[0]?.id),U=i??B,K=s??W,G=r.find(e=>e.id===U)??r[0],Y=l.find(e=>e.id===K)??l[0],X=u??F,Z=L.trim().length>0&&!k;function J(){Z&&(M?.({value:L,modeId:G?.id,modelId:Y?.id}),$(""))}function Q(e){void 0===u&&V(e),h?.(e)}return ew.useLayoutEffect(()=>{let e=D.current;if(!e)return;e.style.height="0px";let t=Number.parseFloat(getComputedStyle(e).lineHeight),n=Number.isFinite(t)?t*N:160;e.style.height=`${Math.min(e.scrollHeight,n)}px`,e.style.overflowY=e.scrollHeight>n?"auto":"hidden"},[N,L]),(0,eb.jsxs)("div",{"data-slot":"agent-input-composer","data-running":j,className:tK("relative grid w-full",A),children:[X.length>0&&(0,eb.jsx)(UO,{messages:X,labels:I,renderActions:v,onRemove:function(e){let t=X.find(t=>t.id===e);if(!t)return;let n=X.filter(t=>t.id!==e);Q(n),m?.(e,t,n)}}),(0,eb.jsxs)("div",{"data-slot":"agent-input-composer-surface",className:tK("vtl-agent-input-composer-surface relative grid w-full gap-2 rounded-lg border border-border p-2 shadow-sm transition-colors"),children:[y.length>0&&(0,eb.jsx)("div",{"data-slot":"agent-input-composer-context",className:"flex min-w-0 flex-wrap items-center gap-1.5",children:y.map(e=>(0,eb.jsx)(UP,{chip:e,removeLabel:I.removeChip},e.id))}),(0,eb.jsx)("textarea",{ref:D,value:L,disabled:k,rows:C,placeholder:I.placeholder,"data-slot":"agent-input-composer-textarea",className:tK("min-h-10 w-full resize-none border-0 bg-transparent px-0.5 py-0 text-sm leading-5 text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-60","[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",z),onChange:e=>$(e.currentTarget.value),onKeyDown:e=>{g&&"Tab"===e.key&&!e.shiftKey&&!e.nativeEvent.isComposing&&function(){let e=L.trim();if(!e||k)return!1;R.current+=1;let t={id:`${T}-queued-${R.current}`,content:e},n=[...X,t];return Q(n),p?.(t,n),$(""),!0}()?e.preventDefault():!S||"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),J())}}),(0,eb.jsxs)("div",{"data-slot":"agent-input-composer-toolbar",className:tK("grid grid-cols-[minmax(0,1fr)_auto] items-end gap-2",_),children:[(0,eb.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,eb.jsx)(UA,{label:I.mode,options:r,value:G?.id,trigger:(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{className:"grid size-3.5 place-items-center text-muted-foreground [&_svg]:size-3",children:G?.icon??(0,eb.jsx)(yt,{className:"fill-current"})}),(0,eb.jsx)("span",{className:"truncate",children:UC(G)}),(0,eb.jsx)(cE,{className:"size-3 text-muted-foreground"})]}),triggerClassName:"rounded-md bg-transparent px-1.5 text-muted-foreground hover:bg-muted/60 hover:text-foreground aria-expanded:bg-muted/70",onSelect:function(e){e.disabled||(void 0===i&&H(e.id),o?.(e.id,e))}}),(0,eb.jsx)(UA,{label:I.model,options:l,value:Y?.id,trigger:(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{className:"truncate",children:UC(Y)}),(0,eb.jsx)(cE,{className:"size-3 text-muted-foreground"})]}),triggerClassName:"rounded-md bg-transparent px-1.5 text-muted-foreground hover:bg-muted/60 hover:text-foreground aria-expanded:bg-muted/70",onSelect:function(e){e.disabled||(void 0===s&&q(e.id),d?.(e.id,e))}}),O&&(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs",className:"text-muted-foreground","aria-label":I.attach,title:I.attach,onClick:O,disabled:k,children:(0,eb.jsx)(qD,{})}),b]}),(0,eb.jsxs)("div",{className:"flex items-center gap-1",children:[x&&(0,eb.jsx)(UE,{usage:x,labels:I}),(0,eb.jsx)(tY,{type:"button",size:"icon-xs",variant:j?"outline":"default","aria-label":j?I.stop:I.send,title:j?I.stop:I.send,disabled:!j&&!Z,className:"rounded-full",onClick:j?E:J,children:j?(0,eb.jsx)(qT,{className:"size-3 fill-current"}):(0,eb.jsx)(q_,{className:"size-3.5"})})]})]}),w&&(0,eb.jsx)("div",{"data-slot":"agent-input-composer-footer",className:"flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:w})]})]})}function UM(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1)}m`:e>=1e3?`${Math.round(e/1e3)}k`:e.toLocaleString()}function UE({usage:e,labels:t}){let[n,r]=ew.useState(!1),i=Math.max(0,e.used),a=Math.max(0,e.total),o=a>0?Math.min(100,Math.round(i/a*100)):0,l=Math.max(0,e.toolCalls),s=Math.max(0,e.userMessages),c=Math.max(0,e.other??Math.max(0,i-l-s)),d=[{name:"toolCalls",value:l,fill:"var(--color-toolCalls)"},{name:"userMessages",value:s,fill:"var(--color-userMessages)"},{name:"other",value:c,fill:"var(--color-other)"},{name:"unused",value:Math.max(0,a-i),fill:"var(--muted)"}].filter(e=>e.value>0),u=t.contextTokenSummary.replace("{used}",UM(i)).replace("{total}",UM(a)),f={toolCalls:{label:t.toolCalls,color:"var(--chart-1)"},userMessages:{label:t.userMessages,color:"var(--chart-3)"},other:{label:t.otherContext,color:"var(--chart-5)"}};return(0,eb.jsxs)(gE,{children:[(0,eb.jsx)(gz,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs",className:"text-muted-foreground","aria-label":`${t.contextUsage}: ${o}% ${t.contextUsed}`,title:`${t.contextUsage}: ${o}% ${t.contextUsed}`,children:(0,eb.jsx)("span",{"aria-hidden":"true",className:"grid size-4 place-items-center rounded-full",style:{background:`conic-gradient(var(--foreground) ${3.6*o}deg, var(--border) 0deg)`},children:(0,eb.jsx)("span",{className:"size-3 rounded-full bg-background dark:bg-popover"})})})}),(0,eb.jsxs)(gq,{side:"top",align:"center",sideOffset:8,className:"w-44 gap-2 p-3",children:[(0,eb.jsxs)("div",{className:"grid gap-0.5 text-center",children:[(0,eb.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:e.label??t.contextUsage}),(0,eb.jsxs)("div",{className:"text-sm text-muted-foreground",children:[o,"% ",t.contextUsed]}),(0,eb.jsx)("div",{className:"text-sm font-medium",children:u})]}),(0,eb.jsx)("div",{className:"grid justify-center",children:(0,eb.jsx)(Fb,{config:f,className:"h-20 w-20",initialDimension:{width:80,height:80},onMouseMove:()=>r(!0),onMouseLeave:()=>r(!1),children:(0,eb.jsxs)(Uw,{children:[(0,eb.jsx)(Fj,{active:n,content:(0,eb.jsx)(Fk,{hideLabel:!0})}),(0,eb.jsx)(Ud,{data:d.length>0?d:[{name:"other",value:1,fill:"var(--muted)"}],dataKey:"value",nameKey:"name",innerRadius:25,outerRadius:35,isAnimationActive:!1,strokeWidth:0})]})})}),(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"sm",className:"w-full",onClick:e.onCompress,disabled:!e.onCompress,children:t.compressContext})]})]})}function UO({messages:e,labels:t,renderActions:n,onRemove:r}){return(0,eb.jsx)("div",{"data-slot":"agent-input-composer-queue",className:"vtl-agent-input-composer-queue z-10 mx-5 mb-[-1px] grid gap-1.5 rounded-t-lg rounded-b-none border border-border p-1.5 shadow-xs",children:e.map((e,i)=>(0,eb.jsxs)("div",{"data-slot":"agent-input-composer-queue-item",className:tK("group/queue flex min-h-8 min-w-0 items-center gap-2 rounded-md px-2 text-sm transition-colors",e.disabled?"text-muted-foreground opacity-60":"text-foreground hover:bg-muted/60"),children:[(0,eb.jsx)("span",{className:"grid size-4 shrink-0 place-items-center text-muted-foreground [&_svg]:size-3.5",children:e.icon??(0,eb.jsx)(qI,{})}),(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate",title:String(e.content),children:e.content}),e.meta&&(0,eb.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:e.meta}),(0,eb.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5 opacity-70 transition-opacity group-hover/queue:opacity-100",children:[n?.(e),(0,eb.jsxs)(tY,{type:"button",variant:"ghost",size:"xs",className:"h-6 gap-1 px-1.5 text-muted-foreground","aria-label":`${t.guideQueuedMessage} ${i+1}`,children:[(0,eb.jsx)(qI,{className:"size-3.5"}),t.guideQueuedMessage]}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs",className:"size-6 text-muted-foreground","aria-label":`${t.removeQueuedMessage} ${i+1}`,onClick:()=>r(e.id),children:(0,eb.jsx)(m2,{})}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs",className:"size-6 text-muted-foreground","aria-label":`${t.moreQueuedMessageActions} ${i+1}`,children:(0,eb.jsx)(s6,{})})]})]},e.id))})}function UP({chip:e,removeLabel:t}){return(0,eb.jsxs)(cI,{variant:"secondary","data-tone":e.tone,className:tK("h-6 max-w-full gap-1 rounded-md border border-border bg-muted/70 px-1.5 text-muted-foreground","success"===e.tone&&"border-primary/25 bg-primary/10 text-foreground","warning"===e.tone&&"border-destructive/25 bg-destructive/10 text-foreground"),children:[e.icon&&(0,eb.jsx)("span",{className:"grid size-3.5 shrink-0 place-items-center [&_svg]:size-3",children:e.icon}),(0,eb.jsx)("span",{className:"truncate",children:e.label}),e.onRemove&&(0,eb.jsx)("button",{type:"button",className:"-mr-0.5 grid size-4 shrink-0 place-items-center rounded-sm text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none","aria-label":`${t} ${e.id}`,onClick:()=>e.onRemove?.(e.id),children:(0,eb.jsx)(p6,{className:"size-3"})})]})}function UA({label:e,options:t,value:n,trigger:r,triggerClassName:i,onSelect:a}){return(0,eb.jsxs)(yu,{children:[(0,eb.jsx)(yh,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"xs",className:tK("h-6 max-w-40 gap-1 rounded-md px-1.5 text-xs font-medium",i),children:r})}),(0,eb.jsx)(yk,{align:"start","aria-label":"string"==typeof e?e:void 0,className:"min-w-40 p-1",children:t.map(e=>(0,eb.jsxs)(yS,{disabled:e.disabled,className:"h-8 gap-2 px-2 text-sm",onSelect:()=>a(e),children:[(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.label}),(0,eb.jsx)(nv,{className:tK("ml-auto size-4 text-foreground",n===e.id?"opacity-100":"opacity-0")})]},e.id))})]})}function Uz(e,t,n,r){return[{id:`${t}-task-${e}`,kind:"user",title:n},...r.map(n=>({...n,id:`${t}-${n.id}-${e}`}))]}function U_(e){return[{id:`read-materials-${e}`,kind:"read",actionLabel:"读取",title:"AgentWorkspace.tsx, styles.css, i18n.json",files:[{id:`workspace-${e}`,name:"AgentWorkspace.tsx",lines:"1-480"},{id:`styles-${e}`,name:"styles.css",lines:"265-820"},{id:`i18n-${e}`,name:"i18n.json",lines:"245-292"}]},{id:`search-actions-${e}`,kind:"search",actionLabel:"搜索",title:"workspace creation, sidebar tree, streaming output",files:[{id:`workspace-search-${e}`,name:"AgentWorkspace.tsx",lines:"64-190"},{id:`style-search-a-${e}`,name:"styles.css",lines:"540-670"},{id:`style-search-b-${e}`,name:"styles.css",lines:"705-790"}]},{id:`subagents-${e}`,kind:"subagent",actionLabel:"召唤",title:"子代理",subagents:[{id:`reader-${e}`,title:"阅读子代理",activity:"阅读 package.json",toolActivities:["读取 package.json","检查 workspace 脚本","整理依赖信息"],status:"阅读 package.json",detail:"package.json 已读取,正在整理脚本与依赖信息。",isRunning:!0,events:Uz(e,"reader","阅读 package.json",[{id:"read-package",kind:"read",actionLabel:"读取",title:"package.json",files:[{id:"package-json",name:"package.json",lines:"1-96"}]},{id:"reader-note",kind:"done",title:"已读取 package.json。\n\n- 已记录 workspace 脚本\n- 已检查 UI 与 app 包依赖\n- 下一步等待主代理合并上下文"}])},{id:`searcher-${e}`,title:"搜索子代理",activity:"搜索 AgentWorkspace.tsx",toolActivities:["搜索 AgentWorkspace.tsx","筛选面板布局","定位事件流接入"],status:"搜索 AgentWorkspace.tsx",detail:"AgentWorkspace.tsx 命中 3 处候选区域,正在筛选可复用结构。",isRunning:!0,events:Uz(e,"searcher","搜索 AgentWorkspace.tsx",[{id:"search-workspace",kind:"search",actionLabel:"搜索",title:"AgentWorkspace.tsx",files:[{id:"agent-workspace-a",name:"AgentWorkspace.tsx",lines:"64-190"},{id:"agent-workspace-b",name:"AgentWorkspace.tsx",lines:"320-418"}]},{id:"searcher-note",kind:"done",title:"已定位 AgentWorkspace.tsx 的面板布局与事件流接入位置。"}])},{id:`verifier-${e}`,title:"验证子代理",activity:"验证工作流状态",toolActivities:["验证对话流","验证右侧面板","检查子代理切换"],status:"验证工作流状态",detail:"工作流状态正在校验,等待主代理提交最终结果。",isRunning:!0,events:Uz(e,"verifier","验证工作流状态",[{id:"verify-flow",kind:"verify",actionLabel:"验证",title:"对话流、右侧面板、子代理切换"},{id:"verifier-note",kind:"done",title:"验证队列已建立,等待主代理继续写入真实结果。"}])}]},{id:`think-structure-${e}`,kind:"thought",actionLabel:"思考",title:"8s",status:"done"},{id:`plan-${e}`,kind:"done",title:"**收到新的编织请求。**\n\n我会先保留当前工作台样式,只用占位文本演示真实任务流:读取、搜索、思考、编辑和验证都会按顺序进入同一条文字流。\n\n- 左侧织布机由真实创建动作产生\n- 编织物初始保持为空\n- 文件读取项仍然可以展开\n- 点击文件名会继续打开右侧标签页"},{id:`edit-workspace-${e}`,kind:"change",actionLabel:"编辑",title:"AgentWorkspace.tsx",additions:44,deletions:16},{id:`edit-style-${e}`,kind:"change",actionLabel:"编辑",title:"styles.css",additions:36,deletions:12},{id:`verify-flow-${e}`,kind:"verify",actionLabel:"验证",title:"empty sidebar, new loom creation, placeholder workflow"},{id:`done-${e}`,kind:"done",title:"演示工作流已完成。\n\n这只是前端占位演示,后续可以直接把事件流替换成真实 agent runtime。"}]}let UI=[{id:"user-1",kind:"user",title:"345"},...U_("1"),{id:"user-2",kind:"user",title:"234"}],UD=eN("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);function UT({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"agent-message-actions",className:tK("flex items-center gap-1.5 text-muted-foreground",e),...t})}function UR({className:e,...t}){return(0,eb.jsx)(tY,{size:"icon-xs",variant:"ghost",className:e,...t})}function UL(e,t=1/0){let n=[],r=0;for(;r<e.length;){if(e.startsWith("**",r)){let i=e.indexOf("**",r+2),a=-1===i?e.slice(r+2):e.slice(r+2,i);a.length>0&&n.push((0,eb.jsx)("strong",{children:UL(a,t-r-2)},`strong-${r}`)),r=-1===i?e.length:i+2;continue}if("`"===e[r]){let i=e.indexOf("`",r+1),a=-1===i?e.slice(r+1):e.slice(r+1,i);a.length>0&&n.push((0,eb.jsx)("code",{children:UL(a,t-r-1)},`code-${r}`)),r=-1===i?e.length:i+1;continue}let i=[e.indexOf("**",r),e.indexOf("`",r)].filter(e=>e>=0).sort((e,t)=>e-t)[0]??e.length;!function(e,t,n,r,i){if(!t)return;let a=n+t.length;if(r<=n)return e.push((0,eb.jsx)("span",{className:"vtl-agent-stream-fade-text",children:t},`${i}-fade-${n}`));if(r>=a)return e.push(t);let o=r-n;e.push(t.slice(0,o)),e.push((0,eb.jsx)("span",{className:"vtl-agent-stream-fade-text",children:t.slice(o)},`${i}-fade-${n}`))}(n,e.slice(r,i),r,t,`text-${r}`),r=i}return n}function U$({content:e,isStreaming:t=!1}){let n=function(e){let t,n=[],r=/\n{2,}/g,i=0;for(;null!==(t=r.exec(e));)n.push({text:e.slice(i,t.index),start:i}),i=t.index+t[0].length;return n.push({text:e.slice(i),start:i}),n}(e),r=t?Math.max(0,e.length-14):1/0;return(0,eb.jsx)("div",{className:"vtl-agent-markdown",children:n.map(({text:e,start:t},n)=>{let i=r-t;if(e.startsWith("```"))return(0,eb.jsx)("pre",{children:e.replace(/^```[a-z]*\n?/i,"").replace(/```$/,"")},`block-${n}`);let a=e.split("\n");return a.every(e=>e.trim().startsWith("- "))?(0,eb.jsx)("ul",{children:a.map((e,t)=>(0,eb.jsx)("li",{children:UL(e.trim().slice(2),i-2)},`${e}-${t}`))},`block-${n}`):(0,eb.jsx)("p",{children:UL(e.replace(/\n/g," "),i)},`block-${n}`)})})}function UF({events:e,labels:t,bottomInset:n=16,className:r,contentClassName:i,onOpenFile:a,onOpenSubagent:o,onRecallUserMessage:l,onBranchUserMessage:s}){let c=ew.useRef(null),d=ew.useRef(!0),[u,f]=ew.useState(0),[h,p]=ew.useState(0),[m,g]=ew.useState({});ew.useLayoutEffect(()=>{let e=c.current;if(!e)return;function t(){p(e.clientHeight)}t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let v=ew.useMemo(()=>e.reduce((e,t,n)=>{var r;let i=m[UG(t,n)]??("user"===(r=t).kind?72:"assistant"===r.kind||"done"===r.kind?Math.max(42,Math.min(260,28+22*Math.ceil((r.title.length+(r.detail?.length??0))/68))):"read"===r.kind||"search"===r.kind?r.files?.length?28+26*Math.min(r.files.length,5):26:"subagent"===r.kind?r.subagents?.length?6+24*Math.min(r.subagents.length,6):42:"change"===r.kind?42:r.detail?54:26);return e.rows.push({event:t,index:n,offset:e.totalHeight,height:i}),e.totalHeight+=i,e},{rows:[],totalHeight:0}),[e,m]),x=v.rows.filter(e=>e.offset+e.height>=u-360&&e.offset<=u+Math.max(h,520)+360),y=v.totalHeight+Math.max(0,n);ew.useLayoutEffect(()=>{let t=c.current;t&&e.length&&d.current&&(t.scrollTop=t.scrollHeight,f(t.scrollTop))},[n,e.length,y]);let b=ew.useCallback((e,t)=>{g(n=>1>Math.abs((n[e]??0)-t)?n:{...n,[e]:t})},[]);return(0,eb.jsx)("div",{ref:c,"data-slot":"agent-conversation-flow",className:tK("min-h-0 flex-1 overflow-auto px-4 pt-4 opacity-100 transition-opacity duration-180 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",r),onScroll:function(){let e=c.current;e&&(d.current=e.scrollHeight-e.scrollTop-e.clientHeight<96,f(e.scrollTop))},children:(0,eb.jsx)("div",{className:tK("relative mx-auto min-h-full w-full max-w-[48rem]",i),style:{height:y},children:x.map(e=>(0,eb.jsx)(UV,{event:e.event,rowKey:UG(e.event,e.index),offset:e.offset,labels:t,onMeasure:b,onOpenFile:a,onOpenSubagent:o,onRecallUserMessage:l,onBranchUserMessage:s},UG(e.event,e.index)))})})}function UV({event:e,rowKey:t,offset:n,labels:r,onMeasure:i,onOpenFile:a,onOpenSubagent:o,onRecallUserMessage:l,onBranchUserMessage:s}){let c=ew.useRef(null);return ew.useLayoutEffect(()=>{let e=c.current;if(!e)return;function n(){i(t,Math.ceil(e.getBoundingClientRect().height))}n();let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[e.id,i,t]),(0,eb.jsx)("div",{ref:c,"data-index":e.id,className:"absolute inset-x-0 top-0",style:{transform:`translateY(${n}px)`},children:(0,eb.jsx)(UB,{event:e,labels:r,onOpenFile:a,onOpenSubagent:o,onRecallUserMessage:l,onBranchUserMessage:s})})}function UB({event:e,labels:t,onOpenFile:n,onOpenSubagent:r,onRecallUserMessage:i,onBranchUserMessage:a}){return"user"===e.kind?(0,eb.jsxs)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:[(0,eb.jsx)("div",{className:"vtl-agent-user-message-wrap",children:(0,eb.jsx)("div",{className:"vtl-agent-user-message",children:e.title})}),(i||a)&&(0,eb.jsxs)(UT,{className:"absolute top-1/2 right-2 opacity-0 transition-opacity focus-within:opacity-100 hover:opacity-100",children:[i&&(0,eb.jsx)(UR,{type:"button","aria-label":t?.recall??"召回",title:t?.recall??"召回",onClick:()=>i(e),children:(0,eb.jsx)(UD,{})}),a&&(0,eb.jsx)(UR,{type:"button","aria-label":t?.branch??"分支",title:t?.branch??"分支",onClick:()=>a(e),children:(0,eb.jsx)(FN,{})})]})]}):"assistant"===e.kind||"done"===e.kind?(0,eb.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,eb.jsx)("div",{"data-streaming":e.isStreaming?"true":"false",children:(0,eb.jsx)(U$,{content:e.detail?`${e.title}
|
|
16
|
+
`).join("\n")}}):null}let Fj=function(e){var t,n,r,i,a,o,l,s,c,d,u=Cs(e,$B),{active:f,allowEscapeViewBox:h,animationDuration:p,animationEasing:m,content:g,filterNull:v,isAnimationActive:x,offset:y,payloadUniqBy:b,position:w,reverseDirection:j,useTranslate3d:k,wrapperStyle:S,cursor:C,shared:N,trigger:M,defaultIndex:E,portal:O,axisId:P}=u,A=ww(),z="number"==typeof E?String(E):E;(0,ew.useEffect)(()=>{A(_e({shared:N,trigger:M,axisId:P,active:f,defaultIndex:z}))},[A,N,M,P,f,z]);var _=S_(),I=RE(),D=wC(e=>z5(e,N)),{activeIndex:T,isActive:R}=null!=(c=wC(e=>I2(e,D,M,z)))?c:{},L=wC(e=>I1(e,D,M,z)),$=wC(e=>I0(e,D,M,z)),F=wC(e=>IQ(e,D,M,z)),V=(0,ew.useContext)(RK),B=null!=(d=null!=f?f:R)&&d,[H,W]=$s([L,B]),q="axis"===D?$:void 0;t=wC(e=>((e,t,n)=>{if(null!=t){var r=_v(e);return"axis"===t?"hover"===n?r.axisInteraction.hover.dataKey:r.axisInteraction.click.dataKey:"hover"===n?r.itemInteraction.hover.dataKey:r.itemInteraction.click.dataKey}})(e,D,M)),n=wC(It),r=wC(MB),i=wC(MF),a=wC(MV),l=(null==(o=wC(RH))?void 0:o.sourceViewBox)!=null,s=S_(),(0,ew.useEffect)(()=>{if(!l&&null!=i&&null!=r){var e=_l({active:B,coordinate:F,dataKey:t,index:T,label:"number"==typeof q?String(q):q,sourceViewBox:s,graphicalItemId:n});RF.emit(RV,i,e,r)}},[l,F,t,n,T,q,r,i,a,B,s]);var U=null!=O?O:V;if(null==U||null==_||null==D)return null;var K=null!=L?L:$V;B||(K=$V),v&&K.length&&(K=$l(K.filter(e=>null!=e.value&&(!0!==e.hide||u.includeHidden)),b,$F));var G=K.length>0,Y=$$($$({},u),{},{payload:K,label:q,active:B,activeIndex:T,coordinate:F,accessibilityLayer:I}),X=ew.createElement($a,{allowEscapeViewBox:h,animationDuration:p,animationEasing:m,isAnimationActive:x,active:B,coordinate:F,hasPayload:G,offset:y,position:w,reverseDirection:j,useTranslate3d:k,viewBox:_,wrapperStyle:S,lastBoundingBox:H,innerRef:W,hasPortalFromProps:!!O},ew.isValidElement(g)?ew.cloneElement(g,Y):"function"==typeof g?ew.createElement(g,Y):ew.createElement(L9,Y));return ew.createElement(ew.Fragment,null,(0,t3.createPortal)(X,U),B&&ew.createElement($R,{cursor:C,tooltipEventType:D,coordinate:F,payload:K,index:T}))};function Fk({active:e,payload:t,className:n,indicator:r="dot",hideLabel:i=!1,hideIndicator:a=!1,label:o,labelFormatter:l,labelClassName:s,formatter:c,color:d,nameKey:u,labelKey:f}){let{config:h}=function(){let e=ew.useContext(Fy);if(!e)throw Error("useChart must be used within a <ChartContainer />");return e}(),p=ew.useMemo(()=>{if(i||!t?.length)return null;let[e]=t,n=`${f??e?.dataKey??e?.name??"value"}`,r=FS(h,e,n),a=f||"string"!=typeof o?r?.label:h[o]?.label??o;return l?(0,eb.jsx)("div",{className:tK("font-medium",s),children:l(a,t)}):a?(0,eb.jsx)("div",{className:tK("font-medium",s),children:a}):null},[o,l,t,i,s,h,f]);if(!e||!t?.length)return null;let m=1===t.length&&"dot"!==r;return(0,eb.jsxs)("div",{className:tK("vtl-surface-popover grid min-w-32 items-start gap-1.5 rounded-[var(--surface-popover-radius)] border px-2.5 py-1.5 text-xs",n),children:[m?null:p,(0,eb.jsx)("div",{className:"grid gap-1.5",children:t.filter(e=>"none"!==e.type).map((e,t)=>{let n=`${u??e.name??e.dataKey??"value"}`,i=FS(h,e,n),o=d??e.payload?.fill??e.color;return(0,eb.jsx)("div",{className:tK("flex w-full flex-wrap items-stretch gap-2 [&>svg]:size-2.5 [&>svg]:text-muted-foreground","dot"===r&&"items-center"),children:c&&e?.value!==void 0&&e.name?c(e.value,e.name,e,t,e.payload):(0,eb.jsxs)(eb.Fragment,{children:[i?.icon?(0,eb.jsx)(i.icon,{}):!a&&(0,eb.jsx)("div",{className:tK("shrink-0 rounded-[2px]","dot"===r&&"size-2.5","line"===r&&"w-1","dashed"===r&&"w-0 border-[1.5px] border-dashed bg-transparent",m&&"dashed"===r&&"my-0.5"),style:{backgroundColor:"dashed"===r?"transparent":o,borderColor:o}}),(0,eb.jsxs)("div",{className:tK("flex flex-1 justify-between leading-none",m?"items-end":"items-center"),children:[(0,eb.jsxs)("div",{className:"grid gap-1.5",children:[m?p:null,(0,eb.jsx)("span",{className:"text-muted-foreground",children:i?.label??e.name})]}),null!=e.value&&(0,eb.jsx)("span",{className:"font-mono font-medium text-foreground tabular-nums",children:"number"==typeof e.value?e.value.toLocaleString():String(e.value)})]})]})},t)})})]})}function FS(e,t,n){if("object"!=typeof t||null===t)return;let r="payload"in t&&"object"==typeof t.payload&&null!==t.payload?t.payload:void 0,i=n;return n in t&&"string"==typeof t[n]?i=t[n]:r&&n in r&&"string"==typeof r[n]&&(i=r[n]),i in e?e[i]:e[n]}function FC({config:e,data:t}){return(0,eb.jsx)(Fb,{config:e,className:"mt-2 min-h-0 flex-1",children:(0,eb.jsxs)(Lr,{data:t,margin:{left:8,right:8},children:[(0,eb.jsx)(L$,{vertical:!1}),(0,eb.jsx)(L1,{dataKey:"time",tickLine:!1,axisLine:!1,tickMargin:8}),(0,eb.jsx)(Fj,{content:(0,eb.jsx)(Fk,{indicator:"line"})}),(0,eb.jsx)(Tl,{dataKey:"p2p",type:"monotone",fill:"var(--color-p2p)",fillOpacity:.12,stroke:"var(--color-p2p)",strokeWidth:2}),(0,eb.jsx)(Tl,{dataKey:"relay",type:"monotone",fill:"var(--color-relay)",fillOpacity:.1,stroke:"var(--color-relay)",strokeWidth:2})]})})}let FN=eN("git-branch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);function FM({canvases:e,mode:t="active",scrollable:n=!1,onSelect:r}){let i=ew.useMemo(()=>e.map(e=>{var n;return{id:e.id,status:"live"===(n=e).status?"current":"review"===n.status?"blocked":"done",title:(0,eb.jsx)(FE,{canvas:e,mode:t,onClick:()=>r(e)})}}),[e,t,r]);return(0,eb.jsx)(mT,{items:i,scrollCurrentIntoView:!1,className:tK("mt-2",n&&"min-h-0 flex-1"),viewportClassName:tK("max-h-none pr-0",n?"h-full overflow-y-auto":"overflow-visible"),itemClassName:"py-2"})}function FE({canvas:e,onClick:t,mode:n}){return(0,eb.jsxs)("button",{type:"button",className:tK("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,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("div",{className:"truncate text-sm font-medium",children:e.title}),(0,eb.jsx)("div",{className:"truncate text-xs text-muted-foreground",children:"active"===n?e.purpose:`${e.nodes} nodes`})]}),"active"===n?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(mA,{value:e.progress,className:"h-1.5"}),(0,eb.jsx)("span",{"aria-label":e.progress>=100?"Canvas complete":"Canvas incomplete",className:tK("size-2.5 rounded-full",e.progress>=100?"bg-primary":"bg-border")})]}):(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(FO,{icon:(0,eb.jsx)(FN,{}),value:`${e.snapshots}`}),(0,eb.jsx)(FO,{icon:(0,eb.jsx)(g7,{}),value:e.runtime}),(0,eb.jsx)("div",{className:"text-right ui-text-kbd text-muted-foreground",children:e.lastOpened})]})]})}function FO({icon:e,value:t}){return(0,eb.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,eb.jsx)("span",{className:"[&_svg]:size-3.5",children:e}),(0,eb.jsx)("span",{className:"tabular-nums",children:t})]})}let FP=eN("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]),FA=eN("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]),Fz=eN("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"}]]),F_=eN("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),FI=eN("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"}]]);function FD({title:e=ez.machineStatus}){return(0,eb.jsx)(fe,{title:e,icon:(0,eb.jsx)(eP,{}),className:"size-full",jellyImage:"/themes/jelly/card3.png",jellyImagePosition:"center top",jellyImageOpacity:.88,jellyImageBlur:"5px",children:(0,eb.jsx)("div",{className:"grid gap-2 overflow-hidden",children:fo.map(e=>(0,eb.jsxs)("div",{className:"grid gap-3 rounded-lg border bg-muted/15 p-3 lg:grid-cols-[minmax(12rem,1fr)_minmax(0,1.6fr)]",children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,eb.jsx)("span",{className:"grid size-9 shrink-0 place-items-center rounded-lg border bg-background text-muted-foreground",children:(0,eb.jsx)(F_,{className:"size-4"})}),(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,eb.jsx)("p",{className:"truncate ui-text-control font-medium",children:e.name}),(0,eb.jsx)(cI,{variant:e.status===ez.online?"secondary":"outline",children:e.status})]}),(0,eb.jsxs)("p",{className:"mt-1 truncate ui-text-kbd text-muted-foreground",children:[e.role," · ",e.link]})]})]}),(0,eb.jsxs)("div",{className:"grid gap-2 sm:grid-cols-4",children:[(0,eb.jsx)(FT,{icon:(0,eb.jsx)(FP,{}),label:ez.cpu,value:e.cpu}),(0,eb.jsx)(FT,{icon:(0,eb.jsx)(Fz,{}),label:ez.memory,value:e.memory}),(0,eb.jsx)(FT,{icon:(0,eb.jsx)(FI,{}),label:ez.gpu,value:e.gpu}),(0,eb.jsx)(FT,{icon:(0,eb.jsx)(FA,{}),label:ez.disk,value:e.disk})]})]},e.id))})})}function FT({icon:e,label:t,value:n}){return(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsxs)("div",{className:"flex items-center justify-between gap-2 ui-text-kbd text-muted-foreground",children:[(0,eb.jsxs)("span",{className:"flex items-center gap-1",children:[e,t]}),(0,eb.jsxs)("span",{className:"tabular-nums",children:[n,"%"]})]}),(0,eb.jsx)(mA,{value:n})]})}function FR({label:e,value:t,jellyImage:n,jellyImagePosition:r}){var i;return(0,eb.jsxs)("section",{className:tK("relative size-full overflow-hidden rounded-xl border bg-card p-5",n&&"vtl-jelly-image-card",n&&u7(n)&&"vtl-jelly-image-card-shadowless"),style:n?u9({image:n,position:r,opacity:.76,blur:"8px"}):void 0,children:[(0,eb.jsx)("div",{className:"text-xl font-semibold tracking-normal",children:e}),(0,eb.jsx)(mC,{value:(i=t,/^\d+$/.test(i)&&1===i.length?`0${i}`:i),minSize:42,maxSize:180,className:"absolute right-5 bottom-5 h-2/3 w-[78%]"})]})}let FL=eN("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);function F$({title:e=ez.resourceTrend}){return(0,eb.jsx)(fe,{title:e,icon:(0,eb.jsx)(FL,{}),className:"size-full",children:(0,eb.jsx)(Fb,{config:fc,className:"h-full min-h-0 w-full",children:(0,eb.jsxs)(Lr,{data:fl,margin:{left:8,right:8},children:[(0,eb.jsx)(L$,{vertical:!1}),(0,eb.jsx)(L1,{dataKey:"time",tickLine:!1,axisLine:!1,tickMargin:8}),(0,eb.jsx)(Fj,{content:(0,eb.jsx)(Fk,{indicator:"line"})}),(0,eb.jsx)(Tl,{dataKey:"cpu",type:"monotone",fill:"var(--color-cpu)",fillOpacity:.12,stroke:"var(--color-cpu)",strokeWidth:2}),(0,eb.jsx)(Tl,{dataKey:"memory",type:"monotone",fill:"var(--color-memory)",fillOpacity:.1,stroke:"var(--color-memory)",strokeWidth:2})]})})})}var FF=ew,FV=e=>null;FV.displayName="Cell";var FB=e.i(19003);function FH(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 FW(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?FH(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FH(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Fq(){return(Fq=Object.assign.bind()).apply(null,arguments)}function FU(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var FK=(e,t,n,r,i)=>{var a=n-r;return b8(ep||(ep=FU(["M ",",",""])),e,t)+b8(em||(em=FU(["L ",",",""])),e+n,t)+b8(eg||(eg=FU(["L ",",",""])),e+n-a/2,t+i)+b8(ev||(ev=FU(["L ",",",""])),e+n-a/2-r,t+i)+b8(ex||(ex=FU(["L ",","," Z"])),e,t)},FG={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},FY=e=>{var t=Cs(e,FG),{x:n,y:r,upperWidth:i,lowerWidth:a,height:o,className:l}=t,{animationEasing:s,animationDuration:c,animationBegin:d,isUpdateAnimationActive:u}=t,f=(0,ew.useRef)(null),[h,p]=(0,ew.useState)(-1),m=(0,ew.useRef)(i),g=(0,ew.useRef)(a),v=(0,ew.useRef)(o),x=(0,ew.useRef)(n),y=(0,ew.useRef)(r),b=Dn(e,"trapezoid-");if((0,ew.useEffect)(()=>{if(f.current&&f.current.getTotalLength)try{var e=f.current.getTotalLength();e&&p(e)}catch(e){}},[]),n!==+n||r!==+r||i!==+i||a!==+a||o!==+o||0===i&&0===a||0===o)return null;var w=eH("recharts-trapezoid",l);if(!u)return ew.createElement("g",null,ew.createElement("path",Fq({},SY(t),{className:w,d:FK(n,r,i,a,o)})));var j=m.current,k=g.current,S=v.current,C=x.current,N=y.current,M="0px ".concat(-1===h?1:h,"px"),E="".concat(h,"px ").concat(h,"px"),O=Dx(["strokeDasharray"],c,s);return ew.createElement(DR,{animationId:b,key:b,canBegin:h>0,duration:c,easing:s,isActive:u,begin:d},e=>{var l=wl(j,i,e),s=wl(k,a,e),c=wl(S,o,e),d=wl(C,n,e),u=wl(N,r,e);f.current&&(m.current=l,g.current=s,v.current=c,x.current=d,y.current=u);var h=e>0?{transition:O,strokeDasharray:E}:{strokeDasharray:M};return ew.createElement("path",Fq({},SY(t),{className:w,d:FK(d,u,l,s,c),ref:f,style:FW(FW({},h),t.style)}))})},FX=["option","shapeType","activeClassName","inActiveClassName"];function FZ(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 FJ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?FZ(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FZ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function FQ(e){var{shapeType:t,elementProps:n}=e;switch(t){case"rectangle":return ew.createElement($j,n);case"trapezoid":return ew.createElement(FY,n);case"sector":return ew.createElement($O,n);case"symbols":if("symbols"===t)return ew.createElement(Fe,n);break;case"curve":return ew.createElement(SG,n);default:return null}}function F0(e){var t,{option:n,shapeType:r,activeClassName:i="recharts-active-shape",inActiveClassName:a="recharts-shape"}=e,o=function(e,t){if(null==e)return{};var n,r,i=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 a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,FX);if((0,ew.isValidElement)(n))t=(0,ew.cloneElement)(n,FJ(FJ({},o),(0,ew.isValidElement)(n)?n.props:n));else if("function"==typeof n)t=n(o,o.index);else if((0,FB.default)(n)&&"boolean"!=typeof n){var l=FJ(FJ({},o),n);t=ew.createElement(FQ,{shapeType:r,elementProps:l})}else t=ew.createElement(FQ,{shapeType:r,elementProps:o});return o.isActive?ew.createElement(SJ,{className:i},t):ew.createElement(SJ,{className:a},t)}function F1(){return(F1=Object.assign.bind()).apply(null,arguments)}function F2(e){return ew.createElement(F0,F1({shapeType:"rectangle",activeClassName:"recharts-active-bar",inActiveClassName:"recharts-inactive-bar"},e))}var F5=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(n,r)=>{if(wt(e))return e;var i=wt(n)||null==n;return i?e(n,r):(i||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)}},F4=(e,t,n)=>{var r=ww();return(i,a)=>o=>{null==e||e(i,a,o),r(_t({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},F3=e=>{var t=ww();return(n,r)=>i=>{null==e||e(n,r,i),t(_n())}},F6=(e,t,n)=>{var r=ww();return(i,a)=>o=>{null==e||e(i,a,o),r(_i({activeIndex:String(a),activeDataKey:t,activeCoordinate:i.tooltipPosition,activeGraphicalItemId:n}))}},F8=["children"],F7=(0,ew.createContext)({data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0});function F9(e){var{children:t}=e,n=function(e,t){if(null==e)return{};var n,r,i=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 a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,F8);return ew.createElement(F7.Provider,{value:n},t)}var Ve=(e,t,n)=>{var r=null!=n?n:e;if(null!=r)return wa(r,t,0)};function Vt(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 Vn(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Vt(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Vt(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Vr=j$([Aj,(e,t)=>t],(e,t)=>e.filter(e=>"bar"===e.type).find(e=>e.id===t)),Vi=j$([Vr],e=>null==e?void 0:e.maxBarSize),Va=j$([ST,Aj,IA,Iz,(e,t,n)=>n],(e,t,n,r,i)=>t.filter(t=>"horizontal"===e?t.xAxisId===n:t.yAxisId===r).filter(e=>e.isPanorama===i).filter(e=>!1===e.hide).filter(e=>"bar"===e.type)),Vo=j$([Va,e=>e.rootProps.barSize,(e,t)=>{var n=ST(e),r=IA(e,t),i=Iz(e,t);if(null!=r&&null!=i)return"horizontal"===n?zW(e,"xAxis",r):zW(e,"yAxis",i)}],(e,t,n)=>{var r=e.filter(MK),i=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,[i,a]=e;return{stackId:i,dataKeys:a.map(e=>e.dataKey),barSize:Ve(t,n,null==(r=a[0])?void 0:r.barSize)}}),...i.map(e=>({stackId:void 0,dataKeys:[e.dataKey].filter(e=>null!=e),barSize:Ve(t,n,e.barSize)}))]}),Vl=(e,t,n)=>{var r,i,a=ST(e),o=IA(e,t),l=Iz(e,t);if(null!=o&&null!=l)return"horizontal"===a?(r=zX(e,"xAxis",o,n),i=zY(e,"xAxis",o,n)):(r=zX(e,"yAxis",l,n),i=zY(e,"yAxis",l,n)),k4(r,i)},Vs=j$([Vo,MD,e=>e.rootProps.barGap,MT,(e,t,n)=>{var r,i,a,o,l=Vr(e,t);if(null==l)return 0;var s=IA(e,t),c=Iz(e,t);if(null==s||null==c)return 0;var d=ST(e),u=MD(e),{maxBarSize:f}=l;return"horizontal"===d?(a=zX(e,"xAxis",s,n),o=zY(e,"xAxis",s,n)):(a=zX(e,"yAxis",c,n),o=zY(e,"yAxis",c,n)),null!=(r=null!=(i=k4(a,o,!0))?i:null==f?u:f)?r:0},Vl,Vi],(e,t,n,r,i,a,o)=>{var l=function(e,t,n,r,i){var a,o,l=r.length;if(!(l<1)){var s=wa(e,n,0,!0),c=[];if(wf(null==(a=r[0])?void 0:a.barSize)){var d=!1,u=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&&u>0&&(d=!0,u*=.9,f=l*u);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:d?u:null!=(n=t.barSize)?n:0}},i=[...e,r];return h=r.position,i},c)}else{var p=wa(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=wf(i)?Math.min(m,i):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,i!==a?i:a,e,null==o?t:o);return i!==a&&null!=l&&(l=l.map(e=>Vn(Vn({},e),{},{position:Vn(Vn({},e.position),{},{offset:e.position.offset-i/2})}))),l}),Vc=j$([Vs,Vr],(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}}),Vd=j$([(e,t,n)=>{var r=ST(e),i=IA(e,t),a=Iz(e,t);if(null!=i&&null!=a)return"horizontal"===r?AK(e,"yAxis",a,n):AK(e,"xAxis",i,n)},Vr],(e,t)=>{var n=Mq(t);if(!e||null==n||null==t)return;var{stackId:r}=t;if(null!=r){var i=e[r];if(i){var{stackedData:a}=i;if(a)return a.find(e=>e.key===n)}}}),Vu=j$([Sl,Sc,(e,t,n)=>{var r=IA(e,t);if(null!=r)return zX(e,"xAxis",r,n)},(e,t,n)=>{var r=Iz(e,t);if(null!=r)return zX(e,"yAxis",r,n)},(e,t,n)=>{var r=IA(e,t);if(null!=r)return zY(e,"xAxis",r,n)},(e,t,n)=>{var r=Iz(e,t);if(null!=r)return zY(e,"yAxis",r,n)},Vc,ST,My,Vl,Vd,Vr,(e,t,n,r)=>r],(e,t,n,r,i,a,o,l,s,c,d,u,f)=>{var h,{chartData:p,dataStartIndex:m,dataEndIndex:g}=s;if(null!=u&&null!=o&&null!=t&&("horizontal"===l||"vertical"===l)&&null!=n&&null!=r&&null!=i&&null!=a&&null!=c){var{data:v}=u;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:i},pos:a,bandSize:o,xAxis:l,yAxis:s,xAxisTicks:c,yAxisTicks:d,stackedData:u,displayedData:f,offset:h,cells:p,parentViewBox:m,dataStartIndex:g}=e,v="horizontal"===t?s:l,x=u?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]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]})({numericAxis:v}),b=v.scale.map(y);return f.map((e,f)=>{if(u){var v=u[f+g];if(null==v)return null;j=((e,t)=>{if(!t||2!==t.length||!wt(t[0])||!wt(t[1]))return e;var n=Math.min(t[0],t[1]),r=Math.max(t[0],t[1]),i=[e[0],e[1]];return(!wt(e[0])||e[0]<n)&&(i[0]=n),(!wt(e[1])||e[1]>r)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]<n&&(i[1]=n),i})(v,x)}else Array.isArray(j=kG(e,n))||(j=[y,j]);var w=F5(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=k1({axis:l,ticks:c,bandSize:o,offset:a.offset,entry:e,index:f}),S=null!=(E=null!=P?P:O)?E:void 0,C=a.size;var A=O-P;if(N=b9(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 z=b7(N||w)*(Math.abs(w)-Math.abs(N));S-=z,N+=z}}else{var _=l.scale.map(j[0]),I=l.scale.map(j[1]);if(null==_||null==I)return null;if(k=_,S=k1({axis:s,ticks:d,bandSize:o,offset:a.offset,entry:e,index:f}),C=I-_,N=a.size,M={x:h.left,y:S,width:h.width,height:N},Math.abs(w)>0&&Math.abs(C)<Math.abs(w)){var D=b7(C||w)*(Math.abs(w)-Math.abs(C));C+=D}}return null!=k&&null!=S&&null!=C&&null!=N&&(i||0!==C&&0!==N)?VE(VE({},e),{},{stackedBarStart:b,x:k,y:S,width:C,height:N,value:u?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:u,pos:o,parentViewBox:t,bandSize:c,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,stackedData:d,displayedData:h,offset:e,cells:f,dataStartIndex:m})}}),Vf=(e,t)=>t,Vh=(e,t,n)=>n,Vp=j$([Vf,Aj,Vh],(e,t,n)=>t.filter(e=>"bar"===e.type).filter(t=>t.stackId===e).filter(e=>e.isPanorama===n).filter(e=>!e.hide)),Vm=j$([Vp],e=>e.map(e=>e.id)),Vg=j$([e=>e,Vf,Vh],(e,t,n)=>{var r=Vm(e,t,n),i=[];return r.forEach(t=>{var r=Vu(e,t,n,void 0);null==r||r.forEach(e=>{var t=e.originalDataIndex;i[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}})(i[t],e)})}),i}),Vv=["index"];function Vx(){return(Vx=Object.assign.bind()).apply(null,arguments)}var Vy=(0,ew.createContext)(void 0),Vb=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),Vw=e=>{var{index:t}=e,n=function(e,t){if(null==e)return{};var n,r,i=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 a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(e,Vv),r=(e=>{var t=(0,ew.useContext)(Vy);if(null!=t){var{stackId:n}=t;return"url(#".concat(Vb(n,e),")")}})(t);return ew.createElement(SJ,Vx({className:"recharts-bar-stack-layer",clipPath:r},n))},Vj=["onMouseEnter","onMouseLeave","onClick"],Vk=["value","background","tooltipPosition"],VS=["id"],VC=["onMouseEnter","onClick","onMouseLeave"];function VN(){return(VN=Object.assign.bind()).apply(null,arguments)}function VM(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 VE(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?VM(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):VM(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function VO(e,t){if(null==e)return{};var n,r,i=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 a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var VP=FF.memo(e=>{var{dataKey:t,stroke:n,strokeWidth:r,fill:i,name:a,hide:o,unit:l,tooltipType:s,id:c}=e,d={dataDefinedOnItem:void 0,getPosition:wu,settings:{stroke:n,strokeWidth:r,fill:i,dataKey:t,nameKey:void 0,name:k6(a,t),hide:o,type:s,color:i,unit:l,graphicalItemId:c}};return FF.createElement(IE,{tooltipEntrySettings:d})});function VA(e){var t,n=wC(_7),{data:r,dataKey:i,background:a,allOtherBarProps:o}=e,{onMouseEnter:l,onMouseLeave:s,onClick:c}=o,d=VO(o,Vj),u=F4(l,i,o.id),f=F3(s),h=F6(c,i,o.id);if(!a||null==r)return null;var p=wx(a);return FF.createElement(ND,{zIndex:(t=CE.barBackground,a&&"object"==typeof a&&"zIndex"in a&&"number"==typeof a.zIndex&&wf(a.zIndex)?a.zIndex:t)},r.map((e,t)=>{var{value:r,background:o,tooltipPosition:l}=e,s=VO(e,Vk);if(!o)return null;var c=u(e,t),m=f(e,t),g=h(e,t),v=VE(VE(VE(VE(VE({option:a,isActive:String(t)===n},s),{},{fill:"#eee"},o),p),b4(d,e,t)),{},{onMouseEnter:c,onMouseLeave:m,onClick:g,dataKey:i,index:t,className:"recharts-bar-background-rectangle"});return FF.createElement(F2,VN({key:"background-bar-".concat(t)},v))}))}function Vz(e){var{showLabels:t,children:n,rects:r}=e,i=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 VE(VE({},t),{},{value:e.value,payload:e.payload,parentViewBox:e.parentViewBox,viewBox:t,fill:e.fill})});return FF.createElement(N3,{value:t?i:void 0},n)}function V_(e){var t,{shape:n,activeBar:r,baseProps:i,entry:a,index:o,dataKey:l}=e,s=wC(_7),c=wC(Ie),d=r&&String(a.originalDataIndex)===s&&(null==c||l===c),[u,f]=(0,FF.useState)(!1),[h,p]=(0,FF.useState)(!1);(0,FF.useEffect)(()=>{var e;return d?(f(!0),e=requestAnimationFrame(()=>{p(!0)})):p(!1),()=>{cancelAnimationFrame(e)}},[d]);var m=(0,FF.useCallback)(()=>{d||f(!1)},[d]),g=d&&h,v=d||u;t=d?!0===r?n:r:n;var x=FF.createElement(F2,VN({},i,{name:String(i.name)},a,{isActive:g,option:t,index:o,dataKey:l,onTransitionEnd:m}));return v?FF.createElement(ND,{zIndex:CE.activeBar},FF.createElement(Vw,{index:a.originalDataIndex},x)):x}function VI(e){var{shape:t,baseProps:n,entry:r,index:i,dataKey:a}=e;return FF.createElement(F2,VN({},n,{name:String(n.name)},r,{isActive:!1,option:t,index:i,dataKey:a}))}function VD(e){var t,{data:n,props:r}=e,i=null!=(t=wv(r))?t:{},{id:a}=i,o=VO(i,VS),{shape:l,dataKey:s,activeBar:c}=r,{onMouseEnter:d,onClick:u,onMouseLeave:f}=r,h=VO(r,VC),p=F4(d,s,a),m=F3(f),g=F6(u,s,a);return n?FF.createElement(FF.Fragment,null,n.map((e,t)=>FF.createElement(Vw,VN({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"},b4(h,e,t),{onMouseEnter:p(e,t),onMouseLeave:m(e,t),onClick:g(e,t)}),c?FF.createElement(V_,{shape:l,activeBar:c,baseProps:o,entry:e,index:t,dataKey:s}):FF.createElement(VI,{shape:l,baseProps:o,entry:e,index:t,dataKey:s})))):null}function VT(e){var{props:t,previousRectanglesRef:n}=e,{data:r,layout:i,isAnimationActive:a,animationBegin:o,animationDuration:l,animationEasing:s,onAnimationEnd:c,onAnimationStart:d}=t,u=n.current,f=Dn(t,"recharts-bar-"),[h,p]=(0,FF.useState)(!1),m=(0,FF.useCallback)(()=>{"function"==typeof c&&c(),p(!1)},[c]),g=(0,FF.useCallback)(()=>{"function"==typeof d&&d(),p(!0)},[d]);return FF.createElement(Vz,{showLabels:!h,rects:r},FF.createElement(DR,{animationId:f,begin:o,duration:l,isActive:a,easing:s,onAnimationEnd:m,onAnimationStart:g,key:f},e=>{var a=1===e?r:null==r?void 0:r.map((t,n)=>{var r=u&&u[n];if(r)return VE(VE({},t),{},{x:wl(r.x,t.x,e),y:wl(r.y,t.y,e),width:wl(r.width,t.width,e),height:wl(r.height,t.height,e)});if("horizontal"===i){var a=wl(0,t.height,e),o=wl(t.stackedBarStart,t.y,e);return VE(VE({},t),{},{y:o,height:a})}var l=wl(0,t.width,e),s=wl(t.stackedBarStart,t.x,e);return VE(VE({},t),{},{width:l,x:s})});return(e>0&&(n.current=null!=a?a:null),null==a)?null:FF.createElement(SJ,null,FF.createElement(VD,{props:t,data:a}))}),FF.createElement(N9,{label:t.label}),t.children)}function VR(e){var t=(0,FF.useRef)(null);return FF.createElement(VT,{previousRectanglesRef:t,props:e})}var VL=(e,t)=>{var n=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:n,errorVal:kG(e,t)}};class V$ extends FF.PureComponent{render(){var{hide:e,data:t,dataKey:n,className:r,xAxisId:i,yAxisId:a,needClip:o,background:l,id:s}=this.props;if(e||null==t)return null;var c=eH("recharts-bar",r);return FF.createElement(SJ,{className:c,id:s},o&&FF.createElement("defs",null,FF.createElement(IP,{clipPathId:s,xAxisId:i,yAxisId:a})),FF.createElement(SJ,{className:"recharts-bar-rectangles",clipPath:o?"url(#clipPath-".concat(s,")"):void 0},FF.createElement(VA,{data:t,dataKey:n,background:l,allOtherBarProps:this.props}),FF.createElement(VR,this.props)))}}var VF={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:CE.bar};function VV(e){var t,{xAxisId:n,yAxisId:r,hide:i,legendType:a,minPointSize:o,activeBar:l,animationBegin:s,animationDuration:c,animationEasing:d,isAnimationActive:u}=e,{needClip:f}=IO(n,r),h=wC(ST),p=Su(),m=Ml(e.children,FV),g=wC(t=>Vu(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,FF.createElement(F9,{xAxisId:n,yAxisId:r,data:g,dataPointFormatter:VL,errorBarOffset:t},FF.createElement(V$,VN({},e,{layout:h,needClip:f,data:g,xAxisId:n,yAxisId:r,hide:i,legendType:a,minPointSize:o,activeBar:l,animationBegin:s,animationDuration:c,animationEasing:d,isAnimationActive:u})))}var VB=FF.memo(function(e){var t,n,r=Cs(e,VF),i=(t=r.stackId,null!=(n=(0,ew.useContext)(Vy))?n.stackId:null!=t?kQ(t):void 0),a=Su();return FF.createElement(Da,{id:r.id,type:"bar"},e=>FF.createElement(FF.Fragment,null,FF.createElement(De,{legendPayload:(e=>{var{dataKey:t,name:n,fill:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:k6(n,t),payload:e}]})(r)}),FF.createElement(VP,{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}),FF.createElement(Dp,{type:"bar",id:e,data:void 0,xAxisId:r.xAxisId,yAxisId:r.yAxisId,zAxisId:0,dataKey:r.dataKey,stackId:i,hide:r.hide,barSize:r.barSize,minPointSize:r.minPointSize,maxBarSize:r.maxBarSize,isPanorama:a,hasCustomShape:null!=r.shape}),FF.createElement(ND,{zIndex:r.zIndex},FF.createElement(VV,VN({},r,{id:e})))))},DZ);VB.displayName="Bar";var VH=["axis","item"],VW=(0,ew.forwardRef)((e,t)=>ew.createElement(Lt,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:VH,tooltipPayloadSearcher:Ts,categoricalChartProps:e,ref:t}));function Vq({x:e,y:t,width:n,height:r,radius:i}){let a=Array.isArray(i)?i[0]:i??5;return n<=0||r<=0?null:(0,eb.jsx)("foreignObject",{x:e,y:t,width:n,height:r,className:"vtl-run-mix-bar-shape",children:(0,eb.jsx)("div",{className:"vtl-run-mix-bar",style:{borderRadius:`${a}px`}})})}function VU({title:e=ez.runMix}){return(0,eb.jsx)(fe,{title:e,icon:(0,eb.jsx)(mR,{}),className:"size-full",jellyImage:"/themes/jelly/card2.png",jellyImagePosition:"62% center",jellyImageOpacity:.88,jellyImageBlur:"5px",children:(0,eb.jsx)(Fb,{config:fc,className:"h-full min-h-0 w-full",children:(0,eb.jsxs)(VW,{data:fs,children:[(0,eb.jsx)(L$,{vertical:!1}),(0,eb.jsx)(L1,{dataKey:"type",tickLine:!1,axisLine:!1,tickMargin:8}),(0,eb.jsx)(Fj,{content:(0,eb.jsx)(Fk,{})}),(0,eb.jsx)(VB,{dataKey:"count",fill:"var(--color-count)",radius:5,shape:e=>(0,eb.jsx)(Vq,{...e})})]})})})}let VK=eN("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"}]]),VG=eN("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"}]]);function VY({className:e,orientation:t="horizontal",...n}){return(0,eb.jsx)("div",{role:"separator","aria-orientation":t,"data-slot":"separator","data-orientation":t,className:tK("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 VX({title:e=ez.schedule}){return(0,eb.jsxs)("div",{className:"grid size-full min-h-0 gap-3",children:[(0,eb.jsx)(fe,{title:e,icon:(0,eb.jsx)(VG,{}),className:"min-h-0",children:(0,eb.jsx)("div",{className:"grid gap-2",children:fd.map(e=>(0,eb.jsxs)("div",{className:"grid grid-cols-[3.5rem_1fr] gap-3 rounded-lg border bg-muted/15 p-2.5",children:[(0,eb.jsx)("span",{className:"ui-text-control font-medium tabular-nums",children:e.time}),(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("p",{className:"truncate ui-text-control font-medium",children:e.title}),(0,eb.jsx)("p",{className:"mt-0.5 truncate ui-text-kbd text-muted-foreground",children:e.meta})]})]},e.time))})}),(0,eb.jsx)(fe,{title:ez.incidents,icon:(0,eb.jsx)(VK,{}),className:"min-h-0",children:(0,eb.jsxs)("div",{className:"grid gap-3",children:[(0,eb.jsxs)("div",{className:"flex items-center justify-center gap-4",children:[(0,eb.jsx)(m_,{value:76,label:"health",className:"size-24"}),(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsx)(mz,{value:82,label:"SLA",mode:"split",size:"sm"}),(0,eb.jsx)(mz,{value:61,label:"队列",mode:"split",size:"sm"})]})]}),(0,eb.jsx)(VY,{}),fu.map(e=>(0,eb.jsx)("div",{className:tK("rounded-lg border p-2.5 ui-text-control","warning"===e.tone?"border-destructive/25 bg-destructive/5 text-destructive":"bg-muted/15"),children:e.title},e.title))]})})]})}function VZ({label:e,description:t,value:n}){return(0,eb.jsxs)("div",{className:"relative h-full min-h-0",children:[(0,eb.jsxs)("div",{children:[(0,eb.jsx)("div",{className:"text-xl font-semibold tracking-normal",children:e}),(0,eb.jsx)("div",{className:"mt-1 text-sm leading-5 text-muted-foreground",children:t})]}),(0,eb.jsx)(mC,{value:mN(n),minSize:48,maxSize:220,className:"absolute right-0 bottom-0 h-2/3 w-full"})]})}function VJ({machines:e}){return(0,eb.jsx)("div",{className:"mt-2 grid min-h-0 flex-1 content-start overflow-hidden",children:e.map((e,t)=>(0,eb.jsxs)("div",{className:tK("grid min-h-14 grid-cols-[minmax(0,1.1fr)_7rem_7rem_13rem] items-center gap-4 px-2 py-1.5",t>0&&"border-t"),children:[(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsxs)("div",{className:"flex items-center gap-2",children:[(0,eb.jsx)(VQ,{state:e.state}),(0,eb.jsx)("span",{className:"truncate text-sm font-medium",children:e.name})]}),(0,eb.jsxs)("div",{className:"mt-1 truncate ui-text-kbd text-muted-foreground",children:[e.os," · ",e.version]})]}),(0,eb.jsxs)("div",{className:"grid gap-0.5",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"Role"}),(0,eb.jsx)("span",{className:"truncate text-sm",children:e.role})]}),(0,eb.jsxs)("div",{className:"grid gap-0.5",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"Agent"}),(0,eb.jsx)("span",{className:"truncate text-sm tabular-nums",children:e.agent})]}),(0,eb.jsx)(V0,{tags:e.tags})]},e.id))})}function VQ({state:e}){return(0,eb.jsx)("span",{className:tK("size-2 rounded-full bg-border","online"===e&&"bg-primary","warning"===e&&"bg-muted-foreground","sleeping"===e&&"bg-border","offline"===e&&"bg-destructive")})}function V0({tags:e}){return(0,eb.jsx)("div",{className:"flex min-w-0 flex-wrap gap-1",children:e.map(e=>(0,eb.jsx)("span",{className:"rounded-md bg-muted px-1.5 py-0.5 ui-text-kbd text-muted-foreground",children:e},e))})}var V1=ew,V2=(e,t,n,r)=>zX(e,"xAxis",t,r),V5=(e,t,n,r)=>zY(e,"xAxis",t,r),V4=(e,t,n,r)=>zX(e,"yAxis",n,r),V3=(e,t,n,r)=>zY(e,"yAxis",n,r),V6=j$([ST,V2,V4,V5,V3],(e,t,n,r,i)=>kY(e,"xAxis")?k4(t,r,!1):k4(n,i,!1));function V8(e){return"line"===e.type}var V7=j$([Aj,(e,t,n,r,i)=>i],(e,t)=>e.filter(V8).find(e=>e.id===t)),V9=j$([ST,V2,V4,V5,V3,V7,V6,Mx],(e,t,n,r,i,a,o,l)=>{var s,{chartData:c,dataStartIndex:d,dataEndIndex:u}=l;if(null!=a&&null!=t&&null!=n&&null!=r&&null!=i&&0!==r.length&&0!==i.length&&null!=o&&("horizontal"===e||"vertical"===e)){var{dataKey:f,data:h}=a;if(null!=(s=null!=h&&h.length>0?h:null==c?void 0:c.slice(d,u+1)))return function(e){var{layout:t,xAxis:n,yAxis:r,xAxisTicks:i,yAxisTicks:a,dataKey:o,bandSize:l,displayedData:s}=e;return s.map((e,s)=>{var c=kG(e,o);if("horizontal"===t){var d=k0({axis:n,ticks:i,bandSize:l,entry:e,index:s}),u=null==c?null:r.scale.map(c);return{x:d,y:null!=u?u:null,value:c,payload:e}}var f=null==c?null:n.scale.map(c),h=k0({axis:r,ticks:a,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:i,dataKey:f,bandSize:o,displayedData:s})}}),Be=["id"],Bt=["type","layout","connectNulls","needClip","shape"],Bn=["activeDot","animateNewValues","animationBegin","animationDuration","animationEasing","connectNulls","dot","hide","isAnimationActive","label","legendType","xAxisId","yAxisId","id"];function Br(){return(Br=Object.assign.bind()).apply(null,arguments)}function Bi(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 Ba(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Bi(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Bi(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Bo(e,t){if(null==e)return{};var n,r,i=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 a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var Bl=V1.memo(e=>{var{dataKey:t,data:n,stroke:r,strokeWidth:i,fill:a,name:o,hide:l,unit:s,tooltipType:c,id:d}=e,u={dataDefinedOnItem:n,getPosition:wu,settings:{stroke:r,strokeWidth:i,fill:a,dataKey:t,nameKey:void 0,name:k6(o,t),hide:l,type:c,color:r,unit:s,graphicalItemId:d}};return V1.createElement(IE,{tooltipEntrySettings:u})}),Bs=(e,t)=>"".concat(t,"px ").concat(e,"px");function Bc(e){var{clipPathId:t,points:n,props:r}=e,{dot:i,dataKey:a,needClip:o}=r,{id:l}=r,s=wv(Bo(r,Be));return V1.createElement(Mp,{points:n,dot:i,className:"recharts-line-dots",dotClassName:"recharts-line-dot",dataKey:a,baseProps:s,needClip:o,clipPathId:t})}function Bd(e){var{showLabels:t,children:n,points:r}=e,i=(0,V1.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 Ba(Ba({},r),{},{value:e.value,payload:e.payload,viewBox:r,parentViewBox:void 0,fill:void 0})}),[r]);return V1.createElement(N3,{value:t?i:void 0},n)}function Bu(e){var{clipPathId:t,pathRef:n,points:r,strokeDasharray:i,props:a}=e,{type:o,layout:l,connectNulls:s,needClip:c,shape:d}=a,u=Ba(Ba({},SY(Bo(a,Bt))),{},{fill:"none",className:"recharts-line-curve",clipPath:c?"url(#clipPath-".concat(t,")"):void 0,points:r,type:o,layout:l,connectNulls:s,strokeDasharray:null!=i?i:a.strokeDasharray});return V1.createElement(V1.Fragment,null,(null==r?void 0:r.length)>1&&V1.createElement(F0,Br({shapeType:"curve",option:d},u,{pathRef:n})),V1.createElement(Bc,{points:r,clipPathId:t,props:a}))}function Bf(e){var{clipPathId:t,props:n,pathRef:r,previousPointsRef:i,longestAnimatedLengthRef:a}=e,{points:o,strokeDasharray:l,isAnimationActive:s,animationBegin:c,animationDuration:d,animationEasing:u,animateNewValues:f,width:h,height:p,onAnimationEnd:m,onAnimationStart:g}=n,v=i.current,x=Dn(o,"recharts-line-"),y=(0,V1.useRef)(x),[b,w]=(0,V1.useState)(!1),j=(0,V1.useCallback)(()=>{"function"==typeof m&&m(),w(!1)},[m]),k=(0,V1.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,V1.useRef)(0);y.current!==x&&(C.current=a.current,y.current=x);var N=C.current;return V1.createElement(Bd,{points:o,showLabels:!b},n.children,V1.createElement(DR,{animationId:x,begin:c,duration:d,isActive:s,easing:u,onAnimationEnd:j,onAnimationStart:k,key:x},e=>{var c,d=Math.min(wl(N,S+N,e),S);if(c=s?l?((e,t,n)=>{var r=n.reduce((e,t)=>e+t,0);if(!r)return Bs(t,e);for(var i=Math.floor(e/r),a=e%r,o=[],l=0,s=0;l<n.length;s+=null!=(c=n[l])?c:0,++l){var c,d=n[l];if(null!=d&&s+d>a){o=[...n.slice(0,l),a-s];break}}var u=o.length%2==0?[0,t]:[t];return[...function(e,t){for(var n=e.length%2!=0?[...e,0]:e,r=[],i=0;i<t;++i)r.push(...n);return r}(n,i),...o,...u].map(e=>"".concat(e,"px")).join(", ")})(d,S,"".concat(l).split(/[,\s]+/gim).map(e=>parseFloat(e))):Bs(S,d):null==l?void 0:String(l),e>0&&S>0&&(i.current=o,a.current=Math.max(a.current,d)),v){var u=v.length/o.length,m=1===e?o:o.map((t,n)=>{var r=Math.floor(n*u);if(v[r]){var i=v[r];return Ba(Ba({},t),{},{x:wl(i.x,t.x,e),y:wl(i.y,t.y,e)})}return f?Ba(Ba({},t),{},{x:wl(2*h,t.x,e),y:wl(p/2,t.y,e)}):Ba(Ba({},t),{},{x:t.x,y:t.y})});return i.current=m,V1.createElement(Bu,{props:n,points:m,clipPathId:t,pathRef:r,strokeDasharray:c})}return V1.createElement(Bu,{props:n,points:o,clipPathId:t,pathRef:r,strokeDasharray:c})}),V1.createElement(N9,{label:n.label}))}function Bh(e){var{clipPathId:t,props:n}=e,r=(0,V1.useRef)(null),i=(0,V1.useRef)(0),a=(0,V1.useRef)(null);return V1.createElement(Bf,{props:n,clipPathId:t,previousPointsRef:r,longestAnimatedLengthRef:i,pathRef:a})}var Bp=(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:kG(e.payload,t)}};class Bm extends V1.Component{render(){var{hide:e,dot:t,points:n,className:r,xAxisId:i,yAxisId:a,top:o,left:l,width:s,height:c,id:d,needClip:u,zIndex:f}=this.props;if(e)return null;var h=eH("recharts-line",r),{r:p,strokeWidth:m}=DL(t),g=Ms(t),v=2*p+m,x=u?"url(#clipPath-".concat(g?"":"dots-").concat(d,")"):void 0;return V1.createElement(ND,{zIndex:f},V1.createElement(SJ,{className:h},u&&V1.createElement("defs",null,V1.createElement(IP,{clipPathId:d,xAxisId:i,yAxisId:a}),!g&&V1.createElement("clipPath",{id:"clipPath-dots-".concat(d)},V1.createElement("rect",{x:l-v/2,y:o-v/2,width:s+v,height:c+v}))),V1.createElement(F9,{xAxisId:i,yAxisId:a,data:n,dataPointFormatter:Bp,errorBarOffset:0},V1.createElement(Bh,{props:this.props,clipPathId:d}))),V1.createElement(IM,{activeDot:this.props.activeDot,points:n,mainColor:this.props.stroke,itemDataKey:this.props.dataKey,clipPath:x}))}}var Bg={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:CE.line,type:"linear"};function Bv(e){var t=Cs(e,Bg),{activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,connectNulls:l,dot:s,hide:c,isAnimationActive:d,label:u,legendType:f,xAxisId:h,yAxisId:p,id:m}=t,g=Bo(t,Bn),{needClip:v}=IO(h,p),x=wC(Ik),y=wC(ST),b=Su(),w=wC(e=>V9(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 V1.createElement(Bm,Br({},g,{id:m,connectNulls:l,dot:s,activeDot:n,animateNewValues:r,animationBegin:i,animationDuration:a,animationEasing:o,isAnimationActive:d,hide:c,label:u,legendType:f,xAxisId:h,yAxisId:p,points:w,layout:y,height:j,width:k,left:S,top:C,needClip:v}))}var Bx=V1.memo(function(e){var t=Cs(e,Bg),n=Su();return V1.createElement(Da,{id:t.id,type:"line"},e=>V1.createElement(V1.Fragment,null,V1.createElement(De,{legendPayload:(e=>{var{dataKey:t,name:n,stroke:r,legendType:i,hide:a}=e;return[{inactive:a,dataKey:t,type:i,color:r,value:k6(n,t),payload:e}]})(t)}),V1.createElement(Bl,{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}),V1.createElement(Dp,{type:"line",id:e,data:t.data,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,hide:t.hide,isPanorama:n}),V1.createElement(Bv,Br({},t,{id:e}))))},DZ);Bx.displayName="Line";var By=["axis"],Bb=(0,ew.forwardRef)((e,t)=>ew.createElement(Lt,{chartName:"LineChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:By,tooltipPayloadSearcher:Ts,categoricalChartProps:e,ref:t}));function Bw({config:e,data:t}){return(0,eb.jsx)(Fb,{config:e,className:"mt-2 min-h-0 flex-1",children:(0,eb.jsxs)(Bb,{data:t,margin:{left:8,right:8},children:[(0,eb.jsx)(L$,{vertical:!1}),(0,eb.jsx)(L1,{dataKey:"time",tickLine:!1,axisLine:!1,tickMargin:8}),(0,eb.jsx)(Fj,{content:(0,eb.jsx)(Fk,{indicator:"line"})}),(0,eb.jsx)(Bx,{type:"monotone",dataKey:"p2p",stroke:"var(--color-p2p)",strokeWidth:2,dot:!1}),(0,eb.jsx)(Bx,{type:"monotone",dataKey:"direct",stroke:"var(--color-direct)",strokeWidth:2,dot:!1}),(0,eb.jsx)(Bx,{type:"monotone",dataKey:"relay",stroke:"var(--color-relay)",strokeWidth:2,dot:!1})]})})}function Bj({candidates:e}){return(0,eb.jsx)("div",{className:"mt-2 grid min-h-0 flex-1 content-start overflow-hidden",children:e.map(([e,t,n,r,i,a],o)=>(0,eb.jsxs)("div",{className:tK("grid grid-cols-[minmax(0,1fr)_4.5rem_7rem_3.5rem_3rem] gap-3 px-2 py-2",o>0&&"border-t"),children:[(0,eb.jsxs)("span",{className:"truncate text-sm",children:[e," / ",t]}),(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:n}),(0,eb.jsx)("span",{className:"truncate ui-text-kbd text-muted-foreground",children:r}),(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:i}),(0,eb.jsx)("span",{className:"text-right ui-text-kbd text-muted-foreground",children:a})]},`${e}-${t}`))})}let Bk={online:"bg-foreground",warning:"bg-muted-foreground",offline:"bg-destructive"},BS={direct:"stroke-foreground",p2p:"stroke-foreground",relay:"stroke-muted-foreground",down:"stroke-destructive"},BC={topologyNode:function({data:e}){return(0,eb.jsxs)("div",{className:"vtl-surface-card min-w-36 rounded-[var(--surface-card-radius)] border px-3 py-2",children:[(0,eb.jsx)(lE,{type:"target",position:T.Top,className:"!size-0 !border-0 !bg-transparent"}),(0,eb.jsx)(lE,{type:"source",position:T.Bottom,className:"!size-0 !border-0 !bg-transparent"}),(0,eb.jsx)(lE,{type:"target",position:T.Left,className:"!size-0 !border-0 !bg-transparent"}),(0,eb.jsx)(lE,{type:"source",position:T.Right,className:"!size-0 !border-0 !bg-transparent"}),(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,eb.jsx)("span",{className:tK("size-2.5 shrink-0 rounded-full",Bk[e.state])}),(0,eb.jsx)("span",{className:"min-w-0 truncate text-sm font-medium",children:e.label})]}),e.meta?(0,eb.jsx)("div",{className:"mt-1 truncate ui-text-kbd text-muted-foreground",children:e.meta}):null]})}},BN={topologyEdge:function({id:e,sourceX:t,sourceY:n,targetX:r,targetY:i,sourcePosition:a,targetPosition:o,data:l}){let[s]=aV({sourcePosition:a,sourceX:t,sourceY:n,targetPosition:o,targetX:r,targetY:i}),{x:c,y:d}=function(e){if("u"<typeof document)return{x:0,y:0};let t=document.createElementNS("http://www.w3.org/2000/svg","path");t.setAttribute("d",e);let n=t.getTotalLength(),r=t.getPointAtLength(n/2);return{x:r.x,y:r.y}}(s),u=l?.kind??"direct";return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(lG,{id:e,path:s,className:tK("fill-none",BS[u],"p2p"===u&&"stroke-dasharray-[8_6]","relay"===u&&"stroke-dasharray-[12_8]"),style:{strokeWidth:"down"===u?3:2.4,strokeLinecap:"round",strokeLinejoin:"round"}}),(l?.label||l?.meta)&&(0,eb.jsx)("foreignObject",{x:c-48,y:d-20,width:96,height:40,className:"overflow-visible",requiredExtensions:"http://www.w3.org/1999/xhtml",children:(0,eb.jsxs)("div",{className:"pointer-events-none grid h-10 w-24 content-center rounded-md border bg-background/95 px-2 py-1 text-center shadow-sm",children:[l.label?(0,eb.jsx)("div",{className:"truncate text-xs font-medium leading-4",children:l.label}):null,l.meta?(0,eb.jsx)("div",{className:"truncate ui-text-kbd text-muted-foreground",children:l.meta}):null]})})]})}};function BM({nodes:e,links:t,className:n,...r}){let i=ew.useMemo(()=>e.map(e=>({id:e.id,data:{label:e.label,meta:e.meta,state:e.state??"online"},position:{x:e.x/100*1e3,y:e.y/100*560},type:"topologyNode"})),[e]),a=ew.useMemo(()=>t.map(e=>({id:e.id,data:{kind:e.kind??"direct",label:e.label,meta:e.meta},source:e.from,target:e.to,type:"topologyEdge"})),[t]);return(0,eb.jsx)("div",{"data-slot":"topology-map",className:tK("h-full min-h-0 overflow-hidden rounded-xl bg-muted/25",n),...r,children:(0,eb.jsx)(sk,{children:(0,eb.jsx)(sN,{nodes:i,edges:a,nodeTypes:BC,edgeTypes:BN,fitView:!0,fitViewOptions:{maxZoom:1.15,minZoom:.45,padding:.22},minZoom:.35,maxZoom:1.5,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,panOnDrag:!1,zoomOnScroll:!1,zoomOnDoubleClick:!1,preventScrolling:!1,proOptions:{hideAttribution:!0},className:"topology-flow text-foreground",children:(0,eb.jsx)(sI,{gap:28,size:1,color:"var(--border)",className:"opacity-80"})})})})}function BE({nodes:e,links:t}){return(0,eb.jsx)(BM,{nodes:e,links:t})}function BO({title:e,count:t}){return(0,eb.jsxs)("div",{className:"flex h-7 shrink-0 items-center justify-between",children:[(0,eb.jsx)("h2",{className:"text-sm font-semibold tracking-normal",children:e}),(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:t})]})}function BP({items:e}){return(0,eb.jsx)("div",{className:"mt-2 grid",children:e.map((e,t)=>(0,eb.jsxs)("div",{className:tK("px-2 py-2",t>0&&"border-t"),children:[(0,eb.jsx)("div",{className:"truncate text-sm font-medium",children:e.title}),(0,eb.jsx)("div",{className:tK("mt-1 truncate ui-text-kbd text-muted-foreground","warning"===e.tone&&"text-destructive"),children:e.meta})]},e.id))})}function BA({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,eb.jsxs)("div",{className:"grid w-full grid-cols-[3.25rem_8rem_minmax(0,1fr)_4rem] items-center gap-3",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:e}),(0,eb.jsx)("span",{className:"truncate ui-text-kbd text-muted-foreground",children:t}),(0,eb.jsx)("span",{className:"truncate",children:n}),(0,eb.jsx)("span",{className:"text-right ui-text-kbd text-muted-foreground",children:r})]})})),[e]);return(0,eb.jsx)(mT,{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 Bz({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,eb.jsx)(B_,{item:e})}}),[e]);return(0,eb.jsx)(mT,{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 B_({item:e}){return(0,eb.jsxs)("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_7.5rem_5rem] items-center gap-3",children:[(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("div",{className:"truncate text-sm font-medium",children:e.title}),(0,eb.jsxs)("div",{className:"mt-1 truncate ui-text-kbd text-muted-foreground",children:[e.machine," · ",e.agent," · ",e.started]})]}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)(mA,{value:e.progress,className:"h-1.5"}),(0,eb.jsx)("div",{className:"ui-text-kbd text-muted-foreground",children:e.runtime})]}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)(mA,{value:e.load,className:"h-1.5"}),(0,eb.jsx)("div",{className:"text-right ui-text-kbd text-muted-foreground",children:"load"})]})]})}function BI({workers:e}){return(0,eb.jsx)("div",{className:"mt-2 grid min-h-0 flex-1 content-start overflow-hidden",children:e.map((e,t)=>(0,eb.jsx)(BD,{worker:e,divided:t>0},e.id))})}function BD({worker:e,divided:t}){return(0,eb.jsxs)("div",{className:tK("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,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("div",{className:"truncate text-lg font-semibold tracking-normal",children:e.machine}),(0,eb.jsx)("div",{className:"mt-0.5 truncate ui-text-kbd text-muted-foreground",children:e.role})]}),(0,eb.jsxs)("div",{className:"text-right text-sm font-medium tabular-nums",children:[e.active,"/",e.capacity]}),(0,eb.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,eb.jsx)(BT,{label:"CPU",value:e.cpu}),(0,eb.jsx)(BT,{label:"MEM",value:e.memory})]})]})}function BT({label:e,value:t}){return(0,eb.jsxs)("div",{className:"grid justify-items-center gap-1",children:[(0,eb.jsx)(m_,{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,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:e})]})}function BR({events:e}){let t=ew.useMemo(()=>e.map(([e,t],n)=>({id:`${e}-${t}`,status:0===n?"current":"done",title:(0,eb.jsxs)("div",{className:"grid w-full grid-cols-[3.25rem_minmax(0,1fr)] items-center gap-2",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:e}),(0,eb.jsx)("span",{className:"truncate",children:t})]})})),[e]);return(0,eb.jsx)(mT,{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 BL({machines:e}){return(0,eb.jsx)("div",{className:"mt-2 grid min-h-0 flex-1 content-start overflow-hidden",children:e.map((e,t)=>(0,eb.jsx)(B$,{machine:e,divided:t>0},e.id))})}function B$({machine:e,divided:t}){return(0,eb.jsxs)("div",{className:tK("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,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsxs)("div",{className:"flex items-center gap-2",children:[(0,eb.jsx)(BV,{status:e.status}),(0,eb.jsx)("span",{className:"truncate text-sm font-medium",children:e.name})]}),(0,eb.jsxs)("div",{className:"mt-1 truncate ui-text-kbd text-muted-foreground",children:[e.os," · ",e.link," · heartbeat ",e.heartbeat]})]}),(0,eb.jsxs)("div",{className:"grid gap-2 sm:grid-cols-4",children:[(0,eb.jsx)(BF,{icon:(0,eb.jsx)(FP,{}),label:"CPU",value:e.cpu}),(0,eb.jsx)(BF,{icon:(0,eb.jsx)(Fz,{}),label:"MEM",value:e.memory}),(0,eb.jsx)(BF,{icon:(0,eb.jsx)(FA,{}),label:"DISK",value:e.disk}),(0,eb.jsx)(BF,{icon:(0,eb.jsx)(FI,{}),label:"NET",value:e.network})]})]})}function BF({icon:e,label:t,value:n}){return(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsxs)("div",{className:"flex justify-between gap-1 ui-text-kbd text-muted-foreground",children:[(0,eb.jsxs)("span",{className:"flex items-center gap-1 [&_svg]:size-3",children:[e,t]}),(0,eb.jsxs)("span",{children:[n,"%"]})]}),(0,eb.jsx)(mA,{value:n,className:"h-1.5"})]})}function BV({status:e}){return(0,eb.jsx)("span",{className:tK("size-2 rounded-full bg-border","online"===e&&"bg-primary")})}function BB({links:e}){let t=ew.useMemo(()=>e.map(([e,t,n,r,i])=>({id:`${e}-${t}`,status:"Relay fallback"===n?"blocked":"current",title:(0,eb.jsxs)("div",{className:"grid w-full grid-cols-[minmax(0,1fr)_5rem_4rem_3.5rem] items-center gap-3",children:[(0,eb.jsxs)("span",{className:"truncate",children:[e," / ",t]}),(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:n}),(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:r}),(0,eb.jsx)("span",{className:"text-right ui-text-kbd text-muted-foreground",children:i})]})})),[e]);return(0,eb.jsx)(mT,{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 BH({config:e,data:t}){return(0,eb.jsx)(Fb,{config:e,className:"mt-2 min-h-0 flex-1",children:(0,eb.jsxs)(Lr,{data:t,margin:{left:8,right:8},children:[(0,eb.jsx)(L$,{vertical:!1}),(0,eb.jsx)(L1,{dataKey:"time",tickLine:!1,axisLine:!1,tickMargin:8}),(0,eb.jsx)(Fj,{content:(0,eb.jsx)(Fk,{indicator:"line"})}),(0,eb.jsx)(Tl,{dataKey:"cpu",type:"monotone",fill:"var(--color-cpu)",fillOpacity:.11,stroke:"var(--color-cpu)",strokeWidth:2}),(0,eb.jsx)(Tl,{dataKey:"memory",type:"monotone",fill:"var(--color-memory)",fillOpacity:.1,stroke:"var(--color-memory)",strokeWidth:2}),(0,eb.jsx)(Tl,{dataKey:"network",type:"monotone",fill:"var(--color-network)",fillOpacity:.08,stroke:"var(--color-network)",strokeWidth:2})]})})}function BW({services:e}){let[t,n]=f3(),r=Math.max(1,Math.floor((Math.max(0,n.width-192-64-32)+5)/12)),i=Math.max(48,n.height>0?Math.floor((n.height-0*Math.max(0,e.length-1))/e.length):48),a=Math.max(28,i-22);return(0,eb.jsx)("div",{ref:t,className:"mt-2 min-h-0 flex-1",children:e.map((e,t)=>(0,eb.jsx)(Bq,{service:e,divided:t>0,rowHeight:i,sampleCount:r,sampleHeight:a},e.id))})}function Bq({service:e,divided:t,rowHeight:n,sampleCount:r,sampleHeight:i}){let a=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,eb.jsxs)("div",{className:tK("grid grid-cols-[12rem_minmax(0,1fr)_4rem] items-center gap-4 px-2",t&&"border-t"),style:{height:n},children:[(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("div",{className:"truncate text-sm font-medium",children:e.name}),(0,eb.jsx)("div",{className:tK("mt-0.5 truncate ui-text-kbd text-muted-foreground","告警"===e.state&&"text-destructive"),children:e.state})]}),(0,eb.jsx)("div",{"aria-label":`${e.name} 30 minute stability samples`,className:"flex min-w-0 items-center overflow-hidden",style:{gap:5},children:a.map((t,n)=>{var r;return(0,eb.jsx)("span",{className:tK("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:i},title:`${t}%`},`${e.id}-${n}`)})}),(0,eb.jsxs)("div",{className:"text-right text-sm font-medium tabular-nums",children:[e.samples.at(-1),"%"]})]})}let BU=eN("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]),BK=eN("message-square",[["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"}]]),BG=eN("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]),BY=eN("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]),BX=[{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 BZ(e,t,n,r,i,a,o){return{id:e,title:t,status:"idle",purpose:n,nodes:r,agents:0,progress:100,health:90,runtime:i,tokenUsage:a,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:[]}}}BX.push(BZ("canvas-terminal-layout","终端工作台草图","记录终端标签组、日志表和命令区的组合方式。",7,"36m",84e3,"昨天 15:21"),BZ("canvas-file-review","文件审阅流程","沉淀文件树、diff 预览和文件标签之间的拖拽关系。",12,"58m",126e3,"周五 20:10"),BZ("canvas-settings-ia","设置导航结构","整理设置菜单面板的主菜单、子菜单和搜索入口。",8,"24m",61e3,"周五 16:42"),BZ("canvas-auth-access","本机账户接入","记录本机用户、工作组加入和可用机器列表关系。",10,"47m",112e3,"周四 22:05"),BZ("canvas-data-ops","运维数据面板","对齐数据表标签、机器状态卡片和运行记录列表。",14,"1h 18m",172e3,"周三 19:48"));let BJ=BX.filter(e=>"idle"!==e.status),BQ=BX.filter(e=>"idle"===e.status);function B0(e,t,n=""){return{title:e,dataSource:t,refreshRate:"30s",note:n}}function B1(e,t){return(0,eb.jsx)("section",{className:tK("size-full rounded-xl border bg-card p-5","vtl-jelly-image-card vtl-jelly-image-card-shadowless"),style:u9({image:t,opacity:.88,blur:"0px"}),children:e})}function B2({onSelect:e}){return[{id:"metric-active",title:"活跃画布",description:"当前正在编辑的画布数量。",icon:(0,eb.jsx)(BY,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:B0("活跃画布","画布列表"),render:e=>B1((0,eb.jsx)(VZ,{label:e.title,description:"当前正在编辑的画布数量",value:String(BJ.length)}),u4)},{id:"metric-nodes",title:"运行节点",description:"所有活跃画布内的节点。",icon:(0,eb.jsx)(FN,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:B0("运行节点","画布节点"),render:e=>B1((0,eb.jsx)(VZ,{label:e.title,description:"所有活跃画布内的节点",value:"38"}),u3)},{id:"metric-unsaved",title:"未保存",description:"等待写入的画布变更。",icon:(0,eb.jsx)(BG,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:B0("未保存","画布保存状态"),render:e=>B1((0,eb.jsx)(VZ,{label:e.title,description:"等待写入的画布变更",value:"4"}),u6)},{id:"metric-snapshots",title:"快照",description:"可回退的历史存档。",icon:(0,eb.jsx)(BU,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:B0("快照","画布快照"),render:e=>B1((0,eb.jsx)(VZ,{label:e.title,description:"可回退的历史存档",value:"46"}),u8)},{id:"active",title:"正在使用的画布",description:"活跃画布 Roadmap。",icon:(0,eb.jsx)(BY,{className:"size-4"}),defaultSize:{w:12,h:3},defaultConfig:B0("正在使用的画布","画布列表"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(BO,{title:t.title,count:BJ.length}),(0,eb.jsx)(FM,{canvases:BJ,scrollable:!0,onSelect:e})]})},{id:"recent",title:"最近画布",description:"最近打开的画布。",icon:(0,eb.jsx)(mL,{className:"size-4"}),defaultSize:{w:12,h:Math.max(3,Math.ceil(.75*BQ.length)+1)},defaultConfig:B0("最近画布","画布列表"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col",children:[(0,eb.jsx)(BO,{title:t.title,count:BQ.length}),(0,eb.jsx)(FM,{canvases:BQ,mode:"archive",onSelect:e})]})}]}let B5=[{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*BQ.length)+1)}];function B4({onSelect:e,conversations:t=mJ}){let n=t.filter(e=>"idle"!==e.status),r=t.filter(e=>"idle"===e.status).sort((e,t)=>e.lastOpened.localeCompare(t.lastOpened)),i=n.length>0?Math.round(n.reduce((e,t)=>e+t.progress,0)/n.length):0,a=t.reduce((e,t)=>e+t.tokens,0);return[{id:"metric-working",title:"工作中",description:"当前正在运行的对话。",icon:(0,eb.jsx)(BK,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:B0("工作中","Agent 对话"),render:e=>B1((0,eb.jsx)(VZ,{label:e.title,description:"当前正在运行的对话",value:String(n.length)}),u4)},{id:"metric-progress",title:"平均完成",description:"活跃目标的完成度。",icon:(0,eb.jsx)(BY,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:B0("平均完成","Agent 对话"),render:e=>B1((0,eb.jsx)(VZ,{label:e.title,description:"活跃目标的完成度",value:`${i}%`}),u3)},{id:"metric-tokens",title:"今日 Tokens",description:"本日累计上下文消耗。",icon:(0,eb.jsx)(BG,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:B0("今日 Tokens","Agent 对话"),render:e=>{var t;return B1((0,eb.jsx)(VZ,{label:e.title,description:"本日累计上下文消耗",value:(t=a)>=1e6?`${(t/1e6).toFixed(2)}M`:t>=1e3?`${Math.round(t/1e3)}K`:String(t)}),u6)}},{id:"metric-handoff",title:"需确认",description:"等待人工接手的事项。",icon:(0,eb.jsx)(mO,{className:"size-4"}),defaultSize:{w:3,h:3},defaultConfig:B0("需确认","Agent 对话"),render:e=>B1((0,eb.jsx)(VZ,{label:e.title,description:"等待人工接手的事项",value:"3"}),u8)},{id:"working",title:"正在工作的 Agent 对话",description:"活跃 Agent 对话 Roadmap。",icon:(0,eb.jsx)(BK,{className:"size-4"}),defaultSize:{w:12,h:3},defaultConfig:B0("正在工作的 Agent 对话","Agent 对话"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(BO,{title:t.title,count:n.length}),(0,eb.jsx)(bx,{conversations:n,scrollable:!0,onSelect:e})]})},{id:"idle",title:"未在工作的 Agent 对话",description:"未运行 Agent 对话列表。",icon:(0,eb.jsx)(BK,{className:"size-4"}),defaultSize:{w:12,h:Math.max(3,Math.ceil(.75*m0.length)+1)},defaultConfig:B0("未在工作的 Agent 对话","Agent 对话"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col",children:[(0,eb.jsx)(BO,{title:t.title,count:r.length}),(0,eb.jsx)(bx,{conversations:r,mode:"archive",onSelect:e})]})}]}let B3=[{id:"metric-working",kind:"metric-working",x:0,y:0,w:3,h:3},{id:"metric-progress",kind:"metric-progress",x:3,y:0,w:3,h:3},{id:"metric-tokens",kind:"metric-tokens",x:6,y:0,w:3,h:3},{id:"metric-handoff",kind:"metric-handoff",x:9,y:0,w:3,h:3},{id:"working",kind:"working",x:0,y:3,w:12,h:3},{id:"idle",kind:"idle",x:0,y:6,w:12,h:Math.max(3,Math.ceil(.75*m0.length)+1)}],B6={subagents:[],mainModels:[],folders:[],blockedCommands:[],allowedTools:["vantaloom_read","shell","apply_patch"],deniedTools:[],plugins:[],hosts:["local"]};async function B8(){return(await Hs("/api/local/agent/conversations")).conversations.map(Hl)}async function B7(){let e=await Hs("/api/local/agent/conversations/recent",void 0,{allowNotFound:!0});return e?Ho(e):void 0}async function B9(e){return Ho(await Hs(`/api/local/agent/conversations/${encodeURIComponent(e)}`))}async function He(e){return Ho(await Hs(`/api/local/agent/conversations/${encodeURIComponent(e)}/open`,{method:"POST"}))}async function Ht(e){return Ho(await Hs("/api/local/agent/conversations",{method:"POST",body:JSON.stringify(e)}))}async function Hn(e,t){return Ho(await Hs(`/api/local/agent/conversations/${encodeURIComponent(e)}`,{method:"PATCH",body:JSON.stringify(t)}))}async function Hr(e){await Hs(`/api/local/agent/conversations/${encodeURIComponent(e)}`,{method:"DELETE"})}async function Hi(e,t){return Ho(await Hs(`/api/local/agent/conversations/${encodeURIComponent(e)}/panes`,{method:"PUT",body:JSON.stringify(t)}))}async function Ha(e,t){return Ho(await Hs(`/api/local/agent/conversations/${encodeURIComponent(e)}/chat-runs`,{method:"POST",body:JSON.stringify(t)}))}function Ho(e){return{conversation:Hl(e.conversation),events:e.events??[],panes:e.panes??{layoutMode:"quad",agentPosition:"left",panes:[]}}}function Hl(e){let t=e.runtimeSeconds??0,n={...B6,...e.settings};return{id:e.id,title:e.title||"新 Agent 对话",agent:e.agent||"Local Agent",status:e.status??"idle",goal:e.goal||"",progress:e.progress??0,taskProgress:e.taskProgress?.length?e.taskProgress:[e.progress??0,0,0],runtime:function(e){if(e<=0)return"0m";let t=Math.floor(e/3600),n=Math.floor(e%3600/60);return t>0?`${t}h ${n}m`:`${Math.max(1,n)}m`}(t),runtimeSeconds:t,tokens:e.tokens??0,lastOpened:function(e){let t=Date.parse(e);if(!Number.isFinite(t))return"刚刚";let n=Math.max(0,Math.floor((Date.now()-t)/1e3));if(n<60)return"刚刚";let r=Math.floor(n/60);if(r<60)return`${r} 分钟前`;let i=Math.floor(r/60);if(i<24)return`${i} 小时前`;let a=Math.floor(i/24);return 1===a?"昨天":a<7?`${a} 天前`:new Intl.DateTimeFormat("zh-CN",{month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(t)}(e.lastOpenedAt??e.updatedAt??e.createdAt),roadmap:e.roadmap?.length?e.roadmap:[{title:"配置会话环境",state:"done"},{title:"等待首条消息",state:"queued"}],settings:n,createdAt:e.createdAt,updatedAt:e.updatedAt,lastOpenedAt:e.lastOpenedAt,lastSeq:e.lastSeq??0,ownerMachineId:e.ownerMachineId??"local"}}async function Hs(e,t,n){let r=await fetch(gQ(e),{cache:"no-store",...t,headers:{...t?.body?{"Content-Type":"application/json"}:{},...t?.headers}});if(n?.allowNotFound&&404===r.status)return;let i=await r.json().catch(()=>({}));if(!r.ok)throw Error("string"==typeof i?.error?i.error:"agent conversation api failed");return i}function Hc({clipboardItems:e=[],onClipboardItemsChange:t,onOpenConversation:n,onOverlayOpenChange:r}){let[i,a]=ew.useState(),[o,l]=ew.useState(),[s,c]=ew.useState(),[d,u]=ew.useState(mZ),[f,h]=ew.useState(()=>Object.fromEntries(mJ.map(e=>[e.id,e.settings.mainModels]))),[p,m]=ew.useState(()=>Object.fromEntries(mJ.map(e=>[e.id,e.settings.subagents]))),[g,v]=ew.useState(()=>Object.fromEntries(mJ.map(e=>[e.id,{folders:e.settings.folders,blockedCommands:e.settings.blockedCommands,allowedTools:e.settings.allowedTools,deniedTools:e.settings.deniedTools,plugins:e.settings.plugins,hosts:e.settings.hosts}]))),x=o??mJ,y=i&&o?o.find(e=>e.id===i.id)??i:i;function b(e,t){t.trim()&&(l(n=>(n??x).map(n=>n.id===e?{...n,title:t}:n)),a(n=>n?.id===e?{...n,title:t}:n))}async function w(e,t){let n=t.trim();if(n)try{let t=await Hn(e,{title:n});l(n=>(n??x).map(n=>n.id===e?t.conversation:n)),a(n=>n?.id===e?t.conversation:n)}catch{b(e,n)}}async function j(e,t){let n=x.find(t=>t.id===e);if(!n)return;let r=g[e]??{folders:n.settings.folders,blockedCommands:n.settings.blockedCommands,allowedTools:n.settings.allowedTools,deniedTools:n.settings.deniedTools,plugins:n.settings.plugins,hosts:n.settings.hosts},i={subagents:t.subagents??p[e]??n.settings.subagents,mainModels:t.mainModels??f[e]??n.settings.mainModels,folders:t.folders??r.folders,blockedCommands:t.blockedCommands??r.blockedCommands,allowedTools:t.allowedTools??r.allowedTools,deniedTools:t.deniedTools??r.deniedTools,plugins:t.plugins??r.plugins,hosts:t.hosts??r.hosts};try{let t=await Hn(e,{settings:i});l(n=>(n??x).map(n=>n.id===e?t.conversation:n)),a(n=>n?.id===e?t.conversation:n)}catch{return}}async function k(e){if("working"!==e.status&&!s){c(e.id);try{await Hr(e.id),l(t=>(t??x).filter(t=>t.id!==e.id)),a(t=>t?.id===e.id?void 0:t),h(t=>Hd(t,e.id)),m(t=>Hd(t,e.id)),v(t=>Hd(t,e.id))}catch{return}finally{c(void 0)}}}ew.useEffect(()=>{let e=!0;return async function(){try{let t=await B8();e&&l(t)}catch{e&&l(mJ)}}(),()=>{e=!1}},[]),ew.useEffect(()=>{h(e=>({...Object.fromEntries(x.map(e=>[e.id,e.settings.mainModels])),...e})),m(e=>({...Object.fromEntries(x.map(e=>[e.id,e.settings.subagents])),...e})),v(e=>({...Object.fromEntries(x.map(e=>[e.id,{folders:e.settings.folders,blockedCommands:e.settings.blockedCommands,allowedTools:e.settings.allowedTools,deniedTools:e.settings.deniedTools,plugins:e.settings.plugins,hosts:e.settings.hosts}])),...e}))},[x]);let S=ew.useMemo(()=>B4({onSelect:a,conversations:x}),[x]);return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(mk,{boardId:"agent-conversation-library",definitions:S,initialLayouts:B3,clipboardItems:e,actionLabel:"对话库页面卡片操作",paletteGroupTitle:"对话库页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:r}),(0,eb.jsx)(bv,{conversation:y,sharedSubagents:d,mainModels:i?f[i.id]??i.settings.mainModels:[],enabledSubagentIds:i?p[i.id]??i.settings.subagents:[],sessionSettings:i?g[i.id]??{folders:i.settings.folders,blockedCommands:i.settings.blockedCommands,allowedTools:i.settings.allowedTools,deniedTools:i.settings.deniedTools,plugins:i.settings.plugins,hosts:i.settings.hosts}:{folders:[],blockedCommands:[],allowedTools:[],deniedTools:[],plugins:[],hosts:[]},onMainModelsChange:(e,t)=>{h(n=>({...n,[e]:t})),j(e,{mainModels:t})},onSharedSubagentsChange:u,onEnabledSubagentIdsChange:(e,t)=>{m(n=>({...n,[e]:t})),j(e,{subagents:t})},onSessionSettingsChange:(e,t)=>{v(n=>({...n,[e]:t})),j(e,t)},onConversationTitleChange:b,onConversationTitleCommit:(e,t)=>{w(e,t)},deletingConversation:!!i&&s===i.id,onDeleteConversation:e=>{k(e)},onEnterConversation:e=>{a(void 0),n?.(e.id)},onOpenChange:e=>{e||a(void 0)}})]})}function Hd(e,t){let n={...e};return delete n[t],n}let Hu={folders:[],blockedCommands:[],allowedTools:["vantaloom_read","shell","apply_patch"],deniedTools:[],plugins:[],hosts:["local"]};function Hf(){return`新 Agent 对话 ${new Intl.DateTimeFormat("zh-CN",{month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).format(new Date)}`}function Hh({open:e,onOpenChange:t,onCreated:n}){let[r,i]=ew.useState("name"),[a,o]=ew.useState(Hf),[l,s]=ew.useState(mZ),[c,d]=ew.useState([]),[u,f]=ew.useState([]),[h,p]=ew.useState(Hu),[m,g]=ew.useState(!1),[v,x]=ew.useState("");ew.useEffect(()=>{e&&(i("name"),o(Hf()),x(""))},[e]);let y=ew.useMemo(()=>({id:"new-agent-conversation",title:a.trim()||"新 Agent 对话",agent:"Local Agent",status:m?"working":"idle",goal:"",progress:0,taskProgress:[100,0],runtime:"0m",tokens:0,lastOpened:"刚刚",roadmap:[{title:"配置会话环境",state:"done"},{title:"等待首条消息",state:"queued"}],settings:{subagents:u,mainModels:c,...h}}),[a,m,u,c,h]),b=ew.useCallback(async()=>{if(!m){g(!0),x("");try{if(!a.trim()){i("name"),x("请填写会话名称");return}let e=await Ht({title:y.title,agent:y.agent,goal:y.goal,ownerMachineId:"local",settings:y.settings});n(e),t(!1)}catch(e){x(e instanceof Error?e.message:"创建对话失败")}finally{g(!1)}}},[y,a,m,n,t]),w=ew.useMemo(()=>[{id:"name",label:"会话名称",content:(0,eb.jsx)(g3,{title:a,onTitleChange:o})},{id:"agent-models",label:"代理模型配置",icon:(0,eb.jsx)(mE,{}),badge:c.length,content:(0,eb.jsx)(g6,{conversation:y,sharedSubagents:l,mainModels:c,enabledSubagentIds:u,onMainModelsChange:d,onSharedSubagentsChange:s})},{id:"subagent-management",label:"子代理管理",icon:(0,eb.jsx)(mR,{}),badge:l.length,content:(0,eb.jsx)(g8,{conversation:y,sharedSubagents:l,enabledSubagentIds:u,onSharedSubagentsChange:s,onEnabledSubagentIdsChange:f})},{id:"folders",label:"工作区文件夹",icon:(0,eb.jsx)(mL,{}),content:(0,eb.jsx)(bm,{title:"可访问的工作区文件夹",value:h.folders,onValueChange:e=>p(t=>({...t,folders:e}))})},{id:"commands",label:"禁止命令",icon:(0,eb.jsx)(mH,{}),content:(0,eb.jsx)(bu,{sharedSubagents:l,enabledSubagentIds:u,mainBlockedCommands:h.blockedCommands,onMainBlockedCommandsChange:e=>p(t=>({...t,blockedCommands:e})),onSharedSubagentsChange:s})},{id:"tools",label:"工具权限",icon:(0,eb.jsx)(mW,{}),content:(0,eb.jsx)(bf,{sharedSubagents:l,enabledSubagentIds:u,mainAllowedTools:h.allowedTools,mainDeniedTools:h.deniedTools,onMainAllowedToolsChange:e=>p(t=>({...t,allowedTools:e})),onMainDeniedToolsChange:e=>p(t=>({...t,deniedTools:e})),onSharedSubagentsChange:s})},{id:"plugins",label:"插件",icon:(0,eb.jsx)(mB,{}),content:(0,eb.jsx)(bg,{title:"已加载插件",value:h.plugins,options:mY,placeholder:"选择插件",onValueChange:e=>p(t=>({...t,plugins:e}))})},{id:"hosts",label:"可访问主机",icon:(0,eb.jsx)(m$,{}),content:(0,eb.jsx)(bg,{title:"可访问的主机",value:h.hosts,options:[{value:"local",label:"local"},...mX],placeholder:"选择主机",onValueChange:e=>p(t=>({...t,hosts:e}))})},{id:"overview",label:"首页",icon:(0,eb.jsx)(mV,{}),content:(0,eb.jsxs)("div",{className:"grid gap-3",children:[(0,eb.jsx)(ve,{conversation:y,onEnter:()=>{b()}}),v?(0,eb.jsx)("div",{className:"text-sm text-destructive",children:v}):null]})}],[y,a,b,u,v,c,h,l]),j=w.find(e=>e.id===r)??w[0];return(0,eb.jsx)(po,{open:e,onOpenChange:t,children:(0,eb.jsxs)(p7,{hideClose:!0,className:"h-[min(44rem,calc(100svh-2rem))] max-w-5xl gap-0 overflow-hidden p-0",children:[(0,eb.jsx)(me,{className:"sr-only",children:"新建 Agent 对话"}),(0,eb.jsx)(mt,{className:"sr-only",children:"逐步配置新 Agent 对话。"}),(0,eb.jsxs)("div",{className:"grid size-full min-h-0 grid-rows-[auto_minmax(0,1fr)]",children:[(0,eb.jsx)("header",{className:"min-w-0 border-b bg-muted/20 px-5 py-4",children:(0,eb.jsx)("ol",{className:"flex max-w-md items-center","aria-label":"新建 Agent 对话步骤",children:w.map((e,t)=>{let n=j?.id===e.id,r=w.findIndex(e=>e.id===j?.id);return(0,eb.jsxs)("li",{className:"flex min-w-0 items-center",children:[(0,eb.jsx)("button",{type:"button","aria-current":n?"step":void 0,"aria-label":`转到${e.label}`,title:"string"==typeof e.label?e.label:void 0,onClick:()=>i(e.id),className:tK("inline-flex size-8 shrink-0 items-center justify-center rounded-full border ui-text-kbd font-medium transition-colors focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none",n?"border-primary bg-primary text-primary-foreground":t<=r?"border-foreground bg-foreground/10 text-foreground":"border-border bg-background text-muted-foreground hover:bg-muted hover:text-foreground"),children:t+1}),t<w.length-1?(0,eb.jsx)("span",{"aria-hidden":"true",className:tK("h-px w-6 shrink-0 bg-border transition-colors sm:w-8",t<r&&"bg-foreground")}):null]},e.id)})})}),(0,eb.jsx)(f1,{className:"min-h-0 bg-background",children:(0,eb.jsx)("div",{className:"p-5 pr-9",children:j?.content})})]})]})})}let Hp=eN("panel-right",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]),Hm=eN("shredder",[["path",{d:"M4 13V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5",key:"1eob4r"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 22v-5",key:"sfixh4"}],["path",{d:"M14 19v-2",key:"pdve8j"}],["path",{d:"M18 20v-3",key:"uox2gk"}],["path",{d:"M2 13h20",key:"5evz65"}],["path",{d:"M6 20v-3",key:"c6pdcb"}]]),Hg=eN("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]),Hv=eN("clapperboard",[["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z",key:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]]),Hx=eN("shield",[["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"}]]),Hy={blank:function({id:e,selected:t,data:n}){let r="select"===n.mode,i="number"==typeof n.contentScale&&n.contentScale>0?n.contentScale:1,a="string"==typeof n.kind?n.kind:void 0;return(0,eb.jsxs)("div",{"data-slot":"node-canvas-blank-node","data-node-kind":a,"data-selected":t?"":void 0,"data-resizing":n.resizing?"":void 0,style:{background:"var(--node-canvas-node)",borderColor:t||n.resizing?"color-mix(in oklch, var(--foreground) 72%, var(--border))":"var(--node-canvas-node-border)",borderWidth:t||n.resizing?"calc(2px / var(--node-canvas-zoom, 1))":"calc(1px / var(--node-canvas-zoom, 1))"},className:tK("relative box-border h-full w-full rounded-lg border shadow-sm transition-shadow",n.resizing&&"rounded-none",t&&"shadow-md"),onPointerDown:t=>{"connect"===n.mode&&n.onConnectPointerDown?.(e,t)},onClick:t=>{"drag"===n.mode&&(t.stopPropagation(),n.onSelectNode?.(e))},children:[ch.map(e=>(0,eb.jsxs)(ew.Fragment,{children:[(0,eb.jsx)(lE,{id:`source-${e.id}`,type:"source",position:e.position,isConnectable:!1,className:tK("node-canvas-handle",e.className)}),(0,eb.jsx)(lE,{id:`target-${e.id}`,type:"target",position:e.position,isConnectable:!1,className:tK("node-canvas-handle",e.className)})]},e.id)),n.content?(0,eb.jsx)("div",{"data-slot":"node-canvas-node-content","data-node-kind":a,className:tK("nodrag nopan nowheel absolute inset-0 z-0 h-full min-h-0 w-full overflow-hidden rounded-[inherit]",r?"pointer-events-auto":"pointer-events-none select-none"),children:(0,eb.jsx)("div",{"data-slot":"node-canvas-node-content-scale","data-node-kind":a,className:"node-canvas-content-scale min-h-0 origin-top-left",style:{"--node-canvas-content-scale":String(i)},children:n.content})}):null,n.resizing?cf.map(e=>(0,eb.jsx)(sJ,{position:e,variant:R.Handle,minWidth:96,minHeight:64,autoScale:!1,className:"node-canvas-resize-handle"},e)):null]})}},Hb={connection:function({id:e,source:t,sourceX:n,sourceY:r,sourcePosition:i,target:a,targetX:o,targetY:l,targetPosition:s,data:c,style:d}){let{getNode:u,screenToFlowPosition:f}=ld(),h=ew.useId().replace(/:/g,""),p=Math.max(c?.viewportZoom??1,.1),m=9/p,g=u(t),v=u(a),x=c?.bidirectional,y=ew.useMemo(()=>({x:n,y:r}),[n,r]),b=ew.useMemo(()=>({x:o,y:l}),[o,l]),w=cb(y,i,g),j=cb(b,s,v),k=ew.useMemo(()=>c?.anchors??[],[c?.anchors]),S=ew.useMemo(()=>0===k.length?function({sourceNode:e,targetNode:t}){if(!e||!t)return;let n=cx(e),r=cx(t),i=[],a=cy(n.y,n.bottom,r.y,r.bottom),o=cy(n.x,n.right,r.x,r.right);i.push({axis:"x",crossDistance:a.distance,distance:Math.abs(n.right-r.x),seam:(n.right+r.x)/2,midpoint:a.midpoint,sourcePosition:T.Right,targetPosition:T.Left,direction:1}),i.push({axis:"x",crossDistance:a.distance,distance:Math.abs(n.x-r.right),seam:(n.x+r.right)/2,midpoint:a.midpoint,sourcePosition:T.Left,targetPosition:T.Right,direction:-1}),i.push({axis:"y",crossDistance:o.distance,distance:Math.abs(n.bottom-r.y),seam:(n.bottom+r.y)/2,midpoint:o.midpoint,sourcePosition:T.Bottom,targetPosition:T.Top,direction:1}),i.push({axis:"y",crossDistance:o.distance,distance:Math.abs(n.y-r.bottom),seam:(n.y+r.bottom)/2,midpoint:o.midpoint,sourcePosition:T.Top,targetPosition:T.Bottom,direction:-1});let l=i.filter(e=>e.distance<=64&&e.crossDistance<=80).sort((e,t)=>e.distance+.35*e.crossDistance-(t.distance+.35*t.crossDistance))[0];if(!l)return;if("x"===l.axis){let e={x:l.seam-18*l.direction,y:l.midpoint},t={x:l.seam+18*l.direction,y:l.midpoint};return{path:`M ${e.x} ${e.y} L ${t.x} ${t.y}`,sourcePoint:e,targetPoint:t,terminalPoint:{x:l.seam,y:l.midpoint},sourcePosition:l.sourcePosition,targetPosition:l.targetPosition}}let s={x:l.midpoint,y:l.seam-18*l.direction},c={x:l.midpoint,y:l.seam+18*l.direction};return{path:`M ${s.x} ${s.y} L ${c.x} ${c.y}`,sourcePoint:s,targetPoint:c,terminalPoint:{x:l.midpoint,y:l.seam},sourcePosition:l.sourcePosition,targetPosition:l.targetPosition}}({sourceNode:g,targetNode:v}):void 0,[k.length,g,v]),C=ew.useMemo(()=>S?[S.sourcePoint,S.targetPoint]:[w,...k,j],[k,w,j,S]),N=ew.useMemo(()=>S?.path??function(e,t,n){if(e.length<2)return"";if(2===e.length){let r=e[0],i=e[1],a=cm(t),o=cm(n),l=cg(r,i),s={x:r.x+a.x*l,y:r.y+a.y*l},c={x:i.x+o.x*l,y:i.y+o.y*l};return`M ${r.x} ${r.y} C ${s.x} ${s.y}, ${c.x} ${c.y}, ${i.x} ${i.y}`}let r=e[0],i=[`M ${r.x} ${r.y}`],a=cm(t),o=cm(n);for(let t=0;t<e.length-1;t+=1){let n=e[t],r=e[t-1]??n,l=e[t+1],s=e[t+2]??l,c=0===t,d=t===e.length-2,u=cg(n,l),f=c?{x:n.x+a.x*u,y:n.y+a.y*u}:{x:n.x+(l.x-r.x)/6,y:n.y+(l.y-r.y)/6},h=d?{x:l.x+o.x*u,y:l.y+o.y*u}:{x:l.x-(s.x-n.x)/6,y:l.y-(s.y-n.y)/6};i.push(`C ${f.x} ${f.y}, ${h.x} ${h.y}, ${l.x} ${l.y}`)}return i.join(" ")}(C,i,s),[S?.path,C,i,s]),M=ew.useMemo(()=>cv({point:S?.terminalPoint??w,position:S?.sourcePosition??i}),[w,S?.sourcePosition,S?.terminalPoint,i]),E=ew.useMemo(()=>cv({point:S?.terminalPoint??j,position:S?.targetPosition??s}),[j,S?.targetPosition,S?.terminalPoint,s]),O=ew.useCallback(()=>{if(c?.mode!=="connect")return;let{anchor:t,anchorIndex:n}=function(e){let t=0,n=e.slice(1).map((n,r)=>{let i=e[r],a=Math.hypot(n.x-i.x,n.y-i.y);return t+=a,a}),r=t/2,i=0;for(let t=0;t<n.length;t+=1){let a=n[t],o=i+a;if(r<=o||t===n.length-1){let n=e[t],o=e[t+1],l=0===a?0:(r-i)/a;return{anchor:{x:n.x+(o.x-n.x)*l,y:n.y+(o.y-n.y)*l},anchorIndex:t}}i=o}return{anchor:e[0],anchorIndex:0}}(C);c.onAddAnchor?.(e,t,n)},[c,e,C]);return(0,eb.jsxs)("g",{className:tK("node-canvas-edge",S&&"node-canvas-edge--joined"),children:[(0,eb.jsx)("defs",{children:(0,eb.jsx)("marker",{id:h,viewBox:"0 0 10 10",refX:"8.8",refY:"5",markerWidth:m,markerHeight:m,markerUnits:"userSpaceOnUse",orient:"auto-start-reverse",children:(0,eb.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",className:"node-canvas-edge-arrow"})})}),(0,eb.jsx)(lG,{id:e,path:N,markerStart:x?`url(#${h})`:void 0,markerEnd:`url(#${h})`,interactionWidth:18,style:d,className:"node-canvas-edge-path"}),S?null:(0,eb.jsx)("path",{d:M,className:"node-canvas-edge-terminal"}),S?null:(0,eb.jsx)("path",{d:E,className:"node-canvas-edge-terminal"}),S?(0,eb.jsx)(cj,{route:S,viewportZoom:p}):null,(0,eb.jsx)("path",{d:N,className:"node-canvas-edge-interaction",onClick:e=>{e.stopPropagation(),O()},onPointerEnter:()=>{c?.mode==="cut"&&c.cutActive&&0===k.length&&c.onCutEdge?.(e)}}),k.map((t,n)=>(0,eb.jsx)("circle",{cx:t.x,cy:t.y,r:5,className:"node-canvas-edge-anchor",onPointerDown:t=>(function(t,n){if(t.preventDefault(),t.stopPropagation(),c?.mode==="cut")return void c.onDeleteAnchor?.(e,n);let r=t=>{c?.onMoveAnchor?.(e,n,f({x:t.clientX,y:t.clientY}))},i=()=>{window.removeEventListener("pointermove",r),window.removeEventListener("pointerup",i)};window.addEventListener("pointermove",r),window.addEventListener("pointerup",i,{once:!0})})(t,n),onClick:t=>{t.stopPropagation(),c?.mode==="cut"&&c.onDeleteAnchor?.(e,n)}},`${t.x}-${t.y}-${n}`))]})}};function Hw(e){return{width:2*e.width,height:2*e.height}}function Hj(e){return{width:e.width,height:e.height}}function Hk(e){return 16*Math.round(e/16)}function HS(e,t){return{x:Hk(e.x-t.width/2),y:Hk(e.y-t.height/2)}}let HC=[{id:"blank-1",type:"blank",position:{x:128,y:112},data:{contentScale:2,kind:"multi-tab-system",tabs:[]},width:1280,height:832,style:Hj({width:1280,height:832})},{id:"blank-2",type:"blank",position:{x:1472,y:112},data:{contentScale:2,kind:"file-tree-panel"},width:704,height:992,style:Hj({width:704,height:992})}],HN=[{id:"multi-tab-system",title:"多标签页系统",description:"文件、浏览器、diff 等标签的组合容器。",icon:(0,eb.jsx)(Hv,{className:"size-4"}),size:Hw({width:640,height:416}),keywords:"tabs workspace multi tab system 多标签"},{id:"file-tree-panel",title:"文件管理树",description:"类似 VS Code Explorer 的项目文件树。",icon:(0,eb.jsx)(function(){return(0,eb.jsx)(FA,{className:"size-4"})},{}),size:Hw({width:352,height:496}),keywords:"file tree explorer 文件树"},{id:"process-management",title:"进程管理",description:"按机器查看进程、资源占用和排序状态。",icon:(0,eb.jsx)(Hg,{className:"size-4"}),size:Hw({width:760,height:520}),keywords:"process monitor machine 进程 管理"},{id:"machine-performance",title:"性能监控",description:"机器 CPU、内存、磁盘、网络和 GPU 性能视图。",icon:(0,eb.jsx)(FP,{className:"size-4"}),size:Hw({width:760,height:520}),keywords:"performance monitor cpu memory gpu 性能"},{id:"firewall-policy-workspace",title:"防火墙策略",description:"防火墙策略、IP 地址、续期和申请工作区。",icon:(0,eb.jsx)(Hx,{className:"size-4"}),size:Hw({width:880,height:560}),keywords:"firewall policy security 防火墙 策略"},{id:"machine-file-management",title:"文件管理窗口",description:"单个完整文件管理窗口,支持文件拖拽移动。",icon:(0,eb.jsx)(vx,{className:"size-4"}),size:Hw({width:760,height:520}),keywords:"file manager window explorer 文件 管理 窗口"},{id:"agent-conversation-panel",title:"Agent 对话面板",description:"Agent 对话流和输入框,可作为画布内独立节点。",icon:(0,eb.jsx)(mR,{className:"size-4"}),size:Hw({width:520,height:640}),keywords:"agent chat conversation composer 对话 输入框"},{id:"file-tab-viewer",title:"文件标签",description:"代码、Markdown、HTML 与二进制文件预览。",icon:(0,eb.jsx)(HM,{}),size:Hw({width:672,height:464}),keywords:"file code markdown viewer 文件标签"},{id:"browser-tab-viewer",title:"浏览器标签",description:"地址栏、刷新、前进后退和响应式预览。",icon:(0,eb.jsx)(F_,{className:"size-4"}),size:Hw({width:672,height:464}),keywords:"browser web preview 浏览器"},{id:"diff-tab-viewer",title:"Diff 标签",description:"统一/分栏差异预览和折叠上下文。",icon:(0,eb.jsx)(BY,{className:"size-4"}),size:Hw({width:720,height:464}),keywords:"diff review code 差异"},{id:"data-table-tab-viewer",title:"数据表标签",description:"筛选、排序、选择行和复制单元格。",icon:(0,eb.jsx)(FA,{className:"size-4"}),size:Hw({width:672,height:432}),keywords:"table csv json data 数据表"},{id:"terminal-tab-group",title:"终端标签组",description:"多终端会话和 TUI 友好的等宽渲染。",icon:(0,eb.jsx)(HE,{}),size:Hw({width:672,height:416}),keywords:"terminal shell xterm 终端"}];function HM(){return(0,eb.jsx)(vs,{className:"size-4"})}function HE(){return(0,eb.jsx)(mH,{className:"size-4"})}function HO(e){return"file-tab-viewer"===e||"browser-tab-viewer"===e||"diff-tab-viewer"===e||"data-table-tab-viewer"===e||"terminal-tab-group"===e}function HP(e){switch(e){case"file-tab-viewer":return(0,eb.jsx)(HM,{});case"browser-tab-viewer":return(0,eb.jsx)(F_,{className:"size-4"});case"diff-tab-viewer":return(0,eb.jsx)(BY,{className:"size-4"});case"data-table-tab-viewer":return(0,eb.jsx)(FA,{className:"size-4"});case"terminal-tab-group":return(0,eb.jsx)(HE,{})}}function HA(e,t=e){switch(e){case"file-tab-viewer":return{id:t,kind:e,title:"选择文件",defaultValue:"",defaultMode:"review"};case"browser-tab-viewer":return{id:t,kind:e,title:"Preview",defaultUrl:"https://vantaloom.local/ops"};case"diff-tab-viewer":return{id:t,kind:e,title:"Diff",file:{name:"diff.patch",path:"diff.patch",language:"diff"},diff:""};case"data-table-tab-viewer":return{id:t,kind:e,title:"选择数据表",tableData:[]};case"terminal-tab-group":return{id:t,kind:e,title:"terminal"}}}async function Hz(){return HV("/api/local/files/roots")}async function H_(e,t){let n=new URLSearchParams({machineId:e,path:t});return HV(`/api/local/files/list?${n}`)}async function HI(e,t){let n=new URLSearchParams({machineId:e,path:t});return HV(`/api/local/files/read?${n}`)}async function HD(e){return HV("/api/local/files/write",{method:"PUT",body:JSON.stringify(e)})}async function HT(e){return HV("/api/local/files/directories",{method:"POST",body:JSON.stringify(e)})}async function HR(e){return HV("/api/local/files/entries/rename",{method:"PATCH",body:JSON.stringify(e)})}async function HL(e){await HV("/api/local/files/entries",{method:"DELETE",body:JSON.stringify(e)})}async function H$(e){return HV("/api/local/files/transfers",{method:"POST",body:JSON.stringify(e)})}async function HF(){return HV("/api/local/files/transfers")}async function HV(e,t){let n=await fetch(gQ(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:"file api failed");return r}async function HB(){return HG("/api/local/terminals/machines")}async function HH(e){let t=new URLSearchParams;e&&t.set("scopeId",e);let n=t.toString();return HG(`/api/local/terminals/sessions${n?`?${n}`:""}`)}async function HW(e){return HG("/api/local/terminals/sessions",{method:"POST",body:JSON.stringify(e)})}async function Hq(e){await HG(`/api/local/terminals/sessions/${encodeURIComponent(e)}`,{method:"DELETE"})}async function HU(e,t){await HG(`/api/local/terminals/sessions/${encodeURIComponent(e)}/input`,{method:"POST",body:JSON.stringify({data:t})})}async function HK(e,t){return HG(`/api/local/terminals/sessions/${encodeURIComponent(e)}/resize`,{method:"POST",body:JSON.stringify(t)})}async function HG(e,t){let n=await fetch(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:"terminal api failed");return r}let HY=eN("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);function HX({groupSize:e,panelElement:t,styleProp:n}){let r,[i,a]=function(e){switch(typeof e){case"number":return[e,"px"];case"string":{let t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}(n);switch(a){case"%":r=i/100*e;break;case"px":r=i;break;case"rem":r=i*parseFloat(getComputedStyle(t.ownerDocument.body).fontSize);break;case"em":r=i*parseFloat(getComputedStyle(t).fontSize);break;case"vh":r=i/100*window.innerHeight;break;case"vw":r=i/100*window.innerWidth}return r}function HZ(e){return parseFloat(e.toFixed(3))}function HJ({group:e}){let{orientation:t,panels:n}=e;return n.reduce((e,n)=>e+="horizontal"===t?n.element.offsetWidth:n.element.offsetHeight,0)}function HQ(e){let{panels:t}=e,n=HJ({group:e});return 0===n?t.map(e=>({groupResizeBehavior:e.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:!0===e.panelConstraints.collapsible,defaultSize:void 0,disabled:e.panelConstraints.disabled,minSize:0,maxSize:100,panelId:e.id})):t.map(e=>{let t,{element:r,panelConstraints:i}=e,a=0;void 0!==i.collapsedSize&&(a=HZ(HX({groupSize:n,panelElement:r,styleProp:i.collapsedSize})/n*100)),void 0!==i.defaultSize&&(t=HZ(HX({groupSize:n,panelElement:r,styleProp:i.defaultSize})/n*100));let o=0;void 0!==i.minSize&&(o=HZ(HX({groupSize:n,panelElement:r,styleProp:i.minSize})/n*100));let l=100;return void 0!==i.maxSize&&(l=HZ(HX({groupSize:n,panelElement:r,styleProp:i.maxSize})/n*100)),{groupResizeBehavior:i.groupResizeBehavior,collapsedSize:a,collapsible:!0===i.collapsible,defaultSize:t,disabled:i.disabled,minSize:o,maxSize:l,panelId:e.id}})}function H0(e,t="Assertion error"){if(!e)throw Error(t)}function H1(e,t){return Array.from(t).sort("horizontal"===e?H2:H5)}function H2(e,t){let n=e.element.offsetLeft-t.element.offsetLeft;return 0!==n?n:e.element.offsetWidth-t.element.offsetWidth}function H5(e,t){let n=e.element.offsetTop-t.element.offsetTop;return 0!==n?n:e.element.offsetHeight-t.element.offsetHeight}function H4(e){return null!==e&&"object"==typeof e&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function H3(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function H6(e){let{element:t,orientation:r,panels:i,separators:a}=e,o=H1(r,Array.from(t.children).filter(H4).map(e=>({element:e}))).map(({element:e})=>e),l=[],s=!1,c=!1,d=-1,u=-1,f=0,h,p=[];{let e=-1;for(let t of o)t.hasAttribute("data-panel")&&(e++,t.hasAttribute("data-disabled")||(f++,-1===d&&(d=e),u=e))}if(f>1){let t=-1;for(let f of o)if(f.hasAttribute("data-panel")){t++;let a=i.find(e=>e.element===f);if(a){if(h){let i,o=h.element.getBoundingClientRect(),m=f.getBoundingClientRect();if(c){let e="horizontal"===r?new DOMRect(o.right,o.top,0,o.height):new DOMRect(o.left,o.bottom,o.width,0),t="horizontal"===r?new DOMRect(m.left,m.top,0,m.height):new DOMRect(m.left,m.top,m.width,0);switch(p.length){case 0:i=[e,t];break;case 1:{let n=p[0],a=function({orientation:e,rects:t,targetRect:n}){let r={x:n.x+n.width/2,y:n.y+n.height/2},i,a=Number.MAX_VALUE;for(let n of t){let{x:t,y:o}=H3(r,n),l="horizontal"===e?t:o;l<a&&(a=l,i=n)}return H0(i,"No rect found"),i}({orientation:r,rects:[o,m],targetRect:n.element.getBoundingClientRect()});i=[n,a===o?t:e];break}default:i=p}}else i=p.length?p:["horizontal"===r?new DOMRect(o.right,m.top,m.left-o.right,m.height):new DOMRect(m.left,o.bottom,m.width,m.top-o.bottom)];for(let r of i){let i="width"in r?r:r.element.getBoundingClientRect(),o=(void 0===n&&(n="function"==typeof matchMedia&&!!matchMedia("(pointer:coarse)").matches),n)?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(i.width<o){let e=o-i.width;i=new DOMRect(i.x-e/2,i.y,i.width+e,i.height)}if(i.height<o){let e=o-i.height;i=new DOMRect(i.x,i.y-e/2,i.width,i.height+e)}let c=t<=d||t>u;s||c||l.push({group:e,groupSize:HJ({group:e}),panels:[h,a],separator:"width"in r?void 0:r,rect:i}),s=!1}}c=!1,h=a,p=[]}}else if(f.hasAttribute("data-separator")){null!==f.ariaDisabled&&(s=!0);let e=a.find(e=>e.element===f);e?p.push(e):(h=void 0,p=[])}else c=!0}return l}class H8{#t={};addListener(e,t){let n=this.#t[e];return void 0===n?this.#t[e]=[t]:n.includes(t)||n.push(t),()=>{this.removeListener(e,t)}}emit(e,t){let n=this.#t[e];if(void 0!==n)if(1===n.length)n[0].call(null,t);else{let e=!1,r=null,i=Array.from(n);for(let n=0;n<i.length;n++){let a=i[n];try{a.call(null,t)}catch(t){null===r&&(e=!0,r=t)}}if(e)throw r}}removeAllListeners(){this.#t={}}removeListener(e,t){let n=this.#t[e];if(void 0!==n){let e=n.indexOf(t);e>=0&&n.splice(e,1)}}}let H7=new Map,H9=new H8;function We(e,t){for(let[t]of H7)if(t.id===e)return t}function Wt(e,t){for(let[t,n]of H7)if(t.id===e)return n;if(t)throw Error(`Could not find data for Group with id ${e}`)}function Wn(e,t){return H9.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function Wr(e,t){let n=H7.get(e);(H7=new Map(H7)).set(e,t),H9.emit("groupChange",{group:e,prev:n,next:t})}let Wi=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function Wa(e){let t=e.length;for(;t--;){let n=e[t];if(H0(n,"Missing node"),function(e){let t,n=getComputedStyle(e);return!!("fixed"===n.position||"auto"!==n.zIndex&&("static"!==n.position||"flex"===(t=getComputedStyle(Ws(e)??e).display)||"inline-flex"===t)||1>+n.opacity||"transform"in n&&"none"!==n.transform||"webkitTransform"in n&&"none"!==n.webkitTransform||"mixBlendMode"in n&&"normal"!==n.mixBlendMode||"filter"in n&&"none"!==n.filter||"webkitFilter"in n&&"none"!==n.webkitFilter||"isolation"in n&&"isolate"===n.isolation||Wi.test(n.willChange)||"touch"===n.webkitOverflowScrolling)}(n))return n}return null}function Wo(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Wl(e){let t=[];for(;e;)t.push(e),e=Ws(e);return t}function Ws(e){let{parentNode:t}=e;return null!==t&&"object"==typeof t&&"nodeType"in t&&t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t.host:t}function Wc(e,t){let n=[];return t.forEach((t,r)=>{if(r.disabled)return;let i=H6(r),a=function(e,t,n){let r,i={x:1/0,y:1/0};for(let a of t){let t=H3(n,a.rect);switch(e){case"horizontal":t.x<=i.x&&(r=a,i=t);break;case"vertical":t.y<=i.y&&(r=a,i=t)}}return r?{distance:i,hitRegion:r}:void 0}(r.orientation,i,{x:e.clientX,y:e.clientY});a&&a.distance.x<=0&&a.distance.y<=0&&function({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!H4(n)||n.contains(e)||e.contains(n))return!0;if(function(e,t){let n;if(e===t)throw Error("Cannot compare node with itself");let r={a:Wl(e),b:Wl(t)};for(;r.a.at(-1)===r.b.at(-1);)n=r.a.pop(),r.b.pop();H0(n,"Stacking order can only be calculated for elements with a common ancestor");let i={a:Wo(Wa(r.a)),b:Wo(Wa(r.b))};if(i.a===i.b){let e=n.childNodes,t={a:r.a.at(-1),b:r.b.at(-1)},i=e.length;for(;i--;){let n=e[i];if(n===t.a)return 1;if(n===t.b)return -1}}return Math.sign(i.a-i.b)}(n,e)>0){let i=n;for(;i;){var r;if(i.contains(e))break;if(r=i.getBoundingClientRect(),r.x<t.x+t.width&&r.x+r.width>t.x&&r.y<t.y+t.height&&r.y+r.height>t.y)return!1;i=i.parentElement}}return!0}({groupElement:r.element,hitRegion:a.hitRegion.rect,pointerEventTarget:e.target})&&n.push(a.hitRegion)}),n}function Wd(e,t,n=0){return Math.abs(HZ(e)-HZ(t))<=n}function Wu(e,t){return Wd(e,t)?0:e>t?1:-1}function Wf({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){let{collapsedSize:i=0,collapsible:a,disabled:o,maxSize:l=100,minSize:s=0}=t;return o&&!e?n:(0>Wu(r,s)&&(r=a&&0>Wu(r,(i+s)/2)?i:s),HZ(r=Math.min(l,r)))}function Wh({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:i,trigger:a}){if(Wd(e,0))return t;let o="imperative-api"===a,l=Object.values(t),s=Object.values(i),c=[...l],[d,u]=r;H0(null!=d,"Invalid first pivot index"),H0(null!=u,"Invalid second pivot index");let f=0;if("keyboard"===a){{let t=e<0?u:d,r=n[t];H0(r,`Panel constraints not found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=l[t];if(H0(null!=n,`Previous layout not found for panel index ${t}`),Wd(n,i)){let t=o-n;Wu(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}{let t=e<0?d:u,r=n[t];H0(r,`No panel constraints found for index ${t}`);let{collapsedSize:i=0,collapsible:a,minSize:o=0}=r;if(a){let n=l[t];if(H0(null!=n,`Previous layout not found for panel index ${t}`),Wd(n,o)){let t=n-i;Wu(t,Math.abs(e))>0&&(e=e<0?0-t:t)}}}}else{let t=e<0?u:d,r=n[t];H0(r,`Panel constraints not found for index ${t}`);let i=l[t],{collapsible:a,collapsedSize:o,minSize:s}=r;if(a&&0>Wu(i,s))if(e>0){let t=s-o;0>Wu(i+e,s)&&(e=0>=Wu(e,t/2)?0:t)}else{let t=s-o;0>Wu(i-e,s)&&(e=Wu(100+e,100-t/2)>0?0:-t)}}{let t=e<0?1:-1,r=e<0?u:d,i=0;for(;;){let e=l[r];if(H0(null!=e,`Previous layout not found for panel index ${r}`),i+=Wf({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:e,size:100})-e,(r+=t)<0||r>=n.length)break}let a=Math.min(Math.abs(e),Math.abs(i));e=e<0?0-a:a}{let t=e<0?d:u;for(;t>=0&&t<n.length;){let r=Math.abs(e)-Math.abs(f),i=l[t];H0(null!=i,`Previous layout not found for panel index ${t}`);let a=i-r,s=Wf({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:i,size:a});if(!Wd(i,s)&&(f+=i-s,c[t]=s,f.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?t--:t++}}if(function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}(s,c))return i;{let t=e<0?u:d,r=l[t];H0(null!=r,`Previous layout not found for panel index ${t}`);let i=r+f,a=Wf({overrideDisabledPanels:o,panelConstraints:n[t],prevSize:r,size:i});if(c[t]=a,!Wd(a,i)){let t=i-a,r=e<0?u:d;for(;r>=0&&r<n.length;){let i=c[r];H0(null!=i,`Previous layout not found for panel index ${r}`);let a=i+t,l=Wf({overrideDisabledPanels:o,panelConstraints:n[r],prevSize:i,size:a});if(Wd(i,l)||(t-=l-i,c[r]=l),Wd(t,0))break;e>0?r--:r++}}}if(!Wd(Object.values(c).reduce((e,t)=>t+e,0),100,.1))return i;let h=Object.keys(i);return c.reduce((e,t,n)=>(e[h[n]]=t,e),{})}function Wp(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(void 0===t[n]||0!==Wu(e[n],t[n]))return!1;return!0}function Wm({layout:e,panelConstraints:t}){let n=Object.values(e),r=[...n],i=r.reduce((e,t)=>e+t,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(e=>`${e}%`).join(", ")}`);if(!Wd(i,100)&&r.length>0)for(let e=0;e<t.length;e++){let t=r[e];H0(null!=t,`No layout data found for index ${e}`);let n=100/i*t;r[e]=n}let a=0;for(let e=0;e<t.length;e++){let i=n[e];H0(null!=i,`No layout data found for index ${e}`);let o=r[e];H0(null!=o,`No layout data found for index ${e}`);let l=Wf({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:i,size:o});o!=l&&(a+=o-l,r[e]=l)}if(!Wd(a,0))for(let e=0;e<t.length;e++){let n=r[e];H0(null!=n,`No layout data found for index ${e}`);let i=n+a,o=Wf({overrideDisabledPanels:!0,panelConstraints:t[e],prevSize:n,size:i});if(n!==o&&(a-=o-n,r[e]=o,Wd(a,0)))break}let o=Object.keys(e);return r.reduce((e,t,n)=>(e[o[n]]=t,e),{})}function Wg({groupId:e,panelId:t}){let n=()=>{for(let[t,{defaultLayoutDeferred:n,derivedPanelConstraints:r,layout:i,groupSize:a,separatorToPanels:o}]of H7)if(t.id===e)return{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:t,groupSize:a,layout:i,separatorToPanels:o};throw Error(`Group ${e} not found`)},r=()=>{let e=n().derivedPanelConstraints.find(e=>e.panelId===t);if(void 0!==e)return e;throw Error(`Panel constraints not found for Panel ${t}`)},i=()=>{let e=n().group.panels.find(e=>e.id===t);if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},a=()=>{let e=n().layout[t];if(void 0!==e)return e;throw Error(`Layout not found for Panel ${t}`)},o=e=>{if(e===a())return;let{defaultLayoutDeferred:r,derivedPanelConstraints:i,group:o,groupSize:l,layout:s,separatorToPanels:c}=n(),d=Wm({layout:(({nextSize:e,panels:n,prevLayout:r,derivedPanelConstraints:i})=>{let o=a(),l=n.findIndex(e=>e.id===t),s=0===l,c=l===n.length-1;if(c&&e<o&&(s||n.slice(0,l).every((e,t)=>{let n=i[t];return n?.collapsible&&Wd(n.collapsedSize,r[n.panelId])}))){let e=n.slice(0,l).reduce((e,t)=>e+r[t.id],0);return{...r,[t]:HZ(100-e)}}return Wh({delta:c?o-e:e-o,initialLayout:r,panelConstraints:i,pivotIndices:c?[l-1,l]:[l,l+1],prevLayout:r,trigger:"imperative-api"})})({nextSize:e,panels:o.panels,prevLayout:s,derivedPanelConstraints:i}),panelConstraints:i});Wp(s,d)||Wr(o,{defaultLayoutDeferred:r,derivedPanelConstraints:i,groupSize:l,layout:d,separatorToPanels:c})};return{collapse:()=>{let{collapsible:e,collapsedSize:t}=r(),{mutableValues:n}=i(),l=a();e&&l!==t&&(n.expandToSize=l,o(t))},expand:()=>{let{collapsible:e,collapsedSize:t,minSize:n}=r(),{mutableValues:l}=i(),s=a();if(e&&s===t){let e=l.expandToSize??n;0===e&&(e=1),o(e)}},getSize:()=>{let{group:e}=n(),t=a(),{element:r}=i();return{asPercentage:t,inPixels:"horizontal"===e.orientation?r.offsetWidth:r.offsetHeight}},isCollapsed:()=>{let{collapsible:e,collapsedSize:t}=r(),n=a();return e&&Wd(t,n)},resize:e=>{let{group:t}=n(),{element:r}=i(),a=HJ({group:t});o(HZ(HX({groupSize:a,panelElement:r,styleProp:e})/a*100))}}}function Wv(e){e.defaultPrevented||Wc(e,H7).forEach(t=>{if(t.separator&&!t.separator.disableDoubleClick){let n=t.panels.find(e=>void 0!==e.panelConstraints.defaultSize);if(n){let r=n.panelConstraints.defaultSize,i=Wg({groupId:t.group.id,panelId:n.id});i&&void 0!==r&&(i.resize(r),e.preventDefault())}}})}function Wx(e){for(let[t]of H7)if(t.separators.some(t=>t.element===e))return t;throw Error("Could not find parent Group for separator element")}function Wy({groupId:e}){let t=()=>{for(let[t,n]of H7)if(t.id===e)return{group:t,...n};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){let{defaultLayoutDeferred:e,layout:n}=t();return e?{}:n},setLayout(e){let{defaultLayoutDeferred:n,derivedPanelConstraints:r,group:i,groupSize:a,layout:o,separatorToPanels:l}=t(),s=Wm({layout:e,panelConstraints:r});return n?o:(Wp(o,s)||Wr(i,{defaultLayoutDeferred:n,derivedPanelConstraints:r,groupSize:a,layout:s,separatorToPanels:l}),s)}}}function Wb(e,t){let n=Wx(e),r=Wt(n.id,!0),i=n.separators.find(t=>t.element===e);H0(i,"Matching separator not found");let a=r.separatorToPanels.get(i);H0(a,"Matching panels not found");let o=a.map(e=>n.panels.indexOf(e)),l=Wy({groupId:n.id}).getLayout(),s=Wm({layout:Wh({delta:t,initialLayout:l,panelConstraints:r.derivedPanelConstraints,pivotIndices:o,prevLayout:l,trigger:"keyboard"}),panelConstraints:r.derivedPanelConstraints});Wp(l,s)||Wr(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:s,separatorToPanels:r.separatorToPanels})}function Ww(e){if(e.defaultPrevented)return;let t=e.currentTarget,n=Wx(t);if(!n.disabled)switch(e.key){case"ArrowDown":e.preventDefault(),"vertical"===n.orientation&&Wb(t,5);break;case"ArrowLeft":e.preventDefault(),"horizontal"===n.orientation&&Wb(t,-5);break;case"ArrowRight":e.preventDefault(),"horizontal"===n.orientation&&Wb(t,5);break;case"ArrowUp":e.preventDefault(),"vertical"===n.orientation&&Wb(t,-5);break;case"End":e.preventDefault(),Wb(t,100);break;case"Enter":{e.preventDefault();let n=Wx(t),{derivedPanelConstraints:r,layout:i,separatorToPanels:a}=Wt(n.id,!0),o=n.separators.find(e=>e.element===t);H0(o,"Matching separator not found");let l=a.get(o);H0(l,"Matching panels not found");let s=l[0],c=r.find(e=>e.panelId===s.id);if(H0(c,"Panel metadata not found"),c.collapsible){let e=i[s.id];Wb(t,(c.collapsedSize===e?n.mutableState.expandedPanelSizes[s.id]??c.minSize:c.collapsedSize)-e)}break}case"F6":{e.preventDefault();let n=Wx(t).separators.map(e=>e.element),r=Array.from(n).findIndex(t=>t===e.currentTarget);H0(null!==r,"Index not found");let i=e.shiftKey?r>0?r-1:n.length-1:r+1<n.length?r+1:0;n[i].focus({preventScroll:!0});break}case"Home":e.preventDefault(),Wb(t,-100)}}let Wj={cursorFlags:0,state:"inactive"},Wk=new H8;function WS(e){let t=Wj;Wj=e,Wk.emit("change",{prev:t,next:e})}function WC(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let t=H7,n=Wc(e,t),r=new Map,i=!1;n.forEach(e=>{e.separator&&(i||(i=!0,e.separator.element.focus({focusVisible:!1,preventScroll:!0})));let n=t.get(e.group);n&&r.set(e.group,n.layout)}),WS({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}let WN=e=>e,WM=()=>{};function WE(){return void 0===r&&(r=!1,"u">typeof window&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(r=!0)),r}let WO=new WeakMap;function WP(e){if(null===e.defaultView||void 0===e.defaultView)return;let{prevStyle:t,styleSheet:n}=WO.get(e)??{};void 0===n&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&(Object.isExtensible(e.adoptedStyleSheets)?e.adoptedStyleSheets.push(n):e.adoptedStyleSheets=[...e.adoptedStyleSheets,n]));let r=Wj;switch(r.state){case"active":case"hover":{let e=function({cursorFlags:e,groups:t,state:n}){let r=0,i=0;switch(n){case"active":case"hover":t.forEach(e=>{if(!e.mutableState.disableCursor)switch(e.orientation){case"horizontal":r++;break;case"vertical":i++}})}if(0!==r||0!==i){if("active"===n&&e&&WE()){let t=(4&e)!=0,n=(8&e)!=0;if((1&e)!=0)return t?"se-resize":n?"ne-resize":"e-resize";if((2&e)!=0)return t?"sw-resize":n?"nw-resize":"w-resize";if(t)return"s-resize";if(n)return"n-resize"}return WE()?r>0&&i>0?"move":r>0?"ew-resize":"ns-resize":r>0&&i>0?"grab":r>0?"col-resize":"row-resize"}}({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(e=>e.group),state:r.state}),i=`*, *:hover {cursor: ${e} !important; }`;if(t===i)return;t=i,e?0===n.cssRules.length?n.insertRule(i):n.replaceSync(i):1===n.cssRules.length&&n.deleteRule(0);break}case"inactive":t=void 0,1===n.cssRules.length&&n.deleteRule(0)}WO.set(e,{prevStyle:t,styleSheet:n})}function WA({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:i,pointerDownAtPoint:a,prevCursorFlags:o}){var l;let s,c,d=0;n.forEach(e=>{let{group:n,groupSize:o}=e,{orientation:l,panels:s}=n,{disableCursor:c}=n.mutableState,u=0;u=a?"horizontal"===l?(t.clientX-a.x)/o*100:(t.clientY-a.y)/o*100:"horizontal"===l?t.clientX<0?-100:100:t.clientY<0?-100:100;let f=r.get(n),h=i.get(n);if(!f||!h)return;let{defaultLayoutDeferred:p,derivedPanelConstraints:m,groupSize:g,layout:v,separatorToPanels:x}=h;if(m&&v&&x){let t=Wh({delta:u,initialLayout:f,panelConstraints:m,pivotIndices:e.panels.map(e=>s.indexOf(e)),prevLayout:v,trigger:"mouse-or-touch"});if(Wp(t,v)){if(0!==u&&!c)switch(l){case"horizontal":d|=u<0?1:2;break;case"vertical":d|=u<0?4:8}}else Wr(e.group,{defaultLayoutDeferred:p,derivedPanelConstraints:m,groupSize:g,layout:t,separatorToPanels:x})}});let u=0;0===t.movementX?u|=3&o:u|=3&d,0===t.movementY?u|=12&o:u|=12&d,l=u,s=Wj,(c={...Wj}).cursorFlags=l,Wj=c,Wk.emit("change",{prev:s,next:c}),WP(e)}function Wz(e){let t=H7,n=Wj;"active"===n.state&&WA({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}function W_(e){if(e.defaultPrevented)return;let t=Wj,n=H7;if("active"===t.state){if(0===e.buttons){WS({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(e=>{let t=Wt(e.group.id,!0);Wr(e.group,t)});return}for(let n of t.hitRegions)if(n.separator){let{element:t}=n.separator;t.hasPointerCapture?.(e.pointerId)||t.setPointerCapture?.(e.pointerId)}WA({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags})}else{let r=Wc(e,n);0===r.length?"inactive"!==t.state&&WS({cursorFlags:0,state:"inactive"}):WS({cursorFlags:0,hitRegions:r,state:"hover"}),WP(e.currentTarget)}}function WI(e){e.relatedTarget instanceof HTMLIFrameElement&&"hover"===Wj.state&&WS({cursorFlags:0,state:"inactive"})}function WD(e){if(e.defaultPrevented||"mouse"===e.pointerType&&e.button>0)return;let t=Wj;"active"===t.state&&(WS({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(WP(e.currentTarget),t.hitRegions.forEach(e=>{let t=Wt(e.group.id,!0);Wr(e.group,t)}),e.preventDefault()))}function WT(e){let t=0,n=0,r={};for(let i of e)if(void 0!==i.defaultSize){t++;let e=HZ(i.defaultSize);n+=e,r[i.panelId]=e}else r[i.panelId]=void 0;let i=e.length-t;if(0!==i){let t=HZ((100-n)/i);for(let n of e)void 0===n.defaultSize&&(r[n.panelId]=t)}return r}let WR=new Map;function WL(e){let t=(0,ew.useId)();return`${e??t}`}let W$="u">typeof window?ew.useLayoutEffect:ew.useEffect;function WF(e){let t=(0,ew.useRef)(e);return W$(()=>{t.current=e},[e]),(0,ew.useCallback)((...e)=>t.current?.(...e),[t])}function WV(...e){return WF(t=>{e.forEach(e=>{if(e)switch(typeof e){case"function":e(t);break;case"object":e.current=t}})})}function WB(e){let t=(0,ew.useRef)({...e});return W$(()=>{for(let n in e)t.current[n]=e[n]},[e]),t.current}let WH=(0,ew.createContext)(null);function WW({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:i,elementRef:a,groupRef:o,id:l,onLayoutChange:s,onLayoutChanged:c,orientation:d="horizontal",resizeTargetMinimumSize:u={coarse:20,fine:10},style:f,...h}){let p,m=(0,ew.useRef)({onLayoutChange:{},onLayoutChanged:{}}),g=WF(e=>{Wp(m.current.onLayoutChange,e)||(m.current.onLayoutChange=e,s?.(e))}),v=WF(e=>{Wp(m.current.onLayoutChanged,e)||(m.current.onLayoutChanged=e,c?.(e))}),x=WL(l),y=(0,ew.useRef)(null),[b,w]=function(){let[e,t]=(0,ew.useState)({});return[e,(0,ew.useCallback)(()=>t({}),[])]}(),j=(0,ew.useRef)({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:u,separators:[]}),k=WV(y,a);p=(0,ew.useRef)({getLayout:()=>({}),setLayout:WN}),(0,ew.useImperativeHandle)(o,()=>p.current,[]),W$(()=>{Object.assign(p.current,Wy({groupId:x}))});let S=WF((e,t)=>{let r=Wj,i=We(e),a=Wt(e);if(a){let e=!1;return"active"===r.state&&(e=r.hitRegions.some(e=>e.group===i)),{flexGrow:a.layout[t]??1,pointerEvents:e?"none":void 0}}if(n?.[t])return{flexGrow:n?.[t]}}),C=WB({defaultLayout:n,disableCursor:r}),N=(0,ew.useMemo)(()=>({get disableCursor(){return!!C.disableCursor},getPanelStyles:S,id:x,orientation:d,registerPanel:e=>{let t=j.current;return t.panels=H1(d,[...t.panels,e]),w(),()=>{t.panels=t.panels.filter(t=>t!==e),w()}},registerSeparator:e=>{let t=j.current;return t.separators=H1(d,[...t.separators,e]),w(),()=>{t.separators=t.separators.filter(t=>t!==e),w()}},updatePanelProps:(e,{disabled:t})=>{let n=j.current.panels.find(t=>t.id===e);n&&(n.panelConstraints.disabled=t);let r=We(x),i=Wt(x);r&&i&&Wr(r,{...i,derivedPanelConstraints:HQ(r)})},updateSeparatorProps:(e,{disabled:t,disableDoubleClick:n})=>{let r=j.current.separators.find(t=>t.id===e);r&&(r.disabled=t,r.disableDoubleClick=n)}}),[S,x,w,d,C]),M=(0,ew.useRef)(null);return W$(()=>{let e,t,n,r,a,o,l,s,c,u,f,h,p,m=y.current;if(null===m)return;let b=j.current;if(void 0!==C.defaultLayout&&Object.keys(C.defaultLayout).length===b.panels.length)for(let t of(e={},b.panels)){let n=C.defaultLayout[t.id];void 0!==n&&(e[t.id]=n)}let w={disabled:!!i,element:m,id:x,mutableState:{defaultLayout:e,disableCursor:!!C.disableCursor,expandedPanelSizes:j.current.lastExpandedPanelSizes,layouts:j.current.layouts},orientation:d,panels:b.panels,resizeTargetMinimumSize:b.resizeTargetMinimumSize,separators:b.separators};M.current=w;let k=(t=!0,H0(w.element.ownerDocument.defaultView,"Cannot register an unmounted Group"),n=w.element.ownerDocument.defaultView.ResizeObserver,r=new Set,a=new Set,(o=new n(e=>{for(let n of e){let{borderBoxSize:e,target:r}=n;if(r===w.element){if(t){let e=HJ({group:w});if(0===e)return;let t=Wt(w.id);if(!t)return;let n=HQ(w),r=t.defaultLayoutDeferred?WT(n):t.layout,i=Wm({layout:function({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let i=0,a=0,o=!1,l=new Map,s=[];for(let c of e.panels){let e=r[c.id]??0;if("preserve-pixel-size"===c.panelConstraints.groupResizeBehavior){o=!0;let r=HZ(e/100*n/t*100);l.set(c.id,r),i+=r}else s.push(c.id),a+=e}if(!o||0===s.length)return r;let c=100-i,d={...r};if(l.forEach((e,t)=>{d[t]=e}),a>0)for(let e of s){let t=r[e]??0;d[e]=HZ(t/a*c)}else{let e=HZ(c/s.length);for(let t of s)d[t]=e}return d}({group:w,nextGroupSize:e,prevGroupSize:t.groupSize,prevLayout:r}),panelConstraints:n});if(!t.defaultLayoutDeferred&&Wp(t.layout,i)&&function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let n in e)if(e[n]!==t[n])return!1;return!0}(t.derivedPanelConstraints,n)&&t.groupSize===e)return;Wr(w,{defaultLayoutDeferred:!1,derivedPanelConstraints:n,groupSize:e,layout:i,separatorToPanels:t.separatorToPanels})}}else!function(e,t,n){if(!n[0])return;let r=e.panels.find(e=>e.element===t);if(!r||!r.onResize)return;let i=HJ({group:e}),a="horizontal"===e.orientation?r.element.offsetWidth:r.element.offsetHeight,o=r.mutableValues.prevSize,l={asPercentage:HZ(a/i*100),inPixels:a};r.mutableValues.prevSize=l,r.onResize(l,r.id,o)}(w,r,e)}})).observe(w.element),w.panels.forEach(e=>{H0(!r.has(e.id),`Panel ids must be unique; id "${e.id}" was used more than once`),r.add(e.id),e.onResize&&o.observe(e.element)}),l=HJ({group:w}),s=HQ(w),c=w.panels.map(({id:e})=>e).join(","),(u=w.mutableState.defaultLayout)&&(function(e,t){let n=e.map(e=>e.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(let e of n)if(!r.includes(e))return!1;return!0}(w.panels,u)||(u=void 0)),f=Wm({layout:w.mutableState.layouts[c]??u??WT(s),panelConstraints:s}),h=w.element.ownerDocument,WR.set(h,(WR.get(h)??0)+1),p=new Map,H6(w).forEach(e=>{e.separator&&p.set(e.separator,e.panels)}),Wr(w,{defaultLayoutDeferred:0===l,derivedPanelConstraints:s,groupSize:l,layout:f,separatorToPanels:p}),w.separators.forEach(e=>{H0(!a.has(e.id),`Separator ids must be unique; id "${e.id}" was used more than once`),a.add(e.id),e.element.addEventListener("keydown",Ww)}),1===WR.get(h)&&(h.addEventListener("dblclick",Wv,!0),h.addEventListener("pointerdown",WC,!0),h.addEventListener("pointerleave",Wz),h.addEventListener("pointermove",W_),h.addEventListener("pointerout",WI),h.addEventListener("pointerup",WD,!0)),function(){t=!1,WR.set(h,Math.max(0,(WR.get(h)??0)-1)),(H7=new Map(H7)).delete(w),w.separators.forEach(e=>{e.element.removeEventListener("keydown",Ww)}),WR.get(h)||(h.removeEventListener("dblclick",Wv,!0),h.removeEventListener("pointerdown",WC,!0),h.removeEventListener("pointerleave",Wz),h.removeEventListener("pointermove",W_),h.removeEventListener("pointerout",WI),h.removeEventListener("pointerup",WD,!0)),o.disconnect()}),{defaultLayoutDeferred:S,derivedPanelConstraints:N,layout:E}=Wt(w.id,!0);!S&&N.length>0&&(g(E),v(E));let O=Wn(x,e=>{let{defaultLayoutDeferred:t,derivedPanelConstraints:n,layout:r}=e.next;if(t||0===n.length)return;let i=w.panels.map(({id:e})=>e).join(",");w.mutableState.layouts[i]=r,n.forEach(t=>{if(t.collapsible){let{layout:n}=e.prev??{};if(n){let e=Wd(t.collapsedSize,r[t.panelId]),i=Wd(t.collapsedSize,n[t.panelId]);e&&!i&&(w.mutableState.expandedPanelSizes[t.panelId]=n[t.panelId])}}});let a="active"!==Wj.state;g(r),a&&v(r)});return()=>{M.current=null,k(),O()}},[i,x,v,g,d,b,C]),(0,ew.useEffect)(()=>{let e=M.current;e&&(e.mutableState.defaultLayout=n,e.mutableState.disableCursor=!!r)}),(0,eb.jsx)(WH.Provider,{value:N,children:(0,eb.jsx)("div",{...h,className:t,"data-group":!0,"data-testid":x,id:x,ref:k,style:{height:"100%",width:"100%",overflow:"hidden",...f,display:"flex",flexDirection:"horizontal"===d?"row":"column",flexWrap:"nowrap",touchAction:"horizontal"===d?"pan-y":"pan-x"},children:e})})}function Wq(){let e=(0,ew.useContext)(WH);return H0(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function WU({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:i,disabled:a,elementRef:o,groupResizeBehavior:l="preserve-relative-size",id:s,maxSize:c="100%",minSize:d="0%",onResize:u,panelRef:f,style:h,...p}){let m,g=!!s,v=WL(s),x=WB({disabled:a}),y=(0,ew.useRef)(null),b=WV(y,o),{getPanelStyles:w,id:j,orientation:k,registerPanel:S,updatePanelProps:C}=Wq(),N=null!==u,M=WF((e,t,n)=>{u?.(e,s,n)});W$(()=>{let e=y.current;if(null!==e)return S({element:e,id:v,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:N?M:void 0,panelConstraints:{groupResizeBehavior:l,collapsedSize:n,collapsible:r,defaultSize:i,disabled:x.disabled,maxSize:c,minSize:d}})},[l,n,r,i,N,v,g,c,d,M,S,x]),(0,ew.useEffect)(()=>{C(v,{disabled:a})},[a,v,C]),function(e,t){let{id:n}=Wq(),r=(0,ew.useRef)({collapse:WM,expand:WM,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:WM});(0,ew.useImperativeHandle)(t,()=>r.current,[]),W$(()=>{Object.assign(r.current,Wg({groupId:n,panelId:e}))})}(v,f);let E=()=>{let e=w(j,v);if(e)return JSON.stringify(e)},O=(0,ew.useSyncExternalStore)(e=>Wn(j,e),E,E);return m=O?JSON.parse(O):void 0!==i?{flexGrow:void 0,flexShrink:void 0,flexBasis:i}:{flexGrow:1},(0,eb.jsx)("div",{...p,"data-disabled":a||void 0,"data-panel":!0,"data-testid":v,id:v,ref:b,style:{...WK,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...m},children:(0,eb.jsx)("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...h,touchAction:"horizontal"===k?"pan-y":"pan-x"},children:e})})}WW.displayName="Group",WU.displayName="Panel";let WK={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function WG({children:e,className:t,disabled:n,disableDoubleClick:r,elementRef:i,id:a,style:o,...l}){let s,c,d=WL(a),u=WB({disabled:n,disableDoubleClick:r}),[f,h]=(0,ew.useState)({}),[p,m]=(0,ew.useState)("inactive"),[g,v]=(0,ew.useState)(!1),x=(0,ew.useRef)(null),y=WV(x,i),{disableCursor:b,id:w,orientation:j,registerSeparator:k,updateSeparatorProps:S}=Wq();return W$(()=>{let e=x.current;if(null!==e){var t;let n={disabled:u.disabled,disableDoubleClick:u.disableDoubleClick,element:e,id:d},r=k(n),i=(t=e=>{m("inactive"!==e.next.state&&e.next.hitRegions.some(e=>e.separator===n)?e.next.state:"inactive")},Wk.addListener("change",t)),a=Wn(w,e=>{let{derivedPanelConstraints:t,layout:r,separatorToPanels:i}=e.next,a=i.get(n);if(a){let e=a[0],n=a.indexOf(e);h(function({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let i,a,o=e[n],l=t.find(e=>e.panelId===n);if(l){let s=l.maxSize,c=l.collapsible?l.collapsedSize:l.minSize,d=[r,r+1];a=Wm({layout:Wh({delta:c-o,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n],i=Wm({layout:Wh({delta:s-o,initialLayout:e,panelConstraints:t,pivotIndices:d,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:i,valueMin:a,valueNow:o}}({layout:r,panelConstraints:t,panelId:e.id,panelIndex:n}))}});return()=>{i(),a(),r()}}},[w,d,k,u]),(0,ew.useEffect)(()=>{S(d,{disabled:n,disableDoubleClick:r})},[n,r,d,S]),n&&!b&&(s="not-allowed"),c=n?"disabled":"active"===p?"active":g?"focus":p,(0,eb.jsx)("div",{...l,"aria-controls":f.valueControls,"aria-disabled":n||void 0,"aria-orientation":"horizontal"===j?"vertical":"horizontal","aria-valuemax":f.valueMax,"aria-valuemin":f.valueMin,"aria-valuenow":f.valueNow,children:e,className:t,"data-separator":c,"data-testid":d,id:d,onBlur:()=>v(!1),onFocus:()=>v(!0),ref:y,role:"separator",style:{flexBasis:"auto",cursor:s,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}function WY({className:e,direction:t,orientation:n,...r}){let i=n??t;return(0,eb.jsx)(WW,{"data-slot":"resizable-panel-group","data-orientation":i??"horizontal",orientation:i,className:tK("flex h-full w-full data-[orientation=vertical]:flex-col",e),...r})}function WX({...e}){return(0,eb.jsx)(WU,{"data-slot":"resizable-panel",...e})}function WZ({withHandle:e,className:t,...n}){return(0,eb.jsx)(WG,{"data-slot":"resizable-handle",className:tK("relative flex w-px items-center justify-center bg-border outline-none after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1 aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:after:left-0 aria-[orientation=horizontal]:after:h-1 aria-[orientation=horizontal]:after:w-full aria-[orientation=horizontal]:after:translate-x-0 aria-[orientation=horizontal]:after:-translate-y-1/2 [&[aria-orientation=horizontal]>div]:rotate-90",t),...n,children:e&&(0,eb.jsx)("div",{className:"z-10 flex h-4 w-3 items-center justify-center rounded-sm border bg-background",children:(0,eb.jsx)(HY,{className:"size-2.5"})})})}WG.displayName="Separator";let WJ=eN("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),WQ=eN("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),W0=eN("octagon-x",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 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-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]),W1=eN("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);var W2=e.i(21957);let W5=Array(12).fill(0),W4=({visible:e,className:t})=>ew.default.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ew.default.createElement("div",{className:"sonner-spinner"},W5.map((e,t)=>ew.default.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${t}`})))),W3=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ew.default.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),W6=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ew.default.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),W8=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ew.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),W7=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ew.default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),W9=ew.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ew.default.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ew.default.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),qe=1,qt=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...r}=e,i="number"==typeof(null==e?void 0:e.id)||(null==(t=e.id)?void 0:t.length)>0?e.id:qe++,a=this.toasts.find(e=>e.id===i),o=void 0===e.dismissible||e.dismissible;return this.dismissedToasts.has(i)&&this.dismissedToasts.delete(i),a?this.toasts=this.toasts.map(t=>t.id===i?(this.publish({...t,...e,id:i,title:n}),{...t,...e,id:i,dismissible:o,title:n}):t):this.addToast({title:n,...r,dismissible:o,id:i}),i},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(t=>t({id:e,dismiss:!0})))):this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{let n,r;if(!t)return;void 0!==t.loading&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:"function"!=typeof t.description?t.description:void 0}));let i=Promise.resolve(e instanceof Function?e():e),a=void 0!==r,o=i.then(async e=>{if(n=["resolve",e],ew.default.isValidElement(e))a=!1,this.create({id:r,type:"default",message:e});else if(qn(e)&&!e.ok){a=!1;let n="function"==typeof t.error?await t.error(`HTTP error! status: ${e.status}`):t.error,i="function"==typeof t.description?await t.description(`HTTP error! status: ${e.status}`):t.description,o="object"!=typeof n||ew.default.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:i,...o})}else if(e instanceof Error){a=!1;let n="function"==typeof t.error?await t.error(e):t.error,i="function"==typeof t.description?await t.description(e):t.description,o="object"!=typeof n||ew.default.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:i,...o})}else if(void 0!==t.success){a=!1;let n="function"==typeof t.success?await t.success(e):t.success,i="function"==typeof t.description?await t.description(e):t.description,o="object"!=typeof n||ew.default.isValidElement(n)?{message:n}:n;this.create({id:r,type:"success",description:i,...o})}}).catch(async e=>{if(n=["reject",e],void 0!==t.error){a=!1;let n="function"==typeof t.error?await t.error(e):t.error,i="function"==typeof t.description?await t.description(e):t.description,o="object"!=typeof n||ew.default.isValidElement(n)?{message:n}:n;this.create({id:r,type:"error",description:i,...o})}}).finally(()=>{a&&(this.dismiss(r),r=void 0),null==t.finally||t.finally.call(t)}),l=()=>new Promise((e,t)=>o.then(()=>"reject"===n[0]?t(n[1]):e(n[1])).catch(t));return"string"!=typeof r&&"number"!=typeof r?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(e,t)=>{let n=(null==t?void 0:t.id)||qe++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},qn=e=>e&&"object"==typeof e&&"ok"in e&&"boolean"==typeof e.ok&&"status"in e&&"number"==typeof e.status,qr=Object.assign((e,t)=>{let n=(null==t?void 0:t.id)||qe++;return qt.addToast({title:e,...t,id:n}),n},{success:qt.success,info:qt.info,warning:qt.warning,error:qt.error,custom:qt.custom,message:qt.message,promise:qt.promise,dismiss:qt.dismiss,loading:qt.loading},{getHistory:()=>qt.toasts,getToasts:()=>qt.getActiveToasts()});function qi(e){return void 0!==e.label}function qa(...e){return e.filter(Boolean).join(" ")}!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-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");let qo=e=>{var t,n,r,i,a,o,l,s,c,d,u,f,h;let{invert:p,toast:m,unstyled:g,interacting:v,setHeights:x,visibleToasts:y,heights:b,index:w,toasts:j,expanded:k,removeToast:S,defaultRichColors:C,closeButton:N,style:M,cancelButtonStyle:E,actionButtonStyle:O,className:P="",descriptionClassName:A="",duration:z,position:_,gap:I,expandByDefault:D,classNames:T,icons:R,closeButtonAriaLabel:L="Close toast"}=e,[$,F]=ew.default.useState(null),[V,B]=ew.default.useState(null),[H,W]=ew.default.useState(!1),[q,U]=ew.default.useState(!1),[K,G]=ew.default.useState(!1),[Y,X]=ew.default.useState(!1),[Z,J]=ew.default.useState(!1),[Q,ee]=ew.default.useState(0),[et,en]=ew.default.useState(0),er=ew.default.useRef(m.duration||z||4e3),ei=ew.default.useRef(null),ea=ew.default.useRef(null),eo=0===w,el=w+1<=y,es=m.type,ec=!1!==m.dismissible,ed=m.className||"",eu=m.descriptionClassName||"",ef=ew.default.useMemo(()=>b.findIndex(e=>e.toastId===m.id)||0,[b,m.id]),eh=ew.default.useMemo(()=>{var e;return null!=(e=m.closeButton)?e:N},[m.closeButton,N]),ep=ew.default.useMemo(()=>m.duration||z||4e3,[m.duration,z]),em=ew.default.useRef(0),eg=ew.default.useRef(0),ev=ew.default.useRef(0),ex=ew.default.useRef(null),[ey,eb]=_.split("-"),ej=ew.default.useMemo(()=>b.reduce((e,t,n)=>n>=ef?e:e+t.height,0),[b,ef]),ek=(()=>{let[e,t]=ew.default.useState(document.hidden);return ew.default.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",e),()=>window.removeEventListener("visibilitychange",e)},[]),e})(),eS=m.invert||p,eC="loading"===es;eg.current=ew.default.useMemo(()=>ef*I+ej,[ef,ej]),ew.default.useEffect(()=>{er.current=ep},[ep]),ew.default.useEffect(()=>{W(!0)},[]),ew.default.useEffect(()=>{let e=ea.current;if(e){let t=e.getBoundingClientRect().height;return en(t),x(e=>[{toastId:m.id,height:t,position:m.position},...e]),()=>x(e=>e.filter(e=>e.toastId!==m.id))}},[x,m.id]),ew.default.useLayoutEffect(()=>{if(!H)return;let e=ea.current,t=e.style.height;e.style.height="auto";let n=e.getBoundingClientRect().height;e.style.height=t,en(n),x(e=>e.find(e=>e.toastId===m.id)?e.map(e=>e.toastId===m.id?{...e,height:n}:e):[{toastId:m.id,height:n,position:m.position},...e])},[H,m.title,m.description,x,m.id,m.jsx,m.action,m.cancel]);let eN=ew.default.useCallback(()=>{U(!0),ee(eg.current),x(e=>e.filter(e=>e.toastId!==m.id)),setTimeout(()=>{S(m)},200)},[m,S,x,eg]);ew.default.useEffect(()=>{let e;if((!m.promise||"loading"!==es)&&m.duration!==1/0&&"loading"!==m.type){if(k||v||ek){if(ev.current<em.current){let e=new Date().getTime()-em.current;er.current=er.current-e}ev.current=new Date().getTime()}else er.current!==1/0&&(em.current=new Date().getTime(),e=setTimeout(()=>{null==m.onAutoClose||m.onAutoClose.call(m,m),eN()},er.current));return()=>clearTimeout(e)}},[k,v,m,es,ek,eN]),ew.default.useEffect(()=>{m.delete&&(eN(),null==m.onDismiss||m.onDismiss.call(m,m))},[eN,m.delete]);let eM=m.icon||(null==R?void 0:R[es])||(e=>{switch(e){case"success":return W3;case"info":return W8;case"warning":return W6;case"error":return W7;default:return null}})(es);return ew.default.createElement("li",{tabIndex:0,ref:ea,className:qa(P,ed,null==T?void 0:T.toast,null==m||null==(t=m.classNames)?void 0:t.toast,null==T?void 0:T.default,null==T?void 0:T[es],null==m||null==(n=m.classNames)?void 0:n[es]),"data-sonner-toast":"","data-rich-colors":null!=(d=m.richColors)?d:C,"data-styled":!(m.jsx||m.unstyled||g),"data-mounted":H,"data-promise":!!m.promise,"data-swiped":Z,"data-removed":q,"data-visible":el,"data-y-position":ey,"data-x-position":eb,"data-index":w,"data-front":eo,"data-swiping":K,"data-dismissible":ec,"data-type":es,"data-invert":eS,"data-swipe-out":Y,"data-swipe-direction":V,"data-expanded":!!(k||D&&H),"data-testid":m.testId,style:{"--index":w,"--toasts-before":w,"--z-index":j.length-w,"--offset":`${q?Q:eg.current}px`,"--initial-height":D?"auto":`${et}px`,...M,...m.style},onDragEnd:()=>{G(!1),F(null),ex.current=null},onPointerDown:e=>{2===e.button||eC||!ec||(ei.current=new Date,ee(eg.current),e.target.setPointerCapture(e.pointerId),"BUTTON"!==e.target.tagName&&(G(!0),ex.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e,t,n,r,i;if(Y||!ec)return;ex.current=null;let a=Number((null==(e=ea.current)?void 0:e.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),o=Number((null==(t=ea.current)?void 0:t.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),l=new Date().getTime()-(null==(n=ei.current)?void 0:n.getTime()),s="x"===$?a:o,c=Math.abs(s)/l;if(Math.abs(s)>=45||c>.11){ee(eg.current),null==m.onDismiss||m.onDismiss.call(m,m),"x"===$?B(a>0?"right":"left"):B(o>0?"down":"up"),eN(),X(!0);return}null==(r=ea.current)||r.style.setProperty("--swipe-amount-x","0px"),null==(i=ea.current)||i.style.setProperty("--swipe-amount-y","0px"),J(!1),G(!1),F(null)},onPointerMove:t=>{var n,r,i,a;if(!ex.current||!ec||(null==(n=window.getSelection())?void 0:n.toString().length)>0)return;let o=t.clientY-ex.current.y,l=t.clientX-ex.current.x,s=null!=(a=e.swipeDirections)?a:function(e){let[t,n]=e.split("-"),r=[];return t&&r.push(t),n&&r.push(n),r}(_);!$&&(Math.abs(l)>1||Math.abs(o)>1)&&F(Math.abs(l)>Math.abs(o)?"x":"y");let c={x:0,y:0},d=e=>1/(1.5+Math.abs(e)/20);if("y"===$){if(s.includes("top")||s.includes("bottom"))if(s.includes("top")&&o<0||s.includes("bottom")&&o>0)c.y=o;else{let e=o*d(o);c.y=Math.abs(e)<Math.abs(o)?e:o}}else if("x"===$&&(s.includes("left")||s.includes("right")))if(s.includes("left")&&l<0||s.includes("right")&&l>0)c.x=l;else{let e=l*d(l);c.x=Math.abs(e)<Math.abs(l)?e:l}(Math.abs(c.x)>0||Math.abs(c.y)>0)&&J(!0),null==(r=ea.current)||r.style.setProperty("--swipe-amount-x",`${c.x}px`),null==(i=ea.current)||i.style.setProperty("--swipe-amount-y",`${c.y}px`)}},eh&&!m.jsx&&"loading"!==es?ew.default.createElement("button",{"aria-label":L,"data-disabled":eC,"data-close-button":!0,onClick:eC||!ec?()=>{}:()=>{eN(),null==m.onDismiss||m.onDismiss.call(m,m)},className:qa(null==T?void 0:T.closeButton,null==m||null==(r=m.classNames)?void 0:r.closeButton)},null!=(u=null==R?void 0:R.close)?u:W9):null,(es||m.icon||m.promise)&&null!==m.icon&&((null==R?void 0:R[es])!==null||m.icon)?ew.default.createElement("div",{"data-icon":"",className:qa(null==T?void 0:T.icon,null==m||null==(i=m.classNames)?void 0:i.icon)},m.promise||"loading"===m.type&&!m.icon?m.icon||((null==R?void 0:R.loading)?ew.default.createElement("div",{className:qa(null==T?void 0:T.loader,null==m||null==(h=m.classNames)?void 0:h.loader,"sonner-loader"),"data-visible":"loading"===es},R.loading):ew.default.createElement(W4,{className:qa(null==T?void 0:T.loader,null==m||null==(f=m.classNames)?void 0:f.loader),visible:"loading"===es})):null,"loading"!==m.type?eM:null):null,ew.default.createElement("div",{"data-content":"",className:qa(null==T?void 0:T.content,null==m||null==(a=m.classNames)?void 0:a.content)},ew.default.createElement("div",{"data-title":"",className:qa(null==T?void 0:T.title,null==m||null==(o=m.classNames)?void 0:o.title)},m.jsx?m.jsx:"function"==typeof m.title?m.title():m.title),m.description?ew.default.createElement("div",{"data-description":"",className:qa(A,eu,null==T?void 0:T.description,null==m||null==(l=m.classNames)?void 0:l.description)},"function"==typeof m.description?m.description():m.description):null),ew.default.isValidElement(m.cancel)?m.cancel:m.cancel&&qi(m.cancel)?ew.default.createElement("button",{"data-button":!0,"data-cancel":!0,style:m.cancelButtonStyle||E,onClick:e=>{!qi(m.cancel)||ec&&(null==m.cancel.onClick||m.cancel.onClick.call(m.cancel,e),eN())},className:qa(null==T?void 0:T.cancelButton,null==m||null==(s=m.classNames)?void 0:s.cancelButton)},m.cancel.label):null,ew.default.isValidElement(m.action)?m.action:m.action&&qi(m.action)?ew.default.createElement("button",{"data-button":!0,"data-action":!0,style:m.actionButtonStyle||O,onClick:e=>{!qi(m.action)||(null==m.action.onClick||m.action.onClick.call(m.action,e),e.defaultPrevented||eN())},className:qa(null==T?void 0:T.actionButton,null==m||null==(c=m.classNames)?void 0:c.actionButton)},m.action.label):null)};function ql(){if("u"<typeof window||"u"<typeof document)return"ltr";let e=document.documentElement.getAttribute("dir");return"auto"!==e&&e?e:window.getComputedStyle(document.documentElement).direction}let qs=ew.default.forwardRef(function(e,t){let{id:n,invert:r,position:i="bottom-right",hotkey:a=["altKey","KeyT"],expand:o,closeButton:l,className:s,offset:c,mobileOffset:d,theme:u="light",richColors:f,duration:h,style:p,visibleToasts:m=3,toastOptions:g,dir:v=ql(),gap:x=14,icons:y,containerAriaLabel:b="Notifications"}=e,[w,j]=ew.default.useState([]),k=ew.default.useMemo(()=>n?w.filter(e=>e.toasterId===n):w.filter(e=>!e.toasterId),[w,n]),S=ew.default.useMemo(()=>Array.from(new Set([i].concat(k.filter(e=>e.position).map(e=>e.position)))),[k,i]),[C,N]=ew.default.useState([]),[M,E]=ew.default.useState(!1),[O,P]=ew.default.useState(!1),[A,z]=ew.default.useState("system"!==u?u:"u">typeof window&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),_=ew.default.useRef(null),I=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),D=ew.default.useRef(null),T=ew.default.useRef(!1),R=ew.default.useCallback(e=>{j(t=>{var n;return(null==(n=t.find(t=>t.id===e.id))?void 0:n.delete)||qt.dismiss(e.id),t.filter(({id:t})=>t!==e.id)})},[]);return ew.default.useEffect(()=>qt.subscribe(e=>{e.dismiss?requestAnimationFrame(()=>{j(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t))}):setTimeout(()=>{t3.default.flushSync(()=>{j(t=>{let n=t.findIndex(t=>t.id===e.id);return -1!==n?[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]:[e,...t]})})})}),[w]),ew.default.useEffect(()=>{if("system"!==u)return void z(u);if("system"===u&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?z("dark"):z("light")),"u"<typeof window)return;let e=window.matchMedia("(prefers-color-scheme: dark)");try{e.addEventListener("change",({matches:e})=>{e?z("dark"):z("light")})}catch(t){e.addListener(({matches:e})=>{try{e?z("dark"):z("light")}catch(e){console.error(e)}})}},[u]),ew.default.useEffect(()=>{w.length<=1&&E(!1)},[w]),ew.default.useEffect(()=>{let e=e=>{var t,n;a.every(t=>e[t]||e.code===t)&&(E(!0),null==(n=_.current)||n.focus()),"Escape"===e.code&&(document.activeElement===_.current||(null==(t=_.current)?void 0:t.contains(document.activeElement)))&&E(!1)};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a]),ew.default.useEffect(()=>{if(_.current)return()=>{D.current&&(D.current.focus({preventScroll:!0}),D.current=null,T.current=!1)}},[_.current]),ew.default.createElement("section",{ref:t,"aria-label":`${b} ${I}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},S.map((t,n)=>{var i;let a,[u,b]=t.split("-");return k.length?ew.default.createElement("ol",{key:t,dir:"auto"===v?ql():v,tabIndex:-1,ref:_,className:s,"data-sonner-toaster":!0,"data-sonner-theme":A,"data-y-position":u,"data-x-position":b,style:{"--front-toast-height":`${(null==(i=C[0])?void 0:i.height)||0}px`,"--width":"356px","--gap":`${x}px`,...p,...(a={},[c,d].forEach((e,t)=>{let n=1===t,r=n?"--mobile-offset":"--offset",i=n?"16px":"24px";function o(e){["top","right","bottom","left"].forEach(t=>{a[`${r}-${t}`]="number"==typeof e?`${e}px`:e})}"number"==typeof e||"string"==typeof e?o(e):"object"==typeof e?["top","right","bottom","left"].forEach(t=>{void 0===e[t]?a[`${r}-${t}`]=i:a[`${r}-${t}`]="number"==typeof e[t]?`${e[t]}px`:e[t]}):o(i)}),a)},onBlur:e=>{T.current&&!e.currentTarget.contains(e.relatedTarget)&&(T.current=!1,D.current&&(D.current.focus({preventScroll:!0}),D.current=null))},onFocus:e=>{!(e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible)&&(T.current||(T.current=!0,D.current=e.relatedTarget))},onMouseEnter:()=>E(!0),onMouseMove:()=>E(!0),onMouseLeave:()=>{O||E(!1)},onDragEnd:()=>E(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&"false"===e.target.dataset.dismissible||P(!0)},onPointerUp:()=>P(!1)},k.filter(e=>!e.position&&0===n||e.position===t).map((n,i)=>{var a,s;return ew.default.createElement(qo,{key:n.id,icons:y,index:i,toast:n,defaultRichColors:f,duration:null!=(a=null==g?void 0:g.duration)?a:h,className:null==g?void 0:g.className,descriptionClassName:null==g?void 0:g.descriptionClassName,invert:r,visibleToasts:m,closeButton:null!=(s=null==g?void 0:g.closeButton)?s:l,interacting:O,position:t,style:null==g?void 0:g.style,unstyled:null==g?void 0:g.unstyled,classNames:null==g?void 0:g.classNames,cancelButtonStyle:null==g?void 0:g.cancelButtonStyle,actionButtonStyle:null==g?void 0:g.actionButtonStyle,closeButtonAriaLabel:null==g?void 0:g.closeButtonAriaLabel,removeToast:R,toasts:k.filter(e=>e.position==n.position),heights:C.filter(e=>e.position==n.position),setHeights:N,expandByDefault:o,gap:x,expanded:M,swipeDirections:e.swipeDirections})})):null}))});function qc({className:e,position:t="top-right",closeButton:n=!0,richColors:r=!1,visibleToasts:i=4,toastOptions:a,...o}){let{theme:l="system"}=(0,W2.useTheme)();return(0,eb.jsx)(qs,{theme:l,position:t,closeButton:n,richColors:r,visibleToasts:i,className:tK("toaster group",e),icons:{success:(0,eb.jsx)(WJ,{className:"size-4"}),info:(0,eb.jsx)(vk,{className:"size-4"}),warning:(0,eb.jsx)(W1,{className:"size-4"}),error:(0,eb.jsx)(W0,{className:"size-4"}),loading:(0,eb.jsx)(WQ,{className:"size-4 animate-spin"})},toastOptions:{...a,classNames:{toast:"vtl-surface-popover group toast group-[.toaster]:rounded-[var(--surface-popover-radius)] group-[.toaster]:border group-[.toaster]:gap-3 group-[.toaster]:p-3",title:"group-[.toast]:text-sm group-[.toast]:font-medium",description:"group-[.toast]:text-sm group-[.toast]:text-muted-foreground",icon:"group-[.toast]:text-foreground",actionButton:"group-[.toast]:h-7 group-[.toast]:rounded-md group-[.toast]:bg-primary group-[.toast]:px-2 group-[.toast]:text-xs group-[.toast]:font-medium group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:h-7 group-[.toast]:rounded-md group-[.toast]:border group-[.toast]:border-border group-[.toast]:bg-background group-[.toast]:px-2 group-[.toast]:text-xs group-[.toast]:font-medium group-[.toast]:text-foreground",closeButton:"group-[.toast]:border-border group-[.toast]:bg-background group-[.toast]:text-muted-foreground",success:"group-[.toast]:text-foreground",info:"group-[.toast]:text-foreground",warning:"group-[.toast]:text-foreground",error:"group-[.toast]:text-foreground",loading:"group-[.toast]:text-foreground",...a?.classNames}},style:{"--normal-bg":"var(--surface-popover)","--normal-text":"var(--surface-popover-foreground)","--normal-border":"var(--surface-popover-border)","--border-radius":"var(--surface-popover-radius)"},...o})}var qd="Tabs",[qu,qf]=tX(qd,[vW]),qh=vW(),[qp,qm]=qu(qd),qg=ew.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o="horizontal",dir:l,activationMode:s="automatic",...c}=e,d=fb(l),[u,f]=t0({prop:r,onChange:i,defaultProp:a??"",caller:qd});return(0,eb.jsx)(qp,{scope:n,baseId:cR(),value:u,onValueChange:f,orientation:o,dir:d,activationMode:s,children:(0,eb.jsx)(ne.div,{dir:d,"data-orientation":o,...c,ref:t})})});qg.displayName=qd;var qv="TabsList",qx=ew.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=qm(qv,n),o=qh(n);return(0,eb.jsx)(vK,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,eb.jsx)(ne.div,{role:"tablist","aria-orientation":a.orientation,...i,ref:t})})});qx.displayName=qv;var qy="TabsTrigger",qb=ew.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=qm(qy,n),l=qh(n),s=qk(o.baseId,r),c=qS(o.baseId,r),d=r===o.value;return(0,eb.jsx)(vX,{asChild:!0,...l,focusable:!i,active:d,children:(0,eb.jsx)(ne.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":c,"data-state":d?"active":"inactive","data-disabled":i?"":void 0,disabled:i,id:s,...a,ref:t,onMouseDown:tZ(e.onMouseDown,e=>{i||0!==e.button||!1!==e.ctrlKey?e.preventDefault():o.onValueChange(r)}),onKeyDown:tZ(e.onKeyDown,e=>{[" ","Enter"].includes(e.key)&&o.onValueChange(r)}),onFocus:tZ(e.onFocus,()=>{let e="manual"!==o.activationMode;d||i||!e||o.onValueChange(r)})})})});qb.displayName=qy;var qw="TabsContent",qj=ew.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,l=qm(qw,n),s=qk(l.baseId,r),c=qS(l.baseId,r),d=r===l.value,u=ew.useRef(d);return ew.useEffect(()=>{let e=requestAnimationFrame(()=>u.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,eb.jsx)(t5,{present:i||d,children:({present:n})=>(0,eb.jsx)(ne.div,{"data-state":d?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":s,hidden:!n,id:c,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:u.current?"0s":void 0},children:n&&a})})});function qk(e,t){return`${e}-trigger-${t}`}function qS(e,t){return`${e}-content-${t}`}function qC({className:e,...t}){return(0,eb.jsx)(qx,{"data-slot":"tabs-list",className:tK("inline-flex h-8 items-center justify-center gap-0.5 rounded-lg bg-muted p-1 text-muted-foreground",e),...t})}function qN({className:e,...t}){return(0,eb.jsx)(qb,{"data-slot":"tabs-trigger",className:tK("inline-flex h-6 shrink-0 items-center justify-center gap-1.5 rounded-md px-2.5 text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:ring-2 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-xs [&_svg]:pointer-events-none [&_svg]:size-3.5 [&_svg]:shrink-0",e),...t})}function qM({className:e,...t}){return(0,eb.jsx)(qj,{"data-slot":"tabs-content",className:tK("mt-3 outline-none focus-visible:ring-2 focus-visible:ring-ring/50",e),...t})}qj.displayName=qw;let qE=HN.map(e=>({id:e.id,title:e.title,description:e.description,icon:e.icon,keywords:e.keywords}));function qO(e){return qE.find(t=>t.id===e)}function qP(e){return"subagent-conversation-panel"!==e.kind}let qA="application/vnd.vantaloom.agent-panel";function qz(e){let t=qP(e)?qO(e.kind):void 0,n={content:e};return{id:`agent-panel-${e.id}`,title:e.title,description:t?.description??("subagent-conversation-panel"===e.kind?"子代理运行信息流。":"来自 Agent 工作区的面板。"),meta:"Agent panel",icon:t?.icon,dragData:{"application/vnd.vantaloom.clip-kind":"agent-panel",[qA]:JSON.stringify(n)},payloads:{[qA]:n}}}let q_=eN("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]),qI=eN("corner-down-right",[["path",{d:"m15 10 5 5-5 5",key:"qqa56n"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]),qD=eN("paperclip",[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]),qT=eN("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);var qR=e=>e.graphicalItems.polarItems,qL=j$([MH,MW],Aw),q$=j$([qR,Ax,qL],AS),qF=j$([q$],AO),qV=j$([qF,Mv],Az),qB=j$([qV,Ax,q$],AI);j$([qV,Ax,q$],(e,t,n)=>n.length>0?e.flatMap(e=>n.flatMap(n=>{var r;return{value:kG(e,null!=(r=t.dataKey)?r:n.dataKey),errorDomain:[]}})).filter(Boolean):(null==t?void 0:t.dataKey)!=null?e.map(e=>({value:kG(e,t.dataKey),errorDomain:[]})):e.map(e=>({value:e,errorDomain:[]})));var qH=()=>void 0,qW=j$([qV,Ax,q$,A0,MH,Mw],A2),qq=j$([Ax,AZ,AJ,qH,qW,qH,ST,MH],zc),qU=j$([Ax,ST,qV,qB,MR,MH,qq],zf),qK=j$([qU,Ay,zp],zm),qG=j$([Ax,qU,qK,MH],zv);function qY(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 qX(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qY(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qY(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}j$([zp,qG],MJ);var qZ=j$([qR,(e,t)=>t],(e,t)=>e.filter(e=>"pie"===e.type).find(e=>e.id===t)),qJ=[],qQ=(e,t,n)=>(null==n?void 0:n.length)===0?qJ:n,q0=j$([Mv,qZ,qQ],(e,t,n)=>{var r,{chartData:i}=e;if(null!=t&&((r=(null==t?void 0:t.data)!=null&&t.data.length>0?t.data:i)&&r.length||null==n||(r=n.map(e=>qX(qX({},t.presentationProps),e.props))),null!=r))return r}),q1=j$([q0,qZ,qQ],(e,t,n)=>{if(null!=e&&null!=t)return e.map((e,r)=>{var i,a,o=kG(e,t.nameKey,t.name);return a=null!=n&&null!=(i=n[r])&&null!=(i=i.props)&&i.fill?n[r].props.fill:"object"==typeof e&&null!=e&&"fill"in e?e.fill:t.fill,{value:k6(o,t.dataKey),color:a,payload:e,type:t.legendType}})}),q2=j$([q0,qZ,qQ,Sl],(e,t,n,r)=>{if(null!=t&&null!=e)return function(e){var t,n,r,{pieSettings:i,displayedData:a,cells:o,offset:l}=e,{cornerRadius:s,startAngle:c,endAngle:d,dataKey:u,nameKey:f,tooltipType:h}=i,p=Math.abs(i.minAngle),m=b7(d-c)*Math.min(Math.abs(d-c),360),g=Math.abs(m),v=a.length<=1?0:null!=(t=i.paddingAngle)?t:0,x=a.filter(e=>0!==kG(e,u,0)).length,y=a.reduce((e,t)=>{var n=kG(t,u,0);return e+(wt(n)?n:0)},0),b=p>0&&y>0&&a.some(e=>{var t=kG(e,u,0),n=(wt(t)?t:0)/y;return 0!==t&&n*g<p})?p:0,w=g-x*b-(g>=360?x:x-1)*v;return y>0&&(n=a.map((e,t)=>{var n,a=kG(e,u,0),d=kG(e,f,t),p=((e,t,n)=>{var r,{top:i,left:a,width:o,height:l}=t,s=CM(o,l),c=a+wa(e.cx,o,o/2),d=i+wa(e.cy,l,l/2),u=wa(e.innerRadius,s,0);return{cx:c,cy:d,innerRadius:u,outerRadius:(r=e.outerRadius,"function"==typeof r?wa(r(n),s,.8*s):wa(r,s,.8*s)),maxRadius:e.maxRadius||Math.sqrt(o*o+l*l)/2}})(i,l,e),g=(wt(a)?a:0)/y,x=Ue(Ue({},e),o&&o[t]&&o[t].props),j=null!=x&&"fill"in x&&"string"==typeof x.fill?x.fill:i.fill,k=(n=t?r.endAngle+b7(m)*v*(0!==a):c)+b7(m)*((0!==a?b:0)+g*w),S=(n+k)/2,C=(p.innerRadius+p.outerRadius)/2,N=[{name:d,value:a,payload:x,dataKey:u,type:h,color:j,fill:j,graphicalItemId:i.id}],M=CN(p.cx,p.cy,C,S);return r=Ue(Ue(Ue(Ue({},i.presentationProps),{},{percent:g,cornerRadius:"string"==typeof s?parseFloat(s):s,name:d,tooltipPayload:N,midAngle:S,middleRadius:C,tooltipPosition:M},x),p),{},{value:a,dataKey:u,startAngle:n,endAngle:k,payload:x,paddingAngle:0!==a?b7(m)*v:0})})),n}({offset:r,pieSettings:t,displayedData:e,cells:n})}),q5=["key"],q4=["onMouseEnter","onClick","onMouseLeave"],q3=["id"],q6=["id"];function q8(){return(q8=Object.assign.bind()).apply(null,arguments)}function q7(e,t){if(null==e)return{};var n,r,i=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 a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function q9(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 Ue(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?q9(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):q9(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Ut(e){var t=(0,ew.useMemo)(()=>Ml(e.children,FV),[e.children]),n=wC(n=>q1(n,e.id,t));return null==n?null:ew.createElement(Dt,{legendPayload:n})}var Un=ew.memo(e=>{var{dataKey:t,nameKey:n,sectors:r,stroke:i,strokeWidth:a,fill:o,name:l,hide:s,tooltipType:c,id:d,activeShape:u}=e,f=function(e){if(null!=e&&"boolean"!=typeof e&&"function"!=typeof e){if(ew.isValidElement(e)){var t,n=null==(t=e.props)?void 0:t.fill;return"string"==typeof n?n:void 0}var{fill:r}=e;return"string"==typeof r?r:void 0}}(u),h={dataDefinedOnItem:r.map(e=>{var t=e.tooltipPayload;return null==f||null==t?t:t.map(e=>Ue(Ue({},e),{},{color:f,fill:f}))}),getPosition:e=>{var t;return null==(t=r[Number(e)])?void 0:t.tooltipPosition},settings:{stroke:i,strokeWidth:a,fill:o,dataKey:t,nameKey:n,name:k6(l,t),hide:s,type:c,color:o,unit:"",graphicalItemId:d}};return ew.createElement(IE,{tooltipEntrySettings:h})});function Ur(e){var{sectors:t,props:n,showLabels:r}=e,{label:i,labelLine:a,dataKey:o}=n;if(!r||!i||!t)return null;var l=wv(n),s=wx(i),c=wx(a),d="object"==typeof i&&"offsetRadius"in i&&"number"==typeof i.offsetRadius&&i.offsetRadius||20,u=t.map((e,t)=>{var n,r,u=(e.startAngle+e.endAngle)/2,f=CN(e.cx,e.cy,e.outerRadius+d,u),h=Ue(Ue(Ue(Ue({},l),e),{},{stroke:"none"},s),{},{index:t,textAnchor:(n=f.x)>(r=e.cx)?"start":n<r?"end":"middle"},f),p=Ue(Ue(Ue(Ue({},l),e),{},{fill:"none",stroke:e.fill},c),{},{index:t,points:[CN(e.cx,e.cy,e.outerRadius,u),f],key:"line"});return ew.createElement(ND,{zIndex:CE.label,key:"label-".concat(e.startAngle,"-").concat(e.endAngle,"-").concat(e.midAngle,"-").concat(t)},ew.createElement(SJ,null,a&&((e,t)=>{if(ew.isValidElement(e))return ew.cloneElement(e,t);if("function"==typeof e)return e(t);var n=eH("recharts-pie-label-line","boolean"!=typeof e?e.className:""),{key:r}=t,i=q7(t,q5);return ew.createElement(SG,q8({},i,{type:"linear",className:n}))})(a,p),((e,t,n)=>{if(ew.isValidElement(e))return ew.cloneElement(e,t);var r=n;if("function"==typeof e&&(r=e(t),ew.isValidElement(r)))return r;var i=eH("recharts-pie-label-text",Ld(e));return ew.createElement(Cj,q8({},t,{alignmentBaseline:"middle",className:i}),r)})(i,h,kG(e,o))))});return ew.createElement(SJ,{className:"recharts-pie-labels"},u)}function Ui(e){var{sectors:t,props:n,showLabels:r}=e,{label:i}=n;return"object"==typeof i&&null!=i&&"position"in i?ew.createElement(N9,{label:i}):ew.createElement(Ur,{sectors:t,props:n,showLabels:r})}function Ua(e){var{sectors:t,activeShape:n,inactiveShape:r,allOtherPieProps:i,shape:a,id:o}=e,l=wC(_7),s=wC(Ie),c=wC(It),{onMouseEnter:d,onClick:u,onMouseLeave:f}=i,h=q7(i,q4),p=F4(d,i.dataKey,o),m=F3(f),g=F6(u,i.dataKey,o);return null==t||0===t.length?null:ew.createElement(ew.Fragment,null,t.map((e,d)=>{if((null==e?void 0:e.startAngle)===0&&(null==e?void 0:e.endAngle)===0&&1!==t.length)return null;var u=null==c||c===o,f=String(d)===l&&(null==s||i.dataKey===s)&&u,v=n&&f?n:l?r:null,x=Ue(Ue({},e),{},{stroke:e.stroke,tabIndex:-1,[Sr]:d,[Si]:o});return ew.createElement(SJ,q8({key:"sector-".concat(null==e?void 0:e.startAngle,"-").concat(null==e?void 0:e.endAngle,"-").concat(e.midAngle,"-").concat(d),tabIndex:-1,className:"recharts-pie-sector"},b4(h,e,d),{onMouseEnter:p(e,d),onMouseLeave:m(e,d),onClick:g(e,d)}),ew.createElement(F0,q8({option:null!=a?a:v,index:d,shapeType:"sector",isActive:f},x)))}))}function Uo(e){var{showLabels:t,sectors:n,children:r}=e,i=(0,ew.useMemo)(()=>t&&n?n.map(e=>({value:e.value,payload:e.payload,clockWise:!1,parentViewBox:void 0,viewBox:{cx:e.cx,cy:e.cy,innerRadius:e.innerRadius,outerRadius:e.outerRadius,startAngle:e.startAngle,endAngle:e.endAngle,clockWise:!1},fill:e.fill})):[],[n,t]);return ew.createElement(N8,{value:t?i:void 0},r)}function Ul(e){var{props:t,previousSectorsRef:n,id:r}=e,{sectors:i,isAnimationActive:a,animationBegin:o,animationDuration:l,animationEasing:s,activeShape:c,inactiveShape:d,onAnimationStart:u,onAnimationEnd:f}=t,h=Dn(t,"recharts-pie-"),p=n.current,[m,g]=(0,ew.useState)(!1),v=(0,ew.useCallback)(()=>{"function"==typeof f&&f(),g(!1)},[f]),x=(0,ew.useCallback)(()=>{"function"==typeof u&&u(),g(!0)},[u]);return ew.createElement(Uo,{showLabels:!m,sectors:i},ew.createElement(DR,{animationId:h,begin:o,duration:l,isActive:a,easing:s,onAnimationStart:x,onAnimationEnd:v,key:h},e=>{var a,o=[],l=i&&i[0],s=null!=(a=null==l?void 0:l.startAngle)?a:0;return null==i||i.forEach((t,n)=>{var r=p&&p[n],i=n>0?(0,b3.default)(t,"paddingAngle",0):0;if(r){var a=wl(r.endAngle-r.startAngle,t.endAngle-t.startAngle,e),l=Ue(Ue({},t),{},{startAngle:s+i,endAngle:s+a+i});o.push(l),s=l.endAngle}else{var{endAngle:c,startAngle:d}=t,u=wl(0,c-d,e),f=Ue(Ue({},t),{},{startAngle:s+i,endAngle:s+u+i});o.push(f),s=f.endAngle}}),n.current=o,ew.createElement(SJ,null,ew.createElement(Ua,{sectors:o,activeShape:c,inactiveShape:d,allOtherPieProps:t,shape:t.shape,id:r}))}),ew.createElement(Ui,{showLabels:!m,sectors:i,props:t}),t.children)}var Us={animationBegin:400,animationDuration:1500,animationEasing:"ease",cx:"50%",cy:"50%",dataKey:"value",endAngle:360,fill:"#808080",hide:!1,innerRadius:0,isAnimationActive:"auto",label:!1,labelLine:!0,legendType:"rect",minAngle:0,nameKey:"name",outerRadius:"80%",paddingAngle:0,rootTabIndex:0,startAngle:0,stroke:"#fff",zIndex:CE.area};function Uc(e){var{id:t}=e,n=q7(e,q3),{hide:r,className:i,rootTabIndex:a}=e,o=(0,ew.useMemo)(()=>Ml(e.children,FV),[e.children]),l=wC(e=>q2(e,t,o)),s=(0,ew.useRef)(null),c=eH("recharts-pie",i);return r||null==l?(s.current=null,ew.createElement(SJ,{tabIndex:a,className:c})):ew.createElement(ND,{zIndex:e.zIndex},ew.createElement(Un,{dataKey:e.dataKey,nameKey:e.nameKey,sectors:l,stroke:e.stroke,strokeWidth:e.strokeWidth,fill:e.fill,name:e.name,hide:e.hide,tooltipType:e.tooltipType,id:t,activeShape:e.activeShape}),ew.createElement(SJ,{tabIndex:a,className:c},ew.createElement(Ul,{props:Ue(Ue({},n),{},{sectors:l}),previousSectorsRef:s,id:t})))}var Ud=function(e){var t=Cs(e,Us),{id:n}=t,r=q7(t,q6),i=wv(r);return ew.createElement(Da,{id:n,type:"pie"},e=>ew.createElement(ew.Fragment,null,ew.createElement(Dm,{type:"pie",id:e,data:r.data,dataKey:r.dataKey,hide:r.hide,angleAxisId:0,radiusAxisId:0,name:r.name,nameKey:r.nameKey,tooltipType:r.tooltipType,legendType:r.legendType,fill:r.fill,cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,paddingAngle:r.paddingAngle,minAngle:r.minAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius,cornerRadius:r.cornerRadius,presentationProps:i,maxRadius:t.maxRadius}),ew.createElement(Ut,q8({},r,{id:e})),ew.createElement(Uc,q8({},r,{id:e}))))};function Uu(e){var t=ww();return(0,ew.useEffect)(()=>{t(TX(e))},[t,e]),null}Ud.displayName="Pie";var Uf=["layout"];function Uh(){return(Uh=Object.assign.bind()).apply(null,arguments)}function Up(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}var Um=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Up(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Up(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}({accessibilityLayer:!0,stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index",layout:"radial",responsive:!1,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"},Rp),Ug=(0,ew.forwardRef)(function(e,t){var n,r=Cs(e.categoricalChartProps,Um),{layout:i}=r,a=function(e,t){if(null==e)return{};var n,r,i=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 a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}(r,Uf),{chartName:o,defaultTooltipEventType:l,validateTooltipEventTypes:s,tooltipPayloadSearcher:c}=e;return ew.createElement(Rk,{preloadedState:{options:{chartName:o,defaultTooltipEventType:l,validateTooltipEventTypes:s,tooltipPayloadSearcher:c,eventEmitter:void 0}},reduxStoreName:null!=(n=r.id)?n:o},ew.createElement(RS,{chartData:r.data}),ew.createElement(RC,{layout:i,margin:r.margin}),ew.createElement(RM,{throttleDelay:r.throttleDelay,throttledEvents:r.throttledEvents}),ew.createElement(RN,{baseValue:void 0,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(Uu,{cx:r.cx,cy:r.cy,startAngle:r.startAngle,endAngle:r.endAngle,innerRadius:r.innerRadius,outerRadius:r.outerRadius}),ew.createElement(R8,Uh({},a,{ref:t})))});function Uv(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 Ux(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Uv(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Uv(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var Uy=["item"],Ub=Ux(Ux({},Um),{},{layout:"centric",startAngle:0,endAngle:360}),Uw=(0,ew.forwardRef)((e,t)=>{var n=Cs(e,Ub);return ew.createElement(Ug,{chartName:"PieChart",defaultTooltipEventType:"item",validateTooltipEventTypes:Uy,tooltipPayloadSearcher:Ts,categoricalChartProps:n,ref:t})});let Uj={placeholder:"Ask the agent to inspect, change, or explain this workspace...",mode:"Mode",model:"Model",attach:"Attach context",removeChip:"Remove context",queuedMessage:"Queued message",guideQueuedMessage:"Guide",removeQueuedMessage:"Remove queued message",moreQueuedMessageActions:"More queued message actions",contextUsage:"Context usage",contextUsed:"used",contextTokenSummary:"used {used} / {total}",toolCalls:"Tool calls",userMessages:"User messages",otherContext:"Other context",compressContext:"Compress context",send:"Run",stop:"Stop"},Uk=[{id:"agent",label:"Agent",description:"Use tools and make changes.",icon:(0,eb.jsx)(yt,{className:"fill-current"})},{id:"planner",label:"Planner",description:"Plan before changing files.",icon:(0,eb.jsx)(BG,{})},{id:"reviewer",label:"Reviewer",description:"Inspect risks and regressions.",icon:(0,eb.jsx)(mR,{})}],US=[{id:"gpt-5.5",label:"GPT-5.5",description:"Highest quality coding agent."},{id:"gpt-5.4",label:"GPT-5.4",description:"Balanced everyday work."},{id:"gpt-5.4-mini",label:"GPT-5.4 Mini",description:"Fast lightweight passes."}];function UC(e){if(e)return"string"==typeof e.label||"number"==typeof e.label?String(e.label):e.id}function UN({value:e,defaultValue:t,onValueChange:n,modes:r=Uk,modeId:i,defaultModeId:a,onModeChange:o,models:l=US,modelId:s,defaultModelId:c,onModelChange:d,queuedMessages:u,defaultQueuedMessages:f=[],onQueuedMessagesChange:h,onQueueMessage:p,onRemoveQueuedMessage:m,queueOnTab:g=!0,renderQueuedMessageActions:v,contextUsage:x,chips:y=[],actions:b,footer:w,running:j=!1,disabled:k=!1,submitOnEnter:S=!0,minRows:C=2,maxRows:N=7,onSubmit:M,onStop:E,onAttach:O,labels:P,className:A,textareaClassName:z,toolbarClassName:_}){let I={...Uj,...P},D=ew.useRef(null),T=ew.useId(),R=ew.useRef(0),[L,$]=function({value:e,defaultValue:t="",onChange:n}){let[r,i]=ew.useState(t);return[e??r,ew.useCallback(t=>{void 0===e&&i(t),n?.(t)},[n,e])]}({value:e,defaultValue:t,onChange:n}),[F,V]=ew.useState(f),[B,H]=ew.useState(a??r[0]?.id),[W,q]=ew.useState(c??l[0]?.id),U=i??B,K=s??W,G=r.find(e=>e.id===U)??r[0],Y=l.find(e=>e.id===K)??l[0],X=u??F,Z=L.trim().length>0&&!k;function J(){Z&&(M?.({value:L,modeId:G?.id,modelId:Y?.id}),$(""))}function Q(e){void 0===u&&V(e),h?.(e)}return ew.useLayoutEffect(()=>{let e=D.current;if(!e)return;e.style.height="0px";let t=Number.parseFloat(getComputedStyle(e).lineHeight),n=Number.isFinite(t)?t*N:160;e.style.height=`${Math.min(e.scrollHeight,n)}px`,e.style.overflowY=e.scrollHeight>n?"auto":"hidden"},[N,L]),(0,eb.jsxs)("div",{"data-slot":"agent-input-composer","data-running":j,className:tK("relative grid w-full",A),children:[X.length>0&&(0,eb.jsx)(UO,{messages:X,labels:I,renderActions:v,onRemove:function(e){let t=X.find(t=>t.id===e);if(!t)return;let n=X.filter(t=>t.id!==e);Q(n),m?.(e,t,n)}}),(0,eb.jsxs)("div",{"data-slot":"agent-input-composer-surface",className:tK("vtl-agent-input-composer-surface relative grid w-full gap-2 rounded-lg border border-border p-2 shadow-sm transition-colors"),children:[y.length>0&&(0,eb.jsx)("div",{"data-slot":"agent-input-composer-context",className:"flex min-w-0 flex-wrap items-center gap-1.5",children:y.map(e=>(0,eb.jsx)(UP,{chip:e,removeLabel:I.removeChip},e.id))}),(0,eb.jsx)("textarea",{ref:D,value:L,disabled:k,rows:C,placeholder:I.placeholder,"data-slot":"agent-input-composer-textarea",className:tK("min-h-10 w-full resize-none border-0 bg-transparent px-0.5 py-0 text-sm leading-5 text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-60","[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",z),onChange:e=>$(e.currentTarget.value),onKeyDown:e=>{g&&"Tab"===e.key&&!e.shiftKey&&!e.nativeEvent.isComposing&&function(){let e=L.trim();if(!e||k)return!1;R.current+=1;let t={id:`${T}-queued-${R.current}`,content:e},n=[...X,t];return Q(n),p?.(t,n),$(""),!0}()?e.preventDefault():!S||"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),J())}}),(0,eb.jsxs)("div",{"data-slot":"agent-input-composer-toolbar",className:tK("grid grid-cols-[minmax(0,1fr)_auto] items-end gap-2",_),children:[(0,eb.jsxs)("div",{className:"flex min-w-0 flex-wrap items-center gap-1.5",children:[(0,eb.jsx)(UA,{label:I.mode,options:r,value:G?.id,trigger:(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{className:"grid size-3.5 place-items-center text-muted-foreground [&_svg]:size-3",children:G?.icon??(0,eb.jsx)(yt,{className:"fill-current"})}),(0,eb.jsx)("span",{className:"truncate",children:UC(G)}),(0,eb.jsx)(cE,{className:"size-3 text-muted-foreground"})]}),triggerClassName:"rounded-md bg-transparent px-1.5 text-muted-foreground hover:bg-muted/60 hover:text-foreground aria-expanded:bg-muted/70",onSelect:function(e){e.disabled||(void 0===i&&H(e.id),o?.(e.id,e))}}),(0,eb.jsx)(UA,{label:I.model,options:l,value:Y?.id,trigger:(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{className:"truncate",children:UC(Y)}),(0,eb.jsx)(cE,{className:"size-3 text-muted-foreground"})]}),triggerClassName:"rounded-md bg-transparent px-1.5 text-muted-foreground hover:bg-muted/60 hover:text-foreground aria-expanded:bg-muted/70",onSelect:function(e){e.disabled||(void 0===s&&q(e.id),d?.(e.id,e))}}),O&&(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs",className:"text-muted-foreground","aria-label":I.attach,title:I.attach,onClick:O,disabled:k,children:(0,eb.jsx)(qD,{})}),b]}),(0,eb.jsxs)("div",{className:"flex items-center gap-1",children:[x&&(0,eb.jsx)(UE,{usage:x,labels:I}),(0,eb.jsx)(tY,{type:"button",size:"icon-xs",variant:j?"outline":"default","aria-label":j?I.stop:I.send,title:j?I.stop:I.send,disabled:!j&&!Z,className:"rounded-full",onClick:j?E:J,children:j?(0,eb.jsx)(qT,{className:"size-3 fill-current"}):(0,eb.jsx)(q_,{className:"size-3.5"})})]})]}),w&&(0,eb.jsx)("div",{"data-slot":"agent-input-composer-footer",className:"flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:w})]})]})}function UM(e){return e>=1e6?`${(e/1e6).toFixed(e>=1e7?0:1)}m`:e>=1e3?`${Math.round(e/1e3)}k`:e.toLocaleString()}function UE({usage:e,labels:t}){let[n,r]=ew.useState(!1),i=Math.max(0,e.used),a=Math.max(0,e.total),o=a>0?Math.min(100,Math.round(i/a*100)):0,l=Math.max(0,e.toolCalls),s=Math.max(0,e.userMessages),c=Math.max(0,e.other??Math.max(0,i-l-s)),d=[{name:"toolCalls",value:l,fill:"var(--color-toolCalls)"},{name:"userMessages",value:s,fill:"var(--color-userMessages)"},{name:"other",value:c,fill:"var(--color-other)"},{name:"unused",value:Math.max(0,a-i),fill:"var(--muted)"}].filter(e=>e.value>0),u=t.contextTokenSummary.replace("{used}",UM(i)).replace("{total}",UM(a)),f={toolCalls:{label:t.toolCalls,color:"var(--chart-1)"},userMessages:{label:t.userMessages,color:"var(--chart-3)"},other:{label:t.otherContext,color:"var(--chart-5)"}};return(0,eb.jsxs)(gE,{children:[(0,eb.jsx)(gz,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs",className:"text-muted-foreground","aria-label":`${t.contextUsage}: ${o}% ${t.contextUsed}`,title:`${t.contextUsage}: ${o}% ${t.contextUsed}`,children:(0,eb.jsx)("span",{"aria-hidden":"true",className:"grid size-4 place-items-center rounded-full",style:{background:`conic-gradient(var(--foreground) ${3.6*o}deg, var(--border) 0deg)`},children:(0,eb.jsx)("span",{className:"size-3 rounded-full bg-background dark:bg-popover"})})})}),(0,eb.jsxs)(gq,{side:"top",align:"center",sideOffset:8,className:"w-44 gap-2 p-3",children:[(0,eb.jsxs)("div",{className:"grid gap-0.5 text-center",children:[(0,eb.jsx)("div",{className:"text-sm font-medium text-muted-foreground",children:e.label??t.contextUsage}),(0,eb.jsxs)("div",{className:"text-sm text-muted-foreground",children:[o,"% ",t.contextUsed]}),(0,eb.jsx)("div",{className:"text-sm font-medium",children:u})]}),(0,eb.jsx)("div",{className:"grid justify-center",children:(0,eb.jsx)(Fb,{config:f,className:"h-20 w-20",initialDimension:{width:80,height:80},onMouseMove:()=>r(!0),onMouseLeave:()=>r(!1),children:(0,eb.jsxs)(Uw,{children:[(0,eb.jsx)(Fj,{active:n,content:(0,eb.jsx)(Fk,{hideLabel:!0})}),(0,eb.jsx)(Ud,{data:d.length>0?d:[{name:"other",value:1,fill:"var(--muted)"}],dataKey:"value",nameKey:"name",innerRadius:25,outerRadius:35,isAnimationActive:!1,strokeWidth:0})]})})}),(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"sm",className:"w-full",onClick:e.onCompress,disabled:!e.onCompress,children:t.compressContext})]})]})}function UO({messages:e,labels:t,renderActions:n,onRemove:r}){return(0,eb.jsx)("div",{"data-slot":"agent-input-composer-queue",className:"vtl-agent-input-composer-queue z-10 mx-5 mb-[-1px] grid gap-1.5 rounded-t-lg rounded-b-none border border-border p-1.5 shadow-xs",children:e.map((e,i)=>(0,eb.jsxs)("div",{"data-slot":"agent-input-composer-queue-item",className:tK("group/queue flex min-h-8 min-w-0 items-center gap-2 rounded-md px-2 text-sm transition-colors",e.disabled?"text-muted-foreground opacity-60":"text-foreground hover:bg-muted/60"),children:[(0,eb.jsx)("span",{className:"grid size-4 shrink-0 place-items-center text-muted-foreground [&_svg]:size-3.5",children:e.icon??(0,eb.jsx)(qI,{})}),(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate",title:String(e.content),children:e.content}),e.meta&&(0,eb.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:e.meta}),(0,eb.jsxs)("div",{className:"flex shrink-0 items-center gap-0.5 opacity-70 transition-opacity group-hover/queue:opacity-100",children:[n?.(e),(0,eb.jsxs)(tY,{type:"button",variant:"ghost",size:"xs",className:"h-6 gap-1 px-1.5 text-muted-foreground","aria-label":`${t.guideQueuedMessage} ${i+1}`,children:[(0,eb.jsx)(qI,{className:"size-3.5"}),t.guideQueuedMessage]}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs",className:"size-6 text-muted-foreground","aria-label":`${t.removeQueuedMessage} ${i+1}`,onClick:()=>r(e.id),children:(0,eb.jsx)(m2,{})}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs",className:"size-6 text-muted-foreground","aria-label":`${t.moreQueuedMessageActions} ${i+1}`,children:(0,eb.jsx)(s6,{})})]})]},e.id))})}function UP({chip:e,removeLabel:t}){return(0,eb.jsxs)(cI,{variant:"secondary","data-tone":e.tone,className:tK("h-6 max-w-full gap-1 rounded-md border border-border bg-muted/70 px-1.5 text-muted-foreground","success"===e.tone&&"border-primary/25 bg-primary/10 text-foreground","warning"===e.tone&&"border-destructive/25 bg-destructive/10 text-foreground"),children:[e.icon&&(0,eb.jsx)("span",{className:"grid size-3.5 shrink-0 place-items-center [&_svg]:size-3",children:e.icon}),(0,eb.jsx)("span",{className:"truncate",children:e.label}),e.onRemove&&(0,eb.jsx)("button",{type:"button",className:"-mr-0.5 grid size-4 shrink-0 place-items-center rounded-sm text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:outline-none","aria-label":`${t} ${e.id}`,onClick:()=>e.onRemove?.(e.id),children:(0,eb.jsx)(p6,{className:"size-3"})})]})}function UA({label:e,options:t,value:n,trigger:r,triggerClassName:i,onSelect:a}){return(0,eb.jsxs)(yu,{children:[(0,eb.jsx)(yh,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"xs",className:tK("h-6 max-w-40 gap-1 rounded-md px-1.5 text-xs font-medium",i),children:r})}),(0,eb.jsx)(yk,{align:"start","aria-label":"string"==typeof e?e:void 0,className:"min-w-40 p-1",children:t.map(e=>(0,eb.jsxs)(yS,{disabled:e.disabled,className:"h-8 gap-2 px-2 text-sm",onSelect:()=>a(e),children:[(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.label}),(0,eb.jsx)(nv,{className:tK("ml-auto size-4 text-foreground",n===e.id?"opacity-100":"opacity-0")})]},e.id))})]})}function Uz(e,t,n,r){return[{id:`${t}-task-${e}`,kind:"user",title:n},...r.map(n=>({...n,id:`${t}-${n.id}-${e}`}))]}function U_(e){return[{id:`read-materials-${e}`,kind:"read",actionLabel:"读取",title:"AgentWorkspace.tsx, styles.css, i18n.json",files:[{id:`workspace-${e}`,name:"AgentWorkspace.tsx",lines:"1-480"},{id:`styles-${e}`,name:"styles.css",lines:"265-820"},{id:`i18n-${e}`,name:"i18n.json",lines:"245-292"}]},{id:`search-actions-${e}`,kind:"search",actionLabel:"搜索",title:"workspace creation, sidebar tree, streaming output",files:[{id:`workspace-search-${e}`,name:"AgentWorkspace.tsx",lines:"64-190"},{id:`style-search-a-${e}`,name:"styles.css",lines:"540-670"},{id:`style-search-b-${e}`,name:"styles.css",lines:"705-790"}]},{id:`subagents-${e}`,kind:"subagent",actionLabel:"召唤",title:"子代理",subagents:[{id:`reader-${e}`,title:"阅读子代理",activity:"阅读 package.json",toolActivities:["读取 package.json","检查 workspace 脚本","整理依赖信息"],status:"阅读 package.json",detail:"package.json 已读取,正在整理脚本与依赖信息。",isRunning:!0,events:Uz(e,"reader","阅读 package.json",[{id:"read-package",kind:"read",actionLabel:"读取",title:"package.json",files:[{id:"package-json",name:"package.json",lines:"1-96"}]},{id:"reader-note",kind:"done",title:"已读取 package.json。\n\n- 已记录 workspace 脚本\n- 已检查 UI 与 app 包依赖\n- 下一步等待主代理合并上下文"}])},{id:`searcher-${e}`,title:"搜索子代理",activity:"搜索 AgentWorkspace.tsx",toolActivities:["搜索 AgentWorkspace.tsx","筛选面板布局","定位事件流接入"],status:"搜索 AgentWorkspace.tsx",detail:"AgentWorkspace.tsx 命中 3 处候选区域,正在筛选可复用结构。",isRunning:!0,events:Uz(e,"searcher","搜索 AgentWorkspace.tsx",[{id:"search-workspace",kind:"search",actionLabel:"搜索",title:"AgentWorkspace.tsx",files:[{id:"agent-workspace-a",name:"AgentWorkspace.tsx",lines:"64-190"},{id:"agent-workspace-b",name:"AgentWorkspace.tsx",lines:"320-418"}]},{id:"searcher-note",kind:"done",title:"已定位 AgentWorkspace.tsx 的面板布局与事件流接入位置。"}])},{id:`verifier-${e}`,title:"验证子代理",activity:"验证工作流状态",toolActivities:["验证对话流","验证右侧面板","检查子代理切换"],status:"验证工作流状态",detail:"工作流状态正在校验,等待主代理提交最终结果。",isRunning:!0,events:Uz(e,"verifier","验证工作流状态",[{id:"verify-flow",kind:"verify",actionLabel:"验证",title:"对话流、右侧面板、子代理切换"},{id:"verifier-note",kind:"done",title:"验证队列已建立,等待主代理继续写入真实结果。"}])}]},{id:`think-structure-${e}`,kind:"thought",actionLabel:"思考",title:"8s",status:"done"},{id:`plan-${e}`,kind:"done",title:"**收到新的编织请求。**\n\n我会先保留当前工作台样式,只用占位文本演示真实任务流:读取、搜索、思考、编辑和验证都会按顺序进入同一条文字流。\n\n- 左侧织布机由真实创建动作产生\n- 编织物初始保持为空\n- 文件读取项仍然可以展开\n- 点击文件名会继续打开右侧标签页"},{id:`edit-workspace-${e}`,kind:"change",actionLabel:"编辑",title:"AgentWorkspace.tsx",additions:44,deletions:16},{id:`edit-style-${e}`,kind:"change",actionLabel:"编辑",title:"styles.css",additions:36,deletions:12},{id:`verify-flow-${e}`,kind:"verify",actionLabel:"验证",title:"empty sidebar, new loom creation, placeholder workflow"},{id:`done-${e}`,kind:"done",title:"演示工作流已完成。\n\n这只是前端占位演示,后续可以直接把事件流替换成真实 agent runtime。"}]}let UI=[{id:"user-1",kind:"user",title:"345"},...U_("1"),{id:"user-2",kind:"user",title:"234"}],UD=eN("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);function UT({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"agent-message-actions",className:tK("flex items-center gap-1.5 text-muted-foreground",e),...t})}function UR({className:e,...t}){return(0,eb.jsx)(tY,{size:"icon-xs",variant:"ghost",className:e,...t})}function UL(e,t=1/0){let n=[],r=0;for(;r<e.length;){if(e.startsWith("**",r)){let i=e.indexOf("**",r+2),a=-1===i?e.slice(r+2):e.slice(r+2,i);a.length>0&&n.push((0,eb.jsx)("strong",{children:UL(a,t-r-2)},`strong-${r}`)),r=-1===i?e.length:i+2;continue}if("`"===e[r]){let i=e.indexOf("`",r+1),a=-1===i?e.slice(r+1):e.slice(r+1,i);a.length>0&&n.push((0,eb.jsx)("code",{children:UL(a,t-r-1)},`code-${r}`)),r=-1===i?e.length:i+1;continue}let i=[e.indexOf("**",r),e.indexOf("`",r)].filter(e=>e>=0).sort((e,t)=>e-t)[0]??e.length;!function(e,t,n,r,i){if(!t)return;let a=n+t.length;if(r<=n)return e.push((0,eb.jsx)("span",{className:"vtl-agent-stream-fade-text",children:t},`${i}-fade-${n}`));if(r>=a)return e.push(t);let o=r-n;e.push(t.slice(0,o)),e.push((0,eb.jsx)("span",{className:"vtl-agent-stream-fade-text",children:t.slice(o)},`${i}-fade-${n}`))}(n,e.slice(r,i),r,t,`text-${r}`),r=i}return n}function U$(e){return/^\s*[-*]\s+/.test(e)}function UF(e){return/^#{1,6}\s+/.test(e.trim())}function UV(e){return/^\s*([-*_])(?:\s*\1){2,}\s*$/.test(e)}function UB(e){return e.includes("|")&&e.trim().split("|").length>=3}function UH(e){return/^\s*\|?\s*:?-{3,}:?\s*(\|\s*:?-{3,}:?\s*)+\|?\s*$/.test(e)}function UW(e){return e.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(e=>e.trim())}function Uq({content:e,isStreaming:t=!1}){let n=function(e){let t=e.replace(/\r\n/g,"\n").split("\n"),n=[],r=0;for(let e of t)n.push(r),r+=e.length+1;let i=[],a=0;for(;a<t.length;){let e=t[a]??"",r=e.trim(),o=n[a]??0;if(!r){a+=1;continue}if(r.startsWith("```")){let e=[];for(a+=1;a<t.length&&!(t[a]??"").trim().startsWith("```");)e.push(t[a]??""),a+=1;a<t.length&&(a+=1),i.push({kind:"code",text:e.join("\n"),start:o});continue}if(UV(e)){i.push({kind:"hr",start:o}),a+=1;continue}if(UF(e)){let e=/^(#{1,6})\s+(.+)$/.exec(r),t=e?.[1]??"##";i.push({kind:"heading",depth:t.length,text:e?.[2]??r,start:o}),a+=1;continue}if(UB(e)&&a+1<t.length&&UH(t[a+1]??"")){let n=UW(e),r=[];for(a+=2;a<t.length&&UB(t[a]??"");)r.push(UW(t[a]??"")),a+=1;i.push({kind:"table",headers:n,rows:r,start:o});continue}if(U$(e)){let e=[];for(;a<t.length&&U$(t[a]??"");)e.push({text:(t[a]??"").replace(/^\s*[-*]\s+/,""),start:n[a]??0}),a+=1;i.push({kind:"list",items:e,start:o});continue}let l=[];for(;a<t.length;){let e=t[a]??"",n=t[a+1]??"";if(!e.trim()||e.trim().startsWith("```")||UV(e)||UF(e)||U$(e)||UB(e)&&UH(n))break;l.push(e),a+=1}i.push({kind:"paragraph",lines:l,start:o})}return i}(e),r=t?Math.max(0,e.length-14):1/0;return(0,eb.jsx)("div",{className:"vtl-agent-markdown",children:n.map((e,t)=>{let n=r-e.start;return"code"===e.kind?(0,eb.jsx)("pre",{children:e.text},`block-${t}`):"hr"===e.kind?(0,eb.jsx)("hr",{},`block-${t}`):"heading"===e.kind?e.depth<=2?(0,eb.jsx)("h3",{children:UL(e.text,n)},`block-${t}`):(0,eb.jsx)("h4",{children:UL(e.text,n)},`block-${t}`):"list"===e.kind?(0,eb.jsx)("ul",{children:e.items.map((e,t)=>(0,eb.jsx)("li",{children:UL(e.text,r-e.start)},`${e.text}-${t}`))},`block-${t}`):"table"===e.kind?(0,eb.jsx)("div",{className:"vtl-agent-markdown-table",children:(0,eb.jsxs)("table",{children:[(0,eb.jsx)("thead",{children:(0,eb.jsx)("tr",{children:e.headers.map((e,t)=>(0,eb.jsx)("th",{children:UL(e,n)},`${e}-${t}`))})}),(0,eb.jsx)("tbody",{children:e.rows.map((t,r)=>(0,eb.jsx)("tr",{children:e.headers.map((e,i)=>(0,eb.jsx)("td",{children:UL(t[i]??"",n)},`cell-${r}-${i}`))},`row-${r}`))})]})},`block-${t}`):(0,eb.jsx)("p",{children:UL(e.lines.map(e=>e.trim()).join(" "),n)},`block-${t}`)})})}function UU(e){return("assistant"===e.kind||"done"===e.kind)&&"模型没有返回内容。"===e.title.trim()&&!e.detail?.trim()}function UK(e){return!UU(e)}function UG({events:e,labels:t,bottomInset:n=16,className:r,contentClassName:i,onOpenFile:a,onOpenSubagent:o,onRecallUserMessage:l,onBranchUserMessage:s}){let c=ew.useRef(null),d=ew.useRef(!0),[u,f]=ew.useState(0),[h,p]=ew.useState(0),[m,g]=ew.useState({}),v=ew.useMemo(()=>e.filter(UK),[e]);ew.useLayoutEffect(()=>{let e=c.current;if(!e)return;function t(){p(e.clientHeight)}t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]);let x=ew.useMemo(()=>v.reduce((e,t,n)=>{var r;let i=m[U8(t,n)]??("user"===(r=t).kind?72:"assistant"===r.kind||"done"===r.kind?Math.max(42,Math.min(260,28+22*Math.ceil((r.title.length+(r.detail?.length??0))/68))):"read"===r.kind||"search"===r.kind?r.files?.length?28+26*Math.min(r.files.length,5):26:"subagent"===r.kind?r.subagents?.length?6+24*Math.min(r.subagents.length,6):42:"change"===r.kind?42:r.detail?54:26);return e.rows.push({event:t,index:n,offset:e.totalHeight,height:i}),e.totalHeight+=i,e},{rows:[],totalHeight:0}),[m,v]),y=x.rows.filter(e=>e.offset+e.height>=u-360&&e.offset<=u+Math.max(h,520)+360),b=x.totalHeight+Math.max(0,n);ew.useLayoutEffect(()=>{let e=c.current;e&&v.length&&d.current&&(e.scrollTop=e.scrollHeight,f(e.scrollTop))},[n,v.length,b]);let w=ew.useCallback((e,t)=>{g(n=>1>Math.abs((n[e]??0)-t)?n:{...n,[e]:t})},[]);return(0,eb.jsx)("div",{ref:c,"data-slot":"agent-conversation-flow",className:tK("min-h-0 flex-1 overflow-auto px-4 pt-4 opacity-100 transition-opacity duration-180 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",r),onScroll:function(){let e=c.current;e&&(d.current=e.scrollHeight-e.scrollTop-e.clientHeight<96,f(e.scrollTop))},children:(0,eb.jsx)("div",{className:tK("relative mx-auto min-h-full w-full max-w-[48rem]",i),style:{height:b},children:y.map(e=>(0,eb.jsx)(UY,{event:e.event,rowKey:U8(e.event,e.index),offset:e.offset,labels:t,onMeasure:w,onOpenFile:a,onOpenSubagent:o,onRecallUserMessage:l,onBranchUserMessage:s},U8(e.event,e.index)))})})}function UY({event:e,rowKey:t,offset:n,labels:r,onMeasure:i,onOpenFile:a,onOpenSubagent:o,onRecallUserMessage:l,onBranchUserMessage:s}){let c=ew.useRef(null);return ew.useLayoutEffect(()=>{let e=c.current;if(!e)return;function n(){i(t,Math.ceil(e.getBoundingClientRect().height))}n();let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[e.id,i,t]),(0,eb.jsx)("div",{ref:c,"data-index":e.id,className:"absolute inset-x-0 top-0",style:{transform:`translateY(${n}px)`},children:(0,eb.jsx)(UX,{event:e,labels:r,onOpenFile:a,onOpenSubagent:o,onRecallUserMessage:l,onBranchUserMessage:s})})}function UX({event:e,labels:t,onOpenFile:n,onOpenSubagent:r,onRecallUserMessage:i,onBranchUserMessage:a}){return"user"===e.kind?(0,eb.jsxs)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:[(0,eb.jsx)("div",{className:"vtl-agent-user-message-wrap",children:(0,eb.jsx)("div",{className:"vtl-agent-user-message",children:e.title})}),(i||a)&&(0,eb.jsxs)(UT,{className:"absolute top-1/2 right-2 opacity-0 transition-opacity focus-within:opacity-100 hover:opacity-100",children:[i&&(0,eb.jsx)(UR,{type:"button","aria-label":t?.recall??"召回",title:t?.recall??"召回",onClick:()=>i(e),children:(0,eb.jsx)(UD,{})}),a&&(0,eb.jsx)(UR,{type:"button","aria-label":t?.branch??"分支",title:t?.branch??"分支",onClick:()=>a(e),children:(0,eb.jsx)(FN,{})})]})]}):"assistant"===e.kind||"done"===e.kind?UU(e)?null:(0,eb.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,eb.jsx)("div",{"data-streaming":e.isStreaming?"true":"false",children:(0,eb.jsx)(Uq,{content:e.detail?`${e.title}
|
|
17
17
|
|
|
18
|
-
${e.detail}`:e.title,isStreaming:e.isStreaming})})}):("read"===e.kind||"search"===e.kind)&&e.files?.length?(0,eb.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,eb.jsxs)(UU,{event:e,children:[(0,eb.jsx)("div",{className:"vtl-agent-read-file-list","data-open":"true",children:e.files.map(e=>{var t;return(0,eb.jsx)("button",{type:"button",onClick:()=>n?.(e),children:(0,eb.jsxs)("span",{className:"truncate",children:[(t=e.name).split(/[\\/]/).filter(Boolean).at(-1)??t,e.lines??e.meta?(0,eb.jsx)("em",{children:e.lines??e.meta}):null]})},e.id??`${e.name}-${e.lines??e.path??""}`)})}),e.detail?(0,eb.jsx)("div",{className:"vtl-agent-thought-detail mt-2",children:(0,eb.jsx)(U$,{content:e.detail})}):null]})}):"subagent"===e.kind&&e.subagents?.length?(0,eb.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,eb.jsx)(UH,{event:e,onOpenSubagent:r})}):"change"===e.kind?(0,eb.jsx)(UK,{event:e}):"thought"===e.kind?(0,eb.jsx)(Uq,{event:e,labels:t}):(0,eb.jsx)(UW,{event:e})}function UH({event:e,onOpenSubagent:t}){let[n,r]=ew.useState(()=>new Set);return(0,eb.jsx)("div",{className:"vtl-agent-subagent-tool-list",children:e.subagents?.map(i=>{let a=n.has(i.id),o=function(e){if(e.toolActivities?.length)return e.toolActivities;let t=e.events?.filter(e=>"read"===e.kind||"search"===e.kind||"verify"===e.kind||"change"===e.kind||"tool"===e.kind).map(e=>[e.actionLabel,e.title].filter(Boolean).join(" ").trim()).filter(Boolean)??[];return t.length?t:[e.activity??e.status??e.title]}(i),l=i.isRunning&&o.length>1?[...o,o[0]]:o;return(0,eb.jsxs)("section",{className:"vtl-agent-subagent-tool","data-expanded":a?"true":"false","data-running":i.isRunning?"true":void 0,children:[(0,eb.jsx)("button",{type:"button",className:"vtl-agent-subagent-tool-trigger","aria-expanded":a,onClick:()=>{r(e=>{let t=new Set(e);return t.has(i.id)?t.delete(i.id):t.add(i.id),t})},children:(0,eb.jsxs)("span",{className:"vtl-agent-subagent-tool-title",children:[e.actionLabel?(0,eb.jsx)("strong",{children:e.actionLabel}):null,i.title,(0,eb.jsx)("i",{"aria-hidden":"true"})]})}),(0,eb.jsx)("div",{className:"vtl-agent-subagent-tool-detail",children:(0,eb.jsx)("button",{type:"button",className:"vtl-agent-subagent-tool-info",style:{"--activity-count":o.length,"--activity-frame-count":l.length},onClick:()=>t?.(i,e),children:(0,eb.jsx)("span",{className:"vtl-agent-subagent-tool-info-stack",children:l.map((e,t)=>(0,eb.jsxs)("span",{className:"vtl-agent-subagent-tool-info-line",children:["正在 ",e]},`${i.id}-${e}-${t}`))})})})]},i.id)})})}function UW({event:e}){return(0,eb.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,eb.jsxs)("p",{className:"vtl-agent-action-line",children:[e.actionLabel?(0,eb.jsx)("strong",{children:e.actionLabel}):null,e.title,e.meta?(0,eb.jsx)("em",{children:e.meta}):null]})})}function Uq({event:e,labels:t}){let[n,r]=ew.useState(!1),i=!!e.detail?.trim(),a=e.title||t?.thinking||"思考中";return(0,eb.jsxs)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:[(0,eb.jsxs)("button",{type:"button",className:"vtl-agent-thought-line","data-streaming":e.isStreaming?"true":"false","aria-expanded":n,onClick:()=>i&&r(e=>!e),children:[(0,eb.jsx)("span",{children:a}),e.meta?(0,eb.jsx)("em",{children:e.meta}):null]}),i?(0,eb.jsx)("div",{className:tK("grid overflow-hidden transition-[grid-template-rows,opacity,transform] duration-200 ease-out",n?"translate-y-0 grid-rows-[1fr] opacity-100":"-translate-y-1 grid-rows-[0fr] opacity-0"),children:(0,eb.jsx)("div",{className:"min-h-0 overflow-hidden",children:(0,eb.jsx)("div",{className:"vtl-agent-thought-detail",children:(0,eb.jsx)(U$,{content:e.detail??"",isStreaming:e.isStreaming})})})}):null]})}function UU({event:e,children:t}){let[n,r]=ew.useState(!1);return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsxs)("button",{type:"button",className:"vtl-agent-event-read-line",onClick:()=>r(e=>!e),"aria-expanded":n,children:[(0,eb.jsx)("span",{children:e.actionLabel?e.actionLabel:null}),e.title]}),(0,eb.jsx)("div",{className:tK("grid overflow-hidden transition-[grid-template-rows,opacity,transform] duration-200 ease-out",n?"translate-y-0 grid-rows-[1fr] opacity-100":"-translate-y-1 grid-rows-[0fr] opacity-0"),children:(0,eb.jsx)("div",{className:"min-h-0 overflow-hidden",children:t})})]})}function UK({event:e}){return(0,eb.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,eb.jsxs)("button",{type:"button",className:"vtl-agent-change-row",children:[(0,eb.jsxs)("span",{children:[e.actionLabel?(0,eb.jsx)("strong",{children:e.actionLabel}):null,e.title]}),"number"==typeof e.additions||"number"==typeof e.deletions?(0,eb.jsxs)("em",{children:["number"==typeof e.additions?(0,eb.jsxs)("b",{"data-kind":"add",children:["+",e.additions]}):null,"number"==typeof e.deletions?(0,eb.jsxs)("b",{"data-kind":"delete",children:["-",e.deletions]}):null]}):e.meta?(0,eb.jsx)("em",{children:e.meta}):null]})})}function UG(e,t){return`${e.id}-${t}`}eN("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),eq("vtl-dot-matrix-loader",{variants:{size:{xs:"[--vtl-dot-size:3px] [--vtl-dot-gap:3px]",sm:"[--vtl-dot-size:3.5px] [--vtl-dot-gap:3.5px]",default:"[--vtl-dot-size:4px] [--vtl-dot-gap:4px]",lg:"[--vtl-dot-size:5px] [--vtl-dot-gap:5px]",xl:"[--vtl-dot-size:6px] [--vtl-dot-gap:6px]"},tone:{default:"text-current",muted:"text-muted-foreground",primary:"text-primary",inverse:"text-primary-foreground"},variant:{pulse:"vtl-dot-matrix-loader-pulse",wave:"vtl-dot-matrix-loader-wave",orbit:"vtl-dot-matrix-loader-orbit",binary:"vtl-dot-matrix-loader-binary"}},defaultVariants:{size:"default",tone:"default",variant:"pulse"}}),eq("animate-spin",{variants:{size:{xs:"size-3",sm:"size-3.5",default:"size-4",lg:"size-5",xl:"size-6"},variant:{default:"text-current",muted:"text-muted-foreground",primary:"text-primary"}},defaultVariants:{size:"default",variant:"default"}});let UY="max-w-[42.5rem]";function UX({className:e,composerClassName:t,initialEvents:n,events:r,models:i,modelId:a,running:o,disabled:l,onEventsChange:s,onModelChange:c,onSubmit:d,onOpenSubagent:u}){let f=r??n??UI,[h,p]=ew.useState(f),m=ew.useRef(0),g=ew.useRef(f),v=ew.useRef([]),x=ew.useRef(null),[y,b]=ew.useState(168),w=ew.useId().replace(/[^a-zA-Z0-9_-]/g,""),j=r??h;function k(e){let t=e(g.current);g.current=t,void 0===r&&p(t),s?.(t)}function S(e,t){let n=window.setTimeout(t,e);v.current.push(n)}return ew.useLayoutEffect(()=>{let e=x.current;if(!e)return;function t(){b(Math.ceil(e.getBoundingClientRect().height))}t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),ew.useEffect(()=>{g.current=j},[j]),ew.useEffect(()=>()=>{v.current.forEach(e=>window.clearTimeout(e)),v.current=[]},[]),(0,eb.jsxs)("section",{className:tK("vtl-agent-conversation-panel relative flex size-full min-h-0 min-w-0 flex-col overflow-hidden bg-transparent",e),children:[(0,eb.jsx)(UF,{events:j,bottomInset:y+16,contentClassName:tK(UY,t),onOpenSubagent:e=>u?.(e),labels:{recall:"召回",branch:"分支",expand:"展开",collapse:"收起",completed:"完成",thinking:"运行中"}}),(0,eb.jsx)("div",{ref:x,className:"pointer-events-none absolute inset-x-0 bottom-0 z-20 flex justify-center px-4 pb-4",children:(0,eb.jsx)("div",{className:tK("vtl-agent-composer-dock pointer-events-auto relative w-full",UY,t),children:(0,eb.jsx)(UN,{className:"relative z-10 w-full",submitOnEnter:!0,running:o,disabled:l,minRows:1,maxRows:8,modes:[{id:"agent",label:"Agent",disabled:!0},{id:"chat",label:"Chat"}],modeId:"chat",models:i,modelId:a,onModelChange:e=>c?.(e),chips:[{id:"workspace",label:"Vantaloom-ui",tone:"success"},{id:"machine",label:"Studio-PC",tone:"muted"}],contextUsage:{used:139e3,total:258e3,toolCalls:52e3,userMessages:77e3,other:1e4},labels:{placeholder:"请问",mode:"模式",model:"模型",attach:"添加上下文",removeChip:"移除上下文",queuedMessage:"待发送消息",guideQueuedMessage:"引导",removeQueuedMessage:"移除待发送消息",moreQueuedMessageActions:"更多待发送消息操作",contextUsage:"上下文用量",contextUsed:"已用",contextTokenSummary:"已用 {used} / {total}",toolCalls:"工具调用",userMessages:"用户信息",otherContext:"系统/其他",compressContext:"压缩上下文",send:"发送",stop:"停止"},onSubmit:function(e){let t,n,r=e.value.trim();if(!r)return;if(d)return void d({value:r,modeId:e.modeId??"chat",modelId:e.modelId??a});m.current+=1;let i=`${w}-${m.current}`,o=`user-${i}`;k(e=>[...e,{id:o,kind:"user",title:r}]),t=U_(i),n=180,t.forEach(e=>{if("done"===e.kind){var t,r,i;let a,o,l=e.title;S(n,()=>{k(t=>[...t,{...e,title:"",isStreaming:!0,status:"running"}])}),t=e.id,r=l,i=n+120,a=Math.max(4,Math.ceil(r.length/36)),o=0,S(i,function e(){o=Math.min(r.length,o+a),k(e=>e.map(e=>e.id===t?{...e,title:r.slice(0,o),isStreaming:o<r.length,status:o<r.length?"running":"done"}:e)),o<r.length&&S(42,e)}),n+=Math.min(2200,Math.max(900,18*l.length))+260;return}S(n,()=>{k(t=>[...t,e])}),n+="thought"===e.kind?520:300})}})})})]})}let UZ=eN("file-plus-corner",[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]]);function UJ(e,t){var n;let r,i="base64"===e.encoding;return{name:e.name,path:e.path,machineId:e.machine.id,language:(n=e.path,/\.([^.\\/]+)$/.exec(n)?.[1]?.toLowerCase()),kind:t,mimeType:e.mimeType,size:e.size,src:i&&!e.truncated?(r=e.mimeType||"application/octet-stream",`data:${r};base64,${e.content}`):void 0,truncated:e.truncated}}function UQ(e){let t=encodeURIComponent(e.path).replace(/%/g,"").replace(/[^a-z0-9_-]/gi,"-").slice(0,96);return`file-${e.machine.id}-${t||"file"}-${Date.now()}`}async function U0(e){var t,n;let r,i=await HI(e.machineId,e.path),a=(t=i.kind,n=i.mimeType,r=n?.toLowerCase()??"","image"===t||r.startsWith("image/")?"image":"video"===t||r.startsWith("video/")?"video":r.includes("html")?"html":r.includes("markdown")?"markdown":"text"===t||"code"===t?"code":"binary"),o="base64"===i.encoding;return{id:UQ(i),kind:"file-tab-viewer",title:i.name,file:UJ(i,a),defaultValue:o?"":i.content,defaultView:"image"===a||"video"===a?"preview":"code",defaultMode:"review"}}async function U1(e){let t=await HI(e.machineId,e.path);return{id:UQ(t),kind:"data-table-tab-viewer",title:t.name,file:UJ(t,"text"),defaultValue:"utf-8"===t.encoding?t.content:""}}let U2={title:"Explorer",search:"Search files...",newFile:"New file",newFolder:"New folder",refresh:"Refresh",collapseAll:"Collapse all",rename:"Rename",delete:"Delete",copyPath:"Copy path",open:"Open",empty:"No files yet.",noResults:"No matching files.",loading:"Loading..."};function U5(e){return"folder"===e.kind||!!e.children||!!e.hasChildren}function U4(e){return`${e.name} ${e.path}`.toLowerCase()}function U3(e,t){if(e&&t)return U6(e.children,t)}function U6(e,t){for(let n of e){if(n.id===t)return n;let e=n.children?U6(n.children,t):void 0;if(e)return e}}function U8(e,t){return e?t.map(t=>U6(e.children,t)).filter(e=>!!e):[]}function U7(e,t){let n=e.includes("\\")?"\\":"/";return e.endsWith("\\")||e.endsWith("/")?`${e}${t}`:`${e}${n}${t}`}function U9(e,t,n){return e.map(e=>e.id===t?n(e):e.children?{...e,children:U9(e.children,t,n)}:e)}function Ke(e,t){return e.filter(e=>!t.has(e.id)).map(e=>({...e,children:e.children?Ke(e.children,t):void 0}))}function Kt(e,t){return e.some(e=>e.id===t||!!(e.children&&Kt(e.children,t)))}function Kn(e,t){let n=U7(t,e.name);return{...e,path:n,children:e.children?.map(e=>Kn(e,n))}}function Kr(e,t,n){let[r,i]=ew.useState(t??n);return[e??r,i]}function Ki({roots:e,defaultRoots:t,activeRootId:n,defaultActiveRootId:r,activeNodeId:i,defaultActiveNodeId:a,selectedIds:o,defaultSelectedIds:l,expandedIds:s,defaultExpandedIds:c,searchValue:d,defaultSearchValue:u,loadingIds:f,labels:h,allowMultiSelect:p=!0,allowCreateFile:m=!0,allowCreateFolder:g=!0,allowRename:v=!0,allowDelete:x=!0,allowDragAndDrop:y=!0,allowBoxSelect:b=!0,openFilesOnSingleClick:w=!0,showSearch:j=!0,showToolbar:k=!0,compact:S=!1,onActiveRootChange:C,onActiveNodeChange:N,onSelectionChange:M,onExpandedChange:E,onSearchValueChange:O,onOpenNode:P,onLoadChildren:A,onCreateNode:z,onRenameNode:_,onDeleteNodes:I,onMoveNodes:D,onCopyPath:T,onRefresh:R,className:L,sidebarClassName:$,style:F}){let V={...U2,...h},B=ew.useRef(null),H=ew.useRef(void 0),W=ew.useRef([]),[q,U]=ew.useState(()=>(t??[]).map(e=>({...e,children:function e(t){return t.map(t=>({...t,children:t.children?e(t.children):void 0}))}(e.children)}))),K=e??q,G=K[0]?.id,[Y,X]=ew.useState(r??G),Z=n??Y??G,J=K.find(e=>e.id===Z)??K[0],[Q,ee]=ew.useState(a),et=i??Q,[en,er]=Kr(o,l,a?[a]:[]),[ei,ea]=Kr(s,c,G?[G]:[]),[eo,el]=ew.useState(u??""),es=d??eo,[ec,ed]=ew.useState(),[eu,ef]=ew.useState(""),[eh,ep]=ew.useState([]),[em,eg]=ew.useState(),[ev,ex]=ew.useState(),ey=ew.useRef(0),ej=ew.useMemo(()=>new Set(f),[f]),ek=ew.useMemo(()=>new Set(ei),[ei]),eS=ew.useMemo(()=>new Set(en),[en]),eC=U3(J,et),eN=es.trim().length>0;function eM(t){e||U(e=>t(e))}function eE(e){void 0===s&&ea(e),E?.(e)}function eO(e){void 0===o&&er(e),M?.({root:J,node:e.at(-1)?U3(J,e.at(-1)):void 0,nodes:U8(J,e)})}function eP(e){void 0===i&&ee(e?.id),N?.(e)}async function eA(e){if(U5(e)&&J){if(ek.has(e.id))return void eE(ei.filter(t=>t!==e.id));if(A&&e.hasChildren&&!e.children){let t=await A(e,J);eM(n=>n.map(n=>n.id===J.id?{...n,children:U9(n.children,e.id,e=>({...e,children:t}))}:n))}eE([...ei,e.id])}}function ez(e){var t;t=e.id,void 0===n&&X(t),C?.(t),ek.has(e.id)?eE(ei.filter(t=>t!==e.id)):eE([...ei,e.id])}function e_(e,t){if(e.disabled)return;let n=p&&(t?.metaKey||t?.ctrlKey)?eS.has(e.id)?en.filter(t=>t!==e.id):[...en,e.id]:[e.id];eP(e),eO(n)}function eI(e){J&&!e.disabled&&P?.(e,J)}function eD(e){if(!J)return;let t=eC&&U5(eC)?eC:J,n="folder"===e?"untitled-folder":"untitled.ts";ey.current+=1;let r={id:`created-${ey.current}`,name:n,path:U7(t.path,n),kind:"folder"===e?"folder":"code",children:"folder"===e?[]:void 0};z?.(t,e,n),eM(e=>e.map(e=>{var n,i;return e.id!==J.id?e:"children"in t&&"platform"in t?{...e,children:[r,...e.children]}:{...e,children:(n=e.children,i=t.id,U9(n,i,e=>({...e,children:[r,...e.children??[]],hasChildren:!0})))}})),eE([...new Set([...ei,t.id])]),eP(r),eO([r.id]),ed(r.id),ef(r.name)}function eT(e){!v||e.disabled||e.readonly||(ed(e.id),ef(e.name))}function eR(e){let t=eu.trim();ed(void 0),t&&t!==e.name&&(_?.(e,t),eM(n=>n.map(n=>n.id===J?.id?{...n,children:U9(n.children,e.id,e=>{let n,r,i;return{...e,name:t,path:U7((r=(n=e.path.replace(/[\\/]+$/,"")).includes("\\")?"\\":"/",(i=n.lastIndexOf(r))<=0?n:n.slice(0,i)),t)}})}:n)))}function eL(e,t){if(!J||!y||e.disabled||ev)return void t.preventDefault();let n=eS.has(e.id)?en:[e.id];eS.has(e.id)||(eO([e.id]),eP(e)),ep(n),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",n.join(","))}function e$(e,t){if(!y||0===eh.length)return;t.preventDefault(),t.dataTransfer.dropEffect="move";let n=t.currentTarget.getBoundingClientRect(),r=(t.clientY-n.top)/n.height,i=r<.3?"before":r>.7?"after":U5(e)?"inside":"after";eg({targetId:e.id,position:i})}function eF(e,t){t.preventDefault(),em?.targetId===e.id&&function(e,t){let n;if(!J||0===eh.length||!y)return;let r=(n=new Set(eh),U8(J,eh).filter(e=>!Array.from(n).some(t=>{var n,r;let i;return t!==e.id&&(n=J.children,r=e.id,i=U6(n,t),!!(i?.children&&Kt(i.children,r)))})));if(0===r.length||r.some(t=>t.id===e.id||!!(t.children&&Kt(t.children,e.id))))return;let i=new Set(r.map(e=>e.id)),a="inside"!==t||U5(e)?t:"after";D?.({root:J,nodes:r,target:e,position:a}),eM(t=>t.map(t=>{if(t.id!==J.id)return t;let n=function e(t,n,r,i,a){let o=!1,l=[];for(let s of t){if(s.id===n){if("before"===r){l.push(...i.map(e=>Kn(e,a))),l.push(s),o=!0;continue}if("after"===r){l.push(s),l.push(...i.map(e=>Kn(e,a))),o=!0;continue}if("inside"===r){l.push({...s,children:[...i.map(e=>Kn(e,s.path)),...s.children??[]],hasChildren:!0}),o=!0;continue}}if(s.children){let t=e(s.children,n,r,i,s.path);l.push({...s,children:t.nodes}),o=o||t.inserted}else l.push(s)}return{nodes:l,inserted:o}}(Ke(t.children,i),e.id,a,r,t.path);return{...t,children:n.inserted?n.nodes:t.children}})),"inside"===a&&eE([...new Set([...ei,e.id])]),eO(r.map(e=>e.id)),eP(r[0])}(e,em.position),eg(void 0),ep([])}function eV(e){let t=B.current;if(!t||!J)return;let n=Math.min(e.startX,e.currentX),r=Math.max(e.startX,e.currentX),i=Math.min(e.startY,e.currentY),a=Math.max(e.startY,e.currentY),o=Array.from(t.querySelectorAll("[data-file-tree-node-id]")).filter(e=>{let t=e.getBoundingClientRect();return t.left<r&&t.right>n&&t.top<a&&t.bottom>i}).map(e=>e.dataset.fileTreeNodeId).filter(e=>!!e);if(o.length>0){eO(Array.from(new Set([...W.current,...o])));let e=U3(J,o.at(-1));e&&eP(e)}}return ew.useEffect(()=>{n||Y||!G||X(G)},[n,G,Y]),(0,eb.jsxs)("div",{ref:B,"data-slot":"file-tree-panel",className:tK("vtl-surface-panel relative flex min-h-[28rem] w-full max-w-sm flex-col overflow-hidden rounded-[var(--surface-panel-radius)] border",L),style:F,onPointerDown:function(e){let t=e.target;if(!b||!p||!e.ctrlKey||0!==e.button||t.closest("input, textarea, [data-file-tree-ignore-box]"))return;e.preventDefault();let n=e.currentTarget.getBoundingClientRect();H.current=e.pointerId,W.current=en,e.currentTarget.setPointerCapture(e.pointerId),ex({startX:e.clientX,startY:e.clientY,currentX:e.clientX,currentY:e.clientY,panelLeft:n.left,panelTop:n.top})},onPointerMove:function(e){if(!ev||H.current!==e.pointerId)return;e.preventDefault();let t={...ev,currentX:e.clientX,currentY:e.clientY};ex(t),eV(t)},onPointerUp:function(e){ev&&H.current===e.pointerId&&(eV(ev),ex(void 0),W.current=[],H.current=void 0)},onPointerCancel:()=>{ex(void 0),W.current=[],H.current=void 0},children:[k&&(0,eb.jsxs)("div",{"data-file-tree-ignore-box":!0,className:"flex h-10 shrink-0 items-center gap-1 border-b px-2",children:[(0,eb.jsx)("div",{className:"mr-auto min-w-0 truncate px-1 text-sm font-medium",children:V.title}),m&&(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":V.newFile,onClick:()=>eD("file"),children:(0,eb.jsx)(s7,{})}),g&&(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":V.newFolder,onClick:()=>eD("folder"),children:(0,eb.jsx)(vy,{})}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":V.refresh,onClick:()=>J&&R?.(J),children:(0,eb.jsx)(vC,{})}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":V.collapseAll,onClick:function(){eE(J?[J.id]:[])},children:(0,eb.jsx)(p6,{})})]}),j&&(0,eb.jsx)("div",{"data-file-tree-ignore-box":!0,className:"shrink-0 border-b p-2",children:(0,eb.jsxs)(yO,{className:"h-7 rounded-md",children:[(0,eb.jsx)(yA,{align:"inline-start",className:"pl-2",children:(0,eb.jsx)(cz,{className:"size-3.5"})}),(0,eb.jsx)(yz,{value:es,onChange:e=>{var t;return t=e.target.value,void(void 0===d&&el(t),O?.(t))},placeholder:V.search,className:"h-7 text-xs"})]})}),(0,eb.jsx)(f1,{className:tK("min-h-0 flex-1",$),"data-slot":"file-tree-panel-scroll",children:(0,eb.jsxs)("div",{className:tK("py-1",S&&"py-0.5"),children:[0===K.length&&(0,eb.jsx)("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:V.empty}),K.map(e=>(0,eb.jsx)(Ka,{root:e,activeRoot:J,labels:V,expandedSet:ek,selectedSet:eS,activeNodeId:et,searchValue:es,loadingSet:ej,compact:S,renamingId:ec,renamingName:eu,allowRename:v,allowDelete:x,allowDragAndDrop:y,openFilesOnSingleClick:w,draggingIds:eh,dropTarget:em,hasSearch:eN,onRootToggle:ez,onNodeToggle:e=>void eA(e),onNodeSelect:e_,onNodeOpen:eI,onStartRename:eT,onRenamingNameChange:ef,onCommitRename:eR,onCancelRename:()=>ed(void 0),onDelete:e=>(function(e){if(!x||0===e.length||!J)return;I?.(e);let t=new Set(e.map(e=>e.id));eM(e=>e.map(e=>e.id===J.id?{...e,children:Ke(e.children,t)}:e)),eO(en.filter(e=>!t.has(e))),et&&t.has(et)&&eP(void 0)})(function(e){if(eS.has(e.id)){let t=U8(J,en);return t.length>0?t:[e]}return[e]}(e)),onCopyPath:e=>T?.(e),onDragStart:eL,onDragOver:e$,onDragEnd:()=>{ep([]),eg(void 0)},onDrop:eF},e.id))]})}),ev&&(0,eb.jsx)(Kc,{box:ev})]})}function Ka({root:e,activeRoot:t,labels:n,expandedSet:r,selectedSet:i,activeNodeId:a,searchValue:o,loadingSet:l,compact:s,renamingId:c,renamingName:d,allowRename:u,allowDelete:f,allowDragAndDrop:h,openFilesOnSingleClick:p,draggingIds:m,dropTarget:g,hasSearch:v,onRootToggle:x,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:C,onDelete:N,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A}){let z=r.has(e.id),_=o.trim().toLowerCase(),I=v?e.children.filter(e=>Kf(e,_)):e.children;return(0,eb.jsxs)("section",{"data-slot":"file-tree-root",className:"min-w-0",children:[(0,eb.jsxs)("button",{type:"button",className:tK("group flex h-7 w-full items-center gap-1 px-2 text-left text-xs font-medium text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground",t?.id===e.id&&"text-foreground"),onClick:()=>x(e),children:[(0,eb.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center",children:z?(0,eb.jsx)(cE,{className:"size-3.5"}):(0,eb.jsx)(vo,{className:"size-3.5"})}),(0,eb.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center [&_svg]:size-3.5",children:e.icon??(0,eb.jsx)(vx,{})}),(0,eb.jsx)("span",{className:"truncate uppercase tracking-wide",children:e.name})]}),(z||v)&&(0,eb.jsxs)("div",{children:[l.has(e.id)&&(0,eb.jsx)("div",{className:"px-8 py-2 text-xs text-muted-foreground",children:n.loading}),!l.has(e.id)&&0===I.length&&(0,eb.jsx)("div",{className:"px-8 py-2 text-xs text-muted-foreground",children:v?n.noResults:n.empty}),I.map(t=>(0,eb.jsx)(Ko,{node:t,root:e,depth:0,labels:n,expandedSet:r,selectedSet:i,activeNodeId:a,searchValue:_,loadingSet:l,compact:s,renamingId:c,renamingName:d,allowRename:u,allowDelete:f,allowDragAndDrop:h,openFilesOnSingleClick:p,draggingIds:m,dropTarget:g,hasSearch:v,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:C,onDelete:N,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A},t.id))]})]})}function Ko({node:e,root:t,depth:n,labels:r,expandedSet:i,selectedSet:a,activeNodeId:o,searchValue:l,loadingSet:s,compact:c,renamingId:d,renamingName:u,allowRename:f,allowDelete:h,allowDragAndDrop:p,openFilesOnSingleClick:m,draggingIds:g,dropTarget:v,hasSearch:x,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:C,onDelete:N,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A}){let z=U5(e),_=i.has(e.id),I=a.has(e.id),D=o===e.id,T=d===e.id,R=s.has(e.id),L=g.includes(e.id),$=v?.targetId===e.id&&"inside"!==v.position,F=v?.targetId===e.id&&"inside"===v.position,V=e.children??[],B=x?V.filter(e=>Kf(e,l)):V,H=!x||U4(e).includes(l),W=(_||x)&&B.length>0,q=8+14*n;if(x&&!H&&0===B.length)return null;let U=(0,eb.jsxs)("div",{"data-slot":"file-tree-row","data-file-tree-node-id":e.id,"data-active":D?"true":void 0,"data-selected":I?"true":void 0,draggable:p&&!T&&!e.disabled,className:tK("group/tree-row relative flex w-full items-center gap-1 pr-1 text-left text-xs transition-colors",c?"h-6":"h-7",I||D?"bg-muted text-foreground":"text-foreground hover:bg-muted/60",F&&"bg-primary/10 ring-1 ring-inset ring-primary/35",L&&"opacity-45",e.disabled&&"pointer-events-none opacity-50"),style:{paddingLeft:q},onDragStart:t=>E(e,t),onDragOver:t=>O(e,t),onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||(e.currentTarget.dataset.dragLeave="true")},onDragEnd:P,onDrop:t=>A(e,t),onDoubleClick:()=>w(e),onKeyDown:t=>{"Enter"===t.key&&w(e),"F2"===t.key&&(t.preventDefault(),j(e)),("Delete"===t.key||"Backspace"===t.key)&&(t.preventDefault(),N(e)),"ArrowRight"===t.key&&z&&!_&&(t.preventDefault(),y(e)),"ArrowLeft"===t.key&&z&&_&&(t.preventDefault(),y(e))},children:[(0,eb.jsx)(Kl,{depth:n}),$&&(0,eb.jsx)(Ks,{position:v.position,depth:n}),e.recentlyModified&&(0,eb.jsx)("span",{className:"absolute top-1/2 left-1 h-1.5 w-1.5 -translate-y-1/2 rounded-full bg-primary"}),(0,eb.jsx)("button",{type:"button",tabIndex:-1,className:"flex size-4 shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted-foreground/10 hover:text-foreground",onClick:t=>{t.stopPropagation(),y(e)},"aria-label":_?"Collapse":"Expand",children:z?_?(0,eb.jsx)(cE,{className:"size-3.5"}):(0,eb.jsx)(vo,{className:"size-3.5"}):null}),(0,eb.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-1.5 text-left",onClick:t=>{b(e,t),!z||t.metaKey||t.ctrlKey?!z&&m&&w(e):y(e)},children:[(0,eb.jsx)(Ku,{node:e,open:_}),T?(0,eb.jsx)("input",{value:u,onChange:e=>k(e.target.value),onClick:e=>e.stopPropagation(),onKeyDown:t=>{"Enter"===t.key&&(t.preventDefault(),S(e)),"Escape"===t.key&&(t.preventDefault(),C())},onBlur:()=>S(e),autoFocus:!0,className:"h-5 min-w-0 flex-1 rounded-sm border border-ring bg-background px-1 text-xs outline-none"}):(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.name}),e.badge&&(0,eb.jsx)("span",{className:"shrink-0 text-muted-foreground",children:e.badge}),e.meta&&(0,eb.jsx)("span",{className:"hidden shrink-0 text-muted-foreground group-hover/tree-row:inline sm:inline",children:e.meta})]})]}),!T&&(0,eb.jsx)(Kd,{node:e,root:t,labels:r,allowRename:f,allowDelete:h,onOpen:w,onRename:j,onDelete:N,onCopyPath:M}),R&&(0,eb.jsx)("span",{className:"absolute inset-y-0 right-8 flex items-center text-[10px] text-muted-foreground",children:r.loading})]});return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsxs)(x2,{children:[(0,eb.jsx)(x4,{asChild:!0,children:U}),(0,eb.jsxs)(yn,{className:"w-40",children:[(0,eb.jsxs)(yr,{onSelect:()=>w(e),children:[(0,eb.jsx)(vh,{}),r.open]}),(0,eb.jsxs)(yr,{onSelect:()=>M(e),children:[(0,eb.jsx)(s0,{}),r.copyPath]}),f&&!e.readonly&&(0,eb.jsxs)(yr,{onSelect:()=>j(e),children:[(0,eb.jsx)(mF,{}),r.rename]}),h&&!e.readonly&&(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(yi,{}),(0,eb.jsxs)(yr,{variant:"destructive",onSelect:()=>N(e),children:[(0,eb.jsx)(m2,{}),r.delete]})]})]})]}),_&&z&&R&&(0,eb.jsx)("div",{className:"py-1 text-xs text-muted-foreground",style:{paddingLeft:q+40},children:r.loading}),W&&B.map(e=>(0,eb.jsx)(Ko,{node:e,root:t,depth:n+1,labels:r,expandedSet:i,selectedSet:a,activeNodeId:o,searchValue:l,loadingSet:s,compact:c,renamingId:d,renamingName:u,allowRename:f,allowDelete:h,allowDragAndDrop:p,openFilesOnSingleClick:m,draggingIds:g,dropTarget:v,hasSearch:x,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:C,onDelete:N,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A},e.id))]})}function Kl({depth:e}){return e<=0?null:(0,eb.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 left-0",children:Array.from({length:e}).map((e,t)=>(0,eb.jsx)("span",{className:"absolute inset-y-0 w-px bg-border/80 dark:bg-border/70",style:{left:17+14*t}},t))})}function Ks({position:e,depth:t}){return(0,eb.jsxs)("span",{"aria-hidden":"true",className:tK("pointer-events-none absolute right-2 z-10 flex h-3 items-center text-primary","before"===e?"top-[-6px]":"bottom-[-6px]"),style:{left:28+14*t},children:[(0,eb.jsx)("span",{className:"text-[10px] leading-none",children:">"}),(0,eb.jsx)("span",{className:"mx-0.5 h-px flex-1 bg-primary"}),(0,eb.jsx)("span",{className:"text-[10px] leading-none",children:"<"})]})}function Kc({box:e}){let t=Math.min(e.startX,e.currentX)-e.panelLeft,n=Math.min(e.startY,e.currentY)-e.panelTop,r=Math.abs(e.currentX-e.startX),i=Math.abs(e.currentY-e.startY);return(0,eb.jsx)("div",{"aria-hidden":"true",className:"pointer-events-none absolute z-50 rounded-sm border border-primary bg-primary/10 shadow-sm",style:{left:t,top:n,width:r,height:i}})}function Kd({node:e,labels:t,allowRename:n,allowDelete:r,onOpen:i,onRename:a,onDelete:o,onCopyPath:l}){return(0,eb.jsxs)(yu,{children:[(0,eb.jsx)(yh,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button","data-file-tree-ignore-box":!0,variant:"ghost",size:"icon-xs",className:"size-6 opacity-0 group-hover/tree-row:opacity-100 data-[state=open]:opacity-100",onClick:e=>e.stopPropagation(),"aria-label":"More actions",children:(0,eb.jsx)(s6,{})})}),(0,eb.jsxs)(yk,{align:"end",className:"w-40",children:[(0,eb.jsxs)(yS,{onSelect:()=>i(e),children:[(0,eb.jsx)(vh,{}),t.open]}),(0,eb.jsxs)(yS,{onSelect:()=>l(e),children:[(0,eb.jsx)(s0,{}),t.copyPath]}),n&&!e.readonly&&(0,eb.jsxs)(yS,{onSelect:()=>a(e),children:[(0,eb.jsx)(mF,{}),t.rename]}),r&&!e.readonly&&(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(yM,{}),(0,eb.jsxs)(yS,{variant:"destructive",onSelect:()=>o(e),children:[(0,eb.jsx)(m2,{}),t.delete]})]})]})]})}function Ku({node:e,open:t}){let n=e.icon??function(e,t){if(U5(e))return t?(0,eb.jsx)(vx,{}):(0,eb.jsx)(vv,{});let n=e.name.toLowerCase();return"image"===e.kind||/\.(png|jpg|jpeg|gif|webp|svg|avif)$/.test(n)?(0,eb.jsx)(vp,{}):"archive"===e.kind||/\.(zip|rar|7z|tar|gz)$/.test(n)?(0,eb.jsx)(vd,{}):"code"===e.kind||/\.(ts|tsx|js|jsx|json|css|scss|html|py|rs|go|mdx)$/.test(n)?(0,eb.jsx)(vs,{}):"text"===e.kind||/\.(md|txt|log|yaml|yml)$/.test(n)?(0,eb.jsx)(vm,{}):(0,eb.jsx)(vh,{})}(e,t);return(0,eb.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center text-muted-foreground [&_svg]:size-3.5",children:n})}function Kf(e,t){return!!(!t||U4(e).includes(t))||!!e.children?.some(e=>Kf(e,t))}function Kh(e){let t=e.trim(),n=/^vantaloom:\/\/([^/]+)\/(.+)$/i.exec(t);return n?{machineId:n[1]||"local",path:decodeURIComponent(n[2]||"").replace(/\//g,"/")}:{machineId:"local",path:t}}function Kp(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 Km(e){let t=e.map(Kh).filter(e=>e.path);return await Promise.all(t.map(async(e,t)=>{let n,r,i=await H_(e.machineId,e.path);return{id:`agent-root-${e.machineId}-${t}-${i.path}`,machineId:e.machineId,name:(n=i.path.replace(/[\\/]+$/,""),r=/([^\\/]+)$/.exec(n),r?.[1]??(n||"workspace")),path:i.path,platform:i.machine.platform,children:Kp(i.items)}}))}async function Kg(e,t){let n=t.machineId||"local";return Kp((await H_(n,e.path)).items)}function Kv({folders:e,className:t,onOpenFile:n}){let[r,i]=ew.useState([]),[a,o]=ew.useState(!1),[l,s]=ew.useState(0),c=e.join("\0"),d=ew.useCallback(async()=>{o(!0);try{i(await Km(e)),s(e=>e+1)}catch{i([]),s(e=>e+1)}finally{o(!1)}},[e]);return ew.useEffect(()=>{d()},[c,d]),(0,eb.jsx)(Ki,{className:t,compact:!0,openFilesOnSingleClick:!1,allowCreateFile:!1,allowCreateFolder:!1,allowRename:!1,allowDelete:!1,allowDragAndDrop:!1,allowBoxSelect:!1,defaultRoots:r,defaultExpandedIds:r.map(e=>e.id),loadingIds:a?r.map(e=>e.id):[],labels:{title:"Explorer",refresh:"刷新",collapseAll:"折叠",empty:0===e.length?"未配置可访问文件夹":"没有文件",noResults:"没有匹配文件",loading:"读取中..."},onLoadChildren:Kg,onOpenNode:(e,t)=>{"folder"!==e.kind&&n?.({machineId:t.machineId||"local",path:e.path})},onRefresh:()=>{d()}},l)}function Kx({open:e,folders:t,onOpenChange:n,onSelectFile:r}){return(0,eb.jsx)(po,{open:e,onOpenChange:n,children:(0,eb.jsxs)(p7,{className:"h-[min(42rem,calc(100svh-2rem))] max-w-2xl gap-0 overflow-hidden p-0",children:[(0,eb.jsx)(me,{className:"sr-only",children:"选择文件"}),(0,eb.jsx)(mt,{className:"sr-only",children:"从当前 Agent 可访问的文件夹中选择文件。"}),(0,eb.jsx)(Kv,{folders:t,className:"size-full max-w-none rounded-none border-0",onOpenFile:e=>{r(e),n(!1)}})]})})}function Ky({className:e,onChooseFile:t}){return(0,eb.jsx)("div",{className:tK("grid size-full place-items-center rounded-[inherit] bg-background p-6",e),children:(0,eb.jsxs)("div",{className:"grid justify-items-center gap-3 text-center",children:[(0,eb.jsx)("div",{className:"grid size-10 place-items-center rounded-full border bg-muted/35 text-muted-foreground",children:(0,eb.jsx)(vx,{className:"size-4"})}),(0,eb.jsxs)(tY,{type:"button",size:"sm",variant:"outline",onClick:t,children:[(0,eb.jsx)(UZ,{className:"size-4"}),"选择文件"]})]})})}let Kb=eN("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]),Kw=eN("maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]),Kj=eN("panel-bottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]),Kk=eN("panel-top",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]),KS=eN("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),KC=eN("earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),KN=eN("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]),KM=eN("tablet",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]),KE=[{id:"phone",label:"Phone",width:390,userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1"},{id:"tablet",label:"Tablet",width:820,userAgent:"Mozilla/5.0 (iPad; CPU OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1"},{id:"desktop",label:"Desktop",width:1200,userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"}],KO=[{id:"adaptive",label:"自适应",adaptive:!0},{id:"16:9",label:"16:9",value:16/9},{id:"4:3",label:"4:3",value:4/3},{id:"3:2",label:"3:2",value:1.5},{id:"1:1",label:"1:1",value:1},{id:"9:16",label:"9:16",value:9/16}],KP={urlLabel:"URL",urlPlaceholder:"https://example.com",navigate:"Navigate",actions:"Browser view options",devices:"User agent",ratios:"Viewport ratio",back:"Back",forward:"Forward",reload:"Reload preview",previewTitle:"Browser preview"};function KA(e,t,n){return e.find(e=>e.id===t)??n}function Kz({id:e}){return"phone"===e?(0,eb.jsx)(KN,{className:"size-4"}):"tablet"===e?(0,eb.jsx)(KM,{className:"size-4"}):(0,eb.jsx)(F_,{className:"size-4"})}function K_({url:e,defaultUrl:t="https://vantaloom.local/workspace",onUrlChange:n,onNavigate:r,onBack:i,onForward:a,device:o,defaultDevice:l="desktop",onDeviceChange:s,ratio:c,defaultRatio:d="adaptive",onRatioChange:u,devices:f=KE,ratios:h=KO,srcDoc:p,renderPreview:m,showHeader:g=!0,labels:v,className:x,headerClassName:y,previewClassName:b,...w}){let j=ew.useMemo(()=>({...KP,...v}),[v]),[k,S]=ew.useState(t),[C,N]=ew.useState(e??t),[M,E]=ew.useState(()=>[e??t]),[O,P]=ew.useState(0),[A,z]=ew.useState(l),[_,I]=ew.useState(d),[D,T]=ew.useState(!1),[R,L]=ew.useState(0),$=ew.useRef(null),F=ew.useId(),[V,B]=function(){let e=ew.useRef(null),[t,n]=ew.useState({width:0,height:0});return ew.useEffect(()=>{let t=e.current;if(!t)return;function r(e){t&&n(e??{width:t.clientWidth,height:t.clientHeight})}r();let i=new ResizeObserver(e=>{let t=e[0];t?r({width:t.contentRect.width,height:t.contentRect.height}):r()});return i.observe(t),()=>i.disconnect()},[]),[e,t]}(),H=e??k,W=KA(f,o??A,f[0]??KE[0]),q=KA(h,c??_,h[0]??KO[0]),U=B.width>0&&B.height>0,K=q.adaptive||"adaptive"===q.id,G=q.value??16/9,Y=K&&B.width||W.width,X=K?B.height||W.width/G:Y/G,Z=(U?B.width/B.height:1)<=G,J=Math.max(1,Math.round(U?K||Z?B.width:B.height*G:Y)),Q=Math.max(1,Math.round(U?K?B.height:Z?B.width/G:B.height:X)),ee=J/Y,et=ew.useMemo(()=>({url:H,device:W,ratio:q,viewport:{width:J,height:Q,scale:ee}}),[W,q,H,ee,Q,J]);function en(t,i={history:"push"}){void 0===e&&S(t),"none"!==i.history&&E(e=>{let n=e.slice(0,O+1);return n[n.length-1]===t?n:(P(n.length),[...n,t])}),n?.(t),r?.(t)}return ew.useEffect(()=>{N(e??k)},[k,e]),ew.useEffect(()=>{if(D)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Node&&$.current?.contains(t)||T(!1)}},[D]),(0,eb.jsxs)("div",{ref:$,"data-slot":"browser-tab-viewer","data-device":W.id,"data-ratio":q.id,className:tK("vtl-surface-panel relative grid min-h-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",g?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",x),...w,children:[g&&(0,eb.jsxs)("div",{"data-slot":"browser-tab-viewer-header",className:tK("flex min-w-0 items-center gap-2 border-b bg-muted/35 px-3 py-2",y),children:[(0,eb.jsx)("span",{className:"grid size-5 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:(0,eb.jsx)(KC,{className:"size-3.5"})}),(0,eb.jsxs)("form",{onSubmit:function(e){let t;e.preventDefault();let n=(t=C.trim())?/^[a-z][a-z\d+\-.]*:\/\//i.test(t)?t:/^(localhost|127\.0\.0\.1|\[::1\])(?::\d+)?(?:\/|$)/i.test(t)?`http://${t}`:`https://${t}`:"";N(n),en(n)},className:"min-w-0 flex-1",children:[(0,eb.jsx)("label",{className:"sr-only",htmlFor:F,children:j.urlLabel}),(0,eb.jsx)(ny,{id:F,value:C,onChange:e=>N(e.target.value),placeholder:j.urlPlaceholder,className:"h-5 rounded-md border bg-background px-2 shadow-none ui-text-kbd",spellCheck:!1})]}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":j.back,disabled:O<=0,onClick:function(){if(O<=0)return;let e=O-1,t=M[e];t&&(P(e),N(t),en(t,{history:"none"}),i?.(t))},className:"size-5 rounded-md",children:(0,eb.jsx)(KS,{className:"size-3.5"})}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":j.forward,disabled:O>=M.length-1,onClick:function(){if(O>=M.length-1)return;let e=O+1,t=M[e];t&&(P(e),N(t),en(t,{history:"none"}),a?.(t))},className:"size-5 rounded-md",children:(0,eb.jsx)(eM,{className:"size-3.5"})}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":j.reload,onClick:()=>L(e=>e+1),className:"size-5 rounded-md",children:(0,eb.jsx)(vC,{className:"size-3.5"})})]}),(0,eb.jsx)("div",{ref:V,"data-slot":"browser-tab-viewer-stage",className:tK("grid min-h-0 place-items-center overflow-hidden bg-muted/20",b),children:(0,eb.jsx)("div",{"data-slot":"browser-tab-viewer-viewport",className:"overflow-hidden rounded-lg border bg-background shadow-sm",style:{width:J,height:Q},children:m?m(et):(0,eb.jsx)("iframe",{title:j.previewTitle,src:p?void 0:H,srcDoc:p,sandbox:"allow-forms allow-modals allow-popups allow-same-origin allow-scripts",className:"size-full border-0 bg-background"},`${R}-${H}-${W.id}-${q.id}`)})}),(0,eb.jsxs)("div",{"data-slot":"browser-tab-floating-actions",className:"absolute right-3 bottom-3 z-20",children:[(0,eb.jsxs)("div",{className:tK("vtl-surface-popover absolute right-0 bottom-10 grid w-56 gap-3 rounded-[var(--surface-popover-radius)] border p-3 transition-[opacity,transform] duration-150",D?"pointer-events-auto opacity-100":"pointer-events-none translate-y-1 opacity-0"),children:[(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsx)("div",{className:"text-muted-foreground ui-text-kbd",children:j.devices}),(0,eb.jsx)("div",{className:"flex gap-1.5",children:f.map(e=>(0,eb.jsx)(tY,{type:"button",variant:W.id===e.id?"default":"outline",size:"icon-sm","aria-label":e.label,title:e.label,className:"rounded-full",onClick:()=>{let t;return t=KA(f,e.id,W),void(void 0===o&&z(t.id),s?.(t.id,t))},children:(0,eb.jsx)(Kz,{id:e.id})},e.id))})]}),(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsx)("div",{className:"text-muted-foreground ui-text-kbd",children:j.ratios}),(0,eb.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.map(e=>(0,eb.jsx)(tY,{type:"button",variant:q.id===e.id?"default":"outline",size:"xs",className:"h-7 rounded-full px-2.5 ui-text-kbd",onClick:()=>{let t;return t=KA(h,e.id,q),void(void 0===c&&I(t.id),u?.(t.id,t))},children:e.label},e.id))})]})]}),(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":j.actions,"aria-expanded":D,onClick:()=>T(e=>!e),className:"rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,eb.jsx)(s6,{className:tK("size-4 transition-transform",D&&"rotate-90")})})]})]})}function KI(e,t){return"function"==typeof e?e(t):e}function KD(e,t){return n=>{t.setState(t=>({...t,[e]:KI(n,t[e])}))}}function KT(e){return e instanceof Function}function KR(e,t,n){let r,i=[];return a=>{let o,l;n.key&&n.debug&&(o=Date.now());let s=e(a);if(!(s.length!==i.length||s.some((e,t)=>i[t]!==e)))return r;if(i=s,n.key&&n.debug&&(l=Date.now()),r=t(...s),null==n||null==n.onChange||n.onChange(r),n.key&&n.debug&&null!=n&&n.debug()){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-l)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
|
|
18
|
+
${e.detail}`:e.title,isStreaming:e.isStreaming})})}):("read"===e.kind||"search"===e.kind)&&(e.files?.length||e.detail?.trim())?(0,eb.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,eb.jsx)(U4,{event:e,children:(0,eb.jsx)(UZ,{event:e,onOpenFile:n})})}):"subagent"===e.kind&&e.subagents?.length?(0,eb.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,eb.jsx)(U1,{event:e,onOpenSubagent:r})}):"change"===e.kind?(0,eb.jsx)(U3,{event:e}):"thought"===e.kind?(0,eb.jsx)(U5,{event:e,labels:t}):(0,eb.jsx)(U2,{event:e})}function UZ({event:e,onOpenFile:t}){let n=function(e){var t;let n=e.files?.map((t,n)=>{var r,i,a;let o,l;return r=e,i=t,a=n,o=r.actionLabel?.trim()==="探索"||i.meta?.toLowerCase().startsWith("depth")||/[\\/]$/.test(i.name)||!!(i.path&&/[\\/]$/.test(i.path)),l=U6(i.name||i.path||"untitled"),{key:i.id??`file-${a}-${i.path??i.name}`,label:l,level:0,kind:o?"folder":"file",meta:i.lines??i.meta,file:i}})??[],r=e.detail?.trim()&&("read"!==e.kind||e.actionLabel?.trim()==="探索")?e.detail.replace(/\r\n/g,"\n").trimEnd():"";return r?e.actionLabel?.trim()==="探索"?(t=function(e,t){let n,r,i,a,o=(n=[],r=[],i=[],a=null,t.split("\n").forEach((e,t)=>{let o=e.trim();if(!o)return;if(o.startsWith("hint:"))return void i.push({key:`hint-${t}`,label:o.replace(/^hint:\s*/,""),level:0,kind:"hint"});let l=Math.max(0,Math.floor((e.match(/^ */)?.[0].length??0)/2)),s=/[\\/]$/.test(o),c={key:`detail-${t}-${o}`,label:o.replace(/[\\/]+$/,""),level:l,kind:s?"folder":"file"};if(0===l){a={root:c,children:[]},n.push(a);return}a?a.children.push(c):r.push(c)}),{sections:n,orphans:r,hints:i});if(!o.sections.length&&!o.orphans.length)return[...e,...o.hints];let l=new Set,s=[];return e.forEach(e=>{s.push(e);let t=o.sections.findIndex((t,n)=>!l.has(n)&&UQ(t.root.label)===UQ(e.label));t>=0&&(l.add(t),s.push(...function(e,t){if(!t)return e;let n=[];return e.map(e=>{var r,i;let a,o=Math.max(0,e.level-1);return(n.length=o,n[o]=e.label,"file"!==e.kind)?e:{...e,file:{id:e.key,name:e.label,path:(r=t,i=n.slice(0,o+1),a=r.includes("\\")?"\\":"/",[r.replace(/[\\/]+$/,""),...i.map(e=>e.replace(/^[\\/]+|[\\/]+$/g,""))].filter(Boolean).join(a))}}})}(o.sections[t]?.children??[],e.file?.path)))}),o.sections.forEach((e,t)=>{l.has(t)||s.push(e.root,...e.children)}),s.push(...o.orphans,...o.hints),s}(n,r)).map((e,n)=>{if(e.level<=0)return e;let r=Array.from({length:e.level-1},(e,r)=>U0(t,n,r+1));return{...e,branch:{ancestorLines:r,isLast:!U0(t,n,e.level)}}}):[...n,...r.split("\n").map((e,t)=>{let n=e.trim();return n?n.startsWith("hint:")?{key:`detail-hint-${t}`,label:n.replace(/^hint:\s*/,""),level:0,kind:"hint"}:{key:`detail-plain-${t}`,label:n,level:Math.max(0,Math.floor((e.match(/^ */)?.[0].length??0)/2)),kind:"plain"}:null}).filter(e=>!!e)]:n}(e);return n.length?(0,eb.jsx)("div",{className:"vtl-agent-tool-result","data-kind":e.actionLabel?.trim()==="探索"?"tree":e.kind,children:n.map(e=>(0,eb.jsx)(UJ,{row:e,onOpenFile:t},e.key))}):null}function UJ({row:e,onOpenFile:t}){let n=(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsxs)("span",{className:"vtl-agent-tool-row-tree","aria-hidden":"true","data-level":e.level,children:[e.branch?.ancestorLines.map((e,t)=>(0,eb.jsx)("span",{className:"vtl-agent-tool-row-tree-ancestor","data-active":e?"true":void 0},`ancestor-${t}`)),e.level>0?(0,eb.jsx)("span",{className:"vtl-agent-tool-row-tree-elbow","data-last":e.branch?.isLast?"true":void 0}):null,(0,eb.jsx)("span",{className:"vtl-agent-tool-row-icon",children:"folder"===e.kind?"▾":""})]}),(0,eb.jsx)("span",{className:"vtl-agent-tool-row-label",children:e.label}),e.meta?(0,eb.jsx)("em",{children:e.meta}):null]}),r={"--tool-tree-indent":`${13*Math.min(e.level,8)}px`,"--tool-tree-level":Math.min(e.level,8)};return e.file&&"file"===e.kind?(0,eb.jsx)("button",{type:"button",className:"vtl-agent-tool-row","data-kind":e.kind,style:r,onClick:()=>t?.(e.file),children:n}):(0,eb.jsx)("div",{className:"vtl-agent-tool-row","data-kind":e.kind,style:r,children:n})}function UQ(e){return U6(e.replace(/[\\/]+$/,"")).toLowerCase()}function U0(e,t,n){for(let r=t+1;r<e.length;r+=1){let t=e[r]?.level??0;if(t<n)break;if(t===n)return!0}return!1}function U1({event:e,onOpenSubagent:t}){let[n,r]=ew.useState(()=>new Set);return(0,eb.jsx)("div",{className:"vtl-agent-subagent-tool-list",children:e.subagents?.map(i=>{let a=n.has(i.id),o=function(e){if(e.toolActivities?.length)return e.toolActivities;let t=e.events?.filter(e=>"read"===e.kind||"search"===e.kind||"verify"===e.kind||"change"===e.kind||"tool"===e.kind).map(e=>[e.actionLabel,e.title].filter(Boolean).join(" ").trim()).filter(Boolean)??[];return t.length?t:[e.activity??e.status??e.title]}(i),l=i.isRunning&&o.length>1?[...o,o[0]]:o;return(0,eb.jsxs)("section",{className:"vtl-agent-subagent-tool","data-expanded":a?"true":"false","data-running":i.isRunning?"true":void 0,children:[(0,eb.jsx)("button",{type:"button",className:"vtl-agent-subagent-tool-trigger","aria-expanded":a,onClick:()=>{r(e=>{let t=new Set(e);return t.has(i.id)?t.delete(i.id):t.add(i.id),t})},children:(0,eb.jsxs)("span",{className:"vtl-agent-subagent-tool-title",children:[e.actionLabel?(0,eb.jsx)("strong",{children:e.actionLabel}):null,i.title,(0,eb.jsx)("i",{"aria-hidden":"true"})]})}),(0,eb.jsx)("div",{className:"vtl-agent-subagent-tool-detail",children:(0,eb.jsx)("button",{type:"button",className:"vtl-agent-subagent-tool-info",style:{"--activity-count":o.length,"--activity-frame-count":l.length},onClick:()=>t?.(i,e),children:(0,eb.jsx)("span",{className:"vtl-agent-subagent-tool-info-stack",children:l.map((e,t)=>(0,eb.jsxs)("span",{className:"vtl-agent-subagent-tool-info-line",children:["正在 ",e]},`${i.id}-${e}-${t}`))})})})]},i.id)})})}function U2({event:e}){return(0,eb.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,eb.jsxs)("p",{className:"vtl-agent-action-line",children:[e.actionLabel?(0,eb.jsx)("strong",{children:e.actionLabel}):null,e.title,e.meta?(0,eb.jsx)("em",{children:e.meta}):null]})})}function U5({event:e,labels:t}){let[n,r]=ew.useState(!1),i=!!e.detail?.trim(),a=e.title||t?.thinking||"思考中";return(0,eb.jsxs)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:[(0,eb.jsxs)("button",{type:"button",className:"vtl-agent-thought-line","data-streaming":e.isStreaming?"true":"false","aria-expanded":n,onClick:()=>i&&r(e=>!e),children:[(0,eb.jsx)("span",{children:a}),e.meta?(0,eb.jsx)("em",{children:e.meta}):null]}),i?(0,eb.jsx)("div",{className:tK("grid overflow-hidden transition-[grid-template-rows,opacity,transform] duration-200 ease-out",n?"translate-y-0 grid-rows-[1fr] opacity-100":"-translate-y-1 grid-rows-[0fr] opacity-0"),children:(0,eb.jsx)("div",{className:"min-h-0 overflow-hidden",children:(0,eb.jsx)("div",{className:"vtl-agent-thought-detail",children:(0,eb.jsx)(Uq,{content:e.detail??"",isStreaming:e.isStreaming})})})}):null]})}function U4({event:e,children:t}){let[n,r]=ew.useState(!1);return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsxs)("button",{type:"button",className:"vtl-agent-event-read-line",onClick:()=>r(e=>!e),"aria-expanded":n,children:[(0,eb.jsx)("span",{children:e.actionLabel?e.actionLabel:null}),e.title]}),(0,eb.jsx)("div",{className:tK("grid overflow-hidden transition-[grid-template-rows,opacity,transform] duration-200 ease-out",n?"translate-y-0 grid-rows-[1fr] opacity-100":"-translate-y-1 grid-rows-[0fr] opacity-0"),children:(0,eb.jsx)("div",{className:"min-h-0 overflow-hidden",children:t})})]})}function U3({event:e}){return(0,eb.jsx)("article",{className:"vtl-agent-event-row","data-kind":e.kind,children:(0,eb.jsxs)("button",{type:"button",className:"vtl-agent-change-row",children:[(0,eb.jsxs)("span",{children:[e.actionLabel?(0,eb.jsx)("strong",{children:e.actionLabel}):null,e.title]}),"number"==typeof e.additions||"number"==typeof e.deletions?(0,eb.jsxs)("em",{children:["number"==typeof e.additions?(0,eb.jsxs)("b",{"data-kind":"add",children:["+",e.additions]}):null,"number"==typeof e.deletions?(0,eb.jsxs)("b",{"data-kind":"delete",children:["-",e.deletions]}):null]}):e.meta?(0,eb.jsx)("em",{children:e.meta}):null]})})}function U6(e){return e.split(/[\\/]/).filter(Boolean).at(-1)??e}function U8(e,t){return`${e.id}-${t}`}eN("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]),eq("vtl-dot-matrix-loader",{variants:{size:{xs:"[--vtl-dot-size:3px] [--vtl-dot-gap:3px]",sm:"[--vtl-dot-size:3.5px] [--vtl-dot-gap:3.5px]",default:"[--vtl-dot-size:4px] [--vtl-dot-gap:4px]",lg:"[--vtl-dot-size:5px] [--vtl-dot-gap:5px]",xl:"[--vtl-dot-size:6px] [--vtl-dot-gap:6px]"},tone:{default:"text-current",muted:"text-muted-foreground",primary:"text-primary",inverse:"text-primary-foreground"},variant:{pulse:"vtl-dot-matrix-loader-pulse",wave:"vtl-dot-matrix-loader-wave",orbit:"vtl-dot-matrix-loader-orbit",binary:"vtl-dot-matrix-loader-binary"}},defaultVariants:{size:"default",tone:"default",variant:"pulse"}}),eq("animate-spin",{variants:{size:{xs:"size-3",sm:"size-3.5",default:"size-4",lg:"size-5",xl:"size-6"},variant:{default:"text-current",muted:"text-muted-foreground",primary:"text-primary"}},defaultVariants:{size:"default",variant:"default"}});let U7="max-w-[42.5rem]";function U9({className:e,composerClassName:t,initialEvents:n,events:r,models:i,modelId:a,running:o,disabled:l,onEventsChange:s,onModelChange:c,onSubmit:d,onOpenFile:u,onOpenSubagent:f}){let h=r??n??UI,[p,m]=ew.useState(h),g=ew.useRef(0),v=ew.useRef(h),x=ew.useRef([]),y=ew.useRef(null),[b,w]=ew.useState(168),j=ew.useId().replace(/[^a-zA-Z0-9_-]/g,""),k=r??p;function S(e){let t=e(v.current);v.current=t,void 0===r&&m(t),s?.(t)}function C(e,t){let n=window.setTimeout(t,e);x.current.push(n)}return ew.useLayoutEffect(()=>{let e=y.current;if(!e)return;function t(){w(Math.ceil(e.getBoundingClientRect().height))}t();let n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[]),ew.useEffect(()=>{v.current=k},[k]),ew.useEffect(()=>()=>{x.current.forEach(e=>window.clearTimeout(e)),x.current=[]},[]),(0,eb.jsxs)("section",{className:tK("vtl-agent-conversation-panel relative flex size-full min-h-0 min-w-0 flex-col overflow-hidden bg-transparent",e),children:[(0,eb.jsx)(UG,{events:k,bottomInset:b+16,contentClassName:tK(U7,t),onOpenFile:u,onOpenSubagent:e=>f?.(e),labels:{recall:"召回",branch:"分支",expand:"展开",collapse:"收起",completed:"完成",thinking:"运行中"}}),(0,eb.jsx)("div",{ref:y,className:"pointer-events-none absolute inset-x-0 bottom-0 z-20 flex justify-center px-4 pb-4",children:(0,eb.jsx)("div",{className:tK("vtl-agent-composer-dock pointer-events-auto relative w-full",U7,t),children:(0,eb.jsx)(UN,{className:"relative z-10 w-full",submitOnEnter:!0,running:o,disabled:l,minRows:1,maxRows:8,modes:[{id:"agent",label:"Agent",disabled:!0},{id:"chat",label:"Chat"}],modeId:"chat",models:i,modelId:a,onModelChange:e=>c?.(e),chips:[{id:"workspace",label:"Vantaloom-ui",tone:"success"},{id:"machine",label:"Studio-PC",tone:"muted"}],contextUsage:{used:139e3,total:258e3,toolCalls:52e3,userMessages:77e3,other:1e4},labels:{placeholder:"请问",mode:"模式",model:"模型",attach:"添加上下文",removeChip:"移除上下文",queuedMessage:"待发送消息",guideQueuedMessage:"引导",removeQueuedMessage:"移除待发送消息",moreQueuedMessageActions:"更多待发送消息操作",contextUsage:"上下文用量",contextUsed:"已用",contextTokenSummary:"已用 {used} / {total}",toolCalls:"工具调用",userMessages:"用户信息",otherContext:"系统/其他",compressContext:"压缩上下文",send:"发送",stop:"停止"},onSubmit:function(e){let t,n,r=e.value.trim();if(!r)return;if(d)return void d({value:r,modeId:e.modeId??"chat",modelId:e.modelId??a});g.current+=1;let i=`${j}-${g.current}`,o=`user-${i}`;S(e=>[...e,{id:o,kind:"user",title:r}]),t=U_(i),n=180,t.forEach(e=>{if("done"===e.kind){var t,r,i;let a,o,l=e.title;C(n,()=>{S(t=>[...t,{...e,title:"",isStreaming:!0,status:"running"}])}),t=e.id,r=l,i=n+120,a=Math.max(4,Math.ceil(r.length/36)),o=0,C(i,function e(){o=Math.min(r.length,o+a),S(e=>e.map(e=>e.id===t?{...e,title:r.slice(0,o),isStreaming:o<r.length,status:o<r.length?"running":"done"}:e)),o<r.length&&C(42,e)}),n+=Math.min(2200,Math.max(900,18*l.length))+260;return}C(n,()=>{S(t=>[...t,e])}),n+="thought"===e.kind?520:300})}})})})]})}let Ke=eN("file-plus-corner",[["path",{d:"M11.35 22H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v5.35",key:"17jvcc"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M14 19h6",key:"bvotb8"}],["path",{d:"M17 16v6",key:"18yu1i"}]]);function Kt(e,t){var n;let r,i="base64"===e.encoding;return{name:e.name,path:e.path,machineId:e.machine.id,language:(n=e.path,/\.([^.\\/]+)$/.exec(n)?.[1]?.toLowerCase()),kind:t,mimeType:e.mimeType,size:e.size,src:i&&!e.truncated?(r=e.mimeType||"application/octet-stream",`data:${r};base64,${e.content}`):void 0,truncated:e.truncated}}function Kn(e){let t=encodeURIComponent(e.path).replace(/%/g,"").replace(/[^a-z0-9_-]/gi,"-").slice(0,96);return`file-${e.machine.id}-${t||"file"}-${Date.now()}`}async function Kr(e){var t,n;let r,i=await HI(e.machineId,e.path),a=(t=i.kind,n=i.mimeType,r=n?.toLowerCase()??"","image"===t||r.startsWith("image/")?"image":"video"===t||r.startsWith("video/")?"video":r.includes("html")?"html":r.includes("markdown")?"markdown":"text"===t||"code"===t?"code":"binary"),o="base64"===i.encoding;return{id:Kn(i),kind:"file-tab-viewer",title:i.name,file:Kt(i,a),defaultValue:o?"":i.content,defaultView:"image"===a||"video"===a?"preview":"code",defaultMode:"review"}}async function Ki(e){let t=await HI(e.machineId,e.path);return{id:Kn(t),kind:"data-table-tab-viewer",title:t.name,file:Kt(t,"text"),defaultValue:"utf-8"===t.encoding?t.content:""}}let Ka={title:"Explorer",search:"Search files...",newFile:"New file",newFolder:"New folder",refresh:"Refresh",collapseAll:"Collapse all",rename:"Rename",delete:"Delete",copyPath:"Copy path",open:"Open",empty:"No files yet.",noResults:"No matching files.",loading:"Loading..."};function Ko(e){return"folder"===e.kind||!!e.children||!!e.hasChildren}function Kl(e){return`${e.name} ${e.path}`.toLowerCase()}function Ks(e,t){if(e&&t)return Kc(e.children,t)}function Kc(e,t){for(let n of e){if(n.id===t)return n;let e=n.children?Kc(n.children,t):void 0;if(e)return e}}function Kd(e,t){return e?t.map(t=>Kc(e.children,t)).filter(e=>!!e):[]}function Ku(e,t){let n=e.includes("\\")?"\\":"/";return e.endsWith("\\")||e.endsWith("/")?`${e}${t}`:`${e}${n}${t}`}function Kf(e,t,n){return e.map(e=>e.id===t?n(e):e.children?{...e,children:Kf(e.children,t,n)}:e)}function Kh(e,t){return e.filter(e=>!t.has(e.id)).map(e=>({...e,children:e.children?Kh(e.children,t):void 0}))}function Kp(e,t){return e.some(e=>e.id===t||!!(e.children&&Kp(e.children,t)))}function Km(e,t){let n=Ku(t,e.name);return{...e,path:n,children:e.children?.map(e=>Km(e,n))}}function Kg(e,t,n){let[r,i]=ew.useState(t??n);return[e??r,i]}function Kv({roots:e,defaultRoots:t,activeRootId:n,defaultActiveRootId:r,activeNodeId:i,defaultActiveNodeId:a,selectedIds:o,defaultSelectedIds:l,expandedIds:s,defaultExpandedIds:c,searchValue:d,defaultSearchValue:u,loadingIds:f,labels:h,allowMultiSelect:p=!0,allowCreateFile:m=!0,allowCreateFolder:g=!0,allowRename:v=!0,allowDelete:x=!0,allowDragAndDrop:y=!0,allowBoxSelect:b=!0,openFilesOnSingleClick:w=!0,showSearch:j=!0,showToolbar:k=!0,compact:S=!1,onActiveRootChange:C,onActiveNodeChange:N,onSelectionChange:M,onExpandedChange:E,onSearchValueChange:O,onOpenNode:P,onLoadChildren:A,onCreateNode:z,onRenameNode:_,onDeleteNodes:I,onMoveNodes:D,onCopyPath:T,onRefresh:R,className:L,sidebarClassName:$,style:F}){let V={...Ka,...h},B=ew.useRef(null),H=ew.useRef(void 0),W=ew.useRef([]),[q,U]=ew.useState(()=>(t??[]).map(e=>({...e,children:function e(t){return t.map(t=>({...t,children:t.children?e(t.children):void 0}))}(e.children)}))),K=e??q,G=K[0]?.id,[Y,X]=ew.useState(r??G),Z=n??Y??G,J=K.find(e=>e.id===Z)??K[0],[Q,ee]=ew.useState(a),et=i??Q,[en,er]=Kg(o,l,a?[a]:[]),[ei,ea]=Kg(s,c,G?[G]:[]),[eo,el]=ew.useState(u??""),es=d??eo,[ec,ed]=ew.useState(),[eu,ef]=ew.useState(""),[eh,ep]=ew.useState([]),[em,eg]=ew.useState(),[ev,ex]=ew.useState(),ey=ew.useRef(0),ej=ew.useMemo(()=>new Set(f),[f]),ek=ew.useMemo(()=>new Set(ei),[ei]),eS=ew.useMemo(()=>new Set(en),[en]),eC=Ks(J,et),eN=es.trim().length>0;function eM(t){e||U(e=>t(e))}function eE(e){void 0===s&&ea(e),E?.(e)}function eO(e){void 0===o&&er(e),M?.({root:J,node:e.at(-1)?Ks(J,e.at(-1)):void 0,nodes:Kd(J,e)})}function eP(e){void 0===i&&ee(e?.id),N?.(e)}async function eA(e){if(Ko(e)&&J){if(ek.has(e.id))return void eE(ei.filter(t=>t!==e.id));if(A&&e.hasChildren&&!e.children){let t=await A(e,J);eM(n=>n.map(n=>n.id===J.id?{...n,children:Kf(n.children,e.id,e=>({...e,children:t}))}:n))}eE([...ei,e.id])}}function ez(e){var t;t=e.id,void 0===n&&X(t),C?.(t),ek.has(e.id)?eE(ei.filter(t=>t!==e.id)):eE([...ei,e.id])}function e_(e,t){if(e.disabled)return;let n=p&&(t?.metaKey||t?.ctrlKey)?eS.has(e.id)?en.filter(t=>t!==e.id):[...en,e.id]:[e.id];eP(e),eO(n)}function eI(e){J&&!e.disabled&&P?.(e,J)}function eD(e){if(!J)return;let t=eC&&Ko(eC)?eC:J,n="folder"===e?"untitled-folder":"untitled.ts";ey.current+=1;let r={id:`created-${ey.current}`,name:n,path:Ku(t.path,n),kind:"folder"===e?"folder":"code",children:"folder"===e?[]:void 0};z?.(t,e,n),eM(e=>e.map(e=>{var n,i;return e.id!==J.id?e:"children"in t&&"platform"in t?{...e,children:[r,...e.children]}:{...e,children:(n=e.children,i=t.id,Kf(n,i,e=>({...e,children:[r,...e.children??[]],hasChildren:!0})))}})),eE([...new Set([...ei,t.id])]),eP(r),eO([r.id]),ed(r.id),ef(r.name)}function eT(e){!v||e.disabled||e.readonly||(ed(e.id),ef(e.name))}function eR(e){let t=eu.trim();ed(void 0),t&&t!==e.name&&(_?.(e,t),eM(n=>n.map(n=>n.id===J?.id?{...n,children:Kf(n.children,e.id,e=>{let n,r,i;return{...e,name:t,path:Ku((r=(n=e.path.replace(/[\\/]+$/,"")).includes("\\")?"\\":"/",(i=n.lastIndexOf(r))<=0?n:n.slice(0,i)),t)}})}:n)))}function eL(e,t){if(!J||!y||e.disabled||ev)return void t.preventDefault();let n=eS.has(e.id)?en:[e.id];eS.has(e.id)||(eO([e.id]),eP(e)),ep(n),t.dataTransfer.effectAllowed="move",t.dataTransfer.setData("text/plain",n.join(","))}function e$(e,t){if(!y||0===eh.length)return;t.preventDefault(),t.dataTransfer.dropEffect="move";let n=t.currentTarget.getBoundingClientRect(),r=(t.clientY-n.top)/n.height,i=r<.3?"before":r>.7?"after":Ko(e)?"inside":"after";eg({targetId:e.id,position:i})}function eF(e,t){t.preventDefault(),em?.targetId===e.id&&function(e,t){let n;if(!J||0===eh.length||!y)return;let r=(n=new Set(eh),Kd(J,eh).filter(e=>!Array.from(n).some(t=>{var n,r;let i;return t!==e.id&&(n=J.children,r=e.id,i=Kc(n,t),!!(i?.children&&Kp(i.children,r)))})));if(0===r.length||r.some(t=>t.id===e.id||!!(t.children&&Kp(t.children,e.id))))return;let i=new Set(r.map(e=>e.id)),a="inside"!==t||Ko(e)?t:"after";D?.({root:J,nodes:r,target:e,position:a}),eM(t=>t.map(t=>{if(t.id!==J.id)return t;let n=function e(t,n,r,i,a){let o=!1,l=[];for(let s of t){if(s.id===n){if("before"===r){l.push(...i.map(e=>Km(e,a))),l.push(s),o=!0;continue}if("after"===r){l.push(s),l.push(...i.map(e=>Km(e,a))),o=!0;continue}if("inside"===r){l.push({...s,children:[...i.map(e=>Km(e,s.path)),...s.children??[]],hasChildren:!0}),o=!0;continue}}if(s.children){let t=e(s.children,n,r,i,s.path);l.push({...s,children:t.nodes}),o=o||t.inserted}else l.push(s)}return{nodes:l,inserted:o}}(Kh(t.children,i),e.id,a,r,t.path);return{...t,children:n.inserted?n.nodes:t.children}})),"inside"===a&&eE([...new Set([...ei,e.id])]),eO(r.map(e=>e.id)),eP(r[0])}(e,em.position),eg(void 0),ep([])}function eV(e){let t=B.current;if(!t||!J)return;let n=Math.min(e.startX,e.currentX),r=Math.max(e.startX,e.currentX),i=Math.min(e.startY,e.currentY),a=Math.max(e.startY,e.currentY),o=Array.from(t.querySelectorAll("[data-file-tree-node-id]")).filter(e=>{let t=e.getBoundingClientRect();return t.left<r&&t.right>n&&t.top<a&&t.bottom>i}).map(e=>e.dataset.fileTreeNodeId).filter(e=>!!e);if(o.length>0){eO(Array.from(new Set([...W.current,...o])));let e=Ks(J,o.at(-1));e&&eP(e)}}return ew.useEffect(()=>{n||Y||!G||X(G)},[n,G,Y]),(0,eb.jsxs)("div",{ref:B,"data-slot":"file-tree-panel",className:tK("vtl-surface-panel relative flex min-h-[28rem] w-full max-w-sm flex-col overflow-hidden rounded-[var(--surface-panel-radius)] border",L),style:F,onPointerDown:function(e){let t=e.target;if(!b||!p||!e.ctrlKey||0!==e.button||t.closest("input, textarea, [data-file-tree-ignore-box]"))return;e.preventDefault();let n=e.currentTarget.getBoundingClientRect();H.current=e.pointerId,W.current=en,e.currentTarget.setPointerCapture(e.pointerId),ex({startX:e.clientX,startY:e.clientY,currentX:e.clientX,currentY:e.clientY,panelLeft:n.left,panelTop:n.top})},onPointerMove:function(e){if(!ev||H.current!==e.pointerId)return;e.preventDefault();let t={...ev,currentX:e.clientX,currentY:e.clientY};ex(t),eV(t)},onPointerUp:function(e){ev&&H.current===e.pointerId&&(eV(ev),ex(void 0),W.current=[],H.current=void 0)},onPointerCancel:()=>{ex(void 0),W.current=[],H.current=void 0},children:[k&&(0,eb.jsxs)("div",{"data-file-tree-ignore-box":!0,className:"flex h-10 shrink-0 items-center gap-1 border-b px-2",children:[(0,eb.jsx)("div",{className:"mr-auto min-w-0 truncate px-1 text-sm font-medium",children:V.title}),m&&(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":V.newFile,onClick:()=>eD("file"),children:(0,eb.jsx)(s7,{})}),g&&(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":V.newFolder,onClick:()=>eD("folder"),children:(0,eb.jsx)(vy,{})}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":V.refresh,onClick:()=>J&&R?.(J),children:(0,eb.jsx)(vC,{})}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":V.collapseAll,onClick:function(){eE(J?[J.id]:[])},children:(0,eb.jsx)(p6,{})})]}),j&&(0,eb.jsx)("div",{"data-file-tree-ignore-box":!0,className:"shrink-0 border-b p-2",children:(0,eb.jsxs)(yO,{className:"h-7 rounded-md",children:[(0,eb.jsx)(yA,{align:"inline-start",className:"pl-2",children:(0,eb.jsx)(cz,{className:"size-3.5"})}),(0,eb.jsx)(yz,{value:es,onChange:e=>{var t;return t=e.target.value,void(void 0===d&&el(t),O?.(t))},placeholder:V.search,className:"h-7 text-xs"})]})}),(0,eb.jsx)(f1,{className:tK("min-h-0 flex-1",$),"data-slot":"file-tree-panel-scroll",children:(0,eb.jsxs)("div",{className:tK("py-1",S&&"py-0.5"),children:[0===K.length&&(0,eb.jsx)("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:V.empty}),K.map(e=>(0,eb.jsx)(Kx,{root:e,activeRoot:J,labels:V,expandedSet:ek,selectedSet:eS,activeNodeId:et,searchValue:es,loadingSet:ej,compact:S,renamingId:ec,renamingName:eu,allowRename:v,allowDelete:x,allowDragAndDrop:y,openFilesOnSingleClick:w,draggingIds:eh,dropTarget:em,hasSearch:eN,onRootToggle:ez,onNodeToggle:e=>void eA(e),onNodeSelect:e_,onNodeOpen:eI,onStartRename:eT,onRenamingNameChange:ef,onCommitRename:eR,onCancelRename:()=>ed(void 0),onDelete:e=>(function(e){if(!x||0===e.length||!J)return;I?.(e);let t=new Set(e.map(e=>e.id));eM(e=>e.map(e=>e.id===J.id?{...e,children:Kh(e.children,t)}:e)),eO(en.filter(e=>!t.has(e))),et&&t.has(et)&&eP(void 0)})(function(e){if(eS.has(e.id)){let t=Kd(J,en);return t.length>0?t:[e]}return[e]}(e)),onCopyPath:e=>T?.(e),onDragStart:eL,onDragOver:e$,onDragEnd:()=>{ep([]),eg(void 0)},onDrop:eF},e.id))]})}),ev&&(0,eb.jsx)(Kj,{box:ev})]})}function Kx({root:e,activeRoot:t,labels:n,expandedSet:r,selectedSet:i,activeNodeId:a,searchValue:o,loadingSet:l,compact:s,renamingId:c,renamingName:d,allowRename:u,allowDelete:f,allowDragAndDrop:h,openFilesOnSingleClick:p,draggingIds:m,dropTarget:g,hasSearch:v,onRootToggle:x,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:C,onDelete:N,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A}){let z=r.has(e.id),_=o.trim().toLowerCase(),I=v?e.children.filter(e=>KC(e,_)):e.children;return(0,eb.jsxs)("section",{"data-slot":"file-tree-root",className:"min-w-0",children:[(0,eb.jsxs)("button",{type:"button",className:tK("group flex h-7 w-full items-center gap-1 px-2 text-left text-xs font-medium text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground",t?.id===e.id&&"text-foreground"),onClick:()=>x(e),children:[(0,eb.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center",children:z?(0,eb.jsx)(cE,{className:"size-3.5"}):(0,eb.jsx)(vo,{className:"size-3.5"})}),(0,eb.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center [&_svg]:size-3.5",children:e.icon??(0,eb.jsx)(vx,{})}),(0,eb.jsx)("span",{className:"truncate uppercase tracking-wide",children:e.name})]}),(z||v)&&(0,eb.jsxs)("div",{children:[l.has(e.id)&&(0,eb.jsx)("div",{className:"px-8 py-2 text-xs text-muted-foreground",children:n.loading}),!l.has(e.id)&&0===I.length&&(0,eb.jsx)("div",{className:"px-8 py-2 text-xs text-muted-foreground",children:v?n.noResults:n.empty}),I.map(t=>(0,eb.jsx)(Ky,{node:t,root:e,depth:0,labels:n,expandedSet:r,selectedSet:i,activeNodeId:a,searchValue:_,loadingSet:l,compact:s,renamingId:c,renamingName:d,allowRename:u,allowDelete:f,allowDragAndDrop:h,openFilesOnSingleClick:p,draggingIds:m,dropTarget:g,hasSearch:v,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:C,onDelete:N,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A},t.id))]})]})}function Ky({node:e,root:t,depth:n,labels:r,expandedSet:i,selectedSet:a,activeNodeId:o,searchValue:l,loadingSet:s,compact:c,renamingId:d,renamingName:u,allowRename:f,allowDelete:h,allowDragAndDrop:p,openFilesOnSingleClick:m,draggingIds:g,dropTarget:v,hasSearch:x,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:C,onDelete:N,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A}){let z=Ko(e),_=i.has(e.id),I=a.has(e.id),D=o===e.id,T=d===e.id,R=s.has(e.id),L=g.includes(e.id),$=v?.targetId===e.id&&"inside"!==v.position,F=v?.targetId===e.id&&"inside"===v.position,V=e.children??[],B=x?V.filter(e=>KC(e,l)):V,H=!x||Kl(e).includes(l),W=(_||x)&&B.length>0,q=8+14*n;if(x&&!H&&0===B.length)return null;let U=(0,eb.jsxs)("div",{"data-slot":"file-tree-row","data-file-tree-node-id":e.id,"data-active":D?"true":void 0,"data-selected":I?"true":void 0,draggable:p&&!T&&!e.disabled,className:tK("group/tree-row relative flex w-full items-center gap-1 pr-1 text-left text-xs transition-colors",c?"h-6":"h-7",I||D?"bg-muted text-foreground":"text-foreground hover:bg-muted/60",F&&"bg-primary/10 ring-1 ring-inset ring-primary/35",L&&"opacity-45",e.disabled&&"pointer-events-none opacity-50"),style:{paddingLeft:q},onDragStart:t=>E(e,t),onDragOver:t=>O(e,t),onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||(e.currentTarget.dataset.dragLeave="true")},onDragEnd:P,onDrop:t=>A(e,t),onDoubleClick:()=>w(e),onKeyDown:t=>{"Enter"===t.key&&w(e),"F2"===t.key&&(t.preventDefault(),j(e)),("Delete"===t.key||"Backspace"===t.key)&&(t.preventDefault(),N(e)),"ArrowRight"===t.key&&z&&!_&&(t.preventDefault(),y(e)),"ArrowLeft"===t.key&&z&&_&&(t.preventDefault(),y(e))},children:[(0,eb.jsx)(Kb,{depth:n}),$&&(0,eb.jsx)(Kw,{position:v.position,depth:n}),e.recentlyModified&&(0,eb.jsx)("span",{className:"absolute top-1/2 left-1 h-1.5 w-1.5 -translate-y-1/2 rounded-full bg-primary"}),(0,eb.jsx)("button",{type:"button",tabIndex:-1,className:"flex size-4 shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted-foreground/10 hover:text-foreground",onClick:t=>{t.stopPropagation(),y(e)},"aria-label":_?"Collapse":"Expand",children:z?_?(0,eb.jsx)(cE,{className:"size-3.5"}):(0,eb.jsx)(vo,{className:"size-3.5"}):null}),(0,eb.jsxs)("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-1.5 text-left",onClick:t=>{b(e,t),!z||t.metaKey||t.ctrlKey?!z&&m&&w(e):y(e)},children:[(0,eb.jsx)(KS,{node:e,open:_}),T?(0,eb.jsx)("input",{value:u,onChange:e=>k(e.target.value),onClick:e=>e.stopPropagation(),onKeyDown:t=>{"Enter"===t.key&&(t.preventDefault(),S(e)),"Escape"===t.key&&(t.preventDefault(),C())},onBlur:()=>S(e),autoFocus:!0,className:"h-5 min-w-0 flex-1 rounded-sm border border-ring bg-background px-1 text-xs outline-none"}):(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.name}),e.badge&&(0,eb.jsx)("span",{className:"shrink-0 text-muted-foreground",children:e.badge}),e.meta&&(0,eb.jsx)("span",{className:"hidden shrink-0 text-muted-foreground group-hover/tree-row:inline sm:inline",children:e.meta})]})]}),!T&&(0,eb.jsx)(Kk,{node:e,root:t,labels:r,allowRename:f,allowDelete:h,onOpen:w,onRename:j,onDelete:N,onCopyPath:M}),R&&(0,eb.jsx)("span",{className:"absolute inset-y-0 right-8 flex items-center text-[10px] text-muted-foreground",children:r.loading})]});return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsxs)(x2,{children:[(0,eb.jsx)(x4,{asChild:!0,children:U}),(0,eb.jsxs)(yn,{className:"w-40",children:[(0,eb.jsxs)(yr,{onSelect:()=>w(e),children:[(0,eb.jsx)(vh,{}),r.open]}),(0,eb.jsxs)(yr,{onSelect:()=>M(e),children:[(0,eb.jsx)(s0,{}),r.copyPath]}),f&&!e.readonly&&(0,eb.jsxs)(yr,{onSelect:()=>j(e),children:[(0,eb.jsx)(mF,{}),r.rename]}),h&&!e.readonly&&(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(yi,{}),(0,eb.jsxs)(yr,{variant:"destructive",onSelect:()=>N(e),children:[(0,eb.jsx)(m2,{}),r.delete]})]})]})]}),_&&z&&R&&(0,eb.jsx)("div",{className:"py-1 text-xs text-muted-foreground",style:{paddingLeft:q+40},children:r.loading}),W&&B.map(e=>(0,eb.jsx)(Ky,{node:e,root:t,depth:n+1,labels:r,expandedSet:i,selectedSet:a,activeNodeId:o,searchValue:l,loadingSet:s,compact:c,renamingId:d,renamingName:u,allowRename:f,allowDelete:h,allowDragAndDrop:p,openFilesOnSingleClick:m,draggingIds:g,dropTarget:v,hasSearch:x,onNodeToggle:y,onNodeSelect:b,onNodeOpen:w,onStartRename:j,onRenamingNameChange:k,onCommitRename:S,onCancelRename:C,onDelete:N,onCopyPath:M,onDragStart:E,onDragOver:O,onDragEnd:P,onDrop:A},e.id))]})}function Kb({depth:e}){return e<=0?null:(0,eb.jsx)("span",{"aria-hidden":"true",className:"pointer-events-none absolute inset-y-0 left-0",children:Array.from({length:e}).map((e,t)=>(0,eb.jsx)("span",{className:"absolute inset-y-0 w-px bg-border/80 dark:bg-border/70",style:{left:17+14*t}},t))})}function Kw({position:e,depth:t}){return(0,eb.jsxs)("span",{"aria-hidden":"true",className:tK("pointer-events-none absolute right-2 z-10 flex h-3 items-center text-primary","before"===e?"top-[-6px]":"bottom-[-6px]"),style:{left:28+14*t},children:[(0,eb.jsx)("span",{className:"text-[10px] leading-none",children:">"}),(0,eb.jsx)("span",{className:"mx-0.5 h-px flex-1 bg-primary"}),(0,eb.jsx)("span",{className:"text-[10px] leading-none",children:"<"})]})}function Kj({box:e}){let t=Math.min(e.startX,e.currentX)-e.panelLeft,n=Math.min(e.startY,e.currentY)-e.panelTop,r=Math.abs(e.currentX-e.startX),i=Math.abs(e.currentY-e.startY);return(0,eb.jsx)("div",{"aria-hidden":"true",className:"pointer-events-none absolute z-50 rounded-sm border border-primary bg-primary/10 shadow-sm",style:{left:t,top:n,width:r,height:i}})}function Kk({node:e,labels:t,allowRename:n,allowDelete:r,onOpen:i,onRename:a,onDelete:o,onCopyPath:l}){return(0,eb.jsxs)(yu,{children:[(0,eb.jsx)(yh,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button","data-file-tree-ignore-box":!0,variant:"ghost",size:"icon-xs",className:"size-6 opacity-0 group-hover/tree-row:opacity-100 data-[state=open]:opacity-100",onClick:e=>e.stopPropagation(),"aria-label":"More actions",children:(0,eb.jsx)(s6,{})})}),(0,eb.jsxs)(yk,{align:"end",className:"w-40",children:[(0,eb.jsxs)(yS,{onSelect:()=>i(e),children:[(0,eb.jsx)(vh,{}),t.open]}),(0,eb.jsxs)(yS,{onSelect:()=>l(e),children:[(0,eb.jsx)(s0,{}),t.copyPath]}),n&&!e.readonly&&(0,eb.jsxs)(yS,{onSelect:()=>a(e),children:[(0,eb.jsx)(mF,{}),t.rename]}),r&&!e.readonly&&(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(yM,{}),(0,eb.jsxs)(yS,{variant:"destructive",onSelect:()=>o(e),children:[(0,eb.jsx)(m2,{}),t.delete]})]})]})]})}function KS({node:e,open:t}){let n=e.icon??function(e,t){if(Ko(e))return t?(0,eb.jsx)(vx,{}):(0,eb.jsx)(vv,{});let n=e.name.toLowerCase();return"image"===e.kind||/\.(png|jpg|jpeg|gif|webp|svg|avif)$/.test(n)?(0,eb.jsx)(vp,{}):"archive"===e.kind||/\.(zip|rar|7z|tar|gz)$/.test(n)?(0,eb.jsx)(vd,{}):"code"===e.kind||/\.(ts|tsx|js|jsx|json|css|scss|html|py|rs|go|mdx)$/.test(n)?(0,eb.jsx)(vs,{}):"text"===e.kind||/\.(md|txt|log|yaml|yml)$/.test(n)?(0,eb.jsx)(vm,{}):(0,eb.jsx)(vh,{})}(e,t);return(0,eb.jsx)("span",{className:"flex size-4 shrink-0 items-center justify-center text-muted-foreground [&_svg]:size-3.5",children:n})}function KC(e,t){return!!(!t||Kl(e).includes(t))||!!e.children?.some(e=>KC(e,t))}function KN(e){let t=e.trim(),n=/^vantaloom:\/\/([^/]+)\/(.+)$/i.exec(t);return n?{machineId:n[1]||"local",path:decodeURIComponent(n[2]||"").replace(/\//g,"/")}:{machineId:"local",path:t}}function KM(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 KE(e){let t=e.map(KN).filter(e=>e.path);return await Promise.all(t.map(async(e,t)=>{let n,r,i=await H_(e.machineId,e.path);return{id:`agent-root-${e.machineId}-${t}-${i.path}`,machineId:e.machineId,name:(n=i.path.replace(/[\\/]+$/,""),r=/([^\\/]+)$/.exec(n),r?.[1]??(n||"workspace")),path:i.path,platform:i.machine.platform,children:KM(i.items)}}))}async function KO(e,t){let n=t.machineId||"local";return KM((await H_(n,e.path)).items)}function KP({folders:e,className:t,onOpenFile:n}){let[r,i]=ew.useState([]),[a,o]=ew.useState(!1),[l,s]=ew.useState(0),c=e.join("\0"),d=ew.useCallback(async()=>{o(!0);try{i(await KE(e)),s(e=>e+1)}catch{i([]),s(e=>e+1)}finally{o(!1)}},[e]);return ew.useEffect(()=>{d()},[c,d]),(0,eb.jsx)(Kv,{className:t,compact:!0,openFilesOnSingleClick:!1,allowCreateFile:!1,allowCreateFolder:!1,allowRename:!1,allowDelete:!1,allowDragAndDrop:!1,allowBoxSelect:!1,defaultRoots:r,defaultExpandedIds:r.map(e=>e.id),loadingIds:a?r.map(e=>e.id):[],labels:{title:"Explorer",refresh:"刷新",collapseAll:"折叠",empty:0===e.length?"未配置可访问文件夹":"没有文件",noResults:"没有匹配文件",loading:"读取中..."},onLoadChildren:KO,onOpenNode:(e,t)=>{"folder"!==e.kind&&n?.({machineId:t.machineId||"local",path:e.path})},onRefresh:()=>{d()}},l)}function KA({open:e,folders:t,onOpenChange:n,onSelectFile:r}){return(0,eb.jsx)(po,{open:e,onOpenChange:n,children:(0,eb.jsxs)(p7,{className:"h-[min(42rem,calc(100svh-2rem))] max-w-2xl gap-0 overflow-hidden p-0",children:[(0,eb.jsx)(me,{className:"sr-only",children:"选择文件"}),(0,eb.jsx)(mt,{className:"sr-only",children:"从当前 Agent 可访问的文件夹中选择文件。"}),(0,eb.jsx)(KP,{folders:t,className:"size-full max-w-none rounded-none border-0",onOpenFile:e=>{r(e),n(!1)}})]})})}function Kz({className:e,onChooseFile:t}){return(0,eb.jsx)("div",{className:tK("grid size-full place-items-center rounded-[inherit] bg-background p-6",e),children:(0,eb.jsxs)("div",{className:"grid justify-items-center gap-3 text-center",children:[(0,eb.jsx)("div",{className:"grid size-10 place-items-center rounded-full border bg-muted/35 text-muted-foreground",children:(0,eb.jsx)(vx,{className:"size-4"})}),(0,eb.jsxs)(tY,{type:"button",size:"sm",variant:"outline",onClick:t,children:[(0,eb.jsx)(Ke,{className:"size-4"}),"选择文件"]})]})})}let K_=eN("columns-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]),KI=eN("maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]),KD=eN("panel-bottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]),KT=eN("panel-top",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]),KR=eN("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]),KL=eN("earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]),K$=eN("smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]),KF=eN("tablet",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]),KV=[{id:"phone",label:"Phone",width:390,userAgent:"Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1"},{id:"tablet",label:"Tablet",width:820,userAgent:"Mozilla/5.0 (iPad; CPU OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0 Mobile/15E148 Safari/604.1"},{id:"desktop",label:"Desktop",width:1200,userAgent:"Mozilla/5.0 (Macintosh; Intel Mac OS X 15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36"}],KB=[{id:"adaptive",label:"自适应",adaptive:!0},{id:"16:9",label:"16:9",value:16/9},{id:"4:3",label:"4:3",value:4/3},{id:"3:2",label:"3:2",value:1.5},{id:"1:1",label:"1:1",value:1},{id:"9:16",label:"9:16",value:9/16}],KH={urlLabel:"URL",urlPlaceholder:"https://example.com",navigate:"Navigate",actions:"Browser view options",devices:"User agent",ratios:"Viewport ratio",back:"Back",forward:"Forward",reload:"Reload preview",previewTitle:"Browser preview"};function KW(e,t,n){return e.find(e=>e.id===t)??n}function Kq({id:e}){return"phone"===e?(0,eb.jsx)(K$,{className:"size-4"}):"tablet"===e?(0,eb.jsx)(KF,{className:"size-4"}):(0,eb.jsx)(F_,{className:"size-4"})}function KU({url:e,defaultUrl:t="https://vantaloom.local/workspace",onUrlChange:n,onNavigate:r,onBack:i,onForward:a,device:o,defaultDevice:l="desktop",onDeviceChange:s,ratio:c,defaultRatio:d="adaptive",onRatioChange:u,devices:f=KV,ratios:h=KB,srcDoc:p,renderPreview:m,showHeader:g=!0,labels:v,className:x,headerClassName:y,previewClassName:b,...w}){let j=ew.useMemo(()=>({...KH,...v}),[v]),[k,S]=ew.useState(t),[C,N]=ew.useState(e??t),[M,E]=ew.useState(()=>[e??t]),[O,P]=ew.useState(0),[A,z]=ew.useState(l),[_,I]=ew.useState(d),[D,T]=ew.useState(!1),[R,L]=ew.useState(0),$=ew.useRef(null),F=ew.useId(),[V,B]=function(){let e=ew.useRef(null),[t,n]=ew.useState({width:0,height:0});return ew.useEffect(()=>{let t=e.current;if(!t)return;function r(e){t&&n(e??{width:t.clientWidth,height:t.clientHeight})}r();let i=new ResizeObserver(e=>{let t=e[0];t?r({width:t.contentRect.width,height:t.contentRect.height}):r()});return i.observe(t),()=>i.disconnect()},[]),[e,t]}(),H=e??k,W=KW(f,o??A,f[0]??KV[0]),q=KW(h,c??_,h[0]??KB[0]),U=B.width>0&&B.height>0,K=q.adaptive||"adaptive"===q.id,G=q.value??16/9,Y=K&&B.width||W.width,X=K?B.height||W.width/G:Y/G,Z=(U?B.width/B.height:1)<=G,J=Math.max(1,Math.round(U?K||Z?B.width:B.height*G:Y)),Q=Math.max(1,Math.round(U?K?B.height:Z?B.width/G:B.height:X)),ee=J/Y,et=ew.useMemo(()=>({url:H,device:W,ratio:q,viewport:{width:J,height:Q,scale:ee}}),[W,q,H,ee,Q,J]);function en(t,i={history:"push"}){void 0===e&&S(t),"none"!==i.history&&E(e=>{let n=e.slice(0,O+1);return n[n.length-1]===t?n:(P(n.length),[...n,t])}),n?.(t),r?.(t)}return ew.useEffect(()=>{N(e??k)},[k,e]),ew.useEffect(()=>{if(D)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Node&&$.current?.contains(t)||T(!1)}},[D]),(0,eb.jsxs)("div",{ref:$,"data-slot":"browser-tab-viewer","data-device":W.id,"data-ratio":q.id,className:tK("vtl-surface-panel relative grid min-h-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",g?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",x),...w,children:[g&&(0,eb.jsxs)("div",{"data-slot":"browser-tab-viewer-header",className:tK("flex min-w-0 items-center gap-2 border-b bg-muted/35 px-3 py-2",y),children:[(0,eb.jsx)("span",{className:"grid size-5 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:(0,eb.jsx)(KL,{className:"size-3.5"})}),(0,eb.jsxs)("form",{onSubmit:function(e){let t;e.preventDefault();let n=(t=C.trim())?/^[a-z][a-z\d+\-.]*:\/\//i.test(t)?t:/^(localhost|127\.0\.0\.1|\[::1\])(?::\d+)?(?:\/|$)/i.test(t)?`http://${t}`:`https://${t}`:"";N(n),en(n)},className:"min-w-0 flex-1",children:[(0,eb.jsx)("label",{className:"sr-only",htmlFor:F,children:j.urlLabel}),(0,eb.jsx)(ny,{id:F,value:C,onChange:e=>N(e.target.value),placeholder:j.urlPlaceholder,className:"h-5 rounded-md border bg-background px-2 shadow-none ui-text-kbd",spellCheck:!1})]}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":j.back,disabled:O<=0,onClick:function(){if(O<=0)return;let e=O-1,t=M[e];t&&(P(e),N(t),en(t,{history:"none"}),i?.(t))},className:"size-5 rounded-md",children:(0,eb.jsx)(KR,{className:"size-3.5"})}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":j.forward,disabled:O>=M.length-1,onClick:function(){if(O>=M.length-1)return;let e=O+1,t=M[e];t&&(P(e),N(t),en(t,{history:"none"}),a?.(t))},className:"size-5 rounded-md",children:(0,eb.jsx)(eM,{className:"size-3.5"})}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-xs","aria-label":j.reload,onClick:()=>L(e=>e+1),className:"size-5 rounded-md",children:(0,eb.jsx)(vC,{className:"size-3.5"})})]}),(0,eb.jsx)("div",{ref:V,"data-slot":"browser-tab-viewer-stage",className:tK("grid min-h-0 place-items-center overflow-hidden bg-muted/20",b),children:(0,eb.jsx)("div",{"data-slot":"browser-tab-viewer-viewport",className:"overflow-hidden rounded-lg border bg-background shadow-sm",style:{width:J,height:Q},children:m?m(et):(0,eb.jsx)("iframe",{title:j.previewTitle,src:p?void 0:H,srcDoc:p,sandbox:"allow-forms allow-modals allow-popups allow-same-origin allow-scripts",className:"size-full border-0 bg-background"},`${R}-${H}-${W.id}-${q.id}`)})}),(0,eb.jsxs)("div",{"data-slot":"browser-tab-floating-actions",className:"absolute right-3 bottom-3 z-20",children:[(0,eb.jsxs)("div",{className:tK("vtl-surface-popover absolute right-0 bottom-10 grid w-56 gap-3 rounded-[var(--surface-popover-radius)] border p-3 transition-[opacity,transform] duration-150",D?"pointer-events-auto opacity-100":"pointer-events-none translate-y-1 opacity-0"),children:[(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsx)("div",{className:"text-muted-foreground ui-text-kbd",children:j.devices}),(0,eb.jsx)("div",{className:"flex gap-1.5",children:f.map(e=>(0,eb.jsx)(tY,{type:"button",variant:W.id===e.id?"default":"outline",size:"icon-sm","aria-label":e.label,title:e.label,className:"rounded-full",onClick:()=>{let t;return t=KW(f,e.id,W),void(void 0===o&&z(t.id),s?.(t.id,t))},children:(0,eb.jsx)(Kq,{id:e.id})},e.id))})]}),(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsx)("div",{className:"text-muted-foreground ui-text-kbd",children:j.ratios}),(0,eb.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.map(e=>(0,eb.jsx)(tY,{type:"button",variant:q.id===e.id?"default":"outline",size:"xs",className:"h-7 rounded-full px-2.5 ui-text-kbd",onClick:()=>{let t;return t=KW(h,e.id,q),void(void 0===c&&I(t.id),u?.(t.id,t))},children:e.label},e.id))})]})]}),(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":j.actions,"aria-expanded":D,onClick:()=>T(e=>!e),className:"rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,eb.jsx)(s6,{className:tK("size-4 transition-transform",D&&"rotate-90")})})]})]})}function KK(e,t){return"function"==typeof e?e(t):e}function KG(e,t){return n=>{t.setState(t=>({...t,[e]:KK(n,t[e])}))}}function KY(e){return e instanceof Function}function KX(e,t,n){let r,i=[];return a=>{let o,l;n.key&&n.debug&&(o=Date.now());let s=e(a);if(!(s.length!==i.length||s.some((e,t)=>i[t]!==e)))return r;if(i=s,n.key&&n.debug&&(l=Date.now()),r=t(...s),null==n||null==n.onChange||n.onChange(r),n.key&&n.debug&&null!=n&&n.debug()){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-l)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=" "+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
|
|
19
19
|
font-size: .6rem;
|
|
20
20
|
font-weight: bold;
|
|
21
|
-
color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,null==n?void 0:n.key)}return r}}function KL(e,t,n,r){return{debug:()=>{var n;return null!=(n=null==e?void 0:e.debugAll)?n:e[t]},key:!1,onChange:r}}let K$="debugHeaders";function KF(e,t,n){var r;let i={id:null!=(r=n.id)?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(i),e},getContext:()=>({table:e,header:i,column:t})};return e._features.forEach(t=>{null==t.createHeader||t.createHeader(i,e)}),i}function KV(e,t,n,r){var i,a;let o=0,l=function(e,t){void 0===t&&(t=1),o=Math.max(o,t),e.filter(e=>e.getIsVisible()).forEach(e=>{var n;null!=(n=e.columns)&&n.length&&l(e.columns,t+1)},0)};l(e);let s=[],c=(e,t)=>{let i={depth:t,id:[r,`${t}`].filter(Boolean).join("_"),headers:[]},a=[];e.forEach(e=>{let o,l=[...a].reverse()[0],s=e.column.depth===i.depth,c=!1;if(s&&e.column.parent?o=e.column.parent:(o=e.column,c=!0),l&&(null==l?void 0:l.column)===o)l.subHeaders.push(e);else{let i=KF(n,o,{id:[r,t,o.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:c,placeholderId:c?`${a.filter(e=>e.column===o).length}`:void 0,depth:t,index:a.length});i.subHeaders.push(e),a.push(i)}i.headers.push(e),e.headerGroup=i}),s.push(i),t>0&&c(a,t-1)};c(t.map((e,t)=>KF(n,e,{depth:o,index:t})),o-1),s.reverse();let d=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,r=[0];return e.subHeaders&&e.subHeaders.length?(r=[],d(e.subHeaders).forEach(e=>{let{colSpan:n,rowSpan:i}=e;t+=n,r.push(i)})):t=1,n+=Math.min(...r),e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}});return d(null!=(i=null==(a=s[0])?void 0:a.headers)?i:[]),s}let KB=(e,t,n,r,i,a,o)=>{let l={id:t,index:r,original:n,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(l._valuesCache.hasOwnProperty(t))return l._valuesCache[t];let n=e.getColumn(t);if(null!=n&&n.accessorFn)return l._valuesCache[t]=n.accessorFn(l.original,r),l._valuesCache[t]},getUniqueValues:t=>{if(l._uniqueValuesCache.hasOwnProperty(t))return l._uniqueValuesCache[t];let n=e.getColumn(t);if(null!=n&&n.accessorFn)return n.columnDef.getUniqueValues?l._uniqueValuesCache[t]=n.columnDef.getUniqueValues(l.original,r):l._uniqueValuesCache[t]=[l.getValue(t)],l._uniqueValuesCache[t]},renderValue:t=>{var n;return null!=(n=l.getValue(t))?n:e.options.renderFallbackValue},subRows:null!=a?a:[],getLeafRows:()=>{var e,t;let n,r;return e=l.subRows,t=e=>e.subRows,n=[],(r=e=>{e.forEach(e=>{n.push(e);let i=t(e);null!=i&&i.length&&r(i)})})(e),n},getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let e=[],t=l;for(;;){let n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:KR(()=>[e.getAllLeafColumns()],t=>t.map(t=>{var n;let r;return n=t.id,r={id:`${l.id}_${t.id}`,row:l,column:t,getValue:()=>l.getValue(n),renderValue:()=>{var t;return null!=(t=r.getValue())?t:e.options.renderFallbackValue},getContext:KR(()=>[e,t,l,r],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),KL(e.options,"debugCells","cell.getContext"))},e._features.forEach(n=>{null==n.createCell||n.createCell(r,t,l,e)},{}),r}),KL(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:KR(()=>[l.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),KL(e.options,"debugRows","getAllCellsByColumnId"))};for(let t=0;t<e._features.length;t++){let n=e._features[t];null==n||null==n.createRow||n.createRow(l,e)}return l},KH=(e,t,n)=>{var r,i;let a=null==n||null==(r=n.toString())?void 0:r.toLowerCase();return!!(null==(i=e.getValue(t))||null==(i=i.toString())||null==(i=i.toLowerCase())?void 0:i.includes(a))};KH.autoRemove=e=>KQ(e);let KW=(e,t,n)=>{var r;return!!(null==(r=e.getValue(t))||null==(r=r.toString())?void 0:r.includes(n))};KW.autoRemove=e=>KQ(e);let Kq=(e,t,n)=>{var r;return(null==(r=e.getValue(t))||null==(r=r.toString())?void 0:r.toLowerCase())===(null==n?void 0:n.toLowerCase())};Kq.autoRemove=e=>KQ(e);let KU=(e,t,n)=>{var r;return null==(r=e.getValue(t))?void 0:r.includes(n)};KU.autoRemove=e=>KQ(e);let KK=(e,t,n)=>!n.some(n=>{var r;return!(null!=(r=e.getValue(t))&&r.includes(n))});KK.autoRemove=e=>KQ(e)||!(null!=e&&e.length);let KG=(e,t,n)=>n.some(n=>{var r;return null==(r=e.getValue(t))?void 0:r.includes(n)});KG.autoRemove=e=>KQ(e)||!(null!=e&&e.length);let KY=(e,t,n)=>e.getValue(t)===n;KY.autoRemove=e=>KQ(e);let KX=(e,t,n)=>e.getValue(t)==n;KX.autoRemove=e=>KQ(e);let KZ=(e,t,n)=>{let[r,i]=n,a=e.getValue(t);return a>=r&&a<=i};KZ.resolveFilterValue=e=>{let[t,n]=e,r="number"!=typeof t?parseFloat(t):t,i="number"!=typeof n?parseFloat(n):n,a=null===t||Number.isNaN(r)?-1/0:r,o=null===n||Number.isNaN(i)?1/0:i;if(a>o){let e=a;a=o,o=e}return[a,o]},KZ.autoRemove=e=>KQ(e)||KQ(e[0])&&KQ(e[1]);let KJ={includesString:KH,includesStringSensitive:KW,equalsString:Kq,arrIncludes:KU,arrIncludesAll:KK,arrIncludesSome:KG,equals:KY,weakEquals:KX,inNumberRange:KZ};function KQ(e){return null==e||""===e}function K0(e,t,n){return!!e&&!!e.autoRemove&&e.autoRemove(t,n)||void 0===t||"string"==typeof t&&!t}let K1={sum:(e,t,n)=>n.reduce((t,n)=>{let r=n.getValue(e);return t+("number"==typeof r?r:0)},0),min:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);null!=n&&(r>n||void 0===r&&n>=n)&&(r=n)}),r},max:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);null!=n&&(r<n||void 0===r&&n>=n)&&(r=n)}),r},extent:(e,t,n)=>{let r,i;return n.forEach(t=>{let n=t.getValue(e);null!=n&&(void 0===r?n>=n&&(r=i=n):(r>n&&(r=n),i<n&&(i=n)))}),[r,i]},mean:(e,t)=>{let n=0,r=0;if(t.forEach(t=>{let i=t.getValue(e);null!=i&&(i*=1)>=i&&(++n,r+=i)}),n)return r/n},median:(e,t)=>{if(!t.length)return;let n=t.map(t=>t.getValue(e));if(!(Array.isArray(n)&&n.every(e=>"number"==typeof e)))return;if(1===n.length)return n[0];let r=Math.floor(n.length/2),i=n.sort((e,t)=>e-t);return n.length%2!=0?i[r]:(i[r-1]+i[r])/2},unique:(e,t)=>Array.from(new Set(t.map(t=>t.getValue(e))).values()),uniqueCount:(e,t)=>new Set(t.map(t=>t.getValue(e))).size,count:(e,t)=>t.length},K2=()=>({left:[],right:[]}),K5={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},K4=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),K3=null;function K6(e){return"touchstart"===e.type}function K8(e,t){return t?"center"===t?e.getCenterVisibleLeafColumns():"left"===t?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}let K7=()=>({pageIndex:0,pageSize:10}),K9=()=>({top:[],bottom:[]}),Ge=(e,t,n,r,i)=>{var a;let o=i.getRow(t,!0);n?(o.getCanMultiSelect()||Object.keys(e).forEach(t=>delete e[t]),o.getCanSelect()&&(e[t]=!0)):delete e[t],r&&null!=(a=o.subRows)&&a.length&&o.getCanSelectSubRows()&&o.subRows.forEach(t=>Ge(e,t.id,n,r,i))};function Gt(e,t){let n=e.getState().rowSelection,r=[],i={},a=function(e,t){return e.map(e=>{var t;let o=Gn(e,n);if(o&&(r.push(e),i[e.id]=e),null!=(t=e.subRows)&&t.length&&(e={...e,subRows:a(e.subRows)}),o)return e}).filter(Boolean)};return{rows:a(t.rows),flatRows:r,rowsById:i}}function Gn(e,t){var n;return null!=(n=t[e.id])&&n}function Gr(e,t,n){var r;if(!(null!=(r=e.subRows)&&r.length))return!1;let i=!0,a=!1;return e.subRows.forEach(e=>{if((!a||i)&&(e.getCanSelect()&&(Gn(e,t)?a=!0:i=!1),e.subRows&&e.subRows.length)){let n=Gr(e,t);"all"===n?a=!0:("some"===n&&(a=!0),i=!1)}}),i?"all":!!a&&"some"}let Gi=/([0-9]+)/gm;function Ga(e,t){return e===t?0:e>t?1:-1}function Go(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}function Gl(e,t){let n=e.split(Gi).filter(Boolean),r=t.split(Gi).filter(Boolean);for(;n.length&&r.length;){let e=n.shift(),t=r.shift(),i=parseInt(e,10),a=parseInt(t,10),o=[i,a].sort();if(isNaN(o[0])){if(e>t)return 1;if(t>e)return -1;continue}if(isNaN(o[1]))return isNaN(i)?-1:1;if(i>a)return 1;if(a>i)return -1}return n.length-r.length}let Gs={alphanumeric:(e,t,n)=>Gl(Go(e.getValue(n)).toLowerCase(),Go(t.getValue(n)).toLowerCase()),alphanumericCaseSensitive:(e,t,n)=>Gl(Go(e.getValue(n)),Go(t.getValue(n))),text:(e,t,n)=>Ga(Go(e.getValue(n)).toLowerCase(),Go(t.getValue(n)).toLowerCase()),textCaseSensitive:(e,t,n)=>Ga(Go(e.getValue(n)),Go(t.getValue(n))),datetime:(e,t,n)=>{let r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},basic:(e,t,n)=>Ga(e.getValue(n),t.getValue(n))},Gc=[{createTable:e=>{e.getHeaderGroups=KR(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{var a,o;let l=null!=(a=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?a:[],s=null!=(o=null==i?void 0:i.map(e=>n.find(t=>t.id===e)).filter(Boolean))?o:[];return KV(t,[...l,...n.filter(e=>!(null!=r&&r.includes(e.id))&&!(null!=i&&i.includes(e.id))),...s],e)},KL(e.options,K$,"getHeaderGroups")),e.getCenterHeaderGroups=KR(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>KV(t,n=n.filter(e=>!(null!=r&&r.includes(e.id))&&!(null!=i&&i.includes(e.id))),e,"center"),KL(e.options,K$,"getCenterHeaderGroups")),e.getLeftHeaderGroups=KR(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var i;return KV(t,null!=(i=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?i:[],e,"left")},KL(e.options,K$,"getLeftHeaderGroups")),e.getRightHeaderGroups=KR(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var i;return KV(t,null!=(i=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?i:[],e,"right")},KL(e.options,K$,"getRightHeaderGroups")),e.getFooterGroups=KR(()=>[e.getHeaderGroups()],e=>[...e].reverse(),KL(e.options,K$,"getFooterGroups")),e.getLeftFooterGroups=KR(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),KL(e.options,K$,"getLeftFooterGroups")),e.getCenterFooterGroups=KR(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),KL(e.options,K$,"getCenterFooterGroups")),e.getRightFooterGroups=KR(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),KL(e.options,K$,"getRightFooterGroups")),e.getFlatHeaders=KR(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),KL(e.options,K$,"getFlatHeaders")),e.getLeftFlatHeaders=KR(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),KL(e.options,K$,"getLeftFlatHeaders")),e.getCenterFlatHeaders=KR(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),KL(e.options,K$,"getCenterFlatHeaders")),e.getRightFlatHeaders=KR(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),KL(e.options,K$,"getRightFlatHeaders")),e.getCenterLeafHeaders=KR(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),KL(e.options,K$,"getCenterLeafHeaders")),e.getLeftLeafHeaders=KR(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),KL(e.options,K$,"getLeftLeafHeaders")),e.getRightLeafHeaders=KR(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),KL(e.options,K$,"getRightLeafHeaders")),e.getLeafHeaders=KR(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>{var r,i,a,o,l,s;return[...null!=(r=null==(i=e[0])?void 0:i.headers)?r:[],...null!=(a=null==(o=t[0])?void 0:o.headers)?a:[],...null!=(l=null==(s=n[0])?void 0:s.headers)?l:[]].map(e=>e.getLeafHeaders()).flat()},KL(e.options,K$,"getLeafHeaders"))}},{getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:KD("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(t=>({...t,[e.id]:null!=n?n:!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;let i=e.columns;return null==(n=i.length?i.some(e=>e.getIsVisible()):null==(r=t.getState().columnVisibility)?void 0:r[e.id])||n},e.getCanHide=()=>{var n,r;return(null==(n=e.columnDef.enableHiding)||n)&&(null==(r=t.options.enableHiding)||r)},e.getToggleVisibilityHandler=()=>t=>{null==e.toggleVisibility||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=KR(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),KL(t.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=KR(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],KL(t.options,"debugRows","getVisibleCells"))},createTable:e=>{let t=(t,n)=>KR(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join("_")],e=>e.filter(e=>null==e.getIsVisible?void 0:e.getIsVisible()),KL(e.options,"debugColumns",t));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>null==e.options.onColumnVisibilityChange?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:null!=(n=e.initialState.columnVisibility)?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=null!=(n=t)?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((e,n)=>({...e,[n.id]:t||!(null!=n.getCanHide&&n.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(e=>!(null!=e.getIsVisible&&e.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(e=>null==e.getIsVisible?void 0:e.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible(null==(n=t.target)?void 0:n.checked)}}},{getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:KD("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=KR(e=>[K8(t,e)],t=>t.findIndex(t=>t.id===e.id),KL(t.options,"debugColumns","getIndex")),e.getIsFirstColumn=n=>{var r;return(null==(r=K8(t,n)[0])?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;let i=K8(t,n);return(null==(r=i[i.length-1])?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>null==e.options.onColumnOrderChange?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:null!=(n=e.initialState.columnOrder)?n:[])},e._getOrderColumnsFn=KR(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(e,t,n)=>r=>{let i=[];if(null!=e&&e.length){let t=[...e],n=[...r];for(;n.length&&t.length;){let e=t.shift(),r=n.findIndex(t=>t.id===e);r>-1&&i.push(n.splice(r,1)[0])}i=[...i,...n]}else i=r;var a=i;if(!(null!=t&&t.length)||!n)return a;let o=a.filter(e=>!t.includes(e.id));return"remove"===n?o:[...t.map(e=>a.find(t=>t.id===e)).filter(Boolean),...o]},KL(e.options,"debugTable","_getOrderColumnsFn"))}},{getInitialState:e=>({columnPinning:K2(),...e}),getDefaultOptions:e=>({onColumnPinningChange:KD("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{let r=e.getLeafColumns().map(e=>e.id).filter(Boolean);t.setColumnPinning(e=>{var t,i,a,o,l,s;return"right"===n?{left:(null!=(a=null==e?void 0:e.left)?a:[]).filter(e=>!(null!=r&&r.includes(e))),right:[...(null!=(o=null==e?void 0:e.right)?o:[]).filter(e=>!(null!=r&&r.includes(e))),...r]}:"left"===n?{left:[...(null!=(l=null==e?void 0:e.left)?l:[]).filter(e=>!(null!=r&&r.includes(e))),...r],right:(null!=(s=null==e?void 0:e.right)?s:[]).filter(e=>!(null!=r&&r.includes(e)))}:{left:(null!=(t=null==e?void 0:e.left)?t:[]).filter(e=>!(null!=r&&r.includes(e))),right:(null!=(i=null==e?void 0:e.right)?i:[]).filter(e=>!(null!=r&&r.includes(e)))}})},e.getCanPin=()=>e.getLeafColumns().some(e=>{var n,r,i;return(null==(n=e.columnDef.enablePinning)||n)&&(null==(r=null!=(i=t.options.enableColumnPinning)?i:t.options.enablePinning)||r)}),e.getIsPinned=()=>{let n=e.getLeafColumns().map(e=>e.id),{left:r,right:i}=t.getState().columnPinning,a=n.some(e=>null==r?void 0:r.includes(e)),o=n.some(e=>null==i?void 0:i.includes(e));return a?"left":!!o&&"right"},e.getPinnedIndex=()=>{var n,r;let i=e.getIsPinned();return i?null!=(n=null==(r=t.getState().columnPinning)||null==(r=r[i])?void 0:r.indexOf(e.id))?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=KR(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,t,n)=>{let r=[...null!=t?t:[],...null!=n?n:[]];return e.filter(e=>!r.includes(e.column.id))},KL(t.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=KR(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:"left"})),KL(t.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=KR(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:"right"})),KL(t.options,"debugRows","getRightVisibleCells"))},createTable:e=>{e.setColumnPinning=t=>null==e.options.onColumnPinningChange?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?K2():null!=(n=null==(r=e.initialState)?void 0:r.columnPinning)?n:K2())},e.getIsSomeColumnsPinned=t=>{var n,r,i;let a=e.getState().columnPinning;return t?!!(null==(n=a[t])?void 0:n.length):!!((null==(r=a.left)?void 0:r.length)||(null==(i=a.right)?void 0:i.length))},e.getLeftLeafColumns=KR(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),KL(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=KR(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),KL(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=KR(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(e,t,n)=>{let r=[...null!=t?t:[],...null!=n?n:[]];return e.filter(e=>!r.includes(e.id))},KL(e.options,"debugColumns","getCenterLeafColumns"))}},{createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},{getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:KD("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let n=t.getCoreRowModel().flatRows[0],r=null==n?void 0:n.getValue(e.id);return"string"==typeof r?KJ.includesString:"number"==typeof r?KJ.inNumberRange:"boolean"==typeof r||null!==r&&"object"==typeof r?KJ.equals:Array.isArray(r)?KJ.arrIncludes:KJ.weakEquals},e.getFilterFn=()=>{var n,r;return KT(e.columnDef.filterFn)?e.columnDef.filterFn:"auto"===e.columnDef.filterFn?e.getAutoFilterFn():null!=(n=null==(r=t.options.filterFns)?void 0:r[e.columnDef.filterFn])?n:KJ[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,i;return(null==(n=e.columnDef.enableColumnFilter)||n)&&(null==(r=t.options.enableColumnFilters)||r)&&(null==(i=t.options.enableFilters)||i)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return null==(n=t.getState().columnFilters)||null==(n=n.find(t=>t.id===e.id))?void 0:n.value},e.getFilterIndex=()=>{var n,r;return null!=(n=null==(r=t.getState().columnFilters)?void 0:r.findIndex(t=>t.id===e.id))?n:-1},e.setFilterValue=n=>{t.setColumnFilters(t=>{var r,i;let a=e.getFilterFn(),o=null==t?void 0:t.find(t=>t.id===e.id),l=KI(n,o?o.value:void 0);if(K0(a,l,e))return null!=(r=null==t?void 0:t.filter(t=>t.id!==e.id))?r:[];let s={id:e.id,value:l};return o?null!=(i=null==t?void 0:t.map(t=>t.id===e.id?s:t))?i:[]:null!=t&&t.length?[...t,s]:[s]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{let n=e.getAllLeafColumns();null==e.options.onColumnFiltersChange||e.options.onColumnFiltersChange(e=>{var r;return null==(r=KI(t,e))?void 0:r.filter(e=>{let t=n.find(t=>t.id===e.id);return!(t&&K0(t.getFilterFn(),e.value,t))&&!0})})},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.columnFilters)?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel)?e.getPreFilteredRowModel():e._getFilteredRowModel()}},{createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},{getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:KD("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;let r=null==(n=e.getCoreRowModel().flatRows[0])||null==(n=n._getAllCellsByColumnId()[t.id])?void 0:n.getValue();return"string"==typeof r||"number"==typeof r}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,i,a;return(null==(n=e.columnDef.enableGlobalFilter)||n)&&(null==(r=t.options.enableGlobalFilter)||r)&&(null==(i=t.options.enableFilters)||i)&&(null==(a=null==t.options.getColumnCanGlobalFilter?void 0:t.options.getColumnCanGlobalFilter(e))||a)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>KJ.includesString,e.getGlobalFilterFn=()=>{var t,n;let{globalFilterFn:r}=e.options;return KT(r)?r:"auto"===r?e.getGlobalAutoFilterFn():null!=(t=null==(n=e.options.filterFns)?void 0:n[r])?t:KJ[r]},e.setGlobalFilter=t=>{null==e.options.onGlobalFilterChange||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},{getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:KD("sorting",e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{let n=t.getFilteredRowModel().flatRows.slice(10),r=!1;for(let t of n){let n=null==t?void 0:t.getValue(e.id);if("[object Date]"===Object.prototype.toString.call(n))return Gs.datetime;if("string"==typeof n&&(r=!0,n.split(Gi).length>1))return Gs.alphanumeric}return r?Gs.text:Gs.basic},e.getAutoSortDir=()=>{let n=t.getFilteredRowModel().flatRows[0];return"string"==typeof(null==n?void 0:n.getValue(e.id))?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw Error();return KT(e.columnDef.sortingFn)?e.columnDef.sortingFn:"auto"===e.columnDef.sortingFn?e.getAutoSortingFn():null!=(n=null==(r=t.options.sortingFns)?void 0:r[e.columnDef.sortingFn])?n:Gs[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{let i=e.getNextSortingOrder(),a=null!=n;t.setSorting(o=>{let l,s=null==o?void 0:o.find(t=>t.id===e.id),c=null==o?void 0:o.findIndex(t=>t.id===e.id),d=[],u=a?n:"desc"===i;if("toggle"!=(l=null!=o&&o.length&&e.getCanMultiSort()&&r?s?"toggle":"add":null!=o&&o.length&&c!==o.length-1?"replace":s?"toggle":"replace")||a||i||(l="remove"),"add"===l){var f;(d=[...o,{id:e.id,desc:u}]).splice(0,d.length-(null!=(f=t.options.maxMultiSortColCount)?f:Number.MAX_SAFE_INTEGER))}else d="toggle"===l?o.map(t=>t.id===e.id?{...t,desc:u}:t):"remove"===l?o.filter(t=>t.id!==e.id):[{id:e.id,desc:u}];return d})},e.getFirstSortDir=()=>{var n,r;return(null!=(n=null!=(r=e.columnDef.sortDescFirst)?r:t.options.sortDescFirst)?n:"desc"===e.getAutoSortDir())?"desc":"asc"},e.getNextSortingOrder=n=>{var r,i;let a=e.getFirstSortDir(),o=e.getIsSorted();return o?(o===a||null!=(r=t.options.enableSortingRemoval)&&!r||!!n&&null!=(i=t.options.enableMultiRemove)&&!i)&&("desc"===o?"asc":"desc"):a},e.getCanSort=()=>{var n,r;return(null==(n=e.columnDef.enableSorting)||n)&&(null==(r=t.options.enableSorting)||r)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return null!=(n=null!=(r=e.columnDef.enableMultiSort)?r:t.options.enableMultiSort)?n:!!e.accessorFn},e.getIsSorted=()=>{var n;let r=null==(n=t.getState().sorting)?void 0:n.find(t=>t.id===e.id);return!!r&&(r.desc?"desc":"asc")},e.getSortIndex=()=>{var n,r;return null!=(n=null==(r=t.getState().sorting)?void 0:r.findIndex(t=>t.id===e.id))?n:-1},e.clearSorting=()=>{t.setSorting(t=>null!=t&&t.length?t.filter(t=>t.id!==e.id):[])},e.getToggleSortingHandler=()=>{let n=e.getCanSort();return r=>{n&&(null==r.persist||r.persist(),null==e.toggleSorting||e.toggleSorting(void 0,!!e.getCanMultiSort()&&(null==t.options.isMultiSortEvent?void 0:t.options.isMultiSortEvent(r))))}}},createTable:e=>{e.setSorting=t=>null==e.options.onSortingChange?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.sorting)?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel)?e.getPreSortedRowModel():e._getSortedRowModel()}},{getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return null!=(t=null==(n=e.getValue())||null==n.toString?void 0:n.toString())?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:KD("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(t=>null!=t&&t.includes(e.id)?t.filter(t=>t!==e.id):[...null!=t?t:[],e.id])},e.getCanGroup=()=>{var n,r;return(null==(n=e.columnDef.enableGrouping)||n)&&(null==(r=t.options.enableGrouping)||r)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{let t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let n=t.getCoreRowModel().flatRows[0],r=null==n?void 0:n.getValue(e.id);return"number"==typeof r?K1.sum:"[object Date]"===Object.prototype.toString.call(r)?K1.extent:void 0},e.getAggregationFn=()=>{var n,r;if(!e)throw Error();return KT(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:"auto"===e.columnDef.aggregationFn?e.getAutoAggregationFn():null!=(n=null==(r=t.options.aggregationFns)?void 0:r[e.columnDef.aggregationFn])?n:K1[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>null==e.options.onGroupingChange?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.grouping)?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel)?e.getPreGroupedRowModel():e._getGroupedRowModel()},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];let r=t.getColumn(n);return null!=r&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!(null!=(t=n.subRows)&&t.length)}}},{getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:KD("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,i;if(!t)return void e._queue(()=>{t=!0});if(null!=(r=null!=(i=e.options.autoResetAll)?i:e.options.autoResetExpanded)?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=t=>null==e.options.onExpandedChange?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{(null!=t?t:!e.getIsAllRowsExpanded())?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{var n,r;e.setExpanded(t?{}:null!=(n=null==(r=e.initialState)?void 0:r.expanded)?n:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(e=>e.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>t=>{null==t.persist||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let t=e.getState().expanded;return!0===t||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{let t=e.getState().expanded;return"boolean"==typeof t?!0===t:!(!Object.keys(t).length||e.getRowModel().flatRows.some(e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(!0===e.getState().expanded?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(e=>{let n=e.split(".");t=Math.max(t,n.length)}),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel)?e.getPreExpandedRowModel():e._getExpandedRowModel()},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var i;let a=!0===r||!!(null!=r&&r[e.id]),o={};if(!0===r?Object.keys(t.getRowModel().rowsById).forEach(e=>{o[e]=!0}):o=r,n=null!=(i=n)?i:!a,!a&&n)return{...o,[e.id]:!0};if(a&&!n){let{[e.id]:t,...n}=o;return n}return r})},e.getIsExpanded=()=>{var n;let r=t.getState().expanded;return!!(null!=(n=null==t.options.getIsRowExpanded?void 0:t.options.getIsRowExpanded(e))?n:!0===r||(null==r?void 0:r[e.id]))},e.getCanExpand=()=>{var n,r,i;return null!=(n=null==t.options.getRowCanExpand?void 0:t.options.getRowCanExpand(e))?n:(null==(r=t.options.enableExpanding)||r)&&!!(null!=(i=e.subRows)&&i.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)n=(r=t.getRow(r.parentId,!0)).getIsExpanded();return n},e.getToggleExpandedHandler=()=>{let t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},{getInitialState:e=>({...e,pagination:{...K7(),...null==e?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:KD("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,i;if(!t)return void e._queue(()=>{t=!0});if(null!=(r=null!=(i=e.options.autoResetAll)?i:e.options.autoResetPageIndex)?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=t=>null==e.options.onPaginationChange?void 0:e.options.onPaginationChange(e=>KI(t,e)),e.resetPagination=t=>{var n;e.setPagination(t?K7():null!=(n=e.initialState.pagination)?n:K7())},e.setPageIndex=t=>{e.setPagination(n=>{let r=KI(t,n.pageIndex);return r=Math.max(0,Math.min(r,void 0===e.options.pageCount||-1===e.options.pageCount?Number.MAX_SAFE_INTEGER:e.options.pageCount-1)),{...n,pageIndex:r}})},e.resetPageIndex=t=>{var n,r;e.setPageIndex(t?0:null!=(n=null==(r=e.initialState)||null==(r=r.pagination)?void 0:r.pageIndex)?n:0)},e.resetPageSize=t=>{var n,r;e.setPageSize(t?10:null!=(n=null==(r=e.initialState)||null==(r=r.pagination)?void 0:r.pageSize)?n:10)},e.setPageSize=t=>{e.setPagination(e=>{let n=Math.max(1,KI(t,e.pageSize)),r=Math.floor(e.pageSize*e.pageIndex/n);return{...e,pageIndex:r,pageSize:n}})},e.setPageCount=t=>e.setPagination(n=>{var r;let i=KI(t,null!=(r=e.options.pageCount)?r:-1);return"number"==typeof i&&(i=Math.max(-1,i)),{...n,pageCount:i}}),e.getPageOptions=KR(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...Array(e)].fill(null).map((e,t)=>t)),t},KL(e.options,"debugTable","getPageOptions")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return -1===n||0!==n&&t<n-1},e.previousPage=()=>e.setPageIndex(e=>e-1),e.nextPage=()=>e.setPageIndex(e=>e+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel)?e.getPrePaginationRowModel():e._getPaginationRowModel(),e.getPageCount=()=>{var t;return null!=(t=e.options.pageCount)?t:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var t;return null!=(t=e.options.rowCount)?t:e.getPrePaginationRowModel().rows.length}}},{getInitialState:e=>({rowPinning:K9(),...e}),getDefaultOptions:e=>({onRowPinningChange:KD("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,i)=>{let a=r?e.getLeafRows().map(e=>{let{id:t}=e;return t}):[],o=new Set([...i?e.getParentRows().map(e=>{let{id:t}=e;return t}):[],e.id,...a]);t.setRowPinning(e=>{var t,r,i,a,l,s;return"bottom"===n?{top:(null!=(i=null==e?void 0:e.top)?i:[]).filter(e=>!(null!=o&&o.has(e))),bottom:[...(null!=(a=null==e?void 0:e.bottom)?a:[]).filter(e=>!(null!=o&&o.has(e))),...Array.from(o)]}:"top"===n?{top:[...(null!=(l=null==e?void 0:e.top)?l:[]).filter(e=>!(null!=o&&o.has(e))),...Array.from(o)],bottom:(null!=(s=null==e?void 0:e.bottom)?s:[]).filter(e=>!(null!=o&&o.has(e)))}:{top:(null!=(t=null==e?void 0:e.top)?t:[]).filter(e=>!(null!=o&&o.has(e))),bottom:(null!=(r=null==e?void 0:e.bottom)?r:[]).filter(e=>!(null!=o&&o.has(e)))}})},e.getCanPin=()=>{var n;let{enableRowPinning:r,enablePinning:i}=t.options;return"function"==typeof r?r(e):null==(n=null!=r?r:i)||n},e.getIsPinned=()=>{let n=[e.id],{top:r,bottom:i}=t.getState().rowPinning,a=n.some(e=>null==r?void 0:r.includes(e)),o=n.some(e=>null==i?void 0:i.includes(e));return a?"top":!!o&&"bottom"},e.getPinnedIndex=()=>{var n,r;let i=e.getIsPinned();if(!i)return -1;let a=null==(n="top"===i?t.getTopRows():t.getBottomRows())?void 0:n.map(e=>{let{id:t}=e;return t});return null!=(r=null==a?void 0:a.indexOf(e.id))?r:-1}},createTable:e=>{e.setRowPinning=t=>null==e.options.onRowPinningChange?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?K9():null!=(n=null==(r=e.initialState)?void 0:r.rowPinning)?n:K9())},e.getIsSomeRowsPinned=t=>{var n,r,i;let a=e.getState().rowPinning;return t?!!(null==(n=a[t])?void 0:n.length):!!((null==(r=a.top)?void 0:r.length)||(null==(i=a.bottom)?void 0:i.length))},e._getPinnedRows=(t,n,r)=>{var i;return(null==(i=e.options.keepPinnedRows)||i?(null!=n?n:[]).map(t=>{let n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null}):(null!=n?n:[]).map(e=>t.find(t=>t.id===e))).filter(Boolean).map(e=>({...e,position:r}))},e.getTopRows=KR(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),KL(e.options,"debugRows","getTopRows")),e.getBottomRows=KR(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),KL(e.options,"debugRows","getBottomRows")),e.getCenterRows=KR(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(e,t,n)=>{let r=new Set([...null!=t?t:[],...null!=n?n:[]]);return e.filter(e=>!r.has(e.id))},KL(e.options,"debugRows","getCenterRows"))}},{getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:KD("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>null==e.options.onRowSelectionChange?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:null!=(n=e.initialState.rowSelection)?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=void 0!==t?t:!e.getIsAllRowsSelected();let r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(e=>{e.getCanSelect()&&(r[e.id]=!0)}):i.forEach(e=>{delete r[e.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{let r=void 0!==t?t:!e.getIsAllPageRowsSelected(),i={...n};return e.getRowModel().rows.forEach(t=>{Ge(i,t.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=KR(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?Gt(e,n):{rows:[],flatRows:[],rowsById:{}},KL(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=KR(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Gt(e,n):{rows:[],flatRows:[],rowsById:{}},KL(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=KR(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Gt(e,n):{rows:[],flatRows:[],rowsById:{}},KL(e.options,"debugTable","getGroupedSelectedRowModel")),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState(),r=!!(t.length&&Object.keys(n).length);return r&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows.filter(e=>e.getCanSelect()),{rowSelection:n}=e.getState(),r=!!t.length;return r&&t.some(e=>!n[e.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;let n=Object.keys(null!=(t=e.getState().rowSelection)?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows;return!e.getIsAllPageRowsSelected()&&t.filter(e=>e.getCanSelect()).some(e=>e.getIsSelected()||e.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{let i=e.getIsSelected();t.setRowSelection(a=>{var o;if(n=void 0!==n?n:!i,e.getCanSelect()&&i===n)return a;let l={...a};return Ge(l,e.id,n,null==(o=null==r?void 0:r.selectChildren)||o,t),l})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return Gn(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return"some"===Gr(e,n)},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return"all"===Gr(e,n)},e.getCanSelect=()=>{var n;return"function"==typeof t.options.enableRowSelection?t.options.enableRowSelection(e):null==(n=t.options.enableRowSelection)||n},e.getCanSelectSubRows=()=>{var n;return"function"==typeof t.options.enableSubRowSelection?t.options.enableSubRowSelection(e):null==(n=t.options.enableSubRowSelection)||n},e.getCanMultiSelect=()=>{var n;return"function"==typeof t.options.enableMultiRowSelection?t.options.enableMultiRowSelection(e):null==(n=t.options.enableMultiRowSelection)||n},e.getToggleSelectedHandler=()=>{let t=e.getCanSelect();return n=>{var r;t&&e.toggleSelected(null==(r=n.target)?void 0:r.checked)}}}},{getDefaultColumnDef:()=>K5,getInitialState:e=>({columnSizing:{},columnSizingInfo:K4(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:KD("columnSizing",e),onColumnSizingInfoChange:KD("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,i;let a=t.getState().columnSizing[e.id];return Math.min(Math.max(null!=(n=e.columnDef.minSize)?n:K5.minSize,null!=(r=null!=a?a:e.columnDef.size)?r:K5.size),null!=(i=e.columnDef.maxSize)?i:K5.maxSize)},e.getStart=KR(e=>[e,K8(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),KL(t.options,"debugColumns","getStart")),e.getAfter=KR(e=>[e,K8(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),KL(t.options,"debugColumns","getAfter")),e.resetSize=()=>{t.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>{var n,r;return(null==(n=e.columnDef.enableResizing)||n)&&(null==(r=t.options.enableColumnResizing)||r)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0,n=e=>{if(e.subHeaders.length)e.subHeaders.forEach(n);else{var r;t+=null!=(r=e.column.getSize())?r:0}};return n(e),t},e.getStart=()=>{if(e.index>0){let t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{let r=t.getColumn(e.column.id),i=null==r?void 0:r.getCanResize();return a=>{if(!r||!i||(null==a.persist||a.persist(),K6(a)&&a.touches&&a.touches.length>1))return;let o=e.getSize(),l=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[r.id,r.getSize()]],s=K6(a)?Math.round(a.touches[0].clientX):a.clientX,c={},d=(e,n)=>{"number"==typeof n&&(t.setColumnSizingInfo(e=>{var r,i;let a="rtl"===t.options.columnResizeDirection?-1:1,o=(n-(null!=(r=null==e?void 0:e.startOffset)?r:0))*a,l=Math.max(o/(null!=(i=null==e?void 0:e.startSize)?i:0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;c[t]=Math.round(100*Math.max(n+n*l,0))/100}),{...e,deltaOffset:o,deltaPercentage:l}}),("onChange"===t.options.columnResizeMode||"end"===e)&&t.setColumnSizing(e=>({...e,...c})))},u=e=>{d("end",e),t.setColumnSizingInfo(e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},f=n||("u">typeof document?document:null),h={moveHandler:e=>d("move",e.clientX),upHandler:e=>{null==f||f.removeEventListener("mousemove",h.moveHandler),null==f||f.removeEventListener("mouseup",h.upHandler),u(e.clientX)}},p={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),d("move",e.touches[0].clientX),!1),upHandler:e=>{var t;null==f||f.removeEventListener("touchmove",p.moveHandler),null==f||f.removeEventListener("touchend",p.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),u(null==(t=e.touches[0])?void 0:t.clientX)}},m=!!function(){if("boolean"==typeof K3)return K3;let e=!1;try{let t=()=>{};window.addEventListener("test",t,{get passive(){return e=!0,!1}}),window.removeEventListener("test",t)}catch(t){e=!1}return K3=e}()&&{passive:!1};K6(a)?(null==f||f.addEventListener("touchmove",p.moveHandler,m),null==f||f.addEventListener("touchend",p.upHandler,m)):(null==f||f.addEventListener("mousemove",h.moveHandler,m),null==f||f.addEventListener("mouseup",h.upHandler,m)),t.setColumnSizingInfo(e=>({...e,startOffset:s,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>null==e.options.onColumnSizingChange?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>null==e.options.onColumnSizingInfoChange?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:null!=(n=e.initialState.columnSizing)?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?K4():null!=(n=e.initialState.columnSizingInfo)?n:K4())},e.getTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getLeftTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getLeftHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getCenterTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getCenterHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getRightTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getRightHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0}}}];function Gd(e,t){var n,r,i;let a;return e?"function"==typeof(r=n=e)&&(a=Object.getPrototypeOf(r)).prototype&&a.prototype.isReactComponent||"function"==typeof n||"object"==typeof(i=n)&&"symbol"==typeof i.$$typeof&&["react.memo","react.forward_ref"].includes(i.$$typeof.description)?ew.createElement(e,t):e:null}function Gu(e,t,n){let r,i=n.initialDeps??[],a=!0;function o(){let o=e();return(o.length!==i.length||o.some((e,t)=>i[t]!==e))&&(i=o,r=t(...o),(null==n?void 0:n.onChange)&&!(a&&n.skipInitialOnChange)&&n.onChange(r),a=!1),r}return o.updateDeps=e=>{i=e},o}function Gf(e,t){if(void 0!==e)return e;throw Error(`Unexpected undefined${t?`: ${t}`:""}`)}let Gh=()=>{if(void 0!==i)return i;if("u"<typeof navigator)return i=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return i=!0;let e=navigator.maxTouchPoints;return i="MacIntel"===navigator.platform&&void 0!==e&&e>0},Gp=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Gm=e=>e,Gg=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},Gv=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(Gp(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(null==e?void 0:e.borderBoxSize){let t=e.borderBoxSize[0];if(t)return void i({width:t.inlineSize,height:t.blockSize})}i(Gp(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:"border-box"}),()=>{a.unobserve(n)}},Gx={passive:!0},Gy="u"<typeof window||"onscrollend"in window,Gb=(e,t)=>((e,t,n)=>{var r,i;let a,o=e.scrollElement;if(!o)return;let l=e.targetWindow;if(!l)return;let s=e.options.useScrollendEvent&&Gy,c=0,d=s?null:(r=()=>t(c,!1),i=e.options.isScrollingResetDelay,function(...e){l.clearTimeout(a),a=l.setTimeout(()=>r.apply(this,e),i)}),u=e=>()=>{c=n(o),null==d||d(),t(c,e)},f=u(!0),h=u(!1);return o.addEventListener("scroll",f,Gx),s&&o.addEventListener("scrollend",h,Gx),()=>{o.removeEventListener("scroll",f),s&&o.removeEventListener("scrollend",h)}})(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),Gw=(e,t,n)=>{if(null==t?void 0:t.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},Gj=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;null==(a=null==(i=r.scrollElement)?void 0:i.scrollTo)||a.call(i,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})};class Gk{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e,t,n;return(null==(n=null==(t=null==(e=this.targetWindow)?void 0:e.performance)?void 0:t.now)?void 0:n.call(t))??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){for(let[e,n]of(this.observer.unobserve(t),this.elementsCache))if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}):null);return{disconnect:()=>{var n;null==(n=t())||n.disconnect(),e=null},observe:e=>{var n;return null==(n=t())?void 0:n.observe(e,{box:"border-box"})},unobserve:e=>{var n;return null==(n=t())?void 0:n.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Gm,rangeExtractor:Gg,onChange:()=>{},measureElement:Gw,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate"};for(let n in e){let r=e[n];void 0!==r&&(t[n]=r)}this.options=t},this.notify=e=>{var t,n;null==(n=(t=this.options).onChange)||n.call(t,this,e)},this.maybeNotify=Gu(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;let t=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==t){if(this.cleanup(),!t)return void this.maybeNotify();if(this.scrollElement=t,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(e=this.scrollElement)?void 0:e.window)??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{null!==this._intendedScrollOffset&&1.5>Math.abs(e-this._intendedScrollOffset)&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,Gh()&&null!=this.targetWindow&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener("touchstart",t,Gx),e.addEventListener("touchend",n,Gx),this.unsubs.push(()=>{e.removeEventListener("touchstart",t),e.removeEventListener("touchend",n),null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this._flushIosDeferredIfReady=()=>{if(0===this._iosDeferredAdjustment||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{let n=new Map,r=new Map;for(let i=t-1;i>=0;i--){let t=e[i];if(n.has(t.lane))continue;let a=r.get(t.lane);if(null==a||t.end>a.end?r.set(t.lane,t):t.end<a.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=Gu(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,t,n,r,i,a,o)=>(void 0!==this.prevLanes&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o}),{key:!1}),this.getMeasurements=Gu(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o},l)=>{let s=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let c=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),1===a){var d;let i,a=this.options.gap,o=2*e,l=this._flatMeasurements;if(!l||l.length<o){let e=new Float64Array(o);l&&c>0&&e.set(l.subarray(0,2*c)),l=e,this._flatMeasurements=l}if(0===c)i=t+n;else{let e=c-1;i=l[2*e]+l[2*e+1]+a}for(let t=c;t<e;t++){let e=r(t),n=s.get(e),o="number"==typeof n?n:this.options.estimateSize(t);l[2*t]=i,l[2*t+1]=o,i+=o+a}let u=(d=l,new Proxy(Array(e),{get(t,n,i){if("string"==typeof n){let i=n.charCodeAt(0);if(i>=48&&i<=57){let i=+n;if(Number.isInteger(i)&&i>=0&&i<e){let e=t[i];if(!e){let n=d[2*i];e=t[i]={index:i,key:r(i),start:n,size:d[2*i+1],end:n+d[2*i+1],lane:0}}return e}}if("length"===n)return e}return Reflect.get(t,n,i)}}));return this.measurementsCache=u,u}let u=this.measurementsCache.slice(0,c),f=Array(a).fill(void 0);for(let e=0;e<c;e++){let t=u[e];t&&(f[t.lane]=e)}for(let i=c;i<e;i++){let e,a,l=r(i),c=this.laneAssignments.get(i),d="estimate"===o||s.has(l);if(void 0!==c&&this.options.lanes>1){let r=f[e=c],i=void 0!==r?u[r]:void 0;a=i?i.end+this.options.gap:t+n}else{let r=1===this.options.lanes?u[i-1]:this.getFurthestMeasurement(u,i);a=r?r.end+this.options.gap:t+n,e=r?r.lane:i%this.options.lanes,this.options.lanes>1&&d&&this.laneAssignments.set(i,e)}let h=s.get(l),p="number"==typeof h?h:this.options.estimateSize(i),m=a+p;u[i]={index:i,start:a,size:p,end:m,key:l,lane:e},f[e]=i}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Gu(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?function({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:i}){let a=e.length-1,o=i?e=>i[2*e]:t=>e[t].start,l=i?e=>i[2*e]+i[2*e+1]:t=>e[t].end;if(e.length<=r)return{startIndex:0,endIndex:a};let s=GS(0,a,o,n),c=s;if(1===r)for(;c<a&&l(c)<n+t;)c++;else if(r>1){let i=Array(r).fill(0);for(;c<a&&i.some(e=>e<n+t);){let t=e[c];i[t.lane]=t.end,c++}let o=Array(r).fill(n+t);for(;s>=0&&o.some(e=>e>=n);){let t=e[s];o[t.lane]=t.start,s--}s=Math.max(0,s-s%r),c=Math.min(a,c+(r-1-c%r))}return{startIndex:s,endIndex:c}}({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:1===r&&null!=this._flatMeasurements?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Gu(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>null===r||null===i?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var t;if(!this.scrollState||"smooth"!==this.scrollState.behavior)return!0;let n=this.scrollState.index??(null==(t=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))?void 0:t.index);if(void 0!==n&&this.range){let t=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,n-t),i=Math.min(this.options.count-1,n+t);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e)return void this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var n;let r,i,a;if(e<0||e>=this.options.count)return;let o=this._flatMeasurements;if(1===this.options.lanes&&null!==o)a=this.options.getItemKey(e),i=o[2*e],r=o[2*e+1];else{let t=this.measurementsCache[e];if(!t)return;a=t.key,i=t.start,r=t.size}let l=t-(this.itemSizeCache.get(a)??r);0!==l&&((null==(n=this.scrollState)?void 0:n.behavior)!=="smooth"&&(void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:a,start:i,size:r,end:i+r,lane:0},l,this):i<this.getScrollOffset()+this.scrollAdjustments&&"backward"!==this.scrollDirection)&&(Gh()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=l:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=l,behavior:void 0})),(null===this.pendingMin||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(a,t),this.itemSizeCacheVersion++,this.notify(!1))},this.getVirtualItems=Gu(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(0===t.length)return;let n=this._flatMeasurements,r=1===this.options.lanes&&null!=n,i=GS(0,t.length-1,r?e=>n[2*e]:e=>Gf(t[e]).start,e);return Gf(t[i])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();return"auto"===t&&(t=e>=i+r?"end":"start"),"center"===t?e+=(n-r)/2:"end"===t&&(e-=r),Math.max(Math.min(this.getMaxScrollOffset(),e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if("auto"===t)if(i.end>=r+n-this.options.scrollPaddingEnd)t="end";else{if(!(i.start<=r+this.options.scrollPaddingStart))return[r,t];t="start"}if("end"===t&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a="end"===t?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t="start",behavior:n="auto"}={})=>{let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t="auto",behavior:n="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t="auto"}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:"start",behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var e;let t,n=this.getMeasurements();if(0===n.length)t=this.options.paddingStart;else if(1===this.options.lanes){let r=n.length-1,i=this._flatMeasurements;t=null!=i?i[2*r]+i[2*r+1]:(null==(e=n[r])?void 0:e.end)??0}else{let e=Array(this.options.lanes).fill(null),r=n.length-1;for(;r>=0&&e.some(e=>null===e);){let t=n[r];null===e[t.lane]&&(e[t.lane]=t.end),r--}t=Math.max(...e.filter(e=>null!==e))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(0===this.itemSizeCache.size)return e;for(let t of this.getMeasurements())t&&this.itemSizeCache.has(t.key)&&e.push({index:t.index,key:t.key,start:t.start,size:t.size,end:t.end,lane:t.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}null==this.rafId&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=null!=this.scrollState.index?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&1.01>Math.abs(t-this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r="smooth"===this.scrollState.behavior&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior="auto"),this._scrollToOffset(t,{adjustments:void 0,behavior:r?"smooth":"auto"})}this.scheduleScrollReconcile()}}let GS=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else{if(!(a>r))return i;t=i-1}}return e>0?e-1:0},GC="u">typeof document?ew.useLayoutEffect:ew.useEffect,GN=eN("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),GM=eN("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]),GE={pathSeparator:"/",searchPlaceholder:"Filter rows...",rows:e=>`${e.toLocaleString()} rows`,columns:e=>`${e.toLocaleString()} columns`,selected:e=>`${e.toLocaleString()} selected`,copied:"Copied",copyCell:"Copy cell",noRows:"No rows match this view.",selectAllRows:"Select all visible rows",selectRow:e=>`Select row ${e+1}`,resizeColumn:"Resize column",sortAsc:"Sort ascending",sortDesc:"Sort descending",sortClear:"Clear sorting"};function GO(e,t){return"function"==typeof e?e(t):e}function GP(e){return null==e?"":"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):e instanceof Date?e.toISOString():JSON.stringify(e)}function GA(e){return"number"==typeof e?e:"boolean"==typeof e?+!!e:GP(e).toLowerCase()}function Gz({file:e={name:"data-table.csv",type:"records"},rows:t,data:n,columns:r,source:i,rowId:a,sorting:o,defaultSorting:l=[],onSortingChange:s,globalFilter:c,defaultGlobalFilter:d="",onGlobalFilterChange:u,rowSelection:f,defaultRowSelection:h={},onRowSelectionChange:p,columnSizing:m,defaultColumnSizing:g={},onColumnSizingChange:v,onCellCopy:x,showHeader:y=!0,showToolbar:b=!0,rowHeight:w=32,overscan:j=14,labels:k,className:S,headerClassName:C,toolbarClassName:N,gridClassName:M,...E}){let O=ew.useMemo(()=>({...GE,...k}),[k]),P=ew.useMemo(()=>{var e,t;let n;return(e=i)?"csv"===e.type?function(e,t=","){let n=function(e,t=","){let n=[],r="",i=[],a=!1;for(let o=0;o<e.length;o+=1){let l=e[o],s=e[o+1];if('"'===l){a&&'"'===s?(r+='"',o+=1):a=!a;continue}if(!a&&l===t){i.push(r),r="";continue}if(!a&&("\n"===l||"\r"===l)){"\r"===l&&"\n"===s&&(o+=1),i.push(r),n.push(i),i=[],r="";continue}r+=l}return i.push(r),i.some(e=>e.length>0)&&n.push(i),n}(e.trim(),t),r=n[0]?.map((e,t)=>e.trim()||`Column ${t+1}`)??[];return{rows:n.slice(1).map(e=>{let t={};return r.forEach((n,r)=>{t[n]=e[r]??""}),t}),columns:r.map(e=>({id:e,header:e,accessorKey:e,minWidth:96,width:Math.max(120,Math.min(260,12*e.length+80))}))}}(e.content,e.delimiter):Array.isArray(n="string"==typeof(t=e.content)?JSON.parse(t):t)?{rows:n,columns:void 0}:n&&"object"==typeof n?{rows:n.rows??n.data??[n],columns:n.columns}:{rows:[{value:n}],columns:void 0}:{rows:void 0,columns:void 0}},[i]),A=ew.useMemo(()=>n??t??P.rows??[],[n,t,P.rows]),z=ew.useMemo(()=>r??P.columns??function(e){let t=new Set;for(let n of e.slice(0,50))Object.keys(n).forEach(e=>t.add(e));return Array.from(t).map(e=>({id:e,header:e,accessorKey:e,minWidth:96,width:Math.max(120,Math.min(280,12*e.length+88))}))}(A),[r,P.columns,A]),[_,I]=ew.useState(l),[D,T]=ew.useState(d),[R,L]=ew.useState(h),[$,F]=ew.useState(g),[V,B]=ew.useState(void 0),[H,W]=ew.useState(void 0),q=ew.useRef(null),U=o??_,K=c??D,G=f??R,Y=m??$,X=function(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=ew.useState(()=>({current:function(e){var t,n;let r=[...Gc,...null!=(t=e._features)?t:[]],i={_features:r},a=i._features.reduce((e,t)=>Object.assign(e,null==t.getDefaultOptions?void 0:t.getDefaultOptions(i)),{}),o={...null!=(n=e.initialState)?n:{}};i._features.forEach(e=>{var t;o=null!=(t=null==e.getInitialState?void 0:e.getInitialState(o))?t:o});let l=[],s=!1,c={_features:r,options:{...a,...e},initialState:o,_queue:e=>{l.push(e),s||(s=!0,Promise.resolve().then(()=>{for(;l.length;)l.shift()();s=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{i.setState(i.initialState)},setOptions:e=>{var t;t=KI(e,i.options),i.options=i.options.mergeOptions?i.options.mergeOptions(a,t):{...a,...t}},getState:()=>i.options.state,setState:e=>{null==i.options.onStateChange||i.options.onStateChange(e)},_getRowId:(e,t,n)=>{var r;return null!=(r=null==i.options.getRowId?void 0:i.options.getRowId(e,t,n))?r:`${n?[n.id,t].join("."):t}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(e,t)=>{let n=(t?i.getPrePaginationRowModel():i.getRowModel()).rowsById[e];if(!n&&!(n=i.getCoreRowModel().rowsById[e]))throw Error();return n},_getDefaultColumnDef:KR(()=>[i.options.defaultColumn],e=>{var t;return e=null!=(t=e)?t:{},{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t,n;return null!=(t=null==(n=e.renderValue())||null==n.toString?void 0:n.toString())?t:null},...i._features.reduce((e,t)=>Object.assign(e,null==t.getDefaultColumnDef?void 0:t.getDefaultColumnDef()),{}),...e}},KL(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>i.options.columns,getAllColumns:KR(()=>[i._getColumnDefs()],e=>{let t=function(e,n,r){return void 0===r&&(r=0),e.map(e=>{let a=function(e,t,n,r){var i,a;let o,l={...e._getDefaultColumnDef(),...t},s=l.accessorKey,c=null!=(i=null!=(a=l.id)?a:s?"function"==typeof String.prototype.replaceAll?s.replaceAll(".","_"):s.replace(/\./g,"_"):void 0)?i:"string"==typeof l.header?l.header:void 0;if(l.accessorFn?o=l.accessorFn:s&&(o=s.includes(".")?e=>{let t=e;for(let e of s.split(".")){var n;t=null==(n=t)?void 0:n[e]}return t}:e=>e[l.accessorKey]),!c)throw Error();let d={id:`${String(c)}`,accessorFn:o,parent:r,depth:n,columnDef:l,columns:[],getFlatColumns:KR(()=>[!0],()=>{var e;return[d,...null==(e=d.columns)?void 0:e.flatMap(e=>e.getFlatColumns())]},KL(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:KR(()=>[e._getOrderColumnsFn()],e=>{var t;return null!=(t=d.columns)&&t.length?e(d.columns.flatMap(e=>e.getLeafColumns())):[d]},KL(e.options,"debugColumns","column.getLeafColumns"))};for(let t of e._features)null==t.createColumn||t.createColumn(d,e);return d}(i,e,r,n);return a.columns=e.columns?t(e.columns,a,r+1):[],a})};return t(e)},KL(e,"debugColumns","getAllColumns")),getAllFlatColumns:KR(()=>[i.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),KL(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:KR(()=>[i.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),KL(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:KR(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),KL(e,"debugColumns","getAllLeafColumns")),getColumn:e=>i._getAllFlatColumnsById()[e]};Object.assign(i,c);for(let e=0;e<i._features.length;e++){let t=i._features[e];null==t||null==t.createTable||t.createTable(i)}return i}(t)})),[r,i]=ew.useState(()=>n.current.initialState);return n.current.setOptions(t=>({...t,...e,state:{...r,...e.state},onStateChange:t=>{i(t),null==e.onStateChange||e.onStateChange(t)}})),n.current}({data:A,columns:ew.useMemo(()=>z.map(e=>({id:e.id,accessorFn:(t,n)=>e.accessorFn?e.accessorFn(t,n):e.accessorKey?t[e.accessorKey]:void 0,header:()=>e.header,cell:t=>e.cell?e.cell({row:t.row.original,rowIndex:t.row.index,value:t.getValue(),column:e}):GP(t.getValue()),sortingFn:(e,t,n)=>{let r=GA(e.getValue(n)),i=GA(t.getValue(n));return"number"==typeof r&&"number"==typeof i?r-i:String(r).localeCompare(String(i),void 0,{numeric:!0})},enableSorting:e.enableSorting??!0,enableGlobalFilter:e.enableFiltering??!0,size:e.width??168,minSize:e.minWidth??80,maxSize:e.maxWidth??640,meta:{align:e.align,className:e.className,headerClassName:e.headerClassName,copyValue:e.copyValue,sourceColumn:e}})),[z]),state:{sorting:U,globalFilter:K,rowSelection:G,columnSizing:Y},defaultColumn:{minSize:80,size:168,maxSize:640},columnResizeMode:"onChange",enableRowSelection:!0,getRowId:"function"==typeof a?(e,t)=>a(e,t):a?(e,t)=>GP(e[a])||String(t):void 0,onSortingChange:e=>{let t=GO(e,U);void 0===o&&I(t),s?.(t)},onGlobalFilterChange:e=>{let t=GO(e,K);void 0===c&&T(t),u?.(t)},onRowSelectionChange:e=>{let t=GO(e,G);void 0===f&&L(t),p?.(t)},onColumnSizingChange:e=>{let t=GO(e,Y);void 0===m&&F(t),v?.(t)},globalFilterFn:(e,t,n)=>{let r=String(n??"").trim().toLowerCase();return!r||GP(e.getValue(t)).toLowerCase().includes(r)},getCoreRowModel:e=>KR(()=>[e.options.data],t=>{let n={rows:[],flatRows:[],rowsById:{}},r=function(t,i,a){void 0===i&&(i=0);let o=[];for(let s=0;s<t.length;s++){let c=KB(e,e._getRowId(t[s],s,a),t[s],s,i,void 0,null==a?void 0:a.id);if(n.flatRows.push(c),n.rowsById[c.id]=c,o.push(c),e.options.getSubRows){var l;c.originalSubRows=e.options.getSubRows(t[s],s),null!=(l=c.originalSubRows)&&l.length&&(c.subRows=r(c.originalSubRows,i+1,c))}}return o};return n.rows=r(t),n},KL(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex())),getFilteredRowModel:e=>KR(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{var i,a,o,l,s,c,d,u,f,h;let p,m,g,v,x,y,b,w,j,k;if(!t.rows.length||!(null!=n&&n.length)&&!r){for(let e=0;e<t.flatRows.length;e++)t.flatRows[e].columnFilters={},t.flatRows[e].columnFiltersMeta={};return t}let S=[],C=[];(null!=n?n:[]).forEach(t=>{var n;let r=e.getColumn(t.id);if(!r)return;let i=r.getFilterFn();i&&S.push({id:t.id,filterFn:i,resolvedValue:null!=(n=null==i.resolveFilterValue?void 0:i.resolveFilterValue(t.value))?n:t.value})});let N=(null!=n?n:[]).map(e=>e.id),M=e.getGlobalFilterFn(),E=e.getAllLeafColumns().filter(e=>e.getCanGlobalFilter());r&&M&&E.length&&(N.push("__global__"),E.forEach(e=>{var t;C.push({id:e.id,filterFn:M,resolvedValue:null!=(t=null==M.resolveFilterValue?void 0:M.resolveFilterValue(r))?t:r})}));for(let e=0;e<t.flatRows.length;e++){let n=t.flatRows[e];if(n.columnFilters={},S.length)for(let e=0;e<S.length;e++){let t=(p=S[e]).id;n.columnFilters[t]=p.filterFn(n,t,p.resolvedValue,e=>{n.columnFiltersMeta[t]=e})}if(C.length){for(let e=0;e<C.length;e++){let t=(m=C[e]).id;if(m.filterFn(n,t,m.resolvedValue,e=>{n.columnFiltersMeta[t]=e})){n.columnFilters.__global__=!0;break}}!0!==n.columnFilters.__global__&&(n.columnFilters.__global__=!1)}}return i=t.rows,a=e=>{for(let t=0;t<N.length;t++)if(!1===e.columnFilters[N[t]])return!1;return!0},e.options.filterFromLeafRows?(o=i,l=a,g=[],v={},x=null!=(c=(s=e).options.maxLeafRowFilterDepth)?c:100,{rows:(y=function(e,t){void 0===t&&(t=0);let n=[];for(let i=0;i<e.length;i++){var r;let a=e[i],o=KB(s,a.id,a.original,a.index,a.depth,void 0,a.parentId);if(o.columnFilters=a.columnFilters,null!=(r=a.subRows)&&r.length&&t<x){if(o.subRows=y(a.subRows,t+1),l(a=o)&&!o.subRows.length||l(a)||o.subRows.length){n.push(a),v[a.id]=a,g.push(a);continue}}else l(a=o)&&(n.push(a),v[a.id]=a,g.push(a))}return n})(o),flatRows:g,rowsById:v}):(d=i,u=a,b=[],w={},j=null!=(h=(f=e).options.maxLeafRowFilterDepth)?h:100,{rows:(k=function(e,t){void 0===t&&(t=0);let n=[];for(let i=0;i<e.length;i++){let a=e[i];if(u(a)){var r;if(null!=(r=a.subRows)&&r.length&&t<j){let e=KB(f,a.id,a.original,a.index,a.depth,void 0,a.parentId);e.subRows=k(a.subRows,t+1),a=e}n.push(a),b.push(a),w[a.id]=a}}return n})(d),flatRows:b,rowsById:w})},KL(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex())),getSortedRowModel:e=>KR(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(null!=t&&t.length))return n;let r=e.getState().sorting,i=[],a=r.filter(t=>{var n;return null==(n=e.getColumn(t.id))?void 0:n.getCanSort()}),o={};a.forEach(t=>{let n=e.getColumn(t.id);n&&(o[t.id]={sortUndefined:n.columnDef.sortUndefined,invertSorting:n.columnDef.invertSorting,sortingFn:n.getSortingFn()})});let l=e=>{let t=e.map(e=>({...e}));return t.sort((e,t)=>{for(let r=0;r<a.length;r+=1){var n;let i=a[r],l=o[i.id],s=l.sortUndefined,c=null!=(n=null==i?void 0:i.desc)&&n,d=0;if(s){let n=e.getValue(i.id),r=t.getValue(i.id),a=void 0===n,o=void 0===r;if(a||o){if("first"===s)return a?-1:1;if("last"===s)return a?1:-1;d=a&&o?0:a?s:-s}}if(0===d&&(d=l.sortingFn(e,t,i.id)),0!==d)return c&&(d*=-1),l.invertSorting&&(d*=-1),d}return e.index-t.index}),t.forEach(e=>{var t;i.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=l(e.subRows))}),t};return{rows:l(n.rows),flatRows:i,rowsById:n.rowsById}},KL(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}),Z=X.getRowModel().rows,J=function({useFlushSync:e=!0,...t}){let n=ew.useReducer(e=>e+1,0)[1],r={...t,onChange:(r,i)=>{var a;e&&i?(0,t3.flushSync)(n):n(),null==(a=t.onChange)||a.call(t,r,i)}},[i]=ew.useState(()=>new Gk(r));return i.setOptions(r),GC(()=>i._didMount(),[]),GC(()=>i._willUpdate()),i}({observeElementRect:Gv,observeElementOffset:Gb,scrollToFn:Gj,...{count:Z.length,getScrollElement:()=>q.current,estimateSize:()=>w,overscan:j,scrollMargin:w}}),Q=X.getVisibleLeafColumns(),ee=Q.reduce((e,t)=>e+t.getSize(),40),et=`40px ${Q.map(e=>`${e.getSize()}px`).join(" ")}`,en=(e?.path??e?.name??"data-table").split(/[\\/]+/).filter(Boolean),er=X.getSelectedRowModel().rows.length;async function ei(e,t){let n=z.find(e=>e.id===t);if(!n)return;let r=e.getValue(t),i=n.copyValue?n.copyValue({row:e.original,rowIndex:e.index,value:r,column:n}):GP(r);await G_(i)&&(W({rowId:e.id,columnId:t}),x?.({row:e.original,rowIndex:e.index,columnId:t,value:r,text:i}),window.setTimeout(()=>{W(n=>n?.rowId===e.id&&n.columnId===t?void 0:n)},1200))}return(0,eb.jsxs)("div",{"data-slot":"data-table-tab-viewer",className:tK("vtl-surface-panel relative grid min-h-0 w-full min-w-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",y&&b?"grid-rows-[auto_auto_minmax(0,1fr)]":y||b?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",S),...E,children:[y&&(0,eb.jsxs)("div",{"data-slot":"data-table-tab-viewer-header",className:tK("flex min-h-9 min-w-0 items-center gap-2 border-b bg-muted/35 px-3 py-2",C),children:[(0,eb.jsx)("span",{className:"grid size-5 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:(0,eb.jsx)(FA,{className:"size-3.5"})}),(0,eb.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 ui-text-kbd",children:en.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[t>0&&(0,eb.jsx)("span",{className:"text-muted-foreground",children:O.pathSeparator}),(0,eb.jsx)("span",{className:tK("truncate",t<en.length-1?"text-muted-foreground":"text-foreground"),children:e})]},`${e}-${t}`))}),(0,eb.jsx)("span",{className:"shrink-0 text-muted-foreground ui-text-kbd",children:e.type??"records"})]}),b&&(0,eb.jsxs)("div",{"data-slot":"data-table-tab-viewer-toolbar",className:tK("flex min-h-10 min-w-0 items-center gap-2 border-b px-3 py-1.5",N),children:[(0,eb.jsxs)("div",{className:"relative min-w-36 flex-1 sm:max-w-80",children:[(0,eb.jsx)(cz,{className:"pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground"}),(0,eb.jsx)(ny,{value:K,onChange:e=>X.setGlobalFilter(e.target.value),placeholder:O.searchPlaceholder,className:"h-7 rounded-md border-border bg-background pl-8 ui-text-control"})]}),(0,eb.jsxs)("div",{className:"flex shrink-0 items-center gap-2 text-muted-foreground ui-text-kbd",children:[(0,eb.jsx)("span",{children:O.rows(Z.length)}),(0,eb.jsx)("span",{className:"h-3 w-px bg-border"}),(0,eb.jsx)("span",{children:O.columns(z.length)}),er>0&&(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{className:"h-3 w-px bg-border"}),(0,eb.jsx)("span",{className:"text-foreground",children:O.selected(er)})]})]})]}),(0,eb.jsx)("div",{ref:q,"data-slot":"data-table-tab-viewer-grid",className:tK("min-h-0 min-w-0 overflow-auto bg-background","[scrollbar-color:var(--border)_transparent] [scrollbar-width:thin]","[&::-webkit-scrollbar]:size-2.5 [&::-webkit-scrollbar-corner]:bg-transparent [&::-webkit-scrollbar-track]:bg-transparent","[&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:border-[3px] [&::-webkit-scrollbar-thumb]:border-transparent [&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-thumb]:bg-clip-content",M),children:(0,eb.jsxs)("div",{className:"relative min-h-full",style:{width:ee,minWidth:"100%"},children:[(0,eb.jsxs)("div",{"data-slot":"data-table-tab-viewer-head",className:"sticky top-0 z-20 grid min-w-full border-b bg-muted/70 backdrop-blur",style:{gridTemplateColumns:et,width:ee,minWidth:"100%"},children:[(0,eb.jsx)("div",{className:"grid h-8 place-items-center border-r",children:(0,eb.jsx)(nx,{checked:!!X.getIsAllRowsSelected()||!!X.getIsSomeRowsSelected()&&"indeterminate",onCheckedChange:e=>X.toggleAllRowsSelected(!0===e),"aria-label":O.selectAllRows})}),X.getFlatHeaders().map(e=>{let t=e.column.columnDef.meta,n=e.column.getIsSorted();return(0,eb.jsxs)("div",{className:tK("group/header relative flex h-8 min-w-0 items-center border-r text-muted-foreground",t?.align==="right"&&"justify-end",t?.align==="center"&&"justify-center",t?.headerClassName),children:[(0,eb.jsxs)("button",{type:"button",disabled:!e.column.getCanSort(),"aria-label":`${GP(t?.sourceColumn.header??e.id)}: ${"asc"===n?O.sortDesc:"desc"===n?O.sortClear:O.sortAsc}`,onClick:e.column.getToggleSortingHandler(),className:tK("flex h-full min-w-0 flex-1 items-center gap-1.5 px-2 text-left ui-text-kbd",e.column.getCanSort()&&"text-foreground hover:bg-muted"),children:[(0,eb.jsx)("span",{className:"truncate",children:Gd(e.column.columnDef.header,e.getContext())}),"asc"===n?(0,eb.jsx)(q_,{className:"size-3 shrink-0"}):"desc"===n?(0,eb.jsx)(GN,{className:"size-3 shrink-0"}):e.column.getCanSort()?(0,eb.jsx)(GM,{className:"size-3 shrink-0 opacity-45"}):null]}),e.column.getCanResize()&&(0,eb.jsx)("button",{type:"button","aria-label":O.resizeColumn,onDoubleClick:()=>e.column.resetSize(),onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:tK("absolute top-0 right-0 h-full w-2 translate-x-1/2 cursor-col-resize touch-none","after:absolute after:top-1 after:right-1/2 after:bottom-1 after:w-px after:bg-border","hover:after:bg-foreground",e.column.getIsResizing()&&"after:bg-foreground")})]},e.id)})]}),0===Z.length?(0,eb.jsx)("div",{className:"grid min-h-44 place-items-center text-muted-foreground ui-text-body",children:O.noRows}):(0,eb.jsx)("div",{"data-slot":"data-table-tab-viewer-rows",className:"relative",style:{height:J.getTotalSize()},children:J.getVirtualItems().map(e=>{let t=Z[e.index];return t?(0,eb.jsxs)("div",{"data-slot":"data-table-tab-viewer-row","data-state":t.getIsSelected()?"selected":void 0,className:tK("absolute left-0 grid min-w-full border-b transition-colors","hover:bg-muted/40 data-[state=selected]:bg-muted/65"),style:{gridTemplateColumns:et,width:ee,minWidth:"100%",height:e.size,transform:`translateY(${e.start-J.options.scrollMargin}px)`},children:[(0,eb.jsx)("div",{className:"grid place-items-center border-r",children:(0,eb.jsx)(nx,{checked:t.getIsSelected(),onCheckedChange:e=>t.toggleSelected(!0===e),"aria-label":O.selectRow(t.index)})}),t.getVisibleCells().map(e=>{let n=e.column.columnDef.meta,r=V?.rowId===t.id&&V.columnId===e.column.id,i=H?.rowId===t.id&&H.columnId===e.column.id;return(0,eb.jsxs)("button",{type:"button","data-slot":"data-table-tab-viewer-cell","data-active":r?"":void 0,onClick:()=>B({rowId:t.id,columnId:e.column.id}),onDoubleClick:()=>ei(t,e.column.id),className:tK("group/cell relative flex min-w-0 items-center border-r px-2 text-left ui-text-code","focus-visible:z-10 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:outline-none","data-active:bg-selection/10",n?.align==="right"&&"justify-end text-right",n?.align==="center"&&"justify-center text-center",n?.className),style:{height:w},children:[(0,eb.jsx)("span",{className:"min-w-0 truncate",children:Gd(e.column.columnDef.cell,e.getContext())}),(0,eb.jsx)("span",{className:tK("absolute top-1/2 right-1 grid size-5 -translate-y-1/2 place-items-center rounded-full border bg-background/95 text-muted-foreground opacity-0 shadow-xs transition-opacity","group-hover/cell:opacity-100",r&&"opacity-100"),title:O.copyCell,onClick:n=>{n.stopPropagation(),ei(t,e.column.id)},children:i?(0,eb.jsx)(nv,{className:"size-3"}):(0,eb.jsx)(s0,{className:"size-3"})})]},e.id)})]},t.id):null})})]})})]})}async function G_(e){try{return await navigator.clipboard?.writeText(e),!0}catch{var t=e;try{let e=document.createElement("textarea");e.value=t,e.setAttribute("readonly",""),e.style.position="fixed",e.style.left="-9999px",e.style.top="0",document.body.appendChild(e),e.select();let n=document.execCommand("copy");return document.body.removeChild(e),n}catch{return!1}}}let GI=eN("file-diff",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]),GD=eN("rows-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]),GT={pathSeparator:"/",additions:"additions",deletions:"deletions",actions:"Diff view options",unified:"Unified diff",split:"Split diff",foldedLines:e=>`${e} folded lines`,expandDown:"Expand next lines",expandUp:"Expand previous lines",expandAll:"Expand folded lines",empty:"No diff content."};function GR(e){return void 0===e?"":String(e)}function GL({line:e,language:t}){let n=ew.useMemo(()=>(function(e,t){if(!e)return[{text:" ",type:"plain"}];let n=RegExp(`("(?:(?:\\\\.)|[^"\\\\])*"|'(?:(?:\\\\.)|[^'\\\\])*'|\\\`(?:(?:\\\\.)|[^\\\`\\\\])*\\\`|//.*|${"css"===t?"\\b(?:align-items|background|border|className|color|display|font|gap|grid|height|justify-content|margin|padding|position|width)\\b":"\\b(?:as|async|await|const|export|false|from|function|if|import|in|let|new|null|return|string|true|type|undefined)\\b"}|\\b\\d+(?:\\.\\d+)?\\b|[{}()[\\].,;:<>/=+\\-*])`,"g"),r=[],i=0;for(let t of e.matchAll(n)){let n=t[0],a=t.index??0;a>i&&r.push({text:e.slice(i,a),type:"plain"}),n.startsWith("//")?r.push({text:n,type:"comment"}):/^["'`]/.test(n)?r.push({text:n,type:"string"}):/^\d/.test(n)?r.push({text:n,type:"number"}):/^[{}()[\].,;:<>/=+\-*]$/.test(n)?r.push({text:n,type:"punctuation"}):r.push({text:n,type:"keyword"}),i=a+n.length}return i<e.length&&r.push({text:e.slice(i),type:"plain"}),r})(e,t),[t,e]);return(0,eb.jsx)(eb.Fragment,{children:n.map((e,t)=>(0,eb.jsx)("span",{className:tK("comment"===e.type&&"text-[var(--vtl-diff-comment)] italic","keyword"===e.type&&"text-[var(--vtl-diff-keyword)]","string"===e.type&&"text-[var(--vtl-diff-string)]","number"===e.type&&"text-[var(--vtl-diff-number)]","punctuation"===e.type&&"text-[var(--vtl-diff-punctuation)]"),children:e.text},`${e.text}-${t}`))})}function G$({row:e,language:t,side:n,blankType:r}){if(!e)return(0,eb.jsxs)("div",{className:tK("relative grid grid-cols-[2.5rem_minmax(0,1fr)] items-stretch overflow-hidden bg-[var(--vtl-diff-empty-bg)]","old"===n&&"border-r",r&&"bg-[image:var(--vtl-diff-empty-hatch)]"),children:[r&&(0,eb.jsx)("span",{className:tK("absolute inset-y-0 left-0 w-1","insert"===r&&"bg-[var(--vtl-diff-insert-fg)]","delete"===r&&"bg-[var(--vtl-diff-delete-fg)]")}),(0,eb.jsx)("span",{}),(0,eb.jsx)("span",{})]});let i="old"===n?"insert"===e.type?void 0:e.oldLineNumber:"delete"===e.type?void 0:e.newLineNumber;return(0,eb.jsxs)("div",{className:tK("relative grid grid-cols-[2.5rem_minmax(0,1fr)] items-stretch overflow-hidden","old"===n&&"border-r","insert"===e.type&&"bg-[var(--vtl-diff-insert-bg)]","delete"===e.type&&"bg-[var(--vtl-diff-delete-bg)]"),children:["context"!==e.type&&(0,eb.jsx)("span",{className:tK("absolute inset-y-0 left-0 w-1","insert"===e.type&&"bg-[var(--vtl-diff-insert-fg)]","delete"===e.type&&"bg-[var(--vtl-diff-delete-fg)]")}),(0,eb.jsx)("span",{className:tK("select-none bg-inherit px-2 text-right text-[var(--vtl-diff-gutter-fg)]","insert"===e.type&&"text-[var(--vtl-diff-insert-fg)]","delete"===e.type&&"text-[var(--vtl-diff-delete-fg)]"),children:GR(i)}),(0,eb.jsx)("span",{className:"overflow-hidden px-3 text-[var(--vtl-diff-code-fg)]",children:(0,eb.jsx)("span",{className:"inline-block whitespace-pre will-change-transform",style:{transform:"translateX(calc(var(--vtl-diff-scroll-left,0px) * -1))"},children:(0,eb.jsx)(GL,{line:e.content,language:t})})})]})}function GF({row:e,language:t,style:n,viewportWidth:r}){return(0,eb.jsx)("div",{"data-slot":"diff-tab-viewer-line","data-type":e.type,className:tK("absolute w-full min-w-full ui-text-code","insert"===e.type&&"bg-[var(--vtl-diff-insert-bg)]","delete"===e.type&&"bg-[var(--vtl-diff-delete-bg)]"),style:n,children:(0,eb.jsxs)("div",{className:"sticky left-0 grid h-full grid-cols-[2.5rem_minmax(0,1fr)] items-stretch",style:{width:r},children:["context"!==e.type&&(0,eb.jsx)("span",{className:tK("absolute inset-y-0 left-0 w-1","insert"===e.type&&"bg-[var(--vtl-diff-insert-fg)]","delete"===e.type&&"bg-[var(--vtl-diff-delete-fg)]")}),(0,eb.jsx)("span",{className:tK("select-none bg-inherit px-2 text-right text-[var(--vtl-diff-gutter-fg)]","insert"===e.type&&"text-[var(--vtl-diff-insert-fg)]","delete"===e.type&&"text-[var(--vtl-diff-delete-fg)]"),children:GR(e.newLineNumber)}),(0,eb.jsx)("span",{className:"overflow-hidden px-3 text-[var(--vtl-diff-code-fg)]",children:(0,eb.jsx)("span",{className:"inline-block whitespace-pre will-change-transform",style:{transform:"translateX(calc(var(--vtl-diff-scroll-left,0px) * -1))"},children:(0,eb.jsx)(GL,{line:e.content,language:t})})})]})})}function GV({row:e,language:t,style:n,viewportWidth:r}){return(0,eb.jsx)("div",{"data-slot":"diff-tab-viewer-split-line",className:"absolute w-full min-w-full ui-text-code",style:n,children:(0,eb.jsxs)("div",{className:"sticky left-0 grid h-full grid-cols-[minmax(0,1fr)_minmax(0,1fr)] items-stretch",style:{width:r},children:[(0,eb.jsx)(G$,{row:e.oldLine,language:t,side:"old",blankType:e.oldBlankType}),(0,eb.jsx)(G$,{row:e.newLine,language:t,side:"new",blankType:e.newBlankType})]})})}function GB({row:e,labels:t,style:n,viewportWidth:r,onExpand:i}){let a="fold-count"===e.kind,o=(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{}),a?(0,eb.jsx)("div",{className:"flex h-full min-w-0 items-center justify-start px-3 text-muted-foreground",children:(0,eb.jsx)("span",{children:t.foldedLines(e.hiddenCount)})}):(0,eb.jsx)("button",{type:"button",className:"group flex h-full min-w-0 items-center gap-2 px-3 text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:bg-muted/70","aria-label":"down"===e.direction?t.expandDown:t.expandUp,onClick:()=>i(e.direction),children:(0,eb.jsxs)(eb.Fragment,{children:["down"===e.direction?(0,eb.jsx)(cE,{className:"size-3.5 shrink-0"}):(0,eb.jsx)(vl,{className:"size-3.5 shrink-0"}),(0,eb.jsx)("span",{className:"h-px min-w-8 flex-1 bg-border transition-colors group-hover:bg-foreground/35"})]})})]});return void 0!==r?(0,eb.jsx)("div",{"data-slot":`diff-tab-viewer-${e.kind}`,className:"absolute w-full min-w-full bg-muted/25 ui-text-code",style:n,children:(0,eb.jsx)("div",{className:"sticky left-0 grid h-full grid-cols-[2.5rem_minmax(0,1fr)] items-stretch",style:{width:r},children:o})}):(0,eb.jsx)("div",{"data-slot":`diff-tab-viewer-${e.kind}`,className:"absolute grid w-full min-w-full grid-cols-[2.5rem_minmax(0,1fr)] items-stretch bg-muted/25 ui-text-code",style:n,children:o})}function GH({open:e,labels:t,currentView:n,onOpenChange:r,onToggleView:i}){let a="unified"===n?t.split:t.unified;return(0,eb.jsx)("div",{"data-slot":"diff-tab-floating-actions",className:"absolute right-3 bottom-3 z-20",children:(0,eb.jsxs)("div",{className:"relative size-8",children:[(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":a,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),i()},className:tK("absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur transition-[opacity,transform] duration-150 ease-out active:translate-y-0",e?"pointer-events-auto -translate-y-[42px] opacity-100":"pointer-events-none translate-y-1 opacity-0"),children:"unified"===n?(0,eb.jsx)(Kb,{className:"size-4"}):(0,eb.jsx)(GD,{className:"size-4"})}),(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.actions,"aria-expanded":e,onClick:()=>r(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,eb.jsx)(s6,{className:tK("size-4 transition-transform",e&&"rotate-90")})})]})})}function GW({file:e,lines:t,diff:n,showHeader:r=!0,contextBefore:i=4,contextAfter:a=4,minFoldLines:o=18,expandStep:l=50,rowHeight:s=22,view:c,defaultView:d="unified",onViewChange:u,labels:f,className:h,headerClassName:p,viewerClassName:m,style:g,...v}){let x,y=ew.useMemo(()=>({...GT,...f}),[f]),b=ew.useMemo(()=>t??(n?function(e){let t=[],n=0,r=0,i=!1;for(let a of e.split("\n")){let e=/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/.exec(a);if(e){n=Number(e[1]),r=Number(e[2]),i=!0;continue}if(!i||a.startsWith("\\ No newline"))continue;let o=a[0],l=a.slice(1);if("+"===o){t.push({type:"insert",content:l,newLineNumber:r}),r+=1;continue}if("-"===o){t.push({type:"delete",content:l,oldLineNumber:n,newLineNumber:r}),n+=1;continue}t.push({type:"context",content:" "===o?l:a,oldLineNumber:n,newLineNumber:r}),n+=1,r+=1}return t}(n):[]),[n,t]),[w,j]=ew.useState({}),[k,S]=ew.useState(0),[C,N]=ew.useState(d),[M,E]=ew.useState(!1),O=ew.useRef(null),[P,A]=function(){let e=ew.useRef(null),[t,n]=ew.useState({height:0,width:0});return ew.useEffect(()=>{let t=e.current;if(!t)return;function r(){n({height:t.getBoundingClientRect().height,width:t.clientWidth})}r();let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[]),[e,t]}(),z=(x=/\.([^.\\/]+)$/.exec(e.name||e.path||""),(e.language??x?.[1]??"text").toLowerCase()),_=c??C,I=ew.useMemo(()=>b.reduce((e,t)=>({additions:e.additions+ +("insert"===t.type),deletions:e.deletions+ +("delete"===t.type),maxLineLength:Math.max(e.maxLineLength,t.content.length)}),{additions:0,deletions:0,maxLineLength:0}),[b]),D=ew.useMemo(()=>(function({rows:e,folds:t,contextBefore:n,contextAfter:r,minFoldLines:i}){let a=[],o=0;function l(e,t){a.push({kind:"line",id:`line-${t}-${e.type}`,line:e})}for(;o<e.length;){let s=e[o];if(s?.type!=="context"){s&&l(s,o),o+=1;continue}let c=o;for(;o<e.length&&e[o]?.type==="context";)o+=1;let d=o,u=d-c;if(u<=n+r+i){for(let t=c;t<d;t+=1)l(e[t],t);continue}let f=`${c}-${d}`,h=t[f]??{revealTop:0,revealBottom:0},p=Math.min(n+h.revealTop,u),m=Math.min(r+h.revealBottom,u-p),g=c+p,v=d-m,x=v-g;if(x<=0){for(let t=c;t<d;t+=1)l(e[t],t);continue}for(let t=c;t<g;t+=1)l(e[t],t);a.push({kind:"fold-action",id:`fold-${f}-down-${x}`,foldId:f,direction:"down",hiddenCount:x}),a.push({kind:"fold-count",id:`fold-${f}-count-${x}`,foldId:f,hiddenCount:x}),a.push({kind:"fold-action",id:`fold-${f}-up-${x}`,foldId:f,direction:"up",hiddenCount:x});for(let t=v;t<d;t+=1)l(e[t],t)}return a})({rows:b,folds:w,contextBefore:i,contextAfter:a,minFoldLines:o}),[a,i,w,o,b]),T=ew.useMemo(()=>(function(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(!r)break;if("line"!==r.kind){t.push(r),n+=1;continue}if("context"===r.line.type){t.push({kind:"split-line",id:`split-${r.id}`,oldLine:r.line,newLine:r.line}),n+=1;continue}let i=[];for(;e[n]?.kind==="line";){let t=e[n];if("context"===t.line.type)break;i.push(t.line),n+=1}let a=i.filter(e=>"delete"===e.type),o=i.filter(e=>"insert"===e.type),l=Math.max(a.length,o.length);for(let e=0;e<l;e+=1){let n=a[e],r=o[e];t.push({kind:"split-line",id:`split-change-${t.length}-${n?.oldLineNumber??"empty"}-${r?.newLineNumber??"empty"}`,oldLine:n,newLine:r,oldBlankType:n?void 0:"insert",newBlankType:r?void 0:"delete"})}}return t})(D),[D]),R="split"===_?T:D,L=(e.path??e.name).split(/[\\/]+/).filter(Boolean),$=R.length*s,F=Math.max(0,Math.floor(k/s)-12),V=Math.min(R.length,Math.ceil((k+A.height)/s)+12),B=R.slice(F,V),H=Math.max(A.width,1),W=9.6*I.maxLineLength+168,q=Math.max(760,W),U=Math.max(A.width,1),K=Math.max(U,U/2+W),G=`${e.path??e.name}-${n??""}-${t?.length??0}`;return ew.useEffect(()=>{j({}),S(0),E(!1)},[G]),ew.useEffect(()=>{if(M)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Node&&O.current?.contains(t)||E(!1)}},[M]),(0,eb.jsxs)("div",{ref:O,"data-slot":"diff-tab-viewer","data-view":_,className:tK("vtl-surface-panel relative grid min-h-0 w-full min-w-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",r?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",h),style:g,...v,children:[r&&(0,eb.jsxs)("div",{"data-slot":"diff-tab-viewer-header",className:tK("flex min-w-0 items-center gap-2 border-b bg-muted/35 px-3 py-2",p),children:[(0,eb.jsx)("span",{className:"grid size-5 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:(0,eb.jsx)(GI,{className:"size-3.5"})}),(0,eb.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 ui-text-kbd",children:L.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[t>0&&(0,eb.jsx)("span",{className:"text-muted-foreground",children:y.pathSeparator}),(0,eb.jsx)("span",{className:tK("truncate",t===L.length-1?"font-medium text-foreground":"text-muted-foreground"),children:e})]},`${e}-${t}`))}),(0,eb.jsxs)("div",{className:"hidden shrink-0 items-center gap-1.5 sm:flex",children:[(0,eb.jsxs)(cI,{variant:"outline",className:"text-[var(--vtl-diff-insert-fg)]",children:["+",I.additions," ",y.additions]}),(0,eb.jsxs)(cI,{variant:"outline",className:"text-[var(--vtl-diff-delete-fg)]",children:["-",I.deletions," ",y.deletions]})]})]}),0===b.length?(0,eb.jsx)("div",{className:"grid min-h-0 place-items-center p-6 text-muted-foreground ui-text-body",children:y.empty}):(0,eb.jsx)("div",{ref:P,"data-slot":"diff-tab-viewer-body",className:tK("min-h-0 min-w-0 overflow-auto bg-background font-mono","[scrollbar-color:var(--border)_transparent] [scrollbar-width:thin]","[&::-webkit-scrollbar]:size-2.5 [&::-webkit-scrollbar-corner]:bg-transparent [&::-webkit-scrollbar-track]:bg-transparent","[&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:border-[3px] [&::-webkit-scrollbar-thumb]:border-transparent [&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-thumb]:bg-clip-content",m),style:{"--vtl-diff-scroll-left":"0px"},onScroll:e=>{S(e.currentTarget.scrollTop),e.currentTarget.style.setProperty("--vtl-diff-scroll-left",`${e.currentTarget.scrollLeft}px`)},children:(0,eb.jsx)("div",{"data-slot":"diff-tab-viewer-scroll-width",className:"relative min-h-full",style:{height:$,width:"split"===_?K:q,minWidth:"100%"},children:B.map((e,t)=>{let n=F+t,r={height:s,lineHeight:`${s}px`,transform:`translateY(${n*s}px)`};return"line"===e.kind?(0,eb.jsx)(GF,{row:e.line,language:z,style:r,viewportWidth:H},e.id):"split-line"===e.kind?(0,eb.jsx)(GV,{row:e,language:z,style:r,viewportWidth:U},e.id):(0,eb.jsx)(GB,{row:e,labels:y,style:r,viewportWidth:"split"===_?U:void 0,onExpand:t=>{var n;return n=e.foldId,void j(e=>{let r=e[n]??{revealTop:0,revealBottom:0};return"all"===t?{...e,[n]:{revealTop:Number.MAX_SAFE_INTEGER,revealBottom:0}}:{...e,[n]:{revealTop:"down"===t?r.revealTop+l:r.revealTop,revealBottom:"up"===t?r.revealBottom+l:r.revealBottom}}})}},e.id)})})}),(0,eb.jsx)(GH,{open:M,labels:y,currentView:_,onOpenChange:E,onToggleView:function(){var e;e="unified"===_?"split":"unified",void 0===c&&N(e),u?.(e)}})]})}var Gq=e.i(32800);function GU(e){return new Gq.LanguageSupport(Gq.StreamLanguage.define(e))}function GK(t){return e.A(22206).then(e=>e.sql({dialect:e[t]}))}let GG=[Gq.LanguageDescription.of({name:"C",extensions:["c","h","ino"],load:()=>e.A(92137).then(e=>e.cpp())}),Gq.LanguageDescription.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load:()=>e.A(92137).then(e=>e.cpp())}),Gq.LanguageDescription.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load:()=>GK("Cassandra")}),Gq.LanguageDescription.of({name:"CSS",extensions:["css"],load:()=>e.A(79258).then(e=>e.css())}),Gq.LanguageDescription.of({name:"Go",extensions:["go"],load:()=>e.A(44771).then(e=>e.go())}),Gq.LanguageDescription.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load:()=>e.A(82412).then(e=>e.html())}),Gq.LanguageDescription.of({name:"Java",extensions:["java"],load:()=>e.A(35733).then(e=>e.java())}),Gq.LanguageDescription.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load:()=>e.A(56714).then(e=>e.javascript())}),Gq.LanguageDescription.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load:()=>e.A(68909).then(e=>e.jinja())}),Gq.LanguageDescription.of({name:"JSON",alias:["json5"],extensions:["json","map"],load:()=>e.A(42017).then(e=>e.json())}),Gq.LanguageDescription.of({name:"JSX",extensions:["jsx"],load:()=>e.A(56714).then(e=>e.javascript({jsx:!0}))}),Gq.LanguageDescription.of({name:"LESS",extensions:["less"],load:()=>e.A(23404).then(e=>e.less())}),Gq.LanguageDescription.of({name:"Liquid",extensions:["liquid"],load:()=>e.A(20628).then(e=>e.liquid())}),Gq.LanguageDescription.of({name:"MariaDB SQL",load:()=>GK("MariaSQL")}),Gq.LanguageDescription.of({name:"Markdown",extensions:["md","markdown","mkd"],load:()=>e.A(80207).then(e=>e.markdown())}),Gq.LanguageDescription.of({name:"MS SQL",load:()=>GK("MSSQL")}),Gq.LanguageDescription.of({name:"MySQL",load:()=>GK("MySQL")}),Gq.LanguageDescription.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load:()=>e.A(50333).then(e=>e.php())}),Gq.LanguageDescription.of({name:"PLSQL",extensions:["pls"],load:()=>GK("PLSQL")}),Gq.LanguageDescription.of({name:"PostgreSQL",load:()=>GK("PostgreSQL")}),Gq.LanguageDescription.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load:()=>e.A(43848).then(e=>e.python())}),Gq.LanguageDescription.of({name:"Rust",extensions:["rs"],load:()=>e.A(22094).then(e=>e.rust())}),Gq.LanguageDescription.of({name:"Sass",extensions:["sass"],load:()=>e.A(62363).then(e=>e.sass({indented:!0}))}),Gq.LanguageDescription.of({name:"SCSS",extensions:["scss"],load:()=>e.A(62363).then(e=>e.sass())}),Gq.LanguageDescription.of({name:"SQL",extensions:["sql"],load:()=>GK("StandardSQL")}),Gq.LanguageDescription.of({name:"SQLite",load:()=>GK("SQLite")}),Gq.LanguageDescription.of({name:"TSX",extensions:["tsx"],load:()=>e.A(56714).then(e=>e.javascript({jsx:!0,typescript:!0}))}),Gq.LanguageDescription.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load:()=>e.A(56714).then(e=>e.javascript({typescript:!0}))}),Gq.LanguageDescription.of({name:"WebAssembly",extensions:["wat","wast"],load:()=>e.A(11043).then(e=>e.wast())}),Gq.LanguageDescription.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load:()=>e.A(25290).then(e=>e.xml())}),Gq.LanguageDescription.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load:()=>e.A(66027).then(e=>e.yaml())}),Gq.LanguageDescription.of({name:"APL",extensions:["dyalog","apl"],load:()=>e.A(66919).then(e=>GU(e.apl))}),Gq.LanguageDescription.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load:()=>e.A(96245).then(e=>GU(e.asciiArmor))}),Gq.LanguageDescription.of({name:"ASN.1",extensions:["asn","asn1"],load:()=>e.A(95592).then(e=>GU(e.asn1({})))}),Gq.LanguageDescription.of({name:"Asterisk",filename:/^extensions\.conf$/i,load:()=>e.A(38120).then(e=>GU(e.asterisk))}),Gq.LanguageDescription.of({name:"Brainfuck",extensions:["b","bf"],load:()=>e.A(33855).then(e=>GU(e.brainfuck))}),Gq.LanguageDescription.of({name:"Cobol",extensions:["cob","cpy"],load:()=>e.A(37413).then(e=>GU(e.cobol))}),Gq.LanguageDescription.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load:()=>e.A(38138).then(e=>GU(e.csharp))}),Gq.LanguageDescription.of({name:"Clojure",extensions:["clj","cljc","cljx"],load:()=>e.A(32566).then(e=>GU(e.clojure))}),Gq.LanguageDescription.of({name:"ClojureScript",extensions:["cljs"],load:()=>e.A(32566).then(e=>GU(e.clojure))}),Gq.LanguageDescription.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load:()=>e.A(48876).then(e=>GU(e.gss))}),Gq.LanguageDescription.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load:()=>e.A(44086).then(e=>GU(e.cmake))}),Gq.LanguageDescription.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load:()=>e.A(11973).then(e=>GU(e.coffeeScript))}),Gq.LanguageDescription.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load:()=>e.A(16995).then(e=>GU(e.commonLisp))}),Gq.LanguageDescription.of({name:"Cypher",extensions:["cyp","cypher"],load:()=>e.A(45748).then(e=>GU(e.cypher))}),Gq.LanguageDescription.of({name:"Cython",extensions:["pyx","pxd","pxi"],load:()=>e.A(64832).then(e=>GU(e.cython))}),Gq.LanguageDescription.of({name:"Crystal",extensions:["cr"],load:()=>e.A(55133).then(e=>GU(e.crystal))}),Gq.LanguageDescription.of({name:"D",extensions:["d"],load:()=>e.A(24299).then(e=>GU(e.d))}),Gq.LanguageDescription.of({name:"Dart",extensions:["dart"],load:()=>e.A(38138).then(e=>GU(e.dart))}),Gq.LanguageDescription.of({name:"diff",extensions:["diff","patch"],load:()=>e.A(85978).then(e=>GU(e.diff))}),Gq.LanguageDescription.of({name:"Dockerfile",filename:/^Dockerfile$/,load:()=>e.A(89654).then(e=>GU(e.dockerFile))}),Gq.LanguageDescription.of({name:"DTD",extensions:["dtd"],load:()=>e.A(77925).then(e=>GU(e.dtd))}),Gq.LanguageDescription.of({name:"Dylan",extensions:["dylan","dyl","intr"],load:()=>e.A(27553).then(e=>GU(e.dylan))}),Gq.LanguageDescription.of({name:"EBNF",load:()=>e.A(6232).then(e=>GU(e.ebnf))}),Gq.LanguageDescription.of({name:"ECL",extensions:["ecl"],load:()=>e.A(11956).then(e=>GU(e.ecl))}),Gq.LanguageDescription.of({name:"edn",extensions:["edn"],load:()=>e.A(32566).then(e=>GU(e.clojure))}),Gq.LanguageDescription.of({name:"Eiffel",extensions:["e"],load:()=>e.A(25267).then(e=>GU(e.eiffel))}),Gq.LanguageDescription.of({name:"Elm",extensions:["elm"],load:()=>e.A(6956).then(e=>GU(e.elm))}),Gq.LanguageDescription.of({name:"Erlang",extensions:["erl"],load:()=>e.A(2095).then(e=>GU(e.erlang))}),Gq.LanguageDescription.of({name:"Esper",load:()=>e.A(45412).then(e=>GU(e.esper))}),Gq.LanguageDescription.of({name:"Factor",extensions:["factor"],load:()=>e.A(2075).then(e=>GU(e.factor))}),Gq.LanguageDescription.of({name:"FCL",load:()=>e.A(68091).then(e=>GU(e.fcl))}),Gq.LanguageDescription.of({name:"Forth",extensions:["forth","fth","4th"],load:()=>e.A(54669).then(e=>GU(e.forth))}),Gq.LanguageDescription.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load:()=>e.A(76946).then(e=>GU(e.fortran))}),Gq.LanguageDescription.of({name:"F#",alias:["fsharp"],extensions:["fs"],load:()=>e.A(36855).then(e=>GU(e.fSharp))}),Gq.LanguageDescription.of({name:"Gas",extensions:["s"],load:()=>e.A(40367).then(e=>GU(e.gas))}),Gq.LanguageDescription.of({name:"Gherkin",extensions:["feature"],load:()=>e.A(23161).then(e=>GU(e.gherkin))}),Gq.LanguageDescription.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load:()=>e.A(97713).then(e=>GU(e.groovy))}),Gq.LanguageDescription.of({name:"Haskell",extensions:["hs"],load:()=>e.A(56334).then(e=>GU(e.haskell))}),Gq.LanguageDescription.of({name:"Haxe",extensions:["hx"],load:()=>e.A(70963).then(e=>GU(e.haxe))}),Gq.LanguageDescription.of({name:"HXML",extensions:["hxml"],load:()=>e.A(70963).then(e=>GU(e.hxml))}),Gq.LanguageDescription.of({name:"HTTP",load:()=>e.A(35064).then(e=>GU(e.http))}),Gq.LanguageDescription.of({name:"IDL",extensions:["pro"],load:()=>e.A(89381).then(e=>GU(e.idl))}),Gq.LanguageDescription.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load:()=>e.A(59695).then(e=>GU(e.jsonld))}),Gq.LanguageDescription.of({name:"Julia",extensions:["jl"],load:()=>e.A(64014).then(e=>GU(e.julia))}),Gq.LanguageDescription.of({name:"Kotlin",extensions:["kt","kts"],load:()=>e.A(38138).then(e=>GU(e.kotlin))}),Gq.LanguageDescription.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load:()=>e.A(42765).then(e=>GU(e.liveScript))}),Gq.LanguageDescription.of({name:"Lua",extensions:["lua"],load:()=>e.A(97328).then(e=>GU(e.lua))}),Gq.LanguageDescription.of({name:"mIRC",extensions:["mrc"],load:()=>e.A(34747).then(e=>GU(e.mirc))}),Gq.LanguageDescription.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load:()=>e.A(15637).then(e=>GU(e.mathematica))}),Gq.LanguageDescription.of({name:"Modelica",extensions:["mo"],load:()=>e.A(4877).then(e=>GU(e.modelica))}),Gq.LanguageDescription.of({name:"MUMPS",extensions:["mps"],load:()=>e.A(51221).then(e=>GU(e.mumps))}),Gq.LanguageDescription.of({name:"Mbox",extensions:["mbox"],load:()=>e.A(64186).then(e=>GU(e.mbox))}),Gq.LanguageDescription.of({name:"Nginx",filename:/nginx.*\.conf$/i,load:()=>e.A(84274).then(e=>GU(e.nginx))}),Gq.LanguageDescription.of({name:"NSIS",extensions:["nsh","nsi"],load:()=>e.A(51971).then(e=>GU(e.nsis))}),Gq.LanguageDescription.of({name:"NTriples",extensions:["nt","nq"],load:()=>e.A(42967).then(e=>GU(e.ntriples))}),Gq.LanguageDescription.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load:()=>e.A(38138).then(e=>GU(e.objectiveC))}),Gq.LanguageDescription.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load:()=>e.A(38138).then(e=>GU(e.objectiveCpp))}),Gq.LanguageDescription.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load:()=>e.A(36855).then(e=>GU(e.oCaml))}),Gq.LanguageDescription.of({name:"Octave",extensions:["m"],load:()=>e.A(22492).then(e=>GU(e.octave))}),Gq.LanguageDescription.of({name:"Oz",extensions:["oz"],load:()=>e.A(73945).then(e=>GU(e.oz))}),Gq.LanguageDescription.of({name:"Pascal",extensions:["p","pas"],load:()=>e.A(2372).then(e=>GU(e.pascal))}),Gq.LanguageDescription.of({name:"Perl",extensions:["pl","pm"],load:()=>e.A(44660).then(e=>GU(e.perl))}),Gq.LanguageDescription.of({name:"Pig",extensions:["pig"],load:()=>e.A(28734).then(e=>GU(e.pig))}),Gq.LanguageDescription.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load:()=>e.A(36584).then(e=>GU(e.powerShell))}),Gq.LanguageDescription.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load:()=>e.A(97145).then(e=>GU(e.properties))}),Gq.LanguageDescription.of({name:"ProtoBuf",extensions:["proto"],load:()=>e.A(86304).then(e=>GU(e.protobuf))}),Gq.LanguageDescription.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load:()=>e.A(86501).then(e=>GU(e.pug))}),Gq.LanguageDescription.of({name:"Puppet",extensions:["pp"],load:()=>e.A(16397).then(e=>GU(e.puppet))}),Gq.LanguageDescription.of({name:"Q",extensions:["q"],load:()=>e.A(71617).then(e=>GU(e.q))}),Gq.LanguageDescription.of({name:"R",alias:["rscript"],extensions:["r","R"],load:()=>e.A(62905).then(e=>GU(e.r))}),Gq.LanguageDescription.of({name:"RPM Changes",load:()=>e.A(31053).then(e=>GU(e.rpmChanges))}),Gq.LanguageDescription.of({name:"RPM Spec",extensions:["spec"],load:()=>e.A(31053).then(e=>GU(e.rpmSpec))}),Gq.LanguageDescription.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load:()=>e.A(84403).then(e=>GU(e.ruby))}),Gq.LanguageDescription.of({name:"SAS",extensions:["sas"],load:()=>e.A(57388).then(e=>GU(e.sas))}),Gq.LanguageDescription.of({name:"Scala",extensions:["scala"],load:()=>e.A(38138).then(e=>GU(e.scala))}),Gq.LanguageDescription.of({name:"Scheme",extensions:["scm","ss"],load:()=>e.A(94780).then(e=>GU(e.scheme))}),Gq.LanguageDescription.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load:()=>e.A(8240).then(e=>GU(e.shell))}),Gq.LanguageDescription.of({name:"Sieve",extensions:["siv","sieve"],load:()=>e.A(46740).then(e=>GU(e.sieve))}),Gq.LanguageDescription.of({name:"Smalltalk",extensions:["st"],load:()=>e.A(48213).then(e=>GU(e.smalltalk))}),Gq.LanguageDescription.of({name:"Solr",load:()=>e.A(47982).then(e=>GU(e.solr))}),Gq.LanguageDescription.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load:()=>e.A(36855).then(e=>GU(e.sml))}),Gq.LanguageDescription.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load:()=>e.A(85501).then(e=>GU(e.sparql))}),Gq.LanguageDescription.of({name:"Spreadsheet",alias:["excel","formula"],load:()=>e.A(44878).then(e=>GU(e.spreadsheet))}),Gq.LanguageDescription.of({name:"Squirrel",extensions:["nut"],load:()=>e.A(38138).then(e=>GU(e.squirrel))}),Gq.LanguageDescription.of({name:"Stylus",extensions:["styl"],load:()=>e.A(76475).then(e=>GU(e.stylus))}),Gq.LanguageDescription.of({name:"Swift",extensions:["swift"],load:()=>e.A(8835).then(e=>GU(e.swift))}),Gq.LanguageDescription.of({name:"sTeX",load:()=>e.A(42690).then(e=>GU(e.stex))}),Gq.LanguageDescription.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load:()=>e.A(42690).then(e=>GU(e.stex))}),Gq.LanguageDescription.of({name:"SystemVerilog",extensions:["v","sv","svh"],load:()=>e.A(78077).then(e=>GU(e.verilog))}),Gq.LanguageDescription.of({name:"Tcl",extensions:["tcl"],load:()=>e.A(139).then(e=>GU(e.tcl))}),Gq.LanguageDescription.of({name:"Textile",extensions:["textile"],load:()=>e.A(75208).then(e=>GU(e.textile))}),Gq.LanguageDescription.of({name:"TiddlyWiki",load:()=>e.A(44524).then(e=>GU(e.tiddlyWiki))}),Gq.LanguageDescription.of({name:"Tiki wiki",load:()=>e.A(38168).then(e=>GU(e.tiki))}),Gq.LanguageDescription.of({name:"TOML",extensions:["toml"],load:()=>e.A(40346).then(e=>GU(e.toml))}),Gq.LanguageDescription.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load:()=>e.A(13368).then(e=>GU(e.troff))}),Gq.LanguageDescription.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load:()=>e.A(49796).then(e=>GU(e.ttcn))}),Gq.LanguageDescription.of({name:"TTCN_CFG",extensions:["cfg"],load:()=>e.A(80429).then(e=>GU(e.ttcnCfg))}),Gq.LanguageDescription.of({name:"Turtle",extensions:["ttl"],load:()=>e.A(98657).then(e=>GU(e.turtle))}),Gq.LanguageDescription.of({name:"Web IDL",extensions:["webidl"],load:()=>e.A(86672).then(e=>GU(e.webIDL))}),Gq.LanguageDescription.of({name:"VB.NET",extensions:["vb"],load:()=>e.A(39480).then(e=>GU(e.vb))}),Gq.LanguageDescription.of({name:"VBScript",extensions:["vbs"],load:()=>e.A(77625).then(e=>GU(e.vbScript))}),Gq.LanguageDescription.of({name:"Velocity",extensions:["vtl"],load:()=>e.A(42762).then(e=>GU(e.velocity))}),Gq.LanguageDescription.of({name:"Verilog",extensions:["v"],load:()=>e.A(78077).then(e=>GU(e.verilog))}),Gq.LanguageDescription.of({name:"VHDL",extensions:["vhd","vhdl"],load:()=>e.A(24973).then(e=>GU(e.vhdl))}),Gq.LanguageDescription.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load:()=>e.A(50321).then(e=>GU(e.xQuery))}),Gq.LanguageDescription.of({name:"Yacas",extensions:["ys"],load:()=>e.A(79514).then(e=>GU(e.yacas))}),Gq.LanguageDescription.of({name:"Z80",extensions:["z80"],load:()=>e.A(91533).then(e=>GU(e.z80))}),Gq.LanguageDescription.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load:()=>e.A(20878).then(e=>GU(e.mscgen))}),Gq.LanguageDescription.of({name:"Xù",extensions:["xu"],load:()=>e.A(20878).then(e=>GU(e.xu))}),Gq.LanguageDescription.of({name:"MsGenny",extensions:["msgenny"],load:()=>e.A(20878).then(e=>GU(e.msgenny))}),Gq.LanguageDescription.of({name:"Vue",extensions:["vue"],load:()=>e.A(99646).then(e=>e.vue())}),Gq.LanguageDescription.of({name:"Angular Template",load:()=>e.A(29423).then(e=>e.angular())})];var GY=e.i(68113),GX=e.i(2262),GZ=e.i(17300);function GJ(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return!!i&&(r(n.update(i)),!0)}}let GQ=GJ(function(e,t,n=t.selection.ranges){let r=[],i=-1;t:for(let{from:e,to:a}of n){let n=r.length,o=1e9,l;for(let n=e;n<=a;){let s=t.doc.lineAt(n);if(void 0==l&&!(l=G2(t,s.from).line))continue t;if(s.from>i&&(e==a||a>s.from)){i=s.from;let e=/^\s*/.exec(s.text)[0].length,t=e==s.length,n=s.text.slice(e,e+l.length)==l?e:-1;e<s.text.length&&e<o&&(o=e),r.push({line:s,comment:n,token:l,indent:e,empty:t,single:!1})}n=s.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(2!=e&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;" "==t.text[a-t.from]&&a++,e.push({from:r,to:a})}return{changes:e}}return null},0),G0=GJ(G5,0),G1=GJ((e,t)=>G5(e,t,function(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}(t)),0);function G2(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}function G5(e,t,n=t.selection.ranges){let r=n.map(e=>G2(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>(function(e,{open:t,close:n},r,i){let a,o,l=e.sliceDoc(r-50,r),s=e.sliceDoc(i,i+50),c=/\s*$/.exec(l)[0].length,d=/^\s*/.exec(s)[0].length,u=l.length-c;if(l.slice(u-t.length,u)==t&&s.slice(d,d+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:i+d,margin:d&&1}};i-r<=100?a=o=e.sliceDoc(r,i):(a=e.sliceDoc(r,r+50),o=e.sliceDoc(i-50,i));let f=/^\s*/.exec(a)[0].length,h=/\s*$/.exec(o)[0].length,p=o.length-h-n.length;return a.slice(f,f+t.length)==t&&o.slice(p,p+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(a.charAt(f+t.length))},close:{pos:i-h-n.length,margin:+!!/\s/.test(o.charAt(p-1))}}:null})(t,r[n],e.from,e.to));if(2!=e&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}]))};if(1!=e&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}let G4=GY.Annotation.define(),G3=GY.Annotation.define(),G6=GY.Facet.define(),G8=GY.Facet.define({combine:e=>(0,GY.combineConfig)(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}),G7=GY.StateField.define({create:()=>Yu.empty,update(e,t){let n=t.state.facet(G8),r=t.annotation(G4);if(r){let i=Yi.fromTransaction(t,r.selection),a=r.side,o=0==a?e.undone:e.done;return o=i?Ya(o,o.length,n.minDepth,i):Ys(o,t.startState.selection),new Yu(0==a?r.rest:o,0==a?o:r.rest)}let i=t.annotation(G3);if(("full"==i||"before"==i)&&(e=e.isolate()),!1===t.annotation(GY.Transaction.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let a=Yi.fromTransaction(t),o=t.annotation(GY.Transaction.time),l=t.annotation(GY.Transaction.userEvent);return a?e=e.addChanges(a,o,l,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,l,n.newGroupDelay)),("full"==i||"after"==i)&&(e=e.isolate()),e},toJSON:e=>({done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}),fromJSON:e=>new Yu(e.done.map(Yi.fromJSON),e.undone.map(Yi.fromJSON))});function G9(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(G7,!1);if(!i)return!1;let a=i.pop(e,n,t);return!!a&&(r(a),!0)}}let Ye=G9(0,!1),Yt=G9(1,!1),Yn=G9(0,!0),Yr=G9(1,!0);class Yi{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(e){return new Yi(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null==(e=this.changes)?void 0:e.toJSON(),mapped:null==(t=this.mapped)?void 0:t.toJSON(),startSelection:null==(n=this.startSelection)?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(e){return new Yi(e.changes&&GY.ChangeSet.fromJSON(e.changes),[],e.mapped&&GY.ChangeDesc.fromJSON(e.mapped),e.startSelection&&GY.EditorSelection.fromJSON(e.startSelection),e.selectionsAfter.map(GY.EditorSelection.fromJSON))}static fromTransaction(e,t){let n=Yl;for(let t of e.startState.facet(G6)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new Yi(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Yl)}static selection(e){return new Yi(void 0,Yl,void 0,void 0,e)}}function Ya(e,t,n,r){let i=e.slice(t+1>n+20?t-n-1:0,t);return i.push(r),i}function Yo(e,t){return e.length?t.length?e.concat(t):e:t}let Yl=[];function Ys(e,t){if(!e.length)return[Yi.selection([t])];{let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),Ya(e,e.length-1,1e9,n.setSelAfter(r)))}}function Yc(e,t){if(!e.length)return e;let n=e.length,r=Yl;for(;n;){let i=function(e,t,n){let r=Yo(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):Yl,n);if(!e.changes)return Yi.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new Yi(i,GY.StateEffect.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[Yi.selection(r)]:Yl}let Yd=/^(input\.type|delete)($|\.)/;class Yu{constructor(e,t,n=0,r){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new Yu(this.done,this.undone):this}addChanges(e,t,n,r,i){var a,o;let l,s,c=this.done,d=c[c.length-1];return new Yu(c=d&&d.changes&&!d.changes.empty&&e.changes&&(!n||Yd.test(n))&&(!d.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,(a=d.changes,o=e.changes,l=[],s=!1,a.iterChangedRanges((e,t)=>l.push(e,t)),o.iterChangedRanges((e,t,n,r)=>{for(let e=0;e<l.length;){let t=l[e++],i=l[e++];r>=t&&n<=i&&(s=!0)}}),s))||"input.type.compose"==n)?Ya(c,c.length-1,r.minDepth,new Yi(e.changes.compose(d.changes),Yo(GY.StateEffect.mapEffects(e.effects,d.changes),d.effects),d.mapped,d.startSelection,Yl)):Ya(c,c.length,r.minDepth,e),Yl,t,n)}addSelection(e,t,n,r){var i;let a=this.done.length?this.done[this.done.length-1].selectionsAfter:Yl;return a.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(i=a[a.length-1],i.ranges.length==e.ranges.length&&0===i.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length)?this:new Yu(Ys(this.done,e),this.undone,t,n)}addMapping(e){return new Yu(Yc(this.done,e),Yc(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=0==e?this.done:this.undone;if(0==r.length)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length){let n,o;return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:G4.of({side:e,rest:(n=r[r.length-1],(o=r.slice())[r.length-1]=n.setSelAfter(n.selectionsAfter.slice(0,n.selectionsAfter.length-1)),o),selection:a}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0})}{if(!i.changes)return null;let n=1==r.length?Yl:r.slice(0,r.length-1);return i.mapped&&(n=Yc(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:G4.of({side:e,rest:n,selection:a}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}}}Yu.empty=new Yu(Yl,Yl);function Yf(e,t){return GY.EditorSelection.create(e.ranges.map(t),e.mainIndex)}function Yh(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Yp({state:e,dispatch:t},n){let r=Yf(e.selection,n);return!r.eq(e.selection,!0)&&(t(Yh(e,r)),!0)}function Ym(e,t){return GY.EditorSelection.cursor(t?e.to:e.from)}function Yg(e,t){return Yp(e,n=>n.empty?e.moveByChar(n,t):Ym(n,t))}function Yv(e){return e.textDirectionAt(e.state.selection.main.head)==GX.Direction.LTR}let Yx=e=>Yg(e,!Yv(e)),Yy=e=>Yg(e,Yv(e));function Yb(e,t){return Yp(e,n=>n.empty?e.moveByGroup(n,t):Ym(n,t))}function Yw(e,t,n){let r,i,a=(0,Gq.syntaxTree)(e).resolveInner(t.head),o=n?GZ.NodeProp.closedBy:GZ.NodeProp.openedBy;for(let r=t.head;;){let t=n?a.childAfter(r):a.childBefore(r);if(!t)break;!function(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}(e,t,o)?r=n?t.to:t.from:a=t}return i=a.type.prop(o)&&(r=n?(0,Gq.matchBrackets)(e,a.from,1):(0,Gq.matchBrackets)(e,a.to,-1))&&r.matched?n?r.end.to:r.end.from:n?a.to:a.from,GY.EditorSelection.cursor(i,n?-1:1)}function Yj(e,t){return Yp(e,n=>{if(!n.empty)return Ym(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}"u">typeof Intl&&Intl.Segmenter;let Yk=e=>Yj(e,!1),YS=e=>Yj(e,!0);function YC(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(GX.EditorView.scrollMargins)){let i=t(e);(null==i?void 0:i.top)&&(n=Math.max(null==i?void 0:i.top,n)),(null==i?void 0:i.bottom)&&(r=Math.max(null==i?void 0:i.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function YN(e,t){let n,r=YC(e),{state:i}=e,a=Yf(i.selection,n=>n.empty?e.moveVertically(n,t,r.height):Ym(n,t));if(a.eq(i.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),l=o.top+r.marginTop,s=o.bottom-r.marginBottom;t&&t.top>l&&t.bottom<s&&(n=GX.EditorView.scrollIntoView(a.main.head,{y:"start",yMargin:t.top-l}))}return e.dispatch(Yh(i,a),{effects:n}),!0}let YM=e=>YN(e,!1),YE=e=>YN(e,!0);function YO(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=GY.EditorSelection.cursor(r.from+n))}return i}function YP(e,t){let n=Yf(e.state.selection,e=>{let n=t(e);return GY.EditorSelection.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0,n.assoc)});return!n.eq(e.state.selection)&&(e.dispatch(Yh(e.state,n)),!0)}function YA(e,t){return YP(e,n=>e.moveByChar(n,t))}let Yz=e=>YA(e,!Yv(e)),Y_=e=>YA(e,Yv(e));function YI(e,t){return YP(e,n=>e.moveByGroup(n,t))}function YD(e,t){return YP(e,n=>e.moveVertically(n,t))}let YT=e=>YD(e,!1),YR=e=>YD(e,!0);function YL(e,t){return YP(e,n=>e.moveVertically(n,t,YC(e).height))}let Y$=e=>YL(e,!1),YF=e=>YL(e,!0),YV=({state:e,dispatch:t})=>(t(Yh(e,{anchor:0})),!0),YB=({state:e,dispatch:t})=>(t(Yh(e,{anchor:e.doc.length})),!0),YH=({state:e,dispatch:t})=>(t(Yh(e,{anchor:e.selection.main.anchor,head:0})),!0),YW=({state:e,dispatch:t})=>(t(Yh(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function Yq(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(Yh(n,GY.EditorSelection.create(i,i.length-1))),!0)}function YU(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n="delete.backward",o=YK(e,o,!1)):o>i&&(n="delete.forward",o=YK(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=YK(e,i,!1),a=YK(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:GY.EditorSelection.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?GX.EditorView.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function YK(e,t,n){if(e instanceof GX.EditorView)for(let r of e.state.facet(GX.EditorView.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}let YG=(e,t,n)=>YU(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),l,s;if(n&&!t&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(l=o.text.slice(0,i-o.from))){if(" "==l[l.length-1])return i-1;let e=(0,GY.countColumn)(l,a.tabSize)%(0,Gq.getIndentUnit)(a)||(0,Gq.getIndentUnit)(a);for(let t=0;t<e&&" "==l[l.length-1-t];t++)i--;s=i}else(s=(0,GY.findClusterBreak)(o.text,i-o.from,t,t)+o.from)==i&&o.number!=(t?a.doc.lines:1)?s+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(s-o.from,i-o.from))&&(s=(0,GY.findClusterBreak)(o.text,s-o.from,!1,!1)+o.from);return s}),YY=e=>YG(e,!1,!0),YX=e=>YG(e,!0,!1),YZ=(e,t)=>YU(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let l=(0,GY.findClusterBreak)(a.text,r-a.from,t)+a.from,s=a.text.slice(Math.min(r,l)-a.from,Math.max(r,l)-a.from),c=o(s);if(null!=e&&c!=e)break;(" "!=s||r!=n.head)&&(e=c),r=l}return r}),YJ=e=>YZ(e,!1);function YQ(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(r.empty||r.to!=a.from||(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function Y0(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of YQ(e)){if(n?t.to==e.doc.length:0==t.from)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n)for(let n of(r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak}),t.ranges))i.push(GY.EditorSelection.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)));else for(let n of(r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text}),t.ranges))i.push(GY.EditorSelection.range(n.anchor-o,n.head-o))}return!!r.length&&(t(e.update({changes:r,scrollIntoView:!0,selection:GY.EditorSelection.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}function Y1(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of YQ(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}let Y2=Y4(!1),Y5=Y4(!0);function Y4(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=(0,Gq.syntaxTree)(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(GZ.NodeProp.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let l=new Gq.IndentContext(t,{simulateBreak:r,simulateDoubleBreak:!!o}),s=(0,Gq.getIndentation)(l,r);for(null==s&&(s=(0,GY.countColumn)(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize));i<a.to&&/\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let c=["",(0,Gq.indentString)(t,s)];return o&&c.push((0,Gq.indentString)(t,l.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:GY.Text.of(c)},range:GY.EditorSelection.cursor(r+1+c[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Y3(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:GY.EditorSelection.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}let Y6=[{key:"Ctrl-b",run:Yx,shift:Yz,preventDefault:!0},{key:"Ctrl-f",run:Yy,shift:Y_},{key:"Ctrl-p",run:Yk,shift:YT},{key:"Ctrl-n",run:YS,shift:YR},{key:"Ctrl-a",run:e=>Yp(e,t=>GY.EditorSelection.cursor(e.lineBlockAt(t.head).from,1)),shift:e=>YP(e,t=>GY.EditorSelection.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>Yp(e,t=>GY.EditorSelection.cursor(e.lineBlockAt(t.head).to,-1)),shift:e=>YP(e,t=>GY.EditorSelection.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:YX},{key:"Ctrl-h",run:YY},{key:"Ctrl-k",run:e=>YU(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})},{key:"Ctrl-Alt-h",run:YJ},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:GY.Text.of(["",""])},range:GY.EditorSelection.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:(0,GY.findClusterBreak)(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:(0,GY.findClusterBreak)(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:GY.EditorSelection.cursor(a)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:YE}],Y8=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>Yp(e,t=>Yw(e.state,t,!Yv(e))),shift:e=>YP(e,t=>Yw(e.state,t,!Yv(e)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>Yp(e,t=>Yw(e.state,t,Yv(e))),shift:e=>YP(e,t=>Yw(e.state,t,Yv(e)))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>Y0(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>Y1(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>Y0(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>Y1(e,t,!0)},{key:"Mod-Alt-ArrowUp",run:e=>Yq(e,!1)},{key:"Mod-Alt-ArrowDown",run:e=>Yq(e,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=GY.EditorSelection.create([n.main]):n.main.empty||(r=GY.EditorSelection.create([GY.EditorSelection.cursor(n.main.head)])),!!r&&(t(Yh(e,r)),!0)}},{key:"Mod-Enter",run:Y5},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=YQ(e).map(({from:t,to:n})=>GY.EditorSelection.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:GY.EditorSelection.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=Yf(e.selection,t=>{let n=(0,Gq.syntaxTree)(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return GY.EditorSelection.range(n.to,n.from)}return t});return!n.eq(e.selection)&&(t(Yh(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Y3(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=(0,GY.countColumn)(r,e.tabSize),a=0,o=(0,Gq.indentString)(e,Math.max(0,i-(0,Gq.getIndentUnit)(e)));for(;a<r.length&&a<o.length&&r.charCodeAt(a)==o.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:o.slice(a)})}),{userEvent:"delete.dedent"})),!0)},{key:"Mod-]",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Y3(e,(t,n)=>{n.push({from:t.from,insert:e.facet(Gq.indentUnit)})}),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new Gq.IndentContext(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),i=Y3(e,(t,i,a)=>{let o=(0,Gq.getIndentation)(r,t.from);if(null==o)return;/\S/.test(t.text)||(o=0);let l=/^\s*/.exec(t.text)[0],s=(0,Gq.indentString)(e,o);(l!=s||a.from<t.from+l.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+l.length,insert:s}))});return i.changes.empty||t(e.update(i,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(YQ(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=Yf(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>{let n,r;return n=!1,r=Yf(e.selection,t=>{let r=(0,Gq.matchBrackets)(e,t.head,-1)||(0,Gq.matchBrackets)(e,t.head,1)||t.head>0&&(0,Gq.matchBrackets)(e,t.head-1,1)||t.head<e.doc.length&&(0,Gq.matchBrackets)(e,t.head+1,-1);if(!r||!r.end)return t;n=!0;let i=r.start.from==t.head?r.end.to:r.end.from;return GY.EditorSelection.cursor(i)}),!!n&&(t(Yh(e,r)),!0)}},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=G2(e.state,n.from);return r.line?GQ(e):!!r.block&&G1(e)}},{key:"Alt-A",run:G0},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:Yx,shift:Yz,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>Yb(e,!Yv(e)),shift:e=>YI(e,!Yv(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>Yp(e,t=>YO(e,t,!Yv(e))),shift:e=>YP(e,t=>YO(e,t,!Yv(e))),preventDefault:!0},{key:"ArrowRight",run:Yy,shift:Y_,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>Yb(e,Yv(e)),shift:e=>YI(e,Yv(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>Yp(e,t=>YO(e,t,Yv(e))),shift:e=>YP(e,t=>YO(e,t,Yv(e))),preventDefault:!0},{key:"ArrowUp",run:Yk,shift:YT,preventDefault:!0},{mac:"Cmd-ArrowUp",run:YV,shift:YH},{mac:"Ctrl-ArrowUp",run:YM,shift:Y$},{key:"ArrowDown",run:YS,shift:YR,preventDefault:!0},{mac:"Cmd-ArrowDown",run:YB,shift:YW},{mac:"Ctrl-ArrowDown",run:YE,shift:YF},{key:"PageUp",run:YM,shift:Y$},{key:"PageDown",run:YE,shift:YF},{key:"Home",run:e=>Yp(e,t=>YO(e,t,!1)),shift:e=>YP(e,t=>YO(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:YV,shift:YH},{key:"End",run:e=>Yp(e,t=>YO(e,t,!0)),shift:e=>YP(e,t=>YO(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:YB,shift:YW},{key:"Enter",run:Y2,shift:Y2},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:YY,shift:YY,preventDefault:!0},{key:"Delete",run:YX,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:YJ,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>YZ(e,!0),preventDefault:!0},{mac:"Mod-Backspace",run:e=>YU(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),preventDefault:!0},{mac:"Mod-Delete",run:e=>YU(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),preventDefault:!0}].concat(Y6.map(e=>({mac:e.key,run:e.run,shift:e.shift}))));var Y7=e.i(41016);let Y9="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class Xe{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(Y9(e)):Y9,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return -1;this.bufferPos=0,this.buffer=this.iter.value}return(0,GY.codePointAt)(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=(0,GY.fromCodePoint)(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=(0,GY.codePointSize)(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(1==this.query.length?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}}"u">typeof Symbol&&(Xe.prototype[Symbol.iterator]=function(){return this});let Xt={from:-1,to:-1,match:/.*/.exec(""),precise:!0},Xn="gm"+(null==/x/.unicode?"":"u");class Xr{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=Xt,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Xo(e,t,n,r,i);this.re=new RegExp(t,Xn+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=Xl(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=Xl(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),e=0}}}}let Xi=new WeakMap;class Xa{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=Xi.get(e);if(!r||r.from>=n||r.to<=t){let r=new Xa(t,e.sliceString(t,n));return Xi.set(e,r),r}if(r.from==t&&r.to==n)return r;let{text:i,from:a}=r;return a>t&&(i=e.sliceString(t,a)+i,a=t),r.to<n&&(i+=e.sliceString(r.to,n)),Xi.set(e,new Xa(a,i)),new Xa(t,i.slice(t-a,n-a))}}class Xo{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=Xt,this.matchPos=Xl(e,r),this.re=new RegExp(t,Xn+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.flat=Xa.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=Xl(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Xa.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function Xl(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}"u">typeof Symbol&&(Xr.prototype[Symbol.iterator]=Xo.prototype[Symbol.iterator]=function(){return this});let Xs={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Xc=GY.Facet.define({combine:e=>(0,GY.combineConfig)(e,Xs,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}),Xd=GX.Decoration.mark({class:"cm-selectionMatch"}),Xu=GX.Decoration.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Xf(e,t,n,r){return(0==n||e(t.sliceDoc(n-1,n))!=GY.CharCategory.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=GY.CharCategory.Word)}let Xh=GX.ViewPlugin.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Xc),{state:n}=e,r=n.selection;if(r.ranges.length>1)return GX.Decoration.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return GX.Decoration.none;let e=n.wordAt(i.head);if(!e)return GX.Decoration.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return GX.Decoration.none;if(t.wholeWords){var l,s,c;if(a=n.sliceDoc(i.from,i.to),!(Xf(o=n.charCategorizer(i.head),n,i.from,i.to)&&(l=o,s=i.from,c=i.to,l(n.sliceDoc(s,s+1))==GY.CharCategory.Word&&l(n.sliceDoc(c-1,c))==GY.CharCategory.Word)))return GX.Decoration.none}else if(!(a=n.sliceDoc(i.from,i.to)))return GX.Decoration.none}let d=[];for(let r of e.visibleRanges){let e=new Xe(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||Xf(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?d.push(Xu.range(r,a)):(r>=i.to||a<=i.from)&&d.push(Xd.range(r,a)),d.length>t.maxMatches))return GX.Decoration.none}}return GX.Decoration.set(d)}},{decorations:e=>e.decorations}),Xp=GX.EditorView.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Xm=GY.Facet.define({combine:e=>(0,GY.combineConfig)(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new XW(e),scrollToMatch:e=>GX.EditorView.scrollIntoView(e)})});class Xg{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,Xn),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Xk(this):new Xy(this)}getCursor(e,t=0,n){let r=e.doc?e:GY.EditorState.create({doc:e});return null==n&&(n=r.doc.length),this.regexp?Xb(this,r,t,n):Xx(this,r,t,n)}}class Xv{constructor(e){this.spec=e}}function Xx(e,t,n,r){var i,a,o,l;let s;return e.wholeWord&&(o=t.doc,l=t.charCategorizer(t.selection.main.head),s=(e,t,n,r)=>((r>e||r+n.length<t)&&(r=Math.max(0,e-2),n=o.sliceString(r,Math.min(o.length,t+2))),(l(Xw(n,e-r))!=GY.CharCategory.Word||l(Xj(n,e-r))!=GY.CharCategory.Word)&&(l(Xj(n,t-r))!=GY.CharCategory.Word||l(Xw(n,t-r))!=GY.CharCategory.Word))),e.test&&(i=e.test,a=s,s=(e,n,r,o)=>(!a||!!a(e,n,r,o))&&i(e>=o&&n<=o+r.length?r.slice(e-o,n-o):t.doc.sliceString(e,n),t,e,n)),new Xe(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),s)}class Xy extends Xv{constructor(e){super(e)}nextMatch(e,t,n){let r=Xx(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=Xx(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=Xx(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=Xx(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=Xx(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}function Xb(e,t,n,r){var i,a,o;let l;return e.wholeWord&&(o=t.charCategorizer(t.selection.main.head),l=(e,t,n)=>!n[0].length||(o(Xw(n.input,n.index))!=GY.CharCategory.Word||o(Xj(n.input,n.index))!=GY.CharCategory.Word)&&(o(Xj(n.input,n.index+n[0].length))!=GY.CharCategory.Word||o(Xw(n.input,n.index+n[0].length))!=GY.CharCategory.Word)),e.test&&(i=e.test,a=l,l=(e,n,r)=>(!a||a(e,n,r))&&i(r[0],t,e,n)),new Xr(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:l},n,r)}function Xw(e,t){return e.slice((0,GY.findClusterBreak)(e,t,!1),t)}function Xj(e,t){return e.slice(t,(0,GY.findClusterBreak)(e,t))}class Xk extends Xv{nextMatch(e,t,n){let r=Xb(this.spec,e,n,e.doc.length).next();return r.done&&(r=Xb(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-1e4*r),a=Xb(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if("&"==n)return e.match[0];if("$"==n)return"$";for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=Xb(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=Xb(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}let XS=GY.StateEffect.define(),XC=GY.StateEffect.define(),XN=GY.StateField.define({create:e=>new XM(XL(e).create(),null),update(e,t){for(let n of t.effects)n.is(XS)?e=new XM(n.value.create(),e.panel):n.is(XC)&&(e=new XM(e.query,n.value?XR:null));return e},provide:e=>GX.showPanel.from(e,e=>e.panel)});class XM{constructor(e,t){this.query=e,this.panel=t}}let XE=GX.Decoration.mark({class:"cm-searchMatch"}),XO=GX.Decoration.mark({class:"cm-searchMatch cm-searchMatch-selected"}),XP=GX.ViewPlugin.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(XN))}update(e){let t=e.state.field(XN);(t!=e.startState.field(XN)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return GX.Decoration.none;let{view:n}=this,r=new GY.RangeSetBuilder;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:l}=i[t];for(;t<a-1&&l>i[t+1].from-500;)l=i[++t].to;e.highlight(n.state,o,l,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?XO:XE)})}return r.finish()}},{decorations:e=>e.decorations});function XA(e){return t=>{let n=t.state.field(XN,!1);return n&&n.query.spec.valid?e(t,n):XV(t)}}let Xz=XA((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=GY.EditorSelection.single(r.from,r.to),a=e.state.facet(Xm);return e.dispatch({selection:i,effects:[XK(e,r),a.scrollToMatch(i.main,e)],userEvent:"select.search"}),XF(e),!0}),X_=XA((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=GY.EditorSelection.single(i.from,i.to),o=e.state.facet(Xm);return e.dispatch({selection:a,effects:[XK(e,i),o.scrollToMatch(a.main,e)],userEvent:"select.search"}),XF(e),!0}),XI=XA((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!!n&&!!n.length&&(e.dispatch({selection:GY.EditorSelection.create(n.map(e=>GY.EditorSelection.range(e.from,e.to))),userEvent:"select.search.matches"}),!0)}),XD=XA((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,l=[],s,c,d=[];o.precise?o.from==r&&o.to==i&&(c=n.toText(t.getReplacement(o)),l.push({from:o.from,to:o.to,insert:c}),d.push(GX.EditorView.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))):o=t.nextMatch(n,o.from,o.to);let u=e.state.changes(l);return o&&(s=GY.EditorSelection.single(o.from,o.to).map(u),d.push(XK(e,o)),d.push(n.facet(Xm).scrollToMatch(s.main,e))),e.dispatch({changes:u,selection:s,effects:d,userEvent:"input.replace"}),!0}),XT=XA((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:GX.EditorView.announce.of(r),userEvent:"input.replace.all"}),!0});function XR(e){return e.state.facet(Xm).createPanel(e)}function XL(e,t){var n,r,i,a,o;let l=e.selection.main,s=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!s)return t;let c=e.facet(Xm);return new Xg({search:(null!=(n=null==t?void 0:t.literal)?n:c.literal)?s:s.replace(/\n/g,"\\n"),caseSensitive:null!=(r=null==t?void 0:t.caseSensitive)?r:c.caseSensitive,literal:null!=(i=null==t?void 0:t.literal)?i:c.literal,regexp:null!=(a=null==t?void 0:t.regexp)?a:c.regexp,wholeWord:null!=(o=null==t?void 0:t.wholeWord)?o:c.wholeWord})}function X$(e){let t=(0,GX.getPanel)(e,XR);return t&&t.dom.querySelector("[main-field]")}function XF(e){let t=X$(e);t&&t==e.root.activeElement&&t.select()}let XV=e=>{let t=e.state.field(XN,!1);if(t&&t.panel){let n=X$(e);if(n&&n!=e.root.activeElement){let r=XL(e.state,t.query.spec);r.valid&&e.dispatch({effects:XS.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[XC.of(!0),t?XS.of(XL(e.state,t.query.spec)):GY.StateEffect.appendConfig.of(XY)]});return!0},XB=e=>{let t=e.state.field(XN,!1);if(!t||!t.panel)return!1;let n=(0,GX.getPanel)(e,XR);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:XC.of(!1)}),!0},XH=[{key:"Mod-f",run:XV,scope:"editor search-panel"},{key:"F3",run:Xz,shift:X_,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Xz,shift:X_,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:XB,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new Xe(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(GY.EditorSelection.range(t.value.from,t.value.to))}return t(e.update({selection:GY.EditorSelection.create(a,o),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=(0,GX.showDialog)(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i)return void e.dispatch({effects:r});let a=t.doc.lineAt(t.selection.main.head),[,o,l,s,c]=i,d=s?+s.slice(1):0,u=l?+l:a.number;if(l&&c){let e=u/100;o&&(e=e*("-"==o?-1:1)+a.number/t.doc.lines),u=Math.round(t.doc.lines*e)}else l&&o&&(u=u*("-"==o?-1:1)+a.number);let f=t.doc.line(Math.max(1,Math.min(t.doc.lines,u))),h=GY.EditorSelection.cursor(f.from+Math.max(0,Math.min(d,f.length)));e.dispatch({effects:[r,GX.EditorView.scrollIntoView(h.from,{y:"center"})],selection:h})}),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return(({state:e,dispatch:t})=>{let{selection:n}=e,r=GY.EditorSelection.create(n.ranges.map(t=>e.wordAt(t.head)||GY.EditorSelection.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)})({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=function(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new Xe(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new Xe(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}(e,r);return!!i&&(t(e.update({selection:e.selection.addRange(GY.EditorSelection.range(i.from,i.to),!1),effects:GX.EditorView.scrollIntoView(i.to)})),!0)},preventDefault:!0}];class XW{constructor(e){this.view=e;let t=this.query=e.state.field(XN).query.spec;function n(e,t,n){return(0,Y7.default)("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=(0,Y7.default)("input",{value:t.search,placeholder:Xq(e,"Find"),"aria-label":Xq(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=(0,Y7.default)("input",{value:t.replace,placeholder:Xq(e,"Replace"),"aria-label":Xq(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=(0,Y7.default)("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=(0,Y7.default)("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=(0,Y7.default)("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=(0,Y7.default)("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",()=>Xz(e),[Xq(e,"next")]),n("prev",()=>X_(e),[Xq(e,"previous")]),n("select",()=>XI(e),[Xq(e,"all")]),(0,Y7.default)("label",null,[this.caseField,Xq(e,"match case")]),(0,Y7.default)("label",null,[this.reField,Xq(e,"regexp")]),(0,Y7.default)("label",null,[this.wordField,Xq(e,"by word")]),...e.state.readOnly?[]:[(0,Y7.default)("br"),this.replaceField,n("replace",()=>XD(e),[Xq(e,"replace")]),n("replaceAll",()=>XT(e),[Xq(e,"replace all")])],(0,Y7.default)("button",{name:"close",onclick:()=>XB(e),"aria-label":Xq(e,"close"),type:"button"},["×"])])}commit(){let e=new Xg({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:XS.of(e)}))}keydown(e){(0,GX.runScopeHandlers)(this.view,e,"search-panel")?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?X_:Xz)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),XD(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(XS)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Xm).top}}function Xq(e,t){return e.state.phrase(t)}let XU=/[\s\.,:;?!]/;function XK(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-30),o=Math.min(i,n+30),l=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<30;e++)if(!XU.test(l[e+1])&&XU.test(l[e])){l=l.slice(e);break}}if(o!=i){for(let e=l.length-1;e>l.length-30;e--)if(!XU.test(l[e-1])&&XU.test(l[e])){l=l.slice(0,e);break}}return GX.EditorView.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${r.number}.`)}let XG=GX.EditorView.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),XY=[XN,GY.Prec.low(XP),XG];var XX=e.i(62291),XZ=GX;class XJ{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class XQ{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let r=n.facet(Ze).markerFilter;r&&(e=r(e,n));let i=e.slice().sort((e,t)=>e.from-t.from||e.to-t.to),a=new GY.RangeSetBuilder,o=[],l=0,s=n.doc.iter(),c=0,d=n.doc.length;for(let e=0;;){let t,n,r=e==i.length?null:i[e];if(!r&&!o.length)break;if(o.length)t=l,n=o.reduce((e,t)=>Math.min(e,t.to),r&&r.from>t?r.from:1e8);else{if((t=r.from)>d)break;n=r.to,o.push(r),e++}for(;e<i.length;){let r=i[e];if(r.from==t&&(r.to>r.from||r.to==t))o.push(r),e++,n=Math.min(r.to,n);else{n=Math.min(r.from,n);break}}n=Math.min(n,d);let u=!1;if(o.some(e=>e.from==t&&(e.to==n||n==d))&&!(u=t==n)&&n-t<10){let e=t-(c+s.value.length);e>0&&(s.next(e),c=t);for(let e=t;;){if(e>=n){u=!0;break}if(!s.lineBreak&&c+s.value.length>e)break;e=c+s.value.length,c+=s.value.length,s.next()}}let f=Zc(o);if(u)a.add(t,t,XZ.Decoration.widget({widget:new Zi(f),diagnostics:o.slice()}));else{let e=o.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");a.add(t,n,XZ.Decoration.mark({class:"cm-lintRange cm-lintRange-"+f+e,diagnostics:o.slice(),inclusiveEnd:o.some(e=>e.to>n)}))}if((l=n)==d)break;for(let e=0;e<o.length;e++)o[e].to<=l&&o.splice(e--,1)}let u=a.finish();return new XQ(u,t,X0(u))}}function X0(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&0>i.diagnostics.indexOf(t)))if(r){if(0>i.diagnostics.indexOf(r.diagnostic))return!1;r=new XJ(r.from,n,r.diagnostic)}else r=new XJ(e,n,t||i.diagnostics[0])}),r}function X1(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(Ze).hideOn(e,n,r);if(null!=i)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(X2))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}let X2=GY.StateEffect.define(),X5=GY.StateEffect.define(),X4=GY.StateEffect.define(),X3=GY.StateField.define({create:()=>new XQ(XZ.Decoration.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=X0(n,e.selected.diagnostic,i)||X0(n,null,i)}!n.size&&i&&t.state.facet(Ze).autoPanel&&(i=null),e=new XQ(n,i,r)}for(let n of t.effects)if(n.is(X2)){let r=t.state.facet(Ze).autoPanel?n.value.length?Zo.open:null:e.panel;e=XQ.init(n.value,r,t.state)}else n.is(X5)?e=new XQ(e.diagnostics,n.value?Zo.open:null,e.selected):n.is(X4)&&(e=new XQ(e.diagnostics,e.panel,n.value));return e},provide:e=>[XZ.showPanel.from(e,e=>e.panel),XZ.EditorView.decorations.from(e,e=>e.diagnostics)]}),X6=XZ.Decoration.mark({class:"cm-lintRange cm-lintRange-active"});function X8(e,t){return(0,Y7.default)("ul",{class:"cm-tooltip-lint"},t.map(t=>Zr(e,t,!1)))}let X7=e=>{let t=e.state.field(X3,!1);return!!t&&!!t.panel&&(e.dispatch({effects:X5.of(!1)}),!0)},X9=[{key:"Mod-Shift-m",run:e=>{var t,n;let r=e.state.field(X3,!1);r&&r.panel||e.dispatch({effects:(t=e.state,n=[X5.of(!0)],t.field(X3,!1)?n:n.concat(GY.StateEffect.appendConfig.of(Zh)))});let i=(0,XZ.getPanel)(e,Zo.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(X3,!1);if(!t)return!1;let n=e.state.selection.main,r=X0(t.diagnostics,null,n.to+1);return(!!r||!!(r=X0(t.diagnostics,null,0))&&(r.from!=n.from||r.to!=n.to))&&(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),(0,XZ.activateHover)(e,r.from,1,{tooltip:Zf,until:e=>e.docChanged||e.newSelection.main.head<r.from||e.newSelection.main.head>r.to}),!0)}}],Ze=GY.Facet.define({combine:e=>({sources:e.map(e=>e.source).filter(e=>null!=e),...(0,GY.combineConfig)(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Zt,tooltipFilter:Zt,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})})});function Zt(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function Zn(e){let t=[];if(e)n:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue n}}t.push("")}return t}function Zr(e,t,n){var r;let i=n?Zn(t.actions):[];return(0,Y7.default)("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},(0,Y7.default)("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null==(r=t.actions)?void 0:r.map((n,r)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=X0(e.state.field(X3).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:l}=n,s=i[r]?l.indexOf(i[r]):-1,c=s<0?l:[l.slice(0,s),(0,Y7.default)("u",l.slice(s,s+1)),l.slice(s+1)],d=n.markClass?" "+n.markClass:"";return(0,Y7.default)("button",{type:"button",class:"cm-diagnosticAction"+d,onclick:o,onmousedown:o,"aria-label":` Action: ${l}${s<0?"":` (access key "${i[r]})"`}.`},c)}),t.source&&(0,Y7.default)("div",{class:"cm-diagnosticSource"},t.source))}class Zi extends XZ.WidgetType{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return(0,Y7.default)("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Za{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(0xffffffff*Math.random()).toString(16),this.dom=Zr(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Zo{constructor(e){this.view=e,this.items=[];let t=t=>{if(!t.ctrlKey&&!t.altKey&&!t.metaKey){if(27==t.keyCode)X7(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65)||!(t.keyCode<=90)||!(this.selectedIndex>=0))return;let{diagnostic:n}=this.items[this.selectedIndex],r=Zn(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=X0(this.view.state.field(X3).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}t.preventDefault()}},n=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=(0,Y7.default)("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=(0,Y7.default)("div",{class:"cm-panel-lint"},this.list,(0,Y7.default)("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>X7(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(X3).selected;if(!e)return -1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return -1}update(){let{diagnostics:e,selected:t}=this.view.state.field(X3),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:l})=>{for(let e of l.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,l;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(l=new Za(this.view,e),this.items.splice(n,0,l),r=!0):(l=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&l.diagnostic==t.diagnostic?l.dom.hasAttribute("aria-selected")||(l.dom.setAttribute("aria-selected","true"),i=l):l.dom.hasAttribute("aria-selected")&&l.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();0==this.items.length&&(this.items.push(new Za(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=X0(this.view.state.field(X3).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:X4.of(t)})}static open(e){return new Zo(e)}}function Zl(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}let Zs=XZ.EditorView.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Zl("#f11")},".cm-lintRange-warning":{backgroundImage:Zl("orange")},".cm-lintRange-info":{backgroundImage:Zl("#999")},".cm-lintRange-hint":{backgroundImage:Zl("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function Zc(e){let t="hint",n=1;for(let i of e){var r;let e="error"==(r=i.severity)?4:"warning"==r?3:"info"==r?2:1;e>n&&(n=e,t=i.severity)}return t}XZ.GutterMarker;let Zd=GY.StateEffect.define(),Zu=GY.StateField.define({create:()=>null,update:(e,t)=>(e&&t.docChanged&&(e=X1(t,e)?null:{...e,pos:t.changes.mapPos(e.pos)}),t.effects.reduce((e,t)=>t.is(Zd)?t.value:e,e)),provide:e=>XZ.showTooltip.from(e)}),Zf=(0,XZ.hoverTooltip)(function(e,t,n){let{diagnostics:r}=e.state.field(X3),i,a=-1,o=-1;r.between(t-(n<0),t+ +(n>0),(e,r,{spec:l})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=l.diagnostics,a=e,o=r,!1});let l=e.state.facet(Ze).tooltipFilter;return(i&&l&&(i=l(i,e.state)),i)?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create:()=>({dom:X8(e,i)})}:null},{hideOn:X1}),Zh=[X3,XZ.EditorView.decorations.compute([X3],e=>{let{selected:t,panel:n}=e.field(X3);return t&&n&&t.from!=t.to?XZ.Decoration.set([X6.range(t.from,t.to)]):XZ.Decoration.none}),Zf,Zs],Zp=GY.Facet.define({combine:e=>(0,GY.combineConfig)(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})}),Zm=[(0,GX.lineNumbers)(),(0,GX.highlightActiveLineGutter)(),(0,GX.highlightSpecialChars)(),function(e={}){return[G7,G8.of(e),GX.EditorView.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?Ye:"historyRedo"==e.inputType?Yt:null;return!!n&&(e.preventDefault(),n(t))}})]}(),(0,Gq.foldGutter)(),(0,GX.drawSelection)(),(0,GX.dropCursor)(),GY.EditorState.allowMultipleSelections.of(!0),(0,Gq.indentOnInput)(),(0,Gq.syntaxHighlighting)(Gq.defaultHighlightStyle,{fallback:!0}),(0,Gq.bracketMatching)(),(0,XX.closeBrackets)(),(0,XX.autocompletion)(),(0,GX.rectangularSelection)(),(0,GX.crosshairCursor)(),(0,GX.highlightActiveLine)(),[Xp,Xh],GX.keymap.of([...XX.closeBracketsKeymap,...Y8,...XH,{key:"Mod-z",run:Ye,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Yt,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Yt,preventDefault:!0},{key:"Mod-u",run:Yn,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Yr,preventDefault:!0},...Gq.foldKeymap,...XX.completionKeymap,...X9])];var Zg=e.i(99242);let Zv=eN("binary",[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]]),Zx=eN("pen-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]),Zy=eN("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),Zb=eN("square-play",[["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["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"}]]),Zw=eN("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),Zj={review:"Review",edit:"Edit",view:"View",code:"Code",preview:"Preview",hex:"Hex",actions:"File view options",save:"Save",saving:"Saving",binaryTitle:"Binary content is not rendered",binaryDescription:"This file is binary or too large to decode safely. Render it only when you explicitly need to inspect the raw bytes.",renderAnyway:"Render anyway",unsupportedPreview:"No preview renderer is available for this file.",noContent:"No file content.",pathSeparator:"/"};function Zk(e){let t=e.name||e.path||"",n=/\.([^.\\/]+)$/.exec(t);return n?.[1]?.toLowerCase()}function ZS(e){if(e.kind)return e.kind;let t=e.mimeType?.toLowerCase()??"",n=Zk(e);return t.startsWith("image/")?"svg"===n?"svg":"image":t.startsWith("video/")?"video":t.includes("html")?"html":t.includes("markdown")?"markdown":t.includes("json")?"code":t.startsWith("text/")?"text":"svg"===n?"svg":"html"===n||"htm"===n?"html":"md"===n||"mdx"===n?"markdown":["png","jpg","jpeg","gif","webp","avif"].includes(n??"")?"image":["mp4","webm","mov","m4v","ogg"].includes(n??"")?"video":["zip","tar","gz","7z","rar","exe","dll","bin","wasm","pdf","psd"].includes(n??"")?"binary":"code"}async function ZC(e){let t=function(e){for(let t of[(e.language??Zk(e)??"text").toLowerCase(),e.mimeType?.toLowerCase()]){if(!t)continue;let e=Gq.LanguageDescription.matchLanguageName(GG,t,!0);if(e)return e}for(let t of[e.name,e.path]){if(!t)continue;let e=Gq.LanguageDescription.matchFilename(GG,t);if(e)return e}}(e);if(!t)return[];try{return await t.load()}catch{return[]}}function ZN(e){if(e&&!(e<=0))return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function ZM(e){let t=ZS(e);return"binary"===t?["hex"]:"image"===t||"video"===t?["preview"]:["html","markdown","richtext","svg"].includes(t)?["code","preview"]:["code"]}let ZE=Gq.HighlightStyle.define([{tag:Zg.tags.comment,color:"var(--vtl-cm-comment)",fontStyle:"italic"},{tag:[Zg.tags.keyword,Zg.tags.modifier,Zg.tags.operatorKeyword],color:"var(--vtl-cm-keyword)"},{tag:[Zg.tags.atom,Zg.tags.bool,Zg.tags.null],color:"var(--vtl-cm-constant)"},{tag:[Zg.tags.number,Zg.tags.integer,Zg.tags.float],color:"var(--vtl-cm-number)"},{tag:[Zg.tags.string,Zg.tags.special(Zg.tags.string),Zg.tags.regexp],color:"var(--vtl-cm-string)"},{tag:[Zg.tags.variableName,Zg.tags.self,Zg.tags.propertyName],color:"var(--vtl-cm-variable)"},{tag:[Zg.tags.definition(Zg.tags.variableName),Zg.tags.function(Zg.tags.variableName)],color:"var(--vtl-cm-function)"},{tag:[Zg.tags.className,Zg.tags.typeName,Zg.tags.namespace],color:"var(--vtl-cm-type)"},{tag:[Zg.tags.tagName,Zg.tags.heading],color:"var(--vtl-cm-tag)"},{tag:Zg.tags.attributeName,color:"var(--vtl-cm-attribute)"},{tag:[Zg.tags.attributeValue,Zg.tags.link],color:"var(--vtl-cm-string)"},{tag:[Zg.tags.punctuation,Zg.tags.separator,Zg.tags.bracket],color:"var(--vtl-cm-punctuation)"},{tag:[Zg.tags.invalid],color:"var(--vtl-cm-invalid)"}]),ZO=GX.EditorView.theme({"&":{height:"100%",backgroundColor:"var(--vtl-cm-background)",color:"var(--vtl-cm-foreground)",fontSize:"var(--font-size-code)",lineHeight:"var(--vtl-cm-line-height)"},".cm-scroller":{fontFamily:"var(--font-family-mono)",height:"100%",overflow:"auto",scrollbarColor:"var(--border) transparent",scrollbarWidth:"thin"},".cm-scroller::-webkit-scrollbar":{width:"10px",height:"10px"},".cm-scroller::-webkit-scrollbar-track, .cm-scroller::-webkit-scrollbar-corner":{background:"transparent"},".cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:"var(--border)",border:"3px solid transparent",borderRadius:"9999px",backgroundClip:"content-box"},".cm-content":{minHeight:"100%",caretColor:"var(--vtl-cm-foreground)",padding:"0 0"},".cm-gutters":{backgroundColor:"var(--vtl-cm-background)",color:"var(--vtl-cm-gutter-foreground)",borderRightColor:"transparent",left:"0",position:"sticky",zIndex:"2"},".cm-gutter":{minWidth:"2.5rem"},".cm-gutters .cm-foldGutter":{display:"none !important"},".cm-lineNumbers .cm-gutterElement":{minWidth:"2.5rem",padding:"0 0.5rem 0 0",textAlign:"right",lineHeight:"var(--vtl-cm-line-height)"},".cm-activeLine":{backgroundColor:"var(--vtl-cm-active-line)"},".cm-activeLineGutter":{backgroundColor:"var(--vtl-cm-background)",color:"var(--vtl-cm-foreground)"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:"var(--vtl-cm-selection) !important"},".cm-line ::selection, .cm-content ::selection, ::selection":{backgroundColor:"var(--vtl-cm-selection) !important",color:"var(--vtl-cm-selection-text) !important"},"&.cm-focused":{outline:"none"},".cm-cursor":{borderLeftColor:"var(--vtl-cm-foreground)"},".cm-line":{caretColor:"var(--vtl-cm-foreground)",lineHeight:"var(--vtl-cm-line-height)",minHeight:"var(--vtl-cm-line-height)",padding:"0 0.75rem"}});function ZP({value:e,file:t,readOnly:n,onValueChange:r,wrapLines:i,className:a}){let o=ew.useRef(null),l=ew.useRef(null),s=ew.useRef(e),c=ew.useRef(r);return ew.useEffect(()=>{c.current=r},[r]),ew.useEffect(()=>{s.current=e;let t=l.current;t&&t.state.doc.toString()!==e&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},[e]),ew.useEffect(()=>{let e=o.current;if(!e)return;let r=!1,a=new GY.Compartment,d=new GX.EditorView({parent:e,state:GY.EditorState.create({doc:s.current,extensions:[Zm,ZO,GY.EditorState.readOnly.of(n),GX.EditorView.editable.of(!n),i?GX.EditorView.lineWrapping:[],a.of([]),GY.Prec.high((0,Gq.syntaxHighlighting)(ZE)),GX.EditorView.updateListener.of(e=>{if(!e.docChanged)return;let t=e.state.doc.toString();s.current=t,c.current?.(t)})]})});return l.current=d,ZC(t).then(e=>{r||l.current!==d||d.dispatch({effects:a.reconfigure(e)})}),()=>{r=!0,d.destroy(),l.current=null}},[t.kind,t.language,t.mimeType,t.name,t.path,t.readOnly,n,i]),(0,eb.jsx)("div",{"data-slot":"file-tab-code-editor",className:tK("size-full overflow-hidden bg-background",a),ref:o})}function ZA({value:e}){let t=e.split(/\n{2,}/);return(0,eb.jsx)("div",{className:"mx-auto grid w-full max-w-3xl gap-3 p-6",children:t.map((e,t)=>{let n=e.trim();return n?n.startsWith("### ")?(0,eb.jsx)("h3",{className:"ui-text-body font-semibold text-foreground",children:n.replace(/^###\s+/,"")},t):n.startsWith("## ")?(0,eb.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:n.replace(/^##\s+/,"")},t):n.startsWith("# ")?(0,eb.jsx)("h1",{className:"text-xl font-semibold text-foreground",children:n.replace(/^#\s+/,"")},t):n.startsWith(">")?(0,eb.jsx)("blockquote",{className:"border-l-2 pl-3 text-muted-foreground ui-text-body",children:n.replace(/^>\s?/gm,"")},t):/^[-*]\s+/m.test(n)?(0,eb.jsx)("ul",{className:"grid list-disc gap-1 pl-5 ui-text-body",children:n.split("\n").map(e=>(0,eb.jsx)("li",{children:e.replace(/^[-*]\s+/,"")},e))},t):n.startsWith("```")?(0,eb.jsx)("pre",{className:"overflow-auto rounded-lg border bg-code p-3 text-code-foreground ui-text-code",children:n.replace(/^```\w*\n?/,"").replace(/```$/,"")},t):(0,eb.jsx)("p",{className:"text-muted-foreground ui-text-body",children:n},t):null})})}function Zz({title:e,value:t,className:n}){let r=function(){let[e,t]=ew.useState("light");return ew.useEffect(()=>{function e(){let e=document.documentElement.classList.contains("dark"),n=document.documentElement.classList.contains("light");e||n?t(e?"dark":"light"):t(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}e();let n=new MutationObserver(e),r=window.matchMedia("(prefers-color-scheme: dark)");return n.observe(document.documentElement,{attributeFilter:["class"],attributes:!0}),r.addEventListener("change",e),()=>{n.disconnect(),r.removeEventListener("change",e)}},[]),e}(),i=ew.useMemo(()=>{let e,n;return e="dark"===r?"rgba(255, 255, 255, 0.16)":"#d8dee9",n=`<style data-vantaloom-scrollbar>
|
|
21
|
+
color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,null==n?void 0:n.key)}return r}}function KZ(e,t,n,r){return{debug:()=>{var n;return null!=(n=null==e?void 0:e.debugAll)?n:e[t]},key:!1,onChange:r}}let KJ="debugHeaders";function KQ(e,t,n){var r;let i={id:null!=(r=n.id)?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{let e=[],t=n=>{n.subHeaders&&n.subHeaders.length&&n.subHeaders.map(t),e.push(n)};return t(i),e},getContext:()=>({table:e,header:i,column:t})};return e._features.forEach(t=>{null==t.createHeader||t.createHeader(i,e)}),i}function K0(e,t,n,r){var i,a;let o=0,l=function(e,t){void 0===t&&(t=1),o=Math.max(o,t),e.filter(e=>e.getIsVisible()).forEach(e=>{var n;null!=(n=e.columns)&&n.length&&l(e.columns,t+1)},0)};l(e);let s=[],c=(e,t)=>{let i={depth:t,id:[r,`${t}`].filter(Boolean).join("_"),headers:[]},a=[];e.forEach(e=>{let o,l=[...a].reverse()[0],s=e.column.depth===i.depth,c=!1;if(s&&e.column.parent?o=e.column.parent:(o=e.column,c=!0),l&&(null==l?void 0:l.column)===o)l.subHeaders.push(e);else{let i=KQ(n,o,{id:[r,t,o.id,null==e?void 0:e.id].filter(Boolean).join("_"),isPlaceholder:c,placeholderId:c?`${a.filter(e=>e.column===o).length}`:void 0,depth:t,index:a.length});i.subHeaders.push(e),a.push(i)}i.headers.push(e),e.headerGroup=i}),s.push(i),t>0&&c(a,t-1)};c(t.map((e,t)=>KQ(n,e,{depth:o,index:t})),o-1),s.reverse();let d=e=>e.filter(e=>e.column.getIsVisible()).map(e=>{let t=0,n=0,r=[0];return e.subHeaders&&e.subHeaders.length?(r=[],d(e.subHeaders).forEach(e=>{let{colSpan:n,rowSpan:i}=e;t+=n,r.push(i)})):t=1,n+=Math.min(...r),e.colSpan=t,e.rowSpan=n,{colSpan:t,rowSpan:n}});return d(null!=(i=null==(a=s[0])?void 0:a.headers)?i:[]),s}let K1=(e,t,n,r,i,a,o)=>{let l={id:t,index:r,original:n,depth:i,parentId:o,_valuesCache:{},_uniqueValuesCache:{},getValue:t=>{if(l._valuesCache.hasOwnProperty(t))return l._valuesCache[t];let n=e.getColumn(t);if(null!=n&&n.accessorFn)return l._valuesCache[t]=n.accessorFn(l.original,r),l._valuesCache[t]},getUniqueValues:t=>{if(l._uniqueValuesCache.hasOwnProperty(t))return l._uniqueValuesCache[t];let n=e.getColumn(t);if(null!=n&&n.accessorFn)return n.columnDef.getUniqueValues?l._uniqueValuesCache[t]=n.columnDef.getUniqueValues(l.original,r):l._uniqueValuesCache[t]=[l.getValue(t)],l._uniqueValuesCache[t]},renderValue:t=>{var n;return null!=(n=l.getValue(t))?n:e.options.renderFallbackValue},subRows:null!=a?a:[],getLeafRows:()=>{var e,t;let n,r;return e=l.subRows,t=e=>e.subRows,n=[],(r=e=>{e.forEach(e=>{n.push(e);let i=t(e);null!=i&&i.length&&r(i)})})(e),n},getParentRow:()=>l.parentId?e.getRow(l.parentId,!0):void 0,getParentRows:()=>{let e=[],t=l;for(;;){let n=t.getParentRow();if(!n)break;e.push(n),t=n}return e.reverse()},getAllCells:KX(()=>[e.getAllLeafColumns()],t=>t.map(t=>{var n;let r;return n=t.id,r={id:`${l.id}_${t.id}`,row:l,column:t,getValue:()=>l.getValue(n),renderValue:()=>{var t;return null!=(t=r.getValue())?t:e.options.renderFallbackValue},getContext:KX(()=>[e,t,l,r],(e,t,n,r)=>({table:e,column:t,row:n,cell:r,getValue:r.getValue,renderValue:r.renderValue}),KZ(e.options,"debugCells","cell.getContext"))},e._features.forEach(n=>{null==n.createCell||n.createCell(r,t,l,e)},{}),r}),KZ(e.options,"debugRows","getAllCells")),_getAllCellsByColumnId:KX(()=>[l.getAllCells()],e=>e.reduce((e,t)=>(e[t.column.id]=t,e),{}),KZ(e.options,"debugRows","getAllCellsByColumnId"))};for(let t=0;t<e._features.length;t++){let n=e._features[t];null==n||null==n.createRow||n.createRow(l,e)}return l},K2=(e,t,n)=>{var r,i;let a=null==n||null==(r=n.toString())?void 0:r.toLowerCase();return!!(null==(i=e.getValue(t))||null==(i=i.toString())||null==(i=i.toLowerCase())?void 0:i.includes(a))};K2.autoRemove=e=>Gn(e);let K5=(e,t,n)=>{var r;return!!(null==(r=e.getValue(t))||null==(r=r.toString())?void 0:r.includes(n))};K5.autoRemove=e=>Gn(e);let K4=(e,t,n)=>{var r;return(null==(r=e.getValue(t))||null==(r=r.toString())?void 0:r.toLowerCase())===(null==n?void 0:n.toLowerCase())};K4.autoRemove=e=>Gn(e);let K3=(e,t,n)=>{var r;return null==(r=e.getValue(t))?void 0:r.includes(n)};K3.autoRemove=e=>Gn(e);let K6=(e,t,n)=>!n.some(n=>{var r;return!(null!=(r=e.getValue(t))&&r.includes(n))});K6.autoRemove=e=>Gn(e)||!(null!=e&&e.length);let K8=(e,t,n)=>n.some(n=>{var r;return null==(r=e.getValue(t))?void 0:r.includes(n)});K8.autoRemove=e=>Gn(e)||!(null!=e&&e.length);let K7=(e,t,n)=>e.getValue(t)===n;K7.autoRemove=e=>Gn(e);let K9=(e,t,n)=>e.getValue(t)==n;K9.autoRemove=e=>Gn(e);let Ge=(e,t,n)=>{let[r,i]=n,a=e.getValue(t);return a>=r&&a<=i};Ge.resolveFilterValue=e=>{let[t,n]=e,r="number"!=typeof t?parseFloat(t):t,i="number"!=typeof n?parseFloat(n):n,a=null===t||Number.isNaN(r)?-1/0:r,o=null===n||Number.isNaN(i)?1/0:i;if(a>o){let e=a;a=o,o=e}return[a,o]},Ge.autoRemove=e=>Gn(e)||Gn(e[0])&&Gn(e[1]);let Gt={includesString:K2,includesStringSensitive:K5,equalsString:K4,arrIncludes:K3,arrIncludesAll:K6,arrIncludesSome:K8,equals:K7,weakEquals:K9,inNumberRange:Ge};function Gn(e){return null==e||""===e}function Gr(e,t,n){return!!e&&!!e.autoRemove&&e.autoRemove(t,n)||void 0===t||"string"==typeof t&&!t}let Gi={sum:(e,t,n)=>n.reduce((t,n)=>{let r=n.getValue(e);return t+("number"==typeof r?r:0)},0),min:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);null!=n&&(r>n||void 0===r&&n>=n)&&(r=n)}),r},max:(e,t,n)=>{let r;return n.forEach(t=>{let n=t.getValue(e);null!=n&&(r<n||void 0===r&&n>=n)&&(r=n)}),r},extent:(e,t,n)=>{let r,i;return n.forEach(t=>{let n=t.getValue(e);null!=n&&(void 0===r?n>=n&&(r=i=n):(r>n&&(r=n),i<n&&(i=n)))}),[r,i]},mean:(e,t)=>{let n=0,r=0;if(t.forEach(t=>{let i=t.getValue(e);null!=i&&(i*=1)>=i&&(++n,r+=i)}),n)return r/n},median:(e,t)=>{if(!t.length)return;let n=t.map(t=>t.getValue(e));if(!(Array.isArray(n)&&n.every(e=>"number"==typeof e)))return;if(1===n.length)return n[0];let r=Math.floor(n.length/2),i=n.sort((e,t)=>e-t);return n.length%2!=0?i[r]:(i[r-1]+i[r])/2},unique:(e,t)=>Array.from(new Set(t.map(t=>t.getValue(e))).values()),uniqueCount:(e,t)=>new Set(t.map(t=>t.getValue(e))).size,count:(e,t)=>t.length},Ga=()=>({left:[],right:[]}),Go={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Gl=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),Gs=null;function Gc(e){return"touchstart"===e.type}function Gd(e,t){return t?"center"===t?e.getCenterVisibleLeafColumns():"left"===t?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}let Gu=()=>({pageIndex:0,pageSize:10}),Gf=()=>({top:[],bottom:[]}),Gh=(e,t,n,r,i)=>{var a;let o=i.getRow(t,!0);n?(o.getCanMultiSelect()||Object.keys(e).forEach(t=>delete e[t]),o.getCanSelect()&&(e[t]=!0)):delete e[t],r&&null!=(a=o.subRows)&&a.length&&o.getCanSelectSubRows()&&o.subRows.forEach(t=>Gh(e,t.id,n,r,i))};function Gp(e,t){let n=e.getState().rowSelection,r=[],i={},a=function(e,t){return e.map(e=>{var t;let o=Gm(e,n);if(o&&(r.push(e),i[e.id]=e),null!=(t=e.subRows)&&t.length&&(e={...e,subRows:a(e.subRows)}),o)return e}).filter(Boolean)};return{rows:a(t.rows),flatRows:r,rowsById:i}}function Gm(e,t){var n;return null!=(n=t[e.id])&&n}function Gg(e,t,n){var r;if(!(null!=(r=e.subRows)&&r.length))return!1;let i=!0,a=!1;return e.subRows.forEach(e=>{if((!a||i)&&(e.getCanSelect()&&(Gm(e,t)?a=!0:i=!1),e.subRows&&e.subRows.length)){let n=Gg(e,t);"all"===n?a=!0:("some"===n&&(a=!0),i=!1)}}),i?"all":!!a&&"some"}let Gv=/([0-9]+)/gm;function Gx(e,t){return e===t?0:e>t?1:-1}function Gy(e){return"number"==typeof e?isNaN(e)||e===1/0||e===-1/0?"":String(e):"string"==typeof e?e:""}function Gb(e,t){let n=e.split(Gv).filter(Boolean),r=t.split(Gv).filter(Boolean);for(;n.length&&r.length;){let e=n.shift(),t=r.shift(),i=parseInt(e,10),a=parseInt(t,10),o=[i,a].sort();if(isNaN(o[0])){if(e>t)return 1;if(t>e)return -1;continue}if(isNaN(o[1]))return isNaN(i)?-1:1;if(i>a)return 1;if(a>i)return -1}return n.length-r.length}let Gw={alphanumeric:(e,t,n)=>Gb(Gy(e.getValue(n)).toLowerCase(),Gy(t.getValue(n)).toLowerCase()),alphanumericCaseSensitive:(e,t,n)=>Gb(Gy(e.getValue(n)),Gy(t.getValue(n))),text:(e,t,n)=>Gx(Gy(e.getValue(n)).toLowerCase(),Gy(t.getValue(n)).toLowerCase()),textCaseSensitive:(e,t,n)=>Gx(Gy(e.getValue(n)),Gy(t.getValue(n))),datetime:(e,t,n)=>{let r=e.getValue(n),i=t.getValue(n);return r>i?1:r<i?-1:0},basic:(e,t,n)=>Gx(e.getValue(n),t.getValue(n))},Gj=[{createTable:e=>{e.getHeaderGroups=KX(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>{var a,o;let l=null!=(a=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?a:[],s=null!=(o=null==i?void 0:i.map(e=>n.find(t=>t.id===e)).filter(Boolean))?o:[];return K0(t,[...l,...n.filter(e=>!(null!=r&&r.includes(e.id))&&!(null!=i&&i.includes(e.id))),...s],e)},KZ(e.options,KJ,"getHeaderGroups")),e.getCenterHeaderGroups=KX(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,i)=>K0(t,n=n.filter(e=>!(null!=r&&r.includes(e.id))&&!(null!=i&&i.includes(e.id))),e,"center"),KZ(e.options,KJ,"getCenterHeaderGroups")),e.getLeftHeaderGroups=KX(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var i;return K0(t,null!=(i=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?i:[],e,"left")},KZ(e.options,KJ,"getLeftHeaderGroups")),e.getRightHeaderGroups=KX(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var i;return K0(t,null!=(i=null==r?void 0:r.map(e=>n.find(t=>t.id===e)).filter(Boolean))?i:[],e,"right")},KZ(e.options,KJ,"getRightHeaderGroups")),e.getFooterGroups=KX(()=>[e.getHeaderGroups()],e=>[...e].reverse(),KZ(e.options,KJ,"getFooterGroups")),e.getLeftFooterGroups=KX(()=>[e.getLeftHeaderGroups()],e=>[...e].reverse(),KZ(e.options,KJ,"getLeftFooterGroups")),e.getCenterFooterGroups=KX(()=>[e.getCenterHeaderGroups()],e=>[...e].reverse(),KZ(e.options,KJ,"getCenterFooterGroups")),e.getRightFooterGroups=KX(()=>[e.getRightHeaderGroups()],e=>[...e].reverse(),KZ(e.options,KJ,"getRightFooterGroups")),e.getFlatHeaders=KX(()=>[e.getHeaderGroups()],e=>e.map(e=>e.headers).flat(),KZ(e.options,KJ,"getFlatHeaders")),e.getLeftFlatHeaders=KX(()=>[e.getLeftHeaderGroups()],e=>e.map(e=>e.headers).flat(),KZ(e.options,KJ,"getLeftFlatHeaders")),e.getCenterFlatHeaders=KX(()=>[e.getCenterHeaderGroups()],e=>e.map(e=>e.headers).flat(),KZ(e.options,KJ,"getCenterFlatHeaders")),e.getRightFlatHeaders=KX(()=>[e.getRightHeaderGroups()],e=>e.map(e=>e.headers).flat(),KZ(e.options,KJ,"getRightFlatHeaders")),e.getCenterLeafHeaders=KX(()=>[e.getCenterFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),KZ(e.options,KJ,"getCenterLeafHeaders")),e.getLeftLeafHeaders=KX(()=>[e.getLeftFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),KZ(e.options,KJ,"getLeftLeafHeaders")),e.getRightLeafHeaders=KX(()=>[e.getRightFlatHeaders()],e=>e.filter(e=>{var t;return!(null!=(t=e.subHeaders)&&t.length)}),KZ(e.options,KJ,"getRightLeafHeaders")),e.getLeafHeaders=KX(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(e,t,n)=>{var r,i,a,o,l,s;return[...null!=(r=null==(i=e[0])?void 0:i.headers)?r:[],...null!=(a=null==(o=t[0])?void 0:o.headers)?a:[],...null!=(l=null==(s=n[0])?void 0:s.headers)?l:[]].map(e=>e.getLeafHeaders()).flat()},KZ(e.options,KJ,"getLeafHeaders"))}},{getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:KG("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(t=>({...t,[e.id]:null!=n?n:!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;let i=e.columns;return null==(n=i.length?i.some(e=>e.getIsVisible()):null==(r=t.getState().columnVisibility)?void 0:r[e.id])||n},e.getCanHide=()=>{var n,r;return(null==(n=e.columnDef.enableHiding)||n)&&(null==(r=t.options.enableHiding)||r)},e.getToggleVisibilityHandler=()=>t=>{null==e.toggleVisibility||e.toggleVisibility(t.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=KX(()=>[e.getAllCells(),t.getState().columnVisibility],e=>e.filter(e=>e.column.getIsVisible()),KZ(t.options,"debugRows","_getAllVisibleCells")),e.getVisibleCells=KX(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(e,t,n)=>[...e,...t,...n],KZ(t.options,"debugRows","getVisibleCells"))},createTable:e=>{let t=(t,n)=>KX(()=>[n(),n().filter(e=>e.getIsVisible()).map(e=>e.id).join("_")],e=>e.filter(e=>null==e.getIsVisible?void 0:e.getIsVisible()),KZ(e.options,"debugColumns",t));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>null==e.options.onColumnVisibilityChange?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:null!=(n=e.initialState.columnVisibility)?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=null!=(n=t)?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((e,n)=>({...e,[n.id]:t||!(null!=n.getCanHide&&n.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(e=>!(null!=e.getIsVisible&&e.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(e=>null==e.getIsVisible?void 0:e.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible(null==(n=t.target)?void 0:n.checked)}}},{getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:KG("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=KX(e=>[Gd(t,e)],t=>t.findIndex(t=>t.id===e.id),KZ(t.options,"debugColumns","getIndex")),e.getIsFirstColumn=n=>{var r;return(null==(r=Gd(t,n)[0])?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;let i=Gd(t,n);return(null==(r=i[i.length-1])?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>null==e.options.onColumnOrderChange?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:null!=(n=e.initialState.columnOrder)?n:[])},e._getOrderColumnsFn=KX(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(e,t,n)=>r=>{let i=[];if(null!=e&&e.length){let t=[...e],n=[...r];for(;n.length&&t.length;){let e=t.shift(),r=n.findIndex(t=>t.id===e);r>-1&&i.push(n.splice(r,1)[0])}i=[...i,...n]}else i=r;var a=i;if(!(null!=t&&t.length)||!n)return a;let o=a.filter(e=>!t.includes(e.id));return"remove"===n?o:[...t.map(e=>a.find(t=>t.id===e)).filter(Boolean),...o]},KZ(e.options,"debugTable","_getOrderColumnsFn"))}},{getInitialState:e=>({columnPinning:Ga(),...e}),getDefaultOptions:e=>({onColumnPinningChange:KG("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{let r=e.getLeafColumns().map(e=>e.id).filter(Boolean);t.setColumnPinning(e=>{var t,i,a,o,l,s;return"right"===n?{left:(null!=(a=null==e?void 0:e.left)?a:[]).filter(e=>!(null!=r&&r.includes(e))),right:[...(null!=(o=null==e?void 0:e.right)?o:[]).filter(e=>!(null!=r&&r.includes(e))),...r]}:"left"===n?{left:[...(null!=(l=null==e?void 0:e.left)?l:[]).filter(e=>!(null!=r&&r.includes(e))),...r],right:(null!=(s=null==e?void 0:e.right)?s:[]).filter(e=>!(null!=r&&r.includes(e)))}:{left:(null!=(t=null==e?void 0:e.left)?t:[]).filter(e=>!(null!=r&&r.includes(e))),right:(null!=(i=null==e?void 0:e.right)?i:[]).filter(e=>!(null!=r&&r.includes(e)))}})},e.getCanPin=()=>e.getLeafColumns().some(e=>{var n,r,i;return(null==(n=e.columnDef.enablePinning)||n)&&(null==(r=null!=(i=t.options.enableColumnPinning)?i:t.options.enablePinning)||r)}),e.getIsPinned=()=>{let n=e.getLeafColumns().map(e=>e.id),{left:r,right:i}=t.getState().columnPinning,a=n.some(e=>null==r?void 0:r.includes(e)),o=n.some(e=>null==i?void 0:i.includes(e));return a?"left":!!o&&"right"},e.getPinnedIndex=()=>{var n,r;let i=e.getIsPinned();return i?null!=(n=null==(r=t.getState().columnPinning)||null==(r=r[i])?void 0:r.indexOf(e.id))?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=KX(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(e,t,n)=>{let r=[...null!=t?t:[],...null!=n?n:[]];return e.filter(e=>!r.includes(e.column.id))},KZ(t.options,"debugRows","getCenterVisibleCells")),e.getLeftVisibleCells=KX(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:"left"})),KZ(t.options,"debugRows","getLeftVisibleCells")),e.getRightVisibleCells=KX(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.column.id===t)).filter(Boolean).map(e=>({...e,position:"right"})),KZ(t.options,"debugRows","getRightVisibleCells"))},createTable:e=>{e.setColumnPinning=t=>null==e.options.onColumnPinningChange?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?Ga():null!=(n=null==(r=e.initialState)?void 0:r.columnPinning)?n:Ga())},e.getIsSomeColumnsPinned=t=>{var n,r,i;let a=e.getState().columnPinning;return t?!!(null==(n=a[t])?void 0:n.length):!!((null==(r=a.left)?void 0:r.length)||(null==(i=a.right)?void 0:i.length))},e.getLeftLeafColumns=KX(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),KZ(e.options,"debugColumns","getLeftLeafColumns")),e.getRightLeafColumns=KX(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(e,t)=>(null!=t?t:[]).map(t=>e.find(e=>e.id===t)).filter(Boolean),KZ(e.options,"debugColumns","getRightLeafColumns")),e.getCenterLeafColumns=KX(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(e,t,n)=>{let r=[...null!=t?t:[],...null!=n?n:[]];return e.filter(e=>!r.includes(e.id))},KZ(e.options,"debugColumns","getCenterLeafColumns"))}},{createColumn:(e,t)=>{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},{getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:KG("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{let n=t.getCoreRowModel().flatRows[0],r=null==n?void 0:n.getValue(e.id);return"string"==typeof r?Gt.includesString:"number"==typeof r?Gt.inNumberRange:"boolean"==typeof r||null!==r&&"object"==typeof r?Gt.equals:Array.isArray(r)?Gt.arrIncludes:Gt.weakEquals},e.getFilterFn=()=>{var n,r;return KY(e.columnDef.filterFn)?e.columnDef.filterFn:"auto"===e.columnDef.filterFn?e.getAutoFilterFn():null!=(n=null==(r=t.options.filterFns)?void 0:r[e.columnDef.filterFn])?n:Gt[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,i;return(null==(n=e.columnDef.enableColumnFilter)||n)&&(null==(r=t.options.enableColumnFilters)||r)&&(null==(i=t.options.enableFilters)||i)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return null==(n=t.getState().columnFilters)||null==(n=n.find(t=>t.id===e.id))?void 0:n.value},e.getFilterIndex=()=>{var n,r;return null!=(n=null==(r=t.getState().columnFilters)?void 0:r.findIndex(t=>t.id===e.id))?n:-1},e.setFilterValue=n=>{t.setColumnFilters(t=>{var r,i;let a=e.getFilterFn(),o=null==t?void 0:t.find(t=>t.id===e.id),l=KK(n,o?o.value:void 0);if(Gr(a,l,e))return null!=(r=null==t?void 0:t.filter(t=>t.id!==e.id))?r:[];let s={id:e.id,value:l};return o?null!=(i=null==t?void 0:t.map(t=>t.id===e.id?s:t))?i:[]:null!=t&&t.length?[...t,s]:[s]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{let n=e.getAllLeafColumns();null==e.options.onColumnFiltersChange||e.options.onColumnFiltersChange(e=>{var r;return null==(r=KK(t,e))?void 0:r.filter(e=>{let t=n.find(t=>t.id===e.id);return!(t&&Gr(t.getFilterFn(),e.value,t))&&!0})})},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.columnFilters)?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel)?e.getPreFilteredRowModel():e._getFilteredRowModel()}},{createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},{getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:KG("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;let r=null==(n=e.getCoreRowModel().flatRows[0])||null==(n=n._getAllCellsByColumnId()[t.id])?void 0:n.getValue();return"string"==typeof r||"number"==typeof r}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,i,a;return(null==(n=e.columnDef.enableGlobalFilter)||n)&&(null==(r=t.options.enableGlobalFilter)||r)&&(null==(i=t.options.enableFilters)||i)&&(null==(a=null==t.options.getColumnCanGlobalFilter?void 0:t.options.getColumnCanGlobalFilter(e))||a)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Gt.includesString,e.getGlobalFilterFn=()=>{var t,n;let{globalFilterFn:r}=e.options;return KY(r)?r:"auto"===r?e.getGlobalAutoFilterFn():null!=(t=null==(n=e.options.filterFns)?void 0:n[r])?t:Gt[r]},e.setGlobalFilter=t=>{null==e.options.onGlobalFilterChange||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},{getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:KG("sorting",e),isMultiSortEvent:e=>e.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{let n=t.getFilteredRowModel().flatRows.slice(10),r=!1;for(let t of n){let n=null==t?void 0:t.getValue(e.id);if("[object Date]"===Object.prototype.toString.call(n))return Gw.datetime;if("string"==typeof n&&(r=!0,n.split(Gv).length>1))return Gw.alphanumeric}return r?Gw.text:Gw.basic},e.getAutoSortDir=()=>{let n=t.getFilteredRowModel().flatRows[0];return"string"==typeof(null==n?void 0:n.getValue(e.id))?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw Error();return KY(e.columnDef.sortingFn)?e.columnDef.sortingFn:"auto"===e.columnDef.sortingFn?e.getAutoSortingFn():null!=(n=null==(r=t.options.sortingFns)?void 0:r[e.columnDef.sortingFn])?n:Gw[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{let i=e.getNextSortingOrder(),a=null!=n;t.setSorting(o=>{let l,s=null==o?void 0:o.find(t=>t.id===e.id),c=null==o?void 0:o.findIndex(t=>t.id===e.id),d=[],u=a?n:"desc"===i;if("toggle"!=(l=null!=o&&o.length&&e.getCanMultiSort()&&r?s?"toggle":"add":null!=o&&o.length&&c!==o.length-1?"replace":s?"toggle":"replace")||a||i||(l="remove"),"add"===l){var f;(d=[...o,{id:e.id,desc:u}]).splice(0,d.length-(null!=(f=t.options.maxMultiSortColCount)?f:Number.MAX_SAFE_INTEGER))}else d="toggle"===l?o.map(t=>t.id===e.id?{...t,desc:u}:t):"remove"===l?o.filter(t=>t.id!==e.id):[{id:e.id,desc:u}];return d})},e.getFirstSortDir=()=>{var n,r;return(null!=(n=null!=(r=e.columnDef.sortDescFirst)?r:t.options.sortDescFirst)?n:"desc"===e.getAutoSortDir())?"desc":"asc"},e.getNextSortingOrder=n=>{var r,i;let a=e.getFirstSortDir(),o=e.getIsSorted();return o?(o===a||null!=(r=t.options.enableSortingRemoval)&&!r||!!n&&null!=(i=t.options.enableMultiRemove)&&!i)&&("desc"===o?"asc":"desc"):a},e.getCanSort=()=>{var n,r;return(null==(n=e.columnDef.enableSorting)||n)&&(null==(r=t.options.enableSorting)||r)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return null!=(n=null!=(r=e.columnDef.enableMultiSort)?r:t.options.enableMultiSort)?n:!!e.accessorFn},e.getIsSorted=()=>{var n;let r=null==(n=t.getState().sorting)?void 0:n.find(t=>t.id===e.id);return!!r&&(r.desc?"desc":"asc")},e.getSortIndex=()=>{var n,r;return null!=(n=null==(r=t.getState().sorting)?void 0:r.findIndex(t=>t.id===e.id))?n:-1},e.clearSorting=()=>{t.setSorting(t=>null!=t&&t.length?t.filter(t=>t.id!==e.id):[])},e.getToggleSortingHandler=()=>{let n=e.getCanSort();return r=>{n&&(null==r.persist||r.persist(),null==e.toggleSorting||e.toggleSorting(void 0,!!e.getCanMultiSort()&&(null==t.options.isMultiSortEvent?void 0:t.options.isMultiSortEvent(r))))}}},createTable:e=>{e.setSorting=t=>null==e.options.onSortingChange?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.sorting)?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel)?e.getPreSortedRowModel():e._getSortedRowModel()}},{getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return null!=(t=null==(n=e.getValue())||null==n.toString?void 0:n.toString())?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:KG("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(t=>null!=t&&t.includes(e.id)?t.filter(t=>t!==e.id):[...null!=t?t:[],e.id])},e.getCanGroup=()=>{var n,r;return(null==(n=e.columnDef.enableGrouping)||n)&&(null==(r=t.options.enableGrouping)||r)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return null==(n=t.getState().grouping)?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{let t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{let n=t.getCoreRowModel().flatRows[0],r=null==n?void 0:n.getValue(e.id);return"number"==typeof r?Gi.sum:"[object Date]"===Object.prototype.toString.call(r)?Gi.extent:void 0},e.getAggregationFn=()=>{var n,r;if(!e)throw Error();return KY(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:"auto"===e.columnDef.aggregationFn?e.getAutoAggregationFn():null!=(n=null==(r=t.options.aggregationFns)?void 0:r[e.columnDef.aggregationFn])?n:Gi[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>null==e.options.onGroupingChange?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:null!=(n=null==(r=e.initialState)?void 0:r.grouping)?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel)?e.getPreGroupedRowModel():e._getGroupedRowModel()},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];let r=t.getColumn(n);return null!=r&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var t;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!(null!=(t=n.subRows)&&t.length)}}},{getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:KG("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,i;if(!t)return void e._queue(()=>{t=!0});if(null!=(r=null!=(i=e.options.autoResetAll)?i:e.options.autoResetExpanded)?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=t=>null==e.options.onExpandedChange?void 0:e.options.onExpandedChange(t),e.toggleAllRowsExpanded=t=>{(null!=t?t:!e.getIsAllRowsExpanded())?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=t=>{var n,r;e.setExpanded(t?{}:null!=(n=null==(r=e.initialState)?void 0:r.expanded)?n:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(e=>e.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>t=>{null==t.persist||t.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{let t=e.getState().expanded;return!0===t||Object.values(t).some(Boolean)},e.getIsAllRowsExpanded=()=>{let t=e.getState().expanded;return"boolean"==typeof t?!0===t:!(!Object.keys(t).length||e.getRowModel().flatRows.some(e=>!e.getIsExpanded()))},e.getExpandedDepth=()=>{let t=0;return(!0===e.getState().expanded?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(e=>{let n=e.split(".");t=Math.max(t,n.length)}),t},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel)?e.getPreExpandedRowModel():e._getExpandedRowModel()},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var i;let a=!0===r||!!(null!=r&&r[e.id]),o={};if(!0===r?Object.keys(t.getRowModel().rowsById).forEach(e=>{o[e]=!0}):o=r,n=null!=(i=n)?i:!a,!a&&n)return{...o,[e.id]:!0};if(a&&!n){let{[e.id]:t,...n}=o;return n}return r})},e.getIsExpanded=()=>{var n;let r=t.getState().expanded;return!!(null!=(n=null==t.options.getIsRowExpanded?void 0:t.options.getIsRowExpanded(e))?n:!0===r||(null==r?void 0:r[e.id]))},e.getCanExpand=()=>{var n,r,i;return null!=(n=null==t.options.getRowCanExpand?void 0:t.options.getRowCanExpand(e))?n:(null==(r=t.options.enableExpanding)||r)&&!!(null!=(i=e.subRows)&&i.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)n=(r=t.getRow(r.parentId,!0)).getIsExpanded();return n},e.getToggleExpandedHandler=()=>{let t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},{getInitialState:e=>({...e,pagination:{...Gu(),...null==e?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:KG("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,i;if(!t)return void e._queue(()=>{t=!0});if(null!=(r=null!=(i=e.options.autoResetAll)?i:e.options.autoResetPageIndex)?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=t=>null==e.options.onPaginationChange?void 0:e.options.onPaginationChange(e=>KK(t,e)),e.resetPagination=t=>{var n;e.setPagination(t?Gu():null!=(n=e.initialState.pagination)?n:Gu())},e.setPageIndex=t=>{e.setPagination(n=>{let r=KK(t,n.pageIndex);return r=Math.max(0,Math.min(r,void 0===e.options.pageCount||-1===e.options.pageCount?Number.MAX_SAFE_INTEGER:e.options.pageCount-1)),{...n,pageIndex:r}})},e.resetPageIndex=t=>{var n,r;e.setPageIndex(t?0:null!=(n=null==(r=e.initialState)||null==(r=r.pagination)?void 0:r.pageIndex)?n:0)},e.resetPageSize=t=>{var n,r;e.setPageSize(t?10:null!=(n=null==(r=e.initialState)||null==(r=r.pagination)?void 0:r.pageSize)?n:10)},e.setPageSize=t=>{e.setPagination(e=>{let n=Math.max(1,KK(t,e.pageSize)),r=Math.floor(e.pageSize*e.pageIndex/n);return{...e,pageIndex:r,pageSize:n}})},e.setPageCount=t=>e.setPagination(n=>{var r;let i=KK(t,null!=(r=e.options.pageCount)?r:-1);return"number"==typeof i&&(i=Math.max(-1,i)),{...n,pageCount:i}}),e.getPageOptions=KX(()=>[e.getPageCount()],e=>{let t=[];return e&&e>0&&(t=[...Array(e)].fill(null).map((e,t)=>t)),t},KZ(e.options,"debugTable","getPageOptions")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{let{pageIndex:t}=e.getState().pagination,n=e.getPageCount();return -1===n||0!==n&&t<n-1},e.previousPage=()=>e.setPageIndex(e=>e-1),e.nextPage=()=>e.setPageIndex(e=>e+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel)?e.getPrePaginationRowModel():e._getPaginationRowModel(),e.getPageCount=()=>{var t;return null!=(t=e.options.pageCount)?t:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var t;return null!=(t=e.options.rowCount)?t:e.getPrePaginationRowModel().rows.length}}},{getInitialState:e=>({rowPinning:Gf(),...e}),getDefaultOptions:e=>({onRowPinningChange:KG("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,i)=>{let a=r?e.getLeafRows().map(e=>{let{id:t}=e;return t}):[],o=new Set([...i?e.getParentRows().map(e=>{let{id:t}=e;return t}):[],e.id,...a]);t.setRowPinning(e=>{var t,r,i,a,l,s;return"bottom"===n?{top:(null!=(i=null==e?void 0:e.top)?i:[]).filter(e=>!(null!=o&&o.has(e))),bottom:[...(null!=(a=null==e?void 0:e.bottom)?a:[]).filter(e=>!(null!=o&&o.has(e))),...Array.from(o)]}:"top"===n?{top:[...(null!=(l=null==e?void 0:e.top)?l:[]).filter(e=>!(null!=o&&o.has(e))),...Array.from(o)],bottom:(null!=(s=null==e?void 0:e.bottom)?s:[]).filter(e=>!(null!=o&&o.has(e)))}:{top:(null!=(t=null==e?void 0:e.top)?t:[]).filter(e=>!(null!=o&&o.has(e))),bottom:(null!=(r=null==e?void 0:e.bottom)?r:[]).filter(e=>!(null!=o&&o.has(e)))}})},e.getCanPin=()=>{var n;let{enableRowPinning:r,enablePinning:i}=t.options;return"function"==typeof r?r(e):null==(n=null!=r?r:i)||n},e.getIsPinned=()=>{let n=[e.id],{top:r,bottom:i}=t.getState().rowPinning,a=n.some(e=>null==r?void 0:r.includes(e)),o=n.some(e=>null==i?void 0:i.includes(e));return a?"top":!!o&&"bottom"},e.getPinnedIndex=()=>{var n,r;let i=e.getIsPinned();if(!i)return -1;let a=null==(n="top"===i?t.getTopRows():t.getBottomRows())?void 0:n.map(e=>{let{id:t}=e;return t});return null!=(r=null==a?void 0:a.indexOf(e.id))?r:-1}},createTable:e=>{e.setRowPinning=t=>null==e.options.onRowPinningChange?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?Gf():null!=(n=null==(r=e.initialState)?void 0:r.rowPinning)?n:Gf())},e.getIsSomeRowsPinned=t=>{var n,r,i;let a=e.getState().rowPinning;return t?!!(null==(n=a[t])?void 0:n.length):!!((null==(r=a.top)?void 0:r.length)||(null==(i=a.bottom)?void 0:i.length))},e._getPinnedRows=(t,n,r)=>{var i;return(null==(i=e.options.keepPinnedRows)||i?(null!=n?n:[]).map(t=>{let n=e.getRow(t,!0);return n.getIsAllParentsExpanded()?n:null}):(null!=n?n:[]).map(e=>t.find(t=>t.id===e))).filter(Boolean).map(e=>({...e,position:r}))},e.getTopRows=KX(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),KZ(e.options,"debugRows","getTopRows")),e.getBottomRows=KX(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),KZ(e.options,"debugRows","getBottomRows")),e.getCenterRows=KX(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(e,t,n)=>{let r=new Set([...null!=t?t:[],...null!=n?n:[]]);return e.filter(e=>!r.has(e.id))},KZ(e.options,"debugRows","getCenterRows"))}},{getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:KG("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>null==e.options.onRowSelectionChange?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:null!=(n=e.initialState.rowSelection)?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=void 0!==t?t:!e.getIsAllRowsSelected();let r={...n},i=e.getPreGroupedRowModel().flatRows;return t?i.forEach(e=>{e.getCanSelect()&&(r[e.id]=!0)}):i.forEach(e=>{delete r[e.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{let r=void 0!==t?t:!e.getIsAllPageRowsSelected(),i={...n};return e.getRowModel().rows.forEach(t=>{Gh(i,t.id,r,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=KX(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?Gp(e,n):{rows:[],flatRows:[],rowsById:{}},KZ(e.options,"debugTable","getSelectedRowModel")),e.getFilteredSelectedRowModel=KX(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?Gp(e,n):{rows:[],flatRows:[],rowsById:{}},KZ(e.options,"debugTable","getFilteredSelectedRowModel")),e.getGroupedSelectedRowModel=KX(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?Gp(e,n):{rows:[],flatRows:[],rowsById:{}},KZ(e.options,"debugTable","getGroupedSelectedRowModel")),e.getIsAllRowsSelected=()=>{let t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState(),r=!!(t.length&&Object.keys(n).length);return r&&t.some(e=>e.getCanSelect()&&!n[e.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows.filter(e=>e.getCanSelect()),{rowSelection:n}=e.getState(),r=!!t.length;return r&&t.some(e=>!n[e.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;let n=Object.keys(null!=(t=e.getState().rowSelection)?t:{}).length;return n>0&&n<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{let t=e.getPaginationRowModel().flatRows;return!e.getIsAllPageRowsSelected()&&t.filter(e=>e.getCanSelect()).some(e=>e.getIsSelected()||e.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{let i=e.getIsSelected();t.setRowSelection(a=>{var o;if(n=void 0!==n?n:!i,e.getCanSelect()&&i===n)return a;let l={...a};return Gh(l,e.id,n,null==(o=null==r?void 0:r.selectChildren)||o,t),l})},e.getIsSelected=()=>{let{rowSelection:n}=t.getState();return Gm(e,n)},e.getIsSomeSelected=()=>{let{rowSelection:n}=t.getState();return"some"===Gg(e,n)},e.getIsAllSubRowsSelected=()=>{let{rowSelection:n}=t.getState();return"all"===Gg(e,n)},e.getCanSelect=()=>{var n;return"function"==typeof t.options.enableRowSelection?t.options.enableRowSelection(e):null==(n=t.options.enableRowSelection)||n},e.getCanSelectSubRows=()=>{var n;return"function"==typeof t.options.enableSubRowSelection?t.options.enableSubRowSelection(e):null==(n=t.options.enableSubRowSelection)||n},e.getCanMultiSelect=()=>{var n;return"function"==typeof t.options.enableMultiRowSelection?t.options.enableMultiRowSelection(e):null==(n=t.options.enableMultiRowSelection)||n},e.getToggleSelectedHandler=()=>{let t=e.getCanSelect();return n=>{var r;t&&e.toggleSelected(null==(r=n.target)?void 0:r.checked)}}}},{getDefaultColumnDef:()=>Go,getInitialState:e=>({columnSizing:{},columnSizingInfo:Gl(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:KG("columnSizing",e),onColumnSizingInfoChange:KG("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,i;let a=t.getState().columnSizing[e.id];return Math.min(Math.max(null!=(n=e.columnDef.minSize)?n:Go.minSize,null!=(r=null!=a?a:e.columnDef.size)?r:Go.size),null!=(i=e.columnDef.maxSize)?i:Go.maxSize)},e.getStart=KX(e=>[e,Gd(t,e),t.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((e,t)=>e+t.getSize(),0),KZ(t.options,"debugColumns","getStart")),e.getAfter=KX(e=>[e,Gd(t,e),t.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((e,t)=>e+t.getSize(),0),KZ(t.options,"debugColumns","getAfter")),e.resetSize=()=>{t.setColumnSizing(t=>{let{[e.id]:n,...r}=t;return r})},e.getCanResize=()=>{var n,r;return(null==(n=e.columnDef.enableResizing)||n)&&(null==(r=t.options.enableColumnResizing)||r)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let t=0,n=e=>{if(e.subHeaders.length)e.subHeaders.forEach(n);else{var r;t+=null!=(r=e.column.getSize())?r:0}};return n(e),t},e.getStart=()=>{if(e.index>0){let t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=n=>{let r=t.getColumn(e.column.id),i=null==r?void 0:r.getCanResize();return a=>{if(!r||!i||(null==a.persist||a.persist(),Gc(a)&&a.touches&&a.touches.length>1))return;let o=e.getSize(),l=e?e.getLeafHeaders().map(e=>[e.column.id,e.column.getSize()]):[[r.id,r.getSize()]],s=Gc(a)?Math.round(a.touches[0].clientX):a.clientX,c={},d=(e,n)=>{"number"==typeof n&&(t.setColumnSizingInfo(e=>{var r,i;let a="rtl"===t.options.columnResizeDirection?-1:1,o=(n-(null!=(r=null==e?void 0:e.startOffset)?r:0))*a,l=Math.max(o/(null!=(i=null==e?void 0:e.startSize)?i:0),-.999999);return e.columnSizingStart.forEach(e=>{let[t,n]=e;c[t]=Math.round(100*Math.max(n+n*l,0))/100}),{...e,deltaOffset:o,deltaPercentage:l}}),("onChange"===t.options.columnResizeMode||"end"===e)&&t.setColumnSizing(e=>({...e,...c})))},u=e=>{d("end",e),t.setColumnSizingInfo(e=>({...e,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},f=n||("u">typeof document?document:null),h={moveHandler:e=>d("move",e.clientX),upHandler:e=>{null==f||f.removeEventListener("mousemove",h.moveHandler),null==f||f.removeEventListener("mouseup",h.upHandler),u(e.clientX)}},p={moveHandler:e=>(e.cancelable&&(e.preventDefault(),e.stopPropagation()),d("move",e.touches[0].clientX),!1),upHandler:e=>{var t;null==f||f.removeEventListener("touchmove",p.moveHandler),null==f||f.removeEventListener("touchend",p.upHandler),e.cancelable&&(e.preventDefault(),e.stopPropagation()),u(null==(t=e.touches[0])?void 0:t.clientX)}},m=!!function(){if("boolean"==typeof Gs)return Gs;let e=!1;try{let t=()=>{};window.addEventListener("test",t,{get passive(){return e=!0,!1}}),window.removeEventListener("test",t)}catch(t){e=!1}return Gs=e}()&&{passive:!1};Gc(a)?(null==f||f.addEventListener("touchmove",p.moveHandler,m),null==f||f.addEventListener("touchend",p.upHandler,m)):(null==f||f.addEventListener("mousemove",h.moveHandler,m),null==f||f.addEventListener("mouseup",h.upHandler,m)),t.setColumnSizingInfo(e=>({...e,startOffset:s,startSize:o,deltaOffset:0,deltaPercentage:0,columnSizingStart:l,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>null==e.options.onColumnSizingChange?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>null==e.options.onColumnSizingInfoChange?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:null!=(n=e.initialState.columnSizing)?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?Gl():null!=(n=e.initialState.columnSizingInfo)?n:Gl())},e.getTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getLeftTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getLeftHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getCenterTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getCenterHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0},e.getRightTotalSize=()=>{var t,n;return null!=(t=null==(n=e.getRightHeaderGroups()[0])?void 0:n.headers.reduce((e,t)=>e+t.getSize(),0))?t:0}}}];function Gk(e,t){var n,r,i;let a;return e?"function"==typeof(r=n=e)&&(a=Object.getPrototypeOf(r)).prototype&&a.prototype.isReactComponent||"function"==typeof n||"object"==typeof(i=n)&&"symbol"==typeof i.$$typeof&&["react.memo","react.forward_ref"].includes(i.$$typeof.description)?ew.createElement(e,t):e:null}function GS(e,t,n){let r,i=n.initialDeps??[],a=!0;function o(){let o=e();return(o.length!==i.length||o.some((e,t)=>i[t]!==e))&&(i=o,r=t(...o),(null==n?void 0:n.onChange)&&!(a&&n.skipInitialOnChange)&&n.onChange(r),a=!1),r}return o.updateDeps=e=>{i=e},o}function GC(e,t){if(void 0!==e)return e;throw Error(`Unexpected undefined${t?`: ${t}`:""}`)}let GN=()=>{if(void 0!==i)return i;if("u"<typeof navigator)return i=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return i=!0;let e=navigator.maxTouchPoints;return i="MacIntel"===navigator.platform&&void 0!==e&&e>0},GM=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},GE=e=>e,GO=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},GP=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(GM(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(null==e?void 0:e.borderBoxSize){let t=e.borderBoxSize[0];if(t)return void i({width:t.inlineSize,height:t.blockSize})}i(GM(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:"border-box"}),()=>{a.unobserve(n)}},GA={passive:!0},Gz="u"<typeof window||"onscrollend"in window,G_=(e,t)=>((e,t,n)=>{var r,i;let a,o=e.scrollElement;if(!o)return;let l=e.targetWindow;if(!l)return;let s=e.options.useScrollendEvent&&Gz,c=0,d=s?null:(r=()=>t(c,!1),i=e.options.isScrollingResetDelay,function(...e){l.clearTimeout(a),a=l.setTimeout(()=>r.apply(this,e),i)}),u=e=>()=>{c=n(o),null==d||d(),t(c,e)},f=u(!0),h=u(!1);return o.addEventListener("scroll",f,GA),s&&o.addEventListener("scrollend",h,GA),()=>{o.removeEventListener("scroll",f),s&&o.removeEventListener("scrollend",h)}})(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),GI=(e,t,n)=>{if(null==t?void 0:t.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},GD=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;null==(a=null==(i=r.scrollElement)?void 0:i.scrollTo)||a.call(i,{[r.options.horizontal?"left":"top"]:e+t,behavior:n})};class GT{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e,t,n;return(null==(n=null==(t=null==(e=this.targetWindow)?void 0:e.performance)?void 0:t.now)?void 0:n.call(t))??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(this.targetWindow&&this.targetWindow.ResizeObserver?e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){for(let[e,n]of(this.observer.unobserve(t),this.elementsCache))if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}):null);return{disconnect:()=>{var n;null==(n=t())||n.disconnect(),e=null},observe:e=>{var n;return null==(n=t())?void 0:n.observe(e,{box:"border-box"})},unobserve:e=>{var n;return null==(n=t())?void 0:n.unobserve(e)}}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:GE,rangeExtractor:GO,onChange:()=>{},measureElement:GI,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate"};for(let n in e){let r=e[n];void 0!==r&&(t[n]=r)}this.options=t},this.notify=e=>{var t,n;null==(n=(t=this.options).onChange)||n.call(t,this,e)},this.maybeNotify=GS(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),null!=this.rafId&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var e;let t=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==t){if(this.cleanup(),!t)return void this.maybeNotify();if(this.scrollElement=t,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=(null==(e=this.scrollElement)?void 0:e.window)??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{null!==this._intendedScrollOffset&&1.5>Math.abs(e-this._intendedScrollOffset)&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?"forward":"backward":null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),"addEventListener"in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,GN()&&null!=this.targetWindow&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener("touchstart",t,GA),e.addEventListener("touchend",n,GA),this.unsubs.push(()=>{e.removeEventListener("touchstart",t),e.removeEventListener("touchend",n),null!==this._iosTouchEndTimerId&&null!=this.targetWindow&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this._flushIosDeferredIfReady=()=>{if(0===this._iosDeferredAdjustment||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??("function"==typeof this.options.initialOffset?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{let n=new Map,r=new Map;for(let i=t-1;i>=0;i--){let t=e[i];if(n.has(t.lane))continue;let a=r.get(t.lane);if(null==a||t.end>a.end?r.set(t.lane,t):t.end<a.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=GS(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,t,n,r,i,a,o)=>(void 0!==this.prevLanes&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o}),{key:!1}),this.getMeasurements=GS(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o},l)=>{let s=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),0!==this.measurementsCache.length||this.lanesSettling||(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let c=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),1===a){var d;let i,a=this.options.gap,o=2*e,l=this._flatMeasurements;if(!l||l.length<o){let e=new Float64Array(o);l&&c>0&&e.set(l.subarray(0,2*c)),l=e,this._flatMeasurements=l}if(0===c)i=t+n;else{let e=c-1;i=l[2*e]+l[2*e+1]+a}for(let t=c;t<e;t++){let e=r(t),n=s.get(e),o="number"==typeof n?n:this.options.estimateSize(t);l[2*t]=i,l[2*t+1]=o,i+=o+a}let u=(d=l,new Proxy(Array(e),{get(t,n,i){if("string"==typeof n){let i=n.charCodeAt(0);if(i>=48&&i<=57){let i=+n;if(Number.isInteger(i)&&i>=0&&i<e){let e=t[i];if(!e){let n=d[2*i];e=t[i]={index:i,key:r(i),start:n,size:d[2*i+1],end:n+d[2*i+1],lane:0}}return e}}if("length"===n)return e}return Reflect.get(t,n,i)}}));return this.measurementsCache=u,u}let u=this.measurementsCache.slice(0,c),f=Array(a).fill(void 0);for(let e=0;e<c;e++){let t=u[e];t&&(f[t.lane]=e)}for(let i=c;i<e;i++){let e,a,l=r(i),c=this.laneAssignments.get(i),d="estimate"===o||s.has(l);if(void 0!==c&&this.options.lanes>1){let r=f[e=c],i=void 0!==r?u[r]:void 0;a=i?i.end+this.options.gap:t+n}else{let r=1===this.options.lanes?u[i-1]:this.getFurthestMeasurement(u,i);a=r?r.end+this.options.gap:t+n,e=r?r.lane:i%this.options.lanes,this.options.lanes>1&&d&&this.laneAssignments.set(i,e)}let h=s.get(l),p="number"==typeof h?h:this.options.estimateSize(i),m=a+p;u[i]={index:i,start:a,size:p,end:m,key:l,lane:e},f[e]=i}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=GS(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?function({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:i}){let a=e.length-1,o=i?e=>i[2*e]:t=>e[t].start,l=i?e=>i[2*e]+i[2*e+1]:t=>e[t].end;if(e.length<=r)return{startIndex:0,endIndex:a};let s=GR(0,a,o,n),c=s;if(1===r)for(;c<a&&l(c)<n+t;)c++;else if(r>1){let i=Array(r).fill(0);for(;c<a&&i.some(e=>e<n+t);){let t=e[c];i[t.lane]=t.end,c++}let o=Array(r).fill(n+t);for(;s>=0&&o.some(e=>e>=n);){let t=e[s];o[t.lane]=t.start,s--}s=Math.max(0,s-s%r),c=Math.min(a,c+(r-1-c%r))}return{startIndex:s,endIndex:c}}({measurements:e,outerSize:t,scrollOffset:n,lanes:r,flat:1===r&&null!=this._flatMeasurements?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=GS(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>null===r||null===i?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{var t;if(!this.scrollState||"smooth"!==this.scrollState.behavior)return!0;let n=this.scrollState.index??(null==(t=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))?void 0:t.index);if(void 0!==n&&this.range){let t=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,n-t),i=Math.min(this.options.count-1,n+t);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e)return void this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{var n;let r,i,a;if(e<0||e>=this.options.count)return;let o=this._flatMeasurements;if(1===this.options.lanes&&null!==o)a=this.options.getItemKey(e),i=o[2*e],r=o[2*e+1];else{let t=this.measurementsCache[e];if(!t)return;a=t.key,i=t.start,r=t.size}let l=t-(this.itemSizeCache.get(a)??r);0!==l&&((null==(n=this.scrollState)?void 0:n.behavior)!=="smooth"&&(void 0!==this.shouldAdjustScrollPositionOnItemSizeChange?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:a,start:i,size:r,end:i+r,lane:0},l,this):i<this.getScrollOffset()+this.scrollAdjustments&&"backward"!==this.scrollDirection)&&(GN()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=l:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=l,behavior:void 0})),(null===this.pendingMin||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(a,t),this.itemSizeCacheVersion++,this.notify(!1))},this.getVirtualItems=GS(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(0===t.length)return;let n=this._flatMeasurements,r=1===this.options.lanes&&null!=n,i=GR(0,t.length-1,r?e=>n[2*e]:e=>GC(t[e]).start,e);return GC(t[i])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();return"auto"===t&&(t=e>=i+r?"end":"start"),"center"===t?e+=(n-r)/2:"end"===t&&(e-=r),Math.max(Math.min(this.getMaxScrollOffset(),e),0)},this.getOffsetForIndex=(e,t="auto")=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if("auto"===t)if(i.end>=r+n-this.options.scrollPaddingEnd)t="end";else{if(!(i.start<=r+this.options.scrollPaddingStart))return[r,t];t="start"}if("end"===t&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a="end"===t?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t="start",behavior:n="auto"}={})=>{let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t="auto",behavior:n="auto"}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t="auto"}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:"start",behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{var e;let t,n=this.getMeasurements();if(0===n.length)t=this.options.paddingStart;else if(1===this.options.lanes){let r=n.length-1,i=this._flatMeasurements;t=null!=i?i[2*r]+i[2*r+1]:(null==(e=n[r])?void 0:e.end)??0}else{let e=Array(this.options.lanes).fill(null),r=n.length-1;for(;r>=0&&e.some(e=>null===e);){let t=n[r];null===e[t.lane]&&(e[t.lane]=t.end),r--}t=Math.max(...e.filter(e=>null!==e))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(0===this.itemSizeCache.size)return e;for(let t of this.getMeasurements())t&&this.itemSizeCache.has(t.key)&&e.push({index:t.index,key:t.key,start:t.start,size:t.size,end:t.end,lane:t.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}null==this.rafId&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=null!=this.scrollState.index?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&1.01>Math.abs(t-this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r="smooth"===this.scrollState.behavior&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior="auto"),this._scrollToOffset(t,{adjustments:void 0,behavior:r?"smooth":"auto"})}this.scheduleScrollReconcile()}}let GR=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else{if(!(a>r))return i;t=i-1}}return e>0?e-1:0},GL="u">typeof document?ew.useLayoutEffect:ew.useEffect,G$=eN("arrow-down",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]),GF=eN("arrow-up-down",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]),GV={pathSeparator:"/",searchPlaceholder:"Filter rows...",rows:e=>`${e.toLocaleString()} rows`,columns:e=>`${e.toLocaleString()} columns`,selected:e=>`${e.toLocaleString()} selected`,copied:"Copied",copyCell:"Copy cell",noRows:"No rows match this view.",selectAllRows:"Select all visible rows",selectRow:e=>`Select row ${e+1}`,resizeColumn:"Resize column",sortAsc:"Sort ascending",sortDesc:"Sort descending",sortClear:"Clear sorting"};function GB(e,t){return"function"==typeof e?e(t):e}function GH(e){return null==e?"":"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):e instanceof Date?e.toISOString():JSON.stringify(e)}function GW(e){return"number"==typeof e?e:"boolean"==typeof e?+!!e:GH(e).toLowerCase()}function Gq({file:e={name:"data-table.csv",type:"records"},rows:t,data:n,columns:r,source:i,rowId:a,sorting:o,defaultSorting:l=[],onSortingChange:s,globalFilter:c,defaultGlobalFilter:d="",onGlobalFilterChange:u,rowSelection:f,defaultRowSelection:h={},onRowSelectionChange:p,columnSizing:m,defaultColumnSizing:g={},onColumnSizingChange:v,onCellCopy:x,showHeader:y=!0,showToolbar:b=!0,rowHeight:w=32,overscan:j=14,labels:k,className:S,headerClassName:C,toolbarClassName:N,gridClassName:M,...E}){let O=ew.useMemo(()=>({...GV,...k}),[k]),P=ew.useMemo(()=>{var e,t;let n;return(e=i)?"csv"===e.type?function(e,t=","){let n=function(e,t=","){let n=[],r="",i=[],a=!1;for(let o=0;o<e.length;o+=1){let l=e[o],s=e[o+1];if('"'===l){a&&'"'===s?(r+='"',o+=1):a=!a;continue}if(!a&&l===t){i.push(r),r="";continue}if(!a&&("\n"===l||"\r"===l)){"\r"===l&&"\n"===s&&(o+=1),i.push(r),n.push(i),i=[],r="";continue}r+=l}return i.push(r),i.some(e=>e.length>0)&&n.push(i),n}(e.trim(),t),r=n[0]?.map((e,t)=>e.trim()||`Column ${t+1}`)??[];return{rows:n.slice(1).map(e=>{let t={};return r.forEach((n,r)=>{t[n]=e[r]??""}),t}),columns:r.map(e=>({id:e,header:e,accessorKey:e,minWidth:96,width:Math.max(120,Math.min(260,12*e.length+80))}))}}(e.content,e.delimiter):Array.isArray(n="string"==typeof(t=e.content)?JSON.parse(t):t)?{rows:n,columns:void 0}:n&&"object"==typeof n?{rows:n.rows??n.data??[n],columns:n.columns}:{rows:[{value:n}],columns:void 0}:{rows:void 0,columns:void 0}},[i]),A=ew.useMemo(()=>n??t??P.rows??[],[n,t,P.rows]),z=ew.useMemo(()=>r??P.columns??function(e){let t=new Set;for(let n of e.slice(0,50))Object.keys(n).forEach(e=>t.add(e));return Array.from(t).map(e=>({id:e,header:e,accessorKey:e,minWidth:96,width:Math.max(120,Math.min(280,12*e.length+88))}))}(A),[r,P.columns,A]),[_,I]=ew.useState(l),[D,T]=ew.useState(d),[R,L]=ew.useState(h),[$,F]=ew.useState(g),[V,B]=ew.useState(void 0),[H,W]=ew.useState(void 0),q=ew.useRef(null),U=o??_,K=c??D,G=f??R,Y=m??$,X=function(e){let t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=ew.useState(()=>({current:function(e){var t,n;let r=[...Gj,...null!=(t=e._features)?t:[]],i={_features:r},a=i._features.reduce((e,t)=>Object.assign(e,null==t.getDefaultOptions?void 0:t.getDefaultOptions(i)),{}),o={...null!=(n=e.initialState)?n:{}};i._features.forEach(e=>{var t;o=null!=(t=null==e.getInitialState?void 0:e.getInitialState(o))?t:o});let l=[],s=!1,c={_features:r,options:{...a,...e},initialState:o,_queue:e=>{l.push(e),s||(s=!0,Promise.resolve().then(()=>{for(;l.length;)l.shift()();s=!1}).catch(e=>setTimeout(()=>{throw e})))},reset:()=>{i.setState(i.initialState)},setOptions:e=>{var t;t=KK(e,i.options),i.options=i.options.mergeOptions?i.options.mergeOptions(a,t):{...a,...t}},getState:()=>i.options.state,setState:e=>{null==i.options.onStateChange||i.options.onStateChange(e)},_getRowId:(e,t,n)=>{var r;return null!=(r=null==i.options.getRowId?void 0:i.options.getRowId(e,t,n))?r:`${n?[n.id,t].join("."):t}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(e,t)=>{let n=(t?i.getPrePaginationRowModel():i.getRowModel()).rowsById[e];if(!n&&!(n=i.getCoreRowModel().rowsById[e]))throw Error();return n},_getDefaultColumnDef:KX(()=>[i.options.defaultColumn],e=>{var t;return e=null!=(t=e)?t:{},{header:e=>{let t=e.header.column.columnDef;return t.accessorKey?t.accessorKey:t.accessorFn?t.id:null},cell:e=>{var t,n;return null!=(t=null==(n=e.renderValue())||null==n.toString?void 0:n.toString())?t:null},...i._features.reduce((e,t)=>Object.assign(e,null==t.getDefaultColumnDef?void 0:t.getDefaultColumnDef()),{}),...e}},KZ(e,"debugColumns","_getDefaultColumnDef")),_getColumnDefs:()=>i.options.columns,getAllColumns:KX(()=>[i._getColumnDefs()],e=>{let t=function(e,n,r){return void 0===r&&(r=0),e.map(e=>{let a=function(e,t,n,r){var i,a;let o,l={...e._getDefaultColumnDef(),...t},s=l.accessorKey,c=null!=(i=null!=(a=l.id)?a:s?"function"==typeof String.prototype.replaceAll?s.replaceAll(".","_"):s.replace(/\./g,"_"):void 0)?i:"string"==typeof l.header?l.header:void 0;if(l.accessorFn?o=l.accessorFn:s&&(o=s.includes(".")?e=>{let t=e;for(let e of s.split(".")){var n;t=null==(n=t)?void 0:n[e]}return t}:e=>e[l.accessorKey]),!c)throw Error();let d={id:`${String(c)}`,accessorFn:o,parent:r,depth:n,columnDef:l,columns:[],getFlatColumns:KX(()=>[!0],()=>{var e;return[d,...null==(e=d.columns)?void 0:e.flatMap(e=>e.getFlatColumns())]},KZ(e.options,"debugColumns","column.getFlatColumns")),getLeafColumns:KX(()=>[e._getOrderColumnsFn()],e=>{var t;return null!=(t=d.columns)&&t.length?e(d.columns.flatMap(e=>e.getLeafColumns())):[d]},KZ(e.options,"debugColumns","column.getLeafColumns"))};for(let t of e._features)null==t.createColumn||t.createColumn(d,e);return d}(i,e,r,n);return a.columns=e.columns?t(e.columns,a,r+1):[],a})};return t(e)},KZ(e,"debugColumns","getAllColumns")),getAllFlatColumns:KX(()=>[i.getAllColumns()],e=>e.flatMap(e=>e.getFlatColumns()),KZ(e,"debugColumns","getAllFlatColumns")),_getAllFlatColumnsById:KX(()=>[i.getAllFlatColumns()],e=>e.reduce((e,t)=>(e[t.id]=t,e),{}),KZ(e,"debugColumns","getAllFlatColumnsById")),getAllLeafColumns:KX(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(e,t)=>t(e.flatMap(e=>e.getLeafColumns())),KZ(e,"debugColumns","getAllLeafColumns")),getColumn:e=>i._getAllFlatColumnsById()[e]};Object.assign(i,c);for(let e=0;e<i._features.length;e++){let t=i._features[e];null==t||null==t.createTable||t.createTable(i)}return i}(t)})),[r,i]=ew.useState(()=>n.current.initialState);return n.current.setOptions(t=>({...t,...e,state:{...r,...e.state},onStateChange:t=>{i(t),null==e.onStateChange||e.onStateChange(t)}})),n.current}({data:A,columns:ew.useMemo(()=>z.map(e=>({id:e.id,accessorFn:(t,n)=>e.accessorFn?e.accessorFn(t,n):e.accessorKey?t[e.accessorKey]:void 0,header:()=>e.header,cell:t=>e.cell?e.cell({row:t.row.original,rowIndex:t.row.index,value:t.getValue(),column:e}):GH(t.getValue()),sortingFn:(e,t,n)=>{let r=GW(e.getValue(n)),i=GW(t.getValue(n));return"number"==typeof r&&"number"==typeof i?r-i:String(r).localeCompare(String(i),void 0,{numeric:!0})},enableSorting:e.enableSorting??!0,enableGlobalFilter:e.enableFiltering??!0,size:e.width??168,minSize:e.minWidth??80,maxSize:e.maxWidth??640,meta:{align:e.align,className:e.className,headerClassName:e.headerClassName,copyValue:e.copyValue,sourceColumn:e}})),[z]),state:{sorting:U,globalFilter:K,rowSelection:G,columnSizing:Y},defaultColumn:{minSize:80,size:168,maxSize:640},columnResizeMode:"onChange",enableRowSelection:!0,getRowId:"function"==typeof a?(e,t)=>a(e,t):a?(e,t)=>GH(e[a])||String(t):void 0,onSortingChange:e=>{let t=GB(e,U);void 0===o&&I(t),s?.(t)},onGlobalFilterChange:e=>{let t=GB(e,K);void 0===c&&T(t),u?.(t)},onRowSelectionChange:e=>{let t=GB(e,G);void 0===f&&L(t),p?.(t)},onColumnSizingChange:e=>{let t=GB(e,Y);void 0===m&&F(t),v?.(t)},globalFilterFn:(e,t,n)=>{let r=String(n??"").trim().toLowerCase();return!r||GH(e.getValue(t)).toLowerCase().includes(r)},getCoreRowModel:e=>KX(()=>[e.options.data],t=>{let n={rows:[],flatRows:[],rowsById:{}},r=function(t,i,a){void 0===i&&(i=0);let o=[];for(let s=0;s<t.length;s++){let c=K1(e,e._getRowId(t[s],s,a),t[s],s,i,void 0,null==a?void 0:a.id);if(n.flatRows.push(c),n.rowsById[c.id]=c,o.push(c),e.options.getSubRows){var l;c.originalSubRows=e.options.getSubRows(t[s],s),null!=(l=c.originalSubRows)&&l.length&&(c.subRows=r(c.originalSubRows,i+1,c))}}return o};return n.rows=r(t),n},KZ(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex())),getFilteredRowModel:e=>KX(()=>[e.getPreFilteredRowModel(),e.getState().columnFilters,e.getState().globalFilter],(t,n,r)=>{var i,a,o,l,s,c,d,u,f,h;let p,m,g,v,x,y,b,w,j,k;if(!t.rows.length||!(null!=n&&n.length)&&!r){for(let e=0;e<t.flatRows.length;e++)t.flatRows[e].columnFilters={},t.flatRows[e].columnFiltersMeta={};return t}let S=[],C=[];(null!=n?n:[]).forEach(t=>{var n;let r=e.getColumn(t.id);if(!r)return;let i=r.getFilterFn();i&&S.push({id:t.id,filterFn:i,resolvedValue:null!=(n=null==i.resolveFilterValue?void 0:i.resolveFilterValue(t.value))?n:t.value})});let N=(null!=n?n:[]).map(e=>e.id),M=e.getGlobalFilterFn(),E=e.getAllLeafColumns().filter(e=>e.getCanGlobalFilter());r&&M&&E.length&&(N.push("__global__"),E.forEach(e=>{var t;C.push({id:e.id,filterFn:M,resolvedValue:null!=(t=null==M.resolveFilterValue?void 0:M.resolveFilterValue(r))?t:r})}));for(let e=0;e<t.flatRows.length;e++){let n=t.flatRows[e];if(n.columnFilters={},S.length)for(let e=0;e<S.length;e++){let t=(p=S[e]).id;n.columnFilters[t]=p.filterFn(n,t,p.resolvedValue,e=>{n.columnFiltersMeta[t]=e})}if(C.length){for(let e=0;e<C.length;e++){let t=(m=C[e]).id;if(m.filterFn(n,t,m.resolvedValue,e=>{n.columnFiltersMeta[t]=e})){n.columnFilters.__global__=!0;break}}!0!==n.columnFilters.__global__&&(n.columnFilters.__global__=!1)}}return i=t.rows,a=e=>{for(let t=0;t<N.length;t++)if(!1===e.columnFilters[N[t]])return!1;return!0},e.options.filterFromLeafRows?(o=i,l=a,g=[],v={},x=null!=(c=(s=e).options.maxLeafRowFilterDepth)?c:100,{rows:(y=function(e,t){void 0===t&&(t=0);let n=[];for(let i=0;i<e.length;i++){var r;let a=e[i],o=K1(s,a.id,a.original,a.index,a.depth,void 0,a.parentId);if(o.columnFilters=a.columnFilters,null!=(r=a.subRows)&&r.length&&t<x){if(o.subRows=y(a.subRows,t+1),l(a=o)&&!o.subRows.length||l(a)||o.subRows.length){n.push(a),v[a.id]=a,g.push(a);continue}}else l(a=o)&&(n.push(a),v[a.id]=a,g.push(a))}return n})(o),flatRows:g,rowsById:v}):(d=i,u=a,b=[],w={},j=null!=(h=(f=e).options.maxLeafRowFilterDepth)?h:100,{rows:(k=function(e,t){void 0===t&&(t=0);let n=[];for(let i=0;i<e.length;i++){let a=e[i];if(u(a)){var r;if(null!=(r=a.subRows)&&r.length&&t<j){let e=K1(f,a.id,a.original,a.index,a.depth,void 0,a.parentId);e.subRows=k(a.subRows,t+1),a=e}n.push(a),b.push(a),w[a.id]=a}}return n})(d),flatRows:b,rowsById:w})},KZ(e.options,"debugTable","getFilteredRowModel",()=>e._autoResetPageIndex())),getSortedRowModel:e=>KX(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,n)=>{if(!n.rows.length||!(null!=t&&t.length))return n;let r=e.getState().sorting,i=[],a=r.filter(t=>{var n;return null==(n=e.getColumn(t.id))?void 0:n.getCanSort()}),o={};a.forEach(t=>{let n=e.getColumn(t.id);n&&(o[t.id]={sortUndefined:n.columnDef.sortUndefined,invertSorting:n.columnDef.invertSorting,sortingFn:n.getSortingFn()})});let l=e=>{let t=e.map(e=>({...e}));return t.sort((e,t)=>{for(let r=0;r<a.length;r+=1){var n;let i=a[r],l=o[i.id],s=l.sortUndefined,c=null!=(n=null==i?void 0:i.desc)&&n,d=0;if(s){let n=e.getValue(i.id),r=t.getValue(i.id),a=void 0===n,o=void 0===r;if(a||o){if("first"===s)return a?-1:1;if("last"===s)return a?1:-1;d=a&&o?0:a?s:-s}}if(0===d&&(d=l.sortingFn(e,t,i.id)),0!==d)return c&&(d*=-1),l.invertSorting&&(d*=-1),d}return e.index-t.index}),t.forEach(e=>{var t;i.push(e),null!=(t=e.subRows)&&t.length&&(e.subRows=l(e.subRows))}),t};return{rows:l(n.rows),flatRows:i,rowsById:n.rowsById}},KZ(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}),Z=X.getRowModel().rows,J=function({useFlushSync:e=!0,...t}){let n=ew.useReducer(e=>e+1,0)[1],r={...t,onChange:(r,i)=>{var a;e&&i?(0,t3.flushSync)(n):n(),null==(a=t.onChange)||a.call(t,r,i)}},[i]=ew.useState(()=>new GT(r));return i.setOptions(r),GL(()=>i._didMount(),[]),GL(()=>i._willUpdate()),i}({observeElementRect:GP,observeElementOffset:G_,scrollToFn:GD,...{count:Z.length,getScrollElement:()=>q.current,estimateSize:()=>w,overscan:j,scrollMargin:w}}),Q=X.getVisibleLeafColumns(),ee=Q.reduce((e,t)=>e+t.getSize(),40),et=`40px ${Q.map(e=>`${e.getSize()}px`).join(" ")}`,en=(e?.path??e?.name??"data-table").split(/[\\/]+/).filter(Boolean),er=X.getSelectedRowModel().rows.length;async function ei(e,t){let n=z.find(e=>e.id===t);if(!n)return;let r=e.getValue(t),i=n.copyValue?n.copyValue({row:e.original,rowIndex:e.index,value:r,column:n}):GH(r);await GU(i)&&(W({rowId:e.id,columnId:t}),x?.({row:e.original,rowIndex:e.index,columnId:t,value:r,text:i}),window.setTimeout(()=>{W(n=>n?.rowId===e.id&&n.columnId===t?void 0:n)},1200))}return(0,eb.jsxs)("div",{"data-slot":"data-table-tab-viewer",className:tK("vtl-surface-panel relative grid min-h-0 w-full min-w-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",y&&b?"grid-rows-[auto_auto_minmax(0,1fr)]":y||b?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",S),...E,children:[y&&(0,eb.jsxs)("div",{"data-slot":"data-table-tab-viewer-header",className:tK("flex min-h-9 min-w-0 items-center gap-2 border-b bg-muted/35 px-3 py-2",C),children:[(0,eb.jsx)("span",{className:"grid size-5 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:(0,eb.jsx)(FA,{className:"size-3.5"})}),(0,eb.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 ui-text-kbd",children:en.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[t>0&&(0,eb.jsx)("span",{className:"text-muted-foreground",children:O.pathSeparator}),(0,eb.jsx)("span",{className:tK("truncate",t<en.length-1?"text-muted-foreground":"text-foreground"),children:e})]},`${e}-${t}`))}),(0,eb.jsx)("span",{className:"shrink-0 text-muted-foreground ui-text-kbd",children:e.type??"records"})]}),b&&(0,eb.jsxs)("div",{"data-slot":"data-table-tab-viewer-toolbar",className:tK("flex min-h-10 min-w-0 items-center gap-2 border-b px-3 py-1.5",N),children:[(0,eb.jsxs)("div",{className:"relative min-w-36 flex-1 sm:max-w-80",children:[(0,eb.jsx)(cz,{className:"pointer-events-none absolute top-1/2 left-2.5 size-3.5 -translate-y-1/2 text-muted-foreground"}),(0,eb.jsx)(ny,{value:K,onChange:e=>X.setGlobalFilter(e.target.value),placeholder:O.searchPlaceholder,className:"h-7 rounded-md border-border bg-background pl-8 ui-text-control"})]}),(0,eb.jsxs)("div",{className:"flex shrink-0 items-center gap-2 text-muted-foreground ui-text-kbd",children:[(0,eb.jsx)("span",{children:O.rows(Z.length)}),(0,eb.jsx)("span",{className:"h-3 w-px bg-border"}),(0,eb.jsx)("span",{children:O.columns(z.length)}),er>0&&(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{className:"h-3 w-px bg-border"}),(0,eb.jsx)("span",{className:"text-foreground",children:O.selected(er)})]})]})]}),(0,eb.jsx)("div",{ref:q,"data-slot":"data-table-tab-viewer-grid",className:tK("min-h-0 min-w-0 overflow-auto bg-background","[scrollbar-color:var(--border)_transparent] [scrollbar-width:thin]","[&::-webkit-scrollbar]:size-2.5 [&::-webkit-scrollbar-corner]:bg-transparent [&::-webkit-scrollbar-track]:bg-transparent","[&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:border-[3px] [&::-webkit-scrollbar-thumb]:border-transparent [&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-thumb]:bg-clip-content",M),children:(0,eb.jsxs)("div",{className:"relative min-h-full",style:{width:ee,minWidth:"100%"},children:[(0,eb.jsxs)("div",{"data-slot":"data-table-tab-viewer-head",className:"sticky top-0 z-20 grid min-w-full border-b bg-muted/70 backdrop-blur",style:{gridTemplateColumns:et,width:ee,minWidth:"100%"},children:[(0,eb.jsx)("div",{className:"grid h-8 place-items-center border-r",children:(0,eb.jsx)(nx,{checked:!!X.getIsAllRowsSelected()||!!X.getIsSomeRowsSelected()&&"indeterminate",onCheckedChange:e=>X.toggleAllRowsSelected(!0===e),"aria-label":O.selectAllRows})}),X.getFlatHeaders().map(e=>{let t=e.column.columnDef.meta,n=e.column.getIsSorted();return(0,eb.jsxs)("div",{className:tK("group/header relative flex h-8 min-w-0 items-center border-r text-muted-foreground",t?.align==="right"&&"justify-end",t?.align==="center"&&"justify-center",t?.headerClassName),children:[(0,eb.jsxs)("button",{type:"button",disabled:!e.column.getCanSort(),"aria-label":`${GH(t?.sourceColumn.header??e.id)}: ${"asc"===n?O.sortDesc:"desc"===n?O.sortClear:O.sortAsc}`,onClick:e.column.getToggleSortingHandler(),className:tK("flex h-full min-w-0 flex-1 items-center gap-1.5 px-2 text-left ui-text-kbd",e.column.getCanSort()&&"text-foreground hover:bg-muted"),children:[(0,eb.jsx)("span",{className:"truncate",children:Gk(e.column.columnDef.header,e.getContext())}),"asc"===n?(0,eb.jsx)(q_,{className:"size-3 shrink-0"}):"desc"===n?(0,eb.jsx)(G$,{className:"size-3 shrink-0"}):e.column.getCanSort()?(0,eb.jsx)(GF,{className:"size-3 shrink-0 opacity-45"}):null]}),e.column.getCanResize()&&(0,eb.jsx)("button",{type:"button","aria-label":O.resizeColumn,onDoubleClick:()=>e.column.resetSize(),onMouseDown:e.getResizeHandler(),onTouchStart:e.getResizeHandler(),className:tK("absolute top-0 right-0 h-full w-2 translate-x-1/2 cursor-col-resize touch-none","after:absolute after:top-1 after:right-1/2 after:bottom-1 after:w-px after:bg-border","hover:after:bg-foreground",e.column.getIsResizing()&&"after:bg-foreground")})]},e.id)})]}),0===Z.length?(0,eb.jsx)("div",{className:"grid min-h-44 place-items-center text-muted-foreground ui-text-body",children:O.noRows}):(0,eb.jsx)("div",{"data-slot":"data-table-tab-viewer-rows",className:"relative",style:{height:J.getTotalSize()},children:J.getVirtualItems().map(e=>{let t=Z[e.index];return t?(0,eb.jsxs)("div",{"data-slot":"data-table-tab-viewer-row","data-state":t.getIsSelected()?"selected":void 0,className:tK("absolute left-0 grid min-w-full border-b transition-colors","hover:bg-muted/40 data-[state=selected]:bg-muted/65"),style:{gridTemplateColumns:et,width:ee,minWidth:"100%",height:e.size,transform:`translateY(${e.start-J.options.scrollMargin}px)`},children:[(0,eb.jsx)("div",{className:"grid place-items-center border-r",children:(0,eb.jsx)(nx,{checked:t.getIsSelected(),onCheckedChange:e=>t.toggleSelected(!0===e),"aria-label":O.selectRow(t.index)})}),t.getVisibleCells().map(e=>{let n=e.column.columnDef.meta,r=V?.rowId===t.id&&V.columnId===e.column.id,i=H?.rowId===t.id&&H.columnId===e.column.id;return(0,eb.jsxs)("button",{type:"button","data-slot":"data-table-tab-viewer-cell","data-active":r?"":void 0,onClick:()=>B({rowId:t.id,columnId:e.column.id}),onDoubleClick:()=>ei(t,e.column.id),className:tK("group/cell relative flex min-w-0 items-center border-r px-2 text-left ui-text-code","focus-visible:z-10 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/40 focus-visible:outline-none","data-active:bg-selection/10",n?.align==="right"&&"justify-end text-right",n?.align==="center"&&"justify-center text-center",n?.className),style:{height:w},children:[(0,eb.jsx)("span",{className:"min-w-0 truncate",children:Gk(e.column.columnDef.cell,e.getContext())}),(0,eb.jsx)("span",{className:tK("absolute top-1/2 right-1 grid size-5 -translate-y-1/2 place-items-center rounded-full border bg-background/95 text-muted-foreground opacity-0 shadow-xs transition-opacity","group-hover/cell:opacity-100",r&&"opacity-100"),title:O.copyCell,onClick:n=>{n.stopPropagation(),ei(t,e.column.id)},children:i?(0,eb.jsx)(nv,{className:"size-3"}):(0,eb.jsx)(s0,{className:"size-3"})})]},e.id)})]},t.id):null})})]})})]})}async function GU(e){try{return await navigator.clipboard?.writeText(e),!0}catch{var t=e;try{let e=document.createElement("textarea");e.value=t,e.setAttribute("readonly",""),e.style.position="fixed",e.style.left="-9999px",e.style.top="0",document.body.appendChild(e),e.select();let n=document.execCommand("copy");return document.body.removeChild(e),n}catch{return!1}}}let GK=eN("file-diff",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]),GG=eN("rows-2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]),GY={pathSeparator:"/",additions:"additions",deletions:"deletions",actions:"Diff view options",unified:"Unified diff",split:"Split diff",foldedLines:e=>`${e} folded lines`,expandDown:"Expand next lines",expandUp:"Expand previous lines",expandAll:"Expand folded lines",empty:"No diff content."};function GX(e){return void 0===e?"":String(e)}function GZ({line:e,language:t}){let n=ew.useMemo(()=>(function(e,t){if(!e)return[{text:" ",type:"plain"}];let n=RegExp(`("(?:(?:\\\\.)|[^"\\\\])*"|'(?:(?:\\\\.)|[^'\\\\])*'|\\\`(?:(?:\\\\.)|[^\\\`\\\\])*\\\`|//.*|${"css"===t?"\\b(?:align-items|background|border|className|color|display|font|gap|grid|height|justify-content|margin|padding|position|width)\\b":"\\b(?:as|async|await|const|export|false|from|function|if|import|in|let|new|null|return|string|true|type|undefined)\\b"}|\\b\\d+(?:\\.\\d+)?\\b|[{}()[\\].,;:<>/=+\\-*])`,"g"),r=[],i=0;for(let t of e.matchAll(n)){let n=t[0],a=t.index??0;a>i&&r.push({text:e.slice(i,a),type:"plain"}),n.startsWith("//")?r.push({text:n,type:"comment"}):/^["'`]/.test(n)?r.push({text:n,type:"string"}):/^\d/.test(n)?r.push({text:n,type:"number"}):/^[{}()[\].,;:<>/=+\-*]$/.test(n)?r.push({text:n,type:"punctuation"}):r.push({text:n,type:"keyword"}),i=a+n.length}return i<e.length&&r.push({text:e.slice(i),type:"plain"}),r})(e,t),[t,e]);return(0,eb.jsx)(eb.Fragment,{children:n.map((e,t)=>(0,eb.jsx)("span",{className:tK("comment"===e.type&&"text-[var(--vtl-diff-comment)] italic","keyword"===e.type&&"text-[var(--vtl-diff-keyword)]","string"===e.type&&"text-[var(--vtl-diff-string)]","number"===e.type&&"text-[var(--vtl-diff-number)]","punctuation"===e.type&&"text-[var(--vtl-diff-punctuation)]"),children:e.text},`${e.text}-${t}`))})}function GJ({row:e,language:t,side:n,blankType:r}){if(!e)return(0,eb.jsxs)("div",{className:tK("relative grid grid-cols-[2.5rem_minmax(0,1fr)] items-stretch overflow-hidden bg-[var(--vtl-diff-empty-bg)]","old"===n&&"border-r",r&&"bg-[image:var(--vtl-diff-empty-hatch)]"),children:[r&&(0,eb.jsx)("span",{className:tK("absolute inset-y-0 left-0 w-1","insert"===r&&"bg-[var(--vtl-diff-insert-fg)]","delete"===r&&"bg-[var(--vtl-diff-delete-fg)]")}),(0,eb.jsx)("span",{}),(0,eb.jsx)("span",{})]});let i="old"===n?"insert"===e.type?void 0:e.oldLineNumber:"delete"===e.type?void 0:e.newLineNumber;return(0,eb.jsxs)("div",{className:tK("relative grid grid-cols-[2.5rem_minmax(0,1fr)] items-stretch overflow-hidden","old"===n&&"border-r","insert"===e.type&&"bg-[var(--vtl-diff-insert-bg)]","delete"===e.type&&"bg-[var(--vtl-diff-delete-bg)]"),children:["context"!==e.type&&(0,eb.jsx)("span",{className:tK("absolute inset-y-0 left-0 w-1","insert"===e.type&&"bg-[var(--vtl-diff-insert-fg)]","delete"===e.type&&"bg-[var(--vtl-diff-delete-fg)]")}),(0,eb.jsx)("span",{className:tK("select-none bg-inherit px-2 text-right text-[var(--vtl-diff-gutter-fg)]","insert"===e.type&&"text-[var(--vtl-diff-insert-fg)]","delete"===e.type&&"text-[var(--vtl-diff-delete-fg)]"),children:GX(i)}),(0,eb.jsx)("span",{className:"overflow-hidden px-3 text-[var(--vtl-diff-code-fg)]",children:(0,eb.jsx)("span",{className:"inline-block whitespace-pre will-change-transform",style:{transform:"translateX(calc(var(--vtl-diff-scroll-left,0px) * -1))"},children:(0,eb.jsx)(GZ,{line:e.content,language:t})})})]})}function GQ({row:e,language:t,style:n,viewportWidth:r}){return(0,eb.jsx)("div",{"data-slot":"diff-tab-viewer-line","data-type":e.type,className:tK("absolute w-full min-w-full ui-text-code","insert"===e.type&&"bg-[var(--vtl-diff-insert-bg)]","delete"===e.type&&"bg-[var(--vtl-diff-delete-bg)]"),style:n,children:(0,eb.jsxs)("div",{className:"sticky left-0 grid h-full grid-cols-[2.5rem_minmax(0,1fr)] items-stretch",style:{width:r},children:["context"!==e.type&&(0,eb.jsx)("span",{className:tK("absolute inset-y-0 left-0 w-1","insert"===e.type&&"bg-[var(--vtl-diff-insert-fg)]","delete"===e.type&&"bg-[var(--vtl-diff-delete-fg)]")}),(0,eb.jsx)("span",{className:tK("select-none bg-inherit px-2 text-right text-[var(--vtl-diff-gutter-fg)]","insert"===e.type&&"text-[var(--vtl-diff-insert-fg)]","delete"===e.type&&"text-[var(--vtl-diff-delete-fg)]"),children:GX(e.newLineNumber)}),(0,eb.jsx)("span",{className:"overflow-hidden px-3 text-[var(--vtl-diff-code-fg)]",children:(0,eb.jsx)("span",{className:"inline-block whitespace-pre will-change-transform",style:{transform:"translateX(calc(var(--vtl-diff-scroll-left,0px) * -1))"},children:(0,eb.jsx)(GZ,{line:e.content,language:t})})})]})})}function G0({row:e,language:t,style:n,viewportWidth:r}){return(0,eb.jsx)("div",{"data-slot":"diff-tab-viewer-split-line",className:"absolute w-full min-w-full ui-text-code",style:n,children:(0,eb.jsxs)("div",{className:"sticky left-0 grid h-full grid-cols-[minmax(0,1fr)_minmax(0,1fr)] items-stretch",style:{width:r},children:[(0,eb.jsx)(GJ,{row:e.oldLine,language:t,side:"old",blankType:e.oldBlankType}),(0,eb.jsx)(GJ,{row:e.newLine,language:t,side:"new",blankType:e.newBlankType})]})})}function G1({row:e,labels:t,style:n,viewportWidth:r,onExpand:i}){let a="fold-count"===e.kind,o=(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{}),a?(0,eb.jsx)("div",{className:"flex h-full min-w-0 items-center justify-start px-3 text-muted-foreground",children:(0,eb.jsx)("span",{children:t.foldedLines(e.hiddenCount)})}):(0,eb.jsx)("button",{type:"button",className:"group flex h-full min-w-0 items-center gap-2 px-3 text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:bg-muted/70","aria-label":"down"===e.direction?t.expandDown:t.expandUp,onClick:()=>i(e.direction),children:(0,eb.jsxs)(eb.Fragment,{children:["down"===e.direction?(0,eb.jsx)(cE,{className:"size-3.5 shrink-0"}):(0,eb.jsx)(vl,{className:"size-3.5 shrink-0"}),(0,eb.jsx)("span",{className:"h-px min-w-8 flex-1 bg-border transition-colors group-hover:bg-foreground/35"})]})})]});return void 0!==r?(0,eb.jsx)("div",{"data-slot":`diff-tab-viewer-${e.kind}`,className:"absolute w-full min-w-full bg-muted/25 ui-text-code",style:n,children:(0,eb.jsx)("div",{className:"sticky left-0 grid h-full grid-cols-[2.5rem_minmax(0,1fr)] items-stretch",style:{width:r},children:o})}):(0,eb.jsx)("div",{"data-slot":`diff-tab-viewer-${e.kind}`,className:"absolute grid w-full min-w-full grid-cols-[2.5rem_minmax(0,1fr)] items-stretch bg-muted/25 ui-text-code",style:n,children:o})}function G2({open:e,labels:t,currentView:n,onOpenChange:r,onToggleView:i}){let a="unified"===n?t.split:t.unified;return(0,eb.jsx)("div",{"data-slot":"diff-tab-floating-actions",className:"absolute right-3 bottom-3 z-20",children:(0,eb.jsxs)("div",{className:"relative size-8",children:[(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":a,onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),i()},className:tK("absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur transition-[opacity,transform] duration-150 ease-out active:translate-y-0",e?"pointer-events-auto -translate-y-[42px] opacity-100":"pointer-events-none translate-y-1 opacity-0"),children:"unified"===n?(0,eb.jsx)(K_,{className:"size-4"}):(0,eb.jsx)(GG,{className:"size-4"})}),(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.actions,"aria-expanded":e,onClick:()=>r(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,eb.jsx)(s6,{className:tK("size-4 transition-transform",e&&"rotate-90")})})]})})}function G5({file:e,lines:t,diff:n,showHeader:r=!0,contextBefore:i=4,contextAfter:a=4,minFoldLines:o=18,expandStep:l=50,rowHeight:s=22,view:c,defaultView:d="unified",onViewChange:u,labels:f,className:h,headerClassName:p,viewerClassName:m,style:g,...v}){let x,y=ew.useMemo(()=>({...GY,...f}),[f]),b=ew.useMemo(()=>t??(n?function(e){let t=[],n=0,r=0,i=!1;for(let a of e.split("\n")){let e=/^@@\s+-(\d+)(?:,\d+)?\s+\+(\d+)(?:,\d+)?\s+@@/.exec(a);if(e){n=Number(e[1]),r=Number(e[2]),i=!0;continue}if(!i||a.startsWith("\\ No newline"))continue;let o=a[0],l=a.slice(1);if("+"===o){t.push({type:"insert",content:l,newLineNumber:r}),r+=1;continue}if("-"===o){t.push({type:"delete",content:l,oldLineNumber:n,newLineNumber:r}),n+=1;continue}t.push({type:"context",content:" "===o?l:a,oldLineNumber:n,newLineNumber:r}),n+=1,r+=1}return t}(n):[]),[n,t]),[w,j]=ew.useState({}),[k,S]=ew.useState(0),[C,N]=ew.useState(d),[M,E]=ew.useState(!1),O=ew.useRef(null),[P,A]=function(){let e=ew.useRef(null),[t,n]=ew.useState({height:0,width:0});return ew.useEffect(()=>{let t=e.current;if(!t)return;function r(){n({height:t.getBoundingClientRect().height,width:t.clientWidth})}r();let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[]),[e,t]}(),z=(x=/\.([^.\\/]+)$/.exec(e.name||e.path||""),(e.language??x?.[1]??"text").toLowerCase()),_=c??C,I=ew.useMemo(()=>b.reduce((e,t)=>({additions:e.additions+ +("insert"===t.type),deletions:e.deletions+ +("delete"===t.type),maxLineLength:Math.max(e.maxLineLength,t.content.length)}),{additions:0,deletions:0,maxLineLength:0}),[b]),D=ew.useMemo(()=>(function({rows:e,folds:t,contextBefore:n,contextAfter:r,minFoldLines:i}){let a=[],o=0;function l(e,t){a.push({kind:"line",id:`line-${t}-${e.type}`,line:e})}for(;o<e.length;){let s=e[o];if(s?.type!=="context"){s&&l(s,o),o+=1;continue}let c=o;for(;o<e.length&&e[o]?.type==="context";)o+=1;let d=o,u=d-c;if(u<=n+r+i){for(let t=c;t<d;t+=1)l(e[t],t);continue}let f=`${c}-${d}`,h=t[f]??{revealTop:0,revealBottom:0},p=Math.min(n+h.revealTop,u),m=Math.min(r+h.revealBottom,u-p),g=c+p,v=d-m,x=v-g;if(x<=0){for(let t=c;t<d;t+=1)l(e[t],t);continue}for(let t=c;t<g;t+=1)l(e[t],t);a.push({kind:"fold-action",id:`fold-${f}-down-${x}`,foldId:f,direction:"down",hiddenCount:x}),a.push({kind:"fold-count",id:`fold-${f}-count-${x}`,foldId:f,hiddenCount:x}),a.push({kind:"fold-action",id:`fold-${f}-up-${x}`,foldId:f,direction:"up",hiddenCount:x});for(let t=v;t<d;t+=1)l(e[t],t)}return a})({rows:b,folds:w,contextBefore:i,contextAfter:a,minFoldLines:o}),[a,i,w,o,b]),T=ew.useMemo(()=>(function(e){let t=[],n=0;for(;n<e.length;){let r=e[n];if(!r)break;if("line"!==r.kind){t.push(r),n+=1;continue}if("context"===r.line.type){t.push({kind:"split-line",id:`split-${r.id}`,oldLine:r.line,newLine:r.line}),n+=1;continue}let i=[];for(;e[n]?.kind==="line";){let t=e[n];if("context"===t.line.type)break;i.push(t.line),n+=1}let a=i.filter(e=>"delete"===e.type),o=i.filter(e=>"insert"===e.type),l=Math.max(a.length,o.length);for(let e=0;e<l;e+=1){let n=a[e],r=o[e];t.push({kind:"split-line",id:`split-change-${t.length}-${n?.oldLineNumber??"empty"}-${r?.newLineNumber??"empty"}`,oldLine:n,newLine:r,oldBlankType:n?void 0:"insert",newBlankType:r?void 0:"delete"})}}return t})(D),[D]),R="split"===_?T:D,L=(e.path??e.name).split(/[\\/]+/).filter(Boolean),$=R.length*s,F=Math.max(0,Math.floor(k/s)-12),V=Math.min(R.length,Math.ceil((k+A.height)/s)+12),B=R.slice(F,V),H=Math.max(A.width,1),W=9.6*I.maxLineLength+168,q=Math.max(760,W),U=Math.max(A.width,1),K=Math.max(U,U/2+W),G=`${e.path??e.name}-${n??""}-${t?.length??0}`;return ew.useEffect(()=>{j({}),S(0),E(!1)},[G]),ew.useEffect(()=>{if(M)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Node&&O.current?.contains(t)||E(!1)}},[M]),(0,eb.jsxs)("div",{ref:O,"data-slot":"diff-tab-viewer","data-view":_,className:tK("vtl-surface-panel relative grid min-h-0 w-full min-w-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",r?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",h),style:g,...v,children:[r&&(0,eb.jsxs)("div",{"data-slot":"diff-tab-viewer-header",className:tK("flex min-w-0 items-center gap-2 border-b bg-muted/35 px-3 py-2",p),children:[(0,eb.jsx)("span",{className:"grid size-5 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:(0,eb.jsx)(GK,{className:"size-3.5"})}),(0,eb.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 ui-text-kbd",children:L.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[t>0&&(0,eb.jsx)("span",{className:"text-muted-foreground",children:y.pathSeparator}),(0,eb.jsx)("span",{className:tK("truncate",t===L.length-1?"font-medium text-foreground":"text-muted-foreground"),children:e})]},`${e}-${t}`))}),(0,eb.jsxs)("div",{className:"hidden shrink-0 items-center gap-1.5 sm:flex",children:[(0,eb.jsxs)(cI,{variant:"outline",className:"text-[var(--vtl-diff-insert-fg)]",children:["+",I.additions," ",y.additions]}),(0,eb.jsxs)(cI,{variant:"outline",className:"text-[var(--vtl-diff-delete-fg)]",children:["-",I.deletions," ",y.deletions]})]})]}),0===b.length?(0,eb.jsx)("div",{className:"grid min-h-0 place-items-center p-6 text-muted-foreground ui-text-body",children:y.empty}):(0,eb.jsx)("div",{ref:P,"data-slot":"diff-tab-viewer-body",className:tK("min-h-0 min-w-0 overflow-auto bg-background font-mono","[scrollbar-color:var(--border)_transparent] [scrollbar-width:thin]","[&::-webkit-scrollbar]:size-2.5 [&::-webkit-scrollbar-corner]:bg-transparent [&::-webkit-scrollbar-track]:bg-transparent","[&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:border-[3px] [&::-webkit-scrollbar-thumb]:border-transparent [&::-webkit-scrollbar-thumb]:bg-border [&::-webkit-scrollbar-thumb]:bg-clip-content",m),style:{"--vtl-diff-scroll-left":"0px"},onScroll:e=>{S(e.currentTarget.scrollTop),e.currentTarget.style.setProperty("--vtl-diff-scroll-left",`${e.currentTarget.scrollLeft}px`)},children:(0,eb.jsx)("div",{"data-slot":"diff-tab-viewer-scroll-width",className:"relative min-h-full",style:{height:$,width:"split"===_?K:q,minWidth:"100%"},children:B.map((e,t)=>{let n=F+t,r={height:s,lineHeight:`${s}px`,transform:`translateY(${n*s}px)`};return"line"===e.kind?(0,eb.jsx)(GQ,{row:e.line,language:z,style:r,viewportWidth:H},e.id):"split-line"===e.kind?(0,eb.jsx)(G0,{row:e,language:z,style:r,viewportWidth:U},e.id):(0,eb.jsx)(G1,{row:e,labels:y,style:r,viewportWidth:"split"===_?U:void 0,onExpand:t=>{var n;return n=e.foldId,void j(e=>{let r=e[n]??{revealTop:0,revealBottom:0};return"all"===t?{...e,[n]:{revealTop:Number.MAX_SAFE_INTEGER,revealBottom:0}}:{...e,[n]:{revealTop:"down"===t?r.revealTop+l:r.revealTop,revealBottom:"up"===t?r.revealBottom+l:r.revealBottom}}})}},e.id)})})}),(0,eb.jsx)(G2,{open:M,labels:y,currentView:_,onOpenChange:E,onToggleView:function(){var e;e="unified"===_?"split":"unified",void 0===c&&N(e),u?.(e)}})]})}var G4=e.i(32800);function G3(e){return new G4.LanguageSupport(G4.StreamLanguage.define(e))}function G6(t){return e.A(22206).then(e=>e.sql({dialect:e[t]}))}let G8=[G4.LanguageDescription.of({name:"C",extensions:["c","h","ino"],load:()=>e.A(92137).then(e=>e.cpp())}),G4.LanguageDescription.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load:()=>e.A(92137).then(e=>e.cpp())}),G4.LanguageDescription.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load:()=>G6("Cassandra")}),G4.LanguageDescription.of({name:"CSS",extensions:["css"],load:()=>e.A(79258).then(e=>e.css())}),G4.LanguageDescription.of({name:"Go",extensions:["go"],load:()=>e.A(44771).then(e=>e.go())}),G4.LanguageDescription.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load:()=>e.A(82412).then(e=>e.html())}),G4.LanguageDescription.of({name:"Java",extensions:["java"],load:()=>e.A(35733).then(e=>e.java())}),G4.LanguageDescription.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load:()=>e.A(56714).then(e=>e.javascript())}),G4.LanguageDescription.of({name:"Jinja",extensions:["j2","jinja","jinja2"],load:()=>e.A(68909).then(e=>e.jinja())}),G4.LanguageDescription.of({name:"JSON",alias:["json5"],extensions:["json","map"],load:()=>e.A(42017).then(e=>e.json())}),G4.LanguageDescription.of({name:"JSX",extensions:["jsx"],load:()=>e.A(56714).then(e=>e.javascript({jsx:!0}))}),G4.LanguageDescription.of({name:"LESS",extensions:["less"],load:()=>e.A(23404).then(e=>e.less())}),G4.LanguageDescription.of({name:"Liquid",extensions:["liquid"],load:()=>e.A(20628).then(e=>e.liquid())}),G4.LanguageDescription.of({name:"MariaDB SQL",load:()=>G6("MariaSQL")}),G4.LanguageDescription.of({name:"Markdown",extensions:["md","markdown","mkd"],load:()=>e.A(80207).then(e=>e.markdown())}),G4.LanguageDescription.of({name:"MS SQL",load:()=>G6("MSSQL")}),G4.LanguageDescription.of({name:"MySQL",load:()=>G6("MySQL")}),G4.LanguageDescription.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load:()=>e.A(50333).then(e=>e.php())}),G4.LanguageDescription.of({name:"PLSQL",extensions:["pls"],load:()=>G6("PLSQL")}),G4.LanguageDescription.of({name:"PostgreSQL",load:()=>G6("PostgreSQL")}),G4.LanguageDescription.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load:()=>e.A(43848).then(e=>e.python())}),G4.LanguageDescription.of({name:"Rust",extensions:["rs"],load:()=>e.A(22094).then(e=>e.rust())}),G4.LanguageDescription.of({name:"Sass",extensions:["sass"],load:()=>e.A(62363).then(e=>e.sass({indented:!0}))}),G4.LanguageDescription.of({name:"SCSS",extensions:["scss"],load:()=>e.A(62363).then(e=>e.sass())}),G4.LanguageDescription.of({name:"SQL",extensions:["sql"],load:()=>G6("StandardSQL")}),G4.LanguageDescription.of({name:"SQLite",load:()=>G6("SQLite")}),G4.LanguageDescription.of({name:"TSX",extensions:["tsx"],load:()=>e.A(56714).then(e=>e.javascript({jsx:!0,typescript:!0}))}),G4.LanguageDescription.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load:()=>e.A(56714).then(e=>e.javascript({typescript:!0}))}),G4.LanguageDescription.of({name:"WebAssembly",extensions:["wat","wast"],load:()=>e.A(11043).then(e=>e.wast())}),G4.LanguageDescription.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load:()=>e.A(25290).then(e=>e.xml())}),G4.LanguageDescription.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load:()=>e.A(66027).then(e=>e.yaml())}),G4.LanguageDescription.of({name:"APL",extensions:["dyalog","apl"],load:()=>e.A(66919).then(e=>G3(e.apl))}),G4.LanguageDescription.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load:()=>e.A(96245).then(e=>G3(e.asciiArmor))}),G4.LanguageDescription.of({name:"ASN.1",extensions:["asn","asn1"],load:()=>e.A(95592).then(e=>G3(e.asn1({})))}),G4.LanguageDescription.of({name:"Asterisk",filename:/^extensions\.conf$/i,load:()=>e.A(38120).then(e=>G3(e.asterisk))}),G4.LanguageDescription.of({name:"Brainfuck",extensions:["b","bf"],load:()=>e.A(33855).then(e=>G3(e.brainfuck))}),G4.LanguageDescription.of({name:"Cobol",extensions:["cob","cpy"],load:()=>e.A(37413).then(e=>G3(e.cobol))}),G4.LanguageDescription.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load:()=>e.A(38138).then(e=>G3(e.csharp))}),G4.LanguageDescription.of({name:"Clojure",extensions:["clj","cljc","cljx"],load:()=>e.A(32566).then(e=>G3(e.clojure))}),G4.LanguageDescription.of({name:"ClojureScript",extensions:["cljs"],load:()=>e.A(32566).then(e=>G3(e.clojure))}),G4.LanguageDescription.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load:()=>e.A(48876).then(e=>G3(e.gss))}),G4.LanguageDescription.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load:()=>e.A(44086).then(e=>G3(e.cmake))}),G4.LanguageDescription.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load:()=>e.A(11973).then(e=>G3(e.coffeeScript))}),G4.LanguageDescription.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load:()=>e.A(16995).then(e=>G3(e.commonLisp))}),G4.LanguageDescription.of({name:"Cypher",extensions:["cyp","cypher"],load:()=>e.A(45748).then(e=>G3(e.cypher))}),G4.LanguageDescription.of({name:"Cython",extensions:["pyx","pxd","pxi"],load:()=>e.A(64832).then(e=>G3(e.cython))}),G4.LanguageDescription.of({name:"Crystal",extensions:["cr"],load:()=>e.A(55133).then(e=>G3(e.crystal))}),G4.LanguageDescription.of({name:"D",extensions:["d"],load:()=>e.A(24299).then(e=>G3(e.d))}),G4.LanguageDescription.of({name:"Dart",extensions:["dart"],load:()=>e.A(38138).then(e=>G3(e.dart))}),G4.LanguageDescription.of({name:"diff",extensions:["diff","patch"],load:()=>e.A(85978).then(e=>G3(e.diff))}),G4.LanguageDescription.of({name:"Dockerfile",filename:/^Dockerfile$/,load:()=>e.A(89654).then(e=>G3(e.dockerFile))}),G4.LanguageDescription.of({name:"DTD",extensions:["dtd"],load:()=>e.A(77925).then(e=>G3(e.dtd))}),G4.LanguageDescription.of({name:"Dylan",extensions:["dylan","dyl","intr"],load:()=>e.A(27553).then(e=>G3(e.dylan))}),G4.LanguageDescription.of({name:"EBNF",load:()=>e.A(6232).then(e=>G3(e.ebnf))}),G4.LanguageDescription.of({name:"ECL",extensions:["ecl"],load:()=>e.A(11956).then(e=>G3(e.ecl))}),G4.LanguageDescription.of({name:"edn",extensions:["edn"],load:()=>e.A(32566).then(e=>G3(e.clojure))}),G4.LanguageDescription.of({name:"Eiffel",extensions:["e"],load:()=>e.A(25267).then(e=>G3(e.eiffel))}),G4.LanguageDescription.of({name:"Elm",extensions:["elm"],load:()=>e.A(6956).then(e=>G3(e.elm))}),G4.LanguageDescription.of({name:"Erlang",extensions:["erl"],load:()=>e.A(2095).then(e=>G3(e.erlang))}),G4.LanguageDescription.of({name:"Esper",load:()=>e.A(45412).then(e=>G3(e.esper))}),G4.LanguageDescription.of({name:"Factor",extensions:["factor"],load:()=>e.A(2075).then(e=>G3(e.factor))}),G4.LanguageDescription.of({name:"FCL",load:()=>e.A(68091).then(e=>G3(e.fcl))}),G4.LanguageDescription.of({name:"Forth",extensions:["forth","fth","4th"],load:()=>e.A(54669).then(e=>G3(e.forth))}),G4.LanguageDescription.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load:()=>e.A(76946).then(e=>G3(e.fortran))}),G4.LanguageDescription.of({name:"F#",alias:["fsharp"],extensions:["fs"],load:()=>e.A(36855).then(e=>G3(e.fSharp))}),G4.LanguageDescription.of({name:"Gas",extensions:["s"],load:()=>e.A(40367).then(e=>G3(e.gas))}),G4.LanguageDescription.of({name:"Gherkin",extensions:["feature"],load:()=>e.A(23161).then(e=>G3(e.gherkin))}),G4.LanguageDescription.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load:()=>e.A(97713).then(e=>G3(e.groovy))}),G4.LanguageDescription.of({name:"Haskell",extensions:["hs"],load:()=>e.A(56334).then(e=>G3(e.haskell))}),G4.LanguageDescription.of({name:"Haxe",extensions:["hx"],load:()=>e.A(70963).then(e=>G3(e.haxe))}),G4.LanguageDescription.of({name:"HXML",extensions:["hxml"],load:()=>e.A(70963).then(e=>G3(e.hxml))}),G4.LanguageDescription.of({name:"HTTP",load:()=>e.A(35064).then(e=>G3(e.http))}),G4.LanguageDescription.of({name:"IDL",extensions:["pro"],load:()=>e.A(89381).then(e=>G3(e.idl))}),G4.LanguageDescription.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load:()=>e.A(59695).then(e=>G3(e.jsonld))}),G4.LanguageDescription.of({name:"Julia",extensions:["jl"],load:()=>e.A(64014).then(e=>G3(e.julia))}),G4.LanguageDescription.of({name:"Kotlin",extensions:["kt","kts"],load:()=>e.A(38138).then(e=>G3(e.kotlin))}),G4.LanguageDescription.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load:()=>e.A(42765).then(e=>G3(e.liveScript))}),G4.LanguageDescription.of({name:"Lua",extensions:["lua"],load:()=>e.A(97328).then(e=>G3(e.lua))}),G4.LanguageDescription.of({name:"mIRC",extensions:["mrc"],load:()=>e.A(34747).then(e=>G3(e.mirc))}),G4.LanguageDescription.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load:()=>e.A(15637).then(e=>G3(e.mathematica))}),G4.LanguageDescription.of({name:"Modelica",extensions:["mo"],load:()=>e.A(4877).then(e=>G3(e.modelica))}),G4.LanguageDescription.of({name:"MUMPS",extensions:["mps"],load:()=>e.A(51221).then(e=>G3(e.mumps))}),G4.LanguageDescription.of({name:"Mbox",extensions:["mbox"],load:()=>e.A(64186).then(e=>G3(e.mbox))}),G4.LanguageDescription.of({name:"Nginx",filename:/nginx.*\.conf$/i,load:()=>e.A(84274).then(e=>G3(e.nginx))}),G4.LanguageDescription.of({name:"NSIS",extensions:["nsh","nsi"],load:()=>e.A(51971).then(e=>G3(e.nsis))}),G4.LanguageDescription.of({name:"NTriples",extensions:["nt","nq"],load:()=>e.A(42967).then(e=>G3(e.ntriples))}),G4.LanguageDescription.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load:()=>e.A(38138).then(e=>G3(e.objectiveC))}),G4.LanguageDescription.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load:()=>e.A(38138).then(e=>G3(e.objectiveCpp))}),G4.LanguageDescription.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load:()=>e.A(36855).then(e=>G3(e.oCaml))}),G4.LanguageDescription.of({name:"Octave",extensions:["m"],load:()=>e.A(22492).then(e=>G3(e.octave))}),G4.LanguageDescription.of({name:"Oz",extensions:["oz"],load:()=>e.A(73945).then(e=>G3(e.oz))}),G4.LanguageDescription.of({name:"Pascal",extensions:["p","pas"],load:()=>e.A(2372).then(e=>G3(e.pascal))}),G4.LanguageDescription.of({name:"Perl",extensions:["pl","pm"],load:()=>e.A(44660).then(e=>G3(e.perl))}),G4.LanguageDescription.of({name:"Pig",extensions:["pig"],load:()=>e.A(28734).then(e=>G3(e.pig))}),G4.LanguageDescription.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load:()=>e.A(36584).then(e=>G3(e.powerShell))}),G4.LanguageDescription.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load:()=>e.A(97145).then(e=>G3(e.properties))}),G4.LanguageDescription.of({name:"ProtoBuf",extensions:["proto"],load:()=>e.A(86304).then(e=>G3(e.protobuf))}),G4.LanguageDescription.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load:()=>e.A(86501).then(e=>G3(e.pug))}),G4.LanguageDescription.of({name:"Puppet",extensions:["pp"],load:()=>e.A(16397).then(e=>G3(e.puppet))}),G4.LanguageDescription.of({name:"Q",extensions:["q"],load:()=>e.A(71617).then(e=>G3(e.q))}),G4.LanguageDescription.of({name:"R",alias:["rscript"],extensions:["r","R"],load:()=>e.A(62905).then(e=>G3(e.r))}),G4.LanguageDescription.of({name:"RPM Changes",load:()=>e.A(31053).then(e=>G3(e.rpmChanges))}),G4.LanguageDescription.of({name:"RPM Spec",extensions:["spec"],load:()=>e.A(31053).then(e=>G3(e.rpmSpec))}),G4.LanguageDescription.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load:()=>e.A(84403).then(e=>G3(e.ruby))}),G4.LanguageDescription.of({name:"SAS",extensions:["sas"],load:()=>e.A(57388).then(e=>G3(e.sas))}),G4.LanguageDescription.of({name:"Scala",extensions:["scala"],load:()=>e.A(38138).then(e=>G3(e.scala))}),G4.LanguageDescription.of({name:"Scheme",extensions:["scm","ss"],load:()=>e.A(94780).then(e=>G3(e.scheme))}),G4.LanguageDescription.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load:()=>e.A(8240).then(e=>G3(e.shell))}),G4.LanguageDescription.of({name:"Sieve",extensions:["siv","sieve"],load:()=>e.A(46740).then(e=>G3(e.sieve))}),G4.LanguageDescription.of({name:"Smalltalk",extensions:["st"],load:()=>e.A(48213).then(e=>G3(e.smalltalk))}),G4.LanguageDescription.of({name:"Solr",load:()=>e.A(47982).then(e=>G3(e.solr))}),G4.LanguageDescription.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load:()=>e.A(36855).then(e=>G3(e.sml))}),G4.LanguageDescription.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load:()=>e.A(85501).then(e=>G3(e.sparql))}),G4.LanguageDescription.of({name:"Spreadsheet",alias:["excel","formula"],load:()=>e.A(44878).then(e=>G3(e.spreadsheet))}),G4.LanguageDescription.of({name:"Squirrel",extensions:["nut"],load:()=>e.A(38138).then(e=>G3(e.squirrel))}),G4.LanguageDescription.of({name:"Stylus",extensions:["styl"],load:()=>e.A(76475).then(e=>G3(e.stylus))}),G4.LanguageDescription.of({name:"Swift",extensions:["swift"],load:()=>e.A(8835).then(e=>G3(e.swift))}),G4.LanguageDescription.of({name:"sTeX",load:()=>e.A(42690).then(e=>G3(e.stex))}),G4.LanguageDescription.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load:()=>e.A(42690).then(e=>G3(e.stex))}),G4.LanguageDescription.of({name:"SystemVerilog",extensions:["v","sv","svh"],load:()=>e.A(78077).then(e=>G3(e.verilog))}),G4.LanguageDescription.of({name:"Tcl",extensions:["tcl"],load:()=>e.A(139).then(e=>G3(e.tcl))}),G4.LanguageDescription.of({name:"Textile",extensions:["textile"],load:()=>e.A(75208).then(e=>G3(e.textile))}),G4.LanguageDescription.of({name:"TiddlyWiki",load:()=>e.A(44524).then(e=>G3(e.tiddlyWiki))}),G4.LanguageDescription.of({name:"Tiki wiki",load:()=>e.A(38168).then(e=>G3(e.tiki))}),G4.LanguageDescription.of({name:"TOML",extensions:["toml"],load:()=>e.A(40346).then(e=>G3(e.toml))}),G4.LanguageDescription.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load:()=>e.A(13368).then(e=>G3(e.troff))}),G4.LanguageDescription.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load:()=>e.A(49796).then(e=>G3(e.ttcn))}),G4.LanguageDescription.of({name:"TTCN_CFG",extensions:["cfg"],load:()=>e.A(80429).then(e=>G3(e.ttcnCfg))}),G4.LanguageDescription.of({name:"Turtle",extensions:["ttl"],load:()=>e.A(98657).then(e=>G3(e.turtle))}),G4.LanguageDescription.of({name:"Web IDL",extensions:["webidl"],load:()=>e.A(86672).then(e=>G3(e.webIDL))}),G4.LanguageDescription.of({name:"VB.NET",extensions:["vb"],load:()=>e.A(39480).then(e=>G3(e.vb))}),G4.LanguageDescription.of({name:"VBScript",extensions:["vbs"],load:()=>e.A(77625).then(e=>G3(e.vbScript))}),G4.LanguageDescription.of({name:"Velocity",extensions:["vtl"],load:()=>e.A(42762).then(e=>G3(e.velocity))}),G4.LanguageDescription.of({name:"Verilog",extensions:["v"],load:()=>e.A(78077).then(e=>G3(e.verilog))}),G4.LanguageDescription.of({name:"VHDL",extensions:["vhd","vhdl"],load:()=>e.A(24973).then(e=>G3(e.vhdl))}),G4.LanguageDescription.of({name:"XQuery",extensions:["xy","xquery","xq","xqm","xqy"],load:()=>e.A(50321).then(e=>G3(e.xQuery))}),G4.LanguageDescription.of({name:"Yacas",extensions:["ys"],load:()=>e.A(79514).then(e=>G3(e.yacas))}),G4.LanguageDescription.of({name:"Z80",extensions:["z80"],load:()=>e.A(91533).then(e=>G3(e.z80))}),G4.LanguageDescription.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load:()=>e.A(20878).then(e=>G3(e.mscgen))}),G4.LanguageDescription.of({name:"Xù",extensions:["xu"],load:()=>e.A(20878).then(e=>G3(e.xu))}),G4.LanguageDescription.of({name:"MsGenny",extensions:["msgenny"],load:()=>e.A(20878).then(e=>G3(e.msgenny))}),G4.LanguageDescription.of({name:"Vue",extensions:["vue"],load:()=>e.A(99646).then(e=>e.vue())}),G4.LanguageDescription.of({name:"Angular Template",load:()=>e.A(29423).then(e=>e.angular())})];var G7=e.i(68113),G9=e.i(2262),Ye=e.i(17300);function Yt(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return!!i&&(r(n.update(i)),!0)}}let Yn=Yt(function(e,t,n=t.selection.ranges){let r=[],i=-1;t:for(let{from:e,to:a}of n){let n=r.length,o=1e9,l;for(let n=e;n<=a;){let s=t.doc.lineAt(n);if(void 0==l&&!(l=Ya(t,s.from).line))continue t;if(s.from>i&&(e==a||a>s.from)){i=s.from;let e=/^\s*/.exec(s.text)[0].length,t=e==s.length,n=s.text.slice(e,e+l.length)==l?e:-1;e<s.text.length&&e<o&&(o=e),r.push({line:s,comment:n,token:l,indent:e,empty:t,single:!1})}n=s.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(2!=e&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;" "==t.text[a-t.from]&&a++,e.push({from:r,to:a})}return{changes:e}}return null},0),Yr=Yt(Yo,0),Yi=Yt((e,t)=>Yo(e,t,function(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}(t)),0);function Ya(e,t){let n=e.languageDataAt("commentTokens",t,1);return n.length?n[0]:{}}function Yo(e,t,n=t.selection.ranges){let r=n.map(e=>Ya(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>(function(e,{open:t,close:n},r,i){let a,o,l=e.sliceDoc(r-50,r),s=e.sliceDoc(i,i+50),c=/\s*$/.exec(l)[0].length,d=/^\s*/.exec(s)[0].length,u=l.length-c;if(l.slice(u-t.length,u)==t&&s.slice(d,d+n.length)==n)return{open:{pos:r-c,margin:c&&1},close:{pos:i+d,margin:d&&1}};i-r<=100?a=o=e.sliceDoc(r,i):(a=e.sliceDoc(r,r+50),o=e.sliceDoc(i-50,i));let f=/^\s*/.exec(a)[0].length,h=/\s*$/.exec(o)[0].length,p=o.length-h-n.length;return a.slice(f,f+t.length)==t&&o.slice(p,p+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(a.charAt(f+t.length))},close:{pos:i-h-n.length,margin:+!!/\s/.test(o.charAt(p-1))}}:null})(t,r[n],e.from,e.to));if(2!=e&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}]))};if(1!=e&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}let Yl=G7.Annotation.define(),Ys=G7.Annotation.define(),Yc=G7.Facet.define(),Yd=G7.Facet.define({combine:e=>(0,G7.combineConfig)(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}),Yu=G7.StateField.define({create:()=>YS.empty,update(e,t){let n=t.state.facet(Yd),r=t.annotation(Yl);if(r){let i=Yv.fromTransaction(t,r.selection),a=r.side,o=0==a?e.undone:e.done;return o=i?Yx(o,o.length,n.minDepth,i):Yw(o,t.startState.selection),new YS(0==a?r.rest:o,0==a?o:r.rest)}let i=t.annotation(Ys);if(("full"==i||"before"==i)&&(e=e.isolate()),!1===t.annotation(G7.Transaction.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let a=Yv.fromTransaction(t),o=t.annotation(G7.Transaction.time),l=t.annotation(G7.Transaction.userEvent);return a?e=e.addChanges(a,o,l,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,l,n.newGroupDelay)),("full"==i||"after"==i)&&(e=e.isolate()),e},toJSON:e=>({done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}),fromJSON:e=>new YS(e.done.map(Yv.fromJSON),e.undone.map(Yv.fromJSON))});function Yf(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(Yu,!1);if(!i)return!1;let a=i.pop(e,n,t);return!!a&&(r(a),!0)}}let Yh=Yf(0,!1),Yp=Yf(1,!1),Ym=Yf(0,!0),Yg=Yf(1,!0);class Yv{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(e){return new Yv(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null==(e=this.changes)?void 0:e.toJSON(),mapped:null==(t=this.mapped)?void 0:t.toJSON(),startSelection:null==(n=this.startSelection)?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(e){return new Yv(e.changes&&G7.ChangeSet.fromJSON(e.changes),[],e.mapped&&G7.ChangeDesc.fromJSON(e.mapped),e.startSelection&&G7.EditorSelection.fromJSON(e.startSelection),e.selectionsAfter.map(G7.EditorSelection.fromJSON))}static fromTransaction(e,t){let n=Yb;for(let t of e.startState.facet(Yc)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new Yv(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Yb)}static selection(e){return new Yv(void 0,Yb,void 0,void 0,e)}}function Yx(e,t,n,r){let i=e.slice(t+1>n+20?t-n-1:0,t);return i.push(r),i}function Yy(e,t){return e.length?t.length?e.concat(t):e:t}let Yb=[];function Yw(e,t){if(!e.length)return[Yv.selection([t])];{let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),Yx(e,e.length-1,1e9,n.setSelAfter(r)))}}function Yj(e,t){if(!e.length)return e;let n=e.length,r=Yb;for(;n;){let i=function(e,t,n){let r=Yy(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):Yb,n);if(!e.changes)return Yv.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new Yv(i,G7.StateEffect.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[Yv.selection(r)]:Yb}let Yk=/^(input\.type|delete)($|\.)/;class YS{constructor(e,t,n=0,r){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new YS(this.done,this.undone):this}addChanges(e,t,n,r,i){var a,o;let l,s,c=this.done,d=c[c.length-1];return new YS(c=d&&d.changes&&!d.changes.empty&&e.changes&&(!n||Yk.test(n))&&(!d.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(i,(a=d.changes,o=e.changes,l=[],s=!1,a.iterChangedRanges((e,t)=>l.push(e,t)),o.iterChangedRanges((e,t,n,r)=>{for(let e=0;e<l.length;){let t=l[e++],i=l[e++];r>=t&&n<=i&&(s=!0)}}),s))||"input.type.compose"==n)?Yx(c,c.length-1,r.minDepth,new Yv(e.changes.compose(d.changes),Yy(G7.StateEffect.mapEffects(e.effects,d.changes),d.effects),d.mapped,d.startSelection,Yb)):Yx(c,c.length,r.minDepth,e),Yb,t,n)}addSelection(e,t,n,r){var i;let a=this.done.length?this.done[this.done.length-1].selectionsAfter:Yb;return a.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&(i=a[a.length-1],i.ranges.length==e.ranges.length&&0===i.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length)?this:new YS(Yw(this.done,e),this.undone,t,n)}addMapping(e){return new YS(Yj(this.done,e),Yj(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=0==e?this.done:this.undone;if(0==r.length)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length){let n,o;return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:Yl.of({side:e,rest:(n=r[r.length-1],(o=r.slice())[r.length-1]=n.setSelAfter(n.selectionsAfter.slice(0,n.selectionsAfter.length-1)),o),selection:a}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0})}{if(!i.changes)return null;let n=1==r.length?Yb:r.slice(0,r.length-1);return i.mapped&&(n=Yj(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Yl.of({side:e,rest:n,selection:a}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}}}YS.empty=new YS(Yb,Yb);function YC(e,t){return G7.EditorSelection.create(e.ranges.map(t),e.mainIndex)}function YN(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function YM({state:e,dispatch:t},n){let r=YC(e.selection,n);return!r.eq(e.selection,!0)&&(t(YN(e,r)),!0)}function YE(e,t){return G7.EditorSelection.cursor(t?e.to:e.from)}function YO(e,t){return YM(e,n=>n.empty?e.moveByChar(n,t):YE(n,t))}function YP(e){return e.textDirectionAt(e.state.selection.main.head)==G9.Direction.LTR}let YA=e=>YO(e,!YP(e)),Yz=e=>YO(e,YP(e));function Y_(e,t){return YM(e,n=>n.empty?e.moveByGroup(n,t):YE(n,t))}function YI(e,t,n){let r,i,a=(0,G4.syntaxTree)(e).resolveInner(t.head),o=n?Ye.NodeProp.closedBy:Ye.NodeProp.openedBy;for(let r=t.head;;){let t=n?a.childAfter(r):a.childBefore(r);if(!t)break;!function(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}(e,t,o)?r=n?t.to:t.from:a=t}return i=a.type.prop(o)&&(r=n?(0,G4.matchBrackets)(e,a.from,1):(0,G4.matchBrackets)(e,a.to,-1))&&r.matched?n?r.end.to:r.end.from:n?a.to:a.from,G7.EditorSelection.cursor(i,n?-1:1)}function YD(e,t){return YM(e,n=>{if(!n.empty)return YE(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)})}"u">typeof Intl&&Intl.Segmenter;let YT=e=>YD(e,!1),YR=e=>YD(e,!0);function YL(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(G9.EditorView.scrollMargins)){let i=t(e);(null==i?void 0:i.top)&&(n=Math.max(null==i?void 0:i.top,n)),(null==i?void 0:i.bottom)&&(r=Math.max(null==i?void 0:i.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function Y$(e,t){let n,r=YL(e),{state:i}=e,a=YC(i.selection,n=>n.empty?e.moveVertically(n,t,r.height):YE(n,t));if(a.eq(i.selection))return!1;if(r.selfScroll){let t=e.coordsAtPos(i.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),l=o.top+r.marginTop,s=o.bottom-r.marginBottom;t&&t.top>l&&t.bottom<s&&(n=G9.EditorView.scrollIntoView(a.main.head,{y:"start",yMargin:t.top-l}))}return e.dispatch(YN(i,a),{effects:n}),!0}let YF=e=>Y$(e,!1),YV=e=>Y$(e,!0);function YB(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=G7.EditorSelection.cursor(r.from+n))}return i}function YH(e,t){let n=YC(e.state.selection,e=>{let n=t(e);return G7.EditorSelection.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0,n.assoc)});return!n.eq(e.state.selection)&&(e.dispatch(YN(e.state,n)),!0)}function YW(e,t){return YH(e,n=>e.moveByChar(n,t))}let Yq=e=>YW(e,!YP(e)),YU=e=>YW(e,YP(e));function YK(e,t){return YH(e,n=>e.moveByGroup(n,t))}function YG(e,t){return YH(e,n=>e.moveVertically(n,t))}let YY=e=>YG(e,!1),YX=e=>YG(e,!0);function YZ(e,t){return YH(e,n=>e.moveVertically(n,t,YL(e).height))}let YJ=e=>YZ(e,!1),YQ=e=>YZ(e,!0),Y0=({state:e,dispatch:t})=>(t(YN(e,{anchor:0})),!0),Y1=({state:e,dispatch:t})=>(t(YN(e,{anchor:e.doc.length})),!0),Y2=({state:e,dispatch:t})=>(t(YN(e,{anchor:e.selection.main.anchor,head:0})),!0),Y5=({state:e,dispatch:t})=>(t(YN(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function Y4(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(YN(n,G7.EditorSelection.create(i,i.length-1))),!0)}function Y3(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n="delete.backward",o=Y6(e,o,!1)):o>i&&(n="delete.forward",o=Y6(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=Y6(e,i,!1),a=Y6(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:G7.EditorSelection.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?G9.EditorView.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Y6(e,t,n){if(e instanceof G9.EditorView)for(let r of e.state.facet(G9.EditorView.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}let Y8=(e,t,n)=>Y3(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),l,s;if(n&&!t&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(l=o.text.slice(0,i-o.from))){if(" "==l[l.length-1])return i-1;let e=(0,G7.countColumn)(l,a.tabSize)%(0,G4.getIndentUnit)(a)||(0,G4.getIndentUnit)(a);for(let t=0;t<e&&" "==l[l.length-1-t];t++)i--;s=i}else(s=(0,G7.findClusterBreak)(o.text,i-o.from,t,t)+o.from)==i&&o.number!=(t?a.doc.lines:1)?s+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(s-o.from,i-o.from))&&(s=(0,G7.findClusterBreak)(o.text,s-o.from,!1,!1)+o.from);return s}),Y7=e=>Y8(e,!1,!0),Y9=e=>Y8(e,!0,!1),Xe=(e,t)=>Y3(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let l=(0,G7.findClusterBreak)(a.text,r-a.from,t)+a.from,s=a.text.slice(Math.min(r,l)-a.from,Math.max(r,l)-a.from),c=o(s);if(null!=e&&c!=e)break;(" "!=s||r!=n.head)&&(e=c),r=l}return r}),Xt=e=>Xe(e,!1);function Xn(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(r.empty||r.to!=a.from||(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function Xr(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of Xn(e)){if(n?t.to==e.doc.length:0==t.from)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n)for(let n of(r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak}),t.ranges))i.push(G7.EditorSelection.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)));else for(let n of(r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text}),t.ranges))i.push(G7.EditorSelection.range(n.anchor-o,n.head-o))}return!!r.length&&(t(e.update({changes:r,scrollIntoView:!0,selection:G7.EditorSelection.create(i,e.selection.mainIndex),userEvent:"move.line"})),!0)}function Xi(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of Xn(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}let Xa=Xl(!1),Xo=Xl(!0);function Xl(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=(0,G4.syntaxTree)(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(Ye.NodeProp.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let l=new G4.IndentContext(t,{simulateBreak:r,simulateDoubleBreak:!!o}),s=(0,G4.getIndentation)(l,r);for(null==s&&(s=(0,G7.countColumn)(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize));i<a.to&&/\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let c=["",(0,G4.indentString)(t,s)];return o&&c.push((0,G4.indentString)(t,l.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:G7.Text.of(c)},range:G7.EditorSelection.cursor(r+1+c[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Xs(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:G7.EditorSelection.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}let Xc=[{key:"Ctrl-b",run:YA,shift:Yq,preventDefault:!0},{key:"Ctrl-f",run:Yz,shift:YU},{key:"Ctrl-p",run:YT,shift:YY},{key:"Ctrl-n",run:YR,shift:YX},{key:"Ctrl-a",run:e=>YM(e,t=>G7.EditorSelection.cursor(e.lineBlockAt(t.head).from,1)),shift:e=>YH(e,t=>G7.EditorSelection.cursor(e.lineBlockAt(t.head).from))},{key:"Ctrl-e",run:e=>YM(e,t=>G7.EditorSelection.cursor(e.lineBlockAt(t.head).to,-1)),shift:e=>YH(e,t=>G7.EditorSelection.cursor(e.lineBlockAt(t.head).to))},{key:"Ctrl-d",run:Y9},{key:"Ctrl-h",run:Y7},{key:"Ctrl-k",run:e=>Y3(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)})},{key:"Ctrl-Alt-h",run:Xt},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:G7.Text.of(["",""])},range:G7.EditorSelection.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:(0,G7.findClusterBreak)(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:(0,G7.findClusterBreak)(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:G7.EditorSelection.cursor(a)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:YV}],Xd=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>YM(e,t=>YI(e.state,t,!YP(e))),shift:e=>YH(e,t=>YI(e.state,t,!YP(e)))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>YM(e,t=>YI(e.state,t,YP(e))),shift:e=>YH(e,t=>YI(e.state,t,YP(e)))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>Xr(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>Xi(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>Xr(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>Xi(e,t,!0)},{key:"Mod-Alt-ArrowUp",run:e=>Y4(e,!1)},{key:"Mod-Alt-ArrowDown",run:e=>Y4(e,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=G7.EditorSelection.create([n.main]):n.main.empty||(r=G7.EditorSelection.create([G7.EditorSelection.cursor(n.main.head)])),!!r&&(t(YN(e,r)),!0)}},{key:"Mod-Enter",run:Xo},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=Xn(e).map(({from:t,to:n})=>G7.EditorSelection.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:G7.EditorSelection.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=YC(e.selection,t=>{let n=(0,G4.syntaxTree)(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return G7.EditorSelection.range(n.to,n.from)}return t});return!n.eq(e.selection)&&(t(YN(e,n)),!0)},preventDefault:!0},{key:"Mod-[",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Xs(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=(0,G7.countColumn)(r,e.tabSize),a=0,o=(0,G4.indentString)(e,Math.max(0,i-(0,G4.getIndentUnit)(e)));for(;a<r.length&&a<o.length&&r.charCodeAt(a)==o.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:o.slice(a)})}),{userEvent:"delete.dedent"})),!0)},{key:"Mod-]",run:({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(Xs(e,(t,n)=>{n.push({from:t.from,insert:e.facet(G4.indentUnit)})}),{userEvent:"input.indent"})),!0)},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new G4.IndentContext(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),i=Xs(e,(t,i,a)=>{let o=(0,G4.getIndentation)(r,t.from);if(null==o)return;/\S/.test(t.text)||(o=0);let l=/^\s*/.exec(t.text)[0],s=(0,G4.indentString)(e,o);(l!=s||a.from<t.from+l.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+l.length,insert:s}))});return i.changes.empty||t(e.update(i,{userEvent:"indent"})),!0}},{key:"Shift-Mod-k",run:e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Xn(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=YC(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>{let n,r;return n=!1,r=YC(e.selection,t=>{let r=(0,G4.matchBrackets)(e,t.head,-1)||(0,G4.matchBrackets)(e,t.head,1)||t.head>0&&(0,G4.matchBrackets)(e,t.head-1,1)||t.head<e.doc.length&&(0,G4.matchBrackets)(e,t.head+1,-1);if(!r||!r.end)return t;n=!0;let i=r.start.from==t.head?r.end.to:r.end.from;return G7.EditorSelection.cursor(i)}),!!n&&(t(YN(e,r)),!0)}},{key:"Mod-/",run:e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Ya(e.state,n.from);return r.line?Yn(e):!!r.block&&Yi(e)}},{key:"Alt-A",run:Yr},{key:"Ctrl-m",mac:"Shift-Alt-m",run:e=>(e.setTabFocusMode(),!0)}].concat([{key:"ArrowLeft",run:YA,shift:Yq,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>Y_(e,!YP(e)),shift:e=>YK(e,!YP(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>YM(e,t=>YB(e,t,!YP(e))),shift:e=>YH(e,t=>YB(e,t,!YP(e))),preventDefault:!0},{key:"ArrowRight",run:Yz,shift:YU,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>Y_(e,YP(e)),shift:e=>YK(e,YP(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>YM(e,t=>YB(e,t,YP(e))),shift:e=>YH(e,t=>YB(e,t,YP(e))),preventDefault:!0},{key:"ArrowUp",run:YT,shift:YY,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Y0,shift:Y2},{mac:"Ctrl-ArrowUp",run:YF,shift:YJ},{key:"ArrowDown",run:YR,shift:YX,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Y1,shift:Y5},{mac:"Ctrl-ArrowDown",run:YV,shift:YQ},{key:"PageUp",run:YF,shift:YJ},{key:"PageDown",run:YV,shift:YQ},{key:"Home",run:e=>YM(e,t=>YB(e,t,!1)),shift:e=>YH(e,t=>YB(e,t,!1)),preventDefault:!0},{key:"Mod-Home",run:Y0,shift:Y2},{key:"End",run:e=>YM(e,t=>YB(e,t,!0)),shift:e=>YH(e,t=>YB(e,t,!0)),preventDefault:!0},{key:"Mod-End",run:Y1,shift:Y5},{key:"Enter",run:Xa,shift:Xa},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:Y7,shift:Y7,preventDefault:!0},{key:"Delete",run:Y9,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Xt,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>Xe(e,!0),preventDefault:!0},{mac:"Mod-Backspace",run:e=>Y3(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),preventDefault:!0},{mac:"Mod-Delete",run:e=>Y3(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),preventDefault:!0}].concat(Xc.map(e=>({mac:e.key,run:e.run,shift:e.shift}))));var Xu=e.i(41016);let Xf="function"==typeof String.prototype.normalize?e=>e.normalize("NFKD"):e=>e;class Xh{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(Xf(e)):Xf,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return -1;this.bufferPos=0,this.buffer=this.iter.value}return(0,G7.codePointAt)(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=(0,G7.fromCodePoint)(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=(0,G7.codePointSize)(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(1==this.query.length?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}}"u">typeof Symbol&&(Xh.prototype[Symbol.iterator]=function(){return this});let Xp={from:-1,to:-1,match:/.*/.exec(""),precise:!0},Xm="gm"+(null==/x/.unicode?"":"u");class Xg{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine="",this.done=!1,this.value=Xp,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Xy(e,t,n,r,i);this.re=new RegExp(t,Xm+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=Xb(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=Xb(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length<this.to))return this.done=!0,this;this.nextLine(),e=0}}}}let Xv=new WeakMap;class Xx{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,n){let r=Xv.get(e);if(!r||r.from>=n||r.to<=t){let r=new Xx(t,e.sliceString(t,n));return Xv.set(e,r),r}if(r.from==t&&r.to==n)return r;let{text:i,from:a}=r;return a>t&&(i=e.sliceString(t,a)+i,a=t),r.to<n&&(i+=e.sliceString(r.to,n)),Xv.set(e,new Xx(a,i)),new Xx(t,i.slice(t-a,n-a))}}class Xy{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=Xp,this.matchPos=Xb(e,r),this.re=new RegExp(t,Xm+((null==n?void 0:n.ignoreCase)?"i":"")),this.test=null==n?void 0:n.test,this.flat=Xx.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=Xb(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Xx.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function Xb(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}"u">typeof Symbol&&(Xg.prototype[Symbol.iterator]=Xy.prototype[Symbol.iterator]=function(){return this});let Xw={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Xj=G7.Facet.define({combine:e=>(0,G7.combineConfig)(e,Xw,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}),Xk=G9.Decoration.mark({class:"cm-selectionMatch"}),XS=G9.Decoration.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function XC(e,t,n,r){return(0==n||e(t.sliceDoc(n-1,n))!=G7.CharCategory.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=G7.CharCategory.Word)}let XN=G9.ViewPlugin.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Xj),{state:n}=e,r=n.selection;if(r.ranges.length>1)return G9.Decoration.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return G9.Decoration.none;let e=n.wordAt(i.head);if(!e)return G9.Decoration.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return G9.Decoration.none;if(t.wholeWords){var l,s,c;if(a=n.sliceDoc(i.from,i.to),!(XC(o=n.charCategorizer(i.head),n,i.from,i.to)&&(l=o,s=i.from,c=i.to,l(n.sliceDoc(s,s+1))==G7.CharCategory.Word&&l(n.sliceDoc(c-1,c))==G7.CharCategory.Word)))return G9.Decoration.none}else if(!(a=n.sliceDoc(i.from,i.to)))return G9.Decoration.none}let d=[];for(let r of e.visibleRanges){let e=new Xh(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||XC(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?d.push(XS.range(r,a)):(r>=i.to||a<=i.from)&&d.push(Xk.range(r,a)),d.length>t.maxMatches))return G9.Decoration.none}}return G9.Decoration.set(d)}},{decorations:e=>e.decorations}),XM=G9.EditorView.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),XE=G7.Facet.define({combine:e=>(0,G7.combineConfig)(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new X5(e),scrollToMatch:e=>G9.EditorView.scrollIntoView(e)})});class XO{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||function(e){try{return new RegExp(e,Xm),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new XT(this):new Xz(this)}getCursor(e,t=0,n){let r=e.doc?e:G7.EditorState.create({doc:e});return null==n&&(n=r.doc.length),this.regexp?X_(this,r,t,n):XA(this,r,t,n)}}class XP{constructor(e){this.spec=e}}function XA(e,t,n,r){var i,a,o,l;let s;return e.wholeWord&&(o=t.doc,l=t.charCategorizer(t.selection.main.head),s=(e,t,n,r)=>((r>e||r+n.length<t)&&(r=Math.max(0,e-2),n=o.sliceString(r,Math.min(o.length,t+2))),(l(XI(n,e-r))!=G7.CharCategory.Word||l(XD(n,e-r))!=G7.CharCategory.Word)&&(l(XD(n,t-r))!=G7.CharCategory.Word||l(XI(n,t-r))!=G7.CharCategory.Word))),e.test&&(i=e.test,a=s,s=(e,n,r,o)=>(!a||!!a(e,n,r,o))&&i(e>=o&&n<=o+r.length?r.slice(e-o,n-o):t.doc.sliceString(e,n),t,e,n)),new Xh(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),s)}class Xz extends XP{constructor(e){super(e)}nextMatch(e,t,n){let r=XA(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=XA(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=XA(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||(r=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length)),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=XA(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=XA(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}function X_(e,t,n,r){var i,a,o;let l;return e.wholeWord&&(o=t.charCategorizer(t.selection.main.head),l=(e,t,n)=>!n[0].length||(o(XI(n.input,n.index))!=G7.CharCategory.Word||o(XD(n.input,n.index))!=G7.CharCategory.Word)&&(o(XD(n.input,n.index+n[0].length))!=G7.CharCategory.Word||o(XI(n.input,n.index+n[0].length))!=G7.CharCategory.Word)),e.test&&(i=e.test,a=l,l=(e,n,r)=>(!a||a(e,n,r))&&i(r[0],t,e,n)),new Xg(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:l},n,r)}function XI(e,t){return e.slice((0,G7.findClusterBreak)(e,t,!1),t)}function XD(e,t){return e.slice(t,(0,G7.findClusterBreak)(e,t))}class XT extends XP{nextMatch(e,t,n){let r=X_(this.spec,e,n,e.doc.length).next();return r.done&&(r=X_(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-1e4*r),a=X_(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if("&"==n)return e.match[0];if("$"==n)return"$";for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=X_(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=X_(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}}let XR=G7.StateEffect.define(),XL=G7.StateEffect.define(),X$=G7.StateField.define({create:e=>new XF(XZ(e).create(),null),update(e,t){for(let n of t.effects)n.is(XR)?e=new XF(n.value.create(),e.panel):n.is(XL)&&(e=new XF(e.query,n.value?XX:null));return e},provide:e=>G9.showPanel.from(e,e=>e.panel)});class XF{constructor(e,t){this.query=e,this.panel=t}}let XV=G9.Decoration.mark({class:"cm-searchMatch"}),XB=G9.Decoration.mark({class:"cm-searchMatch cm-searchMatch-selected"}),XH=G9.ViewPlugin.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(X$))}update(e){let t=e.state.field(X$);(t!=e.startState.field(X$)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return G9.Decoration.none;let{view:n}=this,r=new G7.RangeSetBuilder;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:l}=i[t];for(;t<a-1&&l>i[t+1].from-500;)l=i[++t].to;e.highlight(n.state,o,l,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?XB:XV)})}return r.finish()}},{decorations:e=>e.decorations});function XW(e){return t=>{let n=t.state.field(X$,!1);return n&&n.query.spec.valid?e(t,n):X0(t)}}let Xq=XW((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=G7.EditorSelection.single(r.from,r.to),a=e.state.facet(XE);return e.dispatch({selection:i,effects:[X6(e,r),a.scrollToMatch(i.main,e)],userEvent:"select.search"}),XQ(e),!0}),XU=XW((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=G7.EditorSelection.single(i.from,i.to),o=e.state.facet(XE);return e.dispatch({selection:a,effects:[X6(e,i),o.scrollToMatch(a.main,e)],userEvent:"select.search"}),XQ(e),!0}),XK=XW((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!!n&&!!n.length&&(e.dispatch({selection:G7.EditorSelection.create(n.map(e=>G7.EditorSelection.range(e.from,e.to))),userEvent:"select.search.matches"}),!0)}),XG=XW((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,l=[],s,c,d=[];o.precise?o.from==r&&o.to==i&&(c=n.toText(t.getReplacement(o)),l.push({from:o.from,to:o.to,insert:c}),d.push(G9.EditorView.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(r).number)+"."))):o=t.nextMatch(n,o.from,o.to);let u=e.state.changes(l);return o&&(s=G7.EditorSelection.single(o.from,o.to).map(u),d.push(X6(e,o)),d.push(n.facet(XE).scrollToMatch(s.main,e))),e.dispatch({changes:u,selection:s,effects:d,userEvent:"input.replace"}),!0}),XY=XW((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:G9.EditorView.announce.of(r),userEvent:"input.replace.all"}),!0});function XX(e){return e.state.facet(XE).createPanel(e)}function XZ(e,t){var n,r,i,a,o;let l=e.selection.main,s=l.empty||l.to>l.from+100?"":e.sliceDoc(l.from,l.to);if(t&&!s)return t;let c=e.facet(XE);return new XO({search:(null!=(n=null==t?void 0:t.literal)?n:c.literal)?s:s.replace(/\n/g,"\\n"),caseSensitive:null!=(r=null==t?void 0:t.caseSensitive)?r:c.caseSensitive,literal:null!=(i=null==t?void 0:t.literal)?i:c.literal,regexp:null!=(a=null==t?void 0:t.regexp)?a:c.regexp,wholeWord:null!=(o=null==t?void 0:t.wholeWord)?o:c.wholeWord})}function XJ(e){let t=(0,G9.getPanel)(e,XX);return t&&t.dom.querySelector("[main-field]")}function XQ(e){let t=XJ(e);t&&t==e.root.activeElement&&t.select()}let X0=e=>{let t=e.state.field(X$,!1);if(t&&t.panel){let n=XJ(e);if(n&&n!=e.root.activeElement){let r=XZ(e.state,t.query.spec);r.valid&&e.dispatch({effects:XR.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[XL.of(!0),t?XR.of(XZ(e.state,t.query.spec)):G7.StateEffect.appendConfig.of(X7)]});return!0},X1=e=>{let t=e.state.field(X$,!1);if(!t||!t.panel)return!1;let n=(0,G9.getPanel)(e,XX);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:XL.of(!1)}),!0},X2=[{key:"Mod-f",run:X0,scope:"editor search-panel"},{key:"F3",run:Xq,shift:XU,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Xq,shift:XU,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:X1,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new Xh(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(G7.EditorSelection.range(t.value.from,t.value.to))}return t(e.update({selection:G7.EditorSelection.create(a,o),userEvent:"select.search.matches"})),!0}},{key:"Mod-Alt-g",run:e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=(0,G9.showDialog)(e,{label:t.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:t.phrase("go")});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i)return void e.dispatch({effects:r});let a=t.doc.lineAt(t.selection.main.head),[,o,l,s,c]=i,d=s?+s.slice(1):0,u=l?+l:a.number;if(l&&c){let e=u/100;o&&(e=e*("-"==o?-1:1)+a.number/t.doc.lines),u=Math.round(t.doc.lines*e)}else l&&o&&(u=u*("-"==o?-1:1)+a.number);let f=t.doc.line(Math.max(1,Math.min(t.doc.lines,u))),h=G7.EditorSelection.cursor(f.from+Math.max(0,Math.min(d,f.length)));e.dispatch({effects:[r,G9.EditorView.scrollIntoView(h.from,{y:"center"})],selection:h})}),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return(({state:e,dispatch:t})=>{let{selection:n}=e,r=G7.EditorSelection.create(n.ranges.map(t=>e.wordAt(t.head)||G7.EditorSelection.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)})({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=function(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new Xh(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new Xh(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}(e,r);return!!i&&(t(e.update({selection:e.selection.addRange(G7.EditorSelection.range(i.from,i.to),!1),effects:G9.EditorView.scrollIntoView(i.to)})),!0)},preventDefault:!0}];class X5{constructor(e){this.view=e;let t=this.query=e.state.field(X$).query.spec;function n(e,t,n){return(0,Xu.default)("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=(0,Xu.default)("input",{value:t.search,placeholder:X4(e,"Find"),"aria-label":X4(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=(0,Xu.default)("input",{value:t.replace,placeholder:X4(e,"Replace"),"aria-label":X4(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=(0,Xu.default)("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=(0,Xu.default)("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=(0,Xu.default)("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=(0,Xu.default)("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",()=>Xq(e),[X4(e,"next")]),n("prev",()=>XU(e),[X4(e,"previous")]),n("select",()=>XK(e),[X4(e,"all")]),(0,Xu.default)("label",null,[this.caseField,X4(e,"match case")]),(0,Xu.default)("label",null,[this.reField,X4(e,"regexp")]),(0,Xu.default)("label",null,[this.wordField,X4(e,"by word")]),...e.state.readOnly?[]:[(0,Xu.default)("br"),this.replaceField,n("replace",()=>XG(e),[X4(e,"replace")]),n("replaceAll",()=>XY(e),[X4(e,"replace all")])],(0,Xu.default)("button",{name:"close",onclick:()=>X1(e),"aria-label":X4(e,"close"),type:"button"},["×"])])}commit(){let e=new XO({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:XR.of(e)}))}keydown(e){(0,G9.runScopeHandlers)(this.view,e,"search-panel")?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?XU:Xq)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),XG(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(XR)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(XE).top}}function X4(e,t){return e.state.phrase(t)}let X3=/[\s\.,:;?!]/;function X6(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-30),o=Math.min(i,n+30),l=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<30;e++)if(!X3.test(l[e+1])&&X3.test(l[e])){l=l.slice(e);break}}if(o!=i){for(let e=l.length-1;e>l.length-30;e--)if(!X3.test(l[e-1])&&X3.test(l[e])){l=l.slice(0,e);break}}return G9.EditorView.announce.of(`${e.state.phrase("current match")}. ${l} ${e.state.phrase("on line")} ${r.number}.`)}let X8=G9.EditorView.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),X7=[X$,G7.Prec.low(XH),X8];var X9=e.i(62291),Ze=G9;class Zt{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class Zn{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let r=n.facet(Zh).markerFilter;r&&(e=r(e,n));let i=e.slice().sort((e,t)=>e.from-t.from||e.to-t.to),a=new G7.RangeSetBuilder,o=[],l=0,s=n.doc.iter(),c=0,d=n.doc.length;for(let e=0;;){let t,n,r=e==i.length?null:i[e];if(!r&&!o.length)break;if(o.length)t=l,n=o.reduce((e,t)=>Math.min(e,t.to),r&&r.from>t?r.from:1e8);else{if((t=r.from)>d)break;n=r.to,o.push(r),e++}for(;e<i.length;){let r=i[e];if(r.from==t&&(r.to>r.from||r.to==t))o.push(r),e++,n=Math.min(r.to,n);else{n=Math.min(r.from,n);break}}n=Math.min(n,d);let u=!1;if(o.some(e=>e.from==t&&(e.to==n||n==d))&&!(u=t==n)&&n-t<10){let e=t-(c+s.value.length);e>0&&(s.next(e),c=t);for(let e=t;;){if(e>=n){u=!0;break}if(!s.lineBreak&&c+s.value.length>e)break;e=c+s.value.length,c+=s.value.length,s.next()}}let f=Zj(o);if(u)a.add(t,t,Ze.Decoration.widget({widget:new Zv(f),diagnostics:o.slice()}));else{let e=o.reduce((e,t)=>t.markClass?e+" "+t.markClass:e,"");a.add(t,n,Ze.Decoration.mark({class:"cm-lintRange cm-lintRange-"+f+e,diagnostics:o.slice(),inclusiveEnd:o.some(e=>e.to>n)}))}if((l=n)==d)break;for(let e=0;e<o.length;e++)o[e].to<=l&&o.splice(e--,1)}let u=a.finish();return new Zn(u,t,Zr(u))}}function Zr(e,t=null,n=0){let r=null;return e.between(n,1e9,(e,n,{spec:i})=>{if(!(t&&0>i.diagnostics.indexOf(t)))if(r){if(0>i.diagnostics.indexOf(r.diagnostic))return!1;r=new Zt(r.from,n,r.diagnostic)}else r=new Zt(e,n,t||i.diagnostics[0])}),r}function Zi(e,t){let n=t.pos,r=t.end||n,i=e.state.facet(Zh).hideOn(e,n,r);if(null!=i)return i;let a=e.startState.doc.lineAt(t.pos);return!!(e.effects.some(e=>e.is(Za))||e.changes.touchesRange(a.from,Math.max(a.to,r)))}let Za=G7.StateEffect.define(),Zo=G7.StateEffect.define(),Zl=G7.StateEffect.define(),Zs=G7.StateField.define({create:()=>new Zn(Ze.Decoration.none,null,null),update(e,t){if(t.docChanged&&e.diagnostics.size){let n=e.diagnostics.map(t.changes),r=null,i=e.panel;if(e.selected){let i=t.changes.mapPos(e.selected.from,1);r=Zr(n,e.selected.diagnostic,i)||Zr(n,null,i)}!n.size&&i&&t.state.facet(Zh).autoPanel&&(i=null),e=new Zn(n,i,r)}for(let n of t.effects)if(n.is(Za)){let r=t.state.facet(Zh).autoPanel?n.value.length?Zy.open:null:e.panel;e=Zn.init(n.value,r,t.state)}else n.is(Zo)?e=new Zn(e.diagnostics,n.value?Zy.open:null,e.selected):n.is(Zl)&&(e=new Zn(e.diagnostics,e.panel,n.value));return e},provide:e=>[Ze.showPanel.from(e,e=>e.panel),Ze.EditorView.decorations.from(e,e=>e.diagnostics)]}),Zc=Ze.Decoration.mark({class:"cm-lintRange cm-lintRange-active"});function Zd(e,t){return(0,Xu.default)("ul",{class:"cm-tooltip-lint"},t.map(t=>Zg(e,t,!1)))}let Zu=e=>{let t=e.state.field(Zs,!1);return!!t&&!!t.panel&&(e.dispatch({effects:Zo.of(!1)}),!0)},Zf=[{key:"Mod-Shift-m",run:e=>{var t,n;let r=e.state.field(Zs,!1);r&&r.panel||e.dispatch({effects:(t=e.state,n=[Zo.of(!0)],t.field(Zs,!1)?n:n.concat(G7.StateEffect.appendConfig.of(ZN)))});let i=(0,Ze.getPanel)(e,Zy.open);return i&&i.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(Zs,!1);if(!t)return!1;let n=e.state.selection.main,r=Zr(t.diagnostics,null,n.to+1);return(!!r||!!(r=Zr(t.diagnostics,null,0))&&(r.from!=n.from||r.to!=n.to))&&(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0}),(0,Ze.activateHover)(e,r.from,1,{tooltip:ZC,until:e=>e.docChanged||e.newSelection.main.head<r.from||e.newSelection.main.head>r.to}),!0)}}],Zh=G7.Facet.define({combine:e=>({sources:e.map(e=>e.source).filter(e=>null!=e),...(0,G7.combineConfig)(e.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:Zp,tooltipFilter:Zp,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,i)=>e(n,r,i)||t(n,r,i):e:t,autoPanel:(e,t)=>e||t})})});function Zp(e,t){return e?t?(n,r)=>t(e(n,r),r):e:t}function Zm(e){let t=[];if(e)n:for(let{name:n}of e){for(let e=0;e<n.length;e++){let r=n[e];if(/[a-zA-Z]/.test(r)&&!t.some(e=>e.toLowerCase()==r.toLowerCase())){t.push(r);continue n}}t.push("")}return t}function Zg(e,t,n){var r;let i=n?Zm(t.actions):[];return(0,Xu.default)("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},(0,Xu.default)("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage(e):t.message),null==(r=t.actions)?void 0:r.map((n,r)=>{let a=!1,o=r=>{if(r.preventDefault(),a)return;a=!0;let i=Zr(e.state.field(Zs).diagnostics,t);i&&n.apply(e,i.from,i.to)},{name:l}=n,s=i[r]?l.indexOf(i[r]):-1,c=s<0?l:[l.slice(0,s),(0,Xu.default)("u",l.slice(s,s+1)),l.slice(s+1)],d=n.markClass?" "+n.markClass:"";return(0,Xu.default)("button",{type:"button",class:"cm-diagnosticAction"+d,onclick:o,onmousedown:o,"aria-label":` Action: ${l}${s<0?"":` (access key "${i[r]})"`}.`},c)}),t.source&&(0,Xu.default)("div",{class:"cm-diagnosticSource"},t.source))}class Zv extends Ze.WidgetType{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return(0,Xu.default)("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class Zx{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(0xffffffff*Math.random()).toString(16),this.dom=Zg(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Zy{constructor(e){this.view=e,this.items=[];let t=t=>{if(!t.ctrlKey&&!t.altKey&&!t.metaKey){if(27==t.keyCode)Zu(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65)||!(t.keyCode<=90)||!(this.selectedIndex>=0))return;let{diagnostic:n}=this.items[this.selectedIndex],r=Zm(n.actions);for(let i=0;i<r.length;i++)if(r[i].toUpperCase().charCodeAt(0)==t.keyCode){let t=Zr(this.view.state.field(Zs).diagnostics,n);t&&n.actions[i].apply(e,t.from,t.to)}}t.preventDefault()}},n=e=>{for(let t=0;t<this.items.length;t++)this.items[t].dom.contains(e.target)&&this.moveSelection(t)};this.list=(0,Xu.default)("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=(0,Xu.default)("div",{class:"cm-panel-lint"},this.list,(0,Xu.default)("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>Zu(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Zs).selected;if(!e)return -1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return -1}update(){let{diagnostics:e,selected:t}=this.view.state.field(Zs),n=0,r=!1,i=null,a=new Set;for(e.between(0,this.view.state.doc.length,(e,o,{spec:l})=>{for(let e of l.diagnostics){if(a.has(e))continue;a.add(e);let o=-1,l;for(let t=n;t<this.items.length;t++)if(this.items[t].diagnostic==e){o=t;break}o<0?(l=new Zx(this.view,e),this.items.splice(n,0,l),r=!0):(l=this.items[o],o>n&&(this.items.splice(n,o-n),r=!0)),t&&l.diagnostic==t.diagnostic?l.dom.hasAttribute("aria-selected")||(l.dom.setAttribute("aria-selected","true"),i=l):l.dom.hasAttribute("aria-selected")&&l.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(1==this.items.length&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();0==this.items.length&&(this.items.push(new Zx(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),i?(this.list.setAttribute("aria-activedescendant",i.id),this.view.requestMeasure({key:this,read:()=>({sel:i.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{let n=t.height/this.list.offsetHeight;e.top<t.top?this.list.scrollTop-=(t.top-e.top)/n:e.bottom>t.bottom&&(this.list.scrollTop+=(e.bottom-t.bottom)/n)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=Zr(this.view.state.field(Zs).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:Zl.of(t)})}static open(e){return new Zy(e)}}function Zb(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${t}>${encodeURIComponent(e)}</svg>')`}(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${e}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}let Zw=Ze.EditorView.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Zb("#f11")},".cm-lintRange-warning":{backgroundImage:Zb("orange")},".cm-lintRange-info":{backgroundImage:Zb("#999")},".cm-lintRange-hint":{backgroundImage:Zb("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function Zj(e){let t="hint",n=1;for(let i of e){var r;let e="error"==(r=i.severity)?4:"warning"==r?3:"info"==r?2:1;e>n&&(n=e,t=i.severity)}return t}Ze.GutterMarker;let Zk=G7.StateEffect.define(),ZS=G7.StateField.define({create:()=>null,update:(e,t)=>(e&&t.docChanged&&(e=Zi(t,e)?null:{...e,pos:t.changes.mapPos(e.pos)}),t.effects.reduce((e,t)=>t.is(Zk)?t.value:e,e)),provide:e=>Ze.showTooltip.from(e)}),ZC=(0,Ze.hoverTooltip)(function(e,t,n){let{diagnostics:r}=e.state.field(Zs),i,a=-1,o=-1;r.between(t-(n<0),t+ +(n>0),(e,r,{spec:l})=>{if(t>=e&&t<=r&&(e==r||(t>e||n>0)&&(t<r||n<0)))return i=l.diagnostics,a=e,o=r,!1});let l=e.state.facet(Zh).tooltipFilter;return(i&&l&&(i=l(i,e.state)),i)?{pos:a,end:o,above:e.state.doc.lineAt(a).to<o,create:()=>({dom:Zd(e,i)})}:null},{hideOn:Zi}),ZN=[Zs,Ze.EditorView.decorations.compute([Zs],e=>{let{selected:t,panel:n}=e.field(Zs);return t&&n&&t.from!=t.to?Ze.Decoration.set([Zc.range(t.from,t.to)]):Ze.Decoration.none}),ZC,Zw],ZM=G7.Facet.define({combine:e=>(0,G7.combineConfig)(e,{hoverTime:300,markerFilter:null,tooltipFilter:null})}),ZE=[(0,G9.lineNumbers)(),(0,G9.highlightActiveLineGutter)(),(0,G9.highlightSpecialChars)(),function(e={}){return[Yu,Yd.of(e),G9.EditorView.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?Yh:"historyRedo"==e.inputType?Yp:null;return!!n&&(e.preventDefault(),n(t))}})]}(),(0,G4.foldGutter)(),(0,G9.drawSelection)(),(0,G9.dropCursor)(),G7.EditorState.allowMultipleSelections.of(!0),(0,G4.indentOnInput)(),(0,G4.syntaxHighlighting)(G4.defaultHighlightStyle,{fallback:!0}),(0,G4.bracketMatching)(),(0,X9.closeBrackets)(),(0,X9.autocompletion)(),(0,G9.rectangularSelection)(),(0,G9.crosshairCursor)(),(0,G9.highlightActiveLine)(),[XM,XN],G9.keymap.of([...X9.closeBracketsKeymap,...Xd,...X2,{key:"Mod-z",run:Yh,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Yp,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Yp,preventDefault:!0},{key:"Mod-u",run:Ym,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Yg,preventDefault:!0},...G4.foldKeymap,...X9.completionKeymap,...Zf])];var ZO=e.i(99242);let ZP=eN("binary",[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]]),ZA=eN("pen-line",[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]),Zz=eN("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]),Z_=eN("square-play",[["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["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"}]]),ZI=eN("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]),ZD={review:"Review",edit:"Edit",view:"View",code:"Code",preview:"Preview",hex:"Hex",actions:"File view options",save:"Save",saving:"Saving",binaryTitle:"Binary content is not rendered",binaryDescription:"This file is binary or too large to decode safely. Render it only when you explicitly need to inspect the raw bytes.",renderAnyway:"Render anyway",unsupportedPreview:"No preview renderer is available for this file.",noContent:"No file content.",pathSeparator:"/"};function ZT(e){let t=e.name||e.path||"",n=/\.([^.\\/]+)$/.exec(t);return n?.[1]?.toLowerCase()}function ZR(e){if(e.kind)return e.kind;let t=e.mimeType?.toLowerCase()??"",n=ZT(e);return t.startsWith("image/")?"svg"===n?"svg":"image":t.startsWith("video/")?"video":t.includes("html")?"html":t.includes("markdown")?"markdown":t.includes("json")?"code":t.startsWith("text/")?"text":"svg"===n?"svg":"html"===n||"htm"===n?"html":"md"===n||"mdx"===n?"markdown":["png","jpg","jpeg","gif","webp","avif"].includes(n??"")?"image":["mp4","webm","mov","m4v","ogg"].includes(n??"")?"video":["zip","tar","gz","7z","rar","exe","dll","bin","wasm","pdf","psd"].includes(n??"")?"binary":"code"}async function ZL(e){let t=function(e){for(let t of[(e.language??ZT(e)??"text").toLowerCase(),e.mimeType?.toLowerCase()]){if(!t)continue;let e=G4.LanguageDescription.matchLanguageName(G8,t,!0);if(e)return e}for(let t of[e.name,e.path]){if(!t)continue;let e=G4.LanguageDescription.matchFilename(G8,t);if(e)return e}}(e);if(!t)return[];try{return await t.load()}catch{return[]}}function Z$(e){if(e&&!(e<=0))return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function ZF(e){let t=ZR(e);return"binary"===t?["hex"]:"image"===t||"video"===t?["preview"]:["html","markdown","richtext","svg"].includes(t)?["code","preview"]:["code"]}let ZV=G4.HighlightStyle.define([{tag:ZO.tags.comment,color:"var(--vtl-cm-comment)",fontStyle:"italic"},{tag:[ZO.tags.keyword,ZO.tags.modifier,ZO.tags.operatorKeyword],color:"var(--vtl-cm-keyword)"},{tag:[ZO.tags.atom,ZO.tags.bool,ZO.tags.null],color:"var(--vtl-cm-constant)"},{tag:[ZO.tags.number,ZO.tags.integer,ZO.tags.float],color:"var(--vtl-cm-number)"},{tag:[ZO.tags.string,ZO.tags.special(ZO.tags.string),ZO.tags.regexp],color:"var(--vtl-cm-string)"},{tag:[ZO.tags.variableName,ZO.tags.self,ZO.tags.propertyName],color:"var(--vtl-cm-variable)"},{tag:[ZO.tags.definition(ZO.tags.variableName),ZO.tags.function(ZO.tags.variableName)],color:"var(--vtl-cm-function)"},{tag:[ZO.tags.className,ZO.tags.typeName,ZO.tags.namespace],color:"var(--vtl-cm-type)"},{tag:[ZO.tags.tagName,ZO.tags.heading],color:"var(--vtl-cm-tag)"},{tag:ZO.tags.attributeName,color:"var(--vtl-cm-attribute)"},{tag:[ZO.tags.attributeValue,ZO.tags.link],color:"var(--vtl-cm-string)"},{tag:[ZO.tags.punctuation,ZO.tags.separator,ZO.tags.bracket],color:"var(--vtl-cm-punctuation)"},{tag:[ZO.tags.invalid],color:"var(--vtl-cm-invalid)"}]),ZB=G9.EditorView.theme({"&":{height:"100%",backgroundColor:"var(--vtl-cm-background)",color:"var(--vtl-cm-foreground)",fontSize:"var(--font-size-code)",lineHeight:"var(--vtl-cm-line-height)"},".cm-scroller":{fontFamily:"var(--font-family-mono)",height:"100%",overflow:"auto",scrollbarColor:"var(--border) transparent",scrollbarWidth:"thin"},".cm-scroller::-webkit-scrollbar":{width:"10px",height:"10px"},".cm-scroller::-webkit-scrollbar-track, .cm-scroller::-webkit-scrollbar-corner":{background:"transparent"},".cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:"var(--border)",border:"3px solid transparent",borderRadius:"9999px",backgroundClip:"content-box"},".cm-content":{minHeight:"100%",caretColor:"var(--vtl-cm-foreground)",padding:"0 0"},".cm-gutters":{backgroundColor:"var(--vtl-cm-background)",color:"var(--vtl-cm-gutter-foreground)",borderRightColor:"transparent",left:"0",position:"sticky",zIndex:"2"},".cm-gutter":{minWidth:"2.5rem"},".cm-gutters .cm-foldGutter":{display:"none !important"},".cm-lineNumbers .cm-gutterElement":{minWidth:"2.5rem",padding:"0 0.5rem 0 0",textAlign:"right",lineHeight:"var(--vtl-cm-line-height)"},".cm-activeLine":{backgroundColor:"var(--vtl-cm-active-line)"},".cm-activeLineGutter":{backgroundColor:"var(--vtl-cm-background)",color:"var(--vtl-cm-foreground)"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:"var(--vtl-cm-selection) !important"},".cm-line ::selection, .cm-content ::selection, ::selection":{backgroundColor:"var(--vtl-cm-selection) !important",color:"var(--vtl-cm-selection-text) !important"},"&.cm-focused":{outline:"none"},".cm-cursor":{borderLeftColor:"var(--vtl-cm-foreground)"},".cm-line":{caretColor:"var(--vtl-cm-foreground)",lineHeight:"var(--vtl-cm-line-height)",minHeight:"var(--vtl-cm-line-height)",padding:"0 0.75rem"}});function ZH({value:e,file:t,readOnly:n,onValueChange:r,wrapLines:i,className:a}){let o=ew.useRef(null),l=ew.useRef(null),s=ew.useRef(e),c=ew.useRef(r);return ew.useEffect(()=>{c.current=r},[r]),ew.useEffect(()=>{s.current=e;let t=l.current;t&&t.state.doc.toString()!==e&&t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e}})},[e]),ew.useEffect(()=>{let e=o.current;if(!e)return;let r=!1,a=new G7.Compartment,d=new G9.EditorView({parent:e,state:G7.EditorState.create({doc:s.current,extensions:[ZE,ZB,G7.EditorState.readOnly.of(n),G9.EditorView.editable.of(!n),i?G9.EditorView.lineWrapping:[],a.of([]),G7.Prec.high((0,G4.syntaxHighlighting)(ZV)),G9.EditorView.updateListener.of(e=>{if(!e.docChanged)return;let t=e.state.doc.toString();s.current=t,c.current?.(t)})]})});return l.current=d,ZL(t).then(e=>{r||l.current!==d||d.dispatch({effects:a.reconfigure(e)})}),()=>{r=!0,d.destroy(),l.current=null}},[t.kind,t.language,t.mimeType,t.name,t.path,t.readOnly,n,i]),(0,eb.jsx)("div",{"data-slot":"file-tab-code-editor",className:tK("size-full overflow-hidden bg-background",a),ref:o})}function ZW({value:e}){let t=e.split(/\n{2,}/);return(0,eb.jsx)("div",{className:"mx-auto grid w-full max-w-3xl gap-3 p-6",children:t.map((e,t)=>{let n=e.trim();return n?n.startsWith("### ")?(0,eb.jsx)("h3",{className:"ui-text-body font-semibold text-foreground",children:n.replace(/^###\s+/,"")},t):n.startsWith("## ")?(0,eb.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:n.replace(/^##\s+/,"")},t):n.startsWith("# ")?(0,eb.jsx)("h1",{className:"text-xl font-semibold text-foreground",children:n.replace(/^#\s+/,"")},t):n.startsWith(">")?(0,eb.jsx)("blockquote",{className:"border-l-2 pl-3 text-muted-foreground ui-text-body",children:n.replace(/^>\s?/gm,"")},t):/^[-*]\s+/m.test(n)?(0,eb.jsx)("ul",{className:"grid list-disc gap-1 pl-5 ui-text-body",children:n.split("\n").map(e=>(0,eb.jsx)("li",{children:e.replace(/^[-*]\s+/,"")},e))},t):n.startsWith("```")?(0,eb.jsx)("pre",{className:"overflow-auto rounded-lg border bg-code p-3 text-code-foreground ui-text-code",children:n.replace(/^```\w*\n?/,"").replace(/```$/,"")},t):(0,eb.jsx)("p",{className:"text-muted-foreground ui-text-body",children:n},t):null})})}function Zq({title:e,value:t,className:n}){let r=function(){let[e,t]=ew.useState("light");return ew.useEffect(()=>{function e(){let e=document.documentElement.classList.contains("dark"),n=document.documentElement.classList.contains("light");e||n?t(e?"dark":"light"):t(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}e();let n=new MutationObserver(e),r=window.matchMedia("(prefers-color-scheme: dark)");return n.observe(document.documentElement,{attributeFilter:["class"],attributes:!0}),r.addEventListener("change",e),()=>{n.disconnect(),r.removeEventListener("change",e)}},[]),e}(),i=ew.useMemo(()=>{let e,n;return e="dark"===r?"rgba(255, 255, 255, 0.16)":"#d8dee9",n=`<style data-vantaloom-scrollbar>
|
|
22
22
|
:root {
|
|
23
23
|
color-scheme: ${r};
|
|
24
24
|
scrollbar-color: ${e} transparent;
|
|
@@ -42,4 +42,4 @@ ${e.detail}`:e.title,isStreaming:e.isStreaming})})}):("read"===e.kind||"search"=
|
|
|
42
42
|
border-radius: 9999px;
|
|
43
43
|
background-clip: content-box;
|
|
44
44
|
}
|
|
45
|
-
</style>`,/<\/head>/i.test(t)?t.replace(/<\/head>/i,`${n}</head>`):`${n}${t}`},[r,t]);return(0,eb.jsx)("iframe",{title:e,sandbox:"",srcDoc:i,className:tK("size-full border-0 bg-background",n)})}function Z_({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),i=[];for(let e=0;e<r;e+=16){let t=Array.from({length:Math.min(16,r-e)},(t,r)=>n[e+r]??0);i.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 i},[e.bytes,t]);return 0===r.length?(0,eb.jsx)("div",{className:"grid size-full place-items-center p-6 text-center text-muted-foreground ui-text-body",children:n.noContent}):(0,eb.jsx)("div",{className:"size-full overflow-auto bg-background p-3 ui-text-code",children:(0,eb.jsx)("div",{className:"grid min-w-max grid-cols-[5.5rem_30rem_1fr] gap-x-4",children:r.map(e=>(0,eb.jsxs)(ew.Fragment,{children:[(0,eb.jsx)("span",{className:"text-muted-foreground",children:e.offset}),(0,eb.jsx)("span",{className:"font-mono text-foreground",children:e.hex}),(0,eb.jsx)("span",{className:"font-mono text-muted-foreground",children:e.ascii})]},e.offset))})})}function ZI({file:e,labels:t,onApprove:n}){return(0,eb.jsx)("div",{className:"grid size-full place-items-center bg-muted/20 p-6",children:(0,eb.jsxs)("div",{className:"grid max-w-md justify-items-center gap-3 text-center",children:[(0,eb.jsx)("div",{className:"grid size-10 place-items-center rounded-full border bg-background text-muted-foreground",children:(0,eb.jsx)(Zv,{className:"size-4"})}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)("h3",{className:"font-medium text-foreground ui-text-body",children:t.binaryTitle}),(0,eb.jsx)("p",{className:"text-muted-foreground ui-text-body",children:t.binaryDescription})]}),(0,eb.jsxs)("div",{className:"flex items-center gap-2",children:[ZN(e.size)&&(0,eb.jsx)(cI,{variant:"outline",children:ZN(e.size)}),(0,eb.jsx)(tY,{type:"button",size:"sm",variant:"outline",onClick:n,children:t.renderAnyway})]})]})})}function ZD({labels:e}){return(0,eb.jsx)("div",{className:"grid size-full place-items-center p-6 text-center text-muted-foreground ui-text-body",children:e.unsupportedPreview})}function ZT({file:e,value:t,labels:n,renderPreview:r,className:i}){let a=ZS(e),o=e.src?e.src:t&&"svg"===ZS(e)?`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`:void 0,l=r?.(e,t);return void 0!==l?(0,eb.jsx)("div",{"data-slot":"file-tab-custom-preview",className:tK("size-full",i),children:l}):"html"===a||"richtext"===a?(0,eb.jsx)(Zz,{title:e.name,value:t,className:i}):"markdown"===a?(0,eb.jsx)("div",{"data-slot":"file-tab-markdown-preview",className:tK("size-full overflow-auto bg-background",i),children:(0,eb.jsx)(ZA,{value:t})}):"svg"===a&&o?(0,eb.jsx)("div",{"data-slot":"file-tab-svg-preview",className:tK("grid size-full place-items-center overflow-auto bg-muted/20 p-6",i),children:(0,eb.jsx)("img",{src:o,alt:e.name,className:"max-h-full max-w-full rounded-lg border bg-background p-4"})}):"image"===a&&o?(0,eb.jsx)("div",{"data-slot":"file-tab-image-preview",className:tK("grid size-full place-items-center overflow-auto bg-muted/20 p-6",i),children:(0,eb.jsx)("img",{src:o,alt:e.name,className:"max-h-full max-w-full rounded-md"})}):"video"===a&&o?(0,eb.jsx)("div",{"data-slot":"file-tab-video-preview",className:tK("grid size-full place-items-center bg-muted/20 p-6",i),children:(0,eb.jsx)("video",{src:o,controls:!0,preload:"none",className:"max-h-full max-w-full rounded-md border bg-background"})}):(0,eb.jsx)(ZD,{labels:n})}function ZR({open:e,labels:t,currentView:n,currentMode:r,saving:i,modified:a,canSwitchView:o,canSwitchMode:l,canSave:s,onOpenChange:c,onToggleView:d,onToggleMode:u,onSave:f}){let h=[o?{key:"view",label:"code"===n?t.preview:t.code,onClick:d,icon:"code"===n?(0,eb.jsx)(Kk,{className:"size-4"}):(0,eb.jsx)(vs,{className:"size-4"})}:void 0,l?{key:"mode",label:"review"===r?t.edit:t.review,onClick:u,icon:"review"===r?(0,eb.jsx)(Zx,{className:"size-4"}):(0,eb.jsx)(eE,{className:"size-4"})}:void 0,s?{key:"save",label:i?t.saving:t.save,onClick:f,disabled:i||!a,icon:(0,eb.jsx)(Zw,{className:"size-4"})}:void 0].filter(e=>void 0!==e);return 0===h.length?null:(0,eb.jsx)("div",{"data-slot":"file-tab-floating-actions",className:"absolute right-3 bottom-3 z-20",children:(0,eb.jsxs)("div",{className:"relative size-8",children:[h.map((t,n)=>(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.label,disabled:t.disabled,onClick:()=>{t.disabled||t.onClick()},className:tK("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,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.actions,"aria-expanded":e,onClick:()=>c(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,eb.jsx)(s6,{className:tK("size-4 transition-transform",e&&"rotate-90")})})]})})}function ZL({file:e,value:t,defaultValue:n,onValueChange:r,mode:i,defaultMode:a="review",onModeChange:o,view:l,defaultView:s="code",onViewChange:c,modified:d=!1,onSave:u,onSaveError:f,largeBinaryThreshold:h=2097152,showHeader:p=!0,wrapLines:m=!1,renderPreview:g,labels:v,className:x,editorClassName:y,previewClassName:b,headerClassName:w,...j}){var k;let S,C,N=ew.useMemo(()=>({...Zj,...v}),[v]),[M,E]=ew.useState(n??e.content??""),[O,P]=ew.useState(a),[A,z]=ew.useState(s),[_,I]=ew.useState(!1),[D,T]=ew.useState(!1),[R,L]=ew.useState(!1),$=ew.useRef(null),F=t??M,V=i??O,B=(k=l??A,(S=ZM(e)).includes(k)?k:S[0]),H=ZS(e),W=ZM(e).length>1,q=!e.readOnly&&["text","code","html","markdown","richtext","svg"].includes(ZS(e)),U=!!u&&q&&"code"===B&&(d||R),K="review"===V||!0===e.readOnly,G="binary"===(C=ZS(e))||"image"!==C&&"video"!==C&&!!(e.size&&e.size>h&&!e.content),Y=(e.path??e.name).split(/[\\/]+/).filter(Boolean),X=ZN(e.size??F.length);async function Z(){if(u&&!R){L(!0);try{await u(F),T(!1)}catch(e){f?.(e)}finally{L(!1)}}}return ew.useEffect(()=>{void 0===t&&E(n??e.content??""),I(!1),T(!1)},[n,e,t]),ew.useEffect(()=>{if(D)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Node&&$.current?.contains(t)||T(!1)}},[D]),(0,eb.jsxs)("div",{ref:$,"data-slot":"file-tab-viewer","data-mode":V,"data-view":B,className:tK("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)]",x),...j,children:[p&&(0,eb.jsxs)("div",{"data-slot":"file-tab-viewer-header",className:tK("flex min-w-0 items-center gap-2 border-b bg-muted/35 px-3 py-2",w),children:[(0,eb.jsx)("span",{className:"grid size-5 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:"image"===H?(0,eb.jsx)(Zy,{className:"size-3.5"}):"video"===H?(0,eb.jsx)(Zb,{className:"size-3.5"}):"binary"===H?(0,eb.jsx)(Zv,{className:"size-3.5"}):(0,eb.jsx)(vh,{className:"size-3.5"})}),(0,eb.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 ui-text-kbd",children:Y.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[t>0&&(0,eb.jsx)("span",{className:"text-muted-foreground",children:N.pathSeparator}),(0,eb.jsx)("span",{className:tK("truncate",t===Y.length-1?"font-medium text-foreground":"text-muted-foreground"),children:e})]},`${e}-${t}`))}),(0,eb.jsxs)("div",{className:"hidden shrink-0 items-center gap-1.5 sm:flex",children:[X&&(0,eb.jsx)(cI,{variant:"outline",children:X}),q&&"code"===B&&(K?(0,eb.jsxs)(cI,{variant:"secondary",children:[(0,eb.jsx)(s5,{className:"size-3"}),N.review]}):(0,eb.jsxs)(cI,{variant:"outline",children:[(0,eb.jsx)(Zx,{className:"size-3"}),N.edit]}))]})]}),(0,eb.jsx)("div",{"data-slot":"file-tab-viewer-body",className:"min-h-0 overflow-hidden",children:G&&!_?(0,eb.jsx)(ZI,{file:e,labels:N,onApprove:()=>I(!0)}):"preview"===B?(0,eb.jsx)(ZT,{file:e,value:F,labels:N,renderPreview:g,className:b}):"hex"===B?(0,eb.jsx)(Z_,{file:e,value:F,labels:N}):(0,eb.jsx)(ZP,{file:e,value:F,readOnly:K,onValueChange:function(e){void 0===t&&E(e),r?.(e)},wrapLines:m,className:y})}),(0,eb.jsx)(ZR,{open:D,labels:N,currentView:B,currentMode:V,saving:R,modified:d,canSwitchView:W,canSwitchMode:q&&"code"===B,canSave:U,onOpenChange:T,onToggleView:function(){var e;e="code"===B?"preview":"code",void 0===l&&z(e),c?.(e)},onToggleMode:function(){var e;e="review"===V?"edit":"review",void 0===i&&P(e),o?.(e)},onSave:Z})]})}function Z$(e,t){return e[Math.max(0,t-1)]?.id??e[0]?.id}function ZF(e){return"string"==typeof e||"number"==typeof e?String(e):void 0}function ZV(e,t,n){let r=[...e],i=r[t],a=r[n];return i&&a&&(r[t]=a,r[n]=i),r}function ZB({tabs:e,defaultTabs:t=[],activeTabId:n,defaultActiveTabId:r,onActiveTabChange:i,onTabsChange:a,onCreateTab:o,onCloseTab:l,onTabReorder:s,onTabDetach:c,onExternalTabDrop:d,createActions:u=[],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),[z,_]=ew.useState(),[I,D]=ew.useState(void 0),T=ew.useRef(void 0),[R,L]=ew.useState(void 0),[$,F]=ew.useState(!1),V=ew.useRef(void 0),B=ew.useRef(void 0),H=ew.useRef(!1),[W,q]=ew.useState(!1),[U,K]=ew.useState(!1),[G,Y]=ew.useState(),X=e??E,Z=X.find(e=>!e.disabled),[J,Q]=ew.useState(r??Z?.id),ee=n??J,et=X.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),a?.(t)},[a,e]),er=ew.useCallback(e=>{T.current=e,D(e)},[]),ei=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},[]),ea=ew.useCallback((e,t=!0)=>{t&&(B.current=ei()),V.current=e,L(e)},[ei]),eo=ew.useCallback(()=>{let e=A.current;if(!e){q(!1),K(!1);return}let t=e.scrollWidth-e.clientWidth;q(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)}},[X.length,eo]),ew.useLayoutEffect(()=>{let e=B.current,t=A.current;if(e&&t)for(let n of(B.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 i=n.getBoundingClientRect(),a=r.left-i.left,o=r.top-i.top;1>Math.abs(a)&&1>Math.abs(o)||n.animate([{transform:`translate(${a}px, ${o}px)`},{transform:"translate(0, 0)"}],{duration:150,easing:"cubic-bezier(0.2, 0, 0, 1)"})}},[R]);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=V.current??X,r=n.findIndex(t=>t.id===e.tabId);if(-1===r)return;let i=t-e.offsetX,a=i+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&&a>=t.left+.7*t.width&&ea(ZV(n,r,r+1));return}if(!o&&s&&!s.disabled){let e=es(s.id),t=e?.getBoundingClientRect();t&&i<=t.right-.7*t.width&&ea(ZV(n,r,r-1))}},[es,X,ea]);function ed(e){if(!d||0===m.length)return!1;let t=Array.from(e.dataTransfer.types);return m.some(e=>t.includes(e))}function eu(e){let t=A.current;if(!t)return{index:X.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[i,a]of r.entries()){let r=a.getBoundingClientRect();if(e.clientX<r.left+r.width/2)return{index:i,left:r.left-n.left+t.scrollLeft}}let i=r[r.length-1].getBoundingClientRect();return{index:r.length,left:i.right-n.left+t.scrollLeft}}ew.useEffect(()=>{if(I)return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t,{once:!0}),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t)};function e(e){let t=T.current;if(!t)return;let n=e.clientX-t.startX,r=e.clientY-t.startY,i=t.dragging||Math.abs(n)>4||Math.abs(r)>4;i&&(e.preventDefault(),ec(t,e.clientX)),er({...t,currentX:e.clientX,currentY:e.clientY,dragging:i})}function t(e){let t=T.current;if(t?.dragging){e.preventDefault(),H.current=!0;let r=X.find(e=>e.id===t.tabId),a=P.current?.getBoundingClientRect(),o=!!a&&(e.clientX<a.left||e.clientX>a.right||e.clientY<a.top||e.clientY>a.bottom);if(p&&c&&r&&o&&function(e,t){if(e.pinned)return!1;let r=X.findIndex(t=>t.id===e.id);if(c?.(e,{tabs:X,clientX:t.clientX,clientY:t.clientY,nativeEvent:t})===!1)return!1;let a=X.filter(t=>t.id!==e.id);if(en(a),e.id===ee){let e=Z$(a,r);void 0===n&&Q(e),e&&i?.(e)}return!0}(r,e)){_(void 0),er(void 0),ea(void 0,!1);return}let l=V.current;l&&!(l.length===X.length&&l.every((e,t)=>e.id===X[t]?.id))&&(en(l),s?.(l))}_(void 0),er(void 0),ea(void 0,!1)}});let ef=et&&(k?.(et)??et.content??(0,eb.jsx)("div",{className:"grid min-h-44 place-items-center bg-muted/30 p-6 text-center text-muted-foreground",children:et.title})),eh=I?.dragging&&R?R:X,ep=I?.dragging?X.find(e=>e.id===I.tabId):void 0,em=I?.dragging&&ep&&$?(0,t3.createPortal)((0,eb.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:I.currentX-I.offsetX,top:I.top,width:I.width},children:[ep.icon&&(0,eb.jsx)("span",{className:"grid size-4 shrink-0 place-items-center text-muted-foreground [&_svg]:size-3.5",children:ep.icon}),(0,eb.jsx)("span",{className:"truncate ui-text-control font-medium",children:ep.title}),ep.modified&&(0,eb.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-foreground/70"})]}),document.body):null;return(0,eb.jsxs)("div",{ref:P,"data-slot":"multi-tab-system",className:tK("vtl-surface-panel grid min-h-0 grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-[var(--surface-panel-radius)] border",C),children:[(0,eb.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,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":y,onClick:()=>el("left"),className:"mb-1 shrink-0",children:(0,eb.jsx)(cO,{})}),(0,eb.jsxs)("div",{ref:A,role:"tablist","aria-label":w,"data-slot":"multi-tab-list",className:tK("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&&U?"both":W?"left":U?"right":void 0,onScroll:eo,onDragOver:function(e){ed(e)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move",Y(eu(e)))},onDragLeave:function(e){if(!ed(e))return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||Y(void 0)},onDrop:function(e){if(!ed(e))return;e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move";let t=eu(e);Y(void 0),d?.({tabs:X,insertIndex:t.index,nativeEvent:e})},children:[eh.map((e,t)=>{let r=e.id===et?.id,a=eh[t+1],o=I?.dragging&&z===e.id,s=!r&&!o&&void 0!==a&&a.id!==et?.id&&a.id!==z;return(0,eb.jsxs)(ew.Fragment,{children:[(0,eb.jsxs)("div",{onPointerDown:t=>(function(e,t){if(!h||e.disabled||0!==t.button)return;let n=t.currentTarget.getBoundingClientRect();_(e.id),ea(X,!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":z===e.id?"true":void 0,"data-modified":e.modified?"true":void 0,className:tK("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,eb.jsx)("button",{type:"button",role:"tab","aria-label":ZF(e.title),"aria-selected":r,disabled:e.disabled,onClick:t=>{var r;let a;if(H.current){H.current=!1,t.preventDefault();return}r=e.id,(a=X.find(e=>e.id===r))&&!a.disabled&&(void 0===n&&Q(r),i?.(r))},className:"absolute inset-0 rounded-t-lg outline-none focus-visible:ring-2 focus-visible:ring-ring/50"}),(0,eb.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,eb.jsx)("span",{className:"grid size-4 shrink-0 place-items-center text-muted-foreground [&_svg]:size-3.5",children:e.icon}),(0,eb.jsx)("span",{className:"truncate ui-text-control font-medium",children:e.title}),e.meta&&(0,eb.jsx)("span",{className:"shrink-0 ui-text-kbd text-muted-foreground",children:e.meta}),e.modified&&(0,eb.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-foreground/70"})]}),!e.pinned&&(0,eb.jsx)("button",{type:"button",draggable:!1,onPointerDown:e=>e.stopPropagation(),"aria-label":e.closeLabel??(ZF(e.title)?`${x}: ${ZF(e.title)}`:x),onClick:()=>(function(e){if(e.pinned)return;let t=X.findIndex(t=>t.id===e.id),r=X.filter(t=>t.id!==e.id);if(en(r),l?.(e),e.id===ee){let e=Z$(r,t);void 0===n&&Q(e),e&&i?.(e)}})(e),className:tK("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,eb.jsx)(p6,{className:"size-3.5"})})]}),s&&(0,eb.jsx)("span",{"aria-hidden":"true",className:"mb-2 h-4 w-px shrink-0 bg-border/80"})]},e.id)}),G?(0,eb.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,eb.jsx)("span",{className:"h-full w-px rounded-full bg-foreground/80"}),(0,eb.jsx)("span",{className:"absolute top-0 size-1.5 rounded-full bg-foreground"})]}):null]}),(0,eb.jsxs)("div",{className:"mb-1 flex shrink-0 items-center gap-1",children:[U&&(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":b,onClick:()=>el("right"),children:(0,eb.jsx)(vo,{})}),u.length>0?(0,eb.jsxs)(yu,{children:[(0,eb.jsx)(yh,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":g,children:(0,eb.jsx)(s7,{})})}),(0,eb.jsx)(yk,{align:"end",className:"w-52",children:u.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[e.separatorBefore&&(0,eb.jsx)(yM,{}),(0,eb.jsxs)(yS,{disabled:e.disabled,onSelect:e.onSelect,children:[e.icon,e.label,e.shortcut&&(0,eb.jsx)(yE,{children:e.shortcut})]})]},t))})]}):(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":g,onClick:function(){let e=o?.();e&&(en([...X,e]),e.disabled||(void 0===n&&Q(e.id),i?.(e.id)))},children:(0,eb.jsx)(s7,{})}),f.length>0&&(0,eb.jsxs)(yu,{children:[(0,eb.jsx)(yh,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":v,children:(0,eb.jsx)(s6,{})})}),(0,eb.jsx)(yk,{align:"end",className:"w-52",children:f.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[e.separatorBefore&&(0,eb.jsx)(yM,{}),(0,eb.jsxs)(yS,{disabled:e.disabled,onSelect:e.onSelect,children:[e.icon,e.label,e.shortcut&&(0,eb.jsx)(yE,{children:e.shortcut})]})]},t))})]})]})]}),em,S&&(0,eb.jsx)("div",{"data-slot":"multi-tab-content",className:tK("min-h-0 overflow-hidden",M),children:ef??j??(0,eb.jsx)("div",{"aria-hidden":"true",className:"min-h-44 rounded-lg border border-dashed bg-muted/30"})})]})}let ZH=[{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"}],ZW=Array.from(new Set(ZH.flatMap(e=>e.tags))).sort(),Zq=[["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"]],ZU=[["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"]],ZK=[{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}],ZG=[["14:42","Allay 将 Linux-runner-02 加入 Compute 机器组","done"],["14:37","Ops 对 runner 服务发起重启确认","current"],["14:25","UI Polish Agent 访问 D:\\Projects\\Vantaloom-ui","done"],["14:18","Viewer 请求远程 shell 被拒绝","blocked"],["14:07","Observer-01 P2P 心跳恢复","done"],["13:54","Buildbot 读取发布产物目录","done"]],ZY={p2p:{label:"P2P",color:"var(--chart-1)"},direct:{label:"Direct",color:"var(--chart-3)"},relay:{label:"Relay",color:"var(--chart-5)"},cpu:{label:"CPU",color:"var(--chart-1)"},memory:{label:"Memory",color:"var(--chart-3)"}};function ZX({className:e,...t}){return(0,eb.jsx)("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:tK("mx-auto flex w-full justify-center",e),...t})}function ZZ({className:e,...t}){return(0,eb.jsx)("ul",{"data-slot":"pagination-content",className:tK("flex flex-row items-center gap-1",e),...t})}function ZJ({...e}){return(0,eb.jsx)("li",{"data-slot":"pagination-item",...e})}function ZQ({className:e,isActive:t,size:n="icon",...r}){return(0,eb.jsx)("a",{"aria-current":t?"page":void 0,"data-slot":"pagination-link","data-active":t,className:tK(tG({variant:t?"outline":"ghost",size:n}),e),...r})}function Z0({className:e,previousLabel:t="Previous",...n}){return(0,eb.jsxs)(ZQ,{"aria-label":t,size:"default",className:tK("gap-1 px-2.5 sm:pl-2",e),...n,children:[(0,eb.jsx)(cO,{}),(0,eb.jsx)("span",{className:"hidden sm:block",children:t})]})}function Z1({className:e,nextLabel:t="Next",...n}){return(0,eb.jsxs)(ZQ,{"aria-label":t,size:"default",className:tK("gap-1 px-2.5 sm:pr-2",e),...n,children:[(0,eb.jsx)("span",{className:"hidden sm:block",children:t}),(0,eb.jsx)(vo,{})]})}function Z2({className:e,moreLabel:t="More pages",...n}){return(0,eb.jsxs)("span",{"aria-hidden":!0,"data-slot":"pagination-ellipsis",className:tK("flex size-8 items-center justify-center",e),...n,children:[(0,eb.jsx)(s6,{className:"size-4"}),(0,eb.jsx)("span",{className:"sr-only",children:t})]})}var Z5=[" ","Enter","ArrowUp","ArrowDown"],Z4=[" ","Enter"],Z3="Select",[Z6,Z8,Z7]=v_(Z3),[Z9,Je]=tX(Z3,[Z7,ut]),Jt=ut(),[Jn,Jr]=Z9(Z3),[Ji,Ja]=Z9(Z3),Jo=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:l,onValueChange:s,dir:c,name:d,autoComplete:u,disabled:f,required:h,form:p}=e,m=Jt(t),[g,v]=ew.useState(null),[x,y]=ew.useState(null),[b,w]=ew.useState(!1),j=fb(c),[k,S]=t0({prop:r,defaultProp:i??!1,onChange:a,caller:Z3}),[C,N]=t0({prop:o,defaultProp:l,onChange:s,caller:Z3}),M=ew.useRef(null),E=!g||p||!!g.closest("form"),[O,P]=ew.useState(new Set),A=Array.from(O).map(e=>e.props.value).join(";");return(0,eb.jsx)(ui,{...m,children:(0,eb.jsxs)(Jn,{required:h,scope:t,trigger:g,onTriggerChange:v,valueNode:x,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:w,contentId:cR(),value:C,onValueChange:N,open:k,onOpenChange:S,dir:j,triggerPointerDownPosRef:M,disabled:f,children:[(0,eb.jsx)(Z6.Provider,{scope:t,children:(0,eb.jsx)(Ji,{scope:e.__scopeSelect,onNativeOptionAdd:ew.useCallback(e=>{P(t=>new Set(t).add(e))},[]),onNativeOptionRemove:ew.useCallback(e=>{P(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),E?(0,eb.jsxs)(JH,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:u,value:C,onChange:e=>N(e.target.value),disabled:f,form:p,children:[void 0===C?(0,eb.jsx)("option",{value:""}):null,Array.from(O)]},A):null]})})};Jo.displayName=Z3;var Jl="SelectTrigger",Js=ew.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Jt(n),o=Jr(Jl,n),l=o.disabled||r,s=eT(t,o.onTriggerChange),c=Z8(n),d=ew.useRef("touch"),[u,f,h]=Jq(e=>{let t=c().filter(e=>!e.disabled),n=t.find(e=>e.value===o.value),r=JU(t,e,n);void 0!==r&&o.onValueChange(r.value)}),p=e=>{l||(o.onOpenChange(!0),h()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,eb.jsx)(uo,{asChild:!0,...a,children:(0,eb.jsx)(ne.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":JW(o.value)?"":void 0,...i,ref:s,onClick:tZ(i.onClick,e=>{e.currentTarget.focus(),"mouse"!==d.current&&p(e)}),onPointerDown:tZ(i.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(p(e),e.preventDefault())}),onKeyDown:tZ(i.onKeyDown,e=>{let t=""!==u.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||f(e.key),(!t||" "!==e.key)&&Z5.includes(e.key)&&(p(),e.preventDefault())})})})});Js.displayName=Jl;var Jc="SelectValue",Jd=ew.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o="",...l}=e,s=Jr(Jc,n),{onValueNodeHasChildrenChange:c}=s,d=void 0!==a,u=eT(t,s.onValueNodeChange);return tJ(()=>{c(d)},[c,d]),(0,eb.jsx)(ne.span,{...l,ref:u,style:{pointerEvents:"none"},children:JW(s.value)?(0,eb.jsx)(eb.Fragment,{children:o}):a})});Jd.displayName=Jc;var Ju=ew.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,eb.jsx)(ne.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});Ju.displayName="SelectIcon";var Jf=e=>(0,eb.jsx)(uv,{asChild:!0,...e});Jf.displayName="SelectPortal";var Jh="SelectContent",Jp=ew.forwardRef((e,t)=>{let n=Jr(Jh,e.__scopeSelect),[r,i]=ew.useState();return(tJ(()=>{i(new DocumentFragment)},[]),n.open)?(0,eb.jsx)(Jx,{...e,ref:t}):r?t3.createPortal((0,eb.jsx)(Jm,{scope:e.__scopeSelect,children:(0,eb.jsx)(Z6.Slot,{scope:e.__scopeSelect,children:(0,eb.jsx)("div",{children:e.children})})}),r):null});Jp.displayName=Jh;var[Jm,Jg]=Z9(Jh),Jv=t6("SelectContent.RemoveScroll"),Jx=ew.forwardRef((e,t)=>{let{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:l,sideOffset:s,align:c,alignOffset:d,arrowPadding:u,collisionBoundary:f,collisionPadding:h,sticky:p,hideWhenDetached:m,avoidCollisions:g,...v}=e,x=Jr(Jh,n),[y,b]=ew.useState(null),[w,j]=ew.useState(null),k=eT(t,e=>b(e)),[S,C]=ew.useState(null),[N,M]=ew.useState(null),E=Z8(n),[O,P]=ew.useState(!1),A=ew.useRef(!1);ew.useEffect(()=>{if(y)return pe(y)},[y]),hv();let z=ew.useCallback(e=>{let[t,...n]=E().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:"nearest"}),n===t&&w&&(w.scrollTop=0),n===r&&w&&(w.scrollTop=w.scrollHeight),n?.focus(),document.activeElement!==i))return},[E,w]),_=ew.useCallback(()=>z([S,y]),[z,S,y]);ew.useEffect(()=>{O&&_()},[O,_]);let{onOpenChange:I,triggerPointerDownPosRef:D}=x;ew.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(D.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(D.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||I(!1),document.removeEventListener("pointermove",t),D.current=null};return null!==D.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[y,I,D]),ew.useEffect(()=>{let e=()=>I(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[I]);let[T,R]=Jq(e=>{let t=E().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=JU(t,e,n);r&&setTimeout(()=>r.ref.current.focus())}),L=ew.useCallback((e,t,n)=>{let r=!A.current&&!n;(void 0!==x.value&&x.value===t||r)&&(C(e),r&&(A.current=!0))},[x.value]),$=ew.useCallback(()=>y?.focus(),[y]),F=ew.useCallback((e,t,n)=>{let r=!A.current&&!n;(void 0!==x.value&&x.value===t||r)&&M(e)},[x.value]),V="popper"===r?Jb:Jy,B=V===Jb?{side:l,sideOffset:s,align:c,alignOffset:d,arrowPadding:u,collisionBoundary:f,collisionPadding:h,sticky:p,hideWhenDetached:m,avoidCollisions:g}:{};return(0,eb.jsx)(Jm,{scope:n,content:y,viewport:w,onViewportChange:j,itemRefCallback:L,selectedItem:S,onItemLeave:$,itemTextRefCallback:F,focusSelectedItem:_,selectedItemText:N,position:r,isPositioned:O,searchRef:T,children:(0,eb.jsx)(h5,{as:Jv,allowPinchZoom:!0,children:(0,eb.jsx)(hd,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:tZ(i,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,eb.jsx)(cJ,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:(0,eb.jsx)(V,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:e=>e.preventDefault(),...v,...B,onPlaced:()=>P(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:tZ(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||R(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=E().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>z(t)),e.preventDefault()}})})})})})})});Jx.displayName="SelectContentImpl";var Jy=ew.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=Jr(Jh,n),o=Jg(Jh,n),[l,s]=ew.useState(null),[c,d]=ew.useState(null),u=eT(t,e=>d(e)),f=Z8(n),h=ew.useRef(!1),p=ew.useRef(!0),{viewport:m,selectedItem:g,selectedItemText:v,focusSelectedItem:x}=o,y=ew.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&c&&m&&g&&v){let e=a.trigger.getBoundingClientRect(),t=c.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=v.getBoundingClientRect();if("rtl"!==a.dir){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,c=Math.max(s,t.width),d=fw(a,[10,Math.max(10,window.innerWidth-10-c)]);l.style.minWidth=s+"px",l.style.left=d+"px"}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,c=Math.max(s,t.width),d=fw(a,[10,Math.max(10,window.innerWidth-10-c)]);l.style.minWidth=s+"px",l.style.right=d+"px"}let o=f(),s=window.innerHeight-20,d=m.scrollHeight,u=window.getComputedStyle(c),p=parseInt(u.borderTopWidth,10),x=parseInt(u.paddingTop,10),y=parseInt(u.borderBottomWidth,10),b=p+x+d+parseInt(u.paddingBottom,10)+y,w=Math.min(5*g.offsetHeight,b),j=window.getComputedStyle(m),k=parseInt(j.paddingTop,10),S=parseInt(j.paddingBottom,10),C=e.top+e.height/2-10,N=g.offsetHeight/2,M=p+x+(g.offsetTop+N);if(M<=C){let e=o.length>0&&g===o[o.length-1].ref.current;l.style.bottom="0px";let t=Math.max(s-C,N+(e?S:0)+(c.clientHeight-m.offsetTop-m.offsetHeight)+y);l.style.height=M+t+"px"}else{let e=o.length>0&&g===o[0].ref.current;l.style.top="0px";let t=Math.max(C,p+m.offsetTop+(e?k:0)+N);l.style.height=t+(b-M)+"px",m.scrollTop=M-C+m.offsetTop}l.style.margin="10px 0",l.style.minHeight=w+"px",l.style.maxHeight=s+"px",r?.(),requestAnimationFrame(()=>h.current=!0)}},[f,a.trigger,a.valueNode,l,c,m,g,v,a.dir,r]);tJ(()=>y(),[y]);let[b,w]=ew.useState();tJ(()=>{c&&w(window.getComputedStyle(c).zIndex)},[c]);let j=ew.useCallback(e=>{e&&!0===p.current&&(y(),x?.(),p.current=!1)},[y,x]);return(0,eb.jsx)(Jw,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:j,children:(0,eb.jsx)("div",{ref:s,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:b},children:(0,eb.jsx)(ne.div,{...i,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});Jy.displayName="SelectItemAlignedPosition";var Jb=ew.forwardRef((e,t)=>{let{__scopeSelect:n,align:r="start",collisionPadding:i=10,...a}=e,o=Jt(n);return(0,eb.jsx)(ud,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Jb.displayName="SelectPopperPosition";var[Jw,Jj]=Z9(Jh,{}),Jk="SelectViewport",JS=ew.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Jg(Jk,n),o=Jj(Jk,n),l=eT(t,a.onViewportChange),s=ew.useRef(0);return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),(0,eb.jsx)(Z6.Slot,{scope:n,children:(0,eb.jsx)(ne.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:tZ(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(s.current-t.scrollTop);if(e>0){let r=window.innerHeight-20,i=Math.max(parseFloat(n.style.minHeight),parseFloat(n.style.height));if(i<r){let a=i+e,o=Math.min(r,a),l=a-o;n.style.height=o+"px","0px"===n.style.bottom&&(t.scrollTop=l>0?l:0,n.style.justifyContent="flex-end")}}}s.current=t.scrollTop})})})]})});JS.displayName=Jk;var JC="SelectGroup",[JN,JM]=Z9(JC);ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=cR();return(0,eb.jsx)(JN,{scope:n,id:i,children:(0,eb.jsx)(ne.div,{role:"group","aria-labelledby":i,...r,ref:t})})}).displayName=JC;var JE="SelectLabel";ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=JM(JE,n);return(0,eb.jsx)(ne.div,{id:i.id,...r,ref:t})}).displayName=JE;var JO="SelectItem",[JP,JA]=Z9(JO),Jz=ew.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,l=Jr(JO,n),s=Jg(JO,n),c=l.value===r,[d,u]=ew.useState(a??""),[f,h]=ew.useState(!1),p=eT(t,e=>s.itemRefCallback?.(e,r,i)),m=cR(),g=ew.useRef("touch"),v=()=>{i||(l.onValueChange(r),l.onOpenChange(!1))};if(""===r)throw Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,eb.jsx)(JP,{scope:n,value:r,disabled:i,textId:m,isSelected:c,onItemTextChange:ew.useCallback(e=>{u(t=>t||(e?.textContent??"").trim())},[]),children:(0,eb.jsx)(Z6.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:(0,eb.jsx)(ne.div,{role:"option","aria-labelledby":m,"data-highlighted":f?"":void 0,"aria-selected":c&&f,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:p,onFocus:tZ(o.onFocus,()=>h(!0)),onBlur:tZ(o.onBlur,()=>h(!1)),onClick:tZ(o.onClick,()=>{"mouse"!==g.current&&v()}),onPointerUp:tZ(o.onPointerUp,()=>{"mouse"===g.current&&v()}),onPointerDown:tZ(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:tZ(o.onPointerMove,e=>{g.current=e.pointerType,i?s.onItemLeave?.():"mouse"===g.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:tZ(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&s.onItemLeave?.()}),onKeyDown:tZ(o.onKeyDown,e=>{(s.searchRef?.current===""||" "!==e.key)&&(Z4.includes(e.key)&&v()," "===e.key&&e.preventDefault())})})})})});Jz.displayName=JO;var J_="SelectItemText",JI=ew.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=Jr(J_,n),l=Jg(J_,n),s=JA(J_,n),c=Ja(J_,n),[d,u]=ew.useState(null),f=eT(t,e=>u(e),s.onItemTextChange,e=>l.itemTextRefCallback?.(e,s.value,s.disabled)),h=d?.textContent,p=ew.useMemo(()=>(0,eb.jsx)("option",{value:s.value,disabled:s.disabled,children:h},s.value),[s.disabled,s.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:g}=c;return tJ(()=>(m(p),()=>g(p)),[m,g,p]),(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(ne.span,{id:s.textId,...a,ref:f}),s.isSelected&&o.valueNode&&!o.valueNodeHasChildren?t3.createPortal(a.children,o.valueNode):null]})});JI.displayName=J_;var JD="SelectItemIndicator",JT=ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return JA(JD,n).isSelected?(0,eb.jsx)(ne.span,{"aria-hidden":!0,...r,ref:t}):null});JT.displayName=JD;var JR="SelectScrollUpButton",JL=ew.forwardRef((e,t)=>{let n=Jg(JR,e.__scopeSelect),r=Jj(JR,e.__scopeSelect),[i,a]=ew.useState(!1),o=eT(t,r.onScrollButtonChange);return tJ(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),i?(0,eb.jsx)(JV,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});JL.displayName=JR;var J$="SelectScrollDownButton",JF=ew.forwardRef((e,t)=>{let n=Jg(J$,e.__scopeSelect),r=Jj(J$,e.__scopeSelect),[i,a]=ew.useState(!1),o=eT(t,r.onScrollButtonChange);return tJ(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),i?(0,eb.jsx)(JV,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});JF.displayName=J$;var JV=ew.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Jg("SelectScrollButton",n),o=ew.useRef(null),l=Z8(n),s=ew.useCallback(()=>{null!==o.current&&(window.clearInterval(o.current),o.current=null)},[]);return ew.useEffect(()=>()=>s(),[s]),tJ(()=>{let e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),(0,eb.jsx)(ne.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:tZ(i.onPointerDown,()=>{null===o.current&&(o.current=window.setInterval(r,50))}),onPointerMove:tZ(i.onPointerMove,()=>{a.onItemLeave?.(),null===o.current&&(o.current=window.setInterval(r,50))}),onPointerLeave:tZ(i.onPointerLeave,()=>{s()})})});ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,eb.jsx)(ne.div,{"aria-hidden":!0,...r,ref:t})}).displayName="SelectSeparator";var JB="SelectArrow";ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Jt(n),a=Jr(JB,n),o=Jg(JB,n);return a.open&&"popper"===o.position?(0,eb.jsx)(uh,{...i,...r,ref:t}):null}).displayName=JB;var JH=ew.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=ew.useRef(null),a=eT(r,i),o=t1(t);return ew.useEffect(()=>{let e=i.current;if(!e)return;let n=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(o!==t&&n){let r=new Event("change",{bubbles:!0});n.call(e,t),e.dispatchEvent(r)}},[o,t]),(0,eb.jsx)(ne.select,{...n,style:{...ux,...n.style},ref:a,defaultValue:t})});function JW(e){return""===e||void 0===e}function Jq(e){let t=cY(e),n=ew.useRef(""),r=ew.useRef(0),i=ew.useCallback(e=>{let i=n.current+e;t(i),function e(t){n.current=t,window.clearTimeout(r.current),""!==t&&(r.current=window.setTimeout(()=>e(""),1e3))}(i)},[t]),a=ew.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return ew.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function JU(e,t,n){var r,i;let a=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=n?e.indexOf(n):-1,l=(r=e,i=Math.max(o,0),r.map((e,t)=>r[(i+t)%r.length]));1===a.length&&(l=l.filter(e=>e!==n));let s=l.find(e=>e.textValue.toLowerCase().startsWith(a.toLowerCase()));return s!==n?s:void 0}function JK({className:e,size:t="default",children:n,...r}){return(0,eb.jsxs)(Js,{"data-slot":"select-trigger","data-size":t,className:tK("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&>span]:line-clamp-1 [&>span]:flex [&>span]:items-center [&>span]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,(0,eb.jsx)(Ju,{asChild:!0,children:(0,eb.jsx)(cE,{className:"size-4 text-muted-foreground"})})]})}function JG({className:e,...t}){return(0,eb.jsx)(JL,{"data-slot":"select-scroll-up-button",className:tK("z-10 flex cursor-default items-center justify-center bg-[var(--surface-popover)] py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,eb.jsx)(vl,{})})}function JY({className:e,...t}){return(0,eb.jsx)(JF,{"data-slot":"select-scroll-down-button",className:tK("z-10 flex cursor-default items-center justify-center bg-[var(--surface-popover)] py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,eb.jsx)(cE,{})})}function JX({className:e,children:t,position:n="popper",align:r="center",...i}){return(0,eb.jsx)(Jf,{children:(0,eb.jsxs)(Jp,{"data-slot":"select-content","data-align-trigger":"item-aligned"===n,position:n,align:r,className:tK("vtl-surface-popover relative z-50 max-h-[var(--radix-select-content-available-height)] min-w-36 overflow-x-hidden overflow-y-auto rounded-[var(--surface-popover-radius)] border duration-100 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[align-trigger=true]:animate-none","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),...i,children:[(0,eb.jsx)(JG,{}),(0,eb.jsx)(JS,{"data-position":n,className:tK("p-1","popper"===n&&"w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),(0,eb.jsx)(JY,{})]})})}function JZ({className:e,children:t,...n}){return(0,eb.jsxs)(Jz,{"data-slot":"select-item",className:tK("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[(0,eb.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:(0,eb.jsx)(JT,{children:(0,eb.jsx)(nv,{})})}),(0,eb.jsx)(JI,{children:t})]})}function JJ({title:e}){return(0,eb.jsx)("h2",{className:"h-7 text-sm font-semibold tracking-normal",children:e})}function JQ(){let[e,t]=ew.useState(""),[n,r]=ew.useState("all"),[i,a]=ew.useState({allow:!1,drop:!1,deny:!1}),[o,l]=ew.useState(1),s=ew.useMemo(()=>["allow","drop","deny"].filter(e=>i[e]),[i]),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,eb.jsx)(J2,{zone:e.sourceZone})},{id:"sourceIPs",header:"源 IP",accessorKey:"sourceIPs",width:250,cell:({row:e})=>(0,eb.jsx)(J1,{items:e.sourceIPs,variant:"outline"}),copyValue:({row:e})=>e.sourceIPs.join(", ")},{id:"destinationZone",header:"目标区域",accessorKey:"destinationZone",width:112,cell:({row:e})=>(0,eb.jsx)(J2,{zone:e.destinationZone})},{id:"destinationIPs",header:"目标 IP",accessorKey:"destinationIPs",width:250,cell:({row:e})=>(0,eb.jsx)(J1,{items:e.destinationIPs,variant:"outline"}),copyValue:({row:e})=>e.destinationIPs.join(", ")},{id:"tags",header:"标签",accessorKey:"tags",width:220,cell:({row:e})=>(0,eb.jsx)(J1,{items:e.tags,variant:"secondary"}),copyValue:({row:e})=>e.tags.join(", ")},{id:"action",header:"动作",accessorKey:"action",width:96,cell:({row:e})=>(0,eb.jsx)(J5,{action:e.action})}],[]),d=ew.useMemo(()=>{let t=e.trim().toLowerCase();return ZH.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)),a="all"===n||e.tags.includes(n),o=!(i.allow||i.drop||i.deny)||i.allow&&"allow"===e.action||i.drop&&"drop"===e.action||i.deny&&"deny"===e.action;return r&&a&&o})},[i,e,n]),u=Math.max(1,Math.ceil(d.length/8)),f=Math.min(o,u),h=d.slice((f-1)*8,8*f);return ew.useEffect(()=>{l(1)},[i,e,n]),(0,eb.jsxs)("div",{className:"flex h-full min-h-0 flex-col p-3",children:[(0,eb.jsxs)("div",{className:"mb-3 flex shrink-0 items-center justify-between gap-3",children:[(0,eb.jsx)(JJ,{title:"防火墙策略"}),(0,eb.jsxs)(tY,{size:"sm",children:[(0,eb.jsx)(s7,{className:"size-4"}),"新增策略"]})]}),(0,eb.jsxs)("div",{className:"mb-3 grid shrink-0 grid-cols-[minmax(12rem,1fr)_10rem_auto] items-end gap-3",children:[(0,eb.jsxs)("label",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"搜索"}),(0,eb.jsxs)("span",{className:"relative",children:[(0,eb.jsx)(cz,{className:"pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground"}),(0,eb.jsx)(ny,{value:e,onChange:e=>t(e.target.value),placeholder:"搜索策略...",className:"pl-8"})]})]}),(0,eb.jsxs)("label",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"标签"}),(0,eb.jsxs)(Jo,{value:n,onValueChange:r,children:[(0,eb.jsx)(JK,{className:"w-full",children:(0,eb.jsx)(Jd,{placeholder:"全部标签"})}),(0,eb.jsxs)(JX,{children:[(0,eb.jsx)(JZ,{value:"all",children:"全部标签"}),ZW.map(e=>(0,eb.jsx)(JZ,{value:e,children:e},e))]})]})]}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"动作"}),(0,eb.jsxs)(yJ,{type:"multiple",variant:"outline",value:s,onValueChange:function(e){e.includes("clear")?(t(""),r("all"),a({allow:!1,drop:!1,deny:!1}),l(1)):a({allow:e.includes("allow"),drop:e.includes("drop"),deny:e.includes("deny")})},children:[(0,eb.jsx)(yQ,{value:"allow",children:"允许"}),(0,eb.jsx)(yQ,{value:"drop",children:"丢弃"}),(0,eb.jsx)(yQ,{value:"deny",children:"拒绝"}),(0,eb.jsx)(yQ,{value:"clear",children:"全部"})]})]})]}),(0,eb.jsx)(Gz,{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,eb.jsx)(J0,{page:f,totalPages:u,onPageChange:function(e){l(Math.min(u,Math.max(1,e)))}})]})}function J0({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]),i=r[0]??1,a=r[r.length-1]??t;function o(e,t){e.preventDefault(),n(t)}return(0,eb.jsx)(ZX,{className:"mt-3 shrink-0",children:(0,eb.jsxs)(ZZ,{className:"gap-2",children:[(0,eb.jsx)(ZJ,{children:(0,eb.jsx)(Z0,{href:"#",previousLabel:"上一页","aria-disabled":1===e,className:tK(1===e&&"pointer-events-none opacity-40"),onClick:t=>o(t,e-1)})}),i>1?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(ZJ,{children:(0,eb.jsx)(ZQ,{href:"#",size:"icon",onClick:e=>o(e,1),children:"1"})}),i>2?(0,eb.jsx)(ZJ,{children:(0,eb.jsx)(Z2,{moreLabel:"更多页"})}):null]}):null,r.map(t=>(0,eb.jsx)(ZJ,{children:(0,eb.jsx)(ZQ,{href:"#",size:"icon",isActive:e===t,onClick:e=>o(e,t),children:t})},t)),a<t?(0,eb.jsxs)(eb.Fragment,{children:[a<t-1?(0,eb.jsx)(ZJ,{children:(0,eb.jsx)(Z2,{moreLabel:"更多页"})}):null,(0,eb.jsx)(ZJ,{children:(0,eb.jsx)(ZQ,{href:"#",size:"icon",onClick:e=>o(e,t),children:t})})]}):null,(0,eb.jsx)(ZJ,{children:(0,eb.jsx)(Z1,{href:"#",nextLabel:"下一页","aria-disabled":e===t,className:tK(e===t&&"pointer-events-none opacity-40"),onClick:t=>o(t,e+1)})})]})})}function J1({items:e,variant:t}){return(0,eb.jsx)("div",{className:"flex min-w-48 flex-wrap gap-1",children:e.map(e=>(0,eb.jsx)(cI,{variant:t,children:e},e))})}function J2({zone:e}){return(0,eb.jsx)(cI,{variant:"Trust"===e?"secondary":"outline",children:e})}function J5({action:e}){return(0,eb.jsx)(cI,{variant:"allow"===e?"default":"destructive",children:{allow:"允许",drop:"丢弃",deny:"拒绝"}[e]})}function J4({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:(0,eb.jsx)("table",{"data-slot":"table",className:tK("w-full caption-bottom text-sm",e),...t})})}function J3({className:e,...t}){return(0,eb.jsx)("thead",{"data-slot":"table-header",className:tK("[&_tr]:border-b",e),...t})}function J6({className:e,...t}){return(0,eb.jsx)("tbody",{"data-slot":"table-body",className:tK("[&_tr:last-child]:border-0",e),...t})}function J8({className:e,...t}){return(0,eb.jsx)("tr",{"data-slot":"table-row",className:tK("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function J7({className:e,...t}){return(0,eb.jsx)("th",{"data-slot":"table-head",className:tK("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 J9({className:e,...t}){return(0,eb.jsx)("td",{"data-slot":"table-cell",className:tK("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-0.5",e),...t})}function Qe({title:e}){return(0,eb.jsx)("h2",{className:"h-7 text-sm font-semibold tracking-normal",children:e})}function Qt({title:e,headers:t,rows:n}){return(0,eb.jsxs)("div",{className:"flex h-full min-h-0 flex-col p-3",children:[(0,eb.jsx)(Qe,{title:e}),(0,eb.jsx)("div",{className:"mt-3 min-h-0 flex-1 overflow-auto",children:(0,eb.jsxs)(J4,{children:[(0,eb.jsx)(J3,{children:(0,eb.jsx)(J8,{children:t.map(e=>(0,eb.jsx)(J7,{children:e},e))})}),(0,eb.jsx)(J6,{children:n.map(e=>(0,eb.jsx)(J8,{children:e.map((e,t)=>(0,eb.jsx)(J9,{className:0===t?"font-medium":"text-muted-foreground",children:e},`${e}-${t}`))},e.join("-")))})]})})]})}function Qn(){return(0,eb.jsxs)("div",{className:"grid h-full min-h-0 content-start gap-3 p-3",children:[(0,eb.jsx)(Qe,{title:"策略申请"}),(0,eb.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,eb.jsx)(ny,{placeholder:"策略名称"}),(0,eb.jsx)(ny,{placeholder:"负责人"}),(0,eb.jsx)(ny,{placeholder:"源 CIDR"}),(0,eb.jsx)(ny,{placeholder:"目标 CIDR"})]}),(0,eb.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,eb.jsx)("div",{children:(0,eb.jsxs)(tY,{size:"sm",children:[(0,eb.jsx)(s7,{className:"size-4"}),"提交申请"]})})]})}function Qr(){return(0,eb.jsxs)(qg,{defaultValue:"policies",className:"vtl-firewall-workspace flex h-full min-h-0 flex-col",children:[(0,eb.jsx)("div",{className:"shrink-0 px-3 pt-3",children:(0,eb.jsxs)(qC,{className:"h-8",children:[(0,eb.jsx)(qN,{value:"policies",children:"防火墙策略"}),(0,eb.jsx)(qN,{value:"ip-addresses",children:"IP 地址"}),(0,eb.jsx)(qN,{value:"renewals",children:"续期"}),(0,eb.jsx)(qN,{value:"policy-request",children:"策略申请"}),(0,eb.jsx)(qN,{value:"user-settings",children:"用户设置"})]})}),(0,eb.jsx)(qM,{value:"policies",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(JQ,{})}),(0,eb.jsx)(qM,{value:"ip-addresses",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(Qt,{title:"IP 地址",headers:["地址","名称","区域","策略"],rows:Zq})}),(0,eb.jsx)(qM,{value:"renewals",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(Qt,{title:"续期",headers:["策略","续期时间","负责人"],rows:ZU})}),(0,eb.jsx)(qM,{value:"policy-request",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(Qn,{})}),(0,eb.jsx)(qM,{value:"user-settings",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(Qt,{title:"用户设置",headers:["设置","值"],rows:[["默认区域","Trust"],["审核提醒","14 天"],["申请审批","安全负责人"],["策略导出","已开启"]]})})]})}function Qi(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 Qa(e,t){let n=t.machineId||"local";return Qi((await H_(n,e.path)).items)}function Qo({className:e,onOpenFile:t}){let[n,r]=ew.useState([]),[i,a]=ew.useState(!1),[o,l]=ew.useState(0),s=ew.useCallback(async()=>{a(!0);try{let e=await Hz();r(e.roots.map(e=>({id:e.id,machineId:e.machineId,name:e.name,path:e.path,platform:e.platform,children:Qi(e.children)}))),l(e=>e+1)}catch{r([]),l(e=>e+1)}finally{a(!1)}},[]);return ew.useEffect(()=>{s()},[s]),(0,eb.jsx)(Ki,{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:i?n.map(e=>e.id):[],labels:{title:"Explorer",refresh:"刷新",collapseAll:"折叠",empty:"没有文件",noResults:"没有匹配文件",loading:"读取中..."},onLoadChildren:Qa,onOpenNode:(e,n)=>{"folder"!==e.kind&&t?.({machineId:n.machineId||"local",path:e.path})},onRefresh:()=>{s()}},o)}function Ql({open:e,onOpenChange:t,onSelectFile:n}){return(0,eb.jsx)(po,{open:e,onOpenChange:t,children:(0,eb.jsxs)(p7,{className:"h-[min(42rem,calc(100svh-2rem))] max-w-2xl gap-0 overflow-hidden p-0",children:[(0,eb.jsx)(me,{className:"sr-only",children:"选择文件"}),(0,eb.jsx)(mt,{className:"sr-only",children:"选择本机可访问文件。"}),(0,eb.jsx)(Qo,{className:"size-full max-w-none rounded-none border-0",onOpenFile:e=>{n(e),t(!1)}})]})})}JH.displayName="SelectBubbleInput";let Qs=eN("shield-check",[["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:"m9 12 2 2 4-4",key:"dzmm74"}]]),Qc=eN("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 Qd({open:e,placement:t="viewport",movePermissionGranted:n,onOpenChange:r,onAdd:i,onMovePermissionGrantedChange:a}){let o=[{key:"move-permission",label:n?"取消放行权限":"放行权限",icon:n?(0,eb.jsx)(Qs,{className:"size-4"}):(0,eb.jsx)(Qc,{className:"size-4"}),pressed:n,onClick:()=>a(!n)},{key:"add",label:"新建文件窗口",icon:(0,eb.jsx)(s7,{className:"size-4"}),pressed:void 0,onClick:i}];return(0,eb.jsx)("div",{className:tK("right-5 bottom-5 z-50","viewport"===t?"fixed":"absolute"),children:(0,eb.jsxs)("div",{className:"relative size-8",children:[o.map((t,n)=>(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.label,"aria-pressed":t.pressed,title:t.label,onClick:t.onClick,className:tK("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,eb.jsx)(tY,{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,eb.jsx)(s6,{className:tK("size-4 transition-transform",e&&"rotate-90")})})]})})}let Qu=[];function Qf(e,t){return`${e} / ${t.replace(/\\/g," / ").replace(/\//g," / ")}`}function Qh(e,t){return e.replace(/\\/g,"/").toLowerCase()===t.replace(/\\/g,"/").toLowerCase()}function Qp(e,t){let n=e.replace(/\\/g,"/").replace(/\/+/g,"/");return"windows"===t?n.toLowerCase():n}function Qm(e){return e.map(e=>({...e,children:e.children?Qm(e.children):void 0}))}let Qg=eN("move-right",[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]),Qv=eN("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"}]]),Qx=eN("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"}]]),Qy={title:"Clipboard",empty:"No clips",dragHandle:"Drag clip"};function Qb({items:e,expanded:t,defaultExpanded:n=!1,expansionDirection:r="down-left",title:i,labels:a,maxCollapsedItems:o=10,maxExpandedHeight:l=360,acceptExternalDrops:s=!1,removeOnExternalDrop:c=!1,className:d,onExpandedChange:u,onItemDragStart:f,onItemDragEnd:h,onItemDuplicate:p,onItemsRemove:m,onItemsReorder:g,onExternalDrop:v,onMouseEnter:x,onMouseLeave:y,...b}){let w={...Qy,...a},[j,k]=ew.useState(n),[S,C]=ew.useState(),[N,M]=ew.useState(),[E,O]=ew.useState(n),[P,A]=ew.useState(),[z,_]=ew.useState({canScrollDown:!1,canScrollUp:!1}),[I,D]=ew.useState(!1),[T,R]=ew.useState(!1),L=ew.useRef(0),$=ew.useRef(void 0),F=ew.useRef(!1),V=ew.useRef(null),B=ew.useRef(null),H=void 0!==t,W=(H?t:j)||void 0!==S,q=Math.min(o,10),U=W?e:e.slice(0,q),K=E?N:void 0,G=44*U.length+18,Y=Math.min(G,l),X=W&&G>Y,Z=0===e.length?"h-24":W?`${Y}px`:"h-28",J=W&&X?14:0;ew.useEffect(()=>{if(!W){O(!1),_({canScrollDown:!1,canScrollUp:!1});return}O(!1),window.requestAnimationFrame(()=>{B.current&&(B.current.scrollTop=0)}),_({canScrollUp:!1,canScrollDown:G>Y});let e=window.setTimeout(()=>{O(!0)},260);return()=>window.clearTimeout(e)},[G,Y,W]),ew.useEffect(()=>()=>{void 0!==$.current&&window.clearTimeout($.current)},[]);let Q=ew.useCallback(e=>{H||k(e),u?.(e)},[H,u]);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||!B.current)return 0;let t=Array.from(B.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(()=>{V.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||!X||!K||!B.current)return;let e=U.findIndex(e=>e.id===K);if(e<0)return;let t=B.current,n=44*e-8,r=44*e+(U[e]?.expandedHeight??220)+12,i=t.scrollTop,a=i+t.clientHeight;n<i?t.scrollTo({top:Math.max(0,n),behavior:"smooth"}):r>a&&t.scrollTo({top:r-t.clientHeight,behavior:"smooth"})},[K,X,U,W]),(0,eb.jsxs)("div",{ref:V,"data-slot":"clipboard-stack","data-expanded":W,"data-closing":I,"data-external-dragging":T,"data-expansion-direction":r,className:tK("group/clipboard relative w-80 max-w-full overflow-visible py-2",d),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,R(!0),D(!1))},onDragLeave:function(e){!s||en(e)||(L.current=Math.max(0,L.current-1),0===L.current&&(R(!1),A(void 0)))},onDragOver:function(e){!s||en(e)||(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy",R(!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,R(!1),A(void 0),v?.({insertIndex:n,items:e,nativeEvent:t})},...b,children:[(0,eb.jsxs)("div",{"data-slot":"clipboard-stack-header",className:tK("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,eb.jsx)("span",{className:"inline-flex size-6 items-center justify-center rounded-lg border bg-background text-muted-foreground",children:(0,eb.jsx)(Qx,{className:"size-3.5"})}),(0,eb.jsx)("span",{children:i??w.title}),(0,eb.jsx)("span",{className:"ml-auto tabular-nums text-muted-foreground",children:e.length})]}),(0,eb.jsxs)("div",{"data-slot":"clipboard-stack-list",className:tK("relative transition-[height] duration-300 ease-[cubic-bezier(.2,.8,.2,1)]"),style:{height:Z},children:[e.length>0&&"down-left"===r?(0,eb.jsx)("span",{"data-slot":"clipboard-stack-pivot","aria-hidden":"true",className:tK("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&&T?(0,eb.jsxs)("span",{"data-slot":"clipboard-stack-external-ghost","aria-hidden":"true",className:tK("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,eb.jsx)("span",{className:"absolute top-3 right-[34px] size-2 rounded-full bg-foreground dark:bg-background"}),(0,eb.jsx)("span",{className:"absolute top-4 left-3 h-2 w-24 rounded-full bg-foreground/18"}),(0,eb.jsx)("span",{className:"absolute top-8 left-3 h-1.5 w-14 rounded-full bg-foreground/10"})]}):null,0===e.length?(0,eb.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,eb.jsxs)("div",{"data-slot":"clipboard-stack-scroll-frame",className:"relative h-full",children:[(0,eb.jsx)("div",{"data-slot":"clipboard-stack-scroll",ref:B,className:tK("relative h-full overflow-x-visible",W&&X?"clipboard-stack-scrollbar-hidden overflow-y-auto pt-2 pr-1 pb-3":"overflow-visible"),onScroll:e=>{let t=e.currentTarget;_({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 i=e.filter(e=>e.id!==S),a=Math.max(0,Math.min(P>n?P-1:P,i.length));i.splice(a,0,r),A(void 0),M(void 0),a!==n&&g?.(i,{item:r,fromIndex:n,toIndex:a,items:i})},children:(0,eb.jsxs)("div",{"data-slot":"clipboard-stack-scroll-content",className:"relative",style:{width:W&&X?`calc(100% - ${J}px)`:void 0,marginLeft:W&&X?`${J}px`:void 0,height:W&&X?G+28:W?G:"100%"},children:[void 0!==P?(0,eb.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,eb.jsx)("span",{className:"h-px flex-1 bg-foreground/70"}),(0,eb.jsx)("span",{className:"mx-1 size-1.5 rounded-full bg-foreground"}),(0,eb.jsx)("span",{className:"h-px flex-1 bg-foreground/70"})]}):null,U.map((t,n)=>(0,eb.jsx)(Qw,{item:t,index:n,count:U.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,i=e.findIndex(e=>e.id===r),a=c&&!F.current&&"none"!==n&&i>=0;if(C(void 0),A(void 0),M(void 0),F.current?F.current=!1:Q(!1),a){let n=e.filter(e=>e.id!==r);m?.(n,{item:t.item,index:i,items:n})}h?.(t)}},t.id))]})}),X&&z.canScrollUp?(0,eb.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,X&&z.canScrollDown?(0,eb.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 Qw({item:e,index:t,count:n,expanded:r,active:i,top:a,expansionDirection:o,labels:l,onHover:s,onDuplicate:c,onDragOver:d,onDragStart:u,onDragEnd:f}){let h=Math.min(t,9),p="down-left"===o?-(4.5*h):[-4,2,-1,4][h]??0,m=r?i?n+20:n-t:n+t;return(0,eb.jsx)("article",{"data-slot":"clipboard-stack-card",draggable:!e.disabled,"aria-disabled":e.disabled,className:tK("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&&!i&&"max-h-11",e.disabled&&"cursor-not-allowed opacity-50"),style:{top:r?a??44*t:"down-left"===o?0:9*h,zIndex:m,maxHeight:r&&i?e.expandedHeight??220:void 0,transformOrigin:"down-left"===o?"calc(100% - 34px) 14px":"100% 0",transform:r?i?"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:d,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);u?.({item:e,nativeEvent:t})},onDragEnd:function(t){f?.({item:e,nativeEvent:t})},children:(0,eb.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,eb.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,eb.jsx)(Qx,{className:"size-4"})}),(0,eb.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,eb.jsx)("p",{className:"truncate text-sm font-medium",children:e.title}),e.meta?(0,eb.jsx)("span",{className:"ml-auto shrink-0 text-xs tabular-nums text-muted-foreground",children:e.meta}):null]}),e.description?(0,eb.jsx)("p",{className:tK("mt-0.5 text-xs leading-5 text-muted-foreground transition-[max-height,opacity,transform] duration-200",i?"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,eb.jsx)("div",{className:tK("mt-2 text-xs text-muted-foreground transition-[max-height,opacity,transform] duration-200",i?"max-h-80 translate-y-0 opacity-100":"max-h-0 -translate-y-1 overflow-hidden opacity-0"),children:e.content}):null]}),(0,eb.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,eb.jsx)(HY,{className:"size-3.5"})})]})})}function Qj({transfers:e}){let t=e.slice(0,10);if(0===t.length)return null;let n=t.map(e=>{var t,n,r;let i,a,o;return{id:e.id,title:(i="copy"===(t=e).mode?"复制":"移动",a=t.sources.length,o=t.sources[0],`${i} ${a>1?`${a} 项`:QS(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,eb.jsx)(WJ,{className:"size-4"}):"failed"===r.status?(0,eb.jsx)(Qv,{className:"size-4"}):"running"===r.status?(0,eb.jsx)(WQ,{className:"size-4 animate-spin"}):"copy"===r.mode?(0,eb.jsx)(s0,{className:"size-4"}):(0,eb.jsx)(Qg,{className:"size-4"}),expandedHeight:132,content:(0,eb.jsx)(Qk,{transfer:e})}});return(0,eb.jsx)("div",{className:"pointer-events-auto fixed top-4 right-4 z-50 w-80 max-w-[calc(100vw-2rem)]",children:(0,eb.jsx)(Qb,{items:n,title:"传输",labels:{empty:"暂无传输",dragHandle:"传输任务"},expansionDirection:"down-left",maxExpandedHeight:420})})}function Qk({transfer:e}){let t=Math.max(0,Math.min(100,e.progress?.percent??0));return(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsx)("div",{className:"h-1.5 overflow-hidden rounded-full bg-border",children:(0,eb.jsx)("div",{className:"h-full rounded-full bg-foreground transition-[width] duration-300",style:{width:`${t}%`}})}),(0,eb.jsxs)("div",{className:"grid gap-1 tabular-nums",children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[(0,eb.jsx)("span",{className:"truncate",children:QS(e.target.path)}),(0,eb.jsxs)("span",{children:[Math.round(t),"%"]})]}),(0,eb.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2 text-muted-foreground",children:[(0,eb.jsxs)("span",{className:"truncate",children:[QC(e.progress.bytesDone)," /"," ",QC(e.progress.bytesTotal)]}),(0,eb.jsxs)("span",{children:[e.progress.entriesDone,"/",e.progress.entriesTotal]})]}),e.progress.currentPath?(0,eb.jsx)("div",{className:"truncate text-muted-foreground",children:QS(e.progress.currentPath)}):null]})]})}function QS(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function QC(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 QN=eN("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);function QM({windowLayout:e,roots:t,active:n,zIndex:r,boardSize:i,onActivate:a,onClose:o,onMinimize:l,onWindowChange:s,onNavigate:c,onRootsChange:d,onCreateFolder:u,onRenameItem:f,onDeleteItems:h,onMoveItems:p}){return(0,eb.jsxs)("section",{className:tK("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:a,children:[(0,eb.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),a();let n=t.clientX,r=t.clientY;function i(t){let i=Math.max(0,e.x+t.clientX-n),a=Math.max(0,e.y+t.clientY-r);s({...e,x:i,y:a})}window.addEventListener("pointermove",i),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",e)})},children:[(0,eb.jsxs)("div",{className:"flex items-center gap-1",children:[(0,eb.jsx)(tY,{type:"button",size:"icon-sm",variant:"ghost","aria-label":"关闭窗口",onPointerDown:e=>e.stopPropagation(),onClick:o,children:(0,eb.jsx)(p6,{})}),(0,eb.jsx)(tY,{type:"button",size:"icon-sm",variant:"ghost","aria-label":"缩小到剪切板",onPointerDown:e=>e.stopPropagation(),onClick:l,children:(0,eb.jsx)(QN,{})})]}),(0,eb.jsx)("div",{className:"truncate text-center ui-text-control",children:e.title}),(0,eb.jsx)("div",{className:"w-14"})]}),(0,eb.jsx)(bn,{roots:t,variant:"full",currentRootId:e.rootId,currentPath:e.path,draggableItems:!0,onNavigate:c,onRootsChange:e=>d(e),onCreateFolder:u,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,eb.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),a();let n=t.clientX,r=t.clientY;function o(t){let a=Math.max(420,Math.min(Math.max(420,i.width-e.x),e.w+t.clientX-n)),o=Math.max(320,e.h+t.clientY-r);s({...e,w:a,h:o})}window.addEventListener("pointermove",o),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",o),window.removeEventListener("pointerup",e)})}})]})}function QE({clipboardItems:e=[],onClipboardItemsChange:t}){var n;return n=(0,eb.jsx)(QO,{clipboardItems:e,onClipboardItemsChange:t,className:"min-h-[calc(100svh-5rem)] p-4 lg:p-6",minBoardHeight:820,actionsPlacement:"viewport"}),(0,eb.jsx)(f5,{children:n})}function QO({clipboardItems:e=[],onClipboardItemsChange:t,className:n,minBoardHeight:r=520,actionsPlacement:i="container"}){let[a,o]=f3(),[l,s]=ew.useState([]),[c,d]=ew.useState(Qu),[u,f]=ew.useState(Qu[0]?.id),[h,p]=ew.useState([]),[m,g]=ew.useState(!1),[v,x]=ew.useState(!1),[y,b]=ew.useState(),w=ew.useRef(Qu.length),j=ew.useRef(!1),k=ew.useRef(new Set),S=ew.useCallback(async(e,t,n)=>{let r=await H_(e,n);s(n=>{var i;return i={...r,root:{...r.root,id:t,machineId:e}},n.map(e=>e.id!==i.root.id?e:Qh(e.path,i.path)?{...e,children:Qm(i.items)}:{...e,children:function(e,t,n,r,i){let a=function(e,t,n){let r=Qp(e,n),i=Qp(t,n);if(r===i)return[];let a=r.endsWith("/")?r:`${r}/`;return i.startsWith(a)?i.slice(a.length).split("/").filter(Boolean):[]}(t,n,r);if(0===a.length)return Qm(i);let o="windows"===r?"\\":"/";return function e(t,n,r){let l=a[r];if(!l)return Qm(i);let s=n===o?`${o}${l}`:`${n.replace(/[\\/]+$/,"")}${o}${l}`,c=t.findIndex(e=>Qh(e.path,s)),d=t[c],u={...d??{id:`synthetic-${s}`,name:l,kind:"folder",path:s,children:[]},kind:"folder",children:e(d?.children??[],s,r+1)};if(c<0)return[...t,u];let f=[...t];return f[c]=u,f}(e,t,0)}(e.children,e.path,i.path,e.platform,i.items)})})},[]),C=ew.useCallback(async()=>{let e=QA((await HF()).transfers);return p(e),e},[]),N=ew.useCallback(e=>{p(t=>QA([e,...t.filter(t=>t.id!==e.id)]))},[]),M=ew.useCallback(e=>{H$({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){d(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=a.current?.getBoundingClientRect(),i=r?.width??o.width,s=r?.height??o.height,c=e?.w??680,u=e?.h??460,h=Math.max(0,(i-c)/2),p=Math.max(0,(s-u)/2),m={id:n,title:e?.title??Qf(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:u};d(e=>[...e,m]),f(n),S(m.machineId,m.rootId,m.path)}return ew.useEffect(()=>{let e=!0;return(async function(){let t=await Hz();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:Qf(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]);d([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]),(0,eb.jsxs)("div",{ref:a,className:tK("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=a.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,eb.jsx)("div",{className:"relative h-full min-h-0",style:{minHeight:Math.max(r,o.height-48)},children:c.map((n,r)=>(0,eb.jsx)(QM,{windowLayout:n,roots:l,active:u===n.id,zIndex:20+r+20*(u===n.id),boardSize:o,onActivate:()=>f(n.id),onClose:()=>d(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}`)]),d(e=>e.filter(e=>e.id!==n.id))},onWindowChange:e=>O(n.id,()=>e),onNavigate:({rootId:e,path:t})=>{let r=l.find(t=>t.id===e),i=r?.machineId??n.machineId;O(n.id,n=>({...n,machineId:i,rootId:e,path:t,title:Qf(r?.name??i,t)})),S(i,e,t)},onRootsChange:s,onCreateFolder:(e,t)=>{HT({machineId:n.machineId,path:e.path,name:t}).then(()=>S(n.machineId,n.rootId,n.path)).catch(()=>{})},onRenameItem:(e,t)=>{HR({machineId:n.machineId,path:e.path,name:t}).then(()=>S(n.machineId,n.rootId,n.path)).catch(()=>{})},onDeleteItems:e=>{HL({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 i=l.find(t=>t.id===e);if(!i)return;let a=t.flatMap(e=>{let t=function e(t,n){for(let r of t){if(r.id===n)return r;let t=r.children?e(r.children,n):void 0;if(t)return t}}(i.children,e);return t?[{machineId:i.machineId,path:t.path,name:t.name}]:[]});if(0===a.length)return;let o={sources:a,target:{machineId:n.machineId,path:r.path,name:r.name}};v?M(o):b(o)}},n.id))}),(0,eb.jsx)(Qj,{transfers:h}),(0,eb.jsx)(Qd,{open:m,placement:i,movePermissionGranted:v,onOpenChange:g,onMovePermissionGrantedChange:x,onAdd:()=>{g(!1),P()}}),(0,eb.jsx)(QP,{move:y,onCancel:()=>b(void 0),onConfirm:e=>{b(void 0),M(e)}})]})}function QP({move:e,onCancel:t,onConfirm:n}){var r;let i=e?.sources??[],a=Math.max(0,i.length-4);return(0,eb.jsx)(m8,{open:void 0!==e,onOpenChange:e=>{e||t()},children:(0,eb.jsxs)(gm,{children:[(0,eb.jsxs)(gg,{children:[(0,eb.jsx)(gx,{children:"确认移动"}),(0,eb.jsx)(gy,{children:e?`将 ${1===(r=i).length?r[0]?Qz(r[0]):"0 项":`${r.length} 项`} 移动到 ${Qz(e.target)}`:""})]}),e?(0,eb.jsxs)("div",{className:"grid gap-2 rounded-lg border bg-muted/20 p-3 ui-text-body",children:[(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"text-muted-foreground ui-text-kbd",children:"移动内容"}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[i.slice(0,4).map(e=>(0,eb.jsx)("span",{className:"truncate",children:Qz(e)},`${e.machineId}:${e.path}`)),a>0?(0,eb.jsxs)("span",{className:"text-muted-foreground",children:["另有 ",a," 项"]}):null]})]}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"text-muted-foreground ui-text-kbd",children:"目标位置"}),(0,eb.jsx)("span",{className:"truncate",children:Qz(e.target)})]})]}):null,(0,eb.jsxs)(gv,{children:[(0,eb.jsx)(gw,{children:"取消"}),(0,eb.jsx)(gb,{onClick:()=>{e&&n(e)},children:"确认移动"})]})]})})}function QA(e){return e.slice(0,10)}function Qz(e){let t=e.path.replace(/\\/g,"/");return`${e.machineId} / ${e.name||t}`}function Q_({className:e}){return(0,eb.jsx)(QO,{className:tK("h-full min-h-0 w-full rounded-[inherit] border-0 shadow-none",e),minBoardHeight:360,actionsPlacement:"container"})}var QI=["type"],QD=["dangerouslySetInnerHTML","ticks","scale"],QT=["id","scale"];function QR(){return(QR=Object.assign.bind()).apply(null,arguments)}function QL(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 Q$(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?QL(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QL(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function QF(e,t){if(null==e)return{};var n,r,i=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 a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function QV(e){var t=ww(),n=(0,ew.useRef)(null),r=SR(),{type:i}=e,a=QF(e,QI),o=Cz(r,"yAxis",i),l=(0,ew.useMemo)(()=>{if(null!=o)return Q$(Q$({},a),{},{type:o})},[o,a]);return(0,ew.useLayoutEffect)(()=>{null!=l&&(null===n.current?t(Ip(l)):n.current!==l&&t(Im({prev:n.current,next:l})),n.current=l)},[l,t]),(0,ew.useLayoutEffect)(()=>()=>{n.current&&(t(Ig(n.current)),n.current=null)},[t]),null}function QB(e){var{yAxisId:t,className:n,width:r,label:i}=e,a=(0,ew.useRef)(null),o=(0,ew.useRef)(null),l=wC(Sc),s=Su(),c=ww(),d="yAxis",u=wC(e=>zH(e,t)),f=wC(e=>zB(e,t)),h=wC(e=>zG(e,d,t,s)),p=wC(e=>Ap(e,t));if((0,ew.useLayoutEffect)(()=>{if(!("auto"!==r||!u||NG(i)||(0,ew.isValidElement)(i))&&null!=p){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(u.width)!==Math.round(n)&&c(Ib({id:t,width:n}))}}},[h,u,c,i,t,r,p]),null==u||null==f||null==p)return null;var{dangerouslySetInnerHTML:m,ticks:g,scale:v}=e,x=QF(e,QD),{id:y,scale:b}=p,w=QF(p,QT);return ew.createElement(Lw,QR({},x,w,{ref:a,labelRef:o,x:f.x,y:f.y,tickTextProps:"auto"===r?{width:void 0}:{width:r},width:u.width,height:u.height,className:eH("recharts-".concat(d," ").concat(d),n),viewBox:l,ticks:h,axisType:d,axisId:t}))}var QH={allowDataOverflow:Ah.allowDataOverflow,allowDecimals:Ah.allowDecimals,allowDuplicatedCategory:Ah.allowDuplicatedCategory,angle:Ah.angle,axisLine:Lm.axisLine,hide:!1,includeHidden:Ah.includeHidden,interval:Ah.interval,label:!1,minTickGap:Ah.minTickGap,mirror:Ah.mirror,orientation:Ah.orientation,padding:Ah.padding,reversed:Ah.reversed,scale:Ah.scale,tick:Ah.tick,tickCount:Ah.tickCount,tickLine:Lm.tickLine,tickSize:Lm.tickSize,type:Ah.type,niceTicks:Ah.niceTicks,width:Ah.width,yAxisId:0},QW=ew.memo(e=>{var t=Cs(e,QH);return ew.createElement(ew.Fragment,null,ew.createElement(QV,{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(QB,t))},LW);function Qq({machines:e,defaultMachineId:t,className:n,...r}){let[i,a]=ew.useState(t??e[0]?.id),o=e.find(e=>e.id===i)??e[0],[l,s]=ew.useState({});if(!o)return null;let c=l[o.id]??o.selectedMetricId??o.metrics[0]?.id,d=o.metrics.find(e=>e.id===c)??o.metrics[0];return(0,eb.jsxs)("div",{className:tK("vtl-surface-card flex h-full min-h-0 flex-col rounded-[var(--surface-card-radius)] border","vtl-performance-monitor",n),...r,children:[(0,eb.jsx)(qg,{value:o.id,onValueChange:a,className:"shrink-0 px-3 pt-3",children:(0,eb.jsx)(qC,{className:"h-8",children:e.map(e=>(0,eb.jsx)(qN,{value:e.id,children:e.name},e.id))})}),(0,eb.jsxs)("div",{className:"mt-3 grid min-h-0 flex-1 grid-cols-[14rem_minmax(0,1fr)] border-t",children:[(0,eb.jsx)("div",{className:"min-h-0 overflow-auto border-r p-2",children:o.metrics.map(e=>(0,eb.jsxs)("button",{type:"button",onClick:()=>s(t=>({...t,[o.id]:e.id})),className:tK("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,eb.jsx)(QZ,{data:e.data,color:e.color}),(0,eb.jsxs)("span",{className:"min-w-0",children:[(0,eb.jsx)("span",{className:"block truncate text-base leading-tight",children:e.label}),(0,eb.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.value}),e.detail?(0,eb.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.detail}):null]})]},e.id))}),(0,eb.jsxs)("div",{className:"min-h-0 overflow-auto p-5",children:[(0,eb.jsxs)("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] items-start gap-5",children:[(0,eb.jsxs)("div",{children:[(0,eb.jsx)("h2",{className:"text-4xl leading-none font-semibold tracking-normal",children:d?.title}),d?.subtitle?(0,eb.jsx)("p",{className:"mt-1 text-base text-muted-foreground",children:d.subtitle}):null]}),(0,eb.jsx)("div",{className:"text-right text-sm text-muted-foreground",children:d?.detail})]}),d?(0,eb.jsx)(QU,{metric:d}):null]})]})]})}function QU({metric:e}){return"cpu"===e.kind?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(QK,{panel:{id:"cpu",title:"% 利用率",value:"100%",data:e.data,span:"full"},size:"large"}),(0,eb.jsx)(QG,{}),(0,eb.jsx)(QX,{details:e.details,columns:4})]}):"memory"===e.kind?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(QK,{panel:{id:"memory",title:"内存使用量",value:e.detail,data:e.data,span:"full"},size:"large"}),(0,eb.jsx)(QG,{}),(0,eb.jsx)(QY,{segments:e.composition}),(0,eb.jsx)(QX,{details:e.details,columns:3})]}):"disk"===e.kind?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(QK,{panel:{id:"disk-active",title:"活动时间",value:"100%",data:e.data,span:"full"},size:"large"}),(0,eb.jsx)(QG,{}),(0,eb.jsx)(QK,{panel:{id:"disk-rate",title:"磁盘传输速率",value:"500 KB/秒",data:e.panels?.[0]?.data??e.data,span:"full"},size:"short"}),(0,eb.jsx)(QG,{}),(0,eb.jsx)(QX,{details:e.details,columns:4})]}):"network"===e.kind?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(QK,{panel:{id:"network",title:"吞吐量",value:"100 Kbps",data:e.data,span:"full",color:"danger"},size:"tall"}),(0,eb.jsx)(QG,{}),(0,eb.jsx)(QX,{details:e.details,columns:2})]}):(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("div",{className:"mt-5 grid grid-cols-2 gap-3",children:(e.panels??[]).map(e=>(0,eb.jsx)(QK,{panel:e},e.id))}),(0,eb.jsx)(QX,{details:e.details,columns:3})]})}function QK({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,eb.jsxs)("div",{className:tK("mt-5","full"===e.span&&"col-span-2"),children:[(0,eb.jsxs)("div",{className:"mb-1 flex items-center justify-between text-sm",children:[(0,eb.jsx)("span",{className:"text-muted-foreground",children:e.title}),e.value?(0,eb.jsx)("span",{className:"text-muted-foreground tabular-nums",children:e.value}):null]}),(0,eb.jsx)(QJ,{data:e.data,color:e.color,className:tK("w-full",n)})]})}function QG(){return(0,eb.jsxs)("div",{className:"mt-1 flex justify-between text-xs text-muted-foreground",children:[(0,eb.jsx)("span",{children:"60 秒"}),(0,eb.jsx)("span",{children:"0"})]})}function QY({segments:e}){let t=e&&e.length>0?e:[{label:"used",value:64},{label:"available",value:36}];return(0,eb.jsxs)("div",{className:"mt-5",children:[(0,eb.jsx)("div",{className:"mb-1 text-sm text-muted-foreground",children:"内存组合"}),(0,eb.jsx)("div",{className:"flex h-[3.25rem] w-full overflow-hidden border border-primary/75 bg-background",children:t.map((e,n)=>(0,eb.jsx)("div",{className:tK("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 QX({details:e,columns:t}){return e?.length?(0,eb.jsx)("div",{className:tK("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,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("div",{className:"text-xs text-muted-foreground",children:e}),(0,eb.jsx)("div",{className:"truncate text-2xl leading-tight tabular-nums",children:t})]},e))}):null}function QZ({data:e,color:t}){return(0,eb.jsx)(QJ,{data:e,color:t,className:"h-10 w-full",strokeWidth:1.4,compact:!0})}function QJ({data:e,color:t="default",className:n,strokeWidth:r=1.6,compact:i=!1}){let a=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,eb.jsx)(Fb,{config:o,className:tK("aspect-auto border bg-background text-muted-foreground",n),initialDimension:{width:i?96:640,height:i?40:220},children:(0,eb.jsxs)(Lr,{data:a,margin:{top:i?2:6,right:0,bottom:0,left:0},children:[i?null:(0,eb.jsx)(L$,{strokeDasharray:"0",stroke:"var(--border)",strokeOpacity:.7}),(0,eb.jsx)(L1,{dataKey:"index",hide:!0,domain:["dataMin","dataMax"]}),(0,eb.jsx)(QW,{hide:!0,domain:[0,100]}),i?null:(0,eb.jsx)(Fj,{cursor:!1,content:(0,eb.jsx)(Fk,{hideLabel:!0,indicator:"line"})}),(0,eb.jsx)(Tl,{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})]})})}QW.displayName="YAxis";let QQ=eN("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"}]]),Q0=eN("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"}]]),Q1={name:"名称",cpu:"CPU",memoryMb:"内存",diskMbps:"磁盘",networkMbps:"网络"};function Q2({machines:e,defaultMachineId:t,className:n,...r}){let[i,a]=ew.useState(t??e[0]?.id),[o,l]=ew.useState("cpu"),[s,c]=ew.useState("desc"),[d,u]=ew.useState({}),f=e.find(e=>e.id===i)??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 i of e){var r;let e=function e(t,n,r=new Set){void 0!==t.pid&&r.add(t.pid);let i=void 0!==t.parentPid?n.get(t.parentPid):void 0;return!i||void 0===i.pid||r.has(i.pid)||["bash","containerd","dockerd","explorer","init","kernel_task","launchd","services","sh","smss","svchost","system","systemd","wininit","winlogon","zsh"].includes(Q7(i))?t:e(i,n,r)}(i,n),a=Q7(e),o=t.get(a)??{kind:"group",id:a,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(i),o.cpu+=i.cpu,o.memoryMb+=i.memoryMb,o.diskMbps+=i.diskMbps,o.networkMbps+=i.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,i.status),t.set(a,o)}return Array.from(t.values()).map(e=>({...e,cpu:eee(Math.min(100,e.cpu)),memoryMb:eee(e.memoryMb),diskMbps:eee(e.diskMbps),networkMbps:eee(e.networkMbps)}))}(f.processes)].sort((e,t)=>Q9(e,t,o,s)),t=[];for(let n of e){if(n.children.length<=1){let e=n.children[0];e&&t.push(Q8(e,0));continue}if(t.push(n),d[n.id])for(let e of[...n.children].sort((e,t)=>Q9(e,t,o,s)))t.push(Q8(e,1))}return t},[f,d,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,eb.jsxs)("div",{className:tK("vtl-surface-card flex h-full min-h-0 flex-col rounded-[var(--surface-card-radius)] border","vtl-process-monitor",n),...r,children:[(0,eb.jsx)(qg,{value:f.id,onValueChange:a,className:"shrink-0 px-3 pt-3",children:(0,eb.jsx)(qC,{className:"h-8",children:e.map(e=>(0,eb.jsx)(qN,{value:e.id,children:e.name},e.id))})}),(0,eb.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,eb.jsxs)("button",{type:"button",onClick:()=>m("name"),className:"flex items-end px-3 pb-2 text-left text-muted-foreground",children:["名称",(0,eb.jsx)(Q5,{active:"name"===o,direction:s})]}),(0,eb.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,eb.jsxs)("button",{type:"button",onClick:()=>m(e),className:"grid content-end border-l px-3 pb-2 text-right",children:[(0,eb.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,eb.jsxs)("span",{className:"mt-1 text-xs text-muted-foreground",children:[Q1[e],(0,eb.jsx)(Q5,{active:o===e,direction:s,className:"ml-1 inline-flex"})]})]},e)})]}),(0,eb.jsx)("div",{className:"vtl-scrollbar-hidden min-h-0 flex-1 overflow-auto",children:h.map(e=>{var t;return(0,eb.jsxs)("div",{className:tK("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,eb.jsx)(Q4,{row:e,expanded:"group"===e.kind&&!!d[e.id],onToggle:()=>{"group"===e.kind&&u(t=>({...t,[e.id]:!t[e.id]}))}}),(0,eb.jsx)(Q3,{platform:f.platform,status:e.status}),(0,eb.jsx)(Q6,{value:e.cpu,max:100,label:`${e.cpu.toFixed(1)}%`}),(0,eb.jsx)(Q6,{value:e.memoryMb,max:eet(p,"memoryMb"),label:(t=e.memoryMb)>=1024?`${een(t/1024)} GB`:`${een(t)} MB`}),(0,eb.jsx)(Q6,{value:e.diskMbps,max:Math.max(1,eet(p,"diskMbps")),label:`${een(e.diskMbps)} MB/秒`}),(0,eb.jsx)(Q6,{value:e.networkMbps,max:Math.max(1,eet(p,"networkMbps")),label:`${een(e.networkMbps)} Mbps`})]},`${e.kind}-${e.id}`)})})]}):null}function Q5({active:e,direction:t,className:n}){return e?(0,eb.jsx)("asc"===t?q_:GN,{className:tK("ml-1 size-3",n)}):null}function Q4({row:e,expanded:t,onToggle:n}){if("group"===e.kind){let r=t?cE:vo;return(0,eb.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,eb.jsx)(r,{className:"size-4 shrink-0 text-muted-foreground"}),(0,eb.jsx)("span",{className:"size-2 rounded-sm bg-foreground/65"}),(0,eb.jsxs)("span",{className:"min-w-0 truncate font-medium",children:[e.name," (",e.children.length,")"]})]})}return(0,eb.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,eb.jsx)("span",{className:"size-1.5 rounded-full bg-muted-foreground/70"}):(0,eb.jsx)("span",{className:"size-1.5 rounded-full bg-foreground/65"}),(0,eb.jsx)("span",{className:tK("truncate",0===e.depth&&"font-medium"),children:e.name}),e.process.pid?(0,eb.jsx)("span",{className:"shrink-0 ui-text-kbd text-muted-foreground",children:e.process.pid}):null]})}function Q3({platform:e,status:t}){return t?.length?(0,eb.jsxs)("div",{className:"flex items-center gap-1.5 px-3 text-muted-foreground",children:[t.includes("suspended")?(0,eb.jsx)(Q0,{"aria-label":"linux"===e?"挂起进程":"挂起",className:"size-4"}):null,t.includes("auto-restart")?(0,eb.jsx)(s9,{"aria-label":"linux"===e?"自动重启进程":"自动重启",className:"size-4"}):null,t.includes("running")?(0,eb.jsx)(QQ,{"aria-label":"运行",className:"size-4 text-primary"}):null]}):(0,eb.jsx)("div",{className:"px-3"})}function Q6({value:e,max:t,label:n}){let r=Math.min(1,Math.max(0,e/Math.max(1,t))),i=r>.78,a=i?`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,eb.jsx)("div",{className:"vtl-process-heat-cell h-full border-l px-3 text-right tabular-nums","data-hot":i?"":void 0,style:{background:a},children:(0,eb.jsx)("span",{className:tK("leading-9",i&&"text-destructive"),children:n})})}function Q8(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 Q7(e){return e.appId?.trim().toLowerCase()||e.appName?.trim().toLowerCase()||e.name.trim().toLowerCase().replace(/\.(exe|com)$/i,"")||e.id}function Q9(e,t,n,r){let i="asc"===r?1:-1;return"name"===n?e.name.localeCompare(t.name)*i:(e[n]-t[n])*i}function eee(e){return Math.round(10*e)/10}function eet(e,t){return e.reduce((e,n)=>Math.max(e,n[t]),0)}function een(e){return new Intl.NumberFormat("zh-CN",{maximumFractionDigits:+(e<10)}).format(e)}function eer({className:e}){let t=eea("/api/local/machines/processes");return(0,eb.jsx)(Q2,{machines:t,className:tK("h-full min-h-0 w-full",e)})}function eei({className:e}){let t=eea("/api/local/machines/performance");return(0,eb.jsx)(Qq,{machines:t,className:tK("h-full min-h-0 w-full",e)})}function eea(e){let[t,n]=ew.useState([]);return ew.useEffect(()=>{let t=!0,r=!1;async function i(){if(!r){r=!0;try{let r=await fetch(e,{cache:"no-store"});if(!r.ok)return;let i=await r.json();t&&n(i.machines)}catch{t&&n([])}finally{r=!1}}}i();let a=window.setInterval(i,2e3);return()=>{t=!1,window.clearInterval(a)}},[e]),t}let eeo=eN("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),eel=eN("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"}]]),ees={loading:"Starting terminal...",newTerminal:"New terminal",closeTerminal:e=>`Close ${e}`,terminalList:"Terminal sessions",status:{idle:"Idle",running:"Running",success:"Succeeded",error:"Failed"}},eec=[{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 eed(e,t,n){return e.getPropertyValue(t).trim()||n}function eeu(e,t=!1){let n=getComputedStyle(e),r=eed(n,"--foreground","#18181b"),i=eed(n,"--terminal-background",eed(n,"--background","#ffffff")),a="transparent"===i?eed(n,"--background","#ffffff"):i,o=eed(n,"--muted-foreground","#71717a"),l=eed(n,"--border","#e4e4e7"),s=eed(n,"--selection","#18181b");return{background:i,foreground:r,cursor:t?"transparent":r,cursorAccent:t?"transparent":a,selectionBackground:`color-mix(in oklch, ${s} 18%, transparent)`,selectionForeground:eed(n,"--selection-foreground","#ffffff"),scrollbarSliderBackground:`color-mix(in oklch, ${l} 78%, transparent)`,scrollbarSliderHoverBackground:l,black:r,red:eed(n,"--terminal-red","#bf616a"),green:eed(n,"--terminal-green","#5e8c61"),yellow:eed(n,"--terminal-yellow","#b06f3c"),blue:eed(n,"--terminal-blue","#5e81ac"),magenta:eed(n,"--terminal-magenta","#b48ead"),cyan:eed(n,"--terminal-cyan","#4c8da8"),white:i,brightBlack:o,brightRed:eed(n,"--terminal-bright-red","#d06f79"),brightGreen:eed(n,"--terminal-bright-green","#6b9a70"),brightYellow:eed(n,"--terminal-bright-yellow","#c2824b"),brightBlue:eed(n,"--terminal-bright-blue","#6f91ba"),brightMagenta:eed(n,"--terminal-bright-magenta","#c19ac0"),brightCyan:eed(n,"--terminal-bright-cyan","#5aa0b8"),brightWhite:r}}function eef(e){return void 0===e?[]:Array.isArray(e)?e:[e]}function eeh({initialOutput:t,data:n,dataKey:r,options:i,readOnly:a=!1,autoFocus:o=!1,localEcho:l=!1,onData:s,onResize:c,onReady:d,labels:u,className:f,terminalClassName:h,...p}){let m=ew.useMemo(()=>({loading:ees.loading,...u}),[u]),g=ew.useRef(null),v=ew.useRef(null),x=ew.useRef(void 0),y=ew.useRef(s),b=ew.useRef(c),w=ew.useRef(d),j=ew.useRef(i),k=ew.useRef(a),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=d,j.current=i,k.current=a,S.current=l},[l,s,d,c,i,a]),ew.useEffect(()=>{let n,r=!1,i=[];!async function(){var a;let l,s,c,d,u;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(a=g.current),u=(c=eed(l,"--font-family-mono",s='"Cascadia Mono", "Cascadia Code", Consolas, "SFMono-Regular", "Liberation Mono", monospace'),d=getComputedStyle(a),c.replace(/var\((--[a-zA-Z0-9-_]+)(?:,[^)]+)?\)/g,(e,t)=>d.getPropertyValue(t).trim()||"")).trim(),`"Cascadia Mono", "Cascadia Code", Consolas, ${u||s}`),fontSize:13,letterSpacing:0,lineHeight:1.25,macOptionIsMeta:!0,minimumContrastRatio:4.5,scrollback:5e3,theme:eeu(g.current),...j.current,allowTransparency:!0}),E=new h,P=new p,A=new m;function z(){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(z),(n=new ResizeObserver(z)).observe(g.current),i.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))})),eef(t)))N.write(e);w.current?.({terminal:N,fitAddon:E,searchAddon:P,webLinksAddon:A,fit:z,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=eeu(t,e))},write:(e,t)=>N.write(e,t),writeln:e=>N.writeln(e)}),o&&N.focus()}();let a=new MutationObserver(()=>{let e=v.current,t=g.current;e&&t&&(e.options.theme=eeu(t,C.current))});return a.observe(document.documentElement,{attributeFilter:["class","style"],attributes:!0}),()=>{for(let e of(r=!0,a.disconnect(),n?.disconnect(),i))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,eef(n)))e.write(t)},[n,r]),(0,eb.jsxs)("div",{"data-slot":"terminal-tab-surface",className:tK("relative size-full min-h-0 overflow-hidden bg-background text-foreground",f),...p,children:[(0,eb.jsx)("div",{ref:g,className:tK("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,eb.jsx)("div",{className:"pointer-events-none absolute inset-0 grid place-items-center text-muted-foreground ui-text-code",children:m.loading})]})}function eep({status:e="idle"}){return"running"===e?(0,eb.jsx)(eel,{className:"size-3.5 text-foreground"}):"success"===e?(0,eb.jsx)(WJ,{className:"size-3.5 text-foreground"}):"error"===e?(0,eb.jsx)(eeo,{className:"size-3.5 text-destructive"}):(0,eb.jsx)(yt,{className:"size-3.5 text-muted-foreground"})}function eem({sessions:e,defaultSessions:t=eec,activeSessionId:n,defaultActiveSessionId:r,onActiveSessionChange:i,onSessionsChange:a,onCreateSession:o,onCloseSession:l,onSessionData:s,onSessionResize:c,onSessionReady:d,showTabs:u=!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(()=>({...ees,...g,status:{...ees.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),a?.(t)}function A(e){e.disabled||(void 0===n&&M(e.id),i?.(e.id,e))}return(0,eb.jsxs)("div",{"data-slot":"terminal-tab-group",className:tK("vtl-surface-panel grid min-h-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",u?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",v),...b,children:[u&&(0,eb.jsxs)("div",{"data-slot":"terminal-tab-list",role:"tablist","aria-label":w.terminalList,className:tK("flex min-w-0 items-center gap-1 border-b bg-muted/35 px-2 py-1.5",x),children:[(0,eb.jsx)(mH,{className:"ml-1 size-4 shrink-0 text-muted-foreground"}),(0,eb.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,eb.jsxs)("div",{className:tK("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,eb.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,eb.jsx)(eep,{status:e.status}),(0,eb.jsx)("span",{className:"max-w-36 truncate",children:e.title}),e.shell&&(0,eb.jsx)("span",{className:"hidden text-muted-foreground ui-text-kbd sm:inline",children:e.shell})]}),e.closable&&(0,eb.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,eb.jsx)(p6,{className:"size-3"})})]},e.id)})}),f&&(0,eb.jsx)(tY,{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,eb.jsx)(s7,{className:"size-3.5"})})]}),(0,eb.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,eb.jsx)("div",{id:`terminal-panel-${e.id}`,role:"tabpanel","aria-hidden":!t,"data-active":t,className:tK("absolute inset-0 min-h-0",t?"z-10 opacity-100":"z-0 opacity-0"),children:(0,eb.jsx)(eeh,{initialOutput:e.initialOutput,options:{...m,...e.options},readOnly:h||e.disabled,localEcho:p,autoFocus:t,onData:t=>s?.(e.id,t),onResize:t=>c?.(e.id,t),onReady:t=>d?.(e.id,t),labels:w,terminalClassName:y})},e.id)})})]})}function eeg({className:e,scopeId:t,state:n,onStateChange:r}){let[i,a]=ew.useState([]),[o,l]=ew.useState([]),[s,c]=ew.useState(),[d,u]=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,z=A??"__unscoped__";ew.useEffect(()=>{E.current=n},[n]),ew.useEffect(()=>{O.current=r},[r]);let _=i.find(e=>e.id===d)??i[0],I=_?.shells.find(e=>e.id===f)??_?.shells[0],D=ew.useMemo(()=>o.map(e=>e.id),[o]),T=D.join("\0"),R=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)},[]),L=ew.useCallback(e=>{let t=j.current.get(e);void 0!==t&&window.clearTimeout(t);let n=window.setTimeout(()=>{j.current.delete(e),R(e,!1)},90);j.current.set(e,n)},[R]),$=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),L(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,R(e,!0);try{n.write(r,()=>{(t.writing=!1,y.current.has(e))?t.buffer?t.drainTimer=window.setTimeout(()=>$(e),0):(w.current.delete(e),L(e)):w.current.delete(e)})}catch{t.writing=!1,w.current.delete(e),L(e)}},[L,R]),F=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,R(e,!0),n.buffer.length>=65536)?$(e):n.writing||void 0!==n.drainTimer||(n.drainTimer=window.setTimeout(()=>$(e),8))},[$,R]),V=ew.useCallback((e,t)=>{(k.current.set(e,t.sequence),"output"===t.type&&t.data)?F(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))},[F]),B=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`/api/local/terminals/sessions/${encodeURIComponent(e)}/events${r?`?${r}`:""}`}(e,k.current.get(e)??0));t.onmessage=t=>{try{V(e,JSON.parse(t.data))}catch{return}},x.current.set(e,t)},[V]),H=ew.useCallback(async()=>{if(_&&!p){M.current=!1,m(!0);try{let e=await HW({machineId:_.id,scopeId:A,shell:I?.id,cwd:_.defaultCwd,cols:100,rows:30});l(t=>t.some(t=>t.id===e.id)?t:[...t,e]),c(e.id),B(e.id)}catch{return}finally{m(!1)}}},[p,B,_,I,A]);function W(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,[i,o]=await Promise.all([HB(),HH(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,a(i.machines),l(s),c(e=>{let n=t?.activeSessionId??e;return n&&s.some(e=>e.id===n)?n:s[0]?.id});let d=i.machines[0];if(d){let e=i.machines.find(e=>e.id===t?.selectedMachineId)??d;u(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,z]),ew.useEffect(()=>{g&&O.current?.({sessionIds:D,activeSessionId:s,selectedMachineId:d,selectedShellId:f,autoStart:!M.current})},[s,g,d,f,D,T]),ew.useEffect(()=>{let e=new Set(D);for(let e of o)B(e.id);for(let[t,n]of x.current)e.has(t)||(n.close(),x.current.delete(t))},[B,D,o]),ew.useEffect(()=>{!g||N.current||M.current||o.length>0||0===i.length||(N.current=!0,H())},[H,g,i.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),R(e,!1);S.current.clear(),w.current.clear(),j.current.clear()},[R]),(0,eb.jsxs)("div",{className:tK("grid h-full min-h-0 w-full grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-[inherit] border bg-card",e),children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 border-b bg-muted/35 px-2 py-1.5",children:[(0,eb.jsxs)(Jo,{value:_?.id,onValueChange:e=>{u(e);let t=i.find(t=>t.id===e);h(t?.shells[0]?.id)},children:[(0,eb.jsxs)(JK,{size:"sm",className:"max-w-44",children:[(0,eb.jsx)(vw,{className:"size-3.5"}),(0,eb.jsx)(Jd,{placeholder:"机器"})]}),(0,eb.jsx)(JX,{align:"start",children:i.map(e=>(0,eb.jsx)(JZ,{value:e.id,children:e.name},e.id))})]}),(0,eb.jsxs)(Jo,{value:I?.id,onValueChange:h,children:[(0,eb.jsx)(JK,{size:"sm",className:"max-w-44",children:(0,eb.jsx)(Jd,{placeholder:"Shell"})}),(0,eb.jsx)(JX,{align:"start",children:_?.shells.map(e=>(0,eb.jsx)(JZ,{value:e.id,children:e.name},e.id))})]}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"新建终端",disabled:!_||p,onClick:()=>void H(),className:"ml-auto",children:(0,eb.jsx)(s7,{className:"size-4"})})]}),(0,eb.jsx)(eem,{sessions:o.map(eev),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}),Hq(e).catch(()=>{}))},onSessionData:function(e,t){let n=W(e);n.buffer+=t,function e(t){let n=W(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,HU(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),HK(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),F(e,n))},className:"min-h-0 rounded-none border-0"})]})}function eev(e){return{id:e.id,title:e.title,shell:e.machineName,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:""}}function eex(e,t={}){let n="h-full min-h-0 w-full overflow-hidden rounded-[inherit]";switch(e.kind){case"file-tab-viewer":{let r=HA("file-tab-viewer"),i=e.file;if(!i&&t.onRequestFileTab)return(0,eb.jsx)(Ky,{className:n,onChooseFile:t.onRequestFileTab});return(0,eb.jsx)(ZL,{className:`${n} border-0`,file:i??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,labels:{review:"审阅",edit:"编辑",view:"视图",code:"代码",preview:"预览",hex:"十六进制",actions:"文件菜单",save:"保存",saving:"保存中"}})}case"browser-tab-viewer":return(0,eb.jsx)(K_,{className:`${n} border-0`,defaultUrl:e.defaultUrl??HA("browser-tab-viewer").defaultUrl});case"diff-tab-viewer":{let t=HA("diff-tab-viewer");return(0,eb.jsx)(GW,{className:`${n} border-0`,file:e.file??t.file,diff:e.diff??t.diff??""})}case"data-table-tab-viewer":{let r=HA("data-table-tab-viewer"),i=e.file;if(!i&&t.onRequestFileTab)return(0,eb.jsx)(Ky,{className:n,onChooseFile:t.onRequestFileTab});return(0,eb.jsx)(Gz,{className:`${n} border-0`,file:{name:i?.name??r.file?.name??"data",path:i?.path??r.file?.path,type:eey(e)},source:void 0!==e.defaultValue?{type:eey(e),content:e.defaultValue}:void 0,data:e.tableData??r.tableData??[]})}case"terminal-tab-group":return(0,eb.jsx)(eeg,{className:`${n} border-0`,scopeId:t.terminalScopeId,state:e.terminal??t.terminalState,onStateChange:t.onTerminalStateChange})}}function eey(e){return`${e.file?.mimeType??""} ${e.file?.path??e.file?.name??""}`.toLowerCase().includes("json")?"json":"csv"}function eeb(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,eb.jsx)(ZB,{className:n,contentClassName:"min-h-0",tabs:r.map(n=>({id:n.id,title:n.title,meta:n.meta,modified:n.modified,icon:HP(n.kind),content:eex(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})})),activeTabId:t.activeTabId,detachable:!0,externalDropTypes:[fr],createLabel:"打开文件",emptyContent:(0,eb.jsx)(Ky,{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 i=n.map(e=>r.find(t=>t.id===e.id)).filter(e=>!!e);t.onTabsChange?.(e,i)},onTabDetach:(n,i)=>{if(!e)return!1;let a=r.find(e=>e.id===n.id);return!!a&&t.onTabDetach?.(e,a,{clientX:i.clientX,clientY:i.clientY})},onExternalTabDrop:({insertIndex:n,nativeEvent:r})=>{e&&t.onExternalTabDrop?.(e,n,r)}})}case"file-tree-panel":if(t.workspaceFolders)return(0,eb.jsx)(Kv,{folders:t.workspaceFolders,className:`${n} max-w-none`,onOpenFile:t.onOpenWorkspaceFile});return(0,eb.jsx)(Qo,{className:`${n} max-w-none`,onOpenFile:t.onOpenWorkspaceFile});case"process-management":return(0,eb.jsx)(eer,{className:`${n} rounded-[inherit] border-0`});case"machine-performance":return(0,eb.jsx)(eei,{className:`${n} rounded-[inherit] border-0`});case"firewall-policy-workspace":return(0,eb.jsx)("div",{className:`${n} bg-card`,children:(0,eb.jsx)(Qr,{})});case"machine-file-management":return(0,eb.jsx)(Q_,{className:`${n} bg-card`});case"agent-conversation-panel":return(0,eb.jsx)(UX,{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 eex(t.tab??HA(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})}}function eew({kind:e,...t}){return eeb(e,t)}let eej="application/vnd.vantaloom.agent-pane-shredder",eek="application/vnd.vantaloom.agent-pane-cutter",eeS=[{id:"quad",label:"四分",slots:4,icon:(0,eb.jsx)(vb,{})},{id:"vertical-split",label:"上下二分",slots:2,icon:(0,eb.jsx)(Kk,{})},{id:"horizontal-split",label:"左右二分",slots:2,icon:(0,eb.jsx)(Kb,{})},{id:"left-two-right-one",label:"左二右一",slots:3,icon:(0,eb.jsx)(nw,{})},{id:"left-one-right-two",label:"左一右二",slots:3,icon:(0,eb.jsx)(Hp,{})},{id:"top-two-bottom-one",label:"上二下一",slots:3,icon:(0,eb.jsx)(Kk,{})},{id:"top-one-bottom-two",label:"上一下二",slots:3,icon:(0,eb.jsx)(Kj,{})},{id:"single",label:"整窗口",slots:1,icon:(0,eb.jsx)(Kw,{})}];function eeC(e,t,n=[50,50]){let r=e?.[t],i=r?.[0],a=r?.[1];return["number"==typeof i&&i>0?i:n[0],"number"==typeof a&&a>0?a:n[1]]}function eeN(e,t){return{[e[0]]:t[0],[e[1]]:t[1]}}function eeM(e,t){return[e[t[0]]??50,e[t[1]]??50]}function eeE({mode:e,sizes:t,onSizeGroupChange:n,children:r}){if("single"===e)return(0,eb.jsx)("div",{className:"size-full min-h-0",children:r[0]});if("horizontal-split"===e){let e=eeC(t,"outer"),i=["pane-0","pane-1"];return(0,eb.jsxs)(WY,{direction:"horizontal",defaultLayout:eeN(i,e),onLayoutChanged:e=>n?.("outer",eeM(e,i)),children:[(0,eb.jsx)(WX,{id:i[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:i[1],defaultSize:e[1],minSize:24,children:r[1]})]})}if("vertical-split"===e){let e=eeC(t,"outer"),i=["pane-0","pane-1"];return(0,eb.jsxs)(WY,{direction:"vertical",defaultLayout:eeN(i,e),onLayoutChanged:e=>n?.("outer",eeM(e,i)),children:[(0,eb.jsx)(WX,{id:i[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:i[1],defaultSize:e[1],minSize:24,children:r[1]})]})}if("left-two-right-one"===e){let e=eeC(t,"outer",[58,42]),i=eeC(t,"left"),a=["left","right"],o=["pane-0","pane-1"];return(0,eb.jsxs)(WY,{direction:"horizontal",defaultLayout:eeN(a,e),onLayoutChanged:e=>n?.("outer",eeM(e,a)),children:[(0,eb.jsx)(WX,{id:a[0],defaultSize:e[0],minSize:24,children:(0,eb.jsxs)(WY,{direction:"vertical",defaultLayout:eeN(o,i),onLayoutChanged:e=>n?.("left",eeM(e,o)),children:[(0,eb.jsx)(WX,{id:o[0],defaultSize:i[0],minSize:20,children:r[0]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:o[1],defaultSize:i[1],minSize:20,children:r[1]})]})}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:a[1],defaultSize:e[1],minSize:24,children:r[2]})]})}if("left-one-right-two"===e){let e=eeC(t,"outer",[42,58]),i=eeC(t,"right"),a=["left","right"],o=["pane-1","pane-2"];return(0,eb.jsxs)(WY,{direction:"horizontal",defaultLayout:eeN(a,e),onLayoutChanged:e=>n?.("outer",eeM(e,a)),children:[(0,eb.jsx)(WX,{id:a[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:a[1],defaultSize:e[1],minSize:24,children:(0,eb.jsxs)(WY,{direction:"vertical",defaultLayout:eeN(o,i),onLayoutChanged:e=>n?.("right",eeM(e,o)),children:[(0,eb.jsx)(WX,{id:o[0],defaultSize:i[0],minSize:20,children:r[1]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:o[1],defaultSize:i[1],minSize:20,children:r[2]})]})})]})}if("top-two-bottom-one"===e){let e=eeC(t,"outer",[58,42]),i=eeC(t,"top"),a=["top","bottom"],o=["pane-0","pane-1"];return(0,eb.jsxs)(WY,{direction:"vertical",defaultLayout:eeN(a,e),onLayoutChanged:e=>n?.("outer",eeM(e,a)),children:[(0,eb.jsx)(WX,{id:a[0],defaultSize:e[0],minSize:24,children:(0,eb.jsxs)(WY,{direction:"horizontal",defaultLayout:eeN(o,i),onLayoutChanged:e=>n?.("top",eeM(e,o)),children:[(0,eb.jsx)(WX,{id:o[0],defaultSize:i[0],minSize:24,children:r[0]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:o[1],defaultSize:i[1],minSize:24,children:r[1]})]})}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:a[1],defaultSize:e[1],minSize:24,children:r[2]})]})}if("top-one-bottom-two"===e){let e=eeC(t,"outer",[42,58]),i=eeC(t,"bottom"),a=["top","bottom"],o=["pane-1","pane-2"];return(0,eb.jsxs)(WY,{direction:"vertical",defaultLayout:eeN(a,e),onLayoutChanged:e=>n?.("outer",eeM(e,a)),children:[(0,eb.jsx)(WX,{id:a[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:a[1],defaultSize:e[1],minSize:24,children:(0,eb.jsxs)(WY,{direction:"horizontal",defaultLayout:eeN(o,i),onLayoutChanged:e=>n?.("bottom",eeM(e,o)),children:[(0,eb.jsx)(WX,{id:o[0],defaultSize:i[0],minSize:24,children:r[1]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:o[1],defaultSize:i[1],minSize:24,children:r[2]})]})})]})}let i=eeC(t,"outer"),a=eeC(t,"left"),o=eeC(t,"right"),l=["left","right"],s=["pane-0","pane-2"],c=["pane-1","pane-3"];return(0,eb.jsxs)(WY,{direction:"horizontal",defaultLayout:eeN(l,i),onLayoutChanged:e=>n?.("outer",eeM(e,l)),children:[(0,eb.jsx)(WX,{id:l[0],defaultSize:i[0],minSize:24,children:(0,eb.jsxs)(WY,{direction:"vertical",defaultLayout:eeN(s,a),onLayoutChanged:e=>n?.("left",eeM(e,s)),children:[(0,eb.jsx)(WX,{id:s[0],defaultSize:a[0],minSize:20,children:r[0]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:s[1],defaultSize:a[1],minSize:20,children:r[2]})]})}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:l[1],defaultSize:i[1],minSize:24,children:(0,eb.jsxs)(WY,{direction:"vertical",defaultLayout:eeN(c,o),onLayoutChanged:e=>n?.("right",eeM(e,c)),children:[(0,eb.jsx)(WX,{id:c[0],defaultSize:o[0],minSize:20,children:r[1]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:c[1],defaultSize:o[1],minSize:20,children:r[3]})]})})]})}function eeO({conversationId:e,index:t,content:n,clipboardItems:r,clipboardDraggingId:i,onAdd:a,onPanelDrop:o,onContentChange:l,onClear:s,onCut:c,workspaceFolders:d,onRequestFileTab:u,onOpenWorkspaceFile:f,onSaveFileTab:h}){let[p,m]=ew.useState();return(0,eb.jsx)("div",{"data-agent-pane":t,className:tK("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"===p&&"ring-2 ring-foreground/60 ring-inset","shredder"===p&&"ring-2 ring-destructive/70 ring-inset","cutter"===p&&"ring-2 ring-amber-500/70 ring-inset"),onDragOver:e=>{let t=Array.from(e.dataTransfer.types);if(t.includes(eek)){e.preventDefault(),e.dataTransfer.dropEffect="move",m("cutter");return}if(t.includes(eej)){e.preventDefault(),e.dataTransfer.dropEffect="move",m("shredder");return}t.includes(qA)&&(e.preventDefault(),e.dataTransfer.dropEffect="move",m("panel"))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||m(void 0)},onDrop:e=>{if(Array.from(e.dataTransfer.types).includes(eek)){e.preventDefault(),e.stopPropagation(),m(void 0),c(t);return}if(Array.from(e.dataTransfer.types).includes(eej)){e.preventDefault(),e.stopPropagation(),m(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),i=n?n.payloads?.[qA]:void 0;if(n&&i)return{item:n,content:i.content};let a=e.dataTransfer.getData(qA);if(a)try{let e=JSON.parse(a);return n&&e.content?{item:n,content:e.content}:void 0}catch{return}}(e);n&&(e.preventDefault(),e.stopPropagation(),m(void 0),o(t,n.item,n.content))},children:n?(0,eb.jsx)("div",{className:tK("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",i&&"pointer-events-none"),children:qP(n)?eeb(n.kind,{tab:n.tab,terminalScopeId:e?`agent:${e}:pane:${n.id}`:void 0,terminalState:n.terminal,onTerminalStateChange:e=>{var r;r=n.terminal,((r?.activeSessionId??"")!==(e.activeSessionId??"")||(r?.selectedMachineId??"")!==(e.selectedMachineId??"")||(r?.selectedShellId??"")!==(e.selectedShellId??"")||(r?.autoStart??!0)!==(e.autoStart??!0)||(r?.sessionIds??[]).join("\0")!==e.sessionIds.join("\0"))&&l(t,{...n,terminal:e})},workspaceFolders:d,nodeId:n.id,tabs:n.tabs,activeTabId:n.activeTabId,onRequestFileTab:({insertIndex:e})=>u?.(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),onActiveTabChange:(e,r)=>{l(t,{...n,activeTabId:r})}}):(0,eb.jsx)(UX,{className:"size-full min-h-0",composerClassName:"max-w-[42.5rem]",initialEvents:n.events},n.id)},n.id):(0,eb.jsx)("div",{className:"vtl-agent-pane-empty grid size-full place-items-center p-4",children:(0,eb.jsxs)(tY,{type:"button",variant:"outline",size:"sm",className:"rounded-full bg-background/90",onClick:a,children:[(0,eb.jsx)(s7,{className:"size-4"}),"添加"]})})})}function eeP({open:e,onOpenChange:t,onAdd:n}){return(0,eb.jsx)(mr,{open:e,onOpenChange:t,title:"添加工作区组件",description:"选择一个组件填入当前窗口。",className:"top-1/2 max-w-xl -translate-y-1/2",children:(0,eb.jsxs)(mn,{loop:!0,children:[(0,eb.jsx)(mi,{placeholder:"搜索组件..."}),(0,eb.jsxs)(ma,{children:[(0,eb.jsx)(mo,{children:"没有匹配组件。"}),(0,eb.jsx)(ml,{heading:"可放入窗口",children:qE.map(e=>(0,eb.jsxs)(ms,{value:`${e.title} ${e.description} ${e.keywords}`,onSelect:()=>n(e.id),children:[(0,eb.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg border bg-background text-muted-foreground",children:e.icon}),(0,eb.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,eb.jsx)("span",{className:"block truncate text-sm font-medium",children:e.title}),(0,eb.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,eb.jsx)(mc,{children:"添加"})]},e.id))})]})]})})}let eeA=[];function eez(e){var t;let n=(t=e?.layoutMode,eeS.some(e=>e.id===t)?t:"quad"),r="right"===e?.agentPosition?"right":"left",i=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:ee_(e.outer),left:ee_(e.left),right:ee_(e.right),top:ee_(e.top),bottom:ee_(e.bottom)}}(e?.sizes),a=Array.from({length:Math.max(4,eeS.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>=a.length||(a[e]=function(e,t){var n,r;let i=e.paneId||`${e.kind}-${t+1}`,a=!(n=e.props)||"object"!=typeof n||Array.isArray(n)?{}:n;if("subagent-conversation-panel"===e.kind)return{id:i,kind:"subagent-conversation-panel",title:eeD(a.title)??"Subagent",subagentId:eeD(a.subagentId)??i,events:Array.isArray(a.events)?a.events:[]};if(!qO(e.kind))return;let o=a.tab&&"object"==typeof a.tab?a.tab:void 0,l=Array.isArray(a.tabs)?a.tabs.filter(e=>HO(e?.kind)):void 0,s=qO(e.kind);return{id:i,kind:e.kind,title:eeD(a.title)??o?.title??s?.title??"组件",tab:o,tabs:l,activeTabId:eeD(a.activeTabId),terminal:"terminal-tab-group"===e.kind?!(r=a.terminal)||"object"!=typeof r||Array.isArray(r)?{sessionIds:[]}:{sessionIds:Array.isArray(r.sessionIds)?r.sessionIds.filter(e=>"string"==typeof e):[],activeSessionId:eeD(r.activeSessionId),selectedMachineId:eeD(r.selectedMachineId),selectedShellId:eeD(r.selectedShellId),autoStart:"boolean"==typeof r.autoStart?r.autoStart:void 0}:void 0}}(n,t))}return{layoutMode:n,agentPosition:r,layoutSizes:i,panes:a}}function ee_(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 eeI(e){return e.filter(e=>"number"==typeof e&&Number.isFinite(e)&&e>0)}function eeD(e){return"string"==typeof e&&e.trim()?e:void 0}function eeT(e){let t=e?.id.match(/-(\d+)$/);return t?Number(t[1]):0}function eeR(e){return e.reduce((e,t)=>Math.max(e,eeT(t)),0)}function eeL({conversation:e,clipboardItems:t,clipboardDraggingId:n,onClipboardItemsChange:r,onClipboardDraggingChange:i,onOverlayOpenChange:a}){let o=eez(e?.panes),[l,s]=ew.useState(o.layoutMode),[c,d]=ew.useState(o.agentPosition),[u,f]=ew.useState(o.layoutSizes),[h,p]=ew.useState(()=>o.panes),[m,g]=ew.useState(()=>e?.events??[]),[v,x]=ew.useState(""),[y,b]=ew.useState(e?.conversation.status==="working"),[w,j]=ew.useState(e?.conversation.status??"idle"),[k,S]=ew.useState(),[C,N]=ew.useState(),M=ew.useRef(eeR(o.panes)),E=ew.useRef(0),O=eeS.find(e=>e.id===l)?.slots??4,P=e?.conversation.settings.folders??eeA,{models:A}=g4(),z=ew.useMemo(()=>{let t=e?.conversation.settings.mainModels??[];return t.length?A.filter(e=>t.includes(e.value)).map(e=>({id:e.value,label:e.label})):[]},[A,e?.conversation.settings.mainModels]),_=y||"working"===w;function I(e){if(!e.length)return;let t=e.map(qz);r(e=>[...t,...e.filter(e=>!t.some(t=>t.id===e.id))])}async function D(e,t,n){try{let r=await U0(e);p(e=>e.map((e,i)=>i===t?function(e,t,n){if(!e||!qP(e))return e;if("multi-tab-system"===e.kind){var r;let i,a;return{...e,tabs:(r=e.tabs??[],i=r.filter(e=>e.id!==t.id),a=void 0===n?i.length:Math.min(Math.max(n,0),i.length),i.splice(a,0,t),i),activeTabId:t.id}}return"file-tab-viewer"===e.kind?{...e,title:t.title,tab:t}:e}(e,r,n):e))}catch{qr.error("文件预览打开失败")}}function T(e){let t=h.slice(0,O).findIndex(e=>e?.kind==="multi-tab-system");t<0?qr.warning("请先放入一个多标签页组件"):D(e,t)}async function R(e,t,n){let r=t.file?.path,i=t.file?.machineId??"local";if(!r)throw qr.error("文件路径不可用"),Error("file path is unavailable");try{let a=await HD({machineId:i,path:r,content:n}),o={...t,modified:!1,defaultValue:"utf-8"===a.encoding?a.content:n,file:{...t.file,name:a.name,path:a.path,machineId:a.machine.id,mimeType:a.mimeType,kind:t.file?.kind,size:a.size,truncated:a.truncated}};p(t=>t.map((t,n)=>n===e?t&&qP(t)?"multi-tab-system"===t.kind?{...t,tabs:(t.tabs??[]).map(e=>e.id===o.id?o:e),activeTabId:o.id}:"file-tab-viewer"===t.kind?{...t,title:o.title,tab:o}:t:t:t)),qr.success("文件已保存")}catch(e){throw qr.error("文件保存失败"),e}}function L(e,t,n){let a=h[e];M.current=Math.max(M.current,eeT(n)),p(t=>t.map((t,r)=>r===e?n:t)),r(e=>{let n=e.filter(e=>e.id!==t.id);if(!a)return n;let r=qz(a);return[r,...n.filter(e=>e.id!==r.id)]}),i?.(void 0)}function $(e,t){p(n=>n.map((n,r)=>r===e?t:n))}function F(e){var t=h[e];if(t&&qP(t)&&"terminal-tab-group"===t.kind)for(let e of t.terminal?.sessionIds??[])Hq(e).catch(()=>{});p(t=>t.map((t,n)=>n===e?void 0:t))}function V(e){let t=h[e];t&&I([t]),p(t=>t.map((t,n)=>n===e?void 0:t))}async function B(t){let n=e?.conversation.id,r=v||z[0]?.id;if(n){if(!r)return void qr.error("请先在代理模型配置里选择模型");b(!0),j("working");try{let e=await Ha(n,{message:t,modelRef:r,mode:"chat"});g(e.events),j(e.conversation.status)}catch(e){b(!1),j("idle"),qr.error(e instanceof Error?e.message:"对话请求失败")}}}ew.useEffect(()=>{a?.(void 0!==k||void 0!==C)},[C,a,k]),ew.useEffect(()=>{g(e?.events??[])},[e?.conversation.id,e?.events]),ew.useEffect(()=>{b(e?.conversation.status==="working"),j(e?.conversation.status??"idle")},[e?.conversation.id,e?.conversation.status]),ew.useEffect(()=>{let e=z[0]?.id??"";x(t=>z.some(e=>e.id===t)?t:e)},[z]),ew.useEffect(()=>{let t=eez(e?.panes);s(t.layoutMode),d(t.agentPosition),f(t.layoutSizes),p(t.panes),M.current=eeR(t.panes)},[e?.conversation.id,e?.panes]),ew.useEffect(()=>{let t,n=e?.conversation.id;if(!n||!_)return;let r=new EventSource(gQ(`/api/local/agent/conversations/${encodeURIComponent(n)}/events/stream`));return r.addEventListener("detail",e=>{try{let t=Ho(JSON.parse(e.data));g(t.events),j(t.conversation.status),"working"!==t.conversation.status&&(b(!1),r.close())}catch{return}}),r.onerror=()=>{r.close(),void 0===t&&(t=window.setInterval(async()=>{try{let e=await B9(n);g(e.events),j(e.conversation.status),"working"!==e.conversation.status&&(b(!1),void 0!==t&&(window.clearInterval(t),t=void 0))}catch{return}},350))},()=>{r.close(),void 0!==t&&window.clearInterval(t)}},[e?.conversation.id,_]),ew.useEffect(()=>{let t=e?.conversation.id;if(!t)return;let n=window.setTimeout(()=>{let e;Hi(t,(e=[],h.forEach((t,n)=>{if(t){if(qP(t))return void e.push({paneId:t.id,slot:n,kind:t.kind,machineId:t.terminal?.selectedMachineId,resourceId:t.terminal?.activeSessionId,props:{title:t.title,tab:t.tab,tabs:t.tabs,activeTabId:t.activeTabId,terminal:t.terminal}});e.push({paneId:t.id,slot:n,kind:t.kind,props:{title:t.title,subagentId:t.subagentId,events:t.events}})}}),{layoutMode:l,agentPosition:c,sizes:u,panes:e}))},300);return()=>window.clearTimeout(n)},[c,e?.conversation.id,l,u,h]);let H=Array.from({length:O},(r,i)=>(0,eb.jsx)(eeO,{conversationId:e?.conversation.id,index:i,content:h[i],clipboardItems:t,clipboardDraggingId:n,onAdd:()=>S(i),onPanelDrop:L,onContentChange:$,onClear:F,onCut:V,workspaceFolders:P,onRequestFileTab:(e,t)=>N({paneIndex:e,insertIndex:t}),onOpenWorkspaceFile:T,onSaveFileTab:R},i)),W=h.slice(0,O).some(e=>e?.kind==="subagent-conversation-panel"),q=u.shell?.agent??42,U=u.shell?.panes??58,K=(0,eb.jsx)(WX,{id:"agent",defaultSize:q,minSize:28,children:(0,eb.jsx)(UX,{events:e?m:void 0,models:e?z:void 0,modelId:v,running:_,disabled:!!e&&0===z.length,onModelChange:x,onSubmit:e?e=>{B(e.value)}:void 0,onOpenSubagent:function(e){var t;let n=h.slice(0,O),r=n.findIndex(e=>!e),i=n.findIndex(e=>e?.kind==="subagent-conversation-panel"),a=r>=0?r:i;if(a<0)return void qr.warning("请释放一个窗口再选中浏览");E.current+=1;let o={id:t=`subagent-${e.id}-${E.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}]};p(e=>e.map((e,t)=>t===a?o:e))}})},"agent-conversation"),G=(0,eb.jsx)(WX,{id:"panes",defaultSize:U,minSize:32,children:(0,eb.jsxs)("section",{className:"vtl-agent-workspace-panel flex size-full min-h-0 min-w-0 flex-col bg-transparent","data-has-conversation-pane":W?"true":void 0,children:[(0,eb.jsx)("div",{className:"flex h-11 shrink-0 items-center border-b px-3",children:(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,eb.jsx)(qg,{value:l,onValueChange:e=>{let t,n;return t=eeS.find(t=>t.id===e)?.slots??4,void((n=h.slice(t).filter(e=>!!e)).length&&I(n),p(Array.from({length:Math.max(4,t)},(e,n)=>n<t?h[n]:void 0)),s(e))},children:(0,eb.jsx)(qC,{children:eeS.map(e=>(0,eb.jsx)(qN,{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))})}),(0,eb.jsxs)(yJ,{type:"single",value:c,variant:"outline",size:"sm","aria-label":"Agent 面板位置",onValueChange:e=>{("left"===e||"right"===e)&&d(e)},children:[(0,eb.jsx)(yQ,{value:"left","aria-label":"Agent 在左",title:"Agent 在左",className:"h-7 w-9 px-0 [&_svg]:size-4",children:(0,eb.jsx)(nw,{})}),(0,eb.jsx)(yQ,{value:"right","aria-label":"Agent 在右",title:"Agent 在右",className:"h-7 w-9 px-0 [&_svg]:size-4",children:(0,eb.jsx)(Hp,{})})]}),(0,eb.jsx)(tY,{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(eek,"cut")},children:(0,eb.jsx)(ce,{})}),(0,eb.jsx)(tY,{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(eej,"clear")},children:(0,eb.jsx)(Hm,{})})]})}),(0,eb.jsx)("div",{className:"min-h-0 flex-1",children:(0,eb.jsx)(eeE,{mode:l,sizes:u,onSizeGroupChange:function(e,t){let n=eeI(t);f(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:H},`${e?.conversation.id??"empty"}-${l}`)})]})},"agent-panes");return(0,eb.jsxs)("div",{className:"vtl-app-background vtl-agent-conversation-workspace h-full min-h-0 pl-[5.25rem]",children:[(0,eb.jsxs)(WY,{direction:"horizontal",defaultLayout:{agent:q,panes:U},onLayoutChanged:e=>{let t=e.agent??q,n=e.panes??U;!function(e){let t=eeI(e),n=t[0],r=t[1];if(void 0===n||void 0===r)return;let i="left"===c?{agent:n,panes:r}:{agent:r,panes:n};f(e=>{let t=e.shell?.agent,n=e.shell?.panes;return .01>Math.abs((t??0)-i.agent)&&.01>Math.abs((n??0)-i.panes)?e:{...e,shell:{...e.shell,...i}}})}("left"===c?[t,n]:[n,t])},children:["left"===c?K:G,(0,eb.jsx)(WZ,{withHandle:!0}),"left"===c?G:K]},`${e?.conversation.id??"empty"}-${c}`),(0,eb.jsx)(eeP,{open:void 0!==k,onOpenChange:e=>{e||S(void 0)},onAdd:function(e){var t;let n,r;if(void 0===k)return;M.current+=1;let i=(t=`${e}-${M.current}`,n=qO(e),r="file-tab-viewer"===e?{id:t,kind:e,title:"选择文件"}:HO(e)?HA(e,t):void 0,{id:t,kind:e,title:r?.title??n?.title??"组件",tab:r,tabs:"multi-tab-system"===e?[]:void 0,terminal:"terminal-tab-group"===e?{sessionIds:[],autoStart:!0}:void 0}),a=h[k];a&&I([a]),p(e=>e.map((e,t)=>t===k?i:e)),S(void 0)}}),(0,eb.jsx)(Kx,{open:void 0!==C,folders:P,onOpenChange:e=>{e||N(void 0)},onSelectFile:e=>{C&&D(e,C.paneIndex,C.insertIndex),N(void 0)}}),(0,eb.jsx)(qc,{position:"top-right"})]})}let ee$=eN("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"}]]),eeF=eN("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"}]]),eeV=eN("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"}]]),eeB=eN("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"}]]);function eeH({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){let[r,i]=ew.useState(),a=ew.useMemo(()=>B2({onSelect:i}),[]);return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(mk,{boardId:"canvas-library",definitions:a,initialLayouts:B5,clipboardItems:e,actionLabel:"画布库页面卡片操作",paletteGroupTitle:"画布库页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n}),(0,eb.jsx)(eeq,{canvas:r,onOpenChange:e=>{e||i(void 0)}})]})}function eeW({icon:e,value:t}){return(0,eb.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,eb.jsx)("span",{className:"[&_svg]:size-3.5",children:e}),(0,eb.jsx)("span",{className:"tabular-nums",children:t})]})}function eeq({canvas:e,onOpenChange:t}){return e?(0,eb.jsx)(m1,{open:!!e,onOpenChange:t,title:e.title,eyebrow:"画布管理",description:e.purpose,panels:[{id:"overview",label:"首页",icon:(0,eb.jsx)(mV,{}),content:(0,eb.jsx)(eeU,{canvas:e})},{id:"templates",label:"节点模板",icon:(0,eb.jsx)(ee$,{}),badge:e.settings.nodeTemplates.length,content:(0,eb.jsx)(eeG,{title:"可用节点模板",items:e.settings.nodeTemplates})},{id:"layout",label:"默认布局",icon:(0,eb.jsx)(eeB,{}),content:(0,eb.jsx)(eeG,{title:"默认布局参数",items:e.settings.defaultLayout})},{id:"folders",label:"工作区绑定",icon:(0,eb.jsx)(mL,{}),content:(0,eb.jsx)(eeG,{title:"绑定的工作区文件夹",items:e.settings.folders})},{id:"sharing",label:"共享权限",icon:(0,eb.jsx)(eeV,{}),content:(0,eb.jsx)(eeG,{title:"共享与权限",items:e.settings.sharing})},{id:"autosave",label:"自动保存",icon:(0,eb.jsx)(Zw,{}),content:(0,eb.jsx)(eeG,{title:"自动保存策略",items:e.settings.autosave})},{id:"snapshots",label:"快照和版本",icon:(0,eb.jsx)(BU,{}),content:(0,eb.jsx)(eeG,{title:"快照和版本策略",items:e.settings.snapshots})},{id:"hosts",label:"可访问主机",icon:(0,eb.jsx)(m$,{}),content:(0,eb.jsx)(eeG,{title:"可访问主机",items:e.settings.hosts})},{id:"plugins",label:"插件",icon:(0,eb.jsx)(mB,{}),content:(0,eb.jsx)(eeG,{title:"画布插件",items:e.settings.plugins,empty:"未加载插件"})}]}):null}function eeU({canvas:e}){return(0,eb.jsxs)("div",{className:"grid gap-5",children:[(0,eb.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,eb.jsxs)("div",{className:"grid gap-5",children:[(0,eb.jsxs)("div",{className:"max-w-2xl",children:[(0,eb.jsx)("h3",{className:"text-3xl font-semibold tracking-normal",children:e.title}),(0,eb.jsx)("p",{className:"mt-4 text-sm leading-6 text-muted-foreground",children:e.purpose})]}),(0,eb.jsxs)("div",{className:"grid max-w-56 gap-2",children:[(0,eb.jsx)(eeK,{label:"Nodes",value:`${e.nodes}`}),(0,eb.jsx)(eeK,{label:"Agent",value:`${e.agents}`}),(0,eb.jsx)(eeK,{label:"Snapshots",value:`${e.snapshots}`})]})]}),(0,eb.jsx)("span",{className:"absolute right-7 bottom-7 text-sm font-medium text-foreground transition-opacity group-hover:opacity-70",children:"进入"})]}),(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsxs)("div",{className:"flex items-center justify-between",children:[(0,eb.jsx)("span",{className:"text-sm font-medium",children:"Roadmap"}),(0,eb.jsx)(eeW,{icon:(0,eb.jsx)(FN,{}),value:e.runtime})]}),(0,eb.jsx)(mT,{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 eeK({label:e,value:t}){return(0,eb.jsxs)("span",{className:"grid min-w-0 gap-0.5 py-0.5",children:[(0,eb.jsx)("span",{className:"truncate ui-text-kbd text-muted-foreground",children:e}),(0,eb.jsx)("span",{className:"min-w-0 truncate text-sm font-semibold tracking-normal",children:t})]})}function eeG({title:e,items:t,empty:n="暂无内容"}){return(0,eb.jsxs)("div",{className:"grid gap-3",children:[(0,eb.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:e}),(0,eb.jsx)("div",{className:"overflow-hidden rounded-xl border bg-card",children:t.length>0?t.map((e,t)=>(0,eb.jsxs)("div",{className:tK("flex min-h-10 items-center gap-2 px-3 text-sm",t>0&&"border-t"),children:[(0,eb.jsx)(eeF,{className:"size-4 text-muted-foreground"}),(0,eb.jsx)("span",{className:"min-w-0 truncate",children:e})]},e)):(0,eb.jsx)("div",{className:"px-3 py-6 text-sm text-muted-foreground",children:n})})]})}function eeY({open:e,onOpenChange:t,onAdd:n}){return(0,eb.jsx)(mr,{open:e,onOpenChange:t,title:"添加节点",description:"搜索并选择要放入画布的可用节点。",className:"top-1/2 max-w-xl -translate-y-1/2",children:(0,eb.jsxs)(mn,{loop:!0,children:[(0,eb.jsx)(mi,{placeholder:"搜索节点..."}),(0,eb.jsxs)(ma,{children:[(0,eb.jsx)(mo,{children:"没有匹配节点。"}),(0,eb.jsx)(ml,{heading:"可用节点",children:HN.map(e=>(0,eb.jsxs)(ms,{value:`${e.title} ${e.description} ${e.keywords}`,onSelect:()=>n(e),children:[(0,eb.jsx)("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg border bg-background text-muted-foreground",children:e.icon}),(0,eb.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,eb.jsx)("span",{className:"block truncate text-sm font-medium",children:e.title}),(0,eb.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,eb.jsxs)(mc,{children:[e.size.width,"x",e.size.height]})]},e.id))})]})]})})}function eeX({nodes:e,edges:t,selectedNodeId:n,clipboardItems:r,onNodesChange:i,onEdgesChange:a,onNodesSet:o,onEdgesSet:l,onSelectedNodeChange:s,onClipboardItemsChange:c}){let d=ew.useRef(null),{addPaletteOpen:u,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:i,onSelectedNodeChange:a,onClipboardItemsChange:o}){let l=ew.useRef(0),s=ew.useRef(0),[c,d]=ew.useState(!1),[u,f]=ew.useState(),[h,p]=ew.useState(),m=ew.useCallback((t,n)=>{let r,i,a,o,l,s,c,d;return r=e.current,i=r?.querySelector(".react-flow__viewport"),a=r?.getBoundingClientRect(),l="none"!==(o=i?getComputedStyle(i).transform:"none")?new DOMMatrixReadOnly(o):void 0,s=l?.a&&Number.isFinite(l.a)?l.a:1,c=l?.e??0,d=l?.f??0,{x:(t-(a?.left??0)-c)/s,y:(n-(a?.top??0)-d)/s}},[e]),g=ew.useCallback((e,t)=>{r(n=>n.map(n=>{let r,i;return n.id===e?(i="string"==typeof(r=n.data??{}).activeTabId&&t.some(e=>e.id===r.activeTabId)?r.activeTabId:t[0]?.id,{...n,data:{...r,tabs:t,activeTabId:i}}):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 HO(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 i=(n=e.kind,HN.find(e=>e.id===n)?.size??Hw({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:HS(n,r),data:{contentScale:2,kind:e.kind,tab:{...e,id:`${t}-tab`}},width:r.width,height:r.height,style:Hj(r)}}({tab:e,nodeId:o,center:t,size:i})]),a(o)},[r,a]),w=ew.useCallback(async(e,n)=>{try{let i,a=n?.nodeId?t.find(e=>e.id===n.nodeId):void 0,o=a?(a.data??{}).kind:void 0,l="data-table-tab-viewer"===o?await U1(e):await U0(e),s=void 0!==a&&(i=a.data??{},"multi-tab-system"===i.kind||"file-tab-viewer"===i.kind||"data-table-tab-viewer"===i.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 i,a,o=Array.isArray(r.tabs)?r.tabs:[];return{...e,data:{...r,tabs:(i=o.filter(e=>e.id!==t.id),a=void 0===n?i.length:Math.min(Math.max(n,0),i.length),i.splice(a,0,t),i),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,u??{x:496,y:336})}catch{qr.error("文件预览打开失败")}},[b,t,r,u]),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,i=t.file?.machineId??"local";if(!r)throw qr.error("文件路径不可用"),Error("file path is unavailable");try{let a=await HD({machineId:i,path:r,content:n}),o={...t,title:a.name,modified:!1,defaultValue:"utf-8"===a.encoding?a.content:n,file:{...t.file,name:a.name,path:a.path,machineId:a.machine.id,mimeType:a.mimeType,kind:t.file?.kind,size:a.size,truncated:a.truncated}};x(e,o),qr.success("文件已保存")}catch(e){throw qr.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),i=r?r.payloads?.[fr]:void 0;if(i)return i;let a=e.dataTransfer.getData(fr);if(a)try{return JSON.parse(a)}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??{},i=Array.isArray(r.tabs)?r.tabs:[],a=new Set(i.map(e=>e.id)),o=n.tab.id,l=2;for(;a.has(o);)o=`${n.tab.id}-${l}`,l+=1;let s=[...i];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,i=t.y>=n.position.y&&t.y<=n.position.y+e.height;if(r&&i)return n}})(t,e),[t]),O=ew.useCallback((t,n,r)=>(function(e,t,n,r){let i=Array.from(e.current?.querySelectorAll(".react-flow__node")??[]).find(e=>e.getAttribute("data-id")===t),a=i?.querySelector('[data-slot="multi-tab-list"]');if(!a)return r;let o=Array.from(a.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:i,onTabChange:a,onSaveFileTab:o,onTerminalStateChange:l,onTabDetach:s,onExternalTabDrop:c}){return ew.useMemo(()=>e.map(e=>{let d=e.data??{},u=(e.data??{}).kind;return u?{...e,data:{...d,content:(0,eb.jsx)(eew,{kind:u,nodeId:e.id,tab:d.tab,tabs:d.tabs,activeTabId:d.activeTabId,terminalScopeId:`canvas:node:${e.id}`,terminalState:d.terminal,onTerminalStateChange:t=>l(e.id,t),onRequestFileTab:r,onOpenWorkspaceFile:i,onTabsChange:t,onTabChange:a,onSaveFileTab:o,onActiveTabChange:n,onTabDetach:s,onExternalTabDrop:c})}}:e}),[e,n,c,i,r,o,a,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=[]:HO(e.id)&&(r.tab=HA(e.id,`${t}-tab`)),{id:t,type:"blank",position:HS(n,e.size),data:r,width:e.size.width,height:e.size.height,style:Hj(e.size)}}({template:e,nodeId:n,center:u??{x:496,y:336}})]),a(void 0),d(!1),f(void 0)},[t.length,r,a,u]),z=ew.useCallback(e=>{let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id");if(!t)return;let i=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),a(void 0);return}let d=i?i.payloads?.[fn]:void 0;if(!i||!d)return;e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move",l.current+=1;let u=`${d.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:HS(n,r),style:e.style??Hj(r),selected:!1,data:{...e.data??{},resizing:!1}}}({source:d.node,nodeId:u,center:o})]),a(u)},[n,E,C,m,O,N,r,a]),_=ew.useCallback(e=>{Array.from(e.dataTransfer.types).some(e=>[fn,fr].includes(e))&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},[]),I=ew.useCallback((e,{flowPosition:t})=>{"add"===e&&(f(t),d(!0))},[]),D=ew.useCallback(e=>{i(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:[]}}]})},[i]),T=ew.useCallback((e,t,n)=>{"cut-edge"===e?i(e=>e.filter(e=>e.id!==t)):i(r=>r.map(r=>{if(r.id!==t)return r;let i=[...r.data?.anchors??[]];return"add-anchor"===e&&n.anchor&&i.splice(n.anchorIndex??i.length,0,n.anchor),"move-anchor"===e&&n.anchor&&void 0!==n.anchorIndex&&(i[n.anchorIndex]=n.anchor),"delete-anchor"===e&&void 0!==n.anchorIndex&&i.splice(n.anchorIndex,1),{...r,data:{...r.data??{},anchors:i}}}))},[i]),R=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 a(r),[...e,{...t,id:r,position:l,selected:!1,data:{...t.data??{},resizing:!1}}]});if("cut"===e){let e,l,s,c,d,u,f=t.find(e=>e.id===n);if(!f)return;let h=(e={...f.data??{}},delete e.content,delete e.mode,delete e.onConnectPointerDown,delete e.onSelectNode,delete e.resizing,c=(s=function(e){let t=e.data??{},n=t.tab;if(n?.id&&HO(n.kind))return n;let r=t.kind;if(HO(r))return HA(r,e.id)}(l={...f,selected:!1,data:{...e,resizing:!1}}))?{tab:s,sourceNodeId:f.id}:void 0,d={[fn]:{node:l}},u={"application/vnd.vantaloom.clip-kind":s?"canvas-tab":"canvas-node",[fn]:f.id},c&&(d[fr]=c,u[fr]=JSON.stringify(c)),{id:`clip-${f.id}`,title:s?.title??"画布节点",description:s?"来自画布的独立标签页。":"来自节点画布的空白节点。",meta:`${Math.round(f.width??192)}x${Math.round(f.height??112)}`,icon:s?HP(s.kind):(0,eb.jsx)(Hv,{className:"size-4"}),dragData:u,payloads:d});o(e=>[h,...e.filter(e=>e.id!==h.id)]),r(e=>e.filter(e=>e.id!==n)),i(e=>e.filter(e=>e.source!==n&&e.target!==n)),a(void 0)}},[t,o,i,r,a]);return{addPaletteOpen:c,addTemplateNode:A,filePickerDialog:(0,eb.jsx)(Ql,{open:void 0!==h,onOpenChange:e=>{e||p(void 0)},onSelectFile:e=>{p(void 0),w(e,h)}}),handleAddPaletteOpenChange:function(e){d(e),e||f(void 0)},handleCanvasAction:I,handleCanvasDragOver:_,handleCanvasDrop:z,handleNodeCanvasConnect:D,handleNodeCanvasEdgeAction:T,handleNodeCanvasNodeAction:R,renderedCanvasNodes:P}}({workspaceRef:d,nodes:e,clipboardItems:r,onNodesChange:i,onEdgesChange:a,onNodesSet:o,onEdgesSet:l,onSelectedNodeChange:s,onClipboardItemsChange:c});return(0,eb.jsxs)("div",{ref:d,className:"vtl-app-background vtl-canvas-workspace relative h-full w-full overflow-hidden",onDragOver:m,onDrop:g,children:[(0,eb.jsx)(cM,{"aria-label":"新建画布",className:"h-full min-h-0 rounded-none border-0",viewportClassName:"h-full",nodes:w,edges:t,nodeTypes:Hy,edgeTypes:Hb,onNodesChange:i,onEdgesChange:a,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,eb.jsx)(eeY,{open:u,onOpenChange:h,onAdd:f}),b,(0,eb.jsx)(qc,{position:"top-right"})]})}function eeZ({open:e,definitions:t,onOpenChange:n,onAdd:r}){return(0,eb.jsx)(mr,{open:e,onOpenChange:n,title:"添加卡片",description:"搜索并选择要添加到运维面板的卡片。",className:"top-1/2 max-w-xl -translate-y-1/2",children:(0,eb.jsxs)(mn,{loop:!0,children:[(0,eb.jsx)(mi,{placeholder:"搜索可添加卡片..."}),(0,eb.jsxs)(ma,{className:"max-h-[420px]",children:[(0,eb.jsx)(mo,{children:"没有找到可添加的卡片。"}),(0,eb.jsx)(ml,{heading:"运维面板卡片",children:t.map(e=>(0,eb.jsxs)(ms,{value:`${e.title} ${e.description}`,keywords:[e.id,e.defaultConfig.dataSource],onSelect:()=>r(e.id),className:"min-h-14 items-start py-2",children:[(0,eb.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,eb.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,eb.jsx)("span",{className:"block truncate font-medium",children:e.title}),(0,eb.jsx)("span",{className:"mt-0.5 block truncate ui-text-kbd text-muted-foreground",children:e.description})]}),(0,eb.jsxs)(mc,{children:[e.defaultSize.w,"x",e.defaultSize.h]})]},e.id))})]})]})})}function eeJ({open:e,dragMode:t,onOpenChange:n,onAdd:r,onDragModeChange:i}){let a=[{key:"add",label:"添加组件",icon:(0,eb.jsx)(s7,{className:"size-4"}),onClick:r,pressed:!1},{key:"drag",label:"拖拽排版",icon:(0,eb.jsx)(s2,{className:"size-4"}),onClick:()=>i(!t),pressed:t}];return(0,eb.jsx)("div",{className:"fixed right-5 bottom-5 z-30",children:(0,eb.jsxs)("div",{className:"relative size-8",children:[a.map((t,n)=>(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.label,"aria-pressed":t.pressed,onClick:t.onClick,className:tK("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,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":"仪表盘操作","aria-expanded":e,onClick:()=>n(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,eb.jsx)(s6,{className:tK("size-4 transition-transform",e&&"rotate-90")})})]})})}function eeQ({layout:e,layouts:t,cellSize:n,dragMode:r,selected:i,resizing:a,onSelect:o,onMove:l,onCut:s,onCopy:c,onSettingsOpen:d,onResizeStart:u,onResizeEnd:f,children:h}){let[p,m]=ew.useState(!1),g=e.x*(n+12),v=e.y*(n+12),x=e.w*n+(e.w-1)*12,y=e.h*n+(e.h-1)*12;return(0,eb.jsxs)("div",{"data-dashboard-widget":e.id,className:tK("absolute rounded-lg p-1 transition-[left,top,width,height,box-shadow] duration-200 ease-out",r&&"cursor-grab active:cursor-grabbing",p&&"duration-150",i&&!a&&"z-20 shadow-sm",a&&"z-30 transition-none"),style:{left:g,top:v,width:x,height:y},onPointerDown:function(i){if(!r||a)return;let s=i.target;if(s instanceof HTMLElement&&s.closest("[data-dashboard-action]"))return;i.preventDefault(),i.currentTarget.setPointerCapture(i.pointerId),o();let c=i.clientX,d=i.clientY;function u(r){let i=fm({...e,x:e.x+Math.round((r.clientX-c)/(n+12)),y:e.y+Math.round((r.clientY-d)/(n+12))});fp(i,t,e.id)||l(i)}m(!0),window.addEventListener("pointermove",u),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",e),m(!1)})},onClick:()=>{r&&o()},children:[(0,eb.jsx)("div",{className:tK("size-full",r&&"pointer-events-none"),children:h}),i&&r&&!a?(0,eb.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-1 rounded-lg border-2 border-foreground"}):null,i&&r&&!a?(0,eb.jsx)(ee0,{onSettingsOpen:d,onCut:s,onCopy:c,onResizeStart:u}):null,a?(0,eb.jsx)(ee1,{layout:e,layouts:t,cellSize:n,onResize:l,onResizeEnd:f}):null]})}function ee0({onSettingsOpen:e,onCut:t,onCopy:n,onResizeStart:r}){return(0,eb.jsx)(cn,{"data-dashboard-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,eb.jsxs)(cr,{children:[(0,eb.jsx)(ci,{type:"button","aria-label":"调整大小",onClick:r,children:(0,eb.jsx)(s3,{className:"size-4"})}),(0,eb.jsx)(ci,{type:"button","aria-label":"卡片设置",onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),e()},onClick:e=>e.stopPropagation(),children:(0,eb.jsx)(mf,{className:"size-4"})}),(0,eb.jsx)(ci,{type:"button","aria-label":"复制",onClick:n,children:(0,eb.jsx)(s0,{className:"size-4"})}),(0,eb.jsx)(ci,{type:"button","aria-label":"剪切",onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),t()},onClick:e=>e.stopPropagation(),children:(0,eb.jsx)(ce,{className:"size-4"})})]})})}function ee1({layout:e,layouts:t,cellSize:n,onResize:r,onResizeEnd:i}){return(0,eb.jsx)("div",{"data-dashboard-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(a=>(0,eb.jsx)("button",{type:"button","aria-label":`调整 ${a.id}`,className:tK("pointer-events-auto absolute size-2.5 border border-foreground bg-background shadow-sm",a.className),onPointerDown:o=>(function(a,o){a.preventDefault(),a.stopPropagation(),a.currentTarget.setPointerCapture(a.pointerId);let l=a.clientX,s=a.clientY;function c(i){let a=Math.round((i.clientX-l)/(n+12)),c=Math.round((i.clientY-s)/(n+12)),d={...e};o.includes("right")&&(d.w=e.w+a),o.includes("bottom")&&(d.h=e.h+c),o.includes("left")&&(d.x=e.x+a,d.w=e.w-a),o.includes("top")&&(d.y=e.y+c,d.h=e.h-c),fp(d=fm(d),t,e.id)||r(d)}window.addEventListener("pointermove",c),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",e),i()})})(o,a.id)},a.id))})}function ee2({open:e,layout:t,definition:n,config:r,cellSize:i,onOpenChange:a,onConfigChange:o}){let l=t&&i>0?t.w*i+(t.w-1)*12:320,s=t&&i>0?t.h*i+(t.h-1)*12:180;return(0,eb.jsx)(po,{open:e,onOpenChange:a,children:(0,eb.jsx)(mv,{side:"right",className:"w-screen gap-0 border-0 bg-transparent p-0 shadow-none sm:max-w-none",children:t&&n&&r?(0,eb.jsxs)("div",{className:"grid h-full min-w-0 grid-cols-1 lg:grid-cols-[minmax(0,1fr)_24rem]",children:[(0,eb.jsx)(ee5,{width:l,height:s,className:"hidden lg:grid",children:n.render(r)}),(0,eb.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,eb.jsxs)(mx,{className:"border-b",children:[(0,eb.jsx)(my,{children:"卡片设置"}),(0,eb.jsxs)(mb,{children:[n.title," · ",t.w,"x",t.h]})]}),(0,eb.jsxs)("div",{className:"grid flex-1 content-start gap-4 overflow-y-auto p-4",children:[(0,eb.jsxs)("label",{className:"grid gap-1.5",children:[(0,eb.jsx)("span",{className:"ui-text-control font-medium",children:"显示标题"}),(0,eb.jsx)(ny,{value:r.title,onChange:e=>o({title:e.currentTarget.value})})]}),(0,eb.jsxs)("label",{className:"grid gap-1.5",children:[(0,eb.jsx)("span",{className:"ui-text-control font-medium",children:"数据来源"}),(0,eb.jsx)(ny,{value:r.dataSource,onChange:e=>o({dataSource:e.currentTarget.value})})]}),(0,eb.jsxs)("label",{className:"grid gap-1.5",children:[(0,eb.jsx)("span",{className:"ui-text-control font-medium",children:"刷新间隔"}),(0,eb.jsx)(ny,{value:r.refreshRate,onChange:e=>o({refreshRate:e.currentTarget.value})})]}),(0,eb.jsxs)("label",{className:"grid gap-1.5",children:[(0,eb.jsx)("span",{className:"ui-text-control font-medium",children:"备注"}),(0,eb.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,eb.jsxs)("div",{className:"rounded-lg border bg-muted/20 p-3",children:[(0,eb.jsx)("div",{className:"ui-text-control font-medium",children:"当前绑定"}),(0,eb.jsxs)("div",{className:"mt-2 grid gap-1 ui-text-kbd text-muted-foreground",children:[(0,eb.jsxs)("span",{children:["类型:",n.id]}),(0,eb.jsxs)("span",{children:["来源:",r.dataSource]}),(0,eb.jsxs)("span",{children:["刷新:",r.refreshRate]})]})]})]})]})]}):null})})}function ee5({width:e,height:t,className:n,children:r}){let[i,a]=f3(),o=a.width>0&&a.height>0?Math.min(1,(a.width-32)/e,(a.height-32)/t):1;return(0,eb.jsx)("div",{ref:i,className:tK("min-h-0 min-w-0 place-items-center overflow-hidden p-4",n),children:(0,eb.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 ee4(){return ew.useMemo(()=>[{id:"active-runs",title:ez.activeRuns,description:"当前正在执行的 Agent 运行数量。",icon:(0,eb.jsx)(BY,{className:"size-4"}),defaultSize:{w:3,h:1},defaultConfig:{title:ez.activeRuns,dataSource:"本机运行队列",refreshRate:"5s",note:"统计所有未完成的运行。"},render:e=>(0,eb.jsx)(FR,{label:e.title,value:"18",jellyImage:u4,jellyImagePosition:"center"})},{id:"queue",title:ez.queue,description:"排队等待调度的任务数量。",icon:(0,eb.jsx)(Hg,{className:"size-4"}),defaultSize:{w:3,h:1},defaultConfig:{title:ez.queue,dataSource:"调度器",refreshRate:"5s",note:"用于观察调度压力。"},render:e=>(0,eb.jsx)(FR,{label:e.title,value:"7",jellyImage:u3,jellyImagePosition:"center"})},{id:"cost",title:ez.cost,description:"今日模型、工具和机器资源消耗。",icon:(0,eb.jsx)(FA,{className:"size-4"}),defaultSize:{w:3,h:1},defaultConfig:{title:ez.cost,dataSource:"用量聚合",refreshRate:"1m",note:"后续可接入工作组账单。"},render:e=>(0,eb.jsx)(FR,{label:e.title,value:"$42.8",jellyImage:u6,jellyImagePosition:"center"})},{id:"machines-summary",title:ez.machineStatus,description:"工作组内可用机器概况。",icon:(0,eb.jsx)(F_,{className:"size-4"}),defaultSize:{w:3,h:1},defaultConfig:{title:ez.machineStatus,dataSource:"工作组机器",refreshRate:"15s",note:"包含本机、直连机器和 P2P 节点。"},render:e=>(0,eb.jsx)(FR,{label:e.title,value:"2 / 3",jellyImage:u8,jellyImagePosition:"center"})},{id:"resource-trend",title:ez.resourceTrend,description:"CPU 与内存趋势图。",icon:(0,eb.jsx)(FL,{className:"size-4"}),defaultSize:{w:8,h:4},defaultConfig:{title:ez.resourceTrend,dataSource:"机器遥测",refreshRate:"10s",note:"默认显示最近 6 个采样点。"},render:e=>(0,eb.jsx)(F$,{title:e.title})},{id:"run-mix",title:ez.runMix,description:"不同类型 Agent 运行的占比。",icon:(0,eb.jsx)(mR,{className:"size-4"}),defaultSize:{w:4,h:4},defaultConfig:{title:ez.runMix,dataSource:"运行记录",refreshRate:"30s",note:"用于快速观察任务类型构成。"},render:e=>(0,eb.jsx)(VU,{title:e.title})},{id:"machine-status",title:ez.machineStatus,description:"各机器 CPU、内存、GPU 与磁盘状态。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:8,h:5},defaultConfig:{title:ez.machineStatus,dataSource:"工作组机器",refreshRate:"10s",note:"用于运维总览的核心资源面板。"},render:e=>(0,eb.jsx)(FD,{title:e.title})},{id:"schedule",title:ez.schedule,description:"维护窗口、提醒和自动化计划。",icon:(0,eb.jsx)(VG,{className:"size-4"}),defaultSize:{w:4,h:5},defaultConfig:{title:ez.schedule,dataSource:"本机日程",refreshRate:"5m",note:"之后可接工作组日程。"},render:e=>(0,eb.jsx)(VX,{title:e.title})}],[])}function ee3({clipboardItems:e,onClipboardItemsChange:t,onOverlayOpenChange:n}){let[r,i]=ew.useState(!1),[a,o]=ew.useState(!1),[l,s]=ew.useState(!1),[c,d]=ew.useState(ff),[u,f]=ew.useState({}),[h,p]=ew.useState(),[m,g]=ew.useState(),[v,x]=ew.useState(),y=ew.useRef(0),b=ew.useRef(0),[w,j]=f3(),k=j.width>0?(j.width-132)/12:96,S=Math.max(9,fh(c)+2),C=S*k+(S-1)*12,N=ee4(),M=ew.useMemo(()=>new Map(N.map(e=>[e.id,e])),[N]);function E(e){let t=M.get(e.kind);return u[e.id]??(t?fv(t):void 0)}function O(e){d(t=>{let n=fm(e);return fp(n,t,n.id)?t:t.map(e=>e.id===n.id?n:e)})}ew.useEffect(()=>{n(a||!!v)},[a,n,v]),ew.useEffect(()=>()=>n(!1),[n]),ew.useEffect(()=>{l||(p(void 0),g(void 0))},[l]),ew.useEffect(()=>{if(m)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof HTMLElement&&t.closest("[data-dashboard-action]")||(p(m),g(void 0))}},[m]);let P=v?c.find(e=>e.id===v):void 0,A=P?M.get(P.kind):void 0,z=P?E(P):void 0;return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("div",{ref:w,"data-dashboard-board":!0,className:tK("relative mx-auto max-w-7xl p-4 lg:p-6",l&&"select-none"),style:{minHeight:C+48},onDragOver:e=>{Array.from(e.dataTransfer.types).includes("application/vnd.vantaloom.dashboard-widget-kind")&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},onDrop:function(t){let n=t.dataTransfer.getData("application/vnd.vantaloom.clip-id"),r=t.dataTransfer.getData("application/vnd.vantaloom.dashboard-widget-kind");if(!n||!r)return;let i=e.find(e=>e.id===n);if(!i)return;t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect="move";let a=w.current,o=a?.getBoundingClientRect();!function(e,t){let n=fx(e);if(!n)return;b.current+=1;let r=`${n.kind}-clip-${b.current}`,i=fm({id:r,kind:n.kind,x:t?.x??0,y:t?.y??fh(c),w:n.w,h:n.h}),a=t&&!fp(i,c)?i:fg(c,r,n.kind,n.w,n.h);d(e=>[...e,a]),f(e=>({...e,[r]:{...n.config}})),p(r),g(void 0)}(i,{x:o&&k>0?Math.round((t.clientX-o.left-24)/(k+12)):0,y:o&&k>0?Math.round((t.clientY-o.top-24)/(k+12)):fh(c)})},onPointerDown:e=>{e.target===e.currentTarget&&(p(void 0),l||g(void 0))},children:(0,eb.jsx)("div",{className:"relative",style:{height:C},children:c.map(e=>{let n=N.find(t=>t.id===e.kind);if(!n)return null;let r=E(e);return r?(0,eb.jsx)(eeQ,{layout:e,layouts:c,cellSize:k,dragMode:l,selected:h===e.id,resizing:m===e.id,onSelect:()=>{l&&p(e.id)},onMove:O,onCut:()=>(function(e){let n=c.find(t=>t.id===e),r=n?M.get(n.kind):void 0,i=n?E(n):void 0;if(!n||!r||!i)return;let a=function({layout:e,definition:t,config:n}){let r={kind:e.kind,w:e.w,h:e.h,config:{...n}};return{id:`clip-${e.id}`,title:n.title||t.title,description:t.description,meta:`${e.w}x${e.h}`,icon:t.icon,dragData:{"application/vnd.vantaloom.clip-kind":"dashboard-widget","application/vnd.vantaloom.dashboard-widget-kind":e.kind,"application/vnd.vantaloom.dashboard-widget-width":String(e.w),"application/vnd.vantaloom.dashboard-widget-height":String(e.h),"application/vnd.vantaloom.dashboard-widget-config":JSON.stringify(n)},payloads:{[fi]:r}}}({layout:n,definition:r,config:i});t(e=>[a,...e.filter(e=>e.id!==a.id)]),d(t=>t.filter(t=>t.id!==e)),f(t=>{let n={...t};return delete n[e],n}),p(void 0),g(void 0),x(t=>t===e?void 0:t)})(e.id),onCopy:()=>(function(e){let t=c.find(t=>t.id===e);if(!t)return;y.current+=1;let n=`${e}-copy-${y.current}`,r=fg(c,n,t.kind,t.w,t.h);d(e=>[...e,r]),f(r=>({...r,[n]:r[e]??fv(M.get(t.kind))})),p(n)})(e.id),onSettingsOpen:()=>x(e.id),onResizeStart:()=>{p(void 0),g(e.id)},onResizeEnd:()=>{p(e.id),g(void 0)},children:n.render(r)},e.id):null})})}),(0,eb.jsx)(eeJ,{open:r,dragMode:l,onOpenChange:i,onAdd:()=>{i(!1),o(!0)},onDragModeChange:s}),(0,eb.jsx)(eeZ,{open:a,definitions:N,onOpenChange:o,onAdd:function(e){let t=M.get(e);if(!t)return;b.current+=1;let n=`${e}-added-${b.current}`,r=fg(c,n,e,t.defaultSize.w,t.defaultSize.h);d(e=>[...e,r]),f(e=>({...e,[n]:fv(t)})),p(n),g(void 0),o(!1)}}),(0,eb.jsx)(ee2,{open:!!(P&&A&&z),layout:P,definition:A,config:z,cellSize:k,onOpenChange:e=>{e||x(void 0)},onConfigChange:e=>{var t;let n,r;P&&(t=P.id,r=(n=c.find(e=>e.id===t))?M.get(n.kind):void 0,n&&r&&f(n=>({...n,[t]:{...n[t]??fv(r),...e}})))}})]})}let ee6={delete:"Delete",empty:"Drop here",title:"Trash"};function ee8({active:e=!1,items:t=[],labels:n,className:r,onDrop:i,onDelete:a,onItemRestore:o,...l}){let s={...ee6,...n},[c,d]=ew.useState(!1),u=ew.useRef(0),f=e||c||t.length>0;return ew.useEffect(()=>{e||(u.current=0,d(!1))},[e]),(0,eb.jsx)("div",{"data-slot":"trash-drop-zone","data-visible":f,"data-drag-inside":c,className:tK("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(),u.current+=1,d(!0)},onDragLeave:function(){u.current=Math.max(0,u.current-1),0===u.current&&d(!1)},onDragOver:function(e){e.preventDefault(),e.dataTransfer.dropEffect="move",d(!0)},onDrop:function(e){e.preventDefault(),e.stopPropagation(),u.current=0,d(!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&&i?.({id:t,title:n,meta:r,nativeEvent:e})},...l,children:(0,eb.jsx)("div",{className:tK("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,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.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,eb.jsx)(m2,{className:"size-4"}),(0,eb.jsx)("span",{children:s.empty})]}),t.length>0?(0,eb.jsx)("div",{className:"grid max-h-36 gap-1 overflow-y-auto pr-1",children:t.map(e=>(0,eb.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,eb.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,eb.jsx)(p6,{className:"size-3.5"})}),(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:e.title}),e.meta?(0,eb.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:e.meta}):null]},e.id))}):null,t.length>0?(0,eb.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:()=>a?.(t),children:s.delete}):null]}):(0,eb.jsx)(m2,{className:"size-5"})})})}function ee7({hidden:e,items:t,trashItems:n,trashClipboardItems:r,draggingId:i,onDraggingChange:a,onItemsChange:o,onTrashItemsChange:l,onTrashClipboardItemsChange:s}){let c=ew.useRef(0),[d,u]=ew.useState(!1);return(ew.useEffect(()=>{u(!0)},[]),d)?(0,t3.createPortal)((0,eb.jsxs)("div",{className:tK("pointer-events-none fixed inset-0 z-40 overflow-visible transition-opacity duration-200",e&&"opacity-0"),children:[(0,eb.jsx)(ee8,{active:!e&&void 0!==i,items:e?[]:n,className:tK(e&&"pointer-events-none"),labels:{delete:"删除",empty:"拖入暂存"},onDrop:({id:e,title:n,meta:r})=>{let i=t.find(t=>t.id===e);i&&(s(t=>({...t,[e]:i})),l(t=>t.some(t=>t.id===e)?t:[...t,{id:e,title:n,meta:r,icon:i.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,eb.jsx)("div",{className:tK("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,eb.jsx)(Qb,{items:t,title:"剪切板",labels:{empty:"剪切板为空",dragHandle:"拖拽卡片"},expansionDirection:"down-left",removeOnExternalDrop:!0,maxExpandedHeight:420,onItemDuplicate:(e,{item:n,index:r})=>{let i,a,l,s,d;return c.current+=1,i=fx(n),a=n.payloads?{...n.payloads}:void 0,l=n.payloads?.[fa],i&&a&&(a[fi]={...i,config:{...i.config}}),l&&a&&(a[fa]={...l,config:l.config?{...l.config}:l.config}),s={...n,id:`${n.id}-copy-${c.current}`,title:`${n.title} copy`,payloads:a,dragData:{...n.dragData,...i?{"application/vnd.vantaloom.dashboard-widget-config":JSON.stringify(i.config)}:{}}},void((d=[...t]).splice(r+1,0,s),o(d))},onItemsRemove:e=>o(e),onItemsReorder:e=>o(e),onItemDragStart:({item:e})=>a(e.id),onItemDragEnd:()=>a(void 0)})}):null]}),document.body):null}let ee9=ew.createContext(96);function ete(e,t){let n=e[t];if(!n)throw Error(`Missing static grid layout: ${t}`);return n}function ett({layouts:e,minRows:t=9,className:n,children:r,...i}){let[a,o]=f3(),l=o.width>0?(o.width-132)/12:96,s=Math.max(t,e.reduce((e,t)=>Math.max(e,t.y+t.h),0)+2),c=s*l+(s-1)*12;return(0,eb.jsx)("div",{ref:a,className:tK("relative mx-auto max-w-7xl p-4 lg:p-6",n),style:{minHeight:c+48},...i,children:(0,eb.jsx)("div",{className:"relative",style:{height:c},children:(0,eb.jsx)(ee9.Provider,{value:l,children:r})})})}function etn({layout:e,className:t,style:n,...r}){let i=ew.useContext(ee9);return(0,eb.jsx)("div",{className:tK("absolute min-w-0",t),style:{left:e.x*(i+12),top:e.y*(i+12),width:e.w*i+(e.w-1)*12,height:e.h*i+(e.h-1)*12,...n},...r})}let etr=[{id:"firewall",x:0,y:0,w:12,h:8}],eti=f4(etr);function eta(){var e;return e=(0,eb.jsx)(ett,{layouts:etr,children:(0,eb.jsx)(etn,{layout:ete(eti,"firewall"),className:"vtl-firewall-card overflow-hidden rounded-xl border bg-card",children:(0,eb.jsx)(Qr,{})})}),(0,eb.jsx)(f5,{children:e})}let eto=eN("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"}]]),etl=eN("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"}]]),ets=eN("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"}]]),etc=eN("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"}]]),etd=eN("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"}]]),etu=[{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}],etf=[{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}],eth=[{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"}],etp=[["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","失败"]],etm={cpu:{label:"CPU",color:"var(--chart-1)"},memory:{label:"Memory",color:"var(--chart-3)"},network:{label:"Network",color:"var(--chart-5)"}};function etg(e,t,n=42,r){return(0,eb.jsx)("section",{className:tK("size-full rounded-xl border bg-card p-5",r&&"vtl-jelly-image-card",r&&u7(r)&&"vtl-jelly-image-card-shadowless"),style:r?u9({image:r,opacity:.74,blur:"8px"}):void 0,children:(0,eb.jsx)(mM,{label:e,value:t,minSize:n})})}function etv(e,t,n=""){return{title:e,dataSource:t,refreshRate:"10s",note:n}}let etx={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]}]},ety=[{id:"metric-runs",title:"运行中",description:"当前正在执行的运行数量。",icon:(0,eb.jsx)(BY,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etv("运行中","运行队列"),render:e=>etg(e.title,"07",44,u4)},{id:"metric-queued",title:"排队",description:"等待调度的任务数量。",icon:(0,eb.jsx)(Hg,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etv("排队","调度器"),render:e=>etg(e.title,"04",44,u3)},{id:"metric-blocked",title:"待确认",description:"等待人工确认的任务数量。",icon:(0,eb.jsx)(etd,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etv("待确认","确认队列"),render:e=>etg(e.title,"03",44,u6)},{id:"metric-workers",title:"Worker",description:"当前可调度 worker 数量。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etv("Worker","Agent worker"),render:e=>etg(e.title,"14",44,u8)},{id:"queue",title:"任务队列",description:"运行队列 Roadmap。",icon:(0,eb.jsx)(ets,{className:"size-4"}),defaultSize:{w:7,h:5},defaultConfig:etv("任务队列","运行队列"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(Bz,{items:etu})]})},{id:"workers",title:"Agent worker",description:"各 worker 的负载和容量。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:5,h:5},defaultConfig:etv("Agent worker","Worker 状态"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(BI,{workers:etf})]})},{id:"log",title:"最近执行",description:"最近执行记录 Roadmap。",icon:(0,eb.jsx)(g7,{className:"size-4"}),defaultSize:{w:7,h:4},defaultConfig:etv("最近执行","执行日志"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(BA,{items:etp})]})},{id:"confirmations",title:"待确认",description:"等待人工确认的事项。",icon:(0,eb.jsx)(VK,{className:"size-4"}),defaultSize:{w:5,h:4},defaultConfig:etv("待确认","确认队列"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(BP,{items:eth})]})}],etb=[{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 etw(e=etx){return[{id:"metric-online",title:"在线机器",description:"当前在线机器数量。",icon:(0,eb.jsx)(F_,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etv("在线机器","机器心跳"),render:t=>etg(t.title,String(e.metrics.online),44,u4)},{id:"metric-health",title:"健康度",description:"工作组整体健康度。",icon:(0,eb.jsx)(WJ,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etv("健康度","服务遥测"),render:t=>etg(t.title,`${e.metrics.health}%`,44,u3)},{id:"metric-latency",title:"平均延迟",description:"机器连接平均延迟。",icon:(0,eb.jsx)(FI,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etv("平均延迟","网络遥测"),render:t=>etg(t.title,e.metrics.latency,44,u6)},{id:"metric-events",title:"事件",description:"最近事件数量。",icon:(0,eb.jsx)(VK,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etv("事件","事件流"),render:t=>etg(t.title,String(e.metrics.events),44,u8)},{id:"machines",title:"机器健康矩阵",description:"各机器资源和心跳状态。",icon:(0,eb.jsx)(F_,{className:"size-4"}),defaultSize:{w:7,h:5},defaultConfig:etv("机器健康矩阵","机器遥测"),render:t=>(0,eb.jsxs)("section",{className:"vtl-jelly-image-card flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",style:u9({image:"/themes/jelly/card1.png",opacity:.88,blur:"10px"}),children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(BL,{machines:e.machines})]})},{id:"trend",title:"资源趋势",description:"CPU、内存和网络趋势。",icon:(0,eb.jsx)(eto,{className:"size-4"}),defaultSize:{w:5,h:5},defaultConfig:etv("资源趋势","机器遥测"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(BH,{config:etm,data:e.trend})]})},{id:"network",title:"网络连接",description:"机器之间连接状态。",icon:(0,eb.jsx)(m$,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:etv("网络连接","网络遥测"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(BB,{links:e.networkLinks})]})},{id:"events",title:"事件流",description:"最近遥测事件。",icon:(0,eb.jsx)(VK,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:etv("事件流","事件流"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(BR,{events:e.events})]})},{id:"services",title:"服务健康",description:"服务 30 分钟粒度健康条。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:12,h:3},defaultConfig:etv("服务健康","服务遥测"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(BW,{services:e.serviceHealth})]})}]}let etj=etw(),etk=[{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}],etS={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:ZK,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 etC(e=etS){return[{id:"total",title:"机器",description:"工作组机器总数。",icon:(0,eb.jsx)(F_,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etv("机器","机器组"),render:t=>etg(t.title,String(e.totals.machines),42,u4)},{id:"online",title:"在线",description:"当前在线机器。",icon:(0,eb.jsx)(WJ,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etv("在线","机器心跳"),render:t=>etg(t.title,String(e.totals.online),42,u3)},{id:"runtime",title:"Runtime",description:"可用 runtime 数量。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etv("Runtime","Agent runtime"),render:t=>etg(t.title,String(e.totals.runtime),42,u6)},{id:"tokens",title:"Token",description:"已注册 token 数。",icon:(0,eb.jsx)(etd,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etv("Token","机器注册"),render:t=>etg(t.title,String(e.totals.tokens),42,u8)},{id:"machines",title:"机器组",description:"机器角色、版本和标签。",icon:(0,eb.jsx)(F_,{className:"size-4"}),defaultSize:{w:12,h:4},defaultConfig:etv("机器组","机器组"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(VJ,{machines:e.machines})]})},{id:"topology",title:"拓扑图",description:"工作组连接拓扑。",icon:(0,eb.jsx)(etc,{className:"size-4"}),defaultSize:{w:12,h:6},defaultConfig:etv("拓扑图","网络拓扑"),render:()=>(0,eb.jsx)("section",{className:"size-full rounded-xl border bg-card p-3",children:(0,eb.jsx)(BE,{nodes:e.topology.nodes,links:e.topology.links})})},{id:"direct",title:"直连",description:"直连路径数量。",icon:(0,eb.jsx)(m$,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etv("直连","网络拓扑"),render:t=>etg(t.title,String(e.pathTotals.direct),42,u4)},{id:"p2p",title:"P2P",description:"P2P 路径数量。",icon:(0,eb.jsx)(FI,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etv("P2P","网络拓扑"),render:t=>etg(t.title,String(e.pathTotals.p2p),42,u3)},{id:"relay",title:"Relay",description:"Relay 路径数量。",icon:(0,eb.jsx)(etc,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etv("Relay","网络拓扑"),render:t=>etg(t.title,String(e.pathTotals.relay),42,u6)},{id:"broken",title:"中断",description:"中断路径数量。",icon:(0,eb.jsx)(etd,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etv("中断","网络拓扑"),render:t=>etg(t.title,String(e.pathTotals.broken),42,u8)},{id:"trend",title:"延迟",description:"不同路径延迟趋势。",icon:(0,eb.jsx)(eto,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:etv("延迟","网络遥测"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(Bw,{config:ZY,data:e.latency})]})},{id:"paths",title:"候选路径",description:"可用连接路径候选。",icon:(0,eb.jsx)(etc,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:etv("候选路径","网络候选路径"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(Bj,{candidates:e.candidates})]})}]}let etN=etC(),etM=[{id:"total",kind:"total",x:0,y:0,w:3,h:2},{id:"online",kind:"online",x:3,y:0,w:3,h:2},{id:"runtime",kind:"runtime",x:6,y:0,w:3,h:2},{id:"tokens",kind:"tokens",x:9,y:0,w:3,h:2},{id:"machines",kind:"machines",x:0,y:2,w:12,h:4},{id:"topology",kind:"topology",x:0,y:6,w:12,h:6},{id:"direct",kind:"direct",x:0,y:12,w:3,h:2},{id:"p2p",kind:"p2p",x:3,y:12,w:3,h:2},{id:"relay",kind:"relay",x:6,y:12,w:3,h:2},{id:"broken",kind:"broken",x:9,y:12,w:3,h:2},{id:"trend",kind:"trend",x:0,y:14,w:6,h:4},{id:"paths",kind:"paths",x:6,y:14,w:6,h:4}],etE=[{id:"events",title:"日志与审计",description:"审计事件时间线。",icon:(0,eb.jsx)(ets,{className:"size-4"}),defaultSize:{w:8,h:7},defaultConfig:etv("日志与审计","审计事件"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(bj,{events:ZG})]})},{id:"filters",title:"筛选",description:"审计记录筛选维度。",icon:(0,eb.jsx)(etl,{className:"size-4"}),defaultSize:{w:4,h:3},defaultConfig:etv("筛选","审计筛选"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(bw,{rows:[["机器","4"],["用户","4"],["Agent","6"],["时间","24h"]]})]})},{id:"risk",title:"拒绝事件",description:"权限拒绝和危险操作数量。",icon:(0,eb.jsx)(etd,{className:"size-4"}),defaultSize:{w:4,h:4},defaultConfig:etv("拒绝事件","审计事件"),render:e=>etg(e.title,"05",42,"/themes/jelly/bg5.png")},{id:"trend",title:"事件趋势",description:"审计事件趋势图。",icon:(0,eb.jsx)(eto,{className:"size-4"}),defaultSize:{w:12,h:4},defaultConfig:etv("事件趋势","审计事件"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(FC,{config:ZY,data:ZK})]})}],etO=[{id:"events",kind:"events",x:0,y:0,w:8,h:7},{id:"filters",kind:"filters",x:8,y:0,w:4,h:3},{id:"risk",kind:"risk",x:8,y:3,w:4,h:4},{id:"trend",kind:"trend",x:0,y:7,w:12,h:4}],etP={totals:{machines:0,online:0,runtime:0,tokens:0},machines:[],topology:{nodes:[],links:[]},pathTotals:{direct:0,p2p:0,relay:0,broken:0},latency:[],candidates:[]},etA={metrics:{online:0,health:0,latency:"local",events:0},machines:[],trend:[],networkLinks:[],events:[],serviceHealth:[]};function etz(e,t){let[n,r]=ew.useState(t);return ew.useEffect(()=>{let n=!0,i=!1;async function a(){if(!i){i=!0;try{let t=await fetch(e,{cache:"no-store"});if(!t.ok)return;let i=await t.json();n&&r(i)}catch{n&&r(t)}finally{i=!1}}}a();let o=window.setInterval(a,2e3);return()=>{n=!1,window.clearInterval(o)}},[t,e]),n}function et_(e){return(0,eb.jsx)(f5,{children:e})}function etI({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){let r=etz("/api/local/machines/fleet",etP),i=ew.useMemo(()=>etC(r),[r]);return(0,eb.jsx)(mk,{boardId:"machine-group",definitions:i,initialLayouts:etM,clipboardItems:e,actionLabel:"机器组页面卡片操作",paletteGroupTitle:"机器组页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}let etD=[{id:"processes",x:0,y:0,w:12,h:8}],etT=f4(etD);function etR(){return et_((0,eb.jsx)(ett,{layouts:etD,children:(0,eb.jsx)(etn,{layout:ete(etT,"processes"),className:"overflow-hidden",children:(0,eb.jsx)(eer,{})})}))}let etL=[{id:"performance",x:0,y:0,w:12,h:8}],et$=f4(etL);function etF(){return et_((0,eb.jsx)(ett,{layouts:etL,children:(0,eb.jsx)(etn,{layout:ete(et$,"performance"),className:"overflow-hidden",children:(0,eb.jsx)(eei,{})})}))}function etV({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){return(0,eb.jsx)(mk,{boardId:"audit-logs",definitions:etE,initialLayouts:etO,clipboardItems:e,actionLabel:"日志审计页面卡片操作",paletteGroupTitle:"日志审计页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}let etB=eN("folder-tree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]),etH=eN("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"}]]),etW=eN("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),etq=eN("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),etU=[{id:"dashboard",label:e_.dashboard,icon:(0,eb.jsx)(etl,{})},{id:"canvas",label:e_.canvas,icon:(0,eb.jsx)(Hv,{}),badge:"4"},{id:"machines",label:e_.machines,icon:(0,eb.jsx)(F_,{})},{id:"schedules",label:e_.schedules,icon:(0,eb.jsx)(VG,{})},{id:"settings",label:e_.settings,icon:(0,eb.jsx)(mf,{})}],etK=[{id:"dashboard",title:e_.dashboard,description:ez.subtitle,sections:[{id:"main",items:[{id:"overview",label:e_.overview,icon:(0,eb.jsx)(vj,{})},{id:"runs",label:e_.runs,icon:(0,eb.jsx)(BY,{}),badge:"12"},{id:"telemetry",label:e_.telemetry,icon:(0,eb.jsx)(Hg,{})}]}]},{id:"canvas",title:e_.canvas,description:"节点画布、Agent 对话和运行工作区。",sections:[{id:"canvases",title:e_.canvas,items:[{id:"open-recent-canvas",label:e_.canvasRecent,icon:(0,eb.jsx)(Hv,{})},{id:"new-canvas",label:e_.canvasNew,icon:(0,eb.jsx)(s7,{})},{id:"all-canvases",label:e_.canvasAll,icon:(0,eb.jsx)(FA,{})}]},{id:"conversations",title:"Agent 对话",items:[{id:"open-recent-conversation",label:e_.conversationRecent,icon:(0,eb.jsx)(etH,{})},{id:"new-agent-conversation",label:e_.conversationNew,icon:(0,eb.jsx)(mR,{})},{id:"all-conversations",label:e_.conversationAll,icon:(0,eb.jsx)(BY,{})}]}]},{id:"machines",title:e_.machines,description:"机器、网络、权限和审计。",sections:[{id:"machines",items:[{id:"machine-group",label:e_.fleet,icon:(0,eb.jsx)(eP,{})},{id:"process-management",label:"进程管理",icon:(0,eb.jsx)(etq,{})},{id:"machine-performance",label:"性能",icon:(0,eb.jsx)(Hg,{})},{id:"machine-firewall",label:"防火墙",icon:(0,eb.jsx)(Qs,{})},{id:"audit-logs",label:"日志与审计",icon:(0,eb.jsx)(etW,{})},{id:"machine-files",label:"文件管理",icon:(0,eb.jsx)(etB,{})}]}]},{id:"schedules",title:e_.schedules,description:"自动化、维护窗口和提醒。",sections:[{id:"plans",items:[{id:"calendar",label:e_.calendar,icon:(0,eb.jsx)(VG,{})},{id:"alerts",label:"提醒",icon:(0,eb.jsx)(VK,{})}]}]},{id:"settings",title:e_.settings,description:"系统、工作组和用量配置。",sections:[{id:"settings",items:[{id:"preferences",label:"偏好设置",icon:(0,eb.jsx)(mf,{})},{id:"card-management",label:"卡片管理",icon:(0,eb.jsx)(etl,{})},{id:"billing",label:e_.billing,icon:(0,eb.jsx)(FA,{})}]}]}],etG=eN("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]);function etY({className:e,divided:t=!0,children:n,...r}){let i=ew.Children.toArray(n).filter(Boolean);return(0,eb.jsx)("div",{"data-slot":"settings-card",className:tK("vtl-surface-card overflow-hidden rounded-[var(--surface-card-radius)] border",e),...r,children:t?i.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[e,t<i.length-1&&(0,eb.jsx)(VY,{})]},t)):n})}let etX=[{id:"cards",x:0,y:0,w:12,h:9}],etZ=f4(etX),etJ=[{id:"machine-workspaces",title:"机器页面",cards:[{id:"process-management",title:"进程管理",description:"机器进程、服务和 Agent worker 进程视图。",icon:(0,eb.jsx)(etq,{className:"size-4"}),defaultSize:{w:12,h:8},dataSource:"机器进程"},{id:"machine-performance",title:"性能",description:"CPU、内存、磁盘、网络和 GPU 性能视图。",icon:(0,eb.jsx)(eto,{className:"size-4"}),defaultSize:{w:12,h:8},dataSource:"机器遥测"},{id:"firewall",title:"防火墙",description:"防火墙策略、IP 地址、续期和申请视图。",icon:(0,eb.jsx)(Qs,{className:"size-4"}),defaultSize:{w:12,h:8},dataSource:"防火墙策略"},{id:"file-manager-window",title:"文件管理窗口",description:"可拖拽、缩放和多窗口并存的文件管理组件。",icon:(0,eb.jsx)(etG,{className:"size-4"}),defaultSize:{w:6,h:5},dataSource:"工作区文件"}]}];function etQ(e){return{id:e.id,title:e.title,description:e.description,icon:e.icon,defaultSize:e.defaultSize,dataSource:e.defaultConfig.dataSource}}function et0(e){return{id:e.id,title:e.title,description:e.description,icon:e.icon,defaultSize:e.defaultSize,dataSource:e.defaultConfig.dataSource}}function et1(){let e=ee4(),[t,n]=ew.useState(),r=ew.useCallback(()=>{},[]),i=ew.useCallback(()=>{},[]),a=ew.useMemo(()=>B2({onSelect:r}),[r]),o=ew.useMemo(()=>B4({onSelect:i}),[i]),l=ew.useMemo(()=>[{id:"dashboard",title:"运维总览",cards:e.map(et0)},{id:"runs",title:"运行",cards:ety.map(etQ)},{id:"telemetry",title:"遥测",cards:etj.map(etQ)},{id:"all-canvases",title:"浏览所有画布",cards:a.map(etQ)},{id:"all-conversations",title:"浏览所有对话",cards:o.map(etQ)},{id:"machine-group",title:"机器组",cards:etN.map(etQ)},{id:"audit-logs",title:"日志与审计",cards:etE.map(etQ)},...etJ],[o,a,e]);return(0,eb.jsx)(f5,{children:(0,eb.jsx)("div",{className:"vtl-card-management-page",children:(0,eb.jsx)(ett,{layouts:etX,children:(0,eb.jsx)(etn,{layout:ete(etZ,"cards"),children:(0,eb.jsx)(etY,{className:"h-full",divided:!1,children:t?(0,eb.jsx)(et5,{groupTitle:t.groupTitle,card:t.card,onBack:()=>n(void 0)}):(0,eb.jsx)(et2,{groups:l,onSelect:(e,t)=>n({groupTitle:e,card:t})})})})})})})}function et2({groups:e,onSelect:t}){return(0,eb.jsxs)("div",{className:"vtl-card-management-list flex h-full min-h-0 flex-col",children:[(0,eb.jsxs)("div",{className:"flex shrink-0 items-center justify-between gap-4 px-5 py-4",children:[(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("h2",{className:"text-base font-semibold",children:"卡片管理"}),(0,eb.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"当前可用卡片按页面分组。"})]}),(0,eb.jsxs)("div",{className:"flex shrink-0 items-center gap-2 text-sm text-muted-foreground",children:[(0,eb.jsx)(etl,{className:"size-4"}),(0,eb.jsx)("span",{children:e.reduce((e,t)=>e+t.cards.length,0)})]})]}),(0,eb.jsx)(f1,{className:"min-h-0 flex-1",children:(0,eb.jsx)("div",{className:"space-y-6 px-5 pb-5",children:e.map(e=>(0,eb.jsxs)("section",{className:"space-y-2",children:[(0,eb.jsxs)("div",{className:"flex items-center gap-2",children:[(0,eb.jsx)("h3",{className:"text-sm font-medium",children:e.title}),(0,eb.jsx)("span",{className:"text-xs text-muted-foreground",children:e.cards.length})]}),(0,eb.jsx)("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-2 xl:grid-cols-3",children:e.cards.map(n=>(0,eb.jsxs)("button",{type:"button",className:tK("group/card flex min-h-20 items-start gap-3 rounded-[var(--surface-card-radius)] border bg-card px-3 py-3 text-left transition-colors","vtl-managed-card-item","hover:border-foreground/35 hover:bg-muted/35 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/25"),onClick:()=>t(e.title,n),children:[(0,eb.jsx)("span",{className:"mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-[var(--surface-control-radius)] bg-muted text-muted-foreground transition-colors group-hover/card:text-foreground",children:n.icon}),(0,eb.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,eb.jsxs)("span",{className:"flex items-start justify-between gap-3",children:[(0,eb.jsx)("span",{className:"truncate text-sm font-medium",children:n.title}),(0,eb.jsxs)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:[n.defaultSize.w,"x",n.defaultSize.h]})]}),(0,eb.jsx)("span",{className:"mt-1 line-clamp-2 block text-xs leading-5 text-muted-foreground",children:n.description})]})]},`${e.id}-${n.id}`))})]},e.id))})})]})}function et5({groupTitle:e,card:t,onBack:n}){return(0,eb.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,eb.jsxs)("div",{className:"flex shrink-0 items-center gap-3 px-5 py-4",children:[(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"返回卡片管理",onClick:n,children:(0,eb.jsx)(KS,{className:"size-4"})}),(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("div",{className:"text-xs text-muted-foreground",children:e}),(0,eb.jsx)("h2",{className:"truncate text-base font-semibold",children:t.title})]})]}),(0,eb.jsx)("div",{className:"grid min-h-0 flex-1 place-items-center px-5 pb-5",children:(0,eb.jsx)("div",{className:"w-full max-w-md rounded-[var(--surface-card-radius)] border bg-card p-5",children:(0,eb.jsxs)("div",{className:"flex items-start gap-3",children:[(0,eb.jsx)("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-[var(--surface-control-radius)] bg-muted text-muted-foreground",children:t.icon}),(0,eb.jsxs)("div",{className:"min-w-0 space-y-3",children:[(0,eb.jsxs)("div",{children:[(0,eb.jsx)("div",{className:"text-sm font-medium",children:"编辑页面预留"}),(0,eb.jsx)("div",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:"后续会在这里接入卡片配置、数据源、默认尺寸和可编辑字段。"})]}),(0,eb.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-xs text-muted-foreground",children:[(0,eb.jsxs)("div",{children:[(0,eb.jsx)("div",{children:"默认尺寸"}),(0,eb.jsxs)("div",{className:"mt-1 font-medium text-foreground",children:[t.defaultSize.w,"x",t.defaultSize.h]})]}),(0,eb.jsxs)("div",{children:[(0,eb.jsx)("div",{children:"数据源"}),(0,eb.jsx)("div",{className:"mt-1 truncate font-medium text-foreground",children:t.dataSource})]})]})]})]})})})]})}let et4=eq("group/item flex w-full flex-wrap items-center rounded-lg border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted",{variants:{variant:{default:"border-transparent",outline:"border-border",muted:"border-transparent bg-muted/50"},size:{default:"gap-2.5 px-3 py-2.5",sm:"gap-2.5 px-3 py-2.5",xs:"gap-2 px-2.5 py-2"}},defaultVariants:{variant:"default",size:"default"}});function et3({className:e,variant:t="default",size:n="default",asChild:r=!1,...i}){return(0,eb.jsx)(r?eF:"div",{"data-slot":"item","data-variant":t,"data-size":n,className:tK(et4({variant:t,size:n,className:e})),...i})}let et6=eq("flex shrink-0 items-center justify-center gap-2 [&_svg]:pointer-events-none",{variants:{variant:{default:"bg-transparent",icon:"[&_svg:not([class*='size-'])]:size-4",marker:"size-8 rounded-md border bg-background ui-text-kbd font-medium text-muted-foreground [&_svg:not([class*='size-'])]:size-4",image:"size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover"},align:{auto:"group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start",start:"translate-y-0.5 self-start",center:"self-center"}},defaultVariants:{variant:"default",align:"auto"}});function et8({className:e,variant:t="default",align:n="auto",...r}){return(0,eb.jsx)("div",{"data-slot":"item-media","data-variant":t,"data-align":n,className:tK(et6({variant:t,align:n,className:e})),...r})}function et7({className:e,align:t,...n}){return(0,eb.jsx)("div",{"data-slot":"item-content","data-align":t,className:tK("flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none","start"===t&&"self-start","center"===t&&"self-center",e),...n})}function et9({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"item-title",className:tK("line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4",e),...t})}function ene({className:e,...t}){return(0,eb.jsx)("p",{"data-slot":"item-description",className:tK("line-clamp-2 text-left text-sm leading-normal font-normal text-muted-foreground group-data-[size=xs]/item:text-xs [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function ent({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"item-actions",className:tK("flex items-center gap-2",e),...t})}let enn={back:"Back",search:"Search settings...",welcomeTitle:"Settings",welcomeDescription:"Search or choose a setting to continue.",recommendations:"Recommended",noResults:"No settings found."};function enr(e){return"string"==typeof e||"number"==typeof e?String(e):""}function eni({sections:e,recommendations:t,sectionId:n,defaultSectionId:r,childId:i,defaultChildId:a,onSelectionChange:o,labels:l,welcomeContent:s,className:c,sidebarClassName:d,contentClassName:u}){let f={...enn,...l},[h,p]=ew.useState(r),[m,g]=ew.useState(a),v=n??h,x=i??m,y=e.find(e=>e.id===v),b=y?.children?.find(e=>e.id===x),w=!!y,j=ew.useMemo(()=>e.flatMap(e=>[{value:e.id,label:e.title,description:e.description,icon:e.icon,searchValue:[enr(e.title),enr(e.description),...e.keywords??[]].join(" "),keywords:e.keywords},...(e.children??[]).map(t=>({value:`${e.id}/${t.id}`,label:t.title,description:e.title,icon:t.icon??e.icon,disabled:t.disabled,searchValue:[enr(t.title),enr(t.description),enr(e.title),...t.keywords??[]].join(" "),keywords:[enr(e.title),...t.keywords??[]]}))]),[e]),k=t??e.flatMap(e=>(e.children??[]).slice(0,2).map(t=>({id:`${e.id}-${t.id}`,title:t.title,description:e.title,icon:t.icon,sectionId:e.id,childId:t.id})));function S(e,t){void 0===n&&p(e),void 0===i&&g(t),o?.({sectionId:e,childId:t})}let C=b?.content??y?.content??s??(0,eb.jsxs)("div",{className:"mx-auto flex min-h-[22rem] w-full max-w-2xl flex-col justify-center gap-5 py-12",children:[(0,eb.jsxs)("div",{className:"space-y-2",children:[(0,eb.jsx)("h3",{className:"text-xl font-semibold tracking-normal",children:f.welcomeTitle}),(0,eb.jsx)("p",{className:"max-w-xl text-sm text-muted-foreground",children:f.welcomeDescription})]}),(0,eb.jsx)(eno,{labels:f,options:j,onSelect:(e,t)=>S(e,t)}),k.length>0&&(0,eb.jsxs)("section",{className:"space-y-2",children:[(0,eb.jsx)("div",{className:"ui-text-kbd font-medium text-muted-foreground",children:f.recommendations}),(0,eb.jsx)("div",{className:"grid gap-2 sm:grid-cols-2",children:k.map(e=>(0,eb.jsx)(et3,{asChild:!0,variant:"outline",size:"xs",className:"min-h-14 flex-nowrap bg-card text-left hover:bg-muted/60",children:(0,eb.jsxs)("button",{type:"button",onClick:()=>S(e.sectionId,e.childId),children:[e.icon&&(0,eb.jsx)(et8,{variant:"marker",align:"center",children:e.icon}),(0,eb.jsxs)(et7,{className:"min-w-0 gap-0.5",children:[(0,eb.jsx)(et9,{className:"max-w-full truncate",children:e.title}),e.description&&(0,eb.jsx)(ene,{className:"line-clamp-1",children:e.description})]}),(0,eb.jsx)(ent,{className:"ml-auto",children:(0,eb.jsx)(vo,{className:"size-4 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/item:opacity-100"})})]})},e.id))})]})]});return(0,eb.jsxs)("div",{"data-slot":"settings-menu-panel",className:tK("vtl-surface-panel grid min-h-[34rem] overflow-hidden rounded-[var(--surface-panel-radius)] border md:grid-cols-[15rem_minmax(0,1fr)]",c),children:[(0,eb.jsx)("aside",{"data-slot":"settings-menu-sidebar",className:tK("min-h-0 border-b bg-muted/20 md:border-r md:border-b-0",d),children:(0,eb.jsx)(f1,{className:"h-full",children:(0,eb.jsx)("div",{className:"space-y-1 p-2",children:w?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsxs)(tY,{type:"button",variant:"ghost",className:"mb-1 h-auto min-h-9 w-full justify-start px-2.5 py-1.5 text-left",onClick:()=>S(void 0,void 0),children:[(0,eb.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center [&_svg]:size-4",children:(0,eb.jsx)(KS,{})}),(0,eb.jsx)("span",{className:"min-w-0 truncate",children:f.back})]}),(y?.children??[]).map(e=>(0,eb.jsx)(ena,{title:e.title,icon:e.icon,badge:e.badge,active:e.id===x,disabled:e.disabled,onClick:()=>S(y?.id,e.id)},e.id))]}):e.map(e=>(0,eb.jsx)(ena,{title:e.title,icon:e.icon,badge:e.badge,disabled:e.disabled,onClick:()=>S(e.id,void 0)},e.id))})})}),(0,eb.jsxs)("main",{"data-slot":"settings-menu-content",className:tK("min-w-0 bg-[var(--surface-panel)] p-4 md:p-5",u),children:[y?(0,eb.jsx)("div",{className:"mb-4 flex min-h-8 items-center justify-between gap-4",children:(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("h2",{className:"truncate text-lg font-semibold tracking-normal",children:b?.title??y.title}),(b?.description??y.description)&&(0,eb.jsx)("p",{className:"truncate text-sm text-muted-foreground",children:b?.description??y.description})]})}):null,C]})]})}function ena({title:e,icon:t,badge:n,active:r,disabled:i,onClick:a}){return(0,eb.jsxs)(tY,{type:"button",variant:"ghost",disabled:i,onClick:a,className:tK("h-auto min-h-9 w-full justify-start px-2.5 py-1.5 text-left font-medium",r?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/70 hover:text-foreground"),children:[t&&(0,eb.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center [&_svg]:size-4",children:t}),(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate font-medium",children:e}),n&&(0,eb.jsx)(cI,{variant:"outline",className:"h-5 shrink-0 px-1.5 ui-text-kbd",children:n}),(0,eb.jsx)(vo,{className:"size-3.5 shrink-0 text-muted-foreground/60"})]})}function eno({labels:e,options:t,onSelect:n}){return(0,eb.jsx)(gU,{options:t,placeholder:e.search,emptyText:e.noResults,className:"w-full",contentClassName:"rounded-lg",onValueChange:e=>{let[t,r]=e.split("/");t&&n(t,r)},renderOption:e=>(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center text-muted-foreground [&_svg]:size-4",children:e.icon??(0,eb.jsx)(cz,{})}),(0,eb.jsxs)("span",{className:"grid min-w-0 flex-1 gap-0.5",children:[(0,eb.jsx)("span",{className:"truncate",children:e.label}),e.description&&(0,eb.jsx)("span",{className:"truncate text-sm text-muted-foreground",children:e.description})]})]})})}let enl=eq("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 ens({className:e,variant:t,...n}){return(0,eb.jsx)("div",{role:"alert","data-slot":"alert",className:tK(enl({variant:t}),e),...n})}function enc({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"alert-title",className:tK("mb-1 leading-none font-medium",e),...t})}function end({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"alert-description",className:tK("text-muted-foreground [&_p]:leading-relaxed",e),...t})}let enu=[{value:"openai-v1",label:"OpenAI v1"},{value:"anthropic",label:"Anthropic"},{value:"openai-responses",label:"OpenAI Responses"}];function enf(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}}function enh(){let[e,t]=ew.useState([]),[n,r]=ew.useState(!0),[i,a]=ew.useState(""),o=ew.useCallback(async()=>{a("");try{let e=await g0();t(e.routes.map(enf))}catch(e){a(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 g2({id:n.id,providerName:n.providerName,protocol:n.protocol,endpointUrl:n.endpointUrl,apiKey:n.apiKey,models:n.models,selectedModelIds:n.selectedModelIds});l(t,()=>enf(e))}catch(e){l(t,t=>({...t,saving:!1,error:e instanceof Error?e.message:"保存失败"}))}}}return ew.useEffect(()=>{o()},[o]),(0,eb.jsxs)("div",{className:"grid gap-4",children:[(0,eb.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,eb.jsx)("div",{className:"min-w-0",children:(0,eb.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:"模型路由"})}),(0,eb.jsxs)(tY,{type:"button",size:"sm",onClick:function(){t(e=>[{providerName:"",protocol:"openai-v1",endpointUrl:"",apiKey:"",models:[],selectedModelIds:[],loadingModels:!1,saving:!1,error:""},...e])},children:[(0,eb.jsx)(s7,{className:"size-4"}),"添加模型路由"]})]}),i?(0,eb.jsxs)(ens,{variant:"destructive",children:[(0,eb.jsx)(eeo,{}),(0,eb.jsx)(enc,{children:"读取失败"}),(0,eb.jsx)(end,{children:i})]}):null,n?(0,eb.jsx)("div",{className:"rounded-lg border border-dashed px-3 py-6 text-sm text-muted-foreground",children:"正在读取模型路由"}):0===e.length?(0,eb.jsx)("div",{className:"rounded-lg border border-dashed px-3 py-6 text-sm text-muted-foreground",children:"还没有模型路由。"}):(0,eb.jsx)("div",{className:"grid gap-3",children:e.map((e,t)=>(0,eb.jsx)(enp,{draft:e,onDraftChange:e=>l(t,()=>e),onSave:()=>{s(t)}},e.id??`draft-${t}`))})]})}function enp({draft:e,onDraftChange:t,onSave:n}){let r=ew.useRef(e),i=ew.useRef(t),a=[e.providerName,e.protocol,e.endpointUrl,e.apiKey||(e.savedKeyAvailable?"saved":"")].join("\n"),o=e.providerName.trim()&&e.endpointUrl.trim()&&e.apiKey.trim(),l=e.providerName.trim()&&e.endpointUrl.trim()&&(e.apiKey.trim()||e.savedKeyAvailable)&&e.selectedModelIds.length>0&&!e.saving;function s(n){t({...e,...n})}return ew.useEffect(()=>{r.current=e,i.current=t},[e,t]),ew.useEffect(()=>{if(!o)return;let e=window.setTimeout(async()=>{let e=r.current;i.current({...e,loadingModels:!0,error:""});try{let t=await g1({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)},[o,a]),(0,eb.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-3",children:[(0,eb.jsxs)("div",{className:"grid gap-2 md:grid-cols-[minmax(0,1fr)_11rem]",children:[(0,eb.jsx)(ny,{value:e.providerName,placeholder:"提供商名称",onChange:e=>s({providerName:e.currentTarget.value})}),(0,eb.jsxs)(Jo,{value:e.protocol,onValueChange:e=>s({protocol:e}),children:[(0,eb.jsx)(JK,{className:"w-full",children:(0,eb.jsx)(Jd,{})}),(0,eb.jsx)(JX,{children:enu.map(e=>(0,eb.jsx)(JZ,{value:e.value,children:e.label},e.value))})]})]}),(0,eb.jsxs)("div",{className:"grid gap-2 md:grid-cols-[minmax(0,1fr)_minmax(0,18rem)]",children:[(0,eb.jsx)(ny,{value:e.endpointUrl,placeholder:"API 端点 URL,例如 https://api.openai.com/v1",onChange:e=>s({endpointUrl:e.currentTarget.value})}),(0,eb.jsx)(ny,{value:e.apiKey,type:"password",placeholder:e.savedKeyAvailable?"已保存,留空沿用":"API Key",onChange:e=>s({apiKey:e.currentTarget.value})})]}),(0,eb.jsx)(VY,{}),(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsxs)("div",{className:"flex min-h-6 items-center justify-between gap-2",children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2 text-sm font-medium",children:[(0,eb.jsx)(mE,{className:"size-4 text-muted-foreground"}),"可用模型"]}),e.loadingModels?(0,eb.jsx)("span",{className:"text-xs text-muted-foreground",children:"拉取中"}):null]}),e.models.length>0?(0,eb.jsx)("div",{className:"grid max-h-48 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,eb.jsxs)("label",{className:tK("grid min-h-8 cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-center gap-2 rounded-md px-2 text-sm hover:bg-muted/60",n&&"bg-muted/70"),children:[(0,eb.jsx)(nx,{checked:n,onCheckedChange:n=>{var r;return r=t.id,void s({selectedModelIds:!0===n?[...e.selectedModelIds,r]:e.selectedModelIds.filter(e=>e!==r)})}}),(0,eb.jsx)("span",{className:"truncate",children:t.displayName||t.id})]},t.id)})}):(0,eb.jsx)("div",{className:"rounded-md border border-dashed px-3 py-4 text-sm text-muted-foreground",children:"填写端点和密钥后会自动拉取模型。"})]}),e.error?(0,eb.jsxs)(ens,{variant:"destructive",children:[(0,eb.jsx)(eeo,{}),(0,eb.jsx)(enc,{children:"模型路由错误"}),(0,eb.jsx)(end,{className:"break-words",children:e.error})]}):null,(0,eb.jsx)("div",{className:"flex justify-end",children:(0,eb.jsx)(tY,{type:"button",onClick:n,disabled:!l,children:e.saving?"保存中":"保存"})})]})}let enm=[{id:"settings",x:0,y:0,w:12,h:8}],eng=f4(enm);function env(){return(0,eb.jsx)(f5,{children:(0,eb.jsx)(ett,{layouts:enm,children:(0,eb.jsx)(etn,{layout:ete(eng,"settings"),children:(0,eb.jsx)(eni,{className:"h-full min-h-0",contentClassName:"min-h-0 overflow-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",sections:[{id:"preferences",title:"偏好设置",icon:(0,eb.jsx)(mE,{}),children:[{id:"model-routes",title:"模型路由",icon:(0,eb.jsx)(mE,{}),content:(0,eb.jsx)(enh,{})}]}],defaultSectionId:"preferences",defaultChildId:"model-routes",labels:{back:"返回",search:"搜索设置",welcomeTitle:"偏好设置",welcomeDescription:"",recommendations:"常用",noResults:"没有设置项"}})})})})}let enx=eN("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"}]]),eny=eN("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"}]]);var enb=e.i(91e3);let enw=["light","dark","jelly"],enj={light:{label:"Light",icon:eny,className:"text-sidebar-foreground/60"},dark:{label:"Dark",icon:enx,className:"text-sidebar-foreground/60"},jelly:{label:"Jelly",icon:function(e){return(0,eb.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[(0,eb.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,eb.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,eb.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,eb.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,eb.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 enk(){let{resolvedTheme:e,setTheme:t}=(0,W2.useTheme)(),[n,r]=ew.useState(enb.defaultAppearanceTheme);ew.useEffect(()=>{let e=window.localStorage.getItem(enb.appearanceThemeStorageKey)??enb.defaultAppearanceTheme;r(e),(0,enb.applyAppearanceTheme)({theme:e})},[]);let i=n===enb.jellyAppearanceTheme?"jelly":"dark"===e?"dark":"light",a=enw.indexOf(i),o=enw[(a+1)%enw.length]??"light",{icon:l,label:s,className:c}=enj[i];function d(e){r(e),window.localStorage.setItem(enb.appearanceThemeStorageKey,e),(0,enb.applyAppearanceTheme)({theme:e})}return(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm",className:tK("size-10 hover:bg-muted hover:text-sidebar-foreground",c),"aria-label":`${ez.theme}: ${s}`,title:`${ez.theme}: ${s}`,onClick:function(){if("jelly"===o){t("dark"),d(enb.jellyAppearanceTheme);return}d(enb.defaultAppearanceTheme),t(o)},children:(0,eb.jsx)(l,{})})}function enS({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){return(0,eb.jsx)(mk,{boardId:"runtime-operations",definitions:ety,initialLayouts:etb,clipboardItems:e,actionLabel:"运行页面卡片操作",paletteGroupTitle:"运行页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}function enC({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){let r=etz("/api/local/machines/telemetry",etA),i=ew.useMemo(()=>etw(r),[r]);return(0,eb.jsx)(mk,{boardId:"telemetry",definitions:i,initialLayouts:etk,clipboardItems:e,actionLabel:"遥测页面卡片操作",paletteGroupTitle:"遥测页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}function enN(){let[e,t]=ew.useState("dashboard"),[n,r]=ew.useState(!1),[i,a]=ew.useState(!1),[o,l]=ew.useState(!1),[s,c]=ew.useState(),[d,u]=ew.useState(!1),[f,h]=ew.useState([]),[p,m]=ew.useState([]),[g,v]=ew.useState({}),[x,y]=ew.useState(),[b,w]=ew.useState(HC),[j,k]=ew.useState([]),[S,C]=ew.useState(),N=ew.useCallback(e=>{w(t=>o9(e,t))},[]),M=ew.useCallback(e=>{k(t=>o9(e,t))},[]),E=ew.useCallback(async e=>{c(await He(e)),t("new-agent-conversation")},[]),O=ew.useCallback(async()=>{let e=await B7();e?(c(await He(e.conversation.id)),t("new-agent-conversation")):l(!0)},[]);return(0,eb.jsxs)("main",{className:"vtl-app-background relative h-svh overflow-hidden text-foreground",children:[(0,eb.jsx)("div",{className:"pointer-events-none fixed inset-y-0 left-0 z-40 p-3",children:(0,eb.jsx)(uX,{navItems:etU,contents:etK,defaultActiveNavId:"dashboard",defaultSelectedItemId:"overview",defaultExpandedItemIds:["runs"],logo:(0,eb.jsx)(nw,{}),account:(0,eb.jsx)(nj,{}),labels:{collapse:"收起菜单",expand:"展开菜单",search:e_.search,account:"账户",hideSidebar:"收起侧边栏",showSidebar:"展开侧边栏"},className:"h-[calc(100svh-1.5rem)] drop-shadow-lg",footer:(0,eb.jsx)(enk,{}),onItemSelect:({item:e})=>{"new-canvas"===e.id?t("new-canvas"):"all-canvases"===e.id?t("all-canvases"):"new-agent-conversation"===e.id?l(!0):"open-recent-conversation"===e.id?O():"all-conversations"===e.id?t("all-conversations"):"overview"===e.id?t("dashboard"):"runs"===e.id?t("runs"):"telemetry"===e.id?t("telemetry"):("machine-group"===e.id||"process-management"===e.id||"machine-performance"===e.id||"machine-firewall"===e.id||"audit-logs"===e.id||"machine-files"===e.id||"preferences"===e.id||"card-management"===e.id)&&t(e.id)}})}),(0,eb.jsxs)("section",{className:tK("h-full min-w-0","dashboard"===e?"overflow-auto pl-[8.5rem]":"overflow-hidden"),children:["runs"===e?(0,eb.jsx)(enS,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"telemetry"===e?(0,eb.jsx)(enC,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"machine-group"===e?(0,eb.jsx)(etI,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"process-management"===e?(0,eb.jsx)(etR,{}):"machine-performance"===e?(0,eb.jsx)(etF,{}):"machine-firewall"===e?(0,eb.jsx)(eta,{}):"audit-logs"===e?(0,eb.jsx)(etV,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"machine-files"===e?(0,eb.jsx)(QE,{clipboardItems:f,onClipboardItemsChange:h}):"preferences"===e?(0,eb.jsx)(env,{}):"card-management"===e?(0,eb.jsx)(et1,{}):"new-canvas"===e?(0,eb.jsx)(eeX,{nodes:b,edges:j,selectedNodeId:S,clipboardItems:f,onNodesChange:N,onEdgesChange:M,onNodesSet:w,onEdgesSet:k,onSelectedNodeChange:C,onClipboardItemsChange:h}):"all-canvases"===e?(0,eb.jsx)(eeH,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"new-agent-conversation"===e?(0,eb.jsx)(eeL,{conversation:s,clipboardItems:f,clipboardDraggingId:x,onClipboardItemsChange:h,onClipboardDraggingChange:y,onOverlayOpenChange:a}):"all-conversations"===e?(0,eb.jsx)(Hc,{clipboardItems:f,onClipboardItemsChange:h,onOpenConversation:e=>{E(e)},onOverlayOpenChange:u}):(0,eb.jsx)(ee3,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:r}),(0,eb.jsx)(ee7,{hidden:"dashboard"===e?n||o:"new-agent-conversation"===e?i||o:d,items:f,trashItems:p,draggingId:x,onDraggingChange:y,onItemsChange:h,onTrashItemsChange:m,onTrashClipboardItemsChange:v,trashClipboardItems:g})]}),(0,eb.jsx)(Hh,{open:o,onOpenChange:l,onCreated:e=>{c(e),t("new-agent-conversation")}})]})}let enM=ey.default.env.NEXT_PUBLIC_VANTALOOM_AUTH_MODE??"disabled-local";function enE(){let[e,t]=ew.useState("disabled-local"===enM);return e?(0,eb.jsx)(enN,{}):(0,eb.jsx)(nb,{onComplete:()=>t(!0)})}e.s(["default",()=>enE],66204)}]);
|
|
45
|
+
</style>`,/<\/head>/i.test(t)?t.replace(/<\/head>/i,`${n}</head>`):`${n}${t}`},[r,t]);return(0,eb.jsx)("iframe",{title:e,sandbox:"",srcDoc:i,className:tK("size-full border-0 bg-background",n)})}function ZU({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),i=[];for(let e=0;e<r;e+=16){let t=Array.from({length:Math.min(16,r-e)},(t,r)=>n[e+r]??0);i.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 i},[e.bytes,t]);return 0===r.length?(0,eb.jsx)("div",{className:"grid size-full place-items-center p-6 text-center text-muted-foreground ui-text-body",children:n.noContent}):(0,eb.jsx)("div",{className:"size-full overflow-auto bg-background p-3 ui-text-code",children:(0,eb.jsx)("div",{className:"grid min-w-max grid-cols-[5.5rem_30rem_1fr] gap-x-4",children:r.map(e=>(0,eb.jsxs)(ew.Fragment,{children:[(0,eb.jsx)("span",{className:"text-muted-foreground",children:e.offset}),(0,eb.jsx)("span",{className:"font-mono text-foreground",children:e.hex}),(0,eb.jsx)("span",{className:"font-mono text-muted-foreground",children:e.ascii})]},e.offset))})})}function ZK({file:e,labels:t,onApprove:n}){return(0,eb.jsx)("div",{className:"grid size-full place-items-center bg-muted/20 p-6",children:(0,eb.jsxs)("div",{className:"grid max-w-md justify-items-center gap-3 text-center",children:[(0,eb.jsx)("div",{className:"grid size-10 place-items-center rounded-full border bg-background text-muted-foreground",children:(0,eb.jsx)(ZP,{className:"size-4"})}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)("h3",{className:"font-medium text-foreground ui-text-body",children:t.binaryTitle}),(0,eb.jsx)("p",{className:"text-muted-foreground ui-text-body",children:t.binaryDescription})]}),(0,eb.jsxs)("div",{className:"flex items-center gap-2",children:[Z$(e.size)&&(0,eb.jsx)(cI,{variant:"outline",children:Z$(e.size)}),(0,eb.jsx)(tY,{type:"button",size:"sm",variant:"outline",onClick:n,children:t.renderAnyway})]})]})})}function ZG({labels:e}){return(0,eb.jsx)("div",{className:"grid size-full place-items-center p-6 text-center text-muted-foreground ui-text-body",children:e.unsupportedPreview})}function ZY({file:e,value:t,labels:n,renderPreview:r,className:i}){let a=ZR(e),o=e.src?e.src:t&&"svg"===ZR(e)?`data:image/svg+xml;charset=utf-8,${encodeURIComponent(t)}`:void 0,l=r?.(e,t);return void 0!==l?(0,eb.jsx)("div",{"data-slot":"file-tab-custom-preview",className:tK("size-full",i),children:l}):"html"===a||"richtext"===a?(0,eb.jsx)(Zq,{title:e.name,value:t,className:i}):"markdown"===a?(0,eb.jsx)("div",{"data-slot":"file-tab-markdown-preview",className:tK("size-full overflow-auto bg-background",i),children:(0,eb.jsx)(ZW,{value:t})}):"svg"===a&&o?(0,eb.jsx)("div",{"data-slot":"file-tab-svg-preview",className:tK("grid size-full place-items-center overflow-auto bg-muted/20 p-6",i),children:(0,eb.jsx)("img",{src:o,alt:e.name,className:"max-h-full max-w-full rounded-lg border bg-background p-4"})}):"image"===a&&o?(0,eb.jsx)("div",{"data-slot":"file-tab-image-preview",className:tK("grid size-full place-items-center overflow-auto bg-muted/20 p-6",i),children:(0,eb.jsx)("img",{src:o,alt:e.name,className:"max-h-full max-w-full rounded-md"})}):"video"===a&&o?(0,eb.jsx)("div",{"data-slot":"file-tab-video-preview",className:tK("grid size-full place-items-center bg-muted/20 p-6",i),children:(0,eb.jsx)("video",{src:o,controls:!0,preload:"none",className:"max-h-full max-w-full rounded-md border bg-background"})}):(0,eb.jsx)(ZG,{labels:n})}function ZX({open:e,labels:t,currentView:n,currentMode:r,saving:i,modified:a,canSwitchView:o,canSwitchMode:l,canSave:s,onOpenChange:c,onToggleView:d,onToggleMode:u,onSave:f}){let h=[o?{key:"view",label:"code"===n?t.preview:t.code,onClick:d,icon:"code"===n?(0,eb.jsx)(KT,{className:"size-4"}):(0,eb.jsx)(vs,{className:"size-4"})}:void 0,l?{key:"mode",label:"review"===r?t.edit:t.review,onClick:u,icon:"review"===r?(0,eb.jsx)(ZA,{className:"size-4"}):(0,eb.jsx)(eE,{className:"size-4"})}:void 0,s?{key:"save",label:i?t.saving:t.save,onClick:f,disabled:i||!a,icon:(0,eb.jsx)(ZI,{className:"size-4"})}:void 0].filter(e=>void 0!==e);return 0===h.length?null:(0,eb.jsx)("div",{"data-slot":"file-tab-floating-actions",className:"absolute right-3 bottom-3 z-20",children:(0,eb.jsxs)("div",{className:"relative size-8",children:[h.map((t,n)=>(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.label,disabled:t.disabled,onClick:()=>{t.disabled||t.onClick()},className:tK("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,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.actions,"aria-expanded":e,onClick:()=>c(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,eb.jsx)(s6,{className:tK("size-4 transition-transform",e&&"rotate-90")})})]})})}function ZZ({file:e,value:t,defaultValue:n,onValueChange:r,mode:i,defaultMode:a="review",onModeChange:o,view:l,defaultView:s="code",onViewChange:c,modified:d=!1,onSave:u,onSaveError:f,largeBinaryThreshold:h=2097152,showHeader:p=!0,wrapLines:m=!1,renderPreview:g,labels:v,className:x,editorClassName:y,previewClassName:b,headerClassName:w,...j}){var k;let S,C,N=ew.useMemo(()=>({...ZD,...v}),[v]),[M,E]=ew.useState(n??e.content??""),[O,P]=ew.useState(a),[A,z]=ew.useState(s),[_,I]=ew.useState(!1),[D,T]=ew.useState(!1),[R,L]=ew.useState(!1),$=ew.useRef(null),F=t??M,V=i??O,B=(k=l??A,(S=ZF(e)).includes(k)?k:S[0]),H=ZR(e),W=ZF(e).length>1,q=!e.readOnly&&["text","code","html","markdown","richtext","svg"].includes(ZR(e)),U=!!u&&q&&"code"===B&&(d||R),K="review"===V||!0===e.readOnly,G="binary"===(C=ZR(e))||"image"!==C&&"video"!==C&&!!(e.size&&e.size>h&&!e.content),Y=(e.path??e.name).split(/[\\/]+/).filter(Boolean),X=Z$(e.size??F.length);async function Z(){if(u&&!R){L(!0);try{await u(F),T(!1)}catch(e){f?.(e)}finally{L(!1)}}}return ew.useEffect(()=>{void 0===t&&E(n??e.content??""),I(!1),T(!1)},[n,e,t]),ew.useEffect(()=>{if(D)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof Node&&$.current?.contains(t)||T(!1)}},[D]),(0,eb.jsxs)("div",{ref:$,"data-slot":"file-tab-viewer","data-mode":V,"data-view":B,className:tK("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)]",x),...j,children:[p&&(0,eb.jsxs)("div",{"data-slot":"file-tab-viewer-header",className:tK("flex min-w-0 items-center gap-2 border-b bg-muted/35 px-3 py-2",w),children:[(0,eb.jsx)("span",{className:"grid size-5 shrink-0 place-items-center rounded-md border bg-background text-muted-foreground",children:"image"===H?(0,eb.jsx)(Zz,{className:"size-3.5"}):"video"===H?(0,eb.jsx)(Z_,{className:"size-3.5"}):"binary"===H?(0,eb.jsx)(ZP,{className:"size-3.5"}):(0,eb.jsx)(vh,{className:"size-3.5"})}),(0,eb.jsx)("div",{className:"flex min-w-0 flex-1 items-center gap-1.5 ui-text-kbd",children:Y.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[t>0&&(0,eb.jsx)("span",{className:"text-muted-foreground",children:N.pathSeparator}),(0,eb.jsx)("span",{className:tK("truncate",t===Y.length-1?"font-medium text-foreground":"text-muted-foreground"),children:e})]},`${e}-${t}`))}),(0,eb.jsxs)("div",{className:"hidden shrink-0 items-center gap-1.5 sm:flex",children:[X&&(0,eb.jsx)(cI,{variant:"outline",children:X}),q&&"code"===B&&(K?(0,eb.jsxs)(cI,{variant:"secondary",children:[(0,eb.jsx)(s5,{className:"size-3"}),N.review]}):(0,eb.jsxs)(cI,{variant:"outline",children:[(0,eb.jsx)(ZA,{className:"size-3"}),N.edit]}))]})]}),(0,eb.jsx)("div",{"data-slot":"file-tab-viewer-body",className:"min-h-0 overflow-hidden",children:G&&!_?(0,eb.jsx)(ZK,{file:e,labels:N,onApprove:()=>I(!0)}):"preview"===B?(0,eb.jsx)(ZY,{file:e,value:F,labels:N,renderPreview:g,className:b}):"hex"===B?(0,eb.jsx)(ZU,{file:e,value:F,labels:N}):(0,eb.jsx)(ZH,{file:e,value:F,readOnly:K,onValueChange:function(e){void 0===t&&E(e),r?.(e)},wrapLines:m,className:y})}),(0,eb.jsx)(ZX,{open:D,labels:N,currentView:B,currentMode:V,saving:R,modified:d,canSwitchView:W,canSwitchMode:q&&"code"===B,canSave:U,onOpenChange:T,onToggleView:function(){var e;e="code"===B?"preview":"code",void 0===l&&z(e),c?.(e)},onToggleMode:function(){var e;e="review"===V?"edit":"review",void 0===i&&P(e),o?.(e)},onSave:Z})]})}function ZJ(e,t){return e[Math.max(0,t-1)]?.id??e[0]?.id}function ZQ(e){return"string"==typeof e||"number"==typeof e?String(e):void 0}function Z0(e,t,n){let r=[...e],i=r[t],a=r[n];return i&&a&&(r[t]=a,r[n]=i),r}function Z1({tabs:e,defaultTabs:t=[],activeTabId:n,defaultActiveTabId:r,onActiveTabChange:i,onTabsChange:a,onCreateTab:o,onCloseTab:l,onTabReorder:s,onTabDetach:c,onExternalTabDrop:d,createActions:u=[],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),[z,_]=ew.useState(),[I,D]=ew.useState(void 0),T=ew.useRef(void 0),[R,L]=ew.useState(void 0),[$,F]=ew.useState(!1),V=ew.useRef(void 0),B=ew.useRef(void 0),H=ew.useRef(!1),[W,q]=ew.useState(!1),[U,K]=ew.useState(!1),[G,Y]=ew.useState(),X=e??E,Z=X.find(e=>!e.disabled),[J,Q]=ew.useState(r??Z?.id),ee=n??J,et=X.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),a?.(t)},[a,e]),er=ew.useCallback(e=>{T.current=e,D(e)},[]),ei=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},[]),ea=ew.useCallback((e,t=!0)=>{t&&(B.current=ei()),V.current=e,L(e)},[ei]),eo=ew.useCallback(()=>{let e=A.current;if(!e){q(!1),K(!1);return}let t=e.scrollWidth-e.clientWidth;q(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)}},[X.length,eo]),ew.useLayoutEffect(()=>{let e=B.current,t=A.current;if(e&&t)for(let n of(B.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 i=n.getBoundingClientRect(),a=r.left-i.left,o=r.top-i.top;1>Math.abs(a)&&1>Math.abs(o)||n.animate([{transform:`translate(${a}px, ${o}px)`},{transform:"translate(0, 0)"}],{duration:150,easing:"cubic-bezier(0.2, 0, 0, 1)"})}},[R]);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=V.current??X,r=n.findIndex(t=>t.id===e.tabId);if(-1===r)return;let i=t-e.offsetX,a=i+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&&a>=t.left+.7*t.width&&ea(Z0(n,r,r+1));return}if(!o&&s&&!s.disabled){let e=es(s.id),t=e?.getBoundingClientRect();t&&i<=t.right-.7*t.width&&ea(Z0(n,r,r-1))}},[es,X,ea]);function ed(e){if(!d||0===m.length)return!1;let t=Array.from(e.dataTransfer.types);return m.some(e=>t.includes(e))}function eu(e){let t=A.current;if(!t)return{index:X.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[i,a]of r.entries()){let r=a.getBoundingClientRect();if(e.clientX<r.left+r.width/2)return{index:i,left:r.left-n.left+t.scrollLeft}}let i=r[r.length-1].getBoundingClientRect();return{index:r.length,left:i.right-n.left+t.scrollLeft}}ew.useEffect(()=>{if(I)return window.addEventListener("pointermove",e),window.addEventListener("pointerup",t,{once:!0}),()=>{window.removeEventListener("pointermove",e),window.removeEventListener("pointerup",t)};function e(e){let t=T.current;if(!t)return;let n=e.clientX-t.startX,r=e.clientY-t.startY,i=t.dragging||Math.abs(n)>4||Math.abs(r)>4;i&&(e.preventDefault(),ec(t,e.clientX)),er({...t,currentX:e.clientX,currentY:e.clientY,dragging:i})}function t(e){let t=T.current;if(t?.dragging){e.preventDefault(),H.current=!0;let r=X.find(e=>e.id===t.tabId),a=P.current?.getBoundingClientRect(),o=!!a&&(e.clientX<a.left||e.clientX>a.right||e.clientY<a.top||e.clientY>a.bottom);if(p&&c&&r&&o&&function(e,t){if(e.pinned)return!1;let r=X.findIndex(t=>t.id===e.id);if(c?.(e,{tabs:X,clientX:t.clientX,clientY:t.clientY,nativeEvent:t})===!1)return!1;let a=X.filter(t=>t.id!==e.id);if(en(a),e.id===ee){let e=ZJ(a,r);void 0===n&&Q(e),e&&i?.(e)}return!0}(r,e)){_(void 0),er(void 0),ea(void 0,!1);return}let l=V.current;l&&!(l.length===X.length&&l.every((e,t)=>e.id===X[t]?.id))&&(en(l),s?.(l))}_(void 0),er(void 0),ea(void 0,!1)}});let ef=et&&(k?.(et)??et.content??(0,eb.jsx)("div",{className:"grid min-h-44 place-items-center bg-muted/30 p-6 text-center text-muted-foreground",children:et.title})),eh=I?.dragging&&R?R:X,ep=I?.dragging?X.find(e=>e.id===I.tabId):void 0,em=I?.dragging&&ep&&$?(0,t3.createPortal)((0,eb.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:I.currentX-I.offsetX,top:I.top,width:I.width},children:[ep.icon&&(0,eb.jsx)("span",{className:"grid size-4 shrink-0 place-items-center text-muted-foreground [&_svg]:size-3.5",children:ep.icon}),(0,eb.jsx)("span",{className:"truncate ui-text-control font-medium",children:ep.title}),ep.modified&&(0,eb.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-foreground/70"})]}),document.body):null;return(0,eb.jsxs)("div",{ref:P,"data-slot":"multi-tab-system",className:tK("vtl-surface-panel grid min-h-0 grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-[var(--surface-panel-radius)] border",C),children:[(0,eb.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,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":y,onClick:()=>el("left"),className:"mb-1 shrink-0",children:(0,eb.jsx)(cO,{})}),(0,eb.jsxs)("div",{ref:A,role:"tablist","aria-label":w,"data-slot":"multi-tab-list",className:tK("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&&U?"both":W?"left":U?"right":void 0,onScroll:eo,onDragOver:function(e){ed(e)&&(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move",Y(eu(e)))},onDragLeave:function(e){if(!ed(e))return;let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||Y(void 0)},onDrop:function(e){if(!ed(e))return;e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move";let t=eu(e);Y(void 0),d?.({tabs:X,insertIndex:t.index,nativeEvent:e})},children:[eh.map((e,t)=>{let r=e.id===et?.id,a=eh[t+1],o=I?.dragging&&z===e.id,s=!r&&!o&&void 0!==a&&a.id!==et?.id&&a.id!==z;return(0,eb.jsxs)(ew.Fragment,{children:[(0,eb.jsxs)("div",{onPointerDown:t=>(function(e,t){if(!h||e.disabled||0!==t.button)return;let n=t.currentTarget.getBoundingClientRect();_(e.id),ea(X,!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":z===e.id?"true":void 0,"data-modified":e.modified?"true":void 0,className:tK("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,eb.jsx)("button",{type:"button",role:"tab","aria-label":ZQ(e.title),"aria-selected":r,disabled:e.disabled,onClick:t=>{var r;let a;if(H.current){H.current=!1,t.preventDefault();return}r=e.id,(a=X.find(e=>e.id===r))&&!a.disabled&&(void 0===n&&Q(r),i?.(r))},className:"absolute inset-0 rounded-t-lg outline-none focus-visible:ring-2 focus-visible:ring-ring/50"}),(0,eb.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,eb.jsx)("span",{className:"grid size-4 shrink-0 place-items-center text-muted-foreground [&_svg]:size-3.5",children:e.icon}),(0,eb.jsx)("span",{className:"truncate ui-text-control font-medium",children:e.title}),e.meta&&(0,eb.jsx)("span",{className:"shrink-0 ui-text-kbd text-muted-foreground",children:e.meta}),e.modified&&(0,eb.jsx)("span",{"aria-hidden":"true",className:"size-1.5 shrink-0 rounded-full bg-foreground/70"})]}),!e.pinned&&(0,eb.jsx)("button",{type:"button",draggable:!1,onPointerDown:e=>e.stopPropagation(),"aria-label":e.closeLabel??(ZQ(e.title)?`${x}: ${ZQ(e.title)}`:x),onClick:()=>(function(e){if(e.pinned)return;let t=X.findIndex(t=>t.id===e.id),r=X.filter(t=>t.id!==e.id);if(en(r),l?.(e),e.id===ee){let e=ZJ(r,t);void 0===n&&Q(e),e&&i?.(e)}})(e),className:tK("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,eb.jsx)(p6,{className:"size-3.5"})})]}),s&&(0,eb.jsx)("span",{"aria-hidden":"true",className:"mb-2 h-4 w-px shrink-0 bg-border/80"})]},e.id)}),G?(0,eb.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,eb.jsx)("span",{className:"h-full w-px rounded-full bg-foreground/80"}),(0,eb.jsx)("span",{className:"absolute top-0 size-1.5 rounded-full bg-foreground"})]}):null]}),(0,eb.jsxs)("div",{className:"mb-1 flex shrink-0 items-center gap-1",children:[U&&(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":b,onClick:()=>el("right"),children:(0,eb.jsx)(vo,{})}),u.length>0?(0,eb.jsxs)(yu,{children:[(0,eb.jsx)(yh,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":g,children:(0,eb.jsx)(s7,{})})}),(0,eb.jsx)(yk,{align:"end",className:"w-52",children:u.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[e.separatorBefore&&(0,eb.jsx)(yM,{}),(0,eb.jsxs)(yS,{disabled:e.disabled,onSelect:e.onSelect,children:[e.icon,e.label,e.shortcut&&(0,eb.jsx)(yE,{children:e.shortcut})]})]},t))})]}):(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":g,onClick:function(){let e=o?.();e&&(en([...X,e]),e.disabled||(void 0===n&&Q(e.id),i?.(e.id)))},children:(0,eb.jsx)(s7,{})}),f.length>0&&(0,eb.jsxs)(yu,{children:[(0,eb.jsx)(yh,{asChild:!0,children:(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":v,children:(0,eb.jsx)(s6,{})})}),(0,eb.jsx)(yk,{align:"end",className:"w-52",children:f.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[e.separatorBefore&&(0,eb.jsx)(yM,{}),(0,eb.jsxs)(yS,{disabled:e.disabled,onSelect:e.onSelect,children:[e.icon,e.label,e.shortcut&&(0,eb.jsx)(yE,{children:e.shortcut})]})]},t))})]})]})]}),em,S&&(0,eb.jsx)("div",{"data-slot":"multi-tab-content",className:tK("min-h-0 overflow-hidden",M),children:ef??j??(0,eb.jsx)("div",{"aria-hidden":"true",className:"min-h-44 rounded-lg border border-dashed bg-muted/30"})})]})}let Z2=[{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"}],Z5=Array.from(new Set(Z2.flatMap(e=>e.tags))).sort(),Z4=[["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"]],Z3=[["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"]],Z6=[{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}],Z8=[["14:42","Allay 将 Linux-runner-02 加入 Compute 机器组","done"],["14:37","Ops 对 runner 服务发起重启确认","current"],["14:25","UI Polish Agent 访问 D:\\Projects\\Vantaloom-ui","done"],["14:18","Viewer 请求远程 shell 被拒绝","blocked"],["14:07","Observer-01 P2P 心跳恢复","done"],["13:54","Buildbot 读取发布产物目录","done"]],Z7={p2p:{label:"P2P",color:"var(--chart-1)"},direct:{label:"Direct",color:"var(--chart-3)"},relay:{label:"Relay",color:"var(--chart-5)"},cpu:{label:"CPU",color:"var(--chart-1)"},memory:{label:"Memory",color:"var(--chart-3)"}};function Z9({className:e,...t}){return(0,eb.jsx)("nav",{role:"navigation","aria-label":"pagination","data-slot":"pagination",className:tK("mx-auto flex w-full justify-center",e),...t})}function Je({className:e,...t}){return(0,eb.jsx)("ul",{"data-slot":"pagination-content",className:tK("flex flex-row items-center gap-1",e),...t})}function Jt({...e}){return(0,eb.jsx)("li",{"data-slot":"pagination-item",...e})}function Jn({className:e,isActive:t,size:n="icon",...r}){return(0,eb.jsx)("a",{"aria-current":t?"page":void 0,"data-slot":"pagination-link","data-active":t,className:tK(tG({variant:t?"outline":"ghost",size:n}),e),...r})}function Jr({className:e,previousLabel:t="Previous",...n}){return(0,eb.jsxs)(Jn,{"aria-label":t,size:"default",className:tK("gap-1 px-2.5 sm:pl-2",e),...n,children:[(0,eb.jsx)(cO,{}),(0,eb.jsx)("span",{className:"hidden sm:block",children:t})]})}function Ji({className:e,nextLabel:t="Next",...n}){return(0,eb.jsxs)(Jn,{"aria-label":t,size:"default",className:tK("gap-1 px-2.5 sm:pr-2",e),...n,children:[(0,eb.jsx)("span",{className:"hidden sm:block",children:t}),(0,eb.jsx)(vo,{})]})}function Ja({className:e,moreLabel:t="More pages",...n}){return(0,eb.jsxs)("span",{"aria-hidden":!0,"data-slot":"pagination-ellipsis",className:tK("flex size-8 items-center justify-center",e),...n,children:[(0,eb.jsx)(s6,{className:"size-4"}),(0,eb.jsx)("span",{className:"sr-only",children:t})]})}var Jo=[" ","Enter","ArrowUp","ArrowDown"],Jl=[" ","Enter"],Js="Select",[Jc,Jd,Ju]=v_(Js),[Jf,Jh]=tX(Js,[Ju,ut]),Jp=ut(),[Jm,Jg]=Jf(Js),[Jv,Jx]=Jf(Js),Jy=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:l,onValueChange:s,dir:c,name:d,autoComplete:u,disabled:f,required:h,form:p}=e,m=Jp(t),[g,v]=ew.useState(null),[x,y]=ew.useState(null),[b,w]=ew.useState(!1),j=fb(c),[k,S]=t0({prop:r,defaultProp:i??!1,onChange:a,caller:Js}),[C,N]=t0({prop:o,defaultProp:l,onChange:s,caller:Js}),M=ew.useRef(null),E=!g||p||!!g.closest("form"),[O,P]=ew.useState(new Set),A=Array.from(O).map(e=>e.props.value).join(";");return(0,eb.jsx)(ui,{...m,children:(0,eb.jsxs)(Jm,{required:h,scope:t,trigger:g,onTriggerChange:v,valueNode:x,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:w,contentId:cR(),value:C,onValueChange:N,open:k,onOpenChange:S,dir:j,triggerPointerDownPosRef:M,disabled:f,children:[(0,eb.jsx)(Jc.Provider,{scope:t,children:(0,eb.jsx)(Jv,{scope:e.__scopeSelect,onNativeOptionAdd:ew.useCallback(e=>{P(t=>new Set(t).add(e))},[]),onNativeOptionRemove:ew.useCallback(e=>{P(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),E?(0,eb.jsxs)(J2,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:u,value:C,onChange:e=>N(e.target.value),disabled:f,form:p,children:[void 0===C?(0,eb.jsx)("option",{value:""}):null,Array.from(O)]},A):null]})})};Jy.displayName=Js;var Jb="SelectTrigger",Jw=ew.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Jp(n),o=Jg(Jb,n),l=o.disabled||r,s=eT(t,o.onTriggerChange),c=Jd(n),d=ew.useRef("touch"),[u,f,h]=J4(e=>{let t=c().filter(e=>!e.disabled),n=t.find(e=>e.value===o.value),r=J3(t,e,n);void 0!==r&&o.onValueChange(r.value)}),p=e=>{l||(o.onOpenChange(!0),h()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,eb.jsx)(uo,{asChild:!0,...a,children:(0,eb.jsx)(ne.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":J5(o.value)?"":void 0,...i,ref:s,onClick:tZ(i.onClick,e=>{e.currentTarget.focus(),"mouse"!==d.current&&p(e)}),onPointerDown:tZ(i.onPointerDown,e=>{d.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),0===e.button&&!1===e.ctrlKey&&"mouse"===e.pointerType&&(p(e),e.preventDefault())}),onKeyDown:tZ(i.onKeyDown,e=>{let t=""!==u.current;e.ctrlKey||e.altKey||e.metaKey||1!==e.key.length||f(e.key),(!t||" "!==e.key)&&Jo.includes(e.key)&&(p(),e.preventDefault())})})})});Jw.displayName=Jb;var Jj="SelectValue",Jk=ew.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o="",...l}=e,s=Jg(Jj,n),{onValueNodeHasChildrenChange:c}=s,d=void 0!==a,u=eT(t,s.onValueNodeChange);return tJ(()=>{c(d)},[c,d]),(0,eb.jsx)(ne.span,{...l,ref:u,style:{pointerEvents:"none"},children:J5(s.value)?(0,eb.jsx)(eb.Fragment,{children:o}):a})});Jk.displayName=Jj;var JS=ew.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,eb.jsx)(ne.span,{"aria-hidden":!0,...i,ref:t,children:r||"▼"})});JS.displayName="SelectIcon";var JC=e=>(0,eb.jsx)(uv,{asChild:!0,...e});JC.displayName="SelectPortal";var JN="SelectContent",JM=ew.forwardRef((e,t)=>{let n=Jg(JN,e.__scopeSelect),[r,i]=ew.useState();return(tJ(()=>{i(new DocumentFragment)},[]),n.open)?(0,eb.jsx)(JA,{...e,ref:t}):r?t3.createPortal((0,eb.jsx)(JE,{scope:e.__scopeSelect,children:(0,eb.jsx)(Jc.Slot,{scope:e.__scopeSelect,children:(0,eb.jsx)("div",{children:e.children})})}),r):null});JM.displayName=JN;var[JE,JO]=Jf(JN),JP=t6("SelectContent.RemoveScroll"),JA=ew.forwardRef((e,t)=>{let{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:l,sideOffset:s,align:c,alignOffset:d,arrowPadding:u,collisionBoundary:f,collisionPadding:h,sticky:p,hideWhenDetached:m,avoidCollisions:g,...v}=e,x=Jg(JN,n),[y,b]=ew.useState(null),[w,j]=ew.useState(null),k=eT(t,e=>b(e)),[S,C]=ew.useState(null),[N,M]=ew.useState(null),E=Jd(n),[O,P]=ew.useState(!1),A=ew.useRef(!1);ew.useEffect(()=>{if(y)return pe(y)},[y]),hv();let z=ew.useCallback(e=>{let[t,...n]=E().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:"nearest"}),n===t&&w&&(w.scrollTop=0),n===r&&w&&(w.scrollTop=w.scrollHeight),n?.focus(),document.activeElement!==i))return},[E,w]),_=ew.useCallback(()=>z([S,y]),[z,S,y]);ew.useEffect(()=>{O&&_()},[O,_]);let{onOpenChange:I,triggerPointerDownPosRef:D}=x;ew.useEffect(()=>{if(y){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(D.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(D.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():y.contains(n.target)||I(!1),document.removeEventListener("pointermove",t),D.current=null};return null!==D.current&&(document.addEventListener("pointermove",t),document.addEventListener("pointerup",n,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",t),document.removeEventListener("pointerup",n,{capture:!0})}}},[y,I,D]),ew.useEffect(()=>{let e=()=>I(!1);return window.addEventListener("blur",e),window.addEventListener("resize",e),()=>{window.removeEventListener("blur",e),window.removeEventListener("resize",e)}},[I]);let[T,R]=J4(e=>{let t=E().filter(e=>!e.disabled),n=t.find(e=>e.ref.current===document.activeElement),r=J3(t,e,n);r&&setTimeout(()=>r.ref.current.focus())}),L=ew.useCallback((e,t,n)=>{let r=!A.current&&!n;(void 0!==x.value&&x.value===t||r)&&(C(e),r&&(A.current=!0))},[x.value]),$=ew.useCallback(()=>y?.focus(),[y]),F=ew.useCallback((e,t,n)=>{let r=!A.current&&!n;(void 0!==x.value&&x.value===t||r)&&M(e)},[x.value]),V="popper"===r?J_:Jz,B=V===J_?{side:l,sideOffset:s,align:c,alignOffset:d,arrowPadding:u,collisionBoundary:f,collisionPadding:h,sticky:p,hideWhenDetached:m,avoidCollisions:g}:{};return(0,eb.jsx)(JE,{scope:n,content:y,viewport:w,onViewportChange:j,itemRefCallback:L,selectedItem:S,onItemLeave:$,itemTextRefCallback:F,focusSelectedItem:_,selectedItemText:N,position:r,isPositioned:O,searchRef:T,children:(0,eb.jsx)(h5,{as:JP,allowPinchZoom:!0,children:(0,eb.jsx)(hd,{asChild:!0,trapped:x.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:tZ(i,e=>{x.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,eb.jsx)(cJ,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:(0,eb.jsx)(V,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:e=>e.preventDefault(),...v,...B,onPlaced:()=>P(!0),ref:k,style:{display:"flex",flexDirection:"column",outline:"none",...v.style},onKeyDown:tZ(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if("Tab"===e.key&&e.preventDefault(),t||1!==e.key.length||R(e.key),["ArrowUp","ArrowDown","Home","End"].includes(e.key)){let t=E().filter(e=>!e.disabled).map(e=>e.ref.current);if(["ArrowUp","End"].includes(e.key)&&(t=t.slice().reverse()),["ArrowUp","ArrowDown"].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>z(t)),e.preventDefault()}})})})})})})});JA.displayName="SelectContentImpl";var Jz=ew.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=Jg(JN,n),o=JO(JN,n),[l,s]=ew.useState(null),[c,d]=ew.useState(null),u=eT(t,e=>d(e)),f=Jd(n),h=ew.useRef(!1),p=ew.useRef(!0),{viewport:m,selectedItem:g,selectedItemText:v,focusSelectedItem:x}=o,y=ew.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&c&&m&&g&&v){let e=a.trigger.getBoundingClientRect(),t=c.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=v.getBoundingClientRect();if("rtl"!==a.dir){let r=i.left-t.left,a=n.left-r,o=e.left-a,s=e.width+o,c=Math.max(s,t.width),d=fw(a,[10,Math.max(10,window.innerWidth-10-c)]);l.style.minWidth=s+"px",l.style.left=d+"px"}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,s=e.width+o,c=Math.max(s,t.width),d=fw(a,[10,Math.max(10,window.innerWidth-10-c)]);l.style.minWidth=s+"px",l.style.right=d+"px"}let o=f(),s=window.innerHeight-20,d=m.scrollHeight,u=window.getComputedStyle(c),p=parseInt(u.borderTopWidth,10),x=parseInt(u.paddingTop,10),y=parseInt(u.borderBottomWidth,10),b=p+x+d+parseInt(u.paddingBottom,10)+y,w=Math.min(5*g.offsetHeight,b),j=window.getComputedStyle(m),k=parseInt(j.paddingTop,10),S=parseInt(j.paddingBottom,10),C=e.top+e.height/2-10,N=g.offsetHeight/2,M=p+x+(g.offsetTop+N);if(M<=C){let e=o.length>0&&g===o[o.length-1].ref.current;l.style.bottom="0px";let t=Math.max(s-C,N+(e?S:0)+(c.clientHeight-m.offsetTop-m.offsetHeight)+y);l.style.height=M+t+"px"}else{let e=o.length>0&&g===o[0].ref.current;l.style.top="0px";let t=Math.max(C,p+m.offsetTop+(e?k:0)+N);l.style.height=t+(b-M)+"px",m.scrollTop=M-C+m.offsetTop}l.style.margin="10px 0",l.style.minHeight=w+"px",l.style.maxHeight=s+"px",r?.(),requestAnimationFrame(()=>h.current=!0)}},[f,a.trigger,a.valueNode,l,c,m,g,v,a.dir,r]);tJ(()=>y(),[y]);let[b,w]=ew.useState();tJ(()=>{c&&w(window.getComputedStyle(c).zIndex)},[c]);let j=ew.useCallback(e=>{e&&!0===p.current&&(y(),x?.(),p.current=!1)},[y,x]);return(0,eb.jsx)(JI,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:j,children:(0,eb.jsx)("div",{ref:s,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:b},children:(0,eb.jsx)(ne.div,{...i,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...i.style}})})})});Jz.displayName="SelectItemAlignedPosition";var J_=ew.forwardRef((e,t)=>{let{__scopeSelect:n,align:r="start",collisionPadding:i=10,...a}=e,o=Jp(n);return(0,eb.jsx)(ud,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});J_.displayName="SelectPopperPosition";var[JI,JD]=Jf(JN,{}),JT="SelectViewport",JR=ew.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=JO(JT,n),o=JD(JT,n),l=eT(t,a.onViewportChange),s=ew.useRef(0);return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),(0,eb.jsx)(Jc.Slot,{scope:n,children:(0,eb.jsx)(ne.div,{"data-radix-select-viewport":"",role:"presentation",...i,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...i.style},onScroll:tZ(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(s.current-t.scrollTop);if(e>0){let r=window.innerHeight-20,i=Math.max(parseFloat(n.style.minHeight),parseFloat(n.style.height));if(i<r){let a=i+e,o=Math.min(r,a),l=a-o;n.style.height=o+"px","0px"===n.style.bottom&&(t.scrollTop=l>0?l:0,n.style.justifyContent="flex-end")}}}s.current=t.scrollTop})})})]})});JR.displayName=JT;var JL="SelectGroup",[J$,JF]=Jf(JL);ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=cR();return(0,eb.jsx)(J$,{scope:n,id:i,children:(0,eb.jsx)(ne.div,{role:"group","aria-labelledby":i,...r,ref:t})})}).displayName=JL;var JV="SelectLabel";ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=JF(JV,n);return(0,eb.jsx)(ne.div,{id:i.id,...r,ref:t})}).displayName=JV;var JB="SelectItem",[JH,JW]=Jf(JB),Jq=ew.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,l=Jg(JB,n),s=JO(JB,n),c=l.value===r,[d,u]=ew.useState(a??""),[f,h]=ew.useState(!1),p=eT(t,e=>s.itemRefCallback?.(e,r,i)),m=cR(),g=ew.useRef("touch"),v=()=>{i||(l.onValueChange(r),l.onOpenChange(!1))};if(""===r)throw Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return(0,eb.jsx)(JH,{scope:n,value:r,disabled:i,textId:m,isSelected:c,onItemTextChange:ew.useCallback(e=>{u(t=>t||(e?.textContent??"").trim())},[]),children:(0,eb.jsx)(Jc.ItemSlot,{scope:n,value:r,disabled:i,textValue:d,children:(0,eb.jsx)(ne.div,{role:"option","aria-labelledby":m,"data-highlighted":f?"":void 0,"aria-selected":c&&f,"data-state":c?"checked":"unchecked","aria-disabled":i||void 0,"data-disabled":i?"":void 0,tabIndex:i?void 0:-1,...o,ref:p,onFocus:tZ(o.onFocus,()=>h(!0)),onBlur:tZ(o.onBlur,()=>h(!1)),onClick:tZ(o.onClick,()=>{"mouse"!==g.current&&v()}),onPointerUp:tZ(o.onPointerUp,()=>{"mouse"===g.current&&v()}),onPointerDown:tZ(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:tZ(o.onPointerMove,e=>{g.current=e.pointerType,i?s.onItemLeave?.():"mouse"===g.current&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:tZ(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&s.onItemLeave?.()}),onKeyDown:tZ(o.onKeyDown,e=>{(s.searchRef?.current===""||" "!==e.key)&&(Jl.includes(e.key)&&v()," "===e.key&&e.preventDefault())})})})})});Jq.displayName=JB;var JU="SelectItemText",JK=ew.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=Jg(JU,n),l=JO(JU,n),s=JW(JU,n),c=Jx(JU,n),[d,u]=ew.useState(null),f=eT(t,e=>u(e),s.onItemTextChange,e=>l.itemTextRefCallback?.(e,s.value,s.disabled)),h=d?.textContent,p=ew.useMemo(()=>(0,eb.jsx)("option",{value:s.value,disabled:s.disabled,children:h},s.value),[s.disabled,s.value,h]),{onNativeOptionAdd:m,onNativeOptionRemove:g}=c;return tJ(()=>(m(p),()=>g(p)),[m,g,p]),(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(ne.span,{id:s.textId,...a,ref:f}),s.isSelected&&o.valueNode&&!o.valueNodeHasChildren?t3.createPortal(a.children,o.valueNode):null]})});JK.displayName=JU;var JG="SelectItemIndicator",JY=ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return JW(JG,n).isSelected?(0,eb.jsx)(ne.span,{"aria-hidden":!0,...r,ref:t}):null});JY.displayName=JG;var JX="SelectScrollUpButton",JZ=ew.forwardRef((e,t)=>{let n=JO(JX,e.__scopeSelect),r=JD(JX,e.__scopeSelect),[i,a]=ew.useState(!1),o=eT(t,r.onScrollButtonChange);return tJ(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),i?(0,eb.jsx)(J0,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop-t.offsetHeight)}}):null});JZ.displayName=JX;var JJ="SelectScrollDownButton",JQ=ew.forwardRef((e,t)=>{let n=JO(JJ,e.__scopeSelect),r=JD(JJ,e.__scopeSelect),[i,a]=ew.useState(!1),o=eT(t,r.onScrollButtonChange);return tJ(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener("scroll",e),()=>t.removeEventListener("scroll",e)}},[n.viewport,n.isPositioned]),i?(0,eb.jsx)(J0,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop=e.scrollTop+t.offsetHeight)}}):null});JQ.displayName=JJ;var J0=ew.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=JO("SelectScrollButton",n),o=ew.useRef(null),l=Jd(n),s=ew.useCallback(()=>{null!==o.current&&(window.clearInterval(o.current),o.current=null)},[]);return ew.useEffect(()=>()=>s(),[s]),tJ(()=>{let e=l().find(e=>e.ref.current===document.activeElement);e?.ref.current?.scrollIntoView({block:"nearest"})},[l]),(0,eb.jsx)(ne.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:tZ(i.onPointerDown,()=>{null===o.current&&(o.current=window.setInterval(r,50))}),onPointerMove:tZ(i.onPointerMove,()=>{a.onItemLeave?.(),null===o.current&&(o.current=window.setInterval(r,50))}),onPointerLeave:tZ(i.onPointerLeave,()=>{s()})})});ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,eb.jsx)(ne.div,{"aria-hidden":!0,...r,ref:t})}).displayName="SelectSeparator";var J1="SelectArrow";ew.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Jp(n),a=Jg(J1,n),o=JO(J1,n);return a.open&&"popper"===o.position?(0,eb.jsx)(uh,{...i,...r,ref:t}):null}).displayName=J1;var J2=ew.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=ew.useRef(null),a=eT(r,i),o=t1(t);return ew.useEffect(()=>{let e=i.current;if(!e)return;let n=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,"value").set;if(o!==t&&n){let r=new Event("change",{bubbles:!0});n.call(e,t),e.dispatchEvent(r)}},[o,t]),(0,eb.jsx)(ne.select,{...n,style:{...ux,...n.style},ref:a,defaultValue:t})});function J5(e){return""===e||void 0===e}function J4(e){let t=cY(e),n=ew.useRef(""),r=ew.useRef(0),i=ew.useCallback(e=>{let i=n.current+e;t(i),function e(t){n.current=t,window.clearTimeout(r.current),""!==t&&(r.current=window.setTimeout(()=>e(""),1e3))}(i)},[t]),a=ew.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return ew.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function J3(e,t,n){var r,i;let a=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,o=n?e.indexOf(n):-1,l=(r=e,i=Math.max(o,0),r.map((e,t)=>r[(i+t)%r.length]));1===a.length&&(l=l.filter(e=>e!==n));let s=l.find(e=>e.textValue.toLowerCase().startsWith(a.toLowerCase()));return s!==n?s:void 0}function J6({className:e,size:t="default",children:n,...r}){return(0,eb.jsxs)(Jw,{"data-slot":"select-trigger","data-size":t,className:tK("flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[placeholder]:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&>span]:line-clamp-1 [&>span]:flex [&>span]:items-center [&>span]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r,children:[n,(0,eb.jsx)(JS,{asChild:!0,children:(0,eb.jsx)(cE,{className:"size-4 text-muted-foreground"})})]})}function J8({className:e,...t}){return(0,eb.jsx)(JZ,{"data-slot":"select-scroll-up-button",className:tK("z-10 flex cursor-default items-center justify-center bg-[var(--surface-popover)] py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,eb.jsx)(vl,{})})}function J7({className:e,...t}){return(0,eb.jsx)(JQ,{"data-slot":"select-scroll-down-button",className:tK("z-10 flex cursor-default items-center justify-center bg-[var(--surface-popover)] py-1 [&_svg:not([class*='size-'])]:size-4",e),...t,children:(0,eb.jsx)(cE,{})})}function J9({className:e,children:t,position:n="popper",align:r="center",...i}){return(0,eb.jsx)(JC,{children:(0,eb.jsxs)(JM,{"data-slot":"select-content","data-align-trigger":"item-aligned"===n,position:n,align:r,className:tK("vtl-surface-popover relative z-50 max-h-[var(--radix-select-content-available-height)] min-w-36 overflow-x-hidden overflow-y-auto rounded-[var(--surface-popover-radius)] border duration-100 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[align-trigger=true]:animate-none","popper"===n&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),...i,children:[(0,eb.jsx)(J8,{}),(0,eb.jsx)(JR,{"data-position":n,className:tK("p-1","popper"===n&&"w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),(0,eb.jsx)(J7,{})]})})}function Qe({className:e,children:t,...n}){return(0,eb.jsxs)(Jq,{"data-slot":"select-item",className:tK("relative flex w-full cursor-default items-center gap-1.5 rounded-md py-1 pr-8 pl-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...n,children:[(0,eb.jsx)("span",{className:"pointer-events-none absolute right-2 flex size-4 items-center justify-center",children:(0,eb.jsx)(JY,{children:(0,eb.jsx)(nv,{})})}),(0,eb.jsx)(JK,{children:t})]})}function Qt({title:e}){return(0,eb.jsx)("h2",{className:"h-7 text-sm font-semibold tracking-normal",children:e})}function Qn(){let[e,t]=ew.useState(""),[n,r]=ew.useState("all"),[i,a]=ew.useState({allow:!1,drop:!1,deny:!1}),[o,l]=ew.useState(1),s=ew.useMemo(()=>["allow","drop","deny"].filter(e=>i[e]),[i]),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,eb.jsx)(Qa,{zone:e.sourceZone})},{id:"sourceIPs",header:"源 IP",accessorKey:"sourceIPs",width:250,cell:({row:e})=>(0,eb.jsx)(Qi,{items:e.sourceIPs,variant:"outline"}),copyValue:({row:e})=>e.sourceIPs.join(", ")},{id:"destinationZone",header:"目标区域",accessorKey:"destinationZone",width:112,cell:({row:e})=>(0,eb.jsx)(Qa,{zone:e.destinationZone})},{id:"destinationIPs",header:"目标 IP",accessorKey:"destinationIPs",width:250,cell:({row:e})=>(0,eb.jsx)(Qi,{items:e.destinationIPs,variant:"outline"}),copyValue:({row:e})=>e.destinationIPs.join(", ")},{id:"tags",header:"标签",accessorKey:"tags",width:220,cell:({row:e})=>(0,eb.jsx)(Qi,{items:e.tags,variant:"secondary"}),copyValue:({row:e})=>e.tags.join(", ")},{id:"action",header:"动作",accessorKey:"action",width:96,cell:({row:e})=>(0,eb.jsx)(Qo,{action:e.action})}],[]),d=ew.useMemo(()=>{let t=e.trim().toLowerCase();return Z2.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)),a="all"===n||e.tags.includes(n),o=!(i.allow||i.drop||i.deny)||i.allow&&"allow"===e.action||i.drop&&"drop"===e.action||i.deny&&"deny"===e.action;return r&&a&&o})},[i,e,n]),u=Math.max(1,Math.ceil(d.length/8)),f=Math.min(o,u),h=d.slice((f-1)*8,8*f);return ew.useEffect(()=>{l(1)},[i,e,n]),(0,eb.jsxs)("div",{className:"flex h-full min-h-0 flex-col p-3",children:[(0,eb.jsxs)("div",{className:"mb-3 flex shrink-0 items-center justify-between gap-3",children:[(0,eb.jsx)(Qt,{title:"防火墙策略"}),(0,eb.jsxs)(tY,{size:"sm",children:[(0,eb.jsx)(s7,{className:"size-4"}),"新增策略"]})]}),(0,eb.jsxs)("div",{className:"mb-3 grid shrink-0 grid-cols-[minmax(12rem,1fr)_10rem_auto] items-end gap-3",children:[(0,eb.jsxs)("label",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"搜索"}),(0,eb.jsxs)("span",{className:"relative",children:[(0,eb.jsx)(cz,{className:"pointer-events-none absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground"}),(0,eb.jsx)(ny,{value:e,onChange:e=>t(e.target.value),placeholder:"搜索策略...",className:"pl-8"})]})]}),(0,eb.jsxs)("label",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"标签"}),(0,eb.jsxs)(Jy,{value:n,onValueChange:r,children:[(0,eb.jsx)(J6,{className:"w-full",children:(0,eb.jsx)(Jk,{placeholder:"全部标签"})}),(0,eb.jsxs)(J9,{children:[(0,eb.jsx)(Qe,{value:"all",children:"全部标签"}),Z5.map(e=>(0,eb.jsx)(Qe,{value:e,children:e},e))]})]})]}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"ui-text-kbd text-muted-foreground",children:"动作"}),(0,eb.jsxs)(yJ,{type:"multiple",variant:"outline",value:s,onValueChange:function(e){e.includes("clear")?(t(""),r("all"),a({allow:!1,drop:!1,deny:!1}),l(1)):a({allow:e.includes("allow"),drop:e.includes("drop"),deny:e.includes("deny")})},children:[(0,eb.jsx)(yQ,{value:"allow",children:"允许"}),(0,eb.jsx)(yQ,{value:"drop",children:"丢弃"}),(0,eb.jsx)(yQ,{value:"deny",children:"拒绝"}),(0,eb.jsx)(yQ,{value:"clear",children:"全部"})]})]})]}),(0,eb.jsx)(Gq,{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,eb.jsx)(Qr,{page:f,totalPages:u,onPageChange:function(e){l(Math.min(u,Math.max(1,e)))}})]})}function Qr({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]),i=r[0]??1,a=r[r.length-1]??t;function o(e,t){e.preventDefault(),n(t)}return(0,eb.jsx)(Z9,{className:"mt-3 shrink-0",children:(0,eb.jsxs)(Je,{className:"gap-2",children:[(0,eb.jsx)(Jt,{children:(0,eb.jsx)(Jr,{href:"#",previousLabel:"上一页","aria-disabled":1===e,className:tK(1===e&&"pointer-events-none opacity-40"),onClick:t=>o(t,e-1)})}),i>1?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(Jt,{children:(0,eb.jsx)(Jn,{href:"#",size:"icon",onClick:e=>o(e,1),children:"1"})}),i>2?(0,eb.jsx)(Jt,{children:(0,eb.jsx)(Ja,{moreLabel:"更多页"})}):null]}):null,r.map(t=>(0,eb.jsx)(Jt,{children:(0,eb.jsx)(Jn,{href:"#",size:"icon",isActive:e===t,onClick:e=>o(e,t),children:t})},t)),a<t?(0,eb.jsxs)(eb.Fragment,{children:[a<t-1?(0,eb.jsx)(Jt,{children:(0,eb.jsx)(Ja,{moreLabel:"更多页"})}):null,(0,eb.jsx)(Jt,{children:(0,eb.jsx)(Jn,{href:"#",size:"icon",onClick:e=>o(e,t),children:t})})]}):null,(0,eb.jsx)(Jt,{children:(0,eb.jsx)(Ji,{href:"#",nextLabel:"下一页","aria-disabled":e===t,className:tK(e===t&&"pointer-events-none opacity-40"),onClick:t=>o(t,e+1)})})]})})}function Qi({items:e,variant:t}){return(0,eb.jsx)("div",{className:"flex min-w-48 flex-wrap gap-1",children:e.map(e=>(0,eb.jsx)(cI,{variant:t,children:e},e))})}function Qa({zone:e}){return(0,eb.jsx)(cI,{variant:"Trust"===e?"secondary":"outline",children:e})}function Qo({action:e}){return(0,eb.jsx)(cI,{variant:"allow"===e?"default":"destructive",children:{allow:"允许",drop:"丢弃",deny:"拒绝"}[e]})}function Ql({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:(0,eb.jsx)("table",{"data-slot":"table",className:tK("w-full caption-bottom text-sm",e),...t})})}function Qs({className:e,...t}){return(0,eb.jsx)("thead",{"data-slot":"table-header",className:tK("[&_tr]:border-b",e),...t})}function Qc({className:e,...t}){return(0,eb.jsx)("tbody",{"data-slot":"table-body",className:tK("[&_tr:last-child]:border-0",e),...t})}function Qd({className:e,...t}){return(0,eb.jsx)("tr",{"data-slot":"table-row",className:tK("border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function Qu({className:e,...t}){return(0,eb.jsx)("th",{"data-slot":"table-head",className:tK("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 Qf({className:e,...t}){return(0,eb.jsx)("td",{"data-slot":"table-cell",className:tK("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-0.5",e),...t})}function Qh({title:e}){return(0,eb.jsx)("h2",{className:"h-7 text-sm font-semibold tracking-normal",children:e})}function Qp({title:e,headers:t,rows:n}){return(0,eb.jsxs)("div",{className:"flex h-full min-h-0 flex-col p-3",children:[(0,eb.jsx)(Qh,{title:e}),(0,eb.jsx)("div",{className:"mt-3 min-h-0 flex-1 overflow-auto",children:(0,eb.jsxs)(Ql,{children:[(0,eb.jsx)(Qs,{children:(0,eb.jsx)(Qd,{children:t.map(e=>(0,eb.jsx)(Qu,{children:e},e))})}),(0,eb.jsx)(Qc,{children:n.map(e=>(0,eb.jsx)(Qd,{children:e.map((e,t)=>(0,eb.jsx)(Qf,{className:0===t?"font-medium":"text-muted-foreground",children:e},`${e}-${t}`))},e.join("-")))})]})})]})}function Qm(){return(0,eb.jsxs)("div",{className:"grid h-full min-h-0 content-start gap-3 p-3",children:[(0,eb.jsx)(Qh,{title:"策略申请"}),(0,eb.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,eb.jsx)(ny,{placeholder:"策略名称"}),(0,eb.jsx)(ny,{placeholder:"负责人"}),(0,eb.jsx)(ny,{placeholder:"源 CIDR"}),(0,eb.jsx)(ny,{placeholder:"目标 CIDR"})]}),(0,eb.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,eb.jsx)("div",{children:(0,eb.jsxs)(tY,{size:"sm",children:[(0,eb.jsx)(s7,{className:"size-4"}),"提交申请"]})})]})}function Qg(){return(0,eb.jsxs)(qg,{defaultValue:"policies",className:"vtl-firewall-workspace flex h-full min-h-0 flex-col",children:[(0,eb.jsx)("div",{className:"shrink-0 px-3 pt-3",children:(0,eb.jsxs)(qC,{className:"h-8",children:[(0,eb.jsx)(qN,{value:"policies",children:"防火墙策略"}),(0,eb.jsx)(qN,{value:"ip-addresses",children:"IP 地址"}),(0,eb.jsx)(qN,{value:"renewals",children:"续期"}),(0,eb.jsx)(qN,{value:"policy-request",children:"策略申请"}),(0,eb.jsx)(qN,{value:"user-settings",children:"用户设置"})]})}),(0,eb.jsx)(qM,{value:"policies",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(Qn,{})}),(0,eb.jsx)(qM,{value:"ip-addresses",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(Qp,{title:"IP 地址",headers:["地址","名称","区域","策略"],rows:Z4})}),(0,eb.jsx)(qM,{value:"renewals",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(Qp,{title:"续期",headers:["策略","续期时间","负责人"],rows:Z3})}),(0,eb.jsx)(qM,{value:"policy-request",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(Qm,{})}),(0,eb.jsx)(qM,{value:"user-settings",className:"mt-3 min-h-0 flex-1 border-t",children:(0,eb.jsx)(Qp,{title:"用户设置",headers:["设置","值"],rows:[["默认区域","Trust"],["审核提醒","14 天"],["申请审批","安全负责人"],["策略导出","已开启"]]})})]})}function Qv(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 Qx(e,t){let n=t.machineId||"local";return Qv((await H_(n,e.path)).items)}function Qy({className:e,onOpenFile:t}){let[n,r]=ew.useState([]),[i,a]=ew.useState(!1),[o,l]=ew.useState(0),s=ew.useCallback(async()=>{a(!0);try{let e=await Hz();r(e.roots.map(e=>({id:e.id,machineId:e.machineId,name:e.name,path:e.path,platform:e.platform,children:Qv(e.children)}))),l(e=>e+1)}catch{r([]),l(e=>e+1)}finally{a(!1)}},[]);return ew.useEffect(()=>{s()},[s]),(0,eb.jsx)(Kv,{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:i?n.map(e=>e.id):[],labels:{title:"Explorer",refresh:"刷新",collapseAll:"折叠",empty:"没有文件",noResults:"没有匹配文件",loading:"读取中..."},onLoadChildren:Qx,onOpenNode:(e,n)=>{"folder"!==e.kind&&t?.({machineId:n.machineId||"local",path:e.path})},onRefresh:()=>{s()}},o)}function Qb({open:e,onOpenChange:t,onSelectFile:n}){return(0,eb.jsx)(po,{open:e,onOpenChange:t,children:(0,eb.jsxs)(p7,{className:"h-[min(42rem,calc(100svh-2rem))] max-w-2xl gap-0 overflow-hidden p-0",children:[(0,eb.jsx)(me,{className:"sr-only",children:"选择文件"}),(0,eb.jsx)(mt,{className:"sr-only",children:"选择本机可访问文件。"}),(0,eb.jsx)(Qy,{className:"size-full max-w-none rounded-none border-0",onOpenFile:e=>{n(e),t(!1)}})]})})}J2.displayName="SelectBubbleInput";let Qw=eN("shield-check",[["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:"m9 12 2 2 4-4",key:"dzmm74"}]]),Qj=eN("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 Qk({open:e,placement:t="viewport",movePermissionGranted:n,onOpenChange:r,onAdd:i,onMovePermissionGrantedChange:a}){let o=[{key:"move-permission",label:n?"取消放行权限":"放行权限",icon:n?(0,eb.jsx)(Qw,{className:"size-4"}):(0,eb.jsx)(Qj,{className:"size-4"}),pressed:n,onClick:()=>a(!n)},{key:"add",label:"新建文件窗口",icon:(0,eb.jsx)(s7,{className:"size-4"}),pressed:void 0,onClick:i}];return(0,eb.jsx)("div",{className:tK("right-5 bottom-5 z-50","viewport"===t?"fixed":"absolute"),children:(0,eb.jsxs)("div",{className:"relative size-8",children:[o.map((t,n)=>(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.label,"aria-pressed":t.pressed,title:t.label,onClick:t.onClick,className:tK("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,eb.jsx)(tY,{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,eb.jsx)(s6,{className:tK("size-4 transition-transform",e&&"rotate-90")})})]})})}let QS=[];function QC(e,t){return`${e} / ${t.replace(/\\/g," / ").replace(/\//g," / ")}`}function QN(e,t){return e.replace(/\\/g,"/").toLowerCase()===t.replace(/\\/g,"/").toLowerCase()}function QM(e,t){let n=e.replace(/\\/g,"/").replace(/\/+/g,"/");return"windows"===t?n.toLowerCase():n}function QE(e){return e.map(e=>({...e,children:e.children?QE(e.children):void 0}))}let QO=eN("move-right",[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]),QP=eN("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"}]]),QA=eN("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"}]]),Qz={title:"Clipboard",empty:"No clips",dragHandle:"Drag clip"};function Q_({items:e,expanded:t,defaultExpanded:n=!1,expansionDirection:r="down-left",title:i,labels:a,maxCollapsedItems:o=10,maxExpandedHeight:l=360,acceptExternalDrops:s=!1,removeOnExternalDrop:c=!1,className:d,onExpandedChange:u,onItemDragStart:f,onItemDragEnd:h,onItemDuplicate:p,onItemsRemove:m,onItemsReorder:g,onExternalDrop:v,onMouseEnter:x,onMouseLeave:y,...b}){let w={...Qz,...a},[j,k]=ew.useState(n),[S,C]=ew.useState(),[N,M]=ew.useState(),[E,O]=ew.useState(n),[P,A]=ew.useState(),[z,_]=ew.useState({canScrollDown:!1,canScrollUp:!1}),[I,D]=ew.useState(!1),[T,R]=ew.useState(!1),L=ew.useRef(0),$=ew.useRef(void 0),F=ew.useRef(!1),V=ew.useRef(null),B=ew.useRef(null),H=void 0!==t,W=(H?t:j)||void 0!==S,q=Math.min(o,10),U=W?e:e.slice(0,q),K=E?N:void 0,G=44*U.length+18,Y=Math.min(G,l),X=W&&G>Y,Z=0===e.length?"h-24":W?`${Y}px`:"h-28",J=W&&X?14:0;ew.useEffect(()=>{if(!W){O(!1),_({canScrollDown:!1,canScrollUp:!1});return}O(!1),window.requestAnimationFrame(()=>{B.current&&(B.current.scrollTop=0)}),_({canScrollUp:!1,canScrollDown:G>Y});let e=window.setTimeout(()=>{O(!0)},260);return()=>window.clearTimeout(e)},[G,Y,W]),ew.useEffect(()=>()=>{void 0!==$.current&&window.clearTimeout($.current)},[]);let Q=ew.useCallback(e=>{H||k(e),u?.(e)},[H,u]);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||!B.current)return 0;let t=Array.from(B.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(()=>{V.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||!X||!K||!B.current)return;let e=U.findIndex(e=>e.id===K);if(e<0)return;let t=B.current,n=44*e-8,r=44*e+(U[e]?.expandedHeight??220)+12,i=t.scrollTop,a=i+t.clientHeight;n<i?t.scrollTo({top:Math.max(0,n),behavior:"smooth"}):r>a&&t.scrollTo({top:r-t.clientHeight,behavior:"smooth"})},[K,X,U,W]),(0,eb.jsxs)("div",{ref:V,"data-slot":"clipboard-stack","data-expanded":W,"data-closing":I,"data-external-dragging":T,"data-expansion-direction":r,className:tK("group/clipboard relative w-80 max-w-full overflow-visible py-2",d),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,R(!0),D(!1))},onDragLeave:function(e){!s||en(e)||(L.current=Math.max(0,L.current-1),0===L.current&&(R(!1),A(void 0)))},onDragOver:function(e){!s||en(e)||(e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="copy",R(!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,R(!1),A(void 0),v?.({insertIndex:n,items:e,nativeEvent:t})},...b,children:[(0,eb.jsxs)("div",{"data-slot":"clipboard-stack-header",className:tK("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,eb.jsx)("span",{className:"inline-flex size-6 items-center justify-center rounded-lg border bg-background text-muted-foreground",children:(0,eb.jsx)(QA,{className:"size-3.5"})}),(0,eb.jsx)("span",{children:i??w.title}),(0,eb.jsx)("span",{className:"ml-auto tabular-nums text-muted-foreground",children:e.length})]}),(0,eb.jsxs)("div",{"data-slot":"clipboard-stack-list",className:tK("relative transition-[height] duration-300 ease-[cubic-bezier(.2,.8,.2,1)]"),style:{height:Z},children:[e.length>0&&"down-left"===r?(0,eb.jsx)("span",{"data-slot":"clipboard-stack-pivot","aria-hidden":"true",className:tK("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&&T?(0,eb.jsxs)("span",{"data-slot":"clipboard-stack-external-ghost","aria-hidden":"true",className:tK("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,eb.jsx)("span",{className:"absolute top-3 right-[34px] size-2 rounded-full bg-foreground dark:bg-background"}),(0,eb.jsx)("span",{className:"absolute top-4 left-3 h-2 w-24 rounded-full bg-foreground/18"}),(0,eb.jsx)("span",{className:"absolute top-8 left-3 h-1.5 w-14 rounded-full bg-foreground/10"})]}):null,0===e.length?(0,eb.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,eb.jsxs)("div",{"data-slot":"clipboard-stack-scroll-frame",className:"relative h-full",children:[(0,eb.jsx)("div",{"data-slot":"clipboard-stack-scroll",ref:B,className:tK("relative h-full overflow-x-visible",W&&X?"clipboard-stack-scrollbar-hidden overflow-y-auto pt-2 pr-1 pb-3":"overflow-visible"),onScroll:e=>{let t=e.currentTarget;_({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 i=e.filter(e=>e.id!==S),a=Math.max(0,Math.min(P>n?P-1:P,i.length));i.splice(a,0,r),A(void 0),M(void 0),a!==n&&g?.(i,{item:r,fromIndex:n,toIndex:a,items:i})},children:(0,eb.jsxs)("div",{"data-slot":"clipboard-stack-scroll-content",className:"relative",style:{width:W&&X?`calc(100% - ${J}px)`:void 0,marginLeft:W&&X?`${J}px`:void 0,height:W&&X?G+28:W?G:"100%"},children:[void 0!==P?(0,eb.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,eb.jsx)("span",{className:"h-px flex-1 bg-foreground/70"}),(0,eb.jsx)("span",{className:"mx-1 size-1.5 rounded-full bg-foreground"}),(0,eb.jsx)("span",{className:"h-px flex-1 bg-foreground/70"})]}):null,U.map((t,n)=>(0,eb.jsx)(QI,{item:t,index:n,count:U.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,i=e.findIndex(e=>e.id===r),a=c&&!F.current&&"none"!==n&&i>=0;if(C(void 0),A(void 0),M(void 0),F.current?F.current=!1:Q(!1),a){let n=e.filter(e=>e.id!==r);m?.(n,{item:t.item,index:i,items:n})}h?.(t)}},t.id))]})}),X&&z.canScrollUp?(0,eb.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,X&&z.canScrollDown?(0,eb.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 QI({item:e,index:t,count:n,expanded:r,active:i,top:a,expansionDirection:o,labels:l,onHover:s,onDuplicate:c,onDragOver:d,onDragStart:u,onDragEnd:f}){let h=Math.min(t,9),p="down-left"===o?-(4.5*h):[-4,2,-1,4][h]??0,m=r?i?n+20:n-t:n+t;return(0,eb.jsx)("article",{"data-slot":"clipboard-stack-card",draggable:!e.disabled,"aria-disabled":e.disabled,className:tK("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&&!i&&"max-h-11",e.disabled&&"cursor-not-allowed opacity-50"),style:{top:r?a??44*t:"down-left"===o?0:9*h,zIndex:m,maxHeight:r&&i?e.expandedHeight??220:void 0,transformOrigin:"down-left"===o?"calc(100% - 34px) 14px":"100% 0",transform:r?i?"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:d,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);u?.({item:e,nativeEvent:t})},onDragEnd:function(t){f?.({item:e,nativeEvent:t})},children:(0,eb.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[(0,eb.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,eb.jsx)(QA,{className:"size-4"})}),(0,eb.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,eb.jsx)("p",{className:"truncate text-sm font-medium",children:e.title}),e.meta?(0,eb.jsx)("span",{className:"ml-auto shrink-0 text-xs tabular-nums text-muted-foreground",children:e.meta}):null]}),e.description?(0,eb.jsx)("p",{className:tK("mt-0.5 text-xs leading-5 text-muted-foreground transition-[max-height,opacity,transform] duration-200",i?"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,eb.jsx)("div",{className:tK("mt-2 text-xs text-muted-foreground transition-[max-height,opacity,transform] duration-200",i?"max-h-80 translate-y-0 opacity-100":"max-h-0 -translate-y-1 overflow-hidden opacity-0"),children:e.content}):null]}),(0,eb.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,eb.jsx)(HY,{className:"size-3.5"})})]})})}function QD({transfers:e}){let t=e.slice(0,10);if(0===t.length)return null;let n=t.map(e=>{var t,n,r;let i,a,o;return{id:e.id,title:(i="copy"===(t=e).mode?"复制":"移动",a=t.sources.length,o=t.sources[0],`${i} ${a>1?`${a} 项`:QR(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,eb.jsx)(WJ,{className:"size-4"}):"failed"===r.status?(0,eb.jsx)(QP,{className:"size-4"}):"running"===r.status?(0,eb.jsx)(WQ,{className:"size-4 animate-spin"}):"copy"===r.mode?(0,eb.jsx)(s0,{className:"size-4"}):(0,eb.jsx)(QO,{className:"size-4"}),expandedHeight:132,content:(0,eb.jsx)(QT,{transfer:e})}});return(0,eb.jsx)("div",{className:"pointer-events-auto fixed top-4 right-4 z-50 w-80 max-w-[calc(100vw-2rem)]",children:(0,eb.jsx)(Q_,{items:n,title:"传输",labels:{empty:"暂无传输",dragHandle:"传输任务"},expansionDirection:"down-left",maxExpandedHeight:420})})}function QT({transfer:e}){let t=Math.max(0,Math.min(100,e.progress?.percent??0));return(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsx)("div",{className:"h-1.5 overflow-hidden rounded-full bg-border",children:(0,eb.jsx)("div",{className:"h-full rounded-full bg-foreground transition-[width] duration-300",style:{width:`${t}%`}})}),(0,eb.jsxs)("div",{className:"grid gap-1 tabular-nums",children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2",children:[(0,eb.jsx)("span",{className:"truncate",children:QR(e.target.path)}),(0,eb.jsxs)("span",{children:[Math.round(t),"%"]})]}),(0,eb.jsxs)("div",{className:"flex min-w-0 items-center justify-between gap-2 text-muted-foreground",children:[(0,eb.jsxs)("span",{className:"truncate",children:[QL(e.progress.bytesDone)," /"," ",QL(e.progress.bytesTotal)]}),(0,eb.jsxs)("span",{children:[e.progress.entriesDone,"/",e.progress.entriesTotal]})]}),e.progress.currentPath?(0,eb.jsx)("div",{className:"truncate text-muted-foreground",children:QR(e.progress.currentPath)}):null]})]})}function QR(e){return e.split(/[\\/]+/).filter(Boolean).at(-1)??e}function QL(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 Q$=eN("minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);function QF({windowLayout:e,roots:t,active:n,zIndex:r,boardSize:i,onActivate:a,onClose:o,onMinimize:l,onWindowChange:s,onNavigate:c,onRootsChange:d,onCreateFolder:u,onRenameItem:f,onDeleteItems:h,onMoveItems:p}){return(0,eb.jsxs)("section",{className:tK("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:a,children:[(0,eb.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),a();let n=t.clientX,r=t.clientY;function i(t){let i=Math.max(0,e.x+t.clientX-n),a=Math.max(0,e.y+t.clientY-r);s({...e,x:i,y:a})}window.addEventListener("pointermove",i),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",e)})},children:[(0,eb.jsxs)("div",{className:"flex items-center gap-1",children:[(0,eb.jsx)(tY,{type:"button",size:"icon-sm",variant:"ghost","aria-label":"关闭窗口",onPointerDown:e=>e.stopPropagation(),onClick:o,children:(0,eb.jsx)(p6,{})}),(0,eb.jsx)(tY,{type:"button",size:"icon-sm",variant:"ghost","aria-label":"缩小到剪切板",onPointerDown:e=>e.stopPropagation(),onClick:l,children:(0,eb.jsx)(Q$,{})})]}),(0,eb.jsx)("div",{className:"truncate text-center ui-text-control",children:e.title}),(0,eb.jsx)("div",{className:"w-14"})]}),(0,eb.jsx)(bn,{roots:t,variant:"full",currentRootId:e.rootId,currentPath:e.path,draggableItems:!0,onNavigate:c,onRootsChange:e=>d(e),onCreateFolder:u,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,eb.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),a();let n=t.clientX,r=t.clientY;function o(t){let a=Math.max(420,Math.min(Math.max(420,i.width-e.x),e.w+t.clientX-n)),o=Math.max(320,e.h+t.clientY-r);s({...e,w:a,h:o})}window.addEventListener("pointermove",o),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",o),window.removeEventListener("pointerup",e)})}})]})}function QV({clipboardItems:e=[],onClipboardItemsChange:t}){var n;return n=(0,eb.jsx)(QB,{clipboardItems:e,onClipboardItemsChange:t,className:"min-h-[calc(100svh-5rem)] p-4 lg:p-6",minBoardHeight:820,actionsPlacement:"viewport"}),(0,eb.jsx)(f5,{children:n})}function QB({clipboardItems:e=[],onClipboardItemsChange:t,className:n,minBoardHeight:r=520,actionsPlacement:i="container"}){let[a,o]=f3(),[l,s]=ew.useState([]),[c,d]=ew.useState(QS),[u,f]=ew.useState(QS[0]?.id),[h,p]=ew.useState([]),[m,g]=ew.useState(!1),[v,x]=ew.useState(!1),[y,b]=ew.useState(),w=ew.useRef(QS.length),j=ew.useRef(!1),k=ew.useRef(new Set),S=ew.useCallback(async(e,t,n)=>{let r=await H_(e,n);s(n=>{var i;return i={...r,root:{...r.root,id:t,machineId:e}},n.map(e=>e.id!==i.root.id?e:QN(e.path,i.path)?{...e,children:QE(i.items)}:{...e,children:function(e,t,n,r,i){let a=function(e,t,n){let r=QM(e,n),i=QM(t,n);if(r===i)return[];let a=r.endsWith("/")?r:`${r}/`;return i.startsWith(a)?i.slice(a.length).split("/").filter(Boolean):[]}(t,n,r);if(0===a.length)return QE(i);let o="windows"===r?"\\":"/";return function e(t,n,r){let l=a[r];if(!l)return QE(i);let s=n===o?`${o}${l}`:`${n.replace(/[\\/]+$/,"")}${o}${l}`,c=t.findIndex(e=>QN(e.path,s)),d=t[c],u={...d??{id:`synthetic-${s}`,name:l,kind:"folder",path:s,children:[]},kind:"folder",children:e(d?.children??[],s,r+1)};if(c<0)return[...t,u];let f=[...t];return f[c]=u,f}(e,t,0)}(e.children,e.path,i.path,e.platform,i.items)})})},[]),C=ew.useCallback(async()=>{let e=QW((await HF()).transfers);return p(e),e},[]),N=ew.useCallback(e=>{p(t=>QW([e,...t.filter(t=>t.id!==e.id)]))},[]),M=ew.useCallback(e=>{H$({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){d(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=a.current?.getBoundingClientRect(),i=r?.width??o.width,s=r?.height??o.height,c=e?.w??680,u=e?.h??460,h=Math.max(0,(i-c)/2),p=Math.max(0,(s-u)/2),m={id:n,title:e?.title??QC(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:u};d(e=>[...e,m]),f(n),S(m.machineId,m.rootId,m.path)}return ew.useEffect(()=>{let e=!0;return(async function(){let t=await Hz();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:QC(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]);d([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]),(0,eb.jsxs)("div",{ref:a,className:tK("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=a.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,eb.jsx)("div",{className:"relative h-full min-h-0",style:{minHeight:Math.max(r,o.height-48)},children:c.map((n,r)=>(0,eb.jsx)(QF,{windowLayout:n,roots:l,active:u===n.id,zIndex:20+r+20*(u===n.id),boardSize:o,onActivate:()=>f(n.id),onClose:()=>d(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}`)]),d(e=>e.filter(e=>e.id!==n.id))},onWindowChange:e=>O(n.id,()=>e),onNavigate:({rootId:e,path:t})=>{let r=l.find(t=>t.id===e),i=r?.machineId??n.machineId;O(n.id,n=>({...n,machineId:i,rootId:e,path:t,title:QC(r?.name??i,t)})),S(i,e,t)},onRootsChange:s,onCreateFolder:(e,t)=>{HT({machineId:n.machineId,path:e.path,name:t}).then(()=>S(n.machineId,n.rootId,n.path)).catch(()=>{})},onRenameItem:(e,t)=>{HR({machineId:n.machineId,path:e.path,name:t}).then(()=>S(n.machineId,n.rootId,n.path)).catch(()=>{})},onDeleteItems:e=>{HL({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 i=l.find(t=>t.id===e);if(!i)return;let a=t.flatMap(e=>{let t=function e(t,n){for(let r of t){if(r.id===n)return r;let t=r.children?e(r.children,n):void 0;if(t)return t}}(i.children,e);return t?[{machineId:i.machineId,path:t.path,name:t.name}]:[]});if(0===a.length)return;let o={sources:a,target:{machineId:n.machineId,path:r.path,name:r.name}};v?M(o):b(o)}},n.id))}),(0,eb.jsx)(QD,{transfers:h}),(0,eb.jsx)(Qk,{open:m,placement:i,movePermissionGranted:v,onOpenChange:g,onMovePermissionGrantedChange:x,onAdd:()=>{g(!1),P()}}),(0,eb.jsx)(QH,{move:y,onCancel:()=>b(void 0),onConfirm:e=>{b(void 0),M(e)}})]})}function QH({move:e,onCancel:t,onConfirm:n}){var r;let i=e?.sources??[],a=Math.max(0,i.length-4);return(0,eb.jsx)(m8,{open:void 0!==e,onOpenChange:e=>{e||t()},children:(0,eb.jsxs)(gm,{children:[(0,eb.jsxs)(gg,{children:[(0,eb.jsx)(gx,{children:"确认移动"}),(0,eb.jsx)(gy,{children:e?`将 ${1===(r=i).length?r[0]?Qq(r[0]):"0 项":`${r.length} 项`} 移动到 ${Qq(e.target)}`:""})]}),e?(0,eb.jsxs)("div",{className:"grid gap-2 rounded-lg border bg-muted/20 p-3 ui-text-body",children:[(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"text-muted-foreground ui-text-kbd",children:"移动内容"}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[i.slice(0,4).map(e=>(0,eb.jsx)("span",{className:"truncate",children:Qq(e)},`${e.machineId}:${e.path}`)),a>0?(0,eb.jsxs)("span",{className:"text-muted-foreground",children:["另有 ",a," 项"]}):null]})]}),(0,eb.jsxs)("div",{className:"grid gap-1",children:[(0,eb.jsx)("span",{className:"text-muted-foreground ui-text-kbd",children:"目标位置"}),(0,eb.jsx)("span",{className:"truncate",children:Qq(e.target)})]})]}):null,(0,eb.jsxs)(gv,{children:[(0,eb.jsx)(gw,{children:"取消"}),(0,eb.jsx)(gb,{onClick:()=>{e&&n(e)},children:"确认移动"})]})]})})}function QW(e){return e.slice(0,10)}function Qq(e){let t=e.path.replace(/\\/g,"/");return`${e.machineId} / ${e.name||t}`}function QU({className:e}){return(0,eb.jsx)(QB,{className:tK("h-full min-h-0 w-full rounded-[inherit] border-0 shadow-none",e),minBoardHeight:360,actionsPlacement:"container"})}var QK=["type"],QG=["dangerouslySetInnerHTML","ticks","scale"],QY=["id","scale"];function QX(){return(QX=Object.assign.bind()).apply(null,arguments)}function QZ(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 QJ(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?QZ(Object(n),!0).forEach(function(t){var r,i,a;r=e,i=t,a=n[t],(i=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+""}(i))in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):QZ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function QQ(e,t){if(null==e)return{};var n,r,i=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 a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)n=a[r],-1===t.indexOf(n)&&({}).propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function Q0(e){var t=ww(),n=(0,ew.useRef)(null),r=SR(),{type:i}=e,a=QQ(e,QK),o=Cz(r,"yAxis",i),l=(0,ew.useMemo)(()=>{if(null!=o)return QJ(QJ({},a),{},{type:o})},[o,a]);return(0,ew.useLayoutEffect)(()=>{null!=l&&(null===n.current?t(Ip(l)):n.current!==l&&t(Im({prev:n.current,next:l})),n.current=l)},[l,t]),(0,ew.useLayoutEffect)(()=>()=>{n.current&&(t(Ig(n.current)),n.current=null)},[t]),null}function Q1(e){var{yAxisId:t,className:n,width:r,label:i}=e,a=(0,ew.useRef)(null),o=(0,ew.useRef)(null),l=wC(Sc),s=Su(),c=ww(),d="yAxis",u=wC(e=>zH(e,t)),f=wC(e=>zB(e,t)),h=wC(e=>zG(e,d,t,s)),p=wC(e=>Ap(e,t));if((0,ew.useLayoutEffect)(()=>{if(!("auto"!==r||!u||NG(i)||(0,ew.isValidElement)(i))&&null!=p){var e=a.current;if(e){var n=e.getCalculatedWidth();Math.round(u.width)!==Math.round(n)&&c(Ib({id:t,width:n}))}}},[h,u,c,i,t,r,p]),null==u||null==f||null==p)return null;var{dangerouslySetInnerHTML:m,ticks:g,scale:v}=e,x=QQ(e,QG),{id:y,scale:b}=p,w=QQ(p,QY);return ew.createElement(Lw,QX({},x,w,{ref:a,labelRef:o,x:f.x,y:f.y,tickTextProps:"auto"===r?{width:void 0}:{width:r},width:u.width,height:u.height,className:eH("recharts-".concat(d," ").concat(d),n),viewBox:l,ticks:h,axisType:d,axisId:t}))}var Q2={allowDataOverflow:Ah.allowDataOverflow,allowDecimals:Ah.allowDecimals,allowDuplicatedCategory:Ah.allowDuplicatedCategory,angle:Ah.angle,axisLine:Lm.axisLine,hide:!1,includeHidden:Ah.includeHidden,interval:Ah.interval,label:!1,minTickGap:Ah.minTickGap,mirror:Ah.mirror,orientation:Ah.orientation,padding:Ah.padding,reversed:Ah.reversed,scale:Ah.scale,tick:Ah.tick,tickCount:Ah.tickCount,tickLine:Lm.tickLine,tickSize:Lm.tickSize,type:Ah.type,niceTicks:Ah.niceTicks,width:Ah.width,yAxisId:0},Q5=ew.memo(e=>{var t=Cs(e,Q2);return ew.createElement(ew.Fragment,null,ew.createElement(Q0,{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(Q1,t))},LW);function Q4({machines:e,defaultMachineId:t,className:n,...r}){let[i,a]=ew.useState(t??e[0]?.id),o=e.find(e=>e.id===i)??e[0],[l,s]=ew.useState({});if(!o)return null;let c=l[o.id]??o.selectedMetricId??o.metrics[0]?.id,d=o.metrics.find(e=>e.id===c)??o.metrics[0];return(0,eb.jsxs)("div",{className:tK("vtl-surface-card flex h-full min-h-0 flex-col rounded-[var(--surface-card-radius)] border","vtl-performance-monitor",n),...r,children:[(0,eb.jsx)(qg,{value:o.id,onValueChange:a,className:"shrink-0 px-3 pt-3",children:(0,eb.jsx)(qC,{className:"h-8",children:e.map(e=>(0,eb.jsx)(qN,{value:e.id,children:e.name},e.id))})}),(0,eb.jsxs)("div",{className:"mt-3 grid min-h-0 flex-1 grid-cols-[14rem_minmax(0,1fr)] border-t",children:[(0,eb.jsx)("div",{className:"min-h-0 overflow-auto border-r p-2",children:o.metrics.map(e=>(0,eb.jsxs)("button",{type:"button",onClick:()=>s(t=>({...t,[o.id]:e.id})),className:tK("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,eb.jsx)(eee,{data:e.data,color:e.color}),(0,eb.jsxs)("span",{className:"min-w-0",children:[(0,eb.jsx)("span",{className:"block truncate text-base leading-tight",children:e.label}),(0,eb.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.value}),e.detail?(0,eb.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.detail}):null]})]},e.id))}),(0,eb.jsxs)("div",{className:"min-h-0 overflow-auto p-5",children:[(0,eb.jsxs)("div",{className:"grid grid-cols-[minmax(0,1fr)_auto] items-start gap-5",children:[(0,eb.jsxs)("div",{children:[(0,eb.jsx)("h2",{className:"text-4xl leading-none font-semibold tracking-normal",children:d?.title}),d?.subtitle?(0,eb.jsx)("p",{className:"mt-1 text-base text-muted-foreground",children:d.subtitle}):null]}),(0,eb.jsx)("div",{className:"text-right text-sm text-muted-foreground",children:d?.detail})]}),d?(0,eb.jsx)(Q3,{metric:d}):null]})]})]})}function Q3({metric:e}){return"cpu"===e.kind?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(Q6,{panel:{id:"cpu",title:"% 利用率",value:"100%",data:e.data,span:"full"},size:"large"}),(0,eb.jsx)(Q8,{}),(0,eb.jsx)(Q9,{details:e.details,columns:4})]}):"memory"===e.kind?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(Q6,{panel:{id:"memory",title:"内存使用量",value:e.detail,data:e.data,span:"full"},size:"large"}),(0,eb.jsx)(Q8,{}),(0,eb.jsx)(Q7,{segments:e.composition}),(0,eb.jsx)(Q9,{details:e.details,columns:3})]}):"disk"===e.kind?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(Q6,{panel:{id:"disk-active",title:"活动时间",value:"100%",data:e.data,span:"full"},size:"large"}),(0,eb.jsx)(Q8,{}),(0,eb.jsx)(Q6,{panel:{id:"disk-rate",title:"磁盘传输速率",value:"500 KB/秒",data:e.panels?.[0]?.data??e.data,span:"full"},size:"short"}),(0,eb.jsx)(Q8,{}),(0,eb.jsx)(Q9,{details:e.details,columns:4})]}):"network"===e.kind?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(Q6,{panel:{id:"network",title:"吞吐量",value:"100 Kbps",data:e.data,span:"full",color:"danger"},size:"tall"}),(0,eb.jsx)(Q8,{}),(0,eb.jsx)(Q9,{details:e.details,columns:2})]}):(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("div",{className:"mt-5 grid grid-cols-2 gap-3",children:(e.panels??[]).map(e=>(0,eb.jsx)(Q6,{panel:e},e.id))}),(0,eb.jsx)(Q9,{details:e.details,columns:3})]})}function Q6({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,eb.jsxs)("div",{className:tK("mt-5","full"===e.span&&"col-span-2"),children:[(0,eb.jsxs)("div",{className:"mb-1 flex items-center justify-between text-sm",children:[(0,eb.jsx)("span",{className:"text-muted-foreground",children:e.title}),e.value?(0,eb.jsx)("span",{className:"text-muted-foreground tabular-nums",children:e.value}):null]}),(0,eb.jsx)(eet,{data:e.data,color:e.color,className:tK("w-full",n)})]})}function Q8(){return(0,eb.jsxs)("div",{className:"mt-1 flex justify-between text-xs text-muted-foreground",children:[(0,eb.jsx)("span",{children:"60 秒"}),(0,eb.jsx)("span",{children:"0"})]})}function Q7({segments:e}){let t=e&&e.length>0?e:[{label:"used",value:64},{label:"available",value:36}];return(0,eb.jsxs)("div",{className:"mt-5",children:[(0,eb.jsx)("div",{className:"mb-1 text-sm text-muted-foreground",children:"内存组合"}),(0,eb.jsx)("div",{className:"flex h-[3.25rem] w-full overflow-hidden border border-primary/75 bg-background",children:t.map((e,n)=>(0,eb.jsx)("div",{className:tK("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 Q9({details:e,columns:t}){return e?.length?(0,eb.jsx)("div",{className:tK("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,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("div",{className:"text-xs text-muted-foreground",children:e}),(0,eb.jsx)("div",{className:"truncate text-2xl leading-tight tabular-nums",children:t})]},e))}):null}function eee({data:e,color:t}){return(0,eb.jsx)(eet,{data:e,color:t,className:"h-10 w-full",strokeWidth:1.4,compact:!0})}function eet({data:e,color:t="default",className:n,strokeWidth:r=1.6,compact:i=!1}){let a=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,eb.jsx)(Fb,{config:o,className:tK("aspect-auto border bg-background text-muted-foreground",n),initialDimension:{width:i?96:640,height:i?40:220},children:(0,eb.jsxs)(Lr,{data:a,margin:{top:i?2:6,right:0,bottom:0,left:0},children:[i?null:(0,eb.jsx)(L$,{strokeDasharray:"0",stroke:"var(--border)",strokeOpacity:.7}),(0,eb.jsx)(L1,{dataKey:"index",hide:!0,domain:["dataMin","dataMax"]}),(0,eb.jsx)(Q5,{hide:!0,domain:[0,100]}),i?null:(0,eb.jsx)(Fj,{cursor:!1,content:(0,eb.jsx)(Fk,{hideLabel:!0,indicator:"line"})}),(0,eb.jsx)(Tl,{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})]})})}Q5.displayName="YAxis";let een=eN("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"}]]),eer=eN("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"}]]),eei={name:"名称",cpu:"CPU",memoryMb:"内存",diskMbps:"磁盘",networkMbps:"网络"};function eea({machines:e,defaultMachineId:t,className:n,...r}){let[i,a]=ew.useState(t??e[0]?.id),[o,l]=ew.useState("cpu"),[s,c]=ew.useState("desc"),[d,u]=ew.useState({}),f=e.find(e=>e.id===i)??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 i of e){var r;let e=function e(t,n,r=new Set){void 0!==t.pid&&r.add(t.pid);let i=void 0!==t.parentPid?n.get(t.parentPid):void 0;return!i||void 0===i.pid||r.has(i.pid)||["bash","containerd","dockerd","explorer","init","kernel_task","launchd","services","sh","smss","svchost","system","systemd","wininit","winlogon","zsh"].includes(eeu(i))?t:e(i,n,r)}(i,n),a=eeu(e),o=t.get(a)??{kind:"group",id:a,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(i),o.cpu+=i.cpu,o.memoryMb+=i.memoryMb,o.diskMbps+=i.diskMbps,o.networkMbps+=i.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,i.status),t.set(a,o)}return Array.from(t.values()).map(e=>({...e,cpu:eeh(Math.min(100,e.cpu)),memoryMb:eeh(e.memoryMb),diskMbps:eeh(e.diskMbps),networkMbps:eeh(e.networkMbps)}))}(f.processes)].sort((e,t)=>eef(e,t,o,s)),t=[];for(let n of e){if(n.children.length<=1){let e=n.children[0];e&&t.push(eed(e,0));continue}if(t.push(n),d[n.id])for(let e of[...n.children].sort((e,t)=>eef(e,t,o,s)))t.push(eed(e,1))}return t},[f,d,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,eb.jsxs)("div",{className:tK("vtl-surface-card flex h-full min-h-0 flex-col rounded-[var(--surface-card-radius)] border","vtl-process-monitor",n),...r,children:[(0,eb.jsx)(qg,{value:f.id,onValueChange:a,className:"shrink-0 px-3 pt-3",children:(0,eb.jsx)(qC,{className:"h-8",children:e.map(e=>(0,eb.jsx)(qN,{value:e.id,children:e.name},e.id))})}),(0,eb.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,eb.jsxs)("button",{type:"button",onClick:()=>m("name"),className:"flex items-end px-3 pb-2 text-left text-muted-foreground",children:["名称",(0,eb.jsx)(eeo,{active:"name"===o,direction:s})]}),(0,eb.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,eb.jsxs)("button",{type:"button",onClick:()=>m(e),className:"grid content-end border-l px-3 pb-2 text-right",children:[(0,eb.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,eb.jsxs)("span",{className:"mt-1 text-xs text-muted-foreground",children:[eei[e],(0,eb.jsx)(eeo,{active:o===e,direction:s,className:"ml-1 inline-flex"})]})]},e)})]}),(0,eb.jsx)("div",{className:"vtl-scrollbar-hidden min-h-0 flex-1 overflow-auto",children:h.map(e=>{var t;return(0,eb.jsxs)("div",{className:tK("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,eb.jsx)(eel,{row:e,expanded:"group"===e.kind&&!!d[e.id],onToggle:()=>{"group"===e.kind&&u(t=>({...t,[e.id]:!t[e.id]}))}}),(0,eb.jsx)(ees,{platform:f.platform,status:e.status}),(0,eb.jsx)(eec,{value:e.cpu,max:100,label:`${e.cpu.toFixed(1)}%`}),(0,eb.jsx)(eec,{value:e.memoryMb,max:eep(p,"memoryMb"),label:(t=e.memoryMb)>=1024?`${eem(t/1024)} GB`:`${eem(t)} MB`}),(0,eb.jsx)(eec,{value:e.diskMbps,max:Math.max(1,eep(p,"diskMbps")),label:`${eem(e.diskMbps)} MB/秒`}),(0,eb.jsx)(eec,{value:e.networkMbps,max:Math.max(1,eep(p,"networkMbps")),label:`${eem(e.networkMbps)} Mbps`})]},`${e.kind}-${e.id}`)})})]}):null}function eeo({active:e,direction:t,className:n}){return e?(0,eb.jsx)("asc"===t?q_:G$,{className:tK("ml-1 size-3",n)}):null}function eel({row:e,expanded:t,onToggle:n}){if("group"===e.kind){let r=t?cE:vo;return(0,eb.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,eb.jsx)(r,{className:"size-4 shrink-0 text-muted-foreground"}),(0,eb.jsx)("span",{className:"size-2 rounded-sm bg-foreground/65"}),(0,eb.jsxs)("span",{className:"min-w-0 truncate font-medium",children:[e.name," (",e.children.length,")"]})]})}return(0,eb.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,eb.jsx)("span",{className:"size-1.5 rounded-full bg-muted-foreground/70"}):(0,eb.jsx)("span",{className:"size-1.5 rounded-full bg-foreground/65"}),(0,eb.jsx)("span",{className:tK("truncate",0===e.depth&&"font-medium"),children:e.name}),e.process.pid?(0,eb.jsx)("span",{className:"shrink-0 ui-text-kbd text-muted-foreground",children:e.process.pid}):null]})}function ees({platform:e,status:t}){return t?.length?(0,eb.jsxs)("div",{className:"flex items-center gap-1.5 px-3 text-muted-foreground",children:[t.includes("suspended")?(0,eb.jsx)(eer,{"aria-label":"linux"===e?"挂起进程":"挂起",className:"size-4"}):null,t.includes("auto-restart")?(0,eb.jsx)(s9,{"aria-label":"linux"===e?"自动重启进程":"自动重启",className:"size-4"}):null,t.includes("running")?(0,eb.jsx)(een,{"aria-label":"运行",className:"size-4 text-primary"}):null]}):(0,eb.jsx)("div",{className:"px-3"})}function eec({value:e,max:t,label:n}){let r=Math.min(1,Math.max(0,e/Math.max(1,t))),i=r>.78,a=i?`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,eb.jsx)("div",{className:"vtl-process-heat-cell h-full border-l px-3 text-right tabular-nums","data-hot":i?"":void 0,style:{background:a},children:(0,eb.jsx)("span",{className:tK("leading-9",i&&"text-destructive"),children:n})})}function eed(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 eeu(e){return e.appId?.trim().toLowerCase()||e.appName?.trim().toLowerCase()||e.name.trim().toLowerCase().replace(/\.(exe|com)$/i,"")||e.id}function eef(e,t,n,r){let i="asc"===r?1:-1;return"name"===n?e.name.localeCompare(t.name)*i:(e[n]-t[n])*i}function eeh(e){return Math.round(10*e)/10}function eep(e,t){return e.reduce((e,n)=>Math.max(e,n[t]),0)}function eem(e){return new Intl.NumberFormat("zh-CN",{maximumFractionDigits:+(e<10)}).format(e)}function eeg({className:e}){let t=eex("/api/local/machines/processes");return(0,eb.jsx)(eea,{machines:t,className:tK("h-full min-h-0 w-full",e)})}function eev({className:e}){let t=eex("/api/local/machines/performance");return(0,eb.jsx)(Q4,{machines:t,className:tK("h-full min-h-0 w-full",e)})}function eex(e){let[t,n]=ew.useState([]);return ew.useEffect(()=>{let t=!0,r=!1;async function i(){if(!r){r=!0;try{let r=await fetch(e,{cache:"no-store"});if(!r.ok)return;let i=await r.json();t&&n(i.machines)}catch{t&&n([])}finally{r=!1}}}i();let a=window.setInterval(i,2e3);return()=>{t=!1,window.clearInterval(a)}},[e]),t}let eey=eN("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]),eeb=eN("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"}]]),eew={loading:"Starting terminal...",newTerminal:"New terminal",closeTerminal:e=>`Close ${e}`,terminalList:"Terminal sessions",status:{idle:"Idle",running:"Running",success:"Succeeded",error:"Failed"}},eej=[{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 eek(e,t,n){return e.getPropertyValue(t).trim()||n}function eeS(e,t=!1){let n=getComputedStyle(e),r=eek(n,"--foreground","#18181b"),i=eek(n,"--terminal-background",eek(n,"--background","#ffffff")),a="transparent"===i?eek(n,"--background","#ffffff"):i,o=eek(n,"--muted-foreground","#71717a"),l=eek(n,"--border","#e4e4e7"),s=eek(n,"--selection","#18181b");return{background:i,foreground:r,cursor:t?"transparent":r,cursorAccent:t?"transparent":a,selectionBackground:`color-mix(in oklch, ${s} 18%, transparent)`,selectionForeground:eek(n,"--selection-foreground","#ffffff"),scrollbarSliderBackground:`color-mix(in oklch, ${l} 78%, transparent)`,scrollbarSliderHoverBackground:l,black:r,red:eek(n,"--terminal-red","#bf616a"),green:eek(n,"--terminal-green","#5e8c61"),yellow:eek(n,"--terminal-yellow","#b06f3c"),blue:eek(n,"--terminal-blue","#5e81ac"),magenta:eek(n,"--terminal-magenta","#b48ead"),cyan:eek(n,"--terminal-cyan","#4c8da8"),white:i,brightBlack:o,brightRed:eek(n,"--terminal-bright-red","#d06f79"),brightGreen:eek(n,"--terminal-bright-green","#6b9a70"),brightYellow:eek(n,"--terminal-bright-yellow","#c2824b"),brightBlue:eek(n,"--terminal-bright-blue","#6f91ba"),brightMagenta:eek(n,"--terminal-bright-magenta","#c19ac0"),brightCyan:eek(n,"--terminal-bright-cyan","#5aa0b8"),brightWhite:r}}function eeC(e){return void 0===e?[]:Array.isArray(e)?e:[e]}function eeN({initialOutput:t,data:n,dataKey:r,options:i,readOnly:a=!1,autoFocus:o=!1,localEcho:l=!1,onData:s,onResize:c,onReady:d,labels:u,className:f,terminalClassName:h,...p}){let m=ew.useMemo(()=>({loading:eew.loading,...u}),[u]),g=ew.useRef(null),v=ew.useRef(null),x=ew.useRef(void 0),y=ew.useRef(s),b=ew.useRef(c),w=ew.useRef(d),j=ew.useRef(i),k=ew.useRef(a),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=d,j.current=i,k.current=a,S.current=l},[l,s,d,c,i,a]),ew.useEffect(()=>{let n,r=!1,i=[];!async function(){var a;let l,s,c,d,u;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(a=g.current),u=(c=eek(l,"--font-family-mono",s='"Cascadia Mono", "Cascadia Code", Consolas, "SFMono-Regular", "Liberation Mono", monospace'),d=getComputedStyle(a),c.replace(/var\((--[a-zA-Z0-9-_]+)(?:,[^)]+)?\)/g,(e,t)=>d.getPropertyValue(t).trim()||"")).trim(),`"Cascadia Mono", "Cascadia Code", Consolas, ${u||s}`),fontSize:13,letterSpacing:0,lineHeight:1.25,macOptionIsMeta:!0,minimumContrastRatio:4.5,scrollback:5e3,theme:eeS(g.current),...j.current,allowTransparency:!0}),E=new h,P=new p,A=new m;function z(){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(z),(n=new ResizeObserver(z)).observe(g.current),i.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))})),eeC(t)))N.write(e);w.current?.({terminal:N,fitAddon:E,searchAddon:P,webLinksAddon:A,fit:z,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=eeS(t,e))},write:(e,t)=>N.write(e,t),writeln:e=>N.writeln(e)}),o&&N.focus()}();let a=new MutationObserver(()=>{let e=v.current,t=g.current;e&&t&&(e.options.theme=eeS(t,C.current))});return a.observe(document.documentElement,{attributeFilter:["class","style"],attributes:!0}),()=>{for(let e of(r=!0,a.disconnect(),n?.disconnect(),i))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,eeC(n)))e.write(t)},[n,r]),(0,eb.jsxs)("div",{"data-slot":"terminal-tab-surface",className:tK("relative size-full min-h-0 overflow-hidden bg-background text-foreground",f),...p,children:[(0,eb.jsx)("div",{ref:g,className:tK("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,eb.jsx)("div",{className:"pointer-events-none absolute inset-0 grid place-items-center text-muted-foreground ui-text-code",children:m.loading})]})}function eeM({status:e="idle"}){return"running"===e?(0,eb.jsx)(eeb,{className:"size-3.5 text-foreground"}):"success"===e?(0,eb.jsx)(WJ,{className:"size-3.5 text-foreground"}):"error"===e?(0,eb.jsx)(eey,{className:"size-3.5 text-destructive"}):(0,eb.jsx)(yt,{className:"size-3.5 text-muted-foreground"})}function eeE({sessions:e,defaultSessions:t=eej,activeSessionId:n,defaultActiveSessionId:r,onActiveSessionChange:i,onSessionsChange:a,onCreateSession:o,onCloseSession:l,onSessionData:s,onSessionResize:c,onSessionReady:d,showTabs:u=!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(()=>({...eew,...g,status:{...eew.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),a?.(t)}function A(e){e.disabled||(void 0===n&&M(e.id),i?.(e.id,e))}return(0,eb.jsxs)("div",{"data-slot":"terminal-tab-group",className:tK("vtl-surface-panel grid min-h-0 overflow-hidden rounded-[var(--surface-panel-radius)] border",u?"grid-rows-[auto_minmax(0,1fr)]":"grid-rows-[minmax(0,1fr)]",v),...b,children:[u&&(0,eb.jsxs)("div",{"data-slot":"terminal-tab-list",role:"tablist","aria-label":w.terminalList,className:tK("flex min-w-0 items-center gap-1 border-b bg-muted/35 px-2 py-1.5",x),children:[(0,eb.jsx)(mH,{className:"ml-1 size-4 shrink-0 text-muted-foreground"}),(0,eb.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,eb.jsxs)("div",{className:tK("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,eb.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,eb.jsx)(eeM,{status:e.status}),(0,eb.jsx)("span",{className:"max-w-36 truncate",children:e.title}),e.shell&&(0,eb.jsx)("span",{className:"hidden text-muted-foreground ui-text-kbd sm:inline",children:e.shell})]}),e.closable&&(0,eb.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,eb.jsx)(p6,{className:"size-3"})})]},e.id)})}),f&&(0,eb.jsx)(tY,{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,eb.jsx)(s7,{className:"size-3.5"})})]}),(0,eb.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,eb.jsx)("div",{id:`terminal-panel-${e.id}`,role:"tabpanel","aria-hidden":!t,"data-active":t,className:tK("absolute inset-0 min-h-0",t?"z-10 opacity-100":"z-0 opacity-0"),children:(0,eb.jsx)(eeN,{initialOutput:e.initialOutput,options:{...m,...e.options},readOnly:h||e.disabled,localEcho:p,autoFocus:t,onData:t=>s?.(e.id,t),onResize:t=>c?.(e.id,t),onReady:t=>d?.(e.id,t),labels:w,terminalClassName:y})},e.id)})})]})}function eeO({className:e,scopeId:t,state:n,onStateChange:r}){let[i,a]=ew.useState([]),[o,l]=ew.useState([]),[s,c]=ew.useState(),[d,u]=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,z=A??"__unscoped__";ew.useEffect(()=>{E.current=n},[n]),ew.useEffect(()=>{O.current=r},[r]);let _=i.find(e=>e.id===d)??i[0],I=_?.shells.find(e=>e.id===f)??_?.shells[0],D=ew.useMemo(()=>o.map(e=>e.id),[o]),T=D.join("\0"),R=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)},[]),L=ew.useCallback(e=>{let t=j.current.get(e);void 0!==t&&window.clearTimeout(t);let n=window.setTimeout(()=>{j.current.delete(e),R(e,!1)},90);j.current.set(e,n)},[R]),$=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),L(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,R(e,!0);try{n.write(r,()=>{(t.writing=!1,y.current.has(e))?t.buffer?t.drainTimer=window.setTimeout(()=>$(e),0):(w.current.delete(e),L(e)):w.current.delete(e)})}catch{t.writing=!1,w.current.delete(e),L(e)}},[L,R]),F=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,R(e,!0),n.buffer.length>=65536)?$(e):n.writing||void 0!==n.drainTimer||(n.drainTimer=window.setTimeout(()=>$(e),8))},[$,R]),V=ew.useCallback((e,t)=>{(k.current.set(e,t.sequence),"output"===t.type&&t.data)?F(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))},[F]),B=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`/api/local/terminals/sessions/${encodeURIComponent(e)}/events${r?`?${r}`:""}`}(e,k.current.get(e)??0));t.onmessage=t=>{try{V(e,JSON.parse(t.data))}catch{return}},x.current.set(e,t)},[V]),H=ew.useCallback(async()=>{if(_&&!p){M.current=!1,m(!0);try{let e=await HW({machineId:_.id,scopeId:A,shell:I?.id,cwd:_.defaultCwd,cols:100,rows:30});l(t=>t.some(t=>t.id===e.id)?t:[...t,e]),c(e.id),B(e.id)}catch{return}finally{m(!1)}}},[p,B,_,I,A]);function W(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,[i,o]=await Promise.all([HB(),HH(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,a(i.machines),l(s),c(e=>{let n=t?.activeSessionId??e;return n&&s.some(e=>e.id===n)?n:s[0]?.id});let d=i.machines[0];if(d){let e=i.machines.find(e=>e.id===t?.selectedMachineId)??d;u(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,z]),ew.useEffect(()=>{g&&O.current?.({sessionIds:D,activeSessionId:s,selectedMachineId:d,selectedShellId:f,autoStart:!M.current})},[s,g,d,f,D,T]),ew.useEffect(()=>{let e=new Set(D);for(let e of o)B(e.id);for(let[t,n]of x.current)e.has(t)||(n.close(),x.current.delete(t))},[B,D,o]),ew.useEffect(()=>{!g||N.current||M.current||o.length>0||0===i.length||(N.current=!0,H())},[H,g,i.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),R(e,!1);S.current.clear(),w.current.clear(),j.current.clear()},[R]),(0,eb.jsxs)("div",{className:tK("grid h-full min-h-0 w-full grid-rows-[auto_minmax(0,1fr)] overflow-hidden rounded-[inherit] border bg-card",e),children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-1.5 border-b bg-muted/35 px-2 py-1.5",children:[(0,eb.jsxs)(Jy,{value:_?.id,onValueChange:e=>{u(e);let t=i.find(t=>t.id===e);h(t?.shells[0]?.id)},children:[(0,eb.jsxs)(J6,{size:"sm",className:"max-w-44",children:[(0,eb.jsx)(vw,{className:"size-3.5"}),(0,eb.jsx)(Jk,{placeholder:"机器"})]}),(0,eb.jsx)(J9,{align:"start",children:i.map(e=>(0,eb.jsx)(Qe,{value:e.id,children:e.name},e.id))})]}),(0,eb.jsxs)(Jy,{value:I?.id,onValueChange:h,children:[(0,eb.jsx)(J6,{size:"sm",className:"max-w-44",children:(0,eb.jsx)(Jk,{placeholder:"Shell"})}),(0,eb.jsx)(J9,{align:"start",children:_?.shells.map(e=>(0,eb.jsx)(Qe,{value:e.id,children:e.name},e.id))})]}),(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"新建终端",disabled:!_||p,onClick:()=>void H(),className:"ml-auto",children:(0,eb.jsx)(s7,{className:"size-4"})})]}),(0,eb.jsx)(eeE,{sessions:o.map(eeP),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}),Hq(e).catch(()=>{}))},onSessionData:function(e,t){let n=W(e);n.buffer+=t,function e(t){let n=W(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,HU(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),HK(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),F(e,n))},className:"min-h-0 rounded-none border-0"})]})}function eeP(e){return{id:e.id,title:e.title,shell:e.machineName,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:""}}function eeA(e,t={}){let n="h-full min-h-0 w-full overflow-hidden rounded-[inherit]";switch(e.kind){case"file-tab-viewer":{let r=HA("file-tab-viewer"),i=e.file;if(!i&&t.onRequestFileTab)return(0,eb.jsx)(Kz,{className:n,onChooseFile:t.onRequestFileTab});return(0,eb.jsx)(ZZ,{className:`${n} border-0`,file:i??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,labels:{review:"审阅",edit:"编辑",view:"视图",code:"代码",preview:"预览",hex:"十六进制",actions:"文件菜单",save:"保存",saving:"保存中"}})}case"browser-tab-viewer":return(0,eb.jsx)(KU,{className:`${n} border-0`,defaultUrl:e.defaultUrl??HA("browser-tab-viewer").defaultUrl});case"diff-tab-viewer":{let t=HA("diff-tab-viewer");return(0,eb.jsx)(G5,{className:`${n} border-0`,file:e.file??t.file,diff:e.diff??t.diff??""})}case"data-table-tab-viewer":{let r=HA("data-table-tab-viewer"),i=e.file;if(!i&&t.onRequestFileTab)return(0,eb.jsx)(Kz,{className:n,onChooseFile:t.onRequestFileTab});return(0,eb.jsx)(Gq,{className:`${n} border-0`,file:{name:i?.name??r.file?.name??"data",path:i?.path??r.file?.path,type:eez(e)},source:void 0!==e.defaultValue?{type:eez(e),content:e.defaultValue}:void 0,data:e.tableData??r.tableData??[]})}case"terminal-tab-group":return(0,eb.jsx)(eeO,{className:`${n} border-0`,scopeId:t.terminalScopeId,state:e.terminal??t.terminalState,onStateChange:t.onTerminalStateChange})}}function eez(e){return`${e.file?.mimeType??""} ${e.file?.path??e.file?.name??""}`.toLowerCase().includes("json")?"json":"csv"}function ee_(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,eb.jsx)(Z1,{className:n,contentClassName:"min-h-0",tabs:r.map(n=>({id:n.id,title:n.title,meta:n.meta,modified:n.modified,icon:HP(n.kind),content:eeA(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})})),activeTabId:t.activeTabId,detachable:!0,externalDropTypes:[fr],createLabel:"打开文件",emptyContent:(0,eb.jsx)(Kz,{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 i=n.map(e=>r.find(t=>t.id===e.id)).filter(e=>!!e);t.onTabsChange?.(e,i)},onTabDetach:(n,i)=>{if(!e)return!1;let a=r.find(e=>e.id===n.id);return!!a&&t.onTabDetach?.(e,a,{clientX:i.clientX,clientY:i.clientY})},onExternalTabDrop:({insertIndex:n,nativeEvent:r})=>{e&&t.onExternalTabDrop?.(e,n,r)}})}case"file-tree-panel":if(t.workspaceFolders)return(0,eb.jsx)(KP,{folders:t.workspaceFolders,className:`${n} max-w-none`,onOpenFile:t.onOpenWorkspaceFile});return(0,eb.jsx)(Qy,{className:`${n} max-w-none`,onOpenFile:t.onOpenWorkspaceFile});case"process-management":return(0,eb.jsx)(eeg,{className:`${n} rounded-[inherit] border-0`});case"machine-performance":return(0,eb.jsx)(eev,{className:`${n} rounded-[inherit] border-0`});case"firewall-policy-workspace":return(0,eb.jsx)("div",{className:`${n} bg-card`,children:(0,eb.jsx)(Qg,{})});case"machine-file-management":return(0,eb.jsx)(QU,{className:`${n} bg-card`});case"agent-conversation-panel":return(0,eb.jsx)(U9,{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 eeA(t.tab??HA(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})}}function eeI({kind:e,...t}){return ee_(e,t)}let eeD="application/vnd.vantaloom.agent-pane-shredder",eeT="application/vnd.vantaloom.agent-pane-cutter",eeR=[{id:"quad",label:"四分",slots:4,icon:(0,eb.jsx)(vb,{})},{id:"vertical-split",label:"上下二分",slots:2,icon:(0,eb.jsx)(KT,{})},{id:"horizontal-split",label:"左右二分",slots:2,icon:(0,eb.jsx)(K_,{})},{id:"left-two-right-one",label:"左二右一",slots:3,icon:(0,eb.jsx)(nw,{})},{id:"left-one-right-two",label:"左一右二",slots:3,icon:(0,eb.jsx)(Hp,{})},{id:"top-two-bottom-one",label:"上二下一",slots:3,icon:(0,eb.jsx)(KT,{})},{id:"top-one-bottom-two",label:"上一下二",slots:3,icon:(0,eb.jsx)(KD,{})},{id:"single",label:"整窗口",slots:1,icon:(0,eb.jsx)(KI,{})}];function eeL(e,t,n=[50,50]){let r=e?.[t],i=r?.[0],a=r?.[1];return["number"==typeof i&&i>0?i:n[0],"number"==typeof a&&a>0?a:n[1]]}function ee$(e,t){return{[e[0]]:t[0],[e[1]]:t[1]}}function eeF(e,t){return[e[t[0]]??50,e[t[1]]??50]}function eeV({mode:e,sizes:t,onSizeGroupChange:n,children:r}){if("single"===e)return(0,eb.jsx)("div",{className:"size-full min-h-0",children:r[0]});if("horizontal-split"===e){let e=eeL(t,"outer"),i=["pane-0","pane-1"];return(0,eb.jsxs)(WY,{direction:"horizontal",defaultLayout:ee$(i,e),onLayoutChanged:e=>n?.("outer",eeF(e,i)),children:[(0,eb.jsx)(WX,{id:i[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:i[1],defaultSize:e[1],minSize:24,children:r[1]})]})}if("vertical-split"===e){let e=eeL(t,"outer"),i=["pane-0","pane-1"];return(0,eb.jsxs)(WY,{direction:"vertical",defaultLayout:ee$(i,e),onLayoutChanged:e=>n?.("outer",eeF(e,i)),children:[(0,eb.jsx)(WX,{id:i[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:i[1],defaultSize:e[1],minSize:24,children:r[1]})]})}if("left-two-right-one"===e){let e=eeL(t,"outer",[58,42]),i=eeL(t,"left"),a=["left","right"],o=["pane-0","pane-1"];return(0,eb.jsxs)(WY,{direction:"horizontal",defaultLayout:ee$(a,e),onLayoutChanged:e=>n?.("outer",eeF(e,a)),children:[(0,eb.jsx)(WX,{id:a[0],defaultSize:e[0],minSize:24,children:(0,eb.jsxs)(WY,{direction:"vertical",defaultLayout:ee$(o,i),onLayoutChanged:e=>n?.("left",eeF(e,o)),children:[(0,eb.jsx)(WX,{id:o[0],defaultSize:i[0],minSize:20,children:r[0]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:o[1],defaultSize:i[1],minSize:20,children:r[1]})]})}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:a[1],defaultSize:e[1],minSize:24,children:r[2]})]})}if("left-one-right-two"===e){let e=eeL(t,"outer",[42,58]),i=eeL(t,"right"),a=["left","right"],o=["pane-1","pane-2"];return(0,eb.jsxs)(WY,{direction:"horizontal",defaultLayout:ee$(a,e),onLayoutChanged:e=>n?.("outer",eeF(e,a)),children:[(0,eb.jsx)(WX,{id:a[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:a[1],defaultSize:e[1],minSize:24,children:(0,eb.jsxs)(WY,{direction:"vertical",defaultLayout:ee$(o,i),onLayoutChanged:e=>n?.("right",eeF(e,o)),children:[(0,eb.jsx)(WX,{id:o[0],defaultSize:i[0],minSize:20,children:r[1]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:o[1],defaultSize:i[1],minSize:20,children:r[2]})]})})]})}if("top-two-bottom-one"===e){let e=eeL(t,"outer",[58,42]),i=eeL(t,"top"),a=["top","bottom"],o=["pane-0","pane-1"];return(0,eb.jsxs)(WY,{direction:"vertical",defaultLayout:ee$(a,e),onLayoutChanged:e=>n?.("outer",eeF(e,a)),children:[(0,eb.jsx)(WX,{id:a[0],defaultSize:e[0],minSize:24,children:(0,eb.jsxs)(WY,{direction:"horizontal",defaultLayout:ee$(o,i),onLayoutChanged:e=>n?.("top",eeF(e,o)),children:[(0,eb.jsx)(WX,{id:o[0],defaultSize:i[0],minSize:24,children:r[0]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:o[1],defaultSize:i[1],minSize:24,children:r[1]})]})}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:a[1],defaultSize:e[1],minSize:24,children:r[2]})]})}if("top-one-bottom-two"===e){let e=eeL(t,"outer",[42,58]),i=eeL(t,"bottom"),a=["top","bottom"],o=["pane-1","pane-2"];return(0,eb.jsxs)(WY,{direction:"vertical",defaultLayout:ee$(a,e),onLayoutChanged:e=>n?.("outer",eeF(e,a)),children:[(0,eb.jsx)(WX,{id:a[0],defaultSize:e[0],minSize:24,children:r[0]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:a[1],defaultSize:e[1],minSize:24,children:(0,eb.jsxs)(WY,{direction:"horizontal",defaultLayout:ee$(o,i),onLayoutChanged:e=>n?.("bottom",eeF(e,o)),children:[(0,eb.jsx)(WX,{id:o[0],defaultSize:i[0],minSize:24,children:r[1]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:o[1],defaultSize:i[1],minSize:24,children:r[2]})]})})]})}let i=eeL(t,"outer"),a=eeL(t,"left"),o=eeL(t,"right"),l=["left","right"],s=["pane-0","pane-2"],c=["pane-1","pane-3"];return(0,eb.jsxs)(WY,{direction:"horizontal",defaultLayout:ee$(l,i),onLayoutChanged:e=>n?.("outer",eeF(e,l)),children:[(0,eb.jsx)(WX,{id:l[0],defaultSize:i[0],minSize:24,children:(0,eb.jsxs)(WY,{direction:"vertical",defaultLayout:ee$(s,a),onLayoutChanged:e=>n?.("left",eeF(e,s)),children:[(0,eb.jsx)(WX,{id:s[0],defaultSize:a[0],minSize:20,children:r[0]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:s[1],defaultSize:a[1],minSize:20,children:r[2]})]})}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:l[1],defaultSize:i[1],minSize:24,children:(0,eb.jsxs)(WY,{direction:"vertical",defaultLayout:ee$(c,o),onLayoutChanged:e=>n?.("right",eeF(e,c)),children:[(0,eb.jsx)(WX,{id:c[0],defaultSize:o[0],minSize:20,children:r[1]}),(0,eb.jsx)(WZ,{withHandle:!0}),(0,eb.jsx)(WX,{id:c[1],defaultSize:o[1],minSize:20,children:r[3]})]})})]})}function eeB({conversationId:e,index:t,content:n,clipboardItems:r,clipboardDraggingId:i,onAdd:a,onPanelDrop:o,onContentChange:l,onClear:s,onCut:c,workspaceFolders:d,onRequestFileTab:u,onOpenWorkspaceFile:f,onSaveFileTab:h}){let[p,m]=ew.useState();return(0,eb.jsx)("div",{"data-agent-pane":t,className:tK("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"===p&&"ring-2 ring-foreground/60 ring-inset","shredder"===p&&"ring-2 ring-destructive/70 ring-inset","cutter"===p&&"ring-2 ring-amber-500/70 ring-inset"),onDragOver:e=>{let t=Array.from(e.dataTransfer.types);if(t.includes(eeT)){e.preventDefault(),e.dataTransfer.dropEffect="move",m("cutter");return}if(t.includes(eeD)){e.preventDefault(),e.dataTransfer.dropEffect="move",m("shredder");return}t.includes(qA)&&(e.preventDefault(),e.dataTransfer.dropEffect="move",m("panel"))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||m(void 0)},onDrop:e=>{if(Array.from(e.dataTransfer.types).includes(eeT)){e.preventDefault(),e.stopPropagation(),m(void 0),c(t);return}if(Array.from(e.dataTransfer.types).includes(eeD)){e.preventDefault(),e.stopPropagation(),m(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),i=n?n.payloads?.[qA]:void 0;if(n&&i)return{item:n,content:i.content};let a=e.dataTransfer.getData(qA);if(a)try{let e=JSON.parse(a);return n&&e.content?{item:n,content:e.content}:void 0}catch{return}}(e);n&&(e.preventDefault(),e.stopPropagation(),m(void 0),o(t,n.item,n.content))},children:n?(0,eb.jsx)("div",{className:tK("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",i&&"pointer-events-none"),children:qP(n)?ee_(n.kind,{tab:n.tab,terminalScopeId:e?`agent:${e}:pane:${n.id}`:void 0,terminalState:n.terminal,onTerminalStateChange:e=>{var r;r=n.terminal,((r?.activeSessionId??"")!==(e.activeSessionId??"")||(r?.selectedMachineId??"")!==(e.selectedMachineId??"")||(r?.selectedShellId??"")!==(e.selectedShellId??"")||(r?.autoStart??!0)!==(e.autoStart??!0)||(r?.sessionIds??[]).join("\0")!==e.sessionIds.join("\0"))&&l(t,{...n,terminal:e})},workspaceFolders:d,nodeId:n.id,tabs:n.tabs,activeTabId:n.activeTabId,onRequestFileTab:({insertIndex:e})=>u?.(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),onActiveTabChange:(e,r)=>{l(t,{...n,activeTabId:r})}}):(0,eb.jsx)(U9,{className:"size-full min-h-0",composerClassName:"max-w-[42.5rem]",initialEvents:n.events},n.id)},n.id):(0,eb.jsx)("div",{className:"vtl-agent-pane-empty grid size-full place-items-center p-4",children:(0,eb.jsxs)(tY,{type:"button",variant:"outline",size:"sm",className:"rounded-full bg-background/90",onClick:a,children:[(0,eb.jsx)(s7,{className:"size-4"}),"添加"]})})})}function eeH({open:e,onOpenChange:t,onAdd:n}){return(0,eb.jsx)(mr,{open:e,onOpenChange:t,title:"添加工作区组件",description:"选择一个组件填入当前窗口。",className:"top-1/2 max-w-xl -translate-y-1/2",children:(0,eb.jsxs)(mn,{loop:!0,children:[(0,eb.jsx)(mi,{placeholder:"搜索组件..."}),(0,eb.jsxs)(ma,{children:[(0,eb.jsx)(mo,{children:"没有匹配组件。"}),(0,eb.jsx)(ml,{heading:"可放入窗口",children:qE.map(e=>(0,eb.jsxs)(ms,{value:`${e.title} ${e.description} ${e.keywords}`,onSelect:()=>n(e.id),children:[(0,eb.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg border bg-background text-muted-foreground",children:e.icon}),(0,eb.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,eb.jsx)("span",{className:"block truncate text-sm font-medium",children:e.title}),(0,eb.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,eb.jsx)(mc,{children:"添加"})]},e.id))})]})]})})}let eeW=[];function eeq(e){var t;let n=(t=e?.layoutMode,eeR.some(e=>e.id===t)?t:"quad"),r="right"===e?.agentPosition?"right":"left",i=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:eeU(e.outer),left:eeU(e.left),right:eeU(e.right),top:eeU(e.top),bottom:eeU(e.bottom)}}(e?.sizes),a=Array.from({length:Math.max(4,eeR.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>=a.length||(a[e]=function(e,t){var n,r;let i=e.paneId||`${e.kind}-${t+1}`,a=!(n=e.props)||"object"!=typeof n||Array.isArray(n)?{}:n;if("subagent-conversation-panel"===e.kind)return{id:i,kind:"subagent-conversation-panel",title:eeG(a.title)??"Subagent",subagentId:eeG(a.subagentId)??i,events:Array.isArray(a.events)?a.events:[]};if(!qO(e.kind))return;let o=a.tab&&"object"==typeof a.tab?a.tab:void 0,l=Array.isArray(a.tabs)?a.tabs.filter(e=>HO(e?.kind)):void 0,s=qO(e.kind);return{id:i,kind:e.kind,title:eeG(a.title)??o?.title??s?.title??"组件",tab:o,tabs:l,activeTabId:eeG(a.activeTabId),terminal:"terminal-tab-group"===e.kind?!(r=a.terminal)||"object"!=typeof r||Array.isArray(r)?{sessionIds:[]}:{sessionIds:Array.isArray(r.sessionIds)?r.sessionIds.filter(e=>"string"==typeof e):[],activeSessionId:eeG(r.activeSessionId),selectedMachineId:eeG(r.selectedMachineId),selectedShellId:eeG(r.selectedShellId),autoStart:"boolean"==typeof r.autoStart?r.autoStart:void 0}:void 0}}(n,t))}return{layoutMode:n,agentPosition:r,layoutSizes:i,panes:a}}function eeU(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 eeK(e){return e.filter(e=>"number"==typeof e&&Number.isFinite(e)&&e>0)}function eeG(e){return"string"==typeof e&&e.trim()?e:void 0}function eeY(e){let t=e?.id.match(/-(\d+)$/);return t?Number(t[1]):0}function eeX(e){return e.reduce((e,t)=>Math.max(e,eeY(t)),0)}function eeZ({conversation:e,clipboardItems:t,clipboardDraggingId:n,onClipboardItemsChange:r,onClipboardDraggingChange:i,onOverlayOpenChange:a}){let o=eeq(e?.panes),[l,s]=ew.useState(o.layoutMode),[c,d]=ew.useState(o.agentPosition),[u,f]=ew.useState(o.layoutSizes),[h,p]=ew.useState(()=>o.panes),[m,g]=ew.useState(()=>e?.events??[]),[v,x]=ew.useState(""),[y,b]=ew.useState(e?.conversation.status==="working"),[w,j]=ew.useState(e?.conversation.status??"idle"),[k,S]=ew.useState(),[C,N]=ew.useState(),M=ew.useRef(eeX(o.panes)),E=ew.useRef(0),O=eeR.find(e=>e.id===l)?.slots??4,P=e?.conversation.settings.folders??eeW,{models:A}=g4(),z=ew.useMemo(()=>{let t=e?.conversation.settings.mainModels??[];return t.length?A.filter(e=>t.includes(e.value)).map(e=>({id:e.value,label:e.label})):[]},[A,e?.conversation.settings.mainModels]),_=y||"working"===w;function I(e){if(!e.length)return;let t=e.map(qz);r(e=>[...t,...e.filter(e=>!t.some(t=>t.id===e.id))])}async function D(e,t,n){try{let r=await Kr(e);p(e=>e.map((e,i)=>i===t?function(e,t,n){if(!e||!qP(e))return e;if("multi-tab-system"===e.kind){var r;let i,a;return{...e,tabs:(r=e.tabs??[],i=r.filter(e=>e.id!==t.id),a=void 0===n?i.length:Math.min(Math.max(n,0),i.length),i.splice(a,0,t),i),activeTabId:t.id}}return"file-tab-viewer"===e.kind?{...e,title:t.title,tab:t}:e}(e,r,n):e))}catch{qr.error("文件预览打开失败")}}function T(e){let t=h.slice(0,O).findIndex(e=>e?.kind==="multi-tab-system");t<0?qr.warning("请先放入一个多标签页组件"):D(e,t)}async function R(e,t,n){let r=t.file?.path,i=t.file?.machineId??"local";if(!r)throw qr.error("文件路径不可用"),Error("file path is unavailable");try{let a=await HD({machineId:i,path:r,content:n}),o={...t,modified:!1,defaultValue:"utf-8"===a.encoding?a.content:n,file:{...t.file,name:a.name,path:a.path,machineId:a.machine.id,mimeType:a.mimeType,kind:t.file?.kind,size:a.size,truncated:a.truncated}};p(t=>t.map((t,n)=>n===e?t&&qP(t)?"multi-tab-system"===t.kind?{...t,tabs:(t.tabs??[]).map(e=>e.id===o.id?o:e),activeTabId:o.id}:"file-tab-viewer"===t.kind?{...t,title:o.title,tab:o}:t:t:t)),qr.success("文件已保存")}catch(e){throw qr.error("文件保存失败"),e}}function L(e,t,n){let a=h[e];M.current=Math.max(M.current,eeY(n)),p(t=>t.map((t,r)=>r===e?n:t)),r(e=>{let n=e.filter(e=>e.id!==t.id);if(!a)return n;let r=qz(a);return[r,...n.filter(e=>e.id!==r.id)]}),i?.(void 0)}function $(e,t){p(n=>n.map((n,r)=>r===e?t:n))}function F(e){var t=h[e];if(t&&qP(t)&&"terminal-tab-group"===t.kind)for(let e of t.terminal?.sessionIds??[])Hq(e).catch(()=>{});p(t=>t.map((t,n)=>n===e?void 0:t))}function V(e){let t=h[e];t&&I([t]),p(t=>t.map((t,n)=>n===e?void 0:t))}async function B(t){let n=e?.conversation.id,r=v||z[0]?.id;if(n){if(!r)return void qr.error("请先在代理模型配置里选择模型");b(!0),j("working");try{let e=await Ha(n,{message:t,modelRef:r,mode:"chat"});g(e.events),j(e.conversation.status)}catch(e){b(!1),j("idle"),qr.error(e instanceof Error?e.message:"对话请求失败")}}}ew.useEffect(()=>{a?.(void 0!==k||void 0!==C)},[C,a,k]),ew.useEffect(()=>{g(e?.events??[])},[e?.conversation.id,e?.events]),ew.useEffect(()=>{b(e?.conversation.status==="working"),j(e?.conversation.status??"idle")},[e?.conversation.id,e?.conversation.status]),ew.useEffect(()=>{let e=z[0]?.id??"";x(t=>z.some(e=>e.id===t)?t:e)},[z]),ew.useEffect(()=>{let t=eeq(e?.panes);s(t.layoutMode),d(t.agentPosition),f(t.layoutSizes),p(t.panes),M.current=eeX(t.panes)},[e?.conversation.id,e?.panes]),ew.useEffect(()=>{let t,n=e?.conversation.id;if(!n||!_)return;let r=new EventSource(gQ(`/api/local/agent/conversations/${encodeURIComponent(n)}/events/stream`));return r.addEventListener("detail",e=>{try{let t=Ho(JSON.parse(e.data));g(t.events),j(t.conversation.status),"working"!==t.conversation.status&&(b(!1),r.close())}catch{return}}),r.onerror=()=>{r.close(),void 0===t&&(t=window.setInterval(async()=>{try{let e=await B9(n);g(e.events),j(e.conversation.status),"working"!==e.conversation.status&&(b(!1),void 0!==t&&(window.clearInterval(t),t=void 0))}catch{return}},350))},()=>{r.close(),void 0!==t&&window.clearInterval(t)}},[e?.conversation.id,_]),ew.useEffect(()=>{let t=e?.conversation.id;if(!t)return;let n=window.setTimeout(()=>{let e;Hi(t,(e=[],h.forEach((t,n)=>{if(t){if(qP(t))return void e.push({paneId:t.id,slot:n,kind:t.kind,machineId:t.terminal?.selectedMachineId,resourceId:t.terminal?.activeSessionId,props:{title:t.title,tab:t.tab,tabs:t.tabs,activeTabId:t.activeTabId,terminal:t.terminal}});e.push({paneId:t.id,slot:n,kind:t.kind,props:{title:t.title,subagentId:t.subagentId,events:t.events}})}}),{layoutMode:l,agentPosition:c,sizes:u,panes:e}))},300);return()=>window.clearTimeout(n)},[c,e?.conversation.id,l,u,h]);let H=Array.from({length:O},(r,i)=>(0,eb.jsx)(eeB,{conversationId:e?.conversation.id,index:i,content:h[i],clipboardItems:t,clipboardDraggingId:n,onAdd:()=>S(i),onPanelDrop:L,onContentChange:$,onClear:F,onCut:V,workspaceFolders:P,onRequestFileTab:(e,t)=>N({paneIndex:e,insertIndex:t}),onOpenWorkspaceFile:T,onSaveFileTab:R},i)),W=h.slice(0,O).some(e=>e?.kind==="subagent-conversation-panel"),q=u.shell?.agent??42,U=u.shell?.panes??58,K=(0,eb.jsx)(WX,{id:"agent",defaultSize:q,minSize:28,children:(0,eb.jsx)(U9,{events:e?m:void 0,models:e?z:void 0,modelId:v,running:_,disabled:!!e&&0===z.length,onModelChange:x,onSubmit:e?e=>{B(e.value)}:void 0,onOpenFile:function(e){let t=e.path?.trim()||e.name.trim();!t||e.meta?.toLowerCase().startsWith("depth")||T({machineId:"local",path:t})},onOpenSubagent:function(e){var t;let n=h.slice(0,O),r=n.findIndex(e=>!e),i=n.findIndex(e=>e?.kind==="subagent-conversation-panel"),a=r>=0?r:i;if(a<0)return void qr.warning("请释放一个窗口再选中浏览");E.current+=1;let o={id:t=`subagent-${e.id}-${E.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}]};p(e=>e.map((e,t)=>t===a?o:e))}})},"agent-conversation"),G=(0,eb.jsx)(WX,{id:"panes",defaultSize:U,minSize:32,children:(0,eb.jsxs)("section",{className:"vtl-agent-workspace-panel flex size-full min-h-0 min-w-0 flex-col bg-transparent","data-has-conversation-pane":W?"true":void 0,children:[(0,eb.jsx)("div",{className:"flex h-11 shrink-0 items-center border-b px-3",children:(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[(0,eb.jsx)(qg,{value:l,onValueChange:e=>{let t,n;return t=eeR.find(t=>t.id===e)?.slots??4,void((n=h.slice(t).filter(e=>!!e)).length&&I(n),p(Array.from({length:Math.max(4,t)},(e,n)=>n<t?h[n]:void 0)),s(e))},children:(0,eb.jsx)(qC,{children:eeR.map(e=>(0,eb.jsx)(qN,{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))})}),(0,eb.jsxs)(yJ,{type:"single",value:c,variant:"outline",size:"sm","aria-label":"Agent 面板位置",onValueChange:e=>{("left"===e||"right"===e)&&d(e)},children:[(0,eb.jsx)(yQ,{value:"left","aria-label":"Agent 在左",title:"Agent 在左",className:"h-7 w-9 px-0 [&_svg]:size-4",children:(0,eb.jsx)(nw,{})}),(0,eb.jsx)(yQ,{value:"right","aria-label":"Agent 在右",title:"Agent 在右",className:"h-7 w-9 px-0 [&_svg]:size-4",children:(0,eb.jsx)(Hp,{})})]}),(0,eb.jsx)(tY,{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(eeT,"cut")},children:(0,eb.jsx)(ce,{})}),(0,eb.jsx)(tY,{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(eeD,"clear")},children:(0,eb.jsx)(Hm,{})})]})}),(0,eb.jsx)("div",{className:"min-h-0 flex-1",children:(0,eb.jsx)(eeV,{mode:l,sizes:u,onSizeGroupChange:function(e,t){let n=eeK(t);f(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:H},`${e?.conversation.id??"empty"}-${l}`)})]})},"agent-panes");return(0,eb.jsxs)("div",{className:"vtl-app-background vtl-agent-conversation-workspace h-full min-h-0 pl-[5.25rem]",children:[(0,eb.jsxs)(WY,{direction:"horizontal",defaultLayout:{agent:q,panes:U},onLayoutChanged:e=>{let t=e.agent??q,n=e.panes??U;!function(e){let t=eeK(e),n=t[0],r=t[1];if(void 0===n||void 0===r)return;let i="left"===c?{agent:n,panes:r}:{agent:r,panes:n};f(e=>{let t=e.shell?.agent,n=e.shell?.panes;return .01>Math.abs((t??0)-i.agent)&&.01>Math.abs((n??0)-i.panes)?e:{...e,shell:{...e.shell,...i}}})}("left"===c?[t,n]:[n,t])},children:["left"===c?K:G,(0,eb.jsx)(WZ,{withHandle:!0}),"left"===c?G:K]},`${e?.conversation.id??"empty"}-${c}`),(0,eb.jsx)(eeH,{open:void 0!==k,onOpenChange:e=>{e||S(void 0)},onAdd:function(e){var t;let n,r;if(void 0===k)return;M.current+=1;let i=(t=`${e}-${M.current}`,n=qO(e),r="file-tab-viewer"===e?{id:t,kind:e,title:"选择文件"}:HO(e)?HA(e,t):void 0,{id:t,kind:e,title:r?.title??n?.title??"组件",tab:r,tabs:"multi-tab-system"===e?[]:void 0,terminal:"terminal-tab-group"===e?{sessionIds:[],autoStart:!0}:void 0}),a=h[k];a&&I([a]),p(e=>e.map((e,t)=>t===k?i:e)),S(void 0)}}),(0,eb.jsx)(KA,{open:void 0!==C,folders:P,onOpenChange:e=>{e||N(void 0)},onSelectFile:e=>{C&&D(e,C.paneIndex,C.insertIndex),N(void 0)}}),(0,eb.jsx)(qc,{position:"top-right"})]})}let eeJ=eN("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"}]]),eeQ=eN("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"}]]),ee0=eN("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"}]]),ee1=eN("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"}]]);function ee2({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){let[r,i]=ew.useState(),a=ew.useMemo(()=>B2({onSelect:i}),[]);return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)(mk,{boardId:"canvas-library",definitions:a,initialLayouts:B5,clipboardItems:e,actionLabel:"画布库页面卡片操作",paletteGroupTitle:"画布库页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n}),(0,eb.jsx)(ee4,{canvas:r,onOpenChange:e=>{e||i(void 0)}})]})}function ee5({icon:e,value:t}){return(0,eb.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,eb.jsx)("span",{className:"[&_svg]:size-3.5",children:e}),(0,eb.jsx)("span",{className:"tabular-nums",children:t})]})}function ee4({canvas:e,onOpenChange:t}){return e?(0,eb.jsx)(m1,{open:!!e,onOpenChange:t,title:e.title,eyebrow:"画布管理",description:e.purpose,panels:[{id:"overview",label:"首页",icon:(0,eb.jsx)(mV,{}),content:(0,eb.jsx)(ee3,{canvas:e})},{id:"templates",label:"节点模板",icon:(0,eb.jsx)(eeJ,{}),badge:e.settings.nodeTemplates.length,content:(0,eb.jsx)(ee8,{title:"可用节点模板",items:e.settings.nodeTemplates})},{id:"layout",label:"默认布局",icon:(0,eb.jsx)(ee1,{}),content:(0,eb.jsx)(ee8,{title:"默认布局参数",items:e.settings.defaultLayout})},{id:"folders",label:"工作区绑定",icon:(0,eb.jsx)(mL,{}),content:(0,eb.jsx)(ee8,{title:"绑定的工作区文件夹",items:e.settings.folders})},{id:"sharing",label:"共享权限",icon:(0,eb.jsx)(ee0,{}),content:(0,eb.jsx)(ee8,{title:"共享与权限",items:e.settings.sharing})},{id:"autosave",label:"自动保存",icon:(0,eb.jsx)(ZI,{}),content:(0,eb.jsx)(ee8,{title:"自动保存策略",items:e.settings.autosave})},{id:"snapshots",label:"快照和版本",icon:(0,eb.jsx)(BU,{}),content:(0,eb.jsx)(ee8,{title:"快照和版本策略",items:e.settings.snapshots})},{id:"hosts",label:"可访问主机",icon:(0,eb.jsx)(m$,{}),content:(0,eb.jsx)(ee8,{title:"可访问主机",items:e.settings.hosts})},{id:"plugins",label:"插件",icon:(0,eb.jsx)(mB,{}),content:(0,eb.jsx)(ee8,{title:"画布插件",items:e.settings.plugins,empty:"未加载插件"})}]}):null}function ee3({canvas:e}){return(0,eb.jsxs)("div",{className:"grid gap-5",children:[(0,eb.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,eb.jsxs)("div",{className:"grid gap-5",children:[(0,eb.jsxs)("div",{className:"max-w-2xl",children:[(0,eb.jsx)("h3",{className:"text-3xl font-semibold tracking-normal",children:e.title}),(0,eb.jsx)("p",{className:"mt-4 text-sm leading-6 text-muted-foreground",children:e.purpose})]}),(0,eb.jsxs)("div",{className:"grid max-w-56 gap-2",children:[(0,eb.jsx)(ee6,{label:"Nodes",value:`${e.nodes}`}),(0,eb.jsx)(ee6,{label:"Agent",value:`${e.agents}`}),(0,eb.jsx)(ee6,{label:"Snapshots",value:`${e.snapshots}`})]})]}),(0,eb.jsx)("span",{className:"absolute right-7 bottom-7 text-sm font-medium text-foreground transition-opacity group-hover:opacity-70",children:"进入"})]}),(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsxs)("div",{className:"flex items-center justify-between",children:[(0,eb.jsx)("span",{className:"text-sm font-medium",children:"Roadmap"}),(0,eb.jsx)(ee5,{icon:(0,eb.jsx)(FN,{}),value:e.runtime})]}),(0,eb.jsx)(mT,{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 ee6({label:e,value:t}){return(0,eb.jsxs)("span",{className:"grid min-w-0 gap-0.5 py-0.5",children:[(0,eb.jsx)("span",{className:"truncate ui-text-kbd text-muted-foreground",children:e}),(0,eb.jsx)("span",{className:"min-w-0 truncate text-sm font-semibold tracking-normal",children:t})]})}function ee8({title:e,items:t,empty:n="暂无内容"}){return(0,eb.jsxs)("div",{className:"grid gap-3",children:[(0,eb.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:e}),(0,eb.jsx)("div",{className:"overflow-hidden rounded-xl border bg-card",children:t.length>0?t.map((e,t)=>(0,eb.jsxs)("div",{className:tK("flex min-h-10 items-center gap-2 px-3 text-sm",t>0&&"border-t"),children:[(0,eb.jsx)(eeQ,{className:"size-4 text-muted-foreground"}),(0,eb.jsx)("span",{className:"min-w-0 truncate",children:e})]},e)):(0,eb.jsx)("div",{className:"px-3 py-6 text-sm text-muted-foreground",children:n})})]})}function ee7({open:e,onOpenChange:t,onAdd:n}){return(0,eb.jsx)(mr,{open:e,onOpenChange:t,title:"添加节点",description:"搜索并选择要放入画布的可用节点。",className:"top-1/2 max-w-xl -translate-y-1/2",children:(0,eb.jsxs)(mn,{loop:!0,children:[(0,eb.jsx)(mi,{placeholder:"搜索节点..."}),(0,eb.jsxs)(ma,{children:[(0,eb.jsx)(mo,{children:"没有匹配节点。"}),(0,eb.jsx)(ml,{heading:"可用节点",children:HN.map(e=>(0,eb.jsxs)(ms,{value:`${e.title} ${e.description} ${e.keywords}`,onSelect:()=>n(e),children:[(0,eb.jsx)("span",{className:"flex size-8 shrink-0 items-center justify-center rounded-lg border bg-background text-muted-foreground",children:e.icon}),(0,eb.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,eb.jsx)("span",{className:"block truncate text-sm font-medium",children:e.title}),(0,eb.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,eb.jsxs)(mc,{children:[e.size.width,"x",e.size.height]})]},e.id))})]})]})})}function ee9({nodes:e,edges:t,selectedNodeId:n,clipboardItems:r,onNodesChange:i,onEdgesChange:a,onNodesSet:o,onEdgesSet:l,onSelectedNodeChange:s,onClipboardItemsChange:c}){let d=ew.useRef(null),{addPaletteOpen:u,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:i,onSelectedNodeChange:a,onClipboardItemsChange:o}){let l=ew.useRef(0),s=ew.useRef(0),[c,d]=ew.useState(!1),[u,f]=ew.useState(),[h,p]=ew.useState(),m=ew.useCallback((t,n)=>{let r,i,a,o,l,s,c,d;return r=e.current,i=r?.querySelector(".react-flow__viewport"),a=r?.getBoundingClientRect(),l="none"!==(o=i?getComputedStyle(i).transform:"none")?new DOMMatrixReadOnly(o):void 0,s=l?.a&&Number.isFinite(l.a)?l.a:1,c=l?.e??0,d=l?.f??0,{x:(t-(a?.left??0)-c)/s,y:(n-(a?.top??0)-d)/s}},[e]),g=ew.useCallback((e,t)=>{r(n=>n.map(n=>{let r,i;return n.id===e?(i="string"==typeof(r=n.data??{}).activeTabId&&t.some(e=>e.id===r.activeTabId)?r.activeTabId:t[0]?.id,{...n,data:{...r,tabs:t,activeTabId:i}}):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 HO(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 i=(n=e.kind,HN.find(e=>e.id===n)?.size??Hw({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:HS(n,r),data:{contentScale:2,kind:e.kind,tab:{...e,id:`${t}-tab`}},width:r.width,height:r.height,style:Hj(r)}}({tab:e,nodeId:o,center:t,size:i})]),a(o)},[r,a]),w=ew.useCallback(async(e,n)=>{try{let i,a=n?.nodeId?t.find(e=>e.id===n.nodeId):void 0,o=a?(a.data??{}).kind:void 0,l="data-table-tab-viewer"===o?await Ki(e):await Kr(e),s=void 0!==a&&(i=a.data??{},"multi-tab-system"===i.kind||"file-tab-viewer"===i.kind||"data-table-tab-viewer"===i.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 i,a,o=Array.isArray(r.tabs)?r.tabs:[];return{...e,data:{...r,tabs:(i=o.filter(e=>e.id!==t.id),a=void 0===n?i.length:Math.min(Math.max(n,0),i.length),i.splice(a,0,t),i),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,u??{x:496,y:336})}catch{qr.error("文件预览打开失败")}},[b,t,r,u]),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,i=t.file?.machineId??"local";if(!r)throw qr.error("文件路径不可用"),Error("file path is unavailable");try{let a=await HD({machineId:i,path:r,content:n}),o={...t,title:a.name,modified:!1,defaultValue:"utf-8"===a.encoding?a.content:n,file:{...t.file,name:a.name,path:a.path,machineId:a.machine.id,mimeType:a.mimeType,kind:t.file?.kind,size:a.size,truncated:a.truncated}};x(e,o),qr.success("文件已保存")}catch(e){throw qr.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),i=r?r.payloads?.[fr]:void 0;if(i)return i;let a=e.dataTransfer.getData(fr);if(a)try{return JSON.parse(a)}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??{},i=Array.isArray(r.tabs)?r.tabs:[],a=new Set(i.map(e=>e.id)),o=n.tab.id,l=2;for(;a.has(o);)o=`${n.tab.id}-${l}`,l+=1;let s=[...i];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,i=t.y>=n.position.y&&t.y<=n.position.y+e.height;if(r&&i)return n}})(t,e),[t]),O=ew.useCallback((t,n,r)=>(function(e,t,n,r){let i=Array.from(e.current?.querySelectorAll(".react-flow__node")??[]).find(e=>e.getAttribute("data-id")===t),a=i?.querySelector('[data-slot="multi-tab-list"]');if(!a)return r;let o=Array.from(a.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:i,onTabChange:a,onSaveFileTab:o,onTerminalStateChange:l,onTabDetach:s,onExternalTabDrop:c}){return ew.useMemo(()=>e.map(e=>{let d=e.data??{},u=(e.data??{}).kind;return u?{...e,data:{...d,content:(0,eb.jsx)(eeI,{kind:u,nodeId:e.id,tab:d.tab,tabs:d.tabs,activeTabId:d.activeTabId,terminalScopeId:`canvas:node:${e.id}`,terminalState:d.terminal,onTerminalStateChange:t=>l(e.id,t),onRequestFileTab:r,onOpenWorkspaceFile:i,onTabsChange:t,onTabChange:a,onSaveFileTab:o,onActiveTabChange:n,onTabDetach:s,onExternalTabDrop:c})}}:e}),[e,n,c,i,r,o,a,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=[]:HO(e.id)&&(r.tab=HA(e.id,`${t}-tab`)),{id:t,type:"blank",position:HS(n,e.size),data:r,width:e.size.width,height:e.size.height,style:Hj(e.size)}}({template:e,nodeId:n,center:u??{x:496,y:336}})]),a(void 0),d(!1),f(void 0)},[t.length,r,a,u]),z=ew.useCallback(e=>{let t=e.dataTransfer.getData("application/vnd.vantaloom.clip-id");if(!t)return;let i=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),a(void 0);return}let d=i?i.payloads?.[fn]:void 0;if(!i||!d)return;e.preventDefault(),e.stopPropagation(),e.dataTransfer.dropEffect="move",l.current+=1;let u=`${d.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:HS(n,r),style:e.style??Hj(r),selected:!1,data:{...e.data??{},resizing:!1}}}({source:d.node,nodeId:u,center:o})]),a(u)},[n,E,C,m,O,N,r,a]),_=ew.useCallback(e=>{Array.from(e.dataTransfer.types).some(e=>[fn,fr].includes(e))&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},[]),I=ew.useCallback((e,{flowPosition:t})=>{"add"===e&&(f(t),d(!0))},[]),D=ew.useCallback(e=>{i(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:[]}}]})},[i]),T=ew.useCallback((e,t,n)=>{"cut-edge"===e?i(e=>e.filter(e=>e.id!==t)):i(r=>r.map(r=>{if(r.id!==t)return r;let i=[...r.data?.anchors??[]];return"add-anchor"===e&&n.anchor&&i.splice(n.anchorIndex??i.length,0,n.anchor),"move-anchor"===e&&n.anchor&&void 0!==n.anchorIndex&&(i[n.anchorIndex]=n.anchor),"delete-anchor"===e&&void 0!==n.anchorIndex&&i.splice(n.anchorIndex,1),{...r,data:{...r.data??{},anchors:i}}}))},[i]),R=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 a(r),[...e,{...t,id:r,position:l,selected:!1,data:{...t.data??{},resizing:!1}}]});if("cut"===e){let e,l,s,c,d,u,f=t.find(e=>e.id===n);if(!f)return;let h=(e={...f.data??{}},delete e.content,delete e.mode,delete e.onConnectPointerDown,delete e.onSelectNode,delete e.resizing,c=(s=function(e){let t=e.data??{},n=t.tab;if(n?.id&&HO(n.kind))return n;let r=t.kind;if(HO(r))return HA(r,e.id)}(l={...f,selected:!1,data:{...e,resizing:!1}}))?{tab:s,sourceNodeId:f.id}:void 0,d={[fn]:{node:l}},u={"application/vnd.vantaloom.clip-kind":s?"canvas-tab":"canvas-node",[fn]:f.id},c&&(d[fr]=c,u[fr]=JSON.stringify(c)),{id:`clip-${f.id}`,title:s?.title??"画布节点",description:s?"来自画布的独立标签页。":"来自节点画布的空白节点。",meta:`${Math.round(f.width??192)}x${Math.round(f.height??112)}`,icon:s?HP(s.kind):(0,eb.jsx)(Hv,{className:"size-4"}),dragData:u,payloads:d});o(e=>[h,...e.filter(e=>e.id!==h.id)]),r(e=>e.filter(e=>e.id!==n)),i(e=>e.filter(e=>e.source!==n&&e.target!==n)),a(void 0)}},[t,o,i,r,a]);return{addPaletteOpen:c,addTemplateNode:A,filePickerDialog:(0,eb.jsx)(Qb,{open:void 0!==h,onOpenChange:e=>{e||p(void 0)},onSelectFile:e=>{p(void 0),w(e,h)}}),handleAddPaletteOpenChange:function(e){d(e),e||f(void 0)},handleCanvasAction:I,handleCanvasDragOver:_,handleCanvasDrop:z,handleNodeCanvasConnect:D,handleNodeCanvasEdgeAction:T,handleNodeCanvasNodeAction:R,renderedCanvasNodes:P}}({workspaceRef:d,nodes:e,clipboardItems:r,onNodesChange:i,onEdgesChange:a,onNodesSet:o,onEdgesSet:l,onSelectedNodeChange:s,onClipboardItemsChange:c});return(0,eb.jsxs)("div",{ref:d,className:"vtl-app-background vtl-canvas-workspace relative h-full w-full overflow-hidden",onDragOver:m,onDrop:g,children:[(0,eb.jsx)(cM,{"aria-label":"新建画布",className:"h-full min-h-0 rounded-none border-0",viewportClassName:"h-full",nodes:w,edges:t,nodeTypes:Hy,edgeTypes:Hb,onNodesChange:i,onEdgesChange:a,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,eb.jsx)(ee7,{open:u,onOpenChange:h,onAdd:f}),b,(0,eb.jsx)(qc,{position:"top-right"})]})}function ete({open:e,definitions:t,onOpenChange:n,onAdd:r}){return(0,eb.jsx)(mr,{open:e,onOpenChange:n,title:"添加卡片",description:"搜索并选择要添加到运维面板的卡片。",className:"top-1/2 max-w-xl -translate-y-1/2",children:(0,eb.jsxs)(mn,{loop:!0,children:[(0,eb.jsx)(mi,{placeholder:"搜索可添加卡片..."}),(0,eb.jsxs)(ma,{className:"max-h-[420px]",children:[(0,eb.jsx)(mo,{children:"没有找到可添加的卡片。"}),(0,eb.jsx)(ml,{heading:"运维面板卡片",children:t.map(e=>(0,eb.jsxs)(ms,{value:`${e.title} ${e.description}`,keywords:[e.id,e.defaultConfig.dataSource],onSelect:()=>r(e.id),className:"min-h-14 items-start py-2",children:[(0,eb.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,eb.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,eb.jsx)("span",{className:"block truncate font-medium",children:e.title}),(0,eb.jsx)("span",{className:"mt-0.5 block truncate ui-text-kbd text-muted-foreground",children:e.description})]}),(0,eb.jsxs)(mc,{children:[e.defaultSize.w,"x",e.defaultSize.h]})]},e.id))})]})]})})}function ett({open:e,dragMode:t,onOpenChange:n,onAdd:r,onDragModeChange:i}){let a=[{key:"add",label:"添加组件",icon:(0,eb.jsx)(s7,{className:"size-4"}),onClick:r,pressed:!1},{key:"drag",label:"拖拽排版",icon:(0,eb.jsx)(s2,{className:"size-4"}),onClick:()=>i(!t),pressed:t}];return(0,eb.jsx)("div",{className:"fixed right-5 bottom-5 z-30",children:(0,eb.jsxs)("div",{className:"relative size-8",children:[a.map((t,n)=>(0,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":t.label,"aria-pressed":t.pressed,onClick:t.onClick,className:tK("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,eb.jsx)(tY,{type:"button",variant:"outline",size:"icon-sm","aria-label":"仪表盘操作","aria-expanded":e,onClick:()=>n(!e),className:"absolute inset-0 rounded-full bg-background/95 shadow-md backdrop-blur",children:(0,eb.jsx)(s6,{className:tK("size-4 transition-transform",e&&"rotate-90")})})]})})}function etn({layout:e,layouts:t,cellSize:n,dragMode:r,selected:i,resizing:a,onSelect:o,onMove:l,onCut:s,onCopy:c,onSettingsOpen:d,onResizeStart:u,onResizeEnd:f,children:h}){let[p,m]=ew.useState(!1),g=e.x*(n+12),v=e.y*(n+12),x=e.w*n+(e.w-1)*12,y=e.h*n+(e.h-1)*12;return(0,eb.jsxs)("div",{"data-dashboard-widget":e.id,className:tK("absolute rounded-lg p-1 transition-[left,top,width,height,box-shadow] duration-200 ease-out",r&&"cursor-grab active:cursor-grabbing",p&&"duration-150",i&&!a&&"z-20 shadow-sm",a&&"z-30 transition-none"),style:{left:g,top:v,width:x,height:y},onPointerDown:function(i){if(!r||a)return;let s=i.target;if(s instanceof HTMLElement&&s.closest("[data-dashboard-action]"))return;i.preventDefault(),i.currentTarget.setPointerCapture(i.pointerId),o();let c=i.clientX,d=i.clientY;function u(r){let i=fm({...e,x:e.x+Math.round((r.clientX-c)/(n+12)),y:e.y+Math.round((r.clientY-d)/(n+12))});fp(i,t,e.id)||l(i)}m(!0),window.addEventListener("pointermove",u),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",u),window.removeEventListener("pointerup",e),m(!1)})},onClick:()=>{r&&o()},children:[(0,eb.jsx)("div",{className:tK("size-full",r&&"pointer-events-none"),children:h}),i&&r&&!a?(0,eb.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none absolute inset-1 rounded-lg border-2 border-foreground"}):null,i&&r&&!a?(0,eb.jsx)(etr,{onSettingsOpen:d,onCut:s,onCopy:c,onResizeStart:u}):null,a?(0,eb.jsx)(eti,{layout:e,layouts:t,cellSize:n,onResize:l,onResizeEnd:f}):null]})}function etr({onSettingsOpen:e,onCut:t,onCopy:n,onResizeStart:r}){return(0,eb.jsx)(cn,{"data-dashboard-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,eb.jsxs)(cr,{children:[(0,eb.jsx)(ci,{type:"button","aria-label":"调整大小",onClick:r,children:(0,eb.jsx)(s3,{className:"size-4"})}),(0,eb.jsx)(ci,{type:"button","aria-label":"卡片设置",onPointerDown:t=>{t.preventDefault(),t.stopPropagation(),e()},onClick:e=>e.stopPropagation(),children:(0,eb.jsx)(mf,{className:"size-4"})}),(0,eb.jsx)(ci,{type:"button","aria-label":"复制",onClick:n,children:(0,eb.jsx)(s0,{className:"size-4"})}),(0,eb.jsx)(ci,{type:"button","aria-label":"剪切",onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),t()},onClick:e=>e.stopPropagation(),children:(0,eb.jsx)(ce,{className:"size-4"})})]})})}function eti({layout:e,layouts:t,cellSize:n,onResize:r,onResizeEnd:i}){return(0,eb.jsx)("div",{"data-dashboard-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(a=>(0,eb.jsx)("button",{type:"button","aria-label":`调整 ${a.id}`,className:tK("pointer-events-auto absolute size-2.5 border border-foreground bg-background shadow-sm",a.className),onPointerDown:o=>(function(a,o){a.preventDefault(),a.stopPropagation(),a.currentTarget.setPointerCapture(a.pointerId);let l=a.clientX,s=a.clientY;function c(i){let a=Math.round((i.clientX-l)/(n+12)),c=Math.round((i.clientY-s)/(n+12)),d={...e};o.includes("right")&&(d.w=e.w+a),o.includes("bottom")&&(d.h=e.h+c),o.includes("left")&&(d.x=e.x+a,d.w=e.w-a),o.includes("top")&&(d.y=e.y+c,d.h=e.h-c),fp(d=fm(d),t,e.id)||r(d)}window.addEventListener("pointermove",c),window.addEventListener("pointerup",function e(){window.removeEventListener("pointermove",c),window.removeEventListener("pointerup",e),i()})})(o,a.id)},a.id))})}function eta({open:e,layout:t,definition:n,config:r,cellSize:i,onOpenChange:a,onConfigChange:o}){let l=t&&i>0?t.w*i+(t.w-1)*12:320,s=t&&i>0?t.h*i+(t.h-1)*12:180;return(0,eb.jsx)(po,{open:e,onOpenChange:a,children:(0,eb.jsx)(mv,{side:"right",className:"w-screen gap-0 border-0 bg-transparent p-0 shadow-none sm:max-w-none",children:t&&n&&r?(0,eb.jsxs)("div",{className:"grid h-full min-w-0 grid-cols-1 lg:grid-cols-[minmax(0,1fr)_24rem]",children:[(0,eb.jsx)(eto,{width:l,height:s,className:"hidden lg:grid",children:n.render(r)}),(0,eb.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,eb.jsxs)(mx,{className:"border-b",children:[(0,eb.jsx)(my,{children:"卡片设置"}),(0,eb.jsxs)(mb,{children:[n.title," · ",t.w,"x",t.h]})]}),(0,eb.jsxs)("div",{className:"grid flex-1 content-start gap-4 overflow-y-auto p-4",children:[(0,eb.jsxs)("label",{className:"grid gap-1.5",children:[(0,eb.jsx)("span",{className:"ui-text-control font-medium",children:"显示标题"}),(0,eb.jsx)(ny,{value:r.title,onChange:e=>o({title:e.currentTarget.value})})]}),(0,eb.jsxs)("label",{className:"grid gap-1.5",children:[(0,eb.jsx)("span",{className:"ui-text-control font-medium",children:"数据来源"}),(0,eb.jsx)(ny,{value:r.dataSource,onChange:e=>o({dataSource:e.currentTarget.value})})]}),(0,eb.jsxs)("label",{className:"grid gap-1.5",children:[(0,eb.jsx)("span",{className:"ui-text-control font-medium",children:"刷新间隔"}),(0,eb.jsx)(ny,{value:r.refreshRate,onChange:e=>o({refreshRate:e.currentTarget.value})})]}),(0,eb.jsxs)("label",{className:"grid gap-1.5",children:[(0,eb.jsx)("span",{className:"ui-text-control font-medium",children:"备注"}),(0,eb.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,eb.jsxs)("div",{className:"rounded-lg border bg-muted/20 p-3",children:[(0,eb.jsx)("div",{className:"ui-text-control font-medium",children:"当前绑定"}),(0,eb.jsxs)("div",{className:"mt-2 grid gap-1 ui-text-kbd text-muted-foreground",children:[(0,eb.jsxs)("span",{children:["类型:",n.id]}),(0,eb.jsxs)("span",{children:["来源:",r.dataSource]}),(0,eb.jsxs)("span",{children:["刷新:",r.refreshRate]})]})]})]})]})]}):null})})}function eto({width:e,height:t,className:n,children:r}){let[i,a]=f3(),o=a.width>0&&a.height>0?Math.min(1,(a.width-32)/e,(a.height-32)/t):1;return(0,eb.jsx)("div",{ref:i,className:tK("min-h-0 min-w-0 place-items-center overflow-hidden p-4",n),children:(0,eb.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 etl(){return ew.useMemo(()=>[{id:"active-runs",title:ez.activeRuns,description:"当前正在执行的 Agent 运行数量。",icon:(0,eb.jsx)(BY,{className:"size-4"}),defaultSize:{w:3,h:1},defaultConfig:{title:ez.activeRuns,dataSource:"本机运行队列",refreshRate:"5s",note:"统计所有未完成的运行。"},render:e=>(0,eb.jsx)(FR,{label:e.title,value:"18",jellyImage:u4,jellyImagePosition:"center"})},{id:"queue",title:ez.queue,description:"排队等待调度的任务数量。",icon:(0,eb.jsx)(Hg,{className:"size-4"}),defaultSize:{w:3,h:1},defaultConfig:{title:ez.queue,dataSource:"调度器",refreshRate:"5s",note:"用于观察调度压力。"},render:e=>(0,eb.jsx)(FR,{label:e.title,value:"7",jellyImage:u3,jellyImagePosition:"center"})},{id:"cost",title:ez.cost,description:"今日模型、工具和机器资源消耗。",icon:(0,eb.jsx)(FA,{className:"size-4"}),defaultSize:{w:3,h:1},defaultConfig:{title:ez.cost,dataSource:"用量聚合",refreshRate:"1m",note:"后续可接入工作组账单。"},render:e=>(0,eb.jsx)(FR,{label:e.title,value:"$42.8",jellyImage:u6,jellyImagePosition:"center"})},{id:"machines-summary",title:ez.machineStatus,description:"工作组内可用机器概况。",icon:(0,eb.jsx)(F_,{className:"size-4"}),defaultSize:{w:3,h:1},defaultConfig:{title:ez.machineStatus,dataSource:"工作组机器",refreshRate:"15s",note:"包含本机、直连机器和 P2P 节点。"},render:e=>(0,eb.jsx)(FR,{label:e.title,value:"2 / 3",jellyImage:u8,jellyImagePosition:"center"})},{id:"resource-trend",title:ez.resourceTrend,description:"CPU 与内存趋势图。",icon:(0,eb.jsx)(FL,{className:"size-4"}),defaultSize:{w:8,h:4},defaultConfig:{title:ez.resourceTrend,dataSource:"机器遥测",refreshRate:"10s",note:"默认显示最近 6 个采样点。"},render:e=>(0,eb.jsx)(F$,{title:e.title})},{id:"run-mix",title:ez.runMix,description:"不同类型 Agent 运行的占比。",icon:(0,eb.jsx)(mR,{className:"size-4"}),defaultSize:{w:4,h:4},defaultConfig:{title:ez.runMix,dataSource:"运行记录",refreshRate:"30s",note:"用于快速观察任务类型构成。"},render:e=>(0,eb.jsx)(VU,{title:e.title})},{id:"machine-status",title:ez.machineStatus,description:"各机器 CPU、内存、GPU 与磁盘状态。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:8,h:5},defaultConfig:{title:ez.machineStatus,dataSource:"工作组机器",refreshRate:"10s",note:"用于运维总览的核心资源面板。"},render:e=>(0,eb.jsx)(FD,{title:e.title})},{id:"schedule",title:ez.schedule,description:"维护窗口、提醒和自动化计划。",icon:(0,eb.jsx)(VG,{className:"size-4"}),defaultSize:{w:4,h:5},defaultConfig:{title:ez.schedule,dataSource:"本机日程",refreshRate:"5m",note:"之后可接工作组日程。"},render:e=>(0,eb.jsx)(VX,{title:e.title})}],[])}function ets({clipboardItems:e,onClipboardItemsChange:t,onOverlayOpenChange:n}){let[r,i]=ew.useState(!1),[a,o]=ew.useState(!1),[l,s]=ew.useState(!1),[c,d]=ew.useState(ff),[u,f]=ew.useState({}),[h,p]=ew.useState(),[m,g]=ew.useState(),[v,x]=ew.useState(),y=ew.useRef(0),b=ew.useRef(0),[w,j]=f3(),k=j.width>0?(j.width-132)/12:96,S=Math.max(9,fh(c)+2),C=S*k+(S-1)*12,N=etl(),M=ew.useMemo(()=>new Map(N.map(e=>[e.id,e])),[N]);function E(e){let t=M.get(e.kind);return u[e.id]??(t?fv(t):void 0)}function O(e){d(t=>{let n=fm(e);return fp(n,t,n.id)?t:t.map(e=>e.id===n.id?n:e)})}ew.useEffect(()=>{n(a||!!v)},[a,n,v]),ew.useEffect(()=>()=>n(!1),[n]),ew.useEffect(()=>{l||(p(void 0),g(void 0))},[l]),ew.useEffect(()=>{if(m)return window.addEventListener("pointerdown",e),()=>window.removeEventListener("pointerdown",e);function e(e){let t=e.target;t instanceof HTMLElement&&t.closest("[data-dashboard-action]")||(p(m),g(void 0))}},[m]);let P=v?c.find(e=>e.id===v):void 0,A=P?M.get(P.kind):void 0,z=P?E(P):void 0;return(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("div",{ref:w,"data-dashboard-board":!0,className:tK("relative mx-auto max-w-7xl p-4 lg:p-6",l&&"select-none"),style:{minHeight:C+48},onDragOver:e=>{Array.from(e.dataTransfer.types).includes("application/vnd.vantaloom.dashboard-widget-kind")&&(e.preventDefault(),e.dataTransfer.dropEffect="move")},onDrop:function(t){let n=t.dataTransfer.getData("application/vnd.vantaloom.clip-id"),r=t.dataTransfer.getData("application/vnd.vantaloom.dashboard-widget-kind");if(!n||!r)return;let i=e.find(e=>e.id===n);if(!i)return;t.preventDefault(),t.stopPropagation(),t.dataTransfer.dropEffect="move";let a=w.current,o=a?.getBoundingClientRect();!function(e,t){let n=fx(e);if(!n)return;b.current+=1;let r=`${n.kind}-clip-${b.current}`,i=fm({id:r,kind:n.kind,x:t?.x??0,y:t?.y??fh(c),w:n.w,h:n.h}),a=t&&!fp(i,c)?i:fg(c,r,n.kind,n.w,n.h);d(e=>[...e,a]),f(e=>({...e,[r]:{...n.config}})),p(r),g(void 0)}(i,{x:o&&k>0?Math.round((t.clientX-o.left-24)/(k+12)):0,y:o&&k>0?Math.round((t.clientY-o.top-24)/(k+12)):fh(c)})},onPointerDown:e=>{e.target===e.currentTarget&&(p(void 0),l||g(void 0))},children:(0,eb.jsx)("div",{className:"relative",style:{height:C},children:c.map(e=>{let n=N.find(t=>t.id===e.kind);if(!n)return null;let r=E(e);return r?(0,eb.jsx)(etn,{layout:e,layouts:c,cellSize:k,dragMode:l,selected:h===e.id,resizing:m===e.id,onSelect:()=>{l&&p(e.id)},onMove:O,onCut:()=>(function(e){let n=c.find(t=>t.id===e),r=n?M.get(n.kind):void 0,i=n?E(n):void 0;if(!n||!r||!i)return;let a=function({layout:e,definition:t,config:n}){let r={kind:e.kind,w:e.w,h:e.h,config:{...n}};return{id:`clip-${e.id}`,title:n.title||t.title,description:t.description,meta:`${e.w}x${e.h}`,icon:t.icon,dragData:{"application/vnd.vantaloom.clip-kind":"dashboard-widget","application/vnd.vantaloom.dashboard-widget-kind":e.kind,"application/vnd.vantaloom.dashboard-widget-width":String(e.w),"application/vnd.vantaloom.dashboard-widget-height":String(e.h),"application/vnd.vantaloom.dashboard-widget-config":JSON.stringify(n)},payloads:{[fi]:r}}}({layout:n,definition:r,config:i});t(e=>[a,...e.filter(e=>e.id!==a.id)]),d(t=>t.filter(t=>t.id!==e)),f(t=>{let n={...t};return delete n[e],n}),p(void 0),g(void 0),x(t=>t===e?void 0:t)})(e.id),onCopy:()=>(function(e){let t=c.find(t=>t.id===e);if(!t)return;y.current+=1;let n=`${e}-copy-${y.current}`,r=fg(c,n,t.kind,t.w,t.h);d(e=>[...e,r]),f(r=>({...r,[n]:r[e]??fv(M.get(t.kind))})),p(n)})(e.id),onSettingsOpen:()=>x(e.id),onResizeStart:()=>{p(void 0),g(e.id)},onResizeEnd:()=>{p(e.id),g(void 0)},children:n.render(r)},e.id):null})})}),(0,eb.jsx)(ett,{open:r,dragMode:l,onOpenChange:i,onAdd:()=>{i(!1),o(!0)},onDragModeChange:s}),(0,eb.jsx)(ete,{open:a,definitions:N,onOpenChange:o,onAdd:function(e){let t=M.get(e);if(!t)return;b.current+=1;let n=`${e}-added-${b.current}`,r=fg(c,n,e,t.defaultSize.w,t.defaultSize.h);d(e=>[...e,r]),f(e=>({...e,[n]:fv(t)})),p(n),g(void 0),o(!1)}}),(0,eb.jsx)(eta,{open:!!(P&&A&&z),layout:P,definition:A,config:z,cellSize:k,onOpenChange:e=>{e||x(void 0)},onConfigChange:e=>{var t;let n,r;P&&(t=P.id,r=(n=c.find(e=>e.id===t))?M.get(n.kind):void 0,n&&r&&f(n=>({...n,[t]:{...n[t]??fv(r),...e}})))}})]})}let etc={delete:"Delete",empty:"Drop here",title:"Trash"};function etd({active:e=!1,items:t=[],labels:n,className:r,onDrop:i,onDelete:a,onItemRestore:o,...l}){let s={...etc,...n},[c,d]=ew.useState(!1),u=ew.useRef(0),f=e||c||t.length>0;return ew.useEffect(()=>{e||(u.current=0,d(!1))},[e]),(0,eb.jsx)("div",{"data-slot":"trash-drop-zone","data-visible":f,"data-drag-inside":c,className:tK("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(),u.current+=1,d(!0)},onDragLeave:function(){u.current=Math.max(0,u.current-1),0===u.current&&d(!1)},onDragOver:function(e){e.preventDefault(),e.dataTransfer.dropEffect="move",d(!0)},onDrop:function(e){e.preventDefault(),e.stopPropagation(),u.current=0,d(!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&&i?.({id:t,title:n,meta:r,nativeEvent:e})},...l,children:(0,eb.jsx)("div",{className:tK("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,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.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,eb.jsx)(m2,{className:"size-4"}),(0,eb.jsx)("span",{children:s.empty})]}),t.length>0?(0,eb.jsx)("div",{className:"grid max-h-36 gap-1 overflow-y-auto pr-1",children:t.map(e=>(0,eb.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,eb.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,eb.jsx)(p6,{className:"size-3.5"})}),(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate text-xs font-medium",children:e.title}),e.meta?(0,eb.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground",children:e.meta}):null]},e.id))}):null,t.length>0?(0,eb.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:()=>a?.(t),children:s.delete}):null]}):(0,eb.jsx)(m2,{className:"size-5"})})})}function etu({hidden:e,items:t,trashItems:n,trashClipboardItems:r,draggingId:i,onDraggingChange:a,onItemsChange:o,onTrashItemsChange:l,onTrashClipboardItemsChange:s}){let c=ew.useRef(0),[d,u]=ew.useState(!1);return(ew.useEffect(()=>{u(!0)},[]),d)?(0,t3.createPortal)((0,eb.jsxs)("div",{className:tK("pointer-events-none fixed inset-0 z-40 overflow-visible transition-opacity duration-200",e&&"opacity-0"),children:[(0,eb.jsx)(etd,{active:!e&&void 0!==i,items:e?[]:n,className:tK(e&&"pointer-events-none"),labels:{delete:"删除",empty:"拖入暂存"},onDrop:({id:e,title:n,meta:r})=>{let i=t.find(t=>t.id===e);i&&(s(t=>({...t,[e]:i})),l(t=>t.some(t=>t.id===e)?t:[...t,{id:e,title:n,meta:r,icon:i.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,eb.jsx)("div",{className:tK("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,eb.jsx)(Q_,{items:t,title:"剪切板",labels:{empty:"剪切板为空",dragHandle:"拖拽卡片"},expansionDirection:"down-left",removeOnExternalDrop:!0,maxExpandedHeight:420,onItemDuplicate:(e,{item:n,index:r})=>{let i,a,l,s,d;return c.current+=1,i=fx(n),a=n.payloads?{...n.payloads}:void 0,l=n.payloads?.[fa],i&&a&&(a[fi]={...i,config:{...i.config}}),l&&a&&(a[fa]={...l,config:l.config?{...l.config}:l.config}),s={...n,id:`${n.id}-copy-${c.current}`,title:`${n.title} copy`,payloads:a,dragData:{...n.dragData,...i?{"application/vnd.vantaloom.dashboard-widget-config":JSON.stringify(i.config)}:{}}},void((d=[...t]).splice(r+1,0,s),o(d))},onItemsRemove:e=>o(e),onItemsReorder:e=>o(e),onItemDragStart:({item:e})=>a(e.id),onItemDragEnd:()=>a(void 0)})}):null]}),document.body):null}let etf=ew.createContext(96);function eth(e,t){let n=e[t];if(!n)throw Error(`Missing static grid layout: ${t}`);return n}function etp({layouts:e,minRows:t=9,className:n,children:r,...i}){let[a,o]=f3(),l=o.width>0?(o.width-132)/12:96,s=Math.max(t,e.reduce((e,t)=>Math.max(e,t.y+t.h),0)+2),c=s*l+(s-1)*12;return(0,eb.jsx)("div",{ref:a,className:tK("relative mx-auto max-w-7xl p-4 lg:p-6",n),style:{minHeight:c+48},...i,children:(0,eb.jsx)("div",{className:"relative",style:{height:c},children:(0,eb.jsx)(etf.Provider,{value:l,children:r})})})}function etm({layout:e,className:t,style:n,...r}){let i=ew.useContext(etf);return(0,eb.jsx)("div",{className:tK("absolute min-w-0",t),style:{left:e.x*(i+12),top:e.y*(i+12),width:e.w*i+(e.w-1)*12,height:e.h*i+(e.h-1)*12,...n},...r})}let etg=[{id:"firewall",x:0,y:0,w:12,h:8}],etv=f4(etg);function etx(){var e;return e=(0,eb.jsx)(etp,{layouts:etg,children:(0,eb.jsx)(etm,{layout:eth(etv,"firewall"),className:"vtl-firewall-card overflow-hidden rounded-xl border bg-card",children:(0,eb.jsx)(Qg,{})})}),(0,eb.jsx)(f5,{children:e})}let ety=eN("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"}]]),etb=eN("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"}]]),etw=eN("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"}]]),etj=eN("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"}]]),etk=eN("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"}]]),etS=[{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}],etC=[{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}],etN=[{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"}],etM=[["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","失败"]],etE={cpu:{label:"CPU",color:"var(--chart-1)"},memory:{label:"Memory",color:"var(--chart-3)"},network:{label:"Network",color:"var(--chart-5)"}};function etO(e,t,n=42,r){return(0,eb.jsx)("section",{className:tK("size-full rounded-xl border bg-card p-5",r&&"vtl-jelly-image-card",r&&u7(r)&&"vtl-jelly-image-card-shadowless"),style:r?u9({image:r,opacity:.74,blur:"8px"}):void 0,children:(0,eb.jsx)(mM,{label:e,value:t,minSize:n})})}function etP(e,t,n=""){return{title:e,dataSource:t,refreshRate:"10s",note:n}}let etA={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]}]},etz=[{id:"metric-runs",title:"运行中",description:"当前正在执行的运行数量。",icon:(0,eb.jsx)(BY,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etP("运行中","运行队列"),render:e=>etO(e.title,"07",44,u4)},{id:"metric-queued",title:"排队",description:"等待调度的任务数量。",icon:(0,eb.jsx)(Hg,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etP("排队","调度器"),render:e=>etO(e.title,"04",44,u3)},{id:"metric-blocked",title:"待确认",description:"等待人工确认的任务数量。",icon:(0,eb.jsx)(etk,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etP("待确认","确认队列"),render:e=>etO(e.title,"03",44,u6)},{id:"metric-workers",title:"Worker",description:"当前可调度 worker 数量。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etP("Worker","Agent worker"),render:e=>etO(e.title,"14",44,u8)},{id:"queue",title:"任务队列",description:"运行队列 Roadmap。",icon:(0,eb.jsx)(etw,{className:"size-4"}),defaultSize:{w:7,h:5},defaultConfig:etP("任务队列","运行队列"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(Bz,{items:etS})]})},{id:"workers",title:"Agent worker",description:"各 worker 的负载和容量。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:5,h:5},defaultConfig:etP("Agent worker","Worker 状态"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(BI,{workers:etC})]})},{id:"log",title:"最近执行",description:"最近执行记录 Roadmap。",icon:(0,eb.jsx)(g7,{className:"size-4"}),defaultSize:{w:7,h:4},defaultConfig:etP("最近执行","执行日志"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(BA,{items:etM})]})},{id:"confirmations",title:"待确认",description:"等待人工确认的事项。",icon:(0,eb.jsx)(VK,{className:"size-4"}),defaultSize:{w:5,h:4},defaultConfig:etP("待确认","确认队列"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(BP,{items:etN})]})}],et_=[{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 etI(e=etA){return[{id:"metric-online",title:"在线机器",description:"当前在线机器数量。",icon:(0,eb.jsx)(F_,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etP("在线机器","机器心跳"),render:t=>etO(t.title,String(e.metrics.online),44,u4)},{id:"metric-health",title:"健康度",description:"工作组整体健康度。",icon:(0,eb.jsx)(WJ,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etP("健康度","服务遥测"),render:t=>etO(t.title,`${e.metrics.health}%`,44,u3)},{id:"metric-latency",title:"平均延迟",description:"机器连接平均延迟。",icon:(0,eb.jsx)(FI,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etP("平均延迟","网络遥测"),render:t=>etO(t.title,e.metrics.latency,44,u6)},{id:"metric-events",title:"事件",description:"最近事件数量。",icon:(0,eb.jsx)(VK,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etP("事件","事件流"),render:t=>etO(t.title,String(e.metrics.events),44,u8)},{id:"machines",title:"机器健康矩阵",description:"各机器资源和心跳状态。",icon:(0,eb.jsx)(F_,{className:"size-4"}),defaultSize:{w:7,h:5},defaultConfig:etP("机器健康矩阵","机器遥测"),render:t=>(0,eb.jsxs)("section",{className:"vtl-jelly-image-card flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",style:u9({image:"/themes/jelly/card1.png",opacity:.88,blur:"10px"}),children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(BL,{machines:e.machines})]})},{id:"trend",title:"资源趋势",description:"CPU、内存和网络趋势。",icon:(0,eb.jsx)(ety,{className:"size-4"}),defaultSize:{w:5,h:5},defaultConfig:etP("资源趋势","机器遥测"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(BH,{config:etE,data:e.trend})]})},{id:"network",title:"网络连接",description:"机器之间连接状态。",icon:(0,eb.jsx)(m$,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:etP("网络连接","网络遥测"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(BB,{links:e.networkLinks})]})},{id:"events",title:"事件流",description:"最近遥测事件。",icon:(0,eb.jsx)(VK,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:etP("事件流","事件流"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(BR,{events:e.events})]})},{id:"services",title:"服务健康",description:"服务 30 分钟粒度健康条。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:12,h:3},defaultConfig:etP("服务健康","服务遥测"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(BW,{services:e.serviceHealth})]})}]}let etD=etI(),etT=[{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}],etR={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:Z6,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 etL(e=etR){return[{id:"total",title:"机器",description:"工作组机器总数。",icon:(0,eb.jsx)(F_,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etP("机器","机器组"),render:t=>etO(t.title,String(e.totals.machines),42,u4)},{id:"online",title:"在线",description:"当前在线机器。",icon:(0,eb.jsx)(WJ,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etP("在线","机器心跳"),render:t=>etO(t.title,String(e.totals.online),42,u3)},{id:"runtime",title:"Runtime",description:"可用 runtime 数量。",icon:(0,eb.jsx)(eP,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etP("Runtime","Agent runtime"),render:t=>etO(t.title,String(e.totals.runtime),42,u6)},{id:"tokens",title:"Token",description:"已注册 token 数。",icon:(0,eb.jsx)(etk,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etP("Token","机器注册"),render:t=>etO(t.title,String(e.totals.tokens),42,u8)},{id:"machines",title:"机器组",description:"机器角色、版本和标签。",icon:(0,eb.jsx)(F_,{className:"size-4"}),defaultSize:{w:12,h:4},defaultConfig:etP("机器组","机器组"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(VJ,{machines:e.machines})]})},{id:"topology",title:"拓扑图",description:"工作组连接拓扑。",icon:(0,eb.jsx)(etj,{className:"size-4"}),defaultSize:{w:12,h:6},defaultConfig:etP("拓扑图","网络拓扑"),render:()=>(0,eb.jsx)("section",{className:"size-full rounded-xl border bg-card p-3",children:(0,eb.jsx)(BE,{nodes:e.topology.nodes,links:e.topology.links})})},{id:"direct",title:"直连",description:"直连路径数量。",icon:(0,eb.jsx)(m$,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etP("直连","网络拓扑"),render:t=>etO(t.title,String(e.pathTotals.direct),42,u4)},{id:"p2p",title:"P2P",description:"P2P 路径数量。",icon:(0,eb.jsx)(FI,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etP("P2P","网络拓扑"),render:t=>etO(t.title,String(e.pathTotals.p2p),42,u3)},{id:"relay",title:"Relay",description:"Relay 路径数量。",icon:(0,eb.jsx)(etj,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etP("Relay","网络拓扑"),render:t=>etO(t.title,String(e.pathTotals.relay),42,u6)},{id:"broken",title:"中断",description:"中断路径数量。",icon:(0,eb.jsx)(etk,{className:"size-4"}),defaultSize:{w:3,h:2},defaultConfig:etP("中断","网络拓扑"),render:t=>etO(t.title,String(e.pathTotals.broken),42,u8)},{id:"trend",title:"延迟",description:"不同路径延迟趋势。",icon:(0,eb.jsx)(ety,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:etP("延迟","网络遥测"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(Bw,{config:Z7,data:e.latency})]})},{id:"paths",title:"候选路径",description:"可用连接路径候选。",icon:(0,eb.jsx)(etj,{className:"size-4"}),defaultSize:{w:6,h:4},defaultConfig:etP("候选路径","网络候选路径"),render:t=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:t.title}),(0,eb.jsx)(Bj,{candidates:e.candidates})]})}]}let et$=etL(),etF=[{id:"total",kind:"total",x:0,y:0,w:3,h:2},{id:"online",kind:"online",x:3,y:0,w:3,h:2},{id:"runtime",kind:"runtime",x:6,y:0,w:3,h:2},{id:"tokens",kind:"tokens",x:9,y:0,w:3,h:2},{id:"machines",kind:"machines",x:0,y:2,w:12,h:4},{id:"topology",kind:"topology",x:0,y:6,w:12,h:6},{id:"direct",kind:"direct",x:0,y:12,w:3,h:2},{id:"p2p",kind:"p2p",x:3,y:12,w:3,h:2},{id:"relay",kind:"relay",x:6,y:12,w:3,h:2},{id:"broken",kind:"broken",x:9,y:12,w:3,h:2},{id:"trend",kind:"trend",x:0,y:14,w:6,h:4},{id:"paths",kind:"paths",x:6,y:14,w:6,h:4}],etV=[{id:"events",title:"日志与审计",description:"审计事件时间线。",icon:(0,eb.jsx)(etw,{className:"size-4"}),defaultSize:{w:8,h:7},defaultConfig:etP("日志与审计","审计事件"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(bj,{events:Z8})]})},{id:"filters",title:"筛选",description:"审计记录筛选维度。",icon:(0,eb.jsx)(etb,{className:"size-4"}),defaultSize:{w:4,h:3},defaultConfig:etP("筛选","审计筛选"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(bw,{rows:[["机器","4"],["用户","4"],["Agent","6"],["时间","24h"]]})]})},{id:"risk",title:"拒绝事件",description:"权限拒绝和危险操作数量。",icon:(0,eb.jsx)(etk,{className:"size-4"}),defaultSize:{w:4,h:4},defaultConfig:etP("拒绝事件","审计事件"),render:e=>etO(e.title,"05",42,"/themes/jelly/bg5.png")},{id:"trend",title:"事件趋势",description:"审计事件趋势图。",icon:(0,eb.jsx)(ety,{className:"size-4"}),defaultSize:{w:12,h:4},defaultConfig:etP("事件趋势","审计事件"),render:e=>(0,eb.jsxs)("section",{className:"flex size-full flex-col overflow-hidden rounded-xl border bg-card p-3",children:[(0,eb.jsx)(ft,{title:e.title}),(0,eb.jsx)(FC,{config:Z7,data:Z6})]})}],etB=[{id:"events",kind:"events",x:0,y:0,w:8,h:7},{id:"filters",kind:"filters",x:8,y:0,w:4,h:3},{id:"risk",kind:"risk",x:8,y:3,w:4,h:4},{id:"trend",kind:"trend",x:0,y:7,w:12,h:4}],etH={totals:{machines:0,online:0,runtime:0,tokens:0},machines:[],topology:{nodes:[],links:[]},pathTotals:{direct:0,p2p:0,relay:0,broken:0},latency:[],candidates:[]},etW={metrics:{online:0,health:0,latency:"local",events:0},machines:[],trend:[],networkLinks:[],events:[],serviceHealth:[]};function etq(e,t){let[n,r]=ew.useState(t);return ew.useEffect(()=>{let n=!0,i=!1;async function a(){if(!i){i=!0;try{let t=await fetch(e,{cache:"no-store"});if(!t.ok)return;let i=await t.json();n&&r(i)}catch{n&&r(t)}finally{i=!1}}}a();let o=window.setInterval(a,2e3);return()=>{n=!1,window.clearInterval(o)}},[t,e]),n}function etU(e){return(0,eb.jsx)(f5,{children:e})}function etK({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){let r=etq("/api/local/machines/fleet",etH),i=ew.useMemo(()=>etL(r),[r]);return(0,eb.jsx)(mk,{boardId:"machine-group",definitions:i,initialLayouts:etF,clipboardItems:e,actionLabel:"机器组页面卡片操作",paletteGroupTitle:"机器组页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}let etG=[{id:"processes",x:0,y:0,w:12,h:8}],etY=f4(etG);function etX(){return etU((0,eb.jsx)(etp,{layouts:etG,children:(0,eb.jsx)(etm,{layout:eth(etY,"processes"),className:"overflow-hidden",children:(0,eb.jsx)(eeg,{})})}))}let etZ=[{id:"performance",x:0,y:0,w:12,h:8}],etJ=f4(etZ);function etQ(){return etU((0,eb.jsx)(etp,{layouts:etZ,children:(0,eb.jsx)(etm,{layout:eth(etJ,"performance"),className:"overflow-hidden",children:(0,eb.jsx)(eev,{})})}))}function et0({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){return(0,eb.jsx)(mk,{boardId:"audit-logs",definitions:etV,initialLayouts:etB,clipboardItems:e,actionLabel:"日志审计页面卡片操作",paletteGroupTitle:"日志审计页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}let et1=eN("folder-tree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]),et2=eN("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"}]]),et5=eN("scroll-text",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]),et4=eN("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]),et3=[{id:"dashboard",label:e_.dashboard,icon:(0,eb.jsx)(etb,{})},{id:"canvas",label:e_.canvas,icon:(0,eb.jsx)(Hv,{}),badge:"4"},{id:"machines",label:e_.machines,icon:(0,eb.jsx)(F_,{})},{id:"schedules",label:e_.schedules,icon:(0,eb.jsx)(VG,{})},{id:"settings",label:e_.settings,icon:(0,eb.jsx)(mf,{})}],et6=[{id:"dashboard",title:e_.dashboard,description:ez.subtitle,sections:[{id:"main",items:[{id:"overview",label:e_.overview,icon:(0,eb.jsx)(vj,{})},{id:"runs",label:e_.runs,icon:(0,eb.jsx)(BY,{}),badge:"12"},{id:"telemetry",label:e_.telemetry,icon:(0,eb.jsx)(Hg,{})}]}]},{id:"canvas",title:e_.canvas,description:"节点画布、Agent 对话和运行工作区。",sections:[{id:"canvases",title:e_.canvas,items:[{id:"open-recent-canvas",label:e_.canvasRecent,icon:(0,eb.jsx)(Hv,{})},{id:"new-canvas",label:e_.canvasNew,icon:(0,eb.jsx)(s7,{})},{id:"all-canvases",label:e_.canvasAll,icon:(0,eb.jsx)(FA,{})}]},{id:"conversations",title:"Agent 对话",items:[{id:"open-recent-conversation",label:e_.conversationRecent,icon:(0,eb.jsx)(et2,{})},{id:"new-agent-conversation",label:e_.conversationNew,icon:(0,eb.jsx)(mR,{})},{id:"all-conversations",label:e_.conversationAll,icon:(0,eb.jsx)(BY,{})}]}]},{id:"machines",title:e_.machines,description:"机器、网络、权限和审计。",sections:[{id:"machines",items:[{id:"machine-group",label:e_.fleet,icon:(0,eb.jsx)(eP,{})},{id:"process-management",label:"进程管理",icon:(0,eb.jsx)(et4,{})},{id:"machine-performance",label:"性能",icon:(0,eb.jsx)(Hg,{})},{id:"machine-firewall",label:"防火墙",icon:(0,eb.jsx)(Qw,{})},{id:"audit-logs",label:"日志与审计",icon:(0,eb.jsx)(et5,{})},{id:"machine-files",label:"文件管理",icon:(0,eb.jsx)(et1,{})}]}]},{id:"schedules",title:e_.schedules,description:"自动化、维护窗口和提醒。",sections:[{id:"plans",items:[{id:"calendar",label:e_.calendar,icon:(0,eb.jsx)(VG,{})},{id:"alerts",label:"提醒",icon:(0,eb.jsx)(VK,{})}]}]},{id:"settings",title:e_.settings,description:"系统、工作组和用量配置。",sections:[{id:"settings",items:[{id:"preferences",label:"偏好设置",icon:(0,eb.jsx)(mf,{})},{id:"card-management",label:"卡片管理",icon:(0,eb.jsx)(etb,{})},{id:"billing",label:e_.billing,icon:(0,eb.jsx)(FA,{})}]}]}],et8=eN("files",[["path",{d:"M15 2h-4a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"14sh0y"}],["path",{d:"M16.706 2.706A2.4 2.4 0 0 0 15 2v5a1 1 0 0 0 1 1h5a2.4 2.4 0 0 0-.706-1.706z",key:"1970lx"}],["path",{d:"M5 7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h8a2 2 0 0 0 1.732-1",key:"l4dndm"}]]);function et7({className:e,divided:t=!0,children:n,...r}){let i=ew.Children.toArray(n).filter(Boolean);return(0,eb.jsx)("div",{"data-slot":"settings-card",className:tK("vtl-surface-card overflow-hidden rounded-[var(--surface-card-radius)] border",e),...r,children:t?i.map((e,t)=>(0,eb.jsxs)(ew.Fragment,{children:[e,t<i.length-1&&(0,eb.jsx)(VY,{})]},t)):n})}let et9=[{id:"cards",x:0,y:0,w:12,h:9}],ene=f4(et9),ent=[{id:"machine-workspaces",title:"机器页面",cards:[{id:"process-management",title:"进程管理",description:"机器进程、服务和 Agent worker 进程视图。",icon:(0,eb.jsx)(et4,{className:"size-4"}),defaultSize:{w:12,h:8},dataSource:"机器进程"},{id:"machine-performance",title:"性能",description:"CPU、内存、磁盘、网络和 GPU 性能视图。",icon:(0,eb.jsx)(ety,{className:"size-4"}),defaultSize:{w:12,h:8},dataSource:"机器遥测"},{id:"firewall",title:"防火墙",description:"防火墙策略、IP 地址、续期和申请视图。",icon:(0,eb.jsx)(Qw,{className:"size-4"}),defaultSize:{w:12,h:8},dataSource:"防火墙策略"},{id:"file-manager-window",title:"文件管理窗口",description:"可拖拽、缩放和多窗口并存的文件管理组件。",icon:(0,eb.jsx)(et8,{className:"size-4"}),defaultSize:{w:6,h:5},dataSource:"工作区文件"}]}];function enn(e){return{id:e.id,title:e.title,description:e.description,icon:e.icon,defaultSize:e.defaultSize,dataSource:e.defaultConfig.dataSource}}function enr(e){return{id:e.id,title:e.title,description:e.description,icon:e.icon,defaultSize:e.defaultSize,dataSource:e.defaultConfig.dataSource}}function eni(){let e=etl(),[t,n]=ew.useState(),r=ew.useCallback(()=>{},[]),i=ew.useCallback(()=>{},[]),a=ew.useMemo(()=>B2({onSelect:r}),[r]),o=ew.useMemo(()=>B4({onSelect:i}),[i]),l=ew.useMemo(()=>[{id:"dashboard",title:"运维总览",cards:e.map(enr)},{id:"runs",title:"运行",cards:etz.map(enn)},{id:"telemetry",title:"遥测",cards:etD.map(enn)},{id:"all-canvases",title:"浏览所有画布",cards:a.map(enn)},{id:"all-conversations",title:"浏览所有对话",cards:o.map(enn)},{id:"machine-group",title:"机器组",cards:et$.map(enn)},{id:"audit-logs",title:"日志与审计",cards:etV.map(enn)},...ent],[o,a,e]);return(0,eb.jsx)(f5,{children:(0,eb.jsx)("div",{className:"vtl-card-management-page",children:(0,eb.jsx)(etp,{layouts:et9,children:(0,eb.jsx)(etm,{layout:eth(ene,"cards"),children:(0,eb.jsx)(et7,{className:"h-full",divided:!1,children:t?(0,eb.jsx)(eno,{groupTitle:t.groupTitle,card:t.card,onBack:()=>n(void 0)}):(0,eb.jsx)(ena,{groups:l,onSelect:(e,t)=>n({groupTitle:e,card:t})})})})})})})}function ena({groups:e,onSelect:t}){return(0,eb.jsxs)("div",{className:"vtl-card-management-list flex h-full min-h-0 flex-col",children:[(0,eb.jsxs)("div",{className:"flex shrink-0 items-center justify-between gap-4 px-5 py-4",children:[(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("h2",{className:"text-base font-semibold",children:"卡片管理"}),(0,eb.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"当前可用卡片按页面分组。"})]}),(0,eb.jsxs)("div",{className:"flex shrink-0 items-center gap-2 text-sm text-muted-foreground",children:[(0,eb.jsx)(etb,{className:"size-4"}),(0,eb.jsx)("span",{children:e.reduce((e,t)=>e+t.cards.length,0)})]})]}),(0,eb.jsx)(f1,{className:"min-h-0 flex-1",children:(0,eb.jsx)("div",{className:"space-y-6 px-5 pb-5",children:e.map(e=>(0,eb.jsxs)("section",{className:"space-y-2",children:[(0,eb.jsxs)("div",{className:"flex items-center gap-2",children:[(0,eb.jsx)("h3",{className:"text-sm font-medium",children:e.title}),(0,eb.jsx)("span",{className:"text-xs text-muted-foreground",children:e.cards.length})]}),(0,eb.jsx)("div",{className:"grid grid-cols-1 gap-2 md:grid-cols-2 xl:grid-cols-3",children:e.cards.map(n=>(0,eb.jsxs)("button",{type:"button",className:tK("group/card flex min-h-20 items-start gap-3 rounded-[var(--surface-card-radius)] border bg-card px-3 py-3 text-left transition-colors","vtl-managed-card-item","hover:border-foreground/35 hover:bg-muted/35 focus-visible:border-ring focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/25"),onClick:()=>t(e.title,n),children:[(0,eb.jsx)("span",{className:"mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-[var(--surface-control-radius)] bg-muted text-muted-foreground transition-colors group-hover/card:text-foreground",children:n.icon}),(0,eb.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,eb.jsxs)("span",{className:"flex items-start justify-between gap-3",children:[(0,eb.jsx)("span",{className:"truncate text-sm font-medium",children:n.title}),(0,eb.jsxs)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:[n.defaultSize.w,"x",n.defaultSize.h]})]}),(0,eb.jsx)("span",{className:"mt-1 line-clamp-2 block text-xs leading-5 text-muted-foreground",children:n.description})]})]},`${e.id}-${n.id}`))})]},e.id))})})]})}function eno({groupTitle:e,card:t,onBack:n}){return(0,eb.jsxs)("div",{className:"flex h-full min-h-0 flex-col",children:[(0,eb.jsxs)("div",{className:"flex shrink-0 items-center gap-3 px-5 py-4",children:[(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"返回卡片管理",onClick:n,children:(0,eb.jsx)(KR,{className:"size-4"})}),(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("div",{className:"text-xs text-muted-foreground",children:e}),(0,eb.jsx)("h2",{className:"truncate text-base font-semibold",children:t.title})]})]}),(0,eb.jsx)("div",{className:"grid min-h-0 flex-1 place-items-center px-5 pb-5",children:(0,eb.jsx)("div",{className:"w-full max-w-md rounded-[var(--surface-card-radius)] border bg-card p-5",children:(0,eb.jsxs)("div",{className:"flex items-start gap-3",children:[(0,eb.jsx)("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-[var(--surface-control-radius)] bg-muted text-muted-foreground",children:t.icon}),(0,eb.jsxs)("div",{className:"min-w-0 space-y-3",children:[(0,eb.jsxs)("div",{children:[(0,eb.jsx)("div",{className:"text-sm font-medium",children:"编辑页面预留"}),(0,eb.jsx)("div",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:"后续会在这里接入卡片配置、数据源、默认尺寸和可编辑字段。"})]}),(0,eb.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-xs text-muted-foreground",children:[(0,eb.jsxs)("div",{children:[(0,eb.jsx)("div",{children:"默认尺寸"}),(0,eb.jsxs)("div",{className:"mt-1 font-medium text-foreground",children:[t.defaultSize.w,"x",t.defaultSize.h]})]}),(0,eb.jsxs)("div",{children:[(0,eb.jsx)("div",{children:"数据源"}),(0,eb.jsx)("div",{className:"mt-1 truncate font-medium text-foreground",children:t.dataSource})]})]})]})]})})})]})}let enl=eq("group/item flex w-full flex-wrap items-center rounded-lg border text-sm transition-colors duration-100 outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 [a]:transition-colors [a]:hover:bg-muted",{variants:{variant:{default:"border-transparent",outline:"border-border",muted:"border-transparent bg-muted/50"},size:{default:"gap-2.5 px-3 py-2.5",sm:"gap-2.5 px-3 py-2.5",xs:"gap-2 px-2.5 py-2"}},defaultVariants:{variant:"default",size:"default"}});function ens({className:e,variant:t="default",size:n="default",asChild:r=!1,...i}){return(0,eb.jsx)(r?eF:"div",{"data-slot":"item","data-variant":t,"data-size":n,className:tK(enl({variant:t,size:n,className:e})),...i})}let enc=eq("flex shrink-0 items-center justify-center gap-2 [&_svg]:pointer-events-none",{variants:{variant:{default:"bg-transparent",icon:"[&_svg:not([class*='size-'])]:size-4",marker:"size-8 rounded-md border bg-background ui-text-kbd font-medium text-muted-foreground [&_svg:not([class*='size-'])]:size-4",image:"size-10 overflow-hidden rounded-sm group-data-[size=sm]/item:size-8 group-data-[size=xs]/item:size-6 [&_img]:size-full [&_img]:object-cover"},align:{auto:"group-has-data-[slot=item-description]/item:translate-y-0.5 group-has-data-[slot=item-description]/item:self-start",start:"translate-y-0.5 self-start",center:"self-center"}},defaultVariants:{variant:"default",align:"auto"}});function end({className:e,variant:t="default",align:n="auto",...r}){return(0,eb.jsx)("div",{"data-slot":"item-media","data-variant":t,"data-align":n,className:tK(enc({variant:t,align:n,className:e})),...r})}function enu({className:e,align:t,...n}){return(0,eb.jsx)("div",{"data-slot":"item-content","data-align":t,className:tK("flex flex-1 flex-col gap-1 group-data-[size=xs]/item:gap-0 [&+[data-slot=item-content]]:flex-none","start"===t&&"self-start","center"===t&&"self-center",e),...n})}function enf({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"item-title",className:tK("line-clamp-1 flex w-fit items-center gap-2 text-sm leading-snug font-medium underline-offset-4",e),...t})}function enh({className:e,...t}){return(0,eb.jsx)("p",{"data-slot":"item-description",className:tK("line-clamp-2 text-left text-sm leading-normal font-normal text-muted-foreground group-data-[size=xs]/item:text-xs [&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary",e),...t})}function enp({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"item-actions",className:tK("flex items-center gap-2",e),...t})}let enm={back:"Back",search:"Search settings...",welcomeTitle:"Settings",welcomeDescription:"Search or choose a setting to continue.",recommendations:"Recommended",noResults:"No settings found."};function eng(e){return"string"==typeof e||"number"==typeof e?String(e):""}function env({sections:e,recommendations:t,sectionId:n,defaultSectionId:r,childId:i,defaultChildId:a,onSelectionChange:o,labels:l,welcomeContent:s,className:c,sidebarClassName:d,contentClassName:u}){let f={...enm,...l},[h,p]=ew.useState(r),[m,g]=ew.useState(a),v=n??h,x=i??m,y=e.find(e=>e.id===v),b=y?.children?.find(e=>e.id===x),w=!!y,j=ew.useMemo(()=>e.flatMap(e=>[{value:e.id,label:e.title,description:e.description,icon:e.icon,searchValue:[eng(e.title),eng(e.description),...e.keywords??[]].join(" "),keywords:e.keywords},...(e.children??[]).map(t=>({value:`${e.id}/${t.id}`,label:t.title,description:e.title,icon:t.icon??e.icon,disabled:t.disabled,searchValue:[eng(t.title),eng(t.description),eng(e.title),...t.keywords??[]].join(" "),keywords:[eng(e.title),...t.keywords??[]]}))]),[e]),k=t??e.flatMap(e=>(e.children??[]).slice(0,2).map(t=>({id:`${e.id}-${t.id}`,title:t.title,description:e.title,icon:t.icon,sectionId:e.id,childId:t.id})));function S(e,t){void 0===n&&p(e),void 0===i&&g(t),o?.({sectionId:e,childId:t})}let C=b?.content??y?.content??s??(0,eb.jsxs)("div",{className:"mx-auto flex min-h-[22rem] w-full max-w-2xl flex-col justify-center gap-5 py-12",children:[(0,eb.jsxs)("div",{className:"space-y-2",children:[(0,eb.jsx)("h3",{className:"text-xl font-semibold tracking-normal",children:f.welcomeTitle}),(0,eb.jsx)("p",{className:"max-w-xl text-sm text-muted-foreground",children:f.welcomeDescription})]}),(0,eb.jsx)(eny,{labels:f,options:j,onSelect:(e,t)=>S(e,t)}),k.length>0&&(0,eb.jsxs)("section",{className:"space-y-2",children:[(0,eb.jsx)("div",{className:"ui-text-kbd font-medium text-muted-foreground",children:f.recommendations}),(0,eb.jsx)("div",{className:"grid gap-2 sm:grid-cols-2",children:k.map(e=>(0,eb.jsx)(ens,{asChild:!0,variant:"outline",size:"xs",className:"min-h-14 flex-nowrap bg-card text-left hover:bg-muted/60",children:(0,eb.jsxs)("button",{type:"button",onClick:()=>S(e.sectionId,e.childId),children:[e.icon&&(0,eb.jsx)(end,{variant:"marker",align:"center",children:e.icon}),(0,eb.jsxs)(enu,{className:"min-w-0 gap-0.5",children:[(0,eb.jsx)(enf,{className:"max-w-full truncate",children:e.title}),e.description&&(0,eb.jsx)(enh,{className:"line-clamp-1",children:e.description})]}),(0,eb.jsx)(enp,{className:"ml-auto",children:(0,eb.jsx)(vo,{className:"size-4 shrink-0 text-muted-foreground opacity-0 transition-opacity group-hover/item:opacity-100"})})]})},e.id))})]})]});return(0,eb.jsxs)("div",{"data-slot":"settings-menu-panel",className:tK("vtl-surface-panel grid min-h-[34rem] overflow-hidden rounded-[var(--surface-panel-radius)] border md:grid-cols-[15rem_minmax(0,1fr)]",c),children:[(0,eb.jsx)("aside",{"data-slot":"settings-menu-sidebar",className:tK("min-h-0 border-b bg-muted/20 md:border-r md:border-b-0",d),children:(0,eb.jsx)(f1,{className:"h-full",children:(0,eb.jsx)("div",{className:"space-y-1 p-2",children:w?(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsxs)(tY,{type:"button",variant:"ghost",className:"mb-1 h-auto min-h-9 w-full justify-start px-2.5 py-1.5 text-left",onClick:()=>S(void 0,void 0),children:[(0,eb.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center [&_svg]:size-4",children:(0,eb.jsx)(KR,{})}),(0,eb.jsx)("span",{className:"min-w-0 truncate",children:f.back})]}),(y?.children??[]).map(e=>(0,eb.jsx)(enx,{title:e.title,icon:e.icon,badge:e.badge,active:e.id===x,disabled:e.disabled,onClick:()=>S(y?.id,e.id)},e.id))]}):e.map(e=>(0,eb.jsx)(enx,{title:e.title,icon:e.icon,badge:e.badge,disabled:e.disabled,onClick:()=>S(e.id,void 0)},e.id))})})}),(0,eb.jsxs)("main",{"data-slot":"settings-menu-content",className:tK("min-w-0 bg-[var(--surface-panel)] p-4 md:p-5",u),children:[y?(0,eb.jsx)("div",{className:"mb-4 flex min-h-8 items-center justify-between gap-4",children:(0,eb.jsxs)("div",{className:"min-w-0",children:[(0,eb.jsx)("h2",{className:"truncate text-lg font-semibold tracking-normal",children:b?.title??y.title}),(b?.description??y.description)&&(0,eb.jsx)("p",{className:"truncate text-sm text-muted-foreground",children:b?.description??y.description})]})}):null,C]})]})}function enx({title:e,icon:t,badge:n,active:r,disabled:i,onClick:a}){return(0,eb.jsxs)(tY,{type:"button",variant:"ghost",disabled:i,onClick:a,className:tK("h-auto min-h-9 w-full justify-start px-2.5 py-1.5 text-left font-medium",r?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted/70 hover:text-foreground"),children:[t&&(0,eb.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center [&_svg]:size-4",children:t}),(0,eb.jsx)("span",{className:"min-w-0 flex-1 truncate font-medium",children:e}),n&&(0,eb.jsx)(cI,{variant:"outline",className:"h-5 shrink-0 px-1.5 ui-text-kbd",children:n}),(0,eb.jsx)(vo,{className:"size-3.5 shrink-0 text-muted-foreground/60"})]})}function eny({labels:e,options:t,onSelect:n}){return(0,eb.jsx)(gU,{options:t,placeholder:e.search,emptyText:e.noResults,className:"w-full",contentClassName:"rounded-lg",onValueChange:e=>{let[t,r]=e.split("/");t&&n(t,r)},renderOption:e=>(0,eb.jsxs)(eb.Fragment,{children:[(0,eb.jsx)("span",{className:"flex size-5 shrink-0 items-center justify-center text-muted-foreground [&_svg]:size-4",children:e.icon??(0,eb.jsx)(cz,{})}),(0,eb.jsxs)("span",{className:"grid min-w-0 flex-1 gap-0.5",children:[(0,eb.jsx)("span",{className:"truncate",children:e.label}),e.description&&(0,eb.jsx)("span",{className:"truncate text-sm text-muted-foreground",children:e.description})]})]})})}let enb=eq("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 enw({className:e,variant:t,...n}){return(0,eb.jsx)("div",{role:"alert","data-slot":"alert",className:tK(enb({variant:t}),e),...n})}function enj({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"alert-title",className:tK("mb-1 leading-none font-medium",e),...t})}function enk({className:e,...t}){return(0,eb.jsx)("div",{"data-slot":"alert-description",className:tK("text-muted-foreground [&_p]:leading-relaxed",e),...t})}let enS=[{value:"openai-v1",label:"OpenAI v1"},{value:"anthropic",label:"Anthropic"},{value:"openai-responses",label:"OpenAI Responses"}];function enC(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}}function enN(){let[e,t]=ew.useState([]),[n,r]=ew.useState(!0),[i,a]=ew.useState(""),o=ew.useCallback(async()=>{a("");try{let e=await g0();t(e.routes.map(enC))}catch(e){a(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 g2({id:n.id,providerName:n.providerName,protocol:n.protocol,endpointUrl:n.endpointUrl,apiKey:n.apiKey,models:n.models,selectedModelIds:n.selectedModelIds});l(t,()=>enC(e))}catch(e){l(t,t=>({...t,saving:!1,error:e instanceof Error?e.message:"保存失败"}))}}}return ew.useEffect(()=>{o()},[o]),(0,eb.jsxs)("div",{className:"grid gap-4",children:[(0,eb.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,eb.jsx)("div",{className:"min-w-0",children:(0,eb.jsx)("h3",{className:"text-base font-semibold tracking-normal",children:"模型路由"})}),(0,eb.jsxs)(tY,{type:"button",size:"sm",onClick:function(){t(e=>[{providerName:"",protocol:"openai-v1",endpointUrl:"",apiKey:"",models:[],selectedModelIds:[],loadingModels:!1,saving:!1,error:""},...e])},children:[(0,eb.jsx)(s7,{className:"size-4"}),"添加模型路由"]})]}),i?(0,eb.jsxs)(enw,{variant:"destructive",children:[(0,eb.jsx)(eey,{}),(0,eb.jsx)(enj,{children:"读取失败"}),(0,eb.jsx)(enk,{children:i})]}):null,n?(0,eb.jsx)("div",{className:"rounded-lg border border-dashed px-3 py-6 text-sm text-muted-foreground",children:"正在读取模型路由"}):0===e.length?(0,eb.jsx)("div",{className:"rounded-lg border border-dashed px-3 py-6 text-sm text-muted-foreground",children:"还没有模型路由。"}):(0,eb.jsx)("div",{className:"grid gap-3",children:e.map((e,t)=>(0,eb.jsx)(enM,{draft:e,onDraftChange:e=>l(t,()=>e),onSave:()=>{s(t)}},e.id??`draft-${t}`))})]})}function enM({draft:e,onDraftChange:t,onSave:n}){let r=ew.useRef(e),i=ew.useRef(t),a=[e.providerName,e.protocol,e.endpointUrl,e.apiKey||(e.savedKeyAvailable?"saved":"")].join("\n"),o=e.providerName.trim()&&e.endpointUrl.trim()&&e.apiKey.trim(),l=e.providerName.trim()&&e.endpointUrl.trim()&&(e.apiKey.trim()||e.savedKeyAvailable)&&e.selectedModelIds.length>0&&!e.saving;function s(n){t({...e,...n})}return ew.useEffect(()=>{r.current=e,i.current=t},[e,t]),ew.useEffect(()=>{if(!o)return;let e=window.setTimeout(async()=>{let e=r.current;i.current({...e,loadingModels:!0,error:""});try{let t=await g1({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)},[o,a]),(0,eb.jsxs)("section",{className:"grid gap-3 rounded-lg border bg-card p-3",children:[(0,eb.jsxs)("div",{className:"grid gap-2 md:grid-cols-[minmax(0,1fr)_11rem]",children:[(0,eb.jsx)(ny,{value:e.providerName,placeholder:"提供商名称",onChange:e=>s({providerName:e.currentTarget.value})}),(0,eb.jsxs)(Jy,{value:e.protocol,onValueChange:e=>s({protocol:e}),children:[(0,eb.jsx)(J6,{className:"w-full",children:(0,eb.jsx)(Jk,{})}),(0,eb.jsx)(J9,{children:enS.map(e=>(0,eb.jsx)(Qe,{value:e.value,children:e.label},e.value))})]})]}),(0,eb.jsxs)("div",{className:"grid gap-2 md:grid-cols-[minmax(0,1fr)_minmax(0,18rem)]",children:[(0,eb.jsx)(ny,{value:e.endpointUrl,placeholder:"API 端点 URL,例如 https://api.openai.com/v1",onChange:e=>s({endpointUrl:e.currentTarget.value})}),(0,eb.jsx)(ny,{value:e.apiKey,type:"password",placeholder:e.savedKeyAvailable?"已保存,留空沿用":"API Key",onChange:e=>s({apiKey:e.currentTarget.value})})]}),(0,eb.jsx)(VY,{}),(0,eb.jsxs)("div",{className:"grid gap-2",children:[(0,eb.jsxs)("div",{className:"flex min-h-6 items-center justify-between gap-2",children:[(0,eb.jsxs)("div",{className:"flex min-w-0 items-center gap-2 text-sm font-medium",children:[(0,eb.jsx)(mE,{className:"size-4 text-muted-foreground"}),"可用模型"]}),e.loadingModels?(0,eb.jsx)("span",{className:"text-xs text-muted-foreground",children:"拉取中"}):null]}),e.models.length>0?(0,eb.jsx)("div",{className:"grid max-h-48 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,eb.jsxs)("label",{className:tK("grid min-h-8 cursor-pointer grid-cols-[auto_minmax(0,1fr)] items-center gap-2 rounded-md px-2 text-sm hover:bg-muted/60",n&&"bg-muted/70"),children:[(0,eb.jsx)(nx,{checked:n,onCheckedChange:n=>{var r;return r=t.id,void s({selectedModelIds:!0===n?[...e.selectedModelIds,r]:e.selectedModelIds.filter(e=>e!==r)})}}),(0,eb.jsx)("span",{className:"truncate",children:t.displayName||t.id})]},t.id)})}):(0,eb.jsx)("div",{className:"rounded-md border border-dashed px-3 py-4 text-sm text-muted-foreground",children:"填写端点和密钥后会自动拉取模型。"})]}),e.error?(0,eb.jsxs)(enw,{variant:"destructive",children:[(0,eb.jsx)(eey,{}),(0,eb.jsx)(enj,{children:"模型路由错误"}),(0,eb.jsx)(enk,{className:"break-words",children:e.error})]}):null,(0,eb.jsx)("div",{className:"flex justify-end",children:(0,eb.jsx)(tY,{type:"button",onClick:n,disabled:!l,children:e.saving?"保存中":"保存"})})]})}let enE=[{id:"settings",x:0,y:0,w:12,h:8}],enO=f4(enE);function enP(){return(0,eb.jsx)(f5,{children:(0,eb.jsx)(etp,{layouts:enE,children:(0,eb.jsx)(etm,{layout:eth(enO,"settings"),children:(0,eb.jsx)(env,{className:"h-full min-h-0",contentClassName:"min-h-0 overflow-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",sections:[{id:"preferences",title:"偏好设置",icon:(0,eb.jsx)(mE,{}),children:[{id:"model-routes",title:"模型路由",icon:(0,eb.jsx)(mE,{}),content:(0,eb.jsx)(enN,{})}]}],defaultSectionId:"preferences",defaultChildId:"model-routes",labels:{back:"返回",search:"搜索设置",welcomeTitle:"偏好设置",welcomeDescription:"",recommendations:"常用",noResults:"没有设置项"}})})})})}let enA=eN("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"}]]),enz=eN("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"}]]);var en_=e.i(91e3);let enI=["light","dark","jelly"],enD={light:{label:"Light",icon:enz,className:"text-sidebar-foreground/60"},dark:{label:"Dark",icon:enA,className:"text-sidebar-foreground/60"},jelly:{label:"Jelly",icon:function(e){return(0,eb.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...e,children:[(0,eb.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,eb.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,eb.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,eb.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,eb.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 enT(){let{resolvedTheme:e,setTheme:t}=(0,W2.useTheme)(),[n,r]=ew.useState(en_.defaultAppearanceTheme);ew.useEffect(()=>{let e=window.localStorage.getItem(en_.appearanceThemeStorageKey)??en_.defaultAppearanceTheme;r(e),(0,en_.applyAppearanceTheme)({theme:e})},[]);let i=n===en_.jellyAppearanceTheme?"jelly":"dark"===e?"dark":"light",a=enI.indexOf(i),o=enI[(a+1)%enI.length]??"light",{icon:l,label:s,className:c}=enD[i];function d(e){r(e),window.localStorage.setItem(en_.appearanceThemeStorageKey,e),(0,en_.applyAppearanceTheme)({theme:e})}return(0,eb.jsx)(tY,{type:"button",variant:"ghost",size:"icon-sm",className:tK("size-10 hover:bg-muted hover:text-sidebar-foreground",c),"aria-label":`${ez.theme}: ${s}`,title:`${ez.theme}: ${s}`,onClick:function(){if("jelly"===o){t("dark"),d(en_.jellyAppearanceTheme);return}d(en_.defaultAppearanceTheme),t(o)},children:(0,eb.jsx)(l,{})})}function enR({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){return(0,eb.jsx)(mk,{boardId:"runtime-operations",definitions:etz,initialLayouts:et_,clipboardItems:e,actionLabel:"运行页面卡片操作",paletteGroupTitle:"运行页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}function enL({clipboardItems:e=[],onClipboardItemsChange:t,onOverlayOpenChange:n}){let r=etq("/api/local/machines/telemetry",etW),i=ew.useMemo(()=>etI(r),[r]);return(0,eb.jsx)(mk,{boardId:"telemetry",definitions:i,initialLayouts:etT,clipboardItems:e,actionLabel:"遥测页面卡片操作",paletteGroupTitle:"遥测页面卡片",onClipboardItemsChange:t,onOverlayOpenChange:n})}function en$(){let[e,t]=ew.useState("dashboard"),[n,r]=ew.useState(!1),[i,a]=ew.useState(!1),[o,l]=ew.useState(!1),[s,c]=ew.useState(),[d,u]=ew.useState(!1),[f,h]=ew.useState([]),[p,m]=ew.useState([]),[g,v]=ew.useState({}),[x,y]=ew.useState(),[b,w]=ew.useState(HC),[j,k]=ew.useState([]),[S,C]=ew.useState(),N=ew.useCallback(e=>{w(t=>o9(e,t))},[]),M=ew.useCallback(e=>{k(t=>o9(e,t))},[]),E=ew.useCallback(async e=>{c(await He(e)),t("new-agent-conversation")},[]),O=ew.useCallback(async()=>{let e=await B7();e?(c(await He(e.conversation.id)),t("new-agent-conversation")):l(!0)},[]);return(0,eb.jsxs)("main",{className:"vtl-app-background relative h-svh overflow-hidden text-foreground",children:[(0,eb.jsx)("div",{className:"pointer-events-none fixed inset-y-0 left-0 z-40 p-3",children:(0,eb.jsx)(uX,{navItems:et3,contents:et6,defaultActiveNavId:"dashboard",defaultSelectedItemId:"overview",defaultExpandedItemIds:["runs"],logo:(0,eb.jsx)(nw,{}),account:(0,eb.jsx)(nj,{}),labels:{collapse:"收起菜单",expand:"展开菜单",search:e_.search,account:"账户",hideSidebar:"收起侧边栏",showSidebar:"展开侧边栏"},className:"h-[calc(100svh-1.5rem)] drop-shadow-lg",footer:(0,eb.jsx)(enT,{}),onItemSelect:({item:e})=>{"new-canvas"===e.id?t("new-canvas"):"all-canvases"===e.id?t("all-canvases"):"new-agent-conversation"===e.id?l(!0):"open-recent-conversation"===e.id?O():"all-conversations"===e.id?t("all-conversations"):"overview"===e.id?t("dashboard"):"runs"===e.id?t("runs"):"telemetry"===e.id?t("telemetry"):("machine-group"===e.id||"process-management"===e.id||"machine-performance"===e.id||"machine-firewall"===e.id||"audit-logs"===e.id||"machine-files"===e.id||"preferences"===e.id||"card-management"===e.id)&&t(e.id)}})}),(0,eb.jsxs)("section",{className:tK("h-full min-w-0","dashboard"===e?"overflow-auto pl-[8.5rem]":"overflow-hidden"),children:["runs"===e?(0,eb.jsx)(enR,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"telemetry"===e?(0,eb.jsx)(enL,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"machine-group"===e?(0,eb.jsx)(etK,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"process-management"===e?(0,eb.jsx)(etX,{}):"machine-performance"===e?(0,eb.jsx)(etQ,{}):"machine-firewall"===e?(0,eb.jsx)(etx,{}):"audit-logs"===e?(0,eb.jsx)(et0,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"machine-files"===e?(0,eb.jsx)(QV,{clipboardItems:f,onClipboardItemsChange:h}):"preferences"===e?(0,eb.jsx)(enP,{}):"card-management"===e?(0,eb.jsx)(eni,{}):"new-canvas"===e?(0,eb.jsx)(ee9,{nodes:b,edges:j,selectedNodeId:S,clipboardItems:f,onNodesChange:N,onEdgesChange:M,onNodesSet:w,onEdgesSet:k,onSelectedNodeChange:C,onClipboardItemsChange:h}):"all-canvases"===e?(0,eb.jsx)(ee2,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:u}):"new-agent-conversation"===e?(0,eb.jsx)(eeZ,{conversation:s,clipboardItems:f,clipboardDraggingId:x,onClipboardItemsChange:h,onClipboardDraggingChange:y,onOverlayOpenChange:a}):"all-conversations"===e?(0,eb.jsx)(Hc,{clipboardItems:f,onClipboardItemsChange:h,onOpenConversation:e=>{E(e)},onOverlayOpenChange:u}):(0,eb.jsx)(ets,{clipboardItems:f,onClipboardItemsChange:h,onOverlayOpenChange:r}),(0,eb.jsx)(etu,{hidden:"dashboard"===e?n||o:"new-agent-conversation"===e?i||o:d,items:f,trashItems:p,draggingId:x,onDraggingChange:y,onItemsChange:h,onTrashItemsChange:m,onTrashClipboardItemsChange:v,trashClipboardItems:g})]}),(0,eb.jsx)(Hh,{open:o,onOpenChange:l,onCreated:e=>{c(e),t("new-agent-conversation")}})]})}let enF=ey.default.env.NEXT_PUBLIC_VANTALOOM_AUTH_MODE??"disabled-local";function enV(){let[e,t]=ew.useState("disabled-local"===enF);return e?(0,eb.jsx)(en$,{}):(0,eb.jsx)(nb,{onComplete:()=>t(!0)})}e.s(["default",()=>enV],66204)}]);
|