forge-cw 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,8 +7,8 @@
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
8
  <title>Forge Console</title>
9
9
  <script type="importmap">{"imports":{"preact":"/shared/preact.js","preact/hooks":"/shared/preact-hooks.js","preact/jsx-runtime":"/shared/preact-jsx-runtime.js","preact/compat":"/shared/preact-compat.js","@preact/signals":"/shared/preact-signals.js","@forge-dev/ui":"/shared/forge-dev-ui.js","@forge-dev/sdk":"/shared/forge-dev-sdk.js"}}</script>
10
- <script type="module" crossorigin src="/assets/index-CC7_QwVk.js"></script>
11
- <link rel="stylesheet" crossorigin href="/assets/index-GXv21xGs.css">
10
+ <script type="module" crossorigin src="/assets/index-DvMplpgv.js"></script>
11
+ <link rel="stylesheet" crossorigin href="/assets/index-DPf7M8cb.css">
12
12
  <link rel="stylesheet" href="/shared/forge-dev-ui.css">
13
13
  </head>
14
14
  <body>
@@ -1,4 +1,4 @@
1
- import{jsx as e}from"./preact-jsx-runtime.js";import{useState as B,useRef as w,useEffect as _,useLayoutEffect as H,useCallback as G}from"./preact-hooks.js";import{signal as U}from"./preact-signals.js";import"./preact.js";const ee={good:"var(--green)",warn:"var(--orange)",bad:"var(--red)",neutral:"var(--ink-3)"},ge=({icon:r,label:n,value:o,trend:t,status:a})=>e("div",{class:"relative overflow-hidden",style:{padding:"10px 12px",borderRadius:"13px",background:"var(--card)",border:"1px solid var(--hair)",boxShadow:"var(--shadow-s)"},children:[e("div",{class:"flex items-center gap-2",style:{fontSize:"11.5px",color:"var(--ink-2)"},children:[e("span",{children:r}),e("span",{children:n})]}),e("div",{class:"mono",style:{fontSize:"19px",fontWeight:650,marginTop:"2px"},children:o}),t&&e("div",{class:"mono",style:{fontSize:"11.5px",marginTop:"2px",color:t.startsWith("-")?"var(--red)":"var(--green)"},children:t}),e("div",{class:"absolute bottom-0 left-0 right-0 h-0.5",style:{backgroundColor:ee[a]}})]}),re={sm:{pad:"6px 12px",primaryPad:"6px 14px",font:"12.5px",radius:"9px"},md:{pad:"7px 13px",primaryPad:"7px 15px",font:"13px",radius:"9px"},lg:{pad:"12px 16px",primaryPad:"12px 16px",font:"14.5px",radius:"12px"}},q={primary:{background:"linear-gradient(180deg, var(--blue-2), var(--blue))",color:"#fff",border:"0",boxShadow:"var(--shadow-m)",fontWeight:"600"},secondary:{background:"var(--card)",color:"var(--ink)",border:"1px solid var(--hair)",boxShadow:"var(--shadow-s)",fontWeight:"500"},danger:{background:"var(--card)",color:"var(--red)",border:"1px solid var(--hair)",boxShadow:"var(--shadow-s)",fontWeight:"500"},destructive:{background:"var(--red)",color:"#fff",border:"0",boxShadow:"var(--shadow-m)",fontWeight:"600"}},te={background:"var(--elev)",color:"var(--ink-3)",border:"1px solid transparent",boxShadow:"none",opacity:".8"},ne=({label:r,icon:n,variant:o="primary",size:t="md",block:a,title:x,disabled:s,loading:c,onClick:d})=>{const[i,h]=B(!1),p=c??i,l=!!(s||p),u=async()=>{if(!l){h(!0);try{await d()}finally{h(!1)}}},f=re[t],S=o==="primary"||o==="destructive",L=s&&!p?{...q[o],...te}:q[o];return e("button",{type:"button",class:`inline-flex items-center justify-center gap-1.5 whitespace-nowrap transition-all duration-180 ease-spring ${l?"cursor-not-allowed":`cursor-pointer hover:-translate-y-px hover:shadow-m${S?" hover:brightness-106":""}`}${a?" w-full":""}`,style:{...L,padding:S?f.primaryPad:f.pad,fontSize:f.font,borderRadius:f.radius},disabled:l,title:x,onClick:u,children:[p?e("span",{class:"i-lucide-loader-2 animate-spin"}):n?e("span",{class:n}):null,e("span",{children:r})]})},oe="modulepreload",se=function(r){return"/"+r},X={},N=function(n,o,t){let a=Promise.resolve();if(o&&o.length>0){let s=function(i){return Promise.all(i.map(h=>Promise.resolve(h).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));a=s(o.map(i=>{if(i=se(i),i in X)return;X[i]=!0;const h=i.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${p}`))return;const l=document.createElement("link");if(l.rel=h?"stylesheet":oe,h||(l.as="script"),l.crossOrigin="",l.href=i,d&&l.setAttribute("nonce",d),document.head.appendChild(l),h)return new Promise((u,f)=>{l.addEventListener("load",u),l.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${i}`)))})}))}function x(s){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=s,window.dispatchEvent(c),!c.defaultPrevented)throw s}return a.then(s=>{for(const c of s||[])c.status==="rejected"&&x(c.reason);return n().catch(x)})},ae='ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace',I=r=>({background:r==="dark"?"#0e0e10":"#1c1c1e",foreground:"#e3e3e8",cursor:"#e3e3e8",selectionBackground:"rgba(10,132,255,0.35)"}),be=({streamUrl:r,content:n,wsUrl:o,height:t=300,onExit:a,onGiveUp:x,onConnectionChange:s,onOutput:c,focused:d=!0,theme:i="dark"})=>{const h=w(null),p=!!o,l=w(a);l.current=a;const u=w(x);u.current=x;const f=w(s);f.current=s;const S=w(c);S.current=c;const L=w(i);L.current=i;const j=w(d);j.current=d;const T=w(null);_(()=>{T.current&&(T.current.options.theme=I(i))},[i]),_(()=>{var k;p&&d&&((k=T.current)==null||k.focus())},[d,p]),_(()=>{if(!h.current)return;let k=!1,v=null,C=null,$=0;const J=[];return(async()=>{const{Terminal:F}=await N(async()=>{const{Terminal:b}=await import("./chunk-DlVFs1Kw.js").then(m=>m.x);return{Terminal:b}},[]),{FitAddon:Y}=await N(async()=>{const{FitAddon:b}=await import("./chunk-BlxrFPDK.js").then(m=>m.a);return{FitAddon:b}},[]),{WebLinksAddon:K}=await N(async()=>{const{WebLinksAddon:b}=await import("./chunk-BWjmmSgS.js");return{WebLinksAddon:b}},[]);if(k)return;const g=new F({theme:I(L.current),fontSize:13,fontFamily:ae,convertEol:!p,disableStdin:!p,cursorBlink:p,scrollback:1e4});T.current=g;const D=b=>{var m;g.write(b),(m=S.current)==null||m.call(S,b)},M=new Y;g.loadAddon(M),g.loadAddon(new K),g.open(h.current),setTimeout(()=>{M.fit(),p&&j.current&&g.focus()},50),n&&!p&&D(n);let E;if(r&&!p&&(E=new EventSource(r),E.addEventListener("output",b=>{const{chunk:m}=JSON.parse(b.data);D(m)}),E.addEventListener("done",b=>{const{exitCode:m}=JSON.parse(b.data);g.write(`\r
1
+ import{jsx as e}from"./preact-jsx-runtime.js";import{useState as B,useRef as w,useEffect as _,useLayoutEffect as H,useCallback as U}from"./preact-hooks.js";import{signal as ee}from"./preact-signals.js";import{createPortal as Z}from"./preact-compat.js";import"./preact.js";const re={good:"var(--green)",warn:"var(--orange)",bad:"var(--red)",neutral:"var(--ink-3)"},me=({icon:r,label:n,value:o,trend:t,status:a})=>e("div",{class:"relative overflow-hidden",style:{padding:"10px 12px",borderRadius:"13px",background:"var(--card)",border:"1px solid var(--hair)",boxShadow:"var(--shadow-s)"},children:[e("div",{class:"flex items-center gap-2",style:{fontSize:"11.5px",color:"var(--ink-2)"},children:[e("span",{children:r}),e("span",{children:n})]}),e("div",{class:"mono",style:{fontSize:"19px",fontWeight:650,marginTop:"2px"},children:o}),t&&e("div",{class:"mono",style:{fontSize:"11.5px",marginTop:"2px",color:t.startsWith("-")?"var(--red)":"var(--green)"},children:t}),e("div",{class:"absolute bottom-0 left-0 right-0 h-0.5",style:{backgroundColor:re[a]}})]}),te={sm:{pad:"6px 12px",primaryPad:"6px 14px",font:"12.5px",radius:"9px"},md:{pad:"7px 13px",primaryPad:"7px 15px",font:"13px",radius:"9px"},lg:{pad:"12px 16px",primaryPad:"12px 16px",font:"14.5px",radius:"12px"}},q={primary:{background:"linear-gradient(180deg, var(--blue-2), var(--blue))",color:"#fff",border:"0",boxShadow:"var(--shadow-m)",fontWeight:"600"},secondary:{background:"var(--card)",color:"var(--ink)",border:"1px solid var(--hair)",boxShadow:"var(--shadow-s)",fontWeight:"500"},danger:{background:"var(--card)",color:"var(--red)",border:"1px solid var(--hair)",boxShadow:"var(--shadow-s)",fontWeight:"500"},destructive:{background:"var(--red)",color:"#fff",border:"0",boxShadow:"var(--shadow-m)",fontWeight:"600"}},ne={background:"var(--elev)",color:"var(--ink-3)",border:"1px solid transparent",boxShadow:"none",opacity:".8"},oe=({label:r,icon:n,variant:o="primary",size:t="md",block:a,title:x,disabled:s,loading:c,onClick:d})=>{const[i,h]=B(!1),p=c??i,l=!!(s||p),u=async()=>{if(!l){h(!0);try{await d()}finally{h(!1)}}},f=te[t],S=o==="primary"||o==="destructive",L=s&&!p?{...q[o],...ne}:q[o];return e("button",{type:"button",class:`inline-flex items-center justify-center gap-1.5 whitespace-nowrap transition-all duration-180 ease-spring ${l?"cursor-not-allowed":`cursor-pointer hover:-translate-y-px hover:shadow-m${S?" hover:brightness-106":""}`}${a?" w-full":""}`,style:{...L,padding:S?f.primaryPad:f.pad,fontSize:f.font,borderRadius:f.radius},disabled:l,title:x,onClick:u,children:[p?e("span",{class:"i-lucide-loader-2 animate-spin"}):n?e("span",{class:n}):null,e("span",{children:r})]})},se="modulepreload",ae=function(r){return"/"+r},X={},N=function(n,o,t){let a=Promise.resolve();if(o&&o.length>0){let s=function(i){return Promise.all(i.map(h=>Promise.resolve(h).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};document.getElementsByTagName("link");const c=document.querySelector("meta[property=csp-nonce]"),d=(c==null?void 0:c.nonce)||(c==null?void 0:c.getAttribute("nonce"));a=s(o.map(i=>{if(i=ae(i),i in X)return;X[i]=!0;const h=i.endsWith(".css"),p=h?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${i}"]${p}`))return;const l=document.createElement("link");if(l.rel=h?"stylesheet":se,h||(l.as="script"),l.crossOrigin="",l.href=i,d&&l.setAttribute("nonce",d),document.head.appendChild(l),h)return new Promise((u,f)=>{l.addEventListener("load",u),l.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${i}`)))})}))}function x(s){const c=new Event("vite:preloadError",{cancelable:!0});if(c.payload=s,window.dispatchEvent(c),!c.defaultPrevented)throw s}return a.then(s=>{for(const c of s||[])c.status==="rejected"&&x(c.reason);return n().catch(x)})},ie='ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace',I=r=>({background:r==="dark"?"#0e0e10":"#1c1c1e",foreground:"#e3e3e8",cursor:"#e3e3e8",selectionBackground:"rgba(10,132,255,0.35)"}),ye=({streamUrl:r,content:n,wsUrl:o,height:t=300,onExit:a,onGiveUp:x,onConnectionChange:s,onOutput:c,focused:d=!0,theme:i="dark"})=>{const h=w(null),p=!!o,l=w(a);l.current=a;const u=w(x);u.current=x;const f=w(s);f.current=s;const S=w(c);S.current=c;const L=w(i);L.current=i;const j=w(d);j.current=d;const T=w(null);_(()=>{T.current&&(T.current.options.theme=I(i))},[i]),_(()=>{var k;p&&d&&((k=T.current)==null||k.focus())},[d,p]),_(()=>{if(!h.current)return;let k=!1,v=null,C=null,$=0;const J=[];return(async()=>{const{Terminal:F}=await N(async()=>{const{Terminal:b}=await import("./chunk-DlVFs1Kw.js").then(m=>m.x);return{Terminal:b}},[]),{FitAddon:K}=await N(async()=>{const{FitAddon:b}=await import("./chunk-BlxrFPDK.js").then(m=>m.a);return{FitAddon:b}},[]),{WebLinksAddon:G}=await N(async()=>{const{WebLinksAddon:b}=await import("./chunk-BWjmmSgS.js");return{WebLinksAddon:b}},[]);if(k)return;const g=new F({theme:I(L.current),fontSize:13,fontFamily:ie,convertEol:!p,disableStdin:!p,cursorBlink:p,scrollback:1e4});T.current=g;const D=b=>{var m;g.write(b),(m=S.current)==null||m.call(S,b)},M=new K;g.loadAddon(M),g.loadAddon(new G),g.open(h.current),setTimeout(()=>{M.fit(),p&&j.current&&g.focus()},50),n&&!p&&D(n);let E;if(r&&!p&&(E=new EventSource(r),E.addEventListener("output",b=>{const{chunk:m}=JSON.parse(b.data);D(m)}),E.addEventListener("done",b=>{const{exitCode:m}=JSON.parse(b.data);g.write(`\r
2
2
  \x1B[${m===0?"32":"31"}m--- Exit code: ${m} ---\x1B[0m\r
3
3
  `),E==null||E.close()})),o&&!k){const b=m=>{if(k)return;console.log("[ForgeTerminal] Connecting to:",m),v=new WebSocket(m);const O=[];v.onopen=()=>{var y;console.log("[ForgeTerminal] WebSocket OPEN"),$=0,(y=f.current)==null||y.call(f,!0),M.fit();const{cols:W,rows:z}=g;v.send(JSON.stringify({type:"resize",cols:W,rows:z})),O.push(g.onData(R=>{(v==null?void 0:v.readyState)===WebSocket.OPEN&&v.send(JSON.stringify({type:"input",data:R}))})),O.push(g.onResize(({cols:R,rows:P})=>{(v==null?void 0:v.readyState)===WebSocket.OPEN&&v.send(JSON.stringify({type:"resize",cols:R,rows:P}))}))},v.onmessage=W=>{var z;try{const y=JSON.parse(W.data);y.type==="output"||y.type==="scrollback"?D(y.data):y.type==="exit"?(g.write(`\r
4
4
  \x1B[33m--- Session ended (code ${y.code}) ---\x1B[0m\r
@@ -10,4 +10,4 @@ import{jsx as e}from"./preact-jsx-runtime.js";import{useState as B,useRef as w,u
10
10
  \x1B[90m--- Reconnecting (attempt ${$}/5)... ---\x1B[0m\r
11
11
  `),C=setTimeout(()=>b(m),P)}else g.write(`\r
12
12
  \x1B[31m--- Connection lost. Click Restart to try again. ---\x1B[0m\r
13
- `),(R=u.current)==null||R.call(u)},v.onerror=W=>{console.error("[ForgeTerminal] WebSocket error:",W)}};b(o)}const V=new ResizeObserver(()=>{k||M.fit()});V.observe(h.current),J.push({dispose:()=>{E==null||E.close(),V.disconnect(),C&&clearTimeout(C),v&&(k=!0,v.close()),g.dispose(),T.current=null}})})(),()=>{k=!0,J.forEach(F=>F.dispose())}},[r,n,o,p]);const Q=p?{width:"100%",height:"100%"}:{width:"100%",height:`${t}px`};return e("div",{ref:h,class:"overflow-hidden",style:{...Q,background:I(i).background}})},A=U([]);function me(r,n="info"){const o=Math.random().toString(36).slice(2);A.value=[...A.value,{id:o,message:r,type:n}],setTimeout(()=>{A.value=A.value.filter(t=>t.id!==o)},4e3)}const ie={success:"var(--green)",error:"var(--red)",info:"var(--blue)"},ye=()=>e("div",{class:"fixed bottom-4 right-4 flex flex-col gap-2 z-[70]",style:{maxWidth:"calc(100vw - 32px)"},role:"status","aria-live":"polite",children:A.value.map(r=>e("div",{class:"flex items-center gap-2.5",style:{padding:"10px 14px",borderRadius:"12px",background:"var(--card)",border:"1px solid var(--hair)",boxShadow:"var(--shadow-l)",fontSize:"13px",color:"var(--ink)",animation:"riseIn .3s var(--ease) both"},children:[e("span",{class:"shrink-0",style:{width:"6px",height:"6px",borderRadius:"50%",background:ie[r.type]}}),r.message]},r.id))}),le=({label:r,color:n="var(--ink-2)",variant:o="tint",dot:t})=>{const a=o==="tint"?{background:`color-mix(in srgb, ${n} 18%, transparent)`,color:n}:{background:"var(--elev)",color:"var(--ink-2)",border:"1px solid var(--hair)"};return e("span",{class:"inline-flex items-center gap-1.5 whitespace-nowrap shrink-0",style:{...a,padding:"2px 8px",borderRadius:"99px",fontSize:"11px",fontWeight:600},children:[t&&e("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:n}}),r]})},Z=({onClick:r,label:n="Close"})=>e("button",{type:"button","aria-label":n,class:"grid place-items-center shrink-0 cursor-pointer transition-all duration-180 ease-spring hover:text-ink",style:{width:"26px",height:"26px",borderRadius:"50%",border:"1px solid var(--hair)",background:"var(--card)",color:"var(--ink-2)"},onClick:r,children:e("span",{class:"i-lucide-x",style:{width:"13px",height:"13px"}})}),we=({open:r,title:n,onClose:o,footer:t,width:a=540,children:x})=>(H(()=>{if(!r)return;const s=c=>{c.key==="Escape"&&o()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[r,o]),r?e("div",{class:"fixed inset-0 z-[55] flex items-start justify-center overflow-auto",style:{background:"rgba(0,0,0,.42)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",padding:"56px 16px 16px"},onClick:o,children:e("div",{role:"dialog","aria-modal":"true","aria-label":n,class:"flex flex-col overflow-hidden",style:{width:`min(${a}px, 100%)`,maxHeight:"calc(100vh - 72px)",borderRadius:"18px",background:"var(--bg-2)",border:"1px solid var(--hair-2)",boxShadow:"var(--shadow-l)",animation:"popIn .26s var(--ease) both"},onClick:s=>s.stopPropagation(),children:[e("div",{class:"flex items-center gap-2.5 shrink-0",style:{padding:"14px 18px",borderBottom:"1px solid var(--hair)"},children:[e("h2",{style:{fontSize:"17px",fontWeight:700,letterSpacing:"-0.02em"},children:n}),e("span",{class:"flex-1"}),e(Z,{onClick:o})]}),e("div",{class:"overflow-auto min-h-0",style:{padding:"16px 18px"},children:x}),t&&e("div",{class:"flex items-center gap-2.5 shrink-0",style:{padding:"13px 18px",borderTop:"1px solid var(--hair)"},children:t})]})}):null),ke=({title:r,onClose:n,children:o})=>(H(()=>{const t=a=>{a.key==="Escape"&&n()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[n]),e("div",{class:"fixed inset-0 z-50 flex justify-end",style:{background:"rgba(0,0,0,.38)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:n,children:e("aside",{role:"dialog","aria-modal":"true","aria-label":r,class:"flex flex-col h-full overflow-auto",style:{width:"min(492px, 100%)",background:"var(--bg-2)",borderLeft:"1px solid var(--hair)",boxShadow:"var(--shadow-l)",animation:"slideIn .3s var(--ease) both"},onClick:t=>t.stopPropagation(),children:[e("div",{class:"glass flex items-center sticky top-0 z-1",style:{gap:"10px",padding:"14px 18px",borderBottom:"1px solid var(--hair)"},children:[e("h2",{style:{fontSize:"17px",fontWeight:700,letterSpacing:"-0.02em"},children:r}),e("span",{class:"flex-1"}),e(Z,{onClick:n})]}),e("div",{class:"flex flex-col",style:{padding:"16px 18px 24px",gap:"14px"},children:o})]})})),Se=({tabs:r,active:n,onChange:o,fill:t,size:a="md",label:x})=>{const s=a!=="md",c=a==="xs";return e("div",{role:"tablist","aria-label":x,class:`${t?"flex":"inline-flex"} max-w-full overflow-x-auto`,style:{padding:"3px",borderRadius:s?"10px":"11px",background:"var(--elev)",border:"1px solid var(--hair)"},children:r.map(d=>{const i=n===d.id;return e("button",{type:"button",role:"tab","aria-selected":i,disabled:d.disabled,class:`flex items-center justify-center gap-1.5 whitespace-nowrap transition-all duration-200 ease-spring ${t?"flex-1":""} ${d.disabled?"cursor-not-allowed opacity-50":"cursor-pointer"}`,style:{padding:c?"4px 0":t?s?"5px 6px":"7px 8px":s?"5px 11px":"6px 12px",border:0,borderRadius:s?"7px":"8px",fontSize:c?"11.5px":s?"12px":"12.5px",fontWeight:600,background:i?"var(--card)":"transparent",color:i?"var(--ink)":"var(--ink-3)",boxShadow:i?"var(--shadow-s)":"none"},onClick:()=>o(d.id),children:[d.label,d.count!==void 0&&e("span",{class:"mono",style:{fontSize:"11px",fontWeight:400,color:"var(--ink-3)"},children:d.count})]},d.id)})})},ce=({item:r,onItemClick:n})=>{const[o,t]=B(!1);return e("div",{class:`flex items-center justify-between transition-all duration-180 ease-spring ${n?"cursor-pointer":""}`,style:{padding:"11px 15px",borderRadius:"12px",background:"var(--card)",border:`1px solid ${n&&o?"var(--hair-2)":"var(--hair)"}`,boxShadow:"var(--shadow-s)"},onMouseEnter:n?()=>t(!0):void 0,onMouseLeave:n?()=>t(!1):void 0,onClick:n?()=>n(r.id):void 0,children:[e("div",{class:"min-w-0 flex-1",children:[e("div",{class:"truncate",style:{fontSize:"14px",fontWeight:600},children:r.title}),r.subtitle&&e("div",{class:"truncate",style:{fontSize:"12px",color:"var(--ink-2)",marginTop:"2px"},children:r.subtitle})]}),e("div",{class:"flex items-center gap-2 ml-3",children:[r.badge&&e(le,{label:r.badge.label,color:r.badge.color,variant:"tint"}),r.trailing]})]})},Ee=({items:r,loading:n,onItemClick:o})=>n?e("div",{class:"space-y-2",children:[1,2,3].map(t=>e("div",{class:"h-16 animate-pulse",style:{borderRadius:"12px",background:"var(--card)"}},t))}):r.length===0?null:e("div",{class:"space-y-1",children:r.map(t=>e(ce,{item:t,onItemClick:o},t.id))}),We=({icon:r,title:n,description:o,action:t})=>e("div",{class:"flex flex-col items-center justify-center text-center mx-auto",style:{maxWidth:"520px",padding:"36px 28px",borderRadius:"16px",background:"var(--card)",border:"1px solid var(--hair)",boxShadow:"var(--shadow-m)",animation:"riseIn .34s var(--ease) both"},children:[r&&e("span",{class:r,style:{width:"28px",height:"28px",color:"var(--ink-3)",marginBottom:"14px"}}),e("h3",{style:{fontSize:"17px",fontWeight:700,letterSpacing:"-0.02em",marginBottom:"6px"},children:n}),o&&e("p",{style:{fontSize:"13px",color:"var(--ink-2)",maxWidth:"40ch",marginBottom:t?"16px":0},children:o}),t&&e(ne,{label:t.label,variant:"primary",onClick:t.onClick})]}),ze=({checked:r,onChange:n,label:o,disabled:t})=>e("button",{type:"button",role:"switch","aria-checked":r,"aria-label":o,disabled:t,class:`relative shrink-0 ${t?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,style:{width:"44px",height:"26px",borderRadius:"99px",border:0,background:r?"var(--green)":"var(--hair-2)",transition:"background .22s var(--ease)"},onClick:()=>!t&&n(!r),children:e("span",{class:"absolute pointer-events-none",style:{top:"3px",left:r?"21px":"3px",width:"20px",height:"20px",borderRadius:"50%",background:"#fff",boxShadow:"var(--shadow-s)",transition:"left .22s var(--ease)"}})}),Le=({left:r,right:n,defaultWidth:o=300,minWidth:t=200,maxWidth:a=600,storageKey:x="forge-split-width"})=>{const[s,c]=B(()=>{if(typeof localStorage<"u"&&x){const l=localStorage.getItem(x);if(l){const u=parseInt(l,10);if(!isNaN(u)&&u>=t&&u<=a)return u}}return o}),d=w(!1),i=w(0),h=w(0),p=G(l=>{l.preventDefault(),d.current=!0,i.current=l.clientX,h.current=s,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[s]);return _(()=>{const l=f=>{if(!d.current)return;const S=f.clientX-i.current,L=Math.min(a,Math.max(t,h.current+S));c(L)},u=()=>{d.current&&(d.current=!1,document.body.style.cursor="",document.body.style.userSelect="",typeof localStorage<"u"&&x&&localStorage.setItem(x,String(s)))};return document.addEventListener("mousemove",l),document.addEventListener("mouseup",u),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",u)}},[s,t,a,x]),e("div",{class:"flex h-full w-full overflow-hidden",children:[e("div",{class:"shrink-0 overflow-y-auto overflow-x-hidden",style:{width:`${s}px`},children:r}),e("div",{class:"shrink-0 w-1 cursor-col-resize transition-colors hover:bg-blue",style:{backgroundColor:"var(--hair)"},onMouseDown:p}),e("div",{class:"flex-1 min-w-0 overflow-hidden",children:n})]})},Re=({title:r,defaultOpen:n=!1,children:o})=>{const[t,a]=B(n);return e("div",{style:{borderBottom:"1px solid var(--hair)"},children:[e("button",{class:"flex items-center justify-between w-full px-3 py-2.5 cursor-pointer transition-colors text-ink3 hover:text-ink",style:{fontSize:"11px",fontWeight:600,border:0,background:"none"},onClick:()=>a(!t),children:[e("span",{children:r}),e("span",{class:"transition-transform",style:{transform:t?"rotate(90deg)":"rotate(0deg)"},children:e("span",{class:"i-lucide-chevron-right"})})]}),t&&e("div",{class:"px-3 pb-3",children:o})]})},de={normal:"--blue",warning:"--orange",critical:"--red"},pe=({bar:r,size:n})=>{const o=`var(${de[r.severity]})`,t=n==="sm",a=Math.max(0,Math.min(100,r.percent));return e("span",{class:"flex items-center w-full",style:{gap:t?"6px":"9px"},children:[e("span",{class:"mono shrink-0 text-right",style:{width:t?"28px":"32px",fontSize:t?"10px":"11.5px",color:"var(--ink-3)"},children:r.label}),e("span",{class:"relative block flex-1 overflow-hidden",style:{height:t?"4px":"6px",borderRadius:"99px",background:"var(--elev)"},children:e("span",{class:"block h-full",style:{width:`${a}%`,borderRadius:"99px",background:o,transition:"width .6s var(--ease)"}})}),e("span",{class:"mono shrink-0 text-right",style:{width:t?"30px":"36px",fontSize:t?"10px":"11.5px",fontWeight:600,color:r.severity==="normal"?"var(--ink-2)":o},children:[Math.round(r.percent),"%"]}),!t&&r.reset&&e("span",{class:"shrink-0 whitespace-nowrap",style:{fontSize:"11px",color:"var(--ink-3)"},children:r.reset})]})},Te=({bars:r,size:n="md"})=>e("span",{class:"flex flex-col w-full",style:{gap:n==="sm"?"4px":"6px"},children:r.map((o,t)=>e("span",{class:"flex flex-col w-full",style:{gap:"2px"},children:[e(pe,{bar:o,size:n}),o.scope&&n==="md"&&e("span",{style:{paddingLeft:"39px",fontSize:"10.5px",color:"var(--ink-3)"},children:o.scope})]},t))});export{Re as AccordionSection,ne as ActionButton,le as Badge,Z as CloseButton,Ee as DataList,ke as Drawer,We as EmptyState,be as ForgeTerminal,we as Modal,Le as SplitPane,ge as StatusCard,Se as Tabs,ye as ToastContainer,ze as ToggleSwitch,Te as UsageMeter,me as showToast,A as toasts};
13
+ `),(R=u.current)==null||R.call(u)},v.onerror=W=>{console.error("[ForgeTerminal] WebSocket error:",W)}};b(o)}const V=new ResizeObserver(()=>{k||M.fit()});V.observe(h.current),J.push({dispose:()=>{E==null||E.close(),V.disconnect(),C&&clearTimeout(C),v&&(k=!0,v.close()),g.dispose(),T.current=null}})})(),()=>{k=!0,J.forEach(F=>F.dispose())}},[r,n,o,p]);const Y=p?{width:"100%",height:"100%"}:{width:"100%",height:`${t}px`};return e("div",{ref:h,class:"overflow-hidden",style:{...Y,background:I(i).background}})},A=ee([]);function we(r,n="info"){const o=Math.random().toString(36).slice(2);A.value=[...A.value,{id:o,message:r,type:n}],setTimeout(()=>{A.value=A.value.filter(t=>t.id!==o)},4e3)}const le={success:"var(--green)",error:"var(--red)",info:"var(--blue)"},ke=()=>e("div",{class:"fixed bottom-4 right-4 flex flex-col gap-2 z-[70]",style:{maxWidth:"calc(100vw - 32px)"},role:"status","aria-live":"polite",children:A.value.map(r=>e("div",{class:"flex items-center gap-2.5",style:{padding:"10px 14px",borderRadius:"12px",background:"var(--card)",border:"1px solid var(--hair)",boxShadow:"var(--shadow-l)",fontSize:"13px",color:"var(--ink)",animation:"riseIn .3s var(--ease) both"},children:[e("span",{class:"shrink-0",style:{width:"6px",height:"6px",borderRadius:"50%",background:le[r.type]}}),r.message]},r.id))}),ce=({label:r,color:n="var(--ink-2)",variant:o="tint",dot:t})=>{const a=o==="tint"?{background:`color-mix(in srgb, ${n} 18%, transparent)`,color:n}:{background:"var(--elev)",color:"var(--ink-2)",border:"1px solid var(--hair)"};return e("span",{class:"inline-flex items-center gap-1.5 whitespace-nowrap shrink-0",style:{...a,padding:"2px 8px",borderRadius:"99px",fontSize:"11px",fontWeight:600},children:[t&&e("span",{style:{width:"6px",height:"6px",borderRadius:"50%",background:n}}),r]})},Q=({onClick:r,label:n="Close"})=>e("button",{type:"button","aria-label":n,class:"grid place-items-center shrink-0 cursor-pointer transition-all duration-180 ease-spring hover:text-ink",style:{width:"26px",height:"26px",borderRadius:"50%",border:"1px solid var(--hair)",background:"var(--card)",color:"var(--ink-2)"},onClick:r,children:e("span",{class:"i-lucide-x",style:{width:"13px",height:"13px"}})}),Se=({open:r,title:n,onClose:o,footer:t,width:a=540,children:x})=>(H(()=>{if(!r)return;const s=c=>{c.key==="Escape"&&o()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[r,o]),r?Z(e("div",{class:"fixed inset-0 z-[55] flex items-start justify-center overflow-auto",style:{background:"rgba(0,0,0,.42)",backdropFilter:"blur(6px)",WebkitBackdropFilter:"blur(6px)",padding:"56px 16px 16px"},onClick:o,children:e("div",{role:"dialog","aria-modal":"true","aria-label":n,class:"flex flex-col overflow-hidden",style:{width:`min(${a}px, 100%)`,maxHeight:"calc(100vh - 72px)",borderRadius:"18px",background:"var(--bg-2)",border:"1px solid var(--hair-2)",boxShadow:"var(--shadow-l)",animation:"popIn .26s var(--ease) both"},onClick:s=>s.stopPropagation(),children:[e("div",{class:"flex items-center gap-2.5 shrink-0",style:{padding:"14px 18px",borderBottom:"1px solid var(--hair)"},children:[e("h2",{style:{fontSize:"17px",fontWeight:700,letterSpacing:"-0.02em"},children:n}),e("span",{class:"flex-1"}),e(Q,{onClick:o})]}),e("div",{class:"overflow-auto min-h-0",style:{padding:"16px 18px"},children:x}),t&&e("div",{class:"flex items-center gap-2.5 shrink-0",style:{padding:"13px 18px",borderTop:"1px solid var(--hair)"},children:t})]})}),document.body):null),Ee=({title:r,onClose:n,children:o})=>(H(()=>{const t=a=>{a.key==="Escape"&&n()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[n]),Z(e("div",{class:"fixed inset-0 z-50 flex justify-end",style:{background:"rgba(0,0,0,.38)",backdropFilter:"blur(4px)",WebkitBackdropFilter:"blur(4px)"},onClick:n,children:e("aside",{role:"dialog","aria-modal":"true","aria-label":r,class:"flex flex-col h-full overflow-auto",style:{width:"min(492px, 100%)",background:"var(--bg-2)",borderLeft:"1px solid var(--hair)",boxShadow:"var(--shadow-l)",animation:"slideIn .3s var(--ease) both"},onClick:t=>t.stopPropagation(),children:[e("div",{class:"glass flex items-center sticky top-0 z-1",style:{gap:"10px",padding:"14px 18px",borderBottom:"1px solid var(--hair)"},children:[e("h2",{style:{fontSize:"17px",fontWeight:700,letterSpacing:"-0.02em"},children:r}),e("span",{class:"flex-1"}),e(Q,{onClick:n})]}),e("div",{class:"flex flex-col",style:{padding:"16px 18px 24px",gap:"14px"},children:o})]})}),document.body)),We=({tabs:r,active:n,onChange:o,fill:t,size:a="md",label:x})=>{const s=a!=="md",c=a==="xs";return e("div",{role:"tablist","aria-label":x,class:`${t?"flex":"inline-flex"} max-w-full overflow-x-auto`,style:{padding:"3px",borderRadius:s?"10px":"11px",background:"var(--elev)",border:"1px solid var(--hair)"},children:r.map(d=>{const i=n===d.id;return e("button",{type:"button",role:"tab","aria-selected":i,disabled:d.disabled,class:`flex items-center justify-center gap-1.5 whitespace-nowrap transition-all duration-200 ease-spring ${t?"flex-1":""} ${d.disabled?"cursor-not-allowed opacity-50":"cursor-pointer"}`,style:{padding:c?"4px 0":t?s?"5px 6px":"7px 8px":s?"5px 11px":"6px 12px",border:0,borderRadius:s?"7px":"8px",fontSize:c?"11.5px":s?"12px":"12.5px",fontWeight:600,background:i?"var(--card)":"transparent",color:i?"var(--ink)":"var(--ink-3)",boxShadow:i?"var(--shadow-s)":"none"},onClick:()=>o(d.id),children:[d.label,d.count!==void 0&&e("span",{class:"mono",style:{fontSize:"11px",fontWeight:400,color:"var(--ink-3)"},children:d.count})]},d.id)})})},de=({item:r,onItemClick:n})=>{const[o,t]=B(!1);return e("div",{class:`flex items-center justify-between transition-all duration-180 ease-spring ${n?"cursor-pointer":""}`,style:{padding:"11px 15px",borderRadius:"12px",background:"var(--card)",border:`1px solid ${n&&o?"var(--hair-2)":"var(--hair)"}`,boxShadow:"var(--shadow-s)"},onMouseEnter:n?()=>t(!0):void 0,onMouseLeave:n?()=>t(!1):void 0,onClick:n?()=>n(r.id):void 0,children:[e("div",{class:"min-w-0 flex-1",children:[e("div",{class:"truncate",style:{fontSize:"14px",fontWeight:600},children:r.title}),r.subtitle&&e("div",{class:"truncate",style:{fontSize:"12px",color:"var(--ink-2)",marginTop:"2px"},children:r.subtitle})]}),e("div",{class:"flex items-center gap-2 ml-3",children:[r.badge&&e(ce,{label:r.badge.label,color:r.badge.color,variant:"tint"}),r.trailing]})]})},ze=({items:r,loading:n,onItemClick:o})=>n?e("div",{class:"space-y-2",children:[1,2,3].map(t=>e("div",{class:"h-16 animate-pulse",style:{borderRadius:"12px",background:"var(--card)"}},t))}):r.length===0?null:e("div",{class:"space-y-1",children:r.map(t=>e(de,{item:t,onItemClick:o},t.id))}),Le=({icon:r,title:n,description:o,action:t})=>e("div",{class:"flex flex-col items-center justify-center text-center mx-auto",style:{maxWidth:"520px",padding:"36px 28px",borderRadius:"16px",background:"var(--card)",border:"1px solid var(--hair)",boxShadow:"var(--shadow-m)",animation:"riseIn .34s var(--ease) both"},children:[r&&e("span",{class:r,style:{width:"28px",height:"28px",color:"var(--ink-3)",marginBottom:"14px"}}),e("h3",{style:{fontSize:"17px",fontWeight:700,letterSpacing:"-0.02em",marginBottom:"6px"},children:n}),o&&e("p",{style:{fontSize:"13px",color:"var(--ink-2)",maxWidth:"40ch",marginBottom:t?"16px":0},children:o}),t&&e(oe,{label:t.label,variant:"primary",onClick:t.onClick})]}),Re=({checked:r,onChange:n,label:o,disabled:t})=>e("button",{type:"button",role:"switch","aria-checked":r,"aria-label":o,disabled:t,class:`relative shrink-0 ${t?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,style:{width:"44px",height:"26px",borderRadius:"99px",border:0,background:r?"var(--green)":"var(--hair-2)",transition:"background .22s var(--ease)"},onClick:()=>!t&&n(!r),children:e("span",{class:"absolute pointer-events-none",style:{top:"3px",left:r?"21px":"3px",width:"20px",height:"20px",borderRadius:"50%",background:"#fff",boxShadow:"var(--shadow-s)",transition:"left .22s var(--ease)"}})}),Te=({left:r,right:n,defaultWidth:o=300,minWidth:t=200,maxWidth:a=600,storageKey:x="forge-split-width"})=>{const[s,c]=B(()=>{if(typeof localStorage<"u"&&x){const l=localStorage.getItem(x);if(l){const u=parseInt(l,10);if(!isNaN(u)&&u>=t&&u<=a)return u}}return o}),d=w(!1),i=w(0),h=w(0),p=U(l=>{l.preventDefault(),d.current=!0,i.current=l.clientX,h.current=s,document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[s]);return _(()=>{const l=f=>{if(!d.current)return;const S=f.clientX-i.current,L=Math.min(a,Math.max(t,h.current+S));c(L)},u=()=>{d.current&&(d.current=!1,document.body.style.cursor="",document.body.style.userSelect="",typeof localStorage<"u"&&x&&localStorage.setItem(x,String(s)))};return document.addEventListener("mousemove",l),document.addEventListener("mouseup",u),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",u)}},[s,t,a,x]),e("div",{class:"flex h-full w-full overflow-hidden",children:[e("div",{class:"shrink-0 overflow-y-auto overflow-x-hidden",style:{width:`${s}px`},children:r}),e("div",{class:"shrink-0 w-1 cursor-col-resize transition-colors hover:bg-blue",style:{backgroundColor:"var(--hair)"},onMouseDown:p}),e("div",{class:"flex-1 min-w-0 overflow-hidden",children:n})]})},$e=({title:r,defaultOpen:n=!1,children:o})=>{const[t,a]=B(n);return e("div",{style:{borderBottom:"1px solid var(--hair)"},children:[e("button",{class:"flex items-center justify-between w-full px-3 py-2.5 cursor-pointer transition-colors text-ink3 hover:text-ink",style:{fontSize:"11px",fontWeight:600,border:0,background:"none"},onClick:()=>a(!t),children:[e("span",{children:r}),e("span",{class:"transition-transform",style:{transform:t?"rotate(90deg)":"rotate(0deg)"},children:e("span",{class:"i-lucide-chevron-right"})})]}),t&&e("div",{class:"px-3 pb-3",children:o})]})},pe={normal:"--blue",warning:"--orange",critical:"--red"},ue=({bar:r,size:n})=>{const o=`var(${pe[r.severity]})`,t=n==="sm",a=Math.max(0,Math.min(100,r.percent));return e("span",{class:"flex items-center w-full",style:{gap:t?"6px":"9px"},children:[e("span",{class:"mono shrink-0 text-right",style:{width:t?"28px":"32px",fontSize:t?"10px":"11.5px",color:"var(--ink-3)"},children:r.label}),e("span",{class:"relative block flex-1 overflow-hidden",style:{height:t?"4px":"6px",borderRadius:"99px",background:"var(--elev)"},children:e("span",{class:"block h-full",style:{width:`${a}%`,borderRadius:"99px",background:o,transition:"width .6s var(--ease)"}})}),e("span",{class:"mono shrink-0 text-right",style:{width:t?"30px":"36px",fontSize:t?"10px":"11.5px",fontWeight:600,color:r.severity==="normal"?"var(--ink-2)":o},children:[Math.round(r.percent),"%"]}),!t&&r.reset&&e("span",{class:"shrink-0 whitespace-nowrap",style:{fontSize:"11px",color:"var(--ink-3)"},children:r.reset})]})},Pe=({bars:r,size:n="md"})=>e("span",{class:"flex flex-col w-full",style:{gap:n==="sm"?"4px":"6px"},children:r.map((o,t)=>e("span",{class:"flex flex-col w-full",style:{gap:"2px"},children:[e(ue,{bar:o,size:n}),o.scope&&n==="md"&&e("span",{style:{paddingLeft:"39px",fontSize:"10.5px",color:"var(--ink-3)"},children:o.scope})]},t))});export{$e as AccordionSection,oe as ActionButton,ce as Badge,Q as CloseButton,ze as DataList,Ee as Drawer,Le as EmptyState,ye as ForgeTerminal,Se as Modal,Te as SplitPane,me as StatusCard,We as Tabs,ke as ToastContainer,Re as ToggleSwitch,Pe as UsageMeter,we as showToast,A as toasts};