@synertech/ui 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js ADDED
@@ -0,0 +1,31 @@
1
+ import*as ra from'react';import ra__default,{createContext,forwardRef,useId,useState,useRef,useEffect,useCallback,useImperativeHandle,memo,useMemo,useContext,cloneElement,isValidElement,useLayoutEffect}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';import {createPortal}from'react-dom';import {createRoot}from'react-dom/client';import xg from'dompurify';import vg from'react-markdown';import wg from'remark-gfm';function s(...e){return e.filter(Boolean).join(" ")}var ms=createContext(null),bs=createContext(null);function Zn(){let e=useContext(ms);if(!e)throw new Error("Accordion sub-components must be used within <Accordion>");return e}function hs(){let e=useContext(bs);if(!e)throw new Error("AccordionTrigger/AccordionContent must be used within <AccordionItem>");return e}var ys={sm:{trigger:"px-3 py-2",content:"px-3 pb-2",text:"text-sm",icon:"w-3.5 h-3.5"},md:{trigger:"px-4 py-3",content:"px-4 pb-3",text:"text-base",icon:"w-4 h-4"},lg:{trigger:"px-5 py-4",content:"px-5 pb-4",text:"text-lg",icon:"w-5 h-5"}},Vd=({className:e})=>jsx("svg",{className:e,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),_d={default:"border border-gray-200 dark:border-gray-700 rounded-lg divide-y divide-gray-200 dark:divide-gray-700",bordered:"border-2 border-gray-300 dark:border-gray-600 rounded-lg divide-y divide-gray-300 dark:divide-gray-600",separated:"space-y-2",ghost:""},$d={default:"",bordered:"",separated:"border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",ghost:"border-b border-gray-200 dark:border-gray-700 last:border-b-0"};function Ud({type:e="single",value:t,defaultValue:r,onValueChange:o,collapsible:n=false,variant:a="default",size:i="md",disabled:c=false,iconPosition:d="right",icon:l,hideIcon:p=false,className:u,children:m}){let[g,f]=useState(()=>r?Array.isArray(r)?r:[r]:[]),h=t!==void 0,b=h?Array.isArray(t)?t:[t]:g,x=useCallback(k=>{let R;e==="single"?b.includes(k)?R=n?[]:[k]:R=[k]:R=b.includes(k)?b.filter(S=>S!==k):[...b,k],h||f(R),o?.(e==="single"?R[0]??"":R);},[e,b,n,h,o]),v=useMemo(()=>({openItems:b,toggle:x,variant:a,size:i,disabled:c,iconPosition:d,icon:l??null,hideIcon:p}),[b,x,a,i,c,d,l,p]);return jsx(ms.Provider,{value:v,children:jsx("div",{className:s(_d[a],u),"data-testid":"accordion",children:m})})}function Gd({value:e,disabled:t,className:r,children:o}){let n=Zn(),a=n.openItems.includes(e),i=t??n.disabled,c=useId(),d=`accordion-trigger-${c}`,l=`accordion-content-${c}`,p=useMemo(()=>({value:e,isOpen:a,disabled:i,triggerId:d,contentId:l}),[e,a,i,d,l]);return jsx(bs.Provider,{value:p,children:jsx("div",{className:s($d[n.variant],r),"data-state":a?"open":"closed","data-testid":"accordion-item",children:o})})}function Kd({className:e,icon:t,children:r}){let o=Zn(),n=hs(),a=ys[o.size],i=()=>{n.disabled||o.toggle(n.value);},c=p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),i());},d=t??o.icon??jsx(Vd,{className:a.icon}),l=!o.hideIcon&&jsx("span",{className:s("shrink-0 text-gray-500 dark:text-gray-400 transition-transform duration-200",n.isOpen&&"rotate-180"),"data-testid":"accordion-icon",children:d});return jsxs("button",{type:"button",id:n.triggerId,"aria-expanded":n.isOpen,"aria-controls":n.contentId,disabled:n.disabled,onClick:i,onKeyDown:c,className:s("flex items-center w-full text-left font-medium transition-colors cursor-pointer",a.trigger,a.text,"text-gray-900 dark:text-gray-100",!n.disabled&&"hover:bg-gray-50 dark:hover:bg-gray-800/50",n.disabled&&"opacity-50 cursor-not-allowed",e),"data-testid":"accordion-trigger",children:[o.iconPosition==="left"&&l,jsx("span",{className:"flex-1",children:r}),o.iconPosition==="right"&&l]})}function Yd({className:e,children:t}){let r=Zn(),o=hs(),n=ys[r.size],a=useRef(null),[i,c]=useState(o.isOpen?void 0:0),d=useRef(true);return useEffect(()=>{if(d.current){d.current=false,c(o.isOpen?void 0:0);return}if(o.isOpen){let l=a.current;if(l){c(l.scrollHeight);let p=setTimeout(()=>c(void 0),200);return ()=>clearTimeout(p)}}else {let l=a.current;l&&(c(l.scrollHeight),requestAnimationFrame(()=>c(0)));}},[o.isOpen]),jsx("div",{id:o.contentId,role:"region","aria-labelledby":o.triggerId,className:"overflow-hidden transition-[height] duration-200 ease-in-out",style:{height:i===void 0?"auto":i},"data-testid":"accordion-content","data-state":o.isOpen?"open":"closed",children:jsx("div",{ref:a,className:s(n.content,"text-gray-600 dark:text-gray-400",n.text==="text-lg"?"text-base":"text-sm",e),children:t})})}function Zd(...e){return e.filter(Boolean).join(" ")}var Qd="@synertech/ui/AdvanceDetachable",ec=300,tc="width=800,height=600,menubar=no,toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes",rc=0;function oc(){return `${Date.now()}-${++rc}-${Math.random().toString(36).slice(2,8)}`}function xs(e){try{return JSON.stringify(e)}catch{return String(e)}}function vs(e){try{return JSON.parse(e)}catch{return e}}function nc(e,t){e.querySelectorAll("style").forEach(r=>{let o=t.createElement("style");o.textContent=r.textContent,t.head.appendChild(o);}),e.querySelectorAll('link[rel="stylesheet"]').forEach(r=>{let o=r,n=t.createElement("link");n.rel="stylesheet",n.href=o.href,o.crossOrigin&&(n.crossOrigin=o.crossOrigin),t.head.appendChild(n);}),e.documentElement.className&&(t.documentElement.className=e.documentElement.className),e.body.className&&(t.body.className=e.body.className);}function ac(e,t){let r=new MutationObserver(o=>{for(let n of o)for(let a of Array.from(n.addedNodes))if(a instanceof HTMLStyleElement){let i=t.createElement("style");i.textContent=a.textContent,t.head.appendChild(i);}else if(a instanceof HTMLLinkElement&&a.rel==="stylesheet"){let i=t.createElement("link");i.rel="stylesheet",i.href=a.href,t.head.appendChild(i);}});return r.observe(e.head,{childList:true}),r}function sc(){return typeof BroadcastChannel<"u"}function ic({mode:e,id:t,title:r="",children:o,value:n,defaultValue:a,onValueChange:i,isDetached:c,defaultDetached:d=false,onDetachedChange:l,features:p,target:u,autoFocus:m=true,className:g,detachedBodyClassName:f,disabled:h=false,readOnly:b=false,closeOnMainWindowUnload:x=true,name:v,serialize:k,deserialize:R},S){let E=c!==void 0,[z,N]=useState(d),L=E?c:z,A=n!==void 0,[G,q]=useState(a),M=A?n:G,[O,P]=useState(null),y=useRef(null),T=useRef(null),I=useRef(null),oe=useRef(null),ie=useRef(false),we=useRef(null),he=useRef(null),F=useRef(null),[Q]=useState(()=>`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`),ae=useRef({title:r,features:p,target:u,autoFocus:m,detachedBodyClassName:f,closeOnMainWindowUnload:x,disabled:h,readOnly:b,mode:e,id:t});ae.current={title:r,features:p,target:u,autoFocus:m,detachedBodyClassName:f,closeOnMainWindowUnload:x,disabled:h,readOnly:b,mode:e,id:t};let ye=useRef(k??xs);ye.current=k??xs;let xe=useRef(R??vs);xe.current=R??vs;let le=useRef(i);le.current=i;let X=useRef(l);X.current=l;let C=useRef(L);C.current=L;let $=`${Qd}/${t}`,ge=useCallback(()=>{I.current&&(clearInterval(I.current),I.current=null),oe.current&&(oe.current.disconnect(),oe.current=null),P(null);},[]),te=useCallback(()=>{T.current&&(T.current.close(),T.current=null),we.current&&typeof window<"u"&&(window.removeEventListener("message",we.current),we.current=null);},[]),B=useCallback(Ee=>{if(!(!Ee||Ee.channel!==$)&&Ee.instanceId!==Q&&!ae.current.readOnly&&Ee.type==="value-sync"&&Ee.payload!==void 0){he.current=Ee.payload;let We=xe.current(Ee.payload);A||q(We),le.current?.(We);}},[$,Q,A]),ee=useCallback(()=>{if(te(),!(typeof window>"u"))if(sc()){let Ee=new BroadcastChannel($),We=ht=>B(ht.data);Ee.addEventListener("message",We),T.current=Ee;}else {let Ee=We=>{We.data?.channel===$&&B(We.data);};window.addEventListener("message",Ee),we.current=Ee;}},[$,te,B]),me=useCallback(Ee=>{if(ae.current.readOnly)return;let We=ye.current(Ee);if(We===F.current)return;if(We===he.current){he.current=null;return}F.current=We;let ht={channel:$,instanceId:Q,messageId:oc(),origin:"main",timestamp:Date.now(),type:"value-sync",payload:We};T.current?T.current.postMessage(ht):y.current&&!y.current.closed&&y.current.postMessage(ht,"*");},[$,Q]),Se=useCallback(()=>{if(typeof window>"u"||ae.current.disabled||ie.current||y.current&&!y.current.closed)return;ie.current=true;let Ee=ae.current,We=window.open("",Ee.target||"",Ee.features||tc);if(!We){ie.current=false;return}y.current=We,We.document.title=Ee.title||document.title,Ee.detachedBodyClassName&&(We.document.body.className=Ee.detachedBodyClassName);let ht=We.document.createElement("div");We.document.body.appendChild(ht),P(ht),nc(document,We.document),oe.current=ac(document,We.document),I.current=setInterval(()=>{We.closed&&(ge(),y.current=null,E||N(false),X.current?.(false));},ec),Ee.autoFocus&&We.focus(),ie.current=false;},[E,ge]),j=useCallback(()=>{y.current&&!y.current.closed&&y.current.close(),y.current=null,ge();},[ge]),Te=useRef(Se);Te.current=Se;let Pe=useRef(j);Pe.current=j;let et=useRef(me);et.current=me;let at=useCallback(()=>{ae.current.disabled||(E||N(true),X.current?.(true));},[E]),pt=useCallback(()=>{E||N(false),X.current?.(false);},[E]),J=useCallback(()=>{let Ee=!C.current;Ee&&ae.current.disabled||(E||N(Ee),X.current?.(Ee));},[E]);useImperativeHandle(S,()=>({open:at,close:pt,toggle:J,get isDetached(){return C.current},get window(){return y.current}}),[at,pt,J]),useEffect(()=>(ee(),()=>te()),[ee,te]),useEffect(()=>{if(L)return Te.current(),()=>Pe.current();Pe.current();},[L]),useEffect(()=>{M!==void 0&&et.current(M);},[M]),useEffect(()=>{y.current&&!y.current.closed&&r&&(y.current.document.title=r);},[r]),useEffect(()=>{if(typeof window>"u")return;let Ee=()=>{ae.current.closeOnMainWindowUnload&&y.current&&!y.current.closed&&y.current.close();};return window.addEventListener("beforeunload",Ee),()=>{window.removeEventListener("beforeunload",Ee),y.current&&!y.current.closed&&y.current.close(),y.current=null;}},[]);let fe=typeof o=="function"?o({open:at,close:pt,toggle:J,detached:L,windowRef:y.current}):o,Ke=e==="clone"||!L,xt=L&&O!==null;return jsxs(Fragment,{children:[v&&M!==void 0&&jsx("input",{type:"hidden",name:v,value:ye.current(M)}),Ke&&jsx("div",{className:Zd(g),children:fe}),xt&&createPortal(fe,O)]})}var ks=forwardRef(ic);ks.displayName="AdvanceDetachable";var cc={xs:"h-6 w-6 text-xs",sm:"h-8 w-8 text-sm",md:"h-10 w-10 text-base",lg:"h-12 w-12 text-lg",xl:"h-16 w-16 text-xl"},uc={circle:"rounded-full",square:"rounded-none",rounded:"rounded-md"};function pc({src:e,alt:t="Avatar",fallback:r,size:o="md",variant:n="circle",border:a=false,className:i,...c}){return jsx("div",{className:s("inline-flex items-center justify-center overflow-hidden bg-gray-200 font-medium text-gray-600 dark:bg-gray-700 dark:text-gray-300",cc[o],uc[n],a&&"ring-2 ring-white dark:ring-gray-900",i),...c,children:e?jsx("img",{src:e,alt:t,className:"h-full w-full object-cover"}):jsx("span",{children:r||t.charAt(0).toUpperCase()})})}var gc={default:{solid:"bg-gray-500 text-white",soft:"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300",outlined:"border border-gray-300 text-gray-600 dark:border-gray-600 dark:text-gray-400",subtle:"bg-gray-50 text-gray-600 dark:bg-gray-800 dark:text-gray-400"},primary:{solid:"bg-blue-600 text-white",soft:"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300",outlined:"border border-blue-500 text-blue-600 dark:border-blue-400 dark:text-blue-400",subtle:"bg-blue-50 text-blue-600 dark:bg-blue-900/30 dark:text-blue-400"},success:{solid:"bg-green-600 text-white",soft:"bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300",outlined:"border border-green-500 text-green-600 dark:border-green-400 dark:text-green-400",subtle:"bg-green-50 text-green-600 dark:bg-green-900/30 dark:text-green-400"},warning:{solid:"bg-yellow-500 text-white",soft:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/50 dark:text-yellow-300",outlined:"border border-yellow-400 text-yellow-600 dark:border-yellow-400 dark:text-yellow-400",subtle:"bg-yellow-50 text-yellow-600 dark:bg-yellow-900/30 dark:text-yellow-400"},error:{solid:"bg-red-600 text-white",soft:"bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300",outlined:"border border-red-500 text-red-600 dark:border-red-400 dark:text-red-400",subtle:"bg-red-50 text-red-600 dark:bg-red-900/30 dark:text-red-400"},info:{solid:"bg-cyan-600 text-white",soft:"bg-cyan-100 text-cyan-700 dark:bg-cyan-900/50 dark:text-cyan-300",outlined:"border border-cyan-500 text-cyan-600 dark:border-cyan-400 dark:text-cyan-400",subtle:"bg-cyan-50 text-cyan-600 dark:bg-cyan-900/30 dark:text-cyan-400"},purple:{solid:"bg-purple-600 text-white",soft:"bg-purple-100 text-purple-700 dark:bg-purple-900/50 dark:text-purple-300",outlined:"border border-purple-500 text-purple-600 dark:border-purple-400 dark:text-purple-400",subtle:"bg-purple-50 text-purple-600 dark:bg-purple-900/30 dark:text-purple-400"},indigo:{solid:"bg-indigo-600 text-white",soft:"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",outlined:"border border-indigo-500 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400",subtle:"bg-indigo-50 text-indigo-600 dark:bg-indigo-900/30 dark:text-indigo-400"},teal:{solid:"bg-teal-600 text-white",soft:"bg-teal-100 text-teal-700 dark:bg-teal-900/50 dark:text-teal-300",outlined:"border border-teal-500 text-teal-600 dark:border-teal-400 dark:text-teal-400",subtle:"bg-teal-50 text-teal-600 dark:bg-teal-900/30 dark:text-teal-400"}},fc={default:"bg-gray-500",primary:"bg-blue-500",success:"bg-green-500",warning:"bg-yellow-400",error:"bg-red-500",info:"bg-cyan-500",purple:"bg-purple-500",indigo:"bg-indigo-500",teal:"bg-teal-500"},mc={sm:"text-[10px] px-1.5 py-0.5 gap-1",md:"text-xs px-2 py-0.5 gap-1",lg:"text-sm px-2.5 py-1 gap-1.5"},bc={sm:"w-1.5 h-1.5",md:"w-1.5 h-1.5",lg:"w-2 h-2"},hc={sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5"};function Ns({children:e,color:t="default",size:r="md",variant:o="soft",dot:n=false,icon:a,pill:i=true,className:c,...d}){return jsxs("span",{className:s("inline-flex items-center font-medium",mc[r],i?"rounded-full":"rounded",gc[t][o],c),...d,children:[n&&jsx("span",{className:s("shrink-0 rounded-full",bc[r],fc[t]),"aria-hidden":"true"}),a&&!n&&jsx("span",{className:s("shrink-0",hc[r]),"aria-hidden":"true",children:a}),e]})}Ns.displayName="Badge";function Ss({className:e}){return jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsx("path",{d:"M13 16H12V12H11M12 8H12.01M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function xc({className:e}){return jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsx("path",{d:"M9 12L11 14L15 10M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function vc({className:e}){return jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsx("path",{d:"M12 9V13M12 17H12.01M10.29 3.86L1.82 18C1.65 18.3 1.55 18.65 1.55 18.99C1.55 19.34 1.64 19.69 1.81 19.99C1.99 20.29 2.24 20.55 2.54 20.72C2.84 20.901 3.18 20.99 3.53 21H20.47C20.82 20.99 21.16 20.901 21.46 20.72C21.76 20.55 22.01 20.29 22.19 19.99C22.36 19.69 22.449 19.34 22.448 18.99C22.447 18.65 22.35 18.3 22.18 18L13.71 3.86C13.53 3.57 13.28 3.32 12.98 3.15C12.68 2.99 12.34 2.9 12 2.9C11.66 2.9 11.32 2.99 11.02 3.15C10.72 3.32 10.47 3.57 10.29 3.86Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function wc({className:e}){return jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsx("path",{d:"M12 8V12M12 16H12.01M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function ta({className:e}){return jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var kc={info:Ss,success:xc,warning:vc,error:wc,default:Ss},Cc={info:"bg-blue-50 text-blue-800 border-blue-200 dark:bg-blue-900/20 dark:text-blue-300 dark:border-blue-800",success:"bg-green-50 text-green-800 border-green-200 dark:bg-green-900/20 dark:text-green-300 dark:border-green-800",warning:"bg-yellow-50 text-yellow-800 border-yellow-200 dark:bg-yellow-900/20 dark:text-yellow-300 dark:border-yellow-800",error:"bg-red-50 text-red-800 border-red-200 dark:bg-red-900/20 dark:text-red-300 dark:border-red-800",default:"bg-gray-50 text-gray-800 border-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700"},Nc={info:"text-blue-600 dark:text-blue-400",success:"text-green-600 dark:text-green-400",warning:"text-yellow-600 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",default:"text-gray-600 dark:text-gray-400"};function Sc({type:e="default",title:t,description:r,children:o,icon:n,action:a,closable:i=false,onClose:c,fullWidth:d=false,className:l,...p}){let[u,m]=useState(true);if(!u)return null;let g=()=>{m(false),c?.();},f=kc[e],h=o??r;return jsxs("div",{role:"alert",className:s("flex items-start gap-3 border px-4 py-3",d?"w-full":"rounded-lg",Cc[e],l),...p,children:[jsx("div",{className:s("shrink-0 mt-0.5",Nc[e]),children:n??jsx(f,{className:"w-5 h-5"})}),jsxs("div",{className:"flex-1 min-w-0",children:[t&&jsx("div",{className:"font-semibold text-sm",children:t}),h&&jsx("div",{className:s("text-sm",t?"mt-1 opacity-90":false),children:h}),a&&jsx("div",{className:"mt-3",children:a})]}),i&&jsx("button",{type:"button",onClick:g,className:s("shrink-0 rounded-md p-1 transition-colors","hover:bg-black/10 dark:hover:bg-white/10","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-current"),"aria-label":"Close banner",children:jsx(ta,{className:"w-4 h-4"})})]})}function Rc({title:e,description:t,children:r,action:o,backgroundImage:n,closable:a=false,onClose:i,fullWidth:c=false,className:d,...l}){let[p,u]=useState(true);if(!p)return null;let m=()=>{u(false),i?.();},g=r??t;return jsxs("div",{className:s("relative overflow-hidden bg-gray-900 text-white",c?"w-full":"rounded-xl","py-12 px-6 sm:px-12",d),style:n?{backgroundImage:`url(${n})`,backgroundSize:"cover",backgroundPosition:"center"}:void 0,...l,children:[n&&jsx("div",{className:"absolute inset-0 bg-black/50","aria-hidden":"true"}),jsxs("div",{className:"relative z-10 max-w-3xl mx-auto text-center",children:[e&&jsx("h2",{className:"text-2xl sm:text-3xl lg:text-4xl font-bold tracking-tight",children:e}),g&&jsx("div",{className:s("text-base sm:text-lg opacity-90",e?"mt-4":false),children:g}),o&&jsx("div",{className:"mt-6",children:o})]}),a&&jsx("button",{type:"button",onClick:m,className:s("absolute top-4 right-4 z-10 rounded-md p-1.5 text-white/80 transition-colors","hover:text-white hover:bg-white/10","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-white"),"aria-label":"Close banner",children:jsx(ta,{className:"w-5 h-5"})})]})}function Tc({title:e,description:t,children:r,icon:o,action:n,badge:a,closable:i=false,onClose:c,fullWidth:d=false,className:l,...p}){let[u,m]=useState(true);if(!u)return null;let g=()=>{m(false),c?.();},f=r??t;return jsxs("div",{className:s("relative flex items-center gap-4 bg-linear-to-r from-indigo-600 to-purple-600 text-white px-4 py-3",d?"w-full":"rounded-lg",l),...p,children:[o&&jsx("div",{className:"shrink-0",children:o}),a&&jsx("span",{className:"shrink-0 inline-flex items-center rounded-full bg-white/20 px-2.5 py-0.5 text-xs font-semibold uppercase tracking-wide",children:a}),jsxs("div",{className:"flex-1 min-w-0 flex flex-wrap items-center gap-x-4 gap-y-1",children:[e&&jsx("span",{className:"font-semibold text-sm",children:e}),f&&jsx("span",{className:"text-sm opacity-90",children:f})]}),n&&jsx("div",{className:"shrink-0",children:n}),i&&jsx("button",{type:"button",onClick:g,className:s("shrink-0 rounded-md p-1 text-white/80 transition-colors","hover:text-white hover:bg-white/10","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-white"),"aria-label":"Close banner",children:jsx(ta,{className:"w-4 h-4"})})]})}function Rs({variant:e="notification",...t}){switch(e){case "hero":return jsx(Rc,{...t});case "promotion":return jsx(Tc,{...t});default:return jsx(Sc,{...t})}}Rs.displayName="Banner";var Ec={sm:"text-xs",md:"text-sm",lg:"text-base"};function Dc({items:e,separator:t="/",size:r="md",maxItems:o,itemColor:n="text-gray-500 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-100",activeColor:a="text-gray-700 font-medium dark:text-gray-200",separatorColor:i="text-gray-400 dark:text-gray-500",className:c,...d}){let l=e,p=false;if(o&&e.length>o){p=true;let u=e[0],m=e.slice(-(o-1));l=[u,...m];}return jsx("nav",{"aria-label":"Breadcrumb",className:s("inline-flex items-center",Ec[r],c),...d,children:jsx("ol",{className:"inline-flex items-center space-x-1 md:space-x-2",children:l.map((u,m)=>{let g=m===l.length-1;return jsxs("li",{className:"inline-flex items-center",children:[p&&m===1&&jsxs(Fragment,{children:[jsx("span",{className:s("mx-1 select-none",i),children:"..."}),jsx("span",{className:s("mx-1 select-none",i),"aria-hidden":"true",children:t})]}),u.href||u.onClick?jsxs("a",{href:u.href,onClick:u.onClick,className:s("inline-flex items-center gap-1.5 transition-colors",g?a:n),"aria-current":g?"page":void 0,children:[u.icon&&jsx("span",{className:"inline-flex","aria-hidden":"true",children:u.icon}),jsx("span",{children:u.label})]}):jsxs("span",{className:s("inline-flex items-center gap-1.5",g?a:n),"aria-current":g?"page":void 0,children:[u.icon&&jsx("span",{className:"inline-flex","aria-hidden":"true",children:u.icon}),jsx("span",{children:u.label})]}),!g&&jsx("span",{className:s("mx-2 select-none",i),"aria-hidden":"true",children:t})]},u.href??u.label)})})})}function Mc({className:e}){return jsxs("svg",{className:s("animate-spin",e),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),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"})]})}var Pc={sm:"px-3 py-1.5 text-xs gap-1.5",md:"px-4 py-2 text-sm gap-2",lg:"px-5 py-2.5 text-base gap-2",xl:"px-6 py-3 text-lg gap-2.5"},Lc={sm:"p-1.5",md:"p-2",lg:"p-2.5",xl:"p-3"},on={sm:"h-3.5 w-3.5",md:"h-4 w-4",lg:"h-5 w-5",xl:"h-6 w-6"},zc={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"rounded-full"};function lt({label:e,children:t,onClick:r,disabled:o=false,className:n,type:a="button",size:i="md",loading:c=false,leftIcon:d,rightIcon:l,icon:p,fullWidth:u=false,rounded:m="lg",bgColor:g="bg-blue-600 hover:bg-blue-700",textColor:f="text-white",focusColor:h="focus:ring-blue-300",selected:b=false,value:x,showFocusOnClick:v=false,...k}){let R=o||c,S=p!==void 0&&!t&&!e,E=s("inline-flex items-center justify-center font-medium transition-colors focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed",v?"focus:ring-4":"focus-visible:ring-4"),z=s(b?"bg-blue-700 text-white ring-2 ring-blue-500":g,!b&&f,h&&v&&`focus:ring-4 ${h}`,h&&!v&&`focus-visible:ring-4 ${h}`);return jsx("button",{type:a,onClick:r,disabled:R,"data-value":x,className:s(E,S?Lc[i]:Pc[i],zc[m],z,u&&"w-full",n),...k,children:c?jsx(Mc,{className:on[i]}):S?jsx("span",{className:on[i],children:p}):jsxs(Fragment,{children:[d&&jsx("span",{className:on[i],children:d}),t??e,l&&jsx("span",{className:on[i],children:l})]})})}function ro({children:e,orientation:t="horizontal",size:r,fullWidth:o=false,selectedValue:n,onChange:a,className:i}){let d=ra__default.Children.toArray(e).filter(p=>ra__default.isValidElement(p)&&typeof p.type!="string"),l=(p,u)=>m=>{p!==void 0&&a&&a(p),u&&u(m);};return jsx("div",{className:s("inline-flex",t==="horizontal"?"flex-row":"flex-col",o&&"w-full",i),role:"group",children:d.map((p,u)=>{let m=u===0,g=u===d.length-1,f=!m&&!g,h=p.props.value,b=n!==void 0&&h===n,x=s(t==="horizontal"&&m&&"rounded-r-none",t==="horizontal"&&g&&"rounded-l-none",t==="horizontal"&&f&&"rounded-none",t==="horizontal"&&!m&&"-ml-px",t==="vertical"&&m&&"rounded-b-none",t==="vertical"&&g&&"rounded-t-none",t==="vertical"&&f&&"rounded-none",t==="vertical"&&!m&&"-mt-px",o&&"flex-1");return ra__default.cloneElement(p,{...p.props,size:r??p.props.size,selected:b||p.props.selected,onClick:l(h,p.props.onClick),className:s(x,p.props.className)})})})}var Hc=10080*60*1e3;function ft(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function Vr(e){return new Date(e.getFullYear(),e.getMonth(),1)}function mr(e,t){return new Date(e.getFullYear(),e.getMonth(),e.getDate()+t)}function Ut(e,t){return new Date(e.getFullYear(),e.getMonth()+t,1)}function na(e){return new Date(e.getFullYear(),e.getMonth()+1,0).getDate()}function rr(e,t){return !e||!t?false:e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function oa(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()}function Tr(e,t){return e.getFullYear()*12+e.getMonth()-(t.getFullYear()*12+t.getMonth())}function an(e){let t=`${e.getMonth()+1}`.padStart(2,"0"),r=`${e.getDate()}`.padStart(2,"0");return `${e.getFullYear()}-${t}-${r}`}function Bc(e){let t=ft(e);t.setDate(t.getDate()-(t.getDay()+6)%7+3);let r=new Date(t.getFullYear(),0,4);return r.setDate(r.getDate()-(r.getDay()+6)%7+3),1+Math.round((t.getTime()-r.getTime())/Hc)}function Ds(e,t,r){return t&&e<ft(t)?ft(t):r&&e>ft(r)?ft(r):e}function Oc(e,t,r){let o=Vr(e),n=(o.getDay()-t+7)%7,a=mr(o,-n),i=r?6:Math.ceil((n+na(e))/7);return Array.from({length:i},(c,d)=>Array.from({length:7},(l,p)=>mr(a,d*7+p)))}function Vc({className:e}){return jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function _c({className:e}){return jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}var $c={sm:{day:"h-7 w-7 text-xs",head:"h-7 w-7 text-[10px]",caption:"text-xs",nav:"h-6 w-6",icon:"h-3 w-3",padding:"p-2",gap:"gap-3",footer:"text-xs",select:"text-xs py-0.5 pl-1 pr-5"},md:{day:"h-9 w-9 text-sm",head:"h-9 w-9 text-xs",caption:"text-sm",nav:"h-7 w-7",icon:"h-4 w-4",padding:"p-3",gap:"gap-4",footer:"text-sm",select:"text-sm py-1 pl-1.5 pr-6"},lg:{day:"h-11 w-11 text-base",head:"h-11 w-11 text-sm",caption:"text-base",nav:"h-9 w-9",icon:"h-5 w-5",padding:"p-4",gap:"gap-5",footer:"text-sm",select:"text-base py-1.5 pl-2 pr-7"}},Uc={primary:"bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",success:"bg-green-600 text-white hover:bg-green-700 dark:bg-green-500 dark:hover:bg-green-600",warning:"bg-yellow-500 text-white hover:bg-yellow-600 dark:bg-yellow-400 dark:text-gray-900 dark:hover:bg-yellow-500",error:"bg-red-600 text-white hover:bg-red-700 dark:bg-red-500 dark:hover:bg-red-600",info:"bg-cyan-600 text-white hover:bg-cyan-700 dark:bg-cyan-500 dark:hover:bg-cyan-600",neutral:"bg-gray-700 text-white hover:bg-gray-800 dark:bg-gray-500 dark:hover:bg-gray-400"},Gc={primary:"bg-blue-50 dark:bg-blue-900/30",success:"bg-green-50 dark:bg-green-900/30",warning:"bg-yellow-50 dark:bg-yellow-900/30",error:"bg-red-50 dark:bg-red-900/30",info:"bg-cyan-50 dark:bg-cyan-900/30",neutral:"bg-gray-100 dark:bg-gray-700/40"},Kc={primary:"text-blue-900 dark:text-blue-100",success:"text-green-900 dark:text-green-100",warning:"text-yellow-900 dark:text-yellow-100",error:"text-red-900 dark:text-red-100",info:"text-cyan-900 dark:text-cyan-100",neutral:"text-gray-900 dark:text-gray-100"},Yc={primary:"font-semibold text-blue-600 dark:text-blue-400",success:"font-semibold text-green-600 dark:text-green-400",warning:"font-semibold text-yellow-600 dark:text-yellow-400",error:"font-semibold text-red-600 dark:text-red-400",info:"font-semibold text-cyan-600 dark:text-cyan-400",neutral:"font-semibold text-gray-900 dark:text-gray-100"},Or={primary:"focus-visible:ring-blue-500",success:"focus-visible:ring-green-500",warning:"focus-visible:ring-yellow-500",error:"focus-visible:ring-red-500",info:"focus-visible:ring-cyan-500",neutral:"focus-visible:ring-gray-500"};function sn(e,t){if(e==="multiple")return Array.isArray(t)?t.map(ft):[];if(e==="range"){let r=t??null;return {from:r?.from?ft(r.from):null,to:r?.to?ft(r.to):null}}return t instanceof Date?ft(t):null}function Is(e){return e?e instanceof Date?e:Array.isArray(e)?e[0]??null:e.from??e.to??null:null}function Xc(e){let{mode:t="single",value:r,defaultValue:o,onChange:n,max:a,month:i,defaultMonth:c,onMonthChange:d,numberOfMonths:l=1,weekStartsOn:p=0,locale:u,size:m="md",color:g="primary",minDate:f,maxDate:h,disabledDates:b,disabled:x=false,showOutsideDays:v=true,showWeekNumbers:k=false,fixedWeeks:R=false,captionLayout:S="label",fromYear:E,toYear:z,todayButton:N=false,clearButton:L=false,footer:A,bordered:G=true,renderDay:q,labels:M,className:O,...P}=e,y=$c[m],T=Math.max(1,l),I=useMemo(()=>ft(new Date),[]),oe=r!==void 0,[ie,we]=useState(()=>sn(t,o)),he=oe?sn(t,r):ie,F=i!==void 0,[Q,ae]=useState(()=>Vr(c??Is(sn(t,o??r))??new Date)),ye=F?Vr(i):Q,xe=useCallback(de=>{let ue=Vr(de);F||ae(ue),d?.(ue);},[F,d]),le=useRef(null),X=useRef(false),[C,$]=useState(()=>{let de=Is(sn(t,o??r)),ue=Vr(c??i??de??new Date),H=de&&oa(de,ue)?de:oa(ft(new Date),ue)?ft(new Date):ue;return Ds(H,f,h)}),ge=Ut(ye,T-1),B=Tr(C,ye)>=0&&Tr(C,ge)<=0?C:ye;useEffect(()=>{if(!X.current)return;X.current=false,le.current?.querySelector(`[data-day="${an(C)}"]:not([data-outside])`)?.focus();},[C,ye]);let ee=useCallback(de=>{let ue=Ds(ft(de),f,h);X.current=true,$(ue);let H=Ut(ye,T-1);Tr(ue,ye)<0?xe(ue):Tr(ue,H)>0&&xe(Ut(ue,-(T-1)));},[ye,T,f,h,xe]),me=useCallback(de=>x||f&&de<ft(f)||h&&de>ft(h)?true:typeof b=="function"?b(de):Array.isArray(b)?b.some(ue=>rr(ue,de)):false,[x,f,h,b]),[Se,j]=useState(null),Te=useCallback(de=>{oe||we(de),n?.(de);},[oe,n]),Pe=useCallback(de=>{let ue=ft(de);if(me(ue))return;if(t==="multiple"){let V=he??[];if(V.some(ne=>rr(ne,ue))){Te(V.filter(ne=>!rr(ne,ue)));return}if(a!==void 0&&V.length>=a)return;Te([...V,ue].sort((ne,Ne)=>ne.getTime()-Ne.getTime()));return}if(t==="range"){let V=he??{from:null,to:null};if(!V.from||V.to){Te({from:ue,to:null});return}Te(ue<V.from?{from:ue,to:V.from}:{from:V.from,to:ue});return}Te(rr(he,ue)?null:ue);},[t,he,a,Te,me]),et=useCallback(de=>{Pe(de),$(ft(de)),Tr(de,ye)<0?xe(de):Tr(de,Ut(ye,T-1))>0&&xe(Ut(de,-(T-1)));},[Pe,ye,T,xe]),at=!x&&(!f||Tr(ye,Vr(f))>0),pt=!x&&(!h||Tr(Ut(ye,T-1),Vr(h))<0),J=useCallback(()=>{xe(Ut(ye,-1));},[ye,xe]),fe=useCallback(()=>{xe(Ut(ye,1));},[ye,xe]),Ke=useCallback(de=>{if(x)return;let ue=C;switch(de.key){case "ArrowLeft":de.preventDefault(),ee(mr(ue,-1));break;case "ArrowRight":de.preventDefault(),ee(mr(ue,1));break;case "ArrowUp":de.preventDefault(),ee(mr(ue,-7));break;case "ArrowDown":de.preventDefault(),ee(mr(ue,7));break;case "Home":de.preventDefault(),ee(mr(ue,-((ue.getDay()-p+7)%7)));break;case "End":de.preventDefault(),ee(mr(ue,6-(ue.getDay()-p+7)%7));break;case "PageUp":{de.preventDefault();let H=de.shiftKey?-12:-1,V=Ut(ue,H),se=Math.min(ue.getDate(),na(V));ee(new Date(V.getFullYear(),V.getMonth(),se));break}case "PageDown":{de.preventDefault();let H=de.shiftKey?12:1,V=Ut(ue,H),se=Math.min(ue.getDate(),na(V));ee(new Date(V.getFullYear(),V.getMonth(),se));break}}},[x,C,ee,p]),xt=useMemo(()=>{let de=new Intl.DateTimeFormat(u,{weekday:"short"}),ue=new Intl.DateTimeFormat(u,{weekday:"long"}),H=new Date(2024,0,7);return Array.from({length:7},(V,se)=>{let ne=mr(H,(p+se)%7);return {short:de.format(ne),long:ue.format(ne)}})},[u,p]),Ee=useMemo(()=>{let de=new Intl.DateTimeFormat(u,{month:"long"});return Array.from({length:12},(ue,H)=>de.format(new Date(2024,H,1)))},[u]),We=useMemo(()=>new Intl.DateTimeFormat(u,{month:"long",year:"numeric"}),[u]),ht=useMemo(()=>new Intl.DateTimeFormat(u,{dateStyle:"full"}),[u]),ur=useMemo(()=>{if(S!=="dropdown")return [];let de=I.getFullYear(),ue=E??f?.getFullYear()??de-100,H=z??h?.getFullYear()??de+10;return H<ue?[ue]:Array.from({length:H-ue+1},(V,se)=>ue+se)},[S,E,z,f,h,I]),ct=t==="range"?he:null,Bt=ct&&ct.from&&!ct.to&&Se&&Se>ct.from?Se:null,Tt=ct?.to??Bt,Xt=useCallback((de,ue)=>{let H=!oa(de,ue),V=me(de),se=false,ne=false,Ne=false,be=false;return t==="multiple"?se=(he??[]).some(ke=>rr(ke,de)):t==="range"?(ne=rr(ct?.from,de),Ne=rr(Tt,de),se=ne||Ne,be=!!(ct?.from&&Tt&&de>ct.from&&de<Tt)):se=rr(he,de),{selected:se,today:rr(de,I),outside:H,disabled:V,rangeStart:ne,rangeEnd:Ne,inRange:be}},[t,he,ct,Tt,me,I]),Rr=de=>{let ue=Ut(ye,de),H=Oc(ue,p,R),V=de===0,se=de===T-1;return jsxs("div",{className:"flex flex-col",children:[jsxs("div",{className:"mb-2 flex items-center justify-between",children:[jsx("button",{type:"button",onClick:J,disabled:!at,"aria-label":M?.previousMonth??"Previous month",className:s("inline-flex items-center justify-center rounded-md transition-colors","text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-900",Or[g],y.nav,!at&&"cursor-not-allowed opacity-40 hover:bg-transparent dark:hover:bg-transparent",!V&&"invisible"),children:jsx(Vc,{className:y.icon})}),S==="dropdown"?jsxs("div",{className:"flex items-center gap-1",children:[jsx("select",{"aria-label":M?.monthSelect??"Month",value:ue.getMonth(),disabled:x,onChange:ne=>xe(new Date(ue.getFullYear(),Number(ne.target.value)-de,1)),className:s("rounded-md border border-gray-300 bg-white font-medium text-gray-900","dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100","focus:outline-none focus-visible:ring-2",Or[g],y.select,x&&"cursor-not-allowed opacity-50"),children:Ee.map((ne,Ne)=>jsx("option",{value:Ne,children:ne},ne))}),jsx("select",{"aria-label":M?.yearSelect??"Year",value:ue.getFullYear(),disabled:x,onChange:ne=>xe(new Date(Number(ne.target.value),ue.getMonth()-de,1)),className:s("rounded-md border border-gray-300 bg-white font-medium text-gray-900","dark:border-gray-600 dark:bg-gray-800 dark:text-gray-100","focus:outline-none focus-visible:ring-2",Or[g],y.select,x&&"cursor-not-allowed opacity-50"),children:ur.map(ne=>jsx("option",{value:ne,children:ne},ne))})]}):jsx("div",{"aria-live":"polite",className:s("font-semibold text-gray-900 dark:text-gray-100",y.caption),children:We.format(ue)}),jsx("button",{type:"button",onClick:fe,disabled:!pt,"aria-label":M?.nextMonth??"Next month",className:s("inline-flex items-center justify-center rounded-md transition-colors","text-gray-600 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-900",Or[g],y.nav,!pt&&"cursor-not-allowed opacity-40 hover:bg-transparent dark:hover:bg-transparent",!se&&"invisible"),children:jsx(_c,{className:y.icon})})]}),jsxs("table",{role:"grid","aria-label":We.format(ue),className:"border-collapse",children:[jsx("thead",{children:jsxs("tr",{children:[k&&jsxs("th",{scope:"col",className:s("font-normal text-gray-400 dark:text-gray-500",y.head),children:[jsx("span",{className:"sr-only",children:M?.weekNumber??"Week number"}),jsx("span",{"aria-hidden":"true",children:"#"})]}),xt.map(ne=>jsx("th",{scope:"col",abbr:ne.long,className:s("font-medium uppercase text-gray-500 dark:text-gray-400",y.head),children:ne.short},ne.long))]})}),jsx("tbody",{children:H.map(ne=>jsxs("tr",{children:[k&&jsx("td",{className:s("text-center align-middle text-gray-400 dark:text-gray-500",y.head),children:Bc(ne[0])}),ne.map(Ne=>{let be=Xt(Ne,ue),ke=an(Ne);if(be.outside&&!v)return jsx("td",{className:"p-0"},ke);let Ae=rr(Ne,B)&&!be.outside,Me=be.inRange||be.rangeStart&&!!Tt||be.rangeEnd&&!!ct?.from;return jsx("td",{role:"presentation",className:s("p-0",Me&&Gc[g],Me&&be.rangeStart&&"rounded-l-full",Me&&be.rangeEnd&&"rounded-r-full"),children:jsx("button",{type:"button","data-day":ke,"data-selected":be.selected||void 0,"data-today":be.today||void 0,"data-outside":be.outside||void 0,role:"gridcell",tabIndex:Ae?0:-1,disabled:x,"aria-selected":be.selected,"aria-disabled":be.disabled||void 0,"aria-current":be.today?"date":void 0,"aria-label":ht.format(Ne),onClick:()=>{be.disabled||et(Ne);},onMouseEnter:()=>t==="range"&&j(ft(Ne)),onMouseLeave:()=>t==="range"&&j(null),onFocus:()=>$(ft(Ne)),className:s("inline-flex items-center justify-center rounded-full transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 dark:focus-visible:ring-offset-gray-900",Or[g],y.day,be.selected?Uc[g]:be.inRange?s(Kc[g],"hover:bg-gray-200/60 dark:hover:bg-gray-600/60"):be.today?s(Yc[g],"hover:bg-gray-100 dark:hover:bg-gray-700"):s("text-gray-900 dark:text-gray-100","hover:bg-gray-100 dark:hover:bg-gray-700"),be.outside&&!be.selected&&"text-gray-400 dark:text-gray-500",be.disabled&&"cursor-not-allowed opacity-40 hover:bg-transparent dark:hover:bg-transparent"),children:q?q(Ne,be):Ne.getDate()})},ke)})]},an(ne[0])))})]})]},an(ue))},Ot=useCallback(()=>{xe(I),$(I),me(I)||Pe(I);},[I,xe,me,Pe]),pr=useCallback(()=>{Te(t==="multiple"?[]:t==="range"?{from:null,to:null}:null);},[t,Te]),jt=!!A||N||L;return jsxs("div",{ref:le,onKeyDown:Ke,className:s("inline-block bg-white dark:bg-gray-900",G&&"rounded-lg border border-gray-200 shadow-sm dark:border-gray-700",y.padding,x&&"opacity-60",O),...P,children:[jsx("div",{className:s("flex flex-wrap",y.gap),children:Array.from({length:T},(de,ue)=>Rr(ue))}),jt&&jsxs("div",{className:s("mt-3 flex items-center justify-between gap-2 border-t border-gray-200 pt-3 dark:border-gray-700",y.footer),children:[jsx("div",{className:"text-gray-600 dark:text-gray-400",children:A}),(N||L)&&jsxs("div",{className:"flex items-center gap-2",children:[N&&jsx("button",{type:"button",onClick:Ot,disabled:x,className:s("rounded-md px-2 py-1 font-medium transition-colors","text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2",Or[g],x&&"cursor-not-allowed opacity-50"),children:M?.today??"Today"}),L&&jsx("button",{type:"button",onClick:pr,disabled:x,className:s("rounded-md px-2 py-1 font-medium transition-colors","text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700","focus:outline-none focus-visible:ring-2",Or[g],x&&"cursor-not-allowed opacity-50"),children:M?.clear??"Clear"})]})]})]})}function jc(e,t,r){let o=r||"bg-white dark:bg-gray-800",n=t||"border-gray-200 dark:border-gray-700";switch(e){case "outlined":return s("border-2 bg-transparent",n);case "elevated":return s("shadow-lg border-0",o);case "filled":return s(r||"bg-gray-100 dark:bg-gray-700","border-0");default:return s("border",n,o)}}function qc(e){switch(e){case "sm":return "max-w-sm";case "lg":return "max-w-2xl";default:return "max-w-md"}}function Jc(e){switch(e){case "none":return "rounded-none";case "sm":return "rounded-sm";case "md":return "rounded-md";case "xl":return "rounded-xl";case "full":return "rounded-3xl";default:return "rounded-lg"}}function Zc(e){switch(e){case "none":return "";case "sm":return "p-2";case "lg":return "p-6";default:return ""}}function Ms({variant:e="default",size:t="md",rounded:r="lg",padding:o="none",bgColor:n,borderColor:a,shadowColor:i,hoverable:c=false,clickable:d=false,as:l="div",className:p,children:u,onClick:m,...g}){let f=l,h=c?"transition-all duration-200 hover:shadow-lg hover:-translate-y-0.5":"",b=d?"cursor-pointer active:scale-[0.98] transition-transform":"",x=i||"";return jsx(f,{className:s("overflow-hidden",jc(e,a,n),qc(t),Jc(r),Zc(o),h,b,x,p),onClick:d||m?m:void 0,...g,children:u})}Ms.displayName="Card";function eu(e){switch(e){case "none":return "p-0";case "sm":return "px-3 py-2";case "lg":return "px-6 py-5";default:return "px-4 py-4"}}function Ls({actions:e,divider:t=false,padding:r="md",className:o,children:n,...a}){return jsxs("div",{className:s("flex items-center justify-between",eu(r),t&&"border-b border-gray-200 dark:border-gray-700",o),...a,children:[jsx("div",{className:"flex-1",children:n}),e&&jsx("div",{className:"flex items-center gap-2 ml-4",children:e})]})}Ls.displayName="CardHeader";function ru(e){switch(e){case "none":return "p-0";case "sm":return "px-3 py-2";case "lg":return "px-6 py-5";default:return "px-4 py-4"}}function zs({padding:e="md",className:t,children:r,...o}){return jsx("div",{className:s(ru(e),t),...o,children:r})}zs.displayName="CardBody";function nu(e){switch(e){case "none":return "p-0";case "sm":return "px-3 py-2";case "lg":return "px-6 py-5";default:return "px-4 py-4"}}function au(e){switch(e){case "center":return "justify-center";case "right":return "justify-end";case "between":return "justify-between";default:return "justify-start"}}function As({divider:e=false,align:t="left",padding:r="md",className:o,children:n,...a}){return jsx("div",{className:s("flex items-center gap-2",nu(r),au(t),e&&"border-t border-gray-200 dark:border-gray-700",o),...a,children:n})}As.displayName="CardFooter";function iu(e){switch(e){case "square":return "aspect-square";case "video":return "aspect-video";case "wide":return "aspect-[21/9]";default:return ""}}function lu(e){switch(e){case "contain":return "object-contain";case "fill":return "object-fill";case "none":return "object-none";default:return "object-cover"}}function Ws({position:e="top",aspectRatio:t="auto",objectFit:r="cover",src:o,alt:n,className:a,...i}){let c=e==="top"?"rounded-t-lg":"rounded-b-lg";return jsx("img",{src:o,alt:n,className:s("w-full",iu(t),lu(r),c,a),...i})}Ws.displayName="CardImage";function cu(e){switch(e){case "sm":return "text-base font-medium";case "lg":return "text-2xl font-bold";default:return "text-xl font-semibold"}}function Fs({as:e="h3",size:t="md",className:r,children:o,...n}){return jsx(e,{className:s("text-gray-900 dark:text-white",cu(t),r),...n,children:o})}Fs.displayName="CardTitle";function pu(e){switch(e){case "sm":return "text-xs";case "lg":return "text-base";default:return "text-sm"}}function Hs({size:e="md",className:t,children:r,...o}){return jsx("p",{className:s("text-gray-500 dark:text-gray-400",pu(e),t),...o,children:r})}Hs.displayName="CardDescription";var xu=e=>{switch(e){case "sm":return {checkbox:"w-4 h-4",label:"text-xs",description:"text-xs"};case "lg":return {checkbox:"w-6 h-6",label:"text-base",description:"text-sm"};default:return {checkbox:"w-5 h-5",label:"text-sm",description:"text-xs"}}},vu=e=>{switch(e){case "circle":return "rounded-full";case "rounded":return "rounded-md";default:return "rounded"}},wu=({className:e})=>jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})}),ku=({className:e})=>jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M3 8H13",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"})}),Do=forwardRef(({checked:e,defaultChecked:t=false,onChange:r,disabled:o=false,readOnly:n=false,required:a=false,name:i,value:c,id:d,label:l,description:p,error:u=false,size:m="md",labelPosition:g="right",checkedColor:f="bg-blue-600",uncheckedColor:h="bg-white dark:bg-gray-800",borderColor:b="border-gray-300 dark:border-gray-600",labelColor:x,errorColor:v="text-red-500",checkmarkColor:k="text-white",hoverColor:R,focusRingColor:S="ring-blue-500",indeterminate:E=false,icon:z,variant:N="default",shape:L="square",animation:A=true,showFocusRing:G=true,className:q,containerClassName:M,style:O,tabIndex:P,...y},T)=>{let I=useId(),oe=d||I,ie=`${oe}-error`,we=`${oe}-description`,[he,F]=useState(t),Q=e!==void 0,ae=Q?e:he,ye=useRef(null);useEffect(()=>{ye.current&&(ye.current.indeterminate=E);},[E]);let xe=te=>{if(o||n)return;let B=te.target.checked;Q||F(B),r?.(B,te);},le=xu(m),X=vu(L),C=()=>{let te=s("relative flex items-center justify-center border-2 transition-all",le.checkbox,X,A&&"duration-200 ease-in-out");return o?s(te,"opacity-50 cursor-not-allowed",ae||E?f:h,b):N==="filled"?s(te,ae||E?f:"bg-gray-100 dark:bg-gray-700",ae||E?"border-transparent":b,R&&!n&&`hover:${R}`,"cursor-pointer"):N==="outlined"?s(te,h,ae||E?`border-current ${f.replace("bg-","text-")}`:b,"border-2",R&&!n&&`hover:${R}`,"cursor-pointer"):s(te,ae||E?f:h,ae||E?"border-transparent":b,R&&!n&&`hover:${R}`,"cursor-pointer")},$=u!==false,ge=typeof u=="string"?u:void 0;return jsxs("div",{className:s("inline-flex flex-col",M),children:[jsxs("label",{htmlFor:oe,className:s("inline-flex items-start gap-2",o?"cursor-not-allowed":"cursor-pointer",g==="left"&&"flex-row-reverse justify-end"),children:[jsx("input",{ref:te=>{ye&&(ye.current=te),typeof T=="function"?T(te):T&&(T.current=te);},type:"checkbox",id:oe,name:i,value:c,checked:ae,onChange:xe,disabled:o,readOnly:n,required:a,tabIndex:n?-1:P,"aria-invalid":$,"aria-describedby":s(ge&&ie,p&&we),className:"sr-only peer",style:O,...y}),jsx("span",{className:s(C(),G&&`peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2 peer-focus-visible:${S}`,A&&ae&&"scale-100",$&&"border-red-500"),"aria-hidden":"true",children:(ae||E)&&jsx("span",{className:s(k,A&&"animate-in zoom-in-50 duration-200"),children:E?z||jsx(ku,{className:"w-full h-full"}):z||jsx(wu,{className:"w-full h-full"})})}),l&&jsxs("span",{className:"flex flex-col gap-1",children:[jsxs("span",{className:s(le.label,o&&"opacity-50",x,$&&v),children:[l,a&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),p&&jsx("span",{id:we,className:s(le.description,"text-gray-500 dark:text-gray-400",o&&"opacity-50"),children:p})]})]}),ge&&jsx("p",{id:ie,className:s("mt-1 text-xs",v),children:ge})]})});Do.displayName="Checkbox";var Bs=createContext(null),Os=({label:e,description:t,value:r,defaultValue:o=[],onChange:n,orientation:a="vertical",spacing:i="md",disabled:c=false,size:d="md",error:l=false,required:p=false,children:u,className:m,labelClassName:g,...f})=>{let[h,b]=ra.useState(o),x=r!==void 0,v=x?r:h,k=ra.useCallback(N=>{let L=v.includes(N)?v.filter(A=>A!==N):[...v,N];x||b(L),n?.(L);},[v,x,n]),R=ra.useMemo(()=>({value:v,onChange:k,disabled:c,size:d}),[v,k,c,d]),S={sm:a==="vertical"?"gap-2":"gap-3",md:a==="vertical"?"gap-3":"gap-4",lg:a==="vertical"?"gap-4":"gap-6"},E=l!==false,z=typeof l=="string"?l:void 0;return jsxs("div",{className:s("flex flex-col gap-2",m),...f,children:[(e||t)&&jsxs("div",{className:"flex flex-col gap-1",children:[e&&jsxs("label",{className:s("text-sm font-medium text-gray-900 dark:text-gray-100",c&&"opacity-50",E&&"text-red-500",g),children:[e,p&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]}),t&&jsx("p",{className:s("text-xs text-gray-500 dark:text-gray-400",c&&"opacity-50"),children:t})]}),jsx(Bs.Provider,{value:R,children:jsx("div",{className:s("flex",a==="vertical"?"flex-col":"flex-row flex-wrap",S[i]),role:"group",children:u})}),z&&jsx("p",{className:"text-xs text-red-500",children:z})]})};Os.displayName="CheckboxGroup";var Vs=({value:e,disabled:t,size:r,...o})=>{let n=useContext(Bs);if(!n)return console.warn("CheckboxGroupItem doit \xEAtre utilis\xE9 dans un CheckboxGroup"),jsx(Do,{...o,disabled:t,size:r});let{value:a,onChange:i,disabled:c,size:d}=n,l=a.includes(e);return jsx(Do,{...o,checked:l,onChange:()=>i(e),disabled:c||t,size:r||d})};Vs.displayName="CheckboxGroupItem";var St={compact:"px-3 py-1.5",default:"px-4 py-3",comfortable:"px-6 py-4"},cn={compact:"text-xs",default:"text-sm",comfortable:"text-base"},Eu=()=>jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:jsx("path",{d:"M8 3l4 5H4l4-5z"})}),Du=()=>jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:jsx("path",{d:"M8 13l4-5H4l4 5z"})}),Iu=()=>jsx("svg",{className:"w-3.5 h-3.5 opacity-30",viewBox:"0 0 16 16",fill:"currentColor",children:jsx("path",{d:"M8 3l3 4H5l3-4zM8 13l3-4H5l3 4z"})}),_s=({className:e})=>jsx("svg",{className:s("w-4 h-4",e),viewBox:"0 0 20 20",fill:"currentColor",children:jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),Mu=()=>jsx("svg",{className:"w-4 h-4 text-gray-400",viewBox:"0 0 20 20",fill:"currentColor",children:jsx("path",{fillRule:"evenodd",d:"M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z",clipRule:"evenodd"})}),Pu=()=>jsx("svg",{className:"w-4 h-4 text-gray-400",viewBox:"0 0 20 20",fill:"currentColor",children:jsx("path",{d:"M7 4a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3zM7 10.5a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3zM7 17a1.5 1.5 0 110-3 1.5 1.5 0 010 3zm6 0a1.5 1.5 0 110-3 1.5 1.5 0 010 3z"})}),Lu=()=>jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 20 20",fill:"currentColor",children:jsx("path",{fillRule:"evenodd",d:"M2.628 1.601C5.028 1.206 7.49 1 10 1s4.973.206 7.372.601a.75.75 0 01.628.74v2.288a2.25 2.25 0 01-.659 1.59l-4.682 4.683a2.25 2.25 0 00-.659 1.59v3.037c0 .684-.31 1.33-.844 1.757l-1.937 1.55A.75.75 0 018 18.25v-5.757a2.25 2.25 0 00-.659-1.591L2.659 6.22A2.25 2.25 0 012 4.629V2.34a.75.75 0 01.628-.74z",clipRule:"evenodd"})}),zu=()=>jsxs("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:[jsx("path",{d:"M10.75 2.75a.75.75 0 00-1.5 0v8.614L6.295 8.235a.75.75 0 10-1.09 1.03l4.25 4.5a.75.75 0 001.09 0l4.25-4.5a.75.75 0 00-1.09-1.03l-2.955 3.129V2.75z"}),jsx("path",{d:"M3.5 12.75a.75.75 0 00-1.5 0v2.5A2.75 2.75 0 004.75 18h10.5A2.75 2.75 0 0018 15.25v-2.5a.75.75 0 00-1.5 0v2.5c0 .69-.56 1.25-1.25 1.25H4.75c-.69 0-1.25-.56-1.25-1.25v-2.5z"})]}),Au=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor",children:jsx("path",{fillRule:"evenodd",d:"M2.5 3A1.5 1.5 0 001 4.5v11A1.5 1.5 0 002.5 17h15a1.5 1.5 0 001.5-1.5v-11A1.5 1.5 0 0017.5 3h-15zM2.5 4.5h6v11h-6v-11zm7.5 0h7.5v11H10v-11z",clipRule:"evenodd"})});function dn(e,t,r){return typeof r=="function"?r(e,t):String(typeof r=="string"?e[r]:t)}function nr(e,t){return e[t]}function Wu(e,t){return e==null&&t==null?0:e==null?-1:t==null?1:typeof e=="number"&&typeof t=="number"?e-t:String(e).localeCompare(String(t))}function Fu(e,t){let r=String(e??"").toLowerCase(),o=t.value.toLowerCase();switch(t.operator){case "contains":return r.includes(o);case "equals":return r===o;case "startsWith":return r.startsWith(o);case "endsWith":return r.endsWith(o);case "gt":return Number(e)>Number(t.value);case "gte":return Number(e)>=Number(t.value);case "lt":return Number(e)<Number(t.value);case "lte":return Number(e)<=Number(t.value);case "isEmpty":return r==="";case "isNotEmpty":return r!=="";default:return true}}function $s(e,t,r){let o=[];for(let n of e){let a=Number(nr(n,t));isNaN(a)||o.push(a);}if(o.length===0)return 0;switch(r){case "sum":return o.reduce((n,a)=>n+a,0);case "avg":return o.reduce((n,a)=>n+a,0)/o.length;case "count":return o.length;case "min":return Math.min(...o);case "max":return Math.max(...o)}}function Hu({cols:e,density:t}){return jsx("tr",{className:"border-b border-gray-200 dark:border-gray-700",children:Array.from({length:e}).map((r,o)=>jsx("td",{className:St[t],children:jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse"})},o))})}function Bu({column:e,value:t,onApply:r,onClear:o}){let[n,a]=useState(false),[i,c]=useState(t?.operator??"contains"),[d,l]=useState(t?.value??""),p=useRef(null),u=e.filterType??"text",m=u==="number"?[{value:"equals",label:"Equals"},{value:"gt",label:"Greater than"},{value:"gte",label:"Greater or equal"},{value:"lt",label:"Less than"},{value:"lte",label:"Less or equal"}]:[{value:"contains",label:"Contains"},{value:"equals",label:"Equals"},{value:"startsWith",label:"Starts with"},{value:"endsWith",label:"Ends with"},{value:"isEmpty",label:"Is empty"},{value:"isNotEmpty",label:"Is not empty"}];return useEffect(()=>{let g=f=>{p.current&&!p.current.contains(f.target)&&a(false);};return n&&document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[n]),jsxs("div",{className:"relative inline-block",ref:p,children:[jsx("button",{type:"button",onClick:g=>{g.stopPropagation(),a(!n);},className:s("p-0.5 rounded hover:bg-gray-200 dark:hover:bg-gray-600 cursor-pointer",t&&"text-blue-600 dark:text-blue-400"),"aria-label":`Filter ${String(e.header)}`,children:jsx(Lu,{})}),n&&jsx("div",{className:"absolute z-50 top-full left-0 mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-3 min-w-[220px]",children:u==="select"&&e.filterOptions?jsxs("div",{className:"flex flex-col gap-1.5",children:[e.filterOptions.map(g=>jsxs("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[jsx("input",{type:"radio",name:`filter-${e.key}`,value:g,checked:d===g,onChange:()=>l(g),className:"cursor-pointer"}),jsx("span",{className:"text-gray-700 dark:text-gray-300",children:g})]},g)),jsxs("div",{className:"flex gap-2 mt-2",children:[jsx("button",{type:"button",onClick:()=>{r({column:e.key,operator:"equals",value:d}),a(false);},className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 cursor-pointer",children:"Apply"}),jsx("button",{type:"button",onClick:()=>{l(""),o(),a(false);},className:"px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 cursor-pointer",children:"Clear"})]})]}):jsxs("div",{className:"flex flex-col gap-2",children:[jsx("select",{value:i,onChange:g=>c(g.target.value),className:"text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200",children:m.map(g=>jsx("option",{value:g.value,children:g.label},g.value))}),i!=="isEmpty"&&i!=="isNotEmpty"&&jsx("input",{type:u==="number"?"number":u==="date"?"date":"text",value:d,onChange:g=>l(g.target.value),placeholder:"Filter value...",className:"text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-700 text-gray-700 dark:text-gray-200",autoFocus:true,"aria-label":`Filter ${String(e.header)} value`}),jsxs("div",{className:"flex gap-2",children:[jsx("button",{type:"button",onClick:()=>{r({column:e.key,operator:i,value:d}),a(false);},className:"px-2 py-1 text-xs bg-blue-600 text-white rounded hover:bg-blue-700 cursor-pointer",children:"Apply"}),jsx("button",{type:"button",onClick:()=>{l(""),o(),a(false);},className:"px-2 py-1 text-xs text-gray-600 dark:text-gray-400 hover:text-gray-800 dark:hover:text-gray-200 cursor-pointer",children:"Clear"})]})]})})]})}function Ou({value:e,onSave:t,density:r}){let[o,n]=useState(false),[a,i]=useState(String(e??"")),c=useRef(null);if(useEffect(()=>{o&&c.current&&(c.current.focus(),c.current.select());},[o]),!o)return jsx("div",{onDoubleClick:()=>{i(String(e??"")),n(true);},className:"cursor-text min-h-[1.5em]",title:"Double-click to edit",children:String(e??"")});let d=()=>{n(false),a!==String(e??"")&&t(a);};return jsx("input",{ref:c,type:"text",value:a,onChange:l=>i(l.target.value),onBlur:d,"aria-label":"Edit cell value",onKeyDown:l=>{l.key==="Enter"&&d(),l.key==="Escape"&&n(false);},className:s("w-full border border-blue-500 rounded px-1 py-0.5 bg-white dark:bg-gray-700 text-gray-900 dark:text-gray-100 outline-none",cn[r])})}function Vu(e,t){let{columns:r,data:o,rowKey:n,mode:a="client",sortable:i=false,multiSort:c=false,sort:d,defaultSort:l,onSort:p,pagination:u=false,page:m,onPageChange:g,onPageSizeChange:f,totalItems:h,selectable:b=false,selectionMode:x="multiple",selectedRows:v,onSelectionChange:k,searchable:R=false,searchPlaceholder:S="Search...",searchValue:E,onSearch:z,filters:N,onFilterChange:L,expandable:A=false,expandedContent:G,expandedRows:q,onExpandChange:M,editable:O=false,onCellEdit:P,reorderable:y=false,onReorder:T,columnReorderable:I=false,onColumnReorder:oe,columnToggle:ie=false,hiddenColumns:we,onColumnVisibilityChange:he,groupBy:F,renderGroupHeader:Q,exportable:ae=false,exportFormats:ye=["csv","json"],exportFilename:xe="export",virtualized:le=false,rowHeight:X=40,virtualHeight:C=400,density:$="default",striped:ge=false,bordered:te=false,borderless:B=false,stickyHeader:ee=false,maxHeight:me,loading:Se=false,loadingRows:j=5,emptyState:Te,showFooter:Pe=false,onRowClick:et,onRowDoubleClick:at,onRowContextMenu:pt,className:J,rowClassName:fe,cellClassName:Ke,headerClassName:xt}=e,[Ee,We]=useState(l??[]),[ht,ur]=useState(1),[ct,Bt]=useState(typeof u=="object"?u.pageSize??10:10),[Tt,Xt]=useState([]),[Rr,Ot]=useState(""),[pr,jt]=useState([]),[de,ue]=useState([]),[H,V]=useState(()=>r.flatMap(w=>w.hidden?[w.key]:[])),[se,ne]=useState({}),[Ne,be]=useState(()=>r.map(w=>w.key)),[ke,Ae]=useState(null),[Me,Qe]=useState(null),[Ye,Oe]=useState(false),[vt,tt]=useState(new Set),Vt=useRef(null),[gr,Fr]=useState(0),Zr=useRef(null),qt=d??Ee,_t=m??ht,D=v??Tt,_=E??Rr,U=N??pr,K=q??de,re=we??H,Fe=u?typeof u=="object"?u:{pageSize:10,pageSizeOptions:[10,25,50,100]}:null,Ge=Fe?.pageSize??ct,Ve=useMemo(()=>{let w=new Map(r.map(Ce=>[Ce.key,Ce])),W=Ne.flatMap(Ce=>{let Le=w.get(Ce);return Le?[Le]:[]}),Z=new Set(W.map(Ce=>Ce.key));for(let Ce of r)Z.has(Ce.key)||(W.push(Ce),Z.add(Ce.key));return W.filter(Ce=>!re.includes(Ce.key))},[r,Ne,re]),Ie=useMemo(()=>{if(a==="server")return o;let w=[...o];if(_){let W=_.toLowerCase();w=w.filter(Z=>Ve.some(Ce=>{let Le=nr(Z,Ce.key);return String(Le??"").toLowerCase().includes(W)}));}if(U.length>0&&(w=w.filter(W=>U.every(Z=>Fu(nr(W,Z.column),Z)))),qt.length>0){let W=new Map(r.map(Z=>[Z.key,Z]));w.sort((Z,Ce)=>{for(let Le of qt){if(!Le.direction)continue;let it=W.get(Le.key),It=it?.sortComparator?it.sortComparator(Z,Ce):Wu(nr(Z,Le.key),nr(Ce,Le.key));if(It!==0)return Le.direction==="asc"?It:-It}return 0});}return w},[o,a,_,U,qt,Ve,r]),wt=useMemo(()=>{if(!F)return null;let w=Array.isArray(F)?F:[F],W=new Map;for(let Z of Ie){let Ce=w.map(it=>String(nr(Z,it)??"")).join(" / "),Le=W.get(Ce)??[];Le.push(Z),W.set(Ce,Le);}return W},[Ie,F]),_e=h??Ie.length,st=Math.max(1,Math.ceil(_e/Ge)),gt=useMemo(()=>{if(!Fe||a==="server")return Ie;let w=(_t-1)*Ge;return Ie.slice(w,w+Ge)},[Ie,Fe,_t,Ge,a]),rt=Fe?gt:Ie,Nt=useMemo(()=>{if(!le)return {start:0,end:rt.length};let w=Math.floor(gr/X),W=Math.ceil(C/X),Z=5;return {start:Math.max(0,w-Z),end:Math.min(rt.length,w+W+Z)}},[le,gr,X,C,rt.length]),Jt=useCallback(w=>{d||We(w),p?.(w);},[d,p]),Zt=useCallback(w=>{let W=qt.find(Ce=>Ce.key===w),Z;if(!W||!W.direction?Z="asc":W.direction==="asc"?Z="desc":Z=null,c){let Ce=qt.filter(Le=>Le.key!==w);Z&&Ce.push({key:w,direction:Z}),Jt(Ce);}else Jt(Z?[{key:w,direction:Z}]:[]);},[qt,c,Jt]),Pt=useCallback(w=>{let W=Math.max(1,Math.min(w,st));m||ur(W),g?.(W);},[m,g,st]),Un=useCallback(w=>{Bt(w),Pt(1),f?.(w);},[Pt,f]),en=useCallback(w=>{let W;x==="single"?W=D.includes(w)?[]:[w]:W=D.includes(w)?D.filter(Z=>Z!==w):[...D,w],v||Xt(W),k?.(W);},[x,D,v,k]),Gn=useCallback(()=>{let w=rt.map((W,Z)=>dn(W,Z,n));v||Xt(w),k?.(w);},[rt,n,v,k]),Kn=useCallback(()=>{v||Xt([]),k?.([]);},[v,k]),Yn=rt.length>0&&rt.every((w,W)=>D.includes(dn(w,W,n))),Cd=!Yn&&rt.some((w,W)=>D.includes(dn(w,W,n))),Nd=useCallback(w=>{let W=K.includes(w)?K.filter(Z=>Z!==w):[...K,w];q||ue(W),M?.(W);},[K,q,M]),Sd=useCallback(w=>{let W=w.target.value;E||Ot(W),z?.(W),Pt(1);},[E,z,Pt]),Rd=useCallback(w=>{let W=[...U.filter(Z=>Z.column!==w.column),w];N||jt(W),L?.(W);},[U,N,L]),Td=useCallback(w=>{let W=U.filter(Z=>Z.column!==w);N||jt(W),L?.(W);},[U,N,L]),Ed=useCallback(w=>{let W=re.includes(w)?re.filter(Z=>Z!==w):[...re,w];we||V(W),he?.(W);},[re,we,he]),Dd=useCallback((w,W)=>{w.preventDefault(),w.stopPropagation();let Z=w.clientX,Ce=se[W]??w.currentTarget.parentElement?.getBoundingClientRect().width??100,Le=r.find(Mt=>Mt.key===W),it=Le?.minWidth??50,It=Le?.maxWidth??1/0,Xe=Mt=>{let Hr=Mt.clientX-Z,er=Math.min(It,Math.max(it,Ce+Hr));ne(eo=>({...eo,[W]:er}));},Qt=()=>{document.removeEventListener("mousemove",Xe),document.removeEventListener("mouseup",Qt);};document.addEventListener("mousemove",Xe),document.addEventListener("mouseup",Qt);},[se,r]),Id=useCallback(w=>{y&&Ae(w);},[y]),Md=useCallback((w,W)=>{!y||ke===null||w.preventDefault();},[y,ke]),Pd=useCallback(w=>{!y||ke===null||ke===w||(T?.(ke,w),Ae(null));},[y,ke,T]),Ld=useCallback(w=>{I&&Qe(w);},[I]),zd=useCallback(w=>{if(!I||!Me||Me===w)return;let W=[...Ne],Z=W.indexOf(Me),Ce=W.indexOf(w);Z===-1||Ce===-1||(W.splice(Z,1),W.splice(Ce,0,Me),be(W),oe?.(Me,w),Qe(null));},[I,Me,Ne,oe]),Xn=useCallback(w=>{let W=Ve.filter(Mt=>Mt.type!=="actions"&&Mt.type!=="selection"&&Mt.type!=="expand"),Z=Ie,Ce,Le,it;if(w==="csv"){let Mt=W.map(er=>String(er.header)).join(","),Hr=Z.map(er=>W.map(eo=>{let Jn=String(nr(er,eo.key)??"");return Jn.includes(",")?`"${Jn}"`:Jn}).join(","));Ce=[Mt,...Hr].join(`
2
+ `),Le="text/csv",it="csv";}else {let Mt=Z.map(Hr=>{let er={};for(let eo of W)er[eo.key]=nr(Hr,eo.key);return er});Ce=JSON.stringify(Mt,null,2),Le="application/json",it="json";}let It=new Blob([Ce],{type:Le}),Xe=URL.createObjectURL(It),Qt=document.createElement("a");Qt.href=Xe,Qt.download=`${xe}.${it}`,Qt.click(),URL.revokeObjectURL(Xe);},[Ve,Ie,xe]);useEffect(()=>{if(!Ye)return;let w=W=>{Zr.current&&!Zr.current.contains(W.target)&&Oe(false);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[Ye]),useImperativeHandle(t,()=>({getVisibleData:()=>rt,resetFilters:()=>{N||jt([]),E||Ot(""),L?.([]),z?.("");},resetSort:()=>{d||We([]),p?.([]);},selectAll:Gn,deselectAll:Kn,exportData:Xn,scrollToRow:w=>{Vt.current&&le&&(Vt.current.scrollTop=w*X);}}),[rt,N,E,d,L,z,p,Gn,Kn,Xn,le,X]);let jn=w=>{let W={},Z=se[w.key]??w.width;return Z&&(W.width=typeof Z=="number"?`${Z}px`:Z,W.minWidth=typeof Z=="number"?`${Z}px`:Z),w.sticky&&(W.position="sticky",W[w.sticky]=0,W.zIndex=10),W},Qr=Ve.length+(b?1:0)+(A?1:0)+(y?1:0),Ad=w=>{let W=i&&w.sortable!==false&&w.type!=="actions",Z=qt.find(Le=>Le.key===w.key),Ce=w.filterable&&(w.filterType||w.filterOptions);return jsxs("th",{className:s(St[$],cn[$],"font-semibold text-gray-700 dark:text-gray-300 whitespace-nowrap",w.align==="center"&&"text-center",w.align==="right"&&"text-right",W&&"cursor-pointer select-none hover:bg-gray-100 dark:hover:bg-gray-700",te&&"border border-gray-200 dark:border-gray-700",w.sticky&&"bg-gray-50 dark:bg-gray-800",w.headerClassName,xt),style:jn(w),onClick:W?()=>Zt(w.key):void 0,draggable:I,onDragStart:I?()=>Ld(w.key):void 0,onDragOver:I?Le=>Le.preventDefault():void 0,onDrop:I?()=>zd(w.key):void 0,"aria-sort":Z?.direction==="asc"?"ascending":Z?.direction==="desc"?"descending":void 0,children:[jsxs("div",{className:"flex items-center gap-1",children:[w.renderHeader?w.renderHeader(w):w.header,W&&jsx("span",{className:"inline-flex ml-1",children:Z?.direction==="asc"?jsx(Eu,{}):Z?.direction==="desc"?jsx(Du,{}):jsx(Iu,{})}),Ce&&jsx(Bu,{column:w,value:U.find(Le=>Le.column===w.key),onApply:Rd,onClear:()=>Td(w.key)})]}),w.resizable!==false&&jsx("div",{className:"absolute top-0 right-0 w-1 h-full cursor-col-resize hover:bg-blue-500 opacity-0 hover:opacity-100",onMouseDown:Le=>Dd(Le,w.key)})]},w.key)},qn=(w,W,Z)=>{let Ce=dn(w,Z,n),Le=D.includes(Ce),it=K.includes(Ce),It=typeof fe=="function"?fe(w,Z):fe;return jsxs(ra__default.Fragment,{children:[jsxs("tr",{className:s("border-b border-gray-200 dark:border-gray-700 transition-colors",ge&&Z%2===1&&"bg-gray-50/50 dark:bg-gray-800/50",Le&&"bg-blue-50 dark:bg-blue-900/20",et&&"cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-700/50",ke===W&&"opacity-50",It),onClick:et?()=>et(w,Z):void 0,onDoubleClick:at?()=>at(w,Z):void 0,onContextMenu:pt?Xe=>pt(w,Z,Xe):void 0,draggable:y,onDragStart:y?()=>Id(W):void 0,onDragOver:y?Xe=>Md(Xe,W):void 0,onDrop:y?()=>Pd(W):void 0,"data-row-key":Ce,"aria-selected":b?Le:void 0,children:[y&&jsx("td",{className:s(St[$],"cursor-grab active:cursor-grabbing"),children:jsx(Pu,{})}),b&&jsx("td",{className:s(St[$],"w-10"),children:jsx("input",{type:"checkbox",checked:Le,onChange:()=>en(Ce),onClick:Xe=>Xe.stopPropagation(),className:"rounded border-gray-300 dark:border-gray-600 cursor-pointer","aria-label":`Select row ${Ce}`})}),A&&jsx("td",{className:s(St[$],"w-10"),children:jsx("button",{type:"button",onClick:Xe=>{Xe.stopPropagation(),Nd(Ce);},className:"p-0.5 rounded hover:bg-gray-200 dark:hover:bg-gray-600 cursor-pointer","aria-label":it?"Collapse row":"Expand row","aria-expanded":it,children:jsx(_s,{className:s("transition-transform",it&&"rotate-180")})})}),Ve.map(Xe=>{let Qt=nr(w,Xe.key),Mt=Xe.colSpan?.(w,Z);if(Mt===0)return null;let Hr=O&&Xe.editable!==false&&Xe.type!=="actions";return jsx("td",{className:s(St[$],cn[$],"text-gray-700 dark:text-gray-300",Xe.align==="center"&&"text-center",Xe.align==="right"&&"text-right",te&&"border border-gray-200 dark:border-gray-700",Xe.sticky&&(Le?"bg-blue-50 dark:bg-blue-900/20":ge&&Z%2===1?"bg-gray-50/50 dark:bg-gray-800/50":"bg-white dark:bg-gray-900"),Xe.cellClassName,Ke),style:jn(Xe),colSpan:Mt,children:Hr?jsx(Ou,{value:Qt,onSave:er=>P?.(Ce,Xe.key,er),density:$}):Xe.render?Xe.render(Qt,w,Z):String(Qt??"")},Xe.key)})]}),A&&it&&G&&jsx("tr",{className:"bg-gray-50 dark:bg-gray-800/70",children:jsx("td",{colSpan:Qr,className:s(St[$]),children:G(w,Z)})})]},Ce)},Wd=()=>{if(Se)return Array.from({length:j}).map((w,W)=>jsx(Hu,{cols:Qr,density:$},W));if(rt.length===0)return jsx("tr",{children:jsx("td",{colSpan:Qr,className:s("text-center text-gray-400 dark:text-gray-500",St[$]),children:Te??"No data available"})});if(wt){let w=[],W=0;for(let[Z,Ce]of wt){let Le=vt.has(Z);if(w.push(jsx("tr",{className:"bg-gray-100 dark:bg-gray-800 font-medium",children:jsx("td",{colSpan:Qr,className:s(St[$],"cursor-pointer"),onClick:()=>{tt(it=>{let It=new Set(it);return It.has(Z)?It.delete(Z):It.add(Z),It});},children:jsxs("div",{className:"flex items-center gap-2",children:[jsx(_s,{className:s("transition-transform",Le&&"-rotate-90")}),Q?Q(Z,nr(Ce[0],Array.isArray(F)?F[0]:F),Ce):`${Z} (${Ce.length})`]})})},`group-${Z}`)),Le)W+=Ce.length;else for(let it=0;it<Ce.length;it++)w.push(qn(Ce[it],W,W)),W++;}return w}if(le){let w=[];for(let W=Nt.start;W<Nt.end;W++)w.push(qn(rt[W],W,W));return jsxs(Fragment,{children:[Nt.start>0&&jsx("tr",{children:jsx("td",{colSpan:Qr,style:{height:Nt.start*X,padding:0}})}),w,Nt.end<rt.length&&jsx("tr",{children:jsx("td",{colSpan:Qr,style:{height:(rt.length-Nt.end)*X,padding:0}})})]})}return rt.map((w,W)=>qn(w,W,W))},Fd=()=>!Pe||!Ve.some(W=>W.aggregate)?null:jsx("tfoot",{children:jsxs("tr",{className:"bg-gray-50 dark:bg-gray-800 font-semibold border-t-2 border-gray-300 dark:border-gray-600",children:[y&&jsx("td",{className:St[$]}),b&&jsx("td",{className:St[$]}),A&&jsx("td",{className:St[$]}),Ve.map(W=>jsx("td",{className:s(St[$],cn[$],"text-gray-700 dark:text-gray-300",W.align==="center"&&"text-center",W.align==="right"&&"text-right",te&&"border border-gray-200 dark:border-gray-700"),style:jn(W),children:W.aggregate?W.renderAggregate?W.renderAggregate($s(Ie,W.key,W.aggregate),Ie):`${W.aggregate==="count"?"":W.aggregate==="avg"?"Avg: ":W.aggregate==="sum"?"Total: ":W.aggregate==="min"?"Min: ":"Max: "}${$s(Ie,W.key,W.aggregate).toLocaleString()}`:""},W.key))]})});return jsxs("div",{className:s("flex flex-col gap-3",J),children:[(R||ae||ie)&&jsxs("div",{className:"flex items-center justify-between gap-3 flex-wrap",children:[jsxs("div",{className:"flex items-center gap-3 flex-1",children:[R&&jsxs("div",{className:"relative flex-1 max-w-xs",children:[jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none",children:jsx(Mu,{})}),jsx("input",{type:"text",value:_,onChange:Sd,placeholder:S,className:"w-full pl-9 pr-3 py-1.5 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500","aria-label":"Search table"})]}),D.length>0&&jsxs("span",{className:"text-sm text-gray-500 dark:text-gray-400",children:[D.length," selected"]})]}),jsxs("div",{className:"flex items-center gap-2",children:[ie&&jsxs("div",{className:"relative",ref:Zr,children:[jsx("button",{type:"button",onClick:()=>Oe(!Ye),className:"p-1.5 rounded-md border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":"Toggle columns",title:"Toggle columns",children:jsx(Au,{})}),Ye&&jsx("div",{className:"absolute z-50 right-0 top-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-lg p-2 min-w-[180px]",children:r.filter(w=>w.type!=="selection"&&w.type!=="expand").map(w=>jsxs("label",{className:"flex items-center gap-2 px-2 py-1.5 text-sm rounded hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:[jsx("input",{type:"checkbox",checked:!re.includes(w.key),onChange:()=>Ed(w.key),className:"rounded border-gray-300 dark:border-gray-600 cursor-pointer"}),jsx("span",{className:"text-gray-700 dark:text-gray-300",children:String(w.header)})]},w.key))})]}),ae&&ye.map(w=>jsxs("button",{type:"button",onClick:()=>Xn(w),className:"inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium rounded-md border border-gray-300 dark:border-gray-600 text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",title:`Export as ${w.toUpperCase()}`,children:[jsx(zu,{}),w.toUpperCase()]},w))]})]}),jsx("div",{ref:Vt,className:s("overflow-auto rounded-lg",!B&&"border border-gray-200 dark:border-gray-700",ee&&"relative"),style:me?{maxHeight:typeof me=="number"?`${me}px`:me}:le?{maxHeight:C,overflow:"auto"}:void 0,onScroll:le?w=>Fr(w.target.scrollTop):void 0,children:jsxs("table",{className:"w-full text-left",children:[jsx("thead",{className:s("bg-gray-50 dark:bg-gray-800 text-xs uppercase",ee&&"sticky top-0 z-20"),children:jsxs("tr",{children:[y&&jsx("th",{className:s(St[$],"w-10 font-semibold text-gray-700 dark:text-gray-300")}),b&&jsx("th",{className:s(St[$],"w-10"),children:x==="multiple"&&jsx("input",{type:"checkbox",checked:Yn,ref:w=>{w&&(w.indeterminate=Cd);},onChange:Yn?Kn:Gn,className:"rounded border-gray-300 dark:border-gray-600 cursor-pointer","aria-label":"Select all rows"})}),A&&jsx("th",{className:s(St[$],"w-10 font-semibold text-gray-700 dark:text-gray-300")}),Ve.map(Ad)]})}),jsx("tbody",{children:Wd()}),Fd()]})}),Fe&&jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3 text-sm text-gray-600 dark:text-gray-400",children:[jsxs("div",{className:"flex items-center gap-3",children:[Fe.showTotalItems!==false&&jsxs("span",{children:[_e," item",_e!==1?"s":""]}),Fe.showPageSizeSelector!==false&&Fe.pageSizeOptions&&jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("span",{children:"Rows per page:"}),jsx("select",{value:Ge,onChange:w=>Un(Number(w.target.value)),className:"border border-gray-300 dark:border-gray-600 rounded px-1.5 py-0.5 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 text-sm",children:Fe.pageSizeOptions.map(w=>jsx("option",{value:w,children:w},w))})]})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsxs("span",{className:"mr-2",children:["Page ",_t," of ",st]}),jsx("button",{type:"button",onClick:()=>Pt(1),disabled:_t<=1,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":"First page",children:"\xAB\xAB"}),jsx("button",{type:"button",onClick:()=>Pt(_t-1),disabled:_t<=1,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":"Previous page",children:"\xAB"}),jsx("button",{type:"button",onClick:()=>Pt(_t+1),disabled:_t>=st,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":"Next page",children:"\xBB"}),jsx("button",{type:"button",onClick:()=>Pt(st),disabled:_t>=st,className:"px-2 py-1 rounded border border-gray-300 dark:border-gray-600 disabled:opacity-50 disabled:cursor-not-allowed hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer","aria-label":"Last page",children:"\xBB\xBB"})]})]})]})}var _u=forwardRef(Vu);function Uu({className:e}){return jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var Gu={default:{solid:"bg-gray-500 text-white",outlined:"border-gray-300 text-gray-700 dark:border-gray-600 dark:text-gray-300 bg-transparent",soft:"bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300",dot:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300"},primary:{solid:"bg-blue-600 text-white",outlined:"border-blue-600 text-blue-600 dark:border-blue-400 dark:text-blue-400 bg-transparent",soft:"bg-blue-100 text-blue-700 dark:bg-blue-900/50 dark:text-blue-300",dot:"bg-blue-50 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300"},success:{solid:"bg-green-600 text-white",outlined:"border-green-600 text-green-600 dark:border-green-400 dark:text-green-400 bg-transparent",soft:"bg-green-100 text-green-700 dark:bg-green-900/50 dark:text-green-300",dot:"bg-green-50 text-green-700 dark:bg-green-900/30 dark:text-green-300"},warning:{solid:"bg-yellow-500 text-white",outlined:"border-yellow-500 text-yellow-600 dark:border-yellow-400 dark:text-yellow-400 bg-transparent",soft:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/50 dark:text-yellow-300",dot:"bg-yellow-50 text-yellow-700 dark:bg-yellow-900/30 dark:text-yellow-300"},error:{solid:"bg-red-600 text-white",outlined:"border-red-600 text-red-600 dark:border-red-400 dark:text-red-400 bg-transparent",soft:"bg-red-100 text-red-700 dark:bg-red-900/50 dark:text-red-300",dot:"bg-red-50 text-red-700 dark:bg-red-900/30 dark:text-red-300"},info:{solid:"bg-cyan-600 text-white",outlined:"border-cyan-600 text-cyan-600 dark:border-cyan-400 dark:text-cyan-400 bg-transparent",soft:"bg-cyan-100 text-cyan-700 dark:bg-cyan-900/50 dark:text-cyan-300",dot:"bg-cyan-50 text-cyan-700 dark:bg-cyan-900/30 dark:text-cyan-300"}},Ku={default:"bg-gray-500",primary:"bg-blue-600",success:"bg-green-600",warning:"bg-yellow-500",error:"bg-red-600",info:"bg-cyan-600"},Yu={sm:"h-5 text-xs px-2 gap-1",md:"h-6 text-sm px-2.5 gap-1.5",lg:"h-8 text-sm px-3 gap-2"},ia={sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},Xu={sm:"w-4 h-4 -ml-1",md:"w-5 h-5 -ml-1.5",lg:"w-6 h-6 -ml-1.5"},ju={sm:"w-1.5 h-1.5",md:"w-2 h-2",lg:"w-2.5 h-2.5"},qu={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",full:"rounded-full"};function pn({label:e,children:t,variant:r="solid",size:o="md",color:n="default",bgColor:a,textColor:i,borderColor:c,rounded:d="full",icon:l,endIcon:p,avatar:u,onClose:m,closable:g=false,clickable:f=false,selected:h=false,disabled:b=false,as:x="span",className:v,onClick:k,...R}){let S=x,E=s("inline-flex items-center justify-center font-medium transition-all",Yu[o],qu[d],r==="outlined"&&"border"),z=s(a||i||c?s(a,i,c):Gu[n][r]),N=h?"ring-2 ring-offset-1 ring-blue-500":"",L=f&&!b?"cursor-pointer hover:opacity-80 active:scale-95":"",A=b?"opacity-50 cursor-not-allowed":"",G=O=>{O.stopPropagation(),m?.();},q=O=>{b||k?.(O);},M=t??e;return jsxs(S,{className:s(E,z,N,L,A,v),onClick:q,"aria-disabled":b,...R,children:[r==="dot"&&jsx("span",{className:s("rounded-full shrink-0",ju[o],Ku[n]),"aria-hidden":"true"}),u&&jsx("span",{className:s("rounded-full overflow-hidden shrink-0",Xu[o]),children:u}),l&&!u&&jsx("span",{className:s("shrink-0",ia[o]),children:l}),M&&jsx("span",{className:"truncate",children:M}),p&&!g&&jsx("span",{className:s("shrink-0",ia[o]),children:p}),g&&jsx("button",{type:"button",onClick:G,disabled:b,className:s("shrink-0 rounded-full hover:bg-black/10 dark:hover:bg-white/10 p-0.5 -mr-1 transition-colors","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-current",b&&"pointer-events-none"),"aria-label":"Remove",children:jsx(Uu,{className:ia[o]})})]})}pn.displayName="Chip";var t0=500,r0=800,o0=600;function n0(e,t,r){let o=[`width=${e}`,`height=${t}`,"menubar=no","toolbar=no","location=no","status=no","scrollbars=yes","resizable=yes"];if(r.left!==void 0)o.push(`left=${r.left}`);else if(r.center!==false&&typeof window<"u"){let n=window.screenLeft??window.screenX,a=window.screenTop??window.screenY,i=window.outerWidth??screen.availWidth,c=window.outerHeight??screen.availHeight;o.push(`left=${n+(i-e)/2}`),o.push(`top=${a+(c-t)/2}`);}if(r.top!==void 0){let n=o.filter(a=>!a.startsWith("top="));return n.push(`top=${r.top}`),n.join(",")}return o.join(",")}function a0(e,t){e.querySelectorAll("style").forEach(i=>{let c=t.createElement("style");c.textContent=i.textContent,t.head.appendChild(c);}),e.querySelectorAll('link[rel="stylesheet"]').forEach(i=>{let c=t.createElement("link");c.rel="stylesheet",c.href=i.href,i.crossOrigin&&(c.crossOrigin=i.crossOrigin),t.head.appendChild(c);});let n=e.documentElement.className;n&&(t.documentElement.className=n);let a=e.body.className;a&&(t.body.className=a);}function s0(e,t){let r=new MutationObserver(o=>{for(let n of o)for(let a of Array.from(n.addedNodes))if(a instanceof HTMLStyleElement){let i=t.createElement("style");i.textContent=a.textContent,t.head.appendChild(i);}else if(a instanceof HTMLLinkElement&&a.rel==="stylesheet"){let i=t.createElement("link");i.rel="stylesheet",i.href=a.href,t.head.appendChild(i);}});return r.observe(e.head,{childList:true}),r}var Gs=forwardRef(function({children:t,detached:r,defaultDetached:o=false,onClose:n,onDetach:a,title:i="",width:c=r0,height:d=o0,left:l,top:p,center:u=true,copyStyles:m=true,closeOnParentUnmount:g=true,className:f,windowClassName:h,onPopupBlocked:b},x){let v=r!==void 0,[k,R]=useState(o),S=v?r:k,[E,z]=useState(null),N=useRef(null),L=useRef(null),A=useRef(null),G=useRef(false),q=useRef({width:c,height:d,left:l,top:p,center:u,shouldCopyStyles:m,title:i,windowClassName:h,closeOnParentUnmount:g});q.current={width:c,height:d,left:l,top:p,center:u,shouldCopyStyles:m,title:i,windowClassName:h,closeOnParentUnmount:g};let M=useCallback(()=>{L.current&&(clearInterval(L.current),L.current=null),A.current&&(A.current.disconnect(),A.current=null),z(null);},[]),O=useCallback(()=>{N.current&&!N.current.closed&&N.current.close(),N.current=null,M();},[M]),P=useCallback(()=>{if(typeof window>"u"||G.current||N.current&&!N.current.closed)return;G.current=true;let y=q.current,T=n0(y.width,y.height,{center:y.center,left:y.left,top:y.top}),I=window.open("","",T);if(!I){G.current=false,b?.();return}N.current=I,I.document.title=y.title||document.title;let oe=I.document.createElement("div");y.windowClassName&&(oe.className=y.windowClassName),I.document.body.appendChild(oe),z(oe),y.shouldCopyStyles&&(a0(document,I.document),A.current=s0(document,I.document)),L.current=setInterval(()=>{I.closed&&(M(),N.current=null,v||R(false),n?.());},t0),G.current=false,a?.();},[v,n,a,b,M]);return useEffect(()=>{S?P():O();},[S,P,O]),useEffect(()=>{N.current&&!N.current.closed&&i&&(N.current.document.title=i);},[i]),useEffect(()=>()=>{q.current.closeOnParentUnmount&&N.current&&!N.current.closed&&N.current.close(),M(),N.current=null;},[M]),useImperativeHandle(x,()=>({detach:()=>{v||R(true);},attach:()=>{v||R(false);},get isDetached(){return v?!!r:k},get window(){return N.current}}),[v,r,k]),S&&E?createPortal(t,E):S?null:jsx("div",{className:s(f),children:t})});Gs.displayName="Detachable";var d0={phone:{sm:{w:180,h:320},md:{w:240,h:480},lg:{w:300,h:600}},android:{sm:{w:180,h:320},md:{w:240,h:480},lg:{w:300,h:600}},tablet:{sm:{w:320,h:420},md:{w:420,h:560},lg:{w:540,h:720}},laptop:{sm:{w:400,h:250},md:{w:560,h:350},lg:{w:720,h:450}},desktop:{sm:{w:400,h:300},md:{w:560,h:400},lg:{w:720,h:520}},watch:{sm:{w:80,h:96},md:{w:120,h:144},lg:{w:160,h:192}},browser:{sm:{w:400,h:280},md:{w:560,h:380},lg:{w:720,h:480}}},c0=({className:e})=>jsxs("svg",{className:s("w-3 h-3",e),viewBox:"0 0 16 16",fill:"currentColor",children:[jsx("rect",{x:"1",y:"11",width:"2.5",height:"4",rx:"0.5"}),jsx("rect",{x:"5",y:"8",width:"2.5",height:"7",rx:"0.5"}),jsx("rect",{x:"9",y:"5",width:"2.5",height:"10",rx:"0.5"}),jsx("rect",{x:"13",y:"1",width:"2.5",height:"14",rx:"0.5"})]}),u0=({className:e})=>jsxs("svg",{className:s("w-3 h-3",e),viewBox:"0 0 20 20",fill:"currentColor",children:[jsx("path",{d:"M10 14.5a1.5 1.5 0 100 3 1.5 1.5 0 000-3z"}),jsx("path",{fillRule:"evenodd",d:"M6.05 11.95a5.5 5.5 0 017.9 0 .75.75 0 001.08-1.04 7 7 0 00-10.06 0 .75.75 0 001.08 1.04z",clipRule:"evenodd"}),jsx("path",{fillRule:"evenodd",d:"M2.81 8.72a10 10 0 0114.38 0 .75.75 0 001.06-1.06 11.5 11.5 0 00-16.5 0 .75.75 0 001.06 1.06z",clipRule:"evenodd"})]}),p0=({className:e})=>jsxs("svg",{className:s("w-4 h-3",e),viewBox:"0 0 24 14",fill:"currentColor",children:[jsx("rect",{x:"0.5",y:"0.5",width:"20",height:"13",rx:"2",stroke:"currentColor",fill:"none",strokeWidth:"1"}),jsx("rect",{x:"22",y:"4",width:"2",height:"6",rx:"0.5"}),jsx("rect",{x:"2.5",y:"2.5",width:"14",height:"9",rx:"1"})]});function Po({time:e="9:41",theme:t,device:r}){let o=r==="watch",n=t==="dark"?"text-white":"text-gray-900";return o?jsx("div",{className:s("flex items-center justify-center py-0.5",n),style:{fontSize:"8px"},children:jsx("span",{className:"font-medium",children:e})}):jsxs("div",{className:s("flex items-center justify-between px-4 py-1",t==="dark"?"bg-black/20":"bg-white/20",n),style:{fontSize:"10px"},"data-testid":"status-bar",children:[jsx("span",{className:"font-semibold",children:e}),jsxs("div",{className:"flex items-center gap-1",children:[jsx(c0,{className:n}),jsx(u0,{className:n}),jsx(p0,{className:n})]})]})}function g0({theme:e}){let t=e==="dark";return jsxs("div",{className:s("flex items-center gap-2 px-3 py-2 border-b",t?"bg-gray-800 border-gray-700":"bg-gray-100 border-gray-200"),"data-testid":"browser-chrome",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-red-400"}),jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-yellow-400"}),jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-400"})]}),jsx("div",{className:s("flex-1 rounded-md px-3 py-1 text-center",t?"bg-gray-700 text-gray-400":"bg-white text-gray-500 border border-gray-200"),style:{fontSize:"11px"},children:jsxs("span",{className:"flex items-center justify-center gap-1",children:[jsx("svg",{className:"w-2.5 h-2.5",viewBox:"0 0 16 16",fill:"currentColor",children:jsx("path",{fillRule:"evenodd",d:"M8 1a4 4 0 00-4 4v3.5H3a1 1 0 00-1 1V14a1 1 0 001 1h10a1 1 0 001-1V9.5a1 1 0 00-1-1h-1V5a4 4 0 00-4-4zm2.5 7.5V5a2.5 2.5 0 00-5 0v3.5h5z",clipRule:"evenodd"})}),"example.com"]})})]})}function f0({children:e,theme:t,screenW:r,screenH:o,showStatusBar:n,statusBarTime:a,frameColor:i,landscape:c=false}){let d=t==="dark",l=i??(d?"#1a1a1a":"#e5e7eb");if(c){let u=Math.round(o*.35);return jsxs("div",{className:"relative inline-flex flex-row items-center rounded-[2.5rem] shadow-xl",style:{backgroundColor:l,padding:"8px 12px",height:o+16},"data-testid":"device-frame","data-device":"phone",children:[jsx("div",{className:s("rounded-full mr-2",d?"bg-gray-600":"bg-gray-400"),style:{width:4,height:Math.round(o*.35)},"data-testid":"home-indicator"}),jsxs("div",{className:"rounded-[2rem] overflow-hidden bg-black relative",style:{width:r,height:o},children:[n&&jsx(Po,{time:a,theme:t,device:"phone"}),e]}),jsx("div",{className:"absolute rounded-full bg-black z-10",style:{width:20,height:u,right:10,top:"50%",transform:"translateY(-50%)"},"data-testid":"phone-notch"})]})}let p=Math.round(r*.35);return jsxs("div",{className:"relative inline-flex flex-col items-center rounded-[2.5rem] shadow-xl",style:{backgroundColor:l,padding:"12px 8px",width:r+16},"data-testid":"device-frame","data-device":"phone",children:[jsx("div",{className:"absolute top-[10px] rounded-full bg-black z-10",style:{width:p,height:20,left:"50%",transform:"translateX(-50%)"},"data-testid":"phone-notch"}),jsxs("div",{className:"rounded-[2rem] overflow-hidden bg-black relative",style:{width:r,height:o},children:[n&&jsx(Po,{time:a,theme:t,device:"phone"}),e]}),jsx("div",{className:s("rounded-full mt-2",d?"bg-gray-600":"bg-gray-400"),style:{width:Math.round(r*.35),height:4},"data-testid":"home-indicator"})]})}function m0({children:e,theme:t,screenW:r,screenH:o,showStatusBar:n,statusBarTime:a,frameColor:i}){return jsxs("div",{className:"relative inline-flex flex-col items-center rounded-[2rem] shadow-xl",style:{backgroundColor:i??(t==="dark"?"#1a1a1a":"#e5e7eb"),padding:"10px 6px",width:r+12},"data-testid":"device-frame","data-device":"android",children:[jsx("div",{className:"absolute top-[6px] rounded-full bg-gray-800 z-10 border border-gray-700",style:{width:8,height:8,left:"50%",transform:"translateX(-50%)"},"data-testid":"camera-dot"}),jsxs("div",{className:"rounded-[1.5rem] overflow-hidden bg-black relative",style:{width:r,height:o},children:[n&&jsx(Po,{time:a,theme:t,device:"android"}),e]})]})}function b0({children:e,theme:t,screenW:r,screenH:o,showStatusBar:n,statusBarTime:a,frameColor:i}){return jsxs("div",{className:"relative inline-flex flex-col items-center rounded-[1.5rem] shadow-xl",style:{backgroundColor:i??(t==="dark"?"#1a1a1a":"#e5e7eb"),padding:"16px 12px",width:r+24},"data-testid":"device-frame","data-device":"tablet",children:[jsx("div",{className:"absolute top-[8px] rounded-full bg-gray-700 z-10",style:{width:6,height:6,left:"50%",transform:"translateX(-50%)"}}),jsxs("div",{className:"rounded-lg overflow-hidden bg-black relative",style:{width:r,height:o},children:[n&&jsx(Po,{time:a,theme:t,device:"tablet"}),e]})]})}function h0({children:e,theme:t,screenW:r,screenH:o,frameColor:n}){let a=t==="dark",i=n??(a?"#1a1a1a":"#d1d5db"),c=r+60;return jsxs("div",{className:"inline-flex flex-col items-center","data-testid":"device-frame","data-device":"laptop",children:[jsxs("div",{className:"rounded-t-xl shadow-xl relative",style:{backgroundColor:i,padding:"8px 8px 0",width:r+16},children:[jsx("div",{className:"absolute top-[3px] rounded-full bg-gray-700 z-10",style:{width:4,height:4,left:"50%",transform:"translateX(-50%)"}}),jsx("div",{className:"rounded-t-sm overflow-hidden bg-black",style:{width:r,height:o},children:e})]}),jsx("div",{className:s(a?"bg-gray-800":"bg-gray-400"),style:{width:r+16,height:3}}),jsx("div",{className:"rounded-b-xl shadow-lg",style:{backgroundColor:i,width:c,height:12,clipPath:"polygon(3% 0%, 97% 0%, 100% 100%, 0% 100%)"},"data-testid":"laptop-base"})]})}function y0({children:e,theme:t,screenW:r,screenH:o,frameColor:n}){let a=t==="dark";return jsxs("div",{className:"inline-flex flex-col items-center","data-testid":"device-frame","data-device":"desktop",children:[jsx("div",{className:"rounded-lg shadow-xl",style:{backgroundColor:n??(a?"#1a1a1a":"#d1d5db"),padding:"8px 8px 20px",width:r+16},children:jsx("div",{className:"rounded-sm overflow-hidden bg-black",style:{width:r,height:o},children:e})}),jsx("div",{className:s(a?"bg-gray-800":"bg-gray-400"),style:{width:40,height:24},"data-testid":"monitor-stand"}),jsx("div",{className:s("rounded-t-sm",a?"bg-gray-800":"bg-gray-400"),style:{width:Math.round(r*.4),height:6,borderRadius:"2px 2px 4px 4px"}})]})}function x0({children:e,theme:t,screenW:r,screenH:o,showStatusBar:n,statusBarTime:a,frameColor:i}){let c=t==="dark",d=i??(c?"#1a1a1a":"#d1d5db"),l=Math.round(r*.7);return jsxs("div",{className:"inline-flex flex-col items-center","data-testid":"device-frame","data-device":"watch",children:[jsx("div",{className:s("rounded-t-lg",c?"bg-gray-800":"bg-gray-400"),style:{width:l,height:30},"data-testid":"watch-band"}),jsxs("div",{className:"relative rounded-[1.2rem] shadow-xl",style:{backgroundColor:d,padding:"8px 6px",width:r+12},children:[jsx("div",{className:s("absolute rounded-sm",c?"bg-gray-600":"bg-gray-400"),style:{width:4,height:16,right:-4,top:"30%"},"data-testid":"watch-crown"}),jsxs("div",{className:"rounded-xl overflow-hidden bg-black",style:{width:r,height:o},children:[n&&jsx(Po,{time:a,theme:t,device:"watch"}),e]})]}),jsx("div",{className:s("rounded-b-lg",c?"bg-gray-800":"bg-gray-400"),style:{width:l,height:30}})]})}function v0({children:e,theme:t,screenW:r,screenH:o,frameColor:n}){return jsxs("div",{className:"inline-flex flex-col rounded-lg shadow-xl overflow-hidden",style:{backgroundColor:n??(t==="dark"?"#1f2937":"#f3f4f6"),width:r},"data-testid":"device-frame","data-device":"browser",children:[jsx(g0,{theme:t}),jsx("div",{className:"overflow-hidden bg-white",style:{width:r,height:o},children:e})]})}function w0({device:e="phone",src:t,alt:r="Device screen content",children:o,orientation:n="portrait",theme:a="dark",size:i="md",showStatusBar:c=false,statusBarTime:d,animated:l=false,scrollSpeed:p=30,frameColor:u,className:m,contentClassName:g}){let f=useRef(null),h=useRef(null),b=d0[e][i],x=n==="landscape"&&e!=="watch"&&e!=="browser",v=x?b.h:b.w,k=x?b.w:b.h;useEffect(()=>{if(!l||!f.current)return;let z=f.current,N=null,L=A=>{N===null&&(N=A);let G=(A-N)/1e3;N=A,z.scrollTop+=p*G,z.scrollTop>=z.scrollHeight-z.clientHeight&&(z.scrollTop=0),h.current=requestAnimationFrame(L);};return h.current=requestAnimationFrame(L),()=>{h.current!==null&&cancelAnimationFrame(h.current);}},[l,p]);let R=jsx("div",{ref:l?f:void 0,className:s("w-full h-full overflow-hidden",l&&"overflow-y-auto scrollbar-hide",g),style:l?{scrollBehavior:"auto"}:void 0,children:t?jsx("img",{src:t,alt:r,className:"w-full h-auto object-cover",draggable:false}):o}),S={showStatusBar:c,statusBarTime:d},E=()=>{switch(e){case "phone":return jsx(f0,{theme:a,screenW:v,screenH:k,frameColor:u,landscape:x,...S,children:R});case "android":return jsx(m0,{theme:a,screenW:v,screenH:k,frameColor:u,...S,children:R});case "tablet":return jsx(b0,{theme:a,screenW:v,screenH:k,frameColor:u,...S,children:R});case "laptop":return jsx(h0,{theme:a,screenW:v,screenH:k,frameColor:u,children:R});case "desktop":return jsx(y0,{theme:a,screenW:v,screenH:k,frameColor:u,children:R});case "watch":return jsx(x0,{theme:a,screenW:v,screenH:k,frameColor:u,...S,children:R});case "browser":return jsx(v0,{theme:a,screenW:v,screenH:k,frameColor:u,children:R})}};return jsx("div",{className:s("inline-flex",m),"data-testid":"device-mockup","data-orientation":n,"data-theme":a,"data-size":i,children:E()})}var k0={default:"stroke-gray-500 dark:stroke-gray-400",primary:"stroke-blue-600 dark:stroke-blue-500",success:"stroke-green-600 dark:stroke-green-500",warning:"stroke-yellow-500 dark:stroke-yellow-400",error:"stroke-red-600 dark:stroke-red-500",info:"stroke-cyan-600 dark:stroke-cyan-500"},C0={default:"text-gray-700 dark:text-gray-300",primary:"text-blue-600 dark:text-blue-400",success:"text-green-600 dark:text-green-400",warning:"text-yellow-600 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",info:"text-cyan-600 dark:text-cyan-400"},N0={xs:24,sm:32,md:48,lg:64,xl:96},S0={xs:"text-[8px]",sm:"text-[10px]",md:"text-sm",lg:"text-base",xl:"text-xl"},R0={thin:2,normal:4,thick:8};function Xs({value:e=0,indeterminate:t=false,size:r="md",thickness:o="normal",color:n="primary",progressColor:a,trackColor:i,showValue:c=false,children:d,valueFormat:l,animated:p=true,className:u,...m}){let g=Math.min(100,Math.max(0,e)),f=N0[r],h=R0[o],b=(f-h)/2,x=2*Math.PI*b,v=f/2,k=x-g/100*x,R=a||k0[n],S=i||"stroke-gray-200 dark:stroke-gray-700",E=C0[n],z=d??(c&&!t?jsx("span",{className:s("font-semibold",S0[r],E),children:l?l(g):`${Math.round(g)}%`}):null);return jsxs("div",{className:s("relative inline-flex items-center justify-center",u),role:"progressbar","aria-valuenow":t?void 0:g,"aria-valuemin":0,"aria-valuemax":100,...m,children:[jsxs("svg",{width:f,height:f,viewBox:`0 0 ${f} ${f}`,className:s(t&&"animate-spin"),style:{transform:"rotate(-90deg)"},children:[jsx("circle",{cx:v,cy:v,r:b,fill:"none",strokeWidth:h,className:S}),jsx("circle",{cx:v,cy:v,r:b,fill:"none",strokeWidth:h,strokeLinecap:"round",strokeDasharray:x,strokeDashoffset:t?x*.75:k,className:s(R,p&&!t&&"transition-[stroke-dashoffset] duration-300 ease-out")})]}),z&&jsx("div",{className:"absolute inset-0 flex items-center justify-center",style:{transform:"rotate(0deg)"},children:z})]})}Xs.displayName="CircularProgress";var fn={solid:"border-solid",dashed:"border-dashed",dotted:"border-dotted"},T0={left:{before:"flex-[0.1]",after:"flex-1"},center:{before:"flex-1",after:"flex-1"},right:{before:"flex-1",after:"flex-[0.1]"}};function js({orientation:e="horizontal",variant:t="solid",label:r,textAlign:o="center",thickness:n=1,color:a="border-gray-300 dark:border-gray-700",spacing:i,className:c,...d}){if(e==="vertical")return jsx("hr",{"aria-orientation":"vertical",className:s("h-full border-l-0 border-r",fn[t],a,i||"mx-2",c),style:{borderRightWidth:`${n}px`},...d});if(r){let l=T0[o];return jsxs("div",{role:"separator","aria-orientation":"horizontal",className:s("flex items-center text-sm text-gray-500 dark:text-gray-400",i||"my-4",c),...d,children:[jsx("div",{className:s("border-t",fn[t],a,l.before),style:{borderTopWidth:`${n}px`}}),jsx("span",{className:"px-3 whitespace-nowrap",children:r}),jsx("div",{className:s("border-t",fn[t],a,l.after),style:{borderTopWidth:`${n}px`}})]})}return jsx("hr",{"aria-orientation":"horizontal",className:s("border-t-0 border-b",fn[t],a,i||"my-4",c),style:{borderBottomWidth:`${n}px`},...d})}js.displayName="Divider";var D0=new Set(["SCRIPT","STYLE","LINK","META","NOSCRIPT","TEMPLATE","BASE","TITLE"]),qs="data-synertech-inert-ignore",zo=new WeakMap,ca=new WeakMap,ua=new WeakMap;function I0(e){let t=zo.get(e)??0;t===0&&(ca.set(e,e.getAttribute("aria-hidden")),ua.set(e,e.hasAttribute("inert")),e.setAttribute("aria-hidden","true"),e.setAttribute("inert","")),zo.set(e,t+1);}function M0(e){let t=zo.get(e)??0;if(t===0)return;if(t>1){zo.set(e,t-1);return}zo.delete(e);let r=ca.get(e)??null;r===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r),ca.delete(e),ua.get(e)||e.removeAttribute("inert"),ua.delete(e);}var mn=new Map;function $r(e,t){return mn.set(e,t),()=>{mn.delete(e);}}function bn(e){if(mn.size===0)return [];let t=[];for(let[r,o]of mn){let n=o();n&&e.some(a=>a.contains(n))&&t.push(r);}return t}function P0(e){return !(D0.has(e.tagName)||e.hasAttribute(qs))}function pa(e){let t=(Array.isArray(e)?e:[e]).filter(Boolean),r=t[0]?.ownerDocument?.body;if(!r||!t.every(d=>r.contains(d)))return ()=>{};let o=[...t,...bn(t).filter(d=>r.contains(d))],n=[],a=new Set,i=d=>o.some(l=>d===l||d.contains(l));for(let d of t){let l=d;for(;l&&l!==r;){let p=l.parentElement;if(!p)break;for(let u of Array.from(p.children))a.has(u)||i(u)||P0(u)&&(a.add(u),I0(u),n.push(u));l=p;}}let c=false;return ()=>{if(!c){c=true;for(let d of n)M0(d);}}}var Er=[];function Js(e){let t=Er.indexOf(e);t!==-1&&Er.splice(t,1),Er.push(e);}function Zs(e){let t=Er.indexOf(e);t!==-1&&Er.splice(t,1);}function Qs(e){return Er.length>0&&Er[Er.length-1]===e}var Ao=0,ga=null;function ei(e=document){let t=e.body;if(!t)return ()=>{};Ao===0&&(ga=t.style.overflow,t.style.overflow="hidden"),Ao+=1;let r=false;return ()=>{r||(r=true,Ao=Math.max(0,Ao-1),Ao===0&&(t.style.overflow=ga??"",ga=null));}}var ti=["a[href]","area[href]","button","input","select","textarea","details > summary:first-of-type","iframe","object","embed","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"[tabindex]"].join(",");function L0(e){let t=e.ownerDocument?.defaultView;if(!t)return null;try{return t.getComputedStyle(e)}catch{return null}}function ri(e){let t=e;for(;t;){if(t.hasAttribute("hidden")||t.hasAttribute("inert")||t.getAttribute("aria-hidden")==="true")return false;let r=L0(t);if(r&&(r.display==="none"||r.visibility==="hidden"||r.visibility==="collapse"))return false;t=t.parentElement;}return true}function oi(e){if(e.hasAttribute("disabled")||e.getAttribute("tabindex")==="-1")return false;let t=e.closest("fieldset[disabled]");if(t){let r=t.querySelector("legend");if(!r||!r.contains(e))return false}return ri(e)}function hn(e){return Array.from(e.querySelectorAll(ti)).filter(oi).sort((r,o)=>{let n=r.compareDocumentPosition(o);return n&Node.DOCUMENT_POSITION_FOLLOWING?-1:n&Node.DOCUMENT_POSITION_PRECEDING?1:0})}var z0={role:"dialog","aria-modal":true,tabIndex:-1};function A0(e,t){return t==="none"?null:t&&typeof t=="object"?t.current??e:t==="first"?hn(e)[0]??e:e}function W0(e){return e?e.map(t=>t&&"current"in t?t.current:t).filter(t=>!!t):[]}function ao(e){if(e)try{e.focus();}catch{}}function Ur(e){let{open:t}=e,r=useRef(null),o=useRef(e);return o.current=e,useEffect(()=>{if(!t)return;let n=r.current;if(!n)return;let a=n.ownerDocument,i=a.activeElement,{hideBackground:c,lockScroll:d,initialFocus:l,keepInteractive:p}=o.current;Js(n);let u=c===false?void 0:pa([n,...W0(p)]),m=d===false?void 0:ei(a);return ao(A0(n,l)),()=>{u?.(),m?.(),Zs(n);let{returnFocus:g}=o.current;if(g===false)return;let f=a.activeElement;if(!(!f||f===a.body||n.contains(f)))return;let b=g&&typeof g=="object"?g.current:i;b&&a.contains(b)&&ao(b);}},[t]),useEffect(()=>{if(!t)return;let n=r.current;if(!n)return;let a=n.ownerDocument,i=a.defaultView??a,c=l=>l?n.contains(l)?true:bn([n]).some(p=>p.contains(l)):false,d=l=>{if(l.defaultPrevented||!Qs(n))return;let{closeOnEscape:p,trapFocus:u,onClose:m}=o.current;if(l.key==="Escape"){if(p===false)return;l.preventDefault(),m?.();return}if(l.key!=="Tab"||u===false)return;let g=a.activeElement;if(g&&!n.contains(g)&&c(g))return;let f=hn(n);if(f.length===0){l.preventDefault(),ao(n);return}let h=f[0],b=f[f.length-1];if(!g||!n.contains(g)){l.preventDefault(),ao(l.shiftKey?b:h);return}if(l.shiftKey&&(g===h||g===n)){l.preventDefault(),ao(b);return}!l.shiftKey&&g===b&&(l.preventDefault(),ao(h));};return i.addEventListener("keydown",d),()=>i.removeEventListener("keydown",d)},[t]),{dialogRef:r,dialogProps:z0}}var ii={closeModal:"Close modal",closeDrawer:"Close drawer",closeSidebar:"Close sidebar",openSidebar:"Open sidebar",expandSidebar:"Expand sidebar",collapseSidebar:"Collapse sidebar",sidebar:"Sidebar",enterFullScreen:"Enter full screen",exitFullScreen:"Exit full screen",confirm:"Confirm",cancel:"Cancel",markdownEditorLoading:"Loading the editor\u2026",markdownEditorUnavailable:"Markdown editor unavailable. Install @mdxeditor/editor to enable it."},B0={closeModal:"Fermer la fen\xEAtre",closeDrawer:"Fermer le panneau",closeSidebar:"Fermer le menu lat\xE9ral",openSidebar:"Ouvrir le menu lat\xE9ral",expandSidebar:"D\xE9plier le menu lat\xE9ral",collapseSidebar:"Replier le menu lat\xE9ral",sidebar:"Menu lat\xE9ral",enterFullScreen:"Passer en plein \xE9cran",exitFullScreen:"Quitter le plein \xE9cran",confirm:"Confirmer",cancel:"Annuler",markdownEditorLoading:"Chargement de l'\xE9diteur\u2026",markdownEditorUnavailable:"\xC9diteur Markdown indisponible. Installez @mdxeditor/editor pour l'activer."},fa=createContext(ii);function O0({labels:e,children:t}){let r=useContext(fa),o=useMemo(()=>({...r,...e}),[r,e]);return jsx(fa.Provider,{value:o,children:t})}function Gt(){return useContext(fa)}var K0={left:{sm:"w-64",md:"w-80",lg:"w-96",xl:"w-[32rem]",full:"w-full",half:"w-1/2 h-full"},right:{sm:"w-64",md:"w-80",lg:"w-96",xl:"w-[32rem]",full:"w-full",half:"w-1/2 h-full"},top:{sm:"h-64",md:"h-80",lg:"h-96",xl:"h-[32rem]",full:"h-full",half:"w-1/2 h-full"},bottom:{sm:"h-64",md:"h-80",lg:"h-96",xl:"h-[32rem]",full:"h-full",half:"w-1/2 h-full"}},Y0={left:"left-0 top-0 bottom-0",right:"right-0 top-0 bottom-0",top:"top-0 left-0 right-0",bottom:"bottom-0 left-0 right-0"},li={left:{enter:"animate-in slide-in-from-left duration-300",exit:"animate-out slide-out-to-left duration-200"},right:{enter:"animate-in slide-in-from-right duration-300",exit:"animate-out slide-out-to-right duration-200"},top:{enter:"animate-in slide-in-from-top duration-300",exit:"animate-out slide-out-to-top duration-200"},bottom:{enter:"animate-in slide-in-from-bottom duration-300",exit:"animate-out slide-out-to-bottom duration-200"}},X0=jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})});function di({open:e,onClose:t,children:r,position:o="right",size:n="md",customWidth:a,customHeight:i,showOverlay:c=true,closeOnOverlayClick:d=true,closeOnEscape:l=true,title:p,footer:u,className:m,overlayClassName:g,closeLabel:f,"aria-label":h,trapFocus:b=true,initialFocus:x,returnFocus:v,lockScroll:k=true}){let R=!!(a||i),S=useRef(null),E=Gt(),N=`${useId()}-drawer-title`,{dialogRef:L,dialogProps:A}=Ur({open:e,onClose:t,closeOnEscape:l,trapFocus:b,initialFocus:x,returnFocus:v,lockScroll:k,keepInteractive:[S]}),G=useCallback(()=>{d&&t();},[d,t]);if(!e)return null;let q=jsxs(Fragment,{children:[c&&jsx("div",{ref:S,className:s("fixed inset-0 bg-black/50 z-40 transition-opacity",e?"animate-in fade-in duration-200":"animate-out fade-out duration-150",g),onClick:G,"aria-hidden":"true"}),jsxs("div",{ref:L,...A,"aria-labelledby":p?N:void 0,"aria-label":p?void 0:h,className:s("fixed z-50 bg-white dark:bg-gray-900","shadow-xl overflow-hidden","flex flex-col focus:outline-none",Y0[o],!R&&K0[o][n],e?li[o].enter:li[o].exit,m),style:{...a?{width:a}:{},...i?{height:i}:{}},children:[p&&jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 dark:border-gray-700",children:[jsx("h2",{id:N,className:"text-lg font-semibold text-gray-900 dark:text-white",children:p}),jsx("button",{type:"button",onClick:t,className:s("rounded-lg p-1.5 text-gray-400 hover:bg-gray-100 hover:text-gray-900","dark:hover:bg-gray-800 dark:hover:text-white","focus:outline-none focus:ring-2 focus:ring-gray-300 dark:focus:ring-gray-600"),"aria-label":f??E.closeDrawer,children:X0})]}),jsx("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:r}),u&&jsx("div",{className:"px-6 py-4 border-t border-gray-200 dark:border-gray-700",children:u})]})]});return typeof document<"u"?createPortal(q,document.body):q}di.displayName="Drawer";var Z0={sm:{dropzone:"py-4 px-3",text:"text-xs",subtext:"text-[10px]",icon:"w-6 h-6",button:"px-2.5 py-1.5 text-xs",fileItem:"py-1 px-2 text-xs",gap:"gap-1"},md:{dropzone:"py-6 px-4",text:"text-sm",subtext:"text-xs",icon:"w-8 h-8",button:"px-3 py-2 text-sm",fileItem:"py-1.5 px-3 text-sm",gap:"gap-1.5"},lg:{dropzone:"py-8 px-6",text:"text-base",subtext:"text-sm",icon:"w-10 h-10",button:"px-4 py-2.5 text-base",fileItem:"py-2 px-4 text-base",gap:"gap-2"}},gi=e=>{if(e===0)return "0 B";let t=["B","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(1024));return `${(e/Math.pow(1024,r)).toFixed(r===0?0:1)} ${t[r]}`},ba=e=>e.webkitRelativePath||e.name,Q0=jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-full h-full",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5m-13.5-9L12 3m0 0l4.5 4.5M12 3v13.5"})}),ep=jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-full h-full",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 00-1.883 2.542l.857 6a2.25 2.25 0 002.227 1.932H19.05a2.25 2.25 0 002.227-1.932l.857-6a2.25 2.25 0 00-1.883-2.542m-16.5 0V6A2.25 2.25 0 016 3.75h3.879a1.5 1.5 0 011.06.44l2.122 2.12a1.5 1.5 0 001.06.44H18A2.25 2.25 0 0120.25 9v.776"})}),tp=0;async function rp(e){let t=[],r=async o=>{if(o.isFile){let n=await new Promise((a,i)=>o.file(a,i));t.push(n);}else if(o.isDirectory){let n=o.createReader(),a=()=>new Promise((c,d)=>n.readEntries(c,d)),i=await a();for(;i.length>0;){for(let c of i)await r(c);i=await a();}}};for(let o of e)await r(o);return t}function op({value:e,onChange:t,accept:r,multiple:o=false,maxSize:n=10*1024*1024,maxFiles:a,mode:i="file",variant:c="dropzone",size:d="md",disabled:l=false,readOnly:p=false,label:u,helperText:m,error:g,showFileList:f=true,placeholder:h,browseLabel:b,browseFolderLabel:x,icon:v,onReject:k,className:R}){let[S,E]=useState([]),[z,N]=useState(false),L=useRef(null),A=useRef(null),G=useId(),q=e!==void 0,M=q?e.map((B,ee)=>({file:B,id:`ctrl-${ee}`})):S,O=Z0[d];useEffect(()=>{i==="directory"&&L.current&&L.current.setAttribute("webkitdirectory",""),i==="both"&&A.current&&A.current.setAttribute("webkitdirectory","");},[i]);let P=useMemo(()=>gi(n),[n]),y=useMemo(()=>r?r.split(",").map(B=>B.trim()).map(B=>B.startsWith(".")?B.toUpperCase():B.endsWith("/*")?B.replace("/*","").toUpperCase():B).join(", "):"All files",[r]),T=i==="directory"?"Drag & drop a folder here, or":i==="both"?"Drag & drop files or folders here, or":o?"Drag & drop files here, or":"Drag & drop a file here, or",I=i==="directory"?"Browse folder":"Browse",oe="Browse folder",ie=useCallback(B=>{if(B.size>n)return `File exceeds maximum size of ${P}`;if(r){let ee=r.split(",").map(j=>j.trim()),me=`.${B.name.split(".").pop()?.toLowerCase()}`;if(!ee.some(j=>j.startsWith(".")?me===j.toLowerCase():j.endsWith("/*")?B.type.startsWith(j.replace("/*","/")):B.type===j))return `File type not accepted. Expected: ${y}`}return null},[r,y,n,P]),we=useCallback(B=>{if(l||p)return;let ee=Array.from(B),me=[];for(let Se of ee){let j=ie(Se);j?k?.(Se,j):me.push(Se);}if(me.length!==0)if(q)if(o){let j=[...e??[],...me],Te=a?j.slice(0,a):j;t?.(Te);}else t?.([me[0]]);else E(Se=>{let j=me.map(Te=>({file:Te,id:`file-${++tp}`}));if(o){let Te=[...Se,...j],Pe=a?Te.slice(0,a):Te,et=Pe.map(at=>at.file);return t?.(et),Pe}return t?.([me[0]]),[j[0]]});},[l,p,q,o,a,e,t,k,ie]),he=useCallback(B=>{if(!(l||p)){if(q){let ee=(e??[]).filter((me,Se)=>Se!==B);t?.(ee);}else E(ee=>{let me=ee.filter((Se,j)=>j!==B);return t?.(me.map(Se=>Se.file)),me});L.current&&(L.current.value="");}},[l,p,q,e,t]),F=useCallback(()=>{l||p||(q?t?.([]):(E([]),t?.([])),L.current&&(L.current.value=""));},[l,p,q,t]),Q=useCallback(B=>{B.target.files&&B.target.files.length>0&&we(B.target.files);},[we]),ae=useCallback(B=>{B.preventDefault(),B.stopPropagation(),!l&&!p&&N(true);},[l,p]),ye=useCallback(B=>{B.preventDefault(),B.stopPropagation(),N(false);},[]),xe=useCallback(B=>{if(B.preventDefault(),B.stopPropagation(),N(false),l||p)return;let ee=B.dataTransfer.items;if(ee&&ee.length>0&&(i==="directory"||i==="both")){let me=[];for(let j=0;j<ee.length;j++){let Te=ee[j].webkitGetAsEntry?.();Te&&me.push(Te);}if(me.some(j=>j.isDirectory)){rp(me).then(j=>{j.length>0&&we(j);});return}}B.dataTransfer.files&&B.dataTransfer.files.length>0&&we(B.dataTransfer.files);},[l,p,i,we]),le=useCallback(()=>{!l&&!p&&L.current?.click();},[l,p]),X=useCallback(()=>{!l&&!p&&A.current?.click();},[l,p]),C=M.length>0,$=v||(i==="directory"?ep:Q0),ge=f&&C&&jsxs("div",{className:s("flex flex-col",O.gap),children:[M.map((B,ee)=>jsxs("div",{className:s("flex items-center justify-between rounded-md border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",O.fileItem),children:[jsxs("div",{className:"flex items-center gap-2 min-w-0 flex-1",children:[jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4 shrink-0 text-gray-400 dark:text-gray-500",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"})}),jsx("span",{className:"truncate text-gray-700 dark:text-gray-300",children:ba(B.file)}),jsxs("span",{className:"shrink-0 text-gray-400 dark:text-gray-500",children:["(",gi(B.file.size),")"]})]}),!l&&!p&&jsx("button",{type:"button",onClick:()=>he(ee),className:"shrink-0 ml-2 text-gray-400 hover:text-red-500 dark:text-gray-500 dark:hover:text-red-400 transition-colors cursor-pointer","aria-label":`Remove ${ba(B.file)}`,children:jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor",className:"w-4 h-4",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]},B.id)),o&&M.length>1&&!l&&!p&&jsx("button",{type:"button",onClick:F,className:s("self-start text-gray-400 hover:text-red-500 dark:text-gray-500 dark:hover:text-red-400 transition-colors cursor-pointer",O.subtext),children:"Remove all"})]}),te=s("rounded-md border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200 font-medium transition-colors","hover:bg-gray-50 dark:hover:bg-gray-700","disabled:opacity-50 disabled:cursor-not-allowed cursor-pointer","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1",O.button,g&&"border-red-300 dark:border-red-600");return jsxs("div",{className:s("flex flex-col",O.gap,R),children:[u&&jsx("label",{htmlFor:G,className:s("block font-medium text-gray-700 dark:text-gray-300",O.text),children:u}),jsx("input",{ref:L,id:G,type:"file",accept:i!=="directory"?r:void 0,multiple:o,onChange:Q,className:"sr-only",disabled:l||p,"aria-describedby":g?`${G}-error`:m?`${G}-helper`:void 0,"aria-invalid":!!g}),i==="both"&&jsx("input",{ref:A,type:"file",onChange:Q,className:"sr-only",disabled:l||p,tabIndex:-1,"aria-hidden":"true"}),c==="dropzone"?jsxs("div",{role:i==="both"?"group":"button",tabIndex:i==="both"?void 0:l||p?-1:0,onClick:i==="both"?void 0:le,onKeyDown:i==="both"?void 0:B=>{(B.key==="Enter"||B.key===" ")&&(B.preventDefault(),le());},onDragOver:ae,onDragLeave:ye,onDrop:xe,className:s("flex flex-col items-center justify-center rounded-lg border-2 border-dashed transition-colors",O.dropzone,z&&!l&&!p?"border-blue-500 bg-blue-50 dark:bg-blue-900/20":"border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-800",!l&&!p&&"hover:border-blue-400 dark:hover:border-blue-500 hover:bg-gray-50 dark:hover:bg-gray-800/70",i!=="both"&&!l&&!p&&"cursor-pointer",l&&"opacity-50 cursor-not-allowed",p&&"cursor-default",g&&"border-red-300 dark:border-red-600"),"aria-label":i==="both"?"File and folder drop zone":h||T,children:[jsx("div",{className:s("text-gray-400 dark:text-gray-500 mb-2",O.icon,z&&"text-blue-500 dark:text-blue-400"),children:$}),jsxs("p",{className:s("text-gray-600 dark:text-gray-400",O.text),children:[h||T," ",!l&&!p&&i!=="both"&&jsx("span",{className:"text-blue-600 dark:text-blue-400 font-medium",children:b||I})]}),i==="both"&&!l&&!p&&jsxs("div",{className:s("flex items-center gap-3 mt-1",O.text),children:[jsx("button",{type:"button",onClick:le,className:"text-blue-600 dark:text-blue-400 font-medium hover:underline cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded",children:b||"Browse files"}),jsx("span",{className:"text-gray-300 dark:text-gray-600",children:"\xB7"}),jsx("button",{type:"button",onClick:X,className:"text-blue-600 dark:text-blue-400 font-medium hover:underline cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 rounded",children:x||oe})]}),jsxs("p",{className:s("text-gray-400 dark:text-gray-500 mt-1",O.subtext),children:[y," - Max ",P,o&&a&&` - Up to ${a} files`]})]}):jsxs("div",{className:"flex items-center gap-2",children:[i==="both"?jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:le,disabled:l||p,className:te,children:b||(C?"Change files":"Choose files")}),jsx("button",{type:"button",onClick:X,disabled:l||p,className:te,children:x||"Choose folder"})]}):jsx("button",{type:"button",onClick:le,disabled:l||p,className:te,children:b||(i==="directory"?C?"Change folder":"Choose folder":C?"Change file":"Choose file")}),!C&&jsx("span",{className:s("text-gray-400 dark:text-gray-500",O.text),children:i==="directory"?"No folder selected":i==="both"?"No file or folder selected":"No file selected"}),C&&!f&&jsx("span",{className:s("text-gray-600 dark:text-gray-400 truncate",O.text),children:M.length===1?ba(M[0].file):`${M.length} files selected`})]}),ge,g&&jsx("p",{id:`${G}-error`,className:s("text-red-600 dark:text-red-400",O.subtext),role:"alert",children:g}),m&&!g&&jsx("p",{id:`${G}-helper`,className:s("text-gray-400 dark:text-gray-500",O.subtext),children:m})]})}var bi=createContext(null);function Lt(){let e=useContext(bi);if(!e)throw new Error("Dropdown compound components must be used within a Dropdown");return e}function hi({open:e,defaultOpen:t=false,onOpenChange:r,closeOnSelect:o=true,closeOnClickOutside:n=true,closeOnEscape:a=true,modal:i=false,children:c}){let[d,l]=useState(t),p=e!==void 0,u=p?e:d,m=useRef(null),g=useRef(null),f=useRef([]),[h,b]=useState(-1),x=useRef(0),v=useId(),k={triggerId:`dropdown-trigger-${v}`,contentId:`dropdown-content-${v}`},R=useCallback(N=>{p||l(N),r?.(N),N||b(-1);},[p,r]),S=useCallback((N,L)=>{f.current&&(f.current[N]=L);},[]),E=useCallback(()=>x.current++,[]),z={isOpen:u,setIsOpen:R,triggerRef:m,contentRef:g,closeOnSelect:o,closeOnClickOutside:n,closeOnEscape:a,modal:i,focusedIndex:h,setFocusedIndex:b,itemsRef:f,registerItem:S,getNextItemIndex:E,triggerId:k.triggerId,contentId:k.contentId};return jsx(bi.Provider,{value:z,children:jsx("div",{className:"relative inline-block",children:c})})}hi.displayName="Dropdown";var yi=memo(({isOpen:e})=>jsx("span",{className:s("inline-block transition-transform",e&&"rotate-180"),children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})}));yi.displayName="ChevronIcon";function xi({asChild:e=false,disabled:t=false,children:r,className:o}){let{isOpen:n,setIsOpen:a,triggerRef:i,triggerId:c,contentId:d}=Lt(),u={ref:i,id:c,"aria-haspopup":"menu","aria-expanded":n,"aria-controls":n?d:void 0,disabled:t,onClick:()=>{t||a(!n);},onKeyDown:m=>{t||((m.key==="Enter"||m.key===" ")&&(m.preventDefault(),a(!n)),m.key==="ArrowDown"&&!n&&(m.preventDefault(),a(true)));}};return e&&isValidElement(r)?cloneElement(r,{...u,className:s(r.props.className,o)}):jsxs("button",{type:"button",...u,className:s("inline-flex items-center justify-center gap-2","rounded-md px-4 py-2","bg-white border border-gray-300","text-sm font-medium text-gray-700","hover:bg-gray-50","focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2","disabled:opacity-50 disabled:cursor-not-allowed","transition-colors",o),children:[r,jsx(yi,{isOpen:n})]})}xi.displayName="DropdownTrigger";function so(e){let t=useRef(e);return useLayoutEffect(()=>{t.current=e;}),t}function io(e,t,r=true){let o=so(t);useEffect(()=>{if(!r)return;let n=a=>{let i=a.target;!e.current||e.current.contains(i)||o.current();};return document.addEventListener("mousedown",n),document.addEventListener("touchstart",n,{passive:true}),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("touchstart",n);}},[r,o,e]);}function lo({triggerRef:e,contentRef:t,isOpen:r,side:o="bottom",align:n="start",sideOffset:a=4,alignOffset:i=0,avoidCollisions:c=true,collisionPadding:d=8}){let[l,p]=useState({top:0,left:0,actualSide:o,actualAlign:n,isReady:false}),u=useRef(false),m=useCallback(()=>{if(!e.current||!t.current)return;let g=e.current.getBoundingClientRect(),f=t.current.getBoundingClientRect();if(!(g.width>0&&g.height>0&&f.width>0&&f.height>0)){u.current=false;return}let b={width:window.innerWidth,height:window.innerHeight},x=o,v=n,k=E=>{switch(E){case "bottom":return {top:g.bottom+a,left:g.left};case "top":return {top:g.top-f.height-a,left:g.left};case "right":return {top:g.top,left:g.right+a};case "left":return {top:g.top,left:g.left-f.width-a}}},R=(E,z,N)=>{if(E==="top"||E==="bottom")switch(z){case "start":return {...N,left:g.left+i};case "center":return {...N,left:g.left+g.width/2-f.width/2+i};case "end":return {...N,left:g.right-f.width+i}}else switch(z){case "start":return {...N,top:g.top+i};case "center":return {...N,top:g.top+g.height/2-f.height/2+i};case "end":return {...N,top:g.bottom-f.height+i}}},S=k(x);if(S=R(x,v,S),c){let{top:E,left:z}=S,{height:N,width:L}=f,{height:A,width:G}=b,q=E+N>A-d,M=E<d,O=z+L>G-d,P=z<d;x==="bottom"&&q&&!M?(x="top",S=k(x),S=R(x,v,S)):x==="top"&&M&&!q&&(x="bottom",S=k(x),S=R(x,v,S)),x==="right"&&O&&!P?(x="left",S=k(x),S=R(x,v,S)):x==="left"&&P&&!O&&(x="right",S=k(x),S=R(x,v,S));let y=S.left+L>G-d,T=S.left<d,I=S.top+N>A-d,oe=S.top<d;(x==="top"||x==="bottom")&&(y&&(S.left=G-L-d,v="end"),T&&(S.left=d,v="start")),(x==="left"||x==="right")&&(I&&(S.top=A-N-d,v="end"),oe&&(S.top=d,v="start"));}u.current=true,p({top:S.top,left:S.left,actualSide:x,actualAlign:v,isReady:true});},[e,t,o,n,a,i,c,d]);return useLayoutEffect(()=>{let g=0;if(r){u.current=false;let h=()=>{m(),u.current||(g=requestAnimationFrame(h));};g=requestAnimationFrame(h);}let f=()=>m();return window.addEventListener("resize",f),window.addEventListener("scroll",f,{passive:true,capture:true}),()=>{g&&cancelAnimationFrame(g),window.removeEventListener("resize",f),window.removeEventListener("scroll",f,{capture:true});}},[m,r]),l}function vn({isOpen:e,onClose:t,itemsCount:r,focusedIndex:o,setFocusedIndex:n,onSelect:a,loop:i=true}){let c=so(t),d=so(a),l=so(o),p=useCallback(u=>{if(!(!e||r===0))switch(u.key){case "ArrowDown":u.preventDefault(),n(i?m=>m<r-1?m+1:0:m=>Math.min(m+1,r-1));break;case "ArrowUp":u.preventDefault(),n(i?m=>m>0?m-1:r-1:m=>Math.max(m-1,0));break;case "Home":u.preventDefault(),n(0);break;case "End":u.preventDefault(),n(r-1);break;case "Enter":case " ":u.preventDefault(),d.current?.(l.current);break;case "Escape":u.preventDefault(),c.current();break;case "Tab":c.current();break}},[e,r,n,i,c,d,l]);return useEffect(()=>{if(e)return document.addEventListener("keydown",p),()=>document.removeEventListener("keydown",p)},[e,p]),{focusedIndex:o}}function wi(e,t,r){useEffect(()=>{r&&e.current&&e.current[t]&&e.current[t]?.focus();},[t,r,e]);}var Np={fade:"animate-in fade-in-0 duration-200",scale:"animate-in fade-in-0 zoom-in-95 duration-200",slide:"animate-in fade-in-0 slide-in-from-top-2 duration-200",none:""};function Ci({side:e="bottom",align:t="start",sideOffset:r=4,alignOffset:o=0,avoidCollisions:n=true,collisionPadding:a=8,minWidth:i,maxWidth:c,maxHeight:d=300,animation:l="scale",portal:p=true,children:u,className:m}){let{isOpen:g,setIsOpen:f,triggerRef:h,contentRef:b,closeOnClickOutside:x,closeOnEscape:v,modal:k,contentId:R,focusedIndex:S,setFocusedIndex:E,itemsRef:z}=Lt(),[N,L]=useState(false),A=lo({triggerRef:h,contentRef:b,isOpen:g,side:e,align:t,sideOffset:r,alignOffset:o,avoidCollisions:n,collisionPadding:a});io(b,()=>{x&&f(false);},g);let G=z.current?.filter(Boolean).length||0,q=useCallback(O=>{let P=z.current?.[O];P&&!P.hasAttribute("data-disabled")&&P.click();},[z]);vn({isOpen:g,onClose:()=>{v&&(f(false),h.current?.focus());},itemsCount:G,focusedIndex:S,setFocusedIndex:E,onSelect:q}),useEffect(()=>{let O=b.current;if(O)return $r(O,()=>h.current)},[b,h]),useEffect(()=>{if(g&&z.current&&z.current.length>0){let O=setTimeout(()=>{E(0),z.current?.[0]?.focus();},10);return ()=>clearTimeout(O)}},[g,z,E]),useLayoutEffect(()=>{let O=0;if(!g){L(false);return}let P=()=>{let y=h.current?.getBoundingClientRect(),T=b.current?.getBoundingClientRect();if(A.isReady&&!!y&&!!T&&y.width>0&&y.height>0&&T.width>0&&T.height>0){L(true);return}O=requestAnimationFrame(P);};return L(false),O=requestAnimationFrame(P),()=>{O&&cancelAnimationFrame(O);}},[g,A.isReady,h,b]);let M=jsxs(Fragment,{children:[k&&g&&jsx("div",{className:"fixed inset-0 z-40 bg-black/20",onClick:()=>f(false)}),jsx("div",{ref:b,id:R,role:"menu","aria-orientation":"vertical","aria-hidden":!g,tabIndex:-1,style:{position:"fixed",top:A.top,left:A.left,minWidth:i??h.current?.offsetWidth,maxWidth:c,maxHeight:d,visibility:g&&N?"visible":"hidden",opacity:g&&N?1:0,pointerEvents:g&&N?"auto":"none"},className:s("z-50 overflow-auto rounded-lg","border border-gray-200 bg-white shadow-lg","dark:border-gray-700 dark:bg-gray-800",g&&N&&Np[l],m),children:jsx("div",{className:"py-1",children:u})})]});return p&&typeof document<"u"?createPortal(M,document.body):M}Ci.displayName="DropdownContent";var Ip={default:"text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700",danger:"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20",success:"text-green-600 dark:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/20"};function Si({children:e,icon:t,iconPosition:r="left",description:o,shortcut:n,variant:a="default",closeOnSelect:i,onSelect:c,disabled:d=false,className:l,onClick:p,index:u,...m}){let{setIsOpen:g,closeOnSelect:f,focusedIndex:h,setFocusedIndex:b,registerItem:x,getNextItemIndex:v}=Lt(),k=useRef(null),[R]=useState(()=>u??v());useEffect(()=>(x(R,k.current),()=>{x(R,null);}),[R,x]);let S=i??f,E=h===R;return jsxs("button",{ref:k,role:"menuitem",type:"button",tabIndex:E?0:-1,disabled:d,"data-disabled":d||void 0,"data-focused":E||void 0,onClick:L=>{d||(c?.(),p?.(L),S&&g(false));},onMouseEnter:()=>{d||b(R);},className:s("relative flex w-full items-center px-3 py-2 text-left text-sm","outline-none transition-colors","focus:bg-gray-100 dark:focus:bg-gray-700",Ip[a],d&&"opacity-50 cursor-not-allowed hover:bg-transparent",E&&"bg-gray-100 dark:bg-gray-700",l),...m,children:[t&&r==="left"&&jsx("span",{className:"mr-2 shrink-0 w-5 h-5",children:t}),jsxs("span",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",children:e}),o&&jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 truncate",children:o})]}),t&&r==="right"&&jsx("span",{className:"ml-2 shrink-0 w-5 h-5",children:t}),n&&jsx("span",{className:"ml-auto pl-4 text-xs text-gray-400 dark:text-gray-500",children:n})]})}Si.displayName="DropdownItem";function Ri({className:e}){return jsx("hr",{className:s("my-1 h-px border-0 bg-gray-200 dark:bg-gray-700",e)})}Ri.displayName="DropdownSeparator";function Ti({children:e,className:t}){return jsx("div",{className:s("px-3 py-1.5 text-xs font-semibold text-gray-500 dark:text-gray-400",t),children:e})}Ti.displayName="DropdownLabel";function Mi({checked:e,defaultChecked:t=false,onCheckedChange:r,children:o,icon:n,description:a,disabled:i=false,closeOnChange:c=false,className:d,index:l}){let{setIsOpen:p,focusedIndex:u,setFocusedIndex:m,registerItem:g,getNextItemIndex:f}=Lt(),h=useRef(null),[b]=useState(()=>l??f()),[x,v]=useState(t),k=e!==void 0,R=k?e:x;useEffect(()=>(g(b,h.current),()=>{g(b,null);}),[b,g]);let S=u===b;return jsxs("button",{ref:h,role:"menuitemcheckbox",type:"button",tabIndex:S?0:-1,"aria-checked":R,disabled:i,"data-disabled":i||void 0,"data-focused":S||void 0,onClick:()=>{if(i)return;let N=!R;k||v(N),r?.(N),c&&p(false);},onMouseEnter:()=>{i||m(b);},className:s("relative flex w-full items-center px-3 py-2 text-left text-sm","outline-none transition-colors","text-gray-700 dark:text-gray-200","hover:bg-gray-100 dark:hover:bg-gray-700","focus:bg-gray-100 dark:focus:bg-gray-700",i&&"opacity-50 cursor-not-allowed hover:bg-transparent",S&&"bg-gray-100 dark:bg-gray-700",d),children:[jsx("span",{className:"mr-2 shrink-0 w-4 h-4",children:n||jsx("span",{className:s("flex items-center justify-center w-4 h-4 rounded border-2 transition-colors",R?"bg-blue-600 border-blue-600":"border-gray-300 dark:border-gray-600"),children:R&&jsx("svg",{className:"w-3 h-3 text-white",viewBox:"0 0 16 16",fill:"none",children:jsx("path",{d:"M13.5 4.5L6 12L2.5 8.5",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round"})})})}),jsxs("span",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",children:o}),a&&jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 truncate",children:a})]})]})}Mi.displayName="DropdownCheckboxItem";var zi=createContext(null);function Bp(){let e=useContext(zi);if(!e)throw new Error("DropdownRadioItem must be used within a DropdownRadioGroup");return e}function Ai({value:e,defaultValue:t="",onValueChange:r,children:o,className:n}){let[a,i]=useState(t),c=e!==void 0,d=c?e:a,l=useCallback(u=>{c||i(u),r?.(u);},[c,r]),p=useMemo(()=>({value:d,onValueChange:l}),[d,l]);return jsx(zi.Provider,{value:p,children:jsx("div",{role:"group",className:n,children:o})})}Ai.displayName="DropdownRadioGroup";function Wi({value:e,children:t,icon:r,description:o,disabled:n=false,closeOnChange:a=true,className:i,index:c}){let{value:d,onValueChange:l}=Bp(),{setIsOpen:p,focusedIndex:u,setFocusedIndex:m,registerItem:g,getNextItemIndex:f}=Lt(),h=useRef(null),[b]=useState(()=>c??f()),x=d===e;useEffect(()=>(g(b,h.current),()=>{g(b,null);}),[b,g]);let v=u===b;return jsxs("button",{ref:h,role:"menuitemradio",type:"button",tabIndex:v?0:-1,"aria-checked":x,disabled:n,"data-disabled":n||void 0,"data-focused":v||void 0,onClick:()=>{n||(l(e),a&&p(false));},onMouseEnter:()=>{n||m(b);},className:s("relative flex w-full items-center px-3 py-2 text-left text-sm","outline-none transition-colors","text-gray-700 dark:text-gray-200","hover:bg-gray-100 dark:hover:bg-gray-700","focus:bg-gray-100 dark:focus:bg-gray-700",n&&"opacity-50 cursor-not-allowed hover:bg-transparent",v&&"bg-gray-100 dark:bg-gray-700",i),children:[jsx("span",{className:"mr-2 shrink-0 w-4 h-4",children:r||jsx("span",{className:s("flex items-center justify-center w-4 h-4 rounded-full border-2 transition-colors",x?"border-blue-600":"border-gray-300 dark:border-gray-600"),children:x&&jsx("span",{className:"w-2 h-2 rounded-full bg-blue-600"})})}),jsxs("span",{className:"flex-1 min-w-0",children:[jsx("span",{className:"block truncate",children:t}),o&&jsx("span",{className:"block text-xs text-gray-500 dark:text-gray-400 truncate",children:o})]}),x&&!r&&jsx("svg",{className:"ml-auto w-4 h-4 text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]})}Wi.displayName="DropdownRadioItem";var Oi=createContext(null);function Vi(){let e=useContext(Oi);if(!e)throw new Error("DropdownSubMenu components must be used within a DropdownSubMenu");return e}function _i({children:e}){let[t,r]=useState(false),o=useRef(null),n=useRef(null),a=useMemo(()=>({isOpen:t,setIsOpen:r,triggerRef:o,contentRef:n}),[t]);return jsx(Oi.Provider,{value:a,children:jsx("div",{className:"relative",children:e})})}_i.displayName="DropdownSubMenu";var Hi=0;function $i({children:e,icon:t,disabled:r=false,className:o,index:n}){let{isOpen:a,setIsOpen:i,triggerRef:c}=Vi(),{focusedIndex:d,setFocusedIndex:l,registerItem:p}=Lt(),u=useRef(n??-1);useEffect(()=>(n===void 0&&(u.current=Hi++),p(u.current,c.current),()=>{p(u.current,null);}),[n,p,c]),useEffect(()=>()=>{Hi=0;},[]);let m=d===u.current;return jsxs("button",{ref:c,role:"menuitem",type:"button",tabIndex:m?0:-1,"aria-haspopup":"menu","aria-expanded":a,disabled:r,"data-disabled":r||void 0,"data-focused":m||void 0,onMouseEnter:()=>{r||(l(u.current),i(true));},onMouseLeave:()=>{setTimeout(()=>{i(false);},100);},onKeyDown:b=>{r||(b.key==="ArrowRight"||b.key==="Enter")&&(b.preventDefault(),i(true));},className:s("relative flex w-full items-center px-3 py-2 text-left text-sm","outline-none transition-colors","text-gray-700 dark:text-gray-200","hover:bg-gray-100 dark:hover:bg-gray-700","focus:bg-gray-100 dark:focus:bg-gray-700",r&&"opacity-50 cursor-not-allowed hover:bg-transparent",m&&"bg-gray-100 dark:bg-gray-700",o),children:[t&&jsx("span",{className:"mr-2 shrink-0 w-5 h-5",children:t}),jsx("span",{className:"flex-1",children:e}),jsx("svg",{className:"ml-auto w-4 h-4 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})]})}$i.displayName="DropdownSubMenuTrigger";function Ui({children:e,sideOffset:t=0,className:r}){let{isOpen:o,setIsOpen:n,triggerRef:a,contentRef:i}=Vi(),[c,d]=useState(false),l=lo({triggerRef:a,contentRef:i,isOpen:o,side:"right",align:"start",sideOffset:t,avoidCollisions:true});io(i,()=>n(false),o),useEffect(()=>{let f=i.current;if(f)return $r(f,()=>a.current)},[i,a]);let p=useCallback(()=>{n(true);},[n]),u=useCallback(()=>{n(false);},[n]),m=f=>{(f.key==="ArrowLeft"||f.key==="Escape")&&(f.preventDefault(),n(false),a.current?.focus());};useLayoutEffect(()=>{let f=0;if(!o){d(false);return}let h=()=>{let b=a.current?.getBoundingClientRect(),x=i.current?.getBoundingClientRect();if(l.isReady&&!!b&&!!x&&b.width>0&&b.height>0&&x.width>0&&x.height>0){d(true);return}f=requestAnimationFrame(h);};return d(false),f=requestAnimationFrame(h),()=>{f&&cancelAnimationFrame(f);}},[o,l.isReady,a,i]);let g=jsx("div",{ref:i,role:"menu","aria-orientation":"vertical","aria-hidden":!o,tabIndex:-1,onMouseEnter:p,onMouseLeave:u,onKeyDown:m,style:{position:"fixed",top:l.top,left:l.left,visibility:o&&c?"visible":"hidden",opacity:o&&c?1:0,pointerEvents:o&&c?"auto":"none"},className:s("z-50 min-w-40 overflow-hidden rounded-lg","border border-gray-200 bg-white shadow-lg","dark:border-gray-700 dark:bg-gray-800",o&&c&&"animate-in fade-in-0 zoom-in-95 duration-150",r),children:jsx("div",{className:"py-1",children:e})});return typeof document<"u"?createPortal(g,document.body):g}Ui.displayName="DropdownSubMenuContent";var Kp=(e="md")=>({sm:"text-xs p-1.5",md:"text-sm p-2.5",lg:"text-base p-3.5"})[e],uo=({size:e="md",error:t,disabled:r,readOnly:o,icon:n,iconPosition:a})=>s("bg-gray-50 rounded-lg block w-full","border focus:outline-none focus:ring-0","dark:bg-gray-700 dark:placeholder-gray-400",Kp(e),n&&a==="left"?"pl-9":"",n&&a==="right"?"pr-9":"",r?"opacity-50 cursor-not-allowed":"",o?"bg-gray-100 dark:bg-gray-600 cursor-default":"",t?"border-red-500 dark:border-red-500":"border-gray-300 dark:border-gray-600"),Gi=(e,t)=>s("text-sm font-medium",e?"min-w-[120px]":"block mb-2",!t&&"text-gray-900 dark:text-white"),Ki=e=>s("mt-1 text-xs",e?"text-red-500 dark:text-red-400":"text-gray-500 dark:text-gray-400"),Kr=e=>s("absolute inset-y-0 flex items-center pointer-events-none",e==="left"?"left-2.5":"right-2.5");var po=({label:e,hideLabel:t,labelColor:r,error:o,helperText:n,inline:a,children:i,htmlFor:c})=>jsxs("div",{className:a?"flex items-center gap-4":"flex flex-col",children:[e&&!t&&jsx("label",{htmlFor:c,className:Gi(a||false,r),style:r?{color:r}:void 0,children:e}),jsx("div",{className:a?"flex-1":"w-full",children:i}),n&&jsx("p",{className:s(Ki(o),a&&"ml-34"),children:n})]});var sr=forwardRef(({label:e,inline:t=false,size:r="md",labelColor:o,borderColor:n,textColor:a,disabled:i=false,readOnly:c=false,error:d=false,helperText:l,hideLabel:p=false,icon:u,iconPosition:m="left",multiline:g=false,rows:f=3,focused:h=false,className:b,...x},v)=>{let k=useRef(null),R=A=>{k.current=A,typeof v=="function"?v(A):v&&(v.current=A);};useEffect(()=>{h&&k.current?.focus();},[h]);let S=useId(),E=s(uo({size:r,error:d,disabled:i,readOnly:c,icon:u,iconPosition:m}),g&&"resize-vertical",b),z={...n&&{borderColor:n},...a&&{color:a}},N=n||a?z:void 0;return jsx(po,{label:e,hideLabel:p,labelColor:o,error:d,helperText:l,inline:t,htmlFor:S,children:jsxs("div",{className:"relative w-full",children:[u&&jsx("span",{className:Kr(m),children:u}),g?jsx("textarea",{ref:R,id:S,disabled:i,readOnly:c,rows:f,tabIndex:c||i?-1:void 0,className:E,style:N,...x}):jsx("input",{ref:R,id:S,disabled:i,readOnly:c,tabIndex:c||i?-1:void 0,className:E,style:N,...x})]})})});sr.displayName="Input";var og=e=>jsxs("div",{className:"flex items-center gap-2 px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700 cursor-pointer",children:[e.avatar&&jsx("img",{src:e.avatar,alt:e.label,className:"w-6 h-6 rounded-full"}),jsx("span",{className:"text-sm text-gray-900 dark:text-white",children:e.label})]}),Ca=forwardRef(({label:e,inline:t=false,size:r="md",labelColor:o,borderColor:n,textColor:a,disabled:i=false,readOnly:c=false,error:d=false,helperText:l,hideLabel:p=false,icon:u,iconPosition:m="left",mentionTrigger:g="@",suggestions:f=[],onMentionSearch:h,onMentionSelect:b,onMentionRemove:x,renderSuggestion:v,value:k,onChange:R,placeholder:S,loading:E=false,maxSuggestions:z=10,chipVariant:N="soft",chipColor:L="primary",chipSize:A="sm"},G)=>{let q=useId(),M=useRef(null),[O,P]=useState(false),[y,T]=useState(0),[I,oe]=useState(""),ie=s(uo({size:r,error:d,disabled:i,readOnly:c,icon:u,iconPosition:m}),"min-h-[42px]","whitespace-pre-wrap","break-words"),we={...n&&{borderColor:n},...a&&{color:a}},he=n||a?we:void 0,F=useCallback(()=>{if(!M.current)return {text:"",mentions:[]};let C="",$=[],ge=0,te=B=>{if(B.nodeType===Node.TEXT_NODE)C+=B.textContent||"",ge+=(B.textContent||"").length;else if(B.nodeType===Node.ELEMENT_NODE){let ee=B;if(ee.hasAttribute("data-mention-id")){let me=ee.getAttribute("data-mention-id"),Se=ee.getAttribute("data-mention-label")||"",j=ee.getAttribute("data-mention-avatar")||void 0,Te=`@${Se}`,Pe=ge;$.push({trigger:g,suggestion:{id:me||"",label:Se,avatar:j},startIndex:Pe,endIndex:Pe+Te.length}),C+=Te,ge+=Te.length;}else ee.childNodes.forEach(te);}};return M.current.childNodes.forEach(te),{text:C,mentions:$}},[g]),Q=useCallback((C,$)=>{let ge=document.createElement("span");return ge.contentEditable="false",ge.setAttribute("data-mention-id",C.id),ge.setAttribute("data-mention-label",C.label),C.avatar&&ge.setAttribute("data-mention-avatar",C.avatar),ge.className="inline-block align-middle mx-0.5",ge.style.userSelect="none",createRoot(ge).render(jsx(pn,{label:C.label,variant:N,color:L,size:A,closable:!i&&!c,onClose:$,disabled:i,avatar:C.avatar?jsx("img",{src:C.avatar,alt:C.label,className:"w-full h-full object-cover"}):void 0})),ge},[N,L,A,i,c]),ae=useCallback(C=>{if(!M.current)return;let $=M.current.querySelector(`[data-mention-id="${C}"]`);if($){$.remove();let ge=F();R?.(ge);let te=k?.mentions.find(B=>B.suggestion.id===C)?.suggestion;te&&x?.(te);}},[F,R,x,k?.mentions]),ye=useCallback(()=>{if(!M.current)return;let C=window.getSelection();if(!C||C.rangeCount===0)return;let $=C.getRangeAt(0),ge="";$.startContainer.nodeType===Node.TEXT_NODE&&(ge=$.startContainer.textContent?.substring(0,$.startOffset)||"");let te=ge.match(new RegExp(`${g}(\\w*)$`));if(te){let ee=te[1];oe(ee),P(true),T(0),h?.(ee);}else P(false),oe("");let B=F();R?.(B);},[g,h,R,F]),xe=useCallback(C=>{if(!M.current)return;let $=window.getSelection();if(!$||$.rangeCount===0)return;let ge=$.getRangeAt(0);if(ge.startContainer.nodeType===Node.TEXT_NODE){let B=ge.startContainer,ee=B.textContent||"",me=ge.startOffset,j=ee.substring(0,me).lastIndexOf(g);if(j!==-1){let Te=ee.substring(0,j),Pe=ee.substring(me),et=Q(C,()=>{ae(C.id);});if(Te?(B.textContent=Te,B.parentNode?.insertBefore(et,B.nextSibling)):(B.parentNode?.insertBefore(et,B),B.textContent="",B.textContent||B.remove()),Pe){let J=document.createTextNode(Pe);et.parentNode?.insertBefore(J,et.nextSibling);}let at=document.createTextNode(" ");et.parentNode?.insertBefore(at,et.nextSibling);let pt=document.createRange();pt.setStartAfter(at),pt.collapse(true),$.removeAllRanges(),$.addRange(pt);}}P(false),oe("");let te=F();R?.(te),b?.(C),M.current.focus();},[g,Q,ae,F,R,b]),le=useCallback(C=>{let $=f.slice(0,z);if(O&&$.length>0)switch(C.key){case "ArrowDown":C.preventDefault(),T(ge=>ge<$.length-1?ge+1:0);return;case "ArrowUp":C.preventDefault(),T(ge=>ge>0?ge-1:$.length-1);return;case "Enter":case "Tab":C.preventDefault(),$[y]&&xe($[y]);return;case "Escape":C.preventDefault(),P(false);return}if(C.key==="Backspace"){let ge=window.getSelection();if(!ge||ge.rangeCount===0)return;let te=ge.getRangeAt(0);if(te.collapsed&&te.startOffset===0){let B=te.startContainer.previousSibling;if(B&&B.nodeType===Node.ELEMENT_NODE){let ee=B;if(ee.hasAttribute("data-mention-id")){C.preventDefault();let me=ee.getAttribute("data-mention-id");me&&ae(me);return}}}if(te.collapsed&&te.startContainer.nodeType===Node.TEXT_NODE){let B=te.startContainer;if(te.startOffset===0){let ee=B.previousSibling;if(ee&&ee.nodeType===Node.ELEMENT_NODE){let me=ee;if(me.hasAttribute("data-mention-id")){C.preventDefault();let Se=me.getAttribute("data-mention-id");Se&&ae(Se);return}}}}}},[O,f,y,z,xe,ae]);return useEffect(()=>{M.current&&(!(M.current.textContent||M.current.querySelector("[data-mention-id]"))&&S?M.current.setAttribute("data-placeholder",S):M.current.removeAttribute("data-placeholder"));},[S,k]),useEffect(()=>{M.current&&k?.text===""&&k?.mentions.length===0&&M.current.innerHTML.trim()&&(M.current.innerHTML="");},[k?.text,k?.mentions.length]),jsx(po,{label:e,hideLabel:p,labelColor:o,error:d,helperText:l,inline:t,htmlFor:q,children:jsxs("div",{className:"relative w-full",children:[u&&jsx("span",{className:Kr(m),children:u}),jsx("div",{ref:C=>{typeof G=="function"?G(C):G&&(G.current=C),M.current=C;},id:q,contentEditable:!i&&!c,suppressContentEditableWarning:true,onInput:ye,onKeyDown:le,className:s(ie,"empty:before:content-[attr(data-placeholder)] empty:before:text-gray-400 empty:before:dark:text-gray-500"),style:he,role:"textbox","aria-label":e,"aria-multiline":"true",tabIndex:c||i?-1:0}),O&&f.length>0&&jsx("div",{className:"absolute z-10 mt-1 w-full max-h-60 overflow-auto rounded-lg border border-gray-300 bg-white dark:bg-gray-700 dark:border-gray-600 shadow-lg",children:E?jsx("div",{className:"px-3 py-2 text-sm text-gray-500 dark:text-gray-400",children:"Loading..."}):f.slice(0,z).map((C,$)=>jsx("div",{onClick:()=>xe(C),className:s($===y&&"bg-gray-100 dark:bg-gray-600"),children:v?v(C):og(C)},C.id))})]})})});Ca.displayName="MentionInput";var Na=forwardRef(({label:e,inline:t=false,size:r="md",labelColor:o,borderColor:n,textColor:a,disabled:i=false,readOnly:c=false,error:d=false,helperText:l,hideLabel:p=false,icon:u,iconPosition:m="left",className:g,value:f,onChange:h,format:b="number",currency:x="USD",locale:v="en-US",decimals:k,min:R,max:S,step:E=1,prefix:z,suffix:N,thousandSeparator:L=true,allowNegative:A=true,onBlur:G,onFocus:q,...M},O)=>{let P=useId(),[y,T]=useState(null),I=useMemo(()=>{let X=b==="currency"?{style:"currency",currency:x,minimumFractionDigits:k??2,maximumFractionDigits:k??2}:b==="percentage"?{minimumFractionDigits:k??0,maximumFractionDigits:k??2}:{minimumFractionDigits:k??0,maximumFractionDigits:k??(b==="decimal"?2:0),useGrouping:L};try{return new Intl.NumberFormat(v,X)}catch{return null}},[b,x,v,k,L]),oe=X=>{if(X==null)return "";if(!I)return String(X);let C=I.format(X);return b==="percentage"?(C=z?`${z}${C}`:C,C=N||!C.includes("%")?`${C}%`:C,C):(z&&(C=`${z}${C}`),N&&(C=`${C}${N}`),C)},ie=X=>{if(!X||X.trim()==="")return null;let C=X;if(z&&(C=C.replace(z,"")),N&&(C=C.replace(N,"")),C=C.replace(/[^\d.,-]/g,""),v.includes("fr")||v.includes("de")?C=C.replace(/\s/g,"").replace(",","."):C=C.replace(",",""),!C||C==="-"||C===".")return null;let $=parseFloat(C);return isNaN($)?null:!A&&$<0?Math.abs($):R!==void 0&&$<R?R:S!==void 0&&$>S?S:$},we=y??oe(f??null),he=X=>{let C=v.includes("fr")||v.includes("de")?",":".";return new RegExp(`^-?[0-9${C===","?",":"\\."}]*$`).test(X)},F=X=>{let C=X.target.value;if(C===""||he(C)){T(C);let $=ie(C);h&&h($);}},Q=X=>{let C=v.includes("fr")||v.includes("de")?",":".",$=["Backspace","Delete","Tab","Escape","Enter","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End"],ge=/^[0-9]$/.test(X.key),te=X.key===C,B=X.key==="-"&&A&&we.indexOf("-")===-1,ee=X.ctrlKey||X.metaKey;!ge&&!te&&!B&&!$.includes(X.key)&&!ee&&X.preventDefault();},ae=X=>{let C=f!=null?String(f):"";T(C),q&&q(X);},ye=X=>{let C=ie(y??"");h&&C!==f&&h(C),T(null),G&&G(X);},xe=s(uo({size:r,error:d,disabled:i,readOnly:c,icon:u,iconPosition:m}),n&&`border-[${n}]`,a&&`text-[${a}]`,g),le=jsxs("div",{className:"relative",children:[u&&m==="left"&&jsx("div",{className:Kr(m),children:u}),jsx("input",{ref:O,id:P,type:"text",inputMode:"decimal",className:xe,style:{borderColor:n,color:a},disabled:i,readOnly:c,value:we,onChange:F,onKeyDown:Q,onFocus:ae,onBlur:ye,...M}),u&&m==="right"&&jsx("div",{className:Kr(m),children:u})]});return jsx(po,{label:e,hideLabel:p,labelColor:o,error:d,helperText:l,inline:t,htmlFor:P,children:le})});Na.displayName="NumberInput";function dg({logo:e,logoHref:t="/",onLogoClick:r,navItems:o=[],actions:n,rightContent:a,variant:i="default",size:c="md",backgroundColor:d,textColor:l,hoverColor:p,navItemTextColor:u,navItemHoverColor:m,navItemBgHover:g,navItemActiveColor:f,sticky:h=false,fixed:b=false,showSearch:x=false,onSearch:v,searchPlaceholder:k="Search...",className:R,containerClassName:S}){let[E,z]=useState(false),[N,L]=useState(null),[A,G]=useState(""),q=()=>{z(!E);},M=F=>{L(N===F?null:F);},O=F=>{F.preventDefault(),v&&v(A);},P=s(h&&"sticky top-0 z-50",b&&"fixed top-0 left-0 right-0 z-50"),y=s(i==="default"&&!d&&"bg-neutral text-white",i==="transparent"&&!d&&"bg-transparent",i==="bordered"&&!d&&"bg-white border-b border-gray-200 text-gray-900 dark:bg-gray-900 dark:border-gray-800 dark:text-gray-100",i==="shadow"&&!d&&"bg-white shadow-md text-gray-900 dark:bg-gray-900 dark:text-gray-100"),T=s(c==="sm"&&"py-2",c==="md"&&"py-4",c==="lg"&&"py-6"),I=d||"",oe=l||"",ie=p||"",we=s(P,y,T,I,oe,R),he=(F,Q,ae=false)=>{let ye=F.children&&F.children.length>0,xe=N===Q,le=s("px-4 py-2 transition-colors flex items-center gap-2",ae?"block w-full text-left":"inline-flex",F.active&&"font-semibold border-b-2",F.active&&(f||"border-current"),u||(i==="default"||i==="transparent"?"text-gray-300":"text-gray-600 dark:text-gray-300"),m||ie||(i==="default"||i==="transparent"?"hover:text-white":"hover:text-blue-600 dark:hover:text-blue-400"),g||"");if(ye)return jsxs("div",{className:ae?"w-full":"relative",children:[jsxs("button",{type:"button",onClick:()=>M(Q),className:le,children:[F.icon&&jsx("span",{className:"w-5 h-5",children:F.icon}),jsx("span",{children:F.label}),F.badge&&jsx("span",{className:"bg-red-500 text-white text-xs px-2 py-0.5 rounded-full",children:F.badge}),jsx("svg",{className:s("w-4 h-4 transition-transform",xe&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),xe&&jsx("div",{className:s("bg-white shadow-lg rounded-lg overflow-hidden dark:bg-gray-800 dark:shadow-black/40",ae?"mt-2 mb-2":"absolute top-full left-0 mt-1 min-w-[200px]"),children:F.children?.map(C=>jsx("a",{href:C.href,onClick:C.onClick,target:C.external?"_blank":void 0,rel:C.external?"noopener noreferrer":void 0,className:"block px-4 py-2 text-gray-700 hover:bg-gray-100 transition-colors dark:text-gray-200 dark:hover:bg-gray-700",children:jsxs("div",{className:"flex items-center gap-2",children:[C.icon&&jsx("span",{className:"w-5 h-5",children:C.icon}),jsx("span",{children:C.label}),C.badge&&jsx("span",{className:"bg-red-500 text-white text-xs px-2 py-0.5 rounded-full ml-auto",children:C.badge}),C.external&&jsx("svg",{className:"w-4 h-4 ml-auto",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]})},C.href??C.label))})]},F.href??F.label);let X=jsxs(Fragment,{children:[F.icon&&jsx("span",{className:"w-5 h-5",children:F.icon}),jsx("span",{children:F.label}),F.badge&&jsx("span",{className:"bg-red-500 text-white text-xs px-2 py-0.5 rounded-full",children:F.badge}),F.external&&jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})})]});return F.onClick?jsx("button",{type:"button",onClick:F.onClick,className:le,children:X},F.href??F.label):jsx("a",{href:F.href,target:F.external?"_blank":void 0,rel:F.external?"noopener noreferrer":void 0,className:le,children:X},F.href??F.label)};return jsxs("header",{className:we,children:[jsxs("nav",{className:s("container mx-auto flex items-center justify-between px-4",S),children:[e&&jsx("div",{className:"flex items-center",children:t?jsx("a",{href:t,onClick:r,className:"flex items-center hover:opacity-80 transition-opacity",children:e}):jsx("div",{className:"flex items-center",children:e})}),x&&jsx("form",{onSubmit:O,className:"hidden md:flex flex-1 max-w-md mx-8",children:jsx("input",{type:"search","aria-label":k,value:A,onChange:F=>G(F.target.value),placeholder:k,className:"w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-900 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:placeholder-gray-500"})}),jsx("div",{className:"hidden md:flex items-center gap-2",children:o.map((F,Q)=>he(F,Q,false))}),(n||a)&&jsxs("div",{className:"hidden md:flex items-center gap-2 ml-4",children:[n,a]}),o.length>0&&jsx("div",{className:"md:hidden",children:jsx("button",{type:"button",className:s("inline-flex rounded-lg border-2 p-2 w-10 h-10 justify-center transition-colors focus:outline-none",i==="default"||i==="transparent"?"text-gray-300 hover:text-white":"text-gray-600 hover:text-gray-900 dark:text-gray-300 dark:hover:text-gray-100"),onClick:q,"aria-label":"Toggle menu","aria-expanded":E,children:jsx("svg",{className:"w-5 h-5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 17 14",children:jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M1 1h15M1 7h15M1 13h15"})})})})]}),E&&o.length>0&&jsx("div",{className:s("md:hidden border-t animate-in slide-in-from-top duration-300",i==="default"||i==="transparent"?"border-gray-700":"border-gray-200 dark:border-gray-800"),children:jsxs("div",{className:"flex flex-col py-2 px-4",children:[x&&jsx("form",{onSubmit:O,className:"mb-4",children:jsx("input",{type:"search","aria-label":k,value:A,onChange:F=>G(F.target.value),placeholder:k,className:"w-full px-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-blue-500 text-gray-900 dark:border-gray-700 dark:bg-gray-800 dark:text-gray-100 dark:placeholder-gray-500"})}),o.map((F,Q)=>he(F,Q,true)),(n||a)&&jsxs("div",{className:"flex flex-col gap-2 mt-4 pt-4 border-t border-gray-700",children:[n,a]})]})})]})}var gg="\xC9crivez en Markdown...",fg="border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden bg-white dark:bg-gray-800",mg="prose prose-sm dark:prose-invert max-w-none p-3 min-h-[16rem] focus:outline-none",Ra=null;function bg(){return Ra??(Ra=import('@mdxeditor/editor').then(e=>{let t=[e.headingsPlugin(),e.listsPlugin(),e.quotePlugin(),e.linkPlugin(),e.linkDialogPlugin(),e.codeBlockPlugin({defaultCodeBlockLanguage:""}),e.thematicBreakPlugin(),e.markdownShortcutPlugin(),e.toolbarPlugin({toolbarContents:()=>jsxs(Fragment,{children:[jsx(e.UndoRedo,{}),jsx(e.BlockTypeSelect,{}),jsx(e.BoldItalicUnderlineToggles,{}),jsx(e.CodeToggle,{}),jsx(e.CreateLink,{}),jsx(e.ListsToggle,{}),jsx(e.InsertThematicBreak,{})]})})];function r({value:o,onChange:n,placeholder:a,editorRef:i}){return jsx(e.MDXEditor,{ref:i,markdown:o,onChange:n,placeholder:a,contentEditableClassName:mg,plugins:t})}return r.displayName="LoadedMarkdownEditor",r}).catch(e=>{throw Ra=null,e})),Ra}var Ta=forwardRef(({value:e,onChange:t,placeholder:r=gg,loadingLabel:o,unavailableLabel:n},a)=>{let i=Gt(),[c,d]=useState(null),[l,p]=useState(false);return useEffect(()=>{let u=false;return bg().then(m=>{u||d(()=>m);},()=>{u||p(true);}),()=>{u=true;}},[]),jsx("div",{className:fg,children:c?jsx(c,{value:e,onChange:t,placeholder:r,editorRef:a}):jsx("p",{className:"p-3 text-sm text-gray-500 dark:text-gray-400",role:l?"alert":"status",children:l?n??i.markdownEditorUnavailable:o??i.markdownEditorLoading})})});Ta.displayName="MarkdownEditor";var kg=jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),Cg=jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),jsx("polyline",{points:"17 21 17 13 7 13 7 21"}),jsx("polyline",{points:"7 3 7 8 15 8"})]}),Ng=jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),Sg=jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("polyline",{points:"1 4 1 10 7 10"}),jsx("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]}),Rg=jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10"}),jsx("path",{className:"opacity-75",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z",fill:"currentColor"})]}),Tg={xs:"w-4 h-4 text-[10px]",sm:"w-5 h-5 text-xs",md:"w-6 h-6 text-sm",lg:"w-7 h-7 text-base"},Eg={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},Dg={sm:"w-56",md:"w-72",lg:"w-96",xl:"w-[32rem]"},Ig=[wg],Mg={h1:({...e})=>jsx("h1",{className:"text-xl font-bold mb-2 text-gray-900 dark:text-gray-100",...e}),h2:({...e})=>jsx("h2",{className:"text-lg font-semibold mt-4 mb-2 text-gray-900 dark:text-gray-100",...e}),h3:({...e})=>jsx("h3",{className:"text-base font-semibold mt-3 mb-1 text-gray-900 dark:text-gray-100",...e}),p:({...e})=>jsx("p",{className:"my-1 text-gray-700 dark:text-gray-300",...e}),ul:({...e})=>jsx("ul",{className:"list-disc list-inside space-y-1 my-2 text-gray-700 dark:text-gray-300",...e}),ol:({...e})=>jsx("ol",{className:"list-decimal list-inside space-y-1 my-2 text-gray-700 dark:text-gray-300",...e}),code:({className:e,children:t,...r})=>!e?.includes("language-")?jsx("code",{className:"bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded text-sm font-mono text-gray-900 dark:text-gray-100",...r,children:t}):jsx("code",{className:"block bg-gray-100 dark:bg-gray-800 rounded-lg p-3 my-2 overflow-x-auto text-sm font-mono text-gray-900 dark:text-gray-100",...r,children:t}),pre:({...e})=>jsx("pre",{className:"my-2",...e}),a:({...e})=>jsx("a",{className:"text-blue-600 dark:text-blue-400 hover:underline",...e}),strong:({...e})=>jsx("strong",{className:"font-semibold text-gray-900 dark:text-gray-100",...e}),em:({...e})=>jsx("em",{className:"italic",...e}),blockquote:({...e})=>jsx("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 my-2 italic text-gray-600 dark:text-gray-400",...e})};function qi({content:e,markdown:t=false,position:r="bottom",size:o="sm",className:n="",visible:a=true,editable:i=false,onSave:c,onReset:d,width:l="md",title:p}){let[u,m]=useState(false),[g,f]=useState(false),[h,b]=useState(""),[x,v]=useState(false),[k,R]=useState(null),S=useRef(null),E=useRef(null),z=useRef(null),N=useRef(null);useEffect(()=>{if(!u)return;let O=y=>{S.current&&!S.current.contains(y.target)&&E.current&&!E.current.contains(y.target)&&(g||m(false));},P=y=>{y.key==="Escape"&&(g?(f(false),b("")):m(false));};return document.addEventListener("mousedown",O),document.addEventListener("keydown",P),()=>{document.removeEventListener("mousedown",O),document.removeEventListener("keydown",P);}},[u,g]),useEffect(()=>{g&&z.current&&z.current.focus();},[g]),useEffect(()=>()=>{N.current&&clearTimeout(N.current);},[]);let L=useCallback(()=>{b(typeof e=="string"?e:""),f(true),R(null);},[e]),A=useCallback(()=>{f(false),b(""),R(null);},[]),G=useCallback(async()=>{if(!c){R({type:"error",text:"Aucune fonction de sauvegarde fournie"});return}v(true);try{await c(h)?(R({type:"success",text:"Sauvegard\xE9 avec succ\xE8s !"}),f(!1),N.current&&clearTimeout(N.current),N.current=setTimeout(()=>R(null),2e3)):R({type:"error",text:"Erreur lors de la sauvegarde"});}catch{R({type:"error",text:"Erreur lors de la sauvegarde"});}finally{v(false);}},[h,c]),q=useCallback(async()=>{if(d&&confirm("\xCAtes-vous s\xFBr de vouloir r\xE9initialiser ce contenu ?")){v(true);try{await d()?(R({type:"success",text:"R\xE9initialis\xE9 avec succ\xE8s !"}),f(!1),N.current&&clearTimeout(N.current),N.current=setTimeout(()=>R(null),2e3)):R({type:"error",text:"Erreur lors de la r\xE9initialisation"});}catch{R({type:"error",text:"Erreur lors de la r\xE9initialisation"});}finally{v(false);}}},[d]),M=e;return a?jsxs("div",{className:"relative inline-flex items-center",children:[jsx("button",{type:"button",ref:S,onClick:()=>m(!u),className:`
3
+ ${Tg[o]}
4
+ inline-flex items-center justify-center
5
+ rounded-full border border-gray-300 dark:border-gray-600
6
+ bg-white dark:bg-gray-800
7
+ text-gray-500 dark:text-gray-400
8
+ hover:bg-gray-50 dark:hover:bg-gray-700
9
+ cursor-pointer
10
+ hover:text-gray-700 dark:hover:text-gray-200
11
+ hover:border-gray-400 dark:hover:border-gray-500
12
+ transition-all duration-150
13
+ focus:outline-none focus:ring-2 focus:ring-blue-500/50
14
+ ${n}
15
+ `,"aria-label":"Afficher l'aide","aria-expanded":u,children:jsx("span",{className:"font-medium",children:"?"})}),u&&jsxs("div",{ref:E,className:`
16
+ absolute z-50 ${Eg[r]}
17
+ ${Dg[l]} max-h-[80vh] overflow-hidden flex flex-col
18
+ bg-white dark:bg-gray-900
19
+ border border-gray-200 dark:border-gray-700
20
+ rounded-xl shadow-xl
21
+ text-sm text-gray-700 dark:text-gray-300
22
+ animate-in fade-in-0 zoom-in-95 duration-150
23
+ `,role:"tooltip",children:[(p||i)&&jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50",children:[jsx("div",{className:"flex items-center gap-2",children:p&&jsx("h3",{className:"text-sm font-semibold",children:p})}),i&&jsx("div",{className:"flex items-center gap-1",children:g?jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:G,disabled:x,className:"p-1.5 rounded-md hover:bg-green-100 dark:hover:bg-green-900/30 text-green-600 dark:text-green-400 transition-colors disabled:opacity-50 cursor-pointer",title:"Sauvegarder",children:x?Rg:Cg}),jsx("button",{type:"button",onClick:A,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:"Annuler",children:Ng}),d&&jsx("button",{type:"button",onClick:q,disabled:x,className:"p-1.5 rounded-md hover:bg-orange-100 dark:hover:bg-orange-900/30 text-orange-600 dark:text-orange-400 transition-colors disabled:opacity-50 cursor-pointer",title:"R\xE9initialiser",children:Sg})]}):jsx("button",{type:"button",onClick:L,className:"p-1.5 rounded-md hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-500 hover:text-gray-700 dark:hover:text-gray-300 transition-colors cursor-pointer",title:"Modifier",children:kg})})]}),k&&jsx("div",{className:`px-4 py-2 text-xs ${k.type==="success"?"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400":"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400"}`,children:k.text}),jsx("div",{className:"flex-1 overflow-y-auto p-4",children:g?t?jsx(Ta,{value:h,onChange:b,placeholder:"\xC9crivez en Markdown..."}):jsx("div",{className:"space-y-2",children:jsx("textarea",{ref:z,"aria-label":"Contenu d'aide",value:h,onChange:O=>b(O.target.value),className:"w-full h-64 p-3 text-sm bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg resize-none focus:outline-none focus:ring-2 focus:ring-blue-500/50 text-gray-700 dark:text-gray-300 font-mono",placeholder:"\xC9crivez votre contenu d'aide..."})}):typeof M=="string"?jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none",children:t?jsx(vg,{remarkPlugins:Ig,components:Mg,children:M}):jsx("div",{dangerouslySetInnerHTML:{__html:xg.sanitize(M)}})}):M})]})]}):null}function Pg({children:e,content:t,markdown:r=false,position:o="bottom",size:n="sm",visible:a=true,editable:i=false,onSave:c,onReset:d,width:l="md",title:p,className:u}){return jsxs("div",{className:"inline-flex items-center gap-2.5",children:[e,jsx(qi,{content:t,markdown:r,position:o,size:n,visible:a,editable:i,onSave:c,onReset:d,width:l,title:p,className:u})]})}var Fg={"16/9":"aspect-[16/9]","4/3":"aspect-[4/3]","1/1":"aspect-square",auto:""},Hg=e=>new Promise((t,r)=>{let o=new FileReader;o.onload=n=>{let a=n.target?.result;t(a);},o.onerror=()=>{r(new Error("Erreur lors de la lecture du fichier"));},o.readAsDataURL(e);});function Bg({value:e,onChange:t,onUpload:r,label:o="Image",maxSize:n=5*1024*1024,accept:a="image/*",helpText:i,disabled:c=false,className:d="",showUrlInput:l=true,urlPlaceholder:p="https://example.com/image.jpg",aspectRatio:u="16/9"}){let[m,g]=useState(false),[f,h]=useState(null),b=useRef(null),x=useId(),v=useMemo(()=>(n/(1024*1024)).toFixed(0),[n]),k=`Formats accept\xE9s : ${a==="image/*"?"JPG, PNG, GIF, WebP":a} (max ${v}MB)`,R=useCallback(async L=>{let A=L.target.files?.[0];if(A){if(!A.type.startsWith("image/")){h("Le fichier doit \xEAtre une image");return}if(A.size>n){h(`Le fichier est trop volumineux (max ${v}MB)`);return}g(true),h(null);try{if(r){let G=await r(A);t(G);}else {let G=await Hg(A);t(G);}b.current&&(b.current.value="");}catch(G){console.error("Upload error:",G),h(G instanceof Error?G.message:"Erreur lors de l'upload");}finally{g(false);}}},[n,v,t,r]),S=useCallback(()=>{t(""),b.current&&(b.current.value=""),h(null);},[t]),E=useCallback(L=>{t(L),h(null);},[t]),z=useCallback(()=>{b.current?.click();},[]),N=useCallback(L=>{E(L.target.value);},[E]);return jsxs("div",{className:`space-y-2 ${d}`,children:[o&&jsx("label",{className:"block text-sm font-semibold text-gray-700 dark:text-gray-300",children:o}),e&&jsxs("div",{className:"relative w-full overflow-hidden rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800/50",children:[jsx("div",{className:`relative ${Fg[u]} ${u==="auto"?"max-h-64":""} flex items-center justify-center`,children:jsx("img",{src:e,alt:"Aper\xE7u",className:"w-full h-full object-contain"})}),jsx("button",{type:"button",onClick:S,disabled:c,className:"absolute top-2 right-2 bg-red-500 text-white rounded-full w-6 h-6 flex items-center justify-center text-xs hover:bg-red-600 transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",title:"Supprimer l'image",children:"\xD7"})]}),jsxs("div",{className:"flex gap-2",children:[jsx("input",{ref:b,type:"file","aria-label":"Choisir une image",accept:a,onChange:R,className:"hidden",disabled:c||m}),jsx("button",{type:"button",onClick:z,disabled:c||m,className:"px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md hover:bg-gray-50 dark:hover:bg-gray-700 disabled:opacity-50 disabled:cursor-not-allowed transition-colors cursor-pointer bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-200",children:m?"\u23F3 Upload...":e?"\u{1F4C1} Changer l'image":"\u{1F4C1} Choisir une image"})]}),l&&jsxs("div",{className:"space-y-1",children:[jsx("label",{htmlFor:x,className:"block text-xs text-gray-500 dark:text-gray-400",children:"Ou URL directe :"}),jsx("input",{id:x,type:"url",value:e||"",onChange:N,placeholder:p,disabled:c,className:"w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-800 dark:text-gray-200 disabled:opacity-50 disabled:cursor-not-allowed"})]}),f&&jsxs("div",{className:"text-red-600 dark:text-red-400 text-sm bg-red-50 dark:bg-red-900/20 p-2 rounded border border-red-200 dark:border-red-800",children:["\u274C ",f]}),jsx("div",{className:"text-xs text-gray-500 dark:text-gray-400",children:i||k})]})}var Sn={default:"bg-gray-400",primary:"bg-blue-600",success:"bg-green-500",warning:"bg-yellow-400",error:"bg-red-500",info:"bg-cyan-500",dark:"bg-gray-900 dark:bg-gray-700",purple:"bg-purple-600",indigo:"bg-indigo-600",teal:"bg-teal-500"},Da={xs:"w-2 h-2",sm:"w-2.5 h-2.5",md:"w-3 h-3",lg:"w-3.5 h-3.5",xl:"w-4 h-4"},Og={xs:"min-w-4 h-4 text-[10px] px-1",sm:"min-w-5 h-5 text-xs px-1",md:"min-w-5 h-5 text-xs px-1.5",lg:"min-w-6 h-6 text-sm px-1.5",xl:"min-w-7 h-7 text-sm px-2"},Ia={"top-left":"top-0 left-0 -translate-x-1/2 -translate-y-1/2","top-center":"top-0 left-1/2 -translate-x-1/2 -translate-y-1/2","top-right":"top-0 right-0 translate-x-1/2 -translate-y-1/2","center-left":"top-1/2 left-0 -translate-x-1/2 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 translate-x-1/2 -translate-y-1/2","bottom-left":"bottom-0 left-0 -translate-x-1/2 translate-y-1/2","bottom-center":"bottom-0 left-1/2 -translate-x-1/2 translate-y-1/2","bottom-right":"bottom-0 right-0 translate-x-1/2 translate-y-1/2"},Ma={"top-left":"top-0 left-0","top-center":"top-0 left-1/2 -translate-x-1/2","top-right":"top-0 right-0","center-left":"top-1/2 left-0 -translate-y-1/2",center:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2","center-right":"top-1/2 right-0 -translate-y-1/2","bottom-left":"bottom-0 left-0","bottom-center":"bottom-0 left-1/2 -translate-x-1/2","bottom-right":"bottom-0 right-0"};function Vg(e,t){return e>t?`${t}+`:`${e}`}function _g({color:e="primary",size:t="md",placement:r="top-right",bordered:o=false,borderColor:n,pulse:a=false,offset:i=false,className:c,...d}){return jsx("span",{"data-testid":"indicator",className:s("absolute z-10 rounded-full",Sn[e],Da[t],i?Ma[r]:Ia[r],o&&s("ring-2 ring-white dark:ring-gray-900",n),a&&"animate-pulse",c),...d})}function $g({color:e="error",size:t="md",placement:r="top-right",count:o=0,maxCount:n=99,bordered:a=false,borderColor:i,pulse:c=false,offset:d=false,className:l,...p}){return jsx("span",{"data-testid":"indicator",className:s("absolute z-10 inline-flex items-center justify-center rounded-full font-semibold text-white",Sn[e],Og[t],d?Ma[r]:Ia[r],a&&s("ring-2 ring-white dark:ring-gray-900",i),c&&"animate-pulse",l),...p,children:Vg(o,n)})}function Ug({color:e="success",size:t="md",placement:r="bottom-right",bordered:o=true,borderColor:n,pulse:a=false,offset:i=false,className:c,...d}){return jsx("span",{"data-testid":"indicator",className:s("absolute z-10 rounded-full",Sn[e],Da[t],i?Ma[r]:Ia[r],o&&s("ring-2 ring-white dark:ring-gray-900",n),a&&"animate-pulse",c),...d})}function Gg({color:e="primary",size:t="sm",label:r,className:o,...n}){return jsxs("span",{"data-testid":"indicator",className:s("inline-flex items-center gap-2",o),...n,children:[jsx("span",{className:s("rounded-full shrink-0",Sn[e],Da[t])}),r?jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:r}):null]})}function Zi({variant:e="dot",children:t,...r}){if(e==="legend")return jsx(Gg,{...r});let o=(()=>{switch(e){case "count":return jsx($g,{...r});case "status":return jsx(Ug,{...r});default:return jsx(_g,{...r})}})();return t?jsxs("div",{className:"relative inline-flex",children:[t,o]}):o}Zi.displayName="Indicator";var Kg={xs:"text-xs",sm:"text-sm",md:"text-sm",lg:"text-base",xl:"text-lg"},el={xs:"w-3 h-3",sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-4.5 h-4.5",xl:"w-5 h-5"},Yg={normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},Xg={default:{default:"text-gray-700 dark:text-gray-200",light:"text-gray-500 dark:text-gray-400",strong:"text-gray-900 dark:text-white"},primary:{default:"text-blue-600 dark:text-blue-400",light:"text-blue-400 dark:text-blue-300",strong:"text-blue-700 dark:text-blue-300"},secondary:{default:"text-purple-600 dark:text-purple-400",light:"text-purple-400 dark:text-purple-300",strong:"text-purple-700 dark:text-purple-300"},success:{default:"text-green-600 dark:text-green-400",light:"text-green-400 dark:text-green-300",strong:"text-green-700 dark:text-green-300"},warning:{default:"text-yellow-600 dark:text-yellow-400",light:"text-yellow-400 dark:text-yellow-300",strong:"text-yellow-700 dark:text-yellow-300"},error:{default:"text-red-600 dark:text-red-400",light:"text-red-400 dark:text-red-300",strong:"text-red-700 dark:text-red-300"},info:{default:"text-cyan-600 dark:text-cyan-400",light:"text-cyan-400 dark:text-cyan-300",strong:"text-cyan-700 dark:text-cyan-300"},muted:{default:"text-gray-500 dark:text-gray-400",light:"text-gray-400 dark:text-gray-500",strong:"text-gray-600 dark:text-gray-300"}};function rl({children:e,size:t="md",color:r="default",variant:o="default",weight:n="medium",textColor:a,required:i=false,requiredIndicator:c="*",optional:d=false,optionalText:l="(optional)",tooltip:p,icon:u,endIcon:m,disabled:g=false,truncate:f=false,as:h="label",className:b,...x}){let v=h,k=s("inline-flex items-center gap-1.5 transition-colors",Kg[t],Yg[n]),R=a||Xg[r][o];return jsxs(v,{className:s(k,R,g?"opacity-50 cursor-not-allowed":"cursor-default",b),title:p,"aria-disabled":g,...x,children:[u&&jsx("span",{className:s("shrink-0",el[t]),children:u}),jsxs("span",{className:s(f&&"truncate"),children:[e,i&&jsx("span",{className:"text-red-500 ml-0.5","aria-hidden":"true",children:c}),i&&jsx("span",{className:"sr-only",children:"(required)"})]}),d&&!i&&jsx("span",{className:"text-gray-400 dark:text-gray-500 font-normal",children:l}),m&&jsx("span",{className:s("shrink-0",el[t]),children:m})]})}rl.displayName="Label";var Zg={sm:"max-w-sm",md:"max-w-2xl",lg:"max-w-4xl",xl:"max-w-6xl",full:"max-w-full"},wr=forwardRef(({isOpen:e,onClose:t,title:r="Modal Title",children:o,buttonLabel:n,onButtonClick:a,className:i,allowFullScreen:c=false,showSubmit:d=true,submitLabel:l,onSubmitClick:p,showCancel:u=false,cancelLabel:m,onCancelClick:g,buttonsPosition:f="right",showHeaderDivider:h=true,showFooterDivider:b=true,description:x,icon:v,size:k="md",reverseButtons:R=false,headerClassName:S,contentClassName:E,footerClassName:z,titleClassName:N,descriptionClassName:L,submitClassName:A,cancelClassName:G,closeLabel:q,enterFullScreenLabel:M,exitFullScreenLabel:O,"aria-label":P,closeOnEscape:y=true,trapFocus:T=true,initialFocus:I,returnFocus:oe,lockScroll:ie=true},we)=>{let[he,F]=useState(false),Q=Gt(),ae=useId(),ye=`${ae}-title`,xe=`${ae}-description`,{dialogRef:le,dialogProps:X}=Ur({open:e,onClose:t,closeOnEscape:y,trapFocus:T,initialFocus:I,returnFocus:oe,lockScroll:ie});if(!e)return null;let C=n??l??Q.confirm,$=m??Q.cancel,ge=q??Q.closeModal,te=he?O??Q.exitFullScreen:M??Q.enterFullScreen,B=a??p,ee=async()=>{B&&await B(),t();},me=async()=>{g&&await g(),t();};return jsx("div",{className:s("overflow-y-auto overflow-x-hidden fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",i),"aria-hidden":!e,children:jsx("div",{className:s("relative p-4 w-full max-h-full transition-all duration-300",he?"max-w-full h-full p-0":Zg[k]),ref:we,children:jsxs("div",{...X,ref:le,"aria-labelledby":r?ye:void 0,"aria-label":r?void 0:P,"aria-describedby":x?xe:void 0,className:s("relative bg-white shadow dark:bg-gray-700 border-b-4 transition-all duration-300 focus:outline-none",he?"rounded-none h-full flex flex-col":"rounded-lg"),children:[jsxs("div",{className:s("flex items-center justify-between p-4 md:p-5 rounded-t",h&&"border-b border-gray-200 dark:border-gray-600",S),children:[jsxs("div",{className:"flex items-center gap-3",children:[v&&jsx("div",{className:"shrink-0 text-gray-500 dark:text-gray-400",children:v}),jsxs("div",{children:[jsx("h3",{id:ye,className:s("text-xl font-semibold text-gray-900 dark:text-white",N),children:r}),x&&jsx("p",{id:xe,className:s("mt-1 text-sm text-gray-500 dark:text-gray-400",L),children:x})]})]}),jsxs("div",{className:"flex items-center gap-1 ms-auto",children:[c&&jsx("button",{type:"button",onClick:()=>F(Se=>!Se),className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white","aria-label":te,children:he?jsx("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M7 1H1v6m16 0V1h-6m0 16h6v-6M1 11v6h6"})}):jsx("svg",{className:"w-3.5 h-3.5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 18 18",children:jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M11 1h6v6M1 11v6h6m0-12L1 1m16 16-6-6"})})}),jsxs("button",{type:"button",onClick:t,className:"text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm w-8 h-8 inline-flex justify-center items-center dark:hover:bg-gray-600 dark:hover:text-white",children:[jsx("svg",{className:"w-3 h-3","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 14 14",children:jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"m1 1 6 6m0 0 6 6M7 7l6-6M7 7l-6 6"})}),jsx("span",{className:"sr-only",children:ge})]})]})]}),jsx("div",{className:s("p-4 md:p-5 space-y-4",he&&"flex-1 overflow-y-auto",E),children:o}),(d||u)&&jsxs("div",{className:s("flex items-center gap-2 p-4 md:p-5 rounded-b",b&&"border-t border-gray-200 dark:border-gray-600",f==="right"?"justify-end":f==="center"?"justify-center":"justify-start",R&&"flex-row-reverse",z),children:[u&&jsx("button",{type:"button",onClick:me,className:s("text-gray-500 bg-white hover:bg-gray-100 focus:ring-4 focus:outline-none focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 border border-gray-200 dark:bg-gray-700 dark:text-gray-300 dark:border-gray-500 dark:hover:bg-gray-600 dark:hover:text-white",G),children:$}),d&&jsx("button",{type:"button",onClick:ee,className:s("text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-500 dark:hover:bg-blue-600",A),children:C})]})]})})})});wr.displayName="Modal";function tf(e,t,r,o){let n=r*2+1+o*2+2;if(t<=n)return Array.from({length:t},(m,g)=>g+1);let a=Array.from({length:o},(m,g)=>g+1).filter(m=>m<=t),i=Array.from({length:o},(m,g)=>t-o+1+g).filter(m=>m>=1),c=Math.max(e-r,o+1),d=Math.min(e+r,t-o),l=c>o+2,p=d<t-o-1,u=[];for(let m of a)u.push(m);if(l)u.push("ellipsis");else for(let m=o+1;m<c;m++)u.push(m);for(let m=c;m<=d;m++)u.push(m);if(p)u.push("ellipsis");else for(let m=d+1;m<=t-o;m++)u.push(m);for(let m of i)u.includes(m)||u.push(m);return u}function rf({className:e}){return jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})})}function of({className:e}){return jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})})}function nf({className:e}){return jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 19l-7-7 7-7M18 19l-7-7 7-7"})})}function af({className:e}){return jsx("svg",{className:e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 5l7 7-7 7M6 5l7 7-7 7"})})}var sf={sm:{button:"h-7 min-w-7 px-1.5 text-xs",icon:"h-3 w-3",gap:"gap-0.5",text:"text-xs"},md:{button:"h-9 min-w-9 px-2.5 text-sm",icon:"h-4 w-4",gap:"gap-1",text:"text-sm"},lg:{button:"h-11 min-w-11 px-3.5 text-base",icon:"h-5 w-5",gap:"gap-1.5",text:"text-base"}},lf={default:{base:"rounded-md font-medium transition-colors",idle:"text-gray-700 hover:bg-gray-100 dark:text-gray-300 dark:hover:bg-gray-700",active:"bg-blue-600 text-white hover:bg-blue-700 dark:bg-blue-500 dark:hover:bg-blue-600",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"},outlined:{base:"rounded-md border font-medium transition-colors",idle:"border-gray-300 text-gray-700 hover:bg-gray-50 dark:border-gray-600 dark:text-gray-300 dark:hover:bg-gray-800",active:"border-blue-600 bg-blue-50 text-blue-600 hover:bg-blue-100 dark:border-blue-400 dark:bg-blue-900/30 dark:text-blue-400 dark:hover:bg-blue-900/50",disabled:"border-gray-200 text-gray-300 cursor-not-allowed dark:border-gray-700 dark:text-gray-600"},minimal:{base:"rounded-md font-medium transition-colors",idle:"text-gray-600 hover:text-gray-900 dark:text-gray-400 dark:hover:text-gray-200",active:"text-blue-600 font-semibold hover:text-blue-700 dark:text-blue-400 dark:hover:text-blue-300",disabled:"text-gray-300 cursor-not-allowed dark:text-gray-600"}};function df({page:e,totalPages:t,onPageChange:r,size:o="md",variant:n="default",showFirstLast:a=false,siblings:i=1,boundaries:c=1,disabled:d=false,labels:l,totalItems:p,pageSize:u,pageSizeOptions:m,onPageSizeChange:g,className:f,...h}){let b=sf[o],x=lf[n],v=useMemo(()=>tf(e,t,i,c),[e,t,i,c]),k=useCallback(A=>{d||A<1||A>t||A===e||r(A);},[d,t,e,r]),R=e<=1,S=e>=t,E=s("inline-flex items-center justify-center select-none",b.button,x.base),z=(A,G,q,M)=>jsx("button",{type:"button",onClick:A,disabled:d||G,"aria-label":q,"aria-disabled":d||G,className:s(E,d||G?x.disabled:x.idle),children:M}),N=p!==void 0&&u?(e-1)*u+1:void 0,L=p!==void 0&&u?Math.min(e*u,p):void 0;return jsxs("nav",{"aria-label":"Pagination",className:s("flex items-center",b.gap,f),...h,children:[p!==void 0&&u&&jsxs("span",{className:s("mr-2 text-gray-600 dark:text-gray-400 whitespace-nowrap",b.text),children:[N,"\u2013",L," of ",p]}),m&&m.length>0&&g&&jsxs("div",{className:s("mr-2 flex items-center whitespace-nowrap",b.gap,b.text),children:[jsx("label",{htmlFor:"pagination-page-size",className:"text-gray-600 dark:text-gray-400",children:"Rows:"}),jsx("select",{id:"pagination-page-size",value:u,onChange:A=>g(Number(A.target.value)),disabled:d,className:s("rounded border border-gray-300 bg-white px-1.5 py-0.5 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200",b.text,d&&"cursor-not-allowed opacity-50"),children:m.map(A=>jsx("option",{value:A,children:A},A))})]}),jsxs("div",{className:s("flex items-center",b.gap),children:[a&&z(()=>k(1),R,l?.first??"Go to first page",jsx(nf,{className:b.icon})),z(()=>k(e-1),R,l?.previous??"Go to previous page",jsx(rf,{className:b.icon})),v.map((A,G)=>A==="ellipsis"?jsx("span",{className:s("inline-flex items-center justify-center select-none",b.button,"text-gray-400 dark:text-gray-500"),"aria-hidden":"true",children:"\u2026"},`ellipsis-${G}`):jsx("button",{type:"button",onClick:()=>k(A),disabled:d,"aria-current":A===e?"page":void 0,"aria-label":`Page ${A}`,className:s(E,A===e?x.active:d?x.disabled:x.idle),children:A},A)),z(()=>k(e+1),S,l?.next??"Go to next page",jsx(of,{className:b.icon})),a&&z(()=>k(t),S,l?.last??"Go to last page",jsx(af,{className:b.icon}))]})]})}var cf={xs:"h-1",sm:"h-1.5",md:"h-2.5",lg:"h-4",xl:"h-6"},uf={default:"bg-gray-500 dark:bg-gray-400",primary:"bg-blue-600 dark:bg-blue-500",success:"bg-green-600 dark:bg-green-500",warning:"bg-yellow-500 dark:bg-yellow-400",error:"bg-red-600 dark:bg-red-500",info:"bg-cyan-600 dark:bg-cyan-500"},pf={default:"text-gray-700 dark:text-gray-300",primary:"text-blue-600 dark:text-blue-400",success:"text-green-600 dark:text-green-400",warning:"text-yellow-600 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",info:"text-cyan-600 dark:text-cyan-400"},ol="bg-[repeating-linear-gradient(45deg,transparent,transparent_10px,rgba(255,255,255,0.2)_10px,rgba(255,255,255,0.2)_20px)]",gf={default:"bg-gradient-to-r from-gray-400 to-gray-600",primary:"bg-gradient-to-r from-blue-400 to-blue-700",success:"bg-gradient-to-r from-green-400 to-green-700",warning:"bg-gradient-to-r from-yellow-300 to-yellow-600",error:"bg-gradient-to-r from-red-400 to-red-700",info:"bg-gradient-to-r from-cyan-400 to-cyan-700"};function al({value:e=0,indeterminate:t=false,size:r="md",color:o="primary",variant:n="default",showValue:a=false,valueFormat:i,label:c,animated:d=true,className:l,...p}){let u=Math.min(100,Math.max(0,e)),m=n==="gradient"?gf[o]:uf[o],g=i?i(u):`${Math.round(u)}%`;return jsxs("div",{className:s("w-full",l),...p,children:[(c||a)&&jsxs("div",{className:"flex items-center justify-between mb-1",children:[c&&jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:c}),a&&!t&&jsx("span",{className:s("text-sm font-semibold",pf[o],!c&&"ml-auto"),children:g})]}),jsx("div",{role:"progressbar","aria-valuenow":t?void 0:u,"aria-valuemin":0,"aria-valuemax":100,"aria-label":c,className:s("relative w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700",cf[r]),children:t?jsx("div",{className:s("absolute h-full w-1/3 rounded-full",m,n==="striped"&&ol,"animate-[progress-indeterminate_1.5s_ease-in-out_infinite]")}):jsx("div",{className:s("h-full rounded-full",m,n==="striped"&&ol,d&&"transition-[width] duration-300 ease-out"),style:{width:`${u}%`}})})]})}al.displayName="ProgressBar";var hf=e=>({sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"})[e],yf=e=>({sm:"w-2 h-2",md:"w-2.5 h-2.5",lg:"w-3 h-3"})[e],xf=(e,t,r,o,n,a,i,c)=>{if(t)return s("border-2",o?"":"border-red-500",r&&!n?"bg-red-500":"");switch(e){case "filled":return s("border-2",c?"":"border-gray-300 dark:border-gray-600",r?a?"":"bg-blue-600 border-blue-600 dark:bg-blue-500 dark:border-blue-500":i?"":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700");case "outlined":return s("border-[3px]",c?"":r?"border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800");default:return s("border-2",c?"":r?"border-blue-600 dark:border-blue-500":"border-gray-300 dark:border-gray-600","bg-white dark:bg-gray-800")}},vf={},sl=forwardRef(({label:e,description:t,value:r,checked:o,defaultChecked:n=false,onCheckedChange:a,size:i="md",variant:c="default",labelPosition:d="right",error:l=false,disabled:p=false,readOnly:u=false,required:m=false,checkedColor:g,uncheckedColor:f,borderColor:h,labelColor:b,errorColor:x,dotColor:v,hoverColor:k,focusRingColor:R,showFocusRing:S=true,className:E,containerClassName:z,...N},L)=>{let[A,G]=useState(n),q=o!==void 0,M=q?o:A,O=useId(),P=typeof l=="string"?l:void 0,y=!!l,T=xe=>{if(p||u)return;let le=xe.target.checked;q||G(le),a?.(le);},I=useMemo(()=>xf(c,y,M,x,v,g,f,h),[c,y,M,x,v,g,f,h]),oe=useMemo(()=>{let xe={};return g&&M&&(xe.backgroundColor=g,xe.borderColor=g),f&&!M&&(xe.backgroundColor=f),h&&(xe.borderColor=h),xe},[g,f,h,M]),ie=useMemo(()=>v?{backgroundColor:v}:{},[v]),we=useMemo(()=>b?{color:b}:{},[b]),he=useMemo(()=>x?{color:x}:{},[x]),F=b?"":"text-gray-700 dark:text-gray-200",Q=x?"":"text-red-500",ae=k?"":"hover:border-blue-500 dark:hover:border-blue-400",ye=R?"":"focus-visible:ring-blue-500";return jsxs("div",{className:s("inline-flex flex-col",z),style:vf,children:[jsxs("label",{className:s("inline-flex items-center cursor-pointer",p&&"opacity-50 cursor-not-allowed",u&&"cursor-default",d==="left"&&"flex-row-reverse"),htmlFor:O,children:[jsxs("div",{className:"relative inline-flex items-center",children:[jsx("input",{ref:L,type:"radio",id:O,value:r,checked:M,onChange:T,disabled:p,readOnly:u,required:m,"aria-invalid":y,"aria-describedby":P?`${O}-error`:void 0,className:"sr-only peer",tabIndex:u?-1:void 0,...N}),jsx("div",{className:s("rounded-full transition-all duration-200",hf(i),I,!p&&!u&&ae,!p&&!u&&S&&"peer-focus-visible:ring-2 ring-offset-2",!p&&!u&&S&&ye,E),style:oe,children:M&&jsx("div",{className:s("rounded-full absolute inset-0 m-auto transition-all duration-200",yf(i),v?"":c==="outlined"||c==="default"?"bg-blue-600 dark:bg-blue-500":"bg-white"),style:ie})})]}),e&&jsxs("span",{className:s("select-none",d==="left"?"mr-2":"ml-2",F,p&&"opacity-50"),style:we,children:[e,m&&jsx("span",{className:"text-red-500 ml-1",children:"*"})]})]}),t&&!y&&jsx("p",{className:s("text-sm text-gray-500 dark:text-gray-400 mt-1",d==="left"?"text-right":"ml-7"),children:t}),P&&jsx("p",{id:`${O}-error`,className:s("text-sm mt-1",d==="left"?"text-right":"ml-7",Q),style:he,children:P})]})});sl.displayName="RadioButton";var La=()=>{},Sf=[],Rf=jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0",children:jsx("path",{d:"M4 6L8 10L12 6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Tf=jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:"shrink-0",children:jsx("path",{d:"M10.5 3.5L3.5 10.5M3.5 3.5L10.5 10.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Ef=jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",className:"shrink-0 animate-spin",children:[jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"2",strokeOpacity:"0.25"}),jsx("path",{d:"M14 8a6 6 0 00-6-6",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]}),Df=jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:"shrink-0",children:jsx("path",{d:"M11.5 3.5L5.5 10.5L2.5 7.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),Go={sm:{trigger:"h-8 px-2.5 text-xs gap-1.5",content:"text-xs",option:"px-2.5 py-1.5",searchInput:"px-2.5 py-1.5 text-xs"},md:{trigger:"h-10 px-3 text-sm gap-2",content:"text-sm",option:"px-3 py-2",searchInput:"px-3 py-2 text-sm"},lg:{trigger:"h-12 px-4 text-base gap-2.5",content:"text-base",option:"px-4 py-2.5",searchInput:"px-4 py-2.5 text-base"}},il={default:{trigger:"border border-gray-300 bg-white dark:border-gray-600 dark:bg-gray-800",focus:"focus:ring-2 focus:ring-blue-500 focus:border-blue-500"},outlined:{trigger:"border-2 border-gray-300 bg-transparent dark:border-gray-600",focus:"focus:ring-2 focus:ring-blue-500 focus:border-blue-500"},filled:{trigger:"border border-transparent bg-gray-100 dark:bg-gray-700",focus:"focus:ring-2 focus:ring-blue-500 focus:border-blue-500"}};function Ir(...e){let t="";for(let r=0;r<e.length;r++){let o=e[r];o&&(t&&(t+=" "),t+=o);}return t}function If(e,t){if(!t)return e;let r=t.toLowerCase();return e.filter(o=>{if(o.label.toLowerCase().includes(r)||o.value.toLowerCase().includes(r))return true;if(o.keywords){for(let n of o.keywords)if(n.toLowerCase().includes(r))return true}return false})}var Mf=memo(forwardRef(function({option:t,isSelected:r,isHighlighted:o,isDisabled:n,sizeKey:a,optionId:i,onClick:c,onMouseEnter:d,index:l},p){let u=()=>{n||c(t.value);},m=()=>{n||d(l);};return jsxs("div",{ref:p,id:i,role:"option","aria-selected":r,"aria-disabled":n||void 0,"data-highlighted":o||void 0,className:Ir(Go[a].option,"flex items-center gap-2 cursor-pointer select-none transition-colors",o&&!n&&"bg-blue-50 dark:bg-blue-900/30",r&&!o&&"bg-gray-50 dark:bg-gray-700/50",n&&"opacity-50 cursor-not-allowed"),onClick:u,onMouseEnter:m,children:[t.icon?jsx("span",{className:"flex shrink-0 items-center",children:t.icon}):null,jsxs("span",{className:"flex flex-col min-w-0 flex-1",children:[jsx("span",{className:"truncate",children:t.label}),t.description?jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 truncate",children:t.description}):null]}),r?jsx("span",{className:"ml-auto text-blue-600 dark:text-blue-400",children:Df}):null]})}));function Pf({options:e=Sf,value:t,defaultValue:r,onValueChange:o,searchable:n=false,clearable:a=false,disabled:i=false,readOnly:c=false,loading:d=false,size:l="md",variant:p="default",placeholder:u="Select...",label:m,description:g,helperText:f,error:h,required:b=false,noOptionsText:x="No options",onSearchChange:v,name:k,className:R,triggerClassName:S,contentClassName:E,maxHeight:z=256}){let N=useId(),L=`${N}-label`,A=`${N}-trigger`,G=`${N}-listbox`,q=useRef(null),M=useRef(null),O=useRef(null),P=useRef([]),y=t!==void 0,[T,I]=useState(r??""),oe=y?t:T,[ie,we]=useState(false),[he,F]=useState(""),[Q,ae]=useState(-1),[ye,xe]=useState(null),le=useMemo(()=>n?If(e,he):e,[e,he,n]),X=useMemo(()=>e.find(J=>J.value===oe)??null,[e,oe]),C=useMemo(()=>{let J=new Set;for(let fe of e)fe.disabled&&J.add(fe.value);return J},[e]),$=useCallback(J=>{y||I(J),(o??La)(J),we(false),F(""),ae(-1),q.current?.focus();},[y,o]),ge=useCallback(J=>{J.stopPropagation(),y||I(""),(o??La)(""),F(""),q.current?.focus();},[y,o]),te=useCallback(()=>{i||c||(we(true),F(""),ae(-1));},[i,c]),B=useCallback(()=>{we(false),F(""),ae(-1),q.current?.focus();},[]),ee=useCallback(()=>{ie?B():te();},[ie,B,te]),me=useCallback((J,fe)=>{let Ke=le.length;if(Ke===0)return -1;let xt=J;for(let Ee=0;Ee<Ke;Ee++)if(xt=((xt+fe)%Ke+Ke)%Ke,!C.has(le[xt].value))return xt;return -1},[le,C]),Se=useCallback(J=>{if(!(i||c)){if(ie){switch(J.key){case "ArrowDown":{J.preventDefault();let fe=me(Q,1);fe!==-1&&ae(fe);break}case "ArrowUp":{J.preventDefault();let fe=me(Q,-1);fe!==-1&&ae(fe);break}case "Home":{J.preventDefault();let fe=me(-1,1);fe!==-1&&ae(fe);break}case "End":{J.preventDefault();let fe=me(le.length,-1);fe!==-1&&ae(fe);break}case "Enter":{if(J.preventDefault(),Q>=0&&Q<le.length){let fe=le[Q];C.has(fe.value)||$(fe.value);}break}case " ":if(J.preventDefault(),Q>=0&&Q<le.length){let fe=le[Q];C.has(fe.value)||$(fe.value);}else B();break;case "Escape":J.preventDefault(),B();break;case "Tab":B();break}return}switch(J.key){case "ArrowDown":case "ArrowUp":J.preventDefault(),te();break;case "Enter":case " ":J.preventDefault(),te();break}}},[i,c,ie,te,B,Q,le,C,me,$]),j=useCallback(J=>{switch(J.key){case "ArrowDown":{J.preventDefault();let fe=me(Q,1);fe!==-1&&ae(fe);break}case "ArrowUp":{J.preventDefault();let fe=me(Q,-1);fe!==-1&&ae(fe);break}case "Home":{J.preventDefault();let fe=me(-1,1);fe!==-1&&ae(fe);break}case "End":{J.preventDefault();let fe=me(le.length,-1);fe!==-1&&ae(fe);break}case "Enter":{if(J.preventDefault(),Q>=0&&Q<le.length){let fe=le[Q];C.has(fe.value)||$(fe.value);}break}case "Escape":J.preventDefault(),B();break;case "Tab":B();break}},[Q,le,C,me,$,B]),Te=useCallback(J=>{let fe=J.target.value;F(fe),ae(-1),(v??La)(fe);},[v]);useEffect(()=>{if(!ie)return;let J=fe=>{let Ke=fe.target;q.current?.contains(Ke)||M.current?.contains(Ke)||B();};return document.addEventListener("mousedown",J),document.addEventListener("touchstart",J,{passive:true}),()=>{document.removeEventListener("mousedown",J),document.removeEventListener("touchstart",J);}},[ie,B]),useEffect(()=>{if(!ie||!q.current){xe(null);return}let J=()=>{let fe=q.current;if(!fe)return;let Ke=fe.getBoundingClientRect(),xt=window.innerHeight-Ke.bottom,Ee=Ke.top,We=z+8,ht=xt<We&&Ee>xt?"top":"bottom";xe({top:ht==="bottom"?Ke.bottom+window.scrollY+4:Ke.top+window.scrollY-We,left:Ke.left+window.scrollX,width:Ke.width,placement:ht});};return J(),window.addEventListener("scroll",J,true),window.addEventListener("resize",J),()=>{window.removeEventListener("scroll",J,true),window.removeEventListener("resize",J);}},[ie,z]),useEffect(()=>{ie&&n&&O.current?.focus();},[ie,n]),useEffect(()=>{let J=M.current;if(!(!ie||!J))return $r(J,()=>q.current)},[ie]),useEffect(()=>{if(Q>=0){let J=P.current[Q];J&&typeof J.scrollIntoView=="function"&&J.scrollIntoView({block:"nearest"});}},[Q]);let Pe=oe!==""&&oe!==void 0,et=a&&Pe&&!i&&!c&&!d,at=!i&&!c,pt=Ir("w-full flex items-center justify-between rounded-md transition-colors","text-gray-900 dark:text-gray-100",Go[l].trigger,il[p].trigger,!h&&at&&il[p].focus,h&&"border-red-500 dark:border-red-400 focus:ring-2 focus:ring-red-500 focus:border-red-500",i&&"opacity-50 cursor-not-allowed bg-gray-50 dark:bg-gray-900",c&&"cursor-default",!i&&!c&&"cursor-pointer",S);return jsxs("div",{className:Ir("flex flex-col gap-1",R),children:[m?jsxs("label",{id:L,htmlFor:A,className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:[m,b?jsx("span",{className:"text-red-500 ml-0.5","aria-hidden":"true",children:"*"}):null]}):null,g?jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:g}):null,jsxs("button",{ref:q,id:A,type:"button",role:"combobox","aria-expanded":ie,"aria-haspopup":"listbox","aria-controls":ie?G:void 0,"aria-labelledby":m?L:void 0,"aria-required":b||void 0,"aria-invalid":h?true:void 0,"aria-activedescendant":ie&&Q>=0?`${N}-option-${Q}`:void 0,disabled:i,className:pt,onClick:at?ee:void 0,onKeyDown:Se,children:[jsxs("span",{className:Ir("flex items-center gap-2 min-w-0 flex-1 truncate",!Pe&&"text-gray-400 dark:text-gray-500"),children:[X?.icon?jsx("span",{className:"flex shrink-0 items-center",children:X.icon}):null,jsx("span",{className:"truncate",children:Pe&&X?X.label:u})]}),jsxs("span",{className:"flex items-center gap-1 shrink-0",children:[d?jsx("span",{className:"text-gray-400",children:Ef}):null,et?jsx("span",{role:"button",tabIndex:-1,"aria-label":"Clear selection",className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 p-0.5 rounded transition-colors",onClick:ge,onMouseDown:J=>J.preventDefault(),children:Tf}):null,jsx("span",{className:Ir("text-gray-400 transition-transform duration-200",ie&&"rotate-180"),children:Rf})]})]}),h?jsx("p",{role:"alert",className:"text-xs text-red-500 dark:text-red-400",children:h}):f?jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:f}):null,k?jsx("input",{type:"hidden",name:k,value:oe??""}):null,ie&&ye?createPortal(jsxs("div",{ref:M,role:"listbox",id:G,"aria-labelledby":m?L:void 0,className:Ir("fixed z-50 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700","rounded-md shadow-lg overflow-hidden","animate-in fade-in-0 zoom-in-95",Go[l].content,E),style:{top:ye.top,left:ye.left,width:ye.width,position:"absolute"},onKeyDown:j,children:[n?jsx("div",{className:"border-b border-gray-200 dark:border-gray-700",children:jsx("input",{ref:O,type:"text",role:"searchbox","aria-label":"Search options",className:Ir(Go[l].searchInput,"w-full outline-none bg-transparent text-gray-900 dark:text-gray-100","placeholder:text-gray-400 dark:placeholder:text-gray-500"),placeholder:"Search...",value:he,onChange:Te,onKeyDown:j})}):null,jsx("div",{className:"overflow-y-auto",style:{maxHeight:z},children:le.length===0?jsx("div",{className:Ir(Go[l].option,"text-gray-500 dark:text-gray-400 text-center py-4"),children:x}):le.map((J,fe)=>jsx(Mf,{option:J,isSelected:J.value===oe,isHighlighted:fe===Q,isDisabled:d||C.has(J.value),sizeKey:l,optionId:`${N}-option-${fe}`,onClick:$,onMouseEnter:ae,index:fe,ref:Ke=>{P.current[fe]=Ke;}},J.value))})]}),document.body):null]})}var Aa=createContext(null);function jr(){let e=useContext(Aa);if(!e)throw new Error("Sidebar sub-components must be used within <Sidebar>");return e}function Af(){return jr()}var Wf=({className:e})=>jsx("svg",{className:s("w-4 h-4",e),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M12.79 5.23a.75.75 0 01-.02 1.06L8.832 10l3.938 3.71a.75.75 0 11-1.04 1.08l-4.5-4.25a.75.75 0 010-1.08l4.5-4.25a.75.75 0 011.06.02z",clipRule:"evenodd"})}),Ff=({className:e})=>jsx("svg",{className:s("w-4 h-4",e),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"})}),Hf=({className:e})=>jsx("svg",{className:s("w-5 h-5",e),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{d:"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"})});function cl({text:e,position:t,children:r}){let[o,n]=useState(false),[a,i]=useState({top:0,left:0}),c=useRef(null);return jsxs("div",{ref:c,onMouseEnter:()=>{if(c.current){let l=c.current.getBoundingClientRect();i({top:l.top+l.height/2,left:t==="left"?l.right+8:l.left-8});}n(true);},onMouseLeave:()=>n(false),className:"relative",children:[r,o&&jsx("div",{className:s("fixed z-[9999] px-2.5 py-1.5 text-xs font-medium text-white bg-gray-900 dark:bg-gray-700 rounded-md shadow-lg whitespace-nowrap pointer-events-none",t==="right"&&"-translate-x-full"),style:{top:a.top,left:a.left,transform:`translateY(-50%)${t==="right"?" translateX(-100%)":""}`},role:"tooltip",children:e})]})}function Bf({collapsed:e,defaultCollapsed:t=false,onCollapsedChange:r,expandedWidth:o=260,collapsedWidth:n=64,position:a="left",variant:i="default",mobileBreakpoint:c=768,mobileOpen:d,onMobileOpenChange:l,className:p,"aria-label":u,closeLabel:m,trapFocus:g=true,initialFocus:f,returnFocus:h,lockScroll:b=true,children:x}){let v=Gt(),k=useRef(null),R=useRef(null),[S,E]=useState(t),[z,N]=useState(false),[L,A]=useState(false),G=e!==void 0,q=G?e:S,M=d!==void 0,O=M?d:z;useEffect(()=>{let F=window.matchMedia(`(max-width: ${c}px)`),Q=ae=>{A(ae.matches),ae.matches||(M||N(false),l?.(false));};return Q(F),F.addEventListener("change",Q),()=>F.removeEventListener("change",Q)},[c,M,l]);let P=useCallback(()=>{if(L){let F=!O;M||N(F),l?.(F);}else {let F=!q;G||E(F),r?.(F);}},[L,O,q,M,G,l,r]),y=useCallback(()=>{M||N(false),l?.(false);},[M,l]);useEffect(()=>{let F=R.current;F&&(L&&!O?(F.setAttribute("inert",""),F.setAttribute("aria-hidden","true")):(F.removeAttribute("inert"),F.removeAttribute("aria-hidden")));},[L,O]);let{dialogRef:T,dialogProps:I}=Ur({open:L&&O,onClose:y,trapFocus:g,initialFocus:f,returnFocus:h,lockScroll:b,keepInteractive:[k]}),oe={default:"bg-white dark:bg-gray-900",bordered:s("bg-white dark:bg-gray-900",a==="left"?"border-r border-gray-200 dark:border-gray-700":"border-l border-gray-200 dark:border-gray-700"),floating:"bg-white dark:bg-gray-900 m-3 rounded-xl shadow-xl border border-gray-200 dark:border-gray-700"},ie=q&&!L?n:o,we=jsx("aside",{className:s("flex flex-col h-full overflow-hidden transition-[width] duration-200 ease-in-out",oe[i],p),style:{width:L?o:ie,minWidth:L?o:ie},"data-testid":"sidebar","data-collapsed":q&&!L,"data-mobile":L,"data-position":a,children:x}),he={collapsed:q&&!L,isMobile:L,mobileOpen:O,position:a,variant:i,expandedWidth:o,collapsedWidth:n,toggle:P,closeMobile:y,closeLabel:m};return L?jsxs(Aa.Provider,{value:he,children:[O&&jsx("div",{ref:k,className:"fixed inset-0 z-40 bg-black/50 transition-opacity",onClick:y,"aria-hidden":"true","data-testid":"sidebar-overlay"}),jsx("div",{ref:F=>{R.current=F,T.current=F;},...I,"aria-label":u??v.sidebar,className:s("fixed top-0 z-50 h-full transition-transform duration-200 ease-in-out focus:outline-none",a==="left"?"left-0":"right-0",O?"translate-x-0":a==="left"?"-translate-x-full":"translate-x-full"),children:we})]}):jsx(Aa.Provider,{value:he,children:we})}function Of({className:e,children:t}){let r=jr(),o=Gt();return jsxs("div",{className:s("flex items-center shrink-0 px-4 h-14 overflow-hidden",r.collapsed&&"justify-center px-2",e),"data-testid":"sidebar-header",children:[t,r.isMobile&&r.mobileOpen&&jsx("button",{type:"button",onClick:r.closeMobile,className:"ml-auto p-1 rounded-md text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer","aria-label":r.closeLabel??o.closeSidebar,children:jsx(Hf,{})})]})}function Vf({className:e,children:t}){return jsx("div",{className:s("flex-1 overflow-y-auto overflow-x-hidden py-2",e),"data-testid":"sidebar-content",children:t})}function _f({className:e,children:t}){let r=jr();return jsx("div",{className:s("shrink-0 border-t border-gray-200 dark:border-gray-700 px-4 py-3 overflow-hidden",r.collapsed&&"px-2 flex justify-center",e),"data-testid":"sidebar-footer",children:t})}function $f({label:e,className:t,children:r}){let o=jr();return jsxs("div",{className:s("py-2",t),"data-testid":"sidebar-group",children:[e&&!o.collapsed&&jsx("div",{className:"px-4 py-1.5 text-[11px] font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500",children:e}),e&&o.collapsed&&jsx("div",{className:"mx-auto my-1 w-6 border-t border-gray-200 dark:border-gray-700"}),jsx("div",{className:"space-y-0.5 px-2",children:r})]})}function Uf({icon:e,label:t,badge:r,badgeColor:o="bg-blue-600 text-white",active:n=false,disabled:a=false,href:i,onClick:c,tooltip:d,className:l}){let p=jr(),u=p.collapsed,m=d??t,g=jsxs(Fragment,{children:[e&&jsx("span",{className:s("shrink-0 w-5 h-5",u&&"w-5 h-5"),children:e}),!u&&jsxs(Fragment,{children:[jsx("span",{className:"flex-1 truncate",children:t}),r!=null&&jsx("span",{className:s("shrink-0 inline-flex items-center justify-center rounded-full text-[10px] font-semibold min-w-[18px] h-[18px] px-1",o),children:r})]}),u&&r!==void 0&&r!==null&&jsx("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-blue-600"})]}),f=s("relative flex items-center gap-3 rounded-md text-sm font-medium transition-colors w-full",u?"justify-center px-2 py-2.5":"px-3 py-2",n?"bg-blue-50 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400":"text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800",a&&"opacity-50 pointer-events-none",!a&&"cursor-pointer",l),h=()=>{a||(c?.(),p.isMobile&&p.closeMobile());},b=i?jsx("a",{href:a?void 0:i,className:f,onClick:h,"aria-current":n?"page":void 0,"data-testid":"sidebar-item",children:g}):jsx("button",{type:"button",className:f,onClick:h,disabled:a,"aria-current":n?"page":void 0,"data-testid":"sidebar-item",children:g});return u?jsx(cl,{text:m,position:p.position,children:b}):b}function Gf({icon:e,label:t,badge:r,defaultOpen:o=false,className:n,children:a}){let i=jr(),[c,d]=useState(o),l=useRef(null),[p,u]=useState(o?void 0:0),m=useRef(true);return useEffect(()=>{if(m.current){m.current=false,u(c?void 0:0);return}if(c){let g=l.current;if(g){u(g.scrollHeight);let f=setTimeout(()=>u(void 0),200);return ()=>clearTimeout(f)}}else {let g=l.current;g&&(u(g.scrollHeight),requestAnimationFrame(()=>u(0)));}},[c]),i.collapsed?jsx(cl,{text:t,position:i.position,children:jsxs("button",{type:"button",className:s("relative flex items-center justify-center gap-3 rounded-md text-sm font-medium transition-colors w-full px-2 py-2.5","text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer",n),onClick:()=>{i.toggle(),d(true);},"data-testid":"sidebar-submenu-trigger",children:[e&&jsx("span",{className:"shrink-0 w-5 h-5",children:e}),r!=null&&jsx("span",{className:"absolute top-1 right-1 w-2 h-2 rounded-full bg-blue-600"})]})}):jsxs("div",{className:n,"data-testid":"sidebar-submenu",children:[jsxs("button",{type:"button",className:s("flex items-center gap-3 rounded-md text-sm font-medium transition-colors w-full px-3 py-2","text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 cursor-pointer"),onClick:()=>d(!c),"aria-expanded":c,"data-testid":"sidebar-submenu-trigger",children:[e&&jsx("span",{className:"shrink-0 w-5 h-5",children:e}),jsx("span",{className:"flex-1 truncate text-left",children:t}),r!=null&&jsx("span",{className:"shrink-0 inline-flex items-center justify-center rounded-full text-[10px] font-semibold min-w-[18px] h-[18px] px-1 bg-blue-600 text-white",children:r}),jsx(Ff,{className:s("shrink-0 text-gray-400 transition-transform duration-200",c&&"rotate-180")})]}),jsx("div",{className:"overflow-hidden transition-[height] duration-200 ease-in-out",style:{height:p===void 0?"auto":p},children:jsx("div",{ref:l,className:"pl-4 py-0.5",children:a})})]})}function Kf({className:e}){let t=jr(),r=Gt(),o=t.isMobile?t.mobileOpen?t.closeLabel??r.closeSidebar:r.openSidebar:t.collapsed?r.expandSidebar:r.collapseSidebar;return jsx("button",{type:"button",onClick:t.toggle,className:s("p-1.5 rounded-md text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors cursor-pointer",e),"aria-label":o,"data-testid":"sidebar-toggle",children:jsx(Wf,{className:s("transition-transform duration-200",t.collapsed&&"rotate-180",t.position==="right"&&!t.collapsed&&"rotate-180",t.position==="right"&&t.collapsed&&"rotate-0")})})}var Yf={text:"rounded h-4 w-full",circular:"rounded-full",rectangular:"rounded-none",rounded:"rounded-lg"},Xf={pulse:"animate-pulse",wave:"animate-shimmer bg-gradient-to-r from-gray-200 via-gray-100 to-gray-200 dark:from-gray-700 dark:via-gray-600 dark:to-gray-700 bg-[length:200%_100%]",none:""},jf="bg-gray-200 dark:bg-gray-700";function ul({variant:e="text",animation:t="pulse",width:r,height:o,count:n=1,className:a,style:i,...c}){let d={...r!==void 0&&{width:typeof r=="number"?`${r}px`:r},...o!==void 0&&{height:typeof o=="number"?`${o}px`:o},...i};e==="circular"&&r&&!o&&(d.height=d.width);let l=s(jf,Yf[e],Xf[t],a);return n===1?jsx("div",{className:l,style:d,"aria-busy":"true","aria-live":"polite",...c}):jsx("div",{className:"space-y-2",children:Array.from({length:n}).map((p,u)=>jsx("div",{className:l,style:d,"aria-busy":"true","aria-live":"polite",...c},u))})}ul.displayName="Skeleton";var em={sm:"h-1",md:"h-1.5",lg:"h-2"},tm={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},rm={sm:14,md:16,lg:20},om="[&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-moz-range-thumb]:appearance-none [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-0",nm={sm:"[&::-webkit-slider-thumb]:h-3.5 [&::-webkit-slider-thumb]:w-3.5 [&::-moz-range-thumb]:h-3.5 [&::-moz-range-thumb]:w-3.5",md:"[&::-webkit-slider-thumb]:h-4 [&::-webkit-slider-thumb]:w-4 [&::-moz-range-thumb]:h-4 [&::-moz-range-thumb]:w-4",lg:"[&::-webkit-slider-thumb]:h-5 [&::-webkit-slider-thumb]:w-5 [&::-moz-range-thumb]:h-5 [&::-moz-range-thumb]:w-5"},am={sm:"h-4",md:"h-5",lg:"h-6"},sm={primary:"bg-blue-600 dark:bg-blue-500",success:"bg-green-600 dark:bg-green-500",warning:"bg-yellow-500 dark:bg-yellow-400",error:"bg-red-600 dark:bg-red-500",info:"bg-cyan-600 dark:bg-cyan-500",neutral:"bg-gray-600 dark:bg-gray-400"},im={primary:"border-blue-600 dark:border-blue-500",success:"border-green-600 dark:border-green-500",warning:"border-yellow-500 dark:border-yellow-400",error:"border-red-600 dark:border-red-500",info:"border-cyan-600 dark:border-cyan-500",neutral:"border-gray-600 dark:border-gray-400"},lm={primary:"peer-focus-visible:ring-blue-500",success:"peer-focus-visible:ring-green-500",warning:"peer-focus-visible:ring-yellow-500",error:"peer-focus-visible:ring-red-500",info:"peer-focus-visible:ring-cyan-500",neutral:"peer-focus-visible:ring-gray-500"},dm={primary:"text-blue-600 dark:text-blue-400",success:"text-green-600 dark:text-green-400",warning:"text-yellow-600 dark:text-yellow-400",error:"text-red-600 dark:text-red-400",info:"text-cyan-600 dark:text-cyan-400",neutral:"text-gray-700 dark:text-gray-300"},pl=(e,t,r)=>Math.min(r,Math.max(t,e)),Fa=(e,t,r)=>r>t?(pl(e,t,r)-t)/(r-t)*100:0,Dn=(e,t)=>{let r=(.5-e/100)*t,o=Math.round(Math.abs(r)*1e3)/1e3;return `calc(${e}% ${r<0?"-":"+"} ${o}px)`},cm=(e,t,r,o)=>{if(!e)return [];if(Array.isArray(e))return e;let n=o>0?o:1,a=Math.floor((r-t)/n);return a<=0||a>20?[{value:t},{value:r}]:Array.from({length:a+1},(i,c)=>({value:t+c*n}))},gl=forwardRef(({value:e,defaultValue:t,onValueChange:r,min:o=0,max:n=100,step:a=1,size:i="md",color:c="primary",disabled:d=false,readOnly:l=false,label:p,description:u,error:m=false,showValue:g=false,showTooltip:f=false,valueFormat:h,marks:b,trackColor:x,fillColor:v,thumbColor:k,className:R,containerClassName:S,id:E,...z},N)=>{let[L,A]=useState(t??o),G=e!==void 0,M=pl(G?e:L,o,n),O=useId(),P=E??O,y=typeof m=="string"?m:void 0,T=!!m,I=!d&&!l,oe=T?"error":c,ie=Fa(M,o,n),we=rm[i],he=X=>{if(!I)return;let C=Number(X.target.value);G||A(C),r?.(C);},F=useMemo(()=>cm(b,o,n,a),[b,o,n,a]),Q=F.some(X=>X.label!=null),ae=h?h(M):`${M}`,ye={width:Dn(ie,we)};v&&(ye.backgroundColor=v);let xe={left:Dn(ie,we)};k&&(xe.backgroundColor=k,xe.borderColor=k);let le=x?{backgroundColor:x}:{};return jsxs("div",{className:s("w-full",S),children:[(p||g)&&jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[p?jsx("label",{htmlFor:P,className:s("text-sm font-medium text-gray-700 dark:text-gray-200",d&&"opacity-50"),children:p}):jsx("span",{}),g&&jsx("span",{className:s("text-sm font-semibold tabular-nums",dm[oe]),children:ae})]}),jsxs("div",{className:s("relative flex items-center",am[i],d&&"opacity-50"),children:[jsx("input",{ref:N,type:"range",id:P,min:o,max:n,step:a,value:M,onChange:he,disabled:d,readOnly:l,"aria-invalid":T,"aria-readonly":l||void 0,"aria-describedby":y?`${P}-error`:void 0,tabIndex:I?void 0:-1,className:s("peer absolute inset-0 z-10 m-0 h-full w-full cursor-pointer appearance-none bg-transparent opacity-0",om,nm[i],!I&&"pointer-events-none cursor-default",R),...z}),jsxs("div",{className:s("pointer-events-none relative w-full overflow-hidden rounded-full bg-gray-200 dark:bg-gray-700",em[i]),style:le,children:[jsx("div",{className:s("absolute inset-y-0 left-0 rounded-full transition-[width] duration-150 ease-out",v?"":sm[oe]),style:ye}),F.map((X,C)=>{let $=Fa(X.value,o,n),ge=X.value<=M;return jsx("span",{"data-slider-mark":"",className:s("absolute top-1/2 h-1 w-1 -translate-x-1/2 -translate-y-1/2 rounded-full",ge?"bg-white/80":"bg-gray-400 dark:bg-gray-500"),style:{left:Dn($,we)}},`mark-${X.value}-${C}`)})]}),jsx("div",{"data-slider-thumb":"",className:s("pointer-events-none absolute top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 bg-white shadow transition-transform dark:bg-gray-100",tm[i],k?"":im[oe],I&&"peer-hover:scale-110 peer-active:scale-110","peer-focus-visible:scale-110 peer-focus-visible:ring-2 peer-focus-visible:ring-offset-2",lm[oe]),style:xe,children:f&&jsx("span",{"data-slider-tooltip":"",className:s("pointer-events-none absolute bottom-full left-1/2 mb-2 -translate-x-1/2 rounded bg-gray-900 px-1.5 py-0.5 text-xs font-medium text-white opacity-0 transition-opacity dark:bg-gray-700","peer-hover:opacity-100 peer-focus-visible:opacity-100 peer-active:opacity-100"),children:ae})})]}),Q&&jsx("div",{className:"relative mt-1.5 h-4",children:F.map((X,C)=>X.label!=null?jsx("span",{className:"absolute -translate-x-1/2 whitespace-nowrap text-xs text-gray-500 dark:text-gray-400",style:{left:Dn(Fa(X.value,o,n),we)},children:X.label},`mark-label-${X.value}-${C}`):null)}),u&&!y&&jsx("p",{className:"mt-1.5 text-sm text-gray-500 dark:text-gray-400",children:u}),y&&jsx("p",{id:`${P}-error`,className:"mt-1.5 text-sm text-red-500 dark:text-red-400",children:y})]})});gl.displayName="Slider";function um({children:e,className:t,...r}){return jsx("table",{className:s("w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400",t),...r,children:e})}function gm({children:e,className:t,...r}){return jsx("thead",{className:s("text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400",t),...r,children:jsx("tr",{children:e})})}function fm({children:e,onClick:t,hidden:r=false,className:o,sortable:n=false,...a}){return jsx("th",{scope:"col",className:s("px-6 py-3",n&&"cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-600",o),onClick:t,hidden:r,...a,children:e})}function bm({children:e,className:t,...r}){return jsx("tbody",{className:s(t),...r,children:e})}function ym({children:e,onClick:t,clickable:r=true,className:o,...n}){return jsx("tr",{className:s("bg-white border-b dark:bg-gray-800 dark:border-gray-700",r&&"hover:bg-gray-50 hover:cursor-pointer dark:hover:bg-gray-600",o),onClick:t,...n,children:e})}function vm({children:e,onClick:t,hidden:r=false,className:o,...n}){return jsx("td",{className:s("px-6 py-4",o),onClick:t,hidden:r,...n,children:e})}var Ha=createContext(null);function mo(){let e=useContext(Ha);if(!e)throw new Error("Tabs components must be used within a Tabs provider");return e}function bl({children:e,defaultValue:t="",value:r,onValueChange:o,variant:n="underline",size:a="md",color:i="default",fullWidth:c=false,orientation:d="horizontal",className:l}){let[p,u]=useState(t),m=r!==void 0,g=m?r:p,f=useCallback(b=>{m||u(b),o?.(b);},[m,o]),h=useMemo(()=>({value:g,onValueChange:f,variant:n,size:a,color:i,orientation:d,fullWidth:c}),[g,f,n,a,i,d,c]);return jsx(Ha.Provider,{value:h,children:jsx("div",{className:s("w-full",d==="vertical"&&"flex gap-4",l),"data-orientation":d,children:e})})}bl.displayName="Tabs";var Tm={none:"gap-0",sm:"gap-1",md:"gap-2",lg:"gap-4"};function hl({children:e,className:t,bgColor:r,gap:o="none"}){let{variant:n,orientation:a,fullWidth:i}=mo(),c=s("flex",a==="vertical"?"flex-col":"flex-row items-center",Tm[o]),d={underline:"border-b border-gray-200 dark:border-gray-700",pills:s("p-1 rounded-lg",r||"bg-gray-100 dark:bg-gray-800"),enclosed:"border-b border-gray-200 dark:border-gray-700",soft:s("p-1 rounded-lg",r||"bg-gray-100/50 dark:bg-gray-800/50")};return jsx("div",{role:"tablist","aria-orientation":a,className:s(c,d[n],i&&"w-full",t),children:e})}hl.displayName="TabsList";var Dm={sm:"px-3 py-1.5 text-xs gap-1.5",md:"px-4 py-2 text-sm gap-2",lg:"px-5 py-2.5 text-base gap-2"},yl={sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5"},xl={default:{underline:{active:"text-gray-900 dark:text-white border-gray-900 dark:border-white",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-gray-700 dark:hover:text-gray-300"},pills:{active:"bg-white dark:bg-gray-700 text-gray-900 dark:text-white shadow-sm",inactive:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white"},enclosed:{active:"bg-white dark:bg-gray-800 text-gray-900 dark:text-white border-gray-200 dark:border-gray-700 border-b-white dark:border-b-gray-800",inactive:"text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 border-transparent"},soft:{active:"bg-gray-200 dark:bg-gray-700 text-gray-900 dark:text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white hover:bg-gray-100 dark:hover:bg-gray-700/50"}},primary:{underline:{active:"text-blue-600 dark:text-blue-400 border-blue-600 dark:border-blue-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-blue-600 dark:hover:text-blue-400"},pills:{active:"bg-blue-600 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400"},enclosed:{active:"bg-blue-50 dark:bg-blue-900/20 text-blue-600 dark:text-blue-400 border-blue-200 dark:border-blue-800 border-b-blue-50 dark:border-b-blue-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 border-transparent"},soft:{active:"bg-blue-100 dark:bg-blue-900/50 text-blue-700 dark:text-blue-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20"}},secondary:{underline:{active:"text-purple-600 dark:text-purple-400 border-purple-600 dark:border-purple-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-purple-600 dark:hover:text-purple-400"},pills:{active:"bg-purple-600 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400"},enclosed:{active:"bg-purple-50 dark:bg-purple-900/20 text-purple-600 dark:text-purple-400 border-purple-200 dark:border-purple-800 border-b-purple-50 dark:border-b-purple-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 border-transparent"},soft:{active:"bg-purple-100 dark:bg-purple-900/50 text-purple-700 dark:text-purple-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-purple-600 dark:hover:text-purple-400 hover:bg-purple-50 dark:hover:bg-purple-900/20"}},success:{underline:{active:"text-green-600 dark:text-green-400 border-green-600 dark:border-green-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-green-600 dark:hover:text-green-400"},pills:{active:"bg-green-600 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-green-600 dark:hover:text-green-400"},enclosed:{active:"bg-green-50 dark:bg-green-900/20 text-green-600 dark:text-green-400 border-green-200 dark:border-green-800 border-b-green-50 dark:border-b-green-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-green-600 dark:hover:text-green-400 border-transparent"},soft:{active:"bg-green-100 dark:bg-green-900/50 text-green-700 dark:text-green-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-green-600 dark:hover:text-green-400 hover:bg-green-50 dark:hover:bg-green-900/20"}},warning:{underline:{active:"text-yellow-600 dark:text-yellow-400 border-yellow-600 dark:border-yellow-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-yellow-600 dark:hover:text-yellow-400"},pills:{active:"bg-yellow-500 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-yellow-600 dark:hover:text-yellow-400"},enclosed:{active:"bg-yellow-50 dark:bg-yellow-900/20 text-yellow-600 dark:text-yellow-400 border-yellow-200 dark:border-yellow-800 border-b-yellow-50 dark:border-b-yellow-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-yellow-600 dark:hover:text-yellow-400 border-transparent"},soft:{active:"bg-yellow-100 dark:bg-yellow-900/50 text-yellow-700 dark:text-yellow-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-yellow-600 dark:hover:text-yellow-400 hover:bg-yellow-50 dark:hover:bg-yellow-900/20"}},error:{underline:{active:"text-red-600 dark:text-red-400 border-red-600 dark:border-red-400",inactive:"text-gray-500 dark:text-gray-400 border-transparent hover:text-red-600 dark:hover:text-red-400"},pills:{active:"bg-red-600 text-white",inactive:"text-gray-600 dark:text-gray-400 hover:text-red-600 dark:hover:text-red-400"},enclosed:{active:"bg-red-50 dark:bg-red-900/20 text-red-600 dark:text-red-400 border-red-200 dark:border-red-800 border-b-red-50 dark:border-b-red-900/20",inactive:"text-gray-500 dark:text-gray-400 hover:text-red-600 dark:hover:text-red-400 border-transparent"},soft:{active:"bg-red-100 dark:bg-red-900/50 text-red-700 dark:text-red-300",inactive:"text-gray-600 dark:text-gray-400 hover:text-red-600 dark:hover:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/20"}}},Im={underline:"border-b-2 -mb-px",pills:"rounded-md",enclosed:"border border-b-0 rounded-t-md -mb-px",soft:"rounded-md"};function vl({value:e,children:t,disabled:r=false,icon:o,endIcon:n,className:a,activeClassName:i,inactiveClassName:c}){let{value:d,onValueChange:l,variant:p,size:u,color:m,fullWidth:g}=mo(),f=d===e,h=()=>{r||l(e);},b=R=>{(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),h());},x=s("inline-flex items-center justify-center font-medium transition-all duration-200","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-blue-500",Dm[u],g&&"flex-1"),v=f?s(xl[m][p].active,i):s(xl[m][p].inactive,c),k=r?"opacity-50 cursor-not-allowed":"cursor-pointer";return jsxs("button",{type:"button",role:"tab","aria-selected":f,"aria-disabled":r,tabIndex:f?0:-1,onClick:h,onKeyDown:b,disabled:r,className:s(x,Im[p],v,k,a),children:[o&&jsx("span",{className:s("shrink-0",yl[u]),children:o}),jsx("span",{children:t}),n&&jsx("span",{className:s("shrink-0",yl[u]),children:n})]})}vl.displayName="TabsTrigger";function wl({value:e,children:t,className:r,forceMount:o=false}){let{value:n}=mo(),a=n===e;return !a&&!o?null:jsx("div",{role:"tabpanel",hidden:!a,tabIndex:0,className:s("mt-4 focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-blue-500 rounded-md",!a&&"hidden",r),children:t})}wl.displayName="TabsContent";function Lm({className:e}){return jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsx("path",{d:"M9 12L11 14L15 10M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function zm({className:e}){return jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsx("path",{d:"M12 8V12M12 16H12.01M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Am({className:e}){return jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsx("path",{d:"M12 9V13M12 17H12.01M10.29 3.86L1.82 18C1.65 18.3 1.55 18.65 1.55 18.99C1.55 19.34 1.64 19.69 1.81 19.99C1.99 20.29 2.24 20.55 2.54 20.72C2.84 20.901 3.18 20.99 3.53 21H20.47C20.82 20.99 21.16 20.901 21.46 20.72C21.76 20.55 22.01 20.29 22.19 19.99C22.36 19.69 22.449 19.34 22.448 18.99C22.447 18.65 22.35 18.3 22.18 18L13.71 3.86C13.53 3.57 13.28 3.32 12.98 3.15C12.68 2.99 12.34 2.9 12 2.9C11.66 2.9 11.32 2.99 11.02 3.15C10.72 3.32 10.47 3.57 10.29 3.86Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function kl({className:e}){return jsx("svg",{className:e,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsx("path",{d:"M13 16H12V12H11M12 8H12.01M21 12C21 16.97 16.97 21 12 21C7.03 21 3 16.97 3 12C3 7.03 7.03 3 12 3C16.97 3 21 7.03 21 12Z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}function Wm({className:e}){return jsx("svg",{className:e,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:jsx("path",{d:"M4 4L12 12M12 4L4 12",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})}var Fm={success:Lm,error:zm,warning:Am,info:kl,default:kl},Hm={success:{solid:"bg-green-600 text-white border-green-600",outlined:"bg-white text-green-700 border-green-600 dark:bg-gray-900 dark:text-green-400",soft:"bg-green-50 text-green-700 border-green-200 dark:bg-green-900/20 dark:text-green-400 dark:border-green-800"},error:{solid:"bg-red-600 text-white border-red-600",outlined:"bg-white text-red-700 border-red-600 dark:bg-gray-900 dark:text-red-400",soft:"bg-red-50 text-red-700 border-red-200 dark:bg-red-900/20 dark:text-red-400 dark:border-red-800"},warning:{solid:"bg-yellow-500 text-white border-yellow-500",outlined:"bg-white text-yellow-700 border-yellow-500 dark:bg-gray-900 dark:text-yellow-400",soft:"bg-yellow-50 text-yellow-700 border-yellow-200 dark:bg-yellow-900/20 dark:text-yellow-400 dark:border-yellow-800"},info:{solid:"bg-blue-600 text-white border-blue-600",outlined:"bg-white text-blue-700 border-blue-600 dark:bg-gray-900 dark:text-blue-400",soft:"bg-blue-50 text-blue-700 border-blue-200 dark:bg-blue-900/20 dark:text-blue-400 dark:border-blue-800"},default:{solid:"bg-gray-700 text-white border-gray-700",outlined:"bg-white text-gray-700 border-gray-300 dark:bg-gray-900 dark:text-gray-300",soft:"bg-gray-50 text-gray-700 border-gray-200 dark:bg-gray-800 dark:text-gray-300 dark:border-gray-700"}},Bm={success:"text-green-600 dark:text-green-400",error:"text-red-600 dark:text-red-400",warning:"text-yellow-600 dark:text-yellow-400",info:"text-blue-600 dark:text-blue-400",default:"text-gray-600 dark:text-gray-400"};function Nl({children:e,title:t,description:r,type:o="default",variant:n="soft",icon:a,action:i,onClose:c,closable:d=true,className:l,...p}){let u=Fm[o],m=jsx(u,{className:"w-5 h-5"}),g=e??r;return jsxs("div",{role:"alert",className:s("flex items-start gap-3 p-4 rounded-lg border shadow-lg min-w-[320px] max-w-md","animate-in slide-in-from-top-2 fade-in duration-300",Hm[o][n],l),...p,children:[jsx("div",{className:s("flex-shrink-0 mt-0.5",n==="solid"?"text-white":Bm[o]),children:a??m}),jsxs("div",{className:"flex-1 min-w-0",children:[t&&jsx("div",{className:"font-semibold text-sm mb-1",children:t}),g&&jsx("div",{className:"text-sm opacity-90",children:g}),i&&jsx("div",{className:"mt-3",children:i})]}),d&&jsx("button",{type:"button",onClick:c,className:s("flex-shrink-0 rounded-md p-1 transition-colors hover:bg-black/10 dark:hover:bg-white/10","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-current",n==="solid"?"text-white":""),"aria-label":"Close notification",children:jsx(Wm,{className:"w-4 h-4"})})]})}Nl.displayName="Toast";var _m={default:"bg-gray-900 text-white dark:bg-gray-700",light:"bg-white text-gray-900 border border-gray-200 shadow-lg dark:bg-gray-800 dark:text-white dark:border-gray-600",error:"bg-red-600 text-white",success:"bg-green-600 text-white",warning:"bg-yellow-500 text-white",info:"bg-blue-600 text-white"},$m={default:{top:"border-t-gray-900 dark:border-t-gray-700",bottom:"border-b-gray-900 dark:border-b-gray-700",left:"border-l-gray-900 dark:border-l-gray-700",right:"border-r-gray-900 dark:border-r-gray-700"},light:{top:"border-t-white dark:border-t-gray-800",bottom:"border-b-white dark:border-b-gray-800",left:"border-l-white dark:border-l-gray-800",right:"border-r-white dark:border-r-gray-800"},error:{top:"border-t-red-600",bottom:"border-b-red-600",left:"border-l-red-600",right:"border-r-red-600"},success:{top:"border-t-green-600",bottom:"border-b-green-600",left:"border-l-green-600",right:"border-r-green-600"},warning:{top:"border-t-yellow-500",bottom:"border-b-yellow-500",left:"border-l-yellow-500",right:"border-r-yellow-500"},info:{top:"border-t-blue-600",bottom:"border-b-blue-600",left:"border-l-blue-600",right:"border-r-blue-600"}},Um={sm:"px-2 py-1 text-xs",md:"px-3 py-1.5 text-sm",lg:"px-4 py-2 text-base"},Gm={sm:"border-4",md:"border-[5px]",lg:"border-[6px]"},Km={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},Ym={top:"top-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-b-transparent",bottom:"bottom-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-t-transparent",left:"left-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-r-transparent",right:"right-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-l-transparent"};function dt({children:e,content:t,position:r="top",variant:o="default",size:n="md",trigger:a="hover",open:i,delay:c=0,showArrow:d=true,maxWidth:l="max-w-xs",className:p,contentClassName:u,disabled:m=false,...g}){let[f,h]=useState(false),b=useRef(null),x=useCallback(()=>{m||(c>0?b.current=setTimeout(()=>h(true),c):h(true));},[c,m]),v=useCallback(()=>{b.current&&(clearTimeout(b.current),b.current=null),h(false);},[]),k=useCallback(()=>{m||h(E=>!E);},[m]),R=a==="manual"?i:f,S={hover:{onMouseEnter:x,onMouseLeave:v,onFocus:x,onBlur:v},click:{onClick:k},manual:{}}[a];return jsxs("div",{className:s("relative inline-flex",p),...S,...g,children:[e,R&&!m&&jsxs("div",{role:"tooltip",className:s("absolute z-50 whitespace-normal wrap-break-word rounded-md","transition-opacity duration-150",Km[r],_m[o],Um[n],l,u),children:[t,d&&jsx("span",{className:s("absolute w-0 h-0 border-solid",Gm[n],Ym[r],$m[o][r]),"aria-hidden":"true"})]})]})}dt.displayName="Tooltip";function jm(e){switch(e){case "bordered":return "border-t border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-700 dark:text-gray-300";case "minimal":return "bg-transparent text-gray-600 dark:text-gray-400";case "dark":return "bg-gray-900 text-gray-300";default:return "bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-300"}}function qm(e){switch(e){case "sm":return "py-6";case "lg":return "py-16";default:return "py-10"}}function Tl({variant:e="default",size:t="md",sticky:r=false,className:o,children:n,...a}){return jsx("footer",{className:s(jm(e),qm(t),r&&"sticky bottom-0 z-40",o),...a,children:jsx("div",{className:"container mx-auto px-4",children:n})})}Tl.displayName="Footer";function Jm(e){switch(e){case 1:return "grid-cols-1";case 2:return "grid-cols-1 sm:grid-cols-2";case 3:return "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3";case 4:return "grid-cols-1 sm:grid-cols-2 lg:grid-cols-4";case 5:return "grid-cols-1 sm:grid-cols-2 lg:grid-cols-5";case 6:return "grid-cols-2 sm:grid-cols-3 lg:grid-cols-6";default:return ""}}function El({title:e,titleClassName:t,columns:r,className:o,children:n,...a}){return jsxs("div",{className:s(r&&"grid gap-8",Jm(r),o),...a,children:[e&&jsx("h3",{className:s("text-sm font-semibold uppercase tracking-wider text-gray-900 dark:text-white",r&&"col-span-full",t),children:e}),n]})}El.displayName="FooterSection";function Dl({title:e,titleClassName:t,className:r,children:o,...n}){return jsxs("div",{className:s("flex flex-col gap-3",r),...n,children:[e&&jsx("h4",{className:s("text-sm font-semibold uppercase tracking-wider text-gray-900 dark:text-white",t),children:e}),o]})}Dl.displayName="FooterColumn";function Il({external:e=false,className:t,children:r,...o}){return jsx("a",{className:s("text-sm text-gray-600 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",t),target:e?"_blank":void 0,rel:e?"noopener noreferrer":void 0,...o,children:r})}Il.displayName="FooterLink";function Ml({copyright:e,className:t,children:r,...o}){return jsxs("div",{className:s("mt-8 border-t border-gray-200 dark:border-gray-700 pt-6 flex flex-col sm:flex-row items-center justify-between gap-4",t),...o,children:[e&&jsx("p",{className:"text-sm text-gray-500 dark:text-gray-400",children:e}),r]})}Ml.displayName="FooterBottom";function Pl({className:e,children:t,...r}){return jsx("div",{className:s("flex items-center gap-4",e),...r,children:t})}Pl.displayName="FooterSocial";function Ll({icon:e,label:t,className:r,...o}){return jsx("a",{className:s("text-gray-500 dark:text-gray-400 hover:text-gray-900 dark:hover:text-white transition-colors",r),target:"_blank",rel:"noopener noreferrer","aria-label":t,...o,children:e})}Ll.displayName="FooterSocialLink";var Al="se-grid-pattern",Wl=memo(function({gridSize:t,zoom:r}){let o=t*r;return jsxs("svg",{className:"absolute inset-0 w-full h-full pointer-events-none","aria-hidden":"true",children:[jsx("defs",{children:jsx("pattern",{id:Al,width:o,height:o,patternUnits:"userSpaceOnUse",children:jsx("circle",{cx:1,cy:1,r:1,className:"fill-gray-300 dark:fill-gray-600"})})}),jsx("rect",{width:"100%",height:"100%",fill:`url(#${Al})`})]})});function Mr(e,t){return e.collapsed?40:e.height?e.height:40+(e.notes?24:0)+e.fields.length*32+(t?36:0)}function bo(e,t){return 40+(t?24:0)+e*32+32/2}function Fl(e,t,r){let o=e.fields.findIndex(d=>d.id===t);if(o===-1)return null;let n=e.width??260,a=!!e.notes,i=e.y+bo(o,a);return {x:r==="left"?e.x+0:e.x+n-0,y:i}}function Va(e,t){return Math.round(e/t)*t}function Yo(e,t,r){return Math.min(r,Math.max(t,e))}function Xo(e,t,r,o){return {x:(e-o.left-r.x)/r.zoom,y:(t-o.top-r.y)/r.zoom}}function Pn(e,t,r,o){let n=Math.abs(r-e),a=Math.max(50,n*.5),i=e+a,c=t,d=r-a;return `M ${e} ${t} C ${i} ${c}, ${d} ${o}, ${r} ${o}`}function Hl(e,t,r,o,n=40){if(e.length===0)return {x:0,y:0,zoom:1};let a=1/0,i=1/0,c=-1/0,d=-1/0;for(let f of e){let h=f.width??260,b=Mr(f,o);a=Math.min(a,f.x),i=Math.min(i,f.y),c=Math.max(c,f.x+h),d=Math.max(d,f.y+b);}let l=c-a+n*2,p=d-i+n*2,u=Math.min(t/l,r/p,1),m=(t-l*u)/2-(a-n)*u,g=(r-p*u)/2-(i-n)*u;return {x:m,y:g,zoom:u}}var qo=["text","varchar","char","int2","int4","int8","serial","bigserial","float4","float8","numeric","decimal","bool","date","time","timestamp","timestamptz","uuid","json","jsonb","bytea"];function Bl(){return `table-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function jo(){return `field-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function _a(){return `rel-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function $a(e="new_field"){return {id:jo(),name:e,type:"text",nullable:true}}function Ua(e,t,r="new_table"){return {id:Bl(),name:r,x:e,y:t,fields:[{id:jo(),name:"id",type:"serial",primaryKey:true},{id:jo(),name:"createdAt",type:"timestamp"},{id:jo(),name:"updatedAt",type:"timestamp"}]}}var Ln=()=>jsxs("svg",{className:"w-3.5 h-3.5 text-indigo-500 flex-shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("path",{d:"M10 1l2 2-5 5M8.5 4.5L11 7"}),jsx("circle",{cx:"4.5",cy:"11.5",r:"3"})]}),Vl=()=>jsxs("svg",{className:"w-3.5 h-3.5 flex-shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:[jsx("circle",{cx:"8",cy:"8",r:"6",className:"fill-blue-500"}),jsx("path",{d:"M5 8h6M8 5l3 3-3 3",stroke:"white",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]}),lb=({collapsed:e})=>jsx("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:e?jsx("path",{d:"M6 3l5 5-5 5V3z"}):jsx("path",{d:"M3 6l5 5 5-5H3z"})}),_l=()=>jsx("svg",{className:"w-3.5 h-3.5 text-amber-500 flex-shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M3 2v12M7 4h6M7 8h4M7 12h5"})}),$l=()=>jsx("svg",{className:"w-3.5 h-3.5 text-purple-500 flex-shrink-0",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M4 2v8a4 4 0 008 0V2"})}),db=()=>jsx("svg",{className:"w-3 h-3",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:jsx("path",{d:"M4 8h8"})}),cb=()=>jsxs("svg",{className:"w-3 h-3 text-gray-300",viewBox:"0 0 16 16",fill:"currentColor",children:[jsx("circle",{cx:"5",cy:"4",r:"1.5"}),jsx("circle",{cx:"11",cy:"4",r:"1.5"}),jsx("circle",{cx:"5",cy:"8",r:"1.5"}),jsx("circle",{cx:"11",cy:"8",r:"1.5"}),jsx("circle",{cx:"5",cy:"12",r:"1.5"}),jsx("circle",{cx:"11",cy:"12",r:"1.5"})]}),ub=memo(function({field:t,tableId:r,editable:o,readOnly:n,disabled:a,onFieldChange:i}){let[c,d]=useState(false),[l,p]=useState(t.defaultValue??""),u=o&&!n&&!a,m=()=>{d(false),i?.(r,t.id,{defaultValue:l||void 0});};return u?c?jsx("input",{className:"text-xs w-16 text-emerald-500 bg-transparent border-b border-emerald-300 outline-none focus:ring-0 p-0 flex-shrink-0","aria-label":`Default value for ${t.name}`,value:l,onChange:g=>p(g.target.value),onBlur:m,onKeyDown:g=>{g.key==="Enter"&&m(),g.key==="Escape"&&d(false);},onMouseDown:g=>g.stopPropagation(),autoFocus:true}):t.defaultValue?jsxs("button",{type:"button",className:"text-xs text-emerald-500 flex-shrink-0 truncate max-w-16 cursor-pointer",onClick:g=>{g.stopPropagation(),p(t.defaultValue??""),d(true);},onMouseDown:g=>g.stopPropagation(),title:`Default: ${t.defaultValue}`,children:["= ",t.defaultValue]}):jsx("button",{type:"button",className:"text-xs text-gray-300 flex-shrink-0 opacity-0 group-hover:opacity-30 hover:!opacity-100 cursor-pointer transition-opacity",onClick:g=>{g.stopPropagation(),p(""),d(true);},onMouseDown:g=>g.stopPropagation(),title:"Set default value",children:"= \u2205"}):t.defaultValue?jsxs("span",{className:"text-xs text-emerald-500 flex-shrink-0 truncate max-w-16",title:`Default: ${t.defaultValue}`,children:["= ",t.defaultValue]}):null}),Gl=memo(function({table:t,selected:r,disabled:o,readOnly:n,editable:a,dropTarget:i,fieldTypes:c,onTableNameChange:d,onTableNotesChange:l,onToggleCollapse:p,onFieldChange:u,onFieldAdd:m,onFieldRemove:g,onFieldReorder:f,onResizeStart:h}){let b=t.width??260,x=t.collapsed??false,v=c.length>0?c:qo,[k,R]=useState(null),[S,E]=useState(null),z=useRef(null),N=useCallback(y=>{d?.(t.id,y.target.value);},[t.id,d]),L=useCallback((y,T)=>{u?.(t.id,y,{name:T});},[t.id,u]),A=useCallback((y,T)=>{u?.(t.id,y,{type:T});},[t.id,u]),G=useCallback((y,T)=>{u?.(t.id,y,{primaryKey:!T});},[t.id,u]),q=useCallback((y,T)=>{u?.(t.id,y,{nullable:!T});},[t.id,u]),M=useCallback((y,T)=>{u?.(t.id,y,{indexed:!T});},[t.id,u]),O=useCallback((y,T)=>{u?.(t.id,y,{unique:!T});},[t.id,u]),P=useCallback(()=>{m?.(t.id);},[t.id,m]);return jsxs("div",{"data-table-id":t.id,className:s("absolute bg-white dark:bg-gray-800 border-2 border-dashed rounded-lg shadow-sm cursor-grab active:cursor-grabbing",t.height?"flex flex-col":void 0,i?"border-green-400 shadow-green-100 dark:shadow-green-900/30 shadow-md":r?"border-blue-500 shadow-blue-100 dark:shadow-blue-900/30":"border-gray-300 dark:border-gray-600",o&&"opacity-60",t.locked&&"!cursor-default"),style:{left:t.x,top:t.y,width:b,height:t.height,userSelect:"none",overflow:t.height?"hidden":void 0},children:[jsxs("div",{className:s("flex items-center justify-between px-3 gap-2","bg-gray-50 dark:bg-gray-700 border-b border-gray-200 dark:border-gray-600"),style:{height:40},children:[a&&!n&&!o?jsx("input",{className:"flex-1 min-w-0 text-sm font-semibold text-gray-800 dark:text-gray-100 bg-transparent border-none outline-none focus:ring-0 p-0 truncate cursor-text","aria-label":"Table name",value:t.name,onChange:N,onMouseDown:y=>y.stopPropagation()}):jsx("span",{className:"flex-1 min-w-0 text-sm font-semibold text-gray-800 dark:text-gray-100 truncate",children:t.name}),jsx("button",{type:"button",className:"flex-shrink-0 p-1 rounded hover:bg-gray-200 dark:hover:bg-gray-600 text-gray-500 dark:text-gray-400",onClick:y=>{y.stopPropagation(),p?.(t.id);},onMouseDown:y=>y.stopPropagation(),"aria-label":x?"Expand table":"Collapse table",children:jsx(lb,{collapsed:x})})]}),!x&&(a&&!n&&!o?jsx("div",{className:"px-3 border-b border-gray-100 dark:border-gray-700 flex items-center",style:{height:24},children:jsx("input",{className:"w-full text-xs italic text-gray-400 dark:text-gray-500 bg-transparent border-none outline-none focus:ring-0 p-0 placeholder-gray-400 dark:placeholder-gray-500","aria-label":"Table notes",placeholder:"Add notes...",value:t.notes??"",onChange:y=>l?.(t.id,y.target.value),onMouseDown:y=>y.stopPropagation()})}):t.notes?jsx("div",{className:"px-3 border-b border-gray-100 dark:border-gray-700 flex items-center",style:{height:24},children:jsx("span",{className:"text-xs italic text-gray-400 dark:text-gray-500 truncate",children:t.notes})}):null),!x&&jsxs("div",{className:t.height?"overflow-y-auto flex-1 min-h-0":void 0,children:[t.fields.map((y,T)=>jsxs("div",{"data-field-id":y.id,"data-table-id":t.id,className:s("flex items-center gap-1.5 pr-2 relative group",a&&!n&&!o?"pl-[18px]":"pl-2","border-b border-gray-100 dark:border-gray-700 last:border-b-0",i?"bg-blue-50/50 dark:bg-blue-900/10":"hover:bg-gray-50 dark:hover:bg-gray-750",k===T&&"opacity-40",S===T&&"!border-t-2 !border-t-blue-400"),style:{height:32},draggable:a&&!n&&!o,onDragStart:I=>{!a||n||o||(I.stopPropagation(),z.current=T,R(T),I.dataTransfer.effectAllowed="move",I.dataTransfer.setData("text/plain",String(T)));},onDragOver:I=>{z.current!==null&&(I.preventDefault(),I.stopPropagation(),E(T));},onDragLeave:()=>{S===T&&E(null);},onDrop:I=>{I.preventDefault(),I.stopPropagation(),z.current!==null&&z.current!==T&&f?.(t.id,z.current,T),z.current=null,R(null),E(null);},onDragEnd:()=>{z.current=null,R(null),E(null);},children:[jsx("div",{"data-connection-side":"left","data-field-id":y.id,"data-table-id":t.id,className:s("absolute -left-[5px] w-2.5 h-2.5 rounded-full border-2 border-white dark:border-gray-800 cursor-crosshair z-10 transition-all",i?"opacity-100 bg-green-400 scale-150 shadow-[0_0_6px_rgba(74,222,128,0.6)]":"opacity-0 group-hover:opacity-100 bg-blue-400"),style:{top:32/2-5}}),a&&!n&&!o&&jsx("span",{className:"absolute left-[3px] cursor-grab active:cursor-grabbing opacity-0 group-hover:opacity-100 transition-opacity z-10",style:{top:32/2-6},children:jsx(cb,{})}),a&&!n&&!o?jsx("button",{type:"button",className:s("w-4 text-xs font-bold flex-shrink-0 text-center cursor-pointer",y.nullable?"text-gray-400":"text-transparent"),onClick:I=>{I.stopPropagation(),q(y.id,y.nullable??false);},onMouseDown:I=>I.stopPropagation(),title:y.nullable?"Nullable":"Not nullable",children:"?"}):jsx("span",{className:s("w-4 text-xs font-bold flex-shrink-0 text-center",y.nullable?"text-gray-400":"text-transparent"),children:y.nullable?"?":""}),y.primaryKey&&y.foreignKey?jsxs("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:[a&&!n&&!o?jsx("button",{type:"button",className:"flex-shrink-0 cursor-pointer",onClick:I=>{I.stopPropagation(),G(y.id,true);},onMouseDown:I=>I.stopPropagation(),title:"Primary Key (click to remove)",children:jsx(Ln,{})}):jsx(Ln,{}),jsx(Vl,{})]}):y.primaryKey?a&&!n&&!o?jsx("button",{type:"button",className:"flex-shrink-0 cursor-pointer",onClick:I=>{I.stopPropagation(),G(y.id,true);},onMouseDown:I=>I.stopPropagation(),title:"Primary Key (click to remove)",children:jsx(Ln,{})}):jsx(Ln,{}):y.foreignKey?jsx(Vl,{}):a&&!n&&!o?jsx("button",{type:"button",className:"w-3.5 h-3.5 flex-shrink-0 rounded text-gray-300 hover:text-indigo-400 transition-colors cursor-pointer",onClick:I=>{I.stopPropagation(),G(y.id,false);},onMouseDown:I=>I.stopPropagation(),title:"Set as Primary Key","aria-label":"Set as primary key",children:jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",opacity:"0.3",children:[jsx("path",{d:"M10 1l2 2-5 5M8.5 4.5L11 7"}),jsx("circle",{cx:"4.5",cy:"11.5",r:"3"})]})}):jsx("span",{className:"w-3.5 flex-shrink-0"}),a&&!n&&!o?jsx("input",{className:s("flex-1 min-w-0 text-xs bg-transparent border-none outline-none focus:ring-0 p-0 truncate cursor-text",y.primaryKey?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-300"),"aria-label":"Field name",value:y.name,onChange:I=>L(y.id,I.target.value),onMouseDown:I=>I.stopPropagation()}):jsx("span",{className:s("flex-1 min-w-0 text-xs truncate",y.primaryKey?"text-blue-600 dark:text-blue-400 font-medium":"text-gray-700 dark:text-gray-300"),children:y.name}),a&&!n&&!o?jsxs("select",{className:"text-xs text-gray-400 dark:text-gray-500 bg-transparent border-none outline-none focus:ring-0 p-0 cursor-pointer text-right",value:y.type,onChange:I=>A(y.id,I.target.value),onMouseDown:I=>I.stopPropagation(),children:[v.map(I=>jsx("option",{value:I,children:I},I)),!v.includes(y.type)&&jsx("option",{value:y.type,children:y.type})]}):jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500 flex-shrink-0",children:y.type}),jsx(ub,{field:y,tableId:t.id,editable:a,readOnly:n,disabled:o,onFieldChange:u}),y.indexed&&jsx(_l,{}),y.unique&&jsx($l,{}),a&&!n&&!o&&jsxs("div",{className:"absolute right-1 top-0 bottom-0 flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity bg-gradient-to-l from-white via-white to-transparent dark:from-gray-800 dark:via-gray-800 pl-4 pr-1 z-10",children:[jsx("button",{type:"button",className:s("cursor-pointer transition-opacity",y.indexed?"opacity-100":"opacity-30 hover:opacity-100"),onClick:I=>{I.stopPropagation(),M(y.id,y.indexed??false);},onMouseDown:I=>I.stopPropagation(),title:y.indexed?"Indexed (click to remove)":"Add index",children:jsx(_l,{})}),jsx("button",{type:"button",className:s("cursor-pointer transition-opacity",y.unique?"opacity-100":"opacity-30 hover:opacity-100"),onClick:I=>{I.stopPropagation(),O(y.id,y.unique??false);},onMouseDown:I=>I.stopPropagation(),title:y.unique?"Unique (click to remove)":"Add unique constraint",children:jsx($l,{})}),jsx("button",{type:"button",className:"p-0.5 rounded text-gray-300 hover:text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 cursor-pointer",onClick:I=>{I.stopPropagation(),g?.(t.id,y.id);},onMouseDown:I=>I.stopPropagation(),title:"Remove field",children:jsx(db,{})})]}),jsx("div",{"data-connection-side":"right","data-field-id":y.id,"data-table-id":t.id,className:s("absolute -right-[5px] w-2.5 h-2.5 rounded-full border-2 border-white dark:border-gray-800 cursor-crosshair z-10 transition-all",i?"opacity-100 bg-green-400 scale-150 shadow-[0_0_6px_rgba(74,222,128,0.6)]":"opacity-0 group-hover:opacity-100 bg-green-400"),style:{top:32/2-5}})]},y.id)),a&&!n&&!o&&jsxs("button",{type:"button",className:"flex items-center justify-center w-full gap-1 text-xs text-gray-400 hover:text-blue-500 hover:bg-gray-50 dark:hover:bg-gray-750 transition-colors cursor-pointer",style:{height:36},onClick:y=>{y.stopPropagation(),P();},onMouseDown:y=>y.stopPropagation(),children:[jsx("svg",{className:"w-3 h-3",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:jsx("path",{d:"M8 4v8M4 8h8"})}),"Add field"]})]}),!o&&!n&&jsx("div",{"data-resize-handle":"corner",className:"absolute -bottom-[5px] -right-[5px] w-[14px] h-[14px] cursor-nwse-resize z-20 group/resize",onMouseDown:y=>{y.stopPropagation(),y.preventDefault();let T=t.height??Mr(t,a);h?.(t.id,y.clientX,y.clientY,b,T);},children:jsxs("svg",{className:"w-full h-full text-gray-300 group-hover/resize:text-blue-400 transition-colors",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",children:[jsx("path",{d:"M12 2v10H2",opacity:"0"}),jsx("path",{d:"M6 12L12 6"}),jsx("path",{d:"M10 12L12 10"})]})})]})});function gb(e,t){let r=t.find(f=>f.id===e.from.tableId),o=t.find(f=>f.id===e.to.tableId);if(!r||!o||r.collapsed||o.collapsed)return null;let n=r.fields.findIndex(f=>f.id===e.from.fieldId),a=o.fields.findIndex(f=>f.id===e.to.fieldId);if(n===-1||a===-1)return null;let i=r.width??260,c=o.width??260,d=r.x+i/2,l=o.x+c/2,p=r.y+bo(n,!!r.notes),u=o.y+bo(a,!!o.notes),m,g;return d<=l?(m=r.x+i,g=o.x):(m=r.x,g=o.x+c),{x1:m,y1:p,x2:g,y2:u,cardinality:e.cardinality??"1:n"}}var Ya=["1:1","1:n","n:1","n:n"];function fb(e){let t=Ya.indexOf(e);return Ya[(t+1)%Ya.length]}var Yl=memo(function({relations:t,tables:r,viewport:o,selectedRelationId:n,disabled:a,onRelationClick:i,onCardinalityChange:c}){return jsx("svg",{className:"absolute top-0 left-0 pointer-events-none",style:{width:"100%",height:"100%",overflow:"visible"},children:jsx("g",{transform:`translate(${o.x}, ${o.y}) scale(${o.zoom})`,children:t.map(d=>{let l=gb(d,r);if(!l)return null;let{x1:p,y1:u,x2:m,y2:g,cardinality:f}=l,h=Pn(p,u,m,g),b=n===d.id,x=(p+m)/2,v=(u+g)/2;return jsxs("g",{children:[jsx("path",{d:h,fill:"none",stroke:"transparent",strokeWidth:16,className:"pointer-events-auto cursor-pointer",onClick:k=>{a||i?.(d.id,k);}}),jsx("path",{d:h,fill:"none",stroke:b?"#3b82f6":"#9ca3af",strokeWidth:b?2.5:1.5,className:"transition-colors"}),jsx("circle",{cx:p,cy:u,r:3,fill:b?"#3b82f6":"#9ca3af"}),jsx("circle",{cx:m,cy:g,r:3,fill:b?"#3b82f6":"#9ca3af"}),f&&jsxs("g",{className:a?void 0:"pointer-events-auto cursor-pointer",onClick:a?void 0:k=>{k.stopPropagation(),c?.(d.id,fb(f));},children:[jsx("rect",{x:x-14,y:v-9,width:28,height:18,rx:4,fill:"white",stroke:b?"#3b82f6":"#d1d5db",strokeWidth:1}),jsx("text",{x,y:v+4,textAnchor:"middle",className:"text-[10px] font-mono",fill:b?"#3b82f6":"#6b7280",children:f})]})]},d.id)})})})});var bb=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z",clipRule:"evenodd"})}),hb=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M5 10a1 1 0 011-1h8a1 1 0 110 2H6a1 1 0 01-1-1z",clipRule:"evenodd"})}),yb=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M4 2a1 1 0 011 1v2.101a7.002 7.002 0 0111.601 2.566 1 1 0 11-1.885.666A5.002 5.002 0 005.999 7H9a1 1 0 010 2H4a1 1 0 01-1-1V3a1 1 0 011-1zm.008 9.057a1 1 0 011.276.61A5.002 5.002 0 0014.001 13H11a1 1 0 110-2h5a1 1 0 011 1v5a1 1 0 11-2 0v-2.101a7.002 7.002 0 01-11.601-2.566 1 1 0 01.61-1.276z",clipRule:"evenodd"})}),xb=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{d:"M3 4a1 1 0 011-1h4a1 1 0 010 2H6.414l2.293 2.293a1 1 0 01-1.414 1.414L5 6.414V8a1 1 0 01-2 0V4zm9 1a1 1 0 010-2h4a1 1 0 011 1v4a1 1 0 01-2 0V6.414l-2.293 2.293a1 1 0 11-1.414-1.414L13.586 5H12zm-9 7a1 1 0 012 0v1.586l2.293-2.293a1 1 0 011.414 1.414L6.414 15H8a1 1 0 010 2H4a1 1 0 01-1-1v-4zm13 0a1 1 0 01-2 0v-1.586l-2.293 2.293a1 1 0 01-1.414-1.414L13.586 9H12a1 1 0 010-2h4a1 1 0 011 1v4z"})}),vb=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M6 2a2 2 0 00-2 2v12a2 2 0 002 2h8a2 2 0 002-2V4a2 2 0 00-2-2H6zm4 5a1 1 0 011 1v1h1a1 1 0 110 2h-1v1a1 1 0 11-2 0v-1H8a1 1 0 110-2h1V8a1 1 0 011-1z",clipRule:"evenodd"})}),wb=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z",clipRule:"evenodd"})}),kb=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM6.293 6.707a1 1 0 010-1.414l3-3a1 1 0 011.414 0l3 3a1 1 0 01-1.414 1.414L11 5.414V13a1 1 0 11-2 0V5.414L7.707 6.707a1 1 0 01-1.414 0z",clipRule:"evenodd"})}),Cb=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M2 5a2 2 0 012-2h12a2 2 0 012 2v2a2 2 0 01-2 2H4a2 2 0 01-2-2V5zm14 1a1 1 0 11-2 0 1 1 0 012 0zM2 13a2 2 0 012-2h12a2 2 0 012 2v2a2 2 0 01-2 2H4a2 2 0 01-2-2v-2zm14 1a1 1 0 11-2 0 1 1 0 012 0z",clipRule:"evenodd"})}),Nb=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M7.707 3.293a1 1 0 010 1.414L5.414 7H11a7 7 0 017 7v2a1 1 0 11-2 0v-2a5 5 0 00-5-5H5.414l2.293 2.293a1 1 0 11-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})}),Sb=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M12.293 3.293a1 1 0 011.414 0l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414-1.414L14.586 9H9a5 5 0 00-5 5v2a1 1 0 11-2 0v-2a7 7 0 017-7h5.586l-2.293-2.293a1 1 0 010-1.414z",clipRule:"evenodd"})}),Rb=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{d:"M3 3h4v4H3V3zm0 10h4v4H3v-4zm10-10h4v4h-4V3zm0 10h4v4h-4v-4zM7 5h6v1H7V5zm0 8h6v1H7v-1zM5 7v6h1V7H5zm8 0v6h1V7h-1z"})}),Xl=memo(function({zoom:t,onZoomIn:r,onZoomOut:o,onResetView:n,onFitToContent:a,onAddTable:i,onExportJSON:c,onImportJSON:d,onExportSQL:l,onUndo:p,onRedo:u,canUndo:m=false,canRedo:g=false,onAutoLayout:f,disabled:h,className:b}){let[x,v]=useState(false),[k,R]=useState(false),[S,E]=useState(false),[z,N]=useState(""),[L,A]=useState(""),[G,q]=useState(""),M=useCallback(()=>{N(c()),v(true);},[c]),O=useCallback(()=>{L.trim()&&(d(L.trim()),A(""),R(false));},[L,d]),P=useCallback(()=>{A(""),R(false);},[]),y=useCallback(()=>{v(false);},[]),T=useCallback(()=>{l&&(q(l()),E(true));},[l]),I=useCallback(()=>{E(false);},[]),oe=Math.round(t*100);return jsxs(Fragment,{children:[jsxs("div",{className:s("absolute top-3 left-3 z-20 flex items-center gap-2 bg-white dark:bg-gray-800 rounded-lg shadow-md border border-gray-200 dark:border-gray-600 px-2 py-1.5",b),"data-testid":"schema-toolbar",onMouseDown:ie=>ie.stopPropagation(),children:[jsxs(ro,{size:"sm",children:[jsx(dt,{content:"Zoom in",size:"sm",position:"bottom",children:jsx(lt,{icon:jsx(bb,{}),size:"sm",bgColor:"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",textColor:"text-gray-700 dark:text-gray-200",onClick:r,disabled:h,"aria-label":"Zoom in"})}),jsx(dt,{content:"Zoom out",size:"sm",position:"bottom",children:jsx(lt,{icon:jsx(hb,{}),size:"sm",bgColor:"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",textColor:"text-gray-700 dark:text-gray-200",onClick:o,disabled:h,"aria-label":"Zoom out"})})]}),jsxs("span",{className:"text-xs font-mono text-gray-500 dark:text-gray-400 min-w-[3ch] text-center select-none",children:[oe,"%"]}),jsx("div",{className:"w-px h-5 bg-gray-200 dark:bg-gray-600"}),jsx(dt,{content:"Reset view",size:"sm",position:"bottom",children:jsx(lt,{icon:jsx(yb,{}),size:"sm",bgColor:"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",textColor:"text-gray-700 dark:text-gray-200",onClick:n,disabled:h,"aria-label":"Reset view"})}),jsx(dt,{content:"Fit to content",size:"sm",position:"bottom",children:jsx(lt,{icon:jsx(xb,{}),size:"sm",bgColor:"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",textColor:"text-gray-700 dark:text-gray-200",onClick:a,disabled:h,"aria-label":"Fit to content"})}),jsx("div",{className:"w-px h-5 bg-gray-200 dark:bg-gray-600"}),jsx(dt,{content:"Add table",size:"sm",position:"bottom",children:jsx(lt,{icon:jsx(vb,{}),size:"sm",bgColor:"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",textColor:"text-gray-700 dark:text-gray-200",onClick:i,disabled:h,"aria-label":"Add table"})}),jsx("div",{className:"w-px h-5 bg-gray-200 dark:bg-gray-600"}),jsx(dt,{content:"Export JSON",size:"sm",position:"bottom",children:jsx(lt,{icon:jsx(wb,{}),size:"sm",bgColor:"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",textColor:"text-gray-700 dark:text-gray-200",onClick:M,disabled:h,"aria-label":"Export JSON"})}),jsx(dt,{content:"Import JSON",size:"sm",position:"bottom",children:jsx(lt,{icon:jsx(kb,{}),size:"sm",bgColor:"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",textColor:"text-gray-700 dark:text-gray-200",onClick:()=>R(true),disabled:h,"aria-label":"Import JSON"})}),l&&jsx(dt,{content:"Export SQL",size:"sm",position:"bottom",children:jsx(lt,{icon:jsx(Cb,{}),size:"sm",bgColor:"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",textColor:"text-gray-700 dark:text-gray-200",onClick:T,disabled:h,"aria-label":"Export SQL"})}),(p||u)&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5 bg-gray-200 dark:bg-gray-600"}),jsxs(ro,{size:"sm",children:[jsx(dt,{content:"Undo (Ctrl+Z)",size:"sm",position:"bottom",children:jsx(lt,{icon:jsx(Nb,{}),size:"sm",bgColor:"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",textColor:"text-gray-700 dark:text-gray-200",onClick:p,disabled:h||!m,"aria-label":"Undo"})}),jsx(dt,{content:"Redo (Ctrl+Y)",size:"sm",position:"bottom",children:jsx(lt,{icon:jsx(Sb,{}),size:"sm",bgColor:"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",textColor:"text-gray-700 dark:text-gray-200",onClick:u,disabled:h||!g,"aria-label":"Redo"})})]})]}),f&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5 bg-gray-200 dark:bg-gray-600"}),jsx(dt,{content:"Auto layout",size:"sm",position:"bottom",children:jsx(lt,{icon:jsx(Rb,{}),size:"sm",bgColor:"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",textColor:"text-gray-700 dark:text-gray-200",onClick:f,disabled:h,"aria-label":"Auto layout"})})]})]}),jsx(wr,{isOpen:x,onClose:y,title:"Export Schema",description:"Copy the JSON below to save your schema.",size:"lg",showSubmit:false,showCancel:true,cancelLabel:"Close",children:jsx(sr,{label:"Schema JSON",multiline:true,rows:12,value:z,readOnly:true,size:"sm"})}),jsx(wr,{isOpen:k,onClose:P,title:"Import Schema",description:"Paste schema JSON to load it into the editor.",size:"lg",showSubmit:true,submitLabel:"Import",onSubmitClick:O,showCancel:true,cancelLabel:"Cancel",children:jsx(sr,{label:"Schema JSON",multiline:true,rows:12,value:L,onChange:ie=>A(ie.target.value),placeholder:'{"tables": [], "relations": []}',size:"sm"})}),jsx(wr,{isOpen:S,onClose:I,title:"Export SQL",description:"Generated PostgreSQL CREATE TABLE statements.",size:"lg",showSubmit:false,showCancel:true,cancelLabel:"Close",children:jsx(sr,{label:"SQL",multiline:true,rows:16,value:G,readOnly:true,size:"sm"})})]})});var Eb=()=>jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("path",{d:"M10 1l2 2-5 5M8.5 4.5L11 7"}),jsx("circle",{cx:"4.5",cy:"11.5",r:"3"})]}),Db=()=>jsx("span",{className:"text-xs font-bold text-gray-500 w-3.5 text-center",children:"?"}),Ib=()=>jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 16 16",fill:"currentColor",children:[jsx("circle",{cx:"8",cy:"8",r:"6",className:"fill-blue-500"}),jsx("path",{d:"M5 8h6M8 5l3 3-3 3",stroke:"white",strokeWidth:"1.5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round"})]}),Mb=()=>jsx("svg",{className:"w-3.5 h-3.5 text-amber-500",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M3 2v12M7 4h6M7 8h4M7 12h5"})}),Pb=()=>jsx("svg",{className:"w-3.5 h-3.5 text-purple-500",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:jsx("path",{d:"M4 2v8a4 4 0 008 0V2"})}),jl=memo(function({className:t}){return jsxs("div",{className:s("absolute top-3 right-3 z-20 flex items-center gap-4 bg-white dark:bg-gray-800 rounded-lg shadow-md border border-gray-200 dark:border-gray-600 px-3 py-2",t),"data-testid":"schema-legend",children:[jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Eb,{}),jsx("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Primary Key"})]}),jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Db,{}),jsx("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Nullable"})]}),jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Ib,{}),jsx("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Foreign Key"})]}),jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Mb,{}),jsx("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Index"})]}),jsxs("div",{className:"flex items-center gap-1.5",children:[jsx(Pb,{}),jsx("span",{className:"text-xs text-gray-600 dark:text-gray-300",children:"Unique"})]})]})});var An=180,Wn=120,vo=10,ql=memo(function({tables:t,viewport:r,containerWidth:o,containerHeight:n,editable:a,onViewportChange:i,className:c}){let d=useRef(null),l=useMemo(()=>{if(t.length===0)return null;let S=1/0,E=1/0,z=-1/0,N=-1/0;for(let I of t){let oe=I.width??260,ie=Mr(I,a);S=Math.min(S,I.x),E=Math.min(E,I.y),z=Math.max(z,I.x+oe),N=Math.max(N,I.y+ie);}let L=-r.x/r.zoom,A=-r.y/r.zoom,G=L+o/r.zoom,q=A+n/r.zoom;S=Math.min(S,L),E=Math.min(E,A),z=Math.max(z,G),N=Math.max(N,q);let M=z-S+vo*2,O=N-E+vo*2,P=Math.min((An-4)/M,(Wn-4)/O),y=(An-M*P)/2,T=(Wn-O*P)/2;return {minX:S,minY:E,scale:P,offsetX:y,offsetY:T,vpMinX:L,vpMinY:A}},[t,r,o,n,a]),p=useCallback(S=>{if(!l)return;let E=d.current?.getBoundingClientRect();if(!E)return;let z=S.clientX-E.left,N=S.clientY-E.top,L=(z-l.offsetX)/l.scale+l.minX-vo,A=(N-l.offsetY)/l.scale+l.minY-vo;i({...r,x:-(L-o/(2*r.zoom))*r.zoom,y:-(A-n/(2*r.zoom))*r.zoom});},[l,r,o,n,i]);if(!l)return null;let{minX:u,minY:m,scale:g,offsetX:f,offsetY:h,vpMinX:b,vpMinY:x}=l,v=(S,E)=>({x:(S-u+vo)*g+f,y:(E-m+vo)*g+h}),k=v(b,x),R={w:o/r.zoom*g,h:n/r.zoom*g};return jsx("div",{ref:d,className:s("absolute bottom-3 right-3 z-20 bg-white/90 dark:bg-gray-800/90 rounded-lg shadow-md border border-gray-200 dark:border-gray-600 cursor-pointer overflow-hidden",c),style:{width:An,height:Wn},onClick:p,onMouseDown:S=>S.stopPropagation(),"data-testid":"schema-minimap",children:jsxs("svg",{width:An,height:Wn,children:[t.map(S=>{let E=S.width??260,z=Mr(S,a),N=v(S.x,S.y);return jsx("rect",{x:N.x,y:N.y,width:E*g,height:z*g,fill:S.color??"#e5e7eb",stroke:"#9ca3af",strokeWidth:.5,rx:1},S.id)}),jsx("rect",{x:k.x,y:k.y,width:R.w,height:R.h,fill:"rgba(59, 130, 246, 0.1)",stroke:"#3b82f6",strokeWidth:1,rx:1})]})})});function Sr(e){return `"${e.replace(/"/g,'""')}"`}function Jl(e){return {text:"TEXT",varchar:"VARCHAR(255)",char:"CHAR(1)",int2:"SMALLINT",int4:"INTEGER",int8:"BIGINT",serial:"SERIAL",bigserial:"BIGSERIAL",float4:"REAL",float8:"DOUBLE PRECISION",numeric:"NUMERIC",decimal:"DECIMAL",bool:"BOOLEAN",date:"DATE",time:"TIME",timestamp:"TIMESTAMP",timestamptz:"TIMESTAMP WITH TIME ZONE",uuid:"UUID",json:"JSON",jsonb:"JSONB",bytea:"BYTEA"}[e]??e.toUpperCase()}function Hb(e){let t=[Sr(e.name)];return e.type==="serial"||e.type,t.push(Jl(e.type)),e.primaryKey&&t.push("PRIMARY KEY"),!e.nullable&&!e.primaryKey&&t.push("NOT NULL"),e.unique&&!e.primaryKey&&t.push("UNIQUE"),e.defaultValue&&t.push(`DEFAULT ${e.defaultValue}`)," "+t.join(" ")}function Bb(e,t,r){let o=[],n=[];for(let d of e.fields)o.push(Hb(d));for(let d of e.fields)if(d.foreignKey){let l=r.find(u=>u.id===d.foreignKey.tableId),p=l?.fields.find(u=>u.id===d.foreignKey.fieldId);l&&p&&n.push(` CONSTRAINT ${Sr(`fk_${e.name}_${d.name}`)} FOREIGN KEY (${Sr(d.name)}) REFERENCES ${Sr(l.name)} (${Sr(p.name)})`);}let a=[];for(let d of e.fields)d.indexed&&!d.primaryKey&&!d.unique&&a.push(`CREATE INDEX ${Sr(`idx_${e.name}_${d.name}`)} ON ${Sr(e.name)} (${Sr(d.name)});`);let i=[...o,...n],c=`CREATE TABLE ${Sr(e.name)} (
24
+ ${i.join(`,
25
+ `)}
26
+ );`;return a.length>0?c+`
27
+
28
+ `+a.join(`
29
+ `):c}function Fn(e){let{tables:t,relations:r}=e;return t.length===0?"-- No tables defined":[...t].sort((a,i)=>{let c=a.fields.some(l=>l.foreignKey),d=i.fields.some(l=>l.foreignKey);return c&&!d?1:!c&&d?-1:0}).map(a=>Bb(a,r,t)).join(`
30
+
31
+ `)}var Ob=60,Vb=40;function qa(e,t){if(e.length===0)return e;let r=new Map;for(let f of e){let h=new Set;for(let b of f.fields)b.foreignKey&&h.add(b.foreignKey.tableId);r.set(f.id,h);}let o=new Map;for(let f of e)o.set(f.id,0);for(let[,f]of r)for(let h of f)o.has(h);for(let[f,h]of r)o.set(f,h.size);let n=[],a=[];for(let[f,h]of o)h===0&&a.push(f);for(;a.length>0;){let f=a.shift();n.push(f);for(let[h,b]of r)if(b.has(f)){let x=(o.get(h)??0)-1;o.set(h,x),x===0&&a.push(h);}}let i=new Set(n);for(let f of e)i.has(f.id)||(n.push(f.id),i.add(f.id));let c=new Map(e.map(f=>[f.id,f])),d=Math.max(1,Math.ceil(Math.sqrt(n.length))),l=0,p=0,u=0,m=0,g=[];for(let f of n){let h=c.get(f);if(!h)continue;let b=h.width??260,x=Mr(h,t);g.push({...h,x:l,y:p}),m=Math.max(m,x),u++,u>=d?(u=0,l=0,p+=m+Vb,m=0):l+=b+Ob;}return g}var Za={x:0,y:0,zoom:1},Qa=.1,Gb=.1,Kb=3,Yb=20,Xb=50;function jb({value:e,defaultValue:t,onValueChange:r,fieldTypes:o=qo,onTableClick:n,onTableDoubleClick:a,onTableContextMenu:i,onFieldClick:c,onFieldDoubleClick:d,readOnly:l=false,disabled:p=false,draggableTables:u=true,panOnDrag:m=true,zoomOnWheel:g=true,editable:f=true,minZoom:h=Gb,maxZoom:b=Kb,snapToGrid:x=false,gridSize:v=Yb,showGrid:k=true,toolbar:R=true,legend:S=true,autoFit:E=false,className:z},N){let L=e!==void 0,[A,G]=useState(()=>t??{tables:[],relations:[],viewport:{...Za}}),q=L?e:A,M=q.tables,O=q.relations,P=q.viewport??Za,y=useRef(null),T=useRef(null),[I,oe]=useState(null),[ie,we]=useState(null),[he,F]=useState(null),[Q,ae]=useState(null),[ye,xe]=useState({width:0,height:0}),le=useRef([]),X=useRef(-1),C=useRef(false),$=useRef(P);$.current=P;let ge=useRef(M);ge.current=M;let te=useRef(O);te.current=O;let B=useRef(x);B.current=x;let ee=useRef(v);ee.current=v;let me=useRef(f);me.current=f;let Se=useCallback(D=>{if(C.current)return;let _=le.current,U=X.current;le.current=_.slice(0,U+1),le.current.push(D),le.current.length>Xb&&le.current.shift(),X.current=le.current.length-1;},[]),j=useCallback(D=>{if(L){let _=D(e);Se(_),r?.(_);}else G(_=>{let U=D(_);return Se(U),r?.(U),U});},[L,e,r,Se]),Te=useRef(j);Te.current=j;let Pe=useCallback(D=>{j(_=>({..._,viewport:D}));},[j]),et=useRef(Pe);et.current=Pe,useEffect(()=>{function D(K){let re=T.current;if(!re)return;let Fe=y.current?.getBoundingClientRect();if(!Fe)return;let Ge=$.current;if(re.type==="pan"){let Ve=K.clientX-re.startX,Ie=K.clientY-re.startY;et.current({...Ge,x:re.startVpX+Ve,y:re.startVpY+Ie});}if(re.type==="table"){let Ve=Xo(K.clientX,K.clientY,Ge,Fe),Ie=Ve.x-re.offsetX,wt=Ve.y-re.offsetY;B.current&&(Ie=Va(Ie,ee.current),wt=Va(wt,ee.current)),Te.current(_e=>({..._e,tables:_e.tables.map(st=>st.id===re.tableId?{...st,x:Ie,y:wt}:st)}));}if(re.type==="relation"){let Ve=Xo(K.clientX,K.clientY,Ge,Fe);T.current={...re,currentX:Ve.x,currentY:Ve.y},F({fromX:re.fromX,fromY:re.fromY,currentX:Ve.x,currentY:Ve.y});}if(re.type==="resize"){let Ve=(K.clientX-re.startX)/Ge.zoom,Ie=(K.clientY-re.startY)/Ge.zoom,wt=180,_e=80,st=Math.max(wt,re.startWidth+Ve),gt=Math.max(_e,re.startHeight+Ie);Te.current(rt=>({...rt,tables:rt.tables.map(Nt=>Nt.id===re.tableId?{...Nt,width:st,height:gt}:Nt)}));}}function _(K,re,Fe,Ge){let Ve=$.current,Ie=Xo(K,re,Ve,Fe),wt=1/0,_e=null,st=null;for(let gt of Ge){if(gt.collapsed)continue;let rt=gt.fields.length;if(rt===0)continue;let Nt=gt.width??260,Jt=40+rt*32+(me.current?36:0),Zt=40;if(!(Ie.x<gt.x-Zt||Ie.x>gt.x+Nt+Zt||Ie.y<gt.y-Zt||Ie.y>gt.y+Jt+Zt))for(let Pt=0;Pt<gt.fields.length;Pt++){let Un=gt.y+bo(Pt,!!gt.notes),en=Math.abs(Ie.y-Un);en<wt&&(wt=en,_e=gt.id,st=gt.fields[Pt].id);}}return _e&&st?{tableId:_e,fieldId:st}:null}function U(K){let re=T.current;if(re){if(re.type==="relation"){let Fe=y.current?.getBoundingClientRect();if(Fe){let Ge=te.current,Ve=ge.current,Ie=_(K.clientX,K.clientY,Fe,Ve);if(Ie&&Ie.tableId!==re.fromTableId&&!Ge.some(_e=>_e.from.tableId===re.fromTableId&&_e.from.fieldId===re.fromFieldId&&_e.to.tableId===Ie.tableId&&_e.to.fieldId===Ie.fieldId)){let _e=re.fromTableId,st=re.fromFieldId,gt=Ie.tableId,rt=Ie.fieldId;Te.current(Nt=>({...Nt,tables:Nt.tables.map(Jt=>Jt.id===gt?{...Jt,fields:Jt.fields.map(Zt=>Zt.id===rt?{...Zt,foreignKey:{tableId:_e,fieldId:st}}:Zt)}:Jt),relations:[...Nt.relations,{id:_a(),from:{tableId:_e,fieldId:st},to:{tableId:gt,fieldId:rt},cardinality:"1:n"}]}));}}F(null),ae(null);}T.current=null;}}return document.addEventListener("mousemove",D),document.addEventListener("mouseup",U),()=>{document.removeEventListener("mousemove",D),document.removeEventListener("mouseup",U);}},[]);let at=useCallback(D=>{if(!g||p)return;D.preventDefault();let _=y.current?.getBoundingClientRect();if(!_)return;let U=D.clientX-_.left,K=D.clientY-_.top,re=D.deltaY<0?1:-1,Fe=Yo(P.zoom+re*Qa,h,b),Ge=Fe/P.zoom;Pe({x:U-(U-P.x)*Ge,y:K-(K-P.y)*Ge,zoom:Fe});},[g,p,P,h,b,Pe]),pt=useCallback(D=>{if(p)return;let _=D.target,U=_.tagName,K=U==="INPUT"||U==="SELECT"||U==="TEXTAREA"||U==="BUTTON";if(_.closest("[data-resize-handle]"))return;let re=_.closest("[data-connection-side]");if(re&&!K){if(l)return;D.preventDefault();let Ge=re.getAttribute("data-table-id"),Ve=re.getAttribute("data-field-id");if(!Ge||!Ve)return;let Ie=M.find(st=>st.id===Ge);if(!Ie)return;let wt=re.getAttribute("data-connection-side"),_e=Fl(Ie,Ve,wt);if(!_e)return;T.current={type:"relation",fromTableId:Ge,fromFieldId:Ve,fromX:_e.x,fromY:_e.y,currentX:_e.x,currentY:_e.y},F({fromX:_e.x,fromY:_e.y,currentX:_e.x,currentY:_e.y}),ae(Ge);return}let Fe=_.closest("[data-table-id]");if(Fe){if(l)return;let Ge=Fe.getAttribute("data-table-id");if(we(null),oe(Ge),K)return;if(u){let Ve=y.current?.getBoundingClientRect();if(!Ve)return;let Ie=M.find(_e=>_e.id===Ge);if(!Ie||Ie.locked)return;let wt=Xo(D.clientX,D.clientY,P,Ve);T.current={type:"table",tableId:Ge,offsetX:wt.x-Ie.x,offsetY:wt.y-Ie.y};}return}oe(null),we(null),m&&D.button===0&&(T.current={type:"pan",startX:D.clientX,startY:D.clientY,startVpX:P.x,startVpY:P.y});},[p,l,u,m,P,M]),J=useCallback(D=>{let _=D.target;if(_.closest("[data-connection-side]"))return null;let U=_.closest("[data-table-id]");if(!U)return null;let K=U.getAttribute("data-table-id");return M.find(re=>re.id===K)??null},[M]),fe=useCallback(D=>{if(p)return;let _=J(D);_&&n&&n({table:_,nativeEvent:D.nativeEvent});},[n,p,J]),Ke=useCallback(D=>{if(p)return;let _=J(D);_&&a&&a({table:_,nativeEvent:D.nativeEvent});},[a,p,J]),xt=useCallback(D=>{if(p)return;let _=J(D);_&&i&&(D.preventDefault(),i({table:_,nativeEvent:D.nativeEvent}));},[i,p,J]),Ee=useCallback((D,_)=>{p||(_.stopPropagation(),oe(null),we(D));},[p]),We=useCallback((D,_)=>{j(U=>({...U,relations:U.relations.map(K=>K.id===D?{...K,cardinality:_}:K)}));},[j]),ht=X.current>0,ur=X.current<le.current.length-1,ct=useCallback(()=>{if(X.current<=0)return;C.current=true,X.current--;let D=le.current[X.current];L||G(D),r?.(D),C.current=false;},[L,r]),Bt=useCallback(()=>{if(X.current>=le.current.length-1)return;C.current=true,X.current++;let D=le.current[X.current];L||G(D),r?.(D),C.current=false;},[L,r]),Tt=useCallback(()=>Fn(q),[q]),Xt=useCallback(()=>{j(D=>({...D,tables:qa(D.tables,f)}));},[j,f]),Rr=useCallback((D,_,U)=>{_!==U&&j(K=>({...K,tables:K.tables.map(re=>{if(re.id!==D)return re;let Fe=[...re.fields],[Ge]=Fe.splice(_,1);return Fe.splice(U,0,Ge),{...re,fields:Fe}})}));},[j]);useEffect(()=>{let D=y.current;if(!D)return;let _=new ResizeObserver(U=>{for(let K of U)xe({width:K.contentRect.width,height:K.contentRect.height});});return _.observe(D),()=>_.disconnect()},[]);let Ot=useRef(false);Ot.current||(Ot.current=true,le.current=[q],X.current=0);let pr=useCallback(D=>{if(!(l||p)){if((D.ctrlKey||D.metaKey)&&D.key==="z"&&!D.shiftKey){D.preventDefault(),ct();return}if((D.ctrlKey||D.metaKey)&&(D.key==="y"||D.key==="z"&&D.shiftKey)){D.preventDefault(),Bt();return}if(D.key==="Delete"||D.key==="Backspace"){let _=D.target;if(_.tagName==="INPUT"||_.tagName==="TEXTAREA"||_.tagName==="SELECT")return;I&&(j(U=>({...U,tables:U.tables.filter(K=>K.id!==I),relations:U.relations.filter(K=>K.from.tableId!==I&&K.to.tableId!==I)})),oe(null)),ie&&(j(U=>{let K=U.relations.find(re=>re.id===ie);return {...U,tables:K?U.tables.map(re=>re.id===K.to.tableId?{...re,fields:re.fields.map(Fe=>Fe.id===K.to.fieldId?{...Fe,foreignKey:void 0}:Fe)}:re):U.tables,relations:U.relations.filter(re=>re.id!==ie)}}),we(null));}D.key==="Escape"&&(oe(null),we(null));}},[l,p,I,ie,j,ct,Bt]),jt=useCallback((D,_)=>{j(U=>({...U,tables:U.tables.map(K=>K.id===D?{...K,name:_}:K)}));},[j]),de=useCallback((D,_)=>{j(U=>({...U,tables:U.tables.map(K=>K.id===D?{...K,notes:_}:K)}));},[j]),ue=useCallback(D=>{j(_=>({..._,tables:_.tables.map(U=>U.id===D?{...U,collapsed:!U.collapsed}:U)}));},[j]),H=useCallback((D,_,U)=>{j(K=>({...K,tables:K.tables.map(re=>re.id===D?{...re,fields:re.fields.map(Fe=>Fe.id===_?{...Fe,...U}:Fe)}:re)}));},[j]),V=useCallback(D=>{j(_=>({..._,tables:_.tables.map(U=>U.id===D?{...U,fields:[...U.fields,$a()]}:U)}));},[j]),se=useCallback((D,_)=>{j(U=>({...U,tables:U.tables.map(K=>K.id===D?{...K,fields:K.fields.filter(re=>re.id!==_)}:K),relations:U.relations.filter(K=>!(K.from.tableId===D&&K.from.fieldId===_)&&!(K.to.tableId===D&&K.to.fieldId===_))}));},[j]),ne=useCallback((D,_,U,K,re)=>{T.current={type:"resize",tableId:D,startX:_,startY:U,startWidth:K,startHeight:re};},[]),Ne=useCallback(()=>{let D=Yo(P.zoom+Qa,h,b);Pe({...P,zoom:D});},[P,h,b,Pe]),be=useCallback(()=>{let D=Yo(P.zoom-Qa,h,b);Pe({...P,zoom:D});},[P,h,b,Pe]),ke=useCallback(()=>{Pe({...Za});},[Pe]),Ae=useCallback(()=>{let D=y.current?.getBoundingClientRect();if(!D)return;let _=Hl(M,D.width,D.height,f),U=Yo(_.zoom,h,b);Pe({..._,zoom:U});},[M,f,h,b,Pe]),Me=useCallback(D=>{j(_=>({..._,tables:[..._.tables,D]}));},[j]),Qe=useCallback(D=>{j(_=>({..._,tables:_.tables.filter(U=>U.id!==D),relations:_.relations.filter(U=>U.from.tableId!==D&&U.to.tableId!==D)}));},[j]),Ye=useCallback((D,_)=>{j(U=>({...U,tables:U.tables.map(K=>K.id===D?{...K,fields:[...K.fields,_]}:K)}));},[j]),Oe=useCallback((D,_)=>{se(D,_);},[se]),vt=useCallback(D=>{j(_=>({..._,tables:_.tables.map(U=>U.id===D.to.tableId?{...U,fields:U.fields.map(K=>K.id===D.to.fieldId?{...K,foreignKey:{tableId:D.from.tableId,fieldId:D.from.fieldId}}:K)}:U),relations:[..._.relations,D]}));},[j]),tt=useCallback(D=>{j(_=>{let U=_.relations.find(K=>K.id===D);return {..._,tables:U?_.tables.map(K=>K.id===U.to.tableId?{...K,fields:K.fields.map(re=>re.id===U.to.fieldId?{...re,foreignKey:void 0}:re)}:K):_.tables,relations:_.relations.filter(K=>K.id!==D)}});},[j]),Vt=useCallback(()=>JSON.stringify(q,null,2),[q]),gr=useCallback(D=>{try{let _=JSON.parse(D);_&&Array.isArray(_.tables)&&Array.isArray(_.relations)&&j(()=>_);}catch{}},[j]),Fr=useCallback(()=>{let D=y.current?.getBoundingClientRect(),_=$.current,U=100,K=100;D&&(U=(D.width/2-_.x)/_.zoom-260/2,K=(D.height/2-_.y)/_.zoom-60),Me(Ua(U,K));},[Me]),Zr=useCallback(()=>Fn(q),[q]);useImperativeHandle(N,()=>({zoomIn:Ne,zoomOut:be,resetView:ke,fitToContent:Ae,addTable:Me,removeTable:Qe,addField:Ye,removeField:Oe,addRelation:vt,removeRelation:tt,toJSON:Vt,loadJSON:gr,toSQL:Zr}),[Ne,be,ke,Ae,Me,Qe,Ye,Oe,vt,tt,Vt,gr,Zr]);let qt=useRef(false);useEffect(()=>{E&&!qt.current&&y.current&&(qt.current=true,Ae());},[E,Ae]);let _t=useMemo(()=>({transform:`translate(${P.x}px, ${P.y}px) scale(${P.zoom})`,transformOrigin:"0 0"}),[P.x,P.y,P.zoom]);return jsxs("div",{ref:y,"data-testid":"schema-editor",className:s("relative w-full overflow-hidden bg-gray-50 dark:bg-gray-900 select-none",p&&"opacity-60 pointer-events-none",z),tabIndex:0,onWheel:at,onMouseDown:pt,onClick:fe,onDoubleClick:Ke,onContextMenu:xt,onKeyDown:pr,children:[k&&jsx(Wl,{gridSize:v,zoom:P.zoom}),R&&!l&&jsx(Xl,{zoom:P.zoom,onZoomIn:Ne,onZoomOut:be,onResetView:ke,onFitToContent:Ae,onAddTable:Fr,onExportJSON:Vt,onImportJSON:gr,onExportSQL:Tt,onUndo:ct,onRedo:Bt,canUndo:ht,canRedo:ur,onAutoLayout:Xt,disabled:p}),S&&jsx(jl,{}),jsx(Yl,{relations:O,tables:M,viewport:P,selectedRelationId:ie,disabled:p||l,onRelationClick:Ee,onCardinalityChange:We}),jsx("div",{style:_t,children:M.map(D=>jsx(Gl,{table:D,selected:I===D.id,disabled:p||l,readOnly:l,editable:f,dropTarget:Q!==null&&Q!==D.id&&!D.collapsed,fieldTypes:o,onTableNameChange:jt,onTableNotesChange:de,onToggleCollapse:ue,onFieldChange:H,onFieldAdd:V,onFieldRemove:se,onFieldReorder:Rr,onResizeStart:ne},D.id))}),he&&jsxs("svg",{"data-testid":"drag-relation-overlay",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:1e3,overflow:"visible"},children:[jsx("path",{d:Pn(he.fromX*P.zoom+P.x,he.fromY*P.zoom+P.y,he.currentX*P.zoom+P.x,he.currentY*P.zoom+P.y),fill:"none",stroke:"#3b82f6",strokeWidth:2.5,strokeDasharray:"8 4"}),jsx("circle",{cx:he.fromX*P.zoom+P.x,cy:he.fromY*P.zoom+P.y,r:5,fill:"#3b82f6"}),jsx("circle",{cx:he.currentX*P.zoom+P.x,cy:he.currentY*P.zoom+P.y,r:4,fill:"#3b82f6",opacity:.6})]}),S&&ye.width>0&&jsx(ql,{tables:M,viewport:P,containerWidth:ye.width,containerHeight:ye.height,editable:f,onViewportChange:Pe})]})}var Ql=forwardRef(jb);Ql.displayName="SchemaEditor";var ed="wf-grid-pattern",td=memo(function({gridSize:t,zoom:r}){let o=t*r;return jsxs("svg",{className:"absolute inset-0 w-full h-full pointer-events-none","aria-hidden":"true",children:[jsx("defs",{children:jsx("pattern",{id:ed,width:o,height:o,patternUnits:"userSpaceOnUse",children:jsx("circle",{cx:1,cy:1,r:1,className:"fill-gray-300 dark:fill-gray-600"})})}),jsx("rect",{width:"100%",height:"100%",fill:`url(#${ed})`})]})});function es(e,t){return Math.round(e/t)*t}function Zo(e,t,r){return Math.min(r,Math.max(t,e))}function ko(e,t,r,o){return {x:(e-o.left-r.x)/r.zoom,y:(t-o.top-r.y)/r.zoom}}function Jo(e,t="horizontal"){return t==="vertical"?e==="in"?"top":"bottom":e==="in"?"left":"right"}function Co(e,t,r,o="horizontal"){let n=e.width??180,a=e.height??60,i=t.side??Jo(t.kind,o),c=r.filter(u=>(u.side??Jo(u.kind,o))===i),d=c.findIndex(u=>u.id===t.id),l=c.length,p=l===1?.5:(d+1)/(l+1);switch(i){case "left":return {x:e.x-8,y:e.y+a*p};case "right":return {x:e.x+n+8,y:e.y+a*p};case "top":return {x:e.x+n*p,y:e.y-8};case "bottom":return {x:e.x+n*p,y:e.y+a+8}}}function Bn(e,t,r,o,n="horizontal"){if(n==="vertical"){let u=Math.abs(o-t),m=Math.max(50,u*.5),g=e,f=t+m,h=r,b=o-m;return `M ${e} ${t} C ${g} ${f}, ${h} ${b}, ${r} ${o}`}let a=Math.abs(r-e),i=Math.max(50,a*.5),c=e+i,d=t,l=r-i;return `M ${e} ${t} C ${c} ${d}, ${l} ${o}, ${r} ${o}`}function rd(e,t,r,o=40){if(e.length===0)return {x:0,y:0,zoom:1};let n=1/0,a=1/0,i=-1/0,c=-1/0;for(let g of e){let f=g.width??180,h=g.height??60;n=Math.min(n,g.x),a=Math.min(a,g.y),i=Math.max(i,g.x+f),c=Math.max(c,g.y+h);}let d=i-n+o*2,l=c-a+o*2,p=Math.min(t/d,r/l,1),u=(t-d*p)/2-(n-o)*p,m=(r-l*p)/2-(a-o)*p;return {x:u,y:m,zoom:p}}var Qb=180,eh=60,On=12,No=28,rs=24,th=-8;function rh(e,t,r,o,n="horizontal"){let a=e.side??Jo(e.kind,n),i=t.filter(p=>(p.side??Jo(p.kind,n))===a),c=i.findIndex(p=>p.id===e.id),d=i.length,l=d===1?.5:(c+1)/(d+1);switch(a){case "left":return {left:0,top:o*l};case "right":return {left:r,top:o*l};case "top":return {left:r*l,top:0};case "bottom":return {left:r*l,top:o}}}function oh({port:e,allPorts:t,nodeId:r,nodeWidth:o,nodeHeight:n,disabled:a,direction:i,onMouseUp:c}){let d=rh(e,t,o,n,i),l=a||e.disabled,p=useCallback(u=>{l||(u.stopPropagation(),c(r,e.id));},[l,r,e.id,c]);return jsx("div",{"data-testid":`port-${r}-${e.id}`,"data-port-id":e.id,"data-port-kind":e.kind,"data-node-id":r,className:"absolute",style:{left:d.left-No/2,top:d.top-No/2,width:No,height:No,zIndex:20},onMouseUp:p,title:e.label??e.id,children:jsx("div",{className:s("absolute rounded-full border-2 transition-colors",l?"bg-gray-300 border-gray-400 cursor-not-allowed":e.kind==="in"?"bg-blue-400 border-blue-600 hover:bg-blue-300 cursor-crosshair":"bg-green-400 border-green-600 hover:bg-green-300 cursor-crosshair"),style:{width:On,height:On,left:(No-On)/2,top:(No-On)/2}})})}function nh(e,t,r){let o=e??"top-right",n=th,a=t*(rs+4);switch(o){case "top-right":return {top:n,right:n-a};case "top-left":return {top:n,left:n+a};case "bottom-right":return {bottom:n,right:n-a};case "bottom-left":return {bottom:n,left:n+a}}}function ah({action:e,nodeId:t,index:r,nodeWidth:o,disabled:n,onActionClick:a}){let i=useCallback(l=>{l.stopPropagation(),l.preventDefault(),!n&&a(t,e.id,l.nativeEvent);},[n,t,e.id,a]),c=useCallback(l=>{l.stopPropagation();},[]),d=nh(e.position,r);return jsx("button",{"data-testid":`action-${t}-${e.id}`,"data-action-id":e.id,"data-node-id":t,type:"button",className:s("absolute flex items-center justify-center rounded-full border shadow-sm transition-all","bg-white border-gray-300 text-gray-600","hover:bg-gray-50 hover:border-gray-400 hover:text-gray-800 hover:shadow-md","active:scale-95",n&&"opacity-50 cursor-not-allowed",!n&&"cursor-pointer",e.className),style:{...d,width:rs,height:rs,zIndex:30},onClick:i,onMouseDown:c,title:e.label,disabled:n,children:jsx("span",{className:"flex items-center justify-center w-3.5 h-3.5 [&>svg]:w-full [&>svg]:h-full",children:e.icon})})}var od=memo(function({node:t,registry:r,ports:o,selected:n,disabled:a,draggable:i,direction:c,onPortMouseUp:d,onActionClick:l}){let p=t.width??Qb,u=t.height??eh,m=r.render({node:t,selected:n,disabled:a}),f=(typeof r.actions=="function"?r.actions(t):r.actions)?.filter(b=>typeof b.hidden=="function"?!b.hidden(t):!b.hidden),h=new Map;if(f)for(let b of f){let x=b.position??"top-right",v=h.get(x)??[];v.push(b),h.set(x,v);}return jsxs("div",{"data-testid":`workflow-node-${t.id}`,"data-node-id":t.id,className:s("absolute select-none group/node",i&&!t.locked&&"cursor-grab active:cursor-grabbing",t.locked&&"cursor-not-allowed opacity-75",n&&"ring-2 ring-blue-500 ring-offset-1 rounded-lg"),style:{left:t.x,top:t.y,width:p,height:u,overflow:"visible"},children:[m,o.map(b=>jsx(oh,{port:b,allPorts:o,nodeId:t.id,nodeWidth:p,nodeHeight:u,disabled:a,direction:c,onMouseUp:d},b.id)),l&&h.size>0&&Array.from(h.entries()).map(([,b])=>b.map((x,v)=>jsx(ah,{action:x,nodeId:t.id,index:v,nodeWidth:p,disabled:a,onActionClick:l},x.id)))]})});function nd(e,t,r,o,n="horizontal"){let a=r.find(d=>d.id===e);if(!a)return null;let i=o(a),c=i.find(d=>d.id===t);return c?Co(a,c,i,n):null}var lh=memo(function({edge:t,fromPos:r,toPos:o,selected:n,disabled:a,direction:i,onClick:c}){let d=Bn(r.x,r.y,o.x,o.y,i),l=(r.x+o.x)/2,p=(r.y+o.y)/2,u=useCallback(m=>{m.stopPropagation(),c(t.id,m);},[t.id,c]);return jsxs("g",{"data-testid":`workflow-edge-${t.id}`,children:[jsx("path",{d,fill:"none",stroke:"transparent",strokeWidth:16,className:"cursor-pointer",onClick:u}),jsx("path",{d,fill:"none",className:s("transition-colors pointer-events-none",a||t.disabled?"stroke-gray-300":n?"stroke-blue-500":"stroke-gray-400"),strokeWidth:n?2.5:2,strokeDasharray:t.disabled?"6 3":void 0}),t.label&&jsx("text",{x:l,y:p-8,textAnchor:"middle",className:"fill-gray-600 dark:fill-gray-300 text-xs pointer-events-none select-none",fontSize:11,children:t.label})]})}),sd=memo(function({edges:t,nodes:r,selectedEdgeId:o,disabled:n,direction:a,onEdgeClick:i,getNodePorts:c}){return jsx("svg",{className:"absolute pointer-events-none",style:{top:0,left:0,width:1,height:1,overflow:"visible"},children:jsx("g",{className:"pointer-events-auto",children:t.map(d=>{let l=nd(d.from.nodeId,d.from.portId,r,c,a),p=nd(d.to.nodeId,d.to.portId,r,c,a);return !l||!p?null:jsx(lh,{edge:d,fromPos:l,toPos:p,selected:d.id===o,disabled:n,direction:a,onClick:i},d.id)})})})});var uh=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M10 5a1 1 0 011 1v3h3a1 1 0 110 2h-3v3a1 1 0 11-2 0v-3H6a1 1 0 110-2h3V6a1 1 0 011-1z",clipRule:"evenodd"})}),ph=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M5 10a1 1 0 011-1h8a1 1 0 110 2H6a1 1 0 01-1-1z",clipRule:"evenodd"})}),gh=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M4 2a1 1 0 011 1v2.101a7.002 7.002 0 0111.601 2.566 1 1 0 11-1.885.666A5.002 5.002 0 005.999 7H9a1 1 0 010 2H4a1 1 0 01-1-1V3a1 1 0 011-1zm.008 9.057a1 1 0 011.276.61A5.002 5.002 0 0014.001 13H11a1 1 0 110-2h5a1 1 0 011 1v5a1 1 0 11-2 0v-2.101a7.002 7.002 0 01-11.601-2.566 1 1 0 01.61-1.276z",clipRule:"evenodd"})}),fh=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{d:"M3 4a1 1 0 011-1h4a1 1 0 010 2H6.414l2.293 2.293a1 1 0 01-1.414 1.414L5 6.414V8a1 1 0 01-2 0V4zm9 1a1 1 0 010-2h4a1 1 0 011 1v4a1 1 0 01-2 0V6.414l-2.293 2.293a1 1 0 11-1.414-1.414L13.586 5H12zm-9 7a1 1 0 012 0v1.586l2.293-2.293a1 1 0 011.414 1.414L6.414 15H8a1 1 0 010 2H4a1 1 0 01-1-1v-4zm13 0a1 1 0 01-2 0v-1.586l-2.293 2.293a1 1 0 01-1.414-1.414L13.586 9H12a1 1 0 010-2h4a1 1 0 011 1v4z"})}),mh=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zm3.293-7.707a1 1 0 011.414 0L9 10.586V3a1 1 0 112 0v7.586l1.293-1.293a1 1 0 111.414 1.414l-3 3a1 1 0 01-1.414 0l-3-3a1 1 0 010-1.414z",clipRule:"evenodd"})}),bh=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M3 17a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM6.293 6.707a1 1 0 010-1.414l3-3a1 1 0 011.414 0l3 3a1 1 0 01-1.414 1.414L11 5.414V13a1 1 0 11-2 0V5.414L7.707 6.707a1 1 0 01-1.414 0z",clipRule:"evenodd"})}),hh=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M10.293 3.293a1 1 0 011.414 0l6 6a1 1 0 010 1.414l-6 6a1 1 0 01-1.414-1.414L14.586 11H3a1 1 0 110-2h11.586l-4.293-4.293a1 1 0 010-1.414z",clipRule:"evenodd"})}),yh=()=>jsx("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M16.707 10.293a1 1 0 010 1.414l-6 6a1 1 0 01-1.414 0l-6-6a1 1 0 111.414-1.414L9 14.586V3a1 1 0 012 0v11.586l4.293-4.293a1 1 0 011.414 0z",clipRule:"evenodd"})}),ld=memo(function({zoom:t,direction:r,onDirectionChange:o,onZoomIn:n,onZoomOut:a,onResetView:i,onFitToContent:c,onExportJSON:d,onImportJSON:l,disabled:p,className:u}){let[m,g]=useState(false),[f,h]=useState(false),[b,x]=useState(""),[v,k]=useState(""),R=useCallback(()=>{x(d()),g(true);},[d]),S=useCallback(()=>{v.trim()&&(l(v.trim()),k(""),h(false));},[v,l]),E=useCallback(()=>{k(""),h(false);},[]),z=useCallback(()=>{g(false);},[]),N=Math.round(t*100);return jsxs(Fragment,{children:[jsxs("div",{className:s("absolute top-3 left-3 z-20 flex items-center gap-2 bg-white dark:bg-gray-800 rounded-lg shadow-md border border-gray-200 dark:border-gray-600 px-2 py-1.5",u),"data-testid":"workflow-toolbar",children:[jsxs(ro,{size:"sm",children:[jsx(dt,{content:"Zoom in",size:"sm",position:"bottom",children:jsx(lt,{icon:jsx(uh,{}),size:"sm",bgColor:"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",textColor:"text-gray-700 dark:text-gray-200",onClick:n,disabled:p,"aria-label":"Zoom in"})}),jsx(dt,{content:"Zoom out",size:"sm",position:"bottom",children:jsx(lt,{icon:jsx(ph,{}),size:"sm",bgColor:"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",textColor:"text-gray-700 dark:text-gray-200",onClick:a,disabled:p,"aria-label":"Zoom out"})})]}),jsxs("span",{className:"text-xs font-mono text-gray-500 dark:text-gray-400 min-w-[3ch] text-center select-none",children:[N,"%"]}),jsx("div",{className:"w-px h-5 bg-gray-200 dark:bg-gray-600"}),jsx(dt,{content:"Reset view",size:"sm",position:"bottom",children:jsx(lt,{icon:jsx(gh,{}),size:"sm",bgColor:"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",textColor:"text-gray-700 dark:text-gray-200",onClick:i,disabled:p,"aria-label":"Reset view"})}),jsx(dt,{content:"Fit to content",size:"sm",position:"bottom",children:jsx(lt,{icon:jsx(fh,{}),size:"sm",bgColor:"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",textColor:"text-gray-700 dark:text-gray-200",onClick:c,disabled:p,"aria-label":"Fit to content"})}),o&&jsxs(Fragment,{children:[jsx("div",{className:"w-px h-5 bg-gray-200 dark:bg-gray-600"}),jsx(dt,{content:r==="horizontal"?"Switch to vertical":"Switch to horizontal",size:"sm",position:"bottom",children:jsx(lt,{icon:r==="horizontal"?jsx(hh,{}):jsx(yh,{}),size:"sm",bgColor:"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",textColor:"text-gray-700 dark:text-gray-200",onClick:()=>o(r==="horizontal"?"vertical":"horizontal"),disabled:p,"aria-label":r==="horizontal"?"Switch to vertical":"Switch to horizontal"})})]}),jsx("div",{className:"w-px h-5 bg-gray-200 dark:bg-gray-600"}),jsx(dt,{content:"Export JSON",size:"sm",position:"bottom",children:jsx(lt,{icon:jsx(mh,{}),size:"sm",bgColor:"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",textColor:"text-gray-700 dark:text-gray-200",onClick:R,disabled:p,"aria-label":"Export JSON"})}),jsx(dt,{content:"Import JSON",size:"sm",position:"bottom",children:jsx(lt,{icon:jsx(bh,{}),size:"sm",bgColor:"bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600",textColor:"text-gray-700 dark:text-gray-200",onClick:()=>h(true),disabled:p,"aria-label":"Import JSON"})})]}),jsx(wr,{isOpen:m,onClose:z,title:"Export Workflow",description:"Copy the JSON below to save your workflow.",size:"lg",showSubmit:false,showCancel:true,cancelLabel:"Close",children:jsx(sr,{label:"Workflow JSON",multiline:true,rows:12,value:b,readOnly:true,size:"sm"})}),jsx(wr,{isOpen:f,onClose:E,title:"Import Workflow",description:"Paste workflow JSON to load it into the editor.",size:"lg",showSubmit:true,submitLabel:"Import",onSubmitClick:S,showCancel:true,cancelLabel:"Cancel",children:jsx(sr,{label:"Workflow JSON",multiline:true,rows:12,value:v,onChange:L=>k(L.target.value),placeholder:'{"nodes": [], "edges": []}',size:"sm"})})]})});var os={x:0,y:0,zoom:1},ns=.1,wh=.1,kh=3,Ch=20;function ud(){return `edge-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function Nh({value:e,defaultValue:t,onValueChange:r,nodeRegistry:o,direction:n="horizontal",onDirectionChange:a,onNodeClick:i,onNodeDoubleClick:c,onNodeContextMenu:d,onNodeAction:l,readOnly:p=false,disabled:u=false,draggableNodes:m=true,connectable:g=true,selectable:f=true,multiSelect:h=false,panOnDrag:b=true,zoomOnWheel:x=true,minZoom:v=wh,maxZoom:k=kh,snapToGrid:R=false,gridSize:S=Ch,showGrid:E=true,toolbar:z=true,autoFit:N=false,className:L},A){let G=e!==void 0,[q,M]=useState(()=>t??{nodes:[],edges:[],viewport:{...os}}),O=G?e:q,P=O.nodes,y=O.edges,T=O.viewport??os,I=useRef(null),oe=useRef(null),[ie,we]=useState(new Set),[he,F]=useState(null),[Q,ae]=useState(null),ye=useRef(T);ye.current=T;let xe=useRef(P);xe.current=P;let le=useRef(y);le.current=y;let X=useRef(R);X.current=R;let C=useRef(S);C.current=S;let $=useRef(o);$.current=o;let ge=useRef(n);ge.current=n;let te=useCallback(H=>{G?r?.(H(e)):M(V=>{let se=H(V);return r?.(se),se});},[G,e,r]),B=useRef(te);B.current=te;let ee=useCallback(H=>{te(V=>({...V,viewport:H}));},[te]),me=useRef(ee);me.current=ee;let Se=useCallback(H=>{let V=o[H.type];return V?.getPorts?V.getPorts(H):H.ports??[]},[o]),j=useRef(Se);j.current=Se;let Te=useCallback((H,V,se)=>{let ne=xe.current,Ne=le.current,be=ne.find(tt=>tt.id===H.fromNodeId),ke=ne.find(tt=>tt.id===V);if(!be||!ke)return;let Ae=j.current(be),Me=j.current(ke),Qe=Ae.find(tt=>tt.id===H.fromPortId),Ye=Me.find(tt=>tt.id===se);if(!Qe||!Ye||Ye.kind!=="in"||H.fromNodeId===V)return;let Oe=$.current[be.type];if(Oe?.canConnect&&!Oe.canConnect({fromNode:be,toNode:ke,fromPort:Qe,toPort:Ye}))return;Ne.some(tt=>tt.from.nodeId===H.fromNodeId&&tt.from.portId===H.fromPortId&&tt.to.nodeId===V&&tt.to.portId===se)||B.current(tt=>({...tt,edges:[...tt.edges,{id:ud(),from:{nodeId:H.fromNodeId,portId:H.fromPortId},to:{nodeId:V,portId:se}}]}));},[]);useEffect(()=>{function H(se){let ne=oe.current;if(!ne)return;let Ne=I.current?.getBoundingClientRect();if(!Ne)return;let be=ye.current;if(ne.type==="pan"){let ke=se.clientX-ne.startX,Ae=se.clientY-ne.startY;me.current({...be,x:ne.startViewportX+ke,y:ne.startViewportY+Ae});}if(ne.type==="node"){let ke=ko(se.clientX,se.clientY,be,Ne),Ae=ke.x-ne.offsetX,Me=ke.y-ne.offsetY;X.current&&(Ae=es(Ae,C.current),Me=es(Me,C.current)),B.current(Qe=>({...Qe,nodes:Qe.nodes.map(Ye=>Ye.id===ne.nodeId?{...Ye,x:Ae,y:Me}:Ye)}));}if(ne.type==="edge"){let ke=ko(se.clientX,se.clientY,be,Ne);oe.current={...ne,currentX:ke.x,currentY:ke.y},ae({fromX:ne.fromX,fromY:ne.fromY,currentX:ke.x,currentY:ke.y});}}function V(se){let ne=oe.current;if(ne){if(ne.type==="edge"){let Ne=I.current?.getBoundingClientRect();if(Ne){let be=ye.current,ke=ko(se.clientX,se.clientY,be,Ne),Ae=25,Me=xe.current,Qe=1/0,Ye=null,Oe=null;for(let vt of Me){let tt=j.current(vt);for(let Vt of tt){if(Vt.kind!=="in")continue;let gr=Co(vt,Vt,tt,ge.current),Fr=Math.sqrt((ke.x-gr.x)**2+(ke.y-gr.y)**2);Fr<Ae&&Fr<Qe&&(Qe=Fr,Ye=vt.id,Oe=Vt.id);}}Ye&&Oe&&Te(ne,Ye,Oe);}ae(null);}oe.current=null;}}return document.addEventListener("mousemove",H),document.addEventListener("mouseup",V),()=>{document.removeEventListener("mousemove",H),document.removeEventListener("mouseup",V);}},[Te]);let Pe=useCallback(H=>{if(!x||u)return;H.preventDefault();let V=I.current?.getBoundingClientRect();if(!V)return;let se=H.clientX-V.left,ne=H.clientY-V.top,Ne=H.deltaY<0?1:-1,be=Zo(T.zoom+Ne*ns,v,k),ke=be/T.zoom;ee({x:se-(se-T.x)*ke,y:ne-(ne-T.y)*ke,zoom:be});},[x,u,T,v,k,ee]),et=useCallback(H=>{if(u)return;let V=H.target;if(V.closest("[data-action-id]"))return;let ne=V.closest("[data-port-id]");if(ne){if(!g||p)return;H.preventDefault();let be=ne.getAttribute("data-node-id"),ke=ne.getAttribute("data-port-id"),Ae=ne.getAttribute("data-port-kind");if(!be||!ke||Ae!=="out")return;let Me=P.find(vt=>vt.id===be);if(!Me)return;let Qe=Se(Me),Ye=Qe.find(vt=>vt.id===ke);if(!Ye)return;let Oe=Co(Me,Ye,Qe,ge.current);oe.current={type:"edge",fromNodeId:be,fromPortId:ke,fromX:Oe.x,fromY:Oe.y,currentX:Oe.x,currentY:Oe.y},ae({fromX:Oe.x,fromY:Oe.y,currentX:Oe.x,currentY:Oe.y});return}let Ne=V.closest("[data-node-id]");if(Ne){if(p)return;let be=Ne.getAttribute("data-node-id");if(f&&(F(null),h&&H.shiftKey?we(ke=>{let Ae=new Set(ke);return Ae.has(be)?Ae.delete(be):Ae.add(be),Ae}):we(new Set([be]))),m){let ke=I.current?.getBoundingClientRect();if(!ke)return;let Ae=P.find(Qe=>Qe.id===be);if(!Ae||Ae.locked)return;let Me=ko(H.clientX,H.clientY,T,ke);oe.current={type:"node",nodeId:be,startX:Me.x,startY:Me.y,offsetX:Me.x-Ae.x,offsetY:Me.y-Ae.y};}return}f&&(we(new Set),F(null)),b&&H.button===0&&(oe.current={type:"pan",startX:H.clientX,startY:H.clientY,startViewportX:T.x,startViewportY:T.y});},[u,g,p,f,h,m,b,T,P,Se]),at=useCallback(H=>{let V=oe.current;if(!V||V.type!=="edge")return;let se=I.current?.getBoundingClientRect();if(se){let ne=ko(H.clientX,H.clientY,T,se),Ne=30,be=1/0,ke=null,Ae=null;for(let Me of P){let Qe=Se(Me);for(let Ye of Qe){if(Ye.kind!=="in")continue;let Oe=Co(Me,Ye,Qe,ge.current),vt=Math.sqrt((ne.x-Oe.x)**2+(ne.y-Oe.y)**2);vt<Ne&&vt<be&&(be=vt,ke=Me.id,Ae=Ye.id);}}if(ke&&Ae){let Me=V.fromNodeId,Qe=V.fromPortId;Me!==ke&&(y.some(Oe=>Oe.from.nodeId===Me&&Oe.from.portId===Qe&&Oe.to.nodeId===ke&&Oe.to.portId===Ae)||te(Oe=>({...Oe,edges:[...Oe.edges,{id:ud(),from:{nodeId:Me,portId:Qe},to:{nodeId:ke,portId:Ae}}]})));}}oe.current=null,ae(null);},[T,P,y,Se,te]),pt=useCallback((H,V)=>{let se=oe.current;!se||se.type!=="edge"||(Te(se,H,V),oe.current=null,ae(null));},[Te]),J=useCallback(H=>{let V=H.target;if(V.closest("[data-port-id]")||V.closest("[data-action-id]"))return null;let Ne=V.closest("[data-node-id]");if(!Ne)return null;let be=Ne.getAttribute("data-node-id");return P.find(ke=>ke.id===be)??null},[P]),fe=useCallback(H=>{if(!i||u)return;let V=J(H);V&&i({node:V,nativeEvent:H.nativeEvent});},[i,u,J]),Ke=useCallback(H=>{if(!c||u)return;let V=J(H);V&&c({node:V,nativeEvent:H.nativeEvent});},[c,u,J]),xt=useCallback(H=>{if(!d||u)return;let V=J(H);V&&(H.preventDefault(),d({node:V,nativeEvent:H.nativeEvent}));},[d,u,J]),Ee=useCallback((H,V,se)=>{if(!l||u)return;let ne=P.find(Ne=>Ne.id===H);ne&&l({node:ne,actionId:V,nativeEvent:se});},[l,u,P]),We=useCallback((H,V)=>{!f||u||(V.stopPropagation(),we(new Set),F(H));},[f,u]),ht=useCallback(H=>{p||u||((H.key==="Delete"||H.key==="Backspace")&&(ie.size>0&&(te(V=>({...V,nodes:V.nodes.filter(se=>!ie.has(se.id)),edges:V.edges.filter(se=>!ie.has(se.from.nodeId)&&!ie.has(se.to.nodeId))})),we(new Set)),he&&(te(V=>({...V,edges:V.edges.filter(se=>se.id!==he)})),F(null))),H.key==="Escape"&&(we(new Set),F(null)));},[p,u,ie,he,te]),ur=useCallback(()=>{let H=Zo(T.zoom+ns,v,k);ee({...T,zoom:H});},[T,v,k,ee]),ct=useCallback(()=>{let H=Zo(T.zoom-ns,v,k);ee({...T,zoom:H});},[T,v,k,ee]),Bt=useCallback(()=>{ee({...os});},[ee]),Tt=useCallback(()=>{let H=I.current?.getBoundingClientRect();if(!H)return;let V=rd(P,H.width,H.height),se=Zo(V.zoom,v,k);ee({...V,zoom:se});},[P,v,k,ee]),Xt=useCallback(H=>{te(V=>({...V,nodes:[...V.nodes,H]}));},[te]),Rr=useCallback(H=>{te(V=>({...V,nodes:V.nodes.filter(se=>se.id!==H),edges:V.edges.filter(se=>se.from.nodeId!==H&&se.to.nodeId!==H)}));},[te]),Ot=useCallback(()=>JSON.stringify(O,null,2),[O]),pr=useCallback(H=>{try{let V=JSON.parse(H);V&&Array.isArray(V.nodes)&&Array.isArray(V.edges)&&te(()=>V);}catch{}},[te]);useImperativeHandle(A,()=>({zoomIn:ur,zoomOut:ct,resetView:Bt,fitToContent:Tt,addNode:Xt,removeNode:Rr,toJSON:Ot,loadJSON:pr}),[ur,ct,Bt,Tt,Xt,Rr,Ot,pr]);let jt=useRef(false);useEffect(()=>{N&&!jt.current&&I.current&&(jt.current=true,Tt());},[N,Tt]);let de=useMemo(()=>{let H=new Map;for(let V of P)H.set(V.id,Se(V));return H},[P,Se]),ue=useMemo(()=>({transform:`translate(${T.x}px, ${T.y}px) scale(${T.zoom})`,transformOrigin:"0 0"}),[T.x,T.y,T.zoom]);return jsxs("div",{ref:I,"data-testid":"workflow-editor",className:s("relative w-full overflow-hidden bg-gray-50 dark:bg-gray-900 select-none",u&&"opacity-60 pointer-events-none",L),tabIndex:0,onWheel:Pe,onMouseDown:et,onMouseUp:at,onClick:fe,onDoubleClick:Ke,onContextMenu:xt,onKeyDown:ht,children:[E&&jsx(td,{gridSize:S,zoom:T.zoom}),z&&!p&&jsx(ld,{zoom:T.zoom,direction:n,onDirectionChange:a,onZoomIn:ur,onZoomOut:ct,onResetView:Bt,onFitToContent:Tt,onExportJSON:Ot,onImportJSON:pr,disabled:u}),jsxs("div",{style:ue,children:[jsx(sd,{edges:y,nodes:P,selectedEdgeId:he,disabled:u||p,direction:n,onEdgeClick:We,getNodePorts:H=>de.get(H.id)??[]}),P.map(H=>{let V=o[H.type];if(!V)return null;let se=de.get(H.id)??[];return jsx(od,{node:H,registry:V,ports:se,selected:ie.has(H.id),disabled:u||p,draggable:m&&!p,direction:n,onPortMouseUp:pt,onActionClick:l?Ee:void 0},H.id)})]}),Q&&jsxs("svg",{"data-testid":"drag-edge-overlay",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",pointerEvents:"none",zIndex:1e3,overflow:"visible"},children:[jsx("path",{d:Bn(Q.fromX*T.zoom+T.x,Q.fromY*T.zoom+T.y,Q.currentX*T.zoom+T.x,Q.currentY*T.zoom+T.y,n),fill:"none",stroke:"#3b82f6",strokeWidth:2.5,strokeDasharray:"8 4"}),jsx("circle",{cx:Q.fromX*T.zoom+T.x,cy:Q.fromY*T.zoom+T.y,r:5,fill:"#3b82f6"}),jsx("circle",{cx:Q.currentX*T.zoom+T.x,cy:Q.currentY*T.zoom+T.y,r:4,fill:"#3b82f6",opacity:.6})]})]})}var pd=forwardRef(Nh);pd.displayName="WorkflowEditor";var bd=createContext(null);function Wr(){let e=useContext(bd);if(!e)throw new Error("useWizard and Wizard sub-components must be used within <Wizard>");return e}var ss=(e,t,r)=>Math.max(t,Math.min(e,r)),is={sm:{circle:"h-7 w-7 text-xs",dot:"h-2.5 w-2.5",icon:"h-3.5 w-3.5",title:"text-xs",desc:"text-[11px]",connector:"h-0.5"},md:{circle:"h-9 w-9 text-sm",dot:"h-3 w-3",icon:"h-4 w-4",title:"text-sm",desc:"text-xs",connector:"h-0.5"},lg:{circle:"h-11 w-11 text-base",dot:"h-3.5 w-3.5",icon:"h-5 w-5",title:"text-base",desc:"text-sm",connector:"h-1"}},cr={primary:{solid:"bg-blue-600 text-white",bg:"bg-blue-600",text:"text-blue-600 dark:text-blue-400",ring:"focus-visible:ring-blue-500",ringSoft:"ring-blue-500/20"},secondary:{solid:"bg-gray-700 text-white",bg:"bg-gray-700",text:"text-gray-700 dark:text-gray-300",ring:"focus-visible:ring-gray-500",ringSoft:"ring-gray-500/20"},success:{solid:"bg-green-600 text-white",bg:"bg-green-600",text:"text-green-600 dark:text-green-400",ring:"focus-visible:ring-green-500",ringSoft:"ring-green-500/20"},warning:{solid:"bg-amber-500 text-white",bg:"bg-amber-500",text:"text-amber-600 dark:text-amber-400",ring:"focus-visible:ring-amber-500",ringSoft:"ring-amber-500/20"},error:{solid:"bg-red-600 text-white",bg:"bg-red-600",text:"text-red-600 dark:text-red-400",ring:"focus-visible:ring-red-500",ringSoft:"ring-red-500/20"}};function Th({className:e}){return jsx("svg",{className:e,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})}function hd({steps:e,step:t,defaultStep:r=0,onStepChange:o,onComplete:n,orientation:a="horizontal",variant:i="default",size:c="md",color:d="primary",linear:l=true,className:p,children:u}){let m=e.length,g=Math.max(0,m-1),f=t!==void 0,[h,b]=useState(()=>ss(r,0,g)),x=ss(f?t:h,0,g),[v,k]=useState(x);v<x&&k(x);let R=x<=0,S=x>=g,E=useCallback((M,O)=>{let P=ss(M,0,g);P!==x&&(f||b(P),k(y=>Math.max(y,P)),o?.(P,{previous:x,direction:O}));},[x,f,g,o]),z=useCallback(M=>{let O=e[M];return !O||O.disabled?false:l?M<=v:true},[e,l,v]),N=useCallback(M=>{z(M)&&E(M,M>x?"jump":"backward");},[z,E,x]),L=useCallback(()=>{if(S){n?.();return}E(x+1,"forward");},[S,n,E,x]),A=useCallback(()=>{R||E(x-1,"backward");},[R,E,x]),G=useCallback(M=>e[M]?.error?"error":M===x?"active":M<x?"completed":"upcoming",[e,x]),q={steps:e,activeStep:x,totalSteps:m,isFirstStep:R,isLastStep:S,orientation:a,variant:i,size:c,color:d,linear:l,goToStep:N,goNext:L,goBack:A,getStepStatus:G,isStepAccessible:z};return jsx(bd.Provider,{value:q,children:jsx("div",{className:s("flex w-full flex-col gap-6",p),"data-testid":"wizard","data-orientation":a,children:u})})}function fd({index:e,status:t}){let{variant:r,size:o,color:n,steps:a}=Wr(),i=is[o],c=a[e];if(r==="dots"){let p=t==="upcoming"?"bg-gray-300 dark:bg-gray-600":t==="error"?"bg-red-600":cr[n].bg;return jsx("span",{className:s("shrink-0 rounded-full transition-colors",i.dot,p),"aria-hidden":"true"})}let d=t==="completed"?s(cr[n].solid,"border-transparent"):t==="active"?s(cr[n].solid,"border-transparent ring-4",cr[n].ringSoft):t==="error"?"border-transparent bg-red-600 text-white":"border-2 border-gray-300 bg-white text-gray-500 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-400",l=t==="completed"?jsx(Th,{className:i.icon}):t==="error"?jsx("span",{className:"font-semibold leading-none",children:"!"}):c.icon??jsx("span",{className:"font-medium leading-none",children:e+1});return jsx("span",{className:s("flex shrink-0 items-center justify-center rounded-full transition-all",i.circle,d),"aria-hidden":"true",children:l})}function md({index:e,status:t}){let{steps:r,size:o,color:n,variant:a}=Wr(),i=is[o],c=r[e],l=t==="active"?cr[n].text:t==="completed"?"text-gray-900 dark:text-gray-100":t==="error"?"text-red-600 dark:text-red-400":"text-gray-500 dark:text-gray-400";return jsxs("span",{className:"flex min-w-0 flex-col",children:[jsxs("span",{className:s("font-medium leading-tight",i.title,l),children:[a==="simple"&&jsxs("span",{className:"mr-1 tabular-nums",children:[e+1,"."]}),c.title,c.optional&&jsx("span",{className:"ml-1 text-xs font-normal text-gray-400 dark:text-gray-500",children:"(optional)"})]}),c.description&&jsx("span",{className:s("mt-0.5 text-gray-400 dark:text-gray-500",i.desc),children:c.description})]})}function yd({className:e,hideConnector:t=false,hideLabels:r=false}){let o=Wr(),{steps:n,orientation:a,size:i,variant:c,color:d,activeStep:l}=o,p=is[i],u=a==="vertical",m=c!=="simple";return jsx("ol",{className:s("flex w-full",u?"flex-col":"items-start",e),"data-testid":"wizard-steps","data-orientation":a,children:n.map((g,f)=>{let h=o.getStepStatus(f),b=f===l,x=o.isStepAccessible(f)&&!b,v=f===n.length-1,R=f<l?cr[d].bg:"bg-gray-200 dark:bg-gray-700";return u?jsx("li",{className:"flex","aria-current":b?"step":void 0,"data-status":h,"data-testid":"wizard-step",children:jsxs("button",{type:"button",disabled:!x,onClick:()=>o.goToStep(f),className:s("flex items-stretch gap-3 rounded-md text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",cr[d].ring,x?"cursor-pointer":"cursor-default"),children:[jsxs("span",{className:"flex flex-col items-center",children:[m&&jsx(fd,{index:f,status:h}),!t&&!v&&jsx("span",{className:s("my-1 w-0.5 flex-1 rounded",R),"aria-hidden":"true"})]}),!r&&jsx("span",{className:s(v?"pb-0":"pb-6"),children:jsx(md,{index:f,status:h})})]})},g.id??f):jsxs("li",{className:s("flex items-center",!v&&"flex-1"),"aria-current":b?"step":void 0,"data-status":h,"data-testid":"wizard-step",children:[jsxs("button",{type:"button",disabled:!x,onClick:()=>o.goToStep(f),className:s("flex items-center gap-2.5 rounded-md focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",cr[d].ring,x?"cursor-pointer":"cursor-default"),children:[m&&jsx(fd,{index:f,status:h}),!r&&jsx(md,{index:f,status:h})]}),!t&&!v&&jsx("span",{className:s("mx-2 flex-1 rounded",p.connector,R),"aria-hidden":"true"})]},g.id??f)})})}function xd({index:e,keepMounted:t=false,className:r,children:o}){let{activeStep:n}=Wr(),a=e===n;return !a&&!t?null:jsx("div",{role:"tabpanel",hidden:!a,"data-testid":"wizard-panel","data-active":a,"data-step":e,className:s("w-full",r),children:o})}function vd({className:e,children:t}){let r=Wr();return jsx("div",{className:s("w-full",e),"data-testid":"wizard-content",children:typeof t=="function"?t(r):t})}var wd="inline-flex cursor-pointer items-center justify-center gap-2 rounded-lg px-4 py-2 text-sm font-medium transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50";function ls({children:e,label:t="Previous",className:r,onClick:o,disabled:n,...a}){let{goBack:i,isFirstStep:c}=Wr();return jsx("button",{type:"button",onClick:l=>{o?.(l),l.defaultPrevented||i();},disabled:n??c,"data-testid":"wizard-previous",className:s(wd,"border border-gray-300 bg-white text-gray-700 hover:bg-gray-50 focus-visible:ring-gray-400 dark:border-gray-600 dark:bg-gray-800 dark:text-gray-200 dark:hover:bg-gray-700",r),...a,children:e??t})}function ds({children:e,label:t="Next",finishLabel:r="Finish",className:o,onClick:n,...a}){let{goNext:i,isLastStep:c,color:d}=Wr();return jsx("button",{type:"button",onClick:p=>{n?.(p),p.defaultPrevented||i();},"data-testid":"wizard-next",className:s(wd,cr[d].solid,cr[d].ring,"hover:opacity-90",o),...a,children:e??(c?r:t)})}function kd({className:e,children:t,align:r="between"}){let o={between:"justify-between",start:"justify-start",center:"justify-center",end:"justify-end"}[r];return jsx("div",{className:s("flex items-center gap-3",o,e),"data-testid":"wizard-actions",children:t??jsxs(Fragment,{children:[jsx(ls,{}),jsx(ds,{})]})})}hd.displayName="Wizard";yd.displayName="WizardSteps";xd.displayName="WizardPanel";vd.displayName="WizardContent";kd.displayName="WizardActions";ls.displayName="WizardPrevious";ds.displayName="WizardNext";export{Ud as Accordion,Yd as AccordionContent,Gd as AccordionItem,Kd as AccordionTrigger,ks as AdvanceDetachable,pc as Avatar,Ns as Badge,Rs as Banner,Dc as Breadcrumb,lt as Button,ro as ButtonGroup,Xc as Calendar,Ms as Card,zs as CardBody,Hs as CardDescription,As as CardFooter,Ls as CardHeader,Ws as CardImage,Fs as CardTitle,Do as Checkbox,Os as CheckboxGroup,Vs as CheckboxGroupItem,pn as Chip,Xs as CircularProgress,qo as DEFAULT_FIELD_TYPES,_u as DataGrid,Gs as Detachable,w0 as DeviceMockup,js as Divider,di as Drawer,hi as Dropdown,Mi as DropdownCheckboxItem,Ci as DropdownContent,Si as DropdownItem,Ti as DropdownLabel,Ai as DropdownRadioGroup,Wi as DropdownRadioItem,Ri as DropdownSeparator,_i as DropdownSubMenu,Ui as DropdownSubMenuContent,$i as DropdownSubMenuTrigger,xi as DropdownTrigger,ti as FOCUSABLE_SELECTOR,op as FileSelector,Tl as Footer,Ml as FooterBottom,Dl as FooterColumn,Il as FooterLink,El as FooterSection,Pl as FooterSocial,Ll as FooterSocialLink,dg as Header,qi as HelpButton,qs as INERT_IGNORE_ATTRIBUTE,Bg as ImageUploader,Zi as Indicator,sr as Input,rl as Label,Ca as MentionInput,wr as Modal,Na as NumberInput,df as Pagination,al as ProgressBar,sl as RadioButton,Ql as SchemaEditor,Pf as Select,Bf as Sidebar,Vf as SidebarContent,_f as SidebarFooter,$f as SidebarGroup,Of as SidebarHeader,Uf as SidebarItem,Gf as SidebarSubMenu,Kf as SidebarToggle,ul as Skeleton,gl as Slider,um as Table,bm as TableBody,vm as TableCell,gm as TableHeader,fm as TableHeaderCell,ym as TableRow,bl as Tabs,wl as TabsContent,hl as TabsList,vl as TabsTrigger,Nl as Toast,dt as Tooltip,O0 as UILabelsProvider,Pg as WithHelpButton,hd as Wizard,kd as WizardActions,vd as WizardContent,ds as WizardNext,xd as WizardPanel,ls as WizardPrevious,yd as WizardSteps,pd as WorkflowEditor,qa as autoLayoutTables,s as cn,$a as createDefaultField,Ua as createDefaultTable,ii as defaultUILabels,bn as findOwnedLayers,B0 as frenchUILabels,jo as generateFieldId,_a as generateRelationId,Fn as generateSQL,Bl as generateTableId,hn as getFocusableElements,pa as hideOthers,ri as isElementVisible,oi as isFocusable,$r as registerFloatingLayer,io as useClickOutside,Ur as useDialogA11y,Lt as useDropdownContext,wi as useFocusItem,vn as useKeyboardNavigation,lo as usePositioning,Af as useSidebar,Gt as useUILabels,Wr as useWizard};