@mvr-ui/components 1.0.103 → 1.0.106
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/README.md +48 -83
- package/dist/mvr-ui.css +1 -1
- package/dist/page.d.mts +164 -1
- package/dist/page.d.ts +164 -1
- package/dist/page.js +75 -48
- package/dist/page.mjs +19 -14
- package/package.json +1 -1
package/dist/page.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import qn, { createContext, forwardRef, useEffect, useState, useContext, useRef, useId, useCallback, useMemo, cloneElement, useImperativeHandle } from 'react';
|
|
3
|
+
import zo, { clsx } from 'clsx';
|
|
4
4
|
import { twMerge } from 'tailwind-merge';
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var kt=({title:e="Ocorreu um erro",message:t,description:r="Algo deu errado ao carregar esta p\xE1gina.",badge:n="Erro",actions:o})=>jsx("div",{className:"flex min-h-screen w-full items-center justify-center bg-linear-to-br from-red-50 via-rose-50 to-red-100 px-4 dark:from-red-950 dark:via-zinc-950 dark:to-red-900/30",children:jsxs("div",{className:"relative w-full max-w-md rounded-2xl bg-white/90 p-8 text-center shadow-2xl backdrop-blur animate-in fade-in zoom-in-95 dark:bg-zinc-900/90",children:[jsx("div",{className:"pointer-events-none absolute inset-0 rounded-2xl ring-1 ring-red-200 dark:ring-red-800"}),n&&jsx("span",{className:"mb-6 inline-block rounded-full bg-red-100 px-4 py-1 text-xs font-semibold text-red-700 dark:bg-red-900/40 dark:text-red-300",children:n}),jsx("div",{className:"mx-auto mb-6 flex h-20 w-20 items-center justify-center rounded-full bg-linear-to-tr from-red-200 to-red-100 text-red-600 shadow-inner dark:from-red-900/40 dark:to-red-800/40 dark:text-red-400",children:jsxs("svg",{className:"h-9 w-9 animate-pulse",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[jsx("path",{d:"M12 9v4"}),jsx("path",{d:"M12 17h.01"}),jsx("path",{d:"M5.07 19h13.86c1.54 0 2.5-1.67 1.73-3L13.73 4c-.77-1.33-2.69-1.33-3.46 0L3.34 16c-.77 1.33.19 3 1.73 3z"})]})}),jsx("h1",{className:"mb-2 text-2xl font-extrabold text-zinc-900 dark:text-zinc-100",children:e}),jsx("p",{className:"mb-2 text-sm font-medium text-red-600 dark:text-red-400",children:t}),r&&jsx("p",{className:"mb-6 text-sm text-zinc-600 dark:text-zinc-400",children:r}),o&&o.length>0&&jsx("div",{className:"flex flex-col gap-3",children:o.map((i,a)=>{let l=i.variant!=="secondary";return jsx("button",{onClick:i.onClick,className:l?"rounded-xl bg-linear-to-r from-red-600 to-red-700 px-5 py-2.5 text-sm font-semibold text-white shadow-lg transition hover:scale-[1.02] hover:shadow-red-600/40 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 dark:focus:ring-offset-zinc-900":"rounded-xl border border-zinc-200 px-5 py-2.5 text-sm font-semibold text-zinc-700 transition hover:bg-zinc-100 dark:border-zinc-700 dark:text-zinc-300 dark:hover:bg-zinc-800",children:i.label},a)})})]})});var Nt=(e,t)=>{let r="Problema com licen\xE7a da aplica\xE7\xE3o",n=`
|
|
7
7
|
Ol\xE1,
|
|
8
8
|
|
|
9
9
|
Estou enfrentando um problema com a licen\xE7a da aplica\xE7\xE3o.
|
|
@@ -12,36 +12,41 @@ Erro:
|
|
|
12
12
|
${t??"Licen\xE7a inv\xE1lida"}
|
|
13
13
|
|
|
14
14
|
Aguardo retorno.
|
|
15
|
-
`,o=`mailto:${e}?subject=${encodeURIComponent(r)}&body=${encodeURIComponent(n)}`;window.location.href=o;};var
|
|
15
|
+
`,o=`mailto:${e}?subject=${encodeURIComponent(r)}&body=${encodeURIComponent(n)}`;window.location.href=o;};var Pt=(e,t)=>{let r=`
|
|
16
16
|
Ol\xE1! Estou com um problema de licen\xE7a na aplica\xE7\xE3o.
|
|
17
17
|
|
|
18
18
|
Erro:
|
|
19
19
|
${t??"Licen\xE7a inv\xE1lida"}
|
|
20
20
|
|
|
21
21
|
Pode me ajudar?
|
|
22
|
-
`,n=`https://wa.me/${e}?text=${encodeURIComponent(r)}`;window.open(n,"_blank");};var
|
|
22
|
+
`,n=`https://wa.me/${e}?text=${encodeURIComponent(r)}`;window.open(n,"_blank");};var Lt=createContext(void 0),Vn=({children:e,licenseKey:t})=>{let[r,n]=useState(!1),[o,i]=useState(null),[a,l]=useState(!0),s=m=>{if(i(null),!m)throw new Error("\u{1F512} Chave de licen\xE7a \xE9 obrigat\xF3ria");let u="chave-secreta-123";if(m!==u)throw new Error("\u274C Chave de licen\xE7a inv\xE1lida");n(!0);};return useEffect(()=>{if(t){l(!0);try{s(t);}catch(m){i(m instanceof Error?m.message:"Erro desconhecido na valida\xE7\xE3o da licen\xE7a");}finally{l(!1);}}else i("\u{1F512} Licen\xE7a n\xE3o informada"),l(!1);},[t]),a?null:jsx(Lt.Provider,{value:{isLicenseValid:r,validateLicense:s,licenseError:o},children:r?e:jsx(kt,{badge:"Licen\xE7a necess\xE1ria",title:"Erro de Licen\xE7a",message:o||"Licen\xE7a inv\xE1lida",description:"Sua aplica\xE7\xE3o precisa de uma licen\xE7a v\xE1lida para continuar.",actions:[{label:"Tentar novamente",onClick:()=>window.location.reload()},{label:"Falar no WhatsApp",variant:"secondary",onClick:()=>Pt("5544998204407",o)},{label:"Enviar e-mail",variant:"secondary",onClick:()=>Nt("marcos.vinicius.engsof@gmail.com",o)}]})})},Rt=()=>{let e=useContext(Lt);if(!e)throw new Error("useLicense deve ser usado dentro de um LicenseProvider");return e};var Mt=({message:e="Component locked - Please validate your license"})=>jsxs("div",{className:"flex items-start p-4 bg-red-50 border border-red-500 text-red-700 rounded-md gap-2",children:[jsx("span",{children:" \u274C Component locked - Please validate your license"}),jsx("span",{children:e})]});var f=({children:e})=>{let{isLicenseValid:t}=Rt();return t?jsx(Fragment,{children:e}):jsx(Mt,{})};var St=({items:e,type:t="single",defaultValue:r,value:n,onValueChange:o,className:i=""})=>{let a=u=>u===void 0?[]:Array.isArray(u)?u:[u],[l,s]=useState(a(n??r));useEffect(()=>{n!==void 0&&s(a(n));},[n]);let m=useCallback(u=>{s(c=>{let d;return t==="single"?d=c.includes(u)?[]:[u]:d=c.includes(u)?c.filter(p=>p!==u):[...c,u],o?.(t==="single"?d[0]??"":d),d});},[t,o]);return jsx("div",{className:`space-y-2 ${i}`,children:e.map(u=>jsx(On,{...u,isOpen:l.includes(u.id),onToggle:()=>m(u.id)},u.id))})},On=({title:e,content:t,disabled:r=!1,isOpen:n,onToggle:o})=>jsx(f,{children:jsxs("div",{className:"border border-border rounded-md overflow-hidden",children:[jsx("button",{onClick:o,disabled:r,className:`w-full px-4 py-3 text-left font-medium transition-colors
|
|
23
23
|
${r?"opacity-50 cursor-not-allowed":"hover:bg-accent hover:text-accent-foreground"}
|
|
24
24
|
${n?"bg-accent text-accent-foreground":"bg-background text-foreground"}
|
|
25
|
-
`,children:jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{children:e}),jsx("svg",{className:`w-5 h-5 transition-transform ${n?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})}),n&&jsx("div",{className:"px-4 py-3 bg-background border-t border-border",children:t})]})});ft.displayName="Accordion";var ea=ft;function x(...e){return twMerge(clsx(e))}var bt=forwardRef(({className:e,overrideClassName:t=!1,variant:r="default",children:n,...o},i)=>jsx(v,{children:jsx("div",{ref:i,className:t?e:x("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{default:"bg-primary text-primary-foreground hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"bg-red-500 text-white hover:bg-red-600",outline:"text-foreground border border-input",ghost:"bg-transparent text-foreground hover:bg-muted",link:"text-primary underline-offset-4 hover:underline",success:"bg-green-500 text-white hover:bg-green-600",warning:"bg-yellow-500 text-black hover:bg-yellow-600",info:"bg-blue-500 text-white hover:bg-blue-600",subtle:"bg-muted text-muted-foreground hover:bg-muted/80",dark:"bg-zinc-900 text-white hover:bg-zinc-800",light:"bg-zinc-100 text-zinc-900 hover:bg-zinc-200"}[r],e),...o,children:n})}));bt.displayName="Badge";var da=bt;var vt=jr.forwardRef(({className:e,overrideClassName:t,variant:r="primary",size:n="md",href:o,children:i,loading:a=!1,loadingContent:l,...s},p)=>{let d="inline-flex items-center justify-center rounded-lg font-medium cursor-pointer active:translate-y-1 transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",c={primary:"bg-blue-600 text-white hover:bg-blue-700 shadow-md focus-visible:ring-blue-500",secondary:"bg-gray-600 text-white hover:bg-gray-700 shadow-sm focus-visible:ring-gray-500",tertiary:"bg-purple-600 text-white hover:bg-purple-700 shadow-sm focus-visible:ring-purple-500",destructive:"bg-red-600 text-white hover:bg-red-700 shadow-sm focus-visible:ring-red-500",success:"bg-green-600 text-white hover:bg-green-700 shadow-sm focus-visible:ring-green-500",warning:"bg-amber-500 text-white hover:bg-amber-600 shadow-sm focus-visible:ring-amber-500",info:"bg-cyan-600 text-white hover:bg-cyan-700 shadow-sm focus-visible:ring-cyan-500",accent:"bg-violet-600 text-white hover:bg-violet-700 shadow-sm focus-visible:ring-violet-500",outline:"border border-gray-300 bg-transparent text-gray-700 hover:bg-gray-50 shadow-sm focus-visible:ring-gray-500",ghost:"bg-transparent text-gray-700 hover:bg-gray-100 focus-visible:ring-gray-500",link:"text-blue-600 underline-offset-4 hover:underline bg-transparent p-0 h-auto shadow-none",gradient:"bg-gradient-to-r from-blue-600 to-purple-600 text-white hover:from-blue-700 hover:to-purple-700 shadow-md focus-visible:ring-blue-500",glass:"bg-white/10 backdrop-blur-md border border-white/20 text-black hover:bg-white/20 shadow-sm focus-visible:ring-white/50",soft:"bg-blue-100 text-blue-700 hover:bg-blue-200 shadow-sm focus-visible:ring-blue-500",dark:"bg-gray-900 text-white hover:bg-gray-800 shadow-md focus-visible:ring-gray-500",light:"bg-gray-100 text-gray-900 hover:bg-gray-200 shadow-sm focus-visible:ring-gray-500",obsidian:"bg-black text-white hover:bg-gray-900 shadow-md border border-gray-800 focus-visible:ring-gray-700",polar:"bg-white text-gray-900 hover:bg-gray-50 shadow-md border border-gray-300 focus-visible:ring-gray-400"},u={xs:"h-7 px-2 text-xs min-w-16",sm:"h-9 px-3 text-sm min-w-20",md:"h-10 px-4 py-2 text-base min-w-24",lg:"h-11 px-6 text-lg min-w-28",xl:"h-12 px-8 text-xl min-w-32"},m=t?e:x(d,c[r],u[n],e);return o?jsx(v,{children:jsx("a",{href:o,className:m,ref:p,children:a&&l?l:i})}):jsx(v,{children:jsx("button",{className:m,ref:p,...s,children:a&&l?l:i})})});vt.displayName="Button";var ba=vt;var ht=forwardRef(({className:e,overrideClassName:t=!1,children:r,...n},o)=>jsx(v,{children:jsx("div",{ref:o,className:t?e:x("rounded-lg border bg-card text-card-foreground shadow-sm",e),...n,children:r})}));ht.displayName="Card";var xt=forwardRef(({className:e,overrideClassName:t=!1,children:r,...n},o)=>jsx(v,{children:jsx("div",{ref:o,className:t?e:x("flex flex-col space-y-1.5 p-6",e),...n,children:r})}));xt.displayName="CardHeader";var yt=forwardRef(({className:e,overrideClassName:t=!1,children:r,...n},o)=>jsx(v,{children:jsx("h3",{ref:o,className:t?e:x("text-2xl font-semibold leading-none tracking-tight",e),...n,children:r})}));yt.displayName="CardTitle";var Ct=forwardRef(({className:e,overrideClassName:t=!1,children:r,...n},o)=>jsx(v,{children:jsx("p",{ref:o,className:t?e:x("text-sm text-muted-foreground",e),...n,children:r})}));Ct.displayName="CardDescription";var wt=forwardRef(({className:e,overrideClassName:t=!1,children:r,...n},o)=>jsx(v,{children:jsx("div",{ref:o,className:t?e:x("p-6 pt-0",e),...n,children:r})}));wt.displayName="CardContent";var kt=forwardRef(({className:e,overrideClassName:t=!1,children:r,...n},o)=>jsx(v,{children:jsx("div",{ref:o,className:t?e:x("flex items-center p-6 pt-0",e),...n,children:r})}));kt.displayName="CardFooter";var ka=ht,Pa=xt,Ta=yt,La=Ct,Na=wt,Ra=kt;var Re=createContext(void 0),Tt=forwardRef(({children:e,className:t,...r},n)=>{let[o,i]=useState(!1);return jsx(v,{children:jsx(Re.Provider,{value:{isOpen:o,setIsOpen:i},children:jsx("div",{ref:n,className:x("relative inline-block",t),...r,children:e})})})});Tt.displayName="DropdownMenu";var Lt=({children:e,asChild:t})=>{let r=useContext(Re);if(!r)throw new Error("DropdownMenuTrigger must be used within DropdownMenu");let n=()=>r.setIsOpen(!r.isOpen);if(t){let o=e;return cloneElement(o,{onClick:i=>{o.props.onClick?.(i),n();}})}return jsx(v,{children:jsx("button",{onClick:n,children:e})})};Lt.displayName="DropdownMenuTrigger";var Nt=forwardRef(({children:e,align:t="end",className:r,...n},o)=>{let i=useContext(Re),a=useRef(null);return useEffect(()=>{o&&(typeof o=="function"?o(a.current):o.current=a.current);},[o]),useEffect(()=>{let s=p=>{a.current&&!a.current.contains(p.target)&&i?.setIsOpen(!1);};return i?.isOpen&&document.addEventListener("mousedown",s),()=>{document.removeEventListener("mousedown",s);}},[i?.isOpen]),i?.isOpen?jsx(v,{children:jsx("div",{ref:a,className:x("absolute z-50 mt-2 min-w-32 overflow-hidden rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-md",{start:"left-0",center:"left-1/2 -translate-x-1/2",end:"right-0"}[t],r),...n,children:e})}):null});Nt.displayName="DropdownMenuContent";var Rt=forwardRef(({children:e,onClick:t,destructive:r,className:n,...o},i)=>{let a=useContext(Re);return jsx(v,{children:jsx("button",{ref:i,onClick:s=>{t?.(s),a?.setIsOpen(!1);},className:x("w-full text-left px-4 py-2 text-sm hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none",r&&"text-red-600 hover:bg-red-50 hover:text-red-700 focus:bg-red-50 focus:text-red-700",n),...o,children:e})})});Rt.displayName="DropdownMenuItem";var Dt=forwardRef(({className:e,...t},r)=>jsx(v,{children:jsx("div",{ref:r,className:x("-mx-1 my-1 h-px bg-border",e),...t})}));Dt.displayName="DropdownMenuSeparator";var Mt=forwardRef(({children:e,className:t,...r},n)=>jsx(v,{children:jsx("div",{ref:n,className:x("px-2 py-1.5 text-sm font-semibold",t),...r,children:e})}));Mt.displayName="DropdownMenuLabel";var Va=Tt,Ha=Lt,Aa=Nt,$a=Rt,Oa=Dt,Ba=Mt;var rn=({children:e,className:t,overrideClassName:r})=>{if(e)return jsx(v,{children:jsx("p",{className:r?t:x("text-sm text-muted-foreground",t),children:e})})},$=rn;var nn=({children:e,required:t,className:r,overrideClassName:n=!1,...o})=>jsx(v,{children:jsxs("div",{className:"flex items-center gap-1",children:[jsx("label",{...o,className:n?r:x("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",r),children:e}),t&&jsx("span",{className:"text-red-600",children:"*"})]})}),D=nn;var an=({children:e,className:t,overrideClassName:r})=>{if(e)return jsx(v,{children:jsx("p",{className:r?t:x("text-sm text-red-600 dark:text-red-400",t),children:e})})},O=an;var It=forwardRef(({label:e,required:t,option:r,description:n,icon:o,orientation:i="left",className:a,overrideClassName:l=!1,helperText:s,error:p,...d},c)=>{let u=useId(),m=x("h-4 w-4 rounded border border-input bg-background text-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",p&&"border-destructive",a);return jsx(v,{children:jsxs("div",{className:"space-y-2 w-fit",children:[e&&jsx(D,{required:t,children:e}),jsxs("div",{className:`flex items-center ${i=="left"?"flex-row":"flex-row-reverse"} w-fit gap-2`,children:[jsx("input",{id:u,type:"checkbox",className:l?a:m,ref:c,...d}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{children:o&&o}),jsxs("div",{className:"grid gap-1.5 leading-none select-none",children:[r&&jsx(D,{htmlFor:u,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",overrideClassName:!0,children:r}),n&&jsx(D,{id:`${u}-description`,htmlFor:u,className:"text-xs text-muted-foreground",children:n})]})]})]}),p&&jsx(O,{children:p}),!p&&s&&jsx($,{children:s})]})})});It.displayName="CheckBox";var si=It;function un(e,t){let{typeSet:r="field",multiCheck:n=!1,value:o,onChange:i,labelKey:a,valueKey:l,options:s,alignment:p="vertical",className:d,overrideClassName:c=!1,helperText:u,error:m,label:L,name:y,required:b,...h}=e,M=useId(),R=useMemo(()=>new Map(s.map(P=>[String(P[l]),P])),[s,l]),F=useMemo(()=>o==null?[]:r==="field"?n?o.map(P=>String(P)):[String(o)]:n?o.map(P=>String(P[l])):[String(o[l])],[o,r,n,l]),I=(P,T)=>{if(!i)return;let f;if(r==="field")if(n)f=P.map(N=>{let E=R.get(N);return E?E[l]:N});else {let g=P[0];if(!g)f=void 0;else {let N=R.get(g);f=N?N[l]:g;}}else n?f=P.map(N=>R.get(N)).filter(N=>N!==void 0):f=R.get(P[0]??"")??void 0;i({target:{name:y,value:f,type:"checkboxgroup",checked:T}});},A=P=>{let T;n?T=F.includes(P)?F.filter(f=>f!==P):[...F,P]:T=F[0]===P?[]:[P],I(T,T.includes(P));},S=p==="horizontal"?"flex flex-wrap items-center gap-3":"flex flex-col gap-3",B=x("h-4 w-4 rounded border border-input bg-background text-primary","focus:ring-2 focus:ring-ring focus:ring-offset-2",m&&"border-destructive");return jsx(v,{children:jsxs("div",{className:x("flex flex-col gap-3",d),children:[L&&jsx(D,{required:b,children:L}),jsx("div",{className:S,children:s.map((P,T)=>{let f=String(P[l]),g=F.includes(f),N=`${M}-${f}-${T}`;return jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{...h,id:N,ref:t,type:"checkbox",name:y,checked:g,onChange:()=>A(f),className:c?d:B}),jsx(D,{htmlFor:N,children:String(P[a])})]},N)})}),!!m&&jsx(O,{children:String(m)}),!m&&u&&jsx($,{children:u})]})})}function mn(){let e=forwardRef(un);return e.displayName="CheckBoxGroup",e}var pn=mn(),hi=pn;var vn=["#000000","#ffffff","#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ffa500","#800080","#ffc0cb","#a52a2a","#808080","#000080","#008000"],At=jr.forwardRef(({label:e,required:t,onChange:r,disabled:n=!1,presetColors:o=vn,showPresets:i=!0,className:a,error:l,helperText:s,name:p},d)=>{let c=useId(),u=useRef(null),[m,L]=useState(!1),[y,b]=useState("COLOR"),[h,M]=useState("HEX"),[R,F]=useState("#000000"),[I,A]=useState(0),[S,B]=useState(0),[P,T]=useState(0),[f,g]=useState(1),[N,E]=useState("#000000"),[V,J]=useState("#ffffff"),[te,he]=useState(90),[k,C]=useState("linear-gradient(90deg, #000000, #ffffff)"),G=(w,U,we)=>Math.min(we,Math.max(U,w)),K=w=>{let U=w.replace("#","");return {r:parseInt(U.slice(0,2),16),g:parseInt(U.slice(2,4),16),b:parseInt(U.slice(4,6),16)}},z=w=>{r?.({target:{value:w,name:p}});};useEffect(()=>{let w=U=>{u.current&&!u.current.contains(U.target)&&L(!1);};return document.addEventListener("mousedown",w),()=>document.removeEventListener("mousedown",w)},[]),useEffect(()=>{if(/^#[0-9A-F]{6}$/i.test(R)){let w=K(R);A(w.r),B(w.g),T(w.b);}},[R]),useEffect(()=>{let w=`linear-gradient(${te}deg, ${N}, ${V})`;C(w),y==="GRADIENT"&&z(w);},[N,V,te]);let q=()=>{if(f>=1){if(h==="HEX")return R;if(h==="RGB")return `rgb(${I}, ${S}, ${P})`}return `rgba(${I}, ${S}, ${P}, ${Number(f.toFixed(2))})`},j=y==="GRADIENT"?k:q();return jsx(v,{children:jsxs("div",{className:`space-y-2 ${a??""}`,children:[e&&jsx(D,{htmlFor:c,required:t,children:e}),jsxs("div",{ref:u,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&L(!m),className:"flex items-center gap-2 px-3 py-2 border rounded-md bg-background w-full",children:[jsx("div",{className:"w-6 h-6 rounded border",style:{background:j}}),jsx("span",{className:"text-xs font-mono truncate",children:j})]}),m&&jsxs("div",{className:"absolute z-50 mt-1 w-85 bg-popover border rounded-md p-4 space-y-3 shadow-lg",children:[jsx("div",{className:"flex gap-2",children:["COLOR","GRADIENT"].map(w=>jsx("button",{type:"button",onClick:()=>b(w),className:`px-2 py-1 text-xs rounded ${y===w?"bg-primary text-white":"border"}`,children:w==="COLOR"?"Cor":"Gradiente"},w))}),jsx("div",{className:"w-full h-10 rounded border",style:{background:j}}),y==="COLOR"&&jsxs(Fragment,{children:[jsx("input",{ref:d,type:"color",value:R,onChange:w=>{F(w.target.value.toUpperCase()),z(q());},className:"w-full h-10 rounded"}),jsxs("div",{className:"flex gap-2 items-center",children:[jsxs("select",{value:h,onChange:w=>M(w.target.value),className:"px-2 py-1 text-xs border rounded",children:[jsx("option",{value:"HEX",children:"HEX"}),jsx("option",{value:"RGB",children:"RGB"}),jsx("option",{value:"RGBA",children:"RGBA"})]}),h==="HEX"&&jsx("input",{value:R,onChange:w=>{let U=w.target.value.toUpperCase().replace(/[^0-9A-F#]/g,"");U.startsWith("#")||(U="#"+U),U="#"+U.slice(1,7),F(U),/^#[0-9A-F]{6}$/.test(U)&&z(U);},className:"flex-1 px-2 py-1 text-xs font-mono border rounded",placeholder:"#000000"}),(h==="RGB"||h==="RGBA")&&jsx("div",{className:"flex gap-2",children:[{l:"R",v:I,s:A},{l:"G",v:S,s:B},{l:"B",v:P,s:T}].map(({l:w,v:U,s:we})=>jsxs("div",{className:"flex items-center gap-1",children:[jsx("span",{className:"text-xs font-semibold",children:w}),jsx("input",{type:"number",min:0,max:255,value:U,onChange:Ar=>{we(G(+Ar.target.value,0,255)),z(q());},className:"w-14 px-1 py-1 text-xs border rounded"})]},w))})]}),h==="RGBA"&&jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-xs font-semibold",children:"A"}),jsx("input",{type:"range",min:0,max:1,step:.01,value:f,onChange:w=>{g(+w.target.value),z(q());},className:"flex-1"}),jsxs("span",{className:"text-xs w-10 text-right",children:[Math.round(f*100),"%"]})]}),i&&jsx("div",{className:"grid grid-cols-5 gap-1",children:o.map(w=>jsx("button",{type:"button",onClick:()=>{F(w),g(1),z(w);},className:"w-8 h-8 rounded border",style:{background:w}},w))})]}),y==="GRADIENT"&&jsxs(Fragment,{children:[jsxs("div",{className:"flex gap-2 items-center",children:[jsx("input",{type:"color",value:N,onChange:w=>E(w.target.value)}),jsx("span",{className:"text-xs",children:"\u2192"}),jsx("input",{type:"color",value:V,onChange:w=>J(w.target.value)})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-xs",children:"\xC2ngulo"}),jsx("input",{type:"range",min:0,max:360,value:te,onChange:w=>he(+w.target.value),className:"flex-1"}),jsxs("span",{className:"text-xs w-10 text-right",children:[te,"\xB0"]})]})]})]})]}),l&&jsx(O,{children:l}),!l&&s&&jsx($,{children:s})]})})});At.displayName="ColorPicker";var Li=At;var hn=({...e})=>jsx("svg",{...e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),Me=hn;var yn=(e,t)=>{useEffect(()=>{let r=n=>{e.current&&!e.current.contains(n.target)&&t(!1);};return document.addEventListener("mousedown",r),()=>{document.removeEventListener("mousedown",r);}},[e,t]);},Ot=yn;function Oe({options:e,labelKey:t,valueKey:r,multiple:n,onChange:o,setSearchTerm:i,typeSet:a,name:l}){let[s,p]=useState([]),d=useMemo(()=>new Map(e.map(b=>[String(b[r]),b])),[e,r]),c=useCallback(()=>s.map(b=>d.get(b)).filter(b=>!!b),[s,d]),u=useCallback(b=>{if(!o)return;let h;if(a==="field"?n?h=b:h=b[0]??void 0:n?h=b.map(R=>d.get(R)).filter(R=>R!==void 0):h=d.get(b[0]??"")??void 0,i&&!n){let M=d.get(b[0]??"");M&&i(String(M[t]));}o({target:{name:l,value:h,type:"combobox"}});},[n,o,d,l,a,i,t]),m=useCallback(b=>{let h=String(b[r]),M=n?s.includes(h)?s.filter(R=>R!==h):[...s,h]:[h];p(M),u(M);},[n,s,u,r]),L=useCallback(b=>{let h=s.filter(M=>M!==b);p(h),u(h);},[s,u]),y=useCallback(()=>{p([]),i?.("");let b;a==="field"?b=n?[]:"":b=n?[]:void 0,o?.({target:{name:l,value:b,type:"combobox"}});},[n,o,l,i,a]);return {selectedValues:s,handleSelect:m,handleRemove:L,handleClear:y,getSelectedOptions:c}}function Be(e,t,r){return useMemo(()=>r?e.filter(o=>String(o[t]).toLowerCase().includes(r.toLowerCase())):e,[e,r,t])}var Gt=({isOpen:e,setIsOpen:t,multiple:r,searchTerm:n,setSearchTerm:o,selectedValues:i,filteredOptions:a,highlightedIndex:l,setHighlightedIndex:s,handleSelect:p,handleRemove:d})=>{let c=useCallback(m=>{if(a.length===0){s(-1);return}s(L=>L<0?m>0?0:a.length-1:(L+m+a.length)%a.length);},[a,s]);return useCallback(m=>{if(!e){if(m.key==="Enter"||m.key==="ArrowDown"){t(!0),s(0),m.preventDefault();return}r&&m.key==="Backspace"&&n===""&&i.length>0&&(m.preventDefault(),d(i[i.length-1]));return}switch(m.key){case"ArrowDown":m.preventDefault(),c(1);break;case"ArrowUp":m.preventDefault(),c(-1);break;case"Enter":m.preventDefault();let L=l>=0?l:0,y=a[L];y&&p(y),r&&o&&o(""),r||(t(!1),s(-1));break;case"Escape":m.preventDefault(),t(!1),s(-1),r||o("");break;case"Tab":t(!1),s(-1);break;case"Home":m.preventDefault(),a.length>0&&s(0);break;case"End":m.preventDefault(),a.length>0&&s(a.length-1);break;case"Backspace":r&&n===""&&i.length>0&&(m.preventDefault(),d(i[i.length-1]));break}},[e,r,n,i,a,l,t,o,s,p,d,c])};function Ut({option:e,labelKey:t,valueKey:r,onRemove:n}){let o=String(e[t]),i=String(e[r]);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 text-xs bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 rounded",children:[o,jsx("button",{type:"button",onMouseDown:a=>a.preventDefault(),onClick:()=>n(i),className:"hover:bg-blue-200 dark:hover:bg-blue-800 rounded-full p-0.5 transition-colors","aria-label":`Remover ${o}`,children:"\u2715"})]},i)}function Dn(e,t){let{label:r,required:n=!1,name:o,placeholder:i="Buscar...",labelKey:a,valueKey:l,options:s,value:p,onChange:d,mode:c="single",typeSet:u="field",disabled:m=!1,ClearEnabled:L=!0,helperText:y,error:b=!1,className:h="",...M}=e,R=c==="multiple",[F,I]=useState(!1),[A,S]=useState(""),B=useRef(null),P=useRef(null),T=useRef(null);useImperativeHandle(t,()=>T.current),Ot(P,()=>I(!1));let f=Be(s,a,A),[g,N]=useState(-1),{selectedValues:E,handleSelect:V,handleRemove:J,handleClear:te,getSelectedOptions:he}=Oe({options:s,labelKey:a,valueKey:l,value:p,multiple:R,onChange:d,typeSet:u,name:o,setSearchTerm:S}),k=Gt({isOpen:F,setIsOpen:I,multiple:R,searchTerm:A,setSearchTerm:S,selectedValues:E,filteredOptions:f,highlightedIndex:g,setHighlightedIndex:N,handleSelect:V,handleRemove:J}),C=useId(),G="w-full bg-transparent outline-none placeholder:text-gray-500 dark:placeholder:text-gray-400 text-gray-900 dark:text-gray-100",K=x("relative w-full min-h-[40px] px-3 py-2 border rounded-md bg-white dark:bg-gray-800",b?"border-red-500":"border-gray-300 dark:border-gray-600",m?"opacity-50 cursor-not-allowed":"cursor-text","focus-within:ring-2 focus-within:ring-blue-500 focus-within:border-blue-500");return jsx(v,{children:jsxs("div",{className:`space-y-2 ${h}`,children:[r&&jsx(D,{htmlFor:C,required:n,children:r}),jsxs("div",{ref:B,className:"relative",children:[jsxs("div",{className:K,children:[R&&he().length>0&&jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:he().map((z,q)=>jsx(Ut,{option:z,labelKey:a,valueKey:l,onRemove:J},String(z[l]??q)))}),jsx("input",{ref:T,...M,name:o,type:"text",placeholder:i,value:A,onChange:z=>{let q=z.target.value;S(q),!F&&q.trim()!==""&&I(!0);},onKeyDown:k,onMouseDown:z=>{document.activeElement===T.current&&(z.preventDefault(),I(q=>{let j=!q;return j&&N(0),j}));},onFocus:()=>{I(!0),N(0);},disabled:m,className:G,role:"combobox","aria-expanded":F,"aria-controls":C,"aria-activedescendant":g>=0?`${C}-opt-${g}`:void 0}),L&&!!E.length&&jsx("button",{type:"button",onMouseDown:z=>z.preventDefault(),onClick:te,className:"absolute right-2 top-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 p-1 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700",title:"Limpar sele\xE7\xE3o",children:jsx(Me,{width:12,height:12})})]}),F&&jsx("div",{ref:P,id:C,className:"absolute z-50 w-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-md shadow-lg max-h-60 overflow-auto",role:"listbox","aria-multiselectable":R||void 0,children:f.length===0?jsx("div",{className:"px-3 py-2 text-sm text-gray-500 dark:text-gray-400",children:"Nenhum resultado encontrado"}):f.map((z,q)=>{let j=String(z[l]),w=E.includes(j),U=q===g;return jsx("button",{id:`${C}-opt-${q}`,"data-index":q,role:"option","aria-selected":w,type:"button",onMouseDown:we=>we.preventDefault(),onClick:()=>V(z),className:x("w-full px-3 py-2 text-left text-sm transition-colors",U&&"bg-blue-100 dark:bg-blue-800 text-blue-900 dark:text-white",!U&&w&&"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300",!w&&!U&&"text-gray-900 dark:text-gray-100","hover:bg-gray-100 dark:hover:bg-gray-700"),children:jsx("span",{children:String(z[a])})},j)})})]}),b&&jsx(O,{children:b}),!b&&y&&jsx($,{children:y})]})})}function Mn(){let e=forwardRef(Dn);return e.displayName="ComboBox",e}var En=Mn(),ts=En;var Fn=({...e})=>jsx("svg",{...e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),qt=Fn;var In=({...e})=>jsx("svg",{...e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),ie=In;var Sn=({...e})=>jsx("svg",{...e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),se=Sn;var me=["Janeiro","Fevereiro","Mar\xE7o","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"];var Kt=["Dom","Seg","Ter","Qua","Qui","Sex","S\xE1b"];var We=({type:e,currentMonth:t,selectedDate:r,onChange:n,onNavigate:o,onMonthClick:i,onYearClick:a})=>{let l=s=>{let p=s.getFullYear(),d=s.getMonth(),c=new Date(p,d,1),m=new Date(p,d+1,0).getDate(),L=c.getDay(),y=[];for(let b=L-1;b>=0;b--)y.push({date:new Date(p,d,-b),isCurrentMonth:!1});for(let b=1;b<=m;b++)y.push({date:new Date(p,d,b),isCurrentMonth:!0});for(;y.length<42;)y.push({date:new Date(p,d+1,y.length-m+1),isCurrentMonth:!1});return y};return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("button",{type:"button",onClick:()=>o("prev"),className:"p-1 cursor-pointer hover:bg-accent rounded",children:jsx(ie,{width:16,height:16})}),jsxs("div",{className:"font-medium flex gap-1",children:[jsx("span",{className:"cursor-pointer hover:underline",onClick:i,children:me[t.getMonth()]}),jsx("span",{className:"cursor-pointer hover:underline",onClick:a,children:t.getFullYear()})]}),jsx("button",{type:"button",onClick:()=>o("next"),className:"p-1 cursor-pointer hover:bg-accent rounded",children:jsx(se,{width:16,height:16})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:Kt.map(s=>jsx("div",{className:"text-center text-xs font-medium text-muted-foreground p-2",children:s},s))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:l(t).map((s,p)=>{let c=r&&s.date.toDateString()===r.toDateString(),u=s.date.toDateString()===new Date().toDateString();return jsx("button",{type:"button",onClick:()=>{if(e==="datetime-local"){let m=r??new Date,L=new Date(s.date.getFullYear(),s.date.getMonth(),s.date.getDate(),m.getHours(),m.getMinutes(),m.getSeconds());n(L);}else n(s.date);},className:`
|
|
25
|
+
`,children:jsxs("div",{className:"flex items-center justify-between",children:[jsx("span",{children:e}),jsx("svg",{className:`w-5 h-5 transition-transform ${n?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})}),n&&jsx("div",{className:"px-4 py-3 bg-background border-t border-border",children:t})]})});St.displayName="Accordion";var pi=St;function g(...e){return twMerge(clsx(e))}var Vt=forwardRef(({className:e,overrideClassName:t=!1,children:r,...n},o)=>jsx(f,{children:jsx("h5",{ref:o,className:t?e:g("mb-1 font-medium leading-none tracking-tight",e),...n,children:r})}));Vt.displayName="AlertTitle";var It=forwardRef(({className:e,overrideClassName:t=!1,children:r,...n},o)=>jsx(f,{children:jsx("div",{ref:o,className:t?e:g("text-sm [&_p]:leading-relaxed",e),...n,children:r})}));It.displayName="AlertDescription";var Ht=forwardRef(({className:e,overrideClassName:t=!1,variant:r="default",children:n,...o},i)=>jsx(f,{children:jsx("div",{ref:i,role:"alert",className:t?e:g("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:-translate-y-0.75 [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{default:"bg-background text-foreground border-border",destructive:"border-red-500/50 text-red-700 dark:text-red-400 bg-red-50 dark:bg-red-950/50 [&>svg]:text-red-600 dark:[&>svg]:text-red-400",warning:"border-yellow-500/50 text-yellow-700 dark:text-yellow-400 bg-yellow-50 dark:bg-yellow-950/50 [&>svg]:text-yellow-600 dark:[&>svg]:text-yellow-400",success:"border-green-500/50 text-green-700 dark:text-green-400 bg-green-50 dark:bg-green-950/50 [&>svg]:text-green-600 dark:[&>svg]:text-green-400"}[r],e),...o,children:n})}));Ht.displayName="Alert";var ki=Ht,Ni=Vt,Pi=It;var At=forwardRef(({className:e,overrideClassName:t=!1,variant:r="default",children:n,...o},i)=>jsx(f,{children:jsx("div",{ref:i,className:t?e:g("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{default:"bg-primary text-primary-foreground hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"bg-red-500 text-white hover:bg-red-600",outline:"text-foreground border border-input",ghost:"bg-transparent text-foreground hover:bg-muted",link:"text-primary underline-offset-4 hover:underline",success:"bg-green-500 text-white hover:bg-green-600",warning:"bg-yellow-500 text-black hover:bg-yellow-600",info:"bg-blue-500 text-white hover:bg-blue-600",subtle:"bg-muted text-muted-foreground hover:bg-muted/80",dark:"bg-zinc-900 text-white hover:bg-zinc-800",light:"bg-zinc-100 text-zinc-900 hover:bg-zinc-200"}[r],e),...o,children:n})}));At.displayName="Badge";var Fi=At;var Bt=({items:e,separator:t="/",overrideClassName:r,className:n})=>jsx(f,{children:jsx("nav",{"aria-label":"Breadcrumb",className:r?n:g("flex",n),children:jsx("ol",{className:"flex items-center space-x-2",children:e.map((o,i)=>jsxs("li",{className:"flex items-center",children:[i>0&&jsx("span",{className:"mx-2 text-muted-foreground",children:t}),o.href&&!o.current?jsx("a",{href:o.href,className:"text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",children:o.label}):jsx("span",{className:g("text-sm font-medium",o.current?"text-foreground":"text-muted-foreground"),"aria-current":o.current?"page":void 0,children:o.label})]},i))})})});Bt.displayName="Breadcrumb";var $i=Bt;var Ot=qn.forwardRef(({className:e,overrideClassName:t,variant:r="primary",size:n="md",href:o,children:i,loading:a=!1,loadingContent:l,...s},m)=>{let u="inline-flex items-center justify-center rounded-lg font-medium cursor-pointer active:translate-y-1 transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",c={primary:"bg-blue-600 text-white hover:bg-blue-700 shadow-md focus-visible:ring-blue-500",secondary:"bg-gray-600 text-white hover:bg-gray-700 shadow-sm focus-visible:ring-gray-500",tertiary:"bg-purple-600 text-white hover:bg-purple-700 shadow-sm focus-visible:ring-purple-500",destructive:"bg-red-600 text-white hover:bg-red-700 shadow-sm focus-visible:ring-red-500",success:"bg-green-600 text-white hover:bg-green-700 shadow-sm focus-visible:ring-green-500",warning:"bg-amber-500 text-white hover:bg-amber-600 shadow-sm focus-visible:ring-amber-500",info:"bg-cyan-600 text-white hover:bg-cyan-700 shadow-sm focus-visible:ring-cyan-500",accent:"bg-violet-600 text-white hover:bg-violet-700 shadow-sm focus-visible:ring-violet-500",outline:"border border-gray-300 bg-transparent text-gray-700 hover:bg-gray-50 shadow-sm focus-visible:ring-gray-500",ghost:"bg-transparent text-gray-700 hover:bg-gray-100 focus-visible:ring-gray-500",link:"text-blue-600 underline-offset-4 hover:underline bg-transparent p-0 h-auto shadow-none",gradient:"bg-gradient-to-r from-blue-600 to-purple-600 text-white hover:from-blue-700 hover:to-purple-700 shadow-md focus-visible:ring-blue-500",glass:"bg-white/10 backdrop-blur-md border border-white/20 text-black hover:bg-white/20 shadow-sm focus-visible:ring-white/50",soft:"bg-blue-100 text-blue-700 hover:bg-blue-200 shadow-sm focus-visible:ring-blue-500",dark:"bg-gray-900 text-white hover:bg-gray-800 shadow-md focus-visible:ring-gray-500",light:"bg-gray-100 text-gray-900 hover:bg-gray-200 shadow-sm focus-visible:ring-gray-500",obsidian:"bg-black text-white hover:bg-gray-900 shadow-md border border-gray-800 focus-visible:ring-gray-700",polar:"bg-white text-gray-900 hover:bg-gray-50 shadow-md border border-gray-300 focus-visible:ring-gray-400"},d={xs:"h-7 px-2 text-xs min-w-16",sm:"h-9 px-3 text-sm min-w-20",md:"h-10 px-4 py-2 text-base min-w-24",lg:"h-11 px-6 text-lg min-w-28",xl:"h-12 px-8 text-xl min-w-32"},p=t?e:g(u,c[r],d[n],e);return o?jsx(f,{children:jsx("a",{href:o,className:p,ref:m,children:a&&l?l:i})}):jsx(f,{children:jsx("button",{className:p,ref:m,...s,children:a&&l?l:i})})});Ot.displayName="Button";var Ui=Ot;var Gt=forwardRef(({className:e,overrideClassName:t=!1,children:r,...n},o)=>jsx(f,{children:jsx("div",{ref:o,className:t?e:g("rounded-lg border bg-card text-card-foreground shadow-sm",e),...n,children:r})}));Gt.displayName="Card";var zt=forwardRef(({className:e,overrideClassName:t=!1,children:r,...n},o)=>jsx(f,{children:jsx("div",{ref:o,className:t?e:g("flex flex-col space-y-1.5 p-6",e),...n,children:r})}));zt.displayName="CardHeader";var Ut=forwardRef(({className:e,overrideClassName:t=!1,children:r,...n},o)=>jsx(f,{children:jsx("h3",{ref:o,className:t?e:g("text-2xl font-semibold leading-none tracking-tight",e),...n,children:r})}));Ut.displayName="CardTitle";var Wt=forwardRef(({className:e,overrideClassName:t=!1,children:r,...n},o)=>jsx(f,{children:jsx("p",{ref:o,className:t?e:g("text-sm text-muted-foreground",e),...n,children:r})}));Wt.displayName="CardDescription";var qt=forwardRef(({className:e,overrideClassName:t=!1,children:r,...n},o)=>jsx(f,{children:jsx("div",{ref:o,className:t?e:g("p-6 pt-0",e),...n,children:r})}));qt.displayName="CardContent";var Yt=forwardRef(({className:e,overrideClassName:t=!1,children:r,...n},o)=>jsx(f,{children:jsx("div",{ref:o,className:t?e:g("flex items-center p-6 pt-0",e),...n,children:r})}));Yt.displayName="CardFooter";var Ji=Gt,ji=zt,Zi=Ut,Qi=Wt,es=qt,ts=Yt;var _t=forwardRef(({children:e,isOpen:t,onClose:r,size:n="md",className:o,overrideClassName:i=!1,...a},l)=>(useEffect(()=>(t?document.body.style.overflow="hidden":document.body.style.overflow="unset",()=>{document.body.style.overflow="unset";}),[t]),useEffect(()=>{let m=u=>{u.key==="Escape"&&r();};return t&&document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[t,r]),t?jsx(f,{children:jsxs("div",{ref:l,className:"fixed inset-0 z-50 flex items-center justify-center",...a,children:[jsx("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm",onClick:r}),jsx("div",{className:i?o:g("relative bg-background border border-border rounded-lg shadow-lg w-full mx-4",{sm:"max-w-md",md:"max-w-lg",lg:"max-w-2xl",xl:"max-w-4xl"}[n],o),children:e})]})}):null));_t.displayName="Dialog";var Xt=forwardRef(({children:e,className:t,overrideClassName:r=!1,...n},o)=>jsx(f,{children:jsx("div",{ref:o,className:r?t:g("px-6 py-4 border-b border-border",t),...n,children:e})}));Xt.displayName="DialogHeader";var Jt=forwardRef(({children:e,className:t,overrideClassName:r=!1,...n},o)=>jsx(f,{children:jsx("h2",{ref:o,className:r?t:g("text-lg font-semibold text-foreground",t),...n,children:e})}));Jt.displayName="DialogTitle";var jt=forwardRef(({children:e,className:t,overrideClassName:r=!1,...n},o)=>jsx(f,{children:jsx("div",{ref:o,className:r?t:g("px-6 py-4",t),...n,children:e})}));jt.displayName="DialogContent";var Zt=forwardRef(({children:e,className:t,overrideClassName:r=!1,...n},o)=>jsx(f,{children:jsx("div",{ref:o,className:r?t:g("px-6 py-4 border-t border-border flex justify-end space-x-2",t),...n,children:e})}));Zt.displayName="DialogFooter";var ls=_t,cs=Xt,ds=Jt,us=jt,ms=Zt;var Ae=createContext(void 0),er=forwardRef(({children:e,className:t,...r},n)=>{let[o,i]=useState(!1);return jsx(f,{children:jsx(Ae.Provider,{value:{isOpen:o,setIsOpen:i},children:jsx("div",{ref:n,className:g("relative inline-block",t),...r,children:e})})})});er.displayName="DropdownMenu";var tr=({children:e,asChild:t})=>{let r=useContext(Ae);if(!r)throw new Error("DropdownMenuTrigger must be used within DropdownMenu");let n=()=>r.setIsOpen(!r.isOpen);if(t){let o=e;return cloneElement(o,{onClick:i=>{o.props.onClick?.(i),n();}})}return jsx(f,{children:jsx("button",{onClick:n,children:e})})};tr.displayName="DropdownMenuTrigger";var rr=forwardRef(({children:e,align:t="end",className:r,...n},o)=>{let i=useContext(Ae),a=useRef(null);return useEffect(()=>{o&&(typeof o=="function"?o(a.current):o.current=a.current);},[o]),useEffect(()=>{let s=m=>{a.current&&!a.current.contains(m.target)&&i?.setIsOpen(!1);};return i?.isOpen&&document.addEventListener("mousedown",s),()=>{document.removeEventListener("mousedown",s);}},[i?.isOpen]),i?.isOpen?jsx(f,{children:jsx("div",{ref:a,className:g("absolute z-50 mt-2 min-w-32 overflow-hidden rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-md",{start:"left-0",center:"left-1/2 -translate-x-1/2",end:"right-0"}[t],r),...n,children:e})}):null});rr.displayName="DropdownMenuContent";var nr=forwardRef(({children:e,onClick:t,destructive:r,className:n,...o},i)=>{let a=useContext(Ae);return jsx(f,{children:jsx("button",{ref:i,onClick:s=>{t?.(s),a?.setIsOpen(!1);},className:g("w-full text-left px-4 py-2 text-sm hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground focus:outline-none",r&&"text-red-600 hover:bg-red-50 hover:text-red-700 focus:bg-red-50 focus:text-red-700",n),...o,children:e})})});nr.displayName="DropdownMenuItem";var or=forwardRef(({className:e,...t},r)=>jsx(f,{children:jsx("div",{ref:r,className:g("-mx-1 my-1 h-px bg-border",e),...t})}));or.displayName="DropdownMenuSeparator";var ar=forwardRef(({children:e,className:t,...r},n)=>jsx(f,{children:jsx("div",{ref:n,className:g("px-2 py-1.5 text-sm font-semibold",t),...r,children:e})}));ar.displayName="DropdownMenuLabel";var hs=er,ys=tr,ws=rr,Cs=nr,ks=or,Ns=ar;var ir=({src:e,alt:t="",fallback:r,size:n="md",className:o})=>{let[i,a]=useState(!1),l={sm:"h-8 w-8 text-xs",md:"h-10 w-10 text-sm",lg:"h-12 w-12 text-base",xl:"h-16 w-16 text-lg"},s=m=>m.split(" ").map(u=>u.charAt(0)).join("").toUpperCase().slice(0,2);return jsx(f,{children:jsx("div",{className:g("relative flex shrink-0 overflow-hidden rounded-full bg-muted",l[n],o),children:e&&!i?jsx("img",{src:e||"/placeholder.svg",alt:t,className:"aspect-square h-full w-full object-cover",onError:()=>a(!0)}):jsx("div",{className:"flex h-full w-full items-center justify-center bg-muted font-medium text-muted-foreground",children:r?s(r):"?"})})})};ir.displayName="Avatar";var Es=ir;var Zn=({children:e,className:t,overrideClassName:r})=>{if(e)return jsx(f,{children:jsx("p",{className:r?t:g("text-sm text-muted-foreground",t),children:e})})},O=Zn;var Qn=({children:e,required:t,className:r,overrideClassName:n=!1,...o})=>jsx(f,{children:jsxs("div",{className:"flex items-center gap-1",children:[jsx("label",{...o,className:n?r:g("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",r),children:e}),t&&jsx("span",{className:"text-red-600",children:"*"})]})}),F=Qn;var to=({children:e,className:t,overrideClassName:r})=>{if(e)return jsx(f,{children:jsx("p",{className:r?t:g("text-sm text-red-600 dark:text-red-400",t),children:e})})},G=to;var cr=forwardRef(({label:e,required:t,option:r,description:n,icon:o,orientation:i="left",className:a,overrideClassName:l=!1,helperText:s,error:m,...u},c)=>{let d=useId(),p=g("h-4 w-4 rounded border border-input bg-background text-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",m&&"border-destructive",a);return jsx(f,{children:jsxs("div",{className:"space-y-2 w-fit",children:[e&&jsx(F,{required:t,children:e}),jsxs("div",{className:`flex items-center ${i=="left"?"flex-row":"flex-row-reverse"} w-fit gap-2`,children:[jsx("input",{id:d,type:"checkbox",className:l?a:p,ref:c,...u}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{children:o&&o}),jsxs("div",{className:"grid gap-1.5 leading-none select-none",children:[r&&jsx(F,{htmlFor:d,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",overrideClassName:!0,children:r}),n&&jsx(F,{id:`${d}-description`,htmlFor:d,className:"text-xs text-muted-foreground",children:n})]})]})]}),m&&jsx(G,{children:m}),!m&&s&&jsx(O,{children:s})]})})});cr.displayName="CheckBox";var Zs=cr;function io(e,t){let{typeSet:r="field",multiCheck:n=!1,value:o,onChange:i,labelKey:a,valueKey:l,options:s,alignment:m="vertical",className:u,overrideClassName:c=!1,helperText:d,error:p,label:w,name:y,required:b,...v}=e,E=useId(),D=useMemo(()=>new Map(s.map(k=>[String(k[l]),k])),[s,l]),V=useMemo(()=>o==null?[]:r==="field"?n?o.map(k=>String(k)):[String(o)]:n?o.map(k=>String(k[l])):[String(o[l])],[o,r,n,l]),P=(k,N)=>{if(!i)return;let x;if(r==="field")if(n)x=k.map(M=>{let H=D.get(M);return H?H[l]:M});else {let h=k[0];if(!h)x=void 0;else {let M=D.get(h);x=M?M[l]:h;}}else n?x=k.map(M=>D.get(M)).filter(M=>M!==void 0):x=D.get(k[0]??"")??void 0;i({target:{name:y,value:x,type:"checkboxgroup",checked:N}});},$=k=>{let N;n?N=V.includes(k)?V.filter(x=>x!==k):[...V,k]:N=V[0]===k?[]:[k],P(N,N.includes(k));},I=m==="horizontal"?"flex flex-wrap items-center gap-3":"flex flex-col gap-3",S=g("h-4 w-4 rounded border border-input bg-background text-primary","focus:ring-2 focus:ring-ring focus:ring-offset-2",p&&"border-destructive");return jsx(f,{children:jsxs("div",{className:g("flex flex-col gap-3",u),children:[w&&jsx(F,{required:b,children:w}),jsx("div",{className:I,children:s.map((k,N)=>{let x=String(k[l]),h=V.includes(x),M=`${E}-${x}-${N}`;return jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{...v,id:M,ref:t,type:"checkbox",name:y,checked:h,onChange:()=>$(x),className:c?u:S}),jsx(F,{htmlFor:M,children:String(k[a])})]},M)})}),!!p&&jsx(G,{children:String(p)}),!p&&d&&jsx(O,{children:d})]})})}function so(){let e=forwardRef(io);return e.displayName="CheckBoxGroup",e}var lo=so(),cl=lo;var po=["#000000","#ffffff","#ff0000","#00ff00","#0000ff","#ffff00","#ff00ff","#00ffff","#ffa500","#800080","#ffc0cb","#a52a2a","#808080","#000080","#008000"],pr=qn.forwardRef(({label:e,required:t,onChange:r,disabled:n=!1,presetColors:o=po,showPresets:i=!0,className:a,error:l,helperText:s,name:m},u)=>{let c=useId(),d=useRef(null),[p,w]=useState(!1),[y,b]=useState("COLOR"),[v,E]=useState("HEX"),[D,V]=useState("#000000"),[P,$]=useState(0),[I,S]=useState(0),[k,N]=useState(0),[x,h]=useState(1),[M,H]=useState("#000000"),[A,j]=useState("#ffffff"),[re,Ce]=useState(90),[R,T]=useState("linear-gradient(90deg, #000000, #ffffff)"),z=(L,U,De)=>Math.min(De,Math.max(U,L)),_=L=>{let U=L.replace("#","");return {r:parseInt(U.slice(0,2),16),g:parseInt(U.slice(2,4),16),b:parseInt(U.slice(4,6),16)}},W=L=>{r?.({target:{value:L,name:m}});};useEffect(()=>{let L=U=>{d.current&&!d.current.contains(U.target)&&w(!1);};return document.addEventListener("mousedown",L),()=>document.removeEventListener("mousedown",L)},[]),useEffect(()=>{if(/^#[0-9A-F]{6}$/i.test(D)){let L=_(D);$(L.r),S(L.g),N(L.b);}},[D]),useEffect(()=>{let L=`linear-gradient(${re}deg, ${M}, ${A})`;T(L),y==="GRADIENT"&&W(L);},[M,A,re]);let q=()=>{if(x>=1){if(v==="HEX")return D;if(v==="RGB")return `rgb(${P}, ${I}, ${k})`}return `rgba(${P}, ${I}, ${k}, ${Number(x.toFixed(2))})`},Z=y==="GRADIENT"?R:q();return jsx(f,{children:jsxs("div",{className:`space-y-2 ${a??""}`,children:[e&&jsx(F,{htmlFor:c,required:t,children:e}),jsxs("div",{ref:d,className:"relative",children:[jsxs("button",{type:"button",onClick:()=>!n&&w(!p),className:"flex items-center gap-2 px-3 py-2 border rounded-md bg-background w-full",children:[jsx("div",{className:"w-6 h-6 rounded border",style:{background:Z}}),jsx("span",{className:"text-xs font-mono truncate",children:Z})]}),p&&jsxs("div",{className:"absolute z-50 mt-1 w-85 bg-popover border rounded-md p-4 space-y-3 shadow-lg",children:[jsx("div",{className:"flex gap-2",children:["COLOR","GRADIENT"].map(L=>jsx("button",{type:"button",onClick:()=>b(L),className:`px-2 py-1 text-xs rounded ${y===L?"bg-primary text-white":"border"}`,children:L==="COLOR"?"Cor":"Gradiente"},L))}),jsx("div",{className:"w-full h-10 rounded border",style:{background:Z}}),y==="COLOR"&&jsxs(Fragment,{children:[jsx("input",{ref:u,type:"color",value:D,onChange:L=>{V(L.target.value.toUpperCase()),W(q());},className:"w-full h-10 rounded"}),jsxs("div",{className:"flex gap-2 items-center",children:[jsxs("select",{value:v,onChange:L=>E(L.target.value),className:"px-2 py-1 text-xs border rounded",children:[jsx("option",{value:"HEX",children:"HEX"}),jsx("option",{value:"RGB",children:"RGB"}),jsx("option",{value:"RGBA",children:"RGBA"})]}),v==="HEX"&&jsx("input",{value:D,onChange:L=>{let U=L.target.value.toUpperCase().replace(/[^0-9A-F#]/g,"");U.startsWith("#")||(U="#"+U),U="#"+U.slice(1,7),V(U),/^#[0-9A-F]{6}$/.test(U)&&W(U);},className:"flex-1 px-2 py-1 text-xs font-mono border rounded",placeholder:"#000000"}),(v==="RGB"||v==="RGBA")&&jsx("div",{className:"flex gap-2",children:[{l:"R",v:P,s:$},{l:"G",v:I,s:S},{l:"B",v:k,s:N}].map(({l:L,v:U,s:De})=>jsxs("div",{className:"flex items-center gap-1",children:[jsx("span",{className:"text-xs font-semibold",children:L}),jsx("input",{type:"number",min:0,max:255,value:U,onChange:Mn=>{De(z(+Mn.target.value,0,255)),W(q());},className:"w-14 px-1 py-1 text-xs border rounded"})]},L))})]}),v==="RGBA"&&jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-xs font-semibold",children:"A"}),jsx("input",{type:"range",min:0,max:1,step:.01,value:x,onChange:L=>{h(+L.target.value),W(q());},className:"flex-1"}),jsxs("span",{className:"text-xs w-10 text-right",children:[Math.round(x*100),"%"]})]}),i&&jsx("div",{className:"grid grid-cols-5 gap-1",children:o.map(L=>jsx("button",{type:"button",onClick:()=>{V(L),h(1),W(L);},className:"w-8 h-8 rounded border",style:{background:L}},L))})]}),y==="GRADIENT"&&jsxs(Fragment,{children:[jsxs("div",{className:"flex gap-2 items-center",children:[jsx("input",{type:"color",value:M,onChange:L=>H(L.target.value)}),jsx("span",{className:"text-xs",children:"\u2192"}),jsx("input",{type:"color",value:A,onChange:L=>j(L.target.value)})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{className:"text-xs",children:"\xC2ngulo"}),jsx("input",{type:"range",min:0,max:360,value:re,onChange:L=>Ce(+L.target.value),className:"flex-1"}),jsxs("span",{className:"text-xs w-10 text-right",children:[re,"\xB0"]})]})]})]})]}),l&&jsx(G,{children:l}),!l&&s&&jsx(O,{children:s})]})})});pr.displayName="ColorPicker";var vl=pr;var fo=({...e})=>jsx("svg",{...e,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),Ge=fo;var bo=(e,t)=>{useEffect(()=>{let r=n=>{e.current&&!e.current.contains(n.target)&&t(!1);};return document.addEventListener("mousedown",r),()=>{document.removeEventListener("mousedown",r);}},[e,t]);},gr=bo;function tt({options:e,labelKey:t,valueKey:r,multiple:n,onChange:o,setSearchTerm:i,typeSet:a,name:l}){let[s,m]=useState([]),u=useMemo(()=>new Map(e.map(b=>[String(b[r]),b])),[e,r]),c=useCallback(()=>s.map(b=>u.get(b)).filter(b=>!!b),[s,u]),d=useCallback(b=>{if(!o)return;let v;if(a==="field"?n?v=b:v=b[0]??void 0:n?v=b.map(D=>u.get(D)).filter(D=>D!==void 0):v=u.get(b[0]??"")??void 0,i&&!n){let E=u.get(b[0]??"");E&&i(String(E[t]));}o({target:{name:l,value:v,type:"combobox"}});},[n,o,u,l,a,i,t]),p=useCallback(b=>{let v=String(b[r]),E=n?s.includes(v)?s.filter(D=>D!==v):[...s,v]:[v];m(E),d(E);},[n,s,d,r]),w=useCallback(b=>{let v=s.filter(E=>E!==b);m(v),d(v);},[s,d]),y=useCallback(()=>{m([]),i?.("");let b;a==="field"?b=n?[]:"":b=n?[]:void 0,o?.({target:{name:l,value:b,type:"combobox"}});},[n,o,l,i,a]);return {selectedValues:s,handleSelect:p,handleRemove:w,handleClear:y,getSelectedOptions:c}}function rt(e,t,r){return useMemo(()=>r?e.filter(o=>String(o[t]).toLowerCase().includes(r.toLowerCase())):e,[e,r,t])}var vr=({isOpen:e,setIsOpen:t,multiple:r,searchTerm:n,setSearchTerm:o,selectedValues:i,filteredOptions:a,highlightedIndex:l,setHighlightedIndex:s,handleSelect:m,handleRemove:u})=>{let c=useCallback(p=>{if(a.length===0){s(-1);return}s(w=>w<0?p>0?0:a.length-1:(w+p+a.length)%a.length);},[a,s]);return useCallback(p=>{if(!e){if(p.key==="Enter"||p.key==="ArrowDown"){t(!0),s(0),p.preventDefault();return}r&&p.key==="Backspace"&&n===""&&i.length>0&&(p.preventDefault(),u(i[i.length-1]));return}switch(p.key){case"ArrowDown":p.preventDefault(),c(1);break;case"ArrowUp":p.preventDefault(),c(-1);break;case"Enter":p.preventDefault();let w=l>=0?l:0,y=a[w];y&&m(y),r&&o&&o(""),r||(t(!1),s(-1));break;case"Escape":p.preventDefault(),t(!1),s(-1),r||o("");break;case"Tab":t(!1),s(-1);break;case"Home":p.preventDefault(),a.length>0&&s(0);break;case"End":p.preventDefault(),a.length>0&&s(a.length-1);break;case"Backspace":r&&n===""&&i.length>0&&(p.preventDefault(),u(i[i.length-1]));break}},[e,r,n,i,a,l,t,o,s,m,u,c])};function xr({option:e,labelKey:t,valueKey:r,onRemove:n}){let o=String(e[t]),i=String(e[r]);return jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 text-xs bg-blue-100 dark:bg-blue-900 text-blue-800 dark:text-blue-200 rounded",children:[o,jsx("button",{type:"button",onMouseDown:a=>a.preventDefault(),onClick:()=>n(i),className:"hover:bg-blue-200 dark:hover:bg-blue-800 rounded-full p-0.5 transition-colors","aria-label":`Remover ${o}`,children:"\u2715"})]},i)}function Po(e,t){let{label:r,required:n=!1,name:o,placeholder:i="Buscar...",labelKey:a,valueKey:l,options:s,value:m,onChange:u,mode:c="single",typeSet:d="field",disabled:p=!1,ClearEnabled:w=!0,helperText:y,error:b=!1,className:v="",...E}=e,D=c==="multiple",[V,P]=useState(!1),[$,I]=useState(""),S=useRef(null),k=useRef(null),N=useRef(null);useImperativeHandle(t,()=>N.current),gr(k,()=>P(!1));let x=rt(s,a,$),[h,M]=useState(-1),{selectedValues:H,handleSelect:A,handleRemove:j,handleClear:re,getSelectedOptions:Ce}=tt({options:s,labelKey:a,valueKey:l,value:m,multiple:D,onChange:u,typeSet:d,name:o,setSearchTerm:I}),R=vr({isOpen:V,setIsOpen:P,multiple:D,searchTerm:$,setSearchTerm:I,selectedValues:H,filteredOptions:x,highlightedIndex:h,setHighlightedIndex:M,handleSelect:A,handleRemove:j}),T=useId(),z="w-full bg-transparent outline-none placeholder:text-gray-500 dark:placeholder:text-gray-400 text-gray-900 dark:text-gray-100",_=g("relative w-full min-h-[40px] px-3 py-2 border rounded-md bg-white dark:bg-gray-800",b?"border-red-500":"border-gray-300 dark:border-gray-600",p?"opacity-50 cursor-not-allowed":"cursor-text","focus-within:ring-2 focus-within:ring-blue-500 focus-within:border-blue-500");return jsx(f,{children:jsxs("div",{className:`space-y-2 ${v}`,children:[r&&jsx(F,{htmlFor:T,required:n,children:r}),jsxs("div",{ref:S,className:"relative",children:[jsxs("div",{className:_,children:[D&&Ce().length>0&&jsx("div",{className:"flex flex-wrap gap-1 mb-2",children:Ce().map((W,q)=>jsx(xr,{option:W,labelKey:a,valueKey:l,onRemove:j},String(W[l]??q)))}),jsx("input",{ref:N,...E,name:o,type:"text",placeholder:i,value:$,onChange:W=>{let q=W.target.value;I(q),!V&&q.trim()!==""&&P(!0);},onKeyDown:R,onMouseDown:W=>{document.activeElement===N.current&&(W.preventDefault(),P(q=>{let Z=!q;return Z&&M(0),Z}));},onFocus:()=>{P(!0),M(0);},disabled:p,className:z,role:"combobox","aria-expanded":V,"aria-controls":T,"aria-activedescendant":h>=0?`${T}-opt-${h}`:void 0}),w&&!!H.length&&jsx("button",{type:"button",onMouseDown:W=>W.preventDefault(),onClick:re,className:"absolute right-2 top-2 text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200 p-1 rounded-full hover:bg-gray-100 dark:hover:bg-gray-700",title:"Limpar sele\xE7\xE3o",children:jsx(Ge,{width:12,height:12})})]}),V&&jsx("div",{ref:k,id:T,className:"absolute z-50 w-full mt-1 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-md shadow-lg max-h-60 overflow-auto",role:"listbox","aria-multiselectable":D||void 0,children:x.length===0?jsx("div",{className:"px-3 py-2 text-sm text-gray-500 dark:text-gray-400",children:"Nenhum resultado encontrado"}):x.map((W,q)=>{let Z=String(W[l]),L=H.includes(Z),U=q===h;return jsx("button",{id:`${T}-opt-${q}`,"data-index":q,role:"option","aria-selected":L,type:"button",onMouseDown:De=>De.preventDefault(),onClick:()=>A(W),className:g("w-full px-3 py-2 text-left text-sm transition-colors",U&&"bg-blue-100 dark:bg-blue-800 text-blue-900 dark:text-white",!U&&L&&"bg-blue-50 dark:bg-blue-900/20 text-blue-700 dark:text-blue-300",!L&&!U&&"text-gray-900 dark:text-gray-100","hover:bg-gray-100 dark:hover:bg-gray-700"),children:jsx("span",{children:String(W[a])})},Z)})})]}),b&&jsx(G,{children:b}),!b&&y&&jsx(O,{children:y})]})})}function To(){let e=forwardRef(Po);return e.displayName="ComboBox",e}var Lo=To(),Yl=Lo;var Ro=({...e})=>jsx("svg",{...e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z"})}),yr=Ro;var Do=({...e})=>jsx("svg",{...e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),de=Do;var Mo=({...e})=>jsx("svg",{...e,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"})}),ue=Mo;var be=["Janeiro","Fevereiro","Mar\xE7o","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"];var kr=["Dom","Seg","Ter","Qua","Qui","Sex","S\xE1b"];var st=({type:e,currentMonth:t,selectedDate:r,onChange:n,onNavigate:o,onMonthClick:i,onYearClick:a})=>{let l=s=>{let m=s.getFullYear(),u=s.getMonth(),c=new Date(m,u,1),p=new Date(m,u+1,0).getDate(),w=c.getDay(),y=[];for(let b=w-1;b>=0;b--)y.push({date:new Date(m,u,-b),isCurrentMonth:!1});for(let b=1;b<=p;b++)y.push({date:new Date(m,u,b),isCurrentMonth:!0});for(;y.length<42;)y.push({date:new Date(m,u+1,y.length-p+1),isCurrentMonth:!1});return y};return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("button",{type:"button",onClick:()=>o("prev"),className:"p-1 cursor-pointer hover:bg-accent rounded",children:jsx(de,{width:16,height:16})}),jsxs("div",{className:"font-medium flex gap-1",children:[jsx("span",{className:"cursor-pointer hover:underline",onClick:i,children:be[t.getMonth()]}),jsx("span",{className:"cursor-pointer hover:underline",onClick:a,children:t.getFullYear()})]}),jsx("button",{type:"button",onClick:()=>o("next"),className:"p-1 cursor-pointer hover:bg-accent rounded",children:jsx(ue,{width:16,height:16})})]}),jsx("div",{className:"grid grid-cols-7 gap-1 mb-2",children:kr.map(s=>jsx("div",{className:"text-center text-xs font-medium text-muted-foreground p-2",children:s},s))}),jsx("div",{className:"grid grid-cols-7 gap-1",children:l(t).map((s,m)=>{let c=r&&s.date.toDateString()===r.toDateString(),d=s.date.toDateString()===new Date().toDateString();return jsx("button",{type:"button",onClick:()=>{if(e==="datetime-local"){let p=r??new Date,w=new Date(s.date.getFullYear(),s.date.getMonth(),s.date.getDate(),p.getHours(),p.getMinutes(),p.getSeconds());n(w);}else n(s.date);},className:`
|
|
26
26
|
p-2 cursor-pointer text-sm rounded hover:bg-accent
|
|
27
27
|
${s.isCurrentMonth?"text-foreground":"text-muted-foreground"}
|
|
28
28
|
${c?"bg-primary text-primary-foreground hover:bg-primary":""}
|
|
29
|
-
${
|
|
30
|
-
`,children:s.date.getDate()},
|
|
29
|
+
${d&&!c?"bg-accent font-medium":""}
|
|
30
|
+
`,children:s.date.getDate()},m)})})]})};var Nr=(e,t)=>{let r=e.getFullYear(),n=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0"),i=String(e.getHours()).padStart(2,"0"),a=String(e.getMinutes()).padStart(2,"0"),l=String(e.getSeconds()).padStart(2,"0");switch(t){case"date":return `${r}-${n}-${o}`;case"datetime-local":return `${r}-${n}-${o}T${i}:${a}:${l}`;case"year":return `${r}`;case"month":return `${r}-${n}`;case"week":{let s=new Date(e);s.setHours(0,0,0,0),s.setDate(s.getDate()+3-(s.getDay()+6)%7);let m=new Date(s.getFullYear(),0,4),u=1+Math.round(((s.getTime()-m.getTime())/864e5-3+(m.getDay()+6)%7)/7);return `${s.getFullYear()}-W${String(u).padStart(2,"0")}`}}};var lt=(e,t,r="pt-BR")=>{switch(t){case"date":return e.toLocaleDateString(r);case"datetime-local":return e.toLocaleString(r);case"year":return `${e.getFullYear()}`;case"month":return be?`${be[e.getMonth()]} ${e.getFullYear()}`:e.toLocaleDateString(r,{month:"long",year:"numeric"});case"week":{let n=new Date(e);n.setHours(0,0,0,0),n.setDate(n.getDate()+3-(n.getDay()+6)%7);let o=new Date(n.getFullYear(),0,4);return `Semana ${1+Math.round(((n.getTime()-o.getTime())/864e5-3+(o.getDay()+6)%7)/7)} \u2022 ${n.getFullYear()}`}}};var So=(e,t)=>{useEffect(()=>{let r=n=>{e.current&&!e.current.contains(n.target)&&t(!1);};return document.addEventListener("mousedown",r),()=>{document.removeEventListener("mousedown",r);}},[e,t]);},Pr=So;var Lr=({onChange:e,currentMonth:t,selectedDate:r,setIsOpen:n,onNavigate:o,onHeaderClick:i,closeOnSelect:a})=>{let l=t.getFullYear();return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("button",{type:"button",onClick:()=>o("prev"),className:"p-1 cursor-pointer hover:bg-accent rounded",children:jsx(de,{width:16,height:16})}),jsx("h3",{className:"font-medium cursor-pointer hover:underline",onClick:i,children:l}),jsx("button",{type:"button",onClick:()=>o("next"),className:"p-1 cursor-pointer hover:bg-accent rounded",children:jsx(ue,{width:16,height:16})})]}),jsx("div",{className:"grid grid-cols-3 gap-2",children:be.map((s,m)=>{let u=r,c=u&&u.getFullYear()===l&&u.getMonth()===m;return jsx("button",{type:"button",onClick:()=>{e(new Date(l,m,1)),a&&n(!1);},className:`p-2 cursor-pointer text-sm rounded hover:bg-accent ${c?"bg-primary text-primary-foreground hover:bg-primary":""}`,children:s},s)})})]})};var Rr=({selectedDate:e,onChange:t})=>{let r=e??new Date,n=r.getHours(),o=r.getMinutes(),i=r.getSeconds(),a=`
|
|
31
31
|
${String(n).padStart(2,"0")}:
|
|
32
32
|
${String(o).padStart(2,"0")}:
|
|
33
33
|
${String(i).padStart(2,"0")}
|
|
34
|
-
`,l=Array.from({length:24},(c,
|
|
34
|
+
`,l=Array.from({length:24},(c,d)=>d),s=Array.from({length:60},(c,d)=>d),m=Array.from({length:60},(c,d)=>d),u=(c,d,p)=>{let w=new Date(r.getFullYear(),r.getMonth(),r.getDate(),c,d,p);t(w);};return jsxs("div",{className:"space-y-2",children:[jsxs(F,{className:"flex items-center gap-2",children:["Hora",jsx("span",{className:"text-sm font-normal text-muted-foreground",children:a})]}),jsxs("div",{className:"flex h-full max-h-72 gap-2",children:[jsx("div",{className:"w-16 overflow-y-auto border rounded-md scrollbar-thin",children:l.map(c=>jsx("button",{type:"button",onClick:()=>u(c,o,i),className:`w-full px-2 py-1 text-sm text-center cursor-pointer hover:bg-accent ${c===n?"bg-primary text-primary-foreground hover:bg-primary":""}`,children:String(c).padStart(2,"0")},c))}),jsx("div",{className:"w-16 overflow-y-auto border rounded-md scrollbar-thin",children:s.map(c=>jsx("button",{type:"button",onClick:()=>u(n,c,i),className:`w-full px-2 py-1 text-sm text-center cursor-pointer hover:bg-accent ${c===o?"bg-primary text-primary-foreground hover:bg-primary":""}`,children:String(c).padStart(2,"0")},c))}),jsx("div",{className:"w-16 overflow-y-auto border rounded-md scrollbar-thin",children:m.map(c=>jsx("button",{type:"button",onClick:()=>u(n,o,c),className:`w-full px-2 py-1 text-sm text-center cursor-pointer hover:bg-accent ${c===i?"bg-primary text-primary-foreground hover:bg-primary":""}`,children:String(c).padStart(2,"0")},c))})]})]})};var Dr=({selectedDate:e,currentMonth:t,onChange:r,onNavigate:n,onHeaderClick:o,setIsOpen:i})=>{let a=t.getFullYear(),l=Array.from({length:52},(c,d)=>d+1),s=e,m=c=>{let d=new Date(a,0,1+(c-1)*7);r(d),i(!1);},u=(()=>{if(!s)return null;let c=new Date(s);c.setHours(0,0,0,0),c.setDate(c.getDate()+3-(c.getDay()+6)%7);let d=new Date(c.getFullYear(),0,4),p=1+Math.round(((c.getTime()-d.getTime())/864e5-3+(d.getDay()+6)%7)/7);return {year:c.getFullYear(),week:p}})();return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("button",{type:"button",onClick:()=>n("prev"),className:"p-1 cursor-pointer hover:bg-accent rounded",children:jsx(de,{width:16,height:16})}),jsx("h3",{className:"font-medium cursor-pointer hover:underline",onClick:o,children:a}),jsx("button",{type:"button",onClick:()=>n("next"),className:"p-1 cursor-pointer hover:bg-accent rounded",children:jsx(ue,{width:16,height:16})})]}),jsx("div",{className:"grid grid-cols-4 gap-2",children:l.map(c=>{let d=u&&u.year===a&&u.week===c;return jsxs("button",{type:"button",onClick:()=>m(c),className:`p-2 text-sm rounded cursor-pointer hover:bg-accent ${d?"bg-primary text-primary-foreground hover:bg-primary":""}`,children:["Semana ",c]},c)})})]})};var Er=({currentYear:e,selectedDate:t,onPick:r,onNavigate:n})=>{let o=e-6,i=Array.from({length:12},(a,l)=>o+l);return jsxs(Fragment,{children:[jsxs("div",{className:"flex items-center justify-between mb-4",children:[jsx("button",{type:"button",onClick:()=>n("prev"),className:"p-1 cursor-pointer hover:bg-accent rounded",children:jsx(de,{width:16,height:16})}),jsx("h3",{className:"font-medium",children:e}),jsx("button",{type:"button",onClick:()=>n("next"),className:"p-1 cursor-pointer hover:bg-accent rounded",children:jsx(ue,{width:16,height:16})})]}),jsx("div",{className:"grid grid-cols-3 gap-2",children:i.map(a=>{let l=t?.getFullYear()===a;return jsx("button",{type:"button",onClick:()=>r(a),className:`p-2 text-sm rounded hover:bg-accent ${l?"bg-primary text-primary-foreground":""}`,children:a},a)})})]})};var Sr=forwardRef(({label:e,required:t,value:r,name:n,onChange:o,placeholder:i="Selecione uma data",type:a="date",locale:l="pt-BR",disabled:s=!1,error:m=!1,helperText:u,className:c,...d},p)=>{let w=useId(),y=useRef(null),b=useRef(null),[v,E]=useState(!1),[D,V]=useState(0),[P,$]=useState(r),[I,S]=useState(()=>r?lt(r,a,l):""),[k,N]=useState(()=>a==="month"?"month":a==="week"?"week":a==="year"?"year":"day");Pr(y,()=>E(!1));let x=P??new Date,h=new Date(x.getFullYear(),x.getMonth()+D,1),M=R=>{b.current=R,typeof p=="function"?p(R):p&&(p.current=R);},H=R=>{$(R);let T=Nr(R,a),z=lt(R,a,l);S(z),b.current&&(b.current.value=T,o?.({target:{name:b.current.name,value:T},type:"change"}),V(0));},A=(R,T,z)=>{let _=new Date(R,T+1,0).getDate();return Math.min(z,_)},j=R=>{let T=R.replace(/\D/g,"").slice(0,8),z=[];return T.length>=2&&z.push(T.slice(0,2)),T.length>=4&&z.push(T.slice(2,4)),T.length>4&&z.push(T.slice(4)),z.join("/")},re=R=>{let T=R.target.value,z=j(T);if(S(z),z.length===10){let[_,W,q]=z.split("/").map(Number),Z=new Date(q,W-1,_);isNaN(Z.getTime())||H(Z);}},Ce=()=>{switch(k){case"year":return jsx(Er,{currentYear:h.getFullYear(),selectedDate:P,onNavigate:R=>V(T=>T+(R==="next"?12:-12)),onPick:R=>{let T=P??new Date,z=A(R,T.getMonth(),T.getDate()),_=new Date(R,T.getMonth(),z,T.getHours(),T.getMinutes(),T.getSeconds());$(_),a==="year"?(H(_),E(!1)):N(a==="month"?"month":a==="week"?"week":"month");}});case"month":return jsx(Lr,{currentMonth:h,selectedDate:P,setIsOpen:E,onNavigate:R=>V(T=>T+(R==="next"?12:-12)),onHeaderClick:()=>N("year"),closeOnSelect:a==="month",onChange:R=>{let T=P??new Date,z=A(R.getFullYear(),R.getMonth(),T.getDate()),_=new Date(R.getFullYear(),R.getMonth(),z,T.getHours(),T.getMinutes(),T.getSeconds());$(_),a==="month"?(H(_),E(!1)):N("day");}});case"week":return jsx(Dr,{currentMonth:h,selectedDate:P,setIsOpen:E,onNavigate:R=>V(T=>T+(R==="next"?12:-12)),onHeaderClick:()=>N("year"),onChange:R=>{H(R),E(!1);}});case"day":default:return a==="datetime-local"?jsxs("div",{className:"flex h-fit gap-4",children:[jsx("div",{className:"flex-1",children:jsx(st,{type:a,currentMonth:h,selectedDate:P,onNavigate:R=>V(T=>T+(R==="next"?1:-1)),onMonthClick:()=>N("month"),onYearClick:()=>N("year"),onChange:R=>{let T=P??new Date,z=new Date(R.getFullYear(),R.getMonth(),R.getDate(),T.getHours(),T.getMinutes(),T.getSeconds());H(z);}})}),jsx("div",{className:"w-fit",children:jsx(Rr,{selectedDate:P,onChange:R=>H(R)})})]}):jsx(st,{type:a,currentMonth:h,selectedDate:P,onNavigate:R=>V(T=>T+(R==="next"?1:-1)),onMonthClick:()=>N("month"),onYearClick:()=>N("year"),onChange:R=>{H(R),E(!1);}})}};return jsx(f,{children:jsxs("div",{className:`space-y-2 ${c}`,children:[e&&jsx(F,{htmlFor:w,required:t,children:e}),jsx("input",{ref:M,id:w,name:n,type:"text",className:"sr-only",disabled:s,...d}),jsxs("div",{ref:y,className:"relative",children:[jsxs("div",{className:"relative",children:[jsx("input",{type:"text",value:I,onChange:re,onFocus:()=>!s&&E(!0),placeholder:i,disabled:s,className:`
|
|
35
35
|
w-full px-3 py-2 pr-9 border rounded-md bg-background
|
|
36
|
-
${
|
|
36
|
+
${m?"border-red-500":"border-input"}
|
|
37
37
|
${s?"opacity-50 cursor-not-allowed":"hover:border-ring"}
|
|
38
38
|
focus:ring-2 focus:ring-ring focus:ring-offset-2
|
|
39
|
-
`}),jsx(qt,{width:16,height:16,className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"})]}),h&&jsx("div",{className:"absolute z-50 mt-1 bg-popover border border-border rounded-md shadow-lg p-4 min-w-70",children:he()})]}),p&&jsx(O,{children:p}),!p&&d&&jsx($,{children:d})]})})});nr.displayName="DatePicker";var el=nr;var qn=({children:e,before:t,after:r,className:n})=>{let i=zn("flex justify-center items-center",{"rounded-l-lg":t,"rounded-r-lg":r},n);return jsx("div",{className:i,children:jsx("span",{children:e})})},Xe=qn;var Wn=({children:e})=>jsx("div",{className:"absolute px-2",children:jsx("span",{children:e})}),ir=Wn;var Yn=({children:e})=>jsx("div",{className:"absolute right-0 px-2",children:jsx("span",{children:e})}),lr=Yn;function cr(e){e.currentTarget.maxLength=9;let t=e.currentTarget.value;return t=t.replace(/\D/g,""),t=t.replace(/^(\d{5})(\d)/,"$1-$2"),e.currentTarget.value=t,e}function dr(e){let t=e.currentTarget.value;t=t.replace(/\D/g,""),t=t.padStart(3,"0");let r=t.slice(0,-2),n=t.slice(-2),a=`${(r.replace(/^0+/,"")||"0").replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1.")},${n}`;return e.currentTarget.value=a,e}function ur(e){e.currentTarget.maxLength=14;let t=e.currentTarget.value;return t.match(/^(\d{3}).(\d{3}).(\d{3})-(\d{2})$/)||(t=t.replace(/\D/g,""),t=t.replace(/(\d{3})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d{2})$/,"$1-$2"),e.currentTarget.value=t),e}function mr(e){e.currentTarget.maxLength=15;let t=e.currentTarget.value.replace(/\D/g,"");return t=t.replace(/(\d{2})(\d)/,"($1) $2"),t=t.replace(/(\d{5})(\d)/,"$1-$2"),e.currentTarget.value=t,e}function pr(e){e.currentTarget.maxLength=14;let t=e.currentTarget.value.replace(/\D/g,"");return t=t.replace(/(\d{2})(\d)/,"($1) $2"),t=t.replace(/(\d{4})(\d)/,"$1-$2"),e.currentTarget.value=t,e}function fr(e){let t=e.currentTarget.value.replace(/\D/g,"");return t.length<=11?(e.currentTarget.maxLength=14,t=t.replace(/(\d{3})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d{2})$/,"$1-$2")):(e.currentTarget.maxLength=18,t=t.replace(/(\d{2})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d)/,"$1/$2"),t=t.replace(/(\d{4})(\d{2})$/,"$1-$2")),e.currentTarget.value=t,e}function gr(e){e.currentTarget.maxLength=12;let t=e.currentTarget.value.replace(/\D/g,"");return t=t.replace(/(\d{2})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d{1})$/,"$1-$2"),e.currentTarget.value=t,e}function br(e){e.currentTarget.maxLength=18;let t=e.currentTarget.value.replace(/\D/g,"");return t=t.replace(/(\d{2})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d)/,"$1/$2"),t=t.replace(/(\d{4})(\d{2})$/,"$1-$2"),e.currentTarget.value=t,e}var Kn=({e,mask:t})=>{switch(t){case"money":return dr(e);case"mobile":return mr(e);case"phone":return pr(e);case"cpfCnpj":return fr(e);case"cpf":return ur(e);case"rg":return gr(e);case"cnpj":return br(e);case"cep":return cr(e);default:return e}},vr=Kn;var Jn=({mask:e,initialValue:t=""})=>{let[r,n]=useState(t);useEffect(()=>{t!==r&&n(t);},[t]);let o=useCallback(a=>{let s=vr({e:a,mask:e})?.currentTarget?.value??a.currentTarget.value;n(s);},[e]),i=useCallback(()=>n(""),[]);return {value:r,setValue:n,handleChange:o,handleClear:i}},xr=Jn;var yr=forwardRef(({label:e,required:t=!1,mask:r,name:n,prefix:o,suffix:i,addonBefore:a,addonBeforeClassName:l,addonAfter:s,addonAfterClassName:p,ClearEnabled:d=!0,className:c,overrideClassName:u=!1,error:m,helperText:L,value:y=void 0,onChange:b,...h},M)=>{let R=useId(),{handleChange:F,handleClear:I,setValue:A}=xr({mask:r,initialValue:y}),S=x("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50",m&&"border-destructive focus-visible:ring-destructive",!o&&!i&&"px-3",o&&!i&&"pl-10 pr-3",i&&!o&&"pl-3 pr-10",o&&i&&"pl-10 pr-10",a&&"rounded-l-none border-l-0",s&&"rounded-r-none border-r-0",c),B=T=>{F(T),b?.(T);},P=()=>{I(),A(""),b?.({target:{name:n||"",value:""}});};return jsx(v,{children:jsxs("div",{className:"flex flex-col w-full gap-2",children:[e&&jsx(D,{htmlFor:R,required:t,children:e}),jsxs("div",{className:"relative flex",children:[a&&jsx(Xe,{before:!0,className:l,children:a}),jsxs("div",{className:"relative flex items-center w-full",children:[o&&jsx(ir,{children:o}),jsx("input",{id:R,ref:M,name:n,onChange:B,className:u?c:S,...h}),d&&y&&jsx(Me,{onClick:P,width:12,height:12,className:x("absolute right-2 cursor-pointer",i&&"right-8")}),i&&jsx(lr,{children:i})]}),s&&jsx(Xe,{after:!0,className:p,children:s})]}),m&&jsx(O,{children:m}),!m&&L&&jsx($,{children:L})]})})});yr.displayName="Input";var Nl=yr;var wr=forwardRef(({length:e=6,groupBy:t,value:r,name:n,label:o,required:i=!1,helperText:a,error:l,onChange:s,onBlur:p,className:d,charType:c="numeric",customPattern:u,caseMode:m="none",...L},y)=>{let b=useId(),h=useRef([]),M=f=>{switch(m){case"upper":return f.toUpperCase();case"lower":case"visual-upper":return f.toLowerCase();case"visual-lower":return f.toUpperCase();default:return f}},R=f=>{if(!f)return "";let g=f.slice(0,1);switch(g=M(g),c){case"numeric":return /\d/.test(g)?g:"";case"alpha":return /[A-Za-z]/.test(g)?g:"";case"alphanumeric":return /[A-Za-z0-9]/.test(g)?g:"";case"custom":return u?.test(g)?g:"";default:return g}},F=()=>(r!=null?String(r):"").split("").map(R).slice(0,e),I=F().concat(Array(e).fill(" ")).slice(0,e),A=f=>{let g=f.split("").map(R).join("").slice(0,e),N=g===""?void 0:typeof r=="number"?Number(g):g;s?.({target:{name:n,value:N}});},S=(f,g)=>{let N=R(g),E=F();if(N===""){E[f]="",A(E.join(""));return}if(g.length>1){let V=g.split("").map(R).join("").slice(0,e);A(V),h.current[Math.min(V.length-1,e-1)]?.focus();return}N&&(E[f]=N,A(E.join("")),f<e-1&&h.current[f+1]?.focus());},B=f=>{let g=F();!g[f]&&f>0?g[f-1]="":g[f]="",A(g.join("")),f>0&&h.current[f-1]?.focus();},P=f=>{f.preventDefault();let N=f.clipboardData.getData("text").split("").map(R).join("").slice(0,e);N&&(A(N),h.current[Math.min(N.length-1,e-1)]?.focus());},T=f=>{switch(m){case"upper":case"visual-upper":return f.toUpperCase();case"lower":case"visual-lower":return f.toLowerCase();default:return f}};return jsx(v,{children:jsxs("div",{className:"flex flex-col gap-2 w-full",children:[o&&jsx(D,{htmlFor:b,required:i,children:o}),jsx("div",{className:x("flex gap-3 items-center",l&&"text-red-500",d),...L,children:I.map((f,g)=>{let N=t&&g>0&&g%t===0;return jsxs(jr.Fragment,{children:[N&&jsx("span",{className:"flex items-center justify-center text-xl font-bold select-none",children:"-"}),jsx("input",{id:b,type:"text",maxLength:1,inputMode:c==="numeric"?"numeric":"text",value:T(f).trim(),ref:E=>{h.current[g]=E,g===0&&y&&(typeof y=="function"?y(E):typeof y=="object"&&(y.current=E));},onPaste:P,onChange:E=>S(g,E.target.value),onKeyDown:E=>E.key==="Backspace"&&B(g),onBlur:p,className:x("h-14 w-12 text-center text-2xl rounded-md border border-input bg-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",l&&"border-red-500")})]},g)})}),l&&jsx(O,{children:l}),!l&&a&&jsx($,{children:a})]})})});wr.displayName="OtpInput";var Hl=wr;var kr=forwardRef(({label:e,required:t,option:r,description:n,icon:o,className:i,overrideClassName:a,helperText:l,error:s,...p},d)=>{let c=useId(),u=x("h-4 w-4 border border-input bg-background text-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",s&&"border-destructive",i);return jsx(v,{children:jsxs("div",{className:"space-y-3",children:[e&&jsx(D,{required:t,children:e}),jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{id:c,type:"radio",className:a?i:u,ref:d,...p}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{children:o&&o}),jsxs("div",{className:"grid gap-1.5 leading-none select-none",children:[r&&jsx(D,{htmlFor:c,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",overrideClassName:!0,children:r}),n&&jsx(D,{id:`${c}-description`,htmlFor:c,className:"text-xs text-muted-foreground",children:n})]})]})]}),s&&jsx(O,{children:s}),!s&&l&&jsx($,{children:l})]})})});kr.displayName="Radio";var Wl=kr;function so(e,t){let{label:r,required:n,name:o,labelKey:i,valueKey:a,options:l,alignment:s="vertical",className:p,overrideClassName:d=!1,helperText:c,error:u,typeSet:m="field",value:L,onChange:y,...b}=e,h=useId(),M=useMemo(()=>new Map(l.map(S=>[String(S[a]),S])),[l,a]),R=useMemo(()=>L==null?"":String(m==="field"?L:L[a]),[L,m,a]),F=S=>{if(!y)return;let B;if(m==="field"){let P=M.get(S);if(P)B=P[a];else {let T=Number(S);B=Number.isNaN(T)?S:T;}}else B=M.get(S)??void 0;y({target:{name:o,value:B,type:"radiogroup",checked:!0}});},I=s==="horizontal"?"flex flex-wrap items-center gap-3":"flex flex-col gap-3",A=x("h-4 w-4 rounded-full border border-input bg-background text-primary","focus:ring-2 focus:ring-ring focus:ring-offset-2",u&&"border-destructive");return jsx(v,{children:jsxs("div",{className:x("flex flex-col gap-3",p),children:[r&&jsx(D,{required:n,children:r}),jsx("div",{className:I,children:l.map((S,B)=>{let P=String(S[a]),T=`${h}-${P}-${B}`;return jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{...b,id:T,ref:t,name:o,type:"radio",checked:R===P,onChange:()=>F(P),className:d?p:A}),jsx(D,{htmlFor:T,children:String(S[i])})]},T)})}),u&&jsx(O,{children:String(u)}),!u&&c&&jsx($,{children:c})]})})}function lo(){let e=forwardRef(so);return e.displayName="RadioGroup",e}var co=lo(),rc=co;function po({label:e,required:t=!1,options:r,labelKey:n,valueKey:o,placeholder:i,error:a,helperText:l,className:s,...p},d){let c=useId(),u=x("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50",a&&"border-red-500 focus-visible:ring-red-500",s);return jsx(v,{children:jsxs("div",{className:"space-y-2",children:[e&&jsx(D,{htmlFor:c,required:t,children:e}),jsxs("select",{id:c,ref:d,className:u,...p,children:[i&&jsx("option",{value:"",disabled:!0,children:i}),r.map((m,L)=>jsx("option",{value:String(m[o]),children:String(m[n])},L))]}),a&&jsx(O,{children:a}),!a&&l&&jsx($,{children:l})]})})}function fo(){let e=forwardRef(po);return e.displayName="Select",e}var go=fo(),pc=go;var Nr=forwardRef(({label:e,required:t,option:r,description:n,icon:o,checked:i=!1,className:a,overrideClassName:l,error:s,name:p,...d},c)=>{let u=useId();return jsx(v,{children:jsxs("div",{className:"flex flex-col gap-2",children:[e&&jsx(D,{required:t,children:e}),jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:u,name:p,checked:i,className:"peer sr-only",ref:c,...d}),jsx("label",{htmlFor:u,className:x("relative flex items-center h-6 w-11 cursor-pointer rounded-full bg-input transition-colors duration-200","peer-checked:bg-primary peer-focus:ring-2 peer-focus:ring-ring peer-focus:ring-offset-2 peer-focus:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50",a),children:jsx("span",{className:x("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",i?"translate-x-5":"translate-x-1")})}),jsx("span",{children:o&&o}),(r||n)&&jsxs("div",{className:"grid gap-1.5 leading-none select-none",children:[e&&jsx(D,{id:`${u}-label`,htmlFor:u,className:"text-sm font-medium leading-none",children:r}),n&&jsx(D,{id:`${u}-description`,htmlFor:u,className:"text-xs text-muted-foreground",children:n})]})]})]})})});Nr.displayName="Switch";var Cc=Nr;var Rr=jr.forwardRef(({label:e,required:t,showCount:r,maxLength:n,className:o,overrideClassName:i=!1,error:a,helperText:l,...s},p)=>{let d=useId(),[c,u]=useState(0),m=x("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",a&&"border-red-500 focus-visible:ring-red-500",o);return jsx(v,{children:jsxs("div",{className:"space-y-2",children:[e&&jsx(D,{htmlFor:d,required:t,children:e}),jsxs("div",{className:"relative",children:[jsx("textarea",{id:d,className:i?o:m,maxLength:n,onInput:L=>u(L.currentTarget.textLength),ref:p,...s}),r&&jsxs("span",{className:"absolute bottom-2 right-3 text-xs text-muted-foreground",children:[c,n?` / ${n}`:""]})]}),a&&jsx(O,{children:a}),!a&&l&&jsx($,{children:l})]})})});Rr.displayName="TextArea";var Mc=Rr;var Co=({files:e,removeFile:t})=>jsx("div",{className:"space-y-2",children:e?.length>0&&e?.map((r,n)=>jsxs("div",{className:"flex items-center justify-between p-2 bg-secondary rounded",children:[jsxs("div",{children:[jsx("p",{className:"text-sm truncate",children:r.name}),jsxs("p",{className:"text-xs text-muted-foreground",children:[(r?.size/1024).toFixed(1)," KB"]})]}),jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t(n);},className:"ml-2 p-1 hover:bg-destructive/20 rounded",children:"\u2715"})]},`${r?.name}-${n}`))}),Dr=Co;var wo=({accept:e,maxSize:t})=>jsxs("div",{className:"space-y-2",children:[jsx("svg",{className:"w-8 h-8 mx-auto text-muted-foreground",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})}),jsxs("div",{children:[jsx("p",{className:"text-sm text-foreground",children:"Clique para selecionar ou arraste arquivos aqui"}),jsxs("p",{className:"text-xs text-muted-foreground",children:[e&&`Tipos aceitos: ${e}`,t&&` \u2022 Tamanho m\xE1ximo: ${t}MB`]})]})]}),Mr=wo;var Er=({files:e,setFiles:t,multiple:r=!1,disabled:n=!1,filterFiles:o=i=>i})=>{let i=useRef(null),[a,l]=useState(!1),s=useCallback(u=>{u.preventDefault(),!n&&l(!0);},[n]),p=useCallback(()=>{l(!1);},[]),d=useCallback(u=>{if(u.preventDefault(),n||!i.current)return;l(!1);let m=Array.from(u.dataTransfer.files);if(!r&&!e||!r&&m.length>1)return;let L=o(m),y=r?L:L.slice(0,1);t(y);let b=new DataTransfer;y.forEach(h=>b.items.add(h)),i.current.files=b.files,i.current.dispatchEvent(new Event("change",{bubbles:!0}));},[n,r,e,o]),c=useCallback(()=>{t([]),i.current&&(i.current.value="");},[]);return {files:e,setFiles:t,clearFiles:c,inputRef:i,isDragOver:a,setIsDragOver:l,handleDrop:d,handleDragOver:s,handleDragLeave:p}};var Fr=({files:e,setFiles:t,inputRef:r})=>({removeFile:useCallback(o=>{if(!r.current)return;let i=e?.filter((l,s)=>s!==o);t(i);let a=new DataTransfer;i?.forEach(l=>a.items.add(l)),r.current.files=a.files,r.current.dispatchEvent(new Event("change",{bubbles:!0}));},[e,t,r])});var No=({previews:e,onRemove:t})=>{let[r,n]=useState(0),o=()=>n(a=>a===0?e?.length-1:a-1),i=()=>n(a=>a===e?.length-1?0:a+1);return jsxs("div",{className:"relative w-full h-56 rounded-lg overflow-hidden bg-black/5",children:[jsx("img",{src:e[r]?.url,alt:e[r]?.file?.name,className:"w-full h-full object-cover"}),e.length>1&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:o,className:"absolute left-2 top-1/2 -translate-y-1/2 bg-black/50 text-white px-2 py-1 rounded",children:"\u2039"}),jsx("button",{type:"button",onClick:i,className:"absolute right-2 top-1/2 -translate-y-1/2 bg-black/50 text-white px-2 py-1 rounded",children:"\u203A"})]}),jsx("button",{type:"button",onClick:()=>t(r),className:"absolute top-2 right-2 bg-red-500 text-white rounded px-2 py-1",children:"\u2715"})]})},Sr=No;var Hr=forwardRef(({label:e,required:t,accept:r,renderFiles:n,preview:o=!1,multiple:i=!1,maxSize:a=10,disabled:l=!1,error:s=!1,helperText:p,className:d,name:c,onChange:u,onBlur:m,...L},y)=>{let b=useId(),[h,M]=useState([]),R=1024*1024,F=V=>V.filter(J=>(!a||J.size<=a*R)&&(!r||J.type.match(r))),{inputRef:I,isDragOver:A,handleDrop:S,handleDragOver:B,handleDragLeave:P}=Er({files:h,setFiles:M,multiple:i,filterFiles:F}),{removeFile:T}=Fr({files:h,setFiles:M,inputRef:I}),f=V=>{I.current=V,typeof y=="function"?y(V):y&&(y.current=V);},g=V=>{let J=Array.from(V.target.files??[]);if(!J.length)return;let te=F(J);M(i?te:te.slice(0,1)),u?.(V);},N=useMemo(()=>!o||!h||!h.length?[]:h.filter(V=>V.type.startsWith("image/")).map(V=>({file:V,url:URL.createObjectURL(V)})),[h,o]);useEffect(()=>()=>N.forEach(V=>URL.revokeObjectURL(V.url)),[N]);let E=o&&N.length>0;return jsx(v,{children:jsxs("div",{className:`space-y-2 ${d}`,children:[e&&jsx(D,{htmlFor:b,required:t,children:e}),jsxs("div",{onDrop:S,onDragOver:B,onDragLeave:P,onClick:()=>{!l&&!E&&I.current?.click();},className:`
|
|
39
|
+
`}),jsx(yr,{width:16,height:16,className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground pointer-events-none"})]}),v&&jsx("div",{className:"absolute z-50 mt-1 bg-popover border border-border rounded-md shadow-lg p-4 min-w-70",children:Ce()})]}),m&&jsx(G,{children:m}),!m&&u&&jsx(O,{children:u})]})})});Sr.displayName="DatePicker";var qc=Sr;var Ue=({size:e="md",variant:t="default",color:r="primary",className:n="",speed:o="normal",text:i,textPosition:a="bottom",overlay:l=!1,progress:s})=>{let[m,u]=useState(s||0);useEffect(()=>{s!==void 0&&u(Math.min(Math.max(s,0),100));},[s]);let c=()=>{switch(e){case"xs":return "w-3 h-3";case"sm":return "w-4 h-4";case"lg":return "w-8 h-8";case"xl":return "w-12 h-12";case"xxl":return "w-16 h-16";default:return "w-6 h-6"}},d=()=>{switch(r){case"secondary":return "text-gray-500 dark:text-gray-400";case"muted":return "text-gray-400 dark:text-gray-500";case"success":return "text-green-600 dark:text-green-400";case"danger":return "text-red-600 dark:text-red-400";case"warning":return "text-yellow-600 dark:text-yellow-400";case"info":return "text-blue-400 dark:text-blue-300";case"white":return "text-white dark:text-gray-200";default:return "text-blue-600 dark:text-blue-400"}},p=()=>{switch(o){case"slow":return "animate-[spin_2s_linear_infinite]";case"fast":return "animate-[spin_0.5s_linear_infinite]";default:return "animate-spin"}},w=()=>{switch(o){case"slow":return "animate-pulseSlow";case"fast":return "animate-pulseFast";default:return "animate-pulse"}},y=()=>{switch(o){case"slow":return "animate-bounceSlow";case"fast":return "animate-bounceFast";default:return "animate-bounce"}},b=()=>{switch(e){case"xs":return "w-1 h-1";case"sm":return "w-1.5 h-1.5";case"lg":return "w-3 h-3";case"xl":return "w-4 h-4";case"xxl":return "w-5 h-5";default:return "w-2 h-2"}},v=()=>{switch(e){case"xs":return "w-0.5 h-3";case"sm":return "w-0.5 h-4";case"lg":return "w-1 h-8";case"xl":return "w-1.5 h-12";case"xxl":return "w-2 h-16";default:return "w-1 h-6"}},E=()=>{switch(e){case"xs":return "w-0.5";case"sm":return "w-1";case"lg":return "w-1.5";case"xl":return "w-2";case"xxl":return "w-2.5";default:return "w-1"}},D=()=>{switch(e){case"xs":return "w-1 h-1";case"sm":return "w-1.5 h-1.5";case"lg":return "w-2 h-2";case"xl":return "w-3 h-3";case"xxl":return "w-4 h-4";default:return "w-1.5 h-1.5"}},V=()=>t==="dots"?jsx("div",{className:"flex space-x-1",children:[0,1,2].map(S=>jsx("div",{className:`${b()} ${d()} bg-current rounded-full ${w()}`,style:{animationDelay:`${S*.2}s`}},S))}):t==="bars"?jsx("div",{className:"flex items-end space-x-1",children:[0,1,2,3].map(S=>jsx("div",{className:`${v()} ${d()} bg-current ${w()}`,style:{animationDelay:`${S*.15}s`}},S))}):t==="ring"?jsx("div",{className:c(),children:jsx("div",{className:`w-full h-full border-2 border-gray-200 dark:border-gray-700 border-t-current rounded-full ${p()} ${d()}`})}):t==="pulse"?jsx("div",{className:`${c()} ${d()}`,children:jsx("div",{className:`w-full h-full bg-current rounded-full ${w()}`})}):t==="wave"?jsx("div",{className:"flex items-end space-x-1",children:[0,1,2,3,4].map(S=>jsx("div",{className:`${E()} ${d()} bg-current rounded animate-wave`,style:{animationDelay:`${S*.15}s`,height:e==="xs"?"8px":e==="sm"?"10px":e==="lg"?"16px":e==="xl"?"20px":e==="xxl"?"24px":"12px"}},S))}):t==="bounce"?jsx("div",{className:"flex space-x-1",children:[0,1,2].map(S=>jsx("div",{className:`${b()} ${d()} bg-current rounded-full ${y()}`,style:{animationDelay:`${S*.2}s`}},S))}):t==="grid"?jsx("div",{className:`${c()} ${d()} grid grid-cols-3 gap-0.5`,children:[...Array(9)].map((S,k)=>jsx("div",{className:`${D()} bg-current rounded-full ${w()}`,style:{animationDelay:`${k*.1}s`}},k))}):t==="clock"?jsxs("div",{className:`${c()} relative ${d()}`,children:[jsx("div",{className:"w-full h-full border-2 border-current rounded-full"}),jsx("div",{className:"absolute top-1/2 left-1/2 w-1/2 h-0.5 bg-current origin-left -translate-y-1/2 animate-clock"}),jsx("div",{className:"absolute top-1/2 left-1/2 w-2/5 h-0.5 bg-current origin-left -translate-y-1/2 animate-clock",style:{animationDelay:"-4s"}})]}):t==="orbit"?jsxs("div",{className:`${c()} relative`,children:[jsx("div",{className:`w-full h-full border-2 border-gray-200 dark:border-gray-700 rounded-full ${d()}`}),jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2",children:jsx("div",{className:`${b()} ${d()} bg-current rounded-full animate-orbit`})})]}):t==="cube"?jsxs("div",{className:`${c()} ${d()} relative transform-style-3d animate-rotateCube`,children:[jsx("div",{className:"absolute w-full h-full bg-current opacity-25"}),jsx("div",{className:"absolute w-full h-full bg-current opacity-25 transform-rotateY(90deg)"}),jsx("div",{className:"absolute w-full h-full bg-current opacity-25 transform-rotateX(90deg)"})]}):t==="circle-dots"?jsx("div",{className:`${c()} relative ${d()}`,children:[...Array(8)].map((S,k)=>jsx("div",{className:"absolute w-full h-full animate-circleDots",style:{transform:`rotate(${k*45}deg)`},children:jsx("div",{className:`${b()} bg-current rounded-full absolute top-0 left-1/2 -translate-x-1/2 animate-fadePulse`,style:{animationDelay:`${k*.1}s`}})},k))}):t==="infinity"?jsx("div",{className:`${c()} ${d()}`,children:jsxs("svg",{viewBox:"0 0 120 30",className:"w-full h-full",children:[jsx("circle",{cx:"15",cy:"15",r:"12",className:"animate-infinity1"}),jsx("circle",{cx:"60",cy:"15",r:"12",className:"animate-infinity2"}),jsx("circle",{cx:"105",cy:"15",r:"12",className:"animate-infinity3"})]})}):t==="progress"?jsxs("div",{className:`${c()} relative ${d()}`,children:[jsxs("svg",{className:"w-full h-full",viewBox:"0 0 36 36",children:[jsx("path",{className:"text-gray-200 dark:text-gray-700",stroke:"currentColor",strokeWidth:"3",fill:"transparent",d:`M18 2.0845\r
|
|
40
|
+
a 15.9155 15.9155 0 0 1 0 31.831\r
|
|
41
|
+
a 15.9155 15.9155 0 0 1 0 -31.831`}),jsx("path",{className:"transition-all duration-300",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",fill:"transparent",strokeDasharray:"100, 100",strokeDashoffset:100-m,d:`M18 2.0845\r
|
|
42
|
+
a 15.9155 15.9155 0 0 1 0 31.831\r
|
|
43
|
+
a 15.9155 15.9155 0 0 1 0 -31.831`})]}),e!=="xs"&&e!=="sm"&&jsxs("div",{className:"absolute inset-0 flex items-center justify-center text-xs font-medium",children:[m,"%"]})]}):jsx("div",{className:c(),children:jsxs("svg",{className:`${p()} ${d()}`,fill:"none",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"m4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})}),P=()=>{switch(a){case"top":return "flex-col-reverse";case"left":return "flex-row-reverse";case"right":return "flex-row";default:return "flex-col"}},$=()=>{switch(e){case"xs":case"sm":return "text-xs";case"lg":return "text-base";case"xl":case"xxl":return "text-lg";default:return "text-sm"}},I=jsx(f,{children:jsxs("div",{className:`inline-flex ${i?`items-center ${P()} space-y-1 space-x-0 ${a==="left"||a==="right"?"space-y-0 space-x-2":""}`:""}`,children:[V(),i&&jsx("span",{className:`${$()} text-gray-500 dark:text-gray-400`,children:i})]})});return l?jsx("div",{className:"fixed inset-0 bg-white/80 dark:bg-gray-900/80 backdrop-blur-sm flex items-center justify-center z-50",children:I}):jsx("div",{className:n,children:I})};Ue.displayName="Spinner";var Vr=Ue,Ir=({text:e="Carregando...",size:t="md",variant:r="default",color:n="primary",className:o="",textPosition:i="right"})=>jsx(f,{children:jsx("div",{className:o,children:jsx(Ue,{size:t,variant:r,color:n,text:e,textPosition:i})})});Ir.displayName="LoadingSpinner";var Jc=Ir,Hr=({isVisible:e,text:t="Carregando...",variant:r="default",size:n="lg",className:o=""})=>e?jsx(f,{children:jsx("div",{className:`fixed inset-0 bg-white/80 dark:bg-gray-900/80 backdrop-blur-sm flex items-center justify-center z-50 ${o}`,children:jsxs("div",{className:"flex flex-col items-center space-y-4",children:[jsx(Ue,{size:n,variant:r}),jsx("p",{className:"text-gray-500 dark:text-gray-400",children:t})]})})}):null;Hr.displayName="LoadingOverlay";var jc=Hr,$r=({size:e="sm",color:t="primary"})=>jsx(f,{children:jsx("div",{className:`${(()=>{switch(e){case"xs":return "w-3 h-3";case"md":return "w-5 h-5";default:return "w-4 h-4"}})()} ${t==="white"?"text-white":"text-current"}`,children:jsxs("svg",{className:"animate-spin",fill:"none",viewBox:"0 0 24 24",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"m4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]})})});$r.displayName="ButtonSpinner";var Zc=$r,Ar=({lines:e=3,className:t=""})=>jsx(f,{children:jsx("div",{className:`space-y-3 ${t}`,children:[...Array(e)].map((r,n)=>jsx("div",{className:"h-4 bg-gray-200 dark:bg-gray-700 rounded animate-pulse",style:{width:n===e-1?"60%":"100%"}},n))})});Ar.displayName="ContentLoader";var Qc=Ar,Br=({width:e="100%",height:t="1rem",circle:r=!1,className:n=""})=>jsx(f,{children:jsx("div",{className:`bg-gray-200 dark:bg-gray-700 animate-pulse ${r?"rounded-full":"rounded"} ${n}`,style:{width:e,height:t}})});Br.displayName="Skeleton";var ed=Br;var Or=({children:e,type:t,className:r,overrideClassName:n=!1})=>{if(e)switch(t){case"loading":return jsxs("p",{className:n?r:g("text-sm text-muted-foreground flex items-center gap-2",r),children:[jsx(Vr,{size:"xs"}),e]});case"error":return jsx("p",{className:n?r:g("text-sm text-red-600 dark:text-red-400",r),children:e});case"warning":return jsx("p",{className:n?r:g("text-sm text-yellow-600 dark:text-yellow-400",r),children:e});case"success":return jsx("p",{className:n?r:g("text-sm text-green-600 dark:text-green-400",r),children:e});case"info":return jsx("p",{className:n?r:g("text-sm text-blue-600 dark:text-blue-400",r),children:e});case"helper":return jsx("p",{className:n?r:g("text-sm text-muted-foreground",r),children:e});default:return null}};Or.displayName="FieldFeedback";var We=Or;var Uo=({children:e,before:t,after:r,className:n})=>{let i=zo("flex justify-center items-center",{"rounded-l-lg":t,"rounded-r-lg":r},n);return jsx("div",{className:i,children:jsx("span",{children:e})})},ut=Uo;var Wo=({children:e})=>jsx("div",{className:"absolute px-2",children:jsx("span",{children:e})}),Ur=Wo;var qo=({children:e})=>jsx("div",{className:"absolute right-0 px-2",children:jsx("span",{children:e})}),qr=qo;function Yr(e){e.currentTarget.maxLength=9;let t=e.currentTarget.value;return t=t.replace(/\D/g,""),t=t.replace(/^(\d{5})(\d)/,"$1-$2"),e.currentTarget.value=t,e}function Kr(e){let t=e.currentTarget.value;t=t.replace(/\D/g,""),t=t.padStart(3,"0");let r=t.slice(0,-2),n=t.slice(-2),a=`${(r.replace(/^0+/,"")||"0").replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1.")},${n}`;return e.currentTarget.value=a,e}function _r(e){e.currentTarget.maxLength=14;let t=e.currentTarget.value;return t.match(/^(\d{3}).(\d{3}).(\d{3})-(\d{2})$/)||(t=t.replace(/\D/g,""),t=t.replace(/(\d{3})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d{2})$/,"$1-$2"),e.currentTarget.value=t),e}function Xr(e){e.currentTarget.maxLength=15;let t=e.currentTarget.value.replace(/\D/g,"");return t=t.replace(/(\d{2})(\d)/,"($1) $2"),t=t.replace(/(\d{5})(\d)/,"$1-$2"),e.currentTarget.value=t,e}function Jr(e){e.currentTarget.maxLength=14;let t=e.currentTarget.value.replace(/\D/g,"");return t=t.replace(/(\d{2})(\d)/,"($1) $2"),t=t.replace(/(\d{4})(\d)/,"$1-$2"),e.currentTarget.value=t,e}function jr(e){let t=e.currentTarget.value.replace(/\D/g,"");return t.length<=11?(e.currentTarget.maxLength=14,t=t.replace(/(\d{3})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d{2})$/,"$1-$2")):(e.currentTarget.maxLength=18,t=t.replace(/(\d{2})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d)/,"$1/$2"),t=t.replace(/(\d{4})(\d{2})$/,"$1-$2")),e.currentTarget.value=t,e}function Zr(e){e.currentTarget.maxLength=12;let t=e.currentTarget.value.replace(/\D/g,"");return t=t.replace(/(\d{2})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d{1})$/,"$1-$2"),e.currentTarget.value=t,e}function Qr(e){e.currentTarget.maxLength=18;let t=e.currentTarget.value.replace(/\D/g,"");return t=t.replace(/(\d{2})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d)/,"$1.$2"),t=t.replace(/(\d{3})(\d)/,"$1/$2"),t=t.replace(/(\d{4})(\d{2})$/,"$1-$2"),e.currentTarget.value=t,e}var Yo=({e,mask:t})=>{switch(t){case"money":return Kr(e);case"mobile":return Xr(e);case"phone":return Jr(e);case"cpfCnpj":return jr(e);case"cpf":return _r(e);case"rg":return Zr(e);case"cnpj":return Qr(e);case"cep":return Yr(e);default:return e}},en=Yo;var Xo=({mask:e,initialValue:t=""})=>{let[r,n]=useState(t);useEffect(()=>{t!==r&&n(t);},[t]);let o=useCallback(a=>{let s=en({e:a,mask:e})?.currentTarget?.value??a.currentTarget.value;n(s);},[e]),i=useCallback(()=>n(""),[]);return {value:r,setValue:n,handleChange:o,handleClear:i}},rn=Xo;var nn=forwardRef(({label:e,required:t=!1,mask:r,name:n,prefix:o,suffix:i,addonBefore:a,addonBeforeClassName:l,addonAfter:s,addonAfterClassName:m,ClearEnabled:u=!0,className:c,overrideClassName:d=!1,error:p,helperText:w,value:y=void 0,onChange:b,...v},E)=>{let D=useId(),{handleChange:V,handleClear:P,setValue:$}=rn({mask:r,initialValue:y}),I=g("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50",p&&"border-destructive focus-visible:ring-destructive",!o&&!i&&"px-3",o&&!i&&"pl-10 pr-3",i&&!o&&"pl-3 pr-10",o&&i&&"pl-10 pr-10",a&&"rounded-l-none border-l-0",s&&"rounded-r-none border-r-0",c),S=N=>{V(N),b?.(N);},k=()=>{P(),$(""),b?.({target:{name:n||"",value:""}});};return jsx(f,{children:jsxs("div",{className:"flex flex-col w-full gap-2",children:[e&&jsx(F,{htmlFor:D,required:t,children:e}),jsxs("div",{className:"relative flex",children:[a&&jsx(ut,{before:!0,className:l,children:a}),jsxs("div",{className:"relative flex items-center w-full",children:[o&&jsx(Ur,{children:o}),jsx("input",{id:D,ref:E,name:n,onChange:S,className:d?c:I,...v}),u&&y&&jsx(Ge,{onClick:k,width:12,height:12,className:g("absolute right-2 cursor-pointer",i&&"right-8")}),i&&jsx(qr,{children:i})]}),s&&jsx(ut,{after:!0,className:m,children:s})]}),p&&jsx(G,{children:p}),!p&&w&&jsx(O,{children:w})]})})});nn.displayName="Input";var Ed=nn;var an=forwardRef(({length:e=6,groupBy:t,value:r,name:n,label:o,required:i=!1,helperText:a,error:l,onChange:s,onBlur:m,className:u,charType:c="numeric",customPattern:d,caseMode:p="none",...w},y)=>{let b=useId(),v=useRef([]),E=x=>{switch(p){case"upper":return x.toUpperCase();case"lower":case"visual-upper":return x.toLowerCase();case"visual-lower":return x.toUpperCase();default:return x}},D=x=>{if(!x)return "";let h=x.slice(0,1);switch(h=E(h),c){case"numeric":return /\d/.test(h)?h:"";case"alpha":return /[A-Za-z]/.test(h)?h:"";case"alphanumeric":return /[A-Za-z0-9]/.test(h)?h:"";case"custom":return d?.test(h)?h:"";default:return h}},V=()=>(r!=null?String(r):"").split("").map(D).slice(0,e),P=V().concat(Array(e).fill(" ")).slice(0,e),$=x=>{let h=x.split("").map(D).join("").slice(0,e),M=h===""?void 0:typeof r=="number"?Number(h):h;s?.({target:{name:n,value:M}});},I=(x,h)=>{let M=D(h),H=V();if(M===""){H[x]="",$(H.join(""));return}if(h.length>1){let A=h.split("").map(D).join("").slice(0,e);$(A),v.current[Math.min(A.length-1,e-1)]?.focus();return}M&&(H[x]=M,$(H.join("")),x<e-1&&v.current[x+1]?.focus());},S=x=>{let h=V();!h[x]&&x>0?h[x-1]="":h[x]="",$(h.join("")),x>0&&v.current[x-1]?.focus();},k=x=>{x.preventDefault();let M=x.clipboardData.getData("text").split("").map(D).join("").slice(0,e);M&&($(M),v.current[Math.min(M.length-1,e-1)]?.focus());},N=x=>{switch(p){case"upper":case"visual-upper":return x.toUpperCase();case"lower":case"visual-lower":return x.toLowerCase();default:return x}};return jsx(f,{children:jsxs("div",{className:"flex flex-col gap-2 w-full",children:[o&&jsx(F,{htmlFor:b,required:i,children:o}),jsx("div",{className:g("flex gap-3 items-center",l&&"text-red-500",u),...w,children:P.map((x,h)=>{let M=t&&h>0&&h%t===0;return jsxs(qn.Fragment,{children:[M&&jsx("span",{className:"flex items-center justify-center text-xl font-bold select-none",children:"-"}),jsx("input",{id:b,type:"text",maxLength:1,inputMode:c==="numeric"?"numeric":"text",value:N(x).trim(),ref:H=>{v.current[h]=H,h===0&&y&&(typeof y=="function"?y(H):typeof y=="object"&&(y.current=H));},onPaste:k,onChange:H=>I(h,H.target.value),onKeyDown:H=>H.key==="Backspace"&&S(h),onBlur:m,className:g("h-14 w-12 text-center text-2xl rounded-md border border-input bg-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",l&&"border-red-500")})]},h)})}),l&&jsx(G,{children:l}),!l&&a&&jsx(O,{children:a})]})})});an.displayName="OtpInput";var Od=an;var sn=forwardRef(({label:e,required:t,option:r,description:n,icon:o,className:i,overrideClassName:a,helperText:l,error:s,...m},u)=>{let c=useId(),d=g("h-4 w-4 border border-input bg-background text-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",s&&"border-destructive",i);return jsx(f,{children:jsxs("div",{className:"space-y-3",children:[e&&jsx(F,{required:t,children:e}),jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{id:c,type:"radio",className:a?i:d,ref:u,...m}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("span",{children:o&&o}),jsxs("div",{className:"grid gap-1.5 leading-none select-none",children:[r&&jsx(F,{htmlFor:c,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",overrideClassName:!0,children:r}),n&&jsx(F,{id:`${c}-description`,htmlFor:c,className:"text-xs text-muted-foreground",children:n})]})]})]}),s&&jsx(G,{children:s}),!s&&l&&jsx(O,{children:l})]})})});sn.displayName="Radio";var Xd=sn;function ia(e,t){let{label:r,required:n,name:o,labelKey:i,valueKey:a,options:l,alignment:s="vertical",className:m,overrideClassName:u=!1,helperText:c,error:d,typeSet:p="field",value:w,onChange:y,...b}=e,v=useId(),E=useMemo(()=>new Map(l.map(I=>[String(I[a]),I])),[l,a]),D=useMemo(()=>w==null?"":String(p==="field"?w:w[a]),[w,p,a]),V=I=>{if(!y)return;let S;if(p==="field"){let k=E.get(I);if(k)S=k[a];else {let N=Number(I);S=Number.isNaN(N)?I:N;}}else S=E.get(I)??void 0;y({target:{name:o,value:S,type:"radiogroup",checked:!0}});},P=s==="horizontal"?"flex flex-wrap items-center gap-3":"flex flex-col gap-3",$=g("h-4 w-4 rounded-full border border-input bg-background text-primary","focus:ring-2 focus:ring-ring focus:ring-offset-2",d&&"border-destructive");return jsx(f,{children:jsxs("div",{className:g("flex flex-col gap-3",m),children:[r&&jsx(F,{required:n,children:r}),jsx("div",{className:P,children:l.map((I,S)=>{let k=String(I[a]),N=`${v}-${k}-${S}`;return jsxs("div",{className:"flex items-center gap-2",children:[jsx("input",{...b,id:N,ref:t,name:o,type:"radio",checked:D===k,onChange:()=>V(k),className:u?m:$}),jsx(F,{htmlFor:N,children:String(I[i])})]},N)})}),d&&jsx(G,{children:String(d)}),!d&&c&&jsx(O,{children:c})]})})}function sa(){let e=forwardRef(ia);return e.displayName="RadioGroup",e}var la=sa(),iu=la;var ca=["loading","error","warning","success","info","helper"],Ye=e=>{if(!e)return null;let t=ca.find(r=>e[r]);return t?{type:t,message:e[t]}:null};var dn=forwardRef(({label:e,required:t,className:r,showValue:n=!1,min:o=0,max:i=100,step:a=1,value:l,overrideClassName:s,feedback:m,...u},c)=>{let d=useId(),p=(Number(l)-Number(o))/(Number(i)-Number(o))*100,w=Ye(m),y=g("w-full h-2 bg-secondary rounded-lg appearance-none cursor-pointer slider","focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50",r);return jsx(f,{children:jsxs("div",{className:"space-y-2",children:[(e||n)&&jsxs("div",{className:"flex justify-between items-center",children:[e&&jsx(F,{htmlFor:d,required:t,children:e}),n&&jsx("span",{className:"text-sm text-muted-foreground",children:l})]}),jsxs("div",{className:"relative",children:[jsx("input",{type:"range",id:d,ref:c,min:o,max:i,step:a,value:l,className:s?r:y,style:{background:`linear-gradient(to right, hsl(var(--primary)) 0%, hsl(var(--primary)) ${p}%, hsl(var(--secondary)) ${p}%, hsl(var(--secondary)) 100%)`},...u}),w&&jsx(We,{type:w.type,children:w.message})]})]})})});dn.displayName="Range";var vu=dn;var pa=({value:e,defaultValue:t,onChange:r})=>{let[n,o]=useState(t),i=e!==void 0;return [i?e:n??t,s=>{i||o(s),r?.(s);}]},un=pa;var pn=forwardRef(({min:e=0,max:t=100,step:r=1,value:n,defaultValue:o=[e,t],onChange:i,disabled:a,label:l,showValues:s=!0,className:m="",feedback:u,required:c},d)=>{let p=useId(),w=useRef(null),y=useRef(null),b=Ye(u),[v,E]=un({value:n,defaultValue:o,onChange:P=>i?.({target:{value:P}})}),D=P=>(P-e)/(t-e)*100,V=useCallback(P=>{if(!w.current||!y.current||a)return;let $=w.current.getBoundingClientRect(),I=Math.min(100,Math.max(0,(P-$.left)/$.width*100)),S=e+I/100*(t-e),k=Math.round(S/r)*r,N=[...v];y.current==="min"?N[0]=Math.min(k,v[1]):N[1]=Math.max(k,v[0]),E(N);},[v,e,t,r,E,a]);return useEffect(()=>{let P=I=>V(I.clientX),$=()=>y.current=null;return document.addEventListener("mousemove",P),document.addEventListener("mouseup",$),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",$);}},[V]),jsx(f,{children:jsxs("div",{ref:d,className:`space-y-2 ${m}`,children:[l&&jsxs("div",{className:"flex justify-between",children:[jsx(F,{htmlFor:p,required:c,children:l}),s&&jsxs("span",{className:"text-sm text-muted-foreground",children:[v[0]," \u2013 ",v[1]]})]}),jsxs("div",{ref:w,className:"relative h-2 bg-secondary rounded-full",children:[jsx("div",{className:"absolute h-2 bg-primary rounded-full",style:{left:`${D(v[0])}%`,width:`${D(v[1])-D(v[0])}%`}}),["min","max"].map(P=>jsx("div",{onMouseDown:()=>y.current=P,className:`absolute w-5 h-5 bg-background border-2 border-primary rounded-full\r
|
|
44
|
+
top-1/2 -translate-y-1/2 -translate-x-1/2 cursor-pointer`,style:{left:`${D(P==="min"?v[0]:v[1])}%`}},P))]}),b&&jsx(We,{type:b.type,children:b.message})]})})});pn.displayName="RangeSlider";var Ru=pn;function ya({label:e,required:t=!1,options:r,labelKey:n,valueKey:o,placeholder:i,error:a,helperText:l,className:s,...m},u){let c=useId(),d=g("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:cursor-not-allowed disabled:opacity-50",a&&"border-red-500 focus-visible:ring-red-500",s);return jsx(f,{children:jsxs("div",{className:"space-y-2",children:[e&&jsx(F,{htmlFor:c,required:t,children:e}),jsxs("select",{id:c,ref:u,className:d,...m,children:[i&&jsx("option",{value:"",disabled:!0,children:i}),r.map((p,w)=>jsx("option",{value:String(p[o]),children:String(p[n])},w))]}),a&&jsx(G,{children:a}),!a&&l&&jsx(O,{children:l})]})})}function wa(){let e=forwardRef(ya);return e.displayName="Select",e}var Ca=wa(),Bu=Ca;var gn=forwardRef(({label:e,required:t,option:r,description:n,icon:o,checked:i=!1,className:a,overrideClassName:l,error:s,name:m,...u},c)=>{let d=useId();return jsx(f,{children:jsxs("div",{className:"flex flex-col gap-2",children:[e&&jsx(F,{required:t,children:e}),jsxs("div",{className:"flex items-center space-x-2",children:[jsx("input",{type:"checkbox",id:d,name:m,checked:i,className:"peer sr-only",ref:c,...u}),jsx("label",{htmlFor:d,className:g("relative flex items-center h-6 w-11 cursor-pointer rounded-full bg-input transition-colors duration-200","peer-checked:bg-primary peer-focus:ring-2 peer-focus:ring-ring peer-focus:ring-offset-2 peer-focus:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50",a),children:jsx("span",{className:g("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform",i?"translate-x-5":"translate-x-1")})}),jsx("span",{children:o&&o}),(r||n)&&jsxs("div",{className:"grid gap-1.5 leading-none select-none",children:[e&&jsx(F,{id:`${d}-label`,htmlFor:d,className:"text-sm font-medium leading-none",children:r}),n&&jsx(F,{id:`${d}-description`,htmlFor:d,className:"text-xs text-muted-foreground",children:n})]})]})]})})});gn.displayName="Switch";var Ku=gn;var bn=qn.forwardRef(({label:e,required:t,showCount:r,maxLength:n,className:o,overrideClassName:i=!1,error:a,helperText:l,...s},m)=>{let u=useId(),[c,d]=useState(0),p=g("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",a&&"border-red-500 focus-visible:ring-red-500",o);return jsx(f,{children:jsxs("div",{className:"space-y-2",children:[e&&jsx(F,{htmlFor:u,required:t,children:e}),jsxs("div",{className:"relative",children:[jsx("textarea",{id:u,className:i?o:p,maxLength:n,onInput:w=>d(w.currentTarget.textLength),ref:m,...s}),r&&jsxs("span",{className:"absolute bottom-2 right-3 text-xs text-muted-foreground",children:[c,n?` / ${n}`:""]})]}),a&&jsx(G,{children:a}),!a&&l&&jsx(O,{children:l})]})})});bn.displayName="TextArea";var rm=bn;var xn=createContext(void 0),lm=()=>{let e=useContext(xn);if(!e)throw new Error("useToast must be used within a ToastProvider");return e},cm=({children:e})=>jsx(f,{children:jsx(Fa,{children:e})}),Fa=({children:e})=>{let[t,r]=useState([]),n=useCallback(a=>{r(l=>l.filter(s=>s.id!==a));},[]),o=useCallback(a=>{let l=crypto.randomUUID(),s={...a,id:l};r(m=>[...m,s]),a.duration!==0&&setTimeout(()=>{n(l);},a.duration??5e3);},[n]),i=useMemo(()=>({toasts:t,addToast:o,removeToast:n}),[t,o,n]);return jsxs(xn.Provider,{value:i,children:[e,jsx(Sa,{toasts:t,onRemove:n})]})},Sa=({toasts:e,onRemove:t})=>jsx("div",{className:"fixed top-4 right-4 z-50 flex flex-col gap-2",children:e.map(r=>jsx(hn,{toast:r,onRemove:t},r.id))}),hn=({toast:e,onRemove:t})=>jsx("div",{className:`min-w-80 max-w-md p-4 border rounded-md shadow-lg animate-in slide-in-from-right-full ${{default:"bg-white border-gray-200 text-gray-900 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-100",success:"bg-green-50 border-green-200 text-green-800 dark:bg-green-900/20 dark:border-green-800 dark:text-green-200",warning:"bg-yellow-50 border-yellow-200 text-yellow-800 dark:bg-yellow-900/20 dark:border-yellow-800 dark:text-yellow-200",destructive:"bg-red-50 border-red-200 text-red-800 dark:bg-red-900/20 dark:border-red-800 dark:text-red-200"}[e.variant??"default"]}`,children:jsxs("div",{className:"flex items-start justify-between",children:[jsxs("div",{className:"flex-1",children:[e.title&&jsx("h4",{className:"font-medium mb-1",children:e.title}),jsx("p",{className:"text-sm",children:e.description})]}),jsx("button",{onClick:()=>t(e.id),className:"ml-2 text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200",children:jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})});hn.displayName="ToastItem";var wn=({children:e,content:t,position:r="top",className:n,overrideClassName:o=!1})=>{let i={top:"bottom-full left-1/2 -translate-x-1/2 mb-2",bottom:"top-full left-1/2 -translate-x-1/2 mt-2",left:"right-full top-1/2 -translate-y-1/2 mr-2",right:"left-full top-1/2 -translate-y-1/2 ml-2"},a={top:"top-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-b-transparent border-t-gray-900",bottom:"bottom-full left-1/2 -translate-x-1/2 border-l-transparent border-r-transparent border-t-transparent border-b-gray-900",left:"left-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-r-transparent border-l-gray-900",right:"right-full top-1/2 -translate-y-1/2 border-t-transparent border-b-transparent border-l-transparent border-r-gray-900"};return jsx(f,{children:jsxs("div",{className:"relative inline-block group",children:[jsx("div",{children:e}),jsxs("div",{className:o?n:g("absolute z-50 px-2 py-1 text-xs text-white bg-gray-900 rounded shadow-lg whitespace-nowrap","opacity-0 scale-95 pointer-events-none transition-all duration-150","group-hover:opacity-100 group-hover:scale-100 group-hover:pointer-events-auto","group-focus-within:opacity-100 group-focus-within:scale-100 group-focus-within:pointer-events-auto",i[r],n),children:[t,jsx("div",{className:g("absolute w-0 h-0 border-4",a[r])})]})]})})};wn.displayName="Tooltip";var fm=wn;var Va=({files:e,removeFile:t})=>jsx("div",{className:"space-y-2",children:e?.length>0&&e?.map((r,n)=>jsxs("div",{className:"flex items-center justify-between p-2 bg-secondary rounded",children:[jsxs("div",{children:[jsx("p",{className:"text-sm truncate",children:r.name}),jsxs("p",{className:"text-xs text-muted-foreground",children:[(r?.size/1024).toFixed(1)," KB"]})]}),jsx("button",{type:"button",onClick:o=>{o.stopPropagation(),t(n);},className:"ml-2 p-1 hover:bg-destructive/20 rounded",children:"\u2715"})]},`${r?.name}-${n}`))}),Cn=Va;var Ia=({accept:e,maxSize:t})=>jsxs("div",{className:"space-y-2",children:[jsx("svg",{className:"w-8 h-8 mx-auto text-muted-foreground",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"})}),jsxs("div",{children:[jsx("p",{className:"text-sm text-foreground",children:"Clique para selecionar ou arraste arquivos aqui"}),jsxs("p",{className:"text-xs text-muted-foreground",children:[e&&`Tipos aceitos: ${e}`,t&&` \u2022 Tamanho m\xE1ximo: ${t}MB`]})]})]}),kn=Ia;var Nn=({files:e,setFiles:t,multiple:r=!1,disabled:n=!1,filterFiles:o=i=>i})=>{let i=useRef(null),[a,l]=useState(!1),s=useCallback(d=>{d.preventDefault(),!n&&l(!0);},[n]),m=useCallback(()=>{l(!1);},[]),u=useCallback(d=>{if(d.preventDefault(),n||!i.current)return;l(!1);let p=Array.from(d.dataTransfer.files);if(!r&&!e||!r&&p.length>1)return;let w=o(p),y=r?w:w.slice(0,1);t(y);let b=new DataTransfer;y.forEach(v=>b.items.add(v)),i.current.files=b.files,i.current.dispatchEvent(new Event("change",{bubbles:!0}));},[n,r,e,o]),c=useCallback(()=>{t([]),i.current&&(i.current.value="");},[]);return {files:e,setFiles:t,clearFiles:c,inputRef:i,isDragOver:a,setIsDragOver:l,handleDrop:u,handleDragOver:s,handleDragLeave:m}};var Pn=({files:e,setFiles:t,inputRef:r})=>({removeFile:useCallback(o=>{if(!r.current)return;let i=e?.filter((l,s)=>s!==o);t(i);let a=new DataTransfer;i?.forEach(l=>a.items.add(l)),r.current.files=a.files,r.current.dispatchEvent(new Event("change",{bubbles:!0}));},[e,t,r])});var Oa=({previews:e,onRemove:t})=>{let[r,n]=useState(0),o=()=>n(a=>a===0?e?.length-1:a-1),i=()=>n(a=>a===e?.length-1?0:a+1);return jsxs("div",{className:"relative w-full h-56 rounded-lg overflow-hidden bg-black/5",children:[jsx("img",{src:e[r]?.url,alt:e[r]?.file?.name,className:"w-full h-full object-cover"}),e.length>1&&jsxs(Fragment,{children:[jsx("button",{type:"button",onClick:o,className:"absolute left-2 top-1/2 -translate-y-1/2 bg-black/50 text-white px-2 py-1 rounded",children:"\u2039"}),jsx("button",{type:"button",onClick:i,className:"absolute right-2 top-1/2 -translate-y-1/2 bg-black/50 text-white px-2 py-1 rounded",children:"\u203A"})]}),jsx("button",{type:"button",onClick:()=>t(r),className:"absolute top-2 right-2 bg-red-500 text-white rounded px-2 py-1",children:"\u2715"})]})},Ln=Oa;var Dn=forwardRef(({label:e,required:t,accept:r,renderFiles:n,preview:o=!1,multiple:i=!1,maxSize:a=10,disabled:l=!1,error:s=!1,helperText:m,className:u,name:c,onChange:d,onBlur:p,...w},y)=>{let b=useId(),[v,E]=useState([]),D=1024*1024,V=A=>A.filter(j=>(!a||j.size<=a*D)&&(!r||j.type.match(r))),{inputRef:P,isDragOver:$,handleDrop:I,handleDragOver:S,handleDragLeave:k}=Nn({files:v,setFiles:E,multiple:i,filterFiles:V}),{removeFile:N}=Pn({files:v,setFiles:E,inputRef:P}),x=A=>{P.current=A,typeof y=="function"?y(A):y&&(y.current=A);},h=A=>{let j=Array.from(A.target.files??[]);if(!j.length)return;let re=V(j);E(i?re:re.slice(0,1)),d?.(A);},M=useMemo(()=>!o||!v||!v.length?[]:v.filter(A=>A.type.startsWith("image/")).map(A=>({file:A,url:URL.createObjectURL(A)})),[v,o]);useEffect(()=>()=>M.forEach(A=>URL.revokeObjectURL(A.url)),[M]);let H=o&&M.length>0;return jsx(f,{children:jsxs("div",{className:`space-y-2 ${u}`,children:[e&&jsx(F,{htmlFor:b,required:t,children:e}),jsxs("div",{onDrop:I,onDragOver:S,onDragLeave:k,onClick:()=>{!l&&!H&&P.current?.click();},className:`
|
|
40
45
|
border-2 border-dashed rounded-lg p-6 text-center cursor-pointer
|
|
41
46
|
transition-colors
|
|
42
|
-
${
|
|
47
|
+
${$?"border-primary bg-primary/5":"border-border"}
|
|
43
48
|
${s?"border-red-500":""}
|
|
44
49
|
${l?"opacity-50 cursor-not-allowed":"hover:border-primary"}
|
|
45
|
-
`,children:[jsx("input",{ref:
|
|
50
|
+
`,children:[jsx("input",{ref:x,id:b,name:c,type:"file",accept:r,multiple:i,disabled:l,onChange:h,onBlur:p,className:"hidden",...w}),o&&M.length>0?jsx(Ln,{previews:M,onRemove:N}):jsx(kn,{accept:r,maxSize:a})]}),n?n({files:v,removeFile:N}):v&&v.length>0&&jsx(Cn,{files:v,removeFile:N}),s&&jsx(G,{children:s}),!s&&m&&jsx(O,{children:m})]})})});Dn.displayName="UploadFile";var Om=Dn;
|
|
46
51
|
|
|
47
|
-
export {
|
|
52
|
+
export { pi as AccordionPrimitive, Pi as AlertDescriptionPrimitive, ki as AlertPrimitive, Ni as AlertTitlePrimitive, Es as AvatarPrimitive, Fi as BadgePrimitive, $i as BreadcrumbPrimitive, Ui as ButtonPrimitive, Zc as ButtonSpinnerPrimitive, es as CardContentPrimitive, Qi as CardDescriptionPrimitive, ts as CardFooterPrimitive, ji as CardHeaderPrimitive, Ji as CardPrimitive, Zi as CardTitlePrimitive, cl as CheckBoxGroupPrimitive, Zs as CheckBoxPrimitive, pr as ColorPicker, vl as ColorPickerPrimitive, Yl as ComboBoxPrimitive, Qc as ContentLoaderPrimitive, qc as DatePickerPrimitive, us as DialogContentPrimitive, ms as DialogFooterPrimitive, cs as DialogHeaderPrimitive, ls as DialogPrimitive, ds as DialogTitlePrimitive, ws as DropdownMenuContentPrimitive, Cs as DropdownMenuItemPrimitive, Ns as DropdownMenuLabelPrimitive, hs as DropdownMenuPrimitive, ks as DropdownMenuSeparatorPrimitive, ys as DropdownMenuTriggerPrimitive, We as FieldFeedbackPrimitive, O as HelperFieldPrimitive, Ed as InputPrimitive, F as LabelPrimitive, Vn as LicenseProvider, jc as LoadingOverlayPrimitive, Jc as LoadingSpinnerPrimitive, Od as OtpInputPrimitive, iu as RadioGroupPrimitive, Xd as RadioPrimitive, vu as RangePrimitive, Ru as RangeSliderPrimitive, Bu as SelectPrimitive, ed as SkeletonPrimitive, Vr as SpinnerPrimitive, Ku as SwitchPrimitive, rm as TextAreaPrimitive, cm as ToastProvider, fm as TooltipPrimitive, Om as UploadFilePrimitive, G as ValidateFieldPrimitive, lm as useToast };
|