@opencxh/ui-kit 3.137.11 → 3.137.12
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/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +755 -693
- package/dist/index.js.map +1 -1
- package/dist/src/content/Page.d.ts +85 -0
- package/dist/src/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const at=require("clsx"),d=require("react"),e=require("react/jsx-runtime"),L=require("lucide-react"),lt=require("dompurify"),ot=require("react-markdown"),ct=require("remark-gfm");function it(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return s.default=t,Object.freeze(s)}const dt=it(L);function c(...t){return at.clsx(t)}function ut(t){return(s,r)=>t[s]?.[r]||""}function xt(t){return s=>t[s]||""}function pe(t,s,{gap:r=6,matchWidth:n=!1,placement:a="bottom-start"}={}){const[l,o]=d.useState({});return d.useLayoutEffect(()=>{if(!t)return;const f=()=>{const i=s.current;if(!i)return;const v=i.getBoundingClientRect(),m=window.innerHeight-v.bottom,x=v.top,b=a.startsWith("top"),p=b?x<200&&m>x:m<200&&x>m,N=b!==p,g={position:"fixed"};N?(g.bottom=window.innerHeight-v.top+r,g.maxHeight=Math.max(120,x-r*2)):(g.top=v.bottom+r,g.maxHeight=Math.max(120,m-r*2)),a.endsWith("end")?g.right=window.innerWidth-v.right:g.left=v.left,n&&(g.width=v.width),o(g)};return f(),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[t,s,r,n,a]),l}const Fe=5;function ft(t){let s=2166136261;for(let r=0;r<t.length;r++)s^=t.charCodeAt(r),s=Math.imul(s,16777619);return s>>>0}function Ee(t){const s=(t??"").trim().toLowerCase();return s?ft(s)%Fe+1:1}const mt={1:"bg-cat-1-soft text-cat-1-fg",2:"bg-cat-2-soft text-cat-2-fg",3:"bg-cat-3-soft text-cat-3-fg",4:"bg-cat-4-soft text-cat-4-fg",5:"bg-cat-5-soft text-cat-5-fg"},ht={1:"bg-cat-1",2:"bg-cat-2",3:"bg-cat-3",4:"bg-cat-4",5:"bg-cat-5"};function Te(t){return mt[Ee(t)]}function bt(t){return ht[Ee(t)]}const Le=["cat-1","cat-2","cat-3","cat-4","cat-5"];function gt(t){let s=0;for(let r=0;r<t.length;r++)s=s*31+t.charCodeAt(r)>>>0;return Le[s%Le.length]}function pt({tiles:t,pinned:s,className:r}){if(s)return e.jsxs("div",{className:c("flex flex-col md:flex-row gap-2 h-full min-h-0",r),children:[e.jsx("div",{className:"flex-1 min-h-0",children:s}),t.length>0&&e.jsx("div",{className:"flex md:flex-col gap-2 md:w-48 overflow-auto",children:t.map((a,l)=>e.jsx("div",{className:"min-w-40 md:min-w-0",children:a},l))})]});const n=t.length<=1?"grid-cols-1":t.length<=4?"grid-cols-2":t.length<=9?"grid-cols-3":"grid-cols-4";return e.jsx("div",{className:c("grid gap-2 h-full",n,r),children:t.map((a,l)=>e.jsx("div",{children:a},l))})}function vt({name:t,avatarUrl:s,muted:r,speaking:n,hasVideo:a,videoSlot:l,className:o,fill:f}){return e.jsxs("div",{className:c("relative rounded-lg overflow-hidden bg-video-surface flex items-center justify-center",f?"h-full w-full":"aspect-video",n&&"ring-2 ring-speaking",o),children:[a&&l?e.jsx("div",{className:"absolute inset-0",children:l}):e.jsx("div",{className:"flex flex-col items-center gap-2 text-gray-300",children:s?e.jsx("img",{src:s,alt:t,className:"w-16 h-16 rounded-full object-cover"}):e.jsx("div",{className:"w-16 h-16 rounded-full bg-video-surface-strong flex items-center justify-center",children:a?e.jsx(L.VideoOff,{className:"w-8 h-8"}):e.jsx(L.User,{className:"w-8 h-8"})})}),e.jsxs("div",{className:"absolute bottom-2 left-2 flex items-center gap-1.5 px-2 py-1 rounded bg-video-overlay text-white text-xs",children:[r?e.jsx(L.MicOff,{className:"w-3 h-3"}):e.jsx(L.Mic,{className:"w-3 h-3"}),e.jsx("span",{className:"truncate max-w-35",children:t})]})]})}function jt({attach:t,active:s=!0,mirrored:r=!1,className:n}){const a=d.useRef(null);return d.useEffect(()=>{if(!s||!a.current)return;const l=t(a.current);return()=>{typeof l=="function"&&l(),a.current&&(a.current.innerHTML="")}},[t,s]),e.jsx("div",{ref:a,className:c("w-full h-full bg-video-surface-strong overflow-hidden",r&&"[&>*]:scale-x-[-1]",n)})}const yt={primary:"bg-accent text-accent-fg hover:bg-accent-hover disabled:bg-surface-hover",secondary:"bg-surface-sunk text-text-strong hover:bg-surface-hover disabled:bg-surface-hover",outline:"border border-border text-text-strong hover:bg-surface-hover",ghost:"text-text-muted hover:bg-surface-hover hover:text-text",destructive:"border border-danger-border bg-danger-soft text-danger-fg hover:border-danger disabled:bg-surface-hover",success:"bg-success text-text-inverse hover:opacity-90 disabled:bg-surface-hover",warning:"bg-warning text-text-inverse hover:opacity-90 disabled:bg-surface-hover","danger-solid":"bg-danger text-text-inverse hover:opacity-90 disabled:bg-surface-hover"},Nt={xs:"h-control-xs px-2 text-xs",sm:"h-control-sm px-3 text-sm",md:"h-control-md px-4 text-sm",lg:"h-control-lg px-4 text-sm",xl:"h-control-xl px-6 text-base","2xl":"h-control-2xl px-6 text-base",full:"h-control-md px-4 text-sm"},wt={xs:"h-control-xs w-6",sm:"h-control-sm w-7",md:"h-control-md w-8",lg:"h-control-lg w-9",xl:"h-control-xl w-10","2xl":"h-control-2xl w-12",full:"h-control-md w-8"},se=d.forwardRef(({variant:t="primary",size:s="md",fullWidth:r=!1,loading:n=!1,leftIcon:a,rightIcon:l,iconOnly:o=!1,shape:f="default",className:i,children:v,disabled:m,...x},b)=>{const p=m||n;return e.jsxs("button",{ref:b,type:"button",className:c("inline-flex shrink-0 items-center justify-center gap-2 cursor-pointer font-medium",f==="circle"?"rounded-full":"rounded-md","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:border-border-subtle","disabled:text-text-disabled",yt[t],o?wt[s]:Nt[s],(r||s==="full")&&"w-full",n&&"cursor-wait",i),disabled:p,"aria-busy":n||void 0,...x,children:[n&&e.jsx("span",{"aria-hidden":!0,className:"size-icon-md shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent"}),!n&&a&&e.jsx("span",{className:"flex items-center justify-center shrink-0",children:a}),!o&&v,!n&&l&&e.jsx("span",{className:"flex items-center justify-center shrink-0",children:l}),o&&!n&&!a&&!l&&v]})});se.displayName="Button";const kt=({children:t,size:s="md",orientation:r="horizontal",attached:n=!0,className:a})=>{const l=c("inline-flex",{"flex-row":r==="horizontal","flex-col":r==="vertical","[&>*:not(:first-child):not(:last-child)]:rounded-none":n,"[&>*:first-child]:rounded-r-none":n&&r==="horizontal","[&>*:last-child]:rounded-l-none":n&&r==="horizontal","[&>*:first-child]:rounded-b-none":n&&r==="vertical","[&>*:last-child]:rounded-t-none":n&&r==="vertical","[&>*:not(:first-child)]:-ml-px":n&&r==="horizontal","[&>*:not(:first-child)]:-mt-px":n&&r==="vertical","gap-1":!n&&s==="xs","gap-2":!n&&(s==="sm"||s==="md"),"gap-3":!n&&(s==="lg"||s==="xl")},a);return e.jsx("div",{className:l,role:"group",children:t})};function Ct(t){if(!t)return;const s=t.split(/[-_ ]/).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(""),r=dt[s];return typeof r=="function"||typeof r=="object"&&r!==null?r:void 0}const St={primary:"text-text",secondary:"text-text-muted",accent:"text-accent",success:"text-success-fg",warning:"text-warning-fg",error:"text-danger-fg",info:"text-info-fg",neutral:"text-text-subtle",current:"text-current"},G=({icon:t,size:s="md",color:r="current",clickable:n=!1,onClick:a,className:l,"aria-label":o,...f})=>{const i=typeof s=="number"?s:Et(s),v=c("inline-block shrink-0",St[r],n&&["cursor-pointer rounded-sm transition-opacity duration-fast ease-out hover:opacity-80","focus-visible:outline-none focus-visible:focus-ring"],l),m={size:i,strokeWidth:2,className:v,onClick:n?a:void 0,"aria-label":o,"aria-hidden":o?void 0:!0,role:n?"button":void 0,tabIndex:n?0:void 0,onKeyDown:n?x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),a?.())}:void 0,...f};return e.jsx(t,{...m})};function Et(t){return{xs:12,sm:14,md:16,lg:20,xl:24}[t]}const ze=({trigger:t,children:s,placement:r="bottom-start",className:n,rootClassName:a,triggerClassName:l,disabled:o=!1,triggerLabel:f})=>{const[i,v]=d.useState(!1),m=d.useRef(null),x=d.useRef(null),b=pe(i,x,{placement:r});d.useEffect(()=>{if(!i)return;const g=z=>{m.current&&!m.current.contains(z.target)&&v(!1)},h=z=>{z.key==="Escape"&&v(!1)};return document.addEventListener("mousedown",g),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",h)}},[i]);const p=g=>{g.stopPropagation(),!o&&v(h=>!h)},N=()=>v(!1);return e.jsxs("div",{ref:m,className:c("relative inline-flex",a),children:[e.jsx("button",{ref:x,type:"button",onClick:p,disabled:o,"aria-label":f,"aria-expanded":i,className:c("inline-flex items-center",o&&"cursor-not-allowed opacity-50",l),children:t}),i&&e.jsx("div",{className:c("fixed z-overlay overflow-y-auto rounded-lg border border-border bg-surface shadow-overlay",n),style:b,children:typeof s=="function"?s(N):s})]})},Tt={none:"hover:bg-surface-sunk hover:text-text",default:"bg-surface-sunk text-text-muted hover:text-text",muted:"bg-surface-sunk text-text-subtle hover:text-text",outline:"text-text-muted ring-1 ring-inset ring-border-strong hover:bg-surface-hover hover:text-text",warning:"bg-warning-soft text-warning-fg",danger:"bg-danger-soft text-danger-fg"},zt=t=>c("inline-flex cursor-pointer select-none items-center text-sm font-medium",t.size==="sm"?"h-control-sm":"h-control-md","transition-colors duration-fast ease-out",t.shape==="pill"?"rounded-full":"rounded-md",t.active?"bg-info-soft text-info-fg":Tt[t.tone??"default"],t.className),Mt=t=>c("inline-flex items-center gap-1.5 pl-3",t.shape==="pill"?"rounded-full":"rounded-md",t.withClear?"pr-1.5":"pr-3","focus-visible:outline-none focus-visible:focus-ring");function Oe({label:t,icon:s,tone:r="default",shape:n="rect",size:a="md",active:l=!1,caret:o=!1,menu:f,menuClassName:i,onClear:v,clearLabel:m="Filter wissen",onClick:x,title:b,className:p}){const N=l&&!!v,g=n==="pill"?"rounded-full":"rounded-md",h=zt({active:l,tone:r,shape:n,size:a,className:p}),z=e.jsxs(e.Fragment,{children:[s,t,o&&e.jsx(G,{icon:L.ChevronDown,size:"xs"})]}),k=Mt({shape:n,withClear:N}),V=N&&e.jsx("button",{type:"button","aria-label":m,onClick:v,className:c("inline-flex h-full items-center pr-3 focus-visible:outline-none focus-visible:focus-ring",g),children:e.jsx(G,{icon:L.X,size:"xs"})});return f?e.jsxs("span",{className:h,title:b,children:[e.jsx(ze,{trigger:z,rootClassName:"h-full",triggerClassName:c(k,"h-full"),className:c("min-w-menu p-1.5",i),children:f}),V]}):N?e.jsxs("span",{className:h,title:b,children:[e.jsx("button",{type:"button",onClick:x,className:k,children:z}),V]}):e.jsx("button",{type:"button",title:b,onClick:x,className:c(h,k),children:z})}const Dt={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-md",xl:"text-lg"},_t={primary:"text-text hover:text-info-fg hover:underline",info:"text-info-fg hover:underline",secondary:"text-text-muted hover:text-text",neutral:"text-text-muted hover:text-text",accent:"text-accent hover:underline",success:"text-success-fg hover:underline",warning:"text-warning-fg hover:underline",error:"text-danger-fg hover:underline"},At={primary:"bg-accent-soft",accent:"bg-accent-soft",secondary:"bg-surface-hover",neutral:"bg-surface-hover",success:"bg-success-soft",warning:"bg-warning-soft",error:"bg-danger-soft",info:"bg-info-soft"},$t=({variant:t="default",size:s="md",color:r="primary",disabled:n=!1,external:a=!1,className:l,children:o,href:f,target:i,rel:v,...m})=>{const x=a||f&&(f.startsWith("http")||f.startsWith("mailto:")),b=c("inline-flex items-center gap-1 underline-offset-2","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",Dt[s],!n&&_t[r],t==="subtle"&&"no-underline opacity-70 hover:opacity-100",t==="underline"&&"underline decoration-1 hover:decoration-2",t==="button"&&["h-control-md rounded-md px-3 font-semibold no-underline hover:no-underline",At[r]],n&&"pointer-events-none cursor-not-allowed text-text-disabled opacity-50",l),p={...m,href:n?void 0:f,target:x?"_blank":i,rel:x?"noopener noreferrer":v,"aria-disabled":n||void 0};return e.jsxs("a",{className:b,...p,children:[o,x&&e.jsx(L.ExternalLink,{className:"size-icon-sm shrink-0","aria-hidden":!0})]})},Lt={sm:"h-control-sm px-3 text-sm",md:"h-control-md px-3 text-sm"};function Be({options:t,value:s,onChange:r,size:n="sm",tone:a="sunk",fullWidth:l=!1,className:o,"aria-label":f}){return e.jsx("div",{role:"tablist","aria-label":f,className:c("gap-0.5 rounded-md p-0.5",a==="track"?"bg-surface-track":"bg-surface-sunk",l?"flex w-full":"inline-flex",o),children:t.map(i=>{const v=i.value===s;return e.jsx("button",{role:"tab","aria-selected":v,type:"button",onClick:()=>r(i.value),className:c("inline-flex cursor-pointer items-center justify-center gap-1.5 rounded-sm","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",l&&"min-w-0 flex-1",Lt[n],v?"bg-surface text-text font-medium shadow-sm":"text-text-muted hover:text-text"),children:i.label},i.value)})})}const Pt={primary:"bg-accent text-accent-fg hover:bg-accent-hover",secondary:"border border-border bg-surface text-text hover:bg-surface-hover",outline:"border border-accent-border text-accent hover:bg-accent-soft"},Rt={sm:"h-control-sm w-7",md:"h-control-md w-8"};function Me({label:t,onClick:s,variant:r="primary",size:n="md",icon:a,options:l,disabled:o=!1,loading:f=!1,menuPlacement:i="bottom-end",menuLabel:v="More options"}){const m=o||f,x=l.length>0;return e.jsxs("div",{className:c("inline-flex items-center",r==="primary"&&"gap-px"),children:[e.jsx(se,{variant:r,size:n,onClick:s,disabled:o,loading:f,leftIcon:a,className:c(x&&"rounded-r-none"),children:t}),x&&e.jsx(ze,{placement:i,disabled:m,triggerLabel:v,className:"min-w-menu py-1",trigger:e.jsx("span",{"aria-hidden":"true",className:c("inline-flex items-center justify-center rounded-md rounded-l-none","transition-colors duration-fast ease-out",Pt[r],Rt[n],m&&"cursor-not-allowed opacity-50"),children:e.jsx(L.ChevronDown,{className:"size-icon-md"})}),children:b=>e.jsx(e.Fragment,{children:l.map(p=>e.jsxs("button",{type:"button",onClick:()=>{p.onClick(),b()},className:c("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",p.variant==="destructive"?"text-danger-fg hover:bg-danger-soft":"text-text hover:bg-surface-hover"),children:[p.icon&&e.jsx("span",{className:"shrink-0",children:p.icon}),p.label]},p.id))})})]})}const It={sm:"size-checkbox-sm",md:"size-checkbox",lg:"size-checkbox-lg",full:"size-checkbox"},Ft={sm:"min-h-control-sm",md:"min-h-control-md",lg:"min-h-control-lg",full:"min-h-control-md"},Ot={sm:"text-sm",md:"text-base",lg:"text-md",full:"text-base"},fe=d.forwardRef(({label:t,helperText:s,error:r,size:n="md",indeterminate:a=!1,containerClassName:l,labelClassName:o,className:f,id:i,...v},m)=>{const x=d.useId(),b=i||`checkbox-${x}`,p=!!r,N=d.useRef(null),g=d.useCallback(h=>{N.current=h,typeof m=="function"?m(h):m&&typeof m=="object"&&(m.current=h)},[m]);return d.useEffect(()=>{N.current&&(N.current.indeterminate=a)},[a]),e.jsxs("div",{className:c("flex flex-col",l),children:[e.jsxs("div",{className:c("flex items-center gap-3",Ft[n]),children:[e.jsx("input",{ref:g,id:b,type:"checkbox","aria-invalid":p||void 0,className:c("shrink-0 rounded-xs border accent-accent","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:bg-surface-hover",It[n],p?"border-danger-border":"border-border-strong",f),...v}),t&&e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{htmlFor:b,className:c("cursor-pointer",p?"text-danger-fg":"text-text",Ot[n],o),children:t}),s&&!r&&e.jsx("p",{className:"mt-0.5 text-xs text-text-subtle",children:s})]})]}),r&&e.jsx("p",{className:"mt-1 text-xs text-danger-fg",children:r})]})});fe.displayName="Checkbox";const Bt=()=>e.jsx(G,{icon:L.Calendar,size:"md",color:"current"}),Ht=()=>e.jsx(G,{icon:L.ChevronLeft,size:"md",color:"current"}),qt=()=>e.jsx(G,{icon:L.ChevronRight,size:"md",color:"current"}),ye=d.forwardRef(({value:t,onChange:s,placeholder:r="Select date",disabled:n=!1,required:a=!1,size:l="md",className:o,minDate:f,maxDate:i,format:v="MM/dd/yyyy",withTime:m=!1},x)=>{const[b,p]=d.useState(!1),[N,g]=d.useState(()=>t||new Date),h=d.useRef(null),z=d.useRef(null),k=pe(b,z);d.useEffect(()=>{const u=S=>{h.current&&!h.current.contains(S.target)&&p(!1)};return b&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[b]);const V=u=>{if(!u)return"";const S=u.getDate().toString().padStart(2,"0"),j=(u.getMonth()+1).toString().padStart(2,"0"),A=u.getFullYear(),y=v==="dd/MM/yyyy"?`${S}/${j}/${A}`:v==="yyyy-MM-dd"?`${A}-${j}-${S}`:`${j}/${S}/${A}`;return m?`${y} ${_(u)}`:y},_=u=>`${u.getHours().toString().padStart(2,"0")}:${u.getMinutes().toString().padStart(2,"0")}`,Y=u=>{const[S,j]=u.split(":").map(Number);if(Number.isNaN(S)||Number.isNaN(j))return;const A=t?new Date(t):new Date;A.setHours(S,j,0,0),s?.(A)},q=()=>{const u=N.getFullYear(),S=N.getMonth(),j=new Date(u,S,1),A=new Date(j);A.setDate(A.getDate()-j.getDay());const y=[],K=new Date(A);for(let re=0;re<42;re++)y.push(new Date(K)),K.setDate(K.getDate()+1);return y},P=u=>{if(u.getMonth()===N.getMonth()&&!(f&&u<f)&&!(i&&u>i)){if(m){const j=new Date(u);j.setHours(t?.getHours()??0,t?.getMinutes()??0,0,0),s?.(j);return}s?.(u),p(!1)}},H=()=>{g(new Date(N.getFullYear(),N.getMonth()-1,1))},ee=()=>{g(new Date(N.getFullYear(),N.getMonth()+1,1))},J=()=>{s?.(null),p(!1)},W=c("w-full border border-border-strong rounded-tile transition-colors duration-fast","bg-surface text-text","placeholder:text-text-muted","focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:bg-surface-hover disabled:text-text-disabled",{"h-control-sm px-3 text-sm":l==="sm","h-control-md px-3 text-base":l==="md","h-control-lg px-3 text-base":l==="lg","h-control-md w-full px-3 text-base":l==="full"},o),le=q(),w=["January","February","March","April","May","June","July","August","September","October","November","December"];return e.jsxs("div",{ref:h,className:"relative",children:[e.jsxs("div",{ref:z,className:"relative",children:[e.jsx("input",{ref:x,type:"text",value:V(t??null),placeholder:r,disabled:n,required:a,readOnly:!0,onClick:()=>!n&&p(!b),className:c(W,"pr-10 cursor-pointer")}),e.jsx("button",{type:"button",onClick:()=>!n&&p(!b),disabled:n,className:"absolute inset-y-0 right-0 flex items-center pr-3 text-text-muted hover:text-text-muted",children:e.jsx(Bt,{})})]}),b&&e.jsxs("div",{style:k,className:"fixed z-overlay overflow-auto rounded-lg border border-border bg-surface p-4 shadow-overlay min-w-panel",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("button",{onClick:H,className:"p-1 hover:bg-surface-hover rounded",children:e.jsx(Ht,{})}),e.jsxs("h3",{className:"text-sm font-medium text-text",children:[w[N.getMonth()]," ",N.getFullYear()]}),e.jsx("button",{onClick:ee,className:"p-1 hover:bg-surface-hover rounded",children:e.jsx(qt,{})})]}),e.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:["Su","Mo","Tu","We","Th","Fr","Sa"].map(u=>e.jsx("div",{className:"text-xs font-medium text-text-muted text-center py-1",children:u},u))}),e.jsx("div",{className:"grid grid-cols-7 gap-1",children:le.map((u,S)=>{const j=u.getMonth()===N.getMonth(),A=t&&u.toDateString()===t.toDateString(),y=u.toDateString()===new Date().toDateString(),K=!j||f&&u<f||i&&u>i;return e.jsx("button",{onClick:()=>!K&&P(u),disabled:K,className:c("w-8 h-8 text-sm rounded transition-colors duration-fast",{"text-text hover:bg-surface-hover":j&&!A&&!K,"bg-accent text-accent-fg":A,"bg-surface-hover text-text":y&&!A,"text-text-muted cursor-not-allowed":K}),children:u.getDate()},S)})}),m&&e.jsxs("div",{className:"mt-3 flex items-center gap-2 border-t border-border pt-3",children:[e.jsx("label",{htmlFor:"datepicker-time",className:"text-sm text-text-muted",children:"Tijd"}),e.jsx("input",{id:"datepicker-time",type:"time",value:t?_(t):"",onChange:u=>Y(u.target.value),className:"h-control-sm rounded-md border border-border bg-surface-input px-2 text-sm text-text focus-visible:outline-none focus-visible:focus-ring"})]}),e.jsxs("div",{className:"flex justify-between items-center mt-4 pt-3 border-t border-border",children:[e.jsx("button",{onClick:J,className:"text-sm text-text-muted hover:text-text",children:"Clear"}),e.jsx("button",{onClick:()=>p(!1),className:"text-sm text-info-fg hover:underline",children:"Close"})]})]})]})}),Vt={sm:"h-control-sm px-3 text-sm",md:"h-control-md px-3 text-sm",lg:"h-control-lg px-3 text-base",full:"h-control-md w-full px-3 text-sm"},ve=t=>t.trim().toLowerCase(),be=d.forwardRef(({label:t,helperText:s,error:r,size:n="md",fullWidth:a=!1,disabled:l=!1,options:o,placeholder:f,containerClassName:i,labelClassName:v,className:m,id:x,searchable:b,multiple:p,value:N,onChange:g,allowCreate:h,onCreateOption:z,...k},V)=>{const _=x||`select-${Math.random().toString(36).substr(2,9)}`,Y=!!r,[q,P]=d.useState(!1),[H,ee]=d.useState(""),J=d.useRef(null),W=d.useRef(null),le=pe(q,W,{matchWidth:!0}),[w,u]=d.useState(o);d.useImperativeHandle(V,()=>J.current),d.useEffect(()=>{const M=D=>{J.current&&!J.current.contains(D.target)&&P(!1)};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[]);const S=d.useCallback((M,D)=>M.some(E=>ve(E.value)===ve(D)||ve(E.label)===ve(D)),[]),j=d.useCallback((M,D)=>{const E=[...M],F=I=>{const O=(I??"").trim();O&&(S(E,O)||E.push({value:O,label:O}))};return Array.isArray(D)?D.forEach(F):F(D),E},[S]);d.useEffect(()=>{u(M=>{const D=[...o];return M.forEach(E=>{!S(D,E.value)&&!S(D,E.label)&&D.push(E)}),j(D,N)})},[o,N,j,S]);const A=M=>{if(p){const D=Array.isArray(N)?N:[],E=D.includes(M)?D.filter(F=>F!==M):[...D,M];g?.(E)}else g?.(M),P(!1),ee("")},y=p?null:w.find(M=>M.value===N),K=p?w.filter(M=>Array.isArray(N)&&N.includes(M.value)):[],re=b&&H?w.filter(M=>M.label.toLowerCase().includes(H.toLowerCase())):w,Q=!!h&&!!b&&!!H.trim()&&!S(w,H),X=M=>{const D=M.trim();if(!D)return;const E=z?.(D)??{value:D,label:D};if(S(w,E.value)||S(w,E.label)){A(E.value),ee(""),p||P(!1);return}u(F=>[...F,E]),A(E.value),ee(""),p||P(!1)},R=()=>p?K.length>0?K.map(M=>M.label).join(", "):f||"Select options":y?.label||f||"Select an option";return e.jsxs("div",{ref:J,className:c("relative flex flex-col",a&&"w-full",i),...k,children:[t&&e.jsx("label",{htmlFor:_,onClick:()=>P(!q),className:c("block text-xs font-semibold uppercase tracking-label mb-1.5",Y?"text-danger-fg":"text-text-muted",v),children:t}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{ref:W,type:"button",id:_,disabled:l,onClick:()=>P(!q),className:c("flex w-full items-center justify-between gap-2 rounded-tile border transition-colors duration-fast text-left","focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:bg-surface-hover disabled:text-text-disabled","bg-surface",Vt[n],Y?"border-danger-border text-danger-fg focus-visible:focus-ring":"border-border-strong text-text",m),children:[e.jsx("span",{className:"truncate flex-1 min-w-0",children:R()}),e.jsx(L.ChevronDownIcon,{size:16,className:c("shrink-0 opacity-60 transition-transform duration-fast",q&&"rotate-180")})]}),q&&e.jsxs("div",{style:le,className:"fixed z-overlay flex flex-col overflow-hidden rounded-lg border border-border bg-surface shadow-overlay",children:[b&&e.jsx("div",{className:"p-2",children:e.jsx("input",{type:"text",placeholder:"Search...",value:H,onChange:M=>ee(M.target.value),onKeyDown:M=>{M.key==="Enter"&&Q&&(M.preventDefault(),X(H))},className:c("w-full px-3 py-2 text-sm rounded-md border","text-text border-border focus-visible:outline-none focus-visible:focus-ring")})}),Q&&e.jsxs("div",{className:c("cursor-pointer px-3 py-1.5 text-sm","text-info-fg hover:bg-surface-hover"),onClick:()=>X(H),children:["+: “",H.trim(),"”"]}),e.jsxs("ul",{className:"min-h-0 flex-1 overflow-auto py-1",children:[f&&!p&&e.jsx("li",{className:"cursor-pointer px-3 py-1.5 text-sm text-text-muted hover:bg-surface-hover",onClick:()=>{g?.(""),P(!1)},children:f}),re.map(M=>{const D=p?Array.isArray(N)&&N.includes(M.value):N===M.value;return e.jsx("li",{onClick:()=>!M.disabled&&A(M.value),className:c("cursor-pointer px-3 py-1.5 text-sm","text-text",M.disabled?"opacity-50 cursor-not-allowed":"hover:bg-surface-hover",D&&"bg-accent-soft text-accent font-semibold"),children:e.jsxs("div",{className:"flex items-center",children:[p&&e.jsx("input",{type:"checkbox",checked:D,readOnly:!0,className:"mr-3 h-4 w-4 rounded border-border [&:not(:checked)]:bg-surface-input text-accent "}),e.jsx("span",{children:M.label})]})},M.value)})]})]})]}),(r||s)&&e.jsx("p",{className:c("mt-1 text-xs",Y?"text-danger-fg":"text-text-muted"),children:r||s})]})});be.displayName="Select";const Ut={sm:"h-control-sm px-3 text-sm",md:"h-control-md px-3 text-base",lg:"h-control-lg px-3 text-base",full:"h-control-md px-3 text-base"},He="mb-1.5 block text-sm font-medium",qe="block w-full rounded-tile border bg-surface-input text-text transition-colors duration-fast ease-out placeholder:text-text-subtle focus-visible:outline-none focus-visible:focus-ring disabled:cursor-not-allowed disabled:bg-surface-hover disabled:text-text-disabled",Ve=t=>t?"border-danger-border bg-danger-soft":"border-border-strong",he=d.forwardRef(({label:t,helperText:s,error:r,size:n="md",fullWidth:a=!1,startIcon:l,endIcon:o,loading:f=!1,containerClassName:i,labelClassName:v,className:m,id:x,...b},p)=>{const N=d.useId(),g=x||`textfield-${N}`,h=!!r,z=r||s?`${g}-description`:void 0;return e.jsxs("div",{className:c("flex flex-col",a&&"w-full",i),children:[t&&e.jsx("label",{htmlFor:g,className:c(He,h?"text-danger-fg":"text-text-muted",v),children:t}),e.jsxs("div",{className:"relative",children:[l&&e.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3 text-text-muted",children:l}),e.jsx("input",{ref:p,id:g,"aria-invalid":h||void 0,"aria-describedby":z,className:c(qe,Ut[n],l&&"pl-9",(o||f)&&"pr-9",Ve(h),m),...b}),(o||f)&&e.jsx("span",{className:"absolute inset-y-0 right-0 flex items-center pr-3 text-text-muted",children:f?e.jsx("span",{"aria-hidden":!0,className:"size-icon-md animate-spin rounded-full border-2 border-border border-t-transparent"}):o})]}),(r||s)&&e.jsx("p",{id:z,className:c("mt-1 text-xs",h?"text-danger-fg":"text-text-subtle"),children:r||s})]})});he.displayName="TextField";function Ue({value:t,onChange:s,onListFolders:r,disabled:n,size:a="md",placeholder:l,templatePlaceholder:o,showTemplate:f=!0}){const[i,v]=d.useState([]);d.useEffect(()=>{let x=!0;return Promise.resolve(r?.()).then(b=>{x&&b&&v(b.data??[])}).catch(()=>{}),()=>{x=!1}},[]);const m=t??{};return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(be,{size:a,fullWidth:!0,value:m.folderId??"",options:i.map(x=>({value:x.id,label:x.name})),placeholder:l??"Select a folder",onChange:x=>s?.({...m,folderId:x})}),f&&e.jsx(he,{size:a,disabled:n??!1,value:m.pathTemplate??"",placeholder:o??"Sub-path e.g. {yyyy}/{mm}/{dd} (optional)",onChange:x=>s?.({...m,pathTemplate:x.target.value})})]})}const me=(...t)=>t.filter(Boolean).join(" "),Kt=t=>e.jsx(L.Search,{...t,strokeWidth:1.5,"aria-hidden":!0}),Wt=t=>e.jsx(L.ChevronDown,{...t,strokeWidth:1.5,"aria-hidden":!0}),Gt={sm:"h-control-sm px-3 text-sm",md:"h-control-md px-3 text-base",lg:"h-control-lg px-3 text-base",full:"h-control-md w-full px-3 text-base"},ke={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",full:"h-6 w-6"},Ke=d.forwardRef(({label:t,helperText:s,error:r,size:n="md",fullWidth:a=!1,startIcon:l=e.jsx(Kt,{}),loading:o=!1,containerClassName:f,labelClassName:i,className:v,id:m,options:x,onRemoteSearch:b,onSelect:p,debounceTime:N=500,showAllOnOpen:g=!1,value:h,onChange:z,...k},V)=>{const _=m||`searchfield-${Math.random().toString(36).substr(2,9)}`,Y=!!r,q=d.useRef(null),P=d.useRef(null),[H,ee]=d.useState(h||""),[J,W]=d.useState(!1),[le,w]=d.useState(!1),[u,S]=d.useState(!1);d.useEffect(()=>{h!==void 0&&ee(h)},[h]);const j=d.useMemo(()=>{if(g&&!u||!H)return x;const R=String(H).toLowerCase();return x.filter(M=>String(M.label).toLowerCase().includes(R))},[H,x,g,u]);d.useEffect(()=>{if(!b||!H){w(!1);return}const R=setTimeout(async()=>{w(!0);try{await b(String(H))}catch(M){console.error("Remote search failed:",M)}finally{w(!1)}},N);return()=>{clearTimeout(R),w(!1)}},[H,N,b]),d.useEffect(()=>{const R=M=>{q.current&&!q.current.contains(M.target)&&W(!1)};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[]);const A=R=>{const M=R.target.value;ee(M),W(!0),S(!0),z&&z(R)},y=R=>{ee(R.label),W(!1),S(!1),p&&p(R.value)},K=()=>{(x.length>0||b)&&(W(!0),S(!1))},re=o||le,Q=J&&(j.length>0||re),X=d.useMemo(()=>V||P,[V]);return e.jsxs("div",{className:me("flex flex-col",a?"w-full":"",f||"","relative"),ref:q,children:[t&&e.jsx("label",{htmlFor:_,className:me("block text-sm font-medium mb-1",Y?"text-danger-fg":"text-text",i||""),children:t}),e.jsxs("div",{className:"relative",children:[l&&e.jsx("div",{className:"absolute left-0 pl-3 flex items-center pointer-events-none h-full",children:e.jsx("span",{className:me("text-text-muted",ke[n]),children:l})}),e.jsx("input",{ref:X,id:_,value:H,onChange:A,onFocus:K,className:me("block w-full rounded-tile border bg-surface-input transition-colors duration-fast ease-out","placeholder:text-text-subtle focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:bg-surface-hover disabled:text-text-disabled",Gt[n],l?"pl-10":"","pr-10",Y?"border-danger-border text-danger-fg focus-visible:focus-ring":"border-border-strong text-text",v||""),...k}),e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center",children:re||o?e.jsx(L.Loader2,{className:me("animate-spin text-info-fg",ke[n]),"aria-hidden":!0}):e.jsx(Wt,{className:me("text-text-muted cursor-pointer transition-transform",ke[n],J?"rotate-180":"rotate-0"),onClick:()=>{W(R=>(R||S(!1),!R))}})})]}),Q&&e.jsx("ul",{className:"absolute z-10 mt-1 w-full bg-surface border border-border rounded-lg shadow-lg max-h-60 overflow-auto top-full",role:"listbox",children:j.length>0?j.map(R=>e.jsx("li",{className:"px-4 py-2 cursor-pointer text-text hover:bg-accent-soft hover:text-accent transition-colors",onClick:()=>y(R),role:"option","aria-selected":H===R.label,children:R.label},R.value)):e.jsx("li",{className:"px-4 py-2 text-text-muted",children:re||o?"Zoeken op afstand...":"Geen resultaten gevonden."})}),(r||s)&&e.jsx("p",{className:me("mt-1 text-xs",Y?"text-danger-fg":"text-text-muted"),children:r||s}),b&&e.jsxs("p",{className:"mt-2 text-xs text-success-fg",children:["Huidige zoekterm (niet-gedebounced): ",String(H)]})]})});Ke.displayName="SearchableTextField";const De=d.forwardRef(({value:t,onValueChange:s,hint:r,size:n="md",clearLabel:a="Clear search",containerClassName:l,className:o,disabled:f,...i},v)=>e.jsxs("div",{className:c("flex items-center gap-2 rounded-md bg-surface-sunk px-2.5 text-text-muted","transition-colors duration-fast ease-out",n==="sm"?"h-control-sm":"h-control-md",f&&"opacity-60",l),children:[e.jsx(G,{icon:L.Search,size:"md",color:"current",className:"shrink-0"}),e.jsx("input",{ref:v,type:"search",value:t,disabled:f,onChange:m=>s(m.target.value),className:c("min-w-0 flex-1 border-0 bg-transparent p-0 text-sm text-text shadow-none","placeholder:text-text-subtle","focus:border-0 focus:shadow-none focus:outline-none focus:ring-0","[&::-webkit-search-cancel-button]:appearance-none",o),...i}),t?e.jsx("button",{type:"button","aria-label":a,onClick:()=>s(""),className:"grid size-4 shrink-0 cursor-pointer place-items-center rounded-xs text-text-subtle transition-colors duration-fast ease-out hover:text-text focus-visible:outline-none focus-visible:focus-ring",children:e.jsx(G,{icon:L.X,size:"sm",color:"current"})}):r&&e.jsx("span",{className:"shrink-0 text-xs text-text-subtle",children:r})]}));De.displayName="SearchField";const We=d.forwardRef(({checked:t,onChange:s,label:r,disabled:n=!1,className:a,...l},o)=>{const f=e.jsx("span",{"aria-hidden":!0,className:c("relative inline-flex size-switch-track shrink-0 items-center rounded-full","transition-colors duration-fast ease-out",t?"bg-accent":"bg-surface-hover",n&&"opacity-50"),children:e.jsx("span",{className:c("absolute left-0.5 size-switch-knob rounded-full bg-surface shadow-overlay","transition-transform duration-fast ease-out",t&&"translate-switch")})});return e.jsxs("label",{className:c("inline-flex items-center gap-2",n?"cursor-not-allowed":"cursor-pointer",a),children:[e.jsx("input",{ref:o,type:"checkbox",role:"switch",checked:t,disabled:n,onChange:i=>s(i.target.checked),className:"peer sr-only",...l}),e.jsx("span",{className:"inline-flex rounded-full peer-focus-visible:focus-ring",children:f}),r&&e.jsx("span",{className:"text-sm text-text",children:r})]})});We.displayName="Switch";const Ge=({trigger:t,options:s,value:r,onSelect:n,placement:a="bottom-start",disabled:l=!1,className:o,showCheck:f=!0,header:i})=>{const[v,m]=d.useState(!1),[x,b]=d.useState(null),[p,N]=d.useState({top:0,left:0}),g=d.useRef(null),h=d.useRef(null),z=d.useRef(null),k=d.useRef(null),V=pe(v,h,{placement:a}),_=d.useRef(null),Y=()=>Array.from(k.current?.querySelectorAll("button[data-option-value]:not(:disabled)")??[]);d.useEffect(()=>{v&&Y()[0]?.focus()},[v]);const q=u=>{if(!["ArrowDown","ArrowUp","Home","End"].includes(u.key))return;const j=Y();if(j.length===0)return;u.preventDefault();const A=j.indexOf(document.activeElement),y=u.key==="Home"?0:u.key==="End"?j.length-1:u.key==="ArrowDown"?(A+1)%j.length:(A-1+j.length)%j.length;j[y]?.focus()};d.useEffect(()=>{const u=S=>{g.current&&(!g.current.contains(S.target)||z.current&&!z.current.contains(S.target))&&(m(!1),b(null),_.current&&(clearTimeout(_.current),_.current=null))};return v&&document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}},[v]),d.useEffect(()=>{const u=S=>{S.key==="Escape"&&(m(!1),b(null),h.current?.focus(),_.current&&(clearTimeout(_.current),_.current=null))};return v&&document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}},[v]),d.useEffect(()=>{if(x&&g.current){const u=g.current.querySelector(`[data-option-value="${x}"]`);if(u){const S=u.getBoundingClientRect();N({top:S.top,left:S.right+8})}}},[x]),d.useEffect(()=>()=>{_.current&&clearTimeout(_.current)},[]);const P=u=>{u.stopPropagation(),!l&&(m(!v),b(null),_.current&&(clearTimeout(_.current),_.current=null))},H=(u,S,j)=>{u.stopPropagation(),!S.disabled&&!S.divider&&(!S.children||S.children.length===0)&&(n?.(S.value,j),m(!1),b(null))},ee=u=>{_.current&&(clearTimeout(_.current),_.current=null),u.children&&u.children.length>0?b(u.value):b(null)},J=u=>{u.children&&u.children.length>0?_.current=setTimeout(()=>{b(null)},150):b(null)},W=(u,S,j)=>{u.stopPropagation(),!S.disabled&&!S.divider&&(n?.(S.value,j),m(!1),b(null))},le=c("fixed z-overlay min-w-menu bg-surface rounded-lg shadow-overlay border border-border","max-h-60 overflow-auto"),w=c("fixed z-overlay min-w-menu bg-surface rounded-lg shadow-overlay border border-border","max-h-60 overflow-auto");return e.jsxs("div",{ref:g,className:c("relative flex flex-row items-center justify-center rounded-lg hover:bg-surface-hover",o),children:[e.jsx("button",{ref:h,onClick:P,disabled:l,"aria-haspopup":"menu","aria-expanded":v,className:c("inline-flex items-center justify-center",{"opacity-50 cursor-not-allowed":l}),children:t}),v&&e.jsx("div",{ref:k,className:le,style:V,onKeyDown:q,children:e.jsxs("div",{className:"p-2",role:"menu",children:[i&&(typeof i=="string"?e.jsx("div",{className:"text-xs font-medium text-text-muted uppercase tracking-label px-3 py-2",children:i}):i),s.map((u,S)=>{if(u.divider)return e.jsx("div",{className:"border-t border-border my-2"},`divider-${S}`);const j=u.children&&u.children.length>0,A=x===u.value;return e.jsxs("div",{className:"relative group",children:[e.jsxs("button",{"data-option-value":u.value,role:"menuitem","aria-haspopup":j?"menu":void 0,onClick:y=>H(y,u),onMouseEnter:()=>ee(u),onMouseLeave:()=>J(u),disabled:u.disabled,className:c("flex w-full items-center justify-between rounded-md px-3 py-1.5 text-sm text-text transition-colors duration-fast ease-out hover:bg-surface-hover focus-visible:outline-none focus-visible:focus-ring",{"opacity-50 cursor-not-allowed":u.disabled,"bg-surface-hover":A&&j}),children:[e.jsxs("div",{className:"flex items-center space-x-2 min-w-0",children:[u.icon&&e.jsx("span",{className:"flex-shrink-0",children:u.icon}),e.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[e.jsx("span",{className:"font-base truncate",children:u.label}),u.description&&e.jsx("span",{className:"text-xs text-text-muted",children:u.description})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[f&&r===u.value&&e.jsx(L.Check,{className:"size-icon-md shrink-0 text-success-fg","aria-hidden":!0}),j&&e.jsx("span",{className:"text-text-muted text-xs",children:"▶"})]})]}),j&&A&&e.jsx("div",{ref:z,className:w,style:{top:`${p.top}px`,left:`${p.left}px`},onMouseEnter:()=>{_.current&&(clearTimeout(_.current),_.current=null),b(u.value)},onMouseLeave:()=>{_.current=setTimeout(()=>{b(null)},150)},children:e.jsx("div",{className:"p-2",children:u.children.map((y,K)=>{if(y.divider)return e.jsx("div",{className:"border-t border-border my-2"},`divider-${K}`);const re=typeof r=="object"&&r[u.value]&&r[u.value].includes(y.value)||r===y.value;return e.jsxs("button",{onClick:Q=>W(Q,y,u.value),disabled:y.disabled,className:c("flex w-full items-center justify-between rounded-md px-3 py-1.5 text-sm text-text transition-colors duration-fast ease-out hover:bg-surface-hover",{"opacity-50 cursor-not-allowed":y.disabled}),children:[e.jsxs("div",{className:"flex items-center space-x-2 min-w-0",children:[y.icon&&e.jsx("span",{className:"flex-shrink-0",children:y.icon}),e.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[e.jsx("span",{className:"font-base truncate",children:y.label}),y.description&&e.jsx("span",{className:"text-xs text-text-muted",children:y.description})]})]}),f&&re&&e.jsx(L.Check,{className:"size-icon-md shrink-0 text-success-fg","aria-hidden":!0})]},y.value)})})})]},u.value)}),(()=>{const u=s.reduce((S,j)=>{if(j.divider)return S;const A=j.children?j.children.filter(y=>!y.divider).length:0;return S+1+A},0);return u>1&&e.jsx("div",{className:"border-t border-border mt-2 pt-2",children:e.jsxs("div",{className:"text-xs text-text-muted px-3 py-1",children:[u," options available"]})})})()]})})]})},ge=({actions:t,defaultVariant:s="secondary",className:r})=>t.length===0?null:e.jsx("div",{className:c("flex flex-wrap items-center gap-2",r),children:t.map(n=>n.render?e.jsx(d.Fragment,{children:n.render()},n.id):n.splitOptions&&n.splitOptions.length>0?e.jsx(Me,{label:n.label,onClick:n.onClick,icon:n.icon,variant:n.variant==="primary"?"primary":"secondary",options:n.splitOptions,disabled:n.disabled},n.id):e.jsx(se,{variant:n.variant??s,onClick:a=>{a.stopPropagation(),a.target.blur(),n.onClick()},disabled:n.disabled,leftIcon:n.icon,children:n.label},n.id))}),Yt={none:"p-0",sm:"p-2",md:"px-5 py-4",lg:"p-6"},Jt=({actions:t=[],onBack:s,backLabel:r="Back",className:n,padding:a="md",children:l})=>e.jsxs("div",{className:c("flex items-center gap-2",Yt[a],n),children:[s&&e.jsx(se,{variant:"secondary",onClick:s,"aria-label":r,leftIcon:e.jsx(G,{icon:L.ChevronLeft,size:"sm"}),iconOnly:!0}),l&&e.jsx("div",{className:"min-w-0 flex-1",children:l}),e.jsx(ge,{actions:t,className:c(!l&&"ml-auto")})]}),Xt=t=>s=>t(s instanceof Date?s:null),Zt=t=>s=>t(typeof s=="string"?s:""),Qt={none:"px-0",sm:"px-2",md:"px-3.5",lg:"px-5"},es={sm:"h-row-lg",md:"h-row-xl",lg:"h-14"},ts=8,Pe=["62%","44%","74%","52%","68%","48%","80%","56%"];function ss(t,s){if(s<=7)return Array.from({length:s},(l,o)=>o);const n=[...new Set([0,s-1,t-1,t,t+1])].filter(l=>l>=0&&l<s).sort((l,o)=>l-o),a=[];return n.forEach((l,o)=>{o>0&&l-n[o-1]>1&&a.push("gap"),a.push(l)}),a}const rs=t=>{const s=Array.isArray(t.value)?t.value:t.value!=null&&t.value!==""&&t.value!=="all"?[t.value]:[];if(t.type==="date"){const o=t.value instanceof Date;return e.jsx(ye,{value:t.value,onChange:f=>t.onChange(f),placeholder:t.placeholder||t.label,className:c("min-w-40",o&&"bg-info-soft text-info-fg")})}const r=o=>t.options?.find(f=>f.value===o)?.label??String(o),n=o=>Array.isArray(t.value)?t.value.includes(o):t.value===o,a=o=>{if(!t.multiSelect)return t.onChange(o);const f=Array.isArray(t.value)?t.value:[];t.onChange(f.includes(o)?f.filter(i=>i!==o):[...f,o])},l=s.length>0;return e.jsx(Oe,{tone:"outline",caret:!0,icon:t.icon,active:l,label:l?`${t.label}: ${s.map(r).join(", ")}`:t.label,title:t.label,onClear:()=>t.onChange(t.multiSelect?[]:"all"),menu:o=>e.jsx("div",{role:"listbox",className:"flex flex-col",children:t.options?.map(f=>e.jsx("button",{type:"button",role:"option","aria-selected":n(f.value),onClick:()=>{a(f.value),t.multiSelect||o()},className:c("flex cursor-pointer items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm","transition-colors duration-fast ease-out hover:bg-surface-hover","focus-visible:outline-none focus-visible:focus-ring",n(f.value)?"font-medium text-text":"text-text-muted"),children:f.label},f.value))})})},Ce=({data:t,columns:s,loading:r=!1,searchable:n=!1,searchPlaceholder:a="Search...",searchValue:l,onSearchChange:o,filters:f=[],toolbarActions:i=[],paginated:v=!1,defaultPageSize:m=10,actions:x=[],onRowClick:b,selectable:p=!1,selectedRows:N=[],onSelectionChange:g,getRowKey:h=(ee,J)=>J,emptyContent:z,footerSummary:k,size:V="md",hoverable:_=!0,padding:Y="md",className:q,rowClassName:P,headerBackground:H=!0})=>{const[ee,J]=d.useState(""),W=l!==void 0,le=W?l:ee,w=o??J,[u,S]=d.useState({column:null,direction:null}),[j,A]=d.useState({page:0,pageSize:m}),y=d.useRef(null),K=d.useMemo(()=>{let C=t;if(n&&!W&&le.trim()){const U=s.filter(ae=>ae.searchable!==!1),te=le.toLowerCase();C=C.filter(ae=>U.some(B=>{const ce=typeof B.accessor=="function"?B.accessor(ae):ae[B.accessor];return String(ce||"").toLowerCase().includes(te)}))}return f.forEach(U=>{U.value&&U.value!=="all"&&(C=C.filter(te=>{const ae=s.find(ce=>ce.id===U.id);if(!ae)return!0;const B=typeof ae.accessor=="function"?ae.accessor(te):te[ae.accessor];return String(B||"")===U.value}))}),C},[t,le,W,s,n,f]),re=d.useMemo(()=>{if(!u.column||!u.direction)return K;const C=s.find(U=>U.id===u.column);return C?[...K].sort((U,te)=>{const ae=typeof C.accessor=="function"?C.accessor(U):U[C.accessor],B=typeof C.accessor=="function"?C.accessor(te):te[C.accessor];let ce=0;return ae<B?ce=-1:ae>B&&(ce=1),u.direction==="desc"?-ce:ce}):K},[K,u,s]),Q=d.useMemo(()=>{if(!v)return re;const C=j.page*j.pageSize,U=C+j.pageSize;return re.slice(C,U)},[re,j,v]),X=d.useCallback(C=>{s.find(te=>te.id===C)?.sortable&&S(te=>te.column!==C?{column:C,direction:"asc"}:te.direction==="asc"?{column:C,direction:"desc"}:{column:null,direction:null})},[s]),R=d.useCallback(C=>{A(U=>({...U,page:C}))},[]),M=d.useCallback((C,U)=>{if(!g)return;const te=h(C,0);g(U?[...N,C]:N.filter((ae,B)=>h(N[B],B)!==te))},[N,g,h]),D=d.useCallback(C=>{g&&g(C?[...Q]:[])},[Q,g]);d.useEffect(()=>{A(C=>({...C,page:0}))},[le,u]),d.useEffect(()=>{A(C=>({...C,page:0}))},[f.map(C=>C.value).join(",")]);const E=re.length,F=Math.ceil(E/j.pageSize),I=j.page*j.pageSize+1,O=Math.min(I+j.pageSize-1,E),T=Q.length>0&&Q.every(C=>{const U=h(C,0);return N.some((te,ae)=>h(te,ae)===U)}),$=Q.some(C=>{const U=h(C,0);return N.some((te,ae)=>h(te,ae)===U)}),Z=Qt[Y],ne=H?"bg-surface-sunk":"bg-surface",oe=c("text-text",Z),xe=n||f.length>0||i.length>0,ue=v&&E>0,we=ue||k!==void 0;return e.jsxs("div",{className:c("flex min-w-0 flex-col",q),children:[xe&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pb-3",children:[n&&e.jsx(De,{value:le,onValueChange:w,placeholder:a,containerClassName:"w-full sm:w-66"}),f.map(C=>e.jsx(rs,{...C},C.id)),i.length>0&&e.jsx(ge,{actions:i,className:"ml-auto"})]}),e.jsx("div",{className:"relative w-full overflow-x-auto rounded-lg ring-1 ring-border",children:e.jsxs("table",{ref:y,className:"min-w-full border-collapse text-base text-text",children:[e.jsx("thead",{className:c(ne,"h-control-lg"),children:e.jsxs("tr",{children:[p&&e.jsx("th",{className:c(oe,"w-10"),children:e.jsx(fe,{size:"sm",checked:T,indeterminate:$&&!T,onChange:C=>D(C.target.checked),"aria-label":"Select all rows"})}),s.map(C=>e.jsx("th",{className:c(oe,"text-xs font-semibold uppercase tracking-label text-text-muted","group",{"text-left":C.align==="left"||!C.align,"text-center":C.align==="center","text-right":C.align==="right","cursor-pointer select-none":C.sortable,[`sticky left-0 ${ne}`]:C.sticky==="left",[`sticky right-0 ${ne}`]:C.sticky==="right"}),style:{width:C.width},onClick:()=>C.sortable&&X(C.id),children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[C.headerCell?C.headerCell():C.header,C.sortable&&e.jsx(G,{icon:u.column===C.id&&u.direction==="desc"?L.ChevronDown:L.ChevronUp,size:"xs",className:c("transition-opacity duration-fast ease-out",u.column===C.id?"text-text opacity-100":"text-text-subtle opacity-0 group-hover:opacity-100")})]})},C.id)),x.length>0&&e.jsx("th",{className:c(oe,"w-10"),children:e.jsx("span",{className:"sr-only",children:"Actions"})})]})}),e.jsx("tbody",{children:r?Array.from({length:ts}).map((C,U)=>e.jsxs("tr",{className:"animate-pulse border-t border-border-subtle","aria-hidden":!0,children:[p&&e.jsx("td",{className:c(oe,"h-row-lg"),children:e.jsx("span",{className:"block size-4 rounded-xs bg-surface-hover"})}),s.map((te,ae)=>e.jsx("td",{className:c(oe,"h-row-lg"),style:{width:te.width},children:e.jsx("span",{className:"block h-3 rounded-xs bg-surface-hover",style:{width:Pe[(U+ae)%Pe.length]}})},te.id)),x.length>0&&e.jsx("td",{className:c(oe,"h-row-lg")})]},`skeleton-${U}`)):Q.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:s.length+(p?1:0)+(x.length>0?1:0),className:c(oe,"border-t border-border-subtle py-10 text-center text-text-muted"),children:z||"No data available"})}):Q.map((C,U)=>{const te=h(C,U),ae=N.some((B,ce)=>h(B,ce)===te);return e.jsxs("tr",{className:c(es[V],"border-t border-border-subtle",_&&"transition-colors duration-fast ease-out hover:bg-surface-hover",b&&"cursor-pointer",ae&&"bg-accent-soft",P?.(C,U)),onClick:B=>{B.stopPropagation(),b?.(C,U)},children:[p&&e.jsx("td",{className:oe,children:e.jsx(fe,{size:"sm",checked:ae,onClick:B=>B.stopPropagation(),onChange:B=>{B.stopPropagation(),M(C,B.target.checked)},"aria-label":"Select row"})}),s.map(B=>{const ce=typeof B.accessor=="function"?B.accessor(C):C[B.accessor];return e.jsx("td",{className:c(oe,{"text-left":B.align==="left"||!B.align,"text-center":B.align==="center","text-right":B.align==="right","sticky left-0 bg-surface":B.sticky==="left","sticky right-0 bg-surface":B.sticky==="right"}),children:B.cell?B.cell(ce,C,U):String(ce||"")},B.id)}),x.length>0&&e.jsx("td",{className:oe,children:e.jsx(Ge,{className:"rounded-md",trigger:e.jsx("span",{className:"grid size-7 place-items-center text-text-subtle",children:e.jsx(G,{icon:L.Ellipsis,size:"md",color:"current"})}),options:x.map(B=>({value:B.id,label:B.label,icon:B.icon,disabled:B.disabled?.(C)})),onSelect:B=>{const ce=x.find(nt=>nt.id===B);ce&&ce.onClick(C,U)},placement:"bottom-end"})})]},te)})})]})}),we&&e.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-1 pt-3 text-xs text-text-muted",children:[e.jsx("span",{className:"min-w-0 flex-1",children:k??`Showing ${I}–${O} of ${E}`}),ue&&e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(se,{size:"xs",variant:"ghost",iconOnly:!0,"aria-label":"Previous page",onClick:()=>R(j.page-1),disabled:j.page===0,children:e.jsx(G,{icon:L.ChevronLeft,size:"md",color:"current"})}),ss(j.page,F).map((C,U)=>C==="gap"?e.jsx("span",{className:"px-1 text-text-subtle",children:"…"},`gap-${U}`):e.jsx("button",{type:"button","aria-current":C===j.page?"page":void 0,onClick:()=>R(C),className:c("h-control-xs min-w-6 cursor-pointer rounded-sm px-1.5 tabular-nums","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",C===j.page?"bg-surface-sunk font-semibold text-text":"text-text-muted hover:bg-surface-hover hover:text-text"),children:C+1},C)),e.jsx(se,{size:"xs",variant:"ghost",iconOnly:!0,"aria-label":"Next page",onClick:()=>R(j.page+1),disabled:j.page>=F-1,children:e.jsx(G,{icon:L.ChevronRight,size:"md",color:"current"})})]})]})]})},ns=d.createContext(null),as=({items:t,activeTab:s,onTabChange:r,className:n})=>{const[a,l]=d.useState(t[0]?.id||""),o=s||a,f=i=>{r?r(i):l(i)};return e.jsx("div",{className:c("border-b border-border",n),children:e.jsx("nav",{className:"-mb-px flex space-x-8",children:t.map(i=>e.jsx("button",{onClick:()=>!i.disabled&&f(i.id),disabled:i.disabled,className:c("border-b-2 py-2 px-1 text-sm font-medium transition-colors duration-fast",{"border-accent-border text-text":o===i.id,"border-transparent text-text-muted hover:text-text":o!==i.id&&!i.disabled,"border-transparent text-disabled cursor-not-allowed":i.disabled}),children:e.jsxs("span",{className:"flex items-center gap-2",children:[i.label,i.badge&&e.jsx("span",{className:c("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",o===i.id?"bg-accent-soft text-accent":"bg-surface-hover text-text-muted"),children:i.badge})]})},i.id))})})},Ye=({items:t,defaultTab:s,activeTab:r,onTabChange:n,variant:a="default",size:l="md",className:o})=>{const[f,i]=d.useState(s||r||t[0]?.id||""),v=r||f,m=g=>{n?n(g):i(g)},x={activeTab:v,setActiveTab:m},b=t.find(g=>g.id===v),p=c("flex",{"border-b border-border px-2":a==="default"||a==="underline","bg-surface-hover p-1 rounded-lg":a==="pills","space-x-1":a==="pills","space-x-8":a==="default"||a==="underline"},o),N=(g,h)=>{const z="transition-colors duration-fast font-medium",k={"text-xs px-2 py-1":l==="sm","text-sm px-3 py-2":l==="md","text-base px-4 py-3":l==="lg"},V={"border-b-2 -mb-px":a==="default","rounded-md":a==="pills","border-b-2 pb-2":a==="underline"},_={"opacity-50 cursor-not-allowed":g.disabled,"cursor-pointer":!g.disabled},Y=h?{"border-accent-border text-text":a==="default"||a==="underline","bg-surface text-text shadow-none":a==="pills"}:{},q=!h&&!g.disabled?{"border-transparent text-text-muted hover:text-text":a==="default","text-text-muted hover:text-text":a==="pills","border-transparent text-text-muted hover:text-text hover:border-border":a==="underline"}:{};return c(z,k,V,_,Y,q)};return e.jsx(ns.Provider,{value:x,children:e.jsxs("div",{children:[e.jsx("div",{className:p,role:"tablist",children:t.map(g=>e.jsx("button",{type:"button",role:"tab","aria-selected":v===g.id,"aria-controls":`tabpanel-${g.id}`,disabled:g.disabled,onClick:()=>!g.disabled&&m(g.id),className:N(g,v===g.id),children:e.jsxs("span",{className:"flex items-center gap-2",children:[g.label,g.badge&&e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-surface-hover text-text-muted",children:g.badge})]})},g.id))}),b?.content&&e.jsx("div",{role:"tabpanel",id:`tabpanel-${v}`,"aria-labelledby":`tab-${v}`,className:"mt-4",children:b.content})]})})},ls={sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl",full:"max-w-full mx-4"};function _e({open:t,onClose:s,title:r,size:n="md",closeOnBackdropClick:a=!0,closeOnEscape:l=!0,className:o,backdropClassName:f,children:i,footer:v,showCloseButton:m=!0}){const x=d.useRef(null),b=d.useRef(null);d.useEffect(()=>{if(!t||!l)return;const N=g=>{g.key==="Escape"&&s()};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[t,l,s]),d.useEffect(()=>(t?(b.current=document.activeElement,x.current&&x.current.focus(),document.body.style.overflow="hidden"):(b.current&&b.current.focus(),document.body.style.overflow=""),()=>{document.body.style.overflow=""}),[t]);const p=N=>{a&&N.target===N.currentTarget&&s()};return t?e.jsx("div",{className:c("fixed inset-0 z-modal flex items-center justify-center p-4","bg-scrim",f),onClick:p,children:e.jsxs("div",{ref:x,className:c("relative w-full bg-surface rounded-lg shadow-modal","focus:outline-none",ls[n],o),role:"dialog","aria-modal":"true","aria-labelledby":r?"modal-title":void 0,tabIndex:-1,children:[(r||m)&&e.jsxs("div",{className:"flex items-center justify-between p-6 pb-0",children:[r&&e.jsx("span",{id:"modal-title",className:"text-lg font-semibold text-text",children:r}),m&&e.jsx("button",{onClick:s,className:"p-1 text-text-muted hover:text-text transition-colors","aria-label":"Close modal",children:e.jsx(G,{icon:L.X,size:"lg",color:"current"})})]}),e.jsx("div",{className:"p-6",children:i}),v&&e.jsx("div",{className:"px-6 py-4",children:v})]})}):null}const os={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-md",xl:"text-lg"},cs={light:"font-normal",normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},is={primary:"text-text",secondary:"text-text-muted",accent:"text-accent",success:"text-success-fg",warning:"text-warning-fg",error:"text-danger-fg",info:"text-info-fg",neutral:"text-text",current:"text-current",muted:"text-text-subtle"},ds={left:"text-left",center:"text-center",right:"text-right",justify:"text-justify"},us={tight:"leading-tight",normal:"leading-normal",relaxed:"leading-relaxed"},de=({variant:t="body",size:s="md",weight:r="normal",color:n="current",align:a="left",truncate:l=!1,italic:o=!1,underline:f=!1,lineHeight:i="normal",as:v,className:m,children:x,...b})=>{const p=v||xs(t),N=t==="caption",g=t==="label",h=t==="code",z=c("font-sans",N&&"text-xs text-text-subtle",g&&"text-xs font-semibold uppercase tracking-label text-text-subtle",h&&"font-mono text-sm rounded-sm bg-surface-hover px-1 py-0.5",!N&&!g&&!h&&os[s],!g&&cs[r],is[n],ds[a],t==="body"&&us[i],o&&"italic",f&&"underline",l&&"truncate",m);return e.jsx(p,{className:z,...b,children:x})};function xs(t){return{body:"p",caption:"span",label:"span",code:"code"}[t]||"p"}const Je=({value:t,onChange:s,label:r,placeholder:n="Select or upload a file",error:a,disabled:l,accept:o,onListFiles:f,onListMounts:i,onUploadFile:v,onDownloadFile:m,onRegisterFile:x})=>{const[b,p]=d.useState(!1),[N,g]=d.useState([]),[h,z]=d.useState(null),[k,V]=d.useState("/"),[_,Y]=d.useState([]),[q,P]=d.useState(!1),[H,ee]=d.useState(""),[J,W]=d.useState(typeof t=="object"?t:null),[le,w]=d.useState(!1),[u,S]=d.useState(""),j=d.useRef(null);d.useEffect(()=>{b&&A()},[b]),d.useEffect(()=>{b&&h&&y()},[b,h,k,H]);const A=async()=>{P(!0);try{const T=await i?.();T?.data&&g(T.data)}catch(T){console.error("Failed to load mounts",T)}finally{P(!1)}},y=async()=>{if(h){P(!0);try{const T=await f?.({mountId:h.id,name:H,path:k});T?.data&&Y(T.data)}catch(T){console.error("Failed to load files",T)}finally{P(!1)}}},K=async T=>{const $=T.target.files?.[0];if($){P(!0);try{const Z=await $.arrayBuffer(),ne=new Uint8Array(Z),oe={id:`local-${Date.now()}`,name:$.name,type:"file",path:"/",mimeType:$.type||"application/octet-stream",size:$.size,mountId:"local",providerKey:$.name,ownerId:"me"};W(oe),s(oe,ne),p(!1)}catch(Z){console.error("Local file selection failed",Z)}finally{P(!1)}}},re=async T=>{const $=T.target.files?.[0];if(!(!$||!h)){P(!0);try{const Z=await $.arrayBuffer(),ne=await v?.({file:new Uint8Array(Z),filename:$.name,mimeType:$.type||"application/octet-stream",mountId:h.id,path:k});if(ne?.data){const oe=ne.data;W(oe),s(oe,new Uint8Array(Z)),p(!1)}}catch(Z){console.error("Upload failed",Z)}finally{P(!1)}}},Q=async()=>{if(!(!u||!h)){P(!0);try{const T=`${k}${u}/`;x&&(await x({name:u,type:"folder",path:k,mimeType:"application/x-directory",size:0,mountId:h.id,providerKey:T,ownerId:"me"}),await y()),w(!1),S("")}catch(T){console.error("Failed to create folder",T)}finally{P(!1)}}},X=async T=>{P(!0);try{const $=await m?.(T.id);W(T),s(T,$),p(!1)}catch($){console.error("Failed to download file",$)}finally{P(!1)}},R=T=>{T.stopPropagation(),W(null),s(null)},M=d.useMemo(()=>{const T=new Set,$=[];return _.forEach(Z=>{if(Z.type==="folder"){Z.path===k&&T.add(Z.name);return}const ne=Z.providerKey||Z.name,xe=(k?ne.substring(k.length):ne).split("/").filter(ue=>ue!=="");xe.length>1?T.add(xe[0]):xe.length===1&&$.push(Z)}),{folders:Array.from(T).sort(),files:$.sort((Z,ne)=>Z.name.localeCompare(ne.name))}},[_,k]),D=T=>{V($=>`${$}${T}/`)},E=()=>{const T=k.split("/").filter($=>$!=="");T.pop(),T.length===0?V("/"):V(`${T.join("/")}/`)},F=d.useMemo(()=>{const T=M.folders.map($=>({id:`folder-${$}`,name:$,type:"folder"}));return M.files.forEach($=>{T.push({...$,type:"file"})}),T},[M]),I=[{id:"name",header:"Name",accessor:"name",cell:(T,$)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(G,{icon:$.type==="folder"?L.Folder:L.FileText,size:"sm",color:$.type==="folder"?"warning":"secondary"}),e.jsx("span",{className:c($.type==="folder"&&"font-medium"),children:T})]})},{id:"type",header:"Type",accessor:T=>T.type==="folder"?"Folder":T.mimeType},{id:"size",header:"Size",accessor:T=>T.type==="file"?`${(T.size/1024).toFixed(1)} KB`:"-"},{id:"actions",header:"",accessor:"id",align:"right",cell:(T,$)=>e.jsx(se,{variant:"outline",onClick:Z=>{Z.stopPropagation(),$.type==="folder"?D($.name):X($)},loading:q&&$.type==="file"&&J?.id===$.id,children:$.type==="folder"?"Open":"Select"})}],O=[{id:"name",header:"Mount Name",accessor:"name",cell:T=>e.jsxs("div",{className:"flex items-center gap-2 font-medium",children:[e.jsx(G,{icon:L.HardDrive,size:"sm",color:"primary"}),e.jsx("span",{children:T})]})},{id:"actions",header:"",accessor:"id",align:"right",cell:(T,$)=>e.jsx(se,{variant:"outline",onClick:()=>z($),children:"Open"})}];return e.jsxs("div",{className:"space-y-1",children:[r&&e.jsx(de,{variant:"label",size:"sm",weight:"medium",children:r}),e.jsxs("div",{onClick:()=>!l&&p(!0),className:c("flex items-center gap-3 px-3 py-2 border rounded-lg cursor-pointer transition-colors","hover:border-border-strong bg-surface",a?"border-danger-border":"border-border",l&&"opacity-50 cursor-not-allowed bg-surface-sunk"),children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(G,{icon:J?L.FileText:L.HardDrive,color:J?"primary":"secondary"})}),e.jsx("div",{className:"flex-grow truncate",children:J?e.jsx("span",{className:"text-sm text-text font-medium",children:J.name}):e.jsx("span",{className:"text-sm text-text-muted",children:n})}),J&&!l&&e.jsx("button",{onClick:R,className:"p-1 hover:bg-surface-hover rounded",children:e.jsx(G,{icon:L.X,size:"xs"})})]}),a&&e.jsx(de,{variant:"body",size:"xs",className:"text-danger-fg",children:a}),e.jsx(_e,{open:b,onClose:()=>{p(!1),z(null),V("/"),w(!1)},title:h?`Explorer: ${h.name}`:"Select Storage Mount",size:"lg",children:e.jsx(Ye,{variant:"pills",items:[{id:"remote",label:"Platform Storage",content:e.jsx("div",{className:"space-y-4",children:h?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(se,{variant:"ghost",onClick:()=>{k&&k!=="/"?E():z(null)},leftIcon:e.jsx(G,{icon:L.ArrowLeft,size:"xs"}),children:k?"Back":"Back to Mounts"}),e.jsx("div",{className:"flex items-center gap-1 text-xs text-text-muted overflow-hidden bg-surface-hover px-2 py-1 rounded",children:e.jsx("span",{className:"truncate",children:k})}),e.jsx("div",{className:"flex-grow min-w-40",children:e.jsx(he,{placeholder:"Search...",value:H,onChange:T=>ee(T.target.value),startIcon:e.jsx(L.Search,{size:14}),fullWidth:!0})}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(se,{variant:"outline",onClick:()=>w(!0),leftIcon:e.jsx(G,{icon:L.FolderPlus,size:"xs"}),children:"New Folder"}),e.jsx(se,{variant:"primary",onClick:()=>j.current?.click(),leftIcon:e.jsx(G,{icon:L.Upload,size:"xs"}),loading:q,children:"Upload"}),e.jsx("input",{type:"file",className:"hidden",ref:j,onChange:re,accept:o})]})]}),le&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-surface-sunk rounded-lg border border-border",children:[e.jsx(G,{icon:L.Folder,size:"sm",color:"warning"}),e.jsx(he,{placeholder:"Folder name",value:u,onChange:T=>S(T.target.value),autoFocus:!0}),e.jsx(se,{onClick:Q,loading:q,children:"Create"}),e.jsx(se,{variant:"ghost",onClick:()=>w(!1),children:"Cancel"})]}),e.jsx("div",{className:"max-h-100 overflow-auto rounded-lg border border-border",children:e.jsx(Ce,{data:F,columns:I,loading:q,emptyContent:"This folder is empty",onRowClick:T=>T.type==="folder"?D(T.name):X(T)})})]}):e.jsx("div",{className:"max-h-100 overflow-auto rounded-lg border border-border",children:e.jsx(Ce,{data:N,columns:O,loading:q,emptyContent:"No storage mounts configured",onRowClick:T=>z(T)})})})},{id:"local",label:"Local File",content:e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 border-2 border-dashed border-border rounded-xl bg-surface-sunk/50",children:[e.jsx("div",{className:"p-4 bg-accent-soft rounded-full mb-4",children:e.jsx(G,{icon:L.FileText,size:"xl",color:"primary"})}),e.jsx(de,{variant:"label",size:"lg",weight:"semibold",children:"Select a file from your computer"}),e.jsxs(de,{variant:"body",size:"sm",className:"text-text-muted mt-1 mb-6 text-center max-w-xs",children:["This file will be used directly in the form and will ",e.jsx("strong",{children:"not"})," be uploaded to platform storage."]}),e.jsxs("label",{className:"cursor-pointer",children:[e.jsx(se,{variant:"primary",size:"lg",loading:q,className:"pointer-events-none",children:"Browse Local File"}),e.jsx("input",{type:"file",className:"hidden",onChange:K,accept:o,disabled:q})]})]})})}]})})]})},fs={sm:"px-3 py-1.5 text-sm",md:"px-3 py-2 text-base",lg:"px-3 py-2 text-md",full:"px-3 py-2 text-md"},Ne=d.forwardRef(({label:t,helperText:s,error:r,size:n="md",fullWidth:a=!1,loading:l=!1,containerClassName:o,labelClassName:f,className:i,id:v,rows:m=4,...x},b)=>{const p=d.useId(),N=v||`textarea-${p}`,g=!!r,h=r||s?`${N}-description`:void 0;return e.jsxs("div",{className:c("flex flex-col",a&&"w-full",o),children:[t&&e.jsx("label",{htmlFor:N,className:c(He,g?"text-danger-fg":"text-text-muted",f),children:t}),e.jsxs("div",{className:"relative",children:[e.jsx("textarea",{ref:b,id:N,rows:m,"aria-invalid":g||void 0,"aria-describedby":h,className:c(qe,"resize-y leading-relaxed",fs[n],Ve(g),i),...x}),l&&e.jsx("span",{"aria-hidden":!0,className:"absolute top-2 right-3 size-icon-md animate-spin rounded-full border-2 border-border border-t-transparent"})]}),(r||s)&&e.jsx("p",{id:h,className:c("mt-1 text-xs",g?"text-danger-fg":"text-text-subtle"),children:r||s})]})});Ne.displayName="TextArea";const ms=new Set(["name","given-name","family-name","additional-name","nickname","honorific-prefix","honorific-suffix","email","username","organization","organization-title","tel","tel-country-code","tel-national","tel-extension","url","photo","language","bday","sex","street-address","address-line1","address-line2","address-line3","address-level1","address-level2","country","country-name","postal-code","current-password","new-password","one-time-code"]);function Se(t){return t&&ms.has(t)?{autoComplete:t}:{autoComplete:"off","data-1p-ignore":"true","data-lpignore":"true","data-bwignore":"true","data-form-type":"other"}}function Re(t,s){return s.split(".").reduce((r,n)=>r&&typeof r=="object"&&n in r?r[n]:void 0,t)}function hs(t,s,r){const n=s.split("."),a=Array.isArray(t)?[...t]:{...t};let l=a;for(let o=0;o<n.length-1;o++){const f=n[o],i=l[f];l[f]=i&&typeof i=="object"?Array.isArray(i)?[...i]:{...i}:{},l=l[f]}return l[n[n.length-1]]=r,a}function bs(t,s){const r=s.split("."),n=Array.isArray(t)?[...t]:{...t};let a=n;for(let l=0;l<r.length-1;l++){const o=r[l];if(!a[o]||typeof a[o]!="object")return n;a[o]=Array.isArray(a[o])?[...a[o]]:{...a[o]},a=a[o]}return delete a[r[r.length-1]],n}function Xe({title:t,description:s,className:r,children:n}){return e.jsxs("div",{className:c("flex flex-col gap-4 py-6 sm:flex-row sm:gap-8",r),children:[e.jsxs("div",{className:"w-full shrink-0 sm:w-form-label",children:[t&&e.jsx("span",{className:"text-base font-semibold text-text",children:t}),s&&e.jsx("p",{className:"mt-1 text-sm leading-relaxed text-pretty text-text-subtle",children:s})]}),e.jsx("div",{className:"min-w-0 flex-1",children:n})]})}const gs=({groups:t,data:s,onSubmit:r,onCancel:n,onChange:a,transform:l,validate:o,submitButton:f={label:"Submit",variant:"primary"},cancelButton:i={label:"Cancel",variant:"outline"},showButtons:v=!0,layout:m="vertical",size:x="md",loading:b=!1,className:p,ref:N,sdk:g})=>{const[h,z]=d.useState(s||{}),[k,V]=d.useState({}),[_,Y]=d.useState({});d.useEffect(()=>{s&&z({...s})},[s]);const q=d.useCallback((w,u,S)=>{const j=t.flatMap(A=>A.items).find(A=>A.name===w);if(!j)return null;if(j.required&&(u==null||u===""))return`${j.label} is required`;if(j.type==="array"){if(j.required&&(!u||u.length===0))return`${j.label} cannot be empty.`;if(u&&!Array.isArray(u))return`${j.label} must be an array.`;if(Array.isArray(u)&&j.arrayFields){const A=[];let y=!1;if(u.forEach((K,re)=>{const Q={};for(const X of j.arrayFields){const R=K?.[X.name];if(X.required&&(R==null||R===""))Q[X.name]=`${X.label} is required`,y=!0;else if(X.validator){const M=X.validator(R,K);M&&(Q[X.name]=M,y=!0)}}A[re]=Q}),y)return JSON.stringify(A)}}return j.validator?j.validator(u,S):null},[t]),P=d.useCallback((w,u)=>{let S=hs(h,w,u);t.flatMap(y=>y.items).find(y=>y.name===w)?.removeIfEmpty&&(u==null||u==="")&&(S=bs(S,w)),z(S),Y(y=>({...y,[w]:!0}));const A=q(w,u,S);V(y=>({...y,[w]:A||""})),a?.(S,w)},[h,t,q,a]),H=d.useCallback(async w=>{if(w.preventDefault(),b)return;const u={},S=t.flatMap(A=>A.items);for(const A of S){if(A.hidden||A.conditional&&!A.conditional(h))continue;const y=q(A.name,Re(h,A.name),h);y&&(u[A.name]=y)}if(o){const A=o(h);A&&Object.assign(u,A)}if(V(u),Object.keys(u).some(A=>u[A]))return;const j=l?l(h):h;await r?.(h,j)},[h,t,q,o,l,r,b]),ee=d.useCallback(w=>{const u=Re(h,w.name),S=_[w.name]?k[w.name]:void 0,j=w.disabled||b,A={value:u||"",disabled:j,required:w.required,placeholder:w.placeholder,...w.fieldProps};switch(w.type){case"text":case"email":case"password":case"number":case"tel":case"url":return e.jsx(he,{...A,onChange:y=>P(w.name,y.target.value),type:w.textType||w.type,...Se(w.autocomplete),error:S,size:x});case"textarea":return e.jsx(Ne,{...A,onChange:y=>P(w.name,y.target.value),rows:w.rows??4,error:S,size:x});case"select":return e.jsx(be,{...A,onChange:y=>P(w.name,y),options:(w.options||[]).map(y=>({...y,value:String(y.value)})),searchable:w.searchable,multiple:w.multiple,allowCreate:w.allowCreate,error:S,size:x});case"segmented":return e.jsx(Be,{"aria-label":w.label,value:u==null?"":String(u),onChange:y=>P(w.name,y),options:(w.options||[]).map(y=>({value:String(y.value),label:y.label})),size:x==="sm"?"sm":"md",className:w.disabled?"pointer-events-none opacity-50":void 0});case"checkbox":return e.jsx(fe,{...A,label:w.label,checked:!!u,onChange:y=>P(w.name,y.target.checked),size:x});case"radio":return e.jsx("div",{className:"flex flex-col gap-2",children:w.options?.map(y=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-3 text-base text-text",children:[e.jsx("input",{type:"radio",name:w.name,value:y.value,checked:u===y.value,onChange:()=>P(w.name,y.value),disabled:j||y.disabled,className:"size-checkbox shrink-0 rounded-xs border border-border-strong bg-surface-input accent-accent focus-visible:outline-none focus-visible:focus-ring"}),y.label]},y.value))});case"date":return e.jsx(ye,{...A,value:u?new Date(u):null,onChange:y=>P(w.name,y),size:x});case"file":return e.jsx(Je,{...A,value:u,onChange:y=>P(w.name,y),error:S,onListFiles:y=>g?.http.invoke({method:"POST",action:"storage.file.list",body:y}),onListMounts:()=>g?.http.invoke({method:"GET",action:"storage.mount"}),onUploadFile:y=>g?.http.invoke({method:"POST",action:"storage.file.upload",body:y}),onDownloadFile:y=>g?.http.invoke({method:"GET",action:`storage.file.${y}.download`}),onRegisterFile:y=>g?.http.invoke({method:"POST",action:"storage.file.folder",body:y})});case"folder":return e.jsx(Ue,{value:u||{},onChange:y=>P(w.name,y),onListFolders:()=>g?.http.invoke({method:"GET",action:"storage.mount"}),disabled:j,size:x,placeholder:w.placeholder});case"custom":return w.customComponent?.({value:u,onChange:y=>P(w.name,y),error:S,disabled:j});case"array":{const y=u||[];let K=[];if(typeof S=="string"&&S.startsWith("["))try{K=JSON.parse(S)}catch{}const re=()=>{P(w.name,[...y,{}])},Q=R=>{P(w.name,y.filter((M,D)=>D!==R))},X=(R,M,D)=>{const E=[...y];E[R]={...E[R],[M]:D},P(w.name,E)};return e.jsxs("div",{className:"flex flex-col gap-2",children:[y.map((R,M)=>e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"grid flex-1 gap-2 sm:grid-cols-2",children:w.arrayFields?.map(D=>{const E=K?.[M]?.[D.name];return e.jsxs("div",{className:"flex flex-col gap-1",children:[M===0&&e.jsxs("label",{className:"block text-xs font-semibold uppercase tracking-label text-text-subtle",children:[D.label,D.required&&e.jsx("span",{className:"ml-1 text-danger-fg",children:"*"})]}),(()=>{const F={value:R?.[D.name]||"",disabled:j,required:D.required,placeholder:D.placeholder,...D.fieldProps};switch(D.type){case"text":case"email":case"password":case"number":case"tel":case"url":return e.jsx(he,{...F,onChange:I=>X(M,D.name,I.target.value),type:D.textType||D.type,...Se(D.autocomplete),error:E,size:x});case"textarea":return e.jsx(Ne,{...F,onChange:I=>X(M,D.name,I.target.value),rows:D.rows??4,error:E,size:x});case"select":return e.jsx(be,{...F,onChange:I=>X(M,D.name,I),options:(D.options||[]).map(I=>({...I,value:String(I.value)})),searchable:D.searchable,multiple:D.multiple,allowCreate:D.allowCreate,error:E,size:x});case"checkbox":return e.jsx(fe,{...F,checked:!!R?.[D.name],onChange:I=>X(M,D.name,I.target.checked),size:x});case"radio":return e.jsx("div",{className:"flex flex-col gap-2",children:D.options?.map(I=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-base text-text",children:[e.jsx("input",{type:"radio",name:`${w.name}.${M}.${D.name}`,value:I.value,checked:R?.[D.name]===I.value,onChange:()=>X(M,D.name,I.value),disabled:j||I.disabled,className:"size-checkbox shrink-0 rounded-xs border border-border-strong bg-surface-input accent-accent focus-visible:outline-none focus-visible:focus-ring"}),I.label]},I.value))});case"date":{const I=R?.[D.name];return e.jsx(ye,{...F,value:I?new Date(I):null,onChange:O=>X(M,D.name,O),size:x})}case"custom":return D.customComponent?.({value:R?.[D.name],onChange:I=>X(M,D.name,I),error:E,disabled:j});default:return e.jsxs("p",{children:["Unsupported field type in array:"," ",D.type]})}})(),E&&e.jsx("p",{className:"text-xs text-danger-fg",children:E})]},D.name)})}),e.jsx(se,{type:"button",iconOnly:!0,variant:"ghost",size:"md","aria-label":`${w.label} verwijderen`,onClick:()=>Q(M),disabled:j,className:c("shrink-0",M===0&&"mt-5"),children:e.jsx(L.Trash2,{className:"size-icon-md"})})]},M)),e.jsxs(se,{type:"button",variant:"secondary",leftIcon:e.jsx(L.Plus,{className:"size-icon-sm"}),onClick:re,disabled:j,children:[w.label," toevoegen"]})]})}default:return null}},[h,_,k,b,x,P]),J=d.useCallback(w=>{if(w.conditional&&!w.conditional(h))return null;const u=w.items.filter(j=>!(j.hidden||j.conditional&&!j.conditional(h)));if(u.length===0)return null;const S=c(w.layout==="flex"?"flex flex-wrap gap-3.5":"grid gap-3.5",w.layout!=="flex"&&{"grid-cols-1":!w.columns||w.columns===1,"grid-cols-2":w.columns===2,"grid-cols-3":w.columns===3,"grid-cols-4":w.columns===4},w.className);return e.jsx(Xe,{title:w.title,description:w.description,className:"not-last:border-b not-last:border-border-subtle",children:e.jsx("div",{children:e.jsx("div",{className:S,children:u.map(j=>{const A=_[j.name]?k[j.name]:void 0;return e.jsxs("div",{className:c("flex min-w-0 flex-col gap-1.5",j.type==="checkbox"&&"justify-center"),style:{width:typeof j.width=="string"?j.width:void 0,gridColumn:typeof j.width=="number"?`span ${j.width} / span ${j.width}`:void 0},children:[j.type!=="custom"&&j.type!=="checkbox"&&e.jsxs("label",{className:"block text-sm font-medium text-text-muted",children:[j.label,j.required&&e.jsx("span",{className:"ml-1 text-danger-fg",children:"*"})]}),ee(j),j.help&&!A&&e.jsx("p",{className:"text-xs leading-4 text-text-subtle",children:j.help})]},j.name)})})})},w.id)},[h,_,k,ee]),W=c({"max-w-settings":x==="sm","max-w-form":x==="md","max-w-6xl":x==="lg","max-w-full":x==="full"},p),le=x==="full"?"md":x;return e.jsxs("form",{ref:N,onSubmit:H,className:W,children:[!v&&e.jsx("button",{type:"submit",className:"hidden",tabIndex:-1,"aria-hidden":!0}),e.jsx("div",{className:"flex flex-col",children:t.map(J)}),v&&e.jsx("div",{className:"flex items-center gap-2 border-t border-border-subtle py-4",children:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"ml-auto"}),n&&e.jsx(se,{type:"button",variant:i.variant??"ghost",size:i.size||le,disabled:i.disabled||b,onClick:n,className:i.className,children:i.label}),e.jsx(se,{type:"submit",variant:f.variant,size:f.size||le,disabled:f.disabled||b,loading:b,className:f.className,children:f.label})]})})]})};function ps({open:t,title:s,description:r,confirmLabel:n="Bevestigen",cancelLabel:a="Annuleren",tone:l="default",loading:o=!1,onConfirm:f,onCancel:i}){return e.jsx(_e,{open:t,onClose:i,title:s,size:"sm",footer:e.jsxs("div",{className:"flex w-full items-center justify-end gap-2",children:[e.jsx(se,{variant:"ghost",onClick:i,disabled:o,children:a}),e.jsx(se,{variant:l==="danger"?"destructive":"primary",onClick:f,loading:o,children:n})]}),children:r&&e.jsx(de,{color:"secondary",children:r})})}const vs={default:"bg-surface-hover text-text",primary:"bg-accent-soft text-accent",secondary:"bg-surface-hover text-text-muted",success:"bg-success-soft text-success-fg",warning:"bg-warning-soft text-warning-fg",error:"bg-danger-soft text-danger-fg",info:"bg-info-soft text-info-fg",note:"bg-note-soft text-note"},js={sm:"px-2 py-0.5 text-xs",md:"px-2.5 py-1 text-sm",lg:"px-3 py-1.5 text-base"},ys={default:"bg-surface-hover",primary:"bg-accent",secondary:"bg-surface-hover",success:"bg-success",warning:"bg-warning",error:"bg-danger",info:"bg-info",note:"bg-note"};function Ze({variant:t="default",size:s="md",dot:r=!1,icon:n,dismissible:a=!1,onDismiss:l,className:o,children:f,...i}){return e.jsxs("span",{className:c("inline-flex items-center font-medium rounded-full",vs[t],js[s],o),...i,children:[r&&e.jsx("span",{className:c("w-2 h-2 rounded-full mr-1.5",ys[t])}),n&&e.jsx("span",{className:c("flex-shrink-0",f&&"mr-1"),children:n}),f,a&&l&&e.jsx("button",{onClick:l,className:"ml-1.5 flex-shrink-0 hover:opacity-70 transition-opacity","aria-label":"Remove badge",children:e.jsx(G,{icon:L.X,size:"xs",color:"current"})})]})}const ie=({className:t})=>e.jsx("span",{className:c("block rounded-xs bg-surface-hover",t)});function Ns({shape:t,rows:s,columns:r}){switch(t){case"table":return e.jsxs("div",{className:"overflow-hidden rounded-lg ring-1 ring-border",children:[e.jsx("div",{className:"grid gap-2 bg-surface-hover p-3",style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:Array.from({length:r}).map((n,a)=>e.jsx(ie,{className:"h-4 w-2/3 bg-border-strong"},`h-${a}`))}),Array.from({length:s}).map((n,a)=>e.jsx("div",{className:"grid gap-2 border-t border-border-subtle p-3",style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:Array.from({length:r}).map((l,o)=>e.jsx(ie,{className:"h-4 w-full"},`c-${a}-${o}`))},`r-${a}`))]});case"list":return e.jsx("div",{className:"flex flex-col divide-y divide-border-subtle rounded-lg ring-1 ring-border",children:Array.from({length:s}).map((n,a)=>e.jsxs("div",{className:"flex items-center gap-3 p-3",children:[e.jsx(ie,{className:"size-avatar-sm shrink-0 rounded-full"}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[e.jsx(ie,{className:"h-3"}),e.jsx(ie,{className:"h-2.5 opacity-70"})]})]},a))});case"form":return e.jsx("div",{className:"flex flex-col gap-5",children:Array.from({length:s}).map((n,a)=>e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(ie,{className:"h-2.5 w-28"}),e.jsx(ie,{className:"h-control-md w-full rounded-md"})]},a))});case"menu":return e.jsxs("div",{className:"flex flex-col gap-px",children:[e.jsx("div",{className:"px-2.5 pb-2 pt-5",children:e.jsx(ie,{className:"h-2 w-16"})}),Array.from({length:s}).map((n,a)=>e.jsxs("div",{className:"flex h-row-md items-center gap-2.5 px-2.5",children:[e.jsx(ie,{className:"size-4 shrink-0"}),e.jsx(ie,{className:"h-2"})]},a))]});case"cards":return e.jsx("div",{className:"grid gap-4",style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:Array.from({length:s*r}).map((n,a)=>e.jsxs("div",{className:"flex flex-col gap-2 rounded-lg p-4 ring-1 ring-border",children:[e.jsx(ie,{className:"h-3 w-1/2"}),e.jsx(ie,{className:"h-2.5"}),e.jsx(ie,{className:"h-2.5 w-3/4 opacity-70"})]},a))});case"text":default:return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(ie,{className:"h-6 w-1/4"}),e.jsx("div",{className:"flex flex-col gap-2",children:Array.from({length:s}).map((n,a)=>e.jsx(ie,{className:"h-4"},a))})]})}}const ws={text:2,table:8,list:6,form:5,menu:4,cards:2};function Ae({variant:t="page",shape:s,rows:r,columns:n,children:a,className:l,showTableSkeleton:o=!1,tableColumns:f,tableRows:i}){const v=s??(o?"table":"text"),m=r??i??ws[v],x=n??f??(v==="cards"?3:6),b=e.jsx("div",{className:c("w-full animate-pulse",l),"aria-hidden":!0,children:a??e.jsx(Ns,{shape:v,rows:m,columns:x})});return t==="inline"?b:e.jsx("main",{className:"flex-1 bg-surface p-6",children:b})}const ks={neutral:"bg-surface-hover text-text-muted",success:"bg-success-soft text-success-fg"};function Cs({icon:t,tone:s="neutral",title:r,description:n,actions:a,card:l=!1,className:o,...f}){return e.jsxs("div",{className:c("flex flex-col items-center gap-2.5 text-center",l&&"rounded-lg border border-border bg-surface px-11 py-9 shadow-overlay",o),...f,children:[t!=null&&e.jsx("span",{className:c("flex size-disc items-center justify-center rounded-full text-2xl",ks[s]),children:t}),e.jsx("div",{className:"text-lg font-semibold text-text",children:r}),n&&e.jsx("div",{className:"max-w-sm text-sm leading-relaxed text-text-muted",children:n}),a&&e.jsx("div",{className:"flex gap-2 pt-1.5",children:a})]})}function Ss({children:t,className:s,...r}){return e.jsx("kbd",{className:c("inline-flex items-center rounded border border-border px-1.5 py-px text-xs font-medium leading-none text-text-muted",s),...r,children:t})}const Es={sm:"h-1",md:"h-1.5"},Ts={accent:"bg-accent",success:"bg-success"};function zs({value:t,variant:s="accent",size:r="md",className:n,...a}){const l=Math.max(0,Math.min(100,t));return e.jsx("div",{role:"progressbar","aria-valuenow":Math.round(l),"aria-valuemin":0,"aria-valuemax":100,className:c("w-full overflow-hidden rounded-full bg-surface-hover",Es[r],n),...a,children:e.jsx("div",{className:c("h-full rounded-full transition-[width] duration-300 ease-out",Ts[s]),style:{width:`${l}%`}})})}const Ms={xs:"h-3 w-3",sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8",xl:"h-12 w-12"},Ds={primary:"text-accent",secondary:"text-text-muted",white:"text-white",current:"text-current"},_s={xs:"text-xs",sm:"text-sm",md:"text-sm",lg:"text-base",xl:"text-lg"};function As({size:t="md",variant:s="primary",label:r="Loading...",showLabel:n=!1,className:a,...l}){return e.jsxs("div",{className:c("inline-flex items-center",n?"flex-col space-y-2":"",a),...l,children:[e.jsxs("svg",{className:c("animate-spin",Ms[t],Ds[s]),fill:"none",viewBox:"0 0 24 24","aria-hidden":!n,role:n?"status":void 0,children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),n&&e.jsx("span",{className:c("text-text-muted",_s[t]),children:r}),!n&&e.jsx("span",{className:"sr-only",children:r})]})}const $s={neutral:"bg-text-disabled",accent:"bg-accent",success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",note:"bg-note","cat-1":"bg-cat-1","cat-2":"bg-cat-2","cat-3":"bg-cat-3","cat-4":"bg-cat-4","cat-5":"bg-cat-5"};function Ls({tone:t="neutral",shape:s="round",pulse:r=!1,label:n,className:a}){return e.jsx("span",{role:n?"img":void 0,"aria-label":n,"aria-hidden":n?void 0:!0,className:c("inline-block size-dot shrink-0",s==="round"?"rounded-full":"rounded-sm",$s[t],r&&"animate-pulse",a)})}function Ps({steps:t,current:s,variant:r="numbered",label:n,className:a}){const l=t.indexOf(s),o={role:n?"group":void 0,"aria-label":n,"aria-hidden":n?void 0:!0};return r==="dots"?e.jsx("div",{...o,className:c("flex items-center gap-1.5",a),children:t.map((f,i)=>e.jsx("span",{className:c("h-step-bar rounded-full transition-all duration-fast ease-out",i===l?"w-5 bg-accent":"w-3.5",i<l&&"bg-border-strong",i>l&&"bg-border")},f))}):e.jsx("div",{...o,className:c("flex items-center gap-2",a),children:t.map((f,i)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{"aria-current":i===l?"step":void 0,className:c("flex size-tile-sm items-center justify-center rounded-full text-xs font-medium",i===l&&"bg-accent text-accent-fg",i<l&&"bg-accent-soft text-accent",i>l&&"bg-surface-hover text-text-muted"),children:i+1}),i<t.length-1&&e.jsx("span",{className:"h-px w-8 bg-border-strong"})]},f))})}function Rs({title:t,icon:s=e.jsx(L.Sparkles,{className:"size-icon-md","aria-hidden":!0}),action:r,children:n,className:a,...l}){return e.jsxs("div",{className:c("flex flex-col gap-2 rounded-xl border p-4","border-assistant-border bg-assistant-soft",a),...l,children:[e.jsxs("div",{className:"flex items-center gap-2 text-assistant",children:[e.jsx("span",{"aria-hidden":!0,children:s}),e.jsx("span",{className:"text-sm font-semibold",children:t}),r&&e.jsx("span",{className:"ml-auto",children:r})]}),n&&e.jsx("div",{className:"text-sm leading-relaxed text-text",children:n})]})}const Is={default:"bg-avatar text-avatar-fg",in:"bg-avatar-in text-avatar-in-fg",out:"bg-accent text-accent-fg",note:"bg-avatar-note text-avatar-note-fg"},Fs={xs:"w-5 h-5 text-xs",sm:"w-6 h-6 text-xs",md:"w-7 h-7 text-base",lg:"w-9 h-9 text-sm"};function Os(t){if(!t)return"?";const s=t.trim().split(/[^\p{L}\p{N}]+/u).filter(Boolean);return s.length>=2?(s[0][0]+s[1][0]).toUpperCase():s.length===1?s[0].slice(0,2).toUpperCase():"?"}const Qe=({name:t,src:s,tone:r="default",size:n="sm",className:a,title:l})=>{const[o,f]=d.useState(!1),i=c("inline-flex items-center justify-center rounded-full overflow-hidden shrink-0 font-semibold select-none",r==="identity"?Te(t):Is[r],Fs[n],a);return s&&!o?e.jsx("img",{src:s,alt:t??"",title:l??t,className:c(i,"object-cover"),onError:()=>f(!0)}):e.jsx("span",{className:i,title:l??t,"aria-label":t,children:Os(t)})},Ie="ring-surface",Bs="ring-surface-accent",Hs=({people:t,max:s=4,size:r="sm",className:n})=>{if(t.length===0)return null;const a=t.slice(0,s),l=t.length-a.length;return e.jsxs("span",{className:c("inline-flex items-center",n),children:[a.map((o,f)=>e.jsx(Qe,{name:o.name,src:o.src,size:r,title:o.name?o.seen===!1?`${o.name} — nog niet gelezen`:o.name:void 0,className:c(f>0&&"-ml-2",o.owner?Bs:Ie,o.seen===!1&&"opacity-40")},o.id??`${o.name}-${f}`)),l>0&&e.jsxs("span",{className:c("inline-flex items-center justify-center rounded-full shrink-0 -ml-2 font-semibold bg-avatar text-avatar-fg",r==="xs"?"w-5 h-5 text-xs":r==="md"?"w-7 h-7 text-xs":r==="lg"?"w-9 h-9 text-xs":"w-6 h-6 text-xs",Ie),children:["+",l]})]})},je={mail:{fg:"text-channel-mail-fg",bg:"bg-channel-mail-soft"},wa:{fg:"text-channel-whatsapp-fg",bg:"bg-channel-whatsapp-soft"},chat:{fg:"text-channel-chat-fg",bg:"bg-channel-chat-soft"},tel:{fg:"text-channel-phone-fg",bg:"bg-channel-phone-soft"},note:{fg:"text-channel-note-fg",bg:"bg-channel-note-soft"}},qs={sm:"size-avatar-xs rounded-sm text-xs",md:"size-avatar-sm rounded-md text-xs",lg:"size-avatar-lg rounded-md text-base"};function Vs({channel:t,children:s,size:r="md",className:n,title:a}){const l=t in je?je[t]:void 0;return e.jsx("span",{title:a,className:c("inline-flex shrink-0 items-center justify-center font-bold",qs[r],l?c(l.fg,l.bg):t?Te(t):c(je.note.fg,je.note.bg),n),children:s})}const Us=({src:t,alt:s,size:r="md",aspectRatio:n="auto",radius:a="md",showLoading:l=!0,showError:o=!0,fallback:f,loadingContent:i,errorContent:v,className:m,onLoad:x,onError:b,...p})=>{const[N,g]=d.useState(!0),[h,z]=d.useState(!1),[k,V]=d.useState(t),_=W=>{g(!1),z(!1),x?.(W)},Y=W=>{if(g(!1),z(!0),f&&k!==f){V(f),z(!1),g(!0);return}b?.(W)},q=c("relative overflow-hidden bg-surface-hover",{"w-8 h-8":r==="xs","w-12 h-12":r==="sm","w-16 h-16":r==="md","w-24 h-24":r==="lg","w-32 h-32":r==="xl","w-full h-full":r==="full"},{"aspect-square":n==="square","aspect-video":n==="video","aspect-portrait":n==="portrait","aspect-landscape":n==="landscape"},{"rounded-none":a==="none","rounded-sm":a==="sm","rounded-md":a==="md","rounded-lg":a==="lg","rounded-xl":a==="xl","rounded-full":a==="full"},m),P=c("w-full h-full object-cover transition-opacity duration-fast",{"opacity-0":N||h,"opacity-100":!N&&!h}),H=c("absolute inset-0 flex items-center justify-center","text-text-muted"),ee=e.jsx("div",{className:"animate-pulse",children:e.jsx("div",{className:"w-6 h-6 bg-surface-hover rounded"})}),J=e.jsxs("div",{className:"text-center",children:[e.jsx(G,{icon:L.ImageOff,size:"lg",className:"mx-auto mb-1"}),e.jsx("span",{className:"text-xs",children:"Failed to load"})]});return e.jsxs("div",{className:q,children:[e.jsx("img",{...p,src:k,alt:s,className:P,onLoad:_,onError:Y}),N&&l&&e.jsx("div",{className:H,children:i||ee}),h&&o&&e.jsx("div",{className:H,children:v||J})]})};function Ks({icon:t,onClick:s,children:r}){return e.jsxs("button",{type:"button",onClick:s,className:c("inline-flex h-control-sm shrink-0 cursor-pointer items-center gap-1.5 rounded-md px-2.5","text-sm font-medium whitespace-nowrap","transition-colors duration-fast ease-out hover:bg-white/15","focus-visible:outline-none focus-visible:focus-ring"),children:[t,r]})}function Ws({items:t,getRowKey:s,variant:r="divided",leading:n,renderItem:a,trailing:l,onSelect:o,onActiveIndexChange:f,isActive:i,unread:v,dimmed:m,groupBy:x,groups:b,renderGroupHeader:p,stickyGroupHeaders:N=!1,collapsibleGroups:g=!1,hideGroupCount:h=!1,selectable:z=!1,selectedItems:k=[],onSelectionChange:V,bulkActions:_,header:Y,stickyHeader:q=!1,bordered:P=!1,emptyContent:H,loading:ee=!1,loadingRows:J=4,className:W,"aria-label":le}){const[w,u]=d.useState(()=>Object.fromEntries((b??[]).filter(E=>E.defaultCollapsed).map(E=>[E.id,!0]))),S=d.useRef(null),j=E=>{if(!["ArrowDown","ArrowUp","Home","End"].includes(E.key))return;const I=Array.from(S.current?.querySelectorAll("li[data-list-row]")??[]);if(I.length===0)return;E.preventDefault();const O=I.indexOf(document.activeElement),T=E.key==="Home"?0:E.key==="End"?I.length-1:E.key==="ArrowDown"?(O+1)%I.length:(O-1+I.length)%I.length;I[T]?.focus()},A=(E,F)=>s?s(E,F):F,y=E=>k.includes(E),K=(E,F)=>{V&&V(F?[...k,E]:k.filter(I=>I!==E))},re=E=>V?.(E?[...t]:[]),Q=c("flex flex-col",z&&k.length>0&&"min-h-full",P&&"overflow-hidden rounded-lg border border-border-subtle",W);if(ee)return e.jsx("div",{className:Q,children:Array.from({length:J}).map((E,F)=>e.jsxs("div",{className:c("flex animate-pulse items-center gap-3 px-4 py-2",r==="divided"&&F>0&&"border-t border-border-subtle"),children:[e.jsx("span",{className:"size-tile-sm shrink-0 rounded-md bg-surface-hover"}),e.jsx("span",{className:"h-3 w-30 shrink-0 rounded-sm bg-surface-hover"}),e.jsx("span",{className:"h-3 flex-1 rounded-sm bg-surface-hover"}),e.jsx("span",{className:"h-3 w-8 shrink-0 rounded-sm bg-surface-hover"})]},`skeleton-${F}`))});if(t.length===0&&H)return e.jsx("div",{className:Q,children:H});const X=t.length>0&&k.length===t.length,R=k.length>0&&!X,M=(E,F,I)=>{const O=i?.(E,F)??!1,T=v?.(E,F)??!1,$=m?.(E,F)??!1,Z=z&&y(E);return e.jsxs("li",{...o?{role:"button",tabIndex:0,"data-list-row":"","aria-current":O||void 0,onClick:()=>o(E,F),onFocus:()=>f?.(F),onKeyDown:ne=>{ne.key!=="Enter"&&ne.key!==" "||(ne.preventDefault(),o(E,F))}}:{},className:c("flex items-center gap-3 text-base","transition-colors duration-fast ease-out",r==="inset"?"mx-2 rounded-lg px-3 py-2.5":"px-5 py-2.5",r==="divided"&&!I&&"border-t border-border-subtle",o&&"cursor-pointer focus-visible:outline-none focus-visible:focus-ring",O||Z?"bg-accent-soft text-text":T?c("bg-surface-unread",o&&"hover:bg-surface-unread-hover"):o&&"hover:bg-surface-hover",$&&"text-text-muted"),children:[z&&e.jsx("span",{onClick:ne=>ne.stopPropagation(),children:e.jsx(fe,{checked:y(E),onChange:ne=>K(E,ne.target.checked),"aria-label":"Rij selecteren"})}),r==="bulleted"&&e.jsx("span",{"aria-hidden":!0,className:"mt-2 size-1.5 shrink-0 self-start rounded-full bg-border-strong"}),n&&e.jsx("span",{className:"shrink-0",children:n(E,F)}),e.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:a?a(E,F):String(E)}),l&&e.jsx("span",{className:"shrink-0 text-xs text-text-subtle",children:l(E,F)})]},A(E,F))},D=(()=>{if(!x)return t.map((O,T)=>M(O,T,T===0));const E=new Map;t.forEach((O,T)=>{const $=x(O,T);E.has($)||E.set($,[]),E.get($).push({item:O,index:T})});const F=b??[];return[...F.filter(O=>E.has(O.id)),...[...E.keys()].filter(O=>!F.some(T=>T.id===O)).map(O=>({id:O}))].flatMap((O,T)=>{const $=E.get(O.id)??[],Z=g&&w[O.id],ne=O.title??O.id,oe=O.count??$.length,xe=e.jsx("li",{onClick:g?()=>u(ue=>({...ue,[O.id]:!ue[O.id]})):void 0,className:c("flex items-center gap-2.5 bg-surface px-5 pb-1.5 text-base font-semibold",T>0?"pt-5":"pt-3",O.tone==="danger"?"text-danger-fg":O.tone==="muted"?"text-text-subtle":"text-text",N&&"sticky z-10",g&&"cursor-pointer select-none"),"aria-expanded":g?!Z:void 0,style:N?{top:q?28:0}:void 0,children:p?p(O,$.map(ue=>ue.item)):e.jsxs(e.Fragment,{children:[g&&e.jsx(L.ChevronRight,{"aria-hidden":!0,className:c("size-icon-md shrink-0 text-text-subtle transition-transform duration-fast ease-out",!Z&&"rotate-90")}),e.jsx("span",{children:ne}),!h&&e.jsx("span",{className:c("rounded-full px-2 text-xs font-normal tabular-nums",O.tone==="danger"?"bg-danger-soft text-danger-fg":"bg-surface-sunk text-text-subtle"),children:oe})]})},`group-${O.id}`);return Z?[xe]:[xe,...$.map(({item:ue,index:we},C)=>M(ue,we,C===0))]})})();return e.jsxs("div",{ref:S,className:Q,onKeyDown:o?j:void 0,children:[Y&&e.jsxs("div",{className:c("flex h-row-sm items-end gap-3 border-b border-border bg-surface px-5 pb-2","text-xs font-semibold uppercase tracking-wider text-text-disabled",q&&"sticky top-0 z-20"),children:[z&&e.jsx("span",{className:"flex items-center",children:e.jsx(fe,{checked:X,indeterminate:R,onChange:E=>re(E.target.checked),"aria-label":"Alles selecteren"})}),Y]}),e.jsx("ul",{"aria-label":le,className:"flex flex-col",children:D}),z&&k.length>0&&e.jsx("div",{className:"pointer-events-none sticky bottom-0 z-10 flex justify-center px-5 pb-4",children:e.jsxs("div",{className:"pointer-events-auto flex items-center gap-1.5 rounded-lg bg-accent py-1.5 pl-3.5 pr-1.5 text-accent-fg shadow-overlay",children:[e.jsxs("span",{className:"text-sm font-medium",children:[k.length," geselecteerd"]}),e.jsx("span",{"aria-hidden":!0,className:"mx-1.5 h-4 w-px bg-current opacity-25"}),_,e.jsx("span",{"aria-hidden":!0,className:"mx-1.5 h-4 w-px bg-current opacity-25"}),e.jsx("button",{type:"button",onClick:()=>V?.([]),"aria-label":"Selectie wissen",className:"grid size-tile-md shrink-0 cursor-pointer place-items-center rounded-md transition-colors duration-fast ease-out hover:bg-white/15 focus-visible:outline-none focus-visible:focus-ring",children:e.jsx(L.X,{className:"size-icon-lg"})})]})})]})}function Gs({side:t,continued:s=!1,tone:r="default",className:n,children:a}){return e.jsx("div",{className:c("min-w-0 max-w-bubble md:max-w-bubble-md",t==="out"?"rounded-lg rounded-tr-sm":"rounded-lg rounded-tl-sm",r==="note"?"bg-note-soft":t==="out"?"bg-bubble-out-soft":"bg-surface-sunk",s&&"mt-1",n),children:a})}const Ys={default:"text-text",urgent:"text-danger-fg",success:"text-success-fg"};function Js({value:t,label:s,tone:r="default",className:n,...a}){return e.jsxs("div",{className:c("rounded-xl bg-editor px-4 py-3.5",n),...a,children:[e.jsx("div",{className:c("text-2xl font-semibold",Ys[r]),children:t}),e.jsx("div",{className:"pt-0.5 text-xs text-text-muted",children:s})]})}const Xs=({surface:t=!1,title:s,subtitle:r,meta:n,actions:a=[],children:l,className:o,backLabel:f="Back",backClassName:i,onBack:v,editable:m=!1,onTitleChange:x})=>{const[b,p]=d.useState(!1),[N,g]=d.useState(s),h=d.useRef(null);d.useEffect(()=>{g(s)},[s]),d.useEffect(()=>{b&&h.current&&(h.current.focus(),h.current.select())},[b]);const z=()=>{m&&p(!0)},k=()=>{p(!1),N.trim()!==""&&N!==s&&x?x(N.trim()):g(s)},V=_=>{_.key==="Enter"?h.current?.blur():_.key==="Escape"&&(g(s),p(!1))};return e.jsxs("div",{className:c("px-5 pt-4 pb-2.5",t&&"border-b border-border",o),children:[e.jsxs("div",{className:"flex flex-row sm:items-start sm:justify-between items-center gap-4",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsxs("div",{className:"flex items-start gap-4 text-text",children:[v&&e.jsx(se,{variant:"ghost",onClick:v,leftIcon:e.jsx(G,{icon:L.ChevronLeft,size:"md"}),iconOnly:!0}),e.jsxs("div",{className:"min-w-0 flex-1",children:[b?e.jsx("input",{ref:h,type:"text",value:N,onChange:_=>g(_.target.value),onBlur:k,onKeyDown:V,className:"text-1xl font-semibold bg-transparent border-b-1 border-border rounded-lg outline-none focus:border-none px-1 -mx-1 min-w-0 w-full"}):e.jsxs("div",{className:"group flex items-baseline gap-2.5 min-w-0",children:[e.jsx("h2",{onClick:z,className:c("text-lg font-semibold tracking-title truncate",m&&"cursor-pointer"),title:m?"Click to edit":void 0,children:s}),r&&e.jsx("span",{className:"shrink-0 text-base text-text-muted truncate",children:r}),m&&e.jsx(L.Pencil,{size:15,onClick:z,className:"shrink-0 cursor-pointer text-text-muted opacity-0 group-hover:opacity-100 transition-opacity"})]}),n&&e.jsx("div",{className:c("mt-1 min-w-0 text-sm text-text-subtle",typeof n=="string"&&"truncate"),children:n})]})]})}),a.length>0&&e.jsx("div",{className:"flex flex-wrap sm:flex-nowrap gap-2 sm:gap-3",children:a.map(_=>_.render?e.jsx(d.Fragment,{children:_.render()},_.id):_.splitOptions&&_.splitOptions.length>0?e.jsx(Me,{label:_.label,onClick:_.onClick,icon:_.icon,variant:_.variant==="primary"?"primary":"outline",options:_.splitOptions,disabled:_.disabled},_.id):e.jsx(se,{variant:_.variant??"secondary",onClick:Y=>{Y.stopPropagation(),Y.target.blur(),_.onClick()},disabled:_.disabled,leftIcon:_.icon,children:_.label},_.id))})]}),l&&e.jsx("div",{className:"mt-4",children:l})]})},Zs=/<[a-z][\s\S]*>/i,Qs=["[&_p]:my-1.5 [&_p:first-child]:mt-0 [&_p:last-child]:mb-0 [&_p]:leading-relaxed","[&_a]:text-accent [&_a]:underline [&_a]:underline-offset-2","[&_strong]:font-semibold [&_em]:italic","[&_ul]:my-1.5 [&_ul]:list-disc [&_ul]:pl-5 [&_ol]:my-1.5 [&_ol]:list-decimal [&_ol]:pl-5","[&_li]:leading-relaxed","[&_h1]:mb-1 [&_h1]:mt-2 [&_h1]:font-semibold [&_h2]:mb-1 [&_h2]:mt-2 [&_h2]:font-semibold [&_h3]:mb-1 [&_h3]:mt-2 [&_h3]:font-semibold","[&_blockquote]:my-1.5 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3 [&_blockquote]:text-text-muted","[&_hr]:my-2 [&_hr]:border-border","[&_pre]:my-1.5 [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-surface-sunk [&_pre]:p-2 [&_pre]:text-xs","[&_code]:rounded-sm [&_code]:bg-surface-sunk [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-xs","[&_pre_code]:bg-transparent [&_pre_code]:p-0","[&_table]:my-1.5 [&_table]:w-full [&_table]:border-collapse [&_table]:text-xs","[&_th]:border [&_th]:border-border [&_th]:px-2 [&_th]:py-1 [&_th]:text-left [&_th]:font-semibold","[&_td]:border [&_td]:border-border [&_td]:px-2 [&_td]:py-1"].join(" "),er={p:t=>e.jsx("p",{className:"my-1.5 leading-relaxed first:mt-0 last:mb-0",...t}),a:t=>e.jsx("a",{className:"text-accent underline underline-offset-2 hover:opacity-80",target:"_blank",rel:"noopener noreferrer",...t}),strong:t=>e.jsx("strong",{className:"font-semibold",...t}),em:t=>e.jsx("em",{className:"italic",...t}),ul:t=>e.jsx("ul",{className:"my-1.5 list-disc space-y-0.5 pl-5",...t}),ol:t=>e.jsx("ol",{className:"my-1.5 list-decimal space-y-0.5 pl-5",...t}),li:t=>e.jsx("li",{className:"leading-relaxed",...t}),h1:t=>e.jsx("h1",{className:"mb-1 mt-2 text-md font-semibold first:mt-0",...t}),h2:t=>e.jsx("h2",{className:"mb-1 mt-2 text-base font-semibold first:mt-0",...t}),h3:t=>e.jsx("h3",{className:"mb-1 mt-2 text-base font-semibold first:mt-0",...t}),blockquote:t=>e.jsx("blockquote",{className:"my-1.5 border-l-2 border-border pl-3 text-text-muted",...t}),hr:t=>e.jsx("hr",{className:"my-2 border-border",...t}),pre:t=>e.jsx("pre",{className:"my-1.5 overflow-x-auto rounded-md bg-surface-sunk p-2 text-xs",...t}),code:({className:t,children:s,...r})=>{const n=String(s??"");return/language-/.test(t??"")||n.includes(`
|
|
2
|
-
`)?e.jsx("code",{className:"font-mono text-xs",...r,children:s}):e.jsx("code",{className:"rounded-sm bg-surface-sunk px-1 py-0.5 font-mono text-xs",...r,children:s})},table:t=>e.jsx("div",{className:"my-1.5 overflow-x-auto",children:e.jsx("table",{className:"w-full border-collapse text-xs",...t})}),th:t=>e.jsx("th",{className:"border border-border px-2 py-1 text-left font-semibold",...t}),td:t=>e.jsx("td",{className:"border border-border px-2 py-1",...t})};function tr({text:t,className:s,as:r}){const n=t??"";return(r?r==="html":Zs.test(n))?e.jsx("div",{className:c("break-words",Qs,s),dangerouslySetInnerHTML:{__html:lt.sanitize(n,{ADD_ATTR:["target","rel"]})}}):e.jsx("div",{className:c("break-words",s),children:e.jsx(ot,{remarkPlugins:[ct],components:er,children:n})})}const sr=({label:t,meta:s,action:r,className:n})=>e.jsxs("div",{className:c("flex items-center gap-2 px-1 pb-2 pt-7 first:pt-0",n),children:[e.jsx("span",{className:"shrink-0 text-2xs font-semibold uppercase tracking-label text-text-subtle",children:t}),s&&e.jsx("span",{className:"min-w-0 flex-1 truncate text-right text-xs tabular-nums text-text-subtle",children:s}),r&&e.jsx("span",{className:"ml-auto shrink-0",children:r})]});function rr({label:t,trailing:s,align:r="center",className:n}){const a=e.jsx("span",{className:"h-px flex-1 bg-border-subtle","aria-hidden":!0});return!t&&!s?e.jsx("div",{className:c("flex items-center py-2",n),children:a}):e.jsxs("div",{className:c("flex items-center gap-3 py-2",n),children:[r==="center"&&a,e.jsx("span",{className:"shrink-0 text-xs font-medium text-text-muted",children:t}),a,s&&e.jsx("span",{className:"shrink-0",children:s})]})}const et=d.createContext(null),nr=et.Provider;function tt(){return d.useContext(et)}function ar(){const[t,s]=d.useState(null),r=d.useMemo(()=>({setTrail:(n,a)=>s(l=>a?{ownerId:n,entry:a}:l&&l.ownerId!==n?l:null)}),[]);return{trail:t?.entry??null,api:r}}const lr={none:"",sm:"px-3 py-3",md:"px-5 py-4"},or=({children:t,actions:s=[],secondaryActions:r=[],onBack:n,backLabel:a="Back",title:l,loading:o=!1,loadingShape:f="form",padding:i="md",className:v,contentClassName:m})=>{const x=tt(),b=d.useId(),p=d.useRef(n);p.current=n;const N=!!n;d.useEffect(()=>{if(x&&!(!N&&!l))return x.setTrail(b,{title:l,onBack:N?()=>p.current?.():void 0}),()=>x.setTrail(b,null)},[x,b,l,N]);const g=s.length>0||r.length>0;return e.jsxs("div",{className:c("flex min-h-full flex-col",v),children:[!x&&(N||l)&&e.jsxs("div",{className:"flex shrink-0 items-center gap-2 px-5 pt-4",children:[N&&e.jsx(se,{variant:"ghost",onClick:()=>p.current?.(),"aria-label":a,leftIcon:e.jsx(G,{icon:L.ChevronLeft,size:"sm"}),iconOnly:!0}),l&&e.jsx("h2",{className:"min-w-0 truncate text-md font-semibold tracking-title text-text",children:l})]}),e.jsx("div",{className:c("flex-1",lr[i],m),children:o?e.jsx(Ae,{variant:"inline",shape:f}):t}),g&&e.jsxs("div",{className:"sticky bottom-0 z-10 flex shrink-0 items-center gap-2 border-t border-border bg-surface px-5 py-3",children:[r.length>0&&e.jsx(ge,{actions:r,defaultVariant:"ghost"}),s.length>0&&e.jsx(ge,{actions:s,className:"ml-auto"})]})]})};function cr({label:t,description:s,control:r,bordered:n=!1,disabled:a=!1,className:l}){return e.jsxs("div",{className:c("flex items-center justify-between gap-4 py-2",n&&"rounded-lg border border-border px-3",a&&"opacity-50",l),children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm text-text",children:t}),s&&e.jsx("div",{className:"text-xs text-text-muted",children:s})]}),e.jsx("div",{className:"shrink-0",children:r})]})}function ir({icon:t,title:s,description:r,actions:n,children:a,className:l}){return e.jsxs("section",{className:c("flex flex-col gap-2",l),children:[e.jsxs("div",{className:"flex items-start gap-2",children:[t&&e.jsx(G,{icon:t,size:"md",color:"secondary",className:"mt-0.5"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"text-sm font-semibold text-text",children:s}),r&&e.jsx("p",{className:"text-xs text-text-muted",children:r})]}),n&&e.jsx("div",{className:"shrink-0",children:n})]}),e.jsx("div",{className:c("flex flex-col",t&&"pl-6"),children:a})]})}function dr({label:t,dotColor:s,onClick:r,className:n}){return e.jsxs("button",{type:"button",onClick:r,className:c("inline-flex max-w-full items-center gap-1.5 rounded-full bg-surface-sunk px-2.5 py-1 text-xs text-text-muted transition-colors duration-fast ease-out hover:bg-surface-hover hover:text-text",n),children:[s&&e.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{backgroundColor:s},"aria-hidden":!0}),e.jsx("span",{className:"min-w-0 truncate",children:t}),e.jsx(G,{icon:L.ArrowUpRight,size:"xs",className:"opacity-70"})]})}function st(t){const{id:s,header:r,accessor:n,label:a,tone:l,visible:o,width:f,sortable:i,align:v}=t;return{id:s,header:r,accessor:m=>a(n(m),m),cell:(m,x)=>{const b=n(x);return o&&!o(b,x)?null:e.jsx(Ze,{variant:l?l(b,x):"default",size:"sm",children:a(b,x)})},width:f,sortable:i,align:v}}function ur(t){const{id:s,header:r,accessor:n,onLabel:a,offLabel:l,onTone:o="success",offTone:f="secondary",width:i,sortable:v}=t;return st({id:s,header:r,accessor:m=>!!n(m),label:m=>m?a:l,tone:m=>m?o:f,width:i,sortable:v})}function xr(t){const{id:s,header:r,accessor:n,label:a,empty:l="—",separator:o=", ",width:f,searchable:i,sortable:v}=t;return{id:s,header:r,accessor:m=>{const x=n(m),p=(x==null?[]:Array.isArray(x)?x:[x]).filter(Boolean).map(N=>a(N)??N);return p.length?p.join(o):l},width:f,searchable:i,sortable:v}}function fr(t,s){return s.split(".").reduce((r,n)=>r&&typeof r=="object"&&n in r?r[n]:void 0,t)}const mr=({groups:t,data:s,size:r="md",className:n})=>{const a=m=>{if(!m)return"-";try{return new Date(m).toLocaleDateString("nl-NL",{year:"numeric",month:"long",day:"numeric"})}catch{return String(m)}},l=m=>m?"Ja":"Nee",o=(m,x)=>{if(!x)return String(m||"-");const b=x.find(p=>p.value===m);return b?b.label:String(m||"-")},f=d.useCallback(m=>{const x=fr(s,m.name);if(m.type==="array"){const p=x;return!p||p.length===0?e.jsx(de,{variant:"body",size:"sm",className:"text-text-muted",children:"Geen items"}):e.jsx("div",{className:"space-y-3",children:p.map((N,g)=>e.jsxs("div",{className:"p-4 border border-border rounded-xl space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs(de,{variant:"label",size:"sm",weight:"medium",className:"text-text-muted",children:[m.label," ",g+1]})}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:m.arrayFields?.map(h=>{const z=N?.[h.name];let k="-";switch(h.type){case"text":case"email":case"number":case"tel":case"url":case"textarea":k=z||"-";break;case"select":case"radio":k=o(z,h.options);break;case"checkbox":k=l(z);break;case"date":k=a(z);break;case"custom":k=h.customComponent?.({value:z});break;default:k=String(z||"-")}return h.format&&(k=h.format(z,N)),e.jsxs("div",{className:"space-y-1",children:[e.jsx(de,{variant:"label",size:"xs",className:"text-text-muted",children:h.label}),e.jsx(de,{variant:"body",size:"sm",className:"text-text",children:k})]},h.name)})})]},g))})}if(m.type==="custom"&&m.customComponent)return m.customComponent({value:x});if(m.format){const p=m.format(x,s);return e.jsx(de,{variant:"body",size:"sm",className:"text-text",children:p})}let b="-";switch(m.type){case"text":case"email":case"password":case"number":case"tel":case"url":b=x?String(x):"-";break;case"textarea":b=x?e.jsx("div",{className:"whitespace-pre-wrap",children:String(x||"-")}):"-";break;case"select":case"radio":b=o(x,m.options);break;case"checkbox":b=l(x);break;case"date":b=a(x);break;default:b=x?String(x):"-"}return e.jsx(de,{variant:"body",size:"sm",className:"text-text",children:b})},[s]),i=d.useCallback(m=>{if(m.conditional&&!m.conditional(s))return null;const x=m.items.filter(p=>!(p.hidden||p.conditional&&!p.conditional(s)));if(x.length===0)return null;const b=c("space-y-4",{"grid gap-4":m.layout==="grid","flex flex-wrap gap-4":m.layout==="flex"},m.layout==="grid"&&{"grid-cols-1":!m.columns||m.columns===1,"grid-cols-2":m.columns===2,"grid-cols-3":m.columns===3,"grid-cols-4":m.columns===4},m.className);return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8 p-6 border border-border rounded-xl",children:[e.jsxs("div",{className:"md:col-span-1",children:[e.jsx(de,{variant:"label",size:"lg",weight:"semibold",className:"text-text",children:m.title}),m.description&&e.jsx(de,{variant:"body",size:"sm",className:"text-text-muted mt-1",children:m.description})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx("div",{className:b,children:x.map(p=>e.jsxs("div",{className:"space-y-1",style:{width:typeof p.width=="string"?p.width:void 0,gridColumn:typeof p.width=="number"?`span ${p.width} / span ${p.width}`:void 0},children:[p.type!=="custom"&&e.jsx(de,{variant:"label",size:"sm",className:"font-medium text-text-muted",children:p.label}),f(p)]},p.name))})})]},m.id)},[s,f]),v=c("space-y-6",{"max-w-md":r==="sm","max-w-2xl":r==="md","max-w-4xl":r==="lg","max-w-full":r==="full"},n);return e.jsx("div",{className:v,children:e.jsx("div",{className:"space-y-8",children:t.map(i)})})},hr=()=>e.jsx(Ae,{variant:"inline",shape:"menu"}),rt=({item:t,isSelectedHandler:s,onClick:r,depth:n=0})=>{const a=!!(t.children&&t.children.length>0),l=s?s(t.path):!1;if(a)return e.jsxs("li",{children:[e.jsxs("div",{className:c("flex items-center gap-2 px-2.5 pt-5 pb-2 text-2xs font-semibold uppercase tracking-label text-text-disabled"),children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.label}),t.count!==void 0&&t.count>0&&e.jsx("span",{className:"font-normal tabular-nums",children:t.count})]}),e.jsx("ul",{className:"flex flex-col gap-px",children:t.children?.map((i,v)=>e.jsx(rt,{item:i,isSelectedHandler:s,onClick:r,depth:n+1},v))})]});const o=t.action,f=o?.visibility!=="always";return e.jsx("li",{children:e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>t.path&&r?.(t.path),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),t.path&&r?.(t.path))},className:c("group/item flex h-row-md cursor-pointer items-center gap-2.5 rounded-md px-2.5 text-base no-underline","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",l?"bg-surface-hover font-medium text-text shadow-sm":"text-text-muted hover:bg-page-hover hover:text-text"),children:[t.icon&&e.jsx("span",{className:c("flex w-5 shrink-0 items-center justify-center",l?"text-text-muted":"text-text-subtle"),children:t.icon}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.label}),t.count!==void 0&&t.count>0&&e.jsx("span",{className:c("shrink-0 text-xs tabular-nums",l?"rounded-full bg-accent px-1.5 font-semibold text-accent-fg":"text-text-subtle",o&&f&&"group-hover/item:hidden group-focus-within/item:hidden"),children:t.count}),o&&e.jsx("button",{type:"button","aria-label":o.label,title:o.label,onClick:i=>{i.stopPropagation(),o.onClick()},onKeyDown:i=>i.stopPropagation(),className:c("flex size-5 shrink-0 items-center justify-center rounded-sm","text-text-subtle transition-colors duration-fast ease-out","hover:bg-page-hover hover:text-text","focus-visible:outline-none focus-visible:focus-ring",f&&"opacity-0 group-hover/item:opacity-100 focus-visible:opacity-100"),children:o.icon})]})})},br=({items:t,isSelectedHandler:s,onClick:r,preMenuItemsComponent:n,loading:a=!1})=>a?e.jsxs("nav",{className:"flex h-full min-h-0 shrink-0 flex-col",children:[n&&e.jsx("div",{className:"pb-4",children:n}),e.jsx(hr,{})]}):e.jsxs("nav",{className:"flex h-full min-h-0 shrink-0 flex-col",children:[n&&e.jsx("div",{className:"pb-4",children:n}),e.jsx("ul",{className:"flex min-h-0 flex-1 flex-col gap-px overflow-y-auto",children:t.map((l,o)=>!l.path&&!l.label&&!l.children?e.jsx("li",{"aria-hidden":!0,className:"h-4"},o):e.jsx(rt,{item:l,isSelectedHandler:s,onClick:r},o))})]}),gr={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-lg",xl:"text-xl","2xl":"text-2xl","3xl":"text-3xl","4xl":"text-3xl"},pr={light:"font-normal",normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},vr={primary:"text-text",secondary:"text-text-muted",accent:"text-accent",success:"text-success-fg",warning:"text-warning-fg",error:"text-danger-fg",info:"text-info-fg",neutral:"text-text",current:"text-current"},jr={left:"text-left",center:"text-center",right:"text-right"},yr=({level:t=1,size:s,weight:r="semibold",color:n="current",align:a="left",truncate:l=!1,className:o,children:f,...i})=>{const v=`h${t}`,m=c("font-sans text-pretty",gr[s||Nr(t)],pr[r],vr[n],jr[a],l&&"truncate",o);return e.jsx(v,{className:m,...i,children:f})};function Nr(t){return{1:"2xl",2:"xl",3:"lg",4:"lg",5:"md",6:"md"}[t]||"md"}const wr=({commands:t,isOpen:s,onClose:r,labels:n,initialCommandPath:a,initialActiveIndex:l})=>{const[o,f]=d.useState(""),[i,v]=d.useState(a||[]),[m,x]=d.useState(l||0),b=d.useRef(null),p=d.useRef(null),g=(i.length?t.find(h=>h.id===i[0])?.subCommands||[]:t).filter(h=>h.label.toLowerCase().includes(o.toLowerCase()));return d.useEffect(()=>{s||(f(""),v(a||[]),x(l||0))},[s]),d.useEffect(()=>{const h=z=>{if(s){if(z.key==="Escape")r();else if(z.key==="ArrowUp")x(k=>k>0?k-1:g.length-1);else if(z.key==="ArrowDown")x(k=>k<g.length-1?k+1:0);else if(z.key==="Enter"){const k=g[m];k&&(k.subCommands?(v([...i,k.id]),x(0)):k.action&&(k.action(),r()))}}};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s,r,g,m,i]),d.useEffect(()=>{const h=z=>{b.current&&!b.current.contains(z.target)&&r()};return s&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s,r]),d.useEffect(()=>{if(!s)return;p.current?.querySelector(`[data-index="${m}"]`)?.scrollIntoView({block:"nearest"})},[m,s]),s?e.jsx("div",{className:"fixed inset-0 z-modal flex items-center justify-center bg-scrim",children:e.jsxs("div",{className:"flex flex-col w-full max-w-lg max-h-dialog p-2 mx-auto rounded-lg border border-border shadow-modal bg-surface",ref:b,children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 flex-shrink-0",children:[e.jsx(L.Search,{className:"w-4 h-4 text-text-muted shrink-0"}),e.jsx("input",{type:"text",autoFocus:!0,placeholder:n?.searchPlaceholder||"Search commands...",value:o,onChange:h=>f(h.target.value),className:"w-full border-0 bg-transparent py-2 text-text focus:outline-none"})]}),e.jsxs("div",{ref:p,className:"mt-2 pt-2 text-sm border-t border-border max-h-dialog-list overflow-y-auto",children:[g.length===0&&e.jsx("div",{className:"text-text-muted text-center text-sm",children:n?.noCommandsFound||"No commands found"}),g.map((h,z)=>e.jsxs("div",{"data-index":z,className:`flex items-center p-2 cursor-pointer rounded-md ${z===m?"bg-accent-soft text-accent":"text-text"}`,onClick:()=>{h.subCommands?(v([...i,h.id]),x(0)):h.action&&(h.action(),r())},onMouseEnter:()=>x(z),children:[h.icon&&e.jsx("span",{className:"mr-3",children:h.icon}),e.jsx("span",{className:"flex-grow",children:h.label}),h.subCommands&&e.jsx("span",{className:"text-text-muted",children:e.jsx(L.ChevronRight,{className:"w-4 h-4"})})]},h.id))]}),e.jsxs("div",{className:"flex items-center gap-4 px-3 pt-2 mt-2 text-xs text-text-muted border-t border-border",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("kbd",{className:"inline-flex items-center justify-center min-w-5 px-1 py-0.5 rounded border border-border bg-surface-sunk text-xs font-medium not-italic",children:"↑↓"}),n?.navigate||"to navigate"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("kbd",{className:"inline-flex items-center justify-center min-w-5 px-1 py-0.5 rounded border border-border bg-surface-sunk text-xs font-medium not-italic",children:"↵"}),n?.select||"to select"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("kbd",{className:"inline-flex items-center justify-center min-w-5 px-1 py-0.5 rounded border border-border bg-surface-sunk text-xs font-medium not-italic",children:"Esc"}),n?.close||"to close"]})]})]})}):null},kr={none:"p-0",xs:"p-1",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-8","2xl":"p-12"},Cr={none:"m-0",xs:"m-1",sm:"m-2",md:"m-4",lg:"m-6",xl:"m-8","2xl":"m-12"},Sr={none:"",primary:"bg-accent text-accent-fg",secondary:"bg-surface-hover",accent:"bg-accent-soft",success:"bg-success-soft",warning:"bg-warning-soft",error:"bg-danger-soft",info:"bg-info-soft",neutral:"bg-surface-hover",white:"bg-surface",module:"bg-surface","module-subtle":"bg-surface-sunk",backdrop:"bg-page",editor:"bg-surface",input:"bg-surface-input"},Er={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl",full:"rounded-full"},Tr={none:"shadow-none",sm:"shadow-none",md:"shadow-overlay",lg:"shadow-overlay",xl:"shadow-modal","2xl":"shadow-modal"},zr={none:"border-0",sm:"border",md:"border-2",lg:"border-4"},Mr={primary:"border-accent-border",secondary:"border-border",accent:"border-accent-border",success:"border-success-border",warning:"border-warning-border",error:"border-danger-border",info:"border-info-border",neutral:"border-border-subtle",white:"border-border-subtle"},$e=d.forwardRef(({padding:t,margin:s,background:r,radius:n,shadow:a,border:l,borderColor:o,className:f,children:i,...v},m)=>e.jsx("div",{ref:m,className:c(t&&kr[t],s&&Cr[s],r&&Sr[r],n&&Er[n],a&&Tr[a],l&&zr[l],o&&Mr[o],f),...v,children:i}));$e.displayName="Box";const Dr=({children:t,title:s,...r})=>e.jsxs($e,{background:"module",radius:"lg",shadow:"none",border:"sm",borderColor:"neutral",...r,children:[s&&e.jsx("span",{className:"mb-2 block text-sm font-semibold text-text",children:s}),t]});function _r({identifier:t,resourceLoader:s,framework:r="react",fallback:n,errorFallback:a,componentProps:l,className:o}){const f=d.useRef(null),[i,v]=d.useState(!0),[m,x]=d.useState(!1),[b,p]=d.useState(null),N=d.useRef(null);d.useRef(null);const g=d.useRef(s);return g.current=s,d.useEffect(()=>{let h=!0;return(async()=>{v(!0),x(!1),p(null);try{const k=await g.current();if(!h)return;const V=k.component||k.default||k;p(r==="react"?()=>V:()=>k)}catch(k){console.error(`[FederatedResource] Load failed: ${t}`,k),h&&x(!0)}finally{h&&v(!1)}})(),()=>{h=!1}},[t,r]),d.useEffect(()=>{if(i||!b||r==="react")return;const h=f.current;if(h){if(r==="svelte"){const z=b.default||b,k=new z({target:h,props:l||{}});return N.current=k,()=>k.$destroy()}if(b.mount){const z=b.mount({container:h,props:l||{}});return()=>{typeof z=="function"?z():b.unmount?.(h)}}}},[b,r,i]),d.useEffect(()=>{r==="svelte"&&N.current&&N.current.$set?.(l)},[l,r]),e.jsxs("div",{ref:f,className:o,style:{display:"contents"},children:[i&&n,!i&&m&&a,r==="react"&&!m&&b&&e.jsx(b,{...l})]})}class Ar extends d.Component{constructor(){super(...arguments),this.state={hasError:!1,error:null}}static getDerivedStateFromError(s){return{hasError:!0,error:s}}componentDidCatch(s,r){console.error(`[ErrorBoundary] Error in ${this.props.name||"Component"}:`,s,r)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:e.jsxs("div",{className:"p-4 m-4 border border-danger-border bg-danger-soft rounded-lg",children:[e.jsx("h2",{className:"text-lg font-semibold text-danger-fg",children:"Something went wrong"}),e.jsx("p",{className:"text-sm text-danger-fg mt-1",children:this.props.name?`Error in ${this.props.name}`:"The component failed to render."}),e.jsx("button",{className:"mt-4 px-4 py-2 bg-danger text-on-error rounded hover:opacity-90 transition-opacity text-sm",onClick:()=>this.setState({hasError:!1,error:null}),children:"Try again"})]}):this.props.children}}exports.AssistantCard=Rs;exports.Avatar=Qe;exports.AvatarStack=Hs;exports.Badge=Ze;exports.Box=$e;exports.Button=se;exports.ButtonGroup=kt;exports.Card=Dr;exports.ChannelBadge=Vs;exports.Checkbox=fe;exports.CommandPalette=wr;exports.ConfirmDialog=ps;exports.ContentLoading=Ae;exports.DatePicker=ye;exports.Dropdown=Ge;exports.EmptyState=Cs;exports.ErrorBoundary=Ar;exports.FederatedResource=_r;exports.FilterChip=Oe;exports.FolderSelect=Ue;exports.Form=gs;exports.FormSection=Xe;exports.Heading=yr;exports.IDENTITY_TONE_COUNT=Fe;exports.Icon=G;exports.Image=Us;exports.Kbd=Ss;exports.KpiCard=Js;exports.Link=$t;exports.List=Ws;exports.ListBulkAction=Ks;exports.MeetingGrid=pt;exports.MessageBubble=Gs;exports.Modal=_e;exports.PageHeader=Xs;exports.PageToolbar=Jt;exports.PageToolbarActions=ge;exports.ParticipantTile=vt;exports.Popover=ze;exports.ProgressBar=zs;exports.RichText=tr;exports.SearchField=De;exports.SearchableTextField=Ke;exports.SectionCaption=sr;exports.SectionDivider=rr;exports.SegmentedToggle=Be;exports.Select=be;exports.SettingsFrameProvider=nr;exports.SettingsPage=or;exports.SettingsRow=cr;exports.SettingsSection=ir;exports.SidebarMenu=br;exports.SourceChip=dr;exports.Spinner=As;exports.SplitButton=Me;exports.StatusDot=Ls;exports.StepIndicator=Ps;exports.StorageInput=Je;exports.Switch=We;exports.TabBar=as;exports.Table=Ce;exports.Tabs=Ye;exports.Text=de;exports.TextArea=Ne;exports.TextField=he;exports.VideoSurface=jt;exports.View=mr;exports.autofillProps=Se;exports.badgeColumn=st;exports.booleanBadgeColumn=ur;exports.catTone=gt;exports.cn=c;exports.createSizes=xt;exports.createVariants=ut;exports.dateFilterHandler=Xt;exports.identityDotClass=bt;exports.identityPlateClass=Te;exports.identityTone=Ee;exports.labelsColumn=xr;exports.resolveLucideIcon=Ct;exports.selectFilterHandler=Zt;exports.useAnchoredPosition=pe;exports.useSettingsFrame=tt;exports.useSettingsFrameHost=ar;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const lt=require("clsx"),u=require("react"),e=require("react/jsx-runtime"),L=require("lucide-react"),ot=require("dompurify"),ct=require("react-markdown"),it=require("remark-gfm");function dt(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(s,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return s.default=t,Object.freeze(s)}const ut=dt(L);function c(...t){return lt.clsx(t)}function xt(t){return(s,r)=>t[s]?.[r]||""}function ft(t){return s=>t[s]||""}function pe(t,s,{gap:r=6,matchWidth:n=!1,placement:a="bottom-start"}={}){const[l,o]=u.useState({});return u.useLayoutEffect(()=>{if(!t)return;const f=()=>{const i=s.current;if(!i)return;const p=i.getBoundingClientRect(),m=window.innerHeight-p.bottom,d=p.top,b=a.startsWith("top"),v=b?d<200&&m>d:m<200&&d>m,y=b!==v,g={position:"fixed"};y?(g.bottom=window.innerHeight-p.top+r,g.maxHeight=Math.max(120,d-r*2)):(g.top=p.bottom+r,g.maxHeight=Math.max(120,m-r*2)),a.endsWith("end")?g.right=window.innerWidth-p.right:g.left=p.left,n&&(g.width=p.width),o(g)};return f(),window.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{window.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[t,s,r,n,a]),l}const Fe=5;function mt(t){let s=2166136261;for(let r=0;r<t.length;r++)s^=t.charCodeAt(r),s=Math.imul(s,16777619);return s>>>0}function Te(t){const s=(t??"").trim().toLowerCase();return s?mt(s)%Fe+1:1}const ht={1:"bg-cat-1-soft text-cat-1-fg",2:"bg-cat-2-soft text-cat-2-fg",3:"bg-cat-3-soft text-cat-3-fg",4:"bg-cat-4-soft text-cat-4-fg",5:"bg-cat-5-soft text-cat-5-fg"},bt={1:"bg-cat-1",2:"bg-cat-2",3:"bg-cat-3",4:"bg-cat-4",5:"bg-cat-5"};function ze(t){return ht[Te(t)]}function gt(t){return bt[Te(t)]}const Le=["cat-1","cat-2","cat-3","cat-4","cat-5"];function pt(t){let s=0;for(let r=0;r<t.length;r++)s=s*31+t.charCodeAt(r)>>>0;return Le[s%Le.length]}function vt({tiles:t,pinned:s,className:r}){if(s)return e.jsxs("div",{className:c("flex flex-col md:flex-row gap-2 h-full min-h-0",r),children:[e.jsx("div",{className:"flex-1 min-h-0",children:s}),t.length>0&&e.jsx("div",{className:"flex md:flex-col gap-2 md:w-48 overflow-auto",children:t.map((a,l)=>e.jsx("div",{className:"min-w-40 md:min-w-0",children:a},l))})]});const n=t.length<=1?"grid-cols-1":t.length<=4?"grid-cols-2":t.length<=9?"grid-cols-3":"grid-cols-4";return e.jsx("div",{className:c("grid gap-2 h-full",n,r),children:t.map((a,l)=>e.jsx("div",{children:a},l))})}function jt({name:t,avatarUrl:s,muted:r,speaking:n,hasVideo:a,videoSlot:l,className:o,fill:f}){return e.jsxs("div",{className:c("relative rounded-lg overflow-hidden bg-video-surface flex items-center justify-center",f?"h-full w-full":"aspect-video",n&&"ring-2 ring-speaking",o),children:[a&&l?e.jsx("div",{className:"absolute inset-0",children:l}):e.jsx("div",{className:"flex flex-col items-center gap-2 text-gray-300",children:s?e.jsx("img",{src:s,alt:t,className:"w-16 h-16 rounded-full object-cover"}):e.jsx("div",{className:"w-16 h-16 rounded-full bg-video-surface-strong flex items-center justify-center",children:a?e.jsx(L.VideoOff,{className:"w-8 h-8"}):e.jsx(L.User,{className:"w-8 h-8"})})}),e.jsxs("div",{className:"absolute bottom-2 left-2 flex items-center gap-1.5 px-2 py-1 rounded bg-video-overlay text-white text-xs",children:[r?e.jsx(L.MicOff,{className:"w-3 h-3"}):e.jsx(L.Mic,{className:"w-3 h-3"}),e.jsx("span",{className:"truncate max-w-35",children:t})]})]})}function yt({attach:t,active:s=!0,mirrored:r=!1,className:n}){const a=u.useRef(null);return u.useEffect(()=>{if(!s||!a.current)return;const l=t(a.current);return()=>{typeof l=="function"&&l(),a.current&&(a.current.innerHTML="")}},[t,s]),e.jsx("div",{ref:a,className:c("w-full h-full bg-video-surface-strong overflow-hidden",r&&"[&>*]:scale-x-[-1]",n)})}const Nt={primary:"bg-accent text-accent-fg hover:bg-accent-hover disabled:bg-surface-hover",secondary:"bg-surface-sunk text-text-strong hover:bg-surface-hover disabled:bg-surface-hover",outline:"border border-border text-text-strong hover:bg-surface-hover",ghost:"text-text-muted hover:bg-surface-hover hover:text-text",destructive:"border border-danger-border bg-danger-soft text-danger-fg hover:border-danger disabled:bg-surface-hover",success:"bg-success text-text-inverse hover:opacity-90 disabled:bg-surface-hover",warning:"bg-warning text-text-inverse hover:opacity-90 disabled:bg-surface-hover","danger-solid":"bg-danger text-text-inverse hover:opacity-90 disabled:bg-surface-hover"},wt={xs:"h-control-xs px-2 text-xs",sm:"h-control-sm px-3 text-sm",md:"h-control-md px-4 text-sm",lg:"h-control-lg px-4 text-sm",xl:"h-control-xl px-6 text-base","2xl":"h-control-2xl px-6 text-base",full:"h-control-md px-4 text-sm"},kt={xs:"h-control-xs w-6",sm:"h-control-sm w-7",md:"h-control-md w-8",lg:"h-control-lg w-9",xl:"h-control-xl w-10","2xl":"h-control-2xl w-12",full:"h-control-md w-8"},se=u.forwardRef(({variant:t="primary",size:s="md",fullWidth:r=!1,loading:n=!1,leftIcon:a,rightIcon:l,iconOnly:o=!1,shape:f="default",className:i,children:p,disabled:m,...d},b)=>{const v=m||n;return e.jsxs("button",{ref:b,type:"button",className:c("inline-flex shrink-0 items-center justify-center gap-2 cursor-pointer font-medium",f==="circle"?"rounded-full":"rounded-md","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:border-border-subtle","disabled:text-text-disabled",Nt[t],o?kt[s]:wt[s],(r||s==="full")&&"w-full",n&&"cursor-wait",i),disabled:v,"aria-busy":n||void 0,...d,children:[n&&e.jsx("span",{"aria-hidden":!0,className:"size-icon-md shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent"}),!n&&a&&e.jsx("span",{className:"flex items-center justify-center shrink-0",children:a}),!o&&p,!n&&l&&e.jsx("span",{className:"flex items-center justify-center shrink-0",children:l}),o&&!n&&!a&&!l&&p]})});se.displayName="Button";const Ct=({children:t,size:s="md",orientation:r="horizontal",attached:n=!0,className:a})=>{const l=c("inline-flex",{"flex-row":r==="horizontal","flex-col":r==="vertical","[&>*:not(:first-child):not(:last-child)]:rounded-none":n,"[&>*:first-child]:rounded-r-none":n&&r==="horizontal","[&>*:last-child]:rounded-l-none":n&&r==="horizontal","[&>*:first-child]:rounded-b-none":n&&r==="vertical","[&>*:last-child]:rounded-t-none":n&&r==="vertical","[&>*:not(:first-child)]:-ml-px":n&&r==="horizontal","[&>*:not(:first-child)]:-mt-px":n&&r==="vertical","gap-1":!n&&s==="xs","gap-2":!n&&(s==="sm"||s==="md"),"gap-3":!n&&(s==="lg"||s==="xl")},a);return e.jsx("div",{className:l,role:"group",children:t})};function St(t){if(!t)return;const s=t.split(/[-_ ]/).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(""),r=ut[s];return typeof r=="function"||typeof r=="object"&&r!==null?r:void 0}const Et={primary:"text-text",secondary:"text-text-muted",accent:"text-accent",success:"text-success-fg",warning:"text-warning-fg",error:"text-danger-fg",info:"text-info-fg",neutral:"text-text-subtle",current:"text-current"},G=({icon:t,size:s="md",color:r="current",clickable:n=!1,onClick:a,className:l,"aria-label":o,...f})=>{const i=typeof s=="number"?s:Tt(s),p=c("inline-block shrink-0",Et[r],n&&["cursor-pointer rounded-sm transition-opacity duration-fast ease-out hover:opacity-80","focus-visible:outline-none focus-visible:focus-ring"],l),m={size:i,strokeWidth:2,className:p,onClick:n?a:void 0,"aria-label":o,"aria-hidden":o?void 0:!0,role:n?"button":void 0,tabIndex:n?0:void 0,onKeyDown:n?d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),a?.())}:void 0,...f};return e.jsx(t,{...m})};function Tt(t){return{xs:12,sm:14,md:16,lg:20,xl:24}[t]}const Me=({trigger:t,children:s,placement:r="bottom-start",className:n,rootClassName:a,triggerClassName:l,disabled:o=!1,triggerLabel:f})=>{const[i,p]=u.useState(!1),m=u.useRef(null),d=u.useRef(null),b=pe(i,d,{placement:r});u.useEffect(()=>{if(!i)return;const g=z=>{m.current&&!m.current.contains(z.target)&&p(!1)},h=z=>{z.key==="Escape"&&p(!1)};return document.addEventListener("mousedown",g),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",g),document.removeEventListener("keydown",h)}},[i]);const v=g=>{g.stopPropagation(),!o&&p(h=>!h)},y=()=>p(!1);return e.jsxs("div",{ref:m,className:c("relative inline-flex",a),children:[e.jsx("button",{ref:d,type:"button",onClick:v,disabled:o,"aria-label":f,"aria-expanded":i,className:c("inline-flex items-center",o&&"cursor-not-allowed opacity-50",l),children:t}),i&&e.jsx("div",{className:c("fixed z-overlay overflow-y-auto rounded-lg border border-border bg-surface shadow-overlay",n),style:b,children:typeof s=="function"?s(y):s})]})},zt={none:"hover:bg-surface-sunk hover:text-text",default:"bg-surface-sunk text-text-muted hover:text-text",muted:"bg-surface-sunk text-text-subtle hover:text-text",outline:"text-text-muted ring-1 ring-inset ring-border-strong hover:bg-surface-hover hover:text-text",warning:"bg-warning-soft text-warning-fg",danger:"bg-danger-soft text-danger-fg"},Mt=t=>c("inline-flex cursor-pointer select-none items-center text-sm font-medium",t.size==="sm"?"h-control-sm":"h-control-md","transition-colors duration-fast ease-out",t.shape==="pill"?"rounded-full":"rounded-md",t.active?"bg-info-soft text-info-fg":zt[t.tone??"default"],t.className),Dt=t=>c("inline-flex items-center gap-1.5 pl-3",t.shape==="pill"?"rounded-full":"rounded-md",t.withClear?"pr-1.5":"pr-3","focus-visible:outline-none focus-visible:focus-ring");function Oe({label:t,icon:s,tone:r="default",shape:n="rect",size:a="md",active:l=!1,caret:o=!1,menu:f,menuClassName:i,onClear:p,clearLabel:m="Filter wissen",onClick:d,title:b,className:v}){const y=l&&!!p,g=n==="pill"?"rounded-full":"rounded-md",h=Mt({active:l,tone:r,shape:n,size:a,className:v}),z=e.jsxs(e.Fragment,{children:[s,t,o&&e.jsx(G,{icon:L.ChevronDown,size:"xs"})]}),k=Dt({shape:n,withClear:y}),V=y&&e.jsx("button",{type:"button","aria-label":m,onClick:p,className:c("inline-flex h-full items-center pr-3 focus-visible:outline-none focus-visible:focus-ring",g),children:e.jsx(G,{icon:L.X,size:"xs"})});return f?e.jsxs("span",{className:h,title:b,children:[e.jsx(Me,{trigger:z,rootClassName:"h-full",triggerClassName:c(k,"h-full"),className:c("min-w-menu p-1.5",i),children:f}),V]}):y?e.jsxs("span",{className:h,title:b,children:[e.jsx("button",{type:"button",onClick:d,className:k,children:z}),V]}):e.jsx("button",{type:"button",title:b,onClick:d,className:c(h,k),children:z})}const _t={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-md",xl:"text-lg"},At={primary:"text-text hover:text-info-fg hover:underline",info:"text-info-fg hover:underline",secondary:"text-text-muted hover:text-text",neutral:"text-text-muted hover:text-text",accent:"text-accent hover:underline",success:"text-success-fg hover:underline",warning:"text-warning-fg hover:underline",error:"text-danger-fg hover:underline"},$t={primary:"bg-accent-soft",accent:"bg-accent-soft",secondary:"bg-surface-hover",neutral:"bg-surface-hover",success:"bg-success-soft",warning:"bg-warning-soft",error:"bg-danger-soft",info:"bg-info-soft"},Lt=({variant:t="default",size:s="md",color:r="primary",disabled:n=!1,external:a=!1,className:l,children:o,href:f,target:i,rel:p,...m})=>{const d=a||f&&(f.startsWith("http")||f.startsWith("mailto:")),b=c("inline-flex items-center gap-1 underline-offset-2","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",_t[s],!n&&At[r],t==="subtle"&&"no-underline opacity-70 hover:opacity-100",t==="underline"&&"underline decoration-1 hover:decoration-2",t==="button"&&["h-control-md rounded-md px-3 font-semibold no-underline hover:no-underline",$t[r]],n&&"pointer-events-none cursor-not-allowed text-text-disabled opacity-50",l),v={...m,href:n?void 0:f,target:d?"_blank":i,rel:d?"noopener noreferrer":p,"aria-disabled":n||void 0};return e.jsxs("a",{className:b,...v,children:[o,d&&e.jsx(L.ExternalLink,{className:"size-icon-sm shrink-0","aria-hidden":!0})]})},Pt={sm:"h-control-sm px-3 text-sm",md:"h-control-md px-3 text-sm"};function Be({options:t,value:s,onChange:r,size:n="sm",tone:a="sunk",fullWidth:l=!1,className:o,"aria-label":f}){return e.jsx("div",{role:"tablist","aria-label":f,className:c("gap-0.5 rounded-md p-0.5",a==="track"?"bg-surface-track":"bg-surface-sunk",l?"flex w-full":"inline-flex",o),children:t.map(i=>{const p=i.value===s;return e.jsx("button",{role:"tab","aria-selected":p,type:"button",onClick:()=>r(i.value),className:c("inline-flex cursor-pointer items-center justify-center gap-1.5 rounded-sm","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",l&&"min-w-0 flex-1",Pt[n],p?"bg-surface text-text font-medium shadow-sm":"text-text-muted hover:text-text"),children:i.label},i.value)})})}const Rt={primary:"bg-accent text-accent-fg hover:bg-accent-hover",secondary:"border border-border bg-surface text-text hover:bg-surface-hover",outline:"border border-accent-border text-accent hover:bg-accent-soft"},It={sm:"h-control-sm w-7",md:"h-control-md w-8"};function De({label:t,onClick:s,variant:r="primary",size:n="md",icon:a,options:l,disabled:o=!1,loading:f=!1,menuPlacement:i="bottom-end",menuLabel:p="More options"}){const m=o||f,d=l.length>0;return e.jsxs("div",{className:c("inline-flex items-center",r==="primary"&&"gap-px"),children:[e.jsx(se,{variant:r,size:n,onClick:s,disabled:o,loading:f,leftIcon:a,className:c(d&&"rounded-r-none"),children:t}),d&&e.jsx(Me,{placement:i,disabled:m,triggerLabel:p,className:"min-w-menu py-1",trigger:e.jsx("span",{"aria-hidden":"true",className:c("inline-flex items-center justify-center rounded-md rounded-l-none","transition-colors duration-fast ease-out",Rt[r],It[n],m&&"cursor-not-allowed opacity-50"),children:e.jsx(L.ChevronDown,{className:"size-icon-md"})}),children:b=>e.jsx(e.Fragment,{children:l.map(v=>e.jsxs("button",{type:"button",onClick:()=>{v.onClick(),b()},className:c("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",v.variant==="destructive"?"text-danger-fg hover:bg-danger-soft":"text-text hover:bg-surface-hover"),children:[v.icon&&e.jsx("span",{className:"shrink-0",children:v.icon}),v.label]},v.id))})})]})}const Ft={sm:"size-checkbox-sm",md:"size-checkbox",lg:"size-checkbox-lg",full:"size-checkbox"},Ot={sm:"min-h-control-sm",md:"min-h-control-md",lg:"min-h-control-lg",full:"min-h-control-md"},Bt={sm:"text-sm",md:"text-base",lg:"text-md",full:"text-base"},fe=u.forwardRef(({label:t,helperText:s,error:r,size:n="md",indeterminate:a=!1,containerClassName:l,labelClassName:o,className:f,id:i,...p},m)=>{const d=u.useId(),b=i||`checkbox-${d}`,v=!!r,y=u.useRef(null),g=u.useCallback(h=>{y.current=h,typeof m=="function"?m(h):m&&typeof m=="object"&&(m.current=h)},[m]);return u.useEffect(()=>{y.current&&(y.current.indeterminate=a)},[a]),e.jsxs("div",{className:c("flex flex-col",l),children:[e.jsxs("div",{className:c("flex items-center gap-3",Ot[n]),children:[e.jsx("input",{ref:g,id:b,type:"checkbox","aria-invalid":v||void 0,className:c("shrink-0 rounded-xs border accent-accent","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:bg-surface-hover",Ft[n],v?"border-danger-border":"border-border-strong",f),...p}),t&&e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{htmlFor:b,className:c("cursor-pointer",v?"text-danger-fg":"text-text",Bt[n],o),children:t}),s&&!r&&e.jsx("p",{className:"mt-0.5 text-xs text-text-subtle",children:s})]})]}),r&&e.jsx("p",{className:"mt-1 text-xs text-danger-fg",children:r})]})});fe.displayName="Checkbox";const Ht=()=>e.jsx(G,{icon:L.Calendar,size:"md",color:"current"}),qt=()=>e.jsx(G,{icon:L.ChevronLeft,size:"md",color:"current"}),Vt=()=>e.jsx(G,{icon:L.ChevronRight,size:"md",color:"current"}),ye=u.forwardRef(({value:t,onChange:s,placeholder:r="Select date",disabled:n=!1,required:a=!1,size:l="md",className:o,minDate:f,maxDate:i,format:p="MM/dd/yyyy",withTime:m=!1},d)=>{const[b,v]=u.useState(!1),[y,g]=u.useState(()=>t||new Date),h=u.useRef(null),z=u.useRef(null),k=pe(b,z);u.useEffect(()=>{const x=S=>{h.current&&!h.current.contains(S.target)&&v(!1)};return b&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[b]);const V=x=>{if(!x)return"";const S=x.getDate().toString().padStart(2,"0"),j=(x.getMonth()+1).toString().padStart(2,"0"),A=x.getFullYear(),N=p==="dd/MM/yyyy"?`${S}/${j}/${A}`:p==="yyyy-MM-dd"?`${A}-${j}-${S}`:`${j}/${S}/${A}`;return m?`${N} ${_(x)}`:N},_=x=>`${x.getHours().toString().padStart(2,"0")}:${x.getMinutes().toString().padStart(2,"0")}`,Y=x=>{const[S,j]=x.split(":").map(Number);if(Number.isNaN(S)||Number.isNaN(j))return;const A=t?new Date(t):new Date;A.setHours(S,j,0,0),s?.(A)},q=()=>{const x=y.getFullYear(),S=y.getMonth(),j=new Date(x,S,1),A=new Date(j);A.setDate(A.getDate()-j.getDay());const N=[],K=new Date(A);for(let re=0;re<42;re++)N.push(new Date(K)),K.setDate(K.getDate()+1);return N},P=x=>{if(x.getMonth()===y.getMonth()&&!(f&&x<f)&&!(i&&x>i)){if(m){const j=new Date(x);j.setHours(t?.getHours()??0,t?.getMinutes()??0,0,0),s?.(j);return}s?.(x),v(!1)}},H=()=>{g(new Date(y.getFullYear(),y.getMonth()-1,1))},ee=()=>{g(new Date(y.getFullYear(),y.getMonth()+1,1))},J=()=>{s?.(null),v(!1)},W=c("w-full border border-border-strong rounded-tile transition-colors duration-fast","bg-surface text-text","placeholder:text-text-muted","focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:bg-surface-hover disabled:text-text-disabled",{"h-control-sm px-3 text-sm":l==="sm","h-control-md px-3 text-base":l==="md","h-control-lg px-3 text-base":l==="lg","h-control-md w-full px-3 text-base":l==="full"},o),le=q(),w=["January","February","March","April","May","June","July","August","September","October","November","December"];return e.jsxs("div",{ref:h,className:"relative",children:[e.jsxs("div",{ref:z,className:"relative",children:[e.jsx("input",{ref:d,type:"text",value:V(t??null),placeholder:r,disabled:n,required:a,readOnly:!0,onClick:()=>!n&&v(!b),className:c(W,"pr-10 cursor-pointer")}),e.jsx("button",{type:"button",onClick:()=>!n&&v(!b),disabled:n,className:"absolute inset-y-0 right-0 flex items-center pr-3 text-text-muted hover:text-text-muted",children:e.jsx(Ht,{})})]}),b&&e.jsxs("div",{style:k,className:"fixed z-overlay overflow-auto rounded-lg border border-border bg-surface p-4 shadow-overlay min-w-panel",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("button",{onClick:H,className:"p-1 hover:bg-surface-hover rounded",children:e.jsx(qt,{})}),e.jsxs("h3",{className:"text-sm font-medium text-text",children:[w[y.getMonth()]," ",y.getFullYear()]}),e.jsx("button",{onClick:ee,className:"p-1 hover:bg-surface-hover rounded",children:e.jsx(Vt,{})})]}),e.jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:["Su","Mo","Tu","We","Th","Fr","Sa"].map(x=>e.jsx("div",{className:"text-xs font-medium text-text-muted text-center py-1",children:x},x))}),e.jsx("div",{className:"grid grid-cols-7 gap-1",children:le.map((x,S)=>{const j=x.getMonth()===y.getMonth(),A=t&&x.toDateString()===t.toDateString(),N=x.toDateString()===new Date().toDateString(),K=!j||f&&x<f||i&&x>i;return e.jsx("button",{onClick:()=>!K&&P(x),disabled:K,className:c("w-8 h-8 text-sm rounded transition-colors duration-fast",{"text-text hover:bg-surface-hover":j&&!A&&!K,"bg-accent text-accent-fg":A,"bg-surface-hover text-text":N&&!A,"text-text-muted cursor-not-allowed":K}),children:x.getDate()},S)})}),m&&e.jsxs("div",{className:"mt-3 flex items-center gap-2 border-t border-border pt-3",children:[e.jsx("label",{htmlFor:"datepicker-time",className:"text-sm text-text-muted",children:"Tijd"}),e.jsx("input",{id:"datepicker-time",type:"time",value:t?_(t):"",onChange:x=>Y(x.target.value),className:"h-control-sm rounded-md border border-border bg-surface-input px-2 text-sm text-text focus-visible:outline-none focus-visible:focus-ring"})]}),e.jsxs("div",{className:"flex justify-between items-center mt-4 pt-3 border-t border-border",children:[e.jsx("button",{onClick:J,className:"text-sm text-text-muted hover:text-text",children:"Clear"}),e.jsx("button",{onClick:()=>v(!1),className:"text-sm text-info-fg hover:underline",children:"Close"})]})]})]})}),Ut={sm:"h-control-sm px-3 text-sm",md:"h-control-md px-3 text-sm",lg:"h-control-lg px-3 text-base",full:"h-control-md w-full px-3 text-sm"},ve=t=>t.trim().toLowerCase(),be=u.forwardRef(({label:t,helperText:s,error:r,size:n="md",fullWidth:a=!1,disabled:l=!1,options:o,placeholder:f,containerClassName:i,labelClassName:p,className:m,id:d,searchable:b,multiple:v,value:y,onChange:g,allowCreate:h,onCreateOption:z,...k},V)=>{const _=d||`select-${Math.random().toString(36).substr(2,9)}`,Y=!!r,[q,P]=u.useState(!1),[H,ee]=u.useState(""),J=u.useRef(null),W=u.useRef(null),le=pe(q,W,{matchWidth:!0}),[w,x]=u.useState(o);u.useImperativeHandle(V,()=>J.current),u.useEffect(()=>{const M=D=>{J.current&&!J.current.contains(D.target)&&P(!1)};return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[]);const S=u.useCallback((M,D)=>M.some(E=>ve(E.value)===ve(D)||ve(E.label)===ve(D)),[]),j=u.useCallback((M,D)=>{const E=[...M],F=I=>{const O=(I??"").trim();O&&(S(E,O)||E.push({value:O,label:O}))};return Array.isArray(D)?D.forEach(F):F(D),E},[S]);u.useEffect(()=>{x(M=>{const D=[...o];return M.forEach(E=>{!S(D,E.value)&&!S(D,E.label)&&D.push(E)}),j(D,y)})},[o,y,j,S]);const A=M=>{if(v){const D=Array.isArray(y)?y:[],E=D.includes(M)?D.filter(F=>F!==M):[...D,M];g?.(E)}else g?.(M),P(!1),ee("")},N=v?null:w.find(M=>M.value===y),K=v?w.filter(M=>Array.isArray(y)&&y.includes(M.value)):[],re=b&&H?w.filter(M=>M.label.toLowerCase().includes(H.toLowerCase())):w,Q=!!h&&!!b&&!!H.trim()&&!S(w,H),X=M=>{const D=M.trim();if(!D)return;const E=z?.(D)??{value:D,label:D};if(S(w,E.value)||S(w,E.label)){A(E.value),ee(""),v||P(!1);return}x(F=>[...F,E]),A(E.value),ee(""),v||P(!1)},R=()=>v?K.length>0?K.map(M=>M.label).join(", "):f||"Select options":N?.label||f||"Select an option";return e.jsxs("div",{ref:J,className:c("relative flex flex-col",a&&"w-full",i),...k,children:[t&&e.jsx("label",{htmlFor:_,onClick:()=>P(!q),className:c("block text-xs font-semibold uppercase tracking-label mb-1.5",Y?"text-danger-fg":"text-text-muted",p),children:t}),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{ref:W,type:"button",id:_,disabled:l,onClick:()=>P(!q),className:c("flex w-full items-center justify-between gap-2 rounded-tile border transition-colors duration-fast text-left","focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:bg-surface-hover disabled:text-text-disabled","bg-surface",Ut[n],Y?"border-danger-border text-danger-fg focus-visible:focus-ring":"border-border-strong text-text",m),children:[e.jsx("span",{className:"truncate flex-1 min-w-0",children:R()}),e.jsx(L.ChevronDownIcon,{size:16,className:c("shrink-0 opacity-60 transition-transform duration-fast",q&&"rotate-180")})]}),q&&e.jsxs("div",{style:le,className:"fixed z-overlay flex flex-col overflow-hidden rounded-lg border border-border bg-surface shadow-overlay",children:[b&&e.jsx("div",{className:"p-2",children:e.jsx("input",{type:"text",placeholder:"Search...",value:H,onChange:M=>ee(M.target.value),onKeyDown:M=>{M.key==="Enter"&&Q&&(M.preventDefault(),X(H))},className:c("w-full px-3 py-2 text-sm rounded-md border","text-text border-border focus-visible:outline-none focus-visible:focus-ring")})}),Q&&e.jsxs("div",{className:c("cursor-pointer px-3 py-1.5 text-sm","text-info-fg hover:bg-surface-hover"),onClick:()=>X(H),children:["+: “",H.trim(),"”"]}),e.jsxs("ul",{className:"min-h-0 flex-1 overflow-auto py-1",children:[f&&!v&&e.jsx("li",{className:"cursor-pointer px-3 py-1.5 text-sm text-text-muted hover:bg-surface-hover",onClick:()=>{g?.(""),P(!1)},children:f}),re.map(M=>{const D=v?Array.isArray(y)&&y.includes(M.value):y===M.value;return e.jsx("li",{onClick:()=>!M.disabled&&A(M.value),className:c("cursor-pointer px-3 py-1.5 text-sm","text-text",M.disabled?"opacity-50 cursor-not-allowed":"hover:bg-surface-hover",D&&"bg-accent-soft text-accent font-semibold"),children:e.jsxs("div",{className:"flex items-center",children:[v&&e.jsx("input",{type:"checkbox",checked:D,readOnly:!0,className:"mr-3 h-4 w-4 rounded border-border [&:not(:checked)]:bg-surface-input text-accent "}),e.jsx("span",{children:M.label})]})},M.value)})]})]})]}),(r||s)&&e.jsx("p",{className:c("mt-1 text-xs",Y?"text-danger-fg":"text-text-muted"),children:r||s})]})});be.displayName="Select";const Kt={sm:"h-control-sm px-3 text-sm",md:"h-control-md px-3 text-base",lg:"h-control-lg px-3 text-base",full:"h-control-md px-3 text-base"},He="mb-1.5 block text-sm font-medium",qe="block w-full rounded-tile border bg-surface-input text-text transition-colors duration-fast ease-out placeholder:text-text-subtle focus-visible:outline-none focus-visible:focus-ring disabled:cursor-not-allowed disabled:bg-surface-hover disabled:text-text-disabled",Ve=t=>t?"border-danger-border bg-danger-soft":"border-border-strong",he=u.forwardRef(({label:t,helperText:s,error:r,size:n="md",fullWidth:a=!1,startIcon:l,endIcon:o,loading:f=!1,containerClassName:i,labelClassName:p,className:m,id:d,...b},v)=>{const y=u.useId(),g=d||`textfield-${y}`,h=!!r,z=r||s?`${g}-description`:void 0;return e.jsxs("div",{className:c("flex flex-col",a&&"w-full",i),children:[t&&e.jsx("label",{htmlFor:g,className:c(He,h?"text-danger-fg":"text-text-muted",p),children:t}),e.jsxs("div",{className:"relative",children:[l&&e.jsx("span",{className:"pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3 text-text-muted",children:l}),e.jsx("input",{ref:v,id:g,"aria-invalid":h||void 0,"aria-describedby":z,className:c(qe,Kt[n],l&&"pl-9",(o||f)&&"pr-9",Ve(h),m),...b}),(o||f)&&e.jsx("span",{className:"absolute inset-y-0 right-0 flex items-center pr-3 text-text-muted",children:f?e.jsx("span",{"aria-hidden":!0,className:"size-icon-md animate-spin rounded-full border-2 border-border border-t-transparent"}):o})]}),(r||s)&&e.jsx("p",{id:z,className:c("mt-1 text-xs",h?"text-danger-fg":"text-text-subtle"),children:r||s})]})});he.displayName="TextField";function Ue({value:t,onChange:s,onListFolders:r,disabled:n,size:a="md",placeholder:l,templatePlaceholder:o,showTemplate:f=!0}){const[i,p]=u.useState([]);u.useEffect(()=>{let d=!0;return Promise.resolve(r?.()).then(b=>{d&&b&&p(b.data??[])}).catch(()=>{}),()=>{d=!1}},[]);const m=t??{};return e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(be,{size:a,fullWidth:!0,value:m.folderId??"",options:i.map(d=>({value:d.id,label:d.name})),placeholder:l??"Select a folder",onChange:d=>s?.({...m,folderId:d})}),f&&e.jsx(he,{size:a,disabled:n??!1,value:m.pathTemplate??"",placeholder:o??"Sub-path e.g. {yyyy}/{mm}/{dd} (optional)",onChange:d=>s?.({...m,pathTemplate:d.target.value})})]})}const me=(...t)=>t.filter(Boolean).join(" "),Wt=t=>e.jsx(L.Search,{...t,strokeWidth:1.5,"aria-hidden":!0}),Gt=t=>e.jsx(L.ChevronDown,{...t,strokeWidth:1.5,"aria-hidden":!0}),Yt={sm:"h-control-sm px-3 text-sm",md:"h-control-md px-3 text-base",lg:"h-control-lg px-3 text-base",full:"h-control-md w-full px-3 text-base"},Ce={sm:"h-4 w-4",md:"h-5 w-5",lg:"h-6 w-6",full:"h-6 w-6"},Ke=u.forwardRef(({label:t,helperText:s,error:r,size:n="md",fullWidth:a=!1,startIcon:l=e.jsx(Wt,{}),loading:o=!1,containerClassName:f,labelClassName:i,className:p,id:m,options:d,onRemoteSearch:b,onSelect:v,debounceTime:y=500,showAllOnOpen:g=!1,value:h,onChange:z,...k},V)=>{const _=m||`searchfield-${Math.random().toString(36).substr(2,9)}`,Y=!!r,q=u.useRef(null),P=u.useRef(null),[H,ee]=u.useState(h||""),[J,W]=u.useState(!1),[le,w]=u.useState(!1),[x,S]=u.useState(!1);u.useEffect(()=>{h!==void 0&&ee(h)},[h]);const j=u.useMemo(()=>{if(g&&!x||!H)return d;const R=String(H).toLowerCase();return d.filter(M=>String(M.label).toLowerCase().includes(R))},[H,d,g,x]);u.useEffect(()=>{if(!b||!H){w(!1);return}const R=setTimeout(async()=>{w(!0);try{await b(String(H))}catch(M){console.error("Remote search failed:",M)}finally{w(!1)}},y);return()=>{clearTimeout(R),w(!1)}},[H,y,b]),u.useEffect(()=>{const R=M=>{q.current&&!q.current.contains(M.target)&&W(!1)};return document.addEventListener("mousedown",R),()=>document.removeEventListener("mousedown",R)},[]);const A=R=>{const M=R.target.value;ee(M),W(!0),S(!0),z&&z(R)},N=R=>{ee(R.label),W(!1),S(!1),v&&v(R.value)},K=()=>{(d.length>0||b)&&(W(!0),S(!1))},re=o||le,Q=J&&(j.length>0||re),X=u.useMemo(()=>V||P,[V]);return e.jsxs("div",{className:me("flex flex-col",a?"w-full":"",f||"","relative"),ref:q,children:[t&&e.jsx("label",{htmlFor:_,className:me("block text-sm font-medium mb-1",Y?"text-danger-fg":"text-text",i||""),children:t}),e.jsxs("div",{className:"relative",children:[l&&e.jsx("div",{className:"absolute left-0 pl-3 flex items-center pointer-events-none h-full",children:e.jsx("span",{className:me("text-text-muted",Ce[n]),children:l})}),e.jsx("input",{ref:X,id:_,value:H,onChange:A,onFocus:K,className:me("block w-full rounded-tile border bg-surface-input transition-colors duration-fast ease-out","placeholder:text-text-subtle focus-visible:outline-none focus-visible:focus-ring","disabled:cursor-not-allowed disabled:bg-surface-hover disabled:text-text-disabled",Yt[n],l?"pl-10":"","pr-10",Y?"border-danger-border text-danger-fg focus-visible:focus-ring":"border-border-strong text-text",p||""),...k}),e.jsx("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center",children:re||o?e.jsx(L.Loader2,{className:me("animate-spin text-info-fg",Ce[n]),"aria-hidden":!0}):e.jsx(Gt,{className:me("text-text-muted cursor-pointer transition-transform",Ce[n],J?"rotate-180":"rotate-0"),onClick:()=>{W(R=>(R||S(!1),!R))}})})]}),Q&&e.jsx("ul",{className:"absolute z-10 mt-1 w-full bg-surface border border-border rounded-lg shadow-lg max-h-60 overflow-auto top-full",role:"listbox",children:j.length>0?j.map(R=>e.jsx("li",{className:"px-4 py-2 cursor-pointer text-text hover:bg-accent-soft hover:text-accent transition-colors",onClick:()=>N(R),role:"option","aria-selected":H===R.label,children:R.label},R.value)):e.jsx("li",{className:"px-4 py-2 text-text-muted",children:re||o?"Zoeken op afstand...":"Geen resultaten gevonden."})}),(r||s)&&e.jsx("p",{className:me("mt-1 text-xs",Y?"text-danger-fg":"text-text-muted"),children:r||s}),b&&e.jsxs("p",{className:"mt-2 text-xs text-success-fg",children:["Huidige zoekterm (niet-gedebounced): ",String(H)]})]})});Ke.displayName="SearchableTextField";const _e=u.forwardRef(({value:t,onValueChange:s,hint:r,size:n="md",clearLabel:a="Clear search",containerClassName:l,className:o,disabled:f,...i},p)=>e.jsxs("div",{className:c("flex items-center gap-2 rounded-md bg-surface-sunk px-2.5 text-text-muted","transition-colors duration-fast ease-out",n==="sm"?"h-control-sm":"h-control-md",f&&"opacity-60",l),children:[e.jsx(G,{icon:L.Search,size:"md",color:"current",className:"shrink-0"}),e.jsx("input",{ref:p,type:"search",value:t,disabled:f,onChange:m=>s(m.target.value),className:c("min-w-0 flex-1 border-0 bg-transparent p-0 text-sm text-text shadow-none","placeholder:text-text-subtle","focus:border-0 focus:shadow-none focus:outline-none focus:ring-0","[&::-webkit-search-cancel-button]:appearance-none",o),...i}),t?e.jsx("button",{type:"button","aria-label":a,onClick:()=>s(""),className:"grid size-4 shrink-0 cursor-pointer place-items-center rounded-xs text-text-subtle transition-colors duration-fast ease-out hover:text-text focus-visible:outline-none focus-visible:focus-ring",children:e.jsx(G,{icon:L.X,size:"sm",color:"current"})}):r&&e.jsx("span",{className:"shrink-0 text-xs text-text-subtle",children:r})]}));_e.displayName="SearchField";const We=u.forwardRef(({checked:t,onChange:s,label:r,disabled:n=!1,className:a,...l},o)=>{const f=e.jsx("span",{"aria-hidden":!0,className:c("relative inline-flex size-switch-track shrink-0 items-center rounded-full","transition-colors duration-fast ease-out",t?"bg-accent":"bg-surface-hover",n&&"opacity-50"),children:e.jsx("span",{className:c("absolute left-0.5 size-switch-knob rounded-full bg-surface shadow-overlay","transition-transform duration-fast ease-out",t&&"translate-switch")})});return e.jsxs("label",{className:c("inline-flex items-center gap-2",n?"cursor-not-allowed":"cursor-pointer",a),children:[e.jsx("input",{ref:o,type:"checkbox",role:"switch",checked:t,disabled:n,onChange:i=>s(i.target.checked),className:"peer sr-only",...l}),e.jsx("span",{className:"inline-flex rounded-full peer-focus-visible:focus-ring",children:f}),r&&e.jsx("span",{className:"text-sm text-text",children:r})]})});We.displayName="Switch";const Ge=({trigger:t,options:s,value:r,onSelect:n,placement:a="bottom-start",disabled:l=!1,className:o,showCheck:f=!0,header:i})=>{const[p,m]=u.useState(!1),[d,b]=u.useState(null),[v,y]=u.useState({top:0,left:0}),g=u.useRef(null),h=u.useRef(null),z=u.useRef(null),k=u.useRef(null),V=pe(p,h,{placement:a}),_=u.useRef(null),Y=()=>Array.from(k.current?.querySelectorAll("button[data-option-value]:not(:disabled)")??[]);u.useEffect(()=>{p&&Y()[0]?.focus()},[p]);const q=x=>{if(!["ArrowDown","ArrowUp","Home","End"].includes(x.key))return;const j=Y();if(j.length===0)return;x.preventDefault();const A=j.indexOf(document.activeElement),N=x.key==="Home"?0:x.key==="End"?j.length-1:x.key==="ArrowDown"?(A+1)%j.length:(A-1+j.length)%j.length;j[N]?.focus()};u.useEffect(()=>{const x=S=>{g.current&&(!g.current.contains(S.target)||z.current&&!z.current.contains(S.target))&&(m(!1),b(null),_.current&&(clearTimeout(_.current),_.current=null))};return p&&document.addEventListener("mousedown",x),()=>{document.removeEventListener("mousedown",x)}},[p]),u.useEffect(()=>{const x=S=>{S.key==="Escape"&&(m(!1),b(null),h.current?.focus(),_.current&&(clearTimeout(_.current),_.current=null))};return p&&document.addEventListener("keydown",x),()=>{document.removeEventListener("keydown",x)}},[p]),u.useEffect(()=>{if(d&&g.current){const x=g.current.querySelector(`[data-option-value="${d}"]`);if(x){const S=x.getBoundingClientRect();y({top:S.top,left:S.right+8})}}},[d]),u.useEffect(()=>()=>{_.current&&clearTimeout(_.current)},[]);const P=x=>{x.stopPropagation(),!l&&(m(!p),b(null),_.current&&(clearTimeout(_.current),_.current=null))},H=(x,S,j)=>{x.stopPropagation(),!S.disabled&&!S.divider&&(!S.children||S.children.length===0)&&(n?.(S.value,j),m(!1),b(null))},ee=x=>{_.current&&(clearTimeout(_.current),_.current=null),x.children&&x.children.length>0?b(x.value):b(null)},J=x=>{x.children&&x.children.length>0?_.current=setTimeout(()=>{b(null)},150):b(null)},W=(x,S,j)=>{x.stopPropagation(),!S.disabled&&!S.divider&&(n?.(S.value,j),m(!1),b(null))},le=c("fixed z-overlay min-w-menu bg-surface rounded-lg shadow-overlay border border-border","max-h-60 overflow-auto"),w=c("fixed z-overlay min-w-menu bg-surface rounded-lg shadow-overlay border border-border","max-h-60 overflow-auto");return e.jsxs("div",{ref:g,className:c("relative flex flex-row items-center justify-center rounded-lg hover:bg-surface-hover",o),children:[e.jsx("button",{ref:h,onClick:P,disabled:l,"aria-haspopup":"menu","aria-expanded":p,className:c("inline-flex items-center justify-center",{"opacity-50 cursor-not-allowed":l}),children:t}),p&&e.jsx("div",{ref:k,className:le,style:V,onKeyDown:q,children:e.jsxs("div",{className:"p-2",role:"menu",children:[i&&(typeof i=="string"?e.jsx("div",{className:"text-xs font-medium text-text-muted uppercase tracking-label px-3 py-2",children:i}):i),s.map((x,S)=>{if(x.divider)return e.jsx("div",{className:"border-t border-border my-2"},`divider-${S}`);const j=x.children&&x.children.length>0,A=d===x.value;return e.jsxs("div",{className:"relative group",children:[e.jsxs("button",{"data-option-value":x.value,role:"menuitem","aria-haspopup":j?"menu":void 0,onClick:N=>H(N,x),onMouseEnter:()=>ee(x),onMouseLeave:()=>J(x),disabled:x.disabled,className:c("flex w-full items-center justify-between rounded-md px-3 py-1.5 text-sm text-text transition-colors duration-fast ease-out hover:bg-surface-hover focus-visible:outline-none focus-visible:focus-ring",{"opacity-50 cursor-not-allowed":x.disabled,"bg-surface-hover":A&&j}),children:[e.jsxs("div",{className:"flex items-center space-x-2 min-w-0",children:[x.icon&&e.jsx("span",{className:"flex-shrink-0",children:x.icon}),e.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[e.jsx("span",{className:"font-base truncate",children:x.label}),x.description&&e.jsx("span",{className:"text-xs text-text-muted",children:x.description})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[f&&r===x.value&&e.jsx(L.Check,{className:"size-icon-md shrink-0 text-success-fg","aria-hidden":!0}),j&&e.jsx("span",{className:"text-text-muted text-xs",children:"▶"})]})]}),j&&A&&e.jsx("div",{ref:z,className:w,style:{top:`${v.top}px`,left:`${v.left}px`},onMouseEnter:()=>{_.current&&(clearTimeout(_.current),_.current=null),b(x.value)},onMouseLeave:()=>{_.current=setTimeout(()=>{b(null)},150)},children:e.jsx("div",{className:"p-2",children:x.children.map((N,K)=>{if(N.divider)return e.jsx("div",{className:"border-t border-border my-2"},`divider-${K}`);const re=typeof r=="object"&&r[x.value]&&r[x.value].includes(N.value)||r===N.value;return e.jsxs("button",{onClick:Q=>W(Q,N,x.value),disabled:N.disabled,className:c("flex w-full items-center justify-between rounded-md px-3 py-1.5 text-sm text-text transition-colors duration-fast ease-out hover:bg-surface-hover",{"opacity-50 cursor-not-allowed":N.disabled}),children:[e.jsxs("div",{className:"flex items-center space-x-2 min-w-0",children:[N.icon&&e.jsx("span",{className:"flex-shrink-0",children:N.icon}),e.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[e.jsx("span",{className:"font-base truncate",children:N.label}),N.description&&e.jsx("span",{className:"text-xs text-text-muted",children:N.description})]})]}),f&&re&&e.jsx(L.Check,{className:"size-icon-md shrink-0 text-success-fg","aria-hidden":!0})]},N.value)})})})]},x.value)}),(()=>{const x=s.reduce((S,j)=>{if(j.divider)return S;const A=j.children?j.children.filter(N=>!N.divider).length:0;return S+1+A},0);return x>1&&e.jsx("div",{className:"border-t border-border mt-2 pt-2",children:e.jsxs("div",{className:"text-xs text-text-muted px-3 py-1",children:[x," options available"]})})})()]})})]})},ge=({actions:t,defaultVariant:s="secondary",className:r})=>t.length===0?null:e.jsx("div",{className:c("flex flex-wrap items-center gap-2",r),children:t.map(n=>n.render?e.jsx(u.Fragment,{children:n.render()},n.id):n.splitOptions&&n.splitOptions.length>0?e.jsx(De,{label:n.label,onClick:n.onClick,icon:n.icon,variant:n.variant==="primary"?"primary":"secondary",options:n.splitOptions,disabled:n.disabled},n.id):e.jsx(se,{variant:n.variant??s,onClick:a=>{a.stopPropagation(),a.target.blur(),n.onClick()},disabled:n.disabled,leftIcon:n.icon,children:n.label},n.id))}),Jt={none:"p-0",sm:"p-2",md:"px-5 py-4",lg:"p-6"},Xt=({actions:t=[],onBack:s,backLabel:r="Back",className:n,padding:a="md",children:l})=>e.jsxs("div",{className:c("flex items-center gap-2",Jt[a],n),children:[s&&e.jsx(se,{variant:"secondary",onClick:s,"aria-label":r,leftIcon:e.jsx(G,{icon:L.ChevronLeft,size:"sm"}),iconOnly:!0}),l&&e.jsx("div",{className:"min-w-0 flex-1",children:l}),e.jsx(ge,{actions:t,className:c(!l&&"ml-auto")})]}),Zt=t=>s=>t(s instanceof Date?s:null),Qt=t=>s=>t(typeof s=="string"?s:""),es={none:"px-0",sm:"px-2",md:"px-3.5",lg:"px-5"},ts={sm:"h-row-lg",md:"h-row-xl",lg:"h-14"},ss=8,Pe=["62%","44%","74%","52%","68%","48%","80%","56%"];function rs(t,s){if(s<=7)return Array.from({length:s},(l,o)=>o);const n=[...new Set([0,s-1,t-1,t,t+1])].filter(l=>l>=0&&l<s).sort((l,o)=>l-o),a=[];return n.forEach((l,o)=>{o>0&&l-n[o-1]>1&&a.push("gap"),a.push(l)}),a}const ns=t=>{const s=Array.isArray(t.value)?t.value:t.value!=null&&t.value!==""&&t.value!=="all"?[t.value]:[];if(t.type==="date"){const o=t.value instanceof Date;return e.jsx(ye,{value:t.value,onChange:f=>t.onChange(f),placeholder:t.placeholder||t.label,className:c("min-w-40",o&&"bg-info-soft text-info-fg")})}const r=o=>t.options?.find(f=>f.value===o)?.label??String(o),n=o=>Array.isArray(t.value)?t.value.includes(o):t.value===o,a=o=>{if(!t.multiSelect)return t.onChange(o);const f=Array.isArray(t.value)?t.value:[];t.onChange(f.includes(o)?f.filter(i=>i!==o):[...f,o])},l=s.length>0;return e.jsx(Oe,{tone:"outline",caret:!0,icon:t.icon,active:l,label:l?`${t.label}: ${s.map(r).join(", ")}`:t.label,title:t.label,onClear:()=>t.onChange(t.multiSelect?[]:"all"),menu:o=>e.jsx("div",{role:"listbox",className:"flex flex-col",children:t.options?.map(f=>e.jsx("button",{type:"button",role:"option","aria-selected":n(f.value),onClick:()=>{a(f.value),t.multiSelect||o()},className:c("flex cursor-pointer items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm","transition-colors duration-fast ease-out hover:bg-surface-hover","focus-visible:outline-none focus-visible:focus-ring",n(f.value)?"font-medium text-text":"text-text-muted"),children:f.label},f.value))})})},Se=({data:t,columns:s,loading:r=!1,searchable:n=!1,searchPlaceholder:a="Search...",searchValue:l,onSearchChange:o,filters:f=[],toolbarActions:i=[],paginated:p=!1,defaultPageSize:m=10,actions:d=[],onRowClick:b,selectable:v=!1,selectedRows:y=[],onSelectionChange:g,getRowKey:h=(ee,J)=>J,emptyContent:z,footerSummary:k,size:V="md",hoverable:_=!0,padding:Y="md",className:q,rowClassName:P,headerBackground:H=!0})=>{const[ee,J]=u.useState(""),W=l!==void 0,le=W?l:ee,w=o??J,[x,S]=u.useState({column:null,direction:null}),[j,A]=u.useState({page:0,pageSize:m}),N=u.useRef(null),K=u.useMemo(()=>{let C=t;if(n&&!W&&le.trim()){const U=s.filter(ae=>ae.searchable!==!1),te=le.toLowerCase();C=C.filter(ae=>U.some(B=>{const ce=typeof B.accessor=="function"?B.accessor(ae):ae[B.accessor];return String(ce||"").toLowerCase().includes(te)}))}return f.forEach(U=>{U.value&&U.value!=="all"&&(C=C.filter(te=>{const ae=s.find(ce=>ce.id===U.id);if(!ae)return!0;const B=typeof ae.accessor=="function"?ae.accessor(te):te[ae.accessor];return String(B||"")===U.value}))}),C},[t,le,W,s,n,f]),re=u.useMemo(()=>{if(!x.column||!x.direction)return K;const C=s.find(U=>U.id===x.column);return C?[...K].sort((U,te)=>{const ae=typeof C.accessor=="function"?C.accessor(U):U[C.accessor],B=typeof C.accessor=="function"?C.accessor(te):te[C.accessor];let ce=0;return ae<B?ce=-1:ae>B&&(ce=1),x.direction==="desc"?-ce:ce}):K},[K,x,s]),Q=u.useMemo(()=>{if(!p)return re;const C=j.page*j.pageSize,U=C+j.pageSize;return re.slice(C,U)},[re,j,p]),X=u.useCallback(C=>{s.find(te=>te.id===C)?.sortable&&S(te=>te.column!==C?{column:C,direction:"asc"}:te.direction==="asc"?{column:C,direction:"desc"}:{column:null,direction:null})},[s]),R=u.useCallback(C=>{A(U=>({...U,page:C}))},[]),M=u.useCallback((C,U)=>{if(!g)return;const te=h(C,0);g(U?[...y,C]:y.filter((ae,B)=>h(y[B],B)!==te))},[y,g,h]),D=u.useCallback(C=>{g&&g(C?[...Q]:[])},[Q,g]);u.useEffect(()=>{A(C=>({...C,page:0}))},[le,x]),u.useEffect(()=>{A(C=>({...C,page:0}))},[f.map(C=>C.value).join(",")]);const E=re.length,F=Math.ceil(E/j.pageSize),I=j.page*j.pageSize+1,O=Math.min(I+j.pageSize-1,E),T=Q.length>0&&Q.every(C=>{const U=h(C,0);return y.some((te,ae)=>h(te,ae)===U)}),$=Q.some(C=>{const U=h(C,0);return y.some((te,ae)=>h(te,ae)===U)}),Z=es[Y],ne=H?"bg-surface-sunk":"bg-surface",oe=c("text-text",Z),xe=n||f.length>0||i.length>0,ue=p&&E>0,ke=ue||k!==void 0;return e.jsxs("div",{className:c("flex min-w-0 flex-col",q),children:[xe&&e.jsxs("div",{className:"flex flex-wrap items-center gap-2 pb-3",children:[n&&e.jsx(_e,{value:le,onValueChange:w,placeholder:a,containerClassName:"w-full sm:w-66"}),f.map(C=>e.jsx(ns,{...C},C.id)),i.length>0&&e.jsx(ge,{actions:i,className:"ml-auto"})]}),e.jsx("div",{className:"relative w-full overflow-x-auto rounded-lg ring-1 ring-border",children:e.jsxs("table",{ref:N,className:"min-w-full border-collapse text-base text-text",children:[e.jsx("thead",{className:c(ne,"h-control-lg"),children:e.jsxs("tr",{children:[v&&e.jsx("th",{className:c(oe,"w-10"),children:e.jsx(fe,{size:"sm",checked:T,indeterminate:$&&!T,onChange:C=>D(C.target.checked),"aria-label":"Select all rows"})}),s.map(C=>e.jsx("th",{className:c(oe,"text-xs font-semibold uppercase tracking-label text-text-muted","group",{"text-left":C.align==="left"||!C.align,"text-center":C.align==="center","text-right":C.align==="right","cursor-pointer select-none":C.sortable,[`sticky left-0 ${ne}`]:C.sticky==="left",[`sticky right-0 ${ne}`]:C.sticky==="right"}),style:{width:C.width},onClick:()=>C.sortable&&X(C.id),children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[C.headerCell?C.headerCell():C.header,C.sortable&&e.jsx(G,{icon:x.column===C.id&&x.direction==="desc"?L.ChevronDown:L.ChevronUp,size:"xs",className:c("transition-opacity duration-fast ease-out",x.column===C.id?"text-text opacity-100":"text-text-subtle opacity-0 group-hover:opacity-100")})]})},C.id)),d.length>0&&e.jsx("th",{className:c(oe,"w-10"),children:e.jsx("span",{className:"sr-only",children:"Actions"})})]})}),e.jsx("tbody",{children:r?Array.from({length:ss}).map((C,U)=>e.jsxs("tr",{className:"animate-pulse border-t border-border-subtle","aria-hidden":!0,children:[v&&e.jsx("td",{className:c(oe,"h-row-lg"),children:e.jsx("span",{className:"block size-4 rounded-xs bg-surface-hover"})}),s.map((te,ae)=>e.jsx("td",{className:c(oe,"h-row-lg"),style:{width:te.width},children:e.jsx("span",{className:"block h-3 rounded-xs bg-surface-hover",style:{width:Pe[(U+ae)%Pe.length]}})},te.id)),d.length>0&&e.jsx("td",{className:c(oe,"h-row-lg")})]},`skeleton-${U}`)):Q.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:s.length+(v?1:0)+(d.length>0?1:0),className:c(oe,"border-t border-border-subtle py-10 text-center text-text-muted"),children:z||"No data available"})}):Q.map((C,U)=>{const te=h(C,U),ae=y.some((B,ce)=>h(B,ce)===te);return e.jsxs("tr",{className:c(ts[V],"border-t border-border-subtle",_&&"transition-colors duration-fast ease-out hover:bg-surface-hover",b&&"cursor-pointer",ae&&"bg-accent-soft",P?.(C,U)),onClick:B=>{B.stopPropagation(),b?.(C,U)},children:[v&&e.jsx("td",{className:oe,children:e.jsx(fe,{size:"sm",checked:ae,onClick:B=>B.stopPropagation(),onChange:B=>{B.stopPropagation(),M(C,B.target.checked)},"aria-label":"Select row"})}),s.map(B=>{const ce=typeof B.accessor=="function"?B.accessor(C):C[B.accessor];return e.jsx("td",{className:c(oe,{"text-left":B.align==="left"||!B.align,"text-center":B.align==="center","text-right":B.align==="right","sticky left-0 bg-surface":B.sticky==="left","sticky right-0 bg-surface":B.sticky==="right"}),children:B.cell?B.cell(ce,C,U):String(ce||"")},B.id)}),d.length>0&&e.jsx("td",{className:oe,children:e.jsx(Ge,{className:"rounded-md",trigger:e.jsx("span",{className:"grid size-7 place-items-center text-text-subtle",children:e.jsx(G,{icon:L.Ellipsis,size:"md",color:"current"})}),options:d.map(B=>({value:B.id,label:B.label,icon:B.icon,disabled:B.disabled?.(C)})),onSelect:B=>{const ce=d.find(at=>at.id===B);ce&&ce.onClick(C,U)},placement:"bottom-end"})})]},te)})})]})}),ke&&e.jsxs("div",{className:"flex flex-wrap items-center gap-3 px-1 pt-3 text-xs text-text-muted",children:[e.jsx("span",{className:"min-w-0 flex-1",children:k??`Showing ${I}–${O} of ${E}`}),ue&&e.jsxs("div",{className:"flex items-center gap-0.5",children:[e.jsx(se,{size:"xs",variant:"ghost",iconOnly:!0,"aria-label":"Previous page",onClick:()=>R(j.page-1),disabled:j.page===0,children:e.jsx(G,{icon:L.ChevronLeft,size:"md",color:"current"})}),rs(j.page,F).map((C,U)=>C==="gap"?e.jsx("span",{className:"px-1 text-text-subtle",children:"…"},`gap-${U}`):e.jsx("button",{type:"button","aria-current":C===j.page?"page":void 0,onClick:()=>R(C),className:c("h-control-xs min-w-6 cursor-pointer rounded-sm px-1.5 tabular-nums","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",C===j.page?"bg-surface-sunk font-semibold text-text":"text-text-muted hover:bg-surface-hover hover:text-text"),children:C+1},C)),e.jsx(se,{size:"xs",variant:"ghost",iconOnly:!0,"aria-label":"Next page",onClick:()=>R(j.page+1),disabled:j.page>=F-1,children:e.jsx(G,{icon:L.ChevronRight,size:"md",color:"current"})})]})]})]})},as=u.createContext(null),ls=({items:t,activeTab:s,onTabChange:r,className:n})=>{const[a,l]=u.useState(t[0]?.id||""),o=s||a,f=i=>{r?r(i):l(i)};return e.jsx("div",{className:c("border-b border-border",n),children:e.jsx("nav",{className:"-mb-px flex space-x-8",children:t.map(i=>e.jsx("button",{onClick:()=>!i.disabled&&f(i.id),disabled:i.disabled,className:c("border-b-2 py-2 px-1 text-sm font-medium transition-colors duration-fast",{"border-accent-border text-text":o===i.id,"border-transparent text-text-muted hover:text-text":o!==i.id&&!i.disabled,"border-transparent text-disabled cursor-not-allowed":i.disabled}),children:e.jsxs("span",{className:"flex items-center gap-2",children:[i.label,i.badge&&e.jsx("span",{className:c("inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium",o===i.id?"bg-accent-soft text-accent":"bg-surface-hover text-text-muted"),children:i.badge})]})},i.id))})})},Ye=({items:t,defaultTab:s,activeTab:r,onTabChange:n,variant:a="default",size:l="md",className:o})=>{const[f,i]=u.useState(s||r||t[0]?.id||""),p=r||f,m=g=>{n?n(g):i(g)},d={activeTab:p,setActiveTab:m},b=t.find(g=>g.id===p),v=c("flex",{"border-b border-border px-2":a==="default"||a==="underline","bg-surface-hover p-1 rounded-lg":a==="pills","space-x-1":a==="pills","space-x-8":a==="default"||a==="underline"},o),y=(g,h)=>{const z="transition-colors duration-fast font-medium",k={"text-xs px-2 py-1":l==="sm","text-sm px-3 py-2":l==="md","text-base px-4 py-3":l==="lg"},V={"border-b-2 -mb-px":a==="default","rounded-md":a==="pills","border-b-2 pb-2":a==="underline"},_={"opacity-50 cursor-not-allowed":g.disabled,"cursor-pointer":!g.disabled},Y=h?{"border-accent-border text-text":a==="default"||a==="underline","bg-surface text-text shadow-none":a==="pills"}:{},q=!h&&!g.disabled?{"border-transparent text-text-muted hover:text-text":a==="default","text-text-muted hover:text-text":a==="pills","border-transparent text-text-muted hover:text-text hover:border-border":a==="underline"}:{};return c(z,k,V,_,Y,q)};return e.jsx(as.Provider,{value:d,children:e.jsxs("div",{children:[e.jsx("div",{className:v,role:"tablist",children:t.map(g=>e.jsx("button",{type:"button",role:"tab","aria-selected":p===g.id,"aria-controls":`tabpanel-${g.id}`,disabled:g.disabled,onClick:()=>!g.disabled&&m(g.id),className:y(g,p===g.id),children:e.jsxs("span",{className:"flex items-center gap-2",children:[g.label,g.badge&&e.jsx("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-surface-hover text-text-muted",children:g.badge})]})},g.id))}),b?.content&&e.jsx("div",{role:"tabpanel",id:`tabpanel-${p}`,"aria-labelledby":`tab-${p}`,className:"mt-4",children:b.content})]})})},os={sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl",full:"max-w-full mx-4"};function Ae({open:t,onClose:s,title:r,size:n="md",closeOnBackdropClick:a=!0,closeOnEscape:l=!0,className:o,backdropClassName:f,children:i,footer:p,showCloseButton:m=!0}){const d=u.useRef(null),b=u.useRef(null);u.useEffect(()=>{if(!t||!l)return;const y=g=>{g.key==="Escape"&&s()};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[t,l,s]),u.useEffect(()=>(t?(b.current=document.activeElement,d.current&&d.current.focus(),document.body.style.overflow="hidden"):(b.current&&b.current.focus(),document.body.style.overflow=""),()=>{document.body.style.overflow=""}),[t]);const v=y=>{a&&y.target===y.currentTarget&&s()};return t?e.jsx("div",{className:c("fixed inset-0 z-modal flex items-center justify-center p-4","bg-scrim",f),onClick:v,children:e.jsxs("div",{ref:d,className:c("relative w-full bg-surface rounded-lg shadow-modal","focus:outline-none",os[n],o),role:"dialog","aria-modal":"true","aria-labelledby":r?"modal-title":void 0,tabIndex:-1,children:[(r||m)&&e.jsxs("div",{className:"flex items-center justify-between p-6 pb-0",children:[r&&e.jsx("span",{id:"modal-title",className:"text-lg font-semibold text-text",children:r}),m&&e.jsx("button",{onClick:s,className:"p-1 text-text-muted hover:text-text transition-colors","aria-label":"Close modal",children:e.jsx(G,{icon:L.X,size:"lg",color:"current"})})]}),e.jsx("div",{className:"p-6",children:i}),p&&e.jsx("div",{className:"px-6 py-4",children:p})]})}):null}const cs={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-md",xl:"text-lg"},is={light:"font-normal",normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},ds={primary:"text-text",secondary:"text-text-muted",accent:"text-accent",success:"text-success-fg",warning:"text-warning-fg",error:"text-danger-fg",info:"text-info-fg",neutral:"text-text",current:"text-current",muted:"text-text-subtle"},us={left:"text-left",center:"text-center",right:"text-right",justify:"text-justify"},xs={tight:"leading-tight",normal:"leading-normal",relaxed:"leading-relaxed"},de=({variant:t="body",size:s="md",weight:r="normal",color:n="current",align:a="left",truncate:l=!1,italic:o=!1,underline:f=!1,lineHeight:i="normal",as:p,className:m,children:d,...b})=>{const v=p||fs(t),y=t==="caption",g=t==="label",h=t==="code",z=c("font-sans",y&&"text-xs text-text-subtle",g&&"text-xs font-semibold uppercase tracking-label text-text-subtle",h&&"font-mono text-sm rounded-sm bg-surface-hover px-1 py-0.5",!y&&!g&&!h&&cs[s],!g&&is[r],ds[n],us[a],t==="body"&&xs[i],o&&"italic",f&&"underline",l&&"truncate",m);return e.jsx(v,{className:z,...b,children:d})};function fs(t){return{body:"p",caption:"span",label:"span",code:"code"}[t]||"p"}const Je=({value:t,onChange:s,label:r,placeholder:n="Select or upload a file",error:a,disabled:l,accept:o,onListFiles:f,onListMounts:i,onUploadFile:p,onDownloadFile:m,onRegisterFile:d})=>{const[b,v]=u.useState(!1),[y,g]=u.useState([]),[h,z]=u.useState(null),[k,V]=u.useState("/"),[_,Y]=u.useState([]),[q,P]=u.useState(!1),[H,ee]=u.useState(""),[J,W]=u.useState(typeof t=="object"?t:null),[le,w]=u.useState(!1),[x,S]=u.useState(""),j=u.useRef(null);u.useEffect(()=>{b&&A()},[b]),u.useEffect(()=>{b&&h&&N()},[b,h,k,H]);const A=async()=>{P(!0);try{const T=await i?.();T?.data&&g(T.data)}catch(T){console.error("Failed to load mounts",T)}finally{P(!1)}},N=async()=>{if(h){P(!0);try{const T=await f?.({mountId:h.id,name:H,path:k});T?.data&&Y(T.data)}catch(T){console.error("Failed to load files",T)}finally{P(!1)}}},K=async T=>{const $=T.target.files?.[0];if($){P(!0);try{const Z=await $.arrayBuffer(),ne=new Uint8Array(Z),oe={id:`local-${Date.now()}`,name:$.name,type:"file",path:"/",mimeType:$.type||"application/octet-stream",size:$.size,mountId:"local",providerKey:$.name,ownerId:"me"};W(oe),s(oe,ne),v(!1)}catch(Z){console.error("Local file selection failed",Z)}finally{P(!1)}}},re=async T=>{const $=T.target.files?.[0];if(!(!$||!h)){P(!0);try{const Z=await $.arrayBuffer(),ne=await p?.({file:new Uint8Array(Z),filename:$.name,mimeType:$.type||"application/octet-stream",mountId:h.id,path:k});if(ne?.data){const oe=ne.data;W(oe),s(oe,new Uint8Array(Z)),v(!1)}}catch(Z){console.error("Upload failed",Z)}finally{P(!1)}}},Q=async()=>{if(!(!x||!h)){P(!0);try{const T=`${k}${x}/`;d&&(await d({name:x,type:"folder",path:k,mimeType:"application/x-directory",size:0,mountId:h.id,providerKey:T,ownerId:"me"}),await N()),w(!1),S("")}catch(T){console.error("Failed to create folder",T)}finally{P(!1)}}},X=async T=>{P(!0);try{const $=await m?.(T.id);W(T),s(T,$),v(!1)}catch($){console.error("Failed to download file",$)}finally{P(!1)}},R=T=>{T.stopPropagation(),W(null),s(null)},M=u.useMemo(()=>{const T=new Set,$=[];return _.forEach(Z=>{if(Z.type==="folder"){Z.path===k&&T.add(Z.name);return}const ne=Z.providerKey||Z.name,xe=(k?ne.substring(k.length):ne).split("/").filter(ue=>ue!=="");xe.length>1?T.add(xe[0]):xe.length===1&&$.push(Z)}),{folders:Array.from(T).sort(),files:$.sort((Z,ne)=>Z.name.localeCompare(ne.name))}},[_,k]),D=T=>{V($=>`${$}${T}/`)},E=()=>{const T=k.split("/").filter($=>$!=="");T.pop(),T.length===0?V("/"):V(`${T.join("/")}/`)},F=u.useMemo(()=>{const T=M.folders.map($=>({id:`folder-${$}`,name:$,type:"folder"}));return M.files.forEach($=>{T.push({...$,type:"file"})}),T},[M]),I=[{id:"name",header:"Name",accessor:"name",cell:(T,$)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(G,{icon:$.type==="folder"?L.Folder:L.FileText,size:"sm",color:$.type==="folder"?"warning":"secondary"}),e.jsx("span",{className:c($.type==="folder"&&"font-medium"),children:T})]})},{id:"type",header:"Type",accessor:T=>T.type==="folder"?"Folder":T.mimeType},{id:"size",header:"Size",accessor:T=>T.type==="file"?`${(T.size/1024).toFixed(1)} KB`:"-"},{id:"actions",header:"",accessor:"id",align:"right",cell:(T,$)=>e.jsx(se,{variant:"outline",onClick:Z=>{Z.stopPropagation(),$.type==="folder"?D($.name):X($)},loading:q&&$.type==="file"&&J?.id===$.id,children:$.type==="folder"?"Open":"Select"})}],O=[{id:"name",header:"Mount Name",accessor:"name",cell:T=>e.jsxs("div",{className:"flex items-center gap-2 font-medium",children:[e.jsx(G,{icon:L.HardDrive,size:"sm",color:"primary"}),e.jsx("span",{children:T})]})},{id:"actions",header:"",accessor:"id",align:"right",cell:(T,$)=>e.jsx(se,{variant:"outline",onClick:()=>z($),children:"Open"})}];return e.jsxs("div",{className:"space-y-1",children:[r&&e.jsx(de,{variant:"label",size:"sm",weight:"medium",children:r}),e.jsxs("div",{onClick:()=>!l&&v(!0),className:c("flex items-center gap-3 px-3 py-2 border rounded-lg cursor-pointer transition-colors","hover:border-border-strong bg-surface",a?"border-danger-border":"border-border",l&&"opacity-50 cursor-not-allowed bg-surface-sunk"),children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx(G,{icon:J?L.FileText:L.HardDrive,color:J?"primary":"secondary"})}),e.jsx("div",{className:"flex-grow truncate",children:J?e.jsx("span",{className:"text-sm text-text font-medium",children:J.name}):e.jsx("span",{className:"text-sm text-text-muted",children:n})}),J&&!l&&e.jsx("button",{onClick:R,className:"p-1 hover:bg-surface-hover rounded",children:e.jsx(G,{icon:L.X,size:"xs"})})]}),a&&e.jsx(de,{variant:"body",size:"xs",className:"text-danger-fg",children:a}),e.jsx(Ae,{open:b,onClose:()=>{v(!1),z(null),V("/"),w(!1)},title:h?`Explorer: ${h.name}`:"Select Storage Mount",size:"lg",children:e.jsx(Ye,{variant:"pills",items:[{id:"remote",label:"Platform Storage",content:e.jsx("div",{className:"space-y-4",children:h?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(se,{variant:"ghost",onClick:()=>{k&&k!=="/"?E():z(null)},leftIcon:e.jsx(G,{icon:L.ArrowLeft,size:"xs"}),children:k?"Back":"Back to Mounts"}),e.jsx("div",{className:"flex items-center gap-1 text-xs text-text-muted overflow-hidden bg-surface-hover px-2 py-1 rounded",children:e.jsx("span",{className:"truncate",children:k})}),e.jsx("div",{className:"flex-grow min-w-40",children:e.jsx(he,{placeholder:"Search...",value:H,onChange:T=>ee(T.target.value),startIcon:e.jsx(L.Search,{size:14}),fullWidth:!0})}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(se,{variant:"outline",onClick:()=>w(!0),leftIcon:e.jsx(G,{icon:L.FolderPlus,size:"xs"}),children:"New Folder"}),e.jsx(se,{variant:"primary",onClick:()=>j.current?.click(),leftIcon:e.jsx(G,{icon:L.Upload,size:"xs"}),loading:q,children:"Upload"}),e.jsx("input",{type:"file",className:"hidden",ref:j,onChange:re,accept:o})]})]}),le&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-surface-sunk rounded-lg border border-border",children:[e.jsx(G,{icon:L.Folder,size:"sm",color:"warning"}),e.jsx(he,{placeholder:"Folder name",value:x,onChange:T=>S(T.target.value),autoFocus:!0}),e.jsx(se,{onClick:Q,loading:q,children:"Create"}),e.jsx(se,{variant:"ghost",onClick:()=>w(!1),children:"Cancel"})]}),e.jsx("div",{className:"max-h-100 overflow-auto rounded-lg border border-border",children:e.jsx(Se,{data:F,columns:I,loading:q,emptyContent:"This folder is empty",onRowClick:T=>T.type==="folder"?D(T.name):X(T)})})]}):e.jsx("div",{className:"max-h-100 overflow-auto rounded-lg border border-border",children:e.jsx(Se,{data:y,columns:O,loading:q,emptyContent:"No storage mounts configured",onRowClick:T=>z(T)})})})},{id:"local",label:"Local File",content:e.jsx("div",{className:"space-y-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 border-2 border-dashed border-border rounded-xl bg-surface-sunk/50",children:[e.jsx("div",{className:"p-4 bg-accent-soft rounded-full mb-4",children:e.jsx(G,{icon:L.FileText,size:"xl",color:"primary"})}),e.jsx(de,{variant:"label",size:"lg",weight:"semibold",children:"Select a file from your computer"}),e.jsxs(de,{variant:"body",size:"sm",className:"text-text-muted mt-1 mb-6 text-center max-w-xs",children:["This file will be used directly in the form and will ",e.jsx("strong",{children:"not"})," be uploaded to platform storage."]}),e.jsxs("label",{className:"cursor-pointer",children:[e.jsx(se,{variant:"primary",size:"lg",loading:q,className:"pointer-events-none",children:"Browse Local File"}),e.jsx("input",{type:"file",className:"hidden",onChange:K,accept:o,disabled:q})]})]})})}]})})]})},ms={sm:"px-3 py-1.5 text-sm",md:"px-3 py-2 text-base",lg:"px-3 py-2 text-md",full:"px-3 py-2 text-md"},Ne=u.forwardRef(({label:t,helperText:s,error:r,size:n="md",fullWidth:a=!1,loading:l=!1,containerClassName:o,labelClassName:f,className:i,id:p,rows:m=4,...d},b)=>{const v=u.useId(),y=p||`textarea-${v}`,g=!!r,h=r||s?`${y}-description`:void 0;return e.jsxs("div",{className:c("flex flex-col",a&&"w-full",o),children:[t&&e.jsx("label",{htmlFor:y,className:c(He,g?"text-danger-fg":"text-text-muted",f),children:t}),e.jsxs("div",{className:"relative",children:[e.jsx("textarea",{ref:b,id:y,rows:m,"aria-invalid":g||void 0,"aria-describedby":h,className:c(qe,"resize-y leading-relaxed",ms[n],Ve(g),i),...d}),l&&e.jsx("span",{"aria-hidden":!0,className:"absolute top-2 right-3 size-icon-md animate-spin rounded-full border-2 border-border border-t-transparent"})]}),(r||s)&&e.jsx("p",{id:h,className:c("mt-1 text-xs",g?"text-danger-fg":"text-text-subtle"),children:r||s})]})});Ne.displayName="TextArea";const hs=new Set(["name","given-name","family-name","additional-name","nickname","honorific-prefix","honorific-suffix","email","username","organization","organization-title","tel","tel-country-code","tel-national","tel-extension","url","photo","language","bday","sex","street-address","address-line1","address-line2","address-line3","address-level1","address-level2","country","country-name","postal-code","current-password","new-password","one-time-code"]);function Ee(t){return t&&hs.has(t)?{autoComplete:t}:{autoComplete:"off","data-1p-ignore":"true","data-lpignore":"true","data-bwignore":"true","data-form-type":"other"}}function Re(t,s){return s.split(".").reduce((r,n)=>r&&typeof r=="object"&&n in r?r[n]:void 0,t)}function bs(t,s,r){const n=s.split("."),a=Array.isArray(t)?[...t]:{...t};let l=a;for(let o=0;o<n.length-1;o++){const f=n[o],i=l[f];l[f]=i&&typeof i=="object"?Array.isArray(i)?[...i]:{...i}:{},l=l[f]}return l[n[n.length-1]]=r,a}function gs(t,s){const r=s.split("."),n=Array.isArray(t)?[...t]:{...t};let a=n;for(let l=0;l<r.length-1;l++){const o=r[l];if(!a[o]||typeof a[o]!="object")return n;a[o]=Array.isArray(a[o])?[...a[o]]:{...a[o]},a=a[o]}return delete a[r[r.length-1]],n}function Xe({title:t,description:s,className:r,children:n}){return e.jsxs("div",{className:c("flex flex-col gap-4 py-6 sm:flex-row sm:gap-8",r),children:[e.jsxs("div",{className:"w-full shrink-0 sm:w-form-label",children:[t&&e.jsx("span",{className:"text-base font-semibold text-text",children:t}),s&&e.jsx("p",{className:"mt-1 text-sm leading-relaxed text-pretty text-text-subtle",children:s})]}),e.jsx("div",{className:"min-w-0 flex-1",children:n})]})}const ps=({groups:t,data:s,onSubmit:r,onCancel:n,onChange:a,transform:l,validate:o,submitButton:f={label:"Submit",variant:"primary"},cancelButton:i={label:"Cancel",variant:"outline"},showButtons:p=!0,layout:m="vertical",size:d="md",loading:b=!1,className:v,ref:y,sdk:g})=>{const[h,z]=u.useState(s||{}),[k,V]=u.useState({}),[_,Y]=u.useState({});u.useEffect(()=>{s&&z({...s})},[s]);const q=u.useCallback((w,x,S)=>{const j=t.flatMap(A=>A.items).find(A=>A.name===w);if(!j)return null;if(j.required&&(x==null||x===""))return`${j.label} is required`;if(j.type==="array"){if(j.required&&(!x||x.length===0))return`${j.label} cannot be empty.`;if(x&&!Array.isArray(x))return`${j.label} must be an array.`;if(Array.isArray(x)&&j.arrayFields){const A=[];let N=!1;if(x.forEach((K,re)=>{const Q={};for(const X of j.arrayFields){const R=K?.[X.name];if(X.required&&(R==null||R===""))Q[X.name]=`${X.label} is required`,N=!0;else if(X.validator){const M=X.validator(R,K);M&&(Q[X.name]=M,N=!0)}}A[re]=Q}),N)return JSON.stringify(A)}}return j.validator?j.validator(x,S):null},[t]),P=u.useCallback((w,x)=>{let S=bs(h,w,x);t.flatMap(N=>N.items).find(N=>N.name===w)?.removeIfEmpty&&(x==null||x==="")&&(S=gs(S,w)),z(S),Y(N=>({...N,[w]:!0}));const A=q(w,x,S);V(N=>({...N,[w]:A||""})),a?.(S,w)},[h,t,q,a]),H=u.useCallback(async w=>{if(w.preventDefault(),b)return;const x={},S=t.flatMap(A=>A.items);for(const A of S){if(A.hidden||A.conditional&&!A.conditional(h))continue;const N=q(A.name,Re(h,A.name),h);N&&(x[A.name]=N)}if(o){const A=o(h);A&&Object.assign(x,A)}if(V(x),Object.keys(x).some(A=>x[A]))return;const j=l?l(h):h;await r?.(h,j)},[h,t,q,o,l,r,b]),ee=u.useCallback(w=>{const x=Re(h,w.name),S=_[w.name]?k[w.name]:void 0,j=w.disabled||b,A={value:x||"",disabled:j,required:w.required,placeholder:w.placeholder,...w.fieldProps};switch(w.type){case"text":case"email":case"password":case"number":case"tel":case"url":return e.jsx(he,{...A,onChange:N=>P(w.name,N.target.value),type:w.textType||w.type,...Ee(w.autocomplete),error:S,size:d});case"textarea":return e.jsx(Ne,{...A,onChange:N=>P(w.name,N.target.value),rows:w.rows??4,error:S,size:d});case"select":return e.jsx(be,{...A,onChange:N=>P(w.name,N),options:(w.options||[]).map(N=>({...N,value:String(N.value)})),searchable:w.searchable,multiple:w.multiple,allowCreate:w.allowCreate,error:S,size:d});case"segmented":return e.jsx(Be,{"aria-label":w.label,value:x==null?"":String(x),onChange:N=>P(w.name,N),options:(w.options||[]).map(N=>({value:String(N.value),label:N.label})),size:d==="sm"?"sm":"md",className:w.disabled?"pointer-events-none opacity-50":void 0});case"checkbox":return e.jsx(fe,{...A,label:w.label,checked:!!x,onChange:N=>P(w.name,N.target.checked),size:d});case"radio":return e.jsx("div",{className:"flex flex-col gap-2",children:w.options?.map(N=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-3 text-base text-text",children:[e.jsx("input",{type:"radio",name:w.name,value:N.value,checked:x===N.value,onChange:()=>P(w.name,N.value),disabled:j||N.disabled,className:"size-checkbox shrink-0 rounded-xs border border-border-strong bg-surface-input accent-accent focus-visible:outline-none focus-visible:focus-ring"}),N.label]},N.value))});case"date":return e.jsx(ye,{...A,value:x?new Date(x):null,onChange:N=>P(w.name,N),size:d});case"file":return e.jsx(Je,{...A,value:x,onChange:N=>P(w.name,N),error:S,onListFiles:N=>g?.http.invoke({method:"POST",action:"storage.file.list",body:N}),onListMounts:()=>g?.http.invoke({method:"GET",action:"storage.mount"}),onUploadFile:N=>g?.http.invoke({method:"POST",action:"storage.file.upload",body:N}),onDownloadFile:N=>g?.http.invoke({method:"GET",action:`storage.file.${N}.download`}),onRegisterFile:N=>g?.http.invoke({method:"POST",action:"storage.file.folder",body:N})});case"folder":return e.jsx(Ue,{value:x||{},onChange:N=>P(w.name,N),onListFolders:()=>g?.http.invoke({method:"GET",action:"storage.mount"}),disabled:j,size:d,placeholder:w.placeholder});case"custom":return w.customComponent?.({value:x,onChange:N=>P(w.name,N),error:S,disabled:j});case"array":{const N=x||[];let K=[];if(typeof S=="string"&&S.startsWith("["))try{K=JSON.parse(S)}catch{}const re=()=>{P(w.name,[...N,{}])},Q=R=>{P(w.name,N.filter((M,D)=>D!==R))},X=(R,M,D)=>{const E=[...N];E[R]={...E[R],[M]:D},P(w.name,E)};return e.jsxs("div",{className:"flex flex-col gap-2",children:[N.map((R,M)=>e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"grid flex-1 gap-2 sm:grid-cols-2",children:w.arrayFields?.map(D=>{const E=K?.[M]?.[D.name];return e.jsxs("div",{className:"flex flex-col gap-1",children:[M===0&&e.jsxs("label",{className:"block text-xs font-semibold uppercase tracking-label text-text-subtle",children:[D.label,D.required&&e.jsx("span",{className:"ml-1 text-danger-fg",children:"*"})]}),(()=>{const F={value:R?.[D.name]||"",disabled:j,required:D.required,placeholder:D.placeholder,...D.fieldProps};switch(D.type){case"text":case"email":case"password":case"number":case"tel":case"url":return e.jsx(he,{...F,onChange:I=>X(M,D.name,I.target.value),type:D.textType||D.type,...Ee(D.autocomplete),error:E,size:d});case"textarea":return e.jsx(Ne,{...F,onChange:I=>X(M,D.name,I.target.value),rows:D.rows??4,error:E,size:d});case"select":return e.jsx(be,{...F,onChange:I=>X(M,D.name,I),options:(D.options||[]).map(I=>({...I,value:String(I.value)})),searchable:D.searchable,multiple:D.multiple,allowCreate:D.allowCreate,error:E,size:d});case"checkbox":return e.jsx(fe,{...F,checked:!!R?.[D.name],onChange:I=>X(M,D.name,I.target.checked),size:d});case"radio":return e.jsx("div",{className:"flex flex-col gap-2",children:D.options?.map(I=>e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-base text-text",children:[e.jsx("input",{type:"radio",name:`${w.name}.${M}.${D.name}`,value:I.value,checked:R?.[D.name]===I.value,onChange:()=>X(M,D.name,I.value),disabled:j||I.disabled,className:"size-checkbox shrink-0 rounded-xs border border-border-strong bg-surface-input accent-accent focus-visible:outline-none focus-visible:focus-ring"}),I.label]},I.value))});case"date":{const I=R?.[D.name];return e.jsx(ye,{...F,value:I?new Date(I):null,onChange:O=>X(M,D.name,O),size:d})}case"custom":return D.customComponent?.({value:R?.[D.name],onChange:I=>X(M,D.name,I),error:E,disabled:j});default:return e.jsxs("p",{children:["Unsupported field type in array:"," ",D.type]})}})(),E&&e.jsx("p",{className:"text-xs text-danger-fg",children:E})]},D.name)})}),e.jsx(se,{type:"button",iconOnly:!0,variant:"ghost",size:"md","aria-label":`${w.label} verwijderen`,onClick:()=>Q(M),disabled:j,className:c("shrink-0",M===0&&"mt-5"),children:e.jsx(L.Trash2,{className:"size-icon-md"})})]},M)),e.jsxs(se,{type:"button",variant:"secondary",leftIcon:e.jsx(L.Plus,{className:"size-icon-sm"}),onClick:re,disabled:j,children:[w.label," toevoegen"]})]})}default:return null}},[h,_,k,b,d,P]),J=u.useCallback(w=>{if(w.conditional&&!w.conditional(h))return null;const x=w.items.filter(j=>!(j.hidden||j.conditional&&!j.conditional(h)));if(x.length===0)return null;const S=c(w.layout==="flex"?"flex flex-wrap gap-3.5":"grid gap-3.5",w.layout!=="flex"&&{"grid-cols-1":!w.columns||w.columns===1,"grid-cols-2":w.columns===2,"grid-cols-3":w.columns===3,"grid-cols-4":w.columns===4},w.className);return e.jsx(Xe,{title:w.title,description:w.description,className:"not-last:border-b not-last:border-border-subtle",children:e.jsx("div",{children:e.jsx("div",{className:S,children:x.map(j=>{const A=_[j.name]?k[j.name]:void 0;return e.jsxs("div",{className:c("flex min-w-0 flex-col gap-1.5",j.type==="checkbox"&&"justify-center"),style:{width:typeof j.width=="string"?j.width:void 0,gridColumn:typeof j.width=="number"?`span ${j.width} / span ${j.width}`:void 0},children:[j.type!=="custom"&&j.type!=="checkbox"&&e.jsxs("label",{className:"block text-sm font-medium text-text-muted",children:[j.label,j.required&&e.jsx("span",{className:"ml-1 text-danger-fg",children:"*"})]}),ee(j),j.help&&!A&&e.jsx("p",{className:"text-xs leading-4 text-text-subtle",children:j.help})]},j.name)})})})},w.id)},[h,_,k,ee]),W=c({"max-w-settings":d==="sm","max-w-form":d==="md","max-w-6xl":d==="lg","max-w-full":d==="full"},v),le=d==="full"?"md":d;return e.jsxs("form",{ref:y,onSubmit:H,className:W,children:[!p&&e.jsx("button",{type:"submit",className:"hidden",tabIndex:-1,"aria-hidden":!0}),e.jsx("div",{className:"flex flex-col",children:t.map(J)}),p&&e.jsx("div",{className:"flex items-center gap-2 border-t border-border-subtle py-4",children:e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"ml-auto"}),n&&e.jsx(se,{type:"button",variant:i.variant??"ghost",size:i.size||le,disabled:i.disabled||b,onClick:n,className:i.className,children:i.label}),e.jsx(se,{type:"submit",variant:f.variant,size:f.size||le,disabled:f.disabled||b,loading:b,className:f.className,children:f.label})]})})]})};function vs({open:t,title:s,description:r,confirmLabel:n="Bevestigen",cancelLabel:a="Annuleren",tone:l="default",loading:o=!1,onConfirm:f,onCancel:i}){return e.jsx(Ae,{open:t,onClose:i,title:s,size:"sm",footer:e.jsxs("div",{className:"flex w-full items-center justify-end gap-2",children:[e.jsx(se,{variant:"ghost",onClick:i,disabled:o,children:a}),e.jsx(se,{variant:l==="danger"?"destructive":"primary",onClick:f,loading:o,children:n})]}),children:r&&e.jsx(de,{color:"secondary",children:r})})}const js={default:"bg-surface-hover text-text",primary:"bg-accent-soft text-accent",secondary:"bg-surface-hover text-text-muted",success:"bg-success-soft text-success-fg",warning:"bg-warning-soft text-warning-fg",error:"bg-danger-soft text-danger-fg",info:"bg-info-soft text-info-fg",note:"bg-note-soft text-note"},ys={sm:"px-2 py-0.5 text-xs",md:"px-2.5 py-1 text-sm",lg:"px-3 py-1.5 text-base"},Ns={default:"bg-surface-hover",primary:"bg-accent",secondary:"bg-surface-hover",success:"bg-success",warning:"bg-warning",error:"bg-danger",info:"bg-info",note:"bg-note"};function Ze({variant:t="default",size:s="md",dot:r=!1,icon:n,dismissible:a=!1,onDismiss:l,className:o,children:f,...i}){return e.jsxs("span",{className:c("inline-flex items-center font-medium rounded-full",js[t],ys[s],o),...i,children:[r&&e.jsx("span",{className:c("w-2 h-2 rounded-full mr-1.5",Ns[t])}),n&&e.jsx("span",{className:c("flex-shrink-0",f&&"mr-1"),children:n}),f,a&&l&&e.jsx("button",{onClick:l,className:"ml-1.5 flex-shrink-0 hover:opacity-70 transition-opacity","aria-label":"Remove badge",children:e.jsx(G,{icon:L.X,size:"xs",color:"current"})})]})}const ie=({className:t})=>e.jsx("span",{className:c("block rounded-xs bg-surface-hover",t)});function ws({shape:t,rows:s,columns:r}){switch(t){case"table":return e.jsxs("div",{className:"overflow-hidden rounded-lg ring-1 ring-border",children:[e.jsx("div",{className:"grid gap-2 bg-surface-hover p-3",style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:Array.from({length:r}).map((n,a)=>e.jsx(ie,{className:"h-4 w-2/3 bg-border-strong"},`h-${a}`))}),Array.from({length:s}).map((n,a)=>e.jsx("div",{className:"grid gap-2 border-t border-border-subtle p-3",style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:Array.from({length:r}).map((l,o)=>e.jsx(ie,{className:"h-4 w-full"},`c-${a}-${o}`))},`r-${a}`))]});case"list":return e.jsx("div",{className:"flex flex-col divide-y divide-border-subtle rounded-lg ring-1 ring-border",children:Array.from({length:s}).map((n,a)=>e.jsxs("div",{className:"flex items-center gap-3 p-3",children:[e.jsx(ie,{className:"size-avatar-sm shrink-0 rounded-full"}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1.5",children:[e.jsx(ie,{className:"h-3"}),e.jsx(ie,{className:"h-2.5 opacity-70"})]})]},a))});case"form":return e.jsx("div",{className:"flex flex-col gap-5",children:Array.from({length:s}).map((n,a)=>e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(ie,{className:"h-2.5 w-28"}),e.jsx(ie,{className:"h-control-md w-full rounded-md"})]},a))});case"menu":return e.jsxs("div",{className:"flex flex-col gap-px",children:[e.jsx("div",{className:"px-2.5 pb-2 pt-5",children:e.jsx(ie,{className:"h-2 w-16"})}),Array.from({length:s}).map((n,a)=>e.jsxs("div",{className:"flex h-row-md items-center gap-2.5 px-2.5",children:[e.jsx(ie,{className:"size-4 shrink-0"}),e.jsx(ie,{className:"h-2"})]},a))]});case"cards":return e.jsx("div",{className:"grid gap-4",style:{gridTemplateColumns:`repeat(${r}, minmax(0, 1fr))`},children:Array.from({length:s*r}).map((n,a)=>e.jsxs("div",{className:"flex flex-col gap-2 rounded-lg p-4 ring-1 ring-border",children:[e.jsx(ie,{className:"h-3 w-1/2"}),e.jsx(ie,{className:"h-2.5"}),e.jsx(ie,{className:"h-2.5 w-3/4 opacity-70"})]},a))});case"text":default:return e.jsxs("div",{className:"flex flex-col gap-6",children:[e.jsx(ie,{className:"h-6 w-1/4"}),e.jsx("div",{className:"flex flex-col gap-2",children:Array.from({length:s}).map((n,a)=>e.jsx(ie,{className:"h-4"},a))})]})}}const ks={text:2,table:8,list:6,form:5,menu:4,cards:2};function we({variant:t="page",shape:s,rows:r,columns:n,children:a,className:l,showTableSkeleton:o=!1,tableColumns:f,tableRows:i}){const p=s??(o?"table":"text"),m=r??i??ks[p],d=n??f??(p==="cards"?3:6),b=e.jsx("div",{className:c("w-full animate-pulse",l),"aria-hidden":!0,children:a??e.jsx(ws,{shape:p,rows:m,columns:d})});return t==="inline"?b:e.jsx("main",{className:"flex-1 bg-surface p-6",children:b})}const Cs={neutral:"bg-surface-hover text-text-muted",success:"bg-success-soft text-success-fg"};function Ss({icon:t,tone:s="neutral",title:r,description:n,actions:a,card:l=!1,className:o,...f}){return e.jsxs("div",{className:c("flex flex-col items-center gap-2.5 text-center",l&&"rounded-lg border border-border bg-surface px-11 py-9 shadow-overlay",o),...f,children:[t!=null&&e.jsx("span",{className:c("flex size-disc items-center justify-center rounded-full text-2xl",Cs[s]),children:t}),e.jsx("div",{className:"text-lg font-semibold text-text",children:r}),n&&e.jsx("div",{className:"max-w-sm text-sm leading-relaxed text-text-muted",children:n}),a&&e.jsx("div",{className:"flex gap-2 pt-1.5",children:a})]})}function Es({children:t,className:s,...r}){return e.jsx("kbd",{className:c("inline-flex items-center rounded border border-border px-1.5 py-px text-xs font-medium leading-none text-text-muted",s),...r,children:t})}const Ts={sm:"h-1",md:"h-1.5"},zs={accent:"bg-accent",success:"bg-success"};function Ms({value:t,variant:s="accent",size:r="md",className:n,...a}){const l=Math.max(0,Math.min(100,t));return e.jsx("div",{role:"progressbar","aria-valuenow":Math.round(l),"aria-valuemin":0,"aria-valuemax":100,className:c("w-full overflow-hidden rounded-full bg-surface-hover",Ts[r],n),...a,children:e.jsx("div",{className:c("h-full rounded-full transition-[width] duration-300 ease-out",zs[s]),style:{width:`${l}%`}})})}const Ds={xs:"h-3 w-3",sm:"h-4 w-4",md:"h-6 w-6",lg:"h-8 w-8",xl:"h-12 w-12"},_s={primary:"text-accent",secondary:"text-text-muted",white:"text-white",current:"text-current"},As={xs:"text-xs",sm:"text-sm",md:"text-sm",lg:"text-base",xl:"text-lg"};function $s({size:t="md",variant:s="primary",label:r="Loading...",showLabel:n=!1,className:a,...l}){return e.jsxs("div",{className:c("inline-flex items-center",n?"flex-col space-y-2":"",a),...l,children:[e.jsxs("svg",{className:c("animate-spin",Ds[t],_s[s]),fill:"none",viewBox:"0 0 24 24","aria-hidden":!n,role:n?"status":void 0,children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),n&&e.jsx("span",{className:c("text-text-muted",As[t]),children:r}),!n&&e.jsx("span",{className:"sr-only",children:r})]})}const Ls={neutral:"bg-text-disabled",accent:"bg-accent",success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info",note:"bg-note","cat-1":"bg-cat-1","cat-2":"bg-cat-2","cat-3":"bg-cat-3","cat-4":"bg-cat-4","cat-5":"bg-cat-5"};function Ps({tone:t="neutral",shape:s="round",pulse:r=!1,label:n,className:a}){return e.jsx("span",{role:n?"img":void 0,"aria-label":n,"aria-hidden":n?void 0:!0,className:c("inline-block size-dot shrink-0",s==="round"?"rounded-full":"rounded-sm",Ls[t],r&&"animate-pulse",a)})}function Rs({steps:t,current:s,variant:r="numbered",label:n,className:a}){const l=t.indexOf(s),o={role:n?"group":void 0,"aria-label":n,"aria-hidden":n?void 0:!0};return r==="dots"?e.jsx("div",{...o,className:c("flex items-center gap-1.5",a),children:t.map((f,i)=>e.jsx("span",{className:c("h-step-bar rounded-full transition-all duration-fast ease-out",i===l?"w-5 bg-accent":"w-3.5",i<l&&"bg-border-strong",i>l&&"bg-border")},f))}):e.jsx("div",{...o,className:c("flex items-center gap-2",a),children:t.map((f,i)=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{"aria-current":i===l?"step":void 0,className:c("flex size-tile-sm items-center justify-center rounded-full text-xs font-medium",i===l&&"bg-accent text-accent-fg",i<l&&"bg-accent-soft text-accent",i>l&&"bg-surface-hover text-text-muted"),children:i+1}),i<t.length-1&&e.jsx("span",{className:"h-px w-8 bg-border-strong"})]},f))})}function Is({title:t,icon:s=e.jsx(L.Sparkles,{className:"size-icon-md","aria-hidden":!0}),action:r,children:n,className:a,...l}){return e.jsxs("div",{className:c("flex flex-col gap-2 rounded-xl border p-4","border-assistant-border bg-assistant-soft",a),...l,children:[e.jsxs("div",{className:"flex items-center gap-2 text-assistant",children:[e.jsx("span",{"aria-hidden":!0,children:s}),e.jsx("span",{className:"text-sm font-semibold",children:t}),r&&e.jsx("span",{className:"ml-auto",children:r})]}),n&&e.jsx("div",{className:"text-sm leading-relaxed text-text",children:n})]})}const Fs={default:"bg-avatar text-avatar-fg",in:"bg-avatar-in text-avatar-in-fg",out:"bg-accent text-accent-fg",note:"bg-avatar-note text-avatar-note-fg"},Os={xs:"w-5 h-5 text-xs",sm:"w-6 h-6 text-xs",md:"w-7 h-7 text-base",lg:"w-9 h-9 text-sm"};function Bs(t){if(!t)return"?";const s=t.trim().split(/[^\p{L}\p{N}]+/u).filter(Boolean);return s.length>=2?(s[0][0]+s[1][0]).toUpperCase():s.length===1?s[0].slice(0,2).toUpperCase():"?"}const Qe=({name:t,src:s,tone:r="default",size:n="sm",className:a,title:l})=>{const[o,f]=u.useState(!1),i=c("inline-flex items-center justify-center rounded-full overflow-hidden shrink-0 font-semibold select-none",r==="identity"?ze(t):Fs[r],Os[n],a);return s&&!o?e.jsx("img",{src:s,alt:t??"",title:l??t,className:c(i,"object-cover"),onError:()=>f(!0)}):e.jsx("span",{className:i,title:l??t,"aria-label":t,children:Bs(t)})},Ie="ring-surface",Hs="ring-surface-accent",qs=({people:t,max:s=4,size:r="sm",className:n})=>{if(t.length===0)return null;const a=t.slice(0,s),l=t.length-a.length;return e.jsxs("span",{className:c("inline-flex items-center",n),children:[a.map((o,f)=>e.jsx(Qe,{name:o.name,src:o.src,size:r,title:o.name?o.seen===!1?`${o.name} — nog niet gelezen`:o.name:void 0,className:c(f>0&&"-ml-2",o.owner?Hs:Ie,o.seen===!1&&"opacity-40")},o.id??`${o.name}-${f}`)),l>0&&e.jsxs("span",{className:c("inline-flex items-center justify-center rounded-full shrink-0 -ml-2 font-semibold bg-avatar text-avatar-fg",r==="xs"?"w-5 h-5 text-xs":r==="md"?"w-7 h-7 text-xs":r==="lg"?"w-9 h-9 text-xs":"w-6 h-6 text-xs",Ie),children:["+",l]})]})},je={mail:{fg:"text-channel-mail-fg",bg:"bg-channel-mail-soft"},wa:{fg:"text-channel-whatsapp-fg",bg:"bg-channel-whatsapp-soft"},chat:{fg:"text-channel-chat-fg",bg:"bg-channel-chat-soft"},tel:{fg:"text-channel-phone-fg",bg:"bg-channel-phone-soft"},note:{fg:"text-channel-note-fg",bg:"bg-channel-note-soft"}},Vs={sm:"size-avatar-xs rounded-sm text-xs",md:"size-avatar-sm rounded-md text-xs",lg:"size-avatar-lg rounded-md text-base"};function Us({channel:t,children:s,size:r="md",className:n,title:a}){const l=t in je?je[t]:void 0;return e.jsx("span",{title:a,className:c("inline-flex shrink-0 items-center justify-center font-bold",Vs[r],l?c(l.fg,l.bg):t?ze(t):c(je.note.fg,je.note.bg),n),children:s})}const Ks=({src:t,alt:s,size:r="md",aspectRatio:n="auto",radius:a="md",showLoading:l=!0,showError:o=!0,fallback:f,loadingContent:i,errorContent:p,className:m,onLoad:d,onError:b,...v})=>{const[y,g]=u.useState(!0),[h,z]=u.useState(!1),[k,V]=u.useState(t),_=W=>{g(!1),z(!1),d?.(W)},Y=W=>{if(g(!1),z(!0),f&&k!==f){V(f),z(!1),g(!0);return}b?.(W)},q=c("relative overflow-hidden bg-surface-hover",{"w-8 h-8":r==="xs","w-12 h-12":r==="sm","w-16 h-16":r==="md","w-24 h-24":r==="lg","w-32 h-32":r==="xl","w-full h-full":r==="full"},{"aspect-square":n==="square","aspect-video":n==="video","aspect-portrait":n==="portrait","aspect-landscape":n==="landscape"},{"rounded-none":a==="none","rounded-sm":a==="sm","rounded-md":a==="md","rounded-lg":a==="lg","rounded-xl":a==="xl","rounded-full":a==="full"},m),P=c("w-full h-full object-cover transition-opacity duration-fast",{"opacity-0":y||h,"opacity-100":!y&&!h}),H=c("absolute inset-0 flex items-center justify-center","text-text-muted"),ee=e.jsx("div",{className:"animate-pulse",children:e.jsx("div",{className:"w-6 h-6 bg-surface-hover rounded"})}),J=e.jsxs("div",{className:"text-center",children:[e.jsx(G,{icon:L.ImageOff,size:"lg",className:"mx-auto mb-1"}),e.jsx("span",{className:"text-xs",children:"Failed to load"})]});return e.jsxs("div",{className:q,children:[e.jsx("img",{...v,src:k,alt:s,className:P,onLoad:_,onError:Y}),y&&l&&e.jsx("div",{className:H,children:i||ee}),h&&o&&e.jsx("div",{className:H,children:p||J})]})};function Ws({icon:t,onClick:s,children:r}){return e.jsxs("button",{type:"button",onClick:s,className:c("inline-flex h-control-sm shrink-0 cursor-pointer items-center gap-1.5 rounded-md px-2.5","text-sm font-medium whitespace-nowrap","transition-colors duration-fast ease-out hover:bg-white/15","focus-visible:outline-none focus-visible:focus-ring"),children:[t,r]})}function Gs({items:t,getRowKey:s,variant:r="divided",leading:n,renderItem:a,trailing:l,onSelect:o,onActiveIndexChange:f,isActive:i,unread:p,dimmed:m,groupBy:d,groups:b,renderGroupHeader:v,stickyGroupHeaders:y=!1,collapsibleGroups:g=!1,hideGroupCount:h=!1,selectable:z=!1,selectedItems:k=[],onSelectionChange:V,bulkActions:_,header:Y,stickyHeader:q=!1,bordered:P=!1,emptyContent:H,loading:ee=!1,loadingRows:J=4,className:W,"aria-label":le}){const[w,x]=u.useState(()=>Object.fromEntries((b??[]).filter(E=>E.defaultCollapsed).map(E=>[E.id,!0]))),S=u.useRef(null),j=E=>{if(!["ArrowDown","ArrowUp","Home","End"].includes(E.key))return;const I=Array.from(S.current?.querySelectorAll("li[data-list-row]")??[]);if(I.length===0)return;E.preventDefault();const O=I.indexOf(document.activeElement),T=E.key==="Home"?0:E.key==="End"?I.length-1:E.key==="ArrowDown"?(O+1)%I.length:(O-1+I.length)%I.length;I[T]?.focus()},A=(E,F)=>s?s(E,F):F,N=E=>k.includes(E),K=(E,F)=>{V&&V(F?[...k,E]:k.filter(I=>I!==E))},re=E=>V?.(E?[...t]:[]),Q=c("flex flex-col",z&&k.length>0&&"min-h-full",P&&"overflow-hidden rounded-lg border border-border-subtle",W);if(ee)return e.jsx("div",{className:Q,children:Array.from({length:J}).map((E,F)=>e.jsxs("div",{className:c("flex animate-pulse items-center gap-3 px-4 py-2",r==="divided"&&F>0&&"border-t border-border-subtle"),children:[e.jsx("span",{className:"size-tile-sm shrink-0 rounded-md bg-surface-hover"}),e.jsx("span",{className:"h-3 w-30 shrink-0 rounded-sm bg-surface-hover"}),e.jsx("span",{className:"h-3 flex-1 rounded-sm bg-surface-hover"}),e.jsx("span",{className:"h-3 w-8 shrink-0 rounded-sm bg-surface-hover"})]},`skeleton-${F}`))});if(t.length===0&&H)return e.jsx("div",{className:Q,children:H});const X=t.length>0&&k.length===t.length,R=k.length>0&&!X,M=(E,F,I)=>{const O=i?.(E,F)??!1,T=p?.(E,F)??!1,$=m?.(E,F)??!1,Z=z&&N(E);return e.jsxs("li",{...o?{role:"button",tabIndex:0,"data-list-row":"","aria-current":O||void 0,onClick:()=>o(E,F),onFocus:()=>f?.(F),onKeyDown:ne=>{ne.key!=="Enter"&&ne.key!==" "||(ne.preventDefault(),o(E,F))}}:{},className:c("flex items-center gap-3 text-base","transition-colors duration-fast ease-out",r==="inset"?"mx-2 rounded-lg px-3 py-2.5":"px-5 py-2.5",r==="divided"&&!I&&"border-t border-border-subtle",o&&"cursor-pointer focus-visible:outline-none focus-visible:focus-ring",O||Z?"bg-accent-soft text-text":T?c("bg-surface-unread",o&&"hover:bg-surface-unread-hover"):o&&"hover:bg-surface-hover",$&&"text-text-muted"),children:[z&&e.jsx("span",{onClick:ne=>ne.stopPropagation(),children:e.jsx(fe,{checked:N(E),onChange:ne=>K(E,ne.target.checked),"aria-label":"Rij selecteren"})}),r==="bulleted"&&e.jsx("span",{"aria-hidden":!0,className:"mt-2 size-1.5 shrink-0 self-start rounded-full bg-border-strong"}),n&&e.jsx("span",{className:"shrink-0",children:n(E,F)}),e.jsx("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:a?a(E,F):String(E)}),l&&e.jsx("span",{className:"shrink-0 text-xs text-text-subtle",children:l(E,F)})]},A(E,F))},D=(()=>{if(!d)return t.map((O,T)=>M(O,T,T===0));const E=new Map;t.forEach((O,T)=>{const $=d(O,T);E.has($)||E.set($,[]),E.get($).push({item:O,index:T})});const F=b??[];return[...F.filter(O=>E.has(O.id)),...[...E.keys()].filter(O=>!F.some(T=>T.id===O)).map(O=>({id:O}))].flatMap((O,T)=>{const $=E.get(O.id)??[],Z=g&&w[O.id],ne=O.title??O.id,oe=O.count??$.length,xe=e.jsx("li",{onClick:g?()=>x(ue=>({...ue,[O.id]:!ue[O.id]})):void 0,className:c("flex items-center gap-2.5 bg-surface px-5 pb-1.5 text-base font-semibold",T>0?"pt-5":"pt-3",O.tone==="danger"?"text-danger-fg":O.tone==="muted"?"text-text-subtle":"text-text",y&&"sticky z-10",g&&"cursor-pointer select-none"),"aria-expanded":g?!Z:void 0,style:y?{top:q?28:0}:void 0,children:v?v(O,$.map(ue=>ue.item)):e.jsxs(e.Fragment,{children:[g&&e.jsx(L.ChevronRight,{"aria-hidden":!0,className:c("size-icon-md shrink-0 text-text-subtle transition-transform duration-fast ease-out",!Z&&"rotate-90")}),e.jsx("span",{children:ne}),!h&&e.jsx("span",{className:c("rounded-full px-2 text-xs font-normal tabular-nums",O.tone==="danger"?"bg-danger-soft text-danger-fg":"bg-surface-sunk text-text-subtle"),children:oe})]})},`group-${O.id}`);return Z?[xe]:[xe,...$.map(({item:ue,index:ke},C)=>M(ue,ke,C===0))]})})();return e.jsxs("div",{ref:S,className:Q,onKeyDown:o?j:void 0,children:[Y&&e.jsxs("div",{className:c("flex h-row-sm items-end gap-3 border-b border-border bg-surface px-5 pb-2","text-xs font-semibold uppercase tracking-wider text-text-disabled",q&&"sticky top-0 z-20"),children:[z&&e.jsx("span",{className:"flex items-center",children:e.jsx(fe,{checked:X,indeterminate:R,onChange:E=>re(E.target.checked),"aria-label":"Alles selecteren"})}),Y]}),e.jsx("ul",{"aria-label":le,className:"flex flex-col",children:D}),z&&k.length>0&&e.jsx("div",{className:"pointer-events-none sticky bottom-0 z-10 flex justify-center px-5 pb-4",children:e.jsxs("div",{className:"pointer-events-auto flex items-center gap-1.5 rounded-lg bg-accent py-1.5 pl-3.5 pr-1.5 text-accent-fg shadow-overlay",children:[e.jsxs("span",{className:"text-sm font-medium",children:[k.length," geselecteerd"]}),e.jsx("span",{"aria-hidden":!0,className:"mx-1.5 h-4 w-px bg-current opacity-25"}),_,e.jsx("span",{"aria-hidden":!0,className:"mx-1.5 h-4 w-px bg-current opacity-25"}),e.jsx("button",{type:"button",onClick:()=>V?.([]),"aria-label":"Selectie wissen",className:"grid size-tile-md shrink-0 cursor-pointer place-items-center rounded-md transition-colors duration-fast ease-out hover:bg-white/15 focus-visible:outline-none focus-visible:focus-ring",children:e.jsx(L.X,{className:"size-icon-lg"})})]})})]})}function Ys({side:t,continued:s=!1,tone:r="default",className:n,children:a}){return e.jsx("div",{className:c("min-w-0 max-w-bubble md:max-w-bubble-md",t==="out"?"rounded-lg rounded-tr-sm":"rounded-lg rounded-tl-sm",r==="note"?"bg-note-soft":t==="out"?"bg-bubble-out-soft":"bg-surface-sunk",s&&"mt-1",n),children:a})}const Js={default:"text-text",urgent:"text-danger-fg",success:"text-success-fg"};function Xs({value:t,label:s,tone:r="default",className:n,...a}){return e.jsxs("div",{className:c("rounded-xl bg-editor px-4 py-3.5",n),...a,children:[e.jsx("div",{className:c("text-2xl font-semibold",Js[r]),children:t}),e.jsx("div",{className:"pt-0.5 text-xs text-text-muted",children:s})]})}const et=({surface:t=!1,title:s,subtitle:r,meta:n,actions:a=[],children:l,className:o,backLabel:f="Back",backClassName:i,onBack:p,editable:m=!1,onTitleChange:d})=>{const[b,v]=u.useState(!1),[y,g]=u.useState(s),h=u.useRef(null);u.useEffect(()=>{g(s)},[s]),u.useEffect(()=>{b&&h.current&&(h.current.focus(),h.current.select())},[b]);const z=()=>{m&&v(!0)},k=()=>{v(!1),y.trim()!==""&&y!==s&&d?d(y.trim()):g(s)},V=_=>{_.key==="Enter"?h.current?.blur():_.key==="Escape"&&(g(s),v(!1))};return e.jsxs("div",{className:c("px-5 pt-4 pb-2.5",t&&"border-b border-border",o),children:[e.jsxs("div",{className:"flex flex-row sm:items-start sm:justify-between items-center gap-4",children:[e.jsx("div",{className:"min-w-0 flex-1",children:e.jsxs("div",{className:"flex items-start gap-4 text-text",children:[p&&e.jsx(se,{variant:"ghost",onClick:p,leftIcon:e.jsx(G,{icon:L.ChevronLeft,size:"md"}),iconOnly:!0}),e.jsxs("div",{className:"min-w-0 flex-1",children:[b?e.jsx("input",{ref:h,type:"text",value:y,onChange:_=>g(_.target.value),onBlur:k,onKeyDown:V,className:"text-1xl font-semibold bg-transparent border-b-1 border-border rounded-lg outline-none focus:border-none px-1 -mx-1 min-w-0 w-full"}):e.jsxs("div",{className:"group flex items-baseline gap-2.5 min-w-0",children:[e.jsx("h2",{onClick:z,className:c("text-lg font-semibold tracking-title truncate",m&&"cursor-pointer"),title:m?"Click to edit":void 0,children:s}),r&&e.jsx("span",{className:"shrink-0 text-base text-text-muted truncate",children:r}),m&&e.jsx(L.Pencil,{size:15,onClick:z,className:"shrink-0 cursor-pointer text-text-muted opacity-0 group-hover:opacity-100 transition-opacity"})]}),n&&e.jsx("div",{className:c("mt-1 min-w-0 text-sm text-text-subtle",typeof n=="string"&&"truncate"),children:n})]})]})}),a.length>0&&e.jsx("div",{className:"flex flex-wrap sm:flex-nowrap gap-2 sm:gap-3",children:a.map(_=>_.render?e.jsx(u.Fragment,{children:_.render()},_.id):_.splitOptions&&_.splitOptions.length>0?e.jsx(De,{label:_.label,onClick:_.onClick,icon:_.icon,variant:_.variant==="primary"?"primary":"outline",options:_.splitOptions,disabled:_.disabled},_.id):e.jsx(se,{variant:_.variant??"secondary",onClick:Y=>{Y.stopPropagation(),Y.target.blur(),_.onClick()},disabled:_.disabled,leftIcon:_.icon,children:_.label},_.id))})]}),l&&e.jsx("div",{className:"mt-4",children:l})]})},Zs={none:"",sm:"px-3 pb-3 pt-1",md:"px-5 pb-5 pt-1.5"},Qs=({title:t,subtitle:s,meta:r,actions:n,onBack:a,surface:l,headerContent:o,loading:f=!1,loadingShape:i="table",empty:p,padding:m="md",scroll:d=!0,className:b,contentClassName:v,children:y})=>{const g=f?e.jsx(we,{variant:"inline",shape:i}):p?e.jsx("div",{className:"flex flex-col items-center justify-center py-12",children:p}):y;return e.jsxs("div",{className:c(d?"flex h-full min-h-0 flex-col":"flex flex-col",b),children:[e.jsx(et,{surface:l??d,title:t,subtitle:s,meta:r,actions:n,onBack:a,className:d?"shrink-0":void 0,children:o}),e.jsx("div",{className:c(d&&"min-h-0 flex-1 overflow-y-auto",Zs[m],v),children:g})]})},er=/<[a-z][\s\S]*>/i,tr=["[&_p]:my-1.5 [&_p:first-child]:mt-0 [&_p:last-child]:mb-0 [&_p]:leading-relaxed","[&_a]:text-accent [&_a]:underline [&_a]:underline-offset-2","[&_strong]:font-semibold [&_em]:italic","[&_ul]:my-1.5 [&_ul]:list-disc [&_ul]:pl-5 [&_ol]:my-1.5 [&_ol]:list-decimal [&_ol]:pl-5","[&_li]:leading-relaxed","[&_h1]:mb-1 [&_h1]:mt-2 [&_h1]:font-semibold [&_h2]:mb-1 [&_h2]:mt-2 [&_h2]:font-semibold [&_h3]:mb-1 [&_h3]:mt-2 [&_h3]:font-semibold","[&_blockquote]:my-1.5 [&_blockquote]:border-l-2 [&_blockquote]:border-border [&_blockquote]:pl-3 [&_blockquote]:text-text-muted","[&_hr]:my-2 [&_hr]:border-border","[&_pre]:my-1.5 [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-surface-sunk [&_pre]:p-2 [&_pre]:text-xs","[&_code]:rounded-sm [&_code]:bg-surface-sunk [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-xs","[&_pre_code]:bg-transparent [&_pre_code]:p-0","[&_table]:my-1.5 [&_table]:w-full [&_table]:border-collapse [&_table]:text-xs","[&_th]:border [&_th]:border-border [&_th]:px-2 [&_th]:py-1 [&_th]:text-left [&_th]:font-semibold","[&_td]:border [&_td]:border-border [&_td]:px-2 [&_td]:py-1"].join(" "),sr={p:t=>e.jsx("p",{className:"my-1.5 leading-relaxed first:mt-0 last:mb-0",...t}),a:t=>e.jsx("a",{className:"text-accent underline underline-offset-2 hover:opacity-80",target:"_blank",rel:"noopener noreferrer",...t}),strong:t=>e.jsx("strong",{className:"font-semibold",...t}),em:t=>e.jsx("em",{className:"italic",...t}),ul:t=>e.jsx("ul",{className:"my-1.5 list-disc space-y-0.5 pl-5",...t}),ol:t=>e.jsx("ol",{className:"my-1.5 list-decimal space-y-0.5 pl-5",...t}),li:t=>e.jsx("li",{className:"leading-relaxed",...t}),h1:t=>e.jsx("h1",{className:"mb-1 mt-2 text-md font-semibold first:mt-0",...t}),h2:t=>e.jsx("h2",{className:"mb-1 mt-2 text-base font-semibold first:mt-0",...t}),h3:t=>e.jsx("h3",{className:"mb-1 mt-2 text-base font-semibold first:mt-0",...t}),blockquote:t=>e.jsx("blockquote",{className:"my-1.5 border-l-2 border-border pl-3 text-text-muted",...t}),hr:t=>e.jsx("hr",{className:"my-2 border-border",...t}),pre:t=>e.jsx("pre",{className:"my-1.5 overflow-x-auto rounded-md bg-surface-sunk p-2 text-xs",...t}),code:({className:t,children:s,...r})=>{const n=String(s??"");return/language-/.test(t??"")||n.includes(`
|
|
2
|
+
`)?e.jsx("code",{className:"font-mono text-xs",...r,children:s}):e.jsx("code",{className:"rounded-sm bg-surface-sunk px-1 py-0.5 font-mono text-xs",...r,children:s})},table:t=>e.jsx("div",{className:"my-1.5 overflow-x-auto",children:e.jsx("table",{className:"w-full border-collapse text-xs",...t})}),th:t=>e.jsx("th",{className:"border border-border px-2 py-1 text-left font-semibold",...t}),td:t=>e.jsx("td",{className:"border border-border px-2 py-1",...t})};function rr({text:t,className:s,as:r}){const n=t??"";return(r?r==="html":er.test(n))?e.jsx("div",{className:c("break-words",tr,s),dangerouslySetInnerHTML:{__html:ot.sanitize(n,{ADD_ATTR:["target","rel"]})}}):e.jsx("div",{className:c("break-words",s),children:e.jsx(ct,{remarkPlugins:[it],components:sr,children:n})})}const nr=({label:t,meta:s,action:r,className:n})=>e.jsxs("div",{className:c("flex items-center gap-2 px-1 pb-2 pt-7 first:pt-0",n),children:[e.jsx("span",{className:"shrink-0 text-2xs font-semibold uppercase tracking-label text-text-subtle",children:t}),s&&e.jsx("span",{className:"min-w-0 flex-1 truncate text-right text-xs tabular-nums text-text-subtle",children:s}),r&&e.jsx("span",{className:"ml-auto shrink-0",children:r})]});function ar({label:t,trailing:s,align:r="center",className:n}){const a=e.jsx("span",{className:"h-px flex-1 bg-border-subtle","aria-hidden":!0});return!t&&!s?e.jsx("div",{className:c("flex items-center py-2",n),children:a}):e.jsxs("div",{className:c("flex items-center gap-3 py-2",n),children:[r==="center"&&a,e.jsx("span",{className:"shrink-0 text-xs font-medium text-text-muted",children:t}),a,s&&e.jsx("span",{className:"shrink-0",children:s})]})}const tt=u.createContext(null),lr=tt.Provider;function st(){return u.useContext(tt)}function or(){const[t,s]=u.useState(null),r=u.useMemo(()=>({setTrail:(n,a)=>s(l=>a?{ownerId:n,entry:a}:l&&l.ownerId!==n?l:null)}),[]);return{trail:t?.entry??null,api:r}}const cr={none:"",sm:"px-3 py-3",md:"px-5 py-4"},ir=({children:t,actions:s=[],secondaryActions:r=[],onBack:n,backLabel:a="Back",title:l,loading:o=!1,loadingShape:f="form",padding:i="md",className:p,contentClassName:m})=>{const d=st(),b=u.useId(),v=u.useRef(n);v.current=n;const y=!!n;u.useEffect(()=>{if(d&&!(!y&&!l))return d.setTrail(b,{title:l,onBack:y?()=>v.current?.():void 0}),()=>d.setTrail(b,null)},[d,b,l,y]);const g=s.length>0||r.length>0;return e.jsxs("div",{className:c("flex min-h-full flex-col",p),children:[!d&&(y||l)&&e.jsxs("div",{className:"flex shrink-0 items-center gap-2 px-5 pt-4",children:[y&&e.jsx(se,{variant:"ghost",onClick:()=>v.current?.(),"aria-label":a,leftIcon:e.jsx(G,{icon:L.ChevronLeft,size:"sm"}),iconOnly:!0}),l&&e.jsx("h2",{className:"min-w-0 truncate text-md font-semibold tracking-title text-text",children:l})]}),e.jsx("div",{className:c("flex-1",cr[i],m),children:o?e.jsx(we,{variant:"inline",shape:f}):t}),g&&e.jsxs("div",{className:"sticky bottom-0 z-10 flex shrink-0 items-center gap-2 border-t border-border bg-surface px-5 py-3",children:[r.length>0&&e.jsx(ge,{actions:r,defaultVariant:"ghost"}),s.length>0&&e.jsx(ge,{actions:s,className:"ml-auto"})]})]})};function dr({label:t,description:s,control:r,bordered:n=!1,disabled:a=!1,className:l}){return e.jsxs("div",{className:c("flex items-center justify-between gap-4 py-2",n&&"rounded-lg border border-border px-3",a&&"opacity-50",l),children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"text-sm text-text",children:t}),s&&e.jsx("div",{className:"text-xs text-text-muted",children:s})]}),e.jsx("div",{className:"shrink-0",children:r})]})}function ur({icon:t,title:s,description:r,actions:n,children:a,className:l}){return e.jsxs("section",{className:c("flex flex-col gap-2",l),children:[e.jsxs("div",{className:"flex items-start gap-2",children:[t&&e.jsx(G,{icon:t,size:"md",color:"secondary",className:"mt-0.5"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h3",{className:"text-sm font-semibold text-text",children:s}),r&&e.jsx("p",{className:"text-xs text-text-muted",children:r})]}),n&&e.jsx("div",{className:"shrink-0",children:n})]}),e.jsx("div",{className:c("flex flex-col",t&&"pl-6"),children:a})]})}function xr({label:t,dotColor:s,onClick:r,className:n}){return e.jsxs("button",{type:"button",onClick:r,className:c("inline-flex max-w-full items-center gap-1.5 rounded-full bg-surface-sunk px-2.5 py-1 text-xs text-text-muted transition-colors duration-fast ease-out hover:bg-surface-hover hover:text-text",n),children:[s&&e.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full",style:{backgroundColor:s},"aria-hidden":!0}),e.jsx("span",{className:"min-w-0 truncate",children:t}),e.jsx(G,{icon:L.ArrowUpRight,size:"xs",className:"opacity-70"})]})}function rt(t){const{id:s,header:r,accessor:n,label:a,tone:l,visible:o,width:f,sortable:i,align:p}=t;return{id:s,header:r,accessor:m=>a(n(m),m),cell:(m,d)=>{const b=n(d);return o&&!o(b,d)?null:e.jsx(Ze,{variant:l?l(b,d):"default",size:"sm",children:a(b,d)})},width:f,sortable:i,align:p}}function fr(t){const{id:s,header:r,accessor:n,onLabel:a,offLabel:l,onTone:o="success",offTone:f="secondary",width:i,sortable:p}=t;return rt({id:s,header:r,accessor:m=>!!n(m),label:m=>m?a:l,tone:m=>m?o:f,width:i,sortable:p})}function mr(t){const{id:s,header:r,accessor:n,label:a,empty:l="—",separator:o=", ",width:f,searchable:i,sortable:p}=t;return{id:s,header:r,accessor:m=>{const d=n(m),v=(d==null?[]:Array.isArray(d)?d:[d]).filter(Boolean).map(y=>a(y)??y);return v.length?v.join(o):l},width:f,searchable:i,sortable:p}}function hr(t,s){return s.split(".").reduce((r,n)=>r&&typeof r=="object"&&n in r?r[n]:void 0,t)}const br=({groups:t,data:s,size:r="md",className:n})=>{const a=m=>{if(!m)return"-";try{return new Date(m).toLocaleDateString("nl-NL",{year:"numeric",month:"long",day:"numeric"})}catch{return String(m)}},l=m=>m?"Ja":"Nee",o=(m,d)=>{if(!d)return String(m||"-");const b=d.find(v=>v.value===m);return b?b.label:String(m||"-")},f=u.useCallback(m=>{const d=hr(s,m.name);if(m.type==="array"){const v=d;return!v||v.length===0?e.jsx(de,{variant:"body",size:"sm",className:"text-text-muted",children:"Geen items"}):e.jsx("div",{className:"space-y-3",children:v.map((y,g)=>e.jsxs("div",{className:"p-4 border border-border rounded-xl space-y-3",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs(de,{variant:"label",size:"sm",weight:"medium",className:"text-text-muted",children:[m.label," ",g+1]})}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:m.arrayFields?.map(h=>{const z=y?.[h.name];let k="-";switch(h.type){case"text":case"email":case"number":case"tel":case"url":case"textarea":k=z||"-";break;case"select":case"radio":k=o(z,h.options);break;case"checkbox":k=l(z);break;case"date":k=a(z);break;case"custom":k=h.customComponent?.({value:z});break;default:k=String(z||"-")}return h.format&&(k=h.format(z,y)),e.jsxs("div",{className:"space-y-1",children:[e.jsx(de,{variant:"label",size:"xs",className:"text-text-muted",children:h.label}),e.jsx(de,{variant:"body",size:"sm",className:"text-text",children:k})]},h.name)})})]},g))})}if(m.type==="custom"&&m.customComponent)return m.customComponent({value:d});if(m.format){const v=m.format(d,s);return e.jsx(de,{variant:"body",size:"sm",className:"text-text",children:v})}let b="-";switch(m.type){case"text":case"email":case"password":case"number":case"tel":case"url":b=d?String(d):"-";break;case"textarea":b=d?e.jsx("div",{className:"whitespace-pre-wrap",children:String(d||"-")}):"-";break;case"select":case"radio":b=o(d,m.options);break;case"checkbox":b=l(d);break;case"date":b=a(d);break;default:b=d?String(d):"-"}return e.jsx(de,{variant:"body",size:"sm",className:"text-text",children:b})},[s]),i=u.useCallback(m=>{if(m.conditional&&!m.conditional(s))return null;const d=m.items.filter(v=>!(v.hidden||v.conditional&&!v.conditional(s)));if(d.length===0)return null;const b=c("space-y-4",{"grid gap-4":m.layout==="grid","flex flex-wrap gap-4":m.layout==="flex"},m.layout==="grid"&&{"grid-cols-1":!m.columns||m.columns===1,"grid-cols-2":m.columns===2,"grid-cols-3":m.columns===3,"grid-cols-4":m.columns===4},m.className);return e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-8 p-6 border border-border rounded-xl",children:[e.jsxs("div",{className:"md:col-span-1",children:[e.jsx(de,{variant:"label",size:"lg",weight:"semibold",className:"text-text",children:m.title}),m.description&&e.jsx(de,{variant:"body",size:"sm",className:"text-text-muted mt-1",children:m.description})]}),e.jsx("div",{className:"md:col-span-2",children:e.jsx("div",{className:b,children:d.map(v=>e.jsxs("div",{className:"space-y-1",style:{width:typeof v.width=="string"?v.width:void 0,gridColumn:typeof v.width=="number"?`span ${v.width} / span ${v.width}`:void 0},children:[v.type!=="custom"&&e.jsx(de,{variant:"label",size:"sm",className:"font-medium text-text-muted",children:v.label}),f(v)]},v.name))})})]},m.id)},[s,f]),p=c("space-y-6",{"max-w-md":r==="sm","max-w-2xl":r==="md","max-w-4xl":r==="lg","max-w-full":r==="full"},n);return e.jsx("div",{className:p,children:e.jsx("div",{className:"space-y-8",children:t.map(i)})})},gr=()=>e.jsx(we,{variant:"inline",shape:"menu"}),nt=({item:t,isSelectedHandler:s,onClick:r,depth:n=0})=>{const a=!!(t.children&&t.children.length>0),l=s?s(t.path):!1;if(a)return e.jsxs("li",{children:[e.jsxs("div",{className:c("flex items-center gap-2 px-2.5 pt-5 pb-2 text-2xs font-semibold uppercase tracking-label text-text-disabled"),children:[e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.label}),t.count!==void 0&&t.count>0&&e.jsx("span",{className:"font-normal tabular-nums",children:t.count})]}),e.jsx("ul",{className:"flex flex-col gap-px",children:t.children?.map((i,p)=>e.jsx(nt,{item:i,isSelectedHandler:s,onClick:r,depth:n+1},p))})]});const o=t.action,f=o?.visibility!=="always";return e.jsx("li",{children:e.jsxs("div",{role:"button",tabIndex:0,onClick:()=>t.path&&r?.(t.path),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),t.path&&r?.(t.path))},className:c("group/item flex h-row-md cursor-pointer items-center gap-2.5 rounded-md px-2.5 text-base no-underline","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:focus-ring",l?"bg-surface-hover font-medium text-text shadow-sm":"text-text-muted hover:bg-page-hover hover:text-text"),children:[t.icon&&e.jsx("span",{className:c("flex w-5 shrink-0 items-center justify-center",l?"text-text-muted":"text-text-subtle"),children:t.icon}),e.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.label}),t.count!==void 0&&t.count>0&&e.jsx("span",{className:c("shrink-0 text-xs tabular-nums",l?"rounded-full bg-accent px-1.5 font-semibold text-accent-fg":"text-text-subtle",o&&f&&"group-hover/item:hidden group-focus-within/item:hidden"),children:t.count}),o&&e.jsx("button",{type:"button","aria-label":o.label,title:o.label,onClick:i=>{i.stopPropagation(),o.onClick()},onKeyDown:i=>i.stopPropagation(),className:c("flex size-5 shrink-0 items-center justify-center rounded-sm","text-text-subtle transition-colors duration-fast ease-out","hover:bg-page-hover hover:text-text","focus-visible:outline-none focus-visible:focus-ring",f&&"opacity-0 group-hover/item:opacity-100 focus-visible:opacity-100"),children:o.icon})]})})},pr=({items:t,isSelectedHandler:s,onClick:r,preMenuItemsComponent:n,loading:a=!1})=>a?e.jsxs("nav",{className:"flex h-full min-h-0 shrink-0 flex-col",children:[n&&e.jsx("div",{className:"pb-4",children:n}),e.jsx(gr,{})]}):e.jsxs("nav",{className:"flex h-full min-h-0 shrink-0 flex-col",children:[n&&e.jsx("div",{className:"pb-4",children:n}),e.jsx("ul",{className:"flex min-h-0 flex-1 flex-col gap-px overflow-y-auto",children:t.map((l,o)=>!l.path&&!l.label&&!l.children?e.jsx("li",{"aria-hidden":!0,className:"h-4"},o):e.jsx(nt,{item:l,isSelectedHandler:s,onClick:r},o))})]}),vr={xs:"text-xs",sm:"text-sm",md:"text-base",lg:"text-lg",xl:"text-xl","2xl":"text-2xl","3xl":"text-3xl","4xl":"text-3xl"},jr={light:"font-normal",normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},yr={primary:"text-text",secondary:"text-text-muted",accent:"text-accent",success:"text-success-fg",warning:"text-warning-fg",error:"text-danger-fg",info:"text-info-fg",neutral:"text-text",current:"text-current"},Nr={left:"text-left",center:"text-center",right:"text-right"},wr=({level:t=1,size:s,weight:r="semibold",color:n="current",align:a="left",truncate:l=!1,className:o,children:f,...i})=>{const p=`h${t}`,m=c("font-sans text-pretty",vr[s||kr(t)],jr[r],yr[n],Nr[a],l&&"truncate",o);return e.jsx(p,{className:m,...i,children:f})};function kr(t){return{1:"2xl",2:"xl",3:"lg",4:"lg",5:"md",6:"md"}[t]||"md"}const Cr=({commands:t,isOpen:s,onClose:r,labels:n,initialCommandPath:a,initialActiveIndex:l})=>{const[o,f]=u.useState(""),[i,p]=u.useState(a||[]),[m,d]=u.useState(l||0),b=u.useRef(null),v=u.useRef(null),g=(i.length?t.find(h=>h.id===i[0])?.subCommands||[]:t).filter(h=>h.label.toLowerCase().includes(o.toLowerCase()));return u.useEffect(()=>{s||(f(""),p(a||[]),d(l||0))},[s]),u.useEffect(()=>{const h=z=>{if(s){if(z.key==="Escape")r();else if(z.key==="ArrowUp")d(k=>k>0?k-1:g.length-1);else if(z.key==="ArrowDown")d(k=>k<g.length-1?k+1:0);else if(z.key==="Enter"){const k=g[m];k&&(k.subCommands?(p([...i,k.id]),d(0)):k.action&&(k.action(),r()))}}};return document.addEventListener("keydown",h),()=>document.removeEventListener("keydown",h)},[s,r,g,m,i]),u.useEffect(()=>{const h=z=>{b.current&&!b.current.contains(z.target)&&r()};return s&&document.addEventListener("mousedown",h),()=>document.removeEventListener("mousedown",h)},[s,r]),u.useEffect(()=>{if(!s)return;v.current?.querySelector(`[data-index="${m}"]`)?.scrollIntoView({block:"nearest"})},[m,s]),s?e.jsx("div",{className:"fixed inset-0 z-modal flex items-center justify-center bg-scrim",children:e.jsxs("div",{className:"flex flex-col w-full max-w-lg max-h-dialog p-2 mx-auto rounded-lg border border-border shadow-modal bg-surface",ref:b,children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 flex-shrink-0",children:[e.jsx(L.Search,{className:"w-4 h-4 text-text-muted shrink-0"}),e.jsx("input",{type:"text",autoFocus:!0,placeholder:n?.searchPlaceholder||"Search commands...",value:o,onChange:h=>f(h.target.value),className:"w-full border-0 bg-transparent py-2 text-text focus:outline-none"})]}),e.jsxs("div",{ref:v,className:"mt-2 pt-2 text-sm border-t border-border max-h-dialog-list overflow-y-auto",children:[g.length===0&&e.jsx("div",{className:"text-text-muted text-center text-sm",children:n?.noCommandsFound||"No commands found"}),g.map((h,z)=>e.jsxs("div",{"data-index":z,className:`flex items-center p-2 cursor-pointer rounded-md ${z===m?"bg-accent-soft text-accent":"text-text"}`,onClick:()=>{h.subCommands?(p([...i,h.id]),d(0)):h.action&&(h.action(),r())},onMouseEnter:()=>d(z),children:[h.icon&&e.jsx("span",{className:"mr-3",children:h.icon}),e.jsx("span",{className:"flex-grow",children:h.label}),h.subCommands&&e.jsx("span",{className:"text-text-muted",children:e.jsx(L.ChevronRight,{className:"w-4 h-4"})})]},h.id))]}),e.jsxs("div",{className:"flex items-center gap-4 px-3 pt-2 mt-2 text-xs text-text-muted border-t border-border",children:[e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("kbd",{className:"inline-flex items-center justify-center min-w-5 px-1 py-0.5 rounded border border-border bg-surface-sunk text-xs font-medium not-italic",children:"↑↓"}),n?.navigate||"to navigate"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("kbd",{className:"inline-flex items-center justify-center min-w-5 px-1 py-0.5 rounded border border-border bg-surface-sunk text-xs font-medium not-italic",children:"↵"}),n?.select||"to select"]}),e.jsxs("span",{className:"flex items-center gap-1.5",children:[e.jsx("kbd",{className:"inline-flex items-center justify-center min-w-5 px-1 py-0.5 rounded border border-border bg-surface-sunk text-xs font-medium not-italic",children:"Esc"}),n?.close||"to close"]})]})]})}):null},Sr={none:"p-0",xs:"p-1",sm:"p-2",md:"p-4",lg:"p-6",xl:"p-8","2xl":"p-12"},Er={none:"m-0",xs:"m-1",sm:"m-2",md:"m-4",lg:"m-6",xl:"m-8","2xl":"m-12"},Tr={none:"",primary:"bg-accent text-accent-fg",secondary:"bg-surface-hover",accent:"bg-accent-soft",success:"bg-success-soft",warning:"bg-warning-soft",error:"bg-danger-soft",info:"bg-info-soft",neutral:"bg-surface-hover",white:"bg-surface",module:"bg-surface","module-subtle":"bg-surface-sunk",backdrop:"bg-page",editor:"bg-surface",input:"bg-surface-input"},zr={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl",full:"rounded-full"},Mr={none:"shadow-none",sm:"shadow-none",md:"shadow-overlay",lg:"shadow-overlay",xl:"shadow-modal","2xl":"shadow-modal"},Dr={none:"border-0",sm:"border",md:"border-2",lg:"border-4"},_r={primary:"border-accent-border",secondary:"border-border",accent:"border-accent-border",success:"border-success-border",warning:"border-warning-border",error:"border-danger-border",info:"border-info-border",neutral:"border-border-subtle",white:"border-border-subtle"},$e=u.forwardRef(({padding:t,margin:s,background:r,radius:n,shadow:a,border:l,borderColor:o,className:f,children:i,...p},m)=>e.jsx("div",{ref:m,className:c(t&&Sr[t],s&&Er[s],r&&Tr[r],n&&zr[n],a&&Mr[a],l&&Dr[l],o&&_r[o],f),...p,children:i}));$e.displayName="Box";const Ar=({children:t,title:s,...r})=>e.jsxs($e,{background:"module",radius:"lg",shadow:"none",border:"sm",borderColor:"neutral",...r,children:[s&&e.jsx("span",{className:"mb-2 block text-sm font-semibold text-text",children:s}),t]});function $r({identifier:t,resourceLoader:s,framework:r="react",fallback:n,errorFallback:a,componentProps:l,className:o}){const f=u.useRef(null),[i,p]=u.useState(!0),[m,d]=u.useState(!1),[b,v]=u.useState(null),y=u.useRef(null);u.useRef(null);const g=u.useRef(s);return g.current=s,u.useEffect(()=>{let h=!0;return(async()=>{p(!0),d(!1),v(null);try{const k=await g.current();if(!h)return;const V=k.component||k.default||k;v(r==="react"?()=>V:()=>k)}catch(k){console.error(`[FederatedResource] Load failed: ${t}`,k),h&&d(!0)}finally{h&&p(!1)}})(),()=>{h=!1}},[t,r]),u.useEffect(()=>{if(i||!b||r==="react")return;const h=f.current;if(h){if(r==="svelte"){const z=b.default||b,k=new z({target:h,props:l||{}});return y.current=k,()=>k.$destroy()}if(b.mount){const z=b.mount({container:h,props:l||{}});return()=>{typeof z=="function"?z():b.unmount?.(h)}}}},[b,r,i]),u.useEffect(()=>{r==="svelte"&&y.current&&y.current.$set?.(l)},[l,r]),e.jsxs("div",{ref:f,className:o,style:{display:"contents"},children:[i&&n,!i&&m&&a,r==="react"&&!m&&b&&e.jsx(b,{...l})]})}class Lr extends u.Component{constructor(){super(...arguments),this.state={hasError:!1,error:null}}static getDerivedStateFromError(s){return{hasError:!0,error:s}}componentDidCatch(s,r){console.error(`[ErrorBoundary] Error in ${this.props.name||"Component"}:`,s,r)}render(){return this.state.hasError?this.props.fallback?this.props.fallback:e.jsxs("div",{className:"p-4 m-4 border border-danger-border bg-danger-soft rounded-lg",children:[e.jsx("h2",{className:"text-lg font-semibold text-danger-fg",children:"Something went wrong"}),e.jsx("p",{className:"text-sm text-danger-fg mt-1",children:this.props.name?`Error in ${this.props.name}`:"The component failed to render."}),e.jsx("button",{className:"mt-4 px-4 py-2 bg-danger text-on-error rounded hover:opacity-90 transition-opacity text-sm",onClick:()=>this.setState({hasError:!1,error:null}),children:"Try again"})]}):this.props.children}}exports.AssistantCard=Is;exports.Avatar=Qe;exports.AvatarStack=qs;exports.Badge=Ze;exports.Box=$e;exports.Button=se;exports.ButtonGroup=Ct;exports.Card=Ar;exports.ChannelBadge=Us;exports.Checkbox=fe;exports.CommandPalette=Cr;exports.ConfirmDialog=vs;exports.ContentLoading=we;exports.DatePicker=ye;exports.Dropdown=Ge;exports.EmptyState=Ss;exports.ErrorBoundary=Lr;exports.FederatedResource=$r;exports.FilterChip=Oe;exports.FolderSelect=Ue;exports.Form=ps;exports.FormSection=Xe;exports.Heading=wr;exports.IDENTITY_TONE_COUNT=Fe;exports.Icon=G;exports.Image=Ks;exports.Kbd=Es;exports.KpiCard=Xs;exports.Link=Lt;exports.List=Gs;exports.ListBulkAction=Ws;exports.MeetingGrid=vt;exports.MessageBubble=Ys;exports.Modal=Ae;exports.Page=Qs;exports.PageHeader=et;exports.PageToolbar=Xt;exports.PageToolbarActions=ge;exports.ParticipantTile=jt;exports.Popover=Me;exports.ProgressBar=Ms;exports.RichText=rr;exports.SearchField=_e;exports.SearchableTextField=Ke;exports.SectionCaption=nr;exports.SectionDivider=ar;exports.SegmentedToggle=Be;exports.Select=be;exports.SettingsFrameProvider=lr;exports.SettingsPage=ir;exports.SettingsRow=dr;exports.SettingsSection=ur;exports.SidebarMenu=pr;exports.SourceChip=xr;exports.Spinner=$s;exports.SplitButton=De;exports.StatusDot=Ps;exports.StepIndicator=Rs;exports.StorageInput=Je;exports.Switch=We;exports.TabBar=ls;exports.Table=Se;exports.Tabs=Ye;exports.Text=de;exports.TextArea=Ne;exports.TextField=he;exports.VideoSurface=yt;exports.View=br;exports.autofillProps=Ee;exports.badgeColumn=rt;exports.booleanBadgeColumn=fr;exports.catTone=pt;exports.cn=c;exports.createSizes=ft;exports.createVariants=xt;exports.dateFilterHandler=Zt;exports.identityDotClass=gt;exports.identityPlateClass=ze;exports.identityTone=Te;exports.labelsColumn=mr;exports.resolveLucideIcon=St;exports.selectFilterHandler=Qt;exports.useAnchoredPosition=pe;exports.useSettingsFrame=st;exports.useSettingsFrameHost=or;
|
|
3
3
|
//# sourceMappingURL=index.cjs.map
|