xedonium 0.2.0 → 0.4.0

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/dist/xedonium.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("react"),q=require("react-dom"),he=6,U=8,oe=({text:t,children:s,className:r=""})=>{const a=x.useId(),n=x.useRef(null),l=x.useRef(null),[o,c]=x.useState(!1),[i,u]=x.useState(null),f=()=>c(!0),d=()=>{c(!1),u(null)};if(x.useLayoutEffect(()=>{if(!o||!n.current||!l.current)return;const h=n.current.getBoundingClientRect(),b=l.current.getBoundingClientRect(),p=document.documentElement.clientWidth,g=window.innerHeight;let v=h.bottom+he;v+b.height>g-U&&(v=Math.max(U,h.top-he-b.height));const M=h.left+h.width/2-b.width/2,y=Math.min(Math.max(U,M),p-U-b.width);u({top:v,left:y})},[o,t]),x.useEffect(()=>{if(!o)return;const h=b=>b.key==="Escape"&&d();return window.addEventListener("keydown",h),window.addEventListener("scroll",d,!0),window.addEventListener("resize",d),()=>{window.removeEventListener("keydown",h),window.removeEventListener("scroll",d,!0),window.removeEventListener("resize",d)}},[o]),!t)return s;const m=s.props["aria-label"]!==t;return e.jsxs("span",{ref:n,className:`inline-flex [&>:disabled]:pointer-events-none has-[>:disabled]:cursor-not-allowed ${r}`,onMouseEnter:f,onMouseLeave:d,onFocus:h=>h.target.matches(":focus-visible")&&f(),onBlur:d,onPointerDown:d,children:[m?x.cloneElement(s,{"aria-describedby":a}):s,m&&e.jsx("span",{id:a,hidden:!0,children:t}),o&&q.createPortal(e.jsx("div",{ref:l,"aria-hidden":"true",style:{top:(i==null?void 0:i.top)??0,left:(i==null?void 0:i.left)??0,visibility:i?"visible":"hidden"},className:"pointer-events-none fixed z-[var(--xd-z-tooltip,100)] w-max max-w-[16rem] border border-app-border bg-app-card px-2.5 py-1.5 text-xs normal-case tracking-normal text-app-text shadow-xl",children:t}),document.body)]})},A=t=>{const{onClick:s,tooltip:r,variant:a="default",className:n="",children:l,type:o="button",disabled:c=!1,...i}=t,u={default:"bg-app-strong text-app-bg border border-app-strong hover:bg-app-text",secondary:"bg-app-bg text-app-text border border-app-border hover:border-app-strong hover:text-app-text",danger:"bg-red-500/10 text-red-700 dark:text-red-400 border border-red-500/30 hover:bg-red-500/20",warning:"bg-amber-400 text-black border border-amber-400 hover:bg-amber-300 hover:border-amber-300"},f=e.jsx("button",{type:o,onClick:s,disabled:c,className:`text-xs font-semibold uppercase tracking-widest ${u[a]} px-3 py-2 transition disabled:cursor-not-allowed disabled:opacity-50 ${n}`,...i,children:l});return r?e.jsx(oe,{text:r,children:f}):f},He={default:"text-app-text hover:bg-app-bg",warning:"text-amber-700 hover:bg-amber-400/10 dark:text-amber-400"},Ye=({label:t,trigger:s,variant:r="secondary",items:a,className:n=""})=>{const[l,o]=x.useState(!1),c=x.useRef(null),i=x.useId();x.useEffect(()=>{if(!l)return;const f=m=>{c.current&&!c.current.contains(m.target)&&o(!1)},d=m=>{var h,b;m.key==="Escape"&&(o(!1),(b=(h=c.current)==null?void 0:h.querySelector("button"))==null||b.focus())};return document.addEventListener("mousedown",f),document.addEventListener("keydown",d),()=>{document.removeEventListener("mousedown",f),document.removeEventListener("keydown",d)}},[l]);const u=f=>{o(!1),f.onClick()};return e.jsxs("div",{ref:c,className:`relative ${n}`,children:[e.jsx(A,{onClick:()=>o(f=>!f),variant:r,"aria-label":t,"aria-haspopup":"menu","aria-expanded":l,"aria-controls":l?i:void 0,children:s}),l&&e.jsx("div",{id:i,role:"menu","aria-label":t,className:"absolute right-0 top-full z-20 mt-2 w-60 overflow-hidden border border-app-border bg-app-card shadow-lg",children:a.map(f=>e.jsxs("button",{type:"button",role:"menuitem",disabled:f.disabled,"aria-haspopup":f.hasDialog?"dialog":void 0,onClick:()=>u(f),className:`flex w-full items-center gap-2 border-b border-app-border bg-app-card px-3 py-2.5 text-left transition last:border-b-0 disabled:cursor-not-allowed disabled:opacity-50 ${He[f.tone||"default"]}`,children:[e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-xs font-medium uppercase tracking-widest",children:f.label}),f.description&&e.jsx("span",{className:"mt-0.5 block text-xs normal-case tracking-normal text-app-muted",children:f.description})]}),f.badge!=null&&e.jsx("span",{className:"font-mono text-xs",children:f.badge})]},f.key))})]})},V=({className:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:t??"h-5 w-5 text-app-soft",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),Me=({className:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:t??"w-4 h-4 text-red-600 dark:text-red-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"})}),Ve={info:"border-app-border bg-app-card text-app-text",success:"border-emerald-500/40 bg-emerald-500/10 text-emerald-800 dark:text-emerald-300",warning:"border-amber-500/50 bg-amber-400/15 text-amber-900 dark:text-amber-200",danger:"border-red-500/40 bg-red-500/10 text-red-800 dark:text-red-300"},Ze=({tone:t="info",title:s,onClose:r,icon:a,className:n="",children:l})=>e.jsxs("div",{role:t==="danger"||t==="warning"?"alert":"status",className:`flex items-start gap-3 border px-4 py-3 text-sm ${Ve[t]} ${n}`,children:[e.jsx("span",{className:"mt-0.5 shrink-0",children:a??e.jsx(Me,{className:"h-4 w-4"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[s&&e.jsx("div",{className:"font-semibold",children:s}),l&&e.jsx("div",{className:s?"mt-0.5 opacity-90":"",children:l})]}),r&&e.jsx("button",{type:"button",onClick:r,"aria-label":"Dismiss",className:"shrink-0 opacity-70 transition hover:opacity-100",children:e.jsx(V,{className:"h-4 w-4"})})]}),ie=x.createContext({activeTheme:"dark",toggleTheme:()=>{}}),Ce=()=>x.useContext(ie),Ee=t=>`flex h-9 w-9 items-center justify-center border transition hover:bg-app-card/80 ${t?"border-app-strong bg-app-card/80":"border-transparent hover:border-app-border"}`,Qe=()=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:"h-4 w-4 text-app-soft",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12.79A9 9 0 1111.21 3a7 7 0 009.79 9.79z"})}),Xe=()=>e.jsxs("svg",{"aria-hidden":"true",focusable:"false",className:"h-4 w-4 text-yellow-600",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[e.jsx("circle",{cx:"12",cy:"12",r:"4"}),e.jsx("path",{strokeLinecap:"round",d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}),ce=({variant:t="button"})=>{const{activeTheme:s,toggleTheme:r}=Ce(),a=s==="dark",n=`Switch to ${a?"light":"dark"} theme`,l=a?e.jsx(Qe,{}):e.jsx(Xe,{});return t==="toolbar"?e.jsx(oe,{text:n,children:e.jsx("button",{type:"button",onClick:r,"aria-label":n,className:Ee(!1),children:l})}):e.jsx(A,{onClick:r,tooltip:n,"aria-label":n,variant:"secondary",children:l})},Je=t=>`px-2.5 py-1.5 text-xs font-semibold uppercase tracking-widest transition sm:px-3 ${t?"bg-app-card text-app-text":"text-app-muted hover:text-app-text"}`,et=({brand:t,logo:s,brandHref:r="/",links:a=[],actions:n,themeToggle:l=!0,hideBrandOnMobile:o=!1,linkComponent:c="a",linkProp:i="href",maxWidth:u="max-w-5xl"})=>e.jsx("header",{className:"sticky top-0 z-40 border-b border-app-border bg-app-bg/95 backdrop-blur",children:e.jsxs("div",{className:`mx-auto flex h-14 w-full ${u} items-center justify-between gap-3 px-4`,children:[e.jsxs(c,{[i]:r,className:"flex shrink-0 items-center gap-2 text-app-text",children:[s,e.jsx("span",{className:`text-base font-bold tracking-tight ${o?"hidden sm:inline":""}`,children:t})]}),a.length>0&&e.jsx("nav",{"aria-label":"Main",className:"flex items-center gap-1",children:a.map(({href:f,label:d,active:m=!1,...h})=>e.jsx(c,{[i]:f,"aria-current":m?"page":void 0,className:Je(m),...h,children:d},f))}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[l&&e.jsx(ce,{variant:"toolbar"}),n]})]})}),tt='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',_=(t,s)=>{x.useEffect(()=>{const r=s.current;if(!t||!r)return;const a=document.activeElement,n=()=>[...r.querySelectorAll(tt)];(r.querySelector("[data-autofocus]")||n()[0]||r).focus();const l=o=>{if(o.key!=="Tab")return;const c=n();if(!c.length){o.preventDefault();return}const i=c[0],u=c[c.length-1];o.shiftKey&&document.activeElement===i?(o.preventDefault(),u.focus()):!o.shiftKey&&document.activeElement===u&&(o.preventDefault(),i.focus())};return r.addEventListener("keydown",l),()=>{r.removeEventListener("keydown",l),a!=null&&a.isConnected&&a.focus()}},[t,s])},Z=(t,s)=>{x.useEffect(()=>{if(!t)return;const r=a=>{a.key==="Escape"&&s()};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[t,s])},st={right:"right-0 border-l",left:"left-0 border-r"},Le=({open:t,onClose:s,title:r,side:a="right",width:n="max-w-md",footer:l,children:o})=>{const c=x.useRef(null),i=x.useId();return Z(t,s),_(t,c),x.useEffect(()=>{if(!t)return;const u=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=u}},[t]),t?q.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[var(--xd-z-modal,80)]",children:[e.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:s}),e.jsxs("aside",{ref:c,role:"dialog","aria-modal":"true","aria-labelledby":i,tabIndex:-1,className:`absolute inset-y-0 flex w-full flex-col border-app-border bg-app-card shadow-2xl ${st[a]} ${n}`,children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-app-border px-6 py-4",children:[e.jsx("h2",{id:i,className:"text-sm font-semibold uppercase tracking-widest text-app-soft",children:r}),e.jsx(A,{onClick:s,tooltip:"Close","aria-label":"Close",variant:"secondary",children:e.jsx(V,{})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:o}),l&&e.jsx("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-3 border-t border-app-border px-6 py-4",children:l})]})]}),document.body):null},Se=({className:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:t??"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})}),rt=({header:t,sidebar:s,sidebarTitle:r="Menu",children:a,className:n=""})=>{const[l,o]=x.useState(!1),c=()=>o(!1),i=typeof s=="function"?s(c):s;return e.jsxs("div",{className:`flex h-screen flex-col bg-app-bg text-app-text ${n}`,children:[e.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-app-border bg-app-card px-4 py-2",children:[s&&e.jsx("span",{className:"md:hidden",children:e.jsx(A,{variant:"secondary","aria-label":"Open menu",onClick:()=>o(!0),children:e.jsx(Se,{})})}),e.jsx("div",{className:"min-w-0 flex-1",children:t})]}),e.jsxs("div",{className:"flex min-h-0 flex-1",children:[s&&e.jsx("aside",{className:"hidden shrink-0 md:block",children:i}),e.jsx("main",{className:"min-w-0 flex-1 overflow-y-auto p-4 sm:p-6",children:a})]}),s&&e.jsx(Le,{open:l,onClose:c,title:r,side:"left",width:"max-w-xs",children:e.jsx("div",{className:"-m-6",children:typeof s=="function"?s(c):s})})]})},be=["rgb(var(--color-app-strong))","#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#06b6d4","#ec4899"],Q=(t,s)=>t.color??be[s%be.length],Ie=(t,s,r=5)=>{const a=Math.min(0,t),n=s<=a?a+1:s,l=(n-a)/(r-1),o=10**Math.floor(Math.log10(l)),c=l/o,i=(c<=1?1:c<=2?2:c<=5?5:10)*o,u=Math.floor(a/i)*i,f=Math.ceil(n/i)*i,d=[];for(let m=u;m<=f+i/2;m+=i)d.push(Number(m.toPrecision(12)));return{min:u,max:f,ticks:d}},at=t=>new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1}).format(t),nt=600,D={top:12,right:16,bottom:28,left:44},Te=()=>{const t=x.useRef(null),[s,r]=x.useState(nt);return x.useEffect(()=>{const a=t.current;if(!a||typeof ResizeObserver>"u")return;const n=new ResizeObserver(([l])=>{const o=Math.round(l.contentRect.width);o>0&&r(o)});return n.observe(a),()=>n.disconnect()},[]),[t,s]},de=({items:t})=>e.jsx("ul",{className:"m-0 mt-2 flex list-none flex-wrap justify-center gap-x-4 gap-y-1 p-0 text-xs text-app-muted",children:t.map(s=>e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{"aria-hidden":"true",className:"inline-block h-2.5 w-2.5",style:{background:s.color}}),s.name]},s.name))}),De=({width:t,height:s,scale:r,labels:a,xPositions:n,label:l,children:o,legend:c})=>{const i=s-D.bottom,u=i-D.top,f=d=>D.top+u*(1-(d-r.min)/(r.max-r.min));return e.jsxs("figure",{className:"m-0",children:[e.jsxs("svg",{role:"img","aria-label":l,width:t,height:s,viewBox:`0 0 ${t} ${s}`,className:"block max-w-full text-app-muted",fontFamily:"inherit",children:[r.ticks.map(d=>e.jsxs("g",{children:[e.jsx("line",{x1:D.left,x2:t-D.right,y1:f(d),y2:f(d),stroke:"rgb(var(--color-app-border))",strokeWidth:"1",strokeDasharray:d===r.min?void 0:"3 3"}),e.jsx("text",{x:D.left-6,y:f(d),textAnchor:"end",dominantBaseline:"middle",fontSize:"11",fill:"currentColor",children:at(d)})]},d)),a.map((d,m)=>e.jsx("text",{x:n[m],y:i+16,textAnchor:"middle",fontSize:"11",fill:"currentColor",children:d},`${d}-${m}`)),o(f)]}),c]})},Ae=t=>t.map((s,r)=>({name:s.name,color:Q(s,r)})),Fe=({labels:t,series:s,height:r=300,area:a=!1,label:n="Line chart",legend:l=!0,className:o=""})=>{const[c,i]=Te(),u=s.flatMap(p=>p.values),f=Ie(Math.min(...u),Math.max(...u)),d=D.left,m=i-D.right,h=p=>t.length===1?(d+m)/2:d+(m-d)*p/(t.length-1),b=t.map((p,g)=>h(g));return e.jsx("div",{ref:c,className:o,children:e.jsx(De,{width:i,height:r,scale:f,labels:t,xPositions:b,label:n,legend:l&&s.length>1?e.jsx(de,{items:Ae(s)}):null,children:p=>{const g=p(Math.max(f.min,0));return s.map((v,M)=>{const y=Q(v,M),C=v.values.map((j,$)=>`${h($)},${p(j)}`);return e.jsxs("g",{children:[a&&e.jsx("polygon",{points:`${h(0)},${g} ${C.join(" ")} ${h(v.values.length-1)},${g}`,fill:y,opacity:"0.18"}),e.jsx("polyline",{points:C.join(" "),fill:"none",stroke:y,strokeWidth:"2",strokeLinejoin:"round"}),v.values.map((j,$)=>e.jsx("circle",{cx:h($),cy:p(j),r:"3.5",fill:y,children:e.jsx("title",{children:`${v.name}, ${t[$]}: ${j}`})},$))]},v.name)})}})})},lt=({label:t="Area chart",...s})=>e.jsx(Fe,{area:!0,label:t,...s}),ot={sm:"h-6 w-6 text-[10px]",md:"h-9 w-9 text-xs",lg:"h-14 w-14 text-base"},it=t=>(t??"").split(/\s+/).filter(Boolean).slice(0,2).map(s=>s[0].toUpperCase()).join(""),ct=({src:t,name:s,size:r="md",className:a=""})=>{const[n,l]=x.useState(!1),o=t&&!n;return e.jsx("span",{role:"img","aria-label":s,className:`inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full border border-app-border bg-app-bg font-semibold uppercase tracking-wider text-app-soft ${ot[r]} ${a}`,children:o?e.jsx("img",{src:t,alt:"",className:"h-full w-full object-cover",onError:()=>l(!0)}):it(s)||"?"})},dt=({labels:t,series:s,height:r=300,stacked:a=!1,label:n="Bar chart",legend:l=!0,className:o=""})=>{const[c,i]=Te(),u=t.map((y,C)=>s.reduce((j,$)=>j+$.values[C],0)),f=Math.max(...a?u:s.flatMap(y=>y.values)),d=a?0:Math.min(...s.flatMap(y=>y.values)),m=Ie(d,f),h=D.left,p=(i-D.right-D.left)/t.length,g=p*.7,v=a?g:g/s.length,M=t.map((y,C)=>h+p*C+p/2);return e.jsx("div",{ref:c,className:o,children:e.jsx(De,{width:i,height:r,scale:m,labels:t,xPositions:M,label:n,legend:l&&s.length>1?e.jsx(de,{items:Ae(s)}):null,children:y=>{const C=y(Math.max(m.min,0));return t.map((j,$)=>{const N=h+p*$+(p-g)/2;let w=C;return e.jsx("g",{children:s.map((L,S)=>{const I=L.values[$],R=y(I),F=Math.abs(C-R);let k=Math.min(R,C);const E=N+(a?0:v*S);return a&&(k=w-F,w=k),e.jsx("rect",{x:E+1,y:k,width:Math.max(v-2,1),height:F,fill:Q(L,S),children:e.jsx("title",{children:`${L.name}, ${j}: ${I}`})},L.name)})},`${j}-${$}`)})}})})},pt=({items:t,linkComponent:s="a",linkProp:r="href",className:a=""})=>e.jsx("nav",{"aria-label":"Breadcrumb",className:a,children:e.jsx("ol",{className:"m-0 flex list-none flex-wrap items-center gap-2 p-0 text-xs font-semibold uppercase tracking-widest",children:t.map((n,l)=>{const o=l===t.length-1;return e.jsxs("li",{className:"flex items-center gap-2",children:[o||!n.href?e.jsx("span",{"aria-current":o?"page":void 0,className:o?"text-app-text":"text-app-muted",children:n.label}):e.jsx(s,{[r]:n.href,className:"text-app-muted transition hover:text-app-text",children:n.label}),!o&&e.jsx("span",{"aria-hidden":"true",className:"text-app-border",children:"/"})]},`${n.label}-${l}`)})})}),ge=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate()),B=(t,s)=>new Date(t.getFullYear(),t.getMonth(),t.getDate()+s),ee=(t,s)=>{const r=new Date(t.getFullYear(),t.getMonth()+s,1),a=new Date(r.getFullYear(),r.getMonth()+1,0).getDate();return new Date(r.getFullYear(),r.getMonth(),Math.min(t.getDate(),a))},W=(t,s)=>!!t&&!!s&&t.getTime()===s.getTime(),K=(t,s)=>t.getTime()<s.getTime(),xt=(t,s,r)=>!!s&&K(t,s)||!!r&&K(r,t),ut=(t,s=0)=>{const r=new Date(t.getFullYear(),t.getMonth(),1),a=(r.getDay()-s+7)%7,n=B(r,-a),l=[];for(let o=0;o<6;o++){const c=Array.from({length:7},(i,u)=>B(n,o*7+u));if(o>=4&&c[0].getMonth()!==t.getMonth())break;l.push(c)}return l},ft=(t=0,s)=>Array.from({length:7},(r,a)=>{const n=new Date(2023,0,1+(t+a)%7);return new Intl.DateTimeFormat(s,{weekday:"short"}).format(n)}),mt=(t,s)=>new Intl.DateTimeFormat(s,{month:"long",year:"numeric"}).format(t),re=(t,s)=>t?new Intl.DateTimeFormat(s,{year:"numeric",month:"short",day:"numeric"}).format(t):"",je="border border-app-border bg-app-bg px-2 py-1 text-xs font-semibold text-app-text transition hover:border-app-strong disabled:cursor-not-allowed disabled:opacity-50",pe=({value:t,onChange:s,rangeStart:r,rangeEnd:a,min:n,max:l,weekStartsOn:o=0,locale:c,className:i=""})=>{const u=ge(new Date),f=t??r??u,[d,m]=x.useState(ge(f)),[h,b]=x.useState(new Date(f.getFullYear(),f.getMonth(),1)),p=x.useRef(null),g=x.useRef(!1);x.useEffect(()=>{var N,w;g.current&&(g.current=!1,(w=(N=p.current)==null?void 0:N.querySelector('button[tabindex="0"]'))==null||w.focus())});const v=N=>{g.current=!0,m(N),(N.getMonth()!==h.getMonth()||N.getFullYear()!==h.getFullYear())&&b(new Date(N.getFullYear(),N.getMonth(),1))},M=N=>{const w=(d.getDay()-o+7)%7,L={ArrowLeft:B(d,-1),ArrowRight:B(d,1),ArrowUp:B(d,-7),ArrowDown:B(d,7),PageUp:ee(d,-1),PageDown:ee(d,1),Home:B(d,-w),End:B(d,6-w)};L[N.key]&&(N.preventDefault(),v(L[N.key]))},y=N=>{const w=ee(h,N);b(w),m(new Date(w.getFullYear(),w.getMonth(),Math.min(d.getDate(),28)))},[C,j]=r&&a&&K(a,r)?[a,r]:[r,a],$=ut(h,o);return e.jsxs("div",{className:`inline-block border border-app-border bg-app-card p-3 text-app-text ${i}`,children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[e.jsx("button",{type:"button",className:je,"aria-label":"Previous month",onClick:()=>y(-1),children:"‹"}),e.jsx("div",{"aria-live":"polite",className:"text-xs font-semibold uppercase tracking-widest",children:mt(h,c)}),e.jsx("button",{type:"button",className:je,"aria-label":"Next month",onClick:()=>y(1),children:"›"})]}),e.jsxs("table",{ref:p,role:"grid",onKeyDown:M,className:"border-collapse",children:[e.jsx("thead",{children:e.jsx("tr",{children:ft(o,c).map(N=>e.jsx("th",{scope:"col",className:"h-8 w-9 text-[10px] font-semibold uppercase tracking-widest text-app-muted",children:N.slice(0,2)},N))})}),e.jsx("tbody",{children:$.map(N=>e.jsx("tr",{children:N.map(w=>{const L=W(w,t)||W(w,C)||W(w,j),S=C&&j&&!K(w,C)&&!K(j,w),I=w.getMonth()!==h.getMonth(),R=xt(w,n,l);let F="text-app-text hover:bg-app-bg";return L?F="bg-app-strong text-app-bg":S?F="bg-app-soft/20 text-app-text":I&&(F="text-app-muted hover:bg-app-bg"),e.jsx("td",{role:"gridcell","aria-selected":L,className:"p-0",children:e.jsx("button",{type:"button",tabIndex:W(w,d)?0:-1,disabled:R,"aria-label":w.toDateString(),"aria-current":W(w,u)?"date":void 0,onClick:()=>{m(w),s==null||s(w)},className:`h-9 w-9 text-xs transition disabled:cursor-not-allowed disabled:opacity-30 ${F} ${W(w,u)&&!L?"font-bold underline underline-offset-2":""}`,children:w.getDate()})},w.getTime())})},N[0].getTime()))})]})]})},ht=({title:t,subtitle:s,actions:r,footer:a,padded:n=!0,className:l="",children:o})=>e.jsxs("section",{className:`flex flex-col border border-app-border bg-app-card ${l}`,children:[(t||r)&&e.jsxs("header",{className:"flex items-center justify-between gap-3 border-b border-app-border px-5 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[t&&e.jsx("h3",{className:"m-0 text-sm font-semibold uppercase tracking-widest text-app-text",children:t}),s&&e.jsx("p",{className:"m-0 mt-0.5 text-xs text-app-muted",children:s})]}),r&&e.jsx("div",{className:"flex shrink-0 items-center gap-2",children:r})]}),e.jsx("div",{className:`flex-1 text-sm text-app-text ${n?"p-5":""}`,children:o}),a&&e.jsx("footer",{className:"border-t border-app-border px-5 py-3 text-sm",children:a})]}),ve="absolute top-1/2 z-10 -translate-y-1/2 border border-app-border bg-app-card/90 px-2 py-2 text-app-text transition hover:border-app-strong disabled:cursor-not-allowed disabled:opacity-40",bt=({children:t,index:s,defaultIndex:r=0,onIndexChange:a,autoPlay:n=0,loop:l=!0,label:o="Carousel",className:c=""})=>{const i=x.Children.toArray(t),[u,f]=x.useState(r),[d,m]=x.useState(!1),h=s??u,b=p=>{if(!i.length)return;let g=p;l?g=(p+i.length)%i.length:g=Math.min(Math.max(p,0),i.length-1),s===void 0&&f(g),a==null||a(g)};return x.useEffect(()=>{if(!n||d||i.length<2)return;const p=setTimeout(()=>b(h+1),n);return()=>clearTimeout(p)},[n,d,h,i.length]),e.jsxs("div",{role:"region","aria-roledescription":"carousel","aria-label":o,className:`relative ${c}`,onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),onFocus:()=>m(!0),onBlur:()=>m(!1),onKeyDown:p=>{p.key==="ArrowLeft"?b(h-1):p.key==="ArrowRight"&&b(h+1)},children:[e.jsx("div",{className:"overflow-hidden border border-app-border bg-app-card",children:e.jsx("div",{className:"flex transition-transform duration-300 ease-out",style:{transform:`translateX(-${h*100}%)`},"aria-live":n&&!d?"off":"polite",children:i.map((p,g)=>e.jsx("div",{role:"group","aria-roledescription":"slide","aria-label":`${g+1} of ${i.length}`,"aria-hidden":g!==h,ref:v=>{v&&(g===h?v.removeAttribute("inert"):v.setAttribute("inert",""))},className:"w-full shrink-0",children:p},g))})}),i.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button","aria-label":"Previous slide",className:`${ve} left-2`,disabled:!l&&h===0,onClick:()=>b(h-1),children:"‹"}),e.jsx("button",{type:"button","aria-label":"Next slide",className:`${ve} right-2`,disabled:!l&&h===i.length-1,onClick:()=>b(h+1),children:"›"}),e.jsx("div",{className:"mt-2 flex justify-center gap-1.5",children:i.map((p,g)=>e.jsx("button",{type:"button","aria-label":`Go to slide ${g+1}`,"aria-current":g===h,onClick:()=>b(g),className:`h-2 w-2 border border-app-strong transition ${g===h?"bg-app-strong":"bg-transparent"}`},g))})]})]})},ae=({label:t,checked:s,onChange:r,indeterminate:a=!1,disabled:n=!1,className:l="",...o})=>{const c=x.useId(),i=x.useRef(null);return x.useEffect(()=>{i.current&&(i.current.indeterminate=a)},[a]),e.jsxs("label",{htmlFor:c,className:`inline-flex items-center gap-2 align-middle text-sm leading-none text-app-text ${n?"cursor-not-allowed opacity-50":"cursor-pointer"} ${l}`,children:[e.jsx("input",{ref:i,id:c,type:"checkbox",checked:s,disabled:n,onChange:u=>r==null?void 0:r(u.target.checked),className:"h-4 w-4 cursor-[inherit] accent-[rgb(var(--color-app-strong))]",...o}),t]})},gt=({open:t,onClose:s,commands:r,placeholder:a="Type a command…",empty:n="No matching commands"})=>{const[l,o]=x.useState(""),[c,i]=x.useState(0),u=x.useRef(null),f=x.useRef(null),d=x.useId();Z(t,s),_(t,u),x.useEffect(()=>{t&&(o(""),i(0))},[t]);const m=x.useMemo(()=>{const p=l.trim().toLowerCase(),g=p?r.filter(M=>`${M.label} ${M.description??""} ${M.group??""}`.toLowerCase().includes(p)):r;return[...new Set(g.map(M=>M.group))].flatMap(M=>g.filter(y=>y.group===M))},[r,l]);if(x.useEffect(()=>{var p,g,v;(v=(g=(p=f.current)==null?void 0:p.querySelector('[aria-selected="true"]'))==null?void 0:g.scrollIntoView)==null||v.call(g,{block:"nearest"})},[c,m]),!t)return null;const h=p=>{var g;p&&(s(),(g=p.onSelect)==null||g.call(p))},b=p=>{p.key==="ArrowDown"?(p.preventDefault(),i(g=>m.length?(g+1)%m.length:0)):p.key==="ArrowUp"?(p.preventDefault(),i(g=>m.length?(g-1+m.length)%m.length:0)):p.key==="Enter"&&(p.preventDefault(),h(m[c]))};return q.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[var(--xd-z-modal,80)] flex items-start justify-center px-4 pt-[15vh]",children:[e.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:s}),e.jsxs("div",{ref:u,role:"dialog","aria-modal":"true","aria-label":"Command palette",tabIndex:-1,className:"relative z-10 flex max-h-[60vh] w-full max-w-xl flex-col border border-app-border bg-app-card shadow-2xl",children:[e.jsx("input",{"data-autofocus":!0,role:"combobox","aria-expanded":"true","aria-controls":d,"aria-activedescendant":m[c]?`${d}-${m[c].key}`:void 0,"aria-autocomplete":"list",value:l,onChange:p=>{o(p.target.value),i(0)},onKeyDown:b,placeholder:a,"aria-label":"Search commands",className:"w-full border-b border-app-border bg-transparent px-4 py-3 text-sm text-app-text outline-none placeholder:text-app-muted"}),e.jsxs("ul",{id:d,ref:f,role:"listbox","aria-label":"Commands",className:"m-0 flex-1 list-none overflow-y-auto p-0",children:[m.length===0&&e.jsx("li",{className:"px-4 py-6 text-center text-sm text-app-muted",children:n}),m.map((p,g)=>{var M;const v=p.group&&p.group!==((M=m[g-1])==null?void 0:M.group);return e.jsxs("li",{role:"presentation",children:[v&&e.jsx("div",{className:"px-4 pb-1 pt-3 text-[10px] font-semibold uppercase tracking-widest text-app-muted",children:p.group}),e.jsxs("div",{id:`${d}-${p.key}`,role:"option","aria-selected":g===c,onMouseMove:()=>i(g),onClick:()=>h(p),className:`flex cursor-pointer items-center justify-between gap-3 px-4 py-2.5 text-sm ${g===c?"bg-app-strong text-app-bg":"text-app-text"}`,children:[e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate",children:p.label}),p.description&&e.jsx("span",{className:`block truncate text-xs ${g===c?"opacity-80":"text-app-muted"}`,children:p.description})]}),p.shortcut&&e.jsx("kbd",{className:`shrink-0 border px-1.5 py-0.5 text-[10px] ${g===c?"border-app-bg/40":"border-app-border text-app-muted"}`,children:p.shortcut})]})]},p.key)})]})]})]}),document.body)},xe="xedonium-theme-override",Y={light:{outer:"#d8d8d8",bladeA:"#f5f5f5",bladeB:"#ffffff",hubOuter:"#252529",hubInner:"#ffffff",ring:"#5e5e5e",ringOpacity:"0.85"},dark:{outer:"#3a3a3a",bladeA:"#222222",bladeB:"#151515",hubOuter:"#efeff0",hubInner:"#151515",ring:"#b5b5b5",ringOpacity:"0.85"}},jt=450,ye=()=>typeof document>"u"?"light":document.documentElement.getAttribute("data-theme")==="dark"?"dark":"light",ue=({size:t=64,theme:s,label:r})=>{const[a,n]=x.useState(()=>s||ye()),l=x.useRef(null);x.useEffect(()=>{if(s){n(s);return}const c=document.documentElement,i=()=>n(ye()),u=new MutationObserver(i);return i(),u.observe(c,{attributes:!0,attributeFilter:["data-theme"]}),()=>u.disconnect()},[s]),x.useEffect(()=>{let c=0,i=null,u;const f=d=>{var h;const m=i===null?0:(d-i)/1e3;i=d,c=(c+jt*m)%360,(h=l.current)==null||h.setAttribute("transform",`rotate(${c} 32 32)`),u=requestAnimationFrame(f)};return u=requestAnimationFrame(f),()=>cancelAnimationFrame(u)},[]);const o=Y[a]||Y.light;return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg",focusable:"false",...r?{role:"img","aria-label":r}:{"aria-hidden":!0},children:[e.jsx("circle",{cx:"32",cy:"32",r:"30",fill:o.outer}),e.jsxs("g",{ref:l,children:[e.jsx("path",{d:"M32 32 C32 18, 42 14, 45 10 C49 5, 52 6, 50 12 C48 18, 38 20, 32 32 Z",fill:o.bladeA}),e.jsx("path",{d:"M32 32 C46 32, 50 42, 54 45 C59 49, 58 52, 52 50 C46 48, 44 38, 32 32 Z",fill:o.bladeB}),e.jsx("path",{d:"M32 32 C32 46, 22 50, 19 54 C15 59, 12 58, 14 52 C16 46, 26 44, 32 32 Z",fill:o.bladeA}),e.jsx("path",{d:"M32 32 C18 32, 14 22, 10 19 C5 15, 6 12, 12 14 C18 16, 20 26, 32 32 Z",fill:o.bladeB})]}),e.jsx("circle",{cx:"32",cy:"32",r:"5",fill:o.hubOuter}),e.jsx("circle",{cx:"32",cy:"32",r:"3",fill:o.hubInner}),e.jsx("circle",{cx:"32",cy:"32",r:"30",fill:"none",stroke:o.ring,strokeWidth:"5",opacity:"0.85"})]})},vt={default:{dot:"bg-app-soft",title:"text-app-soft"},danger:{dot:"bg-red-500",title:"text-red-700 dark:text-red-400"}},Re=({open:t,onClose:s,title:r,tone:a="default",busy:n=!1,dismissible:l=!0,role:o="dialog",describedBy:c,maxWidth:i="max-w-lg",className:u="",as:f="div",footer:d,children:m,...h})=>{const b=x.useRef(null),p=x.useId(),g=x.useRef(s);x.useEffect(()=>{g.current=s});const v=x.useCallback(()=>{!n&&l&&g.current()},[n,l]);if(Z(t,v),_(t,b),!t)return null;const{dot:M,title:y}=vt[a];return q.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[var(--xd-z-modal,80)] flex items-center justify-center px-4",children:[e.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:v}),e.jsxs(f,{ref:b,role:o,"aria-modal":"true","aria-labelledby":p,"aria-describedby":c,"aria-busy":n||void 0,tabIndex:-1,className:`relative z-10 flex max-h-[90vh] w-full min-w-0 flex-col border border-app-border bg-app-card shadow-2xl ${i} ${u}`,...h,children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-app-border px-6 pb-5 pt-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:`inline-block h-2 w-2 rounded-full ${M}`}),e.jsx("h2",{id:p,className:`text-sm font-semibold uppercase tracking-widest ${y}`,children:r})]}),e.jsx(A,{onClick:()=>!n&&g.current(),disabled:n,tooltip:"Close dialog","aria-label":"Close dialog",variant:"secondary",children:e.jsx(V,{})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:m}),d&&e.jsx("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-3 border-t border-app-border px-6 pb-6 pt-4",children:d})]})]}),document.body)},yt=({open:t,onClose:s,onConfirm:r,title:a,tone:n="default",busy:l=!1,confirmLabel:o="Confirm",busyLabel:c,cancelLabel:i="Cancel",error:u,children:f})=>e.jsx(Re,{open:t,onClose:s,busy:l,title:a,tone:n,role:n==="danger"?"alertdialog":"dialog",maxWidth:"max-w-md",footer:e.jsxs(e.Fragment,{children:[e.jsx(A,{onClick:s,disabled:l,variant:"secondary","data-autofocus":!0,children:i}),e.jsx(A,{onClick:r,disabled:l,variant:n==="danger"?"danger":"default",children:l?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(ue,{size:16})," ",c||o]}):o})]}),children:e.jsxs("div",{className:"flex flex-col gap-3 px-6 py-5 text-sm text-app-text",children:[f,u&&e.jsx("p",{role:"alert",className:"text-red-700 dark:text-red-400",children:u})]})}),wt=({maxWidth:t="max-w-5xl",className:s="",as:r="div",children:a,...n})=>e.jsx(r,{className:`mx-auto w-full px-4 sm:px-6 ${t} ${s}`,...n,children:a}),kt={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",12:"grid-cols-12"},Nt={1:"grid-cols-1",2:"grid-cols-1 sm:grid-cols-2",3:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-4",5:"grid-cols-1 sm:grid-cols-3 lg:grid-cols-5",6:"grid-cols-2 sm:grid-cols-3 lg:grid-cols-6",12:"grid-cols-4 sm:grid-cols-6 lg:grid-cols-12"},$t={0:"gap-0",1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",6:"gap-6",8:"gap-8"},ne=({cols:t=2,gap:s=4,responsive:r=!0,className:a="",as:n="div",children:l,...o})=>e.jsx(n,{className:`grid ${(r?Nt:kt)[t]} ${$t[s]} ${a}`,...o,children:l}),Pe=({title:t,subtitle:s,children:r})=>e.jsxs("div",{className:"mb-6 flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight text-app-text sm:text-3xl",children:t}),s&&e.jsx("p",{className:"mt-0.5 text-xs font-semibold uppercase tracking-widest text-app-muted",children:s})]}),r&&e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:r})]}),Mt={up:"text-emerald-700 dark:text-emerald-400",down:"text-red-700 dark:text-red-400",flat:"text-app-muted"},Be=({label:t,value:s,delta:r,trend:a="flat",hint:n,className:l=""})=>e.jsxs("div",{className:`flex flex-col gap-1 border border-app-border bg-app-card p-4 ${l}`,children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-widest text-app-muted",children:t}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"text-2xl font-bold tracking-tight text-app-text",children:s}),r&&e.jsxs("span",{className:`text-xs font-semibold ${Mt[a]}`,children:[e.jsx("span",{"aria-hidden":"true",children:a==="up"?"▲ ":a==="down"?"▼ ":""}),r]})]}),n&&e.jsx("span",{className:"text-xs text-app-muted",children:n})]}),Ct=({title:t,subtitle:s,actions:r,stats:a=[],columns:n=2,children:l})=>e.jsxs("div",{className:"flex flex-col gap-6",children:[t&&e.jsx(Pe,{title:t,subtitle:s,children:r}),a.length>0&&e.jsx(ne,{cols:Math.min(a.length,4),gap:4,children:a.map(o=>e.jsx(Be,{...o},o.label))}),l&&e.jsx(ne,{cols:n,gap:4,children:l})]}),G=(t=!1)=>`w-full bg-app-bg border px-3 py-2 text-sm text-app-text placeholder:text-app-muted outline-none transition focus:ring-2 focus:ring-app-strong focus:border-app-strong disabled:cursor-not-allowed disabled:opacity-50 ${t?"border-red-500":"border-app-border"}`,fe=x.forwardRef(({value:t,onChange:s,invalid:r=!1,type:a="text",className:n="",...l},o)=>e.jsx("input",{ref:o,type:a,"aria-invalid":r||void 0,className:`${G(r)} ${n}`,value:t,onChange:c=>s==null?void 0:s(c.target.value),...l}));fe.displayName="Input";const Et=(t,s,r)=>{const a=new Set([1,s]);for(let o=t-r;o<=t+r;o++)o>1&&o<s&&a.add(o);const n=[...a].sort((o,c)=>o-c),l=[];return n.forEach((o,c)=>{c>0&&o-n[c-1]>1&&l.push(null),l.push(o)}),l},te=(t=!1)=>`min-w-[2.25rem] border px-2 py-1.5 text-xs font-semibold tracking-widest transition disabled:cursor-not-allowed disabled:opacity-50 ${t?"border-app-strong bg-app-strong text-app-bg":"border-app-border bg-app-bg text-app-text hover:border-app-strong"}`,Oe=({page:t,pageCount:s,onChange:r,siblings:a=1,className:n=""})=>e.jsx("nav",{"aria-label":"Pagination",className:n,children:e.jsxs("ul",{className:"m-0 flex list-none flex-wrap items-center gap-1 p-0",children:[e.jsx("li",{children:e.jsx("button",{type:"button",className:te(),disabled:t<=1,onClick:()=>r(t-1),children:"Prev"})}),Et(t,s,a).map((l,o)=>l===null?e.jsx("li",{"aria-hidden":"true",className:"px-1 text-app-muted",children:"…"},`gap-${o}`):e.jsx("li",{children:e.jsx("button",{type:"button",className:te(l===t),"aria-current":l===t?"page":void 0,"aria-label":`Page ${l}`,onClick:()=>r(l),children:l})},l)),e.jsx("li",{children:e.jsx("button",{type:"button",className:te(),disabled:t>=s,onClick:()=>r(t+1),children:"Next"})})]})}),we={left:"text-left",center:"text-center",right:"text-right"},Lt=(t,s)=>t==null?s==null?0:1:s==null?-1:typeof t=="number"&&typeof s=="number"?t-s:String(t).localeCompare(String(s),void 0,{numeric:!0,sensitivity:"base"}),St=({columns:t,rows:s,rowKey:r="id",pageSize:a=10,searchable:n=!1,selectable:l=!1,selected:o,onSelectionChange:c,empty:i="No results",caption:u,className:f=""})=>{const[d,m]=x.useState(null),[h,b]=x.useState(""),[p,g]=x.useState(1),[v,M]=x.useState([]),y=o??v,C=(k,E)=>E.accessor?E.accessor(k):k[E.key],j=x.useMemo(()=>{const k=h.trim().toLowerCase();let E=k?s.filter(P=>t.some(T=>String(C(P,T)??"").toLowerCase().includes(k))):s;if(d){const P=t.find(T=>T.key===d.key);E=[...E].sort((T,J)=>Lt(C(T,P),C(J,P))*(d.dir==="asc"?1:-1))}return E},[s,t,h,d]),$=Math.max(1,Math.ceil(j.length/a)),N=Math.min(p,$),w=j.slice((N-1)*a,N*a),L=k=>{o===void 0&&M(k),c==null||c(k)},S=w.map(k=>k[r]),I=S.length>0&&S.every(k=>y.includes(k)),R=S.some(k=>y.includes(k)),F=k=>{g(1),m(E=>(E==null?void 0:E.key)!==k.key?{key:k.key,dir:"asc"}:E.dir==="asc"?{key:k.key,dir:"desc"}:null)};return e.jsxs("div",{className:`flex flex-col gap-3 ${f}`,children:[n&&e.jsx("div",{className:"max-w-xs",children:e.jsx(fe,{value:h,onChange:k=>{b(k),g(1)},placeholder:"Search…","aria-label":"Search rows",type:"search"})}),e.jsx("div",{className:"overflow-x-auto border border-app-border",children:e.jsxs("table",{className:"w-full border-collapse bg-app-card text-sm text-app-text",children:[u&&e.jsx("caption",{className:"sr-only",children:u}),e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-app-border bg-app-bg",children:[l&&e.jsx("th",{scope:"col",className:"w-10 px-4 py-2.5",children:e.jsx(ae,{"aria-label":"Select all rows on this page",checked:I,indeterminate:!I&&R,onChange:k=>L(k?[...new Set([...y,...S])]:y.filter(E=>!S.includes(E)))})}),t.map(k=>{const E=(d==null?void 0:d.key)===k.key;return e.jsx("th",{scope:"col","aria-sort":E?d.dir==="asc"?"ascending":"descending":k.sortable?"none":void 0,className:`px-4 py-2.5 text-xs font-semibold uppercase tracking-widest text-app-muted ${we[k.align??"left"]}`,children:k.sortable?e.jsxs("button",{type:"button",onClick:()=>F(k),className:"inline-flex items-center gap-1 uppercase tracking-widest transition hover:text-app-text",children:[k.header,e.jsx("span",{"aria-hidden":"true",children:E?d.dir==="asc"?"↑":"↓":"↕"})]}):k.header},k.key)})]})}),e.jsx("tbody",{children:w.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length+(l?1:0),className:"px-4 py-6 text-center text-app-muted",children:i})}):w.map(k=>{const E=k[r],P=y.includes(E);return e.jsxs("tr",{"aria-selected":l?P:void 0,className:`border-b border-app-border last:border-b-0 hover:bg-app-bg ${P?"bg-app-soft/10":""}`,children:[l&&e.jsx("td",{className:"px-4 py-2.5",children:e.jsx(ae,{"aria-label":`Select row ${E}`,checked:P,onChange:T=>L(T?[...y,E]:y.filter(J=>J!==E))})}),t.map(T=>e.jsx("td",{className:`px-4 py-2.5 ${we[T.align??"left"]}`,children:T.render?T.render(k):k[T.key]},T.key))]},E)})})]})}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 text-xs text-app-muted",children:[e.jsxs("span",{"aria-live":"polite",children:[j.length," ",j.length===1?"row":"rows",l&&y.length>0?`, ${y.length} selected`:""]}),$>1&&e.jsx(Oe,{page:N,pageCount:$,onChange:g})]})]})},X=(t,s,r)=>{const a=x.useRef(r);x.useEffect(()=>{a.current=r}),x.useEffect(()=>{if(!t)return;const n=o=>{var c;(c=s.current)!=null&&c.contains(o.target)||a.current("outside")},l=o=>{o.key==="Escape"&&a.current("escape")};return document.addEventListener("mousedown",n),document.addEventListener("keydown",l),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("keydown",l)}},[t,s])},It=({label:t,value:s,onChange:r,min:a,max:n,placeholder:l="Select date",error:o,locale:c,weekStartsOn:i})=>{const[u,f]=x.useState(!1),d=x.useRef(null),m=x.useId(),h=`${m}-error`;return X(u,d,b=>{var p,g;f(!1),b==="escape"&&((g=(p=d.current)==null?void 0:p.querySelector("button"))==null||g.focus())}),e.jsxs("div",{ref:d,className:"relative flex flex-col gap-1",children:[t&&e.jsx("label",{htmlFor:m,className:"text-xs font-semibold uppercase tracking-widest text-app-muted",children:t}),e.jsx("button",{id:m,type:"button","aria-haspopup":"dialog","aria-expanded":u,"aria-invalid":!!o,"aria-describedby":o?h:void 0,onClick:()=>f(b=>!b),className:`${G(!!o)} text-left ${s?"":"text-app-muted"}`,children:s?re(s,c):l}),u&&e.jsx("div",{role:"dialog","aria-label":"Choose date",className:"absolute left-0 top-full z-[var(--xd-z-tooltip,70)] mt-1 shadow-xl",children:e.jsx(pe,{value:s,min:a,max:n,locale:c,weekStartsOn:i,onChange:b=>{var p,g;r==null||r(b),f(!1),(g=(p=d.current)==null?void 0:p.querySelector("button"))==null||g.focus()}})}),o&&e.jsx("span",{id:h,className:"text-xs text-red-700 dark:text-red-400",children:o})]})},Tt=({label:t,value:s,onChange:r,min:a,max:n,placeholder:l="Select range",error:o,locale:c,weekStartsOn:i})=>{const[u,f]=x.useState(!1),[d,m]=x.useState(null),h=x.useRef(null),b=x.useId(),p=`${b}-error`,g=()=>{f(!1),m(null)};X(u,h,y=>{var C,j;g(),y==="escape"&&((j=(C=h.current)==null?void 0:C.querySelector("button"))==null||j.focus())});const v=y=>{var $,N;if(!d){m(y),r==null||r({start:y,end:null});return}const[C,j]=K(y,d)?[y,d]:[d,y];r==null||r({start:C,end:j}),g(),(N=($=h.current)==null?void 0:$.querySelector("button"))==null||N.focus()},M=s!=null&&s.start?`${re(s.start,c)} – ${s.end?re(s.end,c):"…"}`:"";return e.jsxs("div",{ref:h,className:"relative flex flex-col gap-1",children:[t&&e.jsx("label",{htmlFor:b,className:"text-xs font-semibold uppercase tracking-widest text-app-muted",children:t}),e.jsx("button",{id:b,type:"button","aria-haspopup":"dialog","aria-expanded":u,"aria-invalid":!!o,"aria-describedby":o?p:void 0,onClick:()=>u?g():f(!0),className:`${G(!!o)} text-left ${M?"":"text-app-muted"}`,children:M||l}),u&&e.jsx("div",{role:"dialog","aria-label":"Choose date range",className:"absolute left-0 top-full z-[var(--xd-z-tooltip,70)] mt-1 shadow-xl",children:e.jsx(pe,{rangeStart:d??(s==null?void 0:s.start),rangeEnd:d?null:s==null?void 0:s.end,min:a,max:n,locale:c,weekStartsOn:i,onChange:v})}),o&&e.jsx("span",{id:p,className:"text-xs text-red-700 dark:text-red-400",children:o})]})},Dt=({orientation:t="horizontal",label:s,className:r=""})=>t==="vertical"?e.jsx("div",{role:"separator","aria-orientation":"vertical",className:`w-px self-stretch bg-app-border ${r}`}):s?e.jsxs("div",{role:"separator",className:`flex items-center gap-3 ${r}`,children:[e.jsx("span",{className:"h-px flex-1 bg-app-border"}),e.jsx("span",{className:"text-xs font-semibold uppercase tracking-widest text-app-muted",children:s}),e.jsx("span",{className:"h-px flex-1 bg-app-border"})]}):e.jsx("hr",{className:`border-0 border-t border-app-border ${r}`}),At=({label:t,value:s,onChange:r,placeholder:a,error:n,type:l="text",autoComplete:o="off",required:c=!0,...i})=>{const u=x.useId(),f=`${u}-error`;return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("label",{htmlFor:u,className:"text-xs font-semibold uppercase tracking-widest text-app-muted",children:t}),e.jsx("input",{id:u,type:l,autoComplete:o,"aria-required":c,"aria-invalid":!!n,"aria-describedby":n?f:void 0,className:`bg-app-bg border px-3 py-2 text-sm text-app-text placeholder:text-app-muted outline-none transition focus:ring-2 focus:ring-app-strong focus:border-app-strong ${n?"border-red-500":"border-app-border"}`,placeholder:a,value:s,onChange:d=>r(d.target.value),...i}),n&&e.jsx("span",{id:f,className:"text-xs text-red-700 dark:text-red-400",children:n})]})},Ft=({label:t="Choose files or drop them here",accept:s,multiple:r=!1,onChange:a,disabled:n=!1})=>{const l=x.useId(),[o,c]=x.useState([]),[i,u]=x.useState(!1),f=d=>{const m=[...d];c(m),a==null||a(m)};return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("label",{htmlFor:l,onDragOver:d=>{d.preventDefault(),n||u(!0)},onDragLeave:()=>u(!1),onDrop:d=>{d.preventDefault(),u(!1),n||f(r?d.dataTransfer.files:[d.dataTransfer.files[0]].filter(Boolean))},className:`flex flex-col items-center justify-center gap-1 border border-dashed px-4 py-8 text-center text-sm text-app-muted transition focus-within:ring-2 focus-within:ring-app-strong ${i?"border-app-strong bg-app-soft/10":"border-app-border bg-app-bg"} ${n?"cursor-not-allowed opacity-50":"cursor-pointer hover:border-app-strong"}`,children:[t,e.jsx("input",{id:l,type:"file",accept:s,multiple:r,disabled:n,className:"sr-only",onChange:d=>f(d.target.files)})]}),o.length>0&&e.jsx("ul",{className:"m-0 list-none p-0 text-xs text-app-soft",children:o.map(d=>e.jsx("li",{children:d.name},`${d.name}-${d.size}`))})]})},Rt={0:"gap-0",1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",6:"gap-6",8:"gap-8"},Pt={row:"flex-row",column:"flex-col"},Bt={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch",baseline:"items-baseline"},Ot={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around"},ze=({direction:t="row",gap:s=3,align:r,justify:a,wrap:n=!1,inline:l=!1,className:o="",as:c="div",children:i,...u})=>e.jsx(c,{className:`${l?"inline-flex":"flex"} ${Pt[t]} ${Rt[s]} ${r?Bt[r]:""} ${a?Ot[a]:""} ${n?"flex-wrap":""} ${o}`,...u,children:i}),zt=({active:t=!0,className:s="",children:r,...a})=>{const n=x.useRef(null);return _(t,n),e.jsx("div",{ref:n,tabIndex:-1,className:s,...a,children:r})},Wt={square:"aspect-square",video:"aspect-video",photo:"aspect-[4/3]"},Kt=({src:t,alt:s,ratio:r,fit:a="cover",fallback:n="Image unavailable",className:l="",...o})=>{const[c,i]=x.useState(!1),u=`${r?Wt[r]:""} ${l}`;return c?e.jsx("div",{role:"img","aria-label":s,className:`flex items-center justify-center border border-app-border bg-app-bg p-4 text-xs text-app-muted ${u}`,children:n}):e.jsx("img",{src:t,alt:s,loading:"lazy",onError:()=>i(!0),className:`block w-full ${a==="contain"?"object-contain":"object-cover"} ${u}`,...o})},qt=({items:t,divided:s=!0,className:r=""})=>e.jsx("ul",{className:`m-0 list-none border border-app-border bg-app-card p-0 ${r}`,children:t.map(a=>{const n=e.jsxs(e.Fragment,{children:[a.leading&&e.jsx("span",{className:"shrink-0",children:a.leading}),e.jsxs("span",{className:"min-w-0 flex-1 text-left",children:[e.jsx("span",{className:"block truncate text-sm text-app-text",children:a.primary}),a.secondary&&e.jsx("span",{className:"block truncate text-xs text-app-muted",children:a.secondary})]}),a.trailing&&e.jsx("span",{className:"shrink-0 text-xs text-app-muted",children:a.trailing})]});return e.jsx("li",{className:s?"border-b border-app-border last:border-b-0":"",children:a.onClick?e.jsx("button",{type:"button",onClick:a.onClick,className:"flex w-full items-center gap-3 px-4 py-3 transition hover:bg-app-bg",children:n}):e.jsx("div",{className:"flex items-center gap-3 px-4 py-3",children:n})},a.key)})}),We=({children:t,maxWidth:s="max-w-5xl",centerContent:r=!1,themeToggle:a=!1,outerClassName:n="",innerClassName:l=""})=>{const o=r?"flex flex-1 items-center justify-center":"";return e.jsxs("main",{className:`relative flex flex-1 flex-col bg-app-bg px-4 py-8 sm:py-10 ${n}`,children:[a&&e.jsx("div",{className:"absolute right-4 top-4",children:e.jsx(ce,{})}),e.jsx("div",{className:`mx-auto w-full ${s} ${o} ${l}`,children:t})]})},_t=()=>e.jsx(We,{maxWidth:"max-w-sm",centerContent:!0,children:e.jsx(ue,{label:"Loading"})}),Gt=({brand:t,links:s=[],actions:r,linkComponent:a="a",linkProp:n="href",label:l="Main",className:o=""})=>e.jsxs("nav",{"aria-label":l,className:`flex flex-wrap items-center gap-x-6 gap-y-2 border-b border-app-border bg-app-card px-4 py-3 ${o}`,children:[t&&e.jsx("div",{className:"text-sm font-bold tracking-tight text-app-text",children:t}),e.jsx("ul",{className:"m-0 flex flex-1 list-none flex-wrap items-center gap-1 p-0",children:s.map(({href:c,label:i,active:u,...f})=>e.jsx("li",{children:e.jsx(a,{[n]:c,"aria-current":u?"page":void 0,className:`px-2.5 py-1.5 text-xs font-semibold uppercase tracking-widest transition ${u?"bg-app-strong text-app-bg":"text-app-muted hover:text-app-text"}`,...f,children:i})},i))}),r&&e.jsx("div",{className:"flex items-center gap-2",children:r})]}),ke=8,me=(t,s,r)=>{const[a,n]=x.useState(!1);return x.useLayoutEffect(()=>{if(!t){n(!1);return}const l=s.current;if(!l)return;const o=l.getBoundingClientRect(),c=document.documentElement.clientWidth,i=r==="end"?o.left<ke:o.right>c-ke;n(i)},[t,s,r]),a?r==="end"?"start":"end":r},Ut=()=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 17h5l-1.4-1.4A2 2 0 0118 14.2V11a6 6 0 10-12 0v3.2a2 2 0 01-.6 1.4L4 17h5m6 0a3 3 0 11-6 0"})}),Ht=({notifications:t,onSelect:s,onMarkRead:r,onMarkAllRead:a,onClear:n,empty:l="You are all caught up",align:o="end"})=>{const[c,i]=x.useState(!1),u=x.useRef(null),f=x.useRef(null),d=me(c,f,o),m=x.useId(),h=t.filter(b=>!b.read).length;return X(c,u,b=>{var p,g;i(!1),b==="escape"&&((g=(p=u.current)==null?void 0:p.querySelector("button"))==null||g.focus())}),e.jsxs("div",{ref:u,className:"relative inline-block",children:[e.jsx(A,{variant:"secondary","aria-label":h?`Notifications, ${h} unread`:"Notifications","aria-haspopup":"dialog","aria-expanded":c,"aria-controls":c?m:void 0,onClick:()=>i(b=>!b),children:e.jsxs("span",{className:"relative inline-flex",children:[e.jsx(Ut,{}),h>0&&e.jsx("span",{"aria-hidden":"true",className:"absolute -right-2 -top-2 min-w-[1rem] bg-red-500 px-1 text-center text-[10px] font-bold leading-4 text-white",children:h>9?"9+":h})]})}),c&&e.jsxs("div",{ref:f,id:m,role:"dialog","aria-label":"Notifications",className:`absolute top-full z-[var(--xd-z-tooltip,70)] mt-1 flex max-h-96 w-80 max-w-[calc(100vw-2rem)] flex-col border border-app-border bg-app-card shadow-xl ${d==="end"?"right-0":"left-0"}`,children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-app-border px-4 py-2.5",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-widest text-app-text",children:"Notifications"}),e.jsxs("span",{className:"flex gap-3 text-xs",children:[a&&h>0&&e.jsx("button",{type:"button",onClick:a,className:"text-app-muted underline underline-offset-2 hover:text-app-text",children:"Mark all read"}),n&&t.length>0&&e.jsx("button",{type:"button",onClick:n,className:"text-app-muted underline underline-offset-2 hover:text-app-text",children:"Clear"})]})]}),t.length===0?e.jsx("p",{className:"m-0 px-4 py-8 text-center text-sm text-app-muted",children:l}):e.jsx("ul",{className:"m-0 flex-1 list-none overflow-y-auto p-0",children:t.map(b=>e.jsx("li",{className:"border-b border-app-border last:border-b-0",children:e.jsxs("button",{type:"button",onClick:()=>{b.read||r==null||r(b.id),s==null||s(b)},className:"flex w-full items-start gap-3 px-4 py-3 text-left transition hover:bg-app-bg",children:[e.jsx("span",{"aria-hidden":"true",className:`mt-1.5 h-2 w-2 shrink-0 ${b.read?"bg-transparent":"bg-red-500"}`}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:`block text-sm text-app-text ${b.read?"":"font-semibold"}`,children:b.title}),b.body&&e.jsx("span",{className:"block text-xs text-app-muted",children:b.body}),b.time&&e.jsx("span",{className:"mt-0.5 block text-[10px] uppercase tracking-widest text-app-muted",children:b.time})]}),!b.read&&e.jsx("span",{className:"sr-only",children:"Unread"})]})},b.id))})]})]})},O=240,z=100,H=(t,s)=>[O/2+s*Math.sin(t),O/2-s*Math.cos(t)],le=(t,s,r)=>{if(s-t>=Math.PI*2-1e-6){const m=t+Math.PI;return`${le(t,m,r)} ${le(m,t+Math.PI*2-1e-4,r)}`}const a=s-t>Math.PI?1:0,[n,l]=H(t,z),[o,c]=H(s,z);if(!r)return`M${O/2},${O/2} L${n},${l} A${z},${z} 0 ${a} 1 ${o},${c} Z`;const[i,u]=H(s,r),[f,d]=H(t,r);return`M${n},${l} A${z},${z} 0 ${a} 1 ${o},${c} L${i},${u} A${r},${r} 0 ${a} 0 ${f},${d} Z`},Yt=({data:t,donut:s=!1,center:r,label:a="Pie chart",className:n=""})=>{const l=t.reduce((i,u)=>i+u.value,0);let o=0;const c=t.filter(i=>i.value>0).map((i,u)=>{const f=o;return o+=i.value/l*Math.PI*2,{...i,start:f,end:o,color:Q(i,u)}});return e.jsxs("figure",{className:`m-0 ${n}`,children:[e.jsxs("svg",{role:"img","aria-label":a,viewBox:`0 0 ${O} ${O}`,className:"mx-auto block h-auto w-full max-w-xs",children:[c.map(i=>e.jsx("path",{d:le(i.start,i.end,s?z*.6:0),fill:i.color,stroke:"rgb(var(--color-app-card))",strokeWidth:"2",children:e.jsx("title",{children:`${i.label}: ${i.value} (${Math.round(i.value/l*100)}%)`})},i.label)),s&&r&&e.jsx("text",{x:O/2,y:O/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:"20",fontWeight:"600",fill:"rgb(var(--color-app-text))",children:r})]}),e.jsx(de,{items:c.map(i=>({name:i.label,color:i.color}))})]})},Vt=({trigger:t,label:s,variant:r="secondary",align:a="start",className:n="",children:l})=>{const[o,c]=x.useState(!1),i=x.useRef(null),u=x.useRef(null),f=me(o,u,a),d=x.useId();return x.useEffect(()=>{if(!o)return;const m=b=>{var p;(p=i.current)!=null&&p.contains(b.target)||c(!1)},h=b=>{var p,g;b.key==="Escape"&&(c(!1),(g=(p=i.current)==null?void 0:p.querySelector("button"))==null||g.focus())};return document.addEventListener("mousedown",m),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",m),document.removeEventListener("keydown",h)}},[o]),e.jsxs("div",{ref:i,className:"relative inline-block",children:[e.jsx(A,{variant:r,"aria-label":s,"aria-haspopup":"dialog","aria-expanded":o,"aria-controls":o?d:void 0,onClick:()=>c(m=>!m),children:t}),o&&e.jsx("div",{ref:u,id:d,role:"dialog","aria-label":s,className:`absolute top-full z-[var(--xd-z-tooltip,70)] mt-1 min-w-[12rem] border border-app-border bg-app-card p-4 text-sm text-app-text shadow-xl ${f==="end"?"right-0":"left-0"} ${n}`,children:l})]})},Zt=({children:t,container:s})=>q.createPortal(t,s??document.body),Qt=({value:t,label:s,showValue:r=!1,className:a=""})=>{const n=t===void 0,l=n?0:Math.min(100,Math.max(0,t));return e.jsxs("div",{className:`flex flex-col gap-1 ${a}`,children:[(s||r&&!n)&&e.jsxs("div",{className:"flex items-center justify-between text-xs font-semibold uppercase tracking-widest text-app-muted",children:[e.jsx("span",{children:s}),r&&!n&&e.jsxs("span",{className:"text-app-text",children:[Math.round(l),"%"]})]}),e.jsx("div",{role:"progressbar","aria-label":s,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":n?void 0:Math.round(l),className:"relative h-1.5 w-full overflow-hidden bg-app-border",children:n?e.jsx("div",{className:"absolute inset-y-0 w-2/5 animate-indeterminate bg-app-strong"}):e.jsx("div",{className:"h-full bg-app-strong transition-all",style:{width:`${l}%`}})})]})},Xt=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),f=require("react"),X=require("react-dom"),G=(t,r,s)=>{const a=f.useRef(s);f.useEffect(()=>{a.current=s}),f.useEffect(()=>{if(!t)return;const l=Array.isArray(r)?r:[r],n=i=>{l.some(c=>{var u;return(u=c.current)==null?void 0:u.contains(i.target)})||a.current("outside")},o=i=>{i.key==="Escape"&&a.current("escape")};return document.addEventListener("mousedown",n),document.addEventListener("keydown",o),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("keydown",o)}},[t])},O=8,nt={top:"bottom",bottom:"top",left:"right",right:"left"},lt=(t="bottom")=>{const[r,s="center"]=t.split("-");return{side:r,align:s}},Me=(t,r,s,a,l)=>{if(t==="top"||t==="bottom"){const i=t==="bottom"?s.bottom+l:s.top-l-a.height,c=r==="start"?s.left:r==="end"?s.right-a.width:s.left+s.width/2-a.width/2;return{top:i,left:c}}const n=t==="right"?s.right+l:s.left-l-a.width;return{top:r==="start"?s.top:r==="end"?s.bottom-a.height:s.top+s.height/2-a.height/2,left:n}},V=(t,r,s,a,l)=>t==="bottom"?Math.max(0,r.bottom+a+s.height-(l.height-O)):t==="top"?Math.max(0,O-(r.top-a-s.height)):t==="right"?Math.max(0,r.right+a+s.width-(l.width-O)):Math.max(0,O-(r.left-a-s.width)),Fe=(t,r,{placement:s="bottom",gap:a=6,viewport:l}={})=>{const n=l??{width:document.documentElement.clientWidth,height:window.innerHeight},{side:o,align:i}=lt(s);let c=o;if(o==="auto"){const j=["bottom","top","right","left"];c=j.find(k=>V(k,t,r,a,n)===0),c||(c=j.reduce((k,$)=>V($,t,r,a,n)<V(k,t,r,a,n)?$:k))}else if(V(o,t,r,a,n)>0){const j=nt[o];V(j,t,r,a,n)<V(o,t,r,a,n)&&(c=j)}const u=c==="top"||c==="bottom",m=j=>u?[j.left,j.left+r.width]:[j.top,j.top+r.height],d=u?n.width:n.height,p=j=>{const[k,$]=m(j);return Math.max(0,O-k)+Math.max(0,$-(d-O))};let h=i,g=Me(c,i,t,r,a);if((i==="start"||i==="end")&&p(g)>0){const j=i==="start"?"end":"start",k=Me(c,j,t,r,a);p(k)<p(g)&&(g=k,h=j)}const x=Math.min(Math.max(O,g.top),Math.max(O,n.height-O-r.height)),b=Math.min(Math.max(O,g.left),Math.max(O,n.width-O-r.width));return{top:x,left:b,side:c,align:h}},ot=t=>{const r=t.getBoundingClientRect(),s=r.width*r.height;if(s===0)return!1;let a={top:Math.max(r.top,0),left:Math.max(r.left,0),bottom:Math.min(r.bottom,window.innerHeight),right:Math.min(r.right,document.documentElement.clientWidth)};for(let o=t.parentElement;o&&o!==document.body;o=o.parentElement){const{overflowX:i,overflowY:c}=getComputedStyle(o);if(i==="visible"&&c==="visible")continue;const u=o.getBoundingClientRect();a={top:Math.max(a.top,u.top),left:Math.max(a.left,u.left),bottom:Math.min(a.bottom,u.bottom),right:Math.min(a.right,u.right)}}const l=Math.max(0,a.right-a.left),n=Math.max(0,a.bottom-a.top);return l*n/s<.5},it=6,ge=({text:t,children:r,placement:s="bottom",className:a=""})=>{const l=f.useId(),n=f.useRef(null),o=f.useRef(null),[i,c]=f.useState(!1),[u,m]=f.useState(null),d=()=>c(!0),p=()=>{c(!1),m(null)};if(f.useLayoutEffect(()=>{if(!i||!n.current||!o.current)return;const g=n.current.getBoundingClientRect(),x=o.current.getBoundingClientRect(),{top:b,left:j}=Fe(g,x,{placement:s,gap:it});m({top:b,left:j})},[i,t,s]),f.useEffect(()=>{if(!i)return;const g=x=>x.key==="Escape"&&p();return window.addEventListener("keydown",g),window.addEventListener("scroll",p,!0),window.addEventListener("resize",p),()=>{window.removeEventListener("keydown",g),window.removeEventListener("scroll",p,!0),window.removeEventListener("resize",p)}},[i]),!t)return r;const h=r.props["aria-label"]!==t;return e.jsxs("span",{ref:n,className:`inline-flex [&>:disabled]:pointer-events-none has-[>:disabled]:cursor-not-allowed ${a}`,onMouseEnter:d,onMouseLeave:p,onFocus:g=>g.target.matches(":focus-visible")&&d(),onBlur:p,onPointerDown:p,children:[h?f.cloneElement(r,{"aria-describedby":l}):r,h&&e.jsx("span",{id:l,hidden:!0,children:t}),i&&X.createPortal(e.jsx("div",{ref:o,"aria-hidden":"true",style:{top:(u==null?void 0:u.top)??0,left:(u==null?void 0:u.left)??0,visibility:u?"visible":"hidden"},className:"pointer-events-none fixed z-[var(--xd-z-tooltip,100)] w-max max-w-[16rem] border border-app-border bg-app-card px-2.5 py-1.5 text-xs normal-case tracking-normal text-app-text shadow-xl",children:t}),document.body)]})},q=t=>{const{onClick:r,tooltip:s,tooltipPlacement:a,variant:l="default",className:n="",children:o,type:i="button",disabled:c=!1,...u}=t,m={default:"bg-app-strong text-app-bg border border-app-strong hover:bg-app-text",secondary:"bg-app-bg text-app-text border border-app-border hover:border-app-strong hover:text-app-text",danger:"bg-red-500/10 text-red-700 dark:text-red-400 border border-red-500/30 hover:bg-red-500/20",success:"bg-emerald-600 text-white border border-emerald-600 hover:bg-emerald-500 hover:border-emerald-500 dark:bg-emerald-500 dark:text-black dark:border-emerald-500 dark:hover:bg-emerald-400 dark:hover:border-emerald-400",warning:"bg-amber-400 text-black border border-amber-400 hover:bg-amber-300 hover:border-amber-300"},d=e.jsx("button",{type:i,onClick:r,disabled:c,className:`text-xs font-semibold uppercase tracking-widest ${m[l]} px-3 py-2 transition disabled:cursor-not-allowed disabled:opacity-50 ${n}`,...u,children:o});return s?e.jsx(ge,{text:s,placement:a,children:d}):d},Y=({open:t,anchorRef:r,placement:s="bottom-start",gap:a=4,matchWidth:l=!1,panelRef:n,className:o="",style:i,children:c,...u})=>{const m=f.useRef(null),d=n??m,[p,h]=f.useState(null);return f.useLayoutEffect(()=>{if(!t){h(null);return}const g=()=>{var $;const b=($=r.current)==null?void 0:$.getBoundingClientRect(),j=d.current;if(!b||!j)return;const k={...Fe(b,{width:j.offsetWidth,height:j.offsetHeight},{placement:s,gap:a}),width:l?b.width:void 0,hidden:ot(r.current)};h(y=>y&&y.top===k.top&&y.left===k.left&&y.width===k.width&&y.hidden===k.hidden?y:k)};g(),window.addEventListener("scroll",g,!0),window.addEventListener("resize",g);const x=typeof ResizeObserver>"u"?null:new ResizeObserver(g);return x&&d.current&&x.observe(d.current),()=>{window.removeEventListener("scroll",g,!0),window.removeEventListener("resize",g),x==null||x.disconnect()}},[t,r,d,s,a,l]),t?X.createPortal(e.jsx("div",{ref:d,...u,style:{position:"fixed",top:(p==null?void 0:p.top)??0,left:(p==null?void 0:p.left)??0,minWidth:p==null?void 0:p.width,opacity:p&&!p.hidden?1:0,pointerEvents:p&&!p.hidden?void 0:"none",...i},className:`z-[var(--xd-z-popover,85)] ${o}`,children:c}),document.body):null},ct={default:"text-app-text hover:bg-app-bg",warning:"text-amber-700 hover:bg-amber-400/10 dark:text-amber-400"},dt=({label:t,trigger:r,variant:s="secondary",items:a,placement:l="bottom-start",className:n=""})=>{const[o,i]=f.useState(!1),c=f.useRef(null),u=f.useRef(null),m=f.useId();G(o,[c,u],p=>{var h,g;i(!1),p==="escape"&&((g=(h=c.current)==null?void 0:h.querySelector("button"))==null||g.focus())});const d=p=>{i(!1),p.onClick()};return e.jsxs("div",{ref:c,className:`relative inline-block ${n}`,children:[e.jsx(q,{onClick:()=>i(p=>!p),variant:s,"aria-label":t,"aria-haspopup":"menu","aria-expanded":o,"aria-controls":o?m:void 0,children:r}),e.jsx(Y,{open:o,anchorRef:c,panelRef:u,placement:l,id:m,role:"menu","aria-label":t,className:"w-60 max-w-[calc(100vw-1rem)] overflow-hidden border border-app-border bg-app-card shadow-lg",children:a.map(p=>e.jsxs("button",{type:"button",role:"menuitem",disabled:p.disabled,"aria-haspopup":p.hasDialog?"dialog":void 0,onClick:()=>d(p),className:`flex w-full items-center gap-2 border-b border-app-border bg-app-card px-3 py-2.5 text-left transition last:border-b-0 disabled:cursor-not-allowed disabled:opacity-50 ${ct[p.tone||"default"]}`,children:[e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block text-xs font-medium uppercase tracking-widest",children:p.label}),p.description&&e.jsx("span",{className:"mt-0.5 block text-xs normal-case tracking-normal text-app-muted",children:p.description})]}),p.badge!=null&&e.jsx("span",{className:"font-mono text-xs",children:p.badge})]},p.key))})]})},ne=({className:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:t??"h-5 w-5 text-app-soft",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),Be=({className:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:t??"w-4 h-4 text-red-600 dark:text-red-400 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 11-18 0 9 9 0 0118 0zm-9 3.75h.008v.008H12v-.008z"})}),pt={info:"border-app-border bg-app-card text-app-text",success:"border-emerald-500/40 bg-emerald-500/10 text-emerald-800 dark:text-emerald-300",warning:"border-amber-500/50 bg-amber-400/15 text-amber-900 dark:text-amber-200",danger:"border-red-500/40 bg-red-500/10 text-red-800 dark:text-red-300"},ut=({tone:t="info",title:r,onClose:s,icon:a,className:l="",children:n})=>e.jsxs("div",{role:t==="danger"||t==="warning"?"alert":"status",className:`flex items-start gap-3 border px-4 py-3 text-sm ${pt[t]} ${l}`,children:[e.jsx("span",{className:"mt-0.5 shrink-0",children:a??e.jsx(Be,{className:"h-4 w-4"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[r&&e.jsx("div",{className:"font-semibold",children:r}),n&&e.jsx("div",{className:r?"mt-0.5 opacity-90":"",children:n})]}),s&&e.jsx("button",{type:"button",onClick:s,"aria-label":"Dismiss",className:"-m-2 shrink-0 p-2 opacity-70 transition hover:opacity-100",children:e.jsx(ne,{className:"h-4 w-4"})})]}),je=f.createContext({activeTheme:"dark",toggleTheme:()=>{}}),Oe=()=>f.useContext(je),We=t=>`flex h-9 w-9 items-center justify-center border transition hover:bg-app-card/80 ${t?"border-app-strong bg-app-card/80":"border-transparent hover:border-app-border"}`,xt=()=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:"h-4 w-4 text-app-soft",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12.79A9 9 0 1111.21 3a7 7 0 009.79 9.79z"})}),ft=()=>e.jsxs("svg",{"aria-hidden":"true",focusable:"false",className:"h-4 w-4 text-yellow-600",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[e.jsx("circle",{cx:"12",cy:"12",r:"4"}),e.jsx("path",{strokeLinecap:"round",d:"M12 2v2M12 20v2M2 12h2M20 12h2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41"})]}),ve=({variant:t="button"})=>{const{activeTheme:r,toggleTheme:s}=Oe(),a=r==="dark",l=`Switch to ${a?"light":"dark"} theme`,n=a?e.jsx(xt,{}):e.jsx(ft,{});return t==="toolbar"?e.jsx(ge,{text:l,children:e.jsx("button",{type:"button",onClick:s,"aria-label":l,className:We(!1),children:n})}):e.jsx(q,{onClick:s,tooltip:l,"aria-label":l,variant:"secondary",children:n})},ht=t=>`flex min-h-9 items-center px-2.5 py-1.5 text-xs font-semibold uppercase tracking-widest transition sm:px-3 ${t?"bg-app-card text-app-text":"text-app-muted hover:text-app-text"}`,mt=({brand:t,logo:r,brandHref:s="/",links:a=[],actions:l,themeToggle:n=!0,hideBrandOnMobile:o=!1,linkComponent:i="a",linkProp:c="href",maxWidth:u="max-w-5xl"})=>e.jsx("header",{className:"sticky top-0 z-40 border-b border-app-border bg-app-bg/95 backdrop-blur",children:e.jsxs("div",{className:`mx-auto flex h-14 w-full ${u} items-center justify-between gap-3 px-4`,children:[e.jsxs(i,{[c]:s,className:"flex min-h-9 shrink-0 items-center gap-2 text-app-text",children:[r,e.jsx("span",{className:`text-base font-bold tracking-tight ${o?"hidden sm:inline":""}`,children:t})]}),a.length>0&&e.jsx("nav",{"aria-label":"Main",className:"flex min-w-0 items-center gap-1 overflow-x-auto",children:a.map(({href:m,label:d,active:p=!1,...h})=>e.jsx(i,{[c]:m,"aria-current":p?"page":void 0,className:ht(p),...h,children:d},m))}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[n&&e.jsx(ve,{variant:"toolbar"}),l]})]})}),bt='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',te=(t,r)=>{f.useEffect(()=>{const s=r.current;if(!t||!s)return;const a=document.activeElement,l=()=>[...s.querySelectorAll(bt)];(s.querySelector("[data-autofocus]")||l()[0]||s).focus();const n=o=>{if(o.key!=="Tab")return;const i=l();if(!i.length){o.preventDefault();return}const c=i[0],u=i[i.length-1];o.shiftKey&&document.activeElement===c?(o.preventDefault(),u.focus()):!o.shiftKey&&document.activeElement===u&&(o.preventDefault(),c.focus())};return s.addEventListener("keydown",n),()=>{s.removeEventListener("keydown",n),a!=null&&a.isConnected&&a.focus()}},[t,r])},le=(t,r)=>{f.useEffect(()=>{if(!t)return;const s=a=>{a.key==="Escape"&&r()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[t,r])},gt={right:"right-0 border-l",left:"left-0 border-r"},ze=({open:t,onClose:r,title:s,side:a="right",width:l="max-w-md",padded:n=!0,footer:o,children:i})=>{const c=f.useRef(null),u=f.useId();return le(t,r),te(t,c),f.useEffect(()=>{if(!t)return;const m=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=m}},[t]),t?X.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[var(--xd-z-modal,80)]",children:[e.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:r}),e.jsxs("aside",{ref:c,role:"dialog","aria-modal":"true","aria-labelledby":u,tabIndex:-1,className:`absolute inset-y-0 flex w-full flex-col border-app-border bg-app-card shadow-2xl ${gt[a]} ${l}`,children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-app-border px-6 py-4",children:[e.jsx("h2",{id:u,className:"text-sm font-semibold uppercase tracking-widest text-app-soft",children:s}),e.jsx(q,{onClick:r,tooltip:"Close","aria-label":"Close",variant:"secondary",children:e.jsx(ne,{})})]}),e.jsx("div",{className:`min-h-0 flex-1 ${n?"overflow-y-auto p-6":"flex flex-col"}`,children:i}),o&&e.jsx("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-3 border-t border-app-border px-6 py-4",children:o})]})]}),document.body):null},qe=({className:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:t??"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 6h16M4 12h16M4 18h16"})}),jt=({header:t,sidebar:r,sidebarTitle:s="Menu",children:a,className:l=""})=>{const[n,o]=f.useState(!1),i=()=>o(!1);f.useEffect(()=>{const u=window.matchMedia("(min-width: 768px)"),m=d=>d.matches&&o(!1);return u.addEventListener("change",m),()=>u.removeEventListener("change",m)},[]);const c=typeof r=="function"?r(i):r;return e.jsxs("div",{className:`relative flex h-screen flex-col overflow-hidden bg-app-bg text-app-text ${l}`,children:[e.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-app-border bg-app-card px-4 py-2",children:[r&&e.jsx("span",{className:"md:hidden",children:e.jsx(q,{variant:"secondary","aria-label":"Open menu",onClick:()=>o(!0),children:e.jsx(qe,{})})}),e.jsx("div",{className:"min-w-0 flex-1",children:t})]}),e.jsxs("div",{className:"flex min-h-0 flex-1",children:[r&&e.jsx("aside",{className:"hidden shrink-0 md:block",children:c}),e.jsx("main",{className:"relative min-w-0 flex-1 overflow-y-auto p-4 sm:p-6",children:a})]}),r&&e.jsx(ze,{open:n,onClose:i,title:s,side:"left",width:"max-w-xs",padded:!1,children:e.jsx("div",{className:"flex min-h-0 flex-1 flex-col [&>nav]:min-h-0 [&>nav]:w-full [&>nav]:flex-1 [&>nav]:border-r-0",children:typeof r=="function"?r(i):r})})]})},Se=["rgb(var(--color-app-strong))","#3b82f6","#10b981","#f59e0b","#ef4444","#8b5cf6","#06b6d4","#ec4899"],oe=(t,r)=>t.color??Se[r%Se.length],Ke=(t,r,s=5)=>{const a=Math.min(0,t),l=r<=a?a+1:r,n=(l-a)/(s-1),o=10**Math.floor(Math.log10(n)),i=n/o,c=(i<=1?1:i<=2?2:i<=5?5:10)*o,u=Math.floor(a/c)*c,m=Math.ceil(l/c)*c,d=[];for(let p=u;p<=m+c/2;p+=c)d.push(Number(p.toPrecision(12)));return{min:u,max:m,ticks:d}},vt=t=>new Intl.NumberFormat(void 0,{notation:"compact",maximumFractionDigits:1}).format(t),yt=600,z={top:12,right:16,bottom:28,left:44},_e=()=>{const t=f.useRef(null),[r,s]=f.useState(yt);return f.useEffect(()=>{const a=t.current;if(!a||typeof ResizeObserver>"u")return;const l=new ResizeObserver(([n])=>{const o=Math.round(n.contentRect.width);o>0&&s(o)});return l.observe(a),()=>l.disconnect()},[]),[t,r]},ye=({items:t})=>e.jsx("ul",{className:"m-0 mt-2 flex list-none flex-wrap justify-center gap-x-4 gap-y-1 p-0 text-xs text-app-muted",children:t.map(r=>e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{"aria-hidden":"true",className:"inline-block h-2.5 w-2.5",style:{background:r.color}}),r.name]},r.name))}),He=({width:t,height:r,scale:s,labels:a,xPositions:l,label:n,children:o,legend:i})=>{const c=r-z.bottom,u=c-z.top,m=d=>z.top+u*(1-(d-s.min)/(s.max-s.min));return e.jsxs("figure",{className:"m-0",children:[e.jsxs("svg",{role:"img","aria-label":n,width:t,height:r,viewBox:`0 0 ${t} ${r}`,className:"block max-w-full text-app-muted",fontFamily:"inherit",children:[s.ticks.map(d=>e.jsxs("g",{children:[e.jsx("line",{x1:z.left,x2:t-z.right,y1:m(d),y2:m(d),stroke:"rgb(var(--color-app-border))",strokeWidth:"1",strokeDasharray:d===s.min?void 0:"3 3"}),e.jsx("text",{x:z.left-6,y:m(d),textAnchor:"end",dominantBaseline:"middle",fontSize:"11",fill:"currentColor",children:vt(d)})]},d)),a.map((d,p)=>e.jsx("text",{x:l[p],y:c+16,textAnchor:"middle",fontSize:"11",fill:"currentColor",children:d},`${d}-${p}`)),o(m)]}),i]})},Ge=t=>t.map((r,s)=>({name:r.name,color:oe(r,s)})),Ue=({labels:t,series:r,height:s=300,area:a=!1,label:l="Line chart",legend:n=!0,className:o=""})=>{const[i,c]=_e(),u=r.flatMap(x=>x.values),m=Ke(Math.min(...u),Math.max(...u)),d=z.left,p=c-z.right,h=x=>t.length===1?(d+p)/2:d+(p-d)*x/(t.length-1),g=t.map((x,b)=>h(b));return e.jsx("div",{ref:i,className:o,children:e.jsx(He,{width:c,height:s,scale:m,labels:t,xPositions:g,label:l,legend:n&&r.length>1?e.jsx(ye,{items:Ge(r)}):null,children:x=>{const b=x(Math.max(m.min,0));return r.map((j,k)=>{const $=oe(j,k),y=j.values.map((v,S)=>`${h(S)},${x(v)}`);return e.jsxs("g",{children:[a&&e.jsx("polygon",{points:`${h(0)},${b} ${y.join(" ")} ${h(j.values.length-1)},${b}`,fill:$,opacity:"0.18"}),e.jsx("polyline",{points:y.join(" "),fill:"none",stroke:$,strokeWidth:"2",strokeLinejoin:"round"}),j.values.map((v,S)=>e.jsx("circle",{cx:h(S),cy:x(v),r:"3.5",fill:$,children:e.jsx("title",{children:`${j.name}, ${t[S]}: ${v}`})},S))]},j.name)})}})})},wt=({label:t="Area chart",...r})=>e.jsx(Ue,{area:!0,label:t,...r}),kt={sm:"h-6 w-6 text-[10px]",md:"h-9 w-9 text-xs",lg:"h-14 w-14 text-base"},Nt=t=>(t??"").split(/\s+/).filter(Boolean).slice(0,2).map(r=>r[0].toUpperCase()).join(""),$t=({src:t,name:r,size:s="md",className:a=""})=>{const[l,n]=f.useState(!1),o=t&&!l;return e.jsx("span",{role:"img","aria-label":r,className:`inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full border border-app-border bg-app-bg font-semibold uppercase tracking-wider text-app-soft ${kt[s]} ${a}`,children:o?e.jsx("img",{src:t,alt:"",className:"h-full w-full object-cover",onError:()=>n(!0)}):Nt(r)||"?"})},Mt=({labels:t,series:r,height:s=300,stacked:a=!1,label:l="Bar chart",legend:n=!0,className:o=""})=>{const[i,c]=_e(),u=t.map(($,y)=>r.reduce((v,S)=>v+S.values[y],0)),m=Math.max(...a?u:r.flatMap($=>$.values)),d=a?0:Math.min(...r.flatMap($=>$.values)),p=Ke(d,m),h=z.left,x=(c-z.right-z.left)/t.length,b=x*.7,j=a?b:b/r.length,k=t.map(($,y)=>h+x*y+x/2);return e.jsx("div",{ref:i,className:o,children:e.jsx(He,{width:c,height:s,scale:p,labels:t,xPositions:k,label:l,legend:n&&r.length>1?e.jsx(ye,{items:Ge(r)}):null,children:$=>{const y=$(Math.max(p.min,0));return t.map((v,S)=>{const C=h+x*S+(x-b)/2;let M=y;return e.jsx("g",{children:r.map((E,D)=>{const R=E.values[S],F=$(R),B=Math.abs(y-F);let w=Math.min(F,y);const N=C+(a?0:j*D);return a&&(w=M-B,M=w),e.jsx("rect",{x:N+1,y:w,width:Math.max(j-2,1),height:B,fill:oe(E,D),children:e.jsx("title",{children:`${E.name}, ${v}: ${R}`})},E.name)})},`${v}-${S}`)})}})})},St=({as:t="p",className:r="",children:s,...a})=>e.jsx(t,{className:`m-0 text-sm text-app-text ${r}`,...a,children:s}),Ct=({items:t,linkComponent:r="a",linkProp:s="href",className:a=""})=>e.jsx("nav",{"aria-label":"Breadcrumb",className:a,children:e.jsx("ol",{className:"m-0 flex list-none flex-wrap items-center gap-2 p-0 text-xs font-semibold uppercase tracking-widest",children:t.map((l,n)=>{const o=n===t.length-1;return e.jsxs("li",{className:"flex items-center gap-2",children:[o||!l.href?e.jsx("span",{"aria-current":o?"page":void 0,className:o?"text-app-text":"text-app-muted",children:l.label}):e.jsx(r,{[s]:l.href,className:"text-app-muted transition hover:text-app-text",children:l.label}),!o&&e.jsx("span",{"aria-hidden":"true",className:"text-app-border",children:"/"})]},`${l.label}-${n}`)})})}),Ce=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate()),_=(t,r)=>new Date(t.getFullYear(),t.getMonth(),t.getDate()+r),ce=(t,r)=>{const s=new Date(t.getFullYear(),t.getMonth()+r,1),a=new Date(s.getFullYear(),s.getMonth()+1,0).getDate();return new Date(s.getFullYear(),s.getMonth(),Math.min(t.getDate(),a))},Z=(t,r)=>!!t&&!!r&&t.getTime()===r.getTime(),Q=(t,r)=>t.getTime()<r.getTime(),Lt=(t,r,s)=>!!r&&Q(t,r)||!!s&&Q(s,t),Et=(t,r=0)=>{const s=new Date(t.getFullYear(),t.getMonth(),1),a=(s.getDay()-r+7)%7,l=_(s,-a),n=[];for(let o=0;o<6;o++){const i=Array.from({length:7},(c,u)=>_(l,o*7+u));if(o>=4&&i[0].getMonth()!==t.getMonth())break;n.push(i)}return n},Tt=(t=0,r)=>Array.from({length:7},(s,a)=>{const l=new Date(2023,0,1+(t+a)%7);return new Intl.DateTimeFormat(r,{weekday:"short"}).format(l)}),It=(t,r)=>new Intl.DateTimeFormat(r,{month:"long",year:"numeric"}).format(t),fe=(t,r)=>t?new Intl.DateTimeFormat(r,{year:"numeric",month:"short",day:"numeric"}).format(t):"",Le="min-h-8 min-w-8 border border-app-border bg-app-bg px-2 py-1 text-xs font-semibold text-app-text transition hover:border-app-strong disabled:cursor-not-allowed disabled:opacity-50",we=({value:t,onChange:r,rangeStart:s,rangeEnd:a,min:l,max:n,weekStartsOn:o=0,locale:i,className:c=""})=>{const u=Ce(new Date),m=t??s??u,[d,p]=f.useState(Ce(m)),[h,g]=f.useState(new Date(m.getFullYear(),m.getMonth(),1)),x=f.useRef(null),b=f.useRef(!1);f.useEffect(()=>{var C,M;b.current&&(b.current=!1,(M=(C=x.current)==null?void 0:C.querySelector('button[tabindex="0"]'))==null||M.focus())});const j=C=>{b.current=!0,p(C),(C.getMonth()!==h.getMonth()||C.getFullYear()!==h.getFullYear())&&g(new Date(C.getFullYear(),C.getMonth(),1))},k=C=>{const M=(d.getDay()-o+7)%7,E={ArrowLeft:_(d,-1),ArrowRight:_(d,1),ArrowUp:_(d,-7),ArrowDown:_(d,7),PageUp:ce(d,-1),PageDown:ce(d,1),Home:_(d,-M),End:_(d,6-M)};E[C.key]&&(C.preventDefault(),j(E[C.key]))},$=C=>{const M=ce(h,C);g(M),p(new Date(M.getFullYear(),M.getMonth(),Math.min(d.getDate(),28)))},[y,v]=s&&a&&Q(a,s)?[a,s]:[s,a],S=Et(h,o);return e.jsxs("div",{className:`inline-block border border-app-border bg-app-card p-3 text-app-text ${c}`,children:[e.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[e.jsx("button",{type:"button",className:Le,"aria-label":"Previous month",onClick:()=>$(-1),children:"‹"}),e.jsx("div",{"aria-live":"polite",className:"text-xs font-semibold uppercase tracking-widest",children:It(h,i)}),e.jsx("button",{type:"button",className:Le,"aria-label":"Next month",onClick:()=>$(1),children:"›"})]}),e.jsxs("table",{ref:x,role:"grid",onKeyDown:k,className:"border-collapse",children:[e.jsx("thead",{children:e.jsx("tr",{children:Tt(o,i).map(C=>e.jsx("th",{scope:"col",className:"h-8 w-7 text-[10px] min-[360px]:w-8 sm:w-9 font-semibold uppercase tracking-widest text-app-muted",children:C.slice(0,2)},C))})}),e.jsx("tbody",{children:S.map(C=>e.jsx("tr",{children:C.map(M=>{const E=Z(M,t)||Z(M,y)||Z(M,v),D=y&&v&&!Q(M,y)&&!Q(v,M),R=M.getMonth()!==h.getMonth(),F=Lt(M,l,n);let B="text-app-text hover:bg-app-bg";return E?B="bg-app-strong text-app-bg":D?B="bg-app-soft/20 text-app-text":R&&(B="text-app-muted hover:bg-app-bg"),e.jsx("td",{role:"gridcell","aria-selected":E,className:"p-0",children:e.jsx("button",{type:"button",tabIndex:Z(M,d)?0:-1,disabled:F,"aria-label":M.toDateString(),"aria-current":Z(M,u)?"date":void 0,onClick:()=>{p(M),r==null||r(M)},className:`h-8 w-7 text-xs transition min-[360px]:w-8 sm:h-9 sm:w-9 disabled:cursor-not-allowed disabled:opacity-30 ${B} ${Z(M,u)&&!E?"font-bold underline underline-offset-2":""}`,children:M.getDate()})},M.getTime())})},C[0].getTime()))})]})]})},Dt=({title:t,subtitle:r,actions:s,footer:a,padded:l=!0,className:n="",children:o})=>e.jsxs("section",{className:`flex flex-col border border-app-border bg-app-card ${n}`,children:[(t||s)&&e.jsxs("header",{className:"flex items-center justify-between gap-3 border-b border-app-border px-5 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[t&&e.jsx("h3",{className:"m-0 text-sm font-semibold uppercase tracking-widest text-app-text",children:t}),r&&e.jsx("p",{className:"m-0 mt-0.5 text-xs text-app-muted",children:r})]}),s&&e.jsx("div",{className:"flex shrink-0 items-center gap-2",children:s})]}),e.jsx("div",{className:`flex-1 text-sm text-app-text ${l?"p-5":""}`,children:o}),a&&e.jsx("footer",{className:"border-t border-app-border px-5 py-3 text-sm",children:a})]}),Ee="absolute top-1/2 z-10 -translate-y-1/2 border border-app-border bg-app-card/90 px-3 py-2 text-app-text transition hover:border-app-strong disabled:cursor-not-allowed disabled:opacity-40",At=({children:t,index:r,defaultIndex:s=0,onIndexChange:a,autoPlay:l=0,loop:n=!0,label:o="Carousel",className:i=""})=>{const c=f.Children.toArray(t),[u,m]=f.useState(s),[d,p]=f.useState(!1),h=r??u,g=x=>{if(!c.length)return;let b=x;n?b=(x+c.length)%c.length:b=Math.min(Math.max(x,0),c.length-1),r===void 0&&m(b),a==null||a(b)};return f.useEffect(()=>{if(!l||d||c.length<2)return;const x=setTimeout(()=>g(h+1),l);return()=>clearTimeout(x)},[l,d,h,c.length]),e.jsxs("div",{role:"region","aria-roledescription":"carousel","aria-label":o,className:`relative ${i}`,onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),onFocus:()=>p(!0),onBlur:()=>p(!1),onKeyDown:x=>{x.key==="ArrowLeft"?g(h-1):x.key==="ArrowRight"&&g(h+1)},children:[e.jsx("div",{className:"overflow-hidden border border-app-border bg-app-card",children:e.jsx("div",{className:"flex transition-transform duration-300 ease-out",style:{transform:`translateX(-${h*100}%)`},"aria-live":l&&!d?"off":"polite",children:c.map((x,b)=>e.jsx("div",{role:"group","aria-roledescription":"slide","aria-label":`${b+1} of ${c.length}`,"aria-hidden":b!==h,ref:j=>{j&&(b===h?j.removeAttribute("inert"):j.setAttribute("inert",""))},className:"w-full shrink-0",children:x},b))})}),c.length>1&&e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button","aria-label":"Previous slide",className:`${Ee} left-2`,disabled:!n&&h===0,onClick:()=>g(h-1),children:"‹"}),e.jsx("button",{type:"button","aria-label":"Next slide",className:`${Ee} right-2`,disabled:!n&&h===c.length-1,onClick:()=>g(h+1),children:"›"}),e.jsx("div",{className:"mt-2 flex justify-center gap-1.5",children:c.map((x,b)=>e.jsx("button",{type:"button","aria-label":`Go to slide ${b+1}`,"aria-current":b===h,onClick:()=>g(b),className:"flex h-6 w-6 items-center justify-center",children:e.jsx("span",{className:`h-2 w-2 border border-app-strong transition ${b===h?"bg-app-strong":"bg-transparent"}`})},b))})]})]})},he=({label:t,checked:r,onChange:s,indeterminate:a=!1,disabled:l=!1,className:n="",...o})=>{const i=f.useId(),c=f.useRef(null);f.useEffect(()=>{c.current&&(c.current.indeterminate=a)},[a]);const u=r||a;return e.jsxs("label",{htmlFor:i,className:`inline-flex min-h-8 items-center gap-2 align-middle text-sm leading-none text-app-text ${l?"cursor-not-allowed opacity-50":"cursor-pointer"} ${n}`,children:[e.jsx("input",{ref:c,id:i,type:"checkbox",checked:r,disabled:l,onChange:m=>s==null?void 0:s(m.target.checked),className:"peer sr-only",...o}),e.jsx("span",{"aria-hidden":"true",className:`flex h-4 w-4 shrink-0 items-center justify-center border transition peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-app-strong ${u?"border-app-strong bg-app-strong text-app-bg":"border-app-border bg-app-bg"}`,children:a?e.jsx("svg",{viewBox:"0 0 16 16",className:"h-3 w-3",fill:"none",stroke:"currentColor",strokeWidth:"2.2",children:e.jsx("path",{d:"M3.5 8h9"})}):r&&e.jsx("svg",{viewBox:"0 0 16 16",className:"h-3 w-3",fill:"none",stroke:"currentColor",strokeWidth:"2.2",children:e.jsx("path",{strokeLinecap:"square",strokeLinejoin:"miter",d:"M3 8.5l3.2 3.2L13 4.8"})})}),t]})},Rt=({open:t,onClose:r,commands:s,placeholder:a="Type a command…",empty:l="No matching commands"})=>{const[n,o]=f.useState(""),[i,c]=f.useState(0),u=f.useRef(null),m=f.useRef(null),d=f.useId();le(t,r),te(t,u),f.useEffect(()=>{t&&(o(""),c(0))},[t]);const p=f.useMemo(()=>{const x=n.trim().toLowerCase(),b=x?s.filter(k=>`${k.label} ${k.description??""} ${k.group??""}`.toLowerCase().includes(x)):s;return[...new Set(b.map(k=>k.group))].flatMap(k=>b.filter($=>$.group===k))},[s,n]);if(f.useEffect(()=>{var x,b,j;(j=(b=(x=m.current)==null?void 0:x.querySelector('[aria-selected="true"]'))==null?void 0:b.scrollIntoView)==null||j.call(b,{block:"nearest"})},[i,p]),!t)return null;const h=x=>{var b;x&&(r(),(b=x.onSelect)==null||b.call(x))},g=x=>{x.key==="ArrowDown"?(x.preventDefault(),c(b=>p.length?(b+1)%p.length:0)):x.key==="ArrowUp"?(x.preventDefault(),c(b=>p.length?(b-1+p.length)%p.length:0)):x.key==="Enter"&&(x.preventDefault(),h(p[i]))};return X.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[var(--xd-z-modal,80)] flex items-start justify-center px-4 pt-[15vh]",children:[e.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:r}),e.jsxs("div",{ref:u,role:"dialog","aria-modal":"true","aria-label":"Command palette",tabIndex:-1,className:"relative z-10 flex max-h-[60vh] w-full max-w-xl flex-col border border-app-border bg-app-card shadow-2xl",children:[e.jsx("input",{"data-autofocus":!0,role:"combobox","aria-expanded":"true","aria-controls":d,"aria-activedescendant":p[i]?`${d}-${p[i].key}`:void 0,"aria-autocomplete":"list",value:n,onChange:x=>{o(x.target.value),c(0)},onKeyDown:g,placeholder:a,"aria-label":"Search commands",className:"w-full border-b border-app-border bg-transparent px-4 py-3 text-sm text-app-text outline-none placeholder:text-app-muted"}),e.jsxs("ul",{id:d,ref:m,role:"listbox","aria-label":"Commands",className:"m-0 flex-1 list-none overflow-y-auto p-0",children:[p.length===0&&e.jsx("li",{className:"px-4 py-6 text-center text-sm text-app-muted",children:l}),p.map((x,b)=>{var k;const j=x.group&&x.group!==((k=p[b-1])==null?void 0:k.group);return e.jsxs("li",{role:"presentation",children:[j&&e.jsx("div",{className:"px-4 pb-1 pt-3 text-[10px] font-semibold uppercase tracking-widest text-app-muted",children:x.group}),e.jsxs("div",{id:`${d}-${x.key}`,role:"option","aria-selected":b===i,onMouseMove:()=>c(b),onClick:()=>h(x),className:`flex cursor-pointer items-center justify-between gap-3 px-4 py-2.5 text-sm ${b===i?"bg-app-strong text-app-bg":"text-app-text"}`,children:[e.jsxs("span",{className:"min-w-0",children:[e.jsx("span",{className:"block truncate",children:x.label}),x.description&&e.jsx("span",{className:`block truncate text-xs ${b===i?"opacity-80":"text-app-muted"}`,children:x.description})]}),x.shortcut&&e.jsx("kbd",{className:`shrink-0 border px-1.5 py-0.5 text-[10px] ${b===i?"border-app-bg/40":"border-app-border text-app-muted"}`,children:x.shortcut})]})]},x.key)})]})]})]}),document.body)},ke="xedonium-theme-override",ae={light:{outer:"#d8d8d8",bladeA:"#f5f5f5",bladeB:"#ffffff",hubOuter:"#252529",hubInner:"#ffffff",ring:"#5e5e5e",ringOpacity:"0.85"},dark:{outer:"#3a3a3a",bladeA:"#222222",bladeB:"#151515",hubOuter:"#efeff0",hubInner:"#151515",ring:"#b5b5b5",ringOpacity:"0.85"}},Pt=450,Te=()=>typeof document>"u"?"light":document.documentElement.getAttribute("data-theme")==="dark"?"dark":"light",Ne=({size:t=64,theme:r,label:s})=>{const[a,l]=f.useState(()=>r||Te()),n=f.useRef(null);f.useEffect(()=>{if(r){l(r);return}const i=document.documentElement,c=()=>l(Te()),u=new MutationObserver(c);return c(),u.observe(i,{attributes:!0,attributeFilter:["data-theme"]}),()=>u.disconnect()},[r]),f.useEffect(()=>{let i=0,c=null,u;const m=d=>{var h;const p=c===null?0:(d-c)/1e3;c=d,i=(i+Pt*p)%360,(h=n.current)==null||h.setAttribute("transform",`rotate(${i} 32 32)`),u=requestAnimationFrame(m)};return u=requestAnimationFrame(m),()=>cancelAnimationFrame(u)},[]);const o=ae[a]||ae.light;return e.jsxs("svg",{width:t,height:t,viewBox:"0 0 64 64",xmlns:"http://www.w3.org/2000/svg",focusable:"false",...s?{role:"img","aria-label":s}:{"aria-hidden":!0},children:[e.jsx("circle",{cx:"32",cy:"32",r:"30",fill:o.outer}),e.jsxs("g",{ref:n,children:[e.jsx("path",{d:"M32 32 C32 18, 42 14, 45 10 C49 5, 52 6, 50 12 C48 18, 38 20, 32 32 Z",fill:o.bladeA}),e.jsx("path",{d:"M32 32 C46 32, 50 42, 54 45 C59 49, 58 52, 52 50 C46 48, 44 38, 32 32 Z",fill:o.bladeB}),e.jsx("path",{d:"M32 32 C32 46, 22 50, 19 54 C15 59, 12 58, 14 52 C16 46, 26 44, 32 32 Z",fill:o.bladeA}),e.jsx("path",{d:"M32 32 C18 32, 14 22, 10 19 C5 15, 6 12, 12 14 C18 16, 20 26, 32 32 Z",fill:o.bladeB})]}),e.jsx("circle",{cx:"32",cy:"32",r:"5",fill:o.hubOuter}),e.jsx("circle",{cx:"32",cy:"32",r:"3",fill:o.hubInner}),e.jsx("circle",{cx:"32",cy:"32",r:"30",fill:"none",stroke:o.ring,strokeWidth:"5",opacity:"0.85"})]})},Ft={default:{dot:"bg-app-soft",title:"text-app-soft"},danger:{dot:"bg-red-500",title:"text-red-700 dark:text-red-400"}},Ye=({open:t,onClose:r,title:s,tone:a="default",busy:l=!1,dismissible:n=!0,role:o="dialog",describedBy:i,maxWidth:c="max-w-lg",className:u="",as:m="div",footer:d,children:p,...h})=>{const g=f.useRef(null),x=f.useId(),b=f.useRef(r);f.useEffect(()=>{b.current=r});const j=f.useCallback(()=>{!l&&n&&b.current()},[l,n]);if(le(t,j),te(t,g),!t)return null;const{dot:k,title:$}=Ft[a];return X.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[var(--xd-z-modal,80)] flex items-center justify-center px-4",children:[e.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 bg-black/30 backdrop-blur-sm",onClick:j}),e.jsxs(m,{ref:g,role:o,"aria-modal":"true","aria-labelledby":x,"aria-describedby":i,"aria-busy":l||void 0,tabIndex:-1,className:`relative z-10 flex max-h-[90vh] w-full min-w-0 flex-col border border-app-border bg-app-card shadow-2xl ${c} ${u}`,...h,children:[e.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-app-border px-6 pb-5 pt-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{"aria-hidden":"true",className:`inline-block h-2 w-2 rounded-full ${k}`}),e.jsx("h2",{id:x,className:`text-sm font-semibold uppercase tracking-widest ${$}`,children:s})]}),e.jsx(q,{onClick:()=>!l&&b.current(),disabled:l,tooltip:"Close dialog","aria-label":"Close dialog",variant:"secondary",children:e.jsx(ne,{})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:p}),d&&e.jsx("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-3 border-t border-app-border px-6 pb-6 pt-4",children:d})]})]}),document.body)},Bt=({open:t,onClose:r,onConfirm:s,title:a,tone:l="default",busy:n=!1,confirmLabel:o="Confirm",busyLabel:i,cancelLabel:c="Cancel",error:u,children:m})=>e.jsx(Ye,{open:t,onClose:r,busy:n,title:a,tone:l,role:l==="danger"?"alertdialog":"dialog",maxWidth:"max-w-md",footer:e.jsxs(e.Fragment,{children:[e.jsx(q,{onClick:r,disabled:n,variant:"secondary","data-autofocus":!0,children:c}),e.jsx(q,{onClick:s,disabled:n,variant:l==="danger"?"danger":"default",children:n?e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(Ne,{size:16})," ",i||o]}):o})]}),children:e.jsxs("div",{className:"flex flex-col gap-3 px-6 py-5 text-sm text-app-text",children:[m,u&&e.jsx("p",{role:"alert",className:"text-red-700 dark:text-red-400",children:u})]})}),Ot=({maxWidth:t="max-w-5xl",className:r="",as:s="div",children:a,...l})=>e.jsx(s,{className:`mx-auto w-full px-4 sm:px-6 ${t} ${r}`,...l,children:a}),Wt={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4",5:"grid-cols-5",6:"grid-cols-6",12:"grid-cols-12"},zt={1:"grid-cols-1",2:"grid-cols-1 sm:grid-cols-2",3:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",4:"grid-cols-1 sm:grid-cols-2 lg:grid-cols-4",5:"grid-cols-1 sm:grid-cols-3 lg:grid-cols-5",6:"grid-cols-2 sm:grid-cols-3 lg:grid-cols-6",12:"grid-cols-4 sm:grid-cols-6 lg:grid-cols-12"},qt={0:"gap-0",1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",6:"gap-6",8:"gap-8"},me=({cols:t=2,gap:r=4,responsive:s=!0,className:a="",as:l="div",children:n,...o})=>e.jsx(l,{className:`grid ${(s?zt:Wt)[t]} ${qt[r]} ${a}`,...o,children:n}),W=({as:t,htmlFor:r,className:s="",children:a,...l})=>{const n=t??(r?"label":"span");return e.jsx(n,{htmlFor:n==="label"?r:void 0,className:`text-xs font-semibold uppercase tracking-widest text-app-muted ${s}`,...l,children:a})},Ve=({title:t,subtitle:r,children:s})=>e.jsxs("div",{className:"mb-6 flex flex-wrap items-end justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight text-app-text sm:text-3xl",children:t}),r&&e.jsx(W,{as:"p",className:"mt-0.5",children:r})]}),s&&e.jsx("div",{className:"flex flex-wrap items-center gap-2",children:s})]}),Kt={up:"text-emerald-700 dark:text-emerald-400",down:"text-red-700 dark:text-red-400",flat:"text-app-muted"},Ze=({label:t,value:r,delta:s,trend:a="flat",hint:l,className:n=""})=>e.jsxs("div",{className:`flex flex-col gap-1 border border-app-border bg-app-card p-4 ${n}`,children:[e.jsx(W,{children:t}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:"text-2xl font-bold tracking-tight text-app-text",children:r}),s&&e.jsxs("span",{className:`text-xs font-semibold ${Kt[a]}`,children:[e.jsx("span",{"aria-hidden":"true",children:a==="up"?"▲ ":a==="down"?"▼ ":""}),s]})]}),l&&e.jsx("span",{className:"text-xs text-app-muted",children:l})]}),_t=({title:t,subtitle:r,actions:s,stats:a=[],columns:l=2,children:n})=>e.jsxs("div",{className:"flex flex-col gap-6",children:[t&&e.jsx(Ve,{title:t,subtitle:r,children:s}),a.length>0&&e.jsx(me,{cols:Math.min(a.length,4),gap:4,children:a.map(o=>e.jsx(Ze,{...o},o.label))}),n&&e.jsx(me,{cols:l,gap:4,children:n})]}),re=(t=!1)=>`w-full bg-app-bg border px-3 py-2 text-sm text-app-text placeholder:text-app-muted outline-none transition focus:ring-2 focus:ring-app-strong focus:border-app-strong disabled:cursor-not-allowed disabled:opacity-50 ${t?"border-red-500":"border-app-border"}`,$e=f.forwardRef(({value:t,onChange:r,invalid:s=!1,type:a="text",className:l="",...n},o)=>e.jsx("input",{ref:o,type:a,"aria-invalid":s||void 0,className:`${re(s)} ${l}`,value:t,onChange:i=>r==null?void 0:r(i.target.value),...n}));$e.displayName="Input";const Ht=(t,r,s)=>{const a=new Set([1,r]);for(let o=t-s;o<=t+s;o++)o>1&&o<r&&a.add(o);const l=[...a].sort((o,i)=>o-i),n=[];return l.forEach((o,i)=>{i>0&&o-l[i-1]>1&&n.push(null),n.push(o)}),n},de=(t=!1)=>`min-h-9 min-w-9 border px-2 py-1.5 text-xs font-semibold tracking-widest transition disabled:cursor-not-allowed disabled:opacity-50 ${t?"border-app-strong bg-app-strong text-app-bg":"border-app-border bg-app-bg text-app-text hover:border-app-strong"}`,Qe=({page:t,pageCount:r,onChange:s,siblings:a=1,className:l=""})=>e.jsx("nav",{"aria-label":"Pagination",className:l,children:e.jsxs("ul",{className:"m-0 flex list-none flex-wrap items-center gap-1 p-0",children:[e.jsx("li",{children:e.jsx("button",{type:"button",className:de(),disabled:t<=1,onClick:()=>s(t-1),children:"Prev"})}),Ht(t,r,a).map((n,o)=>n===null?e.jsx("li",{"aria-hidden":"true",className:"px-1 text-app-muted",children:"…"},`gap-${o}`):e.jsx("li",{children:e.jsx("button",{type:"button",className:de(n===t),"aria-current":n===t?"page":void 0,"aria-label":`Page ${n}`,onClick:()=>s(n),children:n})},n)),e.jsx("li",{children:e.jsx("button",{type:"button",className:de(),disabled:t>=r,onClick:()=>s(t+1),children:"Next"})})]})}),Ie={left:"text-left",center:"text-center",right:"text-right"},Gt=(t,r)=>t==null?r==null?0:1:r==null?-1:typeof t=="number"&&typeof r=="number"?t-r:String(t).localeCompare(String(r),void 0,{numeric:!0,sensitivity:"base"}),Ut=({columns:t,rows:r,rowKey:s="id",pageSize:a=10,searchable:l=!1,selectable:n=!1,selected:o,onSelectionChange:i,empty:c="No results",caption:u,className:m=""})=>{const[d,p]=f.useState(null),[h,g]=f.useState(""),[x,b]=f.useState(1),[j,k]=f.useState([]),$=o??j,y=(w,N)=>N.accessor?N.accessor(w):w[N.key],v=f.useMemo(()=>{const w=h.trim().toLowerCase();let N=w?r.filter(I=>t.some(A=>String(y(I,A)??"").toLowerCase().includes(w))):r;if(d){const I=t.find(A=>A.key===d.key);N=[...N].sort((A,L)=>Gt(y(A,I),y(L,I))*(d.dir==="asc"?1:-1))}return N},[r,t,h,d]),S=Math.max(1,Math.ceil(v.length/a)),C=Math.min(x,S),M=v.slice((C-1)*a,C*a),E=w=>{o===void 0&&k(w),i==null||i(w)},D=M.map(w=>w[s]),R=D.length>0&&D.every(w=>$.includes(w)),F=D.some(w=>$.includes(w)),B=w=>{b(1),p(N=>(N==null?void 0:N.key)!==w.key?{key:w.key,dir:"asc"}:N.dir==="asc"?{key:w.key,dir:"desc"}:null)};return e.jsxs("div",{className:`flex flex-col gap-3 ${m}`,children:[l&&e.jsx("div",{className:"max-w-xs",children:e.jsx($e,{value:h,onChange:w=>{g(w),b(1)},placeholder:"Search…","aria-label":"Search rows",type:"search"})}),e.jsx("div",{className:"overflow-x-auto border border-app-border",children:e.jsxs("table",{className:"w-full border-collapse bg-app-card text-sm text-app-text",children:[u&&e.jsx("caption",{className:"sr-only",children:u}),e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-app-border bg-app-bg",children:[n&&e.jsx("th",{scope:"col",className:"w-10 px-4 py-2.5",children:e.jsx(he,{"aria-label":"Select all rows on this page",checked:R,indeterminate:!R&&F,onChange:w=>E(w?[...new Set([...$,...D])]:$.filter(N=>!D.includes(N)))})}),t.map(w=>{const N=(d==null?void 0:d.key)===w.key;return e.jsx("th",{scope:"col","aria-sort":N?d.dir==="asc"?"ascending":"descending":w.sortable?"none":void 0,className:`px-4 py-2.5 text-xs font-semibold uppercase tracking-widest text-app-muted ${Ie[w.align??"left"]}`,children:w.sortable?e.jsxs("button",{type:"button",onClick:()=>B(w),className:"-my-2 inline-flex min-h-8 items-center gap-1 uppercase tracking-widest transition hover:text-app-text",children:[w.header,e.jsx("span",{"aria-hidden":"true",children:N?d.dir==="asc"?"↑":"↓":"↕"})]}):w.header},w.key)})]})}),e.jsx("tbody",{children:M.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length+(n?1:0),className:"px-4 py-6 text-center text-app-muted",children:c})}):M.map(w=>{const N=w[s],I=$.includes(N);return e.jsxs("tr",{"aria-selected":n?I:void 0,className:`border-b border-app-border last:border-b-0 hover:bg-app-bg ${I?"bg-app-soft/10":""}`,children:[n&&e.jsx("td",{className:"px-4 py-2.5",children:e.jsx(he,{"aria-label":`Select row ${N}`,checked:I,onChange:A=>E(A?[...$,N]:$.filter(L=>L!==N))})}),t.map(A=>e.jsx("td",{className:`px-4 py-2.5 ${Ie[A.align??"left"]}`,children:A.render?A.render(w):w[A.key]},A.key))]},N)})})]})}),e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 text-xs text-app-muted",children:[e.jsxs("span",{"aria-live":"polite",children:[v.length," ",v.length===1?"row":"rows",n&&$.length>0?`, ${$.length} selected`:""]}),S>1&&e.jsx(Qe,{page:C,pageCount:S,onChange:b})]})]})},Yt=({label:t,value:r,onChange:s,min:a,max:l,placeholder:n="Select date",error:o,locale:i,weekStartsOn:c})=>{const[u,m]=f.useState(!1),d=f.useRef(null),p=f.useRef(null),h=f.useRef(null),g=f.useId(),x=`${g}-error`;return G(u,[d,h],b=>{var j,k;m(!1),b==="escape"&&((k=(j=d.current)==null?void 0:j.querySelector("button"))==null||k.focus())}),e.jsxs("div",{ref:d,className:"relative flex flex-col gap-1",children:[t&&e.jsx(W,{htmlFor:g,children:t}),e.jsx("button",{ref:p,id:g,type:"button","aria-haspopup":"dialog","aria-expanded":u,"aria-invalid":!!o,"aria-describedby":o?x:void 0,onClick:()=>m(b=>!b),className:`${re(!!o)} text-left ${r?"":"text-app-muted"}`,children:r?fe(r,i):n}),e.jsx(Y,{open:u,anchorRef:p,panelRef:h,placement:"bottom-start",role:"dialog","aria-label":"Choose date",className:"shadow-xl",children:e.jsx(we,{value:r,min:a,max:l,locale:i,weekStartsOn:c,onChange:b=>{var j,k;s==null||s(b),m(!1),(k=(j=d.current)==null?void 0:j.querySelector("button"))==null||k.focus()}})}),o&&e.jsx("span",{id:x,className:"text-xs text-red-700 dark:text-red-400",children:o})]})},Vt=({label:t,value:r,onChange:s,min:a,max:l,placeholder:n="Select range",error:o,locale:i,weekStartsOn:c})=>{const[u,m]=f.useState(!1),[d,p]=f.useState(null),h=f.useRef(null),g=f.useRef(null),x=f.useRef(null),b=f.useId(),j=`${b}-error`,k=()=>{m(!1),p(null)};G(u,[h,x],v=>{var S,C;k(),v==="escape"&&((C=(S=h.current)==null?void 0:S.querySelector("button"))==null||C.focus())});const $=v=>{var M,E;if(!d){p(v),s==null||s({start:v,end:null});return}const[S,C]=Q(v,d)?[v,d]:[d,v];s==null||s({start:S,end:C}),k(),(E=(M=h.current)==null?void 0:M.querySelector("button"))==null||E.focus()},y=r!=null&&r.start?`${fe(r.start,i)} – ${r.end?fe(r.end,i):"…"}`:"";return e.jsxs("div",{ref:h,className:"relative flex flex-col gap-1",children:[t&&e.jsx(W,{htmlFor:b,children:t}),e.jsx("button",{ref:g,id:b,type:"button","aria-haspopup":"dialog","aria-expanded":u,"aria-invalid":!!o,"aria-describedby":o?j:void 0,onClick:()=>u?k():m(!0),className:`${re(!!o)} text-left ${y?"":"text-app-muted"}`,children:y||n}),e.jsx(Y,{open:u,anchorRef:g,panelRef:x,placement:"bottom-start",role:"dialog","aria-label":"Choose date range",className:"shadow-xl",children:e.jsx(we,{rangeStart:d??(r==null?void 0:r.start),rangeEnd:d?null:r==null?void 0:r.end,min:a,max:l,locale:i,weekStartsOn:c,onChange:$})}),o&&e.jsx("span",{id:j,className:"text-xs text-red-700 dark:text-red-400",children:o})]})},Zt=({orientation:t="horizontal",label:r,className:s=""})=>t==="vertical"?e.jsx("div",{role:"separator","aria-orientation":"vertical",className:`w-px self-stretch bg-app-border ${s}`}):r?e.jsxs("div",{role:"separator",className:`flex items-center gap-3 ${s}`,children:[e.jsx("span",{className:"h-px flex-1 bg-app-border"}),e.jsx(W,{children:r}),e.jsx("span",{className:"h-px flex-1 bg-app-border"})]}):e.jsx("hr",{className:`border-0 border-t border-app-border ${s}`}),Qt=({label:t,value:r,onChange:s,placeholder:a,error:l,type:n="text",autoComplete:o="off",required:i=!0,...c})=>{const u=f.useId(),m=`${u}-error`;return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(W,{htmlFor:u,children:t}),e.jsx("input",{id:u,type:n,autoComplete:o,"aria-required":i,"aria-invalid":!!l,"aria-describedby":l?m:void 0,className:`bg-app-bg border px-3 py-2 text-sm text-app-text placeholder:text-app-muted outline-none transition focus:ring-2 focus:ring-app-strong focus:border-app-strong ${l?"border-red-500":"border-app-border"}`,placeholder:a,value:r,onChange:d=>s(d.target.value),...c}),l&&e.jsx("span",{id:m,className:"text-xs text-red-700 dark:text-red-400",children:l})]})},Xt=({label:t="Choose files or drop them here",accept:r,multiple:s=!1,onChange:a,disabled:l=!1})=>{const n=f.useId(),[o,i]=f.useState([]),[c,u]=f.useState(!1),m=d=>{const p=[...d];i(p),a==null||a(p)};return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("label",{htmlFor:n,onDragOver:d=>{d.preventDefault(),l||u(!0)},onDragLeave:()=>u(!1),onDrop:d=>{d.preventDefault(),u(!1),l||m(s?d.dataTransfer.files:[d.dataTransfer.files[0]].filter(Boolean))},className:`flex flex-col items-center justify-center gap-1 border border-dashed px-4 py-8 text-center text-sm text-app-muted transition focus-within:ring-2 focus-within:ring-app-strong ${c?"border-app-strong bg-app-soft/10":"border-app-border bg-app-bg"} ${l?"cursor-not-allowed opacity-50":"cursor-pointer hover:border-app-strong"}`,children:[t,e.jsx("input",{id:n,type:"file",accept:r,multiple:s,disabled:l,className:"sr-only",onChange:d=>m(d.target.files)})]}),o.length>0&&e.jsx("ul",{className:"m-0 list-none p-0 text-xs text-app-soft",children:o.map(d=>e.jsx("li",{children:d.name},`${d.name}-${d.size}`))})]})},Jt={0:"gap-0",1:"gap-1",2:"gap-2",3:"gap-3",4:"gap-4",6:"gap-6",8:"gap-8"},er={row:"flex-row",column:"flex-col"},tr={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch",baseline:"items-baseline"},rr={start:"justify-start",center:"justify-center",end:"justify-end",between:"justify-between",around:"justify-around"},Xe=({direction:t="row",gap:r=3,align:s,justify:a,wrap:l=!1,inline:n=!1,className:o="",as:i="div",children:c,...u})=>e.jsx(i,{className:`${n?"inline-flex":"flex"} ${er[t]} ${Jt[r]} ${s?tr[s]:""} ${a?rr[a]:""} ${l?"flex-wrap":""} ${o}`,...u,children:c}),sr=({active:t=!0,className:r="",children:s,...a})=>{const l=f.useRef(null);return te(t,l),e.jsx("div",{ref:l,tabIndex:-1,className:r,...a,children:s})},ar=({as:t="p",className:r="",children:s,...a})=>e.jsx(t,{className:`m-0 text-xs text-app-muted ${r}`,...a,children:s}),nr={square:"aspect-square",video:"aspect-video",photo:"aspect-[4/3]"},lr=({src:t,alt:r,ratio:s,fit:a="cover",fallback:l="Image unavailable",className:n="",...o})=>{const[i,c]=f.useState(!1),u=`${s?nr[s]:""} ${n}`;return i?e.jsx("div",{role:"img","aria-label":r,className:`flex items-center justify-center border border-app-border bg-app-bg p-4 text-xs text-app-muted ${u}`,children:l}):e.jsx("img",{src:t,alt:r,loading:"lazy",onError:()=>c(!0),className:`block w-full ${a==="contain"?"object-contain":"object-cover"} ${u}`,...o})},or=({items:t,divided:r=!0,className:s=""})=>e.jsx("ul",{className:`m-0 list-none border border-app-border bg-app-card p-0 ${s}`,children:t.map(a=>{const l=e.jsxs(e.Fragment,{children:[a.leading&&e.jsx("span",{className:"shrink-0",children:a.leading}),e.jsxs("span",{className:"min-w-0 flex-1 text-left",children:[e.jsx("span",{className:"block truncate text-sm text-app-text",children:a.primary}),a.secondary&&e.jsx("span",{className:"block truncate text-xs text-app-muted",children:a.secondary})]}),a.trailing&&e.jsx("span",{className:"shrink-0 text-xs text-app-muted",children:a.trailing})]});return e.jsx("li",{className:r?"border-b border-app-border last:border-b-0":"",children:a.onClick?e.jsx("button",{type:"button",onClick:a.onClick,className:"flex w-full items-center gap-3 px-4 py-3 transition hover:bg-app-bg",children:l}):e.jsx("div",{className:"flex items-center gap-3 px-4 py-3",children:l})},a.key)})}),Je=({children:t,maxWidth:r="max-w-5xl",centerContent:s=!1,themeToggle:a=!1,outerClassName:l="",innerClassName:n=""})=>{const o=s?"flex flex-1 items-center justify-center":"";return e.jsxs("main",{className:`relative flex flex-1 flex-col bg-app-bg px-4 py-8 sm:py-10 ${l}`,children:[a&&e.jsx("div",{className:"absolute right-4 top-4",children:e.jsx(ve,{})}),e.jsx("div",{className:`mx-auto w-full ${r} ${o} ${n}`,children:t})]})},ir=()=>e.jsx(Je,{maxWidth:"max-w-sm",centerContent:!0,children:e.jsx(Ne,{label:"Loading"})}),cr=({brand:t,links:r=[],actions:s,linkComponent:a="a",linkProp:l="href",label:n="Main",className:o=""})=>e.jsxs("nav",{"aria-label":n,className:`flex flex-wrap items-center gap-x-6 gap-y-2 border-b border-app-border bg-app-card px-4 py-3 ${o}`,children:[t&&e.jsx("div",{className:"text-sm font-bold tracking-tight text-app-text",children:t}),e.jsx("ul",{className:"m-0 flex flex-1 list-none flex-wrap items-center gap-1 p-0",children:r.map(({href:i,label:c,active:u,...m})=>e.jsx("li",{children:e.jsx(a,{[l]:i,"aria-current":u?"page":void 0,className:`px-2.5 py-1.5 text-xs font-semibold uppercase tracking-widest transition ${u?"bg-app-strong text-app-bg":"text-app-muted hover:text-app-text"}`,...m,children:c})},c))}),s&&e.jsx("div",{className:"flex items-center gap-2",children:s})]}),dr=()=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 17h5l-1.4-1.4A2 2 0 0118 14.2V11a6 6 0 10-12 0v3.2a2 2 0 01-.6 1.4L4 17h5m6 0a3 3 0 11-6 0"})}),pr=({notifications:t,onSelect:r,onMarkRead:s,onMarkAllRead:a,onClear:l,empty:n="You are all caught up",align:o="end"})=>{const[i,c]=f.useState(!1),u=f.useRef(null),m=f.useRef(null),d=f.useId(),p=t.filter(h=>!h.read).length;return G(i,[u,m],h=>{var g,x;c(!1),h==="escape"&&((x=(g=u.current)==null?void 0:g.querySelector("button"))==null||x.focus())}),e.jsxs("div",{ref:u,className:"relative inline-block",children:[e.jsx(q,{variant:"secondary","aria-label":p?`Notifications, ${p} unread`:"Notifications","aria-haspopup":"dialog","aria-expanded":i,"aria-controls":i?d:void 0,onClick:()=>c(h=>!h),children:e.jsxs("span",{className:"relative inline-flex",children:[e.jsx(dr,{}),p>0&&e.jsx("span",{"aria-hidden":"true",className:"absolute -right-2 -top-2 min-w-[1rem] bg-red-500 px-1 text-center text-[10px] font-bold leading-4 text-white",children:p>9?"9+":p})]})}),e.jsxs(Y,{open:i,anchorRef:u,panelRef:m,placement:`bottom-${o}`,id:d,role:"dialog","aria-label":"Notifications",className:"flex max-h-96 w-80 max-w-[calc(100vw-1rem)] flex-col border border-app-border bg-app-card shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-app-border px-4 py-2.5",children:[e.jsx("span",{className:"text-xs font-semibold uppercase tracking-widest text-app-text",children:"Notifications"}),e.jsxs("span",{className:"flex gap-3 text-xs",children:[a&&p>0&&e.jsx("button",{type:"button",onClick:a,className:"text-app-muted underline underline-offset-2 hover:text-app-text",children:"Mark all read"}),l&&t.length>0&&e.jsx("button",{type:"button",onClick:l,className:"text-app-muted underline underline-offset-2 hover:text-app-text",children:"Clear"})]})]}),t.length===0?e.jsx("p",{className:"m-0 px-4 py-8 text-center text-sm text-app-muted",children:n}):e.jsx("ul",{className:"m-0 flex-1 list-none overflow-y-auto p-0",children:t.map(h=>e.jsx("li",{className:"border-b border-app-border last:border-b-0",children:e.jsxs("button",{type:"button",onClick:()=>{h.read||s==null||s(h.id),r==null||r(h)},className:"flex w-full items-start gap-3 px-4 py-3 text-left transition hover:bg-app-bg",children:[e.jsx("span",{"aria-hidden":"true",className:`mt-1.5 h-2 w-2 shrink-0 ${h.read?"bg-transparent":"bg-red-500"}`}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:`block text-sm text-app-text ${h.read?"":"font-semibold"}`,children:h.title}),h.body&&e.jsx("span",{className:"block text-xs text-app-muted",children:h.body}),h.time&&e.jsx("span",{className:"mt-0.5 block text-[10px] uppercase tracking-widest text-app-muted",children:h.time})]}),!h.read&&e.jsx("span",{className:"sr-only",children:"Unread"})]})},h.id))})]})]})},ur=({as:t="h1",className:r="",children:s,...a})=>e.jsx(t,{className:`m-0 text-2xl font-bold tracking-tight text-app-text sm:text-3xl ${r}`,...a,children:s}),H=240,U=100,se=(t,r)=>[H/2+r*Math.sin(t),H/2-r*Math.cos(t)],be=(t,r,s)=>{if(r-t>=Math.PI*2-1e-6){const p=t+Math.PI;return`${be(t,p,s)} ${be(p,t+Math.PI*2-1e-4,s)}`}const a=r-t>Math.PI?1:0,[l,n]=se(t,U),[o,i]=se(r,U);if(!s)return`M${H/2},${H/2} L${l},${n} A${U},${U} 0 ${a} 1 ${o},${i} Z`;const[c,u]=se(r,s),[m,d]=se(t,s);return`M${l},${n} A${U},${U} 0 ${a} 1 ${o},${i} L${c},${u} A${s},${s} 0 ${a} 0 ${m},${d} Z`},xr=({data:t,donut:r=!1,center:s,label:a="Pie chart",className:l=""})=>{const n=t.reduce((c,u)=>c+u.value,0);let o=0;const i=t.filter(c=>c.value>0).map((c,u)=>{const m=o;return o+=c.value/n*Math.PI*2,{...c,start:m,end:o,color:oe(c,u)}});return e.jsxs("figure",{className:`m-0 ${l}`,children:[e.jsxs("svg",{role:"img","aria-label":a,viewBox:`0 0 ${H} ${H}`,className:"mx-auto block h-auto w-full max-w-xs",children:[i.map(c=>e.jsx("path",{d:be(c.start,c.end,r?U*.6:0),fill:c.color,stroke:"rgb(var(--color-app-card))",strokeWidth:"2",children:e.jsx("title",{children:`${c.label}: ${c.value} (${Math.round(c.value/n*100)}%)`})},c.label)),r&&s&&e.jsx("text",{x:H/2,y:H/2,textAnchor:"middle",dominantBaseline:"middle",fontSize:"20",fontWeight:"600",fill:"rgb(var(--color-app-text))",children:s})]}),e.jsx(ye,{items:i.map(c=>({name:c.label,color:c.color}))})]})},fr=({trigger:t,label:r,variant:s="secondary",align:a="start",placement:l,className:n="",children:o})=>{const[i,c]=f.useState(!1),u=f.useRef(null),m=f.useRef(null),d=f.useId();return G(i,[u,m],p=>{var h,g;c(!1),p==="escape"&&((g=(h=u.current)==null?void 0:h.querySelector("button"))==null||g.focus())}),e.jsxs("div",{ref:u,className:"relative inline-block",children:[e.jsx(q,{variant:s,"aria-label":r,"aria-haspopup":"dialog","aria-expanded":i,"aria-controls":i?d:void 0,onClick:()=>c(p=>!p),children:t}),e.jsx(Y,{open:i,anchorRef:u,panelRef:m,placement:l??`bottom-${a}`,id:d,role:"dialog","aria-label":r,className:`min-w-[12rem] max-w-[calc(100vw-1rem)] border border-app-border bg-app-card p-4 text-sm text-app-text shadow-xl ${n}`,children:o})]})},hr=({children:t,container:r})=>X.createPortal(t,r??document.body),mr=({value:t,label:r,showValue:s=!1,className:a=""})=>{const l=t===void 0,n=l?0:Math.min(100,Math.max(0,t));return e.jsxs("div",{className:`flex flex-col gap-1 ${a}`,children:[(r||s&&!l)&&e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(W,{children:r}),s&&!l&&e.jsxs("span",{className:"text-xs font-semibold uppercase tracking-widest text-app-text",children:[Math.round(n),"%"]})]}),e.jsx("div",{role:"progressbar","aria-label":r,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":l?void 0:Math.round(n),className:"relative h-1.5 w-full overflow-hidden bg-app-border",children:l?e.jsx("div",{className:"absolute inset-y-0 w-2/5 animate-indeterminate bg-app-strong"}):e.jsx("div",{className:"h-full bg-app-strong transition-all",style:{width:`${n}%`}})})]})},br=`
2
2
  @keyframes rs-blink {
3
3
  0%,45% { fill:rgb(var(--color-app-card)); filter:drop-shadow(0 0 0 transparent); }
4
4
  50%,55% { fill:#00e676; filter:drop-shadow(0 0 6px #00e676); }
@@ -31,16 +31,16 @@
31
31
  .rs-fan-hub { fill:rgb(var(--color-app-soft)); }
32
32
  .rs-fan-ring { fill:none; stroke:rgb(var(--color-app-border)); stroke-width:1.5; }
33
33
  .rs-glow { animation: rs-glow-pulse 3s infinite ease-in-out; }
34
- `,Jt=720,es=540,ts=()=>{const t=x.useRef(null),s=x.useRef(null);return x.useEffect(()=>{if(!document.getElementById("rack-server-styles")){const i=document.createElement("style");i.id="rack-server-styles",i.textContent=Xt,document.head.appendChild(i)}let r=0,a=0,n,l=null;const o=performance.now(),c=i=>{var h,b;const u=l===null?0:(i-l)/1e3;l=i;const f=(i-o)/1e3,d=Math.min(f/3,1),m=Math.min(f/5,1);r=(r+d*d*d*Jt*u)%360,a=(a+m*m*m*es*u)%360,(h=t.current)==null||h.setAttribute("transform",`rotate(${r} 222 100)`),(b=s.current)==null||b.setAttribute("transform",`rotate(${a} 222 163)`),n=requestAnimationFrame(c)};return n=requestAnimationFrame(c),()=>{cancelAnimationFrame(n)}},[]),e.jsxs("svg",{width:"300",height:"300",viewBox:"0 0 300 300",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"rs-sg",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"rgb(var(--color-app-strong))",stopOpacity:"0"}),e.jsx("stop",{offset:"50%",stopColor:"rgb(var(--color-app-strong))",stopOpacity:"0.3"}),e.jsx("stop",{offset:"100%",stopColor:"rgb(var(--color-app-strong))",stopOpacity:"0"})]}),e.jsxs("linearGradient",{id:"rs-pg",x1:"0",y1:"0",x2:"1",y2:"0",children:[e.jsx("stop",{offset:"0%",stopColor:"#00e676"}),e.jsx("stop",{offset:"100%",stopColor:"rgb(var(--color-app-strong))"})]}),e.jsxs("radialGradient",{id:"rs-ag",cx:"50%",cy:"50%",r:"50%",children:[e.jsx("stop",{offset:"0%",stopColor:"rgb(var(--color-app-strong))",stopOpacity:"0.15"}),e.jsx("stop",{offset:"100%",stopColor:"rgb(var(--color-app-strong))",stopOpacity:"0"})]}),e.jsx("clipPath",{id:"rs-rc",children:e.jsx("rect",{x:"30",y:"55",width:"240",height:"190"})})]}),e.jsx("ellipse",{cx:"150",cy:"150",rx:"130",ry:"110",fill:"url(#rs-ag)",className:"rs-glow"}),e.jsx("rect",{x:"30",y:"50",width:"240",height:"190",className:"rs-chassis"}),e.jsx("circle",{cx:"40",cy:"60",r:"3",fill:"rgb(var(--color-app-bg))",stroke:"rgb(var(--color-app-border))",strokeWidth:"1"}),e.jsx("circle",{cx:"260",cy:"60",r:"3",fill:"rgb(var(--color-app-bg))",stroke:"rgb(var(--color-app-border))",strokeWidth:"1"}),e.jsx("circle",{cx:"40",cy:"230",r:"3",fill:"rgb(var(--color-app-bg))",stroke:"rgb(var(--color-app-border))",strokeWidth:"1"}),e.jsx("circle",{cx:"260",cy:"230",r:"3",fill:"rgb(var(--color-app-bg))",stroke:"rgb(var(--color-app-border))",strokeWidth:"1"}),e.jsx("rect",{x:"42",y:"72",width:"216",height:"56",className:"rs-rack"}),e.jsx("rect",{x:"52",y:"79",width:"130",height:"8",className:"rs-slotline"}),e.jsx("rect",{x:"52",y:"91",width:"130",height:"8",className:"rs-slotline"}),e.jsx("rect",{x:"52",y:"103",width:"130",height:"8",className:"rs-slotline"}),e.jsx("rect",{x:"52",y:"115",width:"80",height:"8",className:"rs-slotline"}),e.jsx("circle",{cx:"60",cy:"83",r:"2.5",className:"rs-led-g rs-lg1"}),e.jsx("circle",{cx:"60",cy:"95",r:"2.5",className:"rs-led-g rs-lg2"}),e.jsx("circle",{cx:"60",cy:"107",r:"2.5",className:"rs-led-b rs-lb1"}),e.jsx("circle",{cx:"60",cy:"119",r:"2.5",className:"rs-led-g rs-lg3"}),e.jsx("circle",{cx:"222",cy:"100",r:"20",fill:"rgb(var(--color-app-bg))"}),e.jsxs("g",{ref:t,children:[e.jsx("path",{d:"M222 80 Q230 100 222 120 Q214 100 222 80",className:"rs-fan-blade"}),e.jsx("path",{d:"M202 100 Q222 108 242 100 Q222 92 202 100",className:"rs-fan-blade"}),e.jsx("circle",{cx:"222",cy:"100",r:"2.5",className:"rs-fan-hub"})]}),e.jsx("circle",{cx:"222",cy:"100",r:"20",className:"rs-fan-ring"}),e.jsx("rect",{x:"42",y:"136",width:"216",height:"56",className:"rs-rack"}),e.jsx("rect",{x:"52",y:"143",width:"130",height:"8",className:"rs-slotline"}),e.jsx("rect",{x:"52",y:"155",width:"130",height:"8",className:"rs-slotline"}),e.jsx("rect",{x:"52",y:"167",width:"130",height:"8",className:"rs-slotline"}),e.jsx("rect",{x:"52",y:"179",width:"80",height:"8",className:"rs-slotline"}),e.jsx("circle",{cx:"60",cy:"147",r:"2.5",className:"rs-led-g rs-lg2"}),e.jsx("circle",{cx:"60",cy:"159",r:"2.5",className:"rs-led-b rs-lb2"}),e.jsx("circle",{cx:"60",cy:"171",r:"2.5",className:"rs-led-g rs-lg4"}),e.jsx("circle",{cx:"60",cy:"183",r:"2.5",className:"rs-led-g rs-lg1"}),e.jsx("circle",{cx:"222",cy:"163",r:"20",fill:"rgb(var(--color-app-bg))"}),e.jsxs("g",{ref:s,children:[e.jsx("path",{d:"M222 143 Q230 163 222 183 Q214 163 222 143",className:"rs-fan-blade"}),e.jsx("path",{d:"M202 163 Q222 171 242 163 Q222 155 202 163",className:"rs-fan-blade"}),e.jsx("circle",{cx:"222",cy:"163",r:"2.5",className:"rs-fan-hub"})]}),e.jsx("circle",{cx:"222",cy:"163",r:"20",className:"rs-fan-ring"})]})},Ke=({label:t,className:s="",disabled:r=!1,...a})=>{const n=x.useId();return e.jsxs("label",{htmlFor:n,className:`inline-flex items-center gap-2 text-sm text-app-text ${r?"cursor-not-allowed opacity-50":"cursor-pointer"} ${s}`,children:[e.jsx("input",{id:n,type:"radio",disabled:r,className:"h-4 w-4 cursor-[inherit] accent-[rgb(var(--color-app-strong))]",...a}),t]})},ss=({label:t,name:s,value:r,onChange:a,options:n,direction:l="column"})=>{const o=x.useId();return e.jsxs("fieldset",{className:"flex flex-col gap-2 border-0 p-0",children:[t&&e.jsx("legend",{className:"mb-1 text-xs font-semibold uppercase tracking-widest text-app-muted",children:t}),e.jsx("div",{className:`flex gap-3 ${l==="row"?"flex-row flex-wrap":"flex-col"}`,children:n.map(c=>e.jsx(Ke,{name:s??o,value:c.value,label:c.label,disabled:c.disabled,checked:r===c.value,onChange:()=>a==null?void 0:a(c.value)},c.value))})]})},rs=({label:t,value:s,onChange:r,options:a,placeholder:n,error:l,className:o="",...c})=>{const i=x.useId(),u=`${i}-error`;return e.jsxs("div",{className:"flex flex-col gap-1",children:[t&&e.jsx("label",{htmlFor:i,className:"text-xs font-semibold uppercase tracking-widest text-app-muted",children:t}),e.jsxs("select",{id:i,"aria-invalid":!!l,"aria-describedby":l?u:void 0,className:`${G(!!l)} ${o}`,value:s,onChange:f=>r==null?void 0:r(f.target.value),...c,children:[n&&e.jsx("option",{value:"",disabled:!0,children:n}),a.map(f=>e.jsx("option",{value:f.value,disabled:f.disabled,children:f.label},f.value))]}),l&&e.jsx("span",{id:u,className:"text-xs text-red-700 dark:text-red-400",children:l})]})},as=({items:t,activeKey:s,onSelect:r,header:a,footer:n,collapsed:l=!1,linkComponent:o="a",linkProp:c="href",label:i="Sidebar",className:u=""})=>{const f=(d,m=0)=>{var y;const h=d.key===s,b=e.jsxs(e.Fragment,{children:[d.icon&&e.jsx("span",{className:"shrink-0 [&>svg]:h-4 [&>svg]:w-4",children:d.icon}),!l&&e.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:d.label}),!l&&d.badge!=null&&e.jsx("span",{className:"bg-app-strong px-1.5 text-[10px] font-semibold text-app-bg",children:d.badge})]}),p=`flex w-full items-center gap-3 py-2 text-xs font-semibold uppercase tracking-widest transition ${h?"bg-app-strong text-app-bg":"text-app-muted hover:bg-app-bg hover:text-app-text"} ${l?"justify-center px-2":"pr-3"}`,g=l?void 0:{paddingLeft:`${.75+m*1}rem`},v=()=>{var C;(C=d.onClick)==null||C.call(d),r==null||r(d.key)},M=!!((y=d.children)!=null&&y.length);return e.jsxs("li",{children:[d.href&&!M?e.jsx(o,{[c]:d.href,"aria-current":h?"page":void 0,"aria-label":l?d.label:void 0,title:l?d.label:void 0,onClick:v,className:p,style:g,children:b}):e.jsx("button",{type:"button","aria-current":h?"page":void 0,"aria-label":l?d.label:void 0,title:l?d.label:void 0,onClick:v,className:p,style:g,children:b}),M&&!l&&e.jsx("ul",{className:"m-0 list-none p-0",children:d.children.map(C=>f(C,m+1))})]},d.key)};return e.jsxs("nav",{"aria-label":i,className:`flex h-full flex-col border-r border-app-border bg-app-card ${l?"w-14":"w-60"} ${u}`,children:[a&&e.jsx("div",{className:"shrink-0 border-b border-app-border px-3 py-3",children:a}),e.jsx("ul",{className:"m-0 flex-1 list-none overflow-y-auto p-0 py-2",children:t.map(d=>f(d))}),n&&e.jsx("div",{className:"shrink-0 border-t border-app-border px-3 py-3",children:n})]})},ns=({lines:t,circle:s=!1,className:r="h-4 w-full"})=>t?e.jsx("div",{"aria-hidden":"true",className:"flex flex-col gap-2",children:Array.from({length:t},(a,n)=>e.jsx("div",{className:`h-3 animate-pulse bg-app-border ${n===t-1?"w-2/3":"w-full"}`},n))}):e.jsx("div",{"aria-hidden":"true",className:`animate-pulse bg-app-border ${s?"rounded-full":""} ${r}`}),ls=({label:t,value:s,onChange:r,min:a=0,max:n=100,step:l=1,showValue:o=!0,className:c="",...i})=>{const u=x.useId();return e.jsxs("div",{className:`flex flex-col gap-1 ${c}`,children:[(t||o)&&e.jsxs("div",{className:"flex items-center justify-between text-xs font-semibold uppercase tracking-widest text-app-muted",children:[e.jsx("label",{htmlFor:u,children:t}),o&&e.jsx("span",{className:"text-app-text",children:s})]}),e.jsx("input",{id:u,type:"range",min:a,max:n,step:l,value:s,onChange:f=>r==null?void 0:r(Number(f.target.value)),className:"w-full cursor-pointer accent-[rgb(var(--color-app-strong))]",...i})]})},os=(t,s,r)=>{const a=[...t],[n]=a.splice(s,1);return a.splice(r,0,n),a},is=({items:t,onChange:s,renderItem:r,label:a="Sortable list",className:n=""})=>{const[l,o]=x.useState(null),[c,i]=x.useState(null),[u,f]=x.useState(""),d=(m,h)=>{m===h||h<0||h>=t.length||s(os(t,m,h))};return e.jsxs(e.Fragment,{children:[e.jsx("ul",{"aria-label":a,className:`m-0 list-none border border-app-border bg-app-card p-0 ${n}`,children:t.map((m,h)=>e.jsxs("li",{draggable:!0,onDragStart:b=>{o(m.key),b.dataTransfer.effectAllowed="move",b.dataTransfer.setData("text/plain",String(m.key))},onDragOver:b=>{b.preventDefault(),m.key!==c&&i(m.key)},onDrop:b=>{b.preventDefault();const p=t.findIndex(g=>g.key===l);d(p,h),o(null),i(null)},onDragEnd:()=>{o(null),i(null)},className:`flex items-center gap-3 border-b border-app-border px-3 py-2.5 last:border-b-0 ${l===m.key?"opacity-40":""} ${c===m.key&&l!==m.key?"bg-app-soft/20":""}`,children:[e.jsx("button",{type:"button","aria-label":`Reorder ${m.label??m.key}. Use up and down arrow keys.`,onKeyDown:b=>{const p=b.key==="ArrowUp"?h-1:b.key==="ArrowDown"?h+1:null;if(p===null||p<0||p>=t.length)return;b.preventDefault();const g=b.currentTarget;d(h,p),f(`${m.label??m.key} moved to position ${p+1} of ${t.length}`),requestAnimationFrame(()=>g.focus())},className:"cursor-grab select-none px-1 text-app-muted transition hover:text-app-text active:cursor-grabbing",children:e.jsx("span",{"aria-hidden":"true",children:"⋮⋮"})}),e.jsx("div",{className:"min-w-0 flex-1 text-sm text-app-text",children:r(m,h)})]},m.key))}),e.jsx("div",{role:"status","aria-live":"polite",className:"sr-only",children:u})]})},cs=({direction:t="column",gap:s=4,...r})=>e.jsx(ze,{direction:t,gap:s,...r}),qe=({className:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:t??"w-4 h-4 flex-shrink-0 text-emerald-600 dark:text-emerald-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),ds=({steps:t,current:s=0,className:r=""})=>e.jsx("ol",{className:`m-0 flex list-none flex-col gap-4 p-0 sm:flex-row sm:gap-0 ${r}`,children:t.map((a,n)=>{const l=n<s,o=n===s;return e.jsxs("li",{"aria-current":o?"step":void 0,className:"flex flex-1 items-start gap-3 sm:flex-col sm:gap-2",children:[e.jsxs("div",{className:"flex items-center sm:w-full",children:[e.jsx("span",{className:`flex h-7 w-7 shrink-0 items-center justify-center border text-xs font-semibold ${l?"border-app-strong bg-app-strong text-app-bg":o?"border-app-strong text-app-text":"border-app-border text-app-muted"}`,children:l?e.jsx(qe,{className:"h-4 w-4"}):n+1}),n<t.length-1&&e.jsx("span",{"aria-hidden":"true",className:`ml-2 hidden h-px flex-1 sm:block ${l?"bg-app-strong":"bg-app-border"}`})]}),e.jsxs("div",{className:"pr-2",children:[e.jsx("div",{className:`text-xs font-semibold uppercase tracking-widest ${o||l?"text-app-text":"text-app-muted"}`,children:a.label}),a.description&&e.jsx("div",{className:"mt-0.5 text-xs text-app-muted",children:a.description})]})]},a.label)})}),ps=({checked:t,onChange:s,label:r,disabled:a=!1,className:n="",...l})=>e.jsxs("button",{type:"button",role:"switch","aria-checked":t,disabled:a,onClick:()=>s==null?void 0:s(!t),className:`inline-flex items-center gap-2 text-sm text-app-text disabled:cursor-not-allowed disabled:opacity-50 ${n}`,...l,children:[e.jsx("span",{"aria-hidden":"true",className:`relative inline-block h-5 w-9 shrink-0 border transition ${t?"border-app-strong bg-app-strong":"border-app-border bg-app-bg"}`,children:e.jsx("span",{className:`absolute top-0.5 h-3.5 w-3.5 transition-all ${t?"left-[1.1rem] bg-app-bg":"left-0.5 bg-app-muted"}`})}),r]}),Ne={left:"text-left",center:"text-center",right:"text-right"},xs=({columns:t,rows:s,rowKey:r="id",empty:a="No data",caption:n,className:l=""})=>e.jsx("div",{className:`overflow-x-auto border border-app-border ${l}`,children:e.jsxs("table",{className:"w-full border-collapse bg-app-card text-sm text-app-text",children:[n&&e.jsx("caption",{className:"sr-only",children:n}),e.jsx("thead",{children:e.jsx("tr",{className:"border-b border-app-border bg-app-bg",children:t.map(o=>e.jsx("th",{scope:"col",className:`px-4 py-2.5 text-xs font-semibold uppercase tracking-widest text-app-muted ${Ne[o.align??"left"]}`,children:o.header},o.key))})}),e.jsx("tbody",{children:s.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,className:"px-4 py-6 text-center text-app-muted",children:a})}):s.map(o=>e.jsx("tr",{className:"border-b border-app-border last:border-b-0 hover:bg-app-bg",children:t.map(c=>e.jsx("td",{className:`px-4 py-2.5 ${Ne[c.align??"left"]}`,children:c.render?c.render(o):o[c.key]},c.key))},o[r]))})]})}),us=({items:t,value:s,defaultValue:r,onChange:a,className:n=""})=>{var b;const l=x.useId(),[o,c]=x.useState(r??((b=t[0])==null?void 0:b.key)),i=s??o,u=x.useRef({}),f=p=>{s===void 0&&c(p),a==null||a(p)},d=t.filter(p=>!p.disabled),m=p=>{var M;const g=d.findIndex(y=>y.key===i);let v;p.key==="ArrowRight"?v=d[(g+1)%d.length]:p.key==="ArrowLeft"?v=d[(g-1+d.length)%d.length]:p.key==="Home"?v=d[0]:p.key==="End"&&(v=d[d.length-1]),v&&(p.preventDefault(),f(v.key),(M=u.current[v.key])==null||M.focus())},h=t.find(p=>p.key===i);return e.jsxs("div",{className:n,children:[e.jsx("div",{role:"tablist",onKeyDown:m,className:"flex overflow-x-auto overflow-y-hidden shadow-[inset_0_-1px_0_rgb(var(--color-app-border))]",children:t.map(p=>{const g=p.key===i;return e.jsx("button",{ref:v=>u.current[p.key]=v,id:`${l}-tab-${p.key}`,type:"button",role:"tab","aria-selected":g,"aria-controls":`${l}-panel-${p.key}`,tabIndex:g?0:-1,disabled:p.disabled,onClick:()=>f(p.key),className:`whitespace-nowrap border-b-2 px-4 py-2 text-xs font-semibold uppercase tracking-widest transition disabled:cursor-not-allowed disabled:opacity-50 ${g?"border-app-strong text-app-text":"border-transparent text-app-muted hover:text-app-text"}`,children:p.label},p.key)})}),(h==null?void 0:h.content)!==void 0&&e.jsx("div",{role:"tabpanel",id:`${l}-panel-${h.key}`,"aria-labelledby":`${l}-tab-${h.key}`,tabIndex:0,className:"pt-4",children:h.content})]})},fs={default:"bg-app-strong",success:"bg-emerald-500",warning:"bg-amber-400",danger:"bg-red-500"},ms=({items:t,className:s=""})=>e.jsx("ol",{className:`m-0 list-none p-0 ${s}`,children:t.map((r,a)=>e.jsxs("li",{className:"relative flex gap-4 pb-6 last:pb-0",children:[a<t.length-1&&e.jsx("span",{"aria-hidden":"true",className:"absolute left-[0.3rem] top-4 bottom-0 w-px bg-app-border"}),e.jsx("span",{"aria-hidden":"true",className:`relative mt-1.5 h-2.5 w-2.5 shrink-0 ${fs[r.tone??"default"]}`}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-x-3",children:[e.jsx("span",{className:"text-sm font-semibold text-app-text",children:r.title}),r.time&&e.jsx("time",{className:"text-xs text-app-muted",children:r.time})]}),r.description&&e.jsx("p",{className:"m-0 mt-0.5 text-sm text-app-muted",children:r.description})]})]},r.key))}),hs=({label:t,value:s,onChange:r,step:a=900,min:n,max:l,error:o,...c})=>{const i=x.useId(),u=`${i}-error`;return e.jsxs("div",{className:"flex flex-col gap-1",children:[t&&e.jsx("label",{htmlFor:i,className:"text-xs font-semibold uppercase tracking-widest text-app-muted",children:t}),e.jsx("input",{id:i,type:"time",step:a,min:n,max:l,value:s,"aria-invalid":!!o,"aria-describedby":o?u:void 0,onChange:f=>r==null?void 0:r(f.target.value),className:G(!!o),...c}),o&&e.jsx("span",{id:u,className:"text-xs text-red-700 dark:text-red-400",children:o})]})},bs=t=>{const{toast:s}=t;return e.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"fixed bottom-5 right-5 z-[var(--xd-z-toast,90)]",children:s&&e.jsxs("div",{className:`max-w-sm px-4 py-3 text-sm font-semibold shadow-xl ${s.type==="error"?"bg-red-700 text-white":"bg-emerald-700 text-white"}`,children:[s.msg,s.link&&e.jsxs(e.Fragment,{children:[" ",e.jsx("a",{href:s.link.href,target:"_blank",rel:"noreferrer",className:"underline underline-offset-2",children:s.link.label})]})]})})},_e=(t,s,r=0,a=null,n=[])=>(t.forEach(l=>{var o;n.push({node:l,depth:r,parent:a}),(o=l.children)!=null&&o.length&&s.includes(l.key)&&_e(l.children,s,r+1,l.key,n)}),n),gs=({nodes:t,selected:s,onSelect:r,defaultExpanded:a=[],expanded:n,onExpandedChange:l,label:o="Tree",className:c=""})=>{var C;const[i,u]=x.useState(a),f=n??i,[d,m]=x.useState(null),h=j=>{n===void 0&&u(j),l==null||l(j)},b=j=>h(f.includes(j)?f.filter($=>$!==j):[...f,j]),p=_e(t,f),g=p.some(j=>j.node.key===d)?d:(C=p[0])==null?void 0:C.node.key,v=j=>{m(j),requestAnimationFrame(()=>{var $;return($=document.getElementById(`${M}-${j}`))==null?void 0:$.focus()})},M=`tree-${o.replace(/\W+/g,"-")}`,y=(j,$)=>{var I;const{node:N,parent:w}=p[$],L=!!((I=N.children)!=null&&I.length),S=f.includes(N.key);switch(j.key){case"ArrowDown":p[$+1]&&v(p[$+1].node.key);break;case"ArrowUp":p[$-1]&&v(p[$-1].node.key);break;case"ArrowRight":L&&!S?b(N.key):L&&v(N.children[0].key);break;case"ArrowLeft":L&&S?b(N.key):w!==null&&v(w);break;case"Home":v(p[0].node.key);break;case"End":v(p[p.length-1].node.key);break;case"Enter":case" ":r==null||r(N.key);break;default:return}j.preventDefault()};return e.jsx("ul",{role:"tree","aria-label":o,className:`m-0 list-none p-0 text-sm text-app-text ${c}`,children:p.map(({node:j,depth:$},N)=>{var I;const w=!!((I=j.children)!=null&&I.length),L=f.includes(j.key),S=s===j.key;return e.jsx("li",{id:`${M}-${j.key}`,role:"treeitem","aria-level":$+1,"aria-expanded":w?L:void 0,"aria-selected":S,tabIndex:j.key===g?0:-1,onKeyDown:R=>y(R,N),onFocus:()=>m(j.key),className:"list-none outline-none",children:e.jsxs("div",{style:{paddingLeft:`${$*1.25+.5}rem`},className:`flex cursor-pointer items-center gap-1 py-1.5 pr-3 transition hover:bg-app-bg ${S?"bg-app-soft/20 font-semibold":""}`,onClick:()=>{r==null||r(j.key),w&&b(j.key)},children:[e.jsx("span",{"aria-hidden":"true",className:"w-4 text-center text-xs text-app-muted",children:w?L?"▾":"▸":""}),j.label]})},j.key)})})},$e=t=>{if(!Number.isFinite(t))return"0:00";const s=Math.floor(t/60),r=Math.floor(t%60);return`${s}:${String(r).padStart(2,"0")}`},se="px-2 py-1 text-xs font-semibold uppercase tracking-widest text-app-text transition hover:bg-app-bg focus-visible:outline-offset-[-2px]",js=({src:t,poster:s,title:r="Video",ratio:a="video",className:n="",children:l,...o})=>{const c=x.useRef(null),i=x.useRef(null),[u,f]=x.useState(!1),[d,m]=x.useState(0),[h,b]=x.useState(0),[p,g]=x.useState(!1),[v,M]=x.useState(!1);x.useEffect(()=>{const j=()=>M(document.fullscreenElement===i.current);return document.addEventListener("fullscreenchange",j),()=>document.removeEventListener("fullscreenchange",j)},[]);const y=()=>{const j=c.current;j.paused?j.play().catch(()=>{}):j.pause()},C=()=>{var j,$;document.fullscreenElement?document.exitFullscreen():($=(j=i.current)==null?void 0:j.requestFullscreen)==null||$.call(j)};return e.jsxs("div",{ref:i,className:`flex flex-col border border-app-border bg-app-card ${n}`,children:[e.jsx("video",{ref:c,src:t,poster:s,title:r,muted:p,playsInline:!0,preload:"metadata",className:`block w-full bg-black ${a==="video"?"aspect-video":""} ${v?"flex-1":""}`,onClick:y,onPlay:()=>f(!0),onPause:()=>f(!1),onTimeUpdate:j=>m(j.currentTarget.currentTime),onLoadedMetadata:j=>b(j.currentTarget.duration),...o,children:l}),e.jsxs("div",{role:"group","aria-label":`${r} controls`,className:"flex items-center gap-1 border-t border-app-border px-1 py-1",children:[e.jsx("button",{type:"button",className:se,onClick:y,"aria-label":u?"Pause":"Play",children:u?"Pause":"Play"}),e.jsx("span",{className:"w-10 text-center text-xs tabular-nums text-app-muted",children:$e(d)}),e.jsx("input",{type:"range","aria-label":"Seek",min:0,max:h||0,step:"any",value:Math.min(d,h||0),onChange:j=>{c.current.currentTime=Number(j.target.value),m(Number(j.target.value))},className:"min-w-0 flex-1 cursor-pointer accent-[rgb(var(--color-app-strong))]"}),e.jsx("span",{className:"w-10 text-center text-xs tabular-nums text-app-muted",children:$e(h)}),e.jsx("button",{type:"button",className:se,"aria-pressed":p,onClick:()=>g(j=>!j),children:p?"Unmute":"Mute"}),e.jsx("button",{type:"button",className:se,onClick:C,children:v?"Exit":"Full"})]})]})},vs=({items:t,itemHeight:s,height:r=320,overscan:a=4,renderItem:n,getKey:l,label:o="List",className:c=""})=>{const[i,u]=x.useState(0),f=Math.max(0,Math.floor(i/s)-a),d=Math.min(t.length,Math.ceil((i+r)/s)+a);return e.jsx("div",{role:"list","aria-label":o,"aria-rowcount":t.length,tabIndex:0,onScroll:m=>u(m.currentTarget.scrollTop),style:{height:r},className:`overflow-y-auto border border-app-border bg-app-card ${c}`,children:e.jsx("div",{style:{height:t.length*s,position:"relative"},children:t.slice(f,d).map((m,h)=>{const b=f+h;return e.jsx("div",{role:"listitem","aria-posinset":b+1,"aria-setsize":t.length,style:{position:"absolute",top:b*s,height:s,left:0,right:0},className:"flex items-center border-b border-app-border px-4 text-sm text-app-text",children:n(m,b)},l?l(m,b):b)})})})},ys=({className:t})=>e.jsxs("svg",{"aria-hidden":"true",focusable:"false",className:t??"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 12H5"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 5l-7 7 7 7"})]}),ws=({className:t})=>e.jsxs("svg",{"aria-hidden":"true",focusable:"false",className:t??"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),ks=({className:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:t??"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})}),Ns=({className:t})=>e.jsxs("svg",{"aria-hidden":"true",focusable:"false",className:t??"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),e.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),e.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),e.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]}),$s=({className:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:t??"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"})}),Ms=({className:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:t??"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"})}),Cs=({className:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:t??"h-5 w-5 text-app-soft",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 3.487a2.25 2.25 0 113.182 3.182L8.25 18.463 4 20l1.537-4.25L16.862 3.487z"})}),Es=({className:t})=>e.jsxs("svg",{"aria-hidden":"true",focusable:"false",className:t??"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-2.63-6.36"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 3v6h-6"})]}),Ls=({className:t})=>e.jsxs("svg",{"aria-hidden":"true",focusable:"false",className:t??"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 010 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 010-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),Ss=({className:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:t??"h-7 w-7 text-app-soft",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"})}),Is=(t,s="")=>{x.useEffect(()=>{document.title=[t,s].filter(Boolean).join(" · ")},[t,s])},Ts=()=>typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),Ds=(t,s)=>{const r=t.toLowerCase().split("+"),a=r.pop(),n=new Set(r),l=Ts(),o=n.has("ctrl")||n.has("mod")&&!l,c=n.has("meta")||n.has("mod")&&l;return s.key.toLowerCase()===a&&s.ctrlKey===o&&s.metaKey===c&&s.altKey===n.has("alt")&&s.shiftKey===n.has("shift")},As=t=>t instanceof HTMLElement&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)),Fs=(t,s=!0)=>{const r=x.useRef(t);x.useEffect(()=>{r.current=t}),x.useEffect(()=>{if(!s)return;const a=n=>{for(const[l,o]of Object.entries(r.current))if(!(!Ds(l,n)||!/\b(mod|ctrl|alt|meta)\+/i.test(l)&&As(n.target))){n.preventDefault(),o(n);return}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[s])},Rs=t=>{x.useEffect(()=>{if(!t)return;const s=r=>{r.preventDefault(),r.returnValue=""};return window.addEventListener("beforeunload",s),()=>window.removeEventListener("beforeunload",s)},[t])},Ps=(t=3e3)=>{const[s,r]=x.useState(null),a=x.useRef(null);x.useEffect(()=>()=>clearTimeout(a.current),[]);const n=x.useCallback((l,o="success",{link:c,duration:i=t}={})=>{clearTimeout(a.current),r({msg:l,type:o,link:c}),a.current=setTimeout(()=>r(null),i)},[t]);return{toast:s,showToast:n}},Ge=(t,s="")=>{const r=Y[t],a=`
34
+ `,gr=720,jr=540,vr=()=>{const t=f.useRef(null),r=f.useRef(null);return f.useEffect(()=>{if(!document.getElementById("rack-server-styles")){const c=document.createElement("style");c.id="rack-server-styles",c.textContent=br,document.head.appendChild(c)}let s=0,a=0,l,n=null;const o=performance.now(),i=c=>{var h,g;const u=n===null?0:(c-n)/1e3;n=c;const m=(c-o)/1e3,d=Math.min(m/3,1),p=Math.min(m/5,1);s=(s+d*d*d*gr*u)%360,a=(a+p*p*p*jr*u)%360,(h=t.current)==null||h.setAttribute("transform",`rotate(${s} 222 100)`),(g=r.current)==null||g.setAttribute("transform",`rotate(${a} 222 163)`),l=requestAnimationFrame(i)};return l=requestAnimationFrame(i),()=>{cancelAnimationFrame(l)}},[]),e.jsxs("svg",{width:"300",height:"300",viewBox:"0 0 300 300",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",focusable:"false",children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"rs-sg",x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"rgb(var(--color-app-strong))",stopOpacity:"0"}),e.jsx("stop",{offset:"50%",stopColor:"rgb(var(--color-app-strong))",stopOpacity:"0.3"}),e.jsx("stop",{offset:"100%",stopColor:"rgb(var(--color-app-strong))",stopOpacity:"0"})]}),e.jsxs("linearGradient",{id:"rs-pg",x1:"0",y1:"0",x2:"1",y2:"0",children:[e.jsx("stop",{offset:"0%",stopColor:"#00e676"}),e.jsx("stop",{offset:"100%",stopColor:"rgb(var(--color-app-strong))"})]}),e.jsxs("radialGradient",{id:"rs-ag",cx:"50%",cy:"50%",r:"50%",children:[e.jsx("stop",{offset:"0%",stopColor:"rgb(var(--color-app-strong))",stopOpacity:"0.15"}),e.jsx("stop",{offset:"100%",stopColor:"rgb(var(--color-app-strong))",stopOpacity:"0"})]}),e.jsx("clipPath",{id:"rs-rc",children:e.jsx("rect",{x:"30",y:"55",width:"240",height:"190"})})]}),e.jsx("ellipse",{cx:"150",cy:"150",rx:"130",ry:"110",fill:"url(#rs-ag)",className:"rs-glow"}),e.jsx("rect",{x:"30",y:"50",width:"240",height:"190",className:"rs-chassis"}),e.jsx("circle",{cx:"40",cy:"60",r:"3",fill:"rgb(var(--color-app-bg))",stroke:"rgb(var(--color-app-border))",strokeWidth:"1"}),e.jsx("circle",{cx:"260",cy:"60",r:"3",fill:"rgb(var(--color-app-bg))",stroke:"rgb(var(--color-app-border))",strokeWidth:"1"}),e.jsx("circle",{cx:"40",cy:"230",r:"3",fill:"rgb(var(--color-app-bg))",stroke:"rgb(var(--color-app-border))",strokeWidth:"1"}),e.jsx("circle",{cx:"260",cy:"230",r:"3",fill:"rgb(var(--color-app-bg))",stroke:"rgb(var(--color-app-border))",strokeWidth:"1"}),e.jsx("rect",{x:"42",y:"72",width:"216",height:"56",className:"rs-rack"}),e.jsx("rect",{x:"52",y:"79",width:"130",height:"8",className:"rs-slotline"}),e.jsx("rect",{x:"52",y:"91",width:"130",height:"8",className:"rs-slotline"}),e.jsx("rect",{x:"52",y:"103",width:"130",height:"8",className:"rs-slotline"}),e.jsx("rect",{x:"52",y:"115",width:"80",height:"8",className:"rs-slotline"}),e.jsx("circle",{cx:"60",cy:"83",r:"2.5",className:"rs-led-g rs-lg1"}),e.jsx("circle",{cx:"60",cy:"95",r:"2.5",className:"rs-led-g rs-lg2"}),e.jsx("circle",{cx:"60",cy:"107",r:"2.5",className:"rs-led-b rs-lb1"}),e.jsx("circle",{cx:"60",cy:"119",r:"2.5",className:"rs-led-g rs-lg3"}),e.jsx("circle",{cx:"222",cy:"100",r:"20",fill:"rgb(var(--color-app-bg))"}),e.jsxs("g",{ref:t,children:[e.jsx("path",{d:"M222 80 Q230 100 222 120 Q214 100 222 80",className:"rs-fan-blade"}),e.jsx("path",{d:"M202 100 Q222 108 242 100 Q222 92 202 100",className:"rs-fan-blade"}),e.jsx("circle",{cx:"222",cy:"100",r:"2.5",className:"rs-fan-hub"})]}),e.jsx("circle",{cx:"222",cy:"100",r:"20",className:"rs-fan-ring"}),e.jsx("rect",{x:"42",y:"136",width:"216",height:"56",className:"rs-rack"}),e.jsx("rect",{x:"52",y:"143",width:"130",height:"8",className:"rs-slotline"}),e.jsx("rect",{x:"52",y:"155",width:"130",height:"8",className:"rs-slotline"}),e.jsx("rect",{x:"52",y:"167",width:"130",height:"8",className:"rs-slotline"}),e.jsx("rect",{x:"52",y:"179",width:"80",height:"8",className:"rs-slotline"}),e.jsx("circle",{cx:"60",cy:"147",r:"2.5",className:"rs-led-g rs-lg2"}),e.jsx("circle",{cx:"60",cy:"159",r:"2.5",className:"rs-led-b rs-lb2"}),e.jsx("circle",{cx:"60",cy:"171",r:"2.5",className:"rs-led-g rs-lg4"}),e.jsx("circle",{cx:"60",cy:"183",r:"2.5",className:"rs-led-g rs-lg1"}),e.jsx("circle",{cx:"222",cy:"163",r:"20",fill:"rgb(var(--color-app-bg))"}),e.jsxs("g",{ref:r,children:[e.jsx("path",{d:"M222 143 Q230 163 222 183 Q214 163 222 143",className:"rs-fan-blade"}),e.jsx("path",{d:"M202 163 Q222 171 242 163 Q222 155 202 163",className:"rs-fan-blade"}),e.jsx("circle",{cx:"222",cy:"163",r:"2.5",className:"rs-fan-hub"})]}),e.jsx("circle",{cx:"222",cy:"163",r:"20",className:"rs-fan-ring"})]})},et=({label:t,className:r="",disabled:s=!1,...a})=>{const l=f.useId();return e.jsxs("label",{htmlFor:l,className:`inline-flex min-h-8 items-center gap-2 text-sm text-app-text ${s?"cursor-not-allowed opacity-50":"cursor-pointer"} ${r}`,children:[e.jsx("input",{id:l,type:"radio",disabled:s,className:"h-4 w-4 cursor-[inherit] accent-[rgb(var(--color-app-strong))]",...a}),t]})},yr=({label:t,name:r,value:s,onChange:a,options:l,direction:n="column"})=>{const o=f.useId();return e.jsxs("fieldset",{className:"flex flex-col gap-2 border-0 p-0",children:[t&&e.jsx(W,{as:"legend",className:"mb-1",children:t}),e.jsx("div",{className:`flex gap-3 ${n==="row"?"flex-row flex-wrap":"flex-col"}`,children:l.map(i=>e.jsx(et,{name:r??o,value:i.value,label:i.label,disabled:i.disabled,checked:s===i.value,onChange:()=>a==null?void 0:a(i.value)},i.value))})]})},wr=({open:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`h-4 w-4 shrink-0 text-app-muted transition-transform ${t?"rotate-180":""}`,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 9l6 6 6-6"})}),kr=()=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"h-4 w-4 shrink-0",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),Nr=({label:t,value:r,onChange:s,options:a,placeholder:l,error:n,disabled:o=!1,name:i,className:c="",...u})=>{const m=f.useId(),d=`${m}-label`,p=`${m}-list`,h=`${m}-error`,g=f.useRef(null),x=f.useRef(null),b=f.useRef(null),j=f.useRef({text:"",timer:null}),[k,$]=f.useState(!1),[y,v]=f.useState(-1),S=a.findIndex(w=>w.value===r),C=a[S],M=a.map((w,N)=>w.disabled?-1:N).filter(w=>w>=0);G(k,[g,b],w=>{var N;$(!1),w==="escape"&&((N=x.current)==null||N.focus())}),f.useEffect(()=>{var w,N,I;k&&((I=(N=(w=b.current)==null?void 0:w.querySelector('[data-active="true"]'))==null?void 0:N.scrollIntoView)==null||I.call(N,{block:"nearest"}))},[k,y]);const E=()=>{o||(v(S>=0&&!a[S].disabled?S:M[0]??-1),$(!0))},D=w=>{var I;const N=a[w];!N||N.disabled||(s==null||s(N.value),$(!1),(I=x.current)==null||I.focus())},R=w=>{if(!M.length)return;const N=M.indexOf(y),I=M[Math.min(Math.max(N+w,0),M.length-1)];v(I)},F=w=>{const N=j.current;clearTimeout(N.timer),N.text+=w.toLowerCase(),N.timer=setTimeout(()=>N.text="",600);const I=M.indexOf(y),L=[...M.slice(I+1),...M.slice(0,I+1)].find(T=>String(a[T].label).toLowerCase().startsWith(N.text));L!==void 0&&(k?v(L):s==null||s(a[L].value))},B=w=>{if(o)return;const{key:N}=w;if(!k){["ArrowDown","ArrowUp","Enter"," "].includes(N)?(w.preventDefault(),E()):N.length===1&&!w.ctrlKey&&!w.metaKey&&!w.altKey&&F(N);return}if(N==="ArrowDown")R(1);else if(N==="ArrowUp")R(-1);else if(N==="Home")v(M[0]??-1);else if(N==="End")v(M[M.length-1]??-1);else if(N==="Enter"||N===" ")D(y);else if(N==="Tab")$(!1);else if(N.length===1&&!w.ctrlKey&&!w.metaKey&&!w.altKey)F(N);else return;N!=="Tab"&&w.preventDefault()};return e.jsxs("div",{ref:g,className:"relative flex flex-col gap-1",children:[t&&e.jsx(W,{id:d,htmlFor:m,children:t}),e.jsxs("button",{ref:x,id:m,type:"button",role:"combobox",disabled:o,"aria-haspopup":"listbox","aria-expanded":k,"aria-controls":k?p:void 0,"aria-activedescendant":k&&y>=0?`${m}-opt-${y}`:void 0,"aria-labelledby":t?`${d} ${m}`:void 0,"aria-invalid":!!n,"aria-describedby":n?h:void 0,onClick:()=>k?$(!1):E(),onKeyDown:B,className:`${re(!!n)} flex items-center justify-between gap-2 text-left ${c}`,...u,children:[e.jsx("span",{className:`min-w-0 flex-1 truncate ${C?"":"text-app-muted"}`,children:C?C.label:l??" "}),e.jsx(wr,{open:k})]}),i&&e.jsx("input",{type:"hidden",name:i,value:r??""}),e.jsx(Y,{open:k,anchorRef:x,panelRef:b,placement:"bottom-start",matchWidth:!0,gap:2,className:"max-h-60 max-w-[calc(100vw-1rem)] overflow-y-auto border border-app-border bg-app-card shadow-xl",children:e.jsx("ul",{id:p,role:"listbox","aria-labelledby":t?d:void 0,className:"m-0 list-none p-0",children:a.map((w,N)=>{const I=N===S,A=N===y;return e.jsxs("li",{id:`${m}-opt-${N}`,role:"option","aria-selected":I,"aria-disabled":w.disabled||void 0,"data-active":A,onMouseDown:L=>L.preventDefault(),onMouseMove:()=>!w.disabled&&v(N),onClick:()=>D(N),className:`flex items-center justify-between gap-2 px-3 py-2 text-sm ${w.disabled?"cursor-not-allowed text-app-muted opacity-50":A?"cursor-pointer bg-app-strong text-app-bg":"cursor-pointer text-app-text"} ${I?"font-semibold":""}`,children:[e.jsx("span",{className:"min-w-0 truncate",children:w.label}),I&&e.jsx(kr,{})]},w.value)})})}),n&&e.jsx("span",{id:h,className:"text-xs text-red-700 dark:text-red-400",children:n})]})},$r=({items:t,activeKey:r,onSelect:s,header:a,footer:l,collapsed:n=!1,linkComponent:o="a",linkProp:i="href",label:c="Sidebar",className:u=""})=>{const m=(d,p=0)=>{var $;const h=d.key===r,g=e.jsxs(e.Fragment,{children:[d.icon&&e.jsx("span",{className:"shrink-0 [&>svg]:h-4 [&>svg]:w-4",children:d.icon}),!n&&e.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:d.label}),!n&&d.badge!=null&&e.jsx("span",{className:"bg-app-strong px-1.5 text-[10px] font-semibold text-app-bg",children:d.badge})]}),x=`flex w-full items-center gap-3 py-2 text-xs font-semibold uppercase tracking-widest transition ${h?"bg-app-strong text-app-bg":"text-app-muted hover:bg-app-bg hover:text-app-text"} ${n?"justify-center px-2":"pr-3"}`,b=n?void 0:{paddingLeft:`${.75+p*1}rem`},j=()=>{var y;(y=d.onClick)==null||y.call(d),s==null||s(d.key)},k=!!(($=d.children)!=null&&$.length);return e.jsxs("li",{children:[d.href&&!k?e.jsx(o,{[i]:d.href,"aria-current":h?"page":void 0,"aria-label":n?d.label:void 0,title:n?d.label:void 0,onClick:j,className:x,style:b,children:g}):e.jsx("button",{type:"button","aria-current":h?"page":void 0,"aria-label":n?d.label:void 0,title:n?d.label:void 0,onClick:j,className:x,style:b,children:g}),k&&!n&&e.jsx("ul",{className:"m-0 list-none p-0",children:d.children.map(y=>m(y,p+1))})]},d.key)};return e.jsxs("nav",{"aria-label":c,className:`flex h-full flex-col border-r border-app-border bg-app-card ${n?"w-14":"w-60"} ${u}`,children:[a&&e.jsx("div",{className:"shrink-0 border-b border-app-border px-3 py-3",children:a}),e.jsx("ul",{className:"m-0 flex-1 list-none overflow-y-auto p-0 py-2",children:t.map(d=>m(d))}),l&&e.jsx("div",{className:"shrink-0 border-t border-app-border px-3 py-3",children:l})]})},Mr=({lines:t,circle:r=!1,className:s="h-4 w-full"})=>t?e.jsx("div",{"aria-hidden":"true",className:"flex flex-col gap-2",children:Array.from({length:t},(a,l)=>e.jsx("div",{className:`h-3 animate-pulse bg-app-border ${l===t-1?"w-2/3":"w-full"}`},l))}):e.jsx("div",{"aria-hidden":"true",className:`animate-pulse bg-app-border ${r?"rounded-full":""} ${s}`}),Sr=({label:t,value:r,onChange:s,min:a=0,max:l=100,step:n=1,showValue:o=!0,className:i="",...c})=>{const u=f.useId(),m=l-a,d=m>0?Math.min(100,Math.max(0,(r-a)/m*100)):0;return e.jsxs("div",{className:`flex flex-col gap-1 ${i}`,children:[(t||o)&&e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t?e.jsx(W,{htmlFor:u,children:t}):e.jsx("span",{}),o&&e.jsx("span",{className:"text-xs font-semibold uppercase tracking-widest text-app-text",children:r})]}),e.jsx("input",{id:u,type:"range",min:a,max:l,step:n,value:r,onChange:p=>s==null?void 0:s(Number(p.target.value)),style:{"--xd-fill":`${d}%`},className:"xd-slider w-full",...c})]})},Cr=(t,r,s)=>{const a=[...t],[l]=a.splice(r,1);return a.splice(s,0,l),a},Lr=({items:t,onChange:r,renderItem:s,label:a="Sortable list",className:l=""})=>{const[n,o]=f.useState(null),[i,c]=f.useState(null),[u,m]=f.useState(""),d=(p,h)=>{p===h||h<0||h>=t.length||r(Cr(t,p,h))};return e.jsxs(e.Fragment,{children:[e.jsx("ul",{"aria-label":a,className:`m-0 list-none border border-app-border bg-app-card p-0 ${l}`,children:t.map((p,h)=>e.jsxs("li",{draggable:!0,onDragStart:g=>{o(p.key),g.dataTransfer.effectAllowed="move",g.dataTransfer.setData("text/plain",String(p.key))},onDragOver:g=>{g.preventDefault(),p.key!==i&&c(p.key)},onDrop:g=>{g.preventDefault();const x=t.findIndex(b=>b.key===n);d(x,h),o(null),c(null)},onDragEnd:()=>{o(null),c(null)},className:`flex items-center gap-3 border-b border-app-border px-3 py-2.5 last:border-b-0 ${n===p.key?"opacity-40":""} ${i===p.key&&n!==p.key?"bg-app-soft/20":""}`,children:[e.jsx("button",{type:"button","aria-label":`Reorder ${p.label??p.key}. Use up and down arrow keys.`,onKeyDown:g=>{const x=g.key==="ArrowUp"?h-1:g.key==="ArrowDown"?h+1:null;if(x===null||x<0||x>=t.length)return;g.preventDefault();const b=g.currentTarget;d(h,x),m(`${p.label??p.key} moved to position ${x+1} of ${t.length}`),requestAnimationFrame(()=>b.focus())},className:"-my-2 cursor-grab select-none px-2 py-2 text-app-muted transition hover:text-app-text active:cursor-grabbing",children:e.jsx("span",{"aria-hidden":"true",children:"⋮⋮"})}),e.jsx("div",{className:"min-w-0 flex-1 text-sm text-app-text",children:s(p,h)})]},p.key))}),e.jsx("div",{role:"status","aria-live":"polite",className:"sr-only",children:u})]})},Er=({direction:t="column",gap:r=4,...s})=>e.jsx(Xe,{direction:t,gap:r,...s}),tt=({className:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:t??"w-4 h-4 flex-shrink-0 text-emerald-600 dark:text-emerald-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),Tr=({steps:t,current:r=0,className:s=""})=>e.jsx("ol",{className:`m-0 flex list-none flex-col gap-4 p-0 sm:flex-row sm:gap-0 ${s}`,children:t.map((a,l)=>{const n=l<r,o=l===r;return e.jsxs("li",{"aria-current":o?"step":void 0,className:"flex flex-1 items-start gap-3 sm:flex-col sm:gap-2",children:[e.jsxs("div",{className:"flex items-center sm:w-full",children:[e.jsx("span",{className:`flex h-7 w-7 shrink-0 items-center justify-center border text-xs font-semibold ${n?"border-app-strong bg-app-strong text-app-bg":o?"border-app-strong text-app-text":"border-app-border text-app-muted"}`,children:n?e.jsx(tt,{className:"h-4 w-4"}):l+1}),l<t.length-1&&e.jsx("span",{"aria-hidden":"true",className:`ml-2 hidden h-px flex-1 sm:block ${n?"bg-app-strong":"bg-app-border"}`})]}),e.jsxs("div",{className:"pr-2",children:[e.jsx("div",{className:`text-xs font-semibold uppercase tracking-widest ${o||n?"text-app-text":"text-app-muted"}`,children:a.label}),a.description&&e.jsx("div",{className:"mt-0.5 text-xs text-app-muted",children:a.description})]})]},a.label)})}),Ir=({checked:t,onChange:r,label:s,disabled:a=!1,className:l="",...n})=>e.jsxs("button",{type:"button",role:"switch","aria-checked":t,disabled:a,onClick:()=>r==null?void 0:r(!t),className:`inline-flex min-h-8 items-center gap-2 text-sm text-app-text disabled:cursor-not-allowed disabled:opacity-50 ${l}`,...n,children:[e.jsx("span",{"aria-hidden":"true",className:`relative inline-block h-5 w-9 shrink-0 border transition ${t?"border-app-strong bg-app-strong":"border-app-border bg-app-bg"}`,children:e.jsx("span",{className:`absolute top-0.5 h-3.5 w-3.5 transition-all ${t?"left-[1.1rem] bg-app-bg":"left-0.5 bg-app-muted"}`})}),s]}),De={left:"text-left",center:"text-center",right:"text-right"},Dr=({columns:t,rows:r,rowKey:s="id",empty:a="No data",caption:l,className:n=""})=>e.jsx("div",{className:`overflow-x-auto border border-app-border ${n}`,children:e.jsxs("table",{className:"w-full border-collapse bg-app-card text-sm text-app-text",children:[l&&e.jsx("caption",{className:"sr-only",children:l}),e.jsx("thead",{children:e.jsx("tr",{className:"border-b border-app-border bg-app-bg",children:t.map(o=>e.jsx("th",{scope:"col",className:`px-4 py-2.5 text-xs font-semibold uppercase tracking-widest text-app-muted ${De[o.align??"left"]}`,children:o.header},o.key))})}),e.jsx("tbody",{children:r.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:t.length,className:"px-4 py-6 text-center text-app-muted",children:a})}):r.map(o=>e.jsx("tr",{className:"border-b border-app-border last:border-b-0 hover:bg-app-bg",children:t.map(i=>e.jsx("td",{className:`px-4 py-2.5 ${De[i.align??"left"]}`,children:i.render?i.render(o):o[i.key]},i.key))},o[s]))})]})}),Ar=({items:t,value:r,defaultValue:s,onChange:a,className:l=""})=>{var g;const n=f.useId(),[o,i]=f.useState(s??((g=t[0])==null?void 0:g.key)),c=r??o,u=f.useRef({}),m=x=>{r===void 0&&i(x),a==null||a(x)},d=t.filter(x=>!x.disabled),p=x=>{var k;const b=d.findIndex($=>$.key===c);let j;x.key==="ArrowRight"?j=d[(b+1)%d.length]:x.key==="ArrowLeft"?j=d[(b-1+d.length)%d.length]:x.key==="Home"?j=d[0]:x.key==="End"&&(j=d[d.length-1]),j&&(x.preventDefault(),m(j.key),(k=u.current[j.key])==null||k.focus())},h=t.find(x=>x.key===c);return e.jsxs("div",{className:l,children:[e.jsx("div",{role:"tablist",onKeyDown:p,className:"flex overflow-x-auto overflow-y-hidden shadow-[inset_0_-1px_0_rgb(var(--color-app-border))]",children:t.map(x=>{const b=x.key===c;return e.jsx("button",{ref:j=>u.current[x.key]=j,id:`${n}-tab-${x.key}`,type:"button",role:"tab","aria-selected":b,"aria-controls":`${n}-panel-${x.key}`,tabIndex:b?0:-1,disabled:x.disabled,onClick:()=>m(x.key),className:`whitespace-nowrap border-b-2 px-4 py-2 text-xs font-semibold uppercase tracking-widest transition disabled:cursor-not-allowed disabled:opacity-50 ${b?"border-app-strong text-app-text":"border-transparent text-app-muted hover:text-app-text"}`,children:x.label},x.key)})}),(h==null?void 0:h.content)!==void 0&&e.jsx("div",{role:"tabpanel",id:`${n}-panel-${h.key}`,"aria-labelledby":`${n}-tab-${h.key}`,tabIndex:0,className:"pt-4",children:h.content})]})},Rr=({href:t,linkComponent:r="a",linkProp:s="href",className:a="",children:l,...n})=>e.jsx(r,{[s]:t,className:`text-app-text underline underline-offset-2 transition hover:text-app-strong ${a}`,...n,children:l}),Pr={default:"bg-app-strong",success:"bg-emerald-500",warning:"bg-amber-400",danger:"bg-red-500"},Fr=({items:t,className:r=""})=>e.jsx("ol",{className:`m-0 list-none p-0 ${r}`,children:t.map((s,a)=>e.jsxs("li",{className:"relative flex gap-4 pb-6 last:pb-0",children:[a<t.length-1&&e.jsx("span",{"aria-hidden":"true",className:"absolute left-[0.3rem] top-4 bottom-0 w-px bg-app-border"}),e.jsx("span",{"aria-hidden":"true",className:`relative mt-1.5 h-2.5 w-2.5 shrink-0 ${Pr[s.tone??"default"]}`}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-baseline justify-between gap-x-3",children:[e.jsx("span",{className:"text-sm font-semibold text-app-text",children:s.title}),s.time&&e.jsx("time",{className:"text-xs text-app-muted",children:s.time})]}),s.description&&e.jsx("p",{className:"m-0 mt-0.5 text-sm text-app-muted",children:s.description})]})]},s.key))}),K=t=>String(t).padStart(2,"0"),pe=t=>{const r=/^(\d{1,2}):(\d{2})/.exec(t??"");if(!r)return null;const s=Number(r[1]),a=Number(r[2]);return s<24&&a<60?{hour:s,minute:a}:null},Ae=({hour:t,minute:r})=>t*60+r,Br=()=>e.jsxs("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-4 w-4 shrink-0 text-app-muted",children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 7v5l3 2"})]}),ue=({label:t,options:r,selected:s,onPick:a,columnRef:l})=>e.jsx("div",{ref:l,role:"listbox","aria-label":t,className:"flex max-h-56 w-14 flex-col overflow-y-auto border-r border-app-border last:border-r-0",children:r.map(n=>{const o=n.value===s;return e.jsx("button",{type:"button",role:"option","aria-selected":o,disabled:n.disabled,"data-selected":o,tabIndex:o||s===null&&n.first?0:-1,onClick:()=>a(n.value),onKeyDown:i=>{const c=[...i.currentTarget.parentElement.querySelectorAll("button:not(:disabled)")],u=c.indexOf(i.currentTarget),m=i.key==="ArrowDown"?1:i.key==="ArrowUp"?-1:0;if(m){i.preventDefault();const d=c[Math.min(Math.max(u+m,0),c.length-1)];d==null||d.focus(),d==null||d.click()}else if(i.key==="ArrowLeft"||i.key==="ArrowRight"){const d=[...i.currentTarget.closest("[data-columns]").querySelectorAll("[role=listbox]")],p=d[d.indexOf(i.currentTarget.parentElement)+(i.key==="ArrowRight"?1:-1)],h=(p==null?void 0:p.querySelector('[data-selected="true"]'))??(p==null?void 0:p.querySelector("button:not(:disabled)"));h&&(i.preventDefault(),h.focus())}},className:`px-3 py-2 text-center text-sm tabular-nums transition disabled:cursor-not-allowed disabled:opacity-30 ${o?"bg-app-strong font-semibold text-app-bg":"text-app-text hover:bg-app-bg"}`,children:n.label},n.value)})}),Or=({label:t,value:r,onChange:s,step:a=900,min:l,max:n,hour12:o=!1,placeholder:i="Select time",error:c,disabled:u=!1,className:m="",...d})=>{const p=f.useId(),h=`${p}-error`,g=f.useRef(null),x=f.useRef(null),b=f.useRef(null),j=f.useRef(null),[k,$]=f.useState(!1),y=pe(r),v=Math.max(1,Math.round(a/60)),S=Array.from({length:Math.ceil(60/v)},(L,T)=>T*v),C=pe(l),M=pe(n),E=(L,T)=>{const P=L*60+T;return(!C||P>=Ae(C))&&(!M||P<=Ae(M))};G(k,[g,b],L=>{var T;$(!1),L==="escape"&&((T=x.current)==null||T.focus())}),f.useEffect(()=>{var P,J;const L=b.current;if(!k||!L)return;L.querySelectorAll("[role=listbox]").forEach(ee=>{const ie=ee.querySelector('[data-selected="true"]');ie&&(ee.scrollTop=ie.offsetTop-ee.clientHeight/2+ie.offsetHeight/2)});const T=((P=j.current)==null?void 0:P.querySelector('[data-selected="true"]'))??((J=j.current)==null?void 0:J.querySelector("button:not(:disabled)"));T==null||T.focus({preventScroll:!0})},[k]);const D=(L,T)=>s==null?void 0:s(`${K(L)}:${K(T)}`),R=L=>{const T=S.find(P=>P===(y==null?void 0:y.minute)&&E(L,P))??S.find(P=>E(L,P))??0;D(L,T)},F=L=>D((y==null?void 0:y.hour)??(C?C.hour:0),L),B=L=>{const T=(y==null?void 0:y.hour)??0;D(L?T%12+12:T%12,(y==null?void 0:y.minute)??0)},w=((y==null?void 0:y.hour)??0)>=12,N=o?Array.from({length:12},(L,T)=>{const P=T===0?12:T,J=T%12+(w?12:0);return{value:J,label:K(P),first:T===0,disabled:!S.some(ee=>E(J,ee))}}):Array.from({length:24},(L,T)=>({value:T,label:K(T),first:T===0,disabled:!S.some(P=>E(T,P))})),I=S.map((L,T)=>({value:L,label:K(L),first:T===0,disabled:!E((y==null?void 0:y.hour)??(C?C.hour:0),L)})),A=y?o?`${K(y.hour%12===0?12:y.hour%12)}:${K(y.minute)} ${w?"PM":"AM"}`:`${K(y.hour)}:${K(y.minute)}`:"";return e.jsxs("div",{ref:g,className:"relative flex flex-col gap-1",children:[t&&e.jsx(W,{htmlFor:p,children:t}),e.jsxs("button",{ref:x,id:p,type:"button",disabled:u,"aria-haspopup":"dialog","aria-expanded":k,"aria-invalid":!!c,"aria-describedby":c?h:void 0,onClick:()=>$(L=>!L),className:`${re(!!c)} flex items-center justify-between gap-2 text-left ${m}`,...d,children:[e.jsx("span",{className:A?"tabular-nums":"text-app-muted",children:A||i}),e.jsx(Br,{})]}),e.jsx(Y,{open:k,anchorRef:x,panelRef:b,placement:"bottom-start",role:"dialog","aria-label":"Choose time",className:"border border-app-border bg-app-card shadow-xl",children:e.jsxs("div",{"data-columns":!0,className:"flex",children:[e.jsx(ue,{label:"Hours",options:N,selected:y?y.hour:null,onPick:R,columnRef:j}),e.jsx(ue,{label:"Minutes",options:I,selected:y?y.minute:null,onPick:F}),o&&e.jsx(ue,{label:"AM or PM",options:[{value:"AM",label:"AM",first:!0},{value:"PM",label:"PM"}],selected:y?w?"PM":"AM":null,onPick:L=>B(L==="PM")})]})}),c&&e.jsx("span",{id:h,className:"text-xs text-red-700 dark:text-red-400",children:c})]})},Wr=t=>{const{toast:r}=t;return e.jsx("div",{role:"status","aria-live":"polite","aria-atomic":"true",className:"fixed bottom-5 right-5 z-[var(--xd-z-toast,90)]",children:r&&e.jsxs("div",{className:`max-w-sm px-4 py-3 text-sm font-semibold shadow-xl ${r.type==="error"?"bg-red-700 text-white":"bg-emerald-700 text-white"}`,children:[r.msg,r.link&&e.jsxs(e.Fragment,{children:[" ",e.jsx("a",{href:r.link.href,target:"_blank",rel:"noreferrer",className:"underline underline-offset-2",children:r.link.label})]})]})})},rt=(t,r,s=0,a=null,l=[])=>(t.forEach(n=>{var o;l.push({node:n,depth:s,parent:a}),(o=n.children)!=null&&o.length&&r.includes(n.key)&&rt(n.children,r,s+1,n.key,l)}),l),zr=({nodes:t,selected:r,onSelect:s,defaultExpanded:a=[],expanded:l,onExpandedChange:n,label:o="Tree",className:i=""})=>{var y;const[c,u]=f.useState(a),m=l??c,[d,p]=f.useState(null),h=v=>{l===void 0&&u(v),n==null||n(v)},g=v=>h(m.includes(v)?m.filter(S=>S!==v):[...m,v]),x=rt(t,m),b=x.some(v=>v.node.key===d)?d:(y=x[0])==null?void 0:y.node.key,j=v=>{p(v),requestAnimationFrame(()=>{var S;return(S=document.getElementById(`${k}-${v}`))==null?void 0:S.focus()})},k=`tree-${o.replace(/\W+/g,"-")}`,$=(v,S)=>{var R;const{node:C,parent:M}=x[S],E=!!((R=C.children)!=null&&R.length),D=m.includes(C.key);switch(v.key){case"ArrowDown":x[S+1]&&j(x[S+1].node.key);break;case"ArrowUp":x[S-1]&&j(x[S-1].node.key);break;case"ArrowRight":E&&!D?g(C.key):E&&j(C.children[0].key);break;case"ArrowLeft":E&&D?g(C.key):M!==null&&j(M);break;case"Home":j(x[0].node.key);break;case"End":j(x[x.length-1].node.key);break;case"Enter":case" ":s==null||s(C.key);break;default:return}v.preventDefault()};return e.jsx("ul",{role:"tree","aria-label":o,className:`m-0 list-none p-0 text-sm text-app-text ${i}`,children:x.map(({node:v,depth:S},C)=>{var R;const M=!!((R=v.children)!=null&&R.length),E=m.includes(v.key),D=r===v.key;return e.jsx("li",{id:`${k}-${v.key}`,role:"treeitem","aria-level":S+1,"aria-expanded":M?E:void 0,"aria-selected":D,tabIndex:v.key===b?0:-1,onKeyDown:F=>$(F,C),onFocus:()=>p(v.key),className:"list-none outline-none",children:e.jsxs("div",{style:{paddingLeft:`${S*1.25+.5}rem`},className:`flex cursor-pointer items-center gap-1 py-1.5 pr-3 transition hover:bg-app-bg ${D?"bg-app-soft/20 font-semibold":""}`,onClick:()=>{s==null||s(v.key),M&&g(v.key)},children:[e.jsx("span",{"aria-hidden":"true",className:"flex h-5 w-5 shrink-0 items-center justify-center text-app-muted",children:M&&e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:`h-4 w-4 transition-transform ${E?"rotate-90":""}`,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 5l7 7-7 7"})})}),v.label]})},v.key)})})},Re=t=>{if(!Number.isFinite(t))return"0:00";const r=Math.floor(t/60),s=Math.floor(t%60);return`${r}:${String(s).padStart(2,"0")}`},xe="min-h-9 px-2 py-1 text-xs font-semibold uppercase tracking-widest text-app-text transition hover:bg-app-bg focus-visible:outline-offset-[-2px]",qr=({src:t,poster:r,title:s="Video",ratio:a="video",className:l="",children:n,...o})=>{const i=f.useRef(null),c=f.useRef(null),[u,m]=f.useState(!1),[d,p]=f.useState(0),[h,g]=f.useState(0),[x,b]=f.useState(!1),[j,k]=f.useState(!1);f.useEffect(()=>{const v=()=>k(document.fullscreenElement===c.current);return document.addEventListener("fullscreenchange",v),()=>document.removeEventListener("fullscreenchange",v)},[]);const $=()=>{const v=i.current;v.paused?v.play().catch(()=>{}):v.pause()},y=()=>{var v,S;document.fullscreenElement?document.exitFullscreen():(S=(v=c.current)==null?void 0:v.requestFullscreen)==null||S.call(v)};return e.jsxs("div",{ref:c,className:`flex flex-col border border-app-border bg-app-card ${l}`,children:[e.jsx("video",{ref:i,src:t,poster:r,title:s,muted:x,playsInline:!0,preload:"metadata",className:`block w-full bg-black ${a==="video"?"aspect-video":""} ${j?"flex-1":""}`,onClick:$,onPlay:()=>m(!0),onPause:()=>m(!1),onTimeUpdate:v=>p(v.currentTarget.currentTime),onLoadedMetadata:v=>g(v.currentTarget.duration),...o,children:n}),e.jsxs("div",{role:"group","aria-label":`${s} controls`,className:"flex items-center gap-1 border-t border-app-border px-1 py-1",children:[e.jsx("button",{type:"button",className:xe,onClick:$,"aria-label":u?"Pause":"Play",children:u?"Pause":"Play"}),e.jsx("span",{className:"w-10 text-center text-xs tabular-nums text-app-muted",children:Re(d)}),e.jsx("input",{type:"range","aria-label":"Seek",min:0,max:h||0,step:"any",value:Math.min(d,h||0),onChange:v=>{i.current.currentTime=Number(v.target.value),p(Number(v.target.value))},className:"min-w-0 flex-1 cursor-pointer accent-[rgb(var(--color-app-strong))]"}),e.jsx("span",{className:"w-10 text-center text-xs tabular-nums text-app-muted",children:Re(h)}),e.jsx("button",{type:"button",className:xe,"aria-pressed":x,onClick:()=>b(v=>!v),children:x?"Unmute":"Mute"}),e.jsx("button",{type:"button",className:xe,onClick:y,children:j?"Exit":"Full"})]})]})},Kr=({items:t,itemHeight:r,height:s=320,overscan:a=4,renderItem:l,getKey:n,label:o="List",className:i=""})=>{const[c,u]=f.useState(0),m=Math.max(0,Math.floor(c/r)-a),d=Math.min(t.length,Math.ceil((c+s)/r)+a);return e.jsx("div",{role:"list","aria-label":o,"aria-rowcount":t.length,tabIndex:0,onScroll:p=>u(p.currentTarget.scrollTop),style:{height:s},className:`overflow-y-auto border border-app-border bg-app-card ${i}`,children:e.jsx("div",{style:{height:t.length*r,position:"relative"},children:t.slice(m,d).map((p,h)=>{const g=m+h;return e.jsx("div",{role:"listitem","aria-posinset":g+1,"aria-setsize":t.length,style:{position:"absolute",top:g*r,height:r,left:0,right:0},className:"flex items-center border-b border-app-border px-4 text-sm text-app-text",children:l(p,g)},n?n(p,g):g)})})})},_r=({className:t})=>e.jsxs("svg",{"aria-hidden":"true",focusable:"false",className:t??"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 12H5"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 5l-7 7 7 7"})]}),Hr=({className:t})=>e.jsxs("svg",{"aria-hidden":"true",focusable:"false",className:t??"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 010-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),Gr=({className:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:t??"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.98 8.223A10.477 10.477 0 001.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.45 10.45 0 0112 4.5c4.756 0 8.773 3.162 10.065 7.498a10.523 10.523 0 01-4.293 5.774M6.228 6.228L3 3m3.228 3.228l3.65 3.65m7.894 7.894L21 21m-3.228-3.228l-3.65-3.65m0 0a3 3 0 10-4.243-4.243m4.242 4.242L9.88 9.88"})}),Ur=({className:t})=>e.jsxs("svg",{"aria-hidden":"true",focusable:"false",className:t??"h-5 w-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1"}),e.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1"}),e.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1"}),e.jsx("rect",{x:"14",y:"14",width:"7",height:"7",rx:"1"})]}),Yr=({className:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:t??"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6"})}),Vr=({className:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:t??"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"})}),Zr=({className:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:t??"h-5 w-5 text-app-soft",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 3.487a2.25 2.25 0 113.182 3.182L8.25 18.463 4 20l1.537-4.25L16.862 3.487z"})}),Qr=({className:t})=>e.jsxs("svg",{"aria-hidden":"true",focusable:"false",className:t??"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 12a9 9 0 11-2.63-6.36"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M21 3v6h-6"})]}),Xr=({className:t})=>e.jsxs("svg",{"aria-hidden":"true",focusable:"false",className:t??"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:[e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 010 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 010-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28z"}),e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"})]}),Jr=({className:t})=>e.jsx("svg",{"aria-hidden":"true",focusable:"false",className:t??"h-7 w-7 text-app-soft",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"})}),es=(t,r="")=>{f.useEffect(()=>{document.title=[t,r].filter(Boolean).join(" · ")},[t,r])},Pe=8,ts=(t,r,s)=>{const[a,l]=f.useState(!1);return f.useLayoutEffect(()=>{if(!t){l(!1);return}const n=r.current;if(!n)return;const o=n.getBoundingClientRect(),i=document.documentElement.clientWidth,c=s==="end"?o.left<Pe:o.right>i-Pe;l(c)},[t,r,s]),a?s==="end"?"start":"end":s},rs=()=>typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),ss=(t,r)=>{const s=t.toLowerCase().split("+"),a=s.pop(),l=new Set(s),n=rs(),o=l.has("ctrl")||l.has("mod")&&!n,i=l.has("meta")||l.has("mod")&&n;return r.key.toLowerCase()===a&&r.ctrlKey===o&&r.metaKey===i&&r.altKey===l.has("alt")&&r.shiftKey===l.has("shift")},as=t=>t instanceof HTMLElement&&(t.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(t.tagName)),ns=(t,r=!0)=>{const s=f.useRef(t);f.useEffect(()=>{s.current=t}),f.useEffect(()=>{if(!r)return;const a=l=>{for(const[n,o]of Object.entries(s.current))if(!(!ss(n,l)||!/\b(mod|ctrl|alt|meta)\+/i.test(n)&&as(l.target))){l.preventDefault(),o(l);return}};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[r])},ls=t=>{f.useEffect(()=>{if(!t)return;const r=s=>{s.preventDefault(),s.returnValue=""};return window.addEventListener("beforeunload",r),()=>window.removeEventListener("beforeunload",r)},[t])},os=(t=3e3)=>{const[r,s]=f.useState(null),a=f.useRef(null);f.useEffect(()=>()=>clearTimeout(a.current),[]);const l=f.useCallback((n,o="success",{link:i,duration:c=t}={})=>{clearTimeout(a.current),s({msg:n,type:o,link:i}),a.current=setTimeout(()=>s(null),c)},[t]);return{toast:r,showToast:l}},st=(t,r="")=>{const s=ae[t],a=`
35
35
  <svg width="64" height="64" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg">
36
- <title>${s}</title>
37
- <circle cx="32" cy="32" r="30" fill="${r.outer}"/>
38
- <path d="M32 32 C32 18, 42 14, 45 10 C49 5, 52 6, 50 12 C48 18, 38 20, 32 32 Z" fill="${r.bladeA}"/>
39
- <path d="M32 32 C46 32, 50 42, 54 45 C59 49, 58 52, 52 50 C46 48, 44 38, 32 32 Z" fill="${r.bladeB}"/>
40
- <path d="M32 32 C32 46, 22 50, 19 54 C15 59, 12 58, 14 52 C16 46, 26 44, 32 32 Z" fill="${r.bladeA}"/>
41
- <path d="M32 32 C18 32, 14 22, 10 19 C5 15, 6 12, 12 14 C18 16, 20 26, 32 32 Z" fill="${r.bladeB}"/>
42
- <circle cx="32" cy="32" r="5" fill="${r.hubOuter}"/>
43
- <circle cx="32" cy="32" r="3" fill="${r.hubInner}"/>
44
- <circle cx="32" cy="32" r="30" fill="none" stroke="${r.ring}" stroke-width="5" opacity="${r.ringOpacity}"/>
36
+ <title>${r}</title>
37
+ <circle cx="32" cy="32" r="30" fill="${s.outer}"/>
38
+ <path d="M32 32 C32 18, 42 14, 45 10 C49 5, 52 6, 50 12 C48 18, 38 20, 32 32 Z" fill="${s.bladeA}"/>
39
+ <path d="M32 32 C46 32, 50 42, 54 45 C59 49, 58 52, 52 50 C46 48, 44 38, 32 32 Z" fill="${s.bladeB}"/>
40
+ <path d="M32 32 C32 46, 22 50, 19 54 C15 59, 12 58, 14 52 C16 46, 26 44, 32 32 Z" fill="${s.bladeA}"/>
41
+ <path d="M32 32 C18 32, 14 22, 10 19 C5 15, 6 12, 12 14 C18 16, 20 26, 32 32 Z" fill="${s.bladeB}"/>
42
+ <circle cx="32" cy="32" r="5" fill="${s.hubOuter}"/>
43
+ <circle cx="32" cy="32" r="3" fill="${s.hubInner}"/>
44
+ <circle cx="32" cy="32" r="30" fill="none" stroke="${s.ring}" stroke-width="5" opacity="${s.ringOpacity}"/>
45
45
  </svg>
46
- `;return`data:image/svg+xml,${encodeURIComponent(a)}`},Bs=()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",Os=(t=xe)=>{if(typeof window>"u")return null;try{const s=window.localStorage.getItem(t);if(s==="light"||s==="dark")return s}catch{}return null},Ue=({storageKey:t=xe,favicon:s=!0,faviconTitle:r=""}={})=>{const[a,n]=x.useState(Bs),[l,o]=x.useState(()=>Os(t)),c=l||a;return x.useEffect(()=>{if(typeof window>"u")return;const u=window.matchMedia("(prefers-color-scheme: dark)"),f=d=>n(d.matches?"dark":"light");return u.addEventListener("change",f),()=>u.removeEventListener("change",f)},[]),x.useEffect(()=>{try{l?window.localStorage.setItem(t,l):window.localStorage.removeItem(t)}catch{}},[l,t]),x.useEffect(()=>{if(document.documentElement.setAttribute("data-theme",c),!s)return;const u=document.getElementById("app-favicon")||document.querySelector("link[rel='icon']");u&&u.setAttribute("href",Ge(c,r))},[c,s,r]),{activeTheme:c,toggleTheme:()=>o(u=>(u||a)==="dark"?"light":"dark")}},zs=({children:t,storageKey:s,favicon:r=!1,faviconTitle:a})=>{const n=Ue({storageKey:s,favicon:r,faviconTitle:a});return e.jsx(ie.Provider,{value:n,children:t})};exports.ActionMenu=Ye;exports.Alert=Ze;exports.AppBar=et;exports.AppShell=rt;exports.AreaChart=lt;exports.ArrowLeftIcon=ys;exports.Avatar=ct;exports.BarChart=dt;exports.Breadcrumb=pt;exports.Button=A;exports.Calendar=pe;exports.Card=ht;exports.Carousel=bt;exports.CheckIcon=qe;exports.Checkbox=ae;exports.CloseIcon=V;exports.CommandPalette=gt;exports.ConfirmDialog=yt;exports.Container=wt;exports.DEFAULT_THEME_STORAGE_KEY=xe;exports.Dashboard=Ct;exports.DataGrid=St;exports.DatePicker=It;exports.DateRangePicker=Tt;exports.Divider=Dt;exports.Drawer=Le;exports.EyeIcon=ws;exports.EyeOffIcon=ks;exports.FanFavicon=ue;exports.Field=At;exports.FileUpload=Ft;exports.Flex=ze;exports.FocusTrap=zt;exports.Grid=ne;exports.GridIcon=Ns;exports.HomeIcon=$s;exports.Image=Kt;exports.InfoIcon=Me;exports.Input=fe;exports.LineChart=Fe;exports.List=qt;exports.LoadingScreen=_t;exports.LogoutIcon=Ms;exports.MenuIcon=Se;exports.Modal=Re;exports.Navbar=Gt;exports.NotificationCenter=Ht;exports.PageHeader=Pe;exports.PageLayout=We;exports.Pagination=Oe;exports.PencilIcon=Cs;exports.PieChart=Yt;exports.Popover=Vt;exports.Portal=Zt;exports.Progress=Qt;exports.RackServer=ts;exports.Radio=Ke;exports.RadioGroup=ss;exports.RefreshIcon=Es;exports.Select=rs;exports.SettingsIcon=Ls;exports.ShieldIcon=Ss;exports.Sidebar=as;exports.Skeleton=ns;exports.Slider=ls;exports.SortableList=is;exports.Stack=cs;exports.StatCard=Be;exports.Stepper=ds;exports.Switch=ps;exports.THEME_FAVICON_COLORS=Y;exports.Table=xs;exports.Tabs=us;exports.ThemeContext=ie;exports.ThemeProvider=zs;exports.ThemeToggle=ce;exports.TimePicker=hs;exports.Timeline=ms;exports.Toast=bs;exports.Tooltip=oe;exports.Tree=gs;exports.Video=js;exports.VirtualList=vs;exports.buildFaviconHref=Ge;exports.toolbarButtonClass=Ee;exports.useAppTheme=Ue;exports.useDialogFocus=_;exports.useDismissable=X;exports.useDocumentTitle=Is;exports.useEscapeKey=Z;exports.useFlipAlign=me;exports.useKeyboardShortcuts=Fs;exports.useLeaveWarning=Rs;exports.useTheme=Ce;exports.useTimedToast=Ps;
46
+ `;return`data:image/svg+xml,${encodeURIComponent(a)}`},is=()=>typeof window>"u"?"light":window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",cs=(t=ke)=>{if(typeof window>"u")return null;try{const r=window.localStorage.getItem(t);if(r==="light"||r==="dark")return r}catch{}return null},at=({storageKey:t=ke,favicon:r=!0,faviconTitle:s=""}={})=>{const[a,l]=f.useState(is),[n,o]=f.useState(()=>cs(t)),i=n||a;return f.useEffect(()=>{if(typeof window>"u")return;const u=window.matchMedia("(prefers-color-scheme: dark)"),m=d=>l(d.matches?"dark":"light");return u.addEventListener("change",m),()=>u.removeEventListener("change",m)},[]),f.useEffect(()=>{try{n?window.localStorage.setItem(t,n):window.localStorage.removeItem(t)}catch{}},[n,t]),f.useEffect(()=>{if(document.documentElement.setAttribute("data-theme",i),!r)return;let u=document.getElementById("app-favicon")||document.querySelector("link[rel~='icon']");u||(u=document.createElement("link"),u.id="app-favicon",u.rel="icon",document.head.appendChild(u)),u.setAttribute("type","image/svg+xml"),u.setAttribute("href",st(i,s))},[i,r,s]),{activeTheme:i,toggleTheme:()=>o(u=>(u||a)==="dark"?"light":"dark")}},ds=({children:t,storageKey:r,favicon:s=!1,faviconTitle:a})=>{const l=at({storageKey:r,favicon:s,faviconTitle:a});return e.jsx(je.Provider,{value:l,children:t})};exports.ActionMenu=dt;exports.Alert=ut;exports.AppBar=mt;exports.AppShell=jt;exports.AreaChart=wt;exports.ArrowLeftIcon=_r;exports.Avatar=$t;exports.BarChart=Mt;exports.BodyText=St;exports.Breadcrumb=Ct;exports.Button=q;exports.Calendar=we;exports.Card=Dt;exports.Carousel=At;exports.CheckIcon=tt;exports.Checkbox=he;exports.CloseIcon=ne;exports.CommandPalette=Rt;exports.ConfirmDialog=Bt;exports.Container=Ot;exports.DEFAULT_THEME_STORAGE_KEY=ke;exports.Dashboard=_t;exports.DataGrid=Ut;exports.DatePicker=Yt;exports.DateRangePicker=Vt;exports.Divider=Zt;exports.Drawer=ze;exports.EyeIcon=Hr;exports.EyeOffIcon=Gr;exports.FanFavicon=Ne;exports.Field=Qt;exports.FileUpload=Xt;exports.Flex=Xe;exports.FocusTrap=sr;exports.Grid=me;exports.GridIcon=Ur;exports.HelperText=ar;exports.HomeIcon=Yr;exports.Image=lr;exports.InfoIcon=Be;exports.Input=$e;exports.Label=W;exports.LineChart=Ue;exports.List=or;exports.LoadingScreen=ir;exports.LogoutIcon=Vr;exports.MenuIcon=qe;exports.Modal=Ye;exports.Navbar=cr;exports.NotificationCenter=pr;exports.PageHeader=Ve;exports.PageLayout=Je;exports.PageTitle=ur;exports.Pagination=Qe;exports.PencilIcon=Zr;exports.PieChart=xr;exports.Popover=fr;exports.Portal=hr;exports.Progress=mr;exports.RackServer=vr;exports.Radio=et;exports.RadioGroup=yr;exports.RefreshIcon=Qr;exports.Select=Nr;exports.SettingsIcon=Xr;exports.ShieldIcon=Jr;exports.Sidebar=$r;exports.Skeleton=Mr;exports.Slider=Sr;exports.SortableList=Lr;exports.Stack=Er;exports.StatCard=Ze;exports.Stepper=Tr;exports.Switch=Ir;exports.THEME_FAVICON_COLORS=ae;exports.Table=Dr;exports.Tabs=Ar;exports.TextLink=Rr;exports.ThemeContext=je;exports.ThemeProvider=ds;exports.ThemeToggle=ve;exports.TimePicker=Or;exports.Timeline=Fr;exports.Toast=Wr;exports.Tooltip=ge;exports.Tree=zr;exports.Video=qr;exports.VirtualList=Kr;exports.buildFaviconHref=st;exports.toolbarButtonClass=We;exports.useAppTheme=at;exports.useDialogFocus=te;exports.useDismissable=G;exports.useDocumentTitle=es;exports.useEscapeKey=le;exports.useFlipAlign=ts;exports.useKeyboardShortcuts=ns;exports.useLeaveWarning=ls;exports.useTheme=Oe;exports.useTimedToast=os;