@wakastellar/ui 1.0.6 → 1.0.9

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.js CHANGED
@@ -1,6 +1,6 @@
1
- "use strict";var Sc=Object.create;var bn=Object.defineProperty;var Dc=Object.getOwnPropertyDescriptor;var Tc=Object.getOwnPropertyNames;var Ac=Object.getPrototypeOf,Ec=Object.prototype.hasOwnProperty;var Mc=(t,s,a,r)=>{if(s&&typeof s=="object"||typeof s=="function")for(let n of Tc(s))!Ec.call(t,n)&&n!==a&&bn(t,n,{get:()=>s[n],enumerable:!(r=Dc(s,n))||r.enumerable});return t};var Dt=(t,s,a)=>(a=t!=null?Sc(Ac(t)):{},Mc(s||!t||!t.__esModule?bn(a,"default",{value:t,enumerable:!0}):a,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),O=require("react"),Pc=require("@radix-ui/react-accordion"),h=require("lucide-react"),yo=require("clsx"),Rc=require("tailwind-merge"),Xe=require("class-variance-authority"),Fc=require("@radix-ui/react-alert-dialog"),$c=require("@radix-ui/react-aspect-ratio"),Lc=require("@radix-ui/react-avatar"),Na=require("@radix-ui/react-slot"),Ic=require("react-day-picker"),Oc=require("@radix-ui/react-checkbox"),V=require("date-fns"),zc=require("@radix-ui/react-collapsible"),dt=require("cmdk"),_c=require("@radix-ui/react-dialog"),Vc=require("@radix-ui/react-context-menu"),Wc=require("@radix-ui/react-dropdown-menu"),Uc=require("@radix-ui/react-label"),Bc=require("@radix-ui/react-hover-card"),qc=require("@radix-ui/react-select"),er=require("react-dom"),Hc=require("@radix-ui/react-menubar"),Gc=require("@radix-ui/react-navigation-menu"),Xc=require("@radix-ui/react-popover"),Kc=require("@radix-ui/react-progress"),Yc=require("@radix-ui/react-radio-group"),Jc=require("@radix-ui/react-scroll-area"),Qc=require("@radix-ui/react-separator"),Zc=require("@radix-ui/react-slider"),ed=require("@radix-ui/react-switch"),td=require("@radix-ui/react-tabs"),sd=require("@radix-ui/react-toast"),ad=require("@radix-ui/react-toggle"),rd=require("@radix-ui/react-tooltip"),Be=require("@tanstack/react-table"),wt=require("react-i18next"),nd=require("@tanstack/react-virtual"),_t=require("react-datepicker"),$t=require("i18next");function Ee(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const c=Ee(O),hs=Ee(Pc),it=Ee(Fc),od=Ee($c),Ss=Ee(Lc),tr=Ee(Oc),dr=Ee(zc),ue=Ee(_c),Me=Ee(Vc),Pe=Ee(Wc),No=Ee(Uc),Ca=Ee(Bc),ze=Ee(qc),Ae=Ee(Hc),ut=Ee(Gc),qs=Ee(Xc),sr=Ee(Kc),Hs=Ee(Yc),us=Ee(Jc),Co=Ee(Qc),Os=Ee(Zc),ar=Ee(ed),ws=Ee(td),pt=Ee(sd),ko=Ee(ad),Zs=Ee(rd);function ba(...t){return Rc.twMerge(yo.clsx(...t))}ba.variants=function(t){const s={variants:t.variants??{},defaultVariants:t.defaultVariants},a=Xe.cva(t.base??"",s);return r=>{const{class:n,className:o,...i}=r??{};return ba(a(i),n,o)}};const b=(...t)=>ba(t),rr=hs.Root,ur=c.forwardRef(({className:t,...s},a)=>e.jsx(hs.Item,{ref:a,className:b("border-b",t),...s}));ur.displayName="AccordionItem";const mr=c.forwardRef(({className:t,children:s,...a},r)=>e.jsx(hs.Header,{className:"flex",children:e.jsxs(hs.Trigger,{ref:r,className:b("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...a,children:[s,e.jsx(h.ChevronDown,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));mr.displayName=hs.Trigger.displayName;const hr=c.forwardRef(({className:t,children:s,...a},r)=>e.jsx(hs.Content,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...a,children:e.jsx("div",{className:b("pb-4 pt-0",t),children:s})}));hr.displayName=hs.Content.displayName;const fs=it.Root,So=it.Trigger,Do=it.Portal,fr=c.forwardRef(({className:t,...s},a)=>e.jsx(it.Overlay,{className:b("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s,ref:a}));fr.displayName=it.Overlay.displayName;const Kt=c.forwardRef(({className:t,...s},a)=>e.jsxs(Do,{children:[e.jsx(fr,{}),e.jsx(it.Content,{ref:a,className:b("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...s})]}));Kt.displayName=it.Content.displayName;const Yt=({className:t,...s})=>e.jsx("div",{className:b("flex flex-col space-y-2 text-center sm:text-left",t),...s});Yt.displayName="AlertDialogHeader";const Jt=({className:t,...s})=>e.jsx("div",{className:b("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});Jt.displayName="AlertDialogFooter";const Qt=c.forwardRef(({className:t,...s},a)=>e.jsx(it.Title,{ref:a,className:b("text-lg font-semibold",t),...s}));Qt.displayName=it.Title.displayName;const Zt=c.forwardRef(({className:t,...s},a)=>e.jsx(it.Description,{ref:a,className:b("text-sm text-muted-foreground",t),...s}));Zt.displayName=it.Description.displayName;const es=c.forwardRef(({className:t,...s},a)=>e.jsx(it.Action,{ref:a,className:b("inline-flex h-10 items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground ring-offset-background transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...s}));es.displayName=it.Action.displayName;const ts=c.forwardRef(({className:t,...s},a)=>e.jsx(it.Cancel,{ref:a,className:b("mt-2 inline-flex h-10 items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-semibold ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 sm:mt-0",t),...s}));ts.displayName=it.Cancel.displayName;const id=Xe.cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),To=c.forwardRef(({className:t,variant:s,...a},r)=>e.jsx("div",{ref:r,role:"alert",className:b(id({variant:s}),t),...a}));To.displayName="Alert";const Ao=c.forwardRef(({className:t,...s},a)=>e.jsx("h5",{ref:a,className:b("mb-1 font-medium leading-none tracking-tight",t),...s}));Ao.displayName="AlertTitle";const Eo=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b("text-sm [&_p]:leading-relaxed",t),...s}));Eo.displayName="AlertDescription";const ld=od.Root,yt=c.forwardRef(({className:t,...s},a)=>e.jsx(Ss.Root,{ref:a,className:b("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...s}));yt.displayName=Ss.Root.displayName;const Nt=c.forwardRef(({className:t,...s},a)=>e.jsx(Ss.Image,{ref:a,className:b("aspect-square h-full w-full",t),...s}));Nt.displayName=Ss.Image.displayName;const Ct=c.forwardRef(({className:t,...s},a)=>e.jsx(Ss.Fallback,{ref:a,className:b("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...s}));Ct.displayName=Ss.Fallback.displayName;const Mo=Xe.cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Se({className:t,variant:s,...a}){return e.jsx("div",{className:b(Mo({variant:s}),t),...a})}const cd=Xe.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),L=c.forwardRef(({className:t,variant:s,size:a,asChild:r=!1,...n},o)=>{const i=r?Na.Slot:"button";return e.jsx(i,{className:b(cd({variant:s,size:a,className:t})),ref:o,...n})});L.displayName="Button";function ka({className:t,classNames:s,showOutsideDays:a=!0,...r}){return e.jsx(Ic.DayPicker,{showOutsideDays:a,className:b("p-4 bg-background border border-border rounded-lg shadow-sm",t),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center mb-4",caption_label:"text-lg font-semibold text-foreground",nav:"space-x-1 flex items-center",nav_button:b("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200","h-8 w-8 bg-background border border-border hover:bg-accent hover:text-accent-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex mb-2",head_cell:"text-muted-foreground rounded-md w-10 h-10 font-medium text-sm flex items-center justify-center",row:"flex w-full",cell:"h-10 w-10 text-center text-sm p-0 relative",day:b("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200","h-10 w-10 p-0 font-normal cursor-pointer","hover:bg-accent hover:text-accent-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50"),day_range_end:"day-range-end",day_selected:b("bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground","focus:bg-primary focus:text-primary-foreground shadow-sm"),day_today:"bg-accent text-accent-foreground font-semibold",day_outside:"text-muted-foreground opacity-50 hover:opacity-70",day_disabled:"text-muted-foreground opacity-30 cursor-not-allowed",day_range_middle:"bg-accent/50 text-accent-foreground",day_hidden:"invisible",...s},components:{Chevron:({...n})=>n.orientation==="left"?e.jsx(h.ChevronLeft,{className:"h-4 w-4"}):e.jsx(h.ChevronRight,{className:"h-4 w-4"})},...r})}ka.displayName="Calendar";const ke=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b("rounded-xl border bg-card text-card-foreground shadow",t),...s}));ke.displayName="Card";const qe=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b("flex flex-col space-y-1.5 p-6",t),...s}));qe.displayName="CardHeader";const Oe=c.forwardRef(({className:t,...s},a)=>e.jsx("h3",{ref:a,className:b("font-semibold leading-none tracking-tight",t),...s}));Oe.displayName="CardTitle";const ot=c.forwardRef(({className:t,...s},a)=>e.jsx("p",{ref:a,className:b("text-sm text-muted-foreground",t),...s}));ot.displayName="CardDescription";const Te=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b("p-6 pt-0",t),...s}));Te.displayName="CardContent";const pr=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b("flex items-center p-6 pt-0",t),...s}));pr.displayName="CardFooter";const Ze=c.forwardRef(({className:t,...s},a)=>e.jsx(tr.Root,{ref:a,className:b("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...s,children:e.jsx(tr.Indicator,{className:b("flex items-center justify-center text-current"),children:e.jsx(h.Check,{className:"h-4 w-4"})})}));Ze.displayName=tr.Root.displayName;function Fe(t){return(s={})=>{const a=s.width?String(s.width):t.defaultWidth;return t.formats[a]||t.formats[t.defaultWidth]}}function he(t){return(s,a)=>{const r=a?.context?String(a.context):"standalone";let n;if(r==="formatting"&&t.formattingValues){const i=t.defaultFormattingWidth||t.defaultWidth,l=a?.width?String(a.width):i;n=t.formattingValues[l]||t.formattingValues[i]}else{const i=t.defaultWidth,l=a?.width?String(a.width):t.defaultWidth;n=t.values[l]||t.values[i]}const o=t.argumentCallback?t.argumentCallback(s):s;return n[o]}}function fe(t){return(s,a={})=>{const r=a.width,n=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],o=s.match(n);if(!o)return null;const i=o[0],l=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],u=Array.isArray(l)?ud(l,m=>m.test(i)):dd(l,m=>m.test(i));let d;d=t.valueCallback?t.valueCallback(u):u,d=a.valueCallback?a.valueCallback(d):d;const f=s.slice(i.length);return{value:d,rest:f}}}function dd(t,s){for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&s(t[a]))return a}function ud(t,s){for(let a=0;a<t.length;a++)if(s(t[a]))return a}function as(t){return(s,a={})=>{const r=s.match(t.matchPattern);if(!r)return null;const n=r[0],o=s.match(t.parsePattern);if(!o)return null;let i=t.valueCallback?t.valueCallback(o[0]):o[0];i=a.valueCallback?a.valueCallback(i):i;const l=s.slice(n.length);return{value:i,rest:l}}}const jn=Symbol.for("constructDateFrom");function Po(t,s){return typeof t=="function"?t(s):t&&typeof t=="object"&&jn in t?t[jn](s):t instanceof Date?new t.constructor(s):new Date(s)}function md(t,...s){const a=Po.bind(null,t||s.find(r=>typeof r=="object"));return s.map(a)}let hd={};function fd(){return hd}function pd(t,s){return Po(s||t,t)}function vn(t,s){const a=fd(),r=s?.weekStartsOn??s?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,n=pd(t,s?.in),o=n.getDay(),i=(o<r?7:0)+o-r;return n.setDate(n.getDate()-i),n.setHours(0,0,0,0),n}function nr(t,s,a){const[r,n]=md(a?.in,t,s);return+vn(r,a)==+vn(n,a)}const wn={lessThanXSeconds:{standalone:{one:"weniger als 1 Sekunde",other:"weniger als {{count}} Sekunden"},withPreposition:{one:"weniger als 1 Sekunde",other:"weniger als {{count}} Sekunden"}},xSeconds:{standalone:{one:"1 Sekunde",other:"{{count}} Sekunden"},withPreposition:{one:"1 Sekunde",other:"{{count}} Sekunden"}},halfAMinute:{standalone:"eine halbe Minute",withPreposition:"einer halben Minute"},lessThanXMinutes:{standalone:{one:"weniger als 1 Minute",other:"weniger als {{count}} Minuten"},withPreposition:{one:"weniger als 1 Minute",other:"weniger als {{count}} Minuten"}},xMinutes:{standalone:{one:"1 Minute",other:"{{count}} Minuten"},withPreposition:{one:"1 Minute",other:"{{count}} Minuten"}},aboutXHours:{standalone:{one:"etwa 1 Stunde",other:"etwa {{count}} Stunden"},withPreposition:{one:"etwa 1 Stunde",other:"etwa {{count}} Stunden"}},xHours:{standalone:{one:"1 Stunde",other:"{{count}} Stunden"},withPreposition:{one:"1 Stunde",other:"{{count}} Stunden"}},xDays:{standalone:{one:"1 Tag",other:"{{count}} Tage"},withPreposition:{one:"1 Tag",other:"{{count}} Tagen"}},aboutXWeeks:{standalone:{one:"etwa 1 Woche",other:"etwa {{count}} Wochen"},withPreposition:{one:"etwa 1 Woche",other:"etwa {{count}} Wochen"}},xWeeks:{standalone:{one:"1 Woche",other:"{{count}} Wochen"},withPreposition:{one:"1 Woche",other:"{{count}} Wochen"}},aboutXMonths:{standalone:{one:"etwa 1 Monat",other:"etwa {{count}} Monate"},withPreposition:{one:"etwa 1 Monat",other:"etwa {{count}} Monaten"}},xMonths:{standalone:{one:"1 Monat",other:"{{count}} Monate"},withPreposition:{one:"1 Monat",other:"{{count}} Monaten"}},aboutXYears:{standalone:{one:"etwa 1 Jahr",other:"etwa {{count}} Jahre"},withPreposition:{one:"etwa 1 Jahr",other:"etwa {{count}} Jahren"}},xYears:{standalone:{one:"1 Jahr",other:"{{count}} Jahre"},withPreposition:{one:"1 Jahr",other:"{{count}} Jahren"}},overXYears:{standalone:{one:"mehr als 1 Jahr",other:"mehr als {{count}} Jahre"},withPreposition:{one:"mehr als 1 Jahr",other:"mehr als {{count}} Jahren"}},almostXYears:{standalone:{one:"fast 1 Jahr",other:"fast {{count}} Jahre"},withPreposition:{one:"fast 1 Jahr",other:"fast {{count}} Jahren"}}},xd=(t,s,a)=>{let r;const n=a?.addSuffix?wn[t].withPreposition:wn[t].standalone;return typeof n=="string"?r=n:s===1?r=n.one:r=n.other.replace("{{count}}",String(s)),a?.addSuffix?a.comparison&&a.comparison>0?"in "+r:"vor "+r:r},gd={full:"EEEE, do MMMM y",long:"do MMMM y",medium:"do MMM y",short:"dd.MM.y"},bd={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},jd={full:"{{date}} 'um' {{time}}",long:"{{date}} 'um' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},vd={date:Fe({formats:gd,defaultWidth:"full"}),time:Fe({formats:bd,defaultWidth:"full"}),dateTime:Fe({formats:jd,defaultWidth:"full"})},wd={lastWeek:"'letzten' eeee 'um' p",yesterday:"'gestern um' p",today:"'heute um' p",tomorrow:"'morgen um' p",nextWeek:"eeee 'um' p",other:"P"},yd=(t,s,a,r)=>wd[t],Nd={narrow:["v.Chr.","n.Chr."],abbreviated:["v.Chr.","n.Chr."],wide:["vor Christus","nach Christus"]},Cd={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1. Quartal","2. Quartal","3. Quartal","4. Quartal"]},or={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],wide:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},kd={narrow:or.narrow,abbreviated:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sep.","Okt.","Nov.","Dez."],wide:or.wide},Sd={narrow:["S","M","D","M","D","F","S"],short:["So","Mo","Di","Mi","Do","Fr","Sa"],abbreviated:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."],wide:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},Dd={narrow:{am:"vm.",pm:"nm.",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachm.",evening:"Abend",night:"Nacht"},abbreviated:{am:"vorm.",pm:"nachm.",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachmittag",evening:"Abend",night:"Nacht"},wide:{am:"vormittags",pm:"nachmittags",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachmittag",evening:"Abend",night:"Nacht"}},Td={narrow:{am:"vm.",pm:"nm.",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachm.",evening:"abends",night:"nachts"},abbreviated:{am:"vorm.",pm:"nachm.",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachmittags",evening:"abends",night:"nachts"},wide:{am:"vormittags",pm:"nachmittags",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachmittags",evening:"abends",night:"nachts"}},Ad=t=>Number(t)+".",Ed={ordinalNumber:Ad,era:he({values:Nd,defaultWidth:"wide"}),quarter:he({values:Cd,defaultWidth:"wide",argumentCallback:t=>t-1}),month:he({values:or,formattingValues:kd,defaultWidth:"wide"}),day:he({values:Sd,defaultWidth:"wide"}),dayPeriod:he({values:Dd,defaultWidth:"wide",formattingValues:Td,defaultFormattingWidth:"wide"})},Md=/^(\d+)(\.)?/i,Pd=/\d+/i,Rd={narrow:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,abbreviated:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,wide:/^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i},Fd={any:[/^v/i,/^n/i]},$d={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? Quartal/i},Ld={any:[/1/i,/2/i,/3/i,/4/i]},Id={narrow:/^[jfmasond]/i,abbreviated:/^(j[aä]n|feb|mär[z]?|apr|mai|jun[i]?|jul[i]?|aug|sep|okt|nov|dez)\.?/i,wide:/^(januar|februar|märz|april|mai|juni|juli|august|september|oktober|november|dezember)/i},Od={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^j[aä]/i,/^f/i,/^mär/i,/^ap/i,/^mai/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},zd={narrow:/^[smdmf]/i,short:/^(so|mo|di|mi|do|fr|sa)/i,abbreviated:/^(son?|mon?|die?|mit?|don?|fre?|sam?)\.?/i,wide:/^(sonntag|montag|dienstag|mittwoch|donnerstag|freitag|samstag)/i},_d={any:[/^so/i,/^mo/i,/^di/i,/^mi/i,/^do/i,/^f/i,/^sa/i]},Vd={narrow:/^(vm\.?|nm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,abbreviated:/^(vorm\.?|nachm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,wide:/^(vormittags|nachmittags|Mitternacht|Mittag|morgens|nachmittags|abends|nachts)/i},Wd={any:{am:/^v/i,pm:/^n/i,midnight:/^Mitte/i,noon:/^Mitta/i,morning:/morgens/i,afternoon:/nachmittags/i,evening:/abends/i,night:/nachts/i}},Ud={ordinalNumber:as({matchPattern:Md,parsePattern:Pd,valueCallback:t=>parseInt(t)}),era:fe({matchPatterns:Rd,defaultMatchWidth:"wide",parsePatterns:Fd,defaultParseWidth:"any"}),quarter:fe({matchPatterns:$d,defaultMatchWidth:"wide",parsePatterns:Ld,defaultParseWidth:"any",valueCallback:t=>t+1}),month:fe({matchPatterns:Id,defaultMatchWidth:"wide",parsePatterns:Od,defaultParseWidth:"any"}),day:fe({matchPatterns:zd,defaultMatchWidth:"wide",parsePatterns:_d,defaultParseWidth:"any"}),dayPeriod:fe({matchPatterns:Vd,defaultMatchWidth:"wide",parsePatterns:Wd,defaultParseWidth:"any"})},Ro={code:"de",formatDistance:xd,formatLong:vd,formatRelative:yd,localize:Ed,match:Ud,options:{weekStartsOn:1,firstWeekContainsDate:4}},Bd={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},qd=(t,s,a)=>{let r;const n=Bd[t];return typeof n=="string"?r=n:s===1?r=n.one:r=n.other.replace("{{count}}",s.toString()),a?.addSuffix?a.comparison&&a.comparison>0?"in "+r:r+" ago":r},Hd={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Gd=(t,s,a,r)=>Hd[t],Xd={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Kd={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Yd={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Jd={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Qd={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Zd={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},eu=(t,s)=>{const a=Number(t),r=a%100;if(r>20||r<10)switch(r%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},tu={ordinalNumber:eu,era:he({values:Xd,defaultWidth:"wide"}),quarter:he({values:Kd,defaultWidth:"wide",argumentCallback:t=>t-1}),month:he({values:Yd,defaultWidth:"wide"}),day:he({values:Jd,defaultWidth:"wide"}),dayPeriod:he({values:Qd,defaultWidth:"wide",formattingValues:Zd,defaultFormattingWidth:"wide"})},su=/^(\d+)(th|st|nd|rd)?/i,au=/\d+/i,ru={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},nu={any:[/^b/i,/^(a|c)/i]},ou={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},iu={any:[/1/i,/2/i,/3/i,/4/i]},lu={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},cu={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},du={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},uu={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},mu={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},hu={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},fu={ordinalNumber:as({matchPattern:su,parsePattern:au,valueCallback:t=>parseInt(t,10)}),era:fe({matchPatterns:ru,defaultMatchWidth:"wide",parsePatterns:nu,defaultParseWidth:"any"}),quarter:fe({matchPatterns:ou,defaultMatchWidth:"wide",parsePatterns:iu,defaultParseWidth:"any",valueCallback:t=>t+1}),month:fe({matchPatterns:lu,defaultMatchWidth:"wide",parsePatterns:cu,defaultParseWidth:"any"}),day:fe({matchPatterns:du,defaultMatchWidth:"wide",parsePatterns:uu,defaultParseWidth:"any"}),dayPeriod:fe({matchPatterns:mu,defaultMatchWidth:"any",parsePatterns:hu,defaultParseWidth:"any"})},pu={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},xu={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},gu={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},bu={date:Fe({formats:pu,defaultWidth:"full"}),time:Fe({formats:xu,defaultWidth:"full"}),dateTime:Fe({formats:gu,defaultWidth:"full"})},Fo={code:"en-US",formatDistance:qd,formatLong:bu,formatRelative:Gd,localize:tu,match:fu,options:{weekStartsOn:0,firstWeekContainsDate:1}},ju={lessThanXSeconds:{one:"menos de un segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"medio minuto",lessThanXMinutes:{one:"menos de un minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"alrededor de 1 hora",other:"alrededor de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 día",other:"{{count}} días"},aboutXWeeks:{one:"alrededor de 1 semana",other:"alrededor de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"alrededor de 1 mes",other:"alrededor de {{count}} meses"},xMonths:{one:"1 mes",other:"{{count}} meses"},aboutXYears:{one:"alrededor de 1 año",other:"alrededor de {{count}} años"},xYears:{one:"1 año",other:"{{count}} años"},overXYears:{one:"más de 1 año",other:"más de {{count}} años"},almostXYears:{one:"casi 1 año",other:"casi {{count}} años"}},vu=(t,s,a)=>{let r;const n=ju[t];return typeof n=="string"?r=n:s===1?r=n.one:r=n.other.replace("{{count}}",s.toString()),a?.addSuffix?a.comparison&&a.comparison>0?"en "+r:"hace "+r:r},wu={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},yu={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Nu={full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Cu={date:Fe({formats:wu,defaultWidth:"full"}),time:Fe({formats:yu,defaultWidth:"full"}),dateTime:Fe({formats:Nu,defaultWidth:"full"})},ku={lastWeek:"'el' eeee 'pasado a la' p",yesterday:"'ayer a la' p",today:"'hoy a la' p",tomorrow:"'mañana a la' p",nextWeek:"eeee 'a la' p",other:"P"},Su={lastWeek:"'el' eeee 'pasado a las' p",yesterday:"'ayer a las' p",today:"'hoy a las' p",tomorrow:"'mañana a las' p",nextWeek:"eeee 'a las' p",other:"P"},Du=(t,s,a,r)=>s.getHours()!==1?Su[t]:ku[t],Tu={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},Au={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},Eu={narrow:["e","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],wide:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},Mu={narrow:["d","l","m","m","j","v","s"],short:["do","lu","ma","mi","ju","vi","sá"],abbreviated:["dom","lun","mar","mié","jue","vie","sáb"],wide:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},Pu={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"}},Ru={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"}},Fu=(t,s)=>Number(t)+"º",$u={ordinalNumber:Fu,era:he({values:Tu,defaultWidth:"wide"}),quarter:he({values:Au,defaultWidth:"wide",argumentCallback:t=>Number(t)-1}),month:he({values:Eu,defaultWidth:"wide"}),day:he({values:Mu,defaultWidth:"wide"}),dayPeriod:he({values:Pu,defaultWidth:"wide",formattingValues:Ru,defaultFormattingWidth:"wide"})},Lu=/^(\d+)(º)?/i,Iu=/\d+/i,Ou={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},zu={any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},_u={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},Vu={any:[/1/i,/2/i,/3/i,/4/i]},Wu={narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},Uu={narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},Bu={narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},qu={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},Hu={narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},Gu={any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},Xu={ordinalNumber:as({matchPattern:Lu,parsePattern:Iu,valueCallback:function(t){return parseInt(t,10)}}),era:fe({matchPatterns:Ou,defaultMatchWidth:"wide",parsePatterns:zu,defaultParseWidth:"any"}),quarter:fe({matchPatterns:_u,defaultMatchWidth:"wide",parsePatterns:Vu,defaultParseWidth:"any",valueCallback:t=>t+1}),month:fe({matchPatterns:Wu,defaultMatchWidth:"wide",parsePatterns:Uu,defaultParseWidth:"any"}),day:fe({matchPatterns:Bu,defaultMatchWidth:"wide",parsePatterns:qu,defaultParseWidth:"any"}),dayPeriod:fe({matchPatterns:Hu,defaultMatchWidth:"any",parsePatterns:Gu,defaultParseWidth:"any"})},$o={code:"es",formatDistance:vu,formatLong:Cu,formatRelative:Du,localize:$u,match:Xu,options:{weekStartsOn:1,firstWeekContainsDate:1}},Ku={lessThanXSeconds:{one:"moins d’une seconde",other:"moins de {{count}} secondes"},xSeconds:{one:"1 seconde",other:"{{count}} secondes"},halfAMinute:"30 secondes",lessThanXMinutes:{one:"moins d’une minute",other:"moins de {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"environ 1 heure",other:"environ {{count}} heures"},xHours:{one:"1 heure",other:"{{count}} heures"},xDays:{one:"1 jour",other:"{{count}} jours"},aboutXWeeks:{one:"environ 1 semaine",other:"environ {{count}} semaines"},xWeeks:{one:"1 semaine",other:"{{count}} semaines"},aboutXMonths:{one:"environ 1 mois",other:"environ {{count}} mois"},xMonths:{one:"1 mois",other:"{{count}} mois"},aboutXYears:{one:"environ 1 an",other:"environ {{count}} ans"},xYears:{one:"1 an",other:"{{count}} ans"},overXYears:{one:"plus d’un an",other:"plus de {{count}} ans"},almostXYears:{one:"presqu’un an",other:"presque {{count}} ans"}},Yu=(t,s,a)=>{let r;const n=Ku[t];return typeof n=="string"?r=n:s===1?r=n.one:r=n.other.replace("{{count}}",String(s)),a?.addSuffix?a.comparison&&a.comparison>0?"dans "+r:"il y a "+r:r},Ju={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},Qu={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Zu={full:"{{date}} 'à' {{time}}",long:"{{date}} 'à' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},em={date:Fe({formats:Ju,defaultWidth:"full"}),time:Fe({formats:Qu,defaultWidth:"full"}),dateTime:Fe({formats:Zu,defaultWidth:"full"})},tm={lastWeek:"eeee 'dernier à' p",yesterday:"'hier à' p",today:"'aujourd’hui à' p",tomorrow:"'demain à' p'",nextWeek:"eeee 'prochain à' p",other:"P"},sm=(t,s,a,r)=>tm[t],am={narrow:["av. J.-C","ap. J.-C"],abbreviated:["av. J.-C","ap. J.-C"],wide:["avant Jésus-Christ","après Jésus-Christ"]},rm={narrow:["T1","T2","T3","T4"],abbreviated:["1er trim.","2ème trim.","3ème trim.","4ème trim."],wide:["1er trimestre","2ème trimestre","3ème trimestre","4ème trimestre"]},nm={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],wide:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]},om={narrow:["D","L","M","M","J","V","S"],short:["di","lu","ma","me","je","ve","sa"],abbreviated:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],wide:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},im={narrow:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"mat.",afternoon:"ap.m.",evening:"soir",night:"mat."},abbreviated:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"matin",afternoon:"après-midi",evening:"soir",night:"matin"},wide:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"du matin",afternoon:"de l’après-midi",evening:"du soir",night:"du matin"}},lm=(t,s)=>{const a=Number(t),r=s?.unit;if(a===0)return"0";const n=["year","week","hour","minute","second"];let o;return a===1?o=r&&n.includes(r)?"ère":"er":o="ème",a+o},cm=["MMM","MMMM"],dm={preprocessor:(t,s)=>t.getDate()===1||!s.some(r=>r.isToken&&cm.includes(r.value))?s:s.map(r=>r.isToken&&r.value==="do"?{isToken:!0,value:"d"}:r),ordinalNumber:lm,era:he({values:am,defaultWidth:"wide"}),quarter:he({values:rm,defaultWidth:"wide",argumentCallback:t=>t-1}),month:he({values:nm,defaultWidth:"wide"}),day:he({values:om,defaultWidth:"wide"}),dayPeriod:he({values:im,defaultWidth:"wide"})},um=/^(\d+)(ième|ère|ème|er|e)?/i,mm=/\d+/i,hm={narrow:/^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,abbreviated:/^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,wide:/^(avant Jésus-Christ|après Jésus-Christ)/i},fm={any:[/^av/i,/^ap/i]},pm={narrow:/^T?[1234]/i,abbreviated:/^[1234](er|ème|e)? trim\.?/i,wide:/^[1234](er|ème|e)? trimestre/i},xm={any:[/1/i,/2/i,/3/i,/4/i]},gm={narrow:/^[jfmasond]/i,abbreviated:/^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,wide:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i},bm={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^av/i,/^ma/i,/^juin/i,/^juil/i,/^ao/i,/^s/i,/^o/i,/^n/i,/^d/i]},jm={narrow:/^[lmjvsd]/i,short:/^(di|lu|ma|me|je|ve|sa)/i,abbreviated:/^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,wide:/^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i},vm={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^di/i,/^lu/i,/^ma/i,/^me/i,/^je/i,/^ve/i,/^sa/i]},wm={narrow:/^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,any:/^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i},ym={any:{am:/^a/i,pm:/^p/i,midnight:/^min/i,noon:/^mid/i,morning:/mat/i,afternoon:/ap/i,evening:/soir/i,night:/nuit/i}},Nm={ordinalNumber:as({matchPattern:um,parsePattern:mm,valueCallback:t=>parseInt(t)}),era:fe({matchPatterns:hm,defaultMatchWidth:"wide",parsePatterns:fm,defaultParseWidth:"any"}),quarter:fe({matchPatterns:pm,defaultMatchWidth:"wide",parsePatterns:xm,defaultParseWidth:"any",valueCallback:t=>t+1}),month:fe({matchPatterns:gm,defaultMatchWidth:"wide",parsePatterns:bm,defaultParseWidth:"any"}),day:fe({matchPatterns:jm,defaultMatchWidth:"wide",parsePatterns:vm,defaultParseWidth:"any"}),dayPeriod:fe({matchPatterns:wm,defaultMatchWidth:"any",parsePatterns:ym,defaultParseWidth:"any"})},ps={code:"fr",formatDistance:Yu,formatLong:em,formatRelative:sm,localize:dm,match:Nm,options:{weekStartsOn:1,firstWeekContainsDate:4}},Cm={lessThanXSeconds:{one:"meno di un secondo",other:"meno di {{count}} secondi"},xSeconds:{one:"un secondo",other:"{{count}} secondi"},halfAMinute:"alcuni secondi",lessThanXMinutes:{one:"meno di un minuto",other:"meno di {{count}} minuti"},xMinutes:{one:"un minuto",other:"{{count}} minuti"},aboutXHours:{one:"circa un'ora",other:"circa {{count}} ore"},xHours:{one:"un'ora",other:"{{count}} ore"},xDays:{one:"un giorno",other:"{{count}} giorni"},aboutXWeeks:{one:"circa una settimana",other:"circa {{count}} settimane"},xWeeks:{one:"una settimana",other:"{{count}} settimane"},aboutXMonths:{one:"circa un mese",other:"circa {{count}} mesi"},xMonths:{one:"un mese",other:"{{count}} mesi"},aboutXYears:{one:"circa un anno",other:"circa {{count}} anni"},xYears:{one:"un anno",other:"{{count}} anni"},overXYears:{one:"più di un anno",other:"più di {{count}} anni"},almostXYears:{one:"quasi un anno",other:"quasi {{count}} anni"}},km=(t,s,a)=>{let r;const n=Cm[t];return typeof n=="string"?r=n:s===1?r=n.one:r=n.other.replace("{{count}}",s.toString()),a?.addSuffix?a.comparison&&a.comparison>0?"tra "+r:r+" fa":r},Sm={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},Dm={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Tm={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Am={date:Fe({formats:Sm,defaultWidth:"full"}),time:Fe({formats:Dm,defaultWidth:"full"}),dateTime:Fe({formats:Tm,defaultWidth:"full"})},xr=["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"];function Em(t){switch(t){case 0:return"'domenica scorsa alle' p";default:return"'"+xr[t]+" scorso alle' p"}}function yn(t){return"'"+xr[t]+" alle' p"}function Mm(t){switch(t){case 0:return"'domenica prossima alle' p";default:return"'"+xr[t]+" prossimo alle' p"}}const Pm={lastWeek:(t,s,a)=>{const r=t.getDay();return nr(t,s,a)?yn(r):Em(r)},yesterday:"'ieri alle' p",today:"'oggi alle' p",tomorrow:"'domani alle' p",nextWeek:(t,s,a)=>{const r=t.getDay();return nr(t,s,a)?yn(r):Mm(r)},other:"P"},Rm=(t,s,a,r)=>{const n=Pm[t];return typeof n=="function"?n(s,a,r):n},Fm={narrow:["aC","dC"],abbreviated:["a.C.","d.C."],wide:["avanti Cristo","dopo Cristo"]},$m={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},Lm={narrow:["G","F","M","A","M","G","L","A","S","O","N","D"],abbreviated:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic"],wide:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"]},Im={narrow:["D","L","M","M","G","V","S"],short:["dom","lun","mar","mer","gio","ven","sab"],abbreviated:["dom","lun","mar","mer","gio","ven","sab"],wide:["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"]},Om={narrow:{am:"m.",pm:"p.",midnight:"mezzanotte",noon:"mezzogiorno",morning:"mattina",afternoon:"pomeriggio",evening:"sera",night:"notte"},abbreviated:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"mattina",afternoon:"pomeriggio",evening:"sera",night:"notte"},wide:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"mattina",afternoon:"pomeriggio",evening:"sera",night:"notte"}},zm={narrow:{am:"m.",pm:"p.",midnight:"mezzanotte",noon:"mezzogiorno",morning:"di mattina",afternoon:"del pomeriggio",evening:"di sera",night:"di notte"},abbreviated:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"di mattina",afternoon:"del pomeriggio",evening:"di sera",night:"di notte"},wide:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"di mattina",afternoon:"del pomeriggio",evening:"di sera",night:"di notte"}},_m=(t,s)=>{const a=Number(t);return String(a)},Vm={ordinalNumber:_m,era:he({values:Fm,defaultWidth:"wide"}),quarter:he({values:$m,defaultWidth:"wide",argumentCallback:t=>t-1}),month:he({values:Lm,defaultWidth:"wide"}),day:he({values:Im,defaultWidth:"wide"}),dayPeriod:he({values:Om,defaultWidth:"wide",formattingValues:zm,defaultFormattingWidth:"wide"})},Wm=/^(\d+)(º)?/i,Um=/\d+/i,Bm={narrow:/^(aC|dC)/i,abbreviated:/^(a\.?\s?C\.?|a\.?\s?e\.?\s?v\.?|d\.?\s?C\.?|e\.?\s?v\.?)/i,wide:/^(avanti Cristo|avanti Era Volgare|dopo Cristo|Era Volgare)/i},qm={any:[/^a/i,/^(d|e)/i]},Hm={narrow:/^[1234]/i,abbreviated:/^t[1234]/i,wide:/^[1234](º)? trimestre/i},Gm={any:[/1/i,/2/i,/3/i,/4/i]},Xm={narrow:/^[gfmalsond]/i,abbreviated:/^(gen|feb|mar|apr|mag|giu|lug|ago|set|ott|nov|dic)/i,wide:/^(gennaio|febbraio|marzo|aprile|maggio|giugno|luglio|agosto|settembre|ottobre|novembre|dicembre)/i},Km={narrow:[/^g/i,/^f/i,/^m/i,/^a/i,/^m/i,/^g/i,/^l/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ge/i,/^f/i,/^mar/i,/^ap/i,/^mag/i,/^gi/i,/^l/i,/^ag/i,/^s/i,/^o/i,/^n/i,/^d/i]},Ym={narrow:/^[dlmgvs]/i,short:/^(do|lu|ma|me|gi|ve|sa)/i,abbreviated:/^(dom|lun|mar|mer|gio|ven|sab)/i,wide:/^(domenica|luned[i|ì]|marted[i|ì]|mercoled[i|ì]|gioved[i|ì]|venerd[i|ì]|sabato)/i},Jm={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^g/i,/^v/i,/^s/i],any:[/^d/i,/^l/i,/^ma/i,/^me/i,/^g/i,/^v/i,/^s/i]},Qm={narrow:/^(a|m\.|p|mezzanotte|mezzogiorno|(di|del) (mattina|pomeriggio|sera|notte))/i,any:/^([ap]\.?\s?m\.?|mezzanotte|mezzogiorno|(di|del) (mattina|pomeriggio|sera|notte))/i},Zm={any:{am:/^a/i,pm:/^p/i,midnight:/^mezza/i,noon:/^mezzo/i,morning:/mattina/i,afternoon:/pomeriggio/i,evening:/sera/i,night:/notte/i}},eh={ordinalNumber:as({matchPattern:Wm,parsePattern:Um,valueCallback:t=>parseInt(t,10)}),era:fe({matchPatterns:Bm,defaultMatchWidth:"wide",parsePatterns:qm,defaultParseWidth:"any"}),quarter:fe({matchPatterns:Hm,defaultMatchWidth:"wide",parsePatterns:Gm,defaultParseWidth:"any",valueCallback:t=>t+1}),month:fe({matchPatterns:Xm,defaultMatchWidth:"wide",parsePatterns:Km,defaultParseWidth:"any"}),day:fe({matchPatterns:Ym,defaultMatchWidth:"wide",parsePatterns:Jm,defaultParseWidth:"any"}),dayPeriod:fe({matchPatterns:Qm,defaultMatchWidth:"any",parsePatterns:Zm,defaultParseWidth:"any"})},Lo={code:"it",formatDistance:km,formatLong:Am,formatRelative:Rm,localize:Vm,match:eh,options:{weekStartsOn:1,firstWeekContainsDate:4}},th={lessThanXSeconds:{one:"1秒未満",other:"{{count}}秒未満",oneWithSuffix:"約1秒",otherWithSuffix:"約{{count}}秒"},xSeconds:{one:"1秒",other:"{{count}}秒"},halfAMinute:"30秒",lessThanXMinutes:{one:"1分未満",other:"{{count}}分未満",oneWithSuffix:"約1分",otherWithSuffix:"約{{count}}分"},xMinutes:{one:"1分",other:"{{count}}分"},aboutXHours:{one:"約1時間",other:"約{{count}}時間"},xHours:{one:"1時間",other:"{{count}}時間"},xDays:{one:"1日",other:"{{count}}日"},aboutXWeeks:{one:"約1週間",other:"約{{count}}週間"},xWeeks:{one:"1週間",other:"{{count}}週間"},aboutXMonths:{one:"約1か月",other:"約{{count}}か月"},xMonths:{one:"1か月",other:"{{count}}か月"},aboutXYears:{one:"約1年",other:"約{{count}}年"},xYears:{one:"1年",other:"{{count}}年"},overXYears:{one:"1年以上",other:"{{count}}年以上"},almostXYears:{one:"1年近く",other:"{{count}}年近く"}},sh=(t,s,a)=>{a=a||{};let r;const n=th[t];return typeof n=="string"?r=n:s===1?a.addSuffix&&n.oneWithSuffix?r=n.oneWithSuffix:r=n.one:a.addSuffix&&n.otherWithSuffix?r=n.otherWithSuffix.replace("{{count}}",String(s)):r=n.other.replace("{{count}}",String(s)),a.addSuffix?a.comparison&&a.comparison>0?r+"後":r+"前":r},ah={full:"y年M月d日EEEE",long:"y年M月d日",medium:"y/MM/dd",short:"y/MM/dd"},rh={full:"H時mm分ss秒 zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},nh={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},oh={date:Fe({formats:ah,defaultWidth:"full"}),time:Fe({formats:rh,defaultWidth:"full"}),dateTime:Fe({formats:nh,defaultWidth:"full"})},ih={lastWeek:"先週のeeeeのp",yesterday:"昨日のp",today:"今日のp",tomorrow:"明日のp",nextWeek:"翌週のeeeeのp",other:"P"},lh=(t,s,a,r)=>ih[t],ch={narrow:["BC","AC"],abbreviated:["紀元前","西暦"],wide:["紀元前","西暦"]},dh={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["第1四半期","第2四半期","第3四半期","第4四半期"]},uh={narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]},mh={narrow:["日","月","火","水","木","金","土"],short:["日","月","火","水","木","金","土"],abbreviated:["日","月","火","水","木","金","土"],wide:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"]},hh={narrow:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},abbreviated:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},wide:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"}},fh={narrow:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},abbreviated:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},wide:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"}},ph=(t,s)=>{const a=Number(t);switch(String(s?.unit)){case"year":return`${a}年`;case"quarter":return`第${a}四半期`;case"month":return`${a}月`;case"week":return`第${a}週`;case"date":return`${a}日`;case"hour":return`${a}時`;case"minute":return`${a}分`;case"second":return`${a}秒`;default:return`${a}`}},xh={ordinalNumber:ph,era:he({values:ch,defaultWidth:"wide"}),quarter:he({values:dh,defaultWidth:"wide",argumentCallback:t=>Number(t)-1}),month:he({values:uh,defaultWidth:"wide"}),day:he({values:mh,defaultWidth:"wide"}),dayPeriod:he({values:hh,defaultWidth:"wide",formattingValues:fh,defaultFormattingWidth:"wide"})},gh=/^第?\d+(年|四半期|月|週|日|時|分|秒)?/i,bh=/\d+/i,jh={narrow:/^(B\.?C\.?|A\.?D\.?)/i,abbreviated:/^(紀元[前後]|西暦)/i,wide:/^(紀元[前後]|西暦)/i},vh={narrow:[/^B/i,/^A/i],any:[/^(紀元前)/i,/^(西暦|紀元後)/i]},wh={narrow:/^[1234]/i,abbreviated:/^Q[1234]/i,wide:/^第[1234一二三四1234]四半期/i},yh={any:[/(1|一|1)/i,/(2|二|2)/i,/(3|三|3)/i,/(4|四|4)/i]},Nh={narrow:/^([123456789]|1[012])/,abbreviated:/^([123456789]|1[012])月/i,wide:/^([123456789]|1[012])月/i},Ch={any:[/^1\D/,/^2/,/^3/,/^4/,/^5/,/^6/,/^7/,/^8/,/^9/,/^10/,/^11/,/^12/]},kh={narrow:/^[日月火水木金土]/,short:/^[日月火水木金土]/,abbreviated:/^[日月火水木金土]/,wide:/^[日月火水木金土]曜日/},Sh={any:[/^日/,/^月/,/^火/,/^水/,/^木/,/^金/,/^土/]},Dh={any:/^(AM|PM|午前|午後|正午|深夜|真夜中|夜|朝)/i},Th={any:{am:/^(A|午前)/i,pm:/^(P|午後)/i,midnight:/^深夜|真夜中/i,noon:/^正午/i,morning:/^朝/i,afternoon:/^午後/i,evening:/^夜/i,night:/^深夜/i}},Ah={ordinalNumber:as({matchPattern:gh,parsePattern:bh,valueCallback:function(t){return parseInt(t,10)}}),era:fe({matchPatterns:jh,defaultMatchWidth:"wide",parsePatterns:vh,defaultParseWidth:"any"}),quarter:fe({matchPatterns:wh,defaultMatchWidth:"wide",parsePatterns:yh,defaultParseWidth:"any",valueCallback:t=>t+1}),month:fe({matchPatterns:Nh,defaultMatchWidth:"wide",parsePatterns:Ch,defaultParseWidth:"any"}),day:fe({matchPatterns:kh,defaultMatchWidth:"wide",parsePatterns:Sh,defaultParseWidth:"any"}),dayPeriod:fe({matchPatterns:Dh,defaultMatchWidth:"any",parsePatterns:Th,defaultParseWidth:"any"})},Io={code:"ja",formatDistance:sh,formatLong:oh,formatRelative:lh,localize:xh,match:Ah,options:{weekStartsOn:0,firstWeekContainsDate:1}},Eh={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"aproximadamente 1 hora",other:"aproximadamente {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"aproximadamente 1 semana",other:"aproximadamente {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"aproximadamente 1 mês",other:"aproximadamente {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"aproximadamente 1 ano",other:"aproximadamente {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},Mh=(t,s,a)=>{let r;const n=Eh[t];return typeof n=="string"?r=n:s===1?r=n.one:r=n.other.replace("{{count}}",String(s)),a?.addSuffix?a.comparison&&a.comparison>0?"daqui a "+r:"há "+r:r},Ph={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d 'de' MMM 'de' y",short:"dd/MM/y"},Rh={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Fh={full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},$h={date:Fe({formats:Ph,defaultWidth:"full"}),time:Fe({formats:Rh,defaultWidth:"full"}),dateTime:Fe({formats:Fh,defaultWidth:"full"})},Lh={lastWeek:t=>{const s=t.getDay();return"'"+(s===0||s===6?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},Ih=(t,s,a,r)=>{const n=Lh[t];return typeof n=="function"?n(s):n},Oh={narrow:["aC","dC"],abbreviated:["a.C.","d.C."],wide:["antes de Cristo","depois de Cristo"]},zh={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},_h={narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},Vh={narrow:["d","s","t","q","q","s","s"],short:["dom","seg","ter","qua","qui","sex","sáb"],abbreviated:["dom","seg","ter","qua","qui","sex","sáb"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},Wh={narrow:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"noite",night:"madrugada"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"noite",night:"madrugada"},wide:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"noite",night:"madrugada"}},Uh={narrow:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da noite",night:"da madrugada"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da noite",night:"da madrugada"},wide:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da noite",night:"da madrugada"}},Bh=(t,s)=>Number(t)+"º",qh={ordinalNumber:Bh,era:he({values:Oh,defaultWidth:"wide"}),quarter:he({values:zh,defaultWidth:"wide",argumentCallback:t=>t-1}),month:he({values:_h,defaultWidth:"wide"}),day:he({values:Vh,defaultWidth:"wide"}),dayPeriod:he({values:Wh,defaultWidth:"wide",formattingValues:Uh,defaultFormattingWidth:"wide"})},Hh=/^(\d+)(º|ª)?/i,Gh=/\d+/i,Xh={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes da era comum|depois de cristo|era comum)/i},Kh={any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes da era comum)/i,/^(depois de cristo|era comum)/i]},Yh={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º|ª)? trimestre/i},Jh={any:[/1/i,/2/i,/3/i,/4/i]},Qh={narrow:/^[jfmasond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},Zh={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ab/i,/^mai/i,/^jun/i,/^jul/i,/^ag/i,/^s/i,/^o/i,/^n/i,/^d/i]},ef={narrow:/^[dstq]/i,short:/^(dom|seg|ter|qua|qui|sex|s[áa]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[áa]b)/i,wide:/^(domingo|segunda-?\s?feira|terça-?\s?feira|quarta-?\s?feira|quinta-?\s?feira|sexta-?\s?feira|s[áa]bado)/i},tf={narrow:[/^d/i,/^s/i,/^t/i,/^q/i,/^q/i,/^s/i,/^s/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[áa]/i]},sf={narrow:/^(a|p|meia-?\s?noite|meio-?\s?dia|(da) (manh[ãa]|tarde|noite|madrugada))/i,any:/^([ap]\.?\s?m\.?|meia-?\s?noite|meio-?\s?dia|(da) (manh[ãa]|tarde|noite|madrugada))/i},af={any:{am:/^a/i,pm:/^p/i,midnight:/^meia/i,noon:/^meio/i,morning:/manh[ãa]/i,afternoon:/tarde/i,evening:/noite/i,night:/madrugada/i}},rf={ordinalNumber:as({matchPattern:Hh,parsePattern:Gh,valueCallback:t=>parseInt(t,10)}),era:fe({matchPatterns:Xh,defaultMatchWidth:"wide",parsePatterns:Kh,defaultParseWidth:"any"}),quarter:fe({matchPatterns:Yh,defaultMatchWidth:"wide",parsePatterns:Jh,defaultParseWidth:"any",valueCallback:t=>t+1}),month:fe({matchPatterns:Qh,defaultMatchWidth:"wide",parsePatterns:Zh,defaultParseWidth:"any"}),day:fe({matchPatterns:ef,defaultMatchWidth:"wide",parsePatterns:tf,defaultParseWidth:"any"}),dayPeriod:fe({matchPatterns:sf,defaultMatchWidth:"any",parsePatterns:af,defaultParseWidth:"any"})},Oo={code:"pt",formatDistance:Mh,formatLong:$h,formatRelative:Ih,localize:qh,match:rf,options:{weekStartsOn:1,firstWeekContainsDate:4}},nf={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},of=(t,s,a)=>{let r;const n=nf[t];return typeof n=="string"?r=n:s===1?r=n.one:r=n.other.replace("{{count}}",String(s)),a?.addSuffix?a.comparison&&a.comparison>0?r+"内":r+"前":r},lf={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},cf={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},df={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},uf={date:Fe({formats:lf,defaultWidth:"full"}),time:Fe({formats:cf,defaultWidth:"full"}),dateTime:Fe({formats:df,defaultWidth:"full"})};function Nn(t,s,a){const r="eeee p";return nr(t,s,a)?r:t.getTime()>s.getTime()?"'下个'"+r:"'上个'"+r}const mf={lastWeek:Nn,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:Nn,other:"PP p"},hf=(t,s,a,r)=>{const n=mf[t];return typeof n=="function"?n(s,a,r):n},ff={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},pf={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},xf={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},gf={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},bf={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},jf={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},vf=(t,s)=>{const a=Number(t);switch(s?.unit){case"date":return a.toString()+"日";case"hour":return a.toString()+"时";case"minute":return a.toString()+"分";case"second":return a.toString()+"秒";default:return"第 "+a.toString()}},wf={ordinalNumber:vf,era:he({values:ff,defaultWidth:"wide"}),quarter:he({values:pf,defaultWidth:"wide",argumentCallback:t=>t-1}),month:he({values:xf,defaultWidth:"wide"}),day:he({values:gf,defaultWidth:"wide"}),dayPeriod:he({values:bf,defaultWidth:"wide",formattingValues:jf,defaultFormattingWidth:"wide"})},yf=/^(第\s*)?\d+(日|时|分|秒)?/i,Nf=/\d+/i,Cf={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},kf={any:[/^(前)/i,/^(公元)/i]},Sf={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},Df={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},Tf={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},Af={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},Ef={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},Mf={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},Pf={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},Rf={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},Ff={ordinalNumber:as({matchPattern:yf,parsePattern:Nf,valueCallback:t=>parseInt(t,10)}),era:fe({matchPatterns:Cf,defaultMatchWidth:"wide",parsePatterns:kf,defaultParseWidth:"any"}),quarter:fe({matchPatterns:Sf,defaultMatchWidth:"wide",parsePatterns:Df,defaultParseWidth:"any",valueCallback:t=>t+1}),month:fe({matchPatterns:Tf,defaultMatchWidth:"wide",parsePatterns:Af,defaultParseWidth:"any"}),day:fe({matchPatterns:Ef,defaultMatchWidth:"wide",parsePatterns:Mf,defaultParseWidth:"any"}),dayPeriod:fe({matchPatterns:Pf,defaultMatchWidth:"any",parsePatterns:Rf,defaultParseWidth:"any"})},zo={code:"zh-CN",formatDistance:of,formatLong:uf,formatRelative:hf,localize:wf,match:Ff,options:{weekStartsOn:1,firstWeekContainsDate:4}},$f=(t=ps)=>[{label:"Aujourd'hui",value:()=>new Date},{label:"Hier",value:()=>V.subDays(new Date,1)},{label:"Demain",value:()=>V.addDays(new Date,1)},{label:"Cette semaine",range:()=>({from:V.startOfWeek(new Date,{locale:t}),to:V.endOfWeek(new Date,{locale:t})})},{label:"Semaine dernière",range:()=>({from:V.startOfWeek(V.subWeeks(new Date,1),{locale:t}),to:V.endOfWeek(V.subWeeks(new Date,1),{locale:t})})},{label:"Ce mois",range:()=>({from:V.startOfMonth(new Date),to:V.endOfMonth(new Date)})},{label:"Mois dernier",range:()=>({from:V.startOfMonth(V.subMonths(new Date,1)),to:V.endOfMonth(V.subMonths(new Date,1))})},{label:"Ce trimestre",range:()=>({from:V.startOfQuarter(new Date),to:V.endOfQuarter(new Date)})},{label:"Cette année",range:()=>({from:V.startOfYear(new Date),to:V.endOfYear(new Date)})}],Lf=()=>[{label:"7 derniers jours",range:()=>({from:V.subDays(new Date,7),to:new Date})},{label:"30 derniers jours",range:()=>({from:V.subDays(new Date,30),to:new Date})},{label:"90 derniers jours",range:()=>({from:V.subDays(new Date,90),to:new Date})}],If=t=>t.map(s=>({label:`${s} prochains jours`,range:()=>({from:new Date,to:V.addDays(new Date,s)})})),Of=(t,s)=>{if(typeof s=="function"){const a=s();return"from"in a&&a.from&&a.to?{label:t,range:()=>({from:a.from,to:a.to})}:{label:t,value:s}}return"from"in s&&s.from&&s.to?{label:t,range:{from:s.from,to:s.to}}:{label:t,value:s}},zf=t=>V.isAfter(t,V.endOfDay(new Date)),_o=t=>V.isBefore(t,V.startOfDay(new Date)),_f=t=>{const s=new Date;return t.getDate()===s.getDate()&&t.getMonth()===s.getMonth()&&t.getFullYear()===s.getFullYear()},gr=t=>{const s=t.getDay();return s!==0&&s!==6},Vo=t=>{const s=t.getDay();return s===0||s===6},Wo=(t,s)=>s.some(a=>V.isEqual(V.startOfDay(a),V.startOfDay(t))),Lt=(t,s,a)=>V.isWithinInterval(t,{start:s,end:a}),Vf=t=>s=>{const a=V.subYears(new Date,t);return V.isAfter(s,a)?`L'âge minimum est de ${t} ans`:!0},Wf=t=>s=>{const a=V.subYears(new Date,t);return V.isBefore(s,a)?`L'âge maximum est de ${t} ans`:!0},Uf=t=>_o(t)?"Cette date est expirée":!0,Bf=(t,s)=>({days:V.differenceInDays(s,t),weeks:V.differenceInWeeks(s,t),months:V.differenceInMonths(s,t)}),qf=(t,s="PPP",a=ps)=>t.from?t.to?`${V.format(t.from,s,{locale:a})} - ${V.format(t.to,s,{locale:a})}`:V.format(t.from,s,{locale:a}):"",Hf=t=>[new Date(t,0,1),new Date(t,4,1),new Date(t,4,8),new Date(t,6,14),new Date(t,7,15),new Date(t,10,1),new Date(t,10,11),new Date(t,11,25)],br=(t,s)=>{const a=[],r=V.startOfMonth(new Date(t,s)),n=V.endOfMonth(new Date(t,s));let o=r;for(;V.isBefore(o,n)||V.isEqual(o,n);)a.push(o),o=V.addDays(o,1);return a},Gf=(t,s)=>br(t,s).filter(Vo),Xf=(t,s)=>br(t,s).filter(gr),Kf=()=>t=>{const s=new Date,a=V.endOfMonth(t);if(V.isBefore(a,s))return"La carte est expirée";const r=V.addMonths(s,3);return V.isBefore(a,r)?"La carte expire bientôt":!0},Yf=t=>s=>{const a=V.addDays(new Date,t);return V.isBefore(s,a)?`La réservation doit être faite ${t} jours à l'avance minimum`:!0},Jf=t=>s=>!s.from||!s.to?!0:V.differenceInDays(s.to,s.from)>t?`La période ne peut pas dépasser ${t} jours`:!0,Qf=(t,s)=>V.isEqual(V.startOfDay(t),V.startOfDay(s)),Zf=(t,s,a=[])=>{let r=0,n=V.startOfDay(t);const o=V.startOfDay(s);for(;V.isBefore(n,o)||V.isEqual(n,o);)gr(n)&&!Wo(n,a)&&r++,n=V.addDays(n,1);return r},ep=t=>{const s=t||new Date().getFullYear();return[1,2,3,4].map(a=>{const r=V.startOfQuarter(new Date(s,(a-1)*3,1)),n=V.endOfQuarter(r);return{label:`T${a} ${s}`,range:()=>({from:r,to:n})}})},tp=(t,s=ps)=>{const a=t||new Date().getFullYear();return Array.from({length:12},(r,n)=>{const o=V.startOfMonth(new Date(a,n,1)),i=V.endOfMonth(o);return{label:V.format(o,"MMMM yyyy",{locale:s}),range:()=>({from:o,to:i})}})},sp=t=>t.getTime(),ap=t=>new Date(t),rp=t=>V.startOfDay(t),np=(t,s)=>!t.from||!t.to||!s.from||!s.to?!1:V.isEqual(V.startOfDay(t.from),V.startOfDay(s.from))&&V.isEqual(V.startOfDay(t.to),V.startOfDay(s.to)),op=(t,s)=>!t.from||!t.to||!s.from||!s.to||!(Lt(t.from,s.from,s.to)||Lt(t.to,s.from,s.to)||Lt(s.from,t.from,t.to)||Lt(s.to,t.from,t.to))?null:{from:V.isBefore(t.from,s.from)?t.from:s.from,to:V.isAfter(t.to,s.to)?t.to:s.to},ip=(t,s)=>!t.from||!t.to||!s.from||!s.to?!1:Lt(t.from,s.from,s.to)||Lt(t.to,s.from,s.to)||Lt(s.from,t.from,t.to)||Lt(s.to,t.from,t.to);class jr{constructor(s){this.loadedThemes=new Set,this.styleElements=new Map,this.config={baseUrl:s.baseUrl,cache:s.cache??!0,timeout:s.timeout??1e4,onError:s.onError??(a=>console.error("Theme loading error:",a)),onSuccess:s.onSuccess??(()=>{})}}async loadTheme(s){if(this.config.cache&&this.loadedThemes.has(s)){console.log(`Theme "${s}" already loaded from cache`),this.applyTheme(s);return}try{const a=new AbortController,r=setTimeout(()=>a.abort(),this.config.timeout),n=this.buildThemeUrl(s);console.log(`Loading theme from: ${n}`);const o=await fetch(n,{signal:a.signal,headers:{Accept:"text/css"}});if(clearTimeout(r),!o.ok)throw new Error(`Failed to load theme: ${o.status} ${o.statusText}`);const i=await o.text();if(!i.includes(`[data-theme="${s}"]`))throw new Error(`Invalid theme CSS: missing [data-theme="${s}"] selector`);this.injectThemeStyles(s,i),this.loadedThemes.add(s),this.applyTheme(s),this.config.onSuccess(s)}catch(a){const r=a instanceof Error?a:new Error(String(a));throw this.config.onError(r,s),r}}applyTheme(s){if(typeof document>"u")return;document.documentElement.setAttribute("data-theme",s);try{localStorage.setItem("theme",s)}catch(r){console.warn("Could not save theme to localStorage:",r)}console.log(`Applied theme: ${s}`)}getCurrentTheme(){return typeof document>"u"?null:document.documentElement.getAttribute("data-theme")}loadSavedTheme(){if(typeof window>"u")return null;try{return localStorage.getItem("theme")}catch(s){return console.warn("Could not load theme from localStorage:",s),null}}async preloadThemes(s){console.log(`Preloading ${s.length} themes...`),await Promise.allSettled(s.map(a=>this.loadTheme(a))),console.log(`Preloaded ${this.loadedThemes.size} themes`)}unloadTheme(s){const a=this.styleElements.get(s);a&&(a.remove(),this.styleElements.delete(s)),this.loadedThemes.delete(s),console.log(`Unloaded theme: ${s}`)}clearCache(){this.styleElements.forEach(s=>s.remove()),this.styleElements.clear(),this.loadedThemes.clear(),console.log("Theme cache cleared")}getLoadedThemes(){return Array.from(this.loadedThemes)}buildThemeUrl(s){return`${this.config.baseUrl.replace(/\/$/,"")}/${s}.css`}injectThemeStyles(s,a){if(typeof document>"u")return;const r=this.styleElements.get(s);r&&r.remove();const n=document.createElement("style");n.setAttribute("data-theme-name",s),n.textContent=a,document.head.appendChild(n),this.styleElements.set(s,n)}}let Gs=null;function lp(t){return Gs=new jr(t),Gs}function vr(){if(!Gs)throw new Error("ThemeLoader not initialized. Call initThemeLoader() first.");return Gs}async function cp(t){return vr().loadTheme(t)}function dp(t){vr().applyTheme(t)}function up(t){if(typeof window>"u")return{loadTheme:async()=>{},applyTheme:()=>{},currentTheme:null,loadedThemes:[],isLoading:!1};const s=Gs||new jr({baseUrl:t?.baseUrl||"/themes",...t}),[a,r]=c.useState(!1),[n,o]=c.useState(s.getCurrentTheme());return{loadTheme:async u=>{r(!0);try{await s.loadTheme(u),o(u)}finally{r(!1)}},applyTheme:u=>{s.applyTheme(u),o(u)},currentTheme:n,loadedThemes:s.getLoadedThemes(),isLoading:a}}var Cn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mp(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var _a={exports:{}},kn;function hp(){return kn||(kn=1,(function(t){var s=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var a=(function(r){var n=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,o=0,i={},l={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function x(v){return v instanceof u?new u(v.type,x(v.content),v.alias):Array.isArray(v)?v.map(x):v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(x){return Object.prototype.toString.call(x).slice(8,-1)},objId:function(x){return x.__id||Object.defineProperty(x,"__id",{value:++o}),x.__id},clone:function x(v,k){k=k||{};var N,D;switch(l.util.type(v)){case"Object":if(D=l.util.objId(v),k[D])return k[D];N={},k[D]=N;for(var P in v)v.hasOwnProperty(P)&&(N[P]=x(v[P],k));return N;case"Array":return D=l.util.objId(v),k[D]?k[D]:(N=[],k[D]=N,v.forEach(function(R,A){N[A]=x(R,k)}),N);default:return v}},getLanguage:function(x){for(;x;){var v=n.exec(x.className);if(v)return v[1].toLowerCase();x=x.parentElement}return"none"},setLanguage:function(x,v){x.className=x.className.replace(RegExp(n,"gi"),""),x.classList.add("language-"+v)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(N){var x=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(N.stack)||[])[1];if(x){var v=document.getElementsByTagName("script");for(var k in v)if(v[k].src==x)return v[k]}return null}},isActive:function(x,v,k){for(var N="no-"+v;x;){var D=x.classList;if(D.contains(v))return!0;if(D.contains(N))return!1;x=x.parentElement}return!!k}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(x,v){var k=l.util.clone(l.languages[x]);for(var N in v)k[N]=v[N];return k},insertBefore:function(x,v,k,N){N=N||l.languages;var D=N[x],P={};for(var R in D)if(D.hasOwnProperty(R)){if(R==v)for(var A in k)k.hasOwnProperty(A)&&(P[A]=k[A]);k.hasOwnProperty(R)||(P[R]=D[R])}var S=N[x];return N[x]=P,l.languages.DFS(l.languages,function(M,E){E===S&&M!=x&&(this[M]=P)}),P},DFS:function x(v,k,N,D){D=D||{};var P=l.util.objId;for(var R in v)if(v.hasOwnProperty(R)){k.call(v,R,v[R],N||R);var A=v[R],S=l.util.type(A);S==="Object"&&!D[P(A)]?(D[P(A)]=!0,x(A,k,null,D)):S==="Array"&&!D[P(A)]&&(D[P(A)]=!0,x(A,k,R,D))}}},plugins:{},highlightAll:function(x,v){l.highlightAllUnder(document,x,v)},highlightAllUnder:function(x,v,k){var N={callback:k,container:x,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};l.hooks.run("before-highlightall",N),N.elements=Array.prototype.slice.apply(N.container.querySelectorAll(N.selector)),l.hooks.run("before-all-elements-highlight",N);for(var D=0,P;P=N.elements[D++];)l.highlightElement(P,v===!0,N.callback)},highlightElement:function(x,v,k){var N=l.util.getLanguage(x),D=l.languages[N];l.util.setLanguage(x,N);var P=x.parentElement;P&&P.nodeName.toLowerCase()==="pre"&&l.util.setLanguage(P,N);var R=x.textContent,A={element:x,language:N,grammar:D,code:R};function S(E){A.highlightedCode=E,l.hooks.run("before-insert",A),A.element.innerHTML=A.highlightedCode,l.hooks.run("after-highlight",A),l.hooks.run("complete",A),k&&k.call(A.element)}if(l.hooks.run("before-sanity-check",A),P=A.element.parentElement,P&&P.nodeName.toLowerCase()==="pre"&&!P.hasAttribute("tabindex")&&P.setAttribute("tabindex","0"),!A.code){l.hooks.run("complete",A),k&&k.call(A.element);return}if(l.hooks.run("before-highlight",A),!A.grammar){S(l.util.encode(A.code));return}if(v&&r.Worker){var M=new Worker(l.filename);M.onmessage=function(E){S(E.data)},M.postMessage(JSON.stringify({language:A.language,code:A.code,immediateClose:!0}))}else S(l.highlight(A.code,A.grammar,A.language))},highlight:function(x,v,k){var N={code:x,grammar:v,language:k};if(l.hooks.run("before-tokenize",N),!N.grammar)throw new Error('The language "'+N.language+'" has no grammar.');return N.tokens=l.tokenize(N.code,N.grammar),l.hooks.run("after-tokenize",N),u.stringify(l.util.encode(N.tokens),N.language)},tokenize:function(x,v){var k=v.rest;if(k){for(var N in k)v[N]=k[N];delete v.rest}var D=new m;return p(D,D.head,x),f(x,D,v,D.head,0),C(D)},hooks:{all:{},add:function(x,v){var k=l.hooks.all;k[x]=k[x]||[],k[x].push(v)},run:function(x,v){var k=l.hooks.all[x];if(!(!k||!k.length))for(var N=0,D;D=k[N++];)D(v)}},Token:u};r.Prism=l;function u(x,v,k,N){this.type=x,this.content=v,this.alias=k,this.length=(N||"").length|0}u.stringify=function x(v,k){if(typeof v=="string")return v;if(Array.isArray(v)){var N="";return v.forEach(function(S){N+=x(S,k)}),N}var D={type:v.type,content:x(v.content,k),tag:"span",classes:["token",v.type],attributes:{},language:k},P=v.alias;P&&(Array.isArray(P)?Array.prototype.push.apply(D.classes,P):D.classes.push(P)),l.hooks.run("wrap",D);var R="";for(var A in D.attributes)R+=" "+A+'="'+(D.attributes[A]||"").replace(/"/g,"&quot;")+'"';return"<"+D.tag+' class="'+D.classes.join(" ")+'"'+R+">"+D.content+"</"+D.tag+">"};function d(x,v,k,N){x.lastIndex=v;var D=x.exec(k);if(D&&N&&D[1]){var P=D[1].length;D.index+=P,D[0]=D[0].slice(P)}return D}function f(x,v,k,N,D,P){for(var R in k)if(!(!k.hasOwnProperty(R)||!k[R])){var A=k[R];A=Array.isArray(A)?A:[A];for(var S=0;S<A.length;++S){if(P&&P.cause==R+","+S)return;var M=A[S],E=M.inside,T=!!M.lookbehind,K=!!M.greedy,q=M.alias;if(K&&!M.pattern.global){var B=M.pattern.toString().match(/[imsuy]*$/)[0];M.pattern=RegExp(M.pattern.source,B+"g")}for(var W=M.pattern||M,I=N.next,z=D;I!==v.tail&&!(P&&z>=P.reach);z+=I.value.length,I=I.next){var $=I.value;if(v.length>x.length)return;if(!($ instanceof u)){var _=1,F;if(K){if(F=d(W,z,x,T),!F||F.index>=x.length)break;var ne=F.index,H=F.index+F[0].length,J=z;for(J+=I.value.length;ne>=J;)I=I.next,J+=I.value.length;if(J-=I.value.length,z=J,I.value instanceof u)continue;for(var Q=I;Q!==v.tail&&(J<H||typeof Q.value=="string");Q=Q.next)_++,J+=Q.value.length;_--,$=x.slice(z,J),F.index-=z}else if(F=d(W,0,$,T),!F)continue;var ne=F.index,X=F[0],Y=$.slice(0,ne),U=$.slice(ne+X.length),ae=z+$.length;P&&ae>P.reach&&(P.reach=ae);var te=I.prev;Y&&(te=p(v,te,Y),z+=Y.length),w(v,te,_);var Z=new u(R,E?l.tokenize(X,E):X,q,X);if(I=p(v,te,Z),U&&p(v,I,U),_>1){var le={cause:R+","+S,reach:ae};f(x,v,k,I.prev,z,le),P&&le.reach>P.reach&&(P.reach=le.reach)}}}}}}function m(){var x={value:null,prev:null,next:null},v={value:null,prev:x,next:null};x.next=v,this.head=x,this.tail=v,this.length=0}function p(x,v,k){var N=v.next,D={value:k,prev:v,next:N};return v.next=D,N.prev=D,x.length++,D}function w(x,v,k){for(var N=v.next,D=0;D<k&&N!==x.tail;D++)N=N.next;v.next=N,N.prev=v,x.length-=D}function C(x){for(var v=[],k=x.head.next;k!==x.tail;)v.push(k.value),k=k.next;return v}if(!r.document)return r.addEventListener&&(l.disableWorkerMessageHandler||r.addEventListener("message",function(x){var v=JSON.parse(x.data),k=v.language,N=v.code,D=v.immediateClose;r.postMessage(l.highlight(N,l.languages[k],k)),D&&r.close()},!1)),l;var g=l.util.currentScript();g&&(l.filename=g.src,g.hasAttribute("data-manual")&&(l.manual=!0));function y(){l.manual||l.highlightAll()}if(!l.manual){var j=document.readyState;j==="loading"||j==="interactive"&&g&&g.defer?document.addEventListener("DOMContentLoaded",y):window.requestAnimationFrame?window.requestAnimationFrame(y):window.setTimeout(y,16)}return l})(s);t.exports&&(t.exports=a),typeof Cn<"u"&&(Cn.Prism=a),a.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},a.languages.markup.tag.inside["attr-value"].inside.entity=a.languages.markup.entity,a.languages.markup.doctype.inside["internal-subset"].inside=a.languages.markup,a.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.replace(/&amp;/,"&"))}),Object.defineProperty(a.languages.markup.tag,"addInlined",{value:function(n,o){var i={};i["language-"+o]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:a.languages[o]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var l={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};l["language-"+o]={pattern:/[\s\S]+/,inside:a.languages[o]};var u={};u[n]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return n}),"i"),lookbehind:!0,greedy:!0,inside:l},a.languages.insertBefore("markup","cdata",u)}}),Object.defineProperty(a.languages.markup.tag,"addAttribute",{value:function(r,n){a.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:a.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),a.languages.html=a.languages.markup,a.languages.mathml=a.languages.markup,a.languages.svg=a.languages.markup,a.languages.xml=a.languages.extend("markup",{}),a.languages.ssml=a.languages.xml,a.languages.atom=a.languages.xml,a.languages.rss=a.languages.xml,(function(r){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+n.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var o=r.languages.markup;o&&(o.tag.addInlined("style","css"),o.tag.addAttribute("style","css"))})(a),a.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},a.languages.javascript=a.languages.extend("clike",{"class-name":[a.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),a.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,a.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:a.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:a.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:a.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:a.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:a.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),a.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:a.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),a.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),a.languages.markup&&(a.languages.markup.tag.addInlined("script","javascript"),a.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),a.languages.js=a.languages.javascript,(function(){if(typeof a>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var r="Loading…",n=function(g,y){return"✖ Error "+g+" while fetching file: "+y},o="✖ Error: File does not exist or is empty",i={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},l="data-src-status",u="loading",d="loaded",f="failed",m="pre[data-src]:not(["+l+'="'+d+'"]):not(['+l+'="'+u+'"])';function p(g,y,j){var x=new XMLHttpRequest;x.open("GET",g,!0),x.onreadystatechange=function(){x.readyState==4&&(x.status<400&&x.responseText?y(x.responseText):x.status>=400?j(n(x.status,x.statusText)):j(o))},x.send(null)}function w(g){var y=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(g||"");if(y){var j=Number(y[1]),x=y[2],v=y[3];return x?v?[j,Number(v)]:[j,void 0]:[j,j]}}a.hooks.add("before-highlightall",function(g){g.selector+=", "+m}),a.hooks.add("before-sanity-check",function(g){var y=g.element;if(y.matches(m)){g.code="",y.setAttribute(l,u);var j=y.appendChild(document.createElement("CODE"));j.textContent=r;var x=y.getAttribute("data-src"),v=g.language;if(v==="none"){var k=(/\.(\w+)$/.exec(x)||[,"none"])[1];v=i[k]||k}a.util.setLanguage(j,v),a.util.setLanguage(y,v);var N=a.plugins.autoloader;N&&N.loadLanguages(v),p(x,function(D){y.setAttribute(l,d);var P=w(y.getAttribute("data-range"));if(P){var R=D.split(/\r\n?|\n/g),A=P[0],S=P[1]==null?R.length:P[1];A<0&&(A+=R.length),A=Math.max(0,Math.min(A-1,R.length)),S<0&&(S+=R.length),S=Math.max(0,Math.min(S,R.length)),D=R.slice(A,S).join(`
2
- `),y.hasAttribute("data-start")||y.setAttribute("data-start",String(A+1))}j.textContent=D,a.highlightElement(j)},function(D){y.setAttribute(l,f),j.textContent=D})}}),a.plugins.fileHighlight={highlight:function(y){for(var j=(y||document).querySelectorAll(m),x=0,v;v=j[x++];)a.highlightElement(v)}};var C=!1;a.fileHighlight=function(){C||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),C=!0),a.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(_a)),_a.exports}var fp=hp();const Va=mp(fp);var Sn={},Dn;function pp(){return Dn||(Dn=1,(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var s=t.languages.extend("typescript",{});delete s["class-name"],t.languages.typescript["class-name"].inside=s,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:s}}}}),t.languages.ts=t.languages.typescript})(Prism)),Sn}pp();Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;(function(t){var s=t.util.clone(t.languages.javascript),a=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,r=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,n=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function o(u,d){return u=u.replace(/<S>/g,function(){return a}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return n}),RegExp(u,d)}n=o(n).source,t.languages.jsx=t.languages.extend("markup",s),t.languages.jsx.tag.pattern=o(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),t.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,t.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,t.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,t.languages.jsx.tag.inside.comment=s.comment,t.languages.insertBefore("inside","attr-name",{spread:{pattern:o(/<SPREAD>/.source),inside:t.languages.jsx}},t.languages.jsx.tag),t.languages.insertBefore("inside","special-attr",{script:{pattern:o(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:t.languages.jsx}}},t.languages.jsx.tag);var i=function(u){return u?typeof u=="string"?u:typeof u.content=="string"?u.content:u.content.map(i).join(""):""},l=function(u){for(var d=[],f=0;f<u.length;f++){var m=u[f],p=!1;if(typeof m!="string"&&(m.type==="tag"&&m.content[0]&&m.content[0].type==="tag"?m.content[0].content[0].content==="</"?d.length>0&&d[d.length-1].tagName===i(m.content[0].content[1])&&d.pop():m.content[m.content.length-1].content==="/>"||d.push({tagName:i(m.content[0].content[1]),openedBraces:0}):d.length>0&&m.type==="punctuation"&&m.content==="{"?d[d.length-1].openedBraces++:d.length>0&&d[d.length-1].openedBraces>0&&m.type==="punctuation"&&m.content==="}"?d[d.length-1].openedBraces--:p=!0),(p||typeof m=="string")&&d.length>0&&d[d.length-1].openedBraces===0){var w=i(m);f<u.length-1&&(typeof u[f+1]=="string"||u[f+1].type==="plain-text")&&(w+=i(u[f+1]),u.splice(f+1,1)),f>0&&(typeof u[f-1]=="string"||u[f-1].type==="plain-text")&&(w=i(u[f-1])+w,u.splice(f-1,1),f--),u[f]=new t.Token("plain-text",w,null,w)}m.content&&typeof m.content!="string"&&l(m.content)}};t.hooks.add("after-tokenize",function(u){u.language!=="jsx"&&u.language!=="tsx"||l(u.tokens)})})(Prism);(function(t){var s=t.util.clone(t.languages.typescript);t.languages.tsx=t.languages.extend("jsx",s),delete t.languages.tsx.parameter,delete t.languages.tsx["literal-property"];var a=t.languages.tsx.tag;a.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+a.pattern.source+")",a.pattern.flags),a.lookbehind=!0})(Prism);(function(t){var s=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+s.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+s.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+s.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+s.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:s,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var a=t.languages.markup;a&&(a.tag.addInlined("style","css"),a.tag.addAttribute("style","css"))})(Prism);var Tn={},An;function xp(){return An||(An=1,Prism.languages.scss=Prism.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),Prism.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),Prism.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),Prism.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),Prism.languages.scss.atrule.inside.rest=Prism.languages.scss),Tn}xp();Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;(function(t){var s="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",a={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:a,environment:{pattern:RegExp("\\$"+s),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+s),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+s),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:a}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+s),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},a.inside=t.languages.bash;for(var n=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=r.variable[1].inside,i=0;i<n.length;i++)o[n[i]]=t.languages.bash[n[i]];t.languages.sh=t.languages.bash,t.languages.shell=t.languages.bash})(Prism);var En={},Mn;function gp(){return Mn||(Mn=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),En}gp();var Pn={},Rn;function bp(){return Rn||(Rn=1,(function(t){var s=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,a=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,r={pattern:RegExp(/(^|[^\w.])/.source+a+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(/(^|[^\w.])/.source+a+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:r.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+a+/[A-Z]\w*\b/.source),lookbehind:!0,inside:r.inside}],keyword:s,function:[t.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:s,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+a+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+a+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return s.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism)),Pn}bp();var Fn={},$n;function jp(){return $n||($n=1,(function(t){function s(z,$){return z.replace(/<<(\d+)>>/g,function(_,F){return"(?:"+$[+F]+")"})}function a(z,$,_){return RegExp(s(z,$),"")}function r(z,$){for(var _=0;_<$;_++)z=z.replace(/<<self>>/g,function(){return"(?:"+z+")"});return z.replace(/<<self>>/g,"[^\\s\\S]")}var n={type:"bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",typeDeclaration:"class enum interface record struct",contextual:"add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",other:"abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"};function o(z){return"\\b(?:"+z.trim().replace(/ /g,"|")+")\\b"}var i=o(n.typeDeclaration),l=RegExp(o(n.type+" "+n.typeDeclaration+" "+n.contextual+" "+n.other)),u=o(n.typeDeclaration+" "+n.contextual+" "+n.other),d=o(n.type+" "+n.typeDeclaration+" "+n.other),f=r(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source,2),m=r(/\((?:[^()]|<<self>>)*\)/.source,2),p=/@?\b[A-Za-z_]\w*\b/.source,w=s(/<<0>>(?:\s*<<1>>)?/.source,[p,f]),C=s(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[u,w]),g=/\[\s*(?:,\s*)*\]/.source,y=s(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[C,g]),j=s(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[f,m,g]),x=s(/\(<<0>>+(?:,<<0>>+)+\)/.source,[j]),v=s(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[x,C,g]),k={keyword:l,punctuation:/[<>()?,.:[\]]/},N=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,D=/"(?:\\.|[^\\"\r\n])*"/.source,P=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;t.languages.csharp=t.languages.extend("clike",{string:[{pattern:a(/(^|[^$\\])<<0>>/.source,[P]),lookbehind:!0,greedy:!0},{pattern:a(/(^|[^@$\\])<<0>>/.source,[D]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:a(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[C]),lookbehind:!0,inside:k},{pattern:a(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[p,v]),lookbehind:!0,inside:k},{pattern:a(/(\busing\s+)<<0>>(?=\s*=)/.source,[p]),lookbehind:!0},{pattern:a(/(\b<<0>>\s+)<<1>>/.source,[i,w]),lookbehind:!0,inside:k},{pattern:a(/(\bcatch\s*\(\s*)<<0>>/.source,[C]),lookbehind:!0,inside:k},{pattern:a(/(\bwhere\s+)<<0>>/.source,[p]),lookbehind:!0},{pattern:a(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[y]),lookbehind:!0,inside:k},{pattern:a(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[v,d,p]),inside:k}],keyword:l,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),t.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),t.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:a(/([(,]\s*)<<0>>(?=\s*:)/.source,[p]),lookbehind:!0,alias:"punctuation"}}),t.languages.insertBefore("csharp","class-name",{namespace:{pattern:a(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[p]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:a(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[m]),lookbehind:!0,alias:"class-name",inside:k},"return-type":{pattern:a(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[v,C]),inside:k,alias:"class-name"},"constructor-invocation":{pattern:a(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[v]),lookbehind:!0,inside:k,alias:"class-name"},"generic-method":{pattern:a(/<<0>>\s*<<1>>(?=\s*\()/.source,[p,f]),inside:{function:a(/^<<0>>/.source,[p]),generic:{pattern:RegExp(f),alias:"class-name",inside:k}}},"type-list":{pattern:a(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,[i,w,p,v,l.source,m,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:a(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[w,m]),lookbehind:!0,greedy:!0,inside:t.languages.csharp},keyword:l,"class-name":{pattern:RegExp(v),greedy:!0,inside:k},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var R=D+"|"+N,A=s(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[R]),S=r(s(/[^"'/()]|<<0>>|\(<<self>>*\)/.source,[A]),2),M=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,E=s(/<<0>>(?:\s*\(<<1>>*\))?/.source,[C,S]);t.languages.insertBefore("csharp","class-name",{attribute:{pattern:a(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[M,E]),lookbehind:!0,greedy:!0,inside:{target:{pattern:a(/^<<0>>(?=\s*:)/.source,[M]),alias:"keyword"},"attribute-arguments":{pattern:a(/\(<<0>>*\)/.source,[S]),inside:t.languages.csharp},"class-name":{pattern:RegExp(C),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var T=/:[^}\r\n]+/.source,K=r(s(/[^"'/()]|<<0>>|\(<<self>>*\)/.source,[A]),2),q=s(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[K,T]),B=r(s(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source,[R]),2),W=s(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[B,T]);function I(z,$){return{interpolation:{pattern:a(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[z]),lookbehind:!0,inside:{"format-string":{pattern:a(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[$,T]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:t.languages.csharp}}},string:/[\s\S]+/}}t.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:a(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[q]),lookbehind:!0,greedy:!0,inside:I(q,K)},{pattern:a(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[W]),lookbehind:!0,greedy:!0,inside:I(W,B)}],char:{pattern:RegExp(N),greedy:!0}}),t.languages.dotnet=t.languages.cs=t.languages.csharp})(Prism)),Fn}jp();var Ln={},In;function vp(){return In||(In=1,(function(t){var s=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,a=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],r=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,n=/<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,o=/[{}\[\](),:;]/;t.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:s,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:a,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:r,operator:n,punctuation:o};var i={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:t.languages.php},l=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:i}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:i}}];t.languages.insertBefore("php","variable",{string:l,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:s,string:l,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:a,number:r,operator:n,punctuation:o}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),t.hooks.add("before-tokenize",function(u){if(/<\?/.test(u.code)){var d=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;t.languages["markup-templating"].buildPlaceholders(u,"php",d)}}),t.hooks.add("after-tokenize",function(u){t.languages["markup-templating"].tokenizePlaceholders(u,"php")})})(Prism)),Ln}vp();var On={},zn;function wp(){return zn||(zn=1,(function(t){t.languages.ruby=t.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),t.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var s={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:t.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete t.languages.ruby.function;var a="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",r=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;t.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+a+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:s,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:s,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+r),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+r+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),t.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+a),greedy:!0,inside:{interpolation:s,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:s,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:s,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+a),greedy:!0,inside:{interpolation:s,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:s,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete t.languages.ruby.string,t.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),t.languages.rb=t.languages.ruby})(Prism)),On}wp();Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/});Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}});delete Prism.languages.go["class-name"];var _n={},Vn;function yp(){return Vn||(Vn=1,(function(t){for(var s=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,a=0;a<2;a++)s=s.replace(/<self>/g,function(){return s});s=s.replace(/<self>/g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+s),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string})(Prism)),_n}yp();Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};(function(t){var s=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function a(f){return f=f.replace(/<inner>/g,function(){return s}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+f+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,n=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return r}),o=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+n+o+"(?:"+n+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+n+o+")(?:"+n+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+n+")"+o+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+n+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:a(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:a(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:a(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:a(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(f){["url","bold","italic","strike","code-snippet"].forEach(function(m){f!==m&&(t.languages.markdown[f].inside.content.inside[m]=t.languages.markdown[m])})}),t.hooks.add("after-tokenize",function(f){if(f.language!=="markdown"&&f.language!=="md")return;function m(p){if(!(!p||typeof p=="string"))for(var w=0,C=p.length;w<C;w++){var g=p[w];if(g.type!=="code"){m(g.content);continue}var y=g.content[1],j=g.content[3];if(y&&j&&y.type==="code-language"&&j.type==="code-block"&&typeof y.content=="string"){var x=y.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");x=(/[a-z][\w-]*/i.exec(x)||[""])[0].toLowerCase();var v="language-"+x;j.alias?typeof j.alias=="string"?j.alias=[j.alias,v]:j.alias.push(v):j.alias=[v]}}}m(f.tokens)}),t.hooks.add("wrap",function(f){if(f.type==="code-block"){for(var m="",p=0,w=f.classes.length;p<w;p++){var C=f.classes[p],g=/language-(.+)/.exec(C);if(g){m=g[1];break}}var y=t.languages[m];if(y)f.content=t.highlight(d(f.content),y,m);else if(m&&m!=="none"&&t.plugins.autoloader){var j="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);f.attributes.id=j,t.plugins.autoloader.loadLanguages(m,function(){var x=document.getElementById(j);x&&(x.innerHTML=t.highlight(x.textContent,t.languages[m],m))})}}});var i=RegExp(t.languages.markup.tag.pattern.source,"gi"),l={amp:"&",lt:"<",gt:">",quot:'"'},u=String.fromCodePoint||String.fromCharCode;function d(f){var m=f.replace(i,"");return m=m.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(p,w){if(w=w.toLowerCase(),w[0]==="#"){var C;return w[1]==="x"?C=parseInt(w.slice(2),16):C=Number(w.slice(1)),u(C)}else{var g=l[w];return g||p}}),m}t.languages.md=t.languages.markdown})(Prism);(function(t){var s=/[*&][^\s[\]{},]+/,a=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+a.source+"(?:[ ]+"+s.source+")?|"+s.source+"(?:[ ]+"+a.source+")?)",n=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),o=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function i(l,u){u=(u||"").replace(/m/g,"")+"m";var d=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return l});return RegExp(d,u)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return r})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return"(?:"+n+"|"+o+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:i(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:i(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:i(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:i(o),lookbehind:!0,greedy:!0},number:{pattern:i(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:a,important:s,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml})(Prism);(function(t){var s=/\\[\r\n](?:\s|\\[\r\n]|#.*(?!.))*(?![\s#]|\\[\r\n])/.source,a=/(?:[ \t]+(?![ \t])(?:<SP_BS>)?|<SP_BS>)/.source.replace(/<SP_BS>/g,function(){return s}),r=/"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"|'(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'/.source,n=/--[\w-]+=(?:<STR>|(?!["'])(?:[^\s\\]|\\.)+)/.source.replace(/<STR>/g,function(){return r}),o={pattern:RegExp(r),greedy:!0},i={pattern:/(^[ \t]*)#.*/m,lookbehind:!0,greedy:!0};function l(u,d){return u=u.replace(/<OPT>/g,function(){return n}).replace(/<SP>/g,function(){return a}),RegExp(u,d)}t.languages.docker={instruction:{pattern:/(^[ \t]*)(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)(?=\s)(?:\\.|[^\r\n\\])*(?:\\$(?:\s|#.*$)*(?![\s#])(?:\\.|[^\r\n\\])*)*/im,lookbehind:!0,greedy:!0,inside:{options:{pattern:l(/(^(?:ONBUILD<SP>)?\w+<SP>)<OPT>(?:<SP><OPT>)*/.source,"i"),lookbehind:!0,greedy:!0,inside:{property:{pattern:/(^|\s)--[\w-]+/,lookbehind:!0},string:[o,{pattern:/(=)(?!["'])(?:[^\s\\]|\\.)+/,lookbehind:!0}],operator:/\\$/m,punctuation:/=/}},keyword:[{pattern:l(/(^(?:ONBUILD<SP>)?HEALTHCHECK<SP>(?:<OPT><SP>)*)(?:CMD|NONE)\b/.source,"i"),lookbehind:!0,greedy:!0},{pattern:l(/(^(?:ONBUILD<SP>)?FROM<SP>(?:<OPT><SP>)*(?!--)[^ \t\\]+<SP>)AS/.source,"i"),lookbehind:!0,greedy:!0},{pattern:l(/(^ONBUILD<SP>)\w+/.source,"i"),lookbehind:!0,greedy:!0},{pattern:/^\w+/,greedy:!0}],comment:i,string:o,variable:/\$(?:\w+|\{[^{}"'\\]*\})/,operator:/\\$/m}},comment:i},t.languages.dockerfile=t.languages.docker})(Prism);Prism.languages.git={comment:/^#.*/m,deleted:/^[-–].*/m,inserted:/^\+.*/m,string:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s--?\w+/}},coord:/^@@.*@@$/m,"commit-sha1":/^commit \w{40}$/m};const Wn=Xe.cva("relative rounded font-mono",{variants:{variant:{inline:"bg-muted px-[0.3rem] py-[0.2rem] text-xs sm:text-sm",block:"block bg-muted overflow-x-auto"},size:{sm:"text-xs sm:text-sm",base:"text-sm sm:text-base",lg:"text-base sm:text-lg"}},defaultVariants:{variant:"inline",size:"base"}}),Uo=c.forwardRef(({className:t,variant:s,size:a,language:r,showLineNumbers:n=!1,maxHeight:o,copyable:i=!1,filename:l,theme:u="auto",children:d,...f},m)=>{const[p,w]=c.useState(!1),[C,g]=c.useState("");c.useRef(null),c.useEffect(()=>{if(s==="block"&&r&&d)try{const j=typeof d=="string"?d:String(d),x=Va.highlight(j,Va.languages[r]||Va.languages.text,r);g(x)}catch(j){console.warn(`Failed to highlight code for language: ${r}`,j),g(String(d))}else g(String(d))},[r,d,s]);const y=async()=>{if(typeof d=="string")try{await navigator.clipboard.writeText(d),w(!0),setTimeout(()=>w(!1),2e3)}catch(j){console.error("Failed to copy code:",j)}};return s==="block"?e.jsxs("div",{className:"relative my-4 sm:my-6",children:[(l||i)&&e.jsxs("div",{className:"flex items-center justify-between bg-muted/50 px-3 sm:px-4 py-2 sm:py-3 rounded-t-lg border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[l&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs sm:text-sm text-muted-foreground",children:[e.jsx(h.FileText,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"font-medium",children:l})]}),r&&!l&&e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground uppercase font-medium",children:r})]}),i&&e.jsx(L,{variant:"ghost",size:"sm",onClick:y,className:"h-6 w-6 sm:h-7 sm:w-7 p-0 hover:bg-muted-foreground/10",children:p?e.jsx(h.Check,{className:"h-3 w-3 sm:h-4 sm:w-4 text-green-600"}):e.jsx(h.Copy,{className:"h-3 w-3 sm:h-4 sm:w-4"})})]}),e.jsx("div",{className:b("waka-code relative",o&&"overflow-hidden"),style:{maxHeight:o?`${o}px`:void 0},children:e.jsxs("pre",{className:b(Wn({variant:s,size:a}),"p-3 sm:p-4 lg:p-6","text-xs sm:text-sm lg:text-base","leading-relaxed sm:leading-loose","whitespace-pre-wrap break-words","scrollbar-thin scrollbar-thumb-muted-foreground/20 scrollbar-track-transparent","hover:scrollbar-thumb-muted-foreground/30",o&&"overflow-y-auto",!l&&!i&&r&&"rounded-lg",l||i?"rounded-b-lg":"rounded-lg",t),children:[n&&e.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-8 sm:w-10 lg:w-12 bg-muted/30 border-r border-border/50 flex flex-col text-xs sm:text-sm text-muted-foreground select-none",children:String(d).split(`
3
- `).map((j,x)=>e.jsx("div",{className:"flex items-center justify-center h-5 sm:h-6 lg:h-7",children:x+1},x))}),e.jsx("code",{ref:m,className:b("block",n&&"ml-8 sm:ml-10 lg:ml-12",r&&"language-"+r),...f,dangerouslySetInnerHTML:s==="block"&&r?{__html:C}:void 0,children:s==="block"&&r?void 0:d})]})}),r&&!l&&!i&&e.jsx("div",{className:"absolute top-2 right-2 text-xs text-muted-foreground/70 bg-background/80 px-2 py-1 rounded uppercase font-medium",children:r})]}):e.jsx("code",{className:b(Wn({variant:s,size:a}),t),ref:m,...f,children:d})});Uo.displayName="Code";const Bo=dr.Root,qo=dr.CollapsibleTrigger,Ho=dr.CollapsibleContent,It=ue.Root,Np=ue.Trigger,Go=ue.Portal,Xo=ue.Close,wr=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Overlay,{ref:a,className:b("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s}));wr.displayName=ue.Overlay.displayName;const Tt=c.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(Go,{children:[e.jsx(wr,{}),e.jsxs(ue.Content,{ref:r,className:b("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...a,children:[s,e.jsxs(ue.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(h.X,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Tt.displayName=ue.Content.displayName;const Ht=({className:t,...s})=>e.jsx("div",{className:b("flex flex-col space-y-1.5 text-center sm:text-left",t),...s});Ht.displayName="DialogHeader";const Gt=({className:t,...s})=>e.jsx("div",{className:b("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});Gt.displayName="DialogFooter";const Xt=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Title,{ref:a,className:b("text-lg font-semibold leading-none tracking-tight",t),...s}));Xt.displayName=ue.Title.displayName;const Cs=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Description,{ref:a,className:b("text-sm text-muted-foreground",t),...s}));Cs.displayName=ue.Description.displayName;const ss=c.forwardRef(({className:t,...s},a)=>e.jsx(dt.Command,{ref:a,className:b("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...s}));ss.displayName=dt.Command.displayName;const Cp=({children:t,...s})=>e.jsx(It,{...s,children:e.jsx(Tt,{className:"overflow-hidden p-0 shadow-lg",children:e.jsx(ss,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:t})})}),xs=c.forwardRef(({className:t,...s},a)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(h.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(dt.Command.Input,{ref:a,className:b("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...s})]}));xs.displayName=dt.Command.Input.displayName;const ea=c.forwardRef(({className:t,...s},a)=>e.jsx(dt.Command.List,{ref:a,className:b("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...s}));ea.displayName=dt.Command.List.displayName;const gs=c.forwardRef((t,s)=>e.jsx(dt.Command.Empty,{ref:s,className:"py-6 text-center text-sm",...t}));gs.displayName=dt.Command.Empty.displayName;const Ot=c.forwardRef(({className:t,...s},a)=>e.jsx(dt.Command.Group,{ref:a,className:b("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...s}));Ot.displayName=dt.Command.Group.displayName;const ja=c.forwardRef(({className:t,...s},a)=>e.jsx(dt.Command.Separator,{ref:a,className:b("-mx-1 h-px bg-border",t),...s}));ja.displayName=dt.Command.Separator.displayName;const zt=c.forwardRef(({className:t,...s},a)=>e.jsx(dt.Command.Item,{ref:a,className:b("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...s}));zt.displayName=dt.Command.Item.displayName;const Ko=({className:t,...s})=>e.jsx("span",{className:b("ml-auto text-xs tracking-widest text-muted-foreground",t),...s});Ko.displayName="CommandShortcut";const Yo=Me.Root,Jo=Me.Trigger,kp=Me.Group,Sp=Me.Portal,Dp=Me.Sub,Tp=Me.RadioGroup,Qo=c.forwardRef(({className:t,inset:s,children:a,...r},n)=>e.jsxs(Me.SubTrigger,{ref:n,className:b("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",s&&"pl-8",t),...r,children:[a,e.jsx(h.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Qo.displayName=Me.SubTrigger.displayName;const Zo=c.forwardRef(({className:t,...s},a)=>e.jsx(Me.SubContent,{ref:a,className:b("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s}));Zo.displayName=Me.SubContent.displayName;const yr=c.forwardRef(({className:t,...s},a)=>e.jsx(Me.Portal,{children:e.jsx(Me.Content,{ref:a,className:b("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s})}));yr.displayName=Me.Content.displayName;const Ft=c.forwardRef(({className:t,inset:s,...a},r)=>e.jsx(Me.Item,{ref:r,className:b("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s&&"pl-8",t),...a}));Ft.displayName=Me.Item.displayName;const ei=c.forwardRef(({className:t,children:s,checked:a,...r},n)=>e.jsxs(Me.CheckboxItem,{ref:n,className:b("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:a,...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Me.ItemIndicator,{children:e.jsx(h.Check,{className:"h-4 w-4"})})}),s]}));ei.displayName=Me.CheckboxItem.displayName;const ti=c.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(Me.RadioItem,{ref:r,className:b("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Me.ItemIndicator,{children:e.jsx(h.Circle,{className:"h-2 w-2 fill-current"})})}),s]}));ti.displayName=Me.RadioItem.displayName;const si=c.forwardRef(({className:t,inset:s,...a},r)=>e.jsx(Me.Label,{ref:r,className:b("px-2 py-1.5 text-sm font-semibold text-foreground",s&&"pl-8",t),...a}));si.displayName=Me.Label.displayName;const Vs=c.forwardRef(({className:t,...s},a)=>e.jsx(Me.Separator,{ref:a,className:b("-mx-1 my-1 h-px bg-border",t),...s}));Vs.displayName=Me.Separator.displayName;const ai=({className:t,...s})=>e.jsx("span",{className:b("ml-auto text-xs tracking-widest text-muted-foreground",t),...s});ai.displayName="ContextMenuShortcut";const He=Pe.Root,Ge=Pe.Trigger,Ap=Pe.Group,Ep=Pe.Portal,Mp=Pe.Sub,Pp=Pe.RadioGroup,ri=c.forwardRef(({className:t,inset:s,children:a,...r},n)=>e.jsxs(Pe.SubTrigger,{ref:n,className:b("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",s&&"pl-8",t),...r,children:[a,e.jsx(h.ChevronRight,{className:"ml-auto h-4 w-4"})]}));ri.displayName=Pe.SubTrigger.displayName;const ni=c.forwardRef(({className:t,...s},a)=>e.jsx(Pe.SubContent,{ref:a,className:b("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s}));ni.displayName=Pe.SubContent.displayName;const _e=c.forwardRef(({className:t,sideOffset:s=4,...a},r)=>e.jsx(Pe.Portal,{children:e.jsx(Pe.Content,{ref:r,sideOffset:s,className:b("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a})}));_e.displayName=Pe.Content.displayName;const pe=c.forwardRef(({className:t,inset:s,...a},r)=>e.jsx(Pe.Item,{ref:r,className:b("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s&&"pl-8",t),...a}));pe.displayName=Pe.Item.displayName;const ds=c.forwardRef(({className:t,children:s,checked:a,...r},n)=>e.jsxs(Pe.CheckboxItem,{ref:n,className:b("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:a,...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Pe.ItemIndicator,{children:e.jsx(h.Check,{className:"h-4 w-4"})})}),s]}));ds.displayName=Pe.CheckboxItem.displayName;const oi=c.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(Pe.RadioItem,{ref:r,className:b("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Pe.ItemIndicator,{children:e.jsx(h.Circle,{className:"h-2 w-2 fill-current"})})}),s]}));oi.displayName=Pe.RadioItem.displayName;const ms=c.forwardRef(({className:t,inset:s,...a},r)=>e.jsx(Pe.Label,{ref:r,className:b("px-2 py-1.5 text-sm font-semibold",s&&"pl-8",t),...a}));ms.displayName=Pe.Label.displayName;const Qe=c.forwardRef(({className:t,...s},a)=>e.jsx(Pe.Separator,{ref:a,className:b("-mx-1 my-1 h-px bg-muted",t),...s}));Qe.displayName=Pe.Separator.displayName;const ii=({className:t,...s})=>e.jsx("span",{className:b("ml-auto text-xs tracking-widest opacity-60",t),...s});ii.displayName="DropdownMenuShortcut";var Rp=t=>t.type==="checkbox",zs=t=>t instanceof Date,Nr=t=>t==null;const li=t=>typeof t=="object";var bs=t=>!Nr(t)&&!Array.isArray(t)&&li(t)&&!zs(t),Fp=t=>bs(t)&&t.target?Rp(t.target)?t.target.checked:t.target.value:t,$p=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,Lp=(t,s)=>t.has($p(s)),Ip=t=>{const s=t.constructor&&t.constructor.prototype;return bs(s)&&s.hasOwnProperty("isPrototypeOf")},Op=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ci(t){let s;const a=Array.isArray(t),r=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)s=new Date(t);else if(!(Op&&(t instanceof Blob||r))&&(a||bs(t)))if(s=a?[]:Object.create(Object.getPrototypeOf(t)),!a&&!Ip(t))s=t;else for(const n in t)t.hasOwnProperty(n)&&(s[n]=ci(t[n]));else return t;return s}var di=t=>/^\w*$/.test(t),ir=t=>t===void 0,zp=t=>Array.isArray(t)?t.filter(Boolean):[],ui=t=>zp(t.replace(/["|']|\]/g,"").split(/\.|\[/)),lt=(t,s,a)=>{if(!s||!bs(t))return a;const r=(di(s)?[s]:ui(s)).reduce((n,o)=>Nr(n)?n:n[o],t);return ir(r)||r===t?ir(t[s])?a:t[s]:r},Wa=t=>typeof t=="boolean",Un=(t,s,a)=>{let r=-1;const n=di(s)?[s]:ui(s),o=n.length,i=o-1;for(;++r<o;){const l=n[r];let u=a;if(r!==i){const d=t[l];u=bs(d)||Array.isArray(d)?d:isNaN(+n[r+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;t[l]=u,t=t[l]}};const Bn={BLUR:"blur",CHANGE:"change"},qn={all:"all"},Cr=O.createContext(null);Cr.displayName="HookFormContext";const Sa=()=>O.useContext(Cr),_p=t=>{const{children:s,...a}=t;return O.createElement(Cr.Provider,{value:a},s)};var Vp=(t,s,a,r=!0)=>{const n={defaultValues:s._defaultValues};for(const o in t)Object.defineProperty(n,o,{get:()=>{const i=o;return s._proxyFormState[i]!==qn.all&&(s._proxyFormState[i]=!r||qn.all),a&&(a[i]=!0),t[i]}});return n};const mi=typeof window<"u"?O.useLayoutEffect:O.useEffect;function Wp(t){const s=Sa(),{control:a=s.control,disabled:r,name:n,exact:o}=t||{},[i,l]=O.useState(a._formState),u=O.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return mi(()=>a._subscribe({name:n,formState:u.current,exact:o,callback:d=>{!r&&l({...a._formState,...d})}}),[n,r,o]),O.useEffect(()=>{u.current.isValid&&a._setValid(!0)},[a]),O.useMemo(()=>Vp(i,a,u.current,!1),[i,a])}var Up=t=>typeof t=="string",Hn=(t,s,a,r,n)=>Up(t)?lt(a,t,n):Array.isArray(t)?t.map(o=>lt(a,o)):a,Gn=t=>Nr(t)||!li(t);function fa(t,s,a=new WeakSet){if(Gn(t)||Gn(s))return Object.is(t,s);if(zs(t)&&zs(s))return t.getTime()===s.getTime();const r=Object.keys(t),n=Object.keys(s);if(r.length!==n.length)return!1;if(a.has(t)||a.has(s))return!0;a.add(t),a.add(s);for(const o of r){const i=t[o];if(!n.includes(o))return!1;if(o!=="ref"){const l=s[o];if(zs(i)&&zs(l)||bs(i)&&bs(l)||Array.isArray(i)&&Array.isArray(l)?!fa(i,l,a):!Object.is(i,l))return!1}}return!0}function Bp(t){const s=Sa(),{control:a=s.control,name:r,defaultValue:n,disabled:o,exact:i,compute:l}=t||{},u=O.useRef(n),d=O.useRef(l),f=O.useRef(void 0),m=O.useRef(a),p=O.useRef(r);d.current=l;const[w,C]=O.useState(()=>{const k=a._getWatch(r,u.current);return d.current?d.current(k):k}),g=O.useCallback(k=>{const N=Hn(r,a._names,k||a._formValues,!1,u.current);return d.current?d.current(N):N},[a._formValues,a._names,r]),y=O.useCallback(k=>{if(!o){const N=Hn(r,a._names,k||a._formValues,!1,u.current);if(d.current){const D=d.current(N);fa(D,f.current)||(C(D),f.current=D)}else C(N)}},[a._formValues,a._names,o,r]);mi(()=>((m.current!==a||!fa(p.current,r))&&(m.current=a,p.current=r,y()),a._subscribe({name:r,formState:{values:!0},exact:i,callback:k=>{y(k.values)}})),[a,i,r,y]),O.useEffect(()=>a._removeUnmounted());const j=m.current!==a,x=p.current,v=O.useMemo(()=>{if(o)return null;const k=!j&&!fa(x,r);return j||k?g():null},[o,j,r,x,g]);return v!==null?v:w}function qp(t){const s=Sa(),{name:a,disabled:r,control:n=s.control,shouldUnregister:o,defaultValue:i,exact:l=!0}=t,u=Lp(n._names.array,a),d=O.useMemo(()=>lt(n._formValues,a,lt(n._defaultValues,a,i)),[n,a,i]),f=Bp({control:n,name:a,defaultValue:d,exact:l}),m=Wp({control:n,name:a,exact:l}),p=O.useRef(t),w=O.useRef(void 0),C=O.useRef(n.register(a,{...t.rules,value:f,...Wa(t.disabled)?{disabled:t.disabled}:{}}));p.current=t;const g=O.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!lt(m.errors,a)},isDirty:{enumerable:!0,get:()=>!!lt(m.dirtyFields,a)},isTouched:{enumerable:!0,get:()=>!!lt(m.touchedFields,a)},isValidating:{enumerable:!0,get:()=>!!lt(m.validatingFields,a)},error:{enumerable:!0,get:()=>lt(m.errors,a)}}),[m,a]),y=O.useCallback(k=>C.current.onChange({target:{value:Fp(k),name:a},type:Bn.CHANGE}),[a]),j=O.useCallback(()=>C.current.onBlur({target:{value:lt(n._formValues,a),name:a},type:Bn.BLUR}),[a,n._formValues]),x=O.useCallback(k=>{const N=lt(n._fields,a);N&&k&&(N._f.ref={focus:()=>k.focus&&k.focus(),select:()=>k.select&&k.select(),setCustomValidity:D=>k.setCustomValidity(D),reportValidity:()=>k.reportValidity()})},[n._fields,a]),v=O.useMemo(()=>({name:a,value:f,...Wa(r)||m.disabled?{disabled:m.disabled||r}:{},onChange:y,onBlur:j,ref:x}),[a,r,m.disabled,y,j,x,f]);return O.useEffect(()=>{const k=n._options.shouldUnregister||o,N=w.current;N&&N!==a&&!u&&n.unregister(N),n.register(a,{...p.current.rules,...Wa(p.current.disabled)?{disabled:p.current.disabled}:{}});const D=(P,R)=>{const A=lt(n._fields,P);A&&A._f&&(A._f.mount=R)};if(D(a,!0),k){const P=ci(lt(n._options.defaultValues,a,p.current.defaultValue));Un(n._defaultValues,a,P),ir(lt(n._formValues,a))&&Un(n._formValues,a,P)}return!u&&n.register(a),w.current=a,()=>{(u?k&&!n._state.action:k)?n.unregister(a):D(a,!1)}},[a,n,u,o]),O.useEffect(()=>{n._setDisabledField({disabled:r,name:a})},[r,a,n]),O.useMemo(()=>({field:v,formState:m,fieldState:g}),[v,m,g])}const hi=t=>t.render(qp(t)),Hp=Xe.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),me=c.forwardRef(({className:t,...s},a)=>e.jsx(No.Root,{ref:a,className:b(Hp(),t),...s}));me.displayName=No.Root.displayName;const Gp=_p,fi=c.createContext({}),Xp=({...t})=>e.jsx(fi.Provider,{value:{name:t.name},children:e.jsx(hi,{...t})}),ta=()=>{const t=c.useContext(fi),s=c.useContext(pi),{getFieldState:a,formState:r}=Sa(),n=a(t.name,r);if(!t)throw new Error("useFormField should be used within <FormField>");const{id:o}=s;return{id:o,name:t.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...n}},pi=c.createContext({}),xi=c.forwardRef(({className:t,...s},a)=>{const r=c.useId();return e.jsx(pi.Provider,{value:{id:r},children:e.jsx("div",{ref:a,className:b("space-y-2",t),...s})})});xi.displayName="FormItem";const gi=c.forwardRef(({className:t,...s},a)=>{const{error:r,formItemId:n}=ta();return e.jsx(me,{ref:a,className:b(r&&"text-destructive",t),htmlFor:n,...s})});gi.displayName="FormLabel";const bi=c.forwardRef(({...t},s)=>{const{error:a,formItemId:r,formDescriptionId:n,formMessageId:o}=ta();return e.jsx(Na.Slot,{ref:s,id:r,"aria-describedby":a?`${n} ${o}`:`${n}`,"aria-invalid":!!a,...t})});bi.displayName="FormControl";const ji=c.forwardRef(({className:t,...s},a)=>{const{formDescriptionId:r}=ta();return e.jsx("p",{ref:a,id:r,className:b("text-sm text-muted-foreground",t),...s})});ji.displayName="FormDescription";const vi=c.forwardRef(({className:t,children:s,...a},r)=>{const{error:n,formMessageId:o}=ta(),i=n?String(n?.message):s;return i?e.jsx("p",{ref:r,id:o,className:b("text-sm font-medium text-destructive",t),...a,children:i}):null});vi.displayName="FormMessage";const Kp=Ca.Root,Yp=Ca.Trigger,wi=c.forwardRef(({className:t,align:s="center",sideOffset:a=4,...r},n)=>e.jsx(Ca.Content,{ref:n,align:s,sideOffset:a,className:b("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r}));wi.displayName=Ca.Content.displayName;const yi=c.forwardRef(({length:t=6,value:s="",onChange:a,onComplete:r,pattern:n="numeric",secure:o=!1,disabled:i=!1,className:l,error:u,size:d="md",separator:f,separatorElement:m=e.jsx("span",{className:"text-muted-foreground",children:"-"}),...p},w)=>{const[C,g]=c.useState(s.split("").slice(0,t)),y=c.useRef([]);c.useEffect(()=>{const R=s.split("").slice(0,t);g(R)},[s,t]);const x=(()=>{switch(n){case"numeric":return/^[0-9]$/;case"alpha":return/^[a-zA-Z]$/;case"alphanumeric":return/^[a-zA-Z0-9]$/;default:return/^.$/}})(),v=(R,A)=>{if(i)return;const S=A.slice(-1);if(S&&!x.test(S))return;const M=[...C];M[R]=S,g(M);const E=M.join("");a?.(E),S&&R<t-1&&y.current[R+1]?.focus(),M.every(T=>T!=="")&&M.length===t&&r?.(E)},k=(R,A)=>{if(!i){if(A.key==="Backspace"){A.preventDefault();const S=[...C];S[R]?(S[R]="",g(S),a?.(S.join(""))):R>0&&(S[R-1]="",g(S),a?.(S.join("")),y.current[R-1]?.focus())}if(A.key==="Delete"){A.preventDefault();const S=[...C];S[R]="",g(S),a?.(S.join(""))}A.key==="ArrowLeft"&&R>0&&(A.preventDefault(),y.current[R-1]?.focus()),A.key==="ArrowRight"&&R<t-1&&(A.preventDefault(),y.current[R+1]?.focus()),A.key==="Home"&&(A.preventDefault(),y.current[0]?.focus()),A.key==="End"&&(A.preventDefault(),y.current[t-1]?.focus())}},N=R=>{if(R.preventDefault(),i)return;const S=R.clipboardData.getData("text/plain").split("").filter(T=>x.test(T)).slice(0,t),M=[...C];S.forEach((T,K)=>{M[K]=T}),g(M),a?.(M.join(""));const E=M.findIndex(T=>!T);E!==-1?y.current[E]?.focus():y.current[t-1]?.focus(),M.every(T=>T!=="")&&M.length===t&&r?.(M.join(""))},D=R=>{R.target.select()},P={sm:"h-8 w-8 text-sm",md:"h-12 w-12 text-base",lg:"h-16 w-16 text-lg"}[d];return e.jsxs("div",{ref:w,className:b("flex flex-col gap-2",l),children:[e.jsx("div",{className:"flex items-center gap-2",children:Array.from({length:t}).map((R,A)=>e.jsxs(c.Fragment,{children:[e.jsx("input",{ref:S=>y.current[A]=S,type:o?"password":"text",inputMode:n==="numeric"?"numeric":"text",maxLength:1,value:C[A]||"",onChange:S=>v(A,S.target.value),onKeyDown:S=>k(A,S),onPaste:N,onFocus:D,disabled:i,className:b("flex items-center justify-center rounded-md border border-input bg-background text-center font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50",P,u&&"border-destructive focus-visible:ring-destructive",C[A]&&"border-primary"),"aria-label":`Caractère ${A+1} sur ${t}`,...p}),f&&(A+1)%f===0&&A<t-1&&e.jsx("div",{className:"flex items-center justify-center",children:m})]},A))}),u&&e.jsx("p",{className:"text-sm text-destructive",role:"alert",children:u})]})});yi.displayName="InputOTP";const oe=c.forwardRef(({className:t,type:s,...a},r)=>e.jsx("input",{type:s,className:b("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...a}));oe.displayName="Input";const Ve=ze.Root,Jp=ze.Group,We=ze.Value,$e=c.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(ze.Trigger,{ref:r,className:b("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...a,children:[s,e.jsx(ze.Icon,{asChild:!0,children:e.jsx(h.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));$e.displayName=ze.Trigger.displayName;const kr=c.forwardRef(({className:t,...s},a)=>e.jsx(ze.ScrollUpButton,{ref:a,className:b("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(h.ChevronUp,{className:"h-4 w-4"})}));kr.displayName=ze.ScrollUpButton.displayName;const Sr=c.forwardRef(({className:t,...s},a)=>e.jsx(ze.ScrollDownButton,{ref:a,className:b("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(h.ChevronDown,{className:"h-4 w-4"})}));Sr.displayName=ze.ScrollDownButton.displayName;const Le=c.forwardRef(({className:t,children:s,position:a="popper",...r},n)=>e.jsx(ze.Portal,{children:e.jsxs(ze.Content,{ref:n,className:b("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,...r,children:[e.jsx(kr,{}),e.jsx(ze.Viewport,{className:b("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),e.jsx(Sr,{})]})}));Le.displayName=ze.Content.displayName;const Ni=c.forwardRef(({className:t,...s},a)=>e.jsx(ze.Label,{ref:a,className:b("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...s}));Ni.displayName=ze.Label.displayName;const je=c.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(ze.Item,{ref:r,className:b("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(ze.ItemIndicator,{children:e.jsx(h.Check,{className:"h-4 w-4"})})}),e.jsx(ze.ItemText,{children:s})]}));je.displayName=ze.Item.displayName;const Ci=c.forwardRef(({className:t,...s},a)=>e.jsx(ze.Separator,{ref:a,className:b("-mx-1 my-1 h-px bg-muted",t),...s}));Ci.displayName=ze.Separator.displayName;function Qp({languages:t,value:s,onChange:a,showFlags:r=!0,showLabels:n=!0,variant:o="default",isLoading:i=!1,className:l,placeholder:u="Select language",ariaLabel:d="Select language"}){const[f,m]=c.useState(!1),[p,w]=c.useState(!1),C=c.useRef(null),g=c.useRef(null);c.useEffect(()=>{w(!0)},[]);const y=t.find(N=>N.code===s),j=N=>{a?.(N),m(!1)},[x,v]=c.useState({top:0,left:0});if(c.useEffect(()=>{if(f&&C.current&&p){const N=C.current.getBoundingClientRect();v({top:N.bottom+8,left:N.left})}},[f,p]),o==="default")return e.jsxs(Ve,{value:s,onValueChange:a,disabled:i,children:[e.jsx($e,{className:b("w-[180px]",l),children:e.jsx(We,{placeholder:u,children:y&&e.jsxs("div",{className:"flex items-center gap-2",children:[r&&y.flagEmoji&&e.jsx("span",{className:"text-lg",children:y.flagEmoji}),r&&y.flag&&!y.flagEmoji&&e.jsx("img",{src:y.flag,alt:y.label,className:"h-4 w-6 object-cover rounded"}),!r&&e.jsx(h.Globe,{className:"h-4 w-4 text-muted-foreground"}),n&&e.jsx("span",{children:y.label})]})})}),e.jsx(Le,{children:t.map(N=>e.jsx(je,{value:N.code,children:e.jsxs("div",{className:"flex items-center gap-2",children:[r&&N.flagEmoji&&e.jsx("span",{className:"text-lg",children:N.flagEmoji}),r&&N.flag&&!N.flagEmoji&&e.jsx("img",{src:N.flag,alt:N.label,className:"h-4 w-6 object-cover rounded"}),n&&N.label]})},N.code))})]});if(o==="minimal"){const N=f&&p?e.jsx("div",{ref:g,className:"fixed z-[9999] min-w-[160px] rounded-md border border-border bg-popover text-popover-foreground p-2 shadow-lg",style:{top:`${x.top}px`,left:`${x.left}px`},onMouseDown:D=>D.stopPropagation(),children:e.jsx("div",{className:"grid gap-1",children:t.map(D=>e.jsxs("button",{onMouseDown:P=>{P.preventDefault(),P.stopPropagation(),j(D.code)},type:"button",className:b("flex items-center gap-2 rounded-sm px-2 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer",s===D.code&&"bg-accent"),children:[D.flagEmoji&&e.jsx("span",{className:"text-lg",children:D.flagEmoji}),D.flag&&!D.flagEmoji&&e.jsx("img",{src:D.flag,alt:D.label,className:"h-4 w-6 object-cover rounded"}),e.jsx("span",{className:"flex-1 text-left",children:D.label}),s===D.code&&e.jsx(h.Check,{className:"h-4 w-4 shrink-0"})]},D.code))})}):null;return e.jsxs(e.Fragment,{children:[e.jsxs("button",{ref:C,onClick:D=>{D.preventDefault(),D.stopPropagation(),m(!f)},className:b("flex h-9 w-9 items-center justify-center rounded-md border border-input bg-transparent hover:bg-accent hover:text-accent-foreground transition-colors",l),title:"Changer de langue",type:"button",disabled:i,children:[y?.flagEmoji?e.jsx("span",{className:"text-lg",children:y.flagEmoji}):e.jsx(h.Globe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:d})]}),p&&typeof document<"u"&&N&&er.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[9998]",onMouseDown:D=>{D.preventDefault(),m(!1)}}),N]}),document.body)]})}const k=f&&p?e.jsx("div",{ref:g,className:"fixed z-[9999] min-w-[180px] rounded-md border border-border bg-popover text-popover-foreground p-2 shadow-lg",style:{top:`${x.top}px`,left:`${x.left}px`},onMouseDown:N=>N.stopPropagation(),children:e.jsx("div",{className:"grid gap-1",children:t.map(N=>e.jsxs("button",{onMouseDown:D=>{D.preventDefault(),D.stopPropagation(),j(N.code)},type:"button",className:b("flex items-center gap-2 rounded-sm px-2 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer",s===N.code&&"bg-accent"),children:[r&&N.flagEmoji&&e.jsx("span",{className:"text-lg",children:N.flagEmoji}),r&&N.flag&&!N.flagEmoji&&e.jsx("img",{src:N.flag,alt:N.label,className:"h-4 w-6 object-cover rounded"}),e.jsx("span",{className:"flex-1 text-left",children:N.label}),s===N.code&&e.jsx(h.Check,{className:"h-4 w-4 shrink-0"})]},N.code))})}):null;return e.jsxs(e.Fragment,{children:[e.jsxs("button",{ref:C,onClick:N=>{N.preventDefault(),N.stopPropagation(),i||m(!f)},className:b("inline-flex items-center gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",i&&"opacity-50 cursor-not-allowed",l),disabled:i,type:"button","aria-label":d,children:[r&&y?.flagEmoji&&e.jsx("span",{className:"text-lg",children:y.flagEmoji}),r&&y?.flag&&!y?.flagEmoji&&e.jsx("img",{src:y.flag,alt:y.label,className:"h-4 w-6 object-cover rounded"}),!r&&e.jsx(h.Globe,{className:"h-4 w-4"}),n&&e.jsx("span",{children:y?.label||"Langue"}),e.jsx(h.ChevronDown,{className:"h-4 w-4"})]}),p&&typeof document<"u"&&k&&er.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[9998]",onMouseDown:N=>{N.preventDefault(),m(!1)}}),k]}),document.body)]})}const Zp=Ae.Menu,ex=Ae.Group,tx=Ae.Portal,sx=Ae.Sub,ax=Ae.RadioGroup,ki=c.forwardRef(({className:t,...s},a)=>e.jsx(Ae.Root,{ref:a,className:b("flex h-10 items-center space-x-1 rounded-md border bg-background p-1",t),...s}));ki.displayName=Ae.Root.displayName;const Si=c.forwardRef(({className:t,...s},a)=>e.jsx(Ae.Trigger,{ref:a,className:b("flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t),...s}));Si.displayName=Ae.Trigger.displayName;const Di=c.forwardRef(({className:t,inset:s,children:a,...r},n)=>e.jsxs(Ae.SubTrigger,{ref:n,className:b("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",s&&"pl-8",t),...r,children:[a,e.jsx(h.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Di.displayName=Ae.SubTrigger.displayName;const Ti=c.forwardRef(({className:t,...s},a)=>e.jsx(Ae.SubContent,{ref:a,className:b("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s}));Ti.displayName=Ae.SubContent.displayName;const Ai=c.forwardRef(({className:t,align:s="start",alignOffset:a=-4,sideOffset:r=8,...n},o)=>e.jsx(Ae.Portal,{children:e.jsx(Ae.Content,{ref:o,align:s,alignOffset:a,sideOffset:r,className:b("z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));Ai.displayName=Ae.Content.displayName;const Ei=c.forwardRef(({className:t,inset:s,...a},r)=>e.jsx(Ae.Item,{ref:r,className:b("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s&&"pl-8",t),...a}));Ei.displayName=Ae.Item.displayName;const Mi=c.forwardRef(({className:t,children:s,checked:a,...r},n)=>e.jsxs(Ae.CheckboxItem,{ref:n,className:b("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:a,...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Ae.ItemIndicator,{children:e.jsx(h.Check,{className:"h-4 w-4"})})}),s]}));Mi.displayName=Ae.CheckboxItem.displayName;const Pi=c.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(Ae.RadioItem,{ref:r,className:b("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Ae.ItemIndicator,{children:e.jsx(h.Circle,{className:"h-2 w-2 fill-current"})})}),s]}));Pi.displayName=Ae.RadioItem.displayName;const Ri=c.forwardRef(({className:t,inset:s,...a},r)=>e.jsx(Ae.Label,{ref:r,className:b("px-2 py-1.5 text-sm font-semibold",s&&"pl-8",t),...a}));Ri.displayName=Ae.Label.displayName;const Fi=c.forwardRef(({className:t,...s},a)=>e.jsx(Ae.Separator,{ref:a,className:b("-mx-1 my-1 h-px bg-muted",t),...s}));Fi.displayName=Ae.Separator.displayName;const $i=({className:t,...s})=>e.jsx("span",{className:b("ml-auto text-xs tracking-widest text-muted-foreground",t),...s});$i.displayName="MenubarShortcut";const Li=c.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(ut.Root,{ref:r,className:b("relative z-10 flex max-w-max flex-1 items-center justify-center",t),...a,children:[s,e.jsx(Dr,{})]}));Li.displayName=ut.Root.displayName;const Ii=c.forwardRef(({className:t,...s},a)=>e.jsx(ut.List,{ref:a,className:b("group flex flex-1 list-none items-center justify-center space-x-1",t),...s}));Ii.displayName=ut.List.displayName;const rx=ut.Item,Oi=Xe.cva("group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50"),zi=c.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(ut.Trigger,{ref:r,className:b(Oi(),"group",t),...a,children:[s," ",e.jsx(h.ChevronDown,{className:"relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180","aria-hidden":"true"})]}));zi.displayName=ut.Trigger.displayName;const _i=c.forwardRef(({className:t,...s},a)=>e.jsx(ut.Content,{ref:a,className:b("left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ",t),...s}));_i.displayName=ut.Content.displayName;const nx=ut.Link,Dr=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{className:b("absolute left-0 top-full flex justify-center"),children:e.jsx(ut.Viewport,{className:b("origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",t),ref:a,...s})}));Dr.displayName=ut.Viewport.displayName;const Vi=c.forwardRef(({className:t,...s},a)=>e.jsx(ut.Indicator,{ref:a,className:b("top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",t),...s,children:e.jsx("div",{className:"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md"})}));Vi.displayName=ut.Indicator.displayName;const rt=qs.Root,nt=qs.Trigger,st=c.forwardRef(({className:t,align:s="center",sideOffset:a=4,...r},n)=>e.jsx(qs.Portal,{children:e.jsx(qs.Content,{ref:n,align:s,sideOffset:a,className:b("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));st.displayName=qs.Content.displayName;const Xs=c.forwardRef(({className:t,value:s,...a},r)=>e.jsx(sr.Root,{ref:r,className:b("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...a,children:e.jsx(sr.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(s||0)}%)`}})}));Xs.displayName=sr.Root.displayName;const Wi=c.forwardRef(({className:t,...s},a)=>e.jsx(Hs.Root,{className:b("grid gap-2",t),...s,ref:a}));Wi.displayName=Hs.Root.displayName;const Ui=c.forwardRef(({className:t,...s},a)=>e.jsx(Hs.Item,{ref:a,className:b("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:e.jsx(Hs.Indicator,{className:"flex items-center justify-center",children:e.jsx(h.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Ui.displayName=Hs.Item.displayName;const At=c.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(us.Root,{ref:r,className:b("relative overflow-hidden",t),...a,children:[e.jsx(us.Viewport,{className:"h-full w-full rounded-[inherit]",children:s}),e.jsx(Tr,{}),e.jsx(us.Corner,{})]}));At.displayName=us.Root.displayName;const Tr=c.forwardRef(({className:t,orientation:s="vertical",...a},r)=>e.jsx(us.ScrollAreaScrollbar,{ref:r,orientation:s,className:b("flex touch-none select-none transition-colors",s==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",s==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...a,children:e.jsx(us.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Tr.displayName=us.ScrollAreaScrollbar.displayName;const kt=c.forwardRef(({className:t,orientation:s="horizontal",decorative:a=!0,...r},n)=>e.jsx(Co.Root,{ref:n,decorative:a,orientation:s,className:b("shrink-0 bg-border",s==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));kt.displayName=Co.Root.displayName;const sa=ue.Root,Ar=ue.Trigger,ox=ue.Close,Bi=ue.Portal,Er=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Overlay,{className:b("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s,ref:a}));Er.displayName=ue.Overlay.displayName;const ix=Xe.cva("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Ds=c.forwardRef(({side:t="right",className:s,children:a,...r},n)=>e.jsxs(Bi,{children:[e.jsx(Er,{}),e.jsxs(ue.Content,{ref:n,className:b(ix({side:t}),s),...r,children:[a,e.jsxs(ue.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[e.jsx(h.X,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ds.displayName=ue.Content.displayName;const Da=({className:t,...s})=>e.jsx("div",{className:b("flex flex-col space-y-2 text-center sm:text-left",t),...s});Da.displayName="SheetHeader";const Mr=({className:t,...s})=>e.jsx("div",{className:b("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});Mr.displayName="SheetFooter";const Ta=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Title,{ref:a,className:b("text-lg font-semibold text-foreground",t),...s}));Ta.displayName=ue.Title.displayName;const Aa=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Description,{ref:a,className:b("text-sm text-muted-foreground",t),...s}));Aa.displayName=ue.Description.displayName;function qi({className:t,...s}){return e.jsx("div",{className:b("animate-pulse rounded-md bg-muted",t),...s})}const va=c.forwardRef(({className:t,...s},a)=>e.jsxs(Os.Root,{ref:a,className:b("relative flex w-full touch-none select-none items-center",t),...s,children:[e.jsx(Os.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:e.jsx(Os.Range,{className:"absolute h-full bg-primary"})}),e.jsx(Os.Thumb,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));va.displayName=Os.Root.displayName;const aa=c.forwardRef(({className:t,...s},a)=>e.jsx(ar.Root,{className:b("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...s,ref:a,children:e.jsx(ar.Thumb,{className:b("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));aa.displayName=ar.Root.displayName;const Ea=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:a,className:b("w-full caption-bottom text-sm",t),...s})}));Ea.displayName="Table";const Ma=c.forwardRef(({className:t,...s},a)=>e.jsx("thead",{ref:a,className:b("[&_tr]:border-b",t),...s}));Ma.displayName="TableHeader";const Pa=c.forwardRef(({className:t,...s},a)=>e.jsx("tbody",{ref:a,className:b("[&_tr:last-child]:border-0",t),...s}));Pa.displayName="TableBody";const Hi=c.forwardRef(({className:t,...s},a)=>e.jsx("tfoot",{ref:a,className:b("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...s}));Hi.displayName="TableFooter";const qt=c.forwardRef(({className:t,...s},a)=>e.jsx("tr",{ref:a,className:b("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...s}));qt.displayName="TableRow";const ct=c.forwardRef(({className:t,...s},a)=>e.jsx("th",{ref:a,className:b("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...s}));ct.displayName="TableHead";const tt=c.forwardRef(({className:t,...s},a)=>e.jsx("td",{ref:a,className:b("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...s}));tt.displayName="TableCell";const Gi=c.forwardRef(({className:t,...s},a)=>e.jsx("caption",{ref:a,className:b("mt-4 text-sm text-muted-foreground",t),...s}));Gi.displayName="TableCaption";const ra=ws.Root,Ts=c.forwardRef(({className:t,...s},a)=>e.jsx(ws.List,{ref:a,className:b("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...s}));Ts.displayName=ws.List.displayName;const js=c.forwardRef(({className:t,...s},a)=>e.jsx(ws.Trigger,{ref:a,className:b("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...s}));js.displayName=ws.Trigger.displayName;const vs=c.forwardRef(({className:t,...s},a)=>e.jsx(ws.Content,{ref:a,className:b("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...s}));vs.displayName=ws.Content.displayName;const ft=c.forwardRef(({className:t,...s},a)=>e.jsx("textarea",{className:b("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...s}));ft.displayName="Textarea";const Xi=c.createContext(void 0);function Ki({children:t,themes:s,defaultTheme:a="default",s3Config:r,onThemeChange:n,enableDarkMode:o=!1}){const[i,l]=c.useState(a),[u,d]=c.useState(!0),[f,m]=c.useState(new Set),[p,w]=c.useState(!1),[C,g]=c.useState(!1),y=c.useRef(new Map),j=c.useRef(new Set);c.useEffect(()=>{j.current=f},[f]);const x=c.useCallback(async S=>{if(!r)throw new Error("S3 configuration not provided");const{baseUrl:M,prefix:E="",extension:T="css",headers:K={},timeout:q=1e4}=r,B=M.replace(/\/+$/,""),W=E.replace(/^\/+/,"").replace(/\/+$/,""),I=`v=${Date.now()}`;let z;W?z=`${B}/${W}/${S}.${T}?${I}`:z=`${B}/${S}.${T}?${I}`,console.log(`[ThemeProvider] Loading theme "${S}" from URL: ${z}`);try{const $=new AbortController,_=setTimeout(()=>$.abort(),q),F=await fetch(z,{signal:$.signal,headers:{Accept:T==="json"?"application/json":"text/css","Cache-Control":"no-cache, no-store, must-revalidate",Pragma:"no-cache",...K}});if(clearTimeout(_),!F.ok){const J=`HTTP ${F.status}: ${F.statusText}`;throw console.error(`[ThemeProvider] Failed to load theme "${S}" from ${z}:`,J),new Error(J)}if(console.log(`[ThemeProvider] ✅ Successfully loaded theme "${S}" from ${z}`),T==="json"){let J;try{const Q=await F.text();if(console.log(`[ThemeProvider] Raw JSON response for theme "${S}" (${Q.length} chars)`),!Q||Q.trim().length===0)throw new Error(`Empty JSON response for theme "${S}"`);J=JSON.parse(Q),console.log(`[ThemeProvider] Parsed JSON for theme "${S}":`,Object.keys(J))}catch(Q){throw console.error(`[ThemeProvider] Failed to parse JSON for theme "${S}":`,Q),new Error(`Invalid JSON format for theme "${S}": ${Q instanceof Error?Q.message:"Unknown error"}`)}try{const Q=lx(S,J);if(!Q.includes(`[data-theme="${S}"]`))throw console.error(`[ThemeProvider] ❌ Generated CSS missing [data-theme="${S}"] selector for theme "${S}"`),console.error("[ThemeProvider] Generated CSS:",Q.substring(0,500)),new Error(`Generated CSS is missing the required selector [data-theme="${S}"]`);return console.log(`[ThemeProvider] ✅ Converted JSON to CSS for theme "${S}" (${Q.length} chars)`),Q}catch(Q){throw console.error(`[ThemeProvider] Failed to convert JSON to CSS for theme "${S}":`,Q),Q}}const H=await F.text();if(!H||H.trim().length===0)throw new Error(`Empty CSS response for theme "${S}"`);return!H.includes(`[data-theme="${S}"]`)&&!H.includes(":root")&&!H.includes("html")?(console.warn(`[ThemeProvider] Theme CSS might be missing [data-theme="${S}"] selector`),console.warn("[ThemeProvider] CSS content preview:",H.substring(0,200))):console.log(`[ThemeProvider] ✅ CSS file loaded for theme "${S}" (${H.length} chars)`),H}catch($){throw console.error(`[ThemeProvider] Error loading theme ${S}:`,$),$}},[r]);c.useCallback(S=>{const M=y.current.get(S);M&&(M.parentNode&&M.parentNode.removeChild(M),y.current.delete(S))},[]);const v=c.useCallback((S,M)=>{if(typeof document>"u")return;!M.includes(`[data-theme="${S}"]`)&&!M.includes(":root")&&console.warn(`[ThemeProvider] CSS might be missing [data-theme="${S}"] selector:`,M.substring(0,200)),document.querySelectorAll("style[data-theme-styles]").forEach(q=>q.remove()),y.current.clear();const T=document.createElement("style");T.setAttribute("data-theme-id",S),T.setAttribute("data-theme-styles","active"),T.textContent=M,document.head.appendChild(T),y.current.set(S,T),document.querySelector(`style[data-theme-id="${S}"]`)?console.log(`[ThemeProvider] ✅ CSS injected for theme "${S}" (${M.length} chars)`):console.error(`[ThemeProvider] ❌ Failed to inject CSS for theme "${S}"`),T.offsetHeight},[]),k=c.useCallback(S=>{if(typeof document>"u")return;const M=document.documentElement;M.setAttribute("data-theme",S);const E=M.getAttribute("data-theme");E!==S?console.warn(`[ThemeProvider] Failed to apply theme attribute. Expected: ${S}, Got: ${E}`):console.log(`[ThemeProvider] ✅ Theme attribute applied: data-theme="${S}"`);try{localStorage.setItem("waka-theme",S)}catch(T){console.warn("[ThemeProvider] Could not save theme to localStorage:",T)}},[]),N=c.useCallback(async S=>{if(!j.current.has(S))try{if(r){const M=await x(S);v(S,M),m(E=>new Set(E).add(S))}else m(M=>new Set(M).add(S))}catch(M){throw console.error(`[ThemeProvider] Failed to preload theme ${S}:`,M),M}},[r,x,v]),D=c.useCallback(async S=>{console.log(`[ThemeProvider] changeTheme called with themeId: ${S}`),d(!0);try{if(r){console.log(`[ThemeProvider] Loading theme from S3: ${S}`);const M=await x(S);console.log(`[ThemeProvider] CSS loaded, length: ${M.length}`),v(S,M),m(E=>new Set(E).add(S)),await new Promise(E=>requestAnimationFrame(E))}else console.log("[ThemeProvider] No S3 config, applying theme directly");console.log(`[ThemeProvider] Applying theme attribute: ${S}`),k(S),l(S),console.log(`[ThemeProvider] ✅ Theme changed successfully to: ${S}`),n?.(S)}catch(M){console.error(`[ThemeProvider] ❌ Failed to change theme to ${S}:`,M);try{k(S),l(S)}catch(E){console.error("[ThemeProvider] ❌ Fallback also failed:",E)}throw M}finally{d(!1)}},[r,x,v,k,n]),P=c.useCallback(S=>f.has(S),[f]);c.useEffect(()=>{if(p)return;(async()=>{d(!0);try{let M=a;if(typeof window<"u"){const E=localStorage.getItem("waka-theme");E&&s.some(T=>T.id===E)&&(M=E)}if(r){const E=await x(M);v(M,E),m(new Set([M])),await new Promise(T=>requestAnimationFrame(T))}else m(new Set([M]));k(M),l(M)}catch(M){console.error("[ThemeProvider] Error initializing:",M),k(a),l(a),m(new Set([a]))}finally{d(!1),w(!0)}})()},[p,a,s,r,x,v,k]);const R=c.useCallback(()=>{o&&g(S=>{const M=!S,E=document.documentElement;M?E.classList.add("dark"):E.classList.remove("dark");try{localStorage.setItem("waka-dark-mode",M?"dark":"light")}catch(T){console.warn("[ThemeProvider] Could not save dark mode to localStorage:",T)}return M})},[o]);c.useEffect(()=>{if(!o||typeof window>"u")return;let S=!1;try{const K=localStorage.getItem("waka-dark-mode");K!==null?S=K==="dark":(S=window.matchMedia("(prefers-color-scheme: dark)").matches,localStorage.setItem("waka-dark-mode",S?"dark":"light"))}catch(K){console.warn("[ThemeProvider] Could not read dark mode from localStorage:",K)}g(S);const M=document.documentElement;S?M.classList.add("dark"):M.classList.remove("dark");const E=window.matchMedia("(prefers-color-scheme: dark)"),T=K=>{try{localStorage.getItem("waka-dark-mode")||(g(K.matches),K.matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),localStorage.setItem("waka-dark-mode",K.matches?"dark":"light"))}catch{}};return E.addEventListener("change",T),()=>{E.removeEventListener("change",T)}},[]),c.useEffect(()=>()=>{y.current.forEach(S=>{S.parentNode&&S.parentNode.removeChild(S)}),y.current.clear()},[]);const A={currentTheme:i,themes:s,changeTheme:D,isLoading:u,loadedThemes:f,preloadTheme:N,isThemeLoaded:P,isDarkMode:C,toggleDarkMode:R};return e.jsx(Xi.Provider,{value:A,children:t})}function lx(t,s){if(!s||typeof s!="object")throw console.error(`[ThemeProvider] Invalid JSON data for theme "${t}":`,s),new Error(`Invalid JSON data for theme "${t}"`);let a={};if(s.cssVars||s["css-vars"])a=s.cssVars||s["css-vars"],console.log(`[ThemeProvider] Using cssVars/css-vars format for theme "${t}"`);else if(s.variables)a=s.variables,console.log(`[ThemeProvider] Using variables format for theme "${t}"`);else if(typeof s=="object"&&s!==null){const g=["label","description","author","previewColor","version","createdAt","changelog","id"];a=Object.fromEntries(Object.entries(s).filter(([y])=>!g.includes(y))),console.log(`[ThemeProvider] Using direct object format for theme "${t}"`)}if(!a||Object.keys(a).length===0)throw console.error(`[ThemeProvider] No CSS variables found in JSON for theme "${t}":`,s),new Error(`No CSS variables found in JSON for theme "${t}"`);console.log(`[ThemeProvider] Found ${Object.keys(a).length} CSS variables for theme "${t}"`);const r=(g,y)=>{if(typeof g=="string")return g;if(typeof g=="number"||typeof g=="boolean")return String(g);if(g==null)return"none";if(typeof g=="object"){if(Array.isArray(g))return g.map(x=>r(x,y)).join(" ");if(console.log(`[ThemeProvider] Converting object value for key "${y}":`,JSON.stringify(g,null,2)),("r"in g||"R"in g)&&("g"in g||"G"in g)&&("b"in g||"B"in g)){const x=g.r??g.R??0,v=g.g??g.G??0,k=g.b??g.B??0,N=g.a??g.A??g.alpha??g.opacity;return N!=null?`rgba(${x}, ${v}, ${k}, ${N})`:`rgb(${x}, ${v}, ${k})`}if(("h"in g||"H"in g)&&("s"in g||"S"in g)&&("l"in g||"L"in g)){const x=g.h??g.H??0,v=g.s??g.S??0,k=g.l??g.L??0,N=g.a??g.A??g.alpha??g.opacity;return N!=null?`hsla(${x}, ${v}%, ${k}%, ${N})`:`hsl(${x}, ${v}%, ${k}%)`}return Object.keys(g).length>0?(console.warn(`[ThemeProvider] Object value for "${y}" has nested structure, cannot convert to CSS:`,g),JSON.stringify(g)):"none"}return console.warn(`[ThemeProvider] Unknown value type for "${y}":`,typeof g,g),String(g)},n=(g,y="")=>{const j=[];for(const[x,v]of Object.entries(g))if(typeof v=="object"&&v!==null&&!Array.isArray(v))if(("r"in v||"R"in v||"h"in v||"H"in v)&&("g"in v||"G"in v||"s"in v||"S"in v)){const N=y?`--${y}-${x}`:x.startsWith("--")?x:`--${x}`,D=r(v,x);j.push(` ${N}: ${D};`)}else{const N=y?`${y}-${x}`:"",D=n(v,N);j.push(...D)}else{const k=y?`--${y}-${x}`:x.startsWith("--")?x:`--${x}`,N=r(v,x);j.push(` ${k}: ${N};`)}return j},o=a.light,i=a.dark,l=a.theme,u=Object.fromEntries(Object.entries(a).filter(([g])=>!["light","dark","theme"].includes(g))),d=[];l&&typeof l=="object"&&!Array.isArray(l)&&d.push(...n(l,"")),Object.keys(u).length>0&&d.push(...n(u,""));const f=o&&typeof o=="object"&&!Array.isArray(o)?n(o,""):[],m=i&&typeof i=="object"&&!Array.isArray(i)?n(i,""):[];let p="";if(d.length>0||f.length>0){const g=[...d,...f];p+=`[data-theme="${t}"] {
1
+ "use strict";var Sc=Object.create;var bn=Object.defineProperty;var Dc=Object.getOwnPropertyDescriptor;var Tc=Object.getOwnPropertyNames;var Ac=Object.getPrototypeOf,Ec=Object.prototype.hasOwnProperty;var Mc=(t,s,a,r)=>{if(s&&typeof s=="object"||typeof s=="function")for(let n of Tc(s))!Ec.call(t,n)&&n!==a&&bn(t,n,{get:()=>s[n],enumerable:!(r=Dc(s,n))||r.enumerable});return t};var Dt=(t,s,a)=>(a=t!=null?Sc(Ac(t)):{},Mc(s||!t||!t.__esModule?bn(a,"default",{value:t,enumerable:!0}):a,t));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),O=require("react"),Pc=require("@radix-ui/react-accordion"),h=require("lucide-react"),yo=require("clsx"),Rc=require("tailwind-merge"),Xe=require("class-variance-authority"),Fc=require("@radix-ui/react-alert-dialog"),$c=require("@radix-ui/react-aspect-ratio"),Lc=require("@radix-ui/react-avatar"),Aa=require("@radix-ui/react-slot"),Ic=require("react-day-picker"),Oc=require("@radix-ui/react-checkbox"),V=require("date-fns"),zc=require("@radix-ui/react-collapsible"),dt=require("cmdk"),_c=require("@radix-ui/react-dialog"),Vc=require("@radix-ui/react-context-menu"),Wc=require("@radix-ui/react-dropdown-menu"),Uc=require("@radix-ui/react-label"),Bc=require("@radix-ui/react-hover-card"),qc=require("@radix-ui/react-select"),rr=require("react-dom"),Hc=require("@radix-ui/react-menubar"),Gc=require("@radix-ui/react-navigation-menu"),Xc=require("@radix-ui/react-popover"),Kc=require("@radix-ui/react-progress"),Yc=require("@radix-ui/react-radio-group"),Jc=require("@radix-ui/react-scroll-area"),Qc=require("@radix-ui/react-separator"),Zc=require("@radix-ui/react-slider"),ed=require("@radix-ui/react-switch"),td=require("@radix-ui/react-tabs"),sd=require("@radix-ui/react-toast"),ad=require("@radix-ui/react-toggle"),rd=require("@radix-ui/react-tooltip"),Be=require("@tanstack/react-table"),wt=require("react-i18next"),nd=require("@tanstack/react-virtual"),_t=require("react-datepicker"),$t=require("i18next");function Ee(t){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const a in t)if(a!=="default"){const r=Object.getOwnPropertyDescriptor(t,a);Object.defineProperty(s,a,r.get?r:{enumerable:!0,get:()=>t[a]})}}return s.default=t,Object.freeze(s)}const c=Ee(O),hs=Ee(Pc),it=Ee(Fc),od=Ee($c),Ss=Ee(Lc),nr=Ee(Oc),fr=Ee(zc),ue=Ee(_c),Me=Ee(Vc),Pe=Ee(Wc),No=Ee(Uc),Ea=Ee(Bc),ze=Ee(qc),Ae=Ee(Hc),ut=Ee(Gc),qs=Ee(Xc),or=Ee(Kc),Hs=Ee(Yc),us=Ee(Jc),Co=Ee(Qc),Os=Ee(Zc),ir=Ee(ed),ws=Ee(td),pt=Ee(sd),ko=Ee(ad),Zs=Ee(rd);function va(...t){return Rc.twMerge(yo.clsx(...t))}va.variants=function(t){const s={variants:t.variants??{},defaultVariants:t.defaultVariants},a=Xe.cva(t.base??"",s);return r=>{const{class:n,className:o,...i}=r??{};return va(a(i),n,o)}};const b=(...t)=>va(t),lr=hs.Root,pr=c.forwardRef(({className:t,...s},a)=>e.jsx(hs.Item,{ref:a,className:b("border-b",t),...s}));pr.displayName="AccordionItem";const xr=c.forwardRef(({className:t,children:s,...a},r)=>e.jsx(hs.Header,{className:"flex",children:e.jsxs(hs.Trigger,{ref:r,className:b("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...a,children:[s,e.jsx(h.ChevronDown,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));xr.displayName=hs.Trigger.displayName;const gr=c.forwardRef(({className:t,children:s,...a},r)=>e.jsx(hs.Content,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...a,children:e.jsx("div",{className:b("pb-4 pt-0",t),children:s})}));gr.displayName=hs.Content.displayName;const fs=it.Root,So=it.Trigger,Do=it.Portal,br=c.forwardRef(({className:t,...s},a)=>e.jsx(it.Overlay,{className:b("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s,ref:a}));br.displayName=it.Overlay.displayName;const Kt=c.forwardRef(({className:t,...s},a)=>e.jsxs(Do,{children:[e.jsx(br,{}),e.jsx(it.Content,{ref:a,className:b("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...s})]}));Kt.displayName=it.Content.displayName;const Yt=({className:t,...s})=>e.jsx("div",{className:b("flex flex-col space-y-2 text-center sm:text-left",t),...s});Yt.displayName="AlertDialogHeader";const Jt=({className:t,...s})=>e.jsx("div",{className:b("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});Jt.displayName="AlertDialogFooter";const Qt=c.forwardRef(({className:t,...s},a)=>e.jsx(it.Title,{ref:a,className:b("text-lg font-semibold",t),...s}));Qt.displayName=it.Title.displayName;const Zt=c.forwardRef(({className:t,...s},a)=>e.jsx(it.Description,{ref:a,className:b("text-sm text-muted-foreground",t),...s}));Zt.displayName=it.Description.displayName;const es=c.forwardRef(({className:t,...s},a)=>e.jsx(it.Action,{ref:a,className:b("inline-flex h-10 items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground ring-offset-background transition-colors hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...s}));es.displayName=it.Action.displayName;const ts=c.forwardRef(({className:t,...s},a)=>e.jsx(it.Cancel,{ref:a,className:b("mt-2 inline-flex h-10 items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-semibold ring-offset-background transition-colors hover:bg-accent hover:text-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 sm:mt-0",t),...s}));ts.displayName=it.Cancel.displayName;const id=Xe.cva("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),To=c.forwardRef(({className:t,variant:s,...a},r)=>e.jsx("div",{ref:r,role:"alert",className:b(id({variant:s}),t),...a}));To.displayName="Alert";const Ao=c.forwardRef(({className:t,...s},a)=>e.jsx("h5",{ref:a,className:b("mb-1 font-medium leading-none tracking-tight",t),...s}));Ao.displayName="AlertTitle";const Eo=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b("text-sm [&_p]:leading-relaxed",t),...s}));Eo.displayName="AlertDescription";const ld=od.Root,yt=c.forwardRef(({className:t,...s},a)=>e.jsx(Ss.Root,{ref:a,className:b("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...s}));yt.displayName=Ss.Root.displayName;const Nt=c.forwardRef(({className:t,...s},a)=>e.jsx(Ss.Image,{ref:a,className:b("aspect-square h-full w-full",t),...s}));Nt.displayName=Ss.Image.displayName;const Ct=c.forwardRef(({className:t,...s},a)=>e.jsx(Ss.Fallback,{ref:a,className:b("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...s}));Ct.displayName=Ss.Fallback.displayName;const Mo=Xe.cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Se({className:t,variant:s,...a}){return e.jsx("div",{className:b(Mo({variant:s}),t),...a})}const cd=Xe.cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),L=c.forwardRef(({className:t,variant:s,size:a,asChild:r=!1,...n},o)=>{const i=r?Aa.Slot:"button";return e.jsx(i,{className:b(cd({variant:s,size:a,className:t})),ref:o,...n})});L.displayName="Button";function Ma({className:t,classNames:s,showOutsideDays:a=!0,...r}){return e.jsx(Ic.DayPicker,{showOutsideDays:a,className:b("p-4 bg-background border border-border rounded-lg shadow-sm",t),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center mb-4",caption_label:"text-lg font-semibold text-foreground",nav:"space-x-1 flex items-center",nav_button:b("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200","h-8 w-8 bg-background border border-border hover:bg-accent hover:text-accent-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50"),nav_button_previous:"absolute left-1",nav_button_next:"absolute right-1",table:"w-full border-collapse space-y-1",head_row:"flex mb-2",head_cell:"text-muted-foreground rounded-md w-10 h-10 font-medium text-sm flex items-center justify-center",row:"flex w-full",cell:"h-10 w-10 text-center text-sm p-0 relative",day:b("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-all duration-200","h-10 w-10 p-0 font-normal cursor-pointer","hover:bg-accent hover:text-accent-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50"),day_range_end:"day-range-end",day_selected:b("bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground","focus:bg-primary focus:text-primary-foreground shadow-sm"),day_today:"bg-accent text-accent-foreground font-semibold",day_outside:"text-muted-foreground opacity-50 hover:opacity-70",day_disabled:"text-muted-foreground opacity-30 cursor-not-allowed",day_range_middle:"bg-accent/50 text-accent-foreground",day_hidden:"invisible",...s},components:{Chevron:({...n})=>n.orientation==="left"?e.jsx(h.ChevronLeft,{className:"h-4 w-4"}):e.jsx(h.ChevronRight,{className:"h-4 w-4"})},...r})}Ma.displayName="Calendar";const ke=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b("rounded-xl border bg-card text-card-foreground shadow",t),...s}));ke.displayName="Card";const qe=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b("flex flex-col space-y-1.5 p-6",t),...s}));qe.displayName="CardHeader";const Oe=c.forwardRef(({className:t,...s},a)=>e.jsx("h3",{ref:a,className:b("font-semibold leading-none tracking-tight",t),...s}));Oe.displayName="CardTitle";const ot=c.forwardRef(({className:t,...s},a)=>e.jsx("p",{ref:a,className:b("text-sm text-muted-foreground",t),...s}));ot.displayName="CardDescription";const Te=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b("p-6 pt-0",t),...s}));Te.displayName="CardContent";const jr=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b("flex items-center p-6 pt-0",t),...s}));jr.displayName="CardFooter";const Ze=c.forwardRef(({className:t,...s},a)=>e.jsx(nr.Root,{ref:a,className:b("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...s,children:e.jsx(nr.Indicator,{className:b("flex items-center justify-center text-current"),children:e.jsx(h.Check,{className:"h-4 w-4"})})}));Ze.displayName=nr.Root.displayName;function Fe(t){return(s={})=>{const a=s.width?String(s.width):t.defaultWidth;return t.formats[a]||t.formats[t.defaultWidth]}}function he(t){return(s,a)=>{const r=a?.context?String(a.context):"standalone";let n;if(r==="formatting"&&t.formattingValues){const i=t.defaultFormattingWidth||t.defaultWidth,l=a?.width?String(a.width):i;n=t.formattingValues[l]||t.formattingValues[i]}else{const i=t.defaultWidth,l=a?.width?String(a.width):t.defaultWidth;n=t.values[l]||t.values[i]}const o=t.argumentCallback?t.argumentCallback(s):s;return n[o]}}function fe(t){return(s,a={})=>{const r=a.width,n=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],o=s.match(n);if(!o)return null;const i=o[0],l=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],u=Array.isArray(l)?ud(l,m=>m.test(i)):dd(l,m=>m.test(i));let d;d=t.valueCallback?t.valueCallback(u):u,d=a.valueCallback?a.valueCallback(d):d;const f=s.slice(i.length);return{value:d,rest:f}}}function dd(t,s){for(const a in t)if(Object.prototype.hasOwnProperty.call(t,a)&&s(t[a]))return a}function ud(t,s){for(let a=0;a<t.length;a++)if(s(t[a]))return a}function as(t){return(s,a={})=>{const r=s.match(t.matchPattern);if(!r)return null;const n=r[0],o=s.match(t.parsePattern);if(!o)return null;let i=t.valueCallback?t.valueCallback(o[0]):o[0];i=a.valueCallback?a.valueCallback(i):i;const l=s.slice(n.length);return{value:i,rest:l}}}const jn=Symbol.for("constructDateFrom");function Po(t,s){return typeof t=="function"?t(s):t&&typeof t=="object"&&jn in t?t[jn](s):t instanceof Date?new t.constructor(s):new Date(s)}function md(t,...s){const a=Po.bind(null,t||s.find(r=>typeof r=="object"));return s.map(a)}let hd={};function fd(){return hd}function pd(t,s){return Po(s||t,t)}function vn(t,s){const a=fd(),r=s?.weekStartsOn??s?.locale?.options?.weekStartsOn??a.weekStartsOn??a.locale?.options?.weekStartsOn??0,n=pd(t,s?.in),o=n.getDay(),i=(o<r?7:0)+o-r;return n.setDate(n.getDate()-i),n.setHours(0,0,0,0),n}function cr(t,s,a){const[r,n]=md(a?.in,t,s);return+vn(r,a)==+vn(n,a)}const wn={lessThanXSeconds:{standalone:{one:"weniger als 1 Sekunde",other:"weniger als {{count}} Sekunden"},withPreposition:{one:"weniger als 1 Sekunde",other:"weniger als {{count}} Sekunden"}},xSeconds:{standalone:{one:"1 Sekunde",other:"{{count}} Sekunden"},withPreposition:{one:"1 Sekunde",other:"{{count}} Sekunden"}},halfAMinute:{standalone:"eine halbe Minute",withPreposition:"einer halben Minute"},lessThanXMinutes:{standalone:{one:"weniger als 1 Minute",other:"weniger als {{count}} Minuten"},withPreposition:{one:"weniger als 1 Minute",other:"weniger als {{count}} Minuten"}},xMinutes:{standalone:{one:"1 Minute",other:"{{count}} Minuten"},withPreposition:{one:"1 Minute",other:"{{count}} Minuten"}},aboutXHours:{standalone:{one:"etwa 1 Stunde",other:"etwa {{count}} Stunden"},withPreposition:{one:"etwa 1 Stunde",other:"etwa {{count}} Stunden"}},xHours:{standalone:{one:"1 Stunde",other:"{{count}} Stunden"},withPreposition:{one:"1 Stunde",other:"{{count}} Stunden"}},xDays:{standalone:{one:"1 Tag",other:"{{count}} Tage"},withPreposition:{one:"1 Tag",other:"{{count}} Tagen"}},aboutXWeeks:{standalone:{one:"etwa 1 Woche",other:"etwa {{count}} Wochen"},withPreposition:{one:"etwa 1 Woche",other:"etwa {{count}} Wochen"}},xWeeks:{standalone:{one:"1 Woche",other:"{{count}} Wochen"},withPreposition:{one:"1 Woche",other:"{{count}} Wochen"}},aboutXMonths:{standalone:{one:"etwa 1 Monat",other:"etwa {{count}} Monate"},withPreposition:{one:"etwa 1 Monat",other:"etwa {{count}} Monaten"}},xMonths:{standalone:{one:"1 Monat",other:"{{count}} Monate"},withPreposition:{one:"1 Monat",other:"{{count}} Monaten"}},aboutXYears:{standalone:{one:"etwa 1 Jahr",other:"etwa {{count}} Jahre"},withPreposition:{one:"etwa 1 Jahr",other:"etwa {{count}} Jahren"}},xYears:{standalone:{one:"1 Jahr",other:"{{count}} Jahre"},withPreposition:{one:"1 Jahr",other:"{{count}} Jahren"}},overXYears:{standalone:{one:"mehr als 1 Jahr",other:"mehr als {{count}} Jahre"},withPreposition:{one:"mehr als 1 Jahr",other:"mehr als {{count}} Jahren"}},almostXYears:{standalone:{one:"fast 1 Jahr",other:"fast {{count}} Jahre"},withPreposition:{one:"fast 1 Jahr",other:"fast {{count}} Jahren"}}},xd=(t,s,a)=>{let r;const n=a?.addSuffix?wn[t].withPreposition:wn[t].standalone;return typeof n=="string"?r=n:s===1?r=n.one:r=n.other.replace("{{count}}",String(s)),a?.addSuffix?a.comparison&&a.comparison>0?"in "+r:"vor "+r:r},gd={full:"EEEE, do MMMM y",long:"do MMMM y",medium:"do MMM y",short:"dd.MM.y"},bd={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},jd={full:"{{date}} 'um' {{time}}",long:"{{date}} 'um' {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},vd={date:Fe({formats:gd,defaultWidth:"full"}),time:Fe({formats:bd,defaultWidth:"full"}),dateTime:Fe({formats:jd,defaultWidth:"full"})},wd={lastWeek:"'letzten' eeee 'um' p",yesterday:"'gestern um' p",today:"'heute um' p",tomorrow:"'morgen um' p",nextWeek:"eeee 'um' p",other:"P"},yd=(t,s,a,r)=>wd[t],Nd={narrow:["v.Chr.","n.Chr."],abbreviated:["v.Chr.","n.Chr."],wide:["vor Christus","nach Christus"]},Cd={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1. Quartal","2. Quartal","3. Quartal","4. Quartal"]},dr={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mär","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],wide:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"]},kd={narrow:dr.narrow,abbreviated:["Jan.","Feb.","März","Apr.","Mai","Juni","Juli","Aug.","Sep.","Okt.","Nov.","Dez."],wide:dr.wide},Sd={narrow:["S","M","D","M","D","F","S"],short:["So","Mo","Di","Mi","Do","Fr","Sa"],abbreviated:["So.","Mo.","Di.","Mi.","Do.","Fr.","Sa."],wide:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},Dd={narrow:{am:"vm.",pm:"nm.",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachm.",evening:"Abend",night:"Nacht"},abbreviated:{am:"vorm.",pm:"nachm.",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachmittag",evening:"Abend",night:"Nacht"},wide:{am:"vormittags",pm:"nachmittags",midnight:"Mitternacht",noon:"Mittag",morning:"Morgen",afternoon:"Nachmittag",evening:"Abend",night:"Nacht"}},Td={narrow:{am:"vm.",pm:"nm.",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachm.",evening:"abends",night:"nachts"},abbreviated:{am:"vorm.",pm:"nachm.",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachmittags",evening:"abends",night:"nachts"},wide:{am:"vormittags",pm:"nachmittags",midnight:"Mitternacht",noon:"Mittag",morning:"morgens",afternoon:"nachmittags",evening:"abends",night:"nachts"}},Ad=t=>Number(t)+".",Ed={ordinalNumber:Ad,era:he({values:Nd,defaultWidth:"wide"}),quarter:he({values:Cd,defaultWidth:"wide",argumentCallback:t=>t-1}),month:he({values:dr,formattingValues:kd,defaultWidth:"wide"}),day:he({values:Sd,defaultWidth:"wide"}),dayPeriod:he({values:Dd,defaultWidth:"wide",formattingValues:Td,defaultFormattingWidth:"wide"})},Md=/^(\d+)(\.)?/i,Pd=/\d+/i,Rd={narrow:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,abbreviated:/^(v\.? ?Chr\.?|n\.? ?Chr\.?)/i,wide:/^(vor Christus|vor unserer Zeitrechnung|nach Christus|unserer Zeitrechnung)/i},Fd={any:[/^v/i,/^n/i]},$d={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](\.)? Quartal/i},Ld={any:[/1/i,/2/i,/3/i,/4/i]},Id={narrow:/^[jfmasond]/i,abbreviated:/^(j[aä]n|feb|mär[z]?|apr|mai|jun[i]?|jul[i]?|aug|sep|okt|nov|dez)\.?/i,wide:/^(januar|februar|märz|april|mai|juni|juli|august|september|oktober|november|dezember)/i},Od={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^j[aä]/i,/^f/i,/^mär/i,/^ap/i,/^mai/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},zd={narrow:/^[smdmf]/i,short:/^(so|mo|di|mi|do|fr|sa)/i,abbreviated:/^(son?|mon?|die?|mit?|don?|fre?|sam?)\.?/i,wide:/^(sonntag|montag|dienstag|mittwoch|donnerstag|freitag|samstag)/i},_d={any:[/^so/i,/^mo/i,/^di/i,/^mi/i,/^do/i,/^f/i,/^sa/i]},Vd={narrow:/^(vm\.?|nm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,abbreviated:/^(vorm\.?|nachm\.?|Mitternacht|Mittag|morgens|nachm\.?|abends|nachts)/i,wide:/^(vormittags|nachmittags|Mitternacht|Mittag|morgens|nachmittags|abends|nachts)/i},Wd={any:{am:/^v/i,pm:/^n/i,midnight:/^Mitte/i,noon:/^Mitta/i,morning:/morgens/i,afternoon:/nachmittags/i,evening:/abends/i,night:/nachts/i}},Ud={ordinalNumber:as({matchPattern:Md,parsePattern:Pd,valueCallback:t=>parseInt(t)}),era:fe({matchPatterns:Rd,defaultMatchWidth:"wide",parsePatterns:Fd,defaultParseWidth:"any"}),quarter:fe({matchPatterns:$d,defaultMatchWidth:"wide",parsePatterns:Ld,defaultParseWidth:"any",valueCallback:t=>t+1}),month:fe({matchPatterns:Id,defaultMatchWidth:"wide",parsePatterns:Od,defaultParseWidth:"any"}),day:fe({matchPatterns:zd,defaultMatchWidth:"wide",parsePatterns:_d,defaultParseWidth:"any"}),dayPeriod:fe({matchPatterns:Vd,defaultMatchWidth:"wide",parsePatterns:Wd,defaultParseWidth:"any"})},Ro={code:"de",formatDistance:xd,formatLong:vd,formatRelative:yd,localize:Ed,match:Ud,options:{weekStartsOn:1,firstWeekContainsDate:4}},Bd={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},qd=(t,s,a)=>{let r;const n=Bd[t];return typeof n=="string"?r=n:s===1?r=n.one:r=n.other.replace("{{count}}",s.toString()),a?.addSuffix?a.comparison&&a.comparison>0?"in "+r:r+" ago":r},Hd={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Gd=(t,s,a,r)=>Hd[t],Xd={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},Kd={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Yd={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Jd={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Qd={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Zd={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},eu=(t,s)=>{const a=Number(t),r=a%100;if(r>20||r<10)switch(r%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},tu={ordinalNumber:eu,era:he({values:Xd,defaultWidth:"wide"}),quarter:he({values:Kd,defaultWidth:"wide",argumentCallback:t=>t-1}),month:he({values:Yd,defaultWidth:"wide"}),day:he({values:Jd,defaultWidth:"wide"}),dayPeriod:he({values:Qd,defaultWidth:"wide",formattingValues:Zd,defaultFormattingWidth:"wide"})},su=/^(\d+)(th|st|nd|rd)?/i,au=/\d+/i,ru={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},nu={any:[/^b/i,/^(a|c)/i]},ou={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},iu={any:[/1/i,/2/i,/3/i,/4/i]},lu={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},cu={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},du={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},uu={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},mu={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},hu={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},fu={ordinalNumber:as({matchPattern:su,parsePattern:au,valueCallback:t=>parseInt(t,10)}),era:fe({matchPatterns:ru,defaultMatchWidth:"wide",parsePatterns:nu,defaultParseWidth:"any"}),quarter:fe({matchPatterns:ou,defaultMatchWidth:"wide",parsePatterns:iu,defaultParseWidth:"any",valueCallback:t=>t+1}),month:fe({matchPatterns:lu,defaultMatchWidth:"wide",parsePatterns:cu,defaultParseWidth:"any"}),day:fe({matchPatterns:du,defaultMatchWidth:"wide",parsePatterns:uu,defaultParseWidth:"any"}),dayPeriod:fe({matchPatterns:mu,defaultMatchWidth:"any",parsePatterns:hu,defaultParseWidth:"any"})},pu={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},xu={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},gu={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},bu={date:Fe({formats:pu,defaultWidth:"full"}),time:Fe({formats:xu,defaultWidth:"full"}),dateTime:Fe({formats:gu,defaultWidth:"full"})},Fo={code:"en-US",formatDistance:qd,formatLong:bu,formatRelative:Gd,localize:tu,match:fu,options:{weekStartsOn:0,firstWeekContainsDate:1}},ju={lessThanXSeconds:{one:"menos de un segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"medio minuto",lessThanXMinutes:{one:"menos de un minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"alrededor de 1 hora",other:"alrededor de {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 día",other:"{{count}} días"},aboutXWeeks:{one:"alrededor de 1 semana",other:"alrededor de {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"alrededor de 1 mes",other:"alrededor de {{count}} meses"},xMonths:{one:"1 mes",other:"{{count}} meses"},aboutXYears:{one:"alrededor de 1 año",other:"alrededor de {{count}} años"},xYears:{one:"1 año",other:"{{count}} años"},overXYears:{one:"más de 1 año",other:"más de {{count}} años"},almostXYears:{one:"casi 1 año",other:"casi {{count}} años"}},vu=(t,s,a)=>{let r;const n=ju[t];return typeof n=="string"?r=n:s===1?r=n.one:r=n.other.replace("{{count}}",s.toString()),a?.addSuffix?a.comparison&&a.comparison>0?"en "+r:"hace "+r:r},wu={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d MMM y",short:"dd/MM/y"},yu={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Nu={full:"{{date}} 'a las' {{time}}",long:"{{date}} 'a las' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Cu={date:Fe({formats:wu,defaultWidth:"full"}),time:Fe({formats:yu,defaultWidth:"full"}),dateTime:Fe({formats:Nu,defaultWidth:"full"})},ku={lastWeek:"'el' eeee 'pasado a la' p",yesterday:"'ayer a la' p",today:"'hoy a la' p",tomorrow:"'mañana a la' p",nextWeek:"eeee 'a la' p",other:"P"},Su={lastWeek:"'el' eeee 'pasado a las' p",yesterday:"'ayer a las' p",today:"'hoy a las' p",tomorrow:"'mañana a las' p",nextWeek:"eeee 'a las' p",other:"P"},Du=(t,s,a,r)=>s.getHours()!==1?Su[t]:ku[t],Tu={narrow:["AC","DC"],abbreviated:["AC","DC"],wide:["antes de cristo","después de cristo"]},Au={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},Eu={narrow:["e","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["ene","feb","mar","abr","may","jun","jul","ago","sep","oct","nov","dic"],wide:["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"]},Mu={narrow:["d","l","m","m","j","v","s"],short:["do","lu","ma","mi","ju","vi","sá"],abbreviated:["dom","lun","mar","mié","jue","vie","sáb"],wide:["domingo","lunes","martes","miércoles","jueves","viernes","sábado"]},Pu={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"mañana",afternoon:"tarde",evening:"tarde",night:"noche"}},Ru={narrow:{am:"a",pm:"p",midnight:"mn",noon:"md",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},abbreviated:{am:"AM",pm:"PM",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"},wide:{am:"a.m.",pm:"p.m.",midnight:"medianoche",noon:"mediodia",morning:"de la mañana",afternoon:"de la tarde",evening:"de la tarde",night:"de la noche"}},Fu=(t,s)=>Number(t)+"º",$u={ordinalNumber:Fu,era:he({values:Tu,defaultWidth:"wide"}),quarter:he({values:Au,defaultWidth:"wide",argumentCallback:t=>Number(t)-1}),month:he({values:Eu,defaultWidth:"wide"}),day:he({values:Mu,defaultWidth:"wide"}),dayPeriod:he({values:Pu,defaultWidth:"wide",formattingValues:Ru,defaultFormattingWidth:"wide"})},Lu=/^(\d+)(º)?/i,Iu=/\d+/i,Ou={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes de la era com[uú]n|despu[eé]s de cristo|era com[uú]n)/i},zu={any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes de la era com[uú]n)/i,/^(despu[eé]s de cristo|era com[uú]n)/i]},_u={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º)? trimestre/i},Vu={any:[/1/i,/2/i,/3/i,/4/i]},Wu={narrow:/^[efmajsond]/i,abbreviated:/^(ene|feb|mar|abr|may|jun|jul|ago|sep|oct|nov|dic)/i,wide:/^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i},Uu={narrow:[/^e/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^en/i,/^feb/i,/^mar/i,/^abr/i,/^may/i,/^jun/i,/^jul/i,/^ago/i,/^sep/i,/^oct/i,/^nov/i,/^dic/i]},Bu={narrow:/^[dlmjvs]/i,short:/^(do|lu|ma|mi|ju|vi|s[áa])/i,abbreviated:/^(dom|lun|mar|mi[ée]|jue|vie|s[áa]b)/i,wide:/^(domingo|lunes|martes|mi[ée]rcoles|jueves|viernes|s[áa]bado)/i},qu={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^do/i,/^lu/i,/^ma/i,/^mi/i,/^ju/i,/^vi/i,/^sa/i]},Hu={narrow:/^(a|p|mn|md|(de la|a las) (mañana|tarde|noche))/i,any:/^([ap]\.?\s?m\.?|medianoche|mediodia|(de la|a las) (mañana|tarde|noche))/i},Gu={any:{am:/^a/i,pm:/^p/i,midnight:/^mn/i,noon:/^md/i,morning:/mañana/i,afternoon:/tarde/i,evening:/tarde/i,night:/noche/i}},Xu={ordinalNumber:as({matchPattern:Lu,parsePattern:Iu,valueCallback:function(t){return parseInt(t,10)}}),era:fe({matchPatterns:Ou,defaultMatchWidth:"wide",parsePatterns:zu,defaultParseWidth:"any"}),quarter:fe({matchPatterns:_u,defaultMatchWidth:"wide",parsePatterns:Vu,defaultParseWidth:"any",valueCallback:t=>t+1}),month:fe({matchPatterns:Wu,defaultMatchWidth:"wide",parsePatterns:Uu,defaultParseWidth:"any"}),day:fe({matchPatterns:Bu,defaultMatchWidth:"wide",parsePatterns:qu,defaultParseWidth:"any"}),dayPeriod:fe({matchPatterns:Hu,defaultMatchWidth:"any",parsePatterns:Gu,defaultParseWidth:"any"})},$o={code:"es",formatDistance:vu,formatLong:Cu,formatRelative:Du,localize:$u,match:Xu,options:{weekStartsOn:1,firstWeekContainsDate:1}},Ku={lessThanXSeconds:{one:"moins d’une seconde",other:"moins de {{count}} secondes"},xSeconds:{one:"1 seconde",other:"{{count}} secondes"},halfAMinute:"30 secondes",lessThanXMinutes:{one:"moins d’une minute",other:"moins de {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"environ 1 heure",other:"environ {{count}} heures"},xHours:{one:"1 heure",other:"{{count}} heures"},xDays:{one:"1 jour",other:"{{count}} jours"},aboutXWeeks:{one:"environ 1 semaine",other:"environ {{count}} semaines"},xWeeks:{one:"1 semaine",other:"{{count}} semaines"},aboutXMonths:{one:"environ 1 mois",other:"environ {{count}} mois"},xMonths:{one:"1 mois",other:"{{count}} mois"},aboutXYears:{one:"environ 1 an",other:"environ {{count}} ans"},xYears:{one:"1 an",other:"{{count}} ans"},overXYears:{one:"plus d’un an",other:"plus de {{count}} ans"},almostXYears:{one:"presqu’un an",other:"presque {{count}} ans"}},Yu=(t,s,a)=>{let r;const n=Ku[t];return typeof n=="string"?r=n:s===1?r=n.one:r=n.other.replace("{{count}}",String(s)),a?.addSuffix?a.comparison&&a.comparison>0?"dans "+r:"il y a "+r:r},Ju={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},Qu={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Zu={full:"{{date}} 'à' {{time}}",long:"{{date}} 'à' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},em={date:Fe({formats:Ju,defaultWidth:"full"}),time:Fe({formats:Qu,defaultWidth:"full"}),dateTime:Fe({formats:Zu,defaultWidth:"full"})},tm={lastWeek:"eeee 'dernier à' p",yesterday:"'hier à' p",today:"'aujourd’hui à' p",tomorrow:"'demain à' p'",nextWeek:"eeee 'prochain à' p",other:"P"},sm=(t,s,a,r)=>tm[t],am={narrow:["av. J.-C","ap. J.-C"],abbreviated:["av. J.-C","ap. J.-C"],wide:["avant Jésus-Christ","après Jésus-Christ"]},rm={narrow:["T1","T2","T3","T4"],abbreviated:["1er trim.","2ème trim.","3ème trim.","4ème trim."],wide:["1er trimestre","2ème trimestre","3ème trimestre","4ème trimestre"]},nm={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["janv.","févr.","mars","avr.","mai","juin","juil.","août","sept.","oct.","nov.","déc."],wide:["janvier","février","mars","avril","mai","juin","juillet","août","septembre","octobre","novembre","décembre"]},om={narrow:["D","L","M","M","J","V","S"],short:["di","lu","ma","me","je","ve","sa"],abbreviated:["dim.","lun.","mar.","mer.","jeu.","ven.","sam."],wide:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},im={narrow:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"mat.",afternoon:"ap.m.",evening:"soir",night:"mat."},abbreviated:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"matin",afternoon:"après-midi",evening:"soir",night:"matin"},wide:{am:"AM",pm:"PM",midnight:"minuit",noon:"midi",morning:"du matin",afternoon:"de l’après-midi",evening:"du soir",night:"du matin"}},lm=(t,s)=>{const a=Number(t),r=s?.unit;if(a===0)return"0";const n=["year","week","hour","minute","second"];let o;return a===1?o=r&&n.includes(r)?"ère":"er":o="ème",a+o},cm=["MMM","MMMM"],dm={preprocessor:(t,s)=>t.getDate()===1||!s.some(r=>r.isToken&&cm.includes(r.value))?s:s.map(r=>r.isToken&&r.value==="do"?{isToken:!0,value:"d"}:r),ordinalNumber:lm,era:he({values:am,defaultWidth:"wide"}),quarter:he({values:rm,defaultWidth:"wide",argumentCallback:t=>t-1}),month:he({values:nm,defaultWidth:"wide"}),day:he({values:om,defaultWidth:"wide"}),dayPeriod:he({values:im,defaultWidth:"wide"})},um=/^(\d+)(ième|ère|ème|er|e)?/i,mm=/\d+/i,hm={narrow:/^(av\.J\.C|ap\.J\.C|ap\.J\.-C)/i,abbreviated:/^(av\.J\.-C|av\.J-C|apr\.J\.-C|apr\.J-C|ap\.J-C)/i,wide:/^(avant Jésus-Christ|après Jésus-Christ)/i},fm={any:[/^av/i,/^ap/i]},pm={narrow:/^T?[1234]/i,abbreviated:/^[1234](er|ème|e)? trim\.?/i,wide:/^[1234](er|ème|e)? trimestre/i},xm={any:[/1/i,/2/i,/3/i,/4/i]},gm={narrow:/^[jfmasond]/i,abbreviated:/^(janv|févr|mars|avr|mai|juin|juill|juil|août|sept|oct|nov|déc)\.?/i,wide:/^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i},bm={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^av/i,/^ma/i,/^juin/i,/^juil/i,/^ao/i,/^s/i,/^o/i,/^n/i,/^d/i]},jm={narrow:/^[lmjvsd]/i,short:/^(di|lu|ma|me|je|ve|sa)/i,abbreviated:/^(dim|lun|mar|mer|jeu|ven|sam)\.?/i,wide:/^(dimanche|lundi|mardi|mercredi|jeudi|vendredi|samedi)/i},vm={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^j/i,/^v/i,/^s/i],any:[/^di/i,/^lu/i,/^ma/i,/^me/i,/^je/i,/^ve/i,/^sa/i]},wm={narrow:/^(a|p|minuit|midi|mat\.?|ap\.?m\.?|soir|nuit)/i,any:/^([ap]\.?\s?m\.?|du matin|de l'après[-\s]midi|du soir|de la nuit)/i},ym={any:{am:/^a/i,pm:/^p/i,midnight:/^min/i,noon:/^mid/i,morning:/mat/i,afternoon:/ap/i,evening:/soir/i,night:/nuit/i}},Nm={ordinalNumber:as({matchPattern:um,parsePattern:mm,valueCallback:t=>parseInt(t)}),era:fe({matchPatterns:hm,defaultMatchWidth:"wide",parsePatterns:fm,defaultParseWidth:"any"}),quarter:fe({matchPatterns:pm,defaultMatchWidth:"wide",parsePatterns:xm,defaultParseWidth:"any",valueCallback:t=>t+1}),month:fe({matchPatterns:gm,defaultMatchWidth:"wide",parsePatterns:bm,defaultParseWidth:"any"}),day:fe({matchPatterns:jm,defaultMatchWidth:"wide",parsePatterns:vm,defaultParseWidth:"any"}),dayPeriod:fe({matchPatterns:wm,defaultMatchWidth:"any",parsePatterns:ym,defaultParseWidth:"any"})},ps={code:"fr",formatDistance:Yu,formatLong:em,formatRelative:sm,localize:dm,match:Nm,options:{weekStartsOn:1,firstWeekContainsDate:4}},Cm={lessThanXSeconds:{one:"meno di un secondo",other:"meno di {{count}} secondi"},xSeconds:{one:"un secondo",other:"{{count}} secondi"},halfAMinute:"alcuni secondi",lessThanXMinutes:{one:"meno di un minuto",other:"meno di {{count}} minuti"},xMinutes:{one:"un minuto",other:"{{count}} minuti"},aboutXHours:{one:"circa un'ora",other:"circa {{count}} ore"},xHours:{one:"un'ora",other:"{{count}} ore"},xDays:{one:"un giorno",other:"{{count}} giorni"},aboutXWeeks:{one:"circa una settimana",other:"circa {{count}} settimane"},xWeeks:{one:"una settimana",other:"{{count}} settimane"},aboutXMonths:{one:"circa un mese",other:"circa {{count}} mesi"},xMonths:{one:"un mese",other:"{{count}} mesi"},aboutXYears:{one:"circa un anno",other:"circa {{count}} anni"},xYears:{one:"un anno",other:"{{count}} anni"},overXYears:{one:"più di un anno",other:"più di {{count}} anni"},almostXYears:{one:"quasi un anno",other:"quasi {{count}} anni"}},km=(t,s,a)=>{let r;const n=Cm[t];return typeof n=="string"?r=n:s===1?r=n.one:r=n.other.replace("{{count}}",s.toString()),a?.addSuffix?a.comparison&&a.comparison>0?"tra "+r:r+" fa":r},Sm={full:"EEEE d MMMM y",long:"d MMMM y",medium:"d MMM y",short:"dd/MM/y"},Dm={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Tm={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},Am={date:Fe({formats:Sm,defaultWidth:"full"}),time:Fe({formats:Dm,defaultWidth:"full"}),dateTime:Fe({formats:Tm,defaultWidth:"full"})},vr=["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"];function Em(t){switch(t){case 0:return"'domenica scorsa alle' p";default:return"'"+vr[t]+" scorso alle' p"}}function yn(t){return"'"+vr[t]+" alle' p"}function Mm(t){switch(t){case 0:return"'domenica prossima alle' p";default:return"'"+vr[t]+" prossimo alle' p"}}const Pm={lastWeek:(t,s,a)=>{const r=t.getDay();return cr(t,s,a)?yn(r):Em(r)},yesterday:"'ieri alle' p",today:"'oggi alle' p",tomorrow:"'domani alle' p",nextWeek:(t,s,a)=>{const r=t.getDay();return cr(t,s,a)?yn(r):Mm(r)},other:"P"},Rm=(t,s,a,r)=>{const n=Pm[t];return typeof n=="function"?n(s,a,r):n},Fm={narrow:["aC","dC"],abbreviated:["a.C.","d.C."],wide:["avanti Cristo","dopo Cristo"]},$m={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},Lm={narrow:["G","F","M","A","M","G","L","A","S","O","N","D"],abbreviated:["gen","feb","mar","apr","mag","giu","lug","ago","set","ott","nov","dic"],wide:["gennaio","febbraio","marzo","aprile","maggio","giugno","luglio","agosto","settembre","ottobre","novembre","dicembre"]},Im={narrow:["D","L","M","M","G","V","S"],short:["dom","lun","mar","mer","gio","ven","sab"],abbreviated:["dom","lun","mar","mer","gio","ven","sab"],wide:["domenica","lunedì","martedì","mercoledì","giovedì","venerdì","sabato"]},Om={narrow:{am:"m.",pm:"p.",midnight:"mezzanotte",noon:"mezzogiorno",morning:"mattina",afternoon:"pomeriggio",evening:"sera",night:"notte"},abbreviated:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"mattina",afternoon:"pomeriggio",evening:"sera",night:"notte"},wide:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"mattina",afternoon:"pomeriggio",evening:"sera",night:"notte"}},zm={narrow:{am:"m.",pm:"p.",midnight:"mezzanotte",noon:"mezzogiorno",morning:"di mattina",afternoon:"del pomeriggio",evening:"di sera",night:"di notte"},abbreviated:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"di mattina",afternoon:"del pomeriggio",evening:"di sera",night:"di notte"},wide:{am:"AM",pm:"PM",midnight:"mezzanotte",noon:"mezzogiorno",morning:"di mattina",afternoon:"del pomeriggio",evening:"di sera",night:"di notte"}},_m=(t,s)=>{const a=Number(t);return String(a)},Vm={ordinalNumber:_m,era:he({values:Fm,defaultWidth:"wide"}),quarter:he({values:$m,defaultWidth:"wide",argumentCallback:t=>t-1}),month:he({values:Lm,defaultWidth:"wide"}),day:he({values:Im,defaultWidth:"wide"}),dayPeriod:he({values:Om,defaultWidth:"wide",formattingValues:zm,defaultFormattingWidth:"wide"})},Wm=/^(\d+)(º)?/i,Um=/\d+/i,Bm={narrow:/^(aC|dC)/i,abbreviated:/^(a\.?\s?C\.?|a\.?\s?e\.?\s?v\.?|d\.?\s?C\.?|e\.?\s?v\.?)/i,wide:/^(avanti Cristo|avanti Era Volgare|dopo Cristo|Era Volgare)/i},qm={any:[/^a/i,/^(d|e)/i]},Hm={narrow:/^[1234]/i,abbreviated:/^t[1234]/i,wide:/^[1234](º)? trimestre/i},Gm={any:[/1/i,/2/i,/3/i,/4/i]},Xm={narrow:/^[gfmalsond]/i,abbreviated:/^(gen|feb|mar|apr|mag|giu|lug|ago|set|ott|nov|dic)/i,wide:/^(gennaio|febbraio|marzo|aprile|maggio|giugno|luglio|agosto|settembre|ottobre|novembre|dicembre)/i},Km={narrow:[/^g/i,/^f/i,/^m/i,/^a/i,/^m/i,/^g/i,/^l/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ge/i,/^f/i,/^mar/i,/^ap/i,/^mag/i,/^gi/i,/^l/i,/^ag/i,/^s/i,/^o/i,/^n/i,/^d/i]},Ym={narrow:/^[dlmgvs]/i,short:/^(do|lu|ma|me|gi|ve|sa)/i,abbreviated:/^(dom|lun|mar|mer|gio|ven|sab)/i,wide:/^(domenica|luned[i|ì]|marted[i|ì]|mercoled[i|ì]|gioved[i|ì]|venerd[i|ì]|sabato)/i},Jm={narrow:[/^d/i,/^l/i,/^m/i,/^m/i,/^g/i,/^v/i,/^s/i],any:[/^d/i,/^l/i,/^ma/i,/^me/i,/^g/i,/^v/i,/^s/i]},Qm={narrow:/^(a|m\.|p|mezzanotte|mezzogiorno|(di|del) (mattina|pomeriggio|sera|notte))/i,any:/^([ap]\.?\s?m\.?|mezzanotte|mezzogiorno|(di|del) (mattina|pomeriggio|sera|notte))/i},Zm={any:{am:/^a/i,pm:/^p/i,midnight:/^mezza/i,noon:/^mezzo/i,morning:/mattina/i,afternoon:/pomeriggio/i,evening:/sera/i,night:/notte/i}},eh={ordinalNumber:as({matchPattern:Wm,parsePattern:Um,valueCallback:t=>parseInt(t,10)}),era:fe({matchPatterns:Bm,defaultMatchWidth:"wide",parsePatterns:qm,defaultParseWidth:"any"}),quarter:fe({matchPatterns:Hm,defaultMatchWidth:"wide",parsePatterns:Gm,defaultParseWidth:"any",valueCallback:t=>t+1}),month:fe({matchPatterns:Xm,defaultMatchWidth:"wide",parsePatterns:Km,defaultParseWidth:"any"}),day:fe({matchPatterns:Ym,defaultMatchWidth:"wide",parsePatterns:Jm,defaultParseWidth:"any"}),dayPeriod:fe({matchPatterns:Qm,defaultMatchWidth:"any",parsePatterns:Zm,defaultParseWidth:"any"})},Lo={code:"it",formatDistance:km,formatLong:Am,formatRelative:Rm,localize:Vm,match:eh,options:{weekStartsOn:1,firstWeekContainsDate:4}},th={lessThanXSeconds:{one:"1秒未満",other:"{{count}}秒未満",oneWithSuffix:"約1秒",otherWithSuffix:"約{{count}}秒"},xSeconds:{one:"1秒",other:"{{count}}秒"},halfAMinute:"30秒",lessThanXMinutes:{one:"1分未満",other:"{{count}}分未満",oneWithSuffix:"約1分",otherWithSuffix:"約{{count}}分"},xMinutes:{one:"1分",other:"{{count}}分"},aboutXHours:{one:"約1時間",other:"約{{count}}時間"},xHours:{one:"1時間",other:"{{count}}時間"},xDays:{one:"1日",other:"{{count}}日"},aboutXWeeks:{one:"約1週間",other:"約{{count}}週間"},xWeeks:{one:"1週間",other:"{{count}}週間"},aboutXMonths:{one:"約1か月",other:"約{{count}}か月"},xMonths:{one:"1か月",other:"{{count}}か月"},aboutXYears:{one:"約1年",other:"約{{count}}年"},xYears:{one:"1年",other:"{{count}}年"},overXYears:{one:"1年以上",other:"{{count}}年以上"},almostXYears:{one:"1年近く",other:"{{count}}年近く"}},sh=(t,s,a)=>{a=a||{};let r;const n=th[t];return typeof n=="string"?r=n:s===1?a.addSuffix&&n.oneWithSuffix?r=n.oneWithSuffix:r=n.one:a.addSuffix&&n.otherWithSuffix?r=n.otherWithSuffix.replace("{{count}}",String(s)):r=n.other.replace("{{count}}",String(s)),a.addSuffix?a.comparison&&a.comparison>0?r+"後":r+"前":r},ah={full:"y年M月d日EEEE",long:"y年M月d日",medium:"y/MM/dd",short:"y/MM/dd"},rh={full:"H時mm分ss秒 zzzz",long:"H:mm:ss z",medium:"H:mm:ss",short:"H:mm"},nh={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},oh={date:Fe({formats:ah,defaultWidth:"full"}),time:Fe({formats:rh,defaultWidth:"full"}),dateTime:Fe({formats:nh,defaultWidth:"full"})},ih={lastWeek:"先週のeeeeのp",yesterday:"昨日のp",today:"今日のp",tomorrow:"明日のp",nextWeek:"翌週のeeeeのp",other:"P"},lh=(t,s,a,r)=>ih[t],ch={narrow:["BC","AC"],abbreviated:["紀元前","西暦"],wide:["紀元前","西暦"]},dh={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["第1四半期","第2四半期","第3四半期","第4四半期"]},uh={narrow:["1","2","3","4","5","6","7","8","9","10","11","12"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]},mh={narrow:["日","月","火","水","木","金","土"],short:["日","月","火","水","木","金","土"],abbreviated:["日","月","火","水","木","金","土"],wide:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"]},hh={narrow:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},abbreviated:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},wide:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"}},fh={narrow:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},abbreviated:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"},wide:{am:"午前",pm:"午後",midnight:"深夜",noon:"正午",morning:"朝",afternoon:"午後",evening:"夜",night:"深夜"}},ph=(t,s)=>{const a=Number(t);switch(String(s?.unit)){case"year":return`${a}年`;case"quarter":return`第${a}四半期`;case"month":return`${a}月`;case"week":return`第${a}週`;case"date":return`${a}日`;case"hour":return`${a}時`;case"minute":return`${a}分`;case"second":return`${a}秒`;default:return`${a}`}},xh={ordinalNumber:ph,era:he({values:ch,defaultWidth:"wide"}),quarter:he({values:dh,defaultWidth:"wide",argumentCallback:t=>Number(t)-1}),month:he({values:uh,defaultWidth:"wide"}),day:he({values:mh,defaultWidth:"wide"}),dayPeriod:he({values:hh,defaultWidth:"wide",formattingValues:fh,defaultFormattingWidth:"wide"})},gh=/^第?\d+(年|四半期|月|週|日|時|分|秒)?/i,bh=/\d+/i,jh={narrow:/^(B\.?C\.?|A\.?D\.?)/i,abbreviated:/^(紀元[前後]|西暦)/i,wide:/^(紀元[前後]|西暦)/i},vh={narrow:[/^B/i,/^A/i],any:[/^(紀元前)/i,/^(西暦|紀元後)/i]},wh={narrow:/^[1234]/i,abbreviated:/^Q[1234]/i,wide:/^第[1234一二三四1234]四半期/i},yh={any:[/(1|一|1)/i,/(2|二|2)/i,/(3|三|3)/i,/(4|四|4)/i]},Nh={narrow:/^([123456789]|1[012])/,abbreviated:/^([123456789]|1[012])月/i,wide:/^([123456789]|1[012])月/i},Ch={any:[/^1\D/,/^2/,/^3/,/^4/,/^5/,/^6/,/^7/,/^8/,/^9/,/^10/,/^11/,/^12/]},kh={narrow:/^[日月火水木金土]/,short:/^[日月火水木金土]/,abbreviated:/^[日月火水木金土]/,wide:/^[日月火水木金土]曜日/},Sh={any:[/^日/,/^月/,/^火/,/^水/,/^木/,/^金/,/^土/]},Dh={any:/^(AM|PM|午前|午後|正午|深夜|真夜中|夜|朝)/i},Th={any:{am:/^(A|午前)/i,pm:/^(P|午後)/i,midnight:/^深夜|真夜中/i,noon:/^正午/i,morning:/^朝/i,afternoon:/^午後/i,evening:/^夜/i,night:/^深夜/i}},Ah={ordinalNumber:as({matchPattern:gh,parsePattern:bh,valueCallback:function(t){return parseInt(t,10)}}),era:fe({matchPatterns:jh,defaultMatchWidth:"wide",parsePatterns:vh,defaultParseWidth:"any"}),quarter:fe({matchPatterns:wh,defaultMatchWidth:"wide",parsePatterns:yh,defaultParseWidth:"any",valueCallback:t=>t+1}),month:fe({matchPatterns:Nh,defaultMatchWidth:"wide",parsePatterns:Ch,defaultParseWidth:"any"}),day:fe({matchPatterns:kh,defaultMatchWidth:"wide",parsePatterns:Sh,defaultParseWidth:"any"}),dayPeriod:fe({matchPatterns:Dh,defaultMatchWidth:"any",parsePatterns:Th,defaultParseWidth:"any"})},Io={code:"ja",formatDistance:sh,formatLong:oh,formatRelative:lh,localize:xh,match:Ah,options:{weekStartsOn:0,firstWeekContainsDate:1}},Eh={lessThanXSeconds:{one:"menos de um segundo",other:"menos de {{count}} segundos"},xSeconds:{one:"1 segundo",other:"{{count}} segundos"},halfAMinute:"meio minuto",lessThanXMinutes:{one:"menos de um minuto",other:"menos de {{count}} minutos"},xMinutes:{one:"1 minuto",other:"{{count}} minutos"},aboutXHours:{one:"aproximadamente 1 hora",other:"aproximadamente {{count}} horas"},xHours:{one:"1 hora",other:"{{count}} horas"},xDays:{one:"1 dia",other:"{{count}} dias"},aboutXWeeks:{one:"aproximadamente 1 semana",other:"aproximadamente {{count}} semanas"},xWeeks:{one:"1 semana",other:"{{count}} semanas"},aboutXMonths:{one:"aproximadamente 1 mês",other:"aproximadamente {{count}} meses"},xMonths:{one:"1 mês",other:"{{count}} meses"},aboutXYears:{one:"aproximadamente 1 ano",other:"aproximadamente {{count}} anos"},xYears:{one:"1 ano",other:"{{count}} anos"},overXYears:{one:"mais de 1 ano",other:"mais de {{count}} anos"},almostXYears:{one:"quase 1 ano",other:"quase {{count}} anos"}},Mh=(t,s,a)=>{let r;const n=Eh[t];return typeof n=="string"?r=n:s===1?r=n.one:r=n.other.replace("{{count}}",String(s)),a?.addSuffix?a.comparison&&a.comparison>0?"daqui a "+r:"há "+r:r},Ph={full:"EEEE, d 'de' MMMM 'de' y",long:"d 'de' MMMM 'de' y",medium:"d 'de' MMM 'de' y",short:"dd/MM/y"},Rh={full:"HH:mm:ss zzzz",long:"HH:mm:ss z",medium:"HH:mm:ss",short:"HH:mm"},Fh={full:"{{date}} 'às' {{time}}",long:"{{date}} 'às' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},$h={date:Fe({formats:Ph,defaultWidth:"full"}),time:Fe({formats:Rh,defaultWidth:"full"}),dateTime:Fe({formats:Fh,defaultWidth:"full"})},Lh={lastWeek:t=>{const s=t.getDay();return"'"+(s===0||s===6?"último":"última")+"' eeee 'às' p"},yesterday:"'ontem às' p",today:"'hoje às' p",tomorrow:"'amanhã às' p",nextWeek:"eeee 'às' p",other:"P"},Ih=(t,s,a,r)=>{const n=Lh[t];return typeof n=="function"?n(s):n},Oh={narrow:["aC","dC"],abbreviated:["a.C.","d.C."],wide:["antes de Cristo","depois de Cristo"]},zh={narrow:["1","2","3","4"],abbreviated:["T1","T2","T3","T4"],wide:["1º trimestre","2º trimestre","3º trimestre","4º trimestre"]},_h={narrow:["j","f","m","a","m","j","j","a","s","o","n","d"],abbreviated:["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez"],wide:["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro"]},Vh={narrow:["d","s","t","q","q","s","s"],short:["dom","seg","ter","qua","qui","sex","sáb"],abbreviated:["dom","seg","ter","qua","qui","sex","sáb"],wide:["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"]},Wh={narrow:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"noite",night:"madrugada"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"noite",night:"madrugada"},wide:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"manhã",afternoon:"tarde",evening:"noite",night:"madrugada"}},Uh={narrow:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da noite",night:"da madrugada"},abbreviated:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da noite",night:"da madrugada"},wide:{am:"AM",pm:"PM",midnight:"meia-noite",noon:"meio-dia",morning:"da manhã",afternoon:"da tarde",evening:"da noite",night:"da madrugada"}},Bh=(t,s)=>Number(t)+"º",qh={ordinalNumber:Bh,era:he({values:Oh,defaultWidth:"wide"}),quarter:he({values:zh,defaultWidth:"wide",argumentCallback:t=>t-1}),month:he({values:_h,defaultWidth:"wide"}),day:he({values:Vh,defaultWidth:"wide"}),dayPeriod:he({values:Wh,defaultWidth:"wide",formattingValues:Uh,defaultFormattingWidth:"wide"})},Hh=/^(\d+)(º|ª)?/i,Gh=/\d+/i,Xh={narrow:/^(ac|dc|a|d)/i,abbreviated:/^(a\.?\s?c\.?|a\.?\s?e\.?\s?c\.?|d\.?\s?c\.?|e\.?\s?c\.?)/i,wide:/^(antes de cristo|antes da era comum|depois de cristo|era comum)/i},Kh={any:[/^ac/i,/^dc/i],wide:[/^(antes de cristo|antes da era comum)/i,/^(depois de cristo|era comum)/i]},Yh={narrow:/^[1234]/i,abbreviated:/^T[1234]/i,wide:/^[1234](º|ª)? trimestre/i},Jh={any:[/1/i,/2/i,/3/i,/4/i]},Qh={narrow:/^[jfmasond]/i,abbreviated:/^(jan|fev|mar|abr|mai|jun|jul|ago|set|out|nov|dez)/i,wide:/^(janeiro|fevereiro|março|abril|maio|junho|julho|agosto|setembro|outubro|novembro|dezembro)/i},Zh={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ab/i,/^mai/i,/^jun/i,/^jul/i,/^ag/i,/^s/i,/^o/i,/^n/i,/^d/i]},ef={narrow:/^[dstq]/i,short:/^(dom|seg|ter|qua|qui|sex|s[áa]b)/i,abbreviated:/^(dom|seg|ter|qua|qui|sex|s[áa]b)/i,wide:/^(domingo|segunda-?\s?feira|terça-?\s?feira|quarta-?\s?feira|quinta-?\s?feira|sexta-?\s?feira|s[áa]bado)/i},tf={narrow:[/^d/i,/^s/i,/^t/i,/^q/i,/^q/i,/^s/i,/^s/i],any:[/^d/i,/^seg/i,/^t/i,/^qua/i,/^qui/i,/^sex/i,/^s[áa]/i]},sf={narrow:/^(a|p|meia-?\s?noite|meio-?\s?dia|(da) (manh[ãa]|tarde|noite|madrugada))/i,any:/^([ap]\.?\s?m\.?|meia-?\s?noite|meio-?\s?dia|(da) (manh[ãa]|tarde|noite|madrugada))/i},af={any:{am:/^a/i,pm:/^p/i,midnight:/^meia/i,noon:/^meio/i,morning:/manh[ãa]/i,afternoon:/tarde/i,evening:/noite/i,night:/madrugada/i}},rf={ordinalNumber:as({matchPattern:Hh,parsePattern:Gh,valueCallback:t=>parseInt(t,10)}),era:fe({matchPatterns:Xh,defaultMatchWidth:"wide",parsePatterns:Kh,defaultParseWidth:"any"}),quarter:fe({matchPatterns:Yh,defaultMatchWidth:"wide",parsePatterns:Jh,defaultParseWidth:"any",valueCallback:t=>t+1}),month:fe({matchPatterns:Qh,defaultMatchWidth:"wide",parsePatterns:Zh,defaultParseWidth:"any"}),day:fe({matchPatterns:ef,defaultMatchWidth:"wide",parsePatterns:tf,defaultParseWidth:"any"}),dayPeriod:fe({matchPatterns:sf,defaultMatchWidth:"any",parsePatterns:af,defaultParseWidth:"any"})},Oo={code:"pt",formatDistance:Mh,formatLong:$h,formatRelative:Ih,localize:qh,match:rf,options:{weekStartsOn:1,firstWeekContainsDate:4}},nf={lessThanXSeconds:{one:"不到 1 秒",other:"不到 {{count}} 秒"},xSeconds:{one:"1 秒",other:"{{count}} 秒"},halfAMinute:"半分钟",lessThanXMinutes:{one:"不到 1 分钟",other:"不到 {{count}} 分钟"},xMinutes:{one:"1 分钟",other:"{{count}} 分钟"},xHours:{one:"1 小时",other:"{{count}} 小时"},aboutXHours:{one:"大约 1 小时",other:"大约 {{count}} 小时"},xDays:{one:"1 天",other:"{{count}} 天"},aboutXWeeks:{one:"大约 1 个星期",other:"大约 {{count}} 个星期"},xWeeks:{one:"1 个星期",other:"{{count}} 个星期"},aboutXMonths:{one:"大约 1 个月",other:"大约 {{count}} 个月"},xMonths:{one:"1 个月",other:"{{count}} 个月"},aboutXYears:{one:"大约 1 年",other:"大约 {{count}} 年"},xYears:{one:"1 年",other:"{{count}} 年"},overXYears:{one:"超过 1 年",other:"超过 {{count}} 年"},almostXYears:{one:"将近 1 年",other:"将近 {{count}} 年"}},of=(t,s,a)=>{let r;const n=nf[t];return typeof n=="string"?r=n:s===1?r=n.one:r=n.other.replace("{{count}}",String(s)),a?.addSuffix?a.comparison&&a.comparison>0?r+"内":r+"前":r},lf={full:"y'年'M'月'd'日' EEEE",long:"y'年'M'月'd'日'",medium:"yyyy-MM-dd",short:"yy-MM-dd"},cf={full:"zzzz a h:mm:ss",long:"z a h:mm:ss",medium:"a h:mm:ss",short:"a h:mm"},df={full:"{{date}} {{time}}",long:"{{date}} {{time}}",medium:"{{date}} {{time}}",short:"{{date}} {{time}}"},uf={date:Fe({formats:lf,defaultWidth:"full"}),time:Fe({formats:cf,defaultWidth:"full"}),dateTime:Fe({formats:df,defaultWidth:"full"})};function Nn(t,s,a){const r="eeee p";return cr(t,s,a)?r:t.getTime()>s.getTime()?"'下个'"+r:"'上个'"+r}const mf={lastWeek:Nn,yesterday:"'昨天' p",today:"'今天' p",tomorrow:"'明天' p",nextWeek:Nn,other:"PP p"},hf=(t,s,a,r)=>{const n=mf[t];return typeof n=="function"?n(s,a,r):n},ff={narrow:["前","公元"],abbreviated:["前","公元"],wide:["公元前","公元"]},pf={narrow:["1","2","3","4"],abbreviated:["第一季","第二季","第三季","第四季"],wide:["第一季度","第二季度","第三季度","第四季度"]},xf={narrow:["一","二","三","四","五","六","七","八","九","十","十一","十二"],abbreviated:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],wide:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"]},gf={narrow:["日","一","二","三","四","五","六"],short:["日","一","二","三","四","五","六"],abbreviated:["周日","周一","周二","周三","周四","周五","周六"],wide:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},bf={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},jf={narrow:{am:"上",pm:"下",midnight:"凌晨",noon:"午",morning:"早",afternoon:"下午",evening:"晚",night:"夜"},abbreviated:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"},wide:{am:"上午",pm:"下午",midnight:"凌晨",noon:"中午",morning:"早晨",afternoon:"中午",evening:"晚上",night:"夜间"}},vf=(t,s)=>{const a=Number(t);switch(s?.unit){case"date":return a.toString()+"日";case"hour":return a.toString()+"时";case"minute":return a.toString()+"分";case"second":return a.toString()+"秒";default:return"第 "+a.toString()}},wf={ordinalNumber:vf,era:he({values:ff,defaultWidth:"wide"}),quarter:he({values:pf,defaultWidth:"wide",argumentCallback:t=>t-1}),month:he({values:xf,defaultWidth:"wide"}),day:he({values:gf,defaultWidth:"wide"}),dayPeriod:he({values:bf,defaultWidth:"wide",formattingValues:jf,defaultFormattingWidth:"wide"})},yf=/^(第\s*)?\d+(日|时|分|秒)?/i,Nf=/\d+/i,Cf={narrow:/^(前)/i,abbreviated:/^(前)/i,wide:/^(公元前|公元)/i},kf={any:[/^(前)/i,/^(公元)/i]},Sf={narrow:/^[1234]/i,abbreviated:/^第[一二三四]刻/i,wide:/^第[一二三四]刻钟/i},Df={any:[/(1|一)/i,/(2|二)/i,/(3|三)/i,/(4|四)/i]},Tf={narrow:/^(一|二|三|四|五|六|七|八|九|十[二一])/i,abbreviated:/^(一|二|三|四|五|六|七|八|九|十[二一]|\d|1[12])月/i,wide:/^(一|二|三|四|五|六|七|八|九|十[二一])月/i},Af={narrow:[/^一/i,/^二/i,/^三/i,/^四/i,/^五/i,/^六/i,/^七/i,/^八/i,/^九/i,/^十(?!(一|二))/i,/^十一/i,/^十二/i],any:[/^一|1/i,/^二|2/i,/^三|3/i,/^四|4/i,/^五|5/i,/^六|6/i,/^七|7/i,/^八|8/i,/^九|9/i,/^十(?!(一|二))|10/i,/^十一|11/i,/^十二|12/i]},Ef={narrow:/^[一二三四五六日]/i,short:/^[一二三四五六日]/i,abbreviated:/^周[一二三四五六日]/i,wide:/^星期[一二三四五六日]/i},Mf={any:[/日/i,/一/i,/二/i,/三/i,/四/i,/五/i,/六/i]},Pf={any:/^(上午?|下午?|午夜|[中正]午|早上?|下午|晚上?|凌晨|)/i},Rf={any:{am:/^上午?/i,pm:/^下午?/i,midnight:/^午夜/i,noon:/^[中正]午/i,morning:/^早上/i,afternoon:/^下午/i,evening:/^晚上?/i,night:/^凌晨/i}},Ff={ordinalNumber:as({matchPattern:yf,parsePattern:Nf,valueCallback:t=>parseInt(t,10)}),era:fe({matchPatterns:Cf,defaultMatchWidth:"wide",parsePatterns:kf,defaultParseWidth:"any"}),quarter:fe({matchPatterns:Sf,defaultMatchWidth:"wide",parsePatterns:Df,defaultParseWidth:"any",valueCallback:t=>t+1}),month:fe({matchPatterns:Tf,defaultMatchWidth:"wide",parsePatterns:Af,defaultParseWidth:"any"}),day:fe({matchPatterns:Ef,defaultMatchWidth:"wide",parsePatterns:Mf,defaultParseWidth:"any"}),dayPeriod:fe({matchPatterns:Pf,defaultMatchWidth:"any",parsePatterns:Rf,defaultParseWidth:"any"})},zo={code:"zh-CN",formatDistance:of,formatLong:uf,formatRelative:hf,localize:wf,match:Ff,options:{weekStartsOn:1,firstWeekContainsDate:4}},$f=(t=ps)=>[{label:"Aujourd'hui",value:()=>new Date},{label:"Hier",value:()=>V.subDays(new Date,1)},{label:"Demain",value:()=>V.addDays(new Date,1)},{label:"Cette semaine",range:()=>({from:V.startOfWeek(new Date,{locale:t}),to:V.endOfWeek(new Date,{locale:t})})},{label:"Semaine dernière",range:()=>({from:V.startOfWeek(V.subWeeks(new Date,1),{locale:t}),to:V.endOfWeek(V.subWeeks(new Date,1),{locale:t})})},{label:"Ce mois",range:()=>({from:V.startOfMonth(new Date),to:V.endOfMonth(new Date)})},{label:"Mois dernier",range:()=>({from:V.startOfMonth(V.subMonths(new Date,1)),to:V.endOfMonth(V.subMonths(new Date,1))})},{label:"Ce trimestre",range:()=>({from:V.startOfQuarter(new Date),to:V.endOfQuarter(new Date)})},{label:"Cette année",range:()=>({from:V.startOfYear(new Date),to:V.endOfYear(new Date)})}],Lf=()=>[{label:"7 derniers jours",range:()=>({from:V.subDays(new Date,7),to:new Date})},{label:"30 derniers jours",range:()=>({from:V.subDays(new Date,30),to:new Date})},{label:"90 derniers jours",range:()=>({from:V.subDays(new Date,90),to:new Date})}],If=t=>t.map(s=>({label:`${s} prochains jours`,range:()=>({from:new Date,to:V.addDays(new Date,s)})})),Of=(t,s)=>{if(typeof s=="function"){const a=s();return"from"in a&&a.from&&a.to?{label:t,range:()=>({from:a.from,to:a.to})}:{label:t,value:s}}return"from"in s&&s.from&&s.to?{label:t,range:{from:s.from,to:s.to}}:{label:t,value:s}},zf=t=>V.isAfter(t,V.endOfDay(new Date)),_o=t=>V.isBefore(t,V.startOfDay(new Date)),_f=t=>{const s=new Date;return t.getDate()===s.getDate()&&t.getMonth()===s.getMonth()&&t.getFullYear()===s.getFullYear()},wr=t=>{const s=t.getDay();return s!==0&&s!==6},Vo=t=>{const s=t.getDay();return s===0||s===6},Wo=(t,s)=>s.some(a=>V.isEqual(V.startOfDay(a),V.startOfDay(t))),Lt=(t,s,a)=>V.isWithinInterval(t,{start:s,end:a}),Vf=t=>s=>{const a=V.subYears(new Date,t);return V.isAfter(s,a)?`L'âge minimum est de ${t} ans`:!0},Wf=t=>s=>{const a=V.subYears(new Date,t);return V.isBefore(s,a)?`L'âge maximum est de ${t} ans`:!0},Uf=t=>_o(t)?"Cette date est expirée":!0,Bf=(t,s)=>({days:V.differenceInDays(s,t),weeks:V.differenceInWeeks(s,t),months:V.differenceInMonths(s,t)}),qf=(t,s="PPP",a=ps)=>t.from?t.to?`${V.format(t.from,s,{locale:a})} - ${V.format(t.to,s,{locale:a})}`:V.format(t.from,s,{locale:a}):"",Hf=t=>[new Date(t,0,1),new Date(t,4,1),new Date(t,4,8),new Date(t,6,14),new Date(t,7,15),new Date(t,10,1),new Date(t,10,11),new Date(t,11,25)],yr=(t,s)=>{const a=[],r=V.startOfMonth(new Date(t,s)),n=V.endOfMonth(new Date(t,s));let o=r;for(;V.isBefore(o,n)||V.isEqual(o,n);)a.push(o),o=V.addDays(o,1);return a},Gf=(t,s)=>yr(t,s).filter(Vo),Xf=(t,s)=>yr(t,s).filter(wr),Kf=()=>t=>{const s=new Date,a=V.endOfMonth(t);if(V.isBefore(a,s))return"La carte est expirée";const r=V.addMonths(s,3);return V.isBefore(a,r)?"La carte expire bientôt":!0},Yf=t=>s=>{const a=V.addDays(new Date,t);return V.isBefore(s,a)?`La réservation doit être faite ${t} jours à l'avance minimum`:!0},Jf=t=>s=>!s.from||!s.to?!0:V.differenceInDays(s.to,s.from)>t?`La période ne peut pas dépasser ${t} jours`:!0,Qf=(t,s)=>V.isEqual(V.startOfDay(t),V.startOfDay(s)),Zf=(t,s,a=[])=>{let r=0,n=V.startOfDay(t);const o=V.startOfDay(s);for(;V.isBefore(n,o)||V.isEqual(n,o);)wr(n)&&!Wo(n,a)&&r++,n=V.addDays(n,1);return r},ep=t=>{const s=t||new Date().getFullYear();return[1,2,3,4].map(a=>{const r=V.startOfQuarter(new Date(s,(a-1)*3,1)),n=V.endOfQuarter(r);return{label:`T${a} ${s}`,range:()=>({from:r,to:n})}})},tp=(t,s=ps)=>{const a=t||new Date().getFullYear();return Array.from({length:12},(r,n)=>{const o=V.startOfMonth(new Date(a,n,1)),i=V.endOfMonth(o);return{label:V.format(o,"MMMM yyyy",{locale:s}),range:()=>({from:o,to:i})}})},sp=t=>t.getTime(),ap=t=>new Date(t),rp=t=>V.startOfDay(t),np=(t,s)=>!t.from||!t.to||!s.from||!s.to?!1:V.isEqual(V.startOfDay(t.from),V.startOfDay(s.from))&&V.isEqual(V.startOfDay(t.to),V.startOfDay(s.to)),op=(t,s)=>!t.from||!t.to||!s.from||!s.to||!(Lt(t.from,s.from,s.to)||Lt(t.to,s.from,s.to)||Lt(s.from,t.from,t.to)||Lt(s.to,t.from,t.to))?null:{from:V.isBefore(t.from,s.from)?t.from:s.from,to:V.isAfter(t.to,s.to)?t.to:s.to},ip=(t,s)=>!t.from||!t.to||!s.from||!s.to?!1:Lt(t.from,s.from,s.to)||Lt(t.to,s.from,s.to)||Lt(s.from,t.from,t.to)||Lt(s.to,t.from,t.to);class Nr{constructor(s){this.loadedThemes=new Set,this.styleElements=new Map,this.config={baseUrl:s.baseUrl,cache:s.cache??!0,timeout:s.timeout??1e4,onError:s.onError??(a=>console.error("Theme loading error:",a)),onSuccess:s.onSuccess??(()=>{})}}async loadTheme(s){if(this.config.cache&&this.loadedThemes.has(s)){console.log(`Theme "${s}" already loaded from cache`),this.applyTheme(s);return}try{const a=new AbortController,r=setTimeout(()=>a.abort(),this.config.timeout),n=this.buildThemeUrl(s);console.log(`Loading theme from: ${n}`);const o=await fetch(n,{signal:a.signal,headers:{Accept:"text/css"}});if(clearTimeout(r),!o.ok)throw new Error(`Failed to load theme: ${o.status} ${o.statusText}`);const i=await o.text();if(!i.includes(`[data-theme="${s}"]`))throw new Error(`Invalid theme CSS: missing [data-theme="${s}"] selector`);this.injectThemeStyles(s,i),this.loadedThemes.add(s),this.applyTheme(s),this.config.onSuccess(s)}catch(a){const r=a instanceof Error?a:new Error(String(a));throw this.config.onError(r,s),r}}applyTheme(s){if(typeof document>"u")return;document.documentElement.setAttribute("data-theme",s);try{localStorage.setItem("theme",s)}catch(r){console.warn("Could not save theme to localStorage:",r)}console.log(`Applied theme: ${s}`)}getCurrentTheme(){return typeof document>"u"?null:document.documentElement.getAttribute("data-theme")}loadSavedTheme(){if(typeof window>"u")return null;try{return localStorage.getItem("theme")}catch(s){return console.warn("Could not load theme from localStorage:",s),null}}async preloadThemes(s){console.log(`Preloading ${s.length} themes...`),await Promise.allSettled(s.map(a=>this.loadTheme(a))),console.log(`Preloaded ${this.loadedThemes.size} themes`)}unloadTheme(s){const a=this.styleElements.get(s);a&&(a.remove(),this.styleElements.delete(s)),this.loadedThemes.delete(s),console.log(`Unloaded theme: ${s}`)}clearCache(){this.styleElements.forEach(s=>s.remove()),this.styleElements.clear(),this.loadedThemes.clear(),console.log("Theme cache cleared")}getLoadedThemes(){return Array.from(this.loadedThemes)}buildThemeUrl(s){return`${this.config.baseUrl.replace(/\/$/,"")}/${s}.css`}injectThemeStyles(s,a){if(typeof document>"u")return;const r=this.styleElements.get(s);r&&r.remove();const n=document.createElement("style");n.setAttribute("data-theme-name",s),n.textContent=a,document.head.appendChild(n),this.styleElements.set(s,n)}}let Gs=null;function lp(t){return Gs=new Nr(t),Gs}function Cr(){if(!Gs)throw new Error("ThemeLoader not initialized. Call initThemeLoader() first.");return Gs}async function cp(t){return Cr().loadTheme(t)}function dp(t){Cr().applyTheme(t)}function up(t){if(typeof window>"u")return{loadTheme:async()=>{},applyTheme:()=>{},currentTheme:null,loadedThemes:[],isLoading:!1};const s=Gs||new Nr({baseUrl:t?.baseUrl||"/themes",...t}),[a,r]=c.useState(!1),[n,o]=c.useState(s.getCurrentTheme());return{loadTheme:async u=>{r(!0);try{await s.loadTheme(u),o(u)}finally{r(!1)}},applyTheme:u=>{s.applyTheme(u),o(u)},currentTheme:n,loadedThemes:s.getLoadedThemes(),isLoading:a}}var Cn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mp(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ba={exports:{}},kn;function hp(){return kn||(kn=1,(function(t){var s=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var a=(function(r){var n=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,o=0,i={},l={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function x(v){return v instanceof u?new u(v.type,x(v.content),v.alias):Array.isArray(v)?v.map(x):v.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(x){return Object.prototype.toString.call(x).slice(8,-1)},objId:function(x){return x.__id||Object.defineProperty(x,"__id",{value:++o}),x.__id},clone:function x(v,k){k=k||{};var N,D;switch(l.util.type(v)){case"Object":if(D=l.util.objId(v),k[D])return k[D];N={},k[D]=N;for(var P in v)v.hasOwnProperty(P)&&(N[P]=x(v[P],k));return N;case"Array":return D=l.util.objId(v),k[D]?k[D]:(N=[],k[D]=N,v.forEach(function(R,A){N[A]=x(R,k)}),N);default:return v}},getLanguage:function(x){for(;x;){var v=n.exec(x.className);if(v)return v[1].toLowerCase();x=x.parentElement}return"none"},setLanguage:function(x,v){x.className=x.className.replace(RegExp(n,"gi"),""),x.classList.add("language-"+v)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(N){var x=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(N.stack)||[])[1];if(x){var v=document.getElementsByTagName("script");for(var k in v)if(v[k].src==x)return v[k]}return null}},isActive:function(x,v,k){for(var N="no-"+v;x;){var D=x.classList;if(D.contains(v))return!0;if(D.contains(N))return!1;x=x.parentElement}return!!k}},languages:{plain:i,plaintext:i,text:i,txt:i,extend:function(x,v){var k=l.util.clone(l.languages[x]);for(var N in v)k[N]=v[N];return k},insertBefore:function(x,v,k,N){N=N||l.languages;var D=N[x],P={};for(var R in D)if(D.hasOwnProperty(R)){if(R==v)for(var A in k)k.hasOwnProperty(A)&&(P[A]=k[A]);k.hasOwnProperty(R)||(P[R]=D[R])}var S=N[x];return N[x]=P,l.languages.DFS(l.languages,function(M,E){E===S&&M!=x&&(this[M]=P)}),P},DFS:function x(v,k,N,D){D=D||{};var P=l.util.objId;for(var R in v)if(v.hasOwnProperty(R)){k.call(v,R,v[R],N||R);var A=v[R],S=l.util.type(A);S==="Object"&&!D[P(A)]?(D[P(A)]=!0,x(A,k,null,D)):S==="Array"&&!D[P(A)]&&(D[P(A)]=!0,x(A,k,R,D))}}},plugins:{},highlightAll:function(x,v){l.highlightAllUnder(document,x,v)},highlightAllUnder:function(x,v,k){var N={callback:k,container:x,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};l.hooks.run("before-highlightall",N),N.elements=Array.prototype.slice.apply(N.container.querySelectorAll(N.selector)),l.hooks.run("before-all-elements-highlight",N);for(var D=0,P;P=N.elements[D++];)l.highlightElement(P,v===!0,N.callback)},highlightElement:function(x,v,k){var N=l.util.getLanguage(x),D=l.languages[N];l.util.setLanguage(x,N);var P=x.parentElement;P&&P.nodeName.toLowerCase()==="pre"&&l.util.setLanguage(P,N);var R=x.textContent,A={element:x,language:N,grammar:D,code:R};function S(E){A.highlightedCode=E,l.hooks.run("before-insert",A),A.element.innerHTML=A.highlightedCode,l.hooks.run("after-highlight",A),l.hooks.run("complete",A),k&&k.call(A.element)}if(l.hooks.run("before-sanity-check",A),P=A.element.parentElement,P&&P.nodeName.toLowerCase()==="pre"&&!P.hasAttribute("tabindex")&&P.setAttribute("tabindex","0"),!A.code){l.hooks.run("complete",A),k&&k.call(A.element);return}if(l.hooks.run("before-highlight",A),!A.grammar){S(l.util.encode(A.code));return}if(v&&r.Worker){var M=new Worker(l.filename);M.onmessage=function(E){S(E.data)},M.postMessage(JSON.stringify({language:A.language,code:A.code,immediateClose:!0}))}else S(l.highlight(A.code,A.grammar,A.language))},highlight:function(x,v,k){var N={code:x,grammar:v,language:k};if(l.hooks.run("before-tokenize",N),!N.grammar)throw new Error('The language "'+N.language+'" has no grammar.');return N.tokens=l.tokenize(N.code,N.grammar),l.hooks.run("after-tokenize",N),u.stringify(l.util.encode(N.tokens),N.language)},tokenize:function(x,v){var k=v.rest;if(k){for(var N in k)v[N]=k[N];delete v.rest}var D=new m;return p(D,D.head,x),f(x,D,v,D.head,0),C(D)},hooks:{all:{},add:function(x,v){var k=l.hooks.all;k[x]=k[x]||[],k[x].push(v)},run:function(x,v){var k=l.hooks.all[x];if(!(!k||!k.length))for(var N=0,D;D=k[N++];)D(v)}},Token:u};r.Prism=l;function u(x,v,k,N){this.type=x,this.content=v,this.alias=k,this.length=(N||"").length|0}u.stringify=function x(v,k){if(typeof v=="string")return v;if(Array.isArray(v)){var N="";return v.forEach(function(S){N+=x(S,k)}),N}var D={type:v.type,content:x(v.content,k),tag:"span",classes:["token",v.type],attributes:{},language:k},P=v.alias;P&&(Array.isArray(P)?Array.prototype.push.apply(D.classes,P):D.classes.push(P)),l.hooks.run("wrap",D);var R="";for(var A in D.attributes)R+=" "+A+'="'+(D.attributes[A]||"").replace(/"/g,"&quot;")+'"';return"<"+D.tag+' class="'+D.classes.join(" ")+'"'+R+">"+D.content+"</"+D.tag+">"};function d(x,v,k,N){x.lastIndex=v;var D=x.exec(k);if(D&&N&&D[1]){var P=D[1].length;D.index+=P,D[0]=D[0].slice(P)}return D}function f(x,v,k,N,D,P){for(var R in k)if(!(!k.hasOwnProperty(R)||!k[R])){var A=k[R];A=Array.isArray(A)?A:[A];for(var S=0;S<A.length;++S){if(P&&P.cause==R+","+S)return;var M=A[S],E=M.inside,T=!!M.lookbehind,K=!!M.greedy,q=M.alias;if(K&&!M.pattern.global){var B=M.pattern.toString().match(/[imsuy]*$/)[0];M.pattern=RegExp(M.pattern.source,B+"g")}for(var W=M.pattern||M,I=N.next,z=D;I!==v.tail&&!(P&&z>=P.reach);z+=I.value.length,I=I.next){var $=I.value;if(v.length>x.length)return;if(!($ instanceof u)){var _=1,F;if(K){if(F=d(W,z,x,T),!F||F.index>=x.length)break;var ne=F.index,H=F.index+F[0].length,J=z;for(J+=I.value.length;ne>=J;)I=I.next,J+=I.value.length;if(J-=I.value.length,z=J,I.value instanceof u)continue;for(var Q=I;Q!==v.tail&&(J<H||typeof Q.value=="string");Q=Q.next)_++,J+=Q.value.length;_--,$=x.slice(z,J),F.index-=z}else if(F=d(W,0,$,T),!F)continue;var ne=F.index,X=F[0],Y=$.slice(0,ne),U=$.slice(ne+X.length),ae=z+$.length;P&&ae>P.reach&&(P.reach=ae);var te=I.prev;Y&&(te=p(v,te,Y),z+=Y.length),w(v,te,_);var Z=new u(R,E?l.tokenize(X,E):X,q,X);if(I=p(v,te,Z),U&&p(v,I,U),_>1){var le={cause:R+","+S,reach:ae};f(x,v,k,I.prev,z,le),P&&le.reach>P.reach&&(P.reach=le.reach)}}}}}}function m(){var x={value:null,prev:null,next:null},v={value:null,prev:x,next:null};x.next=v,this.head=x,this.tail=v,this.length=0}function p(x,v,k){var N=v.next,D={value:k,prev:v,next:N};return v.next=D,N.prev=D,x.length++,D}function w(x,v,k){for(var N=v.next,D=0;D<k&&N!==x.tail;D++)N=N.next;v.next=N,N.prev=v,x.length-=D}function C(x){for(var v=[],k=x.head.next;k!==x.tail;)v.push(k.value),k=k.next;return v}if(!r.document)return r.addEventListener&&(l.disableWorkerMessageHandler||r.addEventListener("message",function(x){var v=JSON.parse(x.data),k=v.language,N=v.code,D=v.immediateClose;r.postMessage(l.highlight(N,l.languages[k],k)),D&&r.close()},!1)),l;var g=l.util.currentScript();g&&(l.filename=g.src,g.hasAttribute("data-manual")&&(l.manual=!0));function y(){l.manual||l.highlightAll()}if(!l.manual){var j=document.readyState;j==="loading"||j==="interactive"&&g&&g.defer?document.addEventListener("DOMContentLoaded",y):window.requestAnimationFrame?window.requestAnimationFrame(y):window.setTimeout(y,16)}return l})(s);t.exports&&(t.exports=a),typeof Cn<"u"&&(Cn.Prism=a),a.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},a.languages.markup.tag.inside["attr-value"].inside.entity=a.languages.markup.entity,a.languages.markup.doctype.inside["internal-subset"].inside=a.languages.markup,a.hooks.add("wrap",function(r){r.type==="entity"&&(r.attributes.title=r.content.replace(/&amp;/,"&"))}),Object.defineProperty(a.languages.markup.tag,"addInlined",{value:function(n,o){var i={};i["language-"+o]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:a.languages[o]},i.cdata=/^<!\[CDATA\[|\]\]>$/i;var l={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:i}};l["language-"+o]={pattern:/[\s\S]+/,inside:a.languages[o]};var u={};u[n]={pattern:RegExp(/(<__[^>]*>)(?:<!\[CDATA\[(?:[^\]]|\](?!\]>))*\]\]>|(?!<!\[CDATA\[)[\s\S])*?(?=<\/__>)/.source.replace(/__/g,function(){return n}),"i"),lookbehind:!0,greedy:!0,inside:l},a.languages.insertBefore("markup","cdata",u)}}),Object.defineProperty(a.languages.markup.tag,"addAttribute",{value:function(r,n){a.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+r+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[n,"language-"+n],inside:a.languages[n]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),a.languages.html=a.languages.markup,a.languages.mathml=a.languages.markup,a.languages.svg=a.languages.markup,a.languages.xml=a.languages.extend("markup",{}),a.languages.ssml=a.languages.xml,a.languages.atom=a.languages.xml,a.languages.rss=a.languages.xml,(function(r){var n=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;r.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+n.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+n.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+n.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+n.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:n,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},r.languages.css.atrule.inside.rest=r.languages.css;var o=r.languages.markup;o&&(o.tag.addInlined("style","css"),o.tag.addAttribute("style","css"))})(a),a.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},a.languages.javascript=a.languages.extend("clike",{"class-name":[a.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),a.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,a.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:a.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:a.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:a.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:a.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:a.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),a.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:a.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),a.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),a.languages.markup&&(a.languages.markup.tag.addInlined("script","javascript"),a.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),a.languages.js=a.languages.javascript,(function(){if(typeof a>"u"||typeof document>"u")return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var r="Loading…",n=function(g,y){return"✖ Error "+g+" while fetching file: "+y},o="✖ Error: File does not exist or is empty",i={js:"javascript",py:"python",rb:"ruby",ps1:"powershell",psm1:"powershell",sh:"bash",bat:"batch",h:"c",tex:"latex"},l="data-src-status",u="loading",d="loaded",f="failed",m="pre[data-src]:not(["+l+'="'+d+'"]):not(['+l+'="'+u+'"])';function p(g,y,j){var x=new XMLHttpRequest;x.open("GET",g,!0),x.onreadystatechange=function(){x.readyState==4&&(x.status<400&&x.responseText?y(x.responseText):x.status>=400?j(n(x.status,x.statusText)):j(o))},x.send(null)}function w(g){var y=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(g||"");if(y){var j=Number(y[1]),x=y[2],v=y[3];return x?v?[j,Number(v)]:[j,void 0]:[j,j]}}a.hooks.add("before-highlightall",function(g){g.selector+=", "+m}),a.hooks.add("before-sanity-check",function(g){var y=g.element;if(y.matches(m)){g.code="",y.setAttribute(l,u);var j=y.appendChild(document.createElement("CODE"));j.textContent=r;var x=y.getAttribute("data-src"),v=g.language;if(v==="none"){var k=(/\.(\w+)$/.exec(x)||[,"none"])[1];v=i[k]||k}a.util.setLanguage(j,v),a.util.setLanguage(y,v);var N=a.plugins.autoloader;N&&N.loadLanguages(v),p(x,function(D){y.setAttribute(l,d);var P=w(y.getAttribute("data-range"));if(P){var R=D.split(/\r\n?|\n/g),A=P[0],S=P[1]==null?R.length:P[1];A<0&&(A+=R.length),A=Math.max(0,Math.min(A-1,R.length)),S<0&&(S+=R.length),S=Math.max(0,Math.min(S,R.length)),D=R.slice(A,S).join(`
2
+ `),y.hasAttribute("data-start")||y.setAttribute("data-start",String(A+1))}j.textContent=D,a.highlightElement(j)},function(D){y.setAttribute(l,f),j.textContent=D})}}),a.plugins.fileHighlight={highlight:function(y){for(var j=(y||document).querySelectorAll(m),x=0,v;v=j[x++];)a.highlightElement(v)}};var C=!1;a.fileHighlight=function(){C||(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),C=!0),a.plugins.fileHighlight.highlight.apply(this,arguments)}})()})(Ba)),Ba.exports}var fp=hp();const qa=mp(fp);var Sn={},Dn;function pp(){return Dn||(Dn=1,(function(t){t.languages.typescript=t.languages.extend("javascript",{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),t.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete t.languages.typescript.parameter,delete t.languages.typescript["literal-property"];var s=t.languages.extend("typescript",{});delete s["class-name"],t.languages.typescript["class-name"].inside=s,t.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:s}}}}),t.languages.ts=t.languages.typescript})(Prism)),Sn}pp();Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/});Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/;Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/});Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}});Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}});Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript"));Prism.languages.js=Prism.languages.javascript;(function(t){var s=t.util.clone(t.languages.javascript),a=/(?:\s|\/\/.*(?!.)|\/\*(?:[^*]|\*(?!\/))\*\/)/.source,r=/(?:\{(?:\{(?:\{[^{}]*\}|[^{}])*\}|[^{}])*\})/.source,n=/(?:\{<S>*\.{3}(?:[^{}]|<BRACES>)*\})/.source;function o(u,d){return u=u.replace(/<S>/g,function(){return a}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return n}),RegExp(u,d)}n=o(n).source,t.languages.jsx=t.languages.extend("markup",s),t.languages.jsx.tag.pattern=o(/<\/?(?:[\w.:-]+(?:<S>+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\/?)?>/.source),t.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,t.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,t.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,t.languages.jsx.tag.inside.comment=s.comment,t.languages.insertBefore("inside","attr-name",{spread:{pattern:o(/<SPREAD>/.source),inside:t.languages.jsx}},t.languages.jsx.tag),t.languages.insertBefore("inside","special-attr",{script:{pattern:o(/=<BRACES>/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:t.languages.jsx}}},t.languages.jsx.tag);var i=function(u){return u?typeof u=="string"?u:typeof u.content=="string"?u.content:u.content.map(i).join(""):""},l=function(u){for(var d=[],f=0;f<u.length;f++){var m=u[f],p=!1;if(typeof m!="string"&&(m.type==="tag"&&m.content[0]&&m.content[0].type==="tag"?m.content[0].content[0].content==="</"?d.length>0&&d[d.length-1].tagName===i(m.content[0].content[1])&&d.pop():m.content[m.content.length-1].content==="/>"||d.push({tagName:i(m.content[0].content[1]),openedBraces:0}):d.length>0&&m.type==="punctuation"&&m.content==="{"?d[d.length-1].openedBraces++:d.length>0&&d[d.length-1].openedBraces>0&&m.type==="punctuation"&&m.content==="}"?d[d.length-1].openedBraces--:p=!0),(p||typeof m=="string")&&d.length>0&&d[d.length-1].openedBraces===0){var w=i(m);f<u.length-1&&(typeof u[f+1]=="string"||u[f+1].type==="plain-text")&&(w+=i(u[f+1]),u.splice(f+1,1)),f>0&&(typeof u[f-1]=="string"||u[f-1].type==="plain-text")&&(w=i(u[f-1])+w,u.splice(f-1,1),f--),u[f]=new t.Token("plain-text",w,null,w)}m.content&&typeof m.content!="string"&&l(m.content)}};t.hooks.add("after-tokenize",function(u){u.language!=="jsx"&&u.language!=="tsx"||l(u.tokens)})})(Prism);(function(t){var s=t.util.clone(t.languages.typescript);t.languages.tsx=t.languages.extend("jsx",s),delete t.languages.tsx.parameter,delete t.languages.tsx["literal-property"];var a=t.languages.tsx.tag;a.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+a.pattern.source+")",a.pattern.flags),a.lookbehind=!0})(Prism);(function(t){var s=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;t.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp("@[\\w-](?:"+/[^;{\s"']|\s+(?!\s)/.source+"|"+s.source+")*?"+/(?:;|(?=\s*\{))/.source),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+s.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+s.source+"$"),alias:"url"}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+s.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:s,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},t.languages.css.atrule.inside.rest=t.languages.css;var a=t.languages.markup;a&&(a.tag.addInlined("style","css"),a.tag.addAttribute("style","css"))})(Prism);var Tn={},An;function xp(){return An||(An=1,Prism.languages.scss=Prism.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),Prism.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),Prism.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),Prism.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),Prism.languages.scss.atrule.inside.rest=Prism.languages.scss),Tn}xp();Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}};Prism.languages.webmanifest=Prism.languages.json;(function(t){var s="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",a={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:a,environment:{pattern:RegExp("\\$"+s),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+s),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+s),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:a}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+s),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},a.inside=t.languages.bash;for(var n=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=r.variable[1].inside,i=0;i<n.length;i++)o[n[i]]=t.languages.bash[n[i]];t.languages.sh=t.languages.bash,t.languages.shell=t.languages.bash})(Prism);var En={},Mn;function gp(){return Mn||(Mn=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),En}gp();var Pn={},Rn;function bp(){return Rn||(Rn=1,(function(t){var s=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,a=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,r={pattern:RegExp(/(^|[^\w.])/.source+a+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(/(^|[^\w.])/.source+a+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:r.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+a+/[A-Z]\w*\b/.source),lookbehind:!0,inside:r.inside}],keyword:s,function:[t.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:s,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+a+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+a+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return s.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism)),Pn}bp();var Fn={},$n;function jp(){return $n||($n=1,(function(t){function s(z,$){return z.replace(/<<(\d+)>>/g,function(_,F){return"(?:"+$[+F]+")"})}function a(z,$,_){return RegExp(s(z,$),"")}function r(z,$){for(var _=0;_<$;_++)z=z.replace(/<<self>>/g,function(){return"(?:"+z+")"});return z.replace(/<<self>>/g,"[^\\s\\S]")}var n={type:"bool byte char decimal double dynamic float int long object sbyte short string uint ulong ushort var void",typeDeclaration:"class enum interface record struct",contextual:"add alias and ascending async await by descending from(?=\\s*(?:\\w|$)) get global group into init(?=\\s*;) join let nameof not notnull on or orderby partial remove select set unmanaged value when where with(?=\\s*{)",other:"abstract as base break case catch checked const continue default delegate do else event explicit extern finally fixed for foreach goto if implicit in internal is lock namespace new null operator out override params private protected public readonly ref return sealed sizeof stackalloc static switch this throw try typeof unchecked unsafe using virtual volatile while yield"};function o(z){return"\\b(?:"+z.trim().replace(/ /g,"|")+")\\b"}var i=o(n.typeDeclaration),l=RegExp(o(n.type+" "+n.typeDeclaration+" "+n.contextual+" "+n.other)),u=o(n.typeDeclaration+" "+n.contextual+" "+n.other),d=o(n.type+" "+n.typeDeclaration+" "+n.other),f=r(/<(?:[^<>;=+\-*/%&|^]|<<self>>)*>/.source,2),m=r(/\((?:[^()]|<<self>>)*\)/.source,2),p=/@?\b[A-Za-z_]\w*\b/.source,w=s(/<<0>>(?:\s*<<1>>)?/.source,[p,f]),C=s(/(?!<<0>>)<<1>>(?:\s*\.\s*<<1>>)*/.source,[u,w]),g=/\[\s*(?:,\s*)*\]/.source,y=s(/<<0>>(?:\s*(?:\?\s*)?<<1>>)*(?:\s*\?)?/.source,[C,g]),j=s(/[^,()<>[\];=+\-*/%&|^]|<<0>>|<<1>>|<<2>>/.source,[f,m,g]),x=s(/\(<<0>>+(?:,<<0>>+)+\)/.source,[j]),v=s(/(?:<<0>>|<<1>>)(?:\s*(?:\?\s*)?<<2>>)*(?:\s*\?)?/.source,[x,C,g]),k={keyword:l,punctuation:/[<>()?,.:[\]]/},N=/'(?:[^\r\n'\\]|\\.|\\[Uux][\da-fA-F]{1,8})'/.source,D=/"(?:\\.|[^\\"\r\n])*"/.source,P=/@"(?:""|\\[\s\S]|[^\\"])*"(?!")/.source;t.languages.csharp=t.languages.extend("clike",{string:[{pattern:a(/(^|[^$\\])<<0>>/.source,[P]),lookbehind:!0,greedy:!0},{pattern:a(/(^|[^@$\\])<<0>>/.source,[D]),lookbehind:!0,greedy:!0}],"class-name":[{pattern:a(/(\busing\s+static\s+)<<0>>(?=\s*;)/.source,[C]),lookbehind:!0,inside:k},{pattern:a(/(\busing\s+<<0>>\s*=\s*)<<1>>(?=\s*;)/.source,[p,v]),lookbehind:!0,inside:k},{pattern:a(/(\busing\s+)<<0>>(?=\s*=)/.source,[p]),lookbehind:!0},{pattern:a(/(\b<<0>>\s+)<<1>>/.source,[i,w]),lookbehind:!0,inside:k},{pattern:a(/(\bcatch\s*\(\s*)<<0>>/.source,[C]),lookbehind:!0,inside:k},{pattern:a(/(\bwhere\s+)<<0>>/.source,[p]),lookbehind:!0},{pattern:a(/(\b(?:is(?:\s+not)?|as)\s+)<<0>>/.source,[y]),lookbehind:!0,inside:k},{pattern:a(/\b<<0>>(?=\s+(?!<<1>>|with\s*\{)<<2>>(?:\s*[=,;:{)\]]|\s+(?:in|when)\b))/.source,[v,d,p]),inside:k}],keyword:l,number:/(?:\b0(?:x[\da-f_]*[\da-f]|b[01_]*[01])|(?:\B\.\d+(?:_+\d+)*|\b\d+(?:_+\d+)*(?:\.\d+(?:_+\d+)*)?)(?:e[-+]?\d+(?:_+\d+)*)?)(?:[dflmu]|lu|ul)?\b/i,operator:/>>=?|<<=?|[-=]>|([-+&|])\1|~|\?\?=?|[-+*/%&|^!=<>]=?/,punctuation:/\?\.?|::|[{}[\];(),.:]/}),t.languages.insertBefore("csharp","number",{range:{pattern:/\.\./,alias:"operator"}}),t.languages.insertBefore("csharp","punctuation",{"named-parameter":{pattern:a(/([(,]\s*)<<0>>(?=\s*:)/.source,[p]),lookbehind:!0,alias:"punctuation"}}),t.languages.insertBefore("csharp","class-name",{namespace:{pattern:a(/(\b(?:namespace|using)\s+)<<0>>(?:\s*\.\s*<<0>>)*(?=\s*[;{])/.source,[p]),lookbehind:!0,inside:{punctuation:/\./}},"type-expression":{pattern:a(/(\b(?:default|sizeof|typeof)\s*\(\s*(?!\s))(?:[^()\s]|\s(?!\s)|<<0>>)*(?=\s*\))/.source,[m]),lookbehind:!0,alias:"class-name",inside:k},"return-type":{pattern:a(/<<0>>(?=\s+(?:<<1>>\s*(?:=>|[({]|\.\s*this\s*\[)|this\s*\[))/.source,[v,C]),inside:k,alias:"class-name"},"constructor-invocation":{pattern:a(/(\bnew\s+)<<0>>(?=\s*[[({])/.source,[v]),lookbehind:!0,inside:k,alias:"class-name"},"generic-method":{pattern:a(/<<0>>\s*<<1>>(?=\s*\()/.source,[p,f]),inside:{function:a(/^<<0>>/.source,[p]),generic:{pattern:RegExp(f),alias:"class-name",inside:k}}},"type-list":{pattern:a(/\b((?:<<0>>\s+<<1>>|record\s+<<1>>\s*<<5>>|where\s+<<2>>)\s*:\s*)(?:<<3>>|<<4>>|<<1>>\s*<<5>>|<<6>>)(?:\s*,\s*(?:<<3>>|<<4>>|<<6>>))*(?=\s*(?:where|[{;]|=>|$))/.source,[i,w,p,v,l.source,m,/\bnew\s*\(\s*\)/.source]),lookbehind:!0,inside:{"record-arguments":{pattern:a(/(^(?!new\s*\()<<0>>\s*)<<1>>/.source,[w,m]),lookbehind:!0,greedy:!0,inside:t.languages.csharp},keyword:l,"class-name":{pattern:RegExp(v),greedy:!0,inside:k},punctuation:/[,()]/}},preprocessor:{pattern:/(^[\t ]*)#.*/m,lookbehind:!0,alias:"property",inside:{directive:{pattern:/(#)\b(?:define|elif|else|endif|endregion|error|if|line|nullable|pragma|region|undef|warning)\b/,lookbehind:!0,alias:"keyword"}}}});var R=D+"|"+N,A=s(/\/(?![*/])|\/\/[^\r\n]*[\r\n]|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>/.source,[R]),S=r(s(/[^"'/()]|<<0>>|\(<<self>>*\)/.source,[A]),2),M=/\b(?:assembly|event|field|method|module|param|property|return|type)\b/.source,E=s(/<<0>>(?:\s*\(<<1>>*\))?/.source,[C,S]);t.languages.insertBefore("csharp","class-name",{attribute:{pattern:a(/((?:^|[^\s\w>)?])\s*\[\s*)(?:<<0>>\s*:\s*)?<<1>>(?:\s*,\s*<<1>>)*(?=\s*\])/.source,[M,E]),lookbehind:!0,greedy:!0,inside:{target:{pattern:a(/^<<0>>(?=\s*:)/.source,[M]),alias:"keyword"},"attribute-arguments":{pattern:a(/\(<<0>>*\)/.source,[S]),inside:t.languages.csharp},"class-name":{pattern:RegExp(C),inside:{punctuation:/\./}},punctuation:/[:,]/}}});var T=/:[^}\r\n]+/.source,K=r(s(/[^"'/()]|<<0>>|\(<<self>>*\)/.source,[A]),2),q=s(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[K,T]),B=r(s(/[^"'/()]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|<<0>>|\(<<self>>*\)/.source,[R]),2),W=s(/\{(?!\{)(?:(?![}:])<<0>>)*<<1>>?\}/.source,[B,T]);function I(z,$){return{interpolation:{pattern:a(/((?:^|[^{])(?:\{\{)*)<<0>>/.source,[z]),lookbehind:!0,inside:{"format-string":{pattern:a(/(^\{(?:(?![}:])<<0>>)*)<<1>>(?=\}$)/.source,[$,T]),lookbehind:!0,inside:{punctuation:/^:/}},punctuation:/^\{|\}$/,expression:{pattern:/[\s\S]+/,alias:"language-csharp",inside:t.languages.csharp}}},string:/[\s\S]+/}}t.languages.insertBefore("csharp","string",{"interpolation-string":[{pattern:a(/(^|[^\\])(?:\$@|@\$)"(?:""|\\[\s\S]|\{\{|<<0>>|[^\\{"])*"/.source,[q]),lookbehind:!0,greedy:!0,inside:I(q,K)},{pattern:a(/(^|[^@\\])\$"(?:\\.|\{\{|<<0>>|[^\\"{])*"/.source,[W]),lookbehind:!0,greedy:!0,inside:I(W,B)}],char:{pattern:RegExp(N),greedy:!0}}),t.languages.dotnet=t.languages.cs=t.languages.csharp})(Prism)),Fn}jp();var Ln={},In;function vp(){return In||(In=1,(function(t){var s=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,a=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],r=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,n=/<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,o=/[{}\[\](),:;]/;t.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:s,variable:/\$+(?:\w+\b|(?=\{))/,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:array|bool|boolean|float|int|integer|object|string)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|object|self|static|string)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:array(?!\s*\()|bool|callable|(?:false|null)(?=\s*\|)|float|int|iterable|mixed|never|object|self|static|string|void)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:array(?!\s*\()|bool|float|int|iterable|mixed|object|string|void)\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:false|null)\b|\b(?:false|null)(?=\s*\|)/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|match|namespace|never|new|or|parent|print|private|protected|public|readonly|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield|__halt_compiler)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s*)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:a,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:r,operator:n,punctuation:o};var i={pattern:/\{\$(?:\{(?:\{[^{}]+\}|[^{}]+)\}|[^{}])+\}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:t.languages.php},l=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:i}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:i}}];t.languages.insertBefore("php","variable",{string:l,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=\]$)/,lookbehind:!0,inside:{comment:s,string:l,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:a,number:r,operator:n,punctuation:o}},delimiter:{pattern:/^#\[|\]$/,alias:"punctuation"}}}}),t.hooks.add("before-tokenize",function(u){if(/<\?/.test(u.code)){var d=/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/g;t.languages["markup-templating"].buildPlaceholders(u,"php",d)}}),t.hooks.add("after-tokenize",function(u){t.languages["markup-templating"].tokenizePlaceholders(u,"php")})})(Prism)),Ln}vp();var On={},zn;function wp(){return zn||(zn=1,(function(t){t.languages.ruby=t.languages.extend("clike",{comment:{pattern:/#.*|^=begin\s[\s\S]*?^=end/m,greedy:!0},"class-name":{pattern:/(\b(?:class|module)\s+|\bcatch\s+\()[\w.\\]+|\b[A-Z_]\w*(?=\s*\.\s*new\b)/,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:BEGIN|END|alias|and|begin|break|case|class|def|define_method|defined|do|each|else|elsif|end|ensure|extend|for|if|in|include|module|new|next|nil|not|or|prepend|private|protected|public|raise|redo|require|rescue|retry|return|self|super|then|throw|undef|unless|until|when|while|yield)\b/,operator:/\.{2,3}|&\.|===|<?=>|[!=]?~|(?:&&|\|\||<<|>>|\*\*|[+\-*/%<>!^&|=])=?|[?:]/,punctuation:/[(){}[\].,;]/}),t.languages.insertBefore("ruby","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}});var s={pattern:/((?:^|[^\\])(?:\\{2})*)#\{(?:[^{}]|\{[^{}]*\})*\}/,lookbehind:!0,inside:{content:{pattern:/^(#\{)[\s\S]+(?=\}$)/,lookbehind:!0,inside:t.languages.ruby},delimiter:{pattern:/^#\{|\}$/,alias:"punctuation"}}};delete t.languages.ruby.function;var a="(?:"+[/([^a-zA-Z0-9\s{(\[<=])(?:(?!\1)[^\\]|\\[\s\S])*\1/.source,/\((?:[^()\\]|\\[\s\S]|\((?:[^()\\]|\\[\s\S])*\))*\)/.source,/\{(?:[^{}\\]|\\[\s\S]|\{(?:[^{}\\]|\\[\s\S])*\})*\}/.source,/\[(?:[^\[\]\\]|\\[\s\S]|\[(?:[^\[\]\\]|\\[\s\S])*\])*\]/.source,/<(?:[^<>\\]|\\[\s\S]|<(?:[^<>\\]|\\[\s\S])*>)*>/.source].join("|")+")",r=/(?:"(?:\\.|[^"\\\r\n])*"|(?:\b[a-zA-Z_]\w*|[^\s\0-\x7F]+)[?!]?|\$.)/.source;t.languages.insertBefore("ruby","keyword",{"regex-literal":[{pattern:RegExp(/%r/.source+a+/[egimnosux]{0,6}/.source),greedy:!0,inside:{interpolation:s,regex:/[\s\S]+/}},{pattern:/(^|[^/])\/(?!\/)(?:\[[^\r\n\]]+\]|\\.|[^[/\\\r\n])+\/[egimnosux]{0,6}(?=\s*(?:$|[\r\n,.;})#]))/,lookbehind:!0,greedy:!0,inside:{interpolation:s,regex:/[\s\S]+/}}],variable:/[@$]+[a-zA-Z_]\w*(?:[?!]|\b)/,symbol:[{pattern:RegExp(/(^|[^:]):/.source+r),lookbehind:!0,greedy:!0},{pattern:RegExp(/([\r\n{(,][ \t]*)/.source+r+/(?=:(?!:))/.source),lookbehind:!0,greedy:!0}],"method-definition":{pattern:/(\bdef\s+)\w+(?:\s*\.\s*\w+)?/,lookbehind:!0,inside:{function:/\b\w+$/,keyword:/^self\b/,"class-name":/^\w+/,punctuation:/\./}}}),t.languages.insertBefore("ruby","string",{"string-literal":[{pattern:RegExp(/%[qQiIwWs]?/.source+a),greedy:!0,inside:{interpolation:s,string:/[\s\S]+/}},{pattern:/("|')(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|(?!\1)[^\\#\r\n])*\1/,greedy:!0,inside:{interpolation:s,string:/[\s\S]+/}},{pattern:/<<[-~]?([a-z_]\w*)[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?[a-z_]\w*|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?/}},interpolation:s,string:/[\s\S]+/}},{pattern:/<<[-~]?'([a-z_]\w*)'[\r\n](?:.*[\r\n])*?[\t ]*\1/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<[-~]?'[a-z_]\w*'|\b[a-z_]\w*$/i,inside:{symbol:/\b\w+/,punctuation:/^<<[-~]?'|'$/}},string:/[\s\S]+/}}],"command-literal":[{pattern:RegExp(/%x/.source+a),greedy:!0,inside:{interpolation:s,command:{pattern:/[\s\S]+/,alias:"string"}}},{pattern:/`(?:#\{[^}]+\}|#(?!\{)|\\(?:\r\n|[\s\S])|[^\\`#\r\n])*`/,greedy:!0,inside:{interpolation:s,command:{pattern:/[\s\S]+/,alias:"string"}}}]}),delete t.languages.ruby.string,t.languages.insertBefore("ruby","number",{builtin:/\b(?:Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Fixnum|Float|Hash|IO|Integer|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|Stat|String|Struct|Symbol|TMS|Thread|ThreadGroup|Time|TrueClass)\b/,constant:/\b[A-Z][A-Z0-9_]*(?:[?!]|\b)/}),t.languages.rb=t.languages.ruby})(Prism)),On}wp();Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/});Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}});delete Prism.languages.go["class-name"];var _n={},Vn;function yp(){return Vn||(Vn=1,(function(t){for(var s=/\/\*(?:[^*/]|\*(?!\/)|\/(?!\*)|<self>)*\*\//.source,a=0;a<2;a++)s=s.replace(/<self>/g,function(){return s});s=s.replace(/<self>/g,function(){return/[^\s\S]/.source}),t.languages.rust={comment:[{pattern:RegExp(/(^|[^\\])/.source+s),lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/b?"(?:\\[\s\S]|[^\\"])*"|b?r(#*)"(?:[^"]|"(?!\1))*"\1/,greedy:!0},char:{pattern:/b?'(?:\\(?:x[0-7][\da-fA-F]|u\{(?:[\da-fA-F]_*){1,6}\}|.)|[^\\\r\n\t'])'/,greedy:!0},attribute:{pattern:/#!?\[(?:[^\[\]"]|"(?:\\[\s\S]|[^\\"])*")*\]/,greedy:!0,alias:"attr-name",inside:{string:null}},"closure-params":{pattern:/([=(,:]\s*|\bmove\s*)\|[^|]*\||\|[^|]*\|(?=\s*(?:\{|->))/,lookbehind:!0,greedy:!0,inside:{"closure-punctuation":{pattern:/^\||\|$/,alias:"punctuation"},rest:null}},"lifetime-annotation":{pattern:/'\w+/,alias:"symbol"},"fragment-specifier":{pattern:/(\$\w+:)[a-z]+/,lookbehind:!0,alias:"punctuation"},variable:/\$\w+/,"function-definition":{pattern:/(\bfn\s+)\w+/,lookbehind:!0,alias:"function"},"type-definition":{pattern:/(\b(?:enum|struct|trait|type|union)\s+)\w+/,lookbehind:!0,alias:"class-name"},"module-declaration":[{pattern:/(\b(?:crate|mod)\s+)[a-z][a-z_\d]*/,lookbehind:!0,alias:"namespace"},{pattern:/(\b(?:crate|self|super)\s*)::\s*[a-z][a-z_\d]*\b(?:\s*::(?:\s*[a-z][a-z_\d]*\s*::)*)?/,lookbehind:!0,alias:"namespace",inside:{punctuation:/::/}}],keyword:[/\b(?:Self|abstract|as|async|await|become|box|break|const|continue|crate|do|dyn|else|enum|extern|final|fn|for|if|impl|in|let|loop|macro|match|mod|move|mut|override|priv|pub|ref|return|self|static|struct|super|trait|try|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/,/\b(?:bool|char|f(?:32|64)|[ui](?:8|16|32|64|128|size)|str)\b/],function:/\b[a-z_]\w*(?=\s*(?:::\s*<|\())/,macro:{pattern:/\b\w+!/,alias:"property"},constant:/\b[A-Z_][A-Z_\d]+\b/,"class-name":/\b[A-Z]\w*\b/,namespace:{pattern:/(?:\b[a-z][a-z_\d]*\s*::\s*)*\b[a-z][a-z_\d]*\s*::(?!\s*<)/,inside:{punctuation:/::/}},number:/\b(?:0x[\dA-Fa-f](?:_?[\dA-Fa-f])*|0o[0-7](?:_?[0-7])*|0b[01](?:_?[01])*|(?:(?:\d(?:_?\d)*)?\.)?\d(?:_?\d)*(?:[Ee][+-]?\d+)?)(?:_?(?:f32|f64|[iu](?:8|16|32|64|size)?))?\b/,boolean:/\b(?:false|true)\b/,punctuation:/->|\.\.=|\.{1,3}|::|[{}[\];(),:]/,operator:/[-+*\/%!^]=?|=[=>]?|&[&=]?|\|[|=]?|<<?=?|>>?=?|[@?]/},t.languages.rust["closure-params"].inside.rest=t.languages.rust,t.languages.rust.attribute.inside.string=t.languages.rust.string})(Prism)),_n}yp();Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},variable:[{pattern:/@(["'`])(?:\\[\s\S]|(?!\1)[^\\])+\1/,greedy:!0},/@[\w.$]+/],string:{pattern:/(^|[^@\\])("|')(?:\\[\s\S]|(?!\2)[^\\]|\2\2)*\2/,greedy:!0,lookbehind:!0},identifier:{pattern:/(^|[^@\\])`(?:\\[\s\S]|[^`\\]|``)*`/,greedy:!0,lookbehind:!0,inside:{punctuation:/^`|`$/}},function:/\b(?:AVG|COUNT|FIRST|FORMAT|LAST|LCASE|LEN|MAX|MID|MIN|MOD|NOW|ROUND|SUM|UCASE)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|AUTO_INCREMENT|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR(?:ACTER|SET)?|CHECK(?:POINT)?|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMNS?|COMMENT|COMMIT(?:TED)?|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS(?:TABLE)?|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|CYCLE|DATA(?:BASES?)?|DATE(?:TIME)?|DAY|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DELIMITERS?|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE|ELSE(?:IF)?|ENABLE|ENCLOSED|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPED?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|HOUR|IDENTITY(?:COL|_INSERT)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTERVAL|INTO|INVOKER|ISOLATION|ITERATE|JOIN|KEYS?|KILL|LANGUAGE|LAST|LEAVE|LEFT|LEVEL|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|LOOP|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MINUTE|MODE|MODIFIES|MODIFY|MONTH|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL|NATURAL|NCHAR|NEXT|NO|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREPARE|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READS?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEAT(?:ABLE)?|REPLACE|REPLICATION|REQUIRE|RESIGNAL|RESTORE|RESTRICT|RETURN(?:ING|S)?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SECOND|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|SQL|START(?:ING)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED|TEXT(?:SIZE)?|THEN|TIME(?:STAMP)?|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNLOCK|UNPIVOT|UNSIGNED|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?|YEAR)\b/i,boolean:/\b(?:FALSE|NULL|TRUE)\b/i,number:/\b0x[\da-f]+\b|\b\d+(?:\.\d*)?|\B\.\d+\b/i,operator:/[-+*\/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};(function(t){var s=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function a(f){return f=f.replace(/<inner>/g,function(){return s}),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+f+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,n=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,function(){return r}),o=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;t.languages.markdown=t.languages.extend("markup",{}),t.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:t.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+n+o+"(?:"+n+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+n+o+")(?:"+n+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:t.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+n+")"+o+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+n+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:t.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:a(/\b__(?:(?!_)<inner>|_(?:(?!_)<inner>)+_)+__\b|\*\*(?:(?!\*)<inner>|\*(?:(?!\*)<inner>)+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:a(/\b_(?:(?!_)<inner>|__(?:(?!_)<inner>)+__)+_\b|\*(?:(?!\*)<inner>|\*\*(?:(?!\*)<inner>)+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:a(/(~~?)(?:(?!~)<inner>)+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:a(/!?\[(?:(?!\])<inner>)+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\])<inner>)+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach(function(f){["url","bold","italic","strike","code-snippet"].forEach(function(m){f!==m&&(t.languages.markdown[f].inside.content.inside[m]=t.languages.markdown[m])})}),t.hooks.add("after-tokenize",function(f){if(f.language!=="markdown"&&f.language!=="md")return;function m(p){if(!(!p||typeof p=="string"))for(var w=0,C=p.length;w<C;w++){var g=p[w];if(g.type!=="code"){m(g.content);continue}var y=g.content[1],j=g.content[3];if(y&&j&&y.type==="code-language"&&j.type==="code-block"&&typeof y.content=="string"){var x=y.content.replace(/\b#/g,"sharp").replace(/\b\+\+/g,"pp");x=(/[a-z][\w-]*/i.exec(x)||[""])[0].toLowerCase();var v="language-"+x;j.alias?typeof j.alias=="string"?j.alias=[j.alias,v]:j.alias.push(v):j.alias=[v]}}}m(f.tokens)}),t.hooks.add("wrap",function(f){if(f.type==="code-block"){for(var m="",p=0,w=f.classes.length;p<w;p++){var C=f.classes[p],g=/language-(.+)/.exec(C);if(g){m=g[1];break}}var y=t.languages[m];if(y)f.content=t.highlight(d(f.content),y,m);else if(m&&m!=="none"&&t.plugins.autoloader){var j="md-"+new Date().valueOf()+"-"+Math.floor(Math.random()*1e16);f.attributes.id=j,t.plugins.autoloader.loadLanguages(m,function(){var x=document.getElementById(j);x&&(x.innerHTML=t.highlight(x.textContent,t.languages[m],m))})}}});var i=RegExp(t.languages.markup.tag.pattern.source,"gi"),l={amp:"&",lt:"<",gt:">",quot:'"'},u=String.fromCodePoint||String.fromCharCode;function d(f){var m=f.replace(i,"");return m=m.replace(/&(\w{1,8}|#x?[\da-f]{1,8});/gi,function(p,w){if(w=w.toLowerCase(),w[0]==="#"){var C;return w[1]==="x"?C=parseInt(w.slice(2),16):C=Number(w.slice(1)),u(C)}else{var g=l[w];return g||p}}),m}t.languages.md=t.languages.markdown})(Prism);(function(t){var s=/[*&][^\s[\]{},]+/,a=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+a.source+"(?:[ ]+"+s.source+")?|"+s.source+"(?:[ ]+"+a.source+")?)",n=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),o=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function i(l,u){u=(u||"").replace(/m/g,"")+"m";var d=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return l});return RegExp(d,u)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return r})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return"(?:"+n+"|"+o+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:i(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:i(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:i(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:i(o),lookbehind:!0,greedy:!0},number:{pattern:i(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:a,important:s,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml})(Prism);(function(t){var s=/\\[\r\n](?:\s|\\[\r\n]|#.*(?!.))*(?![\s#]|\\[\r\n])/.source,a=/(?:[ \t]+(?![ \t])(?:<SP_BS>)?|<SP_BS>)/.source.replace(/<SP_BS>/g,function(){return s}),r=/"(?:[^"\\\r\n]|\\(?:\r\n|[\s\S]))*"|'(?:[^'\\\r\n]|\\(?:\r\n|[\s\S]))*'/.source,n=/--[\w-]+=(?:<STR>|(?!["'])(?:[^\s\\]|\\.)+)/.source.replace(/<STR>/g,function(){return r}),o={pattern:RegExp(r),greedy:!0},i={pattern:/(^[ \t]*)#.*/m,lookbehind:!0,greedy:!0};function l(u,d){return u=u.replace(/<OPT>/g,function(){return n}).replace(/<SP>/g,function(){return a}),RegExp(u,d)}t.languages.docker={instruction:{pattern:/(^[ \t]*)(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)(?=\s)(?:\\.|[^\r\n\\])*(?:\\$(?:\s|#.*$)*(?![\s#])(?:\\.|[^\r\n\\])*)*/im,lookbehind:!0,greedy:!0,inside:{options:{pattern:l(/(^(?:ONBUILD<SP>)?\w+<SP>)<OPT>(?:<SP><OPT>)*/.source,"i"),lookbehind:!0,greedy:!0,inside:{property:{pattern:/(^|\s)--[\w-]+/,lookbehind:!0},string:[o,{pattern:/(=)(?!["'])(?:[^\s\\]|\\.)+/,lookbehind:!0}],operator:/\\$/m,punctuation:/=/}},keyword:[{pattern:l(/(^(?:ONBUILD<SP>)?HEALTHCHECK<SP>(?:<OPT><SP>)*)(?:CMD|NONE)\b/.source,"i"),lookbehind:!0,greedy:!0},{pattern:l(/(^(?:ONBUILD<SP>)?FROM<SP>(?:<OPT><SP>)*(?!--)[^ \t\\]+<SP>)AS/.source,"i"),lookbehind:!0,greedy:!0},{pattern:l(/(^ONBUILD<SP>)\w+/.source,"i"),lookbehind:!0,greedy:!0},{pattern:/^\w+/,greedy:!0}],comment:i,string:o,variable:/\$(?:\w+|\{[^{}"'\\]*\})/,operator:/\\$/m}},comment:i},t.languages.dockerfile=t.languages.docker})(Prism);Prism.languages.git={comment:/^#.*/m,deleted:/^[-–].*/m,inserted:/^\+.*/m,string:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s--?\w+/}},coord:/^@@.*@@$/m,"commit-sha1":/^commit \w{40}$/m};const Wn=Xe.cva("relative rounded font-mono",{variants:{variant:{inline:"bg-muted px-[0.3rem] py-[0.2rem] text-xs sm:text-sm",block:"block bg-muted overflow-x-auto"},size:{sm:"text-xs sm:text-sm",base:"text-sm sm:text-base",lg:"text-base sm:text-lg"}},defaultVariants:{variant:"inline",size:"base"}}),Uo=c.forwardRef(({className:t,variant:s,size:a,language:r,showLineNumbers:n=!1,maxHeight:o,copyable:i=!1,filename:l,theme:u="auto",children:d,...f},m)=>{const[p,w]=c.useState(!1),[C,g]=c.useState("");c.useRef(null),c.useEffect(()=>{if(s==="block"&&r&&d)try{const j=typeof d=="string"?d:String(d),x=qa.highlight(j,qa.languages[r]||qa.languages.text,r);g(x)}catch(j){console.warn(`Failed to highlight code for language: ${r}`,j),g(String(d))}else g(String(d))},[r,d,s]);const y=async()=>{if(typeof d=="string")try{await navigator.clipboard.writeText(d),w(!0),setTimeout(()=>w(!1),2e3)}catch(j){console.error("Failed to copy code:",j)}};return s==="block"?e.jsxs("div",{className:"relative my-4 sm:my-6",children:[(l||i)&&e.jsxs("div",{className:"flex items-center justify-between bg-muted/50 px-3 sm:px-4 py-2 sm:py-3 rounded-t-lg border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[l&&e.jsxs("div",{className:"flex items-center gap-1.5 text-xs sm:text-sm text-muted-foreground",children:[e.jsx(h.FileText,{className:"h-3 w-3 sm:h-4 sm:w-4"}),e.jsx("span",{className:"font-medium",children:l})]}),r&&!l&&e.jsx("div",{className:"text-xs sm:text-sm text-muted-foreground uppercase font-medium",children:r})]}),i&&e.jsx(L,{variant:"ghost",size:"sm",onClick:y,className:"h-6 w-6 sm:h-7 sm:w-7 p-0 hover:bg-muted-foreground/10",children:p?e.jsx(h.Check,{className:"h-3 w-3 sm:h-4 sm:w-4 text-green-600"}):e.jsx(h.Copy,{className:"h-3 w-3 sm:h-4 sm:w-4"})})]}),e.jsx("div",{className:b("waka-code relative",o&&"overflow-hidden"),style:{maxHeight:o?`${o}px`:void 0},children:e.jsxs("pre",{className:b(Wn({variant:s,size:a}),"p-3 sm:p-4 lg:p-6","text-xs sm:text-sm lg:text-base","leading-relaxed sm:leading-loose","whitespace-pre-wrap break-words","scrollbar-thin scrollbar-thumb-muted-foreground/20 scrollbar-track-transparent","hover:scrollbar-thumb-muted-foreground/30",o&&"overflow-y-auto",!l&&!i&&r&&"rounded-lg",l||i?"rounded-b-lg":"rounded-lg",t),children:[n&&e.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-8 sm:w-10 lg:w-12 bg-muted/30 border-r border-border/50 flex flex-col text-xs sm:text-sm text-muted-foreground select-none",children:String(d).split(`
3
+ `).map((j,x)=>e.jsx("div",{className:"flex items-center justify-center h-5 sm:h-6 lg:h-7",children:x+1},x))}),e.jsx("code",{ref:m,className:b("block",n&&"ml-8 sm:ml-10 lg:ml-12",r&&"language-"+r),...f,dangerouslySetInnerHTML:s==="block"&&r?{__html:C}:void 0,children:s==="block"&&r?void 0:d})]})}),r&&!l&&!i&&e.jsx("div",{className:"absolute top-2 right-2 text-xs text-muted-foreground/70 bg-background/80 px-2 py-1 rounded uppercase font-medium",children:r})]}):e.jsx("code",{className:b(Wn({variant:s,size:a}),t),ref:m,...f,children:d})});Uo.displayName="Code";const Bo=fr.Root,qo=fr.CollapsibleTrigger,Ho=fr.CollapsibleContent,It=ue.Root,Np=ue.Trigger,Go=ue.Portal,Xo=ue.Close,kr=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Overlay,{ref:a,className:b("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s}));kr.displayName=ue.Overlay.displayName;const Tt=c.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(Go,{children:[e.jsx(kr,{}),e.jsxs(ue.Content,{ref:r,className:b("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...a,children:[s,e.jsxs(ue.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(h.X,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Tt.displayName=ue.Content.displayName;const Ht=({className:t,...s})=>e.jsx("div",{className:b("flex flex-col space-y-1.5 text-center sm:text-left",t),...s});Ht.displayName="DialogHeader";const Gt=({className:t,...s})=>e.jsx("div",{className:b("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});Gt.displayName="DialogFooter";const Xt=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Title,{ref:a,className:b("text-lg font-semibold leading-none tracking-tight",t),...s}));Xt.displayName=ue.Title.displayName;const Cs=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Description,{ref:a,className:b("text-sm text-muted-foreground",t),...s}));Cs.displayName=ue.Description.displayName;const ss=c.forwardRef(({className:t,...s},a)=>e.jsx(dt.Command,{ref:a,className:b("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...s}));ss.displayName=dt.Command.displayName;const Cp=({children:t,...s})=>e.jsx(It,{...s,children:e.jsx(Tt,{className:"overflow-hidden p-0 shadow-lg",children:e.jsx(ss,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:t})})}),xs=c.forwardRef(({className:t,...s},a)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(h.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(dt.Command.Input,{ref:a,className:b("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...s})]}));xs.displayName=dt.Command.Input.displayName;const ea=c.forwardRef(({className:t,...s},a)=>e.jsx(dt.Command.List,{ref:a,className:b("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...s}));ea.displayName=dt.Command.List.displayName;const gs=c.forwardRef((t,s)=>e.jsx(dt.Command.Empty,{ref:s,className:"py-6 text-center text-sm",...t}));gs.displayName=dt.Command.Empty.displayName;const Ot=c.forwardRef(({className:t,...s},a)=>e.jsx(dt.Command.Group,{ref:a,className:b("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...s}));Ot.displayName=dt.Command.Group.displayName;const wa=c.forwardRef(({className:t,...s},a)=>e.jsx(dt.Command.Separator,{ref:a,className:b("-mx-1 h-px bg-border",t),...s}));wa.displayName=dt.Command.Separator.displayName;const zt=c.forwardRef(({className:t,...s},a)=>e.jsx(dt.Command.Item,{ref:a,className:b("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...s}));zt.displayName=dt.Command.Item.displayName;const Ko=({className:t,...s})=>e.jsx("span",{className:b("ml-auto text-xs tracking-widest text-muted-foreground",t),...s});Ko.displayName="CommandShortcut";const Yo=Me.Root,Jo=Me.Trigger,kp=Me.Group,Sp=Me.Portal,Dp=Me.Sub,Tp=Me.RadioGroup,Qo=c.forwardRef(({className:t,inset:s,children:a,...r},n)=>e.jsxs(Me.SubTrigger,{ref:n,className:b("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",s&&"pl-8",t),...r,children:[a,e.jsx(h.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Qo.displayName=Me.SubTrigger.displayName;const Zo=c.forwardRef(({className:t,...s},a)=>e.jsx(Me.SubContent,{ref:a,className:b("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s}));Zo.displayName=Me.SubContent.displayName;const Sr=c.forwardRef(({className:t,...s},a)=>e.jsx(Me.Portal,{children:e.jsx(Me.Content,{ref:a,className:b("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s})}));Sr.displayName=Me.Content.displayName;const Ft=c.forwardRef(({className:t,inset:s,...a},r)=>e.jsx(Me.Item,{ref:r,className:b("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s&&"pl-8",t),...a}));Ft.displayName=Me.Item.displayName;const ei=c.forwardRef(({className:t,children:s,checked:a,...r},n)=>e.jsxs(Me.CheckboxItem,{ref:n,className:b("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:a,...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Me.ItemIndicator,{children:e.jsx(h.Check,{className:"h-4 w-4"})})}),s]}));ei.displayName=Me.CheckboxItem.displayName;const ti=c.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(Me.RadioItem,{ref:r,className:b("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Me.ItemIndicator,{children:e.jsx(h.Circle,{className:"h-2 w-2 fill-current"})})}),s]}));ti.displayName=Me.RadioItem.displayName;const si=c.forwardRef(({className:t,inset:s,...a},r)=>e.jsx(Me.Label,{ref:r,className:b("px-2 py-1.5 text-sm font-semibold text-foreground",s&&"pl-8",t),...a}));si.displayName=Me.Label.displayName;const Vs=c.forwardRef(({className:t,...s},a)=>e.jsx(Me.Separator,{ref:a,className:b("-mx-1 my-1 h-px bg-border",t),...s}));Vs.displayName=Me.Separator.displayName;const ai=({className:t,...s})=>e.jsx("span",{className:b("ml-auto text-xs tracking-widest text-muted-foreground",t),...s});ai.displayName="ContextMenuShortcut";const He=Pe.Root,Ge=Pe.Trigger,Ap=Pe.Group,Ep=Pe.Portal,Mp=Pe.Sub,Pp=Pe.RadioGroup,ri=c.forwardRef(({className:t,inset:s,children:a,...r},n)=>e.jsxs(Pe.SubTrigger,{ref:n,className:b("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",s&&"pl-8",t),...r,children:[a,e.jsx(h.ChevronRight,{className:"ml-auto h-4 w-4"})]}));ri.displayName=Pe.SubTrigger.displayName;const ni=c.forwardRef(({className:t,...s},a)=>e.jsx(Pe.SubContent,{ref:a,className:b("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s}));ni.displayName=Pe.SubContent.displayName;const _e=c.forwardRef(({className:t,sideOffset:s=4,...a},r)=>e.jsx(Pe.Portal,{children:e.jsx(Pe.Content,{ref:r,sideOffset:s,className:b("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a})}));_e.displayName=Pe.Content.displayName;const pe=c.forwardRef(({className:t,inset:s,...a},r)=>e.jsx(Pe.Item,{ref:r,className:b("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s&&"pl-8",t),...a}));pe.displayName=Pe.Item.displayName;const ds=c.forwardRef(({className:t,children:s,checked:a,...r},n)=>e.jsxs(Pe.CheckboxItem,{ref:n,className:b("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:a,...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Pe.ItemIndicator,{children:e.jsx(h.Check,{className:"h-4 w-4"})})}),s]}));ds.displayName=Pe.CheckboxItem.displayName;const oi=c.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(Pe.RadioItem,{ref:r,className:b("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Pe.ItemIndicator,{children:e.jsx(h.Circle,{className:"h-2 w-2 fill-current"})})}),s]}));oi.displayName=Pe.RadioItem.displayName;const ms=c.forwardRef(({className:t,inset:s,...a},r)=>e.jsx(Pe.Label,{ref:r,className:b("px-2 py-1.5 text-sm font-semibold",s&&"pl-8",t),...a}));ms.displayName=Pe.Label.displayName;const Qe=c.forwardRef(({className:t,...s},a)=>e.jsx(Pe.Separator,{ref:a,className:b("-mx-1 my-1 h-px bg-muted",t),...s}));Qe.displayName=Pe.Separator.displayName;const ii=({className:t,...s})=>e.jsx("span",{className:b("ml-auto text-xs tracking-widest opacity-60",t),...s});ii.displayName="DropdownMenuShortcut";var Rp=t=>t.type==="checkbox",zs=t=>t instanceof Date,Dr=t=>t==null;const li=t=>typeof t=="object";var bs=t=>!Dr(t)&&!Array.isArray(t)&&li(t)&&!zs(t),Fp=t=>bs(t)&&t.target?Rp(t.target)?t.target.checked:t.target.value:t,$p=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,Lp=(t,s)=>t.has($p(s)),Ip=t=>{const s=t.constructor&&t.constructor.prototype;return bs(s)&&s.hasOwnProperty("isPrototypeOf")},Op=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ci(t){let s;const a=Array.isArray(t),r=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)s=new Date(t);else if(!(Op&&(t instanceof Blob||r))&&(a||bs(t)))if(s=a?[]:Object.create(Object.getPrototypeOf(t)),!a&&!Ip(t))s=t;else for(const n in t)t.hasOwnProperty(n)&&(s[n]=ci(t[n]));else return t;return s}var di=t=>/^\w*$/.test(t),ur=t=>t===void 0,zp=t=>Array.isArray(t)?t.filter(Boolean):[],ui=t=>zp(t.replace(/["|']|\]/g,"").split(/\.|\[/)),lt=(t,s,a)=>{if(!s||!bs(t))return a;const r=(di(s)?[s]:ui(s)).reduce((n,o)=>Dr(n)?n:n[o],t);return ur(r)||r===t?ur(t[s])?a:t[s]:r},Ha=t=>typeof t=="boolean",Un=(t,s,a)=>{let r=-1;const n=di(s)?[s]:ui(s),o=n.length,i=o-1;for(;++r<o;){const l=n[r];let u=a;if(r!==i){const d=t[l];u=bs(d)||Array.isArray(d)?d:isNaN(+n[r+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;t[l]=u,t=t[l]}};const Bn={BLUR:"blur",CHANGE:"change"},qn={all:"all"},Tr=O.createContext(null);Tr.displayName="HookFormContext";const Pa=()=>O.useContext(Tr),_p=t=>{const{children:s,...a}=t;return O.createElement(Tr.Provider,{value:a},s)};var Vp=(t,s,a,r=!0)=>{const n={defaultValues:s._defaultValues};for(const o in t)Object.defineProperty(n,o,{get:()=>{const i=o;return s._proxyFormState[i]!==qn.all&&(s._proxyFormState[i]=!r||qn.all),a&&(a[i]=!0),t[i]}});return n};const mi=typeof window<"u"?O.useLayoutEffect:O.useEffect;function Wp(t){const s=Pa(),{control:a=s.control,disabled:r,name:n,exact:o}=t||{},[i,l]=O.useState(a._formState),u=O.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return mi(()=>a._subscribe({name:n,formState:u.current,exact:o,callback:d=>{!r&&l({...a._formState,...d})}}),[n,r,o]),O.useEffect(()=>{u.current.isValid&&a._setValid(!0)},[a]),O.useMemo(()=>Vp(i,a,u.current,!1),[i,a])}var Up=t=>typeof t=="string",Hn=(t,s,a,r,n)=>Up(t)?lt(a,t,n):Array.isArray(t)?t.map(o=>lt(a,o)):a,Gn=t=>Dr(t)||!li(t);function xa(t,s,a=new WeakSet){if(Gn(t)||Gn(s))return Object.is(t,s);if(zs(t)&&zs(s))return t.getTime()===s.getTime();const r=Object.keys(t),n=Object.keys(s);if(r.length!==n.length)return!1;if(a.has(t)||a.has(s))return!0;a.add(t),a.add(s);for(const o of r){const i=t[o];if(!n.includes(o))return!1;if(o!=="ref"){const l=s[o];if(zs(i)&&zs(l)||bs(i)&&bs(l)||Array.isArray(i)&&Array.isArray(l)?!xa(i,l,a):!Object.is(i,l))return!1}}return!0}function Bp(t){const s=Pa(),{control:a=s.control,name:r,defaultValue:n,disabled:o,exact:i,compute:l}=t||{},u=O.useRef(n),d=O.useRef(l),f=O.useRef(void 0),m=O.useRef(a),p=O.useRef(r);d.current=l;const[w,C]=O.useState(()=>{const k=a._getWatch(r,u.current);return d.current?d.current(k):k}),g=O.useCallback(k=>{const N=Hn(r,a._names,k||a._formValues,!1,u.current);return d.current?d.current(N):N},[a._formValues,a._names,r]),y=O.useCallback(k=>{if(!o){const N=Hn(r,a._names,k||a._formValues,!1,u.current);if(d.current){const D=d.current(N);xa(D,f.current)||(C(D),f.current=D)}else C(N)}},[a._formValues,a._names,o,r]);mi(()=>((m.current!==a||!xa(p.current,r))&&(m.current=a,p.current=r,y()),a._subscribe({name:r,formState:{values:!0},exact:i,callback:k=>{y(k.values)}})),[a,i,r,y]),O.useEffect(()=>a._removeUnmounted());const j=m.current!==a,x=p.current,v=O.useMemo(()=>{if(o)return null;const k=!j&&!xa(x,r);return j||k?g():null},[o,j,r,x,g]);return v!==null?v:w}function qp(t){const s=Pa(),{name:a,disabled:r,control:n=s.control,shouldUnregister:o,defaultValue:i,exact:l=!0}=t,u=Lp(n._names.array,a),d=O.useMemo(()=>lt(n._formValues,a,lt(n._defaultValues,a,i)),[n,a,i]),f=Bp({control:n,name:a,defaultValue:d,exact:l}),m=Wp({control:n,name:a,exact:l}),p=O.useRef(t),w=O.useRef(void 0),C=O.useRef(n.register(a,{...t.rules,value:f,...Ha(t.disabled)?{disabled:t.disabled}:{}}));p.current=t;const g=O.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!lt(m.errors,a)},isDirty:{enumerable:!0,get:()=>!!lt(m.dirtyFields,a)},isTouched:{enumerable:!0,get:()=>!!lt(m.touchedFields,a)},isValidating:{enumerable:!0,get:()=>!!lt(m.validatingFields,a)},error:{enumerable:!0,get:()=>lt(m.errors,a)}}),[m,a]),y=O.useCallback(k=>C.current.onChange({target:{value:Fp(k),name:a},type:Bn.CHANGE}),[a]),j=O.useCallback(()=>C.current.onBlur({target:{value:lt(n._formValues,a),name:a},type:Bn.BLUR}),[a,n._formValues]),x=O.useCallback(k=>{const N=lt(n._fields,a);N&&k&&(N._f.ref={focus:()=>k.focus&&k.focus(),select:()=>k.select&&k.select(),setCustomValidity:D=>k.setCustomValidity(D),reportValidity:()=>k.reportValidity()})},[n._fields,a]),v=O.useMemo(()=>({name:a,value:f,...Ha(r)||m.disabled?{disabled:m.disabled||r}:{},onChange:y,onBlur:j,ref:x}),[a,r,m.disabled,y,j,x,f]);return O.useEffect(()=>{const k=n._options.shouldUnregister||o,N=w.current;N&&N!==a&&!u&&n.unregister(N),n.register(a,{...p.current.rules,...Ha(p.current.disabled)?{disabled:p.current.disabled}:{}});const D=(P,R)=>{const A=lt(n._fields,P);A&&A._f&&(A._f.mount=R)};if(D(a,!0),k){const P=ci(lt(n._options.defaultValues,a,p.current.defaultValue));Un(n._defaultValues,a,P),ur(lt(n._formValues,a))&&Un(n._formValues,a,P)}return!u&&n.register(a),w.current=a,()=>{(u?k&&!n._state.action:k)?n.unregister(a):D(a,!1)}},[a,n,u,o]),O.useEffect(()=>{n._setDisabledField({disabled:r,name:a})},[r,a,n]),O.useMemo(()=>({field:v,formState:m,fieldState:g}),[v,m,g])}const hi=t=>t.render(qp(t)),Hp=Xe.cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),me=c.forwardRef(({className:t,...s},a)=>e.jsx(No.Root,{ref:a,className:b(Hp(),t),...s}));me.displayName=No.Root.displayName;const Gp=_p,fi=c.createContext({}),Xp=({...t})=>e.jsx(fi.Provider,{value:{name:t.name},children:e.jsx(hi,{...t})}),ta=()=>{const t=c.useContext(fi),s=c.useContext(pi),{getFieldState:a,formState:r}=Pa(),n=a(t.name,r);if(!t)throw new Error("useFormField should be used within <FormField>");const{id:o}=s;return{id:o,name:t.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...n}},pi=c.createContext({}),xi=c.forwardRef(({className:t,...s},a)=>{const r=c.useId();return e.jsx(pi.Provider,{value:{id:r},children:e.jsx("div",{ref:a,className:b("space-y-2",t),...s})})});xi.displayName="FormItem";const gi=c.forwardRef(({className:t,...s},a)=>{const{error:r,formItemId:n}=ta();return e.jsx(me,{ref:a,className:b(r&&"text-destructive",t),htmlFor:n,...s})});gi.displayName="FormLabel";const bi=c.forwardRef(({...t},s)=>{const{error:a,formItemId:r,formDescriptionId:n,formMessageId:o}=ta();return e.jsx(Aa.Slot,{ref:s,id:r,"aria-describedby":a?`${n} ${o}`:`${n}`,"aria-invalid":!!a,...t})});bi.displayName="FormControl";const ji=c.forwardRef(({className:t,...s},a)=>{const{formDescriptionId:r}=ta();return e.jsx("p",{ref:a,id:r,className:b("text-sm text-muted-foreground",t),...s})});ji.displayName="FormDescription";const vi=c.forwardRef(({className:t,children:s,...a},r)=>{const{error:n,formMessageId:o}=ta(),i=n?String(n?.message):s;return i?e.jsx("p",{ref:r,id:o,className:b("text-sm font-medium text-destructive",t),...a,children:i}):null});vi.displayName="FormMessage";const Kp=Ea.Root,Yp=Ea.Trigger,wi=c.forwardRef(({className:t,align:s="center",sideOffset:a=4,...r},n)=>e.jsx(Ea.Content,{ref:n,align:s,sideOffset:a,className:b("z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r}));wi.displayName=Ea.Content.displayName;const yi=c.forwardRef(({length:t=6,value:s="",onChange:a,onComplete:r,pattern:n="numeric",secure:o=!1,disabled:i=!1,className:l,error:u,size:d="md",separator:f,separatorElement:m=e.jsx("span",{className:"text-muted-foreground",children:"-"}),...p},w)=>{const[C,g]=c.useState(s.split("").slice(0,t)),y=c.useRef([]);c.useEffect(()=>{const R=s.split("").slice(0,t);g(R)},[s,t]);const x=(()=>{switch(n){case"numeric":return/^[0-9]$/;case"alpha":return/^[a-zA-Z]$/;case"alphanumeric":return/^[a-zA-Z0-9]$/;default:return/^.$/}})(),v=(R,A)=>{if(i)return;const S=A.slice(-1);if(S&&!x.test(S))return;const M=[...C];M[R]=S,g(M);const E=M.join("");a?.(E),S&&R<t-1&&y.current[R+1]?.focus(),M.every(T=>T!=="")&&M.length===t&&r?.(E)},k=(R,A)=>{if(!i){if(A.key==="Backspace"){A.preventDefault();const S=[...C];S[R]?(S[R]="",g(S),a?.(S.join(""))):R>0&&(S[R-1]="",g(S),a?.(S.join("")),y.current[R-1]?.focus())}if(A.key==="Delete"){A.preventDefault();const S=[...C];S[R]="",g(S),a?.(S.join(""))}A.key==="ArrowLeft"&&R>0&&(A.preventDefault(),y.current[R-1]?.focus()),A.key==="ArrowRight"&&R<t-1&&(A.preventDefault(),y.current[R+1]?.focus()),A.key==="Home"&&(A.preventDefault(),y.current[0]?.focus()),A.key==="End"&&(A.preventDefault(),y.current[t-1]?.focus())}},N=R=>{if(R.preventDefault(),i)return;const S=R.clipboardData.getData("text/plain").split("").filter(T=>x.test(T)).slice(0,t),M=[...C];S.forEach((T,K)=>{M[K]=T}),g(M),a?.(M.join(""));const E=M.findIndex(T=>!T);E!==-1?y.current[E]?.focus():y.current[t-1]?.focus(),M.every(T=>T!=="")&&M.length===t&&r?.(M.join(""))},D=R=>{R.target.select()},P={sm:"h-8 w-8 text-sm",md:"h-12 w-12 text-base",lg:"h-16 w-16 text-lg"}[d];return e.jsxs("div",{ref:w,className:b("flex flex-col gap-2",l),children:[e.jsx("div",{className:"flex items-center gap-2",children:Array.from({length:t}).map((R,A)=>e.jsxs(c.Fragment,{children:[e.jsx("input",{ref:S=>y.current[A]=S,type:o?"password":"text",inputMode:n==="numeric"?"numeric":"text",maxLength:1,value:C[A]||"",onChange:S=>v(A,S.target.value),onKeyDown:S=>k(A,S),onPaste:N,onFocus:D,disabled:i,className:b("flex items-center justify-center rounded-md border border-input bg-background text-center font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50",P,u&&"border-destructive focus-visible:ring-destructive",C[A]&&"border-primary"),"aria-label":`Caractère ${A+1} sur ${t}`,...p}),f&&(A+1)%f===0&&A<t-1&&e.jsx("div",{className:"flex items-center justify-center",children:m})]},A))}),u&&e.jsx("p",{className:"text-sm text-destructive",role:"alert",children:u})]})});yi.displayName="InputOTP";const oe=c.forwardRef(({className:t,type:s,...a},r)=>e.jsx("input",{type:s,className:b("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...a}));oe.displayName="Input";const Ve=ze.Root,Jp=ze.Group,We=ze.Value,$e=c.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(ze.Trigger,{ref:r,className:b("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...a,children:[s,e.jsx(ze.Icon,{asChild:!0,children:e.jsx(h.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));$e.displayName=ze.Trigger.displayName;const Ar=c.forwardRef(({className:t,...s},a)=>e.jsx(ze.ScrollUpButton,{ref:a,className:b("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(h.ChevronUp,{className:"h-4 w-4"})}));Ar.displayName=ze.ScrollUpButton.displayName;const Er=c.forwardRef(({className:t,...s},a)=>e.jsx(ze.ScrollDownButton,{ref:a,className:b("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(h.ChevronDown,{className:"h-4 w-4"})}));Er.displayName=ze.ScrollDownButton.displayName;const Le=c.forwardRef(({className:t,children:s,position:a="popper",...r},n)=>e.jsx(ze.Portal,{children:e.jsxs(ze.Content,{ref:n,className:b("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",a==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:a,...r,children:[e.jsx(Ar,{}),e.jsx(ze.Viewport,{className:b("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),e.jsx(Er,{})]})}));Le.displayName=ze.Content.displayName;const Ni=c.forwardRef(({className:t,...s},a)=>e.jsx(ze.Label,{ref:a,className:b("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...s}));Ni.displayName=ze.Label.displayName;const je=c.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(ze.Item,{ref:r,className:b("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(ze.ItemIndicator,{children:e.jsx(h.Check,{className:"h-4 w-4"})})}),e.jsx(ze.ItemText,{children:s})]}));je.displayName=ze.Item.displayName;const Ci=c.forwardRef(({className:t,...s},a)=>e.jsx(ze.Separator,{ref:a,className:b("-mx-1 my-1 h-px bg-muted",t),...s}));Ci.displayName=ze.Separator.displayName;function Qp({languages:t,value:s,onChange:a,showFlags:r=!0,showLabels:n=!0,variant:o="default",isLoading:i=!1,className:l,placeholder:u="Select language",ariaLabel:d="Select language"}){const[f,m]=c.useState(!1),[p,w]=c.useState(!1),C=c.useRef(null),g=c.useRef(null);c.useEffect(()=>{w(!0)},[]);const y=t.find(N=>N.code===s),j=N=>{a?.(N),m(!1)},[x,v]=c.useState({top:0,left:0});if(c.useEffect(()=>{if(f&&C.current&&p){const N=C.current.getBoundingClientRect();v({top:N.bottom+8,left:N.left})}},[f,p]),o==="default")return e.jsxs(Ve,{value:s,onValueChange:a,disabled:i,children:[e.jsx($e,{className:b("w-[180px]",l),children:e.jsx(We,{placeholder:u,children:y&&e.jsxs("div",{className:"flex items-center gap-2",children:[r&&y.flagEmoji&&e.jsx("span",{className:"text-lg",children:y.flagEmoji}),r&&y.flag&&!y.flagEmoji&&e.jsx("img",{src:y.flag,alt:y.label,className:"h-4 w-6 object-cover rounded"}),!r&&e.jsx(h.Globe,{className:"h-4 w-4 text-muted-foreground"}),n&&e.jsx("span",{children:y.label})]})})}),e.jsx(Le,{children:t.map(N=>e.jsx(je,{value:N.code,children:e.jsxs("div",{className:"flex items-center gap-2",children:[r&&N.flagEmoji&&e.jsx("span",{className:"text-lg",children:N.flagEmoji}),r&&N.flag&&!N.flagEmoji&&e.jsx("img",{src:N.flag,alt:N.label,className:"h-4 w-6 object-cover rounded"}),n&&N.label]})},N.code))})]});if(o==="minimal"){const N=f&&p?e.jsx("div",{ref:g,className:"fixed z-[9999] min-w-[160px] rounded-md border border-border bg-popover text-popover-foreground p-2 shadow-lg",style:{top:`${x.top}px`,left:`${x.left}px`},onMouseDown:D=>D.stopPropagation(),children:e.jsx("div",{className:"grid gap-1",children:t.map(D=>e.jsxs("button",{onMouseDown:P=>{P.preventDefault(),P.stopPropagation(),j(D.code)},type:"button",className:b("flex items-center gap-2 rounded-sm px-2 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer",s===D.code&&"bg-accent"),children:[D.flagEmoji&&e.jsx("span",{className:"text-lg",children:D.flagEmoji}),D.flag&&!D.flagEmoji&&e.jsx("img",{src:D.flag,alt:D.label,className:"h-4 w-6 object-cover rounded"}),e.jsx("span",{className:"flex-1 text-left",children:D.label}),s===D.code&&e.jsx(h.Check,{className:"h-4 w-4 shrink-0"})]},D.code))})}):null;return e.jsxs(e.Fragment,{children:[e.jsxs("button",{ref:C,onClick:D=>{D.preventDefault(),D.stopPropagation(),m(!f)},className:b("flex h-9 w-9 items-center justify-center rounded-md border border-input bg-transparent hover:bg-accent hover:text-accent-foreground transition-colors",l),title:"Changer de langue",type:"button",disabled:i,children:[y?.flagEmoji?e.jsx("span",{className:"text-lg",children:y.flagEmoji}):e.jsx(h.Globe,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:d})]}),p&&typeof document<"u"&&N&&rr.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[9998]",onMouseDown:D=>{D.preventDefault(),m(!1)}}),N]}),document.body)]})}const k=f&&p?e.jsx("div",{ref:g,className:"fixed z-[9999] min-w-[180px] rounded-md border border-border bg-popover text-popover-foreground p-2 shadow-lg",style:{top:`${x.top}px`,left:`${x.left}px`},onMouseDown:N=>N.stopPropagation(),children:e.jsx("div",{className:"grid gap-1",children:t.map(N=>e.jsxs("button",{onMouseDown:D=>{D.preventDefault(),D.stopPropagation(),j(N.code)},type:"button",className:b("flex items-center gap-2 rounded-sm px-2 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer",s===N.code&&"bg-accent"),children:[r&&N.flagEmoji&&e.jsx("span",{className:"text-lg",children:N.flagEmoji}),r&&N.flag&&!N.flagEmoji&&e.jsx("img",{src:N.flag,alt:N.label,className:"h-4 w-6 object-cover rounded"}),e.jsx("span",{className:"flex-1 text-left",children:N.label}),s===N.code&&e.jsx(h.Check,{className:"h-4 w-4 shrink-0"})]},N.code))})}):null;return e.jsxs(e.Fragment,{children:[e.jsxs("button",{ref:C,onClick:N=>{N.preventDefault(),N.stopPropagation(),i||m(!f)},className:b("inline-flex items-center gap-2 rounded-md border border-input bg-transparent px-3 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors",i&&"opacity-50 cursor-not-allowed",l),disabled:i,type:"button","aria-label":d,children:[r&&y?.flagEmoji&&e.jsx("span",{className:"text-lg",children:y.flagEmoji}),r&&y?.flag&&!y?.flagEmoji&&e.jsx("img",{src:y.flag,alt:y.label,className:"h-4 w-6 object-cover rounded"}),!r&&e.jsx(h.Globe,{className:"h-4 w-4"}),n&&e.jsx("span",{children:y?.label||"Langue"}),e.jsx(h.ChevronDown,{className:"h-4 w-4"})]}),p&&typeof document<"u"&&k&&rr.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[9998]",onMouseDown:N=>{N.preventDefault(),m(!1)}}),k]}),document.body)]})}const Zp=Ae.Menu,ex=Ae.Group,tx=Ae.Portal,sx=Ae.Sub,ax=Ae.RadioGroup,ki=c.forwardRef(({className:t,...s},a)=>e.jsx(Ae.Root,{ref:a,className:b("flex h-10 items-center space-x-1 rounded-md border bg-background p-1",t),...s}));ki.displayName=Ae.Root.displayName;const Si=c.forwardRef(({className:t,...s},a)=>e.jsx(Ae.Trigger,{ref:a,className:b("flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t),...s}));Si.displayName=Ae.Trigger.displayName;const Di=c.forwardRef(({className:t,inset:s,children:a,...r},n)=>e.jsxs(Ae.SubTrigger,{ref:n,className:b("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",s&&"pl-8",t),...r,children:[a,e.jsx(h.ChevronRight,{className:"ml-auto h-4 w-4"})]}));Di.displayName=Ae.SubTrigger.displayName;const Ti=c.forwardRef(({className:t,...s},a)=>e.jsx(Ae.SubContent,{ref:a,className:b("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s}));Ti.displayName=Ae.SubContent.displayName;const Ai=c.forwardRef(({className:t,align:s="start",alignOffset:a=-4,sideOffset:r=8,...n},o)=>e.jsx(Ae.Portal,{children:e.jsx(Ae.Content,{ref:o,align:s,alignOffset:a,sideOffset:r,className:b("z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));Ai.displayName=Ae.Content.displayName;const Ei=c.forwardRef(({className:t,inset:s,...a},r)=>e.jsx(Ae.Item,{ref:r,className:b("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s&&"pl-8",t),...a}));Ei.displayName=Ae.Item.displayName;const Mi=c.forwardRef(({className:t,children:s,checked:a,...r},n)=>e.jsxs(Ae.CheckboxItem,{ref:n,className:b("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:a,...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Ae.ItemIndicator,{children:e.jsx(h.Check,{className:"h-4 w-4"})})}),s]}));Mi.displayName=Ae.CheckboxItem.displayName;const Pi=c.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(Ae.RadioItem,{ref:r,className:b("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...a,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Ae.ItemIndicator,{children:e.jsx(h.Circle,{className:"h-2 w-2 fill-current"})})}),s]}));Pi.displayName=Ae.RadioItem.displayName;const Ri=c.forwardRef(({className:t,inset:s,...a},r)=>e.jsx(Ae.Label,{ref:r,className:b("px-2 py-1.5 text-sm font-semibold",s&&"pl-8",t),...a}));Ri.displayName=Ae.Label.displayName;const Fi=c.forwardRef(({className:t,...s},a)=>e.jsx(Ae.Separator,{ref:a,className:b("-mx-1 my-1 h-px bg-muted",t),...s}));Fi.displayName=Ae.Separator.displayName;const $i=({className:t,...s})=>e.jsx("span",{className:b("ml-auto text-xs tracking-widest text-muted-foreground",t),...s});$i.displayName="MenubarShortcut";const Li=c.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(ut.Root,{ref:r,className:b("relative z-10 flex max-w-max flex-1 items-center justify-center",t),...a,children:[s,e.jsx(Mr,{})]}));Li.displayName=ut.Root.displayName;const Ii=c.forwardRef(({className:t,...s},a)=>e.jsx(ut.List,{ref:a,className:b("group flex flex-1 list-none items-center justify-center space-x-1",t),...s}));Ii.displayName=ut.List.displayName;const rx=ut.Item,Oi=Xe.cva("group inline-flex h-10 w-max items-center justify-center rounded-md bg-background px-4 py-2 text-sm font-medium transition-colors hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none disabled:pointer-events-none disabled:opacity-50 data-[active]:bg-accent/50 data-[state=open]:bg-accent/50"),zi=c.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(ut.Trigger,{ref:r,className:b(Oi(),"group",t),...a,children:[s," ",e.jsx(h.ChevronDown,{className:"relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180","aria-hidden":"true"})]}));zi.displayName=ut.Trigger.displayName;const _i=c.forwardRef(({className:t,...s},a)=>e.jsx(ut.Content,{ref:a,className:b("left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto ",t),...s}));_i.displayName=ut.Content.displayName;const nx=ut.Link,Mr=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{className:b("absolute left-0 top-full flex justify-center"),children:e.jsx(ut.Viewport,{className:b("origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]",t),ref:a,...s})}));Mr.displayName=ut.Viewport.displayName;const Vi=c.forwardRef(({className:t,...s},a)=>e.jsx(ut.Indicator,{ref:a,className:b("top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",t),...s,children:e.jsx("div",{className:"relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md"})}));Vi.displayName=ut.Indicator.displayName;const rt=qs.Root,nt=qs.Trigger,st=c.forwardRef(({className:t,align:s="center",sideOffset:a=4,...r},n)=>e.jsx(qs.Portal,{children:e.jsx(qs.Content,{ref:n,align:s,sideOffset:a,className:b("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));st.displayName=qs.Content.displayName;const Xs=c.forwardRef(({className:t,value:s,...a},r)=>e.jsx(or.Root,{ref:r,className:b("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...a,children:e.jsx(or.Indicator,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(s||0)}%)`}})}));Xs.displayName=or.Root.displayName;const Wi=c.forwardRef(({className:t,...s},a)=>e.jsx(Hs.Root,{className:b("grid gap-2",t),...s,ref:a}));Wi.displayName=Hs.Root.displayName;const Ui=c.forwardRef(({className:t,...s},a)=>e.jsx(Hs.Item,{ref:a,className:b("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:e.jsx(Hs.Indicator,{className:"flex items-center justify-center",children:e.jsx(h.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Ui.displayName=Hs.Item.displayName;const At=c.forwardRef(({className:t,children:s,...a},r)=>e.jsxs(us.Root,{ref:r,className:b("relative overflow-hidden",t),...a,children:[e.jsx(us.Viewport,{className:"h-full w-full rounded-[inherit]",children:s}),e.jsx(Pr,{}),e.jsx(us.Corner,{})]}));At.displayName=us.Root.displayName;const Pr=c.forwardRef(({className:t,orientation:s="vertical",...a},r)=>e.jsx(us.ScrollAreaScrollbar,{ref:r,orientation:s,className:b("flex touch-none select-none transition-colors",s==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",s==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...a,children:e.jsx(us.ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));Pr.displayName=us.ScrollAreaScrollbar.displayName;const kt=c.forwardRef(({className:t,orientation:s="horizontal",decorative:a=!0,...r},n)=>e.jsx(Co.Root,{ref:n,decorative:a,orientation:s,className:b("shrink-0 bg-border",s==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...r}));kt.displayName=Co.Root.displayName;const sa=ue.Root,Rr=ue.Trigger,ox=ue.Close,Bi=ue.Portal,Fr=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Overlay,{className:b("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s,ref:a}));Fr.displayName=ue.Overlay.displayName;const ix=Xe.cva("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Ds=c.forwardRef(({side:t="right",className:s,children:a,...r},n)=>e.jsxs(Bi,{children:[e.jsx(Fr,{}),e.jsxs(ue.Content,{ref:n,className:b(ix({side:t}),s),...r,children:[a,e.jsxs(ue.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[e.jsx(h.X,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ds.displayName=ue.Content.displayName;const Ra=({className:t,...s})=>e.jsx("div",{className:b("flex flex-col space-y-2 text-center sm:text-left",t),...s});Ra.displayName="SheetHeader";const $r=({className:t,...s})=>e.jsx("div",{className:b("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});$r.displayName="SheetFooter";const aa=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Title,{ref:a,className:b("text-lg font-semibold text-foreground",t),...s}));aa.displayName=ue.Title.displayName;const ra=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Description,{ref:a,className:b("text-sm text-muted-foreground",t),...s}));ra.displayName=ue.Description.displayName;function qi({className:t,...s}){return e.jsx("div",{className:b("animate-pulse rounded-md bg-muted",t),...s})}const ya=c.forwardRef(({className:t,...s},a)=>e.jsxs(Os.Root,{ref:a,className:b("relative flex w-full touch-none select-none items-center",t),...s,children:[e.jsx(Os.Track,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:e.jsx(Os.Range,{className:"absolute h-full bg-primary"})}),e.jsx(Os.Thumb,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));ya.displayName=Os.Root.displayName;const na=c.forwardRef(({className:t,...s},a)=>e.jsx(ir.Root,{className:b("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",t),...s,ref:a,children:e.jsx(ir.Thumb,{className:b("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));na.displayName=ir.Root.displayName;const Fa=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{className:"relative w-full overflow-auto",children:e.jsx("table",{ref:a,className:b("w-full caption-bottom text-sm",t),...s})}));Fa.displayName="Table";const $a=c.forwardRef(({className:t,...s},a)=>e.jsx("thead",{ref:a,className:b("[&_tr]:border-b",t),...s}));$a.displayName="TableHeader";const La=c.forwardRef(({className:t,...s},a)=>e.jsx("tbody",{ref:a,className:b("[&_tr:last-child]:border-0",t),...s}));La.displayName="TableBody";const Hi=c.forwardRef(({className:t,...s},a)=>e.jsx("tfoot",{ref:a,className:b("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...s}));Hi.displayName="TableFooter";const qt=c.forwardRef(({className:t,...s},a)=>e.jsx("tr",{ref:a,className:b("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",t),...s}));qt.displayName="TableRow";const ct=c.forwardRef(({className:t,...s},a)=>e.jsx("th",{ref:a,className:b("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...s}));ct.displayName="TableHead";const tt=c.forwardRef(({className:t,...s},a)=>e.jsx("td",{ref:a,className:b("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...s}));tt.displayName="TableCell";const Gi=c.forwardRef(({className:t,...s},a)=>e.jsx("caption",{ref:a,className:b("mt-4 text-sm text-muted-foreground",t),...s}));Gi.displayName="TableCaption";const oa=ws.Root,Ts=c.forwardRef(({className:t,...s},a)=>e.jsx(ws.List,{ref:a,className:b("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...s}));Ts.displayName=ws.List.displayName;const js=c.forwardRef(({className:t,...s},a)=>e.jsx(ws.Trigger,{ref:a,className:b("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",t),...s}));js.displayName=ws.Trigger.displayName;const vs=c.forwardRef(({className:t,...s},a)=>e.jsx(ws.Content,{ref:a,className:b("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...s}));vs.displayName=ws.Content.displayName;const ft=c.forwardRef(({className:t,...s},a)=>e.jsx("textarea",{className:b("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:a,...s}));ft.displayName="Textarea";const Xi=c.createContext(void 0);function Ki({children:t,themes:s,defaultTheme:a="default",s3Config:r,onThemeChange:n,enableDarkMode:o=!1}){const[i,l]=c.useState(a),[u,d]=c.useState(!0),[f,m]=c.useState(new Set),[p,w]=c.useState(!1),[C,g]=c.useState(!1),y=c.useRef(new Map),j=c.useRef(new Set);c.useEffect(()=>{j.current=f},[f]);const x=c.useCallback(async S=>{if(!r)throw new Error("S3 configuration not provided");const{baseUrl:M,prefix:E="",extension:T="css",headers:K={},timeout:q=1e4}=r,B=M.replace(/\/+$/,""),W=E.replace(/^\/+/,"").replace(/\/+$/,""),I=`v=${Date.now()}`;let z;W?z=`${B}/${W}/${S}.${T}?${I}`:z=`${B}/${S}.${T}?${I}`,console.log(`[ThemeProvider] Loading theme "${S}" from URL: ${z}`);try{const $=new AbortController,_=setTimeout(()=>$.abort(),q),F=await fetch(z,{signal:$.signal,headers:{Accept:T==="json"?"application/json":"text/css","Cache-Control":"no-cache, no-store, must-revalidate",Pragma:"no-cache",...K}});if(clearTimeout(_),!F.ok){const J=`HTTP ${F.status}: ${F.statusText}`;throw console.error(`[ThemeProvider] Failed to load theme "${S}" from ${z}:`,J),new Error(J)}if(console.log(`[ThemeProvider] ✅ Successfully loaded theme "${S}" from ${z}`),T==="json"){let J;try{const Q=await F.text();if(console.log(`[ThemeProvider] Raw JSON response for theme "${S}" (${Q.length} chars)`),!Q||Q.trim().length===0)throw new Error(`Empty JSON response for theme "${S}"`);J=JSON.parse(Q),console.log(`[ThemeProvider] Parsed JSON for theme "${S}":`,Object.keys(J))}catch(Q){throw console.error(`[ThemeProvider] Failed to parse JSON for theme "${S}":`,Q),new Error(`Invalid JSON format for theme "${S}": ${Q instanceof Error?Q.message:"Unknown error"}`)}try{const Q=lx(S,J);if(!Q.includes(`[data-theme="${S}"]`))throw console.error(`[ThemeProvider] ❌ Generated CSS missing [data-theme="${S}"] selector for theme "${S}"`),console.error("[ThemeProvider] Generated CSS:",Q.substring(0,500)),new Error(`Generated CSS is missing the required selector [data-theme="${S}"]`);return console.log(`[ThemeProvider] ✅ Converted JSON to CSS for theme "${S}" (${Q.length} chars)`),Q}catch(Q){throw console.error(`[ThemeProvider] Failed to convert JSON to CSS for theme "${S}":`,Q),Q}}const H=await F.text();if(!H||H.trim().length===0)throw new Error(`Empty CSS response for theme "${S}"`);return!H.includes(`[data-theme="${S}"]`)&&!H.includes(":root")&&!H.includes("html")?(console.warn(`[ThemeProvider] Theme CSS might be missing [data-theme="${S}"] selector`),console.warn("[ThemeProvider] CSS content preview:",H.substring(0,200))):console.log(`[ThemeProvider] ✅ CSS file loaded for theme "${S}" (${H.length} chars)`),H}catch($){throw console.error(`[ThemeProvider] Error loading theme ${S}:`,$),$}},[r]);c.useCallback(S=>{const M=y.current.get(S);M&&(M.parentNode&&M.parentNode.removeChild(M),y.current.delete(S))},[]);const v=c.useCallback((S,M)=>{if(typeof document>"u")return;!M.includes(`[data-theme="${S}"]`)&&!M.includes(":root")&&console.warn(`[ThemeProvider] CSS might be missing [data-theme="${S}"] selector:`,M.substring(0,200)),document.querySelectorAll("style[data-theme-styles]").forEach(q=>q.remove()),y.current.clear();const T=document.createElement("style");T.setAttribute("data-theme-id",S),T.setAttribute("data-theme-styles","active"),T.textContent=M,document.head.appendChild(T),y.current.set(S,T),document.querySelector(`style[data-theme-id="${S}"]`)?console.log(`[ThemeProvider] ✅ CSS injected for theme "${S}" (${M.length} chars)`):console.error(`[ThemeProvider] ❌ Failed to inject CSS for theme "${S}"`),T.offsetHeight},[]),k=c.useCallback(S=>{if(typeof document>"u")return;const M=document.documentElement;M.setAttribute("data-theme",S);const E=M.getAttribute("data-theme");E!==S?console.warn(`[ThemeProvider] Failed to apply theme attribute. Expected: ${S}, Got: ${E}`):console.log(`[ThemeProvider] ✅ Theme attribute applied: data-theme="${S}"`);try{localStorage.setItem("waka-theme",S)}catch(T){console.warn("[ThemeProvider] Could not save theme to localStorage:",T)}},[]),N=c.useCallback(async S=>{if(!j.current.has(S))try{if(r){const M=await x(S);v(S,M),m(E=>new Set(E).add(S))}else m(M=>new Set(M).add(S))}catch(M){throw console.error(`[ThemeProvider] Failed to preload theme ${S}:`,M),M}},[r,x,v]),D=c.useCallback(async S=>{console.log(`[ThemeProvider] changeTheme called with themeId: ${S}`),d(!0);try{if(r){console.log(`[ThemeProvider] Loading theme from S3: ${S}`);const M=await x(S);console.log(`[ThemeProvider] CSS loaded, length: ${M.length}`),v(S,M),m(E=>new Set(E).add(S)),await new Promise(E=>requestAnimationFrame(E))}else console.log("[ThemeProvider] No S3 config, applying theme directly");console.log(`[ThemeProvider] Applying theme attribute: ${S}`),k(S),l(S),console.log(`[ThemeProvider] ✅ Theme changed successfully to: ${S}`),n?.(S)}catch(M){console.error(`[ThemeProvider] ❌ Failed to change theme to ${S}:`,M);try{k(S),l(S)}catch(E){console.error("[ThemeProvider] ❌ Fallback also failed:",E)}throw M}finally{d(!1)}},[r,x,v,k,n]),P=c.useCallback(S=>f.has(S),[f]);c.useEffect(()=>{if(p)return;(async()=>{d(!0);try{let M=a;if(typeof window<"u"){const E=localStorage.getItem("waka-theme");E&&s.some(T=>T.id===E)&&(M=E)}if(r){const E=await x(M);v(M,E),m(new Set([M])),await new Promise(T=>requestAnimationFrame(T))}else m(new Set([M]));k(M),l(M)}catch(M){console.error("[ThemeProvider] Error initializing:",M),k(a),l(a),m(new Set([a]))}finally{d(!1),w(!0)}})()},[p,a,s,r,x,v,k]);const R=c.useCallback(()=>{o&&g(S=>{const M=!S,E=document.documentElement;M?E.classList.add("dark"):E.classList.remove("dark");try{localStorage.setItem("waka-dark-mode",M?"dark":"light")}catch(T){console.warn("[ThemeProvider] Could not save dark mode to localStorage:",T)}return M})},[o]);c.useEffect(()=>{if(!o||typeof window>"u")return;let S=!1;try{const K=localStorage.getItem("waka-dark-mode");K!==null?S=K==="dark":(S=window.matchMedia("(prefers-color-scheme: dark)").matches,localStorage.setItem("waka-dark-mode",S?"dark":"light"))}catch(K){console.warn("[ThemeProvider] Could not read dark mode from localStorage:",K)}g(S);const M=document.documentElement;S?M.classList.add("dark"):M.classList.remove("dark");const E=window.matchMedia("(prefers-color-scheme: dark)"),T=K=>{try{localStorage.getItem("waka-dark-mode")||(g(K.matches),K.matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),localStorage.setItem("waka-dark-mode",K.matches?"dark":"light"))}catch{}};return E.addEventListener("change",T),()=>{E.removeEventListener("change",T)}},[]),c.useEffect(()=>()=>{y.current.forEach(S=>{S.parentNode&&S.parentNode.removeChild(S)}),y.current.clear()},[]);const A={currentTheme:i,themes:s,changeTheme:D,isLoading:u,loadedThemes:f,preloadTheme:N,isThemeLoaded:P,isDarkMode:C,toggleDarkMode:R};return e.jsx(Xi.Provider,{value:A,children:t})}function lx(t,s){if(!s||typeof s!="object")throw console.error(`[ThemeProvider] Invalid JSON data for theme "${t}":`,s),new Error(`Invalid JSON data for theme "${t}"`);let a={};if(s.cssVars||s["css-vars"])a=s.cssVars||s["css-vars"],console.log(`[ThemeProvider] Using cssVars/css-vars format for theme "${t}"`);else if(s.variables)a=s.variables,console.log(`[ThemeProvider] Using variables format for theme "${t}"`);else if(typeof s=="object"&&s!==null){const g=["label","description","author","previewColor","version","createdAt","changelog","id"];a=Object.fromEntries(Object.entries(s).filter(([y])=>!g.includes(y))),console.log(`[ThemeProvider] Using direct object format for theme "${t}"`)}if(!a||Object.keys(a).length===0)throw console.error(`[ThemeProvider] No CSS variables found in JSON for theme "${t}":`,s),new Error(`No CSS variables found in JSON for theme "${t}"`);console.log(`[ThemeProvider] Found ${Object.keys(a).length} CSS variables for theme "${t}"`);const r=(g,y)=>{if(typeof g=="string")return g;if(typeof g=="number"||typeof g=="boolean")return String(g);if(g==null)return"none";if(typeof g=="object"){if(Array.isArray(g))return g.map(x=>r(x,y)).join(" ");if(console.log(`[ThemeProvider] Converting object value for key "${y}":`,JSON.stringify(g,null,2)),("r"in g||"R"in g)&&("g"in g||"G"in g)&&("b"in g||"B"in g)){const x=g.r??g.R??0,v=g.g??g.G??0,k=g.b??g.B??0,N=g.a??g.A??g.alpha??g.opacity;return N!=null?`rgba(${x}, ${v}, ${k}, ${N})`:`rgb(${x}, ${v}, ${k})`}if(("h"in g||"H"in g)&&("s"in g||"S"in g)&&("l"in g||"L"in g)){const x=g.h??g.H??0,v=g.s??g.S??0,k=g.l??g.L??0,N=g.a??g.A??g.alpha??g.opacity;return N!=null?`hsla(${x}, ${v}%, ${k}%, ${N})`:`hsl(${x}, ${v}%, ${k}%)`}return Object.keys(g).length>0?(console.warn(`[ThemeProvider] Object value for "${y}" has nested structure, cannot convert to CSS:`,g),JSON.stringify(g)):"none"}return console.warn(`[ThemeProvider] Unknown value type for "${y}":`,typeof g,g),String(g)},n=(g,y="")=>{const j=[];for(const[x,v]of Object.entries(g))if(typeof v=="object"&&v!==null&&!Array.isArray(v))if(("r"in v||"R"in v||"h"in v||"H"in v)&&("g"in v||"G"in v||"s"in v||"S"in v)){const N=y?`--${y}-${x}`:x.startsWith("--")?x:`--${x}`,D=r(v,x);j.push(` ${N}: ${D};`)}else{const N=y?`${y}-${x}`:"",D=n(v,N);j.push(...D)}else{const k=y?`--${y}-${x}`:x.startsWith("--")?x:`--${x}`,N=r(v,x);j.push(` ${k}: ${N};`)}return j},o=a.light,i=a.dark,l=a.theme,u=Object.fromEntries(Object.entries(a).filter(([g])=>!["light","dark","theme"].includes(g))),d=[];l&&typeof l=="object"&&!Array.isArray(l)&&d.push(...n(l,"")),Object.keys(u).length>0&&d.push(...n(u,""));const f=o&&typeof o=="object"&&!Array.isArray(o)?n(o,""):[],m=i&&typeof i=="object"&&!Array.isArray(i)?n(i,""):[];let p="";if(d.length>0||f.length>0){const g=[...d,...f];p+=`[data-theme="${t}"] {
4
4
  ${g.join(`
5
5
  `)}
6
6
  }
@@ -9,10 +9,10 @@ ${g.join(`
9
9
  [data-theme="${t}"][data-theme-mode="dark"] {
10
10
  ${m.join(`
11
11
  `)}
12
- }`);const w=p.trim();if(w.trim().length===0)throw console.error(`[ThemeProvider] No CSS variables generated for theme "${t}"`),new Error(`No CSS variables found in JSON for theme "${t}"`);const C=w;if(!C.includes(`[data-theme="${t}"]`))throw console.error(`[ThemeProvider] Generated CSS is missing the selector for theme "${t}"`),console.error("[ThemeProvider] Generated CSS:",C),new Error(`Generated CSS is missing the required selector [data-theme="${t}"]`);return C.length<50&&console.warn(`[ThemeProvider] Generated CSS seems too short for theme "${t}":`,C),console.log(`[ThemeProvider] ✅ Generated valid CSS for theme "${t}" with ${Object.keys(a).length} variables`),C}function na(){const t=c.useContext(Xi);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}const Yi=c.forwardRef(({className:t,variant:s="default",ariaLabel:a="Select theme"},r)=>{const{currentTheme:n,changeTheme:o,themes:i,isLoading:l}=na(),[u,d]=c.useState(!1),[f,m]=c.useState(!1),p=c.useRef(null),w=c.useRef(null);c.useEffect(()=>{m(!0)},[]);const C=async(j,x)=>{x&&(x.preventDefault(),x.stopPropagation());try{console.log(`[ThemeSelector] Changing theme to: ${j}`),await o(j),console.log(`[ThemeSelector] ✅ Theme changed to: ${j}`)}catch(v){console.error(`[ThemeSelector] ❌ Failed to change theme to ${j}:`,v)}s==="compact"&&setTimeout(()=>d(!1),100)},[g,y]=c.useState({top:0,right:0});if(c.useEffect(()=>{if(u&&p.current&&f){const j=p.current.getBoundingClientRect();y({top:j.bottom+8,right:window.innerWidth-j.right})}},[u,f]),s==="compact"){const j=u&&f?e.jsxs("div",{ref:w,className:"fixed z-[9999] min-w-[220px] rounded-md border border-border bg-popover text-popover-foreground p-2 shadow-lg",style:{top:`${g.top}px`,right:`${g.right}px`},onMouseDown:x=>{x.stopPropagation()},children:[e.jsx("div",{className:"px-2 py-1.5 border-b border-border mb-2",children:e.jsxs("div",{className:"text-xs font-medium text-muted-foreground flex items-center justify-between",children:[e.jsx("span",{children:"Thèmes"}),l&&e.jsx(h.Loader2,{className:"h-3 w-3 animate-spin"})]})}),l&&i.length===0?e.jsxs("div",{className:"flex items-center justify-center py-6 text-sm text-muted-foreground",children:[e.jsx(h.Loader2,{className:"h-4 w-4 mr-2 animate-spin"}),"Chargement..."]}):e.jsxs("div",{className:"grid gap-1",children:[i.map(x=>e.jsxs("button",{onMouseDown:v=>{v.preventDefault(),v.stopPropagation(),C(x.id,v)},type:"button",className:b("flex items-center gap-3 rounded-sm px-2 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer",n===x.id&&"bg-accent"),children:[x.previewColor&&e.jsx("div",{className:"h-4 w-4 rounded border border-border shrink-0",style:{backgroundColor:x.previewColor}}),e.jsx("span",{className:"flex-1 text-left",children:x.label}),n===x.id&&e.jsx(h.Check,{className:"h-4 w-4 shrink-0"})]},x.id)),i.length===0&&!l&&e.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Aucun thème disponible"})]}),e.jsx("div",{className:"px-2 py-1.5 border-t border-border mt-2",children:e.jsxs("div",{className:"text-xs text-muted-foreground",children:[i.length," thème",i.length>1?"s":""," disponible",i.length>1?"s":""]})})]}):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:r,className:b("relative",t),children:e.jsxs("button",{ref:p,onMouseDown:x=>{x.preventDefault(),x.stopPropagation()},onClick:x=>{x.preventDefault(),x.stopPropagation(),d(!u)},className:"flex h-9 w-9 items-center justify-center rounded-md border border-input bg-transparent hover:bg-accent hover:text-accent-foreground relative",title:"Changer de thème",type:"button",children:[e.jsx(h.Palette,{className:"h-4 w-4"}),l&&e.jsx(h.Loader2,{className:"h-3 w-3 absolute top-1 right-1 animate-spin text-primary"}),e.jsx("span",{className:"sr-only",children:a})]})}),f&&typeof document<"u"&&j&&er.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[9998]",onMouseDown:x=>{x.preventDefault(),d(!1)}}),j]}),document.body)]})}if(s==="select"){const j=i.find(x=>x.id===n);return e.jsx("div",{ref:r,className:b("w-full",t),children:e.jsxs(Ve,{value:n,onValueChange:async x=>{try{console.log(`[ThemeSelector] Changing theme to: ${x}`),await o(x),console.log(`[ThemeSelector] ✅ Theme changed to: ${x}`)}catch(v){console.error(`[ThemeSelector] ❌ Failed to change theme to ${x}:`,v)}},disabled:l||i.length===0,children:[e.jsx($e,{className:"w-full","aria-label":a,children:e.jsx(We,{children:l&&i.length===0?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(h.Loader2,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{children:"Chargement..."})]}):j?e.jsxs("span",{className:"flex items-center gap-3",children:[j.previewColor&&e.jsx("div",{className:"h-4 w-4 rounded border border-border shrink-0",style:{backgroundColor:j.previewColor}}),e.jsx("span",{className:"truncate",children:j.label})]}):e.jsx("span",{className:"text-muted-foreground",children:"Sélectionner un thème"})})}),e.jsxs(Le,{children:[i.map(x=>e.jsx(je,{value:x.id,className:"cursor-pointer",children:e.jsxs("div",{className:"flex items-center gap-3 w-full",children:[x.previewColor&&e.jsx("div",{className:"h-4 w-4 rounded border border-border shrink-0",style:{backgroundColor:x.previewColor}}),e.jsx("span",{className:"flex-1 text-left truncate",children:x.label})]})},x.id)),i.length===0&&!l&&e.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Aucun thème disponible"})]})]})})}return e.jsx("div",{ref:r,className:b("grid gap-4",t),children:l&&i.length===0?e.jsxs("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:[e.jsx(h.Loader2,{className:"h-5 w-5 mr-2 animate-spin"}),"Chargement des thèmes..."]}):e.jsxs(e.Fragment,{children:[i.map(j=>e.jsxs("button",{onClick:async x=>{x.preventDefault(),x.stopPropagation(),await C(j.id,x)},type:"button",className:b("relative flex flex-col items-start gap-2 rounded-lg border-2 p-4 text-left transition-all hover:border-primary",n===j.id?"border-primary bg-primary/5":"border-muted"),children:[e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"font-semibold",children:j.label}),j.description&&e.jsx("span",{className:"text-sm text-muted-foreground",children:j.description})]}),n===j.id&&e.jsx(h.Check,{className:"h-5 w-5 text-primary shrink-0"})]}),j.previewColor&&e.jsx("div",{className:"flex gap-2 w-full",children:e.jsx("div",{className:"h-8 w-full rounded border",style:{backgroundColor:j.previewColor}})})]},j.id)),i.length===0&&!l&&e.jsx("div",{className:"py-12 text-center text-sm text-muted-foreground",children:"Aucun thème disponible"})]})})});Yi.displayName="ThemeSelector";const Ji=pt.Provider,Pr=c.forwardRef(({className:t,...s},a)=>e.jsx(pt.Viewport,{ref:a,className:b("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...s}));Pr.displayName=pt.Viewport.displayName;const cx=Xe.cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Rr=c.forwardRef(({className:t,variant:s,...a},r)=>e.jsx(pt.Root,{ref:r,className:b(cx({variant:s}),t),...a}));Rr.displayName=pt.Root.displayName;const Qi=c.forwardRef(({className:t,...s},a)=>e.jsx(pt.Action,{ref:a,className:b("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...s}));Qi.displayName=pt.Action.displayName;const Fr=c.forwardRef(({className:t,...s},a)=>e.jsx(pt.Close,{ref:a,className:b("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...s,children:e.jsx(h.X,{className:"h-4 w-4"})}));Fr.displayName=pt.Close.displayName;const $r=c.forwardRef(({className:t,...s},a)=>e.jsx(pt.Title,{ref:a,className:b("text-sm font-semibold",t),...s}));$r.displayName=pt.Title.displayName;const Lr=c.forwardRef(({className:t,...s},a)=>e.jsx(pt.Description,{ref:a,className:b("text-sm opacity-90",t),...s}));Lr.displayName=pt.Description.displayName;const dx=1,ux=1e6;let Ua=0;function mx(){return Ua=(Ua+1)%Number.MAX_SAFE_INTEGER,Ua.toString()}const Ba=new Map,Xn=t=>{if(Ba.has(t))return;const s=setTimeout(()=>{Ba.delete(t),Ws({type:"REMOVE_TOAST",toastId:t})},ux);Ba.set(t,s)},Zi=(t,s)=>{switch(s.type){case"ADD_TOAST":return{...t,toasts:[s.toast,...t.toasts].slice(0,dx)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(a=>a.id===s.toast.id?{...a,...s.toast}:a)};case"DISMISS_TOAST":{const{toastId:a}=s;return a?Xn(a):t.toasts.forEach(r=>{Xn(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===a||a===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return s.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(a=>a.id!==s.toastId)}}},pa=[];let xa={toasts:[]};function Ws(t){xa=Zi(xa,t),pa.forEach(s=>{s(xa)})}function el({...t}){const s=mx(),a=n=>Ws({type:"UPDATE_TOAST",toast:{...n,id:s}}),r=()=>Ws({type:"DISMISS_TOAST",toastId:s});return Ws({type:"ADD_TOAST",toast:{...t,id:s,open:!0,onOpenChange:n=>{n||r()}}}),{id:s,dismiss:r,update:a}}function Ir(){const[t,s]=c.useState(xa);return c.useEffect(()=>(pa.push(s),()=>{const a=pa.indexOf(s);a>-1&&pa.splice(a,1)}),[t]),{...t,toast:el,dismiss:a=>Ws({type:"DISMISS_TOAST",toastId:a})}}function hx(){const{toasts:t}=Ir();return e.jsxs(Ji,{children:[t.map(function({id:s,title:a,description:r,action:n,...o}){return e.jsxs(Rr,{...o,children:[e.jsxs("div",{className:"grid gap-1",children:[a&&e.jsx($r,{children:a}),r&&e.jsx(Lr,{children:r})]}),n,e.jsx(Fr,{})]},s)}),e.jsx(Pr,{})]})}const tl=Xe.cva("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),sl=c.forwardRef(({className:t,variant:s,size:a,...r},n)=>e.jsx(ko.Root,{ref:n,className:b(tl({variant:s,size:a,className:t})),...r}));sl.displayName=ko.Root.displayName;const Ks=Zs.Provider,Ys=Zs.Root,Js=Zs.Trigger,ks=c.forwardRef(({className:t,sideOffset:s=4,...a},r)=>e.jsx(Zs.Content,{ref:r,sideOffset:s,className:b("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a}));ks.displayName=Zs.Content.displayName;const al=Xe.cva("",{variants:{variant:{default:"text-foreground",muted:"text-muted-foreground",destructive:"text-destructive",success:"text-green-600 dark:text-green-400",warning:"text-amber-600 dark:text-amber-400",link:"text-primary underline-offset-4 hover:underline"},size:{xs:"text-xs",sm:"text-sm",base:"text-base",lg:"text-lg",xl:"text-xl"},weight:{normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},align:{left:"text-left",center:"text-center",right:"text-right",justify:"text-justify"}},defaultVariants:{variant:"default",size:"base",weight:"normal",align:"left"}}),rl=c.forwardRef(({className:t,variant:s,size:a,weight:r,align:n,asChild:o=!1,truncate:i=!1,...l},u)=>{const d=o?Na.Slot:"p";return e.jsx(d,{className:b(al({variant:s,size:a,weight:r,align:n}),i&&"truncate",t),ref:u,...l})});rl.displayName="Text";const nl=Xe.cva("font-bold tracking-tight",{variants:{level:{h1:"text-4xl lg:text-5xl",h2:"text-3xl lg:text-4xl",h3:"text-2xl lg:text-3xl",h4:"text-xl lg:text-2xl",h5:"text-lg lg:text-xl",h6:"text-base lg:text-lg"},variant:{default:"text-foreground",gradient:"bg-gradient-to-r from-primary to-primary/60 bg-clip-text text-transparent",muted:"text-muted-foreground"}},defaultVariants:{level:"h2",variant:"default"}}),ol=c.forwardRef(({className:t,level:s="h2",variant:a,asChild:r=!1,...n},o)=>{const i=r?Na.Slot:s;return e.jsx(i,{className:b(nl({level:s,variant:a}),t),ref:o,...n})});ol.displayName="Heading";const il=Xe.cva("mt-6 border-l-4 pl-6 italic",{variants:{variant:{default:"border-border text-muted-foreground",primary:"border-primary text-foreground",success:"border-green-500 text-green-900 dark:text-green-100",warning:"border-amber-500 text-amber-900 dark:text-amber-100",destructive:"border-destructive text-destructive"}},defaultVariants:{variant:"default"}}),ll=c.forwardRef(({className:t,variant:s,author:a,cite:r,children:n,...o},i)=>e.jsxs("figure",{className:"my-6",children:[e.jsx("blockquote",{className:b(il({variant:s}),t),cite:r,ref:i,...o,children:n}),a&&e.jsxs("figcaption",{className:"mt-2 text-sm text-muted-foreground",children:["— ",a]})]}));ll.displayName="Blockquote";Xe.cva("relative rounded font-mono",{variants:{variant:{inline:"bg-muted px-[0.3rem] py-[0.2rem] text-xs sm:text-sm",block:"block bg-muted overflow-x-auto"},size:{sm:"text-xs sm:text-sm",base:"text-sm sm:text-base",lg:"text-base sm:text-lg"}},defaultVariants:{variant:"inline",size:"base"}});const cl=Xe.cva("inline-flex items-center justify-center rounded border border-border bg-muted px-2 py-1 font-mono text-xs font-medium text-muted-foreground shadow-sm",{variants:{size:{sm:"h-5 min-w-[1.25rem] text-[0.625rem]",default:"h-6 min-w-[1.5rem] text-xs",lg:"h-7 min-w-[1.75rem] text-sm"}},defaultVariants:{size:"default"}}),dl=c.forwardRef(({className:t,size:s,...a},r)=>e.jsx("kbd",{className:b(cl({size:s}),t),ref:r,...a}));dl.displayName="Kbd";function ge(...t){return yo.clsx(t)}function ul(t,s="export.csv"){if(!t||t.length===0)return;const a=Object.keys(t[0]),r=[a.join(","),...t.map(i=>a.map(l=>{const u=i[l];return typeof u=="string"&&(u.includes(",")||u.includes('"')||u.includes(`
12
+ }`);const w=p.trim();if(w.trim().length===0)throw console.error(`[ThemeProvider] No CSS variables generated for theme "${t}"`),new Error(`No CSS variables found in JSON for theme "${t}"`);const C=w;if(!C.includes(`[data-theme="${t}"]`))throw console.error(`[ThemeProvider] Generated CSS is missing the selector for theme "${t}"`),console.error("[ThemeProvider] Generated CSS:",C),new Error(`Generated CSS is missing the required selector [data-theme="${t}"]`);return C.length<50&&console.warn(`[ThemeProvider] Generated CSS seems too short for theme "${t}":`,C),console.log(`[ThemeProvider] ✅ Generated valid CSS for theme "${t}" with ${Object.keys(a).length} variables`),C}function ia(){const t=c.useContext(Xi);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}const Yi=c.forwardRef(({className:t,variant:s="default",ariaLabel:a="Select theme"},r)=>{const{currentTheme:n,changeTheme:o,themes:i,isLoading:l}=ia(),[u,d]=c.useState(!1),[f,m]=c.useState(!1),p=c.useRef(null),w=c.useRef(null);c.useEffect(()=>{m(!0)},[]);const C=async(j,x)=>{x&&(x.preventDefault(),x.stopPropagation());try{console.log(`[ThemeSelector] Changing theme to: ${j}`),await o(j),console.log(`[ThemeSelector] ✅ Theme changed to: ${j}`)}catch(v){console.error(`[ThemeSelector] ❌ Failed to change theme to ${j}:`,v)}s==="compact"&&setTimeout(()=>d(!1),100)},[g,y]=c.useState({top:0,right:0});if(c.useEffect(()=>{if(u&&p.current&&f){const j=p.current.getBoundingClientRect();y({top:j.bottom+8,right:window.innerWidth-j.right})}},[u,f]),s==="compact"){const j=u&&f?e.jsxs("div",{ref:w,className:"fixed z-[9999] min-w-[220px] rounded-md border border-border bg-popover text-popover-foreground p-2 shadow-lg",style:{top:`${g.top}px`,right:`${g.right}px`},onMouseDown:x=>{x.stopPropagation()},children:[e.jsx("div",{className:"px-2 py-1.5 border-b border-border mb-2",children:e.jsxs("div",{className:"text-xs font-medium text-muted-foreground flex items-center justify-between",children:[e.jsx("span",{children:"Thèmes"}),l&&e.jsx(h.Loader2,{className:"h-3 w-3 animate-spin"})]})}),l&&i.length===0?e.jsxs("div",{className:"flex items-center justify-center py-6 text-sm text-muted-foreground",children:[e.jsx(h.Loader2,{className:"h-4 w-4 mr-2 animate-spin"}),"Chargement..."]}):e.jsxs("div",{className:"grid gap-1",children:[i.map(x=>e.jsxs("button",{onMouseDown:v=>{v.preventDefault(),v.stopPropagation(),C(x.id,v)},type:"button",className:b("flex items-center gap-3 rounded-sm px-2 py-2 text-sm hover:bg-accent hover:text-accent-foreground transition-colors cursor-pointer",n===x.id&&"bg-accent"),children:[x.previewColor&&e.jsx("div",{className:"h-4 w-4 rounded border border-border shrink-0",style:{backgroundColor:x.previewColor}}),e.jsx("span",{className:"flex-1 text-left",children:x.label}),n===x.id&&e.jsx(h.Check,{className:"h-4 w-4 shrink-0"})]},x.id)),i.length===0&&!l&&e.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Aucun thème disponible"})]}),e.jsx("div",{className:"px-2 py-1.5 border-t border-border mt-2",children:e.jsxs("div",{className:"text-xs text-muted-foreground",children:[i.length," thème",i.length>1?"s":""," disponible",i.length>1?"s":""]})})]}):null;return e.jsxs(e.Fragment,{children:[e.jsx("div",{ref:r,className:b("relative",t),children:e.jsxs("button",{ref:p,onMouseDown:x=>{x.preventDefault(),x.stopPropagation()},onClick:x=>{x.preventDefault(),x.stopPropagation(),d(!u)},className:"flex h-9 w-9 items-center justify-center rounded-md border border-input bg-transparent hover:bg-accent hover:text-accent-foreground relative",title:"Changer de thème",type:"button",children:[e.jsx(h.Palette,{className:"h-4 w-4"}),l&&e.jsx(h.Loader2,{className:"h-3 w-3 absolute top-1 right-1 animate-spin text-primary"}),e.jsx("span",{className:"sr-only",children:a})]})}),f&&typeof document<"u"&&j&&rr.createPortal(e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"fixed inset-0 z-[9998]",onMouseDown:x=>{x.preventDefault(),d(!1)}}),j]}),document.body)]})}if(s==="select"){const j=i.find(x=>x.id===n);return e.jsx("div",{ref:r,className:b("w-full",t),children:e.jsxs(Ve,{value:n,onValueChange:async x=>{try{console.log(`[ThemeSelector] Changing theme to: ${x}`),await o(x),console.log(`[ThemeSelector] ✅ Theme changed to: ${x}`)}catch(v){console.error(`[ThemeSelector] ❌ Failed to change theme to ${x}:`,v)}},disabled:l||i.length===0,children:[e.jsx($e,{className:"w-full","aria-label":a,children:e.jsx(We,{children:l&&i.length===0?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(h.Loader2,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{children:"Chargement..."})]}):j?e.jsxs("span",{className:"flex items-center gap-3",children:[j.previewColor&&e.jsx("div",{className:"h-4 w-4 rounded border border-border shrink-0",style:{backgroundColor:j.previewColor}}),e.jsx("span",{className:"truncate",children:j.label})]}):e.jsx("span",{className:"text-muted-foreground",children:"Sélectionner un thème"})})}),e.jsxs(Le,{children:[i.map(x=>e.jsx(je,{value:x.id,className:"cursor-pointer",children:e.jsxs("div",{className:"flex items-center gap-3 w-full",children:[x.previewColor&&e.jsx("div",{className:"h-4 w-4 rounded border border-border shrink-0",style:{backgroundColor:x.previewColor}}),e.jsx("span",{className:"flex-1 text-left truncate",children:x.label})]})},x.id)),i.length===0&&!l&&e.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Aucun thème disponible"})]})]})})}return e.jsx("div",{ref:r,className:b("grid gap-4",t),children:l&&i.length===0?e.jsxs("div",{className:"flex items-center justify-center py-12 text-sm text-muted-foreground",children:[e.jsx(h.Loader2,{className:"h-5 w-5 mr-2 animate-spin"}),"Chargement des thèmes..."]}):e.jsxs(e.Fragment,{children:[i.map(j=>e.jsxs("button",{onClick:async x=>{x.preventDefault(),x.stopPropagation(),await C(j.id,x)},type:"button",className:b("relative flex flex-col items-start gap-2 rounded-lg border-2 p-4 text-left transition-all hover:border-primary",n===j.id?"border-primary bg-primary/5":"border-muted"),children:[e.jsxs("div",{className:"flex w-full items-center justify-between",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"font-semibold",children:j.label}),j.description&&e.jsx("span",{className:"text-sm text-muted-foreground",children:j.description})]}),n===j.id&&e.jsx(h.Check,{className:"h-5 w-5 text-primary shrink-0"})]}),j.previewColor&&e.jsx("div",{className:"flex gap-2 w-full",children:e.jsx("div",{className:"h-8 w-full rounded border",style:{backgroundColor:j.previewColor}})})]},j.id)),i.length===0&&!l&&e.jsx("div",{className:"py-12 text-center text-sm text-muted-foreground",children:"Aucun thème disponible"})]})})});Yi.displayName="ThemeSelector";const Ji=pt.Provider,Lr=c.forwardRef(({className:t,...s},a)=>e.jsx(pt.Viewport,{ref:a,className:b("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",t),...s}));Lr.displayName=pt.Viewport.displayName;const cx=Xe.cva("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Ir=c.forwardRef(({className:t,variant:s,...a},r)=>e.jsx(pt.Root,{ref:r,className:b(cx({variant:s}),t),...a}));Ir.displayName=pt.Root.displayName;const Qi=c.forwardRef(({className:t,...s},a)=>e.jsx(pt.Action,{ref:a,className:b("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...s}));Qi.displayName=pt.Action.displayName;const Or=c.forwardRef(({className:t,...s},a)=>e.jsx(pt.Close,{ref:a,className:b("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...s,children:e.jsx(h.X,{className:"h-4 w-4"})}));Or.displayName=pt.Close.displayName;const zr=c.forwardRef(({className:t,...s},a)=>e.jsx(pt.Title,{ref:a,className:b("text-sm font-semibold",t),...s}));zr.displayName=pt.Title.displayName;const _r=c.forwardRef(({className:t,...s},a)=>e.jsx(pt.Description,{ref:a,className:b("text-sm opacity-90",t),...s}));_r.displayName=pt.Description.displayName;const dx=1,ux=1e6;let Ga=0;function mx(){return Ga=(Ga+1)%Number.MAX_SAFE_INTEGER,Ga.toString()}const Xa=new Map,Xn=t=>{if(Xa.has(t))return;const s=setTimeout(()=>{Xa.delete(t),Ws({type:"REMOVE_TOAST",toastId:t})},ux);Xa.set(t,s)},Zi=(t,s)=>{switch(s.type){case"ADD_TOAST":return{...t,toasts:[s.toast,...t.toasts].slice(0,dx)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(a=>a.id===s.toast.id?{...a,...s.toast}:a)};case"DISMISS_TOAST":{const{toastId:a}=s;return a?Xn(a):t.toasts.forEach(r=>{Xn(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===a||a===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return s.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(a=>a.id!==s.toastId)}}},ga=[];let ba={toasts:[]};function Ws(t){ba=Zi(ba,t),ga.forEach(s=>{s(ba)})}function el({...t}){const s=mx(),a=n=>Ws({type:"UPDATE_TOAST",toast:{...n,id:s}}),r=()=>Ws({type:"DISMISS_TOAST",toastId:s});return Ws({type:"ADD_TOAST",toast:{...t,id:s,open:!0,onOpenChange:n=>{n||r()}}}),{id:s,dismiss:r,update:a}}function Vr(){const[t,s]=c.useState(ba);return c.useEffect(()=>(ga.push(s),()=>{const a=ga.indexOf(s);a>-1&&ga.splice(a,1)}),[t]),{...t,toast:el,dismiss:a=>Ws({type:"DISMISS_TOAST",toastId:a})}}function hx(){const{toasts:t}=Vr();return e.jsxs(Ji,{children:[t.map(function({id:s,title:a,description:r,action:n,...o}){return e.jsxs(Ir,{...o,children:[e.jsxs("div",{className:"grid gap-1",children:[a&&e.jsx(zr,{children:a}),r&&e.jsx(_r,{children:r})]}),n,e.jsx(Or,{})]},s)}),e.jsx(Lr,{})]})}const tl=Xe.cva("inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground"},size:{default:"h-10 px-3",sm:"h-9 px-2.5",lg:"h-11 px-5"}},defaultVariants:{variant:"default",size:"default"}}),sl=c.forwardRef(({className:t,variant:s,size:a,...r},n)=>e.jsx(ko.Root,{ref:n,className:b(tl({variant:s,size:a,className:t})),...r}));sl.displayName=ko.Root.displayName;const Ks=Zs.Provider,Ys=Zs.Root,Js=Zs.Trigger,ks=c.forwardRef(({className:t,sideOffset:s=4,...a},r)=>e.jsx(Zs.Content,{ref:r,sideOffset:s,className:b("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...a}));ks.displayName=Zs.Content.displayName;const al=Xe.cva("",{variants:{variant:{default:"text-foreground",muted:"text-muted-foreground",destructive:"text-destructive",success:"text-green-600 dark:text-green-400",warning:"text-amber-600 dark:text-amber-400",link:"text-primary underline-offset-4 hover:underline"},size:{xs:"text-xs",sm:"text-sm",base:"text-base",lg:"text-lg",xl:"text-xl"},weight:{normal:"font-normal",medium:"font-medium",semibold:"font-semibold",bold:"font-bold"},align:{left:"text-left",center:"text-center",right:"text-right",justify:"text-justify"}},defaultVariants:{variant:"default",size:"base",weight:"normal",align:"left"}}),rl=c.forwardRef(({className:t,variant:s,size:a,weight:r,align:n,asChild:o=!1,truncate:i=!1,...l},u)=>{const d=o?Aa.Slot:"p";return e.jsx(d,{className:b(al({variant:s,size:a,weight:r,align:n}),i&&"truncate",t),ref:u,...l})});rl.displayName="Text";const nl=Xe.cva("font-bold tracking-tight",{variants:{level:{h1:"text-4xl lg:text-5xl",h2:"text-3xl lg:text-4xl",h3:"text-2xl lg:text-3xl",h4:"text-xl lg:text-2xl",h5:"text-lg lg:text-xl",h6:"text-base lg:text-lg"},variant:{default:"text-foreground",gradient:"bg-gradient-to-r from-primary to-primary/60 bg-clip-text text-transparent",muted:"text-muted-foreground"}},defaultVariants:{level:"h2",variant:"default"}}),ol=c.forwardRef(({className:t,level:s="h2",variant:a,asChild:r=!1,...n},o)=>{const i=r?Aa.Slot:s;return e.jsx(i,{className:b(nl({level:s,variant:a}),t),ref:o,...n})});ol.displayName="Heading";const il=Xe.cva("mt-6 border-l-4 pl-6 italic",{variants:{variant:{default:"border-border text-muted-foreground",primary:"border-primary text-foreground",success:"border-green-500 text-green-900 dark:text-green-100",warning:"border-amber-500 text-amber-900 dark:text-amber-100",destructive:"border-destructive text-destructive"}},defaultVariants:{variant:"default"}}),ll=c.forwardRef(({className:t,variant:s,author:a,cite:r,children:n,...o},i)=>e.jsxs("figure",{className:"my-6",children:[e.jsx("blockquote",{className:b(il({variant:s}),t),cite:r,ref:i,...o,children:n}),a&&e.jsxs("figcaption",{className:"mt-2 text-sm text-muted-foreground",children:["— ",a]})]}));ll.displayName="Blockquote";Xe.cva("relative rounded font-mono",{variants:{variant:{inline:"bg-muted px-[0.3rem] py-[0.2rem] text-xs sm:text-sm",block:"block bg-muted overflow-x-auto"},size:{sm:"text-xs sm:text-sm",base:"text-sm sm:text-base",lg:"text-base sm:text-lg"}},defaultVariants:{variant:"inline",size:"base"}});const cl=Xe.cva("inline-flex items-center justify-center rounded border border-border bg-muted px-2 py-1 font-mono text-xs font-medium text-muted-foreground shadow-sm",{variants:{size:{sm:"h-5 min-w-[1.25rem] text-[0.625rem]",default:"h-6 min-w-[1.5rem] text-xs",lg:"h-7 min-w-[1.75rem] text-sm"}},defaultVariants:{size:"default"}}),dl=c.forwardRef(({className:t,size:s,...a},r)=>e.jsx("kbd",{className:b(cl({size:s}),t),ref:r,...a}));dl.displayName="Kbd";function ge(...t){return yo.clsx(t)}function ul(t,s="export.csv"){if(!t||t.length===0)return;const a=Object.keys(t[0]),r=[a.join(","),...t.map(i=>a.map(l=>{const u=i[l];return typeof u=="string"&&(u.includes(",")||u.includes('"')||u.includes(`
13
13
  `))?`"${u.replace(/"/g,'""')}"`:u}).join(","))].join(`
14
14
  `),n=new Blob([r],{type:"text/csv;charset=utf-8;"}),o=document.createElement("a");o.href=URL.createObjectURL(n),o.download=s,o.click(),URL.revokeObjectURL(o.href)}function ml(t,s="export.json"){const a=JSON.stringify(t,null,2),r=new Blob([a],{type:"application/json;charset=utf-8;"}),n=document.createElement("a");n.href=URL.createObjectURL(r),n.download=s,n.click(),URL.revokeObjectURL(n.href)}async function fx(t){return new Promise((s,a)=>{const r=new FileReader;r.onload=n=>{try{const i=(n.target?.result).split(`
15
- `).filter(d=>d.trim());if(i.length===0){s([]);return}const l=i[0].split(",").map(d=>d.trim().replace(/^"|"$/g,"")),u=i.slice(1).map(d=>{const f=d.split(",").map(p=>p.trim().replace(/^"|"$/g,"")),m={};return l.forEach((p,w)=>{m[p]=f[w]||""}),m});s(u)}catch(o){a(o)}},r.onerror=()=>a(r.error),r.readAsText(t)})}function hl(t,s){try{localStorage.setItem(`datatable_${t}`,JSON.stringify(s))}catch(a){console.warn("[DataTable] Failed to save state:",a)}}function fl(t){try{const s=localStorage.getItem(`datatable_${t}`);return s?JSON.parse(s):null}catch(s){return console.warn("[DataTable] Failed to load state:",s),null}}function px(t,s,a){const r=a.toLowerCase();return Object.values(t).some(n=>n==null?!1:String(n).toLowerCase().includes(r))}function pl({data:t,columns:s,pagination:a,tableId:r,onSortingChange:n,onFiltersChange:o,onSelectionChange:i}){const l=O.useMemo(()=>r?fl(r):null,[r]),[u,d]=O.useState(l?.sorting||[]),[f,m]=O.useState(l?.columnFilters||[]),[p,w]=O.useState(l?.columnVisibility||{}),[C,g]=O.useState({}),[y,j]=O.useState(l?.globalFilter||""),[x,v]=O.useState({pageIndex:a?.currentPage||0,pageSize:a?.pageSize||10});O.useEffect(()=>{r&&hl(r,{sorting:u,columnFilters:f,columnVisibility:p,globalFilter:y})},[r,u,f,p,y]),O.useEffect(()=>{n?.(u)},[u,n]),O.useEffect(()=>{o?.(f)},[f,o]),O.useEffect(()=>{const A=k.getFilteredSelectedRowModel().rows.map(S=>S.original);i?.(A)},[C]);const k=Be.useReactTable({data:t,columns:s,state:{sorting:u,columnFilters:f,columnVisibility:p,rowSelection:C,globalFilter:y,pagination:x},enableRowSelection:!0,onRowSelectionChange:g,onSortingChange:d,onColumnFiltersChange:m,onColumnVisibilityChange:w,onGlobalFilterChange:j,onPaginationChange:v,getCoreRowModel:Be.getCoreRowModel(),getFilteredRowModel:Be.getFilteredRowModel(),getPaginationRowModel:Be.getPaginationRowModel(),getSortedRowModel:Be.getSortedRowModel(),globalFilterFn:px,manualPagination:a?.mode==="server",pageCount:a?.mode==="server"?Math.ceil((a.totalItems||0)/x.pageSize):void 0}),N=O.useMemo(()=>k.getFilteredSelectedRowModel().rows.map(A=>A.original),[k,C]),D=O.useCallback(()=>{m([]),j("")},[]),P=O.useCallback(()=>{g({})},[]),R=O.useCallback(()=>k.getFilteredRowModel().rows.map(A=>A.original),[k]);return{table:k,sorting:u,setSorting:d,columnFilters:f,setColumnFilters:m,columnVisibility:p,setColumnVisibility:w,rowSelection:C,setRowSelection:g,globalFilter:y,setGlobalFilter:j,pagination:x,setPagination:v,selectedRows:N,resetFilters:D,resetSelection:P,exportData:R}}function Or(t="standard",s="comfortable"){const[a,r]=O.useState(t),[n,o]=O.useState(s),[i,l]=O.useState(!1);O.useEffect(()=>{const m=()=>{l(window.innerWidth<768)};return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[]),O.useEffect(()=>{i&&a==="standard"&&r("card")},[i,a]);const u=O.useCallback(()=>{r(m=>{switch(m){case"standard":return"card";case"card":return"compact";case"compact":return"standard";default:return"standard"}})},[]),d=O.useCallback(()=>{o(m=>m==="comfortable"?"compact":"comfortable")},[]);return{layout:a,setLayout:r,density:n,setDensity:o,toggleLayout:u,toggleDensity:d,isMobile:i,densityClasses:{comfortable:{table:"text-sm",cell:"px-4 py-3",header:"px-4 py-3"},compact:{table:"text-xs",cell:"px-2 py-1.5",header:"px-2 py-2"},spacious:{table:"text-base",cell:"px-6 py-4",header:"px-6 py-4"}}[n]}}function zr(t,s={}){const{onSave:a,onCancel:r,validateField:n,autoSave:o=!1,autoSaveDelay:i=2e3}=s,[l,u]=O.useState(null),[d,f]=O.useState({}),[m,p]=O.useState(null),[w,C]=O.useState({}),[g,y]=O.useState(!1),j=O.useMemo(()=>!m||!l?!1:Object.keys(d).some(M=>{const E=M;return d[E]!==m[E]}),[d,m,l]),x=j&&l!==null,v=O.useCallback((M,E)=>{u(M),f({...E}),p(E),C({})},[]),k=O.useCallback(()=>{!l||!m||(r?.(l,m),u(null),f({}),p(null),C({}))},[l,m,r]),N=O.useCallback((M,E)=>{if(l){if(n){const T=n(M,E);if(T){C(K=>({...K,[M]:T}));return}else C(K=>{const q={...K};return delete q[M],q})}f(T=>({...T,[M]:E}))}},[l,n]),D=O.useCallback(async()=>{if(!(!l||!a||g)){if(Object.keys(w).length>0)throw new Error("Validation errors present");y(!0);try{await a(l,d),u(null),f({}),p(null),C({})}catch(M){throw console.error("Error saving edit:",M),M}finally{y(!1)}}},[l,a,d,w,g]),P=O.useCallback(()=>{m&&(f({...m}),C({}))},[m]),R=O.useMemo(()=>!o||!x?null:setTimeout(()=>{x&&!g&&D().catch(console.error)},i),[o,x,g,D,i]);return O.useEffect(()=>()=>{R&&clearTimeout(R)},[R]),[{editingRowId:l,editedData:d,hasChanges:j,isDirty:x},{startEdit:v,cancelEdit:k,saveEdit:D,updateField:N,resetEdit:P}]}function Qs({table:t,config:s,globalFilter:a,onGlobalFilterChange:r,density:n,onDensityChange:o,onExport:i,onImport:l}){const{t:u}=wt.useTranslation(),d=c.useRef(null),f=t.getFilteredSelectedRowModel().rows,m=f.length>0,p=c.useMemo(()=>s?.actions?s.actions.filter(g=>!(g.requiresSelection&&!m)):[],[s?.actions,m]),w=g=>{const y=m?f.map(j=>j.original):t.getFilteredRowModel().rows.map(j=>j.original);i?i(g):g==="csv"?ul(y,"export.csv"):ml(y,"export.json")},C=g=>{const y=g.target.files?.[0];y&&l&&l(y),d.current&&(d.current.value="")};return e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 p-4 border-b",children:[e.jsxs("div",{className:"flex flex-1 flex-col sm:flex-row items-start sm:items-center gap-2 w-full sm:w-auto",children:[s?.showSearch!==!1&&e.jsxs("div",{className:"relative w-full sm:w-64",children:[e.jsx(h.Search,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{placeholder:u("datatable.toolbar.search",{defaultValue:"Search..."}),value:a??"",onChange:g=>r(g.target.value),className:"pl-8 h-9"}),a&&e.jsx("button",{onClick:()=>r(""),className:"absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",children:e.jsx(h.X,{className:"h-4 w-4"})})]}),m&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsxs("span",{children:[f.length," ",u("datatable.toolbar.selected",{defaultValue:"selected"})]}),e.jsx(L,{variant:"ghost",size:"sm",onClick:()=>t.resetRowSelection(),className:"h-7 px-2",children:u("datatable.toolbar.clear",{defaultValue:"Clear"})})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[p.map(g=>e.jsxs(L,{variant:g.variant||"outline",size:"sm",onClick:()=>g.onClick(f.map(y=>y.original)),disabled:g.disabled,className:"h-9",children:[g.icon,e.jsx("span",{className:"ml-2",children:g.label})]},g.id)),s?.showRefresh&&e.jsxs(L,{variant:"outline",size:"icon",onClick:s.onRefresh,className:"h-9 w-9",children:[e.jsx(h.RefreshCw,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:u("datatable.toolbar.refresh",{defaultValue:"Refresh"})})]}),i&&e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"icon",className:"h-9 w-9",children:[e.jsx(h.Download,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:u("datatable.toolbar.export",{defaultValue:"Export"})})]})}),e.jsxs(_e,{align:"end",children:[e.jsx(ms,{children:u("datatable.toolbar.exportAs",{defaultValue:"Export as"})}),e.jsx(Qe,{}),e.jsx(ds,{onClick:()=>w("csv"),children:"CSV"}),e.jsx(ds,{onClick:()=>w("json"),children:"JSON"})]})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:d,type:"file",accept:".csv,.json",onChange:C,className:"hidden"}),e.jsxs(L,{variant:"outline",size:"icon",onClick:()=>d.current?.click(),className:"h-9 w-9",children:[e.jsx(h.Upload,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:u("datatable.toolbar.import",{defaultValue:"Import"})})]})]}),s?.showColumnToggle!==!1&&e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"icon",className:"h-9 w-9",children:[e.jsx(h.Columns,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:u("datatable.toolbar.columns",{defaultValue:"Columns"})})]})}),e.jsxs(_e,{align:"end",className:"w-48",children:[e.jsx(ms,{children:u("datatable.toolbar.toggleColumns",{defaultValue:"Toggle columns"})}),e.jsx(Qe,{}),t.getAllColumns().filter(g=>g.getCanHide()).map(g=>e.jsx(ds,{className:"capitalize",checked:g.getIsVisible(),onCheckedChange:y=>g.toggleVisibility(!!y),children:g.id},g.id))]})]}),s?.showDensity&&o&&e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"icon",className:"h-9 w-9",children:[e.jsx(h.SlidersHorizontal,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:u("datatable.toolbar.density",{defaultValue:"Density"})})]})}),e.jsxs(_e,{align:"end",children:[e.jsx(ms,{children:u("datatable.toolbar.tableDensity",{defaultValue:"Table density"})}),e.jsx(Qe,{}),e.jsx(ds,{checked:n==="comfortable",onCheckedChange:()=>o("comfortable"),children:u("datatable.toolbar.comfortable",{defaultValue:"Comfortable"})}),e.jsx(ds,{checked:n==="compact",onCheckedChange:()=>o("compact"),children:u("datatable.toolbar.compact",{defaultValue:"Compact"})})]})]})]})]})}function _r({table:t,pageSizeOptions:s=[25,50,100,500],showInfo:a=!0}){const{t:r}=wt.useTranslation(),n=t.getState().pagination.pageIndex,o=t.getState().pagination.pageSize,i=t.getPageCount(),l=t.getFilteredRowModel().rows.length,u=n*o+1,d=Math.min((n+1)*o,l);return e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a&&e.jsx("div",{className:"text-sm text-muted-foreground",children:l>0?e.jsxs(e.Fragment,{children:[r("datatable.pagination.showing",{defaultValue:"Showing"})," ",u," ",r("datatable.pagination.to",{defaultValue:"to"})," ",d," ",r("datatable.pagination.of",{defaultValue:"of"})," ",l," ",r("datatable.pagination.results",{defaultValue:"results"})]}):r("datatable.pagination.noResults",{defaultValue:"No results"})}),e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:r("datatable.pagination.rowsPerPage",{defaultValue:"Rows per page"})}),e.jsxs(Ve,{value:`${o}`,onValueChange:f=>{t.setPageSize(Number(f))},children:[e.jsx($e,{className:"h-8 w-[70px]",children:e.jsx(We,{placeholder:o})}),e.jsx(Le,{side:"top",children:s.map(f=>e.jsx(je,{value:`${f}`,children:f},f))})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"text-sm text-muted-foreground mr-2",children:[r("datatable.pagination.page",{defaultValue:"Page"})," ",n+1," ",r("datatable.pagination.of",{defaultValue:"of"})," ",i]}),e.jsxs(L,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>t.setPageIndex(0),disabled:!t.getCanPreviousPage(),children:[e.jsx(h.ChevronsLeft,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:r("datatable.pagination.firstPage",{defaultValue:"First page"})})]}),e.jsxs(L,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>t.previousPage(),disabled:!t.getCanPreviousPage(),children:[e.jsx(h.ChevronLeft,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:r("datatable.pagination.previousPage",{defaultValue:"Previous page"})})]}),e.jsxs(L,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>t.nextPage(),disabled:!t.getCanNextPage(),children:[e.jsx(h.ChevronRight,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:r("datatable.pagination.nextPage",{defaultValue:"Next page"})})]}),e.jsxs(L,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>t.setPageIndex(i-1),disabled:!t.getCanNextPage(),children:[e.jsx(h.ChevronsRight,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:r("datatable.pagination.lastPage",{defaultValue:"Last page"})})]})]})]})]})}function Vr({table:t,filters:s,position:a="top",onFiltersChange:r}){const{t:n}=wt.useTranslation(),[o,i]=c.useState([]),[l,u]=c.useState(!1),d=c.useCallback(j=>{const x=t.getPreFilteredRowModel().rows,v=new Set;return x.forEach(k=>{const N=k.getValue(j);N!=null&&N!==""&&v.add(String(N))}),Array.from(v).sort()},[t]),f={text:[{value:"contains",label:n("datatable.filters.contains",{defaultValue:"Contains"})},{value:"equals",label:n("datatable.filters.equals",{defaultValue:"Equals"})},{value:"startsWith",label:n("datatable.filters.startsWith",{defaultValue:"Starts with"})},{value:"endsWith",label:n("datatable.filters.endsWith",{defaultValue:"Ends with"})},{value:"notContains",label:n("datatable.filters.notContains",{defaultValue:"Not contains"})}],select:[{value:"equals",label:n("datatable.filters.equals",{defaultValue:"Equals"})},{value:"notEquals",label:n("datatable.filters.notEquals",{defaultValue:"Not equals"})}],multiselect:[{value:"in",label:n("datatable.filters.in",{defaultValue:"In"})},{value:"notIn",label:n("datatable.filters.notIn",{defaultValue:"Not in"})}],range:[{value:"between",label:n("datatable.filters.between",{defaultValue:"Between"})},{value:"greaterThan",label:n("datatable.filters.greaterThan",{defaultValue:"Greater than"})},{value:"lessThan",label:n("datatable.filters.lessThan",{defaultValue:"Less than"})}],date:[{value:"equals",label:n("datatable.filters.equals",{defaultValue:"Equals"})},{value:"before",label:n("datatable.filters.before",{defaultValue:"Before"})},{value:"after",label:n("datatable.filters.after",{defaultValue:"After"})},{value:"between",label:n("datatable.filters.between",{defaultValue:"Between"})}],daterange:[{value:"between",label:n("datatable.filters.between",{defaultValue:"Between"})},{value:"before",label:n("datatable.filters.before",{defaultValue:"Before"})},{value:"after",label:n("datatable.filters.after",{defaultValue:"After"})}],checkbox:[{value:"equals",label:n("datatable.filters.equals",{defaultValue:"Equals"})}],number:[{value:"equals",label:n("datatable.filters.equals",{defaultValue:"Equals"})},{value:"notEquals",label:n("datatable.filters.notEquals",{defaultValue:"Not equals"})},{value:"greaterThan",label:n("datatable.filters.greaterThan",{defaultValue:"Greater than"})},{value:"lessThan",label:n("datatable.filters.lessThan",{defaultValue:"Less than"})},{value:"between",label:n("datatable.filters.between",{defaultValue:"Between"})}],boolean:[{value:"equals",label:n("datatable.filters.equals",{defaultValue:"Equals"})},{value:"notEquals",label:n("datatable.filters.notEquals",{defaultValue:"Not equals"})}]},m=(j,x,v)=>{const k=t.getColumn(j.column||j.id);if(!k)return;const N={columnId:j.column||j.id,operator:x,value:v,label:j.label};i(D=>[...D,N]),k.setFilterValue({operator:x,value:v}),r?.([...o,N])},p=j=>{const x=o[j],v=t.getColumn(x.columnId);v&&v.setFilterValue(void 0);const k=o.filter((N,D)=>D!==j);i(k),r?.(k)},w=()=>{o.forEach(j=>{const x=t.getColumn(j.columnId);x&&x.setFilterValue(void 0)}),i([]),r?.([])},C=j=>{const[x,v]=c.useState(f[j.type]?.[0]?.value||"equals"),k=()=>j.defaultValue!==void 0?j.defaultValue:j.type==="range"?{min:"",max:""}:j.type==="daterange"?{from:"",to:""}:j.type==="checkbox"?!1:"",[N,D]=c.useState(k()),[P,R]=c.useState([]),[A,S]=c.useState(!1),M=j.column?d(j.column):[],E=()=>{const T=j.type==="multiselect"?P:N;let K=!1;j.type==="multiselect"?K=Array.isArray(T)&&T.length>0:j.type==="range"?K=T.min!==""||T.max!=="":j.type==="daterange"?K=T.from!==""||T.to!=="":j.type==="checkbox"?K=!0:K=T!==""&&T!=null,K&&(m(j,x,T),D(k()),R([]),S(!1))};return e.jsxs("div",{className:"space-y-3 p-4 border rounded-lg",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(me,{className:"text-sm font-medium",children:j.label}),e.jsx(Se,{variant:"outline",className:"text-xs",children:j.type})]}),f[j.type]&&f[j.type].length>1&&e.jsxs(Ve,{value:x,onValueChange:v,children:[e.jsx($e,{className:"h-9",children:e.jsx(We,{})}),e.jsx(Le,{children:f[j.type].map(T=>e.jsx(je,{value:T.value,children:T.label},T.value))})]}),j.type==="text"&&e.jsx("div",{className:"space-y-2",children:e.jsxs(rt,{open:A,onOpenChange:S,children:[e.jsx(nt,{asChild:!0,children:e.jsx(oe,{placeholder:j.placeholder||n("datatable.filters.enterValue",{defaultValue:"Enter value..."}),value:N,onChange:T=>{D(T.target.value),S(!0)},className:"h-9"})}),M.length>0&&N&&e.jsx(st,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(ss,{children:[e.jsx(xs,{placeholder:n("datatable.filters.search",{defaultValue:"Search..."})}),e.jsx(gs,{children:n("datatable.filters.noResults",{defaultValue:"No results"})}),e.jsx(Ot,{className:"max-h-64 overflow-auto",children:M.filter(T=>T.toLowerCase().includes(N.toLowerCase())).slice(0,50).map(T=>e.jsx(zt,{onSelect:()=>{D(T),S(!1)},children:T},T))})]})})]})}),j.type==="select"&&e.jsxs(Ve,{value:N,onValueChange:D,children:[e.jsx($e,{className:"h-9",children:e.jsx(We,{placeholder:j.placeholder})}),e.jsx(Le,{children:(j.options||M.map(T=>({label:T,value:T}))).map(T=>e.jsx(je,{value:String(T.value),children:T.label},T.value))})]}),j.type==="multiselect"&&e.jsxs(rt,{children:[e.jsx(nt,{asChild:!0,children:e.jsxs(L,{variant:"outline",className:"w-full justify-between h-9",children:[P.length>0?`${P.length} ${n("datatable.filters.selected",{defaultValue:"selected"})}`:j.placeholder||n("datatable.filters.selectValues",{defaultValue:"Select values..."}),e.jsx(h.ChevronDown,{className:"ml-2 h-4 w-4 opacity-50"})]})}),e.jsx(st,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(ss,{children:[e.jsx(xs,{placeholder:n("datatable.filters.search",{defaultValue:"Search..."})}),e.jsx(gs,{children:n("datatable.filters.noResults",{defaultValue:"No results"})}),e.jsx(Ot,{className:"max-h-64 overflow-auto",children:M.map(T=>e.jsxs(zt,{onSelect:()=>{R(K=>K.includes(T)?K.filter(q=>q!==T):[...K,T])},children:[e.jsx(Ze,{checked:P.includes(T),className:"mr-2"}),T]},T))})]})})]}),j.type==="date"&&e.jsx(oe,{type:"date",value:N,onChange:T=>D(T.target.value),className:"h-9"}),j.type==="range"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{type:"number",placeholder:"Min",value:N.min||"",onChange:T=>D({...N,min:T.target.value}),className:"h-9"}),e.jsx(oe,{type:"number",placeholder:"Max",value:N.max||"",onChange:T=>D({...N,max:T.target.value}),className:"h-9"})]}),j.type==="daterange"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{type:"date",placeholder:n("datatable.filters.from",{defaultValue:"From"}),value:N.from||"",onChange:T=>D({...N,from:T.target.value}),className:"h-9"}),e.jsx(oe,{type:"date",placeholder:n("datatable.filters.to",{defaultValue:"To"}),value:N.to||"",onChange:T=>D({...N,to:T.target.value}),className:"h-9"})]}),j.type==="checkbox"&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ze,{id:`checkbox-${j.id}`,checked:N===!0,onCheckedChange:T=>D(T===!0)}),e.jsx(me,{htmlFor:`checkbox-${j.id}`,className:"text-sm font-normal",children:j.placeholder||n("datatable.filters.checked",{defaultValue:"Checked"})})]}),e.jsxs(L,{onClick:E,size:"sm",className:"w-full",children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-2"}),n("datatable.filters.apply",{defaultValue:"Apply filter"})]})]})};if(!s||s.length===0)return null;const g=e.jsxs("div",{className:"space-y-4",children:[o.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(me,{className:"text-sm text-muted-foreground",children:n("datatable.filters.active",{defaultValue:"Filtres actifs"})}),e.jsxs(L,{variant:"ghost",size:"sm",onClick:w,children:[e.jsx(h.Trash2,{className:"h-3 w-3 mr-1"}),n("datatable.filters.clearAll",{defaultValue:"Tout effacer"})]})]}),e.jsx("div",{className:"space-y-1",children:o.map((j,x)=>e.jsxs("div",{className:"flex items-center justify-between p-2 bg-muted rounded-md text-sm",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"font-medium",children:j.label}),e.jsx("span",{className:"text-muted-foreground mx-2",children:j.operator}),e.jsx("span",{className:"text-primary truncate",children:Array.isArray(j.value)?j.value.join(", "):j.value})]}),e.jsx(L,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:()=>p(x),children:e.jsx(h.X,{className:"h-3 w-3"})})]},x))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(me,{className:"text-sm text-muted-foreground",children:n("datatable.filters.available",{defaultValue:"Filtres disponibles"})}),s.map(j=>e.jsx("div",{children:C(j)},j.id))]})]}),y=e.jsxs(L,{variant:"outline",size:"sm",children:[e.jsx(h.Filter,{className:"h-4 w-4 mr-2"}),n("datatable.filters.title",{defaultValue:"Filtres"}),o.length>0&&e.jsx(Se,{variant:"secondary",className:"ml-2",children:o.length})]});return a==="right"||a==="left"?e.jsxs(sa,{open:l,onOpenChange:u,children:[e.jsx(Ar,{asChild:!0,children:y}),e.jsxs(Ds,{side:a,className:"w-[400px] sm:w-[540px] overflow-y-auto",children:[e.jsxs(Da,{children:[e.jsxs(Ta,{className:"flex items-center gap-2",children:[e.jsx(h.Filter,{className:"h-5 w-5"}),n("datatable.filters.title",{defaultValue:"Filtres"})]}),e.jsx(Aa,{children:n("datatable.filters.description",{defaultValue:"Appliquez des filtres pour affiner les résultats"})})]}),e.jsx("div",{className:"mt-6",children:g})]})]}):e.jsxs(rt,{open:l,onOpenChange:u,children:[e.jsx(nt,{asChild:!0,children:y}),e.jsx(st,{className:"w-[400px] max-h-[600px] overflow-y-auto",align:a==="top"?"start":"end",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.Filter,{className:"h-4 w-4"}),e.jsx("h4",{className:"font-semibold text-sm",children:n("datatable.filters.title",{defaultValue:"Filtres"})})]})}),g]})})]})}function wa({value:t,field:s,config:a,isEditing:r,error:n,onChange:o,onStartEdit:i,onSave:l,onCancel:u,className:d}){const[f,m]=c.useState(t),[p,w]=c.useState(!1);c.useEffect(()=>{m(t)},[t]);const C=()=>{o(f),l()},g=()=>{m(t),u()},y=x=>{x.key==="Enter"&&!x.shiftKey?(x.preventDefault(),C()):x.key==="Escape"&&(x.preventDefault(),g())};if(!r)return e.jsx("div",{className:ge("cursor-pointer hover:bg-muted/50 p-1 rounded transition-colors",d),onClick:i,children:xx(t,a)});const j=()=>{switch(a.type){case"textarea":return e.jsx(ft,{value:f||"",onChange:x=>m(x.target.value),onKeyDown:y,placeholder:a.placeholder,rows:a.rows||3,disabled:a.disabled,className:ge(n&&"border-destructive")});case"select":return e.jsxs(Ve,{value:f||"",onValueChange:m,disabled:a.disabled,children:[e.jsx($e,{className:ge(n&&"border-destructive"),children:e.jsx(We,{placeholder:a.placeholder})}),e.jsx(Le,{children:a.options?.map(x=>e.jsx(je,{value:x.value,children:x.label},x.value))})]});case"checkbox":return e.jsx(Ze,{checked:!!f,onCheckedChange:m,disabled:a.disabled});case"switch":return e.jsx(aa,{checked:!!f,onCheckedChange:m,disabled:a.disabled});case"date":case"datetime":return e.jsxs(rt,{open:p,onOpenChange:w,children:[e.jsx(nt,{asChild:!0,children:e.jsxs(L,{variant:"outline",className:ge("w-full justify-start text-left font-normal",!f&&"text-muted-foreground",n&&"border-destructive"),children:[e.jsx(h.CalendarIcon,{className:"mr-2 h-4 w-4"}),f?V.format(new Date(f),"PPP"):a.placeholder]})}),e.jsx(st,{className:"w-auto p-0",align:"start",children:e.jsx(ka,{mode:"single",selected:f?new Date(f):void 0,onSelect:x=>{x&&(m(a.type==="datetime"?x.toISOString():x.toISOString().split("T")[0]),w(!1))},initialFocus:!0})})]});default:return e.jsx(oe,{type:a.type,value:f||"",onChange:x=>m(x.target.value),onKeyDown:y,placeholder:a.placeholder,min:a.min,max:a.max,step:a.step,disabled:a.disabled,required:a.required,pattern:a.pattern,title:a.title,className:ge(n&&"border-destructive")})}};return e.jsxs("div",{className:ge("relative",d),children:[j(),e.jsxs("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex gap-1",children:[e.jsx(L,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:C,children:e.jsx(h.Check,{className:"h-3 w-3 text-green-600"})}),e.jsx(L,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:g,children:e.jsx(h.X,{className:"h-3 w-3 text-red-600"})})]}),n&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:n})]})}function xx(t,s){if(t==null)return e.jsx("span",{className:"text-muted-foreground italic",children:"Non défini"});switch(s.type){case"checkbox":case"switch":return e.jsx("span",{className:ge("inline-flex items-center px-2 py-1 rounded-full text-xs font-medium",t?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"),children:t?"Oui":"Non"});case"date":case"datetime":try{const r=new Date(t);return V.format(r,s.type==="datetime"?"PPP p":"PPP")}catch{return t}case"select":const a=s.options?.find(r=>r.value===t);return a?a.label:t;case"textarea":return e.jsx("div",{className:"max-w-xs",children:e.jsx("p",{className:"truncate",children:t})});default:return t}}function gx({data:t,columns:s,layout:a="standard",variant:r="bordered",density:n="comfortable",filters:o,filterPosition:i="top",toolbar:l,pagination:u,selection:d=!1,actions:f,i18nNamespace:m,loading:p=!1,error:w,emptyState:C,headerSticky:g=!1,columnVisibilityToggle:y=!0,columnResize:j=!1,enableExport:x=!1,enableImport:v=!1,enableReorder:k=!1,enableContextMenu:N=!1,onRowClick:D,onRowDoubleClick:P,onSortingChange:R,onFiltersChange:A,onSelectionChange:S,className:M,tableId:E,virtualization:T,edit:K}){const{t:q}=wt.useTranslation(m),{layout:B,setLayout:W,density:I,setDensity:z,densityClasses:$}=Or(a,n),_=c.useMemo(()=>{const xe=[...s];if(d){const se={id:"select",header:({table:de})=>e.jsx(Ze,{checked:de.getIsAllPageRowsSelected(),onCheckedChange:De=>de.toggleAllPageRowsSelected(!!De),"aria-label":q("datatable.selectAll",{defaultValue:"Select all"})}),cell:({row:de})=>e.jsx(Ze,{checked:de.getIsSelected(),onCheckedChange:De=>de.toggleSelected(!!De),"aria-label":q("datatable.selectRow",{defaultValue:"Select row"})}),enableSorting:!1,enableHiding:!1};xe.unshift(se)}return xe},[s,d,K,q]),{table:F,globalFilter:H,setGlobalFilter:J,selectedRows:Q,resetFilters:ne,exportData:X}=pl({data:t,columns:_,pagination:u,tableId:E,onSortingChange:R,onFiltersChange:A,onSelectionChange:S}),[Y,U]=zr(F,{onSave:K?.onSave,onCancel:K?.onCancel,autoSave:K?.autoSave,autoSaveDelay:K?.autoSaveDelay});if(K?.editableColumns&&K.editableColumns.length>0){const xe={id:"edit-actions",header:()=>q("datatable.actions",{defaultValue:"Actions"}),cell:({row:se})=>Y.editingRowId===se.id?e.jsxs("div",{className:"flex gap-1",children:[e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>U.saveEdit(),disabled:!Y.hasChanges,children:q("datatable.save",{defaultValue:"Save"})}),e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>U.cancelEdit(),children:q("datatable.cancel",{defaultValue:"Cancel"})})]}):e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>{console.log("🔧 Starting edit for row:",se.id,se.original),U.startEdit(se.id,se.original)},children:q("datatable.edit",{defaultValue:"Edit"})}),enableSorting:!1,enableHiding:!1};_.push(xe)}const ae=c.useCallback(xe=>{const se=X();console.log("Export",xe,se)},[X]),te=c.useCallback(xe=>{console.log("Import",xe)},[]),Z={bordered:"border rounded-lg",minimal:"",striped:"[&_tbody_tr:nth-child(even)]:bg-muted/50",glass:"backdrop-blur-sm bg-background/80 border rounded-lg"};if(p)return e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(h.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:q("datatable.loading",{defaultValue:"Loading..."})})]})});if(w)return e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg bg-destructive/10",children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-destructive",children:[e.jsx(h.AlertCircle,{className:"h-8 w-8"}),e.jsx("p",{className:"text-sm font-medium",children:w})]})});if(!t||t.length===0)return e.jsxs("div",{className:"flex flex-col",children:[l&&e.jsx(Qs,{table:F,config:l,globalFilter:H,onGlobalFilterChange:J,density:I,onDensityChange:z,onExport:x?ae:void 0,onImport:v?te:void 0}),e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg",children:C||e.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[e.jsx("p",{className:"text-lg font-medium",children:q("datatable.noData",{defaultValue:"No data"})}),e.jsx("p",{className:"text-sm",children:q("datatable.noDataDescription",{defaultValue:"There are no results to display"})})]})})]});const le=()=>{const xe=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[l&&e.jsx("div",{className:"flex-1",children:e.jsx(Qs,{table:F,config:l,globalFilter:H,onGlobalFilterChange:J,density:I,onDensityChange:z,onExport:x?ae:void 0,onImport:v?te:void 0})}),o&&e.jsx(Vr,{table:F,filters:o,position:i,onFiltersChange:A})]}),e.jsx("div",{className:ge("w-full overflow-auto",Z[r]),children:e.jsxs("table",{className:ge("w-full caption-bottom text-sm",$.table),children:[e.jsx("thead",{className:ge(g&&"sticky top-0 bg-background z-10"),children:F.getHeaderGroups().map(se=>e.jsx("tr",{className:"border-b",children:se.headers.map(de=>e.jsxs("th",{className:ge("text-left font-medium text-muted-foreground",$.header,de.column.getCanSort()&&"cursor-pointer select-none hover:text-foreground"),onClick:de.column.getToggleSortingHandler(),children:[de.isPlaceholder?null:Be.flexRender(de.column.columnDef.header,de.getContext()),de.column.getIsSorted()&&e.jsx("span",{className:"ml-2",children:de.column.getIsSorted()==="asc"?"↑":"↓"})]},de.id))},se.id))}),e.jsx("tbody",{children:F.getRowModel().rows.map(se=>e.jsx("tr",{className:ge("border-b transition-colors",D&&"cursor-pointer hover:bg-muted/50",se.getIsSelected()&&"bg-muted"),onClick:()=>D?.(se.original),onDoubleClick:()=>P?.(se.original),children:se.getVisibleCells().map(de=>{const De=de.getValue(),Ne=de.column.id,Ke=se.id,xt=Y.editingRowId===Ke,Ye=K?.editableColumns?.find(et=>et.field===Ne);return Ye&&xt?e.jsx("td",{className:ge("align-middle",$.cell),children:e.jsx(wa,{value:De,field:Ne,config:Ye.config,isEditing:xt,onChange:et=>U.updateField(Ne,et),onStartEdit:()=>U.startEdit(Ke,se.original),onSave:()=>U.saveEdit(),onCancel:()=>U.cancelEdit()})},de.id):e.jsx("td",{className:ge("align-middle",$.cell),children:Be.flexRender(de.column.columnDef.cell,de.getContext())},de.id)})},se.id))})]})}),u&&e.jsx(_r,{table:F,pageSizeOptions:u.pageSizeOptions})]});return e.jsx("div",{className:"space-y-4",children:xe})};return e.jsx("div",{className:ge("w-full",M),children:le()})}function xl({data:t,columns:s,pagination:a,tableId:r,onSortingChange:n,onFiltersChange:o,onSelectionChange:i,onColumnOrderChange:l,onExpandedChange:u,onGroupingChange:d,grouping:f,virtualization:m,sortMode:p="multiple",performance:w}){const C=O.useMemo(()=>r?bx(r):null,[r]),[g,y]=O.useState(C?.sorting||[]),[j,x]=O.useState(C?.columnFilters||[]),[v,k]=O.useState(C?.columnVisibility||{}),[N,D]=O.useState(C?.columnOrder||[]),[P,R]=O.useState(C?.expanded||{}),[A,S]=O.useState(C?.grouping||[]),[M,E]=O.useState(C?.rowSelection||{}),[T,K]=O.useState(C?.globalFilter||""),[q,B]=O.useState({pageIndex:a?.currentPage||0,pageSize:a?.pageSize||10}),[W,I]=O.useState(j);O.useEffect(()=>{const Z=setTimeout(()=>{I(j)},w?.filterDebounceMs||300);return()=>clearTimeout(Z)},[j,w?.filterDebounceMs]),O.useEffect(()=>{f?.columns&&f.columns.length>0&&A.length===0&&S([f.columns[0]])},[f?.columns,A.length]),O.useEffect(()=>{r&&jx(r,{sorting:g,columnFilters:j,columnVisibility:v,columnOrder:N,expanded:P,grouping:A,pagination:q,globalFilter:T,density:"comfortable",layout:"standard",rowSelection:M})},[r,g,j,v,N,P,A,q,T,M]),O.useEffect(()=>{n?.(g)},[g,n]),O.useEffect(()=>{o?.(W)},[W,o]),O.useEffect(()=>{const Z=z.getFilteredSelectedRowModel().rows.map(le=>le.original);i?.(Z)},[M]),O.useEffect(()=>{l?.(N)},[N,l]),O.useEffect(()=>{u?.(P)},[P,u]),O.useEffect(()=>{d?.(A)},[A,d]);const z=Be.useReactTable({data:t,columns:s,state:{sorting:g,columnFilters:W,columnVisibility:v,columnOrder:N,expanded:P,grouping:A,rowSelection:M,globalFilter:T,pagination:q},enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0,enableGrouping:!0,enableExpanding:!0,enableColumnResizing:!0,enableSorting:!0,enableMultiSort:p==="multiple",enableFilters:!0,enableGlobalFilter:!0,enableColumnFilters:!0,onRowSelectionChange:E,onSortingChange:y,onColumnFiltersChange:x,onColumnVisibilityChange:k,onColumnOrderChange:D,onExpandedChange:R,onGroupingChange:S,onGlobalFilterChange:K,onPaginationChange:B,getCoreRowModel:Be.getCoreRowModel(),getFilteredRowModel:Be.getFilteredRowModel(),getPaginationRowModel:Be.getPaginationRowModel(),getSortedRowModel:Be.getSortedRowModel(),getGroupedRowModel:Be.getGroupedRowModel(),getExpandedRowModel:Be.getExpandedRowModel(),getFacetedRowModel:Be.getFacetedRowModel(),getFacetedUniqueValues:Be.getFacetedUniqueValues(),globalFilterFn:vx,manualPagination:a?.mode==="server",pageCount:a?.mode==="server"?Math.ceil((a.totalItems||0)/q.pageSize):void 0,columnResizeMode:"onChange",sortDescFirst:!1}),$=O.useMemo(()=>z.getFilteredSelectedRowModel().rows.map(Z=>Z.original),[z,M]),_=O.useCallback(()=>{x([]),K("")},[]),F=O.useCallback(()=>{E({})},[]),H=O.useCallback(()=>{y([]),x([]),k({}),D([]),R({}),S([]),E({}),K(""),B({pageIndex:0,pageSize:a?.pageSize||10})},[a?.pageSize]),J=O.useCallback(()=>z.getFilteredRowModel().rows.map(Z=>Z.original),[z]),Q=O.useCallback(()=>f?.columns?.length?z.getGroupedRowModel().rows.map(Z=>Z.original):t,[z,f,t]),ne=O.useCallback(()=>z.getExpandedRowModel().rows.map(Z=>Z.original),[z]),X=O.useCallback(Z=>{S(le=>le.includes(Z)?le.filter(se=>se!==Z):[...le,Z])},[]),Y=O.useCallback(()=>{S([])},[]),U=O.useCallback(Z=>{R(le=>({...le,[Z]:!le[Z]}))},[]),ae=O.useCallback(()=>{const Z=z.getRowModel().rows.map(xe=>xe.id),le={};Z.forEach(xe=>{le[xe]=!0}),R(le)},[z]),te=O.useCallback(()=>{R({})},[]);return{table:z,sorting:g,setSorting:y,columnFilters:j,setColumnFilters:x,columnVisibility:v,setColumnVisibility:k,columnOrder:N,setColumnOrder:D,expanded:P,setExpanded:R,grouping:A,setGrouping:S,rowSelection:M,setRowSelection:E,globalFilter:T,setGlobalFilter:K,pagination:q,setPagination:B,selectedRows:$,resetFilters:_,resetSelection:F,resetAll:H,exportData:J,getGroupedData:Q,getExpandedData:ne,toggleGrouping:X,clearGrouping:Y,toggleRowExpansion:U,expandAll:ae,collapseAll:te}}function bx(t){try{const s=localStorage.getItem(`datatable-${t}`);return s?JSON.parse(s):null}catch{return null}}function jx(t,s){try{localStorage.setItem(`datatable-${t}`,JSON.stringify(s))}catch{}}function vx(t,s,a){const r=a.toLowerCase();return t.getVisibleCells().some(n=>{const o=n.getValue();return o==null?!1:String(o).toLowerCase().includes(r)})}function gl({data:t,virtualization:s,containerRef:a}){const[r,n]=O.useState(s?.containerHeight||600);O.useEffect(()=>{if(!a.current||!s)return;const p=new ResizeObserver(w=>{for(const C of w)n(C.contentRect.height)});return p.observe(a.current),()=>{p.disconnect()}},[a,s]);const o=O.useMemo(()=>{if(!s||s.type==="none")return null;const p={count:t.length,getScrollElement:()=>a.current,estimateSize:()=>s.itemHeight||50,overscan:s.overscan||5};return s.type==="dynamic"?{...p,estimateSize:()=>s.estimatedItemHeight||50}:p},[t.length,s,a]),i=o?nd.useVirtualizer(o):null,l=O.useCallback((p,w="start")=>{i&&i.scrollToIndex(p,{align:w})},[i]),u=O.useCallback(p=>{i&&i.scrollToOffset(p)},[i]),d=O.useCallback(()=>i?i.getVirtualItems():[],[i]),f=O.useCallback(()=>i?i.getTotalSize():0,[i]),m=s?.type!=="none"&&o!==null;return{virtualizer:i,isVirtualized:m,containerHeight:r,scrollToIndex:l,scrollToOffset:u,getVirtualItems:d,getTotalSize:f,virtualItems:i?i.getVirtualItems():[],totalSize:i?i.getTotalSize():0}}function bl({data:t,columns:s,exportConfig:a}){const r=O.useMemo(()=>({formats:["csv","xlsx","json"],filename:"export",includeHeaders:!0,...a}),[a]),n=O.useCallback((p,w)=>{if(!p.length)return;const C=s.filter(v=>v.accessorKey||v.id).map(v=>v.header||v.accessorKey||v.id).join(","),g=p.map(v=>s.filter(k=>k.accessorKey||k.id).map(k=>{const N=k.accessorKey?v[k.accessorKey]:v[k.id],D=k.formatter?k.formatter(N):N,P=String(D||"");return P.includes(",")||P.includes('"')||P.includes(`
15
+ `).filter(d=>d.trim());if(i.length===0){s([]);return}const l=i[0].split(",").map(d=>d.trim().replace(/^"|"$/g,"")),u=i.slice(1).map(d=>{const f=d.split(",").map(p=>p.trim().replace(/^"|"$/g,"")),m={};return l.forEach((p,w)=>{m[p]=f[w]||""}),m});s(u)}catch(o){a(o)}},r.onerror=()=>a(r.error),r.readAsText(t)})}function hl(t,s){try{localStorage.setItem(`datatable_${t}`,JSON.stringify(s))}catch(a){console.warn("[DataTable] Failed to save state:",a)}}function fl(t){try{const s=localStorage.getItem(`datatable_${t}`);return s?JSON.parse(s):null}catch(s){return console.warn("[DataTable] Failed to load state:",s),null}}function px(t,s,a){const r=a.toLowerCase();return Object.values(t).some(n=>n==null?!1:String(n).toLowerCase().includes(r))}function pl({data:t,columns:s,pagination:a,tableId:r,onSortingChange:n,onFiltersChange:o,onSelectionChange:i}){const l=O.useMemo(()=>r?fl(r):null,[r]),[u,d]=O.useState(l?.sorting||[]),[f,m]=O.useState(l?.columnFilters||[]),[p,w]=O.useState(l?.columnVisibility||{}),[C,g]=O.useState({}),[y,j]=O.useState(l?.globalFilter||""),[x,v]=O.useState({pageIndex:a?.currentPage||0,pageSize:a?.pageSize||10});O.useEffect(()=>{r&&hl(r,{sorting:u,columnFilters:f,columnVisibility:p,globalFilter:y})},[r,u,f,p,y]),O.useEffect(()=>{n?.(u)},[u,n]),O.useEffect(()=>{o?.(f)},[f,o]),O.useEffect(()=>{const A=k.getFilteredSelectedRowModel().rows.map(S=>S.original);i?.(A)},[C]);const k=Be.useReactTable({data:t,columns:s,state:{sorting:u,columnFilters:f,columnVisibility:p,rowSelection:C,globalFilter:y,pagination:x},enableRowSelection:!0,onRowSelectionChange:g,onSortingChange:d,onColumnFiltersChange:m,onColumnVisibilityChange:w,onGlobalFilterChange:j,onPaginationChange:v,getCoreRowModel:Be.getCoreRowModel(),getFilteredRowModel:Be.getFilteredRowModel(),getPaginationRowModel:Be.getPaginationRowModel(),getSortedRowModel:Be.getSortedRowModel(),globalFilterFn:px,manualPagination:a?.mode==="server",pageCount:a?.mode==="server"?Math.ceil((a.totalItems||0)/x.pageSize):void 0}),N=O.useMemo(()=>k.getFilteredSelectedRowModel().rows.map(A=>A.original),[k,C]),D=O.useCallback(()=>{m([]),j("")},[]),P=O.useCallback(()=>{g({})},[]),R=O.useCallback(()=>k.getFilteredRowModel().rows.map(A=>A.original),[k]);return{table:k,sorting:u,setSorting:d,columnFilters:f,setColumnFilters:m,columnVisibility:p,setColumnVisibility:w,rowSelection:C,setRowSelection:g,globalFilter:y,setGlobalFilter:j,pagination:x,setPagination:v,selectedRows:N,resetFilters:D,resetSelection:P,exportData:R}}function Wr(t="standard",s="comfortable"){const[a,r]=O.useState(t),[n,o]=O.useState(s),[i,l]=O.useState(!1);O.useEffect(()=>{const m=()=>{l(window.innerWidth<768)};return m(),window.addEventListener("resize",m),()=>window.removeEventListener("resize",m)},[]),O.useEffect(()=>{i&&a==="standard"&&r("card")},[i,a]);const u=O.useCallback(()=>{r(m=>{switch(m){case"standard":return"card";case"card":return"compact";case"compact":return"standard";default:return"standard"}})},[]),d=O.useCallback(()=>{o(m=>m==="comfortable"?"compact":"comfortable")},[]);return{layout:a,setLayout:r,density:n,setDensity:o,toggleLayout:u,toggleDensity:d,isMobile:i,densityClasses:{comfortable:{table:"text-sm",cell:"px-4 py-3",header:"px-4 py-3"},compact:{table:"text-xs",cell:"px-2 py-1.5",header:"px-2 py-2"},spacious:{table:"text-base",cell:"px-6 py-4",header:"px-6 py-4"}}[n]}}function Ur(t,s={}){const{onSave:a,onCancel:r,validateField:n,autoSave:o=!1,autoSaveDelay:i=2e3}=s,[l,u]=O.useState(null),[d,f]=O.useState({}),[m,p]=O.useState(null),[w,C]=O.useState({}),[g,y]=O.useState(!1),j=O.useMemo(()=>!m||!l?!1:Object.keys(d).some(M=>{const E=M;return d[E]!==m[E]}),[d,m,l]),x=j&&l!==null,v=O.useCallback((M,E)=>{u(M),f({...E}),p(E),C({})},[]),k=O.useCallback(()=>{!l||!m||(r?.(l,m),u(null),f({}),p(null),C({}))},[l,m,r]),N=O.useCallback((M,E)=>{if(l){if(n){const T=n(M,E);if(T){C(K=>({...K,[M]:T}));return}else C(K=>{const q={...K};return delete q[M],q})}f(T=>({...T,[M]:E}))}},[l,n]),D=O.useCallback(async()=>{if(!(!l||!a||g)){if(Object.keys(w).length>0)throw new Error("Validation errors present");y(!0);try{await a(l,d),u(null),f({}),p(null),C({})}catch(M){throw console.error("Error saving edit:",M),M}finally{y(!1)}}},[l,a,d,w,g]),P=O.useCallback(()=>{m&&(f({...m}),C({}))},[m]),R=O.useMemo(()=>!o||!x?null:setTimeout(()=>{x&&!g&&D().catch(console.error)},i),[o,x,g,D,i]);return O.useEffect(()=>()=>{R&&clearTimeout(R)},[R]),[{editingRowId:l,editedData:d,hasChanges:j,isDirty:x},{startEdit:v,cancelEdit:k,saveEdit:D,updateField:N,resetEdit:P}]}function Qs({table:t,config:s,globalFilter:a,onGlobalFilterChange:r,density:n,onDensityChange:o,onExport:i,onImport:l}){const{t:u}=wt.useTranslation(),d=c.useRef(null),f=t.getFilteredSelectedRowModel().rows,m=f.length>0,p=c.useMemo(()=>s?.actions?s.actions.filter(g=>!(g.requiresSelection&&!m)):[],[s?.actions,m]),w=g=>{const y=m?f.map(j=>j.original):t.getFilteredRowModel().rows.map(j=>j.original);i?i(g):g==="csv"?ul(y,"export.csv"):ml(y,"export.json")},C=g=>{const y=g.target.files?.[0];y&&l&&l(y),d.current&&(d.current.value="")};return e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 p-4 border-b",children:[e.jsxs("div",{className:"flex flex-1 flex-col sm:flex-row items-start sm:items-center gap-2 w-full sm:w-auto",children:[s?.showSearch!==!1&&e.jsxs("div",{className:"relative w-full sm:w-64",children:[e.jsx(h.Search,{className:"absolute left-2 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{placeholder:u("datatable.toolbar.search",{defaultValue:"Search..."}),value:a??"",onChange:g=>r(g.target.value),className:"pl-8 h-9"}),a&&e.jsx("button",{onClick:()=>r(""),className:"absolute right-2 top-2.5 text-muted-foreground hover:text-foreground",children:e.jsx(h.X,{className:"h-4 w-4"})})]}),m&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsxs("span",{children:[f.length," ",u("datatable.toolbar.selected",{defaultValue:"selected"})]}),e.jsx(L,{variant:"ghost",size:"sm",onClick:()=>t.resetRowSelection(),className:"h-7 px-2",children:u("datatable.toolbar.clear",{defaultValue:"Clear"})})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[p.map(g=>e.jsxs(L,{variant:g.variant||"outline",size:"sm",onClick:()=>g.onClick(f.map(y=>y.original)),disabled:g.disabled,className:"h-9",children:[g.icon,e.jsx("span",{className:"ml-2",children:g.label})]},g.id)),s?.showRefresh&&e.jsxs(L,{variant:"outline",size:"icon",onClick:s.onRefresh,className:"h-9 w-9",children:[e.jsx(h.RefreshCw,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:u("datatable.toolbar.refresh",{defaultValue:"Refresh"})})]}),i&&e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"icon",className:"h-9 w-9",children:[e.jsx(h.Download,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:u("datatable.toolbar.export",{defaultValue:"Export"})})]})}),e.jsxs(_e,{align:"end",children:[e.jsx(ms,{children:u("datatable.toolbar.exportAs",{defaultValue:"Export as"})}),e.jsx(Qe,{}),e.jsx(ds,{onClick:()=>w("csv"),children:"CSV"}),e.jsx(ds,{onClick:()=>w("json"),children:"JSON"})]})]}),l&&e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:d,type:"file",accept:".csv,.json",onChange:C,className:"hidden"}),e.jsxs(L,{variant:"outline",size:"icon",onClick:()=>d.current?.click(),className:"h-9 w-9",children:[e.jsx(h.Upload,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:u("datatable.toolbar.import",{defaultValue:"Import"})})]})]}),s?.showColumnToggle!==!1&&e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"icon",className:"h-9 w-9",children:[e.jsx(h.Columns,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:u("datatable.toolbar.columns",{defaultValue:"Columns"})})]})}),e.jsxs(_e,{align:"end",className:"w-48",children:[e.jsx(ms,{children:u("datatable.toolbar.toggleColumns",{defaultValue:"Toggle columns"})}),e.jsx(Qe,{}),t.getAllColumns().filter(g=>g.getCanHide()).map(g=>e.jsx(ds,{className:"capitalize",checked:g.getIsVisible(),onCheckedChange:y=>g.toggleVisibility(!!y),children:g.id},g.id))]})]}),s?.showDensity&&o&&e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"icon",className:"h-9 w-9",children:[e.jsx(h.SlidersHorizontal,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:u("datatable.toolbar.density",{defaultValue:"Density"})})]})}),e.jsxs(_e,{align:"end",children:[e.jsx(ms,{children:u("datatable.toolbar.tableDensity",{defaultValue:"Table density"})}),e.jsx(Qe,{}),e.jsx(ds,{checked:n==="comfortable",onCheckedChange:()=>o("comfortable"),children:u("datatable.toolbar.comfortable",{defaultValue:"Comfortable"})}),e.jsx(ds,{checked:n==="compact",onCheckedChange:()=>o("compact"),children:u("datatable.toolbar.compact",{defaultValue:"Compact"})})]})]})]})]})}function Br({table:t,pageSizeOptions:s=[25,50,100,500],showInfo:a=!0}){const{t:r}=wt.useTranslation(),n=t.getState().pagination.pageIndex,o=t.getState().pagination.pageSize,i=t.getPageCount(),l=t.getFilteredRowModel().rows.length,u=n*o+1,d=Math.min((n+1)*o,l);return e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[a&&e.jsx("div",{className:"text-sm text-muted-foreground",children:l>0?e.jsxs(e.Fragment,{children:[r("datatable.pagination.showing",{defaultValue:"Showing"})," ",u," ",r("datatable.pagination.to",{defaultValue:"to"})," ",d," ",r("datatable.pagination.of",{defaultValue:"of"})," ",l," ",r("datatable.pagination.results",{defaultValue:"results"})]}):r("datatable.pagination.noResults",{defaultValue:"No results"})}),e.jsxs("div",{className:"flex items-center gap-6",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:r("datatable.pagination.rowsPerPage",{defaultValue:"Rows per page"})}),e.jsxs(Ve,{value:`${o}`,onValueChange:f=>{t.setPageSize(Number(f))},children:[e.jsx($e,{className:"h-8 w-[70px]",children:e.jsx(We,{placeholder:o})}),e.jsx(Le,{side:"top",children:s.map(f=>e.jsx(je,{value:`${f}`,children:f},f))})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"text-sm text-muted-foreground mr-2",children:[r("datatable.pagination.page",{defaultValue:"Page"})," ",n+1," ",r("datatable.pagination.of",{defaultValue:"of"})," ",i]}),e.jsxs(L,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>t.setPageIndex(0),disabled:!t.getCanPreviousPage(),children:[e.jsx(h.ChevronsLeft,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:r("datatable.pagination.firstPage",{defaultValue:"First page"})})]}),e.jsxs(L,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>t.previousPage(),disabled:!t.getCanPreviousPage(),children:[e.jsx(h.ChevronLeft,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:r("datatable.pagination.previousPage",{defaultValue:"Previous page"})})]}),e.jsxs(L,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>t.nextPage(),disabled:!t.getCanNextPage(),children:[e.jsx(h.ChevronRight,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:r("datatable.pagination.nextPage",{defaultValue:"Next page"})})]}),e.jsxs(L,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>t.setPageIndex(i-1),disabled:!t.getCanNextPage(),children:[e.jsx(h.ChevronsRight,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:r("datatable.pagination.lastPage",{defaultValue:"Last page"})})]})]})]})]})}function qr({table:t,filters:s,position:a="top",onFiltersChange:r}){const{t:n}=wt.useTranslation(),[o,i]=c.useState([]),[l,u]=c.useState(!1),d=c.useCallback(j=>{const x=t.getPreFilteredRowModel().rows,v=new Set;return x.forEach(k=>{const N=k.getValue(j);N!=null&&N!==""&&v.add(String(N))}),Array.from(v).sort()},[t]),f={text:[{value:"contains",label:n("datatable.filters.contains",{defaultValue:"Contains"})},{value:"equals",label:n("datatable.filters.equals",{defaultValue:"Equals"})},{value:"startsWith",label:n("datatable.filters.startsWith",{defaultValue:"Starts with"})},{value:"endsWith",label:n("datatable.filters.endsWith",{defaultValue:"Ends with"})},{value:"notContains",label:n("datatable.filters.notContains",{defaultValue:"Not contains"})}],select:[{value:"equals",label:n("datatable.filters.equals",{defaultValue:"Equals"})},{value:"notEquals",label:n("datatable.filters.notEquals",{defaultValue:"Not equals"})}],multiselect:[{value:"in",label:n("datatable.filters.in",{defaultValue:"In"})},{value:"notIn",label:n("datatable.filters.notIn",{defaultValue:"Not in"})}],range:[{value:"between",label:n("datatable.filters.between",{defaultValue:"Between"})},{value:"greaterThan",label:n("datatable.filters.greaterThan",{defaultValue:"Greater than"})},{value:"lessThan",label:n("datatable.filters.lessThan",{defaultValue:"Less than"})}],date:[{value:"equals",label:n("datatable.filters.equals",{defaultValue:"Equals"})},{value:"before",label:n("datatable.filters.before",{defaultValue:"Before"})},{value:"after",label:n("datatable.filters.after",{defaultValue:"After"})},{value:"between",label:n("datatable.filters.between",{defaultValue:"Between"})}],daterange:[{value:"between",label:n("datatable.filters.between",{defaultValue:"Between"})},{value:"before",label:n("datatable.filters.before",{defaultValue:"Before"})},{value:"after",label:n("datatable.filters.after",{defaultValue:"After"})}],checkbox:[{value:"equals",label:n("datatable.filters.equals",{defaultValue:"Equals"})}],number:[{value:"equals",label:n("datatable.filters.equals",{defaultValue:"Equals"})},{value:"notEquals",label:n("datatable.filters.notEquals",{defaultValue:"Not equals"})},{value:"greaterThan",label:n("datatable.filters.greaterThan",{defaultValue:"Greater than"})},{value:"lessThan",label:n("datatable.filters.lessThan",{defaultValue:"Less than"})},{value:"between",label:n("datatable.filters.between",{defaultValue:"Between"})}],boolean:[{value:"equals",label:n("datatable.filters.equals",{defaultValue:"Equals"})},{value:"notEquals",label:n("datatable.filters.notEquals",{defaultValue:"Not equals"})}]},m=(j,x,v)=>{const k=t.getColumn(j.column||j.id);if(!k)return;const N={columnId:j.column||j.id,operator:x,value:v,label:j.label};i(D=>[...D,N]),k.setFilterValue({operator:x,value:v}),r?.([...o,N])},p=j=>{const x=o[j],v=t.getColumn(x.columnId);v&&v.setFilterValue(void 0);const k=o.filter((N,D)=>D!==j);i(k),r?.(k)},w=()=>{o.forEach(j=>{const x=t.getColumn(j.columnId);x&&x.setFilterValue(void 0)}),i([]),r?.([])},C=j=>{const[x,v]=c.useState(f[j.type]?.[0]?.value||"equals"),k=()=>j.defaultValue!==void 0?j.defaultValue:j.type==="range"?{min:"",max:""}:j.type==="daterange"?{from:"",to:""}:j.type==="checkbox"?!1:"",[N,D]=c.useState(k()),[P,R]=c.useState([]),[A,S]=c.useState(!1),M=j.column?d(j.column):[],E=()=>{const T=j.type==="multiselect"?P:N;let K=!1;j.type==="multiselect"?K=Array.isArray(T)&&T.length>0:j.type==="range"?K=T.min!==""||T.max!=="":j.type==="daterange"?K=T.from!==""||T.to!=="":j.type==="checkbox"?K=!0:K=T!==""&&T!=null,K&&(m(j,x,T),D(k()),R([]),S(!1))};return e.jsxs("div",{className:"space-y-3 p-4 border rounded-lg",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(me,{className:"text-sm font-medium",children:j.label}),e.jsx(Se,{variant:"outline",className:"text-xs",children:j.type})]}),f[j.type]&&f[j.type].length>1&&e.jsxs(Ve,{value:x,onValueChange:v,children:[e.jsx($e,{className:"h-9",children:e.jsx(We,{})}),e.jsx(Le,{children:f[j.type].map(T=>e.jsx(je,{value:T.value,children:T.label},T.value))})]}),j.type==="text"&&e.jsx("div",{className:"space-y-2",children:e.jsxs(rt,{open:A,onOpenChange:S,children:[e.jsx(nt,{asChild:!0,children:e.jsx(oe,{placeholder:j.placeholder||n("datatable.filters.enterValue",{defaultValue:"Enter value..."}),value:N,onChange:T=>{D(T.target.value),S(!0)},className:"h-9"})}),M.length>0&&N&&e.jsx(st,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(ss,{children:[e.jsx(xs,{placeholder:n("datatable.filters.search",{defaultValue:"Search..."})}),e.jsx(gs,{children:n("datatable.filters.noResults",{defaultValue:"No results"})}),e.jsx(Ot,{className:"max-h-64 overflow-auto",children:M.filter(T=>T.toLowerCase().includes(N.toLowerCase())).slice(0,50).map(T=>e.jsx(zt,{onSelect:()=>{D(T),S(!1)},children:T},T))})]})})]})}),j.type==="select"&&e.jsxs(Ve,{value:N,onValueChange:D,children:[e.jsx($e,{className:"h-9",children:e.jsx(We,{placeholder:j.placeholder})}),e.jsx(Le,{children:(j.options||M.map(T=>({label:T,value:T}))).map(T=>e.jsx(je,{value:String(T.value),children:T.label},T.value))})]}),j.type==="multiselect"&&e.jsxs(rt,{children:[e.jsx(nt,{asChild:!0,children:e.jsxs(L,{variant:"outline",className:"w-full justify-between h-9",children:[P.length>0?`${P.length} ${n("datatable.filters.selected",{defaultValue:"selected"})}`:j.placeholder||n("datatable.filters.selectValues",{defaultValue:"Select values..."}),e.jsx(h.ChevronDown,{className:"ml-2 h-4 w-4 opacity-50"})]})}),e.jsx(st,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(ss,{children:[e.jsx(xs,{placeholder:n("datatable.filters.search",{defaultValue:"Search..."})}),e.jsx(gs,{children:n("datatable.filters.noResults",{defaultValue:"No results"})}),e.jsx(Ot,{className:"max-h-64 overflow-auto",children:M.map(T=>e.jsxs(zt,{onSelect:()=>{R(K=>K.includes(T)?K.filter(q=>q!==T):[...K,T])},children:[e.jsx(Ze,{checked:P.includes(T),className:"mr-2"}),T]},T))})]})})]}),j.type==="date"&&e.jsx(oe,{type:"date",value:N,onChange:T=>D(T.target.value),className:"h-9"}),j.type==="range"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{type:"number",placeholder:"Min",value:N.min||"",onChange:T=>D({...N,min:T.target.value}),className:"h-9"}),e.jsx(oe,{type:"number",placeholder:"Max",value:N.max||"",onChange:T=>D({...N,max:T.target.value}),className:"h-9"})]}),j.type==="daterange"&&e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{type:"date",placeholder:n("datatable.filters.from",{defaultValue:"From"}),value:N.from||"",onChange:T=>D({...N,from:T.target.value}),className:"h-9"}),e.jsx(oe,{type:"date",placeholder:n("datatable.filters.to",{defaultValue:"To"}),value:N.to||"",onChange:T=>D({...N,to:T.target.value}),className:"h-9"})]}),j.type==="checkbox"&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ze,{id:`checkbox-${j.id}`,checked:N===!0,onCheckedChange:T=>D(T===!0)}),e.jsx(me,{htmlFor:`checkbox-${j.id}`,className:"text-sm font-normal",children:j.placeholder||n("datatable.filters.checked",{defaultValue:"Checked"})})]}),e.jsxs(L,{onClick:E,size:"sm",className:"w-full",children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-2"}),n("datatable.filters.apply",{defaultValue:"Apply filter"})]})]})};if(!s||s.length===0)return null;const g=e.jsxs("div",{className:"space-y-4",children:[o.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(me,{className:"text-sm text-muted-foreground",children:n("datatable.filters.active",{defaultValue:"Filtres actifs"})}),e.jsxs(L,{variant:"ghost",size:"sm",onClick:w,children:[e.jsx(h.Trash2,{className:"h-3 w-3 mr-1"}),n("datatable.filters.clearAll",{defaultValue:"Tout effacer"})]})]}),e.jsx("div",{className:"space-y-1",children:o.map((j,x)=>e.jsxs("div",{className:"flex items-center justify-between p-2 bg-muted rounded-md text-sm",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"font-medium",children:j.label}),e.jsx("span",{className:"text-muted-foreground mx-2",children:j.operator}),e.jsx("span",{className:"text-primary truncate",children:Array.isArray(j.value)?j.value.join(", "):j.value})]}),e.jsx(L,{variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0",onClick:()=>p(x),children:e.jsx(h.X,{className:"h-3 w-3"})})]},x))})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(me,{className:"text-sm text-muted-foreground",children:n("datatable.filters.available",{defaultValue:"Filtres disponibles"})}),s.map(j=>e.jsx("div",{children:C(j)},j.id))]})]}),y=e.jsxs(L,{variant:"outline",size:"sm",children:[e.jsx(h.Filter,{className:"h-4 w-4 mr-2"}),n("datatable.filters.title",{defaultValue:"Filtres"}),o.length>0&&e.jsx(Se,{variant:"secondary",className:"ml-2",children:o.length})]});return a==="right"||a==="left"?e.jsxs(sa,{open:l,onOpenChange:u,children:[e.jsx(Rr,{asChild:!0,children:y}),e.jsxs(Ds,{side:a,className:"w-[400px] sm:w-[540px] overflow-y-auto",children:[e.jsxs(Ra,{children:[e.jsxs(aa,{className:"flex items-center gap-2",children:[e.jsx(h.Filter,{className:"h-5 w-5"}),n("datatable.filters.title",{defaultValue:"Filtres"})]}),e.jsx(ra,{children:n("datatable.filters.description",{defaultValue:"Appliquez des filtres pour affiner les résultats"})})]}),e.jsx("div",{className:"mt-6",children:g})]})]}):e.jsxs(rt,{open:l,onOpenChange:u,children:[e.jsx(nt,{asChild:!0,children:y}),e.jsx(st,{className:"w-[400px] max-h-[600px] overflow-y-auto",align:a==="top"?"start":"end",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.Filter,{className:"h-4 w-4"}),e.jsx("h4",{className:"font-semibold text-sm",children:n("datatable.filters.title",{defaultValue:"Filtres"})})]})}),g]})})]})}function Na({value:t,field:s,config:a,isEditing:r,error:n,onChange:o,onStartEdit:i,onSave:l,onCancel:u,className:d}){const[f,m]=c.useState(t),[p,w]=c.useState(!1);c.useEffect(()=>{m(t)},[t]);const C=()=>{o(f),l()},g=()=>{m(t),u()},y=x=>{x.key==="Enter"&&!x.shiftKey?(x.preventDefault(),C()):x.key==="Escape"&&(x.preventDefault(),g())};if(!r)return e.jsx("div",{className:ge("cursor-pointer hover:bg-muted/50 p-1 rounded transition-colors",d),onClick:i,children:xx(t,a)});const j=()=>{switch(a.type){case"textarea":return e.jsx(ft,{value:f||"",onChange:x=>m(x.target.value),onKeyDown:y,placeholder:a.placeholder,rows:a.rows||3,disabled:a.disabled,className:ge(n&&"border-destructive")});case"select":return e.jsxs(Ve,{value:f||"",onValueChange:m,disabled:a.disabled,children:[e.jsx($e,{className:ge(n&&"border-destructive"),children:e.jsx(We,{placeholder:a.placeholder})}),e.jsx(Le,{children:a.options?.map(x=>e.jsx(je,{value:x.value,children:x.label},x.value))})]});case"checkbox":return e.jsx(Ze,{checked:!!f,onCheckedChange:m,disabled:a.disabled});case"switch":return e.jsx(na,{checked:!!f,onCheckedChange:m,disabled:a.disabled});case"date":case"datetime":return e.jsxs(rt,{open:p,onOpenChange:w,children:[e.jsx(nt,{asChild:!0,children:e.jsxs(L,{variant:"outline",className:ge("w-full justify-start text-left font-normal",!f&&"text-muted-foreground",n&&"border-destructive"),children:[e.jsx(h.CalendarIcon,{className:"mr-2 h-4 w-4"}),f?V.format(new Date(f),"PPP"):a.placeholder]})}),e.jsx(st,{className:"w-auto p-0",align:"start",children:e.jsx(Ma,{mode:"single",selected:f?new Date(f):void 0,onSelect:x=>{x&&(m(a.type==="datetime"?x.toISOString():x.toISOString().split("T")[0]),w(!1))},initialFocus:!0})})]});default:return e.jsx(oe,{type:a.type,value:f||"",onChange:x=>m(x.target.value),onKeyDown:y,placeholder:a.placeholder,min:a.min,max:a.max,step:a.step,disabled:a.disabled,required:a.required,pattern:a.pattern,title:a.title,className:ge(n&&"border-destructive")})}};return e.jsxs("div",{className:ge("relative",d),children:[j(),e.jsxs("div",{className:"absolute right-1 top-1/2 -translate-y-1/2 flex gap-1",children:[e.jsx(L,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:C,children:e.jsx(h.Check,{className:"h-3 w-3 text-green-600"})}),e.jsx(L,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0",onClick:g,children:e.jsx(h.X,{className:"h-3 w-3 text-red-600"})})]}),n&&e.jsx("p",{className:"text-xs text-destructive mt-1",children:n})]})}function xx(t,s){if(t==null)return e.jsx("span",{className:"text-muted-foreground italic",children:"Non défini"});switch(s.type){case"checkbox":case"switch":return e.jsx("span",{className:ge("inline-flex items-center px-2 py-1 rounded-full text-xs font-medium",t?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"),children:t?"Oui":"Non"});case"date":case"datetime":try{const r=new Date(t);return V.format(r,s.type==="datetime"?"PPP p":"PPP")}catch{return t}case"select":const a=s.options?.find(r=>r.value===t);return a?a.label:t;case"textarea":return e.jsx("div",{className:"max-w-xs",children:e.jsx("p",{className:"truncate",children:t})});default:return t}}function gx({data:t,columns:s,layout:a="standard",variant:r="bordered",density:n="comfortable",filters:o,filterPosition:i="top",toolbar:l,pagination:u,selection:d=!1,actions:f,i18nNamespace:m,loading:p=!1,error:w,emptyState:C,headerSticky:g=!1,columnVisibilityToggle:y=!0,columnResize:j=!1,enableExport:x=!1,enableImport:v=!1,enableReorder:k=!1,enableContextMenu:N=!1,onRowClick:D,onRowDoubleClick:P,onSortingChange:R,onFiltersChange:A,onSelectionChange:S,className:M,tableId:E,virtualization:T,edit:K}){const{t:q}=wt.useTranslation(m),{layout:B,setLayout:W,density:I,setDensity:z,densityClasses:$}=Wr(a,n),_=c.useMemo(()=>{const xe=[...s];if(d){const se={id:"select",header:({table:de})=>e.jsx(Ze,{checked:de.getIsAllPageRowsSelected(),onCheckedChange:De=>de.toggleAllPageRowsSelected(!!De),"aria-label":q("datatable.selectAll",{defaultValue:"Select all"})}),cell:({row:de})=>e.jsx(Ze,{checked:de.getIsSelected(),onCheckedChange:De=>de.toggleSelected(!!De),"aria-label":q("datatable.selectRow",{defaultValue:"Select row"})}),enableSorting:!1,enableHiding:!1};xe.unshift(se)}return xe},[s,d,K,q]),{table:F,globalFilter:H,setGlobalFilter:J,selectedRows:Q,resetFilters:ne,exportData:X}=pl({data:t,columns:_,pagination:u,tableId:E,onSortingChange:R,onFiltersChange:A,onSelectionChange:S}),[Y,U]=Ur(F,{onSave:K?.onSave,onCancel:K?.onCancel,autoSave:K?.autoSave,autoSaveDelay:K?.autoSaveDelay});if(K?.editableColumns&&K.editableColumns.length>0){const xe={id:"edit-actions",header:()=>q("datatable.actions",{defaultValue:"Actions"}),cell:({row:se})=>Y.editingRowId===se.id?e.jsxs("div",{className:"flex gap-1",children:[e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>U.saveEdit(),disabled:!Y.hasChanges,children:q("datatable.save",{defaultValue:"Save"})}),e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>U.cancelEdit(),children:q("datatable.cancel",{defaultValue:"Cancel"})})]}):e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>{console.log("🔧 Starting edit for row:",se.id,se.original),U.startEdit(se.id,se.original)},children:q("datatable.edit",{defaultValue:"Edit"})}),enableSorting:!1,enableHiding:!1};_.push(xe)}const ae=c.useCallback(xe=>{const se=X();console.log("Export",xe,se)},[X]),te=c.useCallback(xe=>{console.log("Import",xe)},[]),Z={bordered:"border rounded-lg",minimal:"",striped:"[&_tbody_tr:nth-child(even)]:bg-muted/50",glass:"backdrop-blur-sm bg-background/80 border rounded-lg"};if(p)return e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(h.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:q("datatable.loading",{defaultValue:"Loading..."})})]})});if(w)return e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg bg-destructive/10",children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-destructive",children:[e.jsx(h.AlertCircle,{className:"h-8 w-8"}),e.jsx("p",{className:"text-sm font-medium",children:w})]})});if(!t||t.length===0)return e.jsxs("div",{className:"flex flex-col",children:[l&&e.jsx(Qs,{table:F,config:l,globalFilter:H,onGlobalFilterChange:J,density:I,onDensityChange:z,onExport:x?ae:void 0,onImport:v?te:void 0}),e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg",children:C||e.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[e.jsx("p",{className:"text-lg font-medium",children:q("datatable.noData",{defaultValue:"No data"})}),e.jsx("p",{className:"text-sm",children:q("datatable.noDataDescription",{defaultValue:"There are no results to display"})})]})})]});const le=()=>{const xe=e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[l&&e.jsx("div",{className:"flex-1",children:e.jsx(Qs,{table:F,config:l,globalFilter:H,onGlobalFilterChange:J,density:I,onDensityChange:z,onExport:x?ae:void 0,onImport:v?te:void 0})}),o&&e.jsx(qr,{table:F,filters:o,position:i,onFiltersChange:A})]}),e.jsx("div",{className:ge("w-full overflow-auto",Z[r]),children:e.jsxs("table",{className:ge("w-full caption-bottom text-sm",$.table),children:[e.jsx("thead",{className:ge(g&&"sticky top-0 bg-background z-10"),children:F.getHeaderGroups().map(se=>e.jsx("tr",{className:"border-b",children:se.headers.map(de=>e.jsxs("th",{className:ge("text-left font-medium text-muted-foreground",$.header,de.column.getCanSort()&&"cursor-pointer select-none hover:text-foreground"),onClick:de.column.getToggleSortingHandler(),children:[de.isPlaceholder?null:Be.flexRender(de.column.columnDef.header,de.getContext()),de.column.getIsSorted()&&e.jsx("span",{className:"ml-2",children:de.column.getIsSorted()==="asc"?"↑":"↓"})]},de.id))},se.id))}),e.jsx("tbody",{children:F.getRowModel().rows.map(se=>e.jsx("tr",{className:ge("border-b transition-colors",D&&"cursor-pointer hover:bg-muted/50",se.getIsSelected()&&"bg-muted"),onClick:()=>D?.(se.original),onDoubleClick:()=>P?.(se.original),children:se.getVisibleCells().map(de=>{const De=de.getValue(),Ne=de.column.id,Ke=se.id,xt=Y.editingRowId===Ke,Ye=K?.editableColumns?.find(et=>et.field===Ne);return Ye&&xt?e.jsx("td",{className:ge("align-middle",$.cell),children:e.jsx(Na,{value:De,field:Ne,config:Ye.config,isEditing:xt,onChange:et=>U.updateField(Ne,et),onStartEdit:()=>U.startEdit(Ke,se.original),onSave:()=>U.saveEdit(),onCancel:()=>U.cancelEdit()})},de.id):e.jsx("td",{className:ge("align-middle",$.cell),children:Be.flexRender(de.column.columnDef.cell,de.getContext())},de.id)})},se.id))})]})}),u&&e.jsx(Br,{table:F,pageSizeOptions:u.pageSizeOptions})]});return e.jsx("div",{className:"space-y-4",children:xe})};return e.jsx("div",{className:ge("w-full",M),children:le()})}function xl({data:t,columns:s,pagination:a,tableId:r,onSortingChange:n,onFiltersChange:o,onSelectionChange:i,onColumnOrderChange:l,onExpandedChange:u,onGroupingChange:d,grouping:f,virtualization:m,sortMode:p="multiple",performance:w}){const C=O.useMemo(()=>r?bx(r):null,[r]),[g,y]=O.useState(C?.sorting||[]),[j,x]=O.useState(C?.columnFilters||[]),[v,k]=O.useState(C?.columnVisibility||{}),[N,D]=O.useState(C?.columnOrder||[]),[P,R]=O.useState(C?.expanded||{}),[A,S]=O.useState(C?.grouping||[]),[M,E]=O.useState(C?.rowSelection||{}),[T,K]=O.useState(C?.globalFilter||""),[q,B]=O.useState({pageIndex:a?.currentPage||0,pageSize:a?.pageSize||10}),[W,I]=O.useState(j);O.useEffect(()=>{const Z=setTimeout(()=>{I(j)},w?.filterDebounceMs||300);return()=>clearTimeout(Z)},[j,w?.filterDebounceMs]),O.useEffect(()=>{f?.columns&&f.columns.length>0&&A.length===0&&S([f.columns[0]])},[f?.columns,A.length]),O.useEffect(()=>{r&&jx(r,{sorting:g,columnFilters:j,columnVisibility:v,columnOrder:N,expanded:P,grouping:A,pagination:q,globalFilter:T,density:"comfortable",layout:"standard",rowSelection:M})},[r,g,j,v,N,P,A,q,T,M]),O.useEffect(()=>{n?.(g)},[g,n]),O.useEffect(()=>{o?.(W)},[W,o]),O.useEffect(()=>{const Z=z.getFilteredSelectedRowModel().rows.map(le=>le.original);i?.(Z)},[M]),O.useEffect(()=>{l?.(N)},[N,l]),O.useEffect(()=>{u?.(P)},[P,u]),O.useEffect(()=>{d?.(A)},[A,d]);const z=Be.useReactTable({data:t,columns:s,state:{sorting:g,columnFilters:W,columnVisibility:v,columnOrder:N,expanded:P,grouping:A,rowSelection:M,globalFilter:T,pagination:q},enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0,enableGrouping:!0,enableExpanding:!0,enableColumnResizing:!0,enableSorting:!0,enableMultiSort:p==="multiple",enableFilters:!0,enableGlobalFilter:!0,enableColumnFilters:!0,onRowSelectionChange:E,onSortingChange:y,onColumnFiltersChange:x,onColumnVisibilityChange:k,onColumnOrderChange:D,onExpandedChange:R,onGroupingChange:S,onGlobalFilterChange:K,onPaginationChange:B,getCoreRowModel:Be.getCoreRowModel(),getFilteredRowModel:Be.getFilteredRowModel(),getPaginationRowModel:Be.getPaginationRowModel(),getSortedRowModel:Be.getSortedRowModel(),getGroupedRowModel:Be.getGroupedRowModel(),getExpandedRowModel:Be.getExpandedRowModel(),getFacetedRowModel:Be.getFacetedRowModel(),getFacetedUniqueValues:Be.getFacetedUniqueValues(),globalFilterFn:vx,manualPagination:a?.mode==="server",pageCount:a?.mode==="server"?Math.ceil((a.totalItems||0)/q.pageSize):void 0,columnResizeMode:"onChange",sortDescFirst:!1}),$=O.useMemo(()=>z.getFilteredSelectedRowModel().rows.map(Z=>Z.original),[z,M]),_=O.useCallback(()=>{x([]),K("")},[]),F=O.useCallback(()=>{E({})},[]),H=O.useCallback(()=>{y([]),x([]),k({}),D([]),R({}),S([]),E({}),K(""),B({pageIndex:0,pageSize:a?.pageSize||10})},[a?.pageSize]),J=O.useCallback(()=>z.getFilteredRowModel().rows.map(Z=>Z.original),[z]),Q=O.useCallback(()=>f?.columns?.length?z.getGroupedRowModel().rows.map(Z=>Z.original):t,[z,f,t]),ne=O.useCallback(()=>z.getExpandedRowModel().rows.map(Z=>Z.original),[z]),X=O.useCallback(Z=>{S(le=>le.includes(Z)?le.filter(se=>se!==Z):[...le,Z])},[]),Y=O.useCallback(()=>{S([])},[]),U=O.useCallback(Z=>{R(le=>({...le,[Z]:!le[Z]}))},[]),ae=O.useCallback(()=>{const Z=z.getRowModel().rows.map(xe=>xe.id),le={};Z.forEach(xe=>{le[xe]=!0}),R(le)},[z]),te=O.useCallback(()=>{R({})},[]);return{table:z,sorting:g,setSorting:y,columnFilters:j,setColumnFilters:x,columnVisibility:v,setColumnVisibility:k,columnOrder:N,setColumnOrder:D,expanded:P,setExpanded:R,grouping:A,setGrouping:S,rowSelection:M,setRowSelection:E,globalFilter:T,setGlobalFilter:K,pagination:q,setPagination:B,selectedRows:$,resetFilters:_,resetSelection:F,resetAll:H,exportData:J,getGroupedData:Q,getExpandedData:ne,toggleGrouping:X,clearGrouping:Y,toggleRowExpansion:U,expandAll:ae,collapseAll:te}}function bx(t){try{const s=localStorage.getItem(`datatable-${t}`);return s?JSON.parse(s):null}catch{return null}}function jx(t,s){try{localStorage.setItem(`datatable-${t}`,JSON.stringify(s))}catch{}}function vx(t,s,a){const r=a.toLowerCase();return t.getVisibleCells().some(n=>{const o=n.getValue();return o==null?!1:String(o).toLowerCase().includes(r)})}function gl({data:t,virtualization:s,containerRef:a}){const[r,n]=O.useState(s?.containerHeight||600);O.useEffect(()=>{if(!a.current||!s)return;const p=new ResizeObserver(w=>{for(const C of w)n(C.contentRect.height)});return p.observe(a.current),()=>{p.disconnect()}},[a,s]);const o=O.useMemo(()=>{if(!s||s.type==="none")return null;const p={count:t.length,getScrollElement:()=>a.current,estimateSize:()=>s.itemHeight||50,overscan:s.overscan||5};return s.type==="dynamic"?{...p,estimateSize:()=>s.estimatedItemHeight||50}:p},[t.length,s,a]),i=o?nd.useVirtualizer(o):null,l=O.useCallback((p,w="start")=>{i&&i.scrollToIndex(p,{align:w})},[i]),u=O.useCallback(p=>{i&&i.scrollToOffset(p)},[i]),d=O.useCallback(()=>i?i.getVirtualItems():[],[i]),f=O.useCallback(()=>i?i.getTotalSize():0,[i]),m=s?.type!=="none"&&o!==null;return{virtualizer:i,isVirtualized:m,containerHeight:r,scrollToIndex:l,scrollToOffset:u,getVirtualItems:d,getTotalSize:f,virtualItems:i?i.getVirtualItems():[],totalSize:i?i.getTotalSize():0}}function bl({data:t,columns:s,exportConfig:a}){const r=O.useMemo(()=>({formats:["csv","xlsx","json"],filename:"export",includeHeaders:!0,...a}),[a]),n=O.useCallback((p,w)=>{if(!p.length)return;const C=s.filter(v=>v.accessorKey||v.id).map(v=>v.header||v.accessorKey||v.id).join(","),g=p.map(v=>s.filter(k=>k.accessorKey||k.id).map(k=>{const N=k.accessorKey?v[k.accessorKey]:v[k.id],D=k.formatter?k.formatter(N):N,P=String(D||"");return P.includes(",")||P.includes('"')||P.includes(`
16
16
  `)?`"${P.replace(/"/g,'""')}"`:P}).join(",")),y=[C,...g].join(`
17
17
  `),j=new Blob([y],{type:"text/csv;charset=utf-8;"}),x=document.createElement("a");x.href=URL.createObjectURL(j),x.download=`${w||r.filename}.csv`,x.click(),URL.revokeObjectURL(x.href)},[s,r.filename]),o=O.useCallback((p,w)=>{const C=JSON.stringify(p,null,2),g=new Blob([C],{type:"application/json"}),y=document.createElement("a");y.href=URL.createObjectURL(g),y.download=`${w||r.filename}.json`,y.click(),URL.revokeObjectURL(y.href)},[r.filename]),i=O.useCallback(async(p,w)=>{try{if(typeof window>"u")throw new Error("XLSX export not available in server environment");const C=await import("xlsx"),y=[s.filter(v=>v.accessorKey||v.id).map(v=>v.header||v.accessorKey||v.id),...p.map(v=>s.filter(k=>k.accessorKey||k.id).map(k=>{const N=k.accessorKey?v[k.accessorKey]:v[k.id];return k.formatter?k.formatter(N):N}))],j=C.utils.aoa_to_sheet(y),x=C.utils.book_new();C.utils.book_append_sheet(x,j,"Sheet1"),C.writeFile(x,`${w||r.filename}.xlsx`)}catch(C){throw console.error("Erreur lors de l'export XLSX:",C),new Error("La librairie xlsx n'est pas disponible")}},[s,r.filename]),l=O.useCallback(async(p,w)=>{try{if(typeof window>"u")throw new Error("PDF export not available in server environment");const C=await import("jspdf"),g=await import("jspdf-autotable"),y=new C.default,j=s.filter(v=>v.accessorKey||v.id).map(v=>v.header||v.accessorKey||v.id),x=p.map(v=>s.filter(k=>k.accessorKey||k.id).map(k=>{const N=k.accessorKey?v[k.accessorKey]:v[k.id];return k.formatter?k.formatter(N):N}));y.autoTable({head:[j],body:x,startY:20,styles:{fontSize:8},headStyles:{fillColor:[66,139,202]}}),y.save(`${w||r.filename}.pdf`)}catch(C){throw console.error("Erreur lors de l'export PDF:",C),new Error("Les librairies jsPDF et jspdf-autotable ne sont pas disponibles")}},[s,r.filename]),u=O.useCallback((p,w)=>{const C=s.filter(x=>x.accessorKey||x.id).map(x=>x.accessorKey||x.id);let g=`<?xml version="1.0" encoding="UTF-8"?>
18
18
  <data>
@@ -20,12 +20,12 @@ ${m.join(`
20
20
  `,C.forEach(k=>{const N=x[k],D=String(N||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");g+=` <${k}>${D}</${k}>
21
21
  `}),g+=` </row>
22
22
  `}),g+="</data>";const y=new Blob([g],{type:"application/xml"}),j=document.createElement("a");j.href=URL.createObjectURL(y),j.download=`${w||r.filename}.xml`,j.click(),URL.revokeObjectURL(j.href)},[s,r.filename]),d=O.useCallback(async(p,w,C)=>{const g=w||t,y=C||r.filename;if(r.onExport){r.onExport(g,p);return}switch(p.toLowerCase()){case"csv":n(g,y);break;case"json":o(g,y);break;case"xlsx":await i(g,y);break;case"pdf":await l(g,y);break;case"xml":u(g,y);break;default:throw new Error(`Format d'export non supporté: ${p}`)}},[t,r,n,o,i,l,u]),f=O.useCallback(async p=>d(p),[d]),m=O.useCallback(async(p,w)=>d(p,w),[d]);return{exportData:d,exportAll:f,exportSelected:m,supportedFormats:r.formats,isExportSupported:p=>r.formats.includes(p)}}function jl({importConfig:t}){const s=O.useMemo(()=>({accept:".csv,.xlsx,.json,.xml",...t}),[t]),a=O.useCallback((m,p=",")=>{const w=m.split(`
23
- `).filter(y=>y.trim());if(w.length===0)return[];const C=w[0].split(p).map(y=>y.trim().replace(/"/g,""));return w.slice(1).map(y=>{const j=y.split(p).map(v=>v.trim().replace(/"/g,"")),x={};return C.forEach((v,k)=>{x[v]=j[k]||""}),x})},[]),r=O.useCallback(m=>{try{const p=JSON.parse(m);return Array.isArray(p)?p:[p]}catch{throw new Error("Format JSON invalide")}},[]),n=O.useCallback(m=>{try{const C=new DOMParser().parseFromString(m,"text/xml").querySelectorAll("row");return Array.from(C).map(g=>{const y={};return Array.from(g.children).forEach(j=>{y[j.tagName]=j.textContent||""}),y})}catch{throw new Error("Format XML invalide")}},[]),o=O.useCallback(async m=>{try{if(typeof window>"u")throw new Error("XLSX parsing not available in server environment");const p=await import("xlsx"),w=await m.arrayBuffer(),C=p.read(w,{type:"array"}),g=C.SheetNames[0],y=C.Sheets[g],j=p.utils.sheet_to_json(y,{header:1});if(j.length===0)return[];const x=j[0];return j.slice(1).map(v=>{const k={};return x.forEach((N,D)=>{k[N]=v[D]||""}),k})}catch{throw new Error("Erreur lors du parsing du fichier XLSX")}},[]),i=O.useCallback(m=>s.validate?s.validate(m):Array.isArray(m)?m.length===0?{valid:!1,errors:["Aucune donnée trouvée"]}:{valid:!0,errors:[]}:{valid:!1,errors:["Les données doivent être un tableau"]},[s.validate]),l=O.useCallback(m=>s.columnMapping?m.map(p=>{const w={};return Object.entries(s.columnMapping).forEach(([C,g])=>{p[C]!==void 0&&(w[g]=p[C])}),w}):m,[s.columnMapping]),u=O.useCallback(async m=>{const p=m.name.split(".").pop()?.toLowerCase();let w=[];try{const C=await m.text();switch(p){case"csv":w=a(C,s.parseOptions?.csv?.delimiter);break;case"json":w=r(C);break;case"xml":w=n(C);break;case"xlsx":w=await o(m);break;default:throw new Error(`Format de fichier non supporté: ${p}`)}const g=i(w);if(!g.valid)throw new Error(`Données invalides: ${g.errors.join(", ")}`);const y=l(w);return s.onImport&&s.onImport(y),y}catch(C){throw new Error(`Erreur lors de l'import: ${C instanceof Error?C.message:"Erreur inconnue"}`)}},[s,a,r,n,o,i,l]),d=O.useCallback(()=>{const m=document.createElement("input");return m.type="file",m.accept=s.accept,m.multiple=!1,m},[s.accept]),f=O.useCallback(()=>new Promise((m,p)=>{const w=d();w.onchange=async C=>{const g=C.target.files?.[0];if(!g){p(new Error("Aucun fichier sélectionné"));return}try{const y=await u(g);m(y)}catch(y){p(y)}},w.click()}),[d,u]);return{importData:u,importWithUI:f,supportedFormats:s.accept?.split(",")||[],isFormatSupported:m=>{const p=m.split(".").pop()?.toLowerCase();return s.accept?.includes(p||"")||!1}}}function vl({theme:t,variant:s="bordered",density:a="comfortable"}){const r={colors:{primary:"hsl(var(--primary))",secondary:"hsl(var(--secondary))",accent:"hsl(var(--accent))",background:"hsl(var(--background))",surface:"hsl(var(--card))",text:"hsl(var(--foreground))",textSecondary:"hsl(var(--muted-foreground))",border:"hsl(var(--border))",hover:"hsl(var(--muted))",selected:"hsl(var(--accent))",disabled:"hsl(var(--muted))"},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},typography:{fontFamily:"inherit",fontSize:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},fontWeight:{normal:"400",medium:"500",semibold:"600",bold:"700"}},borders:{radius:{sm:"0.25rem",md:"0.5rem",lg:"0.75rem"},width:{thin:"1px",medium:"2px",thick:"4px"}},shadows:{sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)"}},n=O.useMemo(()=>t?{colors:{...r.colors,...t.colors},spacing:{...r.spacing,...t.spacing},typography:{...r.typography,...t.typography},borders:{...r.borders,...t.borders},shadows:{...r.shadows,...t.shadows}}:r,[t,r]),o=O.useMemo(()=>{const f="w-full";switch(s){case"bordered":return`${f} border rounded-lg`;case"minimal":return f;case"striped":return`${f} [&_tbody_tr:nth-child(even)]:bg-muted/50`;case"glass":return`${f} backdrop-blur-sm bg-background/80 border rounded-lg`;default:return f}},[s]),i=O.useMemo(()=>{switch(a){case"spacious":return{table:"text-base",header:"px-6 py-4",cell:"px-6 py-4",row:"h-16"};case"compact":return{table:"text-sm",header:"px-3 py-2",cell:"px-3 py-2",row:"h-8"};case"comfortable":default:return{table:"text-sm",header:"px-4 py-3",cell:"px-4 py-3",row:"h-12"}}},[a]),l=O.useMemo(()=>{const f={};return n.colors&&Object.entries(n.colors).forEach(([m,p])=>{f[`--datatable-color-${m}`]=p}),n.spacing&&Object.entries(n.spacing).forEach(([m,p])=>{f[`--datatable-spacing-${m}`]=p}),n.typography&&(n.typography.fontFamily&&(f["--datatable-font-family"]=n.typography.fontFamily),n.typography.fontSize&&Object.entries(n.typography.fontSize).forEach(([m,p])=>{f[`--datatable-font-size-${m}`]=p}),n.typography.fontWeight&&Object.entries(n.typography.fontWeight).forEach(([m,p])=>{f[`--datatable-font-weight-${m}`]=p})),n.borders&&(n.borders.radius&&Object.entries(n.borders.radius).forEach(([m,p])=>{f[`--datatable-radius-${m}`]=p}),n.borders.width&&Object.entries(n.borders.width).forEach(([m,p])=>{f[`--datatable-border-width-${m}`]=p})),n.shadows&&Object.entries(n.shadows).forEach(([m,p])=>{f[`--datatable-shadow-${m}`]=p}),f},[n]),u=O.useCallback((f,m)=>m?`${f} [--datatable-theme-key:${m}]`:f,[]),d=O.useCallback((f={})=>({...f,...l}),[l]);return{theme:n,variantClasses:o,densityClasses:i,customStyles:l,getThemedClass:u,getThemedStyles:d}}function wx({data:t,columns:s,layout:a="standard",variant:r="bordered",density:n="comfortable",filters:o,filterPosition:i="top",toolbar:l,pagination:u,selection:d=!1,actions:f,i18nNamespace:m,loading:p=!1,error:w,emptyState:C,headerSticky:g=!1,columnVisibilityToggle:y=!0,columnResize:j=!1,columnOrder:x,grouping:v,rowExpansion:k,virtualization:N,sortMode:D="multiple",enableExport:P=!1,enableImport:R=!1,enableReorder:A=!1,enableContextMenu:S=!1,onRowClick:M,onRowDoubleClick:E,onSortingChange:T,onFiltersChange:K,onSelectionChange:q,onColumnOrderChange:B,onExpandedChange:W,onGroupingChange:I,className:z,tableId:$,edit:_,theme:F,performance:H}){const{t:J}=wt.useTranslation(m),Q=c.useRef(null),{layout:ne,setLayout:X,density:Y,setDensity:U,densityClasses:ae}=Or(a,n),{theme:te,variantClasses:Z,densityClasses:le,customStyles:xe,getThemedClass:se,getThemedStyles:de}=vl({theme:F,variant:r,density:Y}),De=c.useMemo(()=>{const ye=[...s];if(d){const ce={id:"select",header:({table:Re})=>e.jsx(Ze,{checked:Re.getIsAllPageRowsSelected(),onCheckedChange:at=>Re.toggleAllPageRowsSelected(!!at),"aria-label":J("datatable.selectAll",{defaultValue:"Select all"})}),cell:({row:Re})=>e.jsx(Ze,{checked:Re.getIsSelected(),onCheckedChange:at=>Re.toggleSelected(!!at),"aria-label":J("datatable.selectRow",{defaultValue:"Select row"})}),enableSorting:!1,enableHiding:!1,size:50};ye.unshift(ce)}if(k?.enabled){const ce={id:"expand",header:()=>null,cell:({row:Re})=>Re.getCanExpand()?e.jsx(L,{variant:"ghost",size:"sm",onClick:()=>Re.toggleExpanded(),className:"h-8 w-8 p-0",children:Re.getIsExpanded()?e.jsx(h.ChevronDown,{className:"h-4 w-4"}):e.jsx(h.ChevronRight,{className:"h-4 w-4"})}):null,enableSorting:!1,enableHiding:!1,size:50};ye.unshift(ce)}if(A){const ce={id:"reorder",header:()=>null,cell:()=>e.jsx(L,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 cursor-move",children:e.jsx(h.GripVertical,{className:"h-4 w-4"})}),enableSorting:!1,enableHiding:!1,size:50};ye.unshift(ce)}return ye},[s,d,k,A,J]);console.log("DataTableAdvanced - props:",{grouping:v,rowExpansion:k,dataLength:t.length});const{table:Ne,sorting:Ke,setSorting:xt,columnFilters:Ye,setColumnFilters:et,columnVisibility:gt,setColumnVisibility:Et,columnOrder:Je,setColumnOrder:G,expanded:ee,setExpanded:re,grouping:we,setGrouping:be,rowSelection:Mt,setRowSelection:ys,globalFilter:Fa,setGlobalFilter:$a,pagination:oa,setPagination:ic,selectedRows:lc,resetFilters:Pt,resetSelection:ns,resetAll:Vt,exportData:ia,getGroupedData:La,getExpandedData:Ia,toggleGrouping:St,clearGrouping:Oa,toggleRowExpansion:bt,expandAll:Ps,collapseAll:jt}=xl({data:t,columns:De,pagination:u,tableId:$,onSortingChange:T,onFiltersChange:K,onSelectionChange:q,onColumnOrderChange:B,onExpandedChange:W,onGroupingChange:I,grouping:v,virtualization:N,sortMode:D,performance:H}),{isVirtualized:Rt,virtualItems:os,totalSize:la,scrollToIndex:fn,scrollToOffset:za}=gl({data:t,virtualization:N,containerRef:Q}),{exportData:ca,exportAll:pn,exportSelected:Rs}=bl({data:t,columns:De,exportConfig:typeof P=="object"?P:void 0}),{importWithUI:Fs,supportedFormats:cc}=jl({importConfig:typeof R=="object"?R:void 0}),[is,vt]=zr(Ne,{onSave:_?.onSave,onCancel:_?.onCancel,autoSave:_?.autoSave,autoSaveDelay:_?.autoSaveDelay});if(_?.editableColumns&&_.editableColumns.length>0){const ye={id:"edit-actions",header:()=>J("datatable.actions",{defaultValue:"Actions"}),cell:({row:ce})=>is.editingRowId===ce.id?e.jsxs("div",{className:"flex gap-1",children:[e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>vt.saveEdit(),disabled:!is.hasChanges,children:J("datatable.save",{defaultValue:"Save"})}),e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>vt.cancelEdit(),children:J("datatable.cancel",{defaultValue:"Cancel"})})]}):e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>vt.startEdit(ce.id,ce.original),children:J("datatable.edit",{defaultValue:"Edit"})}),enableSorting:!1,enableHiding:!1};De.push(ye)}const da=c.useCallback(async ye=>{try{await ca(ye)}catch(ce){console.error("Erreur lors de l'export:",ce)}},[ca]),ua=c.useCallback(async()=>{try{const ye=await Fs();console.log("Données importées:",ye)}catch(ye){console.error("Erreur lors de l'import:",ye)}},[Fs]);if(p)return e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(h.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:J("datatable.loading",{defaultValue:"Loading..."})})]})});if(w)return e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg bg-destructive/10",children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-destructive",children:[e.jsx(h.AlertCircle,{className:"h-8 w-8"}),e.jsx("p",{className:"text-sm font-medium",children:w})]})});if(!t||t.length===0)return e.jsxs("div",{className:"flex flex-col",children:[l&&e.jsx(Qs,{table:Ne,config:l,globalFilter:Fa,onGlobalFilterChange:$a,density:Y,onDensityChange:U,onExport:P?da:void 0,onImport:R?ua:void 0}),e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg",children:C||e.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[e.jsx("p",{className:"text-lg font-medium",children:J("datatable.noData",{defaultValue:"No data"})}),e.jsx("p",{className:"text-sm",children:J("datatable.noDataDescription",{defaultValue:"There are no results to display"})})]})})]});const ma=()=>Rt?e.jsx("div",{ref:Q,className:"h-full overflow-auto",style:{height:N?.containerHeight||600},children:e.jsxs("table",{className:ge("w-full caption-bottom text-sm",le.table),style:de(),children:[e.jsx("thead",{className:ge(g&&"sticky top-0 bg-background z-10"),children:Ne.getHeaderGroups().map(ye=>e.jsx("tr",{className:"border-b",children:ye.headers.map(ce=>e.jsxs("th",{className:ge("text-left font-medium text-muted-foreground",le.header,ce.column.getCanSort()&&"cursor-pointer select-none hover:text-foreground"),onClick:ce.column.getToggleSortingHandler(),style:{width:ce.getSize(),minWidth:ce.column.columnDef.minSize,maxWidth:ce.column.columnDef.maxSize},children:[ce.isPlaceholder?null:Be.flexRender(ce.column.columnDef.header,ce.getContext()),ce.column.getIsSorted()&&e.jsx("span",{className:"ml-2",children:ce.column.getIsSorted()==="asc"?"↑":"↓"})]},ce.id))},ye.id))}),e.jsx("tbody",{children:os.map(ye=>{const Re=(v?.columns?.length?Ne.getGroupedRowModel().rows:k?.enabled?Ne.getExpandedRowModel().rows:Ne.getRowModel().rows)[ye.index];return Re?e.jsx("tr",{className:ge("border-b transition-colors",M&&"cursor-pointer hover:bg-muted/50",Re.getIsSelected()&&"bg-muted"),onClick:()=>M?.(Re.original),onDoubleClick:()=>E?.(Re.original),style:{position:"absolute",top:ye.start,left:0,width:"100%",height:ye.size},children:Re.getVisibleCells().map(at=>{const ls=at.getValue(),Ie=at.column.id,Ue=Re.id,ve=is.editingRowId===Ue,cs=_?.editableColumns?.find(Wt=>Wt.field===Ie);return cs&&ve?e.jsx("td",{className:ge("align-middle",le.cell),children:e.jsx(wa,{value:ls,field:Ie,config:cs.config,isEditing:ve,onChange:Wt=>vt.updateField(Ie,Wt),onStartEdit:()=>vt.startEdit(Ue,Re.original),onSave:()=>vt.saveEdit(),onCancel:()=>vt.cancelEdit()})},at.id):e.jsx("td",{className:ge("align-middle",le.cell),children:Be.flexRender(at.column.columnDef.cell,at.getContext())},at.id)})},Re.id):null})})]})}):e.jsx("div",{className:ge("w-full overflow-auto",Z),children:e.jsxs("table",{className:ge("w-full caption-bottom text-sm",le.table),style:de(),children:[e.jsx("thead",{className:ge(g&&"sticky top-0 bg-background z-10"),children:Ne.getHeaderGroups().map(ye=>e.jsx("tr",{className:"border-b",children:ye.headers.map(ce=>e.jsxs("th",{className:ge("text-left font-medium text-muted-foreground",le.header,ce.column.getCanSort()&&"cursor-pointer select-none hover:text-foreground"),onClick:ce.column.getToggleSortingHandler(),style:{width:ce.getSize(),minWidth:ce.column.columnDef.minSize,maxWidth:ce.column.columnDef.maxSize},children:[ce.isPlaceholder?null:Be.flexRender(ce.column.columnDef.header,ce.getContext()),ce.column.getIsSorted()&&e.jsx("span",{className:"ml-2",children:ce.column.getIsSorted()==="asc"?"↑":"↓"})]},ce.id))},ye.id))}),e.jsx("tbody",{children:(()=>{const ye=v?.columns?.length?Ne.getGroupedRowModel().rows:k?.enabled?Ne.getExpandedRowModel().rows:Ne.getRowModel().rows;return console.log("DataTableAdvanced - rendering rows:",{totalRows:ye.length,grouping:v?.columns,rowExpansion:k?.enabled,firstRow:ye[0]}),ye.map((ce,Re)=>{const at=ce.getIsGrouped(),ls=ce.getIsExpanded();return e.jsxs(c.Fragment,{children:[e.jsx("tr",{className:ge("border-b transition-colors",M&&"cursor-pointer hover:bg-muted/50",ce.getIsSelected()&&"bg-muted",at&&"bg-muted/30 font-medium"),onClick:()=>M?.(ce.original),onDoubleClick:()=>E?.(ce.original),children:ce.getVisibleCells().map(Ie=>{const Ue=Ie.getValue(),ve=Ie.column.id,cs=ce.id,Wt=is.editingRowId===cs,$s=_?.editableColumns?.find(mt=>mt.field===ve);return $s&&Wt?e.jsx("td",{className:ge("align-middle",le.cell),children:e.jsx(wa,{value:Ue,field:ve,config:$s.config,isEditing:Wt,onChange:mt=>vt.updateField(ve,mt),onStartEdit:()=>vt.startEdit(cs,ce.original),onSave:()=>vt.saveEdit(),onCancel:()=>vt.cancelEdit()})},Ie.id):e.jsx("td",{className:ge("align-middle",le.cell),children:at?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:mt=>{mt.stopPropagation(),ce.toggleExpanded()},className:"p-1 hover:bg-muted rounded",children:ls?"▼":"▶"}),e.jsxs("span",{className:"font-medium",children:[Ie.getValue()," (",ce.subRows.length," éléments)"]})]}):Be.flexRender(Ie.column.columnDef.cell,Ie.getContext())},Ie.id)})}),k?.enabled&&ls&&e.jsx("tr",{children:e.jsx("td",{colSpan:De.length,className:"p-0",children:e.jsx("div",{className:"border-b",children:k.renderExpanded?.(ce.original)})})},`${ce.id}-expanded-${Re}`)]},`${ce.id}-${Re}`)})})()})]})});return e.jsxs("div",{className:ge("w-full",z),style:de(),children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[l&&e.jsx("div",{className:"flex-1",children:e.jsx(Qs,{table:Ne,config:l,globalFilter:Fa,onGlobalFilterChange:$a,density:Y,onDensityChange:U,onExport:P?da:void 0,onImport:R?ua:void 0})}),o&&e.jsx(Vr,{table:Ne,filters:o,position:i,onFiltersChange:K})]}),ma(),u&&e.jsx(_r,{table:Ne,pageSizeOptions:u.pageSizeOptions})]})}function yx({header:t,column:s,className:a}){const[r,n]=c.useState(!1),o=c.useCallback(i=>{i.preventDefault(),i.stopPropagation(),n(!0);const l=i.clientX,u=s.getSize(),d=m=>{const p=m.clientX-l,w=Math.max(50,u+p);s.setSize(w)},f=()=>{n(!1),document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",f)};document.addEventListener("mousemove",d),document.addEventListener("mouseup",f)},[s]);return s.getCanResize()?e.jsx("div",{className:ge("absolute right-0 top-0 h-full w-1 cursor-col-resize bg-border opacity-0 hover:opacity-100 transition-opacity",r&&"opacity-100 bg-primary",a),onMouseDown:o,style:{width:"4px",marginRight:"-2px"}}):null}function Nx({row:t,table:s,className:a}){const[r,n]=c.useState(t.getIsExpanded()),o=c.useCallback(()=>{n(!r),t.toggleExpanded()},[r,t]);t.getValue(t.groupingColumnId);const i=t.subRows.length;return e.jsxs("div",{className:ge("flex items-center gap-2 py-2",a),children:[e.jsx(L,{variant:"ghost",size:"sm",onClick:o,className:"h-6 w-6 p-0",children:r?e.jsx(h.ChevronDown,{className:"h-4 w-4"}):e.jsx(h.ChevronRight,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:Be.flexRender(t.groupingColumn.columnDef.cell,t.getGroupingValue())}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",i," ",i===1?"item":"items",")"]})]})]})}function Cx({row:t,table:s,className:a}){const r=t.getAggregationValue();return r?e.jsx("div",{className:ge("flex items-center gap-4 py-2 bg-muted/50",a),children:Object.entries(r).map(([n,o])=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:[n,":"]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:typeof o=="number"?o.toLocaleString():String(o)})]},n))}):null}function kx({table:t,groupingColumns:s,onGroupingChange:a,className:r}){const[n,o]=c.useState(s),i=c.useCallback(u=>{const d=n.includes(u)?n.filter(f=>f!==u):[...n,u];o(d),a(d)},[n,a]),l=c.useCallback(()=>{o([]),a([])},[a]);return e.jsxs("div",{className:ge("flex items-center gap-2",r),children:[e.jsx("span",{className:"text-sm font-medium",children:"Group by:"}),t.getAllColumns().filter(u=>u.getCanGroup()).map(u=>e.jsx(L,{variant:n.includes(u.id)?"default":"outline",size:"sm",onClick:()=>i(u.id),children:u.columnDef.header},u.id)),n.length>0&&e.jsx(L,{variant:"ghost",size:"sm",onClick:l,children:"Clear"})]})}function Sx({row:t,rowIndex:s,actions:a=[],columnActions:r=[],onCopy:n,onExport:o,onEdit:i,onDelete:l,onToggleColumnVisibility:u,visibleColumns:d=[],className:f,children:m}){const[p,w]=c.useState(!1),C=c.useCallback(k=>{k.onClick(t),w(!1)},[t]),g=c.useCallback(()=>{if(n)n(t);else{const k=Object.entries(t).map(([N,D])=>`${N}: ${D}`).join(`
24
- `);navigator.clipboard.writeText(k)}w(!1)},[t,n]),y=c.useCallback(()=>{o&&o(t),w(!1)},[t,o]),j=c.useCallback(()=>{i&&i(t),w(!1)},[t,i]),x=c.useCallback(()=>{l&&l(t),w(!1)},[t,l]),v=c.useCallback(k=>{u&&u(k),w(!1)},[u]);return e.jsxs(Yo,{onOpenChange:w,children:[e.jsx(Jo,{asChild:!0,children:m}),e.jsxs(yr,{className:ge("w-64",f),children:[a.length>0&&e.jsxs(e.Fragment,{children:[a.map(k=>e.jsxs(Ft,{onClick:()=>C(k),disabled:k.disabled,className:ge(k.destructive&&"text-destructive focus:text-destructive"),children:[k.icon&&e.jsx("span",{className:"mr-2",children:k.icon}),k.label]},k.id)),e.jsx(Vs,{})]}),e.jsxs(Ft,{onClick:g,children:[e.jsx(h.Copy,{className:"mr-2 h-4 w-4"}),"Copy row"]}),o&&e.jsxs(Ft,{onClick:y,children:[e.jsx(h.Download,{className:"mr-2 h-4 w-4"}),"Export row"]}),i&&e.jsxs(Ft,{onClick:j,children:[e.jsx(h.Edit,{className:"mr-2 h-4 w-4"}),"Edit row"]}),l&&e.jsxs(Ft,{onClick:x,className:"text-destructive focus:text-destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Delete row"]}),r.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Vs,{}),e.jsx("div",{className:"px-2 py-1.5 text-sm font-semibold text-muted-foreground",children:"Columns"}),r.map(k=>e.jsxs(Ft,{onClick:()=>v(k.id),disabled:k.disabled,children:[k.icon&&e.jsx("span",{className:"mr-2",children:k.icon}),k.label]},k.id))]}),u&&d.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Vs,{}),e.jsx("div",{className:"px-2 py-1.5 text-sm font-semibold text-muted-foreground",children:"Toggle Columns"}),d.map(k=>e.jsxs(Ft,{onClick:()=>v(k),children:[e.jsx(h.Eye,{className:"mr-2 h-4 w-4"}),k]},k))]})]})]})}function Dx({table:t,selectionMode:s="multiple",selectedRows:a,onSelectionChange:r,selectionActions:n=[],className:o}){const[i,l]=c.useState(null);c.useCallback((p,w)=>{if(s==="single"){t.setRowSelection({[p]:w});return}if(s==="range"&&i!==null){const C=Math.min(i,p),g=Math.max(i,p),y={...t.getState().rowSelection};for(let j=C;j<=g;j++)y[j]=w;t.setRowSelection(y)}else t.setRowSelection(C=>({...C,[p]:w}));l(p)},[t,s,i]);const u=c.useCallback(p=>{if(p){const w=t.getRowModel().rows.reduce((C,g,y)=>(C[y]=!0,C),{});t.setRowSelection(w)}else t.setRowSelection({})},[t]);c.useCallback((p,w,C)=>{const g={...t.getState().rowSelection};for(let y=p;y<=w;y++)g[y]=C;t.setRowSelection(g)},[t]),c.useCallback(p=>{const w={...t.getState().rowSelection};t.getRowModel().rows.forEach((C,g)=>{p(C.original)&&(w[g]=!0)}),t.setRowSelection(w)},[t]);const d=c.useCallback(p=>{p.onClick(a)},[a]),f=t.getIsAllPageRowsSelected(),m=t.getIsSomePageRowsSelected();return e.jsxs("div",{className:ge("flex items-center gap-2",o),children:[e.jsx(Ze,{checked:f,onCheckedChange:u,ref:p=>{p&&"indeterminate"in p&&(p.indeterminate=m&&!f)},"aria-label":"Select all rows"}),a.length>0&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsxs("span",{children:[a.length," selected"]}),e.jsx("div",{className:"flex items-center gap-1",children:n.map(p=>e.jsxs(L,{variant:"ghost",size:"sm",onClick:()=>d(p),disabled:p.disabled,className:ge(p.destructive&&"text-destructive hover:text-destructive"),children:[p.icon&&e.jsx("span",{className:"mr-1",children:p.icon}),p.label]},p.id))})]}),e.jsxs(Ve,{onValueChange:p=>{switch(p){case"all":u(!0);break;case"none":u(!1);break;case"invert":t.getRowModel().rows.forEach((w,C)=>{const g=t.getState().rowSelection[C];t.setRowSelection(y=>({...y,[C]:!g}))});break}},children:[e.jsx($e,{className:"w-32",children:e.jsx(We,{placeholder:"Select"})}),e.jsxs(Le,{children:[e.jsx(je,{value:"all",children:"Select All"}),e.jsx(je,{value:"none",children:"Select None"}),e.jsx(je,{value:"invert",children:"Invert Selection"})]})]})]})}function Tx({table:t,selectionMode:s="multiple",onSelectionChange:a}){const[r,n]=c.useState([]);c.useEffect(()=>{const f=t.getFilteredSelectedRowModel().rows.map(m=>m.original);n(f),a?.(f)},[t,a]);const o=c.useCallback((f,m=!0)=>{t.setRowSelection(p=>({...p,[f]:m}))},[t]),i=c.useCallback((f=!0)=>{if(f){const m=t.getRowModel().rows.reduce((p,w,C)=>(p[C]=!0,p),{});t.setRowSelection(m)}else t.setRowSelection({})},[t]),l=c.useCallback((f,m,p=!0)=>{const w={...t.getState().rowSelection};for(let C=f;C<=m;C++)w[C]=p;t.setRowSelection(w)},[t]),u=c.useCallback(f=>{const m={...t.getState().rowSelection};t.getRowModel().rows.forEach((p,w)=>{f(p.original)&&(m[w]=!0)}),t.setRowSelection(m)},[t]),d=c.useCallback(()=>{t.setRowSelection({})},[t]);return{selectedRows:r,selectRow:o,selectAll:i,selectRange:l,selectByCriteria:u,clearSelection:d,isAllSelected:t.getIsAllPageRowsSelected(),isSomeSelected:t.getIsSomePageRowsSelected()}}const Ax=Xe.cva("flex items-center",{variants:{variant:{default:"gap-2 p-3 rounded-lg border bg-card shadow-sm",minimal:"gap-2",pills:"gap-2 p-2 rounded-full border bg-muted/30",inline:"gap-1.5 text-sm",compact:"gap-1.5 p-2 rounded-md bg-muted/50"}},defaultVariants:{variant:"default"}}),Ex=Xe.cva("justify-between gap-2 transition-all",{variants:{variant:{default:"h-9 border-primary/50",minimal:"h-8 border-0 shadow-none hover:bg-accent",pills:"h-8 rounded-full px-4",inline:"h-7 text-sm border-0 shadow-none p-0 hover:bg-transparent hover:underline",compact:"h-7 text-xs px-2"}},defaultVariants:{variant:"default"}}),Mx={partner:h.Building2,network:h.Network,customer:h.Users},Px={partner:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",network:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",customer:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"},qa={partner:"Partenaire",network:"Réseau",customer:"Client"},wl=c.forwardRef(({type:t,items:s,selected:a,isLoading:r,onSelect:n,placeholder:o,emptyText:i,showIcon:l,showBadge:u,variant:d},f)=>{const[m,p]=c.useState(!1),[w,C]=c.useState(""),g=Mx[t],y=c.useMemo(()=>w?s.filter(v=>v.name.toLowerCase().includes(w.toLowerCase())):s,[s,w]),j=v=>{n(v),p(!1),C("")},x=v=>{v.stopPropagation(),n({id:"",name:"",type:t}),C("")};return e.jsxs(rt,{open:m,onOpenChange:p,children:[e.jsx(nt,{asChild:!0,children:e.jsxs(L,{ref:f,variant:d==="inline"?"ghost":"outline",role:"combobox","aria-expanded":m,className:b(Ex({variant:d}),a?.id?"border-primary/50":""),disabled:r||s.length===0,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[l&&g&&e.jsx(g,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:a?.name||o||qa[t]}),u&&a?.id&&e.jsx(Se,{variant:"secondary",className:b("text-xs",Px[t]),children:t})]}),a?.id?e.jsx(h.X,{className:"h-3 w-3 shrink-0 opacity-50 hover:opacity-100",onClick:x}):e.jsx(h.ChevronRight,{className:"h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(st,{className:"w-[300px] p-0",align:"start",children:e.jsxs(ss,{shouldFilter:!1,children:[e.jsxs("div",{className:"flex items-center border-b px-3 py-2 bg-muted/50",children:[e.jsx(h.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(xs,{placeholder:`Rechercher ${qa[t].toLowerCase()}...`,value:w,onValueChange:C,className:"border-0 focus:ring-0"})]}),e.jsxs(ea,{children:[e.jsx(gs,{children:i||`Aucun ${qa[t].toLowerCase()} trouvé`}),e.jsx(Ot,{children:y.map(v=>e.jsx(zt,{value:v.id,onSelect:()=>j(v),className:"cursor-pointer",children:e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[l&&g&&e.jsx(g,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate",children:v.name}),v.metadata?.count!==void 0&&e.jsx(Se,{variant:"secondary",className:"text-xs",children:v.metadata.count})]})},v.id))})]})]})})]})});wl.displayName="AdmincrumbSelector";const yl=c.forwardRef(({levels:t,separator:s,className:a,onLevelChange:r,showIcons:n=!0,showBadges:o=!1,showHome:i=!1,maxWidth:l="100%",variant:u="default",resetable:d=!1,onReset:f},m)=>{const p=g=>y=>{r?.(g,y)},w=t.some(g=>g.selected?.id),C=d&&w&&f;return e.jsxs("nav",{ref:m,"aria-label":"Fil d'Ariane administrateur",className:b("flex items-center gap-2",a),style:{maxWidth:l},children:[e.jsxs("div",{className:b(Ax({variant:u}),"overflow-x-auto"),children:[i&&e.jsxs(e.Fragment,{children:[e.jsx(L,{variant:u==="inline"?"ghost":"outline",size:u==="compact"?"sm":"default",className:b(u==="inline"&&"h-7 px-2",u==="compact"&&"h-7 px-2"),onClick:()=>f?.(),children:e.jsx(h.Home,{className:"h-4 w-4"})}),e.jsx(h.ChevronRight,{className:"h-4 w-4 text-muted-foreground shrink-0","aria-hidden":"true"})]}),e.jsx("ol",{className:"flex items-center gap-2 list-none p-0 m-0",children:t.map((g,y)=>e.jsxs("li",{className:"flex items-center gap-2",children:[y>0&&e.jsx(e.Fragment,{children:s||e.jsx(h.ChevronRight,{className:b("text-muted-foreground shrink-0",u==="compact"||u==="inline"?"h-3 w-3":"h-4 w-4"),"aria-hidden":"true"})}),e.jsx(wl,{...g,onSelect:p(y),showIcon:n,showBadge:o,variant:u||"default"})]},`${g.type}-${y}`))}),C&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-6 bg-border mx-1","aria-hidden":"true"}),e.jsxs(L,{variant:"ghost",size:u==="compact"?"sm":"default",onClick:f,className:b("gap-2",u==="compact"&&"h-7 px-2 text-xs"),children:[e.jsx(h.X,{className:"h-3 w-3"}),"Réinitialiser"]})]})]}),w&&!C&&e.jsxs(Se,{variant:"secondary",className:"gap-1",children:[e.jsx(h.Filter,{className:"h-3 w-3"}),"Filtré"]})]})});yl.displayName="WakaAdmincrumb";function Rx(){const[t,s]=c.useState(),[a,r]=c.useState(),[n,o]=c.useState(),i=c.useCallback((u,d)=>{u===0?(s(d.id?d:void 0),r(void 0),o(void 0)):u===1?(r(d.id?d:void 0),o(void 0)):u===2&&o(d.id?d:void 0)},[]),l=c.useCallback(()=>{s(void 0),r(void 0),o(void 0)},[]);return{partner:t,network:a,customer:n,handleLevelChange:i,reset:l}}const Wr=c.forwardRef(({options:t,value:s,onChange:a,onSearch:r,multiple:n=!1,creatable:o=!1,onCreate:i,placeholder:l="Sélectionner...",emptyMessage:u="Aucun résultat.",loading:d=!1,disabled:f=!1,error:m,className:p,label:w,description:C,maxSelections:g,sortOptions:y=!1,searchDebounce:j=300},x)=>{const[v,k]=c.useState(!1),[N,D]=c.useState(""),[P,R]=c.useState(t),[A,S]=c.useState(!1),M=c.useRef();c.useEffect(()=>{r||R(t)},[t,r]);const E=c.useMemo(()=>s?Array.isArray(s)?s:[s]:[],[s]);c.useEffect(()=>{if(r){if(M.current&&clearTimeout(M.current),!N.trim()){R(t);return}return M.current=setTimeout(async()=>{S(!0);try{const _=await r(N);R(_)}catch{R([])}finally{S(!1)}},j),()=>{M.current&&clearTimeout(M.current)}}},[N,r,j,t]);const T=c.useMemo(()=>{let _=P;if(!r&&N.trim()){const F=N.toLowerCase();_=P.filter(H=>H.label.toLowerCase().includes(F)||H.value.toLowerCase().includes(F))}return y&&(_=[..._].sort((F,H)=>F.label.localeCompare(H.label))),_},[P,N,r,y]),K=c.useMemo(()=>{const _={_ungrouped:[]};for(const F of T){const H=F.group||"_ungrouped";_[H]||(_[H]=[]),_[H].push(F)}return _},[T]),q=o&&N.trim()&&!P.some(_=>_.value.toLowerCase()===N.toLowerCase()),B=_=>{if(n){const F=E.includes(_)?E.filter(H=>H!==_):g&&E.length>=g?E:[...E,_];a?.(F.length>0?F:null)}else a?.(_===s?null:_),k(!1);D("")},W=()=>{if(!N.trim())return;const _={value:N.trim(),label:N.trim()};R(F=>[...F,_]),B(_.value),i?.(_.value)},I=(_,F)=>{F.stopPropagation();const H=E.filter(J=>J!==_);a?.(H.length>0?H:null)},z=_=>P.find(H=>H.value===_)?.label||_,$=A||d;return e.jsxs("div",{className:b("space-y-1.5",p),children:[w&&e.jsx(me,{children:w}),C&&e.jsx("p",{className:"text-sm text-muted-foreground",children:C}),e.jsxs(rt,{open:v,onOpenChange:k,children:[e.jsx(nt,{asChild:!0,children:e.jsxs(L,{ref:x,variant:"outline",role:"combobox","aria-expanded":v,disabled:f,className:b("w-full justify-between font-normal",!s&&"text-muted-foreground",m&&"border-destructive"),children:[n?e.jsx("div",{className:"flex flex-wrap gap-1 flex-1 min-w-0",children:E.length>0?E.map(_=>e.jsxs(Se,{variant:"secondary",className:"text-xs",children:[z(_),e.jsx("button",{className:"ml-1 hover:text-destructive",onClick:F=>I(_,F),children:e.jsx(h.X,{className:"h-3 w-3"})})]},_)):e.jsx("span",{children:l})}):e.jsx("span",{className:"truncate",children:s?z(s):l}),$?e.jsx(h.Loader2,{className:"ml-2 h-4 w-4 shrink-0 animate-spin"}):e.jsx(h.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(st,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(ss,{shouldFilter:!1,children:[e.jsx(xs,{placeholder:"Rechercher...",value:N,onValueChange:D}),e.jsxs(ea,{children:[$&&e.jsxs("div",{className:"py-6 text-center text-sm",children:[e.jsx(h.Loader2,{className:"h-4 w-4 animate-spin mx-auto mb-2"}),"Chargement..."]}),!$&&T.length===0&&!q&&e.jsx(gs,{children:u}),q&&e.jsx(Ot,{children:e.jsxs(zt,{onSelect:W,className:"cursor-pointer",children:[e.jsx(h.Plus,{className:"mr-2 h-4 w-4"}),'Créer "',N,'"']})}),Object.entries(K).map(([_,F])=>F.length===0?null:e.jsx(Ot,{heading:_!=="_ungrouped"?_:void 0,children:F.map(H=>e.jsxs(zt,{value:H.value,onSelect:()=>B(H.value),disabled:H.disabled,className:"cursor-pointer",children:[e.jsx(h.Check,{className:b("mr-2 h-4 w-4",E.includes(H.value)?"opacity-100":"opacity-0")}),H.label]},H.value))},_))]})]})})]}),m&&e.jsx("p",{className:"text-sm text-destructive",children:m})]})});Wr.displayName="WakaAutocomplete";const Nl=c.forwardRef((t,s)=>e.jsx(Wr,{ref:s,...t}));Nl.displayName="WakaAutocompleteForm";const Kn={" ":"11011001100","!":"11001101100",'"':"11001100110","#":"10010011000",$:"10010001100","%":"10001001100","&":"10011001000","'":"10011000100","(":"10001100100",")":"11001001000","*":"11001000100","+":"11000100100",",":"10110011100","-":"10011011100",".":"10011001110","/":"10111001100",0:"10011101100",1:"10011100110",2:"11001110010",3:"11001011100",4:"11001001110",5:"11011100100",6:"11001110100",7:"11101101110",8:"11101001100",9:"11100101100",":":"11100100110",";":"11101100100","<":"11100110100","=":"11100110010",">":"11011011000","?":"11011000110","@":"11000110110",A:"10100011000",B:"10001011000",C:"10001000110",D:"10110001000",E:"10001101000",F:"10001100010",G:"11010001000",H:"11000101000",I:"11000100010",J:"10110111000",K:"10110001110",L:"10001101110",M:"10111011000",N:"10111000110",O:"10001110110",P:"11101110110",Q:"11010001110",R:"11000101110",S:"11011101000",T:"11011100010",U:"11011101110",V:"11101011000",W:"11101000110",X:"11100010110",Y:"11101101000",Z:"11101100010"},Yn="11010000100",Fx="1100011101011";function Ha(t){let s=Yn;for(const a of t.toUpperCase()){const r=Kn[a];r?s+=r:s+=Kn["?"]}return s+=Yn,s+=Fx,s}const Ga={0:"101001101101",1:"110100101011",2:"101100101011",3:"110110010101",4:"101001101011",5:"110100110101",6:"101100110101",7:"101001011011",8:"110100101101",9:"101100101101",A:"110101001011",B:"101101001011",C:"110110100101",D:"101011001011",E:"110101100101",F:"101101100101",G:"101010011011",H:"110101001101",I:"101101001101",J:"101011001101",K:"110101010011",L:"101101010011",M:"110110101001",N:"101011010011",O:"110101101001",P:"101101101001",Q:"101010110011",R:"110101011001",S:"101101011001",T:"101011011001",U:"110010101011",V:"100110101011",W:"110011010101",X:"100101101011",Y:"110010110101",Z:"100110110101","-":"100101011011",".":"110010101101"," ":"100110101101","*":"100101101101"};function $x(t){let s=Ga["*"]+"0";for(const a of t.toUpperCase()){const r=Ga[a];r&&(s+=r+"0")}return s+=Ga["*"],s}function Lx(t,s){switch(s){case"CODE128":return Ha(t);case"CODE39":return $x(t);case"EAN13":case"EAN8":case"UPC":case"ITF14":return Ha(t);default:return Ha(t)}}function Ix({value:t,format:s="CODE128",width:a=200,height:r=80,displayValue:n=!0,lineColor:o="#000000",background:i="#FFFFFF",fontSize:l=14,margin:u=10,showActions:d=!1,className:f}){const m=c.useRef(null),[p,w]=c.useState(!1);c.useEffect(()=>{const y=m.current;if(!y||!t)return;const j=y.getContext("2d");if(!j)return;const x=Lx(t,s),v=n?l+4:0,k=r-v-u*2,N=(a-u*2)/x.length;j.fillStyle=i,j.fillRect(0,0,a,r),j.fillStyle=o;for(let D=0;D<x.length;D++)x[D]==="1"&&j.fillRect(u+D*N,u,N,k);n&&(j.fillStyle=o,j.font=`${l}px monospace`,j.textAlign="center",j.textBaseline="bottom",j.fillText(t,a/2,r-u+2))},[t,s,a,r,n,o,i,l,u]);const C=()=>{const y=m.current;if(!y)return;const j=document.createElement("a");j.download=`barcode-${t}-${Date.now()}.png`,j.href=y.toDataURL("image/png"),j.click()},g=async()=>{const y=m.current;if(y)try{const j=await new Promise(x=>{y.toBlob(v=>{v&&x(v)},"image/png")});await navigator.clipboard.write([new ClipboardItem({"image/png":j})]),w(!0),setTimeout(()=>w(!1),2e3)}catch(j){console.error("Failed to copy barcode:",j)}};return e.jsxs("div",{className:b("inline-flex flex-col items-center gap-2",f),children:[e.jsx("canvas",{ref:m,width:a,height:r,className:"rounded border",style:{width:a,height:r}}),d&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(L,{variant:"outline",size:"sm",onClick:C,children:[e.jsx(h.Download,{className:"h-4 w-4 mr-1"}),"Télécharger"]}),e.jsxs(L,{variant:"outline",size:"sm",onClick:g,children:[p?e.jsx(h.Check,{className:"h-4 w-4 mr-1"}):e.jsx(h.Copy,{className:"h-4 w-4 mr-1"}),p?"Copié":"Copier"]})]})]})}function Jn({item:t,index:s,isLast:a,size:r,variant:n,showHomeIcon:o,renderLink:i,onItemClick:l}){const u={sm:"text-xs py-0.5 px-1.5",md:"text-sm py-1 px-2",lg:"text-base py-1.5 px-3"},d={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},f={default:a?"text-foreground font-medium":"text-muted-foreground hover:text-foreground",ghost:a?"text-foreground font-medium bg-muted rounded-md":"text-muted-foreground hover:text-foreground hover:bg-muted rounded-md",outline:a?"text-foreground font-medium border rounded-md":"text-muted-foreground hover:text-foreground hover:border-foreground border border-transparent rounded-md"},m=e.jsxs("span",{className:"flex items-center gap-1.5",children:[s===0&&o&&!t.icon&&e.jsx(h.Home,{className:d[r]}),t.icon&&e.jsx("span",{className:d[r],children:t.icon}),e.jsx("span",{className:"truncate max-w-[150px]",children:t.label})]}),p=b("inline-flex items-center transition-colors",u[r],f[n],t.disabled&&"opacity-50 pointer-events-none"),w=C=>{l&&(C.preventDefault(),l(t,s))};return a||!t.href?e.jsx("span",{className:b(p,"cursor-default"),"aria-current":a?"page":void 0,children:m}):i?i(t,e.jsx("span",{className:p,onClick:w,children:m})):e.jsx("a",{href:t.href,className:p,onClick:w,children:m})}function Ox({items:t,startIndex:s,size:a,renderLink:r,onItemClick:n}){const o={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"};return e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex items-center justify-center p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors","aria-label":"Afficher les éléments masqués",children:e.jsx(h.MoreHorizontal,{className:o[a]})})}),e.jsx(_e,{align:"start",children:t.map((i,l)=>{const u=s+l,d=()=>{n?.(i,u)};return r&&i.href?e.jsx(pe,{asChild:!0,children:r(i,e.jsxs("span",{className:"flex items-center gap-2 w-full",children:[i.icon,i.label]}))},u):e.jsxs(pe,{onClick:d,disabled:i.disabled,children:[i.icon&&e.jsx("span",{className:"mr-2",children:i.icon}),i.label]},u)})})]})}function zx({items:t,separator:s,showHomeIcon:a=!1,maxItems:r,renderLink:n,onItemClick:o,size:i="md",variant:l="default",className:u}){const d={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},f=e.jsx(h.ChevronRight,{className:b(d[i],"text-muted-foreground")}),m=()=>s??f,p=r&&t.length>r;let w,C=[],g=0;if(p&&r){const y=Math.max(r-2,1);w=[t[0],...t.slice(-y)],C=t.slice(1,-y),g=1}else w=t;return e.jsx("nav",{"aria-label":"Fil d'Ariane",className:b("flex items-center",u),children:e.jsxs("ol",{className:"flex items-center flex-wrap gap-1",children:[w.length>0&&e.jsx("li",{className:"flex items-center",children:e.jsx(Jn,{item:w[0],index:0,isLast:w.length===1&&!p,size:i,variant:l,showHomeIcon:a,renderLink:n,onItemClick:o})}),p&&C.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("li",{className:"flex items-center","aria-hidden":"true",children:m()}),e.jsx("li",{className:"flex items-center",children:e.jsx(Ox,{items:C,startIndex:g,size:i,renderLink:n,onItemClick:o})})]}),w.slice(1).map((y,j)=>{const x=p?t.length-(w.length-1-j):j+1;return e.jsxs(c.Fragment,{children:[e.jsx("li",{className:"flex items-center","aria-hidden":"true",children:m()}),e.jsx("li",{className:"flex items-center",children:e.jsx(Jn,{item:y,index:x,isLast:x===t.length-1,size:i,variant:l,showHomeIcon:!1,renderLink:n,onItemClick:o})})]},x)})]})})}function _x(t,s){const{homeLabel:a="Accueil",labelMap:r={},excludePaths:n=[]}=s||{};return c.useMemo(()=>{const i=t.split("/").filter(Boolean).filter(d=>!n.includes(d)),l=[{label:a,href:"/"}];let u="";return i.forEach(d=>{u+=`/${d}`;const f=r[d]||d.charAt(0).toUpperCase()+d.slice(1).replace(/-/g," ");l.push({label:f,href:u})}),l},[t,a,r,n])}const Vx=({images:t,autoplay:s=!1,autoplayInterval:a=3e3,showIndicators:r=!0,showNavigation:n=!0,showThumbnails:o=!1,showFullscreen:i=!1,showDownload:l=!1,showShare:u=!1,showCounter:d=!1,showProgress:f=!1,transition:m="fade",layout:p="default",theme:w="auto",aspectRatio:C="16/9",maxHeight:g,className:y,imageClassName:j,indicatorClassName:x,navigationClassName:v,thumbnailClassName:k,overlayClassName:N,counterClassName:D,progressClassName:P,onImageChange:R,onImageClick:A,onFullscreenToggle:S,onDownload:M,onShare:E,onPlayPause:T,onThumbnailClick:K,onIndicatorClick:q,onNavigationClick:B,onKeyboardNavigation:W,onTouchStart:I,onTouchEnd:z,onSwipeLeft:$,onSwipeRight:_,onSwipeUp:F,onSwipeDown:H,onLoadStart:J,onLoadEnd:Q,onError:ne,onReady:X,onDestroy:Y,loop:U=!0,pauseOnHover:ae=!0,pauseOnFocus:te=!0,pauseOnTouch:Z=!0,keyboardNavigation:le=!0,touchNavigation:xe=!0,swipeThreshold:se=50,animationDuration:de=300,preloadImages:De=!0,lazyLoading:Ne=!0,imageQuality:Ke="auto",placeholder:xt,errorImage:Ye,loadingSpinner:et,emptyState:gt,customControls:Et,customOverlay:Je,customThumbnails:G,customIndicators:ee,customNavigation:re,ariaLabel:we="Carrousel d'images",ariaLabelledBy:be,ariaDescribedBy:Mt,role:ys="region",virtualScrolling:Fa=!1,maxVisibleThumbnails:$a=10,thumbnailSize:oa="medium",overlayOpacity:ic=.7,overlayGradient:lc,navigationSize:Pt="medium",indicatorSize:ns="medium",indicatorShape:Vt="circle",thumbnailAspectRatio:ia="1/1",onMount:La,onUnmount:Ia,onBeforeChange:St,onAfterChange:Oa})=>{const[bt,Ps]=O.useState(0),[jt,Rt]=O.useState(s),[os,la]=O.useState(!1),[fn,za]=O.useState(!1),[ca,pn]=O.useState(!1),[Rs,Fs]=O.useState(null),[cc,is]=O.useState(null),[vt,da]=O.useState(new Set),[ua,ma]=O.useState(0),ye=O.useRef(null),ce=O.useRef(null),Re=O.useRef([]),at=O.useRef(null),ls=O.useRef(0),Ie=t&&t.length>0,Ue=Math.max(0,Math.min(bt,t.length-1)),ve=Ie?t[Ue]:null,cs=O.useMemo(()=>{switch(C){case"16/9":return"aspect-video";case"4/3":return"aspect-[4/3]";case"1/1":return"aspect-square";case"3/2":return"aspect-[3/2]";default:return"aspect-video"}},[C]),Wt=O.useMemo(()=>w==="auto"?"":w==="dark"?"dark":"light",[w]),$s=O.useCallback(()=>{ye.current&&clearInterval(ye.current),jt&&Ie&&t.length>1&&(ye.current=setInterval(()=>{Ps(ie=>U?(ie+1)%t.length:Math.min(ie+1,t.length-1))},a))},[jt,Ie,t.length,a,U]),mt=O.useCallback(()=>{ye.current&&(clearInterval(ye.current),ye.current=null)},[]),xn=O.useCallback(()=>{if(!jt||!s)return;const ie=Date.now(),Ce=()=>{const Ns=(Date.now()-ie)/a*100;ma(Math.min(Ns,100)),Ns<100&&requestAnimationFrame(Ce)};requestAnimationFrame(Ce)},[jt,s,a]);O.useEffect(()=>(jt?($s(),xn()):(mt(),ma(0)),()=>mt()),[jt,$s,mt,xn]);const Ls=O.useCallback(()=>{if(!Ie)return;const ie=U?(bt-1+t.length)%t.length:Math.max(bt-1,0);St&&!St(bt,ie)||(Ps(ie),B?.("prev"))},[Ie,bt,t.length,U,St,B]),Is=O.useCallback(()=>{if(!Ie)return;const ie=U?(bt+1)%t.length:Math.min(bt+1,t.length-1);St&&!St(bt,ie)||(Ps(ie),B?.("next"))},[Ie,bt,t.length,U,St,B]),gn=O.useCallback(ie=>{!Ie||ie<0||ie>=t.length||St&&!St(bt,ie)||(Ps(ie),q?.(ie))},[Ie,bt,t.length,St,q]),dc=O.useCallback(ie=>{if(!le)return;const Ce=ie.key;switch(W?.(Ce),Ce){case"ArrowLeft":ie.preventDefault(),Ls();break;case"ArrowRight":ie.preventDefault(),Is();break;case"ArrowUp":ie.preventDefault(),F?.();break;case"ArrowDown":ie.preventDefault(),H?.();break;case" ":ie.preventDefault(),Rt(ht=>!ht),T?.(!jt);break;case"Escape":os&&(la(!1),S?.(!1));break;case"f":case"F":i&&la(ht=>(S?.(!ht),!ht));break}},[le,Ls,Is,W,F,H,jt,T,os,i,S]),uc=O.useCallback(ie=>{if(!xe)return;const Ce=ie.touches[0];Fs({x:Ce.clientX,y:Ce.clientY}),ls.current=Date.now(),I?.(ie),Z&&Rt(!1)},[xe,I,Z]),mc=O.useCallback(ie=>{if(!xe||!Rs)return;const Ce=ie.changedTouches[0];is({x:Ce.clientX,y:Ce.clientY}),z?.(ie);const ht=Ce.clientX-Rs.x,Ns=Ce.clientY-Rs.y;Date.now()-ls.current,Math.abs(ht)>Math.abs(Ns)&&Math.abs(ht)>se?ht>0?(_?.(),Ls()):($?.(),Is()):Math.abs(Ns)>se&&(Ns>0?H?.():F?.()),Fs(null),is(null)},[xe,Rs,z,se,_,$,H,F,Ls,Is]),hc=O.useCallback(ie=>{da(Ce=>new Set([...Ce,ie])),za(!1),Q?.(ie)},[Q]),fc=O.useCallback((ie,Ce)=>{pn(!0),za(!1),ne?.(ie,Ce)},[ne]);O.useEffect(()=>{ve&&(R?.(Ue,ve),Oa?.(Ue))},[Ue,ve,R,Oa]);const pc=O.useCallback(()=>{ve&&A?.(ve,Ue)},[ve,Ue,A]),Ut=O.useCallback(ie=>{ie.stopPropagation()},[]),xc=O.useCallback(()=>{la(ie=>(S?.(!ie),!ie))},[S]),gc=O.useCallback(()=>{ve&&M?.(ve,Ue)},[ve,Ue,M]),bc=O.useCallback(()=>{ve&&E?.(ve,Ue)},[ve,Ue,E]),jc=O.useCallback(()=>{ae&&Rt(!1)},[ae]),vc=O.useCallback(()=>{ae&&s&&Rt(!0)},[ae,s]),wc=O.useCallback(()=>{te&&Rt(!1)},[te]),yc=O.useCallback(()=>{te&&s&&Rt(!0)},[te,s]);if(O.useEffect(()=>(La?.(),X?.(),()=>{Ia?.(),Y?.(),mt()}),[La,X,Ia,Y,mt]),O.useEffect(()=>()=>mt(),[mt]),!Ie)return e.jsx("div",{className:b("flex items-center justify-center h-64 bg-gray-100 rounded-lg",y),children:gt||e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-gray-500 mb-2",children:"Aucune image à afficher"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Ajoutez des images pour commencer"})]})});const Nc=b("waka-carousel relative w-full mx-auto bg-black rounded-lg overflow-hidden","focus:outline-none focus:ring-2 focus:ring-blue-500",os&&"fixed inset-0 z-50 rounded-none",Wt,y),Cc=b("relative",cs,j),kc=b("absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-4",N);return e.jsxs("div",{ref:ce,className:Nc,style:{maxHeight:g},tabIndex:0,onKeyDown:dc,onTouchStart:uc,onTouchEnd:mc,onMouseEnter:jc,onMouseLeave:vc,onFocus:wc,onBlur:yc,role:ys,"aria-label":we,"aria-labelledby":be,"aria-describedby":Mt,children:[e.jsxs("div",{className:Cc,children:[fn&&et&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 z-20",children:et}),ca&&Ye?e.jsx("img",{src:Ye,alt:"Erreur de chargement",className:b("w-full h-full object-cover",j)}):ve?e.jsx("img",{ref:ie=>Re.current[Ue]=ie,src:ve.src,alt:ve.alt,className:b("w-full h-full object-cover transition-opacity duration-300",j),onClick:pc,loading:Ne?"lazy":"eager",onLoad:()=>hc(Ue),onError:ie=>fc(Ue,new Error("Erreur de chargement de l'image"))}):null,ve&&(ve.title||ve.description||ve.caption)&&e.jsxs("div",{className:kc,children:[ve.title&&e.jsx("h3",{className:"text-white text-lg font-semibold mb-1",children:ve.title}),ve.description&&e.jsx("p",{className:"text-white/90 text-sm mb-2",children:ve.description}),ve.caption&&e.jsx("p",{className:"text-white/80 text-xs",children:ve.caption})]}),Et&&e.jsx("div",{className:"absolute inset-0 z-10",children:Et}),Je&&e.jsx("div",{className:"absolute inset-0 z-10",children:Je}),n&&t.length>1&&e.jsx(e.Fragment,{children:re?e.jsx("div",{className:"absolute inset-0 z-10",children:re}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:ie=>{Ut(ie),Ls()},className:b("absolute left-2 top-1/2 -translate-y-1/2 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white",Pt==="small"&&"p-1",Pt==="large"&&"p-3",v),"aria-label":"Image précédente",children:e.jsx(h.ChevronLeft,{className:b("w-5 h-5",Pt==="small"&&"w-4 h-4",Pt==="large"&&"w-6 h-6")})}),e.jsx("button",{onClick:ie=>{Ut(ie),Is()},className:b("absolute right-2 top-1/2 -translate-y-1/2 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white",Pt==="small"&&"p-1",Pt==="large"&&"p-3",v),"aria-label":"Image suivante",children:e.jsx(h.ChevronRight,{className:b("w-5 h-5",Pt==="small"&&"w-4 h-4",Pt==="large"&&"w-6 h-6")})})]})}),s&&t.length>1&&e.jsx("button",{onClick:ie=>{Ut(ie),Rt(Ce=>(T?.(!Ce),!Ce))},className:b("absolute top-2 right-2 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white"),"aria-label":jt?"Pause":"Lecture",children:jt?e.jsx(h.Pause,{className:"w-4 h-4"}):e.jsx(h.Play,{className:"w-4 h-4"})}),i&&e.jsx("button",{onClick:ie=>{Ut(ie),xc()},className:b("absolute top-2 left-2 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white"),"aria-label":os?"Quitter le plein écran":"Plein écran",children:os?e.jsx(h.X,{className:"w-4 h-4"}):e.jsx(h.Maximize2,{className:"w-4 h-4"})}),l&&ve?.downloadUrl&&e.jsx("button",{onClick:ie=>{Ut(ie),gc()},className:b("absolute top-2 right-12 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white"),"aria-label":"Télécharger l'image",children:e.jsx(h.Download,{className:"w-4 h-4"})}),u&&ve?.shareUrl&&e.jsx("button",{onClick:ie=>{Ut(ie),bc()},className:b("absolute top-2 right-20 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white"),"aria-label":"Partager l'image",children:e.jsx(h.Share2,{className:"w-4 h-4"})}),d&&e.jsxs("div",{className:b("absolute top-2 left-1/2 -translate-x-1/2 z-10","bg-black/50 text-white px-3 py-1 rounded-full text-sm",D),children:[Ue+1," / ",t.length]}),f&&jt&&e.jsx("div",{className:b("absolute bottom-0 left-0 right-0 h-1 bg-black/30",P),children:e.jsx("div",{ref:at,className:"h-full bg-white transition-all duration-100",style:{width:`${ua}%`}})})]}),r&&t.length>1&&e.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 flex space-x-2",children:ee?e.jsx("div",{className:"flex space-x-2",children:ee}):t.map((ie,Ce)=>e.jsx("button",{onClick:ht=>{Ut(ht),gn(Ce)},className:b("transition-all duration-200","focus:outline-none focus:ring-2 focus:ring-white",Vt==="circle"&&"rounded-full",Vt==="square"&&"rounded",Vt==="diamond"&&"rotate-45",Vt==="line"&&"rounded-none",ns==="small"&&"w-2 h-2",ns==="medium"&&"w-3 h-3",ns==="large"&&"w-4 h-4",Vt==="line"&&ns==="small"&&"w-8 h-1",Vt==="line"&&ns==="medium"&&"w-12 h-1",Vt==="line"&&ns==="large"&&"w-16 h-1",Ce===Ue?"bg-white":"bg-white/50 hover:bg-white/70",x),"aria-label":`Aller à l'image ${Ce+1}`},Ce))}),o&&t.length>1&&e.jsx("div",{className:"flex space-x-2 p-4 bg-gray-100 overflow-x-auto",children:G?e.jsx("div",{className:"flex space-x-2",children:G}):t.map((ie,Ce)=>e.jsx("button",{onClick:ht=>{Ut(ht),gn(Ce),K?.(Ce)},className:b("flex-shrink-0 rounded overflow-hidden","border-2 transition-all duration-200","focus:outline-none focus:ring-2 focus:ring-blue-500",oa==="small"&&"w-12 h-12",oa==="medium"&&"w-16 h-16",oa==="large"&&"w-20 h-20",ia==="1/1"&&"aspect-square",ia==="4/3"&&"aspect-[4/3]",ia==="16/9"&&"aspect-video",Ce===Ue?"border-blue-500":"border-gray-300 hover:border-gray-400",k),children:e.jsx("img",{src:ie.src,alt:ie.alt,className:"w-full h-full object-cover",loading:"lazy"})},Ce))})]})};function Ur(){const[t,s]=O.useState(null),[a,r]=O.useState(!0),[n,o]=O.useState(null);return O.useEffect(()=>{let i=!0;return(async()=>{try{const u=await import("recharts");i&&(s({ResponsiveContainer:u.ResponsiveContainer,BarChart:u.BarChart,LineChart:u.LineChart,AreaChart:u.AreaChart,PieChart:u.PieChart,Bar:u.Bar,Line:u.Line,Area:u.Area,Pie:u.Pie,Cell:u.Cell,XAxis:u.XAxis,YAxis:u.YAxis,CartesianGrid:u.CartesianGrid,Tooltip:u.Tooltip,Legend:u.Legend,defs:"defs",linearGradient:"linearGradient",stop:"stop"}),r(!1))}catch(u){i&&(o(u instanceof Error?u:new Error("Failed to load Recharts")),r(!1))}})(),()=>{i=!1}},[]),{components:t,loading:a,error:n,isAvailable:!a&&!n&&t!==null}}const Wx=["hsl(var(--chart-1, 220 70% 50%))","hsl(var(--chart-2, 160 60% 45%))","hsl(var(--chart-3, 30 80% 55%))","hsl(var(--chart-4, 280 65% 60%))","hsl(var(--chart-5, 340 75% 55%))"],Bt={colors:Wx,gridColor:"hsl(var(--border, 220 13% 91%))",axisColor:"hsl(var(--muted-foreground, 220 9% 46%))",textColor:"hsl(var(--foreground, 224 71% 4%))",tooltipBackground:"hsl(var(--popover, 0 0% 100%))",tooltipText:"hsl(var(--popover-foreground, 224 71% 4%))",tooltipBorder:"hsl(var(--border, 220 13% 91%))",fontFamily:"inherit"};function As(t,s="default"){const a=O.useMemo(()=>({colors:t?.colors??Bt.colors,gridColor:t?.gridColor??Bt.gridColor,axisColor:t?.axisColor??Bt.axisColor,textColor:t?.textColor??Bt.textColor,tooltipBackground:t?.tooltipBackground??Bt.tooltipBackground,tooltipText:t?.tooltipText??Bt.tooltipText,tooltipBorder:t?.tooltipBorder??Bt.tooltipBorder,fontFamily:t?.fontFamily??Bt.fontFamily}),[t]),r=O.useMemo(()=>i=>a.colors[i%a.colors.length],[a.colors]),n=O.useMemo(()=>({contentStyle:{backgroundColor:a.tooltipBackground,color:a.tooltipText,border:`1px solid ${a.tooltipBorder}`,borderRadius:"var(--radius, 0.5rem)",padding:"8px 12px",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",fontFamily:a.fontFamily},wrapperStyle:{outline:"none"},itemStyle:{color:a.tooltipText,padding:"2px 0"},labelStyle:{color:a.textColor,fontWeight:600,marginBottom:"4px"}}),[a]),o=O.useMemo(()=>{const i="relative";switch(s){case"gradient":return`${i} bg-gradient-to-br from-background to-muted/20`;case"outline":return`${i} border border-border rounded-lg p-4`;case"glass":return`${i} bg-background/50 backdrop-blur-sm border border-border/50 rounded-lg p-4`;default:return i}},[s]);return{theme:a,getColor:r,tooltipStyles:n,containerClasses:o}}const Ux={sm:{width:"100%",height:150},md:{width:"100%",height:250},lg:{width:"100%",height:350},xl:{width:"100%",height:450},auto:{width:"100%",height:300}},Es=c.forwardRef(({children:t,variant:s="default",size:a="md",height:r,width:n,theme:o,className:i,style:l,title:u,description:d,loading:f,error:m,responsive:p=!0},w)=>{const{components:C,loading:g,error:y,isAvailable:j}=Ur(),{containerClasses:x}=As(o,s),v=f||g,k=m||(y?"Recharts non disponible. Installez recharts pour utiliser les graphiques.":null),N=Ux[a],D=n??N.width,P=r??N.height;if(v)return e.jsxs("div",{ref:w,className:b(x,i),style:l,children:[u&&e.jsx(Xa,{title:u,description:d}),e.jsx(qi,{className:"w-full",style:{height:P}})]});if(k||!j)return e.jsxs("div",{ref:w,className:b(x,i),style:l,children:[u&&e.jsx(Xa,{title:u,description:d}),e.jsx("div",{className:"flex items-center justify-center text-muted-foreground text-sm border border-dashed border-border rounded-lg",style:{height:P},children:e.jsxs("div",{className:"text-center p-4",children:[e.jsx("p",{children:k||"Graphique non disponible"}),e.jsx("p",{className:"text-xs mt-1",children:"Installez recharts: pnpm add recharts"})]})})]});const{ResponsiveContainer:R}=C;return e.jsxs("div",{ref:w,className:b(x,i),style:l,children:[u&&e.jsx(Xa,{title:u,description:d}),p?e.jsx(R,{width:D,height:P,children:t(C)}):e.jsx("div",{style:{width:D,height:P},children:t(C)})]})});Es.displayName="WakaChart";function Xa({title:t,description:s}){return e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:t}),s&&e.jsx("p",{className:"text-sm text-muted-foreground",children:s})]})}const Cl=c.forwardRef(({data:t,dataKeys:s,series:a,variant:r="default",size:n="md",height:o,width:i,animation:l=!0,animationDuration:u=500,grid:d=!0,tooltip:f=!0,legend:m,axis:p,theme:w,className:C,style:g,title:y,description:j,loading:x,error:v,onClick:k,responsive:N=!0,layout:D="vertical",stacked:P=!1,radius:R=4,barSize:A,barGap:S=4,barCategoryGap:M="20%"},E)=>{const{theme:T,getColor:K,tooltipStyles:q}=As(w,r),B=c.useMemo(()=>{if(a&&a.length>0)return a;if(s&&s.length>0)return s.map(($,_)=>({dataKey:$,label:$,color:K(_)}));if(t.length>0&&"value"in t[0])return[{dataKey:"value",label:"Value",color:K(0)}];const z=t[0];return z?Object.keys(z).filter($=>$!=="name"&&typeof z[$]=="number").map(($,_)=>({dataKey:$,label:$,color:K(_)})):[]},[a,s,t,K]),W=c.useMemo(()=>m?typeof m=="boolean"?{enabled:m,position:"bottom",align:"center"}:m:null,[m]),I=c.useMemo(()=>f?typeof f=="boolean"?{enabled:f}:f:null,[f]);return e.jsx(Es,{ref:E,variant:r,size:n,height:o,width:i,theme:w,className:C,style:g,title:y,description:j,loading:x,error:v,responsive:N,children:z=>{if(!z)return null;const{BarChart:$,Bar:_,XAxis:F,YAxis:H,CartesianGrid:J,Tooltip:Q,Legend:ne}=z;return e.jsxs($,{data:t,layout:D==="horizontal"?"vertical":"horizontal",barGap:S,barCategoryGap:M,children:[d&&e.jsx(J,{strokeDasharray:"3 3",stroke:T.gridColor,horizontal:!0,vertical:!1}),p?.showXAxis!==!1&&e.jsx(F,{dataKey:"name",axisLine:{stroke:T.axisColor},tickLine:{stroke:T.axisColor},tick:{fill:T.textColor,fontSize:12},tickFormatter:p?.xAxisFormatter}),p?.showYAxis!==!1&&e.jsx(H,{axisLine:{stroke:T.axisColor},tickLine:{stroke:T.axisColor},tick:{fill:T.textColor,fontSize:12},tickFormatter:p?.yAxisFormatter,domain:p?.yAxisDomain,unit:p?.yAxisUnit}),I?.enabled!==!1&&f&&e.jsx(Q,{...q,formatter:I&&typeof I!="boolean"&&I.formatter?(X,Y)=>I.formatter(X,Y,t[0]):X=>{const Y=I&&typeof I!="boolean"&&I.valuePrefix||"",U=I&&typeof I!="boolean"&&I.valueSuffix||"";return`${Y}${X}${U}`}}),W?.enabled&&e.jsx(ne,{align:W.align,verticalAlign:W.position==="top"?"top":"bottom",wrapperStyle:{paddingTop:W.position==="bottom"?16:0}}),B.map((X,Y)=>e.jsx(_,{dataKey:X.dataKey,name:X.label,fill:X.color||K(Y),radius:R,stackId:P?"stack":void 0,barSize:A,animationDuration:u,isAnimationActive:l},X.dataKey))]})}})});Cl.displayName="WakaBarChart";const kl=c.forwardRef(({data:t,dataKeys:s,series:a,variant:r="default",size:n="md",height:o,width:i,animation:l=!0,animationDuration:u=500,grid:d=!0,tooltip:f=!0,legend:m,axis:p,theme:w,className:C,style:g,title:y,description:j,loading:x,error:v,onClick:k,responsive:N=!0,curve:D="monotone",dots:P=!0,dotSize:R=4,activeDot:A=!0,strokeWidth:S=2},M)=>{const{theme:E,getColor:T,tooltipStyles:K}=As(w,r),q=c.useMemo(()=>{if(a&&a.length>0)return a;if(s&&s.length>0)return s.map((z,$)=>({dataKey:z,label:z,color:T($),strokeWidth:S}));if(t.length>0&&"value"in t[0])return[{dataKey:"value",label:"Value",color:T(0),strokeWidth:S}];const I=t[0];return I?Object.keys(I).filter(z=>z!=="name"&&typeof I[z]=="number").map((z,$)=>({dataKey:z,label:z,color:T($),strokeWidth:S})):[]},[a,s,t,T,S]),B=c.useMemo(()=>m?typeof m=="boolean"?{enabled:m,position:"bottom",align:"center"}:m:null,[m]),W=c.useMemo(()=>f?typeof f=="boolean"?{enabled:f}:f:null,[f]);return e.jsx(Es,{ref:M,variant:r,size:n,height:o,width:i,theme:w,className:C,style:g,title:y,description:j,loading:x,error:v,responsive:N,children:I=>{if(!I)return null;const{LineChart:z,Line:$,XAxis:_,YAxis:F,CartesianGrid:H,Tooltip:J,Legend:Q}=I;return e.jsxs(z,{data:t,children:[d&&e.jsx(H,{strokeDasharray:"3 3",stroke:E.gridColor,horizontal:!0,vertical:!1}),p?.showXAxis!==!1&&e.jsx(_,{dataKey:"name",axisLine:{stroke:E.axisColor},tickLine:{stroke:E.axisColor},tick:{fill:E.textColor,fontSize:12},tickFormatter:p?.xAxisFormatter}),p?.showYAxis!==!1&&e.jsx(F,{axisLine:{stroke:E.axisColor},tickLine:{stroke:E.axisColor},tick:{fill:E.textColor,fontSize:12},tickFormatter:p?.yAxisFormatter,domain:p?.yAxisDomain,unit:p?.yAxisUnit}),W?.enabled!==!1&&f&&e.jsx(J,{...K,formatter:W&&typeof W!="boolean"&&W.formatter?(ne,X)=>W.formatter(ne,X,t[0]):ne=>{const X=W&&typeof W!="boolean"&&W.valuePrefix||"",Y=W&&typeof W!="boolean"&&W.valueSuffix||"";return`${X}${ne}${Y}`}}),B?.enabled&&e.jsx(Q,{align:B.align,verticalAlign:B.position==="top"?"top":"bottom",wrapperStyle:{paddingTop:B.position==="bottom"?16:0}}),q.map((ne,X)=>e.jsx($,{dataKey:ne.dataKey,name:ne.label,stroke:ne.color||T(X),strokeWidth:ne.strokeWidth||S,strokeDasharray:ne.strokeDasharray,type:D,dot:P?{r:R,fill:ne.color||T(X)}:!1,activeDot:A?{r:R+2}:!1,animationDuration:u,isAnimationActive:l},ne.dataKey))]})}})});kl.displayName="WakaLineChart";const Sl=c.forwardRef(({data:t,dataKeys:s,series:a,variant:r="default",size:n="md",height:o,width:i,animation:l=!0,animationDuration:u=500,grid:d=!0,tooltip:f=!0,legend:m,axis:p,theme:w,className:C,style:g,title:y,description:j,loading:x,error:v,onClick:k,responsive:N=!0,curve:D="monotone",dots:P=!1,dotSize:R=4,activeDot:A=!0,strokeWidth:S=2,stacked:M=!1,fillOpacity:E=.3,gradientDirection:T="vertical"},K)=>{const{theme:q,getColor:B,tooltipStyles:W}=As(w,r),I=c.useMemo(()=>{if(a&&a.length>0)return a;if(s&&s.length>0)return s.map((F,H)=>({dataKey:F,label:F,color:B(H),strokeWidth:S,fillOpacity:E}));if(t.length>0&&"value"in t[0])return[{dataKey:"value",label:"Value",color:B(0),strokeWidth:S,fillOpacity:E}];const _=t[0];return _?Object.keys(_).filter(F=>F!=="name"&&typeof _[F]=="number").map((F,H)=>({dataKey:F,label:F,color:B(H),strokeWidth:S,fillOpacity:E})):[]},[a,s,t,B,S,E]),z=c.useMemo(()=>m?typeof m=="boolean"?{enabled:m,position:"bottom",align:"center"}:m:null,[m]),$=c.useMemo(()=>f?typeof f=="boolean"?{enabled:f}:f:null,[f]);return e.jsx(Es,{ref:K,variant:r,size:n,height:o,width:i,theme:w,className:C,style:g,title:y,description:j,loading:x,error:v,responsive:N,children:_=>{if(!_)return null;const{AreaChart:F,Area:H,XAxis:J,YAxis:Q,CartesianGrid:ne,Tooltip:X,Legend:Y}=_;return e.jsxs(F,{data:t,children:[e.jsx("defs",{children:I.map((U,ae)=>{const te=U.color||B(ae),Z=`gradient-${U.dataKey}-${ae}`;return e.jsxs("linearGradient",{id:Z,x1:"0",y1:"0",x2:T==="horizontal"?"1":"0",y2:T==="horizontal"?"0":"1",children:[e.jsx("stop",{offset:"5%",stopColor:te,stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:te,stopOpacity:.1})]},Z)})}),d&&e.jsx(ne,{strokeDasharray:"3 3",stroke:q.gridColor,horizontal:!0,vertical:!1}),p?.showXAxis!==!1&&e.jsx(J,{dataKey:"name",axisLine:{stroke:q.axisColor},tickLine:{stroke:q.axisColor},tick:{fill:q.textColor,fontSize:12},tickFormatter:p?.xAxisFormatter}),p?.showYAxis!==!1&&e.jsx(Q,{axisLine:{stroke:q.axisColor},tickLine:{stroke:q.axisColor},tick:{fill:q.textColor,fontSize:12},tickFormatter:p?.yAxisFormatter,domain:p?.yAxisDomain,unit:p?.yAxisUnit}),$?.enabled!==!1&&f&&e.jsx(X,{...W,formatter:$&&typeof $!="boolean"&&$.formatter?(U,ae)=>$.formatter(U,ae,t[0]):U=>{const ae=$&&typeof $!="boolean"&&$.valuePrefix||"",te=$&&typeof $!="boolean"&&$.valueSuffix||"";return`${ae}${U}${te}`}}),z?.enabled&&e.jsx(Y,{align:z.align,verticalAlign:z.position==="top"?"top":"bottom",wrapperStyle:{paddingTop:z.position==="bottom"?16:0}}),I.map((U,ae)=>{const te=U.color||B(ae),Z=`gradient-${U.dataKey}-${ae}`;return e.jsx(H,{dataKey:U.dataKey,name:U.label,stroke:te,strokeWidth:U.strokeWidth||S,fill:`url(#${Z})`,fillOpacity:U.fillOpacity??E,type:D,dot:P?{r:R,fill:te}:!1,stackId:M?"stack":void 0,animationDuration:u,isAnimationActive:l},U.dataKey)})]})}})});Sl.displayName="WakaAreaChart";const Dl=c.forwardRef(({data:t,variant:s="default",size:a="md",height:r,width:n,animation:o=!0,animationDuration:i=500,tooltip:l=!0,legend:u=!0,theme:d,className:f,style:m,title:p,description:w,loading:C,error:g,onClick:y,responsive:j=!0,dataKey:x="value",nameKey:v="name",innerRadius:k=0,outerRadius:N="80%",startAngle:D=90,endAngle:P=-270,paddingAngle:R=2,label:A=!1,labelPosition:S="outside"},M)=>{const{theme:E,getColor:T,tooltipStyles:K}=As(d,s),q=c.useMemo(()=>u?typeof u=="boolean"?{enabled:u,position:"bottom",align:"center"}:u:null,[u]),B=c.useMemo(()=>l?typeof l=="boolean"?{enabled:l}:l:null,[l]),W=c.useCallback(I=>{if(!A)return null;const z=Math.PI/180,$=S==="inside"?I.innerRadius+(I.outerRadius-I.innerRadius)*.5:I.outerRadius*1.1,_=I.cx+$*Math.cos(-I.midAngle*z),F=I.cy+$*Math.sin(-I.midAngle*z);let H="";return A==="percent"?H=`${(I.percent*100).toFixed(0)}%`:A==="value"?H=String(I.value):A==="name"?H=I.name:H=`${(I.percent*100).toFixed(0)}%`,e.jsx("text",{x:_,y:F,fill:S==="inside"?"#fff":E.textColor,textAnchor:_>I.cx?"start":"end",dominantBaseline:"central",fontSize:12,children:H})},[A,S,E.textColor]);return e.jsx(Es,{ref:M,variant:s,size:a,height:r,width:n,theme:d,className:f,style:m,title:p,description:w,loading:C,error:g,responsive:j,children:I=>{if(!I)return null;const{PieChart:z,Pie:$,Cell:_,Tooltip:F,Legend:H}=I;return e.jsxs(z,{children:[B?.enabled!==!1&&l&&e.jsx(F,{...K,formatter:B&&typeof B!="boolean"&&B.formatter?(J,Q)=>B.formatter(J,Q,t[0]):J=>{const Q=B&&typeof B!="boolean"&&B.valuePrefix||"",ne=B&&typeof B!="boolean"&&B.valueSuffix||"";return`${Q}${J}${ne}`}}),q?.enabled&&e.jsx(H,{align:q.align,verticalAlign:q.position==="top"?"top":"bottom",layout:q.position==="left"||q.position==="right"?"vertical":"horizontal",wrapperStyle:{paddingTop:q.position==="bottom"?16:0}}),e.jsx($,{data:t,dataKey:x,nameKey:v,cx:"50%",cy:"50%",innerRadius:k,outerRadius:N,startAngle:D,endAngle:P,paddingAngle:R,animationDuration:i,isAnimationActive:o,label:A?W:!1,labelLine:A&&S==="outside",children:t.map((J,Q)=>e.jsx(_,{fill:T(Q),stroke:"transparent"},`cell-${Q}`))})]})}})});Dl.displayName="WakaPieChart";const Br=c.forwardRef(({data:t,type:s="line",width:a=100,height:r=30,color:n="hsl(var(--chart-1))",fillColor:o,fillOpacity:i=.3,showMinMax:l=!1,showValue:u=!1,className:d,animation:f=!0},m)=>{const{components:p,loading:w,isAvailable:C}=Ur(),g=c.useMemo(()=>t.map((S,M)=>({index:M,value:S})),[t]),{min:y,max:j,current:x}=c.useMemo(()=>{const S=t.filter(M=>typeof M=="number"&&!isNaN(M));return{min:Math.min(...S),max:Math.max(...S),current:S[S.length-1]}},[t]);if(w)return e.jsx("div",{ref:m,className:b("inline-flex items-center gap-2",d),children:e.jsx("div",{className:"bg-muted animate-pulse rounded",style:{width:a,height:r}})});if(!C||!p)return e.jsxs("div",{ref:m,className:b("inline-flex items-center gap-2",d),children:[e.jsx(Bx,{data:t,width:a,height:r,color:n,type:s,fillColor:o,fillOpacity:i}),u&&e.jsx("span",{className:"text-sm font-medium",children:x})]});const{ResponsiveContainer:v,LineChart:k,BarChart:N,AreaChart:D,Line:P,Bar:R,Area:A}=p;return e.jsxs("div",{ref:m,className:b("inline-flex items-center gap-2",d),children:[e.jsx("div",{style:{width:a,height:r},children:e.jsx(v,{width:"100%",height:"100%",children:s==="bar"?e.jsx(N,{data:g,children:e.jsx(R,{dataKey:"value",fill:n,radius:1,isAnimationActive:f})}):s==="area"?e.jsxs(D,{data:g,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`sparkline-gradient-${n.replace(/[^a-z0-9]/gi,"")}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:o||n,stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:o||n,stopOpacity:.1})]})}),e.jsx(A,{type:"monotone",dataKey:"value",stroke:n,fill:`url(#sparkline-gradient-${n.replace(/[^a-z0-9]/gi,"")})`,fillOpacity:i,strokeWidth:1.5,dot:!1,isAnimationActive:f})]}):e.jsx(k,{data:g,children:e.jsx(P,{type:"monotone",dataKey:"value",stroke:n,strokeWidth:1.5,dot:!1,isAnimationActive:f})})})}),l&&e.jsxs("div",{className:"flex flex-col text-xs text-muted-foreground",children:[e.jsxs("span",{children:["↑ ",j]}),e.jsxs("span",{children:["↓ ",y]})]}),u&&e.jsx("span",{className:"text-sm font-medium",children:x})]})});Br.displayName="WakaSparkline";function Bx({data:t,width:s,height:a,color:r,type:n,fillColor:o,fillOpacity:i}){const u=s-4,d=a-4,f=Math.min(...t),p=Math.max(...t)-f||1,w=t.map((g,y)=>{const j=2+y/(t.length-1||1)*u,x=2+d-(g-f)/p*d;return{x:j,y:x,value:g}});if(n==="bar"){const g=u/t.length-1;return e.jsx("svg",{width:s,height:a,children:t.map((y,j)=>{const x=(y-f)/p*d;return e.jsx("rect",{x:2+j*(g+1),y:2+d-x,width:g,height:x,fill:r,rx:1},j)})})}const C=w.map((g,y)=>`${y===0?"M":"L"} ${g.x} ${g.y}`).join(" ");if(n==="area"){const g=`${C} L ${w[w.length-1].x} ${a-2} L 2 ${a-2} Z`;return e.jsxs("svg",{width:s,height:a,children:[e.jsx("path",{d:g,fill:o||r,fillOpacity:i}),e.jsx("path",{d:C,fill:"none",stroke:r,strokeWidth:1.5})]})}return e.jsx("svg",{width:s,height:a,children:e.jsx("path",{d:C,fill:"none",stroke:r,strokeWidth:1.5})})}const Tl=c.forwardRef(({data:t,type:s="sparkline",width:a=80,height:r=24,color:n,showTrend:o=!0,valueFormatter:i,className:l},u)=>{const d=c.useMemo(()=>!t||t.length===0?[]:typeof t[0]=="number"?t:t.map(C=>{const g=C.value??Object.values(C).find(y=>typeof y=="number");return typeof g=="number"?g:0}),[t]),{trend:f,trendPercent:m,currentValue:p}=c.useMemo(()=>{if(d.length<2)return{trend:"neutral",trendPercent:0,currentValue:d[0]??0};const C=d[0],g=d[d.length-1],y=g-C,j=C!==0?y/C*100:0;return{trend:y>0?"up":y<0?"down":"neutral",trendPercent:j,currentValue:g}},[d]),w=c.useMemo(()=>n||(f==="up"?"hsl(var(--chart-2, 142 76% 36%))":f==="down"?"hsl(var(--destructive, 0 84% 60%))":"hsl(var(--muted-foreground, 220 9% 46%))"),[n,f]);return d.length===0?e.jsx("div",{ref:u,className:b("flex items-center gap-1 text-muted-foreground",l),children:e.jsx(h.Minus,{className:"h-3 w-3"})}):(i?i(p):p.toLocaleString(),e.jsxs("div",{ref:u,className:b("flex items-center gap-2",l),children:[e.jsx(Br,{data:d,type:s==="sparkline"?"line":s,width:a,height:r,color:w,animation:!1}),o&&e.jsxs("div",{className:"flex items-center gap-1",children:[f==="up"&&e.jsx(h.TrendingUp,{className:"h-3 w-3 text-green-600 dark:text-green-400"}),f==="down"&&e.jsx(h.TrendingDown,{className:"h-3 w-3 text-red-600 dark:text-red-400"}),f==="neutral"&&e.jsx(h.Minus,{className:"h-3 w-3 text-muted-foreground"}),e.jsxs("span",{className:b("text-xs font-medium",f==="up"&&"text-green-600 dark:text-green-400",f==="down"&&"text-red-600 dark:text-red-400",f==="neutral"&&"text-muted-foreground"),children:[f!=="neutral"&&(m>0?"+":""),m.toFixed(1),"%"]})]})]}))});Tl.displayName="WakaMiniChart";function qx(t){const{accessorKey:s,header:a=String(s),chartType:r="sparkline",width:n=100,height:o=24,color:i,showValue:l=!1,valueFormatter:u}=t;return{accessorKey:s,header:a,size:n+(l?60:0),enableSorting:!1,enableColumnFilter:!1,cell:d=>{const f=d.getValue();let m=[];return Array.isArray(f)&&(typeof f[0]=="number"?m=f:typeof f[0]=="object"&&f[0]!==null&&(m=f.map(p=>{const w=p.value??Object.values(p).find(C=>typeof C=="number");return typeof w=="number"?w:0}))),{type:"chart",chartType:r,data:m,width:n,height:o,color:i,showTrend:!0,valueFormatter:u}},meta:{isChartColumn:!0,chartConfig:t}}}const Hx={cell:t=>{if(!Array.isArray(t))return null;let s=[];return typeof t[0]=="number"?s=t:typeof t[0]=="object"&&t[0]!==null&&(s=t.map(a=>{const r=a.value??Object.values(a).find(n=>typeof n=="number");return typeof r=="number"?r:0})),{type:"sparkline",data:s}},size:100,enableSorting:!1,enableFiltering:!1},Gx=["hsl(var(--chart-1))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))"],Xx={sm:{width:"100%",height:150},md:{width:"100%",height:250},lg:{width:"100%",height:350},xl:{width:"100%",height:450},auto:{width:"100%",height:300}},Kx=["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#10b981","#14b8a6","#06b6d4","#0ea5e9","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e","#000000","#6b7280","#ffffff"];function Al(t,s,a){s/=100,a/=100;const r=s*Math.min(a,1-a),n=o=>{const i=(o+t/30)%12;return a-r*Math.max(Math.min(i-3,9-i,1),-1)};return[Math.round(n(0)*255),Math.round(n(8)*255),Math.round(n(4)*255)]}function _s(t,s,a){t/=255,s/=255,a/=255;const r=Math.max(t,s,a),n=Math.min(t,s,a);let o=0,i=0;const l=(r+n)/2;if(r!==n){const u=r-n;switch(i=l>.5?u/(2-r-n):u/(r+n),r){case t:o=((s-a)/u+(s<a?6:0))*60;break;case s:o=((a-t)/u+2)*60;break;case a:o=((t-s)/u+4)*60;break}}return[Math.round(o),Math.round(i*100),Math.round(l*100)]}function Yx(t){const s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return s?[parseInt(s[1],16),parseInt(s[2],16),parseInt(s[3],16)]:null}function Qn(t,s,a){return"#"+[t,s,a].map(r=>r.toString(16).padStart(2,"0")).join("")}function ha(t){if(t.startsWith("#"))return Yx(t);const s=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(s)return[parseInt(s[1]),parseInt(s[2]),parseInt(s[3])];const a=t.match(/hsl\((\d+),\s*(\d+)%?,\s*(\d+)%?\)/);return a?Al(parseInt(a[1]),parseInt(a[2]),parseInt(a[3])):null}function Zn(t,s,a,r){switch(r){case"hex":return Qn(t,s,a);case"rgb":return`rgb(${t}, ${s}, ${a})`;case"hsl":{const[n,o,i]=_s(t,s,a);return`hsl(${n}, ${o}%, ${i}%)`}default:return Qn(t,s,a)}}const qr=c.forwardRef(({value:t="#3b82f6",onChange:s,format:a="hex",showAlpha:r=!1,showPresets:n=!0,presets:o=Kx,showEyeDropper:i=!0,disabled:l=!1,placeholder:u="Sélectionner une couleur",className:d,size:f="md"},m)=>{const[p,w]=c.useState(!1),[C,g]=c.useState(0),[y,j]=c.useState(100),[x,v]=c.useState(50),[k,N]=c.useState(t),D=c.useRef(null),P=c.useRef(null);c.useEffect(()=>{const q=ha(t);if(q){const[B,W,I]=_s(...q);g(B),j(W),v(I),N(t)}},[t]);const R=c.useCallback((q,B,W)=>{const[I,z,$]=Al(q,B,W),_=Zn(I,z,$,a);N(_),s?.(_)},[a,s]),A=q=>{q.preventDefault();const B=D.current?.getBoundingClientRect();if(!B)return;const W=($,_)=>{const F=Math.max(0,Math.min(100,($-B.left)/B.width*100)),H=Math.max(0,Math.min(100,100-(_-B.top)/B.height*100));j(F),v(H),R(C,F,H)};W(q.clientX,q.clientY);const I=$=>W($.clientX,$.clientY),z=()=>{document.removeEventListener("mousemove",I),document.removeEventListener("mouseup",z)};document.addEventListener("mousemove",I),document.addEventListener("mouseup",z)},S=q=>{q.preventDefault();const B=P.current?.getBoundingClientRect();if(!B)return;const W=$=>{const _=Math.max(0,Math.min(360,($-B.left)/B.width*360));g(_),R(_,y,x)};W(q.clientX);const I=$=>W($.clientX),z=()=>{document.removeEventListener("mousemove",I),document.removeEventListener("mouseup",z)};document.addEventListener("mousemove",I),document.addEventListener("mouseup",z)},M=async()=>{if("EyeDropper"in window)try{const B=await new window.EyeDropper().open(),W=ha(B.sRGBHex);if(W){const[I,z,$]=_s(...W);g(I),j(z),v($),R(I,z,$)}}catch{}},E=q=>{const B=q.target.value;N(B);const W=ha(B);if(W){const[I,z,$]=_s(...W);g(I),j(z),v($),s?.(Zn(...W,a))}},T={sm:"h-7 w-7",md:"h-9 w-9",lg:"h-11 w-11"},K=i&&typeof window<"u"&&"EyeDropper"in window;return e.jsxs(rt,{open:p,onOpenChange:w,children:[e.jsx(nt,{asChild:!0,children:e.jsx(L,{ref:m,variant:"outline",disabled:l,className:b("p-0.5 rounded-md border",T[f],d),title:u,children:e.jsx("div",{className:"w-full h-full rounded",style:{backgroundColor:t}})})}),e.jsx(st,{className:"w-64 p-3",align:"start",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{ref:D,className:"relative w-full h-36 rounded cursor-crosshair",style:{background:`
23
+ `).filter(y=>y.trim());if(w.length===0)return[];const C=w[0].split(p).map(y=>y.trim().replace(/"/g,""));return w.slice(1).map(y=>{const j=y.split(p).map(v=>v.trim().replace(/"/g,"")),x={};return C.forEach((v,k)=>{x[v]=j[k]||""}),x})},[]),r=O.useCallback(m=>{try{const p=JSON.parse(m);return Array.isArray(p)?p:[p]}catch{throw new Error("Format JSON invalide")}},[]),n=O.useCallback(m=>{try{const C=new DOMParser().parseFromString(m,"text/xml").querySelectorAll("row");return Array.from(C).map(g=>{const y={};return Array.from(g.children).forEach(j=>{y[j.tagName]=j.textContent||""}),y})}catch{throw new Error("Format XML invalide")}},[]),o=O.useCallback(async m=>{try{if(typeof window>"u")throw new Error("XLSX parsing not available in server environment");const p=await import("xlsx"),w=await m.arrayBuffer(),C=p.read(w,{type:"array"}),g=C.SheetNames[0],y=C.Sheets[g],j=p.utils.sheet_to_json(y,{header:1});if(j.length===0)return[];const x=j[0];return j.slice(1).map(v=>{const k={};return x.forEach((N,D)=>{k[N]=v[D]||""}),k})}catch{throw new Error("Erreur lors du parsing du fichier XLSX")}},[]),i=O.useCallback(m=>s.validate?s.validate(m):Array.isArray(m)?m.length===0?{valid:!1,errors:["Aucune donnée trouvée"]}:{valid:!0,errors:[]}:{valid:!1,errors:["Les données doivent être un tableau"]},[s.validate]),l=O.useCallback(m=>s.columnMapping?m.map(p=>{const w={};return Object.entries(s.columnMapping).forEach(([C,g])=>{p[C]!==void 0&&(w[g]=p[C])}),w}):m,[s.columnMapping]),u=O.useCallback(async m=>{const p=m.name.split(".").pop()?.toLowerCase();let w=[];try{const C=await m.text();switch(p){case"csv":w=a(C,s.parseOptions?.csv?.delimiter);break;case"json":w=r(C);break;case"xml":w=n(C);break;case"xlsx":w=await o(m);break;default:throw new Error(`Format de fichier non supporté: ${p}`)}const g=i(w);if(!g.valid)throw new Error(`Données invalides: ${g.errors.join(", ")}`);const y=l(w);return s.onImport&&s.onImport(y),y}catch(C){throw new Error(`Erreur lors de l'import: ${C instanceof Error?C.message:"Erreur inconnue"}`)}},[s,a,r,n,o,i,l]),d=O.useCallback(()=>{const m=document.createElement("input");return m.type="file",m.accept=s.accept,m.multiple=!1,m},[s.accept]),f=O.useCallback(()=>new Promise((m,p)=>{const w=d();w.onchange=async C=>{const g=C.target.files?.[0];if(!g){p(new Error("Aucun fichier sélectionné"));return}try{const y=await u(g);m(y)}catch(y){p(y)}},w.click()}),[d,u]);return{importData:u,importWithUI:f,supportedFormats:s.accept?.split(",")||[],isFormatSupported:m=>{const p=m.split(".").pop()?.toLowerCase();return s.accept?.includes(p||"")||!1}}}function vl({theme:t,variant:s="bordered",density:a="comfortable"}){const r={colors:{primary:"hsl(var(--primary))",secondary:"hsl(var(--secondary))",accent:"hsl(var(--accent))",background:"hsl(var(--background))",surface:"hsl(var(--card))",text:"hsl(var(--foreground))",textSecondary:"hsl(var(--muted-foreground))",border:"hsl(var(--border))",hover:"hsl(var(--muted))",selected:"hsl(var(--accent))",disabled:"hsl(var(--muted))"},spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},typography:{fontFamily:"inherit",fontSize:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},fontWeight:{normal:"400",medium:"500",semibold:"600",bold:"700"}},borders:{radius:{sm:"0.25rem",md:"0.5rem",lg:"0.75rem"},width:{thin:"1px",medium:"2px",thick:"4px"}},shadows:{sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1)",xl:"0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1)"}},n=O.useMemo(()=>t?{colors:{...r.colors,...t.colors},spacing:{...r.spacing,...t.spacing},typography:{...r.typography,...t.typography},borders:{...r.borders,...t.borders},shadows:{...r.shadows,...t.shadows}}:r,[t,r]),o=O.useMemo(()=>{const f="w-full";switch(s){case"bordered":return`${f} border rounded-lg`;case"minimal":return f;case"striped":return`${f} [&_tbody_tr:nth-child(even)]:bg-muted/50`;case"glass":return`${f} backdrop-blur-sm bg-background/80 border rounded-lg`;default:return f}},[s]),i=O.useMemo(()=>{switch(a){case"spacious":return{table:"text-base",header:"px-6 py-4",cell:"px-6 py-4",row:"h-16"};case"compact":return{table:"text-sm",header:"px-3 py-2",cell:"px-3 py-2",row:"h-8"};case"comfortable":default:return{table:"text-sm",header:"px-4 py-3",cell:"px-4 py-3",row:"h-12"}}},[a]),l=O.useMemo(()=>{const f={};return n.colors&&Object.entries(n.colors).forEach(([m,p])=>{f[`--datatable-color-${m}`]=p}),n.spacing&&Object.entries(n.spacing).forEach(([m,p])=>{f[`--datatable-spacing-${m}`]=p}),n.typography&&(n.typography.fontFamily&&(f["--datatable-font-family"]=n.typography.fontFamily),n.typography.fontSize&&Object.entries(n.typography.fontSize).forEach(([m,p])=>{f[`--datatable-font-size-${m}`]=p}),n.typography.fontWeight&&Object.entries(n.typography.fontWeight).forEach(([m,p])=>{f[`--datatable-font-weight-${m}`]=p})),n.borders&&(n.borders.radius&&Object.entries(n.borders.radius).forEach(([m,p])=>{f[`--datatable-radius-${m}`]=p}),n.borders.width&&Object.entries(n.borders.width).forEach(([m,p])=>{f[`--datatable-border-width-${m}`]=p})),n.shadows&&Object.entries(n.shadows).forEach(([m,p])=>{f[`--datatable-shadow-${m}`]=p}),f},[n]),u=O.useCallback((f,m)=>m?`${f} [--datatable-theme-key:${m}]`:f,[]),d=O.useCallback((f={})=>({...f,...l}),[l]);return{theme:n,variantClasses:o,densityClasses:i,customStyles:l,getThemedClass:u,getThemedStyles:d}}function wx({data:t,columns:s,layout:a="standard",variant:r="bordered",density:n="comfortable",filters:o,filterPosition:i="top",toolbar:l,pagination:u,selection:d=!1,actions:f,i18nNamespace:m,loading:p=!1,error:w,emptyState:C,headerSticky:g=!1,columnVisibilityToggle:y=!0,columnResize:j=!1,columnOrder:x,grouping:v,rowExpansion:k,virtualization:N,sortMode:D="multiple",enableExport:P=!1,enableImport:R=!1,enableReorder:A=!1,enableContextMenu:S=!1,onRowClick:M,onRowDoubleClick:E,onSortingChange:T,onFiltersChange:K,onSelectionChange:q,onColumnOrderChange:B,onExpandedChange:W,onGroupingChange:I,className:z,tableId:$,edit:_,theme:F,performance:H}){const{t:J}=wt.useTranslation(m),Q=c.useRef(null),{layout:ne,setLayout:X,density:Y,setDensity:U,densityClasses:ae}=Wr(a,n),{theme:te,variantClasses:Z,densityClasses:le,customStyles:xe,getThemedClass:se,getThemedStyles:de}=vl({theme:F,variant:r,density:Y}),De=c.useMemo(()=>{const ye=[...s];if(d){const ce={id:"select",header:({table:Re})=>e.jsx(Ze,{checked:Re.getIsAllPageRowsSelected(),onCheckedChange:at=>Re.toggleAllPageRowsSelected(!!at),"aria-label":J("datatable.selectAll",{defaultValue:"Select all"})}),cell:({row:Re})=>e.jsx(Ze,{checked:Re.getIsSelected(),onCheckedChange:at=>Re.toggleSelected(!!at),"aria-label":J("datatable.selectRow",{defaultValue:"Select row"})}),enableSorting:!1,enableHiding:!1,size:50};ye.unshift(ce)}if(k?.enabled){const ce={id:"expand",header:()=>null,cell:({row:Re})=>Re.getCanExpand()?e.jsx(L,{variant:"ghost",size:"sm",onClick:()=>Re.toggleExpanded(),className:"h-8 w-8 p-0",children:Re.getIsExpanded()?e.jsx(h.ChevronDown,{className:"h-4 w-4"}):e.jsx(h.ChevronRight,{className:"h-4 w-4"})}):null,enableSorting:!1,enableHiding:!1,size:50};ye.unshift(ce)}if(A){const ce={id:"reorder",header:()=>null,cell:()=>e.jsx(L,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 cursor-move",children:e.jsx(h.GripVertical,{className:"h-4 w-4"})}),enableSorting:!1,enableHiding:!1,size:50};ye.unshift(ce)}return ye},[s,d,k,A,J]);console.log("DataTableAdvanced - props:",{grouping:v,rowExpansion:k,dataLength:t.length});const{table:Ne,sorting:Ke,setSorting:xt,columnFilters:Ye,setColumnFilters:et,columnVisibility:gt,setColumnVisibility:Et,columnOrder:Je,setColumnOrder:G,expanded:ee,setExpanded:re,grouping:we,setGrouping:be,rowSelection:Mt,setRowSelection:ys,globalFilter:Oa,setGlobalFilter:za,pagination:la,setPagination:ic,selectedRows:lc,resetFilters:Pt,resetSelection:ns,resetAll:Vt,exportData:ca,getGroupedData:_a,getExpandedData:Va,toggleGrouping:St,clearGrouping:Wa,toggleRowExpansion:bt,expandAll:Ps,collapseAll:jt}=xl({data:t,columns:De,pagination:u,tableId:$,onSortingChange:T,onFiltersChange:K,onSelectionChange:q,onColumnOrderChange:B,onExpandedChange:W,onGroupingChange:I,grouping:v,virtualization:N,sortMode:D,performance:H}),{isVirtualized:Rt,virtualItems:os,totalSize:da,scrollToIndex:fn,scrollToOffset:Ua}=gl({data:t,virtualization:N,containerRef:Q}),{exportData:ua,exportAll:pn,exportSelected:Rs}=bl({data:t,columns:De,exportConfig:typeof P=="object"?P:void 0}),{importWithUI:Fs,supportedFormats:cc}=jl({importConfig:typeof R=="object"?R:void 0}),[is,vt]=Ur(Ne,{onSave:_?.onSave,onCancel:_?.onCancel,autoSave:_?.autoSave,autoSaveDelay:_?.autoSaveDelay});if(_?.editableColumns&&_.editableColumns.length>0){const ye={id:"edit-actions",header:()=>J("datatable.actions",{defaultValue:"Actions"}),cell:({row:ce})=>is.editingRowId===ce.id?e.jsxs("div",{className:"flex gap-1",children:[e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>vt.saveEdit(),disabled:!is.hasChanges,children:J("datatable.save",{defaultValue:"Save"})}),e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>vt.cancelEdit(),children:J("datatable.cancel",{defaultValue:"Cancel"})})]}):e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>vt.startEdit(ce.id,ce.original),children:J("datatable.edit",{defaultValue:"Edit"})}),enableSorting:!1,enableHiding:!1};De.push(ye)}const ma=c.useCallback(async ye=>{try{await ua(ye)}catch(ce){console.error("Erreur lors de l'export:",ce)}},[ua]),ha=c.useCallback(async()=>{try{const ye=await Fs();console.log("Données importées:",ye)}catch(ye){console.error("Erreur lors de l'import:",ye)}},[Fs]);if(p)return e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg",children:e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx(h.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:J("datatable.loading",{defaultValue:"Loading..."})})]})});if(w)return e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg bg-destructive/10",children:e.jsxs("div",{className:"flex flex-col items-center gap-2 text-destructive",children:[e.jsx(h.AlertCircle,{className:"h-8 w-8"}),e.jsx("p",{className:"text-sm font-medium",children:w})]})});if(!t||t.length===0)return e.jsxs("div",{className:"flex flex-col",children:[l&&e.jsx(Qs,{table:Ne,config:l,globalFilter:Oa,onGlobalFilterChange:za,density:Y,onDensityChange:U,onExport:P?ma:void 0,onImport:R?ha:void 0}),e.jsx("div",{className:"flex items-center justify-center h-64 border rounded-lg",children:C||e.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[e.jsx("p",{className:"text-lg font-medium",children:J("datatable.noData",{defaultValue:"No data"})}),e.jsx("p",{className:"text-sm",children:J("datatable.noDataDescription",{defaultValue:"There are no results to display"})})]})})]});const fa=()=>Rt?e.jsx("div",{ref:Q,className:"h-full overflow-auto",style:{height:N?.containerHeight||600},children:e.jsxs("table",{className:ge("w-full caption-bottom text-sm",le.table),style:de(),children:[e.jsx("thead",{className:ge(g&&"sticky top-0 bg-background z-10"),children:Ne.getHeaderGroups().map(ye=>e.jsx("tr",{className:"border-b",children:ye.headers.map(ce=>e.jsxs("th",{className:ge("text-left font-medium text-muted-foreground",le.header,ce.column.getCanSort()&&"cursor-pointer select-none hover:text-foreground"),onClick:ce.column.getToggleSortingHandler(),style:{width:ce.getSize(),minWidth:ce.column.columnDef.minSize,maxWidth:ce.column.columnDef.maxSize},children:[ce.isPlaceholder?null:Be.flexRender(ce.column.columnDef.header,ce.getContext()),ce.column.getIsSorted()&&e.jsx("span",{className:"ml-2",children:ce.column.getIsSorted()==="asc"?"↑":"↓"})]},ce.id))},ye.id))}),e.jsx("tbody",{children:os.map(ye=>{const Re=(v?.columns?.length?Ne.getGroupedRowModel().rows:k?.enabled?Ne.getExpandedRowModel().rows:Ne.getRowModel().rows)[ye.index];return Re?e.jsx("tr",{className:ge("border-b transition-colors",M&&"cursor-pointer hover:bg-muted/50",Re.getIsSelected()&&"bg-muted"),onClick:()=>M?.(Re.original),onDoubleClick:()=>E?.(Re.original),style:{position:"absolute",top:ye.start,left:0,width:"100%",height:ye.size},children:Re.getVisibleCells().map(at=>{const ls=at.getValue(),Ie=at.column.id,Ue=Re.id,ve=is.editingRowId===Ue,cs=_?.editableColumns?.find(Wt=>Wt.field===Ie);return cs&&ve?e.jsx("td",{className:ge("align-middle",le.cell),children:e.jsx(Na,{value:ls,field:Ie,config:cs.config,isEditing:ve,onChange:Wt=>vt.updateField(Ie,Wt),onStartEdit:()=>vt.startEdit(Ue,Re.original),onSave:()=>vt.saveEdit(),onCancel:()=>vt.cancelEdit()})},at.id):e.jsx("td",{className:ge("align-middle",le.cell),children:Be.flexRender(at.column.columnDef.cell,at.getContext())},at.id)})},Re.id):null})})]})}):e.jsx("div",{className:ge("w-full overflow-auto",Z),children:e.jsxs("table",{className:ge("w-full caption-bottom text-sm",le.table),style:de(),children:[e.jsx("thead",{className:ge(g&&"sticky top-0 bg-background z-10"),children:Ne.getHeaderGroups().map(ye=>e.jsx("tr",{className:"border-b",children:ye.headers.map(ce=>e.jsxs("th",{className:ge("text-left font-medium text-muted-foreground",le.header,ce.column.getCanSort()&&"cursor-pointer select-none hover:text-foreground"),onClick:ce.column.getToggleSortingHandler(),style:{width:ce.getSize(),minWidth:ce.column.columnDef.minSize,maxWidth:ce.column.columnDef.maxSize},children:[ce.isPlaceholder?null:Be.flexRender(ce.column.columnDef.header,ce.getContext()),ce.column.getIsSorted()&&e.jsx("span",{className:"ml-2",children:ce.column.getIsSorted()==="asc"?"↑":"↓"})]},ce.id))},ye.id))}),e.jsx("tbody",{children:(()=>{const ye=v?.columns?.length?Ne.getGroupedRowModel().rows:k?.enabled?Ne.getExpandedRowModel().rows:Ne.getRowModel().rows;return console.log("DataTableAdvanced - rendering rows:",{totalRows:ye.length,grouping:v?.columns,rowExpansion:k?.enabled,firstRow:ye[0]}),ye.map((ce,Re)=>{const at=ce.getIsGrouped(),ls=ce.getIsExpanded();return e.jsxs(c.Fragment,{children:[e.jsx("tr",{className:ge("border-b transition-colors",M&&"cursor-pointer hover:bg-muted/50",ce.getIsSelected()&&"bg-muted",at&&"bg-muted/30 font-medium"),onClick:()=>M?.(ce.original),onDoubleClick:()=>E?.(ce.original),children:ce.getVisibleCells().map(Ie=>{const Ue=Ie.getValue(),ve=Ie.column.id,cs=ce.id,Wt=is.editingRowId===cs,$s=_?.editableColumns?.find(mt=>mt.field===ve);return $s&&Wt?e.jsx("td",{className:ge("align-middle",le.cell),children:e.jsx(Na,{value:Ue,field:ve,config:$s.config,isEditing:Wt,onChange:mt=>vt.updateField(ve,mt),onStartEdit:()=>vt.startEdit(cs,ce.original),onSave:()=>vt.saveEdit(),onCancel:()=>vt.cancelEdit()})},Ie.id):e.jsx("td",{className:ge("align-middle",le.cell),children:at?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:mt=>{mt.stopPropagation(),ce.toggleExpanded()},className:"p-1 hover:bg-muted rounded",children:ls?"▼":"▶"}),e.jsxs("span",{className:"font-medium",children:[Ie.getValue()," (",ce.subRows.length," éléments)"]})]}):Be.flexRender(Ie.column.columnDef.cell,Ie.getContext())},Ie.id)})}),k?.enabled&&ls&&e.jsx("tr",{children:e.jsx("td",{colSpan:De.length,className:"p-0",children:e.jsx("div",{className:"border-b",children:k.renderExpanded?.(ce.original)})})},`${ce.id}-expanded-${Re}`)]},`${ce.id}-${Re}`)})})()})]})});return e.jsxs("div",{className:ge("w-full",z),style:de(),children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[l&&e.jsx("div",{className:"flex-1",children:e.jsx(Qs,{table:Ne,config:l,globalFilter:Oa,onGlobalFilterChange:za,density:Y,onDensityChange:U,onExport:P?ma:void 0,onImport:R?ha:void 0})}),o&&e.jsx(qr,{table:Ne,filters:o,position:i,onFiltersChange:K})]}),fa(),u&&e.jsx(Br,{table:Ne,pageSizeOptions:u.pageSizeOptions})]})}function yx({header:t,column:s,className:a}){const[r,n]=c.useState(!1),o=c.useCallback(i=>{i.preventDefault(),i.stopPropagation(),n(!0);const l=i.clientX,u=s.getSize(),d=m=>{const p=m.clientX-l,w=Math.max(50,u+p);s.setSize(w)},f=()=>{n(!1),document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",f)};document.addEventListener("mousemove",d),document.addEventListener("mouseup",f)},[s]);return s.getCanResize()?e.jsx("div",{className:ge("absolute right-0 top-0 h-full w-1 cursor-col-resize bg-border opacity-0 hover:opacity-100 transition-opacity",r&&"opacity-100 bg-primary",a),onMouseDown:o,style:{width:"4px",marginRight:"-2px"}}):null}function Nx({row:t,table:s,className:a}){const[r,n]=c.useState(t.getIsExpanded()),o=c.useCallback(()=>{n(!r),t.toggleExpanded()},[r,t]);t.getValue(t.groupingColumnId);const i=t.subRows.length;return e.jsxs("div",{className:ge("flex items-center gap-2 py-2",a),children:[e.jsx(L,{variant:"ghost",size:"sm",onClick:o,className:"h-6 w-6 p-0",children:r?e.jsx(h.ChevronDown,{className:"h-4 w-4"}):e.jsx(h.ChevronRight,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"font-medium",children:Be.flexRender(t.groupingColumn.columnDef.cell,t.getGroupingValue())}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["(",i," ",i===1?"item":"items",")"]})]})]})}function Cx({row:t,table:s,className:a}){const r=t.getAggregationValue();return r?e.jsx("div",{className:ge("flex items-center gap-4 py-2 bg-muted/50",a),children:Object.entries(r).map(([n,o])=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-medium",children:[n,":"]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:typeof o=="number"?o.toLocaleString():String(o)})]},n))}):null}function kx({table:t,groupingColumns:s,onGroupingChange:a,className:r}){const[n,o]=c.useState(s),i=c.useCallback(u=>{const d=n.includes(u)?n.filter(f=>f!==u):[...n,u];o(d),a(d)},[n,a]),l=c.useCallback(()=>{o([]),a([])},[a]);return e.jsxs("div",{className:ge("flex items-center gap-2",r),children:[e.jsx("span",{className:"text-sm font-medium",children:"Group by:"}),t.getAllColumns().filter(u=>u.getCanGroup()).map(u=>e.jsx(L,{variant:n.includes(u.id)?"default":"outline",size:"sm",onClick:()=>i(u.id),children:u.columnDef.header},u.id)),n.length>0&&e.jsx(L,{variant:"ghost",size:"sm",onClick:l,children:"Clear"})]})}function Sx({row:t,rowIndex:s,actions:a=[],columnActions:r=[],onCopy:n,onExport:o,onEdit:i,onDelete:l,onToggleColumnVisibility:u,visibleColumns:d=[],className:f,children:m}){const[p,w]=c.useState(!1),C=c.useCallback(k=>{k.onClick(t),w(!1)},[t]),g=c.useCallback(()=>{if(n)n(t);else{const k=Object.entries(t).map(([N,D])=>`${N}: ${D}`).join(`
24
+ `);navigator.clipboard.writeText(k)}w(!1)},[t,n]),y=c.useCallback(()=>{o&&o(t),w(!1)},[t,o]),j=c.useCallback(()=>{i&&i(t),w(!1)},[t,i]),x=c.useCallback(()=>{l&&l(t),w(!1)},[t,l]),v=c.useCallback(k=>{u&&u(k),w(!1)},[u]);return e.jsxs(Yo,{onOpenChange:w,children:[e.jsx(Jo,{asChild:!0,children:m}),e.jsxs(Sr,{className:ge("w-64",f),children:[a.length>0&&e.jsxs(e.Fragment,{children:[a.map(k=>e.jsxs(Ft,{onClick:()=>C(k),disabled:k.disabled,className:ge(k.destructive&&"text-destructive focus:text-destructive"),children:[k.icon&&e.jsx("span",{className:"mr-2",children:k.icon}),k.label]},k.id)),e.jsx(Vs,{})]}),e.jsxs(Ft,{onClick:g,children:[e.jsx(h.Copy,{className:"mr-2 h-4 w-4"}),"Copy row"]}),o&&e.jsxs(Ft,{onClick:y,children:[e.jsx(h.Download,{className:"mr-2 h-4 w-4"}),"Export row"]}),i&&e.jsxs(Ft,{onClick:j,children:[e.jsx(h.Edit,{className:"mr-2 h-4 w-4"}),"Edit row"]}),l&&e.jsxs(Ft,{onClick:x,className:"text-destructive focus:text-destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Delete row"]}),r.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Vs,{}),e.jsx("div",{className:"px-2 py-1.5 text-sm font-semibold text-muted-foreground",children:"Columns"}),r.map(k=>e.jsxs(Ft,{onClick:()=>v(k.id),disabled:k.disabled,children:[k.icon&&e.jsx("span",{className:"mr-2",children:k.icon}),k.label]},k.id))]}),u&&d.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Vs,{}),e.jsx("div",{className:"px-2 py-1.5 text-sm font-semibold text-muted-foreground",children:"Toggle Columns"}),d.map(k=>e.jsxs(Ft,{onClick:()=>v(k),children:[e.jsx(h.Eye,{className:"mr-2 h-4 w-4"}),k]},k))]})]})]})}function Dx({table:t,selectionMode:s="multiple",selectedRows:a,onSelectionChange:r,selectionActions:n=[],className:o}){const[i,l]=c.useState(null);c.useCallback((p,w)=>{if(s==="single"){t.setRowSelection({[p]:w});return}if(s==="range"&&i!==null){const C=Math.min(i,p),g=Math.max(i,p),y={...t.getState().rowSelection};for(let j=C;j<=g;j++)y[j]=w;t.setRowSelection(y)}else t.setRowSelection(C=>({...C,[p]:w}));l(p)},[t,s,i]);const u=c.useCallback(p=>{if(p){const w=t.getRowModel().rows.reduce((C,g,y)=>(C[y]=!0,C),{});t.setRowSelection(w)}else t.setRowSelection({})},[t]);c.useCallback((p,w,C)=>{const g={...t.getState().rowSelection};for(let y=p;y<=w;y++)g[y]=C;t.setRowSelection(g)},[t]),c.useCallback(p=>{const w={...t.getState().rowSelection};t.getRowModel().rows.forEach((C,g)=>{p(C.original)&&(w[g]=!0)}),t.setRowSelection(w)},[t]);const d=c.useCallback(p=>{p.onClick(a)},[a]),f=t.getIsAllPageRowsSelected(),m=t.getIsSomePageRowsSelected();return e.jsxs("div",{className:ge("flex items-center gap-2",o),children:[e.jsx(Ze,{checked:f,onCheckedChange:u,ref:p=>{p&&"indeterminate"in p&&(p.indeterminate=m&&!f)},"aria-label":"Select all rows"}),a.length>0&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsxs("span",{children:[a.length," selected"]}),e.jsx("div",{className:"flex items-center gap-1",children:n.map(p=>e.jsxs(L,{variant:"ghost",size:"sm",onClick:()=>d(p),disabled:p.disabled,className:ge(p.destructive&&"text-destructive hover:text-destructive"),children:[p.icon&&e.jsx("span",{className:"mr-1",children:p.icon}),p.label]},p.id))})]}),e.jsxs(Ve,{onValueChange:p=>{switch(p){case"all":u(!0);break;case"none":u(!1);break;case"invert":t.getRowModel().rows.forEach((w,C)=>{const g=t.getState().rowSelection[C];t.setRowSelection(y=>({...y,[C]:!g}))});break}},children:[e.jsx($e,{className:"w-32",children:e.jsx(We,{placeholder:"Select"})}),e.jsxs(Le,{children:[e.jsx(je,{value:"all",children:"Select All"}),e.jsx(je,{value:"none",children:"Select None"}),e.jsx(je,{value:"invert",children:"Invert Selection"})]})]})]})}function Tx({table:t,selectionMode:s="multiple",onSelectionChange:a}){const[r,n]=c.useState([]);c.useEffect(()=>{const f=t.getFilteredSelectedRowModel().rows.map(m=>m.original);n(f),a?.(f)},[t,a]);const o=c.useCallback((f,m=!0)=>{t.setRowSelection(p=>({...p,[f]:m}))},[t]),i=c.useCallback((f=!0)=>{if(f){const m=t.getRowModel().rows.reduce((p,w,C)=>(p[C]=!0,p),{});t.setRowSelection(m)}else t.setRowSelection({})},[t]),l=c.useCallback((f,m,p=!0)=>{const w={...t.getState().rowSelection};for(let C=f;C<=m;C++)w[C]=p;t.setRowSelection(w)},[t]),u=c.useCallback(f=>{const m={...t.getState().rowSelection};t.getRowModel().rows.forEach((p,w)=>{f(p.original)&&(m[w]=!0)}),t.setRowSelection(m)},[t]),d=c.useCallback(()=>{t.setRowSelection({})},[t]);return{selectedRows:r,selectRow:o,selectAll:i,selectRange:l,selectByCriteria:u,clearSelection:d,isAllSelected:t.getIsAllPageRowsSelected(),isSomeSelected:t.getIsSomePageRowsSelected()}}const Ax=Xe.cva("flex items-center",{variants:{variant:{default:"gap-2 p-3 rounded-lg border bg-card shadow-sm",minimal:"gap-2",pills:"gap-2 p-2 rounded-full border bg-muted/30",inline:"gap-1.5 text-sm",compact:"gap-1.5 p-2 rounded-md bg-muted/50"}},defaultVariants:{variant:"default"}}),Ex=Xe.cva("justify-between gap-2 transition-all",{variants:{variant:{default:"h-9 border-primary/50",minimal:"h-8 border-0 shadow-none hover:bg-accent",pills:"h-8 rounded-full px-4",inline:"h-7 text-sm border-0 shadow-none p-0 hover:bg-transparent hover:underline",compact:"h-7 text-xs px-2"}},defaultVariants:{variant:"default"}}),Mx={partner:h.Building2,network:h.Network,customer:h.Users},Px={partner:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",network:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",customer:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"},Ka={partner:"Partenaire",network:"Réseau",customer:"Client"},wl=c.forwardRef(({type:t,items:s,selected:a,isLoading:r,onSelect:n,placeholder:o,emptyText:i,showIcon:l,showBadge:u,variant:d},f)=>{const[m,p]=c.useState(!1),[w,C]=c.useState(""),g=Mx[t],y=c.useMemo(()=>w?s.filter(v=>v.name.toLowerCase().includes(w.toLowerCase())):s,[s,w]),j=v=>{n(v),p(!1),C("")},x=v=>{v.stopPropagation(),n({id:"",name:"",type:t}),C("")};return e.jsxs(rt,{open:m,onOpenChange:p,children:[e.jsx(nt,{asChild:!0,children:e.jsxs(L,{ref:f,variant:d==="inline"?"ghost":"outline",role:"combobox","aria-expanded":m,className:b(Ex({variant:d}),a?.id?"border-primary/50":""),disabled:r||s.length===0,children:[e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[l&&g&&e.jsx(g,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"truncate",children:a?.name||o||Ka[t]}),u&&a?.id&&e.jsx(Se,{variant:"secondary",className:b("text-xs",Px[t]),children:t})]}),a?.id?e.jsx(h.X,{className:"h-3 w-3 shrink-0 opacity-50 hover:opacity-100",onClick:x}):e.jsx(h.ChevronRight,{className:"h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(st,{className:"w-[300px] p-0",align:"start",children:e.jsxs(ss,{shouldFilter:!1,children:[e.jsxs("div",{className:"flex items-center border-b px-3 py-2 bg-muted/50",children:[e.jsx(h.Search,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(xs,{placeholder:`Rechercher ${Ka[t].toLowerCase()}...`,value:w,onValueChange:C,className:"border-0 focus:ring-0"})]}),e.jsxs(ea,{children:[e.jsx(gs,{children:i||`Aucun ${Ka[t].toLowerCase()} trouvé`}),e.jsx(Ot,{children:y.map(v=>e.jsx(zt,{value:v.id,onSelect:()=>j(v),className:"cursor-pointer",children:e.jsxs("div",{className:"flex items-center gap-2 w-full",children:[l&&g&&e.jsx(g,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate",children:v.name}),v.metadata?.count!==void 0&&e.jsx(Se,{variant:"secondary",className:"text-xs",children:v.metadata.count})]})},v.id))})]})]})})]})});wl.displayName="AdmincrumbSelector";const yl=c.forwardRef(({levels:t,separator:s,className:a,onLevelChange:r,showIcons:n=!0,showBadges:o=!1,showHome:i=!1,maxWidth:l="100%",variant:u="default",resetable:d=!1,onReset:f},m)=>{const p=g=>y=>{r?.(g,y)},w=t.some(g=>g.selected?.id),C=d&&w&&f;return e.jsxs("nav",{ref:m,"aria-label":"Fil d'Ariane administrateur",className:b("flex items-center gap-2",a),style:{maxWidth:l},children:[e.jsxs("div",{className:b(Ax({variant:u}),"overflow-x-auto"),children:[i&&e.jsxs(e.Fragment,{children:[e.jsx(L,{variant:u==="inline"?"ghost":"outline",size:u==="compact"?"sm":"default",className:b(u==="inline"&&"h-7 px-2",u==="compact"&&"h-7 px-2"),onClick:()=>f?.(),children:e.jsx(h.Home,{className:"h-4 w-4"})}),e.jsx(h.ChevronRight,{className:"h-4 w-4 text-muted-foreground shrink-0","aria-hidden":"true"})]}),e.jsx("ol",{className:"flex items-center gap-2 list-none p-0 m-0",children:t.map((g,y)=>e.jsxs("li",{className:"flex items-center gap-2",children:[y>0&&e.jsx(e.Fragment,{children:s||e.jsx(h.ChevronRight,{className:b("text-muted-foreground shrink-0",u==="compact"||u==="inline"?"h-3 w-3":"h-4 w-4"),"aria-hidden":"true"})}),e.jsx(wl,{...g,onSelect:p(y),showIcon:n,showBadge:o,variant:u||"default"})]},`${g.type}-${y}`))}),C&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-6 bg-border mx-1","aria-hidden":"true"}),e.jsxs(L,{variant:"ghost",size:u==="compact"?"sm":"default",onClick:f,className:b("gap-2",u==="compact"&&"h-7 px-2 text-xs"),children:[e.jsx(h.X,{className:"h-3 w-3"}),"Réinitialiser"]})]})]}),w&&!C&&e.jsxs(Se,{variant:"secondary",className:"gap-1",children:[e.jsx(h.Filter,{className:"h-3 w-3"}),"Filtré"]})]})});yl.displayName="WakaAdmincrumb";function Rx(){const[t,s]=c.useState(),[a,r]=c.useState(),[n,o]=c.useState(),i=c.useCallback((u,d)=>{u===0?(s(d.id?d:void 0),r(void 0),o(void 0)):u===1?(r(d.id?d:void 0),o(void 0)):u===2&&o(d.id?d:void 0)},[]),l=c.useCallback(()=>{s(void 0),r(void 0),o(void 0)},[]);return{partner:t,network:a,customer:n,handleLevelChange:i,reset:l}}const Hr=c.forwardRef(({options:t,value:s,onChange:a,onSearch:r,multiple:n=!1,creatable:o=!1,onCreate:i,placeholder:l="Sélectionner...",emptyMessage:u="Aucun résultat.",loading:d=!1,disabled:f=!1,error:m,className:p,label:w,description:C,maxSelections:g,sortOptions:y=!1,searchDebounce:j=300},x)=>{const[v,k]=c.useState(!1),[N,D]=c.useState(""),[P,R]=c.useState(t),[A,S]=c.useState(!1),M=c.useRef();c.useEffect(()=>{r||R(t)},[t,r]);const E=c.useMemo(()=>s?Array.isArray(s)?s:[s]:[],[s]);c.useEffect(()=>{if(r){if(M.current&&clearTimeout(M.current),!N.trim()){R(t);return}return M.current=setTimeout(async()=>{S(!0);try{const _=await r(N);R(_)}catch{R([])}finally{S(!1)}},j),()=>{M.current&&clearTimeout(M.current)}}},[N,r,j,t]);const T=c.useMemo(()=>{let _=P;if(!r&&N.trim()){const F=N.toLowerCase();_=P.filter(H=>H.label.toLowerCase().includes(F)||H.value.toLowerCase().includes(F))}return y&&(_=[..._].sort((F,H)=>F.label.localeCompare(H.label))),_},[P,N,r,y]),K=c.useMemo(()=>{const _={_ungrouped:[]};for(const F of T){const H=F.group||"_ungrouped";_[H]||(_[H]=[]),_[H].push(F)}return _},[T]),q=o&&N.trim()&&!P.some(_=>_.value.toLowerCase()===N.toLowerCase()),B=_=>{if(n){const F=E.includes(_)?E.filter(H=>H!==_):g&&E.length>=g?E:[...E,_];a?.(F.length>0?F:null)}else a?.(_===s?null:_),k(!1);D("")},W=()=>{if(!N.trim())return;const _={value:N.trim(),label:N.trim()};R(F=>[...F,_]),B(_.value),i?.(_.value)},I=(_,F)=>{F.stopPropagation();const H=E.filter(J=>J!==_);a?.(H.length>0?H:null)},z=_=>P.find(H=>H.value===_)?.label||_,$=A||d;return e.jsxs("div",{className:b("space-y-1.5",p),children:[w&&e.jsx(me,{children:w}),C&&e.jsx("p",{className:"text-sm text-muted-foreground",children:C}),e.jsxs(rt,{open:v,onOpenChange:k,children:[e.jsx(nt,{asChild:!0,children:e.jsxs(L,{ref:x,variant:"outline",role:"combobox","aria-expanded":v,disabled:f,className:b("w-full justify-between font-normal",!s&&"text-muted-foreground",m&&"border-destructive"),children:[n?e.jsx("div",{className:"flex flex-wrap gap-1 flex-1 min-w-0",children:E.length>0?E.map(_=>e.jsxs(Se,{variant:"secondary",className:"text-xs",children:[z(_),e.jsx("button",{className:"ml-1 hover:text-destructive",onClick:F=>I(_,F),children:e.jsx(h.X,{className:"h-3 w-3"})})]},_)):e.jsx("span",{children:l})}):e.jsx("span",{className:"truncate",children:s?z(s):l}),$?e.jsx(h.Loader2,{className:"ml-2 h-4 w-4 shrink-0 animate-spin"}):e.jsx(h.ChevronsUpDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(st,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(ss,{shouldFilter:!1,children:[e.jsx(xs,{placeholder:"Rechercher...",value:N,onValueChange:D}),e.jsxs(ea,{children:[$&&e.jsxs("div",{className:"py-6 text-center text-sm",children:[e.jsx(h.Loader2,{className:"h-4 w-4 animate-spin mx-auto mb-2"}),"Chargement..."]}),!$&&T.length===0&&!q&&e.jsx(gs,{children:u}),q&&e.jsx(Ot,{children:e.jsxs(zt,{onSelect:W,className:"cursor-pointer",children:[e.jsx(h.Plus,{className:"mr-2 h-4 w-4"}),'Créer "',N,'"']})}),Object.entries(K).map(([_,F])=>F.length===0?null:e.jsx(Ot,{heading:_!=="_ungrouped"?_:void 0,children:F.map(H=>e.jsxs(zt,{value:H.value,onSelect:()=>B(H.value),disabled:H.disabled,className:"cursor-pointer",children:[e.jsx(h.Check,{className:b("mr-2 h-4 w-4",E.includes(H.value)?"opacity-100":"opacity-0")}),H.label]},H.value))},_))]})]})})]}),m&&e.jsx("p",{className:"text-sm text-destructive",children:m})]})});Hr.displayName="WakaAutocomplete";const Nl=c.forwardRef((t,s)=>e.jsx(Hr,{ref:s,...t}));Nl.displayName="WakaAutocompleteForm";const Kn={" ":"11011001100","!":"11001101100",'"':"11001100110","#":"10010011000",$:"10010001100","%":"10001001100","&":"10011001000","'":"10011000100","(":"10001100100",")":"11001001000","*":"11001000100","+":"11000100100",",":"10110011100","-":"10011011100",".":"10011001110","/":"10111001100",0:"10011101100",1:"10011100110",2:"11001110010",3:"11001011100",4:"11001001110",5:"11011100100",6:"11001110100",7:"11101101110",8:"11101001100",9:"11100101100",":":"11100100110",";":"11101100100","<":"11100110100","=":"11100110010",">":"11011011000","?":"11011000110","@":"11000110110",A:"10100011000",B:"10001011000",C:"10001000110",D:"10110001000",E:"10001101000",F:"10001100010",G:"11010001000",H:"11000101000",I:"11000100010",J:"10110111000",K:"10110001110",L:"10001101110",M:"10111011000",N:"10111000110",O:"10001110110",P:"11101110110",Q:"11010001110",R:"11000101110",S:"11011101000",T:"11011100010",U:"11011101110",V:"11101011000",W:"11101000110",X:"11100010110",Y:"11101101000",Z:"11101100010"},Yn="11010000100",Fx="1100011101011";function Ya(t){let s=Yn;for(const a of t.toUpperCase()){const r=Kn[a];r?s+=r:s+=Kn["?"]}return s+=Yn,s+=Fx,s}const Ja={0:"101001101101",1:"110100101011",2:"101100101011",3:"110110010101",4:"101001101011",5:"110100110101",6:"101100110101",7:"101001011011",8:"110100101101",9:"101100101101",A:"110101001011",B:"101101001011",C:"110110100101",D:"101011001011",E:"110101100101",F:"101101100101",G:"101010011011",H:"110101001101",I:"101101001101",J:"101011001101",K:"110101010011",L:"101101010011",M:"110110101001",N:"101011010011",O:"110101101001",P:"101101101001",Q:"101010110011",R:"110101011001",S:"101101011001",T:"101011011001",U:"110010101011",V:"100110101011",W:"110011010101",X:"100101101011",Y:"110010110101",Z:"100110110101","-":"100101011011",".":"110010101101"," ":"100110101101","*":"100101101101"};function $x(t){let s=Ja["*"]+"0";for(const a of t.toUpperCase()){const r=Ja[a];r&&(s+=r+"0")}return s+=Ja["*"],s}function Lx(t,s){switch(s){case"CODE128":return Ya(t);case"CODE39":return $x(t);case"EAN13":case"EAN8":case"UPC":case"ITF14":return Ya(t);default:return Ya(t)}}function Ix({value:t,format:s="CODE128",width:a=200,height:r=80,displayValue:n=!0,lineColor:o="#000000",background:i="#FFFFFF",fontSize:l=14,margin:u=10,showActions:d=!1,className:f}){const m=c.useRef(null),[p,w]=c.useState(!1);c.useEffect(()=>{const y=m.current;if(!y||!t)return;const j=y.getContext("2d");if(!j)return;const x=Lx(t,s),v=n?l+4:0,k=r-v-u*2,N=(a-u*2)/x.length;j.fillStyle=i,j.fillRect(0,0,a,r),j.fillStyle=o;for(let D=0;D<x.length;D++)x[D]==="1"&&j.fillRect(u+D*N,u,N,k);n&&(j.fillStyle=o,j.font=`${l}px monospace`,j.textAlign="center",j.textBaseline="bottom",j.fillText(t,a/2,r-u+2))},[t,s,a,r,n,o,i,l,u]);const C=()=>{const y=m.current;if(!y)return;const j=document.createElement("a");j.download=`barcode-${t}-${Date.now()}.png`,j.href=y.toDataURL("image/png"),j.click()},g=async()=>{const y=m.current;if(y)try{const j=await new Promise(x=>{y.toBlob(v=>{v&&x(v)},"image/png")});await navigator.clipboard.write([new ClipboardItem({"image/png":j})]),w(!0),setTimeout(()=>w(!1),2e3)}catch(j){console.error("Failed to copy barcode:",j)}};return e.jsxs("div",{className:b("inline-flex flex-col items-center gap-2",f),children:[e.jsx("canvas",{ref:m,width:a,height:r,className:"rounded border",style:{width:a,height:r}}),d&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(L,{variant:"outline",size:"sm",onClick:C,children:[e.jsx(h.Download,{className:"h-4 w-4 mr-1"}),"Télécharger"]}),e.jsxs(L,{variant:"outline",size:"sm",onClick:g,children:[p?e.jsx(h.Check,{className:"h-4 w-4 mr-1"}):e.jsx(h.Copy,{className:"h-4 w-4 mr-1"}),p?"Copié":"Copier"]})]})]})}function Jn({item:t,index:s,isLast:a,size:r,variant:n,showHomeIcon:o,renderLink:i,onItemClick:l}){const u={sm:"text-xs py-0.5 px-1.5",md:"text-sm py-1 px-2",lg:"text-base py-1.5 px-3"},d={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},f={default:a?"text-foreground font-medium":"text-muted-foreground hover:text-foreground",ghost:a?"text-foreground font-medium bg-muted rounded-md":"text-muted-foreground hover:text-foreground hover:bg-muted rounded-md",outline:a?"text-foreground font-medium border rounded-md":"text-muted-foreground hover:text-foreground hover:border-foreground border border-transparent rounded-md"},m=e.jsxs("span",{className:"flex items-center gap-1.5",children:[s===0&&o&&!t.icon&&e.jsx(h.Home,{className:d[r]}),t.icon&&e.jsx("span",{className:d[r],children:t.icon}),e.jsx("span",{className:"truncate max-w-[150px]",children:t.label})]}),p=b("inline-flex items-center transition-colors",u[r],f[n],t.disabled&&"opacity-50 pointer-events-none"),w=C=>{l&&(C.preventDefault(),l(t,s))};return a||!t.href?e.jsx("span",{className:b(p,"cursor-default"),"aria-current":a?"page":void 0,children:m}):i?i(t,e.jsx("span",{className:p,onClick:w,children:m})):e.jsx("a",{href:t.href,className:p,onClick:w,children:m})}function Ox({items:t,startIndex:s,size:a,renderLink:r,onItemClick:n}){const o={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"};return e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex items-center justify-center p-1 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted transition-colors","aria-label":"Afficher les éléments masqués",children:e.jsx(h.MoreHorizontal,{className:o[a]})})}),e.jsx(_e,{align:"start",children:t.map((i,l)=>{const u=s+l,d=()=>{n?.(i,u)};return r&&i.href?e.jsx(pe,{asChild:!0,children:r(i,e.jsxs("span",{className:"flex items-center gap-2 w-full",children:[i.icon,i.label]}))},u):e.jsxs(pe,{onClick:d,disabled:i.disabled,children:[i.icon&&e.jsx("span",{className:"mr-2",children:i.icon}),i.label]},u)})})]})}function zx({items:t,separator:s,showHomeIcon:a=!1,maxItems:r,renderLink:n,onItemClick:o,size:i="md",variant:l="default",className:u}){const d={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},f=e.jsx(h.ChevronRight,{className:b(d[i],"text-muted-foreground")}),m=()=>s??f,p=r&&t.length>r;let w,C=[],g=0;if(p&&r){const y=Math.max(r-2,1);w=[t[0],...t.slice(-y)],C=t.slice(1,-y),g=1}else w=t;return e.jsx("nav",{"aria-label":"Fil d'Ariane",className:b("flex items-center",u),children:e.jsxs("ol",{className:"flex items-center flex-wrap gap-1",children:[w.length>0&&e.jsx("li",{className:"flex items-center",children:e.jsx(Jn,{item:w[0],index:0,isLast:w.length===1&&!p,size:i,variant:l,showHomeIcon:a,renderLink:n,onItemClick:o})}),p&&C.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("li",{className:"flex items-center","aria-hidden":"true",children:m()}),e.jsx("li",{className:"flex items-center",children:e.jsx(Ox,{items:C,startIndex:g,size:i,renderLink:n,onItemClick:o})})]}),w.slice(1).map((y,j)=>{const x=p?t.length-(w.length-1-j):j+1;return e.jsxs(c.Fragment,{children:[e.jsx("li",{className:"flex items-center","aria-hidden":"true",children:m()}),e.jsx("li",{className:"flex items-center",children:e.jsx(Jn,{item:y,index:x,isLast:x===t.length-1,size:i,variant:l,showHomeIcon:!1,renderLink:n,onItemClick:o})})]},x)})]})})}function _x(t,s){const{homeLabel:a="Accueil",labelMap:r={},excludePaths:n=[]}=s||{};return c.useMemo(()=>{const i=t.split("/").filter(Boolean).filter(d=>!n.includes(d)),l=[{label:a,href:"/"}];let u="";return i.forEach(d=>{u+=`/${d}`;const f=r[d]||d.charAt(0).toUpperCase()+d.slice(1).replace(/-/g," ");l.push({label:f,href:u})}),l},[t,a,r,n])}const Vx=({images:t,autoplay:s=!1,autoplayInterval:a=3e3,showIndicators:r=!0,showNavigation:n=!0,showThumbnails:o=!1,showFullscreen:i=!1,showDownload:l=!1,showShare:u=!1,showCounter:d=!1,showProgress:f=!1,transition:m="fade",layout:p="default",theme:w="auto",aspectRatio:C="16/9",maxHeight:g,className:y,imageClassName:j,indicatorClassName:x,navigationClassName:v,thumbnailClassName:k,overlayClassName:N,counterClassName:D,progressClassName:P,onImageChange:R,onImageClick:A,onFullscreenToggle:S,onDownload:M,onShare:E,onPlayPause:T,onThumbnailClick:K,onIndicatorClick:q,onNavigationClick:B,onKeyboardNavigation:W,onTouchStart:I,onTouchEnd:z,onSwipeLeft:$,onSwipeRight:_,onSwipeUp:F,onSwipeDown:H,onLoadStart:J,onLoadEnd:Q,onError:ne,onReady:X,onDestroy:Y,loop:U=!0,pauseOnHover:ae=!0,pauseOnFocus:te=!0,pauseOnTouch:Z=!0,keyboardNavigation:le=!0,touchNavigation:xe=!0,swipeThreshold:se=50,animationDuration:de=300,preloadImages:De=!0,lazyLoading:Ne=!0,imageQuality:Ke="auto",placeholder:xt,errorImage:Ye,loadingSpinner:et,emptyState:gt,customControls:Et,customOverlay:Je,customThumbnails:G,customIndicators:ee,customNavigation:re,ariaLabel:we="Carrousel d'images",ariaLabelledBy:be,ariaDescribedBy:Mt,role:ys="region",virtualScrolling:Oa=!1,maxVisibleThumbnails:za=10,thumbnailSize:la="medium",overlayOpacity:ic=.7,overlayGradient:lc,navigationSize:Pt="medium",indicatorSize:ns="medium",indicatorShape:Vt="circle",thumbnailAspectRatio:ca="1/1",onMount:_a,onUnmount:Va,onBeforeChange:St,onAfterChange:Wa})=>{const[bt,Ps]=O.useState(0),[jt,Rt]=O.useState(s),[os,da]=O.useState(!1),[fn,Ua]=O.useState(!1),[ua,pn]=O.useState(!1),[Rs,Fs]=O.useState(null),[cc,is]=O.useState(null),[vt,ma]=O.useState(new Set),[ha,fa]=O.useState(0),ye=O.useRef(null),ce=O.useRef(null),Re=O.useRef([]),at=O.useRef(null),ls=O.useRef(0),Ie=t&&t.length>0,Ue=Math.max(0,Math.min(bt,t.length-1)),ve=Ie?t[Ue]:null,cs=O.useMemo(()=>{switch(C){case"16/9":return"aspect-video";case"4/3":return"aspect-[4/3]";case"1/1":return"aspect-square";case"3/2":return"aspect-[3/2]";default:return"aspect-video"}},[C]),Wt=O.useMemo(()=>w==="auto"?"":w==="dark"?"dark":"light",[w]),$s=O.useCallback(()=>{ye.current&&clearInterval(ye.current),jt&&Ie&&t.length>1&&(ye.current=setInterval(()=>{Ps(ie=>U?(ie+1)%t.length:Math.min(ie+1,t.length-1))},a))},[jt,Ie,t.length,a,U]),mt=O.useCallback(()=>{ye.current&&(clearInterval(ye.current),ye.current=null)},[]),xn=O.useCallback(()=>{if(!jt||!s)return;const ie=Date.now(),Ce=()=>{const Ns=(Date.now()-ie)/a*100;fa(Math.min(Ns,100)),Ns<100&&requestAnimationFrame(Ce)};requestAnimationFrame(Ce)},[jt,s,a]);O.useEffect(()=>(jt?($s(),xn()):(mt(),fa(0)),()=>mt()),[jt,$s,mt,xn]);const Ls=O.useCallback(()=>{if(!Ie)return;const ie=U?(bt-1+t.length)%t.length:Math.max(bt-1,0);St&&!St(bt,ie)||(Ps(ie),B?.("prev"))},[Ie,bt,t.length,U,St,B]),Is=O.useCallback(()=>{if(!Ie)return;const ie=U?(bt+1)%t.length:Math.min(bt+1,t.length-1);St&&!St(bt,ie)||(Ps(ie),B?.("next"))},[Ie,bt,t.length,U,St,B]),gn=O.useCallback(ie=>{!Ie||ie<0||ie>=t.length||St&&!St(bt,ie)||(Ps(ie),q?.(ie))},[Ie,bt,t.length,St,q]),dc=O.useCallback(ie=>{if(!le)return;const Ce=ie.key;switch(W?.(Ce),Ce){case"ArrowLeft":ie.preventDefault(),Ls();break;case"ArrowRight":ie.preventDefault(),Is();break;case"ArrowUp":ie.preventDefault(),F?.();break;case"ArrowDown":ie.preventDefault(),H?.();break;case" ":ie.preventDefault(),Rt(ht=>!ht),T?.(!jt);break;case"Escape":os&&(da(!1),S?.(!1));break;case"f":case"F":i&&da(ht=>(S?.(!ht),!ht));break}},[le,Ls,Is,W,F,H,jt,T,os,i,S]),uc=O.useCallback(ie=>{if(!xe)return;const Ce=ie.touches[0];Fs({x:Ce.clientX,y:Ce.clientY}),ls.current=Date.now(),I?.(ie),Z&&Rt(!1)},[xe,I,Z]),mc=O.useCallback(ie=>{if(!xe||!Rs)return;const Ce=ie.changedTouches[0];is({x:Ce.clientX,y:Ce.clientY}),z?.(ie);const ht=Ce.clientX-Rs.x,Ns=Ce.clientY-Rs.y;Date.now()-ls.current,Math.abs(ht)>Math.abs(Ns)&&Math.abs(ht)>se?ht>0?(_?.(),Ls()):($?.(),Is()):Math.abs(Ns)>se&&(Ns>0?H?.():F?.()),Fs(null),is(null)},[xe,Rs,z,se,_,$,H,F,Ls,Is]),hc=O.useCallback(ie=>{ma(Ce=>new Set([...Ce,ie])),Ua(!1),Q?.(ie)},[Q]),fc=O.useCallback((ie,Ce)=>{pn(!0),Ua(!1),ne?.(ie,Ce)},[ne]);O.useEffect(()=>{ve&&(R?.(Ue,ve),Wa?.(Ue))},[Ue,ve,R,Wa]);const pc=O.useCallback(()=>{ve&&A?.(ve,Ue)},[ve,Ue,A]),Ut=O.useCallback(ie=>{ie.stopPropagation()},[]),xc=O.useCallback(()=>{da(ie=>(S?.(!ie),!ie))},[S]),gc=O.useCallback(()=>{ve&&M?.(ve,Ue)},[ve,Ue,M]),bc=O.useCallback(()=>{ve&&E?.(ve,Ue)},[ve,Ue,E]),jc=O.useCallback(()=>{ae&&Rt(!1)},[ae]),vc=O.useCallback(()=>{ae&&s&&Rt(!0)},[ae,s]),wc=O.useCallback(()=>{te&&Rt(!1)},[te]),yc=O.useCallback(()=>{te&&s&&Rt(!0)},[te,s]);if(O.useEffect(()=>(_a?.(),X?.(),()=>{Va?.(),Y?.(),mt()}),[_a,X,Va,Y,mt]),O.useEffect(()=>()=>mt(),[mt]),!Ie)return e.jsx("div",{className:b("flex items-center justify-center h-64 bg-gray-100 rounded-lg",y),children:gt||e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-gray-500 mb-2",children:"Aucune image à afficher"}),e.jsx("p",{className:"text-sm text-gray-400",children:"Ajoutez des images pour commencer"})]})});const Nc=b("waka-carousel relative w-full mx-auto bg-black rounded-lg overflow-hidden","focus:outline-none focus:ring-2 focus:ring-blue-500",os&&"fixed inset-0 z-50 rounded-none",Wt,y),Cc=b("relative",cs,j),kc=b("absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/70 to-transparent p-4",N);return e.jsxs("div",{ref:ce,className:Nc,style:{maxHeight:g},tabIndex:0,onKeyDown:dc,onTouchStart:uc,onTouchEnd:mc,onMouseEnter:jc,onMouseLeave:vc,onFocus:wc,onBlur:yc,role:ys,"aria-label":we,"aria-labelledby":be,"aria-describedby":Mt,children:[e.jsxs("div",{className:Cc,children:[fn&&et&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50 z-20",children:et}),ua&&Ye?e.jsx("img",{src:Ye,alt:"Erreur de chargement",className:b("w-full h-full object-cover",j)}):ve?e.jsx("img",{ref:ie=>Re.current[Ue]=ie,src:ve.src,alt:ve.alt,className:b("w-full h-full object-cover transition-opacity duration-300",j),onClick:pc,loading:Ne?"lazy":"eager",onLoad:()=>hc(Ue),onError:ie=>fc(Ue,new Error("Erreur de chargement de l'image"))}):null,ve&&(ve.title||ve.description||ve.caption)&&e.jsxs("div",{className:kc,children:[ve.title&&e.jsx("h3",{className:"text-white text-lg font-semibold mb-1",children:ve.title}),ve.description&&e.jsx("p",{className:"text-white/90 text-sm mb-2",children:ve.description}),ve.caption&&e.jsx("p",{className:"text-white/80 text-xs",children:ve.caption})]}),Et&&e.jsx("div",{className:"absolute inset-0 z-10",children:Et}),Je&&e.jsx("div",{className:"absolute inset-0 z-10",children:Je}),n&&t.length>1&&e.jsx(e.Fragment,{children:re?e.jsx("div",{className:"absolute inset-0 z-10",children:re}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:ie=>{Ut(ie),Ls()},className:b("absolute left-2 top-1/2 -translate-y-1/2 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white",Pt==="small"&&"p-1",Pt==="large"&&"p-3",v),"aria-label":"Image précédente",children:e.jsx(h.ChevronLeft,{className:b("w-5 h-5",Pt==="small"&&"w-4 h-4",Pt==="large"&&"w-6 h-6")})}),e.jsx("button",{onClick:ie=>{Ut(ie),Is()},className:b("absolute right-2 top-1/2 -translate-y-1/2 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white",Pt==="small"&&"p-1",Pt==="large"&&"p-3",v),"aria-label":"Image suivante",children:e.jsx(h.ChevronRight,{className:b("w-5 h-5",Pt==="small"&&"w-4 h-4",Pt==="large"&&"w-6 h-6")})})]})}),s&&t.length>1&&e.jsx("button",{onClick:ie=>{Ut(ie),Rt(Ce=>(T?.(!Ce),!Ce))},className:b("absolute top-2 right-2 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white"),"aria-label":jt?"Pause":"Lecture",children:jt?e.jsx(h.Pause,{className:"w-4 h-4"}):e.jsx(h.Play,{className:"w-4 h-4"})}),i&&e.jsx("button",{onClick:ie=>{Ut(ie),xc()},className:b("absolute top-2 left-2 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white"),"aria-label":os?"Quitter le plein écran":"Plein écran",children:os?e.jsx(h.X,{className:"w-4 h-4"}):e.jsx(h.Maximize2,{className:"w-4 h-4"})}),l&&ve?.downloadUrl&&e.jsx("button",{onClick:ie=>{Ut(ie),gc()},className:b("absolute top-2 right-12 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white"),"aria-label":"Télécharger l'image",children:e.jsx(h.Download,{className:"w-4 h-4"})}),u&&ve?.shareUrl&&e.jsx("button",{onClick:ie=>{Ut(ie),bc()},className:b("absolute top-2 right-20 z-10","bg-black/50 hover:bg-black/70 text-white p-2 rounded-full","transition-all duration-200 hover:scale-110","focus:outline-none focus:ring-2 focus:ring-white"),"aria-label":"Partager l'image",children:e.jsx(h.Share2,{className:"w-4 h-4"})}),d&&e.jsxs("div",{className:b("absolute top-2 left-1/2 -translate-x-1/2 z-10","bg-black/50 text-white px-3 py-1 rounded-full text-sm",D),children:[Ue+1," / ",t.length]}),f&&jt&&e.jsx("div",{className:b("absolute bottom-0 left-0 right-0 h-1 bg-black/30",P),children:e.jsx("div",{ref:at,className:"h-full bg-white transition-all duration-100",style:{width:`${ha}%`}})})]}),r&&t.length>1&&e.jsx("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 flex space-x-2",children:ee?e.jsx("div",{className:"flex space-x-2",children:ee}):t.map((ie,Ce)=>e.jsx("button",{onClick:ht=>{Ut(ht),gn(Ce)},className:b("transition-all duration-200","focus:outline-none focus:ring-2 focus:ring-white",Vt==="circle"&&"rounded-full",Vt==="square"&&"rounded",Vt==="diamond"&&"rotate-45",Vt==="line"&&"rounded-none",ns==="small"&&"w-2 h-2",ns==="medium"&&"w-3 h-3",ns==="large"&&"w-4 h-4",Vt==="line"&&ns==="small"&&"w-8 h-1",Vt==="line"&&ns==="medium"&&"w-12 h-1",Vt==="line"&&ns==="large"&&"w-16 h-1",Ce===Ue?"bg-white":"bg-white/50 hover:bg-white/70",x),"aria-label":`Aller à l'image ${Ce+1}`},Ce))}),o&&t.length>1&&e.jsx("div",{className:"flex space-x-2 p-4 bg-gray-100 overflow-x-auto",children:G?e.jsx("div",{className:"flex space-x-2",children:G}):t.map((ie,Ce)=>e.jsx("button",{onClick:ht=>{Ut(ht),gn(Ce),K?.(Ce)},className:b("flex-shrink-0 rounded overflow-hidden","border-2 transition-all duration-200","focus:outline-none focus:ring-2 focus:ring-blue-500",la==="small"&&"w-12 h-12",la==="medium"&&"w-16 h-16",la==="large"&&"w-20 h-20",ca==="1/1"&&"aspect-square",ca==="4/3"&&"aspect-[4/3]",ca==="16/9"&&"aspect-video",Ce===Ue?"border-blue-500":"border-gray-300 hover:border-gray-400",k),children:e.jsx("img",{src:ie.src,alt:ie.alt,className:"w-full h-full object-cover",loading:"lazy"})},Ce))})]})};function Gr(){const[t,s]=O.useState(null),[a,r]=O.useState(!0),[n,o]=O.useState(null);return O.useEffect(()=>{let i=!0;return(async()=>{try{const u=await import("recharts");i&&(s({ResponsiveContainer:u.ResponsiveContainer,BarChart:u.BarChart,LineChart:u.LineChart,AreaChart:u.AreaChart,PieChart:u.PieChart,Bar:u.Bar,Line:u.Line,Area:u.Area,Pie:u.Pie,Cell:u.Cell,XAxis:u.XAxis,YAxis:u.YAxis,CartesianGrid:u.CartesianGrid,Tooltip:u.Tooltip,Legend:u.Legend,defs:"defs",linearGradient:"linearGradient",stop:"stop"}),r(!1))}catch(u){i&&(o(u instanceof Error?u:new Error("Failed to load Recharts")),r(!1))}})(),()=>{i=!1}},[]),{components:t,loading:a,error:n,isAvailable:!a&&!n&&t!==null}}const Wx=["hsl(var(--chart-1, 220 70% 50%))","hsl(var(--chart-2, 160 60% 45%))","hsl(var(--chart-3, 30 80% 55%))","hsl(var(--chart-4, 280 65% 60%))","hsl(var(--chart-5, 340 75% 55%))"],Bt={colors:Wx,gridColor:"hsl(var(--border, 220 13% 91%))",axisColor:"hsl(var(--muted-foreground, 220 9% 46%))",textColor:"hsl(var(--foreground, 224 71% 4%))",tooltipBackground:"hsl(var(--popover, 0 0% 100%))",tooltipText:"hsl(var(--popover-foreground, 224 71% 4%))",tooltipBorder:"hsl(var(--border, 220 13% 91%))",fontFamily:"inherit"};function As(t,s="default"){const a=O.useMemo(()=>({colors:t?.colors??Bt.colors,gridColor:t?.gridColor??Bt.gridColor,axisColor:t?.axisColor??Bt.axisColor,textColor:t?.textColor??Bt.textColor,tooltipBackground:t?.tooltipBackground??Bt.tooltipBackground,tooltipText:t?.tooltipText??Bt.tooltipText,tooltipBorder:t?.tooltipBorder??Bt.tooltipBorder,fontFamily:t?.fontFamily??Bt.fontFamily}),[t]),r=O.useMemo(()=>i=>a.colors[i%a.colors.length],[a.colors]),n=O.useMemo(()=>({contentStyle:{backgroundColor:a.tooltipBackground,color:a.tooltipText,border:`1px solid ${a.tooltipBorder}`,borderRadius:"var(--radius, 0.5rem)",padding:"8px 12px",boxShadow:"0 2px 4px rgba(0,0,0,0.1)",fontFamily:a.fontFamily},wrapperStyle:{outline:"none"},itemStyle:{color:a.tooltipText,padding:"2px 0"},labelStyle:{color:a.textColor,fontWeight:600,marginBottom:"4px"}}),[a]),o=O.useMemo(()=>{const i="relative";switch(s){case"gradient":return`${i} bg-gradient-to-br from-background to-muted/20`;case"outline":return`${i} border border-border rounded-lg p-4`;case"glass":return`${i} bg-background/50 backdrop-blur-sm border border-border/50 rounded-lg p-4`;default:return i}},[s]);return{theme:a,getColor:r,tooltipStyles:n,containerClasses:o}}const Ux={sm:{width:"100%",height:150},md:{width:"100%",height:250},lg:{width:"100%",height:350},xl:{width:"100%",height:450},auto:{width:"100%",height:300}},Es=c.forwardRef(({children:t,variant:s="default",size:a="md",height:r,width:n,theme:o,className:i,style:l,title:u,description:d,loading:f,error:m,responsive:p=!0},w)=>{const{components:C,loading:g,error:y,isAvailable:j}=Gr(),{containerClasses:x}=As(o,s),v=f||g,k=m||(y?"Recharts non disponible. Installez recharts pour utiliser les graphiques.":null),N=Ux[a],D=n??N.width,P=r??N.height;if(v)return e.jsxs("div",{ref:w,className:b(x,i),style:l,children:[u&&e.jsx(Qa,{title:u,description:d}),e.jsx(qi,{className:"w-full",style:{height:P}})]});if(k||!j)return e.jsxs("div",{ref:w,className:b(x,i),style:l,children:[u&&e.jsx(Qa,{title:u,description:d}),e.jsx("div",{className:"flex items-center justify-center text-muted-foreground text-sm border border-dashed border-border rounded-lg",style:{height:P},children:e.jsxs("div",{className:"text-center p-4",children:[e.jsx("p",{children:k||"Graphique non disponible"}),e.jsx("p",{className:"text-xs mt-1",children:"Installez recharts: pnpm add recharts"})]})})]});const{ResponsiveContainer:R}=C;return e.jsxs("div",{ref:w,className:b(x,i),style:l,children:[u&&e.jsx(Qa,{title:u,description:d}),p?e.jsx(R,{width:D,height:P,children:t(C)}):e.jsx("div",{style:{width:D,height:P},children:t(C)})]})});Es.displayName="WakaChart";function Qa({title:t,description:s}){return e.jsxs("div",{className:"mb-4",children:[e.jsx("h3",{className:"text-lg font-semibold",children:t}),s&&e.jsx("p",{className:"text-sm text-muted-foreground",children:s})]})}const Cl=c.forwardRef(({data:t,dataKeys:s,series:a,variant:r="default",size:n="md",height:o,width:i,animation:l=!0,animationDuration:u=500,grid:d=!0,tooltip:f=!0,legend:m,axis:p,theme:w,className:C,style:g,title:y,description:j,loading:x,error:v,onClick:k,responsive:N=!0,layout:D="vertical",stacked:P=!1,radius:R=4,barSize:A,barGap:S=4,barCategoryGap:M="20%"},E)=>{const{theme:T,getColor:K,tooltipStyles:q}=As(w,r),B=c.useMemo(()=>{if(a&&a.length>0)return a;if(s&&s.length>0)return s.map(($,_)=>({dataKey:$,label:$,color:K(_)}));if(t.length>0&&"value"in t[0])return[{dataKey:"value",label:"Value",color:K(0)}];const z=t[0];return z?Object.keys(z).filter($=>$!=="name"&&typeof z[$]=="number").map(($,_)=>({dataKey:$,label:$,color:K(_)})):[]},[a,s,t,K]),W=c.useMemo(()=>m?typeof m=="boolean"?{enabled:m,position:"bottom",align:"center"}:m:null,[m]),I=c.useMemo(()=>f?typeof f=="boolean"?{enabled:f}:f:null,[f]);return e.jsx(Es,{ref:E,variant:r,size:n,height:o,width:i,theme:w,className:C,style:g,title:y,description:j,loading:x,error:v,responsive:N,children:z=>{if(!z)return null;const{BarChart:$,Bar:_,XAxis:F,YAxis:H,CartesianGrid:J,Tooltip:Q,Legend:ne}=z;return e.jsxs($,{data:t,layout:D==="horizontal"?"vertical":"horizontal",barGap:S,barCategoryGap:M,children:[d&&e.jsx(J,{strokeDasharray:"3 3",stroke:T.gridColor,horizontal:!0,vertical:!1}),p?.showXAxis!==!1&&e.jsx(F,{dataKey:"name",axisLine:{stroke:T.axisColor},tickLine:{stroke:T.axisColor},tick:{fill:T.textColor,fontSize:12},tickFormatter:p?.xAxisFormatter}),p?.showYAxis!==!1&&e.jsx(H,{axisLine:{stroke:T.axisColor},tickLine:{stroke:T.axisColor},tick:{fill:T.textColor,fontSize:12},tickFormatter:p?.yAxisFormatter,domain:p?.yAxisDomain,unit:p?.yAxisUnit}),I?.enabled!==!1&&f&&e.jsx(Q,{...q,formatter:I&&typeof I!="boolean"&&I.formatter?(X,Y)=>I.formatter(X,Y,t[0]):X=>{const Y=I&&typeof I!="boolean"&&I.valuePrefix||"",U=I&&typeof I!="boolean"&&I.valueSuffix||"";return`${Y}${X}${U}`}}),W?.enabled&&e.jsx(ne,{align:W.align,verticalAlign:W.position==="top"?"top":"bottom",wrapperStyle:{paddingTop:W.position==="bottom"?16:0}}),B.map((X,Y)=>e.jsx(_,{dataKey:X.dataKey,name:X.label,fill:X.color||K(Y),radius:R,stackId:P?"stack":void 0,barSize:A,animationDuration:u,isAnimationActive:l},X.dataKey))]})}})});Cl.displayName="WakaBarChart";const kl=c.forwardRef(({data:t,dataKeys:s,series:a,variant:r="default",size:n="md",height:o,width:i,animation:l=!0,animationDuration:u=500,grid:d=!0,tooltip:f=!0,legend:m,axis:p,theme:w,className:C,style:g,title:y,description:j,loading:x,error:v,onClick:k,responsive:N=!0,curve:D="monotone",dots:P=!0,dotSize:R=4,activeDot:A=!0,strokeWidth:S=2},M)=>{const{theme:E,getColor:T,tooltipStyles:K}=As(w,r),q=c.useMemo(()=>{if(a&&a.length>0)return a;if(s&&s.length>0)return s.map((z,$)=>({dataKey:z,label:z,color:T($),strokeWidth:S}));if(t.length>0&&"value"in t[0])return[{dataKey:"value",label:"Value",color:T(0),strokeWidth:S}];const I=t[0];return I?Object.keys(I).filter(z=>z!=="name"&&typeof I[z]=="number").map((z,$)=>({dataKey:z,label:z,color:T($),strokeWidth:S})):[]},[a,s,t,T,S]),B=c.useMemo(()=>m?typeof m=="boolean"?{enabled:m,position:"bottom",align:"center"}:m:null,[m]),W=c.useMemo(()=>f?typeof f=="boolean"?{enabled:f}:f:null,[f]);return e.jsx(Es,{ref:M,variant:r,size:n,height:o,width:i,theme:w,className:C,style:g,title:y,description:j,loading:x,error:v,responsive:N,children:I=>{if(!I)return null;const{LineChart:z,Line:$,XAxis:_,YAxis:F,CartesianGrid:H,Tooltip:J,Legend:Q}=I;return e.jsxs(z,{data:t,children:[d&&e.jsx(H,{strokeDasharray:"3 3",stroke:E.gridColor,horizontal:!0,vertical:!1}),p?.showXAxis!==!1&&e.jsx(_,{dataKey:"name",axisLine:{stroke:E.axisColor},tickLine:{stroke:E.axisColor},tick:{fill:E.textColor,fontSize:12},tickFormatter:p?.xAxisFormatter}),p?.showYAxis!==!1&&e.jsx(F,{axisLine:{stroke:E.axisColor},tickLine:{stroke:E.axisColor},tick:{fill:E.textColor,fontSize:12},tickFormatter:p?.yAxisFormatter,domain:p?.yAxisDomain,unit:p?.yAxisUnit}),W?.enabled!==!1&&f&&e.jsx(J,{...K,formatter:W&&typeof W!="boolean"&&W.formatter?(ne,X)=>W.formatter(ne,X,t[0]):ne=>{const X=W&&typeof W!="boolean"&&W.valuePrefix||"",Y=W&&typeof W!="boolean"&&W.valueSuffix||"";return`${X}${ne}${Y}`}}),B?.enabled&&e.jsx(Q,{align:B.align,verticalAlign:B.position==="top"?"top":"bottom",wrapperStyle:{paddingTop:B.position==="bottom"?16:0}}),q.map((ne,X)=>e.jsx($,{dataKey:ne.dataKey,name:ne.label,stroke:ne.color||T(X),strokeWidth:ne.strokeWidth||S,strokeDasharray:ne.strokeDasharray,type:D,dot:P?{r:R,fill:ne.color||T(X)}:!1,activeDot:A?{r:R+2}:!1,animationDuration:u,isAnimationActive:l},ne.dataKey))]})}})});kl.displayName="WakaLineChart";const Sl=c.forwardRef(({data:t,dataKeys:s,series:a,variant:r="default",size:n="md",height:o,width:i,animation:l=!0,animationDuration:u=500,grid:d=!0,tooltip:f=!0,legend:m,axis:p,theme:w,className:C,style:g,title:y,description:j,loading:x,error:v,onClick:k,responsive:N=!0,curve:D="monotone",dots:P=!1,dotSize:R=4,activeDot:A=!0,strokeWidth:S=2,stacked:M=!1,fillOpacity:E=.3,gradientDirection:T="vertical"},K)=>{const{theme:q,getColor:B,tooltipStyles:W}=As(w,r),I=c.useMemo(()=>{if(a&&a.length>0)return a;if(s&&s.length>0)return s.map((F,H)=>({dataKey:F,label:F,color:B(H),strokeWidth:S,fillOpacity:E}));if(t.length>0&&"value"in t[0])return[{dataKey:"value",label:"Value",color:B(0),strokeWidth:S,fillOpacity:E}];const _=t[0];return _?Object.keys(_).filter(F=>F!=="name"&&typeof _[F]=="number").map((F,H)=>({dataKey:F,label:F,color:B(H),strokeWidth:S,fillOpacity:E})):[]},[a,s,t,B,S,E]),z=c.useMemo(()=>m?typeof m=="boolean"?{enabled:m,position:"bottom",align:"center"}:m:null,[m]),$=c.useMemo(()=>f?typeof f=="boolean"?{enabled:f}:f:null,[f]);return e.jsx(Es,{ref:K,variant:r,size:n,height:o,width:i,theme:w,className:C,style:g,title:y,description:j,loading:x,error:v,responsive:N,children:_=>{if(!_)return null;const{AreaChart:F,Area:H,XAxis:J,YAxis:Q,CartesianGrid:ne,Tooltip:X,Legend:Y}=_;return e.jsxs(F,{data:t,children:[e.jsx("defs",{children:I.map((U,ae)=>{const te=U.color||B(ae),Z=`gradient-${U.dataKey}-${ae}`;return e.jsxs("linearGradient",{id:Z,x1:"0",y1:"0",x2:T==="horizontal"?"1":"0",y2:T==="horizontal"?"0":"1",children:[e.jsx("stop",{offset:"5%",stopColor:te,stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:te,stopOpacity:.1})]},Z)})}),d&&e.jsx(ne,{strokeDasharray:"3 3",stroke:q.gridColor,horizontal:!0,vertical:!1}),p?.showXAxis!==!1&&e.jsx(J,{dataKey:"name",axisLine:{stroke:q.axisColor},tickLine:{stroke:q.axisColor},tick:{fill:q.textColor,fontSize:12},tickFormatter:p?.xAxisFormatter}),p?.showYAxis!==!1&&e.jsx(Q,{axisLine:{stroke:q.axisColor},tickLine:{stroke:q.axisColor},tick:{fill:q.textColor,fontSize:12},tickFormatter:p?.yAxisFormatter,domain:p?.yAxisDomain,unit:p?.yAxisUnit}),$?.enabled!==!1&&f&&e.jsx(X,{...W,formatter:$&&typeof $!="boolean"&&$.formatter?(U,ae)=>$.formatter(U,ae,t[0]):U=>{const ae=$&&typeof $!="boolean"&&$.valuePrefix||"",te=$&&typeof $!="boolean"&&$.valueSuffix||"";return`${ae}${U}${te}`}}),z?.enabled&&e.jsx(Y,{align:z.align,verticalAlign:z.position==="top"?"top":"bottom",wrapperStyle:{paddingTop:z.position==="bottom"?16:0}}),I.map((U,ae)=>{const te=U.color||B(ae),Z=`gradient-${U.dataKey}-${ae}`;return e.jsx(H,{dataKey:U.dataKey,name:U.label,stroke:te,strokeWidth:U.strokeWidth||S,fill:`url(#${Z})`,fillOpacity:U.fillOpacity??E,type:D,dot:P?{r:R,fill:te}:!1,stackId:M?"stack":void 0,animationDuration:u,isAnimationActive:l},U.dataKey)})]})}})});Sl.displayName="WakaAreaChart";const Dl=c.forwardRef(({data:t,variant:s="default",size:a="md",height:r,width:n,animation:o=!0,animationDuration:i=500,tooltip:l=!0,legend:u=!0,theme:d,className:f,style:m,title:p,description:w,loading:C,error:g,onClick:y,responsive:j=!0,dataKey:x="value",nameKey:v="name",innerRadius:k=0,outerRadius:N="80%",startAngle:D=90,endAngle:P=-270,paddingAngle:R=2,label:A=!1,labelPosition:S="outside"},M)=>{const{theme:E,getColor:T,tooltipStyles:K}=As(d,s),q=c.useMemo(()=>u?typeof u=="boolean"?{enabled:u,position:"bottom",align:"center"}:u:null,[u]),B=c.useMemo(()=>l?typeof l=="boolean"?{enabled:l}:l:null,[l]),W=c.useCallback(I=>{if(!A)return null;const z=Math.PI/180,$=S==="inside"?I.innerRadius+(I.outerRadius-I.innerRadius)*.5:I.outerRadius*1.1,_=I.cx+$*Math.cos(-I.midAngle*z),F=I.cy+$*Math.sin(-I.midAngle*z);let H="";return A==="percent"?H=`${(I.percent*100).toFixed(0)}%`:A==="value"?H=String(I.value):A==="name"?H=I.name:H=`${(I.percent*100).toFixed(0)}%`,e.jsx("text",{x:_,y:F,fill:S==="inside"?"#fff":E.textColor,textAnchor:_>I.cx?"start":"end",dominantBaseline:"central",fontSize:12,children:H})},[A,S,E.textColor]);return e.jsx(Es,{ref:M,variant:s,size:a,height:r,width:n,theme:d,className:f,style:m,title:p,description:w,loading:C,error:g,responsive:j,children:I=>{if(!I)return null;const{PieChart:z,Pie:$,Cell:_,Tooltip:F,Legend:H}=I;return e.jsxs(z,{children:[B?.enabled!==!1&&l&&e.jsx(F,{...K,formatter:B&&typeof B!="boolean"&&B.formatter?(J,Q)=>B.formatter(J,Q,t[0]):J=>{const Q=B&&typeof B!="boolean"&&B.valuePrefix||"",ne=B&&typeof B!="boolean"&&B.valueSuffix||"";return`${Q}${J}${ne}`}}),q?.enabled&&e.jsx(H,{align:q.align,verticalAlign:q.position==="top"?"top":"bottom",layout:q.position==="left"||q.position==="right"?"vertical":"horizontal",wrapperStyle:{paddingTop:q.position==="bottom"?16:0}}),e.jsx($,{data:t,dataKey:x,nameKey:v,cx:"50%",cy:"50%",innerRadius:k,outerRadius:N,startAngle:D,endAngle:P,paddingAngle:R,animationDuration:i,isAnimationActive:o,label:A?W:!1,labelLine:A&&S==="outside",children:t.map((J,Q)=>e.jsx(_,{fill:T(Q),stroke:"transparent"},`cell-${Q}`))})]})}})});Dl.displayName="WakaPieChart";const Xr=c.forwardRef(({data:t,type:s="line",width:a=100,height:r=30,color:n="hsl(var(--chart-1))",fillColor:o,fillOpacity:i=.3,showMinMax:l=!1,showValue:u=!1,className:d,animation:f=!0},m)=>{const{components:p,loading:w,isAvailable:C}=Gr(),g=c.useMemo(()=>t.map((S,M)=>({index:M,value:S})),[t]),{min:y,max:j,current:x}=c.useMemo(()=>{const S=t.filter(M=>typeof M=="number"&&!isNaN(M));return{min:Math.min(...S),max:Math.max(...S),current:S[S.length-1]}},[t]);if(w)return e.jsx("div",{ref:m,className:b("inline-flex items-center gap-2",d),children:e.jsx("div",{className:"bg-muted animate-pulse rounded",style:{width:a,height:r}})});if(!C||!p)return e.jsxs("div",{ref:m,className:b("inline-flex items-center gap-2",d),children:[e.jsx(Bx,{data:t,width:a,height:r,color:n,type:s,fillColor:o,fillOpacity:i}),u&&e.jsx("span",{className:"text-sm font-medium",children:x})]});const{ResponsiveContainer:v,LineChart:k,BarChart:N,AreaChart:D,Line:P,Bar:R,Area:A}=p;return e.jsxs("div",{ref:m,className:b("inline-flex items-center gap-2",d),children:[e.jsx("div",{style:{width:a,height:r},children:e.jsx(v,{width:"100%",height:"100%",children:s==="bar"?e.jsx(N,{data:g,children:e.jsx(R,{dataKey:"value",fill:n,radius:1,isAnimationActive:f})}):s==="area"?e.jsxs(D,{data:g,children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:`sparkline-gradient-${n.replace(/[^a-z0-9]/gi,"")}`,x1:"0",y1:"0",x2:"0",y2:"1",children:[e.jsx("stop",{offset:"5%",stopColor:o||n,stopOpacity:.8}),e.jsx("stop",{offset:"95%",stopColor:o||n,stopOpacity:.1})]})}),e.jsx(A,{type:"monotone",dataKey:"value",stroke:n,fill:`url(#sparkline-gradient-${n.replace(/[^a-z0-9]/gi,"")})`,fillOpacity:i,strokeWidth:1.5,dot:!1,isAnimationActive:f})]}):e.jsx(k,{data:g,children:e.jsx(P,{type:"monotone",dataKey:"value",stroke:n,strokeWidth:1.5,dot:!1,isAnimationActive:f})})})}),l&&e.jsxs("div",{className:"flex flex-col text-xs text-muted-foreground",children:[e.jsxs("span",{children:["↑ ",j]}),e.jsxs("span",{children:["↓ ",y]})]}),u&&e.jsx("span",{className:"text-sm font-medium",children:x})]})});Xr.displayName="WakaSparkline";function Bx({data:t,width:s,height:a,color:r,type:n,fillColor:o,fillOpacity:i}){const u=s-4,d=a-4,f=Math.min(...t),p=Math.max(...t)-f||1,w=t.map((g,y)=>{const j=2+y/(t.length-1||1)*u,x=2+d-(g-f)/p*d;return{x:j,y:x,value:g}});if(n==="bar"){const g=u/t.length-1;return e.jsx("svg",{width:s,height:a,children:t.map((y,j)=>{const x=(y-f)/p*d;return e.jsx("rect",{x:2+j*(g+1),y:2+d-x,width:g,height:x,fill:r,rx:1},j)})})}const C=w.map((g,y)=>`${y===0?"M":"L"} ${g.x} ${g.y}`).join(" ");if(n==="area"){const g=`${C} L ${w[w.length-1].x} ${a-2} L 2 ${a-2} Z`;return e.jsxs("svg",{width:s,height:a,children:[e.jsx("path",{d:g,fill:o||r,fillOpacity:i}),e.jsx("path",{d:C,fill:"none",stroke:r,strokeWidth:1.5})]})}return e.jsx("svg",{width:s,height:a,children:e.jsx("path",{d:C,fill:"none",stroke:r,strokeWidth:1.5})})}const Tl=c.forwardRef(({data:t,type:s="sparkline",width:a=80,height:r=24,color:n,showTrend:o=!0,valueFormatter:i,className:l},u)=>{const d=c.useMemo(()=>!t||t.length===0?[]:typeof t[0]=="number"?t:t.map(C=>{const g=C.value??Object.values(C).find(y=>typeof y=="number");return typeof g=="number"?g:0}),[t]),{trend:f,trendPercent:m,currentValue:p}=c.useMemo(()=>{if(d.length<2)return{trend:"neutral",trendPercent:0,currentValue:d[0]??0};const C=d[0],g=d[d.length-1],y=g-C,j=C!==0?y/C*100:0;return{trend:y>0?"up":y<0?"down":"neutral",trendPercent:j,currentValue:g}},[d]),w=c.useMemo(()=>n||(f==="up"?"hsl(var(--chart-2, 142 76% 36%))":f==="down"?"hsl(var(--destructive, 0 84% 60%))":"hsl(var(--muted-foreground, 220 9% 46%))"),[n,f]);return d.length===0?e.jsx("div",{ref:u,className:b("flex items-center gap-1 text-muted-foreground",l),children:e.jsx(h.Minus,{className:"h-3 w-3"})}):(i?i(p):p.toLocaleString(),e.jsxs("div",{ref:u,className:b("flex items-center gap-2",l),children:[e.jsx(Xr,{data:d,type:s==="sparkline"?"line":s,width:a,height:r,color:w,animation:!1}),o&&e.jsxs("div",{className:"flex items-center gap-1",children:[f==="up"&&e.jsx(h.TrendingUp,{className:"h-3 w-3 text-green-600 dark:text-green-400"}),f==="down"&&e.jsx(h.TrendingDown,{className:"h-3 w-3 text-red-600 dark:text-red-400"}),f==="neutral"&&e.jsx(h.Minus,{className:"h-3 w-3 text-muted-foreground"}),e.jsxs("span",{className:b("text-xs font-medium",f==="up"&&"text-green-600 dark:text-green-400",f==="down"&&"text-red-600 dark:text-red-400",f==="neutral"&&"text-muted-foreground"),children:[f!=="neutral"&&(m>0?"+":""),m.toFixed(1),"%"]})]})]}))});Tl.displayName="WakaMiniChart";function qx(t){const{accessorKey:s,header:a=String(s),chartType:r="sparkline",width:n=100,height:o=24,color:i,showValue:l=!1,valueFormatter:u}=t;return{accessorKey:s,header:a,size:n+(l?60:0),enableSorting:!1,enableColumnFilter:!1,cell:d=>{const f=d.getValue();let m=[];return Array.isArray(f)&&(typeof f[0]=="number"?m=f:typeof f[0]=="object"&&f[0]!==null&&(m=f.map(p=>{const w=p.value??Object.values(p).find(C=>typeof C=="number");return typeof w=="number"?w:0}))),{type:"chart",chartType:r,data:m,width:n,height:o,color:i,showTrend:!0,valueFormatter:u}},meta:{isChartColumn:!0,chartConfig:t}}}const Hx={cell:t=>{if(!Array.isArray(t))return null;let s=[];return typeof t[0]=="number"?s=t:typeof t[0]=="object"&&t[0]!==null&&(s=t.map(a=>{const r=a.value??Object.values(a).find(n=>typeof n=="number");return typeof r=="number"?r:0})),{type:"sparkline",data:s}},size:100,enableSorting:!1,enableFiltering:!1},Gx=["hsl(var(--chart-1))","hsl(var(--chart-2))","hsl(var(--chart-3))","hsl(var(--chart-4))","hsl(var(--chart-5))"],Xx={sm:{width:"100%",height:150},md:{width:"100%",height:250},lg:{width:"100%",height:350},xl:{width:"100%",height:450},auto:{width:"100%",height:300}},Kx=["#ef4444","#f97316","#f59e0b","#eab308","#84cc16","#22c55e","#10b981","#14b8a6","#06b6d4","#0ea5e9","#3b82f6","#6366f1","#8b5cf6","#a855f7","#d946ef","#ec4899","#f43f5e","#000000","#6b7280","#ffffff"];function Al(t,s,a){s/=100,a/=100;const r=s*Math.min(a,1-a),n=o=>{const i=(o+t/30)%12;return a-r*Math.max(Math.min(i-3,9-i,1),-1)};return[Math.round(n(0)*255),Math.round(n(8)*255),Math.round(n(4)*255)]}function _s(t,s,a){t/=255,s/=255,a/=255;const r=Math.max(t,s,a),n=Math.min(t,s,a);let o=0,i=0;const l=(r+n)/2;if(r!==n){const u=r-n;switch(i=l>.5?u/(2-r-n):u/(r+n),r){case t:o=((s-a)/u+(s<a?6:0))*60;break;case s:o=((a-t)/u+2)*60;break;case a:o=((t-s)/u+4)*60;break}}return[Math.round(o),Math.round(i*100),Math.round(l*100)]}function Yx(t){const s=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return s?[parseInt(s[1],16),parseInt(s[2],16),parseInt(s[3],16)]:null}function Qn(t,s,a){return"#"+[t,s,a].map(r=>r.toString(16).padStart(2,"0")).join("")}function pa(t){if(t.startsWith("#"))return Yx(t);const s=t.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/);if(s)return[parseInt(s[1]),parseInt(s[2]),parseInt(s[3])];const a=t.match(/hsl\((\d+),\s*(\d+)%?,\s*(\d+)%?\)/);return a?Al(parseInt(a[1]),parseInt(a[2]),parseInt(a[3])):null}function Zn(t,s,a,r){switch(r){case"hex":return Qn(t,s,a);case"rgb":return`rgb(${t}, ${s}, ${a})`;case"hsl":{const[n,o,i]=_s(t,s,a);return`hsl(${n}, ${o}%, ${i}%)`}default:return Qn(t,s,a)}}const Kr=c.forwardRef(({value:t="#3b82f6",onChange:s,format:a="hex",showAlpha:r=!1,showPresets:n=!0,presets:o=Kx,showEyeDropper:i=!0,disabled:l=!1,placeholder:u="Sélectionner une couleur",className:d,size:f="md"},m)=>{const[p,w]=c.useState(!1),[C,g]=c.useState(0),[y,j]=c.useState(100),[x,v]=c.useState(50),[k,N]=c.useState(t),D=c.useRef(null),P=c.useRef(null);c.useEffect(()=>{const q=pa(t);if(q){const[B,W,I]=_s(...q);g(B),j(W),v(I),N(t)}},[t]);const R=c.useCallback((q,B,W)=>{const[I,z,$]=Al(q,B,W),_=Zn(I,z,$,a);N(_),s?.(_)},[a,s]),A=q=>{q.preventDefault();const B=D.current?.getBoundingClientRect();if(!B)return;const W=($,_)=>{const F=Math.max(0,Math.min(100,($-B.left)/B.width*100)),H=Math.max(0,Math.min(100,100-(_-B.top)/B.height*100));j(F),v(H),R(C,F,H)};W(q.clientX,q.clientY);const I=$=>W($.clientX,$.clientY),z=()=>{document.removeEventListener("mousemove",I),document.removeEventListener("mouseup",z)};document.addEventListener("mousemove",I),document.addEventListener("mouseup",z)},S=q=>{q.preventDefault();const B=P.current?.getBoundingClientRect();if(!B)return;const W=$=>{const _=Math.max(0,Math.min(360,($-B.left)/B.width*360));g(_),R(_,y,x)};W(q.clientX);const I=$=>W($.clientX),z=()=>{document.removeEventListener("mousemove",I),document.removeEventListener("mouseup",z)};document.addEventListener("mousemove",I),document.addEventListener("mouseup",z)},M=async()=>{if("EyeDropper"in window)try{const B=await new window.EyeDropper().open(),W=pa(B.sRGBHex);if(W){const[I,z,$]=_s(...W);g(I),j(z),v($),R(I,z,$)}}catch{}},E=q=>{const B=q.target.value;N(B);const W=pa(B);if(W){const[I,z,$]=_s(...W);g(I),j(z),v($),s?.(Zn(...W,a))}},T={sm:"h-7 w-7",md:"h-9 w-9",lg:"h-11 w-11"},K=i&&typeof window<"u"&&"EyeDropper"in window;return e.jsxs(rt,{open:p,onOpenChange:w,children:[e.jsx(nt,{asChild:!0,children:e.jsx(L,{ref:m,variant:"outline",disabled:l,className:b("p-0.5 rounded-md border",T[f],d),title:u,children:e.jsx("div",{className:"w-full h-full rounded",style:{backgroundColor:t}})})}),e.jsx(st,{className:"w-64 p-3",align:"start",children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{ref:D,className:"relative w-full h-36 rounded cursor-crosshair",style:{background:`
25
25
  linear-gradient(to top, #000, transparent),
26
26
  linear-gradient(to right, #fff, transparent),
27
27
  hsl(${C}, 100%, 50%)
28
- `},onMouseDown:A,children:e.jsx("div",{className:"absolute w-4 h-4 border-2 border-white rounded-full shadow -translate-x-1/2 -translate-y-1/2 pointer-events-none",style:{left:`${y}%`,top:`${100-x}%`,backgroundColor:`hsl(${C}, ${y}%, ${x}%)`}})}),e.jsx("div",{ref:P,className:"relative w-full h-3 rounded cursor-pointer",style:{background:"linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00)"},onMouseDown:S,children:e.jsx("div",{className:"absolute w-3 h-5 border-2 border-white rounded -translate-x-1/2 -top-1 shadow pointer-events-none",style:{left:`${C/360*100}%`,backgroundColor:`hsl(${C}, 100%, 50%)`}})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded border flex-shrink-0",style:{backgroundColor:t}}),e.jsx(oe,{value:k,onChange:E,className:"h-8 text-sm font-mono",placeholder:a==="hex"?"#000000":a==="rgb"?"rgb(0,0,0)":"hsl(0,0%,0%)"}),K&&e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:M,title:"Pipette",children:e.jsx(h.Pipette,{className:"h-4 w-4"})})]}),n&&o.length>0&&e.jsxs("div",{children:[e.jsx(me,{className:"text-xs text-muted-foreground",children:"Couleurs prédéfinies"}),e.jsx("div",{className:"grid grid-cols-10 gap-1 mt-1",children:o.map(q=>e.jsx("button",{className:b("w-5 h-5 rounded border transition-transform hover:scale-110",t.toLowerCase()===q.toLowerCase()&&"ring-2 ring-primary ring-offset-1"),style:{backgroundColor:q},onClick:()=>{const B=ha(q);if(B){const[W,I,z]=_s(...B);g(W),j(I),v(z),R(W,I,z)}}},q))})]})]})})]})});qr.displayName="WakaColorPicker";const El=c.forwardRef(({error:t,label:s,className:a,...r},n)=>e.jsxs("div",{className:b("space-y-1.5",a),children:[s&&e.jsx(me,{htmlFor:r.name,children:s}),e.jsx(qr,{ref:n,...r}),t&&e.jsx("p",{className:"text-sm text-destructive",children:t})]}));El.displayName="WakaColorPickerForm";function Jx(t){const s=new Map;for(const a of t){const r=a.group;s.has(r)||s.set(r,[]),s.get(r).push(a)}return s}function Qx({options:t,value:s,onChange:a,placeholder:r="Sélectionner...",searchPlaceholder:n="Rechercher...",emptyMessage:o="Aucun résultat trouvé.",multiple:i=!1,creatable:l=!1,onCreate:u,createLabel:d="Créer",onSearch:f,searchDebounce:m=300,disabled:p=!1,error:w=!1,loading:C=!1,size:g="md",clearable:y=!0,maxSelections:j,className:x,id:v,name:k}){const[N,D]=c.useState(!1),[P,R]=c.useState(""),[A,S]=c.useState(t),[M,E]=c.useState(!1),[T,K]=c.useState([]),q=C||M;c.useEffect(()=>{f||S(t)},[t,f]),c.useEffect(()=>{if(!f)return;const U=setTimeout(async()=>{E(!0);try{const ae=await f(P);S(ae)}catch(ae){console.error("Search error:",ae)}finally{E(!1)}},m);return()=>clearTimeout(U)},[P,f,m]);const B=c.useMemo(()=>[...A,...T],[A,T]),W=c.useMemo(()=>{if(f||!P)return B;const U=P.toLowerCase();return B.filter(ae=>ae.label.toLowerCase().includes(U)||ae.description?.toLowerCase().includes(U))},[B,P,f]),I=c.useMemo(()=>s===void 0?[]:Array.isArray(s)?s:[s],[s]),z=c.useMemo(()=>B.filter(U=>I.some(ae=>ae===U.value)),[B,I]),$=U=>{if(!U.disabled)if(i){const ae=I.includes(U.value);let te;if(ae)te=I.filter(Z=>Z!==U.value);else{if(j&&I.length>=j)return;te=[...I,U.value]}a?.(te.length>0?te:void 0)}else{const ae=I.includes(U.value);a?.(ae?void 0:U.value),D(!1)}},_=async()=>{if(!(!l||!P.trim())){E(!0);try{let U;u?U=await u(P.trim()):U={value:P.trim(),label:P.trim()},K(ae=>[...ae,U]),$(U),R("")}catch(U){console.error("Creation error:",U)}finally{E(!1)}}},F=U=>{U.stopPropagation(),a?.(void 0),R("")},H=U=>{if(i){const ae=I.filter(te=>te!==U);a?.(ae.length>0?ae:void 0)}},J=c.useMemo(()=>{if(!l||!P.trim())return!1;const U=P.trim().toLowerCase();return!B.some(ae=>ae.label.toLowerCase()===U)},[l,P,B]),Q=c.useMemo(()=>Jx(W),[W]),ne=c.useMemo(()=>z.length===0?"":i?`${z.length} sélectionné${z.length>1?"s":""}`:z[0]?.label||"",[z,i]),X={sm:"h-8 text-xs",md:"h-9 text-sm",lg:"h-10 text-base"},Y={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"};return e.jsxs(rt,{open:N,onOpenChange:D,children:[e.jsx(nt,{asChild:!0,children:e.jsxs(L,{id:v,variant:"outline",role:"combobox","aria-expanded":N,disabled:p,className:b("w-full justify-between font-normal",X[g],!ne&&"text-muted-foreground",w&&"border-destructive focus-visible:ring-destructive",x),children:[e.jsx("span",{className:"flex-1 text-left truncate",children:ne||r}),e.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[q&&e.jsx(h.Loader2,{className:b(Y[g],"animate-spin")}),y&&I.length>0&&!p&&e.jsx(h.X,{className:b(Y[g],"opacity-50 hover:opacity-100"),onClick:F}),e.jsx(h.ChevronsUpDown,{className:b(Y[g],"opacity-50")})]})]})}),e.jsx(st,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(ss,{shouldFilter:!1,children:[e.jsx(xs,{placeholder:n,value:P,onValueChange:R}),e.jsxs(ea,{children:[q&&e.jsx("div",{className:"flex items-center justify-center py-6",children:e.jsx(h.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!q&&W.length===0&&!J&&e.jsx(gs,{children:o}),!q&&Array.from(Q.entries()).map(([U,ae],te)=>e.jsxs(c.Fragment,{children:[te>0&&e.jsx(ja,{}),e.jsx(Ot,{heading:U,children:ae.map(Z=>{const le=I.includes(Z.value);return e.jsxs(zt,{value:String(Z.value),onSelect:()=>$(Z),disabled:Z.disabled||i&&!!j&&I.length>=j&&!le,className:b("flex items-center gap-2",Z.disabled&&"opacity-50"),children:[e.jsx("div",{className:b("flex items-center justify-center w-4 h-4 border rounded",le?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30"),children:le&&e.jsx(h.Check,{className:"h-3 w-3"})}),Z.icon&&e.jsx("span",{className:"flex-shrink-0",children:Z.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"truncate",children:Z.label}),Z.description&&e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:Z.description})]})]},String(Z.value))})})]},U||"ungrouped")),J&&e.jsxs(e.Fragment,{children:[e.jsx(ja,{}),e.jsx(Ot,{children:e.jsxs(zt,{onSelect:_,className:"flex items-center gap-2",children:[e.jsx(h.Plus,{className:Y[g]}),e.jsxs("span",{children:[d,' "',P.trim(),'"']})]})})]})]})]})}),k&&e.jsx("input",{type:"hidden",name:k,value:i?I.join(","):String(I[0]||"")}),i&&z.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:z.map(U=>e.jsxs(Se,{variant:"secondary",className:"gap-1",children:[U.icon,U.label,e.jsx(h.X,{className:"h-3 w-3 cursor-pointer hover:text-destructive",onClick:()=>H(U.value)})]},String(U.value)))})]})}function Zx(t={}){const{options:s=[],initialValue:a,multiple:r=!1}=t,[n,o]=c.useState(a),[i,l]=c.useState(s);return{value:n,onChange:o,options:i,setOptions:l,clear:()=>o(void 0),addOption:w=>{l(C=>[...C,w])},removeOption:w=>{l(C=>C.filter(g=>g.value!==w)),r&&Array.isArray(n)?o(n.filter(C=>C!==w)):n===w&&o(void 0)},selectAll:()=>{r&&o(i.filter(w=>!w.disabled).map(w=>w.value))},selectNone:()=>o(r?[]:void 0),multiple:r}}const Ml=[{label:"Aujourd'hui",getValue:()=>({from:V.startOfDay(new Date),to:V.endOfDay(new Date)})},{label:"Hier",getValue:()=>({from:V.startOfDay(V.subDays(new Date,1)),to:V.endOfDay(V.subDays(new Date,1))})},{label:"7 derniers jours",getValue:()=>({from:V.startOfDay(V.subDays(new Date,6)),to:V.endOfDay(new Date)})},{label:"30 derniers jours",getValue:()=>({from:V.startOfDay(V.subDays(new Date,29)),to:V.endOfDay(new Date)})},{label:"Ce mois",getValue:()=>({from:V.startOfMonth(new Date),to:V.endOfMonth(new Date)})},{label:"Mois dernier",getValue:()=>({from:V.startOfMonth(V.subMonths(new Date,1)),to:V.endOfMonth(V.subMonths(new Date,1))})},{label:"Cette année",getValue:()=>({from:V.startOfYear(new Date),to:V.endOfDay(new Date)})}];function eg({value:t,onChange:s,placeholder:a="Sélectionner une période",dateFormat:r="dd/MM/yyyy",minDate:n,maxDate:o,disabled:i=!1,error:l=!1,showPresets:u=!0,presets:d=Ml,numberOfMonths:f=2,locale:m=ps,size:p="md",className:w,id:C,name:g,clearable:y=!0}){const[j,x]=c.useState(!1),[v,k]=c.useState(t);c.useEffect(()=>{k(t)},[t]);const N=E=>{k(E),s?.(E)},D=E=>{const T=E.getValue();N(T),x(!1)},P=E=>{E.stopPropagation(),N(void 0)},R=c.useMemo(()=>{if(!v?.from)return"";const E=V.format(v.from,r,{locale:m});if(!v.to)return E;const T=V.format(v.to,r,{locale:m});return`${E} - ${T}`},[v,r,m]),A={sm:"h-8 text-xs px-2",md:"h-9 text-sm px-3",lg:"h-10 text-base px-4"},S={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},M=c.useMemo(()=>{const E=[];return n&&E.push(T=>V.isBefore(T,V.startOfDay(n))),o&&E.push(T=>V.isAfter(T,V.endOfDay(o))),E.length>0?T=>E.some(K=>K(T)):void 0},[n,o]);return e.jsxs(rt,{open:j,onOpenChange:x,children:[e.jsx(nt,{asChild:!0,children:e.jsxs(L,{id:C,variant:"outline",role:"combobox","aria-expanded":j,disabled:i,className:b("w-full justify-start font-normal",A[p],!R&&"text-muted-foreground",l&&"border-destructive focus-visible:ring-destructive",w),children:[e.jsx(h.Calendar,{className:b(S[p],"mr-2")}),e.jsx("span",{className:"flex-1 text-left truncate",children:R||a}),y&&R&&!i&&e.jsx(h.X,{className:b(S[p],"ml-2 opacity-50 hover:opacity-100"),onClick:P})]})}),e.jsxs(st,{className:"w-auto p-0",align:"start",children:[e.jsxs("div",{className:"flex",children:[u&&d.length>0&&e.jsx("div",{className:"border-r p-2 space-y-1",children:d.map((E,T)=>e.jsx(L,{variant:"ghost",size:"sm",className:"w-full justify-start text-xs",onClick:()=>D(E),children:E.label},T))}),e.jsx("div",{className:"p-3",children:e.jsx(ka,{mode:"range",selected:v,onSelect:N,numberOfMonths:f,locale:m,disabled:M,initialFocus:!0})})]}),e.jsxs("div",{className:"border-t p-3 flex justify-between items-center",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:v?.from&&v?.to&&e.jsxs(e.Fragment,{children:[Math.ceil((v.to.getTime()-v.from.getTime())/(1e3*60*60*24))+1," ","jours sélectionnés"]})}),e.jsxs("div",{className:"flex gap-2",children:[y&&e.jsx(L,{variant:"ghost",size:"sm",onClick:()=>N(void 0),children:"Effacer"}),e.jsx(L,{size:"sm",onClick:()=>x(!1),children:"Appliquer"})]})]})]})]})}function tg(t={}){const{initialValue:s,minDate:a,maxDate:r}=t,[n,o]=c.useState(s),i=()=>o(void 0),l=()=>{o({from:V.startOfDay(new Date),to:V.endOfDay(new Date)})},u=()=>{o({from:V.startOfDay(V.subDays(new Date,6)),to:V.endOfDay(new Date)})},d=()=>{o({from:V.startOfMonth(new Date),to:V.endOfMonth(new Date)})},f=p=>!(!p?.from||!p?.to||!V.isValid(p.from)||!V.isValid(p.to)||V.isAfter(p.from,p.to)||a&&V.isBefore(p.from,V.startOfDay(a))||r&&V.isAfter(p.to,V.endOfDay(r)));return{value:n,onChange:o,clear:i,setToday:l,setThisWeek:u,setThisMonth:d,isValidRange:()=>f(n),dayCount:!n?.from||!n?.to?null:Math.ceil((n.to.getTime()-n.from.getTime())/(1e3*60*60*24))+1,minDate:a,maxDate:r}}let eo=!1,lr=null;!eo&&!$t.isInitialized&&(eo=!0,lr=$t.use(wt.initReactI18next).init({resources:{},fallbackLng:"fr",lng:"fr",defaultNS:"translation",ns:["translation"],debug:!1,interpolation:{escapeValue:!1},react:{useSuspense:!1},ignoreJSONStructure:!0,returnNull:!1,returnEmptyString:!1,returnObjects:!1,load:"languageOnly",detection:void 0,initImmediate:!0}).then(()=>(console.log("[i18n] Initialized successfully"),$t)).catch(t=>(console.error("[i18n] Failed to initialize:",t),$t)));function Pl(){const[t,s]=O.useState($t.isInitialized);return O.useEffect(()=>{if($t.isInitialized){s(!0);return}if(lr)lr.then(()=>{s(!0)});else{const a=setTimeout(()=>{s(!0)},100);return()=>clearTimeout(a)}},[]),!t||!$t.isInitialized?{t:a=>a,i18n:$t,ready:!1}:wt.useTranslation()}_t.registerLocale("fr",ps);_t.registerLocale("en",Fo);_t.registerLocale("es",$o);_t.registerLocale("de",Ro);_t.registerLocale("it",Lo);_t.registerLocale("pt",Oo);_t.registerLocale("ja",Io);_t.registerLocale("zh",zo);const Hr=c.forwardRef(({value:t,onChange:s,placeholder:a,disabled:r=!1,className:n,variant:o="date",format:i,minDate:l,maxDate:u,showSeconds:d=!1,showClear:f=!0,showPresets:m=!1,presets:p,locale:w="fr",timeFormat:C="24h",size:g="md",error:y,label:j,required:x=!1,inline:v=!1,monthsShown:k=1,timeIntervals:N=15,validation:D,showWeekNumbers:P=!1,showTodayButton:R=!0,showSelectionInfo:A=!1,allowTimeRange:S=!1,timezone:M,onBeforeChange:E,onAfterChange:T,renderDay:K,popoverClassName:q,disableAnimations:B=!1,readOnly:W=!1,id:I,name:z,autoFocus:$=!1},_)=>{const{t:F}=Pl(),[H,J]=c.useState(!1),[Q,ne]=c.useState(o==="range"&&t&&!("from"in t)?{from:t,to:void 0}:t),[X,Y]=c.useState(null),[U,ae]=c.useState(null),Z={fr:ps,en:Fo,es:$o,de:Ro,it:Lo,pt:Oo,ja:Io,zh:zo}[w]||ps,le=[{label:F?.("today")||"Aujourd'hui",value:()=>new Date},{label:F?.("yesterday")||"Hier",value:()=>V.subDays(new Date,1)},{label:F?.("thisWeek")||"Cette semaine",range:()=>({from:V.startOfWeek(new Date,{locale:Z}),to:V.endOfWeek(new Date,{locale:Z})})},{label:F?.("lastWeek")||"Semaine dernière",range:()=>({from:V.startOfWeek(V.subWeeks(new Date,1),{locale:Z}),to:V.endOfWeek(V.subWeeks(new Date,1),{locale:Z})})},{label:F?.("thisMonth")||"Ce mois",range:()=>({from:V.startOfMonth(new Date),to:V.endOfMonth(new Date)})},{label:F?.("lastMonth")||"Mois dernier",range:()=>({from:V.startOfMonth(V.subMonths(new Date,1)),to:V.endOfMonth(V.subMonths(new Date,1))})},{label:F?.("last7Days")||"7 derniers jours",range:()=>({from:V.subDays(new Date,7),to:new Date})},{label:F?.("last30Days")||"30 derniers jours",range:()=>({from:V.subDays(new Date,30),to:new Date})},{label:F?.("thisYear")||"Cette année",range:()=>({from:V.startOfYear(new Date),to:V.endOfYear(new Date)})}],xe=p||(m?le:[]),se={sm:"h-8 px-3 text-xs",md:"h-10 px-4 text-sm",lg:"h-12 px-5 text-base"},De=i||(()=>{switch(o){case"time":return d?C==="12h"?"h:mm:ss a":"HH:mm:ss":C==="12h"?"h:mm a":"HH:mm";case"datetime":return d?C==="12h"?"PPP h:mm:ss a":"PPP HH:mm:ss":C==="12h"?"PPP h:mm a":"PPP HH:mm";case"range":return"PPP";case"multiple":return"PPP";default:return"PPP"}})(),Ne=ee=>{if(!D)return null;if(l&&V.isBefore(ee,V.startOfDay(l)))return F?.("dateBeforeMin")||`Date antérieure au ${V.format(l,De,{locale:Z})}`;if(u&&V.isAfter(ee,V.endOfDay(u)))return F?.("dateAfterMax")||`Date postérieure au ${V.format(u,De,{locale:Z})}`;if(D.disabledDates?.some(re=>V.isEqual(V.startOfDay(re),V.startOfDay(ee)))||D.disabledDatesFn?.(ee))return D.message||F?.("dateDisabled")||"Date désactivée";if(D.disabledDaysOfWeek?.includes(ee.getDay()))return D.message||F?.("dayOfWeekDisabled")||"Jour de la semaine désactivé";if(D.validate){const re=D.validate(ee);if(re===!1)return D.message||F?.("invalidDate")||"Date invalide";if(typeof re=="string")return re}return null},Ke=ee=>{if(W)return;let re=null;if(o==="range"){if(Array.isArray(ee)&&ee[0]&&ee[1])re={from:ee[0],to:ee[1]};else if(ee){const we=Q;we?.from&&!we.to?re={from:we.from,to:ee}:re={from:ee,to:void 0}}}else if(o==="multiple")if(Array.isArray(Q)){const we=[...Q],be=we.findIndex(Mt=>V.isEqual(V.startOfDay(Mt),V.startOfDay(ee)));be>=0?we.splice(be,1):we.push(ee),re=we}else re=ee?[ee]:[];else re=ee;if(!(E&&!E(re))){if(re&&!re.from&&!Array.isArray(re)){const we=Ne(re);if(we){Y(we);return}}Y(null),ne(re),s?.(re),T?.(re),o!=="range"&&o!=="multiple"&&!v&&J(!1)}},xt=ee=>{if(ee.range){const re=typeof ee.range=="function"?ee.range():ee.range;Ke([re.from,re.to])}else if(ee.value){const re=typeof ee.value=="function"?ee.value():ee.value;Ke(re)}v||J(!1)},Ye=ee=>{ee&&ee.stopPropagation(),!W&&(ne(null),Y(null),s?.(null),T?.(null))},et=()=>{Ke(new Date)},gt=()=>{if(!Q)return a||F?.("selectDate")||"Sélectionner une date";try{if(o==="range"){const ee=Q;return ee.from&&ee.to?`${V.format(ee.from,De,{locale:Z})} - ${V.format(ee.to,De,{locale:Z})}`:ee.from?`${V.format(ee.from,De,{locale:Z})} - ...`:a||F?.("selectDateRange")||"Sélectionner une période"}if(o==="multiple"){const ee=Q;return ee.length===0?a||F?.("selectDates")||"Sélectionner des dates":ee.length===1?V.format(ee[0],De,{locale:Z}):`${ee.length} ${F?.("datesSelected")||"dates sélectionnées"}`}return V.format(Q,De,{locale:Z})}catch(ee){return console.error("Error formatting date:",ee),a||F?.("selectDate")||"Sélectionner une date"}},Et=ee=>!!(l&&V.isBefore(ee,V.startOfDay(l))||u&&V.isAfter(ee,V.endOfDay(u))||D?.disabledDates?.some(re=>V.isEqual(V.startOfDay(re),V.startOfDay(ee)))||D?.disabledDatesFn?.(ee)||D?.disabledDaysOfWeek?.includes(ee.getDay())),Je=ee=>!!(D?.highlightedDates?.some(re=>V.isEqual(V.startOfDay(re),V.startOfDay(ee)))||D?.highlightedDatesFn?.(ee)),G=()=>{const ee={selected:o==="range"?Q?.from:o==="multiple"?void 0:Q,onChange:Ke,startDate:o==="range"?Q?.from:void 0,endDate:o==="range"?Q?.to:void 0,selectsRange:o==="range",selectsMultiple:o==="multiple",highlightDates:o==="multiple"?Q:void 0,showTimeSelect:o==="time"||o==="datetime",showTimeSelectOnly:o==="time",timeFormat:d?C==="12h"?"h:mm:ss aa":"HH:mm:ss":C==="12h"?"h:mm aa":"HH:mm",timeIntervals:N,timeCaption:F?.("time")||"Heure",dateFormat:De,locale:w,placeholderText:a,disabled:r,minDate:l,maxDate:u,inline:v,monthsShown:o==="range"?Math.max(2,k):k,showWeekNumbers:P,filterDate:re=>!Et(re),dayClassName:re=>{const we=[];if(Je(re)&&we.push("highlighted-date"),U&&o==="range"){const be=Q;be?.from&&!be.to&&V.isWithinInterval(re,{start:be.from<U?be.from:U,end:be.from>U?be.from:U})&&we.push("in-selecting-range")}return we.join(" ")},onDayMouseEnter:re=>ae(re),calendarClassName:b("waka-datepicker",B&&"no-animations"),wrapperClassName:"w-full",autoFocus:$};return e.jsxs("div",{className:"flex gap-3",children:[m&&xe.length>0&&e.jsxs("div",{className:"flex flex-col gap-1 min-w-[150px] border-r border-border pr-3",children:[e.jsx(me,{className:"text-xs font-semibold text-muted-foreground mb-1",children:F?.("quickSelection")||"Sélection rapide"}),e.jsx(At,{className:"h-[300px]",children:e.jsx("div",{className:"space-y-1",children:xe.map((re,we)=>e.jsx(L,{variant:"ghost",size:"sm",className:"w-full justify-start text-xs",onClick:()=>xt(re),children:re.label},we))})})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx(_t,{...ee}),A&&Q&&e.jsxs("div",{className:"mt-3 p-2 bg-muted rounded-md text-xs space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.Info,{className:"h-3 w-3 text-muted-foreground"}),e.jsxs("span",{className:"font-medium",children:[F?.("selection")||"Sélection"," :"]})]}),e.jsx("div",{className:"text-muted-foreground pl-5",children:gt()})]})]})]})};return v?e.jsxs("div",{ref:_,className:b("space-y-2",n),id:I,children:[j&&e.jsxs(me,{className:"text-sm font-medium text-foreground",children:[j,x&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.jsx("div",{className:"border border-border rounded-lg p-4 bg-card",children:G()}),(y||X)&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-destructive",children:[e.jsx(h.AlertCircle,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:y||X})]})]}):e.jsxs("div",{ref:_,className:b("space-y-2",n),id:I,children:[j&&e.jsxs(me,{htmlFor:`${I}-input`,className:"text-sm font-medium text-foreground",children:[j,x&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.jsxs(rt,{open:H,onOpenChange:J,children:[e.jsx(nt,{asChild:!0,children:e.jsxs(L,{id:`${I}-input`,name:z,variant:"outline",disabled:r||W,className:b("w-full justify-between text-left font-normal",!Q&&"text-muted-foreground",se[g],(y||X)&&"border-destructive focus-visible:ring-destructive",W&&"cursor-default opacity-70"),"aria-label":j||a,"aria-invalid":!!(y||X),"aria-required":x,children:[e.jsxs("span",{className:"flex items-center gap-2 flex-1 truncate",children:[o==="time"?e.jsx(h.Clock,{className:"h-4 w-4 flex-shrink-0"}):e.jsx(h.Calendar,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:gt()})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 ml-2",children:[Q&&f&&!W&&e.jsx(Ks,{children:e.jsxs(Ys,{children:[e.jsx(Js,{asChild:!0,children:e.jsx("div",{className:"h-5 w-5 rounded hover:bg-destructive/10 flex items-center justify-center cursor-pointer",onClick:Ye,role:"button","aria-label":F?.("clear")||"Effacer",children:e.jsx(h.X,{className:"h-3 w-3 text-muted-foreground hover:text-destructive"})})}),e.jsx(ks,{children:e.jsx("p",{children:F?.("clear")||"Effacer"})})]})}),X&&e.jsx(Ks,{children:e.jsxs(Ys,{children:[e.jsx(Js,{asChild:!0,children:e.jsx(h.AlertCircle,{className:"h-4 w-4 text-destructive"})}),e.jsx(ks,{children:e.jsx("p",{children:X})})]})})]})]})}),e.jsxs(st,{className:b("w-auto p-0",q),align:"start",sideOffset:4,children:[e.jsx("div",{className:"p-4",children:G()}),(R||f)&&e.jsxs(e.Fragment,{children:[e.jsx(kt,{}),e.jsxs("div",{className:"flex items-center justify-between p-3 gap-2",children:[R&&e.jsxs(L,{variant:"outline",size:"sm",onClick:et,disabled:r||W,children:[e.jsx(h.Calendar,{className:"h-3.5 w-3.5 mr-1.5"}),F?.("today")||"Aujourd'hui"]}),f&&Q&&e.jsxs(L,{variant:"outline",size:"sm",onClick:Ye,disabled:r||W,className:"ml-auto",children:[e.jsx(h.X,{className:"h-3.5 w-3.5 mr-1.5"}),F?.("clear")||"Effacer"]})]})]})]})]}),(y||X)&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-destructive",children:[e.jsx(h.AlertCircle,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:y||X})]})]})});Hr.displayName="WakaDateTimePicker";function sg({name:t,control:s,defaultValue:a,...r}){return e.jsx(hi,{name:t,control:s,defaultValue:a,render:({field:n,fieldState:o})=>e.jsx(Hr,{...r,value:n.value,onChange:n.onChange,error:o.error?.message})})}function ag(t){return c.useMemo(()=>({formatDateForSubmit:a=>a?a.toISOString():null,formatRangeForSubmit:a=>!a?.from||!a?.to?null:{from:a.from.toISOString(),to:a.to.toISOString()},parseDateFromServer:a=>a?new Date(a):null,parseRangeFromServer:a=>a?{from:new Date(a.from),to:new Date(a.to)}:null}),[])}const rg={left:{sm:"w-64",md:"w-80",lg:"w-96",xl:"w-[480px]",full:"w-screen"},right:{sm:"w-64",md:"w-80",lg:"w-96",xl:"w-[480px]",full:"w-screen"},top:{sm:"h-32",md:"h-48",lg:"h-64",xl:"h-96",full:"h-screen"},bottom:{sm:"h-32",md:"h-48",lg:"h-64",xl:"h-96",full:"h-screen"}},ng={left:"left-0 top-0 h-full",right:"right-0 top-0 h-full",top:"top-0 left-0 w-full",bottom:"bottom-0 left-0 w-full"},og={left:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left",right:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right",top:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom"},Gr=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b("flex flex-col space-y-1.5 p-4 border-b",t),...s}));Gr.displayName="DrawerHeader";const Xr=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b("flex-1 overflow-auto p-4",t),...s}));Xr.displayName="DrawerBody";const Kr=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b("flex items-center justify-end gap-2 p-4 border-t",t),...s}));Kr.displayName="DrawerFooter";const Yr=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Title,{ref:a,className:b("text-lg font-semibold leading-none tracking-tight",t),...s}));Yr.displayName="DrawerTitle";const Jr=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Description,{ref:a,className:b("text-sm text-muted-foreground",t),...s}));Jr.displayName="DrawerDescription";function ig({open:t,onOpenChange:s,position:a="right",size:r="md",title:n,description:o,showCloseButton:i=!0,closeOnOverlayClick:l=!0,closeOnEscape:u=!0,showOverlay:d=!0,children:f,footer:m,className:p,contentClassName:w}){const C=y=>{l||y.preventDefault()},g=y=>{u||y.preventDefault()};return e.jsx(ue.Root,{open:t,onOpenChange:s,children:e.jsxs(ue.Portal,{children:[d&&e.jsx(ue.Overlay,{className:b("fixed inset-0 z-50 bg-black/50","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0")}),e.jsxs(ue.Content,{onPointerDownOutside:C,onEscapeKeyDown:g,className:b("fixed z-50 bg-background shadow-lg flex flex-col","duration-300 ease-in-out",ng[a],rg[a][r],og[a],p),children:[(n||o||i)&&e.jsx(Gr,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[n&&e.jsx(Yr,{children:n}),o&&e.jsx(Jr,{children:o})]}),i&&e.jsxs(ue.Close,{className:"rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[e.jsx(h.X,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Fermer"})]})]})}),e.jsx(Xr,{className:w,children:f}),m&&e.jsx(Kr,{children:m})]})]})})}function lg(t={}){const{defaultOpen:s=!1,onOpen:a,onClose:r}=t,[n,o]=c.useState(s),i=c.useCallback(f=>{o(f),f?a?.():r?.()},[a,r]),l=c.useCallback(()=>i(!0),[i]),u=c.useCallback(()=>i(!1),[i]),d=c.useCallback(()=>i(!n),[i,n]);return{open:n,onOpenChange:i,openDrawer:l,closeDrawer:u,toggleDrawer:d}}const cg=ue.Trigger,dg=ue.Close;function Ka(t){if(t===0)return"0 Bytes";const s=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(t)/Math.log(s));return`${parseFloat((t/Math.pow(s,r)).toFixed(2))} ${a[r]}`}function ug(t){const s=t.type;return s.startsWith("image/")?h.Image:s.includes("pdf")?h.FileText:s.includes("spreadsheet")||s.includes("excel")||s.includes("csv")?h.FileSpreadsheet:s.includes("zip")||s.includes("archive")||s.includes("compressed")?h.FileArchive:h.File}const Rl=c.forwardRef(({variant:t="dropzone",accept:s,maxSize:a=10*1024*1024,maxFiles:r=5,multiple:n=!1,onUpload:o,onComplete:i,onRemove:l,onError:u,showPreview:d=!0,showProgress:f=!0,disabled:m=!1,className:p,placeholder:w="Glissez vos fichiers ici ou cliquez pour sélectionner",label:C,description:g},y)=>{const[j,x]=c.useState([]),[v,k]=c.useState(!1),N=c.useRef(null),D=()=>`${Date.now()}-${Math.random().toString(36).slice(2,11)}`,P=W=>a&&W.size>a?`Le fichier dépasse la taille maximale de ${Ka(a)}`:s&&!s.split(",").map($=>$.trim()).some($=>$.startsWith(".")?W.name.toLowerCase().endsWith($.toLowerCase()):$.endsWith("/*")?W.type.startsWith($.replace("/*","/")):W.type===$)?`Type de fichier non accepté. Types acceptés: ${s}`:null,R=async W=>{const I=Array.from(W),z=j.filter(J=>J.status!=="error").length,$=r-z,_=I.slice(0,$);I.length>$&&u?.(`Nombre maximum de fichiers atteint (${r})`);const F=_.map(J=>({id:D(),file:J,progress:0,status:"pending"})),H=[];for(const J of F){const Q=P(J.file);Q&&(J.status="error",J.error=Q,u?.(Q,J.file)),H.push(J)}if(x(J=>[...J,...H]),o)for(const J of H.filter(Q=>Q.status==="pending"))try{x(ne=>ne.map(X=>X.id===J.id?{...X,status:"uploading"}:X));const Q=await o(J.file,ne=>{x(X=>X.map(Y=>Y.id===J.id?{...Y,progress:ne}:Y))});x(ne=>ne.map(X=>X.id===J.id?{...X,status:"success",progress:100,url:Q}:X))}catch(Q){const ne=Q instanceof Error?Q.message:"Erreur d'upload";x(X=>X.map(Y=>Y.id===J.id?{...Y,status:"error",error:ne}:Y)),u?.(ne,J.file)}else x(J=>J.map(Q=>H.some(ne=>ne.id===Q.id)&&Q.status==="pending"?{...Q,status:"success",progress:100}:Q))};c.useEffect(()=>{j.length>0&&j.every(I=>I.status!=="pending"&&I.status!=="uploading")&&i?.(j)},[j,i]);const A=W=>{if(W.preventDefault(),k(!1),m)return;const I=W.dataTransfer.files;I.length>0&&R(n?I:[I[0]])},S=W=>{const I=W.target.files;I&&I.length>0&&R(n?I:[I[0]]),W.target.value=""},M=W=>{x(I=>I.filter(z=>z.id!==W.id)),l?.(W)},E=()=>{m||N.current?.click()},T=()=>e.jsx("div",{className:b("relative border-2 border-dashed rounded-lg p-6 transition-colors",v&&"border-primary bg-primary/5",m&&"opacity-50 cursor-not-allowed",!m&&"cursor-pointer hover:border-primary/50",p),onDragOver:W=>{W.preventDefault(),m||k(!0)},onDragLeave:()=>k(!1),onDrop:A,onClick:E,children:e.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[e.jsx(h.Upload,{className:b("h-10 w-10 mb-3",v?"text-primary":"text-muted-foreground")}),e.jsx("p",{className:"text-sm font-medium",children:w}),g&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:g}),a&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Taille max: ",Ka(a)]})]})}),K=()=>e.jsxs(L,{variant:"outline",disabled:m,onClick:E,className:p,children:[e.jsx(h.Upload,{className:"h-4 w-4 mr-2"}),w||"Sélectionner un fichier"]}),q=()=>e.jsxs("div",{className:b("flex items-center gap-2 p-2 border rounded-lg",m&&"opacity-50 cursor-not-allowed",!m&&"cursor-pointer hover:bg-muted/50",p),onClick:E,children:[e.jsx(h.Upload,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:w||"Ajouter un fichier"})]}),B=W=>{const I=ug(W.file),z=W.file.type.startsWith("image/");return e.jsxs("div",{className:b("flex items-center gap-3 p-2 rounded-lg border",W.status==="error"&&"border-destructive bg-destructive/5"),children:[e.jsx("div",{className:"w-10 h-10 rounded flex items-center justify-center bg-muted overflow-hidden flex-shrink-0",children:d&&z&&W.status!=="error"?e.jsx("img",{src:URL.createObjectURL(W.file),alt:W.file.name,className:"w-full h-full object-cover"}):e.jsx(I,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:W.file.name}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:Ka(W.file.size)}),W.status==="error"&&e.jsxs("span",{className:"text-destructive flex items-center gap-1",children:[e.jsx(h.AlertCircle,{className:"h-3 w-3"}),W.error]}),W.status==="success"&&e.jsxs("span",{className:"text-green-600 flex items-center gap-1",children:[e.jsx(h.Check,{className:"h-3 w-3"}),"Uploadé"]})]}),f&&W.status==="uploading"&&e.jsx(Xs,{value:W.progress,className:"h-1 mt-1"})]}),e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8 flex-shrink-0",onClick:$=>{$.stopPropagation(),M(W)},children:e.jsx(h.X,{className:"h-4 w-4"})})]},W.id)};return e.jsxs("div",{ref:y,className:"space-y-3",children:[C&&e.jsx(me,{children:C}),e.jsx("input",{ref:N,type:"file",accept:s,multiple:n,onChange:S,className:"sr-only",disabled:m}),t==="dropzone"&&T(),t==="button"&&K(),t==="inline"&&q(),j.length>0&&e.jsx("div",{className:"space-y-2",children:j.map(B)})]})});Rl.displayName="WakaFileUpload";function Fl({src:t,alt:s,width:a,height:r,placeholder:n,placeholderColor:o="bg-muted",lazy:i=!0,zoomable:l=!1,maxZoom:u=3,objectFit:d="cover",objectPosition:f="center",rounded:m="md",showLoader:p=!0,onLoad:w,onError:C,onZoomChange:g,className:y,containerClassName:j,aspectRatio:x}){const[v,k]=c.useState(!1),[N,D]=c.useState(!1),[P,R]=c.useState(!1),[A,S]=c.useState(1),[M,E]=c.useState({x:0,y:0}),[T,K]=c.useState(!1),[q,B]=c.useState({x:0,y:0}),W=c.useRef(null),I={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl",full:"rounded-full"},z=()=>{k(!0),w?.()},$=()=>{D(!0),C?.()},_=()=>{l&&(R(!0),S(1),E({x:0,y:0}))},F=()=>{const U=Math.min(A+.5,u);S(U),g?.(U)},H=()=>{const U=Math.max(A-.5,1);S(U),U===1&&E({x:0,y:0}),g?.(U)},J=U=>{U.preventDefault(),U.deltaY<0?F():H()},Q=U=>{A>1&&(K(!0),B({x:U.clientX-M.x,y:U.clientY-M.y}))},ne=U=>{T&&A>1&&E({x:U.clientX-q.x,y:U.clientY-q.y})},X=()=>{K(!1)},Y=async()=>{try{const ae=await(await fetch(t)).blob(),te=window.URL.createObjectURL(ae),Z=document.createElement("a");Z.href=te,Z.download=s||"image",document.body.appendChild(Z),Z.click(),document.body.removeChild(Z),window.URL.revokeObjectURL(te)}catch(U){console.error("Failed to download image:",U)}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:b("relative overflow-hidden",I[m],j),style:{width:a,height:r,aspectRatio:x},children:[(!v||N)&&e.jsx("div",{className:b("absolute inset-0 flex items-center justify-center",o,I[m]),children:n?e.jsx("img",{src:n,alt:"",className:b("w-full h-full",`object-${d}`),style:{objectPosition:f}}):N?e.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[e.jsx(h.ImageIcon,{className:"h-8 w-8"}),e.jsx("span",{className:"text-xs",children:"Erreur de chargement"})]}):p?e.jsx("div",{className:"animate-pulse",children:e.jsx(h.ImageIcon,{className:"h-8 w-8 text-muted-foreground"})}):null}),!N&&e.jsx("img",{ref:W,src:t,alt:s,loading:i?"lazy":"eager",onLoad:z,onError:$,onClick:_,className:b("w-full h-full transition-opacity duration-300",`object-${d}`,v?"opacity-100":"opacity-0",l&&"cursor-zoom-in",I[m],y),style:{objectPosition:f}}),l&&v&&!N&&e.jsx("div",{className:"absolute bottom-2 right-2 p-1 bg-black/50 rounded text-white",children:e.jsx(h.Maximize2,{className:"h-4 w-4"})})]}),l&&e.jsx(It,{open:P,onOpenChange:R,children:e.jsxs(Tt,{className:"max-w-[95vw] max-h-[95vh] p-0 overflow-hidden bg-black/95",onWheel:J,children:[e.jsxs("div",{className:"absolute top-4 right-4 z-50 flex gap-2",children:[e.jsx(L,{variant:"secondary",size:"icon",onClick:H,disabled:A<=1,children:e.jsx(h.ZoomOut,{className:"h-4 w-4"})}),e.jsx(L,{variant:"secondary",size:"icon",onClick:F,disabled:A>=u,children:e.jsx(h.ZoomIn,{className:"h-4 w-4"})}),e.jsx(L,{variant:"secondary",size:"icon",onClick:Y,children:e.jsx(h.Download,{className:"h-4 w-4"})}),e.jsx(Xo,{asChild:!0,children:e.jsx(L,{variant:"secondary",size:"icon",children:e.jsx(h.X,{className:"h-4 w-4"})})})]}),e.jsxs("div",{className:"absolute bottom-4 left-4 z-50 text-white text-sm bg-black/50 px-2 py-1 rounded",children:[Math.round(A*100),"%"]}),e.jsx("div",{className:b("w-full h-full flex items-center justify-center overflow-hidden",A>1?"cursor-grab":"cursor-default",T&&"cursor-grabbing"),onMouseDown:Q,onMouseMove:ne,onMouseUp:X,onMouseLeave:X,children:e.jsx("img",{src:t,alt:s,className:"max-w-none select-none",style:{transform:`scale(${A}) translate(${M.x/A}px, ${M.y/A}px)`,transition:T?"none":"transform 0.2s ease-out"},draggable:!1})})]})})]})}function mg({images:t,columns:s=3,gap:a=4,aspectRatio:r="1/1",className:n}){return e.jsx("div",{className:b("grid",n),style:{gridTemplateColumns:`repeat(${s}, 1fr)`,gap:`${a*4}px`},children:t.map((o,i)=>e.jsx(Fl,{src:o.thumbnail||o.src,alt:o.alt,zoomable:!0,objectFit:"cover",containerClassName:"w-full",aspectRatio:r},i))})}const hg={low:"bg-gray-100 text-gray-700 border-gray-200",medium:"bg-blue-100 text-blue-700 border-blue-200",high:"bg-orange-100 text-orange-700 border-orange-200",urgent:"bg-red-100 text-red-700 border-red-200"};function fg({card:t,columnId:s,onCardClick:a,onCardDelete:r,renderCard:n,onDragStart:o}){return n?e.jsx("div",{draggable:!0,onDragStart:i=>o(i,t.id,s),className:"cursor-grab active:cursor-grabbing",children:n(t,s)}):e.jsxs("div",{draggable:!0,onDragStart:i=>o(i,t.id,s),onClick:()=>a?.(t,s),className:b("group bg-card border rounded-lg p-3 shadow-sm cursor-grab active:cursor-grabbing","hover:border-primary/50 hover:shadow-md transition-all duration-200"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[t.labels&&t.labels.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:t.labels.map(i=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-medium rounded",style:{backgroundColor:i.color+"20",color:i.color},children:i.name},i.id))}),e.jsx("h4",{className:"font-medium text-sm truncate",children:t.title}),t.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:t.description})]}),e.jsx(h.GripVertical,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"})]}),(t.priority||t.assignee||t.dueDate)&&e.jsxs("div",{className:"flex items-center justify-between mt-3 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[t.priority&&e.jsx("span",{className:b("px-1.5 py-0.5 text-[10px] font-medium rounded border",hg[t.priority]),children:t.priority}),t.dueDate&&e.jsx("span",{className:"text-[10px] text-muted-foreground",children:t.dueDate.toLocaleDateString()})]}),t.assignee&&e.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center text-[10px] font-medium",title:t.assignee.name,children:t.assignee.avatar?e.jsx("img",{src:t.assignee.avatar,alt:t.assignee.name,className:"h-full w-full rounded-full object-cover"}):t.assignee.name.charAt(0).toUpperCase()})]}),r&&e.jsx(L,{variant:"ghost",size:"icon",className:"absolute top-1 right-1 h-6 w-6 opacity-0 group-hover:opacity-100",onClick:i=>{i.stopPropagation(),r(t.id,s)},children:e.jsx(h.X,{className:"h-3 w-3"})})]})}function pg({column:t,onCardMove:s,onCardAdd:a,onCardDelete:r,onCardClick:n,onColumnDelete:o,allowAddCard:i,allowColumnDrag:l,renderCard:u,draggedCard:d,setDraggedCard:f,onColumnDragStart:m}){const[p,w]=c.useState(!1),[C,g]=c.useState(""),[y,j]=c.useState(null),x=(A,S,M)=>{f({id:S,fromColumnId:M}),A.dataTransfer.effectAllowed="move"},v=(A,S)=>{A.preventDefault(),d&&j(S)},k=()=>{j(null)},N=(A,S)=>{A.preventDefault(),d&&s&&s(d.id,d.fromColumnId,t.id,S),f(null),j(null)},D=A=>{A.preventDefault(),d&&s&&s(d.id,d.fromColumnId,t.id,t.cards.length),f(null),j(null)},P=()=>{C.trim()&&a&&(a(t.id,{title:C.trim()}),g(""),w(!1))},R=t.limit!==void 0&&t.cards.length>=t.limit;return e.jsxs("div",{className:"flex flex-col bg-muted/50 rounded-lg min-w-[280px] max-w-[320px] h-full",onDragOver:A=>A.preventDefault(),onDrop:D,children:[e.jsxs("div",{className:b("flex items-center justify-between p-3 border-b",l&&"cursor-grab active:cursor-grabbing"),draggable:l,onDragStart:A=>m(A,t.id),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[t.color&&e.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:t.color}}),e.jsx("h3",{className:"font-semibold text-sm",children:t.title}),e.jsxs("span",{className:"text-xs text-muted-foreground bg-background px-1.5 py-0.5 rounded",children:[t.cards.length,t.limit&&`/${t.limit}`]})]}),o&&e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx(L,{variant:"ghost",size:"icon",className:"h-6 w-6",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsx(_e,{align:"end",children:e.jsx(pe,{className:"text-destructive",onClick:()=>o(t.id),children:"Supprimer la colonne"})})]})]}),e.jsx(At,{className:"flex-1 p-2",children:e.jsxs("div",{className:"space-y-2",children:[t.cards.map((A,S)=>e.jsxs("div",{onDragOver:M=>v(M,S),onDragLeave:k,onDrop:M=>N(M,S),children:[y===S&&d&&e.jsx("div",{className:"h-1 bg-primary rounded mb-2"}),e.jsx(fg,{card:A,columnId:t.id,onCardClick:n,onCardDelete:r,renderCard:u,onDragStart:x})]},A.id)),d&&y===null&&e.jsx("div",{className:"h-20 border-2 border-dashed border-primary/30 rounded-lg",onDragOver:A=>{A.preventDefault(),j(t.cards.length)}})]})}),i&&e.jsx("div",{className:"p-2 border-t",children:p?e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{value:C,onChange:A=>g(A.target.value),placeholder:"Titre de la carte...",autoFocus:!0,onKeyDown:A=>{A.key==="Enter"&&P(),A.key==="Escape"&&w(!1)}}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(L,{size:"sm",onClick:P,disabled:!C.trim(),children:"Ajouter"}),e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>w(!1),children:"Annuler"})]})]}):e.jsxs(L,{variant:"ghost",className:"w-full justify-start text-muted-foreground",onClick:()=>w(!0),disabled:R,children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-1"}),"Ajouter une carte"]})})]})}function xg({columns:t,onCardMove:s,onColumnMove:a,onCardAdd:r,onCardDelete:n,onCardClick:o,onColumnAdd:i,onColumnDelete:l,allowAddCard:u=!0,allowAddColumn:d=!1,allowColumnDrag:f=!1,renderCard:m,height:p="100%",className:w}){const[C,g]=c.useState(null),[y,j]=c.useState(null),[x,v]=c.useState(!1),[k,N]=c.useState(""),D=(A,S)=>{f&&(j(S),A.dataTransfer.effectAllowed="move")},P=(A,S)=>{A.preventDefault(),y&&a&&a(y,S),j(null)},R=()=>{k.trim()&&i&&(i({title:k.trim()}),N(""),v(!1))};return e.jsxs("div",{className:b("flex gap-4 overflow-x-auto p-4",w),style:{height:p},children:[t.map((A,S)=>e.jsx("div",{onDragOver:M=>M.preventDefault(),onDrop:M=>P(M,S),children:e.jsx(pg,{column:A,onCardMove:s,onCardAdd:r,onCardDelete:n,onCardClick:o,onColumnDelete:l,allowAddCard:u,allowColumnDrag:f,renderCard:m,draggedCard:C,setDraggedCard:g,onColumnDragStart:D})},A.id)),d&&e.jsx("div",{className:"min-w-[280px]",children:x?e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 space-y-2",children:[e.jsx(oe,{value:k,onChange:A=>N(A.target.value),placeholder:"Titre de la colonne...",autoFocus:!0,onKeyDown:A=>{A.key==="Enter"&&R(),A.key==="Escape"&&v(!1)}}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(L,{size:"sm",onClick:R,disabled:!k.trim(),children:"Ajouter"}),e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>v(!1),children:"Annuler"})]})]}):e.jsxs(L,{variant:"outline",className:"w-full h-auto py-8 border-dashed",onClick:()=>v(!0),children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-2"}),"Ajouter une colonne"]})})]})}function gg(t){const[s,a]=c.useState(t);return{columns:s,setColumns:a,moveCard:(d,f,m,p)=>{a(w=>{const C=[...w],g=C.find(v=>v.id===f);if(!g)return w;const y=g.cards.findIndex(v=>v.id===d);if(y===-1)return w;const[j]=g.cards.splice(y,1),x=C.find(v=>v.id===m);return x?(x.cards.splice(p,0,j),C):w})},moveColumn:(d,f)=>{a(m=>{const p=[...m],w=p.findIndex(g=>g.id===d);if(w===-1)return m;const[C]=p.splice(w,1);return p.splice(f,0,C),p})},addCard:(d,f)=>{a(m=>m.map(p=>p.id===d?{...p,cards:[...p.cards,{id:`card-${Date.now()}`,title:f.title||"Nouvelle carte",...f}]}:p))},deleteCard:(d,f)=>{a(m=>m.map(p=>p.id===f?{...p,cards:p.cards.filter(w=>w.id!==d)}:p))},addColumn:d=>{a(f=>[...f,{id:`column-${Date.now()}`,title:d.title||"Nouvelle colonne",cards:[],...d}])},deleteColumn:d=>{a(f=>f.filter(m=>m.id!==d))}}}const bg={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-[calc(100vw-2rem)] max-h-[calc(100vh-2rem)]"},jg={fade:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",slide:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",scale:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",none:""},vg={fade:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",slide:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-top-[2%] data-[state=open]:slide-in-from-top-[2%]",scale:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",none:""},Qr=c.forwardRef(({className:t,animation:s="fade",...a},r)=>e.jsx(ue.Overlay,{ref:r,className:b("fixed inset-0 z-50 bg-black/80",jg[s],t),...a}));Qr.displayName="ModalOverlay";const Zr=c.forwardRef(({className:t,children:s,size:a="md",animation:r="fade",centered:n=!0,showCloseButton:o=!0,...i},l)=>e.jsxs(ue.Content,{ref:l,className:b("fixed z-50 w-full bg-background shadow-lg sm:rounded-lg","left-1/2 -translate-x-1/2",n?"top-1/2 -translate-y-1/2":"top-[10%]",bg[a],vg[r],"duration-200",t),...i,children:[s,o&&e.jsxs(ue.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(h.X,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Fermer"})]})]}));Zr.displayName="ModalContent";const en=c.forwardRef(({className:t,sticky:s,...a},r)=>e.jsx("div",{ref:r,className:b("flex flex-col space-y-1.5 p-6 pb-4",s&&"sticky top-0 bg-background z-10 border-b",t),...a}));en.displayName="ModalHeader";const tn=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Title,{ref:a,className:b("text-lg font-semibold leading-none tracking-tight",t),...s}));tn.displayName="ModalTitle";const sn=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Description,{ref:a,className:b("text-sm text-muted-foreground",t),...s}));sn.displayName="ModalDescription";const an=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b("px-6 py-4 overflow-auto",t),...s}));an.displayName="ModalBody";const rn=c.forwardRef(({className:t,sticky:s,...a},r)=>e.jsx("div",{ref:r,className:b("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 p-6 pt-4",s&&"sticky bottom-0 bg-background z-10 border-t",t),...a}));rn.displayName="ModalFooter";function wg({open:t,onOpenChange:s,title:a,description:r,children:n,size:o="md",showCloseButton:i=!0,closeOnOverlayClick:l=!0,closeOnEscape:u=!0,animation:d="scale",centered:f=!0,stickyHeader:m=!1,stickyFooter:p=!1,footer:w,className:C,overlayClassName:g}){const y=x=>{l||x.preventDefault()},j=x=>{u||x.preventDefault()};return e.jsx(ue.Root,{open:t,onOpenChange:s,children:e.jsxs(ue.Portal,{children:[e.jsx(Qr,{animation:d,className:g}),e.jsxs(Zr,{size:o,animation:d,centered:f,showCloseButton:i,className:C,onInteractOutside:y,onEscapeKeyDown:j,children:[(a||r)&&e.jsxs(en,{sticky:m,children:[a&&e.jsx(tn,{children:a}),r&&e.jsx(sn,{children:r})]}),e.jsx(an,{children:n}),w&&e.jsx(rn,{sticky:p,children:w})]})]})})}function yg({children:t,onOpen:s,className:a,disabled:r}){return e.jsx(ue.Trigger,{className:a,disabled:r,onClick:s,asChild:!0,children:t})}function Ng(t){const{defaultOpen:s=!1,onOpenChange:a}=t||{},[r,n]=c.useState(s),o=c.useCallback(()=>{n(!0),a?.(!0)},[a]),i=c.useCallback(()=>{n(!1),a?.(!1)},[a]),l=c.useCallback(()=>{n(d=>{const f=!d;return a?.(f),f})},[a]),u=c.useCallback(d=>{n(d),a?.(d)},[a]);return{isOpen:r,open:o,close:i,toggle:l,onOpenChange:u}}const Cg={info:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",success:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",warning:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",error:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"},ga=c.forwardRef(({notification:t,onMarkAsRead:s,onDelete:a},r)=>{const n=o=>{const l=new Date().getTime()-o.getTime(),u=Math.floor(l/6e4),d=Math.floor(l/36e5),f=Math.floor(l/864e5);return u<1?"À l'instant":u<60?`Il y a ${u} min`:d<24?`Il y a ${d}h`:f<7?`Il y a ${f}j`:o.toLocaleDateString("fr-FR")};return e.jsxs("div",{ref:r,className:b("flex gap-3 p-4 hover:bg-muted/50 transition-colors border-l-4",t.read?"border-l-transparent opacity-60":"border-l-primary","relative group"),children:[e.jsx("div",{className:b("flex-shrink-0 w-10 h-10 rounded-full flex items-center justify-center",Cg[t.type]),children:t.icon||e.jsx(h.Bell,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h4",{className:b("text-sm font-semibold",t.read&&"font-normal"),children:t.title}),e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:n(t.timestamp)})]}),e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:t.message}),t.action&&e.jsx(L,{variant:"link",size:"sm",className:"h-auto p-0 text-primary",onClick:t.action.onClick,children:t.action.label})]}),e.jsxs("div",{className:"flex-shrink-0 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[!t.read&&s&&e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>s(t.id),children:[e.jsx(h.Check,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Marquer comme lu"})]}),a&&e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>a(t.id),children:[e.jsx(h.Trash2,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Supprimer"})]})]})]})});ga.displayName="NotificationItem";const $l=c.forwardRef(({notifications:t,onMarkAsRead:s,onMarkAllAsRead:a,onDelete:r,onDeleteAll:n,onSettingsClick:o,maxHeight:i="400px",className:l,iconClassName:u,badgeClassName:d,showBadge:f=!0,showTabs:m=!0,emptyMessage:p="Aucune notification",emptyIcon:w},C)=>{const[g,y]=c.useState(!1),[j,x]=c.useState("all"),v=t.filter(D=>!D.read).length,k=c.useMemo(()=>j==="all"?t:j==="unread"?t.filter(D=>!D.read):t,[t,j]),N=()=>e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[w||e.jsx(h.Bell,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:p})]});return e.jsxs(rt,{open:g,onOpenChange:y,children:[e.jsx(nt,{asChild:!0,children:e.jsxs(L,{ref:C,variant:"ghost",size:"icon",className:b("relative",l),children:[e.jsx(h.Bell,{className:b("h-5 w-5",u)}),f&&v>0&&e.jsx(Se,{variant:"destructive",className:b("absolute -top-1 -right-1 h-5 min-w-[20px] flex items-center justify-center p-0 text-xs",d),children:v>99?"99+":v}),e.jsxs("span",{className:"sr-only",children:["Notifications (",v," non lues)"]})]})}),e.jsxs(st,{className:"w-[380px] p-0",align:"end",sideOffset:8,children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-base",children:"Notifications"}),v>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[v," non ",v>1?"lues":"lue"]})]}),e.jsxs("div",{className:"flex gap-1",children:[a&&v>0&&e.jsxs(L,{variant:"ghost",size:"sm",className:"h-8 text-xs",onClick:a,children:[e.jsx(h.Check,{className:"h-3 w-3 mr-1"}),"Tout marquer"]}),o&&e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:o,children:[e.jsx(h.Settings,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Paramètres"})]})]})]}),m&&t.length>0&&e.jsxs(ra,{value:j,onValueChange:x,className:"w-full",children:[e.jsxs(Ts,{className:"w-full rounded-none border-b bg-transparent p-0",children:[e.jsxs(js,{value:"all",className:"flex-1 rounded-none data-[state=active]:border-b-2 data-[state=active]:border-primary",children:["Toutes (",t.length,")"]}),e.jsxs(js,{value:"unread",className:"flex-1 rounded-none data-[state=active]:border-b-2 data-[state=active]:border-primary",children:["Non lues (",v,")"]})]}),e.jsx(vs,{value:"all",className:"m-0",children:e.jsx(At,{className:"h-[400px]",style:{maxHeight:i},children:e.jsx("div",{className:"p-0",children:k.length===0?e.jsx(N,{}):e.jsx("div",{className:"divide-y",children:k.map(D=>e.jsx(ga,{notification:D,onMarkAsRead:s,onDelete:r},D.id))})})})}),e.jsx(vs,{value:"unread",className:"m-0",children:e.jsx(At,{className:"h-[400px]",style:{maxHeight:i},children:e.jsx("div",{className:"p-0",children:k.length===0?e.jsx(N,{}):e.jsx("div",{className:"divide-y",children:k.map(D=>e.jsx(ga,{notification:D,onMarkAsRead:s,onDelete:r},D.id))})})})})]}),!m&&e.jsx(At,{className:"h-[400px]",style:{maxHeight:i},children:e.jsx("div",{className:"p-0",children:t.length===0?e.jsx(N,{}):e.jsx("div",{className:"divide-y",children:t.map(D=>e.jsx(ga,{notification:D,onMarkAsRead:s,onDelete:r},D.id))})})}),t.length>0&&n&&e.jsxs(e.Fragment,{children:[e.jsx(kt,{}),e.jsx("div",{className:"p-2",children:e.jsxs(L,{variant:"ghost",size:"sm",className:"w-full text-destructive hover:text-destructive",onClick:n,children:[e.jsx(h.Trash2,{className:"h-3 w-3 mr-2"}),"Tout supprimer"]})})]})]})]})});$l.displayName="WakaNotifications";function kg(t=[]){const[s,a]=c.useState(t),r=c.useCallback(d=>{const f={...d,id:`notification-${Date.now()}-${Math.random()}`,timestamp:new Date,read:!1};a(m=>[f,...m])},[]),n=c.useCallback(d=>{a(f=>f.map(m=>m.id===d?{...m,read:!0}:m))},[]),o=c.useCallback(()=>{a(d=>d.map(f=>({...f,read:!0})))},[]),i=c.useCallback(d=>{a(f=>f.filter(m=>m.id!==d))},[]),l=c.useCallback(()=>{a([])},[]),u=c.useMemo(()=>s.filter(d=>!d.read).length,[s]);return{notifications:s,addNotification:r,markAsRead:n,markAllAsRead:o,deleteNotification:i,deleteAllNotifications:l,unreadCount:u}}function Us(t,s,a){let r=t;return s!==void 0&&r<s&&(r=s),a!==void 0&&r>a&&(r=a),r}function Ya(t,s){const a=Math.pow(10,s);return Math.round(t*a)/a}function Sg({value:t,onChange:s,min:a,max:r,step:n=1,precision:o=0,placeholder:i="0",disabled:l=!1,error:u=!1,size:d="md",buttonPosition:f="sides",allowEmpty:m=!1,formatValue:p,parseValue:w,className:C,id:g,name:y}){const[j,x]=c.useState(t!==void 0?p?p(t):String(t):""),[v,k]=c.useState(!1);c.useEffect(()=>{v||x(t!==void 0?p?p(t):String(t):"")},[t,p,v]);const N=W=>{const I=W.target.value;if(x(I),I===""&&m){s?.(void 0);return}let z;if(w)z=w(I);else{const $=I.replace(",",".");z=parseFloat($)}if(z!==void 0&&!isNaN(z)){const $=Us(Ya(z,o),a,r);s?.($)}},D=()=>{if(k(!1),t!==void 0)x(p?p(t):String(t));else if(!m){const W=a!==void 0?a:0;s?.(W),x(p?p(W):String(W))}},P=()=>{k(!0)},R=()=>{const I=Us(Ya((t??(a!==void 0?a:0))+n,o),a,r);s?.(I)},A=()=>{const I=Us(Ya((t??(a!==void 0?a:0))-n,o),a,r);s?.(I)},S=W=>{W.key==="ArrowUp"?(W.preventDefault(),R()):W.key==="ArrowDown"&&(W.preventDefault(),A())},M={sm:"h-8 text-xs",md:"h-9 text-sm",lg:"h-10 text-base"},E={sm:"h-8 w-8",md:"h-9 w-9",lg:"h-10 w-10"},T={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},K=r===void 0||(t??0)<r,q=a===void 0||(t??0)>a,B=(W,I)=>{const z=W==="increment",$=z?h.Plus:h.Minus,_=z?R:A,F=z?K:q;return e.jsx(L,{type:"button",variant:"outline",size:"icon",className:b(E[d],"flex-shrink-0",I==="left"&&"rounded-r-none border-r-0",I==="right"&&"rounded-l-none border-l-0"),onClick:_,disabled:l||!F,tabIndex:-1,"aria-label":z?"Augmenter":"Diminuer",children:e.jsx($,{className:T[d]})})};return f==="none"?e.jsx(oe,{id:g,name:y,type:"text",inputMode:"decimal",value:j,onChange:N,onBlur:D,onFocus:P,onKeyDown:S,placeholder:i,disabled:l,className:b(M[d],"text-center",u&&"border-destructive focus-visible:ring-destructive",C)}):f==="right"?e.jsxs("div",{className:b("flex",C),children:[e.jsx(oe,{id:g,name:y,type:"text",inputMode:"decimal",value:j,onChange:N,onBlur:D,onFocus:P,onKeyDown:S,placeholder:i,disabled:l,className:b(M[d],"rounded-r-none",u&&"border-destructive focus-visible:ring-destructive")}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx(L,{type:"button",variant:"outline",size:"icon",className:b("h-[50%] w-6 rounded-none rounded-tr-md border-l-0 border-b-0",d==="sm"&&"h-4",d==="lg"&&"h-5"),onClick:R,disabled:l||!K,tabIndex:-1,"aria-label":"Augmenter",children:e.jsx(h.Plus,{className:"h-2.5 w-2.5"})}),e.jsx(L,{type:"button",variant:"outline",size:"icon",className:b("h-[50%] w-6 rounded-none rounded-br-md border-l-0",d==="sm"&&"h-4",d==="lg"&&"h-5"),onClick:A,disabled:l||!q,tabIndex:-1,"aria-label":"Diminuer",children:e.jsx(h.Minus,{className:"h-2.5 w-2.5"})})]})]}):e.jsxs("div",{className:b("flex",C),children:[B("decrement","left"),e.jsx(oe,{id:g,name:y,type:"text",inputMode:"decimal",value:j,onChange:N,onBlur:D,onFocus:P,onKeyDown:S,placeholder:i,disabled:l,className:b(M[d],"rounded-none text-center",u&&"border-destructive focus-visible:ring-destructive")}),B("increment","right")]})}function Dg(t={}){const{initialValue:s,min:a,max:r,step:n=1}=t,[o,i]=c.useState(s);return{value:o,onChange:i,increment:()=>{i(m=>Us((m??(a!==void 0?a:0))+n,a,r))},decrement:()=>{i(m=>Us((m??(a!==void 0?a:0))-n,a,r))},reset:()=>i(s),clear:()=>i(void 0),min:a,max:r,step:n}}function Tg(t,s,a){if(s<=a)return Array.from({length:s},(o,i)=>i+1);const r=[],n=Math.floor((a-3)/2);if(r.push(1),t<=n+2){for(let o=2;o<=Math.min(a-1,s-1);o++)r.push(o);s>a&&r.push("ellipsis")}else if(t>=s-n-1){r.push("ellipsis");for(let o=Math.max(s-a+2,2);o<=s-1;o++)r.push(o)}else{r.push("ellipsis");for(let o=t-n;o<=t+n;o++)r.push(o);r.push("ellipsis")}return s>1&&r.push(s),r}function Ag({page:t,totalPages:s,onPageChange:a,pageSize:r=10,pageSizeOptions:n=[10,20,50,100],onPageSizeChange:o,totalItems:i,showPageSizeSelector:l=!1,showItemsInfo:u=!1,showFirstLast:d=!0,maxVisiblePages:f=7,size:m="md",variant:p="outline",className:w,labels:C={}}){const{page:g="Page",of:y="sur",items:j="éléments",itemsPerPage:x="par page",first:v="Première page",previous:k="Page précédente",next:N="Page suivante",last:D="Dernière page"}=C,P={sm:"h-7 w-7 text-xs",md:"h-8 w-8 text-sm",lg:"h-10 w-10 text-base"},R={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},A=Tg(t,s,f),S=T=>{T>=1&&T<=s&&T!==t&&a(T)},M=i?(t-1)*r+1:null,E=i?Math.min(t*r,i):null;return e.jsxs("nav",{role:"navigation","aria-label":"Pagination",className:b("flex flex-wrap items-center gap-4 justify-between",w),children:[u&&i!==void 0&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:[M,"-",E," ",y," ",i," ",j]}),l&&o&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:[x,":"]}),e.jsxs(Ve,{value:String(r),onValueChange:T=>o(Number(T)),children:[e.jsx($e,{className:b("w-[70px]",m==="sm"?"h-7":m==="lg"?"h-10":"h-8"),children:e.jsx(We,{})}),e.jsx(Le,{children:n.map(T=>e.jsx(je,{value:String(T),children:T},T))})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[d&&e.jsx(L,{variant:p,size:"icon",className:P[m],onClick:()=>S(1),disabled:t===1,"aria-label":v,children:e.jsx(h.ChevronsLeft,{className:R[m]})}),e.jsx(L,{variant:p,size:"icon",className:P[m],onClick:()=>S(t-1),disabled:t===1,"aria-label":k,children:e.jsx(h.ChevronLeft,{className:R[m]})}),e.jsx("div",{className:"flex items-center gap-1",children:A.map((T,K)=>{if(T==="ellipsis")return e.jsx("span",{className:b("flex items-center justify-center text-muted-foreground",P[m]),children:e.jsx(h.MoreHorizontal,{className:R[m]})},`ellipsis-${K}`);const q=T===t;return e.jsx(L,{variant:q?"default":p,size:"icon",className:b(P[m],q&&"pointer-events-none"),onClick:()=>S(T),"aria-label":`${g} ${T}`,"aria-current":q?"page":void 0,children:T},T)})}),e.jsx(L,{variant:p,size:"icon",className:P[m],onClick:()=>S(t+1),disabled:t===s,"aria-label":N,children:e.jsx(h.ChevronRight,{className:R[m]})}),d&&e.jsx(L,{variant:p,size:"icon",className:P[m],onClick:()=>S(s),disabled:t===s,"aria-label":D,children:e.jsx(h.ChevronsRight,{className:R[m]})})]}),!u&&s>0&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:[g," ",t," ",y," ",s]})]})}function Eg({totalItems:t,initialPageSize:s=10,initialPage:a=1}){const[r,n]=c.useState(a),[o,i]=c.useState(s),l=Math.ceil(t/o);c.useEffect(()=>{r>l&&l>0&&n(l)},[r,l]);const u=g=>{i(g),n(1)},d=()=>{r<l&&n(r+1)},f=()=>{r>1&&n(r-1)},m=()=>n(1),p=()=>n(l),w=(r-1)*o,C=Math.min(w+o-1,t-1);return{page:r,pageSize:o,totalPages:l,setPage:n,setPageSize:u,nextPage:d,prevPage:f,firstPage:m,lastPage:p,canNextPage:r<l,canPrevPage:r>1,startIndex:w,endIndex:C}}function Mg(t,s){const a=Math.max(21,Math.min(177,21+Math.floor(t.length/10)*4)),r=[];for(let n=0;n<a;n++){r[n]=[];for(let o=0;o<a;o++)if(n<7&&o<7||n<7&&o>=a-7||n>=a-7&&o<7){const l=n<7?n:n-(a-7),u=o<7?o:o>=a-7?o-(a-7):o;l===0||l===6||u===0||u===6||l>=2&&l<=4&&u>=2&&u<=4?r[n][o]=!0:r[n][o]=!1}else{const l=(t.charCodeAt((n*a+o)%t.length)||0)+n*31+o*17;r[n][o]=l%3===0}}return{modules:r,size:a}}function Pg({value:t,size:s=200,errorCorrectionLevel:a="M",fgColor:r="#000000",bgColor:n="#FFFFFF",includeMargin:o=!0,logoUrl:i,logoSize:l=.2,showActions:u=!1,className:d}){const f=c.useRef(null),[m,p]=c.useState(!1);c.useEffect(()=>{const g=f.current;if(!g||!t)return;const y=g.getContext("2d");if(!y)return;const j=Mg(t),x=o?4:0,v=s/(j.size+x*2);y.fillStyle=n,y.fillRect(0,0,s,s),y.fillStyle=r;for(let k=0;k<j.size;k++)for(let N=0;N<j.size;N++)j.modules[k][N]&&y.fillRect((N+x)*v,(k+x)*v,v,v);if(i){const k=new Image;k.crossOrigin="anonymous",k.onload=()=>{const N=s*l,D=(s-N)/2,P=(s-N)/2;y.fillStyle=n,y.fillRect(D-4,P-4,N+8,N+8),y.drawImage(k,D,P,N,N)},k.src=i}},[t,s,a,r,n,o,i,l]);const w=()=>{const g=f.current;if(!g)return;const y=document.createElement("a");y.download=`qrcode-${Date.now()}.png`,y.href=g.toDataURL("image/png"),y.click()},C=async()=>{const g=f.current;if(g)try{const y=await new Promise(j=>{g.toBlob(x=>{x&&j(x)},"image/png")});await navigator.clipboard.write([new ClipboardItem({"image/png":y})]),p(!0),setTimeout(()=>p(!1),2e3)}catch(y){console.error("Failed to copy QR code:",y)}};return e.jsxs("div",{className:b("inline-flex flex-col items-center gap-2",d),children:[e.jsx("canvas",{ref:f,width:s,height:s,className:"rounded-lg",style:{width:s,height:s}}),u&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(L,{variant:"outline",size:"sm",onClick:w,children:[e.jsx(h.Download,{className:"h-4 w-4 mr-1"}),"Télécharger"]}),e.jsxs(L,{variant:"outline",size:"sm",onClick:C,children:[m?e.jsx(h.Check,{className:"h-4 w-4 mr-1"}):e.jsx(h.Copy,{className:"h-4 w-4 mr-1"}),m?"Copié":"Copier"]})]})]})}function Rg(t=""){const[s,a]=c.useState(t);return{value:s,setValue:a,props:{value:s}}}const Fg=[["bold","italic","underline","strike"],["h1","h2","h3"],["bulletList","orderedList","blockquote"],["link","code"],["undo","redo"]],Ll=c.forwardRef(({value:t="",onChange:s,toolbar:a=Fg,placeholder:r="Écrivez ici...",maxLength:n,showCharacterCount:o=!1,minHeight:i=200,disabled:l=!1,error:u,className:d,label:f,description:m,editable:p=!0},w)=>{const[C,g]=c.useState(null),[y,j]=c.useState(null),[x,v]=c.useState(null),[k,N]=c.useState("");return c.useEffect(()=>{(async()=>{try{const[{useEditor:P,EditorContent:R},{default:A},{default:S},{default:M},{default:E}]=await Promise.all([import("@tiptap/react"),import("@tiptap/starter-kit"),import("@tiptap/extension-underline"),import("@tiptap/extension-link"),import("@tiptap/extension-text-align")]);j({useEditor:P,EditorContent:R,StarterKit:A,Underline:S,Link:M,TextAlign:E}),g(!0)}catch{g(!1)}})()},[]),C&&y?e.jsx(Il,{ref:w,components:y,value:t,onChange:s,toolbar:a,placeholder:r,maxLength:n,showCharacterCount:o,minHeight:i,disabled:l,error:u,className:d,label:f,description:m,editable:p,linkUrl:k,setLinkUrl:N,editor:x,setEditor:v}):e.jsx(Ol,{ref:w,value:t,onChange:s,placeholder:r,maxLength:n,showCharacterCount:o,minHeight:i,disabled:l,error:u,className:d,label:f,description:m,loading:C===null})});Ll.displayName="WakaRichTextEditor";const Il=c.forwardRef(({components:t,value:s,onChange:a,toolbar:r,placeholder:n,maxLength:o,showCharacterCount:i,minHeight:l,disabled:u,error:d,className:f,label:m,description:p,editable:w,linkUrl:C,setLinkUrl:g,setEditor:y},j)=>{const{useEditor:x,EditorContent:v,StarterKit:k,Underline:N,Link:D,TextAlign:P}=t,R=x({extensions:[k.configure({heading:{levels:[1,2,3]}}),N,D.configure({openOnClick:!1}),P.configure({types:["heading","paragraph"]})],content:s,editable:w&&!u,onUpdate:({editor:M})=>{const E=M.getHTML();(!o||E.length<=o)&&a?.(E)}});c.useEffect(()=>{y(R)},[R,y]),c.useEffect(()=>{R&&s!==R.getHTML()&&R.commands?.setContent?.(s||"",!1)},[s,R]);const A=()=>{R&&(C?R.chain().focus().setLink({href:C}).run():R.chain().focus().unsetLink().run(),g(""))},S=R?.storage?.characterCount?.characters?.()??s?.replace(/<[^>]*>/g,"").length??0;return e.jsxs("div",{ref:j,className:b("space-y-1.5",f),children:[m&&e.jsx(me,{children:m}),p&&e.jsx("p",{className:"text-sm text-muted-foreground",children:p}),e.jsxs("div",{className:b("border rounded-lg overflow-hidden",d&&"border-destructive"),children:[R&&r&&e.jsx("div",{className:"flex flex-wrap items-center gap-0.5 p-1 border-b bg-muted/30",children:r.map((M,E)=>e.jsxs(c.Fragment,{children:[E>0&&e.jsx(kt,{orientation:"vertical",className:"mx-1 h-6"}),M.map(T=>e.jsx($g,{button:T,editor:R,linkUrl:C,setLinkUrl:g,handleSetLink:A},T))]},E))}),e.jsx("div",{style:{minHeight:l},children:e.jsx(v,{editor:R,className:b("prose prose-sm max-w-none p-3 focus-within:outline-none h-full","[&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[inherit]")})}),i&&e.jsxs("div",{className:"flex justify-end p-1.5 border-t bg-muted/30 text-xs text-muted-foreground",children:[S,o&&` / ${o}`," caractères"]})]}),d&&e.jsx("p",{className:"text-sm text-destructive",children:d})]})});Il.displayName="TiptapEditorComponent";function $g({button:t,editor:s,linkUrl:a,setLinkUrl:r,handleSetLink:n}){const o={bold:{icon:e.jsx(h.Bold,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleBold().run(),isActive:()=>s.isActive("bold")},italic:{icon:e.jsx(h.Italic,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleItalic().run(),isActive:()=>s.isActive("italic")},underline:{icon:e.jsx(h.Underline,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleUnderline().run(),isActive:()=>s.isActive("underline")},strike:{icon:e.jsx(h.Strikethrough,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleStrike().run(),isActive:()=>s.isActive("strike")},h1:{icon:e.jsx(h.Heading1,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleHeading({level:1}).run(),isActive:()=>s.isActive("heading",{level:1})},h2:{icon:e.jsx(h.Heading2,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleHeading({level:2}).run(),isActive:()=>s.isActive("heading",{level:2})},h3:{icon:e.jsx(h.Heading3,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleHeading({level:3}).run(),isActive:()=>s.isActive("heading",{level:3})},bulletList:{icon:e.jsx(h.List,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleBulletList().run(),isActive:()=>s.isActive("bulletList")},orderedList:{icon:e.jsx(h.ListOrdered,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleOrderedList().run(),isActive:()=>s.isActive("orderedList")},blockquote:{icon:e.jsx(h.Quote,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleBlockquote().run(),isActive:()=>s.isActive("blockquote")},code:{icon:e.jsx(h.Code,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleCodeBlock().run(),isActive:()=>s.isActive("codeBlock")},link:{icon:e.jsx(h.Link,{className:"h-4 w-4"}),action:()=>{},isActive:()=>s.isActive("link")},alignLeft:{icon:e.jsx(h.AlignLeft,{className:"h-4 w-4"}),action:()=>s.chain().focus().setTextAlign("left").run(),isActive:()=>s.isActive({textAlign:"left"})},alignCenter:{icon:e.jsx(h.AlignCenter,{className:"h-4 w-4"}),action:()=>s.chain().focus().setTextAlign("center").run(),isActive:()=>s.isActive({textAlign:"center"})},alignRight:{icon:e.jsx(h.AlignRight,{className:"h-4 w-4"}),action:()=>s.chain().focus().setTextAlign("right").run(),isActive:()=>s.isActive({textAlign:"right"})},undo:{icon:e.jsx(h.Undo,{className:"h-4 w-4"}),action:()=>s.chain().focus().undo().run()},redo:{icon:e.jsx(h.Redo,{className:"h-4 w-4"}),action:()=>s.chain().focus().redo().run()}},{icon:i,action:l,isActive:u}=o[t];return t==="link"?e.jsxs(rt,{children:[e.jsx(nt,{asChild:!0,children:e.jsx(L,{type:"button",variant:u?.()?"secondary":"ghost",size:"icon",className:"h-7 w-7",children:i})}),e.jsx(st,{className:"w-64 p-2",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{value:a,onChange:d=>r(d.target.value),placeholder:"https://...",className:"h-8"}),e.jsx(L,{size:"sm",onClick:n,children:"OK"})]})})]}):e.jsx(L,{type:"button",variant:u?.()?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:l,children:i})}const Ol=c.forwardRef(({value:t,onChange:s,placeholder:a,maxLength:r,showCharacterCount:n,minHeight:o,disabled:i,error:l,className:u,label:d,description:f,loading:m},p)=>e.jsxs("div",{ref:p,className:b("space-y-1.5",u),children:[d&&e.jsx(me,{children:d}),f&&e.jsx("p",{className:"text-sm text-muted-foreground",children:f}),e.jsxs("div",{className:"relative",children:[e.jsx(ft,{value:t,onChange:w=>s?.(w.target.value),placeholder:a,maxLength:r,disabled:i||m,style:{minHeight:o},className:b(l&&"border-destructive")}),m&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/50",children:e.jsx("span",{className:"text-sm text-muted-foreground",children:"Chargement..."})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[l&&e.jsx("p",{className:"text-sm text-destructive",children:l}),n&&e.jsxs("p",{className:"text-xs text-muted-foreground ml-auto",children:[t?.length||0,r&&` / ${r}`," caractères"]})]})]}));Ol.displayName="FallbackEditor";function Lg({options:t,value:s,onChange:a,size:r="md",variant:n="default",fullWidth:o=!1,disabled:i=!1,name:l,className:u}){const[d,f]=c.useState({}),m=c.useRef(null),p=c.useRef(new Map),w={sm:"h-7 text-xs px-2",md:"h-9 text-sm px-3",lg:"h-11 text-base px-4"},C={sm:"p-0.5",md:"p-1",lg:"p-1"},g={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"};c.useEffect(()=>{if(s===void 0)return;const x=p.current.get(s),v=m.current;if(x&&v){const k=v.getBoundingClientRect(),N=x.getBoundingClientRect();f({left:N.left-k.left,width:N.width,height:N.height})}},[s,t]);const y=x=>{i||a?.(x)},j=x=>v=>{v?p.current.set(x,v):p.current.delete(x)};return e.jsxs("div",{ref:m,role:"radiogroup",className:b("relative inline-flex items-center bg-muted rounded-lg",C[r],o&&"w-full",i&&"opacity-50",u),children:[s!==void 0&&n==="default"&&e.jsx("div",{className:"absolute bg-background rounded-md shadow-sm transition-all duration-200 ease-out",style:d}),t.map(x=>{const v=x.value===s,k=i||x.disabled;return e.jsxs("button",{ref:j(x.value),type:"button",role:"radio","aria-checked":v,disabled:k,onClick:()=>y(x.value),className:b("relative z-10 inline-flex items-center justify-center gap-1.5 font-medium transition-colors rounded-md",w[r],o&&"flex-1",n==="default"&&[v?"text-foreground":"text-muted-foreground hover:text-foreground"],n==="pills"&&[v?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-background/50"],k&&"cursor-not-allowed opacity-50"),children:[x.icon&&e.jsx("span",{className:g[r],children:x.icon}),x.label]},String(x.value))}),l&&e.jsx("input",{type:"hidden",name:l,value:String(s??"")})]})}function Ig(t,s){const[a,r]=c.useState(s??t[0]?.value);return{value:a,onChange:r,selectNext:()=>{const d=(t.findIndex(m=>m.value===a)+1)%t.length,f=t[d];f.disabled||r(f.value)},selectPrevious:()=>{const u=t.findIndex(m=>m.value===a),d=u===0?t.length-1:u-1,f=t[d];f.disabled||r(f.value)},selectFirst:()=>{const u=t.find(d=>!d.disabled);u&&r(u.value)},selectLast:()=>{const u=[...t].reverse().find(d=>!d.disabled);u&&r(u.value)},options:t}}const Og=Xe.cva("relative inline-flex items-center justify-center",{variants:{size:{sm:"w-12 h-12",md:"w-16 h-16",lg:"w-24 h-24",xl:"w-32 h-32"}},defaultVariants:{size:"md"}}),zl=c.forwardRef(({className:t,size:s,showAsteroids:a=!0,speed:r=2,rocketColor:n="text-primary",asteroidColor:o="text-muted-foreground",...i},l)=>{const d={sm:{orbit:40,rocket:16,asteroid:6},md:{orbit:56,rocket:20,asteroid:8},lg:{orbit:88,rocket:28,asteroid:12},xl:{orbit:120,rocket:36,asteroid:16}}[s||"md"],f=d.orbit,m=d.orbit;return e.jsxs("div",{ref:l,className:b(Og({size:s,className:t})),role:"status","aria-label":"Chargement en cours",...i,children:[e.jsxs("svg",{width:d.orbit*2,height:d.orbit*2,viewBox:`0 0 ${d.orbit*2} ${d.orbit*2}`,className:"overflow-visible",children:[e.jsx("circle",{cx:f,cy:m,r:d.orbit-d.rocket,fill:"none",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 4",className:"opacity-20"}),a&&e.jsxs("g",{className:o,children:[e.jsx("g",{style:{animation:`waka-float ${r*1.5}s ease-in-out infinite`,transformOrigin:`${f+d.orbit*.6}px ${m-d.orbit*.5}px`},children:e.jsx("polygon",{points:Ja(f+d.orbit*.6,m-d.orbit*.5,d.asteroid),fill:"currentColor",opacity:"0.3"})}),e.jsx("g",{style:{animation:`waka-float ${r*2}s ease-in-out infinite 0.5s`,transformOrigin:`${f-d.orbit*.7}px ${m+d.orbit*.4}px`},children:e.jsx("polygon",{points:Ja(f-d.orbit*.7,m+d.orbit*.4,d.asteroid*.8),fill:"currentColor",opacity:"0.3"})}),e.jsx("g",{style:{animation:`waka-float ${r*1.8}s ease-in-out infinite 1s`,transformOrigin:`${f-d.orbit*.8}px ${m-d.orbit*.2}px`},children:e.jsx("polygon",{points:Ja(f-d.orbit*.8,m-d.orbit*.2,d.asteroid*.6),fill:"currentColor",opacity:"0.3"})})]}),e.jsx("g",{className:n,style:{animation:`waka-orbit ${r}s linear infinite`,transformOrigin:`${f}px ${m}px`},children:e.jsxs("g",{transform:`translate(${f}, ${m-d.orbit+d.rocket/2})`,children:[e.jsx("path",{d:`M 0,-${d.rocket/2} L ${d.rocket/4},-${d.rocket/6} L ${d.rocket/4},${d.rocket/3} L 0,${d.rocket/2} L -${d.rocket/4},${d.rocket/3} L -${d.rocket/4},-${d.rocket/6} Z`,fill:"currentColor"}),e.jsx("circle",{cx:"0",cy:-d.rocket/6,r:d.rocket/8,fill:"white",opacity:"0.8"}),e.jsxs("g",{opacity:"0.8",children:[e.jsx("path",{d:`M -${d.rocket/6},${d.rocket/2} L -${d.rocket/8},${d.rocket/1.5} L 0,${d.rocket/2} Z`,fill:"#FF6B35",style:{animation:`waka-flicker ${r/4}s ease-in-out infinite`}}),e.jsx("path",{d:`M 0,${d.rocket/2} L ${d.rocket/8},${d.rocket/1.5} L ${d.rocket/6},${d.rocket/2} Z`,fill:"#FF6B35",style:{animation:`waka-flicker ${r/4}s ease-in-out infinite 0.1s`}}),e.jsx("path",{d:`M -${d.rocket/12},${d.rocket/2} L 0,${d.rocket/1.3} L ${d.rocket/12},${d.rocket/2} Z`,fill:"#FFA500",style:{animation:`waka-flicker ${r/4}s ease-in-out infinite 0.05s`}})]})]})}),[...Array(3)].map((p,w)=>e.jsx("circle",{cx:f+(w-1)*d.orbit*.3,cy:m-d.orbit*1.2,r:"1",fill:"currentColor",className:"opacity-40",style:{animation:`waka-twinkle ${r*1.5}s ease-in-out infinite ${w*.3}s`}},w))]}),e.jsx("style",{dangerouslySetInnerHTML:{__html:`
28
+ `},onMouseDown:A,children:e.jsx("div",{className:"absolute w-4 h-4 border-2 border-white rounded-full shadow -translate-x-1/2 -translate-y-1/2 pointer-events-none",style:{left:`${y}%`,top:`${100-x}%`,backgroundColor:`hsl(${C}, ${y}%, ${x}%)`}})}),e.jsx("div",{ref:P,className:"relative w-full h-3 rounded cursor-pointer",style:{background:"linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00)"},onMouseDown:S,children:e.jsx("div",{className:"absolute w-3 h-5 border-2 border-white rounded -translate-x-1/2 -top-1 shadow pointer-events-none",style:{left:`${C/360*100}%`,backgroundColor:`hsl(${C}, 100%, 50%)`}})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"w-8 h-8 rounded border flex-shrink-0",style:{backgroundColor:t}}),e.jsx(oe,{value:k,onChange:E,className:"h-8 text-sm font-mono",placeholder:a==="hex"?"#000000":a==="rgb"?"rgb(0,0,0)":"hsl(0,0%,0%)"}),K&&e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:M,title:"Pipette",children:e.jsx(h.Pipette,{className:"h-4 w-4"})})]}),n&&o.length>0&&e.jsxs("div",{children:[e.jsx(me,{className:"text-xs text-muted-foreground",children:"Couleurs prédéfinies"}),e.jsx("div",{className:"grid grid-cols-10 gap-1 mt-1",children:o.map(q=>e.jsx("button",{className:b("w-5 h-5 rounded border transition-transform hover:scale-110",t.toLowerCase()===q.toLowerCase()&&"ring-2 ring-primary ring-offset-1"),style:{backgroundColor:q},onClick:()=>{const B=pa(q);if(B){const[W,I,z]=_s(...B);g(W),j(I),v(z),R(W,I,z)}}},q))})]})]})})]})});Kr.displayName="WakaColorPicker";const El=c.forwardRef(({error:t,label:s,className:a,...r},n)=>e.jsxs("div",{className:b("space-y-1.5",a),children:[s&&e.jsx(me,{htmlFor:r.name,children:s}),e.jsx(Kr,{ref:n,...r}),t&&e.jsx("p",{className:"text-sm text-destructive",children:t})]}));El.displayName="WakaColorPickerForm";function Jx(t){const s=new Map;for(const a of t){const r=a.group;s.has(r)||s.set(r,[]),s.get(r).push(a)}return s}function Qx({options:t,value:s,onChange:a,placeholder:r="Sélectionner...",searchPlaceholder:n="Rechercher...",emptyMessage:o="Aucun résultat trouvé.",multiple:i=!1,creatable:l=!1,onCreate:u,createLabel:d="Créer",onSearch:f,searchDebounce:m=300,disabled:p=!1,error:w=!1,loading:C=!1,size:g="md",clearable:y=!0,maxSelections:j,className:x,id:v,name:k}){const[N,D]=c.useState(!1),[P,R]=c.useState(""),[A,S]=c.useState(t),[M,E]=c.useState(!1),[T,K]=c.useState([]),q=C||M;c.useEffect(()=>{f||S(t)},[t,f]),c.useEffect(()=>{if(!f)return;const U=setTimeout(async()=>{E(!0);try{const ae=await f(P);S(ae)}catch(ae){console.error("Search error:",ae)}finally{E(!1)}},m);return()=>clearTimeout(U)},[P,f,m]);const B=c.useMemo(()=>[...A,...T],[A,T]),W=c.useMemo(()=>{if(f||!P)return B;const U=P.toLowerCase();return B.filter(ae=>ae.label.toLowerCase().includes(U)||ae.description?.toLowerCase().includes(U))},[B,P,f]),I=c.useMemo(()=>s===void 0?[]:Array.isArray(s)?s:[s],[s]),z=c.useMemo(()=>B.filter(U=>I.some(ae=>ae===U.value)),[B,I]),$=U=>{if(!U.disabled)if(i){const ae=I.includes(U.value);let te;if(ae)te=I.filter(Z=>Z!==U.value);else{if(j&&I.length>=j)return;te=[...I,U.value]}a?.(te.length>0?te:void 0)}else{const ae=I.includes(U.value);a?.(ae?void 0:U.value),D(!1)}},_=async()=>{if(!(!l||!P.trim())){E(!0);try{let U;u?U=await u(P.trim()):U={value:P.trim(),label:P.trim()},K(ae=>[...ae,U]),$(U),R("")}catch(U){console.error("Creation error:",U)}finally{E(!1)}}},F=U=>{U.stopPropagation(),a?.(void 0),R("")},H=U=>{if(i){const ae=I.filter(te=>te!==U);a?.(ae.length>0?ae:void 0)}},J=c.useMemo(()=>{if(!l||!P.trim())return!1;const U=P.trim().toLowerCase();return!B.some(ae=>ae.label.toLowerCase()===U)},[l,P,B]),Q=c.useMemo(()=>Jx(W),[W]),ne=c.useMemo(()=>z.length===0?"":i?`${z.length} sélectionné${z.length>1?"s":""}`:z[0]?.label||"",[z,i]),X={sm:"h-8 text-xs",md:"h-9 text-sm",lg:"h-10 text-base"},Y={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"};return e.jsxs(rt,{open:N,onOpenChange:D,children:[e.jsx(nt,{asChild:!0,children:e.jsxs(L,{id:v,variant:"outline",role:"combobox","aria-expanded":N,disabled:p,className:b("w-full justify-between font-normal",X[g],!ne&&"text-muted-foreground",w&&"border-destructive focus-visible:ring-destructive",x),children:[e.jsx("span",{className:"flex-1 text-left truncate",children:ne||r}),e.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[q&&e.jsx(h.Loader2,{className:b(Y[g],"animate-spin")}),y&&I.length>0&&!p&&e.jsx(h.X,{className:b(Y[g],"opacity-50 hover:opacity-100"),onClick:F}),e.jsx(h.ChevronsUpDown,{className:b(Y[g],"opacity-50")})]})]})}),e.jsx(st,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:e.jsxs(ss,{shouldFilter:!1,children:[e.jsx(xs,{placeholder:n,value:P,onValueChange:R}),e.jsxs(ea,{children:[q&&e.jsx("div",{className:"flex items-center justify-center py-6",children:e.jsx(h.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),!q&&W.length===0&&!J&&e.jsx(gs,{children:o}),!q&&Array.from(Q.entries()).map(([U,ae],te)=>e.jsxs(c.Fragment,{children:[te>0&&e.jsx(wa,{}),e.jsx(Ot,{heading:U,children:ae.map(Z=>{const le=I.includes(Z.value);return e.jsxs(zt,{value:String(Z.value),onSelect:()=>$(Z),disabled:Z.disabled||i&&!!j&&I.length>=j&&!le,className:b("flex items-center gap-2",Z.disabled&&"opacity-50"),children:[e.jsx("div",{className:b("flex items-center justify-center w-4 h-4 border rounded",le?"bg-primary border-primary text-primary-foreground":"border-muted-foreground/30"),children:le&&e.jsx(h.Check,{className:"h-3 w-3"})}),Z.icon&&e.jsx("span",{className:"flex-shrink-0",children:Z.icon}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"truncate",children:Z.label}),Z.description&&e.jsx("div",{className:"text-xs text-muted-foreground truncate",children:Z.description})]})]},String(Z.value))})})]},U||"ungrouped")),J&&e.jsxs(e.Fragment,{children:[e.jsx(wa,{}),e.jsx(Ot,{children:e.jsxs(zt,{onSelect:_,className:"flex items-center gap-2",children:[e.jsx(h.Plus,{className:Y[g]}),e.jsxs("span",{children:[d,' "',P.trim(),'"']})]})})]})]})]})}),k&&e.jsx("input",{type:"hidden",name:k,value:i?I.join(","):String(I[0]||"")}),i&&z.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-2",children:z.map(U=>e.jsxs(Se,{variant:"secondary",className:"gap-1",children:[U.icon,U.label,e.jsx(h.X,{className:"h-3 w-3 cursor-pointer hover:text-destructive",onClick:()=>H(U.value)})]},String(U.value)))})]})}function Zx(t={}){const{options:s=[],initialValue:a,multiple:r=!1}=t,[n,o]=c.useState(a),[i,l]=c.useState(s);return{value:n,onChange:o,options:i,setOptions:l,clear:()=>o(void 0),addOption:w=>{l(C=>[...C,w])},removeOption:w=>{l(C=>C.filter(g=>g.value!==w)),r&&Array.isArray(n)?o(n.filter(C=>C!==w)):n===w&&o(void 0)},selectAll:()=>{r&&o(i.filter(w=>!w.disabled).map(w=>w.value))},selectNone:()=>o(r?[]:void 0),multiple:r}}const Ml=[{label:"Aujourd'hui",getValue:()=>({from:V.startOfDay(new Date),to:V.endOfDay(new Date)})},{label:"Hier",getValue:()=>({from:V.startOfDay(V.subDays(new Date,1)),to:V.endOfDay(V.subDays(new Date,1))})},{label:"7 derniers jours",getValue:()=>({from:V.startOfDay(V.subDays(new Date,6)),to:V.endOfDay(new Date)})},{label:"30 derniers jours",getValue:()=>({from:V.startOfDay(V.subDays(new Date,29)),to:V.endOfDay(new Date)})},{label:"Ce mois",getValue:()=>({from:V.startOfMonth(new Date),to:V.endOfMonth(new Date)})},{label:"Mois dernier",getValue:()=>({from:V.startOfMonth(V.subMonths(new Date,1)),to:V.endOfMonth(V.subMonths(new Date,1))})},{label:"Cette année",getValue:()=>({from:V.startOfYear(new Date),to:V.endOfDay(new Date)})}];function eg({value:t,onChange:s,placeholder:a="Sélectionner une période",dateFormat:r="dd/MM/yyyy",minDate:n,maxDate:o,disabled:i=!1,error:l=!1,showPresets:u=!0,presets:d=Ml,numberOfMonths:f=2,locale:m=ps,size:p="md",className:w,id:C,name:g,clearable:y=!0}){const[j,x]=c.useState(!1),[v,k]=c.useState(t);c.useEffect(()=>{k(t)},[t]);const N=E=>{k(E),s?.(E)},D=E=>{const T=E.getValue();N(T),x(!1)},P=E=>{E.stopPropagation(),N(void 0)},R=c.useMemo(()=>{if(!v?.from)return"";const E=V.format(v.from,r,{locale:m});if(!v.to)return E;const T=V.format(v.to,r,{locale:m});return`${E} - ${T}`},[v,r,m]),A={sm:"h-8 text-xs px-2",md:"h-9 text-sm px-3",lg:"h-10 text-base px-4"},S={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},M=c.useMemo(()=>{const E=[];return n&&E.push(T=>V.isBefore(T,V.startOfDay(n))),o&&E.push(T=>V.isAfter(T,V.endOfDay(o))),E.length>0?T=>E.some(K=>K(T)):void 0},[n,o]);return e.jsxs(rt,{open:j,onOpenChange:x,children:[e.jsx(nt,{asChild:!0,children:e.jsxs(L,{id:C,variant:"outline",role:"combobox","aria-expanded":j,disabled:i,className:b("w-full justify-start font-normal",A[p],!R&&"text-muted-foreground",l&&"border-destructive focus-visible:ring-destructive",w),children:[e.jsx(h.Calendar,{className:b(S[p],"mr-2")}),e.jsx("span",{className:"flex-1 text-left truncate",children:R||a}),y&&R&&!i&&e.jsx(h.X,{className:b(S[p],"ml-2 opacity-50 hover:opacity-100"),onClick:P})]})}),e.jsxs(st,{className:"w-auto p-0",align:"start",children:[e.jsxs("div",{className:"flex",children:[u&&d.length>0&&e.jsx("div",{className:"border-r p-2 space-y-1",children:d.map((E,T)=>e.jsx(L,{variant:"ghost",size:"sm",className:"w-full justify-start text-xs",onClick:()=>D(E),children:E.label},T))}),e.jsx("div",{className:"p-3",children:e.jsx(Ma,{mode:"range",selected:v,onSelect:N,numberOfMonths:f,locale:m,disabled:M,initialFocus:!0})})]}),e.jsxs("div",{className:"border-t p-3 flex justify-between items-center",children:[e.jsx("div",{className:"text-xs text-muted-foreground",children:v?.from&&v?.to&&e.jsxs(e.Fragment,{children:[Math.ceil((v.to.getTime()-v.from.getTime())/(1e3*60*60*24))+1," ","jours sélectionnés"]})}),e.jsxs("div",{className:"flex gap-2",children:[y&&e.jsx(L,{variant:"ghost",size:"sm",onClick:()=>N(void 0),children:"Effacer"}),e.jsx(L,{size:"sm",onClick:()=>x(!1),children:"Appliquer"})]})]})]})]})}function tg(t={}){const{initialValue:s,minDate:a,maxDate:r}=t,[n,o]=c.useState(s),i=()=>o(void 0),l=()=>{o({from:V.startOfDay(new Date),to:V.endOfDay(new Date)})},u=()=>{o({from:V.startOfDay(V.subDays(new Date,6)),to:V.endOfDay(new Date)})},d=()=>{o({from:V.startOfMonth(new Date),to:V.endOfMonth(new Date)})},f=p=>!(!p?.from||!p?.to||!V.isValid(p.from)||!V.isValid(p.to)||V.isAfter(p.from,p.to)||a&&V.isBefore(p.from,V.startOfDay(a))||r&&V.isAfter(p.to,V.endOfDay(r)));return{value:n,onChange:o,clear:i,setToday:l,setThisWeek:u,setThisMonth:d,isValidRange:()=>f(n),dayCount:!n?.from||!n?.to?null:Math.ceil((n.to.getTime()-n.from.getTime())/(1e3*60*60*24))+1,minDate:a,maxDate:r}}let eo=!1,mr=null;!eo&&!$t.isInitialized&&(eo=!0,mr=$t.use(wt.initReactI18next).init({resources:{},fallbackLng:"fr",lng:"fr",defaultNS:"translation",ns:["translation"],debug:!1,interpolation:{escapeValue:!1},react:{useSuspense:!1},ignoreJSONStructure:!0,returnNull:!1,returnEmptyString:!1,returnObjects:!1,load:"languageOnly",detection:void 0,initImmediate:!0}).then(()=>(console.log("[i18n] Initialized successfully"),$t)).catch(t=>(console.error("[i18n] Failed to initialize:",t),$t)));function Pl(){const[t,s]=O.useState($t.isInitialized);return O.useEffect(()=>{if($t.isInitialized){s(!0);return}if(mr)mr.then(()=>{s(!0)});else{const a=setTimeout(()=>{s(!0)},100);return()=>clearTimeout(a)}},[]),!t||!$t.isInitialized?{t:a=>a,i18n:$t,ready:!1}:wt.useTranslation()}_t.registerLocale("fr",ps);_t.registerLocale("en",Fo);_t.registerLocale("es",$o);_t.registerLocale("de",Ro);_t.registerLocale("it",Lo);_t.registerLocale("pt",Oo);_t.registerLocale("ja",Io);_t.registerLocale("zh",zo);const Yr=c.forwardRef(({value:t,onChange:s,placeholder:a,disabled:r=!1,className:n,variant:o="date",format:i,minDate:l,maxDate:u,showSeconds:d=!1,showClear:f=!0,showPresets:m=!1,presets:p,locale:w="fr",timeFormat:C="24h",size:g="md",error:y,label:j,required:x=!1,inline:v=!1,monthsShown:k=1,timeIntervals:N=15,validation:D,showWeekNumbers:P=!1,showTodayButton:R=!0,showSelectionInfo:A=!1,allowTimeRange:S=!1,timezone:M,onBeforeChange:E,onAfterChange:T,renderDay:K,popoverClassName:q,disableAnimations:B=!1,readOnly:W=!1,id:I,name:z,autoFocus:$=!1},_)=>{const{t:F}=Pl(),[H,J]=c.useState(!1),[Q,ne]=c.useState(o==="range"&&t&&!("from"in t)?{from:t,to:void 0}:t),[X,Y]=c.useState(null),[U,ae]=c.useState(null),Z={fr:ps,en:Fo,es:$o,de:Ro,it:Lo,pt:Oo,ja:Io,zh:zo}[w]||ps,le=[{label:F?.("today")||"Aujourd'hui",value:()=>new Date},{label:F?.("yesterday")||"Hier",value:()=>V.subDays(new Date,1)},{label:F?.("thisWeek")||"Cette semaine",range:()=>({from:V.startOfWeek(new Date,{locale:Z}),to:V.endOfWeek(new Date,{locale:Z})})},{label:F?.("lastWeek")||"Semaine dernière",range:()=>({from:V.startOfWeek(V.subWeeks(new Date,1),{locale:Z}),to:V.endOfWeek(V.subWeeks(new Date,1),{locale:Z})})},{label:F?.("thisMonth")||"Ce mois",range:()=>({from:V.startOfMonth(new Date),to:V.endOfMonth(new Date)})},{label:F?.("lastMonth")||"Mois dernier",range:()=>({from:V.startOfMonth(V.subMonths(new Date,1)),to:V.endOfMonth(V.subMonths(new Date,1))})},{label:F?.("last7Days")||"7 derniers jours",range:()=>({from:V.subDays(new Date,7),to:new Date})},{label:F?.("last30Days")||"30 derniers jours",range:()=>({from:V.subDays(new Date,30),to:new Date})},{label:F?.("thisYear")||"Cette année",range:()=>({from:V.startOfYear(new Date),to:V.endOfYear(new Date)})}],xe=p||(m?le:[]),se={sm:"h-8 px-3 text-xs",md:"h-10 px-4 text-sm",lg:"h-12 px-5 text-base"},De=i||(()=>{switch(o){case"time":return d?C==="12h"?"h:mm:ss a":"HH:mm:ss":C==="12h"?"h:mm a":"HH:mm";case"datetime":return d?C==="12h"?"PPP h:mm:ss a":"PPP HH:mm:ss":C==="12h"?"PPP h:mm a":"PPP HH:mm";case"range":return"PPP";case"multiple":return"PPP";default:return"PPP"}})(),Ne=ee=>{if(!D)return null;if(l&&V.isBefore(ee,V.startOfDay(l)))return F?.("dateBeforeMin")||`Date antérieure au ${V.format(l,De,{locale:Z})}`;if(u&&V.isAfter(ee,V.endOfDay(u)))return F?.("dateAfterMax")||`Date postérieure au ${V.format(u,De,{locale:Z})}`;if(D.disabledDates?.some(re=>V.isEqual(V.startOfDay(re),V.startOfDay(ee)))||D.disabledDatesFn?.(ee))return D.message||F?.("dateDisabled")||"Date désactivée";if(D.disabledDaysOfWeek?.includes(ee.getDay()))return D.message||F?.("dayOfWeekDisabled")||"Jour de la semaine désactivé";if(D.validate){const re=D.validate(ee);if(re===!1)return D.message||F?.("invalidDate")||"Date invalide";if(typeof re=="string")return re}return null},Ke=ee=>{if(W)return;let re=null;if(o==="range"){if(Array.isArray(ee)&&ee[0]&&ee[1])re={from:ee[0],to:ee[1]};else if(ee){const we=Q;we?.from&&!we.to?re={from:we.from,to:ee}:re={from:ee,to:void 0}}}else if(o==="multiple")if(Array.isArray(Q)){const we=[...Q],be=we.findIndex(Mt=>V.isEqual(V.startOfDay(Mt),V.startOfDay(ee)));be>=0?we.splice(be,1):we.push(ee),re=we}else re=ee?[ee]:[];else re=ee;if(!(E&&!E(re))){if(re&&!re.from&&!Array.isArray(re)){const we=Ne(re);if(we){Y(we);return}}Y(null),ne(re),s?.(re),T?.(re),o!=="range"&&o!=="multiple"&&!v&&J(!1)}},xt=ee=>{if(ee.range){const re=typeof ee.range=="function"?ee.range():ee.range;Ke([re.from,re.to])}else if(ee.value){const re=typeof ee.value=="function"?ee.value():ee.value;Ke(re)}v||J(!1)},Ye=ee=>{ee&&ee.stopPropagation(),!W&&(ne(null),Y(null),s?.(null),T?.(null))},et=()=>{Ke(new Date)},gt=()=>{if(!Q)return a||F?.("selectDate")||"Sélectionner une date";try{if(o==="range"){const ee=Q;return ee.from&&ee.to?`${V.format(ee.from,De,{locale:Z})} - ${V.format(ee.to,De,{locale:Z})}`:ee.from?`${V.format(ee.from,De,{locale:Z})} - ...`:a||F?.("selectDateRange")||"Sélectionner une période"}if(o==="multiple"){const ee=Q;return ee.length===0?a||F?.("selectDates")||"Sélectionner des dates":ee.length===1?V.format(ee[0],De,{locale:Z}):`${ee.length} ${F?.("datesSelected")||"dates sélectionnées"}`}return V.format(Q,De,{locale:Z})}catch(ee){return console.error("Error formatting date:",ee),a||F?.("selectDate")||"Sélectionner une date"}},Et=ee=>!!(l&&V.isBefore(ee,V.startOfDay(l))||u&&V.isAfter(ee,V.endOfDay(u))||D?.disabledDates?.some(re=>V.isEqual(V.startOfDay(re),V.startOfDay(ee)))||D?.disabledDatesFn?.(ee)||D?.disabledDaysOfWeek?.includes(ee.getDay())),Je=ee=>!!(D?.highlightedDates?.some(re=>V.isEqual(V.startOfDay(re),V.startOfDay(ee)))||D?.highlightedDatesFn?.(ee)),G=()=>{const ee={selected:o==="range"?Q?.from:o==="multiple"?void 0:Q,onChange:Ke,startDate:o==="range"?Q?.from:void 0,endDate:o==="range"?Q?.to:void 0,selectsRange:o==="range",selectsMultiple:o==="multiple",highlightDates:o==="multiple"?Q:void 0,showTimeSelect:o==="time"||o==="datetime",showTimeSelectOnly:o==="time",timeFormat:d?C==="12h"?"h:mm:ss aa":"HH:mm:ss":C==="12h"?"h:mm aa":"HH:mm",timeIntervals:N,timeCaption:F?.("time")||"Heure",dateFormat:De,locale:w,placeholderText:a,disabled:r,minDate:l,maxDate:u,inline:v,monthsShown:o==="range"?Math.max(2,k):k,showWeekNumbers:P,filterDate:re=>!Et(re),dayClassName:re=>{const we=[];if(Je(re)&&we.push("highlighted-date"),U&&o==="range"){const be=Q;be?.from&&!be.to&&V.isWithinInterval(re,{start:be.from<U?be.from:U,end:be.from>U?be.from:U})&&we.push("in-selecting-range")}return we.join(" ")},onDayMouseEnter:re=>ae(re),calendarClassName:b("waka-datepicker",B&&"no-animations"),wrapperClassName:"w-full",autoFocus:$};return e.jsxs("div",{className:"flex gap-3",children:[m&&xe.length>0&&e.jsxs("div",{className:"flex flex-col gap-1 min-w-[150px] border-r border-border pr-3",children:[e.jsx(me,{className:"text-xs font-semibold text-muted-foreground mb-1",children:F?.("quickSelection")||"Sélection rapide"}),e.jsx(At,{className:"h-[300px]",children:e.jsx("div",{className:"space-y-1",children:xe.map((re,we)=>e.jsx(L,{variant:"ghost",size:"sm",className:"w-full justify-start text-xs",onClick:()=>xt(re),children:re.label},we))})})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx(_t,{...ee}),A&&Q&&e.jsxs("div",{className:"mt-3 p-2 bg-muted rounded-md text-xs space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.Info,{className:"h-3 w-3 text-muted-foreground"}),e.jsxs("span",{className:"font-medium",children:[F?.("selection")||"Sélection"," :"]})]}),e.jsx("div",{className:"text-muted-foreground pl-5",children:gt()})]})]})]})};return v?e.jsxs("div",{ref:_,className:b("space-y-2",n),id:I,children:[j&&e.jsxs(me,{className:"text-sm font-medium text-foreground",children:[j,x&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.jsx("div",{className:"border border-border rounded-lg p-4 bg-card",children:G()}),(y||X)&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-destructive",children:[e.jsx(h.AlertCircle,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:y||X})]})]}):e.jsxs("div",{ref:_,className:b("space-y-2",n),id:I,children:[j&&e.jsxs(me,{htmlFor:`${I}-input`,className:"text-sm font-medium text-foreground",children:[j,x&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.jsxs(rt,{open:H,onOpenChange:J,children:[e.jsx(nt,{asChild:!0,children:e.jsxs(L,{id:`${I}-input`,name:z,variant:"outline",disabled:r||W,className:b("w-full justify-between text-left font-normal",!Q&&"text-muted-foreground",se[g],(y||X)&&"border-destructive focus-visible:ring-destructive",W&&"cursor-default opacity-70"),"aria-label":j||a,"aria-invalid":!!(y||X),"aria-required":x,children:[e.jsxs("span",{className:"flex items-center gap-2 flex-1 truncate",children:[o==="time"?e.jsx(h.Clock,{className:"h-4 w-4 flex-shrink-0"}):e.jsx(h.Calendar,{className:"h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"truncate",children:gt()})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0 ml-2",children:[Q&&f&&!W&&e.jsx(Ks,{children:e.jsxs(Ys,{children:[e.jsx(Js,{asChild:!0,children:e.jsx("div",{className:"h-5 w-5 rounded hover:bg-destructive/10 flex items-center justify-center cursor-pointer",onClick:Ye,role:"button","aria-label":F?.("clear")||"Effacer",children:e.jsx(h.X,{className:"h-3 w-3 text-muted-foreground hover:text-destructive"})})}),e.jsx(ks,{children:e.jsx("p",{children:F?.("clear")||"Effacer"})})]})}),X&&e.jsx(Ks,{children:e.jsxs(Ys,{children:[e.jsx(Js,{asChild:!0,children:e.jsx(h.AlertCircle,{className:"h-4 w-4 text-destructive"})}),e.jsx(ks,{children:e.jsx("p",{children:X})})]})})]})]})}),e.jsxs(st,{className:b("w-auto p-0",q),align:"start",sideOffset:4,children:[e.jsx("div",{className:"p-4",children:G()}),(R||f)&&e.jsxs(e.Fragment,{children:[e.jsx(kt,{}),e.jsxs("div",{className:"flex items-center justify-between p-3 gap-2",children:[R&&e.jsxs(L,{variant:"outline",size:"sm",onClick:et,disabled:r||W,children:[e.jsx(h.Calendar,{className:"h-3.5 w-3.5 mr-1.5"}),F?.("today")||"Aujourd'hui"]}),f&&Q&&e.jsxs(L,{variant:"outline",size:"sm",onClick:Ye,disabled:r||W,className:"ml-auto",children:[e.jsx(h.X,{className:"h-3.5 w-3.5 mr-1.5"}),F?.("clear")||"Effacer"]})]})]})]})]}),(y||X)&&e.jsxs("div",{className:"flex items-center gap-1.5 text-sm text-destructive",children:[e.jsx(h.AlertCircle,{className:"h-3.5 w-3.5"}),e.jsx("span",{children:y||X})]})]})});Yr.displayName="WakaDateTimePicker";function sg({name:t,control:s,defaultValue:a,...r}){return e.jsx(hi,{name:t,control:s,defaultValue:a,render:({field:n,fieldState:o})=>e.jsx(Yr,{...r,value:n.value,onChange:n.onChange,error:o.error?.message})})}function ag(t){return c.useMemo(()=>({formatDateForSubmit:a=>a?a.toISOString():null,formatRangeForSubmit:a=>!a?.from||!a?.to?null:{from:a.from.toISOString(),to:a.to.toISOString()},parseDateFromServer:a=>a?new Date(a):null,parseRangeFromServer:a=>a?{from:new Date(a.from),to:new Date(a.to)}:null}),[])}const rg={left:{sm:"w-64",md:"w-80",lg:"w-96",xl:"w-[480px]",full:"w-screen"},right:{sm:"w-64",md:"w-80",lg:"w-96",xl:"w-[480px]",full:"w-screen"},top:{sm:"h-32",md:"h-48",lg:"h-64",xl:"h-96",full:"h-screen"},bottom:{sm:"h-32",md:"h-48",lg:"h-64",xl:"h-96",full:"h-screen"}},ng={left:"left-0 top-0 h-full",right:"right-0 top-0 h-full",top:"top-0 left-0 w-full",bottom:"bottom-0 left-0 w-full"},og={left:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left",right:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right",top:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom"},Jr=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b("flex flex-col space-y-1.5 p-4 border-b",t),...s}));Jr.displayName="DrawerHeader";const Qr=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b("flex-1 overflow-auto p-4",t),...s}));Qr.displayName="DrawerBody";const Zr=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b("flex items-center justify-end gap-2 p-4 border-t",t),...s}));Zr.displayName="DrawerFooter";const Ca=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Title,{ref:a,className:b("text-lg font-semibold leading-none tracking-tight",t),...s}));Ca.displayName="DrawerTitle";const ka=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Description,{ref:a,className:b("text-sm text-muted-foreground",t),...s}));ka.displayName="DrawerDescription";function ig({open:t,onOpenChange:s,position:a="right",size:r="md",title:n,description:o,showCloseButton:i=!0,closeOnOverlayClick:l=!0,closeOnEscape:u=!0,showOverlay:d=!0,children:f,footer:m,className:p,contentClassName:w}){const C=y=>{l||y.preventDefault()},g=y=>{u||y.preventDefault()};return e.jsx(ue.Root,{open:t,onOpenChange:s,children:e.jsxs(ue.Portal,{children:[d&&e.jsx(ue.Overlay,{className:b("fixed inset-0 z-50 bg-black/50","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0")}),e.jsxs(ue.Content,{onPointerDownOutside:C,onEscapeKeyDown:g,"aria-describedby":o?void 0:"drawer-description",className:b("fixed z-50 bg-background shadow-lg flex flex-col","duration-300 ease-in-out",ng[a],rg[a][r],og[a],p),children:[!n&&e.jsx(Ca,{className:"sr-only",children:"Panneau latéral"}),!o&&e.jsx(ka,{id:"drawer-description",className:"sr-only",children:"Contenu du panneau latéral"}),(n||o||i)&&e.jsx(Jr,{children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[n&&e.jsx(Ca,{children:n}),o&&e.jsx(ka,{children:o})]}),i&&e.jsxs(ue.Close,{className:"rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[e.jsx(h.X,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Fermer"})]})]})}),e.jsx(Qr,{className:w,children:f}),m&&e.jsx(Zr,{children:m})]})]})})}function lg(t={}){const{defaultOpen:s=!1,onOpen:a,onClose:r}=t,[n,o]=c.useState(s),i=c.useCallback(f=>{o(f),f?a?.():r?.()},[a,r]),l=c.useCallback(()=>i(!0),[i]),u=c.useCallback(()=>i(!1),[i]),d=c.useCallback(()=>i(!n),[i,n]);return{open:n,onOpenChange:i,openDrawer:l,closeDrawer:u,toggleDrawer:d}}const cg=ue.Trigger,dg=ue.Close;function Za(t){if(t===0)return"0 Bytes";const s=1024,a=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(t)/Math.log(s));return`${parseFloat((t/Math.pow(s,r)).toFixed(2))} ${a[r]}`}function ug(t){const s=t.type;return s.startsWith("image/")?h.Image:s.includes("pdf")?h.FileText:s.includes("spreadsheet")||s.includes("excel")||s.includes("csv")?h.FileSpreadsheet:s.includes("zip")||s.includes("archive")||s.includes("compressed")?h.FileArchive:h.File}const Rl=c.forwardRef(({variant:t="dropzone",accept:s,maxSize:a=10*1024*1024,maxFiles:r=5,multiple:n=!1,onUpload:o,onComplete:i,onRemove:l,onError:u,showPreview:d=!0,showProgress:f=!0,disabled:m=!1,className:p,placeholder:w="Glissez vos fichiers ici ou cliquez pour sélectionner",label:C,description:g},y)=>{const[j,x]=c.useState([]),[v,k]=c.useState(!1),N=c.useRef(null),D=()=>`${Date.now()}-${Math.random().toString(36).slice(2,11)}`,P=W=>a&&W.size>a?`Le fichier dépasse la taille maximale de ${Za(a)}`:s&&!s.split(",").map($=>$.trim()).some($=>$.startsWith(".")?W.name.toLowerCase().endsWith($.toLowerCase()):$.endsWith("/*")?W.type.startsWith($.replace("/*","/")):W.type===$)?`Type de fichier non accepté. Types acceptés: ${s}`:null,R=async W=>{const I=Array.from(W),z=j.filter(J=>J.status!=="error").length,$=r-z,_=I.slice(0,$);I.length>$&&u?.(`Nombre maximum de fichiers atteint (${r})`);const F=_.map(J=>({id:D(),file:J,progress:0,status:"pending"})),H=[];for(const J of F){const Q=P(J.file);Q&&(J.status="error",J.error=Q,u?.(Q,J.file)),H.push(J)}if(x(J=>[...J,...H]),o)for(const J of H.filter(Q=>Q.status==="pending"))try{x(ne=>ne.map(X=>X.id===J.id?{...X,status:"uploading"}:X));const Q=await o(J.file,ne=>{x(X=>X.map(Y=>Y.id===J.id?{...Y,progress:ne}:Y))});x(ne=>ne.map(X=>X.id===J.id?{...X,status:"success",progress:100,url:Q}:X))}catch(Q){const ne=Q instanceof Error?Q.message:"Erreur d'upload";x(X=>X.map(Y=>Y.id===J.id?{...Y,status:"error",error:ne}:Y)),u?.(ne,J.file)}else x(J=>J.map(Q=>H.some(ne=>ne.id===Q.id)&&Q.status==="pending"?{...Q,status:"success",progress:100}:Q))};c.useEffect(()=>{j.length>0&&j.every(I=>I.status!=="pending"&&I.status!=="uploading")&&i?.(j)},[j,i]);const A=W=>{if(W.preventDefault(),k(!1),m)return;const I=W.dataTransfer.files;I.length>0&&R(n?I:[I[0]])},S=W=>{const I=W.target.files;I&&I.length>0&&R(n?I:[I[0]]),W.target.value=""},M=W=>{x(I=>I.filter(z=>z.id!==W.id)),l?.(W)},E=()=>{m||N.current?.click()},T=()=>e.jsx("div",{className:b("relative border-2 border-dashed rounded-lg p-6 transition-colors",v&&"border-primary bg-primary/5",m&&"opacity-50 cursor-not-allowed",!m&&"cursor-pointer hover:border-primary/50",p),onDragOver:W=>{W.preventDefault(),m||k(!0)},onDragLeave:()=>k(!1),onDrop:A,onClick:E,children:e.jsxs("div",{className:"flex flex-col items-center justify-center text-center",children:[e.jsx(h.Upload,{className:b("h-10 w-10 mb-3",v?"text-primary":"text-muted-foreground")}),e.jsx("p",{className:"text-sm font-medium",children:w}),g&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:g}),a&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Taille max: ",Za(a)]})]})}),K=()=>e.jsxs(L,{variant:"outline",disabled:m,onClick:E,className:p,children:[e.jsx(h.Upload,{className:"h-4 w-4 mr-2"}),w||"Sélectionner un fichier"]}),q=()=>e.jsxs("div",{className:b("flex items-center gap-2 p-2 border rounded-lg",m&&"opacity-50 cursor-not-allowed",!m&&"cursor-pointer hover:bg-muted/50",p),onClick:E,children:[e.jsx(h.Upload,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:w||"Ajouter un fichier"})]}),B=W=>{const I=ug(W.file),z=W.file.type.startsWith("image/");return e.jsxs("div",{className:b("flex items-center gap-3 p-2 rounded-lg border",W.status==="error"&&"border-destructive bg-destructive/5"),children:[e.jsx("div",{className:"w-10 h-10 rounded flex items-center justify-center bg-muted overflow-hidden flex-shrink-0",children:d&&z&&W.status!=="error"?e.jsx("img",{src:URL.createObjectURL(W.file),alt:W.file.name,className:"w-full h-full object-cover"}):e.jsx(I,{className:"h-5 w-5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:W.file.name}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:Za(W.file.size)}),W.status==="error"&&e.jsxs("span",{className:"text-destructive flex items-center gap-1",children:[e.jsx(h.AlertCircle,{className:"h-3 w-3"}),W.error]}),W.status==="success"&&e.jsxs("span",{className:"text-green-600 flex items-center gap-1",children:[e.jsx(h.Check,{className:"h-3 w-3"}),"Uploadé"]})]}),f&&W.status==="uploading"&&e.jsx(Xs,{value:W.progress,className:"h-1 mt-1"})]}),e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8 flex-shrink-0",onClick:$=>{$.stopPropagation(),M(W)},children:e.jsx(h.X,{className:"h-4 w-4"})})]},W.id)};return e.jsxs("div",{ref:y,className:"space-y-3",children:[C&&e.jsx(me,{children:C}),e.jsx("input",{ref:N,type:"file",accept:s,multiple:n,onChange:S,className:"sr-only",disabled:m}),t==="dropzone"&&T(),t==="button"&&K(),t==="inline"&&q(),j.length>0&&e.jsx("div",{className:"space-y-2",children:j.map(B)})]})});Rl.displayName="WakaFileUpload";function Fl({src:t,alt:s,width:a,height:r,placeholder:n,placeholderColor:o="bg-muted",lazy:i=!0,zoomable:l=!1,maxZoom:u=3,objectFit:d="cover",objectPosition:f="center",rounded:m="md",showLoader:p=!0,onLoad:w,onError:C,onZoomChange:g,className:y,containerClassName:j,aspectRatio:x}){const[v,k]=c.useState(!1),[N,D]=c.useState(!1),[P,R]=c.useState(!1),[A,S]=c.useState(1),[M,E]=c.useState({x:0,y:0}),[T,K]=c.useState(!1),[q,B]=c.useState({x:0,y:0}),W=c.useRef(null),I={none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl",full:"rounded-full"},z=()=>{k(!0),w?.()},$=()=>{D(!0),C?.()},_=()=>{l&&(R(!0),S(1),E({x:0,y:0}))},F=()=>{const U=Math.min(A+.5,u);S(U),g?.(U)},H=()=>{const U=Math.max(A-.5,1);S(U),U===1&&E({x:0,y:0}),g?.(U)},J=U=>{U.preventDefault(),U.deltaY<0?F():H()},Q=U=>{A>1&&(K(!0),B({x:U.clientX-M.x,y:U.clientY-M.y}))},ne=U=>{T&&A>1&&E({x:U.clientX-q.x,y:U.clientY-q.y})},X=()=>{K(!1)},Y=async()=>{try{const ae=await(await fetch(t)).blob(),te=window.URL.createObjectURL(ae),Z=document.createElement("a");Z.href=te,Z.download=s||"image",document.body.appendChild(Z),Z.click(),document.body.removeChild(Z),window.URL.revokeObjectURL(te)}catch(U){console.error("Failed to download image:",U)}};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:b("relative overflow-hidden",I[m],j),style:{width:a,height:r,aspectRatio:x},children:[(!v||N)&&e.jsx("div",{className:b("absolute inset-0 flex items-center justify-center",o,I[m]),children:n?e.jsx("img",{src:n,alt:"",className:b("w-full h-full",`object-${d}`),style:{objectPosition:f}}):N?e.jsxs("div",{className:"flex flex-col items-center gap-2 text-muted-foreground",children:[e.jsx(h.ImageIcon,{className:"h-8 w-8"}),e.jsx("span",{className:"text-xs",children:"Erreur de chargement"})]}):p?e.jsx("div",{className:"animate-pulse",children:e.jsx(h.ImageIcon,{className:"h-8 w-8 text-muted-foreground"})}):null}),!N&&e.jsx("img",{ref:W,src:t,alt:s,loading:i?"lazy":"eager",onLoad:z,onError:$,onClick:_,className:b("w-full h-full transition-opacity duration-300",`object-${d}`,v?"opacity-100":"opacity-0",l&&"cursor-zoom-in",I[m],y),style:{objectPosition:f}}),l&&v&&!N&&e.jsx("div",{className:"absolute bottom-2 right-2 p-1 bg-black/50 rounded text-white",children:e.jsx(h.Maximize2,{className:"h-4 w-4"})})]}),l&&e.jsx(It,{open:P,onOpenChange:R,children:e.jsxs(Tt,{className:"max-w-[95vw] max-h-[95vh] p-0 overflow-hidden bg-black/95",onWheel:J,children:[e.jsxs("div",{className:"absolute top-4 right-4 z-50 flex gap-2",children:[e.jsx(L,{variant:"secondary",size:"icon",onClick:H,disabled:A<=1,children:e.jsx(h.ZoomOut,{className:"h-4 w-4"})}),e.jsx(L,{variant:"secondary",size:"icon",onClick:F,disabled:A>=u,children:e.jsx(h.ZoomIn,{className:"h-4 w-4"})}),e.jsx(L,{variant:"secondary",size:"icon",onClick:Y,children:e.jsx(h.Download,{className:"h-4 w-4"})}),e.jsx(Xo,{asChild:!0,children:e.jsx(L,{variant:"secondary",size:"icon",children:e.jsx(h.X,{className:"h-4 w-4"})})})]}),e.jsxs("div",{className:"absolute bottom-4 left-4 z-50 text-white text-sm bg-black/50 px-2 py-1 rounded",children:[Math.round(A*100),"%"]}),e.jsx("div",{className:b("w-full h-full flex items-center justify-center overflow-hidden",A>1?"cursor-grab":"cursor-default",T&&"cursor-grabbing"),onMouseDown:Q,onMouseMove:ne,onMouseUp:X,onMouseLeave:X,children:e.jsx("img",{src:t,alt:s,className:"max-w-none select-none",style:{transform:`scale(${A}) translate(${M.x/A}px, ${M.y/A}px)`,transition:T?"none":"transform 0.2s ease-out"},draggable:!1})})]})})]})}function mg({images:t,columns:s=3,gap:a=4,aspectRatio:r="1/1",className:n}){return e.jsx("div",{className:b("grid",n),style:{gridTemplateColumns:`repeat(${s}, 1fr)`,gap:`${a*4}px`},children:t.map((o,i)=>e.jsx(Fl,{src:o.thumbnail||o.src,alt:o.alt,zoomable:!0,objectFit:"cover",containerClassName:"w-full",aspectRatio:r},i))})}const hg={low:"bg-gray-100 text-gray-700 border-gray-200",medium:"bg-blue-100 text-blue-700 border-blue-200",high:"bg-orange-100 text-orange-700 border-orange-200",urgent:"bg-red-100 text-red-700 border-red-200"};function fg({card:t,columnId:s,onCardClick:a,onCardDelete:r,renderCard:n,onDragStart:o}){return n?e.jsx("div",{draggable:!0,onDragStart:i=>o(i,t.id,s),className:"cursor-grab active:cursor-grabbing",children:n(t,s)}):e.jsxs("div",{draggable:!0,onDragStart:i=>o(i,t.id,s),onClick:()=>a?.(t,s),className:b("group bg-card border rounded-lg p-3 shadow-sm cursor-grab active:cursor-grabbing","hover:border-primary/50 hover:shadow-md transition-all duration-200"),children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[t.labels&&t.labels.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:t.labels.map(i=>e.jsx("span",{className:"px-1.5 py-0.5 text-[10px] font-medium rounded",style:{backgroundColor:i.color+"20",color:i.color},children:i.name},i.id))}),e.jsx("h4",{className:"font-medium text-sm truncate",children:t.title}),t.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:t.description})]}),e.jsx(h.GripVertical,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"})]}),(t.priority||t.assignee||t.dueDate)&&e.jsxs("div",{className:"flex items-center justify-between mt-3 pt-2 border-t",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[t.priority&&e.jsx("span",{className:b("px-1.5 py-0.5 text-[10px] font-medium rounded border",hg[t.priority]),children:t.priority}),t.dueDate&&e.jsx("span",{className:"text-[10px] text-muted-foreground",children:t.dueDate.toLocaleDateString()})]}),t.assignee&&e.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/10 flex items-center justify-center text-[10px] font-medium",title:t.assignee.name,children:t.assignee.avatar?e.jsx("img",{src:t.assignee.avatar,alt:t.assignee.name,className:"h-full w-full rounded-full object-cover"}):t.assignee.name.charAt(0).toUpperCase()})]}),r&&e.jsx(L,{variant:"ghost",size:"icon",className:"absolute top-1 right-1 h-6 w-6 opacity-0 group-hover:opacity-100",onClick:i=>{i.stopPropagation(),r(t.id,s)},children:e.jsx(h.X,{className:"h-3 w-3"})})]})}function pg({column:t,onCardMove:s,onCardAdd:a,onCardDelete:r,onCardClick:n,onColumnDelete:o,allowAddCard:i,allowColumnDrag:l,renderCard:u,draggedCard:d,setDraggedCard:f,onColumnDragStart:m}){const[p,w]=c.useState(!1),[C,g]=c.useState(""),[y,j]=c.useState(null),x=(A,S,M)=>{f({id:S,fromColumnId:M}),A.dataTransfer.effectAllowed="move"},v=(A,S)=>{A.preventDefault(),d&&j(S)},k=()=>{j(null)},N=(A,S)=>{A.preventDefault(),d&&s&&s(d.id,d.fromColumnId,t.id,S),f(null),j(null)},D=A=>{A.preventDefault(),d&&s&&s(d.id,d.fromColumnId,t.id,t.cards.length),f(null),j(null)},P=()=>{C.trim()&&a&&(a(t.id,{title:C.trim()}),g(""),w(!1))},R=t.limit!==void 0&&t.cards.length>=t.limit;return e.jsxs("div",{className:"flex flex-col bg-muted/50 rounded-lg min-w-[280px] max-w-[320px] h-full",onDragOver:A=>A.preventDefault(),onDrop:D,children:[e.jsxs("div",{className:b("flex items-center justify-between p-3 border-b",l&&"cursor-grab active:cursor-grabbing"),draggable:l,onDragStart:A=>m(A,t.id),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[t.color&&e.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:t.color}}),e.jsx("h3",{className:"font-semibold text-sm",children:t.title}),e.jsxs("span",{className:"text-xs text-muted-foreground bg-background px-1.5 py-0.5 rounded",children:[t.cards.length,t.limit&&`/${t.limit}`]})]}),o&&e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx(L,{variant:"ghost",size:"icon",className:"h-6 w-6",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsx(_e,{align:"end",children:e.jsx(pe,{className:"text-destructive",onClick:()=>o(t.id),children:"Supprimer la colonne"})})]})]}),e.jsx(At,{className:"flex-1 p-2",children:e.jsxs("div",{className:"space-y-2",children:[t.cards.map((A,S)=>e.jsxs("div",{onDragOver:M=>v(M,S),onDragLeave:k,onDrop:M=>N(M,S),children:[y===S&&d&&e.jsx("div",{className:"h-1 bg-primary rounded mb-2"}),e.jsx(fg,{card:A,columnId:t.id,onCardClick:n,onCardDelete:r,renderCard:u,onDragStart:x})]},A.id)),d&&y===null&&e.jsx("div",{className:"h-20 border-2 border-dashed border-primary/30 rounded-lg",onDragOver:A=>{A.preventDefault(),j(t.cards.length)}})]})}),i&&e.jsx("div",{className:"p-2 border-t",children:p?e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{value:C,onChange:A=>g(A.target.value),placeholder:"Titre de la carte...",autoFocus:!0,onKeyDown:A=>{A.key==="Enter"&&P(),A.key==="Escape"&&w(!1)}}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(L,{size:"sm",onClick:P,disabled:!C.trim(),children:"Ajouter"}),e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>w(!1),children:"Annuler"})]})]}):e.jsxs(L,{variant:"ghost",className:"w-full justify-start text-muted-foreground",onClick:()=>w(!0),disabled:R,children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-1"}),"Ajouter une carte"]})})]})}function xg({columns:t,onCardMove:s,onColumnMove:a,onCardAdd:r,onCardDelete:n,onCardClick:o,onColumnAdd:i,onColumnDelete:l,allowAddCard:u=!0,allowAddColumn:d=!1,allowColumnDrag:f=!1,renderCard:m,height:p="100%",className:w}){const[C,g]=c.useState(null),[y,j]=c.useState(null),[x,v]=c.useState(!1),[k,N]=c.useState(""),D=(A,S)=>{f&&(j(S),A.dataTransfer.effectAllowed="move")},P=(A,S)=>{A.preventDefault(),y&&a&&a(y,S),j(null)},R=()=>{k.trim()&&i&&(i({title:k.trim()}),N(""),v(!1))};return e.jsxs("div",{className:b("flex gap-4 overflow-x-auto p-4",w),style:{height:p},children:[t.map((A,S)=>e.jsx("div",{onDragOver:M=>M.preventDefault(),onDrop:M=>P(M,S),children:e.jsx(pg,{column:A,onCardMove:s,onCardAdd:r,onCardDelete:n,onCardClick:o,onColumnDelete:l,allowAddCard:u,allowColumnDrag:f,renderCard:m,draggedCard:C,setDraggedCard:g,onColumnDragStart:D})},A.id)),d&&e.jsx("div",{className:"min-w-[280px]",children:x?e.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 space-y-2",children:[e.jsx(oe,{value:k,onChange:A=>N(A.target.value),placeholder:"Titre de la colonne...",autoFocus:!0,onKeyDown:A=>{A.key==="Enter"&&R(),A.key==="Escape"&&v(!1)}}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(L,{size:"sm",onClick:R,disabled:!k.trim(),children:"Ajouter"}),e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>v(!1),children:"Annuler"})]})]}):e.jsxs(L,{variant:"outline",className:"w-full h-auto py-8 border-dashed",onClick:()=>v(!0),children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-2"}),"Ajouter une colonne"]})})]})}function gg(t){const[s,a]=c.useState(t);return{columns:s,setColumns:a,moveCard:(d,f,m,p)=>{a(w=>{const C=[...w],g=C.find(v=>v.id===f);if(!g)return w;const y=g.cards.findIndex(v=>v.id===d);if(y===-1)return w;const[j]=g.cards.splice(y,1),x=C.find(v=>v.id===m);return x?(x.cards.splice(p,0,j),C):w})},moveColumn:(d,f)=>{a(m=>{const p=[...m],w=p.findIndex(g=>g.id===d);if(w===-1)return m;const[C]=p.splice(w,1);return p.splice(f,0,C),p})},addCard:(d,f)=>{a(m=>m.map(p=>p.id===d?{...p,cards:[...p.cards,{id:`card-${Date.now()}`,title:f.title||"Nouvelle carte",...f}]}:p))},deleteCard:(d,f)=>{a(m=>m.map(p=>p.id===f?{...p,cards:p.cards.filter(w=>w.id!==d)}:p))},addColumn:d=>{a(f=>[...f,{id:`column-${Date.now()}`,title:d.title||"Nouvelle colonne",cards:[],...d}])},deleteColumn:d=>{a(f=>f.filter(m=>m.id!==d))}}}const bg={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg",xl:"max-w-xl",full:"max-w-[calc(100vw-2rem)] max-h-[calc(100vh-2rem)]"},jg={fade:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",slide:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",scale:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",none:""},vg={fade:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",slide:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:slide-out-to-top-[2%] data-[state=open]:slide-in-from-top-[2%]",scale:"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",none:""},en=c.forwardRef(({className:t,animation:s="fade",...a},r)=>e.jsx(ue.Overlay,{ref:r,className:b("fixed inset-0 z-50 bg-black/80",jg[s],t),...a}));en.displayName="ModalOverlay";const tn=c.forwardRef(({className:t,children:s,size:a="md",animation:r="fade",centered:n=!0,showCloseButton:o=!0,...i},l)=>e.jsxs(ue.Content,{ref:l,className:b("fixed z-50 w-full bg-background shadow-lg sm:rounded-lg","left-1/2 -translate-x-1/2",n?"top-1/2 -translate-y-1/2":"top-[10%]",bg[a],vg[r],"duration-200",t),...i,children:[s,o&&e.jsxs(ue.Close,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(h.X,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Fermer"})]})]}));tn.displayName="ModalContent";const sn=c.forwardRef(({className:t,sticky:s,...a},r)=>e.jsx("div",{ref:r,className:b("flex flex-col space-y-1.5 p-6 pb-4",s&&"sticky top-0 bg-background z-10 border-b",t),...a}));sn.displayName="ModalHeader";const Sa=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Title,{ref:a,className:b("text-lg font-semibold leading-none tracking-tight",t),...s}));Sa.displayName="ModalTitle";const Da=c.forwardRef(({className:t,...s},a)=>e.jsx(ue.Description,{ref:a,className:b("text-sm text-muted-foreground",t),...s}));Da.displayName="ModalDescription";const an=c.forwardRef(({className:t,...s},a)=>e.jsx("div",{ref:a,className:b("px-6 py-4 overflow-auto",t),...s}));an.displayName="ModalBody";const rn=c.forwardRef(({className:t,sticky:s,...a},r)=>e.jsx("div",{ref:r,className:b("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 p-6 pt-4",s&&"sticky bottom-0 bg-background z-10 border-t",t),...a}));rn.displayName="ModalFooter";function wg({open:t,onOpenChange:s,title:a,description:r,children:n,size:o="md",showCloseButton:i=!0,closeOnOverlayClick:l=!0,closeOnEscape:u=!0,animation:d="scale",centered:f=!0,stickyHeader:m=!1,stickyFooter:p=!1,footer:w,className:C,overlayClassName:g}){const y=x=>{l||x.preventDefault()},j=x=>{u||x.preventDefault()};return e.jsx(ue.Root,{open:t,onOpenChange:s,children:e.jsxs(ue.Portal,{children:[e.jsx(en,{animation:d,className:g}),e.jsxs(tn,{size:o,animation:d,centered:f,showCloseButton:i,className:C,onInteractOutside:y,onEscapeKeyDown:j,"aria-describedby":r?void 0:"modal-description",children:[!a&&e.jsx(Sa,{className:"sr-only",children:"Fenêtre modale"}),!r&&e.jsx(Da,{id:"modal-description",className:"sr-only",children:"Contenu de la fenêtre modale"}),(a||r)&&e.jsxs(sn,{sticky:m,children:[a&&e.jsx(Sa,{children:a}),r&&e.jsx(Da,{children:r})]}),e.jsx(an,{children:n}),w&&e.jsx(rn,{sticky:p,children:w})]})]})})}function yg({children:t,onOpen:s,className:a,disabled:r}){return e.jsx(ue.Trigger,{className:a,disabled:r,onClick:s,asChild:!0,children:t})}function Ng(t){const{defaultOpen:s=!1,onOpenChange:a}=t||{},[r,n]=c.useState(s),o=c.useCallback(()=>{n(!0),a?.(!0)},[a]),i=c.useCallback(()=>{n(!1),a?.(!1)},[a]),l=c.useCallback(()=>{n(d=>{const f=!d;return a?.(f),f})},[a]),u=c.useCallback(d=>{n(d),a?.(d)},[a]);return{isOpen:r,open:o,close:i,toggle:l,onOpenChange:u}}const Cg={info:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",success:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",warning:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",error:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"},ja=c.forwardRef(({notification:t,onMarkAsRead:s,onDelete:a},r)=>{const n=o=>{const l=new Date().getTime()-o.getTime(),u=Math.floor(l/6e4),d=Math.floor(l/36e5),f=Math.floor(l/864e5);return u<1?"À l'instant":u<60?`Il y a ${u} min`:d<24?`Il y a ${d}h`:f<7?`Il y a ${f}j`:o.toLocaleDateString("fr-FR")};return e.jsxs("div",{ref:r,className:b("flex gap-3 p-4 hover:bg-muted/50 transition-colors border-l-4",t.read?"border-l-transparent opacity-60":"border-l-primary","relative group"),children:[e.jsx("div",{className:b("flex-shrink-0 w-10 h-10 rounded-full flex items-center justify-center",Cg[t.type]),children:t.icon||e.jsx(h.Bell,{className:"h-5 w-5"})}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h4",{className:b("text-sm font-semibold",t.read&&"font-normal"),children:t.title}),e.jsx("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:n(t.timestamp)})]}),e.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:t.message}),t.action&&e.jsx(L,{variant:"link",size:"sm",className:"h-auto p-0 text-primary",onClick:t.action.onClick,children:t.action.label})]}),e.jsxs("div",{className:"flex-shrink-0 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[!t.read&&s&&e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>s(t.id),children:[e.jsx(h.Check,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Marquer comme lu"})]}),a&&e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>a(t.id),children:[e.jsx(h.Trash2,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Supprimer"})]})]})]})});ja.displayName="NotificationItem";const $l=c.forwardRef(({notifications:t,onMarkAsRead:s,onMarkAllAsRead:a,onDelete:r,onDeleteAll:n,onSettingsClick:o,maxHeight:i="400px",className:l,iconClassName:u,badgeClassName:d,showBadge:f=!0,showTabs:m=!0,emptyMessage:p="Aucune notification",emptyIcon:w},C)=>{const[g,y]=c.useState(!1),[j,x]=c.useState("all"),v=t.filter(D=>!D.read).length,k=c.useMemo(()=>j==="all"?t:j==="unread"?t.filter(D=>!D.read):t,[t,j]),N=()=>e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-4 text-center",children:[w||e.jsx(h.Bell,{className:"h-12 w-12 text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:p})]});return e.jsxs(rt,{open:g,onOpenChange:y,children:[e.jsx(nt,{asChild:!0,children:e.jsxs(L,{ref:C,variant:"ghost",size:"icon",className:b("relative",l),children:[e.jsx(h.Bell,{className:b("h-5 w-5",u)}),f&&v>0&&e.jsx(Se,{variant:"destructive",className:b("absolute -top-1 -right-1 h-5 min-w-[20px] flex items-center justify-center p-0 text-xs",d),children:v>99?"99+":v}),e.jsxs("span",{className:"sr-only",children:["Notifications (",v," non lues)"]})]})}),e.jsxs(st,{className:"w-[380px] p-0",align:"end",sideOffset:8,children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-base",children:"Notifications"}),v>0&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:[v," non ",v>1?"lues":"lue"]})]}),e.jsxs("div",{className:"flex gap-1",children:[a&&v>0&&e.jsxs(L,{variant:"ghost",size:"sm",className:"h-8 text-xs",onClick:a,children:[e.jsx(h.Check,{className:"h-3 w-3 mr-1"}),"Tout marquer"]}),o&&e.jsxs(L,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:o,children:[e.jsx(h.Settings,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Paramètres"})]})]})]}),m&&t.length>0&&e.jsxs(oa,{value:j,onValueChange:x,className:"w-full",children:[e.jsxs(Ts,{className:"w-full rounded-none border-b bg-transparent p-0",children:[e.jsxs(js,{value:"all",className:"flex-1 rounded-none data-[state=active]:border-b-2 data-[state=active]:border-primary",children:["Toutes (",t.length,")"]}),e.jsxs(js,{value:"unread",className:"flex-1 rounded-none data-[state=active]:border-b-2 data-[state=active]:border-primary",children:["Non lues (",v,")"]})]}),e.jsx(vs,{value:"all",className:"m-0",children:e.jsx(At,{className:"h-[400px]",style:{maxHeight:i},children:e.jsx("div",{className:"p-0",children:k.length===0?e.jsx(N,{}):e.jsx("div",{className:"divide-y",children:k.map(D=>e.jsx(ja,{notification:D,onMarkAsRead:s,onDelete:r},D.id))})})})}),e.jsx(vs,{value:"unread",className:"m-0",children:e.jsx(At,{className:"h-[400px]",style:{maxHeight:i},children:e.jsx("div",{className:"p-0",children:k.length===0?e.jsx(N,{}):e.jsx("div",{className:"divide-y",children:k.map(D=>e.jsx(ja,{notification:D,onMarkAsRead:s,onDelete:r},D.id))})})})})]}),!m&&e.jsx(At,{className:"h-[400px]",style:{maxHeight:i},children:e.jsx("div",{className:"p-0",children:t.length===0?e.jsx(N,{}):e.jsx("div",{className:"divide-y",children:t.map(D=>e.jsx(ja,{notification:D,onMarkAsRead:s,onDelete:r},D.id))})})}),t.length>0&&n&&e.jsxs(e.Fragment,{children:[e.jsx(kt,{}),e.jsx("div",{className:"p-2",children:e.jsxs(L,{variant:"ghost",size:"sm",className:"w-full text-destructive hover:text-destructive",onClick:n,children:[e.jsx(h.Trash2,{className:"h-3 w-3 mr-2"}),"Tout supprimer"]})})]})]})]})});$l.displayName="WakaNotifications";function kg(t=[]){const[s,a]=c.useState(t),r=c.useCallback(d=>{const f={...d,id:`notification-${Date.now()}-${Math.random()}`,timestamp:new Date,read:!1};a(m=>[f,...m])},[]),n=c.useCallback(d=>{a(f=>f.map(m=>m.id===d?{...m,read:!0}:m))},[]),o=c.useCallback(()=>{a(d=>d.map(f=>({...f,read:!0})))},[]),i=c.useCallback(d=>{a(f=>f.filter(m=>m.id!==d))},[]),l=c.useCallback(()=>{a([])},[]),u=c.useMemo(()=>s.filter(d=>!d.read).length,[s]);return{notifications:s,addNotification:r,markAsRead:n,markAllAsRead:o,deleteNotification:i,deleteAllNotifications:l,unreadCount:u}}function Us(t,s,a){let r=t;return s!==void 0&&r<s&&(r=s),a!==void 0&&r>a&&(r=a),r}function er(t,s){const a=Math.pow(10,s);return Math.round(t*a)/a}function Sg({value:t,onChange:s,min:a,max:r,step:n=1,precision:o=0,placeholder:i="0",disabled:l=!1,error:u=!1,size:d="md",buttonPosition:f="sides",allowEmpty:m=!1,formatValue:p,parseValue:w,className:C,id:g,name:y}){const[j,x]=c.useState(t!==void 0?p?p(t):String(t):""),[v,k]=c.useState(!1);c.useEffect(()=>{v||x(t!==void 0?p?p(t):String(t):"")},[t,p,v]);const N=W=>{const I=W.target.value;if(x(I),I===""&&m){s?.(void 0);return}let z;if(w)z=w(I);else{const $=I.replace(",",".");z=parseFloat($)}if(z!==void 0&&!isNaN(z)){const $=Us(er(z,o),a,r);s?.($)}},D=()=>{if(k(!1),t!==void 0)x(p?p(t):String(t));else if(!m){const W=a!==void 0?a:0;s?.(W),x(p?p(W):String(W))}},P=()=>{k(!0)},R=()=>{const I=Us(er((t??(a!==void 0?a:0))+n,o),a,r);s?.(I)},A=()=>{const I=Us(er((t??(a!==void 0?a:0))-n,o),a,r);s?.(I)},S=W=>{W.key==="ArrowUp"?(W.preventDefault(),R()):W.key==="ArrowDown"&&(W.preventDefault(),A())},M={sm:"h-8 text-xs",md:"h-9 text-sm",lg:"h-10 text-base"},E={sm:"h-8 w-8",md:"h-9 w-9",lg:"h-10 w-10"},T={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},K=r===void 0||(t??0)<r,q=a===void 0||(t??0)>a,B=(W,I)=>{const z=W==="increment",$=z?h.Plus:h.Minus,_=z?R:A,F=z?K:q;return e.jsx(L,{type:"button",variant:"outline",size:"icon",className:b(E[d],"flex-shrink-0",I==="left"&&"rounded-r-none border-r-0",I==="right"&&"rounded-l-none border-l-0"),onClick:_,disabled:l||!F,tabIndex:-1,"aria-label":z?"Augmenter":"Diminuer",children:e.jsx($,{className:T[d]})})};return f==="none"?e.jsx(oe,{id:g,name:y,type:"text",inputMode:"decimal",value:j,onChange:N,onBlur:D,onFocus:P,onKeyDown:S,placeholder:i,disabled:l,className:b(M[d],"text-center",u&&"border-destructive focus-visible:ring-destructive",C)}):f==="right"?e.jsxs("div",{className:b("flex",C),children:[e.jsx(oe,{id:g,name:y,type:"text",inputMode:"decimal",value:j,onChange:N,onBlur:D,onFocus:P,onKeyDown:S,placeholder:i,disabled:l,className:b(M[d],"rounded-r-none",u&&"border-destructive focus-visible:ring-destructive")}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx(L,{type:"button",variant:"outline",size:"icon",className:b("h-[50%] w-6 rounded-none rounded-tr-md border-l-0 border-b-0",d==="sm"&&"h-4",d==="lg"&&"h-5"),onClick:R,disabled:l||!K,tabIndex:-1,"aria-label":"Augmenter",children:e.jsx(h.Plus,{className:"h-2.5 w-2.5"})}),e.jsx(L,{type:"button",variant:"outline",size:"icon",className:b("h-[50%] w-6 rounded-none rounded-br-md border-l-0",d==="sm"&&"h-4",d==="lg"&&"h-5"),onClick:A,disabled:l||!q,tabIndex:-1,"aria-label":"Diminuer",children:e.jsx(h.Minus,{className:"h-2.5 w-2.5"})})]})]}):e.jsxs("div",{className:b("flex",C),children:[B("decrement","left"),e.jsx(oe,{id:g,name:y,type:"text",inputMode:"decimal",value:j,onChange:N,onBlur:D,onFocus:P,onKeyDown:S,placeholder:i,disabled:l,className:b(M[d],"rounded-none text-center",u&&"border-destructive focus-visible:ring-destructive")}),B("increment","right")]})}function Dg(t={}){const{initialValue:s,min:a,max:r,step:n=1}=t,[o,i]=c.useState(s);return{value:o,onChange:i,increment:()=>{i(m=>Us((m??(a!==void 0?a:0))+n,a,r))},decrement:()=>{i(m=>Us((m??(a!==void 0?a:0))-n,a,r))},reset:()=>i(s),clear:()=>i(void 0),min:a,max:r,step:n}}function Tg(t,s,a){if(s<=a)return Array.from({length:s},(o,i)=>i+1);const r=[],n=Math.floor((a-3)/2);if(r.push(1),t<=n+2){for(let o=2;o<=Math.min(a-1,s-1);o++)r.push(o);s>a&&r.push("ellipsis")}else if(t>=s-n-1){r.push("ellipsis");for(let o=Math.max(s-a+2,2);o<=s-1;o++)r.push(o)}else{r.push("ellipsis");for(let o=t-n;o<=t+n;o++)r.push(o);r.push("ellipsis")}return s>1&&r.push(s),r}function Ag({page:t,totalPages:s,onPageChange:a,pageSize:r=10,pageSizeOptions:n=[10,20,50,100],onPageSizeChange:o,totalItems:i,showPageSizeSelector:l=!1,showItemsInfo:u=!1,showFirstLast:d=!0,maxVisiblePages:f=7,size:m="md",variant:p="outline",className:w,labels:C={}}){const{page:g="Page",of:y="sur",items:j="éléments",itemsPerPage:x="par page",first:v="Première page",previous:k="Page précédente",next:N="Page suivante",last:D="Dernière page"}=C,P={sm:"h-7 w-7 text-xs",md:"h-8 w-8 text-sm",lg:"h-10 w-10 text-base"},R={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},A=Tg(t,s,f),S=T=>{T>=1&&T<=s&&T!==t&&a(T)},M=i?(t-1)*r+1:null,E=i?Math.min(t*r,i):null;return e.jsxs("nav",{role:"navigation","aria-label":"Pagination",className:b("flex flex-wrap items-center gap-4 justify-between",w),children:[u&&i!==void 0&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:[M,"-",E," ",y," ",i," ",j]}),l&&o&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:[x,":"]}),e.jsxs(Ve,{value:String(r),onValueChange:T=>o(Number(T)),children:[e.jsx($e,{className:b("w-[70px]",m==="sm"?"h-7":m==="lg"?"h-10":"h-8"),children:e.jsx(We,{})}),e.jsx(Le,{children:n.map(T=>e.jsx(je,{value:String(T),children:T},T))})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[d&&e.jsx(L,{variant:p,size:"icon",className:P[m],onClick:()=>S(1),disabled:t===1,"aria-label":v,children:e.jsx(h.ChevronsLeft,{className:R[m]})}),e.jsx(L,{variant:p,size:"icon",className:P[m],onClick:()=>S(t-1),disabled:t===1,"aria-label":k,children:e.jsx(h.ChevronLeft,{className:R[m]})}),e.jsx("div",{className:"flex items-center gap-1",children:A.map((T,K)=>{if(T==="ellipsis")return e.jsx("span",{className:b("flex items-center justify-center text-muted-foreground",P[m]),children:e.jsx(h.MoreHorizontal,{className:R[m]})},`ellipsis-${K}`);const q=T===t;return e.jsx(L,{variant:q?"default":p,size:"icon",className:b(P[m],q&&"pointer-events-none"),onClick:()=>S(T),"aria-label":`${g} ${T}`,"aria-current":q?"page":void 0,children:T},T)})}),e.jsx(L,{variant:p,size:"icon",className:P[m],onClick:()=>S(t+1),disabled:t===s,"aria-label":N,children:e.jsx(h.ChevronRight,{className:R[m]})}),d&&e.jsx(L,{variant:p,size:"icon",className:P[m],onClick:()=>S(s),disabled:t===s,"aria-label":D,children:e.jsx(h.ChevronsRight,{className:R[m]})})]}),!u&&s>0&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:[g," ",t," ",y," ",s]})]})}function Eg({totalItems:t,initialPageSize:s=10,initialPage:a=1}){const[r,n]=c.useState(a),[o,i]=c.useState(s),l=Math.ceil(t/o);c.useEffect(()=>{r>l&&l>0&&n(l)},[r,l]);const u=g=>{i(g),n(1)},d=()=>{r<l&&n(r+1)},f=()=>{r>1&&n(r-1)},m=()=>n(1),p=()=>n(l),w=(r-1)*o,C=Math.min(w+o-1,t-1);return{page:r,pageSize:o,totalPages:l,setPage:n,setPageSize:u,nextPage:d,prevPage:f,firstPage:m,lastPage:p,canNextPage:r<l,canPrevPage:r>1,startIndex:w,endIndex:C}}function Mg(t,s){const a=Math.max(21,Math.min(177,21+Math.floor(t.length/10)*4)),r=[];for(let n=0;n<a;n++){r[n]=[];for(let o=0;o<a;o++)if(n<7&&o<7||n<7&&o>=a-7||n>=a-7&&o<7){const l=n<7?n:n-(a-7),u=o<7?o:o>=a-7?o-(a-7):o;l===0||l===6||u===0||u===6||l>=2&&l<=4&&u>=2&&u<=4?r[n][o]=!0:r[n][o]=!1}else{const l=(t.charCodeAt((n*a+o)%t.length)||0)+n*31+o*17;r[n][o]=l%3===0}}return{modules:r,size:a}}function Pg({value:t,size:s=200,errorCorrectionLevel:a="M",fgColor:r="#000000",bgColor:n="#FFFFFF",includeMargin:o=!0,logoUrl:i,logoSize:l=.2,showActions:u=!1,className:d}){const f=c.useRef(null),[m,p]=c.useState(!1);c.useEffect(()=>{const g=f.current;if(!g||!t)return;const y=g.getContext("2d");if(!y)return;const j=Mg(t),x=o?4:0,v=s/(j.size+x*2);y.fillStyle=n,y.fillRect(0,0,s,s),y.fillStyle=r;for(let k=0;k<j.size;k++)for(let N=0;N<j.size;N++)j.modules[k][N]&&y.fillRect((N+x)*v,(k+x)*v,v,v);if(i){const k=new Image;k.crossOrigin="anonymous",k.onload=()=>{const N=s*l,D=(s-N)/2,P=(s-N)/2;y.fillStyle=n,y.fillRect(D-4,P-4,N+8,N+8),y.drawImage(k,D,P,N,N)},k.src=i}},[t,s,a,r,n,o,i,l]);const w=()=>{const g=f.current;if(!g)return;const y=document.createElement("a");y.download=`qrcode-${Date.now()}.png`,y.href=g.toDataURL("image/png"),y.click()},C=async()=>{const g=f.current;if(g)try{const y=await new Promise(j=>{g.toBlob(x=>{x&&j(x)},"image/png")});await navigator.clipboard.write([new ClipboardItem({"image/png":y})]),p(!0),setTimeout(()=>p(!1),2e3)}catch(y){console.error("Failed to copy QR code:",y)}};return e.jsxs("div",{className:b("inline-flex flex-col items-center gap-2",d),children:[e.jsx("canvas",{ref:f,width:s,height:s,className:"rounded-lg",style:{width:s,height:s}}),u&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(L,{variant:"outline",size:"sm",onClick:w,children:[e.jsx(h.Download,{className:"h-4 w-4 mr-1"}),"Télécharger"]}),e.jsxs(L,{variant:"outline",size:"sm",onClick:C,children:[m?e.jsx(h.Check,{className:"h-4 w-4 mr-1"}):e.jsx(h.Copy,{className:"h-4 w-4 mr-1"}),m?"Copié":"Copier"]})]})]})}function Rg(t=""){const[s,a]=c.useState(t);return{value:s,setValue:a,props:{value:s}}}const Fg=[["bold","italic","underline","strike"],["h1","h2","h3"],["bulletList","orderedList","blockquote"],["link","code"],["undo","redo"]],Ll=c.forwardRef(({value:t="",onChange:s,toolbar:a=Fg,placeholder:r="Écrivez ici...",maxLength:n,showCharacterCount:o=!1,minHeight:i=200,disabled:l=!1,error:u,className:d,label:f,description:m,editable:p=!0},w)=>{const[C,g]=c.useState(null),[y,j]=c.useState(null),[x,v]=c.useState(null),[k,N]=c.useState("");return c.useEffect(()=>{(async()=>{try{const[{useEditor:P,EditorContent:R},{default:A},{default:S},{default:M},{default:E}]=await Promise.all([import("@tiptap/react"),import("@tiptap/starter-kit"),import("@tiptap/extension-underline"),import("@tiptap/extension-link"),import("@tiptap/extension-text-align")]);j({useEditor:P,EditorContent:R,StarterKit:A,Underline:S,Link:M,TextAlign:E}),g(!0)}catch{g(!1)}})()},[]),C&&y?e.jsx(Il,{ref:w,components:y,value:t,onChange:s,toolbar:a,placeholder:r,maxLength:n,showCharacterCount:o,minHeight:i,disabled:l,error:u,className:d,label:f,description:m,editable:p,linkUrl:k,setLinkUrl:N,editor:x,setEditor:v}):e.jsx(Ol,{ref:w,value:t,onChange:s,placeholder:r,maxLength:n,showCharacterCount:o,minHeight:i,disabled:l,error:u,className:d,label:f,description:m,loading:C===null})});Ll.displayName="WakaRichTextEditor";const Il=c.forwardRef(({components:t,value:s,onChange:a,toolbar:r,placeholder:n,maxLength:o,showCharacterCount:i,minHeight:l,disabled:u,error:d,className:f,label:m,description:p,editable:w,linkUrl:C,setLinkUrl:g,setEditor:y},j)=>{const{useEditor:x,EditorContent:v,StarterKit:k,Underline:N,Link:D,TextAlign:P}=t,R=x({extensions:[k.configure({heading:{levels:[1,2,3]}}),N,D.configure({openOnClick:!1}),P.configure({types:["heading","paragraph"]})],content:s,editable:w&&!u,onUpdate:({editor:M})=>{const E=M.getHTML();(!o||E.length<=o)&&a?.(E)}});c.useEffect(()=>{y(R)},[R,y]),c.useEffect(()=>{R&&s!==R.getHTML()&&R.commands?.setContent?.(s||"",!1)},[s,R]);const A=()=>{R&&(C?R.chain().focus().setLink({href:C}).run():R.chain().focus().unsetLink().run(),g(""))},S=R?.storage?.characterCount?.characters?.()??s?.replace(/<[^>]*>/g,"").length??0;return e.jsxs("div",{ref:j,className:b("space-y-1.5",f),children:[m&&e.jsx(me,{children:m}),p&&e.jsx("p",{className:"text-sm text-muted-foreground",children:p}),e.jsxs("div",{className:b("border rounded-lg overflow-hidden",d&&"border-destructive"),children:[R&&r&&e.jsx("div",{className:"flex flex-wrap items-center gap-0.5 p-1 border-b bg-muted/30",children:r.map((M,E)=>e.jsxs(c.Fragment,{children:[E>0&&e.jsx(kt,{orientation:"vertical",className:"mx-1 h-6"}),M.map(T=>e.jsx($g,{button:T,editor:R,linkUrl:C,setLinkUrl:g,handleSetLink:A},T))]},E))}),e.jsx("div",{style:{minHeight:l},children:e.jsx(v,{editor:R,className:b("prose prose-sm max-w-none p-3 focus-within:outline-none h-full","[&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[inherit]")})}),i&&e.jsxs("div",{className:"flex justify-end p-1.5 border-t bg-muted/30 text-xs text-muted-foreground",children:[S,o&&` / ${o}`," caractères"]})]}),d&&e.jsx("p",{className:"text-sm text-destructive",children:d})]})});Il.displayName="TiptapEditorComponent";function $g({button:t,editor:s,linkUrl:a,setLinkUrl:r,handleSetLink:n}){const o={bold:{icon:e.jsx(h.Bold,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleBold().run(),isActive:()=>s.isActive("bold")},italic:{icon:e.jsx(h.Italic,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleItalic().run(),isActive:()=>s.isActive("italic")},underline:{icon:e.jsx(h.Underline,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleUnderline().run(),isActive:()=>s.isActive("underline")},strike:{icon:e.jsx(h.Strikethrough,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleStrike().run(),isActive:()=>s.isActive("strike")},h1:{icon:e.jsx(h.Heading1,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleHeading({level:1}).run(),isActive:()=>s.isActive("heading",{level:1})},h2:{icon:e.jsx(h.Heading2,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleHeading({level:2}).run(),isActive:()=>s.isActive("heading",{level:2})},h3:{icon:e.jsx(h.Heading3,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleHeading({level:3}).run(),isActive:()=>s.isActive("heading",{level:3})},bulletList:{icon:e.jsx(h.List,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleBulletList().run(),isActive:()=>s.isActive("bulletList")},orderedList:{icon:e.jsx(h.ListOrdered,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleOrderedList().run(),isActive:()=>s.isActive("orderedList")},blockquote:{icon:e.jsx(h.Quote,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleBlockquote().run(),isActive:()=>s.isActive("blockquote")},code:{icon:e.jsx(h.Code,{className:"h-4 w-4"}),action:()=>s.chain().focus().toggleCodeBlock().run(),isActive:()=>s.isActive("codeBlock")},link:{icon:e.jsx(h.Link,{className:"h-4 w-4"}),action:()=>{},isActive:()=>s.isActive("link")},alignLeft:{icon:e.jsx(h.AlignLeft,{className:"h-4 w-4"}),action:()=>s.chain().focus().setTextAlign("left").run(),isActive:()=>s.isActive({textAlign:"left"})},alignCenter:{icon:e.jsx(h.AlignCenter,{className:"h-4 w-4"}),action:()=>s.chain().focus().setTextAlign("center").run(),isActive:()=>s.isActive({textAlign:"center"})},alignRight:{icon:e.jsx(h.AlignRight,{className:"h-4 w-4"}),action:()=>s.chain().focus().setTextAlign("right").run(),isActive:()=>s.isActive({textAlign:"right"})},undo:{icon:e.jsx(h.Undo,{className:"h-4 w-4"}),action:()=>s.chain().focus().undo().run()},redo:{icon:e.jsx(h.Redo,{className:"h-4 w-4"}),action:()=>s.chain().focus().redo().run()}},{icon:i,action:l,isActive:u}=o[t];return t==="link"?e.jsxs(rt,{children:[e.jsx(nt,{asChild:!0,children:e.jsx(L,{type:"button",variant:u?.()?"secondary":"ghost",size:"icon",className:"h-7 w-7",children:i})}),e.jsx(st,{className:"w-64 p-2",children:e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{value:a,onChange:d=>r(d.target.value),placeholder:"https://...",className:"h-8"}),e.jsx(L,{size:"sm",onClick:n,children:"OK"})]})})]}):e.jsx(L,{type:"button",variant:u?.()?"secondary":"ghost",size:"icon",className:"h-7 w-7",onClick:l,children:i})}const Ol=c.forwardRef(({value:t,onChange:s,placeholder:a,maxLength:r,showCharacterCount:n,minHeight:o,disabled:i,error:l,className:u,label:d,description:f,loading:m},p)=>e.jsxs("div",{ref:p,className:b("space-y-1.5",u),children:[d&&e.jsx(me,{children:d}),f&&e.jsx("p",{className:"text-sm text-muted-foreground",children:f}),e.jsxs("div",{className:"relative",children:[e.jsx(ft,{value:t,onChange:w=>s?.(w.target.value),placeholder:a,maxLength:r,disabled:i||m,style:{minHeight:o},className:b(l&&"border-destructive")}),m&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/50",children:e.jsx("span",{className:"text-sm text-muted-foreground",children:"Chargement..."})})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[l&&e.jsx("p",{className:"text-sm text-destructive",children:l}),n&&e.jsxs("p",{className:"text-xs text-muted-foreground ml-auto",children:[t?.length||0,r&&` / ${r}`," caractères"]})]})]}));Ol.displayName="FallbackEditor";function Lg({options:t,value:s,onChange:a,size:r="md",variant:n="default",fullWidth:o=!1,disabled:i=!1,name:l,className:u}){const[d,f]=c.useState({}),m=c.useRef(null),p=c.useRef(new Map),w={sm:"h-7 text-xs px-2",md:"h-9 text-sm px-3",lg:"h-11 text-base px-4"},C={sm:"p-0.5",md:"p-1",lg:"p-1"},g={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"};c.useEffect(()=>{if(s===void 0)return;const x=p.current.get(s),v=m.current;if(x&&v){const k=v.getBoundingClientRect(),N=x.getBoundingClientRect();f({left:N.left-k.left,width:N.width,height:N.height})}},[s,t]);const y=x=>{i||a?.(x)},j=x=>v=>{v?p.current.set(x,v):p.current.delete(x)};return e.jsxs("div",{ref:m,role:"radiogroup",className:b("relative inline-flex items-center bg-muted rounded-lg",C[r],o&&"w-full",i&&"opacity-50",u),children:[s!==void 0&&n==="default"&&e.jsx("div",{className:"absolute bg-background rounded-md shadow-sm transition-all duration-200 ease-out",style:d}),t.map(x=>{const v=x.value===s,k=i||x.disabled;return e.jsxs("button",{ref:j(x.value),type:"button",role:"radio","aria-checked":v,disabled:k,onClick:()=>y(x.value),className:b("relative z-10 inline-flex items-center justify-center gap-1.5 font-medium transition-colors rounded-md",w[r],o&&"flex-1",n==="default"&&[v?"text-foreground":"text-muted-foreground hover:text-foreground"],n==="pills"&&[v?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground hover:bg-background/50"],k&&"cursor-not-allowed opacity-50"),children:[x.icon&&e.jsx("span",{className:g[r],children:x.icon}),x.label]},String(x.value))}),l&&e.jsx("input",{type:"hidden",name:l,value:String(s??"")})]})}function Ig(t,s){const[a,r]=c.useState(s??t[0]?.value);return{value:a,onChange:r,selectNext:()=>{const d=(t.findIndex(m=>m.value===a)+1)%t.length,f=t[d];f.disabled||r(f.value)},selectPrevious:()=>{const u=t.findIndex(m=>m.value===a),d=u===0?t.length-1:u-1,f=t[d];f.disabled||r(f.value)},selectFirst:()=>{const u=t.find(d=>!d.disabled);u&&r(u.value)},selectLast:()=>{const u=[...t].reverse().find(d=>!d.disabled);u&&r(u.value)},options:t}}const Og=Xe.cva("relative inline-flex items-center justify-center",{variants:{size:{sm:"w-12 h-12",md:"w-16 h-16",lg:"w-24 h-24",xl:"w-32 h-32"}},defaultVariants:{size:"md"}}),zl=c.forwardRef(({className:t,size:s,showAsteroids:a=!0,speed:r=2,rocketColor:n="text-primary",asteroidColor:o="text-muted-foreground",...i},l)=>{const d={sm:{orbit:40,rocket:16,asteroid:6},md:{orbit:56,rocket:20,asteroid:8},lg:{orbit:88,rocket:28,asteroid:12},xl:{orbit:120,rocket:36,asteroid:16}}[s||"md"],f=d.orbit,m=d.orbit;return e.jsxs("div",{ref:l,className:b(Og({size:s,className:t})),role:"status","aria-label":"Chargement en cours",...i,children:[e.jsxs("svg",{width:d.orbit*2,height:d.orbit*2,viewBox:`0 0 ${d.orbit*2} ${d.orbit*2}`,className:"overflow-visible",children:[e.jsx("circle",{cx:f,cy:m,r:d.orbit-d.rocket,fill:"none",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 4",className:"opacity-20"}),a&&e.jsxs("g",{className:o,children:[e.jsx("g",{style:{animation:`waka-float ${r*1.5}s ease-in-out infinite`,transformOrigin:`${f+d.orbit*.6}px ${m-d.orbit*.5}px`},children:e.jsx("polygon",{points:tr(f+d.orbit*.6,m-d.orbit*.5,d.asteroid),fill:"currentColor",opacity:"0.3"})}),e.jsx("g",{style:{animation:`waka-float ${r*2}s ease-in-out infinite 0.5s`,transformOrigin:`${f-d.orbit*.7}px ${m+d.orbit*.4}px`},children:e.jsx("polygon",{points:tr(f-d.orbit*.7,m+d.orbit*.4,d.asteroid*.8),fill:"currentColor",opacity:"0.3"})}),e.jsx("g",{style:{animation:`waka-float ${r*1.8}s ease-in-out infinite 1s`,transformOrigin:`${f-d.orbit*.8}px ${m-d.orbit*.2}px`},children:e.jsx("polygon",{points:tr(f-d.orbit*.8,m-d.orbit*.2,d.asteroid*.6),fill:"currentColor",opacity:"0.3"})})]}),e.jsx("g",{className:n,style:{animation:`waka-orbit ${r}s linear infinite`,transformOrigin:`${f}px ${m}px`},children:e.jsxs("g",{transform:`translate(${f}, ${m-d.orbit+d.rocket/2})`,children:[e.jsx("path",{d:`M 0,-${d.rocket/2} L ${d.rocket/4},-${d.rocket/6} L ${d.rocket/4},${d.rocket/3} L 0,${d.rocket/2} L -${d.rocket/4},${d.rocket/3} L -${d.rocket/4},-${d.rocket/6} Z`,fill:"currentColor"}),e.jsx("circle",{cx:"0",cy:-d.rocket/6,r:d.rocket/8,fill:"white",opacity:"0.8"}),e.jsxs("g",{opacity:"0.8",children:[e.jsx("path",{d:`M -${d.rocket/6},${d.rocket/2} L -${d.rocket/8},${d.rocket/1.5} L 0,${d.rocket/2} Z`,fill:"#FF6B35",style:{animation:`waka-flicker ${r/4}s ease-in-out infinite`}}),e.jsx("path",{d:`M 0,${d.rocket/2} L ${d.rocket/8},${d.rocket/1.5} L ${d.rocket/6},${d.rocket/2} Z`,fill:"#FF6B35",style:{animation:`waka-flicker ${r/4}s ease-in-out infinite 0.1s`}}),e.jsx("path",{d:`M -${d.rocket/12},${d.rocket/2} L 0,${d.rocket/1.3} L ${d.rocket/12},${d.rocket/2} Z`,fill:"#FFA500",style:{animation:`waka-flicker ${r/4}s ease-in-out infinite 0.05s`}})]})]})}),[...Array(3)].map((p,w)=>e.jsx("circle",{cx:f+(w-1)*d.orbit*.3,cy:m-d.orbit*1.2,r:"1",fill:"currentColor",className:"opacity-40",style:{animation:`waka-twinkle ${r*1.5}s ease-in-out infinite ${w*.3}s`}},w))]}),e.jsx("style",{dangerouslySetInnerHTML:{__html:`
29
29
  @keyframes waka-orbit {
30
30
  from { transform: rotate(0deg); }
31
31
  to { transform: rotate(360deg); }
@@ -42,7 +42,7 @@ ${m.join(`
42
42
  0%, 100% { opacity: 0.4; transform: scale(1); }
43
43
  50% { opacity: 1; transform: scale(1.5); }
44
44
  }
45
- `}})]})});zl.displayName="WakaSpinner";function Ja(t,s,a){const r=[];for(let o=0;o<6;o++){const i=o/6*Math.PI*2,l=a*(.7+Math.random()*.6),u=t+Math.cos(i)*l,d=s+Math.sin(i)*l;r.push([u,d])}return r.map(([o,i])=>`${o},${i}`).join(" ")}const zg={default:{icon:"text-muted-foreground",bg:"bg-muted",gradient:"from-gray-500 to-gray-600"},primary:{icon:"text-primary",bg:"bg-primary/10",gradient:"from-primary to-primary/80"},success:{icon:"text-green-600",bg:"bg-green-100",gradient:"from-green-500 to-green-600"},warning:{icon:"text-yellow-600",bg:"bg-yellow-100",gradient:"from-yellow-500 to-yellow-600"},destructive:{icon:"text-destructive",bg:"bg-destructive/10",gradient:"from-destructive to-destructive/80"},blue:{icon:"text-blue-600",bg:"bg-blue-100",gradient:"from-blue-500 to-blue-600"},purple:{icon:"text-purple-600",bg:"bg-purple-100",gradient:"from-purple-500 to-purple-600"}};function to({direction:t,value:s,text:a,invert:r,size:n}){const o=r?t==="down":t==="up",i=r?t==="up":t==="down",l={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},u={sm:"text-[10px]",md:"text-xs",lg:"text-sm"},d=t==="up"?h.TrendingUp:t==="down"?h.TrendingDown:h.Minus;return e.jsxs("div",{className:b("flex items-center gap-1",u[n],o&&"text-green-600",i&&"text-destructive",t==="neutral"&&"text-muted-foreground"),children:[e.jsx(d,{className:l[n]}),s&&e.jsx("span",{className:"font-medium",children:s}),a&&e.jsx("span",{className:"text-muted-foreground",children:a})]})}function _g({size:t}){const s={sm:"h-5 w-16",md:"h-7 w-20",lg:"h-9 w-24"};return e.jsxs("div",{className:"animate-pulse",children:[e.jsx("div",{className:"h-3 w-16 bg-muted rounded mb-2"}),e.jsx("div",{className:b("bg-muted rounded",s[t])})]})}function _l({label:t,value:s,description:a,icon:r,trend:n,trendValue:o,trendText:i,invertTrend:l=!1,variant:u="default",size:d="md",color:f="default",loading:m=!1,className:p}){const w=zg[f],g={sm:{container:"p-3",label:"text-xs",value:"text-xl",description:"text-[10px]",icon:"h-8 w-8",iconInner:"h-4 w-4"},md:{container:"p-4",label:"text-sm",value:"text-2xl",description:"text-xs",icon:"h-10 w-10",iconInner:"h-5 w-5"},lg:{container:"p-6",label:"text-base",value:"text-4xl",description:"text-sm",icon:"h-12 w-12",iconInner:"h-6 w-6"}}[d];return m?e.jsx("div",{className:b(u==="card"&&"rounded-lg border bg-card shadow-sm",u==="gradient"&&"rounded-lg text-white",g.container,p),children:e.jsx(_g,{size:d})}):u==="minimal"?e.jsxs("div",{className:b("flex flex-col",p),children:[e.jsx("span",{className:b("text-muted-foreground",g.label),children:t}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:b("font-bold tracking-tight",g.value),children:s}),n&&e.jsx(to,{direction:n,value:o,text:i,invert:l,size:d})]}),a&&e.jsx("span",{className:b("text-muted-foreground mt-1",g.description),children:a})]}):u==="gradient"?e.jsx("div",{className:b("rounded-lg bg-gradient-to-br text-white",w.gradient,g.container,p),children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:b("text-white/80",g.label),children:t}),e.jsx("p",{className:b("font-bold mt-1",g.value),children:s}),a&&e.jsx("p",{className:b("text-white/70 mt-1",g.description),children:a}),n&&e.jsxs("div",{className:"mt-2 flex items-center gap-1 text-white/90",children:[n==="up"&&e.jsx(h.ArrowUp,{className:g.iconInner}),n==="down"&&e.jsx(h.ArrowDown,{className:g.iconInner}),o&&e.jsx("span",{className:g.description,children:o}),i&&e.jsx("span",{className:b("text-white/70",g.description),children:i})]})]}),r&&e.jsx("div",{className:"rounded-lg bg-white/20 p-2",children:e.jsx("div",{className:g.iconInner,children:r})})]})}):e.jsx("div",{className:b(u==="card"&&"rounded-lg border bg-card shadow-sm",g.container,p),children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:b("text-muted-foreground font-medium",g.label),children:t}),e.jsxs("div",{className:"flex items-baseline gap-2 mt-1",children:[e.jsx("span",{className:b("font-bold tracking-tight",g.value),children:s}),n&&e.jsx(to,{direction:n,value:o,text:i,invert:l,size:d})]}),a&&e.jsx("p",{className:b("text-muted-foreground mt-1",g.description),children:a})]}),r&&e.jsx("div",{className:b("rounded-lg flex items-center justify-center flex-shrink-0",g.icon,w.bg),children:e.jsx("div",{className:b(g.iconInner,w.icon),children:r})})]})})}function Vl({children:t,layout:s="row",columns:a=4,gap:r="md",className:n}){const o={sm:"gap-2",md:"gap-4",lg:"gap-6"},i={2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4"};return e.jsx("div",{className:b(o[r],s==="row"&&"flex flex-wrap",s==="grid"&&b("grid",i[a]),n),children:t})}function Vg(t={}){const{initialValue:s=0,format:a,previousValue:r}=t,[n,o]=c.useState(s),i=a?a(n):n.toString(),l=c.useMemo(()=>r===void 0?"neutral":n>r?"up":n<r?"down":"neutral",[n,r]),u=c.useMemo(()=>{if(r===void 0||r===0)return;const d=(n-r)/r*100;return`${d>=0?"+":""}${d.toFixed(1)}%`},[n,r]);return{value:i,rawValue:n,setValue:o,trend:l,trendValue:u}}const nn=c.createContext(null);function on(){const t=c.useContext(nn);if(!t)throw new Error("useStepperContext must be used within a WakaStepper");return t}function so({step:t,index:s,status:a}){const{variant:r,size:n}=on(),o={sm:"h-6 w-6 text-xs",md:"h-8 w-8 text-sm",lg:"h-10 w-10 text-base"},i={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},l=b("rounded-full flex items-center justify-center font-medium transition-all duration-200",o[n]),u={pending:"bg-muted text-muted-foreground border-2 border-muted",current:"bg-primary text-primary-foreground border-2 border-primary shadow-md",completed:"bg-primary text-primary-foreground border-2 border-primary",error:"bg-destructive text-destructive-foreground border-2 border-destructive"},d=()=>t.icon&&a==="current"?t.icon:a==="completed"?e.jsx(h.Check,{className:i[n]}):a==="error"?e.jsx(h.AlertCircle,{className:i[n]}):r==="simple"?e.jsx(h.Circle,{className:b(i[n],a==="current"?"fill-current":"")}):e.jsx("span",{children:s+1});return e.jsx("div",{className:b(l,u[a]),children:d()})}function ao({isCompleted:t,orientation:s}){const a=b("transition-colors duration-300",s==="horizontal"?"flex-1 h-0.5 mx-2":"w-0.5 min-h-[24px] mx-auto my-1");return e.jsx("div",{className:b(a,t?"bg-primary":"bg-muted")})}function Wg({step:t,index:s,isLast:a}){const{currentStep:r,orientation:n,size:o,clickable:i,allowPrevious:l,goToStep:u,getStepStatus:d}=on(),f=d(s),m=i&&!t.disabled&&(l?s<r:!0),p={sm:"text-xs",md:"text-sm",lg:"text-base"},w={sm:"text-[10px]",md:"text-xs",lg:"text-sm"},C=()=>{m&&u(s)};return n==="vertical"?e.jsxs("div",{className:"flex",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("button",{type:"button",onClick:C,disabled:!m,className:b("flex items-center gap-3 text-left",m&&"cursor-pointer hover:opacity-80",!m&&"cursor-default"),children:e.jsx(so,{step:t,index:s,status:f})}),!a&&e.jsx(ao,{isCompleted:f==="completed",orientation:"vertical"})]}),e.jsx("div",{className:"ml-3 pb-6",children:e.jsxs("button",{type:"button",onClick:C,disabled:!m,className:b("text-left",m&&"cursor-pointer hover:opacity-80",!m&&"cursor-default"),children:[e.jsxs("p",{className:b("font-medium",p[o],f==="current"?"text-foreground":"text-muted-foreground",t.disabled&&"opacity-50"),children:[t.title,t.optional&&e.jsx("span",{className:"ml-1 text-muted-foreground font-normal",children:"(Optionnel)"})]}),t.description&&e.jsx("p",{className:b("text-muted-foreground mt-0.5",w[o]),children:t.description})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col items-center",children:e.jsxs("button",{type:"button",onClick:C,disabled:!m,className:b("flex flex-col items-center gap-2",m&&"cursor-pointer hover:opacity-80",!m&&"cursor-default"),children:[e.jsx(so,{step:t,index:s,status:f}),e.jsxs("div",{className:"text-center min-w-[80px] max-w-[120px]",children:[e.jsx("p",{className:b("font-medium",p[o],f==="current"?"text-foreground":"text-muted-foreground",t.disabled&&"opacity-50"),children:t.title}),t.description&&e.jsx("p",{className:b("text-muted-foreground mt-0.5 hidden sm:block",w[o]),children:t.description})]})]})}),!a&&e.jsx(ao,{isCompleted:f==="completed",orientation:"horizontal"})]})}function Ug({steps:t,currentStep:s,onStepChange:a,orientation:r="horizontal",variant:n="default",size:o="md",clickable:i=!1,allowPrevious:l=!0,showContent:u=!1,className:d}){const f=c.useCallback(g=>g<s?"completed":g===s?"current":"pending",[s]),m=c.useCallback(g=>{g>=0&&g<t.length&&!t[g].disabled&&a?.(g)},[t,a]),p=c.useCallback(()=>{s<t.length-1&&m(s+1)},[s,t.length,m]),w=c.useCallback(()=>{s>0&&m(s-1)},[s,m]),C={currentStep:s,orientation:r,variant:n,size:o,clickable:i,allowPrevious:l,goToStep:m,nextStep:p,prevStep:w,getStepStatus:f};return e.jsx(nn.Provider,{value:C,children:e.jsxs("div",{className:b("w-full",d),children:[e.jsx("nav",{"aria-label":"Progress",className:b(r==="horizontal"?"flex items-start justify-between":"flex flex-col"),children:t.map((g,y)=>e.jsx(Wg,{step:g,index:y,isLast:y===t.length-1},g.id))}),u&&t[s]?.content&&e.jsx("div",{className:"mt-6 p-4 rounded-lg border bg-card",children:t[s].content})]})})}function Bg({prevLabel:t="Précédent",nextLabel:s="Suivant",finishLabel:a="Terminer",onFinish:r,showCancel:n=!1,cancelLabel:o="Annuler",onCancel:i,disableNext:l=!1,className:u}){const d=c.useContext(nn);if(!d)throw new Error("StepperNavigation must be used within a WakaStepper");const{currentStep:f,prevStep:m,nextStep:p}=d;return e.jsxs("div",{className:b("flex items-center justify-between mt-6",u),children:[e.jsx("div",{className:"flex gap-2",children:n&&e.jsx("button",{type:"button",onClick:i,className:"px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",children:o})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:m,disabled:f===0,className:b("px-4 py-2 text-sm font-medium rounded-md border transition-colors",f===0?"opacity-50 cursor-not-allowed":"hover:bg-muted"),children:t}),e.jsx("button",{type:"button",onClick:r||p,disabled:l,className:b("px-4 py-2 text-sm font-medium rounded-md bg-primary text-primary-foreground transition-colors",l?"opacity-50 cursor-not-allowed":"hover:bg-primary/90"),children:r?a:s})]})]})}function Wl({s3Config:t,onSave:s,onDelete:a,onLoadTheme:r,existingThemes:n=[],className:o}){const{toast:i}=Ir(),[l,u]=c.useState(""),[d,f]=c.useState(""),[m,p]=c.useState(""),[w,C]=c.useState("#3b82f6"),[g,y]=c.useState(""),[j,x]=c.useState(""),[v,k]=c.useState(""),[N,D]=c.useState(!1),[P,R]=c.useState(!1),[A,S]=c.useState(!1),[M,E]=c.useState(!1),[T,K]=c.useState(!1),[q,B]=c.useState(null),[W,I]=c.useState([]),[z,$]=c.useState("1.0.0"),_=c.useRef(null),F=c.useCallback(te=>{if(!te.trim())return{valid:!1,error:"Le CSS ne peut pas être vide"};const Z=te.includes(":root")||te.includes(".dark"),le=te.includes("@theme inline");return!Z&&!le?{valid:!1,error:"Le CSS doit contenir :root, .dark ou @theme inline"}:te.includes("--")?{valid:!0}:{valid:!1,error:"Le CSS doit contenir des variables CSS (--variable)"}},[]),H=c.useCallback(()=>{const te=F(j);if(!te.valid){i({title:"CSS invalide",description:te.error,variant:"destructive"});return}_.current&&_.current.parentNode&&_.current.parentNode.removeChild(_.current);const Z=document.createElement("style");Z.setAttribute("data-theme-preview",l),Z.textContent=j,document.head.appendChild(Z),_.current=Z,document.documentElement.setAttribute("data-theme",l),R(!0),i({title:"Prévisualisation activée",description:`Le thème "${d}" est maintenant actif`})},[j,l,d,F,i]),J=c.useCallback(()=>{_.current&&_.current.parentNode&&_.current.parentNode.removeChild(_.current),document.documentElement.removeAttribute("data-theme"),R(!1),i({title:"Prévisualisation arrêtée",description:"Thème par défaut restauré"})},[i]),Q=c.useCallback(async()=>{const te=F(j);if(!te.valid){i({title:"CSS invalide",description:te.error,variant:"destructive"});return}if(!l||!d){i({title:"Informations manquantes",description:"Veuillez renseigner l'ID et le nom du thème",variant:"destructive"});return}D(!0);try{const{baseUrl:Z,method:le="PUT",headers:xe={},prefix:se="",extension:de="css"}=t,De=encodeURIComponent(l.replace(/\s+/g,"-").toLowerCase()),Ne=`${Z.replace(/\/$/,"")}/${se}${De}.${de}`;console.log(`[ThemeCreator] Uploading theme to: ${Ne}`);const Ke=await fetch(Ne,{method:le,headers:{"Content-Type":"text/css",...xe},body:j});if(!Ke.ok)throw new Error(`Upload failed: ${Ke.status} ${Ke.statusText}`);const xt={version:z,createdAt:new Date,createdBy:g||"Anonymous",changelog:v||"No changelog provided",css:j},Ye=[...W,xt];I(Ye);const et={id:l,label:d,description:m,previewColor:w,author:g,versions:Ye,currentVersion:z},gt=`${Z.replace(/\/$/,"")}/${se}${l}.json`;await fetch(gt,{method:le,headers:{"Content-Type":"application/json",...xe},body:JSON.stringify(et,null,2)}),i({title:"Thème publié !",description:`Le thème "${d}" v${z} a été uploadé sur S3`}),s?.(et),k("")}catch(Z){console.error("[ThemeCreator] Upload error:",Z),i({title:"Erreur d'upload",description:Z instanceof Error?Z.message:"Une erreur est survenue",variant:"destructive"})}finally{D(!1)}},[j,l,d,m,w,g,z,v,W,t,F,i,s]),ne=c.useCallback(async()=>{try{await navigator.clipboard.writeText(j),S(!0),setTimeout(()=>S(!1),2e3),i({title:"CSS copié !",description:"Le code CSS a été copié dans le presse-papiers"})}catch{i({title:"Erreur de copie",description:"Impossible de copier le CSS",variant:"destructive"})}},[j,i]),X=c.useCallback(async te=>{K(!0);try{let Z=te;if(r&&(!te.versions||te.versions.length===0||!te.versions[0].css)){const xe=await r(te.id);if(xe)Z=xe,i({title:"Thème chargé",description:`Thème "${Z.label}" chargé depuis S3`});else{i({title:"Erreur",description:`Impossible de charger le thème "${te.label}"`,variant:"destructive"});return}}u(Z.id),f(Z.label),p(Z.description||""),C(Z.previewColor||"#3b82f6"),y(Z.author||""),I(Z.versions),$(Z.currentVersion);const le=Z.versions[Z.versions.length-1];le&&x(le.css),B(Z)}catch(Z){console.error("[WakaThemeCreator] Error loading theme:",Z),i({title:"Erreur",description:"Erreur lors du chargement du thème",variant:"destructive"})}finally{K(!1)}},[r,i]),Y=c.useCallback(()=>{u(""),f(""),p(""),C("#3b82f6"),y(""),x(""),k(""),I([]),$("1.0.0"),B(null),P&&J()},[P,J]),U=c.useCallback(()=>{const te=new Blob([j],{type:"text/css"}),Z=URL.createObjectURL(te),le=document.createElement("a");le.href=Z,le.download=`${l||"theme"}.css`,document.body.appendChild(le),le.click(),document.body.removeChild(le),URL.revokeObjectURL(Z),i({title:"CSS téléchargé",description:`Fichier ${l||"theme"}.css téléchargé`})},[j,l,i]);return e.jsxs("div",{className:b("w-full max-w-6xl mx-auto space-y-6",o),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Créateur de Thèmes"}),e.jsx("p",{className:"text-muted-foreground",children:"Créez et publiez des thèmes TweakCN sur S3"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(L,{variant:"outline",onClick:Y,children:[e.jsx(h.Plus,{className:"mr-2 h-4 w-4"}),"Nouveau thème"]}),P&&e.jsx(L,{variant:"destructive",onClick:J,children:"Arrêter la prévisualisation"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs(ke,{className:"lg:col-span-1",children:[e.jsxs(qe,{children:[e.jsx(Oe,{children:"Thèmes existants"}),e.jsx(ot,{children:"Chargez un thème pour le modifier"})]}),e.jsx(Te,{className:"space-y-2",children:n.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Aucun thème existant"}):n.map(te=>e.jsxs("button",{onClick:()=>X(te),disabled:T,className:b("w-full flex items-center gap-3 p-3 rounded-lg border-2 transition-all text-left",q?.id===te.id?"border-primary bg-primary/10":"border-border hover:border-primary/50",T&&"opacity-50 cursor-not-allowed"),children:[e.jsx("div",{className:"w-8 h-8 rounded-full flex-shrink-0",style:{backgroundColor:te.previewColor||"#3b82f6"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"font-medium truncate flex items-center gap-2",children:[te.label,T&&q?.id===te.id&&e.jsx(h.Loader2,{className:"h-4 w-4 animate-spin"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["v",te.currentVersion||"1.0.0"," • ",te.versions?.length||0," versions"]})]})]},te.id))})]}),e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(ke,{children:[e.jsx(qe,{children:e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Palette,{className:"h-5 w-5"}),"Informations du thème"]})}),e.jsxs(Te,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"theme-id",children:"ID du thème *"}),e.jsx(oe,{id:"theme-id",placeholder:"ex: forest",value:l,onChange:te=>u(te.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"theme-label",children:"Nom d'affichage *"}),e.jsx(oe,{id:"theme-label",placeholder:"ex: Forêt",value:d,onChange:te=>f(te.target.value)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"theme-description",children:"Description"}),e.jsx(oe,{id:"theme-description",placeholder:"Thème inspiré de la nature",value:m,onChange:te=>p(te.target.value)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"theme-color",children:"Couleur de prévisualisation"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{id:"theme-color",type:"color",value:w,onChange:te=>C(te.target.value),className:"w-16 h-10 p-1"}),e.jsx(oe,{value:w,onChange:te=>C(te.target.value),placeholder:"#3b82f6"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"theme-author",children:"Auteur"}),e.jsx(oe,{id:"theme-author",placeholder:"Votre nom",value:g,onChange:te=>y(te.target.value)})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"theme-version",children:"Version"}),e.jsx(oe,{id:"theme-version",placeholder:"1.0.0",value:z,onChange:te=>$(te.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"theme-changelog",children:"Changelog"}),e.jsx(oe,{id:"theme-changelog",placeholder:"Modifications apportées",value:v,onChange:te=>k(te.target.value)})]})]})]})]}),e.jsxs(ke,{children:[e.jsxs(qe,{children:[e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.FileCode,{className:"h-5 w-5"}),"Code CSS TweakCN"]}),e.jsx(ot,{children:"Collez le CSS généré par TweakCN ici"})]}),e.jsxs(Te,{className:"space-y-4",children:[e.jsx(ft,{placeholder:`:root {
45
+ `}})]})});zl.displayName="WakaSpinner";function tr(t,s,a){const r=[];for(let o=0;o<6;o++){const i=o/6*Math.PI*2,l=a*(.7+Math.random()*.6),u=t+Math.cos(i)*l,d=s+Math.sin(i)*l;r.push([u,d])}return r.map(([o,i])=>`${o},${i}`).join(" ")}const zg={default:{icon:"text-muted-foreground",bg:"bg-muted",gradient:"from-gray-500 to-gray-600"},primary:{icon:"text-primary",bg:"bg-primary/10",gradient:"from-primary to-primary/80"},success:{icon:"text-green-600",bg:"bg-green-100",gradient:"from-green-500 to-green-600"},warning:{icon:"text-yellow-600",bg:"bg-yellow-100",gradient:"from-yellow-500 to-yellow-600"},destructive:{icon:"text-destructive",bg:"bg-destructive/10",gradient:"from-destructive to-destructive/80"},blue:{icon:"text-blue-600",bg:"bg-blue-100",gradient:"from-blue-500 to-blue-600"},purple:{icon:"text-purple-600",bg:"bg-purple-100",gradient:"from-purple-500 to-purple-600"}};function to({direction:t,value:s,text:a,invert:r,size:n}){const o=r?t==="down":t==="up",i=r?t==="up":t==="down",l={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},u={sm:"text-[10px]",md:"text-xs",lg:"text-sm"},d=t==="up"?h.TrendingUp:t==="down"?h.TrendingDown:h.Minus;return e.jsxs("div",{className:b("flex items-center gap-1",u[n],o&&"text-green-600",i&&"text-destructive",t==="neutral"&&"text-muted-foreground"),children:[e.jsx(d,{className:l[n]}),s&&e.jsx("span",{className:"font-medium",children:s}),a&&e.jsx("span",{className:"text-muted-foreground",children:a})]})}function _g({size:t}){const s={sm:"h-5 w-16",md:"h-7 w-20",lg:"h-9 w-24"};return e.jsxs("div",{className:"animate-pulse",children:[e.jsx("div",{className:"h-3 w-16 bg-muted rounded mb-2"}),e.jsx("div",{className:b("bg-muted rounded",s[t])})]})}function _l({label:t,value:s,description:a,icon:r,trend:n,trendValue:o,trendText:i,invertTrend:l=!1,variant:u="default",size:d="md",color:f="default",loading:m=!1,className:p}){const w=zg[f],g={sm:{container:"p-3",label:"text-xs",value:"text-xl",description:"text-[10px]",icon:"h-8 w-8",iconInner:"h-4 w-4"},md:{container:"p-4",label:"text-sm",value:"text-2xl",description:"text-xs",icon:"h-10 w-10",iconInner:"h-5 w-5"},lg:{container:"p-6",label:"text-base",value:"text-4xl",description:"text-sm",icon:"h-12 w-12",iconInner:"h-6 w-6"}}[d];return m?e.jsx("div",{className:b(u==="card"&&"rounded-lg border bg-card shadow-sm",u==="gradient"&&"rounded-lg text-white",g.container,p),children:e.jsx(_g,{size:d})}):u==="minimal"?e.jsxs("div",{className:b("flex flex-col",p),children:[e.jsx("span",{className:b("text-muted-foreground",g.label),children:t}),e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("span",{className:b("font-bold tracking-tight",g.value),children:s}),n&&e.jsx(to,{direction:n,value:o,text:i,invert:l,size:d})]}),a&&e.jsx("span",{className:b("text-muted-foreground mt-1",g.description),children:a})]}):u==="gradient"?e.jsx("div",{className:b("rounded-lg bg-gradient-to-br text-white",w.gradient,g.container,p),children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:b("text-white/80",g.label),children:t}),e.jsx("p",{className:b("font-bold mt-1",g.value),children:s}),a&&e.jsx("p",{className:b("text-white/70 mt-1",g.description),children:a}),n&&e.jsxs("div",{className:"mt-2 flex items-center gap-1 text-white/90",children:[n==="up"&&e.jsx(h.ArrowUp,{className:g.iconInner}),n==="down"&&e.jsx(h.ArrowDown,{className:g.iconInner}),o&&e.jsx("span",{className:g.description,children:o}),i&&e.jsx("span",{className:b("text-white/70",g.description),children:i})]})]}),r&&e.jsx("div",{className:"rounded-lg bg-white/20 p-2",children:e.jsx("div",{className:g.iconInner,children:r})})]})}):e.jsx("div",{className:b(u==="card"&&"rounded-lg border bg-card shadow-sm",g.container,p),children:e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:b("text-muted-foreground font-medium",g.label),children:t}),e.jsxs("div",{className:"flex items-baseline gap-2 mt-1",children:[e.jsx("span",{className:b("font-bold tracking-tight",g.value),children:s}),n&&e.jsx(to,{direction:n,value:o,text:i,invert:l,size:d})]}),a&&e.jsx("p",{className:b("text-muted-foreground mt-1",g.description),children:a})]}),r&&e.jsx("div",{className:b("rounded-lg flex items-center justify-center flex-shrink-0",g.icon,w.bg),children:e.jsx("div",{className:b(g.iconInner,w.icon),children:r})})]})})}function Vl({children:t,layout:s="row",columns:a=4,gap:r="md",className:n}){const o={sm:"gap-2",md:"gap-4",lg:"gap-6"},i={2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4"};return e.jsx("div",{className:b(o[r],s==="row"&&"flex flex-wrap",s==="grid"&&b("grid",i[a]),n),children:t})}function Vg(t={}){const{initialValue:s=0,format:a,previousValue:r}=t,[n,o]=c.useState(s),i=a?a(n):n.toString(),l=c.useMemo(()=>r===void 0?"neutral":n>r?"up":n<r?"down":"neutral",[n,r]),u=c.useMemo(()=>{if(r===void 0||r===0)return;const d=(n-r)/r*100;return`${d>=0?"+":""}${d.toFixed(1)}%`},[n,r]);return{value:i,rawValue:n,setValue:o,trend:l,trendValue:u}}const nn=c.createContext(null);function on(){const t=c.useContext(nn);if(!t)throw new Error("useStepperContext must be used within a WakaStepper");return t}function so({step:t,index:s,status:a}){const{variant:r,size:n}=on(),o={sm:"h-6 w-6 text-xs",md:"h-8 w-8 text-sm",lg:"h-10 w-10 text-base"},i={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},l=b("rounded-full flex items-center justify-center font-medium transition-all duration-200",o[n]),u={pending:"bg-muted text-muted-foreground border-2 border-muted",current:"bg-primary text-primary-foreground border-2 border-primary shadow-md",completed:"bg-primary text-primary-foreground border-2 border-primary",error:"bg-destructive text-destructive-foreground border-2 border-destructive"},d=()=>t.icon&&a==="current"?t.icon:a==="completed"?e.jsx(h.Check,{className:i[n]}):a==="error"?e.jsx(h.AlertCircle,{className:i[n]}):r==="simple"?e.jsx(h.Circle,{className:b(i[n],a==="current"?"fill-current":"")}):e.jsx("span",{children:s+1});return e.jsx("div",{className:b(l,u[a]),children:d()})}function ao({isCompleted:t,orientation:s}){const a=b("transition-colors duration-300",s==="horizontal"?"flex-1 h-0.5 mx-2":"w-0.5 min-h-[24px] mx-auto my-1");return e.jsx("div",{className:b(a,t?"bg-primary":"bg-muted")})}function Wg({step:t,index:s,isLast:a}){const{currentStep:r,orientation:n,size:o,clickable:i,allowPrevious:l,goToStep:u,getStepStatus:d}=on(),f=d(s),m=i&&!t.disabled&&(l?s<r:!0),p={sm:"text-xs",md:"text-sm",lg:"text-base"},w={sm:"text-[10px]",md:"text-xs",lg:"text-sm"},C=()=>{m&&u(s)};return n==="vertical"?e.jsxs("div",{className:"flex",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("button",{type:"button",onClick:C,disabled:!m,className:b("flex items-center gap-3 text-left",m&&"cursor-pointer hover:opacity-80",!m&&"cursor-default"),children:e.jsx(so,{step:t,index:s,status:f})}),!a&&e.jsx(ao,{isCompleted:f==="completed",orientation:"vertical"})]}),e.jsx("div",{className:"ml-3 pb-6",children:e.jsxs("button",{type:"button",onClick:C,disabled:!m,className:b("text-left",m&&"cursor-pointer hover:opacity-80",!m&&"cursor-default"),children:[e.jsxs("p",{className:b("font-medium",p[o],f==="current"?"text-foreground":"text-muted-foreground",t.disabled&&"opacity-50"),children:[t.title,t.optional&&e.jsx("span",{className:"ml-1 text-muted-foreground font-normal",children:"(Optionnel)"})]}),t.description&&e.jsx("p",{className:b("text-muted-foreground mt-0.5",w[o]),children:t.description})]})})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col items-center",children:e.jsxs("button",{type:"button",onClick:C,disabled:!m,className:b("flex flex-col items-center gap-2",m&&"cursor-pointer hover:opacity-80",!m&&"cursor-default"),children:[e.jsx(so,{step:t,index:s,status:f}),e.jsxs("div",{className:"text-center min-w-[80px] max-w-[120px]",children:[e.jsx("p",{className:b("font-medium",p[o],f==="current"?"text-foreground":"text-muted-foreground",t.disabled&&"opacity-50"),children:t.title}),t.description&&e.jsx("p",{className:b("text-muted-foreground mt-0.5 hidden sm:block",w[o]),children:t.description})]})]})}),!a&&e.jsx(ao,{isCompleted:f==="completed",orientation:"horizontal"})]})}function Ug({steps:t,currentStep:s,onStepChange:a,orientation:r="horizontal",variant:n="default",size:o="md",clickable:i=!1,allowPrevious:l=!0,showContent:u=!1,className:d}){const f=c.useCallback(g=>g<s?"completed":g===s?"current":"pending",[s]),m=c.useCallback(g=>{g>=0&&g<t.length&&!t[g].disabled&&a?.(g)},[t,a]),p=c.useCallback(()=>{s<t.length-1&&m(s+1)},[s,t.length,m]),w=c.useCallback(()=>{s>0&&m(s-1)},[s,m]),C={currentStep:s,orientation:r,variant:n,size:o,clickable:i,allowPrevious:l,goToStep:m,nextStep:p,prevStep:w,getStepStatus:f};return e.jsx(nn.Provider,{value:C,children:e.jsxs("div",{className:b("w-full",d),children:[e.jsx("nav",{"aria-label":"Progress",className:b(r==="horizontal"?"flex items-start justify-between":"flex flex-col"),children:t.map((g,y)=>e.jsx(Wg,{step:g,index:y,isLast:y===t.length-1},g.id))}),u&&t[s]?.content&&e.jsx("div",{className:"mt-6 p-4 rounded-lg border bg-card",children:t[s].content})]})})}function Bg({prevLabel:t="Précédent",nextLabel:s="Suivant",finishLabel:a="Terminer",onFinish:r,showCancel:n=!1,cancelLabel:o="Annuler",onCancel:i,disableNext:l=!1,className:u}){const d=c.useContext(nn);if(!d)throw new Error("StepperNavigation must be used within a WakaStepper");const{currentStep:f,prevStep:m,nextStep:p}=d;return e.jsxs("div",{className:b("flex items-center justify-between mt-6",u),children:[e.jsx("div",{className:"flex gap-2",children:n&&e.jsx("button",{type:"button",onClick:i,className:"px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",children:o})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"button",onClick:m,disabled:f===0,className:b("px-4 py-2 text-sm font-medium rounded-md border transition-colors",f===0?"opacity-50 cursor-not-allowed":"hover:bg-muted"),children:t}),e.jsx("button",{type:"button",onClick:r||p,disabled:l,className:b("px-4 py-2 text-sm font-medium rounded-md bg-primary text-primary-foreground transition-colors",l?"opacity-50 cursor-not-allowed":"hover:bg-primary/90"),children:r?a:s})]})]})}function Wl({s3Config:t,onSave:s,onDelete:a,onLoadTheme:r,existingThemes:n=[],className:o}){const{toast:i}=Vr(),[l,u]=c.useState(""),[d,f]=c.useState(""),[m,p]=c.useState(""),[w,C]=c.useState("#3b82f6"),[g,y]=c.useState(""),[j,x]=c.useState(""),[v,k]=c.useState(""),[N,D]=c.useState(!1),[P,R]=c.useState(!1),[A,S]=c.useState(!1),[M,E]=c.useState(!1),[T,K]=c.useState(!1),[q,B]=c.useState(null),[W,I]=c.useState([]),[z,$]=c.useState("1.0.0"),_=c.useRef(null),F=c.useCallback(te=>{if(!te.trim())return{valid:!1,error:"Le CSS ne peut pas être vide"};const Z=te.includes(":root")||te.includes(".dark"),le=te.includes("@theme inline");return!Z&&!le?{valid:!1,error:"Le CSS doit contenir :root, .dark ou @theme inline"}:te.includes("--")?{valid:!0}:{valid:!1,error:"Le CSS doit contenir des variables CSS (--variable)"}},[]),H=c.useCallback(()=>{const te=F(j);if(!te.valid){i({title:"CSS invalide",description:te.error,variant:"destructive"});return}_.current&&_.current.parentNode&&_.current.parentNode.removeChild(_.current);const Z=document.createElement("style");Z.setAttribute("data-theme-preview",l),Z.textContent=j,document.head.appendChild(Z),_.current=Z,document.documentElement.setAttribute("data-theme",l),R(!0),i({title:"Prévisualisation activée",description:`Le thème "${d}" est maintenant actif`})},[j,l,d,F,i]),J=c.useCallback(()=>{_.current&&_.current.parentNode&&_.current.parentNode.removeChild(_.current),document.documentElement.removeAttribute("data-theme"),R(!1),i({title:"Prévisualisation arrêtée",description:"Thème par défaut restauré"})},[i]),Q=c.useCallback(async()=>{const te=F(j);if(!te.valid){i({title:"CSS invalide",description:te.error,variant:"destructive"});return}if(!l||!d){i({title:"Informations manquantes",description:"Veuillez renseigner l'ID et le nom du thème",variant:"destructive"});return}D(!0);try{const{baseUrl:Z,method:le="PUT",headers:xe={},prefix:se="",extension:de="css"}=t,De=encodeURIComponent(l.replace(/\s+/g,"-").toLowerCase()),Ne=`${Z.replace(/\/$/,"")}/${se}${De}.${de}`;console.log(`[ThemeCreator] Uploading theme to: ${Ne}`);const Ke=await fetch(Ne,{method:le,headers:{"Content-Type":"text/css",...xe},body:j});if(!Ke.ok)throw new Error(`Upload failed: ${Ke.status} ${Ke.statusText}`);const xt={version:z,createdAt:new Date,createdBy:g||"Anonymous",changelog:v||"No changelog provided",css:j},Ye=[...W,xt];I(Ye);const et={id:l,label:d,description:m,previewColor:w,author:g,versions:Ye,currentVersion:z},gt=`${Z.replace(/\/$/,"")}/${se}${l}.json`;await fetch(gt,{method:le,headers:{"Content-Type":"application/json",...xe},body:JSON.stringify(et,null,2)}),i({title:"Thème publié !",description:`Le thème "${d}" v${z} a été uploadé sur S3`}),s?.(et),k("")}catch(Z){console.error("[ThemeCreator] Upload error:",Z),i({title:"Erreur d'upload",description:Z instanceof Error?Z.message:"Une erreur est survenue",variant:"destructive"})}finally{D(!1)}},[j,l,d,m,w,g,z,v,W,t,F,i,s]),ne=c.useCallback(async()=>{try{await navigator.clipboard.writeText(j),S(!0),setTimeout(()=>S(!1),2e3),i({title:"CSS copié !",description:"Le code CSS a été copié dans le presse-papiers"})}catch{i({title:"Erreur de copie",description:"Impossible de copier le CSS",variant:"destructive"})}},[j,i]),X=c.useCallback(async te=>{K(!0);try{let Z=te;if(r&&(!te.versions||te.versions.length===0||!te.versions[0].css)){const xe=await r(te.id);if(xe)Z=xe,i({title:"Thème chargé",description:`Thème "${Z.label}" chargé depuis S3`});else{i({title:"Erreur",description:`Impossible de charger le thème "${te.label}"`,variant:"destructive"});return}}u(Z.id),f(Z.label),p(Z.description||""),C(Z.previewColor||"#3b82f6"),y(Z.author||""),I(Z.versions),$(Z.currentVersion);const le=Z.versions[Z.versions.length-1];le&&x(le.css),B(Z)}catch(Z){console.error("[WakaThemeCreator] Error loading theme:",Z),i({title:"Erreur",description:"Erreur lors du chargement du thème",variant:"destructive"})}finally{K(!1)}},[r,i]),Y=c.useCallback(()=>{u(""),f(""),p(""),C("#3b82f6"),y(""),x(""),k(""),I([]),$("1.0.0"),B(null),P&&J()},[P,J]),U=c.useCallback(()=>{const te=new Blob([j],{type:"text/css"}),Z=URL.createObjectURL(te),le=document.createElement("a");le.href=Z,le.download=`${l||"theme"}.css`,document.body.appendChild(le),le.click(),document.body.removeChild(le),URL.revokeObjectURL(Z),i({title:"CSS téléchargé",description:`Fichier ${l||"theme"}.css téléchargé`})},[j,l,i]);return e.jsxs("div",{className:b("w-full max-w-6xl mx-auto space-y-6",o),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Créateur de Thèmes"}),e.jsx("p",{className:"text-muted-foreground",children:"Créez et publiez des thèmes TweakCN sur S3"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(L,{variant:"outline",onClick:Y,children:[e.jsx(h.Plus,{className:"mr-2 h-4 w-4"}),"Nouveau thème"]}),P&&e.jsx(L,{variant:"destructive",onClick:J,children:"Arrêter la prévisualisation"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[e.jsxs(ke,{className:"lg:col-span-1",children:[e.jsxs(qe,{children:[e.jsx(Oe,{children:"Thèmes existants"}),e.jsx(ot,{children:"Chargez un thème pour le modifier"})]}),e.jsx(Te,{className:"space-y-2",children:n.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Aucun thème existant"}):n.map(te=>e.jsxs("button",{onClick:()=>X(te),disabled:T,className:b("w-full flex items-center gap-3 p-3 rounded-lg border-2 transition-all text-left",q?.id===te.id?"border-primary bg-primary/10":"border-border hover:border-primary/50",T&&"opacity-50 cursor-not-allowed"),children:[e.jsx("div",{className:"w-8 h-8 rounded-full flex-shrink-0",style:{backgroundColor:te.previewColor||"#3b82f6"}}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"font-medium truncate flex items-center gap-2",children:[te.label,T&&q?.id===te.id&&e.jsx(h.Loader2,{className:"h-4 w-4 animate-spin"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["v",te.currentVersion||"1.0.0"," • ",te.versions?.length||0," versions"]})]})]},te.id))})]}),e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(ke,{children:[e.jsx(qe,{children:e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Palette,{className:"h-5 w-5"}),"Informations du thème"]})}),e.jsxs(Te,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"theme-id",children:"ID du thème *"}),e.jsx(oe,{id:"theme-id",placeholder:"ex: forest",value:l,onChange:te=>u(te.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"theme-label",children:"Nom d'affichage *"}),e.jsx(oe,{id:"theme-label",placeholder:"ex: Forêt",value:d,onChange:te=>f(te.target.value)})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"theme-description",children:"Description"}),e.jsx(oe,{id:"theme-description",placeholder:"Thème inspiré de la nature",value:m,onChange:te=>p(te.target.value)})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"theme-color",children:"Couleur de prévisualisation"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{id:"theme-color",type:"color",value:w,onChange:te=>C(te.target.value),className:"w-16 h-10 p-1"}),e.jsx(oe,{value:w,onChange:te=>C(te.target.value),placeholder:"#3b82f6"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"theme-author",children:"Auteur"}),e.jsx(oe,{id:"theme-author",placeholder:"Votre nom",value:g,onChange:te=>y(te.target.value)})]})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"theme-version",children:"Version"}),e.jsx(oe,{id:"theme-version",placeholder:"1.0.0",value:z,onChange:te=>$(te.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"theme-changelog",children:"Changelog"}),e.jsx(oe,{id:"theme-changelog",placeholder:"Modifications apportées",value:v,onChange:te=>k(te.target.value)})]})]})]})]}),e.jsxs(ke,{children:[e.jsxs(qe,{children:[e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.FileCode,{className:"h-5 w-5"}),"Code CSS TweakCN"]}),e.jsx(ot,{children:"Collez le CSS généré par TweakCN ici"})]}),e.jsxs(Te,{className:"space-y-4",children:[e.jsx(ft,{placeholder:`:root {
46
46
  --background: oklch(0.9911 0 0);
47
47
  --foreground: oklch(0.2046 0 0);
48
48
  --primary: oklch(0.8348 0.1302 160.9080);
@@ -73,4 +73,4 @@ ${m.join(`
73
73
  --color-primary: var(--primary);
74
74
  --color-primary-foreground: var(--primary-foreground);
75
75
  /* ... autres couleurs ... */
76
- }`,value:j,onChange:te=>x(te.target.value),className:"font-mono text-sm min-h-[300px]"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(L,{onClick:H,disabled:P,children:[e.jsx(h.Eye,{className:"mr-2 h-4 w-4"}),"Prévisualiser"]}),e.jsx(L,{variant:"outline",onClick:ne,children:A?e.jsxs(e.Fragment,{children:[e.jsx(h.Check,{className:"mr-2 h-4 w-4"}),"Copié !"]}):e.jsxs(e.Fragment,{children:[e.jsx(h.Copy,{className:"mr-2 h-4 w-4"}),"Copier CSS"]})}),e.jsxs(L,{variant:"outline",onClick:U,children:[e.jsx(h.Download,{className:"mr-2 h-4 w-4"}),"Télécharger"]}),e.jsx("div",{className:"ml-auto",children:e.jsx(L,{onClick:Q,disabled:N,children:N?e.jsxs(e.Fragment,{children:[e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Publication..."]}):e.jsxs(e.Fragment,{children:[e.jsx(h.Upload,{className:"mr-2 h-4 w-4"}),"Publier sur S3"]})})})]})]})]}),W.length>0&&e.jsxs(ke,{children:[e.jsx(qe,{children:e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.History,{className:"h-5 w-5"}),"Historique des versions"]})}),e.jsx(Te,{children:e.jsx("div",{className:"space-y-3",children:W.slice().reverse().map((te,Z)=>e.jsxs("div",{className:"flex items-start gap-3 p-3 border rounded-lg",children:[e.jsxs(Se,{variant:"outline",children:["v",te.version]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:te.changelog||"Aucune description"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Par ",te.createdBy," • ",te.createdAt.toLocaleDateString()]})]}),e.jsx(L,{variant:"ghost",size:"sm",onClick:()=>x(te.css),children:"Charger"})]},Z))})})]})]})]}),e.jsx(fs,{open:M,onOpenChange:E,children:e.jsxs(Kt,{children:[e.jsxs(Yt,{children:[e.jsx(Qt,{children:"Supprimer le thème ?"}),e.jsx(Zt,{children:"Cette action est irréversible. Le thème sera supprimé de S3."})]}),e.jsxs(Jt,{children:[e.jsx(ts,{children:"Annuler"}),e.jsx(es,{onClick:()=>{q&&(a?.(q.id),Y()),E(!1)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer"})]})]})})]})}Wl.displayName="WakaThemeCreator";function qg(){try{return na()}catch{return null}}const Ul=Xe.cva("w-full",{variants:{size:{sm:"max-w-2xl",base:"max-w-4xl",lg:"max-w-6xl",full:"max-w-full"}},defaultVariants:{size:"base"}}),Bl=c.forwardRef(({className:t,size:s,onThemeChange:a,onThemeLoad:r,onThemeSave:n,initialTheme:o,showPreview:i=!0,showExport:l=!0,showImport:u=!0,allowCustomColors:d=!0,...f},m)=>{const p=qg(),w=p?.theme,C=p?.themes||[],g=p?.setTheme,[y,j]=O.useState(o||{name:"Custom Theme",description:"Thème personnalisé",colors:{background:"#ffffff",foreground:"#0a0a0a",card:"#ffffff",cardForeground:"#0a0a0a",popover:"#ffffff",popoverForeground:"#0a0a0a",primary:"#0a0a0a",primaryForeground:"#fafafa",secondary:"#f4f4f5",secondaryForeground:"#0a0a0a",muted:"#f4f4f5",mutedForeground:"#737373",accent:"#f4f4f5",accentForeground:"#0a0a0a",destructive:"#ef4444",destructiveForeground:"#fafafa",border:"#e4e4e7",input:"#e4e4e7",ring:"#0a0a0a"}}),[x,v]=O.useState(!1),[k,N]=O.useState(null),[D,P]=O.useState(null),[R,A]=O.useState(""),[S,M]=O.useState(!1),[E,T]=O.useState("auto"),K=O.useCallback($=>{const _=document.documentElement;if(Object.entries($.colors).forEach(([F,H])=>{const J=`--${F.replace(/([A-Z])/g,"-$1").toLowerCase()}`;_.style.setProperty(J,H)}),g){const F={id:$.name.toLowerCase().replace(/\s+/g,"-"),label:$.name,description:$.description||"",previewColor:$.colors.primary};g(F.id)}},[g]),q=async $=>{v(!0),N(null),P(null);try{const _=await fetch($);if(!_.ok)throw new Error(`Erreur HTTP: ${_.status}`);const F=await _.json();if(!F.name||!F.colors)throw new Error("Format de thème invalide");const H={name:F.name,description:F.description||"",author:F.author||"",version:F.version||"1.0.0",colors:{background:F.colors.background||"#ffffff",foreground:F.colors.foreground||"#0a0a0a",card:F.colors.card||"#ffffff",cardForeground:F.colors.cardForeground||"#0a0a0a",popover:F.colors.popover||"#ffffff",popoverForeground:F.colors.popoverForeground||"#0a0a0a",primary:F.colors.primary||"#0a0a0a",primaryForeground:F.colors.primaryForeground||"#fafafa",secondary:F.colors.secondary||"#f4f4f5",secondaryForeground:F.colors.secondaryForeground||"#0a0a0a",muted:F.colors.muted||"#f4f4f5",mutedForeground:F.colors.mutedForeground||"#737373",accent:F.colors.accent||"#f4f4f5",accentForeground:F.colors.accentForeground||"#0a0a0a",destructive:F.colors.destructive||"#ef4444",destructiveForeground:F.colors.destructiveForeground||"#fafafa",border:F.colors.border||"#e4e4e7",input:F.colors.input||"#e4e4e7",ring:F.colors.ring||"#0a0a0a",chart1:F.colors.chart1,chart2:F.colors.chart2,chart3:F.colors.chart3,chart4:F.colors.chart4,chart5:F.colors.chart5}};j(H),K(H),r?.(H),P("Thème chargé avec succès !")}catch(_){N(_ instanceof Error?_.message:"Erreur lors du chargement du thème")}finally{v(!1)}},B=()=>{const $=JSON.stringify(y,null,2),_=new Blob([$],{type:"application/json"}),F=URL.createObjectURL(_),H=document.createElement("a");H.href=F,H.download=`${y.name.toLowerCase().replace(/\s+/g,"-")}-theme.json`,document.body.appendChild(H),H.click(),document.body.removeChild(H),URL.revokeObjectURL(F)},W=async()=>{try{await navigator.clipboard.writeText(JSON.stringify(y,null,2)),M(!0),setTimeout(()=>M(!1),2e3)}catch{N("Impossible de copier le thème")}},I=($,_)=>{const F={...y,colors:{...y.colors,[$]:_}};j(F),K(F),a?.(F)},z=()=>{n?.(y),P("Thème sauvegardé !")};return O.useEffect(()=>{K(y)},[y,K]),O.useEffect(()=>{const $=document.documentElement;E==="dark"?$.classList.add("dark"):E==="light"?$.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?$.classList.add("dark"):$.classList.remove("dark")},[E]),e.jsx("div",{ref:m,className:b(Ul({size:s}),t),...f,children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Gestionnaire de Thèmes TweakCN"}),e.jsx("p",{className:"text-muted-foreground",children:"Créez, importez et prévisualisez vos thèmes personnalisés"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(Se,{variant:"outline",className:"flex items-center gap-1",children:[e.jsx(h.Palette,{className:"h-3 w-3"}),y.name]})})]}),k&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-lg text-destructive",children:[e.jsx(h.AlertCircle,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:k})]}),D&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-green-500/10 border border-green-500/20 rounded-lg text-green-600",children:[e.jsx(h.CheckCircle,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:D})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs(ke,{children:[e.jsx(qe,{children:e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Settings,{className:"h-5 w-5"}),"Informations du thème"]})}),e.jsxs(Te,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(me,{htmlFor:"theme-name",children:"Nom"}),e.jsx(oe,{id:"theme-name",value:y.name,onChange:$=>j({...y,name:$.target.value}),placeholder:"Mon thème"})]}),e.jsxs("div",{children:[e.jsx(me,{htmlFor:"theme-author",children:"Auteur"}),e.jsx(oe,{id:"theme-author",value:y.author||"",onChange:$=>j({...y,author:$.target.value}),placeholder:"Votre nom"})]})]}),e.jsxs("div",{children:[e.jsx(me,{htmlFor:"theme-description",children:"Description"}),e.jsx(ft,{id:"theme-description",value:y.description||"",onChange:$=>j({...y,description:$.target.value}),placeholder:"Description du thème...",rows:3})]})]})]}),(u||l)&&e.jsxs(ke,{children:[e.jsx(qe,{children:e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Upload,{className:"h-5 w-5"}),"Import / Export"]})}),e.jsxs(Te,{className:"space-y-4",children:[u&&e.jsxs("div",{children:[e.jsx(me,{htmlFor:"import-url",children:"URL du thème JSON"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{id:"import-url",value:R,onChange:$=>A($.target.value),placeholder:"https://example.com/theme.json",className:"flex-1"}),e.jsx(L,{onClick:()=>q(R),disabled:!R||x,size:"sm",children:x?e.jsx(h.RefreshCw,{className:"h-4 w-4 animate-spin"}):e.jsx(h.Download,{className:"h-4 w-4"})})]})]}),l&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(L,{onClick:B,variant:"outline",className:"flex-1",children:[e.jsx(h.Download,{className:"h-4 w-4 mr-2"}),"Exporter JSON"]}),e.jsx(L,{onClick:W,variant:"outline",children:S?e.jsx(h.Check,{className:"h-4 w-4"}):e.jsx(h.Copy,{className:"h-4 w-4"})})]})]})]}),i&&e.jsxs(ke,{children:[e.jsx(qe,{children:e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Eye,{className:"h-5 w-5"}),"Prévisualisation"]})}),e.jsx(Te,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(L,{variant:E==="light"?"default":"outline",size:"sm",onClick:()=>T("light"),children:[e.jsx(h.Sun,{className:"h-4 w-4 mr-2"}),"Clair"]}),e.jsxs(L,{variant:E==="dark"?"default":"outline",size:"sm",onClick:()=>T("dark"),children:[e.jsx(h.Moon,{className:"h-4 w-4 mr-2"}),"Sombre"]}),e.jsxs(L,{variant:E==="auto"?"default":"outline",size:"sm",onClick:()=>T("auto"),children:[e.jsx(h.Monitor,{className:"h-4 w-4 mr-2"}),"Auto"]})]}),w&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Thème actuel:"}),e.jsx("span",{className:"font-medium",children:w})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Mode sombre:"}),e.jsx("span",{className:"font-medium",children:"Géré par le système"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Thèmes disponibles:"}),e.jsx("span",{className:"font-medium",children:C.length})]})]})]})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(L,{onClick:z,className:"flex-1",children:"Sauvegarder le thème"}),e.jsxs(L,{variant:"outline",onClick:()=>window.open("https://tweakcn.com","_blank"),children:[e.jsx(h.ExternalLink,{className:"h-4 w-4 mr-2"}),"TweakCN"]})]})]}),d&&e.jsx("div",{className:"space-y-6",children:e.jsxs(ke,{children:[e.jsxs(qe,{children:[e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Palette,{className:"h-5 w-5"}),"Couleurs du thème"]}),e.jsx(ot,{children:"Cliquez sur une couleur pour la modifier"})]}),e.jsx(Te,{children:e.jsx("div",{className:"grid grid-cols-2 gap-4",children:Object.entries(y.colors).map(([$,_])=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:`color-${$}`,className:"text-sm font-medium",children:$.replace(/([A-Z])/g," $1").replace(/^./,F=>F.toUpperCase())}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"w-10 h-10 rounded border border-border cursor-pointer",style:{backgroundColor:_},onClick:()=>{document.getElementById(`color-${$}`)?.click()}}),e.jsx(oe,{id:`color-${$}`,type:"color",value:_,onChange:F=>I($,F.target.value),className:"flex-1 h-10"})]})]},$))})})]})})]}),i&&e.jsxs(ke,{children:[e.jsx(qe,{children:e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Eye,{className:"h-5 w-5"}),"Prévisualisation en temps réel"]})}),e.jsx(Te,{children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Boutons"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(L,{size:"sm",children:"Primary"}),e.jsx(L,{variant:"secondary",size:"sm",children:"Secondary"}),e.jsx(L,{variant:"outline",size:"sm",children:"Outline"}),e.jsx(L,{variant:"destructive",size:"sm",children:"Destructive"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Cards"}),e.jsxs(ke,{className:"p-3",children:[e.jsx(Oe,{className:"text-sm",children:"Exemple de carte"}),e.jsx(ot,{className:"text-xs",children:"Contenu de la carte avec le nouveau thème"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Inputs"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{placeholder:"Input normal"}),e.jsx(oe,{placeholder:"Input avec erreur",className:"border-destructive"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Badges"}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.jsx(Se,{children:"Default"}),e.jsx(Se,{variant:"secondary",children:"Secondary"}),e.jsx(Se,{variant:"destructive",children:"Destructive"}),e.jsx(Se,{variant:"outline",children:"Outline"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Séparateur"}),e.jsx(kt,{}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Texte avec couleur muted"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Progress"}),e.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:e.jsx("div",{className:"bg-primary h-2 rounded-full",style:{width:"60%"}})})]})]})})]})]})})});Bl.displayName="WakaThemeManager";function ya(t){const s=t.split(":");return{hours:parseInt(s[0]||"0",10),minutes:parseInt(s[1]||"0",10),seconds:parseInt(s[2]||"0",10)}}function ro(t,s,a,r){const n=t.toString().padStart(2,"0"),o=s.toString().padStart(2,"0"),i=a.toString().padStart(2,"0");return r?`${n}:${o}:${i}`:`${n}:${o}`}function Hg(t){const s=t>=12?"PM":"AM";let a=t%12;return a===0&&(a=12),{display:a,period:s}}function no(t,s){return s==="AM"?t===12?0:t:t===12?12:t+12}function Gg(t,s,a,r,n){const o=t*3600+s*60+a;if(r){const i=ya(r),l=i.hours*3600+i.minutes*60+i.seconds;if(o<l)return!1}if(n){const i=ya(n),l=i.hours*3600+i.minutes*60+i.seconds;if(o>l)return!1}return!0}function Qa({value:t,onChange:s,max:a,step:r=1,disabled:n,label:o}){const i=c.useMemo(()=>{const d=[];for(let f=0;f<a;f+=r)d.push(f);return d},[a,r]),l=()=>{const f=(i.indexOf(t)+1)%i.length;s(i[f])},u=()=>{const d=i.indexOf(t),f=d===0?i.length-1:d-1;s(i[f])};return e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("span",{className:"text-xs text-muted-foreground mb-1",children:o}),e.jsx(L,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-8",onClick:l,disabled:n,tabIndex:-1,children:e.jsx(h.ChevronUp,{className:"h-4 w-4"})}),e.jsx("div",{className:"h-10 w-12 flex items-center justify-center text-lg font-medium",children:t.toString().padStart(2,"0")}),e.jsx(L,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-8",onClick:u,disabled:n,tabIndex:-1,children:e.jsx(h.ChevronDown,{className:"h-4 w-4"})})]})}function Xg({value:t,onChange:s,disabled:a}){return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(L,{type:"button",variant:t==="AM"?"default":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>s("AM"),disabled:a,children:"AM"}),e.jsx(L,{type:"button",variant:t==="PM"?"default":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>s("PM"),disabled:a,children:"PM"})]})}function Kg({value:t,onChange:s,placeholder:a="Sélectionner une heure",format:r="24h",showSeconds:n=!1,minuteStep:o=1,secondStep:i=1,minTime:l,maxTime:u,disabled:d=!1,error:f=!1,size:m="md",className:p,id:w,name:C}){const[g,y]=c.useState(!1),[j,x]=c.useState(t||""),v=t?ya(t):{hours:0,minutes:0,seconds:0},[k,N]=c.useState(v.hours),[D,P]=c.useState(v.minutes),[R,A]=c.useState(v.seconds),[S,M]=c.useState(v.hours>=12?"PM":"AM");c.useEffect(()=>{if(t){const F=ya(t);N(F.hours),P(F.minutes),A(F.seconds),M(F.hours>=12?"PM":"AM"),x(t)}},[t]);const E=c.useMemo(()=>{if(!t)return"";if(r==="12h"){const{display:F,period:H}=Hg(k);return`${F.toString().padStart(2,"0")}:${D.toString().padStart(2,"0")}${n?`:${R.toString().padStart(2,"0")}`:""} ${H}`}return ro(k,D,R,n)},[t,k,D,R,r,n]),T=(F,H,J)=>{if(!Gg(F,H,J,l,u))return;N(F),P(H),A(J);const Q=ro(F,H,J,n);s?.(Q)},K=F=>{const H=r==="12h"?no(F,S):F;T(H,D,R)},q=F=>{T(k,F,R)},B=F=>{T(k,D,F)},W=F=>{M(F);const H=k%12||12,J=no(H,F);T(J,D,R)},I=F=>{const H=F.target.value;x(H);const J=n?/^(\d{1,2}):(\d{2}):(\d{2})$/:/^(\d{1,2}):(\d{2})$/,Q=H.match(J);if(Q){const ne=parseInt(Q[1],10),X=parseInt(Q[2],10),Y=n?parseInt(Q[3],10):0;ne>=0&&ne<24&&X>=0&&X<60&&Y>=0&&Y<60&&T(ne,X,Y)}},z={sm:"h-8 text-xs",md:"h-9 text-sm",lg:"h-10 text-base"},$={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},_=r==="12h"?k%12||12:k;return e.jsxs(rt,{open:g,onOpenChange:y,children:[e.jsx(nt,{asChild:!0,children:e.jsxs("div",{className:b("relative",p),children:[e.jsx(oe,{id:w,name:C,value:E,onChange:I,placeholder:a,disabled:d,className:b(z[m],"pr-10",f&&"border-destructive focus-visible:ring-destructive")}),e.jsx(L,{type:"button",variant:"ghost",size:"icon",className:b("absolute right-0 top-0 h-full px-2",d&&"pointer-events-none opacity-50"),onClick:()=>!d&&y(!g),tabIndex:-1,children:e.jsx(h.Clock,{className:$[m]})})]})}),e.jsxs(st,{className:"w-auto p-4",align:"start",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Qa,{value:_,onChange:K,max:r==="12h"?13:24,disabled:d,label:"Heures"}),e.jsx("span",{className:"text-xl font-medium",children:":"}),e.jsx(Qa,{value:D,onChange:q,max:60,step:o,disabled:d,label:"Minutes"}),n&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xl font-medium",children:":"}),e.jsx(Qa,{value:R,onChange:B,max:60,step:i,disabled:d,label:"Secondes"})]}),r==="12h"&&e.jsx("div",{className:"ml-2",children:e.jsx(Xg,{value:S,onChange:W,disabled:d})})]}),e.jsxs("div",{className:"flex gap-2 mt-4 pt-4 border-t",children:[e.jsx(L,{type:"button",variant:"outline",size:"sm",onClick:()=>{const F=new Date;T(F.getHours(),F.getMinutes(),F.getSeconds())},disabled:d,children:"Maintenant"}),e.jsx(L,{type:"button",variant:"outline",size:"sm",onClick:()=>T(0,0,0),disabled:d,children:"00:00"}),e.jsx(L,{type:"button",variant:"outline",size:"sm",onClick:()=>T(12,0,0),disabled:d,children:"12:00"})]})]})]})}function Yg(t={}){const{initialValue:s="",format:a="24h",showSeconds:r=!1}=t,[n,o]=c.useState(s);return{value:n,onChange:o,clear:()=>o(""),setNow:()=>{const u=new Date,d=u.getHours().toString().padStart(2,"0"),f=u.getMinutes().toString().padStart(2,"0"),m=u.getSeconds().toString().padStart(2,"0");o(r?`${d}:${f}:${m}`:`${d}:${f}`)},format:a,showSeconds:r}}const ql={completed:{icon:h.Check,color:"text-green-600",bgColor:"bg-green-100"},current:{icon:h.Circle,color:"text-primary",bgColor:"bg-primary/10"},pending:{icon:h.Clock,color:"text-muted-foreground",bgColor:"bg-muted"},error:{icon:h.AlertCircle,color:"text-destructive",bgColor:"bg-destructive/10"}};function oo({status:t,icon:s,color:a,size:r}){const n=ql[t],o=n.icon,i={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10"},l={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"};return e.jsx("div",{className:b("rounded-full flex items-center justify-center flex-shrink-0 border-2 border-background shadow-sm",i[r],a?"":n.bgColor),style:a?{backgroundColor:a+"20"}:void 0,children:s||e.jsx(o,{className:b(l[r],a?"":n.color),style:a?{color:a}:void 0})})}function io({item:t,isLast:s,size:a,showDate:r,dateFormat:n,collapsible:o,onItemClick:i,orientation:l,position:u}){const[d,f]=c.useState(!1),m=t.status||"pending",p={sm:{title:"text-sm",desc:"text-xs",date:"text-[10px]"},md:{title:"text-base",desc:"text-sm",date:"text-xs"},lg:{title:"text-lg",desc:"text-base",date:"text-sm"}},w=y=>(typeof y=="string"?new Date(y):y).toLocaleDateString("fr-FR",n||{day:"numeric",month:"short",year:"numeric"}),C=()=>{o&&t.content&&f(!d),i?.(t)};if(l==="horizontal")return e.jsxs("div",{className:"flex flex-col items-center flex-1 min-w-[120px]",children:[r&&t.date&&e.jsx("div",{className:b("mb-2 text-muted-foreground",p[a].date),children:w(t.date)}),e.jsxs("div",{className:"flex items-center w-full",children:[e.jsx("div",{className:b("flex-1 h-0.5",s?"":"bg-border"),style:m==="completed"?{backgroundColor:ql.completed.color.replace("text-","")}:void 0}),e.jsx(oo,{status:m,icon:t.icon,color:t.color,size:a}),e.jsx("div",{className:b("flex-1 h-0.5",s?"":"bg-border")})]}),e.jsxs("div",{className:b("mt-2 text-center",i&&"cursor-pointer hover:opacity-80"),onClick:C,children:[e.jsx("h4",{className:b("font-medium",p[a].title),children:t.title}),t.description&&e.jsx("p",{className:b("text-muted-foreground mt-0.5",p[a].desc),children:t.description})]})]});const g=u==="right";return e.jsxs("div",{className:b("flex gap-4",g&&"flex-row-reverse"),children:[u!=="left"&&r&&t.date&&e.jsx("div",{className:b("w-24 text-muted-foreground pt-1",p[a].date,g?"text-left":"text-right"),children:w(t.date)}),e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx(oo,{status:m,icon:t.icon,color:t.color,size:a}),!s&&e.jsx("div",{className:b("w-0.5 flex-1 min-h-[24px] mt-1",m==="completed"?"bg-green-500":"bg-border")})]}),e.jsxs("div",{className:b("flex-1 pb-8",g&&"text-right"),children:[u==="left"&&r&&t.date&&e.jsx("div",{className:b("text-muted-foreground mb-1",p[a].date),children:w(t.date)}),e.jsxs("div",{className:b("inline-block",(i||o&&t.content)&&"cursor-pointer hover:opacity-80"),onClick:C,children:[e.jsxs("h4",{className:b("font-medium",p[a].title),children:[t.title,o&&t.content&&e.jsx(L,{variant:"ghost",size:"icon",className:"h-5 w-5 ml-1",children:d?e.jsx(h.ChevronUp,{className:"h-3 w-3"}):e.jsx(h.ChevronDown,{className:"h-3 w-3"})})]}),t.description&&e.jsx("p",{className:b("text-muted-foreground mt-0.5",p[a].desc),children:t.description})]}),o&&t.content&&d&&e.jsx("div",{className:"mt-3 p-3 bg-muted/50 rounded-lg",children:t.content})]})]})}function Jg({items:t,orientation:s="vertical",linePosition:a="left",size:r="md",showDates:n=!0,dateFormat:o,collapsible:i=!1,alternate:l=!1,onItemClick:u,className:d}){return s==="horizontal"?e.jsx("div",{className:b("flex items-start overflow-x-auto",d),children:t.map((f,m)=>e.jsx(io,{item:f,isLast:m===t.length-1,size:r,showDate:n,dateFormat:o,collapsible:i,onItemClick:u,orientation:"horizontal",position:"left"},f.id))}):e.jsx("div",{className:b("flex flex-col",a==="center"&&"items-center",d),children:t.map((f,m)=>{let p="left";return a==="center"&&l?p=m%2===0?"left":"right":a==="right"&&(p="right"),e.jsx(io,{item:f,isLast:m===t.length-1,size:r,showDate:n,dateFormat:o,collapsible:i,onItemClick:u,orientation:"vertical",position:p},f.id)})})}const Hl=c.createContext(null);function Qg(){const t=c.useContext(Hl);if(!t)throw new Error("useTreeContext must be used within a WakaTree");return t}function Zg(t){const s=[];function a(r){for(const n of r)s.push(n.id),n.children&&a(n.children)}return a(t),s}function Gl({node:t,level:s}){const{selectedIds:a,selectionMode:r,showCheckboxes:n,showIcons:o,draggable:i,size:l,toggleSelect:u,toggleExpand:d,isSelected:f,isExpanded:m,onDragStart:p,onDragOver:w,onDragLeave:C,onDrop:g,dragOverId:y,dragPosition:j}=Qg(),x=t.children&&t.children.length>0,v=m(t.id),k=f(t.id),N={sm:"py-0.5 text-xs",md:"py-1 text-sm",lg:"py-1.5 text-base"},D={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},P=s*(l==="sm"?12:l==="md"?16:20),R=B=>{B.stopPropagation(),r!=="none"&&t.selectable!==!1&&!t.disabled&&u(t.id)},A=B=>{B.stopPropagation(),d(t.id)},S=B=>{i&&p(B,t.id)},M=B=>{i&&(B.preventDefault(),w(B,t.id))},E=B=>{i&&C(B)},T=B=>{if(!i)return;B.preventDefault();const W=B.currentTarget.getBoundingClientRect(),I=B.clientY-W.top,z=W.height;let $="inside";I<z*.25?$="before":I>z*.75&&($="after"),g(B,t.id,$)},K=()=>t.icon?t.icon:o?x?v?e.jsx(h.FolderOpen,{className:b(D[l],"text-amber-500")}):e.jsx(h.Folder,{className:b(D[l],"text-amber-500")}):e.jsx(h.File,{className:b(D[l],"text-muted-foreground")}):null,q=y===t.id;return e.jsxs("li",{role:"treeitem","aria-expanded":x?v:void 0,"aria-selected":k,children:[e.jsxs("div",{className:b("flex items-center gap-1 rounded-md cursor-pointer transition-colors group",N[l],k&&"bg-primary/10 text-primary",!k&&"hover:bg-muted",t.disabled&&"opacity-50 cursor-not-allowed",q&&j==="before"&&"border-t-2 border-primary",q&&j==="after"&&"border-b-2 border-primary",q&&j==="inside"&&"bg-primary/20"),style:{paddingLeft:P},onClick:R,draggable:i&&!t.disabled,onDragStart:S,onDragOver:M,onDragLeave:E,onDrop:T,children:[i&&e.jsx(h.GripVertical,{className:b(D[l],"text-muted-foreground opacity-0 group-hover:opacity-100 cursor-grab")}),e.jsx("button",{type:"button",onClick:A,className:b("flex items-center justify-center rounded hover:bg-muted-foreground/10",!x&&"invisible"),tabIndex:-1,children:v?e.jsx(h.ChevronDown,{className:D[l]}):e.jsx(h.ChevronRight,{className:D[l]})}),n&&r!=="none"&&e.jsx(Ze,{checked:k,onCheckedChange:()=>u(t.id),disabled:t.disabled||t.selectable===!1,className:l==="sm"?"h-3 w-3":l==="lg"?"h-5 w-5":"h-4 w-4"}),K(),e.jsx("span",{className:"truncate flex-1",children:t.label})]}),x&&v&&e.jsx("ul",{role:"group",className:"list-none",children:t.children.map(B=>e.jsx(Gl,{node:B,level:s+1},B.id))})]})}function eb({data:t,selectedIds:s,onSelect:a,expandedIds:r,onExpand:n,selectionMode:o="single",showCheckboxes:i=!1,showIcons:l=!0,draggable:u=!1,onDrop:d,size:f="md",className:m,defaultExpandAll:p=!1}){const[w,C]=c.useState([]),[g,y]=c.useState(()=>p?Zg(t):[]),[j,x]=c.useState(null),[v,k]=c.useState(null),[N,D]=c.useState(null),P=s??w,R=r??g,A=c.useCallback(I=>{let z;o==="single"?z=P.includes(I)?[]:[I]:z=P.includes(I)?P.filter($=>$!==I):[...P,I],a?a(z):C(z)},[P,o,a]),S=c.useCallback(I=>{const z=R.includes(I)?R.filter($=>$!==I):[...R,I];n?n(z):y(z)},[R,n]),M=c.useCallback(I=>P.includes(I),[P]),E=c.useCallback(I=>R.includes(I),[R]),T=c.useCallback((I,z)=>{x(z),I.dataTransfer.effectAllowed="move",I.dataTransfer.setData("text/plain",z)},[]),K=c.useCallback((I,z)=>{if(j===z)return;const $=I.currentTarget.getBoundingClientRect(),_=I.clientY-$.top,F=$.height;let H="inside";_<F*.25?H="before":_>F*.75&&(H="after"),k(z),D(H)},[j]),q=c.useCallback(()=>{k(null),D(null)},[]),B=c.useCallback((I,z,$)=>{I.preventDefault(),j&&j!==z&&d&&d(j,z,$),x(null),k(null),D(null)},[j,d]),W={selectedIds:P,expandedIds:R,selectionMode:o,showCheckboxes:i,showIcons:l,draggable:u,size:f,toggleSelect:A,toggleExpand:S,isSelected:M,isExpanded:E,onDragStart:T,onDragOver:K,onDragLeave:q,onDrop:B,dragOverId:v,dragPosition:N};return e.jsx(Hl.Provider,{value:W,children:e.jsx("ul",{role:"tree","aria-multiselectable":o==="multiple",className:b("list-none",m),children:t.map(I=>e.jsx(Gl,{node:I,level:0},I.id))})})}function ln(t,s){for(const a of t){if(a.id===s)return a;if(a.children){const r=ln(a.children,s);if(r)return r}}return null}function Xl(t,s,a){return t.map(r=>r.id===s?{...r,...a}:r.children?{...r,children:Xl(r.children,s,a)}:r)}function cn(t,s){return t.filter(a=>a.id!==s).map(a=>a.children?{...a,children:cn(a.children,s)}:a)}function dn(t,s,a){return t.map(r=>r.id===s?{...r,children:[...r.children||[],a]}:r.children?{...r,children:dn(r.children,s,a)}:r)}function tb(t,s,a,r){const n=ln(t,s);if(!n)return t;let o=cn(t,s);if(r==="inside")o=dn(o,a,n);else{const i=l=>{const u=[];for(const d of l)d.id===a?r==="before"?(u.push(n),u.push(d)):(u.push(d),u.push(n)):u.push({...d,children:d.children?i(d.children):void 0});return u};o=i(o)}return o}function lo(t){const s=Math.floor(t/3600),a=Math.floor(t%3600/60),r=Math.floor(t%60);return s>0?`${s}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function sb({src:t,poster:s,autoPlay:a=!1,loop:r=!1,muted:n=!1,controls:o=!0,preload:i="metadata",width:l,height:u,aspectRatio:d="16/9",showFullscreen:f=!0,showPlaybackSpeed:m=!0,showQualitySelector:p=!1,playbackSpeeds:w=[.5,.75,1,1.25,1.5,2],onReady:C,onPlay:g,onPause:y,onEnded:j,onTimeUpdate:x,onError:v,className:k}){const N=c.useRef(null),D=c.useRef(null),[P,R]=c.useState(a),[A,S]=c.useState(n),[M,E]=c.useState(1),[T,K]=c.useState(0),[q,B]=c.useState(0),[W,I]=c.useState(!1),[z,$]=c.useState(!0),[_,F]=c.useState(!0),[H,J]=c.useState(1),[Q,ne]=c.useState(""),X=c.useRef(),Y=c.useMemo(()=>typeof t=="string"?[{src:t,type:"video/mp4"}]:t,[t]);c.useEffect(()=>{Y.length>0&&Y[0].quality&&ne(Y[0].quality)},[Y]);const U=()=>{const G=N.current;G&&(B(G.duration),$(!1),C?.())},ae=()=>{const G=N.current;G&&(K(G.currentTime),x?.(G.currentTime))},te=()=>{R(!0),g?.()},Z=()=>{R(!1),y?.()},le=()=>{R(!1),j?.()},xe=()=>{$(!1),v?.(new Error("Video failed to load"))},se=()=>{$(!0)},de=()=>{$(!1)},De=()=>{const G=N.current;G&&(P?G.pause():G.play())},Ne=()=>{const G=N.current;G&&(G.muted=!A,S(!A))},Ke=G=>{const ee=N.current;if(!ee)return;const re=G[0];ee.volume=re,E(re),S(re===0)},xt=G=>{const ee=N.current;ee&&(ee.currentTime=G[0],K(G[0]))},Ye=G=>{const ee=N.current;ee&&(ee.currentTime=Math.max(0,Math.min(q,ee.currentTime+G)))},et=G=>{const ee=N.current;ee&&(ee.playbackRate=G,J(G))},gt=G=>{const ee=N.current;if(!ee)return;const re=ee.currentTime;ee.src=G.src,ee.currentTime=re,ne(G.quality||""),P&&ee.play()},Et=async()=>{const G=D.current;if(G)try{document.fullscreenElement?(await document.exitFullscreen(),I(!1)):(await G.requestFullscreen(),I(!0))}catch(ee){console.error("Fullscreen error:",ee)}},Je=()=>{F(!0),X.current&&clearTimeout(X.current),P&&(X.current=setTimeout(()=>{F(!1)},3e3))};return c.useEffect(()=>()=>{X.current&&clearTimeout(X.current)},[]),c.useEffect(()=>{const G=()=>{I(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",G),()=>{document.removeEventListener("fullscreenchange",G)}},[]),e.jsxs("div",{ref:D,className:b("relative bg-black overflow-hidden group",k),style:{width:l,height:u,aspectRatio:u?void 0:d},onMouseMove:Je,onMouseLeave:()=>P&&F(!1),children:[e.jsx("video",{ref:N,className:"w-full h-full",poster:s,autoPlay:a,loop:r,muted:n,preload:i,playsInline:!0,onLoadedMetadata:U,onTimeUpdate:ae,onPlay:te,onPause:Z,onEnded:le,onError:xe,onWaiting:se,onCanPlay:de,onClick:De,children:Y.map((G,ee)=>e.jsx("source",{src:G.src,type:G.type},ee))}),z&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:e.jsx(h.Loader2,{className:"h-10 w-10 text-white animate-spin"})}),!P&&!z&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30",children:e.jsx(L,{variant:"ghost",size:"icon",className:"h-16 w-16 rounded-full bg-white/90 hover:bg-white text-black",onClick:De,children:e.jsx(h.Play,{className:"h-8 w-8 ml-1"})})}),o&&e.jsxs("div",{className:b("absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent p-4 transition-opacity duration-300",_||!P?"opacity-100":"opacity-0"),children:[e.jsx(va,{value:[T],max:q||100,step:.1,onValueChange:xt,className:"mb-3"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white hover:bg-white/20",onClick:De,children:P?e.jsx(h.Pause,{className:"h-5 w-5"}):e.jsx(h.Play,{className:"h-5 w-5"})}),e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white hover:bg-white/20",onClick:()=>Ye(-10),children:e.jsx(h.SkipBack,{className:"h-4 w-4"})}),e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white hover:bg-white/20",onClick:()=>Ye(10),children:e.jsx(h.SkipForward,{className:"h-4 w-4"})}),e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white hover:bg-white/20",onClick:Ne,children:A||M===0?e.jsx(h.VolumeX,{className:"h-5 w-5"}):e.jsx(h.Volume2,{className:"h-5 w-5"})}),e.jsx(va,{value:[A?0:M],max:1,step:.1,onValueChange:Ke,className:"w-20"}),e.jsxs("span",{className:"text-white text-sm ml-2",children:[lo(T)," / ",lo(q)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[(m||p)&&e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white hover:bg-white/20",children:e.jsx(h.Settings,{className:"h-5 w-5"})})}),e.jsxs(_e,{align:"end",children:[m&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:"Vitesse"}),w.map(G=>e.jsxs(pe,{onClick:()=>et(G),className:b(H===G&&"bg-muted"),children:[G,"x"]},G))]}),p&&Y.some(G=>G.quality)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-2 py-1 text-xs text-muted-foreground mt-2",children:"Qualité"}),Y.filter(G=>G.quality).map((G,ee)=>e.jsx(pe,{onClick:()=>gt(G),className:b(Q===G.quality&&"bg-muted"),children:G.quality},ee))]})]})]}),f&&e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white hover:bg-white/20",onClick:Et,children:W?e.jsx(h.Minimize,{className:"h-5 w-5"}):e.jsx(h.Maximize,{className:"h-5 w-5"})})]})]})]})]})}function ab(t={}){const[s,a]=c.useState(t.autoPlay??!1),[r,n]=c.useState(t.muted??!1),[o,i]=c.useState(0),[l,u]=c.useState(0);return{isPlaying:s,isMuted:r,currentTime:o,duration:l,onPlay:()=>a(!0),onPause:()=>a(!1),onTimeUpdate:i,onReady:()=>{}}}function rb(t,s,a,r,n){return c.useMemo(()=>{const o=typeof s=="number";let i=0;const l=[];for(let m=0;m<t.length;m++){l.push(i);const p=o?s:s(t[m],m);i+=p}let u=0,d=t.length-1;if(o)u=Math.floor(r/s),d=Math.min(t.length-1,Math.ceil((r+a)/s));else{let m=0,p=t.length-1;for(;m<=p;){const w=Math.floor((m+p)/2);l[w]<r?m=w+1:p=w-1}u=Math.max(0,p);for(let w=u;w<t.length;w++){const C=l[w],g=o?s:s(t[w],w);if(C+g>r+a){d=w;break}}}u=Math.max(0,u-n),d=Math.min(t.length-1,d+n);const f=[];for(let m=u;m<=d;m++){const p=o?s:s(t[m],m);f.push({item:t[m],index:m,style:{position:"absolute",top:l[m],left:0,right:0,height:p}})}return{totalHeight:i,visibleItems:f,startIndex:u,endIndex:d}},[t,s,a,r,n])}function nb({items:t,itemHeight:s,height:a,width:r="100%",overscan:n=3,renderItem:o,onScroll:i,onEndReached:l,endReachedThreshold:u=200,isLoading:d=!1,loadingElement:f,emptyElement:m,className:p,innerClassName:w,scrollRef:C}){const g=c.useRef(null),y=C||g,[j,x]=c.useState(0),v=c.useRef(!1),{totalHeight:k,visibleItems:N}=rb(t,s,a,j,n),D=R=>{const A=R.currentTarget,S=A.scrollTop;if(x(S),i?.(S),l){const M=A.scrollHeight-A.scrollTop-A.clientHeight;M<u&&!v.current?(v.current=!0,l()):M>=u&&(v.current=!1)}},P=c.useCallback(R=>{y.current&&(y.current.scrollTop=R)},[y]);return c.useCallback((R,A="start")=>{const S=typeof s=="number";let M=0;if(S)M=R*s;else for(let T=0;T<R&&T<t.length;T++)M+=s(t[T],T);const E=S?s:s(t[R],R);A==="center"?M-=(a-E)/2:A==="end"&&(M-=a-E),P(Math.max(0,M))},[t,s,a,P]),t.length===0&&!d?e.jsx("div",{className:b("flex items-center justify-center text-muted-foreground",p),style:{height:a,width:r},children:m||"Aucun élément"}):e.jsx("div",{ref:y,className:b("overflow-auto",p),style:{height:a,width:r},onScroll:D,children:e.jsxs("div",{className:b("relative",w),style:{height:k+(d?50:0)},children:[N.map(({item:R,index:A,style:S})=>e.jsx(c.Fragment,{children:o(R,A,S)},A)),d&&e.jsx("div",{className:"absolute left-0 right-0 flex items-center justify-center py-4",style:{top:k},children:f||e.jsx("div",{className:"text-muted-foreground text-sm",children:"Chargement..."})})]})})}function ob(t){const{itemCount:s,itemHeight:a,containerHeight:r,overscan:n=3}=t,[o,i]=c.useState(0),l=s*a,u=Math.max(0,Math.floor(o/a)-n),d=Math.min(s-1,Math.ceil((o+r)/a)+n),f=c.useMemo(()=>{const w=[];for(let C=u;C<=d;C++)w.push({index:C,start:C*a,size:a});return w},[u,d,a]);return{totalHeight:l,virtualItems:f,startIndex:u,endIndex:d,handleScroll:w=>{i(w.currentTarget.scrollTop)},scrollToIndex:w=>{i(w*a)},scrollTop:o}}const Kl=c.createContext(void 0);function Yl({children:t,languages:s,defaultLanguage:a="fr",s3Config:r,onLanguageChange:n}){const{i18n:o}=wt.useTranslation(),[i,l]=c.useState(a),[u,d]=c.useState(!0),[f,m]=c.useState(new Set),[p,w]=c.useState(!1),C=c.useCallback(async j=>{if(!r)throw new Error("S3 configuration not provided");const{baseUrl:x,prefix:v="",extension:k="json",headers:N={}}=r,D=`${x.replace(/\/$/,"")}/${v}${j}.${k}`;console.log(`[LanguageProvider] Loading translations from S3: ${D}`);try{const P=await fetch(D,{headers:{Accept:"application/json",...N}});if(!P.ok)throw new Error(`Failed to load translations: ${P.status} ${P.statusText}`);const R=await P.json();return console.log(`[LanguageProvider] ✓ Translations loaded for ${j}`),R}catch(P){throw console.error(`[LanguageProvider] ✗ Error loading translations for ${j}:`,P),P}},[r]);c.useEffect(()=>{if(p||!o||!r)return;(async()=>{try{const x=typeof window<"u"?localStorage.getItem("language"):null,v=x&&s.some(N=>N.code===x)?x:a;console.log(`[LanguageProvider] Initializing with language: ${v}`);const k=await C(v);o.addResourceBundle&&o.addResourceBundle(v,"translation",k,!0,!0),await o.changeLanguage(v),l(v),m(new Set([v])),w(!0),console.log(`[LanguageProvider] ✓ Initialized with ${v}`)}catch(x){console.error("[LanguageProvider] Error initializing:",x),w(!0)}finally{d(!1)}})()},[p,o,r,a,s,C]);const g=c.useCallback(async j=>{if(j!==i){if(!o?.changeLanguage){console.error("[LanguageProvider] i18next is not initialized");return}if(!r){console.error("[LanguageProvider] S3 config not provided");return}d(!0);try{if(!f.has(j)){console.log(`[LanguageProvider] Loading ${j} from S3...`);const x=await C(j);o.addResourceBundle&&o.addResourceBundle(j,"translation",x,!0,!0),m(v=>new Set([...v,j]))}await o.changeLanguage(j),l(j),typeof window<"u"&&localStorage.setItem("language",j),n?.(j),console.log(`[LanguageProvider] ✓ Language changed to: ${j}`)}catch(x){throw console.error("[LanguageProvider] ✗ Error changing language:",x),x}finally{d(!1)}}},[i,f,r,C,o,n]),y={currentLanguage:i,languages:s,changeLanguage:g,isLoading:u,loadedLanguages:f};return e.jsx(Kl.Provider,{value:y,children:t})}function un(){const t=c.useContext(Kl);if(!t)throw new Error("useLanguage must be used within a LanguageProvider");return t}const Jl=c.createContext(void 0);function ib({children:t,config:s}){const{defaultTheme:a="light",storageKey:r="waka-ui-theme",themes:n,enableSystem:o=!0,s3Config:i}=s||{},[l,u]=c.useState(a),[d,f]=c.useState(),[m,p]=c.useState([]),[w,C]=c.useState(!0),[g,y]=c.useState("fallback");c.useEffect(()=>{(async()=>{if(C(!0),n&&n.length>0){const N=lb(n);p(N),y("config"),C(!1),console.log("[ThemeProvider] Using themes from config:",N.length);return}if(i?.baseUrl)try{const N=await cb(i.baseUrl);if(N.length>0){p(N),y("s3"),C(!1),console.log("[ThemeProvider] Loaded themes from S3:",N.length);return}}catch(N){console.error("[ThemeProvider] Failed to load themes from S3:",N)}p([{id:"light",label:"Clair",previewColor:"#3b82f6"},{id:"dark",label:"Sombre",previewColor:"#1e293b"}]),y("fallback"),C(!1),console.log("[ThemeProvider] Using fallback themes")})()},[n,i]),c.useEffect(()=>{if(!o)return;const v=window.matchMedia("(prefers-color-scheme: dark)"),k=N=>{f(N.matches?"dark":"light")};return f(v.matches?"dark":"light"),v.addEventListener("change",k),()=>v.removeEventListener("change",k)},[o]),c.useEffect(()=>{if(m.length===0)return;const v=localStorage.getItem(r),k=m.map(N=>N.id);v&&k.includes(v)&&u(v)},[r,m]),c.useEffect(()=>{if(m.length===0)return;const v=document.documentElement,k=l==="system"&&d?d:l;m.forEach(N=>v.classList.remove(N.id)),v.classList.add(k),v.setAttribute("data-theme",k),process.env.NODE_ENV==="development"&&console.log(`[WakaUI] Theme applied: ${k}`)},[l,d,m]);const j=c.useCallback(v=>{const k=m.map(N=>N.id);if(!k.includes(v)&&v!=="system"){console.warn(`[WakaUI] Theme "${v}" is not in the list of available themes:`,k);return}u(v),localStorage.setItem(r,v)},[m,r]),x=c.useMemo(()=>({theme:l,setTheme:j,themes:m,systemTheme:d,isLoadingThemes:w,themesSource:g}),[l,j,m,d,w,g]);return e.jsx(Jl.Provider,{value:x,children:t})}function lb(t){return t.length===0?[]:typeof t[0]=="string"?t.map(s=>({id:s,label:db(s),previewColor:ub(s)})):t}async function cb(t){try{const s=await fetch("/api/themes/list",{cache:"no-store"});if(!s.ok)throw new Error(`HTTP ${s.status}`);return(await s.json()).themes||[]}catch(s){return console.error("[ThemeProvider] Failed to fetch themes from S3:",s),[]}}function db(t){return t.split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function ub(t){return{light:"#3b82f6",dark:"#1e293b",forest:"#10b981",sunset:"#f59e0b",twilight:"#8b5cf6",monochrome:"#6b7280",perpetuity:"#ec4899"}[t]||"#3b82f6"}function mb(){const t=c.useContext(Jl);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}function hb({children:t,config:s}){const[a]=c.useState(()=>$t.createInstance()),[r,n]=c.useState(!1);return c.useEffect(()=>{(async()=>{try{await a.use(wt.initReactI18next).init({lng:s.language.defaultLanguage,fallbackLng:s.language.defaultLanguage,supportedLngs:s.language.supportedLanguages,resources:s.language.resources||{},interpolation:{escapeValue:!1},react:{useSuspense:!1},debug:s.debug}),s.language.s3Config&&await fb(a,s.language.s3Config,s.language.supportedLanguages),n(!0),s.debug&&console.log("[WakaUI] i18n initialized successfully")}catch(i){console.error("[WakaUI] Failed to initialize i18n:",i),n(!0)}})()},[a,s]),c.useEffect(()=>{if(!r)return;const o=s.language.storageKey||"waka-ui-language",i=localStorage.getItem(o);i&&s.language.supportedLanguages.includes(i)&&a.changeLanguage(i);const l=u=>{localStorage.setItem(o,u),s.debug&&console.log(`[WakaUI] Language changed to: ${u}`)};return a.on("languageChanged",l),()=>{a.off("languageChanged",l)}},[r,a,s]),r?e.jsx(wt.I18nextProvider,{i18n:a,children:e.jsx(Yl,{languages:s.language.languages||[],defaultLanguage:s.language.defaultLanguage,s3Config:s.language.s3Config?{baseUrl:s.language.s3Config.bucketUrl,prefix:s.language.s3Config.translationsPath?`${s.language.s3Config.translationsPath}/`:"",extension:"json"}:void 0,children:e.jsx(Ki,{themes:s.theme?.themes||[{id:"default",label:"Default"}],defaultTheme:s.theme?.defaultTheme||"default",s3Config:s.theme?.s3Config,enableDarkMode:s.theme?.enableSystem,children:t})})}):e.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading WakaUI..."})}async function fb(t,s,a){if(!s)return;const{bucketUrl:r,translationsPath:n="translations"}=s;try{await Promise.all(a.map(async o=>{try{const i=`${r}/${n}/${o}.json`,l=await fetch(i);if(!l.ok){console.warn(`[WakaUI] Failed to load translations for ${o} from S3`);return}const u=await l.json();t.addResourceBundle(o,"translation",u,!0,!0),process.env.NODE_ENV==="development"&&console.log(`[WakaUI] Loaded translations for ${o} from S3`)}catch(i){console.warn(`[WakaUI] Error loading translations for ${o}:`,i)}}))}catch(o){console.error("[WakaUI] Error loading translations from S3:",o)}}function pb(){const{i18n:t,t:s}=wt.useTranslation(),a=un(),r=na();return{currentLanguage:t.language||a.currentLanguage,changeLanguage:async n=>{await a.changeLanguage(n),await t.changeLanguage(n)},languages:a.languages,isLanguageLoading:a.isLoading,currentTheme:r.currentTheme,changeTheme:r.changeTheme,themes:r.themes,isThemeLoading:r.isLoading,preloadTheme:r.preloadTheme,isThemeLoaded:r.isThemeLoaded,t:s}}const mn=c.createContext(void 0);function xb({children:t,initialSelection:s,onSelectionChange:a,persistKey:r="admincrumb-selection"}){const[n,o]=c.useState(()=>{if(typeof window<"u"&&r){const w=localStorage.getItem(r);if(w)try{return JSON.parse(w)}catch(C){console.error("Failed to parse stored admincrumb selection",C)}}return s||{}});c.useEffect(()=>{typeof window<"u"&&r&&localStorage.setItem(r,JSON.stringify(n))},[n,r]),c.useEffect(()=>{a?.(n)},[n,a]);const i=c.useCallback(w=>{o({partner:w,network:void 0,customer:void 0})},[]),l=c.useCallback(w=>{o(C=>({...C,network:w,customer:void 0}))},[]),u=c.useCallback(w=>{o(C=>({...C,customer:w}))},[]),d=c.useCallback(()=>{o({})},[]),f=c.useMemo(()=>!!(n.partner||n.network||n.customer),[n]),m=c.useCallback(()=>({...n.partner?.id&&{partnerId:n.partner.id},...n.network?.id&&{networkId:n.network.id},...n.customer?.id&&{customerId:n.customer.id}}),[n]),p=c.useMemo(()=>({selection:n,setPartner:i,setNetwork:l,setCustomer:u,reset:d,isFiltered:f,getFilterQuery:m}),[n,i,l,u,d,f,m]);return e.jsx(mn.Provider,{value:p,children:t})}function gb(){const t=c.useContext(mn);if(!t)throw new Error("useAdmincrumbContext must be used within AdmincrumbProvider");return t}function bb(){return c.useContext(mn)}const jb={github:h.Github,twitter:h.Twitter,linkedin:h.Linkedin,email:h.Mail};function vb({columns:t=[],socialLinks:s=[],copyright:a="© 2024 Tous droits réservés.",className:r}){return e.jsx("footer",{className:b("bg-muted/40",r),children:e.jsxs("div",{className:"container mx-auto px-4 py-12",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-4",children:[t.map((n,o)=>e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:n.title}),e.jsx("ul",{className:"space-y-2",children:n.links.map((i,l)=>e.jsx("li",{children:e.jsx("a",{href:i.href,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:i.label})},l))})]},o)),s.length>0&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Suivez-nous"}),e.jsx("div",{className:"flex space-x-4",children:s.map((n,o)=>{const i=jb[n.platform];return e.jsx(L,{variant:"ghost",size:"icon",asChild:!0,className:"h-8 w-8",children:e.jsx("a",{href:n.url,target:"_blank",rel:"noopener noreferrer","aria-label":n.platform,children:e.jsx(i,{className:"h-4 w-4"})})},o)})})]})]}),e.jsx(kt,{className:"my-8"}),e.jsxs("div",{className:"flex flex-col items-center justify-between space-y-4 md:flex-row md:space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:a}),e.jsxs("div",{className:"flex space-x-6",children:[e.jsx("a",{href:"/privacy",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Politique de confidentialité"}),e.jsx("a",{href:"/terms",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Conditions d'utilisation"})]})]})]})})}function wb({items:t,defaultActiveId:s,variant:a="default",size:r="md",className:n,onTabChange:o}){const[i,l]=c.useState(s||t[0]?.id||""),u=m=>{l(m),o?.(m)},d={sm:"h-8 px-3 text-sm",md:"h-10 px-4 text-sm",lg:"h-12 px-6 text-base"},f={default:"bg-background",pills:"bg-muted rounded-full",underline:"bg-transparent border-b-2 border-transparent data-[state=active]:border-primary"};return e.jsx("div",{className:b("w-full",n),children:e.jsxs(ra,{value:i,onValueChange:u,children:[e.jsx(Ts,{className:b("grid w-full",a==="pills"&&"grid-cols-auto",a!=="pills"&&`grid-cols-${t.length}`,f[a]),children:t.map(m=>e.jsx(js,{value:m.id,disabled:m.disabled,className:b(d[r],a==="underline"&&"rounded-none border-b-2 border-transparent data-[state=active]:border-primary",a==="pills"&&"rounded-full"),children:m.label},m.id))}),t.map(m=>e.jsx(vs,{value:m.id,className:"mt-6",children:m.content},m.id))]})})}function yb({items:t,separator:s="/",className:a}){return e.jsx("nav",{className:b("flex items-center space-x-1 text-sm text-muted-foreground",a),children:t.map((r,n)=>e.jsxs(c.Fragment,{children:[n>0&&e.jsx("span",{className:"mx-2 text-muted-foreground",children:s}),r.href?e.jsx("a",{href:r.href,className:"hover:text-foreground transition-colors",children:r.label}):e.jsx("span",{className:"text-foreground font-medium",children:r.label})]},n))})}function Nb({variant:t="dropdown",showFlags:s=!0,className:a}){const{currentLanguage:r,languages:n,changeLanguage:o,isLoading:i}=un(),l=n.find(u=>u.code===r);return t==="select"?e.jsxs(Ve,{value:r,onValueChange:o,disabled:i,children:[e.jsx($e,{className:b("w-[180px]",a),children:e.jsxs(We,{children:[s&&l?.flagEmoji&&e.jsx("span",{className:"mr-2",children:l.flagEmoji}),l?.label]})}),e.jsx(Le,{children:n.map(u=>e.jsxs(je,{value:u.code,children:[s&&u.flagEmoji&&e.jsx("span",{className:"mr-2",children:u.flagEmoji}),u.label]},u.code))})]}):e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"sm",className:b("gap-2",a),disabled:i,children:[e.jsx(h.Globe,{className:"h-4 w-4"}),s&&l?.flagEmoji&&e.jsx("span",{children:l.flagEmoji}),l?.label]})}),e.jsx(_e,{align:"end",children:n.map(u=>e.jsxs(pe,{onClick:()=>o(u.code),className:"cursor-pointer",children:[s&&u.flagEmoji&&e.jsx("span",{className:"mr-2",children:u.flagEmoji}),u.label]},u.code))})]})}function Cb({children:t,header:s,sidebar:a,footer:r,collapsible:n=!1,className:o}){const[i,l]=c.useState(!1);return e.jsxs("div",{className:b("min-h-screen bg-background",o),children:[s&&e.jsx("header",{className:"sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsxs("div",{className:"container flex h-14 max-w-screen-2xl items-center",children:[n&&a&&e.jsxs(sa,{open:i,onOpenChange:l,children:[e.jsx(Ar,{asChild:!0,children:e.jsxs(L,{variant:"ghost",size:"icon",className:"md:hidden",children:[e.jsx(h.Menu,{className:"h-5 w-5"}),e.jsx("span",{className:"sr-only",children:"Ouvrir le menu"})]})}),e.jsx(Ds,{side:"left",className:"w-72 p-0",children:e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Navigation"}),e.jsx(L,{variant:"ghost",size:"icon",onClick:()=>l(!1),children:e.jsx(h.X,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:a})]})})]}),s]})}),e.jsxs("div",{className:"flex",children:[a&&!n&&e.jsx("aside",{className:"hidden w-64 border-r bg-muted/40 md:block",children:e.jsx("div",{className:"h-full overflow-y-auto p-4",children:a})}),e.jsx("main",{className:"flex-1",children:e.jsx("div",{className:"container mx-auto p-4",children:t})})]}),r&&e.jsx("footer",{className:"border-t bg-muted/40",children:e.jsx("div",{className:"container mx-auto p-4",children:r})})]})}function kb({config:t,onSubmit:s,onForgotPassword:a,onSignUp:r,onSSOGoogle:n,onSSOMicrosoft:o,onSSOApple:i,onSSOLinkedIn:l,onSSOGithub:u,onSSOFacebook:d,onSSOInstagram:f,onSSOFranceConnect:m,showSocialLogin:p=!1,className:w}){let C=!1;try{C=na().isDarkMode}catch{}const g=t?.theme_json?.dark_mode??C,[y,j]=c.useState({email:"",password:"",rememberMe:!1}),[x,v]=c.useState(!1),k=c.useMemo(()=>t?.assets?g?t.assets.theme_logo_dark:t.assets.theme_logo_light:null,[t?.assets,g]),N=c.useMemo(()=>t?.color_json?{"--login-primary":t.color_json.primary,"--login-secondary":t.color_json.secondary,"--login-accent":t.color_json.accent}:{},[t?.color_json]),D=c.useMemo(()=>{const S=[];if(!t?.signup_options)return p&&(u&&S.push({id:"github",label:"GitHub",icon:e.jsx(h.Github,{className:"h-4 w-4"}),onClick:u}),n&&S.push({id:"google",label:"Google",icon:e.jsx(h.Mail,{className:"h-4 w-4"}),onClick:n})),S;const M=t.signup_options;return M.allow_sso_google&&S.push({id:"google",label:"Google",icon:e.jsx(h.Mail,{className:"h-4 w-4"}),onClick:n}),M.allow_sso_microsoft&&S.push({id:"microsoft",label:"Microsoft",icon:e.jsx(h.Mail,{className:"h-4 w-4"}),onClick:o}),M.allow_sso_apple&&S.push({id:"apple",label:"Apple",icon:e.jsx(h.Apple,{className:"h-4 w-4"}),onClick:i}),M.allow_sso_linkedIn&&S.push({id:"linkedin",label:"LinkedIn",icon:e.jsx(h.Linkedin,{className:"h-4 w-4"}),onClick:l}),M.allow_sso_github&&S.push({id:"github",label:"GitHub",icon:e.jsx(h.Github,{className:"h-4 w-4"}),onClick:u}),M.allow_sso_facebook&&S.push({id:"facebook",label:"Facebook",icon:e.jsx(h.Facebook,{className:"h-4 w-4"}),onClick:d}),M.allow_sso_instagram&&S.push({id:"instagram",label:"Instagram",icon:e.jsx(h.Instagram,{className:"h-4 w-4"}),onClick:f}),M.allow_sso_france_connect&&S.push({id:"france-connect",label:"France Connect",icon:e.jsx(h.Mail,{className:"h-4 w-4"}),onClick:m}),S},[t?.signup_options,p,n,o,i,l,u,d,f,m]),P=t?.signup_options?.allow_login!==!1,R=async S=>{S.preventDefault(),v(!0);try{await s?.(y)}finally{v(!1)}},A=S=>M=>{j(E=>({...E,[S]:S==="rememberMe"?M.target.checked:M.target.value}))};return e.jsx("div",{className:b("flex items-center justify-center p-4",w),style:N,children:e.jsxs(ke,{className:"w-full max-w-md",children:[e.jsxs(qe,{className:"space-y-1",children:[k&&e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:k,alt:t?.theme_json?.name||"Logo",className:"max-h-16 max-w-full object-contain"})}),e.jsx(Oe,{className:"text-2xl text-center",children:"Connexion"}),e.jsx(ot,{className:"text-center",children:"Entrez vos identifiants pour accéder à votre compte"})]}),e.jsxs(Te,{className:"space-y-4",children:[D.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:b("grid gap-4",D.length===1?"grid-cols-1":"grid-cols-2"),children:D.map(S=>e.jsxs(L,{variant:"outline",className:"w-full",onClick:S.onClick,type:"button",children:[S.icon,S.label]},S.id))}),P&&e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx(kt,{className:"w-full"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Ou continuez avec"})})]})]}),P&&e.jsxs("form",{onSubmit:R,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"email",children:"Email"}),e.jsx(oe,{id:"email",type:"email",placeholder:"votre@email.com",value:y.email,onChange:A("email"),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"password",children:"Mot de passe"}),e.jsx(oe,{id:"password",type:"password",placeholder:"••••••••",value:y.password,onChange:A("password"),required:!0})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{id:"remember",type:"checkbox",checked:y.rememberMe,onChange:A("rememberMe"),className:"h-4 w-4 rounded border-gray-300"}),e.jsx(me,{htmlFor:"remember",className:"text-sm",children:"Se souvenir de moi"})]}),a&&e.jsx(L,{type:"button",variant:"link",className:"px-0 text-sm",onClick:a,children:"Mot de passe oublié ?"})]}),e.jsx(L,{type:"submit",className:"w-full",disabled:x,style:t?.color_json?.primary?{backgroundColor:t.color_json.primary,color:t.color_json.secondary}:void 0,children:x?"Connexion...":"Se connecter"})]}),r&&e.jsxs("div",{className:"text-center text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Pas encore de compte ? "}),e.jsx(L,{type:"button",variant:"link",className:"px-0 text-sm",onClick:r,children:"S'inscrire"})]}),t?.waka_powered&&e.jsx("div",{className:"text-center text-xs text-muted-foreground mt-4 pt-4 border-t",children:"Powered by Waka"})]})]})})}const Ql=c.createContext(null);function Sb(){const t=c.useContext(Ql);if(!t)throw new Error("Sidebar components must be used within WakaSidebar");return t}function Db({config:t}){const s=t.component?t.component:e.jsxs("div",{className:"flex items-center gap-3",children:[t.src&&e.jsx("img",{src:t.src,alt:t.alt||"Logo",className:"h-8 w-auto object-contain"}),t.title&&e.jsx("span",{className:"text-lg font-bold tracking-wide",children:t.title})]});return t.href?e.jsx("a",{href:t.href,className:"block",onClick:t.onClick,children:s}):t.onClick?e.jsx("button",{type:"button",onClick:t.onClick,className:"block text-left",children:s}):e.jsx("div",{children:s})}function Zl({item:t,isChild:s=!1,renderItem:a}){const{activeId:r,setActiveId:n,expandedIds:o,toggleExpanded:i,isMobile:l,closeOnNavigate:u,onClose:d}=Sb(),f=t.children&&t.children.length>0,m=o.includes(t.id),p=r===t.id||t.active,w=()=>{t.disabled||(f?i(t.id):(n(t.id),t.onClick?.(),l&&u&&d()))};if(a)return e.jsx(e.Fragment,{children:a(t,s)});const C=e.jsxs("div",{className:b("flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-all duration-200","hover:bg-white/10",p&&!f&&"bg-sidebar-active text-sidebar-active-foreground",s&&"ml-6 text-[13px]",t.disabled&&"opacity-50 cursor-not-allowed"),children:[t.icon&&e.jsx("span",{className:b("flex-shrink-0",s?"h-4 w-4":"h-5 w-5"),children:t.icon}),e.jsx("span",{className:"flex-1 truncate",children:t.label}),t.badge!==void 0&&e.jsx("span",{className:"ml-auto flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary px-1.5 text-[10px] font-semibold text-primary-foreground",children:t.badge}),f&&e.jsx(h.ChevronDown,{className:b("h-4 w-4 transition-transform duration-200",m&&"rotate-180")})]});return f?e.jsxs(Bo,{open:m,onOpenChange:()=>i(t.id),children:[e.jsx(qo,{asChild:!0,children:e.jsx("button",{type:"button",className:"w-full text-left",disabled:t.disabled,children:C})}),e.jsx(Ho,{className:"space-y-1 pt-1",children:t.children?.map(g=>e.jsx(Zl,{item:g,isChild:!0,renderItem:a},g.id))})]}):t.href?e.jsx("a",{href:t.href,onClick:g=>{if(t.disabled){g.preventDefault();return}w()},className:"block",children:C}):e.jsx("button",{type:"button",className:"w-full text-left",disabled:t.disabled,onClick:w,children:C})}function co({config:t}){const s=t.initials||t.name.split(" ").map(n=>n[0]).join("").slice(0,2).toUpperCase(),a=[{id:"profile",label:"Profil",icon:e.jsx(h.User,{className:"h-4 w-4"})},{id:"settings",label:"Paramètres",icon:e.jsx(h.Settings,{className:"h-4 w-4"})},{id:"logout",label:"Déconnexion",icon:e.jsx(h.LogOut,{className:"h-4 w-4"}),variant:"destructive"}],r=t.actions??a;return e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-lg p-2 text-left transition-colors hover:bg-white/10",children:[e.jsxs(yt,{className:"h-10 w-10 border-2 border-sidebar-active",children:[e.jsx(Nt,{src:t.avatarUrl,alt:t.name}),e.jsx(Ct,{className:"bg-sidebar-active text-sidebar-active-foreground text-sm font-medium",children:s})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:t.name}),t.email&&e.jsx("p",{className:"text-xs text-sidebar-foreground/70 truncate",children:t.email})]}),e.jsx(h.ChevronDown,{className:"h-4 w-4 flex-shrink-0 opacity-70"})]})}),e.jsx(_e,{align:"end",className:"w-56",children:r.map((n,o)=>e.jsxs(c.Fragment,{children:[n.variant==="destructive"&&o>0&&e.jsx(Qe,{}),e.jsx(pe,{onClick:n.onClick,className:b(n.variant==="destructive"&&"text-destructive focus:text-destructive"),asChild:!!n.href,children:n.href?e.jsxs("a",{href:n.href,className:"flex items-center gap-2",children:[n.icon,n.label]}):e.jsxs("span",{className:"flex items-center gap-2",children:[n.icon,n.label]})})]},n.id))})]})}function Tb({logo:t,menu:s,user:a,userPosition:r="bottom",header:n,footer:o,renderItem:i}){return e.jsxs("div",{className:"flex h-full flex-col",children:[t&&e.jsx("div",{className:"flex-shrink-0 p-4 pb-2",children:e.jsx(Db,{config:t})}),n&&e.jsx("div",{className:"flex-shrink-0 px-4 py-2",children:n}),a&&r==="top"&&e.jsx("div",{className:"flex-shrink-0 px-3 py-2 border-b border-white/10",children:e.jsx(co,{config:a})}),e.jsx(At,{className:"flex-1 px-3 py-4",children:e.jsx("nav",{className:"space-y-1",children:s.map(l=>e.jsx(Zl,{item:l,renderItem:i},l.id))})}),o&&e.jsx("div",{className:"flex-shrink-0 px-4 py-2 border-t border-white/10",children:o}),a&&r==="bottom"&&e.jsx("div",{className:"flex-shrink-0 p-3 border-t border-white/10",children:e.jsx(co,{config:a})})]})}function ec({logo:t,menu:s,user:a,width:r=260,mobileBreakpoint:n=768,open:o,onOpenChange:i,className:l,contentClassName:u,backgroundColor:d,textColor:f,activeColor:m,hoverColor:p,userPosition:w="bottom",showHamburger:C=!0,hamburgerPosition:g="left",renderItem:y,footer:j,header:x,position:v="fixed"}){const[k,N]=c.useState(!1),D=o!==void 0,P=D?o:k,R=D?i:N,[A,S]=c.useState(!1);c.useEffect(()=>{const $=()=>{S(window.innerWidth<n)};return $(),window.addEventListener("resize",$),()=>window.removeEventListener("resize",$)},[n]);const[M,E]=c.useState(()=>{const $=_=>{for(const F of _){if(F.active)return F.id;if(F.children){const H=$(F.children);if(H)return H}}return null};return $(s)}),[T,K]=c.useState(()=>{const $=(_,F=[])=>{for(const H of _){if(H.active)return F;if(H.children){const J=$(H.children,[...F,H.id]);if(J.length>F.length)return J}}return[]};return $(s)}),q=c.useCallback($=>{K(_=>_.includes($)?_.filter(F=>F!==$):[..._,$])},[]),B={activeId:M,setActiveId:E,expandedIds:T,toggleExpanded:q,isMobile:A,closeOnNavigate:!0,onClose:()=>R(!1)},W={"--sidebar-bg":d||"hsl(222 47% 11%)","--sidebar-text":f||"hsl(210 40% 96%)","--sidebar-active":m||"hsl(187 85% 43%)","--sidebar-active-foreground":"hsl(222 47% 11%)","--sidebar-hover":p||"rgba(255, 255, 255, 0.1)"},I=b("bg-[var(--sidebar-bg)] text-[var(--sidebar-text)]","[&_.bg-sidebar-active]:bg-[var(--sidebar-active)]","[&_.text-sidebar-active-foreground]:text-[var(--sidebar-active-foreground)]","[&_.text-sidebar-foreground\\/70]:text-[var(--sidebar-text)]/70","[&_.border-sidebar-active]:border-[var(--sidebar-active)]",u),z=e.jsx(Ql.Provider,{value:B,children:e.jsx("div",{className:b("h-full",I),style:W,children:e.jsx(Tb,{logo:t,menu:s,user:a,userPosition:w,header:x,footer:j,renderItem:y})})});return e.jsxs(e.Fragment,{children:[C&&A&&e.jsxs(L,{variant:"ghost",size:"icon",className:b("fixed top-3 z-50",g==="left"?"left-3":"right-3"),onClick:()=>R(!0),children:[e.jsx(h.Menu,{className:"h-6 w-6"}),e.jsx("span",{className:"sr-only",children:"Ouvrir le menu"})]}),!A&&e.jsx("aside",{className:b(v==="fixed"?"fixed left-0 top-0 h-screen z-40":"relative h-full",l),style:{width:r},children:z}),A&&e.jsx(sa,{open:P,onOpenChange:R,children:e.jsx(Ds,{side:"left",className:b("w-[280px] p-0 border-0",l),style:W,children:z})})]})}function Ab(){const[t,s]=c.useState(!1),a=c.useCallback(()=>s(!0),[]),r=c.useCallback(()=>s(!1),[]),n=c.useCallback(()=>s(o=>!o),[]);return{isOpen:t,setIsOpen:s,open:a,close:r,toggle:n}}function Eb({sidebar:t,children:s,sidebarWidth:a=260,className:r,contentClassName:n}){const[o,i]=c.useState(!1),l=t.mobileBreakpoint||768;return c.useEffect(()=>{const u=()=>i(window.innerWidth<l);return u(),window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[l]),e.jsxs("div",{className:b("min-h-screen bg-background",r),children:[e.jsx(ec,{...t,width:a}),e.jsx("main",{className:b("min-h-screen transition-all duration-300",n),style:{marginLeft:o?0:a},children:s})]})}function Mb({title:t,subtitle:s,showSearch:a=!0,searchPlaceholder:r="Rechercher...",searchValue:n,onSearchChange:o,onSearchSubmit:i,primaryAction:l,secondaryActions:u,filters:d,notifications:f,unreadCount:m=0,onNotificationsClick:p,userMenu:w,leftContent:C,rightContent:g,filterContent:y,className:j,mainBarClassName:x,filterBarClassName:v,sticky:k=!0}){const[N,D]=c.useState(n||""),P=S=>{const M=S.target.value;D(M),o?.(M)},R=S=>{S.key==="Enter"&&i?.(N)},A=d&&d.length>0||y;return e.jsxs("header",{className:b("w-full bg-background border-b",k&&"sticky top-0 z-50",j),children:[e.jsxs("div",{className:b("flex items-center gap-4 px-4 py-2 min-h-[56px]",x),children:[e.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[l&&e.jsxs(L,{variant:l.variant||"default",size:"sm",onClick:l.onClick,className:"gap-2",children:[l.icon||e.jsx(h.Plus,{className:"h-4 w-4"}),l.label]}),a&&e.jsxs("div",{className:"relative",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{type:"search",placeholder:r,value:N,onChange:P,onKeyDown:R,className:"pl-9 w-[200px] h-9 bg-muted/50"})]}),C]}),(t||s)&&e.jsxs("div",{className:"flex-1 text-center",children:[t&&e.jsx("h1",{className:"text-lg font-semibold leading-none",children:t}),s&&e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-auto",children:[u?.map(S=>e.jsxs(L,{variant:S.variant||"ghost",size:"sm",onClick:S.onClick,className:"gap-2",children:[S.icon,S.label]},S.id)),g,(f||p)&&e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsxs(L,{variant:"ghost",size:"icon",className:"relative",onClick:f?void 0:p,children:[e.jsx(h.Bell,{className:"h-5 w-5"}),m>0&&e.jsx(Se,{variant:"destructive",className:"absolute -top-1 -right-1 h-5 w-5 p-0 flex items-center justify-center text-xs",children:m>9?"9+":m})]})}),f&&f.length>0&&e.jsxs(_e,{align:"end",className:"w-80",children:[e.jsx("div",{className:"p-2 font-semibold border-b",children:"Notifications"}),f.slice(0,5).map(S=>e.jsxs(pe,{onClick:S.onClick,className:b("flex flex-col items-start gap-1 p-3",!S.read&&"bg-muted/50"),children:[e.jsx("div",{className:"font-medium",children:S.title}),S.description&&e.jsx("div",{className:"text-sm text-muted-foreground",children:S.description}),S.time&&e.jsx("div",{className:"text-xs text-muted-foreground",children:S.time})]},S.id))]})]}),w&&e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsxs(L,{variant:"ghost",size:"sm",className:"gap-2",children:[e.jsxs(yt,{className:"h-7 w-7",children:[w.avatar&&e.jsx(Nt,{src:w.avatar,alt:w.name}),e.jsx(Ct,{className:"text-xs",children:w.initials||w.name.slice(0,2).toUpperCase()})]}),e.jsx(h.ChevronDown,{className:"h-4 w-4"})]})}),e.jsxs(_e,{align:"end",className:"w-56",children:[e.jsxs("div",{className:"p-2",children:[e.jsx("p",{className:"font-medium",children:w.name}),w.email&&e.jsx("p",{className:"text-sm text-muted-foreground",children:w.email})]}),e.jsx(Qe,{}),w.items.map((S,M)=>S.separator?e.jsx(Qe,{},M):e.jsxs(pe,{onClick:S.onClick,children:[S.icon&&e.jsx("span",{className:"mr-2",children:S.icon}),S.label]},M))]})]})]})]}),A&&e.jsxs("div",{className:b("flex items-center gap-2 px-4 py-2 border-t bg-muted/30",v),children:[d?.map(S=>e.jsxs(Ve,{value:S.value,onValueChange:S.onChange,children:[e.jsxs($e,{className:"w-auto h-8 gap-2 bg-muted/50 border-0",children:[S.icon,e.jsx(We,{placeholder:S.placeholder||S.label})]}),e.jsx(Le,{children:S.options.map(M=>e.jsx(je,{value:M.value,children:M.label},M.value))})]},S.id)),y]})]})}function Pb({title:t="Tableau de bord",description:s,period:a,onPeriodChange:r,periods:n=[{value:"today",label:"Aujourd'hui"},{value:"week",label:"Cette semaine"},{value:"month",label:"Ce mois"},{value:"year",label:"Cette année"}],onRefresh:o,loading:i,quickActions:l}){return e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:t}),s&&e.jsx("p",{className:"text-muted-foreground mt-1",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r&&e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"sm",children:[e.jsx(h.Calendar,{className:"mr-2 h-4 w-4"}),n.find(u=>u.value===a)?.label||"Période"]})}),e.jsx(_e,{align:"end",children:n.map(u=>e.jsx(pe,{onClick:()=>r(u.value),className:b(a===u.value&&"bg-muted"),children:u.label},u.value))})]}),o&&e.jsx(L,{variant:"outline",size:"sm",onClick:o,disabled:i,children:e.jsx(h.RefreshCw,{className:b("h-4 w-4",i&&"animate-spin")})}),l?.map(u=>e.jsx(L,{variant:u.variant||"default",size:"sm",onClick:u.onClick,asChild:!!u.href,children:u.href?e.jsxs("a",{href:u.href,children:[u.icon&&e.jsx("span",{className:"mr-2",children:u.icon}),u.label]}):e.jsxs(e.Fragment,{children:[u.icon&&e.jsx("span",{className:"mr-2",children:u.icon}),u.label]})},u.id))]})]})}function Rb({stats:t,layout:s="grid",columns:a=4,loading:r}){return e.jsx(Vl,{layout:s,columns:a,gap:"md",children:t.map(n=>e.jsx(_l,{label:n.label,value:n.value,trend:n.trend,trendValue:n.trendValue,trendText:n.trendText,icon:n.icon,color:n.color,variant:"card",loading:r},n.id))})}function Fb({config:t}){return e.jsxs(ke,{children:[e.jsxs(qe,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsxs("div",{children:[e.jsx(Oe,{className:"text-base",children:t.title}),t.description&&e.jsx(ot,{children:t.description})]}),t.actions&&t.actions.length>0&&e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsx(_e,{align:"end",children:t.actions.map((s,a)=>e.jsx(pe,{onClick:s.onClick,children:s.label},a))})]})]}),e.jsx(Te,{children:t.chart})]})}function $b({config:t}){return e.jsxs(ke,{children:[e.jsxs(qe,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsxs("div",{children:[e.jsx(Oe,{className:"text-base",children:t.title}),t.description&&e.jsx(ot,{children:t.description})]}),t.actions&&t.actions.length>0&&e.jsx("div",{className:"flex gap-2",children:t.actions.map((s,a)=>e.jsx(L,{variant:"outline",size:"sm",onClick:s.onClick,asChild:!!s.href,children:s.href?e.jsxs("a",{href:s.href,children:[s.label,e.jsx(h.ArrowUpRight,{className:"ml-1 h-3 w-3"})]}):s.label},a))})]}),e.jsx(Te,{children:t.table})]})}function Lb({activities:t}){const s=r=>{const n=typeof r=="string"?new Date(r):r,i=new Date().getTime()-n.getTime(),l=Math.floor(i/6e4),u=Math.floor(l/60),d=Math.floor(u/24);return l<1?"À l'instant":l<60?`Il y a ${l} min`:u<24?`Il y a ${u}h`:d<7?`Il y a ${d}j`:n.toLocaleDateString("fr-FR")},a={info:"bg-blue-500",success:"bg-green-500",warning:"bg-yellow-500",error:"bg-red-500"};return e.jsxs(ke,{children:[e.jsx(qe,{children:e.jsx(Oe,{className:"text-base",children:"Activité récente"})}),e.jsx(Te,{children:e.jsx("div",{className:"space-y-4",children:t.map(r=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:b("h-2 w-2 rounded-full mt-2 flex-shrink-0",a[r.type||"info"])}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:r.title}),r.description&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:r.description})]}),e.jsx("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:s(r.timestamp)})]},r.id))})})]})}function Ib({title:t="Tableau de bord",description:s,stats:a,charts:r,tables:n,activities:o,quickActions:i,showHeader:l=!0,onRefresh:u,loading:d=!1,period:f="month",onPeriodChange:m,periods:p,statsLayout:w="grid",statsColumns:C=4,className:g}){return e.jsxs("div",{className:b("space-y-6",g),children:[l&&e.jsx(Pb,{title:t,description:s,period:f,onPeriodChange:m,periods:p,onRefresh:u,loading:d,quickActions:i}),a&&a.length>0&&e.jsx(Rb,{stats:a,layout:w,columns:C,loading:d}),r&&r.length>0&&e.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:r.map(y=>e.jsx(Fb,{config:y},y.id))}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[n&&n.length>0&&e.jsx("div",{className:b("space-y-6",o?"lg:col-span-2":"lg:col-span-3"),children:n.map(y=>e.jsx($b,{config:y},y.id))}),o&&o.length>0&&e.jsx("div",{className:b(!n||n.length===0?"lg:col-span-3":""),children:e.jsx(Lb,{activities:o})})]})]})}const Ob=[{id:"revenue",label:"Revenus",value:"€45,231.89",trend:"up",trendValue:"+20.1%",trendText:"vs mois dernier",icon:e.jsx(h.DollarSign,{className:"h-5 w-5"}),color:"success"},{id:"users",label:"Utilisateurs",value:"2,350",trend:"up",trendValue:"+180",trendText:"cette semaine",icon:e.jsx(h.Users,{className:"h-5 w-5"}),color:"blue"},{id:"orders",label:"Commandes",value:"12,234",trend:"down",trendValue:"-4.3%",trendText:"vs mois dernier",icon:e.jsx(h.ShoppingCart,{className:"h-5 w-5"}),color:"purple"},{id:"performance",label:"Performance",value:"94.2%",trend:"up",trendValue:"+2.4%",icon:e.jsx(h.Activity,{className:"h-5 w-5"}),color:"primary"}];function zb({field:t,value:s,onChange:a}){const r=n=>{a?.(n)};return t.type==="custom"&&t.customComponent?e.jsx("div",{className:"space-y-2",children:t.customComponent}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(me,{htmlFor:t.id,className:"text-sm font-medium",children:[t.label,t.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.type==="switch"&&e.jsx(aa,{id:t.id,checked:s,onCheckedChange:r,disabled:t.disabled})]}),t.description&&t.type!=="switch"&&e.jsx("p",{className:"text-xs text-muted-foreground",children:t.description}),t.type==="switch"&&t.description&&e.jsx("p",{className:"text-xs text-muted-foreground",children:t.description}),t.type==="text"&&e.jsx(oe,{id:t.id,type:"text",value:s||"",onChange:n=>r(n.target.value),placeholder:t.placeholder,disabled:t.disabled}),t.type==="email"&&e.jsx(oe,{id:t.id,type:"email",value:s||"",onChange:n=>r(n.target.value),placeholder:t.placeholder,disabled:t.disabled}),t.type==="password"&&e.jsx(oe,{id:t.id,type:"password",value:s||"",onChange:n=>r(n.target.value),placeholder:t.placeholder,disabled:t.disabled}),t.type==="textarea"&&e.jsx(ft,{id:t.id,value:s||"",onChange:n=>r(n.target.value),placeholder:t.placeholder,disabled:t.disabled,rows:3}),t.type==="select"&&t.options&&e.jsxs(Ve,{value:s,onValueChange:r,disabled:t.disabled,children:[e.jsx($e,{id:t.id,children:e.jsx(We,{placeholder:t.placeholder||"Sélectionner..."})}),e.jsx(Le,{children:t.options.map(n=>e.jsx(je,{value:n.value,children:n.label},n.value))})]})]})}function _b({section:t,values:s,onChange:a}){return e.jsxs(ke,{children:[e.jsx(qe,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[t.icon&&e.jsx("span",{className:"text-muted-foreground",children:t.icon}),e.jsxs("div",{children:[e.jsx(Oe,{className:"text-base",children:t.title}),t.description&&e.jsx(ot,{children:t.description})]})]})}),e.jsx(Te,{className:"space-y-6",children:t.fields.map((r,n)=>e.jsxs(c.Fragment,{children:[e.jsx(zb,{field:r,value:s?.[r.id],onChange:o=>a?.(r.id,o)}),n<t.fields.length-1&&e.jsx(kt,{className:"my-4"})]},r.id))})]})}function Vb({title:t="Paramètres",description:s="Gérez les paramètres de votre compte et de l'application.",tabs:a,sections:r,useTabs:n=!0,defaultTab:o,values:i={},onChange:l,onSave:u,saving:d=!1,showSaveButton:f=!0,showDeleteAccount:m=!1,onDeleteAccount:p,className:w}){const[C,g]=c.useState(i),[y,j]=c.useState(!1);c.useEffect(()=>{g(i)},[i]);const x=(N,D)=>{g(P=>({...P,[N]:D})),j(!0),l?.(N,D)},v=async()=>{await u?.(C),j(!1)},k=N=>e.jsx("div",{className:"space-y-6",children:N.map(D=>e.jsx(_b,{section:D,values:C,onChange:x},D.id))});return e.jsxs("div",{className:b("space-y-6",w),children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:t}),s&&e.jsx("p",{className:"text-muted-foreground mt-1",children:s})]}),f&&u&&e.jsxs(L,{onClick:v,disabled:d||!y,children:[d?e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(h.Save,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})]}),n&&a&&a.length>0?e.jsxs(ra,{defaultValue:o||a[0].id,className:"space-y-6",children:[e.jsx(Ts,{className:"grid w-full grid-cols-2 md:w-auto md:inline-flex",children:a.map(N=>e.jsxs(js,{value:N.id,className:"gap-2",children:[N.icon,N.label]},N.id))}),a.map(N=>e.jsx(vs,{value:N.id,className:"space-y-6",children:k(N.sections)},N.id))]}):r&&k(r),m&&p&&e.jsxs(ke,{className:"border-destructive",children:[e.jsxs(qe,{children:[e.jsxs(Oe,{className:"text-base text-destructive flex items-center gap-2",children:[e.jsx(h.Trash2,{className:"h-4 w-4"}),"Zone dangereuse"]}),e.jsx(ot,{children:"Actions irréversibles concernant votre compte."})]}),e.jsx(Te,{children:e.jsxs(fs,{children:[e.jsx(So,{asChild:!0,children:e.jsxs(L,{variant:"destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer mon compte"]})}),e.jsxs(Kt,{children:[e.jsxs(Yt,{children:[e.jsx(Qt,{children:"Êtes-vous sûr ?"}),e.jsx(Zt,{children:"Cette action est irréversible. Toutes vos données seront définitivement supprimées et ne pourront pas être récupérées."})]}),e.jsxs(Jt,{children:[e.jsx(ts,{children:"Annuler"}),e.jsx(es,{onClick:p,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer définitivement"})]})]})]})})]})]})}const Wb=[{id:"profile",label:"Profil",icon:e.jsx(h.User,{className:"h-4 w-4"}),sections:[{id:"personal",title:"Informations personnelles",description:"Mettez à jour vos informations personnelles.",icon:e.jsx(h.User,{className:"h-5 w-5"}),fields:[{id:"name",label:"Nom complet",type:"text",placeholder:"Jean Dupont",required:!0},{id:"email",label:"Adresse email",type:"email",placeholder:"jean@exemple.com",required:!0},{id:"bio",label:"Bio",type:"textarea",placeholder:"Parlez-nous de vous..."}]}]},{id:"notifications",label:"Notifications",icon:e.jsx(h.Bell,{className:"h-4 w-4"}),sections:[{id:"email-notifs",title:"Notifications par email",description:"Gérez vos préférences de notification par email.",icon:e.jsx(h.Mail,{className:"h-5 w-5"}),fields:[{id:"notif-marketing",label:"Marketing",description:"Recevoir des emails marketing et promotionnels.",type:"switch"},{id:"notif-security",label:"Sécurité",description:"Recevoir des alertes de sécurité importantes.",type:"switch"},{id:"notif-updates",label:"Mises à jour",description:"Recevoir les mises à jour de produit.",type:"switch"}]}]},{id:"security",label:"Sécurité",icon:e.jsx(h.Shield,{className:"h-4 w-4"}),sections:[{id:"password",title:"Mot de passe",description:"Changez votre mot de passe.",icon:e.jsx(h.Lock,{className:"h-5 w-5"}),fields:[{id:"current-password",label:"Mot de passe actuel",type:"password",placeholder:"••••••••"},{id:"new-password",label:"Nouveau mot de passe",type:"password",placeholder:"••••••••"},{id:"confirm-password",label:"Confirmer le mot de passe",type:"password",placeholder:"••••••••"}]},{id:"two-factor",title:"Authentification à deux facteurs",description:"Ajoutez une couche de sécurité supplémentaire.",icon:e.jsx(h.Smartphone,{className:"h-5 w-5"}),fields:[{id:"2fa-enabled",label:"Activer la 2FA",description:"Utilisez une application d'authentification.",type:"switch"}]}]},{id:"preferences",label:"Préférences",icon:e.jsx(h.Palette,{className:"h-4 w-4"}),sections:[{id:"appearance",title:"Apparence",description:"Personnalisez l'apparence de l'application.",icon:e.jsx(h.Palette,{className:"h-5 w-5"}),fields:[{id:"theme",label:"Thème",type:"select",options:[{value:"light",label:"Clair"},{value:"dark",label:"Sombre"},{value:"system",label:"Système"}]},{id:"language",label:"Langue",type:"select",options:[{value:"fr",label:"Français"},{value:"en",label:"English"},{value:"es",label:"Español"}]}]}]}];function uo({url:t,name:s,size:a="lg",editable:r,onAvatarChange:n}){const o=c.useRef(null),i={sm:"h-12 w-12",md:"h-16 w-16",lg:"h-24 w-24",xl:"h-32 w-32"},l=s.split(" ").map(d=>d[0]).join("").toUpperCase().slice(0,2),u=d=>{const f=d.target.files?.[0];f&&n&&n(f)};return e.jsxs("div",{className:"relative inline-block",children:[e.jsxs(yt,{className:b(i[a],"border-4 border-background shadow-lg"),children:[e.jsx(Nt,{src:t,alt:s}),e.jsx(Ct,{className:"text-lg font-medium",children:l})]}),r&&n&&e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:o,type:"file",accept:"image/*",onChange:u,className:"hidden"}),e.jsx(L,{size:"icon",variant:"secondary",className:"absolute bottom-0 right-0 h-8 w-8 rounded-full shadow-md",onClick:()=>o.current?.click(),children:e.jsx(h.Camera,{className:"h-4 w-4"})})]})]})}function Ub({field:t,value:s,onChange:a,isEditing:r}){if(!r)return e.jsxs("div",{className:"flex items-center gap-2",children:[t.icon&&e.jsx("span",{className:"text-muted-foreground",children:t.icon}),e.jsx("span",{className:b(!s&&"text-muted-foreground italic"),children:s||"Non renseigné"})]});const n={id:t.id,value:s||"",onChange:o=>a(o.target.value),placeholder:t.placeholder,disabled:t.disabled};return t.type==="textarea"?e.jsx(ft,{...n,rows:3}):t.type==="select"&&t.options?e.jsxs(Ve,{value:s,onValueChange:a,disabled:t.disabled,children:[e.jsx($e,{children:e.jsx(We,{placeholder:t.placeholder||"Sélectionner..."})}),e.jsx(Le,{children:t.options.map(o=>e.jsx(je,{value:o.value,children:o.label},o.value))})]}):e.jsx(oe,{type:t.type||"text",...n})}function mo({section:t,values:s,onChange:a,isEditing:r}){return e.jsxs(ke,{children:[e.jsx(qe,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[t.icon&&e.jsx("span",{className:"text-muted-foreground",children:t.icon}),e.jsxs("div",{children:[e.jsx(Oe,{className:"text-base",children:t.title}),t.description&&e.jsx(ot,{children:t.description})]})]})}),e.jsx(Te,{className:"space-y-4",children:t.fields.map((n,o)=>e.jsxs(c.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(me,{htmlFor:n.id,className:"text-sm font-medium",children:[n.label,n.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.jsx(Ub,{field:n,value:s[n.id]||"",onChange:i=>a(n.id,i),isEditing:r})]}),o<t.fields.length-1&&r&&e.jsx(kt,{className:"my-4"})]},n.id))})]})}function Bb({links:t,isEditing:s}){const a=r=>{switch(r){case"twitter":return e.jsx(h.Twitter,{className:"h-4 w-4"});case"github":return e.jsx(h.Github,{className:"h-4 w-4"});case"linkedin":return e.jsx(h.Linkedin,{className:"h-4 w-4"});case"website":return e.jsx(h.Globe,{className:"h-4 w-4"});default:return e.jsx(h.Link,{className:"h-4 w-4"})}};return s?e.jsx("div",{className:"space-y-2",children:t.map(r=>e.jsxs("div",{className:"flex items-center gap-2",children:[a(r.type),e.jsx(oe,{value:r.url,className:"flex-1",readOnly:!0})]},r.id))}):e.jsx("div",{className:"flex gap-2 flex-wrap",children:t.map(r=>e.jsxs("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 px-3 py-1.5 bg-muted rounded-full text-sm hover:bg-muted/80 transition-colors",children:[a(r.type),e.jsx("span",{children:r.label||r.type})]},r.id))})}function qb({profile:t,editable:s=!1,isEditing:a,onEditToggle:r,onChange:n,onSave:o,saving:i=!1,onAvatarChange:l,customSections:u,showSocialLinks:d=!0,showStats:f=!1,stats:m,layout:p="card",useTabs:w=!1,className:C}){const[g,y]=c.useState(!1),[j,x]=c.useState(t),v=a??g;c.useEffect(()=>{x(t)},[t]);const k=E=>{r?r(E):y(E),E||x(t)},N=(E,T)=>{x(K=>({...K,[E]:T})),n?.(E,T)},D=async()=>{await o?.(j),k(!1)},P=[{id:"personal",title:"Informations personnelles",icon:e.jsx(h.User,{className:"h-5 w-5"}),fields:[{id:"firstName",label:"Prénom",value:j.firstName||"",type:"text",placeholder:"Jean",icon:e.jsx(h.User,{className:"h-4 w-4"})},{id:"lastName",label:"Nom",value:j.lastName||"",type:"text",placeholder:"Dupont"},{id:"email",label:"Email",value:j.email,type:"email",placeholder:"jean@exemple.com",required:!0,icon:e.jsx(h.Mail,{className:"h-4 w-4"})},{id:"phone",label:"Téléphone",value:j.phone||"",type:"tel",placeholder:"+33 6 12 34 56 78",icon:e.jsx(h.Phone,{className:"h-4 w-4"})},{id:"bio",label:"Bio",value:j.bio||"",type:"textarea",placeholder:"Parlez-nous de vous..."}]},{id:"professional",title:"Informations professionnelles",icon:e.jsx(h.Briefcase,{className:"h-5 w-5"}),fields:[{id:"role",label:"Poste",value:j.role||"",type:"text",placeholder:"Développeur Senior",icon:e.jsx(h.Briefcase,{className:"h-4 w-4"})},{id:"department",label:"Département",value:j.department||"",type:"text",placeholder:"Engineering"},{id:"company",label:"Entreprise",value:j.company||"",type:"text",placeholder:"Acme Inc.",icon:e.jsx(h.Building,{className:"h-4 w-4"})},{id:"location",label:"Localisation",value:j.location||"",type:"text",placeholder:"Paris, France",icon:e.jsx(h.MapPin,{className:"h-4 w-4"})},{id:"website",label:"Site web",value:j.website||"",type:"url",placeholder:"https://exemple.com",icon:e.jsx(h.Globe,{className:"h-4 w-4"})}]}],R=u||P,A={firstName:j.firstName||"",lastName:j.lastName||"",email:j.email,phone:j.phone||"",bio:j.bio||"",role:j.role||"",department:j.department||"",company:j.company||"",location:j.location||"",website:j.website||"",...j.customFields};if(p==="compact")return e.jsxs("div",{className:b("flex items-center gap-4",C),children:[e.jsx(uo,{url:j.avatarUrl,name:j.displayName,size:"md"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:j.displayName}),j.role&&e.jsx("p",{className:"text-sm text-muted-foreground",children:j.role}),j.email&&e.jsx("p",{className:"text-sm text-muted-foreground",children:j.email})]})]});const S=()=>e.jsxs("div",{className:"flex flex-col items-center text-center gap-4 md:flex-row md:text-left",children:[e.jsx(uo,{url:j.avatarUrl,name:j.displayName,size:"xl",editable:s&&v,onAvatarChange:l}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:j.displayName}),j.role&&e.jsx("p",{className:"text-muted-foreground",children:j.role}),j.company&&e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(h.Building,{className:"h-3 w-3"}),j.company]}),j.location&&e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(h.MapPin,{className:"h-3 w-3"}),j.location]})]}),s&&e.jsx("div",{className:"flex gap-2",children:v?e.jsxs(e.Fragment,{children:[e.jsxs(L,{variant:"outline",size:"sm",onClick:()=>k(!1),disabled:i,children:[e.jsx(h.X,{className:"mr-2 h-4 w-4"}),"Annuler"]}),e.jsxs(L,{size:"sm",onClick:D,disabled:i,children:[i?e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(h.Save,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})]}):e.jsxs(L,{variant:"outline",size:"sm",onClick:()=>k(!0),children:[e.jsx(h.Edit3,{className:"mr-2 h-4 w-4"}),"Modifier"]})})]}),f&&m&&m.length>0&&e.jsx("div",{className:"flex gap-6 mt-4",children:m.map((E,T)=>e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:E.value}),e.jsx("div",{className:"text-xs text-muted-foreground",children:E.label})]},T))}),d&&j.socialLinks&&j.socialLinks.length>0&&e.jsx("div",{className:"mt-4",children:e.jsx(Bb,{links:j.socialLinks,isEditing:v})}),j.joinedAt&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-4 flex items-center gap-1",children:[e.jsx(h.Calendar,{className:"h-3 w-3"}),"Membre depuis"," ",new Date(j.joinedAt).toLocaleDateString("fr-FR",{month:"long",year:"numeric"})]})]})]}),M=()=>e.jsx("div",{className:"space-y-6",children:R.map(E=>e.jsx(mo,{section:E,values:A,onChange:N,isEditing:v},E.id))});return p==="card"?e.jsx(ke,{className:C,children:e.jsx(Te,{className:"pt-6",children:e.jsxs("div",{className:"space-y-6",children:[S(),e.jsx(kt,{}),M()]})})}):e.jsxs("div",{className:b("space-y-6",C),children:[S(),w?e.jsxs(ra,{defaultValue:R[0]?.id,className:"space-y-6",children:[e.jsx(Ts,{children:R.map(E=>e.jsxs(js,{value:E.id,className:"gap-2",children:[E.icon,E.title]},E.id))}),R.map(E=>e.jsx(vs,{value:E.id,children:e.jsx(mo,{section:E,values:A,onChange:N,isEditing:v})},E.id))]}):M()]})}const Hb={displayName:"Jean Dupont",firstName:"Jean",lastName:"Dupont",email:"jean.dupont@exemple.com",phone:"+33 6 12 34 56 78",bio:"Développeur passionné avec plus de 10 ans d'expérience dans le développement web et mobile.",avatarUrl:"",role:"Lead Developer",department:"Engineering",company:"Acme Inc.",location:"Paris, France",website:"https://jeandupont.dev",joinedAt:new Date("2023-01-15"),socialLinks:[{id:"1",type:"twitter",url:"https://twitter.com/jeandupont",label:"@jeandupont"},{id:"2",type:"github",url:"https://github.com/jeandupont",label:"jeandupont"},{id:"3",type:"linkedin",url:"https://linkedin.com/in/jeandupont",label:"Jean Dupont"}]},tc=[{value:"admin",label:"Administrateur",color:"destructive"},{value:"moderator",label:"Modérateur",color:"warning"},{value:"user",label:"Utilisateur",color:"default"},{value:"guest",label:"Invité",color:"secondary"}],Ra={active:{label:"Actif",color:"bg-green-500",icon:h.CheckCircle},inactive:{label:"Inactif",color:"bg-gray-500",icon:h.XCircle},pending:{label:"En attente",color:"bg-yellow-500",icon:h.Mail},banned:{label:"Banni",color:"bg-red-500",icon:h.Ban}};function Gb({user:t,size:s="sm"}){const a={sm:"h-8 w-8",md:"h-10 w-10"},r=t.displayName.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2);return e.jsxs(yt,{className:a[s],children:[e.jsx(Nt,{src:t.avatarUrl,alt:t.displayName}),e.jsx(Ct,{className:"text-xs",children:r})]})}function Xb({role:t,roles:s=tc}){const a=s.find(n=>n.value===t),r=t==="admin"?h.ShieldAlert:t==="moderator"?h.ShieldCheck:h.Shield;return e.jsxs(Se,{variant:a?.color,children:[e.jsx(r,{className:"h-3 w-3 mr-1"}),a?.label||t]})}function Kb({status:t}){const s=Ra[t];return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:b("h-2 w-2 rounded-full",s.color)}),e.jsx("span",{className:"text-sm",children:s.label})]})}function ho({open:t,onOpenChange:s,user:a,roles:r,permissions:n,onSubmit:o,loading:i}){const[l,u]=c.useState({email:"",displayName:"",firstName:"",lastName:"",role:"user",status:"pending",permissions:[]});c.useEffect(()=>{u(a?{email:a.email,displayName:a.displayName,firstName:a.firstName||"",lastName:a.lastName||"",role:a.role,status:a.status,permissions:a.permissions||[]}:{email:"",displayName:"",firstName:"",lastName:"",role:"user",status:"pending",permissions:[]})},[a,t]);const d=async m=>{m.preventDefault(),await o(l),s(!1)},f=m=>{u(p=>({...p,permissions:p.permissions?.includes(m)?p.permissions.filter(w=>w!==m):[...p.permissions||[],m]}))};return e.jsx(It,{open:t,onOpenChange:s,children:e.jsx(Tt,{className:"sm:max-w-[500px]",children:e.jsxs("form",{onSubmit:d,children:[e.jsxs(Ht,{children:[e.jsx(Xt,{children:a?"Modifier l'utilisateur":"Créer un utilisateur"}),e.jsx(Cs,{children:a?"Modifiez les informations de l'utilisateur.":"Remplissez les informations pour créer un nouvel utilisateur."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"firstName",children:"Prénom"}),e.jsx(oe,{id:"firstName",value:l.firstName,onChange:m=>u(p=>({...p,firstName:m.target.value})),placeholder:"Jean"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"lastName",children:"Nom"}),e.jsx(oe,{id:"lastName",value:l.lastName,onChange:m=>u(p=>({...p,lastName:m.target.value})),placeholder:"Dupont"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"displayName",children:"Nom d'affichage *"}),e.jsx(oe,{id:"displayName",value:l.displayName,onChange:m=>u(p=>({...p,displayName:m.target.value})),placeholder:"Jean Dupont",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"email",children:"Email *"}),e.jsx(oe,{id:"email",type:"email",value:l.email,onChange:m=>u(p=>({...p,email:m.target.value})),placeholder:"jean@exemple.com",required:!0})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"role",children:"Rôle"}),e.jsxs(Ve,{value:l.role,onValueChange:m=>u(p=>({...p,role:m})),children:[e.jsx($e,{children:e.jsx(We,{})}),e.jsx(Le,{children:r.map(m=>e.jsx(je,{value:m.value,children:m.label},m.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"status",children:"Statut"}),e.jsxs(Ve,{value:l.status,onValueChange:m=>u(p=>({...p,status:m})),children:[e.jsx($e,{children:e.jsx(We,{})}),e.jsx(Le,{children:Object.entries(Ra).map(([m,p])=>e.jsx(je,{value:m,children:p.label},m))})]})]})]}),n&&n.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{children:"Permissions"}),e.jsx("div",{className:"border rounded-md p-3 space-y-2 max-h-[150px] overflow-y-auto",children:n.map(m=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ze,{id:m.id,checked:l.permissions?.includes(m.id),onCheckedChange:()=>f(m.id)}),e.jsx("label",{htmlFor:m.id,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:m.name})]},m.id))})]})]}),e.jsxs(Gt,{children:[e.jsx(L,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Annuler"}),e.jsxs(L,{type:"submit",disabled:i,children:[i&&e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),a?"Enregistrer":"Créer"]})]})]})})})}function Yb({user:t,onEdit:s,onDelete:a,onResetPassword:r,onStatusChange:n,onRoleChange:o,roles:i}){return e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(_e,{align:"end",children:[s&&e.jsxs(pe,{onClick:s,children:[e.jsx(h.Edit,{className:"mr-2 h-4 w-4"}),"Modifier"]}),r&&e.jsxs(pe,{onClick:r,children:[e.jsx(h.Key,{className:"mr-2 h-4 w-4"}),"Réinitialiser le mot de passe"]}),o&&e.jsxs(e.Fragment,{children:[e.jsx(Qe,{}),e.jsx(ms,{children:"Changer le rôle"}),i.map(l=>e.jsx(pe,{onClick:()=>o(l.value),disabled:t.role===l.value,children:l.label},l.value))]}),n&&e.jsxs(e.Fragment,{children:[e.jsx(Qe,{}),e.jsx(ms,{children:"Changer le statut"}),Object.entries(Ra).map(([l,u])=>e.jsx(pe,{onClick:()=>n(l),disabled:t.status===l,children:u.label},l))]}),a&&e.jsxs(e.Fragment,{children:[e.jsx(Qe,{}),e.jsxs(pe,{onClick:a,className:"text-destructive focus:text-destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]})}function Jb({users:t,roles:s=tc,permissions:a,selectedUsers:r=[],onSelectionChange:n,onCreate:o,onEdit:i,onDelete:l,onBulkDelete:u,onRoleChange:d,onStatusChange:f,onResetPassword:m,onExport:p,onRefresh:w,loading:C=!1,actionLoading:g=!1,searchQuery:y="",onSearchChange:j,roleFilter:x="all",onRoleFilterChange:v,statusFilter:k="all",onStatusFilterChange:N,showBulkActions:D=!0,showCreateButton:P=!0,title:R="Gestion des utilisateurs",description:A="Gérez les utilisateurs, leurs rôles et permissions.",className:S}){const[M,E]=c.useState(!1),[T,K]=c.useState(null),[q,B]=c.useState(null),[W,I]=c.useState(!1),z=c.useMemo(()=>t.filter(X=>{if(y){const Y=y.toLowerCase();if(!(X.displayName.toLowerCase().includes(Y)||X.email.toLowerCase().includes(Y)))return!1}return!(x!=="all"&&X.role!==x||k!=="all"&&X.status!==k)}),[t,y,x,k]),$=X=>{n?.(X?z.map(Y=>Y.id):[])},_=(X,Y)=>{n?.(Y?[...r,X]:r.filter(U=>U!==X))},F=async X=>{await o?.(X)},H=async X=>{T&&(await i?.(T.id,X),K(null))},J=async()=>{q&&(await l?.(q.id),B(null))},Q=async()=>{await u?.(r),n?.([]),I(!1)},ne=X=>(typeof X=="string"?new Date(X):X).toLocaleDateString("fr-FR",{day:"numeric",month:"short",year:"numeric"});return e.jsxs("div",{className:b("space-y-6",S),children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold tracking-tight flex items-center gap-2",children:[e.jsx(h.Users,{className:"h-6 w-6"}),R]}),A&&e.jsx("p",{className:"text-muted-foreground mt-1",children:A})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[w&&e.jsx(L,{variant:"outline",size:"sm",onClick:w,disabled:C,children:e.jsx(h.RefreshCw,{className:b("h-4 w-4",C&&"animate-spin")})}),p&&e.jsxs(L,{variant:"outline",size:"sm",onClick:p,children:[e.jsx(h.Download,{className:"mr-2 h-4 w-4"}),"Exporter"]}),P&&o&&e.jsxs(L,{size:"sm",onClick:()=>E(!0),children:[e.jsx(h.UserPlus,{className:"mr-2 h-4 w-4"}),"Ajouter"]})]})]}),e.jsx(ke,{children:e.jsxs(Te,{className:"pt-6",children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center",children:[j&&e.jsxs("div",{className:"relative flex-1",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{placeholder:"Rechercher un utilisateur...",value:y,onChange:X=>j(X.target.value),className:"pl-9"})]}),v&&e.jsxs(Ve,{value:x,onValueChange:X=>v(X),children:[e.jsxs($e,{className:"w-[180px]",children:[e.jsx(h.Filter,{className:"mr-2 h-4 w-4"}),e.jsx(We,{placeholder:"Rôle"})]}),e.jsxs(Le,{children:[e.jsx(je,{value:"all",children:"Tous les rôles"}),s.map(X=>e.jsx(je,{value:X.value,children:X.label},X.value))]})]}),N&&e.jsxs(Ve,{value:k,onValueChange:X=>N(X),children:[e.jsxs($e,{className:"w-[180px]",children:[e.jsx(h.Filter,{className:"mr-2 h-4 w-4"}),e.jsx(We,{placeholder:"Statut"})]}),e.jsxs(Le,{children:[e.jsx(je,{value:"all",children:"Tous les statuts"}),Object.entries(Ra).map(([X,Y])=>e.jsx(je,{value:X,children:Y.label},X))]})]})]}),D&&r.length>0&&e.jsxs("div",{className:"flex items-center gap-4 mt-4 p-3 bg-muted rounded-lg",children:[e.jsxs("span",{className:"text-sm font-medium",children:[r.length," utilisateur(s) sélectionné(s)"]}),u&&e.jsxs(L,{variant:"destructive",size:"sm",onClick:()=>I(!0),children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]}),e.jsx(L,{variant:"outline",size:"sm",onClick:()=>n?.([]),children:"Désélectionner"})]})]})}),e.jsx(ke,{children:e.jsx(Te,{className:"p-0",children:e.jsxs(Ea,{children:[e.jsx(Ma,{children:e.jsxs(qt,{children:[n&&e.jsx(ct,{className:"w-[50px]",children:e.jsx(Ze,{checked:z.length>0&&r.length===z.length,onCheckedChange:$})}),e.jsx(ct,{children:"Utilisateur"}),e.jsx(ct,{children:"Rôle"}),e.jsx(ct,{children:"Statut"}),e.jsx(ct,{children:"Inscrit le"}),e.jsx(ct,{children:"Dernière connexion"}),e.jsx(ct,{className:"w-[50px]"})]})}),e.jsx(Pa,{children:C?e.jsx(qt,{children:e.jsx(tt,{colSpan:n?7:6,className:"text-center py-8",children:e.jsx(h.Loader2,{className:"h-6 w-6 animate-spin mx-auto"})})}):z.length===0?e.jsx(qt,{children:e.jsx(tt,{colSpan:n?7:6,className:"text-center py-8 text-muted-foreground",children:"Aucun utilisateur trouvé"})}):z.map(X=>e.jsxs(qt,{children:[n&&e.jsx(tt,{children:e.jsx(Ze,{checked:r.includes(X.id),onCheckedChange:Y=>_(X.id,Y)})}),e.jsx(tt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Gb,{user:X}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:X.displayName}),e.jsx("div",{className:"text-sm text-muted-foreground",children:X.email})]})]})}),e.jsx(tt,{children:e.jsx(Xb,{role:X.role,roles:s})}),e.jsx(tt,{children:e.jsx(Kb,{status:X.status})}),e.jsx(tt,{className:"text-muted-foreground",children:ne(X.createdAt)}),e.jsx(tt,{className:"text-muted-foreground",children:X.lastLogin?ne(X.lastLogin):"-"}),e.jsx(tt,{children:e.jsx(Yb,{user:X,roles:s,onEdit:i?()=>K(X):void 0,onDelete:l?()=>B(X):void 0,onResetPassword:m?()=>m(X.id):void 0,onRoleChange:d?Y=>d(X.id,Y):void 0,onStatusChange:f?Y=>f(X.id,Y):void 0})})]},X.id))})]})})}),e.jsx(ho,{open:M,onOpenChange:E,roles:s,permissions:a,onSubmit:F,loading:g}),e.jsx(ho,{open:!!T,onOpenChange:X=>!X&&K(null),user:T||void 0,roles:s,permissions:a,onSubmit:H,loading:g}),e.jsx(fs,{open:!!q,onOpenChange:X=>!X&&B(null),children:e.jsxs(Kt,{children:[e.jsxs(Yt,{children:[e.jsx(Qt,{children:"Supprimer l'utilisateur ?"}),e.jsxs(Zt,{children:["Êtes-vous sûr de vouloir supprimer ",q?.displayName," ? Cette action est irréversible."]})]}),e.jsxs(Jt,{children:[e.jsx(ts,{children:"Annuler"}),e.jsx(es,{onClick:J,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer"})]})]})}),e.jsx(fs,{open:W,onOpenChange:I,children:e.jsxs(Kt,{children:[e.jsxs(Yt,{children:[e.jsx(Qt,{children:"Supprimer les utilisateurs ?"}),e.jsxs(Zt,{children:["Êtes-vous sûr de vouloir supprimer ",r.length," utilisateur(s) ? Cette action est irréversible."]})]}),e.jsxs(Jt,{children:[e.jsx(ts,{children:"Annuler"}),e.jsx(es,{onClick:Q,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer"})]})]})})]})}const Qb=[{id:"1",email:"admin@exemple.com",displayName:"Admin User",firstName:"Admin",lastName:"User",role:"admin",status:"active",createdAt:new Date("2023-01-01"),lastLogin:new Date("2024-01-15")},{id:"2",email:"moderator@exemple.com",displayName:"Marie Modérateur",firstName:"Marie",lastName:"Modérateur",role:"moderator",status:"active",createdAt:new Date("2023-03-15"),lastLogin:new Date("2024-01-14")},{id:"3",email:"user@exemple.com",displayName:"Jean Utilisateur",firstName:"Jean",lastName:"Utilisateur",role:"user",status:"active",createdAt:new Date("2023-06-01"),lastLogin:new Date("2024-01-10")},{id:"4",email:"pending@exemple.com",displayName:"Paul Pending",firstName:"Paul",lastName:"Pending",role:"user",status:"pending",createdAt:new Date("2024-01-10")},{id:"5",email:"banned@exemple.com",displayName:"Bob Banni",firstName:"Bob",lastName:"Banni",role:"guest",status:"banned",createdAt:new Date("2023-09-01"),lastLogin:new Date("2023-12-01")}],Zb=[{id:"read",name:"Lecture",description:"Accès en lecture",category:"Base"},{id:"write",name:"Écriture",description:"Accès en écriture",category:"Base"},{id:"delete",name:"Suppression",description:"Accès suppression",category:"Base"},{id:"admin",name:"Administration",description:"Accès admin",category:"Admin"},{id:"users",name:"Gestion utilisateurs",description:"Gérer les utilisateurs",category:"Admin"}],sc={created:{icon:h.Plus,color:"text-green-500",label:"créé"},updated:{icon:h.Edit,color:"text-blue-500",label:"modifié"},deleted:{icon:h.Trash2,color:"text-red-500",label:"supprimé"},commented:{icon:h.MessageSquare,color:"text-purple-500",label:"commenté"},uploaded:{icon:h.Upload,color:"text-cyan-500",label:"uploadé"},downloaded:{icon:h.Download,color:"text-gray-500",label:"téléchargé"},shared:{icon:h.User,color:"text-orange-500",label:"partagé"},approved:{icon:h.Check,color:"text-green-500",label:"approuvé"},rejected:{icon:h.X,color:"text-red-500",label:"rejeté"},mentioned:{icon:h.Bell,color:"text-yellow-500",label:"mentionné"},assigned:{icon:h.User,color:"text-indigo-500",label:"assigné"},completed:{icon:h.Check,color:"text-green-500",label:"terminé"},custom:{icon:h.AlertCircle,color:"text-gray-500",label:""}};function fo({user:t,size:s="sm"}){const a={sm:"h-8 w-8",md:"h-10 w-10"},r=t.name.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2);return e.jsxs(yt,{className:a[s],children:[e.jsx(Nt,{src:t.avatar,alt:t.name}),e.jsx(Ct,{className:"text-xs",children:r})]})}function po({type:t,customIcon:s,customColor:a}){const r=sc[t],n=r.icon;return e.jsx("div",{className:b("flex h-8 w-8 items-center justify-center rounded-full bg-background border-2 shadow-sm",a||r.color),children:s||e.jsx(n,{className:"h-4 w-4"})})}function ej({activity:t,showAvatar:s,relativeTime:a,layout:r,isLast:n}){const o=l=>{const u=typeof l=="string"?new Date(l):l;if(a){const f=new Date().getTime()-u.getTime(),m=Math.floor(f/6e4),p=Math.floor(m/60),w=Math.floor(p/24);if(m<1)return"À l'instant";if(m<60)return`Il y a ${m} min`;if(p<24)return`Il y a ${p}h`;if(w<7)return`Il y a ${w}j`}return u.toLocaleDateString("fr-FR",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})},i=sc[t.type];return r==="compact"?e.jsxs("div",{className:"flex items-center gap-3 py-2",children:[e.jsx(po,{type:t.type,customIcon:t.icon,customColor:t.color}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("p",{className:"text-sm truncate",children:[e.jsx("span",{className:"font-medium",children:t.user.name})," ",e.jsx("span",{className:"text-muted-foreground",children:t.title})]})}),e.jsx("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:o(t.timestamp)})]}):r==="feed"?e.jsx(ke,{className:"mb-4",children:e.jsx(Te,{className:"pt-4",children:e.jsxs("div",{className:"flex gap-3",children:[s&&e.jsx(fo,{user:t.user,size:"md"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium",children:t.user.name}),e.jsx(Se,{variant:"secondary",className:"text-xs",children:i.label||t.type}),e.jsx("span",{className:"text-xs text-muted-foreground",children:o(t.timestamp)})]}),e.jsx("p",{className:"text-sm",children:t.title}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.description}),t.metadata?.comment&&e.jsx("div",{className:"mt-2 p-3 bg-muted rounded-lg text-sm",children:t.metadata.comment})]})]})})}):e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx(po,{type:t.type,customIcon:t.icon,customColor:t.color}),!n&&e.jsx("div",{className:"w-0.5 flex-1 bg-border mt-2"})]}),e.jsx("div",{className:"flex-1 pb-8",children:e.jsxs("div",{className:"flex items-start gap-3",children:[s&&e.jsx(fo,{user:t.user}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium",children:t.user.name}),e.jsx("span",{className:"text-muted-foreground",children:t.title})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.description}),t.metadata?.comment&&e.jsx("div",{className:"mt-2 p-3 bg-muted rounded-lg text-sm",children:t.metadata.comment}),e.jsx("span",{className:"text-xs text-muted-foreground mt-2 block",children:o(t.timestamp)})]})]})})]})}function tj({activities:t,title:s="Activité",showSearch:a=!0,showFilters:r=!0,filters:n=[],activeFilter:o,onFilterChange:i,showRefresh:l=!0,onRefresh:u,loading:d=!1,groupByDay:f=!0,showLoadMore:m=!1,onLoadMore:p,loadingMore:w=!1,showAvatars:C=!0,relativeTime:g=!0,layout:y="timeline",className:j}){const[x,v]=c.useState(""),[k,N]=c.useState(null),D=o??k,P=M=>{i?i(M):N(M)},R=c.useMemo(()=>{let M=t;if(x){const E=x.toLowerCase();M=M.filter(T=>T.title.toLowerCase().includes(E)||T.user.name.toLowerCase().includes(E)||T.description?.toLowerCase().includes(E))}if(D){const E=n.find(T=>T.id===D);E&&(M=M.filter(T=>E.types.includes(T.type)))}return M},[t,x,D,n]),A=c.useMemo(()=>{if(!f)return null;const M={};return R.forEach(E=>{const K=(typeof E.timestamp=="string"?new Date(E.timestamp):E.timestamp).toLocaleDateString("fr-FR",{weekday:"long",day:"numeric",month:"long",year:"numeric"});M[K]||(M[K]=[]),M[K].push(E)}),M},[R,f]),S=M=>e.jsx("div",{children:M.map((E,T)=>e.jsx(ej,{activity:E,showAvatar:C,relativeTime:g,layout:y,isLast:T===M.length-1},E.id))});return e.jsxs("div",{className:b("space-y-4",j),children:[e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("h2",{className:"text-xl font-semibold",children:s}),e.jsx("div",{className:"flex items-center gap-2",children:l&&u&&e.jsx(L,{variant:"outline",size:"sm",onClick:u,disabled:d,children:e.jsx(h.RefreshCw,{className:b("h-4 w-4",d&&"animate-spin")})})})]}),(a||r)&&e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center",children:[a&&e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{placeholder:"Rechercher...",value:x,onChange:M=>v(M.target.value),className:"pl-9"})]}),r&&n.length>0&&e.jsxs(Ve,{value:D||"all",onValueChange:M=>P(M==="all"?null:M),children:[e.jsxs($e,{className:"w-[180px]",children:[e.jsx(h.Filter,{className:"h-4 w-4 mr-2"}),e.jsx(We,{placeholder:"Filtrer"})]}),e.jsxs(Le,{children:[e.jsx(je,{value:"all",children:"Toutes les activités"}),n.map(M=>e.jsx(je,{value:M.id,children:M.label},M.id))]})]})]}),d?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(h.RefreshCw,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):R.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(h.Clock,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Aucune activité"})]}):f&&A?e.jsx("div",{className:"space-y-6",children:Object.entries(A).map(([M,E])=>e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-4 capitalize",children:M}),S(E)]},M))}):S(R),m&&p&&e.jsx("div",{className:"flex justify-center pt-4",children:e.jsxs(L,{variant:"outline",onClick:p,disabled:w,children:[w?e.jsx(h.RefreshCw,{className:"h-4 w-4 animate-spin mr-2"}):e.jsx(h.ChevronDown,{className:"h-4 w-4 mr-2"}),"Charger plus"]})})]})}const sj=[{id:"edits",label:"Modifications",types:["created","updated","deleted"]},{id:"comments",label:"Commentaires",types:["commented","mentioned"]},{id:"files",label:"Fichiers",types:["uploaded","downloaded","shared"]},{id:"approvals",label:"Approbations",types:["approved","rejected","completed"]}],aj=[{id:"1",type:"created",title:"a créé le document 'Rapport Q4'",user:{id:"1",name:"Marie Dupont"},timestamp:new Date(Date.now()-1e3*60*5)},{id:"2",type:"commented",title:"a commenté sur 'Projet Alpha'",user:{id:"2",name:"Pierre Martin"},timestamp:new Date(Date.now()-1e3*60*30),metadata:{comment:"Super travail sur cette partie !"}},{id:"3",type:"uploaded",title:"a uploadé 3 fichiers",user:{id:"3",name:"Sophie Bernard"},timestamp:new Date(Date.now()-1e3*60*60*2)},{id:"4",type:"approved",title:"a approuvé la demande de congés",user:{id:"1",name:"Marie Dupont"},timestamp:new Date(Date.now()-1e3*60*60*24)}],hn={blue:{bg:"bg-blue-100",text:"text-blue-700",border:"border-blue-500"},green:{bg:"bg-green-100",text:"text-green-700",border:"border-green-500"},red:{bg:"bg-red-100",text:"text-red-700",border:"border-red-500"},yellow:{bg:"bg-yellow-100",text:"text-yellow-700",border:"border-yellow-500"},purple:{bg:"bg-purple-100",text:"text-purple-700",border:"border-purple-500"},pink:{bg:"bg-pink-100",text:"text-pink-700",border:"border-pink-500"},orange:{bg:"bg-orange-100",text:"text-orange-700",border:"border-orange-500"},cyan:{bg:"bg-cyan-100",text:"text-cyan-700",border:"border-cyan-500"}};function rj(t,s){const a=[],r=new Date(t,s+1,0);for(let n=1;n<=r.getDate();n++)a.push(new Date(t,s,n));return a}function cr(t,s){return t.getFullYear()===s.getFullYear()&&t.getMonth()===s.getMonth()&&t.getDate()===s.getDate()}function nj(t,s){return t.filter(a=>{const r=typeof a.start=="string"?new Date(a.start):a.start,n=typeof a.end=="string"?new Date(a.end):a.end;return a.allDay?cr(r,s)||s>=r&&s<=n:cr(r,s)})}function oj({currentDate:t,viewMode:s,onPrevious:a,onNext:r,onToday:n,onViewModeChange:o,onAddClick:i,showViewSelector:l,showAddButton:u,locale:d}){const f=()=>{switch(s){case"month":return t.toLocaleDateString(d,{month:"long",year:"numeric"});case"week":return`Semaine du ${t.toLocaleDateString(d,{day:"numeric",month:"long"})}`;case"day":return t.toLocaleDateString(d,{weekday:"long",day:"numeric",month:"long",year:"numeric"});case"agenda":return"Agenda";default:return""}};return e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{variant:"outline",size:"icon",onClick:a,children:e.jsx(h.ChevronLeft,{className:"h-4 w-4"})}),e.jsx(L,{variant:"outline",size:"icon",onClick:r,children:e.jsx(h.ChevronRight,{className:"h-4 w-4"})}),e.jsx(L,{variant:"outline",size:"sm",onClick:n,children:"Aujourd'hui"}),e.jsx("h2",{className:"text-xl font-semibold ml-4 capitalize",children:f()})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[l&&o&&e.jsxs(Ve,{value:s,onValueChange:m=>o(m),children:[e.jsx($e,{className:"w-[120px]",children:e.jsx(We,{})}),e.jsxs(Le,{children:[e.jsx(je,{value:"month",children:"Mois"}),e.jsx(je,{value:"week",children:"Semaine"}),e.jsx(je,{value:"day",children:"Jour"}),e.jsx(je,{value:"agenda",children:"Agenda"})]})]}),u&&i&&e.jsxs(L,{onClick:i,children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-2"}),"Événement"]})]})]})}function ij({event:t,onClick:s,compact:a=!1}){const r=hn[t.color||"blue"],n=typeof t.start=="string"?new Date(t.start):t.start;return e.jsxs("button",{onClick:o=>{o.stopPropagation(),s?.()},className:b("w-full text-left rounded px-1.5 py-0.5 text-xs truncate border-l-2",r.bg,r.text,r.border),children:[!t.allDay&&!a&&e.jsx("span",{className:"font-medium mr-1",children:n.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})}),t.title]})}function lj({event:t,onEdit:s,onDelete:a}){const r=typeof t.start=="string"?new Date(t.start):t.start,n=typeof t.end=="string"?new Date(t.end):t.end,o=hn[t.color||"blue"];return e.jsxs("div",{className:"w-72",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("div",{className:b("w-3 h-3 rounded-full mt-1",o.bg.replace("100","500"))}),e.jsxs("div",{className:"flex gap-1",children:[s&&e.jsx(L,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:s,children:e.jsx(h.Edit,{className:"h-3 w-3"})}),a&&e.jsx(L,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a,children:e.jsx(h.Trash2,{className:"h-3 w-3"})})]})]}),e.jsx("h4",{className:"font-semibold mt-2",children:t.title}),e.jsxs("div",{className:"space-y-2 mt-3 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.Clock,{className:"h-4 w-4"}),t.allDay?e.jsx("span",{children:"Toute la journée"}):e.jsxs("span",{children:[r.toLocaleString("fr-FR",{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})," - ",n.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})]})]}),t.location&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.MapPin,{className:"h-4 w-4"}),e.jsx("span",{children:t.location})]}),t.attendees&&t.attendees.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.Users,{className:"h-4 w-4"}),e.jsxs("span",{children:[t.attendees.length," participant(s)"]})]})]}),t.description&&e.jsx("p",{className:"mt-3 text-sm",children:t.description})]})}function cj({currentDate:t,events:s,weekStartsOn:a,locale:r,onDayClick:n,onEventClick:o,onEventEdit:i,onEventDelete:l}){const u=t.getFullYear(),d=t.getMonth(),f=rj(u,d),m=new Date,p=Array.from({length:7},(y,j)=>new Date(2024,0,a+j).toLocaleDateString(r,{weekday:"short"})),C=(new Date(u,d,1).getDay()-a+7)%7,g=[];for(let y=0;y<C;y++)g.push(null);for(g.push(...f);g.length%7!==0;)g.push(null);return e.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[e.jsx("div",{className:"grid grid-cols-7 bg-muted",children:p.map(y=>e.jsx("div",{className:"p-2 text-center text-sm font-medium capitalize",children:y},y))}),e.jsx("div",{className:"grid grid-cols-7",children:g.map((y,j)=>{const x=y?nj(s,y):[],v=y&&cr(y,m),k=y&&y.getMonth()===d;return e.jsx("div",{className:b("min-h-[100px] border-t border-l p-1 cursor-pointer hover:bg-muted/50",!k&&"bg-muted/30 text-muted-foreground"),onClick:()=>y&&n?.(y),children:y&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:b("text-sm font-medium mb-1 w-7 h-7 flex items-center justify-center rounded-full",v&&"bg-primary text-primary-foreground"),children:y.getDate()}),e.jsxs("div",{className:"space-y-1",children:[x.slice(0,3).map(N=>e.jsxs(rt,{children:[e.jsx(nt,{asChild:!0,children:e.jsx("div",{children:e.jsx(ij,{event:N,onClick:()=>o?.(N),compact:!0})})}),e.jsx(st,{children:e.jsx(lj,{event:N,onEdit:()=>i?.(N.id,{}),onDelete:()=>l?.(N.id)})})]},N.id)),x.length>3&&e.jsxs("button",{className:"text-xs text-muted-foreground hover:text-foreground",children:["+",x.length-3," autres"]})]})]})},j)})})]})}function dj({currentDate:t,events:s,locale:a,onEventClick:r}){const n=s.filter(i=>{const l=typeof i.start=="string"?new Date(i.start):i.start,u=new Date(t);return u.setDate(u.getDate()+30),l>=t&&l<=u}).sort((i,l)=>{const u=typeof i.start=="string"?new Date(i.start):i.start,d=typeof l.start=="string"?new Date(l.start):l.start;return u.getTime()-d.getTime()}),o={};return n.forEach(i=>{const u=(typeof i.start=="string"?new Date(i.start):i.start).toDateString();o[u]||(o[u]=[]),o[u].push(i)}),e.jsxs("div",{className:"space-y-4",children:[Object.entries(o).map(([i,l])=>{const u=new Date(i);return e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-2 capitalize",children:u.toLocaleDateString(a,{weekday:"long",day:"numeric",month:"long"})}),e.jsx("div",{className:"space-y-2",children:l.map(d=>{const f=hn[d.color||"blue"],m=typeof d.start=="string"?new Date(d.start):d.start,p=typeof d.end=="string"?new Date(d.end):d.end;return e.jsx(ke,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>r?.(d),children:e.jsxs(Te,{className:"p-3 flex gap-3",children:[e.jsx("div",{className:b("w-1 rounded-full",f.bg.replace("100","500"))}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium",children:d.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:d.allDay?"Toute la journée":`${m.toLocaleTimeString(a,{hour:"2-digit",minute:"2-digit"})} - ${p.toLocaleTimeString(a,{hour:"2-digit",minute:"2-digit"})}`}),d.location&&e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1 mt-1",children:[e.jsx(h.MapPin,{className:"h-3 w-3"}),d.location]})]})]})},d.id)})})]},i)}),Object.keys(o).length===0&&e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Aucun événement à venir"})]})}function uj({events:t,currentDate:s,onDateChange:a,viewMode:r,onViewModeChange:n,onEventClick:o,onEventCreate:i,onEventEdit:l,onEventDelete:u,onDayClick:d,showHeader:f=!0,showViewSelector:m=!0,showAddButton:p=!0,weekStartsOn:w=1,locale:C="fr-FR",className:g}){const[y,j]=c.useState(new Date),[x,v]=c.useState("month"),[k,N]=c.useState(!1),D=s??y,P=r??x,R=T=>{a?a(T):j(T)},A=T=>{n?n(T):v(T)},S=()=>{const T=new Date(D);switch(P){case"month":T.setMonth(T.getMonth()-1);break;case"week":T.setDate(T.getDate()-7);break;case"day":T.setDate(T.getDate()-1);break}R(T)},M=()=>{const T=new Date(D);switch(P){case"month":T.setMonth(T.getMonth()+1);break;case"week":T.setDate(T.getDate()+7);break;case"day":T.setDate(T.getDate()+1);break}R(T)},E=()=>{R(new Date)};return e.jsxs("div",{className:b("space-y-4",g),children:[f&&e.jsx(oj,{currentDate:D,viewMode:P,onPrevious:S,onNext:M,onToday:E,onViewModeChange:A,onAddClick:()=>N(!0),showViewSelector:m,showAddButton:p,locale:C}),P==="month"&&e.jsx(cj,{currentDate:D,events:t,weekStartsOn:w,locale:C,onDayClick:d,onEventClick:o,onEventEdit:l,onEventDelete:u}),P==="agenda"&&e.jsx(dj,{currentDate:D,events:t,locale:C,onEventClick:o}),(P==="week"||P==="day")&&e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:["Vue ",P==="week"?"semaine":"jour"," - À implémenter"]})]})}const mj=[{id:"1",title:"Réunion d'équipe",start:new Date,end:new Date(Date.now()+1e3*60*60),color:"blue",location:"Salle de réunion A"},{id:"2",title:"Déjeuner avec le client",start:new Date(Date.now()+1e3*60*60*24),end:new Date(Date.now()+1e3*60*60*25),color:"green",location:"Restaurant Le Gourmet"},{id:"3",title:"Formation React",start:new Date(Date.now()+1e3*60*60*24*2),end:new Date(Date.now()+1e3*60*60*24*2+1e3*60*60*4),color:"purple",allDay:!0},{id:"4",title:"Deadline projet",start:new Date(Date.now()+1e3*60*60*24*5),end:new Date(Date.now()+1e3*60*60*24*5),color:"red",allDay:!0}];function hj({conversations:t,activeId:s,currentUser:a,onSelect:r,onSearch:n}){const[o,i]=c.useState(""),l=m=>m.name?m.name:m.participants.filter(w=>w.id!==a.id).map(w=>w.name).join(", "),u=m=>{if(m.avatar)return{url:m.avatar,fallback:m.name?.charAt(0)||"G"};if(m.isGroup)return{fallback:"G"};const p=m.participants.find(w=>w.id!==a.id);return{url:p?.avatar,fallback:p?.name.charAt(0)||"?"}},d=m=>{if(!m)return"";const p=typeof m=="string"?new Date(m):m,C=new Date().getTime()-p.getTime(),g=Math.floor(C/(1e3*60*60*24));return g===0?p.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"}):g===1?"Hier":g<7?p.toLocaleDateString("fr-FR",{weekday:"short"}):p.toLocaleDateString("fr-FR",{day:"numeric",month:"short"})},f=t.filter(m=>o?l(m).toLowerCase().includes(o.toLowerCase()):!0);return e.jsxs("div",{className:"flex flex-col h-full border-r",children:[e.jsx("div",{className:"p-3 border-b",children:e.jsxs("div",{className:"relative",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{placeholder:"Rechercher...",value:o,onChange:m=>{i(m.target.value),n?.(m.target.value)},className:"pl-9"})]})}),e.jsx(At,{className:"flex-1",children:f.map(m=>{const p=u(m),w=l(m),C=m.participants.find(g=>g.id!==a.id);return e.jsxs("button",{onClick:()=>r(m),className:b("w-full flex items-center gap-3 p-3 hover:bg-muted/50 transition-colors text-left",s===m.id&&"bg-muted"),children:[e.jsxs("div",{className:"relative",children:[e.jsxs(yt,{children:[e.jsx(Nt,{src:p.url}),e.jsx(Ct,{children:p.fallback})]}),C?.status==="online"&&e.jsx("div",{className:"absolute bottom-0 right-0 h-3 w-3 rounded-full bg-green-500 border-2 border-background"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:w}),e.jsx("span",{className:"text-xs text-muted-foreground",children:d(m.lastMessage?.timestamp)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:m.lastMessage?.content||"Aucun message"}),m.unreadCount&&m.unreadCount>0&&e.jsx(Se,{className:"h-5 min-w-[20px] justify-center",children:m.unreadCount})]})]})]},m.id)})})]})}function fj({conversation:t,currentUser:s,onAudioCall:a,onVideoCall:r}){const n=t.participants.find(l=>l.id!==s.id),o=t.name||n?.name||"Chat",i=()=>t.isGroup?`${t.participants.length} participants`:n?.status==="online"?"En ligne":n?.lastSeen?`Vu ${(typeof n.lastSeen=="string"?new Date(n.lastSeen):n.lastSeen).toLocaleString("fr-FR")}`:"Hors ligne";return e.jsxs("div",{className:"flex items-center justify-between p-3 border-b",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(yt,{children:[e.jsx(Nt,{src:t.avatar||n?.avatar}),e.jsx(Ct,{children:o.charAt(0)})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-sm",children:o}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i()})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[a&&e.jsx(L,{variant:"ghost",size:"icon",onClick:a,children:e.jsx(h.Phone,{className:"h-4 w-4"})}),r&&e.jsx(L,{variant:"ghost",size:"icon",onClick:r,children:e.jsx(h.Video,{className:"h-4 w-4"})}),e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx(L,{variant:"ghost",size:"icon",children:e.jsx(h.MoreVertical,{className:"h-4 w-4"})})}),e.jsx(_e,{align:"end",children:e.jsxs(pe,{children:[e.jsx(h.Settings,{className:"mr-2 h-4 w-4"}),"Paramètres"]})})]})]})]})}function pj({message:t,isOwn:s,showStatus:a,showTimestamp:r,onDelete:n,onReply:o}){const i=u=>(typeof u=="string"?new Date(u):u).toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"}),l=()=>{switch(t.status){case"sending":return e.jsx("div",{className:"h-3 w-3 rounded-full border-2 border-current animate-pulse"});case"sent":return e.jsx(h.Check,{className:"h-3 w-3"});case"delivered":return e.jsx(h.CheckCheck,{className:"h-3 w-3"});case"read":return e.jsx(h.CheckCheck,{className:"h-3 w-3 text-blue-500"});case"error":return e.jsx(h.X,{className:"h-3 w-3 text-red-500"});default:return null}};return e.jsxs("div",{className:b("flex gap-2 group",s?"flex-row-reverse":"flex-row"),children:[!s&&e.jsxs(yt,{className:"h-8 w-8",children:[e.jsx(Nt,{src:t.sender.avatar}),e.jsx(Ct,{className:"text-xs",children:t.sender.name.charAt(0)})]}),e.jsxs("div",{className:b("max-w-[70%]",s&&"items-end"),children:[t.replyTo&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-1 p-2 bg-muted/50 rounded border-l-2 border-primary",children:[e.jsx("span",{className:"font-medium",children:t.replyTo.sender.name}),e.jsx("p",{className:"truncate",children:t.replyTo.content})]}),e.jsxs("div",{className:b("relative rounded-2xl px-4 py-2",s?"bg-primary text-primary-foreground rounded-tr-sm":"bg-muted rounded-tl-sm"),children:[t.attachments&&t.attachments.length>0&&e.jsx("div",{className:"space-y-2 mb-2",children:t.attachments.map((u,d)=>e.jsx("div",{children:u.type==="image"?e.jsx("img",{src:u.url,alt:u.name,className:"rounded-lg max-w-full"}):e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-background/10 rounded",children:[e.jsx(h.File,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm truncate",children:u.name})]})},d))}),e.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:t.content}),e.jsxs("div",{className:b("absolute top-0 opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1",s?"-left-20":"-right-20"),children:[e.jsx(L,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>o?.(t),children:e.jsx(h.Reply,{className:"h-3 w-3"})}),s&&n&&e.jsx(L,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(t.id),children:e.jsx(h.Trash2,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:b("flex items-center gap-1 mt-1 text-xs text-muted-foreground",s&&"justify-end"),children:[r&&e.jsx("span",{children:i(t.timestamp)}),t.isEdited&&e.jsx("span",{children:"(modifié)"}),s&&a&&l()]})]})]})}function xj({onSend:t,replyTo:s,onCancelReply:a,showAttachments:r,showEmoji:n,placeholder:o,sending:i}){const[l,u]=c.useState(""),d=c.useRef(null),f=()=>{l.trim()&&!i&&(t(l.trim()),u(""))},m=p=>{p.key==="Enter"&&!p.shiftKey&&(p.preventDefault(),f())};return e.jsxs("div",{className:"border-t p-3",children:[s&&e.jsxs("div",{className:"flex items-center justify-between mb-2 p-2 bg-muted rounded text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.Reply,{className:"h-4 w-4 text-primary"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:s.sender.name}),e.jsx("p",{className:"text-muted-foreground truncate",children:s.content})]})]}),e.jsx(L,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:a,children:e.jsx(h.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[r&&e.jsx(L,{variant:"ghost",size:"icon",children:e.jsx(h.Paperclip,{className:"h-4 w-4"})}),e.jsx(oe,{ref:d,value:l,onChange:p=>u(p.target.value),onKeyDown:m,placeholder:o,className:"flex-1",disabled:i}),n&&e.jsx(L,{variant:"ghost",size:"icon",children:e.jsx(h.Smile,{className:"h-4 w-4"})}),e.jsx(L,{onClick:f,disabled:!l.trim()||i,children:e.jsx(h.Send,{className:"h-4 w-4"})})]})]})}function gj({conversations:t=[],activeConversation:s,messages:a,currentUser:r,onSendMessage:n,onConversationSelect:o,onMessageDelete:i,onMessageReply:l,onSearch:u,onAudioCall:d,onVideoCall:f,showConversationList:m=!0,showHeader:p=!0,showMessageStatus:w=!0,showTimestamps:C=!0,showAttachments:g=!0,showEmoji:y=!0,inputPlaceholder:j="Écrire un message...",sending:x=!1,loading:v=!1,layout:k="full",className:N}){const[D,P]=c.useState(null),R=c.useRef(null);c.useEffect(()=>{R.current?.scrollIntoView({behavior:"smooth"})},[a]);const A=(E,T)=>{n?.(E,T),P(null)},S=E=>{P(E),l?.(E)},M={full:"h-screen",embedded:"h-[600px]",floating:"h-[500px] w-[400px] rounded-lg shadow-xl"};return e.jsxs("div",{className:b("flex bg-background",M[k],N),children:[m&&e.jsx("div",{className:"w-80 flex-shrink-0",children:e.jsx(hj,{conversations:t,activeId:s?.id,currentUser:r,onSelect:E=>o?.(E),onSearch:u})}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:s?e.jsxs(e.Fragment,{children:[p&&e.jsx(fj,{conversation:s,currentUser:r,onAudioCall:d,onVideoCall:f}),e.jsx(At,{className:"flex-1 p-4",children:e.jsxs("div",{className:"space-y-4",children:[a.map(E=>e.jsx(pj,{message:E,isOwn:E.sender.id===r.id,showStatus:w,showTimestamp:C,onDelete:i,onReply:S},E.id)),e.jsx("div",{ref:R})]})}),e.jsx(xj,{onSend:A,replyTo:D,onCancelReply:()=>P(null),showAttachments:g,showEmoji:y,placeholder:j,sending:x})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Sélectionnez une conversation"})})]})}const Bs={id:"current",name:"Moi",status:"online"},bj=[{id:"1",participants:[Bs,{id:"2",name:"Marie Dupont",status:"online"}],lastMessage:{id:"m1",content:"D'accord, je m'en occupe !",sender:{id:"2",name:"Marie Dupont"},timestamp:new Date(Date.now()-1e3*60*5),status:"read"},unreadCount:0},{id:"2",participants:[Bs,{id:"3",name:"Pierre Martin",status:"offline"}],lastMessage:{id:"m2",content:"On se voit demain ?",sender:Bs,timestamp:new Date(Date.now()-1e3*60*60),status:"delivered"},unreadCount:2}],jj=[{id:"1",content:"Salut ! Comment ça va ?",sender:{id:"2",name:"Marie Dupont"},timestamp:new Date(Date.now()-1e3*60*30),status:"read"},{id:"2",content:"Ça va bien merci ! Et toi ?",sender:Bs,timestamp:new Date(Date.now()-1e3*60*25),status:"read"},{id:"3",content:"Super ! Tu as vu le nouveau projet ?",sender:{id:"2",name:"Marie Dupont"},timestamp:new Date(Date.now()-1e3*60*20),status:"read"}],ac={"no-data":{title:"Aucune donnée",description:"Il n'y a pas encore de données à afficher.",icon:h.Inbox,actionLabel:"Ajouter",actionIcon:h.Plus},"no-results":{title:"Aucun résultat",description:"Aucun élément ne correspond à votre recherche.",icon:h.Search,actionLabel:"Effacer les filtres",actionIcon:h.Filter},"no-messages":{title:"Aucun message",description:"Votre boîte de réception est vide.",icon:h.MessageSquare,actionLabel:"Nouveau message",actionIcon:h.Plus},"no-files":{title:"Aucun fichier",description:"Vous n'avez pas encore de fichiers.",icon:h.FolderOpen,actionLabel:"Importer un fichier",actionIcon:h.Upload},"no-users":{title:"Aucun utilisateur",description:"Il n'y a pas encore d'utilisateurs.",icon:h.Users,actionLabel:"Inviter des utilisateurs",actionIcon:h.Plus},"no-cart":{title:"Panier vide",description:"Votre panier est vide.",icon:h.ShoppingCart,actionLabel:"Parcourir les produits",actionIcon:h.ArrowRight},"no-notifications":{title:"Aucune notification",description:"Vous êtes à jour !",icon:h.Bell},"no-events":{title:"Aucun événement",description:"Aucun événement prévu.",icon:h.Calendar,actionLabel:"Créer un événement",actionIcon:h.Plus},"no-images":{title:"Aucune image",description:"Vous n'avez pas encore d'images.",icon:h.Image,actionLabel:"Importer des images",actionIcon:h.Upload},"no-bookmarks":{title:"Aucun favori",description:"Vous n'avez pas encore de favoris.",icon:h.Bookmark,actionLabel:"Parcourir",actionIcon:h.ArrowRight},"no-favorites":{title:"Aucun favori",description:"Vous n'avez pas encore aimé de contenu.",icon:h.Heart},error:{title:"Une erreur est survenue",description:"Impossible de charger les données.",icon:h.FileQuestion,actionLabel:"Réessayer",actionIcon:h.RefreshCw},custom:{title:"Aucun élément",description:"Il n'y a rien à afficher.",icon:h.Inbox}};function xo({type:t,size:s,className:a}){const n=ac[t].icon,i={sm:{container:"h-24 w-24",icon:"h-8 w-8",circles:{outer:"h-20 w-20",inner:"h-14 w-14"}},md:{container:"h-32 w-32",icon:"h-10 w-10",circles:{outer:"h-28 w-28",inner:"h-20 w-20"}},lg:{container:"h-40 w-40",icon:"h-12 w-12",circles:{outer:"h-36 w-36",inner:"h-28 w-28"}}}[s];return e.jsxs("div",{className:b("relative flex items-center justify-center",i.container,a),children:[e.jsx("div",{className:b("absolute rounded-full bg-muted/50",i.circles.outer)}),e.jsx("div",{className:b("absolute rounded-full bg-muted",i.circles.inner)}),e.jsx("div",{className:"relative z-10 flex items-center justify-center rounded-full bg-background p-4 shadow-sm",children:e.jsx(n,{className:b(i.icon,"text-muted-foreground")})}),e.jsx("div",{className:"absolute -right-1 top-2 h-2 w-2 rounded-full bg-primary/20"}),e.jsx("div",{className:"absolute -left-1 bottom-4 h-1.5 w-1.5 rounded-full bg-primary/30"}),e.jsx("div",{className:"absolute right-4 bottom-0 h-2.5 w-2.5 rounded-full bg-primary/10"})]})}function rs({type:t="no-data",title:s,description:a,icon:r,actions:n,illustration:o,showIllustration:i=!0,size:l="md",layout:u="vertical",centered:d=!0,children:f,className:m}){const p=ac[t],w=s??p.title,C=a??p.description;p.icon;const g={sm:{container:"py-8 px-4",title:"text-base",description:"text-sm",icon:"h-8 w-8"},md:{container:"py-12 px-6",title:"text-lg",description:"text-sm",icon:"h-10 w-10"},lg:{container:"py-16 px-8",title:"text-xl",description:"text-base",icon:"h-12 w-12"}},y=[];if(p.actionLabel&&!n){const x=p.actionIcon;y.push({label:p.actionLabel,variant:"default",icon:x?e.jsx(x,{className:"h-4 w-4"}):void 0})}const j=n||(y.length>0?y:void 0);return u==="horizontal"?e.jsxs("div",{className:b("flex items-center gap-6",g[l].container,d&&"justify-center",m),children:[i&&e.jsx("div",{className:"flex-shrink-0",children:o||(r?e.jsx("div",{className:"flex items-center justify-center rounded-full bg-muted p-4",children:r}):e.jsx(xo,{type:t,size:l}))}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("h3",{className:b("font-semibold",g[l].title),children:w}),e.jsx("p",{className:b("text-muted-foreground mt-1",g[l].description),children:C}),f&&e.jsx("div",{className:"mt-4",children:f}),j&&j.length>0&&e.jsx("div",{className:"flex gap-3 mt-4",children:j.map((x,v)=>e.jsx(L,{variant:x.variant||"default",size:"sm",onClick:x.onClick,asChild:!!x.href,children:x.href?e.jsxs("a",{href:x.href,children:[x.icon&&e.jsx("span",{className:"mr-2",children:x.icon}),x.label]}):e.jsxs(e.Fragment,{children:[x.icon&&e.jsx("span",{className:"mr-2",children:x.icon}),x.label]})},v))})]})]}):e.jsxs("div",{className:b("flex flex-col items-center",d&&"text-center",g[l].container,m),children:[i&&e.jsx("div",{className:"mb-6",children:o||(r?e.jsx("div",{className:"flex items-center justify-center rounded-full bg-muted p-6",children:c.cloneElement(r,{className:b(g[l].icon,"text-muted-foreground")})}):e.jsx(xo,{type:t,size:l}))}),e.jsx("h3",{className:b("font-semibold",g[l].title),children:w}),e.jsx("p",{className:b("text-muted-foreground mt-2 max-w-sm",g[l].description),children:C}),f&&e.jsx("div",{className:"mt-4",children:f}),j&&j.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3 mt-6 justify-center",children:j.map((x,v)=>e.jsx(L,{variant:x.variant||"default",onClick:x.onClick,asChild:!!x.href,children:x.href?e.jsxs("a",{href:x.href,children:[x.icon&&e.jsx("span",{className:"mr-2",children:x.icon}),x.label]}):e.jsxs(e.Fragment,{children:[x.icon&&e.jsx("span",{className:"mr-2",children:x.icon}),x.label]})},v))})]})}function vj(t){return e.jsx(rs,{type:"no-data",...t})}function wj(t){return e.jsx(rs,{type:"no-results",...t})}function yj(t){return e.jsx(rs,{type:"no-messages",...t})}function Nj(t){return e.jsx(rs,{type:"no-files",...t})}function Cj(t){return e.jsx(rs,{type:"no-cart",...t})}function kj(t){return e.jsx(rs,{type:"no-notifications",...t})}function Sj(t){return e.jsx(rs,{type:"error",...t})}const rc={404:{code:"404",title:"Page non trouvée",description:"Désolé, la page que vous recherchez n'existe pas ou a été déplacée.",icon:h.FileQuestion},500:{code:"500",title:"Erreur serveur",description:"Une erreur inattendue s'est produite. Notre équipe a été notifiée.",icon:h.ServerCrash},403:{code:"403",title:"Accès refusé",description:"Vous n'avez pas les permissions nécessaires pour accéder à cette page.",icon:h.ShieldX},503:{code:"503",title:"Service indisponible",description:"Le service est temporairement indisponible. Veuillez réessayer plus tard.",icon:h.ServerCrash},offline:{code:"Hors ligne",title:"Vous êtes hors ligne",description:"Vérifiez votre connexion internet et réessayez.",icon:h.Wifi},maintenance:{code:"Maintenance",title:"Maintenance en cours",description:"Nous effectuons une maintenance. Nous serons bientôt de retour.",icon:h.Construction},custom:{code:"",title:"Erreur",description:"Une erreur s'est produite.",icon:h.FileQuestion}};function go({type:t,className:s}){const r=rc[t].icon;return e.jsxs("div",{className:b("relative flex items-center justify-center",s),children:[e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"h-48 w-48 rounded-full bg-muted/50"})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"h-32 w-32 rounded-full bg-muted"})}),e.jsx("div",{className:"relative z-10 flex h-20 w-20 items-center justify-center rounded-full bg-background shadow-lg",children:e.jsx(r,{className:"h-10 w-10 text-muted-foreground"})}),e.jsx("div",{className:"absolute -right-4 top-4 h-3 w-3 rounded-full bg-primary/20"}),e.jsx("div",{className:"absolute -left-2 bottom-8 h-2 w-2 rounded-full bg-primary/30"}),e.jsx("div",{className:"absolute right-8 bottom-2 h-4 w-4 rounded-full bg-primary/10"})]})}function Ms({type:t="404",code:s,title:a,description:r,actions:n,illustration:o,showCode:i=!0,showIllustration:l=!0,showBackButton:u=!0,onBack:d,showHomeButton:f=!0,homeUrl:m="/",showRefreshButton:p=!1,children:w,layout:C="centered",size:g="md",className:y}){const j=rc[t],x=s??j.code,v=a??j.title,k=r??j.description,N={sm:{container:"py-12 px-4",code:"text-6xl",title:"text-xl",description:"text-sm",illustration:"h-32 w-32"},md:{container:"py-16 px-6",code:"text-8xl",title:"text-2xl",description:"text-base",illustration:"h-48 w-48"},lg:{container:"py-24 px-8",code:"text-9xl",title:"text-3xl",description:"text-lg",illustration:"h-64 w-64"}},D=[];u&&D.push({label:"Retour",onClick:d||(()=>window.history.back()),variant:"outline",icon:e.jsx(h.ArrowLeft,{className:"h-4 w-4"})}),f&&D.push({label:"Accueil",href:m,variant:"default",icon:e.jsx(h.Home,{className:"h-4 w-4"})}),p&&D.push({label:"Réessayer",onClick:()=>window.location.reload(),variant:"secondary",icon:e.jsx(h.RefreshCw,{className:"h-4 w-4"})});const P=n||D,R=()=>e.jsxs("div",{className:"flex flex-col items-center text-center",children:[l&&e.jsx("div",{className:b("mb-8",N[g].illustration),children:o||e.jsx(go,{type:t})}),i&&x&&e.jsx("div",{className:b("font-bold text-muted-foreground/20 mb-4",N[g].code),children:x}),e.jsx("h1",{className:b("font-bold tracking-tight mb-4",N[g].title),children:v}),e.jsx("p",{className:b("text-muted-foreground max-w-md mb-8",N[g].description),children:k}),w&&e.jsx("div",{className:"mb-8",children:w}),P.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3 justify-center",children:P.map((A,S)=>e.jsx(L,{variant:A.variant||"default",onClick:A.onClick,asChild:!!A.href,children:A.href?e.jsxs("a",{href:A.href,children:[A.icon&&e.jsx("span",{className:"mr-2",children:A.icon}),A.label]}):e.jsxs(e.Fragment,{children:[A.icon&&e.jsx("span",{className:"mr-2",children:A.icon}),A.label]})},S))})]});return C==="split"?e.jsxs("div",{className:b("min-h-screen flex flex-col lg:flex-row",y),children:[e.jsx("div",{className:"flex-1 bg-muted/30 flex items-center justify-center p-8 lg:p-16",children:e.jsx("div",{className:N[g].illustration,children:o||e.jsx(go,{type:t})})}),e.jsx("div",{className:"flex-1 flex items-center justify-center p-8 lg:p-16",children:e.jsxs("div",{className:"max-w-md",children:[i&&x&&e.jsx("div",{className:b("font-bold text-primary mb-4",g==="sm"?"text-4xl":g==="md"?"text-5xl":"text-6xl"),children:x}),e.jsx("h1",{className:b("font-bold tracking-tight mb-4",N[g].title),children:v}),e.jsx("p",{className:b("text-muted-foreground mb-8",N[g].description),children:k}),w&&e.jsx("div",{className:"mb-8",children:w}),P.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3",children:P.map((A,S)=>e.jsx(L,{variant:A.variant||"default",onClick:A.onClick,asChild:!!A.href,children:A.href?e.jsxs("a",{href:A.href,children:[A.icon&&e.jsx("span",{className:"mr-2",children:A.icon}),A.label]}):e.jsxs(e.Fragment,{children:[A.icon&&e.jsx("span",{className:"mr-2",children:A.icon}),A.label]})},S))})]})})]}):e.jsx("div",{className:b("min-h-screen flex items-center justify-center",N[g].container,y),children:R()})}function Dj(t){return e.jsx(Ms,{type:"404",...t})}function Tj(t){return e.jsx(Ms,{type:"500",showRefreshButton:!0,...t})}function Aj(t){return e.jsx(Ms,{type:"403",...t})}function Ej(t){return e.jsx(Ms,{type:"maintenance",showBackButton:!1,showHomeButton:!1,...t})}function Mj(t){return e.jsx(Ms,{type:"offline",showRefreshButton:!0,...t})}function Pj({value:t,onChange:s,placeholder:a}){return e.jsxs("div",{className:"relative",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{type:"text",placeholder:a,value:t,onChange:r=>s(r.target.value),className:"pl-10"})]})}function Rj({categories:t,activeCategory:s,onCategoryChange:a,itemCounts:r}){return e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>a(null),className:b("inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-colors",s===null?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),children:["Tous",e.jsx(Se,{variant:"secondary",className:"ml-1",children:Object.values(r).reduce((n,o)=>n+o,0)})]}),t.map(n=>e.jsxs("button",{type:"button",onClick:()=>a(n.id),className:b("inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-colors",s===n.id?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),children:[n.icon,n.name,e.jsx(Se,{variant:"secondary",className:"ml-1",children:r[n.id]||0})]},n.id))]})}function Fj({itemId:t,helpful:s=0,notHelpful:a=0,onFeedback:r}){const[n,o]=c.useState(null),i=l=>{n===null&&(o(l),r(t,l))};return e.jsxs("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Cette réponse vous a-t-elle aidé ?"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>i(!0),disabled:n!==null,className:b("inline-flex items-center gap-1 px-2 py-1 text-sm rounded transition-colors",n===!0?"bg-green-100 text-green-700":n===null?"hover:bg-muted":"opacity-50"),children:["👍 ",s+(n===!0?1:0)]}),e.jsxs("button",{type:"button",onClick:()=>i(!1),disabled:n!==null,className:b("inline-flex items-center gap-1 px-2 py-1 text-sm rounded transition-colors",n===!1?"bg-red-100 text-red-700":n===null?"hover:bg-muted":"opacity-50"),children:["👎 ",a+(n===!1?1:0)]})]})]})}function $j({items:t,categories:s=[],title:a="Questions fréquentes",description:r,showSearch:n=!0,searchPlaceholder:o="Rechercher une question...",showCategoryFilter:i=!0,activeCategory:l,onCategoryChange:u,allowMultiple:d=!1,defaultOpen:f=[],showFeedback:m=!1,onFeedback:p,layout:w="default",size:C="md",className:g}){const[y,j]=c.useState(""),[x,v]=c.useState(null),k=l??x,N=E=>{u?u(E):v(E)},D=c.useMemo(()=>t.filter(E=>{if(y){const T=y.toLowerCase();if(!(E.question.toLowerCase().includes(T)||typeof E.answer=="string"&&E.answer.toLowerCase().includes(T)||E.tags?.some(q=>q.toLowerCase().includes(T))))return!1}return!(k&&E.category!==k)}),[t,y,k]),P=c.useMemo(()=>{const E={};return t.forEach(T=>{T.category&&(E[T.category]=(E[T.category]||0)+1)}),E},[t]),R=c.useMemo(()=>{if(w!=="grouped")return null;const E={};return D.forEach(T=>{const K=T.category||"other";E[K]||(E[K]=[]),E[K].push(T)}),E},[D,w]),A={sm:{title:"text-xl",question:"text-sm",answer:"text-sm"},md:{title:"text-2xl",question:"text-base",answer:"text-sm"},lg:{title:"text-3xl",question:"text-lg",answer:"text-base"}},S=E=>e.jsx(e.Fragment,{children:E.map(T=>e.jsxs(ur,{value:T.id,className:b(w==="cards"&&"border rounded-lg px-4 bg-card"),children:[e.jsx(mr,{className:b("hover:no-underline",A[C].question),children:e.jsx("span",{className:"text-left",children:T.question})}),e.jsxs(hr,{children:[e.jsx("div",{className:b("text-muted-foreground",A[C].answer),children:typeof T.answer=="string"?e.jsx("p",{children:T.answer}):T.answer}),T.tags&&T.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-3",children:T.tags.map(K=>e.jsx(Se,{variant:"outline",className:"text-xs",children:K},K))}),m&&p&&e.jsx(Fj,{itemId:T.id,helpful:T.helpful,notHelpful:T.notHelpful,onFeedback:p})]})]},T.id))}),M=E=>d?e.jsx(rr,{type:"multiple",defaultValue:f,className:"space-y-2",children:S(E)}):e.jsx(rr,{type:"single",defaultValue:f[0],collapsible:!0,className:"space-y-2",children:S(E)});return e.jsxs("div",{className:b("space-y-6",g),children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:b("font-bold tracking-tight",A[C].title),children:a}),r&&e.jsx("p",{className:"text-muted-foreground mt-2 max-w-2xl mx-auto",children:r})]}),n&&e.jsx("div",{className:"max-w-md mx-auto",children:e.jsx(Pj,{value:y,onChange:j,placeholder:o})}),i&&s.length>0&&e.jsx("div",{className:"flex justify-center",children:e.jsx(Rj,{categories:s,activeCategory:k,onCategoryChange:N,itemCounts:P})}),D.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(h.HelpCircle,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Aucune question ne correspond à votre recherche."})]}):w==="grouped"&&R?e.jsx("div",{className:"space-y-8",children:Object.entries(R).map(([E,T])=>{const K=s.find(q=>q.id===E);return e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[K?.icon,K?.name||E]}),M(T)]},E)})}):e.jsx("div",{className:"max-w-3xl mx-auto",children:M(D)})]})}const Lj=[{id:"general",name:"Général",icon:e.jsx(h.HelpCircle,{className:"h-4 w-4"})},{id:"billing",name:"Facturation",icon:e.jsx(h.MessageCircle,{className:"h-4 w-4"})},{id:"technical",name:"Technique",icon:e.jsx(h.MessageCircle,{className:"h-4 w-4"})}],Ij=[{id:"1",question:"Comment créer un compte ?",answer:"Pour créer un compte, cliquez sur le bouton 'S'inscrire' en haut à droite de la page, puis remplissez le formulaire avec vos informations personnelles.",category:"general",tags:["compte","inscription"]},{id:"2",question:"Comment réinitialiser mon mot de passe ?",answer:"Cliquez sur 'Mot de passe oublié' sur la page de connexion, entrez votre email et suivez les instructions envoyées par email.",category:"general",tags:["mot de passe","sécurité"]},{id:"3",question:"Quels moyens de paiement acceptez-vous ?",answer:"Nous acceptons les cartes de crédit (Visa, Mastercard, Amex), PayPal et les virements bancaires pour les entreprises.",category:"billing",tags:["paiement","carte"]},{id:"4",question:"Comment annuler mon abonnement ?",answer:"Vous pouvez annuler votre abonnement à tout moment depuis les paramètres de votre compte, section 'Abonnement'.",category:"billing",tags:["abonnement","annulation"]},{id:"5",question:"L'API est-elle disponible ?",answer:"Oui, notre API REST est disponible pour tous les plans payants. Consultez notre documentation développeur pour plus d'informations.",category:"technical",tags:["API","développeur"]}],Oj={folder:{icon:h.Folder,color:"text-yellow-500"},document:{icon:h.FileText,color:"text-blue-500"},image:{icon:h.FileImage,color:"text-green-500"},video:{icon:h.FileVideo,color:"text-purple-500"},audio:{icon:h.FileAudio,color:"text-pink-500"},archive:{icon:h.FileArchive,color:"text-orange-500"},code:{icon:h.FileCode,color:"text-cyan-500"},other:{icon:h.File,color:"text-gray-500"}};function bo(t){if(!t)return"-";const s=["B","KB","MB","GB","TB"];let a=0,r=t;for(;r>=1024&&a<s.length-1;)r/=1024,a++;return`${r.toFixed(1)} ${s[a]}`}function zj({breadcrumbs:t,viewMode:s,onViewModeChange:a,onNavigate:r,onCreateFolder:n,onUpload:o,onRefresh:i,showSearch:l,onSearch:u,selectedCount:d,onDeleteSelected:f,onDownloadSelected:m}){const[p,w]=c.useState("");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[i&&e.jsx(L,{variant:"outline",size:"icon",onClick:i,children:e.jsx(h.RefreshCw,{className:"h-4 w-4"})}),o&&e.jsxs(L,{variant:"outline",onClick:o,children:[e.jsx(h.Upload,{className:"h-4 w-4 mr-2"}),"Importer"]}),n&&e.jsxs(L,{variant:"outline",onClick:n,children:[e.jsx(h.FolderPlus,{className:"h-4 w-4 mr-2"}),"Nouveau dossier"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[l&&u&&e.jsxs("div",{className:"relative w-64",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{placeholder:"Rechercher...",value:p,onChange:C=>{w(C.target.value),u(C.target.value)},className:"pl-9"})]}),e.jsx(L,{variant:s==="grid"?"secondary":"ghost",size:"icon",onClick:()=>a("grid"),children:e.jsx(h.Grid,{className:"h-4 w-4"})}),e.jsx(L,{variant:s==="list"?"secondary":"ghost",size:"icon",onClick:()=>a("list"),children:e.jsx(h.List,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[e.jsx("button",{onClick:()=>r("/"),className:"flex items-center gap-1 hover:text-primary",children:e.jsx(h.Home,{className:"h-4 w-4"})}),t.map((C,g)=>e.jsxs(c.Fragment,{children:[e.jsx(h.ChevronRight,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("button",{onClick:()=>r(C.path),className:b("hover:text-primary",g===t.length-1&&"font-medium"),children:C.name})]},C.id))]}),d>0&&e.jsxs("div",{className:"flex items-center gap-4 p-3 bg-muted rounded-lg",children:[e.jsxs("span",{className:"text-sm font-medium",children:[d," élément(s) sélectionné(s)"]}),m&&e.jsxs(L,{variant:"outline",size:"sm",onClick:m,children:[e.jsx(h.Download,{className:"h-4 w-4 mr-2"}),"Télécharger"]}),f&&e.jsxs(L,{variant:"destructive",size:"sm",onClick:f,children:[e.jsx(h.Trash2,{className:"h-4 w-4 mr-2"}),"Supprimer"]})]})]})}function jo({file:t,viewMode:s,isSelected:a,onSelect:r,onOpen:n,onRename:o,onDelete:i,onDownload:l,onShare:u,onToggleStar:d}){const f=Oj[t.type],m=f.icon,p=typeof t.modifiedAt=="string"?new Date(t.modifiedAt):t.modifiedAt,w=()=>{t.type==="folder"&&n()};return s==="grid"?e.jsxs("div",{className:b("relative group p-4 rounded-lg border cursor-pointer transition-colors",a?"bg-primary/10 border-primary":"hover:bg-muted"),onClick:()=>r(!a),onDoubleClick:w,children:[e.jsx("div",{className:"absolute top-2 left-2 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(Ze,{checked:a,onCheckedChange:C=>r(C),onClick:C=>C.stopPropagation()})}),t.starred&&e.jsx(h.Star,{className:"absolute top-2 right-2 h-4 w-4 text-yellow-500 fill-yellow-500"}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[t.thumbnail&&t.type==="image"?e.jsx("img",{src:t.thumbnail,alt:t.name,className:"w-16 h-16 object-cover rounded"}):e.jsx(m,{className:b("h-12 w-12",f.color)}),e.jsx("span",{className:"text-sm font-medium text-center line-clamp-2",children:t.name}),t.type!=="folder"&&e.jsx("span",{className:"text-xs text-muted-foreground",children:bo(t.size)})]}),e.jsx("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,onClick:C=>C.stopPropagation(),children:e.jsx(L,{variant:"ghost",size:"icon",className:"h-7 w-7",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(_e,{align:"end",children:[e.jsxs(pe,{onClick:n,children:[e.jsx(h.Eye,{className:"mr-2 h-4 w-4"}),"Ouvrir"]}),o&&e.jsxs(pe,{onClick:o,children:[e.jsx(h.Edit,{className:"mr-2 h-4 w-4"}),"Renommer"]}),l&&t.type!=="folder"&&e.jsxs(pe,{onClick:l,children:[e.jsx(h.Download,{className:"mr-2 h-4 w-4"}),"Télécharger"]}),u&&e.jsxs(pe,{onClick:u,children:[e.jsx(h.Share2,{className:"mr-2 h-4 w-4"}),"Partager"]}),d&&e.jsx(pe,{onClick:d,children:t.starred?e.jsxs(e.Fragment,{children:[e.jsx(h.StarOff,{className:"mr-2 h-4 w-4"}),"Retirer des favoris"]}):e.jsxs(e.Fragment,{children:[e.jsx(h.Star,{className:"mr-2 h-4 w-4"}),"Ajouter aux favoris"]})}),i&&e.jsxs(e.Fragment,{children:[e.jsx(Qe,{}),e.jsxs(pe,{onClick:i,className:"text-destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]})})]}):e.jsxs(qt,{className:b("cursor-pointer",a&&"bg-primary/10"),onClick:()=>r(!a),onDoubleClick:w,children:[e.jsx(tt,{className:"w-12",children:e.jsx(Ze,{checked:a,onCheckedChange:C=>r(C),onClick:C=>C.stopPropagation()})}),e.jsx(tt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(m,{className:b("h-5 w-5",f.color)}),e.jsx("span",{className:"font-medium",children:t.name}),t.starred&&e.jsx(h.Star,{className:"h-4 w-4 text-yellow-500 fill-yellow-500"}),t.shared&&e.jsx(Se,{variant:"secondary",className:"text-xs",children:"Partagé"})]})}),e.jsx(tt,{className:"text-muted-foreground",children:bo(t.size)}),e.jsx(tt,{className:"text-muted-foreground",children:p.toLocaleDateString("fr-FR")}),e.jsx(tt,{children:e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,onClick:C=>C.stopPropagation(),children:e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(_e,{align:"end",children:[e.jsxs(pe,{onClick:n,children:[e.jsx(h.Eye,{className:"mr-2 h-4 w-4"}),"Ouvrir"]}),o&&e.jsxs(pe,{onClick:o,children:[e.jsx(h.Edit,{className:"mr-2 h-4 w-4"}),"Renommer"]}),l&&t.type!=="folder"&&e.jsxs(pe,{onClick:l,children:[e.jsx(h.Download,{className:"mr-2 h-4 w-4"}),"Télécharger"]}),i&&e.jsxs(e.Fragment,{children:[e.jsx(Qe,{}),e.jsxs(pe,{onClick:i,className:"text-destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]})})]})}function _j({files:t,currentPath:s="/",breadcrumbs:a=[],selectedFiles:r=[],onSelectionChange:n,onNavigate:o,onFileOpen:i,onDownload:l,onDelete:u,onRename:d,onCopy:f,onMove:m,onCreateFolder:p,onUpload:w,onShare:C,onToggleStar:g,onRefresh:y,viewMode:j,onViewModeChange:x,showSearch:v=!0,onSearch:k,showHeader:N=!0,showActions:D=!0,loading:P=!1,className:R}){const[A,S]=c.useState("grid"),[M,E]=c.useState(!1),[T,K]=c.useState(null),[q,B]=c.useState(""),[W,I]=c.useState(!1),[z,$]=c.useState([]),[_,F]=c.useState(!1),[H,J]=c.useState(""),Q=j??A,ne=se=>{x?x(se):S(se)},X=(se,de)=>{n?.(de?[...r,se]:r.filter(De=>De!==se))},Y=se=>{se.type==="folder"?o?.(se.path,se.id):i?.(se)},U=se=>{K(se),B(se.name),E(!0)},ae=()=>{T&&q.trim()&&q!==T.name&&d?.(T.id,q.trim()),E(!1),K(null)},te=()=>{$(r),I(!0)},Z=()=>{u?.(z),I(!1),$([]),n?.([])},le=()=>{H.trim()&&(p?.(H.trim(),s),F(!1),J(""))},xe=[...t].sort((se,de)=>se.type==="folder"&&de.type!=="folder"?-1:se.type!=="folder"&&de.type==="folder"?1:se.name.localeCompare(de.name));return e.jsxs("div",{className:b("space-y-4",R),children:[N&&e.jsx(zj,{breadcrumbs:a,viewMode:Q,onViewModeChange:ne,onNavigate:se=>o?.(se),onCreateFolder:p?()=>F(!0):void 0,onUpload:w?()=>{}:void 0,onRefresh:y,showSearch:v,onSearch:k,selectedCount:r.length,onDeleteSelected:u?te:void 0,onDownloadSelected:l?()=>l(r):void 0}),P?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(h.RefreshCw,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):xe.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(h.Folder,{className:"h-12 w-12 mb-4"}),e.jsx("p",{children:"Ce dossier est vide"})]}):Q==="grid"?e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4",children:xe.map(se=>e.jsx(jo,{file:se,viewMode:"grid",isSelected:r.includes(se.id),onSelect:de=>X(se.id,de),onOpen:()=>Y(se),onRename:d?()=>U(se):void 0,onDelete:u?()=>{$([se.id]),I(!0)}:void 0,onDownload:l?()=>l([se.id]):void 0,onShare:C?()=>C(se.id):void 0,onToggleStar:g?()=>g(se.id):void 0},se.id))}):e.jsxs(Ea,{children:[e.jsx(Ma,{children:e.jsxs(qt,{children:[e.jsx(ct,{className:"w-12",children:e.jsx(Ze,{checked:r.length===t.length&&t.length>0,onCheckedChange:se=>{n?.(se?t.map(de=>de.id):[])}})}),e.jsx(ct,{children:"Nom"}),e.jsx(ct,{children:"Taille"}),e.jsx(ct,{children:"Modifié"}),e.jsx(ct,{className:"w-12"})]})}),e.jsx(Pa,{children:xe.map(se=>e.jsx(jo,{file:se,viewMode:"list",isSelected:r.includes(se.id),onSelect:de=>X(se.id,de),onOpen:()=>Y(se),onRename:d?()=>U(se):void 0,onDelete:u?()=>{$([se.id]),I(!0)}:void 0,onDownload:l?()=>l([se.id]):void 0,onShare:C?()=>C(se.id):void 0,onToggleStar:g?()=>g(se.id):void 0},se.id))})]}),e.jsx(It,{open:M,onOpenChange:E,children:e.jsxs(Tt,{children:[e.jsx(Ht,{children:e.jsx(Xt,{children:"Renommer"})}),e.jsx(oe,{value:q,onChange:se=>B(se.target.value),placeholder:"Nouveau nom",onKeyDown:se=>se.key==="Enter"&&ae()}),e.jsxs(Gt,{children:[e.jsx(L,{variant:"outline",onClick:()=>E(!1),children:"Annuler"}),e.jsx(L,{onClick:ae,children:"Renommer"})]})]})}),e.jsx(fs,{open:W,onOpenChange:I,children:e.jsxs(Kt,{children:[e.jsxs(Yt,{children:[e.jsx(Qt,{children:"Supprimer ?"}),e.jsxs(Zt,{children:["Êtes-vous sûr de vouloir supprimer ",z.length," élément(s) ? Cette action est irréversible."]})]}),e.jsxs(Jt,{children:[e.jsx(ts,{children:"Annuler"}),e.jsx(es,{onClick:Z,children:"Supprimer"})]})]})}),e.jsx(It,{open:_,onOpenChange:F,children:e.jsxs(Tt,{children:[e.jsx(Ht,{children:e.jsx(Xt,{children:"Nouveau dossier"})}),e.jsx(oe,{value:H,onChange:se=>J(se.target.value),placeholder:"Nom du dossier",onKeyDown:se=>se.key==="Enter"&&le()}),e.jsxs(Gt,{children:[e.jsx(L,{variant:"outline",onClick:()=>F(!1),children:"Annuler"}),e.jsx(L,{onClick:le,children:"Créer"})]})]})})]})}const Vj=[{id:"1",name:"Documents",type:"folder",path:"/Documents",createdAt:new Date("2024-01-01"),modifiedAt:new Date("2024-01-15")},{id:"2",name:"Images",type:"folder",path:"/Images",createdAt:new Date("2024-01-01"),modifiedAt:new Date("2024-01-10"),starred:!0},{id:"3",name:"Rapport Q4.pdf",type:"document",path:"/Rapport Q4.pdf",size:2456e3,createdAt:new Date("2024-01-05"),modifiedAt:new Date("2024-01-05")},{id:"4",name:"Photo vacances.jpg",type:"image",path:"/Photo vacances.jpg",size:567e4,createdAt:new Date("2024-01-08"),modifiedAt:new Date("2024-01-08")},{id:"5",name:"Présentation.pptx",type:"document",path:"/Présentation.pptx",size:89e5,createdAt:new Date("2024-01-12"),modifiedAt:new Date("2024-01-14"),shared:!0}],Wj=[{id:"root",name:"Mes fichiers",path:"/"}],vo={low:{label:"Basse",color:"bg-gray-500",icon:h.Clock},medium:{label:"Moyenne",color:"bg-blue-500",icon:h.Clock},high:{label:"Haute",color:"bg-orange-500",icon:h.AlertCircle},urgent:{label:"Urgente",color:"bg-red-500",icon:h.AlertCircle}};function Uj({card:t,columnId:s,showAssignees:a,showLabels:r,showPriority:n,showDueDate:o,draggable:i,onCardClick:l,onCardEdit:u,onCardDelete:d,onDragStart:f}){const m=c.useMemo(()=>t.dueDate?(typeof t.dueDate=="string"?new Date(t.dueDate):t.dueDate)<new Date:!1,[t.dueDate]),p=w=>(typeof w=="string"?new Date(w):w).toLocaleDateString("fr-FR",{day:"numeric",month:"short"});return e.jsx(ke,{className:b("cursor-pointer hover:shadow-md transition-shadow",i&&"cursor-grab active:cursor-grabbing"),draggable:i,onDragStart:w=>f?.(w,t.id,s),onClick:()=>l?.(t,s),children:e.jsxs(Te,{className:"p-3 space-y-2",children:[r&&t.labels&&t.labels.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:t.labels.map(w=>e.jsx("div",{className:"h-1.5 w-8 rounded-full",style:{backgroundColor:w.color},title:w.name},w.id))}),e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h4",{className:"text-sm font-medium leading-tight",children:t.title}),e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,onClick:w=>w.stopPropagation(),children:e.jsx(L,{variant:"ghost",size:"icon",className:"h-6 w-6 flex-shrink-0",children:e.jsx(h.MoreHorizontal,{className:"h-3 w-3"})})}),e.jsxs(_e,{align:"end",children:[e.jsxs(pe,{onClick:w=>{w.stopPropagation(),l?.(t,s)},children:[e.jsx(h.Edit,{className:"mr-2 h-4 w-4"}),"Modifier"]}),e.jsx(Qe,{}),e.jsxs(pe,{onClick:w=>{w.stopPropagation(),d?.(t.id,s)},className:"text-destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]}),t.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:t.description}),e.jsxs("div",{className:"flex items-center justify-between pt-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[n&&t.priority&&e.jsx("div",{className:b("h-2 w-2 rounded-full",vo[t.priority].color),title:vo[t.priority].label}),o&&t.dueDate&&e.jsxs(Se,{variant:m?"destructive":"outline",className:"text-xs px-1.5 py-0",children:[e.jsx(h.Calendar,{className:"h-3 w-3 mr-1"}),p(t.dueDate)]})]}),a&&t.assignees&&t.assignees.length>0&&e.jsxs("div",{className:"flex -space-x-1",children:[t.assignees.slice(0,3).map(w=>e.jsxs(yt,{className:"h-5 w-5 border-2 border-background",children:[e.jsx(Nt,{src:w.avatar}),e.jsx(Ct,{className:"text-[8px]",children:w.name.charAt(0)})]},w.id)),t.assignees.length>3&&e.jsxs("div",{className:"h-5 w-5 rounded-full bg-muted flex items-center justify-center text-[8px] border-2 border-background",children:["+",t.assignees.length-3]})]})]})]})})}function Bj({column:t,showCardCount:s,showAddCard:a,showAssignees:r,showLabels:n,showPriority:o,showDueDate:i,draggable:l,onCardClick:u,onCardAdd:d,onCardEdit:f,onCardDelete:m,onColumnEdit:p,onColumnDelete:w,onDragStart:C,onDragOver:g,onDrop:y}){const[j,x]=c.useState(!1),[v,k]=c.useState(""),[N,D]=c.useState(!1),[P,R]=c.useState(t.title),A=()=>{v.trim()&&(d?.(t.id,{title:v.trim()}),k(""),x(!1))},S=()=>{P.trim()&&P!==t.title&&p?.(t.id,{title:P.trim()}),D(!1)},M=t.limit&&t.cards.length>=t.limit;return e.jsxs("div",{className:"flex flex-col w-72 flex-shrink-0 bg-muted/50 rounded-lg",onDragOver:g,onDrop:E=>y?.(E,t.id),children:[e.jsxs("div",{className:"flex items-center justify-between p-3 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[t.color&&e.jsx("div",{className:"h-3 w-3 rounded-full",style:{backgroundColor:t.color}}),N?e.jsx("div",{className:"flex items-center gap-1",children:e.jsx(oe,{value:P,onChange:E=>R(E.target.value),className:"h-7 text-sm font-semibold",autoFocus:!0,onBlur:S,onKeyDown:E=>{E.key==="Enter"&&S(),E.key==="Escape"&&D(!1)}})}):e.jsx("h3",{className:"font-semibold text-sm cursor-pointer",onClick:()=>D(!0),children:t.title}),s&&e.jsxs(Se,{variant:"secondary",className:"text-xs",children:[t.cards.length,t.limit&&`/${t.limit}`]})]}),e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx(L,{variant:"ghost",size:"icon",className:"h-7 w-7",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(_e,{align:"end",children:[e.jsxs(pe,{onClick:()=>D(!0),children:[e.jsx(h.Edit,{className:"mr-2 h-4 w-4"}),"Renommer"]}),e.jsx(Qe,{}),e.jsxs(pe,{onClick:()=>w?.(t.id),className:"text-destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]}),e.jsxs("div",{className:"flex-1 p-2 space-y-2 min-h-[200px] overflow-y-auto",children:[t.cards.map(E=>e.jsx(Uj,{card:E,columnId:t.id,showAssignees:r,showLabels:n,showPriority:o,showDueDate:i,draggable:l,onCardClick:u,onCardEdit:f,onCardDelete:m,onDragStart:C},E.id)),j&&e.jsxs(ke,{className:"p-2",children:[e.jsx(ft,{placeholder:"Titre de la carte...",value:v,onChange:E=>k(E.target.value),className:"min-h-[60px] text-sm",autoFocus:!0}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(L,{size:"sm",onClick:A,children:"Ajouter"}),e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>{x(!1),k("")},children:e.jsx(h.X,{className:"h-4 w-4"})})]})]})]}),a&&!j&&!M&&e.jsx("div",{className:"p-2 border-t",children:e.jsxs(L,{variant:"ghost",size:"sm",className:"w-full justify-start",onClick:()=>x(!0),children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-2"}),"Ajouter une carte"]})}),M&&e.jsx("div",{className:"p-2 border-t text-center text-xs text-muted-foreground",children:"Limite atteinte"})]})}function qj({columns:t,onColumnsChange:s,onCardClick:a,onCardAdd:r,onCardEdit:n,onCardDelete:o,onCardMove:i,onColumnAdd:l,onColumnEdit:u,onColumnDelete:d,showAddCard:f=!0,showAddColumn:m=!0,showCardCount:p=!0,showAssignees:w=!0,showLabels:C=!0,showPriority:g=!0,showDueDate:y=!0,draggable:j=!0,availableLabels:x=[],availableAssignees:v=[],className:k}){const[N,D]=c.useState(t),[P,R]=c.useState(null),[A,S]=c.useState(!1),[M,E]=c.useState("");c.useEffect(()=>{D(t)},[t]);const T=($,_,F)=>{R({cardId:_,columnId:F}),$.dataTransfer.effectAllowed="move"},K=$=>{$.preventDefault(),$.dataTransfer.dropEffect="move"},q=($,_)=>{if($.preventDefault(),!P)return;const{cardId:F,columnId:H}=P;if(H===_){R(null);return}if(i)i(F,H,_,0);else{const J=N.map(Q=>{if(Q.id===H)return{...Q,cards:Q.cards.filter(ne=>ne.id!==F)};if(Q.id===_){const ne=N.find(X=>X.id===H)?.cards.find(X=>X.id===F);if(ne)return{...Q,cards:[...Q.cards,ne]}}return Q});D(J),s?.(J)}R(null)},B=($,_)=>{if(r)r($,_);else{const F={id:`card-${Date.now()}`,title:_.title||"Nouvelle carte",..._},H=N.map(J=>J.id===$?{...J,cards:[...J.cards,F]}:J);D(H),s?.(H)}},W=($,_)=>{if(o)o($,_);else{const F=N.map(H=>H.id===_?{...H,cards:H.cards.filter(J=>J.id!==$)}:H);D(F),s?.(F)}},I=$=>{if(d)d($);else{const _=N.filter(F=>F.id!==$);D(_),s?.(_)}},z=()=>{if(M.trim()){const $={id:`column-${Date.now()}`,title:M.trim(),cards:[]};if(l)l($);else{const _=[...N,$];D(_),s?.(_)}E(""),S(!1)}};return e.jsx("div",{className:b("overflow-x-auto",k),children:e.jsxs("div",{className:"flex gap-4 p-4 min-h-[500px]",children:[N.map($=>e.jsx(Bj,{column:$,showCardCount:p,showAddCard:f,showAssignees:w,showLabels:C,showPriority:g,showDueDate:y,draggable:j,onCardClick:a,onCardAdd:B,onCardEdit:n,onCardDelete:W,onColumnEdit:u,onColumnDelete:I,onDragStart:T,onDragOver:K,onDrop:q},$.id)),m&&e.jsx("div",{className:"w-72 flex-shrink-0",children:A?e.jsxs(ke,{className:"p-3",children:[e.jsx(oe,{placeholder:"Titre de la colonne...",value:M,onChange:$=>E($.target.value),autoFocus:!0,onKeyDown:$=>{$.key==="Enter"&&z(),$.key==="Escape"&&S(!1)}}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(L,{size:"sm",onClick:z,children:"Ajouter"}),e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>{S(!1),E("")},children:e.jsx(h.X,{className:"h-4 w-4"})})]})]}):e.jsxs(L,{variant:"outline",className:"w-full justify-start h-12",onClick:()=>S(!0),children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-2"}),"Ajouter une colonne"]})})]})})}const Hj=[{id:"todo",title:"À faire",color:"#6b7280",cards:[{id:"1",title:"Implémenter l'authentification",description:"Ajouter le login/logout avec JWT",priority:"high",labels:[{id:"dev",name:"Dev",color:"#3b82f6"}],assignees:[{id:"1",name:"Marie D."}]},{id:"2",title:"Créer les maquettes",priority:"medium",labels:[{id:"design",name:"Design",color:"#8b5cf6"}]}]},{id:"in-progress",title:"En cours",color:"#3b82f6",limit:3,cards:[{id:"3",title:"Refactoring du dashboard",priority:"medium",assignees:[{id:"2",name:"Pierre M."}],dueDate:new Date(Date.now()+1e3*60*60*24*2)}]},{id:"review",title:"En revue",color:"#f59e0b",cards:[]},{id:"done",title:"Terminé",color:"#10b981",cards:[{id:"4",title:"Setup du projet",priority:"low"}]}],Gj=[{id:"dev",name:"Dev",color:"#3b82f6"},{id:"design",name:"Design",color:"#8b5cf6"},{id:"bug",name:"Bug",color:"#ef4444"},{id:"feature",name:"Feature",color:"#10b981"}];function Xj({logo:t,brandName:s="Brand",navItems:a=[],showLoginButton:r=!0,loginButtonText:n="Se connecter",onLogin:o,loginHref:i}){const[l,u]=c.useState(!1);return e.jsxs("nav",{className:"sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[e.jsxs("div",{className:"container flex h-16 items-center justify-between",children:[e.jsxs("a",{href:"/",className:"flex items-center gap-2 font-bold text-xl",children:[t,e.jsx("span",{children:s})]}),e.jsx("div",{className:"hidden md:flex items-center gap-6",children:a.map(d=>e.jsx("a",{href:d.href,className:b("text-sm font-medium transition-colors hover:text-primary",d.isActive?"text-primary":"text-muted-foreground"),children:d.label},d.href))}),e.jsx("div",{className:"hidden md:flex items-center gap-4",children:r&&e.jsx(L,{variant:"default",onClick:o,asChild:!!i,children:i?e.jsx("a",{href:i,children:n}):n})}),e.jsx(L,{variant:"ghost",size:"icon",className:"md:hidden",onClick:()=>u(!l),children:l?e.jsx(h.X,{className:"h-5 w-5"}):e.jsx(h.Menu,{className:"h-5 w-5"})})]}),l&&e.jsx("div",{className:"md:hidden border-t bg-background p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[a.map(d=>e.jsx("a",{href:d.href,className:"text-sm font-medium",onClick:()=>u(!1),children:d.label},d.href)),r&&e.jsx(L,{onClick:o,asChild:!!i,children:i?e.jsx("a",{href:i,children:n}):n})]})})]})}function Kj({badge:t,title:s,highlightedTitle:a,description:r,primaryButtonText:n="Commencer",primaryButtonAction:o,primaryButtonHref:i,secondaryButtonText:l,secondaryButtonAction:u,secondaryButtonHref:d,image:f,stats:m}){return e.jsx("section",{className:"container py-24 md:py-32",children:e.jsxs("div",{className:"flex flex-col lg:flex-row items-center gap-12",children:[e.jsxs("div",{className:"flex-1 text-center lg:text-left",children:[t&&e.jsx(Se,{variant:"secondary",className:"mb-4",children:t}),e.jsxs("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight mb-6",children:[s," ",a&&e.jsx("span",{className:"text-primary",children:a})]}),e.jsx("p",{className:"text-lg md:text-xl text-muted-foreground mb-8 max-w-2xl lg:max-w-none",children:r}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center lg:justify-start mb-8",children:[e.jsx(L,{size:"lg",onClick:o,asChild:!!i,children:i?e.jsxs("a",{href:i,children:[n,e.jsx(h.ArrowRight,{className:"ml-2 h-4 w-4"})]}):e.jsxs(e.Fragment,{children:[n,e.jsx(h.ArrowRight,{className:"ml-2 h-4 w-4"})]})}),l&&e.jsx(L,{size:"lg",variant:"outline",onClick:u,asChild:!!d,children:d?e.jsxs("a",{href:d,children:[e.jsx(h.Play,{className:"mr-2 h-4 w-4"}),l]}):e.jsxs(e.Fragment,{children:[e.jsx(h.Play,{className:"mr-2 h-4 w-4"}),l]})})]}),m&&m.length>0&&e.jsx("div",{className:"flex gap-8 justify-center lg:justify-start",children:m.map((p,w)=>e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold",children:p.value}),e.jsx("div",{className:"text-sm text-muted-foreground",children:p.label})]},w))})]}),f&&e.jsx("div",{className:"flex-1 w-full lg:w-auto",children:f})]})})}function Yj({title:t="Fonctionnalités",description:s,features:a}){return e.jsxs("section",{className:"container py-24 bg-muted/30",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold tracking-tight mb-4",children:t}),s&&e.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:s})]}),e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:a.map(r=>e.jsxs(ke,{className:"bg-background",children:[e.jsxs(qe,{children:[e.jsx("div",{className:"h-12 w-12 rounded-lg bg-primary/10 flex items-center justify-center mb-4",children:e.jsx("span",{className:"text-primary",children:r.icon})}),e.jsx(Oe,{className:"text-xl",children:r.title})]}),e.jsx(Te,{children:e.jsx(ot,{className:"text-base",children:r.description})})]},r.id))})]})}function Jj({title:t="Ce que disent nos clients",testimonials:s}){return e.jsxs("section",{className:"container py-24",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold tracking-tight text-center mb-12",children:t}),e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:s.map(a=>e.jsx(ke,{children:e.jsxs(Te,{className:"pt-6",children:[a.rating&&e.jsx("div",{className:"flex gap-1 mb-4",children:Array.from({length:5}).map((r,n)=>e.jsx(h.Star,{className:b("h-4 w-4",n<a.rating?"text-yellow-400 fill-yellow-400":"text-muted-foreground")},n))}),e.jsxs("p",{className:"text-muted-foreground mb-6",children:['"',a.content,'"']}),e.jsxs("div",{className:"flex items-center gap-3",children:[a.avatar?e.jsx("img",{src:a.avatar,alt:a.author,className:"h-10 w-10 rounded-full object-cover"}):e.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx("span",{className:"text-sm font-medium text-primary",children:a.author.charAt(0)})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:a.author}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[a.role,a.company&&` @ ${a.company}`]})]})]})]})},a.id))})]})}function Qj({title:t,description:s,buttonText:a,buttonAction:r,buttonHref:n,secondaryButtonText:o,secondaryButtonAction:i,variant:l="default"}){const u={default:"bg-muted/50",gradient:"bg-gradient-to-r from-primary/10 via-primary/5 to-background",dark:"bg-foreground text-background"};return e.jsx("section",{className:b("py-24",u[l]),children:e.jsx("div",{className:"container",children:e.jsxs("div",{className:"text-center max-w-2xl mx-auto",children:[e.jsx("h2",{className:b("text-3xl md:text-4xl font-bold tracking-tight mb-4",l==="dark"&&"text-background"),children:t}),s&&e.jsx("p",{className:b("text-lg mb-8",l==="dark"?"text-background/80":"text-muted-foreground"),children:s}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[e.jsx(L,{size:"lg",variant:l==="dark"?"secondary":"default",onClick:r,asChild:!!n,children:n?e.jsxs("a",{href:n,children:[a,e.jsx(h.ChevronRight,{className:"ml-2 h-4 w-4"})]}):e.jsxs(e.Fragment,{children:[a,e.jsx(h.ChevronRight,{className:"ml-2 h-4 w-4"})]})}),o&&e.jsx(L,{size:"lg",variant:"outline",onClick:i,className:l==="dark"?"border-background/20 text-background hover:bg-background/10":"",children:o})]})]})})})}function Zj({logo:t,brandName:s="Brand",navItems:a,showLoginButton:r=!0,loginButtonText:n="Se connecter",onLogin:o,loginHref:i,hero:l,features:u,featuresTitle:d,featuresDescription:f,testimonials:m,testimonialsTitle:p,cta:w,footer:C,className:g}){return e.jsxs("div",{className:b("min-h-screen",g),children:[e.jsx(Xj,{logo:t,brandName:s,navItems:a,showLoginButton:r,loginButtonText:n,onLogin:o,loginHref:i}),l&&e.jsx(Kj,{...l}),u&&u.length>0&&e.jsx(Yj,{title:d,description:f,features:u}),m&&m.length>0&&e.jsx(Jj,{title:p,testimonials:m}),w&&e.jsx(Qj,{...w}),C]})}const ev=[{label:"Fonctionnalités",href:"#features"},{label:"Tarifs",href:"#pricing"},{label:"Témoignages",href:"#testimonials"},{label:"Contact",href:"#contact"}],tv=[{id:"1",icon:e.jsx(h.Zap,{className:"h-6 w-6"}),title:"Rapide et performant",description:"Optimisé pour la vitesse avec des temps de chargement minimaux."},{id:"2",icon:e.jsx(h.Shield,{className:"h-6 w-6"}),title:"Sécurisé",description:"Vos données sont protégées avec un chiffrement de bout en bout."},{id:"3",icon:e.jsx(h.Users,{className:"h-6 w-6"}),title:"Collaboration",description:"Travaillez en équipe avec des outils de collaboration intégrés."},{id:"4",icon:e.jsx(h.Globe,{className:"h-6 w-6"}),title:"Accessible partout",description:"Accédez à votre espace depuis n'importe quel appareil."}],sv=[{id:"1",content:"Cette solution a transformé notre façon de travailler. Nous avons gagné un temps précieux.",author:"Marie Dupont",role:"CEO",company:"TechCorp",rating:5},{id:"2",content:"Interface intuitive et support réactif. Je recommande vivement.",author:"Pierre Martin",role:"CTO",company:"StartupXYZ",rating:5},{id:"3",content:"Le meilleur outil que nous ayons utilisé pour gérer nos projets.",author:"Sophie Bernard",role:"Product Manager",company:"InnoLab",rating:5}],av={badge:"Nouveau",title:"La solution pour",highlightedTitle:"votre entreprise",description:"Simplifiez votre quotidien avec notre plateforme tout-en-un. Gagnez du temps et concentrez-vous sur l'essentiel.",primaryButtonText:"Essayer gratuitement",secondaryButtonText:"Voir la démo",stats:[{value:"10K+",label:"Utilisateurs"},{value:"99.9%",label:"Uptime"},{value:"24/7",label:"Support"}]},rv={title:"Prêt à commencer ?",description:"Rejoignez des milliers d'entreprises qui nous font confiance.",buttonText:"Créer un compte gratuit",secondaryButtonText:"Contacter les ventes",variant:"gradient"};function nv({period:t,onChange:s,yearlyDiscount:a}){return e.jsxs("div",{className:"flex items-center justify-center gap-4 mb-8",children:[e.jsx(me,{htmlFor:"billing-toggle",className:b("cursor-pointer transition-colors",t==="monthly"?"text-foreground":"text-muted-foreground"),children:"Mensuel"}),e.jsx(aa,{id:"billing-toggle",checked:t==="yearly",onCheckedChange:r=>s(r?"yearly":"monthly")}),e.jsxs(me,{htmlFor:"billing-toggle",className:b("cursor-pointer transition-colors flex items-center gap-2",t==="yearly"?"text-foreground":"text-muted-foreground"),children:["Annuel",a&&e.jsxs(Se,{variant:"secondary",className:"text-xs",children:["-",a]})]})]})}function ov({plan:t,billingPeriod:s}){const a=s==="yearly"&&t.priceYearly!==void 0?t.priceYearly:t.price,r=s==="yearly"&&t.periodYearly?t.periodYearly:t.period||"/mois",n=typeof a=="string";return e.jsxs(ke,{className:b("relative flex flex-col",t.popular&&"border-primary shadow-lg scale-105"),children:[t.popular&&e.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:e.jsxs(Se,{className:"px-3",children:[e.jsx(h.Zap,{className:"h-3 w-3 mr-1"}),t.badge||"Populaire"]})}),e.jsxs(qe,{className:"text-center pb-2",children:[e.jsx(Oe,{className:"text-xl",children:t.name}),t.description&&e.jsx(ot,{children:t.description})]}),e.jsxs(Te,{className:"flex-1",children:[e.jsx("div",{className:"text-center mb-6",children:n?e.jsx("div",{className:"text-3xl font-bold",children:a}):e.jsxs("div",{className:"flex items-baseline justify-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground mr-1",children:t.currency||"€"}),e.jsx("span",{className:"text-4xl font-bold",children:a}),e.jsx("span",{className:"text-sm text-muted-foreground ml-1",children:r})]})}),e.jsx("ul",{className:"space-y-3",children:t.features.map((o,i)=>e.jsxs("li",{className:"flex items-start gap-2",children:[o.included===!0?e.jsx(h.Check,{className:"h-5 w-5 text-green-500 flex-shrink-0"}):o.included==="partial"||o.included==="limited"?e.jsx(h.Check,{className:"h-5 w-5 text-yellow-500 flex-shrink-0"}):e.jsx(h.X,{className:"h-5 w-5 text-muted-foreground flex-shrink-0"}),e.jsxs("span",{className:b("text-sm",!o.included&&"text-muted-foreground"),children:[o.name,o.value&&e.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",o.value,")"]})]}),o.tooltip&&e.jsx(Ks,{children:e.jsxs(Ys,{children:[e.jsx(Js,{asChild:!0,children:e.jsx(h.HelpCircle,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),e.jsx(ks,{children:e.jsx("p",{className:"max-w-xs",children:o.tooltip})})]})})]},i))})]}),e.jsx(pr,{children:e.jsx(L,{className:"w-full",variant:t.buttonVariant||(t.popular?"default":"outline"),onClick:t.onSelect,disabled:t.disabled,asChild:!!t.href,children:t.href?e.jsx("a",{href:t.href,children:t.buttonText||"Choisir"}):t.buttonText||"Choisir"})})]})}function iv({plans:t,billingPeriod:s}){const a=Array.from(new Set(t.flatMap(r=>r.features.map(n=>n.name))));return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsxs("thead",{children:[e.jsxs("tr",{children:[e.jsx("th",{className:"text-left p-4 border-b bg-muted/50",children:"Fonctionnalité"}),t.map(r=>e.jsxs("th",{className:b("text-center p-4 border-b min-w-[150px]",r.popular&&"bg-primary/5"),children:[e.jsx("div",{className:"font-bold",children:r.name}),r.popular&&e.jsx(Se,{className:"mt-1",variant:"default",children:"Populaire"})]},r.id))]}),e.jsxs("tr",{children:[e.jsx("td",{className:"p-4 border-b bg-muted/50 font-medium",children:"Prix"}),t.map(r=>{const n=s==="yearly"&&r.priceYearly!==void 0?r.priceYearly:r.price,o=s==="yearly"&&r.periodYearly?r.periodYearly:r.period||"/mois",i=typeof n=="string";return e.jsx("td",{className:b("text-center p-4 border-b",r.popular&&"bg-primary/5"),children:i?e.jsx("span",{className:"font-bold",children:n}):e.jsxs("span",{className:"font-bold",children:[r.currency||"€",n,e.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:o})]})},r.id)})]})]}),e.jsxs("tbody",{children:[a.map((r,n)=>e.jsxs("tr",{className:n%2===0?"bg-muted/20":"",children:[e.jsx("td",{className:"p-4 border-b",children:r}),t.map(o=>{const i=o.features.find(l=>l.name===r);return e.jsx("td",{className:b("text-center p-4 border-b",o.popular&&"bg-primary/5"),children:i?i.included===!0?i.value?e.jsx("span",{children:i.value}):e.jsx(h.Check,{className:"h-5 w-5 text-green-500 mx-auto"}):i.included==="partial"||i.included==="limited"?e.jsx("span",{className:"text-yellow-600",children:i.value||"Limité"}):e.jsx(h.X,{className:"h-5 w-5 text-muted-foreground mx-auto"}):e.jsx(h.X,{className:"h-5 w-5 text-muted-foreground mx-auto"})},o.id)})]},n)),e.jsxs("tr",{children:[e.jsx("td",{className:"p-4"}),t.map(r=>e.jsx("td",{className:b("text-center p-4",r.popular&&"bg-primary/5"),children:e.jsx(L,{variant:r.buttonVariant||(r.popular?"default":"outline"),onClick:r.onSelect,disabled:r.disabled,asChild:!!r.href,children:r.href?e.jsx("a",{href:r.href,children:r.buttonText||"Choisir"}):r.buttonText||"Choisir"})},r.id))]})]})]})})}function lv({title:t="Questions fréquentes",items:s}){return e.jsxs("div",{className:"mt-16",children:[e.jsx("h2",{className:"text-2xl font-bold text-center mb-8",children:t}),e.jsx("div",{className:"grid md:grid-cols-2 gap-6 max-w-4xl mx-auto",children:s.map((a,r)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"font-semibold",children:a.question}),e.jsx("p",{className:"text-muted-foreground text-sm",children:a.answer})]},r))})]})}function cv({title:t="Tarification",description:s,plans:a,showBillingToggle:r=!0,billingPeriod:n,onBillingPeriodChange:o,yearlyDiscount:i,faq:l,faqTitle:u,layout:d="cards",columns:f=3,showComparison:m=!1,className:p}){const[w,C]=c.useState("monthly"),g=n??w,y=x=>{o?o(x):C(x)},j={2:"md:grid-cols-2",3:"md:grid-cols-2 lg:grid-cols-3",4:"md:grid-cols-2 lg:grid-cols-4"};return e.jsxs("div",{className:b("container py-16",p),children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-bold tracking-tight mb-4",children:t}),s&&e.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:s})]}),r&&e.jsx(nv,{period:g,onChange:y,yearlyDiscount:i}),d==="cards"&&!m?e.jsx("div",{className:b("grid gap-6 items-stretch",j[f]),children:a.map(x=>e.jsx(ov,{plan:x,billingPeriod:g},x.id))}):e.jsx(iv,{plans:a,billingPeriod:g}),l&&l.length>0&&e.jsx(lv,{title:u,items:l})]})}const dv=[{id:"free",name:"Gratuit",description:"Pour démarrer",price:0,priceYearly:0,features:[{name:"1 utilisateur",included:!0},{name:"5 projets",included:!0},{name:"1 Go de stockage",included:!0},{name:"Support email",included:!0},{name:"API Access",included:!1},{name:"Analytics avancés",included:!1},{name:"Support prioritaire",included:!1}],buttonText:"Commencer gratuitement",buttonVariant:"outline"},{id:"pro",name:"Pro",description:"Pour les équipes",price:29,priceYearly:24,periodYearly:"/mois (facturé annuellement)",popular:!0,features:[{name:"5 utilisateurs",included:!0},{name:"Projets illimités",included:!0},{name:"50 Go de stockage",included:!0},{name:"Support email",included:!0},{name:"API Access",included:!0},{name:"Analytics avancés",included:!0},{name:"Support prioritaire",included:!1}],buttonText:"Essai gratuit 14 jours"},{id:"enterprise",name:"Enterprise",description:"Pour les grandes équipes",price:"Sur mesure",features:[{name:"Utilisateurs illimités",included:!0},{name:"Projets illimités",included:!0},{name:"Stockage illimité",included:!0},{name:"Support email",included:!0},{name:"API Access",included:!0},{name:"Analytics avancés",included:!0},{name:"Support prioritaire",included:!0}],buttonText:"Contacter les ventes",buttonVariant:"outline"}],uv=[{question:"Puis-je changer de plan à tout moment ?",answer:"Oui, vous pouvez upgrader ou downgrader votre plan à tout moment. Les changements prennent effet immédiatement."},{question:"Y a-t-il une période d'essai ?",answer:"Oui, tous nos plans payants incluent une période d'essai gratuite de 14 jours, sans carte bancaire requise."},{question:"Quels moyens de paiement acceptez-vous ?",answer:"Nous acceptons les cartes de crédit (Visa, Mastercard, Amex), PayPal et les virements bancaires pour les entreprises."},{question:"Puis-je annuler à tout moment ?",answer:"Absolument. Vous pouvez annuler votre abonnement à tout moment sans frais supplémentaires."}],nc=c.createContext(null);function mv(){const t=c.useContext(nc);if(!t)throw new Error("useWizard must be used within a WakaWizard");return t}function hv({steps:t,currentStep:s,stepStatuses:a,showStepNumbers:r,orientation:n,onStepClick:o,allowBackNavigation:i}){const l=(d,f)=>f==="completed"?e.jsx(h.Check,{className:"h-4 w-4"}):f==="error"?e.jsx(h.AlertCircle,{className:"h-4 w-4"}):f==="skipped"?e.jsx(h.X,{className:"h-4 w-4 text-muted-foreground"}):r?e.jsx("span",{className:"text-xs font-medium",children:d+1}):e.jsx(h.Circle,{className:"h-3 w-3"}),u=d=>{switch(d){case"completed":return"bg-primary text-primary-foreground border-primary";case"current":return"bg-primary text-primary-foreground border-primary";case"error":return"bg-destructive text-destructive-foreground border-destructive";case"skipped":return"bg-muted text-muted-foreground border-muted";default:return"bg-background text-muted-foreground border-border"}};return n==="vertical"?e.jsx("div",{className:"flex flex-col gap-0",children:t.map((d,f)=>{const m=a[f],p=i&&f<s;return e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("button",{type:"button",disabled:!p,onClick:()=>p&&o?.(f),className:b("flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors",u(m),p&&"cursor-pointer hover:opacity-80"),children:d.icon||l(f,m)}),f<t.length-1&&e.jsx("div",{className:b("w-0.5 flex-1 min-h-[24px]",a[f]==="completed"?"bg-primary":"bg-border")})]}),e.jsxs("div",{className:"pb-8",children:[e.jsxs("div",{className:b("font-medium",m==="current"?"text-foreground":"text-muted-foreground"),children:[d.title,d.optional&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(optionnel)"})]}),d.description&&e.jsx("div",{className:"text-sm text-muted-foreground mt-0.5",children:d.description})]})]},d.id)})}):e.jsx("div",{className:"flex items-center gap-0",children:t.map((d,f)=>{const m=a[f],p=i&&f<s;return e.jsxs(c.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("button",{type:"button",disabled:!p,onClick:()=>p&&o?.(f),className:b("flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors",u(m),p&&"cursor-pointer hover:opacity-80"),children:d.icon||l(f,m)}),e.jsx("div",{className:"text-center",children:e.jsx("div",{className:b("text-sm font-medium",m==="current"?"text-foreground":"text-muted-foreground"),children:d.title})})]}),f<t.length-1&&e.jsx("div",{className:b("flex-1 h-0.5 mx-2 mb-6",a[f]==="completed"?"bg-primary":"bg-border")})]},d.id)})})}function fv({onPrev:t,onNext:s,onSkip:a,onCancel:r,isFirstStep:n,isLastStep:o,isOptional:i,prevButtonText:l,nextButtonText:u,finishButtonText:d,skipButtonText:f,cancelButtonText:m,showCancelButton:p,submitting:w}){return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex gap-2",children:p&&r&&e.jsx(L,{type:"button",variant:"ghost",onClick:r,disabled:w,children:m})}),e.jsxs("div",{className:"flex gap-2",children:[!n&&e.jsxs(L,{type:"button",variant:"outline",onClick:t,disabled:w,children:[e.jsx(h.ArrowLeft,{className:"mr-2 h-4 w-4"}),l]}),i&&a&&!o&&e.jsx(L,{type:"button",variant:"ghost",onClick:a,disabled:w,children:f}),e.jsxs(L,{type:"button",onClick:s,disabled:w,children:[w&&e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),o?d:u,!o&&!w&&e.jsx(h.ArrowRight,{className:"ml-2 h-4 w-4"})]})]})]})}function pv({steps:t,currentStep:s,onStepChange:a,onSubmit:r,onCancel:n,title:o,description:i,prevButtonText:l="Précédent",nextButtonText:u="Suivant",finishButtonText:d="Terminer",cancelButtonText:f="Annuler",skipButtonText:m="Passer",showCancelButton:p=!0,showProgress:w=!0,showStepNumbers:C=!0,showStepper:g=!0,stepperPosition:y="top",allowBackNavigation:j=!0,confirmCancel:x=!0,cancelConfirmMessage:v="Êtes-vous sûr de vouloir annuler ? Toutes les modifications seront perdues.",submitting:k=!1,layout:N="card",className:D}){const[P,R]=c.useState(0),[A,S]=c.useState(t.map((Y,U)=>U===0?"current":"pending")),[M,E]=c.useState(!1),T=s??P,K=T===0,q=T===t.length-1,B=t[T],W=(T+1)/t.length*100,I=(Y,U)=>{S(ae=>{const te=[...ae];if(U==="next"&&T<t.length)te[T]="completed";else if(U==="skip")te[T]="skipped";else if(U==="goto"&&Y<T)for(let Z=Y+1;Z<t.length;Z++)te[Z]="pending";return te[Y]="current",te})},z=async Y=>{if(Y<0||Y>=t.length||Y>T&&!j)return;B.onLeave&&await B.onLeave(),I(Y,"goto"),a?a(Y):R(Y);const U=t[Y];U.onEnter&&await U.onEnter()},$=async()=>{if(B.validate&&!await B.validate()){S(U=>{const ae=[...U];return ae[T]="error",ae});return}if(B.onLeave&&await B.onLeave(),q){const Y={steps:t.map((U,ae)=>({id:U.id,status:ae===T?"completed":A[ae]})),completedSteps:t.filter((U,ae)=>A[ae]==="completed"||ae===T).map(U=>U.id),skippedSteps:t.filter((U,ae)=>A[ae]==="skipped").map(U=>U.id)};await r?.(Y)}else{const Y=T+1;I(Y,"next"),a?a(Y):R(Y);const U=t[Y];U.onEnter&&await U.onEnter()}},_=async()=>{if(K)return;B.onLeave&&await B.onLeave();const Y=T-1;I(Y,"prev"),a?a(Y):R(Y);const U=t[Y];U.onEnter&&await U.onEnter()},F=async()=>{if(!B.optional||q)return;B.onLeave&&await B.onLeave();const Y=T+1;I(Y,"skip"),a?a(Y):R(Y);const U=t[Y];U.onEnter&&await U.onEnter()},H=()=>{x?E(!0):n?.()},J={currentStep:T,totalSteps:t.length,stepStatuses:A,goToStep:z,nextStep:$,prevStep:_,skipStep:F,isFirstStep:K,isLastStep:q},Q=g&&e.jsx(hv,{steps:t,currentStep:T,stepStatuses:A,showStepNumbers:C,orientation:y==="left"?"vertical":"horizontal",onStepClick:z,allowBackNavigation:j}),ne=e.jsx(fv,{onPrev:_,onNext:$,onSkip:B.optional?F:void 0,onCancel:n?H:void 0,isFirstStep:K,isLastStep:q,isOptional:B.optional||!1,prevButtonText:l,nextButtonText:u,finishButtonText:d,skipButtonText:m,cancelButtonText:f,showCancelButton:p,submitting:k}),X=e.jsxs(nc.Provider,{value:J,children:[y==="left"?e.jsxs("div",{className:"flex gap-8",children:[e.jsx("div",{className:"w-64 flex-shrink-0",children:Q}),e.jsxs("div",{className:"flex-1",children:[w&&e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground mb-2",children:[e.jsxs("span",{children:["Étape ",T+1," sur ",t.length]}),e.jsxs("span",{children:[Math.round(W),"%"]})]}),e.jsx(Xs,{value:W})]}),e.jsx("div",{className:"min-h-[300px]",children:B.content}),e.jsx("div",{className:"mt-8",children:ne})]})]}):e.jsxs(e.Fragment,{children:[Q&&e.jsx("div",{className:"mb-8",children:Q}),w&&e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground mb-2",children:[e.jsxs("span",{children:["Étape ",T+1," sur ",t.length]}),e.jsxs("span",{children:[Math.round(W),"%"]})]}),e.jsx(Xs,{value:W})]}),e.jsx("div",{className:"min-h-[300px]",children:B.content}),e.jsx("div",{className:"mt-8",children:ne})]}),e.jsx(fs,{open:M,onOpenChange:E,children:e.jsxs(Kt,{children:[e.jsxs(Yt,{children:[e.jsx(Qt,{children:"Annuler ?"}),e.jsx(Zt,{children:v})]}),e.jsxs(Jt,{children:[e.jsx(ts,{children:"Non, continuer"}),e.jsx(es,{onClick:()=>{E(!1),n?.()},children:"Oui, annuler"})]})]})})]});return N==="minimal"?e.jsx("div",{className:b("space-y-6",D),children:X}):N==="page"?e.jsxs("div",{className:b("container py-8 max-w-4xl",D),children:[(o||i)&&e.jsxs("div",{className:"mb-8",children:[o&&e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:o}),i&&e.jsx("p",{className:"text-muted-foreground mt-1",children:i})]}),X]}):e.jsxs(ke,{className:D,children:[(o||i)&&e.jsxs(qe,{children:[o&&e.jsx(Oe,{children:o}),i&&e.jsx(ot,{children:i})]}),e.jsx(Te,{children:X})]})}const xv=[{id:"step-1",title:"Informations de base",description:"Renseignez vos informations personnelles",content:e.jsx("div",{className:"space-y-4",children:e.jsx("p",{className:"text-muted-foreground",children:"Contenu de l'étape 1 - Informations de base"})})},{id:"step-2",title:"Configuration",description:"Configurez vos préférences",optional:!0,content:e.jsx("div",{className:"space-y-4",children:e.jsx("p",{className:"text-muted-foreground",children:"Contenu de l'étape 2 - Configuration (optionnel)"})})},{id:"step-3",title:"Confirmation",description:"Vérifiez et confirmez",content:e.jsx("div",{className:"space-y-4",children:e.jsx("p",{className:"text-muted-foreground",children:"Contenu de l'étape 3 - Confirmation"})})}];function oc(t,s,a){const r=t.translations[a]?.value||"",n=t.translations[s]?.value;return!n||n.trim()===""?"missing":n===r?"identical":"valid"}function Za(t,s,a){const r=s.filter(n=>n!==a).map(n=>oc(t,n,a));return r.includes("missing")?"missing":r.includes("identical")?"identical":"valid"}function gv(t,s){const a=new Map;for(const r of t){const n=r.key.split(s),o=n.length>1?n[0]:"__root__";a.has(o)||a.set(o,[]),a.get(o).push(r)}return a}function bv({status:t}){const s={valid:{label:"OK",variant:"default",icon:h.CheckCircle,className:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300"},missing:{label:"Manquant",variant:"destructive",icon:h.XCircle,className:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300"},identical:{label:"Identique",variant:"secondary",icon:h.AlertTriangle,className:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300"},warning:{label:"Attention",variant:"secondary",icon:h.AlertTriangle,className:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300"}},{label:a,icon:r,className:n}=s[t];return e.jsxs(Se,{variant:"outline",className:b("gap-1 text-xs",n),children:[e.jsx(r,{className:"h-3 w-3"}),a]})}function wo({value:t,onChange:s,onBlur:a,placeholder:r,status:n,disabled:o}){const[i,l]=c.useState(t);c.useEffect(()=>{l(t)},[t]);const u=d=>{l(d.target.value),s(d.target.value)};return e.jsx(ft,{value:i,onChange:u,onBlur:a,placeholder:r,disabled:o,className:b("min-h-[60px] resize-none text-sm",n==="missing"&&"border-red-300 dark:border-red-700",n==="identical"&&"border-yellow-300 dark:border-yellow-700")})}function jv({config:t,translations:s,onChange:a,onSave:r,onAddKey:n,onDeleteKey:o,onAddLanguage:i,onExport:l,onImport:u,isLoading:d=!1,isSaving:f=!1,className:m,title:p="Translation Editor",description:w="Gérez vos traductions i18n"}){const[C,g]=c.useState(s),[y,j]=c.useState(""),[x,v]=c.useState("all"),[k,N]=c.useState(new Set),[D,P]=c.useState(null),[R,A]=c.useState(!1),[S,M]=c.useState(!1),[E,T]=c.useState(!1),[K,q]=c.useState(!1),[B,W]=c.useState(""),[I,z]=c.useState({code:"",label:"",flag:""}),[$,_]=c.useState(null),[F,H]=c.useState(""),[J,Q]=c.useState("merge"),[ne,X]=c.useState(new Map),Y=c.useRef(null),{languages:U,sourceLanguage:ae,keyPathSeparator:te=".",autoSave:Z=!0,saveDebounceMs:le=300,placeholderPatterns:xe=["{{.*?}}","{.*?}","%s","%d"]}=t,se=U.filter(G=>G.code!==ae);c.useEffect(()=>{g(s)},[s]),c.useEffect(()=>(Z&&ne.size>0&&r&&(Y.current&&clearTimeout(Y.current),Y.current=setTimeout(async()=>{await r(C),X(new Map)},le)),()=>{Y.current&&clearTimeout(Y.current)}),[ne,Z,le,r,C]);const de=c.useMemo(()=>{let G=C;if(y){const ee=y.toLowerCase();G=G.filter(re=>{if(re.key.toLowerCase().includes(ee))return!0;for(const we of Object.keys(re.translations))if(re.translations[we]?.value?.toLowerCase().includes(ee))return!0;return!1})}return x!=="all"&&(G=G.filter(ee=>{const re=Za(ee,U.map(we=>we.code),ae);switch(x){case"missing":return re==="missing";case"incomplete":return re==="missing"||re==="identical";case"identical":return re==="identical";default:return!0}})),G},[C,y,x,U,ae]),De=c.useMemo(()=>gv(de,te),[de,te]),Ne=(G,ee,re)=>{g(we=>we.map(be=>be.key===G?{...be,translations:{...be.translations,[ee]:{...be.translations[ee],value:re,updatedAt:new Date}}}:be)),X(we=>{const be=new Map(we);return be.has(G)||be.set(G,new Map),be.get(G).set(ee,re),be}),a?.(G,ee,re)},Ke=async()=>{B.trim()&&(await n?.(B),W(""),M(!1))},xt=async G=>{await o?.(G),g(ee=>ee.filter(re=>re.key!==G))},Ye=async()=>{!I.code||!I.label||(await i?.(I),z({code:"",label:"",flag:""}),T(!1))},et=async()=>{!$||!F||(await u?.($,F,J),_(null),H(""),q(!1))},gt=G=>{navigator.clipboard.writeText(G)},Et=G=>{N(ee=>{const re=new Set(ee);return re.has(G)?re.delete(G):re.add(G),re})},Je=c.useMemo(()=>{let G=C.length,ee=0,re=0,we=0;for(const be of C){const Mt=Za(be,U.map(ys=>ys.code),ae);Mt==="missing"?ee++:Mt==="identical"?re++:we++}return{total:G,missing:ee,identical:re,valid:we}},[C,U,ae]);return d?e.jsx("div",{className:b("flex items-center justify-center py-12",m),children:e.jsx(h.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsx(Ks,{children:e.jsxs("div",{className:b("flex flex-col h-full",m),children:[e.jsxs("div",{className:"flex flex-col gap-4 p-4 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[e.jsx(h.Languages,{className:"h-6 w-6"}),p]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:w})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(L,{variant:"outline",size:"sm",onClick:()=>M(!0),children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-1"}),"Ajouter une clé"]}),e.jsxs(L,{variant:"outline",size:"sm",onClick:()=>T(!0),children:[e.jsx(h.Flag,{className:"h-4 w-4 mr-1"}),"Ajouter une langue"]}),e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx(L,{variant:"outline",size:"sm",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(_e,{align:"end",children:[e.jsxs(pe,{onClick:()=>l?.(),children:[e.jsx(h.Download,{className:"h-4 w-4 mr-2"}),"Exporter tout"]}),U.map(G=>e.jsxs(pe,{onClick:()=>l?.(G.code),children:[e.jsx(h.Download,{className:"h-4 w-4 mr-2"}),"Exporter ",G.label]},G.code)),e.jsx(Qe,{}),e.jsxs(pe,{onClick:()=>q(!0),children:[e.jsx(h.Upload,{className:"h-4 w-4 mr-2"}),"Importer"]})]})]}),f&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(h.Loader2,{className:"h-4 w-4 animate-spin"}),"Sauvegarde..."]})]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:[Je.total," clés"]}),e.jsxs("span",{className:"flex items-center gap-1 text-green-600 dark:text-green-400",children:[e.jsx(h.CheckCircle,{className:"h-4 w-4"}),Je.valid," traduites"]}),e.jsxs("span",{className:"flex items-center gap-1 text-red-600 dark:text-red-400",children:[e.jsx(h.XCircle,{className:"h-4 w-4"}),Je.missing," manquantes"]}),e.jsxs("span",{className:"flex items-center gap-1 text-yellow-600 dark:text-yellow-400",children:[e.jsx(h.AlertTriangle,{className:"h-4 w-4"}),Je.identical," identiques"]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{placeholder:"Rechercher une clé ou une traduction...",value:y,onChange:G=>j(G.target.value),className:"pl-10"}),y&&e.jsx("button",{onClick:()=>j(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:e.jsx(h.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.Filter,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs(Ve,{value:x,onValueChange:G=>v(G),children:[e.jsx($e,{className:"w-[180px]",children:e.jsx(We,{})}),e.jsxs(Le,{children:[e.jsxs(je,{value:"all",children:["Toutes (",Je.total,")"]}),e.jsxs(je,{value:"missing",children:["Manquantes (",Je.missing,")"]}),e.jsxs(je,{value:"incomplete",children:["Incomplètes (",Je.missing+Je.identical,")"]}),e.jsxs(je,{value:"identical",children:["Identiques (",Je.identical,")"]})]})]})]})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{className:"sticky top-0 bg-muted/50 backdrop-blur z-10",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left p-3 font-medium text-sm border-b w-[280px]",children:"Clé"}),e.jsxs("th",{className:"text-left p-3 font-medium text-sm border-b",children:[U.find(G=>G.code===ae)?.label||ae," (source)"]}),se.map(G=>e.jsx("th",{className:"text-left p-3 font-medium text-sm border-b",children:e.jsxs("span",{className:"flex items-center gap-2",children:[G.flag&&e.jsx("span",{children:G.flag}),G.label]})},G.code)),e.jsx("th",{className:"text-center p-3 font-medium text-sm border-b w-[100px]",children:"État"}),e.jsx("th",{className:"text-center p-3 font-medium text-sm border-b w-[60px]",children:"Actions"})]})}),e.jsxs("tbody",{children:[Array.from(De.entries()).map(([G,ee])=>e.jsxs(c.Fragment,{children:[G!=="__root__"&&e.jsx("tr",{className:"bg-muted/30",children:e.jsx("td",{colSpan:se.length+4,className:"p-2",children:e.jsxs("button",{onClick:()=>Et(G),className:"flex items-center gap-2 text-sm font-medium hover:text-primary transition-colors",children:[k.has(G)?e.jsx(h.ChevronRight,{className:"h-4 w-4"}):e.jsx(h.ChevronDown,{className:"h-4 w-4"}),G,e.jsx(Se,{variant:"secondary",className:"text-xs",children:ee.length})]})})}),!k.has(G)&&ee.map(re=>{const we=Za(re,U.map(be=>be.code),ae);return e.jsxs("tr",{className:"border-b hover:bg-muted/30 transition-colors",children:[e.jsx("td",{className:"p-3 font-mono text-sm",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate max-w-[200px]",title:re.key,children:re.key}),e.jsxs(Ys,{children:[e.jsx(Js,{asChild:!0,children:e.jsx("button",{onClick:()=>gt(re.key),className:"text-muted-foreground hover:text-foreground",children:e.jsx(h.Copy,{className:"h-3 w-3"})})}),e.jsx(ks,{children:"Copier la clé"})]})]})}),e.jsx("td",{className:"p-2",children:e.jsx(wo,{value:re.translations[ae]?.value||"",onChange:be=>Ne(re.key,ae,be),placeholder:"Texte source...",status:re.translations[ae]?.value?"valid":"missing"})}),se.map(be=>{const Mt=oc(re,be.code,ae);return e.jsx("td",{className:"p-2",children:e.jsx(wo,{value:re.translations[be.code]?.value||"",onChange:ys=>Ne(re.key,be.code,ys),placeholder:`Traduction ${be.label}...`,status:Mt})},be.code)}),e.jsx("td",{className:"p-3 text-center",children:e.jsx(bv,{status:we})}),e.jsx("td",{className:"p-3 text-center",children:e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx(L,{variant:"ghost",size:"sm",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(_e,{align:"end",children:[e.jsxs(pe,{onClick:()=>{P(re),A(!0)},children:[e.jsx(h.Edit3,{className:"h-4 w-4 mr-2"}),"Éditer"]}),e.jsxs(pe,{onClick:()=>gt(re.key),children:[e.jsx(h.Copy,{className:"h-4 w-4 mr-2"}),"Copier la clé"]}),e.jsx(Qe,{}),e.jsxs(pe,{className:"text-destructive",onClick:()=>xt(re.key),children:[e.jsx(h.Trash2,{className:"h-4 w-4 mr-2"}),"Supprimer"]})]})]})})]},re.key)})]},G)),de.length===0&&e.jsx("tr",{children:e.jsxs("td",{colSpan:se.length+4,className:"p-12 text-center",children:[e.jsx(h.Languages,{className:"h-12 w-12 mx-auto text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:y||x!=="all"?"Aucune traduction ne correspond à vos critères":"Aucune traduction disponible"})]})})]})]})}),e.jsx(sa,{open:R,onOpenChange:A,children:e.jsxs(Ds,{className:"w-[500px] sm:max-w-[500px]",children:[e.jsxs(Da,{children:[e.jsx(Ta,{children:"Éditer la traduction"}),e.jsx(Aa,{children:D?.key})]}),D&&e.jsxs("div",{className:"py-6 space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium",children:[U.find(G=>G.code===ae)?.label," (source)"]}),e.jsx(ft,{value:D.translations[ae]?.value||"",onChange:G=>{Ne(D.key,ae,G.target.value),P({...D,translations:{...D.translations,[ae]:{...D.translations[ae],value:G.target.value}}})},placeholder:"Texte source...",className:"min-h-[100px]"})]}),U.filter(G=>G.code!==ae).map(G=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[G.flag&&e.jsx("span",{children:G.flag}),G.label]}),e.jsx(ft,{value:D.translations[G.code]?.value||"",onChange:ee=>{Ne(D.key,G.code,ee.target.value),P({...D,translations:{...D.translations,[G.code]:{...D.translations[G.code],value:ee.target.value}}})},placeholder:`Traduction ${G.label}...`,className:"min-h-[100px]"})]},G.code)),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Commentaire (optionnel)"}),e.jsx(ft,{placeholder:"Contexte ou indication pour la traduction...",className:"min-h-[80px]"})]})]}),e.jsx(Mr,{children:e.jsx(L,{variant:"outline",onClick:()=>A(!1),children:"Fermer"})})]})}),e.jsx(It,{open:S,onOpenChange:M,children:e.jsxs(Tt,{children:[e.jsxs(Ht,{children:[e.jsx(Xt,{children:"Ajouter une clé de traduction"}),e.jsx(Cs,{children:"Entrez la clé de traduction (ex: common.buttons.submit)"})]}),e.jsx("div",{className:"py-4",children:e.jsx(oe,{value:B,onChange:G=>W(G.target.value),placeholder:"namespace.key.name"})}),e.jsxs(Gt,{children:[e.jsx(L,{variant:"outline",onClick:()=>M(!1),children:"Annuler"}),e.jsx(L,{onClick:Ke,children:"Ajouter"})]})]})}),e.jsx(It,{open:E,onOpenChange:T,children:e.jsxs(Tt,{children:[e.jsxs(Ht,{children:[e.jsx(Xt,{children:"Ajouter une langue"}),e.jsx(Cs,{children:"Configurez la nouvelle langue à ajouter"})]}),e.jsxs("div",{className:"py-4 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Code (ex: de, it, pt)"}),e.jsx(oe,{value:I.code,onChange:G=>z({...I,code:G.target.value}),placeholder:"de"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Label"}),e.jsx(oe,{value:I.label,onChange:G=>z({...I,label:G.target.value}),placeholder:"Allemand"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Emoji drapeau (optionnel)"}),e.jsx(oe,{value:I.flag,onChange:G=>z({...I,flag:G.target.value}),placeholder:"🇩🇪"})]})]}),e.jsxs(Gt,{children:[e.jsx(L,{variant:"outline",onClick:()=>T(!1),children:"Annuler"}),e.jsx(L,{onClick:Ye,children:"Ajouter"})]})]})}),e.jsx(It,{open:K,onOpenChange:q,children:e.jsxs(Tt,{children:[e.jsxs(Ht,{children:[e.jsx(Xt,{children:"Importer des traductions"}),e.jsx(Cs,{children:"Sélectionnez un fichier JSON à importer"})]}),e.jsxs("div",{className:"py-4 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Fichier JSON"}),e.jsx(oe,{type:"file",accept:".json",onChange:G=>_(G.target.files?.[0]||null)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Langue cible"}),e.jsxs(Ve,{value:F,onValueChange:H,children:[e.jsx($e,{children:e.jsx(We,{placeholder:"Sélectionner une langue"})}),e.jsx(Le,{children:U.map(G=>e.jsxs(je,{value:G.code,children:[G.flag&&e.jsx("span",{className:"mr-2",children:G.flag}),G.label]},G.code))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Stratégie"}),e.jsxs(Ve,{value:J,onValueChange:G=>Q(G),children:[e.jsx($e,{children:e.jsx(We,{})}),e.jsxs(Le,{children:[e.jsx(je,{value:"merge",children:"Fusionner (conserver les existantes)"}),e.jsx(je,{value:"overwrite",children:"Écraser tout"})]})]})]})]}),e.jsxs(Gt,{children:[e.jsx(L,{variant:"outline",onClick:()=>q(!1),children:"Annuler"}),e.jsx(L,{onClick:et,disabled:!$||!F,children:"Importer"})]})]})})]})})}exports.Accordion=rr;exports.AccordionContent=hr;exports.AccordionItem=ur;exports.AccordionTrigger=mr;exports.AdmincrumbProvider=xb;exports.Alert=To;exports.AlertDescription=Eo;exports.AlertDialog=fs;exports.AlertDialogAction=es;exports.AlertDialogCancel=ts;exports.AlertDialogContent=Kt;exports.AlertDialogDescription=Zt;exports.AlertDialogFooter=Jt;exports.AlertDialogHeader=Yt;exports.AlertDialogOverlay=fr;exports.AlertDialogPortal=Do;exports.AlertDialogTitle=Qt;exports.AlertDialogTrigger=So;exports.AlertTitle=Ao;exports.AspectRatio=ld;exports.Avatar=yt;exports.AvatarFallback=Ct;exports.AvatarImage=Nt;exports.Badge=Se;exports.BlockLanguageSelector=Nb;exports.Blockquote=ll;exports.Button=L;exports.CHART_SIZE_MAP=Xx;exports.Calendar=ka;exports.Card=ke;exports.CardContent=Te;exports.CardDescription=ot;exports.CardFooter=pr;exports.CardHeader=qe;exports.CardTitle=Oe;exports.Checkbox=Ze;exports.Code=Uo;exports.Collapsible=Bo;exports.CollapsibleContent=Ho;exports.CollapsibleTrigger=qo;exports.Command=ss;exports.CommandDialog=Cp;exports.CommandEmpty=gs;exports.CommandGroup=Ot;exports.CommandInput=xs;exports.CommandItem=zt;exports.CommandList=ea;exports.CommandSeparator=ja;exports.CommandShortcut=Ko;exports.ContextMenu=Yo;exports.ContextMenuCheckboxItem=ei;exports.ContextMenuContent=yr;exports.ContextMenuGroup=kp;exports.ContextMenuItem=Ft;exports.ContextMenuLabel=si;exports.ContextMenuPortal=Sp;exports.ContextMenuRadioGroup=Tp;exports.ContextMenuRadioItem=ti;exports.ContextMenuSeparator=Vs;exports.ContextMenuShortcut=ai;exports.ContextMenuSub=Dp;exports.ContextMenuSubContent=Zo;exports.ContextMenuSubTrigger=Qo;exports.ContextMenuTrigger=Jo;exports.DEFAULT_CHART_COLORS=Gx;exports.DataTable=gx;exports.DataTableAdvanced=wx;exports.DataTableColumnResizer=yx;exports.DataTableContextMenu=Sx;exports.DataTableEditCell=wa;exports.DataTableFilters=Vr;exports.DataTableGroupTotals=Cx;exports.DataTableGrouping=Nx;exports.DataTableGroupingControls=kx;exports.DataTablePagination=_r;exports.DataTableSelection=Dx;exports.DataTableToolbar=Qs;exports.Dialog=It;exports.DialogClose=Xo;exports.DialogContent=Tt;exports.DialogDescription=Cs;exports.DialogFooter=Gt;exports.DialogHeader=Ht;exports.DialogOverlay=wr;exports.DialogPortal=Go;exports.DialogTitle=Xt;exports.DialogTrigger=Np;exports.DrawerBody=Xr;exports.DrawerClose=dg;exports.DrawerDescription=Jr;exports.DrawerFooter=Kr;exports.DrawerHeader=Gr;exports.DrawerTitle=Yr;exports.DrawerTrigger=cg;exports.DropdownMenu=He;exports.DropdownMenuCheckboxItem=ds;exports.DropdownMenuContent=_e;exports.DropdownMenuGroup=Ap;exports.DropdownMenuItem=pe;exports.DropdownMenuLabel=ms;exports.DropdownMenuPortal=Ep;exports.DropdownMenuRadioGroup=Pp;exports.DropdownMenuRadioItem=oi;exports.DropdownMenuSeparator=Qe;exports.DropdownMenuShortcut=ii;exports.DropdownMenuSub=Mp;exports.DropdownMenuSubContent=ni;exports.DropdownMenuSubTrigger=ri;exports.DropdownMenuTrigger=Ge;exports.EmptyCartState=Cj;exports.Error403Page=Aj;exports.Error404Page=Dj;exports.Error500Page=Tj;exports.ErrorState=Sj;exports.Footer=vb;exports.Form=Gp;exports.FormControl=bi;exports.FormDescription=ji;exports.FormField=Xp;exports.FormItem=xi;exports.FormLabel=gi;exports.FormMessage=vi;exports.Heading=ol;exports.Headtab=wb;exports.HeadtabBreadcrumb=yb;exports.HoverCard=Kp;exports.HoverCardContent=wi;exports.HoverCardTrigger=Yp;exports.Input=oe;exports.InputOTP=yi;exports.Kbd=dl;exports.Label=me;exports.LanguageProvider=Yl;exports.LanguageSelector=Qp;exports.Layout=Cb;exports.LegacyThemeProvider=ib;exports.Login=kb;exports.MaintenancePage=Ej;exports.Menubar=ki;exports.MenubarCheckboxItem=Mi;exports.MenubarContent=Ai;exports.MenubarGroup=ex;exports.MenubarItem=Ei;exports.MenubarLabel=Ri;exports.MenubarMenu=Zp;exports.MenubarPortal=tx;exports.MenubarRadioGroup=ax;exports.MenubarRadioItem=Pi;exports.MenubarSeparator=Fi;exports.MenubarShortcut=$i;exports.MenubarSub=sx;exports.MenubarSubContent=Ti;exports.MenubarSubTrigger=Di;exports.MenubarTrigger=Si;exports.ModalBody=an;exports.ModalContent=Zr;exports.ModalDescription=sn;exports.ModalFooter=rn;exports.ModalHeader=en;exports.ModalOverlay=Qr;exports.ModalTitle=tn;exports.NavigationMenu=Li;exports.NavigationMenuContent=_i;exports.NavigationMenuIndicator=Vi;exports.NavigationMenuItem=rx;exports.NavigationMenuLink=nx;exports.NavigationMenuList=Ii;exports.NavigationMenuTrigger=zi;exports.NavigationMenuViewport=Dr;exports.NoDataState=vj;exports.NoFilesState=Nj;exports.NoMessagesState=yj;exports.NoNotificationsState=kj;exports.NoResultsState=wj;exports.OfflinePage=Mj;exports.Popover=rt;exports.PopoverContent=st;exports.PopoverTrigger=nt;exports.Progress=Xs;exports.RadioGroup=Wi;exports.RadioGroupItem=Ui;exports.ScrollArea=At;exports.ScrollBar=Tr;exports.Select=Ve;exports.SelectContent=Le;exports.SelectGroup=Jp;exports.SelectItem=je;exports.SelectLabel=Ni;exports.SelectScrollDownButton=Sr;exports.SelectScrollUpButton=kr;exports.SelectSeparator=Ci;exports.SelectTrigger=$e;exports.SelectValue=We;exports.Separator=kt;exports.Sheet=sa;exports.SheetClose=ox;exports.SheetContent=Ds;exports.SheetDescription=Aa;exports.SheetFooter=Mr;exports.SheetHeader=Da;exports.SheetOverlay=Er;exports.SheetPortal=Bi;exports.SheetTitle=Ta;exports.SheetTrigger=Ar;exports.SidebarLayout=Eb;exports.Skeleton=qi;exports.Slider=va;exports.StepperNavigation=Bg;exports.Switch=aa;exports.Table=Ea;exports.TableBody=Pa;exports.TableCaption=Gi;exports.TableCell=tt;exports.TableFooter=Hi;exports.TableHead=ct;exports.TableHeader=Ma;exports.TableRow=qt;exports.Tabs=ra;exports.TabsContent=vs;exports.TabsList=Ts;exports.TabsTrigger=js;exports.Text=rl;exports.Textarea=ft;exports.ThemeLoader=jr;exports.ThemeProvider=Ki;exports.ThemeSelector=Yi;exports.Toast=Rr;exports.ToastAction=Qi;exports.ToastClose=Fr;exports.ToastDescription=Lr;exports.ToastProvider=Ji;exports.ToastTitle=$r;exports.ToastViewport=Pr;exports.Toaster=hx;exports.Toggle=sl;exports.Tooltip=Ys;exports.TooltipContent=ks;exports.TooltipProvider=Ks;exports.TooltipTrigger=Js;exports.WakaActivityTimeline=tj;exports.WakaAdmincrumb=yl;exports.WakaAreaChart=Sl;exports.WakaAutocomplete=Wr;exports.WakaAutocompleteForm=Nl;exports.WakaBarChart=Cl;exports.WakaBarcode=Ix;exports.WakaBreadcrumb=zx;exports.WakaCalendarView=uj;exports.WakaCarousel=Vx;exports.WakaChart=Es;exports.WakaChat=gj;exports.WakaColorPicker=qr;exports.WakaColorPickerForm=El;exports.WakaCombobox=Qx;exports.WakaDashboard=Ib;exports.WakaDateRangePicker=eg;exports.WakaDateTimePicker=Hr;exports.WakaDateTimePickerForm=sg;exports.WakaDrawer=ig;exports.WakaEmptyState=rs;exports.WakaErrorPage=Ms;exports.WakaFAQ=$j;exports.WakaFileManager=_j;exports.WakaFileUpload=Rl;exports.WakaHeader=Mb;exports.WakaI18nEditor=jv;exports.WakaImage=Fl;exports.WakaImageGallery=mg;exports.WakaKanban=xg;exports.WakaKanbanBoard=qj;exports.WakaLanding=Zj;exports.WakaLineChart=kl;exports.WakaMiniChart=Tl;exports.WakaModal=wg;exports.WakaModalTrigger=yg;exports.WakaNotifications=$l;exports.WakaNumberInput=Sg;exports.WakaPagination=Ag;exports.WakaPieChart=Dl;exports.WakaPricing=cv;exports.WakaProfile=qb;exports.WakaProvider=hb;exports.WakaQRCode=Pg;exports.WakaRichTextEditor=Ll;exports.WakaSegmentedControl=Lg;exports.WakaSettings=Vb;exports.WakaSidebar=ec;exports.WakaSparkline=Br;exports.WakaSpinner=zl;exports.WakaStat=_l;exports.WakaStatGroup=Vl;exports.WakaStepper=Ug;exports.WakaThemeCreator=Wl;exports.WakaThemeManager=Bl;exports.WakaTimePicker=Kg;exports.WakaTimeline=Jg;exports.WakaTree=eb;exports.WakaUserManagement=Jb;exports.WakaVideo=sb;exports.WakaVirtualList=nb;exports.WakaWizard=pv;exports.addChildNode=dn;exports.applyTheme=dp;exports.badgeVariants=Mo;exports.blockquoteVariants=il;exports.calculateDuration=Bf;exports.cn=b;exports.compareRanges=np;exports.createBookingDateValidator=Yf;exports.createCardExpiryValidator=Kf;exports.createChartColumn=qx;exports.createCommonPresets=$f;exports.createCustomPreset=Of;exports.createLastDaysPresets=Lf;exports.createMaxAgeValidator=Wf;exports.createMaxRangeDaysValidator=Jf;exports.createMinAgeValidator=Vf;exports.createMonthlyPresets=tp;exports.createNextDaysPresets=If;exports.createQuarterPresets=ep;exports.dateToTimestamp=sp;exports.defaultActivities=aj;exports.defaultActivityFilters=sj;exports.defaultCalendarEvents=mj;exports.defaultChatConversations=bj;exports.defaultChatMessages=jj;exports.defaultChatUser=Bs;exports.defaultDashboardStats=Ob;exports.defaultFAQCategories=Lj;exports.defaultFAQItems=Ij;exports.defaultFileManagerBreadcrumbs=Wj;exports.defaultFiles=Vj;exports.defaultKanbanColumns=Hj;exports.defaultKanbanLabels=Gj;exports.defaultLandingCTA=rv;exports.defaultLandingFeatures=tv;exports.defaultLandingHero=av;exports.defaultLandingNavItems=ev;exports.defaultLandingTestimonials=sv;exports.defaultPermissions=Zb;exports.defaultPresets=Ml;exports.defaultPricingFAQ=uv;exports.defaultPricingPlans=dv;exports.defaultProfileData=Hb;exports.defaultSettingsTabs=Wb;exports.defaultUsers=Qb;exports.defaultWizardSteps=xv;exports.exportToCSV=ul;exports.exportToJSON=ml;exports.findNodeById=ln;exports.formatDateRange=qf;exports.getDatesInMonth=br;exports.getFrenchHolidays=Hf;exports.getThemeLoader=vr;exports.getWeekdaysInMonth=Xf;exports.getWeekendsInMonth=Gf;exports.getWorkingDays=Zf;exports.headingVariants=nl;exports.initThemeLoader=lp;exports.isDateInRange=Lt;exports.isFutureDate=zf;exports.isHoliday=Wo;exports.isNotExpired=Uf;exports.isPastDate=_o;exports.isSameDay=Qf;exports.isToday=_f;exports.isWeekday=gr;exports.isWeekend=Vo;exports.kbdVariants=cl;exports.loadTableState=fl;exports.loadTheme=cp;exports.mergeRanges=op;exports.moveNode=tb;exports.navigationMenuTriggerStyle=Oi;exports.normalizeDate=rp;exports.parseCSV=fx;exports.rangesOverlap=ip;exports.reducer=Zi;exports.removeNode=cn;exports.saveTableState=hl;exports.sparklineTemplate=Hx;exports.textVariants=al;exports.themeManagerVariants=Ul;exports.timestampToDate=ap;exports.toast=el;exports.toggleVariants=tl;exports.tweak=ba;exports.updateNode=Xl;exports.useAdmincrumb=Rx;exports.useAdmincrumbContext=gb;exports.useAdmincrumbContextOptional=bb;exports.useBreadcrumbFromPath=_x;exports.useChartTheme=As;exports.useCombobox=Zx;exports.useDataTable=pl;exports.useDataTableAdvanced=xl;exports.useDataTableEdit=zr;exports.useDataTableExport=bl;exports.useDataTableImport=jl;exports.useDataTableSelection=Tx;exports.useDataTableTheme=vl;exports.useDataTableVirtualization=gl;exports.useDateForm=ag;exports.useDateRangePicker=tg;exports.useDrawer=lg;exports.useFormField=ta;exports.useKanban=gg;exports.useLanguage=un;exports.useLegacyTheme=mb;exports.useModal=Ng;exports.useNotifications=kg;exports.useNumberInput=Dg;exports.usePagination=Eg;exports.useQRCode=Rg;exports.useRechartsLoader=Ur;exports.useSegmentedControl=Ig;exports.useSidebar=Ab;exports.useStat=Vg;exports.useStepperContext=on;exports.useTableLayout=Or;exports.useTheme=na;exports.useThemeLoader=up;exports.useTimePicker=Yg;exports.useToast=Ir;exports.useTranslation=Pl;exports.useVideo=ab;exports.useVirtualList=ob;exports.useWaka=pb;exports.useWizard=mv;
76
+ }`,value:j,onChange:te=>x(te.target.value),className:"font-mono text-sm min-h-[300px]"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(L,{onClick:H,disabled:P,children:[e.jsx(h.Eye,{className:"mr-2 h-4 w-4"}),"Prévisualiser"]}),e.jsx(L,{variant:"outline",onClick:ne,children:A?e.jsxs(e.Fragment,{children:[e.jsx(h.Check,{className:"mr-2 h-4 w-4"}),"Copié !"]}):e.jsxs(e.Fragment,{children:[e.jsx(h.Copy,{className:"mr-2 h-4 w-4"}),"Copier CSS"]})}),e.jsxs(L,{variant:"outline",onClick:U,children:[e.jsx(h.Download,{className:"mr-2 h-4 w-4"}),"Télécharger"]}),e.jsx("div",{className:"ml-auto",children:e.jsx(L,{onClick:Q,disabled:N,children:N?e.jsxs(e.Fragment,{children:[e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),"Publication..."]}):e.jsxs(e.Fragment,{children:[e.jsx(h.Upload,{className:"mr-2 h-4 w-4"}),"Publier sur S3"]})})})]})]})]}),W.length>0&&e.jsxs(ke,{children:[e.jsx(qe,{children:e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.History,{className:"h-5 w-5"}),"Historique des versions"]})}),e.jsx(Te,{children:e.jsx("div",{className:"space-y-3",children:W.slice().reverse().map((te,Z)=>e.jsxs("div",{className:"flex items-start gap-3 p-3 border rounded-lg",children:[e.jsxs(Se,{variant:"outline",children:["v",te.version]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium",children:te.changelog||"Aucune description"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Par ",te.createdBy," • ",te.createdAt.toLocaleDateString()]})]}),e.jsx(L,{variant:"ghost",size:"sm",onClick:()=>x(te.css),children:"Charger"})]},Z))})})]})]})]}),e.jsx(fs,{open:M,onOpenChange:E,children:e.jsxs(Kt,{children:[e.jsxs(Yt,{children:[e.jsx(Qt,{children:"Supprimer le thème ?"}),e.jsx(Zt,{children:"Cette action est irréversible. Le thème sera supprimé de S3."})]}),e.jsxs(Jt,{children:[e.jsx(ts,{children:"Annuler"}),e.jsx(es,{onClick:()=>{q&&(a?.(q.id),Y()),E(!1)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer"})]})]})})]})}Wl.displayName="WakaThemeCreator";function qg(){try{return ia()}catch{return null}}const Ul=Xe.cva("w-full",{variants:{size:{sm:"max-w-2xl",base:"max-w-4xl",lg:"max-w-6xl",full:"max-w-full"}},defaultVariants:{size:"base"}}),Bl=c.forwardRef(({className:t,size:s,onThemeChange:a,onThemeLoad:r,onThemeSave:n,initialTheme:o,showPreview:i=!0,showExport:l=!0,showImport:u=!0,allowCustomColors:d=!0,...f},m)=>{const p=qg(),w=p?.theme,C=p?.themes||[],g=p?.setTheme,[y,j]=O.useState(o||{name:"Custom Theme",description:"Thème personnalisé",colors:{background:"#ffffff",foreground:"#0a0a0a",card:"#ffffff",cardForeground:"#0a0a0a",popover:"#ffffff",popoverForeground:"#0a0a0a",primary:"#0a0a0a",primaryForeground:"#fafafa",secondary:"#f4f4f5",secondaryForeground:"#0a0a0a",muted:"#f4f4f5",mutedForeground:"#737373",accent:"#f4f4f5",accentForeground:"#0a0a0a",destructive:"#ef4444",destructiveForeground:"#fafafa",border:"#e4e4e7",input:"#e4e4e7",ring:"#0a0a0a"}}),[x,v]=O.useState(!1),[k,N]=O.useState(null),[D,P]=O.useState(null),[R,A]=O.useState(""),[S,M]=O.useState(!1),[E,T]=O.useState("auto"),K=O.useCallback($=>{const _=document.documentElement;if(Object.entries($.colors).forEach(([F,H])=>{const J=`--${F.replace(/([A-Z])/g,"-$1").toLowerCase()}`;_.style.setProperty(J,H)}),g){const F={id:$.name.toLowerCase().replace(/\s+/g,"-"),label:$.name,description:$.description||"",previewColor:$.colors.primary};g(F.id)}},[g]),q=async $=>{v(!0),N(null),P(null);try{const _=await fetch($);if(!_.ok)throw new Error(`Erreur HTTP: ${_.status}`);const F=await _.json();if(!F.name||!F.colors)throw new Error("Format de thème invalide");const H={name:F.name,description:F.description||"",author:F.author||"",version:F.version||"1.0.0",colors:{background:F.colors.background||"#ffffff",foreground:F.colors.foreground||"#0a0a0a",card:F.colors.card||"#ffffff",cardForeground:F.colors.cardForeground||"#0a0a0a",popover:F.colors.popover||"#ffffff",popoverForeground:F.colors.popoverForeground||"#0a0a0a",primary:F.colors.primary||"#0a0a0a",primaryForeground:F.colors.primaryForeground||"#fafafa",secondary:F.colors.secondary||"#f4f4f5",secondaryForeground:F.colors.secondaryForeground||"#0a0a0a",muted:F.colors.muted||"#f4f4f5",mutedForeground:F.colors.mutedForeground||"#737373",accent:F.colors.accent||"#f4f4f5",accentForeground:F.colors.accentForeground||"#0a0a0a",destructive:F.colors.destructive||"#ef4444",destructiveForeground:F.colors.destructiveForeground||"#fafafa",border:F.colors.border||"#e4e4e7",input:F.colors.input||"#e4e4e7",ring:F.colors.ring||"#0a0a0a",chart1:F.colors.chart1,chart2:F.colors.chart2,chart3:F.colors.chart3,chart4:F.colors.chart4,chart5:F.colors.chart5}};j(H),K(H),r?.(H),P("Thème chargé avec succès !")}catch(_){N(_ instanceof Error?_.message:"Erreur lors du chargement du thème")}finally{v(!1)}},B=()=>{const $=JSON.stringify(y,null,2),_=new Blob([$],{type:"application/json"}),F=URL.createObjectURL(_),H=document.createElement("a");H.href=F,H.download=`${y.name.toLowerCase().replace(/\s+/g,"-")}-theme.json`,document.body.appendChild(H),H.click(),document.body.removeChild(H),URL.revokeObjectURL(F)},W=async()=>{try{await navigator.clipboard.writeText(JSON.stringify(y,null,2)),M(!0),setTimeout(()=>M(!1),2e3)}catch{N("Impossible de copier le thème")}},I=($,_)=>{const F={...y,colors:{...y.colors,[$]:_}};j(F),K(F),a?.(F)},z=()=>{n?.(y),P("Thème sauvegardé !")};return O.useEffect(()=>{K(y)},[y,K]),O.useEffect(()=>{const $=document.documentElement;E==="dark"?$.classList.add("dark"):E==="light"?$.classList.remove("dark"):window.matchMedia("(prefers-color-scheme: dark)").matches?$.classList.add("dark"):$.classList.remove("dark")},[E]),e.jsx("div",{ref:m,className:b(Ul({size:s}),t),...f,children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold",children:"Gestionnaire de Thèmes TweakCN"}),e.jsx("p",{className:"text-muted-foreground",children:"Créez, importez et prévisualisez vos thèmes personnalisés"})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs(Se,{variant:"outline",className:"flex items-center gap-1",children:[e.jsx(h.Palette,{className:"h-3 w-3"}),y.name]})})]}),k&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-destructive/10 border border-destructive/20 rounded-lg text-destructive",children:[e.jsx(h.AlertCircle,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:k})]}),D&&e.jsxs("div",{className:"flex items-center gap-2 p-3 bg-green-500/10 border border-green-500/20 rounded-lg text-green-600",children:[e.jsx(h.CheckCircle,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm",children:D})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[e.jsxs("div",{className:"space-y-6",children:[e.jsxs(ke,{children:[e.jsx(qe,{children:e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Settings,{className:"h-5 w-5"}),"Informations du thème"]})}),e.jsxs(Te,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(me,{htmlFor:"theme-name",children:"Nom"}),e.jsx(oe,{id:"theme-name",value:y.name,onChange:$=>j({...y,name:$.target.value}),placeholder:"Mon thème"})]}),e.jsxs("div",{children:[e.jsx(me,{htmlFor:"theme-author",children:"Auteur"}),e.jsx(oe,{id:"theme-author",value:y.author||"",onChange:$=>j({...y,author:$.target.value}),placeholder:"Votre nom"})]})]}),e.jsxs("div",{children:[e.jsx(me,{htmlFor:"theme-description",children:"Description"}),e.jsx(ft,{id:"theme-description",value:y.description||"",onChange:$=>j({...y,description:$.target.value}),placeholder:"Description du thème...",rows:3})]})]})]}),(u||l)&&e.jsxs(ke,{children:[e.jsx(qe,{children:e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Upload,{className:"h-5 w-5"}),"Import / Export"]})}),e.jsxs(Te,{className:"space-y-4",children:[u&&e.jsxs("div",{children:[e.jsx(me,{htmlFor:"import-url",children:"URL du thème JSON"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(oe,{id:"import-url",value:R,onChange:$=>A($.target.value),placeholder:"https://example.com/theme.json",className:"flex-1"}),e.jsx(L,{onClick:()=>q(R),disabled:!R||x,size:"sm",children:x?e.jsx(h.RefreshCw,{className:"h-4 w-4 animate-spin"}):e.jsx(h.Download,{className:"h-4 w-4"})})]})]}),l&&e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(L,{onClick:B,variant:"outline",className:"flex-1",children:[e.jsx(h.Download,{className:"h-4 w-4 mr-2"}),"Exporter JSON"]}),e.jsx(L,{onClick:W,variant:"outline",children:S?e.jsx(h.Check,{className:"h-4 w-4"}):e.jsx(h.Copy,{className:"h-4 w-4"})})]})]})]}),i&&e.jsxs(ke,{children:[e.jsx(qe,{children:e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Eye,{className:"h-5 w-5"}),"Prévisualisation"]})}),e.jsx(Te,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(L,{variant:E==="light"?"default":"outline",size:"sm",onClick:()=>T("light"),children:[e.jsx(h.Sun,{className:"h-4 w-4 mr-2"}),"Clair"]}),e.jsxs(L,{variant:E==="dark"?"default":"outline",size:"sm",onClick:()=>T("dark"),children:[e.jsx(h.Moon,{className:"h-4 w-4 mr-2"}),"Sombre"]}),e.jsxs(L,{variant:E==="auto"?"default":"outline",size:"sm",onClick:()=>T("auto"),children:[e.jsx(h.Monitor,{className:"h-4 w-4 mr-2"}),"Auto"]})]}),w&&e.jsxs("div",{className:"text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Thème actuel:"}),e.jsx("span",{className:"font-medium",children:w})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Mode sombre:"}),e.jsx("span",{className:"font-medium",children:"Géré par le système"})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx("span",{children:"Thèmes disponibles:"}),e.jsx("span",{className:"font-medium",children:C.length})]})]})]})})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(L,{onClick:z,className:"flex-1",children:"Sauvegarder le thème"}),e.jsxs(L,{variant:"outline",onClick:()=>window.open("https://tweakcn.com","_blank"),children:[e.jsx(h.ExternalLink,{className:"h-4 w-4 mr-2"}),"TweakCN"]})]})]}),d&&e.jsx("div",{className:"space-y-6",children:e.jsxs(ke,{children:[e.jsxs(qe,{children:[e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Palette,{className:"h-5 w-5"}),"Couleurs du thème"]}),e.jsx(ot,{children:"Cliquez sur une couleur pour la modifier"})]}),e.jsx(Te,{children:e.jsx("div",{className:"grid grid-cols-2 gap-4",children:Object.entries(y.colors).map(([$,_])=>e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:`color-${$}`,className:"text-sm font-medium",children:$.replace(/([A-Z])/g," $1").replace(/^./,F=>F.toUpperCase())}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("div",{className:"w-10 h-10 rounded border border-border cursor-pointer",style:{backgroundColor:_},onClick:()=>{document.getElementById(`color-${$}`)?.click()}}),e.jsx(oe,{id:`color-${$}`,type:"color",value:_,onChange:F=>I($,F.target.value),className:"flex-1 h-10"})]})]},$))})})]})})]}),i&&e.jsxs(ke,{children:[e.jsx(qe,{children:e.jsxs(Oe,{className:"flex items-center gap-2",children:[e.jsx(h.Eye,{className:"h-5 w-5"}),"Prévisualisation en temps réel"]})}),e.jsx(Te,{children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Boutons"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(L,{size:"sm",children:"Primary"}),e.jsx(L,{variant:"secondary",size:"sm",children:"Secondary"}),e.jsx(L,{variant:"outline",size:"sm",children:"Outline"}),e.jsx(L,{variant:"destructive",size:"sm",children:"Destructive"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Cards"}),e.jsxs(ke,{className:"p-3",children:[e.jsx(Oe,{className:"text-sm",children:"Exemple de carte"}),e.jsx(ot,{className:"text-xs",children:"Contenu de la carte avec le nouveau thème"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Inputs"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(oe,{placeholder:"Input normal"}),e.jsx(oe,{placeholder:"Input avec erreur",className:"border-destructive"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Badges"}),e.jsxs("div",{className:"flex flex-wrap gap-1",children:[e.jsx(Se,{children:"Default"}),e.jsx(Se,{variant:"secondary",children:"Secondary"}),e.jsx(Se,{variant:"destructive",children:"Destructive"}),e.jsx(Se,{variant:"outline",children:"Outline"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Séparateur"}),e.jsx(kt,{}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Texte avec couleur muted"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h4",{className:"font-medium",children:"Progress"}),e.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:e.jsx("div",{className:"bg-primary h-2 rounded-full",style:{width:"60%"}})})]})]})})]})]})})});Bl.displayName="WakaThemeManager";function Ta(t){const s=t.split(":");return{hours:parseInt(s[0]||"0",10),minutes:parseInt(s[1]||"0",10),seconds:parseInt(s[2]||"0",10)}}function ro(t,s,a,r){const n=t.toString().padStart(2,"0"),o=s.toString().padStart(2,"0"),i=a.toString().padStart(2,"0");return r?`${n}:${o}:${i}`:`${n}:${o}`}function Hg(t){const s=t>=12?"PM":"AM";let a=t%12;return a===0&&(a=12),{display:a,period:s}}function no(t,s){return s==="AM"?t===12?0:t:t===12?12:t+12}function Gg(t,s,a,r,n){const o=t*3600+s*60+a;if(r){const i=Ta(r),l=i.hours*3600+i.minutes*60+i.seconds;if(o<l)return!1}if(n){const i=Ta(n),l=i.hours*3600+i.minutes*60+i.seconds;if(o>l)return!1}return!0}function sr({value:t,onChange:s,max:a,step:r=1,disabled:n,label:o}){const i=c.useMemo(()=>{const d=[];for(let f=0;f<a;f+=r)d.push(f);return d},[a,r]),l=()=>{const f=(i.indexOf(t)+1)%i.length;s(i[f])},u=()=>{const d=i.indexOf(t),f=d===0?i.length-1:d-1;s(i[f])};return e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("span",{className:"text-xs text-muted-foreground mb-1",children:o}),e.jsx(L,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-8",onClick:l,disabled:n,tabIndex:-1,children:e.jsx(h.ChevronUp,{className:"h-4 w-4"})}),e.jsx("div",{className:"h-10 w-12 flex items-center justify-center text-lg font-medium",children:t.toString().padStart(2,"0")}),e.jsx(L,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-8",onClick:u,disabled:n,tabIndex:-1,children:e.jsx(h.ChevronDown,{className:"h-4 w-4"})})]})}function Xg({value:t,onChange:s,disabled:a}){return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(L,{type:"button",variant:t==="AM"?"default":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>s("AM"),disabled:a,children:"AM"}),e.jsx(L,{type:"button",variant:t==="PM"?"default":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>s("PM"),disabled:a,children:"PM"})]})}function Kg({value:t,onChange:s,placeholder:a="Sélectionner une heure",format:r="24h",showSeconds:n=!1,minuteStep:o=1,secondStep:i=1,minTime:l,maxTime:u,disabled:d=!1,error:f=!1,size:m="md",className:p,id:w,name:C}){const[g,y]=c.useState(!1),[j,x]=c.useState(t||""),v=t?Ta(t):{hours:0,minutes:0,seconds:0},[k,N]=c.useState(v.hours),[D,P]=c.useState(v.minutes),[R,A]=c.useState(v.seconds),[S,M]=c.useState(v.hours>=12?"PM":"AM");c.useEffect(()=>{if(t){const F=Ta(t);N(F.hours),P(F.minutes),A(F.seconds),M(F.hours>=12?"PM":"AM"),x(t)}},[t]);const E=c.useMemo(()=>{if(!t)return"";if(r==="12h"){const{display:F,period:H}=Hg(k);return`${F.toString().padStart(2,"0")}:${D.toString().padStart(2,"0")}${n?`:${R.toString().padStart(2,"0")}`:""} ${H}`}return ro(k,D,R,n)},[t,k,D,R,r,n]),T=(F,H,J)=>{if(!Gg(F,H,J,l,u))return;N(F),P(H),A(J);const Q=ro(F,H,J,n);s?.(Q)},K=F=>{const H=r==="12h"?no(F,S):F;T(H,D,R)},q=F=>{T(k,F,R)},B=F=>{T(k,D,F)},W=F=>{M(F);const H=k%12||12,J=no(H,F);T(J,D,R)},I=F=>{const H=F.target.value;x(H);const J=n?/^(\d{1,2}):(\d{2}):(\d{2})$/:/^(\d{1,2}):(\d{2})$/,Q=H.match(J);if(Q){const ne=parseInt(Q[1],10),X=parseInt(Q[2],10),Y=n?parseInt(Q[3],10):0;ne>=0&&ne<24&&X>=0&&X<60&&Y>=0&&Y<60&&T(ne,X,Y)}},z={sm:"h-8 text-xs",md:"h-9 text-sm",lg:"h-10 text-base"},$={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},_=r==="12h"?k%12||12:k;return e.jsxs(rt,{open:g,onOpenChange:y,children:[e.jsx(nt,{asChild:!0,children:e.jsxs("div",{className:b("relative",p),children:[e.jsx(oe,{id:w,name:C,value:E,onChange:I,placeholder:a,disabled:d,className:b(z[m],"pr-10",f&&"border-destructive focus-visible:ring-destructive")}),e.jsx(L,{type:"button",variant:"ghost",size:"icon",className:b("absolute right-0 top-0 h-full px-2",d&&"pointer-events-none opacity-50"),onClick:()=>!d&&y(!g),tabIndex:-1,children:e.jsx(h.Clock,{className:$[m]})})]})}),e.jsxs(st,{className:"w-auto p-4",align:"start",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(sr,{value:_,onChange:K,max:r==="12h"?13:24,disabled:d,label:"Heures"}),e.jsx("span",{className:"text-xl font-medium",children:":"}),e.jsx(sr,{value:D,onChange:q,max:60,step:o,disabled:d,label:"Minutes"}),n&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-xl font-medium",children:":"}),e.jsx(sr,{value:R,onChange:B,max:60,step:i,disabled:d,label:"Secondes"})]}),r==="12h"&&e.jsx("div",{className:"ml-2",children:e.jsx(Xg,{value:S,onChange:W,disabled:d})})]}),e.jsxs("div",{className:"flex gap-2 mt-4 pt-4 border-t",children:[e.jsx(L,{type:"button",variant:"outline",size:"sm",onClick:()=>{const F=new Date;T(F.getHours(),F.getMinutes(),F.getSeconds())},disabled:d,children:"Maintenant"}),e.jsx(L,{type:"button",variant:"outline",size:"sm",onClick:()=>T(0,0,0),disabled:d,children:"00:00"}),e.jsx(L,{type:"button",variant:"outline",size:"sm",onClick:()=>T(12,0,0),disabled:d,children:"12:00"})]})]})]})}function Yg(t={}){const{initialValue:s="",format:a="24h",showSeconds:r=!1}=t,[n,o]=c.useState(s);return{value:n,onChange:o,clear:()=>o(""),setNow:()=>{const u=new Date,d=u.getHours().toString().padStart(2,"0"),f=u.getMinutes().toString().padStart(2,"0"),m=u.getSeconds().toString().padStart(2,"0");o(r?`${d}:${f}:${m}`:`${d}:${f}`)},format:a,showSeconds:r}}const ql={completed:{icon:h.Check,color:"text-green-600",bgColor:"bg-green-100"},current:{icon:h.Circle,color:"text-primary",bgColor:"bg-primary/10"},pending:{icon:h.Clock,color:"text-muted-foreground",bgColor:"bg-muted"},error:{icon:h.AlertCircle,color:"text-destructive",bgColor:"bg-destructive/10"}};function oo({status:t,icon:s,color:a,size:r}){const n=ql[t],o=n.icon,i={sm:"h-6 w-6",md:"h-8 w-8",lg:"h-10 w-10"},l={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"};return e.jsx("div",{className:b("rounded-full flex items-center justify-center flex-shrink-0 border-2 border-background shadow-sm",i[r],a?"":n.bgColor),style:a?{backgroundColor:a+"20"}:void 0,children:s||e.jsx(o,{className:b(l[r],a?"":n.color),style:a?{color:a}:void 0})})}function io({item:t,isLast:s,size:a,showDate:r,dateFormat:n,collapsible:o,onItemClick:i,orientation:l,position:u}){const[d,f]=c.useState(!1),m=t.status||"pending",p={sm:{title:"text-sm",desc:"text-xs",date:"text-[10px]"},md:{title:"text-base",desc:"text-sm",date:"text-xs"},lg:{title:"text-lg",desc:"text-base",date:"text-sm"}},w=y=>(typeof y=="string"?new Date(y):y).toLocaleDateString("fr-FR",n||{day:"numeric",month:"short",year:"numeric"}),C=()=>{o&&t.content&&f(!d),i?.(t)};if(l==="horizontal")return e.jsxs("div",{className:"flex flex-col items-center flex-1 min-w-[120px]",children:[r&&t.date&&e.jsx("div",{className:b("mb-2 text-muted-foreground",p[a].date),children:w(t.date)}),e.jsxs("div",{className:"flex items-center w-full",children:[e.jsx("div",{className:b("flex-1 h-0.5",s?"":"bg-border"),style:m==="completed"?{backgroundColor:ql.completed.color.replace("text-","")}:void 0}),e.jsx(oo,{status:m,icon:t.icon,color:t.color,size:a}),e.jsx("div",{className:b("flex-1 h-0.5",s?"":"bg-border")})]}),e.jsxs("div",{className:b("mt-2 text-center",i&&"cursor-pointer hover:opacity-80"),onClick:C,children:[e.jsx("h4",{className:b("font-medium",p[a].title),children:t.title}),t.description&&e.jsx("p",{className:b("text-muted-foreground mt-0.5",p[a].desc),children:t.description})]})]});const g=u==="right";return e.jsxs("div",{className:b("flex gap-4",g&&"flex-row-reverse"),children:[u!=="left"&&r&&t.date&&e.jsx("div",{className:b("w-24 text-muted-foreground pt-1",p[a].date,g?"text-left":"text-right"),children:w(t.date)}),e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx(oo,{status:m,icon:t.icon,color:t.color,size:a}),!s&&e.jsx("div",{className:b("w-0.5 flex-1 min-h-[24px] mt-1",m==="completed"?"bg-green-500":"bg-border")})]}),e.jsxs("div",{className:b("flex-1 pb-8",g&&"text-right"),children:[u==="left"&&r&&t.date&&e.jsx("div",{className:b("text-muted-foreground mb-1",p[a].date),children:w(t.date)}),e.jsxs("div",{className:b("inline-block",(i||o&&t.content)&&"cursor-pointer hover:opacity-80"),onClick:C,children:[e.jsxs("h4",{className:b("font-medium",p[a].title),children:[t.title,o&&t.content&&e.jsx(L,{variant:"ghost",size:"icon",className:"h-5 w-5 ml-1",children:d?e.jsx(h.ChevronUp,{className:"h-3 w-3"}):e.jsx(h.ChevronDown,{className:"h-3 w-3"})})]}),t.description&&e.jsx("p",{className:b("text-muted-foreground mt-0.5",p[a].desc),children:t.description})]}),o&&t.content&&d&&e.jsx("div",{className:"mt-3 p-3 bg-muted/50 rounded-lg",children:t.content})]})]})}function Jg({items:t,orientation:s="vertical",linePosition:a="left",size:r="md",showDates:n=!0,dateFormat:o,collapsible:i=!1,alternate:l=!1,onItemClick:u,className:d}){return s==="horizontal"?e.jsx("div",{className:b("flex items-start overflow-x-auto",d),children:t.map((f,m)=>e.jsx(io,{item:f,isLast:m===t.length-1,size:r,showDate:n,dateFormat:o,collapsible:i,onItemClick:u,orientation:"horizontal",position:"left"},f.id))}):e.jsx("div",{className:b("flex flex-col",a==="center"&&"items-center",d),children:t.map((f,m)=>{let p="left";return a==="center"&&l?p=m%2===0?"left":"right":a==="right"&&(p="right"),e.jsx(io,{item:f,isLast:m===t.length-1,size:r,showDate:n,dateFormat:o,collapsible:i,onItemClick:u,orientation:"vertical",position:p},f.id)})})}const Hl=c.createContext(null);function Qg(){const t=c.useContext(Hl);if(!t)throw new Error("useTreeContext must be used within a WakaTree");return t}function Zg(t){const s=[];function a(r){for(const n of r)s.push(n.id),n.children&&a(n.children)}return a(t),s}function Gl({node:t,level:s}){const{selectedIds:a,selectionMode:r,showCheckboxes:n,showIcons:o,draggable:i,size:l,toggleSelect:u,toggleExpand:d,isSelected:f,isExpanded:m,onDragStart:p,onDragOver:w,onDragLeave:C,onDrop:g,dragOverId:y,dragPosition:j}=Qg(),x=t.children&&t.children.length>0,v=m(t.id),k=f(t.id),N={sm:"py-0.5 text-xs",md:"py-1 text-sm",lg:"py-1.5 text-base"},D={sm:"h-3 w-3",md:"h-4 w-4",lg:"h-5 w-5"},P=s*(l==="sm"?12:l==="md"?16:20),R=B=>{B.stopPropagation(),r!=="none"&&t.selectable!==!1&&!t.disabled&&u(t.id)},A=B=>{B.stopPropagation(),d(t.id)},S=B=>{i&&p(B,t.id)},M=B=>{i&&(B.preventDefault(),w(B,t.id))},E=B=>{i&&C(B)},T=B=>{if(!i)return;B.preventDefault();const W=B.currentTarget.getBoundingClientRect(),I=B.clientY-W.top,z=W.height;let $="inside";I<z*.25?$="before":I>z*.75&&($="after"),g(B,t.id,$)},K=()=>t.icon?t.icon:o?x?v?e.jsx(h.FolderOpen,{className:b(D[l],"text-amber-500")}):e.jsx(h.Folder,{className:b(D[l],"text-amber-500")}):e.jsx(h.File,{className:b(D[l],"text-muted-foreground")}):null,q=y===t.id;return e.jsxs("li",{role:"treeitem","aria-expanded":x?v:void 0,"aria-selected":k,children:[e.jsxs("div",{className:b("flex items-center gap-1 rounded-md cursor-pointer transition-colors group",N[l],k&&"bg-primary/10 text-primary",!k&&"hover:bg-muted",t.disabled&&"opacity-50 cursor-not-allowed",q&&j==="before"&&"border-t-2 border-primary",q&&j==="after"&&"border-b-2 border-primary",q&&j==="inside"&&"bg-primary/20"),style:{paddingLeft:P},onClick:R,draggable:i&&!t.disabled,onDragStart:S,onDragOver:M,onDragLeave:E,onDrop:T,children:[i&&e.jsx(h.GripVertical,{className:b(D[l],"text-muted-foreground opacity-0 group-hover:opacity-100 cursor-grab")}),e.jsx("button",{type:"button",onClick:A,className:b("flex items-center justify-center rounded hover:bg-muted-foreground/10",!x&&"invisible"),tabIndex:-1,children:v?e.jsx(h.ChevronDown,{className:D[l]}):e.jsx(h.ChevronRight,{className:D[l]})}),n&&r!=="none"&&e.jsx(Ze,{checked:k,onCheckedChange:()=>u(t.id),disabled:t.disabled||t.selectable===!1,className:l==="sm"?"h-3 w-3":l==="lg"?"h-5 w-5":"h-4 w-4"}),K(),e.jsx("span",{className:"truncate flex-1",children:t.label})]}),x&&v&&e.jsx("ul",{role:"group",className:"list-none",children:t.children.map(B=>e.jsx(Gl,{node:B,level:s+1},B.id))})]})}function eb({data:t,selectedIds:s,onSelect:a,expandedIds:r,onExpand:n,selectionMode:o="single",showCheckboxes:i=!1,showIcons:l=!0,draggable:u=!1,onDrop:d,size:f="md",className:m,defaultExpandAll:p=!1}){const[w,C]=c.useState([]),[g,y]=c.useState(()=>p?Zg(t):[]),[j,x]=c.useState(null),[v,k]=c.useState(null),[N,D]=c.useState(null),P=s??w,R=r??g,A=c.useCallback(I=>{let z;o==="single"?z=P.includes(I)?[]:[I]:z=P.includes(I)?P.filter($=>$!==I):[...P,I],a?a(z):C(z)},[P,o,a]),S=c.useCallback(I=>{const z=R.includes(I)?R.filter($=>$!==I):[...R,I];n?n(z):y(z)},[R,n]),M=c.useCallback(I=>P.includes(I),[P]),E=c.useCallback(I=>R.includes(I),[R]),T=c.useCallback((I,z)=>{x(z),I.dataTransfer.effectAllowed="move",I.dataTransfer.setData("text/plain",z)},[]),K=c.useCallback((I,z)=>{if(j===z)return;const $=I.currentTarget.getBoundingClientRect(),_=I.clientY-$.top,F=$.height;let H="inside";_<F*.25?H="before":_>F*.75&&(H="after"),k(z),D(H)},[j]),q=c.useCallback(()=>{k(null),D(null)},[]),B=c.useCallback((I,z,$)=>{I.preventDefault(),j&&j!==z&&d&&d(j,z,$),x(null),k(null),D(null)},[j,d]),W={selectedIds:P,expandedIds:R,selectionMode:o,showCheckboxes:i,showIcons:l,draggable:u,size:f,toggleSelect:A,toggleExpand:S,isSelected:M,isExpanded:E,onDragStart:T,onDragOver:K,onDragLeave:q,onDrop:B,dragOverId:v,dragPosition:N};return e.jsx(Hl.Provider,{value:W,children:e.jsx("ul",{role:"tree","aria-multiselectable":o==="multiple",className:b("list-none",m),children:t.map(I=>e.jsx(Gl,{node:I,level:0},I.id))})})}function ln(t,s){for(const a of t){if(a.id===s)return a;if(a.children){const r=ln(a.children,s);if(r)return r}}return null}function Xl(t,s,a){return t.map(r=>r.id===s?{...r,...a}:r.children?{...r,children:Xl(r.children,s,a)}:r)}function cn(t,s){return t.filter(a=>a.id!==s).map(a=>a.children?{...a,children:cn(a.children,s)}:a)}function dn(t,s,a){return t.map(r=>r.id===s?{...r,children:[...r.children||[],a]}:r.children?{...r,children:dn(r.children,s,a)}:r)}function tb(t,s,a,r){const n=ln(t,s);if(!n)return t;let o=cn(t,s);if(r==="inside")o=dn(o,a,n);else{const i=l=>{const u=[];for(const d of l)d.id===a?r==="before"?(u.push(n),u.push(d)):(u.push(d),u.push(n)):u.push({...d,children:d.children?i(d.children):void 0});return u};o=i(o)}return o}function lo(t){const s=Math.floor(t/3600),a=Math.floor(t%3600/60),r=Math.floor(t%60);return s>0?`${s}:${a.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${a}:${r.toString().padStart(2,"0")}`}function sb({src:t,poster:s,autoPlay:a=!1,loop:r=!1,muted:n=!1,controls:o=!0,preload:i="metadata",width:l,height:u,aspectRatio:d="16/9",showFullscreen:f=!0,showPlaybackSpeed:m=!0,showQualitySelector:p=!1,playbackSpeeds:w=[.5,.75,1,1.25,1.5,2],onReady:C,onPlay:g,onPause:y,onEnded:j,onTimeUpdate:x,onError:v,className:k}){const N=c.useRef(null),D=c.useRef(null),[P,R]=c.useState(a),[A,S]=c.useState(n),[M,E]=c.useState(1),[T,K]=c.useState(0),[q,B]=c.useState(0),[W,I]=c.useState(!1),[z,$]=c.useState(!0),[_,F]=c.useState(!0),[H,J]=c.useState(1),[Q,ne]=c.useState(""),X=c.useRef(),Y=c.useMemo(()=>typeof t=="string"?[{src:t,type:"video/mp4"}]:t,[t]);c.useEffect(()=>{Y.length>0&&Y[0].quality&&ne(Y[0].quality)},[Y]);const U=()=>{const G=N.current;G&&(B(G.duration),$(!1),C?.())},ae=()=>{const G=N.current;G&&(K(G.currentTime),x?.(G.currentTime))},te=()=>{R(!0),g?.()},Z=()=>{R(!1),y?.()},le=()=>{R(!1),j?.()},xe=()=>{$(!1),v?.(new Error("Video failed to load"))},se=()=>{$(!0)},de=()=>{$(!1)},De=()=>{const G=N.current;G&&(P?G.pause():G.play())},Ne=()=>{const G=N.current;G&&(G.muted=!A,S(!A))},Ke=G=>{const ee=N.current;if(!ee)return;const re=G[0];ee.volume=re,E(re),S(re===0)},xt=G=>{const ee=N.current;ee&&(ee.currentTime=G[0],K(G[0]))},Ye=G=>{const ee=N.current;ee&&(ee.currentTime=Math.max(0,Math.min(q,ee.currentTime+G)))},et=G=>{const ee=N.current;ee&&(ee.playbackRate=G,J(G))},gt=G=>{const ee=N.current;if(!ee)return;const re=ee.currentTime;ee.src=G.src,ee.currentTime=re,ne(G.quality||""),P&&ee.play()},Et=async()=>{const G=D.current;if(G)try{document.fullscreenElement?(await document.exitFullscreen(),I(!1)):(await G.requestFullscreen(),I(!0))}catch(ee){console.error("Fullscreen error:",ee)}},Je=()=>{F(!0),X.current&&clearTimeout(X.current),P&&(X.current=setTimeout(()=>{F(!1)},3e3))};return c.useEffect(()=>()=>{X.current&&clearTimeout(X.current)},[]),c.useEffect(()=>{const G=()=>{I(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",G),()=>{document.removeEventListener("fullscreenchange",G)}},[]),e.jsxs("div",{ref:D,className:b("relative bg-black overflow-hidden group",k),style:{width:l,height:u,aspectRatio:u?void 0:d},onMouseMove:Je,onMouseLeave:()=>P&&F(!1),children:[e.jsx("video",{ref:N,className:"w-full h-full",poster:s,autoPlay:a,loop:r,muted:n,preload:i,playsInline:!0,onLoadedMetadata:U,onTimeUpdate:ae,onPlay:te,onPause:Z,onEnded:le,onError:xe,onWaiting:se,onCanPlay:de,onClick:De,children:Y.map((G,ee)=>e.jsx("source",{src:G.src,type:G.type},ee))}),z&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/50",children:e.jsx(h.Loader2,{className:"h-10 w-10 text-white animate-spin"})}),!P&&!z&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30",children:e.jsx(L,{variant:"ghost",size:"icon",className:"h-16 w-16 rounded-full bg-white/90 hover:bg-white text-black",onClick:De,children:e.jsx(h.Play,{className:"h-8 w-8 ml-1"})})}),o&&e.jsxs("div",{className:b("absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent p-4 transition-opacity duration-300",_||!P?"opacity-100":"opacity-0"),children:[e.jsx(ya,{value:[T],max:q||100,step:.1,onValueChange:xt,className:"mb-3"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white hover:bg-white/20",onClick:De,children:P?e.jsx(h.Pause,{className:"h-5 w-5"}):e.jsx(h.Play,{className:"h-5 w-5"})}),e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white hover:bg-white/20",onClick:()=>Ye(-10),children:e.jsx(h.SkipBack,{className:"h-4 w-4"})}),e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white hover:bg-white/20",onClick:()=>Ye(10),children:e.jsx(h.SkipForward,{className:"h-4 w-4"})}),e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white hover:bg-white/20",onClick:Ne,children:A||M===0?e.jsx(h.VolumeX,{className:"h-5 w-5"}):e.jsx(h.Volume2,{className:"h-5 w-5"})}),e.jsx(ya,{value:[A?0:M],max:1,step:.1,onValueChange:Ke,className:"w-20"}),e.jsxs("span",{className:"text-white text-sm ml-2",children:[lo(T)," / ",lo(q)]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[(m||p)&&e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white hover:bg-white/20",children:e.jsx(h.Settings,{className:"h-5 w-5"})})}),e.jsxs(_e,{align:"end",children:[m&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-2 py-1 text-xs text-muted-foreground",children:"Vitesse"}),w.map(G=>e.jsxs(pe,{onClick:()=>et(G),className:b(H===G&&"bg-muted"),children:[G,"x"]},G))]}),p&&Y.some(G=>G.quality)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-2 py-1 text-xs text-muted-foreground mt-2",children:"Qualité"}),Y.filter(G=>G.quality).map((G,ee)=>e.jsx(pe,{onClick:()=>gt(G),className:b(Q===G.quality&&"bg-muted"),children:G.quality},ee))]})]})]}),f&&e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8 text-white hover:bg-white/20",onClick:Et,children:W?e.jsx(h.Minimize,{className:"h-5 w-5"}):e.jsx(h.Maximize,{className:"h-5 w-5"})})]})]})]})]})}function ab(t={}){const[s,a]=c.useState(t.autoPlay??!1),[r,n]=c.useState(t.muted??!1),[o,i]=c.useState(0),[l,u]=c.useState(0);return{isPlaying:s,isMuted:r,currentTime:o,duration:l,onPlay:()=>a(!0),onPause:()=>a(!1),onTimeUpdate:i,onReady:()=>{}}}function rb(t,s,a,r,n){return c.useMemo(()=>{const o=typeof s=="number";let i=0;const l=[];for(let m=0;m<t.length;m++){l.push(i);const p=o?s:s(t[m],m);i+=p}let u=0,d=t.length-1;if(o)u=Math.floor(r/s),d=Math.min(t.length-1,Math.ceil((r+a)/s));else{let m=0,p=t.length-1;for(;m<=p;){const w=Math.floor((m+p)/2);l[w]<r?m=w+1:p=w-1}u=Math.max(0,p);for(let w=u;w<t.length;w++){const C=l[w],g=o?s:s(t[w],w);if(C+g>r+a){d=w;break}}}u=Math.max(0,u-n),d=Math.min(t.length-1,d+n);const f=[];for(let m=u;m<=d;m++){const p=o?s:s(t[m],m);f.push({item:t[m],index:m,style:{position:"absolute",top:l[m],left:0,right:0,height:p}})}return{totalHeight:i,visibleItems:f,startIndex:u,endIndex:d}},[t,s,a,r,n])}function nb({items:t,itemHeight:s,height:a,width:r="100%",overscan:n=3,renderItem:o,onScroll:i,onEndReached:l,endReachedThreshold:u=200,isLoading:d=!1,loadingElement:f,emptyElement:m,className:p,innerClassName:w,scrollRef:C}){const g=c.useRef(null),y=C||g,[j,x]=c.useState(0),v=c.useRef(!1),{totalHeight:k,visibleItems:N}=rb(t,s,a,j,n),D=R=>{const A=R.currentTarget,S=A.scrollTop;if(x(S),i?.(S),l){const M=A.scrollHeight-A.scrollTop-A.clientHeight;M<u&&!v.current?(v.current=!0,l()):M>=u&&(v.current=!1)}},P=c.useCallback(R=>{y.current&&(y.current.scrollTop=R)},[y]);return c.useCallback((R,A="start")=>{const S=typeof s=="number";let M=0;if(S)M=R*s;else for(let T=0;T<R&&T<t.length;T++)M+=s(t[T],T);const E=S?s:s(t[R],R);A==="center"?M-=(a-E)/2:A==="end"&&(M-=a-E),P(Math.max(0,M))},[t,s,a,P]),t.length===0&&!d?e.jsx("div",{className:b("flex items-center justify-center text-muted-foreground",p),style:{height:a,width:r},children:m||"Aucun élément"}):e.jsx("div",{ref:y,className:b("overflow-auto",p),style:{height:a,width:r},onScroll:D,children:e.jsxs("div",{className:b("relative",w),style:{height:k+(d?50:0)},children:[N.map(({item:R,index:A,style:S})=>e.jsx(c.Fragment,{children:o(R,A,S)},A)),d&&e.jsx("div",{className:"absolute left-0 right-0 flex items-center justify-center py-4",style:{top:k},children:f||e.jsx("div",{className:"text-muted-foreground text-sm",children:"Chargement..."})})]})})}function ob(t){const{itemCount:s,itemHeight:a,containerHeight:r,overscan:n=3}=t,[o,i]=c.useState(0),l=s*a,u=Math.max(0,Math.floor(o/a)-n),d=Math.min(s-1,Math.ceil((o+r)/a)+n),f=c.useMemo(()=>{const w=[];for(let C=u;C<=d;C++)w.push({index:C,start:C*a,size:a});return w},[u,d,a]);return{totalHeight:l,virtualItems:f,startIndex:u,endIndex:d,handleScroll:w=>{i(w.currentTarget.scrollTop)},scrollToIndex:w=>{i(w*a)},scrollTop:o}}const Kl=c.createContext(void 0);function Yl({children:t,languages:s,defaultLanguage:a="fr",s3Config:r,onLanguageChange:n}){const{i18n:o}=wt.useTranslation(),[i,l]=c.useState(a),[u,d]=c.useState(!0),[f,m]=c.useState(new Set),[p,w]=c.useState(!1),C=c.useCallback(async j=>{if(!r)throw new Error("S3 configuration not provided");const{baseUrl:x,prefix:v="",extension:k="json",headers:N={}}=r,D=`${x.replace(/\/$/,"")}/${v}${j}.${k}`;console.log(`[LanguageProvider] Loading translations from S3: ${D}`);try{const P=await fetch(D,{headers:{Accept:"application/json",...N}});if(!P.ok)throw new Error(`Failed to load translations: ${P.status} ${P.statusText}`);const R=await P.json();return console.log(`[LanguageProvider] ✓ Translations loaded for ${j}`),R}catch(P){throw console.error(`[LanguageProvider] ✗ Error loading translations for ${j}:`,P),P}},[r]);c.useEffect(()=>{if(p||!o||!r)return;(async()=>{try{const x=typeof window<"u"?localStorage.getItem("language"):null,v=x&&s.some(N=>N.code===x)?x:a;console.log(`[LanguageProvider] Initializing with language: ${v}`);const k=await C(v);o.addResourceBundle&&o.addResourceBundle(v,"translation",k,!0,!0),await o.changeLanguage(v),l(v),m(new Set([v])),w(!0),console.log(`[LanguageProvider] ✓ Initialized with ${v}`)}catch(x){console.error("[LanguageProvider] Error initializing:",x),w(!0)}finally{d(!1)}})()},[p,o,r,a,s,C]);const g=c.useCallback(async j=>{if(j!==i){if(!o?.changeLanguage){console.error("[LanguageProvider] i18next is not initialized");return}if(!r){console.error("[LanguageProvider] S3 config not provided");return}d(!0);try{if(!f.has(j)){console.log(`[LanguageProvider] Loading ${j} from S3...`);const x=await C(j);o.addResourceBundle&&o.addResourceBundle(j,"translation",x,!0,!0),m(v=>new Set([...v,j]))}await o.changeLanguage(j),l(j),typeof window<"u"&&localStorage.setItem("language",j),n?.(j),console.log(`[LanguageProvider] ✓ Language changed to: ${j}`)}catch(x){throw console.error("[LanguageProvider] ✗ Error changing language:",x),x}finally{d(!1)}}},[i,f,r,C,o,n]),y={currentLanguage:i,languages:s,changeLanguage:g,isLoading:u,loadedLanguages:f};return e.jsx(Kl.Provider,{value:y,children:t})}function un(){const t=c.useContext(Kl);if(!t)throw new Error("useLanguage must be used within a LanguageProvider");return t}const Jl=c.createContext(void 0);function ib({children:t,config:s}){const{defaultTheme:a="light",storageKey:r="waka-ui-theme",themes:n,enableSystem:o=!0,s3Config:i}=s||{},[l,u]=c.useState(a),[d,f]=c.useState(),[m,p]=c.useState([]),[w,C]=c.useState(!0),[g,y]=c.useState("fallback");c.useEffect(()=>{(async()=>{if(C(!0),n&&n.length>0){const N=lb(n);p(N),y("config"),C(!1),console.log("[ThemeProvider] Using themes from config:",N.length);return}if(i?.baseUrl)try{const N=await cb(i.baseUrl);if(N.length>0){p(N),y("s3"),C(!1),console.log("[ThemeProvider] Loaded themes from S3:",N.length);return}}catch(N){console.error("[ThemeProvider] Failed to load themes from S3:",N)}p([{id:"light",label:"Clair",previewColor:"#3b82f6"},{id:"dark",label:"Sombre",previewColor:"#1e293b"}]),y("fallback"),C(!1),console.log("[ThemeProvider] Using fallback themes")})()},[n,i]),c.useEffect(()=>{if(!o)return;const v=window.matchMedia("(prefers-color-scheme: dark)"),k=N=>{f(N.matches?"dark":"light")};return f(v.matches?"dark":"light"),v.addEventListener("change",k),()=>v.removeEventListener("change",k)},[o]),c.useEffect(()=>{if(m.length===0)return;const v=localStorage.getItem(r),k=m.map(N=>N.id);v&&k.includes(v)&&u(v)},[r,m]),c.useEffect(()=>{if(m.length===0)return;const v=document.documentElement,k=l==="system"&&d?d:l;m.forEach(N=>v.classList.remove(N.id)),v.classList.add(k),v.setAttribute("data-theme",k),process.env.NODE_ENV==="development"&&console.log(`[WakaUI] Theme applied: ${k}`)},[l,d,m]);const j=c.useCallback(v=>{const k=m.map(N=>N.id);if(!k.includes(v)&&v!=="system"){console.warn(`[WakaUI] Theme "${v}" is not in the list of available themes:`,k);return}u(v),localStorage.setItem(r,v)},[m,r]),x=c.useMemo(()=>({theme:l,setTheme:j,themes:m,systemTheme:d,isLoadingThemes:w,themesSource:g}),[l,j,m,d,w,g]);return e.jsx(Jl.Provider,{value:x,children:t})}function lb(t){return t.length===0?[]:typeof t[0]=="string"?t.map(s=>({id:s,label:db(s),previewColor:ub(s)})):t}async function cb(t){try{const s=await fetch("/api/themes/list",{cache:"no-store"});if(!s.ok)throw new Error(`HTTP ${s.status}`);return(await s.json()).themes||[]}catch(s){return console.error("[ThemeProvider] Failed to fetch themes from S3:",s),[]}}function db(t){return t.split("-").map(s=>s.charAt(0).toUpperCase()+s.slice(1)).join(" ")}function ub(t){return{light:"#3b82f6",dark:"#1e293b",forest:"#10b981",sunset:"#f59e0b",twilight:"#8b5cf6",monochrome:"#6b7280",perpetuity:"#ec4899"}[t]||"#3b82f6"}function mb(){const t=c.useContext(Jl);if(!t)throw new Error("useTheme must be used within a ThemeProvider");return t}function hb({children:t,config:s}){const[a]=c.useState(()=>$t.createInstance()),[r,n]=c.useState(!1);return c.useEffect(()=>{(async()=>{try{await a.use(wt.initReactI18next).init({lng:s.language.defaultLanguage,fallbackLng:s.language.defaultLanguage,supportedLngs:s.language.supportedLanguages,resources:s.language.resources||{},interpolation:{escapeValue:!1},react:{useSuspense:!1},debug:s.debug}),s.language.s3Config&&await fb(a,s.language.s3Config,s.language.supportedLanguages),n(!0),s.debug&&console.log("[WakaUI] i18n initialized successfully")}catch(i){console.error("[WakaUI] Failed to initialize i18n:",i),n(!0)}})()},[a,s]),c.useEffect(()=>{if(!r)return;const o=s.language.storageKey||"waka-ui-language",i=localStorage.getItem(o);i&&s.language.supportedLanguages.includes(i)&&a.changeLanguage(i);const l=u=>{localStorage.setItem(o,u),s.debug&&console.log(`[WakaUI] Language changed to: ${u}`)};return a.on("languageChanged",l),()=>{a.off("languageChanged",l)}},[r,a,s]),r?e.jsx(wt.I18nextProvider,{i18n:a,children:e.jsx(Yl,{languages:s.language.languages||[],defaultLanguage:s.language.defaultLanguage,s3Config:s.language.s3Config?{baseUrl:s.language.s3Config.bucketUrl,prefix:s.language.s3Config.translationsPath?`${s.language.s3Config.translationsPath}/`:"",extension:"json"}:void 0,children:e.jsx(Ki,{themes:s.theme?.themes||[{id:"default",label:"Default"}],defaultTheme:s.theme?.defaultTheme||"default",s3Config:s.theme?.s3Config,enableDarkMode:s.theme?.enableSystem,children:t})})}):e.jsx("div",{style:{padding:"20px",textAlign:"center"},children:"Loading WakaUI..."})}async function fb(t,s,a){if(!s)return;const{bucketUrl:r,translationsPath:n="translations"}=s;try{await Promise.all(a.map(async o=>{try{const i=`${r}/${n}/${o}.json`,l=await fetch(i);if(!l.ok){console.warn(`[WakaUI] Failed to load translations for ${o} from S3`);return}const u=await l.json();t.addResourceBundle(o,"translation",u,!0,!0),process.env.NODE_ENV==="development"&&console.log(`[WakaUI] Loaded translations for ${o} from S3`)}catch(i){console.warn(`[WakaUI] Error loading translations for ${o}:`,i)}}))}catch(o){console.error("[WakaUI] Error loading translations from S3:",o)}}function pb(){const{i18n:t,t:s}=wt.useTranslation(),a=un(),r=ia();return{currentLanguage:t.language||a.currentLanguage,changeLanguage:async n=>{await a.changeLanguage(n),await t.changeLanguage(n)},languages:a.languages,isLanguageLoading:a.isLoading,currentTheme:r.currentTheme,changeTheme:r.changeTheme,themes:r.themes,isThemeLoading:r.isLoading,preloadTheme:r.preloadTheme,isThemeLoaded:r.isThemeLoaded,t:s}}const mn=c.createContext(void 0);function xb({children:t,initialSelection:s,onSelectionChange:a,persistKey:r="admincrumb-selection"}){const[n,o]=c.useState(()=>{if(typeof window<"u"&&r){const w=localStorage.getItem(r);if(w)try{return JSON.parse(w)}catch(C){console.error("Failed to parse stored admincrumb selection",C)}}return s||{}});c.useEffect(()=>{typeof window<"u"&&r&&localStorage.setItem(r,JSON.stringify(n))},[n,r]),c.useEffect(()=>{a?.(n)},[n,a]);const i=c.useCallback(w=>{o({partner:w,network:void 0,customer:void 0})},[]),l=c.useCallback(w=>{o(C=>({...C,network:w,customer:void 0}))},[]),u=c.useCallback(w=>{o(C=>({...C,customer:w}))},[]),d=c.useCallback(()=>{o({})},[]),f=c.useMemo(()=>!!(n.partner||n.network||n.customer),[n]),m=c.useCallback(()=>({...n.partner?.id&&{partnerId:n.partner.id},...n.network?.id&&{networkId:n.network.id},...n.customer?.id&&{customerId:n.customer.id}}),[n]),p=c.useMemo(()=>({selection:n,setPartner:i,setNetwork:l,setCustomer:u,reset:d,isFiltered:f,getFilterQuery:m}),[n,i,l,u,d,f,m]);return e.jsx(mn.Provider,{value:p,children:t})}function gb(){const t=c.useContext(mn);if(!t)throw new Error("useAdmincrumbContext must be used within AdmincrumbProvider");return t}function bb(){return c.useContext(mn)}const jb={github:h.Github,twitter:h.Twitter,linkedin:h.Linkedin,email:h.Mail};function vb({columns:t=[],socialLinks:s=[],copyright:a="© 2024 Tous droits réservés.",className:r}){return e.jsx("footer",{className:b("bg-muted/40",r),children:e.jsxs("div",{className:"container mx-auto px-4 py-12",children:[e.jsxs("div",{className:"grid grid-cols-1 gap-8 md:grid-cols-2 lg:grid-cols-4",children:[t.map((n,o)=>e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:n.title}),e.jsx("ul",{className:"space-y-2",children:n.links.map((i,l)=>e.jsx("li",{children:e.jsx("a",{href:i.href,className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:i.label})},l))})]},o)),s.length>0&&e.jsxs("div",{className:"space-y-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Suivez-nous"}),e.jsx("div",{className:"flex space-x-4",children:s.map((n,o)=>{const i=jb[n.platform];return e.jsx(L,{variant:"ghost",size:"icon",asChild:!0,className:"h-8 w-8",children:e.jsx("a",{href:n.url,target:"_blank",rel:"noopener noreferrer","aria-label":n.platform,children:e.jsx(i,{className:"h-4 w-4"})})},o)})})]})]}),e.jsx(kt,{className:"my-8"}),e.jsxs("div",{className:"flex flex-col items-center justify-between space-y-4 md:flex-row md:space-y-0",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:a}),e.jsxs("div",{className:"flex space-x-6",children:[e.jsx("a",{href:"/privacy",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Politique de confidentialité"}),e.jsx("a",{href:"/terms",className:"text-sm text-muted-foreground hover:text-foreground transition-colors",children:"Conditions d'utilisation"})]})]})]})})}function wb({items:t,defaultActiveId:s,variant:a="default",size:r="md",className:n,onTabChange:o}){const[i,l]=c.useState(s||t[0]?.id||""),u=m=>{l(m),o?.(m)},d={sm:"h-8 px-3 text-sm",md:"h-10 px-4 text-sm",lg:"h-12 px-6 text-base"},f={default:"bg-background",pills:"bg-muted rounded-full",underline:"bg-transparent border-b-2 border-transparent data-[state=active]:border-primary"};return e.jsx("div",{className:b("w-full",n),children:e.jsxs(oa,{value:i,onValueChange:u,children:[e.jsx(Ts,{className:b("grid w-full",a==="pills"&&"grid-cols-auto",a!=="pills"&&`grid-cols-${t.length}`,f[a]),children:t.map(m=>e.jsx(js,{value:m.id,disabled:m.disabled,className:b(d[r],a==="underline"&&"rounded-none border-b-2 border-transparent data-[state=active]:border-primary",a==="pills"&&"rounded-full"),children:m.label},m.id))}),t.map(m=>e.jsx(vs,{value:m.id,className:"mt-6",children:m.content},m.id))]})})}function yb({items:t,separator:s="/",className:a}){return e.jsx("nav",{className:b("flex items-center space-x-1 text-sm text-muted-foreground",a),children:t.map((r,n)=>e.jsxs(c.Fragment,{children:[n>0&&e.jsx("span",{className:"mx-2 text-muted-foreground",children:s}),r.href?e.jsx("a",{href:r.href,className:"hover:text-foreground transition-colors",children:r.label}):e.jsx("span",{className:"text-foreground font-medium",children:r.label})]},n))})}function Nb({variant:t="dropdown",showFlags:s=!0,className:a}){const{currentLanguage:r,languages:n,changeLanguage:o,isLoading:i}=un(),l=n.find(u=>u.code===r);return t==="select"?e.jsxs(Ve,{value:r,onValueChange:o,disabled:i,children:[e.jsx($e,{className:b("w-[180px]",a),children:e.jsxs(We,{children:[s&&l?.flagEmoji&&e.jsx("span",{className:"mr-2",children:l.flagEmoji}),l?.label]})}),e.jsx(Le,{children:n.map(u=>e.jsxs(je,{value:u.code,children:[s&&u.flagEmoji&&e.jsx("span",{className:"mr-2",children:u.flagEmoji}),u.label]},u.code))})]}):e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"sm",className:b("gap-2",a),disabled:i,children:[e.jsx(h.Globe,{className:"h-4 w-4"}),s&&l?.flagEmoji&&e.jsx("span",{children:l.flagEmoji}),l?.label]})}),e.jsx(_e,{align:"end",children:n.map(u=>e.jsxs(pe,{onClick:()=>o(u.code),className:"cursor-pointer",children:[s&&u.flagEmoji&&e.jsx("span",{className:"mr-2",children:u.flagEmoji}),u.label]},u.code))})]})}function Cb({children:t,header:s,sidebar:a,footer:r,collapsible:n=!1,className:o}){const[i,l]=c.useState(!1);return e.jsxs("div",{className:b("min-h-screen bg-background",o),children:[s&&e.jsx("header",{className:"sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:e.jsxs("div",{className:"container flex h-14 max-w-screen-2xl items-center",children:[n&&a&&e.jsxs(sa,{open:i,onOpenChange:l,children:[e.jsx(Rr,{asChild:!0,children:e.jsxs(L,{variant:"ghost",size:"icon",className:"md:hidden",children:[e.jsx(h.Menu,{className:"h-5 w-5"}),e.jsx("span",{className:"sr-only",children:"Ouvrir le menu"})]})}),e.jsx(Ds,{side:"left",className:"w-72 p-0",children:e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between p-4",children:[e.jsx("h2",{className:"text-lg font-semibold",children:"Navigation"}),e.jsx(L,{variant:"ghost",size:"icon",onClick:()=>l(!1),children:e.jsx(h.X,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:a})]})})]}),s]})}),e.jsxs("div",{className:"flex",children:[a&&!n&&e.jsx("aside",{className:"hidden w-64 border-r bg-muted/40 md:block",children:e.jsx("div",{className:"h-full overflow-y-auto p-4",children:a})}),e.jsx("main",{className:"flex-1",children:e.jsx("div",{className:"container mx-auto p-4",children:t})})]}),r&&e.jsx("footer",{className:"border-t bg-muted/40",children:e.jsx("div",{className:"container mx-auto p-4",children:r})})]})}function kb({config:t,onSubmit:s,onForgotPassword:a,onSignUp:r,onSSOGoogle:n,onSSOMicrosoft:o,onSSOApple:i,onSSOLinkedIn:l,onSSOGithub:u,onSSOFacebook:d,onSSOInstagram:f,onSSOFranceConnect:m,showSocialLogin:p=!1,className:w}){let C=!1;try{C=ia().isDarkMode}catch{}const g=t?.theme_json?.dark_mode??C,[y,j]=c.useState({email:"",password:"",rememberMe:!1}),[x,v]=c.useState(!1),k=c.useMemo(()=>t?.assets?g?t.assets.theme_logo_dark:t.assets.theme_logo_light:null,[t?.assets,g]),N=c.useMemo(()=>t?.color_json?{"--login-primary":t.color_json.primary,"--login-secondary":t.color_json.secondary,"--login-accent":t.color_json.accent}:{},[t?.color_json]),D=c.useMemo(()=>{const S=[];if(!t?.signup_options)return p&&(u&&S.push({id:"github",label:"GitHub",icon:e.jsx(h.Github,{className:"h-4 w-4"}),onClick:u}),n&&S.push({id:"google",label:"Google",icon:e.jsx(h.Mail,{className:"h-4 w-4"}),onClick:n})),S;const M=t.signup_options;return M.allow_sso_google&&S.push({id:"google",label:"Google",icon:e.jsx(h.Mail,{className:"h-4 w-4"}),onClick:n}),M.allow_sso_microsoft&&S.push({id:"microsoft",label:"Microsoft",icon:e.jsx(h.Mail,{className:"h-4 w-4"}),onClick:o}),M.allow_sso_apple&&S.push({id:"apple",label:"Apple",icon:e.jsx(h.Apple,{className:"h-4 w-4"}),onClick:i}),M.allow_sso_linkedIn&&S.push({id:"linkedin",label:"LinkedIn",icon:e.jsx(h.Linkedin,{className:"h-4 w-4"}),onClick:l}),M.allow_sso_github&&S.push({id:"github",label:"GitHub",icon:e.jsx(h.Github,{className:"h-4 w-4"}),onClick:u}),M.allow_sso_facebook&&S.push({id:"facebook",label:"Facebook",icon:e.jsx(h.Facebook,{className:"h-4 w-4"}),onClick:d}),M.allow_sso_instagram&&S.push({id:"instagram",label:"Instagram",icon:e.jsx(h.Instagram,{className:"h-4 w-4"}),onClick:f}),M.allow_sso_france_connect&&S.push({id:"france-connect",label:"France Connect",icon:e.jsx(h.Mail,{className:"h-4 w-4"}),onClick:m}),S},[t?.signup_options,p,n,o,i,l,u,d,f,m]),P=t?.signup_options?.allow_login!==!1,R=async S=>{S.preventDefault(),v(!0);try{await s?.(y)}finally{v(!1)}},A=S=>M=>{j(E=>({...E,[S]:S==="rememberMe"?M.target.checked:M.target.value}))};return e.jsx("div",{className:b("flex items-center justify-center p-4",w),style:N,children:e.jsxs(ke,{className:"w-full max-w-md",children:[e.jsxs(qe,{className:"space-y-1",children:[k&&e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:k,alt:t?.theme_json?.name||"Logo",className:"max-h-16 max-w-full object-contain"})}),e.jsx(Oe,{className:"text-2xl text-center",children:"Connexion"}),e.jsx(ot,{className:"text-center",children:"Entrez vos identifiants pour accéder à votre compte"})]}),e.jsxs(Te,{className:"space-y-4",children:[D.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:b("grid gap-4",D.length===1?"grid-cols-1":"grid-cols-2"),children:D.map(S=>e.jsxs(L,{variant:"outline",className:"w-full",onClick:S.onClick,type:"button",children:[S.icon,S.label]},S.id))}),P&&e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx(kt,{className:"w-full"})}),e.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:e.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"Ou continuez avec"})})]})]}),P&&e.jsxs("form",{onSubmit:R,className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"email",children:"Email"}),e.jsx(oe,{id:"email",type:"email",placeholder:"votre@email.com",value:y.email,onChange:A("email"),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"password",children:"Mot de passe"}),e.jsx(oe,{id:"password",type:"password",placeholder:"••••••••",value:y.password,onChange:A("password"),required:!0})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{id:"remember",type:"checkbox",checked:y.rememberMe,onChange:A("rememberMe"),className:"h-4 w-4 rounded border-gray-300"}),e.jsx(me,{htmlFor:"remember",className:"text-sm",children:"Se souvenir de moi"})]}),a&&e.jsx(L,{type:"button",variant:"link",className:"px-0 text-sm",onClick:a,children:"Mot de passe oublié ?"})]}),e.jsx(L,{type:"submit",className:"w-full",disabled:x,style:t?.color_json?.primary?{backgroundColor:t.color_json.primary,color:t.color_json.secondary}:void 0,children:x?"Connexion...":"Se connecter"})]}),r&&e.jsxs("div",{className:"text-center text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:"Pas encore de compte ? "}),e.jsx(L,{type:"button",variant:"link",className:"px-0 text-sm",onClick:r,children:"S'inscrire"})]}),t?.waka_powered&&e.jsx("div",{className:"text-center text-xs text-muted-foreground mt-4 pt-4 border-t",children:"Powered by Waka"})]})]})})}const Ql=c.createContext(null);function Sb(){const t=c.useContext(Ql);if(!t)throw new Error("Sidebar components must be used within WakaSidebar");return t}function Db({config:t}){const s=t.component?t.component:e.jsxs("div",{className:"flex items-center gap-3",children:[t.src&&e.jsx("img",{src:t.src,alt:t.alt||"Logo",className:"h-8 w-auto object-contain"}),t.title&&e.jsx("span",{className:"text-lg font-bold tracking-wide",children:t.title})]});return t.href?e.jsx("a",{href:t.href,className:"block",onClick:t.onClick,children:s}):t.onClick?e.jsx("button",{type:"button",onClick:t.onClick,className:"block text-left",children:s}):e.jsx("div",{children:s})}function Zl({item:t,isChild:s=!1,renderItem:a}){const{activeId:r,setActiveId:n,expandedIds:o,toggleExpanded:i,isMobile:l,closeOnNavigate:u,onClose:d}=Sb(),f=t.children&&t.children.length>0,m=o.includes(t.id),p=r===t.id||t.active,w=()=>{t.disabled||(f?i(t.id):(n(t.id),t.onClick?.(),l&&u&&d()))};if(a)return e.jsx(e.Fragment,{children:a(t,s)});const C=e.jsxs("div",{className:b("flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-medium transition-all duration-200","hover:bg-white/10",p&&!f&&"bg-sidebar-active text-sidebar-active-foreground",s&&"ml-6 text-[13px]",t.disabled&&"opacity-50 cursor-not-allowed"),children:[t.icon&&e.jsx("span",{className:b("flex-shrink-0",s?"h-4 w-4":"h-5 w-5"),children:t.icon}),e.jsx("span",{className:"flex-1 truncate",children:t.label}),t.badge!==void 0&&e.jsx("span",{className:"ml-auto flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary px-1.5 text-[10px] font-semibold text-primary-foreground",children:t.badge}),f&&e.jsx(h.ChevronDown,{className:b("h-4 w-4 transition-transform duration-200",m&&"rotate-180")})]});return f?e.jsxs(Bo,{open:m,onOpenChange:()=>i(t.id),children:[e.jsx(qo,{asChild:!0,children:e.jsx("button",{type:"button",className:"w-full text-left",disabled:t.disabled,children:C})}),e.jsx(Ho,{className:"space-y-1 pt-1",children:t.children?.map(g=>e.jsx(Zl,{item:g,isChild:!0,renderItem:a},g.id))})]}):t.href?e.jsx("a",{href:t.href,onClick:g=>{if(t.disabled){g.preventDefault();return}w()},className:"block",children:C}):e.jsx("button",{type:"button",className:"w-full text-left",disabled:t.disabled,onClick:w,children:C})}function co({config:t}){const s=t.initials||t.name.split(" ").map(n=>n[0]).join("").slice(0,2).toUpperCase(),a=[{id:"profile",label:"Profil",icon:e.jsx(h.User,{className:"h-4 w-4"})},{id:"settings",label:"Paramètres",icon:e.jsx(h.Settings,{className:"h-4 w-4"})},{id:"logout",label:"Déconnexion",icon:e.jsx(h.LogOut,{className:"h-4 w-4"}),variant:"destructive"}],r=t.actions??a;return e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 rounded-lg p-2 text-left transition-colors hover:bg-white/10",children:[e.jsxs(yt,{className:"h-10 w-10 border-2 border-sidebar-active",children:[e.jsx(Nt,{src:t.avatarUrl,alt:t.name}),e.jsx(Ct,{className:"bg-sidebar-active text-sidebar-active-foreground text-sm font-medium",children:s})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:t.name}),t.email&&e.jsx("p",{className:"text-xs text-sidebar-foreground/70 truncate",children:t.email})]}),e.jsx(h.ChevronDown,{className:"h-4 w-4 flex-shrink-0 opacity-70"})]})}),e.jsx(_e,{align:"end",className:"w-56",children:r.map((n,o)=>e.jsxs(c.Fragment,{children:[n.variant==="destructive"&&o>0&&e.jsx(Qe,{}),e.jsx(pe,{onClick:n.onClick,className:b(n.variant==="destructive"&&"text-destructive focus:text-destructive"),asChild:!!n.href,children:n.href?e.jsxs("a",{href:n.href,className:"flex items-center gap-2",children:[n.icon,n.label]}):e.jsxs("span",{className:"flex items-center gap-2",children:[n.icon,n.label]})})]},n.id))})]})}function Tb({logo:t,menu:s,user:a,userPosition:r="bottom",header:n,footer:o,renderItem:i}){return e.jsxs("div",{className:"flex h-full flex-col",children:[t&&e.jsx("div",{className:"flex-shrink-0 p-4 pb-2",children:e.jsx(Db,{config:t})}),n&&e.jsx("div",{className:"flex-shrink-0 px-4 py-2",children:n}),a&&r==="top"&&e.jsx("div",{className:"flex-shrink-0 px-3 py-2 border-b border-white/10",children:e.jsx(co,{config:a})}),e.jsx(At,{className:"flex-1 px-3 py-4",children:e.jsx("nav",{className:"space-y-1",children:s.map(l=>e.jsx(Zl,{item:l,renderItem:i},l.id))})}),o&&e.jsx("div",{className:"flex-shrink-0 px-4 py-2 border-t border-white/10",children:o}),a&&r==="bottom"&&e.jsx("div",{className:"flex-shrink-0 p-3 border-t border-white/10",children:e.jsx(co,{config:a})})]})}function ec({logo:t,menu:s,user:a,width:r=260,mobileBreakpoint:n=768,open:o,onOpenChange:i,className:l,contentClassName:u,backgroundColor:d,textColor:f,activeColor:m,hoverColor:p,userPosition:w="bottom",showHamburger:C=!0,hamburgerPosition:g="left",renderItem:y,footer:j,header:x,position:v="fixed"}){const[k,N]=c.useState(!1),D=o!==void 0,P=D?o:k,R=D?i:N,[A,S]=c.useState(!1);c.useEffect(()=>{const $=()=>{S(window.innerWidth<n)};return $(),window.addEventListener("resize",$),()=>window.removeEventListener("resize",$)},[n]);const[M,E]=c.useState(()=>{const $=_=>{for(const F of _){if(F.active)return F.id;if(F.children){const H=$(F.children);if(H)return H}}return null};return $(s)}),[T,K]=c.useState(()=>{const $=(_,F=[])=>{for(const H of _){if(H.active)return F;if(H.children){const J=$(H.children,[...F,H.id]);if(J.length>F.length)return J}}return[]};return $(s)}),q=c.useCallback($=>{K(_=>_.includes($)?_.filter(F=>F!==$):[..._,$])},[]),B={activeId:M,setActiveId:E,expandedIds:T,toggleExpanded:q,isMobile:A,closeOnNavigate:!0,onClose:()=>R(!1)},W={"--sidebar-bg":d||"hsl(222 47% 11%)","--sidebar-text":f||"hsl(210 40% 96%)","--sidebar-active":m||"hsl(187 85% 43%)","--sidebar-active-foreground":"hsl(222 47% 11%)","--sidebar-hover":p||"rgba(255, 255, 255, 0.1)"},I=b("bg-[var(--sidebar-bg)] text-[var(--sidebar-text)]","[&_.bg-sidebar-active]:bg-[var(--sidebar-active)]","[&_.text-sidebar-active-foreground]:text-[var(--sidebar-active-foreground)]","[&_.text-sidebar-foreground\\/70]:text-[var(--sidebar-text)]/70","[&_.border-sidebar-active]:border-[var(--sidebar-active)]",u),z=e.jsx(Ql.Provider,{value:B,children:e.jsx("div",{className:b("h-full",I),style:W,children:e.jsx(Tb,{logo:t,menu:s,user:a,userPosition:w,header:x,footer:j,renderItem:y})})});return e.jsxs(e.Fragment,{children:[C&&A&&e.jsxs(L,{variant:"ghost",size:"icon",className:b("fixed top-3 z-50",g==="left"?"left-3":"right-3"),onClick:()=>R(!0),children:[e.jsx(h.Menu,{className:"h-6 w-6"}),e.jsx("span",{className:"sr-only",children:"Ouvrir le menu"})]}),!A&&e.jsx("aside",{className:b(v==="fixed"?"fixed left-0 top-0 h-screen z-40":"relative h-full",l),style:{width:r},children:z}),A&&e.jsx(sa,{open:P,onOpenChange:R,children:e.jsxs(Ds,{side:"left",className:b("w-[280px] p-0 border-0",l),style:W,"aria-describedby":"sidebar-description",children:[e.jsx(aa,{className:"sr-only",children:"Menu de navigation"}),e.jsx(ra,{id:"sidebar-description",className:"sr-only",children:"Menu principal de l'application"}),z]})})]})}function Ab(){const[t,s]=c.useState(!1),a=c.useCallback(()=>s(!0),[]),r=c.useCallback(()=>s(!1),[]),n=c.useCallback(()=>s(o=>!o),[]);return{isOpen:t,setIsOpen:s,open:a,close:r,toggle:n}}function Eb({sidebar:t,children:s,sidebarWidth:a=260,className:r,contentClassName:n}){const[o,i]=c.useState(!1),l=t.mobileBreakpoint||768;return c.useEffect(()=>{const u=()=>i(window.innerWidth<l);return u(),window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[l]),e.jsxs("div",{className:b("min-h-screen bg-background",r),children:[e.jsx(ec,{...t,width:a}),e.jsx("main",{className:b("min-h-screen transition-all duration-300",n),style:{marginLeft:o?0:a},children:s})]})}function Mb({title:t,subtitle:s,showSearch:a=!0,searchPlaceholder:r="Rechercher...",searchValue:n,onSearchChange:o,onSearchSubmit:i,primaryAction:l,secondaryActions:u,filters:d,notifications:f,unreadCount:m=0,onNotificationsClick:p,userMenu:w,leftContent:C,rightContent:g,filterContent:y,className:j,mainBarClassName:x,filterBarClassName:v,sticky:k=!0}){const[N,D]=c.useState(n||""),P=S=>{const M=S.target.value;D(M),o?.(M)},R=S=>{S.key==="Enter"&&i?.(N)},A=d&&d.length>0||y;return e.jsxs("header",{className:b("w-full bg-background border-b",k&&"sticky top-0 z-50",j),children:[e.jsxs("div",{className:b("flex items-center gap-4 px-4 py-2 min-h-[56px]",x),children:[e.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[l&&e.jsxs(L,{variant:l.variant||"default",size:"sm",onClick:l.onClick,className:"gap-2",children:[l.icon||e.jsx(h.Plus,{className:"h-4 w-4"}),l.label]}),a&&e.jsxs("div",{className:"relative",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{type:"search",placeholder:r,value:N,onChange:P,onKeyDown:R,className:"pl-9 w-[200px] h-9 bg-muted/50"})]}),C]}),(t||s)&&e.jsxs("div",{className:"flex-1 text-center",children:[t&&e.jsx("h1",{className:"text-lg font-semibold leading-none",children:t}),s&&e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0 ml-auto",children:[u?.map(S=>e.jsxs(L,{variant:S.variant||"ghost",size:"sm",onClick:S.onClick,className:"gap-2",children:[S.icon,S.label]},S.id)),g,(f||p)&&e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsxs(L,{variant:"ghost",size:"icon",className:"relative",onClick:f?void 0:p,children:[e.jsx(h.Bell,{className:"h-5 w-5"}),m>0&&e.jsx(Se,{variant:"destructive",className:"absolute -top-1 -right-1 h-5 w-5 p-0 flex items-center justify-center text-xs",children:m>9?"9+":m})]})}),f&&f.length>0&&e.jsxs(_e,{align:"end",className:"w-80",children:[e.jsx("div",{className:"p-2 font-semibold border-b",children:"Notifications"}),f.slice(0,5).map(S=>e.jsxs(pe,{onClick:S.onClick,className:b("flex flex-col items-start gap-1 p-3",!S.read&&"bg-muted/50"),children:[e.jsx("div",{className:"font-medium",children:S.title}),S.description&&e.jsx("div",{className:"text-sm text-muted-foreground",children:S.description}),S.time&&e.jsx("div",{className:"text-xs text-muted-foreground",children:S.time})]},S.id))]})]}),w&&e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsxs(L,{variant:"ghost",size:"sm",className:"gap-2",children:[e.jsxs(yt,{className:"h-7 w-7",children:[w.avatar&&e.jsx(Nt,{src:w.avatar,alt:w.name}),e.jsx(Ct,{className:"text-xs",children:w.initials||w.name.slice(0,2).toUpperCase()})]}),e.jsx(h.ChevronDown,{className:"h-4 w-4"})]})}),e.jsxs(_e,{align:"end",className:"w-56",children:[e.jsxs("div",{className:"p-2",children:[e.jsx("p",{className:"font-medium",children:w.name}),w.email&&e.jsx("p",{className:"text-sm text-muted-foreground",children:w.email})]}),e.jsx(Qe,{}),w.items.map((S,M)=>S.separator?e.jsx(Qe,{},M):e.jsxs(pe,{onClick:S.onClick,children:[S.icon&&e.jsx("span",{className:"mr-2",children:S.icon}),S.label]},M))]})]})]})]}),A&&e.jsxs("div",{className:b("flex items-center gap-2 px-4 py-2 border-t bg-muted/30",v),children:[d?.map(S=>e.jsxs(Ve,{value:S.value,onValueChange:S.onChange,children:[e.jsxs($e,{className:"w-auto h-8 gap-2 bg-muted/50 border-0",children:[S.icon,e.jsx(We,{placeholder:S.placeholder||S.label})]}),e.jsx(Le,{children:S.options.map(M=>e.jsx(je,{value:M.value,children:M.label},M.value))})]},S.id)),y]})]})}function Pb({title:t="Tableau de bord",description:s,period:a,onPeriodChange:r,periods:n=[{value:"today",label:"Aujourd'hui"},{value:"week",label:"Cette semaine"},{value:"month",label:"Ce mois"},{value:"year",label:"Cette année"}],onRefresh:o,loading:i,quickActions:l}){return e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:t}),s&&e.jsx("p",{className:"text-muted-foreground mt-1",children:s})]}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r&&e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsxs(L,{variant:"outline",size:"sm",children:[e.jsx(h.Calendar,{className:"mr-2 h-4 w-4"}),n.find(u=>u.value===a)?.label||"Période"]})}),e.jsx(_e,{align:"end",children:n.map(u=>e.jsx(pe,{onClick:()=>r(u.value),className:b(a===u.value&&"bg-muted"),children:u.label},u.value))})]}),o&&e.jsx(L,{variant:"outline",size:"sm",onClick:o,disabled:i,children:e.jsx(h.RefreshCw,{className:b("h-4 w-4",i&&"animate-spin")})}),l?.map(u=>e.jsx(L,{variant:u.variant||"default",size:"sm",onClick:u.onClick,asChild:!!u.href,children:u.href?e.jsxs("a",{href:u.href,children:[u.icon&&e.jsx("span",{className:"mr-2",children:u.icon}),u.label]}):e.jsxs(e.Fragment,{children:[u.icon&&e.jsx("span",{className:"mr-2",children:u.icon}),u.label]})},u.id))]})]})}function Rb({stats:t,layout:s="grid",columns:a=4,loading:r}){return e.jsx(Vl,{layout:s,columns:a,gap:"md",children:t.map(n=>e.jsx(_l,{label:n.label,value:n.value,trend:n.trend,trendValue:n.trendValue,trendText:n.trendText,icon:n.icon,color:n.color,variant:"card",loading:r},n.id))})}function Fb({config:t}){return e.jsxs(ke,{children:[e.jsxs(qe,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsxs("div",{children:[e.jsx(Oe,{className:"text-base",children:t.title}),t.description&&e.jsx(ot,{children:t.description})]}),t.actions&&t.actions.length>0&&e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsx(_e,{align:"end",children:t.actions.map((s,a)=>e.jsx(pe,{onClick:s.onClick,children:s.label},a))})]})]}),e.jsx(Te,{children:t.chart})]})}function $b({config:t}){return e.jsxs(ke,{children:[e.jsxs(qe,{className:"flex flex-row items-center justify-between pb-2",children:[e.jsxs("div",{children:[e.jsx(Oe,{className:"text-base",children:t.title}),t.description&&e.jsx(ot,{children:t.description})]}),t.actions&&t.actions.length>0&&e.jsx("div",{className:"flex gap-2",children:t.actions.map((s,a)=>e.jsx(L,{variant:"outline",size:"sm",onClick:s.onClick,asChild:!!s.href,children:s.href?e.jsxs("a",{href:s.href,children:[s.label,e.jsx(h.ArrowUpRight,{className:"ml-1 h-3 w-3"})]}):s.label},a))})]}),e.jsx(Te,{children:t.table})]})}function Lb({activities:t}){const s=r=>{const n=typeof r=="string"?new Date(r):r,i=new Date().getTime()-n.getTime(),l=Math.floor(i/6e4),u=Math.floor(l/60),d=Math.floor(u/24);return l<1?"À l'instant":l<60?`Il y a ${l} min`:u<24?`Il y a ${u}h`:d<7?`Il y a ${d}j`:n.toLocaleDateString("fr-FR")},a={info:"bg-blue-500",success:"bg-green-500",warning:"bg-yellow-500",error:"bg-red-500"};return e.jsxs(ke,{children:[e.jsx(qe,{children:e.jsx(Oe,{className:"text-base",children:"Activité récente"})}),e.jsx(Te,{children:e.jsx("div",{className:"space-y-4",children:t.map(r=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:b("h-2 w-2 rounded-full mt-2 flex-shrink-0",a[r.type||"info"])}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium",children:r.title}),r.description&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:r.description})]}),e.jsx("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:s(r.timestamp)})]},r.id))})})]})}function Ib({title:t="Tableau de bord",description:s,stats:a,charts:r,tables:n,activities:o,quickActions:i,showHeader:l=!0,onRefresh:u,loading:d=!1,period:f="month",onPeriodChange:m,periods:p,statsLayout:w="grid",statsColumns:C=4,className:g}){return e.jsxs("div",{className:b("space-y-6",g),children:[l&&e.jsx(Pb,{title:t,description:s,period:f,onPeriodChange:m,periods:p,onRefresh:u,loading:d,quickActions:i}),a&&a.length>0&&e.jsx(Rb,{stats:a,layout:w,columns:C,loading:d}),r&&r.length>0&&e.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:r.map(y=>e.jsx(Fb,{config:y},y.id))}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[n&&n.length>0&&e.jsx("div",{className:b("space-y-6",o?"lg:col-span-2":"lg:col-span-3"),children:n.map(y=>e.jsx($b,{config:y},y.id))}),o&&o.length>0&&e.jsx("div",{className:b(!n||n.length===0?"lg:col-span-3":""),children:e.jsx(Lb,{activities:o})})]})]})}const Ob=[{id:"revenue",label:"Revenus",value:"€45,231.89",trend:"up",trendValue:"+20.1%",trendText:"vs mois dernier",icon:e.jsx(h.DollarSign,{className:"h-5 w-5"}),color:"success"},{id:"users",label:"Utilisateurs",value:"2,350",trend:"up",trendValue:"+180",trendText:"cette semaine",icon:e.jsx(h.Users,{className:"h-5 w-5"}),color:"blue"},{id:"orders",label:"Commandes",value:"12,234",trend:"down",trendValue:"-4.3%",trendText:"vs mois dernier",icon:e.jsx(h.ShoppingCart,{className:"h-5 w-5"}),color:"purple"},{id:"performance",label:"Performance",value:"94.2%",trend:"up",trendValue:"+2.4%",icon:e.jsx(h.Activity,{className:"h-5 w-5"}),color:"primary"}];function zb({field:t,value:s,onChange:a}){const r=n=>{a?.(n)};return t.type==="custom"&&t.customComponent?e.jsx("div",{className:"space-y-2",children:t.customComponent}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(me,{htmlFor:t.id,className:"text-sm font-medium",children:[t.label,t.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),t.type==="switch"&&e.jsx(na,{id:t.id,checked:s,onCheckedChange:r,disabled:t.disabled})]}),t.description&&t.type!=="switch"&&e.jsx("p",{className:"text-xs text-muted-foreground",children:t.description}),t.type==="switch"&&t.description&&e.jsx("p",{className:"text-xs text-muted-foreground",children:t.description}),t.type==="text"&&e.jsx(oe,{id:t.id,type:"text",value:s||"",onChange:n=>r(n.target.value),placeholder:t.placeholder,disabled:t.disabled}),t.type==="email"&&e.jsx(oe,{id:t.id,type:"email",value:s||"",onChange:n=>r(n.target.value),placeholder:t.placeholder,disabled:t.disabled}),t.type==="password"&&e.jsx(oe,{id:t.id,type:"password",value:s||"",onChange:n=>r(n.target.value),placeholder:t.placeholder,disabled:t.disabled}),t.type==="textarea"&&e.jsx(ft,{id:t.id,value:s||"",onChange:n=>r(n.target.value),placeholder:t.placeholder,disabled:t.disabled,rows:3}),t.type==="select"&&t.options&&e.jsxs(Ve,{value:s,onValueChange:r,disabled:t.disabled,children:[e.jsx($e,{id:t.id,children:e.jsx(We,{placeholder:t.placeholder||"Sélectionner..."})}),e.jsx(Le,{children:t.options.map(n=>e.jsx(je,{value:n.value,children:n.label},n.value))})]})]})}function _b({section:t,values:s,onChange:a}){return e.jsxs(ke,{children:[e.jsx(qe,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[t.icon&&e.jsx("span",{className:"text-muted-foreground",children:t.icon}),e.jsxs("div",{children:[e.jsx(Oe,{className:"text-base",children:t.title}),t.description&&e.jsx(ot,{children:t.description})]})]})}),e.jsx(Te,{className:"space-y-6",children:t.fields.map((r,n)=>e.jsxs(c.Fragment,{children:[e.jsx(zb,{field:r,value:s?.[r.id],onChange:o=>a?.(r.id,o)}),n<t.fields.length-1&&e.jsx(kt,{className:"my-4"})]},r.id))})]})}function Vb({title:t="Paramètres",description:s="Gérez les paramètres de votre compte et de l'application.",tabs:a,sections:r,useTabs:n=!0,defaultTab:o,values:i={},onChange:l,onSave:u,saving:d=!1,showSaveButton:f=!0,showDeleteAccount:m=!1,onDeleteAccount:p,className:w}){const[C,g]=c.useState(i),[y,j]=c.useState(!1);c.useEffect(()=>{g(i)},[i]);const x=(N,D)=>{g(P=>({...P,[N]:D})),j(!0),l?.(N,D)},v=async()=>{await u?.(C),j(!1)},k=N=>e.jsx("div",{className:"space-y-6",children:N.map(D=>e.jsx(_b,{section:D,values:C,onChange:x},D.id))});return e.jsxs("div",{className:b("space-y-6",w),children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:t}),s&&e.jsx("p",{className:"text-muted-foreground mt-1",children:s})]}),f&&u&&e.jsxs(L,{onClick:v,disabled:d||!y,children:[d?e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(h.Save,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})]}),n&&a&&a.length>0?e.jsxs(oa,{defaultValue:o||a[0].id,className:"space-y-6",children:[e.jsx(Ts,{className:"grid w-full grid-cols-2 md:w-auto md:inline-flex",children:a.map(N=>e.jsxs(js,{value:N.id,className:"gap-2",children:[N.icon,N.label]},N.id))}),a.map(N=>e.jsx(vs,{value:N.id,className:"space-y-6",children:k(N.sections)},N.id))]}):r&&k(r),m&&p&&e.jsxs(ke,{className:"border-destructive",children:[e.jsxs(qe,{children:[e.jsxs(Oe,{className:"text-base text-destructive flex items-center gap-2",children:[e.jsx(h.Trash2,{className:"h-4 w-4"}),"Zone dangereuse"]}),e.jsx(ot,{children:"Actions irréversibles concernant votre compte."})]}),e.jsx(Te,{children:e.jsxs(fs,{children:[e.jsx(So,{asChild:!0,children:e.jsxs(L,{variant:"destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer mon compte"]})}),e.jsxs(Kt,{children:[e.jsxs(Yt,{children:[e.jsx(Qt,{children:"Êtes-vous sûr ?"}),e.jsx(Zt,{children:"Cette action est irréversible. Toutes vos données seront définitivement supprimées et ne pourront pas être récupérées."})]}),e.jsxs(Jt,{children:[e.jsx(ts,{children:"Annuler"}),e.jsx(es,{onClick:p,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer définitivement"})]})]})]})})]})]})}const Wb=[{id:"profile",label:"Profil",icon:e.jsx(h.User,{className:"h-4 w-4"}),sections:[{id:"personal",title:"Informations personnelles",description:"Mettez à jour vos informations personnelles.",icon:e.jsx(h.User,{className:"h-5 w-5"}),fields:[{id:"name",label:"Nom complet",type:"text",placeholder:"Jean Dupont",required:!0},{id:"email",label:"Adresse email",type:"email",placeholder:"jean@exemple.com",required:!0},{id:"bio",label:"Bio",type:"textarea",placeholder:"Parlez-nous de vous..."}]}]},{id:"notifications",label:"Notifications",icon:e.jsx(h.Bell,{className:"h-4 w-4"}),sections:[{id:"email-notifs",title:"Notifications par email",description:"Gérez vos préférences de notification par email.",icon:e.jsx(h.Mail,{className:"h-5 w-5"}),fields:[{id:"notif-marketing",label:"Marketing",description:"Recevoir des emails marketing et promotionnels.",type:"switch"},{id:"notif-security",label:"Sécurité",description:"Recevoir des alertes de sécurité importantes.",type:"switch"},{id:"notif-updates",label:"Mises à jour",description:"Recevoir les mises à jour de produit.",type:"switch"}]}]},{id:"security",label:"Sécurité",icon:e.jsx(h.Shield,{className:"h-4 w-4"}),sections:[{id:"password",title:"Mot de passe",description:"Changez votre mot de passe.",icon:e.jsx(h.Lock,{className:"h-5 w-5"}),fields:[{id:"current-password",label:"Mot de passe actuel",type:"password",placeholder:"••••••••"},{id:"new-password",label:"Nouveau mot de passe",type:"password",placeholder:"••••••••"},{id:"confirm-password",label:"Confirmer le mot de passe",type:"password",placeholder:"••••••••"}]},{id:"two-factor",title:"Authentification à deux facteurs",description:"Ajoutez une couche de sécurité supplémentaire.",icon:e.jsx(h.Smartphone,{className:"h-5 w-5"}),fields:[{id:"2fa-enabled",label:"Activer la 2FA",description:"Utilisez une application d'authentification.",type:"switch"}]}]},{id:"preferences",label:"Préférences",icon:e.jsx(h.Palette,{className:"h-4 w-4"}),sections:[{id:"appearance",title:"Apparence",description:"Personnalisez l'apparence de l'application.",icon:e.jsx(h.Palette,{className:"h-5 w-5"}),fields:[{id:"theme",label:"Thème",type:"select",options:[{value:"light",label:"Clair"},{value:"dark",label:"Sombre"},{value:"system",label:"Système"}]},{id:"language",label:"Langue",type:"select",options:[{value:"fr",label:"Français"},{value:"en",label:"English"},{value:"es",label:"Español"}]}]}]}];function uo({url:t,name:s,size:a="lg",editable:r,onAvatarChange:n}){const o=c.useRef(null),i={sm:"h-12 w-12",md:"h-16 w-16",lg:"h-24 w-24",xl:"h-32 w-32"},l=s.split(" ").map(d=>d[0]).join("").toUpperCase().slice(0,2),u=d=>{const f=d.target.files?.[0];f&&n&&n(f)};return e.jsxs("div",{className:"relative inline-block",children:[e.jsxs(yt,{className:b(i[a],"border-4 border-background shadow-lg"),children:[e.jsx(Nt,{src:t,alt:s}),e.jsx(Ct,{className:"text-lg font-medium",children:l})]}),r&&n&&e.jsxs(e.Fragment,{children:[e.jsx("input",{ref:o,type:"file",accept:"image/*",onChange:u,className:"hidden"}),e.jsx(L,{size:"icon",variant:"secondary",className:"absolute bottom-0 right-0 h-8 w-8 rounded-full shadow-md",onClick:()=>o.current?.click(),children:e.jsx(h.Camera,{className:"h-4 w-4"})})]})]})}function Ub({field:t,value:s,onChange:a,isEditing:r}){if(!r)return e.jsxs("div",{className:"flex items-center gap-2",children:[t.icon&&e.jsx("span",{className:"text-muted-foreground",children:t.icon}),e.jsx("span",{className:b(!s&&"text-muted-foreground italic"),children:s||"Non renseigné"})]});const n={id:t.id,value:s||"",onChange:o=>a(o.target.value),placeholder:t.placeholder,disabled:t.disabled};return t.type==="textarea"?e.jsx(ft,{...n,rows:3}):t.type==="select"&&t.options?e.jsxs(Ve,{value:s,onValueChange:a,disabled:t.disabled,children:[e.jsx($e,{children:e.jsx(We,{placeholder:t.placeholder||"Sélectionner..."})}),e.jsx(Le,{children:t.options.map(o=>e.jsx(je,{value:o.value,children:o.label},o.value))})]}):e.jsx(oe,{type:t.type||"text",...n})}function mo({section:t,values:s,onChange:a,isEditing:r}){return e.jsxs(ke,{children:[e.jsx(qe,{children:e.jsxs("div",{className:"flex items-center gap-2",children:[t.icon&&e.jsx("span",{className:"text-muted-foreground",children:t.icon}),e.jsxs("div",{children:[e.jsx(Oe,{className:"text-base",children:t.title}),t.description&&e.jsx(ot,{children:t.description})]})]})}),e.jsx(Te,{className:"space-y-4",children:t.fields.map((n,o)=>e.jsxs(c.Fragment,{children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(me,{htmlFor:n.id,className:"text-sm font-medium",children:[n.label,n.required&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.jsx(Ub,{field:n,value:s[n.id]||"",onChange:i=>a(n.id,i),isEditing:r})]}),o<t.fields.length-1&&r&&e.jsx(kt,{className:"my-4"})]},n.id))})]})}function Bb({links:t,isEditing:s}){const a=r=>{switch(r){case"twitter":return e.jsx(h.Twitter,{className:"h-4 w-4"});case"github":return e.jsx(h.Github,{className:"h-4 w-4"});case"linkedin":return e.jsx(h.Linkedin,{className:"h-4 w-4"});case"website":return e.jsx(h.Globe,{className:"h-4 w-4"});default:return e.jsx(h.Link,{className:"h-4 w-4"})}};return s?e.jsx("div",{className:"space-y-2",children:t.map(r=>e.jsxs("div",{className:"flex items-center gap-2",children:[a(r.type),e.jsx(oe,{value:r.url,className:"flex-1",readOnly:!0})]},r.id))}):e.jsx("div",{className:"flex gap-2 flex-wrap",children:t.map(r=>e.jsxs("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 px-3 py-1.5 bg-muted rounded-full text-sm hover:bg-muted/80 transition-colors",children:[a(r.type),e.jsx("span",{children:r.label||r.type})]},r.id))})}function qb({profile:t,editable:s=!1,isEditing:a,onEditToggle:r,onChange:n,onSave:o,saving:i=!1,onAvatarChange:l,customSections:u,showSocialLinks:d=!0,showStats:f=!1,stats:m,layout:p="card",useTabs:w=!1,className:C}){const[g,y]=c.useState(!1),[j,x]=c.useState(t),v=a??g;c.useEffect(()=>{x(t)},[t]);const k=E=>{r?r(E):y(E),E||x(t)},N=(E,T)=>{x(K=>({...K,[E]:T})),n?.(E,T)},D=async()=>{await o?.(j),k(!1)},P=[{id:"personal",title:"Informations personnelles",icon:e.jsx(h.User,{className:"h-5 w-5"}),fields:[{id:"firstName",label:"Prénom",value:j.firstName||"",type:"text",placeholder:"Jean",icon:e.jsx(h.User,{className:"h-4 w-4"})},{id:"lastName",label:"Nom",value:j.lastName||"",type:"text",placeholder:"Dupont"},{id:"email",label:"Email",value:j.email,type:"email",placeholder:"jean@exemple.com",required:!0,icon:e.jsx(h.Mail,{className:"h-4 w-4"})},{id:"phone",label:"Téléphone",value:j.phone||"",type:"tel",placeholder:"+33 6 12 34 56 78",icon:e.jsx(h.Phone,{className:"h-4 w-4"})},{id:"bio",label:"Bio",value:j.bio||"",type:"textarea",placeholder:"Parlez-nous de vous..."}]},{id:"professional",title:"Informations professionnelles",icon:e.jsx(h.Briefcase,{className:"h-5 w-5"}),fields:[{id:"role",label:"Poste",value:j.role||"",type:"text",placeholder:"Développeur Senior",icon:e.jsx(h.Briefcase,{className:"h-4 w-4"})},{id:"department",label:"Département",value:j.department||"",type:"text",placeholder:"Engineering"},{id:"company",label:"Entreprise",value:j.company||"",type:"text",placeholder:"Acme Inc.",icon:e.jsx(h.Building,{className:"h-4 w-4"})},{id:"location",label:"Localisation",value:j.location||"",type:"text",placeholder:"Paris, France",icon:e.jsx(h.MapPin,{className:"h-4 w-4"})},{id:"website",label:"Site web",value:j.website||"",type:"url",placeholder:"https://exemple.com",icon:e.jsx(h.Globe,{className:"h-4 w-4"})}]}],R=u||P,A={firstName:j.firstName||"",lastName:j.lastName||"",email:j.email,phone:j.phone||"",bio:j.bio||"",role:j.role||"",department:j.department||"",company:j.company||"",location:j.location||"",website:j.website||"",...j.customFields};if(p==="compact")return e.jsxs("div",{className:b("flex items-center gap-4",C),children:[e.jsx(uo,{url:j.avatarUrl,name:j.displayName,size:"md"}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",children:j.displayName}),j.role&&e.jsx("p",{className:"text-sm text-muted-foreground",children:j.role}),j.email&&e.jsx("p",{className:"text-sm text-muted-foreground",children:j.email})]})]});const S=()=>e.jsxs("div",{className:"flex flex-col items-center text-center gap-4 md:flex-row md:text-left",children:[e.jsx(uo,{url:j.avatarUrl,name:j.displayName,size:"xl",editable:s&&v,onAvatarChange:l}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-start md:justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold",children:j.displayName}),j.role&&e.jsx("p",{className:"text-muted-foreground",children:j.role}),j.company&&e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(h.Building,{className:"h-3 w-3"}),j.company]}),j.location&&e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[e.jsx(h.MapPin,{className:"h-3 w-3"}),j.location]})]}),s&&e.jsx("div",{className:"flex gap-2",children:v?e.jsxs(e.Fragment,{children:[e.jsxs(L,{variant:"outline",size:"sm",onClick:()=>k(!1),disabled:i,children:[e.jsx(h.X,{className:"mr-2 h-4 w-4"}),"Annuler"]}),e.jsxs(L,{size:"sm",onClick:D,disabled:i,children:[i?e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}):e.jsx(h.Save,{className:"mr-2 h-4 w-4"}),"Enregistrer"]})]}):e.jsxs(L,{variant:"outline",size:"sm",onClick:()=>k(!0),children:[e.jsx(h.Edit3,{className:"mr-2 h-4 w-4"}),"Modifier"]})})]}),f&&m&&m.length>0&&e.jsx("div",{className:"flex gap-6 mt-4",children:m.map((E,T)=>e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"text-2xl font-bold",children:E.value}),e.jsx("div",{className:"text-xs text-muted-foreground",children:E.label})]},T))}),d&&j.socialLinks&&j.socialLinks.length>0&&e.jsx("div",{className:"mt-4",children:e.jsx(Bb,{links:j.socialLinks,isEditing:v})}),j.joinedAt&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-4 flex items-center gap-1",children:[e.jsx(h.Calendar,{className:"h-3 w-3"}),"Membre depuis"," ",new Date(j.joinedAt).toLocaleDateString("fr-FR",{month:"long",year:"numeric"})]})]})]}),M=()=>e.jsx("div",{className:"space-y-6",children:R.map(E=>e.jsx(mo,{section:E,values:A,onChange:N,isEditing:v},E.id))});return p==="card"?e.jsx(ke,{className:C,children:e.jsx(Te,{className:"pt-6",children:e.jsxs("div",{className:"space-y-6",children:[S(),e.jsx(kt,{}),M()]})})}):e.jsxs("div",{className:b("space-y-6",C),children:[S(),w?e.jsxs(oa,{defaultValue:R[0]?.id,className:"space-y-6",children:[e.jsx(Ts,{children:R.map(E=>e.jsxs(js,{value:E.id,className:"gap-2",children:[E.icon,E.title]},E.id))}),R.map(E=>e.jsx(vs,{value:E.id,children:e.jsx(mo,{section:E,values:A,onChange:N,isEditing:v})},E.id))]}):M()]})}const Hb={displayName:"Jean Dupont",firstName:"Jean",lastName:"Dupont",email:"jean.dupont@exemple.com",phone:"+33 6 12 34 56 78",bio:"Développeur passionné avec plus de 10 ans d'expérience dans le développement web et mobile.",avatarUrl:"",role:"Lead Developer",department:"Engineering",company:"Acme Inc.",location:"Paris, France",website:"https://jeandupont.dev",joinedAt:new Date("2023-01-15"),socialLinks:[{id:"1",type:"twitter",url:"https://twitter.com/jeandupont",label:"@jeandupont"},{id:"2",type:"github",url:"https://github.com/jeandupont",label:"jeandupont"},{id:"3",type:"linkedin",url:"https://linkedin.com/in/jeandupont",label:"Jean Dupont"}]},tc=[{value:"admin",label:"Administrateur",color:"destructive"},{value:"moderator",label:"Modérateur",color:"warning"},{value:"user",label:"Utilisateur",color:"default"},{value:"guest",label:"Invité",color:"secondary"}],Ia={active:{label:"Actif",color:"bg-green-500",icon:h.CheckCircle},inactive:{label:"Inactif",color:"bg-gray-500",icon:h.XCircle},pending:{label:"En attente",color:"bg-yellow-500",icon:h.Mail},banned:{label:"Banni",color:"bg-red-500",icon:h.Ban}};function Gb({user:t,size:s="sm"}){const a={sm:"h-8 w-8",md:"h-10 w-10"},r=t.displayName.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2);return e.jsxs(yt,{className:a[s],children:[e.jsx(Nt,{src:t.avatarUrl,alt:t.displayName}),e.jsx(Ct,{className:"text-xs",children:r})]})}function Xb({role:t,roles:s=tc}){const a=s.find(n=>n.value===t),r=t==="admin"?h.ShieldAlert:t==="moderator"?h.ShieldCheck:h.Shield;return e.jsxs(Se,{variant:a?.color,children:[e.jsx(r,{className:"h-3 w-3 mr-1"}),a?.label||t]})}function Kb({status:t}){const s=Ia[t];return e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:b("h-2 w-2 rounded-full",s.color)}),e.jsx("span",{className:"text-sm",children:s.label})]})}function ho({open:t,onOpenChange:s,user:a,roles:r,permissions:n,onSubmit:o,loading:i}){const[l,u]=c.useState({email:"",displayName:"",firstName:"",lastName:"",role:"user",status:"pending",permissions:[]});c.useEffect(()=>{u(a?{email:a.email,displayName:a.displayName,firstName:a.firstName||"",lastName:a.lastName||"",role:a.role,status:a.status,permissions:a.permissions||[]}:{email:"",displayName:"",firstName:"",lastName:"",role:"user",status:"pending",permissions:[]})},[a,t]);const d=async m=>{m.preventDefault(),await o(l),s(!1)},f=m=>{u(p=>({...p,permissions:p.permissions?.includes(m)?p.permissions.filter(w=>w!==m):[...p.permissions||[],m]}))};return e.jsx(It,{open:t,onOpenChange:s,children:e.jsx(Tt,{className:"sm:max-w-[500px]",children:e.jsxs("form",{onSubmit:d,children:[e.jsxs(Ht,{children:[e.jsx(Xt,{children:a?"Modifier l'utilisateur":"Créer un utilisateur"}),e.jsx(Cs,{children:a?"Modifiez les informations de l'utilisateur.":"Remplissez les informations pour créer un nouvel utilisateur."})]}),e.jsxs("div",{className:"space-y-4 py-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"firstName",children:"Prénom"}),e.jsx(oe,{id:"firstName",value:l.firstName,onChange:m=>u(p=>({...p,firstName:m.target.value})),placeholder:"Jean"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"lastName",children:"Nom"}),e.jsx(oe,{id:"lastName",value:l.lastName,onChange:m=>u(p=>({...p,lastName:m.target.value})),placeholder:"Dupont"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"displayName",children:"Nom d'affichage *"}),e.jsx(oe,{id:"displayName",value:l.displayName,onChange:m=>u(p=>({...p,displayName:m.target.value})),placeholder:"Jean Dupont",required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"email",children:"Email *"}),e.jsx(oe,{id:"email",type:"email",value:l.email,onChange:m=>u(p=>({...p,email:m.target.value})),placeholder:"jean@exemple.com",required:!0})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"role",children:"Rôle"}),e.jsxs(Ve,{value:l.role,onValueChange:m=>u(p=>({...p,role:m})),children:[e.jsx($e,{children:e.jsx(We,{})}),e.jsx(Le,{children:r.map(m=>e.jsx(je,{value:m.value,children:m.label},m.value))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{htmlFor:"status",children:"Statut"}),e.jsxs(Ve,{value:l.status,onValueChange:m=>u(p=>({...p,status:m})),children:[e.jsx($e,{children:e.jsx(We,{})}),e.jsx(Le,{children:Object.entries(Ia).map(([m,p])=>e.jsx(je,{value:m,children:p.label},m))})]})]})]}),n&&n.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(me,{children:"Permissions"}),e.jsx("div",{className:"border rounded-md p-3 space-y-2 max-h-[150px] overflow-y-auto",children:n.map(m=>e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(Ze,{id:m.id,checked:l.permissions?.includes(m.id),onCheckedChange:()=>f(m.id)}),e.jsx("label",{htmlFor:m.id,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:m.name})]},m.id))})]})]}),e.jsxs(Gt,{children:[e.jsx(L,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Annuler"}),e.jsxs(L,{type:"submit",disabled:i,children:[i&&e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),a?"Enregistrer":"Créer"]})]})]})})})}function Yb({user:t,onEdit:s,onDelete:a,onResetPassword:r,onStatusChange:n,onRoleChange:o,roles:i}){return e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(_e,{align:"end",children:[s&&e.jsxs(pe,{onClick:s,children:[e.jsx(h.Edit,{className:"mr-2 h-4 w-4"}),"Modifier"]}),r&&e.jsxs(pe,{onClick:r,children:[e.jsx(h.Key,{className:"mr-2 h-4 w-4"}),"Réinitialiser le mot de passe"]}),o&&e.jsxs(e.Fragment,{children:[e.jsx(Qe,{}),e.jsx(ms,{children:"Changer le rôle"}),i.map(l=>e.jsx(pe,{onClick:()=>o(l.value),disabled:t.role===l.value,children:l.label},l.value))]}),n&&e.jsxs(e.Fragment,{children:[e.jsx(Qe,{}),e.jsx(ms,{children:"Changer le statut"}),Object.entries(Ia).map(([l,u])=>e.jsx(pe,{onClick:()=>n(l),disabled:t.status===l,children:u.label},l))]}),a&&e.jsxs(e.Fragment,{children:[e.jsx(Qe,{}),e.jsxs(pe,{onClick:a,className:"text-destructive focus:text-destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]})}function Jb({users:t,roles:s=tc,permissions:a,selectedUsers:r=[],onSelectionChange:n,onCreate:o,onEdit:i,onDelete:l,onBulkDelete:u,onRoleChange:d,onStatusChange:f,onResetPassword:m,onExport:p,onRefresh:w,loading:C=!1,actionLoading:g=!1,searchQuery:y="",onSearchChange:j,roleFilter:x="all",onRoleFilterChange:v,statusFilter:k="all",onStatusFilterChange:N,showBulkActions:D=!0,showCreateButton:P=!0,title:R="Gestion des utilisateurs",description:A="Gérez les utilisateurs, leurs rôles et permissions.",className:S}){const[M,E]=c.useState(!1),[T,K]=c.useState(null),[q,B]=c.useState(null),[W,I]=c.useState(!1),z=c.useMemo(()=>t.filter(X=>{if(y){const Y=y.toLowerCase();if(!(X.displayName.toLowerCase().includes(Y)||X.email.toLowerCase().includes(Y)))return!1}return!(x!=="all"&&X.role!==x||k!=="all"&&X.status!==k)}),[t,y,x,k]),$=X=>{n?.(X?z.map(Y=>Y.id):[])},_=(X,Y)=>{n?.(Y?[...r,X]:r.filter(U=>U!==X))},F=async X=>{await o?.(X)},H=async X=>{T&&(await i?.(T.id,X),K(null))},J=async()=>{q&&(await l?.(q.id),B(null))},Q=async()=>{await u?.(r),n?.([]),I(!1)},ne=X=>(typeof X=="string"?new Date(X):X).toLocaleDateString("fr-FR",{day:"numeric",month:"short",year:"numeric"});return e.jsxs("div",{className:b("space-y-6",S),children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl font-bold tracking-tight flex items-center gap-2",children:[e.jsx(h.Users,{className:"h-6 w-6"}),R]}),A&&e.jsx("p",{className:"text-muted-foreground mt-1",children:A})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[w&&e.jsx(L,{variant:"outline",size:"sm",onClick:w,disabled:C,children:e.jsx(h.RefreshCw,{className:b("h-4 w-4",C&&"animate-spin")})}),p&&e.jsxs(L,{variant:"outline",size:"sm",onClick:p,children:[e.jsx(h.Download,{className:"mr-2 h-4 w-4"}),"Exporter"]}),P&&o&&e.jsxs(L,{size:"sm",onClick:()=>E(!0),children:[e.jsx(h.UserPlus,{className:"mr-2 h-4 w-4"}),"Ajouter"]})]})]}),e.jsx(ke,{children:e.jsxs(Te,{className:"pt-6",children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-center",children:[j&&e.jsxs("div",{className:"relative flex-1",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{placeholder:"Rechercher un utilisateur...",value:y,onChange:X=>j(X.target.value),className:"pl-9"})]}),v&&e.jsxs(Ve,{value:x,onValueChange:X=>v(X),children:[e.jsxs($e,{className:"w-[180px]",children:[e.jsx(h.Filter,{className:"mr-2 h-4 w-4"}),e.jsx(We,{placeholder:"Rôle"})]}),e.jsxs(Le,{children:[e.jsx(je,{value:"all",children:"Tous les rôles"}),s.map(X=>e.jsx(je,{value:X.value,children:X.label},X.value))]})]}),N&&e.jsxs(Ve,{value:k,onValueChange:X=>N(X),children:[e.jsxs($e,{className:"w-[180px]",children:[e.jsx(h.Filter,{className:"mr-2 h-4 w-4"}),e.jsx(We,{placeholder:"Statut"})]}),e.jsxs(Le,{children:[e.jsx(je,{value:"all",children:"Tous les statuts"}),Object.entries(Ia).map(([X,Y])=>e.jsx(je,{value:X,children:Y.label},X))]})]})]}),D&&r.length>0&&e.jsxs("div",{className:"flex items-center gap-4 mt-4 p-3 bg-muted rounded-lg",children:[e.jsxs("span",{className:"text-sm font-medium",children:[r.length," utilisateur(s) sélectionné(s)"]}),u&&e.jsxs(L,{variant:"destructive",size:"sm",onClick:()=>I(!0),children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]}),e.jsx(L,{variant:"outline",size:"sm",onClick:()=>n?.([]),children:"Désélectionner"})]})]})}),e.jsx(ke,{children:e.jsx(Te,{className:"p-0",children:e.jsxs(Fa,{children:[e.jsx($a,{children:e.jsxs(qt,{children:[n&&e.jsx(ct,{className:"w-[50px]",children:e.jsx(Ze,{checked:z.length>0&&r.length===z.length,onCheckedChange:$})}),e.jsx(ct,{children:"Utilisateur"}),e.jsx(ct,{children:"Rôle"}),e.jsx(ct,{children:"Statut"}),e.jsx(ct,{children:"Inscrit le"}),e.jsx(ct,{children:"Dernière connexion"}),e.jsx(ct,{className:"w-[50px]"})]})}),e.jsx(La,{children:C?e.jsx(qt,{children:e.jsx(tt,{colSpan:n?7:6,className:"text-center py-8",children:e.jsx(h.Loader2,{className:"h-6 w-6 animate-spin mx-auto"})})}):z.length===0?e.jsx(qt,{children:e.jsx(tt,{colSpan:n?7:6,className:"text-center py-8 text-muted-foreground",children:"Aucun utilisateur trouvé"})}):z.map(X=>e.jsxs(qt,{children:[n&&e.jsx(tt,{children:e.jsx(Ze,{checked:r.includes(X.id),onCheckedChange:Y=>_(X.id,Y)})}),e.jsx(tt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(Gb,{user:X}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:X.displayName}),e.jsx("div",{className:"text-sm text-muted-foreground",children:X.email})]})]})}),e.jsx(tt,{children:e.jsx(Xb,{role:X.role,roles:s})}),e.jsx(tt,{children:e.jsx(Kb,{status:X.status})}),e.jsx(tt,{className:"text-muted-foreground",children:ne(X.createdAt)}),e.jsx(tt,{className:"text-muted-foreground",children:X.lastLogin?ne(X.lastLogin):"-"}),e.jsx(tt,{children:e.jsx(Yb,{user:X,roles:s,onEdit:i?()=>K(X):void 0,onDelete:l?()=>B(X):void 0,onResetPassword:m?()=>m(X.id):void 0,onRoleChange:d?Y=>d(X.id,Y):void 0,onStatusChange:f?Y=>f(X.id,Y):void 0})})]},X.id))})]})})}),e.jsx(ho,{open:M,onOpenChange:E,roles:s,permissions:a,onSubmit:F,loading:g}),e.jsx(ho,{open:!!T,onOpenChange:X=>!X&&K(null),user:T||void 0,roles:s,permissions:a,onSubmit:H,loading:g}),e.jsx(fs,{open:!!q,onOpenChange:X=>!X&&B(null),children:e.jsxs(Kt,{children:[e.jsxs(Yt,{children:[e.jsx(Qt,{children:"Supprimer l'utilisateur ?"}),e.jsxs(Zt,{children:["Êtes-vous sûr de vouloir supprimer ",q?.displayName," ? Cette action est irréversible."]})]}),e.jsxs(Jt,{children:[e.jsx(ts,{children:"Annuler"}),e.jsx(es,{onClick:J,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer"})]})]})}),e.jsx(fs,{open:W,onOpenChange:I,children:e.jsxs(Kt,{children:[e.jsxs(Yt,{children:[e.jsx(Qt,{children:"Supprimer les utilisateurs ?"}),e.jsxs(Zt,{children:["Êtes-vous sûr de vouloir supprimer ",r.length," utilisateur(s) ? Cette action est irréversible."]})]}),e.jsxs(Jt,{children:[e.jsx(ts,{children:"Annuler"}),e.jsx(es,{onClick:Q,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Supprimer"})]})]})})]})}const Qb=[{id:"1",email:"admin@exemple.com",displayName:"Admin User",firstName:"Admin",lastName:"User",role:"admin",status:"active",createdAt:new Date("2023-01-01"),lastLogin:new Date("2024-01-15")},{id:"2",email:"moderator@exemple.com",displayName:"Marie Modérateur",firstName:"Marie",lastName:"Modérateur",role:"moderator",status:"active",createdAt:new Date("2023-03-15"),lastLogin:new Date("2024-01-14")},{id:"3",email:"user@exemple.com",displayName:"Jean Utilisateur",firstName:"Jean",lastName:"Utilisateur",role:"user",status:"active",createdAt:new Date("2023-06-01"),lastLogin:new Date("2024-01-10")},{id:"4",email:"pending@exemple.com",displayName:"Paul Pending",firstName:"Paul",lastName:"Pending",role:"user",status:"pending",createdAt:new Date("2024-01-10")},{id:"5",email:"banned@exemple.com",displayName:"Bob Banni",firstName:"Bob",lastName:"Banni",role:"guest",status:"banned",createdAt:new Date("2023-09-01"),lastLogin:new Date("2023-12-01")}],Zb=[{id:"read",name:"Lecture",description:"Accès en lecture",category:"Base"},{id:"write",name:"Écriture",description:"Accès en écriture",category:"Base"},{id:"delete",name:"Suppression",description:"Accès suppression",category:"Base"},{id:"admin",name:"Administration",description:"Accès admin",category:"Admin"},{id:"users",name:"Gestion utilisateurs",description:"Gérer les utilisateurs",category:"Admin"}],sc={created:{icon:h.Plus,color:"text-green-500",label:"créé"},updated:{icon:h.Edit,color:"text-blue-500",label:"modifié"},deleted:{icon:h.Trash2,color:"text-red-500",label:"supprimé"},commented:{icon:h.MessageSquare,color:"text-purple-500",label:"commenté"},uploaded:{icon:h.Upload,color:"text-cyan-500",label:"uploadé"},downloaded:{icon:h.Download,color:"text-gray-500",label:"téléchargé"},shared:{icon:h.User,color:"text-orange-500",label:"partagé"},approved:{icon:h.Check,color:"text-green-500",label:"approuvé"},rejected:{icon:h.X,color:"text-red-500",label:"rejeté"},mentioned:{icon:h.Bell,color:"text-yellow-500",label:"mentionné"},assigned:{icon:h.User,color:"text-indigo-500",label:"assigné"},completed:{icon:h.Check,color:"text-green-500",label:"terminé"},custom:{icon:h.AlertCircle,color:"text-gray-500",label:""}};function fo({user:t,size:s="sm"}){const a={sm:"h-8 w-8",md:"h-10 w-10"},r=t.name.split(" ").map(n=>n[0]).join("").toUpperCase().slice(0,2);return e.jsxs(yt,{className:a[s],children:[e.jsx(Nt,{src:t.avatar,alt:t.name}),e.jsx(Ct,{className:"text-xs",children:r})]})}function po({type:t,customIcon:s,customColor:a}){const r=sc[t],n=r.icon;return e.jsx("div",{className:b("flex h-8 w-8 items-center justify-center rounded-full bg-background border-2 shadow-sm",a||r.color),children:s||e.jsx(n,{className:"h-4 w-4"})})}function ej({activity:t,showAvatar:s,relativeTime:a,layout:r,isLast:n}){const o=l=>{const u=typeof l=="string"?new Date(l):l;if(a){const f=new Date().getTime()-u.getTime(),m=Math.floor(f/6e4),p=Math.floor(m/60),w=Math.floor(p/24);if(m<1)return"À l'instant";if(m<60)return`Il y a ${m} min`;if(p<24)return`Il y a ${p}h`;if(w<7)return`Il y a ${w}j`}return u.toLocaleDateString("fr-FR",{day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})},i=sc[t.type];return r==="compact"?e.jsxs("div",{className:"flex items-center gap-3 py-2",children:[e.jsx(po,{type:t.type,customIcon:t.icon,customColor:t.color}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("p",{className:"text-sm truncate",children:[e.jsx("span",{className:"font-medium",children:t.user.name})," ",e.jsx("span",{className:"text-muted-foreground",children:t.title})]})}),e.jsx("span",{className:"text-xs text-muted-foreground flex-shrink-0",children:o(t.timestamp)})]}):r==="feed"?e.jsx(ke,{className:"mb-4",children:e.jsx(Te,{className:"pt-4",children:e.jsxs("div",{className:"flex gap-3",children:[s&&e.jsx(fo,{user:t.user,size:"md"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx("span",{className:"font-medium",children:t.user.name}),e.jsx(Se,{variant:"secondary",className:"text-xs",children:i.label||t.type}),e.jsx("span",{className:"text-xs text-muted-foreground",children:o(t.timestamp)})]}),e.jsx("p",{className:"text-sm",children:t.title}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.description}),t.metadata?.comment&&e.jsx("div",{className:"mt-2 p-3 bg-muted rounded-lg text-sm",children:t.metadata.comment})]})]})})}):e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx(po,{type:t.type,customIcon:t.icon,customColor:t.color}),!n&&e.jsx("div",{className:"w-0.5 flex-1 bg-border mt-2"})]}),e.jsx("div",{className:"flex-1 pb-8",children:e.jsxs("div",{className:"flex items-start gap-3",children:[s&&e.jsx(fo,{user:t.user}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium",children:t.user.name}),e.jsx("span",{className:"text-muted-foreground",children:t.title})]}),t.description&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.description}),t.metadata?.comment&&e.jsx("div",{className:"mt-2 p-3 bg-muted rounded-lg text-sm",children:t.metadata.comment}),e.jsx("span",{className:"text-xs text-muted-foreground mt-2 block",children:o(t.timestamp)})]})]})})]})}function tj({activities:t,title:s="Activité",showSearch:a=!0,showFilters:r=!0,filters:n=[],activeFilter:o,onFilterChange:i,showRefresh:l=!0,onRefresh:u,loading:d=!1,groupByDay:f=!0,showLoadMore:m=!1,onLoadMore:p,loadingMore:w=!1,showAvatars:C=!0,relativeTime:g=!0,layout:y="timeline",className:j}){const[x,v]=c.useState(""),[k,N]=c.useState(null),D=o??k,P=M=>{i?i(M):N(M)},R=c.useMemo(()=>{let M=t;if(x){const E=x.toLowerCase();M=M.filter(T=>T.title.toLowerCase().includes(E)||T.user.name.toLowerCase().includes(E)||T.description?.toLowerCase().includes(E))}if(D){const E=n.find(T=>T.id===D);E&&(M=M.filter(T=>E.types.includes(T.type)))}return M},[t,x,D,n]),A=c.useMemo(()=>{if(!f)return null;const M={};return R.forEach(E=>{const K=(typeof E.timestamp=="string"?new Date(E.timestamp):E.timestamp).toLocaleDateString("fr-FR",{weekday:"long",day:"numeric",month:"long",year:"numeric"});M[K]||(M[K]=[]),M[K].push(E)}),M},[R,f]),S=M=>e.jsx("div",{children:M.map((E,T)=>e.jsx(ej,{activity:E,showAvatar:C,relativeTime:g,layout:y,isLast:T===M.length-1},E.id))});return e.jsxs("div",{className:b("space-y-4",j),children:[e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[e.jsx("h2",{className:"text-xl font-semibold",children:s}),e.jsx("div",{className:"flex items-center gap-2",children:l&&u&&e.jsx(L,{variant:"outline",size:"sm",onClick:u,disabled:d,children:e.jsx(h.RefreshCw,{className:b("h-4 w-4",d&&"animate-spin")})})})]}),(a||r)&&e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center",children:[a&&e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{placeholder:"Rechercher...",value:x,onChange:M=>v(M.target.value),className:"pl-9"})]}),r&&n.length>0&&e.jsxs(Ve,{value:D||"all",onValueChange:M=>P(M==="all"?null:M),children:[e.jsxs($e,{className:"w-[180px]",children:[e.jsx(h.Filter,{className:"h-4 w-4 mr-2"}),e.jsx(We,{placeholder:"Filtrer"})]}),e.jsxs(Le,{children:[e.jsx(je,{value:"all",children:"Toutes les activités"}),n.map(M=>e.jsx(je,{value:M.id,children:M.label},M.id))]})]})]}),d?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(h.RefreshCw,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):R.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(h.Clock,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Aucune activité"})]}):f&&A?e.jsx("div",{className:"space-y-6",children:Object.entries(A).map(([M,E])=>e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-4 capitalize",children:M}),S(E)]},M))}):S(R),m&&p&&e.jsx("div",{className:"flex justify-center pt-4",children:e.jsxs(L,{variant:"outline",onClick:p,disabled:w,children:[w?e.jsx(h.RefreshCw,{className:"h-4 w-4 animate-spin mr-2"}):e.jsx(h.ChevronDown,{className:"h-4 w-4 mr-2"}),"Charger plus"]})})]})}const sj=[{id:"edits",label:"Modifications",types:["created","updated","deleted"]},{id:"comments",label:"Commentaires",types:["commented","mentioned"]},{id:"files",label:"Fichiers",types:["uploaded","downloaded","shared"]},{id:"approvals",label:"Approbations",types:["approved","rejected","completed"]}],aj=[{id:"1",type:"created",title:"a créé le document 'Rapport Q4'",user:{id:"1",name:"Marie Dupont"},timestamp:new Date(Date.now()-1e3*60*5)},{id:"2",type:"commented",title:"a commenté sur 'Projet Alpha'",user:{id:"2",name:"Pierre Martin"},timestamp:new Date(Date.now()-1e3*60*30),metadata:{comment:"Super travail sur cette partie !"}},{id:"3",type:"uploaded",title:"a uploadé 3 fichiers",user:{id:"3",name:"Sophie Bernard"},timestamp:new Date(Date.now()-1e3*60*60*2)},{id:"4",type:"approved",title:"a approuvé la demande de congés",user:{id:"1",name:"Marie Dupont"},timestamp:new Date(Date.now()-1e3*60*60*24)}],hn={blue:{bg:"bg-blue-100",text:"text-blue-700",border:"border-blue-500"},green:{bg:"bg-green-100",text:"text-green-700",border:"border-green-500"},red:{bg:"bg-red-100",text:"text-red-700",border:"border-red-500"},yellow:{bg:"bg-yellow-100",text:"text-yellow-700",border:"border-yellow-500"},purple:{bg:"bg-purple-100",text:"text-purple-700",border:"border-purple-500"},pink:{bg:"bg-pink-100",text:"text-pink-700",border:"border-pink-500"},orange:{bg:"bg-orange-100",text:"text-orange-700",border:"border-orange-500"},cyan:{bg:"bg-cyan-100",text:"text-cyan-700",border:"border-cyan-500"}};function rj(t,s){const a=[],r=new Date(t,s+1,0);for(let n=1;n<=r.getDate();n++)a.push(new Date(t,s,n));return a}function hr(t,s){return t.getFullYear()===s.getFullYear()&&t.getMonth()===s.getMonth()&&t.getDate()===s.getDate()}function nj(t,s){return t.filter(a=>{const r=typeof a.start=="string"?new Date(a.start):a.start,n=typeof a.end=="string"?new Date(a.end):a.end;return a.allDay?hr(r,s)||s>=r&&s<=n:hr(r,s)})}function oj({currentDate:t,viewMode:s,onPrevious:a,onNext:r,onToday:n,onViewModeChange:o,onAddClick:i,showViewSelector:l,showAddButton:u,locale:d}){const f=()=>{switch(s){case"month":return t.toLocaleDateString(d,{month:"long",year:"numeric"});case"week":return`Semaine du ${t.toLocaleDateString(d,{day:"numeric",month:"long"})}`;case"day":return t.toLocaleDateString(d,{weekday:"long",day:"numeric",month:"long",year:"numeric"});case"agenda":return"Agenda";default:return""}};return e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{variant:"outline",size:"icon",onClick:a,children:e.jsx(h.ChevronLeft,{className:"h-4 w-4"})}),e.jsx(L,{variant:"outline",size:"icon",onClick:r,children:e.jsx(h.ChevronRight,{className:"h-4 w-4"})}),e.jsx(L,{variant:"outline",size:"sm",onClick:n,children:"Aujourd'hui"}),e.jsx("h2",{className:"text-xl font-semibold ml-4 capitalize",children:f()})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[l&&o&&e.jsxs(Ve,{value:s,onValueChange:m=>o(m),children:[e.jsx($e,{className:"w-[120px]",children:e.jsx(We,{})}),e.jsxs(Le,{children:[e.jsx(je,{value:"month",children:"Mois"}),e.jsx(je,{value:"week",children:"Semaine"}),e.jsx(je,{value:"day",children:"Jour"}),e.jsx(je,{value:"agenda",children:"Agenda"})]})]}),u&&i&&e.jsxs(L,{onClick:i,children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-2"}),"Événement"]})]})]})}function ij({event:t,onClick:s,compact:a=!1}){const r=hn[t.color||"blue"],n=typeof t.start=="string"?new Date(t.start):t.start;return e.jsxs("button",{onClick:o=>{o.stopPropagation(),s?.()},className:b("w-full text-left rounded px-1.5 py-0.5 text-xs truncate border-l-2",r.bg,r.text,r.border),children:[!t.allDay&&!a&&e.jsx("span",{className:"font-medium mr-1",children:n.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})}),t.title]})}function lj({event:t,onEdit:s,onDelete:a}){const r=typeof t.start=="string"?new Date(t.start):t.start,n=typeof t.end=="string"?new Date(t.end):t.end,o=hn[t.color||"blue"];return e.jsxs("div",{className:"w-72",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("div",{className:b("w-3 h-3 rounded-full mt-1",o.bg.replace("100","500"))}),e.jsxs("div",{className:"flex gap-1",children:[s&&e.jsx(L,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:s,children:e.jsx(h.Edit,{className:"h-3 w-3"})}),a&&e.jsx(L,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:a,children:e.jsx(h.Trash2,{className:"h-3 w-3"})})]})]}),e.jsx("h4",{className:"font-semibold mt-2",children:t.title}),e.jsxs("div",{className:"space-y-2 mt-3 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.Clock,{className:"h-4 w-4"}),t.allDay?e.jsx("span",{children:"Toute la journée"}):e.jsxs("span",{children:[r.toLocaleString("fr-FR",{weekday:"short",day:"numeric",month:"short",hour:"2-digit",minute:"2-digit"})," - ",n.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"})]})]}),t.location&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.MapPin,{className:"h-4 w-4"}),e.jsx("span",{children:t.location})]}),t.attendees&&t.attendees.length>0&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.Users,{className:"h-4 w-4"}),e.jsxs("span",{children:[t.attendees.length," participant(s)"]})]})]}),t.description&&e.jsx("p",{className:"mt-3 text-sm",children:t.description})]})}function cj({currentDate:t,events:s,weekStartsOn:a,locale:r,onDayClick:n,onEventClick:o,onEventEdit:i,onEventDelete:l}){const u=t.getFullYear(),d=t.getMonth(),f=rj(u,d),m=new Date,p=Array.from({length:7},(y,j)=>new Date(2024,0,a+j).toLocaleDateString(r,{weekday:"short"})),C=(new Date(u,d,1).getDay()-a+7)%7,g=[];for(let y=0;y<C;y++)g.push(null);for(g.push(...f);g.length%7!==0;)g.push(null);return e.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[e.jsx("div",{className:"grid grid-cols-7 bg-muted",children:p.map(y=>e.jsx("div",{className:"p-2 text-center text-sm font-medium capitalize",children:y},y))}),e.jsx("div",{className:"grid grid-cols-7",children:g.map((y,j)=>{const x=y?nj(s,y):[],v=y&&hr(y,m),k=y&&y.getMonth()===d;return e.jsx("div",{className:b("min-h-[100px] border-t border-l p-1 cursor-pointer hover:bg-muted/50",!k&&"bg-muted/30 text-muted-foreground"),onClick:()=>y&&n?.(y),children:y&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:b("text-sm font-medium mb-1 w-7 h-7 flex items-center justify-center rounded-full",v&&"bg-primary text-primary-foreground"),children:y.getDate()}),e.jsxs("div",{className:"space-y-1",children:[x.slice(0,3).map(N=>e.jsxs(rt,{children:[e.jsx(nt,{asChild:!0,children:e.jsx("div",{children:e.jsx(ij,{event:N,onClick:()=>o?.(N),compact:!0})})}),e.jsx(st,{children:e.jsx(lj,{event:N,onEdit:()=>i?.(N.id,{}),onDelete:()=>l?.(N.id)})})]},N.id)),x.length>3&&e.jsxs("button",{className:"text-xs text-muted-foreground hover:text-foreground",children:["+",x.length-3," autres"]})]})]})},j)})})]})}function dj({currentDate:t,events:s,locale:a,onEventClick:r}){const n=s.filter(i=>{const l=typeof i.start=="string"?new Date(i.start):i.start,u=new Date(t);return u.setDate(u.getDate()+30),l>=t&&l<=u}).sort((i,l)=>{const u=typeof i.start=="string"?new Date(i.start):i.start,d=typeof l.start=="string"?new Date(l.start):l.start;return u.getTime()-d.getTime()}),o={};return n.forEach(i=>{const u=(typeof i.start=="string"?new Date(i.start):i.start).toDateString();o[u]||(o[u]=[]),o[u].push(i)}),e.jsxs("div",{className:"space-y-4",children:[Object.entries(o).map(([i,l])=>{const u=new Date(i);return e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-2 capitalize",children:u.toLocaleDateString(a,{weekday:"long",day:"numeric",month:"long"})}),e.jsx("div",{className:"space-y-2",children:l.map(d=>{const f=hn[d.color||"blue"],m=typeof d.start=="string"?new Date(d.start):d.start,p=typeof d.end=="string"?new Date(d.end):d.end;return e.jsx(ke,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>r?.(d),children:e.jsxs(Te,{className:"p-3 flex gap-3",children:[e.jsx("div",{className:b("w-1 rounded-full",f.bg.replace("100","500"))}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h4",{className:"font-medium",children:d.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:d.allDay?"Toute la journée":`${m.toLocaleTimeString(a,{hour:"2-digit",minute:"2-digit"})} - ${p.toLocaleTimeString(a,{hour:"2-digit",minute:"2-digit"})}`}),d.location&&e.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1 mt-1",children:[e.jsx(h.MapPin,{className:"h-3 w-3"}),d.location]})]})]})},d.id)})})]},i)}),Object.keys(o).length===0&&e.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Aucun événement à venir"})]})}function uj({events:t,currentDate:s,onDateChange:a,viewMode:r,onViewModeChange:n,onEventClick:o,onEventCreate:i,onEventEdit:l,onEventDelete:u,onDayClick:d,showHeader:f=!0,showViewSelector:m=!0,showAddButton:p=!0,weekStartsOn:w=1,locale:C="fr-FR",className:g}){const[y,j]=c.useState(new Date),[x,v]=c.useState("month"),[k,N]=c.useState(!1),D=s??y,P=r??x,R=T=>{a?a(T):j(T)},A=T=>{n?n(T):v(T)},S=()=>{const T=new Date(D);switch(P){case"month":T.setMonth(T.getMonth()-1);break;case"week":T.setDate(T.getDate()-7);break;case"day":T.setDate(T.getDate()-1);break}R(T)},M=()=>{const T=new Date(D);switch(P){case"month":T.setMonth(T.getMonth()+1);break;case"week":T.setDate(T.getDate()+7);break;case"day":T.setDate(T.getDate()+1);break}R(T)},E=()=>{R(new Date)};return e.jsxs("div",{className:b("space-y-4",g),children:[f&&e.jsx(oj,{currentDate:D,viewMode:P,onPrevious:S,onNext:M,onToday:E,onViewModeChange:A,onAddClick:()=>N(!0),showViewSelector:m,showAddButton:p,locale:C}),P==="month"&&e.jsx(cj,{currentDate:D,events:t,weekStartsOn:w,locale:C,onDayClick:d,onEventClick:o,onEventEdit:l,onEventDelete:u}),P==="agenda"&&e.jsx(dj,{currentDate:D,events:t,locale:C,onEventClick:o}),(P==="week"||P==="day")&&e.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:["Vue ",P==="week"?"semaine":"jour"," - À implémenter"]})]})}const mj=[{id:"1",title:"Réunion d'équipe",start:new Date,end:new Date(Date.now()+1e3*60*60),color:"blue",location:"Salle de réunion A"},{id:"2",title:"Déjeuner avec le client",start:new Date(Date.now()+1e3*60*60*24),end:new Date(Date.now()+1e3*60*60*25),color:"green",location:"Restaurant Le Gourmet"},{id:"3",title:"Formation React",start:new Date(Date.now()+1e3*60*60*24*2),end:new Date(Date.now()+1e3*60*60*24*2+1e3*60*60*4),color:"purple",allDay:!0},{id:"4",title:"Deadline projet",start:new Date(Date.now()+1e3*60*60*24*5),end:new Date(Date.now()+1e3*60*60*24*5),color:"red",allDay:!0}];function hj({conversations:t,activeId:s,currentUser:a,onSelect:r,onSearch:n}){const[o,i]=c.useState(""),l=m=>m.name?m.name:m.participants.filter(w=>w.id!==a.id).map(w=>w.name).join(", "),u=m=>{if(m.avatar)return{url:m.avatar,fallback:m.name?.charAt(0)||"G"};if(m.isGroup)return{fallback:"G"};const p=m.participants.find(w=>w.id!==a.id);return{url:p?.avatar,fallback:p?.name.charAt(0)||"?"}},d=m=>{if(!m)return"";const p=typeof m=="string"?new Date(m):m,C=new Date().getTime()-p.getTime(),g=Math.floor(C/(1e3*60*60*24));return g===0?p.toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"}):g===1?"Hier":g<7?p.toLocaleDateString("fr-FR",{weekday:"short"}):p.toLocaleDateString("fr-FR",{day:"numeric",month:"short"})},f=t.filter(m=>o?l(m).toLowerCase().includes(o.toLowerCase()):!0);return e.jsxs("div",{className:"flex flex-col h-full border-r",children:[e.jsx("div",{className:"p-3 border-b",children:e.jsxs("div",{className:"relative",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{placeholder:"Rechercher...",value:o,onChange:m=>{i(m.target.value),n?.(m.target.value)},className:"pl-9"})]})}),e.jsx(At,{className:"flex-1",children:f.map(m=>{const p=u(m),w=l(m),C=m.participants.find(g=>g.id!==a.id);return e.jsxs("button",{onClick:()=>r(m),className:b("w-full flex items-center gap-3 p-3 hover:bg-muted/50 transition-colors text-left",s===m.id&&"bg-muted"),children:[e.jsxs("div",{className:"relative",children:[e.jsxs(yt,{children:[e.jsx(Nt,{src:p.url}),e.jsx(Ct,{children:p.fallback})]}),C?.status==="online"&&e.jsx("div",{className:"absolute bottom-0 right-0 h-3 w-3 rounded-full bg-green-500 border-2 border-background"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium text-sm truncate",children:w}),e.jsx("span",{className:"text-xs text-muted-foreground",children:d(m.lastMessage?.timestamp)})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:m.lastMessage?.content||"Aucun message"}),m.unreadCount&&m.unreadCount>0&&e.jsx(Se,{className:"h-5 min-w-[20px] justify-center",children:m.unreadCount})]})]})]},m.id)})})]})}function fj({conversation:t,currentUser:s,onAudioCall:a,onVideoCall:r}){const n=t.participants.find(l=>l.id!==s.id),o=t.name||n?.name||"Chat",i=()=>t.isGroup?`${t.participants.length} participants`:n?.status==="online"?"En ligne":n?.lastSeen?`Vu ${(typeof n.lastSeen=="string"?new Date(n.lastSeen):n.lastSeen).toLocaleString("fr-FR")}`:"Hors ligne";return e.jsxs("div",{className:"flex items-center justify-between p-3 border-b",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(yt,{children:[e.jsx(Nt,{src:t.avatar||n?.avatar}),e.jsx(Ct,{children:o.charAt(0)})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold text-sm",children:o}),e.jsx("p",{className:"text-xs text-muted-foreground",children:i()})]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[a&&e.jsx(L,{variant:"ghost",size:"icon",onClick:a,children:e.jsx(h.Phone,{className:"h-4 w-4"})}),r&&e.jsx(L,{variant:"ghost",size:"icon",onClick:r,children:e.jsx(h.Video,{className:"h-4 w-4"})}),e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx(L,{variant:"ghost",size:"icon",children:e.jsx(h.MoreVertical,{className:"h-4 w-4"})})}),e.jsx(_e,{align:"end",children:e.jsxs(pe,{children:[e.jsx(h.Settings,{className:"mr-2 h-4 w-4"}),"Paramètres"]})})]})]})]})}function pj({message:t,isOwn:s,showStatus:a,showTimestamp:r,onDelete:n,onReply:o}){const i=u=>(typeof u=="string"?new Date(u):u).toLocaleTimeString("fr-FR",{hour:"2-digit",minute:"2-digit"}),l=()=>{switch(t.status){case"sending":return e.jsx("div",{className:"h-3 w-3 rounded-full border-2 border-current animate-pulse"});case"sent":return e.jsx(h.Check,{className:"h-3 w-3"});case"delivered":return e.jsx(h.CheckCheck,{className:"h-3 w-3"});case"read":return e.jsx(h.CheckCheck,{className:"h-3 w-3 text-blue-500"});case"error":return e.jsx(h.X,{className:"h-3 w-3 text-red-500"});default:return null}};return e.jsxs("div",{className:b("flex gap-2 group",s?"flex-row-reverse":"flex-row"),children:[!s&&e.jsxs(yt,{className:"h-8 w-8",children:[e.jsx(Nt,{src:t.sender.avatar}),e.jsx(Ct,{className:"text-xs",children:t.sender.name.charAt(0)})]}),e.jsxs("div",{className:b("max-w-[70%]",s&&"items-end"),children:[t.replyTo&&e.jsxs("div",{className:"text-xs text-muted-foreground mb-1 p-2 bg-muted/50 rounded border-l-2 border-primary",children:[e.jsx("span",{className:"font-medium",children:t.replyTo.sender.name}),e.jsx("p",{className:"truncate",children:t.replyTo.content})]}),e.jsxs("div",{className:b("relative rounded-2xl px-4 py-2",s?"bg-primary text-primary-foreground rounded-tr-sm":"bg-muted rounded-tl-sm"),children:[t.attachments&&t.attachments.length>0&&e.jsx("div",{className:"space-y-2 mb-2",children:t.attachments.map((u,d)=>e.jsx("div",{children:u.type==="image"?e.jsx("img",{src:u.url,alt:u.name,className:"rounded-lg max-w-full"}):e.jsxs("div",{className:"flex items-center gap-2 p-2 bg-background/10 rounded",children:[e.jsx(h.File,{className:"h-4 w-4"}),e.jsx("span",{className:"text-sm truncate",children:u.name})]})},d))}),e.jsx("p",{className:"text-sm whitespace-pre-wrap break-words",children:t.content}),e.jsxs("div",{className:b("absolute top-0 opacity-0 group-hover:opacity-100 transition-opacity flex items-center gap-1",s?"-left-20":"-right-20"),children:[e.jsx(L,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>o?.(t),children:e.jsx(h.Reply,{className:"h-3 w-3"})}),s&&n&&e.jsx(L,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>n(t.id),children:e.jsx(h.Trash2,{className:"h-3 w-3"})})]})]}),e.jsxs("div",{className:b("flex items-center gap-1 mt-1 text-xs text-muted-foreground",s&&"justify-end"),children:[r&&e.jsx("span",{children:i(t.timestamp)}),t.isEdited&&e.jsx("span",{children:"(modifié)"}),s&&a&&l()]})]})]})}function xj({onSend:t,replyTo:s,onCancelReply:a,showAttachments:r,showEmoji:n,placeholder:o,sending:i}){const[l,u]=c.useState(""),d=c.useRef(null),f=()=>{l.trim()&&!i&&(t(l.trim()),u(""))},m=p=>{p.key==="Enter"&&!p.shiftKey&&(p.preventDefault(),f())};return e.jsxs("div",{className:"border-t p-3",children:[s&&e.jsxs("div",{className:"flex items-center justify-between mb-2 p-2 bg-muted rounded text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.Reply,{className:"h-4 w-4 text-primary"}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium",children:s.sender.name}),e.jsx("p",{className:"text-muted-foreground truncate",children:s.content})]})]}),e.jsx(L,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:a,children:e.jsx(h.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[r&&e.jsx(L,{variant:"ghost",size:"icon",children:e.jsx(h.Paperclip,{className:"h-4 w-4"})}),e.jsx(oe,{ref:d,value:l,onChange:p=>u(p.target.value),onKeyDown:m,placeholder:o,className:"flex-1",disabled:i}),n&&e.jsx(L,{variant:"ghost",size:"icon",children:e.jsx(h.Smile,{className:"h-4 w-4"})}),e.jsx(L,{onClick:f,disabled:!l.trim()||i,children:e.jsx(h.Send,{className:"h-4 w-4"})})]})]})}function gj({conversations:t=[],activeConversation:s,messages:a,currentUser:r,onSendMessage:n,onConversationSelect:o,onMessageDelete:i,onMessageReply:l,onSearch:u,onAudioCall:d,onVideoCall:f,showConversationList:m=!0,showHeader:p=!0,showMessageStatus:w=!0,showTimestamps:C=!0,showAttachments:g=!0,showEmoji:y=!0,inputPlaceholder:j="Écrire un message...",sending:x=!1,loading:v=!1,layout:k="full",className:N}){const[D,P]=c.useState(null),R=c.useRef(null);c.useEffect(()=>{R.current?.scrollIntoView({behavior:"smooth"})},[a]);const A=(E,T)=>{n?.(E,T),P(null)},S=E=>{P(E),l?.(E)},M={full:"h-screen",embedded:"h-[600px]",floating:"h-[500px] w-[400px] rounded-lg shadow-xl"};return e.jsxs("div",{className:b("flex bg-background",M[k],N),children:[m&&e.jsx("div",{className:"w-80 flex-shrink-0",children:e.jsx(hj,{conversations:t,activeId:s?.id,currentUser:r,onSelect:E=>o?.(E),onSearch:u})}),e.jsx("div",{className:"flex-1 flex flex-col min-w-0",children:s?e.jsxs(e.Fragment,{children:[p&&e.jsx(fj,{conversation:s,currentUser:r,onAudioCall:d,onVideoCall:f}),e.jsx(At,{className:"flex-1 p-4",children:e.jsxs("div",{className:"space-y-4",children:[a.map(E=>e.jsx(pj,{message:E,isOwn:E.sender.id===r.id,showStatus:w,showTimestamp:C,onDelete:i,onReply:S},E.id)),e.jsx("div",{ref:R})]})}),e.jsx(xj,{onSend:A,replyTo:D,onCancelReply:()=>P(null),showAttachments:g,showEmoji:y,placeholder:j,sending:x})]}):e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Sélectionnez une conversation"})})]})}const Bs={id:"current",name:"Moi",status:"online"},bj=[{id:"1",participants:[Bs,{id:"2",name:"Marie Dupont",status:"online"}],lastMessage:{id:"m1",content:"D'accord, je m'en occupe !",sender:{id:"2",name:"Marie Dupont"},timestamp:new Date(Date.now()-1e3*60*5),status:"read"},unreadCount:0},{id:"2",participants:[Bs,{id:"3",name:"Pierre Martin",status:"offline"}],lastMessage:{id:"m2",content:"On se voit demain ?",sender:Bs,timestamp:new Date(Date.now()-1e3*60*60),status:"delivered"},unreadCount:2}],jj=[{id:"1",content:"Salut ! Comment ça va ?",sender:{id:"2",name:"Marie Dupont"},timestamp:new Date(Date.now()-1e3*60*30),status:"read"},{id:"2",content:"Ça va bien merci ! Et toi ?",sender:Bs,timestamp:new Date(Date.now()-1e3*60*25),status:"read"},{id:"3",content:"Super ! Tu as vu le nouveau projet ?",sender:{id:"2",name:"Marie Dupont"},timestamp:new Date(Date.now()-1e3*60*20),status:"read"}],ac={"no-data":{title:"Aucune donnée",description:"Il n'y a pas encore de données à afficher.",icon:h.Inbox,actionLabel:"Ajouter",actionIcon:h.Plus},"no-results":{title:"Aucun résultat",description:"Aucun élément ne correspond à votre recherche.",icon:h.Search,actionLabel:"Effacer les filtres",actionIcon:h.Filter},"no-messages":{title:"Aucun message",description:"Votre boîte de réception est vide.",icon:h.MessageSquare,actionLabel:"Nouveau message",actionIcon:h.Plus},"no-files":{title:"Aucun fichier",description:"Vous n'avez pas encore de fichiers.",icon:h.FolderOpen,actionLabel:"Importer un fichier",actionIcon:h.Upload},"no-users":{title:"Aucun utilisateur",description:"Il n'y a pas encore d'utilisateurs.",icon:h.Users,actionLabel:"Inviter des utilisateurs",actionIcon:h.Plus},"no-cart":{title:"Panier vide",description:"Votre panier est vide.",icon:h.ShoppingCart,actionLabel:"Parcourir les produits",actionIcon:h.ArrowRight},"no-notifications":{title:"Aucune notification",description:"Vous êtes à jour !",icon:h.Bell},"no-events":{title:"Aucun événement",description:"Aucun événement prévu.",icon:h.Calendar,actionLabel:"Créer un événement",actionIcon:h.Plus},"no-images":{title:"Aucune image",description:"Vous n'avez pas encore d'images.",icon:h.Image,actionLabel:"Importer des images",actionIcon:h.Upload},"no-bookmarks":{title:"Aucun favori",description:"Vous n'avez pas encore de favoris.",icon:h.Bookmark,actionLabel:"Parcourir",actionIcon:h.ArrowRight},"no-favorites":{title:"Aucun favori",description:"Vous n'avez pas encore aimé de contenu.",icon:h.Heart},error:{title:"Une erreur est survenue",description:"Impossible de charger les données.",icon:h.FileQuestion,actionLabel:"Réessayer",actionIcon:h.RefreshCw},custom:{title:"Aucun élément",description:"Il n'y a rien à afficher.",icon:h.Inbox}};function xo({type:t,size:s,className:a}){const n=ac[t].icon,i={sm:{container:"h-24 w-24",icon:"h-8 w-8",circles:{outer:"h-20 w-20",inner:"h-14 w-14"}},md:{container:"h-32 w-32",icon:"h-10 w-10",circles:{outer:"h-28 w-28",inner:"h-20 w-20"}},lg:{container:"h-40 w-40",icon:"h-12 w-12",circles:{outer:"h-36 w-36",inner:"h-28 w-28"}}}[s];return e.jsxs("div",{className:b("relative flex items-center justify-center",i.container,a),children:[e.jsx("div",{className:b("absolute rounded-full bg-muted/50",i.circles.outer)}),e.jsx("div",{className:b("absolute rounded-full bg-muted",i.circles.inner)}),e.jsx("div",{className:"relative z-10 flex items-center justify-center rounded-full bg-background p-4 shadow-sm",children:e.jsx(n,{className:b(i.icon,"text-muted-foreground")})}),e.jsx("div",{className:"absolute -right-1 top-2 h-2 w-2 rounded-full bg-primary/20"}),e.jsx("div",{className:"absolute -left-1 bottom-4 h-1.5 w-1.5 rounded-full bg-primary/30"}),e.jsx("div",{className:"absolute right-4 bottom-0 h-2.5 w-2.5 rounded-full bg-primary/10"})]})}function rs({type:t="no-data",title:s,description:a,icon:r,actions:n,illustration:o,showIllustration:i=!0,size:l="md",layout:u="vertical",centered:d=!0,children:f,className:m}){const p=ac[t],w=s??p.title,C=a??p.description;p.icon;const g={sm:{container:"py-8 px-4",title:"text-base",description:"text-sm",icon:"h-8 w-8"},md:{container:"py-12 px-6",title:"text-lg",description:"text-sm",icon:"h-10 w-10"},lg:{container:"py-16 px-8",title:"text-xl",description:"text-base",icon:"h-12 w-12"}},y=[];if(p.actionLabel&&!n){const x=p.actionIcon;y.push({label:p.actionLabel,variant:"default",icon:x?e.jsx(x,{className:"h-4 w-4"}):void 0})}const j=n||(y.length>0?y:void 0);return u==="horizontal"?e.jsxs("div",{className:b("flex items-center gap-6",g[l].container,d&&"justify-center",m),children:[i&&e.jsx("div",{className:"flex-shrink-0",children:o||(r?e.jsx("div",{className:"flex items-center justify-center rounded-full bg-muted p-4",children:r}):e.jsx(xo,{type:t,size:l}))}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("h3",{className:b("font-semibold",g[l].title),children:w}),e.jsx("p",{className:b("text-muted-foreground mt-1",g[l].description),children:C}),f&&e.jsx("div",{className:"mt-4",children:f}),j&&j.length>0&&e.jsx("div",{className:"flex gap-3 mt-4",children:j.map((x,v)=>e.jsx(L,{variant:x.variant||"default",size:"sm",onClick:x.onClick,asChild:!!x.href,children:x.href?e.jsxs("a",{href:x.href,children:[x.icon&&e.jsx("span",{className:"mr-2",children:x.icon}),x.label]}):e.jsxs(e.Fragment,{children:[x.icon&&e.jsx("span",{className:"mr-2",children:x.icon}),x.label]})},v))})]})]}):e.jsxs("div",{className:b("flex flex-col items-center",d&&"text-center",g[l].container,m),children:[i&&e.jsx("div",{className:"mb-6",children:o||(r?e.jsx("div",{className:"flex items-center justify-center rounded-full bg-muted p-6",children:c.cloneElement(r,{className:b(g[l].icon,"text-muted-foreground")})}):e.jsx(xo,{type:t,size:l}))}),e.jsx("h3",{className:b("font-semibold",g[l].title),children:w}),e.jsx("p",{className:b("text-muted-foreground mt-2 max-w-sm",g[l].description),children:C}),f&&e.jsx("div",{className:"mt-4",children:f}),j&&j.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3 mt-6 justify-center",children:j.map((x,v)=>e.jsx(L,{variant:x.variant||"default",onClick:x.onClick,asChild:!!x.href,children:x.href?e.jsxs("a",{href:x.href,children:[x.icon&&e.jsx("span",{className:"mr-2",children:x.icon}),x.label]}):e.jsxs(e.Fragment,{children:[x.icon&&e.jsx("span",{className:"mr-2",children:x.icon}),x.label]})},v))})]})}function vj(t){return e.jsx(rs,{type:"no-data",...t})}function wj(t){return e.jsx(rs,{type:"no-results",...t})}function yj(t){return e.jsx(rs,{type:"no-messages",...t})}function Nj(t){return e.jsx(rs,{type:"no-files",...t})}function Cj(t){return e.jsx(rs,{type:"no-cart",...t})}function kj(t){return e.jsx(rs,{type:"no-notifications",...t})}function Sj(t){return e.jsx(rs,{type:"error",...t})}const rc={404:{code:"404",title:"Page non trouvée",description:"Désolé, la page que vous recherchez n'existe pas ou a été déplacée.",icon:h.FileQuestion},500:{code:"500",title:"Erreur serveur",description:"Une erreur inattendue s'est produite. Notre équipe a été notifiée.",icon:h.ServerCrash},403:{code:"403",title:"Accès refusé",description:"Vous n'avez pas les permissions nécessaires pour accéder à cette page.",icon:h.ShieldX},503:{code:"503",title:"Service indisponible",description:"Le service est temporairement indisponible. Veuillez réessayer plus tard.",icon:h.ServerCrash},offline:{code:"Hors ligne",title:"Vous êtes hors ligne",description:"Vérifiez votre connexion internet et réessayez.",icon:h.Wifi},maintenance:{code:"Maintenance",title:"Maintenance en cours",description:"Nous effectuons une maintenance. Nous serons bientôt de retour.",icon:h.Construction},custom:{code:"",title:"Erreur",description:"Une erreur s'est produite.",icon:h.FileQuestion}};function go({type:t,className:s}){const r=rc[t].icon;return e.jsxs("div",{className:b("relative flex items-center justify-center",s),children:[e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"h-48 w-48 rounded-full bg-muted/50"})}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"h-32 w-32 rounded-full bg-muted"})}),e.jsx("div",{className:"relative z-10 flex h-20 w-20 items-center justify-center rounded-full bg-background shadow-lg",children:e.jsx(r,{className:"h-10 w-10 text-muted-foreground"})}),e.jsx("div",{className:"absolute -right-4 top-4 h-3 w-3 rounded-full bg-primary/20"}),e.jsx("div",{className:"absolute -left-2 bottom-8 h-2 w-2 rounded-full bg-primary/30"}),e.jsx("div",{className:"absolute right-8 bottom-2 h-4 w-4 rounded-full bg-primary/10"})]})}function Ms({type:t="404",code:s,title:a,description:r,actions:n,illustration:o,showCode:i=!0,showIllustration:l=!0,showBackButton:u=!0,onBack:d,showHomeButton:f=!0,homeUrl:m="/",showRefreshButton:p=!1,children:w,layout:C="centered",size:g="md",className:y}){const j=rc[t],x=s??j.code,v=a??j.title,k=r??j.description,N={sm:{container:"py-12 px-4",code:"text-6xl",title:"text-xl",description:"text-sm",illustration:"h-32 w-32"},md:{container:"py-16 px-6",code:"text-8xl",title:"text-2xl",description:"text-base",illustration:"h-48 w-48"},lg:{container:"py-24 px-8",code:"text-9xl",title:"text-3xl",description:"text-lg",illustration:"h-64 w-64"}},D=[];u&&D.push({label:"Retour",onClick:d||(()=>window.history.back()),variant:"outline",icon:e.jsx(h.ArrowLeft,{className:"h-4 w-4"})}),f&&D.push({label:"Accueil",href:m,variant:"default",icon:e.jsx(h.Home,{className:"h-4 w-4"})}),p&&D.push({label:"Réessayer",onClick:()=>window.location.reload(),variant:"secondary",icon:e.jsx(h.RefreshCw,{className:"h-4 w-4"})});const P=n||D,R=()=>e.jsxs("div",{className:"flex flex-col items-center text-center",children:[l&&e.jsx("div",{className:b("mb-8",N[g].illustration),children:o||e.jsx(go,{type:t})}),i&&x&&e.jsx("div",{className:b("font-bold text-muted-foreground/20 mb-4",N[g].code),children:x}),e.jsx("h1",{className:b("font-bold tracking-tight mb-4",N[g].title),children:v}),e.jsx("p",{className:b("text-muted-foreground max-w-md mb-8",N[g].description),children:k}),w&&e.jsx("div",{className:"mb-8",children:w}),P.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3 justify-center",children:P.map((A,S)=>e.jsx(L,{variant:A.variant||"default",onClick:A.onClick,asChild:!!A.href,children:A.href?e.jsxs("a",{href:A.href,children:[A.icon&&e.jsx("span",{className:"mr-2",children:A.icon}),A.label]}):e.jsxs(e.Fragment,{children:[A.icon&&e.jsx("span",{className:"mr-2",children:A.icon}),A.label]})},S))})]});return C==="split"?e.jsxs("div",{className:b("min-h-screen flex flex-col lg:flex-row",y),children:[e.jsx("div",{className:"flex-1 bg-muted/30 flex items-center justify-center p-8 lg:p-16",children:e.jsx("div",{className:N[g].illustration,children:o||e.jsx(go,{type:t})})}),e.jsx("div",{className:"flex-1 flex items-center justify-center p-8 lg:p-16",children:e.jsxs("div",{className:"max-w-md",children:[i&&x&&e.jsx("div",{className:b("font-bold text-primary mb-4",g==="sm"?"text-4xl":g==="md"?"text-5xl":"text-6xl"),children:x}),e.jsx("h1",{className:b("font-bold tracking-tight mb-4",N[g].title),children:v}),e.jsx("p",{className:b("text-muted-foreground mb-8",N[g].description),children:k}),w&&e.jsx("div",{className:"mb-8",children:w}),P.length>0&&e.jsx("div",{className:"flex flex-wrap gap-3",children:P.map((A,S)=>e.jsx(L,{variant:A.variant||"default",onClick:A.onClick,asChild:!!A.href,children:A.href?e.jsxs("a",{href:A.href,children:[A.icon&&e.jsx("span",{className:"mr-2",children:A.icon}),A.label]}):e.jsxs(e.Fragment,{children:[A.icon&&e.jsx("span",{className:"mr-2",children:A.icon}),A.label]})},S))})]})})]}):e.jsx("div",{className:b("min-h-screen flex items-center justify-center",N[g].container,y),children:R()})}function Dj(t){return e.jsx(Ms,{type:"404",...t})}function Tj(t){return e.jsx(Ms,{type:"500",showRefreshButton:!0,...t})}function Aj(t){return e.jsx(Ms,{type:"403",...t})}function Ej(t){return e.jsx(Ms,{type:"maintenance",showBackButton:!1,showHomeButton:!1,...t})}function Mj(t){return e.jsx(Ms,{type:"offline",showRefreshButton:!0,...t})}function Pj({value:t,onChange:s,placeholder:a}){return e.jsxs("div",{className:"relative",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{type:"text",placeholder:a,value:t,onChange:r=>s(r.target.value),className:"pl-10"})]})}function Rj({categories:t,activeCategory:s,onCategoryChange:a,itemCounts:r}){return e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>a(null),className:b("inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-colors",s===null?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),children:["Tous",e.jsx(Se,{variant:"secondary",className:"ml-1",children:Object.values(r).reduce((n,o)=>n+o,0)})]}),t.map(n=>e.jsxs("button",{type:"button",onClick:()=>a(n.id),className:b("inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium transition-colors",s===n.id?"bg-primary text-primary-foreground":"bg-muted hover:bg-muted/80"),children:[n.icon,n.name,e.jsx(Se,{variant:"secondary",className:"ml-1",children:r[n.id]||0})]},n.id))]})}function Fj({itemId:t,helpful:s=0,notHelpful:a=0,onFeedback:r}){const[n,o]=c.useState(null),i=l=>{n===null&&(o(l),r(t,l))};return e.jsxs("div",{className:"flex items-center gap-4 mt-4 pt-4 border-t",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Cette réponse vous a-t-elle aidé ?"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>i(!0),disabled:n!==null,className:b("inline-flex items-center gap-1 px-2 py-1 text-sm rounded transition-colors",n===!0?"bg-green-100 text-green-700":n===null?"hover:bg-muted":"opacity-50"),children:["👍 ",s+(n===!0?1:0)]}),e.jsxs("button",{type:"button",onClick:()=>i(!1),disabled:n!==null,className:b("inline-flex items-center gap-1 px-2 py-1 text-sm rounded transition-colors",n===!1?"bg-red-100 text-red-700":n===null?"hover:bg-muted":"opacity-50"),children:["👎 ",a+(n===!1?1:0)]})]})]})}function $j({items:t,categories:s=[],title:a="Questions fréquentes",description:r,showSearch:n=!0,searchPlaceholder:o="Rechercher une question...",showCategoryFilter:i=!0,activeCategory:l,onCategoryChange:u,allowMultiple:d=!1,defaultOpen:f=[],showFeedback:m=!1,onFeedback:p,layout:w="default",size:C="md",className:g}){const[y,j]=c.useState(""),[x,v]=c.useState(null),k=l??x,N=E=>{u?u(E):v(E)},D=c.useMemo(()=>t.filter(E=>{if(y){const T=y.toLowerCase();if(!(E.question.toLowerCase().includes(T)||typeof E.answer=="string"&&E.answer.toLowerCase().includes(T)||E.tags?.some(q=>q.toLowerCase().includes(T))))return!1}return!(k&&E.category!==k)}),[t,y,k]),P=c.useMemo(()=>{const E={};return t.forEach(T=>{T.category&&(E[T.category]=(E[T.category]||0)+1)}),E},[t]),R=c.useMemo(()=>{if(w!=="grouped")return null;const E={};return D.forEach(T=>{const K=T.category||"other";E[K]||(E[K]=[]),E[K].push(T)}),E},[D,w]),A={sm:{title:"text-xl",question:"text-sm",answer:"text-sm"},md:{title:"text-2xl",question:"text-base",answer:"text-sm"},lg:{title:"text-3xl",question:"text-lg",answer:"text-base"}},S=E=>e.jsx(e.Fragment,{children:E.map(T=>e.jsxs(pr,{value:T.id,className:b(w==="cards"&&"border rounded-lg px-4 bg-card"),children:[e.jsx(xr,{className:b("hover:no-underline",A[C].question),children:e.jsx("span",{className:"text-left",children:T.question})}),e.jsxs(gr,{children:[e.jsx("div",{className:b("text-muted-foreground",A[C].answer),children:typeof T.answer=="string"?e.jsx("p",{children:T.answer}):T.answer}),T.tags&&T.tags.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1 mt-3",children:T.tags.map(K=>e.jsx(Se,{variant:"outline",className:"text-xs",children:K},K))}),m&&p&&e.jsx(Fj,{itemId:T.id,helpful:T.helpful,notHelpful:T.notHelpful,onFeedback:p})]})]},T.id))}),M=E=>d?e.jsx(lr,{type:"multiple",defaultValue:f,className:"space-y-2",children:S(E)}):e.jsx(lr,{type:"single",defaultValue:f[0],collapsible:!0,className:"space-y-2",children:S(E)});return e.jsxs("div",{className:b("space-y-6",g),children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:b("font-bold tracking-tight",A[C].title),children:a}),r&&e.jsx("p",{className:"text-muted-foreground mt-2 max-w-2xl mx-auto",children:r})]}),n&&e.jsx("div",{className:"max-w-md mx-auto",children:e.jsx(Pj,{value:y,onChange:j,placeholder:o})}),i&&s.length>0&&e.jsx("div",{className:"flex justify-center",children:e.jsx(Rj,{categories:s,activeCategory:k,onCategoryChange:N,itemCounts:P})}),D.length===0?e.jsxs("div",{className:"text-center py-12",children:[e.jsx(h.HelpCircle,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:"Aucune question ne correspond à votre recherche."})]}):w==="grouped"&&R?e.jsx("div",{className:"space-y-8",children:Object.entries(R).map(([E,T])=>{const K=s.find(q=>q.id===E);return e.jsxs("div",{children:[e.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[K?.icon,K?.name||E]}),M(T)]},E)})}):e.jsx("div",{className:"max-w-3xl mx-auto",children:M(D)})]})}const Lj=[{id:"general",name:"Général",icon:e.jsx(h.HelpCircle,{className:"h-4 w-4"})},{id:"billing",name:"Facturation",icon:e.jsx(h.MessageCircle,{className:"h-4 w-4"})},{id:"technical",name:"Technique",icon:e.jsx(h.MessageCircle,{className:"h-4 w-4"})}],Ij=[{id:"1",question:"Comment créer un compte ?",answer:"Pour créer un compte, cliquez sur le bouton 'S'inscrire' en haut à droite de la page, puis remplissez le formulaire avec vos informations personnelles.",category:"general",tags:["compte","inscription"]},{id:"2",question:"Comment réinitialiser mon mot de passe ?",answer:"Cliquez sur 'Mot de passe oublié' sur la page de connexion, entrez votre email et suivez les instructions envoyées par email.",category:"general",tags:["mot de passe","sécurité"]},{id:"3",question:"Quels moyens de paiement acceptez-vous ?",answer:"Nous acceptons les cartes de crédit (Visa, Mastercard, Amex), PayPal et les virements bancaires pour les entreprises.",category:"billing",tags:["paiement","carte"]},{id:"4",question:"Comment annuler mon abonnement ?",answer:"Vous pouvez annuler votre abonnement à tout moment depuis les paramètres de votre compte, section 'Abonnement'.",category:"billing",tags:["abonnement","annulation"]},{id:"5",question:"L'API est-elle disponible ?",answer:"Oui, notre API REST est disponible pour tous les plans payants. Consultez notre documentation développeur pour plus d'informations.",category:"technical",tags:["API","développeur"]}],Oj={folder:{icon:h.Folder,color:"text-yellow-500"},document:{icon:h.FileText,color:"text-blue-500"},image:{icon:h.FileImage,color:"text-green-500"},video:{icon:h.FileVideo,color:"text-purple-500"},audio:{icon:h.FileAudio,color:"text-pink-500"},archive:{icon:h.FileArchive,color:"text-orange-500"},code:{icon:h.FileCode,color:"text-cyan-500"},other:{icon:h.File,color:"text-gray-500"}};function bo(t){if(!t)return"-";const s=["B","KB","MB","GB","TB"];let a=0,r=t;for(;r>=1024&&a<s.length-1;)r/=1024,a++;return`${r.toFixed(1)} ${s[a]}`}function zj({breadcrumbs:t,viewMode:s,onViewModeChange:a,onNavigate:r,onCreateFolder:n,onUpload:o,onRefresh:i,showSearch:l,onSearch:u,selectedCount:d,onDeleteSelected:f,onDownloadSelected:m}){const[p,w]=c.useState("");return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[i&&e.jsx(L,{variant:"outline",size:"icon",onClick:i,children:e.jsx(h.RefreshCw,{className:"h-4 w-4"})}),o&&e.jsxs(L,{variant:"outline",onClick:o,children:[e.jsx(h.Upload,{className:"h-4 w-4 mr-2"}),"Importer"]}),n&&e.jsxs(L,{variant:"outline",onClick:n,children:[e.jsx(h.FolderPlus,{className:"h-4 w-4 mr-2"}),"Nouveau dossier"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[l&&u&&e.jsxs("div",{className:"relative w-64",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{placeholder:"Rechercher...",value:p,onChange:C=>{w(C.target.value),u(C.target.value)},className:"pl-9"})]}),e.jsx(L,{variant:s==="grid"?"secondary":"ghost",size:"icon",onClick:()=>a("grid"),children:e.jsx(h.Grid,{className:"h-4 w-4"})}),e.jsx(L,{variant:s==="list"?"secondary":"ghost",size:"icon",onClick:()=>a("list"),children:e.jsx(h.List,{className:"h-4 w-4"})})]})]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[e.jsx("button",{onClick:()=>r("/"),className:"flex items-center gap-1 hover:text-primary",children:e.jsx(h.Home,{className:"h-4 w-4"})}),t.map((C,g)=>e.jsxs(c.Fragment,{children:[e.jsx(h.ChevronRight,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("button",{onClick:()=>r(C.path),className:b("hover:text-primary",g===t.length-1&&"font-medium"),children:C.name})]},C.id))]}),d>0&&e.jsxs("div",{className:"flex items-center gap-4 p-3 bg-muted rounded-lg",children:[e.jsxs("span",{className:"text-sm font-medium",children:[d," élément(s) sélectionné(s)"]}),m&&e.jsxs(L,{variant:"outline",size:"sm",onClick:m,children:[e.jsx(h.Download,{className:"h-4 w-4 mr-2"}),"Télécharger"]}),f&&e.jsxs(L,{variant:"destructive",size:"sm",onClick:f,children:[e.jsx(h.Trash2,{className:"h-4 w-4 mr-2"}),"Supprimer"]})]})]})}function jo({file:t,viewMode:s,isSelected:a,onSelect:r,onOpen:n,onRename:o,onDelete:i,onDownload:l,onShare:u,onToggleStar:d}){const f=Oj[t.type],m=f.icon,p=typeof t.modifiedAt=="string"?new Date(t.modifiedAt):t.modifiedAt,w=()=>{t.type==="folder"&&n()};return s==="grid"?e.jsxs("div",{className:b("relative group p-4 rounded-lg border cursor-pointer transition-colors",a?"bg-primary/10 border-primary":"hover:bg-muted"),onClick:()=>r(!a),onDoubleClick:w,children:[e.jsx("div",{className:"absolute top-2 left-2 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(Ze,{checked:a,onCheckedChange:C=>r(C),onClick:C=>C.stopPropagation()})}),t.starred&&e.jsx(h.Star,{className:"absolute top-2 right-2 h-4 w-4 text-yellow-500 fill-yellow-500"}),e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[t.thumbnail&&t.type==="image"?e.jsx("img",{src:t.thumbnail,alt:t.name,className:"w-16 h-16 object-cover rounded"}):e.jsx(m,{className:b("h-12 w-12",f.color)}),e.jsx("span",{className:"text-sm font-medium text-center line-clamp-2",children:t.name}),t.type!=="folder"&&e.jsx("span",{className:"text-xs text-muted-foreground",children:bo(t.size)})]}),e.jsx("div",{className:"absolute top-2 right-2 opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,onClick:C=>C.stopPropagation(),children:e.jsx(L,{variant:"ghost",size:"icon",className:"h-7 w-7",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(_e,{align:"end",children:[e.jsxs(pe,{onClick:n,children:[e.jsx(h.Eye,{className:"mr-2 h-4 w-4"}),"Ouvrir"]}),o&&e.jsxs(pe,{onClick:o,children:[e.jsx(h.Edit,{className:"mr-2 h-4 w-4"}),"Renommer"]}),l&&t.type!=="folder"&&e.jsxs(pe,{onClick:l,children:[e.jsx(h.Download,{className:"mr-2 h-4 w-4"}),"Télécharger"]}),u&&e.jsxs(pe,{onClick:u,children:[e.jsx(h.Share2,{className:"mr-2 h-4 w-4"}),"Partager"]}),d&&e.jsx(pe,{onClick:d,children:t.starred?e.jsxs(e.Fragment,{children:[e.jsx(h.StarOff,{className:"mr-2 h-4 w-4"}),"Retirer des favoris"]}):e.jsxs(e.Fragment,{children:[e.jsx(h.Star,{className:"mr-2 h-4 w-4"}),"Ajouter aux favoris"]})}),i&&e.jsxs(e.Fragment,{children:[e.jsx(Qe,{}),e.jsxs(pe,{onClick:i,className:"text-destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]})})]}):e.jsxs(qt,{className:b("cursor-pointer",a&&"bg-primary/10"),onClick:()=>r(!a),onDoubleClick:w,children:[e.jsx(tt,{className:"w-12",children:e.jsx(Ze,{checked:a,onCheckedChange:C=>r(C),onClick:C=>C.stopPropagation()})}),e.jsx(tt,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(m,{className:b("h-5 w-5",f.color)}),e.jsx("span",{className:"font-medium",children:t.name}),t.starred&&e.jsx(h.Star,{className:"h-4 w-4 text-yellow-500 fill-yellow-500"}),t.shared&&e.jsx(Se,{variant:"secondary",className:"text-xs",children:"Partagé"})]})}),e.jsx(tt,{className:"text-muted-foreground",children:bo(t.size)}),e.jsx(tt,{className:"text-muted-foreground",children:p.toLocaleDateString("fr-FR")}),e.jsx(tt,{children:e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,onClick:C=>C.stopPropagation(),children:e.jsx(L,{variant:"ghost",size:"icon",className:"h-8 w-8",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(_e,{align:"end",children:[e.jsxs(pe,{onClick:n,children:[e.jsx(h.Eye,{className:"mr-2 h-4 w-4"}),"Ouvrir"]}),o&&e.jsxs(pe,{onClick:o,children:[e.jsx(h.Edit,{className:"mr-2 h-4 w-4"}),"Renommer"]}),l&&t.type!=="folder"&&e.jsxs(pe,{onClick:l,children:[e.jsx(h.Download,{className:"mr-2 h-4 w-4"}),"Télécharger"]}),i&&e.jsxs(e.Fragment,{children:[e.jsx(Qe,{}),e.jsxs(pe,{onClick:i,className:"text-destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]})})]})}function _j({files:t,currentPath:s="/",breadcrumbs:a=[],selectedFiles:r=[],onSelectionChange:n,onNavigate:o,onFileOpen:i,onDownload:l,onDelete:u,onRename:d,onCopy:f,onMove:m,onCreateFolder:p,onUpload:w,onShare:C,onToggleStar:g,onRefresh:y,viewMode:j,onViewModeChange:x,showSearch:v=!0,onSearch:k,showHeader:N=!0,showActions:D=!0,loading:P=!1,className:R}){const[A,S]=c.useState("grid"),[M,E]=c.useState(!1),[T,K]=c.useState(null),[q,B]=c.useState(""),[W,I]=c.useState(!1),[z,$]=c.useState([]),[_,F]=c.useState(!1),[H,J]=c.useState(""),Q=j??A,ne=se=>{x?x(se):S(se)},X=(se,de)=>{n?.(de?[...r,se]:r.filter(De=>De!==se))},Y=se=>{se.type==="folder"?o?.(se.path,se.id):i?.(se)},U=se=>{K(se),B(se.name),E(!0)},ae=()=>{T&&q.trim()&&q!==T.name&&d?.(T.id,q.trim()),E(!1),K(null)},te=()=>{$(r),I(!0)},Z=()=>{u?.(z),I(!1),$([]),n?.([])},le=()=>{H.trim()&&(p?.(H.trim(),s),F(!1),J(""))},xe=[...t].sort((se,de)=>se.type==="folder"&&de.type!=="folder"?-1:se.type!=="folder"&&de.type==="folder"?1:se.name.localeCompare(de.name));return e.jsxs("div",{className:b("space-y-4",R),children:[N&&e.jsx(zj,{breadcrumbs:a,viewMode:Q,onViewModeChange:ne,onNavigate:se=>o?.(se),onCreateFolder:p?()=>F(!0):void 0,onUpload:w?()=>{}:void 0,onRefresh:y,showSearch:v,onSearch:k,selectedCount:r.length,onDeleteSelected:u?te:void 0,onDownloadSelected:l?()=>l(r):void 0}),P?e.jsx("div",{className:"flex items-center justify-center py-12",children:e.jsx(h.RefreshCw,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):xe.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[e.jsx(h.Folder,{className:"h-12 w-12 mb-4"}),e.jsx("p",{children:"Ce dossier est vide"})]}):Q==="grid"?e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-6 gap-4",children:xe.map(se=>e.jsx(jo,{file:se,viewMode:"grid",isSelected:r.includes(se.id),onSelect:de=>X(se.id,de),onOpen:()=>Y(se),onRename:d?()=>U(se):void 0,onDelete:u?()=>{$([se.id]),I(!0)}:void 0,onDownload:l?()=>l([se.id]):void 0,onShare:C?()=>C(se.id):void 0,onToggleStar:g?()=>g(se.id):void 0},se.id))}):e.jsxs(Fa,{children:[e.jsx($a,{children:e.jsxs(qt,{children:[e.jsx(ct,{className:"w-12",children:e.jsx(Ze,{checked:r.length===t.length&&t.length>0,onCheckedChange:se=>{n?.(se?t.map(de=>de.id):[])}})}),e.jsx(ct,{children:"Nom"}),e.jsx(ct,{children:"Taille"}),e.jsx(ct,{children:"Modifié"}),e.jsx(ct,{className:"w-12"})]})}),e.jsx(La,{children:xe.map(se=>e.jsx(jo,{file:se,viewMode:"list",isSelected:r.includes(se.id),onSelect:de=>X(se.id,de),onOpen:()=>Y(se),onRename:d?()=>U(se):void 0,onDelete:u?()=>{$([se.id]),I(!0)}:void 0,onDownload:l?()=>l([se.id]):void 0,onShare:C?()=>C(se.id):void 0,onToggleStar:g?()=>g(se.id):void 0},se.id))})]}),e.jsx(It,{open:M,onOpenChange:E,children:e.jsxs(Tt,{children:[e.jsx(Ht,{children:e.jsx(Xt,{children:"Renommer"})}),e.jsx(oe,{value:q,onChange:se=>B(se.target.value),placeholder:"Nouveau nom",onKeyDown:se=>se.key==="Enter"&&ae()}),e.jsxs(Gt,{children:[e.jsx(L,{variant:"outline",onClick:()=>E(!1),children:"Annuler"}),e.jsx(L,{onClick:ae,children:"Renommer"})]})]})}),e.jsx(fs,{open:W,onOpenChange:I,children:e.jsxs(Kt,{children:[e.jsxs(Yt,{children:[e.jsx(Qt,{children:"Supprimer ?"}),e.jsxs(Zt,{children:["Êtes-vous sûr de vouloir supprimer ",z.length," élément(s) ? Cette action est irréversible."]})]}),e.jsxs(Jt,{children:[e.jsx(ts,{children:"Annuler"}),e.jsx(es,{onClick:Z,children:"Supprimer"})]})]})}),e.jsx(It,{open:_,onOpenChange:F,children:e.jsxs(Tt,{children:[e.jsx(Ht,{children:e.jsx(Xt,{children:"Nouveau dossier"})}),e.jsx(oe,{value:H,onChange:se=>J(se.target.value),placeholder:"Nom du dossier",onKeyDown:se=>se.key==="Enter"&&le()}),e.jsxs(Gt,{children:[e.jsx(L,{variant:"outline",onClick:()=>F(!1),children:"Annuler"}),e.jsx(L,{onClick:le,children:"Créer"})]})]})})]})}const Vj=[{id:"1",name:"Documents",type:"folder",path:"/Documents",createdAt:new Date("2024-01-01"),modifiedAt:new Date("2024-01-15")},{id:"2",name:"Images",type:"folder",path:"/Images",createdAt:new Date("2024-01-01"),modifiedAt:new Date("2024-01-10"),starred:!0},{id:"3",name:"Rapport Q4.pdf",type:"document",path:"/Rapport Q4.pdf",size:2456e3,createdAt:new Date("2024-01-05"),modifiedAt:new Date("2024-01-05")},{id:"4",name:"Photo vacances.jpg",type:"image",path:"/Photo vacances.jpg",size:567e4,createdAt:new Date("2024-01-08"),modifiedAt:new Date("2024-01-08")},{id:"5",name:"Présentation.pptx",type:"document",path:"/Présentation.pptx",size:89e5,createdAt:new Date("2024-01-12"),modifiedAt:new Date("2024-01-14"),shared:!0}],Wj=[{id:"root",name:"Mes fichiers",path:"/"}],vo={low:{label:"Basse",color:"bg-gray-500",icon:h.Clock},medium:{label:"Moyenne",color:"bg-blue-500",icon:h.Clock},high:{label:"Haute",color:"bg-orange-500",icon:h.AlertCircle},urgent:{label:"Urgente",color:"bg-red-500",icon:h.AlertCircle}};function Uj({card:t,columnId:s,showAssignees:a,showLabels:r,showPriority:n,showDueDate:o,draggable:i,onCardClick:l,onCardEdit:u,onCardDelete:d,onDragStart:f}){const m=c.useMemo(()=>t.dueDate?(typeof t.dueDate=="string"?new Date(t.dueDate):t.dueDate)<new Date:!1,[t.dueDate]),p=w=>(typeof w=="string"?new Date(w):w).toLocaleDateString("fr-FR",{day:"numeric",month:"short"});return e.jsx(ke,{className:b("cursor-pointer hover:shadow-md transition-shadow",i&&"cursor-grab active:cursor-grabbing"),draggable:i,onDragStart:w=>f?.(w,t.id,s),onClick:()=>l?.(t,s),children:e.jsxs(Te,{className:"p-3 space-y-2",children:[r&&t.labels&&t.labels.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1",children:t.labels.map(w=>e.jsx("div",{className:"h-1.5 w-8 rounded-full",style:{backgroundColor:w.color},title:w.name},w.id))}),e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsx("h4",{className:"text-sm font-medium leading-tight",children:t.title}),e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,onClick:w=>w.stopPropagation(),children:e.jsx(L,{variant:"ghost",size:"icon",className:"h-6 w-6 flex-shrink-0",children:e.jsx(h.MoreHorizontal,{className:"h-3 w-3"})})}),e.jsxs(_e,{align:"end",children:[e.jsxs(pe,{onClick:w=>{w.stopPropagation(),l?.(t,s)},children:[e.jsx(h.Edit,{className:"mr-2 h-4 w-4"}),"Modifier"]}),e.jsx(Qe,{}),e.jsxs(pe,{onClick:w=>{w.stopPropagation(),d?.(t.id,s)},className:"text-destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]}),t.description&&e.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:t.description}),e.jsxs("div",{className:"flex items-center justify-between pt-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[n&&t.priority&&e.jsx("div",{className:b("h-2 w-2 rounded-full",vo[t.priority].color),title:vo[t.priority].label}),o&&t.dueDate&&e.jsxs(Se,{variant:m?"destructive":"outline",className:"text-xs px-1.5 py-0",children:[e.jsx(h.Calendar,{className:"h-3 w-3 mr-1"}),p(t.dueDate)]})]}),a&&t.assignees&&t.assignees.length>0&&e.jsxs("div",{className:"flex -space-x-1",children:[t.assignees.slice(0,3).map(w=>e.jsxs(yt,{className:"h-5 w-5 border-2 border-background",children:[e.jsx(Nt,{src:w.avatar}),e.jsx(Ct,{className:"text-[8px]",children:w.name.charAt(0)})]},w.id)),t.assignees.length>3&&e.jsxs("div",{className:"h-5 w-5 rounded-full bg-muted flex items-center justify-center text-[8px] border-2 border-background",children:["+",t.assignees.length-3]})]})]})]})})}function Bj({column:t,showCardCount:s,showAddCard:a,showAssignees:r,showLabels:n,showPriority:o,showDueDate:i,draggable:l,onCardClick:u,onCardAdd:d,onCardEdit:f,onCardDelete:m,onColumnEdit:p,onColumnDelete:w,onDragStart:C,onDragOver:g,onDrop:y}){const[j,x]=c.useState(!1),[v,k]=c.useState(""),[N,D]=c.useState(!1),[P,R]=c.useState(t.title),A=()=>{v.trim()&&(d?.(t.id,{title:v.trim()}),k(""),x(!1))},S=()=>{P.trim()&&P!==t.title&&p?.(t.id,{title:P.trim()}),D(!1)},M=t.limit&&t.cards.length>=t.limit;return e.jsxs("div",{className:"flex flex-col w-72 flex-shrink-0 bg-muted/50 rounded-lg",onDragOver:g,onDrop:E=>y?.(E,t.id),children:[e.jsxs("div",{className:"flex items-center justify-between p-3 border-b",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[t.color&&e.jsx("div",{className:"h-3 w-3 rounded-full",style:{backgroundColor:t.color}}),N?e.jsx("div",{className:"flex items-center gap-1",children:e.jsx(oe,{value:P,onChange:E=>R(E.target.value),className:"h-7 text-sm font-semibold",autoFocus:!0,onBlur:S,onKeyDown:E=>{E.key==="Enter"&&S(),E.key==="Escape"&&D(!1)}})}):e.jsx("h3",{className:"font-semibold text-sm cursor-pointer",onClick:()=>D(!0),children:t.title}),s&&e.jsxs(Se,{variant:"secondary",className:"text-xs",children:[t.cards.length,t.limit&&`/${t.limit}`]})]}),e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx(L,{variant:"ghost",size:"icon",className:"h-7 w-7",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(_e,{align:"end",children:[e.jsxs(pe,{onClick:()=>D(!0),children:[e.jsx(h.Edit,{className:"mr-2 h-4 w-4"}),"Renommer"]}),e.jsx(Qe,{}),e.jsxs(pe,{onClick:()=>w?.(t.id),className:"text-destructive",children:[e.jsx(h.Trash2,{className:"mr-2 h-4 w-4"}),"Supprimer"]})]})]})]}),e.jsxs("div",{className:"flex-1 p-2 space-y-2 min-h-[200px] overflow-y-auto",children:[t.cards.map(E=>e.jsx(Uj,{card:E,columnId:t.id,showAssignees:r,showLabels:n,showPriority:o,showDueDate:i,draggable:l,onCardClick:u,onCardEdit:f,onCardDelete:m,onDragStart:C},E.id)),j&&e.jsxs(ke,{className:"p-2",children:[e.jsx(ft,{placeholder:"Titre de la carte...",value:v,onChange:E=>k(E.target.value),className:"min-h-[60px] text-sm",autoFocus:!0}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(L,{size:"sm",onClick:A,children:"Ajouter"}),e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>{x(!1),k("")},children:e.jsx(h.X,{className:"h-4 w-4"})})]})]})]}),a&&!j&&!M&&e.jsx("div",{className:"p-2 border-t",children:e.jsxs(L,{variant:"ghost",size:"sm",className:"w-full justify-start",onClick:()=>x(!0),children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-2"}),"Ajouter une carte"]})}),M&&e.jsx("div",{className:"p-2 border-t text-center text-xs text-muted-foreground",children:"Limite atteinte"})]})}function qj({columns:t,onColumnsChange:s,onCardClick:a,onCardAdd:r,onCardEdit:n,onCardDelete:o,onCardMove:i,onColumnAdd:l,onColumnEdit:u,onColumnDelete:d,showAddCard:f=!0,showAddColumn:m=!0,showCardCount:p=!0,showAssignees:w=!0,showLabels:C=!0,showPriority:g=!0,showDueDate:y=!0,draggable:j=!0,availableLabels:x=[],availableAssignees:v=[],className:k}){const[N,D]=c.useState(t),[P,R]=c.useState(null),[A,S]=c.useState(!1),[M,E]=c.useState("");c.useEffect(()=>{D(t)},[t]);const T=($,_,F)=>{R({cardId:_,columnId:F}),$.dataTransfer.effectAllowed="move"},K=$=>{$.preventDefault(),$.dataTransfer.dropEffect="move"},q=($,_)=>{if($.preventDefault(),!P)return;const{cardId:F,columnId:H}=P;if(H===_){R(null);return}if(i)i(F,H,_,0);else{const J=N.map(Q=>{if(Q.id===H)return{...Q,cards:Q.cards.filter(ne=>ne.id!==F)};if(Q.id===_){const ne=N.find(X=>X.id===H)?.cards.find(X=>X.id===F);if(ne)return{...Q,cards:[...Q.cards,ne]}}return Q});D(J),s?.(J)}R(null)},B=($,_)=>{if(r)r($,_);else{const F={id:`card-${Date.now()}`,title:_.title||"Nouvelle carte",..._},H=N.map(J=>J.id===$?{...J,cards:[...J.cards,F]}:J);D(H),s?.(H)}},W=($,_)=>{if(o)o($,_);else{const F=N.map(H=>H.id===_?{...H,cards:H.cards.filter(J=>J.id!==$)}:H);D(F),s?.(F)}},I=$=>{if(d)d($);else{const _=N.filter(F=>F.id!==$);D(_),s?.(_)}},z=()=>{if(M.trim()){const $={id:`column-${Date.now()}`,title:M.trim(),cards:[]};if(l)l($);else{const _=[...N,$];D(_),s?.(_)}E(""),S(!1)}};return e.jsx("div",{className:b("overflow-x-auto",k),children:e.jsxs("div",{className:"flex gap-4 p-4 min-h-[500px]",children:[N.map($=>e.jsx(Bj,{column:$,showCardCount:p,showAddCard:f,showAssignees:w,showLabels:C,showPriority:g,showDueDate:y,draggable:j,onCardClick:a,onCardAdd:B,onCardEdit:n,onCardDelete:W,onColumnEdit:u,onColumnDelete:I,onDragStart:T,onDragOver:K,onDrop:q},$.id)),m&&e.jsx("div",{className:"w-72 flex-shrink-0",children:A?e.jsxs(ke,{className:"p-3",children:[e.jsx(oe,{placeholder:"Titre de la colonne...",value:M,onChange:$=>E($.target.value),autoFocus:!0,onKeyDown:$=>{$.key==="Enter"&&z(),$.key==="Escape"&&S(!1)}}),e.jsxs("div",{className:"flex gap-2 mt-2",children:[e.jsx(L,{size:"sm",onClick:z,children:"Ajouter"}),e.jsx(L,{size:"sm",variant:"ghost",onClick:()=>{S(!1),E("")},children:e.jsx(h.X,{className:"h-4 w-4"})})]})]}):e.jsxs(L,{variant:"outline",className:"w-full justify-start h-12",onClick:()=>S(!0),children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-2"}),"Ajouter une colonne"]})})]})})}const Hj=[{id:"todo",title:"À faire",color:"#6b7280",cards:[{id:"1",title:"Implémenter l'authentification",description:"Ajouter le login/logout avec JWT",priority:"high",labels:[{id:"dev",name:"Dev",color:"#3b82f6"}],assignees:[{id:"1",name:"Marie D."}]},{id:"2",title:"Créer les maquettes",priority:"medium",labels:[{id:"design",name:"Design",color:"#8b5cf6"}]}]},{id:"in-progress",title:"En cours",color:"#3b82f6",limit:3,cards:[{id:"3",title:"Refactoring du dashboard",priority:"medium",assignees:[{id:"2",name:"Pierre M."}],dueDate:new Date(Date.now()+1e3*60*60*24*2)}]},{id:"review",title:"En revue",color:"#f59e0b",cards:[]},{id:"done",title:"Terminé",color:"#10b981",cards:[{id:"4",title:"Setup du projet",priority:"low"}]}],Gj=[{id:"dev",name:"Dev",color:"#3b82f6"},{id:"design",name:"Design",color:"#8b5cf6"},{id:"bug",name:"Bug",color:"#ef4444"},{id:"feature",name:"Feature",color:"#10b981"}];function Xj({logo:t,brandName:s="Brand",navItems:a=[],showLoginButton:r=!0,loginButtonText:n="Se connecter",onLogin:o,loginHref:i}){const[l,u]=c.useState(!1);return e.jsxs("nav",{className:"sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[e.jsxs("div",{className:"container flex h-16 items-center justify-between",children:[e.jsxs("a",{href:"/",className:"flex items-center gap-2 font-bold text-xl",children:[t,e.jsx("span",{children:s})]}),e.jsx("div",{className:"hidden md:flex items-center gap-6",children:a.map(d=>e.jsx("a",{href:d.href,className:b("text-sm font-medium transition-colors hover:text-primary",d.isActive?"text-primary":"text-muted-foreground"),children:d.label},d.href))}),e.jsx("div",{className:"hidden md:flex items-center gap-4",children:r&&e.jsx(L,{variant:"default",onClick:o,asChild:!!i,children:i?e.jsx("a",{href:i,children:n}):n})}),e.jsx(L,{variant:"ghost",size:"icon",className:"md:hidden",onClick:()=>u(!l),children:l?e.jsx(h.X,{className:"h-5 w-5"}):e.jsx(h.Menu,{className:"h-5 w-5"})})]}),l&&e.jsx("div",{className:"md:hidden border-t bg-background p-4",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[a.map(d=>e.jsx("a",{href:d.href,className:"text-sm font-medium",onClick:()=>u(!1),children:d.label},d.href)),r&&e.jsx(L,{onClick:o,asChild:!!i,children:i?e.jsx("a",{href:i,children:n}):n})]})})]})}function Kj({badge:t,title:s,highlightedTitle:a,description:r,primaryButtonText:n="Commencer",primaryButtonAction:o,primaryButtonHref:i,secondaryButtonText:l,secondaryButtonAction:u,secondaryButtonHref:d,image:f,stats:m}){return e.jsx("section",{className:"container py-24 md:py-32",children:e.jsxs("div",{className:"flex flex-col lg:flex-row items-center gap-12",children:[e.jsxs("div",{className:"flex-1 text-center lg:text-left",children:[t&&e.jsx(Se,{variant:"secondary",className:"mb-4",children:t}),e.jsxs("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold tracking-tight mb-6",children:[s," ",a&&e.jsx("span",{className:"text-primary",children:a})]}),e.jsx("p",{className:"text-lg md:text-xl text-muted-foreground mb-8 max-w-2xl lg:max-w-none",children:r}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center lg:justify-start mb-8",children:[e.jsx(L,{size:"lg",onClick:o,asChild:!!i,children:i?e.jsxs("a",{href:i,children:[n,e.jsx(h.ArrowRight,{className:"ml-2 h-4 w-4"})]}):e.jsxs(e.Fragment,{children:[n,e.jsx(h.ArrowRight,{className:"ml-2 h-4 w-4"})]})}),l&&e.jsx(L,{size:"lg",variant:"outline",onClick:u,asChild:!!d,children:d?e.jsxs("a",{href:d,children:[e.jsx(h.Play,{className:"mr-2 h-4 w-4"}),l]}):e.jsxs(e.Fragment,{children:[e.jsx(h.Play,{className:"mr-2 h-4 w-4"}),l]})})]}),m&&m.length>0&&e.jsx("div",{className:"flex gap-8 justify-center lg:justify-start",children:m.map((p,w)=>e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl md:text-3xl font-bold",children:p.value}),e.jsx("div",{className:"text-sm text-muted-foreground",children:p.label})]},w))})]}),f&&e.jsx("div",{className:"flex-1 w-full lg:w-auto",children:f})]})})}function Yj({title:t="Fonctionnalités",description:s,features:a}){return e.jsxs("section",{className:"container py-24 bg-muted/30",children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold tracking-tight mb-4",children:t}),s&&e.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:s})]}),e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:a.map(r=>e.jsxs(ke,{className:"bg-background",children:[e.jsxs(qe,{children:[e.jsx("div",{className:"h-12 w-12 rounded-lg bg-primary/10 flex items-center justify-center mb-4",children:e.jsx("span",{className:"text-primary",children:r.icon})}),e.jsx(Oe,{className:"text-xl",children:r.title})]}),e.jsx(Te,{children:e.jsx(ot,{className:"text-base",children:r.description})})]},r.id))})]})}function Jj({title:t="Ce que disent nos clients",testimonials:s}){return e.jsxs("section",{className:"container py-24",children:[e.jsx("h2",{className:"text-3xl md:text-4xl font-bold tracking-tight text-center mb-12",children:t}),e.jsx("div",{className:"grid md:grid-cols-2 lg:grid-cols-3 gap-6",children:s.map(a=>e.jsx(ke,{children:e.jsxs(Te,{className:"pt-6",children:[a.rating&&e.jsx("div",{className:"flex gap-1 mb-4",children:Array.from({length:5}).map((r,n)=>e.jsx(h.Star,{className:b("h-4 w-4",n<a.rating?"text-yellow-400 fill-yellow-400":"text-muted-foreground")},n))}),e.jsxs("p",{className:"text-muted-foreground mb-6",children:['"',a.content,'"']}),e.jsxs("div",{className:"flex items-center gap-3",children:[a.avatar?e.jsx("img",{src:a.avatar,alt:a.author,className:"h-10 w-10 rounded-full object-cover"}):e.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:e.jsx("span",{className:"text-sm font-medium text-primary",children:a.author.charAt(0)})}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium",children:a.author}),e.jsxs("div",{className:"text-sm text-muted-foreground",children:[a.role,a.company&&` @ ${a.company}`]})]})]})]})},a.id))})]})}function Qj({title:t,description:s,buttonText:a,buttonAction:r,buttonHref:n,secondaryButtonText:o,secondaryButtonAction:i,variant:l="default"}){const u={default:"bg-muted/50",gradient:"bg-gradient-to-r from-primary/10 via-primary/5 to-background",dark:"bg-foreground text-background"};return e.jsx("section",{className:b("py-24",u[l]),children:e.jsx("div",{className:"container",children:e.jsxs("div",{className:"text-center max-w-2xl mx-auto",children:[e.jsx("h2",{className:b("text-3xl md:text-4xl font-bold tracking-tight mb-4",l==="dark"&&"text-background"),children:t}),s&&e.jsx("p",{className:b("text-lg mb-8",l==="dark"?"text-background/80":"text-muted-foreground"),children:s}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[e.jsx(L,{size:"lg",variant:l==="dark"?"secondary":"default",onClick:r,asChild:!!n,children:n?e.jsxs("a",{href:n,children:[a,e.jsx(h.ChevronRight,{className:"ml-2 h-4 w-4"})]}):e.jsxs(e.Fragment,{children:[a,e.jsx(h.ChevronRight,{className:"ml-2 h-4 w-4"})]})}),o&&e.jsx(L,{size:"lg",variant:"outline",onClick:i,className:l==="dark"?"border-background/20 text-background hover:bg-background/10":"",children:o})]})]})})})}function Zj({logo:t,brandName:s="Brand",navItems:a,showLoginButton:r=!0,loginButtonText:n="Se connecter",onLogin:o,loginHref:i,hero:l,features:u,featuresTitle:d,featuresDescription:f,testimonials:m,testimonialsTitle:p,cta:w,footer:C,className:g}){return e.jsxs("div",{className:b("min-h-screen",g),children:[e.jsx(Xj,{logo:t,brandName:s,navItems:a,showLoginButton:r,loginButtonText:n,onLogin:o,loginHref:i}),l&&e.jsx(Kj,{...l}),u&&u.length>0&&e.jsx(Yj,{title:d,description:f,features:u}),m&&m.length>0&&e.jsx(Jj,{title:p,testimonials:m}),w&&e.jsx(Qj,{...w}),C]})}const ev=[{label:"Fonctionnalités",href:"#features"},{label:"Tarifs",href:"#pricing"},{label:"Témoignages",href:"#testimonials"},{label:"Contact",href:"#contact"}],tv=[{id:"1",icon:e.jsx(h.Zap,{className:"h-6 w-6"}),title:"Rapide et performant",description:"Optimisé pour la vitesse avec des temps de chargement minimaux."},{id:"2",icon:e.jsx(h.Shield,{className:"h-6 w-6"}),title:"Sécurisé",description:"Vos données sont protégées avec un chiffrement de bout en bout."},{id:"3",icon:e.jsx(h.Users,{className:"h-6 w-6"}),title:"Collaboration",description:"Travaillez en équipe avec des outils de collaboration intégrés."},{id:"4",icon:e.jsx(h.Globe,{className:"h-6 w-6"}),title:"Accessible partout",description:"Accédez à votre espace depuis n'importe quel appareil."}],sv=[{id:"1",content:"Cette solution a transformé notre façon de travailler. Nous avons gagné un temps précieux.",author:"Marie Dupont",role:"CEO",company:"TechCorp",rating:5},{id:"2",content:"Interface intuitive et support réactif. Je recommande vivement.",author:"Pierre Martin",role:"CTO",company:"StartupXYZ",rating:5},{id:"3",content:"Le meilleur outil que nous ayons utilisé pour gérer nos projets.",author:"Sophie Bernard",role:"Product Manager",company:"InnoLab",rating:5}],av={badge:"Nouveau",title:"La solution pour",highlightedTitle:"votre entreprise",description:"Simplifiez votre quotidien avec notre plateforme tout-en-un. Gagnez du temps et concentrez-vous sur l'essentiel.",primaryButtonText:"Essayer gratuitement",secondaryButtonText:"Voir la démo",stats:[{value:"10K+",label:"Utilisateurs"},{value:"99.9%",label:"Uptime"},{value:"24/7",label:"Support"}]},rv={title:"Prêt à commencer ?",description:"Rejoignez des milliers d'entreprises qui nous font confiance.",buttonText:"Créer un compte gratuit",secondaryButtonText:"Contacter les ventes",variant:"gradient"};function nv({period:t,onChange:s,yearlyDiscount:a}){return e.jsxs("div",{className:"flex items-center justify-center gap-4 mb-8",children:[e.jsx(me,{htmlFor:"billing-toggle",className:b("cursor-pointer transition-colors",t==="monthly"?"text-foreground":"text-muted-foreground"),children:"Mensuel"}),e.jsx(na,{id:"billing-toggle",checked:t==="yearly",onCheckedChange:r=>s(r?"yearly":"monthly")}),e.jsxs(me,{htmlFor:"billing-toggle",className:b("cursor-pointer transition-colors flex items-center gap-2",t==="yearly"?"text-foreground":"text-muted-foreground"),children:["Annuel",a&&e.jsxs(Se,{variant:"secondary",className:"text-xs",children:["-",a]})]})]})}function ov({plan:t,billingPeriod:s}){const a=s==="yearly"&&t.priceYearly!==void 0?t.priceYearly:t.price,r=s==="yearly"&&t.periodYearly?t.periodYearly:t.period||"/mois",n=typeof a=="string";return e.jsxs(ke,{className:b("relative flex flex-col",t.popular&&"border-primary shadow-lg scale-105"),children:[t.popular&&e.jsx("div",{className:"absolute -top-3 left-1/2 -translate-x-1/2",children:e.jsxs(Se,{className:"px-3",children:[e.jsx(h.Zap,{className:"h-3 w-3 mr-1"}),t.badge||"Populaire"]})}),e.jsxs(qe,{className:"text-center pb-2",children:[e.jsx(Oe,{className:"text-xl",children:t.name}),t.description&&e.jsx(ot,{children:t.description})]}),e.jsxs(Te,{className:"flex-1",children:[e.jsx("div",{className:"text-center mb-6",children:n?e.jsx("div",{className:"text-3xl font-bold",children:a}):e.jsxs("div",{className:"flex items-baseline justify-center",children:[e.jsx("span",{className:"text-sm text-muted-foreground mr-1",children:t.currency||"€"}),e.jsx("span",{className:"text-4xl font-bold",children:a}),e.jsx("span",{className:"text-sm text-muted-foreground ml-1",children:r})]})}),e.jsx("ul",{className:"space-y-3",children:t.features.map((o,i)=>e.jsxs("li",{className:"flex items-start gap-2",children:[o.included===!0?e.jsx(h.Check,{className:"h-5 w-5 text-green-500 flex-shrink-0"}):o.included==="partial"||o.included==="limited"?e.jsx(h.Check,{className:"h-5 w-5 text-yellow-500 flex-shrink-0"}):e.jsx(h.X,{className:"h-5 w-5 text-muted-foreground flex-shrink-0"}),e.jsxs("span",{className:b("text-sm",!o.included&&"text-muted-foreground"),children:[o.name,o.value&&e.jsxs("span",{className:"text-muted-foreground ml-1",children:["(",o.value,")"]})]}),o.tooltip&&e.jsx(Ks,{children:e.jsxs(Ys,{children:[e.jsx(Js,{asChild:!0,children:e.jsx(h.HelpCircle,{className:"h-4 w-4 text-muted-foreground cursor-help"})}),e.jsx(ks,{children:e.jsx("p",{className:"max-w-xs",children:o.tooltip})})]})})]},i))})]}),e.jsx(jr,{children:e.jsx(L,{className:"w-full",variant:t.buttonVariant||(t.popular?"default":"outline"),onClick:t.onSelect,disabled:t.disabled,asChild:!!t.href,children:t.href?e.jsx("a",{href:t.href,children:t.buttonText||"Choisir"}):t.buttonText||"Choisir"})})]})}function iv({plans:t,billingPeriod:s}){const a=Array.from(new Set(t.flatMap(r=>r.features.map(n=>n.name))));return e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsxs("thead",{children:[e.jsxs("tr",{children:[e.jsx("th",{className:"text-left p-4 border-b bg-muted/50",children:"Fonctionnalité"}),t.map(r=>e.jsxs("th",{className:b("text-center p-4 border-b min-w-[150px]",r.popular&&"bg-primary/5"),children:[e.jsx("div",{className:"font-bold",children:r.name}),r.popular&&e.jsx(Se,{className:"mt-1",variant:"default",children:"Populaire"})]},r.id))]}),e.jsxs("tr",{children:[e.jsx("td",{className:"p-4 border-b bg-muted/50 font-medium",children:"Prix"}),t.map(r=>{const n=s==="yearly"&&r.priceYearly!==void 0?r.priceYearly:r.price,o=s==="yearly"&&r.periodYearly?r.periodYearly:r.period||"/mois",i=typeof n=="string";return e.jsx("td",{className:b("text-center p-4 border-b",r.popular&&"bg-primary/5"),children:i?e.jsx("span",{className:"font-bold",children:n}):e.jsxs("span",{className:"font-bold",children:[r.currency||"€",n,e.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:o})]})},r.id)})]})]}),e.jsxs("tbody",{children:[a.map((r,n)=>e.jsxs("tr",{className:n%2===0?"bg-muted/20":"",children:[e.jsx("td",{className:"p-4 border-b",children:r}),t.map(o=>{const i=o.features.find(l=>l.name===r);return e.jsx("td",{className:b("text-center p-4 border-b",o.popular&&"bg-primary/5"),children:i?i.included===!0?i.value?e.jsx("span",{children:i.value}):e.jsx(h.Check,{className:"h-5 w-5 text-green-500 mx-auto"}):i.included==="partial"||i.included==="limited"?e.jsx("span",{className:"text-yellow-600",children:i.value||"Limité"}):e.jsx(h.X,{className:"h-5 w-5 text-muted-foreground mx-auto"}):e.jsx(h.X,{className:"h-5 w-5 text-muted-foreground mx-auto"})},o.id)})]},n)),e.jsxs("tr",{children:[e.jsx("td",{className:"p-4"}),t.map(r=>e.jsx("td",{className:b("text-center p-4",r.popular&&"bg-primary/5"),children:e.jsx(L,{variant:r.buttonVariant||(r.popular?"default":"outline"),onClick:r.onSelect,disabled:r.disabled,asChild:!!r.href,children:r.href?e.jsx("a",{href:r.href,children:r.buttonText||"Choisir"}):r.buttonText||"Choisir"})},r.id))]})]})]})})}function lv({title:t="Questions fréquentes",items:s}){return e.jsxs("div",{className:"mt-16",children:[e.jsx("h2",{className:"text-2xl font-bold text-center mb-8",children:t}),e.jsx("div",{className:"grid md:grid-cols-2 gap-6 max-w-4xl mx-auto",children:s.map((a,r)=>e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"font-semibold",children:a.question}),e.jsx("p",{className:"text-muted-foreground text-sm",children:a.answer})]},r))})]})}function cv({title:t="Tarification",description:s,plans:a,showBillingToggle:r=!0,billingPeriod:n,onBillingPeriodChange:o,yearlyDiscount:i,faq:l,faqTitle:u,layout:d="cards",columns:f=3,showComparison:m=!1,className:p}){const[w,C]=c.useState("monthly"),g=n??w,y=x=>{o?o(x):C(x)},j={2:"md:grid-cols-2",3:"md:grid-cols-2 lg:grid-cols-3",4:"md:grid-cols-2 lg:grid-cols-4"};return e.jsxs("div",{className:b("container py-16",p),children:[e.jsxs("div",{className:"text-center mb-12",children:[e.jsx("h1",{className:"text-3xl md:text-4xl font-bold tracking-tight mb-4",children:t}),s&&e.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:s})]}),r&&e.jsx(nv,{period:g,onChange:y,yearlyDiscount:i}),d==="cards"&&!m?e.jsx("div",{className:b("grid gap-6 items-stretch",j[f]),children:a.map(x=>e.jsx(ov,{plan:x,billingPeriod:g},x.id))}):e.jsx(iv,{plans:a,billingPeriod:g}),l&&l.length>0&&e.jsx(lv,{title:u,items:l})]})}const dv=[{id:"free",name:"Gratuit",description:"Pour démarrer",price:0,priceYearly:0,features:[{name:"1 utilisateur",included:!0},{name:"5 projets",included:!0},{name:"1 Go de stockage",included:!0},{name:"Support email",included:!0},{name:"API Access",included:!1},{name:"Analytics avancés",included:!1},{name:"Support prioritaire",included:!1}],buttonText:"Commencer gratuitement",buttonVariant:"outline"},{id:"pro",name:"Pro",description:"Pour les équipes",price:29,priceYearly:24,periodYearly:"/mois (facturé annuellement)",popular:!0,features:[{name:"5 utilisateurs",included:!0},{name:"Projets illimités",included:!0},{name:"50 Go de stockage",included:!0},{name:"Support email",included:!0},{name:"API Access",included:!0},{name:"Analytics avancés",included:!0},{name:"Support prioritaire",included:!1}],buttonText:"Essai gratuit 14 jours"},{id:"enterprise",name:"Enterprise",description:"Pour les grandes équipes",price:"Sur mesure",features:[{name:"Utilisateurs illimités",included:!0},{name:"Projets illimités",included:!0},{name:"Stockage illimité",included:!0},{name:"Support email",included:!0},{name:"API Access",included:!0},{name:"Analytics avancés",included:!0},{name:"Support prioritaire",included:!0}],buttonText:"Contacter les ventes",buttonVariant:"outline"}],uv=[{question:"Puis-je changer de plan à tout moment ?",answer:"Oui, vous pouvez upgrader ou downgrader votre plan à tout moment. Les changements prennent effet immédiatement."},{question:"Y a-t-il une période d'essai ?",answer:"Oui, tous nos plans payants incluent une période d'essai gratuite de 14 jours, sans carte bancaire requise."},{question:"Quels moyens de paiement acceptez-vous ?",answer:"Nous acceptons les cartes de crédit (Visa, Mastercard, Amex), PayPal et les virements bancaires pour les entreprises."},{question:"Puis-je annuler à tout moment ?",answer:"Absolument. Vous pouvez annuler votre abonnement à tout moment sans frais supplémentaires."}],nc=c.createContext(null);function mv(){const t=c.useContext(nc);if(!t)throw new Error("useWizard must be used within a WakaWizard");return t}function hv({steps:t,currentStep:s,stepStatuses:a,showStepNumbers:r,orientation:n,onStepClick:o,allowBackNavigation:i}){const l=(d,f)=>f==="completed"?e.jsx(h.Check,{className:"h-4 w-4"}):f==="error"?e.jsx(h.AlertCircle,{className:"h-4 w-4"}):f==="skipped"?e.jsx(h.X,{className:"h-4 w-4 text-muted-foreground"}):r?e.jsx("span",{className:"text-xs font-medium",children:d+1}):e.jsx(h.Circle,{className:"h-3 w-3"}),u=d=>{switch(d){case"completed":return"bg-primary text-primary-foreground border-primary";case"current":return"bg-primary text-primary-foreground border-primary";case"error":return"bg-destructive text-destructive-foreground border-destructive";case"skipped":return"bg-muted text-muted-foreground border-muted";default:return"bg-background text-muted-foreground border-border"}};return n==="vertical"?e.jsx("div",{className:"flex flex-col gap-0",children:t.map((d,f)=>{const m=a[f],p=i&&f<s;return e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsx("button",{type:"button",disabled:!p,onClick:()=>p&&o?.(f),className:b("flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors",u(m),p&&"cursor-pointer hover:opacity-80"),children:d.icon||l(f,m)}),f<t.length-1&&e.jsx("div",{className:b("w-0.5 flex-1 min-h-[24px]",a[f]==="completed"?"bg-primary":"bg-border")})]}),e.jsxs("div",{className:"pb-8",children:[e.jsxs("div",{className:b("font-medium",m==="current"?"text-foreground":"text-muted-foreground"),children:[d.title,d.optional&&e.jsx("span",{className:"ml-2 text-xs text-muted-foreground",children:"(optionnel)"})]}),d.description&&e.jsx("div",{className:"text-sm text-muted-foreground mt-0.5",children:d.description})]})]},d.id)})}):e.jsx("div",{className:"flex items-center gap-0",children:t.map((d,f)=>{const m=a[f],p=i&&f<s;return e.jsxs(c.Fragment,{children:[e.jsxs("div",{className:"flex flex-col items-center gap-2",children:[e.jsx("button",{type:"button",disabled:!p,onClick:()=>p&&o?.(f),className:b("flex h-8 w-8 items-center justify-center rounded-full border-2 transition-colors",u(m),p&&"cursor-pointer hover:opacity-80"),children:d.icon||l(f,m)}),e.jsx("div",{className:"text-center",children:e.jsx("div",{className:b("text-sm font-medium",m==="current"?"text-foreground":"text-muted-foreground"),children:d.title})})]}),f<t.length-1&&e.jsx("div",{className:b("flex-1 h-0.5 mx-2 mb-6",a[f]==="completed"?"bg-primary":"bg-border")})]},d.id)})})}function fv({onPrev:t,onNext:s,onSkip:a,onCancel:r,isFirstStep:n,isLastStep:o,isOptional:i,prevButtonText:l,nextButtonText:u,finishButtonText:d,skipButtonText:f,cancelButtonText:m,showCancelButton:p,submitting:w}){return e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"flex gap-2",children:p&&r&&e.jsx(L,{type:"button",variant:"ghost",onClick:r,disabled:w,children:m})}),e.jsxs("div",{className:"flex gap-2",children:[!n&&e.jsxs(L,{type:"button",variant:"outline",onClick:t,disabled:w,children:[e.jsx(h.ArrowLeft,{className:"mr-2 h-4 w-4"}),l]}),i&&a&&!o&&e.jsx(L,{type:"button",variant:"ghost",onClick:a,disabled:w,children:f}),e.jsxs(L,{type:"button",onClick:s,disabled:w,children:[w&&e.jsx(h.Loader2,{className:"mr-2 h-4 w-4 animate-spin"}),o?d:u,!o&&!w&&e.jsx(h.ArrowRight,{className:"ml-2 h-4 w-4"})]})]})]})}function pv({steps:t,currentStep:s,onStepChange:a,onSubmit:r,onCancel:n,title:o,description:i,prevButtonText:l="Précédent",nextButtonText:u="Suivant",finishButtonText:d="Terminer",cancelButtonText:f="Annuler",skipButtonText:m="Passer",showCancelButton:p=!0,showProgress:w=!0,showStepNumbers:C=!0,showStepper:g=!0,stepperPosition:y="top",allowBackNavigation:j=!0,confirmCancel:x=!0,cancelConfirmMessage:v="Êtes-vous sûr de vouloir annuler ? Toutes les modifications seront perdues.",submitting:k=!1,layout:N="card",className:D}){const[P,R]=c.useState(0),[A,S]=c.useState(t.map((Y,U)=>U===0?"current":"pending")),[M,E]=c.useState(!1),T=s??P,K=T===0,q=T===t.length-1,B=t[T],W=(T+1)/t.length*100,I=(Y,U)=>{S(ae=>{const te=[...ae];if(U==="next"&&T<t.length)te[T]="completed";else if(U==="skip")te[T]="skipped";else if(U==="goto"&&Y<T)for(let Z=Y+1;Z<t.length;Z++)te[Z]="pending";return te[Y]="current",te})},z=async Y=>{if(Y<0||Y>=t.length||Y>T&&!j)return;B.onLeave&&await B.onLeave(),I(Y,"goto"),a?a(Y):R(Y);const U=t[Y];U.onEnter&&await U.onEnter()},$=async()=>{if(B.validate&&!await B.validate()){S(U=>{const ae=[...U];return ae[T]="error",ae});return}if(B.onLeave&&await B.onLeave(),q){const Y={steps:t.map((U,ae)=>({id:U.id,status:ae===T?"completed":A[ae]})),completedSteps:t.filter((U,ae)=>A[ae]==="completed"||ae===T).map(U=>U.id),skippedSteps:t.filter((U,ae)=>A[ae]==="skipped").map(U=>U.id)};await r?.(Y)}else{const Y=T+1;I(Y,"next"),a?a(Y):R(Y);const U=t[Y];U.onEnter&&await U.onEnter()}},_=async()=>{if(K)return;B.onLeave&&await B.onLeave();const Y=T-1;I(Y,"prev"),a?a(Y):R(Y);const U=t[Y];U.onEnter&&await U.onEnter()},F=async()=>{if(!B.optional||q)return;B.onLeave&&await B.onLeave();const Y=T+1;I(Y,"skip"),a?a(Y):R(Y);const U=t[Y];U.onEnter&&await U.onEnter()},H=()=>{x?E(!0):n?.()},J={currentStep:T,totalSteps:t.length,stepStatuses:A,goToStep:z,nextStep:$,prevStep:_,skipStep:F,isFirstStep:K,isLastStep:q},Q=g&&e.jsx(hv,{steps:t,currentStep:T,stepStatuses:A,showStepNumbers:C,orientation:y==="left"?"vertical":"horizontal",onStepClick:z,allowBackNavigation:j}),ne=e.jsx(fv,{onPrev:_,onNext:$,onSkip:B.optional?F:void 0,onCancel:n?H:void 0,isFirstStep:K,isLastStep:q,isOptional:B.optional||!1,prevButtonText:l,nextButtonText:u,finishButtonText:d,skipButtonText:m,cancelButtonText:f,showCancelButton:p,submitting:k}),X=e.jsxs(nc.Provider,{value:J,children:[y==="left"?e.jsxs("div",{className:"flex gap-8",children:[e.jsx("div",{className:"w-64 flex-shrink-0",children:Q}),e.jsxs("div",{className:"flex-1",children:[w&&e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground mb-2",children:[e.jsxs("span",{children:["Étape ",T+1," sur ",t.length]}),e.jsxs("span",{children:[Math.round(W),"%"]})]}),e.jsx(Xs,{value:W})]}),e.jsx("div",{className:"min-h-[300px]",children:B.content}),e.jsx("div",{className:"mt-8",children:ne})]})]}):e.jsxs(e.Fragment,{children:[Q&&e.jsx("div",{className:"mb-8",children:Q}),w&&e.jsxs("div",{className:"mb-6",children:[e.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground mb-2",children:[e.jsxs("span",{children:["Étape ",T+1," sur ",t.length]}),e.jsxs("span",{children:[Math.round(W),"%"]})]}),e.jsx(Xs,{value:W})]}),e.jsx("div",{className:"min-h-[300px]",children:B.content}),e.jsx("div",{className:"mt-8",children:ne})]}),e.jsx(fs,{open:M,onOpenChange:E,children:e.jsxs(Kt,{children:[e.jsxs(Yt,{children:[e.jsx(Qt,{children:"Annuler ?"}),e.jsx(Zt,{children:v})]}),e.jsxs(Jt,{children:[e.jsx(ts,{children:"Non, continuer"}),e.jsx(es,{onClick:()=>{E(!1),n?.()},children:"Oui, annuler"})]})]})})]});return N==="minimal"?e.jsx("div",{className:b("space-y-6",D),children:X}):N==="page"?e.jsxs("div",{className:b("container py-8 max-w-4xl",D),children:[(o||i)&&e.jsxs("div",{className:"mb-8",children:[o&&e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:o}),i&&e.jsx("p",{className:"text-muted-foreground mt-1",children:i})]}),X]}):e.jsxs(ke,{className:D,children:[(o||i)&&e.jsxs(qe,{children:[o&&e.jsx(Oe,{children:o}),i&&e.jsx(ot,{children:i})]}),e.jsx(Te,{children:X})]})}const xv=[{id:"step-1",title:"Informations de base",description:"Renseignez vos informations personnelles",content:e.jsx("div",{className:"space-y-4",children:e.jsx("p",{className:"text-muted-foreground",children:"Contenu de l'étape 1 - Informations de base"})})},{id:"step-2",title:"Configuration",description:"Configurez vos préférences",optional:!0,content:e.jsx("div",{className:"space-y-4",children:e.jsx("p",{className:"text-muted-foreground",children:"Contenu de l'étape 2 - Configuration (optionnel)"})})},{id:"step-3",title:"Confirmation",description:"Vérifiez et confirmez",content:e.jsx("div",{className:"space-y-4",children:e.jsx("p",{className:"text-muted-foreground",children:"Contenu de l'étape 3 - Confirmation"})})}];function oc(t,s,a){const r=t.translations[a]?.value||"",n=t.translations[s]?.value;return!n||n.trim()===""?"missing":n===r?"identical":"valid"}function ar(t,s,a){const r=s.filter(n=>n!==a).map(n=>oc(t,n,a));return r.includes("missing")?"missing":r.includes("identical")?"identical":"valid"}function gv(t,s){const a=new Map;for(const r of t){const n=r.key.split(s),o=n.length>1?n[0]:"__root__";a.has(o)||a.set(o,[]),a.get(o).push(r)}return a}function bv({status:t}){const s={valid:{label:"OK",variant:"default",icon:h.CheckCircle,className:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-300"},missing:{label:"Manquant",variant:"destructive",icon:h.XCircle,className:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-300"},identical:{label:"Identique",variant:"secondary",icon:h.AlertTriangle,className:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300"},warning:{label:"Attention",variant:"secondary",icon:h.AlertTriangle,className:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-300"}},{label:a,icon:r,className:n}=s[t];return e.jsxs(Se,{variant:"outline",className:b("gap-1 text-xs",n),children:[e.jsx(r,{className:"h-3 w-3"}),a]})}function wo({value:t,onChange:s,onBlur:a,placeholder:r,status:n,disabled:o}){const[i,l]=c.useState(t);c.useEffect(()=>{l(t)},[t]);const u=d=>{l(d.target.value),s(d.target.value)};return e.jsx(ft,{value:i,onChange:u,onBlur:a,placeholder:r,disabled:o,className:b("min-h-[60px] resize-none text-sm",n==="missing"&&"border-red-300 dark:border-red-700",n==="identical"&&"border-yellow-300 dark:border-yellow-700")})}function jv({config:t,translations:s,onChange:a,onSave:r,onAddKey:n,onDeleteKey:o,onAddLanguage:i,onExport:l,onImport:u,isLoading:d=!1,isSaving:f=!1,className:m,title:p="Translation Editor",description:w="Gérez vos traductions i18n"}){const[C,g]=c.useState(s),[y,j]=c.useState(""),[x,v]=c.useState("all"),[k,N]=c.useState(new Set),[D,P]=c.useState(null),[R,A]=c.useState(!1),[S,M]=c.useState(!1),[E,T]=c.useState(!1),[K,q]=c.useState(!1),[B,W]=c.useState(""),[I,z]=c.useState({code:"",label:"",flag:""}),[$,_]=c.useState(null),[F,H]=c.useState(""),[J,Q]=c.useState("merge"),[ne,X]=c.useState(new Map),Y=c.useRef(null),{languages:U,sourceLanguage:ae,keyPathSeparator:te=".",autoSave:Z=!0,saveDebounceMs:le=300,placeholderPatterns:xe=["{{.*?}}","{.*?}","%s","%d"]}=t,se=U.filter(G=>G.code!==ae);c.useEffect(()=>{g(s)},[s]),c.useEffect(()=>(Z&&ne.size>0&&r&&(Y.current&&clearTimeout(Y.current),Y.current=setTimeout(async()=>{await r(C),X(new Map)},le)),()=>{Y.current&&clearTimeout(Y.current)}),[ne,Z,le,r,C]);const de=c.useMemo(()=>{let G=C;if(y){const ee=y.toLowerCase();G=G.filter(re=>{if(re.key.toLowerCase().includes(ee))return!0;for(const we of Object.keys(re.translations))if(re.translations[we]?.value?.toLowerCase().includes(ee))return!0;return!1})}return x!=="all"&&(G=G.filter(ee=>{const re=ar(ee,U.map(we=>we.code),ae);switch(x){case"missing":return re==="missing";case"incomplete":return re==="missing"||re==="identical";case"identical":return re==="identical";default:return!0}})),G},[C,y,x,U,ae]),De=c.useMemo(()=>gv(de,te),[de,te]),Ne=(G,ee,re)=>{g(we=>we.map(be=>be.key===G?{...be,translations:{...be.translations,[ee]:{...be.translations[ee],value:re,updatedAt:new Date}}}:be)),X(we=>{const be=new Map(we);return be.has(G)||be.set(G,new Map),be.get(G).set(ee,re),be}),a?.(G,ee,re)},Ke=async()=>{B.trim()&&(await n?.(B),W(""),M(!1))},xt=async G=>{await o?.(G),g(ee=>ee.filter(re=>re.key!==G))},Ye=async()=>{!I.code||!I.label||(await i?.(I),z({code:"",label:"",flag:""}),T(!1))},et=async()=>{!$||!F||(await u?.($,F,J),_(null),H(""),q(!1))},gt=G=>{navigator.clipboard.writeText(G)},Et=G=>{N(ee=>{const re=new Set(ee);return re.has(G)?re.delete(G):re.add(G),re})},Je=c.useMemo(()=>{let G=C.length,ee=0,re=0,we=0;for(const be of C){const Mt=ar(be,U.map(ys=>ys.code),ae);Mt==="missing"?ee++:Mt==="identical"?re++:we++}return{total:G,missing:ee,identical:re,valid:we}},[C,U,ae]);return d?e.jsx("div",{className:b("flex items-center justify-center py-12",m),children:e.jsx(h.Loader2,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.jsx(Ks,{children:e.jsxs("div",{className:b("flex flex-col h-full",m),children:[e.jsxs("div",{className:"flex flex-col gap-4 p-4 border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-2xl font-bold flex items-center gap-2",children:[e.jsx(h.Languages,{className:"h-6 w-6"}),p]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:w})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(L,{variant:"outline",size:"sm",onClick:()=>M(!0),children:[e.jsx(h.Plus,{className:"h-4 w-4 mr-1"}),"Ajouter une clé"]}),e.jsxs(L,{variant:"outline",size:"sm",onClick:()=>T(!0),children:[e.jsx(h.Flag,{className:"h-4 w-4 mr-1"}),"Ajouter une langue"]}),e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx(L,{variant:"outline",size:"sm",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(_e,{align:"end",children:[e.jsxs(pe,{onClick:()=>l?.(),children:[e.jsx(h.Download,{className:"h-4 w-4 mr-2"}),"Exporter tout"]}),U.map(G=>e.jsxs(pe,{onClick:()=>l?.(G.code),children:[e.jsx(h.Download,{className:"h-4 w-4 mr-2"}),"Exporter ",G.label]},G.code)),e.jsx(Qe,{}),e.jsxs(pe,{onClick:()=>q(!0),children:[e.jsx(h.Upload,{className:"h-4 w-4 mr-2"}),"Importer"]})]})]}),f&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(h.Loader2,{className:"h-4 w-4 animate-spin"}),"Sauvegarde..."]})]})]}),e.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:[Je.total," clés"]}),e.jsxs("span",{className:"flex items-center gap-1 text-green-600 dark:text-green-400",children:[e.jsx(h.CheckCircle,{className:"h-4 w-4"}),Je.valid," traduites"]}),e.jsxs("span",{className:"flex items-center gap-1 text-red-600 dark:text-red-400",children:[e.jsx(h.XCircle,{className:"h-4 w-4"}),Je.missing," manquantes"]}),e.jsxs("span",{className:"flex items-center gap-1 text-yellow-600 dark:text-yellow-400",children:[e.jsx(h.AlertTriangle,{className:"h-4 w-4"}),Je.identical," identiques"]})]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("div",{className:"relative flex-1 max-w-md",children:[e.jsx(h.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),e.jsx(oe,{placeholder:"Rechercher une clé ou une traduction...",value:y,onChange:G=>j(G.target.value),className:"pl-10"}),y&&e.jsx("button",{onClick:()=>j(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:e.jsx(h.X,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h.Filter,{className:"h-4 w-4 text-muted-foreground"}),e.jsxs(Ve,{value:x,onValueChange:G=>v(G),children:[e.jsx($e,{className:"w-[180px]",children:e.jsx(We,{})}),e.jsxs(Le,{children:[e.jsxs(je,{value:"all",children:["Toutes (",Je.total,")"]}),e.jsxs(je,{value:"missing",children:["Manquantes (",Je.missing,")"]}),e.jsxs(je,{value:"incomplete",children:["Incomplètes (",Je.missing+Je.identical,")"]}),e.jsxs(je,{value:"identical",children:["Identiques (",Je.identical,")"]})]})]})]})]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("table",{className:"w-full border-collapse",children:[e.jsx("thead",{className:"sticky top-0 bg-muted/50 backdrop-blur z-10",children:e.jsxs("tr",{children:[e.jsx("th",{className:"text-left p-3 font-medium text-sm border-b w-[280px]",children:"Clé"}),e.jsxs("th",{className:"text-left p-3 font-medium text-sm border-b",children:[U.find(G=>G.code===ae)?.label||ae," (source)"]}),se.map(G=>e.jsx("th",{className:"text-left p-3 font-medium text-sm border-b",children:e.jsxs("span",{className:"flex items-center gap-2",children:[G.flag&&e.jsx("span",{children:G.flag}),G.label]})},G.code)),e.jsx("th",{className:"text-center p-3 font-medium text-sm border-b w-[100px]",children:"État"}),e.jsx("th",{className:"text-center p-3 font-medium text-sm border-b w-[60px]",children:"Actions"})]})}),e.jsxs("tbody",{children:[Array.from(De.entries()).map(([G,ee])=>e.jsxs(c.Fragment,{children:[G!=="__root__"&&e.jsx("tr",{className:"bg-muted/30",children:e.jsx("td",{colSpan:se.length+4,className:"p-2",children:e.jsxs("button",{onClick:()=>Et(G),className:"flex items-center gap-2 text-sm font-medium hover:text-primary transition-colors",children:[k.has(G)?e.jsx(h.ChevronRight,{className:"h-4 w-4"}):e.jsx(h.ChevronDown,{className:"h-4 w-4"}),G,e.jsx(Se,{variant:"secondary",className:"text-xs",children:ee.length})]})})}),!k.has(G)&&ee.map(re=>{const we=ar(re,U.map(be=>be.code),ae);return e.jsxs("tr",{className:"border-b hover:bg-muted/30 transition-colors",children:[e.jsx("td",{className:"p-3 font-mono text-sm",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate max-w-[200px]",title:re.key,children:re.key}),e.jsxs(Ys,{children:[e.jsx(Js,{asChild:!0,children:e.jsx("button",{onClick:()=>gt(re.key),className:"text-muted-foreground hover:text-foreground",children:e.jsx(h.Copy,{className:"h-3 w-3"})})}),e.jsx(ks,{children:"Copier la clé"})]})]})}),e.jsx("td",{className:"p-2",children:e.jsx(wo,{value:re.translations[ae]?.value||"",onChange:be=>Ne(re.key,ae,be),placeholder:"Texte source...",status:re.translations[ae]?.value?"valid":"missing"})}),se.map(be=>{const Mt=oc(re,be.code,ae);return e.jsx("td",{className:"p-2",children:e.jsx(wo,{value:re.translations[be.code]?.value||"",onChange:ys=>Ne(re.key,be.code,ys),placeholder:`Traduction ${be.label}...`,status:Mt})},be.code)}),e.jsx("td",{className:"p-3 text-center",children:e.jsx(bv,{status:we})}),e.jsx("td",{className:"p-3 text-center",children:e.jsxs(He,{children:[e.jsx(Ge,{asChild:!0,children:e.jsx(L,{variant:"ghost",size:"sm",children:e.jsx(h.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(_e,{align:"end",children:[e.jsxs(pe,{onClick:()=>{P(re),A(!0)},children:[e.jsx(h.Edit3,{className:"h-4 w-4 mr-2"}),"Éditer"]}),e.jsxs(pe,{onClick:()=>gt(re.key),children:[e.jsx(h.Copy,{className:"h-4 w-4 mr-2"}),"Copier la clé"]}),e.jsx(Qe,{}),e.jsxs(pe,{className:"text-destructive",onClick:()=>xt(re.key),children:[e.jsx(h.Trash2,{className:"h-4 w-4 mr-2"}),"Supprimer"]})]})]})})]},re.key)})]},G)),de.length===0&&e.jsx("tr",{children:e.jsxs("td",{colSpan:se.length+4,className:"p-12 text-center",children:[e.jsx(h.Languages,{className:"h-12 w-12 mx-auto text-muted-foreground/50 mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:y||x!=="all"?"Aucune traduction ne correspond à vos critères":"Aucune traduction disponible"})]})})]})]})}),e.jsx(sa,{open:R,onOpenChange:A,children:e.jsxs(Ds,{className:"w-[500px] sm:max-w-[500px]",children:[e.jsxs(Ra,{children:[e.jsx(aa,{children:"Éditer la traduction"}),e.jsx(ra,{children:D?.key})]}),D&&e.jsxs("div",{className:"py-6 space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium",children:[U.find(G=>G.code===ae)?.label," (source)"]}),e.jsx(ft,{value:D.translations[ae]?.value||"",onChange:G=>{Ne(D.key,ae,G.target.value),P({...D,translations:{...D.translations,[ae]:{...D.translations[ae],value:G.target.value}}})},placeholder:"Texte source...",className:"min-h-[100px]"})]}),U.filter(G=>G.code!==ae).map(G=>e.jsxs("div",{className:"space-y-2",children:[e.jsxs("label",{className:"text-sm font-medium flex items-center gap-2",children:[G.flag&&e.jsx("span",{children:G.flag}),G.label]}),e.jsx(ft,{value:D.translations[G.code]?.value||"",onChange:ee=>{Ne(D.key,G.code,ee.target.value),P({...D,translations:{...D.translations,[G.code]:{...D.translations[G.code],value:ee.target.value}}})},placeholder:`Traduction ${G.label}...`,className:"min-h-[100px]"})]},G.code)),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Commentaire (optionnel)"}),e.jsx(ft,{placeholder:"Contexte ou indication pour la traduction...",className:"min-h-[80px]"})]})]}),e.jsx($r,{children:e.jsx(L,{variant:"outline",onClick:()=>A(!1),children:"Fermer"})})]})}),e.jsx(It,{open:S,onOpenChange:M,children:e.jsxs(Tt,{children:[e.jsxs(Ht,{children:[e.jsx(Xt,{children:"Ajouter une clé de traduction"}),e.jsx(Cs,{children:"Entrez la clé de traduction (ex: common.buttons.submit)"})]}),e.jsx("div",{className:"py-4",children:e.jsx(oe,{value:B,onChange:G=>W(G.target.value),placeholder:"namespace.key.name"})}),e.jsxs(Gt,{children:[e.jsx(L,{variant:"outline",onClick:()=>M(!1),children:"Annuler"}),e.jsx(L,{onClick:Ke,children:"Ajouter"})]})]})}),e.jsx(It,{open:E,onOpenChange:T,children:e.jsxs(Tt,{children:[e.jsxs(Ht,{children:[e.jsx(Xt,{children:"Ajouter une langue"}),e.jsx(Cs,{children:"Configurez la nouvelle langue à ajouter"})]}),e.jsxs("div",{className:"py-4 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Code (ex: de, it, pt)"}),e.jsx(oe,{value:I.code,onChange:G=>z({...I,code:G.target.value}),placeholder:"de"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Label"}),e.jsx(oe,{value:I.label,onChange:G=>z({...I,label:G.target.value}),placeholder:"Allemand"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Emoji drapeau (optionnel)"}),e.jsx(oe,{value:I.flag,onChange:G=>z({...I,flag:G.target.value}),placeholder:"🇩🇪"})]})]}),e.jsxs(Gt,{children:[e.jsx(L,{variant:"outline",onClick:()=>T(!1),children:"Annuler"}),e.jsx(L,{onClick:Ye,children:"Ajouter"})]})]})}),e.jsx(It,{open:K,onOpenChange:q,children:e.jsxs(Tt,{children:[e.jsxs(Ht,{children:[e.jsx(Xt,{children:"Importer des traductions"}),e.jsx(Cs,{children:"Sélectionnez un fichier JSON à importer"})]}),e.jsxs("div",{className:"py-4 space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Fichier JSON"}),e.jsx(oe,{type:"file",accept:".json",onChange:G=>_(G.target.files?.[0]||null)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Langue cible"}),e.jsxs(Ve,{value:F,onValueChange:H,children:[e.jsx($e,{children:e.jsx(We,{placeholder:"Sélectionner une langue"})}),e.jsx(Le,{children:U.map(G=>e.jsxs(je,{value:G.code,children:[G.flag&&e.jsx("span",{className:"mr-2",children:G.flag}),G.label]},G.code))})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"text-sm font-medium",children:"Stratégie"}),e.jsxs(Ve,{value:J,onValueChange:G=>Q(G),children:[e.jsx($e,{children:e.jsx(We,{})}),e.jsxs(Le,{children:[e.jsx(je,{value:"merge",children:"Fusionner (conserver les existantes)"}),e.jsx(je,{value:"overwrite",children:"Écraser tout"})]})]})]})]}),e.jsxs(Gt,{children:[e.jsx(L,{variant:"outline",onClick:()=>q(!1),children:"Annuler"}),e.jsx(L,{onClick:et,disabled:!$||!F,children:"Importer"})]})]})})]})})}exports.Accordion=lr;exports.AccordionContent=gr;exports.AccordionItem=pr;exports.AccordionTrigger=xr;exports.AdmincrumbProvider=xb;exports.Alert=To;exports.AlertDescription=Eo;exports.AlertDialog=fs;exports.AlertDialogAction=es;exports.AlertDialogCancel=ts;exports.AlertDialogContent=Kt;exports.AlertDialogDescription=Zt;exports.AlertDialogFooter=Jt;exports.AlertDialogHeader=Yt;exports.AlertDialogOverlay=br;exports.AlertDialogPortal=Do;exports.AlertDialogTitle=Qt;exports.AlertDialogTrigger=So;exports.AlertTitle=Ao;exports.AspectRatio=ld;exports.Avatar=yt;exports.AvatarFallback=Ct;exports.AvatarImage=Nt;exports.Badge=Se;exports.BlockLanguageSelector=Nb;exports.Blockquote=ll;exports.Button=L;exports.CHART_SIZE_MAP=Xx;exports.Calendar=Ma;exports.Card=ke;exports.CardContent=Te;exports.CardDescription=ot;exports.CardFooter=jr;exports.CardHeader=qe;exports.CardTitle=Oe;exports.Checkbox=Ze;exports.Code=Uo;exports.Collapsible=Bo;exports.CollapsibleContent=Ho;exports.CollapsibleTrigger=qo;exports.Command=ss;exports.CommandDialog=Cp;exports.CommandEmpty=gs;exports.CommandGroup=Ot;exports.CommandInput=xs;exports.CommandItem=zt;exports.CommandList=ea;exports.CommandSeparator=wa;exports.CommandShortcut=Ko;exports.ContextMenu=Yo;exports.ContextMenuCheckboxItem=ei;exports.ContextMenuContent=Sr;exports.ContextMenuGroup=kp;exports.ContextMenuItem=Ft;exports.ContextMenuLabel=si;exports.ContextMenuPortal=Sp;exports.ContextMenuRadioGroup=Tp;exports.ContextMenuRadioItem=ti;exports.ContextMenuSeparator=Vs;exports.ContextMenuShortcut=ai;exports.ContextMenuSub=Dp;exports.ContextMenuSubContent=Zo;exports.ContextMenuSubTrigger=Qo;exports.ContextMenuTrigger=Jo;exports.DEFAULT_CHART_COLORS=Gx;exports.DataTable=gx;exports.DataTableAdvanced=wx;exports.DataTableColumnResizer=yx;exports.DataTableContextMenu=Sx;exports.DataTableEditCell=Na;exports.DataTableFilters=qr;exports.DataTableGroupTotals=Cx;exports.DataTableGrouping=Nx;exports.DataTableGroupingControls=kx;exports.DataTablePagination=Br;exports.DataTableSelection=Dx;exports.DataTableToolbar=Qs;exports.Dialog=It;exports.DialogClose=Xo;exports.DialogContent=Tt;exports.DialogDescription=Cs;exports.DialogFooter=Gt;exports.DialogHeader=Ht;exports.DialogOverlay=kr;exports.DialogPortal=Go;exports.DialogTitle=Xt;exports.DialogTrigger=Np;exports.DrawerBody=Qr;exports.DrawerClose=dg;exports.DrawerDescription=ka;exports.DrawerFooter=Zr;exports.DrawerHeader=Jr;exports.DrawerTitle=Ca;exports.DrawerTrigger=cg;exports.DropdownMenu=He;exports.DropdownMenuCheckboxItem=ds;exports.DropdownMenuContent=_e;exports.DropdownMenuGroup=Ap;exports.DropdownMenuItem=pe;exports.DropdownMenuLabel=ms;exports.DropdownMenuPortal=Ep;exports.DropdownMenuRadioGroup=Pp;exports.DropdownMenuRadioItem=oi;exports.DropdownMenuSeparator=Qe;exports.DropdownMenuShortcut=ii;exports.DropdownMenuSub=Mp;exports.DropdownMenuSubContent=ni;exports.DropdownMenuSubTrigger=ri;exports.DropdownMenuTrigger=Ge;exports.EmptyCartState=Cj;exports.Error403Page=Aj;exports.Error404Page=Dj;exports.Error500Page=Tj;exports.ErrorState=Sj;exports.Footer=vb;exports.Form=Gp;exports.FormControl=bi;exports.FormDescription=ji;exports.FormField=Xp;exports.FormItem=xi;exports.FormLabel=gi;exports.FormMessage=vi;exports.Heading=ol;exports.Headtab=wb;exports.HeadtabBreadcrumb=yb;exports.HoverCard=Kp;exports.HoverCardContent=wi;exports.HoverCardTrigger=Yp;exports.Input=oe;exports.InputOTP=yi;exports.Kbd=dl;exports.Label=me;exports.LanguageProvider=Yl;exports.LanguageSelector=Qp;exports.Layout=Cb;exports.LegacyThemeProvider=ib;exports.Login=kb;exports.MaintenancePage=Ej;exports.Menubar=ki;exports.MenubarCheckboxItem=Mi;exports.MenubarContent=Ai;exports.MenubarGroup=ex;exports.MenubarItem=Ei;exports.MenubarLabel=Ri;exports.MenubarMenu=Zp;exports.MenubarPortal=tx;exports.MenubarRadioGroup=ax;exports.MenubarRadioItem=Pi;exports.MenubarSeparator=Fi;exports.MenubarShortcut=$i;exports.MenubarSub=sx;exports.MenubarSubContent=Ti;exports.MenubarSubTrigger=Di;exports.MenubarTrigger=Si;exports.ModalBody=an;exports.ModalContent=tn;exports.ModalDescription=Da;exports.ModalFooter=rn;exports.ModalHeader=sn;exports.ModalOverlay=en;exports.ModalTitle=Sa;exports.NavigationMenu=Li;exports.NavigationMenuContent=_i;exports.NavigationMenuIndicator=Vi;exports.NavigationMenuItem=rx;exports.NavigationMenuLink=nx;exports.NavigationMenuList=Ii;exports.NavigationMenuTrigger=zi;exports.NavigationMenuViewport=Mr;exports.NoDataState=vj;exports.NoFilesState=Nj;exports.NoMessagesState=yj;exports.NoNotificationsState=kj;exports.NoResultsState=wj;exports.OfflinePage=Mj;exports.Popover=rt;exports.PopoverContent=st;exports.PopoverTrigger=nt;exports.Progress=Xs;exports.RadioGroup=Wi;exports.RadioGroupItem=Ui;exports.ScrollArea=At;exports.ScrollBar=Pr;exports.Select=Ve;exports.SelectContent=Le;exports.SelectGroup=Jp;exports.SelectItem=je;exports.SelectLabel=Ni;exports.SelectScrollDownButton=Er;exports.SelectScrollUpButton=Ar;exports.SelectSeparator=Ci;exports.SelectTrigger=$e;exports.SelectValue=We;exports.Separator=kt;exports.Sheet=sa;exports.SheetClose=ox;exports.SheetContent=Ds;exports.SheetDescription=ra;exports.SheetFooter=$r;exports.SheetHeader=Ra;exports.SheetOverlay=Fr;exports.SheetPortal=Bi;exports.SheetTitle=aa;exports.SheetTrigger=Rr;exports.SidebarLayout=Eb;exports.Skeleton=qi;exports.Slider=ya;exports.StepperNavigation=Bg;exports.Switch=na;exports.Table=Fa;exports.TableBody=La;exports.TableCaption=Gi;exports.TableCell=tt;exports.TableFooter=Hi;exports.TableHead=ct;exports.TableHeader=$a;exports.TableRow=qt;exports.Tabs=oa;exports.TabsContent=vs;exports.TabsList=Ts;exports.TabsTrigger=js;exports.Text=rl;exports.Textarea=ft;exports.ThemeLoader=Nr;exports.ThemeProvider=Ki;exports.ThemeSelector=Yi;exports.Toast=Ir;exports.ToastAction=Qi;exports.ToastClose=Or;exports.ToastDescription=_r;exports.ToastProvider=Ji;exports.ToastTitle=zr;exports.ToastViewport=Lr;exports.Toaster=hx;exports.Toggle=sl;exports.Tooltip=Ys;exports.TooltipContent=ks;exports.TooltipProvider=Ks;exports.TooltipTrigger=Js;exports.WakaActivityTimeline=tj;exports.WakaAdmincrumb=yl;exports.WakaAreaChart=Sl;exports.WakaAutocomplete=Hr;exports.WakaAutocompleteForm=Nl;exports.WakaBarChart=Cl;exports.WakaBarcode=Ix;exports.WakaBreadcrumb=zx;exports.WakaCalendarView=uj;exports.WakaCarousel=Vx;exports.WakaChart=Es;exports.WakaChat=gj;exports.WakaColorPicker=Kr;exports.WakaColorPickerForm=El;exports.WakaCombobox=Qx;exports.WakaDashboard=Ib;exports.WakaDateRangePicker=eg;exports.WakaDateTimePicker=Yr;exports.WakaDateTimePickerForm=sg;exports.WakaDrawer=ig;exports.WakaEmptyState=rs;exports.WakaErrorPage=Ms;exports.WakaFAQ=$j;exports.WakaFileManager=_j;exports.WakaFileUpload=Rl;exports.WakaHeader=Mb;exports.WakaI18nEditor=jv;exports.WakaImage=Fl;exports.WakaImageGallery=mg;exports.WakaKanban=xg;exports.WakaKanbanBoard=qj;exports.WakaLanding=Zj;exports.WakaLineChart=kl;exports.WakaMiniChart=Tl;exports.WakaModal=wg;exports.WakaModalTrigger=yg;exports.WakaNotifications=$l;exports.WakaNumberInput=Sg;exports.WakaPagination=Ag;exports.WakaPieChart=Dl;exports.WakaPricing=cv;exports.WakaProfile=qb;exports.WakaProvider=hb;exports.WakaQRCode=Pg;exports.WakaRichTextEditor=Ll;exports.WakaSegmentedControl=Lg;exports.WakaSettings=Vb;exports.WakaSidebar=ec;exports.WakaSparkline=Xr;exports.WakaSpinner=zl;exports.WakaStat=_l;exports.WakaStatGroup=Vl;exports.WakaStepper=Ug;exports.WakaThemeCreator=Wl;exports.WakaThemeManager=Bl;exports.WakaTimePicker=Kg;exports.WakaTimeline=Jg;exports.WakaTree=eb;exports.WakaUserManagement=Jb;exports.WakaVideo=sb;exports.WakaVirtualList=nb;exports.WakaWizard=pv;exports.addChildNode=dn;exports.applyTheme=dp;exports.badgeVariants=Mo;exports.blockquoteVariants=il;exports.calculateDuration=Bf;exports.cn=b;exports.compareRanges=np;exports.createBookingDateValidator=Yf;exports.createCardExpiryValidator=Kf;exports.createChartColumn=qx;exports.createCommonPresets=$f;exports.createCustomPreset=Of;exports.createLastDaysPresets=Lf;exports.createMaxAgeValidator=Wf;exports.createMaxRangeDaysValidator=Jf;exports.createMinAgeValidator=Vf;exports.createMonthlyPresets=tp;exports.createNextDaysPresets=If;exports.createQuarterPresets=ep;exports.dateToTimestamp=sp;exports.defaultActivities=aj;exports.defaultActivityFilters=sj;exports.defaultCalendarEvents=mj;exports.defaultChatConversations=bj;exports.defaultChatMessages=jj;exports.defaultChatUser=Bs;exports.defaultDashboardStats=Ob;exports.defaultFAQCategories=Lj;exports.defaultFAQItems=Ij;exports.defaultFileManagerBreadcrumbs=Wj;exports.defaultFiles=Vj;exports.defaultKanbanColumns=Hj;exports.defaultKanbanLabels=Gj;exports.defaultLandingCTA=rv;exports.defaultLandingFeatures=tv;exports.defaultLandingHero=av;exports.defaultLandingNavItems=ev;exports.defaultLandingTestimonials=sv;exports.defaultPermissions=Zb;exports.defaultPresets=Ml;exports.defaultPricingFAQ=uv;exports.defaultPricingPlans=dv;exports.defaultProfileData=Hb;exports.defaultSettingsTabs=Wb;exports.defaultUsers=Qb;exports.defaultWizardSteps=xv;exports.exportToCSV=ul;exports.exportToJSON=ml;exports.findNodeById=ln;exports.formatDateRange=qf;exports.getDatesInMonth=yr;exports.getFrenchHolidays=Hf;exports.getThemeLoader=Cr;exports.getWeekdaysInMonth=Xf;exports.getWeekendsInMonth=Gf;exports.getWorkingDays=Zf;exports.headingVariants=nl;exports.initThemeLoader=lp;exports.isDateInRange=Lt;exports.isFutureDate=zf;exports.isHoliday=Wo;exports.isNotExpired=Uf;exports.isPastDate=_o;exports.isSameDay=Qf;exports.isToday=_f;exports.isWeekday=wr;exports.isWeekend=Vo;exports.kbdVariants=cl;exports.loadTableState=fl;exports.loadTheme=cp;exports.mergeRanges=op;exports.moveNode=tb;exports.navigationMenuTriggerStyle=Oi;exports.normalizeDate=rp;exports.parseCSV=fx;exports.rangesOverlap=ip;exports.reducer=Zi;exports.removeNode=cn;exports.saveTableState=hl;exports.sparklineTemplate=Hx;exports.textVariants=al;exports.themeManagerVariants=Ul;exports.timestampToDate=ap;exports.toast=el;exports.toggleVariants=tl;exports.tweak=va;exports.updateNode=Xl;exports.useAdmincrumb=Rx;exports.useAdmincrumbContext=gb;exports.useAdmincrumbContextOptional=bb;exports.useBreadcrumbFromPath=_x;exports.useChartTheme=As;exports.useCombobox=Zx;exports.useDataTable=pl;exports.useDataTableAdvanced=xl;exports.useDataTableEdit=Ur;exports.useDataTableExport=bl;exports.useDataTableImport=jl;exports.useDataTableSelection=Tx;exports.useDataTableTheme=vl;exports.useDataTableVirtualization=gl;exports.useDateForm=ag;exports.useDateRangePicker=tg;exports.useDrawer=lg;exports.useFormField=ta;exports.useKanban=gg;exports.useLanguage=un;exports.useLegacyTheme=mb;exports.useModal=Ng;exports.useNotifications=kg;exports.useNumberInput=Dg;exports.usePagination=Eg;exports.useQRCode=Rg;exports.useRechartsLoader=Gr;exports.useSegmentedControl=Ig;exports.useSidebar=Ab;exports.useStat=Vg;exports.useStepperContext=on;exports.useTableLayout=Wr;exports.useTheme=ia;exports.useThemeLoader=up;exports.useTimePicker=Yg;exports.useToast=Vr;exports.useTranslation=Pl;exports.useVideo=ab;exports.useVirtualList=ob;exports.useWaka=pb;exports.useWizard=mv;