gymatra-ui 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),X=require("@base-ui/react/accordion"),f=require("react"),pe=require("@base-ui/react/avatar"),J=require("chart.js"),rt=require("react-chartjs-2"),Je=require("@base-ui/react/checkbox"),F=require("@base-ui/react/combobox"),W=require("@base-ui/react/dialog"),V=require("@base-ui/react/field"),Dt=require("@base-ui/react/form"),Ft=require("@base-ui/react/input"),_=require("@base-ui/react/select"),ke=require("@base-ui/react/switch"),L=require("@base-ui/react/menu"),Et=require("@base-ui/react/menubar"),U=require("@base-ui/react/popover"),ee=require("@base-ui/react/progress"),Wt=require("@base-ui/react/separator"),te=require("@base-ui/react/tabs"),$t=require("@base-ui/react/toggle"),Ot=require("@base-ui/react/toggle-group"),ne=require("@base-ui/react/tooltip"),Kr=require("react-phone-number-input/input"),ae=require("react-phone-number-input"),St=require("react-phone-number-input/flags"),zt=require("react-phone-number-input/locale/fr.json");function Zr(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(r,s,n.get?n:{enumerable:!0,get:()=>t[s]})}}return r.default=t,Object.freeze(r)}const Ge=Zr(f);function c(...t){return t.filter(Boolean).join(" ")}const Qr={default:"divide-y divide-border rounded-lg border border-border bg-white",separated:"flex flex-col gap-2",flush:"divide-y divide-border"},Yr={default:"",separated:"rounded-lg border border-border bg-white",flush:""},Pt={default:"px-4",separated:"px-4",flush:"px-0"};function Jr(){return e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:"size-4 shrink-0 text-text-muted transition-transform duration-200 group-data-[panel-open]:rotate-180 motion-reduce:transition-none",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function Xr({items:t,multiple:r=!1,value:s,defaultValue:n,onValueChange:a,variant:o="default",disabled:i=!1,headingLevel:l=3,className:m}){const u=`h${l}`;return e.jsx(X.Accordion.Root,{multiple:r,value:s,defaultValue:n,onValueChange:a?d=>a(d):void 0,disabled:i,className:c("w-full",Qr[o],m),children:t.map(d=>e.jsxs(X.Accordion.Item,{value:d.value,disabled:d.disabled,className:Yr[o],children:[e.jsx(X.Accordion.Header,{render:e.jsx(u,{}),className:"m-0",children:e.jsxs(X.Accordion.Trigger,{className:c("group flex w-full cursor-pointer items-center gap-3 py-3.5 text-start outline-none transition-colors",Pt[o],o!=="flush"&&"hover:bg-surface-muted/50",o==="separated"&&"rounded-lg data-[panel-open]:rounded-b-none","focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary","data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[disabled]:hover:bg-transparent"),children:[d.icon&&e.jsx("span",{"aria-hidden":"true",className:"flex shrink-0 text-text-muted group-data-[panel-open]:text-primary [&>svg]:size-4",children:d.icon}),e.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("span",{className:"text-sm font-medium text-text",children:d.title}),d.description&&e.jsx("span",{className:"text-xs font-normal text-text-muted",children:d.description})]}),d.meta&&e.jsx("span",{className:"shrink-0",children:d.meta}),e.jsx(Jr,{})]})}),e.jsx(X.Accordion.Panel,{className:c("h-[var(--accordion-panel-height)] overflow-hidden transition-[height] duration-200 ease-out motion-reduce:transition-none","data-[starting-style]:h-0 data-[ending-style]:h-0"),children:e.jsx("div",{className:c("pb-4 text-sm leading-6 text-text-muted",Pt[o],!!d.icon&&(o==="flush"?"ps-7":"ps-11")),children:d.content})})]},d.value))})}const es=X.Accordion.Root,ts=X.Accordion.Item,rs=X.Accordion.Header,ss=X.Accordion.Trigger,ns=X.Accordion.Panel,ve=t=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t}),as={info:ve(e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 11v5M12 8h.01"})]})),neutral:ve(e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 11v5M12 8h.01"})]})),success:ve(e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]})),warning:ve(e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M10.3 4.3 2.6 18a2 2 0 0 0 1.7 3h15.4a2 2 0 0 0 1.7-3L13.7 4.3a2 2 0 0 0-3.4 0Z"}),e.jsx("path",{d:"M12 9.5v4M12 17h.01"})]})),danger:ve(e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 7.5v5M12 16h.01"})]}))},os={info:"text-info",success:"text-success",warning:"text-warning",danger:"text-danger",neutral:"text-text-muted"},is={soft:{info:"bg-info-soft",success:"bg-success-soft",warning:"bg-warning-soft",danger:"bg-danger-soft",neutral:"bg-surface-muted"},outline:{info:"border border-border bg-white",success:"border border-border bg-white",warning:"border border-border bg-white",danger:"border border-border bg-white",neutral:"border border-border bg-white"}},Ht=f.forwardRef(({tone:t="info",variant:r="soft",title:s,description:n,icon:a,action:o,onClose:i,closeLabel:l="Fermer",className:m,children:u,role:d,...h},b)=>{const p=a===void 0?as[t]:a,x=n??u;return e.jsxs("div",{ref:b,role:d??(t==="danger"||t==="warning"?"alert":"status"),className:c("flex w-full items-start gap-3 rounded-lg px-4 py-3",is[r][t],m),...h,children:[p!==null&&e.jsx("span",{"aria-hidden":"true",className:c("mt-0.5 flex size-5 shrink-0 [&>svg]:size-5",os[t]),children:p}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-0.5",children:[s&&e.jsx("p",{className:"text-sm font-semibold text-text",children:s}),x&&e.jsx("div",{className:"text-sm leading-6 text-text-muted",children:x})]}),o&&e.jsx("div",{className:"flex shrink-0 items-center gap-2 self-center",children:o}),i&&e.jsx("button",{type:"button",onClick:i,"aria-label":l,className:"-me-1 flex size-7 shrink-0 cursor-pointer items-center justify-center self-start rounded-md text-text-muted transition-colors hover:bg-white hover:text-text motion-reduce:transition-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",className:"size-4","aria-hidden":"true",children:e.jsx("path",{d:"M6 6l12 12M18 6 6 18"})})})]})});Ht.displayName="GymatraAlert";const qt=f.createContext(null),Xe={xs:{root:"size-6 text-xs",status:"size-1.5 ring-1"},sm:{root:"size-8 text-xs",status:"size-2 ring-1.5"},md:{root:"size-10 text-sm",status:"size-2.5 ring-2"},lg:{root:"size-12 text-base",status:"size-3 ring-2"},xl:{root:"size-16 text-lg",status:"size-3.5 ring-2"},"2xl":{root:"size-20 text-2xl",status:"size-4 ring-2"}},et={circle:"rounded-full",square:"rounded-lg"},Mt={primary:"bg-primary-soft text-primary",secondary:"bg-surface-muted text-text",success:"bg-success-soft text-success",warning:"bg-warning-soft text-warning",danger:"bg-danger-soft text-danger",info:"bg-info-soft text-info",neutral:"bg-surface-muted text-text-muted"},ls={online:"bg-success",busy:"bg-danger",away:"bg-warning",offline:"bg-text-subtle"};function cs(t){if(!t)return"";const r=t.trim().split(/\s+/).filter(Boolean);return r.length===0?"":r.length===1?r[0].slice(0,2).toUpperCase():(r[0][0]+r[r.length-1][0]).toUpperCase()}function ds({className:t}){return e.jsxs("svg",{className:c("size-1/2 opacity-65",t),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"12",cy:"7",r:"4"})]})}function ze({src:t,alt:r="Avatar",name:s,fallback:n,size:a,shape:o,variant:i="primary",status:l,statusPosition:m="bottom-right",bordered:u=!1,delayMs:d=0,className:h,children:b,...p}){const x=f.useContext(qt),y=a??(x==null?void 0:x.size)??"md",g=o??(x==null?void 0:x.shape)??"circle",j=Xe[y]??Xe.md,k=et[g]??et.circle,v=Mt[i]??Mt.primary,w=s?cs(s):void 0,C=n??w??e.jsx(ds,{});return e.jsxs("span",{className:c("relative inline-flex shrink-0 select-none",h),...p,children:[e.jsx(pe.Avatar.Root,{className:c("flex items-center justify-center overflow-hidden font-medium transition-all",j.root,k,v,u&&"border border-border",x&&"ring-2 ring-white"),children:b||e.jsxs(e.Fragment,{children:[t&&e.jsx(pe.Avatar.Image,{src:t,alt:r||s||"Avatar",className:"size-full object-cover"}),e.jsx(pe.Avatar.Fallback,{delay:d,className:"flex size-full items-center justify-center uppercase tracking-wider",children:C})]})}),l&&e.jsx("span",{className:c("absolute rounded-full ring-white",j.status,ls[l],m==="bottom-right"&&(g==="circle"?"bottom-0 end-0 translate-x-[1px] translate-y-[1px]":"bottom-[-2px] end-[-2px]"),m==="top-right"&&(g==="circle"?"top-0 end-0 translate-x-[1px] -translate-y-[1px]":"top-[-2px] end-[-2px]")),"aria-hidden":"true"})]})}const us={xs:"-space-x-1.5",sm:"-space-x-2",md:"-space-x-2.5",lg:"-space-x-3",xl:"-space-x-4","2xl":"-space-x-5"};function Vt({children:t,max:r,size:s="md",shape:n="circle",spacing:a="tight",className:o,...i}){const l=f.Children.toArray(t).filter(f.isValidElement),m=l.length,u=r!==void 0&&r>=0&&m>r,d=u?l.slice(0,r):l,h=u?m-r:0,b=a==="tight"?us[s]:a==="normal"?"-space-x-1":"space-x-1";return e.jsx(qt.Provider,{value:{size:s,shape:n},children:e.jsxs("div",{role:"group","aria-label":`Groupe de ${m} avatars`,className:c("inline-flex items-center",b,o),...i,children:[d.map(p=>e.jsx("span",{className:"relative inline-flex hover:z-10",children:p},p.key)),h>0&&e.jsxs("span",{role:"img","aria-label":`${h} autre${h>1?"s":""}`,title:`${h} autre${h>1?"s":""}`,className:c("relative inline-flex shrink-0 select-none items-center justify-center bg-surface-muted font-medium text-text-muted ring-2 ring-white",Xe[s].root,et[n]),children:["+",h]})]})})}ze.Root=pe.Avatar.Root;ze.Image=pe.Avatar.Image;ze.Fallback=pe.Avatar.Fallback;ze.Group=Vt;const xs={default:"bg-surface-muted text-text-muted",primary:"bg-primary-soft text-primary",secondary:"bg-surface text-text",outline:"bg-transparent text-text border border-border",success:"bg-success-soft text-success",warning:"bg-warning-soft text-warning",danger:"bg-danger-soft text-danger",info:"bg-info-soft text-info"},ms={sm:"h-5 px-2 text-xs gap-1",md:"h-6 px-2.5 text-xs gap-1.5",lg:"h-7 px-3 text-xs font-medium gap-1.5"},st=f.forwardRef(({variant:t="default",size:r="md",pill:s=!0,dot:n=!1,check:a=!1,circle:o=!1,startIcon:i,endIcon:l,className:m,children:u,...d},h)=>e.jsxs("span",{ref:h,className:c("inline-flex items-center justify-center font-medium border-0 select-none transition-colors",s?"rounded-full":"rounded-md",xs[t],ms[r],m),...d,children:[o||n?e.jsx("span",{className:c("rounded-full border-2 border-current shrink-0",r==="sm"?"size-2":"size-2.5"),"aria-hidden":"true"}):a?e.jsx("svg",{className:c("shrink-0",r==="sm"?"size-3":r==="lg"?"size-3.5":"size-3"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}):null,i&&e.jsx("span",{className:"inline-flex shrink-0 items-center justify-center","aria-hidden":"true",children:i}),u&&e.jsx("span",{className:"truncate",children:u}),l&&e.jsx("span",{className:"inline-flex shrink-0 items-center justify-center","aria-hidden":"true",children:l})]}));st.displayName="GymatraBadge";function Ut({items:t,separator:r="/",className:s,...n}){return e.jsx("nav",{"aria-label":"Breadcrumb",className:c("inline-block",s),...n,children:e.jsx("ol",{className:"flex flex-wrap items-center gap-1.5 text-sm text-text-muted m-0 p-0 list-none",children:t.map((a,o)=>{const i=o===t.length-1;return e.jsxs("li",{className:"inline-flex items-center gap-1.5",children:[!i&&a.href?e.jsxs("a",{href:a.href,onClick:a.onClick,className:"inline-flex items-center gap-1.5 rounded px-0.5 text-sm text-text-muted transition-colors hover:text-text outline-none focus-visible:outline-2 focus-visible:outline-primary",children:[a.icon,e.jsx("span",{children:a.label})]}):e.jsxs("span",{className:c("inline-flex items-center gap-1.5 px-0.5 text-sm",i?"font-medium text-text":"text-text-muted"),"aria-current":i?"page":void 0,children:[a.icon,e.jsx("span",{children:a.label})]}),!i&&e.jsx("span",{className:"text-xs text-text-subtle select-none px-0.5","aria-hidden":"true",children:r})]},o)})})})}Ut.displayName="GymatraBreadcrumb";function _t({className:t,...r}){return e.jsx("ol",{className:c("flex flex-wrap items-center gap-1.5 text-sm text-text-muted m-0 p-0 list-none",t),...r})}_t.displayName="GymatraBreadcrumbList";function Kt({className:t,...r}){return e.jsx("li",{className:c("inline-flex items-center gap-1.5",t),...r})}Kt.displayName="GymatraBreadcrumbItem";function Zt({className:t,...r}){return e.jsx("a",{className:c("inline-flex items-center gap-1.5 rounded px-0.5 text-sm text-text-muted transition-colors hover:text-text outline-none focus-visible:outline-2 focus-visible:outline-primary",t),...r})}Zt.displayName="GymatraBreadcrumbLink";function Qt({className:t,...r}){return e.jsx("span",{"aria-current":"page",className:c("inline-flex items-center gap-1.5 px-0.5 text-sm font-medium text-text",t),...r})}Qt.displayName="GymatraBreadcrumbPage";function Yt({children:t="/",className:r,...s}){return e.jsx("span",{"aria-hidden":"true",className:c("text-xs text-text-subtle select-none px-0.5",r),...s,children:t})}Yt.displayName="GymatraBreadcrumbSeparator";function Jt({className:t,...r}){return e.jsx("span",{"aria-hidden":"true",className:c("flex size-6 items-center justify-center text-text-muted select-none text-xs font-medium",t),...r,children:"…"})}Jt.displayName="GymatraBreadcrumbEllipsis";J.Chart.register(J.CategoryScale,J.LinearScale,J.PointElement,J.LineElement,J.BarElement,J.ArcElement,J.Filler,J.Legend,J.Tooltip);const Ce=["#3563c9","#f47230","#00b894","#f2a600","#ee7fac","#008a17","#6a4ce2","#ec4647"],de={primary:"#224086",text:"#172033",textMuted:"#667085",border:"#e1e5ed",surface:"#ffffff"};function It(){if(typeof window>"u")return de;const t=getComputedStyle(document.documentElement),r=(s,n)=>t.getPropertyValue(s).trim()||n;return{primary:r("--color-primary",de.primary),text:r("--color-text",de.text),textMuted:r("--color-text-muted",de.textMuted),border:r("--color-border",de.border),surface:de.surface}}function We(){const[t,r]=Ge.useState(de);return Ge.useEffect(()=>{r(It());const s=new MutationObserver(()=>r(It()));return s.observe(document.documentElement,{attributes:!0,attributeFilter:["style","class","data-theme"]}),()=>s.disconnect()},[]),t}function Xt(t,r){const s=t.replace("#","");if(!/^[0-9a-f]{6}$/i.test(s))return t;const[n,a,o]=[0,2,4].map(i=>parseInt(s.slice(i,i+2),16));return`rgba(${n}, ${a}, ${o}, ${r})`}const er=(t,r,s)=>t[r].color??(t.length===1?s.primary:Ce[r%Ce.length]);function nt(t){return{backgroundColor:t.surface,titleColor:t.text,bodyColor:t.text,borderColor:t.border,borderWidth:1,padding:10,cornerRadius:6,boxWidth:8,boxHeight:8,boxPadding:4,usePointStyle:!0,titleFont:{size:12,weight:600},bodyFont:{size:12}}}function tr(t,r){return{display:r,position:"bottom",align:"start",labels:{color:t.textMuted,usePointStyle:!0,pointStyle:"circle",boxWidth:8,boxHeight:8,padding:16,font:{size:12}}}}function at({title:t,labels:r,series:s,formatValue:n}){const a=n??(o=>String(o));return e.jsxs("table",{className:"sr-only",children:[e.jsx("caption",{children:t}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:"—"}),s.map(o=>e.jsx("th",{scope:"col",children:o.label},o.label))]})}),e.jsx("tbody",{children:r.map((o,i)=>e.jsxs("tr",{children:[e.jsx("th",{scope:"row",children:o}),s.map(l=>e.jsx("td",{children:l.data[i]!=null?a(l.data[i]):"—"},l.label))]},o))})]})}function ps({labels:t,series:r,title:s,height:n=240,formatValue:a,legend:o="auto",area:i=!1,curved:l=!0,className:m}){const u=We(),d=o==="auto"?r.length>1:o,h=a??(p=>String(p)),b={responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},plugins:{legend:tr(u,d),tooltip:{...nt(u),callbacks:{label:p=>` ${p.dataset.label} : ${h(Number(p.raw))}`}}},scales:{x:{grid:{display:!1},border:{color:u.border},ticks:{color:u.textMuted,font:{size:12},maxRotation:0,autoSkipPadding:16}},y:{beginAtZero:!0,grid:{color:u.border},border:{display:!1},ticks:{color:u.textMuted,font:{size:12},maxTicksLimit:5,callback:p=>h(Number(p))}}}};return e.jsxs("div",{className:c("relative w-full",m),style:{height:n},children:[e.jsx(rt.Line,{role:"img","aria-label":s,options:b,data:{labels:[...t],datasets:r.map((p,x)=>{const y=er(r,x,u);return{label:p.label,data:[...p.data],borderColor:y,backgroundColor:i?Xt(y,.08):y,fill:i,borderWidth:2,tension:l?.35:0,pointRadius:0,pointHoverRadius:5,pointHoverBackgroundColor:y,pointHoverBorderColor:u.surface,pointHoverBorderWidth:2}})}}),e.jsx(at,{title:s,labels:t,series:r,formatValue:a})]})}function fs({labels:t,series:r,title:s,height:n=240,formatValue:a,legend:o="auto",horizontal:i=!1,stacked:l=!1,className:m}){const u=We(),d=o==="auto"?r.length>1:o,h=a??(y=>String(y)),b=i?"x":"y",p=i?"y":"x",x={responsive:!0,maintainAspectRatio:!1,indexAxis:i?"y":"x",interaction:{mode:"index",intersect:!1},plugins:{legend:tr(u,d),tooltip:{...nt(u),callbacks:{label:y=>` ${y.dataset.label} : ${h(Number(y.raw))}`}}},scales:{[p]:{stacked:l,grid:{display:!1},border:{color:u.border},ticks:{color:i?u.text:u.textMuted,font:{size:12},maxRotation:0,autoSkipPadding:12}},[b]:{stacked:l,beginAtZero:!0,grid:{color:u.border},border:{display:!1},ticks:{color:u.textMuted,font:{size:12},maxTicksLimit:5,callback:y=>h(Number(y))}}}};return e.jsxs("div",{className:c("relative w-full",m),style:{height:n},children:[e.jsx(rt.Bar,{role:"img","aria-label":s,options:x,data:{labels:[...t],datasets:r.map((y,g)=>{const j=er(r,g,u),k=g===r.length-1;return{label:y.label,data:[...y.data],backgroundColor:j,hoverBackgroundColor:j,borderRadius:l&&!k?0:4,borderSkipped:"start",borderColor:u.surface,borderWidth:l?{[i?"right":"top"]:2}:0,maxBarThickness:28,categoryPercentage:.7,barPercentage:r.length>1&&!l?.72:.9}})}}),e.jsx(at,{title:s,labels:t,series:r,formatValue:a})]})}function hs({data:t,title:r,centerValue:s,centerLabel:n,size:a=180,formatValue:o,showList:i=!0,className:l}){const m=We(),u=o??(p=>String(p)),d=t.reduce((p,x)=>p+x.value,0),h=t.map((p,x)=>p.color??Ce[x%Ce.length]),b={responsive:!0,maintainAspectRatio:!1,cutout:"72%",plugins:{legend:{display:!1},tooltip:{...nt(m),callbacks:{label:p=>{const x=Number(p.raw),y=d?Math.round(x/d*100):0;return` ${p.label} : ${u(x)} (${y} %)`}}}}};return e.jsxs("div",{className:c("flex flex-wrap items-center gap-6",l),children:[e.jsxs("div",{className:"relative shrink-0",style:{width:a,height:a},children:[e.jsx(rt.Doughnut,{role:"img","aria-label":r,options:b,data:{labels:t.map(p=>p.label),datasets:[{data:t.map(p=>p.value),backgroundColor:h,hoverBackgroundColor:h,borderColor:m.surface,borderWidth:2,hoverOffset:4}]}}),e.jsxs("div",{className:"pointer-events-none absolute inset-0 flex flex-col items-center justify-center text-center",children:[e.jsx("span",{className:"text-2xl font-semibold tabular-nums text-text",children:s??u(d)}),n&&e.jsx("span",{className:"text-xs text-text-muted",children:n})]})]}),i&&e.jsx("ul",{className:"min-w-40 flex-1 space-y-2",children:t.map((p,x)=>e.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:h[x]},"aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-text",children:p.label}),e.jsx("span",{className:"tabular-nums text-text",children:u(p.value)}),e.jsxs("span",{className:"w-10 text-end tabular-nums text-text-muted",children:[d?Math.round(p.value/d*100):0," %"]})]},p.label))}),e.jsx(at,{title:r,labels:t.map(p=>p.label),series:[{label:r,data:t.map(p=>p.value)}],formatValue:o})]})}const rr=Ge.forwardRef(({title:t,description:r,action:s,variant:n="outline",className:a,children:o,...i},l)=>{const m=Ge.useId();return e.jsxs("section",{ref:l,"aria-labelledby":m,className:c("flex min-w-0 flex-col gap-4",n==="outline"&&"rounded-lg border border-border bg-white px-4 py-3.5",a),...i,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{id:m,className:"truncate text-sm font-semibold text-text",children:t}),r&&e.jsx("p",{className:"truncate text-xs text-text-muted",children:r})]}),s&&e.jsx("div",{className:"flex shrink-0 items-center gap-2",children:s})]}),o]})});rr.displayName="GymatraChartCard";const Tt={primary:"bg-primary text-white hover:bg-primary-hover active:bg-primary-active focus-visible:outline-primary shadow-none border-0",secondary:"bg-surface-muted text-text hover:bg-border/60 active:bg-border focus-visible:outline-primary shadow-none border-0",outline:"bg-transparent text-text border border-border hover:bg-surface-muted hover:text-text active:bg-border/40 focus-visible:outline-primary shadow-none",soft:"bg-primary-soft text-primary hover:bg-primary-soft/70 active:bg-primary/15 focus-visible:outline-primary shadow-none border-0",ghost:"bg-transparent text-text-muted hover:text-text hover:bg-surface-muted active:bg-border/40 focus-visible:outline-primary shadow-none border-0",danger:"bg-danger text-white hover:bg-danger/90 active:bg-danger/80 focus-visible:outline-danger shadow-none border-0",success:"bg-success text-white hover:bg-success/90 active:bg-success/80 focus-visible:outline-success shadow-none border-0",warning:"bg-warning text-white hover:bg-warning/90 active:bg-warning/80 focus-visible:outline-warning shadow-none border-0",info:"bg-info text-white hover:bg-info/90 active:bg-info/80 focus-visible:outline-info shadow-none border-0","outline-primary":"bg-transparent text-primary border border-primary/40 hover:bg-primary-soft hover:border-primary active:bg-primary/15 focus-visible:outline-primary shadow-none","outline-danger":"bg-transparent text-danger border border-danger/40 hover:bg-danger-soft hover:border-danger active:bg-danger/15 focus-visible:outline-danger shadow-none","outline-warning":"bg-transparent text-warning border border-warning/40 hover:bg-warning-soft hover:border-warning active:bg-warning/15 focus-visible:outline-warning shadow-none","outline-success":"bg-transparent text-success border border-success/40 hover:bg-success-soft hover:border-success active:bg-success/15 focus-visible:outline-success shadow-none","outline-info":"bg-transparent text-info border border-info/40 hover:bg-info-soft hover:border-info active:bg-info/15 focus-visible:outline-info shadow-none"},bs={xs:"h-7 px-2.5 text-xs gap-1.5",sm:"h-8 px-3 text-sm gap-1.5",md:"h-10 px-4 text-sm gap-2",lg:"h-11 px-5 text-sm gap-2.5",xl:"h-12 px-6 text-base gap-3",icon:"size-9 p-0 justify-center text-sm gap-0"},ys={normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},gs={xs:"size-3.5",sm:"size-4",md:"size-4",lg:"size-4.5",xl:"size-5",icon:"size-4.5"};function js(t,r){if(r&&r!=="default"){if(t==="outline")return`outline-${r}`;if(t==="primary")return r}return t}const De=f.forwardRef(({variant:t="primary",color:r,size:s="md",weight:n="medium",pill:a=!1,fullWidth:o=!1,startIcon:i,endIcon:l,loading:m=!1,loadingText:u,disabled:d,children:h,className:b,type:p="button",...x},y)=>{const g=d||m,j=gs[s],k=js(t,r);return e.jsx("button",{ref:y,type:p,disabled:g,"aria-busy":m?!0:void 0,className:c("inline-flex cursor-pointer items-center justify-center transition-all duration-150 select-none",a?"rounded-full":s==="xs"?"rounded":s==="xl"?"rounded-lg":"rounded-md",o?"w-full":"",ys[n],"focus-visible:outline-2 focus-visible:outline-offset-2 disabled:pointer-events-none disabled:opacity-50",Tt[k]||Tt.primary,bs[s],b),...x,children:m?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:c("animate-spin shrink-0",j),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),u?e.jsx("span",{children:u}):h?e.jsx("span",{children:h}):null]}):e.jsxs(e.Fragment,{children:[i&&e.jsx("span",{className:c("inline-flex shrink-0 items-center justify-center",j),"aria-hidden":"true",children:i}),h&&e.jsx("span",{children:h}),l&&e.jsx("span",{className:c("inline-flex shrink-0 items-center justify-center",j),"aria-hidden":"true",children:l})]})})});De.displayName="GymatraButton";const vs={sm:{box:"size-3.5",icon:"size-2.5",offset:"mt-[3px]"},md:{box:"size-4",icon:"size-3",offset:"mt-0.5"},lg:{box:"size-5",icon:"size-3.5",offset:"mt-0"}};function ws({className:t}){return e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",className:t,"aria-hidden":"true",children:e.jsx("path",{d:"M20 6 9 17l-5-5"})})}function Ns({className:t}){return e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.5",strokeLinecap:"round","aria-hidden":"true",className:t,children:e.jsx("path",{d:"M5 12h14"})})}const ot=f.forwardRef(({label:t,description:r,size:s="md",invalid:n=!1,indeterminate:a=!1,disabled:o=!1,onChange:i,onCheckedChange:l,className:m,wrapperClassName:u,...d},h)=>{const b=vs[s],p=e.jsx(Je.Checkbox.Root,{ref:h,indeterminate:a,disabled:o,"aria-invalid":n||void 0,onCheckedChange:(x,y)=>{l==null||l(x,y),i==null||i(x)},className:c("inline-flex shrink-0 cursor-pointer items-center justify-center rounded-sm border border-border-strong bg-white text-white outline-none transition-colors motion-reduce:transition-none","hover:border-text-subtle","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary","data-[checked]:border-primary data-[checked]:bg-primary data-[indeterminate]:border-primary data-[indeterminate]:bg-primary","aria-[invalid=true]:border-danger aria-[invalid=true]:focus-visible:outline-danger","data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[disabled]:hover:border-border-strong",b.box,!!(t||r)&&b.offset,m),...d,children:e.jsx(Je.Checkbox.Indicator,{className:"flex items-center justify-center",keepMounted:!1,children:a?e.jsx(Ns,{className:b.icon}):e.jsx(ws,{className:b.icon})})});return!t&&!r?p:e.jsxs("label",{className:c("inline-flex select-none items-start gap-2.5",o?"cursor-not-allowed":"cursor-pointer",u),children:[p,e.jsxs("span",{className:"flex min-w-0 flex-col",children:[t&&e.jsx("span",{className:c("text-sm font-medium leading-5",o?"text-text-subtle":"text-text"),children:t}),r&&e.jsx("span",{className:"text-xs leading-normal text-text-muted",children:r})]})]})});ot.displayName="GymatraCheckbox";const ks=F.Combobox.Root,Gs=F.Combobox.Trigger,Cs=F.Combobox.Portal,Ss=F.Combobox.Positioner,zs=F.Combobox.List,Ps=F.Combobox.Group,Ms=F.Combobox.Separator,Is=F.Combobox.Clear,Ts=F.Combobox.Chips,Ls=F.Combobox.Chip,Rs=F.Combobox.ChipRemove,sr=f.forwardRef(({className:t,startIcon:r,error:s,disabled:n,...a},o)=>e.jsxs("div",{className:c("relative flex items-center w-full h-10 rounded-md border bg-white transition-colors",n?"border-border bg-surface-muted opacity-50 cursor-not-allowed":s?"border-danger focus-within:border-danger focus-within:ring-1 focus-within:ring-danger":"border-border hover:border-text-subtle focus-within:border-primary focus-within:ring-1 focus-within:ring-primary"),children:[r&&e.jsx("span",{className:"shrink-0 pl-3 text-text-subtle pointer-events-none flex items-center justify-center",children:r}),e.jsx(F.Combobox.Input,{ref:o,disabled:n,className:c("h-full w-full bg-transparent px-3.5 py-2 text-sm text-text placeholder:text-text-subtle outline-none border-0 ring-0 shadow-none focus:outline-none focus:ring-0 focus:border-0",t),...a}),e.jsx("span",{className:"shrink-0 pr-3 text-text-subtle pointer-events-none flex items-center justify-center",children:e.jsx("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})})]}));sr.displayName="GymatraComboboxInput";const it=f.forwardRef(({className:t,children:r,...s},n)=>e.jsx(F.Combobox.Popup,{ref:n,className:c("z-50 min-w-[var(--anchor-width)] max-h-64 overflow-y-auto rounded-lg border border-border bg-white p-1 text-sm text-text outline-none shadow-none",t),...s,children:r}));it.displayName="GymatraComboboxPopup";function Bs({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}const Fe=f.forwardRef(({className:t,children:r,icon:s,description:n,...a},o)=>e.jsxs(F.Combobox.Item,{ref:o,className:c("group relative flex w-full cursor-pointer select-none items-center justify-between gap-2 rounded-md px-2.5 py-1.5 text-sm text-text outline-none transition-colors","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","data-[highlighted]:bg-surface-muted data-[highlighted]:text-text","data-[selected]:font-medium data-[selected]:text-primary",t),...a,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s&&e.jsx("span",{className:"shrink-0 size-4 text-text-muted flex items-center justify-center",children:s}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate",children:r}),n&&e.jsx("div",{className:"text-xs text-text-muted truncate",children:n})]})]}),e.jsx(F.Combobox.ItemIndicator,{className:"shrink-0 size-4 flex items-center justify-center text-primary",children:e.jsx(Bs,{})})]}));Fe.displayName="GymatraComboboxItem";const lt=f.forwardRef(({className:t,children:r,...s},n)=>e.jsx(F.Combobox.Empty,{ref:n,className:c("px-3 py-2 text-sm text-text-muted text-center",t),...s,children:r??"Aucun résultat trouvé"}));lt.displayName="GymatraComboboxEmpty";const ct=f.forwardRef(({className:t,...r},s)=>e.jsx(F.Combobox.GroupLabel,{ref:s,className:c("px-2.5 py-1 text-xs font-semibold uppercase tracking-wider text-text-muted select-none",t),...r}));ct.displayName="GymatraComboboxGroupLabel";function As(t){return t.map(r=>typeof r=="string"?{value:r,label:r}:r)}function Ds({label:t,helperText:r,error:s,options:n,value:a,defaultValue:o,onValueChange:i,onChange:l,placeholder:m="Rechercher ou sélectionner...",emptyText:u="Aucun résultat trouvé",disabled:d=!1,required:h=!1,className:b,startIcon:p}){const x=As(n),y=x.some(v=>!!v.group),g={};y&&x.forEach(v=>{const w=v.group||"Autres";g[w]||(g[w]=[]),g[w].push(v)});const j=v=>{i==null||i(v),l==null||l(v)},k=a!==void 0?{value:a,onValueChange:j,items:x}:o!==void 0?{defaultValue:o,onValueChange:j,items:x}:{onValueChange:j,items:x};return e.jsxs("div",{className:c("w-full space-y-1.5",b),children:[t&&e.jsxs("label",{className:"block text-xs font-medium text-text-muted",children:[t,h&&e.jsx("span",{className:"text-danger ml-0.5",children:"*"})]}),e.jsxs(F.Combobox.Root,{...k,disabled:d,children:[e.jsxs("div",{className:c("relative flex items-center w-full h-10 rounded-md border bg-white transition-colors",d?"border-border bg-surface-muted opacity-50 cursor-not-allowed":s?"border-danger focus-within:border-danger focus-within:ring-1 focus-within:ring-danger":"border-border hover:border-text-subtle focus-within:border-primary focus-within:ring-1 focus-within:ring-primary"),children:[p&&e.jsx("span",{className:"shrink-0 pl-3 text-text-subtle pointer-events-none flex items-center justify-center",children:p}),e.jsx(F.Combobox.Input,{placeholder:m,disabled:d,className:"h-full w-full bg-transparent px-3.5 py-2 text-sm text-text placeholder:text-text-subtle outline-none border-0 ring-0 shadow-none focus:outline-none focus:ring-0 focus:border-0"}),e.jsx("span",{className:"shrink-0 pr-3 text-text-subtle pointer-events-none flex items-center justify-center",children:e.jsx("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})})]}),e.jsx(F.Combobox.Portal,{children:e.jsx(F.Combobox.Positioner,{sideOffset:4,className:"z-[10020] outline-none",children:e.jsxs(it,{children:[e.jsx(lt,{children:u}),e.jsx(F.Combobox.List,{children:y?Object.entries(g).map(([v,w])=>e.jsxs(F.Combobox.Group,{children:[e.jsx(ct,{children:v}),w.map(C=>e.jsx(Fe,{value:C.value,disabled:C.disabled,icon:C.icon,description:C.description,children:C.label},C.value))]},v)):x.map(v=>e.jsx(Fe,{value:v.value,disabled:v.disabled,icon:v.icon,description:v.description,children:v.label},v.value))})]})})})]}),s?e.jsx("p",{className:"text-xs text-danger",children:s}):r?e.jsx("p",{className:"text-xs text-text-muted",children:r}):null]})}const nr={sm:"max-w-[420px]",md:"max-w-lg",lg:"max-w-xl",xl:"max-w-2xl"};function Fs({variant:t}){switch(t){case"danger":case"delete":return e.jsx("svg",{className:"size-12 text-danger stroke-[1.5]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})});case"warning":return e.jsx("svg",{className:"size-12 text-warning stroke-[1.5]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})});case"success":return e.jsx("svg",{className:"size-12 text-success stroke-[1.5]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})});case"info":return e.jsx("svg",{className:"size-12 text-info stroke-[1.5]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"})});case"primary":return e.jsx("svg",{className:"size-12 text-primary stroke-[1.5]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"})});default:return null}}function ar({open:t,defaultOpen:r,onOpenChange:s,trigger:n,variant:a="default",size:o="sm",title:i,description:l,icon:m,align:u="center",children:d,confirmLabel:h,onConfirm:b,confirmVariant:p,cancelLabel:x="Annuler",onCancel:y,loading:g=!1,confirmDisabled:j=!1,showCloseButton:k=!1,footer:v,className:w}){const C=a==="danger"||a==="delete",S=h??(b?C?"Supprimer":"Confirmer":void 0),z=m===!1?null:m!==void 0?m:e.jsx(Fs,{variant:a}),N=()=>p||(C?"danger":a==="warning"?"warning":a==="success"?"success":a==="info"?"info":"primary"),P=e.jsxs(W.Dialog.Portal,{children:[e.jsx(W.Dialog.Backdrop,{className:"fixed inset-0 z-[10010] bg-around/40 transition-opacity duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),e.jsxs(W.Dialog.Popup,{className:c("fixed left-1/2 top-1/2 z-[10010] -translate-x-1/2 -translate-y-1/2","w-[calc(100%-2rem)] bg-white rounded-lg border border-border p-6 shadow-none","flex flex-col focus:outline-none transition-all duration-150","data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0",nr[o],u==="center"?"items-center text-center":"items-start text-left",w),children:[k&&e.jsx(W.Dialog.Close,{className:"size-8 inline-flex items-center justify-center absolute right-3.5 top-3.5 rounded-md text-text-muted hover:bg-surface-muted hover:text-text cursor-pointer transition-colors focus-visible:outline-primary","aria-label":"Fermer",onClick:y,children:e.jsxs("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),z&&e.jsx("div",{className:"flex items-center justify-center mb-3 text-center",children:z}),i&&e.jsx(W.Dialog.Title,{className:c("text-lg font-semibold text-text leading-snug",u==="center"?"text-center":"text-left"),children:i}),l&&e.jsx(W.Dialog.Description,{className:c("text-sm text-text-muted mt-2 leading-relaxed",u==="center"?"text-center":"text-left"),children:l}),d&&e.jsx("div",{className:"mt-4 w-full text-left",children:d}),v!==void 0?v:(S||x)&&e.jsxs("div",{className:c("w-full mt-6",x&&S?"grid grid-cols-2 gap-3":"flex justify-end gap-3"),children:[x&&e.jsx(W.Dialog.Close,{render:e.jsx(De,{variant:"outline",size:"md",className:"w-full text-sm font-medium",onClick:y,disabled:g,children:x})}),S&&e.jsx(De,{variant:N(),size:"md",className:"w-full text-sm font-medium",onClick:b,loading:g,disabled:j||g,children:S})]})]})]});return e.jsxs(W.Dialog.Root,{open:t,defaultOpen:r,onOpenChange:s,children:[n&&e.jsx(W.Dialog.Trigger,{render:n}),P]})}const fe=Object.assign(ar,{Root:W.Dialog.Root,Trigger:W.Dialog.Trigger,Portal:W.Dialog.Portal,Backdrop:f.forwardRef(function({className:r,...s},n){return e.jsx(W.Dialog.Backdrop,{ref:n,className:c("fixed inset-0 z-[10010] bg-around/40 transition-opacity duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0",r),...s})}),Popup:f.forwardRef(function({className:r,size:s="sm",...n},a){return e.jsx(W.Dialog.Popup,{ref:a,className:c("fixed left-1/2 top-1/2 z-[10010] -translate-x-1/2 -translate-y-1/2","w-[calc(100%-2rem)] bg-white rounded-lg border border-border p-6 shadow-none","flex flex-col focus:outline-none transition-all duration-150","data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0",nr[s],r),...n})}),Title:f.forwardRef(function({className:r,...s},n){return e.jsx(W.Dialog.Title,{ref:n,className:c("text-lg font-semibold text-text leading-snug",r),...s})}),Description:f.forwardRef(function({className:r,...s},n){return e.jsx(W.Dialog.Description,{ref:n,className:c("text-sm text-text-muted mt-2 leading-relaxed",r),...s})}),Close:W.Dialog.Close}),Es=W.Dialog.Root,Ws=W.Dialog.Trigger,$s=W.Dialog.Portal,Os=fe.Backdrop,Hs=fe.Popup,qs=fe.Popup,Vs=fe.Title,Us=fe.Description,_s=W.Dialog.Close,tt={s:25,m:35,l:50,xl:70,full:100},Ks=360;function Zs(t){return typeof t=="number"?`${t}px`:`${tt[t??"m"]??tt.m}vw`}const Qs={s:"w-[25vw]",m:"w-[35vw]",l:"w-[50vw]",xl:"w-[70vw]",full:"w-screen"},Be=f.forwardRef(({size:t,animated:r,mobileLayer:s,label:n,children:a},o)=>e.jsx("div",{ref:o,role:"dialog","aria-modal":"true","aria-label":n,className:c("flex min-h-0 min-w-90 max-w-full shrink flex-col overflow-y-auto overflow-x-hidden border-s border-border bg-white shadow-none","transition-[translate,opacity] duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] motion-reduce:transition-none",typeof t=="number"?void 0:Qs[t],r?"pointer-events-auto translate-x-0 opacity-100":"pointer-events-none translate-x-full opacity-0 rtl:-translate-x-full","max-[900px]:fixed max-[900px]:inset-0 max-[900px]:!w-full max-[900px]:min-w-0 max-[900px]:border-0",s),style:typeof t=="number"?{width:t}:void 0,children:a}));Be.displayName="DrawerSlot";const dt=f.createContext(void 0),or=()=>{const t=f.useContext(dt);if(!t)throw new Error("useGymatraDrawer must be used within a GymatraDrawerProvider");return t},Ys=or,Js=dt;function ir({children:t}){const[r,s]=f.useState(!1),[n,a]=f.useState(!1),[o,i]=f.useState(!1),[l,m]=f.useState("m"),[u,d]=f.useState(null),[h,b]=f.useState(null),p=f.useRef(null),x=f.useRef(null),[y,g]=f.useState(!1),[j,k]=f.useState(!1),[v,w]=f.useState(!1),[C,T]=f.useState("l"),[S,z]=f.useState(null),[N,P]=f.useState(null),E=f.useRef(null),R=f.useRef(null),[O,re]=f.useState(!1),[M,H]=f.useState(!1),[oe,B]=f.useState(!1),[$,K]=f.useState("s"),[q,Z]=f.useState(null),[Ie,ie]=f.useState(null),ye=f.useRef(null),le=f.useRef(null);f.useEffect(()=>{if(n&&r){const G=requestAnimationFrame(()=>{i(!0)});return()=>cancelAnimationFrame(G)}else i(!1)},[n,r]),f.useEffect(()=>{if(j&&y){const G=requestAnimationFrame(()=>{w(!0)});return()=>cancelAnimationFrame(G)}else w(!1)},[j,y]),f.useEffect(()=>{if(M&&O){const G=requestAnimationFrame(()=>{B(!0)});return()=>cancelAnimationFrame(G)}else B(!1)},[M,O]),f.useEffect(()=>{const G=()=>{je()};return window.addEventListener("popstate",G),()=>window.removeEventListener("popstate",G)},[]);const ge=(G,I="s",A={})=>{le.current&&clearTimeout(le.current),Z(()=>G),K(I),ie(A),H(!0),re(!0)},Q=()=>{re(!1),B(!1),le.current&&clearTimeout(le.current),le.current=setTimeout(()=>{H(!1),Z(null),ie(null)},300)},Te=(G,I="l",A={})=>{R.current&&clearTimeout(R.current),z(()=>G),T(I),P(A),k(!0),g(!0)},ue=()=>{Q(),g(!1),w(!1),R.current&&clearTimeout(R.current),R.current=setTimeout(()=>{k(!1),z(null),P(null)},300)},Ke=(G,I="m",A={})=>{x.current&&clearTimeout(x.current),d(()=>G),m(I),b(A),a(!0),s(!0)},xe=()=>{Q(),ue(),s(!1),i(!1),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{a(!1),d(null),b(null)},300)},je=()=>{xe()};f.useEffect(()=>{const G=I=>{I.key==="Escape"&&(O?Q():y?ue():r&&xe())};if(r||y||O)return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[r,y,O]);const Le=n||j||M,Ze=o||v||oe,Re=(r?1:0)+(y?1:0)+(O?1:0);return e.jsxs(dt.Provider,{value:{openDrawer:Ke,closeDrawer:xe,isOpen:r,size:l,contentProps:h,Component:u,openSecondDrawer:Te,closeSecondDrawer:ue,isSecondOpen:y,secondSize:C,secondContentProps:N,SecondComponent:S,openThirdDrawer:ge,closeThirdDrawer:Q,isThirdOpen:O,thirdSize:$,thirdContentProps:Ie,ThirdComponent:q,closeAll:je,openCount:Re},children:[t,Le&&e.jsx("div",{"aria-hidden":"true",onClick:()=>{O?Q():y?ue():r&&xe()},className:c("fixed inset-0 z-[9990] bg-around/40 cursor-pointer","transition-opacity duration-300 ease-out",Ze?"opacity-100":"opacity-0 pointer-events-none")}),Le&&e.jsxs("div",{className:"pointer-events-none fixed inset-y-0 end-0 z-[10000] flex max-w-full items-stretch justify-end gap-1.5 overflow-x-auto overflow-y-hidden max-[900px]:inset-0",children:[M&&e.jsx(Be,{ref:ye,size:$,animated:oe,mobileLayer:"max-[900px]:z-30",label:"Tiroir de niveau 3",children:q&&e.jsx(q,{...Ie||{}})}),j&&e.jsx(Be,{ref:E,size:C,animated:v,mobileLayer:"max-[900px]:z-20",label:"Tiroir de niveau 2",children:S&&e.jsx(S,{...N||{}})}),n&&e.jsx(Be,{ref:p,size:l,animated:o,mobileLayer:"max-[900px]:z-10",label:"Tiroir",children:u&&e.jsx(u,{...h||{}})})]})]})}const Xs=ir;function en({title:t,description:r,icon:s,showCloseButton:n=!0,onClose:a,footer:o,className:i,children:l,...m}){return e.jsxs("div",{className:c("flex h-full flex-col bg-white text-text min-h-0",i),...m,children:[(t||n)&&e.jsxs("div",{className:"sticky top-0 z-20 shrink-0 bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 pt-4 pb-3 sm:px-6",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 pe-3",children:[s&&e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-primary-soft text-primary",children:s}),e.jsxs("div",{className:"min-w-0",children:[t&&e.jsx("h3",{className:"text-base font-semibold text-text truncate",children:t}),r&&e.jsx("p",{className:"text-xs text-text-muted truncate mt-0.5",children:r})]})]}),n&&e.jsx("button",{type:"button",onClick:a,"aria-label":"Fermer",className:"size-8 inline-flex shrink-0 items-center justify-center rounded-md text-text-muted hover:bg-surface-muted hover:text-text cursor-pointer transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",children:e.jsxs("svg",{className:"size-4.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsx("div",{className:"mx-5 sm:mx-6 border-b border-border"})]}),e.jsx("div",{className:"flex-1 space-y-4 overflow-y-auto p-5 text-sm text-text",children:l}),o&&e.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2.5 border-t border-border bg-white px-5 py-3.5",children:o})]})}function tn(){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M3 9l2.5-5h13L21 9"}),e.jsx("path",{d:"M3 9h5l1.5 3h5L16 9h5v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1Z"})]})}const rn={sm:{root:"gap-3 px-4 py-6",tile:"size-10 [&>svg]:size-5",title:"text-sm",description:"text-xs"},md:{root:"gap-4 px-6 py-10",tile:"size-12 [&>svg]:size-6",title:"text-base",description:"text-sm"},lg:{root:"gap-5 px-6 py-16",tile:"size-14 [&>svg]:size-7",title:"text-lg",description:"text-sm"}},sn={plain:"",bordered:"rounded-lg border border-dashed border-border-strong",muted:"rounded-lg bg-surface-muted"},nn={neutral:{plain:"bg-surface-muted text-text-muted",bordered:"bg-surface-muted text-text-muted",muted:"bg-white text-text-muted"},primary:{plain:"bg-primary-soft text-primary",bordered:"bg-primary-soft text-primary",muted:"bg-white text-primary"},danger:{plain:"bg-danger-soft text-danger",bordered:"bg-danger-soft text-danger",muted:"bg-white text-danger"}},lr=f.forwardRef(({title:t,description:r,icon:s,action:n,secondaryAction:a,size:o="md",variant:i="plain",tone:l="neutral",headingLevel:m=3,className:u,...d},h)=>{const b=rn[o],p=`h${m}`,x=s===void 0?e.jsx(tn,{}):s;return e.jsxs("div",{ref:h,className:c("flex w-full flex-col items-center justify-center text-center",b.root,sn[i],u),...d,children:[x!==null&&e.jsx("span",{"aria-hidden":"true",className:c("flex shrink-0 items-center justify-center rounded-full",b.tile,nn[l][i]),children:x}),e.jsxs("div",{className:"max-w-sm space-y-1",children:[e.jsx(p,{className:c("font-semibold text-text",b.title),children:t}),r&&e.jsx("p",{className:c("text-text-muted",b.description),children:r})]}),(n||a)&&e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[a,n]})]})});lr.displayName="GymatraEmptyState";function an({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function ut({label:t,options:r,multiple:s=!1,value:n,defaultValue:a,onChange:o,placeholder:i,bordered:l=!0,showCount:m=!0,size:u="sm",width:d,className:h,disabled:b=!1}){const[p,x]=f.useState(()=>typeof a<"u"?a:s?[]:r.length>0?r[0].value:""),[y,g]=f.useState(!1),j=f.useRef(null),k=n??p,v=s?Array.isArray(k)?k:k?[k]:[]:typeof k=="string"&&k!==""?[k]:[];let w;if(s)if(v.length===0)w=i??`All ${t}`;else if(v.length===1){const N=r.find(P=>P.value===v[0]);w=N?N.label:v[0]}else v.length===r.length?w=`All (${v.length})`:w=`${v.length} selected`;else{const N=v[0],P=r.find(E=>E.value===N);w=P?P.label:i??`All ${t}`}const C=s?v.length>0:!!(v[0]&&v[0]!=="all"&&v[0]!=="");f.useEffect(()=>{function N(P){j.current&&!j.current.contains(P.target)&&g(!1)}if(y)return document.addEventListener("mousedown",N),()=>document.removeEventListener("mousedown",N)},[y]),f.useEffect(()=>{function N(P){P.key==="Escape"&&g(!1)}if(y)return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[y]);function T(N){if(s){const E=v.includes(N)?v.filter(R=>R!==N):[...v,N];typeof n>"u"&&x(E),o==null||o(E)}else typeof n>"u"&&x(N),o==null||o(N),g(!1)}function S(){const N=r.filter(P=>!P.disabled).map(P=>P.value);typeof n>"u"&&x(N),o==null||o(N)}function z(){const N=[];typeof n>"u"&&x(N),o==null||o(N)}return e.jsxs("div",{ref:j,className:c("relative inline-block text-left",h),children:[e.jsxs("button",{type:"button",disabled:b,onClick:()=>g(N=>!N),"aria-haspopup":"listbox","aria-expanded":y,"aria-label":`${t}: ${w}`,className:c("inline-flex items-center justify-between gap-2 rounded-md text-text cursor-pointer transition-colors outline-none","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary","disabled:pointer-events-none disabled:opacity-50",u==="sm"?"h-8.5 px-3 text-sm":"h-10 px-3.5 text-sm",d||(u==="sm"?"w-[165px]":"w-[185px]"),l?"border border-border bg-white hover:border-border-strong hover:bg-surface/50":"border-0 bg-transparent hover:bg-surface/50",y&&"bg-primary-soft/50 text-primary",C&&!y&&"bg-primary-soft/50 text-primary"),children:[e.jsxs("span",{className:"flex items-center gap-1.5 truncate",children:[e.jsxs("span",{className:"text-text-muted",children:[t,":"]}),e.jsx("span",{className:"truncate",children:w})]}),e.jsx("span",{className:c("text-text-subtle transition-transform duration-150 flex items-center shrink-0",y&&"rotate-180 text-primary"),"aria-hidden":"true",children:e.jsx(an,{})})]}),y&&e.jsxs("div",{role:"listbox","aria-multiselectable":s,"aria-label":t,className:"absolute left-0 z-50 mt-1 min-w-[190px] w-max max-w-[280px] rounded-lg border border-border bg-white p-1.5 shadow-none focus:outline-none",children:[s&&r.length>2&&e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-2 py-1.5 mb-1 text-xs text-text-muted",children:[e.jsxs("span",{children:[v.length," of ",r.length," selected"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:S,className:"text-primary hover:underline font-medium cursor-pointer",children:"All"}),e.jsx("span",{className:"text-border","aria-hidden":"true",children:"|"}),e.jsx("button",{type:"button",onClick:z,className:"text-text-muted hover:text-text hover:underline cursor-pointer",children:"Clear"})]})]}),e.jsx("div",{className:"max-h-60 overflow-y-auto space-y-0.5",children:r.map(N=>{const P=v.includes(N.value);return e.jsxs("button",{type:"button",role:"option","aria-selected":P,disabled:N.disabled,onClick:()=>T(N.value),className:c("flex w-full items-center justify-between gap-2.5 rounded-md px-2 py-1.5 text-sm text-left cursor-pointer transition-colors outline-none","hover:bg-surface hover:text-text","focus-visible:bg-surface focus-visible:text-primary","disabled:pointer-events-none disabled:opacity-40",P?"bg-primary-soft/40 text-primary font-medium":"text-text font-normal"),children:[e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[e.jsx("span",{"aria-hidden":"true",className:c("size-5 shrink-0 rounded-md flex items-center justify-center border transition-colors",P?"border-primary bg-primary text-white":"border-border-strong bg-white hover:border-text-subtle"),children:P&&e.jsx("svg",{"aria-hidden":"true",className:"size-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}),e.jsx("span",{className:"truncate",children:N.label})]}),m&&typeof N.count<"u"&&e.jsx("span",{className:c("shrink-0 rounded px-1.5 py-0.5 text-xs font-medium leading-none",P?"bg-primary text-white":"bg-surface text-text-muted"),children:N.count})]},N.value)})})]})]})}ut.displayName="GymatraFilterSelect";function on({className:t="size-4"}){return e.jsxs("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("path",{d:"m21 21-4.35-4.35"})]})}function cr({className:t="size-3"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})}function ln({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function cn({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})})}function dr({value:t,onChange:r,onClear:s,placeholder:n="Search...",borderless:a=!0,className:o,...i}){const l=!!(t&&String(t).length>0);return e.jsxs("div",{className:c("relative flex items-center shrink-0",a?"w-[180px] min-w-[140px] max-w-[220px]":"w-60",o),children:[e.jsx("span",{className:"pointer-events-none absolute left-0.5 flex items-center text-text-subtle","aria-hidden":"true",children:e.jsx(on,{className:"size-4"})}),e.jsx("input",{type:"search",value:t,onChange:r,placeholder:n,className:c("w-full h-9 bg-transparent text-sm text-text placeholder:text-sm placeholder:text-text-subtle",a?"border-0 ring-0 outline-none shadow-none pl-6 pr-5 focus:border-0 focus:ring-0 focus:outline-none focus:shadow-none active:border-0 active:ring-0 active:outline-none":"rounded-md border border-border pl-8 pr-6 focus:border-primary focus:outline-2 focus:outline-primary/30"),...i}),l&&s&&e.jsx("button",{type:"button",onClick:s,"aria-label":"Clear search",className:"absolute right-0.5 flex size-5 items-center justify-center text-text-subtle hover:text-text cursor-pointer transition-colors",children:e.jsx(cr,{className:"size-3.5"})})]})}function dn({label:t,options:r,value:s,defaultValue:n,onChange:a,className:o,...i}){return e.jsxs("div",{className:c("relative inline-flex items-center",o),children:[e.jsx("select",{value:s,defaultValue:n,onChange:a,"aria-label":t,className:"h-8.5 rounded-md border border-border bg-surface pl-2.5 pr-7 text-sm text-text outline-none hover:border-border-strong focus-visible:border-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary cursor-pointer appearance-none transition-colors",...i,children:r.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))}),e.jsx("span",{className:"pointer-events-none absolute right-2 text-text-subtle flex items-center","aria-hidden":"true",children:e.jsx(ln,{})})]})}function ur({label:t,valueLabel:r,onRemove:s,className:n}){return e.jsxs("span",{className:c("inline-flex h-6 items-center gap-1.5 rounded border border-border bg-surface px-2 text-xs text-text",n),children:[e.jsxs("span",{className:"text-text-muted",children:[t,":"]}),e.jsx("span",{className:"font-medium text-text",children:r}),e.jsx("button",{type:"button",onClick:s,"aria-label":`Remove filter ${t}: ${r}`,className:"inline-flex size-3.5 items-center justify-center rounded-full text-text-muted hover:text-text cursor-pointer transition-colors",children:e.jsx(cr,{})})]})}function xr({searchValue:t,onSearchChange:r,searchPlaceholder:s="Search...",searchBorderless:n=!0,totalCount:a,countLabel:o="Results",actions:i,filters:l=[],activeFilters:m=[],onResetFilters:u,isFiltersOpen:d,defaultFiltersOpen:h=!1,onToggleFilters:b,filterButtonLabel:p="Filters",bottomContent:x,className:y,children:g,...j}){const[k,v]=f.useState(h),w=d??k;function C(){const z=!w;typeof d>"u"&&v(z),b==null||b(z)}const T=typeof t<"u"||typeof r<"u";l.length>0||m.length>0;const S=m.length;return e.jsxs("div",{className:c("flex flex-col w-full",y),...j,children:[e.jsxs("div",{className:"flex flex-wrap items-center min-h-12 py-1.5 ps-3.5 pe-1.5 gap-3 rounded-lg border border-border bg-surface",children:[T&&e.jsx(dr,{value:t,onChange:z=>r==null?void 0:r(z.target.value),onClear:()=>r==null?void 0:r(""),placeholder:s,borderless:n}),T&&typeof a<"u"&&e.jsx("span",{className:"h-5 w-px shrink-0 bg-border","aria-hidden":"true"}),typeof a<"u"&&e.jsxs("div",{className:"inline-flex items-center gap-1.5 whitespace-nowrap text-sm text-text-muted",children:[e.jsx("span",{className:"font-medium text-text",children:a}),e.jsx("span",{children:o})]}),g,e.jsxs("div",{className:"ms-auto flex flex-wrap items-center gap-2.5",children:[l.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"h-5 w-px shrink-0 bg-border","aria-hidden":"true"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.map(z=>e.jsx(ut,{label:z.label,options:z.options,multiple:z.multiple,value:z.value,defaultValue:z.defaultValue,onChange:z.onChange},z.id)),u&&(m.length>0||!!t)&&e.jsx("button",{type:"button",onClick:u,className:"rounded px-1.5 py-0.5 text-xs font-medium text-primary hover:underline cursor-pointer transition-opacity",children:"Reset"})]})]}),i,x&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"h-5 w-px shrink-0 bg-border","aria-hidden":"true"}),e.jsxs("button",{type:"button",onClick:C,"aria-expanded":w,"aria-label":`${w?"Hide":"Show"} filters`,title:p,"data-active":w||S>0,className:"relative inline-flex size-8 shrink-0 items-center justify-center rounded-md border-0 bg-transparent text-text hover:bg-surface-muted hover:text-primary cursor-pointer transition-colors outline-none focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary data-[active=true]:bg-primary-soft data-[active=true]:text-primary",children:[e.jsx(cn,{}),S>0&&e.jsx("span",{className:"absolute -top-1 -right-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-xs font-medium leading-none text-white",children:S})]})]})]})]}),m.length>0&&e.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-1.5 px-1","aria-label":"Applied filters",children:m.map(z=>e.jsx(ur,{label:z.label,valueLabel:z.valueLabel,onRemove:z.onRemove},z.id))}),w&&x&&e.jsx("div",{className:"mt-2.5 flex flex-col gap-3 rounded-lg border border-border bg-surface p-3.5 transition-all",children:x})]})}xr.displayName="GymatraFilterBar";function D({label:t,error:r,helperText:s,required:n,disabled:a,focused:o,startAdornment:i,endAdornment:l,className:m,wrapperClassName:u,children:d,...h}){const b=!!r;return e.jsxs("div",{className:c("relative w-full pt-2.5 pb-1",a&&"opacity-60 pointer-events-none",u),...h,children:[e.jsxs("div",{className:c("group relative flex items-center w-full min-h-11 rounded-md border bg-white transition-all",b?"border-danger focus-within:border-danger focus-within:ring-1 focus-within:ring-danger":o?"border-primary ring-1 ring-primary":"border-border hover:border-text-subtle focus-within:border-primary focus-within:ring-1 focus-within:ring-primary",m),children:[t&&e.jsxs("label",{className:c("pointer-events-none absolute -top-3 start-3 z-10 px-1.5 bg-white text-sm leading-none font-medium transition-colors select-none",b?"text-danger":o?"text-primary":"text-text-muted group-focus-within:text-primary group-hover:text-text"),children:[t,n&&e.jsx("span",{className:"ms-0.5 text-danger","aria-hidden":"true",children:"*"})]}),i&&e.jsx("div",{className:"flex shrink-0 items-center ps-3 text-text-muted select-none",children:i}),e.jsx("div",{className:"flex-1 min-w-0 flex items-center",children:d}),l&&e.jsx("div",{className:"flex shrink-0 items-center pe-3 text-text-muted select-none",children:l})]}),(r||s)&&e.jsxs("p",{className:c("mt-2 text-xs flex items-center gap-1 ps-1",b?"text-danger font-medium":"text-text-muted"),children:[b&&e.jsxs("svg",{className:"size-3.5 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),e.jsx("span",{children:r||s})]})]})}const he=f.forwardRef(({label:t,error:r,helperText:s,startIcon:n,endIcon:a,prefixText:o,suffixText:i,type:l="text",placeholder:m,disabled:u,required:d,className:h,wrapperClassName:b,...p},x)=>{const y=!!(n||o),g=!!(i||a);return e.jsx(D,{label:t,error:r,helperText:s,required:d,disabled:u,wrapperClassName:b,startAdornment:y?e.jsxs("div",{className:"flex items-center gap-1.5 text-text-muted text-sm",children:[n,o&&e.jsx("span",{className:"font-medium text-text select-none",children:o})]}):void 0,endAdornment:g?e.jsxs("div",{className:"flex items-center gap-1.5 text-text-muted text-sm",children:[i&&e.jsx("span",{className:"font-medium text-text select-none",children:i}),a]}):void 0,children:e.jsx("input",{ref:x,type:l,disabled:u,placeholder:m||(typeof t=="string"?t:void 0),className:c("w-full h-11 bg-transparent text-sm text-text placeholder:text-text-subtle/80 outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0",y?"ps-2.5":"ps-3.5",g?"pe-2.5":"pe-3.5","disabled:cursor-not-allowed",h),...p})})});he.displayName="GymatraTextInput";const mr=f.forwardRef(({label:t="Email",startIcon:r,...s},n)=>{const a=e.jsxs("svg",{className:"size-4 text-text-subtle",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]});return e.jsx(he,{ref:n,type:"email",label:t,startIcon:r??a,autoComplete:"email",...s})});mr.displayName="GymatraEmailInput";const pr=f.forwardRef(({label:t="Mot de passe",startIcon:r,...s},n)=>{const[a,o]=f.useState(!1),i=e.jsxs("svg",{className:"size-4 text-text-subtle",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]});return e.jsx(he,{ref:n,type:a?"text":"password",label:t,startIcon:r??i,autoComplete:"current-password",endIcon:e.jsx("button",{type:"button",tabIndex:-1,onClick:()=>o(!a),className:"text-text-muted hover:text-text cursor-pointer transition-colors p-1","aria-label":a?"Masquer":"Afficher",children:a?e.jsxs("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),e.jsx("line",{x1:"1",y1:"23",x2:"23",y2:"1"})]}):e.jsxs("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),...s})});pr.displayName="GymatraPasswordInput";const fr=f.forwardRef(({label:t="Rechercher",startIcon:r,value:s,onChange:n,onClear:a,...o},i)=>{const[l,m]=f.useState(""),u=s!==void 0,d=u?String(s):l,h=e.jsxs("svg",{className:"size-4 text-text-subtle",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),b=()=>{u||m(""),a==null||a()};return e.jsx(he,{ref:i,type:"search",label:t,value:s,onChange:p=>{u||m(p.target.value),n==null||n(p)},startIcon:r??h,endIcon:d?e.jsx("button",{type:"button",onClick:b,className:"text-text-muted hover:text-text cursor-pointer p-0.5 rounded-full hover:bg-surface-muted transition-colors","aria-label":"Effacer",children:e.jsxs("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):void 0,...o})});fr.displayName="GymatraSearchInput";const Lt=["MA","DZ","TN","FR","ES","BE","CA","US","GB","SA","AE","QA","TR"],Rt={MA:"Maroc",DZ:"Algérie",TN:"Tunisie",FR:"France",ES:"Espagne",BE:"Belgique",CA:"Canada",US:"États-Unis",GB:"Royaume-Uni",SA:"Arabie Saoudite",AE:"Émirats Arabes Unis",QA:"Qatar",TR:"Turquie",IT:"Italie",DE:"Allemagne",CH:"Suisse",NL:"Pays-Bas",PT:"Portugal",EG:"Égypte",SN:"Sénégal",CI:"Côte d'Ivoire"},hr=({name:t,label:r="Téléphone",error:s,helperText:n,value:a,defaultValue:o,onChange:i,onBlur:l,defaultCountry:m="MA",disabled:u,required:d,autoValidate:h=!1,invalidErrorMessage:b,placeholder:p,className:x,wrapperClassName:y})=>{const[g,j]=f.useState(m),[k,v]=f.useState(o),[w,C]=f.useState(!1),[T,S]=f.useState(""),z=f.useRef(null),N=f.useRef(null),P=a!==void 0?a:k,E=B=>{a===void 0&&v(B),i==null||i(B)},R=St[g],O=g?ae.getCountryCallingCode(g):"212",re=!!(h&&P&&P.trim().length>3&&!ae.isValidPhoneNumber(P)),M=s||(re?b||"Numéro de téléphone invalide pour ce pays":void 0),H=f.useMemo(()=>{const $=ae.getCountries().filter(K=>!Lt.includes(K));return[...Lt,...$]},[]),oe=f.useMemo(()=>{if(!T.trim())return H;const B=T.toLowerCase().trim();return H.filter($=>{const K=(zt[$]||Rt[$]||$).toLowerCase(),q=ae.getCountryCallingCode($);return K.includes(B)||q.includes(B)||$.toLowerCase().includes(B)})},[H,T]);return f.useEffect(()=>{const B=$=>{z.current&&!z.current.contains($.target)&&C(!1)};return w&&(document.addEventListener("mousedown",B),setTimeout(()=>{var $;return($=N.current)==null?void 0:$.focus()},50)),()=>document.removeEventListener("mousedown",B)},[w]),e.jsxs("div",{ref:z,className:"relative w-full",children:[e.jsx(D,{label:r,error:M,helperText:n,required:d,disabled:u,focused:w,wrapperClassName:y,className:x,startAdornment:e.jsxs("div",{className:"relative flex items-center pe-1 self-stretch",children:[e.jsxs("button",{type:"button",disabled:u,onClick:()=>{u||(C(!w),S(""))},className:"flex items-center gap-1.5 py-1 px-1 -ms-1 rounded hover:bg-surface-muted transition-colors cursor-pointer select-none text-sm text-text outline-none focus-visible:ring-1 focus-visible:ring-primary","aria-expanded":w,"aria-label":"Sélectionner le pays",children:[e.jsx("span",{className:"flex items-center justify-center w-5 h-3.5 rounded-xs overflow-hidden border border-border/80 shrink-0 bg-surface-muted [&>svg]:size-full [&>svg]:object-cover",children:R?e.jsx(R,{title:g}):e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-muted","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}),e.jsx("svg",{className:c("size-3 text-text-subtle shrink-0 transition-transform duration-200",w&&"rotate-180"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),e.jsxs("span",{className:"font-medium text-text text-sm ms-0.5",children:["+",O]})]}),e.jsx("span",{className:"h-4 w-px bg-border ms-1.5 me-1 shrink-0","aria-hidden":"true"})]}),children:e.jsx(Kr,{name:t,country:g,value:P,onChange:E,onBlur:l,disabled:u,placeholder:p||(g==="MA"?"06 55 12 34 56":"Numéro de téléphone"),className:c("w-full h-11 ps-1 pe-3.5 bg-transparent text-sm text-text placeholder:text-text-subtle/80 outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0","disabled:cursor-not-allowed",x)})}),w&&e.jsxs("div",{className:"absolute top-[calc(100%+6px)] start-0 z-50 w-72 rounded-lg border border-border bg-white p-2 shadow-none max-h-72 flex flex-col",children:[e.jsxs("div",{className:"relative mb-2 shrink-0",children:[e.jsx("div",{className:"absolute inset-y-0 start-2.5 flex items-center pointer-events-none text-text-subtle",children:e.jsxs("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}),e.jsx("input",{ref:N,type:"text",value:T,onChange:B=>S(B.target.value),placeholder:"Rechercher pays ou indicatif...",className:"w-full h-8 ps-8 pe-2.5 bg-surface-muted rounded text-sm text-text placeholder:text-text-subtle outline-none border border-border focus:border-primary focus:bg-white transition-colors"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto space-y-0.5 pe-1",children:oe.length===0?e.jsx("div",{className:"px-3 py-4 text-sm text-center text-text-muted",children:"Aucun pays trouvé"}):oe.map(B=>{const $=St[B],K=ae.getCountryCallingCode(B),q=zt[B]||Rt[B]||B,Z=B===g;return e.jsxs("button",{type:"button",onClick:()=>{j(B),C(!1),S("")},className:c("w-full flex items-center justify-between px-2.5 py-1.5 rounded text-sm transition-colors cursor-pointer text-start",Z?"bg-primary-soft text-primary font-medium":"text-text hover:bg-surface-muted"),children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"flex items-center justify-center w-5 h-3.5 rounded-xs overflow-hidden border border-border/80 shrink-0 bg-surface-muted [&>svg]:size-full [&>svg]:object-cover",children:$?e.jsx($,{title:q}):e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-muted","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}),e.jsx("span",{className:"truncate",children:q})]}),e.jsxs("span",{className:c("text-xs shrink-0 ms-2 font-medium",Z?"text-primary":"text-text-muted"),children:["+",K]})]},B)})})]})]})};hr.displayName="GymatraPhoneInput";const br=f.forwardRef(({label:t="Site web",prefixText:r="https://",...s},n)=>{const a=e.jsxs("svg",{className:"size-4 text-text-subtle",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),e.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]});return e.jsx(he,{ref:n,type:"url",label:t,startIcon:a,prefixText:r,placeholder:"example.com",...s})});br.displayName="GymatraUrlInput";const Pe=f.forwardRef(({label:t="Nombre",error:r,helperText:s,step:n=1,min:a,max:o,showSteppers:i=!0,prefixText:l,suffixText:m,disabled:u,required:d,className:h,value:b,defaultValue:p,onChange:x,...y},g)=>{const j=f.useRef(null),k=v=>{const w=j.current;!w||u||(v==="up"?w.stepUp():w.stepDown(),w.dispatchEvent(new Event("change",{bubbles:!0})))};return e.jsx(D,{label:t,error:r,helperText:s,required:d,disabled:u,startAdornment:l?e.jsx("span",{className:"text-xs text-text-muted font-medium select-none",children:l}):void 0,endAdornment:i?e.jsxs("div",{className:"flex flex-col border-s border-border -me-1 self-stretch my-0.5 justify-center",children:[e.jsx("button",{type:"button",tabIndex:-1,disabled:u,onClick:()=>k("up"),className:"px-1.5 py-0 text-text-muted hover:text-text hover:bg-surface-muted transition-colors cursor-pointer flex-1 flex items-center justify-center","aria-label":"Augmenter",children:e.jsx("svg",{className:"size-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("polyline",{points:"18 15 12 9 6 15"})})}),e.jsx("button",{type:"button",tabIndex:-1,disabled:u,onClick:()=>k("down"),className:"px-1.5 py-0 text-text-muted hover:text-text hover:bg-surface-muted transition-colors cursor-pointer border-t border-border flex-1 flex items-center justify-center","aria-label":"Diminuer",children:e.jsx("svg",{className:"size-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}):m?e.jsx("span",{className:"text-xs text-text-muted font-medium select-none",children:m}):void 0,children:e.jsx("input",{ref:v=>{j.current=v,typeof g=="function"?g(v):g&&(g.current=v)},type:"number",step:n,min:a,max:o,disabled:u,value:b,defaultValue:p,onChange:x,className:c("w-full h-11 bg-transparent text-sm text-text placeholder:text-text-subtle outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",l?"ps-2.5":"ps-3.5",i||m?"pe-2.5":"pe-3.5",h),...y})})});Pe.displayName="GymatraNumberInput";const un=Pe,yr=f.forwardRef(({label:t="Montant",currency:r="DH",currencyPosition:s="end",step:n=.01,min:a=0,placeholder:o="0.00",...i},l)=>{const m=s==="start";return e.jsx(Pe,{ref:l,label:t,step:n,min:a,placeholder:o,showSteppers:!1,prefixText:m?r:void 0,suffixText:m?void 0:r,...i})});yr.displayName="GymatraCurrencyInput";const gr=f.forwardRef(({label:t="Pourcentage",min:r=0,max:s=100,step:n=1,placeholder:a="0",...o},i)=>e.jsx(Pe,{ref:i,label:t,min:r,max:s,step:n,placeholder:a,showSteppers:!1,suffixText:"%",...o}));gr.displayName="GymatraPercentageInput";const jr=f.forwardRef(({label:t="Date",error:r,helperText:s,required:n,disabled:a,className:o,...i},l)=>e.jsx(D,{label:t,error:r,helperText:s,required:n,disabled:a,endAdornment:e.jsxs("svg",{className:"size-4 text-text-subtle pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),children:e.jsx("input",{ref:l,type:"date",disabled:a,className:c("w-full h-11 px-3 bg-transparent text-sm text-text outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0 [color-scheme:light]",o),...i})}));jr.displayName="GymatraDateInput";const vr=f.forwardRef(({label:t="Heure",error:r,helperText:s,required:n,disabled:a,className:o,...i},l)=>e.jsx(D,{label:t,error:r,helperText:s,required:n,disabled:a,endAdornment:e.jsxs("svg",{className:"size-4 text-text-subtle pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),children:e.jsx("input",{ref:l,type:"time",disabled:a,className:c("w-full h-11 px-3 bg-transparent text-sm text-text outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0 [color-scheme:light]",o),...i})}));vr.displayName="GymatraTimeInput";const wr=f.forwardRef(({label:t="Date & Heure",error:r,helperText:s,required:n,disabled:a,className:o,...i},l)=>e.jsx(D,{label:t,error:r,helperText:s,required:n,disabled:a,endAdornment:e.jsxs("svg",{className:"size-4 text-text-subtle pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),children:e.jsx("input",{ref:l,type:"datetime-local",disabled:a,className:c("w-full h-11 px-3 bg-transparent text-sm text-text outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0 [color-scheme:light]",o),...i})}));wr.displayName="GymatraDateTimeInput";function xn({label:t="Période (Début - Fin)",startDate:r,endDate:s,onStartDateChange:n,onEndDateChange:a,error:o,helperText:i,disabled:l,required:m,className:u}){return e.jsx(D,{label:t,error:o,helperText:i,required:m,disabled:l,className:u,endAdornment:e.jsxs("svg",{className:"size-4 text-text-subtle pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),children:e.jsxs("div",{className:"flex items-center w-full px-2",children:[e.jsx("input",{type:"date",value:r,disabled:l,onChange:d=>n==null?void 0:n(d.target.value),className:"flex-1 h-11 bg-transparent text-sm text-text outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0 [color-scheme:light]"}),e.jsx("span",{className:"px-2 text-text-muted select-none",children:"→"}),e.jsx("input",{type:"date",value:s,disabled:l,onChange:d=>a==null?void 0:a(d.target.value),className:"flex-1 h-11 bg-transparent text-sm text-text outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0 [color-scheme:light]"})]})})}function mn({name:t,label:r="Sélection",options:s,value:n,defaultValue:a,onChange:o,onBlur:i,placeholder:l="Sélectionner une option...",searchable:m=!1,searchPlaceholder:u="Rechercher...",clearable:d=!1,error:h,helperText:b,required:p,disabled:x,className:y,wrapperClassName:g}){const[j,k]=f.useState(a),[v,w]=f.useState(!1),[C,T]=f.useState(""),S=f.useRef(null),z=f.useRef(null),N=n!==void 0,P=N?n:j,E=s.find(M=>M.value===P);f.useEffect(()=>{const M=H=>{S.current&&!S.current.contains(H.target)&&w(!1)};if(v)return document.addEventListener("mousedown",M),()=>document.removeEventListener("mousedown",M)},[v]),f.useEffect(()=>{v&&m&&z.current&&z.current.focus(),v||T("")},[v,m]);const R=C.trim()?s.filter(M=>M.label.toLowerCase().includes(C.toLowerCase())||M.description&&M.description.toLowerCase().includes(C.toLowerCase())):s,O=M=>{M.disabled||(N||k(M.value),o==null||o(M.value),w(!1))},re=M=>{M.stopPropagation(),N||k(void 0),o==null||o(void 0)};return e.jsxs("div",{ref:S,className:c("relative w-full",g),children:[t&&e.jsx("input",{type:"hidden",name:t,value:P!==void 0?String(P):""}),e.jsx(D,{label:r,error:h,helperText:b,required:p,disabled:x,focused:v,endAdornment:e.jsxs("div",{className:"flex items-center gap-1",children:[d&&P!==void 0&&!x&&e.jsx("button",{type:"button",tabIndex:-1,onClick:re,className:"size-5 flex items-center justify-center rounded text-text-subtle hover:text-text hover:bg-surface-muted transition-colors cursor-pointer",title:"Effacer",children:e.jsxs("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),e.jsx("svg",{className:c("size-4 text-text-subtle transition-transform duration-200 pointer-events-none",v&&"rotate-180"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),children:e.jsx("button",{type:"button",disabled:x,onClick:()=>w(M=>!M),onBlur:i,className:c("w-full h-11 px-3.5 flex items-center justify-start text-start bg-transparent text-sm outline-none cursor-pointer border-0 ring-0",x&&"cursor-not-allowed text-text-subtle",y),children:E?e.jsxs("span",{className:"flex items-center gap-2 truncate text-text font-normal",children:[E.icon&&e.jsx("span",{className:"shrink-0 text-text-muted",children:E.icon}),e.jsx("span",{className:"truncate",children:E.label})]}):e.jsx("span",{className:"text-text-subtle/80 truncate",children:l})})}),v&&e.jsxs("div",{className:"absolute top-[calc(100%+4px)] start-0 z-50 w-full rounded-lg border border-border bg-white p-1.5 shadow-none max-h-72 overflow-y-auto animate-in fade-in-50 zoom-in-95",children:[m&&e.jsx("div",{className:"p-1 pb-1.5 border-b border-border mb-1",children:e.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 bg-surface-muted rounded-md text-xs",children:[e.jsxs("svg",{className:"size-3.5 text-text-subtle shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{ref:z,type:"text",value:C,onChange:M=>T(M.target.value),placeholder:u,className:"w-full bg-transparent text-text outline-none placeholder:text-text-subtle text-sm"}),C&&e.jsx("button",{type:"button",onClick:()=>T(""),className:"size-3.5 text-text-subtle hover:text-text cursor-pointer",children:"×"})]})}),e.jsx("div",{className:"space-y-0.5",children:R.length===0?e.jsx("div",{className:"py-4 text-center text-sm text-text-muted",children:"Aucun résultat trouvé"}):R.map(M=>{const H=M.value===P;return e.jsxs("button",{type:"button",disabled:M.disabled,onClick:()=>O(M),className:c("w-full flex items-center justify-between gap-2 px-3 py-2 rounded-md text-sm text-start transition-colors cursor-pointer",H?"bg-primary-soft text-primary font-medium":"text-text hover:bg-surface-muted",M.disabled&&"opacity-40 cursor-not-allowed hover:bg-transparent"),children:[e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[M.icon&&e.jsx("span",{className:"shrink-0 text-text-muted",children:M.icon}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate font-medium",children:M.label}),M.description&&e.jsx("div",{className:"text-xs text-text-muted truncate mt-0.5",children:M.description})]})]}),H&&e.jsx("svg",{className:"size-4 text-primary shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})]},String(M.value))})})]})]})}const Nr=f.forwardRef(({label:t="Sélection",options:r,error:s,helperText:n,placeholder:a="Choisir...",disabled:o,required:i,className:l,children:m,...u},d)=>e.jsx(D,{label:t,error:s,helperText:n,required:i,disabled:o,endAdornment:e.jsx("svg",{className:"size-4 text-text-subtle pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),children:e.jsxs("select",{ref:d,disabled:o,className:c("w-full h-11 ps-3.5 pe-8 bg-transparent text-sm text-text outline-none appearance-none cursor-pointer border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0",l),...u,children:[a&&e.jsx("option",{value:"",children:a}),r.map(h=>e.jsx("option",{value:h.value,children:h.label},h.value)),m]})}));Nr.displayName="GymatraSelectField";function pn({label:t="Sélection multiple",options:r,value:s=[],onChange:n,error:a,helperText:o,placeholder:i="Sélectionner...",disabled:l,required:m}){const[u,d]=f.useState(!1),h=f.useRef(null);f.useEffect(()=>{const x=y=>{h.current&&!h.current.contains(y.target)&&d(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[]);const b=x=>{s.includes(x)?n==null||n(s.filter(y=>y!==x)):n==null||n([...s,x])},p=r.filter(x=>s.includes(x.value));return e.jsxs("div",{ref:h,className:"relative w-full",children:[e.jsx(D,{label:t,error:a,helperText:o,required:m,disabled:l,focused:u,endAdornment:e.jsx("svg",{className:c("size-4 text-text-subtle transition-transform",u&&"rotate-180"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),children:e.jsx("button",{type:"button",disabled:l,onClick:()=>d(!u),className:"w-full min-h-11 py-2 px-3.5 flex flex-wrap items-center gap-1.5 text-left text-sm text-text outline-none cursor-pointer",children:p.length===0?e.jsx("span",{className:"text-text-subtle",children:i}):p.map(x=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-surface-muted px-2 py-0.5 text-xs font-medium text-text border border-border",children:[x.label,e.jsx("span",{role:"button",tabIndex:0,onClick:y=>{y.stopPropagation(),b(x.value)},className:"text-text-muted hover:text-text cursor-pointer",children:"×"})]},x.value))})}),u&&e.jsx("div",{className:"absolute top-[calc(100%+4px)] start-0 z-50 w-full rounded-md border border-border bg-white p-1.5 shadow-none max-h-56 overflow-y-auto",children:r.map(x=>{const y=s.includes(x.value);return e.jsxs("div",{onClick:()=>b(x.value),className:c("flex items-center justify-between px-2.5 py-1.5 rounded text-sm cursor-pointer transition-colors",y?"bg-primary-soft text-primary font-medium":"text-text hover:bg-surface-muted"),children:[e.jsx("span",{children:x.label}),y&&e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4 text-primary","aria-hidden":"true",children:e.jsx("path",{d:"M20 6 9 17l-5-5"})})]},x.value)})})]})}function fn({label:t="Autocomplétion",suggestions:r,value:s="",onChange:n,placeholder:a="Commencez à taper...",error:o,helperText:i}){const[l,m]=f.useState(!1),[u,d]=f.useState(s),h=f.useRef(null),b=s!==void 0?s:u,p=r.filter(x=>x.toLowerCase().includes(b.toLowerCase())&&x.toLowerCase()!==b.toLowerCase());return f.useEffect(()=>{const x=y=>{h.current&&!h.current.contains(y.target)&&m(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[]),e.jsxs("div",{ref:h,className:"relative w-full",children:[e.jsx(D,{label:t,error:o,helperText:i,focused:l&&p.length>0,children:e.jsx("input",{type:"text",value:b,placeholder:a,onFocus:()=>m(!0),onChange:x=>{const y=x.target.value;d(y),n==null||n(y),m(!0)},className:"w-full h-11 px-3.5 bg-transparent text-sm text-text placeholder:text-text-subtle outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0"})}),l&&p.length>0&&e.jsx("div",{className:"absolute top-[calc(100%+4px)] start-0 z-50 w-full rounded-md border border-border bg-white p-1 shadow-none max-h-48 overflow-y-auto",children:p.map((x,y)=>e.jsx("div",{onClick:()=>{d(x),n==null||n(x),m(!1)},className:"px-3 py-2 rounded text-sm text-text hover:bg-surface-muted cursor-pointer transition-colors",children:x},y))})]})}const hn=ke.Switch.Root,bn=ke.Switch.Thumb;function yn(t="md"){switch(t){case"sm":return{track:"h-5 w-9 p-0.5",thumb:"size-4 data-[checked]:translate-x-4 rtl:data-[checked]:-translate-x-4"};case"lg":return{track:"h-7 w-13 p-0.5",thumb:"size-6 data-[checked]:translate-x-6 rtl:data-[checked]:-translate-x-6"};case"md":default:return{track:"h-6 w-11 p-0.5",thumb:"size-5 data-[checked]:translate-x-5 rtl:data-[checked]:-translate-x-5"}}}function gn(t="primary"){switch(t){case"success":return"data-[checked]:bg-success focus-visible:outline-success";case"danger":return"data-[checked]:bg-danger focus-visible:outline-danger";case"warning":return"data-[checked]:bg-warning focus-visible:outline-warning";case"primary":default:return"data-[checked]:bg-primary focus-visible:outline-primary"}}const xt=f.forwardRef(({size:t="md",variant:r="primary",label:s,description:n,labelPosition:a="right",onCheckedChange:o,onChange:i,disabled:l=!1,className:m,wrapperClassName:u,...d},h)=>{const b=yn(t),p=gn(r),x=(g,j)=>{o==null||o(g,j),i==null||i(g)},y=e.jsx(ke.Switch.Root,{ref:h,disabled:l,onCheckedChange:x,className:c("relative inline-flex shrink-0 cursor-pointer items-center rounded-full border-0 bg-text-subtle transition-colors duration-200 outline-none select-none shadow-none motion-reduce:transition-none","focus-visible:outline-2 focus-visible:outline-offset-2","data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",b.track,p,m),...d,children:e.jsx(ke.Switch.Thumb,{className:c("pointer-events-none block rounded-full bg-white transition-transform duration-200 shadow-none translate-x-0 motion-reduce:transition-none",b.thumb)})});return!s&&!n?y:a==="left"?e.jsxs("label",{className:c("flex cursor-pointer select-none items-center justify-between gap-4 w-full",l&&"cursor-not-allowed",u),children:[e.jsxs("span",{className:"flex min-w-0 flex-col",children:[s&&e.jsx("span",{className:c("text-sm font-medium leading-tight",l?"text-text-subtle":"text-text"),children:s}),n&&e.jsx("span",{className:"mt-0.5 text-xs leading-normal text-text-muted",children:n})]}),y]}):e.jsxs("label",{className:c("inline-flex cursor-pointer select-none items-center gap-3",l&&"cursor-not-allowed",u),children:[y,e.jsxs("span",{className:"flex min-w-0 flex-col",children:[s&&e.jsx("span",{className:c("text-sm font-medium leading-tight",l?"text-text-subtle":"text-text"),children:s}),n&&e.jsx("span",{className:"mt-0.5 text-xs leading-normal text-text-muted",children:n})]})]})});xt.displayName="GymatraSwitch";function jn({label:t,boxLabel:r,description:s,error:n,helperText:a,disabled:o,className:i,...l}){return e.jsx(D,{label:t,error:n,helperText:a,disabled:o,className:i,children:e.jsx(ot,{label:r,description:s,disabled:o,invalid:!!n,wrapperClassName:"flex w-full p-3",...l})})}function vn({label:t="Options",name:r,options:s,value:n,defaultValue:a,onChange:o,direction:i="horizontal",error:l,helperText:m,disabled:u}){return e.jsx(D,{label:t,error:l,helperText:m,disabled:u,children:e.jsx("div",{className:c("p-3 w-full flex flex-wrap gap-4",i==="vertical"&&"flex-col gap-2.5"),children:s.map(d=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[e.jsx("input",{type:"radio",name:r,value:d.value,checked:n!==void 0?n===d.value:void 0,defaultChecked:a===d.value,onChange:()=>o==null?void 0:o(d.value),disabled:u,className:"size-4 accent-primary"}),e.jsx("span",{className:"text-sm font-medium text-text",children:d.label})]},d.value))})})}function wn({label:t,switchLabel:r,description:s,checked:n,defaultChecked:a,onChange:o,error:i,helperText:l,disabled:m}){return e.jsx(D,{label:t,error:i,helperText:l,disabled:m,children:e.jsx(xt,{label:r,description:s,labelPosition:"left",checked:n,defaultChecked:a,onChange:o,disabled:m,"aria-invalid":i?!0:void 0,wrapperClassName:"p-3"})})}function Nn({label:t,options:r,value:s,onChange:n,error:a,helperText:o}){return e.jsx(D,{label:t,error:a,helperText:o,children:e.jsx("div",{className:"flex items-center p-1.5 w-full gap-1",children:r.map(i=>e.jsx("button",{type:"button",onClick:()=>n(i.value),className:c("flex-1 h-8 rounded text-sm font-medium transition-colors cursor-pointer",s===i.value?"bg-primary text-white shadow-none":"bg-surface-muted text-text-muted hover:bg-border/60 hover:text-text"),children:i.label},i.value))})})}const kr=f.forwardRef(({label:t="Description",error:r,helperText:s,required:n,disabled:a,className:o,placeholder:i,rows:l=3,...m},u)=>e.jsx(D,{label:t,error:r,helperText:s,required:n,disabled:a,children:e.jsx("textarea",{ref:u,rows:l,disabled:a,placeholder:i||(typeof t=="string"?t:void 0),className:c("w-full p-3 bg-transparent text-sm text-text placeholder:text-text-subtle/80 outline-none resize-none",o),...m})}));kr.displayName="GymatraTextareaField";function kn({label:t="Contenu enrichi",value:r,defaultValue:s="",onChange:n,placeholder:a="Rédigez votre texte...",error:o,helperText:i,disabled:l}){const[m,u]=f.useState(s),d=r!==void 0?r:m,h=b=>{const p=`${d} [${b}]`;r===void 0&&u(p),n==null||n(p)};return e.jsx(D,{label:t,error:o,helperText:i,disabled:l,children:e.jsxs("div",{className:"flex flex-col w-full",children:[e.jsxs("div",{className:"flex items-center gap-1 border-b border-border p-2 bg-surface-muted/50",children:[e.jsx("button",{type:"button",onClick:()=>h("b"),className:"size-7 rounded text-sm font-semibold text-text hover:bg-white transition-colors",title:"Gras",children:"B"}),e.jsx("button",{type:"button",onClick:()=>h("i"),className:"size-7 rounded text-sm italic font-serif text-text hover:bg-white transition-colors",title:"Italique",children:"I"}),e.jsx("button",{type:"button",onClick:()=>h("u"),className:"size-7 rounded text-sm underline text-text hover:bg-white transition-colors",title:"Souligné",children:"U"}),e.jsx("span",{className:"h-4 w-px bg-border mx-1"}),e.jsx("button",{type:"button",onClick:()=>h("ul"),className:"size-7 rounded text-sm text-text hover:bg-white transition-colors flex items-center justify-center",title:"Liste à puces",children:e.jsxs("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),e.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),e.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),e.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]})}),e.jsx("button",{type:"button",onClick:()=>h("link"),className:"size-7 rounded text-sm text-text hover:bg-white transition-colors flex items-center justify-center",title:"Lien",children:e.jsxs("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),e.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})})]}),e.jsx("textarea",{rows:4,value:d,disabled:l,placeholder:a,onChange:b=>{r===void 0&&u(b.target.value),n==null||n(b.target.value)},className:"w-full p-3 bg-transparent text-sm text-text placeholder:text-text-subtle/80 outline-none resize-none"})]})})}function Gn({label:t="Fichiers joints",accept:r,multiple:s=!1,onFilesSelected:n,error:a,helperText:o,disabled:i}){const[l,m]=f.useState([]),u=f.useId(),d=h=>{if(!h||h.length===0)return;const b=Array.from(h);m(b.map(p=>p.name)),n==null||n(b)};return e.jsx(D,{label:t,error:a,helperText:o,disabled:i,children:e.jsxs("div",{className:"flex flex-col w-full p-3.5",children:[e.jsx("input",{id:u,type:"file",accept:r,multiple:s,disabled:i,onChange:h=>d(h.target.files),className:"hidden"}),e.jsxs("label",{htmlFor:u,className:"flex flex-col items-center justify-center border-2 border-dashed border-border rounded-md p-4 bg-surface-muted/30 hover:bg-surface-muted cursor-pointer transition-colors text-center",children:[e.jsxs("svg",{className:"size-6 text-text-subtle mb-1.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"17 8 12 3 7 8"}),e.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),e.jsx("span",{className:"text-sm font-medium text-primary",children:"Cliquez pour parcourir"}),e.jsx("span",{className:"text-xs text-text-muted mt-0.5",children:"ou glissez-déposez vos fichiers ici"})]}),l.length>0&&e.jsx("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:l.map((h,b)=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-surface-muted px-2 py-0.5 text-xs text-text border border-border",children:["📄 ",h]},b))})]})})}function Cn({label:t="Téléverser une image",onImageSelected:r,error:s,helperText:n,disabled:a}){const[o,i]=f.useState(null),l=f.useId(),m=u=>{const d=u==null?void 0:u[0];d&&(i(URL.createObjectURL(d)),r==null||r(d))};return e.jsx(D,{label:t,error:s,helperText:n,disabled:a,children:e.jsxs("div",{className:"flex items-center justify-between w-full p-3.5 gap-3",children:[e.jsx("input",{id:l,type:"file",accept:"image/*",disabled:a,onChange:u=>m(u.target.files),className:"hidden"}),o?e.jsxs("div",{className:"flex items-center gap-3 w-full",children:[e.jsx("img",{src:o,alt:"Aperçu",className:"size-14 rounded-md object-cover border border-border shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("label",{htmlFor:l,className:"text-xs font-medium text-primary hover:underline cursor-pointer block",children:"Changer l'image"}),e.jsx("button",{type:"button",onClick:()=>i(null),className:"mt-1 text-xs text-danger hover:underline cursor-pointer",children:"Supprimer"})]})]}):e.jsxs("label",{htmlFor:l,className:"flex items-center gap-3 w-full cursor-pointer",children:[e.jsx("div",{className:"size-12 rounded-md bg-surface-muted border border-border flex items-center justify-center text-text-subtle shrink-0",children:e.jsxs("svg",{className:"size-6",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),e.jsx("polyline",{points:"21 15 16 10 5 21"})]})}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-text block",children:"Sélectionner une photo"}),e.jsx("span",{className:"text-xs text-text-muted",children:"PNG, JPG, WebP jusqu'à 5MB"})]})]})]})})}function Sn({label:t="Photo de profil",initialSrc:r,onAvatarChange:s,error:n,helperText:a,disabled:o}){const[i,l]=f.useState(r??null),m=f.useId(),u=d=>{const h=d==null?void 0:d[0];h&&(l(URL.createObjectURL(h)),s==null||s(h))};return e.jsx(D,{label:t,error:n,helperText:a,disabled:o,children:e.jsxs("div",{className:"flex items-center gap-3.5 w-full p-3.5",children:[e.jsx("input",{id:m,type:"file",accept:"image/*",disabled:o,onChange:d=>u(d.target.files),className:"hidden"}),e.jsx("div",{className:"size-12 rounded-full border border-border bg-surface-muted overflow-hidden flex items-center justify-center shrink-0",children:i?e.jsx("img",{src:i,alt:"Avatar",className:"size-full object-cover"}):e.jsx("svg",{className:"size-6 text-text-subtle",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:e.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"})})}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:m,className:"inline-flex h-8 items-center justify-center rounded-md border border-border bg-surface px-3 text-xs font-medium text-text hover:bg-surface-muted cursor-pointer transition-colors",children:"Téléverser une photo"}),e.jsx("span",{className:"text-xs text-text-muted block mt-0.5",children:"Format carré recommandé"})]})]})})}const zn=["#224086","#10B981","#EF4444","#F59E0B","#8B5CF6","#06B6D4","#1E293B"];function Gr({name:t,label:r="Couleur",value:s,defaultValue:n="#224086",onChange:a,onBlur:o,presets:i=zn,showPresets:l=!0,error:m,helperText:u,disabled:d,required:h,className:b,wrapperClassName:p}){const[x,y]=f.useState(n),g=s!==void 0?s:x,j=v=>{s===void 0&&y(v),a==null||a(v)},k=g.startsWith("#")?g.slice(1):g;return e.jsx(D,{label:r,error:m,helperText:u,required:h,disabled:d,wrapperClassName:p,className:b,startAdornment:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative size-6 rounded border border-border overflow-hidden cursor-pointer shrink-0 shadow-none hover:border-text-subtle transition-colors",children:[e.jsx("div",{className:"w-full h-full",style:{backgroundColor:g||"#224086"}}),e.jsx("input",{type:"color",value:g.startsWith("#")&&g.length===7?g:"#224086",disabled:d,onChange:v=>j(v.target.value.toUpperCase()),className:"absolute inset-0 opacity-0 w-full h-full cursor-pointer disabled:cursor-not-allowed","aria-label":"Choisir la couleur"})]}),e.jsx("span",{className:"text-text-muted font-mono text-sm select-none",children:"#"})]}),endAdornment:l&&i.length>0?e.jsx("div",{className:"flex items-center gap-1.5 pe-1",children:i.slice(0,7).map(v=>{const w=g.toLowerCase()===v.toLowerCase();return e.jsx("button",{type:"button",disabled:d,onClick:()=>j(v),className:c("size-4 rounded-full border transition-all cursor-pointer hover:scale-115 shrink-0",w?"ring-2 ring-primary ring-offset-1 border-white scale-110":"border-border/60 hover:border-text-subtle"),style:{backgroundColor:v},title:v,"aria-label":`Couleur ${v}`},v)})}):void 0,children:e.jsx("input",{name:t,type:"text",value:k.toUpperCase(),disabled:d,maxLength:6,onChange:v=>{const w=v.target.value.replace(/[^0-9A-Fa-f]/g,"");w.length<=6&&j(`#${w}`)},onBlur:o,placeholder:"224086",className:c("w-full h-11 ps-1 pe-2 bg-transparent text-sm font-mono text-text placeholder:text-text-subtle/80 uppercase outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0","disabled:cursor-not-allowed")})})}const Pn=Gr;function Mn({label:t="Intensité",min:r=0,max:s=100,step:n=1,value:a,defaultValue:o=50,unit:i="%",onChange:l,error:m,helperText:u,disabled:d}){const[h,b]=f.useState(o),p=a!==void 0?a:h;return e.jsx(D,{label:t,error:m,helperText:u,disabled:d,children:e.jsxs("div",{className:"flex items-center gap-3 w-full p-3",children:[e.jsx("input",{type:"range",min:r,max:s,step:n,value:p,disabled:d,onChange:x=>{const y=Number(x.target.value);a===void 0&&b(y),l==null||l(y)},className:"flex-1 accent-primary cursor-pointer"}),e.jsxs("span",{className:"min-w-10 text-right text-sm font-medium text-text font-mono tabular-nums",children:[p,i]})]})})}function In({label:t="Fourchette",min:r=0,max:s=1e3,minValue:n=100,maxValue:a=600,unit:o="€",onRangeChange:i,error:l,helperText:m}){const[u,d]=f.useState(n),[h,b]=f.useState(a);return e.jsx(D,{label:t,error:l,helperText:m,children:e.jsxs("div",{className:"flex items-center justify-between w-full p-3 gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Min:"}),e.jsx("input",{type:"number",min:r,max:h,value:u,onChange:p=>{const x=Number(p.target.value);d(x),i==null||i(x,h)},className:"w-full h-8 px-2 rounded border border-border text-sm text-text outline-none focus:border-primary"}),e.jsx("span",{className:"text-xs text-text-muted",children:o})]}),e.jsx("span",{className:"text-text-muted",children:"—"}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Max:"}),e.jsx("input",{type:"number",min:u,max:s,value:h,onChange:p=>{const x=Number(p.target.value);b(x),i==null||i(u,x)},className:"w-full h-8 px-2 rounded border border-border text-sm text-text outline-none focus:border-primary"}),e.jsx("span",{className:"text-xs text-text-muted",children:o})]})]})})}function Tn({label:t="Code de validation (OTP)",length:r=6,value:s,onChange:n,error:a,helperText:o,disabled:i}){const l=f.useId(),[m,u]=f.useState(""),d=s!==void 0?s:m,h=(p,x)=>{x.length>1&&(x=x.slice(-1));const y=d.padEnd(r," ").split("");y[p]=x||" ";const g=y.join("").trimEnd();if(s===void 0&&u(g),n==null||n(g),x&&p<r-1){const j=document.getElementById(`${l}-otp-${p+1}`);j==null||j.focus()}},b=(p,x)=>{if(x.key==="Backspace"&&!d[p]&&p>0){const y=document.getElementById(`${l}-otp-${p-1}`);y==null||y.focus()}};return e.jsx(D,{label:t,error:a,helperText:o,disabled:i,children:e.jsx("div",{className:"flex items-center justify-between w-full p-3 gap-2",children:Array.from({length:r}).map((p,x)=>e.jsx("input",{id:`${l}-otp-${x}`,"aria-label":`Chiffre ${x+1} sur ${r}`,type:"text",inputMode:"numeric",maxLength:1,disabled:i,value:d[x]&&d[x]!==" "?d[x]:"",onChange:y=>h(x,y.target.value),onKeyDown:y=>b(x,y),className:"size-10 rounded-md border border-border bg-surface-muted text-center text-base font-semibold text-text focus:border-primary focus:bg-white focus:outline-none"},x))})})}function Me({label:t,error:r,helperText:s,required:n,disabled:a,startAdornment:o,endAdornment:i,focused:l,hasValue:m,className:u,children:d,...h}){const b=!!r;return e.jsxs("div",{className:c("relative w-full pt-2.5 pb-1",a&&"opacity-60 pointer-events-none",u),...h,children:[e.jsxs("div",{className:c("group relative flex items-center w-full min-h-11 rounded-md border bg-white transition-all",b?"border-danger focus-within:border-danger focus-within:ring-1 focus-within:ring-danger":l?"border-primary ring-1 ring-primary":"border-border hover:border-text-subtle focus-within:border-primary focus-within:ring-1 focus-within:ring-primary"),children:[e.jsxs("label",{className:c("pointer-events-none absolute -top-3 start-3 z-10 px-1.5 bg-white text-sm leading-none font-medium transition-colors select-none",b?"text-danger":l?"text-primary":"text-text-muted group-focus-within:text-primary group-hover:text-text"),children:[t,n&&e.jsx("span",{className:"ms-0.5 text-danger",children:"*"})]}),o&&e.jsx("div",{className:"flex shrink-0 items-center ps-3 text-text-muted select-none",children:o}),e.jsx("div",{className:"flex-1 min-w-0 flex items-center",children:d}),i&&e.jsx("div",{className:"flex shrink-0 items-center pe-3 text-text-muted select-none",children:i})]}),(r||s)&&e.jsx("p",{className:c("mt-1 text-xs leading-none ps-1",b?"text-danger":"text-text-muted"),children:r||s})]})}const Cr=f.forwardRef(({label:t,error:r,helperText:s,startIcon:n,endIcon:a,prefixText:o,suffixText:i,type:l="text",value:m,defaultValue:u,onChange:d,disabled:h,required:b,className:p,placeholder:x,...y},g)=>{const[j,k]=f.useState(!1),[v,w]=f.useState(u??""),C=m!==void 0,T=l==="password",S=T?j?"text":"password":l;return e.jsx(Me,{label:t,error:r,helperText:s,required:b,disabled:h,className:p,startAdornment:n||o?e.jsxs("div",{className:"flex items-center gap-1.5 text-text-muted text-sm",children:[n,o&&e.jsx("span",{className:"font-medium text-text",children:o})]}):void 0,endAdornment:T?e.jsx("button",{type:"button",tabIndex:-1,onClick:()=>k(!j),className:"text-text-muted hover:text-text cursor-pointer transition-colors","aria-label":j?"Hide password":"Show password",children:j?e.jsxs("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),e.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):e.jsxs("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}):i||a?e.jsxs("div",{className:"flex items-center gap-1.5 text-text-muted text-sm",children:[i&&e.jsx("span",{className:"font-medium text-text",children:i}),a]}):void 0,children:e.jsx("input",{ref:g,type:S,value:m,defaultValue:u,onChange:z=>{C||w(z.target.value),d==null||d(z)},disabled:h,placeholder:x||(typeof t=="string"?t:void 0),className:c("w-full h-11 px-3.5 bg-transparent text-sm text-text placeholder:text-text-subtle/80 outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0","disabled:cursor-not-allowed"),...y})})});Cr.displayName="GymatraTextField";const Sr=f.forwardRef(({label:t,error:r,helperText:s,required:n,disabled:a,className:o,placeholder:i,rows:l=3,...m},u)=>e.jsx(Me,{label:t,error:r,helperText:s,required:n,disabled:a,className:o,children:e.jsx("textarea",{ref:u,rows:l,disabled:a,placeholder:i||(typeof t=="string"?t:void 0),className:"w-full p-3 bg-transparent text-sm text-text placeholder:text-text-subtle/80 outline-none resize-none",...m})}));Sr.displayName="GymatraFloatingTextarea";const zr=f.forwardRef(({label:t,error:r,helperText:s,required:n,disabled:a,options:o,className:i,children:l,...m},u)=>e.jsx(Me,{label:t,error:r,helperText:s,required:n,disabled:a,className:i,endAdornment:e.jsx("svg",{className:"size-4 text-text-subtle pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),children:e.jsxs("select",{ref:u,disabled:a,className:"w-full h-11 ps-3.5 pe-8 bg-transparent text-sm text-text outline-none appearance-none cursor-pointer border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0",...m,children:[o.map(d=>e.jsx("option",{value:d.value,children:d.label},d.value)),l]})}));zr.displayName="GymatraFloatingSelect";function Ln({length:t=6,value:r="",onChange:s,label:n="Code OTP / PIN",error:a,disabled:o}){const[i,l]=f.useState(r),m=r!==void 0?r:i,u=(h,b)=>{b.length>1&&(b=b.slice(-1));const p=m.padEnd(t," ").split("");p[h]=b||" ";const x=p.join("").trimEnd();if(r===void 0&&l(x),s==null||s(x),b&&h<t-1){const y=document.getElementById(`otp-digit-${h+1}`);y==null||y.focus()}},d=(h,b)=>{if(b.key==="Backspace"&&!m[h]&&h>0){const p=document.getElementById(`otp-digit-${h-1}`);p==null||p.focus()}};return e.jsx("div",{className:"relative",children:e.jsx(Me,{label:n,error:a,disabled:o,children:e.jsx("div",{className:"flex items-center justify-between w-full p-2.5 gap-2",children:Array.from({length:t}).map((h,b)=>e.jsx("input",{id:`otp-digit-${b}`,type:"text",inputMode:"numeric",maxLength:1,disabled:o,value:m[b]&&m[b]!==" "?m[b]:"",onChange:p=>u(b,p.target.value),onKeyDown:p=>d(b,p),className:"size-10 rounded-md border border-border bg-surface-muted text-center text-base font-semibold text-text focus:border-primary focus:bg-white focus:outline-none"},b))})})})}function Rn({label:t="Photo de profil",src:r,onChange:s,disabled:n}){const[a,o]=f.useState(r),i=f.useId(),l=m=>{var d;const u=(d=m.target.files)==null?void 0:d[0];if(u){const h=URL.createObjectURL(u);o(h),s==null||s(u)}};return e.jsxs("div",{className:"relative rounded-md border border-border p-3.5 bg-white",children:[e.jsx("label",{className:"absolute -top-2.5 start-2.5 px-1 bg-white text-xs font-medium text-text-muted",children:t}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"relative size-12 shrink-0 rounded-full border border-border overflow-hidden bg-surface-muted flex items-center justify-center text-text-muted",children:a?e.jsx("img",{src:a,alt:"Avatar preview",className:"size-full object-cover"}):e.jsx("svg",{className:"size-6",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:e.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"})})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("input",{id:i,type:"file",accept:"image/*",disabled:n,onChange:l,className:"hidden"}),e.jsx("label",{htmlFor:i,className:"inline-flex h-8 items-center justify-center rounded-md border border-border bg-surface px-3 text-xs font-medium text-text hover:bg-surface-muted cursor-pointer transition-colors",children:"Téléverser une image"}),e.jsx("p",{className:"mt-1 text-xs text-text-muted",children:"PNG, JPG jusqu'à 2MB"})]})]})]})}const Pr="grid min-w-0 gap-1.5 text-text",Mr="text-xs font-medium text-text-muted",Ir="ms-1 text-primary",Tr="text-xs text-text-muted",Ae="text-xs text-danger",mt="flex min-h-10 w-full items-center rounded-md border border-border bg-white px-3 text-sm text-text placeholder:text-text-subtle outline-none transition-colors hover:border-border-strong focus-visible:border-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary/30 aria-[invalid=true]:border-danger data-[invalid]:border-danger disabled:cursor-not-allowed disabled:bg-surface-muted disabled:text-text-subtle";function Bn({className:t,...r}){return e.jsx(Dt.Form,{...r,className:typeof t=="function"?s=>c("flex flex-col gap-6",t(s)):c("flex flex-col gap-6",t)})}function An({name:t,label:r,description:s,error:n,required:a,disabled:o,validate:i,validationMode:l,className:m,children:u}){return e.jsxs(V.Field.Root,{name:t,invalid:!!n,disabled:o,validate:i,validationMode:l,className:c(Pr,m),children:[e.jsxs(V.Field.Label,{className:Mr,children:[r,a&&e.jsx("span",{className:Ir,"aria-hidden":"true",children:"*"})]}),u,s&&e.jsx(V.Field.Description,{className:Tr,children:s}),n?e.jsx(V.Field.Error,{match:!0,className:Ae,children:n}):e.jsx(V.Field.Error,{match:"valueMissing",className:Ae,children:"This field is required."}),!n&&e.jsx(V.Field.Error,{match:"typeMismatch",className:Ae,children:"Enter a valid value."})]})}const Lr=f.forwardRef(({className:t,...r},s)=>e.jsx(V.Field.Control,{ref:s,render:e.jsx(Ft.Input,{}),...r,className:c(mt,t)}));Lr.displayName="GymatraInput";function Dn({rows:t=4,className:r,...s}){return e.jsx(V.Field.Control,{...s,render:e.jsx("textarea",{rows:t}),className:c(mt,"min-h-24 resize-y py-2.5",r)})}function Fn({name:t,label:r,description:s,error:n,options:a,value:o,defaultValue:i,onValueChange:l,placeholder:m="Choose an option",required:u,disabled:d,className:h}){const b=f.useId(),p=s?`${b}-description`:void 0,x=`${b}-error`;return e.jsxs(V.Field.Root,{name:t,invalid:!!n,disabled:d,className:c(Pr,h),children:[e.jsxs(V.Field.Label,{htmlFor:b,className:Mr,children:[r,u&&e.jsx("span",{className:Ir,"aria-hidden":"true",children:"*"})]}),e.jsxs(_.Select.Root,{name:t,id:b,items:a,value:o,defaultValue:i,onValueChange:l,required:u,disabled:d,children:[e.jsxs(_.Select.Trigger,{"aria-describedby":[p,x].filter(Boolean).join(" "),"aria-invalid":n?!0:void 0,className:c(mt,"cursor-pointer justify-between gap-3 text-start data-[popup-open]:border-primary"),children:[e.jsx(_.Select.Value,{placeholder:m}),e.jsx(_.Select.Icon,{"aria-hidden":"true",className:"flex text-text-muted",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})})]}),e.jsx(_.Select.Portal,{children:e.jsx(_.Select.Positioner,{sideOffset:4,className:"z-[10020] outline-none",children:e.jsx(_.Select.Popup,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-border bg-white p-1 text-text shadow-none outline-none",children:e.jsx(_.Select.List,{children:a.map(y=>e.jsxs(_.Select.Item,{value:y.value,className:"flex min-h-9 cursor-default items-center justify-between gap-2 rounded-sm px-2.5 text-sm text-text outline-none data-[highlighted]:bg-primary-soft data-[highlighted]:text-primary data-[selected]:font-semibold data-[selected]:text-primary",children:[e.jsx(_.Select.ItemText,{children:y.label}),e.jsx(_.Select.ItemIndicator,{className:"flex text-primary",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4","aria-hidden":"true",children:e.jsx("path",{d:"M20 6 9 17l-5-5"})})})]},y.value))})})})})]}),s&&e.jsx(V.Field.Description,{id:p,className:Tr,children:s}),e.jsx(V.Field.Error,{id:x,match:n?!0:"valueMissing",className:Ae,children:n??"Choose an option."})]})}const En=L.Menu.Root,Wn=L.Menu.Trigger,$n=L.Menu.Portal,On=L.Menu.Positioner,Rr=L.Menu.Group,Hn=L.Menu.RadioGroup,qn=L.Menu.SubmenuRoot,be=f.forwardRef(({className:t,children:r,...s},n)=>e.jsx(L.Menu.Popup,{ref:n,className:c("z-50 min-w-48 rounded-lg border border-border bg-white p-1 text-sm text-text outline-none shadow-none",t),...s,children:r}));be.displayName="GymatraMenuPopup";const $e=f.forwardRef(({variant:t="default",startIcon:r,endIcon:s,shortcut:n,className:a,children:o,...i},l)=>e.jsxs(L.Menu.Item,{ref:l,className:c("group relative flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-1.5 text-sm outline-none transition-colors","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t==="danger"?"text-danger data-[highlighted]:bg-danger-soft data-[highlighted]:text-danger font-medium":t==="primary"?"text-primary data-[highlighted]:bg-primary-soft data-[highlighted]:text-primary font-medium":"text-text data-[highlighted]:bg-surface-muted data-[highlighted]:text-text",a),...i,children:[r&&e.jsx("span",{className:"shrink-0 size-4 text-text-muted group-data-[highlighted]:text-current flex items-center justify-center",children:r}),e.jsx("span",{className:"flex-1 truncate",children:o}),n&&e.jsx("kbd",{className:"ml-auto pl-3 font-mono text-xs text-text-muted",children:n}),s&&e.jsx("span",{className:"shrink-0 size-4 text-text-muted group-data-[highlighted]:text-current flex items-center justify-center ml-auto",children:s})]}));$e.displayName="GymatraMenuItem";const Oe=f.forwardRef(({className:t,...r},s)=>e.jsx(L.Menu.Separator,{ref:s,className:c("my-1 h-px bg-border -mx-1",t),...r}));Oe.displayName="GymatraMenuSeparator";const He=f.forwardRef(({className:t,...r},s)=>e.jsx(L.Menu.GroupLabel,{ref:s,className:c("px-2.5 py-1 text-xs font-semibold uppercase tracking-wider text-text-muted select-none",t),...r}));He.displayName="GymatraMenuGroupLabel";function Vn({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}function Un({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}const qe=f.forwardRef(({className:t,children:r,shortcut:s,...n},a)=>e.jsxs(L.Menu.CheckboxItem,{ref:a,className:c("group relative flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-1.5 text-sm text-text outline-none transition-colors","data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-surface-muted",t),...n,children:[e.jsx("span",{className:"shrink-0 size-4 flex items-center justify-center text-primary",children:e.jsx(L.Menu.CheckboxItemIndicator,{children:e.jsx(Vn,{})})}),e.jsx("span",{className:"flex-1 truncate",children:r}),s&&e.jsx("kbd",{className:"ml-auto pl-3 font-mono text-xs text-text-muted",children:s})]}));qe.displayName="GymatraMenuCheckboxItem";const Ve=f.forwardRef(({className:t,children:r,...s},n)=>e.jsxs(L.Menu.RadioItem,{ref:n,className:c("group relative flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-1.5 text-sm text-text outline-none transition-colors","data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-surface-muted",t),...s,children:[e.jsx("span",{className:"shrink-0 size-4 flex items-center justify-center text-primary",children:e.jsx(L.Menu.RadioItemIndicator,{children:e.jsx("span",{className:"size-2 rounded-full bg-primary"})})}),e.jsx("span",{className:"flex-1 truncate",children:r})]}));Ve.displayName="GymatraMenuRadioItem";const Ue=f.forwardRef(({startIcon:t,className:r,children:s,...n},a)=>e.jsxs(L.Menu.SubmenuTrigger,{ref:a,className:c("group relative flex w-full cursor-pointer select-none items-center justify-between gap-2 rounded-md px-2.5 py-1.5 text-sm text-text outline-none transition-colors","data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-surface-muted",r),...n,children:[e.jsxs("div",{className:"flex items-center gap-2 truncate",children:[t&&e.jsx("span",{className:"shrink-0 size-4 text-text-muted group-data-[highlighted]:text-current flex items-center justify-center",children:t}),e.jsx("span",{className:"truncate",children:s})]}),e.jsx(Un,{className:"size-3.5 text-text-muted shrink-0"})]}));Ue.displayName="GymatraMenuSubmenuTrigger";function _e(t){const r=[];let s=0;for(;s<t.length;){const n=t[s];if(n.type!=="label"){r.push(Bt(n,s)),s++;continue}const a=s,o=[];for(s++;s<t.length&&t[s].type!=="label"&&t[s].type!=="separator";)o.push(Bt(t[s],s)),s++;r.push(e.jsxs(Rr,{children:[e.jsx(He,{children:n.label}),o]},n.key??`menu-group-${a}`))}return r}function Bt(t,r){const s=t.key??`menu-item-${r}`;return t.type==="separator"?e.jsx(Oe,{},s):t.type==="checkbox"?e.jsx(qe,{checked:t.checked,onCheckedChange:t.onCheckedChange,shortcut:t.shortcut,disabled:t.disabled,children:t.label},s):t.type==="radio"?e.jsx(Ve,{value:t.value??String(s),disabled:t.disabled,children:t.label},s):t.items&&t.items.length>0?e.jsxs(L.Menu.SubmenuRoot,{children:[e.jsx(Ue,{startIcon:t.startIcon??t.icon,disabled:t.disabled,children:t.label}),e.jsx(L.Menu.Portal,{children:e.jsx(L.Menu.Positioner,{sideOffset:4,align:"start",className:"z-[10020] outline-none",children:e.jsx(be,{children:_e(t.items)})})})]},s):e.jsx($e,{variant:t.variant,startIcon:t.startIcon??t.icon,endIcon:t.endIcon,shortcut:t.shortcut,disabled:t.disabled,onClick:t.onClick,children:t.label},s)}function _n({trigger:t,items:r,open:s,defaultOpen:n,onOpenChange:a,side:o="bottom",align:i="start",sideOffset:l=6,width:m="min-w-[200px]",popupClassName:u,children:d}){const h=s!==void 0?{open:s,onOpenChange:a}:n!==void 0?{defaultOpen:n,onOpenChange:a}:{onOpenChange:a};return e.jsxs(L.Menu.Root,{...h,children:[e.jsx(L.Menu.Trigger,{render:f.isValidElement(t)?t:e.jsx("button",{type:"button",children:t})}),e.jsx(L.Menu.Portal,{children:e.jsx(L.Menu.Positioner,{side:o,align:i,sideOffset:l,className:"z-[10020] outline-none",children:e.jsx(be,{className:c(m,u),children:r&&r.length>0?_e(r):d})})})]})}const Kn=Et.Menubar,Zn=L.Menu.Root,Qn=L.Menu.Portal,Yn=L.Menu.Positioner,Jn=L.Menu.Group,Xn=L.Menu.RadioGroup,ea=L.Menu.SubmenuRoot,ta=be,ra=$e,sa=Oe,na=He,aa=qe,oa=Ve,ia=Ue,pt=f.forwardRef(({className:t,startIcon:r,children:s,...n},a)=>e.jsxs(L.Menu.Trigger,{ref:a,className:c("flex cursor-pointer select-none items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium text-text outline-none transition-colors","hover:bg-surface-muted hover:text-text","data-[popup-open]:bg-primary-soft data-[popup-open]:text-primary","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary","data-[disabled]:opacity-50 data-[disabled]:pointer-events-none",t),...n,children:[r&&e.jsx("span",{className:"shrink-0 size-4 text-text-muted flex items-center justify-center",children:r}),e.jsx("span",{children:s})]}));pt.displayName="GymatraMenubarTrigger";const Br=f.forwardRef(({menus:t,bordered:r=!0,className:s,children:n,...a},o)=>e.jsx(Et.Menubar,{ref:o,className:c("flex items-center gap-0.5 text-sm text-text select-none",r?"rounded-md border border-border bg-white p-1 shadow-none":"bg-transparent p-0.5",s),...a,children:t&&t.length>0?t.map((i,l)=>{const m=i.key??`menubar-menu-${l}`;return e.jsxs(L.Menu.Root,{disabled:i.disabled,children:[e.jsx(pt,{startIcon:i.startIcon,disabled:i.disabled,children:i.trigger}),e.jsx(L.Menu.Portal,{children:e.jsx(L.Menu.Positioner,{side:i.side??"bottom",align:i.align??"start",sideOffset:i.sideOffset??6,className:"z-[10020] outline-none",children:e.jsx(be,{className:c(i.width??"min-w-52",i.popupClassName),children:_e(i.items)})})})]},m)}):n}));Br.displayName="GymatraMenubar";function la({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}function ca({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}function da({className:t="size-3"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function ua({className:t="size-3"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}function ft({page:t,total:r,pageSize:s,onPageChange:n,pageSizeOptions:a,onPageSizeChange:o,showSummary:i=!0,className:l,...m}){const u=Math.max(1,Math.ceil(r/s)),d=Math.min(Math.max(1,t),u),h=r===0?0:(d-1)*s+1,b=Math.min(d*s,r),[p,x]=f.useState(!1),y=f.useRef(null);f.useEffect(()=>{function k(v){y.current&&!y.current.contains(v.target)&&x(!1)}if(p)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[p]);function g(){return u<=7?Array.from({length:u},(k,v)=>v+1):d<=4?[1,2,3,4,5,"ellipsis",u]:d>=u-3?[1,"ellipsis",u-4,u-3,u-2,u-1,u]:[1,"ellipsis",d-1,d,d+1,"ellipsis",u]}const j=g();return e.jsxs("div",{className:c("flex flex-wrap items-center justify-between gap-3 pt-3 px-1 text-sm text-text-muted",l),...m,children:[e.jsxs("div",{className:"flex items-center gap-2 text-text-muted text-sm",children:[i&&e.jsxs("span",{children:["Display ",h," to ",b," of ",r]}),a&&a.length>0&&o&&e.jsxs("div",{ref:y,className:"relative inline-block text-left",children:[e.jsxs("button",{type:"button",onClick:()=>x(k=>!k),"aria-haspopup":"listbox","aria-expanded":p,"aria-label":`Rows per page: ${s}`,className:c("inline-flex h-7 items-center justify-between gap-2 rounded-md border border-border bg-white px-2.5 text-sm text-text cursor-pointer transition-colors outline-none","hover:border-border-strong hover:bg-surface/50","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary",p&&"border-primary bg-primary-soft/30 text-primary"),children:[e.jsx("span",{children:s}),e.jsx("span",{className:c("text-text-subtle transition-transform duration-150 flex items-center",p&&"rotate-180 text-primary"),"aria-hidden":"true",children:e.jsx(da,{})})]}),p&&e.jsx("div",{role:"listbox","aria-label":"Rows per page",className:"absolute left-0 bottom-full z-50 mb-1 min-w-[75px] rounded-lg border border-border bg-white p-1 shadow-none focus:outline-none",children:a.map(k=>{const v=k===s;return e.jsxs("button",{type:"button",role:"option","aria-selected":v,onClick:()=>{o(k),x(!1)},className:c("flex w-full items-center justify-between rounded px-2 py-1 text-sm text-left cursor-pointer transition-colors outline-none","hover:bg-surface hover:text-text",v?"bg-primary-soft/40 text-primary font-medium":"text-text font-normal"),children:[e.jsx("span",{children:k}),v&&e.jsx("span",{className:"text-primary","aria-hidden":"true",children:e.jsx(ua,{})})]},k)})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 ms-auto",children:[e.jsx("button",{type:"button",disabled:d<=1,onClick:()=>n(d-1),"aria-label":"Previous page",className:"flex size-7 items-center justify-center rounded-full text-text-muted hover:text-text hover:bg-surface disabled:pointer-events-none disabled:opacity-30 cursor-pointer transition-colors",children:e.jsx(la,{})}),j.map((k,v)=>{if(k==="ellipsis")return e.jsx("span",{className:"flex size-7 items-center justify-center text-text-subtle select-none",children:"…"},`ellipsis-${v}`);const w=k===d;return e.jsx("button",{type:"button",onClick:()=>n(k),"aria-current":w?"page":void 0,className:c("flex size-7 items-center justify-center rounded-full text-sm font-medium cursor-pointer transition-colors",w?"bg-primary text-white":"text-text hover:bg-surface"),children:k},k)}),e.jsx("button",{type:"button",disabled:d>=u,onClick:()=>n(d+1),"aria-label":"Next page",className:"flex size-7 items-center justify-center rounded-full text-text-muted hover:text-text hover:bg-surface disabled:pointer-events-none disabled:opacity-30 cursor-pointer transition-colors",children:e.jsx(ca,{})})]})]})}ft.displayName="GymatraPagination";const xa=U.Popover.Root,ma=U.Popover.Trigger,pa=U.Popover.Portal,fa=U.Popover.Positioner,ht=f.forwardRef(({className:t,children:r,...s},n)=>e.jsx(U.Popover.Popup,{ref:n,className:c("relative z-50 rounded-lg border border-border bg-white p-4 text-text outline-none shadow-none",t),...s,children:r}));ht.displayName="GymatraPopoverPopup";const bt=f.forwardRef(({className:t,...r},s)=>e.jsx(U.Popover.Title,{ref:s,className:c("text-sm font-semibold text-text",t),...r}));bt.displayName="GymatraPopoverTitle";const yt=f.forwardRef(({className:t,...r},s)=>e.jsx(U.Popover.Description,{ref:s,className:c("mt-1 text-xs leading-relaxed text-text-muted",t),...r}));yt.displayName="GymatraPopoverDescription";function ha({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})}const gt=f.forwardRef(({className:t,children:r,...s},n)=>e.jsx(U.Popover.Close,{ref:n,className:c("absolute top-3 right-3 rounded-md p-1 text-text-muted hover:bg-surface-muted hover:text-text cursor-pointer transition-colors outline-none focus-visible:outline-2 focus-visible:outline-primary",t),"aria-label":"Fermer",...s,children:r??e.jsx(ha,{})}));gt.displayName="GymatraPopoverClose";const Ar=f.forwardRef(({className:t,...r},s)=>e.jsx(U.Popover.Arrow,{ref:s,className:c("fill-white stroke-border stroke-1",t),...r}));Ar.displayName="GymatraPopoverArrow";function ba({trigger:t,title:r,description:s,content:n,children:a,footer:o,side:i="bottom",align:l="center",sideOffset:m=8,width:u="w-80",showCloseButton:d=!0,open:h,defaultOpen:b,onOpenChange:p,modal:x=!1,popupClassName:y}){const g=h!==void 0?{open:h,onOpenChange:p,modal:x}:b!==void 0?{defaultOpen:b,onOpenChange:p,modal:x}:{onOpenChange:p,modal:x};return e.jsxs(U.Popover.Root,{...g,children:[e.jsx(U.Popover.Trigger,{render:f.isValidElement(t)?t:e.jsx("button",{type:"button",children:t})}),e.jsx(U.Popover.Portal,{children:e.jsx(U.Popover.Positioner,{side:i,align:l,sideOffset:m,className:"z-[10020] outline-none",children:e.jsxs(ht,{className:c(u,y),children:[d&&e.jsx(gt,{}),(r||s)&&e.jsxs("div",{className:c("space-y-1",d?"pr-6":void 0),children:[r&&e.jsx(bt,{children:r}),s&&e.jsx(yt,{children:s})]}),(n||a)&&e.jsx("div",{className:c(r||s?"mt-3":void 0),children:n??a}),o&&e.jsx("div",{className:"mt-4 pt-3 border-t border-border flex items-center justify-end gap-2",children:o})]})})})]})}const ya=ee.Progress.Root,ga=ee.Progress.Track,ja=ee.Progress.Indicator,va=ee.Progress.Label,wa=ee.Progress.Value,Na={primary:"bg-primary",success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info"},ka={xs:"h-1",sm:"h-1.5",md:"h-2",lg:"h-3"},Ga={pill:"rounded-full",rounded:"rounded-md",square:"rounded-none"};function Ca({value:t,min:r=0,max:s=100,label:n,description:a,showValue:o=!0,formatValue:i,variant:l="primary",size:m="md",shape:u="pill",className:d,trackClassName:h,indicatorClassName:b}){const p=t===null,x=Ga[u],y=t!==null?Math.round((t-r)/(s-r)*100):0;return e.jsxs(ee.Progress.Root,{value:t,min:r,max:s,className:c("w-full space-y-1.5",d),children:[(n||o)&&e.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs font-medium",children:[e.jsxs("div",{className:"space-y-0.5 min-w-0",children:[n&&e.jsx(ee.Progress.Label,{className:"text-text font-medium truncate",children:n}),a&&e.jsx("p",{className:"text-xs text-text-muted",children:a})]}),o&&!p&&e.jsx("span",{className:"text-text-muted font-mono font-medium shrink-0 ml-auto",children:i?i(t):`${y}%`})]}),e.jsx(ee.Progress.Track,{className:c("relative w-full overflow-hidden bg-surface-muted",ka[m],x,h),children:e.jsx(ee.Progress.Indicator,{className:c("h-full transition-all duration-300 ease-out",Na[l],x,p&&"w-1/3 animate-[indeterminate_1.5s_infinite_ease-in-out]",b)})})]})}const Sa={primary:"text-primary",success:"text-success",warning:"text-warning",danger:"text-danger",info:"text-info"};function za({value:t,size:r=80,strokeWidth:s=8,variant:n="primary",children:a,className:o,showValue:i=!0}){const l=Math.min(100,Math.max(0,t)),m=(r-s)/2,u=2*Math.PI*m,d=u-l/100*u;return e.jsxs("div",{className:c("relative inline-flex items-center justify-center shrink-0",o),style:{width:r,height:r},role:"progressbar","aria-valuenow":l,"aria-valuemin":0,"aria-valuemax":100,children:[e.jsxs("svg",{className:"-rotate-90 origin-center",width:r,height:r,viewBox:`0 0 ${r} ${r}`,children:[e.jsx("circle",{className:"text-surface-muted",strokeWidth:s,stroke:"currentColor",fill:"transparent",r:m,cx:r/2,cy:r/2}),e.jsx("circle",{className:c(Sa[n],"transition-all duration-500 ease-out"),strokeWidth:s,strokeDasharray:u,strokeDashoffset:d,strokeLinecap:"round",stroke:"currentColor",fill:"transparent",r:m,cx:r/2,cy:r/2})]}),e.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-center p-1",children:a??(i&&e.jsxs("span",{className:"text-xs font-medium font-mono tabular-nums text-text",children:[Math.round(l),"%"]}))})]})}const Pa=Wt.Separator,Dr=f.forwardRef(({orientation:t="horizontal",variant:r="default",decorative:s=!0,label:n,children:a,labelPosition:o="center",className:i,...l},m)=>{const u=t==="horizontal",d=n??a,h=()=>{switch(r){case"subtle":return u?"h-px w-full bg-border/50":"w-px h-full min-h-[1rem] bg-border/50 self-stretch";case"primary":return u?"h-px w-full bg-primary/40":"w-px h-full min-h-[1rem] bg-primary/40 self-stretch";case"dashed":return u?"h-0 w-full border-t border-dashed border-border":"w-0 h-full min-h-[1rem] border-s border-dashed border-border self-stretch";case"dotted":return u?"h-0 w-full border-t border-dotted border-border":"w-0 h-full min-h-[1rem] border-s border-dotted border-border self-stretch";case"default":default:return u?"h-px w-full bg-border":"w-px h-full min-h-[1rem] bg-border self-stretch"}};if(u&&d){const b=h();return e.jsxs("div",{ref:m,role:s?"none":"separator","aria-orientation":"horizontal",className:c("flex w-full items-center select-none text-xs font-medium text-text-muted",i),...l,children:[e.jsx("div",{className:c(o==="start"?"w-6 shrink-0":"flex-1",b)}),e.jsx("span",{className:"px-3 shrink-0 flex items-center gap-1.5",children:d}),e.jsx("div",{className:c(o==="end"?"w-6 shrink-0":"flex-1",b)})]})}return e.jsx(Wt.Separator,{ref:m,orientation:t,role:s?"none":"separator",className:c("shrink-0",h(),i),...l})});Dr.displayName="GymatraSeparator";const Ma={primary:"bg-primary-soft text-primary",success:"bg-success-soft text-success",warning:"bg-warning-soft text-warning",danger:"bg-danger-soft text-danger",info:"bg-info-soft text-info",neutral:"bg-surface-muted text-text-muted"},Ia={primary:"text-primary",success:"text-success",warning:"text-warning",danger:"text-danger",info:"text-info",neutral:"text-text-muted"},Ta={outline:"border border-border bg-white",soft:"bg-surface-muted"},Ye={good:"text-success",bad:"text-danger",flat:"text-text-muted"},At={up:"En hausse",down:"En baisse",flat:"Stable"};function Fr({direction:t,className:r}){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",className:r,"aria-hidden":"true",children:[t==="up"&&e.jsx("path",{d:"M7 17 17 7M9 7h8v8"}),t==="down"&&e.jsx("path",{d:"M7 7l10 10M17 9v8H9"}),t==="flat"&&e.jsx("path",{d:"M6 12h12"})]})}function La({direction:t}){return t==="flat"?e.jsx(Fr,{direction:"flat",className:"size-3"}):e.jsx("svg",{viewBox:"0 0 10 10",className:"size-2",fill:"currentColor","aria-hidden":"true",children:t==="up"?e.jsx("path",{d:"M5 1 9.5 9h-9z"}):e.jsx("path",{d:"M5 9 .5 1h9z"})})}function Ra({progress:t}){const s=2*Math.PI*6.5,n=Math.max(0,Math.min(100,t));return e.jsxs("svg",{viewBox:"0 0 16 16",className:"size-4 -rotate-90","aria-hidden":"true",children:[e.jsx("circle",{cx:"8",cy:"8",r:6.5,fill:"none",strokeWidth:"2",className:"stroke-border"}),e.jsx("circle",{cx:"8",cy:"8",r:6.5,fill:"none",strokeWidth:"2",strokeLinecap:"round",className:"stroke-primary",strokeDasharray:`${n/100*s} ${s}`})]})}const Er=Ge.forwardRef(({label:t,unit:r,description:s,icon:n,tone:a="primary",value:o,caption:i,trend:l,trendPlacement:m="below",chart:u,secondary:d,action:h,variant:b="outline",loading:p=!1,className:x,...y},g)=>{const j=l?l.direction==="flat"?"flat":l.direction===(l.positive??"up")?"good":"bad":"flat",k=l&&m==="inline"&&e.jsxs("span",{className:c("inline-flex items-center gap-1 text-xs font-medium tabular-nums",Ye[j]),children:[e.jsx(La,{direction:l.direction}),e.jsxs("span",{className:"sr-only",children:[At[l.direction]," :"]}),l.value]}),v=l&&m==="below"&&e.jsxs("p",{className:"mt-2 flex items-center gap-1.5 text-xs text-text-muted",children:[e.jsx("span",{className:c("flex size-4 shrink-0 items-center justify-center rounded-sm border border-current",Ye[j]),children:e.jsx(Fr,{direction:l.direction,className:"size-2.5"})}),e.jsxs("span",{className:"sr-only",children:[At[l.direction]," :"]}),e.jsx("span",{className:c("font-medium tabular-nums",Ye[j]),children:l.value}),l.label&&e.jsx("span",{className:"truncate",children:l.label})]});return e.jsxs("div",{ref:g,"aria-busy":p||void 0,className:c("flex min-w-0 flex-col gap-3 rounded-lg px-4 py-3.5",Ta[b],x),...y,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[n&&e.jsx("span",{"aria-hidden":"true",className:c("flex size-10 shrink-0 items-center justify-center rounded-lg [&>img]:size-6 [&>svg]:size-5",Ma[a]),children:n}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"truncate text-sm font-medium text-text",children:[t,r&&e.jsxs("span",{className:"font-normal text-text-muted",children:[" ",r]})]}),s&&e.jsx("p",{className:"truncate text-xs text-text-muted",children:s})]})]}),h&&e.jsx("div",{className:"shrink-0 text-xs",children:h})]}),e.jsxs("div",{className:"flex items-end justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[p?e.jsx("span",{className:"block h-8 w-24 animate-pulse rounded-md bg-border/60 motion-reduce:animate-none"}):e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[e.jsx("p",{className:"text-2xl font-semibold tabular-nums text-text",children:o}),k]}),i&&e.jsx("p",{className:"mt-1 truncate text-xs text-text-muted",children:i}),!p&&v]}),u&&!p&&e.jsx("div",{className:c("h-12 w-28 shrink-0",Ia[a]),children:u}),d&&!p&&e.jsxs("div",{className:"shrink-0 text-end",children:[e.jsxs("p",{className:"flex items-center justify-end gap-1.5 text-sm font-medium tabular-nums text-text",children:[typeof d.progress=="number"&&e.jsx(Ra,{progress:d.progress}),d.value]}),e.jsx("p",{className:"mt-1 text-xs text-text-muted",children:d.label})]})]})]})});Er.displayName="GymatraStatCard";function Ba({data:t,highlightIndex:r,highlightLabel:s,label:n,className:a,...o}){const m=s?18:4,u=45,d=t.length>=2?t:[t[0]??0,t[0]??0],h=Math.min(...d),p=Math.max(...d)-h||1,x=d.map((v,w)=>({x:w/(d.length-1)*108+2,y:u-(v-h)/p*(u-m)}));let y=`M ${x[0].x} ${x[0].y}`;for(let v=1;v<x.length;v++){const w=x[v-1],C=x[v],T=(w.x+C.x)/2;y+=` Q ${w.x} ${w.y} ${T} ${(w.y+C.y)/2} T ${C.x} ${C.y}`}const g=`${y} L ${x[x.length-1].x} 48 L ${x[0].x} 48 Z`,j=r===void 0?x.length-1:r,k=j!==null&&x[j]?x[j]:null;return e.jsxs("svg",{viewBox:"0 0 112 48",className:c("size-full overflow-visible",a),role:n?"img":void 0,"aria-label":n,"aria-hidden":n?void 0:!0,...o,children:[e.jsx("path",{d:g,fill:"currentColor",fillOpacity:"0.08",stroke:"none"}),e.jsx("path",{d:y,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"}),k&&e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:k.x,x2:k.x,y1:k.y,y2:48,stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"1",vectorEffect:"non-scaling-stroke"}),e.jsx("circle",{cx:k.x,cy:k.y,r:"3.5",fill:"currentColor",stroke:"white",strokeWidth:"2"}),s&&e.jsx("text",{x:k.x,y:k.y-7,textAnchor:"middle",className:"fill-text text-xs font-medium",children:s})]})]})}const me=f.createContext(null);function Wr(){const t=f.useContext(me);if(!t)throw new Error("useGymatraStepper must be used within a GymatraStepper");return t}function $r({className:t}){return e.jsx("svg",{className:c("size-3.5",t),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}function Aa({className:t}){return e.jsxs("svg",{className:c("size-3.5",t),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})}function Da({steps:t,currentStep:r,activeStep:s,orientation:n="horizontal",variant:a="numbered",layout:o="inline",size:i="md",clickable:l=!1,allowStepAdvance:m=!1,onStepClick:u,className:d,children:h,...b}){const p=r??s??0,x=t?t.length:f.Children.count(h),y={currentStep:p,orientation:n,variant:a,size:i,layout:o,clickable:l,allowStepAdvance:m,onStepClick:u,totalSteps:x};return n==="vertical"?e.jsx(me.Provider,{value:y,children:e.jsx("div",{role:"navigation","aria-label":"Progress Stepper",className:c("w-full flex flex-col",d),...b,children:t?t.map((g,j)=>{const k=j===t.length-1,v=g.status??(j<p?"complete":j===p?"current":"upcoming");return e.jsx(Or,{stepIndex:j,status:v,title:g.title,description:g.description,icon:g.icon,completedIcon:g.completedIcon,errorIcon:g.errorIcon,optional:g.optional,disabled:g.disabled,badge:g.badge,isLast:k},g.id??j)}):h})}):t&&a==="pills"&&n==="horizontal"?e.jsx(me.Provider,{value:y,children:e.jsx("nav",{role:"navigation","aria-label":"Progress Stepper",className:c("w-full text-text",d),...b,children:e.jsx("ol",{className:"flex flex-wrap items-center gap-2 sm:gap-2.5 w-full",children:t.map((g,j)=>{const k=j===t.length-1,v=g.status??(j<p?"complete":j===p?"current":"upcoming"),w=v==="complete",C=v==="current",T=v==="error",S=l&&!g.disabled&&(m||w||C),z=()=>{S&&u&&u(j,g)};return e.jsxs("li",{className:"inline-flex items-center gap-2",children:[e.jsxs("button",{type:"button",disabled:!S||g.disabled,onClick:z,"aria-current":C?"step":void 0,className:c("inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-xs transition-all outline-none",C?"bg-primary text-white font-medium ring-2 ring-primary/25":w?"bg-primary-soft text-primary font-medium hover:bg-primary-soft/80":T?"bg-danger-soft text-danger border border-danger/30 font-medium":"bg-surface-muted text-text-muted font-normal hover:text-text",S&&"cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",!S&&"cursor-default",g.disabled&&"opacity-50 pointer-events-none"),children:[e.jsx("span",{className:c("flex size-4 items-center justify-center rounded-full text-xs font-medium shrink-0",C?"bg-white/20 text-white":w?"bg-primary text-white":T?"bg-danger text-white":"bg-border text-text-muted"),children:w?e.jsx($r,{className:"size-2.5"}):j+1}),e.jsx("span",{className:"truncate",children:g.title})]}),!k&&e.jsx("span",{className:"text-text-subtle text-xs select-none","aria-hidden":"true",children:"/"})]},g.id??j)})})})}):t&&n==="horizontal"&&o==="centered"?e.jsx(me.Provider,{value:y,children:e.jsx("nav",{role:"navigation","aria-label":"Progress Stepper",className:c("w-full text-text",d),...b,children:e.jsx("ol",{className:"flex items-start justify-between w-full",children:t.map((g,j)=>{const k=j===0,v=j===t.length-1,w=g.status??(j<p?"complete":j===p?"current":"upcoming"),C=w==="complete",T=w==="current",S=l&&!g.disabled&&(m||C||T),z=()=>{S&&u&&u(j,g)},N=P=>{S&&(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),z())};return e.jsxs("li",{className:"relative flex-1 flex flex-col items-center text-center group",children:[!k&&e.jsx("div",{"aria-hidden":"true",className:"absolute top-4 -translate-y-1/2 left-0 right-1/2 h-0.5 bg-border -z-0",children:e.jsx("div",{className:c("h-full transition-all duration-300",j<=p?"bg-primary":"bg-transparent")})}),!v&&e.jsx("div",{"aria-hidden":"true",className:"absolute top-4 -translate-y-1/2 left-1/2 right-0 h-0.5 bg-border -z-0",children:e.jsx("div",{className:c("h-full transition-all duration-300",j<p?"bg-primary":"bg-transparent")})}),e.jsxs("div",{role:S?"button":void 0,tabIndex:S?0:void 0,onClick:S?z:void 0,onKeyDown:S?N:void 0,"aria-current":T?"step":void 0,className:c("relative z-10 flex flex-col items-center outline-none group rounded-lg p-1 transition-colors",S&&"cursor-pointer hover:bg-surface-muted/40 focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",g.disabled&&"opacity-50 pointer-events-none"),children:[e.jsx("div",{className:"bg-white rounded-full p-0.5 ring-4 ring-white",children:e.jsx(Se,{stepIndex:j,status:w,icon:g.icon,completedIcon:g.completedIcon,errorIcon:g.errorIcon,variant:a,size:i})}),e.jsxs("div",{className:"mt-2 flex flex-col items-center max-w-[140px]",children:[e.jsx("span",{className:c("text-xs leading-tight transition-colors",T?"text-primary font-medium":C?"text-text font-medium":w==="error"?"text-danger font-medium":"text-text-muted"),children:g.title}),g.description&&e.jsx("span",{className:"text-xs text-text-muted mt-0.5 hidden sm:block truncate w-full",children:g.description}),g.badge&&e.jsx("span",{className:"mt-1",children:g.badge})]})]})]},g.id??j)})})})}):t&&n==="horizontal"?e.jsx(me.Provider,{value:y,children:e.jsx("nav",{role:"navigation","aria-label":"Progress Stepper",className:c("w-full text-text",d),...b,children:e.jsx("ol",{className:"flex items-center w-full",children:t.map((g,j)=>{const k=j===t.length-1,v=g.status??(j<p?"complete":j===p?"current":"upcoming"),w=v==="complete",C=v==="current",T=v==="error",S=l&&!g.disabled&&(m||w||C),z=()=>{S&&u&&u(j,g)},N=P=>{S&&(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),z())};return e.jsxs("li",{className:c("flex items-center min-w-0",k?"flex-none":"flex-1"),children:[e.jsxs("div",{role:S?"button":void 0,tabIndex:S?0:void 0,onClick:S?z:void 0,onKeyDown:S?N:void 0,"aria-current":C?"step":void 0,className:c("flex items-center gap-2.5 sm:gap-3 shrink-0 rounded-lg outline-none transition-colors p-1 -m-1",S&&"cursor-pointer hover:bg-surface-muted/50 focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",g.disabled&&"opacity-50 pointer-events-none"),children:[e.jsx(Se,{stepIndex:j,status:v,icon:g.icon,completedIcon:g.completedIcon,errorIcon:g.errorIcon,variant:a,size:i}),e.jsxs("div",{className:"flex flex-col text-start min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{className:c("leading-tight truncate transition-colors",i==="sm"?"text-xs":i==="lg"?"text-base":"text-sm",C?"text-primary font-medium":w?"text-text font-medium":T?"text-danger font-medium":"text-text-muted font-normal"),children:g.title}),g.optional&&e.jsx("span",{className:"text-xs text-text-muted font-normal",children:"(Facultatif)"}),g.badge&&e.jsx("span",{children:g.badge})]}),g.description&&e.jsx("span",{className:"text-text-muted leading-tight mt-0.5 truncate hidden md:inline-block text-xs",children:g.description})]})]}),!k&&e.jsx("div",{"aria-hidden":"true",className:"flex-1 mx-2 sm:mx-4 h-0.5 min-w-3 sm:min-w-6 bg-border relative overflow-hidden rounded-full shrink",children:e.jsx("div",{className:c("h-full w-full transition-all duration-300",j<p?"bg-primary":"bg-transparent")})})]},g.id??j)})})})}):e.jsx(me.Provider,{value:y,children:e.jsx("div",{role:"navigation","aria-label":"Progress Stepper",className:c("w-full text-text",n==="horizontal"?"flex flex-row items-start justify-between":"flex flex-col space-y-0",d),...b,children:h})})}function Or({stepIndex:t=0,status:r,title:s,description:n,icon:a,completedIcon:o,errorIcon:i,optional:l,disabled:m,badge:u,isLast:d=!1,className:h,children:b,...p}){const{currentStep:x,orientation:y,variant:g,size:j,clickable:k,allowStepAdvance:v,onStepClick:w}=Wr(),C=r??(t<x?"complete":t===x?"current":"upcoming"),T=C==="complete",S=C==="current",z=C==="error",N=k&&!m&&(v||T||S),P=()=>{N&&w&&w(t)},E=R=>{N&&(R.key==="Enter"||R.key===" ")&&(R.preventDefault(),P())};return y==="vertical"?e.jsxs("div",{className:c("relative flex items-stretch gap-3.5 group",m&&"opacity-50 pointer-events-none",h),...p,children:[e.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[e.jsx("div",{role:N?"button":void 0,tabIndex:N?0:void 0,onClick:N?P:void 0,onKeyDown:N?E:void 0,"aria-current":S?"step":void 0,className:c("rounded-full outline-none transition-transform",N&&"cursor-pointer hover:scale-105 focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2"),children:e.jsx(Se,{stepIndex:t,status:C,icon:a,completedIcon:o,errorIcon:i,variant:g,size:j})}),!d&&e.jsx("div",{className:c("w-0.5 flex-1 my-1.5 transition-colors duration-200 min-h-7",T?"bg-primary":"bg-border"),"aria-hidden":"true"})]}),e.jsxs("div",{className:c("flex-1 min-w-0 pb-6",d&&"pb-1"),children:[e.jsxs("div",{role:N?"button":void 0,tabIndex:N?0:void 0,onClick:N?P:void 0,onKeyDown:N?E:void 0,className:c("flex flex-col outline-none rounded-md",N&&"cursor-pointer"),children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:c("leading-tight transition-colors",j==="sm"?"text-xs":j==="lg"?"text-base":"text-sm",S?"text-primary font-medium":T?"text-text font-medium":z?"text-danger font-medium":"text-text-muted font-normal"),children:s}),l&&e.jsx("span",{className:"text-xs text-text-muted font-normal",children:"(Facultatif)"}),u&&e.jsx("span",{children:u})]}),n&&e.jsx("p",{className:"text-xs text-text-muted mt-0.5 leading-relaxed",children:n})]}),b&&e.jsx("div",{className:"mt-2.5",children:b})]})]}):e.jsx("div",{className:c("group relative flex flex-col items-center flex-1 text-center sm:flex-row sm:items-start sm:text-start",m&&"opacity-50 pointer-events-none",h),...p,children:e.jsxs("div",{role:N?"button":void 0,tabIndex:N?0:void 0,onClick:N?P:void 0,onKeyDown:N?E:void 0,"aria-current":S?"step":void 0,className:c("flex items-start gap-3 rounded-lg transition-colors outline-none flex-col sm:flex-row items-center sm:items-start",N&&"cursor-pointer p-1.5 -m-1.5 rounded-md hover:bg-surface-muted/70 focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2"),children:[e.jsx(Se,{stepIndex:t,status:C,icon:a,completedIcon:o,errorIcon:i,variant:g,size:j}),(s||n||b)&&e.jsxs("div",{className:"min-w-0 flex flex-col items-center sm:items-start",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s&&e.jsx("span",{className:c("leading-tight truncate transition-colors",j==="sm"?"text-xs":j==="lg"?"text-base":"text-sm",S?"text-primary font-medium":T?"text-text font-medium":z?"text-danger font-medium":"text-text-muted font-normal"),children:s}),l&&e.jsx("span",{className:"text-xs text-text-muted font-normal",children:"(Facultatif)"}),u&&e.jsx("span",{children:u})]}),n&&e.jsx("p",{className:"text-text-muted leading-relaxed mt-0.5 text-xs",children:n}),b]})]})})}function Se({stepIndex:t,status:r,icon:s,completedIcon:n,errorIcon:a,variant:o="numbered",size:i="md"}){const l=r==="complete",m=r==="current",u=r==="error";if(o==="dots"){const h=i==="sm"?"size-2.5":i==="lg"?"size-4":"size-3";return e.jsx("span",{"aria-hidden":"true",className:c("rounded-full shrink-0 transition-all duration-200 mt-1.5",h,l?"bg-primary":m?"bg-primary ring-4 ring-primary/25 scale-125":u?"bg-danger ring-2 ring-danger/20":"bg-border")})}const d=i==="sm"?"size-6 text-xs":i==="lg"?"size-10 text-sm":"size-8 text-xs font-medium";return e.jsx("span",{className:c("relative flex shrink-0 items-center justify-center rounded-full transition-all duration-200 select-none",d,l?"bg-primary text-white border border-primary shadow-none":m?"bg-primary text-white border border-primary ring-4 ring-primary/20 font-medium":u?"bg-danger-soft text-danger border-2 border-danger font-medium":"bg-surface-muted text-text-muted border border-border"),"aria-hidden":"true",children:l?n??e.jsx($r,{}):u?a??e.jsx(Aa,{}):o==="icons"&&s?s:e.jsx("span",{children:t+1})})}function Fa({status:t="upcoming",className:r}){const s=t==="complete";return e.jsx("div",{"aria-hidden":"true",className:c("flex-1 hidden sm:flex items-center self-start mt-4 px-2",r),children:e.jsx("div",{className:c("h-0.5 w-full transition-colors duration-200",s?"bg-primary":"bg-border")})})}function Ea({active:t=!0,className:r,children:s,...n}){return t?e.jsx("div",{className:c("text-xs text-text",r),...n,children:s}):null}function Wa({direction:t}){return e.jsxs("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:[e.jsx("path",{d:"M5 12V4M5 4L2.5 6.5M5 4L7.5 6.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",className:t==="asc"?"text-primary opacity-100":"opacity-35"}),e.jsx("path",{d:"M11 4V12M11 12L8.5 9.5M11 12L13.5 9.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",className:t==="desc"?"text-primary opacity-100":"opacity-35"})]})}function $a({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function Hr({variant:t="cards",className:r,...s}){return e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsx("table",{className:c("w-full text-left text-sm",t==="cards"?"border-separate border-spacing-y-2":"border-collapse border border-border rounded-lg bg-white overflow-hidden",r),...s})})}Hr.displayName="GymatraTable";function jt({className:t,...r}){return e.jsx("thead",{className:c("text-xs font-semibold uppercase tracking-wider text-text-muted",t),...r})}jt.displayName="GymatraTableHeader";function vt({className:t,...r}){return e.jsx("tbody",{className:c("space-y-2",t),...r})}vt.displayName="GymatraTableBody";function wt({className:t,selected:r,variant:s="cards",...n}){return e.jsx("tr",{"data-selected":r,className:c("group transition-all bg-white hover:bg-surface/60","data-[selected=true]:bg-primary-soft/30",s==="cards"?"[&>td:first-child]:rounded-s-lg [&>td:last-child]:rounded-e-lg [&>td]:border-y [&>td]:border-border [&>td:first-child]:border-s [&>td:last-child]:border-e [&>td]:shadow-none":"border-b border-border last:border-b-0",t),...n})}wt.displayName="GymatraTableRow";function we({className:t,align:r="left",density:s="normal",...n}){const a=s==="compact"?"py-1.5 px-3 text-xs":s==="relaxed"?"py-3.5 px-4 text-xs":"py-2.5 px-3.5 text-xs";return e.jsx("th",{className:c("font-semibold uppercase tracking-wider text-text-muted align-middle whitespace-nowrap",a,r==="center"&&"text-center",r==="right"&&"text-right",t),...n})}we.displayName="GymatraTableHead";function Ne({className:t,align:r="left",density:s="normal",...n}){const a=s==="compact"?"py-2 px-3 text-sm":s==="relaxed"?"py-4 px-4 text-sm":"py-3 px-3.5 text-sm";return e.jsx("td",{className:c("align-middle text-text bg-inherit",a,r==="center"&&"text-center",r==="right"&&"text-right",t),...n})}Ne.displayName="GymatraTableCell";function Nt({children:t,direction:r,onSort:s,align:n="left",density:a="normal",className:o,...i}){const l=!!r,m=a==="compact"?"py-1.5 px-3 text-xs":a==="relaxed"?"py-3.5 px-4 text-xs":"py-2.5 px-3.5 text-xs";return e.jsx("th",{className:c("font-semibold uppercase tracking-wider align-middle whitespace-nowrap",m,n==="center"&&"text-center",n==="right"&&"text-right",o),...i,children:e.jsxs("button",{type:"button",onClick:s,className:c("inline-flex items-center gap-1.5 cursor-pointer transition-colors outline-none","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary",l?"text-primary font-semibold":"text-text-muted hover:text-text"),children:[e.jsx("span",{children:t}),e.jsx(Wa,{direction:r})]})})}Nt.displayName="GymatraTableSortHead";function Ee({checked:t=!1,onChange:r,indeterminate:s=!1,"aria-label":n}){return e.jsxs("button",{type:"button",role:"checkbox","aria-checked":s?"mixed":t,"aria-label":n,onClick:()=>r==null?void 0:r(!t),className:c("size-5 shrink-0 rounded-md flex items-center justify-center border cursor-pointer transition-colors outline-none","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary",t||s?"border-primary bg-primary text-white":"border-border-strong bg-white hover:border-text-subtle"),children:[t&&!s&&e.jsx("svg",{"aria-hidden":"true",className:"size-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),s&&e.jsx("span",{className:"h-0.5 w-3 bg-white rounded-full"})]})}Ee.displayName="GymatraTableCheckbox";function kt({columnsCount:t,hasCheckbox:r=!1,hasExpand:s=!1,density:n="normal",variant:a="cards"}){const o=n==="compact"?"py-2 px-3":n==="relaxed"?"py-4 px-4":"py-3 px-3.5";return e.jsxs("tr",{className:c("bg-white transition-opacity",a==="cards"?"[&>td:first-child]:rounded-s-lg [&>td:last-child]:rounded-e-lg [&>td]:border-y [&>td]:border-border [&>td:first-child]:border-s [&>td:last-child]:border-e":"border-b border-border last:border-b-0"),children:[s&&e.jsx("td",{className:c("w-8 text-center align-middle",o),children:e.jsx("div",{className:"size-4 mx-auto rounded bg-surface-muted animate-pulse"})}),r&&e.jsx("td",{className:c("w-8 align-middle",o),children:e.jsx("div",{className:"size-5 rounded-md bg-surface-muted animate-pulse"})}),Array.from({length:t}).map((i,l)=>e.jsx("td",{className:c("align-middle",o),children:l===0?e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"size-8 shrink-0 rounded-full bg-surface-muted animate-pulse"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"h-3.5 w-28 rounded bg-surface-muted animate-pulse"}),e.jsx("div",{className:"h-2.5 w-20 rounded bg-surface-muted/70 animate-pulse"})]})]}):e.jsx("div",{className:c("h-3.5 rounded bg-surface-muted animate-pulse",l===1?"w-24":l===t-1?"w-16":"w-20")})},l))]})}kt.displayName="GymatraTableSkeletonRow";function Gt({rowCount:t=5,columnsCount:r,hasCheckbox:s=!1,hasExpand:n=!1,density:a="normal",variant:o="cards"}){return e.jsx(e.Fragment,{children:Array.from({length:t}).map((i,l)=>e.jsx(kt,{columnsCount:r,hasCheckbox:s,hasExpand:n,density:a,variant:o},l))})}Gt.displayName="GymatraTableSkeleton";function qr({columns:t,data:r,rowKey:s=(S,z)=>S.id??z,sort:n,defaultSort:a,onSortChange:o,selectable:i=!1,selectedIds:l,onSelectionChange:m,selectionActions:u,pagination:d,emptyTitle:h="No data found",emptyDescription:b="There are no records matching your criteria.",loading:p=!1,skeletonRowCount:x=5,density:y="normal",variant:g="cards",onRowClick:j,expandedRowRender:k,expandedRowKeys:v,onExpandedRowsChange:w,className:C,...T}){const[S,z]=f.useState(a),N=n??S,[P,E]=f.useState([]),R=l??P,[O,re]=f.useState([]),M=v??O,[H,oe]=f.useState((d==null?void 0:d.page)??1),[B,$]=f.useState((d==null?void 0:d.pageSize)??10),K=(d==null?void 0:d.page)??H,q=(d==null?void 0:d.pageSize)??B,Z=!!k;function Ie(G){let I;(N==null?void 0:N.key)!==G?I={key:G,direction:"asc"}:N.direction==="asc"?I={key:G,direction:"desc"}:I=void 0,typeof n>"u"&&z(I),o==null||o(I)}const ie=f.useMemo(()=>N?[...r].sort((G,I)=>{const A=G[N.key],se=I[N.key];if(A===se)return 0;if(A==null)return 1;if(se==null)return-1;const ce=String(A).localeCompare(String(se),void 0,{numeric:!0});return N.direction==="asc"?ce:-ce}):r,[r,N]),ye=typeof(d==null?void 0:d.total)<"u",le=ye?d.total:ie.length,ge=f.useMemo(()=>{if(!d||ye)return ie;const G=(K-1)*q;return ie.slice(G,G+q)},[ie,d,ye,K,q]),Q=ge.map((G,I)=>s(G,I)),Te=Q.length>0&&Q.every(G=>R.includes(G)),ue=Q.some(G=>R.includes(G))&&!Te;function Ke(G){let I;if(G){const A=new Set([...R,...Q]);I=Array.from(A)}else I=R.filter(A=>!Q.includes(A));typeof l>"u"&&E(I),m==null||m(I)}function xe(G,I){let A;I?A=[...R,G]:A=R.filter(se=>se!==G),typeof l>"u"&&E(A),m==null||m(A)}function je(){typeof l>"u"&&E([]),m==null||m([])}function Le(G){let I;M.includes(G)?I=M.filter(A=>A!==G):I=[...M,G],typeof v>"u"&&re(I),w==null||w(I)}const Ze=R.length>0,Re=t.length+(i?1:0)+(Z?1:0);return e.jsxs("div",{className:c("flex flex-col w-full relative",C),...T,children:[e.jsx("div",{className:c("fixed bottom-6 left-1/2 -translate-x-1/2 z-50 transition-all duration-200 ease-out","w-[calc(100%-2rem)] max-w-lg sm:w-auto",Ze&&u?"translate-y-0 opacity-100 pointer-events-auto":"translate-y-4 opacity-0 pointer-events-none"),children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between sm:justify-start gap-3 rounded-lg border border-border bg-white px-4 py-2 text-sm shadow-none",children:[e.jsx("span",{className:"font-medium text-text",children:R.length===1?"1 item selected":`${R.length} items selected`}),e.jsx("span",{className:"hidden sm:inline-block h-4 w-px bg-border","aria-hidden":"true"}),e.jsx("div",{className:"flex items-center gap-1.5 ms-auto sm:ms-0",children:typeof u=="function"?u(R,je):u}),e.jsx("span",{className:"hidden sm:inline-block h-4 w-px bg-border","aria-hidden":"true"}),e.jsx("button",{type:"button",onClick:je,"aria-label":"Cancel selection",title:"Cancel selection",className:"flex size-6 items-center justify-center rounded-full text-text-muted hover:bg-surface hover:text-text cursor-pointer transition-colors outline-none focus-visible:outline-2 focus-visible:outline-primary",children:e.jsx("svg",{"aria-hidden":"true",className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})})]})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:c("w-full text-left text-sm",g==="cards"?"border-separate border-spacing-y-2":"border-collapse border border-border rounded-lg bg-white overflow-hidden"),children:[e.jsx(jt,{children:e.jsxs("tr",{children:[Z&&e.jsx(we,{density:y,className:"w-8 px-2"}),i&&e.jsx(we,{density:y,className:"w-8 px-3",children:e.jsx(Ee,{checked:Te,indeterminate:ue,onChange:Ke,"aria-label":"Select all rows on current page"})}),t.map(G=>G.sortable?e.jsx(Nt,{direction:(N==null?void 0:N.key)===G.key?N.direction:void 0,onSort:()=>Ie(G.key),align:G.align,density:y,className:G.width,children:G.header},G.key):e.jsx(we,{align:G.align,density:y,className:G.width,children:G.header},G.key))]})}),e.jsx(vt,{children:p?e.jsx(Gt,{rowCount:x,columnsCount:t.length,hasCheckbox:i,hasExpand:Z,density:y,variant:g}):ge.length>0?ge.map((G,I)=>{const A=s(G,I),se=R.includes(A),ce=M.includes(A);return e.jsxs(f.Fragment,{children:[e.jsxs(wt,{selected:se,variant:g,onClick:Y=>{const Qe=Y.target;Qe.closest("button")||Qe.closest("input")||Qe.closest("a")||j==null||j(G,I)},className:c(j&&"cursor-pointer hover:border-primary/40"),children:[Z&&e.jsx(Ne,{density:y,className:"w-8 px-2 text-center",children:e.jsx("button",{type:"button",onClick:Y=>{Y.stopPropagation(),Le(A)},"aria-expanded":ce,"aria-label":ce?"Collapse row":"Expand row",className:"size-6 inline-flex items-center justify-center rounded text-text-muted hover:text-text hover:bg-surface-muted transition-transform cursor-pointer outline-none focus-visible:outline-2 focus-visible:outline-primary",children:e.jsx("span",{className:c("inline-block transition-transform duration-150",ce&&"rotate-180"),children:e.jsx($a,{})})})}),i&&e.jsx(Ne,{density:y,className:"w-8 px-3",children:e.jsx(Ee,{checked:se,onChange:Y=>xe(A,Y),"aria-label":`Select row ${A}`})}),t.map(Y=>e.jsx(Ne,{align:Y.align,density:y,children:Y.render?Y.render(G,I):G[Y.key]},Y.key))]}),Z&&ce&&e.jsx("tr",{className:c(g==="cards"?"bg-surface-muted/30":"bg-surface-muted/40 border-b border-border"),children:e.jsx("td",{colSpan:Re,className:c("px-5 py-4 text-sm text-text",g==="cards"&&"rounded-lg border border-border border-dashed my-1"),children:k==null?void 0:k(G,I)})})]},A)}):e.jsx("tr",{children:e.jsxs("td",{colSpan:Re,className:"rounded-lg border border-border bg-white px-4 py-12 text-center text-text-muted",children:[e.jsx("p",{className:"font-semibold text-text",children:h}),e.jsx("p",{className:"mt-1 text-sm text-text-muted",children:b})]})})})]})}),d&&!p&&e.jsx(ft,{page:K,pageSize:q,total:le,onPageChange:G=>{var I;typeof d.page>"u"&&oe(G),(I=d.onPageChange)==null||I.call(d,G)},pageSizeOptions:d.pageSizeOptions,onPageSizeChange:G=>{var I;typeof d.pageSize>"u"&&$(G),(I=d.onPageSizeChange)==null||I.call(d,G)},showSummary:d.showSummary})]})}qr.displayName="GymatraDataTable";const Oa=te.Tabs.Root,Ha=te.Tabs.List,qa=te.Tabs.Tab,Va=te.Tabs.Panel,Ua=te.Tabs.Indicator,_a={sm:"h-8 px-2.5 text-sm gap-1.5",md:"h-9 px-3.5 text-sm gap-2",lg:"h-11 px-4 text-base gap-2.5"};function Ka(t,r,s,n="horizontal"){const a="inline-flex items-center justify-center font-medium transition-colors select-none outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary disabled:pointer-events-none disabled:opacity-50 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 cursor-pointer",o=_a[r],i=s?"flex-1":"";switch(t){case"line":return n==="vertical"?c(a,o,i,"justify-start border-r-2 -mr-px border-transparent text-text-muted hover:text-text hover:border-border","data-[active]:border-primary aria-selected:border-primary data-[active]:text-primary aria-selected:text-primary"):c(a,o,i,"border-b-2 -mb-px border-transparent text-text-muted hover:text-text hover:border-border","data-[active]:border-primary aria-selected:border-primary data-[active]:text-primary aria-selected:text-primary");case"pills":return c(a,o,i,"rounded-md border border-transparent text-text-muted hover:text-text hover:bg-surface-muted/60","data-[active]:bg-white aria-selected:bg-white data-[active]:text-primary aria-selected:text-primary data-[active]:border-border aria-selected:border-border");case"enclosed":return c(a,o,i,"rounded-t-md border-t border-x -mb-px border-transparent text-text-muted hover:text-text hover:bg-surface-muted/40","data-[active]:border-border aria-selected:border-border data-[active]:bg-white aria-selected:bg-white data-[active]:text-primary aria-selected:text-primary data-[active]:border-b-transparent aria-selected:border-b-transparent");case"soft":default:return c(a,o,i,"rounded-md text-text-muted hover:bg-surface-muted hover:text-text","data-[active]:bg-primary-soft aria-selected:bg-primary-soft data-[active]:text-primary aria-selected:text-primary")}}function Za(t,r="horizontal",s){if(r==="vertical")return t==="line"?"flex flex-col border-r border-border gap-1":t==="pills"?"flex flex-col rounded-lg border border-border bg-surface-muted/60 p-1 gap-1":"flex flex-col gap-1";const n=s?"w-full":"";switch(t){case"line":return c("flex items-center border-b border-border gap-2 sm:gap-6",n);case"pills":return c("inline-flex items-center rounded-lg border border-border bg-surface-muted/60 p-1 gap-1",n);case"enclosed":return c("flex items-center border-b border-border gap-1",n);case"soft":default:return c("flex items-center gap-1.5",n)}}function Qa({value:t,defaultValue:r,onValueChange:s,variant:n="line",size:a="md",orientation:o="horizontal",fullWidth:i=!1,items:l,children:m,className:u,listClassName:d,panelClassName:h}){const b=r??(l&&l.length>0?l[0].value:void 0),p=t!==void 0?{value:t}:b!==void 0?{defaultValue:b}:{};return e.jsx(te.Tabs.Root,{...p,onValueChange:x=>{typeof x=="string"&&(s==null||s(x))},orientation:o,className:c(o==="vertical"?"flex gap-6 items-start":"flex flex-col",u),children:l&&l.length>0?e.jsxs(e.Fragment,{children:[e.jsx(te.Tabs.List,{className:c(Za(n,o,i),d),children:l.map(x=>{const y=x.startIcon??x.icon;return e.jsxs(te.Tabs.Tab,{value:x.value,disabled:x.disabled,className:c(Ka(n,a,i,o)),children:[y&&e.jsx("span",{className:"shrink-0 size-4 flex items-center justify-center",children:y}),e.jsx("span",{children:x.label}),x.badge!==void 0&&e.jsx(st,{variant:x.badgeVariant??"default",size:"sm",pill:!0,className:"ml-1 text-xs px-1.5 py-0 h-4 min-w-4",children:x.badge}),x.endIcon&&e.jsx("span",{className:"shrink-0 size-4 flex items-center justify-center",children:x.endIcon})]},x.value)})}),l.map(x=>x.content?e.jsx(te.Tabs.Panel,{value:x.value,className:c("pt-4 focus-visible:outline-none",h),children:x.content},x.value):null)]}):m})}const Ya=$t.Toggle,Ja=Ot.ToggleGroup;function Vr(t="default"){switch(t){case"outline":return c("border border-border bg-white text-text","hover:bg-surface-muted hover:border-text-subtle","data-[pressed]:border-primary data-[pressed]:bg-primary-soft data-[pressed]:text-primary data-[pressed]:font-medium");case"solid":return c("bg-surface-muted text-text","hover:bg-surface-muted/80","data-[pressed]:bg-primary data-[pressed]:text-white data-[pressed]:font-medium");case"ghost":return c("bg-transparent text-text-muted","hover:bg-surface-muted hover:text-text","data-[pressed]:bg-surface-muted data-[pressed]:text-primary data-[pressed]:font-medium");case"default":default:return c("bg-surface-muted text-text","hover:bg-surface-muted/80 hover:text-text","data-[pressed]:bg-primary-soft data-[pressed]:text-primary data-[pressed]:font-medium")}}function Ur(t="md"){switch(t){case"sm":return"h-8 px-2.5 text-sm gap-1.5 rounded-md";case"lg":return"h-11 px-4 text-base gap-2.5 rounded-md";case"md":default:return"h-9.5 px-3 text-sm gap-2 rounded-md"}}const Ct=f.forwardRef(({variant:t="default",size:r="md",startIcon:s,endIcon:n,className:a,children:o,...i},l)=>e.jsxs($t.Toggle,{ref:l,className:c("inline-flex items-center justify-center select-none outline-none transition-colors shadow-none font-medium","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary","data-[disabled]:opacity-50 data-[disabled]:pointer-events-none",Ur(r),Vr(t),a),...i,children:[s&&e.jsx("span",{className:"shrink-0 size-4 flex items-center justify-center",children:s}),o&&e.jsx("span",{children:o}),n&&e.jsx("span",{className:"shrink-0 size-4 flex items-center justify-center",children:n})]}));Ct.displayName="GymatraToggle";const Xa=f.forwardRef(({options:t,value:r,defaultValue:s,onValueChange:n,size:a="md",variant:o="default",bordered:i=!0,multiple:l=!1,orientation:m="horizontal",className:u,children:d,...h},b)=>{const p=r!==void 0?Array.isArray(r)?r:[r]:void 0,x=s!==void 0?Array.isArray(s)?s:[s]:void 0,y=j=>{n&&n(l?j:j[0]??"")},g=m==="vertical";return e.jsx(Ot.ToggleGroup,{ref:b,value:p,defaultValue:x,onValueChange:y,multiple:l,orientation:m,className:c("inline-flex select-none",g?"flex-col items-stretch gap-1":"flex-row items-center gap-1",i?"rounded-md border border-border bg-white p-1 shadow-none":"bg-transparent p-0.5",u),...h,children:t&&t.length>0?t.map(j=>e.jsx(Ct,{value:j.value,size:a,variant:o,disabled:j.disabled,"aria-label":j.ariaLabel||(typeof j.label=="string"?j.label:void 0),startIcon:j.startIcon??j.icon,endIcon:j.endIcon,children:j.label},j.value)):d})}),eo=ne.Tooltip.Provider,to={dark:"bg-text text-white",light:"border border-border bg-white text-text"},ro={dark:"bg-text",light:c("border-border bg-white","data-[side=top]:border-b data-[side=top]:border-r","data-[side=bottom]:border-t data-[side=bottom]:border-l","data-[side=left]:border-t data-[side=left]:border-r","data-[side=right]:border-b data-[side=right]:border-l")},so={dark:"bg-white/15 text-white",light:"bg-surface-muted text-text-muted"};function _r({content:t,shortcut:r,children:s,side:n="top",align:a="center",sideOffset:o=8,delay:i=300,closeDelay:l=0,showArrow:m=!0,disabled:u=!1,open:d,defaultOpen:h,onOpenChange:b,className:p,variant:x="dark"}){return e.jsx(ne.Tooltip.Provider,{delay:i,closeDelay:l,children:e.jsxs(ne.Tooltip.Root,{open:d,defaultOpen:h,onOpenChange:b,disabled:u,children:[e.jsx(ne.Tooltip.Trigger,{render:s}),e.jsx(ne.Tooltip.Portal,{children:e.jsx(ne.Tooltip.Positioner,{side:n,align:a,sideOffset:o,className:"z-[10030] outline-none",children:e.jsxs(ne.Tooltip.Popup,{className:c("relative flex max-w-xs items-center gap-2 rounded-md px-2.5 py-1.5 text-xs font-medium leading-snug outline-none","origin-[var(--transform-origin)] transition-[opacity,scale] duration-150 motion-reduce:transition-none","data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:scale-95 data-[ending-style]:opacity-0",to[x],p),children:[m&&e.jsx(ne.Tooltip.Arrow,{className:c("size-2 rotate-45","data-[side=top]:-bottom-1 data-[side=bottom]:-top-1 data-[side=left]:-right-1 data-[side=right]:-left-1",ro[x])}),e.jsx("span",{className:"min-w-0",children:t}),r&&e.jsx("kbd",{className:c("shrink-0 rounded-sm px-1.5 py-0.5 font-mono text-xs font-normal",so[x]),children:r})]})})})]})})}_r.displayName="GymatraTooltip";Object.defineProperty(exports,"BaseUICheckbox",{enumerable:!0,get:()=>Je.Checkbox});Object.defineProperty(exports,"BaseUIField",{enumerable:!0,get:()=>V.Field});Object.defineProperty(exports,"BaseUIForm",{enumerable:!0,get:()=>Dt.Form});Object.defineProperty(exports,"BaseUIInput",{enumerable:!0,get:()=>Ft.Input});Object.defineProperty(exports,"BaseUISelect",{enumerable:!0,get:()=>_.Select});Object.defineProperty(exports,"BaseUISwitch",{enumerable:!0,get:()=>ke.Switch});Object.defineProperty(exports,"formatPhoneNumber",{enumerable:!0,get:()=>ae.formatPhoneNumber});Object.defineProperty(exports,"formatPhoneNumberIntl",{enumerable:!0,get:()=>ae.formatPhoneNumberIntl});Object.defineProperty(exports,"isValidPhoneNumber",{enumerable:!0,get:()=>ae.isValidPhoneNumber});exports.DRAWER_MIN_WIDTH=Ks;exports.DRAWER_SIZES=tt;exports.GYMATRA_CHART_PALETTE=Ce;exports.GymatraAccordion=Xr;exports.GymatraAccordionHeader=rs;exports.GymatraAccordionItemPrimitive=ts;exports.GymatraAccordionPanel=ns;exports.GymatraAccordionRoot=es;exports.GymatraAccordionTrigger=ss;exports.GymatraAlert=Ht;exports.GymatraAutocomplete=fn;exports.GymatraAvatar=ze;exports.GymatraAvatarGroup=Vt;exports.GymatraAvatarUpload=Rn;exports.GymatraAvatarUploadField=Sn;exports.GymatraBadge=st;exports.GymatraBarChart=fs;exports.GymatraBreadcrumb=Ut;exports.GymatraBreadcrumbEllipsis=Jt;exports.GymatraBreadcrumbItem=Kt;exports.GymatraBreadcrumbLink=Zt;exports.GymatraBreadcrumbList=_t;exports.GymatraBreadcrumbPage=Qt;exports.GymatraBreadcrumbSeparator=Yt;exports.GymatraButton=De;exports.GymatraChartCard=rr;exports.GymatraCheckbox=ot;exports.GymatraCheckboxField=jn;exports.GymatraCircularProgress=za;exports.GymatraColorPicker=Pn;exports.GymatraColorPickerField=Gr;exports.GymatraCombobox=Ds;exports.GymatraComboboxChip=Ls;exports.GymatraComboboxChipRemove=Rs;exports.GymatraComboboxChips=Ts;exports.GymatraComboboxClear=Is;exports.GymatraComboboxEmpty=lt;exports.GymatraComboboxGroup=Ps;exports.GymatraComboboxGroupLabel=ct;exports.GymatraComboboxInput=sr;exports.GymatraComboboxItem=Fe;exports.GymatraComboboxList=zs;exports.GymatraComboboxPopup=it;exports.GymatraComboboxPortal=Cs;exports.GymatraComboboxPositioner=Ss;exports.GymatraComboboxRoot=ks;exports.GymatraComboboxSeparator=Ms;exports.GymatraComboboxTrigger=Gs;exports.GymatraCurrencyInput=yr;exports.GymatraCustomSelect=mn;exports.GymatraDataTable=qr;exports.GymatraDateInput=jr;exports.GymatraDateRangeInput=xn;exports.GymatraDateTimeInput=wr;exports.GymatraDialog=fe;exports.GymatraDialogBackdrop=Os;exports.GymatraDialogClose=_s;exports.GymatraDialogComponent=ar;exports.GymatraDialogContent=qs;exports.GymatraDialogDescription=Us;exports.GymatraDialogPopup=Hs;exports.GymatraDialogPortal=$s;exports.GymatraDialogRoot=Es;exports.GymatraDialogTitle=Vs;exports.GymatraDialogTrigger=Ws;exports.GymatraDoughnutChart=hs;exports.GymatraDrawerPanel=en;exports.GymatraDrawerProvider=ir;exports.GymatraEmailInput=mr;exports.GymatraEmptyState=lr;exports.GymatraField=An;exports.GymatraFieldContainer=D;exports.GymatraFileUploadField=Gn;exports.GymatraFilterBar=xr;exports.GymatraFilterBarChip=ur;exports.GymatraFilterBarSearch=dr;exports.GymatraFilterBarSelect=dn;exports.GymatraFilterSelect=ut;exports.GymatraFloatingField=Me;exports.GymatraFloatingSelect=zr;exports.GymatraFloatingTextarea=Sr;exports.GymatraForm=Bn;exports.GymatraImageUploadField=Cn;exports.GymatraInput=Lr;exports.GymatraLineChart=ps;exports.GymatraMenu=_n;exports.GymatraMenuCheckboxItem=qe;exports.GymatraMenuGroup=Rr;exports.GymatraMenuGroupLabel=He;exports.GymatraMenuItem=$e;exports.GymatraMenuPopup=be;exports.GymatraMenuPortal=$n;exports.GymatraMenuPositioner=On;exports.GymatraMenuRadioGroup=Hn;exports.GymatraMenuRadioItem=Ve;exports.GymatraMenuRoot=En;exports.GymatraMenuSeparator=Oe;exports.GymatraMenuSubmenuRoot=qn;exports.GymatraMenuSubmenuTrigger=Ue;exports.GymatraMenuTrigger=Wn;exports.GymatraMenubar=Br;exports.GymatraMenubarCheckboxItem=aa;exports.GymatraMenubarGroup=Jn;exports.GymatraMenubarGroupLabel=na;exports.GymatraMenubarItem=ra;exports.GymatraMenubarMenu=Zn;exports.GymatraMenubarPopup=ta;exports.GymatraMenubarPortal=Qn;exports.GymatraMenubarPositioner=Yn;exports.GymatraMenubarRadioGroup=Xn;exports.GymatraMenubarRadioItem=oa;exports.GymatraMenubarRoot=Kn;exports.GymatraMenubarSeparator=sa;exports.GymatraMenubarSubmenuRoot=ea;exports.GymatraMenubarSubmenuTrigger=ia;exports.GymatraMenubarTrigger=pt;exports.GymatraMultiSelect=pn;exports.GymatraNumberInput=Pe;exports.GymatraNumericField=un;exports.GymatraOtpField=Tn;exports.GymatraOtpInput=Ln;exports.GymatraPagination=ft;exports.GymatraPasswordInput=pr;exports.GymatraPercentageInput=gr;exports.GymatraPhoneInput=hr;exports.GymatraPopover=ba;exports.GymatraPopoverArrow=Ar;exports.GymatraPopoverClose=gt;exports.GymatraPopoverDescription=yt;exports.GymatraPopoverPopup=ht;exports.GymatraPopoverPortal=pa;exports.GymatraPopoverPositioner=fa;exports.GymatraPopoverRoot=xa;exports.GymatraPopoverTitle=bt;exports.GymatraPopoverTrigger=ma;exports.GymatraProgress=Ca;exports.GymatraProgressIndicator=ja;exports.GymatraProgressLabel=va;exports.GymatraProgressRoot=ya;exports.GymatraProgressTrack=ga;exports.GymatraProgressValue=wa;exports.GymatraRadioGroupField=vn;exports.GymatraRangeField=In;exports.GymatraRichTextEditor=kn;exports.GymatraSearchInput=fr;exports.GymatraSelect=Fn;exports.GymatraSelectField=Nr;exports.GymatraSeparator=Dr;exports.GymatraSeparatorRoot=Pa;exports.GymatraSliderField=Mn;exports.GymatraSparkline=Ba;exports.GymatraStatCard=Er;exports.GymatraStep=Or;exports.GymatraStepConnector=Fa;exports.GymatraStepContent=Ea;exports.GymatraStepIndicator=Se;exports.GymatraStepper=Da;exports.GymatraSwitch=xt;exports.GymatraSwitchField=wn;exports.GymatraSwitchRoot=hn;exports.GymatraSwitchThumb=bn;exports.GymatraTab=qa;exports.GymatraTable=Hr;exports.GymatraTableBody=vt;exports.GymatraTableCell=Ne;exports.GymatraTableCheckbox=Ee;exports.GymatraTableHead=we;exports.GymatraTableHeader=jt;exports.GymatraTableRow=wt;exports.GymatraTableSkeleton=Gt;exports.GymatraTableSkeletonRow=kt;exports.GymatraTableSortHead=Nt;exports.GymatraTabs=Qa;exports.GymatraTabsIndicator=Ua;exports.GymatraTabsList=Ha;exports.GymatraTabsPanel=Va;exports.GymatraTabsRoot=Oa;exports.GymatraTextField=Cr;exports.GymatraTextInput=he;exports.GymatraTextarea=Dn;exports.GymatraTextareaField=kr;exports.GymatraTimeInput=vr;exports.GymatraToggle=Ct;exports.GymatraToggleField=Nn;exports.GymatraToggleGroup=Xa;exports.GymatraToggleGroupRoot=Ja;exports.GymatraToggleRoot=Ya;exports.GymatraTooltip=_r;exports.GymatraTooltipProvider=eo;exports.GymatraUrlInput=br;exports.SidebarContext=Js;exports.SidebarProvider=Xs;exports.cn=c;exports.getDrawerWidth=Zs;exports.getToggleSizeClasses=Ur;exports.getToggleVariantClasses=Vr;exports.gymatraAlpha=Xt;exports.renderMenuItems=_e;exports.useGymatraChartTheme=We;exports.useGymatraDrawer=or;exports.useGymatraStepper=Wr;exports.useSidebar=Ys;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),ee=require("@base-ui/react/accordion"),h=require("react"),pe=require("@base-ui/react/avatar"),X=require("chart.js"),at=require("react-chartjs-2"),et=require("@base-ui/react/checkbox"),E=require("@base-ui/react/combobox"),$=require("@base-ui/react/dialog"),H=require("@base-ui/react/popover"),_=require("@base-ui/react/field"),Wt=require("@base-ui/react/form"),$t=require("@base-ui/react/input"),K=require("@base-ui/react/select"),Ge=require("@base-ui/react/switch"),R=require("@base-ui/react/menu"),Ot=require("@base-ui/react/menubar"),te=require("@base-ui/react/progress"),Ht=require("@base-ui/react/separator"),re=require("@base-ui/react/tabs"),qt=require("@base-ui/react/toggle"),Ut=require("@base-ui/react/toggle-group"),ne=require("@base-ui/react/tooltip"),ts=require("react-phone-number-input/input"),ae=require("react-phone-number-input"),Pt=require("react-phone-number-input/flags"),Mt=require("react-phone-number-input/locale/fr.json");function rs(t){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const n=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(r,s,n.get?n:{enumerable:!0,get:()=>t[s]})}}return r.default=t,Object.freeze(r)}const fe=rs(h);function c(...t){return t.filter(Boolean).join(" ")}const ss={default:"divide-y divide-border rounded-lg border border-border bg-white",separated:"flex flex-col gap-2",flush:"divide-y divide-border"},ns={default:"",separated:"rounded-lg border border-border bg-white",flush:""},It={default:"px-4",separated:"px-4",flush:"px-0"};function as(){return e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:"size-4 shrink-0 text-text-muted transition-transform duration-200 group-data-[panel-open]:rotate-180 motion-reduce:transition-none",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function os({items:t,multiple:r=!1,value:s,defaultValue:n,onValueChange:a,variant:o="default",disabled:i=!1,headingLevel:l=3,className:m}){const u=`h${l}`;return e.jsx(ee.Accordion.Root,{multiple:r,value:s,defaultValue:n,onValueChange:a?d=>a(d):void 0,disabled:i,className:c("w-full",ss[o],m),children:t.map(d=>e.jsxs(ee.Accordion.Item,{value:d.value,disabled:d.disabled,className:ns[o],children:[e.jsx(ee.Accordion.Header,{render:e.jsx(u,{}),className:"m-0",children:e.jsxs(ee.Accordion.Trigger,{className:c("group flex w-full cursor-pointer items-center gap-3 py-3.5 text-start outline-none transition-colors",It[o],o!=="flush"&&"hover:bg-surface-muted/50",o==="separated"&&"rounded-lg data-[panel-open]:rounded-b-none","focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary","data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[disabled]:hover:bg-transparent"),children:[d.icon&&e.jsx("span",{"aria-hidden":"true",className:"flex shrink-0 text-text-muted group-data-[panel-open]:text-primary [&>svg]:size-4",children:d.icon}),e.jsxs("span",{className:"flex min-w-0 flex-1 flex-col",children:[e.jsx("span",{className:"text-sm font-medium text-text",children:d.title}),d.description&&e.jsx("span",{className:"text-xs font-normal text-text-muted",children:d.description})]}),d.meta&&e.jsx("span",{className:"shrink-0",children:d.meta}),e.jsx(as,{})]})}),e.jsx(ee.Accordion.Panel,{className:c("h-[var(--accordion-panel-height)] overflow-hidden transition-[height] duration-200 ease-out motion-reduce:transition-none","data-[starting-style]:h-0 data-[ending-style]:h-0"),children:e.jsx("div",{className:c("pb-4 text-sm leading-6 text-text-muted",It[o],!!d.icon&&(o==="flush"?"ps-7":"ps-11")),children:d.content})})]},d.value))})}const is=ee.Accordion.Root,ls=ee.Accordion.Item,cs=ee.Accordion.Header,ds=ee.Accordion.Trigger,us=ee.Accordion.Panel,we=t=>e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:t}),xs={info:we(e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 11v5M12 8h.01"})]})),neutral:we(e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 11v5M12 8h.01"})]})),success:we(e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]})),warning:we(e.jsxs(e.Fragment,{children:[e.jsx("path",{d:"M10.3 4.3 2.6 18a2 2 0 0 0 1.7 3h15.4a2 2 0 0 0 1.7-3L13.7 4.3a2 2 0 0 0-3.4 0Z"}),e.jsx("path",{d:"M12 9.5v4M12 17h.01"})]})),danger:we(e.jsxs(e.Fragment,{children:[e.jsx("circle",{cx:"12",cy:"12",r:"9"}),e.jsx("path",{d:"M12 7.5v5M12 16h.01"})]}))},ms={info:"text-info",success:"text-success",warning:"text-warning",danger:"text-danger",neutral:"text-text-muted"},ps={soft:{info:"bg-info-soft",success:"bg-success-soft",warning:"bg-warning-soft",danger:"bg-danger-soft",neutral:"bg-surface-muted"},outline:{info:"border border-border bg-white",success:"border border-border bg-white",warning:"border border-border bg-white",danger:"border border-border bg-white",neutral:"border border-border bg-white"}},Vt=h.forwardRef(({tone:t="info",variant:r="soft",title:s,description:n,icon:a,action:o,onClose:i,closeLabel:l="Fermer",className:m,children:u,role:d,...b},y)=>{const p=a===void 0?xs[t]:a,x=n??u;return e.jsxs("div",{ref:y,role:d??(t==="danger"||t==="warning"?"alert":"status"),className:c("flex w-full items-start gap-3 rounded-lg px-4 py-3",ps[r][t],m),...b,children:[p!==null&&e.jsx("span",{"aria-hidden":"true",className:c("mt-0.5 flex size-5 shrink-0 [&>svg]:size-5",ms[t]),children:p}),e.jsxs("div",{className:"min-w-0 flex-1 space-y-0.5",children:[s&&e.jsx("p",{className:"text-sm font-semibold text-text",children:s}),x&&e.jsx("div",{className:"text-sm leading-6 text-text-muted",children:x})]}),o&&e.jsx("div",{className:"flex shrink-0 items-center gap-2 self-center",children:o}),i&&e.jsx("button",{type:"button",onClick:i,"aria-label":l,className:"-me-1 flex size-7 shrink-0 cursor-pointer items-center justify-center self-start rounded-md text-text-muted transition-colors hover:bg-white hover:text-text motion-reduce:transition-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",className:"size-4","aria-hidden":"true",children:e.jsx("path",{d:"M6 6l12 12M18 6 6 18"})})})]})});Vt.displayName="GymatraAlert";const _t=h.createContext(null),tt={xs:{root:"size-6 text-xs",status:"size-1.5 ring-1"},sm:{root:"size-8 text-xs",status:"size-2 ring-1.5"},md:{root:"size-10 text-sm",status:"size-2.5 ring-2"},lg:{root:"size-12 text-base",status:"size-3 ring-2"},xl:{root:"size-16 text-lg",status:"size-3.5 ring-2"},"2xl":{root:"size-20 text-2xl",status:"size-4 ring-2"}},rt={circle:"rounded-full",square:"rounded-lg"},Tt={primary:"bg-primary-soft text-primary",secondary:"bg-surface-muted text-text",success:"bg-success-soft text-success",warning:"bg-warning-soft text-warning",danger:"bg-danger-soft text-danger",info:"bg-info-soft text-info",neutral:"bg-surface-muted text-text-muted"},fs={online:"bg-success",busy:"bg-danger",away:"bg-warning",offline:"bg-text-subtle"};function hs(t){if(!t)return"";const r=t.trim().split(/\s+/).filter(Boolean);return r.length===0?"":r.length===1?r[0].slice(0,2).toUpperCase():(r[0][0]+r[r.length-1][0]).toUpperCase()}function bs({className:t}){return e.jsxs("svg",{className:c("size-1/2 opacity-65",t),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"12",cy:"7",r:"4"})]})}function ze({src:t,alt:r="Avatar",name:s,fallback:n,size:a,shape:o,variant:i="primary",status:l,statusPosition:m="bottom-right",bordered:u=!1,delayMs:d=0,className:b,children:y,...p}){const x=h.useContext(_t),f=a??(x==null?void 0:x.size)??"md",g=o??(x==null?void 0:x.shape)??"circle",j=tt[f]??tt.md,k=rt[g]??rt.circle,v=Tt[i]??Tt.primary,N=s?hs(s):void 0,S=n??N??e.jsx(bs,{});return e.jsxs("span",{className:c("relative inline-flex shrink-0 select-none",b),...p,children:[e.jsx(pe.Avatar.Root,{className:c("flex items-center justify-center overflow-hidden font-medium transition-all",j.root,k,v,u&&"border border-border",x&&"ring-2 ring-white"),children:y||e.jsxs(e.Fragment,{children:[t&&e.jsx(pe.Avatar.Image,{src:t,alt:r||s||"Avatar",className:"size-full object-cover"}),e.jsx(pe.Avatar.Fallback,{delay:d,className:"flex size-full items-center justify-center uppercase tracking-wider",children:S})]})}),l&&e.jsx("span",{className:c("absolute rounded-full ring-white",j.status,fs[l],m==="bottom-right"&&(g==="circle"?"bottom-0 end-0 translate-x-[1px] translate-y-[1px]":"bottom-[-2px] end-[-2px]"),m==="top-right"&&(g==="circle"?"top-0 end-0 translate-x-[1px] -translate-y-[1px]":"top-[-2px] end-[-2px]")),"aria-hidden":"true"})]})}const ys={xs:"-space-x-1.5",sm:"-space-x-2",md:"-space-x-2.5",lg:"-space-x-3",xl:"-space-x-4","2xl":"-space-x-5"};function Kt({children:t,max:r,size:s="md",shape:n="circle",spacing:a="tight",className:o,...i}){const l=h.Children.toArray(t).filter(h.isValidElement),m=l.length,u=r!==void 0&&r>=0&&m>r,d=u?l.slice(0,r):l,b=u?m-r:0,y=a==="tight"?ys[s]:a==="normal"?"-space-x-1":"space-x-1";return e.jsx(_t.Provider,{value:{size:s,shape:n},children:e.jsxs("div",{role:"group","aria-label":`Groupe de ${m} avatars`,className:c("inline-flex items-center",y,o),...i,children:[d.map(p=>e.jsx("span",{className:"relative inline-flex hover:z-10",children:p},p.key)),b>0&&e.jsxs("span",{role:"img","aria-label":`${b} autre${b>1?"s":""}`,title:`${b} autre${b>1?"s":""}`,className:c("relative inline-flex shrink-0 select-none items-center justify-center bg-surface-muted font-medium text-text-muted ring-2 ring-white",tt[s].root,rt[n]),children:["+",b]})]})})}ze.Root=pe.Avatar.Root;ze.Image=pe.Avatar.Image;ze.Fallback=pe.Avatar.Fallback;ze.Group=Kt;const gs={default:"bg-surface-muted text-text-muted",primary:"bg-primary-soft text-primary",secondary:"bg-surface text-text",outline:"bg-transparent text-text border border-border",success:"bg-success-soft text-success",warning:"bg-warning-soft text-warning",danger:"bg-danger-soft text-danger",info:"bg-info-soft text-info"},js={sm:"h-5 px-2 text-xs gap-1",md:"h-6 px-2.5 text-xs gap-1.5",lg:"h-7 px-3 text-xs font-medium gap-1.5"},ot=h.forwardRef(({variant:t="default",size:r="md",pill:s=!0,dot:n=!1,check:a=!1,circle:o=!1,startIcon:i,endIcon:l,className:m,children:u,...d},b)=>e.jsxs("span",{ref:b,className:c("inline-flex items-center justify-center font-medium border-0 select-none transition-colors",s?"rounded-full":"rounded-md",gs[t],js[r],m),...d,children:[o||n?e.jsx("span",{className:c("rounded-full border-2 border-current shrink-0",r==="sm"?"size-2":"size-2.5"),"aria-hidden":"true"}):a?e.jsx("svg",{className:c("shrink-0",r==="sm"?"size-3":r==="lg"?"size-3.5":"size-3"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}):null,i&&e.jsx("span",{className:"inline-flex shrink-0 items-center justify-center","aria-hidden":"true",children:i}),u&&e.jsx("span",{className:"truncate",children:u}),l&&e.jsx("span",{className:"inline-flex shrink-0 items-center justify-center","aria-hidden":"true",children:l})]}));ot.displayName="GymatraBadge";function Zt({items:t,separator:r="/",className:s,...n}){return e.jsx("nav",{"aria-label":"Breadcrumb",className:c("inline-block",s),...n,children:e.jsx("ol",{className:"flex flex-wrap items-center gap-1.5 text-sm text-text-muted m-0 p-0 list-none",children:t.map((a,o)=>{const i=o===t.length-1;return e.jsxs("li",{className:"inline-flex items-center gap-1.5",children:[!i&&a.href?e.jsxs("a",{href:a.href,onClick:a.onClick,className:"inline-flex items-center gap-1.5 rounded px-0.5 text-sm text-text-muted transition-colors hover:text-text outline-none focus-visible:outline-2 focus-visible:outline-primary",children:[a.icon,e.jsx("span",{children:a.label})]}):e.jsxs("span",{className:c("inline-flex items-center gap-1.5 px-0.5 text-sm",i?"font-medium text-text":"text-text-muted"),"aria-current":i?"page":void 0,children:[a.icon,e.jsx("span",{children:a.label})]}),!i&&e.jsx("span",{className:"text-xs text-text-subtle select-none px-0.5","aria-hidden":"true",children:r})]},o)})})})}Zt.displayName="GymatraBreadcrumb";function Qt({className:t,...r}){return e.jsx("ol",{className:c("flex flex-wrap items-center gap-1.5 text-sm text-text-muted m-0 p-0 list-none",t),...r})}Qt.displayName="GymatraBreadcrumbList";function Yt({className:t,...r}){return e.jsx("li",{className:c("inline-flex items-center gap-1.5",t),...r})}Yt.displayName="GymatraBreadcrumbItem";function Jt({className:t,...r}){return e.jsx("a",{className:c("inline-flex items-center gap-1.5 rounded px-0.5 text-sm text-text-muted transition-colors hover:text-text outline-none focus-visible:outline-2 focus-visible:outline-primary",t),...r})}Jt.displayName="GymatraBreadcrumbLink";function Xt({className:t,...r}){return e.jsx("span",{"aria-current":"page",className:c("inline-flex items-center gap-1.5 px-0.5 text-sm font-medium text-text",t),...r})}Xt.displayName="GymatraBreadcrumbPage";function er({children:t="/",className:r,...s}){return e.jsx("span",{"aria-hidden":"true",className:c("text-xs text-text-subtle select-none px-0.5",r),...s,children:t})}er.displayName="GymatraBreadcrumbSeparator";function tr({className:t,...r}){return e.jsx("span",{"aria-hidden":"true",className:c("flex size-6 items-center justify-center text-text-muted select-none text-xs font-medium",t),...r,children:"…"})}tr.displayName="GymatraBreadcrumbEllipsis";X.Chart.register(X.CategoryScale,X.LinearScale,X.PointElement,X.LineElement,X.BarElement,X.ArcElement,X.Filler,X.Legend,X.Tooltip);const Ce=["#3563c9","#f47230","#00b894","#f2a600","#ee7fac","#008a17","#6a4ce2","#ec4647"],de={primary:"#224086",text:"#172033",textMuted:"#667085",border:"#e1e5ed",surface:"#ffffff"};function Lt(){if(typeof window>"u")return de;const t=getComputedStyle(document.documentElement),r=(s,n)=>t.getPropertyValue(s).trim()||n;return{primary:r("--color-primary",de.primary),text:r("--color-text",de.text),textMuted:r("--color-text-muted",de.textMuted),border:r("--color-border",de.border),surface:de.surface}}function $e(){const[t,r]=fe.useState(de);return fe.useEffect(()=>{r(Lt());const s=new MutationObserver(()=>r(Lt()));return s.observe(document.documentElement,{attributes:!0,attributeFilter:["style","class","data-theme"]}),()=>s.disconnect()},[]),t}function rr(t,r){const s=t.replace("#","");if(!/^[0-9a-f]{6}$/i.test(s))return t;const[n,a,o]=[0,2,4].map(i=>parseInt(s.slice(i,i+2),16));return`rgba(${n}, ${a}, ${o}, ${r})`}const sr=(t,r,s)=>t[r].color??(t.length===1?s.primary:Ce[r%Ce.length]);function it(t){return{backgroundColor:t.surface,titleColor:t.text,bodyColor:t.text,borderColor:t.border,borderWidth:1,padding:10,cornerRadius:6,boxWidth:8,boxHeight:8,boxPadding:4,usePointStyle:!0,titleFont:{size:12,weight:600},bodyFont:{size:12}}}function nr(t,r){return{display:r,position:"bottom",align:"start",labels:{color:t.textMuted,usePointStyle:!0,pointStyle:"circle",boxWidth:8,boxHeight:8,padding:16,font:{size:12}}}}function lt({title:t,labels:r,series:s,formatValue:n}){const a=n??(o=>String(o));return e.jsxs("table",{className:"sr-only",children:[e.jsx("caption",{children:t}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",children:"—"}),s.map(o=>e.jsx("th",{scope:"col",children:o.label},o.label))]})}),e.jsx("tbody",{children:r.map((o,i)=>e.jsxs("tr",{children:[e.jsx("th",{scope:"row",children:o}),s.map(l=>e.jsx("td",{children:l.data[i]!=null?a(l.data[i]):"—"},l.label))]},o))})]})}function vs({labels:t,series:r,title:s,height:n=240,formatValue:a,legend:o="auto",area:i=!1,curved:l=!0,className:m}){const u=$e(),d=o==="auto"?r.length>1:o,b=a??(p=>String(p)),y={responsive:!0,maintainAspectRatio:!1,interaction:{mode:"index",intersect:!1},plugins:{legend:nr(u,d),tooltip:{...it(u),callbacks:{label:p=>` ${p.dataset.label} : ${b(Number(p.raw))}`}}},scales:{x:{grid:{display:!1},border:{color:u.border},ticks:{color:u.textMuted,font:{size:12},maxRotation:0,autoSkipPadding:16}},y:{beginAtZero:!0,grid:{color:u.border},border:{display:!1},ticks:{color:u.textMuted,font:{size:12},maxTicksLimit:5,callback:p=>b(Number(p))}}}};return e.jsxs("div",{className:c("relative w-full",m),style:{height:n},children:[e.jsx(at.Line,{role:"img","aria-label":s,options:y,data:{labels:[...t],datasets:r.map((p,x)=>{const f=sr(r,x,u);return{label:p.label,data:[...p.data],borderColor:f,backgroundColor:i?rr(f,.08):f,fill:i,borderWidth:2,tension:l?.35:0,pointRadius:0,pointHoverRadius:5,pointHoverBackgroundColor:f,pointHoverBorderColor:u.surface,pointHoverBorderWidth:2}})}}),e.jsx(lt,{title:s,labels:t,series:r,formatValue:a})]})}function ws({labels:t,series:r,title:s,height:n=240,formatValue:a,legend:o="auto",horizontal:i=!1,stacked:l=!1,className:m}){const u=$e(),d=o==="auto"?r.length>1:o,b=a??(f=>String(f)),y=i?"x":"y",p=i?"y":"x",x={responsive:!0,maintainAspectRatio:!1,indexAxis:i?"y":"x",interaction:{mode:"index",intersect:!1},plugins:{legend:nr(u,d),tooltip:{...it(u),callbacks:{label:f=>` ${f.dataset.label} : ${b(Number(f.raw))}`}}},scales:{[p]:{stacked:l,grid:{display:!1},border:{color:u.border},ticks:{color:i?u.text:u.textMuted,font:{size:12},maxRotation:0,autoSkipPadding:12}},[y]:{stacked:l,beginAtZero:!0,grid:{color:u.border},border:{display:!1},ticks:{color:u.textMuted,font:{size:12},maxTicksLimit:5,callback:f=>b(Number(f))}}}};return e.jsxs("div",{className:c("relative w-full",m),style:{height:n},children:[e.jsx(at.Bar,{role:"img","aria-label":s,options:x,data:{labels:[...t],datasets:r.map((f,g)=>{const j=sr(r,g,u),k=g===r.length-1;return{label:f.label,data:[...f.data],backgroundColor:j,hoverBackgroundColor:j,borderRadius:l&&!k?0:4,borderSkipped:"start",borderColor:u.surface,borderWidth:l?{[i?"right":"top"]:2}:0,maxBarThickness:28,categoryPercentage:.7,barPercentage:r.length>1&&!l?.72:.9}})}}),e.jsx(lt,{title:s,labels:t,series:r,formatValue:a})]})}function Ns({data:t,title:r,centerValue:s,centerLabel:n,size:a=180,formatValue:o,showList:i=!0,className:l}){const m=$e(),u=o??(p=>String(p)),d=t.reduce((p,x)=>p+x.value,0),b=t.map((p,x)=>p.color??Ce[x%Ce.length]),y={responsive:!0,maintainAspectRatio:!1,cutout:"72%",plugins:{legend:{display:!1},tooltip:{...it(m),callbacks:{label:p=>{const x=Number(p.raw),f=d?Math.round(x/d*100):0;return` ${p.label} : ${u(x)} (${f} %)`}}}}};return e.jsxs("div",{className:c("flex flex-wrap items-center gap-6",l),children:[e.jsxs("div",{className:"relative shrink-0",style:{width:a,height:a},children:[e.jsx(at.Doughnut,{role:"img","aria-label":r,options:y,data:{labels:t.map(p=>p.label),datasets:[{data:t.map(p=>p.value),backgroundColor:b,hoverBackgroundColor:b,borderColor:m.surface,borderWidth:2,hoverOffset:4}]}}),e.jsxs("div",{className:"pointer-events-none absolute inset-0 flex flex-col items-center justify-center text-center",children:[e.jsx("span",{className:"text-2xl font-semibold tabular-nums text-text",children:s??u(d)}),n&&e.jsx("span",{className:"text-xs text-text-muted",children:n})]})]}),i&&e.jsx("ul",{className:"min-w-40 flex-1 space-y-2",children:t.map((p,x)=>e.jsxs("li",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"size-2 shrink-0 rounded-full",style:{backgroundColor:b[x]},"aria-hidden":"true"}),e.jsx("span",{className:"min-w-0 flex-1 truncate text-text",children:p.label}),e.jsx("span",{className:"tabular-nums text-text",children:u(p.value)}),e.jsxs("span",{className:"w-10 text-end tabular-nums text-text-muted",children:[d?Math.round(p.value/d*100):0," %"]})]},p.label))}),e.jsx(lt,{title:r,labels:t.map(p=>p.label),series:[{label:r,data:t.map(p=>p.value)}],formatValue:o})]})}const ar=fe.forwardRef(({title:t,description:r,action:s,variant:n="outline",className:a,children:o,...i},l)=>{const m=fe.useId();return e.jsxs("section",{ref:l,"aria-labelledby":m,className:c("flex min-w-0 flex-col gap-4",n==="outline"&&"rounded-lg border border-border bg-white px-4 py-3.5",a),...i,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h3",{id:m,className:"truncate text-sm font-semibold text-text",children:t}),r&&e.jsx("p",{className:"truncate text-xs text-text-muted",children:r})]}),s&&e.jsx("div",{className:"flex shrink-0 items-center gap-2",children:s})]}),o]})});ar.displayName="GymatraChartCard";const Rt={primary:"bg-primary text-white hover:bg-primary-hover active:bg-primary-active focus-visible:outline-primary shadow-none border-0",secondary:"bg-surface-muted text-text hover:bg-border/60 active:bg-border focus-visible:outline-primary shadow-none border-0",outline:"bg-transparent text-text border border-border hover:bg-surface-muted hover:text-text active:bg-border/40 focus-visible:outline-primary shadow-none",soft:"bg-primary-soft text-primary hover:bg-primary-soft/70 active:bg-primary/15 focus-visible:outline-primary shadow-none border-0",ghost:"bg-transparent text-text-muted hover:text-text hover:bg-surface-muted active:bg-border/40 focus-visible:outline-primary shadow-none border-0",danger:"bg-danger text-white hover:bg-danger/90 active:bg-danger/80 focus-visible:outline-danger shadow-none border-0",success:"bg-success text-white hover:bg-success/90 active:bg-success/80 focus-visible:outline-success shadow-none border-0",warning:"bg-warning text-white hover:bg-warning/90 active:bg-warning/80 focus-visible:outline-warning shadow-none border-0",info:"bg-info text-white hover:bg-info/90 active:bg-info/80 focus-visible:outline-info shadow-none border-0","outline-primary":"bg-transparent text-primary border border-primary/40 hover:bg-primary-soft hover:border-primary active:bg-primary/15 focus-visible:outline-primary shadow-none","outline-danger":"bg-transparent text-danger border border-danger/40 hover:bg-danger-soft hover:border-danger active:bg-danger/15 focus-visible:outline-danger shadow-none","outline-warning":"bg-transparent text-warning border border-warning/40 hover:bg-warning-soft hover:border-warning active:bg-warning/15 focus-visible:outline-warning shadow-none","outline-success":"bg-transparent text-success border border-success/40 hover:bg-success-soft hover:border-success active:bg-success/15 focus-visible:outline-success shadow-none","outline-info":"bg-transparent text-info border border-info/40 hover:bg-info-soft hover:border-info active:bg-info/15 focus-visible:outline-info shadow-none"},ks={xs:"h-7 px-2.5 text-xs gap-1.5",sm:"h-8 px-3 text-sm gap-1.5",md:"h-10 px-4 text-sm gap-2",lg:"h-11 px-5 text-sm gap-2.5",xl:"h-12 px-6 text-base gap-3",icon:"size-9 p-0 justify-center text-sm gap-0"},Gs={normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},Cs={xs:"size-3.5",sm:"size-4",md:"size-4",lg:"size-4.5",xl:"size-5",icon:"size-4.5"};function Ss(t,r){if(r&&r!=="default"){if(t==="outline")return`outline-${r}`;if(t==="primary")return r}return t}const Fe=h.forwardRef(({variant:t="primary",color:r,size:s="md",weight:n="medium",pill:a=!1,fullWidth:o=!1,startIcon:i,endIcon:l,loading:m=!1,loadingText:u,disabled:d,children:b,className:y,type:p="button",...x},f)=>{const g=d||m,j=Cs[s],k=Ss(t,r);return e.jsx("button",{ref:f,type:p,disabled:g,"aria-busy":m?!0:void 0,className:c("inline-flex cursor-pointer items-center justify-center transition-all duration-150 select-none",a?"rounded-full":s==="xs"?"rounded":s==="xl"?"rounded-lg":"rounded-md",o?"w-full":"",Gs[n],"focus-visible:outline-2 focus-visible:outline-offset-2 disabled:pointer-events-none disabled:opacity-50",Rt[k]||Rt.primary,ks[s],y),...x,children:m?e.jsxs(e.Fragment,{children:[e.jsxs("svg",{className:c("animate-spin shrink-0",j),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[e.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),e.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),u?e.jsx("span",{children:u}):b?e.jsx("span",{children:b}):null]}):e.jsxs(e.Fragment,{children:[i&&e.jsx("span",{className:c("inline-flex shrink-0 items-center justify-center",j),"aria-hidden":"true",children:i}),b&&e.jsx("span",{children:b}),l&&e.jsx("span",{className:c("inline-flex shrink-0 items-center justify-center",j),"aria-hidden":"true",children:l})]})})});Fe.displayName="GymatraButton";const zs={sm:{box:"size-3.5",icon:"size-2.5",offset:"mt-[3px]"},md:{box:"size-4",icon:"size-3",offset:"mt-0.5"},lg:{box:"size-5",icon:"size-3.5",offset:"mt-0"}};function Ps({className:t}){return e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round",className:t,"aria-hidden":"true",children:e.jsx("path",{d:"M20 6 9 17l-5-5"})})}function Ms({className:t}){return e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.5",strokeLinecap:"round","aria-hidden":"true",className:t,children:e.jsx("path",{d:"M5 12h14"})})}const ct=h.forwardRef(({label:t,description:r,size:s="md",invalid:n=!1,indeterminate:a=!1,disabled:o=!1,onChange:i,onCheckedChange:l,className:m,wrapperClassName:u,...d},b)=>{const y=zs[s],p=e.jsx(et.Checkbox.Root,{ref:b,indeterminate:a,disabled:o,"aria-invalid":n||void 0,onCheckedChange:(x,f)=>{l==null||l(x,f),i==null||i(x)},className:c("inline-flex shrink-0 cursor-pointer items-center justify-center rounded-sm border border-border-strong bg-white text-white outline-none transition-colors motion-reduce:transition-none","hover:border-text-subtle","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary","data-[checked]:border-primary data-[checked]:bg-primary data-[indeterminate]:border-primary data-[indeterminate]:bg-primary","aria-[invalid=true]:border-danger aria-[invalid=true]:focus-visible:outline-danger","data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50 data-[disabled]:hover:border-border-strong",y.box,!!(t||r)&&y.offset,m),...d,children:e.jsx(et.Checkbox.Indicator,{className:"flex items-center justify-center",keepMounted:!1,children:a?e.jsx(Ms,{className:y.icon}):e.jsx(Ps,{className:y.icon})})});return!t&&!r?p:e.jsxs("label",{className:c("inline-flex select-none items-start gap-2.5",o?"cursor-not-allowed":"cursor-pointer",u),children:[p,e.jsxs("span",{className:"flex min-w-0 flex-col",children:[t&&e.jsx("span",{className:c("text-sm font-medium leading-5",o?"text-text-subtle":"text-text"),children:t}),r&&e.jsx("span",{className:"text-xs leading-normal text-text-muted",children:r})]})]})});ct.displayName="GymatraCheckbox";const Is=E.Combobox.Root,Ts=E.Combobox.Trigger,Ls=E.Combobox.Portal,Rs=E.Combobox.Positioner,Bs=E.Combobox.List,As=E.Combobox.Group,Ds=E.Combobox.Separator,Fs=E.Combobox.Clear,Es=E.Combobox.Chips,Ws=E.Combobox.Chip,$s=E.Combobox.ChipRemove,or=h.forwardRef(({className:t,startIcon:r,error:s,disabled:n,...a},o)=>e.jsxs("div",{className:c("relative flex items-center w-full h-10 rounded-md border bg-white transition-colors",n?"border-border bg-surface-muted opacity-50 cursor-not-allowed":s?"border-danger focus-within:border-danger focus-within:ring-1 focus-within:ring-danger":"border-border hover:border-text-subtle focus-within:border-primary focus-within:ring-1 focus-within:ring-primary"),children:[r&&e.jsx("span",{className:"shrink-0 pl-3 text-text-subtle pointer-events-none flex items-center justify-center",children:r}),e.jsx(E.Combobox.Input,{ref:o,disabled:n,className:c("h-full w-full bg-transparent px-3.5 py-2 text-sm text-text placeholder:text-text-subtle outline-none border-0 ring-0 shadow-none focus:outline-none focus:ring-0 focus:border-0",t),...a}),e.jsx("span",{className:"shrink-0 pr-3 text-text-subtle pointer-events-none flex items-center justify-center",children:e.jsx("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})})]}));or.displayName="GymatraComboboxInput";const dt=h.forwardRef(({className:t,children:r,...s},n)=>e.jsx(E.Combobox.Popup,{ref:n,className:c("z-50 min-w-[var(--anchor-width)] max-h-64 overflow-y-auto rounded-lg border border-border bg-white p-1 text-sm text-text outline-none shadow-none",t),...s,children:r}));dt.displayName="GymatraComboboxPopup";function Os({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}const Ee=h.forwardRef(({className:t,children:r,icon:s,description:n,...a},o)=>e.jsxs(E.Combobox.Item,{ref:o,className:c("group relative flex w-full cursor-pointer select-none items-center justify-between gap-2 rounded-md px-2.5 py-1.5 text-sm text-text outline-none transition-colors","data-[disabled]:pointer-events-none data-[disabled]:opacity-50","data-[highlighted]:bg-surface-muted data-[highlighted]:text-text","data-[selected]:font-medium data-[selected]:text-primary",t),...a,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s&&e.jsx("span",{className:"shrink-0 size-4 text-text-muted flex items-center justify-center",children:s}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate",children:r}),n&&e.jsx("div",{className:"text-xs text-text-muted truncate",children:n})]})]}),e.jsx(E.Combobox.ItemIndicator,{className:"shrink-0 size-4 flex items-center justify-center text-primary",children:e.jsx(Os,{})})]}));Ee.displayName="GymatraComboboxItem";const ut=h.forwardRef(({className:t,children:r,...s},n)=>e.jsx(E.Combobox.Empty,{ref:n,className:c("px-3 py-2 text-sm text-text-muted text-center",t),...s,children:r??"Aucun résultat trouvé"}));ut.displayName="GymatraComboboxEmpty";const xt=h.forwardRef(({className:t,...r},s)=>e.jsx(E.Combobox.GroupLabel,{ref:s,className:c("px-2.5 py-1 text-xs font-semibold uppercase tracking-wider text-text-muted select-none",t),...r}));xt.displayName="GymatraComboboxGroupLabel";function Hs(t){return t.map(r=>typeof r=="string"?{value:r,label:r}:r)}function qs({label:t,helperText:r,error:s,options:n,value:a,defaultValue:o,onValueChange:i,onChange:l,placeholder:m="Rechercher ou sélectionner...",emptyText:u="Aucun résultat trouvé",disabled:d=!1,required:b=!1,className:y,startIcon:p}){const x=Hs(n),f=x.some(v=>!!v.group),g={};f&&x.forEach(v=>{const N=v.group||"Autres";g[N]||(g[N]=[]),g[N].push(v)});const j=v=>{i==null||i(v),l==null||l(v)},k=a!==void 0?{value:a,onValueChange:j,items:x}:o!==void 0?{defaultValue:o,onValueChange:j,items:x}:{onValueChange:j,items:x};return e.jsxs("div",{className:c("w-full space-y-1.5",y),children:[t&&e.jsxs("label",{className:"block text-xs font-medium text-text-muted",children:[t,b&&e.jsx("span",{className:"text-danger ml-0.5",children:"*"})]}),e.jsxs(E.Combobox.Root,{...k,disabled:d,children:[e.jsxs("div",{className:c("relative flex items-center w-full h-10 rounded-md border bg-white transition-colors",d?"border-border bg-surface-muted opacity-50 cursor-not-allowed":s?"border-danger focus-within:border-danger focus-within:ring-1 focus-within:ring-danger":"border-border hover:border-text-subtle focus-within:border-primary focus-within:ring-1 focus-within:ring-primary"),children:[p&&e.jsx("span",{className:"shrink-0 pl-3 text-text-subtle pointer-events-none flex items-center justify-center",children:p}),e.jsx(E.Combobox.Input,{placeholder:m,disabled:d,className:"h-full w-full bg-transparent px-3.5 py-2 text-sm text-text placeholder:text-text-subtle outline-none border-0 ring-0 shadow-none focus:outline-none focus:ring-0 focus:border-0"}),e.jsx("span",{className:"shrink-0 pr-3 text-text-subtle pointer-events-none flex items-center justify-center",children:e.jsx("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})})]}),e.jsx(E.Combobox.Portal,{children:e.jsx(E.Combobox.Positioner,{sideOffset:4,className:"z-[10020] outline-none",children:e.jsxs(dt,{children:[e.jsx(ut,{children:u}),e.jsx(E.Combobox.List,{children:f?Object.entries(g).map(([v,N])=>e.jsxs(E.Combobox.Group,{children:[e.jsx(xt,{children:v}),N.map(S=>e.jsx(Ee,{value:S.value,disabled:S.disabled,icon:S.icon,description:S.description,children:S.label},S.value))]},v)):x.map(v=>e.jsx(Ee,{value:v.value,disabled:v.disabled,icon:v.icon,description:v.description,children:v.label},v.value))})]})})})]}),s?e.jsx("p",{className:"text-xs text-danger",children:s}):r?e.jsx("p",{className:"text-xs text-text-muted",children:r}):null]})}const ir={sm:"max-w-[420px]",md:"max-w-lg",lg:"max-w-xl",xl:"max-w-2xl"};function Us({variant:t}){switch(t){case"danger":case"delete":return e.jsx("svg",{className:"size-12 text-danger stroke-[1.5]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})});case"warning":return e.jsx("svg",{className:"size-12 text-warning stroke-[1.5]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126zM12 15.75h.007v.008H12v-.008z"})});case"success":return e.jsx("svg",{className:"size-12 text-success stroke-[1.5]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})});case"info":return e.jsx("svg",{className:"size-12 text-info stroke-[1.5]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"})});case"primary":return e.jsx("svg",{className:"size-12 text-primary stroke-[1.5]",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","aria-hidden":"true",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"})});default:return null}}function lr({open:t,defaultOpen:r,onOpenChange:s,trigger:n,variant:a="default",size:o="sm",title:i,description:l,icon:m,align:u="center",children:d,confirmLabel:b,onConfirm:y,confirmVariant:p,cancelLabel:x="Annuler",onCancel:f,loading:g=!1,confirmDisabled:j=!1,showCloseButton:k=!1,footer:v,className:N}){const S=a==="danger"||a==="delete",G=b??(y?S?"Supprimer":"Confirmer":void 0),z=m===!1?null:m!==void 0?m:e.jsx(Us,{variant:a}),w=()=>p||(S?"danger":a==="warning"?"warning":a==="success"?"success":a==="info"?"info":"primary"),P=e.jsxs($.Dialog.Portal,{children:[e.jsx($.Dialog.Backdrop,{className:"fixed inset-0 z-[10010] bg-around/40 transition-opacity duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0"}),e.jsxs($.Dialog.Popup,{className:c("fixed left-1/2 top-1/2 z-[10010] -translate-x-1/2 -translate-y-1/2","w-[calc(100%-2rem)] bg-white rounded-lg border border-border p-6 shadow-none","flex flex-col focus:outline-none transition-all duration-150","data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0",ir[o],u==="center"?"items-center text-center":"items-start text-left",N),children:[k&&e.jsx($.Dialog.Close,{className:"size-8 inline-flex items-center justify-center absolute right-3.5 top-3.5 rounded-md text-text-muted hover:bg-surface-muted hover:text-text cursor-pointer transition-colors focus-visible:outline-primary","aria-label":"Fermer",onClick:f,children:e.jsxs("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),z&&e.jsx("div",{className:"flex items-center justify-center mb-3 text-center",children:z}),i&&e.jsx($.Dialog.Title,{className:c("text-lg font-semibold text-text leading-snug",u==="center"?"text-center":"text-left"),children:i}),l&&e.jsx($.Dialog.Description,{className:c("text-sm text-text-muted mt-2 leading-relaxed",u==="center"?"text-center":"text-left"),children:l}),d&&e.jsx("div",{className:"mt-4 w-full text-left",children:d}),v!==void 0?v:(G||x)&&e.jsxs("div",{className:c("w-full mt-6",x&&G?"grid grid-cols-2 gap-3":"flex justify-end gap-3"),children:[x&&e.jsx($.Dialog.Close,{render:e.jsx(Fe,{variant:"outline",size:"md",className:"w-full text-sm font-medium",onClick:f,disabled:g,children:x})}),G&&e.jsx(Fe,{variant:w(),size:"md",className:"w-full text-sm font-medium",onClick:y,loading:g,disabled:j||g,children:G})]})]})]});return e.jsxs($.Dialog.Root,{open:t,defaultOpen:r,onOpenChange:s,children:[n&&e.jsx($.Dialog.Trigger,{render:n}),P]})}const he=Object.assign(lr,{Root:$.Dialog.Root,Trigger:$.Dialog.Trigger,Portal:$.Dialog.Portal,Backdrop:h.forwardRef(function({className:r,...s},n){return e.jsx($.Dialog.Backdrop,{ref:n,className:c("fixed inset-0 z-[10010] bg-around/40 transition-opacity duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0",r),...s})}),Popup:h.forwardRef(function({className:r,size:s="sm",...n},a){return e.jsx($.Dialog.Popup,{ref:a,className:c("fixed left-1/2 top-1/2 z-[10010] -translate-x-1/2 -translate-y-1/2","w-[calc(100%-2rem)] bg-white rounded-lg border border-border p-6 shadow-none","flex flex-col focus:outline-none transition-all duration-150","data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0",ir[s],r),...n})}),Title:h.forwardRef(function({className:r,...s},n){return e.jsx($.Dialog.Title,{ref:n,className:c("text-lg font-semibold text-text leading-snug",r),...s})}),Description:h.forwardRef(function({className:r,...s},n){return e.jsx($.Dialog.Description,{ref:n,className:c("text-sm text-text-muted mt-2 leading-relaxed",r),...s})}),Close:$.Dialog.Close}),Vs=$.Dialog.Root,_s=$.Dialog.Trigger,Ks=$.Dialog.Portal,Zs=he.Backdrop,Qs=he.Popup,Ys=he.Popup,Js=he.Title,Xs=he.Description,en=$.Dialog.Close,st={s:25,m:35,l:50,xl:70,full:100},tn=360;function rn(t){return typeof t=="number"?`${t}px`:`${st[t??"m"]??st.m}vw`}const sn={s:"w-[25vw]",m:"w-[35vw]",l:"w-[50vw]",xl:"w-[70vw]",full:"w-screen"},Ae=h.forwardRef(({size:t,animated:r,mobileLayer:s,label:n,children:a},o)=>e.jsx("div",{ref:o,role:"dialog","aria-modal":"true","aria-label":n,className:c("flex min-h-0 min-w-90 max-w-full shrink flex-col overflow-y-auto overflow-x-hidden border-s border-border bg-white shadow-none","transition-[translate,opacity] duration-300 ease-[cubic-bezier(0.16,1,0.3,1)] motion-reduce:transition-none",typeof t=="number"?void 0:sn[t],r?"pointer-events-auto translate-x-0 opacity-100":"pointer-events-none translate-x-full opacity-0 rtl:-translate-x-full","max-[900px]:fixed max-[900px]:inset-0 max-[900px]:!w-full max-[900px]:min-w-0 max-[900px]:border-0",s),style:typeof t=="number"?{width:t}:void 0,children:a}));Ae.displayName="DrawerSlot";const mt=h.createContext(void 0),cr=()=>{const t=h.useContext(mt);if(!t)throw new Error("useGymatraDrawer must be used within a GymatraDrawerProvider");return t},nn=cr,an=mt;function dr({children:t}){const[r,s]=h.useState(!1),[n,a]=h.useState(!1),[o,i]=h.useState(!1),[l,m]=h.useState("m"),[u,d]=h.useState(null),[b,y]=h.useState(null),p=h.useRef(null),x=h.useRef(null),[f,g]=h.useState(!1),[j,k]=h.useState(!1),[v,N]=h.useState(!1),[S,T]=h.useState("l"),[G,z]=h.useState(null),[w,P]=h.useState(null),F=h.useRef(null),M=h.useRef(null),[W,q]=h.useState(!1),[I,U]=h.useState(!1),[oe,B]=h.useState(!1),[O,Z]=h.useState("s"),[V,Q]=h.useState(null),[Ie,ie]=h.useState(null),ge=h.useRef(null),le=h.useRef(null);h.useEffect(()=>{if(n&&r){const C=requestAnimationFrame(()=>{i(!0)});return()=>cancelAnimationFrame(C)}else i(!1)},[n,r]),h.useEffect(()=>{if(j&&f){const C=requestAnimationFrame(()=>{N(!0)});return()=>cancelAnimationFrame(C)}else N(!1)},[j,f]),h.useEffect(()=>{if(I&&W){const C=requestAnimationFrame(()=>{B(!0)});return()=>cancelAnimationFrame(C)}else B(!1)},[I,W]),h.useEffect(()=>{const C=()=>{ve()};return window.addEventListener("popstate",C),()=>window.removeEventListener("popstate",C)},[]);const je=(C,L="s",A={})=>{le.current&&clearTimeout(le.current),Q(()=>C),Z(L),ie(A),U(!0),q(!0)},Y=()=>{q(!1),B(!1),le.current&&clearTimeout(le.current),le.current=setTimeout(()=>{U(!1),Q(null),ie(null)},300)},Te=(C,L="l",A={})=>{M.current&&clearTimeout(M.current),z(()=>C),T(L),P(A),k(!0),g(!0)},ue=()=>{Y(),g(!1),N(!1),M.current&&clearTimeout(M.current),M.current=setTimeout(()=>{k(!1),z(null),P(null)},300)},Qe=(C,L="m",A={})=>{x.current&&clearTimeout(x.current),d(()=>C),m(L),y(A),a(!0),s(!0)},xe=()=>{Y(),ue(),s(!1),i(!1),x.current&&clearTimeout(x.current),x.current=setTimeout(()=>{a(!1),d(null),y(null)},300)},ve=()=>{xe()};h.useEffect(()=>{const C=L=>{L.key==="Escape"&&(W?Y():f?ue():r&&xe())};if(r||f||W)return document.addEventListener("keydown",C),()=>document.removeEventListener("keydown",C)},[r,f,W]);const Le=n||j||I,Ye=o||v||oe,Re=(r?1:0)+(f?1:0)+(W?1:0);return e.jsxs(mt.Provider,{value:{openDrawer:Qe,closeDrawer:xe,isOpen:r,size:l,contentProps:b,Component:u,openSecondDrawer:Te,closeSecondDrawer:ue,isSecondOpen:f,secondSize:S,secondContentProps:w,SecondComponent:G,openThirdDrawer:je,closeThirdDrawer:Y,isThirdOpen:W,thirdSize:O,thirdContentProps:Ie,ThirdComponent:V,closeAll:ve,openCount:Re},children:[t,Le&&e.jsx("div",{"aria-hidden":"true",onClick:()=>{W?Y():f?ue():r&&xe()},className:c("fixed inset-0 z-[9990] bg-around/40 cursor-pointer","transition-opacity duration-300 ease-out",Ye?"opacity-100":"opacity-0 pointer-events-none")}),Le&&e.jsxs("div",{className:"pointer-events-none fixed inset-y-0 end-0 z-[10000] flex max-w-full items-stretch justify-end gap-1.5 overflow-x-auto overflow-y-hidden max-[900px]:inset-0",children:[I&&e.jsx(Ae,{ref:ge,size:O,animated:oe,mobileLayer:"max-[900px]:z-30",label:"Tiroir de niveau 3",children:V&&e.jsx(V,{...Ie||{}})}),j&&e.jsx(Ae,{ref:F,size:S,animated:v,mobileLayer:"max-[900px]:z-20",label:"Tiroir de niveau 2",children:G&&e.jsx(G,{...w||{}})}),n&&e.jsx(Ae,{ref:p,size:l,animated:o,mobileLayer:"max-[900px]:z-10",label:"Tiroir",children:u&&e.jsx(u,{...b||{}})})]})]})}const on=dr;function ln({title:t,description:r,icon:s,showCloseButton:n=!0,onClose:a,footer:o,className:i,children:l,...m}){return e.jsxs("div",{className:c("flex h-full flex-col bg-white text-text min-h-0",i),...m,children:[(t||n)&&e.jsxs("div",{className:"sticky top-0 z-20 shrink-0 bg-white",children:[e.jsxs("div",{className:"flex items-center justify-between px-5 pt-4 pb-3 sm:px-6",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0 pe-3",children:[s&&e.jsx("span",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-primary-soft text-primary",children:s}),e.jsxs("div",{className:"min-w-0",children:[t&&e.jsx("h3",{className:"text-base font-semibold text-text truncate",children:t}),r&&e.jsx("p",{className:"text-xs text-text-muted truncate mt-0.5",children:r})]})]}),n&&e.jsx("button",{type:"button",onClick:a,"aria-label":"Fermer",className:"size-8 inline-flex shrink-0 items-center justify-center rounded-md text-text-muted hover:bg-surface-muted hover:text-text cursor-pointer transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary",children:e.jsxs("svg",{className:"size-4.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),e.jsx("div",{className:"mx-5 sm:mx-6 border-b border-border"})]}),e.jsx("div",{className:"flex-1 space-y-4 overflow-y-auto p-5 text-sm text-text",children:l}),o&&e.jsx("div",{className:"flex shrink-0 items-center justify-end gap-2.5 border-t border-border bg-white px-5 py-3.5",children:o})]})}function cn(){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("path",{d:"M3 9l2.5-5h13L21 9"}),e.jsx("path",{d:"M3 9h5l1.5 3h5L16 9h5v10a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1Z"})]})}const dn={sm:{root:"gap-3 px-4 py-6",tile:"size-10 [&>svg]:size-5",title:"text-sm",description:"text-xs"},md:{root:"gap-4 px-6 py-10",tile:"size-12 [&>svg]:size-6",title:"text-base",description:"text-sm"},lg:{root:"gap-5 px-6 py-16",tile:"size-14 [&>svg]:size-7",title:"text-lg",description:"text-sm"}},un={plain:"",bordered:"rounded-lg border border-dashed border-border-strong",muted:"rounded-lg bg-surface-muted"},xn={neutral:{plain:"bg-surface-muted text-text-muted",bordered:"bg-surface-muted text-text-muted",muted:"bg-white text-text-muted"},primary:{plain:"bg-primary-soft text-primary",bordered:"bg-primary-soft text-primary",muted:"bg-white text-primary"},danger:{plain:"bg-danger-soft text-danger",bordered:"bg-danger-soft text-danger",muted:"bg-white text-danger"}},ur=h.forwardRef(({title:t,description:r,icon:s,action:n,secondaryAction:a,size:o="md",variant:i="plain",tone:l="neutral",headingLevel:m=3,className:u,...d},b)=>{const y=dn[o],p=`h${m}`,x=s===void 0?e.jsx(cn,{}):s;return e.jsxs("div",{ref:b,className:c("flex w-full flex-col items-center justify-center text-center",y.root,un[i],u),...d,children:[x!==null&&e.jsx("span",{"aria-hidden":"true",className:c("flex shrink-0 items-center justify-center rounded-full",y.tile,xn[l][i]),children:x}),e.jsxs("div",{className:"max-w-sm space-y-1",children:[e.jsx(p,{className:c("font-semibold text-text",y.title),children:t}),r&&e.jsx("p",{className:c("text-text-muted",y.description),children:r})]}),(n||a)&&e.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[a,n]})]})});ur.displayName="GymatraEmptyState";function mn({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function pt({label:t,options:r,multiple:s=!1,value:n,defaultValue:a,onChange:o,placeholder:i,bordered:l=!0,showCount:m=!0,size:u="sm",width:d,className:b,disabled:y=!1}){const[p,x]=h.useState(()=>typeof a<"u"?a:s?[]:r.length>0?r[0].value:""),[f,g]=h.useState(!1),j=h.useRef(null),k=n??p,v=s?Array.isArray(k)?k:k?[k]:[]:typeof k=="string"&&k!==""?[k]:[];let N;if(s)if(v.length===0)N=i??`All ${t}`;else if(v.length===1){const w=r.find(P=>P.value===v[0]);N=w?w.label:v[0]}else v.length===r.length?N=`All (${v.length})`:N=`${v.length} selected`;else{const w=v[0],P=r.find(F=>F.value===w);N=P?P.label:i??`All ${t}`}const S=s?v.length>0:!!(v[0]&&v[0]!=="all"&&v[0]!=="");h.useEffect(()=>{function w(P){j.current&&!j.current.contains(P.target)&&g(!1)}if(f)return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[f]),h.useEffect(()=>{function w(P){P.key==="Escape"&&g(!1)}if(f)return document.addEventListener("keydown",w),()=>document.removeEventListener("keydown",w)},[f]);function T(w){if(s){const F=v.includes(w)?v.filter(M=>M!==w):[...v,w];typeof n>"u"&&x(F),o==null||o(F)}else typeof n>"u"&&x(w),o==null||o(w),g(!1)}function G(){const w=r.filter(P=>!P.disabled).map(P=>P.value);typeof n>"u"&&x(w),o==null||o(w)}function z(){const w=[];typeof n>"u"&&x(w),o==null||o(w)}return e.jsxs("div",{ref:j,className:c("relative inline-block text-left",b),children:[e.jsxs("button",{type:"button",disabled:y,onClick:()=>g(w=>!w),"aria-haspopup":"listbox","aria-expanded":f,"aria-label":`${t}: ${N}`,className:c("inline-flex items-center justify-between gap-2 rounded-md text-text cursor-pointer transition-colors outline-none","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary","disabled:pointer-events-none disabled:opacity-50",u==="sm"?"h-8.5 px-3 text-sm":"h-10 px-3.5 text-sm",d||(u==="sm"?"w-[165px]":"w-[185px]"),l?"border border-border bg-white hover:border-border-strong hover:bg-surface/50":"border-0 bg-transparent hover:bg-surface/50",f&&"bg-primary-soft/50 text-primary",S&&!f&&"bg-primary-soft/50 text-primary"),children:[e.jsxs("span",{className:"flex items-center gap-1.5 truncate",children:[e.jsxs("span",{className:"text-text-muted",children:[t,":"]}),e.jsx("span",{className:"truncate",children:N})]}),e.jsx("span",{className:c("text-text-subtle transition-transform duration-150 flex items-center shrink-0",f&&"rotate-180 text-primary"),"aria-hidden":"true",children:e.jsx(mn,{})})]}),f&&e.jsxs("div",{role:"listbox","aria-multiselectable":s,"aria-label":t,className:"absolute left-0 z-50 mt-1 min-w-[190px] w-max max-w-[280px] rounded-lg border border-border bg-white p-1.5 shadow-none focus:outline-none",children:[s&&r.length>2&&e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-2 py-1.5 mb-1 text-xs text-text-muted",children:[e.jsxs("span",{children:[v.length," of ",r.length," selected"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:G,className:"text-primary hover:underline font-medium cursor-pointer",children:"All"}),e.jsx("span",{className:"text-border","aria-hidden":"true",children:"|"}),e.jsx("button",{type:"button",onClick:z,className:"text-text-muted hover:text-text hover:underline cursor-pointer",children:"Clear"})]})]}),e.jsx("div",{className:"max-h-60 overflow-y-auto space-y-0.5",children:r.map(w=>{const P=v.includes(w.value);return e.jsxs("button",{type:"button",role:"option","aria-selected":P,disabled:w.disabled,onClick:()=>T(w.value),className:c("flex w-full items-center justify-between gap-2.5 rounded-md px-2 py-1.5 text-sm text-left cursor-pointer transition-colors outline-none","hover:bg-surface hover:text-text","focus-visible:bg-surface focus-visible:text-primary","disabled:pointer-events-none disabled:opacity-40",P?"bg-primary-soft/40 text-primary font-medium":"text-text font-normal"),children:[e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[e.jsx("span",{"aria-hidden":"true",className:c("size-5 shrink-0 rounded-md flex items-center justify-center border transition-colors",P?"border-primary bg-primary text-white":"border-border-strong bg-white hover:border-text-subtle"),children:P&&e.jsx("svg",{"aria-hidden":"true",className:"size-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}),e.jsx("span",{className:"truncate",children:w.label})]}),m&&typeof w.count<"u"&&e.jsx("span",{className:c("shrink-0 rounded px-1.5 py-0.5 text-xs font-medium leading-none",P?"bg-primary text-white":"bg-surface text-text-muted"),children:w.count})]},w.value)})})]})]})}pt.displayName="GymatraFilterSelect";function pn({className:t="size-4"}){return e.jsxs("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("path",{d:"m21 21-4.35-4.35"})]})}function xr({className:t="size-3"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})}function fn({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function hn({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"})})}function mr({value:t,onChange:r,onClear:s,placeholder:n="Search...",borderless:a=!0,className:o,...i}){const l=!!(t&&String(t).length>0);return e.jsxs("div",{className:c("relative flex items-center shrink-0",a?"w-[180px] min-w-[140px] max-w-[220px]":"w-60",o),children:[e.jsx("span",{className:"pointer-events-none absolute left-0.5 flex items-center text-text-subtle","aria-hidden":"true",children:e.jsx(pn,{className:"size-4"})}),e.jsx("input",{type:"search",value:t,onChange:r,placeholder:n,className:c("w-full h-9 bg-transparent text-sm text-text placeholder:text-sm placeholder:text-text-subtle",a?"border-0 ring-0 outline-none shadow-none pl-6 pr-5 focus:border-0 focus:ring-0 focus:outline-none focus:shadow-none active:border-0 active:ring-0 active:outline-none":"rounded-md border border-border pl-8 pr-6 focus:border-primary focus:outline-2 focus:outline-primary/30"),...i}),l&&s&&e.jsx("button",{type:"button",onClick:s,"aria-label":"Clear search",className:"absolute right-0.5 flex size-5 items-center justify-center text-text-subtle hover:text-text cursor-pointer transition-colors",children:e.jsx(xr,{className:"size-3.5"})})]})}function bn({label:t,options:r,value:s,defaultValue:n,onChange:a,className:o,...i}){return e.jsxs("div",{className:c("relative inline-flex items-center",o),children:[e.jsx("select",{value:s,defaultValue:n,onChange:a,"aria-label":t,className:"h-8.5 rounded-md border border-border bg-surface pl-2.5 pr-7 text-sm text-text outline-none hover:border-border-strong focus-visible:border-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary cursor-pointer appearance-none transition-colors",...i,children:r.map(l=>e.jsx("option",{value:l.value,children:l.label},l.value))}),e.jsx("span",{className:"pointer-events-none absolute right-2 text-text-subtle flex items-center","aria-hidden":"true",children:e.jsx(fn,{})})]})}function pr({label:t,valueLabel:r,onRemove:s,className:n}){return e.jsxs("span",{className:c("inline-flex h-6 items-center gap-1.5 rounded border border-border bg-surface px-2 text-xs text-text",n),children:[e.jsxs("span",{className:"text-text-muted",children:[t,":"]}),e.jsx("span",{className:"font-medium text-text",children:r}),e.jsx("button",{type:"button",onClick:s,"aria-label":`Remove filter ${t}: ${r}`,className:"inline-flex size-3.5 items-center justify-center rounded-full text-text-muted hover:text-text cursor-pointer transition-colors",children:e.jsx(xr,{})})]})}function fr({searchValue:t,onSearchChange:r,searchPlaceholder:s="Search...",searchBorderless:n=!0,totalCount:a,countLabel:o="Results",actions:i,filters:l=[],activeFilters:m=[],onResetFilters:u,isFiltersOpen:d,defaultFiltersOpen:b=!1,onToggleFilters:y,filterButtonLabel:p="Filters",bottomContent:x,className:f,children:g,...j}){const[k,v]=h.useState(b),N=d??k;function S(){const z=!N;typeof d>"u"&&v(z),y==null||y(z)}const T=typeof t<"u"||typeof r<"u";l.length>0||m.length>0;const G=m.length;return e.jsxs("div",{className:c("flex flex-col w-full",f),...j,children:[e.jsxs("div",{className:"flex flex-wrap items-center min-h-12 py-1.5 ps-3.5 pe-1.5 gap-3 rounded-lg border border-border bg-surface",children:[T&&e.jsx(mr,{value:t,onChange:z=>r==null?void 0:r(z.target.value),onClear:()=>r==null?void 0:r(""),placeholder:s,borderless:n}),T&&typeof a<"u"&&e.jsx("span",{className:"h-5 w-px shrink-0 bg-border","aria-hidden":"true"}),typeof a<"u"&&e.jsxs("div",{className:"inline-flex items-center gap-1.5 whitespace-nowrap text-sm text-text-muted",children:[e.jsx("span",{className:"font-medium text-text",children:a}),e.jsx("span",{children:o})]}),g,e.jsxs("div",{className:"ms-auto flex flex-wrap items-center gap-2.5",children:[l.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"h-5 w-px shrink-0 bg-border","aria-hidden":"true"}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.map(z=>e.jsx(pt,{label:z.label,options:z.options,multiple:z.multiple,value:z.value,defaultValue:z.defaultValue,onChange:z.onChange},z.id)),u&&(m.length>0||!!t)&&e.jsx("button",{type:"button",onClick:u,className:"rounded px-1.5 py-0.5 text-xs font-medium text-primary hover:underline cursor-pointer transition-opacity",children:"Reset"})]})]}),i,x&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"h-5 w-px shrink-0 bg-border","aria-hidden":"true"}),e.jsxs("button",{type:"button",onClick:S,"aria-expanded":N,"aria-label":`${N?"Hide":"Show"} filters`,title:p,"data-active":N||G>0,className:"relative inline-flex size-8 shrink-0 items-center justify-center rounded-md border-0 bg-transparent text-text hover:bg-surface-muted hover:text-primary cursor-pointer transition-colors outline-none focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary data-[active=true]:bg-primary-soft data-[active=true]:text-primary",children:[e.jsx(hn,{}),G>0&&e.jsx("span",{className:"absolute -top-1 -right-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-xs font-medium leading-none text-white",children:G})]})]})]})]}),m.length>0&&e.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-1.5 px-1","aria-label":"Applied filters",children:m.map(z=>e.jsx(pr,{label:z.label,valueLabel:z.valueLabel,onRemove:z.onRemove},z.id))}),N&&x&&e.jsx("div",{className:"mt-2.5 flex flex-col gap-3 rounded-lg border border-border bg-surface p-3.5 transition-all",children:x})]})}fr.displayName="GymatraFilterBar";const hr={0:"Auriculaire gauche",1:"Annulaire gauche",2:"Majeur gauche",3:"Index gauche",4:"Pouce gauche",5:"Pouce droit",6:"Index droit",7:"Majeur droit",8:"Annulaire droit",9:"Auriculaire droit"},nt=144,br=22,Bt=116,yn=[{finger:0,left:8,top:52,height:72},{finger:1,left:34,top:28,height:96},{finger:2,left:60,top:16,height:108},{finger:3,left:86,top:30,height:94},{finger:4,left:104,top:90,height:66,rotate:38}],gn={0:9,1:8,2:7,3:6,4:5};function jn(t){return yn.map(r=>t==="left"?r:{...r,finger:gn[r.finger],left:nt-r.left-br,rotate:r.rotate?-r.rotate:void 0})}const Be=[0,1,2,3,4,5,6,7,8,9];function yr(){return e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",className:"size-3","aria-hidden":"true",children:e.jsx("path",{d:"m5 12 5 5 9-10"})})}function vn({value:t=null,onChange:r,enrolled:s=null,scanning:n=null,disabled:a=!1,labels:o,handLabels:i={left:"Main gauche",right:"Main droite"},ariaLabel:l="Doigt à enregistrer",className:m}){const u=fe.useRef({}),d=f=>(o==null?void 0:o[f])??hr[f],b=t??s??6,y=(f,g)=>{var k;const j=Be[(Be.indexOf(f)+g+Be.length)%Be.length];r==null||r(j),(k=u.current[j])==null||k.focus()},p=(f,g)=>{a||(f.key==="ArrowRight"||f.key==="ArrowDown"?(f.preventDefault(),y(g,1)):(f.key==="ArrowLeft"||f.key==="ArrowUp")&&(f.preventDefault(),y(g,-1)))},x=f=>e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsxs("div",{className:"relative",style:{width:nt,height:176},children:[e.jsx("div",{"aria-hidden":"true",className:"absolute rounded-lg border border-border bg-surface-muted",style:{left:f==="left"?4:nt-4-Bt,top:100,width:Bt,height:74}}),jn(f).map(({finger:g,left:j,top:k,height:v,rotate:N})=>{const S=t===g,T=s===g,G=n===g,z=G?"scanning":S?"selected":T?"enrolled":"empty",w=T?" · enregistré":"";return e.jsx("button",{ref:P=>{u.current[g]=P},type:"button",role:"radio","aria-checked":S,"aria-label":`${d(g)}${w}`,tabIndex:g===b?0:-1,disabled:a,onClick:()=>r==null?void 0:r(g),onKeyDown:P=>p(P,g),className:c("absolute flex cursor-pointer items-start justify-center rounded-full pt-2 transition-colors motion-reduce:transition-none","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary","disabled:cursor-default",z==="empty"&&"border border-border-strong bg-white text-text-muted enabled:hover:border-primary enabled:hover:bg-primary-soft",z==="enrolled"&&"border border-success bg-success-soft text-success",z==="selected"&&"border-2 border-primary bg-primary-soft text-primary",z==="scanning"&&"border-2 border-primary bg-primary text-white animate-pulse motion-reduce:animate-none"),style:{left:j,top:k,width:br,height:v,transform:N?`rotate(${N}deg)`:void 0,transformOrigin:"bottom center"},children:(T||S||G)&&e.jsx("span",{className:"flex size-4 items-center justify-center",children:T&&!S&&!G?e.jsx(yr,{}):e.jsx("span",{className:"size-2 rounded-full bg-current","aria-hidden":"true"})})},g)})]}),e.jsx("span",{className:"text-xs font-medium text-text-muted",children:f==="left"?i.left:i.right})]});return e.jsxs("div",{role:"radiogroup","aria-label":l,"aria-disabled":a||void 0,className:c("flex flex-wrap items-end justify-center gap-10",m),children:[x("left"),x("right")]})}function wn({completed:t,total:r=3,active:s=!0,stepLabel:n=o=>`Scan ${o}`,className:a}){return e.jsx("ol",{className:c("flex items-center gap-2",a),"aria-label":`${Math.min(t,r)} / ${r}`,children:Array.from({length:r},(o,i)=>{const l=i+1,m=l<=t,u=!m&&l===t+1&&s;return e.jsxs("li",{className:"flex items-center gap-2",children:[i>0&&e.jsx("span",{"aria-hidden":"true",className:c("h-0.5 w-8 rounded-full",m?"bg-primary":"bg-border")}),e.jsxs("span",{className:c("flex size-8 items-center justify-center rounded-full border text-xs font-medium tabular-nums",m&&"border-primary bg-primary text-white",u&&"border-2 border-primary bg-primary-soft text-primary animate-pulse motion-reduce:animate-none",!m&&!u&&"border-border bg-white text-text-muted"),children:[m?e.jsx(yr,{}):l,e.jsxs("span",{className:"sr-only",children:[n(l)," ",m?"· terminé":u?"· en cours":""]})]})]},l)})})}const Nn=H.Popover.Root,kn=H.Popover.Trigger,Gn=H.Popover.Portal,Cn=H.Popover.Positioner,Oe=h.forwardRef(({className:t,children:r,...s},n)=>e.jsx(H.Popover.Popup,{ref:n,className:c("relative z-50 rounded-lg border border-border bg-white p-4 text-text outline-none shadow-none",t),...s,children:r}));Oe.displayName="GymatraPopoverPopup";const ft=h.forwardRef(({className:t,...r},s)=>e.jsx(H.Popover.Title,{ref:s,className:c("text-sm font-semibold text-text",t),...r}));ft.displayName="GymatraPopoverTitle";const ht=h.forwardRef(({className:t,...r},s)=>e.jsx(H.Popover.Description,{ref:s,className:c("mt-1 text-xs leading-relaxed text-text-muted",t),...r}));ht.displayName="GymatraPopoverDescription";function Sn({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})}const bt=h.forwardRef(({className:t,children:r,...s},n)=>e.jsx(H.Popover.Close,{ref:n,className:c("absolute top-3 right-3 rounded-md p-1 text-text-muted hover:bg-surface-muted hover:text-text cursor-pointer transition-colors outline-none focus-visible:outline-2 focus-visible:outline-primary",t),"aria-label":"Fermer",...s,children:r??e.jsx(Sn,{})}));bt.displayName="GymatraPopoverClose";const gr=h.forwardRef(({className:t,...r},s)=>e.jsx(H.Popover.Arrow,{ref:s,className:c("fill-white stroke-border stroke-1",t),...r}));gr.displayName="GymatraPopoverArrow";function zn({trigger:t,title:r,description:s,content:n,children:a,footer:o,side:i="bottom",align:l="center",sideOffset:m=8,width:u="w-80",showCloseButton:d=!0,open:b,defaultOpen:y,onOpenChange:p,modal:x=!1,popupClassName:f}){const g=b!==void 0?{open:b,onOpenChange:p,modal:x}:y!==void 0?{defaultOpen:y,onOpenChange:p,modal:x}:{onOpenChange:p,modal:x};return e.jsxs(H.Popover.Root,{...g,children:[e.jsx(H.Popover.Trigger,{render:h.isValidElement(t)?t:e.jsx("button",{type:"button",children:t})}),e.jsx(H.Popover.Portal,{children:e.jsx(H.Popover.Positioner,{side:i,align:l,sideOffset:m,className:"z-[10020] outline-none",children:e.jsxs(Oe,{className:c(u,f),children:[d&&e.jsx(bt,{}),(r||s)&&e.jsxs("div",{className:c("space-y-1",d?"pr-6":void 0),children:[r&&e.jsx(ft,{children:r}),s&&e.jsx(ht,{children:s})]}),(n||a)&&e.jsx("div",{className:c(r||s?"mt-3":void 0),children:n??a}),o&&e.jsx("div",{className:"mt-4 pt-3 border-t border-border flex items-center justify-end gap-2",children:o})]})})})]})}const Pn={sm:{box:"size-8",icon:"size-4"},md:{box:"size-10",icon:"size-5"},lg:{box:"size-11",icon:"size-5"}};function Mn(t){return t.replace(/^[A-Z][a-z](?=[A-Z])/,"").replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase()}function In(){return e.jsxs("svg",{"aria-hidden":"true",className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"11",cy:"11",r:"7"}),e.jsx("path",{d:"m21 21-4.35-4.35"})]})}function Tn({className:t}){return e.jsxs("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"7",height:"7",rx:"1.5"}),e.jsx("rect",{x:"14",y:"3",width:"7",height:"7",rx:"1.5"}),e.jsx("rect",{x:"3",y:"14",width:"7",height:"7",rx:"1.5"}),e.jsx("path",{d:"M17.5 14v7M14 17.5h7"})]})}function jr({value:t,defaultValue:r,onChange:s,icons:n,suggested:a,renderIcon:o,getIconLabel:i=Mn,label:l="Choisir une icône",searchPlaceholder:m="Rechercher une icône…",emptyText:u="Aucune icône trouvée",maxVisible:d=96,size:b="md",disabled:y=!1,invalid:p=!1,name:x,className:f}){const[g,j]=h.useState(r??""),[k,v]=h.useState(!1),[N,S]=h.useState(""),T=h.useId(),G=t??g,z=Pn[b],w=h.useMemo(()=>{const M=N.trim().toLowerCase(),W=M?n.filter(I=>I.toLowerCase().includes(M)||i(I).includes(M)):a??n,q=G&&(W.includes(G)||!M&&n.includes(G))?[G,...W.filter(I=>I!==G)]:W;return{shown:q.slice(0,d),total:q.length}},[n,a,N,G,d,i]),P=M=>{t===void 0&&j(M),s==null||s(M),v(!1),S("")},F=G?i(G):"";return e.jsxs(H.Popover.Root,{open:k,onOpenChange:M=>{v(M),M||S("")},children:[x&&e.jsx("input",{type:"hidden",name:x,value:G}),e.jsx(H.Popover.Trigger,{disabled:y,"aria-label":G?`${l} : ${F}`:l,title:G?F:l,"aria-invalid":p||void 0,className:c("inline-flex shrink-0 cursor-pointer items-center justify-center rounded-md border bg-white transition-colors motion-reduce:transition-none","focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary","disabled:cursor-not-allowed disabled:opacity-50",p?"border-danger text-danger":"border-border text-primary hover:border-border-strong data-[popup-open]:border-primary",z.box,f),children:G?o(G,z.icon):e.jsx(Tn,{className:c(z.icon,"text-text-subtle")})}),e.jsx(H.Popover.Portal,{children:e.jsx(H.Popover.Positioner,{side:"bottom",align:"start",sideOffset:6,className:"z-[10020] outline-none",children:e.jsx(Oe,{className:"w-72 p-2",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("label",{htmlFor:T,className:"flex h-9 items-center gap-2 rounded-md border border-border px-2.5 text-text-subtle focus-within:border-primary",children:[e.jsx(In,{}),e.jsx("input",{id:T,type:"search",autoFocus:!0,value:N,onChange:M=>S(M.target.value),placeholder:m,"aria-label":m,className:"min-w-0 flex-1 bg-transparent text-sm text-text outline-none placeholder:text-text-subtle"})]}),w.total===0?e.jsx("p",{className:"px-1 py-6 text-center text-xs text-text-muted",children:u}):e.jsx("div",{role:"listbox","aria-label":l,className:"grid max-h-64 grid-cols-7 gap-1 overflow-y-auto",children:w.shown.map(M=>{const W=M===G,q=i(M);return e.jsx("button",{type:"button",role:"option","aria-selected":W,"aria-label":q,title:q,onClick:()=>P(M),className:c("flex aspect-square items-center justify-center rounded-md transition-colors motion-reduce:transition-none","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary",W?"bg-primary text-white":"text-text-muted hover:bg-surface-muted hover:text-text"),children:o(M,"size-5")},M)})}),w.total>w.shown.length&&e.jsxs("p",{className:"px-1 text-xs text-text-muted",children:[w.shown.length," sur ",w.total," — affinez la recherche"]})]})})})})]})}jr.displayName="GymatraIconPicker";function D({label:t,error:r,helperText:s,required:n,disabled:a,focused:o,startAdornment:i,endAdornment:l,className:m,wrapperClassName:u,children:d,...b}){const y=!!r;return e.jsxs("div",{className:c("relative w-full pt-2.5 pb-1",a&&"opacity-60 pointer-events-none",u),...b,children:[e.jsxs("div",{className:c("group relative flex items-center w-full min-h-11 rounded-md border bg-white transition-all",y?"border-danger focus-within:border-danger focus-within:ring-1 focus-within:ring-danger":o?"border-primary ring-1 ring-primary":"border-border hover:border-text-subtle focus-within:border-primary focus-within:ring-1 focus-within:ring-primary",m),children:[t&&e.jsxs("label",{className:c("pointer-events-none absolute -top-3 start-3 z-10 px-1.5 bg-white text-sm leading-none font-medium transition-colors select-none",y?"text-danger":o?"text-primary":"text-text-muted group-focus-within:text-primary group-hover:text-text"),children:[t,n&&e.jsx("span",{className:"ms-0.5 text-danger","aria-hidden":"true",children:"*"})]}),i&&e.jsx("div",{className:"flex shrink-0 items-center ps-3 text-text-muted select-none",children:i}),e.jsx("div",{className:"flex-1 min-w-0 flex items-center",children:d}),l&&e.jsx("div",{className:"flex shrink-0 items-center pe-3 text-text-muted select-none",children:l})]}),(r||s)&&e.jsxs("p",{className:c("mt-2 text-xs flex items-center gap-1 ps-1",y?"text-danger font-medium":"text-text-muted"),children:[y&&e.jsxs("svg",{className:"size-3.5 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),e.jsx("span",{children:r||s})]})]})}const be=h.forwardRef(({label:t,error:r,helperText:s,startIcon:n,endIcon:a,prefixText:o,suffixText:i,type:l="text",placeholder:m,disabled:u,required:d,className:b,wrapperClassName:y,...p},x)=>{const f=!!(n||o),g=!!(i||a);return e.jsx(D,{label:t,error:r,helperText:s,required:d,disabled:u,wrapperClassName:y,startAdornment:f?e.jsxs("div",{className:"flex items-center gap-1.5 text-text-muted text-sm",children:[n,o&&e.jsx("span",{className:"font-medium text-text select-none",children:o})]}):void 0,endAdornment:g?e.jsxs("div",{className:"flex items-center gap-1.5 text-text-muted text-sm",children:[i&&e.jsx("span",{className:"font-medium text-text select-none",children:i}),a]}):void 0,children:e.jsx("input",{ref:x,type:l,disabled:u,placeholder:m||(typeof t=="string"?t:void 0),className:c("w-full h-11 bg-transparent text-sm text-text placeholder:text-text-subtle/80 outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0",f?"ps-2.5":"ps-3.5",g?"pe-2.5":"pe-3.5","disabled:cursor-not-allowed",b),...p})})});be.displayName="GymatraTextInput";const vr=h.forwardRef(({label:t="Email",startIcon:r,...s},n)=>{const a=e.jsxs("svg",{className:"size-4 text-text-subtle",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]});return e.jsx(be,{ref:n,type:"email",label:t,startIcon:r??a,autoComplete:"email",...s})});vr.displayName="GymatraEmailInput";const wr=h.forwardRef(({label:t="Mot de passe",startIcon:r,...s},n)=>{const[a,o]=h.useState(!1),i=e.jsxs("svg",{className:"size-4 text-text-subtle",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"11",width:"18",height:"11",rx:"2",ry:"2"}),e.jsx("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"})]});return e.jsx(be,{ref:n,type:a?"text":"password",label:t,startIcon:r??i,autoComplete:"current-password",endIcon:e.jsx("button",{type:"button",tabIndex:-1,onClick:()=>o(!a),className:"text-text-muted hover:text-text cursor-pointer transition-colors p-1","aria-label":a?"Masquer":"Afficher",children:a?e.jsxs("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),e.jsx("line",{x1:"1",y1:"23",x2:"23",y2:"1"})]}):e.jsxs("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}),...s})});wr.displayName="GymatraPasswordInput";const Nr=h.forwardRef(({label:t="Rechercher",startIcon:r,value:s,onChange:n,onClear:a,...o},i)=>{const[l,m]=h.useState(""),u=s!==void 0,d=u?String(s):l,b=e.jsxs("svg",{className:"size-4 text-text-subtle",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),y=()=>{u||m(""),a==null||a()};return e.jsx(be,{ref:i,type:"search",label:t,value:s,onChange:p=>{u||m(p.target.value),n==null||n(p)},startIcon:r??b,endIcon:d?e.jsx("button",{type:"button",onClick:y,className:"text-text-muted hover:text-text cursor-pointer p-0.5 rounded-full hover:bg-surface-muted transition-colors","aria-label":"Effacer",children:e.jsxs("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}):void 0,...o})});Nr.displayName="GymatraSearchInput";const At=["MA","DZ","TN","FR","ES","BE","CA","US","GB","SA","AE","QA","TR"],Dt={MA:"Maroc",DZ:"Algérie",TN:"Tunisie",FR:"France",ES:"Espagne",BE:"Belgique",CA:"Canada",US:"États-Unis",GB:"Royaume-Uni",SA:"Arabie Saoudite",AE:"Émirats Arabes Unis",QA:"Qatar",TR:"Turquie",IT:"Italie",DE:"Allemagne",CH:"Suisse",NL:"Pays-Bas",PT:"Portugal",EG:"Égypte",SN:"Sénégal",CI:"Côte d'Ivoire"},kr=({name:t,label:r="Téléphone",error:s,helperText:n,value:a,defaultValue:o,onChange:i,onBlur:l,defaultCountry:m="MA",disabled:u,required:d,autoValidate:b=!1,invalidErrorMessage:y,placeholder:p,className:x,wrapperClassName:f})=>{const[g,j]=h.useState(m),[k,v]=h.useState(o),[N,S]=h.useState(!1),[T,G]=h.useState(""),z=h.useRef(null),w=h.useRef(null),P=a!==void 0?a:k,F=B=>{a===void 0&&v(B),i==null||i(B)},M=Pt[g],W=g?ae.getCountryCallingCode(g):"212",q=!!(b&&P&&P.trim().length>3&&!ae.isValidPhoneNumber(P)),I=s||(q?y||"Numéro de téléphone invalide pour ce pays":void 0),U=h.useMemo(()=>{const O=ae.getCountries().filter(Z=>!At.includes(Z));return[...At,...O]},[]),oe=h.useMemo(()=>{if(!T.trim())return U;const B=T.toLowerCase().trim();return U.filter(O=>{const Z=(Mt[O]||Dt[O]||O).toLowerCase(),V=ae.getCountryCallingCode(O);return Z.includes(B)||V.includes(B)||O.toLowerCase().includes(B)})},[U,T]);return h.useEffect(()=>{const B=O=>{z.current&&!z.current.contains(O.target)&&S(!1)};return N&&(document.addEventListener("mousedown",B),setTimeout(()=>{var O;return(O=w.current)==null?void 0:O.focus()},50)),()=>document.removeEventListener("mousedown",B)},[N]),e.jsxs("div",{ref:z,className:"relative w-full",children:[e.jsx(D,{label:r,error:I,helperText:n,required:d,disabled:u,focused:N,wrapperClassName:f,className:x,startAdornment:e.jsxs("div",{className:"relative flex items-center pe-1 self-stretch",children:[e.jsxs("button",{type:"button",disabled:u,onClick:()=>{u||(S(!N),G(""))},className:"flex items-center gap-1.5 py-1 px-1 -ms-1 rounded hover:bg-surface-muted transition-colors cursor-pointer select-none text-sm text-text outline-none focus-visible:ring-1 focus-visible:ring-primary","aria-expanded":N,"aria-label":"Sélectionner le pays",children:[e.jsx("span",{className:"flex items-center justify-center w-5 h-3.5 rounded-xs overflow-hidden border border-border/80 shrink-0 bg-surface-muted [&>svg]:size-full [&>svg]:object-cover",children:M?e.jsx(M,{title:g}):e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-muted","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}),e.jsx("svg",{className:c("size-3 text-text-subtle shrink-0 transition-transform duration-200",N&&"rotate-180"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),e.jsxs("span",{className:"font-medium text-text text-sm ms-0.5",children:["+",W]})]}),e.jsx("span",{className:"h-4 w-px bg-border ms-1.5 me-1 shrink-0","aria-hidden":"true"})]}),children:e.jsx(ts,{name:t,country:g,value:P,onChange:F,onBlur:l,disabled:u,placeholder:p||(g==="MA"?"06 55 12 34 56":"Numéro de téléphone"),className:c("w-full h-11 ps-1 pe-3.5 bg-transparent text-sm text-text placeholder:text-text-subtle/80 outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0","disabled:cursor-not-allowed",x)})}),N&&e.jsxs("div",{className:"absolute top-[calc(100%+6px)] start-0 z-50 w-72 rounded-lg border border-border bg-white p-2 shadow-none max-h-72 flex flex-col",children:[e.jsxs("div",{className:"relative mb-2 shrink-0",children:[e.jsx("div",{className:"absolute inset-y-0 start-2.5 flex items-center pointer-events-none text-text-subtle",children:e.jsxs("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}),e.jsx("input",{ref:w,type:"text",value:T,onChange:B=>G(B.target.value),placeholder:"Rechercher pays ou indicatif...",className:"w-full h-8 ps-8 pe-2.5 bg-surface-muted rounded text-sm text-text placeholder:text-text-subtle outline-none border border-border focus:border-primary focus:bg-white transition-colors"})]}),e.jsx("div",{className:"flex-1 overflow-y-auto space-y-0.5 pe-1",children:oe.length===0?e.jsx("div",{className:"px-3 py-4 text-sm text-center text-text-muted",children:"Aucun pays trouvé"}):oe.map(B=>{const O=Pt[B],Z=ae.getCountryCallingCode(B),V=Mt[B]||Dt[B]||B,Q=B===g;return e.jsxs("button",{type:"button",onClick:()=>{j(B),S(!1),G("")},className:c("w-full flex items-center justify-between px-2.5 py-1.5 rounded text-sm transition-colors cursor-pointer text-start",Q?"bg-primary-soft text-primary font-medium":"text-text hover:bg-surface-muted"),children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"flex items-center justify-center w-5 h-3.5 rounded-xs overflow-hidden border border-border/80 shrink-0 bg-surface-muted [&>svg]:size-full [&>svg]:object-cover",children:O?e.jsx(O,{title:V}):e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-text-muted","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M2 12h20M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}),e.jsx("span",{className:"truncate",children:V})]}),e.jsxs("span",{className:c("text-xs shrink-0 ms-2 font-medium",Q?"text-primary":"text-text-muted"),children:["+",Z]})]},B)})})]})]})};kr.displayName="GymatraPhoneInput";const Gr=h.forwardRef(({label:t="Site web",prefixText:r="https://",...s},n)=>{const a=e.jsxs("svg",{className:"size-4 text-text-subtle",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),e.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]});return e.jsx(be,{ref:n,type:"url",label:t,startIcon:a,prefixText:r,placeholder:"example.com",...s})});Gr.displayName="GymatraUrlInput";const Pe=h.forwardRef(({label:t="Nombre",error:r,helperText:s,step:n=1,min:a,max:o,showSteppers:i=!0,prefixText:l,suffixText:m,disabled:u,required:d,className:b,value:y,defaultValue:p,onChange:x,...f},g)=>{const j=h.useRef(null),k=v=>{const N=j.current;!N||u||(v==="up"?N.stepUp():N.stepDown(),N.dispatchEvent(new Event("change",{bubbles:!0})))};return e.jsx(D,{label:t,error:r,helperText:s,required:d,disabled:u,startAdornment:l?e.jsx("span",{className:"text-xs text-text-muted font-medium select-none",children:l}):void 0,endAdornment:i?e.jsxs("div",{className:"flex flex-col border-s border-border -me-1 self-stretch my-0.5 justify-center",children:[e.jsx("button",{type:"button",tabIndex:-1,disabled:u,onClick:()=>k("up"),className:"px-1.5 py-0 text-text-muted hover:text-text hover:bg-surface-muted transition-colors cursor-pointer flex-1 flex items-center justify-center","aria-label":"Augmenter",children:e.jsx("svg",{className:"size-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("polyline",{points:"18 15 12 9 6 15"})})}),e.jsx("button",{type:"button",tabIndex:-1,disabled:u,onClick:()=>k("down"),className:"px-1.5 py-0 text-text-muted hover:text-text hover:bg-surface-muted transition-colors cursor-pointer border-t border-border flex-1 flex items-center justify-center","aria-label":"Diminuer",children:e.jsx("svg",{className:"size-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}):m?e.jsx("span",{className:"text-xs text-text-muted font-medium select-none",children:m}):void 0,children:e.jsx("input",{ref:v=>{j.current=v,typeof g=="function"?g(v):g&&(g.current=v)},type:"number",step:n,min:a,max:o,disabled:u,value:y,defaultValue:p,onChange:x,className:c("w-full h-11 bg-transparent text-sm text-text placeholder:text-text-subtle outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",l?"ps-2.5":"ps-3.5",i||m?"pe-2.5":"pe-3.5",b),...f})})});Pe.displayName="GymatraNumberInput";const Ln=Pe,Cr=h.forwardRef(({label:t="Montant",currency:r="DH",currencyPosition:s="end",step:n=.01,min:a=0,placeholder:o="0.00",...i},l)=>{const m=s==="start";return e.jsx(Pe,{ref:l,label:t,step:n,min:a,placeholder:o,showSteppers:!1,prefixText:m?r:void 0,suffixText:m?void 0:r,...i})});Cr.displayName="GymatraCurrencyInput";const Sr=h.forwardRef(({label:t="Pourcentage",min:r=0,max:s=100,step:n=1,placeholder:a="0",...o},i)=>e.jsx(Pe,{ref:i,label:t,min:r,max:s,step:n,placeholder:a,showSteppers:!1,suffixText:"%",...o}));Sr.displayName="GymatraPercentageInput";const zr=h.forwardRef(({label:t="Date",error:r,helperText:s,required:n,disabled:a,className:o,...i},l)=>e.jsx(D,{label:t,error:r,helperText:s,required:n,disabled:a,endAdornment:e.jsxs("svg",{className:"size-4 text-text-subtle pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),children:e.jsx("input",{ref:l,type:"date",disabled:a,className:c("w-full h-11 px-3 bg-transparent text-sm text-text outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0 [color-scheme:light]",o),...i})}));zr.displayName="GymatraDateInput";const Pr=h.forwardRef(({label:t="Heure",error:r,helperText:s,required:n,disabled:a,className:o,...i},l)=>e.jsx(D,{label:t,error:r,helperText:s,required:n,disabled:a,endAdornment:e.jsxs("svg",{className:"size-4 text-text-subtle pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12 6 12 12 16 14"})]}),children:e.jsx("input",{ref:l,type:"time",disabled:a,className:c("w-full h-11 px-3 bg-transparent text-sm text-text outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0 [color-scheme:light]",o),...i})}));Pr.displayName="GymatraTimeInput";const Mr=h.forwardRef(({label:t="Date & Heure",error:r,helperText:s,required:n,disabled:a,className:o,...i},l)=>e.jsx(D,{label:t,error:r,helperText:s,required:n,disabled:a,endAdornment:e.jsxs("svg",{className:"size-4 text-text-subtle pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),children:e.jsx("input",{ref:l,type:"datetime-local",disabled:a,className:c("w-full h-11 px-3 bg-transparent text-sm text-text outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0 [color-scheme:light]",o),...i})}));Mr.displayName="GymatraDateTimeInput";function Rn({label:t="Période (Début - Fin)",startDate:r,endDate:s,onStartDateChange:n,onEndDateChange:a,error:o,helperText:i,disabled:l,required:m,className:u}){return e.jsx(D,{label:t,error:o,helperText:i,required:m,disabled:l,className:u,endAdornment:e.jsxs("svg",{className:"size-4 text-text-subtle pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),e.jsx("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),e.jsx("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),e.jsx("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),children:e.jsxs("div",{className:"flex items-center w-full px-2",children:[e.jsx("input",{type:"date",value:r,disabled:l,onChange:d=>n==null?void 0:n(d.target.value),className:"flex-1 h-11 bg-transparent text-sm text-text outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0 [color-scheme:light]"}),e.jsx("span",{className:"px-2 text-text-muted select-none",children:"→"}),e.jsx("input",{type:"date",value:s,disabled:l,onChange:d=>a==null?void 0:a(d.target.value),className:"flex-1 h-11 bg-transparent text-sm text-text outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0 [color-scheme:light]"})]})})}function Bn({name:t,label:r="Sélection",options:s,value:n,defaultValue:a,onChange:o,onBlur:i,placeholder:l="Sélectionner une option...",searchable:m=!1,searchPlaceholder:u="Rechercher...",clearable:d=!1,error:b,helperText:y,required:p,disabled:x,className:f,wrapperClassName:g}){const[j,k]=h.useState(a),[v,N]=h.useState(!1),[S,T]=h.useState(""),G=h.useRef(null),z=h.useRef(null),w=n!==void 0,P=w?n:j,F=s.find(I=>I.value===P);h.useEffect(()=>{const I=U=>{G.current&&!G.current.contains(U.target)&&N(!1)};if(v)return document.addEventListener("mousedown",I),()=>document.removeEventListener("mousedown",I)},[v]),h.useEffect(()=>{v&&m&&z.current&&z.current.focus(),v||T("")},[v,m]);const M=S.trim()?s.filter(I=>I.label.toLowerCase().includes(S.toLowerCase())||I.description&&I.description.toLowerCase().includes(S.toLowerCase())):s,W=I=>{I.disabled||(w||k(I.value),o==null||o(I.value),N(!1))},q=I=>{I.stopPropagation(),w||k(void 0),o==null||o(void 0)};return e.jsxs("div",{ref:G,className:c("relative w-full",g),children:[t&&e.jsx("input",{type:"hidden",name:t,value:P!==void 0?String(P):""}),e.jsx(D,{label:r,error:b,helperText:y,required:p,disabled:x,focused:v,endAdornment:e.jsxs("div",{className:"flex items-center gap-1",children:[d&&P!==void 0&&!x&&e.jsx("button",{type:"button",tabIndex:-1,onClick:q,className:"size-5 flex items-center justify-center rounded text-text-subtle hover:text-text hover:bg-surface-muted transition-colors cursor-pointer",title:"Effacer",children:e.jsxs("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})}),e.jsx("svg",{className:c("size-4 text-text-subtle transition-transform duration-200 pointer-events-none",v&&"rotate-180"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),children:e.jsx("button",{type:"button",disabled:x,onClick:()=>N(I=>!I),onBlur:i,className:c("w-full h-11 px-3.5 flex items-center justify-start text-start bg-transparent text-sm outline-none cursor-pointer border-0 ring-0",x&&"cursor-not-allowed text-text-subtle",f),children:F?e.jsxs("span",{className:"flex items-center gap-2 truncate text-text font-normal",children:[F.icon&&e.jsx("span",{className:"shrink-0 text-text-muted",children:F.icon}),e.jsx("span",{className:"truncate",children:F.label})]}):e.jsx("span",{className:"text-text-subtle/80 truncate",children:l})})}),v&&e.jsxs("div",{className:"absolute top-[calc(100%+4px)] start-0 z-50 w-full rounded-lg border border-border bg-white p-1.5 shadow-none max-h-72 overflow-y-auto animate-in fade-in-50 zoom-in-95",children:[m&&e.jsx("div",{className:"p-1 pb-1.5 border-b border-border mb-1",children:e.jsxs("div",{className:"flex items-center gap-2 px-2.5 py-1.5 bg-surface-muted rounded-md text-xs",children:[e.jsxs("svg",{className:"size-3.5 text-text-subtle shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),e.jsx("input",{ref:z,type:"text",value:S,onChange:I=>T(I.target.value),placeholder:u,className:"w-full bg-transparent text-text outline-none placeholder:text-text-subtle text-sm"}),S&&e.jsx("button",{type:"button",onClick:()=>T(""),className:"size-3.5 text-text-subtle hover:text-text cursor-pointer",children:"×"})]})}),e.jsx("div",{className:"space-y-0.5",children:M.length===0?e.jsx("div",{className:"py-4 text-center text-sm text-text-muted",children:"Aucun résultat trouvé"}):M.map(I=>{const U=I.value===P;return e.jsxs("button",{type:"button",disabled:I.disabled,onClick:()=>W(I),className:c("w-full flex items-center justify-between gap-2 px-3 py-2 rounded-md text-sm text-start transition-colors cursor-pointer",U?"bg-primary-soft text-primary font-medium":"text-text hover:bg-surface-muted",I.disabled&&"opacity-40 cursor-not-allowed hover:bg-transparent"),children:[e.jsxs("div",{className:"flex items-center gap-2.5 min-w-0",children:[I.icon&&e.jsx("span",{className:"shrink-0 text-text-muted",children:I.icon}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate font-medium",children:I.label}),I.description&&e.jsx("div",{className:"text-xs text-text-muted truncate mt-0.5",children:I.description})]})]}),U&&e.jsx("svg",{className:"size-4 text-primary shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})]},String(I.value))})})]})]})}const Ir=h.forwardRef(({label:t="Sélection",options:r,error:s,helperText:n,placeholder:a="Choisir...",disabled:o,required:i,className:l,children:m,...u},d)=>e.jsx(D,{label:t,error:s,helperText:n,required:i,disabled:o,endAdornment:e.jsx("svg",{className:"size-4 text-text-subtle pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),children:e.jsxs("select",{ref:d,disabled:o,className:c("w-full h-11 ps-3.5 pe-8 bg-transparent text-sm text-text outline-none appearance-none cursor-pointer border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0",l),...u,children:[a&&e.jsx("option",{value:"",children:a}),r.map(b=>e.jsx("option",{value:b.value,children:b.label},b.value)),m]})}));Ir.displayName="GymatraSelectField";function An({label:t="Sélection multiple",options:r,value:s=[],onChange:n,error:a,helperText:o,placeholder:i="Sélectionner...",disabled:l,required:m}){const[u,d]=h.useState(!1),b=h.useRef(null);h.useEffect(()=>{const x=f=>{b.current&&!b.current.contains(f.target)&&d(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[]);const y=x=>{s.includes(x)?n==null||n(s.filter(f=>f!==x)):n==null||n([...s,x])},p=r.filter(x=>s.includes(x.value));return e.jsxs("div",{ref:b,className:"relative w-full",children:[e.jsx(D,{label:t,error:a,helperText:o,required:m,disabled:l,focused:u,endAdornment:e.jsx("svg",{className:c("size-4 text-text-subtle transition-transform",u&&"rotate-180"),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),children:e.jsx("button",{type:"button",disabled:l,onClick:()=>d(!u),className:"w-full min-h-11 py-2 px-3.5 flex flex-wrap items-center gap-1.5 text-left text-sm text-text outline-none cursor-pointer",children:p.length===0?e.jsx("span",{className:"text-text-subtle",children:i}):p.map(x=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-surface-muted px-2 py-0.5 text-xs font-medium text-text border border-border",children:[x.label,e.jsx("span",{role:"button",tabIndex:0,onClick:f=>{f.stopPropagation(),y(x.value)},className:"text-text-muted hover:text-text cursor-pointer",children:"×"})]},x.value))})}),u&&e.jsx("div",{className:"absolute top-[calc(100%+4px)] start-0 z-50 w-full rounded-md border border-border bg-white p-1.5 shadow-none max-h-56 overflow-y-auto",children:r.map(x=>{const f=s.includes(x.value);return e.jsxs("div",{onClick:()=>y(x.value),className:c("flex items-center justify-between px-2.5 py-1.5 rounded text-sm cursor-pointer transition-colors",f?"bg-primary-soft text-primary font-medium":"text-text hover:bg-surface-muted"),children:[e.jsx("span",{children:x.label}),f&&e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4 text-primary","aria-hidden":"true",children:e.jsx("path",{d:"M20 6 9 17l-5-5"})})]},x.value)})})]})}function Dn({label:t="Autocomplétion",suggestions:r,value:s="",onChange:n,placeholder:a="Commencez à taper...",error:o,helperText:i}){const[l,m]=h.useState(!1),[u,d]=h.useState(s),b=h.useRef(null),y=s!==void 0?s:u,p=r.filter(x=>x.toLowerCase().includes(y.toLowerCase())&&x.toLowerCase()!==y.toLowerCase());return h.useEffect(()=>{const x=f=>{b.current&&!b.current.contains(f.target)&&m(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[]),e.jsxs("div",{ref:b,className:"relative w-full",children:[e.jsx(D,{label:t,error:o,helperText:i,focused:l&&p.length>0,children:e.jsx("input",{type:"text",value:y,placeholder:a,onFocus:()=>m(!0),onChange:x=>{const f=x.target.value;d(f),n==null||n(f),m(!0)},className:"w-full h-11 px-3.5 bg-transparent text-sm text-text placeholder:text-text-subtle outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0"})}),l&&p.length>0&&e.jsx("div",{className:"absolute top-[calc(100%+4px)] start-0 z-50 w-full rounded-md border border-border bg-white p-1 shadow-none max-h-48 overflow-y-auto",children:p.map((x,f)=>e.jsx("div",{onClick:()=>{d(x),n==null||n(x),m(!1)},className:"px-3 py-2 rounded text-sm text-text hover:bg-surface-muted cursor-pointer transition-colors",children:x},f))})]})}const Fn=Ge.Switch.Root,En=Ge.Switch.Thumb;function Wn(t="md"){switch(t){case"sm":return{track:"h-5 w-9 p-0.5",thumb:"size-4 data-[checked]:translate-x-4 rtl:data-[checked]:-translate-x-4"};case"lg":return{track:"h-7 w-13 p-0.5",thumb:"size-6 data-[checked]:translate-x-6 rtl:data-[checked]:-translate-x-6"};case"md":default:return{track:"h-6 w-11 p-0.5",thumb:"size-5 data-[checked]:translate-x-5 rtl:data-[checked]:-translate-x-5"}}}function $n(t="primary"){switch(t){case"success":return"data-[checked]:bg-success focus-visible:outline-success";case"danger":return"data-[checked]:bg-danger focus-visible:outline-danger";case"warning":return"data-[checked]:bg-warning focus-visible:outline-warning";case"primary":default:return"data-[checked]:bg-primary focus-visible:outline-primary"}}const yt=h.forwardRef(({size:t="md",variant:r="primary",label:s,description:n,labelPosition:a="right",onCheckedChange:o,onChange:i,disabled:l=!1,className:m,wrapperClassName:u,...d},b)=>{const y=Wn(t),p=$n(r),x=(g,j)=>{o==null||o(g,j),i==null||i(g)},f=e.jsx(Ge.Switch.Root,{ref:b,disabled:l,onCheckedChange:x,className:c("relative inline-flex shrink-0 cursor-pointer items-center rounded-full border-0 bg-text-subtle transition-colors duration-200 outline-none select-none shadow-none motion-reduce:transition-none","focus-visible:outline-2 focus-visible:outline-offset-2","data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",y.track,p,m),...d,children:e.jsx(Ge.Switch.Thumb,{className:c("pointer-events-none block rounded-full bg-white transition-transform duration-200 shadow-none translate-x-0 motion-reduce:transition-none",y.thumb)})});return!s&&!n?f:a==="left"?e.jsxs("label",{className:c("flex cursor-pointer select-none items-center justify-between gap-4 w-full",l&&"cursor-not-allowed",u),children:[e.jsxs("span",{className:"flex min-w-0 flex-col",children:[s&&e.jsx("span",{className:c("text-sm font-medium leading-tight",l?"text-text-subtle":"text-text"),children:s}),n&&e.jsx("span",{className:"mt-0.5 text-xs leading-normal text-text-muted",children:n})]}),f]}):e.jsxs("label",{className:c("inline-flex cursor-pointer select-none items-center gap-3",l&&"cursor-not-allowed",u),children:[f,e.jsxs("span",{className:"flex min-w-0 flex-col",children:[s&&e.jsx("span",{className:c("text-sm font-medium leading-tight",l?"text-text-subtle":"text-text"),children:s}),n&&e.jsx("span",{className:"mt-0.5 text-xs leading-normal text-text-muted",children:n})]})]})});yt.displayName="GymatraSwitch";function On({label:t,boxLabel:r,description:s,error:n,helperText:a,disabled:o,className:i,...l}){return e.jsx(D,{label:t,error:n,helperText:a,disabled:o,className:i,children:e.jsx(ct,{label:r,description:s,disabled:o,invalid:!!n,wrapperClassName:"flex w-full p-3",...l})})}function Hn({label:t="Options",name:r,options:s,value:n,defaultValue:a,onChange:o,direction:i="horizontal",error:l,helperText:m,disabled:u}){return e.jsx(D,{label:t,error:l,helperText:m,disabled:u,children:e.jsx("div",{className:c("p-3 w-full flex flex-wrap gap-4",i==="vertical"&&"flex-col gap-2.5"),children:s.map(d=>e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[e.jsx("input",{type:"radio",name:r,value:d.value,checked:n!==void 0?n===d.value:void 0,defaultChecked:a===d.value,onChange:()=>o==null?void 0:o(d.value),disabled:u,className:"size-4 accent-primary"}),e.jsx("span",{className:"text-sm font-medium text-text",children:d.label})]},d.value))})})}function qn({label:t,switchLabel:r,description:s,checked:n,defaultChecked:a,onChange:o,error:i,helperText:l,disabled:m}){return e.jsx(D,{label:t,error:i,helperText:l,disabled:m,children:e.jsx(yt,{label:r,description:s,labelPosition:"left",checked:n,defaultChecked:a,onChange:o,disabled:m,"aria-invalid":i?!0:void 0,wrapperClassName:"p-3"})})}function Un({label:t,options:r,value:s,onChange:n,error:a,helperText:o}){return e.jsx(D,{label:t,error:a,helperText:o,children:e.jsx("div",{className:"flex items-center p-1.5 w-full gap-1",children:r.map(i=>e.jsx("button",{type:"button",onClick:()=>n(i.value),className:c("flex-1 h-8 rounded text-sm font-medium transition-colors cursor-pointer",s===i.value?"bg-primary text-white shadow-none":"bg-surface-muted text-text-muted hover:bg-border/60 hover:text-text"),children:i.label},i.value))})})}const Tr=h.forwardRef(({label:t="Description",error:r,helperText:s,required:n,disabled:a,className:o,placeholder:i,rows:l=3,...m},u)=>e.jsx(D,{label:t,error:r,helperText:s,required:n,disabled:a,children:e.jsx("textarea",{ref:u,rows:l,disabled:a,placeholder:i||(typeof t=="string"?t:void 0),className:c("w-full p-3 bg-transparent text-sm text-text placeholder:text-text-subtle/80 outline-none resize-none",o),...m})}));Tr.displayName="GymatraTextareaField";function Vn({label:t="Contenu enrichi",value:r,defaultValue:s="",onChange:n,placeholder:a="Rédigez votre texte...",error:o,helperText:i,disabled:l}){const[m,u]=h.useState(s),d=r!==void 0?r:m,b=y=>{const p=`${d} [${y}]`;r===void 0&&u(p),n==null||n(p)};return e.jsx(D,{label:t,error:o,helperText:i,disabled:l,children:e.jsxs("div",{className:"flex flex-col w-full",children:[e.jsxs("div",{className:"flex items-center gap-1 border-b border-border p-2 bg-surface-muted/50",children:[e.jsx("button",{type:"button",onClick:()=>b("b"),className:"size-7 rounded text-sm font-semibold text-text hover:bg-white transition-colors",title:"Gras",children:"B"}),e.jsx("button",{type:"button",onClick:()=>b("i"),className:"size-7 rounded text-sm italic font-serif text-text hover:bg-white transition-colors",title:"Italique",children:"I"}),e.jsx("button",{type:"button",onClick:()=>b("u"),className:"size-7 rounded text-sm underline text-text hover:bg-white transition-colors",title:"Souligné",children:"U"}),e.jsx("span",{className:"h-4 w-px bg-border mx-1"}),e.jsx("button",{type:"button",onClick:()=>b("ul"),className:"size-7 rounded text-sm text-text hover:bg-white transition-colors flex items-center justify-center",title:"Liste à puces",children:e.jsxs("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),e.jsx("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),e.jsx("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),e.jsx("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]})}),e.jsx("button",{type:"button",onClick:()=>b("link"),className:"size-7 rounded text-sm text-text hover:bg-white transition-colors flex items-center justify-center",title:"Lien",children:e.jsxs("svg",{className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),e.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]})})]}),e.jsx("textarea",{rows:4,value:d,disabled:l,placeholder:a,onChange:y=>{r===void 0&&u(y.target.value),n==null||n(y.target.value)},className:"w-full p-3 bg-transparent text-sm text-text placeholder:text-text-subtle/80 outline-none resize-none"})]})})}function _n({label:t="Fichiers joints",accept:r,multiple:s=!1,onFilesSelected:n,error:a,helperText:o,disabled:i}){const[l,m]=h.useState([]),u=h.useId(),d=b=>{if(!b||b.length===0)return;const y=Array.from(b);m(y.map(p=>p.name)),n==null||n(y)};return e.jsx(D,{label:t,error:a,helperText:o,disabled:i,children:e.jsxs("div",{className:"flex flex-col w-full p-3.5",children:[e.jsx("input",{id:u,type:"file",accept:r,multiple:s,disabled:i,onChange:b=>d(b.target.files),className:"hidden"}),e.jsxs("label",{htmlFor:u,className:"flex flex-col items-center justify-center border-2 border-dashed border-border rounded-md p-4 bg-surface-muted/30 hover:bg-surface-muted cursor-pointer transition-colors text-center",children:[e.jsxs("svg",{className:"size-6 text-text-subtle mb-1.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"17 8 12 3 7 8"}),e.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),e.jsx("span",{className:"text-sm font-medium text-primary",children:"Cliquez pour parcourir"}),e.jsx("span",{className:"text-xs text-text-muted mt-0.5",children:"ou glissez-déposez vos fichiers ici"})]}),l.length>0&&e.jsx("div",{className:"mt-2.5 flex flex-wrap gap-1.5",children:l.map((b,y)=>e.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-surface-muted px-2 py-0.5 text-xs text-text border border-border",children:["📄 ",b]},y))})]})})}function Kn({label:t="Téléverser une image",onImageSelected:r,error:s,helperText:n,disabled:a}){const[o,i]=h.useState(null),l=h.useId(),m=u=>{const d=u==null?void 0:u[0];d&&(i(URL.createObjectURL(d)),r==null||r(d))};return e.jsx(D,{label:t,error:s,helperText:n,disabled:a,children:e.jsxs("div",{className:"flex items-center justify-between w-full p-3.5 gap-3",children:[e.jsx("input",{id:l,type:"file",accept:"image/*",disabled:a,onChange:u=>m(u.target.files),className:"hidden"}),o?e.jsxs("div",{className:"flex items-center gap-3 w-full",children:[e.jsx("img",{src:o,alt:"Aperçu",className:"size-14 rounded-md object-cover border border-border shrink-0"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("label",{htmlFor:l,className:"text-xs font-medium text-primary hover:underline cursor-pointer block",children:"Changer l'image"}),e.jsx("button",{type:"button",onClick:()=>i(null),className:"mt-1 text-xs text-danger hover:underline cursor-pointer",children:"Supprimer"})]})]}):e.jsxs("label",{htmlFor:l,className:"flex items-center gap-3 w-full cursor-pointer",children:[e.jsx("div",{className:"size-12 rounded-md bg-surface-muted border border-border flex items-center justify-center text-text-subtle shrink-0",children:e.jsxs("svg",{className:"size-6",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),e.jsx("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),e.jsx("polyline",{points:"21 15 16 10 5 21"})]})}),e.jsxs("div",{children:[e.jsx("span",{className:"text-sm font-medium text-text block",children:"Sélectionner une photo"}),e.jsx("span",{className:"text-xs text-text-muted",children:"PNG, JPG, WebP jusqu'à 5MB"})]})]})]})})}function Zn({label:t="Photo de profil",initialSrc:r,onAvatarChange:s,error:n,helperText:a,disabled:o}){const[i,l]=h.useState(r??null),m=h.useId(),u=d=>{const b=d==null?void 0:d[0];b&&(l(URL.createObjectURL(b)),s==null||s(b))};return e.jsx(D,{label:t,error:n,helperText:a,disabled:o,children:e.jsxs("div",{className:"flex items-center gap-3.5 w-full p-3.5",children:[e.jsx("input",{id:m,type:"file",accept:"image/*",disabled:o,onChange:d=>u(d.target.files),className:"hidden"}),e.jsx("div",{className:"size-12 rounded-full border border-border bg-surface-muted overflow-hidden flex items-center justify-center shrink-0",children:i?e.jsx("img",{src:i,alt:"Avatar",className:"size-full object-cover"}):e.jsx("svg",{className:"size-6 text-text-subtle",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",children:e.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"})})}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:m,className:"inline-flex h-8 items-center justify-center rounded-md border border-border bg-surface px-3 text-xs font-medium text-text hover:bg-surface-muted cursor-pointer transition-colors",children:"Téléverser une photo"}),e.jsx("span",{className:"text-xs text-text-muted block mt-0.5",children:"Format carré recommandé"})]})]})})}const Qn=["#224086","#10B981","#EF4444","#F59E0B","#8B5CF6","#06B6D4","#1E293B"];function Lr({name:t,label:r="Couleur",value:s,defaultValue:n="#224086",onChange:a,onBlur:o,presets:i=Qn,showPresets:l=!0,error:m,helperText:u,disabled:d,required:b,className:y,wrapperClassName:p}){const[x,f]=h.useState(n),g=s!==void 0?s:x,j=v=>{s===void 0&&f(v),a==null||a(v)},k=g.startsWith("#")?g.slice(1):g;return e.jsx(D,{label:r,error:m,helperText:u,required:b,disabled:d,wrapperClassName:p,className:y,startAdornment:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"relative size-6 rounded border border-border overflow-hidden cursor-pointer shrink-0 shadow-none hover:border-text-subtle transition-colors",children:[e.jsx("div",{className:"w-full h-full",style:{backgroundColor:g||"#224086"}}),e.jsx("input",{type:"color",value:g.startsWith("#")&&g.length===7?g:"#224086",disabled:d,onChange:v=>j(v.target.value.toUpperCase()),className:"absolute inset-0 opacity-0 w-full h-full cursor-pointer disabled:cursor-not-allowed","aria-label":"Choisir la couleur"})]}),e.jsx("span",{className:"text-text-muted font-mono text-sm select-none",children:"#"})]}),endAdornment:l&&i.length>0?e.jsx("div",{className:"flex items-center gap-1.5 pe-1",children:i.slice(0,7).map(v=>{const N=g.toLowerCase()===v.toLowerCase();return e.jsx("button",{type:"button",disabled:d,onClick:()=>j(v),className:c("size-4 rounded-full border transition-all cursor-pointer hover:scale-115 shrink-0",N?"ring-2 ring-primary ring-offset-1 border-white scale-110":"border-border/60 hover:border-text-subtle"),style:{backgroundColor:v},title:v,"aria-label":`Couleur ${v}`},v)})}):void 0,children:e.jsx("input",{name:t,type:"text",value:k.toUpperCase(),disabled:d,maxLength:6,onChange:v=>{const N=v.target.value.replace(/[^0-9A-Fa-f]/g,"");N.length<=6&&j(`#${N}`)},onBlur:o,placeholder:"224086",className:c("w-full h-11 ps-1 pe-2 bg-transparent text-sm font-mono text-text placeholder:text-text-subtle/80 uppercase outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0","disabled:cursor-not-allowed")})})}const Yn=Lr;function Jn({label:t="Intensité",min:r=0,max:s=100,step:n=1,value:a,defaultValue:o=50,unit:i="%",onChange:l,error:m,helperText:u,disabled:d}){const[b,y]=h.useState(o),p=a!==void 0?a:b;return e.jsx(D,{label:t,error:m,helperText:u,disabled:d,children:e.jsxs("div",{className:"flex items-center gap-3 w-full p-3",children:[e.jsx("input",{type:"range",min:r,max:s,step:n,value:p,disabled:d,onChange:x=>{const f=Number(x.target.value);a===void 0&&y(f),l==null||l(f)},className:"flex-1 accent-primary cursor-pointer"}),e.jsxs("span",{className:"min-w-10 text-right text-sm font-medium text-text font-mono tabular-nums",children:[p,i]})]})})}function Xn({label:t="Fourchette",min:r=0,max:s=1e3,minValue:n=100,maxValue:a=600,unit:o="€",onRangeChange:i,error:l,helperText:m}){const[u,d]=h.useState(n),[b,y]=h.useState(a);return e.jsx(D,{label:t,error:l,helperText:m,children:e.jsxs("div",{className:"flex items-center justify-between w-full p-3 gap-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Min:"}),e.jsx("input",{type:"number",min:r,max:b,value:u,onChange:p=>{const x=Number(p.target.value);d(x),i==null||i(x,b)},className:"w-full h-8 px-2 rounded border border-border text-sm text-text outline-none focus:border-primary"}),e.jsx("span",{className:"text-xs text-text-muted",children:o})]}),e.jsx("span",{className:"text-text-muted",children:"—"}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[e.jsx("span",{className:"text-xs text-text-muted",children:"Max:"}),e.jsx("input",{type:"number",min:u,max:s,value:b,onChange:p=>{const x=Number(p.target.value);y(x),i==null||i(u,x)},className:"w-full h-8 px-2 rounded border border-border text-sm text-text outline-none focus:border-primary"}),e.jsx("span",{className:"text-xs text-text-muted",children:o})]})]})})}function ea({label:t="Code de validation (OTP)",length:r=6,value:s,onChange:n,error:a,helperText:o,disabled:i}){const l=h.useId(),[m,u]=h.useState(""),d=s!==void 0?s:m,b=(p,x)=>{x.length>1&&(x=x.slice(-1));const f=d.padEnd(r," ").split("");f[p]=x||" ";const g=f.join("").trimEnd();if(s===void 0&&u(g),n==null||n(g),x&&p<r-1){const j=document.getElementById(`${l}-otp-${p+1}`);j==null||j.focus()}},y=(p,x)=>{if(x.key==="Backspace"&&!d[p]&&p>0){const f=document.getElementById(`${l}-otp-${p-1}`);f==null||f.focus()}};return e.jsx(D,{label:t,error:a,helperText:o,disabled:i,children:e.jsx("div",{className:"flex items-center justify-between w-full p-3 gap-2",children:Array.from({length:r}).map((p,x)=>e.jsx("input",{id:`${l}-otp-${x}`,"aria-label":`Chiffre ${x+1} sur ${r}`,type:"text",inputMode:"numeric",maxLength:1,disabled:i,value:d[x]&&d[x]!==" "?d[x]:"",onChange:f=>b(x,f.target.value),onKeyDown:f=>y(x,f),className:"size-10 rounded-md border border-border bg-surface-muted text-center text-base font-semibold text-text focus:border-primary focus:bg-white focus:outline-none"},x))})})}function Me({label:t,error:r,helperText:s,required:n,disabled:a,startAdornment:o,endAdornment:i,focused:l,hasValue:m,className:u,children:d,...b}){const y=!!r;return e.jsxs("div",{className:c("relative w-full pt-2.5 pb-1",a&&"opacity-60 pointer-events-none",u),...b,children:[e.jsxs("div",{className:c("group relative flex items-center w-full min-h-11 rounded-md border bg-white transition-all",y?"border-danger focus-within:border-danger focus-within:ring-1 focus-within:ring-danger":l?"border-primary ring-1 ring-primary":"border-border hover:border-text-subtle focus-within:border-primary focus-within:ring-1 focus-within:ring-primary"),children:[e.jsxs("label",{className:c("pointer-events-none absolute -top-3 start-3 z-10 px-1.5 bg-white text-sm leading-none font-medium transition-colors select-none",y?"text-danger":l?"text-primary":"text-text-muted group-focus-within:text-primary group-hover:text-text"),children:[t,n&&e.jsx("span",{className:"ms-0.5 text-danger",children:"*"})]}),o&&e.jsx("div",{className:"flex shrink-0 items-center ps-3 text-text-muted select-none",children:o}),e.jsx("div",{className:"flex-1 min-w-0 flex items-center",children:d}),i&&e.jsx("div",{className:"flex shrink-0 items-center pe-3 text-text-muted select-none",children:i})]}),(r||s)&&e.jsx("p",{className:c("mt-1 text-xs leading-none ps-1",y?"text-danger":"text-text-muted"),children:r||s})]})}const Rr=h.forwardRef(({label:t,error:r,helperText:s,startIcon:n,endIcon:a,prefixText:o,suffixText:i,type:l="text",value:m,defaultValue:u,onChange:d,disabled:b,required:y,className:p,placeholder:x,...f},g)=>{const[j,k]=h.useState(!1),[v,N]=h.useState(u??""),S=m!==void 0,T=l==="password",G=T?j?"text":"password":l;return e.jsx(Me,{label:t,error:r,helperText:s,required:y,disabled:b,className:p,startAdornment:n||o?e.jsxs("div",{className:"flex items-center gap-1.5 text-text-muted text-sm",children:[n,o&&e.jsx("span",{className:"font-medium text-text",children:o})]}):void 0,endAdornment:T?e.jsx("button",{type:"button",tabIndex:-1,onClick:()=>k(!j),className:"text-text-muted hover:text-text cursor-pointer transition-colors","aria-label":j?"Hide password":"Show password",children:j?e.jsxs("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),e.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]}):e.jsxs("svg",{className:"size-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}):i||a?e.jsxs("div",{className:"flex items-center gap-1.5 text-text-muted text-sm",children:[i&&e.jsx("span",{className:"font-medium text-text",children:i}),a]}):void 0,children:e.jsx("input",{ref:g,type:G,value:m,defaultValue:u,onChange:z=>{S||N(z.target.value),d==null||d(z)},disabled:b,placeholder:x||(typeof t=="string"?t:void 0),className:c("w-full h-11 px-3.5 bg-transparent text-sm text-text placeholder:text-text-subtle/80 outline-none border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0","disabled:cursor-not-allowed"),...f})})});Rr.displayName="GymatraTextField";const Br=h.forwardRef(({label:t,error:r,helperText:s,required:n,disabled:a,className:o,placeholder:i,rows:l=3,...m},u)=>e.jsx(Me,{label:t,error:r,helperText:s,required:n,disabled:a,className:o,children:e.jsx("textarea",{ref:u,rows:l,disabled:a,placeholder:i||(typeof t=="string"?t:void 0),className:"w-full p-3 bg-transparent text-sm text-text placeholder:text-text-subtle/80 outline-none resize-none",...m})}));Br.displayName="GymatraFloatingTextarea";const Ar=h.forwardRef(({label:t,error:r,helperText:s,required:n,disabled:a,options:o,className:i,children:l,...m},u)=>e.jsx(Me,{label:t,error:r,helperText:s,required:n,disabled:a,className:i,endAdornment:e.jsx("svg",{className:"size-4 text-text-subtle pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"6 9 12 15 18 9"})}),children:e.jsxs("select",{ref:u,disabled:a,className:"w-full h-11 ps-3.5 pe-8 bg-transparent text-sm text-text outline-none appearance-none cursor-pointer border-0 border-none ring-0 shadow-none focus:ring-0 focus:outline-none focus:border-0",...m,children:[o.map(d=>e.jsx("option",{value:d.value,children:d.label},d.value)),l]})}));Ar.displayName="GymatraFloatingSelect";function ta({length:t=6,value:r="",onChange:s,label:n="Code OTP / PIN",error:a,disabled:o}){const[i,l]=h.useState(r),m=r!==void 0?r:i,u=(b,y)=>{y.length>1&&(y=y.slice(-1));const p=m.padEnd(t," ").split("");p[b]=y||" ";const x=p.join("").trimEnd();if(r===void 0&&l(x),s==null||s(x),y&&b<t-1){const f=document.getElementById(`otp-digit-${b+1}`);f==null||f.focus()}},d=(b,y)=>{if(y.key==="Backspace"&&!m[b]&&b>0){const p=document.getElementById(`otp-digit-${b-1}`);p==null||p.focus()}};return e.jsx("div",{className:"relative",children:e.jsx(Me,{label:n,error:a,disabled:o,children:e.jsx("div",{className:"flex items-center justify-between w-full p-2.5 gap-2",children:Array.from({length:t}).map((b,y)=>e.jsx("input",{id:`otp-digit-${y}`,type:"text",inputMode:"numeric",maxLength:1,disabled:o,value:m[y]&&m[y]!==" "?m[y]:"",onChange:p=>u(y,p.target.value),onKeyDown:p=>d(y,p),className:"size-10 rounded-md border border-border bg-surface-muted text-center text-base font-semibold text-text focus:border-primary focus:bg-white focus:outline-none"},y))})})})}function ra({label:t="Photo de profil",src:r,onChange:s,disabled:n}){const[a,o]=h.useState(r),i=h.useId(),l=m=>{var d;const u=(d=m.target.files)==null?void 0:d[0];if(u){const b=URL.createObjectURL(u);o(b),s==null||s(u)}};return e.jsxs("div",{className:"relative rounded-md border border-border p-3.5 bg-white",children:[e.jsx("label",{className:"absolute -top-2.5 start-2.5 px-1 bg-white text-xs font-medium text-text-muted",children:t}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"relative size-12 shrink-0 rounded-full border border-border overflow-hidden bg-surface-muted flex items-center justify-center text-text-muted",children:a?e.jsx("img",{src:a,alt:"Avatar preview",className:"size-full object-cover"}):e.jsx("svg",{className:"size-6",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",children:e.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"})})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("input",{id:i,type:"file",accept:"image/*",disabled:n,onChange:l,className:"hidden"}),e.jsx("label",{htmlFor:i,className:"inline-flex h-8 items-center justify-center rounded-md border border-border bg-surface px-3 text-xs font-medium text-text hover:bg-surface-muted cursor-pointer transition-colors",children:"Téléverser une image"}),e.jsx("p",{className:"mt-1 text-xs text-text-muted",children:"PNG, JPG jusqu'à 2MB"})]})]})]})}const Dr="grid min-w-0 gap-1.5 text-text",Fr="text-xs font-medium text-text-muted",Er="ms-1 text-primary",Wr="text-xs text-text-muted",De="text-xs text-danger",gt="flex min-h-10 w-full items-center rounded-md border border-border bg-white px-3 text-sm text-text placeholder:text-text-subtle outline-none transition-colors hover:border-border-strong focus-visible:border-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary/30 aria-[invalid=true]:border-danger data-[invalid]:border-danger disabled:cursor-not-allowed disabled:bg-surface-muted disabled:text-text-subtle";function sa({className:t,...r}){return e.jsx(Wt.Form,{...r,className:typeof t=="function"?s=>c("flex flex-col gap-6",t(s)):c("flex flex-col gap-6",t)})}function na({name:t,label:r,description:s,error:n,required:a,disabled:o,validate:i,validationMode:l,className:m,children:u}){return e.jsxs(_.Field.Root,{name:t,invalid:!!n,disabled:o,validate:i,validationMode:l,className:c(Dr,m),children:[e.jsxs(_.Field.Label,{className:Fr,children:[r,a&&e.jsx("span",{className:Er,"aria-hidden":"true",children:"*"})]}),u,s&&e.jsx(_.Field.Description,{className:Wr,children:s}),n?e.jsx(_.Field.Error,{match:!0,className:De,children:n}):e.jsx(_.Field.Error,{match:"valueMissing",className:De,children:"This field is required."}),!n&&e.jsx(_.Field.Error,{match:"typeMismatch",className:De,children:"Enter a valid value."})]})}const $r=h.forwardRef(({className:t,...r},s)=>e.jsx(_.Field.Control,{ref:s,render:e.jsx($t.Input,{}),...r,className:c(gt,t)}));$r.displayName="GymatraInput";function aa({rows:t=4,className:r,...s}){return e.jsx(_.Field.Control,{...s,render:e.jsx("textarea",{rows:t}),className:c(gt,"min-h-24 resize-y py-2.5",r)})}function oa({name:t,label:r,description:s,error:n,options:a,value:o,defaultValue:i,onValueChange:l,placeholder:m="Choose an option",required:u,disabled:d,className:b}){const y=h.useId(),p=s?`${y}-description`:void 0,x=`${y}-error`;return e.jsxs(_.Field.Root,{name:t,invalid:!!n,disabled:d,className:c(Dr,b),children:[e.jsxs(_.Field.Label,{htmlFor:y,className:Fr,children:[r,u&&e.jsx("span",{className:Er,"aria-hidden":"true",children:"*"})]}),e.jsxs(K.Select.Root,{name:t,id:y,items:a,value:o,defaultValue:i,onValueChange:l,required:u,disabled:d,children:[e.jsxs(K.Select.Trigger,{"aria-describedby":[p,x].filter(Boolean).join(" "),"aria-invalid":n?!0:void 0,className:c(gt,"cursor-pointer justify-between gap-3 text-start data-[popup-open]:border-primary"),children:[e.jsx(K.Select.Value,{placeholder:m}),e.jsx(K.Select.Icon,{"aria-hidden":"true",className:"flex text-text-muted",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})})]}),e.jsx(K.Select.Portal,{children:e.jsx(K.Select.Positioner,{sideOffset:4,className:"z-[10020] outline-none",children:e.jsx(K.Select.Popup,{className:"min-w-[var(--anchor-width)] overflow-hidden rounded-md border border-border bg-white p-1 text-text shadow-none outline-none",children:e.jsx(K.Select.List,{children:a.map(f=>e.jsxs(K.Select.Item,{value:f.value,className:"flex min-h-9 cursor-default items-center justify-between gap-2 rounded-sm px-2.5 text-sm text-text outline-none data-[highlighted]:bg-primary-soft data-[highlighted]:text-primary data-[selected]:font-semibold data-[selected]:text-primary",children:[e.jsx(K.Select.ItemText,{children:f.label}),e.jsx(K.Select.ItemIndicator,{className:"flex text-primary",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:"size-4","aria-hidden":"true",children:e.jsx("path",{d:"M20 6 9 17l-5-5"})})})]},f.value))})})})})]}),s&&e.jsx(_.Field.Description,{id:p,className:Wr,children:s}),e.jsx(_.Field.Error,{id:x,match:n?!0:"valueMissing",className:De,children:n??"Choose an option."})]})}const ia=R.Menu.Root,la=R.Menu.Trigger,ca=R.Menu.Portal,da=R.Menu.Positioner,Or=R.Menu.Group,ua=R.Menu.RadioGroup,xa=R.Menu.SubmenuRoot,ye=h.forwardRef(({className:t,children:r,...s},n)=>e.jsx(R.Menu.Popup,{ref:n,className:c("z-50 min-w-48 rounded-lg border border-border bg-white p-1 text-sm text-text outline-none shadow-none",t),...s,children:r}));ye.displayName="GymatraMenuPopup";const He=h.forwardRef(({variant:t="default",startIcon:r,endIcon:s,shortcut:n,className:a,children:o,...i},l)=>e.jsxs(R.Menu.Item,{ref:l,className:c("group relative flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-1.5 text-sm outline-none transition-colors","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t==="danger"?"text-danger data-[highlighted]:bg-danger-soft data-[highlighted]:text-danger font-medium":t==="primary"?"text-primary data-[highlighted]:bg-primary-soft data-[highlighted]:text-primary font-medium":"text-text data-[highlighted]:bg-surface-muted data-[highlighted]:text-text",a),...i,children:[r&&e.jsx("span",{className:"shrink-0 size-4 text-text-muted group-data-[highlighted]:text-current flex items-center justify-center",children:r}),e.jsx("span",{className:"flex-1 truncate",children:o}),n&&e.jsx("kbd",{className:"ml-auto pl-3 font-mono text-xs text-text-muted",children:n}),s&&e.jsx("span",{className:"shrink-0 size-4 text-text-muted group-data-[highlighted]:text-current flex items-center justify-center ml-auto",children:s})]}));He.displayName="GymatraMenuItem";const qe=h.forwardRef(({className:t,...r},s)=>e.jsx(R.Menu.Separator,{ref:s,className:c("my-1 h-px bg-border -mx-1",t),...r}));qe.displayName="GymatraMenuSeparator";const Ue=h.forwardRef(({className:t,...r},s)=>e.jsx(R.Menu.GroupLabel,{ref:s,className:c("px-2.5 py-1 text-xs font-semibold uppercase tracking-wider text-text-muted select-none",t),...r}));Ue.displayName="GymatraMenuGroupLabel";function ma({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}function pa({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}const Ve=h.forwardRef(({className:t,children:r,shortcut:s,...n},a)=>e.jsxs(R.Menu.CheckboxItem,{ref:a,className:c("group relative flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-1.5 text-sm text-text outline-none transition-colors","data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-surface-muted",t),...n,children:[e.jsx("span",{className:"shrink-0 size-4 flex items-center justify-center text-primary",children:e.jsx(R.Menu.CheckboxItemIndicator,{children:e.jsx(ma,{})})}),e.jsx("span",{className:"flex-1 truncate",children:r}),s&&e.jsx("kbd",{className:"ml-auto pl-3 font-mono text-xs text-text-muted",children:s})]}));Ve.displayName="GymatraMenuCheckboxItem";const _e=h.forwardRef(({className:t,children:r,...s},n)=>e.jsxs(R.Menu.RadioItem,{ref:n,className:c("group relative flex w-full cursor-pointer select-none items-center gap-2 rounded-md px-2.5 py-1.5 text-sm text-text outline-none transition-colors","data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-surface-muted",t),...s,children:[e.jsx("span",{className:"shrink-0 size-4 flex items-center justify-center text-primary",children:e.jsx(R.Menu.RadioItemIndicator,{children:e.jsx("span",{className:"size-2 rounded-full bg-primary"})})}),e.jsx("span",{className:"flex-1 truncate",children:r})]}));_e.displayName="GymatraMenuRadioItem";const Ke=h.forwardRef(({startIcon:t,className:r,children:s,...n},a)=>e.jsxs(R.Menu.SubmenuTrigger,{ref:a,className:c("group relative flex w-full cursor-pointer select-none items-center justify-between gap-2 rounded-md px-2.5 py-1.5 text-sm text-text outline-none transition-colors","data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[highlighted]:bg-surface-muted",r),...n,children:[e.jsxs("div",{className:"flex items-center gap-2 truncate",children:[t&&e.jsx("span",{className:"shrink-0 size-4 text-text-muted group-data-[highlighted]:text-current flex items-center justify-center",children:t}),e.jsx("span",{className:"truncate",children:s})]}),e.jsx(pa,{className:"size-3.5 text-text-muted shrink-0"})]}));Ke.displayName="GymatraMenuSubmenuTrigger";function Ze(t){const r=[];let s=0;for(;s<t.length;){const n=t[s];if(n.type!=="label"){r.push(Ft(n,s)),s++;continue}const a=s,o=[];for(s++;s<t.length&&t[s].type!=="label"&&t[s].type!=="separator";)o.push(Ft(t[s],s)),s++;r.push(e.jsxs(Or,{children:[e.jsx(Ue,{children:n.label}),o]},n.key??`menu-group-${a}`))}return r}function Ft(t,r){const s=t.key??`menu-item-${r}`;return t.type==="separator"?e.jsx(qe,{},s):t.type==="checkbox"?e.jsx(Ve,{checked:t.checked,onCheckedChange:t.onCheckedChange,shortcut:t.shortcut,disabled:t.disabled,children:t.label},s):t.type==="radio"?e.jsx(_e,{value:t.value??String(s),disabled:t.disabled,children:t.label},s):t.items&&t.items.length>0?e.jsxs(R.Menu.SubmenuRoot,{children:[e.jsx(Ke,{startIcon:t.startIcon??t.icon,disabled:t.disabled,children:t.label}),e.jsx(R.Menu.Portal,{children:e.jsx(R.Menu.Positioner,{sideOffset:4,align:"start",className:"z-[10020] outline-none",children:e.jsx(ye,{children:Ze(t.items)})})})]},s):e.jsx(He,{variant:t.variant,startIcon:t.startIcon??t.icon,endIcon:t.endIcon,shortcut:t.shortcut,disabled:t.disabled,onClick:t.onClick,children:t.label},s)}function fa({trigger:t,items:r,open:s,defaultOpen:n,onOpenChange:a,side:o="bottom",align:i="start",sideOffset:l=6,width:m="min-w-[200px]",popupClassName:u,children:d}){const b=s!==void 0?{open:s,onOpenChange:a}:n!==void 0?{defaultOpen:n,onOpenChange:a}:{onOpenChange:a};return e.jsxs(R.Menu.Root,{...b,children:[e.jsx(R.Menu.Trigger,{render:h.isValidElement(t)?t:e.jsx("button",{type:"button",children:t})}),e.jsx(R.Menu.Portal,{children:e.jsx(R.Menu.Positioner,{side:o,align:i,sideOffset:l,className:"z-[10020] outline-none",children:e.jsx(ye,{className:c(m,u),children:r&&r.length>0?Ze(r):d})})})]})}const ha=Ot.Menubar,ba=R.Menu.Root,ya=R.Menu.Portal,ga=R.Menu.Positioner,ja=R.Menu.Group,va=R.Menu.RadioGroup,wa=R.Menu.SubmenuRoot,Na=ye,ka=He,Ga=qe,Ca=Ue,Sa=Ve,za=_e,Pa=Ke,jt=h.forwardRef(({className:t,startIcon:r,children:s,...n},a)=>e.jsxs(R.Menu.Trigger,{ref:a,className:c("flex cursor-pointer select-none items-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium text-text outline-none transition-colors","hover:bg-surface-muted hover:text-text","data-[popup-open]:bg-primary-soft data-[popup-open]:text-primary","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary","data-[disabled]:opacity-50 data-[disabled]:pointer-events-none",t),...n,children:[r&&e.jsx("span",{className:"shrink-0 size-4 text-text-muted flex items-center justify-center",children:r}),e.jsx("span",{children:s})]}));jt.displayName="GymatraMenubarTrigger";const Hr=h.forwardRef(({menus:t,bordered:r=!0,className:s,children:n,...a},o)=>e.jsx(Ot.Menubar,{ref:o,className:c("flex items-center gap-0.5 text-sm text-text select-none",r?"rounded-md border border-border bg-white p-1 shadow-none":"bg-transparent p-0.5",s),...a,children:t&&t.length>0?t.map((i,l)=>{const m=i.key??`menubar-menu-${l}`;return e.jsxs(R.Menu.Root,{disabled:i.disabled,children:[e.jsx(jt,{startIcon:i.startIcon,disabled:i.disabled,children:i.trigger}),e.jsx(R.Menu.Portal,{children:e.jsx(R.Menu.Positioner,{side:i.side??"bottom",align:i.align??"start",sideOffset:i.sideOffset??6,className:"z-[10020] outline-none",children:e.jsx(ye,{className:c(i.width??"min-w-52",i.popupClassName),children:Ze(i.items)})})})]},m)}):n}));Hr.displayName="GymatraMenubar";function Ma({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m15 18-6-6 6-6"})})}function Ia({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}function Ta({className:t="size-3"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function La({className:t="size-3"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}function vt({page:t,total:r,pageSize:s,onPageChange:n,pageSizeOptions:a,onPageSizeChange:o,showSummary:i=!0,className:l,...m}){const u=Math.max(1,Math.ceil(r/s)),d=Math.min(Math.max(1,t),u),b=r===0?0:(d-1)*s+1,y=Math.min(d*s,r),[p,x]=h.useState(!1),f=h.useRef(null);h.useEffect(()=>{function k(v){f.current&&!f.current.contains(v.target)&&x(!1)}if(p)return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[p]);function g(){return u<=7?Array.from({length:u},(k,v)=>v+1):d<=4?[1,2,3,4,5,"ellipsis",u]:d>=u-3?[1,"ellipsis",u-4,u-3,u-2,u-1,u]:[1,"ellipsis",d-1,d,d+1,"ellipsis",u]}const j=g();return e.jsxs("div",{className:c("flex flex-wrap items-center justify-between gap-3 pt-3 px-1 text-sm text-text-muted",l),...m,children:[e.jsxs("div",{className:"flex items-center gap-2 text-text-muted text-sm",children:[i&&e.jsxs("span",{children:["Display ",b," to ",y," of ",r]}),a&&a.length>0&&o&&e.jsxs("div",{ref:f,className:"relative inline-block text-left",children:[e.jsxs("button",{type:"button",onClick:()=>x(k=>!k),"aria-haspopup":"listbox","aria-expanded":p,"aria-label":`Rows per page: ${s}`,className:c("inline-flex h-7 items-center justify-between gap-2 rounded-md border border-border bg-white px-2.5 text-sm text-text cursor-pointer transition-colors outline-none","hover:border-border-strong hover:bg-surface/50","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary",p&&"border-primary bg-primary-soft/30 text-primary"),children:[e.jsx("span",{children:s}),e.jsx("span",{className:c("text-text-subtle transition-transform duration-150 flex items-center",p&&"rotate-180 text-primary"),"aria-hidden":"true",children:e.jsx(Ta,{})})]}),p&&e.jsx("div",{role:"listbox","aria-label":"Rows per page",className:"absolute left-0 bottom-full z-50 mb-1 min-w-[75px] rounded-lg border border-border bg-white p-1 shadow-none focus:outline-none",children:a.map(k=>{const v=k===s;return e.jsxs("button",{type:"button",role:"option","aria-selected":v,onClick:()=>{o(k),x(!1)},className:c("flex w-full items-center justify-between rounded px-2 py-1 text-sm text-left cursor-pointer transition-colors outline-none","hover:bg-surface hover:text-text",v?"bg-primary-soft/40 text-primary font-medium":"text-text font-normal"),children:[e.jsx("span",{children:k}),v&&e.jsx("span",{className:"text-primary","aria-hidden":"true",children:e.jsx(La,{})})]},k)})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 ms-auto",children:[e.jsx("button",{type:"button",disabled:d<=1,onClick:()=>n(d-1),"aria-label":"Previous page",className:"flex size-7 items-center justify-center rounded-full text-text-muted hover:text-text hover:bg-surface disabled:pointer-events-none disabled:opacity-30 cursor-pointer transition-colors",children:e.jsx(Ma,{})}),j.map((k,v)=>{if(k==="ellipsis")return e.jsx("span",{className:"flex size-7 items-center justify-center text-text-subtle select-none",children:"…"},`ellipsis-${v}`);const N=k===d;return e.jsx("button",{type:"button",onClick:()=>n(k),"aria-current":N?"page":void 0,className:c("flex size-7 items-center justify-center rounded-full text-sm font-medium cursor-pointer transition-colors",N?"bg-primary text-white":"text-text hover:bg-surface"),children:k},k)}),e.jsx("button",{type:"button",disabled:d>=u,onClick:()=>n(d+1),"aria-label":"Next page",className:"flex size-7 items-center justify-center rounded-full text-text-muted hover:text-text hover:bg-surface disabled:pointer-events-none disabled:opacity-30 cursor-pointer transition-colors",children:e.jsx(Ia,{})})]})]})}vt.displayName="GymatraPagination";const Ra=te.Progress.Root,Ba=te.Progress.Track,Aa=te.Progress.Indicator,Da=te.Progress.Label,Fa=te.Progress.Value,Ea={primary:"bg-primary",success:"bg-success",warning:"bg-warning",danger:"bg-danger",info:"bg-info"},Wa={xs:"h-1",sm:"h-1.5",md:"h-2",lg:"h-3"},$a={pill:"rounded-full",rounded:"rounded-md",square:"rounded-none"};function Oa({value:t,min:r=0,max:s=100,label:n,description:a,showValue:o=!0,formatValue:i,variant:l="primary",size:m="md",shape:u="pill",className:d,trackClassName:b,indicatorClassName:y}){const p=t===null,x=$a[u],f=t!==null?Math.round((t-r)/(s-r)*100):0;return e.jsxs(te.Progress.Root,{value:t,min:r,max:s,className:c("w-full space-y-1.5",d),children:[(n||o)&&e.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs font-medium",children:[e.jsxs("div",{className:"space-y-0.5 min-w-0",children:[n&&e.jsx(te.Progress.Label,{className:"text-text font-medium truncate",children:n}),a&&e.jsx("p",{className:"text-xs text-text-muted",children:a})]}),o&&!p&&e.jsx("span",{className:"text-text-muted font-mono font-medium shrink-0 ml-auto",children:i?i(t):`${f}%`})]}),e.jsx(te.Progress.Track,{className:c("relative w-full overflow-hidden bg-surface-muted",Wa[m],x,b),children:e.jsx(te.Progress.Indicator,{className:c("h-full transition-all duration-300 ease-out",Ea[l],x,p&&"w-1/3 animate-[indeterminate_1.5s_infinite_ease-in-out]",y)})})]})}const Ha={primary:"text-primary",success:"text-success",warning:"text-warning",danger:"text-danger",info:"text-info"};function qa({value:t,size:r=80,strokeWidth:s=8,variant:n="primary",children:a,className:o,showValue:i=!0}){const l=Math.min(100,Math.max(0,t)),m=(r-s)/2,u=2*Math.PI*m,d=u-l/100*u;return e.jsxs("div",{className:c("relative inline-flex items-center justify-center shrink-0",o),style:{width:r,height:r},role:"progressbar","aria-valuenow":l,"aria-valuemin":0,"aria-valuemax":100,children:[e.jsxs("svg",{className:"-rotate-90 origin-center",width:r,height:r,viewBox:`0 0 ${r} ${r}`,children:[e.jsx("circle",{className:"text-surface-muted",strokeWidth:s,stroke:"currentColor",fill:"transparent",r:m,cx:r/2,cy:r/2}),e.jsx("circle",{className:c(Ha[n],"transition-all duration-500 ease-out"),strokeWidth:s,strokeDasharray:u,strokeDashoffset:d,strokeLinecap:"round",stroke:"currentColor",fill:"transparent",r:m,cx:r/2,cy:r/2})]}),e.jsx("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-center p-1",children:a??(i&&e.jsxs("span",{className:"text-xs font-medium font-mono tabular-nums text-text",children:[Math.round(l),"%"]}))})]})}const Ua=Ht.Separator,qr=h.forwardRef(({orientation:t="horizontal",variant:r="default",decorative:s=!0,label:n,children:a,labelPosition:o="center",className:i,...l},m)=>{const u=t==="horizontal",d=n??a,b=()=>{switch(r){case"subtle":return u?"h-px w-full bg-border/50":"w-px h-full min-h-[1rem] bg-border/50 self-stretch";case"primary":return u?"h-px w-full bg-primary/40":"w-px h-full min-h-[1rem] bg-primary/40 self-stretch";case"dashed":return u?"h-0 w-full border-t border-dashed border-border":"w-0 h-full min-h-[1rem] border-s border-dashed border-border self-stretch";case"dotted":return u?"h-0 w-full border-t border-dotted border-border":"w-0 h-full min-h-[1rem] border-s border-dotted border-border self-stretch";case"default":default:return u?"h-px w-full bg-border":"w-px h-full min-h-[1rem] bg-border self-stretch"}};if(u&&d){const y=b();return e.jsxs("div",{ref:m,role:s?"none":"separator","aria-orientation":"horizontal",className:c("flex w-full items-center select-none text-xs font-medium text-text-muted",i),...l,children:[e.jsx("div",{className:c(o==="start"?"w-6 shrink-0":"flex-1",y)}),e.jsx("span",{className:"px-3 shrink-0 flex items-center gap-1.5",children:d}),e.jsx("div",{className:c(o==="end"?"w-6 shrink-0":"flex-1",y)})]})}return e.jsx(Ht.Separator,{ref:m,orientation:t,role:s?"none":"separator",className:c("shrink-0",b(),i),...l})});qr.displayName="GymatraSeparator";const Va={primary:"bg-primary-soft text-primary",success:"bg-success-soft text-success",warning:"bg-warning-soft text-warning",danger:"bg-danger-soft text-danger",info:"bg-info-soft text-info",neutral:"bg-surface-muted text-text-muted"},_a={primary:"text-primary",success:"text-success",warning:"text-warning",danger:"text-danger",info:"text-info",neutral:"text-text-muted"},Ka={outline:"border border-border bg-white",soft:"bg-surface-muted"},Xe={good:"text-success",bad:"text-danger",flat:"text-text-muted"},Et={up:"En hausse",down:"En baisse",flat:"Stable"};function Ur({direction:t,className:r}){return e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",className:r,"aria-hidden":"true",children:[t==="up"&&e.jsx("path",{d:"M7 17 17 7M9 7h8v8"}),t==="down"&&e.jsx("path",{d:"M7 7l10 10M17 9v8H9"}),t==="flat"&&e.jsx("path",{d:"M6 12h12"})]})}function Za({direction:t}){return t==="flat"?e.jsx(Ur,{direction:"flat",className:"size-3"}):e.jsx("svg",{viewBox:"0 0 10 10",className:"size-2",fill:"currentColor","aria-hidden":"true",children:t==="up"?e.jsx("path",{d:"M5 1 9.5 9h-9z"}):e.jsx("path",{d:"M5 9 .5 1h9z"})})}function Qa({progress:t}){const s=2*Math.PI*6.5,n=Math.max(0,Math.min(100,t));return e.jsxs("svg",{viewBox:"0 0 16 16",className:"size-4 -rotate-90","aria-hidden":"true",children:[e.jsx("circle",{cx:"8",cy:"8",r:6.5,fill:"none",strokeWidth:"2",className:"stroke-border"}),e.jsx("circle",{cx:"8",cy:"8",r:6.5,fill:"none",strokeWidth:"2",strokeLinecap:"round",className:"stroke-primary",strokeDasharray:`${n/100*s} ${s}`})]})}const Vr=fe.forwardRef(({label:t,unit:r,description:s,icon:n,tone:a="primary",value:o,caption:i,trend:l,trendPlacement:m="below",chart:u,secondary:d,action:b,variant:y="outline",loading:p=!1,className:x,...f},g)=>{const j=l?l.direction==="flat"?"flat":l.direction===(l.positive??"up")?"good":"bad":"flat",k=l&&m==="inline"&&e.jsxs("span",{className:c("inline-flex items-center gap-1 text-xs font-medium tabular-nums",Xe[j]),children:[e.jsx(Za,{direction:l.direction}),e.jsxs("span",{className:"sr-only",children:[Et[l.direction]," :"]}),l.value]}),v=l&&m==="below"&&e.jsxs("p",{className:"mt-2 flex items-center gap-1.5 text-xs text-text-muted",children:[e.jsx("span",{className:c("flex size-4 shrink-0 items-center justify-center rounded-sm border border-current",Xe[j]),children:e.jsx(Ur,{direction:l.direction,className:"size-2.5"})}),e.jsxs("span",{className:"sr-only",children:[Et[l.direction]," :"]}),e.jsx("span",{className:c("font-medium tabular-nums",Xe[j]),children:l.value}),l.label&&e.jsx("span",{className:"truncate",children:l.label})]});return e.jsxs("div",{ref:g,"aria-busy":p||void 0,className:c("flex min-w-0 flex-col gap-3 rounded-lg px-4 py-3.5",Ka[y],x),...f,children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[n&&e.jsx("span",{"aria-hidden":"true",className:c("flex size-10 shrink-0 items-center justify-center rounded-lg [&>img]:size-6 [&>svg]:size-5",Va[a]),children:n}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("p",{className:"truncate text-sm font-medium text-text",children:[t,r&&e.jsxs("span",{className:"font-normal text-text-muted",children:[" ",r]})]}),s&&e.jsx("p",{className:"truncate text-xs text-text-muted",children:s})]})]}),b&&e.jsx("div",{className:"shrink-0 text-xs",children:b})]}),e.jsxs("div",{className:"flex items-end justify-between gap-4",children:[e.jsxs("div",{className:"min-w-0",children:[p?e.jsx("span",{className:"block h-8 w-24 animate-pulse rounded-md bg-border/60 motion-reduce:animate-none"}):e.jsxs("div",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-1",children:[e.jsx("p",{className:"text-2xl font-semibold tabular-nums text-text",children:o}),k]}),i&&e.jsx("p",{className:"mt-1 truncate text-xs text-text-muted",children:i}),!p&&v]}),u&&!p&&e.jsx("div",{className:c("h-12 w-28 shrink-0",_a[a]),children:u}),d&&!p&&e.jsxs("div",{className:"shrink-0 text-end",children:[e.jsxs("p",{className:"flex items-center justify-end gap-1.5 text-sm font-medium tabular-nums text-text",children:[typeof d.progress=="number"&&e.jsx(Qa,{progress:d.progress}),d.value]}),e.jsx("p",{className:"mt-1 text-xs text-text-muted",children:d.label})]})]})]})});Vr.displayName="GymatraStatCard";function Ya({data:t,highlightIndex:r,highlightLabel:s,label:n,className:a,...o}){const m=s?18:4,u=45,d=t.length>=2?t:[t[0]??0,t[0]??0],b=Math.min(...d),p=Math.max(...d)-b||1,x=d.map((v,N)=>({x:N/(d.length-1)*108+2,y:u-(v-b)/p*(u-m)}));let f=`M ${x[0].x} ${x[0].y}`;for(let v=1;v<x.length;v++){const N=x[v-1],S=x[v],T=(N.x+S.x)/2;f+=` Q ${N.x} ${N.y} ${T} ${(N.y+S.y)/2} T ${S.x} ${S.y}`}const g=`${f} L ${x[x.length-1].x} 48 L ${x[0].x} 48 Z`,j=r===void 0?x.length-1:r,k=j!==null&&x[j]?x[j]:null;return e.jsxs("svg",{viewBox:"0 0 112 48",className:c("size-full overflow-visible",a),role:n?"img":void 0,"aria-label":n,"aria-hidden":n?void 0:!0,...o,children:[e.jsx("path",{d:g,fill:"currentColor",fillOpacity:"0.08",stroke:"none"}),e.jsx("path",{d:f,fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"}),k&&e.jsxs(e.Fragment,{children:[e.jsx("line",{x1:k.x,x2:k.x,y1:k.y,y2:48,stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"1",vectorEffect:"non-scaling-stroke"}),e.jsx("circle",{cx:k.x,cy:k.y,r:"3.5",fill:"currentColor",stroke:"white",strokeWidth:"2"}),s&&e.jsx("text",{x:k.x,y:k.y-7,textAnchor:"middle",className:"fill-text text-xs font-medium",children:s})]})]})}const me=h.createContext(null);function _r(){const t=h.useContext(me);if(!t)throw new Error("useGymatraStepper must be used within a GymatraStepper");return t}function Kr({className:t}){return e.jsx("svg",{className:c("size-3.5",t),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}function Ja({className:t}){return e.jsxs("svg",{className:c("size-3.5",t),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]})}function Xa({steps:t,currentStep:r,activeStep:s,orientation:n="horizontal",variant:a="numbered",layout:o="inline",size:i="md",clickable:l=!1,allowStepAdvance:m=!1,onStepClick:u,className:d,children:b,...y}){const p=r??s??0,x=t?t.length:h.Children.count(b),f={currentStep:p,orientation:n,variant:a,size:i,layout:o,clickable:l,allowStepAdvance:m,onStepClick:u,totalSteps:x};return n==="vertical"?e.jsx(me.Provider,{value:f,children:e.jsx("div",{role:"navigation","aria-label":"Progress Stepper",className:c("w-full flex flex-col",d),...y,children:t?t.map((g,j)=>{const k=j===t.length-1,v=g.status??(j<p?"complete":j===p?"current":"upcoming");return e.jsx(Zr,{stepIndex:j,status:v,title:g.title,description:g.description,icon:g.icon,completedIcon:g.completedIcon,errorIcon:g.errorIcon,optional:g.optional,disabled:g.disabled,badge:g.badge,isLast:k},g.id??j)}):b})}):t&&a==="pills"&&n==="horizontal"?e.jsx(me.Provider,{value:f,children:e.jsx("nav",{role:"navigation","aria-label":"Progress Stepper",className:c("w-full text-text",d),...y,children:e.jsx("ol",{className:"flex flex-wrap items-center gap-2 sm:gap-2.5 w-full",children:t.map((g,j)=>{const k=j===t.length-1,v=g.status??(j<p?"complete":j===p?"current":"upcoming"),N=v==="complete",S=v==="current",T=v==="error",G=l&&!g.disabled&&(m||N||S),z=()=>{G&&u&&u(j,g)};return e.jsxs("li",{className:"inline-flex items-center gap-2",children:[e.jsxs("button",{type:"button",disabled:!G||g.disabled,onClick:z,"aria-current":S?"step":void 0,className:c("inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-xs transition-all outline-none",S?"bg-primary text-white font-medium ring-2 ring-primary/25":N?"bg-primary-soft text-primary font-medium hover:bg-primary-soft/80":T?"bg-danger-soft text-danger border border-danger/30 font-medium":"bg-surface-muted text-text-muted font-normal hover:text-text",G&&"cursor-pointer focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",!G&&"cursor-default",g.disabled&&"opacity-50 pointer-events-none"),children:[e.jsx("span",{className:c("flex size-4 items-center justify-center rounded-full text-xs font-medium shrink-0",S?"bg-white/20 text-white":N?"bg-primary text-white":T?"bg-danger text-white":"bg-border text-text-muted"),children:N?e.jsx(Kr,{className:"size-2.5"}):j+1}),e.jsx("span",{className:"truncate",children:g.title})]}),!k&&e.jsx("span",{className:"text-text-subtle text-xs select-none","aria-hidden":"true",children:"/"})]},g.id??j)})})})}):t&&n==="horizontal"&&o==="centered"?e.jsx(me.Provider,{value:f,children:e.jsx("nav",{role:"navigation","aria-label":"Progress Stepper",className:c("w-full text-text",d),...y,children:e.jsx("ol",{className:"flex items-start justify-between w-full",children:t.map((g,j)=>{const k=j===0,v=j===t.length-1,N=g.status??(j<p?"complete":j===p?"current":"upcoming"),S=N==="complete",T=N==="current",G=l&&!g.disabled&&(m||S||T),z=()=>{G&&u&&u(j,g)},w=P=>{G&&(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),z())};return e.jsxs("li",{className:"relative flex-1 flex flex-col items-center text-center group",children:[!k&&e.jsx("div",{"aria-hidden":"true",className:"absolute top-4 -translate-y-1/2 left-0 right-1/2 h-0.5 bg-border -z-0",children:e.jsx("div",{className:c("h-full transition-all duration-300",j<=p?"bg-primary":"bg-transparent")})}),!v&&e.jsx("div",{"aria-hidden":"true",className:"absolute top-4 -translate-y-1/2 left-1/2 right-0 h-0.5 bg-border -z-0",children:e.jsx("div",{className:c("h-full transition-all duration-300",j<p?"bg-primary":"bg-transparent")})}),e.jsxs("div",{role:G?"button":void 0,tabIndex:G?0:void 0,onClick:G?z:void 0,onKeyDown:G?w:void 0,"aria-current":T?"step":void 0,className:c("relative z-10 flex flex-col items-center outline-none group rounded-lg p-1 transition-colors",G&&"cursor-pointer hover:bg-surface-muted/40 focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",g.disabled&&"opacity-50 pointer-events-none"),children:[e.jsx("div",{className:"bg-white rounded-full p-0.5 ring-4 ring-white",children:e.jsx(Se,{stepIndex:j,status:N,icon:g.icon,completedIcon:g.completedIcon,errorIcon:g.errorIcon,variant:a,size:i})}),e.jsxs("div",{className:"mt-2 flex flex-col items-center max-w-[140px]",children:[e.jsx("span",{className:c("text-xs leading-tight transition-colors",T?"text-primary font-medium":S?"text-text font-medium":N==="error"?"text-danger font-medium":"text-text-muted"),children:g.title}),g.description&&e.jsx("span",{className:"text-xs text-text-muted mt-0.5 hidden sm:block truncate w-full",children:g.description}),g.badge&&e.jsx("span",{className:"mt-1",children:g.badge})]})]})]},g.id??j)})})})}):t&&n==="horizontal"?e.jsx(me.Provider,{value:f,children:e.jsx("nav",{role:"navigation","aria-label":"Progress Stepper",className:c("w-full text-text",d),...y,children:e.jsx("ol",{className:"flex items-center w-full",children:t.map((g,j)=>{const k=j===t.length-1,v=g.status??(j<p?"complete":j===p?"current":"upcoming"),N=v==="complete",S=v==="current",T=v==="error",G=l&&!g.disabled&&(m||N||S),z=()=>{G&&u&&u(j,g)},w=P=>{G&&(P.key==="Enter"||P.key===" ")&&(P.preventDefault(),z())};return e.jsxs("li",{className:c("flex items-center min-w-0",k?"flex-none":"flex-1"),children:[e.jsxs("div",{role:G?"button":void 0,tabIndex:G?0:void 0,onClick:G?z:void 0,onKeyDown:G?w:void 0,"aria-current":S?"step":void 0,className:c("flex items-center gap-2.5 sm:gap-3 shrink-0 rounded-lg outline-none transition-colors p-1 -m-1",G&&"cursor-pointer hover:bg-surface-muted/50 focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2",g.disabled&&"opacity-50 pointer-events-none"),children:[e.jsx(Se,{stepIndex:j,status:v,icon:g.icon,completedIcon:g.completedIcon,errorIcon:g.errorIcon,variant:a,size:i}),e.jsxs("div",{className:"flex flex-col text-start min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[e.jsx("span",{className:c("leading-tight truncate transition-colors",i==="sm"?"text-xs":i==="lg"?"text-base":"text-sm",S?"text-primary font-medium":N?"text-text font-medium":T?"text-danger font-medium":"text-text-muted font-normal"),children:g.title}),g.optional&&e.jsx("span",{className:"text-xs text-text-muted font-normal",children:"(Facultatif)"}),g.badge&&e.jsx("span",{children:g.badge})]}),g.description&&e.jsx("span",{className:"text-text-muted leading-tight mt-0.5 truncate hidden md:inline-block text-xs",children:g.description})]})]}),!k&&e.jsx("div",{"aria-hidden":"true",className:"flex-1 mx-2 sm:mx-4 h-0.5 min-w-3 sm:min-w-6 bg-border relative overflow-hidden rounded-full shrink",children:e.jsx("div",{className:c("h-full w-full transition-all duration-300",j<p?"bg-primary":"bg-transparent")})})]},g.id??j)})})})}):e.jsx(me.Provider,{value:f,children:e.jsx("div",{role:"navigation","aria-label":"Progress Stepper",className:c("w-full text-text",n==="horizontal"?"flex flex-row items-start justify-between":"flex flex-col space-y-0",d),...y,children:b})})}function Zr({stepIndex:t=0,status:r,title:s,description:n,icon:a,completedIcon:o,errorIcon:i,optional:l,disabled:m,badge:u,isLast:d=!1,className:b,children:y,...p}){const{currentStep:x,orientation:f,variant:g,size:j,clickable:k,allowStepAdvance:v,onStepClick:N}=_r(),S=r??(t<x?"complete":t===x?"current":"upcoming"),T=S==="complete",G=S==="current",z=S==="error",w=k&&!m&&(v||T||G),P=()=>{w&&N&&N(t)},F=M=>{w&&(M.key==="Enter"||M.key===" ")&&(M.preventDefault(),P())};return f==="vertical"?e.jsxs("div",{className:c("relative flex items-stretch gap-3.5 group",m&&"opacity-50 pointer-events-none",b),...p,children:[e.jsxs("div",{className:"flex flex-col items-center shrink-0",children:[e.jsx("div",{role:w?"button":void 0,tabIndex:w?0:void 0,onClick:w?P:void 0,onKeyDown:w?F:void 0,"aria-current":G?"step":void 0,className:c("rounded-full outline-none transition-transform",w&&"cursor-pointer hover:scale-105 focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2"),children:e.jsx(Se,{stepIndex:t,status:S,icon:a,completedIcon:o,errorIcon:i,variant:g,size:j})}),!d&&e.jsx("div",{className:c("w-0.5 flex-1 my-1.5 transition-colors duration-200 min-h-7",T?"bg-primary":"bg-border"),"aria-hidden":"true"})]}),e.jsxs("div",{className:c("flex-1 min-w-0 pb-6",d&&"pb-1"),children:[e.jsxs("div",{role:w?"button":void 0,tabIndex:w?0:void 0,onClick:w?P:void 0,onKeyDown:w?F:void 0,className:c("flex flex-col outline-none rounded-md",w&&"cursor-pointer"),children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:c("leading-tight transition-colors",j==="sm"?"text-xs":j==="lg"?"text-base":"text-sm",G?"text-primary font-medium":T?"text-text font-medium":z?"text-danger font-medium":"text-text-muted font-normal"),children:s}),l&&e.jsx("span",{className:"text-xs text-text-muted font-normal",children:"(Facultatif)"}),u&&e.jsx("span",{children:u})]}),n&&e.jsx("p",{className:"text-xs text-text-muted mt-0.5 leading-relaxed",children:n})]}),y&&e.jsx("div",{className:"mt-2.5",children:y})]})]}):e.jsx("div",{className:c("group relative flex flex-col items-center flex-1 text-center sm:flex-row sm:items-start sm:text-start",m&&"opacity-50 pointer-events-none",b),...p,children:e.jsxs("div",{role:w?"button":void 0,tabIndex:w?0:void 0,onClick:w?P:void 0,onKeyDown:w?F:void 0,"aria-current":G?"step":void 0,className:c("flex items-start gap-3 rounded-lg transition-colors outline-none flex-col sm:flex-row items-center sm:items-start",w&&"cursor-pointer p-1.5 -m-1.5 rounded-md hover:bg-surface-muted/70 focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2"),children:[e.jsx(Se,{stepIndex:t,status:S,icon:a,completedIcon:o,errorIcon:i,variant:g,size:j}),(s||n||y)&&e.jsxs("div",{className:"min-w-0 flex flex-col items-center sm:items-start",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s&&e.jsx("span",{className:c("leading-tight truncate transition-colors",j==="sm"?"text-xs":j==="lg"?"text-base":"text-sm",G?"text-primary font-medium":T?"text-text font-medium":z?"text-danger font-medium":"text-text-muted font-normal"),children:s}),l&&e.jsx("span",{className:"text-xs text-text-muted font-normal",children:"(Facultatif)"}),u&&e.jsx("span",{children:u})]}),n&&e.jsx("p",{className:"text-text-muted leading-relaxed mt-0.5 text-xs",children:n}),y]})]})})}function Se({stepIndex:t,status:r,icon:s,completedIcon:n,errorIcon:a,variant:o="numbered",size:i="md"}){const l=r==="complete",m=r==="current",u=r==="error";if(o==="dots"){const b=i==="sm"?"size-2.5":i==="lg"?"size-4":"size-3";return e.jsx("span",{"aria-hidden":"true",className:c("rounded-full shrink-0 transition-all duration-200 mt-1.5",b,l?"bg-primary":m?"bg-primary ring-4 ring-primary/25 scale-125":u?"bg-danger ring-2 ring-danger/20":"bg-border")})}const d=i==="sm"?"size-6 text-xs":i==="lg"?"size-10 text-sm":"size-8 text-xs font-medium";return e.jsx("span",{className:c("relative flex shrink-0 items-center justify-center rounded-full transition-all duration-200 select-none",d,l?"bg-primary text-white border border-primary shadow-none":m?"bg-primary text-white border border-primary ring-4 ring-primary/20 font-medium":u?"bg-danger-soft text-danger border-2 border-danger font-medium":"bg-surface-muted text-text-muted border border-border"),"aria-hidden":"true",children:l?n??e.jsx(Kr,{}):u?a??e.jsx(Ja,{}):o==="icons"&&s?s:e.jsx("span",{children:t+1})})}function eo({status:t="upcoming",className:r}){const s=t==="complete";return e.jsx("div",{"aria-hidden":"true",className:c("flex-1 hidden sm:flex items-center self-start mt-4 px-2",r),children:e.jsx("div",{className:c("h-0.5 w-full transition-colors duration-200",s?"bg-primary":"bg-border")})})}function to({active:t=!0,className:r,children:s,...n}){return t?e.jsx("div",{className:c("text-xs text-text",r),...n,children:s}):null}function ro({direction:t}){return e.jsxs("svg",{"aria-hidden":"true",className:"size-3.5 shrink-0",viewBox:"0 0 16 16",fill:"currentColor",children:[e.jsx("path",{d:"M5 12V4M5 4L2.5 6.5M5 4L7.5 6.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",className:t==="asc"?"text-primary opacity-100":"opacity-35"}),e.jsx("path",{d:"M11 4V12M11 12L8.5 9.5M11 12L13.5 9.5",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",fill:"none",className:t==="desc"?"text-primary opacity-100":"opacity-35"})]})}function so({className:t="size-3.5"}){return e.jsx("svg",{"aria-hidden":"true",className:t,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"m6 9 6 6 6-6"})})}function Qr({variant:t="cards",className:r,...s}){return e.jsx("div",{className:"w-full overflow-x-auto",children:e.jsx("table",{className:c("w-full text-left text-sm",t==="cards"?"border-separate border-spacing-y-2":"border-collapse border border-border rounded-lg bg-white overflow-hidden",r),...s})})}Qr.displayName="GymatraTable";function wt({className:t,...r}){return e.jsx("thead",{className:c("text-xs font-semibold uppercase tracking-wider text-text-muted",t),...r})}wt.displayName="GymatraTableHeader";function Nt({className:t,...r}){return e.jsx("tbody",{className:c("space-y-2",t),...r})}Nt.displayName="GymatraTableBody";function kt({className:t,selected:r,variant:s="cards",...n}){return e.jsx("tr",{"data-selected":r,className:c("group transition-all bg-white hover:bg-surface/60","data-[selected=true]:bg-primary-soft/30",s==="cards"?"[&>td:first-child]:rounded-s-lg [&>td:last-child]:rounded-e-lg [&>td]:border-y [&>td]:border-border [&>td:first-child]:border-s [&>td:last-child]:border-e [&>td]:shadow-none":"border-b border-border last:border-b-0",t),...n})}kt.displayName="GymatraTableRow";function Ne({className:t,align:r="left",density:s="normal",...n}){const a=s==="compact"?"py-1.5 px-3 text-xs":s==="relaxed"?"py-3.5 px-4 text-xs":"py-2.5 px-3.5 text-xs";return e.jsx("th",{className:c("font-semibold uppercase tracking-wider text-text-muted align-middle whitespace-nowrap",a,r==="center"&&"text-center",r==="right"&&"text-right",t),...n})}Ne.displayName="GymatraTableHead";function ke({className:t,align:r="left",density:s="normal",...n}){const a=s==="compact"?"py-2 px-3 text-sm":s==="relaxed"?"py-4 px-4 text-sm":"py-3 px-3.5 text-sm";return e.jsx("td",{className:c("align-middle text-text bg-inherit",a,r==="center"&&"text-center",r==="right"&&"text-right",t),...n})}ke.displayName="GymatraTableCell";function Gt({children:t,direction:r,onSort:s,align:n="left",density:a="normal",className:o,...i}){const l=!!r,m=a==="compact"?"py-1.5 px-3 text-xs":a==="relaxed"?"py-3.5 px-4 text-xs":"py-2.5 px-3.5 text-xs";return e.jsx("th",{className:c("font-semibold uppercase tracking-wider align-middle whitespace-nowrap",m,n==="center"&&"text-center",n==="right"&&"text-right",o),...i,children:e.jsxs("button",{type:"button",onClick:s,className:c("inline-flex items-center gap-1.5 cursor-pointer transition-colors outline-none","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary",l?"text-primary font-semibold":"text-text-muted hover:text-text"),children:[e.jsx("span",{children:t}),e.jsx(ro,{direction:r})]})})}Gt.displayName="GymatraTableSortHead";function We({checked:t=!1,onChange:r,indeterminate:s=!1,"aria-label":n}){return e.jsxs("button",{type:"button",role:"checkbox","aria-checked":s?"mixed":t,"aria-label":n,onClick:()=>r==null?void 0:r(!t),className:c("size-5 shrink-0 rounded-md flex items-center justify-center border cursor-pointer transition-colors outline-none","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary",t||s?"border-primary bg-primary text-white":"border-border-strong bg-white hover:border-text-subtle"),children:[t&&!s&&e.jsx("svg",{"aria-hidden":"true",className:"size-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),s&&e.jsx("span",{className:"h-0.5 w-3 bg-white rounded-full"})]})}We.displayName="GymatraTableCheckbox";function Ct({columnsCount:t,hasCheckbox:r=!1,hasExpand:s=!1,density:n="normal",variant:a="cards"}){const o=n==="compact"?"py-2 px-3":n==="relaxed"?"py-4 px-4":"py-3 px-3.5";return e.jsxs("tr",{className:c("bg-white transition-opacity",a==="cards"?"[&>td:first-child]:rounded-s-lg [&>td:last-child]:rounded-e-lg [&>td]:border-y [&>td]:border-border [&>td:first-child]:border-s [&>td:last-child]:border-e":"border-b border-border last:border-b-0"),children:[s&&e.jsx("td",{className:c("w-8 text-center align-middle",o),children:e.jsx("div",{className:"size-4 mx-auto rounded bg-surface-muted animate-pulse"})}),r&&e.jsx("td",{className:c("w-8 align-middle",o),children:e.jsx("div",{className:"size-5 rounded-md bg-surface-muted animate-pulse"})}),Array.from({length:t}).map((i,l)=>e.jsx("td",{className:c("align-middle",o),children:l===0?e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx("div",{className:"size-8 shrink-0 rounded-full bg-surface-muted animate-pulse"}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"h-3.5 w-28 rounded bg-surface-muted animate-pulse"}),e.jsx("div",{className:"h-2.5 w-20 rounded bg-surface-muted/70 animate-pulse"})]})]}):e.jsx("div",{className:c("h-3.5 rounded bg-surface-muted animate-pulse",l===1?"w-24":l===t-1?"w-16":"w-20")})},l))]})}Ct.displayName="GymatraTableSkeletonRow";function St({rowCount:t=5,columnsCount:r,hasCheckbox:s=!1,hasExpand:n=!1,density:a="normal",variant:o="cards"}){return e.jsx(e.Fragment,{children:Array.from({length:t}).map((i,l)=>e.jsx(Ct,{columnsCount:r,hasCheckbox:s,hasExpand:n,density:a,variant:o},l))})}St.displayName="GymatraTableSkeleton";function Yr({columns:t,data:r,rowKey:s=(G,z)=>G.id??z,sort:n,defaultSort:a,onSortChange:o,selectable:i=!1,selectedIds:l,onSelectionChange:m,selectionActions:u,pagination:d,emptyTitle:b="No data found",emptyDescription:y="There are no records matching your criteria.",loading:p=!1,skeletonRowCount:x=5,density:f="normal",variant:g="cards",onRowClick:j,expandedRowRender:k,expandedRowKeys:v,onExpandedRowsChange:N,className:S,...T}){const[G,z]=h.useState(a),w=n??G,[P,F]=h.useState([]),M=l??P,[W,q]=h.useState([]),I=v??W,[U,oe]=h.useState((d==null?void 0:d.page)??1),[B,O]=h.useState((d==null?void 0:d.pageSize)??10),Z=(d==null?void 0:d.page)??U,V=(d==null?void 0:d.pageSize)??B,Q=!!k;function Ie(C){let L;(w==null?void 0:w.key)!==C?L={key:C,direction:"asc"}:w.direction==="asc"?L={key:C,direction:"desc"}:L=void 0,typeof n>"u"&&z(L),o==null||o(L)}const ie=h.useMemo(()=>w?[...r].sort((C,L)=>{const A=C[w.key],se=L[w.key];if(A===se)return 0;if(A==null)return 1;if(se==null)return-1;const ce=String(A).localeCompare(String(se),void 0,{numeric:!0});return w.direction==="asc"?ce:-ce}):r,[r,w]),ge=typeof(d==null?void 0:d.total)<"u",le=ge?d.total:ie.length,je=h.useMemo(()=>{if(!d||ge)return ie;const C=(Z-1)*V;return ie.slice(C,C+V)},[ie,d,ge,Z,V]),Y=je.map((C,L)=>s(C,L)),Te=Y.length>0&&Y.every(C=>M.includes(C)),ue=Y.some(C=>M.includes(C))&&!Te;function Qe(C){let L;if(C){const A=new Set([...M,...Y]);L=Array.from(A)}else L=M.filter(A=>!Y.includes(A));typeof l>"u"&&F(L),m==null||m(L)}function xe(C,L){let A;L?A=[...M,C]:A=M.filter(se=>se!==C),typeof l>"u"&&F(A),m==null||m(A)}function ve(){typeof l>"u"&&F([]),m==null||m([])}function Le(C){let L;I.includes(C)?L=I.filter(A=>A!==C):L=[...I,C],typeof v>"u"&&q(L),N==null||N(L)}const Ye=M.length>0,Re=t.length+(i?1:0)+(Q?1:0);return e.jsxs("div",{className:c("flex flex-col w-full relative",S),...T,children:[e.jsx("div",{className:c("fixed bottom-6 left-1/2 -translate-x-1/2 z-50 transition-all duration-200 ease-out","w-[calc(100%-2rem)] max-w-lg sm:w-auto",Ye&&u?"translate-y-0 opacity-100 pointer-events-auto":"translate-y-4 opacity-0 pointer-events-none"),children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between sm:justify-start gap-3 rounded-lg border border-border bg-white px-4 py-2 text-sm shadow-none",children:[e.jsx("span",{className:"font-medium text-text",children:M.length===1?"1 item selected":`${M.length} items selected`}),e.jsx("span",{className:"hidden sm:inline-block h-4 w-px bg-border","aria-hidden":"true"}),e.jsx("div",{className:"flex items-center gap-1.5 ms-auto sm:ms-0",children:typeof u=="function"?u(M,ve):u}),e.jsx("span",{className:"hidden sm:inline-block h-4 w-px bg-border","aria-hidden":"true"}),e.jsx("button",{type:"button",onClick:ve,"aria-label":"Cancel selection",title:"Cancel selection",className:"flex size-6 items-center justify-center rounded-full text-text-muted hover:bg-surface hover:text-text cursor-pointer transition-colors outline-none focus-visible:outline-2 focus-visible:outline-primary",children:e.jsx("svg",{"aria-hidden":"true",className:"size-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M18 6 6 18M6 6l12 12"})})})]})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:c("w-full text-left text-sm",g==="cards"?"border-separate border-spacing-y-2":"border-collapse border border-border rounded-lg bg-white overflow-hidden"),children:[e.jsx(wt,{children:e.jsxs("tr",{children:[Q&&e.jsx(Ne,{density:f,className:"w-8 px-2"}),i&&e.jsx(Ne,{density:f,className:"w-8 px-3",children:e.jsx(We,{checked:Te,indeterminate:ue,onChange:Qe,"aria-label":"Select all rows on current page"})}),t.map(C=>C.sortable?e.jsx(Gt,{direction:(w==null?void 0:w.key)===C.key?w.direction:void 0,onSort:()=>Ie(C.key),align:C.align,density:f,className:C.width,children:C.header},C.key):e.jsx(Ne,{align:C.align,density:f,className:C.width,children:C.header},C.key))]})}),e.jsx(Nt,{children:p?e.jsx(St,{rowCount:x,columnsCount:t.length,hasCheckbox:i,hasExpand:Q,density:f,variant:g}):je.length>0?je.map((C,L)=>{const A=s(C,L),se=M.includes(A),ce=I.includes(A);return e.jsxs(h.Fragment,{children:[e.jsxs(kt,{selected:se,variant:g,onClick:J=>{const Je=J.target;Je.closest("button")||Je.closest("input")||Je.closest("a")||j==null||j(C,L)},className:c(j&&"cursor-pointer hover:border-primary/40"),children:[Q&&e.jsx(ke,{density:f,className:"w-8 px-2 text-center",children:e.jsx("button",{type:"button",onClick:J=>{J.stopPropagation(),Le(A)},"aria-expanded":ce,"aria-label":ce?"Collapse row":"Expand row",className:"size-6 inline-flex items-center justify-center rounded text-text-muted hover:text-text hover:bg-surface-muted transition-transform cursor-pointer outline-none focus-visible:outline-2 focus-visible:outline-primary",children:e.jsx("span",{className:c("inline-block transition-transform duration-150",ce&&"rotate-180"),children:e.jsx(so,{})})})}),i&&e.jsx(ke,{density:f,className:"w-8 px-3",children:e.jsx(We,{checked:se,onChange:J=>xe(A,J),"aria-label":`Select row ${A}`})}),t.map(J=>e.jsx(ke,{align:J.align,density:f,children:J.render?J.render(C,L):C[J.key]},J.key))]}),Q&&ce&&e.jsx("tr",{className:c(g==="cards"?"bg-surface-muted/30":"bg-surface-muted/40 border-b border-border"),children:e.jsx("td",{colSpan:Re,className:c("px-5 py-4 text-sm text-text",g==="cards"&&"rounded-lg border border-border border-dashed my-1"),children:k==null?void 0:k(C,L)})})]},A)}):e.jsx("tr",{children:e.jsxs("td",{colSpan:Re,className:"rounded-lg border border-border bg-white px-4 py-12 text-center text-text-muted",children:[e.jsx("p",{className:"font-semibold text-text",children:b}),e.jsx("p",{className:"mt-1 text-sm text-text-muted",children:y})]})})})]})}),d&&!p&&e.jsx(vt,{page:Z,pageSize:V,total:le,onPageChange:C=>{var L;typeof d.page>"u"&&oe(C),(L=d.onPageChange)==null||L.call(d,C)},pageSizeOptions:d.pageSizeOptions,onPageSizeChange:C=>{var L;typeof d.pageSize>"u"&&O(C),(L=d.onPageSizeChange)==null||L.call(d,C)},showSummary:d.showSummary})]})}Yr.displayName="GymatraDataTable";const no=re.Tabs.Root,ao=re.Tabs.List,oo=re.Tabs.Tab,io=re.Tabs.Panel,lo=re.Tabs.Indicator,co={sm:"h-8 px-2.5 text-sm gap-1.5",md:"h-9 px-3.5 text-sm gap-2",lg:"h-11 px-4 text-base gap-2.5"};function uo(t,r,s,n="horizontal"){const a="inline-flex items-center justify-center font-medium transition-colors select-none outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary disabled:pointer-events-none disabled:opacity-50 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 cursor-pointer",o=co[r],i=s?"flex-1":"";switch(t){case"line":return n==="vertical"?c(a,o,i,"justify-start border-r-2 -mr-px border-transparent text-text-muted hover:text-text hover:border-border","data-[active]:border-primary aria-selected:border-primary data-[active]:text-primary aria-selected:text-primary"):c(a,o,i,"border-b-2 -mb-px border-transparent text-text-muted hover:text-text hover:border-border","data-[active]:border-primary aria-selected:border-primary data-[active]:text-primary aria-selected:text-primary");case"pills":return c(a,o,i,"rounded-md border border-transparent text-text-muted hover:text-text hover:bg-surface-muted/60","data-[active]:bg-white aria-selected:bg-white data-[active]:text-primary aria-selected:text-primary data-[active]:border-border aria-selected:border-border");case"enclosed":return c(a,o,i,"rounded-t-md border-t border-x -mb-px border-transparent text-text-muted hover:text-text hover:bg-surface-muted/40","data-[active]:border-border aria-selected:border-border data-[active]:bg-white aria-selected:bg-white data-[active]:text-primary aria-selected:text-primary data-[active]:border-b-transparent aria-selected:border-b-transparent");case"soft":default:return c(a,o,i,"rounded-md text-text-muted hover:bg-surface-muted hover:text-text","data-[active]:bg-primary-soft aria-selected:bg-primary-soft data-[active]:text-primary aria-selected:text-primary")}}function xo(t,r="horizontal",s){if(r==="vertical")return t==="line"?"flex flex-col border-r border-border gap-1":t==="pills"?"flex flex-col rounded-lg border border-border bg-surface-muted/60 p-1 gap-1":"flex flex-col gap-1";const n=s?"w-full":"";switch(t){case"line":return c("flex items-center border-b border-border gap-2 sm:gap-6",n);case"pills":return c("inline-flex items-center rounded-lg border border-border bg-surface-muted/60 p-1 gap-1",n);case"enclosed":return c("flex items-center border-b border-border gap-1",n);case"soft":default:return c("flex items-center gap-1.5",n)}}function mo({value:t,defaultValue:r,onValueChange:s,variant:n="line",size:a="md",orientation:o="horizontal",fullWidth:i=!1,items:l,children:m,className:u,listClassName:d,panelClassName:b}){const y=r??(l&&l.length>0?l[0].value:void 0),p=t!==void 0?{value:t}:y!==void 0?{defaultValue:y}:{};return e.jsx(re.Tabs.Root,{...p,onValueChange:x=>{typeof x=="string"&&(s==null||s(x))},orientation:o,className:c(o==="vertical"?"flex gap-6 items-start":"flex flex-col",u),children:l&&l.length>0?e.jsxs(e.Fragment,{children:[e.jsx(re.Tabs.List,{className:c(xo(n,o,i),d),children:l.map(x=>{const f=x.startIcon??x.icon;return e.jsxs(re.Tabs.Tab,{value:x.value,disabled:x.disabled,className:c(uo(n,a,i,o)),children:[f&&e.jsx("span",{className:"shrink-0 size-4 flex items-center justify-center",children:f}),e.jsx("span",{children:x.label}),x.badge!==void 0&&e.jsx(ot,{variant:x.badgeVariant??"default",size:"sm",pill:!0,className:"ml-1 text-xs px-1.5 py-0 h-4 min-w-4",children:x.badge}),x.endIcon&&e.jsx("span",{className:"shrink-0 size-4 flex items-center justify-center",children:x.endIcon})]},x.value)})}),l.map(x=>x.content?e.jsx(re.Tabs.Panel,{value:x.value,className:c("pt-4 focus-visible:outline-none",b),children:x.content},x.value):null)]}):m})}const po=qt.Toggle,fo=Ut.ToggleGroup;function Jr(t="default"){switch(t){case"outline":return c("border border-border bg-white text-text","hover:bg-surface-muted hover:border-text-subtle","data-[pressed]:border-primary data-[pressed]:bg-primary-soft data-[pressed]:text-primary data-[pressed]:font-medium");case"solid":return c("bg-surface-muted text-text","hover:bg-surface-muted/80","data-[pressed]:bg-primary data-[pressed]:text-white data-[pressed]:font-medium");case"ghost":return c("bg-transparent text-text-muted","hover:bg-surface-muted hover:text-text","data-[pressed]:bg-surface-muted data-[pressed]:text-primary data-[pressed]:font-medium");case"default":default:return c("bg-surface-muted text-text","hover:bg-surface-muted/80 hover:text-text","data-[pressed]:bg-primary-soft data-[pressed]:text-primary data-[pressed]:font-medium")}}function Xr(t="md"){switch(t){case"sm":return"h-8 px-2.5 text-sm gap-1.5 rounded-md";case"lg":return"h-11 px-4 text-base gap-2.5 rounded-md";case"md":default:return"h-9.5 px-3 text-sm gap-2 rounded-md"}}const zt=h.forwardRef(({variant:t="default",size:r="md",startIcon:s,endIcon:n,className:a,children:o,...i},l)=>e.jsxs(qt.Toggle,{ref:l,className:c("inline-flex items-center justify-center select-none outline-none transition-colors shadow-none font-medium","focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-primary","data-[disabled]:opacity-50 data-[disabled]:pointer-events-none",Xr(r),Jr(t),a),...i,children:[s&&e.jsx("span",{className:"shrink-0 size-4 flex items-center justify-center",children:s}),o&&e.jsx("span",{children:o}),n&&e.jsx("span",{className:"shrink-0 size-4 flex items-center justify-center",children:n})]}));zt.displayName="GymatraToggle";const ho=h.forwardRef(({options:t,value:r,defaultValue:s,onValueChange:n,size:a="md",variant:o="default",bordered:i=!0,multiple:l=!1,orientation:m="horizontal",className:u,children:d,...b},y)=>{const p=r!==void 0?Array.isArray(r)?r:[r]:void 0,x=s!==void 0?Array.isArray(s)?s:[s]:void 0,f=j=>{n&&n(l?j:j[0]??"")},g=m==="vertical";return e.jsx(Ut.ToggleGroup,{ref:y,value:p,defaultValue:x,onValueChange:f,multiple:l,orientation:m,className:c("inline-flex select-none",g?"flex-col items-stretch gap-1":"flex-row items-center gap-1",i?"rounded-md border border-border bg-white p-1 shadow-none":"bg-transparent p-0.5",u),...b,children:t&&t.length>0?t.map(j=>e.jsx(zt,{value:j.value,size:a,variant:o,disabled:j.disabled,"aria-label":j.ariaLabel||(typeof j.label=="string"?j.label:void 0),startIcon:j.startIcon??j.icon,endIcon:j.endIcon,children:j.label},j.value)):d})}),bo=ne.Tooltip.Provider,yo={dark:"bg-text text-white",light:"border border-border bg-white text-text"},go={dark:"bg-text",light:c("border-border bg-white","data-[side=top]:border-b data-[side=top]:border-r","data-[side=bottom]:border-t data-[side=bottom]:border-l","data-[side=left]:border-t data-[side=left]:border-r","data-[side=right]:border-b data-[side=right]:border-l")},jo={dark:"bg-white/15 text-white",light:"bg-surface-muted text-text-muted"};function es({content:t,shortcut:r,children:s,side:n="top",align:a="center",sideOffset:o=8,delay:i=300,closeDelay:l=0,showArrow:m=!0,disabled:u=!1,open:d,defaultOpen:b,onOpenChange:y,className:p,variant:x="dark"}){return e.jsx(ne.Tooltip.Provider,{delay:i,closeDelay:l,children:e.jsxs(ne.Tooltip.Root,{open:d,defaultOpen:b,onOpenChange:y,disabled:u,children:[e.jsx(ne.Tooltip.Trigger,{render:s}),e.jsx(ne.Tooltip.Portal,{children:e.jsx(ne.Tooltip.Positioner,{side:n,align:a,sideOffset:o,className:"z-[10030] outline-none",children:e.jsxs(ne.Tooltip.Popup,{className:c("relative flex max-w-xs items-center gap-2 rounded-md px-2.5 py-1.5 text-xs font-medium leading-snug outline-none","origin-[var(--transform-origin)] transition-[opacity,scale] duration-150 motion-reduce:transition-none","data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:scale-95 data-[ending-style]:opacity-0",yo[x],p),children:[m&&e.jsx(ne.Tooltip.Arrow,{className:c("size-2 rotate-45","data-[side=top]:-bottom-1 data-[side=bottom]:-top-1 data-[side=left]:-right-1 data-[side=right]:-left-1",go[x])}),e.jsx("span",{className:"min-w-0",children:t}),r&&e.jsx("kbd",{className:c("shrink-0 rounded-sm px-1.5 py-0.5 font-mono text-xs font-normal",jo[x]),children:r})]})})})]})})}es.displayName="GymatraTooltip";Object.defineProperty(exports,"BaseUICheckbox",{enumerable:!0,get:()=>et.Checkbox});Object.defineProperty(exports,"BaseUIField",{enumerable:!0,get:()=>_.Field});Object.defineProperty(exports,"BaseUIForm",{enumerable:!0,get:()=>Wt.Form});Object.defineProperty(exports,"BaseUIInput",{enumerable:!0,get:()=>$t.Input});Object.defineProperty(exports,"BaseUISelect",{enumerable:!0,get:()=>K.Select});Object.defineProperty(exports,"BaseUISwitch",{enumerable:!0,get:()=>Ge.Switch});Object.defineProperty(exports,"formatPhoneNumber",{enumerable:!0,get:()=>ae.formatPhoneNumber});Object.defineProperty(exports,"formatPhoneNumberIntl",{enumerable:!0,get:()=>ae.formatPhoneNumberIntl});Object.defineProperty(exports,"isValidPhoneNumber",{enumerable:!0,get:()=>ae.isValidPhoneNumber});exports.DRAWER_MIN_WIDTH=tn;exports.DRAWER_SIZES=st;exports.GYMATRA_CHART_PALETTE=Ce;exports.GYMATRA_FINGER_LABELS=hr;exports.GymatraAccordion=os;exports.GymatraAccordionHeader=cs;exports.GymatraAccordionItemPrimitive=ls;exports.GymatraAccordionPanel=us;exports.GymatraAccordionRoot=is;exports.GymatraAccordionTrigger=ds;exports.GymatraAlert=Vt;exports.GymatraAutocomplete=Dn;exports.GymatraAvatar=ze;exports.GymatraAvatarGroup=Kt;exports.GymatraAvatarUpload=ra;exports.GymatraAvatarUploadField=Zn;exports.GymatraBadge=ot;exports.GymatraBarChart=ws;exports.GymatraBreadcrumb=Zt;exports.GymatraBreadcrumbEllipsis=tr;exports.GymatraBreadcrumbItem=Yt;exports.GymatraBreadcrumbLink=Jt;exports.GymatraBreadcrumbList=Qt;exports.GymatraBreadcrumbPage=Xt;exports.GymatraBreadcrumbSeparator=er;exports.GymatraButton=Fe;exports.GymatraChartCard=ar;exports.GymatraCheckbox=ct;exports.GymatraCheckboxField=On;exports.GymatraCircularProgress=qa;exports.GymatraColorPicker=Yn;exports.GymatraColorPickerField=Lr;exports.GymatraCombobox=qs;exports.GymatraComboboxChip=Ws;exports.GymatraComboboxChipRemove=$s;exports.GymatraComboboxChips=Es;exports.GymatraComboboxClear=Fs;exports.GymatraComboboxEmpty=ut;exports.GymatraComboboxGroup=As;exports.GymatraComboboxGroupLabel=xt;exports.GymatraComboboxInput=or;exports.GymatraComboboxItem=Ee;exports.GymatraComboboxList=Bs;exports.GymatraComboboxPopup=dt;exports.GymatraComboboxPortal=Ls;exports.GymatraComboboxPositioner=Rs;exports.GymatraComboboxRoot=Is;exports.GymatraComboboxSeparator=Ds;exports.GymatraComboboxTrigger=Ts;exports.GymatraCurrencyInput=Cr;exports.GymatraCustomSelect=Bn;exports.GymatraDataTable=Yr;exports.GymatraDateInput=zr;exports.GymatraDateRangeInput=Rn;exports.GymatraDateTimeInput=Mr;exports.GymatraDialog=he;exports.GymatraDialogBackdrop=Zs;exports.GymatraDialogClose=en;exports.GymatraDialogComponent=lr;exports.GymatraDialogContent=Ys;exports.GymatraDialogDescription=Xs;exports.GymatraDialogPopup=Qs;exports.GymatraDialogPortal=Ks;exports.GymatraDialogRoot=Vs;exports.GymatraDialogTitle=Js;exports.GymatraDialogTrigger=_s;exports.GymatraDoughnutChart=Ns;exports.GymatraDrawerPanel=ln;exports.GymatraDrawerProvider=dr;exports.GymatraEmailInput=vr;exports.GymatraEmptyState=ur;exports.GymatraField=na;exports.GymatraFieldContainer=D;exports.GymatraFileUploadField=_n;exports.GymatraFilterBar=fr;exports.GymatraFilterBarChip=pr;exports.GymatraFilterBarSearch=mr;exports.GymatraFilterBarSelect=bn;exports.GymatraFilterSelect=pt;exports.GymatraFingerPicker=vn;exports.GymatraFloatingField=Me;exports.GymatraFloatingSelect=Ar;exports.GymatraFloatingTextarea=Br;exports.GymatraForm=sa;exports.GymatraIconPicker=jr;exports.GymatraImageUploadField=Kn;exports.GymatraInput=$r;exports.GymatraLineChart=vs;exports.GymatraMenu=fa;exports.GymatraMenuCheckboxItem=Ve;exports.GymatraMenuGroup=Or;exports.GymatraMenuGroupLabel=Ue;exports.GymatraMenuItem=He;exports.GymatraMenuPopup=ye;exports.GymatraMenuPortal=ca;exports.GymatraMenuPositioner=da;exports.GymatraMenuRadioGroup=ua;exports.GymatraMenuRadioItem=_e;exports.GymatraMenuRoot=ia;exports.GymatraMenuSeparator=qe;exports.GymatraMenuSubmenuRoot=xa;exports.GymatraMenuSubmenuTrigger=Ke;exports.GymatraMenuTrigger=la;exports.GymatraMenubar=Hr;exports.GymatraMenubarCheckboxItem=Sa;exports.GymatraMenubarGroup=ja;exports.GymatraMenubarGroupLabel=Ca;exports.GymatraMenubarItem=ka;exports.GymatraMenubarMenu=ba;exports.GymatraMenubarPopup=Na;exports.GymatraMenubarPortal=ya;exports.GymatraMenubarPositioner=ga;exports.GymatraMenubarRadioGroup=va;exports.GymatraMenubarRadioItem=za;exports.GymatraMenubarRoot=ha;exports.GymatraMenubarSeparator=Ga;exports.GymatraMenubarSubmenuRoot=wa;exports.GymatraMenubarSubmenuTrigger=Pa;exports.GymatraMenubarTrigger=jt;exports.GymatraMultiSelect=An;exports.GymatraNumberInput=Pe;exports.GymatraNumericField=Ln;exports.GymatraOtpField=ea;exports.GymatraOtpInput=ta;exports.GymatraPagination=vt;exports.GymatraPasswordInput=wr;exports.GymatraPercentageInput=Sr;exports.GymatraPhoneInput=kr;exports.GymatraPopover=zn;exports.GymatraPopoverArrow=gr;exports.GymatraPopoverClose=bt;exports.GymatraPopoverDescription=ht;exports.GymatraPopoverPopup=Oe;exports.GymatraPopoverPortal=Gn;exports.GymatraPopoverPositioner=Cn;exports.GymatraPopoverRoot=Nn;exports.GymatraPopoverTitle=ft;exports.GymatraPopoverTrigger=kn;exports.GymatraProgress=Oa;exports.GymatraProgressIndicator=Aa;exports.GymatraProgressLabel=Da;exports.GymatraProgressRoot=Ra;exports.GymatraProgressTrack=Ba;exports.GymatraProgressValue=Fa;exports.GymatraRadioGroupField=Hn;exports.GymatraRangeField=Xn;exports.GymatraRichTextEditor=Vn;exports.GymatraScanProgress=wn;exports.GymatraSearchInput=Nr;exports.GymatraSelect=oa;exports.GymatraSelectField=Ir;exports.GymatraSeparator=qr;exports.GymatraSeparatorRoot=Ua;exports.GymatraSliderField=Jn;exports.GymatraSparkline=Ya;exports.GymatraStatCard=Vr;exports.GymatraStep=Zr;exports.GymatraStepConnector=eo;exports.GymatraStepContent=to;exports.GymatraStepIndicator=Se;exports.GymatraStepper=Xa;exports.GymatraSwitch=yt;exports.GymatraSwitchField=qn;exports.GymatraSwitchRoot=Fn;exports.GymatraSwitchThumb=En;exports.GymatraTab=oo;exports.GymatraTable=Qr;exports.GymatraTableBody=Nt;exports.GymatraTableCell=ke;exports.GymatraTableCheckbox=We;exports.GymatraTableHead=Ne;exports.GymatraTableHeader=wt;exports.GymatraTableRow=kt;exports.GymatraTableSkeleton=St;exports.GymatraTableSkeletonRow=Ct;exports.GymatraTableSortHead=Gt;exports.GymatraTabs=mo;exports.GymatraTabsIndicator=lo;exports.GymatraTabsList=ao;exports.GymatraTabsPanel=io;exports.GymatraTabsRoot=no;exports.GymatraTextField=Rr;exports.GymatraTextInput=be;exports.GymatraTextarea=aa;exports.GymatraTextareaField=Tr;exports.GymatraTimeInput=Pr;exports.GymatraToggle=zt;exports.GymatraToggleField=Un;exports.GymatraToggleGroup=ho;exports.GymatraToggleGroupRoot=fo;exports.GymatraToggleRoot=po;exports.GymatraTooltip=es;exports.GymatraTooltipProvider=bo;exports.GymatraUrlInput=Gr;exports.SidebarContext=an;exports.SidebarProvider=on;exports.cn=c;exports.getDrawerWidth=rn;exports.getToggleSizeClasses=Xr;exports.getToggleVariantClasses=Jr;exports.gymatraAlpha=rr;exports.renderMenuItems=Ze;exports.useGymatraChartTheme=$e;exports.useGymatraDrawer=cr;exports.useGymatraStepper=_r;exports.useSidebar=nn;