@oniratec/onira-react-ui 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/factories/form/types.d.ts +2 -0
- package/dist/factories/form/types.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +807 -783
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
|
|
43
43
|
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
44
44
|
|
|
45
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return h.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},vy="DialogDescriptionWarning",xy=({contentRef:t,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${gu(vy).contentName}}.`;return h.useEffect(()=>{const s=t.current?.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},yu=ru,vu=su,xu=iu,as=ou,is=lu,os=uu,ls=fu,cs=mu;const bu=yu,by=vu,wu=xu,wy=cs,za=h.forwardRef(({className:t,...e},r)=>l.jsx(as,{ref:r,className:N("fixed inset-0 isolate z-50 bg-black/10 backdrop-blur-[2px] transition-opacity duration-100","data-[state=closed]:opacity-0 data-[state=open]:opacity-100",t),...e}));za.displayName=as.displayName;const ky={sm:"sm:max-w-sm",md:"sm:max-w-md",lg:"sm:max-w-lg",xl:"sm:max-w-xl","2xl":"sm:max-w-2xl",full:"sm:max-w-full"},Wa=h.forwardRef(({className:t,children:e,hideClose:r,size:n="md",...s},a)=>l.jsxs(wu,{children:[l.jsx(za,{}),l.jsxs(is,{ref:a,className:N("fixed left-1/2 top-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-background p-4 text-sm","ring-1 ring-foreground/10 shadow-card-lg outline-none transition-[opacity,transform] duration-100",ky[n],"data-[state=closed]:opacity-0 data-[state=closed]:scale-95","data-[state=open]:opacity-100 data-[state=open]:scale-100",t),...s,children:[e,!r&&l.jsx(cs,{asChild:!0,children:l.jsxs(Le,{variant:"ghost",size:"icon-sm",className:"absolute right-2 top-2","aria-label":"Cerrar",children:[l.jsx(J.X,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Cerrar"})]})})]})]}));Wa.displayName=is.displayName;const Za=({className:t,...e})=>l.jsx("div",{className:N("flex flex-col gap-2",t),...e});Za.displayName="DialogHeader";const Ba=({className:t,...e})=>l.jsx("div",{className:N("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",t),...e});Ba.displayName="DialogFooter";const Ua=h.forwardRef(({className:t,...e},r)=>l.jsx(os,{ref:r,className:N("text-base font-medium leading-none text-foreground",t),...e}));Ua.displayName=os.displayName;const Ha=h.forwardRef(({className:t,...e},r)=>l.jsx(ls,{ref:r,className:N("text-sm text-muted-foreground",t),...e}));Ha.displayName=ls.displayName;const Sy=fe.Root,Ny=fe.Trigger,Cy=fe.Group,_y=fe.Portal,Ty=fe.Sub,jy=fe.RadioGroup,ku=h.forwardRef(({className:t,sideOffset:e=6,...r},n)=>l.jsx(fe.Portal,{children:l.jsx(fe.Content,{ref:n,sideOffset:e,className:N("z-50 min-w-[10rem] overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-card-sm ring-1 ring-foreground/10 outline-none","transition-[opacity,transform] duration-100","data-[state=closed]:opacity-0 data-[state=closed]:scale-95","data-[state=open]:opacity-100 data-[state=open]:scale-100",t),...r})}));ku.displayName=fe.Content.displayName;const Su=h.forwardRef(({className:t,inset:e,icon:r,destructive:n,children:s,...a},i)=>l.jsxs(fe.Item,{ref:i,className:N("relative flex cursor-default select-none items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-none transition-colors","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",n&&"text-destructive focus:bg-destructive/10 focus:text-destructive",t),...a,children:[r&&l.jsx("span",{className:"h-4 w-4 shrink-0 [&>svg]:h-4 [&>svg]:w-4",children:r}),s]}));Su.displayName=fe.Item.displayName;const Nu=h.forwardRef(({className:t,children:e,checked:r,...n},s)=>l.jsxs(fe.CheckboxItem,{ref:s,className:N("relative flex cursor-default select-none items-center gap-1.5 rounded-md py-1 pl-1.5 pr-8 text-sm outline-none transition-colors","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:r,...n,children:[l.jsx("span",{className:"absolute right-2 flex h-4 w-4 items-center justify-center",children:l.jsx(fe.ItemIndicator,{children:l.jsx(J.Check,{className:"h-4 w-4"})})}),e]}));Nu.displayName=fe.CheckboxItem.displayName;const Cu=h.forwardRef(({className:t,children:e,...r},n)=>l.jsxs(fe.RadioItem,{ref:n,className:N("relative flex cursor-default select-none items-center gap-1.5 rounded-md py-1 pl-1.5 pr-8 text-sm outline-none transition-colors","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[l.jsx("span",{className:"absolute right-2 flex h-4 w-4 items-center justify-center",children:l.jsx(fe.ItemIndicator,{children:l.jsx(J.Circle,{className:"h-2.5 w-2.5 fill-current"})})}),e]}));Cu.displayName=fe.RadioItem.displayName;const _u=h.forwardRef(({className:t,inset:e,...r},n)=>l.jsx(fe.Label,{ref:n,className:N("px-1.5 py-1 text-xs font-medium text-muted-foreground",e&&"pl-8",t),...r}));_u.displayName=fe.Label.displayName;const Tu=h.forwardRef(({className:t,...e},r)=>l.jsx(fe.Separator,{ref:r,className:N("-mx-1 my-1 h-px bg-border",t),...e}));Tu.displayName=fe.Separator.displayName;const ju=h.forwardRef(({className:t,inset:e,children:r,...n},s)=>l.jsxs(fe.SubTrigger,{ref:s,className:N("flex cursor-default select-none items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-none transition-colors","focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...n,children:[r,l.jsx(J.ChevronRight,{className:"ml-auto h-4 w-4"})]}));ju.displayName=fe.SubTrigger.displayName;const Eu=h.forwardRef(({className:t,...e},r)=>l.jsx(fe.SubContent,{ref:r,className:N("z-50 min-w-[8rem] overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-card-sm ring-1 ring-foreground/10 outline-none","transition-[opacity,transform] duration-100","data-[state=closed]:opacity-0 data-[state=closed]:scale-95","data-[state=open]:opacity-100 data-[state=open]:scale-100",t),...e}));Eu.displayName=fe.SubContent.displayName;const Ou=({className:t,...e})=>l.jsx("span",{className:N("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});Ou.displayName="DropdownMenuShortcut";const Ey="Arrastra y suelta archivos aquí o selecciona desde tu dispositivo.",Oy=t=>{if(t===0)return"0 B";const e=1024,r=["B","KB","MB","GB","TB"],n=Math.floor(Math.log(t)/Math.log(e));return`${(t/Math.pow(e,n)).toFixed(n===0?0:1)} ${r[n]}`},ir=t=>`${t.name}-${t.size}-${t.lastModified}`,go=t=>t.type.startsWith("image/");function us({label:t,helperText:e,error:r,disabled:n=!1,multiple:s=!1,accept:a,files:i,defaultFiles:o=[],onFilesChange:c,id:u,name:f,allowDrop:d=!1,placeholder:m=Ey,showPreview:p=!0,previewMode:y="auto",maxPreviewItems:g=4,defaultPreviewUrl:x}){const v=b.useId(),S=u??v,C=e?`${S}-helper`:void 0,k=r?`${S}-error`:void 0,w=[C,k].filter(Boolean).join(" ")||void 0,j=b.useRef(null),[T,A]=b.useState(o),[$,L]=b.useState(!1),W=i!==void 0,B=W?i:T,G=F=>{const D=s?F:F.slice(0,1);W||A(D),c?.(D)},Q=F=>{if(!s)return F.slice(0,1);const D=new Map(B.map(ee=>[ir(ee),ee]));for(const ee of F)D.set(ir(ee),ee);return Array.from(D.values())},H=F=>{const D=Array.from(F.target.files??[]);G(s?Q(D):D),F.target.value=""},P=F=>{G(B.filter(D=>ir(D)!==ir(F)))},U=F=>{if(!d||n)return;F.preventDefault(),L(!1);const D=Array.from(F.dataTransfer.files??[]);D.length!==0&&G(s?Q(D):D)},V=b.useMemo(()=>{if(!p)return[];const F=B.slice(0,g);return y==="image"||y==="auto"&&F.some(ee=>go(ee))?F.filter(ee=>go(ee)).map(ee=>({key:ir(ee),file:ee,url:URL.createObjectURL(ee)})):[]},[B,g,y,p]);b.useEffect(()=>()=>{for(const F of V)URL.revokeObjectURL(F.url)},[V]);const ie=!!x&&B.length===0;return l.jsxs("div",{className:N("flex flex-col gap-2",n&&"pointer-events-none opacity-60"),children:[t&&l.jsx("label",{htmlFor:S,className:"text-sm font-medium text-foreground",children:t}),l.jsx("input",{ref:j,id:S,name:f,type:"file",className:"sr-only",disabled:n,multiple:s,accept:a,"aria-invalid":r?"true":void 0,"aria-describedby":w,onChange:H}),l.jsxs("button",{type:"button",disabled:n,className:N("flex min-h-44 flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border bg-card px-6 py-8 text-center","transition-[border-color,background-color,box-shadow,transform] hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px",d&&"cursor-pointer",$&&"border-ring bg-muted",r&&"border-destructive focus-visible:ring-destructive/20"),onClick:()=>j.current?.click(),onDragOver:F=>{!d||n||(F.preventDefault(),L(!0))},onDragLeave:()=>d&&L(!1),onDrop:U,children:[l.jsx(J.UploadCloud,{className:"h-8 w-8 text-muted-foreground"}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:s?"Seleccionar archivos":"Seleccionar archivo"}),l.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:m}),a&&l.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["Acepta: ",a]})]})]}),ie&&l.jsx("div",{className:"mt-2 flex gap-2",children:l.jsx("div",{className:"h-16 w-16 overflow-hidden rounded-lg bg-muted ring-1 ring-foreground/10",children:l.jsx("img",{src:x,alt:"Logo actual",className:"h-full w-full object-cover"})})}),V.length>0&&l.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:V.map(F=>l.jsx("div",{className:"h-16 w-16 overflow-hidden rounded-lg bg-muted ring-1 ring-foreground/10",children:l.jsx("img",{src:F.url,alt:F.file.name,className:"h-full w-full object-cover"})},F.key))}),e&&!r&&l.jsx("p",{id:C,className:"text-xs text-muted-foreground",children:e}),r&&l.jsx("p",{id:k,className:"text-xs text-destructive",children:r}),B.length>0&&l.jsx("ul",{className:"mt-2 flex flex-col gap-1",children:B.map(F=>l.jsxs("li",{className:"flex items-center justify-between gap-2 rounded-lg bg-muted/40 px-3 py-2 ring-1 ring-foreground/10",children:[l.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[l.jsx(J.FileIcon,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:F.name}),l.jsx("p",{className:"text-xs text-muted-foreground",children:Oy(F.size)})]})]}),l.jsx("button",{type:"button",className:"shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50",onClick:()=>P(F),"aria-label":`Eliminar ${F.name}`,children:l.jsx(J.X,{className:"h-4 w-4"})})]},ir(F)))})]})}const Dy=us,Du=h.createContext(null);function ds(){const t=h.useContext(Du);if(!t)throw new Error("Field components must be used inside <Field>");return t}function st({className:t,error:e,required:r,...n}){const s=h.useId();return l.jsx(Du.Provider,{value:{id:s,error:e,required:r},children:l.jsx("div",{className:N("flex flex-col gap-1.5",t),...n})})}const Xe=b.forwardRef((t,e)=>{const{id:r,error:n}=ds();return l.jsx(Go,{ref:e,id:r,"aria-invalid":!!n,...t})});Xe.displayName="FieldControl";const at=h.forwardRef(({className:t,children:e,...r},n)=>{const{id:s,required:a}=ds();return l.jsxs("label",{ref:n,htmlFor:s,className:N("text-sm font-medium text-foreground leading-none",t),...r,children:[e,a&&l.jsx("span",{className:"ml-0.5 text-destructive",children:"*"})]})});at.displayName="FieldLabel";const Je=h.forwardRef(({className:t,children:e,...r},n)=>{const{error:s}=ds(),a=s??e;return a?l.jsx("p",{ref:n,className:N("text-xs",s?"text-destructive":"text-muted-foreground",t),...r,children:a}):null});Je.displayName="FieldMessage";const Ru=b.forwardRef(({className:t,containerClassName:e,isInvalid:r,...n},s)=>{const[a,i]=b.useState(!1);return l.jsxs("div",{className:N("relative",e),children:[l.jsx("input",{ref:s,type:a?"text":"password","aria-invalid":r||void 0,className:N("flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 pr-10 text-sm text-foreground shadow-sm transition-colors","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1","disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-muted",r&&"border-destructive focus-visible:ring-destructive",t),...n}),l.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",onClick:()=>i(o=>!o),children:a?l.jsx(J.EyeOff,{className:"h-4 w-4"}):l.jsx(J.EyeIcon,{className:"h-4 w-4"})})]})});Ru.displayName="PasswordInput";const $r=h.forwardRef(({className:t,isInvalid:e,"aria-invalid":r,...n},s)=>{const a=e??(r===!0||r==="true");return l.jsx("input",{ref:s,"aria-invalid":a||void 0,className:N("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-sm text-foreground transition-[border-color,box-shadow,color,background-color] outline-none","file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground","placeholder:text-muted-foreground","focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50","disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50","dark:bg-input/30 dark:disabled:bg-input/80",a&&"border-destructive focus-visible:border-destructive focus-visible:ring-destructive/20 dark:border-destructive/50 dark:focus-visible:ring-destructive/40",t),...n})});$r.displayName="Input";const Au=h.forwardRef(({className:t,...e},r)=>l.jsx("kbd",{ref:r,className:N("inline-flex min-h-6 items-center rounded-md border border-border bg-muted px-1.5 font-mono text-[11px] font-medium text-muted-foreground shadow-sm",t),...e}));Au.displayName="Kbd";const Ry=({lottieJson:t,title:e,description:r,actionLabel:n,onAction:s,fallbackIcon:a})=>l.jsxs("div",{className:"flex w-full flex-col items-center justify-center text-center",children:[t?l.jsx("div",{className:"mb-4 w-1/2",children:l.jsx(Rd,{animationData:t,loop:!0})}):a&&l.jsx("div",{className:"mb-4 text-[color:var(--oniratec-label-secondary)]",children:a}),l.jsx("h2",{className:"mb-2 text-lg font-semibold text-[color:var(--oniratec-label-primary)]",children:e}),r&&l.jsx("p",{className:"mb-6 max-w-md text-sm text-[color:var(--oniratec-label-secondary)]",children:r}),n&&s&&l.jsx(Le,{size:"md",onClick:s,children:n})]}),Mu=h.forwardRef(({className:t,indicatorClassName:e,max:r=100,value:n=0,...s},a)=>{const i=r>0?r:100,o=n==null?0:Math.min(Math.max(n,0),i),c=`${o/i*100}%`;return l.jsx("div",{ref:a,role:"progressbar","aria-valuemin":0,"aria-valuemax":i,"aria-valuenow":n==null?void 0:o,className:N("h-2 w-full overflow-hidden rounded-full bg-muted ring-1 ring-foreground/10",t),...s,children:l.jsx("div",{className:N("h-full rounded-full bg-primary transition-[width] duration-300",e),style:{width:c}})})});Mu.displayName="Progress";const Iu=h.createContext(null);function Ay(){const t=h.useContext(Iu);if(!t)throw new Error("RadioGroupItem must be used inside <RadioGroup>.");return t}function My({className:t,defaultValue:e,disabled:r,name:n,onValueChange:s,orientation:a="vertical",required:i,value:o,...c}){const u=h.useId(),[f,d]=h.useState(e),m=o!==void 0,p=m?o:f,y=h.useCallback(g=>{m||d(g),s?.(g)},[m,s]);return l.jsx(Iu.Provider,{value:{disabled:r,name:n??u,onValueChange:y,orientation:a,required:i,value:p},children:l.jsx("div",{role:"radiogroup","aria-required":i,"data-orientation":a,className:N("flex gap-3",a==="horizontal"?"flex-row flex-wrap items-center":"flex-col",t),...c})})}const Pu=h.forwardRef(({className:t,description:e,disabled:r,id:n,label:s,size:a="md",value:i,"aria-describedby":o,"aria-invalid":c,onChange:u,...f},d)=>{const m=h.useId(),p=n??m,y=e?`${p}-description`:void 0,g=c===!0||c==="true",x=Ay(),v=x.value===i,S=x.disabled||r;return l.jsxs("label",{htmlFor:p,className:N("inline-flex w-fit items-start gap-2.5 text-sm",S&&"cursor-not-allowed opacity-60",t),children:[l.jsx("input",{ref:d,id:p,type:"radio",name:x.name,value:i,checked:v,required:x.required,disabled:S,"aria-invalid":g||void 0,"aria-describedby":[o,y].filter(Boolean).join(" ")||void 0,className:"peer sr-only",onChange:C=>{C.target.checked&&x.onValueChange(i),u?.(C)},...f}),l.jsx("span",{className:N("flex shrink-0 items-center justify-center rounded-full border border-input bg-background text-primary transition-[background-color,border-color,box-shadow,color] outline-none","peer-focus-visible:border-ring peer-focus-visible:ring-3 peer-focus-visible:ring-ring/50","peer-disabled:border-input peer-disabled:bg-input/50","peer-checked:border-primary peer-checked:bg-primary/10 peer-checked:[&_span]:scale-100 peer-checked:[&_span]:opacity-100",g&&"border-destructive peer-focus-visible:border-destructive peer-focus-visible:ring-destructive/20",a==="sm"?"h-4 w-4":"h-5 w-5"),children:l.jsx("span",{className:N("rounded-full bg-primary opacity-0 transition-[opacity,transform]",a==="sm"?"h-2 w-2 scale-75":"h-2.5 w-2.5 scale-75")})}),(s||e)&&l.jsxs("span",{className:"grid gap-1 leading-tight",children:[s&&l.jsx("span",{className:"font-medium text-foreground",children:s}),e&&l.jsx("span",{id:y,className:"text-sm text-muted-foreground",children:e})]})]})});Pu.displayName="RadioGroupItem";const fs=pe.Root,Iy=pe.Group,hs=pe.Value,Kr=h.forwardRef(({className:t,hasError:e,children:r,...n},s)=>l.jsxs(pe.Trigger,{ref:s,"aria-invalid":e||void 0,className:N("flex h-8 w-full items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent px-2.5 py-1 pr-2 text-sm transition-[border-color,box-shadow,color,background-color] outline-none","data-[placeholder]:text-muted-foreground","focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50","disabled:cursor-not-allowed disabled:opacity-50","dark:bg-input/30 dark:hover:bg-input/50","[&>span]:line-clamp-1",e&&"border-destructive focus-visible:border-destructive focus-visible:ring-destructive/20 dark:border-destructive/50 dark:focus-visible:ring-destructive/40",t),...n,children:[r,l.jsx(pe.Icon,{asChild:!0,children:l.jsx(J.ChevronDown,{className:"h-4 w-4 shrink-0 text-muted-foreground"})})]}));Kr.displayName=pe.Trigger.displayName;const qa=h.forwardRef(({className:t,...e},r)=>l.jsx(pe.ScrollUpButton,{ref:r,className:N("flex cursor-default items-center justify-center bg-popover py-1",t),...e,children:l.jsx(J.ChevronUp,{className:"h-4 w-4"})}));qa.displayName=pe.ScrollUpButton.displayName;const Ya=h.forwardRef(({className:t,...e},r)=>l.jsx(pe.ScrollDownButton,{ref:r,className:N("flex cursor-default items-center justify-center bg-popover py-1",t),...e,children:l.jsx(J.ChevronDown,{className:"h-4 w-4"})}));Ya.displayName=pe.ScrollDownButton.displayName;const Qr=h.forwardRef(({className:t,children:e,position:r="popper",...n},s)=>l.jsx(pe.Portal,{children:l.jsxs(pe.Content,{ref:s,className:N("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-card-sm ring-1 ring-foreground/10 outline-none","transition-[opacity,transform] duration-100","data-[state=closed]:opacity-0 data-[state=closed]:scale-95","data-[state=open]:opacity-100 data-[state=open]:scale-100",r==="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:r,...n,children:[l.jsx(qa,{}),l.jsx(pe.Viewport,{className:N("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),l.jsx(Ya,{})]})}));Qr.displayName=pe.Content.displayName;const Fu=h.forwardRef(({className:t,...e},r)=>l.jsx(pe.Label,{ref:r,className:N("px-1.5 py-1 text-xs font-medium text-muted-foreground",t),...e}));Fu.displayName=pe.Label.displayName;const en=h.forwardRef(({className:t,children:e,...r},n)=>l.jsxs(pe.Item,{ref:n,className:N("relative flex w-full cursor-default select-none items-center gap-1.5 rounded-md py-1 pl-1.5 pr-8 text-sm outline-none transition-colors","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[l.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(pe.ItemIndicator,{children:l.jsx(J.Check,{className:"h-4 w-4"})})}),l.jsx(pe.ItemText,{children:e})]}));en.displayName=pe.Item.displayName;const Lu=h.forwardRef(({className:t,...e},r)=>l.jsx(pe.Separator,{ref:r,className:N("-mx-1 my-1 h-px bg-border",t),...e}));Lu.displayName=pe.Separator.displayName;function Py(t,e){const[r,n]=h.useState(t);return h.useEffect(()=>{const s=setTimeout(()=>n(t),e);return()=>clearTimeout(s)},[t,e]),r}function Ga({value:t,onValueChange:e,placeholder:r="Seleccionar",searchPlaceholder:n="Buscar...",disabled:s,hasError:a,minChars:i=2,debounceMs:o=300,fetcher:c,getOptionValue:u,getOptionLabel:f,emptyLabel:d="Sin resultados",loadingLabel:m="Buscando...",emptyActionLabel:p,onEmptyActionClick:y,contentClassName:g,triggerClassName:x}){const[v,S]=h.useState(!1),[C,k]=h.useState(""),[w,j]=h.useState(!1),[T,A]=h.useState([]),[$,L]=h.useState(""),W=Py(C,o),B=W.trim().length>=i,G=h.useRef(null);h.useEffect(()=>{const H=P=>{G.current&&(G.current.contains(P.target)||S(!1))};return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[]),h.useEffect(()=>{let H=!0;return(async()=>{if(v){if(!B){A([]);return}j(!0);try{const U=await c(W.trim());if(!H)return;A(U??[])}finally{H&&j(!1)}}})(),()=>{H=!1}},[v,W,B,c]),h.useEffect(()=>{if(!t){L("");return}const H=T.find(P=>u(P)===t);H&&L(f(H))},[t,T,u,f]);const Q=$||r;return l.jsxs("div",{ref:G,className:"relative w-full",children:[l.jsxs("button",{type:"button",disabled:s,"aria-invalid":a?"true":"false","aria-expanded":v,"aria-haspopup":"listbox",onClick:()=>S(H=>!H),className:N("flex h-9 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-colors","focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1","disabled:cursor-not-allowed disabled:opacity-50",a&&"border-destructive focus:ring-destructive",x),children:[l.jsx("span",{className:N("truncate",!$&&"text-muted-foreground"),children:Q}),l.jsx(J.ChevronDown,{className:N("h-4 w-4 shrink-0 opacity-50 transition-transform",v&&"rotate-180")})]}),v&&l.jsxs("div",{className:N("absolute left-0 top-full z-50 mt-1 w-full rounded-md border border-border bg-popover shadow-card-sm",g),role:"listbox",children:[l.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[l.jsx("input",{className:"flex h-9 w-full bg-transparent py-2 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",value:C,onChange:H=>k(H.target.value),placeholder:n,autoFocus:!0}),w&&l.jsx(J.Loader2,{className:"h-4 w-4 shrink-0 animate-spin text-muted-foreground"})]}),l.jsxs("div",{className:"max-h-60 overflow-y-auto p-1",children:[!B&&l.jsxs("p",{className:"py-2 text-center text-xs text-muted-foreground",children:["Escribe al menos ",i," caracteres"]}),B&&w&&l.jsx("p",{className:"py-2 text-center text-xs text-muted-foreground",children:m}),B&&!w&&T.length===0&&l.jsxs("div",{className:"flex flex-col items-center gap-2 py-3",children:[l.jsx("p",{className:"text-xs text-muted-foreground",children:d}),p&&y&&l.jsx("button",{type:"button",className:"text-xs font-medium text-primary hover:underline",onClick:y,children:p})]}),T.length>0&&l.jsx("ul",{children:T.map(H=>{const P=u(H),U=f(H),V=P===t;return l.jsx("li",{children:l.jsxs("button",{type:"button",role:"option","aria-selected":V,className:N("relative flex w-full cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground",V&&"bg-accent text-accent-foreground font-medium"),onClick:()=>{e(P),L(U),S(!1),k("")},children:[V&&l.jsx(J.Check,{className:"mr-2 h-4 w-4 shrink-0"}),l.jsx("span",{className:N(!V&&"ml-6"),children:U})]})},P)})})]})]})]})}const Vu=h.forwardRef(({className:t,decorative:e=!0,orientation:r="horizontal",...n},s)=>l.jsx("div",{ref:s,role:e?"none":"separator","aria-orientation":e?void 0:r,"data-orientation":r,className:N("shrink-0 bg-border",r==="horizontal"?"h-px w-full":"h-full w-px",t),...n}));Vu.displayName="Separator";const Fy=yu,Ly=vu,Vy=cs,$u=xu,Xa=h.forwardRef(({className:t,...e},r)=>l.jsx(as,{ref:r,className:N("fixed inset-0 isolate z-50 bg-black/10 backdrop-blur-[2px] transition-opacity duration-100","data-[state=closed]:opacity-0 data-[state=open]:opacity-100",t),...e}));Xa.displayName=as.displayName;const $y=Bn("fixed z-50 flex flex-col gap-4 bg-background p-4 text-sm ring-1 ring-foreground/10 shadow-card-lg outline-none transition-[opacity,transform] duration-100 data-[state=closed]:opacity-0 data-[state=open]:opacity-100",{variants:{side:{top:"inset-x-0 top-0 border-b border-border data-[state=closed]:-translate-y-6 data-[state=open]:translate-y-0",bottom:"inset-x-0 bottom-0 border-t border-border data-[state=closed]:translate-y-6 data-[state=open]:translate-y-0",left:"inset-y-0 left-0 h-full w-full max-w-sm border-r border-border data-[state=closed]:-translate-x-full data-[state=open]:translate-x-0",right:"inset-y-0 right-0 h-full w-full max-w-sm border-l border-border data-[state=closed]:translate-x-full data-[state=open]:translate-x-0"}},defaultVariants:{side:"right"}}),zu=h.forwardRef(({side:t="right",className:e,children:r,hideClose:n,...s},a)=>l.jsxs($u,{children:[l.jsx(Xa,{}),l.jsxs(is,{ref:a,className:N($y({side:t}),e),...s,children:[!n&&l.jsx(cs,{asChild:!0,children:l.jsxs(Le,{variant:"ghost",size:"icon-sm",className:"absolute right-2 top-2","aria-label":"Cerrar",children:[l.jsx(J.X,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Cerrar"})]})}),r]})]}));zu.displayName=is.displayName;const Wu=({className:t,...e})=>l.jsx("div",{className:N("flex flex-col gap-2",t),...e});Wu.displayName="SheetHeader";const Zu=({className:t,...e})=>l.jsx("div",{className:N("-mx-4 -mb-4 mt-auto flex flex-col-reverse gap-2 border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",t),...e});Zu.displayName="SheetFooter";const Bu=h.forwardRef(({className:t,...e},r)=>l.jsx(os,{ref:r,className:N("text-base font-medium leading-none text-foreground",t),...e}));Bu.displayName=os.displayName;const Uu=h.forwardRef(({className:t,...e},r)=>l.jsx(ls,{ref:r,className:N("text-sm text-muted-foreground",t),...e}));Uu.displayName=ls.displayName;function sa({className:t}){return l.jsx("div",{className:N("animate-pulse rounded-lg bg-muted/80",t)})}const Hu=h.forwardRef(({className:t,isInvalid:e,"aria-invalid":r,...n},s)=>{const a=e??(r===!0||r==="true");return l.jsx("textarea",{ref:s,"aria-invalid":a||void 0,className:N("min-h-20 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-sm text-foreground transition-[border-color,box-shadow,color,background-color] outline-none","placeholder:text-muted-foreground","focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50","disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50","dark:bg-input/30 dark:disabled:bg-input/80","resize-y",a&&"border-destructive focus-visible:border-destructive focus-visible:ring-destructive/20 dark:border-destructive/50 dark:focus-visible:ring-destructive/40",t),...n})});Hu.displayName="Textarea";const qu=h.createContext(null);function Ja(){const t=h.useContext(qu);if(!t)throw new Error("Tabs components must be used inside <Tabs>.");return t}function zy({children:t,className:e,defaultValue:r,onValueChange:n,orientation:s="horizontal",value:a,...i}){const o=h.useId(),[c,u]=h.useState(r),f=a!==void 0,d=f?a:c,m=h.useCallback(p=>{f||u(p),n?.(p)},[f,n]);return l.jsx(qu.Provider,{value:{baseId:o,onValueChange:m,orientation:s,value:d},children:l.jsx("div",{className:N("w-full",e),"data-orientation":s,...i,children:t})})}const Yu=h.forwardRef(({className:t,onKeyDown:e,...r},n)=>{const{onValueChange:s,orientation:a}=Ja();return l.jsx("div",{ref:n,role:"tablist","aria-orientation":a,className:N("inline-flex w-fit items-center gap-1 rounded-lg bg-muted p-1 text-muted-foreground ring-1 ring-foreground/10",a==="vertical"&&"flex-col items-stretch",t),onKeyDown:i=>{const o=a==="horizontal"?i.key==="ArrowRight":i.key==="ArrowDown",c=a==="horizontal"?i.key==="ArrowLeft":i.key==="ArrowUp",u=i.key==="Home"||i.key==="End";if(!o&&!c&&!u){e?.(i);return}const f=Array.from(i.currentTarget.querySelectorAll('[role="tab"]:not(:disabled)'));if(f.length===0){e?.(i);return}const d=f.findIndex(g=>g===document.activeElement);let m=d===-1?0:d;o&&(m=(d+1+f.length)%f.length),c&&(m=(d-1+f.length)%f.length),i.key==="Home"&&(m=0),i.key==="End"&&(m=f.length-1),i.preventDefault();const p=f[m];p?.focus();const y=p?.dataset.value;y&&s(y),e?.(i)},...r})});Yu.displayName="TabsList";const Gu=h.forwardRef(({children:t,className:e,value:r,...n},s)=>{const{baseId:a,onValueChange:i,orientation:o,value:c}=Ja(),u=r===c;return l.jsx("button",{ref:s,id:`${a}-trigger-${r}`,type:"button",role:"tab","aria-controls":`${a}-content-${r}`,"aria-selected":u,tabIndex:u?0:-1,"data-state":u?"active":"inactive","data-value":r,className:N("inline-flex h-8 items-center justify-center gap-1.5 rounded-md px-2.5 text-sm font-medium transition-[background-color,color,box-shadow,transform] outline-none","focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50","data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-card-sm","data-[state=inactive]:text-muted-foreground hover:text-foreground",o==="vertical"&&"justify-start",e),onClick:()=>i(r),...n,children:t})});Gu.displayName="TabsTrigger";const Xu=h.forwardRef(({className:t,forceMount:e=!1,value:r,...n},s)=>{const{baseId:a,value:i}=Ja(),o=r===i;return!o&&!e?null:l.jsx("div",{ref:s,id:`${a}-content-${r}`,role:"tabpanel","aria-labelledby":`${a}-trigger-${r}`,hidden:!o,tabIndex:0,"data-state":o?"active":"inactive",className:N("mt-4 outline-none focus-visible:ring-3 focus-visible:ring-ring/50",!o&&"hidden",t),...n})});Xu.displayName="TabsContent";function Wy(t){const e=h.useRef({value:t,previous:t});return h.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var ms="Switch",[Zy]=Un(ms),[By,Uy]=Zy(ms),Ju=h.forwardRef((t,e)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:a,required:i,disabled:o,value:c="on",onCheckedChange:u,form:f,...d}=t,[m,p]=h.useState(null),y=$e(e,C=>p(C)),g=h.useRef(!1),x=m?f||!!m.closest("form"):!0,[v,S]=Ta({prop:s,defaultProp:a??!1,onChange:u,caller:ms});return l.jsxs(By,{scope:r,checked:v,disabled:o,children:[l.jsx(_e.button,{type:"button",role:"switch","aria-checked":v,"aria-required":i,"data-state":td(v),"data-disabled":o?"":void 0,disabled:o,value:c,...d,ref:y,onClick:Re(t.onClick,C=>{S(k=>!k),x&&(g.current=C.isPropagationStopped(),g.current||C.stopPropagation())})}),x&&l.jsx(ed,{control:m,bubbles:!g.current,name:n,value:c,checked:v,required:i,disabled:o,form:f,style:{transform:"translateX(-100%)"}})]})});Ju.displayName=ms;var Ku="SwitchThumb",Qu=h.forwardRef((t,e)=>{const{__scopeSwitch:r,...n}=t,s=Uy(Ku,r);return l.jsx(_e.span,{"data-state":td(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:e})});Qu.displayName=Ku;var Hy="SwitchBubbleInput",ed=h.forwardRef(({__scopeSwitch:t,control:e,checked:r,bubbles:n=!0,...s},a)=>{const i=h.useRef(null),o=$e(i,a),c=Wy(r),u=kl(e);return h.useEffect(()=>{const f=i.current;if(!f)return;const d=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(d,"checked").set;if(c!==r&&p){const y=new Event("click",{bubbles:n});p.call(f,r),f.dispatchEvent(y)}},[c,r,n]),l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:o,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});ed.displayName=Hy;function td(t){return t?"checked":"unchecked"}var qy=Ju,Yy=Qu;const tn=h.forwardRef(({checked:t,defaultChecked:e=!1,onChange:r,size:n="md",disabled:s=!1,label:a,className:i,ariaLabel:o,id:c},u)=>{const f=h.useId(),d=c??f;return l.jsxs("div",{className:N("flex items-center gap-2",i),children:[l.jsx(qy,{ref:u,id:d,checked:t,defaultChecked:e,onCheckedChange:r,disabled:s,"aria-label":o,className:N("peer inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent transition-[background-color,box-shadow] outline-none","focus-visible:ring-3 focus-visible:ring-ring/50","disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-muted/60",n==="sm"?"h-4 w-7":"h-5 w-9"),children:l.jsx(Yy,{className:N("pointer-events-none block rounded-full bg-background shadow-sm ring-1 ring-black/10 transition-transform dark:ring-white/20",n==="sm"?"h-3 w-3 translate-x-0.5 data-[state=checked]:translate-x-3":"h-4 w-4 translate-x-0.5 data-[state=checked]:translate-x-4")})}),a&&l.jsx("label",{htmlFor:d,className:N("text-sm font-medium text-foreground",s&&"cursor-not-allowed opacity-50"),children:a})]})});tn.displayName="Toggle";const Gy=tn;function Xy(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}const Jy=t=>{switch(t){case"success":return ev;case"info":return rv;case"warning":return tv;case"error":return nv;default:return null}},Ky=Array(12).fill(0),Qy=({visible:t,className:e})=>b.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},b.createElement("div",{className:"sonner-spinner"},Ky.map((r,n)=>b.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),ev=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},b.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),tv=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},b.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),rv=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},b.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),nv=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},b.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),sv=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},b.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),b.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),av=()=>{const[t,e]=b.useState(document.hidden);return b.useEffect(()=>{const r=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t};let aa=1;class iv{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const r=this.subscribers.indexOf(e);this.subscribers.splice(r,1)}),this.publish=e=>{this.subscribers.forEach(r=>r(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var r;const{message:n,...s}=e,a=typeof e?.id=="number"||((r=e.id)==null?void 0:r.length)>0?e.id:aa++,i=this.toasts.find(c=>c.id===a),o=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),i?this.toasts=this.toasts.map(c=>c.id===a?(this.publish({...c,...e,id:a,title:n}),{...c,...e,id:a,dismissible:o,title:n}):c):this.addToast({title:n,...s,dismissible:o,id:a}),a},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:e,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),e),this.message=(e,r)=>this.create({...r,message:e}),this.error=(e,r)=>this.create({...r,message:e,type:"error"}),this.success=(e,r)=>this.create({...r,type:"success",message:e}),this.info=(e,r)=>this.create({...r,type:"info",message:e}),this.warning=(e,r)=>this.create({...r,type:"warning",message:e}),this.loading=(e,r)=>this.create({...r,type:"loading",message:e}),this.promise=(e,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:e,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const s=Promise.resolve(e instanceof Function?e():e);let a=n!==void 0,i;const o=s.then(async u=>{if(i=["resolve",u],b.isValidElement(u))a=!1,this.create({id:n,type:"default",message:u});else if(lv(u)&&!u.ok){a=!1;const d=typeof r.error=="function"?await r.error(`HTTP error! status: ${u.status}`):r.error,m=typeof r.description=="function"?await r.description(`HTTP error! status: ${u.status}`):r.description,y=typeof d=="object"&&!b.isValidElement(d)?d:{message:d};this.create({id:n,type:"error",description:m,...y})}else if(u instanceof Error){a=!1;const d=typeof r.error=="function"?await r.error(u):r.error,m=typeof r.description=="function"?await r.description(u):r.description,y=typeof d=="object"&&!b.isValidElement(d)?d:{message:d};this.create({id:n,type:"error",description:m,...y})}else if(r.success!==void 0){a=!1;const d=typeof r.success=="function"?await r.success(u):r.success,m=typeof r.description=="function"?await r.description(u):r.description,y=typeof d=="object"&&!b.isValidElement(d)?d:{message:d};this.create({id:n,type:"success",description:m,...y})}}).catch(async u=>{if(i=["reject",u],r.error!==void 0){a=!1;const f=typeof r.error=="function"?await r.error(u):r.error,d=typeof r.description=="function"?await r.description(u):r.description,p=typeof f=="object"&&!b.isValidElement(f)?f:{message:f};this.create({id:n,type:"error",description:d,...p})}}).finally(()=>{a&&(this.dismiss(n),n=void 0),r.finally==null||r.finally.call(r)}),c=()=>new Promise((u,f)=>o.then(()=>i[0]==="reject"?f(i[1]):u(i[1])).catch(f));return typeof n!="string"&&typeof n!="number"?{unwrap:c}:Object.assign(n,{unwrap:c})},this.custom=(e,r)=>{const n=r?.id||aa++;return this.create({jsx:e(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const De=new iv,ov=(t,e)=>{const r=e?.id||aa++;return De.addToast({title:t,...e,id:r}),r},lv=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",cv=ov,uv=()=>De.toasts,dv=()=>De.getActiveToasts(),fv=Object.assign(cv,{success:De.success,info:De.info,warning:De.warning,error:De.error,custom:De.custom,message:De.message,promise:De.promise,dismiss:De.dismiss,loading:De.loading},{getHistory:uv,getToasts:dv});Xy("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function yn(t){return t.label!==void 0}const hv=3,mv="24px",pv="16px",yo=4e3,gv=356,yv=14,vv=45,xv=200;function nt(...t){return t.filter(Boolean).join(" ")}function bv(t){const[e,r]=t.split("-"),n=[];return e&&n.push(e),r&&n.push(r),n}const wv=t=>{var e,r,n,s,a,i,o,c,u;const{invert:f,toast:d,unstyled:m,interacting:p,setHeights:y,visibleToasts:g,heights:x,index:v,toasts:S,expanded:C,removeToast:k,defaultRichColors:w,closeButton:j,style:T,cancelButtonStyle:A,actionButtonStyle:$,className:L="",descriptionClassName:W="",duration:B,position:G,gap:Q,expandByDefault:H,classNames:P,icons:U,closeButtonAriaLabel:V="Close toast"}=t,[ie,F]=b.useState(null),[D,ee]=b.useState(null),[z,oe]=b.useState(!1),[ce,ve]=b.useState(!1),[Te,le]=b.useState(!1),[vt,Yt]=b.useState(!1),[Gt,xt]=b.useState(!1),[Xt,ps]=b.useState(0),[bd,ri]=b.useState(0),Er=b.useRef(d.duration||B||yo),ni=b.useRef(null),ht=b.useRef(null),wd=v===0,kd=v+1<=g,Ae=d.type,Jt=d.dismissible!==!1,Sd=d.className||"",Nd=d.descriptionClassName||"",rn=b.useMemo(()=>x.findIndex(X=>X.toastId===d.id)||0,[x,d.id]),Cd=b.useMemo(()=>{var X;return(X=d.closeButton)!=null?X:j},[d.closeButton,j]),si=b.useMemo(()=>d.duration||B||yo,[d.duration,B]),gs=b.useRef(0),Kt=b.useRef(0),ai=b.useRef(0),Qt=b.useRef(null),[_d,Td]=G.split("-"),ii=b.useMemo(()=>x.reduce((X,xe,we)=>we>=rn?X:X+xe.height,0),[x,rn]),oi=av(),jd=d.invert||f,ys=Ae==="loading";Kt.current=b.useMemo(()=>rn*Q+ii,[rn,ii]),b.useEffect(()=>{Er.current=si},[si]),b.useEffect(()=>{oe(!0)},[]),b.useEffect(()=>{const X=ht.current;if(X){const xe=X.getBoundingClientRect().height;return ri(xe),y(we=>[{toastId:d.id,height:xe,position:d.position},...we]),()=>y(we=>we.filter(Me=>Me.toastId!==d.id))}},[y,d.id]),b.useLayoutEffect(()=>{if(!z)return;const X=ht.current,xe=X.style.height;X.style.height="auto";const we=X.getBoundingClientRect().height;X.style.height=xe,ri(we),y(Me=>Me.find(be=>be.toastId===d.id)?Me.map(be=>be.toastId===d.id?{...be,height:we}:be):[{toastId:d.id,height:we,position:d.position},...Me])},[z,d.title,d.description,y,d.id,d.jsx,d.action,d.cancel]);const bt=b.useCallback(()=>{ve(!0),ps(Kt.current),y(X=>X.filter(xe=>xe.toastId!==d.id)),setTimeout(()=>{k(d)},xv)},[d,k,y,Kt]);b.useEffect(()=>{if(d.promise&&Ae==="loading"||d.duration===1/0||d.type==="loading")return;let X;return C||p||oi?(()=>{if(ai.current<gs.current){const Me=new Date().getTime()-gs.current;Er.current=Er.current-Me}ai.current=new Date().getTime()})():Er.current!==1/0&&(gs.current=new Date().getTime(),X=setTimeout(()=>{d.onAutoClose==null||d.onAutoClose.call(d,d),bt()},Er.current)),()=>clearTimeout(X)},[C,p,d,Ae,oi,bt]),b.useEffect(()=>{d.delete&&(bt(),d.onDismiss==null||d.onDismiss.call(d,d))},[bt,d.delete]);function Ed(){var X;if(U?.loading){var xe;return b.createElement("div",{className:nt(P?.loader,d==null||(xe=d.classNames)==null?void 0:xe.loader,"sonner-loader"),"data-visible":Ae==="loading"},U.loading)}return b.createElement(Qy,{className:nt(P?.loader,d==null||(X=d.classNames)==null?void 0:X.loader),visible:Ae==="loading"})}const Od=d.icon||U?.[Ae]||Jy(Ae);var li,ci;return b.createElement("li",{tabIndex:0,ref:ht,className:nt(L,Sd,P?.toast,d==null||(e=d.classNames)==null?void 0:e.toast,P?.default,P?.[Ae],d==null||(r=d.classNames)==null?void 0:r[Ae]),"data-sonner-toast":"","data-rich-colors":(li=d.richColors)!=null?li:w,"data-styled":!(d.jsx||d.unstyled||m),"data-mounted":z,"data-promise":!!d.promise,"data-swiped":Gt,"data-removed":ce,"data-visible":kd,"data-y-position":_d,"data-x-position":Td,"data-index":v,"data-front":wd,"data-swiping":Te,"data-dismissible":Jt,"data-type":Ae,"data-invert":jd,"data-swipe-out":vt,"data-swipe-direction":D,"data-expanded":!!(C||H&&z),"data-testid":d.testId,style:{"--index":v,"--toasts-before":v,"--z-index":S.length-v,"--offset":`${ce?Xt:Kt.current}px`,"--initial-height":H?"auto":`${bd}px`,...T,...d.style},onDragEnd:()=>{le(!1),F(null),Qt.current=null},onPointerDown:X=>{X.button!==2&&(ys||!Jt||(ni.current=new Date,ps(Kt.current),X.target.setPointerCapture(X.pointerId),X.target.tagName!=="BUTTON"&&(le(!0),Qt.current={x:X.clientX,y:X.clientY})))},onPointerUp:()=>{var X,xe,we;if(vt||!Jt)return;Qt.current=null;const Me=Number(((X=ht.current)==null?void 0:X.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),nn=Number(((xe=ht.current)==null?void 0:xe.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),be=new Date().getTime()-((we=ni.current)==null?void 0:we.getTime()),ze=ie==="x"?Me:nn,sn=Math.abs(ze)/be;if(Math.abs(ze)>=vv||sn>.11){ps(Kt.current),d.onDismiss==null||d.onDismiss.call(d,d),ee(ie==="x"?Me>0?"right":"left":nn>0?"down":"up"),bt(),Yt(!0);return}else{var He,qe;(He=ht.current)==null||He.style.setProperty("--swipe-amount-x","0px"),(qe=ht.current)==null||qe.style.setProperty("--swipe-amount-y","0px")}xt(!1),le(!1),F(null)},onPointerMove:X=>{var xe,we,Me;if(!Qt.current||!Jt||((xe=window.getSelection())==null?void 0:xe.toString().length)>0)return;const be=X.clientY-Qt.current.y,ze=X.clientX-Qt.current.x;var sn;const He=(sn=t.swipeDirections)!=null?sn:bv(G);!ie&&(Math.abs(ze)>1||Math.abs(be)>1)&&F(Math.abs(ze)>Math.abs(be)?"x":"y");let qe={x:0,y:0};const ui=Mt=>1/(1.5+Math.abs(Mt)/20);if(ie==="y"){if(He.includes("top")||He.includes("bottom"))if(He.includes("top")&&be<0||He.includes("bottom")&&be>0)qe.y=be;else{const Mt=be*ui(be);qe.y=Math.abs(Mt)<Math.abs(be)?Mt:be}}else if(ie==="x"&&(He.includes("left")||He.includes("right")))if(He.includes("left")&&ze<0||He.includes("right")&&ze>0)qe.x=ze;else{const Mt=ze*ui(ze);qe.x=Math.abs(Mt)<Math.abs(ze)?Mt:ze}(Math.abs(qe.x)>0||Math.abs(qe.y)>0)&&xt(!0),(we=ht.current)==null||we.style.setProperty("--swipe-amount-x",`${qe.x}px`),(Me=ht.current)==null||Me.style.setProperty("--swipe-amount-y",`${qe.y}px`)}},Cd&&!d.jsx&&Ae!=="loading"?b.createElement("button",{"aria-label":V,"data-disabled":ys,"data-close-button":!0,onClick:ys||!Jt?()=>{}:()=>{bt(),d.onDismiss==null||d.onDismiss.call(d,d)},className:nt(P?.closeButton,d==null||(n=d.classNames)==null?void 0:n.closeButton)},(ci=U?.close)!=null?ci:sv):null,(Ae||d.icon||d.promise)&&d.icon!==null&&(U?.[Ae]!==null||d.icon)?b.createElement("div",{"data-icon":"",className:nt(P?.icon,d==null||(s=d.classNames)==null?void 0:s.icon)},d.promise||d.type==="loading"&&!d.icon?d.icon||Ed():null,d.type!=="loading"?Od:null):null,b.createElement("div",{"data-content":"",className:nt(P?.content,d==null||(a=d.classNames)==null?void 0:a.content)},b.createElement("div",{"data-title":"",className:nt(P?.title,d==null||(i=d.classNames)==null?void 0:i.title)},d.jsx?d.jsx:typeof d.title=="function"?d.title():d.title),d.description?b.createElement("div",{"data-description":"",className:nt(W,Nd,P?.description,d==null||(o=d.classNames)==null?void 0:o.description)},typeof d.description=="function"?d.description():d.description):null),b.isValidElement(d.cancel)?d.cancel:d.cancel&&yn(d.cancel)?b.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||A,onClick:X=>{yn(d.cancel)&&Jt&&(d.cancel.onClick==null||d.cancel.onClick.call(d.cancel,X),bt())},className:nt(P?.cancelButton,d==null||(c=d.classNames)==null?void 0:c.cancelButton)},d.cancel.label):null,b.isValidElement(d.action)?d.action:d.action&&yn(d.action)?b.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||$,onClick:X=>{yn(d.action)&&(d.action.onClick==null||d.action.onClick.call(d.action,X),!X.defaultPrevented&&bt())},className:nt(P?.actionButton,d==null||(u=d.classNames)==null?void 0:u.actionButton)},d.action.label):null)};function vo(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function kv(t,e){const r={};return[t,e].forEach((n,s)=>{const a=s===1,i=a?"--mobile-offset":"--offset",o=a?pv:mv;function c(u){["top","right","bottom","left"].forEach(f=>{r[`${i}-${f}`]=typeof u=="number"?`${u}px`:u})}typeof n=="number"||typeof n=="string"?c(n):typeof n=="object"?["top","right","bottom","left"].forEach(u=>{n[u]===void 0?r[`${i}-${u}`]=o:r[`${i}-${u}`]=typeof n[u]=="number"?`${n[u]}px`:n[u]}):c(o)}),r}const Sv=b.forwardRef(function(e,r){const{id:n,invert:s,position:a="bottom-right",hotkey:i=["altKey","KeyT"],expand:o,closeButton:c,className:u,offset:f,mobileOffset:d,theme:m="light",richColors:p,duration:y,style:g,visibleToasts:x=hv,toastOptions:v,dir:S=vo(),gap:C=yv,icons:k,containerAriaLabel:w="Notifications"}=e,[j,T]=b.useState([]),A=b.useMemo(()=>n?j.filter(z=>z.toasterId===n):j.filter(z=>!z.toasterId),[j,n]),$=b.useMemo(()=>Array.from(new Set([a].concat(A.filter(z=>z.position).map(z=>z.position)))),[A,a]),[L,W]=b.useState([]),[B,G]=b.useState(!1),[Q,H]=b.useState(!1),[P,U]=b.useState(m!=="system"?m:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),V=b.useRef(null),ie=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),F=b.useRef(null),D=b.useRef(!1),ee=b.useCallback(z=>{T(oe=>{var ce;return(ce=oe.find(ve=>ve.id===z.id))!=null&&ce.delete||De.dismiss(z.id),oe.filter(({id:ve})=>ve!==z.id)})},[]);return b.useEffect(()=>De.subscribe(z=>{if(z.dismiss){requestAnimationFrame(()=>{T(oe=>oe.map(ce=>ce.id===z.id?{...ce,delete:!0}:ce))});return}setTimeout(()=>{ma.flushSync(()=>{T(oe=>{const ce=oe.findIndex(ve=>ve.id===z.id);return ce!==-1?[...oe.slice(0,ce),{...oe[ce],...z},...oe.slice(ce+1)]:[z,...oe]})})})}),[j]),b.useEffect(()=>{if(m!=="system"){U(m);return}if(m==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?U("dark"):U("light")),typeof window>"u")return;const z=window.matchMedia("(prefers-color-scheme: dark)");try{z.addEventListener("change",({matches:oe})=>{U(oe?"dark":"light")})}catch{z.addListener(({matches:ce})=>{try{U(ce?"dark":"light")}catch(ve){console.error(ve)}})}},[m]),b.useEffect(()=>{j.length<=1&&G(!1)},[j]),b.useEffect(()=>{const z=oe=>{var ce;if(i.every(le=>oe[le]||oe.code===le)){var Te;G(!0),(Te=V.current)==null||Te.focus()}oe.code==="Escape"&&(document.activeElement===V.current||(ce=V.current)!=null&&ce.contains(document.activeElement))&&G(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[i]),b.useEffect(()=>{if(V.current)return()=>{F.current&&(F.current.focus({preventScroll:!0}),F.current=null,D.current=!1)}},[V.current]),b.createElement("section",{ref:r,"aria-label":`${w} ${ie}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},$.map((z,oe)=>{var ce;const[ve,Te]=z.split("-");return A.length?b.createElement("ol",{key:z,dir:S==="auto"?vo():S,tabIndex:-1,ref:V,className:u,"data-sonner-toaster":!0,"data-sonner-theme":P,"data-y-position":ve,"data-x-position":Te,style:{"--front-toast-height":`${((ce=L[0])==null?void 0:ce.height)||0}px`,"--width":`${gv}px`,"--gap":`${C}px`,...g,...kv(f,d)},onBlur:le=>{D.current&&!le.currentTarget.contains(le.relatedTarget)&&(D.current=!1,F.current&&(F.current.focus({preventScroll:!0}),F.current=null))},onFocus:le=>{le.target instanceof HTMLElement&&le.target.dataset.dismissible==="false"||D.current||(D.current=!0,F.current=le.relatedTarget)},onMouseEnter:()=>G(!0),onMouseMove:()=>G(!0),onMouseLeave:()=>{Q||G(!1)},onDragEnd:()=>G(!1),onPointerDown:le=>{le.target instanceof HTMLElement&&le.target.dataset.dismissible==="false"||H(!0)},onPointerUp:()=>H(!1)},A.filter(le=>!le.position&&oe===0||le.position===z).map((le,vt)=>{var Yt,Gt;return b.createElement(wv,{key:le.id,icons:k,index:vt,toast:le,defaultRichColors:p,duration:(Yt=v?.duration)!=null?Yt:y,className:v?.className,descriptionClassName:v?.descriptionClassName,invert:s,visibleToasts:x,closeButton:(Gt=v?.closeButton)!=null?Gt:c,interacting:Q,position:z,style:v?.style,unstyled:v?.unstyled,classNames:v?.classNames,cancelButtonStyle:v?.cancelButtonStyle,actionButtonStyle:v?.actionButtonStyle,closeButtonAriaLabel:v?.closeButtonAriaLabel,removeToast:ee,toasts:A.filter(xt=>xt.position==le.position),heights:L.filter(xt=>xt.position==le.position),setHeights:W,expandByDefault:o,gap:C,expanded:B,swipeDirections:e.swipeDirections})})):null}))});function Nv({...t}){return l.jsx(Sv,{position:"bottom-right",richColors:!1,toastOptions:{classNames:{toast:"group toast rounded-xl bg-background text-foreground shadow-card-sm ring-1 ring-foreground/10",title:"text-sm font-medium",description:"text-sm text-muted-foreground",actionButton:"!h-8 !rounded-md !border-0 !bg-primary !px-2.5 !text-sm !font-medium !text-primary-foreground",cancelButton:"!h-8 !rounded-md !border !border-border !bg-background !px-2.5 !text-sm !font-medium !text-foreground hover:!bg-muted",error:"!bg-destructive/10 !text-foreground !ring-destructive/20",success:"!bg-primary/5 !text-foreground !ring-primary/15",warning:"!bg-amber-500/10 !text-foreground !ring-amber-500/20",info:"!bg-accent !text-accent-foreground !ring-foreground/10"}},...t})}const Cv=zt.Provider,_v=zt.Root,Tv=zt.Trigger,rd=b.forwardRef(({className:t,sideOffset:e=6,children:r,...n},s)=>l.jsx(zt.Portal,{children:l.jsxs(zt.Content,{ref:s,sideOffset:e,className:N("z-50 overflow-hidden rounded-md bg-foreground px-2.5 py-1 text-xs font-medium text-background shadow-card-sm","transition-[opacity,transform] duration-100","data-[state=closed]:opacity-0 data-[state=closed]:scale-95","data-[state=delayed-open]:opacity-100 data-[state=delayed-open]:scale-100",t),...n,children:[r,l.jsx(zt.Arrow,{className:"fill-foreground"})]})}));rd.displayName=zt.Content.displayName;const nd=({logo:t,children:e,footer:r,className:n})=>l.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gradient-to-br from-[--surface-1] via-[--surface-2] to-[--surface-1] px-4 py-12",children:l.jsxs("div",{className:N("w-full max-w-sm rounded-xl bg-[--surface-1] p-8","shadow-[var(--shadow-card-xl)] border border-[--border-1]","flex flex-col gap-6",n),children:[t&&l.jsx("div",{className:"flex justify-center",children:t.href?l.jsx("a",{href:t.href,className:"focus-visible:outline-none focus-visible:ring-2",children:l.jsx("img",{src:t.src,alt:t.alt,className:"h-10 w-auto"})}):l.jsx("img",{src:t.src,alt:t.alt,className:"h-10 w-auto"})}),l.jsx("div",{className:"flex flex-col gap-4",children:e}),r&&l.jsx("div",{className:"border-t border-[--border-1] pt-4 text-center text-xs text-[--text-2]",children:r})]})});nd.displayName="AuthLayout";function jv({items:t,className:e,separator:r,renderLink:n}){const s=r??l.jsx(J.ChevronRight,{className:"h-4 w-4 text-[color:var(--oniratec-label-secondary)]"});return l.jsx("nav",{"aria-label":"Breadcrumb",className:e,children:l.jsx("ol",{className:"flex flex-wrap items-center gap-2 text-sm",children:t.map((a,i)=>{const o=i===t.length-1,c=l.jsx("span",{className:N("transition-colors",o?"font-medium text-[color:var(--oniratec-label-primary)]":"text-[color:var(--oniratec-label-secondary)] hover:text-[color:var(--oniratec-label-primary)]"),children:a.label}),u="inline-flex items-center gap-1 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--oniratec-focus)] focus-visible:ring-offset-2 focus-visible:ring-offset-[color:var(--oniratec-fill-primary)]";return l.jsxs("li",{className:"flex items-center gap-2",children:[o?l.jsx("span",{"aria-current":"page",children:c}):n?n({item:a,className:u,children:c}):a.href?l.jsx("a",{href:a.href,className:u,children:c}):l.jsx("button",{type:"button",onClick:a.onClick,className:u,children:c}),!o&&l.jsx("span",{"aria-hidden":"true",children:s})]},`${a.label}-${i}`)})})})}function Ev({open:t,onOpenChange:e,title:r,description:n,confirmLabel:s="Confirmar",cancelLabel:a="Cancelar",variant:i="default",onConfirm:o,loading:c=!1}){const u=async()=>{await o()};return l.jsx(bu,{open:t,onOpenChange:e,children:l.jsxs(Wa,{size:"sm",hideClose:!0,children:[l.jsxs(Za,{children:[l.jsx(Ua,{children:r}),n&&l.jsx(Ha,{children:n})]}),l.jsxs(Ba,{children:[l.jsx(Le,{variant:"secondary",onClick:()=>e(!1),disabled:c,children:a}),l.jsxs(Le,{variant:i==="destructive"?"destructive":"default",onClick:u,disabled:c,children:[c&&l.jsx(J.Loader2,{className:"h-4 w-4 animate-spin"}),s]})]})]})})}const xo="onira-sidebar-collapsed",Ov=({to:t,children:e,className:r,onClick:n})=>l.jsx("a",{href:t,className:r,onClick:n,children:e});function Dv({item:t,collapsed:e,LinkComponent:r,onMobileClose:n}){const s=r??Ov,a=t.icon;return l.jsxs(s,{to:t.to,end:t.end,className:N("group flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition-colors","text-muted-foreground hover:bg-accent hover:text-accent-foreground","aria-[current=page]:bg-primary/10 aria-[current=page]:text-primary",e&&"justify-center px-2"),onClick:n,children:[a&&l.jsx(a,{className:N("h-4 w-4 shrink-0 transition-colors","group-[.active]:text-primary")}),!e&&l.jsx("span",{className:"flex-1 truncate",children:t.label}),!e&&t.badge!==void 0&&l.jsx(pa,{variant:"secondary",size:"sm",children:t.badge})]})}function bo({navSections:t,logo:e,appName:r,collapsed:n,LinkComponent:s,onMobileClose:a}){return l.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[l.jsxs("div",{className:N("flex h-14 items-center border-b border-border px-4 shrink-0",n?"justify-center px-2":"gap-2"),children:[e&&l.jsx("div",{className:"shrink-0",children:e}),!n&&r&&l.jsx("span",{className:"truncate text-sm font-semibold text-foreground",children:r})]}),l.jsx("nav",{className:"flex-1 overflow-y-auto px-2 py-3 space-y-4",children:t.map((i,o)=>l.jsxs("div",{className:"space-y-1",children:[!n&&i.title&&l.jsx("p",{className:"px-3 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:i.title}),i.items.map(c=>l.jsx(Dv,{item:c,collapsed:n,LinkComponent:s,onMobileClose:a},c.to))]},o))})]})}function Rv({navSections:t,logo:e,appName:r,headerActions:n,children:s,LinkComponent:a}){const[i,o]=h.useState(()=>{try{return localStorage.getItem(xo)==="true"}catch{return!1}}),[c,u]=h.useState(!1),f=()=>{const d=!i;o(d);try{localStorage.setItem(xo,String(d))}catch{return}};return l.jsxs("div",{className:"flex h-screen overflow-hidden bg-background",children:[l.jsxs("aside",{className:N("hidden md:flex flex-col border-r border-border bg-card transition-all duration-200 relative",i?"w-14":"w-60"),children:[l.jsx(bo,{navSections:t,logo:e,appName:r,collapsed:i,LinkComponent:a}),l.jsx("button",{type:"button",onClick:f,className:N("absolute -right-3 top-16 z-10 flex h-6 w-6 items-center justify-center rounded-full border border-border bg-background text-muted-foreground shadow-card-sm transition-colors hover:bg-accent hover:text-accent-foreground"),"aria-label":i?"Expandir sidebar":"Colapsar sidebar",children:i?l.jsx(J.ChevronRight,{className:"h-3 w-3"}):l.jsx(J.ChevronLeft,{className:"h-3 w-3"})})]}),c&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 md:hidden",onClick:()=>u(!1)}),l.jsxs("div",{className:"fixed inset-y-0 left-0 z-50 w-72 bg-card shadow-card-xl md:hidden",children:[l.jsx("div",{className:"absolute right-3 top-3",children:l.jsx("button",{type:"button",onClick:()=>u(!1),className:"rounded-md p-1.5 text-muted-foreground hover:text-foreground",children:l.jsx(J.X,{className:"h-5 w-5"})})}),l.jsx(bo,{navSections:t,logo:e,appName:r,collapsed:!1,LinkComponent:a,onMobileClose:()=>u(!1)})]})]}),l.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[l.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border bg-card px-4 md:px-6",children:[l.jsx("button",{type:"button",className:"md:hidden rounded-md p-1.5 text-muted-foreground hover:text-foreground",onClick:()=>u(!0),"aria-label":"Abrir menú",children:l.jsx(J.Menu,{className:"h-5 w-5"})}),l.jsx("div",{className:"hidden md:block"}),n&&l.jsx("div",{className:"flex items-center gap-2",children:n})]}),l.jsx("main",{className:"flex-1 overflow-y-auto",children:s})]})]})}function wo(t){return t?Array.isArray(t)?t:[t]:[]}function Av(t,e){return t==null&&e==null?0:t==null?1:e==null?-1:typeof t=="number"&&typeof e=="number"?t-e:typeof t=="boolean"&&typeof e=="boolean"?Number(t)-Number(e):t instanceof Date&&e instanceof Date?t.getTime()-e.getTime():String(t).localeCompare(String(e),void 0,{numeric:!0,sensitivity:"base"})}function sd({columns:t,data:e,enableSorting:r=!0,sortState:n,defaultSortState:s=null,onSortChange:a,unsortedIcon:i="muted",sortMode:o="single",manualSorting:c=!1,emptyContent:u,loadingContent:f,errorContent:d,isLoading:m=!1}){const[p,y]=b.useState(s),g=n!==void 0?n:p,x=wo(g),v=b.useMemo(()=>new Map(t.map(w=>[w.key,w])),[t]),S=b.useMemo(()=>{if(c||!r||x.length===0)return e;const w=[...e];return w.sort((j,T)=>{for(const A of x){const $=v.get(A.columnId);if(!$)continue;const W=($.sortFn??((B,G)=>{const Q=$.sortValue?.(B)??B[$.key],H=$.sortValue?.(G)??G[$.key];return Av(Q,H)}))(j,T);if(W!==0)return A.direction==="asc"?W:-W}return 0}),w},[e,c,x,v,r]),C=w=>{n===void 0&&y(w),a?.(w)},k=(w,j)=>{if(!(r&&(w.sortable??!!(w.sortFn||w.sortValue))))return;const A=wo(g),$=A.find(W=>W.columnId===w.key),L=$?.direction==="asc"?"desc":$?.direction==="desc"?null:"asc";if(o==="multi"&&j){const W=A.filter(B=>B.columnId!==w.key);L&&W.push({columnId:w.key,direction:L}),C(W.length?W:null);return}if(!L){C(null);return}C({columnId:w.key,direction:L})};return l.jsx("div",{className:"oniratec-data-table",children:l.jsxs("table",{className:"oniratec-data-table__table",children:[l.jsx("thead",{className:"oniratec-data-table__head",children:l.jsx("tr",{className:"oniratec-data-table__head-row",children:t.map(w=>{const j=r&&(w.sortable??!!(w.sortFn||w.sortValue)),A=x.find(L=>L.columnId===w.key)?.direction,$=j?A==="asc"?"ascending":A==="desc"?"descending":"none":void 0;return l.jsx("th",{scope:"col","aria-sort":$,className:N("oniratec-data-table__th",w.headerClassName),children:j?l.jsxs("button",{type:"button",onClick:L=>k(w,L.shiftKey),className:"oniratec-data-table__sort-button",children:[l.jsx("span",{className:"flex-1",children:w.header}),l.jsxs("span",{className:N("oniratec-data-table__sort-icon",A&&"oniratec-data-table__sort-icon--active",!A&&i==="placeholder"&&"opacity-0",!A&&i==="hidden"&&"hidden"),"aria-hidden":"true",children:[A==="asc"&&l.jsx(J.ChevronUp,{className:"h-4 w-4"}),A==="desc"&&l.jsx(J.ChevronDown,{className:"h-4 w-4"}),!A&&i!=="hidden"&&l.jsx(J.ChevronsUpDown,{className:"h-4 w-4"})]})]}):w.header},w.key)})})}),l.jsx("tbody",{className:"oniratec-data-table__divider",children:d&&!m?l.jsx("tr",{children:l.jsx("td",{colSpan:t.length,className:"oniratec-data-table__empty",children:d})}):m?l.jsx("tr",{children:l.jsx("td",{colSpan:t.length,className:"oniratec-data-table__empty",children:f??"Cargando..."})}):S.length===0?l.jsx("tr",{children:l.jsx("td",{colSpan:t.length,className:"oniratec-data-table__empty",children:u??"No hay datos disponibles."})}):S.map((w,j)=>l.jsx("tr",{className:"oniratec-data-table__row",children:t.map(T=>l.jsx("td",{className:N("oniratec-data-table__td",T.className),children:T.render(w)},T.key))},j))})]})})}const Mv=[5,10,25,50],ad=({value:t,onChange:e,options:r=Mv})=>l.jsxs("div",{className:"flex items-center gap-2 text-[color:var(--oniratec-label-secondary)]",children:[l.jsx("span",{children:"Mostrar"}),l.jsxs(fs,{value:t.toString(),onValueChange:n=>{e(parseInt(n))},children:[l.jsx(Kr,{children:l.jsx(hs,{})}),l.jsx(Qr,{children:(r??[]).map(n=>l.jsx(en,{value:n.toString(),children:String(n)},n))})]}),l.jsx("span",{children:"por página"})]}),Iv=({page:t,pageSize:e,total:r,onPageChange:n,onPageSizeChange:s})=>{const a=Math.ceil(r/e);if(a<=1&&r<=e)return null;const i=t+1,o="rounded-md border border-[color:var(--border-1)] px-3 py-1 text-[color:var(--text-1)] transition-colors hover:bg-[color:color-mix(in srgb, var(--brand) 12%, transparent)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--focus)] disabled:opacity-50 disabled:cursor-not-allowed";return l.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-4 text-sm text-[color:var(--text-2)]",children:[l.jsxs("span",{children:["Página ",i," de ",a]}),l.jsx(ad,{value:e,onChange:s}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{disabled:t===0,onClick:()=>n(t-1),"aria-label":"Página anterior",className:o,children:"Anterior"}),l.jsx("button",{disabled:t+1>=a,onClick:()=>n(t+1),"aria-label":"Página siguiente",className:o,children:"Siguiente"})]})]})};function id({filters:t,value:e,onChange:r,onReset:n,resetLabel:s="Resetear filtros",showReset:a=!0,className:i,layout:o="inline",actions:c}){const u=(m,p)=>{r({...e,[m]:p})},f=a&&!!n,d=o==="stacked"?"grid gap-4":"grid gap-4 sm:grid-cols-2 lg:grid-cols-3";return l.jsxs("section",{className:N("rounded-xl border border-[color:var(--border-1)] bg-[color:var(--surface-2)] p-4 shadow-[var(--shadow-card-sm)]",i),children:[l.jsx("div",{className:d,children:t.map(m=>l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-sm font-semibold text-[color:var(--text-1)]",children:m.label}),m.helperText&&l.jsx("span",{className:"text-xs text-[color:var(--text-2)]",children:m.helperText})]}),m.type==="text"&&l.jsx($r,{placeholder:m.placeholder,value:e[m.id]??"",onChange:p=>u(m.id,p.target.value),disabled:m.disabled}),m.type==="select"&&l.jsxs(fs,{value:e[m.id]??"",onValueChange:p=>u(m.id,p),disabled:m.disabled,children:[l.jsx(Kr,{children:l.jsx(hs,{placeholder:m.placeholder??"Seleccionar"})}),l.jsx(Qr,{children:m.options.map(p=>l.jsx(en,{value:p.value,children:p.label},p.value))})]}),m.type==="async-select"&&l.jsx(Ga,{value:e[m.id]??"",onValueChange:p=>u(m.id,p),placeholder:m.placeholder,searchPlaceholder:m.searchPlaceholder,minChars:m.minChars,debounceMs:m.debounceMs,fetcher:m.fetcher,getOptionLabel:m.getOptionLabel,getOptionValue:m.getOptionValue,emptyLabel:m.emptyLabel,loadingLabel:m.loadingLabel,emptyActionLabel:m.emptyActionLabel,onEmptyActionClick:m.onEmptyActionClick,disabled:m.disabled}),m.type==="toggle"&&l.jsx(tn,{checked:e[m.id]??!1,onChange:p=>u(m.id,p),disabled:m.disabled,ariaLabel:m.label,label:m.description}),m.type==="date"&&l.jsx(ns,{value:e[m.id]??null,onChange:p=>u(m.id,p??null),placeholder:m.placeholder,min:m.min,max:m.max,timeZone:m.timeZone,disabled:m.disabled})]},m.id))}),(f||c)&&l.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3",children:[f&&l.jsx(Le,{type:"button",variant:"ghost",onClick:n,children:s}),c&&l.jsx("div",{className:"flex items-center gap-2",children:c})]})]})}function od({title:t="Filtros",description:e,children:r,isOpen:n,onOpenChange:s,onApply:a,applyLabel:i="Aplicar filtros",closeLabel:o="Cerrar",className:c}){const u=b.useId(),f=e?`${u}-description`:void 0,d=n,m=b.useCallback(p=>{s(p)},[s]);return b.useEffect(()=>{if(!d)return;const p=y=>{y.key==="Escape"&&m(!1)};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[d,m]),b.useEffect(()=>{if(!d)return;const p=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=p}},[d]),d?l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",children:l.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":u,"aria-describedby":f,className:N("w-full max-w-3xl rounded-2xl border border-[color:var(--border-1)] bg-[color:var(--surface-1)] p-6 shadow-[var(--shadow-card-lg)]",c),children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h2",{id:u,className:"text-lg font-semibold text-[color:var(--text-1)]",children:t}),e&&l.jsx("p",{id:f,className:"text-sm text-[color:var(--text-2)]",children:e})]}),l.jsx("button",{type:"button",onClick:()=>m(!1),className:N("inline-flex h-9 w-9 items-center justify-center rounded-md","text-[color:var(--text-2)] transition-colors","hover:bg-[color:color-mix(in srgb, var(--brand) 12%, transparent)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--focus)]"),"aria-label":o,children:l.jsx(J.X,{className:"h-4 w-4"})})]}),l.jsx("div",{className:"mt-6",children:r}),l.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-end gap-2",children:[l.jsx(Le,{type:"button",variant:"ghost",onClick:()=>m(!1),children:o}),l.jsx(Le,{type:"button",onClick:()=>{a?.(),m(!1)},children:i})]})]})}):null}const Pv=".csv,.xlsx";function Fv({title:t="Importar datos",description:e="Sube un fichero CSV o XLSX para ejecutar la importacion.",helperText:r="El sistema procesara cada fila de forma tolerante.",accept:n=Pv,className:s,actionLabel:a="Importar",disabled:i=!1,loading:o=!1,summary:c,onImport:u}){const[f,d]=b.useState([]),m=f[0]??null,p=b.useMemo(()=>c?`Resultado: ${c.created} creados, ${c.updated} actualizados, ${c.failed} fallidos`:null,[c]),y=async()=>{!m||i||o||await u(m)};return l.jsxs("section",{className:N("rounded-xl border border-slate-200 bg-white p-4 shadow-sm space-y-3",s),children:[l.jsxs("header",{className:"space-y-1",children:[l.jsx("h3",{className:"text-sm font-semibold text-slate-900",children:t}),l.jsx("p",{className:"text-sm text-slate-600",children:e})]}),l.jsx(us,{files:f,onFilesChange:d,multiple:!1,accept:n,helperText:r,allowDrop:!0,showPreview:!1,disabled:i||o}),p&&l.jsx("p",{className:"text-sm text-slate-700",children:p}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Le,{type:"button",variant:"primary",onClick:()=>{y()},disabled:!m||i,loading:o,children:a})})]})}function Lv({title:t,value:e,delta:r,deltaLabel:n,icon:s,description:a,loading:i=!1,className:o}){const c=r!==void 0&&r>=0,u=r!==void 0&&r<0;return i?l.jsxs(zs,{className:N("p-6",o),children:[l.jsx(sa,{className:"mb-2 h-4 w-24"}),l.jsx(sa,{className:"h-8 w-32"})]}):l.jsxs(zs,{className:o,children:[l.jsx(Jo,{children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(Ko,{className:"text-sm font-medium text-muted-foreground",children:t}),s&&l.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-md bg-primary/10",children:l.jsx(s,{className:"h-4 w-4 text-primary"})})]})}),l.jsxs(Qo,{children:[l.jsx("div",{className:"text-2xl font-bold text-foreground",children:e}),(r!==void 0||a)&&l.jsxs("div",{className:"mt-1 flex items-center gap-1.5",children:[r!==void 0&&l.jsxs("span",{className:N("inline-flex items-center gap-0.5 text-xs font-medium",c&&"text-emerald-600",u&&"text-red-600"),children:[c?l.jsx(J.TrendingUp,{className:"h-3 w-3"}):l.jsx(J.TrendingDown,{className:"h-3 w-3"}),Math.abs(r),"%"]}),a&&l.jsx("p",{className:"text-xs text-muted-foreground",children:n??a})]})]})]})}function Vv({title:t,description:e,actions:r,className:n}){return l.jsxs("div",{className:N("flex items-start justify-between gap-4",n),children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:t}),e&&l.jsx("p",{className:"text-sm text-muted-foreground",children:e})]}),r&&l.jsx("div",{className:"flex shrink-0 items-center gap-2",children:r})]})}function $v({mode:t="light",theme:e="nova",children:r}){return b.useEffect(()=>{const n=document.documentElement;n.dataset.mode=t,n.dataset.theme=e,n.classList.toggle("dark",t==="dark"),n.style.colorScheme=t},[t,e]),r}var ne;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},t.getValidEnumValues=s=>{const a=t.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},t.find=(s,a)=>{for(const i of s)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(ne||(ne={}));var ko;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(ko||(ko={}));const R=ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Nt=t=>{switch(typeof t){case"undefined":return R.undefined;case"string":return R.string;case"number":return Number.isNaN(t)?R.nan:R.number;case"boolean":return R.boolean;case"function":return R.function;case"bigint":return R.bigint;case"symbol":return R.symbol;case"object":return Array.isArray(t)?R.array:t===null?R.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?R.promise:typeof Map<"u"&&t instanceof Map?R.map:typeof Set<"u"&&t instanceof Set?R.set:typeof Date<"u"&&t instanceof Date?R.date:R.object;default:return R.unknown}},_=ne.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class yt extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let o=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(r(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return s(this),n}static assert(e){if(!(e instanceof yt))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ne.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];r[a]=r[a]||[],r[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}yt.create=t=>new yt(t);const ia=(t,e)=>{let r;switch(t.code){case _.invalid_type:t.received===R.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case _.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ne.jsonStringifyReplacer)}`;break;case _.unrecognized_keys:r=`Unrecognized key(s) in object: ${ne.joinValues(t.keys,", ")}`;break;case _.invalid_union:r="Invalid input";break;case _.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ne.joinValues(t.options)}`;break;case _.invalid_enum_value:r=`Invalid enum value. Expected ${ne.joinValues(t.options)}, received '${t.received}'`;break;case _.invalid_arguments:r="Invalid function arguments";break;case _.invalid_return_type:r="Invalid function return type";break;case _.invalid_date:r="Invalid date";break;case _.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ne.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case _.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case _.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case _.custom:r="Invalid input";break;case _.invalid_intersection_types:r="Intersection results could not be merged";break;case _.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case _.not_finite:r="Number must be finite";break;default:r=e.defaultError,ne.assertNever(t)}return{message:r}};let zv=ia;function Wv(){return zv}const Zv=t=>{const{data:e,path:r,errorMaps:n,issueData:s}=t,a=[...r,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)o=u(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}};function O(t,e){const r=Wv(),n=Zv({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ia?void 0:ia].filter(s=>!!s)});t.common.issues.push(n)}class Ve{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const s of r){if(s.status==="aborted")return q;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const s of r){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return Ve.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const s of r){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return q;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const q=Object.freeze({status:"aborted"}),Mr=t=>({status:"dirty",value:t}),Ue=t=>({status:"valid",value:t}),So=t=>t.status==="aborted",No=t=>t.status==="dirty",yr=t=>t.status==="valid",Ln=t=>typeof Promise<"u"&&t instanceof Promise;var M;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(M||(M={}));class Dt{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Co=(t,e)=>{if(yr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new yt(t.common.issues);return this._error=r,this._error}}};function K(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{const{message:c}=t;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??r??o.defaultError}},description:s}}class re{get description(){return this._def.description}_getType(e){return Nt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ve,ctx:{common:e.parent.common,data:e.data,parsedType:Nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(Ln(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nt(e)},s=this._parseSync({data:e,path:n.path,parent:n});return Co(n,s)}"~validate"(e){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nt(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:r});return yr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>yr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nt(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Ln(s)?s:Promise.resolve(s));return Co(n,a)}refine(e,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:_.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new xr({schema:this,typeName:Y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Tt.create(this,this._def)}nullable(){return br.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ct.create(this)}promise(){return Wn.create(this,this._def)}or(e){return $n.create([this,e],this._def)}and(e){return zn.create(this,e,this._def)}transform(e){return new xr({...K(this._def),schema:this,typeName:Y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new ca({...K(this._def),innerType:this,defaultValue:r,typeName:Y.ZodDefault})}brand(){return new fx({typeName:Y.ZodBranded,type:this,...K(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new ua({...K(this._def),innerType:this,catchValue:r,typeName:Y.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ka.create(this,e)}readonly(){return da.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Bv=/^c[^\s-]{8,}$/i,Uv=/^[0-9a-z]+$/,Hv=/^[0-9A-HJKMNP-TV-Z]{26}$/i,qv=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Yv=/^[a-z0-9_-]{21}$/i,Gv=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Xv=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Jv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Kv="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ls;const Qv=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,tx=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,rx=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nx=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sx=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ld="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ax=new RegExp(`^${ld}$`);function cd(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function ix(t){return new RegExp(`^${cd(t)}$`)}function ox(t){let e=`${ld}T${cd(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function lx(t,e){return!!((e==="v4"||!e)&&Qv.test(t)||(e==="v6"||!e)&&tx.test(t))}function cx(t,e){if(!Gv.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function ux(t,e){return!!((e==="v4"||!e)&&ex.test(t)||(e==="v6"||!e)&&rx.test(t))}class $t extends re{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==R.string){const a=this._getOrReturnCtx(e);return O(a,{code:_.invalid_type,expected:R.string,received:a.parsedType}),q}const n=new Ve;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),O(s,{code:_.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),O(s,{code:_.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?O(s,{code:_.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&O(s,{code:_.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Jv.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"email",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Ls||(Ls=new RegExp(Kv,"u")),Ls.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"emoji",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")qv.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"uuid",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")Yv.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"nanoid",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Bv.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"cuid",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Uv.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"cuid2",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Hv.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"ulid",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),O(s,{validation:"url",code:_.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"regex",code:_.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),O(s,{code:_.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),O(s,{code:_.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),O(s,{code:_.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?ox(a).test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{code:_.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?ax.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{code:_.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?ix(a).test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{code:_.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?Xv.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"duration",code:_.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?lx(e.data,a.version)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"ip",code:_.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?cx(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"jwt",code:_.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?ux(e.data,a.version)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"cidr",code:_.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?nx.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"base64",code:_.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?sx.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"base64url",code:_.invalid_string,message:a.message}),n.dirty()):ne.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:_.invalid_string,...M.errToObj(n)})}_addCheck(e){return new $t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...M.errToObj(e)})}url(e){return this._addCheck({kind:"url",...M.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...M.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...M.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...M.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...M.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...M.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...M.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...M.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...M.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...M.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...M.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...M.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...M.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...M.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...M.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...M.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...M.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...M.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...M.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...M.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...M.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...M.errToObj(r)})}nonempty(e){return this.min(1,M.errToObj(e))}trim(){return new $t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new $t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new $t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}$t.create=t=>new $t({checks:[],typeName:Y.ZodString,coerce:t?.coerce??!1,...K(t)});function dx(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,a=Number.parseInt(t.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}class zr extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==R.number){const a=this._getOrReturnCtx(e);return O(a,{code:_.invalid_type,expected:R.number,received:a.parsedType}),q}let n;const s=new Ve;for(const a of this._def.checks)a.kind==="int"?ne.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),O(n,{code:_.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),O(n,{code:_.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),O(n,{code:_.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?dx(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),O(n,{code:_.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),O(n,{code:_.not_finite,message:a.message}),s.dirty()):ne.assertNever(a);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,M.toString(r))}gt(e,r){return this.setLimit("min",e,!1,M.toString(r))}lte(e,r){return this.setLimit("max",e,!0,M.toString(r))}lt(e,r){return this.setLimit("max",e,!1,M.toString(r))}setLimit(e,r,n,s){return new zr({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:M.toString(s)}]})}_addCheck(e){return new zr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:M.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:M.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:M.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:M.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:M.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:M.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:M.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:M.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:M.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ne.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}zr.create=t=>new zr({checks:[],typeName:Y.ZodNumber,coerce:t?.coerce||!1,...K(t)});class Wr extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==R.bigint)return this._getInvalidInput(e);let n;const s=new Ve;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),O(n,{code:_.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),O(n,{code:_.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),O(n,{code:_.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):ne.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return O(r,{code:_.invalid_type,expected:R.bigint,received:r.parsedType}),q}gte(e,r){return this.setLimit("min",e,!0,M.toString(r))}gt(e,r){return this.setLimit("min",e,!1,M.toString(r))}lte(e,r){return this.setLimit("max",e,!0,M.toString(r))}lt(e,r){return this.setLimit("max",e,!1,M.toString(r))}setLimit(e,r,n,s){return new Wr({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:M.toString(s)}]})}_addCheck(e){return new Wr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:M.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:M.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:M.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:M.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:M.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Wr.create=t=>new Wr({checks:[],typeName:Y.ZodBigInt,coerce:t?.coerce??!1,...K(t)});class _o extends re{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==R.boolean){const n=this._getOrReturnCtx(e);return O(n,{code:_.invalid_type,expected:R.boolean,received:n.parsedType}),q}return Ue(e.data)}}_o.create=t=>new _o({typeName:Y.ZodBoolean,coerce:t?.coerce||!1,...K(t)});class Vn extends re{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==R.date){const a=this._getOrReturnCtx(e);return O(a,{code:_.invalid_type,expected:R.date,received:a.parsedType}),q}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return O(a,{code:_.invalid_date}),q}const n=new Ve;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),O(s,{code:_.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),O(s,{code:_.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):ne.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Vn({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:M.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:M.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}Vn.create=t=>new Vn({checks:[],coerce:t?.coerce||!1,typeName:Y.ZodDate,...K(t)});class To extends re{_parse(e){if(this._getType(e)!==R.symbol){const n=this._getOrReturnCtx(e);return O(n,{code:_.invalid_type,expected:R.symbol,received:n.parsedType}),q}return Ue(e.data)}}To.create=t=>new To({typeName:Y.ZodSymbol,...K(t)});class jo extends re{_parse(e){if(this._getType(e)!==R.undefined){const n=this._getOrReturnCtx(e);return O(n,{code:_.invalid_type,expected:R.undefined,received:n.parsedType}),q}return Ue(e.data)}}jo.create=t=>new jo({typeName:Y.ZodUndefined,...K(t)});class Eo extends re{_parse(e){if(this._getType(e)!==R.null){const n=this._getOrReturnCtx(e);return O(n,{code:_.invalid_type,expected:R.null,received:n.parsedType}),q}return Ue(e.data)}}Eo.create=t=>new Eo({typeName:Y.ZodNull,...K(t)});class oa extends re{constructor(){super(...arguments),this._any=!0}_parse(e){return Ue(e.data)}}oa.create=t=>new oa({typeName:Y.ZodAny,...K(t)});class Oo extends re{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ue(e.data)}}Oo.create=t=>new Oo({typeName:Y.ZodUnknown,...K(t)});class Rt extends re{_parse(e){const r=this._getOrReturnCtx(e);return O(r,{code:_.invalid_type,expected:R.never,received:r.parsedType}),q}}Rt.create=t=>new Rt({typeName:Y.ZodNever,...K(t)});class Do extends re{_parse(e){if(this._getType(e)!==R.undefined){const n=this._getOrReturnCtx(e);return O(n,{code:_.invalid_type,expected:R.void,received:n.parsedType}),q}return Ue(e.data)}}Do.create=t=>new Do({typeName:Y.ZodVoid,...K(t)});class ct extends re{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==R.array)return O(r,{code:_.invalid_type,expected:R.array,received:r.parsedType}),q;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,o=r.data.length<s.exactLength.value;(i||o)&&(O(r,{code:i?_.too_big:_.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(O(r,{code:_.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(O(r,{code:_.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>s.type._parseAsync(new Dt(r,i,r.path,o)))).then(i=>Ve.mergeArray(n,i));const a=[...r.data].map((i,o)=>s.type._parseSync(new Dt(r,i,r.path,o)));return Ve.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new ct({...this._def,minLength:{value:e,message:M.toString(r)}})}max(e,r){return new ct({...this._def,maxLength:{value:e,message:M.toString(r)}})}length(e,r){return new ct({...this._def,exactLength:{value:e,message:M.toString(r)}})}nonempty(e){return this.min(1,e)}}ct.create=(t,e)=>new ct({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Y.ZodArray,...K(e)});function or(t){if(t instanceof ye){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=Tt.create(or(n))}return new ye({...t._def,shape:()=>e})}else return t instanceof ct?new ct({...t._def,type:or(t.element)}):t instanceof Tt?Tt.create(or(t.unwrap())):t instanceof br?br.create(or(t.unwrap())):t instanceof Ut?Ut.create(t.items.map(e=>or(e))):t}class ye extends re{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=ne.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==R.object){const u=this._getOrReturnCtx(e);return O(u,{code:_.invalid_type,expected:R.object,received:u.parsedType}),q}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Rt&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const c=[];for(const u of i){const f=a[u],d=s.data[u];c.push({key:{status:"valid",value:u},value:f._parse(new Dt(s,d,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Rt){const u=this._def.unknownKeys;if(u==="passthrough")for(const f of o)c.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(u==="strict")o.length>0&&(O(s,{code:_.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const f of o){const d=s.data[f];c.push({key:{status:"valid",value:f},value:u._parse(new Dt(s,d,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const f of c){const d=await f.key,m=await f.value;u.push({key:d,value:m,alwaysSet:f.alwaysSet})}return u}).then(u=>Ve.mergeObjectSync(n,u)):Ve.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return M.errToObj,new ye({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{const s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:M.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new ye({...this._def,unknownKeys:"strip"})}passthrough(){return new ye({...this._def,unknownKeys:"passthrough"})}extend(e){return new ye({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ye({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Y.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new ye({...this._def,catchall:e})}pick(e){const r={};for(const n of ne.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new ye({...this._def,shape:()=>r})}omit(e){const r={};for(const n of ne.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new ye({...this._def,shape:()=>r})}deepPartial(){return or(this)}partial(e){const r={};for(const n of ne.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}return new ye({...this._def,shape:()=>r})}required(e){const r={};for(const n of ne.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Tt;)a=a._def.innerType;r[n]=a}return new ye({...this._def,shape:()=>r})}keyof(){return ud(ne.objectKeys(this.shape))}}ye.create=(t,e)=>new ye({shape:()=>t,unknownKeys:"strip",catchall:Rt.create(),typeName:Y.ZodObject,...K(e)});ye.strictCreate=(t,e)=>new ye({shape:()=>t,unknownKeys:"strict",catchall:Rt.create(),typeName:Y.ZodObject,...K(e)});ye.lazycreate=(t,e)=>new ye({shape:t,unknownKeys:"strip",catchall:Rt.create(),typeName:Y.ZodObject,...K(e)});class $n extends re{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new yt(o.ctx.common.issues));return O(r,{code:_.invalid_union,unionErrors:i}),q}if(r.common.async)return Promise.all(n.map(async a=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},f=c._parseSync({data:r.data,path:r.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!a&&(a={result:f,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new yt(c));return O(r,{code:_.invalid_union,unionErrors:o}),q}}get options(){return this._def.options}}$n.create=(t,e)=>new $n({options:t,typeName:Y.ZodUnion,...K(e)});function la(t,e){const r=Nt(t),n=Nt(e);if(t===e)return{valid:!0,data:t};if(r===R.object&&n===R.object){const s=ne.objectKeys(e),a=ne.objectKeys(t).filter(o=>s.indexOf(o)!==-1),i={...t,...e};for(const o of a){const c=la(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(r===R.array&&n===R.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],c=la(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===R.date&&n===R.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class zn extends re{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(So(a)||So(i))return q;const o=la(a.value,i.value);return o.valid?((No(a)||No(i))&&r.dirty(),{status:r.value,value:o.data}):(O(n,{code:_.invalid_intersection_types}),q)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}zn.create=(t,e,r)=>new zn({left:t,right:e,typeName:Y.ZodIntersection,...K(r)});class Ut extends re{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.array)return O(n,{code:_.invalid_type,expected:R.array,received:n.parsedType}),q;if(n.data.length<this._def.items.length)return O(n,{code:_.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),q;!this._def.rest&&n.data.length>this._def.items.length&&(O(n,{code:_.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new Dt(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>Ve.mergeArray(r,i)):Ve.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new Ut({...this._def,rest:e})}}Ut.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ut({items:t,typeName:Y.ZodTuple,rest:null,...K(e)})};class Ro extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.map)return O(n,{code:_.invalid_type,expected:R.map,received:n.parsedType}),q;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],u)=>({key:s._parse(new Dt(n,o,n.path,[u,"key"])),value:a._parse(new Dt(n,c,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,f=await c.value;if(u.status==="aborted"||f.status==="aborted")return q;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),o.set(u.value,f.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const c of i){const u=c.key,f=c.value;if(u.status==="aborted"||f.status==="aborted")return q;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),o.set(u.value,f.value)}return{status:r.value,value:o}}}}Ro.create=(t,e,r)=>new Ro({valueType:e,keyType:t,typeName:Y.ZodMap,...K(r)});class Zr extends re{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.set)return O(n,{code:_.invalid_type,expected:R.set,received:n.parsedType}),q;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(O(n,{code:_.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(O(n,{code:_.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const a=this._def.valueType;function i(c){const u=new Set;for(const f of c){if(f.status==="aborted")return q;f.status==="dirty"&&r.dirty(),u.add(f.value)}return{status:r.value,value:u}}const o=[...n.data.values()].map((c,u)=>a._parse(new Dt(n,c,n.path,u)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,r){return new Zr({...this._def,minSize:{value:e,message:M.toString(r)}})}max(e,r){return new Zr({...this._def,maxSize:{value:e,message:M.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}Zr.create=(t,e)=>new Zr({valueType:t,minSize:null,maxSize:null,typeName:Y.ZodSet,...K(e)});class Ao extends re{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Ao.create=(t,e)=>new Ao({getter:t,typeName:Y.ZodLazy,...K(e)});class Mo extends re{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return O(r,{received:r.data,code:_.invalid_literal,expected:this._def.value}),q}return{status:"valid",value:e.data}}get value(){return this._def.value}}Mo.create=(t,e)=>new Mo({value:t,typeName:Y.ZodLiteral,...K(e)});function ud(t,e){return new vr({values:t,typeName:Y.ZodEnum,...K(e)})}class vr extends re{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return O(r,{expected:ne.joinValues(n),received:r.parsedType,code:_.invalid_type}),q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return O(r,{received:r.data,code:_.invalid_enum_value,options:n}),q}return Ue(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return vr.create(e,{...this._def,...r})}exclude(e,r=this._def){return vr.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}vr.create=ud;class Io extends re{_parse(e){const r=ne.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==R.string&&n.parsedType!==R.number){const s=ne.objectValues(r);return O(n,{expected:ne.joinValues(s),received:n.parsedType,code:_.invalid_type}),q}if(this._cache||(this._cache=new Set(ne.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=ne.objectValues(r);return O(n,{received:n.data,code:_.invalid_enum_value,options:s}),q}return Ue(e.data)}get enum(){return this._def.values}}Io.create=(t,e)=>new Io({values:t,typeName:Y.ZodNativeEnum,...K(e)});class Wn extends re{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==R.promise&&r.common.async===!1)return O(r,{code:_.invalid_type,expected:R.promise,received:r.parsedType}),q;const n=r.parsedType===R.promise?r.data:Promise.resolve(r.data);return Ue(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}Wn.create=(t,e)=>new Wn({type:t,typeName:Y.ZodPromise,...K(e)});class xr extends re{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{O(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return q;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?q:c.status==="dirty"||r.value==="dirty"?Mr(c.value):c});{if(r.value==="aborted")return q;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?q:o.status==="dirty"||r.value==="dirty"?Mr(o.value):o}}if(s.type==="refinement"){const i=o=>{const c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?q:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?q:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yr(i))return q;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>yr(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:r.value,value:o})):q);ne.assertNever(s)}}xr.create=(t,e,r)=>new xr({schema:t,typeName:Y.ZodEffects,effect:e,...K(r)});xr.createWithPreprocess=(t,e,r)=>new xr({schema:e,effect:{type:"preprocess",transform:t},typeName:Y.ZodEffects,...K(r)});class Tt extends re{_parse(e){return this._getType(e)===R.undefined?Ue(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Tt.create=(t,e)=>new Tt({innerType:t,typeName:Y.ZodOptional,...K(e)});class br extends re{_parse(e){return this._getType(e)===R.null?Ue(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}br.create=(t,e)=>new br({innerType:t,typeName:Y.ZodNullable,...K(e)});class ca extends re{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===R.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}ca.create=(t,e)=>new ca({innerType:t,typeName:Y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...K(e)});class ua extends re{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ln(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new yt(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new yt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ua.create=(t,e)=>new ua({innerType:t,typeName:Y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...K(e)});class Po extends re{_parse(e){if(this._getType(e)!==R.nan){const n=this._getOrReturnCtx(e);return O(n,{code:_.invalid_type,expected:R.nan,received:n.parsedType}),q}return{status:"valid",value:e.data}}}Po.create=t=>new Po({typeName:Y.ZodNaN,...K(t)});class fx extends re{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Ka extends re{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?q:a.status==="dirty"?(r.dirty(),Mr(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?q:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new Ka({in:e,out:r,typeName:Y.ZodPipeline})}}class da extends re{_parse(e){const r=this._def.innerType._parse(e),n=s=>(yr(s)&&(s.value=Object.freeze(s.value)),s);return Ln(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}da.create=(t,e)=>new da({innerType:t,typeName:Y.ZodReadonly,...K(e)});var Y;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Y||(Y={}));const hx=oa.create;Rt.create;ct.create;const mx=ye.create;$n.create;zn.create;Ut.create;vr.create;Wn.create;Tt.create;br.create;function px(t){const e=[];for(const r of t.sections)for(const n of r.fields)Array.isArray(n)?e.push(...n):e.push(n);return e}function gx(t){const e={};for(const n of t.sections)for(const s of n.fields){const a=Array.isArray(s)?s:[s];for(const i of a)e[i.name]=i.schema??hx().optional()}let r=mx(e);return t.crossRules?.length&&(r=r.superRefine((n,s)=>{for(const a of t.crossRules)a(n,s)})),r}function yx(t,e){const r=t.defaultValues?.(e)??{},n=px(t),s={...r};for(const a of n)a.defaultValue!==void 0&&s[a.name]===void 0&&(s[a.name]=a.defaultValue);return s}var vx=t=>t.type==="checkbox",Ir=t=>t instanceof Date,Qa=t=>t==null;const dd=t=>typeof t=="object";var Ht=t=>!Qa(t)&&!Array.isArray(t)&&dd(t)&&!Ir(t),xx=t=>Ht(t)&&t.target?vx(t.target)?t.target.checked:t.target.value:t,bx=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,wx=(t,e)=>t.has(bx(e)),kx=t=>{const e=t.constructor&&t.constructor.prototype;return Ht(e)&&e.hasOwnProperty("isPrototypeOf")},Sx=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function fd(t){if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(Sx&&(t instanceof Blob||e))return t;const r=Array.isArray(t);if(!r&&!(Ht(t)&&kx(t)))return t;const n=r?[]:Object.create(Object.getPrototypeOf(t));for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[s]=fd(t[s]));return n}var hd=t=>/^\w*$/.test(t),fa=t=>t===void 0,Nx=t=>Array.isArray(t)?t.filter(Boolean):[],md=t=>Nx(t.replace(/["|']|\]/g,"").split(/\.|\[/)),Oe=(t,e,r)=>{if(!e||!Ht(t))return r;const n=(hd(e)?[e]:md(e)).reduce((s,a)=>Qa(s)?s:s[a],t);return fa(n)||n===t?fa(t[e])?r:t[e]:n},Vs=t=>typeof t=="boolean",vn=t=>typeof t=="function",Fo=(t,e,r)=>{let n=-1;const s=hd(e)?[e]:md(e),a=s.length,i=a-1;for(;++n<a;){const o=s[n];let c=r;if(n!==i){const u=t[o];c=Ht(u)||Array.isArray(u)?u:isNaN(+s[n+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;t[o]=c,t=t[o]}};const Lo={BLUR:"blur",CHANGE:"change"},Vo={all:"all"},ei=b.createContext(null);ei.displayName="HookFormContext";const ti=()=>b.useContext(ei),Cx=t=>{const{children:e,...r}=t;return b.createElement(ei.Provider,{value:r},e)};var _x=(t,e,r,n=!0)=>{const s={defaultValues:e._defaultValues};for(const a in t)Object.defineProperty(s,a,{get:()=>{const i=a;return e._proxyFormState[i]!==Vo.all&&(e._proxyFormState[i]=!n||Vo.all),r&&(r[i]=!0),t[i]}});return s};const pd=typeof window<"u"?b.useLayoutEffect:b.useEffect;function Tx(t){const e=ti(),{control:r=e.control,disabled:n,name:s,exact:a}=t||{},[i,o]=b.useState(r._formState),c=b.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return pd(()=>r._subscribe({name:s,formState:c.current,exact:a,callback:u=>{!n&&o({...r._formState,...u})}}),[s,n,a]),b.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),b.useMemo(()=>_x(i,r,c.current,!1),[i,r])}var jx=t=>typeof t=="string",$o=(t,e,r,n,s)=>jx(t)?Oe(r,t,s):Array.isArray(t)?t.map(a=>Oe(r,a)):r,zo=t=>Qa(t)||!dd(t);function _n(t,e,r=new WeakSet){if(zo(t)||zo(e))return Object.is(t,e);if(Ir(t)&&Ir(e))return Object.is(t.getTime(),e.getTime());const n=Object.keys(t),s=Object.keys(e);if(n.length!==s.length)return!1;if(r.has(t)||r.has(e))return!0;r.add(t),r.add(e);for(const a of n){const i=t[a];if(!s.includes(a))return!1;if(a!=="ref"){const o=e[a];if(Ir(i)&&Ir(o)||Ht(i)&&Ht(o)||Array.isArray(i)&&Array.isArray(o)?!_n(i,o,r):!Object.is(i,o))return!1}}return!0}function gd(t){const e=ti(),{control:r=e.control,name:n,defaultValue:s,disabled:a,exact:i,compute:o}=t||{},c=b.useRef(s),u=b.useRef(o),f=b.useRef(void 0),d=b.useRef(r),m=b.useRef(n);u.current=o;const[p,y]=b.useState(()=>{const k=r._getWatch(n,c.current);return u.current?u.current(k):k}),g=b.useCallback(k=>{const w=$o(n,r._names,k||r._formValues,!1,c.current);return u.current?u.current(w):w},[r._formValues,r._names,n]),x=b.useCallback(k=>{if(!a){const w=$o(n,r._names,k||r._formValues,!1,c.current);if(u.current){const j=u.current(w);_n(j,f.current)||(y(j),f.current=j)}else y(w)}},[r._formValues,r._names,a,n]);pd(()=>((d.current!==r||!_n(m.current,n))&&(d.current=r,m.current=n,x()),r._subscribe({name:n,formState:{values:!0},exact:i,callback:k=>{x(k.values)}})),[r,i,n,x]),b.useEffect(()=>r._removeUnmounted());const v=d.current!==r,S=m.current,C=b.useMemo(()=>{if(a)return null;const k=!v&&!_n(S,n);return v||k?g():null},[a,v,n,S,g]);return C!==null?C:p}function Ex(t){const e=ti(),{name:r,disabled:n,control:s=e.control,shouldUnregister:a,defaultValue:i,exact:o=!0}=t,c=wx(s._names.array,r),u=b.useMemo(()=>Oe(s._formValues,r,Oe(s._defaultValues,r,i)),[s,r,i]),f=gd({control:s,name:r,defaultValue:u,exact:o}),d=Tx({control:s,name:r,exact:o}),m=b.useRef(t),p=b.useRef(void 0),y=b.useRef(s.register(r,{...t.rules,value:f,...Vs(t.disabled)?{disabled:t.disabled}:{}}));m.current=t;const g=b.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Oe(d.errors,r)},isDirty:{enumerable:!0,get:()=>!!Oe(d.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!Oe(d.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!Oe(d.validatingFields,r)},error:{enumerable:!0,get:()=>Oe(d.errors,r)}}),[d,r]),x=b.useCallback(k=>y.current.onChange({target:{value:xx(k),name:r},type:Lo.CHANGE}),[r]),v=b.useCallback(()=>y.current.onBlur({target:{value:Oe(s._formValues,r),name:r},type:Lo.BLUR}),[r,s._formValues]),S=b.useCallback(k=>{const w=Oe(s._fields,r);w&&w._f&&k&&(w._f.ref={focus:()=>vn(k.focus)&&k.focus(),select:()=>vn(k.select)&&k.select(),setCustomValidity:j=>vn(k.setCustomValidity)&&k.setCustomValidity(j),reportValidity:()=>vn(k.reportValidity)&&k.reportValidity()})},[s._fields,r]),C=b.useMemo(()=>({name:r,value:f,...Vs(n)||d.disabled?{disabled:d.disabled||n}:{},onChange:x,onBlur:v,ref:S}),[r,n,d.disabled,x,v,S,f]);return b.useEffect(()=>{const k=s._options.shouldUnregister||a,w=p.current;w&&w!==r&&!c&&s.unregister(w),s.register(r,{...m.current.rules,...Vs(m.current.disabled)?{disabled:m.current.disabled}:{}});const j=(T,A)=>{const $=Oe(s._fields,T);$&&$._f&&($._f.mount=A)};if(j(r,!0),k){const T=fd(Oe(s._options.defaultValues,r,m.current.defaultValue));Fo(s._defaultValues,r,T),fa(Oe(s._formValues,r))&&Fo(s._formValues,r,T)}return!c&&s.register(r),p.current=r,()=>{(c?k&&!s._state.action:k)?s.unregister(r):j(r,!1)}},[r,s,c,a]),b.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),b.useMemo(()=>({field:C,formState:d,fieldState:g}),[C,d,g])}const Ox=t=>t.render(Ex(t));function Dx({form:t,field:e}){const[r,n]=b.useState(!1);return l.jsx(Ox,{control:t.control,name:e.name,render:({field:s,fieldState:{error:a}})=>{const i=u=>e.normalize?e.normalize(u):u,o=()=>{e.deps?.onChangeTrigger&&t.trigger(e.deps.onChangeTrigger)},c={className:e.className,error:a?.message,required:!e.schema?.isOptional?.()};switch(e.kind){case"custom":if(!e.render)throw new Error(`Field ${e.name} marked as custom but has no render function`);return l.jsx("div",{className:e.className,children:e.render({form:t})});case"input":return l.jsxs(st,{...c,children:[l.jsx(at,{children:e.label}),l.jsx(Xe,{children:l.jsx($r,{type:"text",placeholder:e.placeholder,value:s.value??"",onChange:u=>{s.onChange(i(u.target.value)),o()},onBlur:s.onBlur})}),l.jsx(Je,{})]});case"password":return l.jsxs(st,{...c,children:[l.jsx(at,{children:e.label}),l.jsx(Xe,{children:l.jsxs("div",{className:"relative flex w-full items-center",children:[l.jsx($r,{type:r?"text":"password",placeholder:e.placeholder,value:s.value??"",className:"pr-10",onChange:u=>{const f=u.target.value;s.onChange(i(f)),o()},onBlur:s.onBlur}),l.jsx(Le,{type:"button",variant:"ghost",className:"absolute right-3 flex items-center justify-center text-slate-400 hover:text-slate-600 focus:outline-none",onClick:()=>n(!r),tabIndex:-1,children:r?l.jsx(J.EyeOff,{className:"h-4 w-4"}):l.jsx(J.Eye,{className:"h-4 w-4"})})]})}),l.jsx(Je,{})]});case"textarea":return l.jsxs(st,{...c,children:[l.jsx(at,{children:e.label}),l.jsx(Xe,{children:l.jsx("textarea",{className:"oniratec-field__textarea",value:s.value??"",placeholder:e.placeholder,rows:4,onChange:u=>{s.onChange(i(u.target.value)),o()},onBlur:s.onBlur})}),l.jsx(Je,{})]});case"select":return l.jsxs(st,{...c,children:[l.jsx(at,{children:e.label}),l.jsx(Xe,{children:l.jsxs(fs,{value:s.value||void 0,onValueChange:u=>{s.onChange(i(u||void 0)),o()},children:[l.jsx(Kr,{children:l.jsx(hs,{})}),l.jsx(Qr,{children:(e.options??[]).map(u=>l.jsx(en,{value:String(u.value),children:u.label},u.value))})]})}),l.jsx(Je,{})]});case"asyncSelect":return l.jsxs(st,{...c,children:[l.jsx(at,{children:e.label}),l.jsx(Xe,{children:l.jsx(Ga,{value:s.value||void 0,onValueChange:u=>{s.onChange(i(u)),o()},placeholder:e.placeholder,searchPlaceholder:e.searchPlaceholder,minChars:e.minChars,debounceMs:e.debounceMs,fetcher:e.fetcher,getOptionValue:e.getOptionValue,getOptionLabel:e.getOptionLabel,emptyLabel:e.emptyLabel,emptyActionLabel:e.emptyActionLabel,onEmptyActionClick:e.onEmptyActionClick,hasError:!!a?.message})}),l.jsx(Je,{})]});case"toggle":return l.jsxs(st,{...c,children:[l.jsx(at,{children:e.label}),l.jsx(Xe,{children:l.jsx(tn,{checked:!!s.value,onChange:u=>{s.onChange(i(u)),o()}})}),l.jsx(Je,{})]});case"checkbox":return l.jsxs(st,{...c,children:[l.jsx(Xe,{children:l.jsxs("label",{className:"oniratec-checkbox",children:[l.jsx("input",{type:"checkbox",checked:!!s.value,onChange:u=>{s.onChange(i(u.target.checked)),o()},onBlur:s.onBlur}),l.jsx("span",{children:e.label})]})}),l.jsx(Je,{})]});case"date":return l.jsxs(st,{...c,children:[l.jsx(at,{children:e.label}),l.jsx(Xe,{children:l.jsx(ns,{value:s.value,onChange:u=>{s.onChange(i(u)),o()},placeholder:e.placeholder,min:e.min,max:e.max,timeZone:e.timeZone,isInvalid:!!a?.message})}),l.jsx(Je,{})]});case"fileUpload":{const u=Array.isArray(s.value)?s.value:[];return l.jsxs(st,{...c,children:[l.jsx(at,{children:e.label}),l.jsx(Xe,{children:l.jsx(us,{files:u,onFilesChange:f=>{s.onChange(i(f)),o()},accept:e.accept,multiple:e.multiple,helperText:e.helperText,allowDrop:e.allowDrop,placeholder:e.placeholder,defaultPreviewUrl:e.defaultPreviewUrl})}),l.jsx(Je,{})]})}}}})}function Rx(t){return Array.isArray(t)?t:[t]}function yd({config:t,form:e,onSubmitAction:r,handleErrors:n,submitLabel:s,maxWidthClass:a,children:i}){const o=gd({control:e.control});return l.jsx(Cx,{...e,children:l.jsxs("form",{onSubmit:e.handleSubmit(r,c=>n(c)),className:N("space-y-8",a),children:[t.sections.map((c,u)=>l.jsxs(b.Fragment,{children:[l.jsxs("section",{className:"space-y-4",children:[l.jsx("h3",{className:"oniratec-form__section-title",children:c.title}),l.jsx("div",{className:"space-y-4",children:c.fields.map((f,d)=>{const m=Rx(f).filter(g=>!g.hidden?.(o));if(!m.length)return null;const p=m.reduce((g,x)=>g+(x.colSpan??1),0),y=p>1?N("grid gap-4",p===2&&"grid-cols-2",p===3&&"grid-cols-3",p===4&&"grid-cols-4"):"";return l.jsx("div",{className:y,children:m.map(g=>l.jsx("div",{className:g.colSpan?`col-span-${g.colSpan}`:void 0,children:l.jsx(Dx,{form:e,field:g})},g.name))},d)})})]},c.title),u<t.sections.length-1&&l.jsx(b.Fragment,{children:l.jsx("hr",{className:"oniratec-form__separator"})})]},`fragment-${c.title}`)),i,l.jsx("div",{className:"oniratec-form__actions",children:l.jsx(Le,{type:"submit",loading:e.formState.isSubmitting,children:s})})]})})}function Ax(t){return l.jsx(yd,{...t})}const Mx=t=>t==="center"?"text-center":t==="right"?"text-right":"text-left",Ix=t=>{if(t)return typeof t=="number"?`w-[${t}px]`:t.startsWith("w-")?t:`w-[${t}]`},Px=t=>t?Array.isArray(t)?t:[t]:[];function vd(t){return{columns:t.columns.map(n=>{const s=Mx(n.align),a=Ix(n.width),i=[s,a,n.className].filter(Boolean).join(" "),o=[s,a,n.headerClassName].filter(Boolean).join(" ");return{key:n.id,header:n.header,render:n.cell??(c=>String(n.accessor?.(c)??"")),className:i||void 0,headerClassName:o||void 0,sortable:n.sortable??!!(n.sortFn||n.accessor),sortFn:n.sortFn,sortValue:n.accessor}}),getSortDirection:(n,s)=>Px(n).find(o=>o.columnId===s)?.direction??null}}function Fx(t,e,r){const{columns:n}=vd(t);return l.jsx(sd,{columns:n,data:e,...r})}const Lx=t=>t.reduce((e,r)=>r.type==="toggle"?(e[r.id]=r.value??!1,e):r.type==="date"?(e[r.id]=r.value??null,e):(e[r.id]=r.value??"",e),{});function Vx(t){const e=Lx(t.filters),r=(a,i,o)=>({...a,[i]:o}),n=()=>({...e}),s=a=>t.buildQueryParams?t.buildQueryParams(a):a;return{filters:t.filters,initialState:e,updateFilter:r,resetState:n,buildQueryParams:s}}function xd(t,e,r,n){return l.jsx(id,{filters:t.filters,value:e,onChange:r,onReset:n?.onReset,resetLabel:n?.resetLabel,showReset:n?.showReset,className:n?.className,layout:n?.layout,actions:n?.actions})}function $x(t,e,r,n){return l.jsx(od,{title:n.title,description:n.description,isOpen:n.isOpen,onOpenChange:n.onOpenChange,onApply:n.onApply,applyLabel:n.applyLabel,closeLabel:n.closeLabel,className:n.className,children:xd(t,e,r,n.panel)})}function zx(t,e,r){const n=new Set(t.filter(s=>s.type==="date").map(s=>s.id));return Object.entries(e).reduce((s,[a,i])=>i==null?(s[a]=void 0,s):n.has(a)&&i instanceof Date?(s[a]=eu(i,r?.timeZone)??void 0,s):(s[a]=i,s),{})}function Wx(...t){return Wo.twMerge(ha.clsx(t))}exports.Alert=tl;exports.AlertDescription=nl;exports.AlertTitle=rl;exports.AsyncSelect=Ga;exports.AuthLayout=nd;exports.Badge=pa;exports.Box=Qd;exports.Breadcrumbs=jv;exports.Button=Le;exports.Card=zs;exports.CardAction=lf;exports.CardContent=Qo;exports.CardDescription=of;exports.CardFooter=cf;exports.CardHeader=Jo;exports.CardTitle=Ko;exports.Checkbox=al;exports.ConfirmDialog=Ev;exports.DEFAULT_TIME_ZONE=In;exports.DashboardLayout=Rv;exports.DataTable=sd;exports.DatePicker=ns;exports.Dialog=bu;exports.DialogClose=wy;exports.DialogContent=Wa;exports.DialogDescription=Ha;exports.DialogFooter=Ba;exports.DialogHeader=Za;exports.DialogOverlay=za;exports.DialogPortal=wu;exports.DialogTitle=Ua;exports.DialogTrigger=by;exports.DropdownMenu=Sy;exports.DropdownMenuCheckboxItem=Nu;exports.DropdownMenuContent=ku;exports.DropdownMenuGroup=Cy;exports.DropdownMenuItem=Su;exports.DropdownMenuLabel=_u;exports.DropdownMenuPortal=_y;exports.DropdownMenuRadioGroup=jy;exports.DropdownMenuRadioItem=Cu;exports.DropdownMenuSeparator=Tu;exports.DropdownMenuShortcut=Ou;exports.DropdownMenuSub=Ty;exports.DropdownMenuSubContent=Eu;exports.DropdownMenuSubTrigger=ju;exports.DropdownMenuTrigger=Ny;exports.Field=st;exports.FieldControl=Xe;exports.FieldLabel=at;exports.FieldMessage=Je;exports.FilePicker=Dy;exports.FileUpload=us;exports.FiltersModal=od;exports.FiltersPanel=id;exports.FormFactoryRenderer=yd;exports.ImportFileCard=Fv;exports.Input=$r;exports.Kbd=Au;exports.KpiCard=Lv;exports.Logo=af;exports.NotFoundState=Ry;exports.PageHeader=Vv;exports.PageSizeSelector=ad;exports.Pagination=Iv;exports.PasswordInput=Ru;exports.PersonAvatar=Jd;exports.ProfileAvatar=Kd;exports.Progress=Mu;exports.RadioGroup=My;exports.RadioGroupItem=Pu;exports.Select=fs;exports.SelectContent=Qr;exports.SelectGroup=Iy;exports.SelectItem=en;exports.SelectLabel=Fu;exports.SelectScrollDownButton=Ya;exports.SelectScrollUpButton=qa;exports.SelectSeparator=Lu;exports.SelectTrigger=Kr;exports.SelectValue=hs;exports.Separator=Vu;exports.Sheet=Fy;exports.SheetClose=Vy;exports.SheetContent=zu;exports.SheetDescription=Uu;exports.SheetFooter=Zu;exports.SheetHeader=Wu;exports.SheetOverlay=Xa;exports.SheetPortal=$u;exports.SheetTitle=Bu;exports.SheetTrigger=Ly;exports.Skeleton=sa;exports.Switch=Gy;exports.Tabs=zy;exports.TabsContent=Xu;exports.TabsList=Yu;exports.TabsTrigger=Gu;exports.Textarea=Hu;exports.ThemeProvider=$v;exports.Toaster=Nv;exports.Toggle=tn;exports.Tooltip=_v;exports.TooltipContent=rd;exports.TooltipProvider=Cv;exports.TooltipTrigger=Tv;exports.alertVariants=el;exports.badgeVariants=sl;exports.buildDefaultValues=yx;exports.buildFiltersQueryParams=zx;exports.buildZodSchema=gx;exports.buttonVariants=Xo;exports.cn=Wx;exports.createFiltersFactory=Vx;exports.createTableFactory=vd;exports.isValidTimeZone=Pn;exports.renderFiltersModal=$x;exports.renderFiltersPanel=xd;exports.renderFormFactory=Ax;exports.renderTable=Fx;exports.resolveTimeZone=Jr;exports.setDefaultTimeZone=ny;exports.toDateTime=sy;exports.toISODate=eu;exports.toISODateTime=ay;exports.toast=fv;exports.useField=ds;
|
|
45
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return h.useEffect(()=>{t&&(document.getElementById(t)||console.error(r))},[r,t]),null},vy="DialogDescriptionWarning",xy=({contentRef:t,descriptionId:e})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${gu(vy).contentName}}.`;return h.useEffect(()=>{const s=t.current?.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(n))},[n,t,e]),null},yu=ru,vu=su,xu=iu,as=ou,is=lu,os=uu,ls=fu,cs=mu;const bu=yu,by=vu,wu=xu,wy=cs,za=h.forwardRef(({className:t,...e},r)=>l.jsx(as,{ref:r,className:N("fixed inset-0 isolate z-50 bg-black/10 backdrop-blur-[2px] transition-opacity duration-100","data-[state=closed]:opacity-0 data-[state=open]:opacity-100",t),...e}));za.displayName=as.displayName;const ky={sm:"sm:max-w-sm",md:"sm:max-w-md",lg:"sm:max-w-lg",xl:"sm:max-w-xl","2xl":"sm:max-w-2xl",full:"sm:max-w-full"},Wa=h.forwardRef(({className:t,children:e,hideClose:r,size:n="md",...s},a)=>l.jsxs(wu,{children:[l.jsx(za,{}),l.jsxs(is,{ref:a,className:N("fixed left-1/2 top-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-background p-4 text-sm","ring-1 ring-foreground/10 shadow-card-lg outline-none transition-[opacity,transform] duration-100",ky[n],"data-[state=closed]:opacity-0 data-[state=closed]:scale-95","data-[state=open]:opacity-100 data-[state=open]:scale-100",t),...s,children:[e,!r&&l.jsx(cs,{asChild:!0,children:l.jsxs(Le,{variant:"ghost",size:"icon-sm",className:"absolute right-2 top-2","aria-label":"Cerrar",children:[l.jsx(J.X,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Cerrar"})]})})]})]}));Wa.displayName=is.displayName;const Za=({className:t,...e})=>l.jsx("div",{className:N("flex flex-col gap-2",t),...e});Za.displayName="DialogHeader";const Ba=({className:t,...e})=>l.jsx("div",{className:N("-mx-4 -mb-4 flex flex-col-reverse gap-2 rounded-b-xl border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",t),...e});Ba.displayName="DialogFooter";const Ua=h.forwardRef(({className:t,...e},r)=>l.jsx(os,{ref:r,className:N("text-base font-medium leading-none text-foreground",t),...e}));Ua.displayName=os.displayName;const Ha=h.forwardRef(({className:t,...e},r)=>l.jsx(ls,{ref:r,className:N("text-sm text-muted-foreground",t),...e}));Ha.displayName=ls.displayName;const Sy=fe.Root,Ny=fe.Trigger,Cy=fe.Group,_y=fe.Portal,Ty=fe.Sub,jy=fe.RadioGroup,ku=h.forwardRef(({className:t,sideOffset:e=6,...r},n)=>l.jsx(fe.Portal,{children:l.jsx(fe.Content,{ref:n,sideOffset:e,className:N("z-50 min-w-[10rem] overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-card-sm ring-1 ring-foreground/10 outline-none","transition-[opacity,transform] duration-100","data-[state=closed]:opacity-0 data-[state=closed]:scale-95","data-[state=open]:opacity-100 data-[state=open]:scale-100",t),...r})}));ku.displayName=fe.Content.displayName;const Su=h.forwardRef(({className:t,inset:e,icon:r,destructive:n,children:s,...a},i)=>l.jsxs(fe.Item,{ref:i,className:N("relative flex cursor-default select-none items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-none transition-colors","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e&&"pl-8",n&&"text-destructive focus:bg-destructive/10 focus:text-destructive",t),...a,children:[r&&l.jsx("span",{className:"h-4 w-4 shrink-0 [&>svg]:h-4 [&>svg]:w-4",children:r}),s]}));Su.displayName=fe.Item.displayName;const Nu=h.forwardRef(({className:t,children:e,checked:r,...n},s)=>l.jsxs(fe.CheckboxItem,{ref:s,className:N("relative flex cursor-default select-none items-center gap-1.5 rounded-md py-1 pl-1.5 pr-8 text-sm outline-none transition-colors","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:r,...n,children:[l.jsx("span",{className:"absolute right-2 flex h-4 w-4 items-center justify-center",children:l.jsx(fe.ItemIndicator,{children:l.jsx(J.Check,{className:"h-4 w-4"})})}),e]}));Nu.displayName=fe.CheckboxItem.displayName;const Cu=h.forwardRef(({className:t,children:e,...r},n)=>l.jsxs(fe.RadioItem,{ref:n,className:N("relative flex cursor-default select-none items-center gap-1.5 rounded-md py-1 pl-1.5 pr-8 text-sm outline-none transition-colors","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[l.jsx("span",{className:"absolute right-2 flex h-4 w-4 items-center justify-center",children:l.jsx(fe.ItemIndicator,{children:l.jsx(J.Circle,{className:"h-2.5 w-2.5 fill-current"})})}),e]}));Cu.displayName=fe.RadioItem.displayName;const _u=h.forwardRef(({className:t,inset:e,...r},n)=>l.jsx(fe.Label,{ref:n,className:N("px-1.5 py-1 text-xs font-medium text-muted-foreground",e&&"pl-8",t),...r}));_u.displayName=fe.Label.displayName;const Tu=h.forwardRef(({className:t,...e},r)=>l.jsx(fe.Separator,{ref:r,className:N("-mx-1 my-1 h-px bg-border",t),...e}));Tu.displayName=fe.Separator.displayName;const ju=h.forwardRef(({className:t,inset:e,children:r,...n},s)=>l.jsxs(fe.SubTrigger,{ref:s,className:N("flex cursor-default select-none items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-none transition-colors","focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",e&&"pl-8",t),...n,children:[r,l.jsx(J.ChevronRight,{className:"ml-auto h-4 w-4"})]}));ju.displayName=fe.SubTrigger.displayName;const Eu=h.forwardRef(({className:t,...e},r)=>l.jsx(fe.SubContent,{ref:r,className:N("z-50 min-w-[8rem] overflow-hidden rounded-lg bg-popover p-1 text-popover-foreground shadow-card-sm ring-1 ring-foreground/10 outline-none","transition-[opacity,transform] duration-100","data-[state=closed]:opacity-0 data-[state=closed]:scale-95","data-[state=open]:opacity-100 data-[state=open]:scale-100",t),...e}));Eu.displayName=fe.SubContent.displayName;const Ou=({className:t,...e})=>l.jsx("span",{className:N("ml-auto text-xs tracking-widest text-muted-foreground",t),...e});Ou.displayName="DropdownMenuShortcut";const Ey="Arrastra y suelta archivos aquí o selecciona desde tu dispositivo.",Oy=t=>{if(t===0)return"0 B";const e=1024,r=["B","KB","MB","GB","TB"],n=Math.floor(Math.log(t)/Math.log(e));return`${(t/Math.pow(e,n)).toFixed(n===0?0:1)} ${r[n]}`},ir=t=>`${t.name}-${t.size}-${t.lastModified}`,go=t=>t.type.startsWith("image/");function us({label:t,helperText:e,error:r,disabled:n=!1,multiple:s=!1,accept:a,files:i,defaultFiles:o=[],onFilesChange:c,id:u,name:f,allowDrop:d=!1,placeholder:m=Ey,showPreview:p=!0,previewMode:y="auto",maxPreviewItems:g=4,defaultPreviewUrl:x}){const v=b.useId(),S=u??v,C=e?`${S}-helper`:void 0,k=r?`${S}-error`:void 0,w=[C,k].filter(Boolean).join(" ")||void 0,j=b.useRef(null),[T,A]=b.useState(o),[$,L]=b.useState(!1),W=i!==void 0,B=W?i:T,G=F=>{const D=s?F:F.slice(0,1);W||A(D),c?.(D)},Q=F=>{if(!s)return F.slice(0,1);const D=new Map(B.map(ee=>[ir(ee),ee]));for(const ee of F)D.set(ir(ee),ee);return Array.from(D.values())},H=F=>{const D=Array.from(F.target.files??[]);G(s?Q(D):D),F.target.value=""},P=F=>{G(B.filter(D=>ir(D)!==ir(F)))},U=F=>{if(!d||n)return;F.preventDefault(),L(!1);const D=Array.from(F.dataTransfer.files??[]);D.length!==0&&G(s?Q(D):D)},V=b.useMemo(()=>{if(!p)return[];const F=B.slice(0,g);return y==="image"||y==="auto"&&F.some(ee=>go(ee))?F.filter(ee=>go(ee)).map(ee=>({key:ir(ee),file:ee,url:URL.createObjectURL(ee)})):[]},[B,g,y,p]);b.useEffect(()=>()=>{for(const F of V)URL.revokeObjectURL(F.url)},[V]);const ie=!!x&&B.length===0;return l.jsxs("div",{className:N("flex flex-col gap-2",n&&"pointer-events-none opacity-60"),children:[t&&l.jsx("label",{htmlFor:S,className:"text-sm font-medium text-foreground",children:t}),l.jsx("input",{ref:j,id:S,name:f,type:"file",className:"sr-only",disabled:n,multiple:s,accept:a,"aria-invalid":r?"true":void 0,"aria-describedby":w,onChange:H}),l.jsxs("button",{type:"button",disabled:n,className:N("flex min-h-44 flex-col items-center justify-center gap-3 rounded-xl border border-dashed border-border bg-card px-6 py-8 text-center","transition-[border-color,background-color,box-shadow,transform] hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 active:translate-y-px",d&&"cursor-pointer",$&&"border-ring bg-muted",r&&"border-destructive focus-visible:ring-destructive/20"),onClick:()=>j.current?.click(),onDragOver:F=>{!d||n||(F.preventDefault(),L(!0))},onDragLeave:()=>d&&L(!1),onDrop:U,children:[l.jsx(J.UploadCloud,{className:"h-8 w-8 text-muted-foreground"}),l.jsxs("div",{children:[l.jsx("p",{className:"text-sm font-medium text-foreground",children:s?"Seleccionar archivos":"Seleccionar archivo"}),l.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:m}),a&&l.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["Acepta: ",a]})]})]}),ie&&l.jsx("div",{className:"mt-2 flex gap-2",children:l.jsx("div",{className:"h-16 w-16 overflow-hidden rounded-lg bg-muted ring-1 ring-foreground/10",children:l.jsx("img",{src:x,alt:"Logo actual",className:"h-full w-full object-cover"})})}),V.length>0&&l.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:V.map(F=>l.jsx("div",{className:"h-16 w-16 overflow-hidden rounded-lg bg-muted ring-1 ring-foreground/10",children:l.jsx("img",{src:F.url,alt:F.file.name,className:"h-full w-full object-cover"})},F.key))}),e&&!r&&l.jsx("p",{id:C,className:"text-xs text-muted-foreground",children:e}),r&&l.jsx("p",{id:k,className:"text-xs text-destructive",children:r}),B.length>0&&l.jsx("ul",{className:"mt-2 flex flex-col gap-1",children:B.map(F=>l.jsxs("li",{className:"flex items-center justify-between gap-2 rounded-lg bg-muted/40 px-3 py-2 ring-1 ring-foreground/10",children:[l.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[l.jsx(J.FileIcon,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),l.jsxs("div",{className:"min-w-0",children:[l.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:F.name}),l.jsx("p",{className:"text-xs text-muted-foreground",children:Oy(F.size)})]})]}),l.jsx("button",{type:"button",className:"shrink-0 rounded-md p-1 text-muted-foreground transition-colors hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50",onClick:()=>P(F),"aria-label":`Eliminar ${F.name}`,children:l.jsx(J.X,{className:"h-4 w-4"})})]},ir(F)))})]})}const Dy=us,Du=h.createContext(null);function ds(){const t=h.useContext(Du);if(!t)throw new Error("Field components must be used inside <Field>");return t}function st({className:t,error:e,required:r,...n}){const s=h.useId();return l.jsx(Du.Provider,{value:{id:s,error:e,required:r},children:l.jsx("div",{className:N("flex flex-col gap-1.5",t),...n})})}const Xe=b.forwardRef((t,e)=>{const{id:r,error:n}=ds();return l.jsx(Go,{ref:e,id:r,"aria-invalid":!!n,...t})});Xe.displayName="FieldControl";const at=h.forwardRef(({className:t,children:e,...r},n)=>{const{id:s,required:a}=ds();return l.jsxs("label",{ref:n,htmlFor:s,className:N("text-sm font-medium text-foreground leading-none",t),...r,children:[e,a&&l.jsx("span",{className:"ml-0.5 text-destructive",children:"*"})]})});at.displayName="FieldLabel";const Je=h.forwardRef(({className:t,children:e,...r},n)=>{const{error:s}=ds(),a=s??e;return a?l.jsx("p",{ref:n,className:N("text-xs",s?"text-destructive":"text-muted-foreground",t),...r,children:a}):null});Je.displayName="FieldMessage";const Ru=b.forwardRef(({className:t,containerClassName:e,isInvalid:r,...n},s)=>{const[a,i]=b.useState(!1);return l.jsxs("div",{className:N("relative",e),children:[l.jsx("input",{ref:s,type:a?"text":"password","aria-invalid":r||void 0,className:N("flex h-9 w-full rounded-md border border-input bg-background px-3 py-1 pr-10 text-sm text-foreground shadow-sm transition-colors","placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1","disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-muted",r&&"border-destructive focus-visible:ring-destructive",t),...n}),l.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",onClick:()=>i(o=>!o),children:a?l.jsx(J.EyeOff,{className:"h-4 w-4"}):l.jsx(J.EyeIcon,{className:"h-4 w-4"})})]})});Ru.displayName="PasswordInput";const $r=h.forwardRef(({className:t,isInvalid:e,"aria-invalid":r,...n},s)=>{const a=e??(r===!0||r==="true");return l.jsx("input",{ref:s,"aria-invalid":a||void 0,className:N("h-8 w-full min-w-0 rounded-lg border border-input bg-transparent px-2.5 py-1 text-sm text-foreground transition-[border-color,box-shadow,color,background-color] outline-none","file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground","placeholder:text-muted-foreground","focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50","disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50","dark:bg-input/30 dark:disabled:bg-input/80",a&&"border-destructive focus-visible:border-destructive focus-visible:ring-destructive/20 dark:border-destructive/50 dark:focus-visible:ring-destructive/40",t),...n})});$r.displayName="Input";const Au=h.forwardRef(({className:t,...e},r)=>l.jsx("kbd",{ref:r,className:N("inline-flex min-h-6 items-center rounded-md border border-border bg-muted px-1.5 font-mono text-[11px] font-medium text-muted-foreground shadow-sm",t),...e}));Au.displayName="Kbd";const Ry=({lottieJson:t,title:e,description:r,actionLabel:n,onAction:s,fallbackIcon:a})=>l.jsxs("div",{className:"flex w-full flex-col items-center justify-center text-center",children:[t?l.jsx("div",{className:"mb-4 w-1/2",children:l.jsx(Rd,{animationData:t,loop:!0})}):a&&l.jsx("div",{className:"mb-4 text-[color:var(--oniratec-label-secondary)]",children:a}),l.jsx("h2",{className:"mb-2 text-lg font-semibold text-[color:var(--oniratec-label-primary)]",children:e}),r&&l.jsx("p",{className:"mb-6 max-w-md text-sm text-[color:var(--oniratec-label-secondary)]",children:r}),n&&s&&l.jsx(Le,{size:"md",onClick:s,children:n})]}),Mu=h.forwardRef(({className:t,indicatorClassName:e,max:r=100,value:n=0,...s},a)=>{const i=r>0?r:100,o=n==null?0:Math.min(Math.max(n,0),i),c=`${o/i*100}%`;return l.jsx("div",{ref:a,role:"progressbar","aria-valuemin":0,"aria-valuemax":i,"aria-valuenow":n==null?void 0:o,className:N("h-2 w-full overflow-hidden rounded-full bg-muted ring-1 ring-foreground/10",t),...s,children:l.jsx("div",{className:N("h-full rounded-full bg-primary transition-[width] duration-300",e),style:{width:c}})})});Mu.displayName="Progress";const Iu=h.createContext(null);function Ay(){const t=h.useContext(Iu);if(!t)throw new Error("RadioGroupItem must be used inside <RadioGroup>.");return t}function My({className:t,defaultValue:e,disabled:r,name:n,onValueChange:s,orientation:a="vertical",required:i,value:o,...c}){const u=h.useId(),[f,d]=h.useState(e),m=o!==void 0,p=m?o:f,y=h.useCallback(g=>{m||d(g),s?.(g)},[m,s]);return l.jsx(Iu.Provider,{value:{disabled:r,name:n??u,onValueChange:y,orientation:a,required:i,value:p},children:l.jsx("div",{role:"radiogroup","aria-required":i,"data-orientation":a,className:N("flex gap-3",a==="horizontal"?"flex-row flex-wrap items-center":"flex-col",t),...c})})}const Pu=h.forwardRef(({className:t,description:e,disabled:r,id:n,label:s,size:a="md",value:i,"aria-describedby":o,"aria-invalid":c,onChange:u,...f},d)=>{const m=h.useId(),p=n??m,y=e?`${p}-description`:void 0,g=c===!0||c==="true",x=Ay(),v=x.value===i,S=x.disabled||r;return l.jsxs("label",{htmlFor:p,className:N("inline-flex w-fit items-start gap-2.5 text-sm",S&&"cursor-not-allowed opacity-60",t),children:[l.jsx("input",{ref:d,id:p,type:"radio",name:x.name,value:i,checked:v,required:x.required,disabled:S,"aria-invalid":g||void 0,"aria-describedby":[o,y].filter(Boolean).join(" ")||void 0,className:"peer sr-only",onChange:C=>{C.target.checked&&x.onValueChange(i),u?.(C)},...f}),l.jsx("span",{className:N("flex shrink-0 items-center justify-center rounded-full border border-input bg-background text-primary transition-[background-color,border-color,box-shadow,color] outline-none","peer-focus-visible:border-ring peer-focus-visible:ring-3 peer-focus-visible:ring-ring/50","peer-disabled:border-input peer-disabled:bg-input/50","peer-checked:border-primary peer-checked:bg-primary/10 peer-checked:[&_span]:scale-100 peer-checked:[&_span]:opacity-100",g&&"border-destructive peer-focus-visible:border-destructive peer-focus-visible:ring-destructive/20",a==="sm"?"h-4 w-4":"h-5 w-5"),children:l.jsx("span",{className:N("rounded-full bg-primary opacity-0 transition-[opacity,transform]",a==="sm"?"h-2 w-2 scale-75":"h-2.5 w-2.5 scale-75")})}),(s||e)&&l.jsxs("span",{className:"grid gap-1 leading-tight",children:[s&&l.jsx("span",{className:"font-medium text-foreground",children:s}),e&&l.jsx("span",{id:y,className:"text-sm text-muted-foreground",children:e})]})]})});Pu.displayName="RadioGroupItem";const fs=pe.Root,Iy=pe.Group,hs=pe.Value,Kr=h.forwardRef(({className:t,hasError:e,children:r,...n},s)=>l.jsxs(pe.Trigger,{ref:s,"aria-invalid":e||void 0,className:N("flex h-8 w-full items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent px-2.5 py-1 pr-2 text-sm transition-[border-color,box-shadow,color,background-color] outline-none","data-[placeholder]:text-muted-foreground","focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50","disabled:cursor-not-allowed disabled:opacity-50","dark:bg-input/30 dark:hover:bg-input/50","[&>span]:line-clamp-1",e&&"border-destructive focus-visible:border-destructive focus-visible:ring-destructive/20 dark:border-destructive/50 dark:focus-visible:ring-destructive/40",t),...n,children:[r,l.jsx(pe.Icon,{asChild:!0,children:l.jsx(J.ChevronDown,{className:"h-4 w-4 shrink-0 text-muted-foreground"})})]}));Kr.displayName=pe.Trigger.displayName;const qa=h.forwardRef(({className:t,...e},r)=>l.jsx(pe.ScrollUpButton,{ref:r,className:N("flex cursor-default items-center justify-center bg-popover py-1",t),...e,children:l.jsx(J.ChevronUp,{className:"h-4 w-4"})}));qa.displayName=pe.ScrollUpButton.displayName;const Ya=h.forwardRef(({className:t,...e},r)=>l.jsx(pe.ScrollDownButton,{ref:r,className:N("flex cursor-default items-center justify-center bg-popover py-1",t),...e,children:l.jsx(J.ChevronDown,{className:"h-4 w-4"})}));Ya.displayName=pe.ScrollDownButton.displayName;const Qr=h.forwardRef(({className:t,children:e,position:r="popper",...n},s)=>l.jsx(pe.Portal,{children:l.jsxs(pe.Content,{ref:s,className:N("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-lg bg-popover text-popover-foreground shadow-card-sm ring-1 ring-foreground/10 outline-none","transition-[opacity,transform] duration-100","data-[state=closed]:opacity-0 data-[state=closed]:scale-95","data-[state=open]:opacity-100 data-[state=open]:scale-100",r==="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:r,...n,children:[l.jsx(qa,{}),l.jsx(pe.Viewport,{className:N("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),l.jsx(Ya,{})]})}));Qr.displayName=pe.Content.displayName;const Fu=h.forwardRef(({className:t,...e},r)=>l.jsx(pe.Label,{ref:r,className:N("px-1.5 py-1 text-xs font-medium text-muted-foreground",t),...e}));Fu.displayName=pe.Label.displayName;const en=h.forwardRef(({className:t,children:e,...r},n)=>l.jsxs(pe.Item,{ref:n,className:N("relative flex w-full cursor-default select-none items-center gap-1.5 rounded-md py-1 pl-1.5 pr-8 text-sm outline-none transition-colors","focus:bg-accent focus:text-accent-foreground","data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...r,children:[l.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:l.jsx(pe.ItemIndicator,{children:l.jsx(J.Check,{className:"h-4 w-4"})})}),l.jsx(pe.ItemText,{children:e})]}));en.displayName=pe.Item.displayName;const Lu=h.forwardRef(({className:t,...e},r)=>l.jsx(pe.Separator,{ref:r,className:N("-mx-1 my-1 h-px bg-border",t),...e}));Lu.displayName=pe.Separator.displayName;function Py(t,e){const[r,n]=h.useState(t);return h.useEffect(()=>{const s=setTimeout(()=>n(t),e);return()=>clearTimeout(s)},[t,e]),r}function Ga({value:t,onValueChange:e,placeholder:r="Seleccionar",searchPlaceholder:n="Buscar...",disabled:s,hasError:a,minChars:i=2,debounceMs:o=300,fetcher:c,getOptionValue:u,getOptionLabel:f,emptyLabel:d="Sin resultados",loadingLabel:m="Buscando...",emptyActionLabel:p,onEmptyActionClick:y,contentClassName:g,triggerClassName:x}){const[v,S]=h.useState(!1),[C,k]=h.useState(""),[w,j]=h.useState(!1),[T,A]=h.useState([]),[$,L]=h.useState(""),W=Py(C,o),B=W.trim().length>=i,G=h.useRef(null);h.useEffect(()=>{const H=P=>{G.current&&(G.current.contains(P.target)||S(!1))};return document.addEventListener("mousedown",H),()=>document.removeEventListener("mousedown",H)},[]),h.useEffect(()=>{let H=!0;return(async()=>{if(v){if(!B){A([]);return}j(!0);try{const U=await c(W.trim());if(!H)return;A(U??[])}finally{H&&j(!1)}}})(),()=>{H=!1}},[v,W,B,c]),h.useEffect(()=>{if(!t){L("");return}const H=T.find(P=>u(P)===t);H&&L(f(H))},[t,T,u,f]);const Q=$||r;return l.jsxs("div",{ref:G,className:"relative w-full",children:[l.jsxs("button",{type:"button",disabled:s,"aria-invalid":a?"true":"false","aria-expanded":v,"aria-haspopup":"listbox",onClick:()=>S(H=>!H),className:N("flex h-9 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm shadow-sm transition-colors","focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-1","disabled:cursor-not-allowed disabled:opacity-50",a&&"border-destructive focus:ring-destructive",x),children:[l.jsx("span",{className:N("truncate",!$&&"text-muted-foreground"),children:Q}),l.jsx(J.ChevronDown,{className:N("h-4 w-4 shrink-0 opacity-50 transition-transform",v&&"rotate-180")})]}),v&&l.jsxs("div",{className:N("absolute left-0 top-full z-50 mt-1 w-full rounded-md border border-border bg-popover shadow-card-sm",g),role:"listbox",children:[l.jsxs("div",{className:"flex items-center border-b border-border px-3",children:[l.jsx("input",{className:"flex h-9 w-full bg-transparent py-2 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",value:C,onChange:H=>k(H.target.value),placeholder:n,autoFocus:!0}),w&&l.jsx(J.Loader2,{className:"h-4 w-4 shrink-0 animate-spin text-muted-foreground"})]}),l.jsxs("div",{className:"max-h-60 overflow-y-auto p-1",children:[!B&&l.jsxs("p",{className:"py-2 text-center text-xs text-muted-foreground",children:["Escribe al menos ",i," caracteres"]}),B&&w&&l.jsx("p",{className:"py-2 text-center text-xs text-muted-foreground",children:m}),B&&!w&&T.length===0&&l.jsxs("div",{className:"flex flex-col items-center gap-2 py-3",children:[l.jsx("p",{className:"text-xs text-muted-foreground",children:d}),p&&y&&l.jsx("button",{type:"button",className:"text-xs font-medium text-primary hover:underline",onClick:y,children:p})]}),T.length>0&&l.jsx("ul",{children:T.map(H=>{const P=u(H),U=f(H),V=P===t;return l.jsx("li",{children:l.jsxs("button",{type:"button",role:"option","aria-selected":V,className:N("relative flex w-full cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors","hover:bg-accent hover:text-accent-foreground",V&&"bg-accent text-accent-foreground font-medium"),onClick:()=>{e(P),L(U),S(!1),k("")},children:[V&&l.jsx(J.Check,{className:"mr-2 h-4 w-4 shrink-0"}),l.jsx("span",{className:N(!V&&"ml-6"),children:U})]})},P)})})]})]})]})}const Vu=h.forwardRef(({className:t,decorative:e=!0,orientation:r="horizontal",...n},s)=>l.jsx("div",{ref:s,role:e?"none":"separator","aria-orientation":e?void 0:r,"data-orientation":r,className:N("shrink-0 bg-border",r==="horizontal"?"h-px w-full":"h-full w-px",t),...n}));Vu.displayName="Separator";const Fy=yu,Ly=vu,Vy=cs,$u=xu,Xa=h.forwardRef(({className:t,...e},r)=>l.jsx(as,{ref:r,className:N("fixed inset-0 isolate z-50 bg-black/10 backdrop-blur-[2px] transition-opacity duration-100","data-[state=closed]:opacity-0 data-[state=open]:opacity-100",t),...e}));Xa.displayName=as.displayName;const $y=Bn("fixed z-50 flex flex-col gap-4 bg-background p-4 text-sm ring-1 ring-foreground/10 shadow-card-lg outline-none transition-[opacity,transform] duration-100 data-[state=closed]:opacity-0 data-[state=open]:opacity-100",{variants:{side:{top:"inset-x-0 top-0 border-b border-border data-[state=closed]:-translate-y-6 data-[state=open]:translate-y-0",bottom:"inset-x-0 bottom-0 border-t border-border data-[state=closed]:translate-y-6 data-[state=open]:translate-y-0",left:"inset-y-0 left-0 h-full w-full max-w-sm border-r border-border data-[state=closed]:-translate-x-full data-[state=open]:translate-x-0",right:"inset-y-0 right-0 h-full w-full max-w-sm border-l border-border data-[state=closed]:translate-x-full data-[state=open]:translate-x-0"}},defaultVariants:{side:"right"}}),zu=h.forwardRef(({side:t="right",className:e,children:r,hideClose:n,...s},a)=>l.jsxs($u,{children:[l.jsx(Xa,{}),l.jsxs(is,{ref:a,className:N($y({side:t}),e),...s,children:[!n&&l.jsx(cs,{asChild:!0,children:l.jsxs(Le,{variant:"ghost",size:"icon-sm",className:"absolute right-2 top-2","aria-label":"Cerrar",children:[l.jsx(J.X,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"Cerrar"})]})}),r]})]}));zu.displayName=is.displayName;const Wu=({className:t,...e})=>l.jsx("div",{className:N("flex flex-col gap-2",t),...e});Wu.displayName="SheetHeader";const Zu=({className:t,...e})=>l.jsx("div",{className:N("-mx-4 -mb-4 mt-auto flex flex-col-reverse gap-2 border-t bg-muted/50 p-4 sm:flex-row sm:justify-end",t),...e});Zu.displayName="SheetFooter";const Bu=h.forwardRef(({className:t,...e},r)=>l.jsx(os,{ref:r,className:N("text-base font-medium leading-none text-foreground",t),...e}));Bu.displayName=os.displayName;const Uu=h.forwardRef(({className:t,...e},r)=>l.jsx(ls,{ref:r,className:N("text-sm text-muted-foreground",t),...e}));Uu.displayName=ls.displayName;function sa({className:t}){return l.jsx("div",{className:N("animate-pulse rounded-lg bg-muted/80",t)})}const Hu=h.forwardRef(({className:t,isInvalid:e,"aria-invalid":r,...n},s)=>{const a=e??(r===!0||r==="true");return l.jsx("textarea",{ref:s,"aria-invalid":a||void 0,className:N("min-h-20 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-sm text-foreground transition-[border-color,box-shadow,color,background-color] outline-none","placeholder:text-muted-foreground","focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50","disabled:pointer-events-none disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50","dark:bg-input/30 dark:disabled:bg-input/80","resize-y",a&&"border-destructive focus-visible:border-destructive focus-visible:ring-destructive/20 dark:border-destructive/50 dark:focus-visible:ring-destructive/40",t),...n})});Hu.displayName="Textarea";const qu=h.createContext(null);function Ja(){const t=h.useContext(qu);if(!t)throw new Error("Tabs components must be used inside <Tabs>.");return t}function zy({children:t,className:e,defaultValue:r,onValueChange:n,orientation:s="horizontal",value:a,...i}){const o=h.useId(),[c,u]=h.useState(r),f=a!==void 0,d=f?a:c,m=h.useCallback(p=>{f||u(p),n?.(p)},[f,n]);return l.jsx(qu.Provider,{value:{baseId:o,onValueChange:m,orientation:s,value:d},children:l.jsx("div",{className:N("w-full",e),"data-orientation":s,...i,children:t})})}const Yu=h.forwardRef(({className:t,onKeyDown:e,...r},n)=>{const{onValueChange:s,orientation:a}=Ja();return l.jsx("div",{ref:n,role:"tablist","aria-orientation":a,className:N("inline-flex w-fit items-center gap-1 rounded-lg bg-muted p-1 text-muted-foreground ring-1 ring-foreground/10",a==="vertical"&&"flex-col items-stretch",t),onKeyDown:i=>{const o=a==="horizontal"?i.key==="ArrowRight":i.key==="ArrowDown",c=a==="horizontal"?i.key==="ArrowLeft":i.key==="ArrowUp",u=i.key==="Home"||i.key==="End";if(!o&&!c&&!u){e?.(i);return}const f=Array.from(i.currentTarget.querySelectorAll('[role="tab"]:not(:disabled)'));if(f.length===0){e?.(i);return}const d=f.findIndex(g=>g===document.activeElement);let m=d===-1?0:d;o&&(m=(d+1+f.length)%f.length),c&&(m=(d-1+f.length)%f.length),i.key==="Home"&&(m=0),i.key==="End"&&(m=f.length-1),i.preventDefault();const p=f[m];p?.focus();const y=p?.dataset.value;y&&s(y),e?.(i)},...r})});Yu.displayName="TabsList";const Gu=h.forwardRef(({children:t,className:e,value:r,...n},s)=>{const{baseId:a,onValueChange:i,orientation:o,value:c}=Ja(),u=r===c;return l.jsx("button",{ref:s,id:`${a}-trigger-${r}`,type:"button",role:"tab","aria-controls":`${a}-content-${r}`,"aria-selected":u,tabIndex:u?0:-1,"data-state":u?"active":"inactive","data-value":r,className:N("inline-flex h-8 items-center justify-center gap-1.5 rounded-md px-2.5 text-sm font-medium transition-[background-color,color,box-shadow,transform] outline-none","focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50","data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-card-sm","data-[state=inactive]:text-muted-foreground hover:text-foreground",o==="vertical"&&"justify-start",e),onClick:()=>i(r),...n,children:t})});Gu.displayName="TabsTrigger";const Xu=h.forwardRef(({className:t,forceMount:e=!1,value:r,...n},s)=>{const{baseId:a,value:i}=Ja(),o=r===i;return!o&&!e?null:l.jsx("div",{ref:s,id:`${a}-content-${r}`,role:"tabpanel","aria-labelledby":`${a}-trigger-${r}`,hidden:!o,tabIndex:0,"data-state":o?"active":"inactive",className:N("mt-4 outline-none focus-visible:ring-3 focus-visible:ring-ring/50",!o&&"hidden",t),...n})});Xu.displayName="TabsContent";function Wy(t){const e=h.useRef({value:t,previous:t});return h.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var ms="Switch",[Zy]=Un(ms),[By,Uy]=Zy(ms),Ju=h.forwardRef((t,e)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:a,required:i,disabled:o,value:c="on",onCheckedChange:u,form:f,...d}=t,[m,p]=h.useState(null),y=$e(e,C=>p(C)),g=h.useRef(!1),x=m?f||!!m.closest("form"):!0,[v,S]=Ta({prop:s,defaultProp:a??!1,onChange:u,caller:ms});return l.jsxs(By,{scope:r,checked:v,disabled:o,children:[l.jsx(_e.button,{type:"button",role:"switch","aria-checked":v,"aria-required":i,"data-state":td(v),"data-disabled":o?"":void 0,disabled:o,value:c,...d,ref:y,onClick:Re(t.onClick,C=>{S(k=>!k),x&&(g.current=C.isPropagationStopped(),g.current||C.stopPropagation())})}),x&&l.jsx(ed,{control:m,bubbles:!g.current,name:n,value:c,checked:v,required:i,disabled:o,form:f,style:{transform:"translateX(-100%)"}})]})});Ju.displayName=ms;var Ku="SwitchThumb",Qu=h.forwardRef((t,e)=>{const{__scopeSwitch:r,...n}=t,s=Uy(Ku,r);return l.jsx(_e.span,{"data-state":td(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:e})});Qu.displayName=Ku;var Hy="SwitchBubbleInput",ed=h.forwardRef(({__scopeSwitch:t,control:e,checked:r,bubbles:n=!0,...s},a)=>{const i=h.useRef(null),o=$e(i,a),c=Wy(r),u=kl(e);return h.useEffect(()=>{const f=i.current;if(!f)return;const d=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(d,"checked").set;if(c!==r&&p){const y=new Event("click",{bubbles:n});p.call(f,r),f.dispatchEvent(y)}},[c,r,n]),l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:o,style:{...s.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});ed.displayName=Hy;function td(t){return t?"checked":"unchecked"}var qy=Ju,Yy=Qu;const tn=h.forwardRef(({checked:t,defaultChecked:e=!1,onChange:r,size:n="md",disabled:s=!1,label:a,className:i,ariaLabel:o,id:c},u)=>{const f=h.useId(),d=c??f;return l.jsxs("div",{className:N("flex items-center gap-2",i),children:[l.jsx(qy,{ref:u,id:d,checked:t,defaultChecked:e,onCheckedChange:r,disabled:s,"aria-label":o,className:N("peer inline-flex shrink-0 cursor-pointer items-center rounded-full border border-transparent transition-[background-color,box-shadow] outline-none","focus-visible:ring-3 focus-visible:ring-ring/50","disabled:cursor-not-allowed disabled:opacity-50","data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-muted/60",n==="sm"?"h-4 w-7":"h-5 w-9"),children:l.jsx(Yy,{className:N("pointer-events-none block rounded-full bg-background shadow-sm ring-1 ring-black/10 transition-transform dark:ring-white/20",n==="sm"?"h-3 w-3 translate-x-0.5 data-[state=checked]:translate-x-3":"h-4 w-4 translate-x-0.5 data-[state=checked]:translate-x-4")})}),a&&l.jsx("label",{htmlFor:d,className:N("text-sm font-medium text-foreground",s&&"cursor-not-allowed opacity-50"),children:a})]})});tn.displayName="Toggle";const Gy=tn;function Xy(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}const Jy=t=>{switch(t){case"success":return ev;case"info":return rv;case"warning":return tv;case"error":return nv;default:return null}},Ky=Array(12).fill(0),Qy=({visible:t,className:e})=>b.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},b.createElement("div",{className:"sonner-spinner"},Ky.map((r,n)=>b.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),ev=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},b.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),tv=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},b.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),rv=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},b.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),nv=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},b.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),sv=b.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},b.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),b.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),av=()=>{const[t,e]=b.useState(document.hidden);return b.useEffect(()=>{const r=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),t};let aa=1;class iv{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{const r=this.subscribers.indexOf(e);this.subscribers.splice(r,1)}),this.publish=e=>{this.subscribers.forEach(r=>r(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var r;const{message:n,...s}=e,a=typeof e?.id=="number"||((r=e.id)==null?void 0:r.length)>0?e.id:aa++,i=this.toasts.find(c=>c.id===a),o=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),i?this.toasts=this.toasts.map(c=>c.id===a?(this.publish({...c,...e,id:a,title:n}),{...c,...e,id:a,dismissible:o,title:n}):c):this.addToast({title:n,...s,dismissible:o,id:a}),a},this.dismiss=e=>(e?(this.dismissedToasts.add(e),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:e,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(n=>n({id:r.id,dismiss:!0}))}),e),this.message=(e,r)=>this.create({...r,message:e}),this.error=(e,r)=>this.create({...r,message:e,type:"error"}),this.success=(e,r)=>this.create({...r,type:"success",message:e}),this.info=(e,r)=>this.create({...r,type:"info",message:e}),this.warning=(e,r)=>this.create({...r,type:"warning",message:e}),this.loading=(e,r)=>this.create({...r,type:"loading",message:e}),this.promise=(e,r)=>{if(!r)return;let n;r.loading!==void 0&&(n=this.create({...r,promise:e,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const s=Promise.resolve(e instanceof Function?e():e);let a=n!==void 0,i;const o=s.then(async u=>{if(i=["resolve",u],b.isValidElement(u))a=!1,this.create({id:n,type:"default",message:u});else if(lv(u)&&!u.ok){a=!1;const d=typeof r.error=="function"?await r.error(`HTTP error! status: ${u.status}`):r.error,m=typeof r.description=="function"?await r.description(`HTTP error! status: ${u.status}`):r.description,y=typeof d=="object"&&!b.isValidElement(d)?d:{message:d};this.create({id:n,type:"error",description:m,...y})}else if(u instanceof Error){a=!1;const d=typeof r.error=="function"?await r.error(u):r.error,m=typeof r.description=="function"?await r.description(u):r.description,y=typeof d=="object"&&!b.isValidElement(d)?d:{message:d};this.create({id:n,type:"error",description:m,...y})}else if(r.success!==void 0){a=!1;const d=typeof r.success=="function"?await r.success(u):r.success,m=typeof r.description=="function"?await r.description(u):r.description,y=typeof d=="object"&&!b.isValidElement(d)?d:{message:d};this.create({id:n,type:"success",description:m,...y})}}).catch(async u=>{if(i=["reject",u],r.error!==void 0){a=!1;const f=typeof r.error=="function"?await r.error(u):r.error,d=typeof r.description=="function"?await r.description(u):r.description,p=typeof f=="object"&&!b.isValidElement(f)?f:{message:f};this.create({id:n,type:"error",description:d,...p})}}).finally(()=>{a&&(this.dismiss(n),n=void 0),r.finally==null||r.finally.call(r)}),c=()=>new Promise((u,f)=>o.then(()=>i[0]==="reject"?f(i[1]):u(i[1])).catch(f));return typeof n!="string"&&typeof n!="number"?{unwrap:c}:Object.assign(n,{unwrap:c})},this.custom=(e,r)=>{const n=r?.id||aa++;return this.create({jsx:e(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const De=new iv,ov=(t,e)=>{const r=e?.id||aa++;return De.addToast({title:t,...e,id:r}),r},lv=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",cv=ov,uv=()=>De.toasts,dv=()=>De.getActiveToasts(),fv=Object.assign(cv,{success:De.success,info:De.info,warning:De.warning,error:De.error,custom:De.custom,message:De.message,promise:De.promise,dismiss:De.dismiss,loading:De.loading},{getHistory:uv,getToasts:dv});Xy("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function yn(t){return t.label!==void 0}const hv=3,mv="24px",pv="16px",yo=4e3,gv=356,yv=14,vv=45,xv=200;function nt(...t){return t.filter(Boolean).join(" ")}function bv(t){const[e,r]=t.split("-"),n=[];return e&&n.push(e),r&&n.push(r),n}const wv=t=>{var e,r,n,s,a,i,o,c,u;const{invert:f,toast:d,unstyled:m,interacting:p,setHeights:y,visibleToasts:g,heights:x,index:v,toasts:S,expanded:C,removeToast:k,defaultRichColors:w,closeButton:j,style:T,cancelButtonStyle:A,actionButtonStyle:$,className:L="",descriptionClassName:W="",duration:B,position:G,gap:Q,expandByDefault:H,classNames:P,icons:U,closeButtonAriaLabel:V="Close toast"}=t,[ie,F]=b.useState(null),[D,ee]=b.useState(null),[z,oe]=b.useState(!1),[ce,ve]=b.useState(!1),[Te,le]=b.useState(!1),[vt,Yt]=b.useState(!1),[Gt,xt]=b.useState(!1),[Xt,ps]=b.useState(0),[bd,ri]=b.useState(0),Er=b.useRef(d.duration||B||yo),ni=b.useRef(null),ht=b.useRef(null),wd=v===0,kd=v+1<=g,Ae=d.type,Jt=d.dismissible!==!1,Sd=d.className||"",Nd=d.descriptionClassName||"",rn=b.useMemo(()=>x.findIndex(X=>X.toastId===d.id)||0,[x,d.id]),Cd=b.useMemo(()=>{var X;return(X=d.closeButton)!=null?X:j},[d.closeButton,j]),si=b.useMemo(()=>d.duration||B||yo,[d.duration,B]),gs=b.useRef(0),Kt=b.useRef(0),ai=b.useRef(0),Qt=b.useRef(null),[_d,Td]=G.split("-"),ii=b.useMemo(()=>x.reduce((X,xe,we)=>we>=rn?X:X+xe.height,0),[x,rn]),oi=av(),jd=d.invert||f,ys=Ae==="loading";Kt.current=b.useMemo(()=>rn*Q+ii,[rn,ii]),b.useEffect(()=>{Er.current=si},[si]),b.useEffect(()=>{oe(!0)},[]),b.useEffect(()=>{const X=ht.current;if(X){const xe=X.getBoundingClientRect().height;return ri(xe),y(we=>[{toastId:d.id,height:xe,position:d.position},...we]),()=>y(we=>we.filter(Me=>Me.toastId!==d.id))}},[y,d.id]),b.useLayoutEffect(()=>{if(!z)return;const X=ht.current,xe=X.style.height;X.style.height="auto";const we=X.getBoundingClientRect().height;X.style.height=xe,ri(we),y(Me=>Me.find(be=>be.toastId===d.id)?Me.map(be=>be.toastId===d.id?{...be,height:we}:be):[{toastId:d.id,height:we,position:d.position},...Me])},[z,d.title,d.description,y,d.id,d.jsx,d.action,d.cancel]);const bt=b.useCallback(()=>{ve(!0),ps(Kt.current),y(X=>X.filter(xe=>xe.toastId!==d.id)),setTimeout(()=>{k(d)},xv)},[d,k,y,Kt]);b.useEffect(()=>{if(d.promise&&Ae==="loading"||d.duration===1/0||d.type==="loading")return;let X;return C||p||oi?(()=>{if(ai.current<gs.current){const Me=new Date().getTime()-gs.current;Er.current=Er.current-Me}ai.current=new Date().getTime()})():Er.current!==1/0&&(gs.current=new Date().getTime(),X=setTimeout(()=>{d.onAutoClose==null||d.onAutoClose.call(d,d),bt()},Er.current)),()=>clearTimeout(X)},[C,p,d,Ae,oi,bt]),b.useEffect(()=>{d.delete&&(bt(),d.onDismiss==null||d.onDismiss.call(d,d))},[bt,d.delete]);function Ed(){var X;if(U?.loading){var xe;return b.createElement("div",{className:nt(P?.loader,d==null||(xe=d.classNames)==null?void 0:xe.loader,"sonner-loader"),"data-visible":Ae==="loading"},U.loading)}return b.createElement(Qy,{className:nt(P?.loader,d==null||(X=d.classNames)==null?void 0:X.loader),visible:Ae==="loading"})}const Od=d.icon||U?.[Ae]||Jy(Ae);var li,ci;return b.createElement("li",{tabIndex:0,ref:ht,className:nt(L,Sd,P?.toast,d==null||(e=d.classNames)==null?void 0:e.toast,P?.default,P?.[Ae],d==null||(r=d.classNames)==null?void 0:r[Ae]),"data-sonner-toast":"","data-rich-colors":(li=d.richColors)!=null?li:w,"data-styled":!(d.jsx||d.unstyled||m),"data-mounted":z,"data-promise":!!d.promise,"data-swiped":Gt,"data-removed":ce,"data-visible":kd,"data-y-position":_d,"data-x-position":Td,"data-index":v,"data-front":wd,"data-swiping":Te,"data-dismissible":Jt,"data-type":Ae,"data-invert":jd,"data-swipe-out":vt,"data-swipe-direction":D,"data-expanded":!!(C||H&&z),"data-testid":d.testId,style:{"--index":v,"--toasts-before":v,"--z-index":S.length-v,"--offset":`${ce?Xt:Kt.current}px`,"--initial-height":H?"auto":`${bd}px`,...T,...d.style},onDragEnd:()=>{le(!1),F(null),Qt.current=null},onPointerDown:X=>{X.button!==2&&(ys||!Jt||(ni.current=new Date,ps(Kt.current),X.target.setPointerCapture(X.pointerId),X.target.tagName!=="BUTTON"&&(le(!0),Qt.current={x:X.clientX,y:X.clientY})))},onPointerUp:()=>{var X,xe,we;if(vt||!Jt)return;Qt.current=null;const Me=Number(((X=ht.current)==null?void 0:X.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),nn=Number(((xe=ht.current)==null?void 0:xe.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),be=new Date().getTime()-((we=ni.current)==null?void 0:we.getTime()),ze=ie==="x"?Me:nn,sn=Math.abs(ze)/be;if(Math.abs(ze)>=vv||sn>.11){ps(Kt.current),d.onDismiss==null||d.onDismiss.call(d,d),ee(ie==="x"?Me>0?"right":"left":nn>0?"down":"up"),bt(),Yt(!0);return}else{var He,qe;(He=ht.current)==null||He.style.setProperty("--swipe-amount-x","0px"),(qe=ht.current)==null||qe.style.setProperty("--swipe-amount-y","0px")}xt(!1),le(!1),F(null)},onPointerMove:X=>{var xe,we,Me;if(!Qt.current||!Jt||((xe=window.getSelection())==null?void 0:xe.toString().length)>0)return;const be=X.clientY-Qt.current.y,ze=X.clientX-Qt.current.x;var sn;const He=(sn=t.swipeDirections)!=null?sn:bv(G);!ie&&(Math.abs(ze)>1||Math.abs(be)>1)&&F(Math.abs(ze)>Math.abs(be)?"x":"y");let qe={x:0,y:0};const ui=Mt=>1/(1.5+Math.abs(Mt)/20);if(ie==="y"){if(He.includes("top")||He.includes("bottom"))if(He.includes("top")&&be<0||He.includes("bottom")&&be>0)qe.y=be;else{const Mt=be*ui(be);qe.y=Math.abs(Mt)<Math.abs(be)?Mt:be}}else if(ie==="x"&&(He.includes("left")||He.includes("right")))if(He.includes("left")&&ze<0||He.includes("right")&&ze>0)qe.x=ze;else{const Mt=ze*ui(ze);qe.x=Math.abs(Mt)<Math.abs(ze)?Mt:ze}(Math.abs(qe.x)>0||Math.abs(qe.y)>0)&&xt(!0),(we=ht.current)==null||we.style.setProperty("--swipe-amount-x",`${qe.x}px`),(Me=ht.current)==null||Me.style.setProperty("--swipe-amount-y",`${qe.y}px`)}},Cd&&!d.jsx&&Ae!=="loading"?b.createElement("button",{"aria-label":V,"data-disabled":ys,"data-close-button":!0,onClick:ys||!Jt?()=>{}:()=>{bt(),d.onDismiss==null||d.onDismiss.call(d,d)},className:nt(P?.closeButton,d==null||(n=d.classNames)==null?void 0:n.closeButton)},(ci=U?.close)!=null?ci:sv):null,(Ae||d.icon||d.promise)&&d.icon!==null&&(U?.[Ae]!==null||d.icon)?b.createElement("div",{"data-icon":"",className:nt(P?.icon,d==null||(s=d.classNames)==null?void 0:s.icon)},d.promise||d.type==="loading"&&!d.icon?d.icon||Ed():null,d.type!=="loading"?Od:null):null,b.createElement("div",{"data-content":"",className:nt(P?.content,d==null||(a=d.classNames)==null?void 0:a.content)},b.createElement("div",{"data-title":"",className:nt(P?.title,d==null||(i=d.classNames)==null?void 0:i.title)},d.jsx?d.jsx:typeof d.title=="function"?d.title():d.title),d.description?b.createElement("div",{"data-description":"",className:nt(W,Nd,P?.description,d==null||(o=d.classNames)==null?void 0:o.description)},typeof d.description=="function"?d.description():d.description):null),b.isValidElement(d.cancel)?d.cancel:d.cancel&&yn(d.cancel)?b.createElement("button",{"data-button":!0,"data-cancel":!0,style:d.cancelButtonStyle||A,onClick:X=>{yn(d.cancel)&&Jt&&(d.cancel.onClick==null||d.cancel.onClick.call(d.cancel,X),bt())},className:nt(P?.cancelButton,d==null||(c=d.classNames)==null?void 0:c.cancelButton)},d.cancel.label):null,b.isValidElement(d.action)?d.action:d.action&&yn(d.action)?b.createElement("button",{"data-button":!0,"data-action":!0,style:d.actionButtonStyle||$,onClick:X=>{yn(d.action)&&(d.action.onClick==null||d.action.onClick.call(d.action,X),!X.defaultPrevented&&bt())},className:nt(P?.actionButton,d==null||(u=d.classNames)==null?void 0:u.actionButton)},d.action.label):null)};function vo(){if(typeof window>"u"||typeof document>"u")return"ltr";const t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function kv(t,e){const r={};return[t,e].forEach((n,s)=>{const a=s===1,i=a?"--mobile-offset":"--offset",o=a?pv:mv;function c(u){["top","right","bottom","left"].forEach(f=>{r[`${i}-${f}`]=typeof u=="number"?`${u}px`:u})}typeof n=="number"||typeof n=="string"?c(n):typeof n=="object"?["top","right","bottom","left"].forEach(u=>{n[u]===void 0?r[`${i}-${u}`]=o:r[`${i}-${u}`]=typeof n[u]=="number"?`${n[u]}px`:n[u]}):c(o)}),r}const Sv=b.forwardRef(function(e,r){const{id:n,invert:s,position:a="bottom-right",hotkey:i=["altKey","KeyT"],expand:o,closeButton:c,className:u,offset:f,mobileOffset:d,theme:m="light",richColors:p,duration:y,style:g,visibleToasts:x=hv,toastOptions:v,dir:S=vo(),gap:C=yv,icons:k,containerAriaLabel:w="Notifications"}=e,[j,T]=b.useState([]),A=b.useMemo(()=>n?j.filter(z=>z.toasterId===n):j.filter(z=>!z.toasterId),[j,n]),$=b.useMemo(()=>Array.from(new Set([a].concat(A.filter(z=>z.position).map(z=>z.position)))),[A,a]),[L,W]=b.useState([]),[B,G]=b.useState(!1),[Q,H]=b.useState(!1),[P,U]=b.useState(m!=="system"?m:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),V=b.useRef(null),ie=i.join("+").replace(/Key/g,"").replace(/Digit/g,""),F=b.useRef(null),D=b.useRef(!1),ee=b.useCallback(z=>{T(oe=>{var ce;return(ce=oe.find(ve=>ve.id===z.id))!=null&&ce.delete||De.dismiss(z.id),oe.filter(({id:ve})=>ve!==z.id)})},[]);return b.useEffect(()=>De.subscribe(z=>{if(z.dismiss){requestAnimationFrame(()=>{T(oe=>oe.map(ce=>ce.id===z.id?{...ce,delete:!0}:ce))});return}setTimeout(()=>{ma.flushSync(()=>{T(oe=>{const ce=oe.findIndex(ve=>ve.id===z.id);return ce!==-1?[...oe.slice(0,ce),{...oe[ce],...z},...oe.slice(ce+1)]:[z,...oe]})})})}),[j]),b.useEffect(()=>{if(m!=="system"){U(m);return}if(m==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?U("dark"):U("light")),typeof window>"u")return;const z=window.matchMedia("(prefers-color-scheme: dark)");try{z.addEventListener("change",({matches:oe})=>{U(oe?"dark":"light")})}catch{z.addListener(({matches:ce})=>{try{U(ce?"dark":"light")}catch(ve){console.error(ve)}})}},[m]),b.useEffect(()=>{j.length<=1&&G(!1)},[j]),b.useEffect(()=>{const z=oe=>{var ce;if(i.every(le=>oe[le]||oe.code===le)){var Te;G(!0),(Te=V.current)==null||Te.focus()}oe.code==="Escape"&&(document.activeElement===V.current||(ce=V.current)!=null&&ce.contains(document.activeElement))&&G(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[i]),b.useEffect(()=>{if(V.current)return()=>{F.current&&(F.current.focus({preventScroll:!0}),F.current=null,D.current=!1)}},[V.current]),b.createElement("section",{ref:r,"aria-label":`${w} ${ie}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},$.map((z,oe)=>{var ce;const[ve,Te]=z.split("-");return A.length?b.createElement("ol",{key:z,dir:S==="auto"?vo():S,tabIndex:-1,ref:V,className:u,"data-sonner-toaster":!0,"data-sonner-theme":P,"data-y-position":ve,"data-x-position":Te,style:{"--front-toast-height":`${((ce=L[0])==null?void 0:ce.height)||0}px`,"--width":`${gv}px`,"--gap":`${C}px`,...g,...kv(f,d)},onBlur:le=>{D.current&&!le.currentTarget.contains(le.relatedTarget)&&(D.current=!1,F.current&&(F.current.focus({preventScroll:!0}),F.current=null))},onFocus:le=>{le.target instanceof HTMLElement&&le.target.dataset.dismissible==="false"||D.current||(D.current=!0,F.current=le.relatedTarget)},onMouseEnter:()=>G(!0),onMouseMove:()=>G(!0),onMouseLeave:()=>{Q||G(!1)},onDragEnd:()=>G(!1),onPointerDown:le=>{le.target instanceof HTMLElement&&le.target.dataset.dismissible==="false"||H(!0)},onPointerUp:()=>H(!1)},A.filter(le=>!le.position&&oe===0||le.position===z).map((le,vt)=>{var Yt,Gt;return b.createElement(wv,{key:le.id,icons:k,index:vt,toast:le,defaultRichColors:p,duration:(Yt=v?.duration)!=null?Yt:y,className:v?.className,descriptionClassName:v?.descriptionClassName,invert:s,visibleToasts:x,closeButton:(Gt=v?.closeButton)!=null?Gt:c,interacting:Q,position:z,style:v?.style,unstyled:v?.unstyled,classNames:v?.classNames,cancelButtonStyle:v?.cancelButtonStyle,actionButtonStyle:v?.actionButtonStyle,closeButtonAriaLabel:v?.closeButtonAriaLabel,removeToast:ee,toasts:A.filter(xt=>xt.position==le.position),heights:L.filter(xt=>xt.position==le.position),setHeights:W,expandByDefault:o,gap:C,expanded:B,swipeDirections:e.swipeDirections})})):null}))});function Nv({...t}){return l.jsx(Sv,{position:"bottom-right",richColors:!1,toastOptions:{classNames:{toast:"group toast rounded-xl bg-background text-foreground shadow-card-sm ring-1 ring-foreground/10",title:"text-sm font-medium",description:"text-sm text-muted-foreground",actionButton:"!h-8 !rounded-md !border-0 !bg-primary !px-2.5 !text-sm !font-medium !text-primary-foreground",cancelButton:"!h-8 !rounded-md !border !border-border !bg-background !px-2.5 !text-sm !font-medium !text-foreground hover:!bg-muted",error:"!bg-destructive/10 !text-foreground !ring-destructive/20",success:"!bg-primary/5 !text-foreground !ring-primary/15",warning:"!bg-amber-500/10 !text-foreground !ring-amber-500/20",info:"!bg-accent !text-accent-foreground !ring-foreground/10"}},...t})}const Cv=zt.Provider,_v=zt.Root,Tv=zt.Trigger,rd=b.forwardRef(({className:t,sideOffset:e=6,children:r,...n},s)=>l.jsx(zt.Portal,{children:l.jsxs(zt.Content,{ref:s,sideOffset:e,className:N("z-50 overflow-hidden rounded-md bg-foreground px-2.5 py-1 text-xs font-medium text-background shadow-card-sm","transition-[opacity,transform] duration-100","data-[state=closed]:opacity-0 data-[state=closed]:scale-95","data-[state=delayed-open]:opacity-100 data-[state=delayed-open]:scale-100",t),...n,children:[r,l.jsx(zt.Arrow,{className:"fill-foreground"})]})}));rd.displayName=zt.Content.displayName;const nd=({logo:t,children:e,footer:r,className:n})=>l.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gradient-to-br from-[--surface-1] via-[--surface-2] to-[--surface-1] px-4 py-12",children:l.jsxs("div",{className:N("w-full max-w-sm rounded-xl bg-[--surface-1] p-8","shadow-[var(--shadow-card-xl)] border border-[--border-1]","flex flex-col gap-6",n),children:[t&&l.jsx("div",{className:"flex justify-center",children:t.href?l.jsx("a",{href:t.href,className:"focus-visible:outline-none focus-visible:ring-2",children:l.jsx("img",{src:t.src,alt:t.alt,className:"h-10 w-auto"})}):l.jsx("img",{src:t.src,alt:t.alt,className:"h-10 w-auto"})}),l.jsx("div",{className:"flex flex-col gap-4",children:e}),r&&l.jsx("div",{className:"border-t border-[--border-1] pt-4 text-center text-xs text-[--text-2]",children:r})]})});nd.displayName="AuthLayout";function jv({items:t,className:e,separator:r,renderLink:n}){const s=r??l.jsx(J.ChevronRight,{className:"h-4 w-4 text-[color:var(--oniratec-label-secondary)]"});return l.jsx("nav",{"aria-label":"Breadcrumb",className:e,children:l.jsx("ol",{className:"flex flex-wrap items-center gap-2 text-sm",children:t.map((a,i)=>{const o=i===t.length-1,c=l.jsx("span",{className:N("transition-colors",o?"font-medium text-[color:var(--oniratec-label-primary)]":"text-[color:var(--oniratec-label-secondary)] hover:text-[color:var(--oniratec-label-primary)]"),children:a.label}),u="inline-flex items-center gap-1 rounded-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--oniratec-focus)] focus-visible:ring-offset-2 focus-visible:ring-offset-[color:var(--oniratec-fill-primary)]";return l.jsxs("li",{className:"flex items-center gap-2",children:[o?l.jsx("span",{"aria-current":"page",children:c}):n?n({item:a,className:u,children:c}):a.href?l.jsx("a",{href:a.href,className:u,children:c}):l.jsx("button",{type:"button",onClick:a.onClick,className:u,children:c}),!o&&l.jsx("span",{"aria-hidden":"true",children:s})]},`${a.label}-${i}`)})})})}function Ev({open:t,onOpenChange:e,title:r,description:n,confirmLabel:s="Confirmar",cancelLabel:a="Cancelar",variant:i="default",onConfirm:o,loading:c=!1}){const u=async()=>{await o()};return l.jsx(bu,{open:t,onOpenChange:e,children:l.jsxs(Wa,{size:"sm",hideClose:!0,children:[l.jsxs(Za,{children:[l.jsx(Ua,{children:r}),n&&l.jsx(Ha,{children:n})]}),l.jsxs(Ba,{children:[l.jsx(Le,{variant:"secondary",onClick:()=>e(!1),disabled:c,children:a}),l.jsxs(Le,{variant:i==="destructive"?"destructive":"default",onClick:u,disabled:c,children:[c&&l.jsx(J.Loader2,{className:"h-4 w-4 animate-spin"}),s]})]})]})})}const xo="onira-sidebar-collapsed",Ov=({to:t,children:e,className:r,onClick:n})=>l.jsx("a",{href:t,className:r,onClick:n,children:e});function Dv({item:t,collapsed:e,LinkComponent:r,onMobileClose:n}){const s=r??Ov,a=t.icon;return l.jsxs(s,{to:t.to,end:t.end,className:N("group flex items-center gap-3 rounded-md px-3 py-2 text-sm font-medium transition-colors","text-muted-foreground hover:bg-accent hover:text-accent-foreground","aria-[current=page]:bg-primary/10 aria-[current=page]:text-primary",e&&"justify-center px-2"),onClick:n,children:[a&&l.jsx(a,{className:N("h-4 w-4 shrink-0 transition-colors","group-[.active]:text-primary")}),!e&&l.jsx("span",{className:"flex-1 truncate",children:t.label}),!e&&t.badge!==void 0&&l.jsx(pa,{variant:"secondary",size:"sm",children:t.badge})]})}function bo({navSections:t,logo:e,appName:r,collapsed:n,LinkComponent:s,onMobileClose:a}){return l.jsxs("div",{className:"flex h-full flex-col overflow-hidden",children:[l.jsxs("div",{className:N("flex h-14 items-center border-b border-border px-4 shrink-0",n?"justify-center px-2":"gap-2"),children:[e&&l.jsx("div",{className:"shrink-0",children:e}),!n&&r&&l.jsx("span",{className:"truncate text-sm font-semibold text-foreground",children:r})]}),l.jsx("nav",{className:"flex-1 overflow-y-auto px-2 py-3 space-y-4",children:t.map((i,o)=>l.jsxs("div",{className:"space-y-1",children:[!n&&i.title&&l.jsx("p",{className:"px-3 pb-1 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:i.title}),i.items.map(c=>l.jsx(Dv,{item:c,collapsed:n,LinkComponent:s,onMobileClose:a},c.to))]},o))})]})}function Rv({navSections:t,logo:e,appName:r,headerActions:n,children:s,LinkComponent:a}){const[i,o]=h.useState(()=>{try{return localStorage.getItem(xo)==="true"}catch{return!1}}),[c,u]=h.useState(!1),f=()=>{const d=!i;o(d);try{localStorage.setItem(xo,String(d))}catch{return}};return l.jsxs("div",{className:"flex h-screen overflow-hidden bg-background",children:[l.jsxs("aside",{className:N("hidden md:flex flex-col border-r border-border bg-card transition-all duration-200 relative",i?"w-14":"w-60"),children:[l.jsx(bo,{navSections:t,logo:e,appName:r,collapsed:i,LinkComponent:a}),l.jsx("button",{type:"button",onClick:f,className:N("absolute -right-3 top-16 z-10 flex h-6 w-6 items-center justify-center rounded-full border border-border bg-background text-muted-foreground shadow-card-sm transition-colors hover:bg-accent hover:text-accent-foreground"),"aria-label":i?"Expandir sidebar":"Colapsar sidebar",children:i?l.jsx(J.ChevronRight,{className:"h-3 w-3"}):l.jsx(J.ChevronLeft,{className:"h-3 w-3"})})]}),c&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 md:hidden",onClick:()=>u(!1)}),l.jsxs("div",{className:"fixed inset-y-0 left-0 z-50 w-72 bg-card shadow-card-xl md:hidden",children:[l.jsx("div",{className:"absolute right-3 top-3",children:l.jsx("button",{type:"button",onClick:()=>u(!1),className:"rounded-md p-1.5 text-muted-foreground hover:text-foreground",children:l.jsx(J.X,{className:"h-5 w-5"})})}),l.jsx(bo,{navSections:t,logo:e,appName:r,collapsed:!1,LinkComponent:a,onMobileClose:()=>u(!1)})]})]}),l.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden",children:[l.jsxs("header",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border bg-card px-4 md:px-6",children:[l.jsx("button",{type:"button",className:"md:hidden rounded-md p-1.5 text-muted-foreground hover:text-foreground",onClick:()=>u(!0),"aria-label":"Abrir menú",children:l.jsx(J.Menu,{className:"h-5 w-5"})}),l.jsx("div",{className:"hidden md:block"}),n&&l.jsx("div",{className:"flex items-center gap-2",children:n})]}),l.jsx("main",{className:"flex-1 overflow-y-auto",children:s})]})]})}function wo(t){return t?Array.isArray(t)?t:[t]:[]}function Av(t,e){return t==null&&e==null?0:t==null?1:e==null?-1:typeof t=="number"&&typeof e=="number"?t-e:typeof t=="boolean"&&typeof e=="boolean"?Number(t)-Number(e):t instanceof Date&&e instanceof Date?t.getTime()-e.getTime():String(t).localeCompare(String(e),void 0,{numeric:!0,sensitivity:"base"})}function sd({columns:t,data:e,enableSorting:r=!0,sortState:n,defaultSortState:s=null,onSortChange:a,unsortedIcon:i="muted",sortMode:o="single",manualSorting:c=!1,emptyContent:u,loadingContent:f,errorContent:d,isLoading:m=!1}){const[p,y]=b.useState(s),g=n!==void 0?n:p,x=wo(g),v=b.useMemo(()=>new Map(t.map(w=>[w.key,w])),[t]),S=b.useMemo(()=>{if(c||!r||x.length===0)return e;const w=[...e];return w.sort((j,T)=>{for(const A of x){const $=v.get(A.columnId);if(!$)continue;const W=($.sortFn??((B,G)=>{const Q=$.sortValue?.(B)??B[$.key],H=$.sortValue?.(G)??G[$.key];return Av(Q,H)}))(j,T);if(W!==0)return A.direction==="asc"?W:-W}return 0}),w},[e,c,x,v,r]),C=w=>{n===void 0&&y(w),a?.(w)},k=(w,j)=>{if(!(r&&(w.sortable??!!(w.sortFn||w.sortValue))))return;const A=wo(g),$=A.find(W=>W.columnId===w.key),L=$?.direction==="asc"?"desc":$?.direction==="desc"?null:"asc";if(o==="multi"&&j){const W=A.filter(B=>B.columnId!==w.key);L&&W.push({columnId:w.key,direction:L}),C(W.length?W:null);return}if(!L){C(null);return}C({columnId:w.key,direction:L})};return l.jsx("div",{className:"oniratec-data-table",children:l.jsxs("table",{className:"oniratec-data-table__table",children:[l.jsx("thead",{className:"oniratec-data-table__head",children:l.jsx("tr",{className:"oniratec-data-table__head-row",children:t.map(w=>{const j=r&&(w.sortable??!!(w.sortFn||w.sortValue)),A=x.find(L=>L.columnId===w.key)?.direction,$=j?A==="asc"?"ascending":A==="desc"?"descending":"none":void 0;return l.jsx("th",{scope:"col","aria-sort":$,className:N("oniratec-data-table__th",w.headerClassName),children:j?l.jsxs("button",{type:"button",onClick:L=>k(w,L.shiftKey),className:"oniratec-data-table__sort-button",children:[l.jsx("span",{className:"flex-1",children:w.header}),l.jsxs("span",{className:N("oniratec-data-table__sort-icon",A&&"oniratec-data-table__sort-icon--active",!A&&i==="placeholder"&&"opacity-0",!A&&i==="hidden"&&"hidden"),"aria-hidden":"true",children:[A==="asc"&&l.jsx(J.ChevronUp,{className:"h-4 w-4"}),A==="desc"&&l.jsx(J.ChevronDown,{className:"h-4 w-4"}),!A&&i!=="hidden"&&l.jsx(J.ChevronsUpDown,{className:"h-4 w-4"})]})]}):w.header},w.key)})})}),l.jsx("tbody",{className:"oniratec-data-table__divider",children:d&&!m?l.jsx("tr",{children:l.jsx("td",{colSpan:t.length,className:"oniratec-data-table__empty",children:d})}):m?l.jsx("tr",{children:l.jsx("td",{colSpan:t.length,className:"oniratec-data-table__empty",children:f??"Cargando..."})}):S.length===0?l.jsx("tr",{children:l.jsx("td",{colSpan:t.length,className:"oniratec-data-table__empty",children:u??"No hay datos disponibles."})}):S.map((w,j)=>l.jsx("tr",{className:"oniratec-data-table__row",children:t.map(T=>l.jsx("td",{className:N("oniratec-data-table__td",T.className),children:T.render(w)},T.key))},j))})]})})}const Mv=[5,10,25,50],ad=({value:t,onChange:e,options:r=Mv})=>l.jsxs("div",{className:"flex items-center gap-2 text-[color:var(--oniratec-label-secondary)]",children:[l.jsx("span",{children:"Mostrar"}),l.jsxs(fs,{value:t.toString(),onValueChange:n=>{e(parseInt(n))},children:[l.jsx(Kr,{children:l.jsx(hs,{})}),l.jsx(Qr,{children:(r??[]).map(n=>l.jsx(en,{value:n.toString(),children:String(n)},n))})]}),l.jsx("span",{children:"por página"})]}),Iv=({page:t,pageSize:e,total:r,onPageChange:n,onPageSizeChange:s})=>{const a=Math.ceil(r/e);if(a<=1&&r<=e)return null;const i=t+1,o="rounded-md border border-[color:var(--border-1)] px-3 py-1 text-[color:var(--text-1)] transition-colors hover:bg-[color:color-mix(in srgb, var(--brand) 12%, transparent)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--focus)] disabled:opacity-50 disabled:cursor-not-allowed";return l.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-4 text-sm text-[color:var(--text-2)]",children:[l.jsxs("span",{children:["Página ",i," de ",a]}),l.jsx(ad,{value:e,onChange:s}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx("button",{disabled:t===0,onClick:()=>n(t-1),"aria-label":"Página anterior",className:o,children:"Anterior"}),l.jsx("button",{disabled:t+1>=a,onClick:()=>n(t+1),"aria-label":"Página siguiente",className:o,children:"Siguiente"})]})]})};function id({filters:t,value:e,onChange:r,onReset:n,resetLabel:s="Resetear filtros",showReset:a=!0,className:i,layout:o="inline",actions:c}){const u=(m,p)=>{r({...e,[m]:p})},f=a&&!!n,d=o==="stacked"?"grid gap-4":"grid gap-4 sm:grid-cols-2 lg:grid-cols-3";return l.jsxs("section",{className:N("rounded-xl border border-[color:var(--border-1)] bg-[color:var(--surface-2)] p-4 shadow-[var(--shadow-card-sm)]",i),children:[l.jsx("div",{className:d,children:t.map(m=>l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("span",{className:"text-sm font-semibold text-[color:var(--text-1)]",children:m.label}),m.helperText&&l.jsx("span",{className:"text-xs text-[color:var(--text-2)]",children:m.helperText})]}),m.type==="text"&&l.jsx($r,{placeholder:m.placeholder,value:e[m.id]??"",onChange:p=>u(m.id,p.target.value),disabled:m.disabled}),m.type==="select"&&l.jsxs(fs,{value:e[m.id]??"",onValueChange:p=>u(m.id,p),disabled:m.disabled,children:[l.jsx(Kr,{children:l.jsx(hs,{placeholder:m.placeholder??"Seleccionar"})}),l.jsx(Qr,{children:m.options.map(p=>l.jsx(en,{value:p.value,children:p.label},p.value))})]}),m.type==="async-select"&&l.jsx(Ga,{value:e[m.id]??"",onValueChange:p=>u(m.id,p),placeholder:m.placeholder,searchPlaceholder:m.searchPlaceholder,minChars:m.minChars,debounceMs:m.debounceMs,fetcher:m.fetcher,getOptionLabel:m.getOptionLabel,getOptionValue:m.getOptionValue,emptyLabel:m.emptyLabel,loadingLabel:m.loadingLabel,emptyActionLabel:m.emptyActionLabel,onEmptyActionClick:m.onEmptyActionClick,disabled:m.disabled}),m.type==="toggle"&&l.jsx(tn,{checked:e[m.id]??!1,onChange:p=>u(m.id,p),disabled:m.disabled,ariaLabel:m.label,label:m.description}),m.type==="date"&&l.jsx(ns,{value:e[m.id]??null,onChange:p=>u(m.id,p??null),placeholder:m.placeholder,min:m.min,max:m.max,timeZone:m.timeZone,disabled:m.disabled})]},m.id))}),(f||c)&&l.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-3",children:[f&&l.jsx(Le,{type:"button",variant:"ghost",onClick:n,children:s}),c&&l.jsx("div",{className:"flex items-center gap-2",children:c})]})]})}function od({title:t="Filtros",description:e,children:r,isOpen:n,onOpenChange:s,onApply:a,applyLabel:i="Aplicar filtros",closeLabel:o="Cerrar",className:c}){const u=b.useId(),f=e?`${u}-description`:void 0,d=n,m=b.useCallback(p=>{s(p)},[s]);return b.useEffect(()=>{if(!d)return;const p=y=>{y.key==="Escape"&&m(!1)};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[d,m]),b.useEffect(()=>{if(!d)return;const p=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=p}},[d]),d?l.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",children:l.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":u,"aria-describedby":f,className:N("w-full max-w-3xl rounded-2xl border border-[color:var(--border-1)] bg-[color:var(--surface-1)] p-6 shadow-[var(--shadow-card-lg)]",c),children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{className:"space-y-2",children:[l.jsx("h2",{id:u,className:"text-lg font-semibold text-[color:var(--text-1)]",children:t}),e&&l.jsx("p",{id:f,className:"text-sm text-[color:var(--text-2)]",children:e})]}),l.jsx("button",{type:"button",onClick:()=>m(!1),className:N("inline-flex h-9 w-9 items-center justify-center rounded-md","text-[color:var(--text-2)] transition-colors","hover:bg-[color:color-mix(in srgb, var(--brand) 12%, transparent)]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--focus)]"),"aria-label":o,children:l.jsx(J.X,{className:"h-4 w-4"})})]}),l.jsx("div",{className:"mt-6",children:r}),l.jsxs("div",{className:"mt-6 flex flex-wrap items-center justify-end gap-2",children:[l.jsx(Le,{type:"button",variant:"ghost",onClick:()=>m(!1),children:o}),l.jsx(Le,{type:"button",onClick:()=>{a?.(),m(!1)},children:i})]})]})}):null}const Pv=".csv,.xlsx";function Fv({title:t="Importar datos",description:e="Sube un fichero CSV o XLSX para ejecutar la importacion.",helperText:r="El sistema procesara cada fila de forma tolerante.",accept:n=Pv,className:s,actionLabel:a="Importar",disabled:i=!1,loading:o=!1,summary:c,onImport:u}){const[f,d]=b.useState([]),m=f[0]??null,p=b.useMemo(()=>c?`Resultado: ${c.created} creados, ${c.updated} actualizados, ${c.failed} fallidos`:null,[c]),y=async()=>{!m||i||o||await u(m)};return l.jsxs("section",{className:N("rounded-xl border border-slate-200 bg-white p-4 shadow-sm space-y-3",s),children:[l.jsxs("header",{className:"space-y-1",children:[l.jsx("h3",{className:"text-sm font-semibold text-slate-900",children:t}),l.jsx("p",{className:"text-sm text-slate-600",children:e})]}),l.jsx(us,{files:f,onFilesChange:d,multiple:!1,accept:n,helperText:r,allowDrop:!0,showPreview:!1,disabled:i||o}),p&&l.jsx("p",{className:"text-sm text-slate-700",children:p}),l.jsx("div",{className:"flex justify-end",children:l.jsx(Le,{type:"button",variant:"primary",onClick:()=>{y()},disabled:!m||i,loading:o,children:a})})]})}function Lv({title:t,value:e,delta:r,deltaLabel:n,icon:s,description:a,loading:i=!1,className:o}){const c=r!==void 0&&r>=0,u=r!==void 0&&r<0;return i?l.jsxs(zs,{className:N("p-6",o),children:[l.jsx(sa,{className:"mb-2 h-4 w-24"}),l.jsx(sa,{className:"h-8 w-32"})]}):l.jsxs(zs,{className:o,children:[l.jsx(Jo,{children:l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(Ko,{className:"text-sm font-medium text-muted-foreground",children:t}),s&&l.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-md bg-primary/10",children:l.jsx(s,{className:"h-4 w-4 text-primary"})})]})}),l.jsxs(Qo,{children:[l.jsx("div",{className:"text-2xl font-bold text-foreground",children:e}),(r!==void 0||a)&&l.jsxs("div",{className:"mt-1 flex items-center gap-1.5",children:[r!==void 0&&l.jsxs("span",{className:N("inline-flex items-center gap-0.5 text-xs font-medium",c&&"text-emerald-600",u&&"text-red-600"),children:[c?l.jsx(J.TrendingUp,{className:"h-3 w-3"}):l.jsx(J.TrendingDown,{className:"h-3 w-3"}),Math.abs(r),"%"]}),a&&l.jsx("p",{className:"text-xs text-muted-foreground",children:n??a})]})]})]})}function Vv({title:t,description:e,actions:r,className:n}){return l.jsxs("div",{className:N("flex items-start justify-between gap-4",n),children:[l.jsxs("div",{className:"flex flex-col gap-1",children:[l.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:t}),e&&l.jsx("p",{className:"text-sm text-muted-foreground",children:e})]}),r&&l.jsx("div",{className:"flex shrink-0 items-center gap-2",children:r})]})}function $v({mode:t="light",theme:e="nova",children:r}){return b.useEffect(()=>{const n=document.documentElement;n.dataset.mode=t,n.dataset.theme=e,n.classList.toggle("dark",t==="dark"),n.style.colorScheme=t},[t,e]),r}var ne;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},t.getValidEnumValues=s=>{const a=t.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},t.find=(s,a)=>{for(const i of s)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(ne||(ne={}));var ko;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(ko||(ko={}));const R=ne.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Nt=t=>{switch(typeof t){case"undefined":return R.undefined;case"string":return R.string;case"number":return Number.isNaN(t)?R.nan:R.number;case"boolean":return R.boolean;case"function":return R.function;case"bigint":return R.bigint;case"symbol":return R.symbol;case"object":return Array.isArray(t)?R.array:t===null?R.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?R.promise:typeof Map<"u"&&t instanceof Map?R.map:typeof Set<"u"&&t instanceof Set?R.set:typeof Date<"u"&&t instanceof Date?R.date:R.object;default:return R.unknown}},_=ne.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class yt extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){const r=e||function(a){return a.message},n={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(r(i));else{let o=n,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(r(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return s(this),n}static assert(e){if(!(e instanceof yt))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,ne.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){const r={},n=[];for(const s of this.issues)if(s.path.length>0){const a=s.path[0];r[a]=r[a]||[],r[a].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}yt.create=t=>new yt(t);const ia=(t,e)=>{let r;switch(t.code){case _.invalid_type:t.received===R.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case _.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,ne.jsonStringifyReplacer)}`;break;case _.unrecognized_keys:r=`Unrecognized key(s) in object: ${ne.joinValues(t.keys,", ")}`;break;case _.invalid_union:r="Invalid input";break;case _.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ne.joinValues(t.options)}`;break;case _.invalid_enum_value:r=`Invalid enum value. Expected ${ne.joinValues(t.options)}, received '${t.received}'`;break;case _.invalid_arguments:r="Invalid function arguments";break;case _.invalid_return_type:r="Invalid function return type";break;case _.invalid_date:r="Invalid date";break;case _.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:ne.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case _.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case _.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case _.custom:r="Invalid input";break;case _.invalid_intersection_types:r="Intersection results could not be merged";break;case _.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case _.not_finite:r="Number must be finite";break;default:r=e.defaultError,ne.assertNever(t)}return{message:r}};let zv=ia;function Wv(){return zv}const Zv=t=>{const{data:e,path:r,errorMaps:n,issueData:s}=t,a=[...r,...s.path||[]],i={...s,path:a};if(s.message!==void 0)return{...s,path:a,message:s.message};let o="";const c=n.filter(u=>!!u).slice().reverse();for(const u of c)o=u(i,{data:e,defaultError:o}).message;return{...s,path:a,message:o}};function O(t,e){const r=Wv(),n=Zv({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===ia?void 0:ia].filter(s=>!!s)});t.common.issues.push(n)}class Ve{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){const n=[];for(const s of r){if(s.status==="aborted")return q;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){const n=[];for(const s of r){const a=await s.key,i=await s.value;n.push({key:a,value:i})}return Ve.mergeObjectSync(e,n)}static mergeObjectSync(e,r){const n={};for(const s of r){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return q;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[a.value]=i.value)}return{status:e.value,value:n}}}const q=Object.freeze({status:"aborted"}),Mr=t=>({status:"dirty",value:t}),Ue=t=>({status:"valid",value:t}),So=t=>t.status==="aborted",No=t=>t.status==="dirty",yr=t=>t.status==="valid",Ln=t=>typeof Promise<"u"&&t instanceof Promise;var M;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(M||(M={}));class Dt{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Co=(t,e)=>{if(yr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new yt(t.common.issues);return this._error=r,this._error}}};function K(t){if(!t)return{};const{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(i,o)=>{const{message:c}=t;return i.code==="invalid_enum_value"?{message:c??o.defaultError}:typeof o.data>"u"?{message:c??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:c??r??o.defaultError}},description:s}}class re{get description(){return this._def.description}_getType(e){return Nt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ve,ctx:{common:e.parent.common,data:e.data,parsedType:Nt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(Ln(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nt(e)},s=this._parseSync({data:e,path:n.path,parent:n});return Co(n,s)}"~validate"(e){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nt(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:r});return yr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(n=>yr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(e,r){const n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Nt(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(Ln(s)?s:Promise.resolve(s));return Co(n,a)}refine(e,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue({code:_.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new xr({schema:this,typeName:Y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Tt.create(this,this._def)}nullable(){return br.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ct.create(this)}promise(){return Wn.create(this,this._def)}or(e){return $n.create([this,e],this._def)}and(e){return zn.create(this,e,this._def)}transform(e){return new xr({...K(this._def),schema:this,typeName:Y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r=typeof e=="function"?e:()=>e;return new ca({...K(this._def),innerType:this,defaultValue:r,typeName:Y.ZodDefault})}brand(){return new fx({typeName:Y.ZodBranded,type:this,...K(this._def)})}catch(e){const r=typeof e=="function"?e:()=>e;return new ua({...K(this._def),innerType:this,catchValue:r,typeName:Y.ZodCatch})}describe(e){const r=this.constructor;return new r({...this._def,description:e})}pipe(e){return Ka.create(this,e)}readonly(){return da.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Bv=/^c[^\s-]{8,}$/i,Uv=/^[0-9a-z]+$/,Hv=/^[0-9A-HJKMNP-TV-Z]{26}$/i,qv=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Yv=/^[a-z0-9_-]{21}$/i,Gv=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Xv=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Jv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Kv="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ls;const Qv=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ex=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,tx=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,rx=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nx=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,sx=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ld="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",ax=new RegExp(`^${ld}$`);function cd(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function ix(t){return new RegExp(`^${cd(t)}$`)}function ox(t){let e=`${ld}T${cd(t)}`;const r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function lx(t,e){return!!((e==="v4"||!e)&&Qv.test(t)||(e==="v6"||!e)&&tx.test(t))}function cx(t,e){if(!Gv.test(t))return!1;try{const[r]=t.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function ux(t,e){return!!((e==="v4"||!e)&&ex.test(t)||(e==="v6"||!e)&&rx.test(t))}class $t extends re{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==R.string){const a=this._getOrReturnCtx(e);return O(a,{code:_.invalid_type,expected:R.string,received:a.parsedType}),q}const n=new Ve;let s;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),O(s,{code:_.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),O(s,{code:_.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?O(s,{code:_.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&O(s,{code:_.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Jv.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"email",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Ls||(Ls=new RegExp(Kv,"u")),Ls.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"emoji",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")qv.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"uuid",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="nanoid")Yv.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"nanoid",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Bv.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"cuid",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Uv.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"cuid2",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")Hv.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"ulid",code:_.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),O(s,{validation:"url",code:_.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"regex",code:_.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),O(s,{code:_.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),O(s,{code:_.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),O(s,{code:_.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?ox(a).test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{code:_.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="date"?ax.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{code:_.invalid_string,validation:"date",message:a.message}),n.dirty()):a.kind==="time"?ix(a).test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{code:_.invalid_string,validation:"time",message:a.message}),n.dirty()):a.kind==="duration"?Xv.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"duration",code:_.invalid_string,message:a.message}),n.dirty()):a.kind==="ip"?lx(e.data,a.version)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"ip",code:_.invalid_string,message:a.message}),n.dirty()):a.kind==="jwt"?cx(e.data,a.alg)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"jwt",code:_.invalid_string,message:a.message}),n.dirty()):a.kind==="cidr"?ux(e.data,a.version)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"cidr",code:_.invalid_string,message:a.message}),n.dirty()):a.kind==="base64"?nx.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"base64",code:_.invalid_string,message:a.message}),n.dirty()):a.kind==="base64url"?sx.test(e.data)||(s=this._getOrReturnCtx(e,s),O(s,{validation:"base64url",code:_.invalid_string,message:a.message}),n.dirty()):ne.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:_.invalid_string,...M.errToObj(n)})}_addCheck(e){return new $t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...M.errToObj(e)})}url(e){return this._addCheck({kind:"url",...M.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...M.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...M.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...M.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...M.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...M.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...M.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...M.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...M.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...M.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...M.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...M.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...M.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...M.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...M.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...M.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...M.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...M.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...M.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...M.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...M.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...M.errToObj(r)})}nonempty(e){return this.min(1,M.errToObj(e))}trim(){return new $t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new $t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new $t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}$t.create=t=>new $t({checks:[],typeName:Y.ZodString,coerce:t?.coerce??!1,...K(t)});function dx(t,e){const r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,a=Number.parseInt(t.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return a%i/10**s}class zr extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==R.number){const a=this._getOrReturnCtx(e);return O(a,{code:_.invalid_type,expected:R.number,received:a.parsedType}),q}let n;const s=new Ve;for(const a of this._def.checks)a.kind==="int"?ne.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),O(n,{code:_.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),O(n,{code:_.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),O(n,{code:_.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?dx(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),O(n,{code:_.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),O(n,{code:_.not_finite,message:a.message}),s.dirty()):ne.assertNever(a);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,M.toString(r))}gt(e,r){return this.setLimit("min",e,!1,M.toString(r))}lte(e,r){return this.setLimit("max",e,!0,M.toString(r))}lt(e,r){return this.setLimit("max",e,!1,M.toString(r))}setLimit(e,r,n,s){return new zr({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:M.toString(s)}]})}_addCheck(e){return new zr({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:M.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:M.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:M.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:M.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:M.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:M.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:M.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:M.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:M.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&ne.isInteger(e.value))}get isFinite(){let e=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}}zr.create=t=>new zr({checks:[],typeName:Y.ZodNumber,coerce:t?.coerce||!1,...K(t)});class Wr extends re{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==R.bigint)return this._getInvalidInput(e);let n;const s=new Ve;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),O(n,{code:_.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),O(n,{code:_.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),O(n,{code:_.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):ne.assertNever(a);return{status:s.value,value:e.data}}_getInvalidInput(e){const r=this._getOrReturnCtx(e);return O(r,{code:_.invalid_type,expected:R.bigint,received:r.parsedType}),q}gte(e,r){return this.setLimit("min",e,!0,M.toString(r))}gt(e,r){return this.setLimit("min",e,!1,M.toString(r))}lte(e,r){return this.setLimit("max",e,!0,M.toString(r))}lt(e,r){return this.setLimit("max",e,!1,M.toString(r))}setLimit(e,r,n,s){return new Wr({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:M.toString(s)}]})}_addCheck(e){return new Wr({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:M.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:M.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:M.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:M.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:M.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}}Wr.create=t=>new Wr({checks:[],typeName:Y.ZodBigInt,coerce:t?.coerce??!1,...K(t)});class _o extends re{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==R.boolean){const n=this._getOrReturnCtx(e);return O(n,{code:_.invalid_type,expected:R.boolean,received:n.parsedType}),q}return Ue(e.data)}}_o.create=t=>new _o({typeName:Y.ZodBoolean,coerce:t?.coerce||!1,...K(t)});class Vn extends re{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==R.date){const a=this._getOrReturnCtx(e);return O(a,{code:_.invalid_type,expected:R.date,received:a.parsedType}),q}if(Number.isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return O(a,{code:_.invalid_date}),q}const n=new Ve;let s;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),O(s,{code:_.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),O(s,{code:_.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):ne.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Vn({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:M.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:M.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}}Vn.create=t=>new Vn({checks:[],coerce:t?.coerce||!1,typeName:Y.ZodDate,...K(t)});class To extends re{_parse(e){if(this._getType(e)!==R.symbol){const n=this._getOrReturnCtx(e);return O(n,{code:_.invalid_type,expected:R.symbol,received:n.parsedType}),q}return Ue(e.data)}}To.create=t=>new To({typeName:Y.ZodSymbol,...K(t)});class jo extends re{_parse(e){if(this._getType(e)!==R.undefined){const n=this._getOrReturnCtx(e);return O(n,{code:_.invalid_type,expected:R.undefined,received:n.parsedType}),q}return Ue(e.data)}}jo.create=t=>new jo({typeName:Y.ZodUndefined,...K(t)});class Eo extends re{_parse(e){if(this._getType(e)!==R.null){const n=this._getOrReturnCtx(e);return O(n,{code:_.invalid_type,expected:R.null,received:n.parsedType}),q}return Ue(e.data)}}Eo.create=t=>new Eo({typeName:Y.ZodNull,...K(t)});class oa extends re{constructor(){super(...arguments),this._any=!0}_parse(e){return Ue(e.data)}}oa.create=t=>new oa({typeName:Y.ZodAny,...K(t)});class Oo extends re{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Ue(e.data)}}Oo.create=t=>new Oo({typeName:Y.ZodUnknown,...K(t)});class Rt extends re{_parse(e){const r=this._getOrReturnCtx(e);return O(r,{code:_.invalid_type,expected:R.never,received:r.parsedType}),q}}Rt.create=t=>new Rt({typeName:Y.ZodNever,...K(t)});class Do extends re{_parse(e){if(this._getType(e)!==R.undefined){const n=this._getOrReturnCtx(e);return O(n,{code:_.invalid_type,expected:R.void,received:n.parsedType}),q}return Ue(e.data)}}Do.create=t=>new Do({typeName:Y.ZodVoid,...K(t)});class ct extends re{_parse(e){const{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==R.array)return O(r,{code:_.invalid_type,expected:R.array,received:r.parsedType}),q;if(s.exactLength!==null){const i=r.data.length>s.exactLength.value,o=r.data.length<s.exactLength.value;(i||o)&&(O(r,{code:i?_.too_big:_.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(O(r,{code:_.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(O(r,{code:_.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>s.type._parseAsync(new Dt(r,i,r.path,o)))).then(i=>Ve.mergeArray(n,i));const a=[...r.data].map((i,o)=>s.type._parseSync(new Dt(r,i,r.path,o)));return Ve.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new ct({...this._def,minLength:{value:e,message:M.toString(r)}})}max(e,r){return new ct({...this._def,maxLength:{value:e,message:M.toString(r)}})}length(e,r){return new ct({...this._def,exactLength:{value:e,message:M.toString(r)}})}nonempty(e){return this.min(1,e)}}ct.create=(t,e)=>new ct({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Y.ZodArray,...K(e)});function or(t){if(t instanceof ye){const e={};for(const r in t.shape){const n=t.shape[r];e[r]=Tt.create(or(n))}return new ye({...t._def,shape:()=>e})}else return t instanceof ct?new ct({...t._def,type:or(t.element)}):t instanceof Tt?Tt.create(or(t.unwrap())):t instanceof br?br.create(or(t.unwrap())):t instanceof Ut?Ut.create(t.items.map(e=>or(e))):t}class ye extends re{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),r=ne.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==R.object){const u=this._getOrReturnCtx(e);return O(u,{code:_.invalid_type,expected:R.object,received:u.parsedType}),q}const{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Rt&&this._def.unknownKeys==="strip"))for(const u in s.data)i.includes(u)||o.push(u);const c=[];for(const u of i){const f=a[u],d=s.data[u];c.push({key:{status:"valid",value:u},value:f._parse(new Dt(s,d,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof Rt){const u=this._def.unknownKeys;if(u==="passthrough")for(const f of o)c.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(u==="strict")o.length>0&&(O(s,{code:_.unrecognized_keys,keys:o}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const f of o){const d=s.data[f];c.push({key:{status:"valid",value:f},value:u._parse(new Dt(s,d,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const u=[];for(const f of c){const d=await f.key,m=await f.value;u.push({key:d,value:m,alwaysSet:f.alwaysSet})}return u}).then(u=>Ve.mergeObjectSync(n,u)):Ve.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(e){return M.errToObj,new ye({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{const s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:M.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new ye({...this._def,unknownKeys:"strip"})}passthrough(){return new ye({...this._def,unknownKeys:"passthrough"})}extend(e){return new ye({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ye({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Y.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new ye({...this._def,catchall:e})}pick(e){const r={};for(const n of ne.objectKeys(e))e[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new ye({...this._def,shape:()=>r})}omit(e){const r={};for(const n of ne.objectKeys(this.shape))e[n]||(r[n]=this.shape[n]);return new ye({...this._def,shape:()=>r})}deepPartial(){return or(this)}partial(e){const r={};for(const n of ne.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}return new ye({...this._def,shape:()=>r})}required(e){const r={};for(const n of ne.objectKeys(this.shape))if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Tt;)a=a._def.innerType;r[n]=a}return new ye({...this._def,shape:()=>r})}keyof(){return ud(ne.objectKeys(this.shape))}}ye.create=(t,e)=>new ye({shape:()=>t,unknownKeys:"strip",catchall:Rt.create(),typeName:Y.ZodObject,...K(e)});ye.strictCreate=(t,e)=>new ye({shape:()=>t,unknownKeys:"strict",catchall:Rt.create(),typeName:Y.ZodObject,...K(e)});ye.lazycreate=(t,e)=>new ye({shape:t,unknownKeys:"strip",catchall:Rt.create(),typeName:Y.ZodObject,...K(e)});class $n extends re{_parse(e){const{ctx:r}=this._processInputParams(e),n=this._def.options;function s(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new yt(o.ctx.common.issues));return O(r,{code:_.invalid_union,unionErrors:i}),q}if(r.common.async)return Promise.all(n.map(async a=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(s);{let a;const i=[];for(const c of n){const u={...r,common:{...r.common,issues:[]},parent:null},f=c._parseSync({data:r.data,path:r.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!a&&(a={result:f,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new yt(c));return O(r,{code:_.invalid_union,unionErrors:o}),q}}get options(){return this._def.options}}$n.create=(t,e)=>new $n({options:t,typeName:Y.ZodUnion,...K(e)});function la(t,e){const r=Nt(t),n=Nt(e);if(t===e)return{valid:!0,data:t};if(r===R.object&&n===R.object){const s=ne.objectKeys(e),a=ne.objectKeys(t).filter(o=>s.indexOf(o)!==-1),i={...t,...e};for(const o of a){const c=la(t[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(r===R.array&&n===R.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],c=la(i,o);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===R.date&&n===R.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class zn extends re{_parse(e){const{status:r,ctx:n}=this._processInputParams(e),s=(a,i)=>{if(So(a)||So(i))return q;const o=la(a.value,i.value);return o.valid?((No(a)||No(i))&&r.dirty(),{status:r.value,value:o.data}):(O(n,{code:_.invalid_intersection_types}),q)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}zn.create=(t,e,r)=>new zn({left:t,right:e,typeName:Y.ZodIntersection,...K(r)});class Ut extends re{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.array)return O(n,{code:_.invalid_type,expected:R.array,received:n.parsedType}),q;if(n.data.length<this._def.items.length)return O(n,{code:_.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),q;!this._def.rest&&n.data.length>this._def.items.length&&(O(n,{code:_.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...n.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new Dt(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(a).then(i=>Ve.mergeArray(r,i)):Ve.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new Ut({...this._def,rest:e})}}Ut.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ut({items:t,typeName:Y.ZodTuple,rest:null,...K(e)})};class Ro extends re{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.map)return O(n,{code:_.invalid_type,expected:R.map,received:n.parsedType}),q;const s=this._def.keyType,a=this._def.valueType,i=[...n.data.entries()].map(([o,c],u)=>({key:s._parse(new Dt(n,o,n.path,[u,"key"])),value:a._parse(new Dt(n,c,n.path,[u,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const c of i){const u=await c.key,f=await c.value;if(u.status==="aborted"||f.status==="aborted")return q;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),o.set(u.value,f.value)}return{status:r.value,value:o}})}else{const o=new Map;for(const c of i){const u=c.key,f=c.value;if(u.status==="aborted"||f.status==="aborted")return q;(u.status==="dirty"||f.status==="dirty")&&r.dirty(),o.set(u.value,f.value)}return{status:r.value,value:o}}}}Ro.create=(t,e,r)=>new Ro({valueType:e,keyType:t,typeName:Y.ZodMap,...K(r)});class Zr extends re{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==R.set)return O(n,{code:_.invalid_type,expected:R.set,received:n.parsedType}),q;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(O(n,{code:_.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(O(n,{code:_.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const a=this._def.valueType;function i(c){const u=new Set;for(const f of c){if(f.status==="aborted")return q;f.status==="dirty"&&r.dirty(),u.add(f.value)}return{status:r.value,value:u}}const o=[...n.data.values()].map((c,u)=>a._parse(new Dt(n,c,n.path,u)));return n.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,r){return new Zr({...this._def,minSize:{value:e,message:M.toString(r)}})}max(e,r){return new Zr({...this._def,maxSize:{value:e,message:M.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}Zr.create=(t,e)=>new Zr({valueType:t,minSize:null,maxSize:null,typeName:Y.ZodSet,...K(e)});class Ao extends re{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}Ao.create=(t,e)=>new Ao({getter:t,typeName:Y.ZodLazy,...K(e)});class Mo extends re{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return O(r,{received:r.data,code:_.invalid_literal,expected:this._def.value}),q}return{status:"valid",value:e.data}}get value(){return this._def.value}}Mo.create=(t,e)=>new Mo({value:t,typeName:Y.ZodLiteral,...K(e)});function ud(t,e){return new vr({values:t,typeName:Y.ZodEnum,...K(e)})}class vr extends re{_parse(e){if(typeof e.data!="string"){const r=this._getOrReturnCtx(e),n=this._def.values;return O(r,{expected:ne.joinValues(n),received:r.parsedType,code:_.invalid_type}),q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const r=this._getOrReturnCtx(e),n=this._def.values;return O(r,{received:r.data,code:_.invalid_enum_value,options:n}),q}return Ue(e.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return vr.create(e,{...this._def,...r})}exclude(e,r=this._def){return vr.create(this.options.filter(n=>!e.includes(n)),{...this._def,...r})}}vr.create=ud;class Io extends re{_parse(e){const r=ne.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==R.string&&n.parsedType!==R.number){const s=ne.objectValues(r);return O(n,{expected:ne.joinValues(s),received:n.parsedType,code:_.invalid_type}),q}if(this._cache||(this._cache=new Set(ne.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=ne.objectValues(r);return O(n,{received:n.data,code:_.invalid_enum_value,options:s}),q}return Ue(e.data)}get enum(){return this._def.values}}Io.create=(t,e)=>new Io({values:t,typeName:Y.ZodNativeEnum,...K(e)});class Wn extends re{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==R.promise&&r.common.async===!1)return O(r,{code:_.invalid_type,expected:R.promise,received:r.parsedType}),q;const n=r.parsedType===R.promise?r.data:Promise.resolve(r.data);return Ue(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}Wn.create=(t,e)=>new Wn({type:t,typeName:Y.ZodPromise,...K(e)});class xr extends re{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{O(n,i),i.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(n.data,a);if(n.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return q;const c=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return c.status==="aborted"?q:c.status==="dirty"||r.value==="dirty"?Mr(c.value):c});{if(r.value==="aborted")return q;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?q:o.status==="dirty"||r.value==="dirty"?Mr(o.value):o}}if(s.type==="refinement"){const i=o=>{const c=s.refinement(o,a);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?q:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?q:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yr(i))return q;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>yr(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:r.value,value:o})):q);ne.assertNever(s)}}xr.create=(t,e,r)=>new xr({schema:t,typeName:Y.ZodEffects,effect:e,...K(r)});xr.createWithPreprocess=(t,e,r)=>new xr({schema:e,effect:{type:"preprocess",transform:t},typeName:Y.ZodEffects,...K(r)});class Tt extends re{_parse(e){return this._getType(e)===R.undefined?Ue(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Tt.create=(t,e)=>new Tt({innerType:t,typeName:Y.ZodOptional,...K(e)});class br extends re{_parse(e){return this._getType(e)===R.null?Ue(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}br.create=(t,e)=>new br({innerType:t,typeName:Y.ZodNullable,...K(e)});class ca extends re{_parse(e){const{ctx:r}=this._processInputParams(e);let n=r.data;return r.parsedType===R.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}ca.create=(t,e)=>new ca({innerType:t,typeName:Y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...K(e)});class ua extends re{_parse(e){const{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return Ln(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new yt(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new yt(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ua.create=(t,e)=>new ua({innerType:t,typeName:Y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...K(e)});class Po extends re{_parse(e){if(this._getType(e)!==R.nan){const n=this._getOrReturnCtx(e);return O(n,{code:_.invalid_type,expected:R.nan,received:n.parsedType}),q}return{status:"valid",value:e.data}}}Po.create=t=>new Po({typeName:Y.ZodNaN,...K(t)});class fx extends re{_parse(e){const{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class Ka extends re{_parse(e){const{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?q:a.status==="dirty"?(r.dirty(),Mr(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?q:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,r){return new Ka({in:e,out:r,typeName:Y.ZodPipeline})}}class da extends re{_parse(e){const r=this._def.innerType._parse(e),n=s=>(yr(s)&&(s.value=Object.freeze(s.value)),s);return Ln(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}da.create=(t,e)=>new da({innerType:t,typeName:Y.ZodReadonly,...K(e)});var Y;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Y||(Y={}));const hx=oa.create;Rt.create;ct.create;const mx=ye.create;$n.create;zn.create;Ut.create;vr.create;Wn.create;Tt.create;br.create;function px(t){const e=[];for(const r of t.sections)for(const n of r.fields)Array.isArray(n)?e.push(...n):e.push(n);return e}function gx(t){const e={};for(const n of t.sections)for(const s of n.fields){const a=Array.isArray(s)?s:[s];for(const i of a)e[i.name]=i.schema??hx().optional()}let r=mx(e);return t.crossRules?.length&&(r=r.superRefine((n,s)=>{for(const a of t.crossRules)a(n,s)})),r}function yx(t,e){const r=t.defaultValues?.(e)??{},n=px(t),s={...r};for(const a of n)a.defaultValue!==void 0&&s[a.name]===void 0&&(s[a.name]=a.defaultValue);return s}var vx=t=>t.type==="checkbox",Ir=t=>t instanceof Date,Qa=t=>t==null;const dd=t=>typeof t=="object";var Ht=t=>!Qa(t)&&!Array.isArray(t)&&dd(t)&&!Ir(t),xx=t=>Ht(t)&&t.target?vx(t.target)?t.target.checked:t.target.value:t,bx=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,wx=(t,e)=>t.has(bx(e)),kx=t=>{const e=t.constructor&&t.constructor.prototype;return Ht(e)&&e.hasOwnProperty("isPrototypeOf")},Sx=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function fd(t){if(t instanceof Date)return new Date(t);const e=typeof FileList<"u"&&t instanceof FileList;if(Sx&&(t instanceof Blob||e))return t;const r=Array.isArray(t);if(!r&&!(Ht(t)&&kx(t)))return t;const n=r?[]:Object.create(Object.getPrototypeOf(t));for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[s]=fd(t[s]));return n}var hd=t=>/^\w*$/.test(t),fa=t=>t===void 0,Nx=t=>Array.isArray(t)?t.filter(Boolean):[],md=t=>Nx(t.replace(/["|']|\]/g,"").split(/\.|\[/)),Oe=(t,e,r)=>{if(!e||!Ht(t))return r;const n=(hd(e)?[e]:md(e)).reduce((s,a)=>Qa(s)?s:s[a],t);return fa(n)||n===t?fa(t[e])?r:t[e]:n},Vs=t=>typeof t=="boolean",vn=t=>typeof t=="function",Fo=(t,e,r)=>{let n=-1;const s=hd(e)?[e]:md(e),a=s.length,i=a-1;for(;++n<a;){const o=s[n];let c=r;if(n!==i){const u=t[o];c=Ht(u)||Array.isArray(u)?u:isNaN(+s[n+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;t[o]=c,t=t[o]}};const Lo={BLUR:"blur",CHANGE:"change"},Vo={all:"all"},ei=b.createContext(null);ei.displayName="HookFormContext";const ti=()=>b.useContext(ei),Cx=t=>{const{children:e,...r}=t;return b.createElement(ei.Provider,{value:r},e)};var _x=(t,e,r,n=!0)=>{const s={defaultValues:e._defaultValues};for(const a in t)Object.defineProperty(s,a,{get:()=>{const i=a;return e._proxyFormState[i]!==Vo.all&&(e._proxyFormState[i]=!n||Vo.all),r&&(r[i]=!0),t[i]}});return s};const pd=typeof window<"u"?b.useLayoutEffect:b.useEffect;function Tx(t){const e=ti(),{control:r=e.control,disabled:n,name:s,exact:a}=t||{},[i,o]=b.useState(r._formState),c=b.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return pd(()=>r._subscribe({name:s,formState:c.current,exact:a,callback:u=>{!n&&o({...r._formState,...u})}}),[s,n,a]),b.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),b.useMemo(()=>_x(i,r,c.current,!1),[i,r])}var jx=t=>typeof t=="string",$o=(t,e,r,n,s)=>jx(t)?Oe(r,t,s):Array.isArray(t)?t.map(a=>Oe(r,a)):r,zo=t=>Qa(t)||!dd(t);function _n(t,e,r=new WeakSet){if(zo(t)||zo(e))return Object.is(t,e);if(Ir(t)&&Ir(e))return Object.is(t.getTime(),e.getTime());const n=Object.keys(t),s=Object.keys(e);if(n.length!==s.length)return!1;if(r.has(t)||r.has(e))return!0;r.add(t),r.add(e);for(const a of n){const i=t[a];if(!s.includes(a))return!1;if(a!=="ref"){const o=e[a];if(Ir(i)&&Ir(o)||Ht(i)&&Ht(o)||Array.isArray(i)&&Array.isArray(o)?!_n(i,o,r):!Object.is(i,o))return!1}}return!0}function gd(t){const e=ti(),{control:r=e.control,name:n,defaultValue:s,disabled:a,exact:i,compute:o}=t||{},c=b.useRef(s),u=b.useRef(o),f=b.useRef(void 0),d=b.useRef(r),m=b.useRef(n);u.current=o;const[p,y]=b.useState(()=>{const k=r._getWatch(n,c.current);return u.current?u.current(k):k}),g=b.useCallback(k=>{const w=$o(n,r._names,k||r._formValues,!1,c.current);return u.current?u.current(w):w},[r._formValues,r._names,n]),x=b.useCallback(k=>{if(!a){const w=$o(n,r._names,k||r._formValues,!1,c.current);if(u.current){const j=u.current(w);_n(j,f.current)||(y(j),f.current=j)}else y(w)}},[r._formValues,r._names,a,n]);pd(()=>((d.current!==r||!_n(m.current,n))&&(d.current=r,m.current=n,x()),r._subscribe({name:n,formState:{values:!0},exact:i,callback:k=>{x(k.values)}})),[r,i,n,x]),b.useEffect(()=>r._removeUnmounted());const v=d.current!==r,S=m.current,C=b.useMemo(()=>{if(a)return null;const k=!v&&!_n(S,n);return v||k?g():null},[a,v,n,S,g]);return C!==null?C:p}function Ex(t){const e=ti(),{name:r,disabled:n,control:s=e.control,shouldUnregister:a,defaultValue:i,exact:o=!0}=t,c=wx(s._names.array,r),u=b.useMemo(()=>Oe(s._formValues,r,Oe(s._defaultValues,r,i)),[s,r,i]),f=gd({control:s,name:r,defaultValue:u,exact:o}),d=Tx({control:s,name:r,exact:o}),m=b.useRef(t),p=b.useRef(void 0),y=b.useRef(s.register(r,{...t.rules,value:f,...Vs(t.disabled)?{disabled:t.disabled}:{}}));m.current=t;const g=b.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Oe(d.errors,r)},isDirty:{enumerable:!0,get:()=>!!Oe(d.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!Oe(d.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!Oe(d.validatingFields,r)},error:{enumerable:!0,get:()=>Oe(d.errors,r)}}),[d,r]),x=b.useCallback(k=>y.current.onChange({target:{value:xx(k),name:r},type:Lo.CHANGE}),[r]),v=b.useCallback(()=>y.current.onBlur({target:{value:Oe(s._formValues,r),name:r},type:Lo.BLUR}),[r,s._formValues]),S=b.useCallback(k=>{const w=Oe(s._fields,r);w&&w._f&&k&&(w._f.ref={focus:()=>vn(k.focus)&&k.focus(),select:()=>vn(k.select)&&k.select(),setCustomValidity:j=>vn(k.setCustomValidity)&&k.setCustomValidity(j),reportValidity:()=>vn(k.reportValidity)&&k.reportValidity()})},[s._fields,r]),C=b.useMemo(()=>({name:r,value:f,...Vs(n)||d.disabled?{disabled:d.disabled||n}:{},onChange:x,onBlur:v,ref:S}),[r,n,d.disabled,x,v,S,f]);return b.useEffect(()=>{const k=s._options.shouldUnregister||a,w=p.current;w&&w!==r&&!c&&s.unregister(w),s.register(r,{...m.current.rules,...Vs(m.current.disabled)?{disabled:m.current.disabled}:{}});const j=(T,A)=>{const $=Oe(s._fields,T);$&&$._f&&($._f.mount=A)};if(j(r,!0),k){const T=fd(Oe(s._options.defaultValues,r,m.current.defaultValue));Fo(s._defaultValues,r,T),fa(Oe(s._formValues,r))&&Fo(s._formValues,r,T)}return!c&&s.register(r),p.current=r,()=>{(c?k&&!s._state.action:k)?s.unregister(r):j(r,!1)}},[r,s,c,a]),b.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),b.useMemo(()=>({field:C,formState:d,fieldState:g}),[C,d,g])}const Ox=t=>t.render(Ex(t));function Dx({form:t,field:e}){const[r,n]=b.useState(!1);return l.jsx(Ox,{control:t.control,name:e.name,render:({field:s,fieldState:{error:a}})=>{const i=u=>e.normalize?e.normalize(u):u,o=()=>{e.deps?.onChangeTrigger&&t.trigger(e.deps.onChangeTrigger)},c={className:e.className,error:a?.message,required:!e.schema?.isOptional?.()};switch(e.kind){case"custom":if(!e.render)throw new Error(`Field ${e.name} marked as custom but has no render function`);return l.jsx("div",{className:e.className,children:e.render({form:t})});case"input":return l.jsxs(st,{...c,children:[l.jsxs(at,{children:[e.label,e.labelAddon]}),l.jsx(Xe,{children:l.jsx($r,{type:"text",placeholder:e.placeholder,value:s.value??"",onChange:u=>{s.onChange(i(u.target.value)),o()},onBlur:s.onBlur})}),l.jsx(Je,{})]});case"password":return l.jsxs(st,{...c,children:[l.jsxs(at,{children:[e.label,e.labelAddon]}),l.jsx(Xe,{children:l.jsxs("div",{className:"relative flex w-full items-center",children:[l.jsx($r,{type:r?"text":"password",placeholder:e.placeholder,value:s.value??"",className:"pr-10",onChange:u=>{const f=u.target.value;s.onChange(i(f)),o()},onBlur:s.onBlur}),l.jsx(Le,{type:"button",variant:"ghost",className:"absolute right-3 flex items-center justify-center text-slate-400 hover:text-slate-600 focus:outline-none",onClick:()=>n(!r),tabIndex:-1,children:r?l.jsx(J.EyeOff,{className:"h-4 w-4"}):l.jsx(J.Eye,{className:"h-4 w-4"})})]})}),l.jsx(Je,{})]});case"textarea":return l.jsxs(st,{...c,children:[l.jsxs(at,{children:[e.label,e.labelAddon]}),l.jsx(Xe,{children:l.jsx("textarea",{className:"oniratec-field__textarea",value:s.value??"",placeholder:e.placeholder,rows:4,onChange:u=>{s.onChange(i(u.target.value)),o()},onBlur:s.onBlur})}),l.jsx(Je,{})]});case"select":return l.jsxs(st,{...c,children:[l.jsxs(at,{children:[e.label,e.labelAddon]}),l.jsx(Xe,{children:l.jsxs(fs,{value:s.value||void 0,onValueChange:u=>{s.onChange(i(u||void 0)),o()},children:[l.jsx(Kr,{children:l.jsx(hs,{})}),l.jsx(Qr,{children:(e.options??[]).map(u=>l.jsx(en,{value:String(u.value),children:u.label},u.value))})]})}),l.jsx(Je,{})]});case"asyncSelect":return l.jsxs(st,{...c,children:[l.jsxs(at,{children:[e.label,e.labelAddon]}),l.jsx(Xe,{children:l.jsx(Ga,{value:s.value||void 0,onValueChange:u=>{s.onChange(i(u)),o()},placeholder:e.placeholder,searchPlaceholder:e.searchPlaceholder,minChars:e.minChars,debounceMs:e.debounceMs,fetcher:e.fetcher,getOptionValue:e.getOptionValue,getOptionLabel:e.getOptionLabel,emptyLabel:e.emptyLabel,emptyActionLabel:e.emptyActionLabel,onEmptyActionClick:e.onEmptyActionClick,hasError:!!a?.message})}),l.jsx(Je,{})]});case"toggle":return l.jsxs(st,{...c,children:[l.jsxs(at,{children:[e.label,e.labelAddon]}),l.jsx(Xe,{children:l.jsx(tn,{checked:!!s.value,onChange:u=>{s.onChange(i(u)),o()}})}),l.jsx(Je,{})]});case"checkbox":return l.jsxs(st,{...c,children:[l.jsx(Xe,{children:l.jsxs("label",{className:"oniratec-checkbox",children:[l.jsx("input",{type:"checkbox",checked:!!s.value,onChange:u=>{s.onChange(i(u.target.checked)),o()},onBlur:s.onBlur}),l.jsx("span",{children:e.label})]})}),l.jsx(Je,{})]});case"date":return l.jsxs(st,{...c,children:[l.jsxs(at,{children:[e.label,e.labelAddon]}),l.jsx(Xe,{children:l.jsx(ns,{value:s.value,onChange:u=>{s.onChange(i(u)),o()},placeholder:e.placeholder,min:e.min,max:e.max,timeZone:e.timeZone,isInvalid:!!a?.message})}),l.jsx(Je,{})]});case"fileUpload":{const u=Array.isArray(s.value)?s.value:[];return l.jsxs(st,{...c,children:[l.jsxs(at,{children:[e.label,e.labelAddon]}),l.jsx(Xe,{children:l.jsx(us,{files:u,onFilesChange:f=>{s.onChange(i(f)),o()},accept:e.accept,multiple:e.multiple,helperText:e.helperText,allowDrop:e.allowDrop,placeholder:e.placeholder,defaultPreviewUrl:e.defaultPreviewUrl})}),l.jsx(Je,{})]})}}}})}function Rx(t){return Array.isArray(t)?t:[t]}function yd({config:t,form:e,onSubmitAction:r,handleErrors:n,submitLabel:s,maxWidthClass:a,children:i}){const o=gd({control:e.control});return l.jsx(Cx,{...e,children:l.jsxs("form",{onSubmit:e.handleSubmit(r,c=>n(c)),className:N("space-y-8",a),children:[t.sections.map((c,u)=>l.jsxs(b.Fragment,{children:[l.jsxs("section",{className:"space-y-4",children:[l.jsx("h3",{className:"oniratec-form__section-title",children:c.title}),l.jsx("div",{className:"space-y-4",children:c.fields.map((f,d)=>{const m=Rx(f).filter(g=>!g.hidden?.(o));if(!m.length)return null;const p=m.reduce((g,x)=>g+(x.colSpan??1),0),y=p>1?N("grid gap-4",p===2&&"grid-cols-2",p===3&&"grid-cols-3",p===4&&"grid-cols-4"):"";return l.jsx("div",{className:y,children:m.map(g=>l.jsx("div",{className:g.colSpan?`col-span-${g.colSpan}`:void 0,children:l.jsx(Dx,{form:e,field:g})},g.name))},d)})})]},c.title),u<t.sections.length-1&&l.jsx(b.Fragment,{children:l.jsx("hr",{className:"oniratec-form__separator"})})]},`fragment-${c.title}`)),i,l.jsx("div",{className:"oniratec-form__actions",children:l.jsx(Le,{type:"submit",loading:e.formState.isSubmitting,children:s})})]})})}function Ax(t){return l.jsx(yd,{...t})}const Mx=t=>t==="center"?"text-center":t==="right"?"text-right":"text-left",Ix=t=>{if(t)return typeof t=="number"?`w-[${t}px]`:t.startsWith("w-")?t:`w-[${t}]`},Px=t=>t?Array.isArray(t)?t:[t]:[];function vd(t){return{columns:t.columns.map(n=>{const s=Mx(n.align),a=Ix(n.width),i=[s,a,n.className].filter(Boolean).join(" "),o=[s,a,n.headerClassName].filter(Boolean).join(" ");return{key:n.id,header:n.header,render:n.cell??(c=>String(n.accessor?.(c)??"")),className:i||void 0,headerClassName:o||void 0,sortable:n.sortable??!!(n.sortFn||n.accessor),sortFn:n.sortFn,sortValue:n.accessor}}),getSortDirection:(n,s)=>Px(n).find(o=>o.columnId===s)?.direction??null}}function Fx(t,e,r){const{columns:n}=vd(t);return l.jsx(sd,{columns:n,data:e,...r})}const Lx=t=>t.reduce((e,r)=>r.type==="toggle"?(e[r.id]=r.value??!1,e):r.type==="date"?(e[r.id]=r.value??null,e):(e[r.id]=r.value??"",e),{});function Vx(t){const e=Lx(t.filters),r=(a,i,o)=>({...a,[i]:o}),n=()=>({...e}),s=a=>t.buildQueryParams?t.buildQueryParams(a):a;return{filters:t.filters,initialState:e,updateFilter:r,resetState:n,buildQueryParams:s}}function xd(t,e,r,n){return l.jsx(id,{filters:t.filters,value:e,onChange:r,onReset:n?.onReset,resetLabel:n?.resetLabel,showReset:n?.showReset,className:n?.className,layout:n?.layout,actions:n?.actions})}function $x(t,e,r,n){return l.jsx(od,{title:n.title,description:n.description,isOpen:n.isOpen,onOpenChange:n.onOpenChange,onApply:n.onApply,applyLabel:n.applyLabel,closeLabel:n.closeLabel,className:n.className,children:xd(t,e,r,n.panel)})}function zx(t,e,r){const n=new Set(t.filter(s=>s.type==="date").map(s=>s.id));return Object.entries(e).reduce((s,[a,i])=>i==null?(s[a]=void 0,s):n.has(a)&&i instanceof Date?(s[a]=eu(i,r?.timeZone)??void 0,s):(s[a]=i,s),{})}function Wx(...t){return Wo.twMerge(ha.clsx(t))}exports.Alert=tl;exports.AlertDescription=nl;exports.AlertTitle=rl;exports.AsyncSelect=Ga;exports.AuthLayout=nd;exports.Badge=pa;exports.Box=Qd;exports.Breadcrumbs=jv;exports.Button=Le;exports.Card=zs;exports.CardAction=lf;exports.CardContent=Qo;exports.CardDescription=of;exports.CardFooter=cf;exports.CardHeader=Jo;exports.CardTitle=Ko;exports.Checkbox=al;exports.ConfirmDialog=Ev;exports.DEFAULT_TIME_ZONE=In;exports.DashboardLayout=Rv;exports.DataTable=sd;exports.DatePicker=ns;exports.Dialog=bu;exports.DialogClose=wy;exports.DialogContent=Wa;exports.DialogDescription=Ha;exports.DialogFooter=Ba;exports.DialogHeader=Za;exports.DialogOverlay=za;exports.DialogPortal=wu;exports.DialogTitle=Ua;exports.DialogTrigger=by;exports.DropdownMenu=Sy;exports.DropdownMenuCheckboxItem=Nu;exports.DropdownMenuContent=ku;exports.DropdownMenuGroup=Cy;exports.DropdownMenuItem=Su;exports.DropdownMenuLabel=_u;exports.DropdownMenuPortal=_y;exports.DropdownMenuRadioGroup=jy;exports.DropdownMenuRadioItem=Cu;exports.DropdownMenuSeparator=Tu;exports.DropdownMenuShortcut=Ou;exports.DropdownMenuSub=Ty;exports.DropdownMenuSubContent=Eu;exports.DropdownMenuSubTrigger=ju;exports.DropdownMenuTrigger=Ny;exports.Field=st;exports.FieldControl=Xe;exports.FieldLabel=at;exports.FieldMessage=Je;exports.FilePicker=Dy;exports.FileUpload=us;exports.FiltersModal=od;exports.FiltersPanel=id;exports.FormFactoryRenderer=yd;exports.ImportFileCard=Fv;exports.Input=$r;exports.Kbd=Au;exports.KpiCard=Lv;exports.Logo=af;exports.NotFoundState=Ry;exports.PageHeader=Vv;exports.PageSizeSelector=ad;exports.Pagination=Iv;exports.PasswordInput=Ru;exports.PersonAvatar=Jd;exports.ProfileAvatar=Kd;exports.Progress=Mu;exports.RadioGroup=My;exports.RadioGroupItem=Pu;exports.Select=fs;exports.SelectContent=Qr;exports.SelectGroup=Iy;exports.SelectItem=en;exports.SelectLabel=Fu;exports.SelectScrollDownButton=Ya;exports.SelectScrollUpButton=qa;exports.SelectSeparator=Lu;exports.SelectTrigger=Kr;exports.SelectValue=hs;exports.Separator=Vu;exports.Sheet=Fy;exports.SheetClose=Vy;exports.SheetContent=zu;exports.SheetDescription=Uu;exports.SheetFooter=Zu;exports.SheetHeader=Wu;exports.SheetOverlay=Xa;exports.SheetPortal=$u;exports.SheetTitle=Bu;exports.SheetTrigger=Ly;exports.Skeleton=sa;exports.Switch=Gy;exports.Tabs=zy;exports.TabsContent=Xu;exports.TabsList=Yu;exports.TabsTrigger=Gu;exports.Textarea=Hu;exports.ThemeProvider=$v;exports.Toaster=Nv;exports.Toggle=tn;exports.Tooltip=_v;exports.TooltipContent=rd;exports.TooltipProvider=Cv;exports.TooltipTrigger=Tv;exports.alertVariants=el;exports.badgeVariants=sl;exports.buildDefaultValues=yx;exports.buildFiltersQueryParams=zx;exports.buildZodSchema=gx;exports.buttonVariants=Xo;exports.cn=Wx;exports.createFiltersFactory=Vx;exports.createTableFactory=vd;exports.isValidTimeZone=Pn;exports.renderFiltersModal=$x;exports.renderFiltersPanel=xd;exports.renderFormFactory=Ax;exports.renderTable=Fx;exports.resolveTimeZone=Jr;exports.setDefaultTimeZone=ny;exports.toDateTime=sy;exports.toISODate=eu;exports.toISODateTime=ay;exports.toast=fv;exports.useField=ds;
|
|
46
46
|
//# sourceMappingURL=index.cjs.map
|