@schema-forms-data/react 0.3.23 → 4.0.1

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.
Files changed (4) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs +37 -39
  3. package/dist/index.js +22209 -15752
  4. package/package.json +10 -7
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react"),o=require("react/jsx-runtime"),ce=require("react-hook-form"),P=require("lucide-react"),Bo=require("react-dom"),xt=require("@dnd-kit/sortable"),Cr=require("@dnd-kit/utilities"),cr=require("@dnd-kit/core");function Uo(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const h=Uo(E),ct=Uo(P),da=Uo(Bo);var O=(e=>(e.TEXTO="texto",e.TEXTAREA="textarea",e.NUMBER="number",e.EMAIL="email",e.PASSWORD="password",e.TELEFONE="telefone",e.CPF="cpf",e.CEP="cep",e.DATE="date",e.DATETIME="datetime",e.TIME="time",e.DATE_RANGE="date_range",e.SELECT="select",e.AUTOCOMPLETE="autocomplete",e.RADIO="radio",e.CHECKBOX="checkbox",e.CHECKBOX_GROUP="checkbox_group",e.SWITCH="switch",e.SLIDER="slider",e.RATING="rating",e.COLOR="color",e.FILE="file",e.HIDDEN="hidden",e.FIELD_ARRAY="field_array",e.PARTICIPATION_TYPE="participation_type",e.PAYMENT_METHOD="payment_method",e.TERMS="terms",e.SUB_FORM="sub_form",e))(O||{}),vi=(e=>(e.RASCUNHO="rascunho",e.ATIVO="ativo",e.INATIVO="inativo",e))(vi||{}),bi=(e=>(e.CPF="cpf",e.TELEFONE="telefone",e.CEP="cep",e.CUSTOM="custom",e))(bi||{});const ap={texto:"Texto",textarea:"Área de texto",number:"Número",email:"E-mail",password:"Senha",telefone:"Telefone",cpf:"CPF",cep:"CEP",date:"Data",datetime:"Data e hora",time:"Horário",date_range:"Período (data inicial/final)",select:"Seleção",autocomplete:"Autocomplete",radio:"Radio",checkbox:"Checkbox",checkbox_group:"Grupo de checkboxes",switch:"Switch (toggle)",slider:"Slider",rating:"Avaliação (estrelas)",color:"Cor",file:"Arquivo",hidden:"Oculto",field_array:"Lista de itens",participation_type:"Tipo de participação",payment_method:"Forma de pagamento",terms:"Termos e condições",sub_form:"Sub-formulário"},op={texto:"Type",textarea:"AlignLeft",number:"Hash",email:"Mail",password:"Lock",telefone:"Phone",cpf:"CreditCard",cep:"MapPin",date:"Calendar",datetime:"Clock",time:"Timer",date_range:"CalendarRange",select:"ChevronDown",autocomplete:"Search",radio:"CircleDot",checkbox:"CheckSquare",checkbox_group:"ListChecks",switch:"ToggleLeft",slider:"SlidersHorizontal",rating:"Star",color:"Palette",file:"Upload",hidden:"EyeOff",field_array:"List",participation_type:"CalendarDays",payment_method:"Wallet",terms:"ScrollText",sub_form:"LayoutList"},yi=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Fe=yi,ze={primary:"#3b82f6",primaryHover:"#2563eb",accent:"#8b5cf6",background:"hsl(var(--background))",surface:"hsl(var(--card))",text:"hsl(var(--foreground))",textMuted:"hsl(var(--muted-foreground))",border:"hsl(var(--border))",error:"hsl(var(--destructive))"},np={primary:"#f97316",primaryHover:"#ea580c",accent:"#ef4444",background:"#09090b",surface:"rgba(24,24,27,0.9)",text:"#ffffff",textMuted:"#a1a1aa",border:"rgba(249,115,22,0.2)",error:"#f87171"},sp={...ze,primary:"#18181b",primaryHover:"#27272a",accent:"#71717a",border:"#e4e4e7"},ip={...ze,primary:"#1e3a5f",primaryHover:"#162d4a",accent:"#c9a84c"},lp={...ze,primary:"#ec4899",primaryHover:"#db2777",accent:"#8b5cf6",background:"#0f0f1a",text:"#ffffff",textMuted:"#a78bfa"},cp={...ze,primary:"#059669",primaryHover:"#047857",accent:"#6ee7b7"},dp={...ze,primary:"#0ea5e9",primaryHover:"#0284c7",accent:"#38bdf8"},up={...ze,primary:"#6366f1",primaryHover:"#4f46e5",accent:"#818cf8"},pp={...ze,primary:"#d97706",primaryHover:"#b45309",accent:"#fbbf24"},mp={...ze,primary:"#10b981",primaryHover:"#059669",accent:"#34d399"},fp={...ze,primary:"#b45309",primaryHover:"#92400e",accent:"#f59e0b",background:"#0c0c0c",text:"#fafafa",textMuted:"#d4af37"},hp={...ze,primary:"#dc2626",primaryHover:"#b91c1c",accent:"#f97316"},xp={...ze,primary:"#7c3aed",primaryHover:"#6d28d9",accent:"#a78bfa"},gp={primary:"#374151",primaryHover:"#1f2937",accent:"#6b7280",background:"#ffffff",surface:"#f9fafb",text:"#111827",textMuted:"#6b7280",border:"#e5e7eb",error:"#ef4444"},vp={primary:"#16a34a",primaryHover:"#15803d",accent:"#4ade80",background:"#fefce8",surface:"#ffffff",text:"#1c1917",textMuted:"#78716c",border:"#d6d3d1",error:"#dc2626"},bp={primary:"#d4af37",primaryHover:"#b8962e",accent:"#f0d060",background:"#0a0a0f",surface:"rgba(20,20,30,0.95)",text:"#f8f8f0",textMuted:"#9990aa",border:"rgba(212,175,55,0.25)",error:"#f87171"},zt={moderno:{id:"moderno",displayName:"Moderno",colors:{...ze},layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-muted/30"},minimalista:{id:"minimalista",displayName:"Minimalista",colors:sp,layout:{stepNavigation:"wizard",containerStyle:"flat",spacing:"relaxed",roundness:"rounded-lg",showProgressBar:!1,showStepIndicators:!1},wrapperClass:"bg-background"},card:{id:"card",displayName:"Card",colors:{...ze},layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-muted/40"},banner:{id:"banner",displayName:"Banner",colors:{...ze},layout:{stepNavigation:"tabs",containerStyle:"bordered",spacing:"normal",roundness:"rounded-xl",showProgressBar:!1,showStepIndicators:!0},wrapperClass:"bg-background"},acampamento:{id:"acampamento",displayName:"Acampamento",colors:np,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0,stepIndicatorVariant:"icons-labeled",stepIndicatorPosition:"top-center",stepIndicatorOrientation:"horizontal",eventTitleStyle:"inline"},typography:{fontFamily:"font-sans",stepTitleClass:"text-2xl font-bold text-white",stepDescClass:"text-sm text-zinc-400",labelClass:"font-medium text-zinc-200"},wrapperClass:"bg-[#09090b]"},acampamento_imersivo:{id:"acampamento_imersivo",displayName:"Acampamento Imersivo",colors:{primary:"#f97316",primaryHover:"#ea580c",accent:"#fb923c",background:"#09090b",surface:"rgba(20,20,22,0.85)",text:"#ffffff",textMuted:"#a1a1aa",border:"rgba(249,115,22,0.25)",error:"#f87171"},layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0,stepIndicatorVariant:"icons-labeled",stepIndicatorPosition:"top-center",stepIndicatorOrientation:"horizontal",eventTitleStyle:"inline"},typography:{fontFamily:"font-sans",stepTitleClass:"text-2xl font-bold text-white",stepDescClass:"text-sm text-zinc-400",labelClass:"font-medium text-zinc-200"},wrapperClass:"bg-[#09090b]"},corporativo:{id:"corporativo",displayName:"Corporativo",colors:ip,layout:{stepNavigation:"wizard",containerStyle:"bordered",spacing:"normal",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-slate-50 dark:bg-slate-950"},festival:{id:"festival",displayName:"Festival",colors:lp,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-[#0f0f1a]"},webinar:{id:"webinar",displayName:"Webinar",colors:dp,layout:{stepNavigation:"tabs",containerStyle:"card",spacing:"compact",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},retiro:{id:"retiro",displayName:"Retiro",colors:cp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-emerald-50 dark:bg-emerald-950/20"},conferencia:{id:"conferencia",displayName:"Conferência",colors:up,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},social:{id:"social",displayName:"Social",colors:mp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},workshop:{id:"workshop",displayName:"Workshop",colors:pp,layout:{stepNavigation:"vertical",containerStyle:"bordered",spacing:"compact",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0,stepIndicatorVariant:"icons-labeled",stepIndicatorOrientation:"vertical",eventTitleStyle:"bar"},wrapperClass:"bg-amber-50 dark:bg-amber-950/10"},gala:{id:"gala",displayName:"Gala",colors:fp,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-[#0c0c0c]"},acao:{id:"acao",displayName:"Ação",colors:hp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"compact",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},podcast:{id:"podcast",displayName:"Podcast",colors:xp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!1,showStepIndicators:!0},wrapperClass:"bg-background"},classico:{id:"classico",displayName:"Clássico",colors:gp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-white dark:bg-background"},comunitario:{id:"comunitario",displayName:"Comunitário",colors:vp,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-yellow-50 dark:bg-background"},noturno:{id:"noturno",displayName:"Noturno",colors:bp,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},typography:{fontFamily:"font-sans",stepTitleClass:"text-2xl font-bold text-[#f8f8f0]",stepDescClass:"text-sm text-[#9990aa]",labelClass:"font-medium text-[#d4d4c8]"},wrapperClass:"bg-[#0a0a0f]"}},ua=e=>e&&e in zt?zt[e]:zt.moderno,yp=()=>Object.values(zt),wp=e=>e.layout.containerStyle==="glassmorphism",wi=e=>e.colors.background.startsWith("#0")||e.colors.background.startsWith("rgba(0")||e.colors.text==="#ffffff";var go={exports:{}},xr={};/**
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react"),a=require("react/jsx-runtime"),Se=require("react-hook-form"),O=require("lucide-react"),vs=require("react-dom"),Pt=require("@dnd-kit/sortable"),va=require("@dnd-kit/utilities"),Rt=require("@dnd-kit/core");function bs(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const x=bs(k),wt=bs(O),bo=bs(vs);var _=(e=>(e.TEXTO="texto",e.TEXTAREA="textarea",e.NUMBER="number",e.EMAIL="email",e.PASSWORD="password",e.TELEFONE="telefone",e.CPF="cpf",e.CEP="cep",e.DATE="date",e.DATETIME="datetime",e.TIME="time",e.DATE_RANGE="date_range",e.SELECT="select",e.AUTOCOMPLETE="autocomplete",e.RADIO="radio",e.CHECKBOX="checkbox",e.CHECKBOX_GROUP="checkbox_group",e.SWITCH="switch",e.SLIDER="slider",e.RATING="rating",e.COLOR="color",e.FILE="file",e.HIDDEN="hidden",e.FIELD_ARRAY="field_array",e.PARTICIPATION_TYPE="participation_type",e.PAYMENT_METHOD="payment_method",e.TERMS="terms",e.SUB_FORM="sub_form",e))(_||{}),ys=(e=>(e.RASCUNHO="rascunho",e.ATIVO="ativo",e.INATIVO="inativo",e))(ys||{}),ic=(e=>(e.CPF="cpf",e.TELEFONE="telefone",e.CEP="cep",e.CUSTOM="custom",e))(ic||{});const Pf={texto:"Texto",textarea:"Área de texto",number:"Número",email:"E-mail",password:"Senha",telefone:"Telefone",cpf:"CPF",cep:"CEP",date:"Data",datetime:"Data e hora",time:"Horário",date_range:"Período (data inicial/final)",select:"Seleção",autocomplete:"Autocomplete",radio:"Radio",checkbox:"Checkbox",checkbox_group:"Grupo de checkboxes",switch:"Switch (toggle)",slider:"Slider",rating:"Avaliação (estrelas)",color:"Cor",file:"Arquivo",hidden:"Oculto",field_array:"Lista de itens",participation_type:"Tipo de participação",payment_method:"Forma de pagamento",terms:"Termos e condições",sub_form:"Sub-formulário"},Of={texto:"Type",textarea:"AlignLeft",number:"Hash",email:"Mail",password:"Lock",telefone:"Phone",cpf:"CreditCard",cep:"MapPin",date:"Calendar",datetime:"Clock",time:"Timer",date_range:"CalendarRange",select:"ChevronDown",autocomplete:"Search",radio:"CircleDot",checkbox:"CheckSquare",checkbox_group:"ListChecks",switch:"ToggleLeft",slider:"SlidersHorizontal",rating:"Star",color:"Palette",file:"Upload",hidden:"EyeOff",field_array:"List",participation_type:"CalendarDays",payment_method:"Wallet",terms:"ScrollText",sub_form:"LayoutList"},cc=()=>{if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function"){const e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e).map(r=>r.toString(16).padStart(2,"0")).join("");return`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})},pt=cc,ut={primary:"#3b82f6",primaryHover:"#2563eb",accent:"#8b5cf6",background:"hsl(var(--background))",surface:"hsl(var(--card))",text:"hsl(var(--foreground))",textMuted:"hsl(var(--muted-foreground))",border:"hsl(var(--border))",error:"hsl(var(--destructive))"},If={primary:"#f97316",primaryHover:"#ea580c",accent:"#ef4444",background:"#09090b",surface:"rgba(24,24,27,0.9)",text:"#ffffff",textMuted:"#a1a1aa",border:"rgba(249,115,22,0.2)",error:"#f87171"},Ff={...ut,primary:"#18181b",primaryHover:"#27272a",accent:"#71717a",border:"#e4e4e7"},Lf={...ut,primary:"#1e3a5f",primaryHover:"#162d4a",accent:"#c9a84c"},Mf={...ut,primary:"#ec4899",primaryHover:"#db2777",accent:"#8b5cf6",background:"#0f0f1a",text:"#ffffff",textMuted:"#a78bfa"},Vf={...ut,primary:"#059669",primaryHover:"#047857",accent:"#6ee7b7"},zf={...ut,primary:"#0ea5e9",primaryHover:"#0284c7",accent:"#38bdf8"},Bf={...ut,primary:"#6366f1",primaryHover:"#4f46e5",accent:"#818cf8"},Uf={...ut,primary:"#d97706",primaryHover:"#b45309",accent:"#fbbf24"},Hf={...ut,primary:"#10b981",primaryHover:"#059669",accent:"#34d399"},Wf={...ut,primary:"#b45309",primaryHover:"#92400e",accent:"#f59e0b",background:"#0c0c0c",text:"#fafafa",textMuted:"#d4af37"},qf={...ut,primary:"#dc2626",primaryHover:"#b91c1c",accent:"#f97316"},Xf={...ut,primary:"#7c3aed",primaryHover:"#6d28d9",accent:"#a78bfa"},Gf={primary:"#374151",primaryHover:"#1f2937",accent:"#6b7280",background:"#ffffff",surface:"#f9fafb",text:"#111827",textMuted:"#6b7280",border:"#e5e7eb",error:"#ef4444"},Kf={primary:"#16a34a",primaryHover:"#15803d",accent:"#4ade80",background:"#fefce8",surface:"#ffffff",text:"#1c1917",textMuted:"#78716c",border:"#d6d3d1",error:"#dc2626"},Yf={primary:"#d4af37",primaryHover:"#b8962e",accent:"#f0d060",background:"#0a0a0f",surface:"rgba(20,20,30,0.95)",text:"#f8f8f0",textMuted:"#9990aa",border:"rgba(212,175,55,0.25)",error:"#f87171"},Cr={moderno:{id:"moderno",displayName:"Moderno",colors:{...ut},layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-muted/30"},minimalista:{id:"minimalista",displayName:"Minimalista",colors:Ff,layout:{stepNavigation:"wizard",containerStyle:"flat",spacing:"relaxed",roundness:"rounded-lg",showProgressBar:!1,showStepIndicators:!1},wrapperClass:"bg-background"},card:{id:"card",displayName:"Card",colors:{...ut},layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-muted/40"},banner:{id:"banner",displayName:"Banner",colors:{...ut},layout:{stepNavigation:"tabs",containerStyle:"bordered",spacing:"normal",roundness:"rounded-xl",showProgressBar:!1,showStepIndicators:!0},wrapperClass:"bg-background"},acampamento:{id:"acampamento",displayName:"Acampamento",colors:If,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0,stepIndicatorVariant:"icons-labeled",stepIndicatorPosition:"top-center",stepIndicatorOrientation:"horizontal",eventTitleStyle:"inline"},typography:{fontFamily:"font-sans",stepTitleClass:"text-2xl font-bold text-white",stepDescClass:"text-sm text-zinc-400",labelClass:"font-medium text-zinc-200"},wrapperClass:"bg-[#09090b]"},acampamento_imersivo:{id:"acampamento_imersivo",displayName:"Acampamento Imersivo",colors:{primary:"#f97316",primaryHover:"#ea580c",accent:"#fb923c",background:"#09090b",surface:"rgba(20,20,22,0.85)",text:"#ffffff",textMuted:"#a1a1aa",border:"rgba(249,115,22,0.25)",error:"#f87171"},layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"normal",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0,stepIndicatorVariant:"icons-labeled",stepIndicatorPosition:"top-center",stepIndicatorOrientation:"horizontal",eventTitleStyle:"inline"},typography:{fontFamily:"font-sans",stepTitleClass:"text-2xl font-bold text-white",stepDescClass:"text-sm text-zinc-400",labelClass:"font-medium text-zinc-200"},wrapperClass:"bg-[#09090b]"},corporativo:{id:"corporativo",displayName:"Corporativo",colors:Lf,layout:{stepNavigation:"wizard",containerStyle:"bordered",spacing:"normal",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-slate-50 dark:bg-slate-950"},festival:{id:"festival",displayName:"Festival",colors:Mf,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-[#0f0f1a]"},webinar:{id:"webinar",displayName:"Webinar",colors:zf,layout:{stepNavigation:"tabs",containerStyle:"card",spacing:"compact",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},retiro:{id:"retiro",displayName:"Retiro",colors:Vf,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-emerald-50 dark:bg-emerald-950/20"},conferencia:{id:"conferencia",displayName:"Conferência",colors:Bf,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},social:{id:"social",displayName:"Social",colors:Hf,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},workshop:{id:"workshop",displayName:"Workshop",colors:Uf,layout:{stepNavigation:"vertical",containerStyle:"bordered",spacing:"compact",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0,stepIndicatorVariant:"icons-labeled",stepIndicatorOrientation:"vertical",eventTitleStyle:"bar"},wrapperClass:"bg-amber-50 dark:bg-amber-950/10"},gala:{id:"gala",displayName:"Gala",colors:Wf,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-[#0c0c0c]"},acao:{id:"acao",displayName:"Ação",colors:qf,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"compact",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},podcast:{id:"podcast",displayName:"Podcast",colors:Xf,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!1,showStepIndicators:!0},wrapperClass:"bg-background"},classico:{id:"classico",displayName:"Clássico",colors:Gf,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-white dark:bg-background"},comunitario:{id:"comunitario",displayName:"Comunitário",colors:Kf,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-yellow-50 dark:bg-background"},noturno:{id:"noturno",displayName:"Noturno",colors:Yf,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},typography:{fontFamily:"font-sans",stepTitleClass:"text-2xl font-bold text-[#f8f8f0]",stepDescClass:"text-sm text-[#9990aa]",labelClass:"font-medium text-[#d4d4c8]"},wrapperClass:"bg-[#0a0a0f]"}},yo=e=>e&&e in Cr?Cr[e]:Cr.moderno,Zf=()=>Object.values(Cr),Jf=e=>e.layout.containerStyle==="glassmorphism",dc=e=>e.colors.background.startsWith("#0")||e.colors.background.startsWith("rgba(0")||e.colors.text==="#ffffff";var Bn={exports:{}},ia={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var rs;function jp(){if(rs)return xr;rs=1;var e=E,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,n=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function i(l,c,d){var u,p={},m=null,x=null;d!==void 0&&(m=""+d),c.key!==void 0&&(m=""+c.key),c.ref!==void 0&&(x=c.ref);for(u in c)a.call(c,u)&&!s.hasOwnProperty(u)&&(p[u]=c[u]);if(l&&l.defaultProps)for(u in c=l.defaultProps,c)p[u]===void 0&&(p[u]=c[u]);return{$$typeof:t,type:l,key:m,ref:x,props:p,_owner:n.current}}return xr.Fragment=r,xr.jsx=i,xr.jsxs=i,xr}var Or={};/**
9
+ */var Ll;function Qf(){if(Ll)return ia;Ll=1;var e=k,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,n=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function l(i,c,d){var m,u={},h=null,p=null;d!==void 0&&(h=""+d),c.key!==void 0&&(h=""+c.key),c.ref!==void 0&&(p=c.ref);for(m in c)o.call(c,m)&&!s.hasOwnProperty(m)&&(u[m]=c[m]);if(i&&i.defaultProps)for(m in c=i.defaultProps,c)u[m]===void 0&&(u[m]=c[m]);return{$$typeof:t,type:i,key:h,ref:p,props:u,_owner:n.current}}return ia.Fragment=r,ia.jsx=l,ia.jsxs=l,ia}var Ra={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,68 +14,66 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var as;function Np(){return as||(as=1,process.env.NODE_ENV!=="production"&&function(){var e=E,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),i=Symbol.for("react.provider"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),x=Symbol.for("react.offscreen"),g=Symbol.iterator,f="@@iterator";function v(S){if(S===null||typeof S!="object")return null;var B=g&&S[g]||S[f];return typeof B=="function"?B:null}var b=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function j(S){{for(var B=arguments.length,Z=new Array(B>1?B-1:0),ne=1;ne<B;ne++)Z[ne-1]=arguments[ne];y("error",S,Z)}}function y(S,B,Z){{var ne=b.ReactDebugCurrentFrame,ge=ne.getStackAddendum();ge!==""&&(B+="%s",Z=Z.concat([ge]));var ve=Z.map(function(xe){return String(xe)});ve.unshift("Warning: "+B),Function.prototype.apply.call(console[S],console,ve)}}var N=!1,C=!1,k=!1,_=!1,w=!1,R;R=Symbol.for("react.module.reference");function A(S){return!!(typeof S=="string"||typeof S=="function"||S===a||S===s||w||S===n||S===d||S===u||_||S===x||N||C||k||typeof S=="object"&&S!==null&&(S.$$typeof===m||S.$$typeof===p||S.$$typeof===i||S.$$typeof===l||S.$$typeof===c||S.$$typeof===R||S.getModuleId!==void 0))}function I(S,B,Z){var ne=S.displayName;if(ne)return ne;var ge=B.displayName||B.name||"";return ge!==""?Z+"("+ge+")":Z}function F(S){return S.displayName||"Context"}function V(S){if(S==null)return null;if(typeof S.tag=="number"&&j("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof S=="function")return S.displayName||S.name||null;if(typeof S=="string")return S;switch(S){case a:return"Fragment";case r:return"Portal";case s:return"Profiler";case n:return"StrictMode";case d:return"Suspense";case u:return"SuspenseList"}if(typeof S=="object")switch(S.$$typeof){case l:var B=S;return F(B)+".Consumer";case i:var Z=S;return F(Z._context)+".Provider";case c:return I(S,S.render,"ForwardRef");case p:var ne=S.displayName||null;return ne!==null?ne:V(S.type)||"Memo";case m:{var ge=S,ve=ge._payload,xe=ge._init;try{return V(xe(ve))}catch{return null}}}return null}var M=Object.assign,U=0,$,T,D,z,L,ee,Y;function J(){}J.__reactDisabledLog=!0;function q(){{if(U===0){$=console.log,T=console.info,D=console.warn,z=console.error,L=console.group,ee=console.groupCollapsed,Y=console.groupEnd;var S={configurable:!0,enumerable:!0,value:J,writable:!0};Object.defineProperties(console,{info:S,log:S,warn:S,error:S,group:S,groupCollapsed:S,groupEnd:S})}U++}}function se(){{if(U--,U===0){var S={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:M({},S,{value:$}),info:M({},S,{value:T}),warn:M({},S,{value:D}),error:M({},S,{value:z}),group:M({},S,{value:L}),groupCollapsed:M({},S,{value:ee}),groupEnd:M({},S,{value:Y})})}U<0&&j("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var me=b.ReactCurrentDispatcher,H;function ie(S,B,Z){{if(H===void 0)try{throw Error()}catch(ge){var ne=ge.stack.trim().match(/\n( *(at )?)/);H=ne&&ne[1]||""}return`
18
- `+H+S}}var te=!1,re;{var Q=typeof WeakMap=="function"?WeakMap:Map;re=new Q}function fe(S,B){if(!S||te)return"";{var Z=re.get(S);if(Z!==void 0)return Z}var ne;te=!0;var ge=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ve;ve=me.current,me.current=null,q();try{if(B){var xe=function(){throw Error()};if(Object.defineProperty(xe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(xe,[])}catch(Ie){ne=Ie}Reflect.construct(S,[],xe)}else{try{xe.call()}catch(Ie){ne=Ie}S.call(xe.prototype)}}else{try{throw Error()}catch(Ie){ne=Ie}S()}}catch(Ie){if(Ie&&ne&&typeof Ie.stack=="string"){for(var he=Ie.stack.split(`
19
- `),Te=ne.stack.split(`
20
- `),Ce=he.length-1,ke=Te.length-1;Ce>=1&&ke>=0&&he[Ce]!==Te[ke];)ke--;for(;Ce>=1&&ke>=0;Ce--,ke--)if(he[Ce]!==Te[ke]){if(Ce!==1||ke!==1)do if(Ce--,ke--,ke<0||he[Ce]!==Te[ke]){var qe=`
21
- `+he[Ce].replace(" at new "," at ");return S.displayName&&qe.includes("<anonymous>")&&(qe=qe.replace("<anonymous>",S.displayName)),typeof S=="function"&&re.set(S,qe),qe}while(Ce>=1&&ke>=0);break}}}finally{te=!1,me.current=ve,se(),Error.prepareStackTrace=ge}var Xt=S?S.displayName||S.name:"",At=Xt?ie(Xt):"";return typeof S=="function"&&re.set(S,At),At}function we(S,B,Z){return fe(S,!1)}function je(S){var B=S.prototype;return!!(B&&B.isReactComponent)}function Me(S,B,Z){if(S==null)return"";if(typeof S=="function")return fe(S,je(S));if(typeof S=="string")return ie(S);switch(S){case d:return ie("Suspense");case u:return ie("SuspenseList")}if(typeof S=="object")switch(S.$$typeof){case c:return we(S.render);case p:return Me(S.type,B,Z);case m:{var ne=S,ge=ne._payload,ve=ne._init;try{return Me(ve(ge),B,Z)}catch{}}}return""}var Ae=Object.prototype.hasOwnProperty,$r={},Rr=b.ReactDebugCurrentFrame;function mt(S){if(S){var B=S._owner,Z=Me(S.type,S._source,B?B.type:null);Rr.setExtraStackFrame(Z)}else Rr.setExtraStackFrame(null)}function Au(S,B,Z,ne,ge){{var ve=Function.call.bind(Ae);for(var xe in S)if(ve(S,xe)){var he=void 0;try{if(typeof S[xe]!="function"){var Te=Error((ne||"React class")+": "+Z+" type `"+xe+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof S[xe]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw Te.name="Invariant Violation",Te}he=S[xe](B,xe,ne,Z,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Ce){he=Ce}he&&!(he instanceof Error)&&(mt(ge),j("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",ne||"React class",Z,xe,typeof he),mt(null)),he instanceof Error&&!(he.message in $r)&&($r[he.message]=!0,mt(ge),j("Failed %s type: %s",Z,he.message),mt(null))}}}var Iu=Array.isArray;function Xa(S){return Iu(S)}function Lu(S){{var B=typeof Symbol=="function"&&Symbol.toStringTag,Z=B&&S[Symbol.toStringTag]||S.constructor.name||"Object";return Z}}function zu(S){try{return Hn(S),!1}catch{return!0}}function Hn(S){return""+S}function Wn(S){if(zu(S))return j("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Lu(S)),Hn(S)}var qn=b.ReactCurrentOwner,Mu={key:!0,ref:!0,__self:!0,__source:!0},Zn,Xn;function Fu(S){if(Ae.call(S,"ref")){var B=Object.getOwnPropertyDescriptor(S,"ref").get;if(B&&B.isReactWarning)return!1}return S.ref!==void 0}function Vu(S){if(Ae.call(S,"key")){var B=Object.getOwnPropertyDescriptor(S,"key").get;if(B&&B.isReactWarning)return!1}return S.key!==void 0}function Bu(S,B){typeof S.ref=="string"&&qn.current}function Uu(S,B){{var Z=function(){Zn||(Zn=!0,j("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",B))};Z.isReactWarning=!0,Object.defineProperty(S,"key",{get:Z,configurable:!0})}}function Hu(S,B){{var Z=function(){Xn||(Xn=!0,j("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",B))};Z.isReactWarning=!0,Object.defineProperty(S,"ref",{get:Z,configurable:!0})}}var Wu=function(S,B,Z,ne,ge,ve,xe){var he={$$typeof:t,type:S,key:B,ref:Z,props:xe,_owner:ve};return he._store={},Object.defineProperty(he._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(he,"_self",{configurable:!1,enumerable:!1,writable:!1,value:ne}),Object.defineProperty(he,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ge}),Object.freeze&&(Object.freeze(he.props),Object.freeze(he)),he};function qu(S,B,Z,ne,ge){{var ve,xe={},he=null,Te=null;Z!==void 0&&(Wn(Z),he=""+Z),Vu(B)&&(Wn(B.key),he=""+B.key),Fu(B)&&(Te=B.ref,Bu(B));for(ve in B)Ae.call(B,ve)&&!Mu.hasOwnProperty(ve)&&(xe[ve]=B[ve]);if(S&&S.defaultProps){var Ce=S.defaultProps;for(ve in Ce)xe[ve]===void 0&&(xe[ve]=Ce[ve])}if(he||Te){var ke=typeof S=="function"?S.displayName||S.name||"Unknown":S;he&&Uu(xe,ke),Te&&Hu(xe,ke)}return Wu(S,he,Te,ge,ne,qn.current,xe)}}var Ga=b.ReactCurrentOwner,Gn=b.ReactDebugCurrentFrame;function Zt(S){if(S){var B=S._owner,Z=Me(S.type,S._source,B?B.type:null);Gn.setExtraStackFrame(Z)}else Gn.setExtraStackFrame(null)}var Ya;Ya=!1;function Ka(S){return typeof S=="object"&&S!==null&&S.$$typeof===t}function Yn(){{if(Ga.current){var S=V(Ga.current.type);if(S)return`
17
+ */var Ml;function eh(){return Ml||(Ml=1,process.env.NODE_ENV!=="production"&&function(){var e=k,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),o=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),i=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),m=Symbol.for("react.suspense_list"),u=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),p=Symbol.for("react.offscreen"),y=Symbol.iterator,f="@@iterator";function g(R){if(R===null||typeof R!="object")return null;var re=y&&R[y]||R[f];return typeof re=="function"?re:null}var w=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function v(R){{for(var re=arguments.length,ce=new Array(re>1?re-1:0),we=1;we<re;we++)ce[we-1]=arguments[we];b("error",R,ce)}}function b(R,re,ce){{var we=w.ReactDebugCurrentFrame,Re=we.getStackAddendum();Re!==""&&(re+="%s",ce=ce.concat([Re]));var Oe=ce.map(function(Ae){return String(Ae)});Oe.unshift("Warning: "+re),Function.prototype.apply.call(console[R],console,Oe)}}var j=!1,N=!1,S=!1,$=!1,C=!1,E;E=Symbol.for("react.module.reference");function A(R){return!!(typeof R=="string"||typeof R=="function"||R===o||R===s||C||R===n||R===d||R===m||$||R===p||j||N||S||typeof R=="object"&&R!==null&&(R.$$typeof===h||R.$$typeof===u||R.$$typeof===l||R.$$typeof===i||R.$$typeof===c||R.$$typeof===E||R.getModuleId!==void 0))}function I(R,re,ce){var we=R.displayName;if(we)return we;var Re=re.displayName||re.name||"";return Re!==""?ce+"("+Re+")":ce}function M(R){return R.displayName||"Context"}function T(R){if(R==null)return null;if(typeof R.tag=="number"&&v("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof R=="function")return R.displayName||R.name||null;if(typeof R=="string")return R;switch(R){case o:return"Fragment";case r:return"Portal";case s:return"Profiler";case n:return"StrictMode";case d:return"Suspense";case m:return"SuspenseList"}if(typeof R=="object")switch(R.$$typeof){case i:var re=R;return M(re)+".Consumer";case l:var ce=R;return M(ce._context)+".Provider";case c:return I(R,R.render,"ForwardRef");case u:var we=R.displayName||null;return we!==null?we:T(R.type)||"Memo";case h:{var Re=R,Oe=Re._payload,Ae=Re._init;try{return T(Ae(Oe))}catch{return null}}}return null}var B=Object.assign,q=0,W,X,V,L,P,se,U;function Q(){}Q.__reactDisabledLog=!0;function ee(){{if(q===0){W=console.log,X=console.info,V=console.warn,L=console.error,P=console.group,se=console.groupCollapsed,U=console.groupEnd;var R={configurable:!0,enumerable:!0,value:Q,writable:!0};Object.defineProperties(console,{info:R,log:R,warn:R,error:R,group:R,groupCollapsed:R,groupEnd:R})}q++}}function H(){{if(q--,q===0){var R={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:B({},R,{value:W}),info:B({},R,{value:X}),warn:B({},R,{value:V}),error:B({},R,{value:L}),group:B({},R,{value:P}),groupCollapsed:B({},R,{value:se}),groupEnd:B({},R,{value:U})})}q<0&&v("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var K=w.ReactCurrentDispatcher,G;function Y(R,re,ce){{if(G===void 0)try{throw Error()}catch(Re){var we=Re.stack.trim().match(/\n( *(at )?)/);G=we&&we[1]||""}return`
18
+ `+G+R}}var Z=!1,te;{var ue=typeof WeakMap=="function"?WeakMap:Map;te=new ue}function ve(R,re){if(!R||Z)return"";{var ce=te.get(R);if(ce!==void 0)return ce}var we;Z=!0;var Re=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var Oe;Oe=K.current,K.current=null,ee();try{if(re){var Ae=function(){throw Error()};if(Object.defineProperty(Ae.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(Ae,[])}catch(lt){we=lt}Reflect.construct(R,[],Ae)}else{try{Ae.call()}catch(lt){we=lt}R.call(Ae.prototype)}}else{try{throw Error()}catch(lt){we=lt}R()}}catch(lt){if(lt&&we&&typeof lt.stack=="string"){for(var Ee=lt.stack.split(`
19
+ `),at=we.stack.split(`
20
+ `),Le=Ee.length-1,He=at.length-1;Le>=1&&He>=0&&Ee[Le]!==at[He];)He--;for(;Le>=1&&He>=0;Le--,He--)if(Ee[Le]!==at[He]){if(Le!==1||He!==1)do if(Le--,He--,He<0||Ee[Le]!==at[He]){var Ct=`
21
+ `+Ee[Le].replace(" at new "," at ");return R.displayName&&Ct.includes("<anonymous>")&&(Ct=Ct.replace("<anonymous>",R.displayName)),typeof R=="function"&&te.set(R,Ct),Ct}while(Le>=1&&He>=0);break}}}finally{Z=!1,K.current=Oe,H(),Error.prepareStackTrace=Re}var Pr=R?R.displayName||R.name:"",br=Pr?Y(Pr):"";return typeof R=="function"&&te.set(R,br),br}function Ne(R,re,ce){return ve(R,!1)}function ye(R){var re=R.prototype;return!!(re&&re.isReactComponent)}function Be(R,re,ce){if(R==null)return"";if(typeof R=="function")return ve(R,ye(R));if(typeof R=="string")return Y(R);switch(R){case d:return Y("Suspense");case m:return Y("SuspenseList")}if(typeof R=="object")switch(R.$$typeof){case c:return Ne(R.render);case u:return Be(R.type,re,ce);case h:{var we=R,Re=we._payload,Oe=we._init;try{return Be(Oe(Re),re,ce)}catch{}}}return""}var Ue=Object.prototype.hasOwnProperty,Je={},qt=w.ReactDebugCurrentFrame;function rt(R){if(R){var re=R._owner,ce=Be(R.type,R._source,re?re.type:null);qt.setExtraStackFrame(ce)}else qt.setExtraStackFrame(null)}function D(R,re,ce,we,Re){{var Oe=Function.call.bind(Ue);for(var Ae in R)if(Oe(R,Ae)){var Ee=void 0;try{if(typeof R[Ae]!="function"){var at=Error((we||"React class")+": "+ce+" type `"+Ae+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof R[Ae]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw at.name="Invariant Violation",at}Ee=R[Ae](re,Ae,we,ce,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(Le){Ee=Le}Ee&&!(Ee instanceof Error)&&(rt(Re),v("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",we||"React class",ce,Ae,typeof Ee),rt(null)),Ee instanceof Error&&!(Ee.message in Je)&&(Je[Ee.message]=!0,rt(Re),v("Failed %s type: %s",ce,Ee.message),rt(null))}}}var F=Array.isArray;function z(R){return F(R)}function ie(R){{var re=typeof Symbol=="function"&&Symbol.toStringTag,ce=re&&R[Symbol.toStringTag]||R.constructor.name||"Object";return ce}}function ne(R){try{return ae(R),!1}catch{return!0}}function ae(R){return""+R}function ge(R){if(ne(R))return v("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ie(R)),ae(R)}var _e=w.ReactCurrentOwner,Te={key:!0,ref:!0,__self:!0,__source:!0},Ye,Lt;function Mt(R){if(Ue.call(R,"ref")){var re=Object.getOwnPropertyDescriptor(R,"ref").get;if(re&&re.isReactWarning)return!1}return R.ref!==void 0}function sn(R){if(Ue.call(R,"key")){var re=Object.getOwnPropertyDescriptor(R,"key").get;if(re&&re.isReactWarning)return!1}return R.key!==void 0}function sa(R,re){typeof R.ref=="string"&&_e.current}function la(R,re){{var ce=function(){Ye||(Ye=!0,v("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",re))};ce.isReactWarning=!0,Object.defineProperty(R,"key",{get:ce,configurable:!0})}}function ln(R,re){{var ce=function(){Lt||(Lt=!0,v("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",re))};ce.isReactWarning=!0,Object.defineProperty(R,"ref",{get:ce,configurable:!0})}}var Ta=function(R,re,ce,we,Re,Oe,Ae){var Ee={$$typeof:t,type:R,key:re,ref:ce,props:Ae,_owner:Oe};return Ee._store={},Object.defineProperty(Ee._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(Ee,"_self",{configurable:!1,enumerable:!1,writable:!1,value:we}),Object.defineProperty(Ee,"_source",{configurable:!1,enumerable:!1,writable:!1,value:Re}),Object.freeze&&(Object.freeze(Ee.props),Object.freeze(Ee)),Ee};function cn(R,re,ce,we,Re){{var Oe,Ae={},Ee=null,at=null;ce!==void 0&&(ge(ce),Ee=""+ce),sn(re)&&(ge(re.key),Ee=""+re.key),Mt(re)&&(at=re.ref,sa(re));for(Oe in re)Ue.call(re,Oe)&&!Te.hasOwnProperty(Oe)&&(Ae[Oe]=re[Oe]);if(R&&R.defaultProps){var Le=R.defaultProps;for(Oe in Le)Ae[Oe]===void 0&&(Ae[Oe]=Le[Oe])}if(Ee||at){var He=typeof R=="function"?R.displayName||R.name||"Unknown":R;Ee&&la(Ae,He),at&&ln(Ae,He)}return Ta(R,Ee,at,Re,we,_e.current,Ae)}}var Rr=w.ReactCurrentOwner,Tl=w.ReactDebugCurrentFrame;function Dr(R){if(R){var re=R._owner,ce=Be(R.type,R._source,re?re.type:null);Tl.setExtraStackFrame(ce)}else Tl.setExtraStackFrame(null)}var dn;dn=!1;function un(R){return typeof R=="object"&&R!==null&&R.$$typeof===t}function Rl(){{if(Rr.current){var R=T(Rr.current.type);if(R)return`
22
22
 
23
- Check the render method of \``+S+"`."}return""}}function Zu(S){return""}var Kn={};function Xu(S){{var B=Yn();if(!B){var Z=typeof S=="string"?S:S.displayName||S.name;Z&&(B=`
23
+ Check the render method of \``+R+"`."}return""}}function Cf(R){return""}var Dl={};function kf(R){{var re=Rl();if(!re){var ce=typeof R=="string"?R:R.displayName||R.name;ce&&(re=`
24
24
 
25
- Check the top-level render call using <`+Z+">.")}return B}}function Jn(S,B){{if(!S._store||S._store.validated||S.key!=null)return;S._store.validated=!0;var Z=Xu(B);if(Kn[Z])return;Kn[Z]=!0;var ne="";S&&S._owner&&S._owner!==Ga.current&&(ne=" It was passed a child from "+V(S._owner.type)+"."),Zt(S),j('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',Z,ne),Zt(null)}}function Qn(S,B){{if(typeof S!="object")return;if(Xa(S))for(var Z=0;Z<S.length;Z++){var ne=S[Z];Ka(ne)&&Jn(ne,B)}else if(Ka(S))S._store&&(S._store.validated=!0);else if(S){var ge=v(S);if(typeof ge=="function"&&ge!==S.entries)for(var ve=ge.call(S),xe;!(xe=ve.next()).done;)Ka(xe.value)&&Jn(xe.value,B)}}}function Gu(S){{var B=S.type;if(B==null||typeof B=="string")return;var Z;if(typeof B=="function")Z=B.propTypes;else if(typeof B=="object"&&(B.$$typeof===c||B.$$typeof===p))Z=B.propTypes;else return;if(Z){var ne=V(B);Au(Z,S.props,"prop",ne,S)}else if(B.PropTypes!==void 0&&!Ya){Ya=!0;var ge=V(B);j("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ge||"Unknown")}typeof B.getDefaultProps=="function"&&!B.getDefaultProps.isReactClassApproved&&j("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Yu(S){{for(var B=Object.keys(S.props),Z=0;Z<B.length;Z++){var ne=B[Z];if(ne!=="children"&&ne!=="key"){Zt(S),j("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",ne),Zt(null);break}}S.ref!==null&&(Zt(S),j("Invalid attribute `ref` supplied to `React.Fragment`."),Zt(null))}}var es={};function ts(S,B,Z,ne,ge,ve){{var xe=A(S);if(!xe){var he="";(S===void 0||typeof S=="object"&&S!==null&&Object.keys(S).length===0)&&(he+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var Te=Zu();Te?he+=Te:he+=Yn();var Ce;S===null?Ce="null":Xa(S)?Ce="array":S!==void 0&&S.$$typeof===t?(Ce="<"+(V(S.type)||"Unknown")+" />",he=" Did you accidentally export a JSX literal instead of a component?"):Ce=typeof S,j("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Ce,he)}var ke=qu(S,B,Z,ge,ve);if(ke==null)return ke;if(xe){var qe=B.children;if(qe!==void 0)if(ne)if(Xa(qe)){for(var Xt=0;Xt<qe.length;Xt++)Qn(qe[Xt],S);Object.freeze&&Object.freeze(qe)}else j("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Qn(qe,S)}if(Ae.call(B,"key")){var At=V(S),Ie=Object.keys(B).filter(function(rp){return rp!=="key"}),Ja=Ie.length>0?"{key: someKey, "+Ie.join(": ..., ")+": ...}":"{key: someKey}";if(!es[At+Ja]){var tp=Ie.length>0?"{"+Ie.join(": ..., ")+": ...}":"{}";j(`A props object containing a "key" prop is being spread into JSX:
25
+ Check the top-level render call using <`+ce+">.")}return re}}function Pl(R,re){{if(!R._store||R._store.validated||R.key!=null)return;R._store.validated=!0;var ce=kf(re);if(Dl[ce])return;Dl[ce]=!0;var we="";R&&R._owner&&R._owner!==Rr.current&&(we=" It was passed a child from "+T(R._owner.type)+"."),Dr(R),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ce,we),Dr(null)}}function Ol(R,re){{if(typeof R!="object")return;if(z(R))for(var ce=0;ce<R.length;ce++){var we=R[ce];un(we)&&Pl(we,re)}else if(un(R))R._store&&(R._store.validated=!0);else if(R){var Re=g(R);if(typeof Re=="function"&&Re!==R.entries)for(var Oe=Re.call(R),Ae;!(Ae=Oe.next()).done;)un(Ae.value)&&Pl(Ae.value,re)}}}function Sf(R){{var re=R.type;if(re==null||typeof re=="string")return;var ce;if(typeof re=="function")ce=re.propTypes;else if(typeof re=="object"&&(re.$$typeof===c||re.$$typeof===u))ce=re.propTypes;else return;if(ce){var we=T(re);D(ce,R.props,"prop",we,R)}else if(re.PropTypes!==void 0&&!dn){dn=!0;var Re=T(re);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",Re||"Unknown")}typeof re.getDefaultProps=="function"&&!re.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function $f(R){{for(var re=Object.keys(R.props),ce=0;ce<re.length;ce++){var we=re[ce];if(we!=="children"&&we!=="key"){Dr(R),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",we),Dr(null);break}}R.ref!==null&&(Dr(R),v("Invalid attribute `ref` supplied to `React.Fragment`."),Dr(null))}}var Il={};function Fl(R,re,ce,we,Re,Oe){{var Ae=A(R);if(!Ae){var Ee="";(R===void 0||typeof R=="object"&&R!==null&&Object.keys(R).length===0)&&(Ee+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var at=Cf();at?Ee+=at:Ee+=Rl();var Le;R===null?Le="null":z(R)?Le="array":R!==void 0&&R.$$typeof===t?(Le="<"+(T(R.type)||"Unknown")+" />",Ee=" Did you accidentally export a JSX literal instead of a component?"):Le=typeof R,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Le,Ee)}var He=cn(R,re,ce,Re,Oe);if(He==null)return He;if(Ae){var Ct=re.children;if(Ct!==void 0)if(we)if(z(Ct)){for(var Pr=0;Pr<Ct.length;Pr++)Ol(Ct[Pr],R);Object.freeze&&Object.freeze(Ct)}else v("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Ol(Ct,R)}if(Ue.call(re,"key")){var br=T(R),lt=Object.keys(re).filter(function(Df){return Df!=="key"}),mn=lt.length>0?"{key: someKey, "+lt.join(": ..., ")+": ...}":"{key: someKey}";if(!Il[br+mn]){var Rf=lt.length>0?"{"+lt.join(": ..., ")+": ...}":"{}";v(`A props object containing a "key" prop is being spread into JSX:
26
26
  let props = %s;
27
27
  <%s {...props} />
28
28
  React keys must be passed directly to JSX without using spread:
29
29
  let props = %s;
30
- <%s key={someKey} {...props} />`,Ja,At,tp,At),es[At+Ja]=!0}}return S===a?Yu(ke):Gu(ke),ke}}function Ku(S,B,Z){return ts(S,B,Z,!0)}function Ju(S,B,Z){return ts(S,B,Z,!1)}var Qu=Ju,ep=Ku;Or.Fragment=a,Or.jsx=Qu,Or.jsxs=ep}()),Or}process.env.NODE_ENV==="production"?go.exports=jp():go.exports=Np();var Qa=go.exports;const vo=E.createContext(ua("moderno")),Ho=({config:e,children:t,renderWrapper:r=!0,className:a,style:n})=>{const s={"--t-primary":e.colors.primary,"--t-primary-hover":e.colors.primaryHover,"--t-accent":e.colors.accent,"--t-bg":e.colors.background,"--t-surface":e.colors.surface,"--t-text":e.colors.text,"--t-text-muted":e.colors.textMuted,"--t-border":e.colors.border,"--t-error":e.colors.error,...n};return r?Qa.jsx(vo.Provider,{value:e,children:Qa.jsx("div",{className:a,style:s,"data-template":"1",children:t})}):Qa.jsx(vo.Provider,{value:e,children:t})},Wo=()=>E.useContext(vo),pa=[{id:"preset_personal",name:"Dados Pessoais",description:"Nome, e-mail, CPF, telefone e data de nascimento",icon:"User",category:"personal",containerTemplate:{titulo:"Dados Pessoais",icone:"User",ordem:0,campos:[{id:"_personal_nome",nome:"nome",tipo:O.TEXTO,label:"Nome completo",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Seu nome completo"},{id:"_personal_email",nome:"email",tipo:O.EMAIL,label:"E-mail",ordem:1,tamanho:6,obrigatorio:!0,placeholder:"seuemail@exemplo.com"},{id:"_personal_telefone",nome:"telefone",tipo:O.TELEFONE,label:"Telefone / WhatsApp",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"},{id:"_personal_cpf",nome:"cpf",tipo:O.CPF,label:"CPF",ordem:3,tamanho:6,obrigatorio:!1,placeholder:"000.000.000-00"},{id:"_personal_nascimento",nome:"data_nascimento",tipo:O.DATE,label:"Data de nascimento",ordem:4,tamanho:6,obrigatorio:!1}]}},{id:"preset_emergency_array",name:"Contatos de Emergência",description:"Lista de contatos (mín. 2, máx. 7) com Nome, Parentesco e Telefone",icon:"PhoneCall",category:"emergency",containerTemplate:{titulo:"Contatos de Emergência",icone:"PhoneCall",ordem:0,campos:[{id:"_emerg_array_contatos",nome:"contatos_emergencia",tipo:O.FIELD_ARRAY,label:"Contatos de Emergência",ordem:0,tamanho:12,obrigatorio:!0,itemLabel:"Contato",minItems:2,maxItems:7,addLabel:"Adicionar Contato",subFields:[{id:"_emerg_array_nome",nome:"nome",tipo:O.TEXTO,label:"Nome",ordem:0,tamanho:4,obrigatorio:!0,placeholder:"Nome completo do contato"},{id:"_emerg_array_parentesco",nome:"parentesco",tipo:O.SELECT,label:"Parentesco",ordem:1,tamanho:4,obrigatorio:!0,opcoes:[{valor:"pai",label:"Pai"},{valor:"mae",label:"Mãe"},{valor:"conjuge",label:"Cônjuge"},{valor:"irmao",label:"Irmão/Irmã"},{valor:"avo",label:"Avô/Avó"},{valor:"tio",label:"Tio/Tia"},{valor:"amigo",label:"Amigo(a)"},{valor:"outro",label:"Outro"}]},{id:"_emerg_array_telefone",nome:"telefone",tipo:O.TELEFONE,label:"Celular",ordem:2,tamanho:4,obrigatorio:!0,placeholder:"(34) 99999-9999"}]}]}},{id:"preset_emergency",name:"Contatos de Emergência (Repetível)",description:"Lista repetível de contatos de emergência (mínimo 2)",icon:"PhoneCall",category:"emergency",containerTemplate:{titulo:"Contatos de Emergência",icone:"PhoneCall",ordem:0,nome:"contatos_emergencia",repeatable:!0,minItems:2,maxItems:5,itemLabel:"Contato",campos:[{id:"_emerg_nome",nome:"nome",tipo:O.TEXTO,label:"Nome",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Nome completo do contato"},{id:"_emerg_parentesco",nome:"parentesco",tipo:O.SELECT,label:"Parentesco",ordem:1,tamanho:6,obrigatorio:!0,opcoes:[{valor:"pai",label:"Pai"},{valor:"mae",label:"Mãe"},{valor:"conjuge",label:"Cônjuge"},{valor:"irmao",label:"Irmão/Irmã"},{valor:"avo",label:"Avô/Avó"},{valor:"amigo",label:"Amigo(a)"},{valor:"outro",label:"Outro"}]},{id:"_emerg_telefone",nome:"telefone",tipo:O.TELEFONE,label:"Telefone",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"}]}},{id:"preset_address",name:"Endereço",description:"CEP com preenchimento automático via ViaCEP + campos de endereço",icon:"MapPin",category:"address",containerTemplate:{titulo:"Endereço",icone:"MapPin",ordem:0,campos:[{id:"_address_cep",nome:"_address_cep",tipo:O.CEP,label:"CEP",ordem:0,tamanho:4,obrigatorio:!1,placeholder:"00000-000",hint:"Preencha o CEP para auto-completar o endereço",locked:!0,cepFillMap:{logradouro:"_address_logradouro",bairro:"_address_bairro",cidade:"_address_cidade",estado:"_address_estado"}},{id:"_address_logradouro",nome:"_address_logradouro",tipo:O.TEXTO,label:"Logradouro",ordem:1,tamanho:8,obrigatorio:!1,placeholder:"Rua, Av., Travessa...",locked:!0},{id:"_address_numero",nome:"_address_numero",tipo:O.TEXTO,label:"Número",ordem:2,tamanho:3,obrigatorio:!1,placeholder:"Nº"},{id:"_address_complemento",nome:"_address_complemento",tipo:O.TEXTO,label:"Complemento",ordem:3,tamanho:9,obrigatorio:!1,placeholder:"Apto, bloco, casa..."},{id:"_address_bairro",nome:"_address_bairro",tipo:O.TEXTO,label:"Bairro",ordem:4,tamanho:5,obrigatorio:!1,locked:!0},{id:"_address_cidade",nome:"_address_cidade",tipo:O.TEXTO,label:"Cidade",ordem:5,tamanho:5,obrigatorio:!1,locked:!0},{id:"_address_estado",nome:"_address_estado",tipo:O.TEXTO,label:"Estado (UF)",ordem:6,tamanho:2,obrigatorio:!1,placeholder:"SP",locked:!0}]}},{id:"preset_responsible",name:"Responsável",description:"Dados do responsável legal (para menores ou dependentes)",icon:"Users",category:"personal",containerTemplate:{titulo:"Responsável",icone:"Users",ordem:0,campos:[{id:"_resp_nome",nome:"responsavel_nome",tipo:O.TEXTO,label:"Nome do responsável",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Nome completo do responsável"},{id:"_resp_parentesco",nome:"responsavel_parentesco",tipo:O.SELECT,label:"Parentesco",ordem:1,tamanho:6,obrigatorio:!0,opcoes:[{valor:"pai",label:"Pai"},{valor:"mae",label:"Mãe"},{valor:"avo",label:"Avô/Avó"},{valor:"outro",label:"Outro"}]},{id:"_resp_telefone",nome:"responsavel_telefone",tipo:O.TELEFONE,label:"Telefone do responsável",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"},{id:"_resp_cpf",nome:"responsavel_cpf",tipo:O.CPF,label:"CPF do responsável",ordem:3,tamanho:6,obrigatorio:!1,placeholder:"000.000.000-00"}]}},{id:"preset_health",name:"Informações de Saúde",description:"Alergias, medicamentos, tipo sanguíneo e plano de saúde",icon:"HeartPulse",category:"health",containerTemplate:{titulo:"Informações de Saúde",icone:"HeartPulse",ordem:0,campos:[{id:"_health_tipo_sanguineo",nome:"tipo_sanguineo",tipo:O.SELECT,label:"Tipo sanguíneo",ordem:0,tamanho:4,obrigatorio:!1,opcoes:[{valor:"A+",label:"A+"},{valor:"A-",label:"A-"},{valor:"B+",label:"B+"},{valor:"B-",label:"B-"},{valor:"AB+",label:"AB+"},{valor:"AB-",label:"AB-"},{valor:"O+",label:"O+"},{valor:"O-",label:"O-"},{valor:"nao_sei",label:"Não sei"}]},{id:"_health_plano",nome:"plano_saude",tipo:O.TEXTO,label:"Plano de saúde",ordem:1,tamanho:8,obrigatorio:!1,placeholder:'Ex: Unimed... ou "Nenhum"'},{id:"_health_alergias",nome:"alergias",tipo:O.TEXTAREA,label:"Alergias",ordem:2,tamanho:12,obrigatorio:!1,placeholder:"Descreva alergias conhecidas"},{id:"_health_medicamentos",nome:"medicamentos",tipo:O.TEXTAREA,label:"Medicamentos em uso contínuo",ordem:3,tamanho:12,obrigatorio:!1,placeholder:"Nome, dosagem e frequência"},{id:"_health_obs",nome:"observacoes_medicas",tipo:O.TEXTAREA,label:"Outras observações médicas",ordem:4,tamanho:12,obrigatorio:!1}]}},{id:"preset_participation",name:"Participação",description:"Restrições alimentares, tamanho de camiseta e observações gerais",icon:"ClipboardList",category:"event",containerTemplate:{titulo:"Participação",icone:"ClipboardList",ordem:0,campos:[{id:"_part_restricao_alimentar",nome:"restricao_alimentar",tipo:O.SELECT,label:"Restrição alimentar",ordem:0,tamanho:6,obrigatorio:!1,opcoes:[{valor:"nenhuma",label:"Nenhuma"},{valor:"vegetariano",label:"Vegetariano"},{valor:"vegano",label:"Vegano"},{valor:"sem_gluten",label:"Sem glúten"},{valor:"sem_lactose",label:"Sem lactose"},{valor:"outro",label:"Outro"}]},{id:"_part_camiseta",nome:"tamanho_camiseta",tipo:O.SELECT,label:"Tamanho da camiseta",ordem:1,tamanho:6,obrigatorio:!1,opcoes:[{valor:"PP",label:"PP"},{valor:"P",label:"P"},{valor:"M",label:"M"},{valor:"G",label:"G"},{valor:"GG",label:"GG"},{valor:"XGG",label:"XGG"}]},{id:"_part_obs",nome:"observacoes_participacao",tipo:O.TEXTAREA,label:"Observações",ordem:2,tamanho:12,obrigatorio:!1}]}},{id:"preset_payment",name:"Informações de Pagamento",description:"Forma de pagamento e comprovante",icon:"CreditCard",category:"payment",containerTemplate:{titulo:"Pagamento",icone:"CreditCard",ordem:0,campos:[{id:"_pay_forma",nome:"forma_pagamento",tipo:O.SELECT,label:"Forma de pagamento",ordem:0,tamanho:6,obrigatorio:!0,opcoes:[{valor:"pix",label:"PIX"},{valor:"cartao",label:"Cartão de crédito/débito"},{valor:"boleto",label:"Boleto bancário"},{valor:"dinheiro",label:"Dinheiro (presencial)"}]},{id:"_pay_comprovante",nome:"comprovante_pagamento",tipo:O.FILE,label:"Comprovante de pagamento",ordem:1,tamanho:6,obrigatorio:!1,hint:"Envie o comprovante caso já tenha efetuado o pagamento"}]}},{id:"preset_participation_type",name:"Tipo de Participação",description:"Seleção de todos os dias ou dia específico. Datas, preços e vagas carregados via externalData.",icon:"CalendarDays",category:"event",containerTemplate:{titulo:"Tipo de Participação",icone:"CalendarDays",descricao:"Escolha como você deseja participar do evento",ordem:0,campos:[{id:"_participation_type_field",nome:"tipo_participacao",tipo:O.PARTICIPATION_TYPE,label:"Tipo de Participação",hint:"Escolha como você deseja participar",ordem:0,tamanho:12,obrigatorio:!0,locked:!0}]}}],Cp=e=>pa.filter(t=>t.category===e),ji=e=>pa.find(t=>t.id===e),qo=[{id:"preset_steps_participation_payment",name:"Participação + Pagamento",description:"Dois steps: seleção do tipo de participação e escolha da forma de pagamento com cálculo automático de taxas.",icon:"Wallet",steps:[{titulo:"Tipo de Participação",descricao:"Escolha como deseja participar do evento",icone:"CalendarDays",containers:[{titulo:"Tipo de Participação",icone:"CalendarDays",descricao:"Escolha como você deseja participar do evento",ordem:0,campos:[{id:"_participation_type_field",nome:"tipo_participacao",tipo:O.PARTICIPATION_TYPE,label:"Tipo de Participação",hint:"Escolha como você deseja participar",ordem:0,tamanho:12,obrigatorio:!0,locked:!0}]}]},{titulo:"Forma de Pagamento",descricao:"Escolha como deseja pagar sua inscrição",icone:"Wallet",containers:[{titulo:"Forma de Pagamento",icone:"Wallet",descricao:"Escolha como deseja pagar sua inscrição",ordem:0,campos:[{id:"_payment_method_field",nome:"forma_pagamento",tipo:O.PAYMENT_METHOD,label:"Forma de Pagamento",ordem:0,tamanho:12,obrigatorio:!0,locked:!0,relatedFieldName:"tipo_participacao"}]}]}]}],Sp=e=>qo.find(t=>t.id===e);function de(e,t,r){function a(l,c){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),l._zod.traits.has(e))return;l._zod.traits.add(e),t(l,c);const d=i.prototype,u=Object.keys(d);for(let p=0;p<u.length;p++){const m=u[p];m in l||(l[m]=d[m].bind(l))}}const n=(r==null?void 0:r.Parent)??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(l){var c;const d=r!=null&&r.Parent?new s:this;a(d,l),(c=d._zod).deferred??(c.deferred=[]);for(const u of d._zod.deferred)u();return d}return Object.defineProperty(i,"init",{value:a}),Object.defineProperty(i,Symbol.hasInstance,{value:l=>{var c,d;return r!=null&&r.Parent&&l instanceof r.Parent?!0:(d=(c=l==null?void 0:l._zod)==null?void 0:c.traits)==null?void 0:d.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}class er extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Ni extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const kp={};function Mt(e){return kp}function bo(e,t){return typeof t=="bigint"?t.toString():t}function Zo(e){return e==null}function Xo(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const os=Symbol("evaluating");function be(e,t,r){let a;Object.defineProperty(e,t,{get(){if(a!==os)return a===void 0&&(a=os,a=r()),a},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function _p(...e){const t={};for(const r of e){const a=Object.getOwnPropertyDescriptors(r);Object.assign(t,a)}return Object.defineProperties({},t)}const Ci="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function ns(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function yo(e){if(ns(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(ns(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Si(e){return yo(e)?{...e}:Array.isArray(e)?[...e]:e}function Ep(e,t,r){const a=new e._zod.constr(t??e._zod.def);return(!t||r!=null&&r.parent)&&(a._zod.parent=e),a}function Tt(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Qt(e,t=0){var r;if(e.aborted===!0)return!0;for(let a=t;a<e.issues.length;a++)if(((r=e.issues[a])==null?void 0:r.continue)!==!0)return!0;return!1}function Pp(e,t){return t.map(r=>{var a;return(a=r).path??(a.path=[]),r.path.unshift(e),r})}function Dr(e){return typeof e=="string"?e:e==null?void 0:e.message}function Ft(e,t,r){var a,n,s,i,l,c;const d={...e,path:e.path??[]};if(!e.message){const u=Dr((s=(n=(a=e.inst)==null?void 0:a._zod.def)==null?void 0:n.error)==null?void 0:s.call(n,e))??Dr((i=t==null?void 0:t.error)==null?void 0:i.call(t,e))??Dr((l=r.customError)==null?void 0:l.call(r,e))??Dr((c=r.localeError)==null?void 0:c.call(r,e))??"Invalid input";d.message=u}return delete d.inst,delete d.continue,t!=null&&t.reportInput||delete d.input,d}function Go(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function yr(...e){const[t,r,a]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:a}:{...t}}const ki=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,bo,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},_i=de("$ZodError",ki),Ei=de("$ZodError",ki,{Parent:Error});function Tp(e,t=r=>r.message){const r={},a=[];for(const n of e.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(t(n))):a.push(t(n));return{formErrors:a,fieldErrors:r}}function $p(e,t=r=>r.message){const r={_errors:[]},a=n=>{for(const s of n.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(i=>a({issues:i}));else if(s.code==="invalid_key")a({issues:s.issues});else if(s.code==="invalid_element")a({issues:s.issues});else if(s.path.length===0)r._errors.push(t(s));else{let i=r,l=0;for(;l<s.path.length;){const c=s.path[l];l===s.path.length-1?(i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(s))):i[c]=i[c]||{_errors:[]},i=i[c],l++}}};return a(e),r}const Yo=e=>(t,r,a,n)=>{const s=a?Object.assign(a,{async:!1}):{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new er;if(i.issues.length){const l=new((n==null?void 0:n.Err)??e)(i.issues.map(c=>Ft(c,s,Mt())));throw Ci(l,n==null?void 0:n.callee),l}return i.value},Ko=e=>async(t,r,a,n)=>{const s=a?Object.assign(a,{async:!0}):{async:!0};let i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const l=new((n==null?void 0:n.Err)??e)(i.issues.map(c=>Ft(c,s,Mt())));throw Ci(l,n==null?void 0:n.callee),l}return i.value},ma=e=>(t,r,a)=>{const n=a?{...a,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new er;return s.issues.length?{success:!1,error:new(e??_i)(s.issues.map(i=>Ft(i,n,Mt())))}:{success:!0,data:s.value}},Rp=ma(Ei),fa=e=>async(t,r,a)=>{const n=a?Object.assign(a,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>Ft(i,n,Mt())))}:{success:!0,data:s.value}},Op=fa(Ei),Dp=e=>(t,r,a)=>{const n=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Yo(e)(t,r,n)},Ap=e=>(t,r,a)=>Yo(e)(t,r,a),Ip=e=>async(t,r,a)=>{const n=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return Ko(e)(t,r,n)},Lp=e=>async(t,r,a)=>Ko(e)(t,r,a),zp=e=>(t,r,a)=>{const n=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return ma(e)(t,r,n)},Mp=e=>(t,r,a)=>ma(e)(t,r,a),Fp=e=>async(t,r,a)=>{const n=a?Object.assign(a,{direction:"backward"}):{direction:"backward"};return fa(e)(t,r,n)},Vp=e=>async(t,r,a)=>fa(e)(t,r,a),dr=de("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Bp=de("$ZodCheckMaxLength",(e,t)=>{var r;dr.init(e,t),(r=e._zod.def).when??(r.when=a=>{const n=a.value;return!Zo(n)&&n.length!==void 0}),e._zod.onattach.push(a=>{const n=a._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(a._zod.bag.maximum=t.maximum)}),e._zod.check=a=>{const n=a.value;if(n.length<=t.maximum)return;const s=Go(n);a.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Up=de("$ZodCheckMinLength",(e,t)=>{var r;dr.init(e,t),(r=e._zod.def).when??(r.when=a=>{const n=a.value;return!Zo(n)&&n.length!==void 0}),e._zod.onattach.push(a=>{const n=a._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(a._zod.bag.minimum=t.minimum)}),e._zod.check=a=>{const n=a.value;if(n.length>=t.minimum)return;const s=Go(n);a.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:n,inst:e,continue:!t.abort})}}),Hp=de("$ZodCheckLengthEquals",(e,t)=>{var r;dr.init(e,t),(r=e._zod.def).when??(r.when=a=>{const n=a.value;return!Zo(n)&&n.length!==void 0}),e._zod.onattach.push(a=>{const n=a._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=a=>{const n=a.value,s=n.length;if(s===t.length)return;const i=Go(n),l=s>t.length;a.issues.push({origin:i,...l?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:a.value,inst:e,continue:!t.abort})}}),Wp=de("$ZodCheckOverwrite",(e,t)=>{dr.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}}),qp={major:4,minor:3,patch:6},Oe=de("$ZodType",(e,t)=>{var r,a;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=qp;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const s of n)for(const i of s._zod.onattach)i(e);if(n.length===0)(a=e._zod).deferred??(a.deferred=[]),(r=e._zod.deferred)==null||r.push(()=>{e._zod.run=e._zod.parse});else{const s=(l,c,d)=>{let u=Qt(l),p;for(const m of c){if(m._zod.def.when){if(!m._zod.def.when(l))continue}else if(u)continue;const x=l.issues.length,g=m._zod.check(l);if(g instanceof Promise&&(d==null?void 0:d.async)===!1)throw new er;if(p||g instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await g,l.issues.length!==x&&(u||(u=Qt(l,x)))});else{if(l.issues.length===x)continue;u||(u=Qt(l,x))}}return p?p.then(()=>l):l},i=(l,c,d)=>{if(Qt(l))return l.aborted=!0,l;const u=s(c,n,d);if(u instanceof Promise){if(d.async===!1)throw new er;return u.then(p=>e._zod.parse(p,d))}return e._zod.parse(u,d)};e._zod.run=(l,c)=>{if(c.skipChecks)return e._zod.parse(l,c);if(c.direction==="backward"){const u=e._zod.parse({value:l.value,issues:[]},{...c,skipChecks:!0});return u instanceof Promise?u.then(p=>i(p,l,c)):i(u,l,c)}const d=e._zod.parse(l,c);if(d instanceof Promise){if(c.async===!1)throw new er;return d.then(u=>s(u,n,c))}return s(d,n,c)}}be(e,"~standard",()=>({validate:s=>{var i;try{const l=Rp(e,s);return l.success?{value:l.data}:{issues:(i=l.error)==null?void 0:i.issues}}catch{return Op(e,s).then(l=>{var c;return l.success?{value:l.data}:{issues:(c=l.error)==null?void 0:c.issues}})}},vendor:"zod",version:1}))}),Zp=de("$ZodUnknown",(e,t)=>{Oe.init(e,t),e._zod.parse=r=>r});function ss(e,t,r){e.issues.length&&t.issues.push(...Pp(r,e.issues)),t.value[r]=e.value}const Xp=de("$ZodArray",(e,t)=>{Oe.init(e,t),e._zod.parse=(r,a)=>{const n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);const s=[];for(let i=0;i<n.length;i++){const l=n[i],c=t.element._zod.run({value:l,issues:[]},a);c instanceof Promise?s.push(c.then(d=>ss(d,r,i))):ss(c,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function is(e,t,r,a){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const n=e.filter(s=>!Qt(s));return n.length===1?(t.value=n[0].value,n[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(s=>s.issues.map(i=>Ft(i,a,Mt())))}),t)}const Gp=de("$ZodUnion",(e,t)=>{Oe.init(e,t),be(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),be(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),be(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),be(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(s=>s._zod.pattern);return new RegExp(`^(${n.map(s=>Xo(s.source)).join("|")})$`)}});const r=t.options.length===1,a=t.options[0]._zod.run;e._zod.parse=(n,s)=>{if(r)return a(n,s);let i=!1;const l=[];for(const c of t.options){const d=c._zod.run({value:n.value,issues:[]},s);if(d instanceof Promise)l.push(d),i=!0;else{if(d.issues.length===0)return d;l.push(d)}}return i?Promise.all(l).then(c=>is(c,n,e,s)):is(l,n,e,s)}}),Yp=de("$ZodIntersection",(e,t)=>{Oe.init(e,t),e._zod.parse=(r,a)=>{const n=r.value,s=t.left._zod.run({value:n,issues:[]},a),i=t.right._zod.run({value:n,issues:[]},a);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([l,c])=>ls(r,l,c)):ls(r,s,i)}});function wo(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(yo(e)&&yo(t)){const r=Object.keys(t),a=Object.keys(e).filter(s=>r.indexOf(s)!==-1),n={...e,...t};for(const s of a){const i=wo(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n[s]=i.data}return{valid:!0,data:n}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let a=0;a<e.length;a++){const n=e[a],s=t[a],i=wo(n,s);if(!i.valid)return{valid:!1,mergeErrorPath:[a,...i.mergeErrorPath]};r.push(i.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function ls(e,t,r){const a=new Map;let n;for(const l of t.issues)if(l.code==="unrecognized_keys"){n??(n=l);for(const c of l.keys)a.has(c)||a.set(c,{}),a.get(c).l=!0}else e.issues.push(l);for(const l of r.issues)if(l.code==="unrecognized_keys")for(const c of l.keys)a.has(c)||a.set(c,{}),a.get(c).r=!0;else e.issues.push(l);const s=[...a].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(s.length&&n&&e.issues.push({...n,keys:s}),Qt(e))return e;const i=wo(t.value,r.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const Kp=de("$ZodTransform",(e,t)=>{Oe.init(e,t),e._zod.parse=(r,a)=>{if(a.direction==="backward")throw new Ni(e.constructor.name);const n=t.transform(r.value,r);if(a.async)return(n instanceof Promise?n:Promise.resolve(n)).then(s=>(r.value=s,r));if(n instanceof Promise)throw new er;return r.value=n,r}});function cs(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const Pi=de("$ZodOptional",(e,t)=>{Oe.init(e,t),e._zod.optin="optional",e._zod.optout="optional",be(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),be(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Xo(r.source)})?$`):void 0}),e._zod.parse=(r,a)=>{if(t.innerType._zod.optin==="optional"){const n=t.innerType._zod.run(r,a);return n instanceof Promise?n.then(s=>cs(s,r.value)):cs(n,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,a)}}),Jp=de("$ZodExactOptional",(e,t)=>{Pi.init(e,t),be(e._zod,"values",()=>t.innerType._zod.values),be(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(r,a)=>t.innerType._zod.run(r,a)}),Qp=de("$ZodNullable",(e,t)=>{Oe.init(e,t),be(e._zod,"optin",()=>t.innerType._zod.optin),be(e._zod,"optout",()=>t.innerType._zod.optout),be(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Xo(r.source)}|null)$`):void 0}),be(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,a)=>r.value===null?r:t.innerType._zod.run(r,a)}),em=de("$ZodDefault",(e,t)=>{Oe.init(e,t),e._zod.optin="optional",be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,a)=>{if(a.direction==="backward")return t.innerType._zod.run(r,a);if(r.value===void 0)return r.value=t.defaultValue,r;const n=t.innerType._zod.run(r,a);return n instanceof Promise?n.then(s=>ds(s,t)):ds(n,t)}});function ds(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const tm=de("$ZodPrefault",(e,t)=>{Oe.init(e,t),e._zod.optin="optional",be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,a)=>(a.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,a))}),rm=de("$ZodNonOptional",(e,t)=>{Oe.init(e,t),be(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(a=>a!==void 0)):void 0}),e._zod.parse=(r,a)=>{const n=t.innerType._zod.run(r,a);return n instanceof Promise?n.then(s=>us(s,e)):us(n,e)}});function us(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const am=de("$ZodCatch",(e,t)=>{Oe.init(e,t),be(e._zod,"optin",()=>t.innerType._zod.optin),be(e._zod,"optout",()=>t.innerType._zod.optout),be(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,a)=>{if(a.direction==="backward")return t.innerType._zod.run(r,a);const n=t.innerType._zod.run(r,a);return n instanceof Promise?n.then(s=>(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(i=>Ft(i,a,Mt()))},input:r.value}),r.issues=[]),r)):(r.value=n.value,n.issues.length&&(r.value=t.catchValue({...r,error:{issues:n.issues.map(s=>Ft(s,a,Mt()))},input:r.value}),r.issues=[]),r)}}),om=de("$ZodPipe",(e,t)=>{Oe.init(e,t),be(e._zod,"values",()=>t.in._zod.values),be(e._zod,"optin",()=>t.in._zod.optin),be(e._zod,"optout",()=>t.out._zod.optout),be(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,a)=>{if(a.direction==="backward"){const s=t.out._zod.run(r,a);return s instanceof Promise?s.then(i=>Ar(i,t.in,a)):Ar(s,t.in,a)}const n=t.in._zod.run(r,a);return n instanceof Promise?n.then(s=>Ar(s,t.out,a)):Ar(n,t.out,a)}});function Ar(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const nm=de("$ZodReadonly",(e,t)=>{Oe.init(e,t),be(e._zod,"propValues",()=>t.innerType._zod.propValues),be(e._zod,"values",()=>t.innerType._zod.values),be(e._zod,"optin",()=>{var r,a;return(a=(r=t.innerType)==null?void 0:r._zod)==null?void 0:a.optin}),be(e._zod,"optout",()=>{var r,a;return(a=(r=t.innerType)==null?void 0:r._zod)==null?void 0:a.optout}),e._zod.parse=(r,a)=>{if(a.direction==="backward")return t.innerType._zod.run(r,a);const n=t.innerType._zod.run(r,a);return n instanceof Promise?n.then(ps):ps(n)}});function ps(e){return e.value=Object.freeze(e.value),e}const sm=de("$ZodCustom",(e,t)=>{dr.init(e,t),Oe.init(e,t),e._zod.parse=(r,a)=>r,e._zod.check=r=>{const a=r.value,n=t.fn(a);if(n instanceof Promise)return n.then(s=>ms(s,r,a,e));ms(n,r,a,e)}});function ms(e,t,r,a){if(!e){const n={code:"custom",input:r,inst:a,path:[...a._zod.def.path??[]],continue:!a._zod.def.abort};a._zod.def.params&&(n.params=a._zod.def.params),t.issues.push(yr(n))}}var fs;class im{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const a=r[0];return this._map.set(t,a),a&&typeof a=="object"&&"id"in a&&this._idmap.set(a.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const a={...this.get(r)??{}};delete a.id;const n={...a,...this._map.get(t)};return Object.keys(n).length?n:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function lm(){return new im}(fs=globalThis).__zod_globalRegistry??(fs.__zod_globalRegistry=lm());const vr=globalThis.__zod_globalRegistry;function cm(e){return new e({type:"unknown"})}function dm(e,t){return new Bp({check:"max_length",...Tt(t),maximum:e})}function hs(e,t){return new Up({check:"min_length",...Tt(t),minimum:e})}function um(e,t){return new Hp({check:"length_equals",...Tt(t),length:e})}function pm(e){return new Wp({check:"overwrite",tx:e})}function mm(e,t,r){return new e({type:"array",element:t,...Tt(r)})}function fm(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Tt(r)})}function hm(e){const t=xm(r=>(r.addIssue=a=>{if(typeof a=="string")r.issues.push(yr(a,r.value,t._zod.def));else{const n=a;n.fatal&&(n.continue=!1),n.code??(n.code="custom"),n.input??(n.input=r.value),n.inst??(n.inst=t),n.continue??(n.continue=!t._zod.def.abort),r.issues.push(yr(n))}},e(r.value,r)));return t}function xm(e,t){const r=new dr({check:"custom",...Tt(t)});return r._zod.check=e,r}function Ti(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??vr,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function Re(e,t,r={path:[],schemaPath:[]}){var a,n,s;const i=e._zod.def,l=t.seen.get(e);if(l)return l.count++,r.schemaPath.includes(e)&&(l.cycle=r.path),l.schema;const c={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,c);const d=(n=(a=e._zod).toJSONSchema)==null?void 0:n.call(a);if(d)c.schema=d;else{const p={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,c.schema,p);else{const x=c.schema,g=t.processors[i.type];if(!g)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);g(e,t,x,p)}const m=e._zod.parent;m&&(c.ref||(c.ref=m),Re(m,t,p),t.seen.get(m).isParent=!0)}const u=t.metadataRegistry.get(e);return u&&Object.assign(c.schema,u),t.io==="input"&&$e(e)&&(delete c.schema.examples,delete c.schema.default),t.io==="input"&&c.schema._prefault&&((s=c.schema).default??(s.default=c.schema._prefault)),delete c.schema._prefault,t.seen.get(e).schema}function $i(e,t){var r,a,n,s;const i=e.seen.get(t);if(!i)throw new Error("Unprocessed schema. This is a bug in Zod.");const l=new Map;for(const u of e.seen.entries()){const p=(r=e.metadataRegistry.get(u[0]))==null?void 0:r.id;if(p){const m=l.get(p);if(m&&m!==u[0])throw new Error(`Duplicate schema id "${p}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);l.set(p,u[0])}}const c=u=>{var p;const m=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const f=(p=e.external.registry.get(u[0]))==null?void 0:p.id,v=e.external.uri??(j=>j);if(f)return{ref:v(f)};const b=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=b,{defId:b,ref:`${v("__shared")}#/${m}/${b}`}}if(u[1]===i)return{ref:"#"};const x=`#/${m}/`,g=u[1].schema.id??`__schema${e.counter++}`;return{defId:g,ref:x+g}},d=u=>{if(u[1].schema.$ref)return;const p=u[1],{ref:m,defId:x}=c(u);p.def={...p.schema},x&&(p.defId=x);const g=p.schema;for(const f in g)delete g[f];g.$ref=m};if(e.cycles==="throw")for(const u of e.seen.entries()){const p=u[1];if(p.cycle)throw new Error(`Cycle detected: #/${(a=p.cycle)==null?void 0:a.join("/")}/<root>
31
-
32
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of e.seen.entries()){const p=u[1];if(t===u[0]){d(u);continue}if(e.external){const m=(n=e.external.registry.get(u[0]))==null?void 0:n.id;if(t!==u[0]&&m){d(u);continue}}if((s=e.metadataRegistry.get(u[0]))!=null&&s.id){d(u);continue}if(p.cycle){d(u);continue}if(p.count>1&&e.reused==="ref"){d(u);continue}}}function Ri(e,t){var r,a,n;const s=e.seen.get(t);if(!s)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=d=>{const u=e.seen.get(d);if(u.ref===null)return;const p=u.def??u.schema,m={...p},x=u.ref;if(u.ref=null,x){i(x);const f=e.seen.get(x),v=f.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(p.allOf=p.allOf??[],p.allOf.push(v)):Object.assign(p,v),Object.assign(p,m),d._zod.parent===x)for(const b in p)b==="$ref"||b==="allOf"||b in m||delete p[b];if(v.$ref&&f.def)for(const b in p)b==="$ref"||b==="allOf"||b in f.def&&JSON.stringify(p[b])===JSON.stringify(f.def[b])&&delete p[b]}const g=d._zod.parent;if(g&&g!==x){i(g);const f=e.seen.get(g);if(f!=null&&f.schema.$ref&&(p.$ref=f.schema.$ref,f.def))for(const v in p)v==="$ref"||v==="allOf"||v in f.def&&JSON.stringify(p[v])===JSON.stringify(f.def[v])&&delete p[v]}e.override({zodSchema:d,jsonSchema:p,path:u.path??[]})};for(const d of[...e.seen.entries()].reverse())i(d[0]);const l={};if(e.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?l.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?l.$schema="http://json-schema.org/draft-04/schema#":e.target,(r=e.external)!=null&&r.uri){const d=(a=e.external.registry.get(t))==null?void 0:a.id;if(!d)throw new Error("Schema is missing an `id` property");l.$id=e.external.uri(d)}Object.assign(l,s.def??s.schema);const c=((n=e.external)==null?void 0:n.defs)??{};for(const d of e.seen.entries()){const u=d[1];u.def&&u.defId&&(c[u.defId]=u.def)}e.external||Object.keys(c).length>0&&(e.target==="draft-2020-12"?l.$defs=c:l.definitions=c);try{const d=JSON.parse(JSON.stringify(l));return Object.defineProperty(d,"~standard",{value:{...t["~standard"],jsonSchema:{input:Yr(t,"input",e.processors),output:Yr(t,"output",e.processors)}},enumerable:!1,writable:!1}),d}catch{throw new Error("Error converting schema to JSON.")}}function $e(e,t){const r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);const a=e._zod.def;if(a.type==="transform")return!0;if(a.type==="array")return $e(a.element,r);if(a.type==="set")return $e(a.valueType,r);if(a.type==="lazy")return $e(a.getter(),r);if(a.type==="promise"||a.type==="optional"||a.type==="nonoptional"||a.type==="nullable"||a.type==="readonly"||a.type==="default"||a.type==="prefault")return $e(a.innerType,r);if(a.type==="intersection")return $e(a.left,r)||$e(a.right,r);if(a.type==="record"||a.type==="map")return $e(a.keyType,r)||$e(a.valueType,r);if(a.type==="pipe")return $e(a.in,r)||$e(a.out,r);if(a.type==="object"){for(const n in a.shape)if($e(a.shape[n],r))return!0;return!1}if(a.type==="union"){for(const n of a.options)if($e(n,r))return!0;return!1}if(a.type==="tuple"){for(const n of a.items)if($e(n,r))return!0;return!!(a.rest&&$e(a.rest,r))}return!1}const gm=(e,t={})=>r=>{const a=Ti({...r,processors:t});return Re(e,a),$i(a,e),Ri(a,e)},Yr=(e,t,r={})=>a=>{const{libraryOptions:n,target:s}=a??{},i=Ti({...n??{},target:s,io:t,processors:r});return Re(e,i),$i(i,e),Ri(i,e)},vm=(e,t,r,a)=>{},bm=(e,t,r,a)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},ym=(e,t,r,a)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},wm=(e,t,r,a)=>{const n=r,s=e._zod.def,{minimum:i,maximum:l}=e._zod.bag;typeof i=="number"&&(n.minItems=i),typeof l=="number"&&(n.maxItems=l),n.type="array",n.items=Re(s.element,t,{...a,path:[...a.path,"items"]})},jm=(e,t,r,a)=>{const n=e._zod.def,s=n.inclusive===!1,i=n.options.map((l,c)=>Re(l,t,{...a,path:[...a.path,s?"oneOf":"anyOf",c]}));s?r.oneOf=i:r.anyOf=i},Nm=(e,t,r,a)=>{const n=e._zod.def,s=Re(n.left,t,{...a,path:[...a.path,"allOf",0]}),i=Re(n.right,t,{...a,path:[...a.path,"allOf",1]}),l=d=>"allOf"in d&&Object.keys(d).length===1,c=[...l(s)?s.allOf:[s],...l(i)?i.allOf:[i]];r.allOf=c},Cm=(e,t,r,a)=>{const n=e._zod.def,s=Re(n.innerType,t,a),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=n.innerType,r.nullable=!0):r.anyOf=[s,{type:"null"}]},Sm=(e,t,r,a)=>{const n=e._zod.def;Re(n.innerType,t,a);const s=t.seen.get(e);s.ref=n.innerType},km=(e,t,r,a)=>{const n=e._zod.def;Re(n.innerType,t,a);const s=t.seen.get(e);s.ref=n.innerType,r.default=JSON.parse(JSON.stringify(n.defaultValue))},_m=(e,t,r,a)=>{const n=e._zod.def;Re(n.innerType,t,a);const s=t.seen.get(e);s.ref=n.innerType,t.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(n.defaultValue)))},Em=(e,t,r,a)=>{const n=e._zod.def;Re(n.innerType,t,a);const s=t.seen.get(e);s.ref=n.innerType;let i;try{i=n.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=i},Pm=(e,t,r,a)=>{const n=e._zod.def,s=t.io==="input"?n.in._zod.def.type==="transform"?n.out:n.in:n.out;Re(s,t,a);const i=t.seen.get(e);i.ref=s},Tm=(e,t,r,a)=>{const n=e._zod.def;Re(n.innerType,t,a);const s=t.seen.get(e);s.ref=n.innerType,r.readOnly=!0},Oi=(e,t,r,a)=>{const n=e._zod.def;Re(n.innerType,t,a);const s=t.seen.get(e);s.ref=n.innerType},$m=(e,t)=>{_i.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>$p(e,r)},flatten:{value:r=>Tp(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,bo,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,bo,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ke=de("ZodError",$m,{Parent:Error}),Rm=Yo(Ke),Om=Ko(Ke),Dm=ma(Ke),Am=fa(Ke),Im=Dp(Ke),Lm=Ap(Ke),zm=Ip(Ke),Mm=Lp(Ke),Fm=zp(Ke),Vm=Mp(Ke),Bm=Fp(Ke),Um=Vp(Ke),De=de("ZodType",(e,t)=>(Oe.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Yr(e,"input"),output:Yr(e,"output")}}),e.toJSONSchema=gm(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(_p(t,{checks:[...t.checks??[],...r.map(a=>typeof a=="function"?{_zod:{check:a,def:{check:"custom"},onattach:[]}}:a)]}),{parent:!0}),e.with=e.check,e.clone=(r,a)=>Ep(e,r,a),e.brand=()=>e,e.register=(r,a)=>(r.add(e,a),e),e.parse=(r,a)=>Rm(e,r,a,{callee:e.parse}),e.safeParse=(r,a)=>Dm(e,r,a),e.parseAsync=async(r,a)=>Om(e,r,a,{callee:e.parseAsync}),e.safeParseAsync=async(r,a)=>Am(e,r,a),e.spa=e.safeParseAsync,e.encode=(r,a)=>Im(e,r,a),e.decode=(r,a)=>Lm(e,r,a),e.encodeAsync=async(r,a)=>zm(e,r,a),e.decodeAsync=async(r,a)=>Mm(e,r,a),e.safeEncode=(r,a)=>Fm(e,r,a),e.safeDecode=(r,a)=>Vm(e,r,a),e.safeEncodeAsync=async(r,a)=>Bm(e,r,a),e.safeDecodeAsync=async(r,a)=>Um(e,r,a),e.refine=(r,a)=>e.check(gf(r,a)),e.superRefine=r=>e.check(vf(r)),e.overwrite=r=>e.check(pm(r)),e.optional=()=>xs(e),e.exactOptional=()=>rf(e),e.nullable=()=>gs(e),e.nullish=()=>xs(gs(e)),e.nonoptional=r=>df(e,r),e.array=()=>Zm(e),e.or=r=>Gm([e,r]),e.and=r=>Km(e,r),e.transform=r=>vs(e,Qm(r)),e.default=r=>nf(e,r),e.prefault=r=>lf(e,r),e.catch=r=>pf(e,r),e.pipe=r=>vs(e,r),e.readonly=()=>hf(e),e.describe=r=>{const a=e.clone();return vr.add(a,{description:r}),a},Object.defineProperty(e,"description",{get(){var r;return(r=vr.get(e))==null?void 0:r.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return vr.get(e);const a=e.clone();return vr.add(a,r[0]),a},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=r=>r(e),e)),Hm=de("ZodUnknown",(e,t)=>{Zp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>vm()});function Wm(){return cm(Hm)}const qm=de("ZodArray",(e,t)=>{Xp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>wm(e,r,a,n),e.element=t.element,e.min=(r,a)=>e.check(hs(r,a)),e.nonempty=r=>e.check(hs(1,r)),e.max=(r,a)=>e.check(dm(r,a)),e.length=(r,a)=>e.check(um(r,a)),e.unwrap=()=>e.element});function Zm(e,t){return mm(qm,e,t)}const Xm=de("ZodUnion",(e,t)=>{Gp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>jm(e,r,a,n),e.options=t.options});function Gm(e,t){return new Xm({type:"union",options:e,...Tt(t)})}const Ym=de("ZodIntersection",(e,t)=>{Yp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Nm(e,r,a,n)});function Km(e,t){return new Ym({type:"intersection",left:e,right:t})}const Jm=de("ZodTransform",(e,t)=>{Kp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>ym(e,r),e._zod.parse=(r,a)=>{if(a.direction==="backward")throw new Ni(e.constructor.name);r.addIssue=s=>{if(typeof s=="string")r.issues.push(yr(s,r.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=e),r.issues.push(yr(i))}};const n=t.transform(r.value,r);return n instanceof Promise?n.then(s=>(r.value=s,r)):(r.value=n,r)}});function Qm(e){return new Jm({type:"transform",transform:e})}const ef=de("ZodOptional",(e,t)=>{Pi.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Oi(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function xs(e){return new ef({type:"optional",innerType:e})}const tf=de("ZodExactOptional",(e,t)=>{Jp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Oi(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function rf(e){return new tf({type:"optional",innerType:e})}const af=de("ZodNullable",(e,t)=>{Qp.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Cm(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function gs(e){return new af({type:"nullable",innerType:e})}const of=de("ZodDefault",(e,t)=>{em.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>km(e,r,a,n),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function nf(e,t){return new of({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Si(t)}})}const sf=de("ZodPrefault",(e,t)=>{tm.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>_m(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function lf(e,t){return new sf({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Si(t)}})}const cf=de("ZodNonOptional",(e,t)=>{rm.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Sm(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function df(e,t){return new cf({type:"nonoptional",innerType:e,...Tt(t)})}const uf=de("ZodCatch",(e,t)=>{am.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Em(e,r,a,n),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function pf(e,t){return new uf({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const mf=de("ZodPipe",(e,t)=>{om.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Pm(e,r,a,n),e.in=t.in,e.out=t.out});function vs(e,t){return new mf({type:"pipe",in:e,out:t})}const ff=de("ZodReadonly",(e,t)=>{nm.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>Tm(e,r,a,n),e.unwrap=()=>e._zod.def.innerType});function hf(e){return new ff({type:"readonly",innerType:e})}const xf=de("ZodCustom",(e,t)=>{sm.init(e,t),De.init(e,t),e._zod.processJSONSchema=(r,a,n)=>bm(e,r)});function gf(e,t={}){return fm(xf,e,t)}function vf(e){return hm(e)}const bf={custom:"custom"},rt=(e,t,r={})=>{if(!e)return!0;if("and"in e||"or"in e)return"and"in e&&Array.isArray(e.and)?e.and.every(d=>rt(d,t,r)):"or"in e&&Array.isArray(e.or)?e.or.some(d=>rt(d,t,r)):!0;const a=e;if(!a.campoId)return!0;const n=a.source==="evento"?r[a.campoId]:t[a.campoId],s=n!=null?String(n):"",i=a.valor!==void 0?String(a.valor):"",l=parseFloat(s),c=parseFloat(i);switch(a.operador){case"igual":return s===i;case"diferente":return s!==i;case"vazio":return!s;case"naoVazio":return!!s;case"contem":return s.includes(i);case"naoContem":return!s.includes(i);case"maiorQue":return!isNaN(l)&&!isNaN(c)&&l>c;case"menorQue":return!isNaN(l)&&!isNaN(c)&&l<c;case"maiorOuIgual":return!isNaN(l)&&!isNaN(c)&&l>=c;case"menorOuIgual":return!isNaN(l)&&!isNaN(c)&&l<=c;default:return!0}},yf=/^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/,wf=/^\(?\d{2}\)?\s?\d{4,5}-?\d{4}$/,jf=/^\d{5}-?\d{3}$/,Nf=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,eo=(e,t,r={})=>{const a=e.validacao;if(e.tipo===O.CHECKBOX||e.tipo===O.SWITCH)return e.obrigatorio&&!t?"Campo obrigatório":void 0;if(e.tipo===O.SLIDER){const s=t!==void 0?Number(t):NaN;return e.obrigatorio&&isNaN(s)?"Campo obrigatório":isNaN(s)?void 0:(a==null?void 0:a.min)!==void 0&&s<a.min?`Valor mínimo: ${a.min}`:(a==null?void 0:a.max)!==void 0&&s>a.max?`Valor máximo: ${a.max}`:void 0}if(e.tipo===O.RATING){const s=t!==void 0?Number(t):0;return e.obrigatorio&&(!s||s<1)?"Avaliação obrigatória":void 0}if(e.tipo===O.DATE_RANGE){const s=t;if(e.obrigatorio){if(!(s!=null&&s.start))return"Data inicial obrigatória";if(!(s!=null&&s.end))return"Data final obrigatória"}return s!=null&&s.start&&s!=null&&s.end&&s.start>s.end?"A data inicial deve ser menor ou igual à data final":void 0}if(e.tipo===O.PARTICIPATION_TYPE){if(!e.obrigatorio)return;const s=t;return s!=null&&s.tipo?s.tipo==="por_dia"&&!s.data?"Selecione um dia para participar":"genero"in(s??{})&&!(s!=null&&s.genero)?"Selecione o sexo":void 0:"Selecione o tipo de participação"}if(e.tipo===O.CHECKBOX_GROUP){const s=Array.isArray(t)?t:[];return e.obrigatorio&&s.length===0?"Selecione pelo menos uma opção":void 0}if(e.tipo===O.FILE)return e.obrigatorio&&!t?"Arquivo obrigatório":void 0;if(e.tipo===O.NUMBER){const s=t!=null?String(t):"";if(e.obrigatorio&&!s)return"Campo obrigatório";if(!s)return;const i=Number(s);return isNaN(i)?"Deve ser um número":(a==null?void 0:a.min)!==void 0&&i<a.min?`Valor mínimo: ${a.min}`:(a==null?void 0:a.max)!==void 0&&i>a.max?`Valor máximo: ${a.max}`:void 0}const n=t!=null?String(t):"";if(e.obrigatorio&&!n.trim())return"Campo obrigatório";if(n){if(e.tipo===O.EMAIL&&!Nf.test(n))return"E-mail inválido";if(e.tipo===O.CPF&&!yf.test(n))return"CPF inválido";if(e.tipo===O.TELEFONE&&!wf.test(n))return"Telefone inválido";if(e.tipo===O.CEP&&!jf.test(n))return"CEP inválido";if(a!=null&&a.minLength&&n.length<a.minLength)return`Mínimo ${a.minLength} caracteres`;if(a!=null&&a.maxLength&&n.length>a.maxLength)return`Máximo ${a.maxLength} caracteres`;if((e.tipo===O.DATE||e.tipo===O.DATETIME)&&n){if(a!=null&&a.minDate&&n<a.minDate)return`Data mínima: ${a.minDate}`;if(a!=null&&a.maxDate&&n>a.maxDate)return`Data máxima: ${a.maxDate}`}if((e.tipo===O.DATE||e.tipo===O.DATETIME)&&n&&((a==null?void 0:a.minAge)!=null||(a==null?void 0:a.maxAge)!=null)){const s=n.split("T")[0],i=new Date(s+"T00:00:00"),l=r["evento.dataInicioEvento"],c=l?new Date(l.split("T")[0]+"T00:00:00"):new Date;let d=c.getFullYear()-i.getFullYear();const u=c.getMonth()-i.getMonth();if((u<0||u===0&&c.getDate()<i.getDate())&&d--,a.minAge!=null&&d<a.minAge)return`Idade mínima: ${a.minAge} ano${a.minAge!==1?"s":""}`;if(a.maxAge!=null&&d>a.maxAge)return`Idade máxima: ${a.maxAge} ano${a.maxAge!==1?"s":""}`}if(a!=null&&a.regex)try{if(!new RegExp(a.regex).test(n))return a.regexMessage||"Formato inválido"}catch{}}},Ir=(e,t,r)=>{const a=t.split(".");let n=e;for(let s=0;s<a.length-1;s++){const i=a[s];(n[i]==null||typeof n[i]!="object")&&(n[i]={}),n=n[i]}n[a[a.length-1]]=r},Cf=e=>[...e.containers].sort((t,r)=>t.ordem-r.ordem).filter(t=>!t.repeatable).flatMap(t=>[...t.campos].sort((r,a)=>r.ordem-a.ordem)),Di=(e,t={},r={})=>async a=>{var n,s,i;const l=Cf(e),c={};for(const p of l){if(!rt(p.condicional,a,t)||p.tipo===O.HIDDEN)continue;if(p.tipo===O.FIELD_ARRAY){const x=Array.isArray(a[p.nome])?a[p.nome]:[];p.obrigatorio&&x.length===0?c[p.nome]={type:"custom",message:"Adicione pelo menos um item"}:p.minItems&&x.length<p.minItems&&(c[p.nome]={type:"custom",message:`Mínimo de ${p.minItems} item${p.minItems!==1?"s":""}`});for(let g=0;g<x.length;g++){const f=x[g];for(const v of p.subFields??[]){const b=eo(v,f[v.nome],t);if(b){Ir(c,`${p.nome}.${g}.${v.nome}`,{type:"custom",message:b});continue}if((n=v.validate)!=null&&n.length){const j=await qr(v.validate,v.nome,f[v.nome],f,t,r);j&&Ir(c,`${p.nome}.${g}.${v.nome}`,{type:"custom",message:j})}}}continue}const m=eo(p,a[p.nome],t);if(m&&(c[p.nome]={type:"custom",message:m}),!c[p.nome]&&(s=p.validate)!=null&&s.length){const x=await qr(p.validate,p.nome,a[p.nome],a,t,r);x&&(c[p.nome]={type:"custom",message:x})}}const d=e.containers.filter(p=>p.repeatable&&p.nome);for(const p of d){const m=Array.isArray(a[p.nome])?a[p.nome]:[];for(let x=0;x<m.length;x++){const g=m[x];for(const f of p.campos){if(!rt(f.condicional,g,t)||f.tipo===O.HIDDEN)continue;const v=eo(f,g[f.nome],t);if(v){Ir(c,`${p.nome}.${x}.${f.nome}`,{type:"custom",message:v});continue}if((i=f.validate)!=null&&i.length){const b=await qr(f.validate,f.nome,g[f.nome],g,t,r);b&&Ir(c,`${p.nome}.${x}.${f.nome}`,{type:"custom",message:b})}}}}const u=Object.keys(c).length>0;return{values:u?{}:a,errors:u?c:{}}},qr=async(e,t,r,a,n,s)=>{var i;let l=Wm();for(const d of e){const u=s[d.type];if(!u)continue;const p=u,m=d;l=l.superRefine(async(x,g)=>{const f=await p(x,a,m,n);f&&g.addIssue({code:bf.custom,message:m.message??f})})}const c=await l.safeParseAsync(r);if(!c.success)return(i=c.error.issues[0])==null?void 0:i.message},Ai=(e,t={},r={})=>async a=>{var n;const s={},i=[...e.containers].sort((l,c)=>l.ordem-c.ordem).flatMap(l=>[...l.campos].sort((c,d)=>c.ordem-d.ordem));for(const l of i){if(!((n=l.warn)!=null&&n.length)||!rt(l.condicional,a,t))continue;const c=await qr(l.warn,l.nome,a[l.nome],a,t,r);c&&(s[l.nome]=c)}return s},Sf=/\{\{\s*(?:event|evento)\.([a-zA-Z0-9_.]+)\s*\}\}/g,Xe=(e,t)=>e?e.replace(Sf,(r,a)=>t[`evento.${a}`]??t[a]??r):e??"",kf=(e,t)=>({...e,label:Xe(e.label,t)}),Ii=(e,t)=>{var r;return{...e,label:Xe(e.label,t),placeholder:Xe(e.placeholder,t),hint:Xe(e.hint,t),defaultValue:typeof e.defaultValue=="string"?Xe(e.defaultValue,t):e.defaultValue,opcoes:(r=e.opcoes)==null?void 0:r.map(a=>kf(a,t))}},ha=(e,t)=>({...e,titulo:Xe(e.titulo,t),descricao:Xe(e.descricao,t),campos:e.campos.map(r=>Ii(r,t))}),Li=(e,t)=>({...e,titulo:Xe(e.titulo,t),descricao:Xe(e.descricao,t),containers:e.containers.map(r=>ha(r,t))}),Jo=E.createContext({}),dt=()=>E.useContext(Jo),Be=({name:e,control:t,placeholder:r,type:a="text",disabled:n,readOnly:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t}),d=!!c.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx("input",{...l,value:l.value??"",type:a,placeholder:r,disabled:n,readOnly:s,className:`sfr-input${d?" sfr-input--error":""}`,"data-sfr-field":"text"}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"sfr-error",children:c.error.message})]})},xa=({name:e,control:t,placeholder:r,disabled:a,readOnly:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsx("textarea",{...i,value:i.value??"",placeholder:r,disabled:a,readOnly:n,rows:3,className:`sfr-textarea${l.error?" sfr-input--error":""}`,"data-sfr-field":"textarea"}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},ga=({name:e,control:t,placeholder:r,options:a,disabled:n,readOnly:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("select",{...l,value:l.value??"",disabled:n||s,className:`sfr-select${c.error?" sfr-input--error":""}`,"data-sfr-field":"select",children:[r&&o.jsx("option",{value:"",children:r}),!r&&o.jsx("option",{value:"",children:"Selecione..."}),a.map(d=>o.jsx("option",{value:d.valor,disabled:d.disabled,children:d.label},d.valor))]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"sfr-error",children:c.error.message})]})},va=({name:e,control:t,label:r,disabled:a,readOnly:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t});return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"sfr-checkbox-label","data-sfr-field":"checkbox",children:[o.jsx("input",{type:"checkbox",name:i.name,checked:!!i.value,onChange:c=>!n&&i.onChange(c.target.checked),onBlur:i.onBlur,onKeyDown:c=>{n&&c.key===" "&&c.preventDefault()},disabled:a,readOnly:n,className:"sfr-checkbox"}),r&&o.jsx("span",{className:"sfr-checkbox-text",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},Qo=({name:e,control:t,options:r,disabled:a})=>{var n;const{field:s,fieldState:i}=ce.useController({name:e,control:t}),l=Array.isArray(s.value)?s.value:[],c=d=>{const u=l.includes(d)?l.filter(p=>p!==d):[...l,d];s.onChange(u)};return o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:"sfr-checkbox-group","data-sfr-field":"checkbox-group",children:r.map(d=>o.jsxs("label",{className:"sfr-checkbox-label",children:[o.jsx("input",{type:"checkbox",checked:l.includes(d.valor),onChange:()=>c(d.valor),disabled:a||d.disabled,className:"sfr-checkbox"}),o.jsx("span",{className:"sfr-checkbox-text",children:d.label})]},d.valor))}),((n=i.error)==null?void 0:n.message)&&o.jsx("p",{className:"sfr-error",children:i.error.message})]})},en=({name:e,control:t,options:r,visualStyle:a="default",disabled:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t}),c=a==="card";return o.jsxs("div",{className:"space-y-1",children:[o.jsx("div",{className:c?"sfr-radio-cards":"sfr-radio-group","data-sfr-field":"radio","data-style":a,children:r.map(d=>o.jsxs("label",{className:c?"sfr-radio-card":"sfr-radio-label","data-selected":i.value===d.valor?"true":void 0,children:[o.jsx("input",{type:"radio",name:i.name,value:d.valor,checked:i.value===d.valor,onChange:()=>i.onChange(d.valor),onBlur:i.onBlur,disabled:n||d.disabled,className:c?"sfr-radio-card-input":"sfr-radio"}),o.jsx("span",{className:c?"sfr-radio-card-label":"sfr-radio-text",children:d.label})]},d.valor))}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},_f=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),t.toISOString().split("T")[0]},Ef=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),t.toISOString().split("T")[0]},ar=({name:e,control:t,isDatetime:r,disabled:a,readOnly:n,validacao:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t}),d=r?"datetime-local":"date",u=x=>r?x+"T00:00":x,p=(s==null?void 0:s.minAge)!=null?u(_f(s.minAge)):(s==null?void 0:s.maxDate)!=null?u(s.maxDate):void 0,m=(s==null?void 0:s.maxAge)!=null?u(Ef(s.maxAge)):(s==null?void 0:s.minDate)!=null?u(s.minDate):void 0;return o.jsxs("div",{className:"space-y-1",children:[o.jsx("input",{name:l.name,value:l.value??"",onChange:l.onChange,onBlur:l.onBlur,type:d,min:m,max:p,disabled:a,readOnly:n,className:`sfr-input${c.error?" sfr-input--error":""}`,"data-sfr-field":"date"}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"sfr-error",children:c.error.message})]})},bs=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,tn=({name:e,control:t,disabled:r,campo:a,fileTypes:n,maxFileSize:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t}),{uploadFile:d}=dt(),[u,p]=E.useState({status:"idle"}),m=E.useRef(null),[x,g]=E.useState(!1),f=typeof l.value=="string"&&l.value?l.value:null,v=E.useCallback(async N=>{var C;if(n&&n.length>0){const k=((C=N.name.split(".").pop())==null?void 0:C.toLowerCase())??"",_=N.type.toLowerCase();if(!n.some(w=>w.toLowerCase()===k||w.toLowerCase()===_)){p({status:"error",message:`Tipo de arquivo não permitido. Permitidos: ${n.join(", ")}`});return}}if(s&&N.size>s){p({status:"error",message:`Arquivo muito grande. Tamanho máximo: ${bs(s)}`});return}if(!d){p({status:"error",message:"Preview: upload não disponível sem configuração."});return}p({status:"uploading",fileName:N.name,progress:0});try{const k=await d(N,a??e,_=>{p(w=>w.status==="uploading"?{...w,progress:Math.min(100,_)}:w)});l.onChange(k),p({status:"done",uploadId:k,fileName:N.name,size:N.size})}catch{p({status:"error",message:"Falha no upload. Tente novamente."})}},[d,a,e,l,n,s]),b=E.useCallback(N=>{var C;const k=(C=N.target.files)==null?void 0:C[0];k&&v(k),N.target.value=""},[v]),j=E.useCallback(()=>{l.onChange(""),p({status:"idle"}),m.current&&(m.current.value="")},[l]);if(u.status==="done"||u.status==="idle"&&f){const N=u.status==="done"?u.fileName:"Arquivo enviado",C=u.status==="done"?u.size:null;return o.jsxs("div",{className:"sfr-file-upload sfr-file-done","data-sfr-field":"file","data-status":"done",children:[o.jsx("span",{className:"sfr-file-name",children:N}),C!==null&&o.jsx("span",{className:"sfr-file-size",children:bs(C)}),!r&&o.jsx("button",{type:"button",onClick:j,className:"sfr-file-remove","aria-label":"Remover arquivo",children:"✕"})]})}if(u.status==="uploading"){const{fileName:N,progress:C}=u;return o.jsxs("div",{className:"sfr-file-upload sfr-file-uploading","data-sfr-field":"file","data-status":"uploading",children:[o.jsxs("div",{className:"sfr-file-uploading__info",children:[o.jsx("span",{className:"sfr-file-name",children:N}),o.jsxs("span",{className:"sfr-file-progress-pct",children:[C,"%"]})]}),o.jsx("div",{className:"sfr-file-progress-track",children:o.jsx("div",{className:"sfr-file-progress-bar",style:{width:`${C}%`}})})]})}const y=u.status==="error";return o.jsxs("div",{className:"sfr-file-upload","data-sfr-field":"file","data-status":u.status,children:[o.jsxs("div",{role:"button",tabIndex:r?-1:0,"aria-label":"Selecionar arquivo","data-dragging":x||void 0,"data-error":y||void 0,"data-field-error":!!c.error||void 0,"data-disabled":r||void 0,className:"sfr-file-drop",onClick:()=>{var N;return!r&&((N=m.current)==null?void 0:N.click())},onKeyDown:N=>{var C;(N.key==="Enter"||N.key===" ")&&((C=m.current)==null||C.click())},onDragOver:N=>{N.preventDefault(),r||g(!0)},onDragLeave:()=>g(!1),onDrop:r?void 0:N=>{var C;N.preventDefault(),g(!1);const k=(C=N.dataTransfer.files)==null?void 0:C[0];k&&v(k)},onBlur:l.onBlur,children:[o.jsx("input",{ref:m,type:"file",onChange:b,disabled:r,className:"sfr-file-input"}),o.jsx("span",{className:"sfr-file-label",children:x?"Solte o arquivo aqui":"Clique ou arraste um arquivo"})]}),y&&o.jsxs("p",{className:"sfr-error",children:[u.message," · ",o.jsx("button",{type:"button",className:"sfr-error-retry",onClick:()=>p({status:"idle"}),children:"Tentar novamente"})]}),!y&&((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"sfr-error",children:c.error.message})]})},Pf={cpf:e=>e.replace(/\D/g,"").slice(0,11).replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2"),telefone:e=>{const t=e.replace(/\D/g,"").slice(0,11);return t.length<=10?t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{4})(\d)/,"$1-$2"):t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2")},cep:e=>e.replace(/\D/g,"").slice(0,8).replace(/(\d{5})(\d)/,"$1-$2")},Ct=({name:e,control:t,placeholder:r,maskType:a,disabled:n,readOnly:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t}),d=Pf[a||""],u=E.useCallback(p=>{l.onChange(d?d(p.target.value):p.target.value)},[l,d]);return o.jsxs("div",{className:"space-y-1",children:[o.jsx("input",{name:l.name,value:l.value||"",onChange:u,onBlur:l.onBlur,placeholder:r,disabled:n,readOnly:s,className:`sfr-input${c.error?" sfr-input--error":""}`,"data-sfr-field":"masked"}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"sfr-error",children:c.error.message})]})},ba=({name:e,control:t})=>{const{field:r}=ce.useController({name:e,control:t});return o.jsx("input",{type:"hidden",...r,value:r.value??""})},zi=e=>e.replace(/\D/g,""),Tf=e=>{const t=zi(e).slice(0,8);return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5)}`},$f=async(e,t)=>{const r=await fetch(`https://viacep.com.br/ws/${e}/json/`,{signal:t});if(!r.ok)throw new Error("Falha ao consultar CEP");return r.json()},rn=({name:e,control:t,placeholder:r="00000-000",disabled:a,readOnly:n,cepFillMap:s})=>{var i,l;const{field:c,fieldState:d}=ce.useController({name:e,control:t}),{setValue:u}=ce.useFormContext(),{cepLookup:p}=dt(),[m,x]=E.useState("idle"),[g,f]=E.useState(null),v=E.useRef(null);E.useEffect(()=>()=>{var y;(y=v.current)==null||y.abort()},[]);const b=E.useCallback(async()=>{var y;c.onBlur();const N=zi(c.value??"");if(N.length===8){(y=v.current)==null||y.abort(),v.current=new AbortController,x("loading"),f(null);try{let C;if(p){const w=v.current;if(C=await p(N),w.signal.aborted)return}else{const w=await $f(N,v.current.signal);if(w.erro){x("error"),f("CEP não encontrado");return}C={logradouro:w.logradouro,bairro:w.bairro,cidade:w.localidade,estado:w.uf}}if(C.erro){x("error"),f("CEP não encontrado");return}const k=e.includes(".")?`${e.substring(0,e.lastIndexOf("."))}.`:"",_=(w,R,A)=>{if(!A)return;const I=s!=null&&s[w]?`${k}${s[w]}`:`${k}${R}`;u(I,A)};_("logradouro","_address_logradouro",C.logradouro),_("bairro","_address_bairro",C.bairro),_("cidade","_address_cidade",C.cidade),_("estado","_address_estado",C.estado),x("success")}catch(C){if(C instanceof Error&&C.name==="AbortError")return;x("error"),f("Erro ao buscar CEP")}}},[c,p,u,e,s]),j=E.useCallback(y=>{c.onChange(Tf(y.target.value))},[c]);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"sfr-cep-wrapper","data-sfr-field":"cep","data-status":m,children:[o.jsx("input",{name:c.name,value:c.value||"",onChange:j,onBlur:b,placeholder:r,disabled:a,readOnly:n,className:`sfr-input${d.error?" sfr-input--error":""}`}),m==="loading"&&o.jsx("span",{className:"sfr-cep-indicator sfr-cep-loading"}),m==="success"&&o.jsx("span",{className:"sfr-cep-indicator sfr-cep-success"}),m==="error"&&o.jsx("span",{className:"sfr-cep-indicator sfr-cep-error"})]}),(((i=d.error)==null?void 0:i.message)||g)&&o.jsx("p",{className:"sfr-error",children:((l=d.error)==null?void 0:l.message)||g})]})},Rf=({field:e,control:t,nameOverride:r})=>{const a={name:r,control:t,placeholder:e.placeholder};switch(e.tipo){case O.TEXTO:return o.jsx(Be,{...a,type:"text"});case O.EMAIL:return o.jsx(Be,{...a,type:"email"});case O.NUMBER:return o.jsx(Be,{...a,type:"number"});case O.TEXTAREA:return o.jsx(xa,{...a});case O.SELECT:return o.jsx(ga,{...a,options:e.opcoes??[]});case O.RADIO:return o.jsx(en,{...a,options:e.opcoes??[]});case O.CHECKBOX:return o.jsx(va,{name:r,control:t,label:e.label});case O.CHECKBOX_GROUP:return o.jsx(Qo,{...a,options:e.opcoes??[]});case O.DATE:return o.jsx(ar,{...a,validacao:e.validacao});case O.DATETIME:return o.jsx(ar,{...a,isDatetime:!0,validacao:e.validacao});case O.FILE:return o.jsx(tn,{name:r,control:t});case O.TELEFONE:return o.jsx(Ct,{...a,maskType:"telefone"});case O.CPF:return o.jsx(Ct,{...a,maskType:"cpf"});case O.CEP:return o.jsx(rn,{name:r,control:t,placeholder:e.placeholder});case O.HIDDEN:return o.jsx(ba,{name:r,control:t});default:return o.jsx(Be,{...a,type:"text"})}},Mi=({name:e,control:t,subFields:r=[],minItems:a=1,maxItems:n,itemLabel:s="Item",addLabel:i})=>{var l;const{fields:c,append:d,remove:u}=ce.useFieldArray({control:t,name:e}),{errors:p}=ce.useFormState({control:t}),m=(l=p[e])==null?void 0:l.message;E.useEffect(()=>{if(c.length<a)for(let v=c.length;v<a;v++)d({})},[]);const x=[...r].sort((v,b)=>v.ordem-b.ordem),g=!n||c.length<n,f=i??`Adicionar ${s.toLowerCase()}`;return o.jsxs("div",{className:"sfr-field-array space-y-3",children:[c.map((v,b)=>o.jsxs("div",{className:"sfr-field-array__item border rounded-lg p-4",children:[o.jsxs("div",{className:"sfr-field-array__item-header flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"sfr-field-array__counter w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0",children:b+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[s," ",b+1]})]}),c.length>a&&o.jsx("button",{type:"button",onClick:()=>u(b),className:"sfr-field-array__remove","aria-label":`Remover ${s.toLowerCase()} ${b+1}`,children:o.jsx(P.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:x.map(j=>{const y=`${e}.${b}.${j.nome}`,N=`span ${j.tamanho??12}`,C=o.jsx(Rf,{field:j,control:t,nameOverride:y});return j.tipo===O.CHECKBOX||j.tipo===O.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:N},children:C},j.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:N},children:[o.jsxs("label",{className:"sfr-label font-medium flex items-center gap-1 text-sm",children:[j.label,j.obrigatorio&&o.jsx("span",{className:"sfr-required",children:"*"})]}),C,j.hint&&o.jsx("p",{className:"sfr-hint text-xs",children:j.hint})]},j.id)})})]},v.id)),g&&o.jsxs("button",{type:"button",className:"sfr-btn sfr-btn--outline w-full flex items-center justify-center gap-2 py-2 px-4 border rounded-lg text-sm",onClick:()=>d({}),children:[o.jsx(P.Plus,{className:"w-4 h-4"}),f]}),n&&o.jsxs("p",{className:"sfr-hint text-xs text-center",children:["Máximo de ",n," ",s.toLowerCase(),n>1?"s":""]}),m&&o.jsxs("p",{className:"sfr-error text-sm flex items-center gap-1",children:[o.jsx(P.AlertCircle,{className:"w-4 h-4 shrink-0"}),m]})]})},ys=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,Of=(e,t)=>{const r=new Date(e.slice(0,10)+"T00:00:00Z"),a=new Date(t.slice(0,10)+"T00:00:00Z");return Math.round((a.getTime()-r.getTime())/864e5)+1},Df=(e,t)=>{const r=[],a=new Date(e.slice(0,10)+"T00:00:00Z"),n=new Date(t.slice(0,10)+"T00:00:00Z");let s=0;for(;a<=n&&s<60;)r.push(a.toISOString().slice(0,10)),a.setUTCDate(a.getUTCDate()+1),s++;return r},Af=e=>{const[t,r,a]=e.split("-").map(Number),n=new Date(Date.UTC(t,r-1,a)),s=String(a).padStart(2,"0"),i=String(r).padStart(2,"0"),l=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(n),c=l.charAt(0).toUpperCase()+l.slice(1);return`${s}/${i} - ${c}`},If=(e,t)=>{const r=a=>{const[n,s,i]=a.slice(0,10).split("-");return`${i}/${s}/${n}`};return`${r(e)} a ${r(t)}`},Fi=({name:e,control:t})=>{var r;const{field:a,fieldState:n}=ce.useController({name:e,control:t}),{externalData:s={}}=dt(),i=a.value??null,l=(r=n.error)==null?void 0:r.message,c=D=>s[`evento.${D}`]??s[D],d=c("dataInicioEvento")??"",u=c("dataFimEvento")??"",p=Number(c("valor")??0),m=Number(c("valorPorDia")??0),x=c("vagasTotal"),g=c("vagasPorDia"),f=c("vagasMasculinas"),v=c("vagasFemininas"),b=x!=null?Number(x):null,j=g!=null?Number(g):null,y=f!=null?Number(f):null,N=v!=null?Number(v):null,C=d&&u?Df(d,u):[],k=(d&&u?Of(d,u):0)>1,_=y!=null&&y>0&&N!=null&&N>0,w=y!=null&&N==null?"masculino":N!=null&&y==null?"feminino":null,R=(i==null?void 0:i.tipo)??null,A=(i==null?void 0:i.data)??null,I=(i==null?void 0:i.genero)??null,F=E.useRef(i);F.current=i;const V=E.useRef(a.onChange);V.current=a.onChange,E.useEffect(()=>{var D,z,L;w&&((D=F.current)==null?void 0:D.genero)!==w&&V.current({tipo:((z=F.current)==null?void 0:z.tipo)??null,data:((L=F.current)==null?void 0:L.data)??null,genero:w})},[w]);const M=D=>{const z={tipo:D,data:null};(_||w)&&(z.genero=I??w??void 0),a.onChange(z)},U=D=>{const z={tipo:"por_dia",data:D};(_||w)&&(z.genero=I??w??void 0),a.onChange(z)},$=D=>{a.onChange({tipo:R,data:A,genero:D})},T=D=>R===D;return o.jsxs("div",{className:"sfr-participation-type space-y-3",children:[_&&o.jsxs("div",{className:"flex items-center gap-2 px-1",children:[o.jsx("span",{className:"text-xs sfr-text-muted shrink-0",children:"Você é:"}),o.jsx("div",{className:"flex gap-2",children:["masculino","feminino"].map(D=>o.jsx("button",{type:"button",onClick:()=>$(D),className:"sfr-participation-type__gender-btn px-3 py-1 rounded-full text-xs font-medium border transition-all","data-selected":I===D?"true":void 0,children:D==="masculino"?"Masculino":"Feminino"},D))})]}),o.jsxs("button",{type:"button",onClick:()=>M("todos_os_dias"),className:"sfr-participation-type__card w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all","data-selected":T("todos_os_dias")?"true":void 0,children:[o.jsx("div",{className:"sfr-participation-type__card-icon mt-0.5 p-2 rounded-lg shrink-0","data-selected":T("todos_os_dias")?"true":void 0,children:o.jsx(P.CalendarCheck2,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar todos os dias"}),d&&u?o.jsx("p",{className:"text-xs sfr-text-muted",children:If(d,u)}):o.jsx("p",{className:"text-xs sfr-text-muted italic",children:"Datas do evento"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[p>0&&o.jsx("p",{className:"font-bold text-sm sfr-participation-type__price","data-selected":T("todos_os_dias")?"true":void 0,children:ys(p)}),b!=null&&b>0&&o.jsxs("p",{className:"text-xs flex items-center justify-end gap-1 sfr-participation-type__vagas",children:[o.jsx(P.Users,{className:"w-3 h-3"}),b," vagas disponíveis"]})]})]}),k?o.jsxs("button",{type:"button",onClick:()=>M("por_dia"),className:"sfr-participation-type__card w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all","data-selected":T("por_dia")?"true":void 0,children:[o.jsx("div",{className:"sfr-participation-type__card-icon mt-0.5 p-2 rounded-lg shrink-0","data-selected":T("por_dia")?"true":void 0,children:o.jsx(P.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm",children:"Participar um dia"}),o.jsx("p",{className:"text-xs sfr-text-muted",children:"Escolha o dia desejado abaixo"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[m>0&&o.jsx("p",{className:"font-bold text-sm sfr-participation-type__price","data-selected":T("por_dia")?"true":void 0,children:ys(m)}),o.jsx("p",{className:"text-xs sfr-text-muted",children:"por dia"})]})]}):d?o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg border sfr-participation-type__notice",children:[o.jsx(P.Info,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 sfr-text-muted"}),o.jsx("p",{className:"text-xs sfr-text-muted",children:'Este evento ocorre em apenas 1 dia — a opção "Participar um dia" não é necessária.'})]}):null,R==="por_dia"&&o.jsxs("div",{className:"pl-2 space-y-2 sfr-participation-type__days",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide sfr-primary-text",children:"Selecione o dia:"}),C.length===0?o.jsx("p",{className:"text-xs sfr-text-muted italic",children:"Nenhuma data configurada no evento"}):C.map(D=>o.jsxs("button",{type:"button",onClick:()=>U(D),className:"sfr-participation-type__day-btn w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all","data-selected":A===D?"true":void 0,children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:"w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center sfr-participation-type__day-radio","data-selected":A===D?"true":void 0,children:A===D&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-white"})}),o.jsx("span",{className:"text-sm",children:Af(D)})]}),j!=null&&o.jsxs("span",{className:"text-xs sfr-participation-type__vagas",children:[j," vagas"]})]},D))]}),l&&o.jsx("p",{className:"text-sm sfr-error",children:l})]})},ws=.0315,js=.124,Ns=7,Cs=12,Vi=[{id:"pix",label:"PIX",description:"Transferência instantânea (à vista)",Icon:P.Smartphone,taxa:0},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:P.Banknote,taxa:0},{id:"cartao",label:"Cartão de Crédito",description:"Débito ou crédito na maquininha",Icon:P.CreditCard,taxa:ws,taxaLabel:`Taxa: ${(ws*100).toFixed(2).replace(".",",")}%`}],Bi=[{id:"pix",label:"PIX à Vista",description:"Pagamento instantâneo sem parcelamento",Icon:P.Smartphone,taxa:0},{id:"pix_parcelado",label:"PIX Parcelado",description:`Parcelado em até ${Ns}x sem juros`,Icon:P.Smartphone,taxa:0,parcelas:Ns},{id:"cartao",label:"Cartão de Crédito",description:`Parcelado em até ${Cs}x`,Icon:P.CreditCard,taxa:js,parcelas:Cs,taxaLabel:`Taxa: ${(js*100).toFixed(2).replace(".",",")}%`},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:P.Banknote,taxa:0}],Lr=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,Ss=(e,t)=>Math.round(e*(1+t)*100)/100,Lf=(e,t)=>Math.round(e/t*100)/100,Ui=({name:e,control:t,relatedFieldName:r="tipo_participacao"})=>{var a;const{field:n,fieldState:s}=ce.useController({name:e,control:t}),{externalData:i={},paymentMethodOptions:l}=dt(),c=n.value??null,d=(a=s.error)==null?void 0:a.message,u=ce.useWatch({control:t,name:r}),p=(u==null?void 0:u.tipo)??null,m=y=>i[`evento.${y}`]??i[y],x=Number(m("valor")??0),g=Number(m("valorPorDia")??0),f=p==="por_dia"&&g>0?g:x,v=p==="por_dia"?(l==null?void 0:l.porDia)??Vi:(l==null?void 0:l.todosOsDias)??Bi,b=p==="por_dia"?(()=>{if(!(u!=null&&u.data))return"Um dia";const[y,N,C]=u.data.split("-");return`${C}/${N}/${y}`})():"Todos os dias",j=y=>{if(y.disabled)return;const N=Ss(f,y.taxa),C={metodo:y.id,valorTotal:N};y.parcelas&&(C.parcelas=y.parcelas),n.onChange(C)};return o.jsxs("div",{className:"sfr-payment-method space-y-4",children:[o.jsxs("div",{className:"sfr-payment-method__summary flex items-center justify-between rounded-xl border px-4 py-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs sfr-text-muted",children:"Tipo de participação"}),o.jsx("p",{className:"font-semibold",children:b})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-xs sfr-text-muted",children:"Valor base"}),o.jsx("p",{className:"text-lg font-bold sfr-primary-text",children:Lr(f)})]})]}),o.jsxs("div",{className:"sfr-payment-method__notice flex items-start gap-2 rounded-lg border px-3 py-2.5",children:[o.jsx(P.Info,{className:"h-4 w-4 mt-0.5 shrink-0"}),o.jsxs("p",{className:"text-xs",children:[o.jsx("span",{className:"font-bold",children:"Importante:"})," Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."]})]}),o.jsx("p",{className:"text-sm font-semibold sfr-primary-text",children:"Selecione a forma de pagamento:"}),o.jsx("div",{className:"space-y-3",children:v.map(y=>{const{Icon:N}=y,C=(c==null?void 0:c.metodo)===y.id,k=Ss(f,y.taxa),_=!!y.parcelas&&y.parcelas>1,w=_?Lf(k,y.parcelas):null;return o.jsxs("button",{type:"button",disabled:y.disabled,onClick:()=>j(y),className:"sfr-payment-method__card w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all","data-selected":C?"true":void 0,"data-disabled":y.disabled?"true":void 0,children:[o.jsx("div",{className:"sfr-payment-method__card-icon flex items-center justify-center w-10 h-10 rounded-lg shrink-0","data-selected":C?"true":void 0,children:o.jsx(N,{className:"h-5 w-5"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm leading-tight",children:y.label}),o.jsx("p",{className:"text-xs sfr-text-muted",children:y.description}),y.taxaLabel&&o.jsxs("p",{className:"text-xs sfr-payment-method__taxa mt-0.5",children:["* ",y.taxaLabel]}),y.taxa>0&&o.jsxs("p",{className:"text-xs sfr-text-muted",children:["Total com taxa: ",Lr(k)]})]}),o.jsx("div",{className:"text-right shrink-0",children:_?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-xs sfr-text-muted",children:[y.parcelas,"x de"]}),o.jsx("p",{className:"text-base font-bold sfr-primary-text",children:Lr(w)})]}):o.jsx("p",{className:"text-base font-bold sfr-primary-text",children:Lr(k)})})]},y.id)})}),d&&o.jsx("p",{className:"text-xs sfr-error",children:d})]})},Hi=({name:e,control:t,label:r,termoTexto:a,termoPdfUrl:n,termoPdfUploadId:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t}),{resolveTermsUploadUrl:d}=dt(),u=!!c.error,p=(i=c.error)==null?void 0:i.message,[m,x]=E.useState(null),[g,f]=E.useState(!1),[v,b]=E.useState(!1);E.useEffect(()=>{if(!s||!d){x(null);return}f(!0),d(s).then(k=>x(k)).catch(()=>x(null)).finally(()=>f(!1))},[s,d]);const j=l.value==="accepted",y=m||n||null,N=!!(a||y||s),C=!!y;return o.jsxs("div",{className:"sfr-terms space-y-2",children:[o.jsxs("div",{className:"sfr-terms__box rounded-lg border p-4 space-y-4",style:{borderColor:u?"var(--sfr-error, #ef4444)":j?"var(--sfr-success, #22c55e)":"var(--sfr-border, #e2e8f0)",background:u?"color-mix(in srgb, var(--sfr-error, #ef4444) 5%, transparent)":j?"color-mix(in srgb, var(--sfr-success, #22c55e) 5%, transparent)":"transparent"},children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(P.ScrollText,{className:"h-4 w-4 sfr-terms__icon shrink-0"}),o.jsx("span",{className:"text-sm font-medium",children:r||"Termos e condições"})]}),N?o.jsxs("button",{type:"button",className:"sfr-btn sfr-btn--outline flex items-center gap-1.5 text-xs h-7 px-2 border rounded",disabled:g,onClick:()=>b(!0),children:[g?o.jsx(P.Loader2,{className:"h-3 w-3 animate-spin"}):o.jsx(P.ExternalLink,{className:"h-3 w-3"}),"Ler termos"]}):o.jsx("span",{className:"text-xs sfr-text-muted italic",children:s&&g?"Carregando PDF...":"Conteúdo não configurado"})]}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[o.jsx("input",{type:"checkbox",className:"sfr-checkbox mt-0.5",checked:j,onChange:k=>l.onChange(k.target.checked?"accepted":""),style:u?{outline:"1px solid var(--sfr-error, #ef4444)"}:{}}),o.jsxs("span",{className:"text-sm leading-snug flex-1",children:["Li e aceito ",r?`"${r}"`:"os termos e condições"]}),j&&o.jsx(P.CheckCircle2,{className:"h-4 w-4 sfr-terms__check shrink-0 mt-0.5"})]})]}),u&&o.jsxs("div",{className:"flex items-center gap-1.5 text-xs sfr-error",children:[o.jsx(P.AlertCircle,{className:"h-3.5 w-3.5 shrink-0"}),p||"Você precisa aceitar os termos para continuar"]}),v&&o.jsx("div",{className:"sfr-modal-backdrop fixed inset-0 z-50 flex items-center justify-center p-4",style:{background:"rgba(0,0,0,0.6)"},onClick:()=>b(!1),children:o.jsxs("div",{className:"sfr-modal relative w-full max-w-2xl max-h-[90vh] rounded-xl overflow-hidden flex flex-col",style:{background:"var(--sfr-surface, #ffffff)"},onClick:k=>k.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b sfr-modal__header",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(P.ScrollText,{className:"h-4 w-4"}),o.jsx("span",{className:"font-semibold",children:"Termos e condições"})]}),o.jsx("button",{type:"button",className:"sfr-btn sfr-btn--ghost",onClick:()=>b(!1),children:o.jsx(P.X,{className:"h-4 w-4"})})]}),o.jsx("div",{className:"flex-1 overflow-auto p-4",children:C?o.jsx("iframe",{src:y,className:"w-full rounded border",style:{height:"62vh"},title:"Termos e condições",sandbox:"allow-scripts allow-same-origin"}):o.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:a})})]})})]})},zf=({name:e,control:t,placeholder:r,disabled:a,readOnly:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t}),[c,d]=E.useState(!1),u=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"relative",children:[o.jsx("input",{...i,value:i.value??"",type:c?"text":"password",placeholder:r,disabled:a,readOnly:n,className:`sfr-input pr-10${u?" sfr-input--error":""}`,"data-sfr-field":"password"}),o.jsx("button",{type:"button",tabIndex:-1,onClick:()=>d(p=>!p),className:"absolute right-3 top-1/2 -translate-y-1/2 text-[var(--t-text-muted)] hover:text-[var(--t-text)] transition-colors","aria-label":c?"Ocultar senha":"Mostrar senha",children:c?o.jsx(P.EyeOff,{size:16}):o.jsx(P.Eye,{size:16})})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},Wi=({name:e,control:t,label:r,disabled:a,readOnly:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t}),c=!!i.value;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none",children:[o.jsx("button",{type:"button",role:"switch","aria-checked":c,disabled:a||n,onClick:()=>!n&&i.onChange(!c),className:["relative inline-flex h-6 w-11 shrink-0 items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--t-primary)] focus-visible:ring-offset-2",c?"bg-[var(--t-primary)]":"bg-[var(--t-border)]",a?"opacity-50 cursor-not-allowed":"cursor-pointer"].join(" "),children:o.jsx("span",{className:["pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow-lg transition-transform",c?"translate-x-5":"translate-x-0.5"].join(" ")})}),o.jsx("span",{className:"sfr-label !mb-0",children:r})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},Mf=({name:e,control:t,minValue:r=0,maxValue:a=100,step:n=1,disabled:s,readOnly:i})=>{var l;const{field:c,fieldState:d}=ce.useController({name:e,control:t}),u=c.value??r,p=a-r,m=p>0?(u-r)/p*100:0;return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"relative flex-1",children:o.jsx("input",{type:"range",min:r,max:a,step:n,value:u,disabled:s||i,onChange:x=>c.onChange(Number(x.target.value)),className:"sfr-slider w-full",style:{"--slider-pct":`${m}%`}})}),o.jsx("span",{className:"sfr-label !mb-0 min-w-[3rem] text-right tabular-nums",style:{color:"var(--t-primary)"},children:u})]}),o.jsxs("div",{className:"flex justify-between text-xs",style:{color:"var(--t-text-muted)"},children:[o.jsx("span",{children:r}),o.jsx("span",{children:a})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"sfr-error",children:d.error.message})]})},Ff=({name:e,control:t,disabled:r,readOnly:a})=>{var n;const{field:s,fieldState:i}=ce.useController({name:e,control:t}),l=s.value??"#000000";return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("input",{type:"color",value:l,disabled:r||a,onChange:c=>s.onChange(c.target.value),className:"h-10 w-14 cursor-pointer rounded-lg border border-[var(--t-border)] bg-transparent p-1 disabled:cursor-not-allowed disabled:opacity-50","data-sfr-field":"color"}),o.jsx("input",{type:"text",value:l,readOnly:a,disabled:r,onChange:c=>{const d=c.target.value;/^#[0-9a-fA-F]{0,6}$/.test(d)&&s.onChange(d)},className:`sfr-input flex-1 font-mono uppercase${i.error?" sfr-input--error":""}`,maxLength:7,placeholder:"#000000"})]}),((n=i.error)==null?void 0:n.message)&&o.jsx("p",{className:"sfr-error",children:i.error.message})]})},Vf=({name:e,control:t,options:r,placeholder:a,disabled:n,readOnly:s})=>{var i,l;const{field:c,fieldState:d}=ce.useController({name:e,control:t}),[u,p]=E.useState(""),[m,x]=E.useState(!1),g=E.useRef(null),f=((i=r.find(y=>y.valor===c.value))==null?void 0:i.label)??"",v=u.length>0?r.filter(y=>y.label.toLowerCase().includes(u.toLowerCase())):r;E.useEffect(()=>{const y=N=>{g.current&&!g.current.contains(N.target)&&(x(!1),p(""))};return document.addEventListener("mousedown",y),()=>document.removeEventListener("mousedown",y)},[]);const b=y=>{y.disabled||(c.onChange(y.valor),x(!1),p(""))},j=()=>{c.onChange(""),p("")};return o.jsxs("div",{className:"space-y-1",ref:g,children:[o.jsxs("div",{className:"relative",children:[o.jsx("input",{type:"text",value:m?u:f,placeholder:a??"Buscar...",disabled:n,readOnly:s,onChange:y=>{p(y.target.value),x(!0)},onFocus:()=>!s&&x(!0),className:`sfr-input pr-8${d.error?" sfr-input--error":""}`,"data-sfr-field":"autocomplete",autoComplete:"off"}),o.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",children:c.value?o.jsx("button",{type:"button",onClick:j,className:"text-[var(--t-text-muted)] hover:text-[var(--t-text)]",tabIndex:-1,children:o.jsx(P.X,{size:14})}):o.jsx(P.ChevronDown,{size:16,className:"text-[var(--t-text-muted)] pointer-events-none"})}),m&&!n&&!s&&o.jsx("ul",{className:"absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg border border-[var(--t-border)] bg-[var(--t-surface)] shadow-lg",children:v.length===0?o.jsx("li",{className:"px-3 py-2 text-sm text-[var(--t-text-muted)]",children:"Nenhuma opção encontrada"}):v.map(y=>o.jsx("li",{onMouseDown:()=>b(y),className:["flex cursor-pointer items-center px-3 py-2 text-sm",y.disabled?"cursor-not-allowed opacity-40":"hover:bg-[var(--t-accent)]",c.value===y.valor?"font-medium text-[var(--t-primary)]":"text-[var(--t-text)]"].join(" "),children:y.label},y.valor))})]}),((l=d.error)==null?void 0:l.message)&&o.jsx("p",{className:"sfr-error",children:d.error.message})]})},qi=({name:e,control:t,placeholder:r,disabled:a,readOnly:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t}),c=!!l.error;return o.jsxs("div",{className:"space-y-1",children:[o.jsx("input",{...i,value:i.value??"",type:"time",placeholder:r,disabled:a,readOnly:n,className:`sfr-input${c?" sfr-input--error":""}`,"data-sfr-field":"time"}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},Bf=({name:e,control:t,startLabel:r="Data inicial",endLabel:a="Data final",disabled:n,readOnly:s})=>{var i;const{field:l,fieldState:c}=ce.useController({name:e,control:t}),d=l.value??{},u=(m,x)=>{l.onChange({...d,[m]:x})},p=!!c.error;return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"sfr-label",children:r}),o.jsx("input",{type:"date",value:d.start??"",disabled:n,readOnly:s,onChange:m=>u("start",m.target.value),max:d.end??void 0,className:`sfr-input${p?" sfr-input--error":""}`,"data-sfr-field":"date-range-start"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"sfr-label",children:a}),o.jsx("input",{type:"date",value:d.end??"",disabled:n,readOnly:s,onChange:m=>u("end",m.target.value),min:d.start??void 0,className:`sfr-input${p?" sfr-input--error":""}`,"data-sfr-field":"date-range-end"})]})]}),((i=c.error)==null?void 0:i.message)&&o.jsx("p",{className:"sfr-error",children:c.error.message})]})},Uf=({name:e,control:t,maxRating:r=5,disabled:a,readOnly:n})=>{var s;const{field:i,fieldState:l}=ce.useController({name:e,control:t}),c=i.value??0,d=Array.from({length:r},(u,p)=>p+1);return o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[d.map(u=>o.jsx("button",{type:"button",disabled:a||n,onClick:()=>i.onChange(u===c?0:u),className:"transition-transform hover:scale-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--t-primary)] rounded","aria-label":`${u} estrela${u>1?"s":""}`,children:o.jsx(P.Star,{size:24,className:"transition-colors",fill:u<=c?"var(--t-primary)":"transparent",stroke:u<=c?"var(--t-primary)":"var(--t-border)"})},u)),c>0&&o.jsxs("span",{className:"ml-2 text-sm",style:{color:"var(--t-text-muted)"},children:[c,"/",r]})]}),((s=l.error)==null?void 0:s.message)&&o.jsx("p",{className:"sfr-error",children:l.error.message})]})},Hf=({field:e,name:t,control:r,disabled:a,readOnly:n})=>{const s=a||e.isDisabled,i=n||e.isReadOnly;switch(e.tipo){case O.EMAIL:return o.jsx(Be,{name:t,control:r,type:"email",placeholder:e.placeholder,disabled:s,readOnly:i});case O.NUMBER:return o.jsx(Be,{name:t,control:r,type:"number",placeholder:e.placeholder,disabled:s,readOnly:i});case O.PASSWORD:return o.jsx(Be,{name:t,control:r,type:"password",placeholder:e.placeholder,disabled:s,readOnly:i});case O.TELEFONE:return o.jsx(Ct,{name:t,control:r,maskType:"telefone",placeholder:e.placeholder??"(00) 00000-0000",disabled:s,readOnly:i});case O.CPF:return o.jsx(Ct,{name:t,control:r,maskType:"cpf",placeholder:e.placeholder??"000.000.000-00",disabled:s,readOnly:i});case O.CEP:return o.jsx(Ct,{name:t,control:r,maskType:"cep",placeholder:e.placeholder??"00000-000",disabled:s,readOnly:i});case O.TEXTAREA:return o.jsx(xa,{name:t,control:r,placeholder:e.placeholder,disabled:s,readOnly:i});case O.SELECT:return o.jsx(ga,{name:t,control:r,options:e.opcoes??[],placeholder:e.placeholder,disabled:s,readOnly:i});case O.CHECKBOX:return o.jsx(va,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case O.SWITCH:return o.jsx(Wi,{name:t,control:r,label:e.label??"",disabled:s,readOnly:i});case O.DATE:return o.jsx(ar,{name:t,control:r,disabled:s,readOnly:i});case O.TIME:return o.jsx(qi,{name:t,control:r,disabled:s,readOnly:i});case O.HIDDEN:return o.jsx(ba,{name:t,control:r});default:return o.jsx(Be,{name:t,control:r,type:"text",placeholder:e.placeholder,disabled:s,readOnly:i})}},Wf=({name:e,control:t,subSchema:r,disabled:a,readOnly:n})=>{if(!r||r.fields.length===0)return null;const s=[...r.fields].sort((i,l)=>i.ordem-l.ordem);return o.jsxs("div",{className:"sfr-subform rounded-xl border p-4 space-y-4",style:{borderColor:"var(--t-border)",background:"color-mix(in srgb, var(--t-surface) 60%, transparent)"},children:[r.titulo&&o.jsx("h4",{className:"sfr-subform__title text-sm font-semibold",style:{color:"var(--t-text-muted)"},children:r.titulo}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:s.map(i=>{const l=`${e}.${i.nome}`,c=i.tipo===O.CHECKBOX||i.tipo===O.SWITCH||i.tipo===O.HIDDEN,d=i.tamanho??6;return o.jsxs("div",{className:`col-span-${d}`,children:[!c&&o.jsxs("label",{className:"sfr-label mb-1 block",children:[i.label,i.obrigatorio&&o.jsx("span",{style:{color:"var(--t-error)"},children:" *"})]}),o.jsx(Hf,{field:i,name:l,control:t,disabled:a,readOnly:n})]},i.id)})})]})},Zi=({field:e,control:t,nameOverride:r})=>{var a,n;const s=r??e.nome,{componentMapper:i}=dt(),l=i==null?void 0:i[e.tipo];if(l)return o.jsx(l,{name:s,control:t,field:e});const c={name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly};switch(e.tipo){case O.TEXTO:return o.jsx(Be,{...c,type:"text"});case O.EMAIL:return o.jsx(Be,{...c,type:"email"});case O.NUMBER:return o.jsx(Be,{...c,type:"number"});case O.PASSWORD:return o.jsx(zf,{...c});case O.TEXTAREA:return o.jsx(xa,{...c});case O.SELECT:return o.jsx(ga,{...c,options:e.opcoes??[]});case O.AUTOCOMPLETE:return o.jsx(Vf,{...c,options:e.opcoes??[]});case O.SWITCH:return o.jsx(Wi,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case O.SLIDER:return o.jsx(Mf,{name:s,control:t,minValue:e.minValue,maxValue:e.maxValue,step:e.step,disabled:e.isDisabled,readOnly:e.isReadOnly});case O.RATING:return o.jsx(Uf,{name:s,control:t,maxRating:e.maxRating,disabled:e.isDisabled,readOnly:e.isReadOnly});case O.COLOR:return o.jsx(Ff,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly});case O.TIME:return o.jsx(qi,{...c});case O.DATE_RANGE:return o.jsx(Bf,{name:s,control:t,startLabel:e.dateRangeStartLabel,endLabel:e.dateRangeEndLabel,disabled:e.isDisabled,readOnly:e.isReadOnly});case O.RADIO:return o.jsx(en,{...c,options:e.opcoes??[]});case O.CHECKBOX:return o.jsx(va,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case O.CHECKBOX_GROUP:return o.jsx(Qo,{...c,options:e.opcoes??[]});case O.DATE:return o.jsx(ar,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case O.DATETIME:return o.jsx(ar,{name:s,control:t,isDatetime:!0,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case O.FILE:return o.jsx(tn,{name:s,control:t,disabled:e.isDisabled,fileTypes:(a=e.validacao)==null?void 0:a.fileTypes,maxFileSize:(n=e.validacao)==null?void 0:n.maxFileSize});case O.TELEFONE:return o.jsx(Ct,{...c,maskType:"telefone"});case O.CPF:return o.jsx(Ct,{...c,maskType:"cpf"});case O.CEP:return o.jsx(rn,{name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly,cepFillMap:e.cepFillMap});case O.HIDDEN:return o.jsx(ba,{name:s,control:t});case O.PARTICIPATION_TYPE:return o.jsx(Fi,{name:s,control:t});case O.PAYMENT_METHOD:return o.jsx(Ui,{name:s,control:t,relatedFieldName:e.relatedFieldName});case O.TERMS:return o.jsx(Hi,{name:s,control:t,label:e.label,termoTexto:e.termoTexto,termoPdfUrl:e.termoPdfUrl,termoPdfUploadId:e.termoPdfUploadId});case O.FIELD_ARRAY:return o.jsx(Mi,{name:s,control:t,subFields:e.subFields,minItems:e.minItems,maxItems:e.maxItems,itemLabel:e.itemLabel,addLabel:e.addLabel});case O.SUB_FORM:return o.jsx(Wf,{name:s,control:t,subSchema:e.subSchema,disabled:e.isDisabled,readOnly:e.isReadOnly});default:return o.jsx(Be,{...c,type:"text"})}},Xi=()=>{const e=Wo(),t=e.layout.containerStyle,r=["sfr-container overflow-hidden",e.layout.roundness??"rounded-xl",t==="card"?"sfr-container--card border":"",t==="bordered"?"sfr-container--bordered border":"",t==="glassmorphism"?"sfr-container--glass backdrop-blur-sm":""].filter(Boolean).join(" "),a=t==="glassmorphism"?{background:"var(--t-surface)",borderColor:"var(--t-border)",borderWidth:"1px",borderStyle:"solid"}:{},n=["sfr-container__header border-b px-6 py-4",t==="flat"?"border-transparent":""].filter(Boolean).join(" ");return{wrapperClass:r,wrapperStyle:a,headerClass:n,headerStyle:t==="glassmorphism"?{borderColor:"var(--t-border)"}:{},tmpl:e}},qf=({container:e,control:t})=>{var r;const{externalData:a={}}=dt(),n=e.icone?ct[e.icone]:void 0,s=a,i=E.useMemo(()=>ha(e,s),[e,JSON.stringify(s)]),l=E.useMemo(()=>[...i.campos].sort((v,b)=>v.ordem-b.ordem),[i.campos]),c=ce.useWatch({control:t}),{fieldResolvers:d}=dt(),{wrapperClass:u,wrapperStyle:p,headerClass:m,headerStyle:x,tmpl:g}=Xi(),f=v=>{if(!rt(v.condicional,c,a))return null;let b=v;if(v.resolvePropsKey&&d!=null&&d[v.resolvePropsKey]){const k=d[v.resolvePropsKey](v,c,a);b={...v,...k}}if(b.opcoesFromVar){const k=a[b.opcoesFromVar];Array.isArray(k)&&(b={...b,opcoes:k.map(_=>typeof _=="string"?{valor:_,label:_}:_&&typeof _=="object"&&"valor"in _&&"label"in _?_:{valor:String(_),label:String(_)})})}const j=b.tamanho??12,y=b.inicioColuna,N=y?`${y} / span ${j}`:`span ${j}`,C=o.jsx(Zi,{field:b,control:t});return b.tipo===O.CHECKBOX||b.tipo===O.HIDDEN||b.tipo===O.SWITCH?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:N},children:C},b.id):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:N},children:[o.jsxs("label",{className:"sfr-label font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[b.label,b.obrigatorio&&o.jsx("span",{className:"sfr-required",children:"*"})]}),C,b.hint&&o.jsx("p",{className:"sfr-hint text-xs",style:{color:"var(--t-text-muted)"},children:b.hint})]},b.id)};return o.jsxs("div",{className:u,style:p,children:[(i.titulo||n)&&o.jsx("div",{className:m,style:x,children:o.jsxs("div",{className:"flex items-center gap-3",children:[n&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(n,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=g.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:i.titulo}),i.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:i.descricao})]})]})}),o.jsx("div",{className:"p-6 grid grid-cols-12 gap-4",children:l.map(f)})]})},Zf=({container:e,control:t})=>{var r;const{externalData:a={}}=dt(),n=e.nome,s=e.minItems??1,i=e.maxItems,l=e.itemLabel??"Item",{fields:c,append:d,remove:u}=ce.useFieldArray({control:t,name:n});E.useEffect(()=>{if(c.length<s)for(let k=c.length;k<s;k++)d({})},[]);const p=e.icone?ct[e.icone]:void 0,m=a,x=E.useMemo(()=>ha(e,m),[e,JSON.stringify(m)]),g=E.useMemo(()=>[...x.campos].sort((k,_)=>k.ordem-_.ordem),[x.campos]),f=ce.useWatch({control:t}),{wrapperClass:v,wrapperStyle:b,headerClass:j,headerStyle:y,tmpl:N}=Xi(),C=(k,_)=>{if(!rt(k.condicional,f,a))return null;const w=`${n}.${_}.${k.nome}`,R=k.tamanho??12,A=k.inicioColuna,I=A?`${A} / span ${R}`:`span ${R}`,F=o.jsx(Zi,{field:k,control:t,nameOverride:w});return k.tipo===O.CHECKBOX||k.tipo===O.HIDDEN?o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:I},children:F},`${k.id}-${_}`):o.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:I},children:[o.jsxs("label",{className:"sfr-label font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[k.label,k.obrigatorio&&o.jsx("span",{className:"sfr-required",children:"*"})]}),F,k.hint&&o.jsx("p",{className:"sfr-hint text-xs",style:{color:"var(--t-text-muted)"},children:k.hint})]},`${k.id}-${_}`)};return o.jsxs("div",{className:v,style:b,children:[(x.titulo||p)&&o.jsx("div",{className:j,style:y,children:o.jsxs("div",{className:"flex items-center gap-3",children:[p&&o.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(p,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),o.jsxs("div",{children:[o.jsx("h3",{className:((r=N.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:x.titulo}),x.descricao&&o.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:x.descricao})]})]})}),o.jsxs("div",{className:"p-6 space-y-4",children:[c.map((k,_)=>o.jsxs("div",{className:"sfr-container__repeat-item border rounded-lg p-4",style:{borderColor:"var(--t-border)",background:"color-mix(in srgb, var(--t-surface) 60%, transparent)"},children:[o.jsxs("div",{className:"flex items-center justify-between mb-4",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0",style:{background:"var(--t-primary)",color:"#fff"},children:_+1}),o.jsxs("span",{className:"text-sm font-semibold",style:{color:"var(--t-text)"},children:[l," ",_+1]})]}),c.length>s&&o.jsx("button",{type:"button",onClick:()=>u(_),className:"sfr-btn sfr-btn--ghost sfr-error","aria-label":"Remover item",children:o.jsx(P.Trash2,{className:"w-4 h-4"})})]}),o.jsx("div",{className:"grid grid-cols-12 gap-4",children:g.map(w=>C(w,_))})]},k.id)),(!i||c.length<i)&&o.jsxs("button",{type:"button",className:"sfr-btn sfr-btn--outline w-full flex items-center justify-center gap-2 py-2 px-4 border rounded-lg text-sm",onClick:()=>d({}),children:[o.jsx(P.Plus,{className:"w-4 h-4"}),"Adicionar ",l.toLowerCase()]}),i&&o.jsxs("p",{className:"text-xs text-center sfr-text-muted",children:["Máximo de ",i," ",l.toLowerCase(),i>1?"s":""]})]})]})},Gi=e=>e.container.repeatable&&e.container.nome?o.jsx(Zf,{...e}):o.jsx(qf,{...e}),Yi=({step:e,control:t,externalData:r={}})=>{const a=E.useMemo(()=>[...e.containers].sort((s,i)=>s.ordem-i.ordem),[e.containers]),n=ce.useWatch({control:t});return o.jsx("div",{className:"sfr-step grid grid-cols-12 gap-4 sfr-step--animate",children:a.map(s=>{if(s.condicional&&!rt(s.condicional,n,r))return null;const i=s.tamanho??12,l=s.inicioColuna,c=l?`${l} / span ${i}`:`span ${i}`;return o.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:c},children:o.jsx(Gi,{container:s,control:t})},s.id)})})},Sr=E.createContext({submitting:!1,warnings:{},requestSubmit:()=>{}}),Xf=Sr.Provider,Gf=()=>{const e=ce.useFormContext(),t=E.useContext(Sr);return{change:(r,a)=>e.setValue(r,a,{shouldValidate:!0,shouldDirty:!0}),reset:r=>e.reset(r),submit:t.requestSubmit,getState:()=>{const{errors:r,isDirty:a,isValid:n}=e.formState;return{values:e.getValues(),errors:Object.fromEntries(Object.entries(r).map(([s,i])=>[s,i==null?void 0:i.message])),warnings:t.warnings,dirty:a,valid:n,submitting:t.submitting}}}},Ki=()=>{const e=ce.useFormContext(),t=E.useContext(Sr),r=ce.useWatch({control:e.control}),{errors:a,isDirty:n,isValid:s}=e.formState;return{values:r,errors:Object.fromEntries(Object.entries(a).map(([i,l])=>[i,l==null?void 0:l.message])),warnings:t.warnings,dirty:n,valid:s,submitting:t.submitting}},Yf=e=>{var t;const r=ce.useFormContext(),{warnings:a}=E.useContext(Sr),n=ce.useWatch({control:r.control,name:e}),s=r.getFieldState(e,r.formState);return{value:n,error:(t=s.error)==null?void 0:t.message,warning:a[e],dirty:s.isDirty,touched:s.isTouched,valid:!s.error}},Kf=e=>{var t;const{control:r}=ce.useFormContext(),{warnings:a}=E.useContext(Sr),{field:n,fieldState:s}=ce.useController({name:e,control:r});return{input:{name:n.name,value:n.value,onChange:n.onChange,onBlur:n.onBlur,ref:n.ref},meta:{error:(t=s.error)==null?void 0:t.message,warning:a[e],touched:s.isTouched,dirty:s.isDirty,valid:!s.error}}},Jf=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"sfr-step-indicator flex items-center gap-2 justify-center flex-wrap",children:e.map((a,n)=>{const s=n<t,i=n===t,l=a.icone?ct[a.icone]:void 0;return o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{type:"button",onClick:()=>s&&(r==null?void 0:r(n)),disabled:!s,className:"sfr-step-indicator__dot flex items-center justify-center w-8 h-8 rounded-full text-xs font-bold transition-all","data-active":i?"true":void 0,"data-done":s?"true":void 0,title:a.label,children:s?o.jsx(P.Check,{className:"w-4 h-4"}):l?o.jsx(l,{className:"w-4 h-4"}):n+1}),a.label&&o.jsx("span",{className:"text-xs hidden sm:block sfr-step-indicator__label","data-active":i?"true":void 0,children:a.label}),n<e.length-1&&o.jsx("div",{className:"sfr-step-indicator__line w-6 h-0.5","data-done":s?"true":void 0})]},a.id)})}),Qf=({stepIndex:e,totalSteps:t,step:r,defaultValues:a,externalData:n,fieldErrors:s,isSubmitting:i,submitError:l,validatorMapper:c={},onWarningsChange:d,onValuesChange:u,onSubmit:p,onBack:m})=>{const x=e===t-1,g=E.useMemo(()=>Di(r,n,c),[r.id]),f=E.useMemo(()=>Ai(r,n,c),[r.id]),[v,b]=E.useState({}),j=E.useRef(d);j.current=d;const y=n,N=E.useMemo(()=>Li(r,y),[r,JSON.stringify(y)]),C=ce.useForm({resolver:g,defaultValues:a,mode:"onTouched"}),{control:k,watch:_,setValue:w,handleSubmit:R,setError:A,clearErrors:I}=C;E.useEffect(()=>{I();for(const[z,L]of Object.entries(s))A(z,{type:"server",message:L})},[s,A,I]);const F=E.useMemo(()=>r.containers.flatMap(z=>z.campos).filter(z=>z.condicional&&z.clearedValue!==void 0),[r.containers]),V=E.useMemo(()=>r.containers.flatMap(z=>z.campos).filter(z=>{var L;return z.condicional&&((L=z.setValues)==null?void 0:L.length)}),[r.containers]),M=E.useRef({}),U=ce.useWatch({control:k}),$=E.useRef(u);$.current=u,E.useEffect(()=>{var z;(z=$.current)==null||z.call($,U)},[U]),E.useEffect(()=>{let z=!1;return f(U).then(L=>{var ee;z||(b(L),(ee=j.current)==null||ee.call(j,L))}),()=>{z=!0}},[U,f]),E.useEffect(()=>{var z;if(!F.length&&!V.length)return;const L=U,ee=n;for(const Y of F)if(!rt(Y.condicional,L,n)){const J=Y.clearedValue??"";L[Y.nome]!==J&&w(Y.nome,J,{shouldValidate:!1})}for(const Y of V){const J=rt(Y.condicional,L,n),q=M.current[Y.nome]??!1;if(J&&!q&&(z=Y.setValues)!=null&&z.length)for(const se of Y.setValues){const me=typeof se.valor=="string"?Xe(se.valor,ee):se.valor;w(se.campo,me,{shouldValidate:!1})}M.current[Y.nome]=J}},[U,F,V,n,w]);const T=N.icone?ct[N.icone]:void 0,D=E.useMemo(()=>()=>{C.handleSubmit(p)()},[p]);return o.jsx(ce.FormProvider,{...C,children:o.jsx(Xf,{value:{submitting:i,warnings:v,requestSubmit:D},children:o.jsx("form",{onSubmit:R(p),noValidate:!0,onKeyDown:z=>{z.key==="Enter"&&z.target.tagName==="INPUT"&&z.preventDefault()},children:o.jsxs("div",{className:"space-y-6",children:[N.showLabel!==!1&&o.jsxs("div",{className:"text-center space-y-2",children:[T&&o.jsx("div",{className:"w-12 h-12 mx-auto rounded-xl flex items-center justify-center",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:o.jsx(T,{className:"w-6 h-6",style:{color:"var(--t-primary)"}})}),o.jsx("h2",{className:"sfr-step__title text-2xl font-bold",style:{color:"var(--t-text)"},children:N.titulo}),N.descricao&&o.jsx("p",{className:"sfr-step__desc text-sm",style:{color:"var(--t-text-muted)"},children:N.descricao})]}),o.jsx(Yi,{step:N,control:k,externalData:n}),o.jsxs("div",{className:"sfr-form__nav flex items-center justify-between gap-4 pt-6 pb-2",children:[o.jsxs("button",{type:"button",className:"sfr-btn sfr-btn--outline flex items-center gap-1 px-4 py-2 border rounded-lg text-sm",onClick:m,disabled:e===0,style:e>0?{borderColor:"color-mix(in srgb, var(--t-primary) 40%, transparent)",color:"var(--t-primary)"}:{},children:[o.jsx(P.ChevronLeft,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:"Anterior"})]}),o.jsxs("span",{className:"text-xs font-semibold tabular-nums sm:hidden",style:{color:"var(--t-text-muted)"},children:[e+1,"/",t]}),o.jsxs("button",{type:"submit",className:"sfr-btn sfr-btn--primary flex items-center gap-1 px-4 py-2 rounded-lg text-sm font-semibold",disabled:i,style:{background:"var(--t-primary)",color:"#ffffff"},children:[i?o.jsx(P.Loader2,{className:"w-4 h-4 animate-spin"}):x?o.jsx(P.Check,{className:"w-4 h-4"}):o.jsx(P.ChevronRight,{className:"w-4 h-4"}),o.jsx("span",{className:"hidden sm:inline",children:x?"Finalizar":"Próximo"})]})]}),l&&o.jsx("p",{className:"sfr-error text-sm mt-2 text-center",children:l})]})})})})},eh=(e,t,r)=>{const a={...t},n=r;for(const s of e.containers)for(const i of s.campos)a[i.nome]===void 0&&(i.initialValue!==void 0?a[i.nome]=typeof i.initialValue=="string"?Xe(i.initialValue,n):i.initialValue:i.defaultValue!==void 0&&(a[i.nome]=i.defaultValue));return a},th=({schema:e,initialValues:t={},initialStep:r=0,onSubmitStep:a,onComplete:n,template:s,formTitle:i,externalData:l={},fieldErrors:c={},uploadFile:d,cepLookup:u,resolveTermsUploadUrl:p,fieldResolvers:m,validatorMapper:x,componentMapper:g,paymentMethodOptions:f,onValuesChange:v,className:b,StepIndicator:j=Jf})=>{const[y,N]=E.useState(()=>r),[C,k]=E.useState({...t}),[_,w]=E.useState(!1),[R,A]=E.useState(null),[I,F]=E.useState({}),V=E.useMemo(()=>ua(s),[s]),M=E.useMemo(()=>[...e.steps].sort((Y,J)=>Y.ordem-J.ordem),[e.steps]),U=M.length,$=M[Math.min(y,U-1)],T=E.useMemo(()=>eh($,C,l),[$,C,JSON.stringify(l)]),D=E.useMemo(()=>({uploadFile:d,cepLookup:u,resolveTermsUploadUrl:p,externalData:l,fieldResolvers:m,validatorMapper:x,fieldWarnings:I,componentMapper:g,paymentMethodOptions:f}),[d,u,p,m,x,I,g,f,JSON.stringify(l)]),z=E.useCallback(async Y=>{w(!0),A(null);try{const J={...C,...Y};k(J),a&&await a(y,Y),y===U-1?n&&await n(J):N(q=>q+1)}catch(J){console.error("[FormRenderer] Submit error:",J);const q=J instanceof Error?J.message:"Ocorreu um erro. Tente novamente.";A(q)}finally{w(!1)}},[y,C,U,a,n]),L=E.useCallback(()=>{y>0&&N(Y=>Y-1)},[y]),ee=V.layout.eventTitleStyle??"bar";return o.jsx(Jo.Provider,{value:D,children:o.jsx(Ho,{config:V,className:`sfr-root min-h-dvh ${V.wrapperClass??""} ${b??""}`,renderWrapper:!0,children:o.jsxs("div",{className:"sfr-form w-full max-w-4xl mx-auto px-4 py-6 sm:px-6",children:[i&&ee==="bar"&&o.jsx("div",{className:"sfr-form__title w-full text-center text-sm font-medium py-2.5 px-4 mb-6 rounded-lg border",style:{background:"color-mix(in srgb, var(--t-surface) 80%, transparent)",borderColor:"var(--t-border)",color:"var(--t-text-muted)"},children:i}),i&&ee==="inline"&&o.jsxs("div",{className:"text-center mb-6",children:[o.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest mb-1",style:{color:"var(--t-text-muted)"},children:"Inscrição"}),o.jsx("h1",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:i}),o.jsx("div",{className:"h-0.5 w-12 mx-auto mt-3 rounded-full",style:{background:"var(--t-primary)"}})]}),U>1&&o.jsx("div",{className:"mb-8",children:o.jsx(j,{steps:M.map(Y=>({id:Y.id,label:Y.titulo,icone:Y.icone})),currentStep:y,onStepClick:N})}),o.jsx(Qf,{stepIndex:y,totalSteps:U,step:$,defaultValues:T,externalData:l,fieldErrors:c,isSubmitting:_,submitError:R,validatorMapper:x,onWarningsChange:F,onValuesChange:v,onSubmit:z,onBack:L},y)]})})})},rh=({children:e,render:t,onChange:r})=>{const a=Ki(),n=E.useRef(r);return n.current=r,E.useEffect(()=>{var s;(s=n.current)==null||s.call(n,a)},[a.values,a.dirty,a.valid,a.submitting,a.errors,a.warnings]),t?o.jsx(o.Fragment,{children:t(a)}):typeof e=="function"?o.jsx(o.Fragment,{children:e(a)}):e!==void 0?o.jsx(o.Fragment,{children:e}):null},St=[{component:"texto",label:"Texto",icon:P.Type,group:"texto"},{component:"textarea",label:"Área de texto",icon:P.AlignLeft,group:"texto"},{component:"number",label:"Número",icon:P.Hash,group:"texto"},{component:"email",label:"E-mail",icon:P.Mail,group:"texto"},{component:"password",label:"Senha",icon:P.Lock,group:"texto"},{component:"select",label:"Seleção",icon:P.ChevronDown,group:"selecao"},{component:"autocomplete",label:"Autocomplete",icon:P.Search,group:"selecao"},{component:"radio",label:"Radio",icon:P.CircleDot,group:"selecao"},{component:"checkbox",label:"Checkbox",icon:P.CheckSquare,group:"selecao"},{component:"checkbox_group",label:"Grupo de checkboxes",icon:P.ListChecks,group:"selecao"},{component:"switch",label:"Switch (toggle)",icon:P.ToggleLeft,group:"selecao"},{component:"slider",label:"Slider",icon:P.SlidersHorizontal,group:"range"},{component:"rating",label:"Avaliação (estrelas)",icon:P.Star,group:"range"},{component:"color",label:"Cor",icon:P.Palette,group:"range"},{component:"date",label:"Data",icon:P.Calendar,group:"data"},{component:"datetime",label:"Data e hora",icon:P.Clock,group:"data"},{component:"time",label:"Horário",icon:P.Timer,group:"data"},{component:"date_range",label:"Período",icon:P.CalendarRange,group:"data"},{component:"telefone",label:"Telefone",icon:P.Phone,group:"contato"},{component:"cpf",label:"CPF",icon:P.CreditCard,group:"contato"},{component:"cep",label:"CEP",icon:P.MapPin,group:"contato"},{component:"file",label:"Arquivo",icon:P.Upload,group:"outros"},{component:"hidden",label:"Oculto",icon:P.EyeOff,group:"outros"},{component:"field_array",label:"Lista de itens",icon:P.List,group:"outros"},{component:"terms",label:"Termos e condições",icon:P.ScrollText,group:"outros"},{component:"sub_form",label:"Sub-formulário",icon:P.LayoutList,group:"outros"}],an=[{component:"step",label:"Step",icon:P.Layers,color:"border-primary/40 bg-primary/5"},{component:"container",label:"Container",icon:P.BoxSelect,color:"border-blue-500/40 bg-blue-500/5"}],on=[{key:"evento.nome",label:"Nome do evento",type:"string"},{key:"evento.descricao",label:"Descrição",type:"string"},{key:"evento.valor",label:"Valor (centavos)",type:"number"},{key:"evento.valorPorDia",label:"Valor por dia",type:"number"},{key:"evento.vagasTotal",label:"Vagas totais",type:"number"},{key:"evento.vagasPorDia",label:"Vagas por dia",type:"number"},{key:"evento.vagasMasculinas",label:"Vagas masculinas",type:"number"},{key:"evento.vagasFemininas",label:"Vagas femininas",type:"number"},{key:"evento.dataInicioEvento",label:"Data início",type:"date"},{key:"evento.dataFimEvento",label:"Data fim",type:"date"},{key:"evento.dataAberturaInscricoes",label:"Abertura inscrições",type:"date"},{key:"evento.localNome",label:"Local - Nome",type:"string"},{key:"evento.localEndereco",label:"Local - Endereço",type:"string"},{key:"evento.localTelefone",label:"Local - Telefone",type:"string"},{key:"evento.localMapUrl",label:"Local - URL do mapa",type:"string"},{key:"evento.localMapLink",label:"Local - Link do mapa",type:"string"},{key:"evento.status",label:"Status do evento",type:"string"},{key:"evento.publicId",label:"ID público (URL)",type:"string"},{key:"evento.fotoCapa",label:"URL da foto de capa",type:"string"},{key:"evento.template",label:"Template visual",type:"string"}],Ne=e=>e.startsWith("step-")||e==="step"?"step":e.startsWith("container-")||e==="container"?"container":"field",ah=e=>St.find(t=>t.component===e),Ji=e=>{const t=St.map(a=>a.component).filter(a=>a.includes("_"));for(const a of t)if(e.startsWith(a))return St.find(n=>n.component===a);const r=e.split("-")[0];return St.find(a=>a.component===r)},Qi=E.createContext(null),oh=e=>{if(e.startsWith("step"))return"step";if(e.startsWith("container"))return"container";const t=e.match(/^([a-z_]+)-/);return t?t[1]:e.split("-")[0]},to=(e,t)=>{const r=t||oh(e),a=r==="step",n=r==="container",s=r==="field_array";return{label:a?"Novo Step":n?"Novo Container":s?"Lista de itens":r||e,name:e,fieldType:r||"texto",required:!1,columns:2,tamanho:n||s?12:a?void 0:6,showLabel:n?!0:void 0,itemLabel:s?"Item":void 0}},ro=e=>({containers:JSON.parse(JSON.stringify(e.containers)),configs:JSON.parse(JSON.stringify(e.configs))}),el=(e,t)=>{const r=[e],a=t[e];if(a!=null&&a.children)for(const n of a.children)r.push(...el(n,t));return r},tl=(e,t)=>{for(const[r,a]of Object.entries(t))if(a.children.includes(e))return r;return null},rl=({children:e,initialConfigs:t,initialContainers:r,initialTemplateId:a,schemaId:n,uploadTermsPdf:s})=>{const[i,l]=E.useState({selectedId:null,configs:t||{},showPreview:!1,containers:r??{root:{children:[]}},previewTemplateId:a||"moderno"}),[c,d]=E.useState(null),[u,p]=E.useState(null),m=E.useRef([]),x=E.useRef([]),g=$=>{m.current=[...m.current.slice(-49),ro($)],x.current=[]},f=E.useCallback(()=>{l($=>(g($),{...$}))},[]),v=E.useCallback(()=>{m.current.length!==0&&l($=>{x.current=[...x.current,ro($)];const T=m.current.pop();return{...$,containers:T.containers,configs:T.configs}})},[]),b=E.useCallback(()=>{x.current.length!==0&&l($=>{m.current=[...m.current,ro($)];const T=x.current.pop();return{...$,containers:T.containers,configs:T.configs}})},[]);E.useEffect(()=>{const $=T=>{const D=T.metaKey||T.ctrlKey;D&&T.key==="z"&&!T.shiftKey&&(T.preventDefault(),v()),D&&T.key==="z"&&T.shiftKey&&(T.preventDefault(),b()),D&&T.key==="y"&&(T.preventDefault(),b())};return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[v,b]);const j=E.useCallback($=>i.configs[$]??to($),[i.configs]),y=E.useCallback(()=>{const $=[],T=D=>{var z;const L=((z=i.containers[D])==null?void 0:z.children)??[];for(const ee of L)Ne(ee)==="field"?$.push(ee):i.containers[ee]&&T(ee)};return T("root"),$},[i.containers]),N=E.useCallback($=>{l(T=>({...T,selectedId:$}))},[]),C=E.useCallback($=>{l(T=>({...T,showPreview:$}))},[]),k=E.useCallback($=>{l(T=>({...T,previewTemplateId:$}))},[]),_=E.useCallback(($,T)=>{l(D=>({...D,configs:{...D.configs,[$]:{...D.configs[$]??to($),...T}}}))},[]),w=E.useCallback(($,T,D)=>{const z=`${$}-${Fe()}`,L=Ne(z);return l(ee=>{var Y;g(ee);const J={...ee.containers};(L==="step"||L==="container"||$==="field_array")&&(J[z]={children:[]});const q=[...((Y=J[T])==null?void 0:Y.children)??[]];return D!==void 0&&D>=0?q.splice(D,0,z):q.push(z),J[T]={children:q},{...ee,containers:J,configs:{...ee.configs,[z]:to(z,$)},selectedId:z}}),z},[]),R=E.useCallback(($,T)=>{const D=`container-${Fe()}`;return l(z=>{var L,ee,Y;g(z);const J={...z.containers},q={...z.configs},se=[];for(const H of $.containerTemplate.campos){const ie=H.locked?H.id:`${String(H.tipo).toLowerCase()}-${Fe()}`;if(se.push(ie),q[ie]={label:H.label,name:H.locked?H.id:H.nome,fieldType:H.tipo,required:H.obrigatorio||!1,placeholder:H.placeholder,hint:H.hint,tamanho:H.tamanho||6,inicioColuna:H.inicioColuna,defaultValue:H.defaultValue!=null?String(H.defaultValue):void 0,locked:H.locked||!1,options:(L=H.opcoes)==null?void 0:L.map(te=>({value:te.valor,label:te.label})),...H.tipo==="field_array"&&{itemLabel:H.itemLabel,minItems:H.minItems,maxItems:H.maxItems,addLabel:H.addLabel}},H.tipo==="field_array"){const te=[];for(const re of H.subFields??[]){const Q=`${String(re.tipo).toLowerCase()}-${Fe()}`;te.push(Q),q[Q]={label:re.label,name:re.nome,fieldType:re.tipo,required:re.obrigatorio||!1,placeholder:re.placeholder,hint:re.hint,tamanho:re.tamanho||6,inicioColuna:re.inicioColuna,options:(ee=re.opcoes)==null?void 0:ee.map(fe=>({value:fe.valor,label:fe.label}))}}J[ie]={children:te}}}J[D]={children:se},q[D]={label:$.containerTemplate.titulo||$.name,description:$.containerTemplate.descricao,icone:$.containerTemplate.icone,tamanho:$.containerTemplate.tamanho||12,inicioColuna:$.containerTemplate.inicioColuna,showLabel:!0};const me=[...((Y=J[T])==null?void 0:Y.children)??[]];return me.push(D),J[T]={children:me},{...z,containers:J,configs:q,selectedId:D}}),D},[]),A=E.useCallback($=>{const T=[];return l(D=>{var z,L,ee;g(D);const Y={...D.containers},J={...D.configs};for(const q of $.steps){const se=`step-${Fe()}`;T.push(se);const me=[];for(const ie of q.containers){const te=`container-${Fe()}`;me.push(te);const re=[];for(const Q of ie.campos){const fe=Q.locked?Q.id:`${String(Q.tipo).toLowerCase()}-${Fe()}`;if(re.push(fe),J[fe]={label:Q.label,name:Q.locked?Q.id:Q.nome,fieldType:Q.tipo,required:Q.obrigatorio||!1,placeholder:Q.placeholder,hint:Q.hint,tamanho:Q.tamanho||12,inicioColuna:Q.inicioColuna,defaultValue:Q.defaultValue!=null?String(Q.defaultValue):void 0,locked:Q.locked||!1,options:(z=Q.opcoes)==null?void 0:z.map(we=>({value:we.valor,label:we.label})),...Q.tipo==="field_array"&&{itemLabel:Q.itemLabel,minItems:Q.minItems,maxItems:Q.maxItems,addLabel:Q.addLabel}},Q.tipo==="field_array"){const we=[];for(const je of Q.subFields??[]){const Me=`${String(je.tipo).toLowerCase()}-${Fe()}`;we.push(Me),J[Me]={label:je.label,name:je.nome,fieldType:je.tipo,required:je.obrigatorio||!1,placeholder:je.placeholder,hint:je.hint,tamanho:je.tamanho||6,inicioColuna:je.inicioColuna,options:(L=je.opcoes)==null?void 0:L.map(Ae=>({value:Ae.valor,label:Ae.label}))}}Y[fe]={children:we}}}Y[te]={children:re},J[te]={label:ie.titulo,description:ie.descricao,icone:ie.icone,tamanho:ie.tamanho||12,showLabel:!0}}Y[se]={children:me},J[se]={label:q.titulo,description:q.descricao,icone:q.icone};const H=[...((ee=Y.root)==null?void 0:ee.children)??[],se];Y.root={children:H}}return{...D,containers:Y,configs:J,selectedId:T[0]??D.selectedId}}),T},[]),I=E.useCallback(($,T,D,z)=>{l(L=>{var ee,Y;g(L);const J={...L.containers},q=(((ee=J[T])==null?void 0:ee.children)??[]).filter(H=>H!==$);J[T]={children:q};const se=[...(((Y=J[D])==null?void 0:Y.children)??[]).filter(H=>H!==$)],me=Math.max(0,Math.min(z,se.length));return se.splice(me,0,$),J[D]={children:se},{...L,containers:J}})},[]),F=E.useCallback(($,T)=>{l(D=>(g(D),{...D,containers:{...D.containers,[$]:{children:T}}}))},[]),V=E.useCallback($=>{l(T=>{g(T);const D=el($,T.containers),z={};for(const[ee,Y]of Object.entries(T.containers))D.includes(ee)||(z[ee]={children:Y.children.filter(J=>J!==$)});const L={...T.configs};for(const ee of D)delete L[ee];return{...T,containers:z,configs:L,selectedId:D.includes(T.selectedId??"")?null:T.selectedId}})},[]),M=E.useCallback(($,T)=>{l(D=>{const z=tl($,D.containers);if(!z)return D;const L=[...D.containers[z].children],ee=L.indexOf($),Y=T==="up"?ee-1:ee+1;return Y<0||Y>=L.length?D:([L[ee],L[Y]]=[L[Y],L[ee]],{...D,containers:{...D.containers,[z]:{children:L}}})})},[]),U=E.useCallback(($,T)=>{f(),M($,T)},[M,f]);return o.jsx(Qi.Provider,{value:{selectedId:i.selectedId,configs:i.configs,showPreview:i.showPreview,containers:i.containers,positionDrag:c,reorderDrag:u,canUndo:m.current.length>0,canRedo:x.current.length>0,schemaId:n,uploadTermsPdf:s,previewTemplateId:i.previewTemplateId,setPreviewTemplateId:k,getConfig:j,getAllFieldIds:y,setSelected:N,updateConfig:_,setShowPreview:C,addItem:w,addPresetBlock:R,addPresetStepBlock:A,moveCanvasItem:I,reorderInContainer:F,removeItem:V,moveItem:U,moveItemNoSnapshot:M,setPositionDrag:d,setReorderDrag:p,undo:v,redo:b,pushSnapshot:f},children:e})},Je=()=>{const e=E.useContext(Qi);if(!e)throw new Error("useBuilder must be inside BuilderProvider");return e};function ks(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function nn(...e){return t=>{let r=!1;const a=e.map(n=>{const s=ks(n,t);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let n=0;n<a.length;n++){const s=a[n];typeof s=="function"?s():ks(e[n],null)}}}}function pe(...e){return h.useCallback(nn(...e),e)}var nh=Symbol.for("react.lazy"),Kr=h[" use ".trim().toString()];function sh(e){return typeof e=="object"&&e!==null&&"then"in e}function al(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===nh&&"_payload"in e&&sh(e._payload)}function ol(e){const t=lh(e),r=h.forwardRef((a,n)=>{let{children:s,...i}=a;al(s)&&typeof Kr=="function"&&(s=Kr(s._payload));const l=h.Children.toArray(s),c=l.find(dh);if(c){const d=c.props.children,u=l.map(p=>p===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:p);return o.jsx(t,{...i,ref:n,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return o.jsx(t,{...i,ref:n,children:s})});return r.displayName=`${e}.Slot`,r}var ih=ol("Slot");function lh(e){const t=h.forwardRef((r,a)=>{let{children:n,...s}=r;if(al(n)&&typeof Kr=="function"&&(n=Kr(n._payload)),h.isValidElement(n)){const i=ph(n),l=uh(s,n.props);return n.type!==h.Fragment&&(l.ref=a?nn(a,i):i),h.cloneElement(n,l)}return h.Children.count(n)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var ch=Symbol("radix.slottable");function dh(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===ch}function uh(e,t){const r={...t};for(const a in t){const n=e[a],s=t[a];/^on[A-Z]/.test(a)?n&&s?r[a]=(...i)=>{const l=s(...i);return n(...i),l}:n&&(r[a]=n):a==="style"?r[a]={...n,...s}:a==="className"&&(r[a]=[n,s].filter(Boolean).join(" "))}return{...e,...r}}function ph(e){var t,r;let a=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning;return n?e.ref:(a=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var mh=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ya=mh.reduce((e,t)=>{const r=ol(`Primitive.${t}`),a=h.forwardRef((n,s)=>{const{asChild:i,...l}=n,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{}),fh="Separator",_s="horizontal",hh=["horizontal","vertical"],nl=h.forwardRef((e,t)=>{const{decorative:r,orientation:a=_s,...n}=e,s=xh(a)?a:_s,i=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return o.jsx(ya.div,{"data-orientation":s,...i,...n,ref:t})});nl.displayName=fh;function xh(e){return hh.includes(e)}var sl=nl;function il(e){var t,r,a="";if(typeof e=="string"||typeof e=="number")a+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=il(e[t]))&&(a&&(a+=" "),a+=r)}else for(r in e)e[r]&&(a&&(a+=" "),a+=r);return a}function ll(){for(var e,t,r=0,a="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=il(e))&&(a&&(a+=" "),a+=t);return a}const gh=(e,t)=>{const r=new Array(e.length+t.length);for(let a=0;a<e.length;a++)r[a]=e[a];for(let a=0;a<t.length;a++)r[e.length+a]=t[a];return r},vh=(e,t)=>({classGroupId:e,validator:t}),cl=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Jr="-",Es=[],bh="arbitrary..",yh=e=>{const t=jh(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:a}=e;return{getClassGroupId:n=>{if(n.startsWith("[")&&n.endsWith("]"))return wh(n);const s=n.split(Jr),i=s[0]===""&&s.length>1?1:0;return dl(s,i,t)},getConflictingClassGroupIds:(n,s)=>{if(s){const i=a[n],l=r[n];return i?l?gh(l,i):i:l||Es}return r[n]||Es}}},dl=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const a=e[t],n=r.nextPart.get(a);if(n){const c=dl(e,t+1,n);if(c)return c}const s=r.validators;if(s===null)return;const i=t===0?e.join(Jr):e.slice(t).join(Jr),l=s.length;for(let c=0;c<l;c++){const d=s[c];if(d.validator(i))return d.classGroupId}},wh=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),a=t.slice(0,r);return a?bh+a:void 0})(),jh=e=>{const{theme:t,classGroups:r}=e;return Nh(r,t)},Nh=(e,t)=>{const r=cl();for(const a in e){const n=e[a];sn(n,r,a,t)}return r},sn=(e,t,r,a)=>{const n=e.length;for(let s=0;s<n;s++){const i=e[s];Ch(i,t,r,a)}},Ch=(e,t,r,a)=>{if(typeof e=="string"){Sh(e,t,r);return}if(typeof e=="function"){kh(e,t,r,a);return}_h(e,t,r,a)},Sh=(e,t,r)=>{const a=e===""?t:ul(t,e);a.classGroupId=r},kh=(e,t,r,a)=>{if(Eh(e)){sn(e(a),t,r,a);return}t.validators===null&&(t.validators=[]),t.validators.push(vh(r,e))},_h=(e,t,r,a)=>{const n=Object.entries(e),s=n.length;for(let i=0;i<s;i++){const[l,c]=n[i];sn(c,ul(t,l),r,a)}},ul=(e,t)=>{let r=e;const a=t.split(Jr),n=a.length;for(let s=0;s<n;s++){const i=a[s];let l=r.nextPart.get(i);l||(l=cl(),r.nextPart.set(i,l)),r=l}return r},Eh=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Ph=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),a=Object.create(null);const n=(s,i)=>{r[s]=i,t++,t>e&&(t=0,a=r,r=Object.create(null))};return{get(s){let i=r[s];if(i!==void 0)return i;if((i=a[s])!==void 0)return n(s,i),i},set(s,i){s in r?r[s]=i:n(s,i)}}},jo="!",Ps=":",Th=[],Ts=(e,t,r,a,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:a,isExternal:n}),$h=e=>{const{prefix:t,experimentalParseClassName:r}=e;let a=n=>{const s=[];let i=0,l=0,c=0,d;const u=n.length;for(let f=0;f<u;f++){const v=n[f];if(i===0&&l===0){if(v===Ps){s.push(n.slice(c,f)),c=f+1;continue}if(v==="/"){d=f;continue}}v==="["?i++:v==="]"?i--:v==="("?l++:v===")"&&l--}const p=s.length===0?n:n.slice(c);let m=p,x=!1;p.endsWith(jo)?(m=p.slice(0,-1),x=!0):p.startsWith(jo)&&(m=p.slice(1),x=!0);const g=d&&d>c?d-c:void 0;return Ts(s,x,m,g)};if(t){const n=t+Ps,s=a;a=i=>i.startsWith(n)?s(i.slice(n.length)):Ts(Th,!1,i,void 0,!0)}if(r){const n=a;a=s=>r({className:s,parseClassName:n})}return a},Rh=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,a)=>{t.set(r,1e6+a)}),r=>{const a=[];let n=[];for(let s=0;s<r.length;s++){const i=r[s],l=i[0]==="[",c=t.has(i);l||c?(n.length>0&&(n.sort(),a.push(...n),n=[]),a.push(i)):n.push(i)}return n.length>0&&(n.sort(),a.push(...n)),a}},Oh=e=>({cache:Ph(e.cacheSize),parseClassName:$h(e),sortModifiers:Rh(e),...yh(e)}),Dh=/\s+/,Ah=(e,t)=>{const{parseClassName:r,getClassGroupId:a,getConflictingClassGroupIds:n,sortModifiers:s}=t,i=[],l=e.trim().split(Dh);let c="";for(let d=l.length-1;d>=0;d-=1){const u=l[d],{isExternal:p,modifiers:m,hasImportantModifier:x,baseClassName:g,maybePostfixModifierPosition:f}=r(u);if(p){c=u+(c.length>0?" "+c:c);continue}let v=!!f,b=a(v?g.substring(0,f):g);if(!b){if(!v){c=u+(c.length>0?" "+c:c);continue}if(b=a(g),!b){c=u+(c.length>0?" "+c:c);continue}v=!1}const j=m.length===0?"":m.length===1?m[0]:s(m).join(":"),y=x?j+jo:j,N=y+b;if(i.indexOf(N)>-1)continue;i.push(N);const C=n(b,v);for(let k=0;k<C.length;++k){const _=C[k];i.push(y+_)}c=u+(c.length>0?" "+c:c)}return c},Ih=(...e)=>{let t=0,r,a,n="";for(;t<e.length;)(r=e[t++])&&(a=pl(r))&&(n&&(n+=" "),n+=a);return n},pl=e=>{if(typeof e=="string")return e;let t,r="";for(let a=0;a<e.length;a++)e[a]&&(t=pl(e[a]))&&(r&&(r+=" "),r+=t);return r},Lh=(e,...t)=>{let r,a,n,s;const i=c=>{const d=t.reduce((u,p)=>p(u),e());return r=Oh(d),a=r.cache.get,n=r.cache.set,s=l,l(c)},l=c=>{const d=a(c);if(d)return d;const u=Ah(c,r);return n(c,u),u};return s=i,(...c)=>s(Ih(...c))},zh=[],_e=e=>{const t=r=>r[e]||zh;return t.isThemeGetter=!0,t},ml=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,fl=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Mh=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Fh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Vh=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Bh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Uh=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Hh=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wt=e=>Mh.test(e),ue=e=>!!e&&!Number.isNaN(Number(e)),jt=e=>!!e&&Number.isInteger(Number(e)),ao=e=>e.endsWith("%")&&ue(e.slice(0,-1)),ft=e=>Fh.test(e),hl=()=>!0,Wh=e=>Vh.test(e)&&!Bh.test(e),ln=()=>!1,qh=e=>Uh.test(e),Zh=e=>Hh.test(e),Xh=e=>!X(e)&&!K(e),Gh=e=>$t(e,vl,ln),X=e=>ml.test(e),It=e=>$t(e,bl,Wh),$s=e=>$t(e,ax,ue),Yh=e=>$t(e,wl,hl),Kh=e=>$t(e,yl,ln),Rs=e=>$t(e,xl,ln),Jh=e=>$t(e,gl,Zh),zr=e=>$t(e,jl,qh),K=e=>fl.test(e),gr=e=>qt(e,bl),Qh=e=>qt(e,yl),Os=e=>qt(e,xl),ex=e=>qt(e,vl),tx=e=>qt(e,gl),Mr=e=>qt(e,jl,!0),rx=e=>qt(e,wl,!0),$t=(e,t,r)=>{const a=ml.exec(e);return a?a[1]?t(a[1]):r(a[2]):!1},qt=(e,t,r=!1)=>{const a=fl.exec(e);return a?a[1]?t(a[1]):r:!1},xl=e=>e==="position"||e==="percentage",gl=e=>e==="image"||e==="url",vl=e=>e==="length"||e==="size"||e==="bg-size",bl=e=>e==="length",ax=e=>e==="number",yl=e=>e==="family-name",wl=e=>e==="number"||e==="weight",jl=e=>e==="shadow",ox=()=>{const e=_e("color"),t=_e("font"),r=_e("text"),a=_e("font-weight"),n=_e("tracking"),s=_e("leading"),i=_e("breakpoint"),l=_e("container"),c=_e("spacing"),d=_e("radius"),u=_e("shadow"),p=_e("inset-shadow"),m=_e("text-shadow"),x=_e("drop-shadow"),g=_e("blur"),f=_e("perspective"),v=_e("aspect"),b=_e("ease"),j=_e("animate"),y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[...N(),K,X],k=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto","contain","none"],w=()=>[K,X,c],R=()=>[wt,"full","auto",...w()],A=()=>[jt,"none","subgrid",K,X],I=()=>["auto",{span:["full",jt,K,X]},jt,K,X],F=()=>[jt,"auto",K,X],V=()=>["auto","min","max","fr",K,X],M=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],U=()=>["start","end","center","stretch","center-safe","end-safe"],$=()=>["auto",...w()],T=()=>[wt,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...w()],D=()=>[wt,"screen","full","dvw","lvw","svw","min","max","fit",...w()],z=()=>[wt,"screen","full","lh","dvh","lvh","svh","min","max","fit",...w()],L=()=>[e,K,X],ee=()=>[...N(),Os,Rs,{position:[K,X]}],Y=()=>["no-repeat",{repeat:["","x","y","space","round"]}],J=()=>["auto","cover","contain",ex,Gh,{size:[K,X]}],q=()=>[ao,gr,It],se=()=>["","none","full",d,K,X],me=()=>["",ue,gr,It],H=()=>["solid","dashed","dotted","double"],ie=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=()=>[ue,ao,Os,Rs],re=()=>["","none",g,K,X],Q=()=>["none",ue,K,X],fe=()=>["none",ue,K,X],we=()=>[ue,K,X],je=()=>[wt,"full",...w()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ft],breakpoint:[ft],color:[hl],container:[ft],"drop-shadow":[ft],ease:["in","out","in-out"],font:[Xh],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ft],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ft],shadow:[ft],spacing:["px",ue],text:[ft],"text-shadow":[ft],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",wt,X,K,v]}],container:["container"],columns:[{columns:[ue,X,K,l]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:C()}],overflow:[{overflow:k()}],"overflow-x":[{"overflow-x":k()}],"overflow-y":[{"overflow-y":k()}],overscroll:[{overscroll:_()}],"overscroll-x":[{"overscroll-x":_()}],"overscroll-y":[{"overscroll-y":_()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:R()}],"inset-x":[{"inset-x":R()}],"inset-y":[{"inset-y":R()}],start:[{"inset-s":R(),start:R()}],end:[{"inset-e":R(),end:R()}],"inset-bs":[{"inset-bs":R()}],"inset-be":[{"inset-be":R()}],top:[{top:R()}],right:[{right:R()}],bottom:[{bottom:R()}],left:[{left:R()}],visibility:["visible","invisible","collapse"],z:[{z:[jt,"auto",K,X]}],basis:[{basis:[wt,"full","auto",l,...w()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ue,wt,"auto","initial","none",X]}],grow:[{grow:["",ue,K,X]}],shrink:[{shrink:["",ue,K,X]}],order:[{order:[jt,"first","last","none",K,X]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":V()}],"auto-rows":[{"auto-rows":V()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...M(),"normal"]}],"justify-items":[{"justify-items":[...U(),"normal"]}],"justify-self":[{"justify-self":["auto",...U()]}],"align-content":[{content:["normal",...M()]}],"align-items":[{items:[...U(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...U(),{baseline:["","last"]}]}],"place-content":[{"place-content":M()}],"place-items":[{"place-items":[...U(),"baseline"]}],"place-self":[{"place-self":["auto",...U()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:$()}],mx:[{mx:$()}],my:[{my:$()}],ms:[{ms:$()}],me:[{me:$()}],mbs:[{mbs:$()}],mbe:[{mbe:$()}],mt:[{mt:$()}],mr:[{mr:$()}],mb:[{mb:$()}],ml:[{ml:$()}],"space-x":[{"space-x":w()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":w()}],"space-y-reverse":["space-y-reverse"],size:[{size:T()}],"inline-size":[{inline:["auto",...D()]}],"min-inline-size":[{"min-inline":["auto",...D()]}],"max-inline-size":[{"max-inline":["none",...D()]}],"block-size":[{block:["auto",...z()]}],"min-block-size":[{"min-block":["auto",...z()]}],"max-block-size":[{"max-block":["none",...z()]}],w:[{w:[l,"screen",...T()]}],"min-w":[{"min-w":[l,"screen","none",...T()]}],"max-w":[{"max-w":[l,"screen","none","prose",{screen:[i]},...T()]}],h:[{h:["screen","lh",...T()]}],"min-h":[{"min-h":["screen","lh","none",...T()]}],"max-h":[{"max-h":["screen","lh",...T()]}],"font-size":[{text:["base",r,gr,It]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[a,rx,Yh]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ao,X]}],"font-family":[{font:[Qh,Kh,t]}],"font-features":[{"font-features":[X]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,K,X]}],"line-clamp":[{"line-clamp":[ue,"none",K,$s]}],leading:[{leading:[s,...w()]}],"list-image":[{"list-image":["none",K,X]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",K,X]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:L()}],"text-color":[{text:L()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...H(),"wavy"]}],"text-decoration-thickness":[{decoration:[ue,"from-font","auto",K,It]}],"text-decoration-color":[{decoration:L()}],"underline-offset":[{"underline-offset":[ue,"auto",K,X]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:w()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",K,X]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",K,X]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:Y()}],"bg-size":[{bg:J()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},jt,K,X],radial:["",K,X],conic:[jt,K,X]},tx,Jh]}],"bg-color":[{bg:L()}],"gradient-from-pos":[{from:q()}],"gradient-via-pos":[{via:q()}],"gradient-to-pos":[{to:q()}],"gradient-from":[{from:L()}],"gradient-via":[{via:L()}],"gradient-to":[{to:L()}],rounded:[{rounded:se()}],"rounded-s":[{"rounded-s":se()}],"rounded-e":[{"rounded-e":se()}],"rounded-t":[{"rounded-t":se()}],"rounded-r":[{"rounded-r":se()}],"rounded-b":[{"rounded-b":se()}],"rounded-l":[{"rounded-l":se()}],"rounded-ss":[{"rounded-ss":se()}],"rounded-se":[{"rounded-se":se()}],"rounded-ee":[{"rounded-ee":se()}],"rounded-es":[{"rounded-es":se()}],"rounded-tl":[{"rounded-tl":se()}],"rounded-tr":[{"rounded-tr":se()}],"rounded-br":[{"rounded-br":se()}],"rounded-bl":[{"rounded-bl":se()}],"border-w":[{border:me()}],"border-w-x":[{"border-x":me()}],"border-w-y":[{"border-y":me()}],"border-w-s":[{"border-s":me()}],"border-w-e":[{"border-e":me()}],"border-w-bs":[{"border-bs":me()}],"border-w-be":[{"border-be":me()}],"border-w-t":[{"border-t":me()}],"border-w-r":[{"border-r":me()}],"border-w-b":[{"border-b":me()}],"border-w-l":[{"border-l":me()}],"divide-x":[{"divide-x":me()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":me()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...H(),"hidden","none"]}],"divide-style":[{divide:[...H(),"hidden","none"]}],"border-color":[{border:L()}],"border-color-x":[{"border-x":L()}],"border-color-y":[{"border-y":L()}],"border-color-s":[{"border-s":L()}],"border-color-e":[{"border-e":L()}],"border-color-bs":[{"border-bs":L()}],"border-color-be":[{"border-be":L()}],"border-color-t":[{"border-t":L()}],"border-color-r":[{"border-r":L()}],"border-color-b":[{"border-b":L()}],"border-color-l":[{"border-l":L()}],"divide-color":[{divide:L()}],"outline-style":[{outline:[...H(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ue,K,X]}],"outline-w":[{outline:["",ue,gr,It]}],"outline-color":[{outline:L()}],shadow:[{shadow:["","none",u,Mr,zr]}],"shadow-color":[{shadow:L()}],"inset-shadow":[{"inset-shadow":["none",p,Mr,zr]}],"inset-shadow-color":[{"inset-shadow":L()}],"ring-w":[{ring:me()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:L()}],"ring-offset-w":[{"ring-offset":[ue,It]}],"ring-offset-color":[{"ring-offset":L()}],"inset-ring-w":[{"inset-ring":me()}],"inset-ring-color":[{"inset-ring":L()}],"text-shadow":[{"text-shadow":["none",m,Mr,zr]}],"text-shadow-color":[{"text-shadow":L()}],opacity:[{opacity:[ue,K,X]}],"mix-blend":[{"mix-blend":[...ie(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ie()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ue]}],"mask-image-linear-from-pos":[{"mask-linear-from":te()}],"mask-image-linear-to-pos":[{"mask-linear-to":te()}],"mask-image-linear-from-color":[{"mask-linear-from":L()}],"mask-image-linear-to-color":[{"mask-linear-to":L()}],"mask-image-t-from-pos":[{"mask-t-from":te()}],"mask-image-t-to-pos":[{"mask-t-to":te()}],"mask-image-t-from-color":[{"mask-t-from":L()}],"mask-image-t-to-color":[{"mask-t-to":L()}],"mask-image-r-from-pos":[{"mask-r-from":te()}],"mask-image-r-to-pos":[{"mask-r-to":te()}],"mask-image-r-from-color":[{"mask-r-from":L()}],"mask-image-r-to-color":[{"mask-r-to":L()}],"mask-image-b-from-pos":[{"mask-b-from":te()}],"mask-image-b-to-pos":[{"mask-b-to":te()}],"mask-image-b-from-color":[{"mask-b-from":L()}],"mask-image-b-to-color":[{"mask-b-to":L()}],"mask-image-l-from-pos":[{"mask-l-from":te()}],"mask-image-l-to-pos":[{"mask-l-to":te()}],"mask-image-l-from-color":[{"mask-l-from":L()}],"mask-image-l-to-color":[{"mask-l-to":L()}],"mask-image-x-from-pos":[{"mask-x-from":te()}],"mask-image-x-to-pos":[{"mask-x-to":te()}],"mask-image-x-from-color":[{"mask-x-from":L()}],"mask-image-x-to-color":[{"mask-x-to":L()}],"mask-image-y-from-pos":[{"mask-y-from":te()}],"mask-image-y-to-pos":[{"mask-y-to":te()}],"mask-image-y-from-color":[{"mask-y-from":L()}],"mask-image-y-to-color":[{"mask-y-to":L()}],"mask-image-radial":[{"mask-radial":[K,X]}],"mask-image-radial-from-pos":[{"mask-radial-from":te()}],"mask-image-radial-to-pos":[{"mask-radial-to":te()}],"mask-image-radial-from-color":[{"mask-radial-from":L()}],"mask-image-radial-to-color":[{"mask-radial-to":L()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[ue]}],"mask-image-conic-from-pos":[{"mask-conic-from":te()}],"mask-image-conic-to-pos":[{"mask-conic-to":te()}],"mask-image-conic-from-color":[{"mask-conic-from":L()}],"mask-image-conic-to-color":[{"mask-conic-to":L()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:Y()}],"mask-size":[{mask:J()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",K,X]}],filter:[{filter:["","none",K,X]}],blur:[{blur:re()}],brightness:[{brightness:[ue,K,X]}],contrast:[{contrast:[ue,K,X]}],"drop-shadow":[{"drop-shadow":["","none",x,Mr,zr]}],"drop-shadow-color":[{"drop-shadow":L()}],grayscale:[{grayscale:["",ue,K,X]}],"hue-rotate":[{"hue-rotate":[ue,K,X]}],invert:[{invert:["",ue,K,X]}],saturate:[{saturate:[ue,K,X]}],sepia:[{sepia:["",ue,K,X]}],"backdrop-filter":[{"backdrop-filter":["","none",K,X]}],"backdrop-blur":[{"backdrop-blur":re()}],"backdrop-brightness":[{"backdrop-brightness":[ue,K,X]}],"backdrop-contrast":[{"backdrop-contrast":[ue,K,X]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ue,K,X]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ue,K,X]}],"backdrop-invert":[{"backdrop-invert":["",ue,K,X]}],"backdrop-opacity":[{"backdrop-opacity":[ue,K,X]}],"backdrop-saturate":[{"backdrop-saturate":[ue,K,X]}],"backdrop-sepia":[{"backdrop-sepia":["",ue,K,X]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",K,X]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ue,"initial",K,X]}],ease:[{ease:["linear","initial",b,K,X]}],delay:[{delay:[ue,K,X]}],animate:[{animate:["none",j,K,X]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,K,X]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:Q()}],"rotate-x":[{"rotate-x":Q()}],"rotate-y":[{"rotate-y":Q()}],"rotate-z":[{"rotate-z":Q()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":["scale-3d"],skew:[{skew:we()}],"skew-x":[{"skew-x":we()}],"skew-y":[{"skew-y":we()}],transform:[{transform:[K,X,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:je()}],"translate-x":[{"translate-x":je()}],"translate-y":[{"translate-y":je()}],"translate-z":[{"translate-z":je()}],"translate-none":["translate-none"],accent:[{accent:L()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:L()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",K,X]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",K,X]}],fill:[{fill:["none",...L()]}],"stroke-w":[{stroke:[ue,gr,It,$s]}],stroke:[{stroke:["none",...L()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},nx=Lh(ox);function G(...e){return nx(ll(e))}const Ze=h.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...a},n)=>o.jsx(sl,{ref:n,decorative:r,orientation:t,className:G("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...a}));Ze.displayName=sl.displayName;const ae=h.forwardRef(({className:e,type:t,...r},a)=>o.jsx("input",{type:t,className:G("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:a,...r}));ae.displayName="Input";var sx="Label",Nl=h.forwardRef((e,t)=>o.jsx(ya.label,{...e,ref:t,onMouseDown:r=>{var a;r.target.closest("button, input, select, textarea")||((a=e.onMouseDown)==null||a.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Nl.displayName=sx;var Cl=Nl;const Ds=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,As=ll,cn=(e,t)=>r=>{var a;if((t==null?void 0:t.variants)==null)return As(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:n,defaultVariants:s}=t,i=Object.keys(n).map(d=>{const u=r==null?void 0:r[d],p=s==null?void 0:s[d];if(u===null)return null;const m=Ds(u)||Ds(p);return n[d][m]}),l=r&&Object.entries(r).reduce((d,u)=>{let[p,m]=u;return m===void 0||(d[p]=m),d},{}),c=t==null||(a=t.compoundVariants)===null||a===void 0?void 0:a.reduce((d,u)=>{let{class:p,className:m,...x}=u;return Object.entries(x).every(g=>{let[f,v]=g;return Array.isArray(v)?v.includes({...s,...l}[f]):{...s,...l}[f]===v})?[...d,p,m]:d},[]);return As(e,i,c,r==null?void 0:r.class,r==null?void 0:r.className)},ix=cn("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),W=h.forwardRef(({className:e,...t},r)=>o.jsx(Cl,{ref:r,className:G(ix(),e),...t}));W.displayName=Cl.displayName;function lx(e,t){const r=h.createContext(t),a=s=>{const{children:i,...l}=s,c=h.useMemo(()=>l,Object.values(l));return o.jsx(r.Provider,{value:c,children:i})};a.displayName=e+"Provider";function n(s){const i=h.useContext(r);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[a,n]}function bt(e,t=[]){let r=[];function a(s,i){const l=h.createContext(i),c=r.length;r=[...r,i];const d=p=>{var m;const{scope:x,children:g,...f}=p,v=((m=x==null?void 0:x[e])==null?void 0:m[c])||l,b=h.useMemo(()=>f,Object.values(f));return o.jsx(v.Provider,{value:b,children:g})};d.displayName=s+"Provider";function u(p,m){var x;const g=((x=m==null?void 0:m[e])==null?void 0:x[c])||l,f=h.useContext(g);if(f)return f;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[d,u]}const n=()=>{const s=r.map(i=>h.createContext(i));return function(i){const l=(i==null?void 0:i[e])||s;return h.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return n.scopeName=e,[a,cx(n,...t)]}function cx(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const a=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(n){const s=a.reduce((i,{useScope:l,scopeName:c})=>{const d=l(n)[`__scope${c}`];return{...i,...d}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}function oe(e,t,{checkForDefaultPrevented:r=!0}={}){return function(a){if(e==null||e(a),r===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}var Ee=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},dx=h[" useInsertionEffect ".trim().toString()]||Ee;function Vt({prop:e,defaultProp:t,onChange:r=()=>{},caller:a}){const[n,s,i]=ux({defaultProp:t,onChange:r}),l=e!==void 0,c=l?e:n;{const u=h.useRef(e!==void 0);h.useEffect(()=>{const p=u.current;p!==l&&console.warn(`${a} is changing from ${p?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,a])}const d=h.useCallback(u=>{var p;if(l){const m=px(u)?u(e):u;m!==e&&((p=i.current)==null||p.call(i,m))}else s(u)},[l,e,s,i]);return[c,d]}function ux({defaultProp:e,onChange:t}){const[r,a]=h.useState(e),n=h.useRef(r),s=h.useRef(t);return dx(()=>{s.current=t},[t]),h.useEffect(()=>{var i;n.current!==r&&((i=s.current)==null||i.call(s,r),n.current=r)},[r,n]),[r,a,s]}function px(e){return typeof e=="function"}function dn(e){const t=h.useRef({value:e,previous:e});return h.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function un(e){const[t,r]=h.useState(void 0);return Ee(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const a=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const s=n[0];let i,l;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;i=d.inlineSize,l=d.blockSize}else i=e.offsetWidth,l=e.offsetHeight;r({width:i,height:l})});return a.observe(e,{box:"border-box"}),()=>a.unobserve(e)}else r(void 0)},[e]),t}function mx(e,t){return h.useReducer((r,a)=>t[r][a]??r,e)}var Qe=e=>{const{present:t,children:r}=e,a=fx(t),n=typeof r=="function"?r({present:a.isPresent}):h.Children.only(r),s=pe(a.ref,hx(n));return typeof r=="function"||a.isPresent?h.cloneElement(n,{ref:s}):null};Qe.displayName="Presence";function fx(e){const[t,r]=h.useState(),a=h.useRef(null),n=h.useRef(e),s=h.useRef("none"),i=e?"mounted":"unmounted",[l,c]=mx(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const d=Fr(a.current);s.current=l==="mounted"?d:"none"},[l]),Ee(()=>{const d=a.current,u=n.current;if(u!==e){const p=s.current,m=Fr(d);e?c("MOUNT"):m==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&p!==m?"ANIMATION_OUT":"UNMOUNT"),n.current=e}},[e,c]),Ee(()=>{if(t){let d;const u=t.ownerDocument.defaultView??window,p=x=>{const g=Fr(a.current).includes(CSS.escape(x.animationName));if(x.target===t&&g&&(c("ANIMATION_END"),!n.current)){const f=t.style.animationFillMode;t.style.animationFillMode="forwards",d=u.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=f)})}},m=x=>{x.target===t&&(s.current=Fr(a.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{u.clearTimeout(d),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:h.useCallback(d=>{a.current=d?getComputedStyle(d):null,r(d)},[])}}function Fr(e){return(e==null?void 0:e.animationName)||"none"}function hx(e){var t,r;let a=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning;return n?e.ref:(a=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function or(e){const t=xx(e),r=h.forwardRef((a,n)=>{const{children:s,...i}=a,l=h.Children.toArray(s),c=l.find(vx);if(c){const d=c.props.children,u=l.map(p=>p===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:p);return o.jsx(t,{...i,ref:n,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return o.jsx(t,{...i,ref:n,children:s})});return r.displayName=`${e}.Slot`,r}function xx(e){const t=h.forwardRef((r,a)=>{const{children:n,...s}=r;if(h.isValidElement(n)){const i=yx(n),l=bx(s,n.props);return n.type!==h.Fragment&&(l.ref=a?nn(a,i):i),h.cloneElement(n,l)}return h.Children.count(n)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Sl=Symbol("radix.slottable");function gx(e){const t=({children:r})=>o.jsx(o.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=Sl,t}function vx(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Sl}function bx(e,t){const r={...t};for(const a in t){const n=e[a],s=t[a];/^on[A-Z]/.test(a)?n&&s?r[a]=(...i)=>{const l=s(...i);return n(...i),l}:n&&(r[a]=n):a==="style"?r[a]={...n,...s}:a==="className"&&(r[a]=[n,s].filter(Boolean).join(" "))}return{...e,...r}}function yx(e){var t,r;let a=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,n=a&&"isReactWarning"in a&&a.isReactWarning;return n?e.ref:(a=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=a&&"isReactWarning"in a&&a.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var wx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],le=wx.reduce((e,t)=>{const r=or(`Primitive.${t}`),a=h.forwardRef((n,s)=>{const{asChild:i,...l}=n,c=i?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),o.jsx(c,{...l,ref:s})});return a.displayName=`Primitive.${t}`,{...e,[t]:a}},{});function jx(e,t){e&&da.flushSync(()=>e.dispatchEvent(t))}var wa="Checkbox",[Nx]=bt(wa),[Cx,pn]=Nx(wa);function Sx(e){const{__scopeCheckbox:t,checked:r,children:a,defaultChecked:n,disabled:s,form:i,name:l,onCheckedChange:c,required:d,value:u="on",internal_do_not_use_render:p}=e,[m,x]=Vt({prop:r,defaultProp:n??!1,onChange:c,caller:wa}),[g,f]=h.useState(null),[v,b]=h.useState(null),j=h.useRef(!1),y=g?!!i||!!g.closest("form"):!0,N={checked:m,disabled:s,setChecked:x,control:g,setControl:f,name:l,form:i,value:u,hasConsumerStoppedPropagationRef:j,required:d,defaultChecked:kt(n)?!1:n,isFormControl:y,bubbleInput:v,setBubbleInput:b};return o.jsx(Cx,{scope:t,...N,children:kx(p)?p(N):a})}var kl="CheckboxTrigger",_l=h.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...a},n)=>{const{control:s,value:i,disabled:l,checked:c,required:d,setControl:u,setChecked:p,hasConsumerStoppedPropagationRef:m,isFormControl:x,bubbleInput:g}=pn(kl,e),f=pe(n,u),v=h.useRef(c);return h.useEffect(()=>{const b=s==null?void 0:s.form;if(b){const j=()=>p(v.current);return b.addEventListener("reset",j),()=>b.removeEventListener("reset",j)}},[s,p]),o.jsx(le.button,{type:"button",role:"checkbox","aria-checked":kt(c)?"mixed":c,"aria-required":d,"data-state":Rl(c),"data-disabled":l?"":void 0,disabled:l,value:i,...a,ref:f,onKeyDown:oe(t,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:oe(r,b=>{p(j=>kt(j)?!0:!j),g&&x&&(m.current=b.isPropagationStopped(),m.current||b.stopPropagation())})})});_l.displayName=kl;var mn=h.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:a,checked:n,defaultChecked:s,required:i,disabled:l,value:c,onCheckedChange:d,form:u,...p}=e;return o.jsx(Sx,{__scopeCheckbox:r,checked:n,defaultChecked:s,disabled:l,required:i,onCheckedChange:d,name:a,form:u,value:c,internal_do_not_use_render:({isFormControl:m})=>o.jsxs(o.Fragment,{children:[o.jsx(_l,{...p,ref:t,__scopeCheckbox:r}),m&&o.jsx($l,{__scopeCheckbox:r})]})})});mn.displayName=wa;var El="CheckboxIndicator",Pl=h.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:a,...n}=e,s=pn(El,r);return o.jsx(Qe,{present:a||kt(s.checked)||s.checked===!0,children:o.jsx(le.span,{"data-state":Rl(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t,style:{pointerEvents:"none",...e.style}})})});Pl.displayName=El;var Tl="CheckboxBubbleInput",$l=h.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:a,hasConsumerStoppedPropagationRef:n,checked:s,defaultChecked:i,required:l,disabled:c,name:d,value:u,form:p,bubbleInput:m,setBubbleInput:x}=pn(Tl,e),g=pe(r,x),f=dn(s),v=un(a);h.useEffect(()=>{const j=m;if(!j)return;const y=window.HTMLInputElement.prototype,N=Object.getOwnPropertyDescriptor(y,"checked").set,C=!n.current;if(f!==s&&N){const k=new Event("click",{bubbles:C});j.indeterminate=kt(s),N.call(j,kt(s)?!1:s),j.dispatchEvent(k)}},[m,f,s,n]);const b=h.useRef(kt(s)?!1:s);return o.jsx(le.input,{type:"checkbox","aria-hidden":!0,defaultChecked:i??b.current,required:l,disabled:c,name:d,value:u,form:p,...t,tabIndex:-1,ref:g,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});$l.displayName=Tl;function kx(e){return typeof e=="function"}function kt(e){return e==="indeterminate"}function Rl(e){return kt(e)?"indeterminate":e?"checked":"unchecked"}const Pe=h.forwardRef(({className:e,...t},r)=>o.jsx(mn,{ref:r,className:G("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:o.jsx(Pl,{className:G("flex items-center justify-center text-current"),children:o.jsx(P.Check,{className:"h-4 w-4"})})}));Pe.displayName=mn.displayName;const _x=cn("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),ye=h.forwardRef(({className:e,variant:t,size:r,asChild:a=!1,...n},s)=>o.jsx(a?ih:"button",{className:G(_x({variant:t,size:r,className:e})),ref:s,...n}));ye.displayName="Button";function Le(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...r)=>{var a;return(a=t.current)==null?void 0:a.call(t,...r)},[])}var Ex=h.createContext(void 0);function fn(e){const t=h.useContext(Ex);return e||t||"ltr"}function wr(e,[t,r]){return Math.min(r,Math.max(t,e))}function Px(e,t){return h.useReducer((r,a)=>t[r][a]??r,e)}var hn="ScrollArea",[Ol]=bt(hn),[Tx,et]=Ol(hn),Dl=h.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:a="hover",dir:n,scrollHideDelay:s=600,...i}=e,[l,c]=h.useState(null),[d,u]=h.useState(null),[p,m]=h.useState(null),[x,g]=h.useState(null),[f,v]=h.useState(null),[b,j]=h.useState(0),[y,N]=h.useState(0),[C,k]=h.useState(!1),[_,w]=h.useState(!1),R=pe(t,I=>c(I)),A=fn(n);return o.jsx(Tx,{scope:r,type:a,dir:A,scrollHideDelay:s,scrollArea:l,viewport:d,onViewportChange:u,content:p,onContentChange:m,scrollbarX:x,onScrollbarXChange:g,scrollbarXEnabled:C,onScrollbarXEnabledChange:k,scrollbarY:f,onScrollbarYChange:v,scrollbarYEnabled:_,onScrollbarYEnabledChange:w,onCornerWidthChange:j,onCornerHeightChange:N,children:o.jsx(le.div,{dir:A,...i,ref:R,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":y+"px",...e.style}})})});Dl.displayName=hn;var Al="ScrollAreaViewport",Il=h.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:a,nonce:n,...s}=e,i=et(Al,r),l=h.useRef(null),c=pe(t,l,i.onViewportChange);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),o.jsx(le.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:o.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:a})})]})});Il.displayName=Al;var ut="ScrollAreaScrollbar",xn=h.forwardRef((e,t)=>{const{forceMount:r,...a}=e,n=et(ut,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=n,l=e.orientation==="horizontal";return h.useEffect(()=>(l?s(!0):i(!0),()=>{l?s(!1):i(!1)}),[l,s,i]),n.type==="hover"?o.jsx($x,{...a,ref:t,forceMount:r}):n.type==="scroll"?o.jsx(Rx,{...a,ref:t,forceMount:r}):n.type==="auto"?o.jsx(Ll,{...a,ref:t,forceMount:r}):n.type==="always"?o.jsx(gn,{...a,ref:t}):null});xn.displayName=ut;var $x=h.forwardRef((e,t)=>{const{forceMount:r,...a}=e,n=et(ut,e.__scopeScrollArea),[s,i]=h.useState(!1);return h.useEffect(()=>{const l=n.scrollArea;let c=0;if(l){const d=()=>{window.clearTimeout(c),i(!0)},u=()=>{c=window.setTimeout(()=>i(!1),n.scrollHideDelay)};return l.addEventListener("pointerenter",d),l.addEventListener("pointerleave",u),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",d),l.removeEventListener("pointerleave",u)}}},[n.scrollArea,n.scrollHideDelay]),o.jsx(Qe,{present:r||s,children:o.jsx(Ll,{"data-state":s?"visible":"hidden",...a,ref:t})})}),Rx=h.forwardRef((e,t)=>{const{forceMount:r,...a}=e,n=et(ut,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Na(()=>c("SCROLL_END"),100),[l,c]=Px("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return h.useEffect(()=>{if(l==="idle"){const d=window.setTimeout(()=>c("HIDE"),n.scrollHideDelay);return()=>window.clearTimeout(d)}},[l,n.scrollHideDelay,c]),h.useEffect(()=>{const d=n.viewport,u=s?"scrollLeft":"scrollTop";if(d){let p=d[u];const m=()=>{const x=d[u];p!==x&&(c("SCROLL"),i()),p=x};return d.addEventListener("scroll",m),()=>d.removeEventListener("scroll",m)}},[n.viewport,s,c,i]),o.jsx(Qe,{present:r||l!=="hidden",children:o.jsx(gn,{"data-state":l==="hidden"?"hidden":"visible",...a,ref:t,onPointerEnter:oe(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:oe(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Ll=h.forwardRef((e,t)=>{const r=et(ut,e.__scopeScrollArea),{forceMount:a,...n}=e,[s,i]=h.useState(!1),l=e.orientation==="horizontal",c=Na(()=>{if(r.viewport){const d=r.viewport.offsetWidth<r.viewport.scrollWidth,u=r.viewport.offsetHeight<r.viewport.scrollHeight;i(l?d:u)}},10);return nr(r.viewport,c),nr(r.content,c),o.jsx(Qe,{present:a||s,children:o.jsx(gn,{"data-state":s?"visible":"hidden",...n,ref:t})})}),gn=h.forwardRef((e,t)=>{const{orientation:r="vertical",...a}=e,n=et(ut,e.__scopeScrollArea),s=h.useRef(null),i=h.useRef(0),[l,c]=h.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Bl(l.viewport,l.content),u={...a,sizes:l,onSizesChange:c,hasThumb:d>0&&d<1,onThumbChange:m=>s.current=m,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:m=>i.current=m};function p(m,x){return zx(m,i.current,l,x)}return r==="horizontal"?o.jsx(Ox,{...u,ref:t,onThumbPositionChange:()=>{if(n.viewport&&s.current){const m=n.viewport.scrollLeft,x=Is(m,l,n.dir);s.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:m=>{n.viewport&&(n.viewport.scrollLeft=m)},onDragScroll:m=>{n.viewport&&(n.viewport.scrollLeft=p(m,n.dir))}}):r==="vertical"?o.jsx(Dx,{...u,ref:t,onThumbPositionChange:()=>{if(n.viewport&&s.current){const m=n.viewport.scrollTop,x=Is(m,l);s.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:m=>{n.viewport&&(n.viewport.scrollTop=m)},onDragScroll:m=>{n.viewport&&(n.viewport.scrollTop=p(m))}}):null}),Ox=h.forwardRef((e,t)=>{const{sizes:r,onSizesChange:a,...n}=e,s=et(ut,e.__scopeScrollArea),[i,l]=h.useState(),c=h.useRef(null),d=pe(t,c,s.onScrollbarXChange);return h.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(Ml,{"data-orientation":"horizontal",...n,ref:d,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":ja(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.x),onDragScroll:u=>e.onDragScroll(u.x),onWheelScroll:(u,p)=>{if(s.viewport){const m=s.viewport.scrollLeft+u.deltaX;e.onWheelScroll(m),Hl(m,p)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&a({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:ea(i.paddingLeft),paddingEnd:ea(i.paddingRight)}})}})}),Dx=h.forwardRef((e,t)=>{const{sizes:r,onSizesChange:a,...n}=e,s=et(ut,e.__scopeScrollArea),[i,l]=h.useState(),c=h.useRef(null),d=pe(t,c,s.onScrollbarYChange);return h.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),o.jsx(Ml,{"data-orientation":"vertical",...n,ref:d,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":ja(r)+"px",...e.style},onThumbPointerDown:u=>e.onThumbPointerDown(u.y),onDragScroll:u=>e.onDragScroll(u.y),onWheelScroll:(u,p)=>{if(s.viewport){const m=s.viewport.scrollTop+u.deltaY;e.onWheelScroll(m),Hl(m,p)&&u.preventDefault()}},onResize:()=>{c.current&&s.viewport&&i&&a({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:ea(i.paddingTop),paddingEnd:ea(i.paddingBottom)}})}})}),[Ax,zl]=Ol(ut),Ml=h.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:a,hasThumb:n,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:u,onResize:p,...m}=e,x=et(ut,r),[g,f]=h.useState(null),v=pe(t,R=>f(R)),b=h.useRef(null),j=h.useRef(""),y=x.viewport,N=a.content-a.viewport,C=Le(u),k=Le(c),_=Na(p,10);function w(R){if(b.current){const A=R.clientX-b.current.left,I=R.clientY-b.current.top;d({x:A,y:I})}}return h.useEffect(()=>{const R=A=>{const I=A.target;g!=null&&g.contains(I)&&C(A,N)};return document.addEventListener("wheel",R,{passive:!1}),()=>document.removeEventListener("wheel",R,{passive:!1})},[y,g,N,C]),h.useEffect(k,[a,k]),nr(g,_),nr(x.content,_),o.jsx(Ax,{scope:r,scrollbar:g,hasThumb:n,onThumbChange:Le(s),onThumbPointerUp:Le(i),onThumbPositionChange:k,onThumbPointerDown:Le(l),children:o.jsx(le.div,{...m,ref:v,style:{position:"absolute",...m.style},onPointerDown:oe(e.onPointerDown,R=>{R.button===0&&(R.target.setPointerCapture(R.pointerId),b.current=g.getBoundingClientRect(),j.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",x.viewport&&(x.viewport.style.scrollBehavior="auto"),w(R))}),onPointerMove:oe(e.onPointerMove,w),onPointerUp:oe(e.onPointerUp,R=>{const A=R.target;A.hasPointerCapture(R.pointerId)&&A.releasePointerCapture(R.pointerId),document.body.style.webkitUserSelect=j.current,x.viewport&&(x.viewport.style.scrollBehavior=""),b.current=null})})})}),Qr="ScrollAreaThumb",Fl=h.forwardRef((e,t)=>{const{forceMount:r,...a}=e,n=zl(Qr,e.__scopeScrollArea);return o.jsx(Qe,{present:r||n.hasThumb,children:o.jsx(Ix,{ref:t,...a})})}),Ix=h.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:a,...n}=e,s=et(Qr,r),i=zl(Qr,r),{onThumbPositionChange:l}=i,c=pe(t,p=>i.onThumbChange(p)),d=h.useRef(void 0),u=Na(()=>{d.current&&(d.current(),d.current=void 0)},100);return h.useEffect(()=>{const p=s.viewport;if(p){const m=()=>{if(u(),!d.current){const x=Mx(p,l);d.current=x,l()}};return l(),p.addEventListener("scroll",m),()=>p.removeEventListener("scroll",m)}},[s.viewport,u,l]),o.jsx(le.div,{"data-state":i.hasThumb?"visible":"hidden",...n,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...a},onPointerDownCapture:oe(e.onPointerDownCapture,p=>{const m=p.target.getBoundingClientRect(),x=p.clientX-m.left,g=p.clientY-m.top;i.onThumbPointerDown({x,y:g})}),onPointerUp:oe(e.onPointerUp,i.onThumbPointerUp)})});Fl.displayName=Qr;var vn="ScrollAreaCorner",Vl=h.forwardRef((e,t)=>{const r=et(vn,e.__scopeScrollArea),a=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&a?o.jsx(Lx,{...e,ref:t}):null});Vl.displayName=vn;var Lx=h.forwardRef((e,t)=>{const{__scopeScrollArea:r,...a}=e,n=et(vn,r),[s,i]=h.useState(0),[l,c]=h.useState(0),d=!!(s&&l);return nr(n.scrollbarX,()=>{var u;const p=((u=n.scrollbarX)==null?void 0:u.offsetHeight)||0;n.onCornerHeightChange(p),c(p)}),nr(n.scrollbarY,()=>{var u;const p=((u=n.scrollbarY)==null?void 0:u.offsetWidth)||0;n.onCornerWidthChange(p),i(p)}),d?o.jsx(le.div,{...a,ref:t,style:{width:s,height:l,position:"absolute",right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function ea(e){return e?parseInt(e,10):0}function Bl(e,t){const r=e/t;return isNaN(r)?0:r}function ja(e){const t=Bl(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,a=(e.scrollbar.size-r)*t;return Math.max(a,18)}function zx(e,t,r,a="ltr"){const n=ja(r),s=n/2,i=t||s,l=n-i,c=r.scrollbar.paddingStart+i,d=r.scrollbar.size-r.scrollbar.paddingEnd-l,u=r.content-r.viewport,p=a==="ltr"?[0,u]:[u*-1,0];return Ul([c,d],p)(e)}function Is(e,t,r="ltr"){const a=ja(t),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-n,i=t.content-t.viewport,l=s-a,c=r==="ltr"?[0,i]:[i*-1,0],d=wr(e,c);return Ul([0,i],[0,l])(d)}function Ul(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(r-e[0])}}function Hl(e,t){return e>0&&e<t}var Mx=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},a=0;return function n(){const s={left:e.scrollLeft,top:e.scrollTop},i=r.left!==s.left,l=r.top!==s.top;(i||l)&&t(),r=s,a=window.requestAnimationFrame(n)}(),()=>window.cancelAnimationFrame(a)};function Na(e,t){const r=Le(e),a=h.useRef(0);return h.useEffect(()=>()=>window.clearTimeout(a.current),[]),h.useCallback(()=>{window.clearTimeout(a.current),a.current=window.setTimeout(r,t)},[r,t])}function nr(e,t){const r=Le(t);Ee(()=>{let a=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(a),a=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(a),n.unobserve(e)}}},[e,r])}var Wl=Dl,Fx=Il,Vx=Vl;const Ca=h.forwardRef(({className:e,children:t,...r},a)=>o.jsxs(Wl,{ref:a,className:G("relative overflow-hidden",e),...r,children:[o.jsx(Fx,{className:"h-full w-full rounded-[inherit]",children:t}),o.jsx(ql,{}),o.jsx(Vx,{})]}));Ca.displayName=Wl.displayName;const ql=h.forwardRef(({className:e,orientation:t="vertical",...r},a)=>o.jsx(xn,{ref:a,orientation:t,className:G("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:o.jsx(Fl,{className:"relative flex-1 rounded-full bg-border"})}));ql.displayName=xn.displayName;var Bx=h[" useId ".trim().toString()]||(()=>{}),Ux=0;function _t(e){const[t,r]=h.useState(Bx());return Ee(()=>{r(a=>a??String(Ux++))},[e]),t?`radix-${t}`:""}function Hx(e,t=globalThis==null?void 0:globalThis.document){const r=Le(e);h.useEffect(()=>{const a=n=>{n.key==="Escape"&&r(n)};return t.addEventListener("keydown",a,{capture:!0}),()=>t.removeEventListener("keydown",a,{capture:!0})},[r,t])}var Wx="DismissableLayer",No="dismissableLayer.update",qx="dismissableLayer.pointerDownOutside",Zx="dismissableLayer.focusOutside",Ls,Zl=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),kr=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:a,onPointerDownOutside:n,onFocusOutside:s,onInteractOutside:i,onDismiss:l,...c}=e,d=h.useContext(Zl),[u,p]=h.useState(null),m=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,x]=h.useState({}),g=pe(t,_=>p(_)),f=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=f.indexOf(v),j=u?f.indexOf(u):-1,y=d.layersWithOutsidePointerEventsDisabled.size>0,N=j>=b,C=Yx(_=>{const w=_.target,R=[...d.branches].some(A=>A.contains(w));!N||R||(n==null||n(_),i==null||i(_),_.defaultPrevented||l==null||l())},m),k=Kx(_=>{const w=_.target;[...d.branches].some(R=>R.contains(w))||(s==null||s(_),i==null||i(_),_.defaultPrevented||l==null||l())},m);return Hx(_=>{j===d.layers.size-1&&(a==null||a(_),!_.defaultPrevented&&l&&(_.preventDefault(),l()))},m),h.useEffect(()=>{if(u)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Ls=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),zs(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Ls)}},[u,m,r,d]),h.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),zs())},[u,d]),h.useEffect(()=>{const _=()=>x({});return document.addEventListener(No,_),()=>document.removeEventListener(No,_)},[]),o.jsx(le.div,{...c,ref:g,style:{pointerEvents:y?N?"auto":"none":void 0,...e.style},onFocusCapture:oe(e.onFocusCapture,k.onFocusCapture),onBlurCapture:oe(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:oe(e.onPointerDownCapture,C.onPointerDownCapture)})});kr.displayName=Wx;var Xx="DismissableLayerBranch",Gx=h.forwardRef((e,t)=>{const r=h.useContext(Zl),a=h.useRef(null),n=pe(t,a);return h.useEffect(()=>{const s=a.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),o.jsx(le.div,{...e,ref:n})});Gx.displayName=Xx;function Yx(e,t=globalThis==null?void 0:globalThis.document){const r=Le(e),a=h.useRef(!1),n=h.useRef(()=>{});return h.useEffect(()=>{const s=l=>{if(l.target&&!a.current){let c=function(){Xl(qx,r,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(t.removeEventListener("click",n.current),n.current=c,t.addEventListener("click",n.current,{once:!0})):c()}else t.removeEventListener("click",n.current);a.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",n.current)}},[t,r]),{onPointerDownCapture:()=>a.current=!0}}function Kx(e,t=globalThis==null?void 0:globalThis.document){const r=Le(e),a=h.useRef(!1);return h.useEffect(()=>{const n=s=>{s.target&&!a.current&&Xl(Zx,r,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",n),()=>t.removeEventListener("focusin",n)},[t,r]),{onFocusCapture:()=>a.current=!0,onBlurCapture:()=>a.current=!1}}function zs(){const e=new CustomEvent(No);document.dispatchEvent(e)}function Xl(e,t,r,{discrete:a}){const n=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&n.addEventListener(e,t,{once:!0}),a?jx(n,s):n.dispatchEvent(s)}var oo="focusScope.autoFocusOnMount",no="focusScope.autoFocusOnUnmount",Ms={bubbles:!1,cancelable:!0},Jx="FocusScope",Sa=h.forwardRef((e,t)=>{const{loop:r=!1,trapped:a=!1,onMountAutoFocus:n,onUnmountAutoFocus:s,...i}=e,[l,c]=h.useState(null),d=Le(n),u=Le(s),p=h.useRef(null),m=pe(t,f=>c(f)),x=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(a){let f=function(y){if(x.paused||!l)return;const N=y.target;l.contains(N)?p.current=N:Nt(p.current,{select:!0})},v=function(y){if(x.paused||!l)return;const N=y.relatedTarget;N!==null&&(l.contains(N)||Nt(p.current,{select:!0}))},b=function(y){if(document.activeElement===document.body)for(const N of y)N.removedNodes.length>0&&Nt(l)};document.addEventListener("focusin",f),document.addEventListener("focusout",v);const j=new MutationObserver(b);return l&&j.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",v),j.disconnect()}}},[a,l,x.paused]),h.useEffect(()=>{if(l){Vs.add(x);const f=document.activeElement;if(!l.contains(f)){const v=new CustomEvent(oo,Ms);l.addEventListener(oo,d),l.dispatchEvent(v),v.defaultPrevented||(Qx(og(Gl(l)),{select:!0}),document.activeElement===f&&Nt(l))}return()=>{l.removeEventListener(oo,d),setTimeout(()=>{const v=new CustomEvent(no,Ms);l.addEventListener(no,u),l.dispatchEvent(v),v.defaultPrevented||Nt(f??document.body,{select:!0}),l.removeEventListener(no,u),Vs.remove(x)},0)}}},[l,d,u,x]);const g=h.useCallback(f=>{if(!r&&!a||x.paused)return;const v=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,b=document.activeElement;if(v&&b){const j=f.currentTarget,[y,N]=eg(j);y&&N?!f.shiftKey&&b===N?(f.preventDefault(),r&&Nt(y,{select:!0})):f.shiftKey&&b===y&&(f.preventDefault(),r&&Nt(N,{select:!0})):b===j&&f.preventDefault()}},[r,a,x.paused]);return o.jsx(le.div,{tabIndex:-1,...i,ref:m,onKeyDown:g})});Sa.displayName=Jx;function Qx(e,{select:t=!1}={}){const r=document.activeElement;for(const a of e)if(Nt(a,{select:t}),document.activeElement!==r)return}function eg(e){const t=Gl(e),r=Fs(t,e),a=Fs(t.reverse(),e);return[r,a]}function Gl(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:a=>{const n=a.tagName==="INPUT"&&a.type==="hidden";return a.disabled||a.hidden||n?NodeFilter.FILTER_SKIP:a.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Fs(e,t){for(const r of e)if(!tg(r,{upTo:t}))return r}function tg(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function rg(e){return e instanceof HTMLInputElement&&"select"in e}function Nt(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&rg(e)&&t&&e.select()}}var Vs=ag();function ag(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=Bs(e,t),e.unshift(t)},remove(t){var r;e=Bs(e,t),(r=e[0])==null||r.resume()}}}function Bs(e,t){const r=[...e],a=r.indexOf(t);return a!==-1&&r.splice(a,1),r}function og(e){return e.filter(t=>t.tagName!=="A")}var ng="Portal",ka=h.forwardRef((e,t)=>{var r;const{container:a,...n}=e,[s,i]=h.useState(!1);Ee(()=>i(!0),[]);const l=a||s&&((r=globalThis==null?void 0:globalThis.document)==null?void 0:r.body);return l?Bo.createPortal(o.jsx(le.div,{...n,ref:t}),l):null});ka.displayName=ng;var so=0;function bn(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Us()),document.body.insertAdjacentElement("beforeend",e[1]??Us()),so++,()=>{so===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),so--}},[])}function Us(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var st=function(){return st=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},st.apply(this,arguments)};function Yl(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]]);return r}function sg(e,t,r){for(var a=0,n=t.length,s;a<n;a++)(s||!(a in t))&&(s||(s=Array.prototype.slice.call(t,0,a)),s[a]=t[a]);return e.concat(s||Array.prototype.slice.call(t))}var Zr="right-scroll-bar-position",Xr="width-before-scroll-bar",ig="with-scroll-bars-hidden",lg="--removed-body-scroll-bar-size";function io(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function cg(e,t){var r=E.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(a){var n=r.value;n!==a&&(r.value=a,r.callback(a,n))}}}})[0];return r.callback=t,r.facade}var dg=typeof window<"u"?h.useLayoutEffect:h.useEffect,Hs=new WeakMap;function ug(e,t){var r=cg(null,function(a){return e.forEach(function(n){return io(n,a)})});return dg(function(){var a=Hs.get(r);if(a){var n=new Set(a),s=new Set(e),i=r.current;n.forEach(function(l){s.has(l)||io(l,null)}),s.forEach(function(l){n.has(l)||io(l,i)})}Hs.set(r,e)},[e]),r}function pg(e){return e}function mg(e,t){t===void 0&&(t=pg);var r=[],a=!1,n={read:function(){if(a)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(s){var i=t(s,a);return r.push(i),function(){r=r.filter(function(l){return l!==i})}},assignSyncMedium:function(s){for(a=!0;r.length;){var i=r;r=[],i.forEach(s)}r={push:function(l){return s(l)},filter:function(){return r}}},assignMedium:function(s){a=!0;var i=[];if(r.length){var l=r;r=[],l.forEach(s),i=r}var c=function(){var u=i;i=[],u.forEach(s)},d=function(){return Promise.resolve().then(c)};d(),r={push:function(u){i.push(u),d()},filter:function(u){return i=i.filter(u),r}}}};return n}function fg(e){e===void 0&&(e={});var t=mg(null);return t.options=st({async:!0,ssr:!1},e),t}var Kl=function(e){var t=e.sideCar,r=Yl(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var a=t.read();if(!a)throw new Error("Sidecar medium not found");return h.createElement(a,st({},r))};Kl.isSideCarExport=!0;function hg(e,t){return e.useMedium(t),Kl}var Jl=fg(),lo=function(){},_a=h.forwardRef(function(e,t){var r=h.useRef(null),a=h.useState({onScrollCapture:lo,onWheelCapture:lo,onTouchMoveCapture:lo}),n=a[0],s=a[1],i=e.forwardProps,l=e.children,c=e.className,d=e.removeScrollBar,u=e.enabled,p=e.shards,m=e.sideCar,x=e.noRelative,g=e.noIsolation,f=e.inert,v=e.allowPinchZoom,b=e.as,j=b===void 0?"div":b,y=e.gapMode,N=Yl(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),C=m,k=ug([r,t]),_=st(st({},N),n);return h.createElement(h.Fragment,null,u&&h.createElement(C,{sideCar:Jl,removeScrollBar:d,shards:p,noRelative:x,noIsolation:g,inert:f,setCallbacks:s,allowPinchZoom:!!v,lockRef:r,gapMode:y}),i?h.cloneElement(h.Children.only(l),st(st({},_),{ref:k})):h.createElement(j,st({},_,{className:c,ref:k}),l))});_a.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};_a.classNames={fullWidth:Xr,zeroRight:Zr};var xg=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function gg(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=xg();return t&&e.setAttribute("nonce",t),e}function vg(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function bg(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var yg=function(){var e=0,t=null;return{add:function(r){e==0&&(t=gg())&&(vg(t,r),bg(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},wg=function(){var e=yg();return function(t,r){h.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Ql=function(){var e=wg(),t=function(r){var a=r.styles,n=r.dynamic;return e(a,n),null};return t},jg={left:0,top:0,right:0,gap:0},co=function(e){return parseInt(e||"",10)||0},Ng=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],a=t[e==="padding"?"paddingTop":"marginTop"],n=t[e==="padding"?"paddingRight":"marginRight"];return[co(r),co(a),co(n)]},Cg=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return jg;var t=Ng(e),r=document.documentElement.clientWidth,a=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,a-r+t[2]-t[0])}},Sg=Ql(),tr="data-scroll-locked",kg=function(e,t,r,a){var n=e.left,s=e.top,i=e.right,l=e.gap;return r===void 0&&(r="margin"),`
33
- .`.concat(ig,` {
34
- overflow: hidden `).concat(a,`;
35
- padding-right: `).concat(l,"px ").concat(a,`;
30
+ <%s key={someKey} {...props} />`,mn,br,Rf,br),Il[br+mn]=!0}}return R===o?$f(He):Sf(He),He}}function Ef(R,re,ce){return Fl(R,re,ce,!0)}function Af(R,re,ce){return Fl(R,re,ce,!1)}var _f=Af,Tf=Ef;Ra.Fragment=o,Ra.jsx=_f,Ra.jsxs=Tf}()),Ra}process.env.NODE_ENV==="production"?Bn.exports=Qf():Bn.exports=eh();var pn=Bn.exports;const Un=k.createContext(yo("moderno")),pa=({config:e,children:t,renderWrapper:r=!0,className:o,style:n})=>{const s={"--t-primary":e.colors.primary,"--t-primary-hover":e.colors.primaryHover,"--t-accent":e.colors.accent,"--t-bg":e.colors.background,"--t-surface":e.colors.surface,"--t-text":e.colors.text,"--t-text-muted":e.colors.textMuted,"--t-border":e.colors.border,"--t-error":e.colors.error,...n};return r?pn.jsx(Un.Provider,{value:e,children:pn.jsx("div",{className:o,style:s,"data-template":"1",children:t})}):pn.jsx(Un.Provider,{value:e,children:t})},ba=()=>k.useContext(Un),wo=[{id:"preset_personal",name:"Dados Pessoais",description:"Nome, e-mail, CPF, telefone e data de nascimento",icon:"User",category:"personal",containerTemplate:{titulo:"Dados Pessoais",icone:"User",ordem:0,campos:[{id:"_personal_nome",nome:"nome",tipo:_.TEXTO,label:"Nome completo",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Seu nome completo"},{id:"_personal_email",nome:"email",tipo:_.EMAIL,label:"E-mail",ordem:1,tamanho:6,obrigatorio:!0,placeholder:"seuemail@exemplo.com"},{id:"_personal_telefone",nome:"telefone",tipo:_.TELEFONE,label:"Telefone / WhatsApp",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"},{id:"_personal_cpf",nome:"cpf",tipo:_.CPF,label:"CPF",ordem:3,tamanho:6,obrigatorio:!1,placeholder:"000.000.000-00"},{id:"_personal_nascimento",nome:"data_nascimento",tipo:_.DATE,label:"Data de nascimento",ordem:4,tamanho:6,obrigatorio:!1}]}},{id:"preset_emergency_array",name:"Contatos de Emergência",description:"Lista de contatos (mín. 2, máx. 7) com Nome, Parentesco e Telefone",icon:"PhoneCall",category:"emergency",containerTemplate:{titulo:"Contatos de Emergência",icone:"PhoneCall",ordem:0,campos:[{id:"_emerg_array_contatos",nome:"contatos_emergencia",tipo:_.FIELD_ARRAY,label:"Contatos de Emergência",ordem:0,tamanho:12,obrigatorio:!0,itemLabel:"Contato",minItems:2,maxItems:7,addLabel:"Adicionar Contato",subFields:[{id:"_emerg_array_nome",nome:"nome",tipo:_.TEXTO,label:"Nome",ordem:0,tamanho:4,obrigatorio:!0,placeholder:"Nome completo do contato"},{id:"_emerg_array_parentesco",nome:"parentesco",tipo:_.SELECT,label:"Parentesco",ordem:1,tamanho:4,obrigatorio:!0,opcoes:[{valor:"pai",label:"Pai"},{valor:"mae",label:"Mãe"},{valor:"conjuge",label:"Cônjuge"},{valor:"irmao",label:"Irmão/Irmã"},{valor:"avo",label:"Avô/Avó"},{valor:"tio",label:"Tio/Tia"},{valor:"amigo",label:"Amigo(a)"},{valor:"outro",label:"Outro"}]},{id:"_emerg_array_telefone",nome:"telefone",tipo:_.TELEFONE,label:"Celular",ordem:2,tamanho:4,obrigatorio:!0,placeholder:"(34) 99999-9999"}]}]}},{id:"preset_emergency",name:"Contatos de Emergência (Repetível)",description:"Lista repetível de contatos de emergência (mínimo 2)",icon:"PhoneCall",category:"emergency",containerTemplate:{titulo:"Contatos de Emergência",icone:"PhoneCall",ordem:0,nome:"contatos_emergencia",repeatable:!0,minItems:2,maxItems:5,itemLabel:"Contato",campos:[{id:"_emerg_nome",nome:"nome",tipo:_.TEXTO,label:"Nome",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Nome completo do contato"},{id:"_emerg_parentesco",nome:"parentesco",tipo:_.SELECT,label:"Parentesco",ordem:1,tamanho:6,obrigatorio:!0,opcoes:[{valor:"pai",label:"Pai"},{valor:"mae",label:"Mãe"},{valor:"conjuge",label:"Cônjuge"},{valor:"irmao",label:"Irmão/Irmã"},{valor:"avo",label:"Avô/Avó"},{valor:"amigo",label:"Amigo(a)"},{valor:"outro",label:"Outro"}]},{id:"_emerg_telefone",nome:"telefone",tipo:_.TELEFONE,label:"Telefone",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"}]}},{id:"preset_address",name:"Endereço",description:"CEP com preenchimento automático via ViaCEP + campos de endereço",icon:"MapPin",category:"address",containerTemplate:{titulo:"Endereço",icone:"MapPin",ordem:0,campos:[{id:"_address_cep",nome:"_address_cep",tipo:_.CEP,label:"CEP",ordem:0,tamanho:4,obrigatorio:!1,placeholder:"00000-000",hint:"Preencha o CEP para auto-completar o endereço",locked:!0,cepFillMap:{logradouro:"_address_logradouro",bairro:"_address_bairro",cidade:"_address_cidade",estado:"_address_estado"}},{id:"_address_logradouro",nome:"_address_logradouro",tipo:_.TEXTO,label:"Logradouro",ordem:1,tamanho:8,obrigatorio:!1,placeholder:"Rua, Av., Travessa...",locked:!0},{id:"_address_numero",nome:"_address_numero",tipo:_.TEXTO,label:"Número",ordem:2,tamanho:3,obrigatorio:!1,placeholder:"Nº"},{id:"_address_complemento",nome:"_address_complemento",tipo:_.TEXTO,label:"Complemento",ordem:3,tamanho:9,obrigatorio:!1,placeholder:"Apto, bloco, casa..."},{id:"_address_bairro",nome:"_address_bairro",tipo:_.TEXTO,label:"Bairro",ordem:4,tamanho:5,obrigatorio:!1,locked:!0},{id:"_address_cidade",nome:"_address_cidade",tipo:_.TEXTO,label:"Cidade",ordem:5,tamanho:5,obrigatorio:!1,locked:!0},{id:"_address_estado",nome:"_address_estado",tipo:_.TEXTO,label:"Estado (UF)",ordem:6,tamanho:2,obrigatorio:!1,placeholder:"SP",locked:!0}]}},{id:"preset_responsible",name:"Responsável",description:"Dados do responsável legal (para menores ou dependentes)",icon:"Users",category:"personal",containerTemplate:{titulo:"Responsável",icone:"Users",ordem:0,campos:[{id:"_resp_nome",nome:"responsavel_nome",tipo:_.TEXTO,label:"Nome do responsável",ordem:0,tamanho:12,obrigatorio:!0,placeholder:"Nome completo do responsável"},{id:"_resp_parentesco",nome:"responsavel_parentesco",tipo:_.SELECT,label:"Parentesco",ordem:1,tamanho:6,obrigatorio:!0,opcoes:[{valor:"pai",label:"Pai"},{valor:"mae",label:"Mãe"},{valor:"avo",label:"Avô/Avó"},{valor:"outro",label:"Outro"}]},{id:"_resp_telefone",nome:"responsavel_telefone",tipo:_.TELEFONE,label:"Telefone do responsável",ordem:2,tamanho:6,obrigatorio:!0,placeholder:"(11) 99999-9999"},{id:"_resp_cpf",nome:"responsavel_cpf",tipo:_.CPF,label:"CPF do responsável",ordem:3,tamanho:6,obrigatorio:!1,placeholder:"000.000.000-00"}]}},{id:"preset_health",name:"Informações de Saúde",description:"Alergias, medicamentos, tipo sanguíneo e plano de saúde",icon:"HeartPulse",category:"health",containerTemplate:{titulo:"Informações de Saúde",icone:"HeartPulse",ordem:0,campos:[{id:"_health_tipo_sanguineo",nome:"tipo_sanguineo",tipo:_.SELECT,label:"Tipo sanguíneo",ordem:0,tamanho:4,obrigatorio:!1,opcoes:[{valor:"A+",label:"A+"},{valor:"A-",label:"A-"},{valor:"B+",label:"B+"},{valor:"B-",label:"B-"},{valor:"AB+",label:"AB+"},{valor:"AB-",label:"AB-"},{valor:"O+",label:"O+"},{valor:"O-",label:"O-"},{valor:"nao_sei",label:"Não sei"}]},{id:"_health_plano",nome:"plano_saude",tipo:_.TEXTO,label:"Plano de saúde",ordem:1,tamanho:8,obrigatorio:!1,placeholder:'Ex: Unimed... ou "Nenhum"'},{id:"_health_alergias",nome:"alergias",tipo:_.TEXTAREA,label:"Alergias",ordem:2,tamanho:12,obrigatorio:!1,placeholder:"Descreva alergias conhecidas"},{id:"_health_medicamentos",nome:"medicamentos",tipo:_.TEXTAREA,label:"Medicamentos em uso contínuo",ordem:3,tamanho:12,obrigatorio:!1,placeholder:"Nome, dosagem e frequência"},{id:"_health_obs",nome:"observacoes_medicas",tipo:_.TEXTAREA,label:"Outras observações médicas",ordem:4,tamanho:12,obrigatorio:!1}]}},{id:"preset_participation",name:"Participação",description:"Restrições alimentares, tamanho de camiseta e observações gerais",icon:"ClipboardList",category:"event",containerTemplate:{titulo:"Participação",icone:"ClipboardList",ordem:0,campos:[{id:"_part_restricao_alimentar",nome:"restricao_alimentar",tipo:_.SELECT,label:"Restrição alimentar",ordem:0,tamanho:6,obrigatorio:!1,opcoes:[{valor:"nenhuma",label:"Nenhuma"},{valor:"vegetariano",label:"Vegetariano"},{valor:"vegano",label:"Vegano"},{valor:"sem_gluten",label:"Sem glúten"},{valor:"sem_lactose",label:"Sem lactose"},{valor:"outro",label:"Outro"}]},{id:"_part_camiseta",nome:"tamanho_camiseta",tipo:_.SELECT,label:"Tamanho da camiseta",ordem:1,tamanho:6,obrigatorio:!1,opcoes:[{valor:"PP",label:"PP"},{valor:"P",label:"P"},{valor:"M",label:"M"},{valor:"G",label:"G"},{valor:"GG",label:"GG"},{valor:"XGG",label:"XGG"}]},{id:"_part_obs",nome:"observacoes_participacao",tipo:_.TEXTAREA,label:"Observações",ordem:2,tamanho:12,obrigatorio:!1}]}},{id:"preset_payment",name:"Informações de Pagamento",description:"Forma de pagamento e comprovante",icon:"CreditCard",category:"payment",containerTemplate:{titulo:"Pagamento",icone:"CreditCard",ordem:0,campos:[{id:"_pay_forma",nome:"forma_pagamento",tipo:_.SELECT,label:"Forma de pagamento",ordem:0,tamanho:6,obrigatorio:!0,opcoes:[{valor:"pix",label:"PIX"},{valor:"cartao",label:"Cartão de crédito/débito"},{valor:"boleto",label:"Boleto bancário"},{valor:"dinheiro",label:"Dinheiro (presencial)"}]},{id:"_pay_comprovante",nome:"comprovante_pagamento",tipo:_.FILE,label:"Comprovante de pagamento",ordem:1,tamanho:6,obrigatorio:!1,hint:"Envie o comprovante caso já tenha efetuado o pagamento"}]}},{id:"preset_participation_type",name:"Tipo de Participação",description:"Seleção de todos os dias ou dia específico. Datas, preços e vagas carregados via externalData.",icon:"CalendarDays",category:"event",containerTemplate:{titulo:"Tipo de Participação",icone:"CalendarDays",descricao:"Escolha como você deseja participar do evento",ordem:0,campos:[{id:"_participation_type_field",nome:"tipo_participacao",tipo:_.PARTICIPATION_TYPE,label:"Tipo de Participação",hint:"Escolha como você deseja participar",ordem:0,tamanho:12,obrigatorio:!0,locked:!0}]}}],th=e=>wo.filter(t=>t.category===e),ws=e=>wo.find(t=>t.id===e),js=[{id:"preset_steps_participation_payment",name:"Participação + Pagamento",description:"Dois steps: seleção do tipo de participação e escolha da forma de pagamento com cálculo automático de taxas.",icon:"Wallet",steps:[{titulo:"Tipo de Participação",descricao:"Escolha como deseja participar do evento",icone:"CalendarDays",containers:[{titulo:"Tipo de Participação",icone:"CalendarDays",descricao:"Escolha como você deseja participar do evento",ordem:0,campos:[{id:"_participation_type_field",nome:"tipo_participacao",tipo:_.PARTICIPATION_TYPE,label:"Tipo de Participação",hint:"Escolha como você deseja participar",ordem:0,tamanho:12,obrigatorio:!0,locked:!0}]}]},{titulo:"Forma de Pagamento",descricao:"Escolha como deseja pagar sua inscrição",icone:"Wallet",containers:[{titulo:"Forma de Pagamento",icone:"Wallet",descricao:"Escolha como deseja pagar sua inscrição",ordem:0,campos:[{id:"_payment_method_field",nome:"forma_pagamento",tipo:_.PAYMENT_METHOD,label:"Forma de Pagamento",ordem:0,tamanho:12,obrigatorio:!0,locked:!0,relatedFieldName:"tipo_participacao"}]}]}]}],rh=e=>js.find(t=>t.id===e);function uc(e){var t,r,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=uc(e[t]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function mc(){for(var e,t,r=0,o="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=uc(e))&&(o&&(o+=" "),o+=t);return o}const ah=(e,t)=>{const r=new Array(e.length+t.length);for(let o=0;o<e.length;o++)r[o]=e[o];for(let o=0;o<t.length;o++)r[e.length+o]=t[o];return r},oh=(e,t)=>({classGroupId:e,validator:t}),pc=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Ja="-",Vl=[],nh="arbitrary..",sh=e=>{const t=ih(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:n=>{if(n.startsWith("[")&&n.endsWith("]"))return lh(n);const s=n.split(Ja),l=s[0]===""&&s.length>1?1:0;return fc(s,l,t)},getConflictingClassGroupIds:(n,s)=>{if(s){const l=o[n],i=r[n];return l?i?ah(i,l):l:i||Vl}return r[n]||Vl}}},fc=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const o=e[t],n=r.nextPart.get(o);if(n){const c=fc(e,t+1,n);if(c)return c}const s=r.validators;if(s===null)return;const l=t===0?e.join(Ja):e.slice(t).join(Ja),i=s.length;for(let c=0;c<i;c++){const d=s[c];if(d.validator(l))return d.classGroupId}},lh=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),o=t.slice(0,r);return o?nh+o:void 0})(),ih=e=>{const{theme:t,classGroups:r}=e;return ch(r,t)},ch=(e,t)=>{const r=pc();for(const o in e){const n=e[o];Ns(n,r,o,t)}return r},Ns=(e,t,r,o)=>{const n=e.length;for(let s=0;s<n;s++){const l=e[s];dh(l,t,r,o)}},dh=(e,t,r,o)=>{if(typeof e=="string"){uh(e,t,r);return}if(typeof e=="function"){mh(e,t,r,o);return}ph(e,t,r,o)},uh=(e,t,r)=>{const o=e===""?t:hc(t,e);o.classGroupId=r},mh=(e,t,r,o)=>{if(fh(e)){Ns(e(o),t,r,o);return}t.validators===null&&(t.validators=[]),t.validators.push(oh(r,e))},ph=(e,t,r,o)=>{const n=Object.entries(e),s=n.length;for(let l=0;l<s;l++){const[i,c]=n[l];Ns(c,hc(t,i),r,o)}},hc=(e,t)=>{let r=e;const o=t.split(Ja),n=o.length;for(let s=0;s<n;s++){const l=o[s];let i=r.nextPart.get(l);i||(i=pc(),r.nextPart.set(l,i)),r=i}return r},fh=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,hh=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),o=Object.create(null);const n=(s,l)=>{r[s]=l,t++,t>e&&(t=0,o=r,r=Object.create(null))};return{get(s){let l=r[s];if(l!==void 0)return l;if((l=o[s])!==void 0)return n(s,l),l},set(s,l){s in r?r[s]=l:n(s,l)}}},Hn="!",zl=":",xh=[],Bl=(e,t,r,o,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:o,isExternal:n}),gh=e=>{const{prefix:t,experimentalParseClassName:r}=e;let o=n=>{const s=[];let l=0,i=0,c=0,d;const m=n.length;for(let f=0;f<m;f++){const g=n[f];if(l===0&&i===0){if(g===zl){s.push(n.slice(c,f)),c=f+1;continue}if(g==="/"){d=f;continue}}g==="["?l++:g==="]"?l--:g==="("?i++:g===")"&&i--}const u=s.length===0?n:n.slice(c);let h=u,p=!1;u.endsWith(Hn)?(h=u.slice(0,-1),p=!0):u.startsWith(Hn)&&(h=u.slice(1),p=!0);const y=d&&d>c?d-c:void 0;return Bl(s,p,h,y)};if(t){const n=t+zl,s=o;o=l=>l.startsWith(n)?s(l.slice(n.length)):Bl(xh,!1,l,void 0,!0)}if(r){const n=o;o=s=>r({className:s,parseClassName:n})}return o},vh=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,o)=>{t.set(r,1e6+o)}),r=>{const o=[];let n=[];for(let s=0;s<r.length;s++){const l=r[s],i=l[0]==="[",c=t.has(l);i||c?(n.length>0&&(n.sort(),o.push(...n),n=[]),o.push(l)):n.push(l)}return n.length>0&&(n.sort(),o.push(...n)),o}},bh=e=>({cache:hh(e.cacheSize),parseClassName:gh(e),sortModifiers:vh(e),...sh(e)}),yh=/\s+/,wh=(e,t)=>{const{parseClassName:r,getClassGroupId:o,getConflictingClassGroupIds:n,sortModifiers:s}=t,l=[],i=e.trim().split(yh);let c="";for(let d=i.length-1;d>=0;d-=1){const m=i[d],{isExternal:u,modifiers:h,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:f}=r(m);if(u){c=m+(c.length>0?" "+c:c);continue}let g=!!f,w=o(g?y.substring(0,f):y);if(!w){if(!g){c=m+(c.length>0?" "+c:c);continue}if(w=o(y),!w){c=m+(c.length>0?" "+c:c);continue}g=!1}const v=h.length===0?"":h.length===1?h[0]:s(h).join(":"),b=p?v+Hn:v,j=b+w;if(l.indexOf(j)>-1)continue;l.push(j);const N=n(w,g);for(let S=0;S<N.length;++S){const $=N[S];l.push(b+$)}c=m+(c.length>0?" "+c:c)}return c},jh=(...e)=>{let t=0,r,o,n="";for(;t<e.length;)(r=e[t++])&&(o=xc(r))&&(n&&(n+=" "),n+=o);return n},xc=e=>{if(typeof e=="string")return e;let t,r="";for(let o=0;o<e.length;o++)e[o]&&(t=xc(e[o]))&&(r&&(r+=" "),r+=t);return r},Nh=(e,...t)=>{let r,o,n,s;const l=c=>{const d=t.reduce((m,u)=>u(m),e());return r=bh(d),o=r.cache.get,n=r.cache.set,s=i,i(c)},i=c=>{const d=o(c);if(d)return d;const m=wh(c,r);return n(c,m),m};return s=l,(...c)=>s(jh(...c))},Ch=[],Xe=e=>{const t=r=>r[e]||Ch;return t.isThemeGetter=!0,t},gc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,vc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,kh=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Sh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$h=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Eh=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ah=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,_h=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,rr=e=>kh.test(e),Ce=e=>!!e&&!Number.isNaN(Number(e)),ar=e=>!!e&&Number.isInteger(Number(e)),fn=e=>e.endsWith("%")&&Ce(e.slice(0,-1)),Xt=e=>Sh.test(e),bc=()=>!0,Th=e=>$h.test(e)&&!Eh.test(e),Cs=()=>!1,Rh=e=>Ah.test(e),Dh=e=>_h.test(e),Ph=e=>!me(e)&&!fe(e),Oh=e=>pr(e,jc,Cs),me=e=>gc.test(e),yr=e=>pr(e,Nc,Th),Ul=e=>pr(e,Uh,Ce),Ih=e=>pr(e,kc,bc),Fh=e=>pr(e,Cc,Cs),Hl=e=>pr(e,yc,Cs),Lh=e=>pr(e,wc,Dh),Da=e=>pr(e,Sc,Rh),fe=e=>vc.test(e),ca=e=>_r(e,Nc),Mh=e=>_r(e,Cc),Wl=e=>_r(e,yc),Vh=e=>_r(e,jc),zh=e=>_r(e,wc),Pa=e=>_r(e,Sc,!0),Bh=e=>_r(e,kc,!0),pr=(e,t,r)=>{const o=gc.exec(e);return o?o[1]?t(o[1]):r(o[2]):!1},_r=(e,t,r=!1)=>{const o=vc.exec(e);return o?o[1]?t(o[1]):r:!1},yc=e=>e==="position"||e==="percentage",wc=e=>e==="image"||e==="url",jc=e=>e==="length"||e==="size"||e==="bg-size",Nc=e=>e==="length",Uh=e=>e==="number",Cc=e=>e==="family-name",kc=e=>e==="number"||e==="weight",Sc=e=>e==="shadow",Hh=()=>{const e=Xe("color"),t=Xe("font"),r=Xe("text"),o=Xe("font-weight"),n=Xe("tracking"),s=Xe("leading"),l=Xe("breakpoint"),i=Xe("container"),c=Xe("spacing"),d=Xe("radius"),m=Xe("shadow"),u=Xe("inset-shadow"),h=Xe("text-shadow"),p=Xe("drop-shadow"),y=Xe("blur"),f=Xe("perspective"),g=Xe("aspect"),w=Xe("ease"),v=Xe("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...j(),fe,me],S=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],C=()=>[fe,me,c],E=()=>[rr,"full","auto",...C()],A=()=>[ar,"none","subgrid",fe,me],I=()=>["auto",{span:["full",ar,fe,me]},ar,fe,me],M=()=>[ar,"auto",fe,me],T=()=>["auto","min","max","fr",fe,me],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],q=()=>["start","end","center","stretch","center-safe","end-safe"],W=()=>["auto",...C()],X=()=>[rr,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...C()],V=()=>[rr,"screen","full","dvw","lvw","svw","min","max","fit",...C()],L=()=>[rr,"screen","full","lh","dvh","lvh","svh","min","max","fit",...C()],P=()=>[e,fe,me],se=()=>[...j(),Wl,Hl,{position:[fe,me]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Q=()=>["auto","cover","contain",Vh,Oh,{size:[fe,me]}],ee=()=>[fn,ca,yr],H=()=>["","none","full",d,fe,me],K=()=>["",Ce,ca,yr],G=()=>["solid","dashed","dotted","double"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>[Ce,fn,Wl,Hl],te=()=>["","none",y,fe,me],ue=()=>["none",Ce,fe,me],ve=()=>["none",Ce,fe,me],Ne=()=>[Ce,fe,me],ye=()=>[rr,"full",...C()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xt],breakpoint:[Xt],color:[bc],container:[Xt],"drop-shadow":[Xt],ease:["in","out","in-out"],font:[Ph],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xt],shadow:[Xt],spacing:["px",Ce],text:[Xt],"text-shadow":[Xt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",rr,me,fe,g]}],container:["container"],columns:[{columns:[Ce,me,fe,i]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:N()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{"inset-s":E(),start:E()}],end:[{"inset-e":E(),end:E()}],"inset-bs":[{"inset-bs":E()}],"inset-be":[{"inset-be":E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:["visible","invisible","collapse"],z:[{z:[ar,"auto",fe,me]}],basis:[{basis:[rr,"full","auto",i,...C()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ce,rr,"auto","initial","none",me]}],grow:[{grow:["",Ce,fe,me]}],shrink:[{shrink:["",Ce,fe,me]}],order:[{order:[ar,"first","last","none",fe,me]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":T()}],"auto-rows":[{"auto-rows":T()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...B(),"normal"]}],"justify-items":[{"justify-items":[...q(),"normal"]}],"justify-self":[{"justify-self":["auto",...q()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...q(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...q(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...q(),"baseline"]}],"place-self":[{"place-self":["auto",...q()]}],p:[{p:C()}],px:[{px:C()}],py:[{py:C()}],ps:[{ps:C()}],pe:[{pe:C()}],pbs:[{pbs:C()}],pbe:[{pbe:C()}],pt:[{pt:C()}],pr:[{pr:C()}],pb:[{pb:C()}],pl:[{pl:C()}],m:[{m:W()}],mx:[{mx:W()}],my:[{my:W()}],ms:[{ms:W()}],me:[{me:W()}],mbs:[{mbs:W()}],mbe:[{mbe:W()}],mt:[{mt:W()}],mr:[{mr:W()}],mb:[{mb:W()}],ml:[{ml:W()}],"space-x":[{"space-x":C()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":C()}],"space-y-reverse":["space-y-reverse"],size:[{size:X()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...L()]}],"min-block-size":[{"min-block":["auto",...L()]}],"max-block-size":[{"max-block":["none",...L()]}],w:[{w:[i,"screen",...X()]}],"min-w":[{"min-w":[i,"screen","none",...X()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[l]},...X()]}],h:[{h:["screen","lh",...X()]}],"min-h":[{"min-h":["screen","lh","none",...X()]}],"max-h":[{"max-h":["screen","lh",...X()]}],"font-size":[{text:["base",r,ca,yr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,Bh,Ih]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fn,me]}],"font-family":[{font:[Mh,Fh,t]}],"font-features":[{"font-features":[me]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,fe,me]}],"line-clamp":[{"line-clamp":[Ce,"none",fe,Ul]}],leading:[{leading:[s,...C()]}],"list-image":[{"list-image":["none",fe,me]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",fe,me]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ce,"from-font","auto",fe,yr]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[Ce,"auto",fe,me]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",fe,me]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",fe,me]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:se()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:Q()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ar,fe,me],radial:["",fe,me],conic:[ar,fe,me]},zh,Lh]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-bs":[{"border-bs":K()}],"border-w-be":[{"border-be":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ce,fe,me]}],"outline-w":[{outline:["",Ce,ca,yr]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",m,Pa,Da]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",u,Pa,Da]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[Ce,yr]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",h,Pa,Da]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[Ce,fe,me]}],"mix-blend":[{"mix-blend":[...Y(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Y()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ce]}],"mask-image-linear-from-pos":[{"mask-linear-from":Z()}],"mask-image-linear-to-pos":[{"mask-linear-to":Z()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":Z()}],"mask-image-t-to-pos":[{"mask-t-to":Z()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":Z()}],"mask-image-r-to-pos":[{"mask-r-to":Z()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":Z()}],"mask-image-b-to-pos":[{"mask-b-to":Z()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":Z()}],"mask-image-l-to-pos":[{"mask-l-to":Z()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":Z()}],"mask-image-x-to-pos":[{"mask-x-to":Z()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":Z()}],"mask-image-y-to-pos":[{"mask-y-to":Z()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[fe,me]}],"mask-image-radial-from-pos":[{"mask-radial-from":Z()}],"mask-image-radial-to-pos":[{"mask-radial-to":Z()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":j()}],"mask-image-conic-pos":[{"mask-conic":[Ce]}],"mask-image-conic-from-pos":[{"mask-conic-from":Z()}],"mask-image-conic-to-pos":[{"mask-conic-to":Z()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:se()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:Q()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",fe,me]}],filter:[{filter:["","none",fe,me]}],blur:[{blur:te()}],brightness:[{brightness:[Ce,fe,me]}],contrast:[{contrast:[Ce,fe,me]}],"drop-shadow":[{"drop-shadow":["","none",p,Pa,Da]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",Ce,fe,me]}],"hue-rotate":[{"hue-rotate":[Ce,fe,me]}],invert:[{invert:["",Ce,fe,me]}],saturate:[{saturate:[Ce,fe,me]}],sepia:[{sepia:["",Ce,fe,me]}],"backdrop-filter":[{"backdrop-filter":["","none",fe,me]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[Ce,fe,me]}],"backdrop-contrast":[{"backdrop-contrast":[Ce,fe,me]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ce,fe,me]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ce,fe,me]}],"backdrop-invert":[{"backdrop-invert":["",Ce,fe,me]}],"backdrop-opacity":[{"backdrop-opacity":[Ce,fe,me]}],"backdrop-saturate":[{"backdrop-saturate":[Ce,fe,me]}],"backdrop-sepia":[{"backdrop-sepia":["",Ce,fe,me]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",fe,me]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ce,"initial",fe,me]}],ease:[{ease:["linear","initial",w,fe,me]}],delay:[{delay:[Ce,fe,me]}],animate:[{animate:["none",v,fe,me]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,fe,me]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:ue()}],"rotate-x":[{"rotate-x":ue()}],"rotate-y":[{"rotate-y":ue()}],"rotate-z":[{"rotate-z":ue()}],scale:[{scale:ve()}],"scale-x":[{"scale-x":ve()}],"scale-y":[{"scale-y":ve()}],"scale-z":[{"scale-z":ve()}],"scale-3d":["scale-3d"],skew:[{skew:Ne()}],"skew-x":[{"skew-x":Ne()}],"skew-y":[{"skew-y":Ne()}],transform:[{transform:[fe,me,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ye()}],"translate-x":[{"translate-x":ye()}],"translate-y":[{"translate-y":ye()}],"translate-z":[{"translate-z":ye()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",fe,me]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mbs":[{"scroll-mbs":C()}],"scroll-mbe":[{"scroll-mbe":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pbs":[{"scroll-pbs":C()}],"scroll-pbe":[{"scroll-pbe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",fe,me]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[Ce,ca,yr,Ul]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Wh=Nh(Hh);function J(...e){return Wh(mc(e))}function qh(e){if(!e)return null;if(e.includes("-")){const t=e.split("-").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("");return O.icons[t]??null}return O.icons[e]??null}function ql(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ks(...e){return t=>{let r=!1;const o=e.map(n=>{const s=ql(n,t);return!r&&typeof s=="function"&&(r=!0),s});if(r)return()=>{for(let n=0;n<o.length;n++){const s=o[n];typeof s=="function"?s():ql(e[n],null)}}}}function je(...e){return x.useCallback(ks(...e),e)}var Xh=Symbol.for("react.lazy"),Qa=x[" use ".trim().toString()];function Gh(e){return typeof e=="object"&&e!==null&&"then"in e}function $c(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Xh&&"_payload"in e&&Gh(e._payload)}function Ec(e){const t=Yh(e),r=x.forwardRef((o,n)=>{let{children:s,...l}=o;$c(s)&&typeof Qa=="function"&&(s=Qa(s._payload));const i=x.Children.toArray(s),c=i.find(Jh);if(c){const d=c.props.children,m=i.map(u=>u===c?x.Children.count(d)>1?x.Children.only(null):x.isValidElement(d)?d.props.children:null:u);return a.jsx(t,{...l,ref:n,children:x.isValidElement(d)?x.cloneElement(d,void 0,m):null})}return a.jsx(t,{...l,ref:n,children:s})});return r.displayName=`${e}.Slot`,r}var Kh=Ec("Slot");function Yh(e){const t=x.forwardRef((r,o)=>{let{children:n,...s}=r;if($c(n)&&typeof Qa=="function"&&(n=Qa(n._payload)),x.isValidElement(n)){const l=ex(n),i=Qh(s,n.props);return n.type!==x.Fragment&&(i.ref=o?ks(o,l):l),x.cloneElement(n,i)}return x.Children.count(n)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Zh=Symbol("radix.slottable");function Jh(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Zh}function Qh(e,t){const r={...t};for(const o in t){const n=e[o],s=t[o];/^on[A-Z]/.test(o)?n&&s?r[o]=(...l)=>{const i=s(...l);return n(...l),i}:n&&(r[o]=n):o==="style"?r[o]={...n,...s}:o==="className"&&(r[o]=[n,s].filter(Boolean).join(" "))}return{...e,...r}}function ex(e){var t,r;let o=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,n=o&&"isReactWarning"in o&&o.isReactWarning;return n?e.ref:(o=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=o&&"isReactWarning"in o&&o.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}const Xl=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Gl=mc,Ss=(e,t)=>r=>{var o;if((t==null?void 0:t.variants)==null)return Gl(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:n,defaultVariants:s}=t,l=Object.keys(n).map(d=>{const m=r==null?void 0:r[d],u=s==null?void 0:s[d];if(m===null)return null;const h=Xl(m)||Xl(u);return n[d][h]}),i=r&&Object.entries(r).reduce((d,m)=>{let[u,h]=m;return h===void 0||(d[u]=h),d},{}),c=t==null||(o=t.compoundVariants)===null||o===void 0?void 0:o.reduce((d,m)=>{let{class:u,className:h,...p}=m;return Object.entries(p).every(y=>{let[f,g]=y;return Array.isArray(g)?g.includes({...s,...i}[f]):{...s,...i}[f]===g})?[...d,u,h]:d},[]);return Gl(e,l,c,r==null?void 0:r.class,r==null?void 0:r.className)},tx=Ss("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),$e=x.forwardRef(({className:e,variant:t,size:r,asChild:o=!1,...n},s)=>a.jsx(o?Kh:"button",{className:J(tx({variant:t,size:r,className:e})),ref:s,...n}));$e.displayName="Button";const de=x.forwardRef(({className:e,type:t,...r},o)=>a.jsx("input",{type:t,className:J("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),ref:o,...r}));de.displayName="Input";const jo=x.forwardRef(({className:e,...t},r)=>a.jsx("textarea",{className:J("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",e),ref:r,...t}));jo.displayName="Textarea";var rx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],No=rx.reduce((e,t)=>{const r=Ec(`Primitive.${t}`),o=x.forwardRef((n,s)=>{const{asChild:l,...i}=n,c=l?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...i,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),ax="Label",Ac=x.forwardRef((e,t)=>a.jsx(No.label,{...e,ref:t,onMouseDown:r=>{var o;r.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));Ac.displayName=ax;var _c=Ac;const ox=Ss("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),le=x.forwardRef(({className:e,...t},r)=>a.jsx(_c,{ref:r,className:J(ox(),e),...t}));le.displayName=_c.displayName;const nx=Ss("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground",success:"border-transparent bg-green-500 text-white shadow"}},defaultVariants:{variant:"default"}});function $s({className:e,variant:t,...r}){return a.jsx("div",{className:J(nx({variant:t}),e),...r})}var sx="Separator",Kl="horizontal",lx=["horizontal","vertical"],Tc=x.forwardRef((e,t)=>{const{decorative:r,orientation:o=Kl,...n}=e,s=ix(o)?o:Kl,l=r?{role:"none"}:{"aria-orientation":s==="vertical"?s:void 0,role:"separator"};return a.jsx(No.div,{"data-orientation":s,...l,...n,ref:t})});Tc.displayName=sx;function ix(e){return lx.includes(e)}var Rc=Tc;const Qe=x.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...o},n)=>a.jsx(Rc,{ref:n,decorative:r,orientation:t,className:J("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...o}));Qe.displayName=Rc.displayName;function cx(e,t){const r=x.createContext(t),o=s=>{const{children:l,...i}=s,c=x.useMemo(()=>i,Object.values(i));return a.jsx(r.Provider,{value:c,children:l})};o.displayName=e+"Provider";function n(s){const l=x.useContext(r);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[o,n]}function jt(e,t=[]){let r=[];function o(s,l){const i=x.createContext(l),c=r.length;r=[...r,l];const d=u=>{var h;const{scope:p,children:y,...f}=u,g=((h=p==null?void 0:p[e])==null?void 0:h[c])||i,w=x.useMemo(()=>f,Object.values(f));return a.jsx(g.Provider,{value:w,children:y})};d.displayName=s+"Provider";function m(u,h){var p;const y=((p=h==null?void 0:h[e])==null?void 0:p[c])||i,f=x.useContext(y);if(f)return f;if(l!==void 0)return l;throw new Error(`\`${u}\` must be used within \`${s}\``)}return[d,m]}const n=()=>{const s=r.map(l=>x.createContext(l));return function(l){const i=(l==null?void 0:l[e])||s;return x.useMemo(()=>({[`__scope${e}`]:{...l,[e]:i}}),[l,i])}};return n.scopeName=e,[o,dx(n,...t)]}function dx(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const o=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(n){const s=o.reduce((l,{useScope:i,scopeName:c})=>{const d=i(n)[`__scope${c}`];return{...l,...d}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}function xe(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e==null||e(o),r===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}var et=globalThis!=null&&globalThis.document?x.useLayoutEffect:()=>{},ux=x[" useInsertionEffect ".trim().toString()]||et;function Ut({prop:e,defaultProp:t,onChange:r=()=>{},caller:o}){const[n,s,l]=mx({defaultProp:t,onChange:r}),i=e!==void 0,c=i?e:n;{const m=x.useRef(e!==void 0);x.useEffect(()=>{const u=m.current;u!==i&&console.warn(`${o} is changing from ${u?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),m.current=i},[i,o])}const d=x.useCallback(m=>{var u;if(i){const h=px(m)?m(e):m;h!==e&&((u=l.current)==null||u.call(l,h))}else s(m)},[i,e,s,l]);return[c,d]}function mx({defaultProp:e,onChange:t}){const[r,o]=x.useState(e),n=x.useRef(r),s=x.useRef(t);return ux(()=>{s.current=t},[t]),x.useEffect(()=>{var l;n.current!==r&&((l=s.current)==null||l.call(s,r),n.current=r)},[r,n]),[r,o,s]}function px(e){return typeof e=="function"}function ya(e){const t=x.useRef({value:e,previous:e});return x.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function wa(e){const[t,r]=x.useState(void 0);return et(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const s=n[0];let l,i;if("borderBoxSize"in s){const c=s.borderBoxSize,d=Array.isArray(c)?c[0]:c;l=d.inlineSize,i=d.blockSize}else l=e.offsetWidth,i=e.offsetHeight;r({width:l,height:i})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else r(void 0)},[e]),t}function fx(e,t){return x.useReducer((r,o)=>t[r][o]??r,e)}var Nt=e=>{const{present:t,children:r}=e,o=hx(t),n=typeof r=="function"?r({present:o.isPresent}):x.Children.only(r),s=je(o.ref,xx(n));return typeof r=="function"||o.isPresent?x.cloneElement(n,{ref:s}):null};Nt.displayName="Presence";function hx(e){const[t,r]=x.useState(),o=x.useRef(null),n=x.useRef(e),s=x.useRef("none"),l=e?"mounted":"unmounted",[i,c]=fx(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return x.useEffect(()=>{const d=Oa(o.current);s.current=i==="mounted"?d:"none"},[i]),et(()=>{const d=o.current,m=n.current;if(m!==e){const u=s.current,h=Oa(d);e?c("MOUNT"):h==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(m&&u!==h?"ANIMATION_OUT":"UNMOUNT"),n.current=e}},[e,c]),et(()=>{if(t){let d;const m=t.ownerDocument.defaultView??window,u=p=>{const y=Oa(o.current).includes(CSS.escape(p.animationName));if(p.target===t&&y&&(c("ANIMATION_END"),!n.current)){const f=t.style.animationFillMode;t.style.animationFillMode="forwards",d=m.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=f)})}},h=p=>{p.target===t&&(s.current=Oa(o.current))};return t.addEventListener("animationstart",h),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{m.clearTimeout(d),t.removeEventListener("animationstart",h),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:x.useCallback(d=>{o.current=d?getComputedStyle(d):null,r(d)},[])}}function Oa(e){return(e==null?void 0:e.animationName)||"none"}function xx(e){var t,r;let o=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,n=o&&"isReactWarning"in o&&o.isReactWarning;return n?e.ref:(o=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=o&&"isReactWarning"in o&&o.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Gr(e){const t=gx(e),r=x.forwardRef((o,n)=>{const{children:s,...l}=o,i=x.Children.toArray(s),c=i.find(bx);if(c){const d=c.props.children,m=i.map(u=>u===c?x.Children.count(d)>1?x.Children.only(null):x.isValidElement(d)?d.props.children:null:u);return a.jsx(t,{...l,ref:n,children:x.isValidElement(d)?x.cloneElement(d,void 0,m):null})}return a.jsx(t,{...l,ref:n,children:s})});return r.displayName=`${e}.Slot`,r}function gx(e){const t=x.forwardRef((r,o)=>{const{children:n,...s}=r;if(x.isValidElement(n)){const l=wx(n),i=yx(s,n.props);return n.type!==x.Fragment&&(i.ref=o?ks(o,l):l),x.cloneElement(n,i)}return x.Children.count(n)>1?x.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Dc=Symbol("radix.slottable");function vx(e){const t=({children:r})=>a.jsx(a.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=Dc,t}function bx(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Dc}function yx(e,t){const r={...t};for(const o in t){const n=e[o],s=t[o];/^on[A-Z]/.test(o)?n&&s?r[o]=(...l)=>{const i=s(...l);return n(...l),i}:n&&(r[o]=n):o==="style"?r[o]={...n,...s}:o==="className"&&(r[o]=[n,s].filter(Boolean).join(" "))}return{...e,...r}}function wx(e){var t,r;let o=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,n=o&&"isReactWarning"in o&&o.isReactWarning;return n?e.ref:(o=(r=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:r.get,n=o&&"isReactWarning"in o&&o.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var jx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],be=jx.reduce((e,t)=>{const r=Gr(`Primitive.${t}`),o=x.forwardRef((n,s)=>{const{asChild:l,...i}=n,c=l?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...i,ref:s})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function Nx(e,t){e&&bo.flushSync(()=>e.dispatchEvent(t))}var Co="Checkbox",[Cx]=jt(Co),[kx,Es]=Cx(Co);function Sx(e){const{__scopeCheckbox:t,checked:r,children:o,defaultChecked:n,disabled:s,form:l,name:i,onCheckedChange:c,required:d,value:m="on",internal_do_not_use_render:u}=e,[h,p]=Ut({prop:r,defaultProp:n??!1,onChange:c,caller:Co}),[y,f]=x.useState(null),[g,w]=x.useState(null),v=x.useRef(!1),b=y?!!l||!!y.closest("form"):!0,j={checked:h,disabled:s,setChecked:p,control:y,setControl:f,name:i,form:l,value:m,hasConsumerStoppedPropagationRef:v,required:d,defaultChecked:ir(n)?!1:n,isFormControl:b,bubbleInput:g,setBubbleInput:w};return a.jsx(kx,{scope:t,...j,children:$x(u)?u(j):o})}var Pc="CheckboxTrigger",Oc=x.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...o},n)=>{const{control:s,value:l,disabled:i,checked:c,required:d,setControl:m,setChecked:u,hasConsumerStoppedPropagationRef:h,isFormControl:p,bubbleInput:y}=Es(Pc,e),f=je(n,m),g=x.useRef(c);return x.useEffect(()=>{const w=s==null?void 0:s.form;if(w){const v=()=>u(g.current);return w.addEventListener("reset",v),()=>w.removeEventListener("reset",v)}},[s,u]),a.jsx(be.button,{type:"button",role:"checkbox","aria-checked":ir(c)?"mixed":c,"aria-required":d,"data-state":Vc(c),"data-disabled":i?"":void 0,disabled:i,value:l,...o,ref:f,onKeyDown:xe(t,w=>{w.key==="Enter"&&w.preventDefault()}),onClick:xe(r,w=>{u(v=>ir(v)?!0:!v),y&&p&&(h.current=w.isPropagationStopped(),h.current||w.stopPropagation())})})});Oc.displayName=Pc;var As=x.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:o,checked:n,defaultChecked:s,required:l,disabled:i,value:c,onCheckedChange:d,form:m,...u}=e;return a.jsx(Sx,{__scopeCheckbox:r,checked:n,defaultChecked:s,disabled:i,required:l,onCheckedChange:d,name:o,form:m,value:c,internal_do_not_use_render:({isFormControl:h})=>a.jsxs(a.Fragment,{children:[a.jsx(Oc,{...u,ref:t,__scopeCheckbox:r}),h&&a.jsx(Mc,{__scopeCheckbox:r})]})})});As.displayName=Co;var Ic="CheckboxIndicator",Fc=x.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:o,...n}=e,s=Es(Ic,r);return a.jsx(Nt,{present:o||ir(s.checked)||s.checked===!0,children:a.jsx(be.span,{"data-state":Vc(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t,style:{pointerEvents:"none",...e.style}})})});Fc.displayName=Ic;var Lc="CheckboxBubbleInput",Mc=x.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:o,hasConsumerStoppedPropagationRef:n,checked:s,defaultChecked:l,required:i,disabled:c,name:d,value:m,form:u,bubbleInput:h,setBubbleInput:p}=Es(Lc,e),y=je(r,p),f=ya(s),g=wa(o);x.useEffect(()=>{const v=h;if(!v)return;const b=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(b,"checked").set,N=!n.current;if(f!==s&&j){const S=new Event("click",{bubbles:N});v.indeterminate=ir(s),j.call(v,ir(s)?!1:s),v.dispatchEvent(S)}},[h,f,s,n]);const w=x.useRef(ir(s)?!1:s);return a.jsx(be.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??w.current,required:i,disabled:c,name:d,value:m,form:u,...t,tabIndex:-1,ref:y,style:{...t.style,...g,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});Mc.displayName=Lc;function $x(e){return typeof e=="function"}function ir(e){return e==="indeterminate"}function Vc(e){return ir(e)?"indeterminate":e?"checked":"unchecked"}const We=x.forwardRef(({className:e,...t},r)=>a.jsx(As,{ref:r,className:J("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:a.jsx(Fc,{className:J("flex items-center justify-center text-current"),children:a.jsx(O.Check,{className:"h-4 w-4"})})}));We.displayName=As.displayName;function _s(e){const t=e+"CollectionProvider",[r,o]=jt(t),[n,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),l=f=>{const{scope:g,children:w}=f,v=k.useRef(null),b=k.useRef(new Map).current;return a.jsx(n,{scope:g,itemMap:b,collectionRef:v,children:w})};l.displayName=t;const i=e+"CollectionSlot",c=Gr(i),d=k.forwardRef((f,g)=>{const{scope:w,children:v}=f,b=s(i,w),j=je(g,b.collectionRef);return a.jsx(c,{ref:j,children:v})});d.displayName=i;const m=e+"CollectionItemSlot",u="data-radix-collection-item",h=Gr(m),p=k.forwardRef((f,g)=>{const{scope:w,children:v,...b}=f,j=k.useRef(null),N=je(g,j),S=s(m,w);return k.useEffect(()=>(S.itemMap.set(j,{ref:j,...b}),()=>void S.itemMap.delete(j))),a.jsx(h,{[u]:"",ref:N,children:v})});p.displayName=m;function y(f){const g=s(e+"CollectionConsumer",f);return k.useCallback(()=>{const w=g.collectionRef.current;if(!w)return[];const v=Array.from(w.querySelectorAll(`[${u}]`));return Array.from(g.itemMap.values()).sort((b,j)=>v.indexOf(b.ref.current)-v.indexOf(j.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:l,Slot:d,ItemSlot:p},y,o]}var Ex=x[" useId ".trim().toString()]||(()=>{}),Ax=0;function Zt(e){const[t,r]=x.useState(Ex());return et(()=>{r(o=>o??String(Ax++))},[e]),t?`radix-${t}`:""}function ot(e){const t=x.useRef(e);return x.useEffect(()=>{t.current=e}),x.useMemo(()=>(...r)=>{var o;return(o=t.current)==null?void 0:o.call(t,...r)},[])}var _x=x.createContext(void 0);function ja(e){const t=x.useContext(_x);return e||t||"ltr"}var hn="rovingFocusGroup.onEntryFocus",Tx={bubbles:!1,cancelable:!0},Na="RovingFocusGroup",[Wn,zc,Rx]=_s(Na),[Dx,Bc]=jt(Na,[Rx]),[Px,Ox]=Dx(Na),Uc=x.forwardRef((e,t)=>a.jsx(Wn.Provider,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Wn.Slot,{scope:e.__scopeRovingFocusGroup,children:a.jsx(Ix,{...e,ref:t})})}));Uc.displayName=Na;var Ix=x.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:o,loop:n=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:m=!1,...u}=e,h=x.useRef(null),p=je(t,h),y=ja(s),[f,g]=Ut({prop:l,defaultProp:i??null,onChange:c,caller:Na}),[w,v]=x.useState(!1),b=ot(d),j=zc(r),N=x.useRef(!1),[S,$]=x.useState(0);return x.useEffect(()=>{const C=h.current;if(C)return C.addEventListener(hn,b),()=>C.removeEventListener(hn,b)},[b]),a.jsx(Px,{scope:r,orientation:o,dir:y,loop:n,currentTabStopId:f,onItemFocus:x.useCallback(C=>g(C),[g]),onItemShiftTab:x.useCallback(()=>v(!0),[]),onFocusableItemAdd:x.useCallback(()=>$(C=>C+1),[]),onFocusableItemRemove:x.useCallback(()=>$(C=>C-1),[]),children:a.jsx(be.div,{tabIndex:w||S===0?-1:0,"data-orientation":o,...u,ref:p,style:{outline:"none",...e.style},onMouseDown:xe(e.onMouseDown,()=>{N.current=!0}),onFocus:xe(e.onFocus,C=>{const E=!N.current;if(C.target===C.currentTarget&&E&&!w){const A=new CustomEvent(hn,Tx);if(C.currentTarget.dispatchEvent(A),!A.defaultPrevented){const I=j().filter(q=>q.focusable),M=I.find(q=>q.active),T=I.find(q=>q.id===f),B=[M,T,...I].filter(Boolean).map(q=>q.ref.current);qc(B,m)}}N.current=!1}),onBlur:xe(e.onBlur,()=>v(!1))})})}),Hc="RovingFocusGroupItem",Wc=x.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:o=!0,active:n=!1,tabStopId:s,children:l,...i}=e,c=Zt(),d=s||c,m=Ox(Hc,r),u=m.currentTabStopId===d,h=zc(r),{onFocusableItemAdd:p,onFocusableItemRemove:y,currentTabStopId:f}=m;return x.useEffect(()=>{if(o)return p(),()=>y()},[o,p,y]),a.jsx(Wn.ItemSlot,{scope:r,id:d,focusable:o,active:n,children:a.jsx(be.span,{tabIndex:u?0:-1,"data-orientation":m.orientation,...i,ref:t,onMouseDown:xe(e.onMouseDown,g=>{o?m.onItemFocus(d):g.preventDefault()}),onFocus:xe(e.onFocus,()=>m.onItemFocus(d)),onKeyDown:xe(e.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){m.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const w=Mx(g,m.orientation,m.dir);if(w!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let v=h().filter(b=>b.focusable).map(b=>b.ref.current);if(w==="last")v.reverse();else if(w==="prev"||w==="next"){w==="prev"&&v.reverse();const b=v.indexOf(g.currentTarget);v=m.loop?Vx(v,b+1):v.slice(b+1)}setTimeout(()=>qc(v))}}),children:typeof l=="function"?l({isCurrentTabStop:u,hasTabStop:f!=null}):l})})});Wc.displayName=Hc;var Fx={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Lx(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Mx(e,t,r){const o=Lx(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return Fx[o]}function qc(e,t=!1){const r=document.activeElement;for(const o of e)if(o===r||(o.focus({preventScroll:t}),document.activeElement!==r))return}function Vx(e,t){return e.map((r,o)=>e[(t+o)%e.length])}var zx=Uc,Bx=Wc,Ts="Radio",[Ux,Xc]=jt(Ts),[Hx,Wx]=Ux(Ts),Gc=x.forwardRef((e,t)=>{const{__scopeRadio:r,name:o,checked:n=!1,required:s,disabled:l,value:i="on",onCheck:c,form:d,...m}=e,[u,h]=x.useState(null),p=je(t,g=>h(g)),y=x.useRef(!1),f=u?d||!!u.closest("form"):!0;return a.jsxs(Hx,{scope:r,checked:n,disabled:l,children:[a.jsx(be.button,{type:"button",role:"radio","aria-checked":n,"data-state":Jc(n),"data-disabled":l?"":void 0,disabled:l,value:i,...m,ref:p,onClick:xe(e.onClick,g=>{n||c==null||c(),f&&(y.current=g.isPropagationStopped(),y.current||g.stopPropagation())})}),f&&a.jsx(Zc,{control:u,bubbles:!y.current,name:o,value:i,checked:n,required:s,disabled:l,form:d,style:{transform:"translateX(-100%)"}})]})});Gc.displayName=Ts;var Kc="RadioIndicator",Yc=x.forwardRef((e,t)=>{const{__scopeRadio:r,forceMount:o,...n}=e,s=Wx(Kc,r);return a.jsx(Nt,{present:o||s.checked,children:a.jsx(be.span,{"data-state":Jc(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t})})});Yc.displayName=Kc;var qx="RadioBubbleInput",Zc=x.forwardRef(({__scopeRadio:e,control:t,checked:r,bubbles:o=!0,...n},s)=>{const l=x.useRef(null),i=je(l,s),c=ya(r),d=wa(t);return x.useEffect(()=>{const m=l.current;if(!m)return;const u=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(u,"checked").set;if(c!==r&&h){const p=new Event("click",{bubbles:o});h.call(m,r),m.dispatchEvent(p)}},[c,r,o]),a.jsx(be.input,{type:"radio","aria-hidden":!0,defaultChecked:r,...n,tabIndex:-1,ref:i,style:{...n.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});Zc.displayName=qx;function Jc(e){return e?"checked":"unchecked"}var Xx=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ko="RadioGroup",[Gx]=jt(ko,[Bc,Xc]),Qc=Bc(),ed=Xc(),[Kx,Yx]=Gx(ko),td=x.forwardRef((e,t)=>{const{__scopeRadioGroup:r,name:o,defaultValue:n,value:s,required:l=!1,disabled:i=!1,orientation:c,dir:d,loop:m=!0,onValueChange:u,...h}=e,p=Qc(r),y=ja(d),[f,g]=Ut({prop:s,defaultProp:n??null,onChange:u,caller:ko});return a.jsx(Kx,{scope:r,name:o,required:l,disabled:i,value:f,onValueChange:g,children:a.jsx(zx,{asChild:!0,...p,orientation:c,dir:y,loop:m,children:a.jsx(be.div,{role:"radiogroup","aria-required":l,"aria-orientation":c,"data-disabled":i?"":void 0,dir:y,...h,ref:t})})})});td.displayName=ko;var rd="RadioGroupItem",ad=x.forwardRef((e,t)=>{const{__scopeRadioGroup:r,disabled:o,...n}=e,s=Yx(rd,r),l=s.disabled||o,i=Qc(r),c=ed(r),d=x.useRef(null),m=je(t,d),u=s.value===n.value,h=x.useRef(!1);return x.useEffect(()=>{const p=f=>{Xx.includes(f.key)&&(h.current=!0)},y=()=>h.current=!1;return document.addEventListener("keydown",p),document.addEventListener("keyup",y),()=>{document.removeEventListener("keydown",p),document.removeEventListener("keyup",y)}},[]),a.jsx(Bx,{asChild:!0,...i,focusable:!l,active:u,children:a.jsx(Gc,{disabled:l,required:s.required,checked:u,...c,...n,name:s.name,ref:m,onCheck:()=>s.onValueChange(n.value),onKeyDown:xe(p=>{p.key==="Enter"&&p.preventDefault()}),onFocus:xe(n.onFocus,()=>{var p;h.current&&((p=d.current)==null||p.click())})})})});ad.displayName=rd;var Zx="RadioGroupIndicator",od=x.forwardRef((e,t)=>{const{__scopeRadioGroup:r,...o}=e,n=ed(r);return a.jsx(Yc,{...n,...o,ref:t})});od.displayName=Zx;var nd=td,sd=ad,Jx=od;const Rs=x.forwardRef(({className:e,...t},r)=>a.jsx(nd,{className:J("grid gap-2",e),...t,ref:r}));Rs.displayName=nd.displayName;const Ds=x.forwardRef(({className:e,...t},r)=>a.jsx(sd,{ref:r,className:J("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...t,children:a.jsx(Jx,{className:"flex items-center justify-center",children:a.jsx(O.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Ds.displayName=sd.displayName;var So="Switch",[Qx]=jt(So),[eg,tg]=Qx(So),ld=x.forwardRef((e,t)=>{const{__scopeSwitch:r,name:o,checked:n,defaultChecked:s,required:l,disabled:i,value:c="on",onCheckedChange:d,form:m,...u}=e,[h,p]=x.useState(null),y=je(t,b=>p(b)),f=x.useRef(!1),g=h?m||!!h.closest("form"):!0,[w,v]=Ut({prop:n,defaultProp:s??!1,onChange:d,caller:So});return a.jsxs(eg,{scope:r,checked:w,disabled:i,children:[a.jsx(be.button,{type:"button",role:"switch","aria-checked":w,"aria-required":l,"data-state":ud(w),"data-disabled":i?"":void 0,disabled:i,value:c,...u,ref:y,onClick:xe(e.onClick,b=>{v(j=>!j),g&&(f.current=b.isPropagationStopped(),f.current||b.stopPropagation())})}),g&&a.jsx(dd,{control:h,bubbles:!f.current,name:o,value:c,checked:w,required:l,disabled:i,form:m,style:{transform:"translateX(-100%)"}})]})});ld.displayName=So;var id="SwitchThumb",cd=x.forwardRef((e,t)=>{const{__scopeSwitch:r,...o}=e,n=tg(id,r);return a.jsx(be.span,{"data-state":ud(n.checked),"data-disabled":n.disabled?"":void 0,...o,ref:t})});cd.displayName=id;var rg="SwitchBubbleInput",dd=x.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:o=!0,...n},s)=>{const l=x.useRef(null),i=je(l,s),c=ya(r),d=wa(t);return x.useEffect(()=>{const m=l.current;if(!m)return;const u=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(u,"checked").set;if(c!==r&&h){const p=new Event("click",{bubbles:o});h.call(m,r),m.dispatchEvent(p)}},[c,r,o]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...n,tabIndex:-1,ref:i,style:{...n.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});dd.displayName=rg;function ud(e){return e?"checked":"unchecked"}var md=ld,ag=cd;const Ps=x.forwardRef(({className:e,...t},r)=>a.jsx(md,{ref:r,className:J("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,children:a.jsx(ag,{className:J("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Ps.displayName=md.displayName;function fa(e,[t,r]){return Math.min(r,Math.max(t,e))}function og(e,t=globalThis==null?void 0:globalThis.document){const r=ot(e);x.useEffect(()=>{const o=n=>{n.key==="Escape"&&r(n)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[r,t])}var ng="DismissableLayer",qn="dismissableLayer.update",sg="dismissableLayer.pointerDownOutside",lg="dismissableLayer.focusOutside",Yl,pd=x.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ca=x.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:o,onPointerDownOutside:n,onFocusOutside:s,onInteractOutside:l,onDismiss:i,...c}=e,d=x.useContext(pd),[m,u]=x.useState(null),h=(m==null?void 0:m.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,p]=x.useState({}),y=je(t,$=>u($)),f=Array.from(d.layers),[g]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),w=f.indexOf(g),v=m?f.indexOf(m):-1,b=d.layersWithOutsidePointerEventsDisabled.size>0,j=v>=w,N=dg($=>{const C=$.target,E=[...d.branches].some(A=>A.contains(C));!j||E||(n==null||n($),l==null||l($),$.defaultPrevented||i==null||i())},h),S=ug($=>{const C=$.target;[...d.branches].some(E=>E.contains(C))||(s==null||s($),l==null||l($),$.defaultPrevented||i==null||i())},h);return og($=>{v===d.layers.size-1&&(o==null||o($),!$.defaultPrevented&&i&&($.preventDefault(),i()))},h),x.useEffect(()=>{if(m)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(Yl=h.body.style.pointerEvents,h.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(m)),d.layers.add(m),Zl(),()=>{r&&d.layersWithOutsidePointerEventsDisabled.size===1&&(h.body.style.pointerEvents=Yl)}},[m,h,r,d]),x.useEffect(()=>()=>{m&&(d.layers.delete(m),d.layersWithOutsidePointerEventsDisabled.delete(m),Zl())},[m,d]),x.useEffect(()=>{const $=()=>p({});return document.addEventListener(qn,$),()=>document.removeEventListener(qn,$)},[]),a.jsx(be.div,{...c,ref:y,style:{pointerEvents:b?j?"auto":"none":void 0,...e.style},onFocusCapture:xe(e.onFocusCapture,S.onFocusCapture),onBlurCapture:xe(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:xe(e.onPointerDownCapture,N.onPointerDownCapture)})});Ca.displayName=ng;var ig="DismissableLayerBranch",cg=x.forwardRef((e,t)=>{const r=x.useContext(pd),o=x.useRef(null),n=je(t,o);return x.useEffect(()=>{const s=o.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),a.jsx(be.div,{...e,ref:n})});cg.displayName=ig;function dg(e,t=globalThis==null?void 0:globalThis.document){const r=ot(e),o=x.useRef(!1),n=x.useRef(()=>{});return x.useEffect(()=>{const s=i=>{if(i.target&&!o.current){let c=function(){fd(sg,r,d,{discrete:!0})};const d={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",n.current),n.current=c,t.addEventListener("click",n.current,{once:!0})):c()}else t.removeEventListener("click",n.current);o.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",s),t.removeEventListener("click",n.current)}},[t,r]),{onPointerDownCapture:()=>o.current=!0}}function ug(e,t=globalThis==null?void 0:globalThis.document){const r=ot(e),o=x.useRef(!1);return x.useEffect(()=>{const n=s=>{s.target&&!o.current&&fd(lg,r,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",n),()=>t.removeEventListener("focusin",n)},[t,r]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Zl(){const e=new CustomEvent(qn);document.dispatchEvent(e)}function fd(e,t,r,{discrete:o}){const n=r.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&n.addEventListener(e,t,{once:!0}),o?Nx(n,s):n.dispatchEvent(s)}var xn=0;function Os(){x.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Jl()),document.body.insertAdjacentElement("beforeend",e[1]??Jl()),xn++,()=>{xn===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),xn--}},[])}function Jl(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var gn="focusScope.autoFocusOnMount",vn="focusScope.autoFocusOnUnmount",Ql={bubbles:!1,cancelable:!0},mg="FocusScope",$o=x.forwardRef((e,t)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:n,onUnmountAutoFocus:s,...l}=e,[i,c]=x.useState(null),d=ot(n),m=ot(s),u=x.useRef(null),h=je(t,f=>c(f)),p=x.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;x.useEffect(()=>{if(o){let f=function(b){if(p.paused||!i)return;const j=b.target;i.contains(j)?u.current=j:lr(u.current,{select:!0})},g=function(b){if(p.paused||!i)return;const j=b.relatedTarget;j!==null&&(i.contains(j)||lr(u.current,{select:!0}))},w=function(b){if(document.activeElement===document.body)for(const j of b)j.removedNodes.length>0&&lr(i)};document.addEventListener("focusin",f),document.addEventListener("focusout",g);const v=new MutationObserver(w);return i&&v.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",g),v.disconnect()}}},[o,i,p.paused]),x.useEffect(()=>{if(i){ti.add(p);const f=document.activeElement;if(!i.contains(f)){const g=new CustomEvent(gn,Ql);i.addEventListener(gn,d),i.dispatchEvent(g),g.defaultPrevented||(pg(vg(hd(i)),{select:!0}),document.activeElement===f&&lr(i))}return()=>{i.removeEventListener(gn,d),setTimeout(()=>{const g=new CustomEvent(vn,Ql);i.addEventListener(vn,m),i.dispatchEvent(g),g.defaultPrevented||lr(f??document.body,{select:!0}),i.removeEventListener(vn,m),ti.remove(p)},0)}}},[i,d,m,p]);const y=x.useCallback(f=>{if(!r&&!o||p.paused)return;const g=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,w=document.activeElement;if(g&&w){const v=f.currentTarget,[b,j]=fg(v);b&&j?!f.shiftKey&&w===j?(f.preventDefault(),r&&lr(b,{select:!0})):f.shiftKey&&w===b&&(f.preventDefault(),r&&lr(j,{select:!0})):w===v&&f.preventDefault()}},[r,o,p.paused]);return a.jsx(be.div,{tabIndex:-1,...l,ref:h,onKeyDown:y})});$o.displayName=mg;function pg(e,{select:t=!1}={}){const r=document.activeElement;for(const o of e)if(lr(o,{select:t}),document.activeElement!==r)return}function fg(e){const t=hd(e),r=ei(t,e),o=ei(t.reverse(),e);return[r,o]}function hd(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const n=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||n?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function ei(e,t){for(const r of e)if(!hg(r,{upTo:t}))return r}function hg(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function xg(e){return e instanceof HTMLInputElement&&"select"in e}function lr(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&xg(e)&&t&&e.select()}}var ti=gg();function gg(){let e=[];return{add(t){const r=e[0];t!==r&&(r==null||r.pause()),e=ri(e,t),e.unshift(t)},remove(t){var r;e=ri(e,t),(r=e[0])==null||r.resume()}}}function ri(e,t){const r=[...e],o=r.indexOf(t);return o!==-1&&r.splice(o,1),r}function vg(e){return e.filter(t=>t.tagName!=="A")}const bg=["top","right","bottom","left"],ur=Math.min,ht=Math.max,eo=Math.round,Ia=Math.floor,Bt=e=>({x:e,y:e}),yg={left:"right",right:"left",bottom:"top",top:"bottom"};function Xn(e,t,r){return ht(e,ur(t,r))}function Jt(e,t){return typeof e=="function"?e(t):e}function Qt(e){return e.split("-")[0]}function ea(e){return e.split("-")[1]}function Is(e){return e==="x"?"y":"x"}function Fs(e){return e==="y"?"height":"width"}function zt(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Ls(e){return Is(zt(e))}function wg(e,t,r){r===void 0&&(r=!1);const o=ea(e),n=Ls(e),s=Fs(n);let l=n==="x"?o===(r?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(l=to(l)),[l,to(l)]}function jg(e){const t=to(e);return[Gn(e),t,Gn(t)]}function Gn(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const ai=["left","right"],oi=["right","left"],Ng=["top","bottom"],Cg=["bottom","top"];function kg(e,t,r){switch(e){case"top":case"bottom":return r?t?oi:ai:t?ai:oi;case"left":case"right":return t?Ng:Cg;default:return[]}}function Sg(e,t,r,o){const n=ea(e);let s=kg(Qt(e),r==="start",o);return n&&(s=s.map(l=>l+"-"+n),t&&(s=s.concat(s.map(Gn)))),s}function to(e){const t=Qt(e);return yg[t]+e.slice(t.length)}function $g(e){return{top:0,right:0,bottom:0,left:0,...e}}function xd(e){return typeof e!="number"?$g(e):{top:e,right:e,bottom:e,left:e}}function ro(e){const{x:t,y:r,width:o,height:n}=e;return{width:o,height:n,top:r,left:t,right:t+o,bottom:r+n,x:t,y:r}}function ni(e,t,r){let{reference:o,floating:n}=e;const s=zt(t),l=Ls(t),i=Fs(l),c=Qt(t),d=s==="y",m=o.x+o.width/2-n.width/2,u=o.y+o.height/2-n.height/2,h=o[i]/2-n[i]/2;let p;switch(c){case"top":p={x:m,y:o.y-n.height};break;case"bottom":p={x:m,y:o.y+o.height};break;case"right":p={x:o.x+o.width,y:u};break;case"left":p={x:o.x-n.width,y:u};break;default:p={x:o.x,y:o.y}}switch(ea(t)){case"start":p[l]-=h*(r&&d?-1:1);break;case"end":p[l]+=h*(r&&d?-1:1);break}return p}async function Eg(e,t){var r;t===void 0&&(t={});const{x:o,y:n,platform:s,rects:l,elements:i,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:m="viewport",elementContext:u="floating",altBoundary:h=!1,padding:p=0}=Jt(t,e),y=xd(p),f=i[h?u==="floating"?"reference":"floating":u],g=ro(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(f)))==null||r?f:f.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(i.floating)),boundary:d,rootBoundary:m,strategy:c})),w=u==="floating"?{x:o,y:n,width:l.floating.width,height:l.floating.height}:l.reference,v=await(s.getOffsetParent==null?void 0:s.getOffsetParent(i.floating)),b=await(s.isElement==null?void 0:s.isElement(v))?await(s.getScale==null?void 0:s.getScale(v))||{x:1,y:1}:{x:1,y:1},j=ro(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:w,offsetParent:v,strategy:c}):w);return{top:(g.top-j.top+y.top)/b.y,bottom:(j.bottom-g.bottom+y.bottom)/b.y,left:(g.left-j.left+y.left)/b.x,right:(j.right-g.right+y.right)/b.x}}const Ag=50,_g=async(e,t,r)=>{const{placement:o="bottom",strategy:n="absolute",middleware:s=[],platform:l}=r,i=l.detectOverflow?l:{...l,detectOverflow:Eg},c=await(l.isRTL==null?void 0:l.isRTL(t));let d=await l.getElementRects({reference:e,floating:t,strategy:n}),{x:m,y:u}=ni(d,o,c),h=o,p=0;const y={};for(let f=0;f<s.length;f++){const g=s[f];if(!g)continue;const{name:w,fn:v}=g,{x:b,y:j,data:N,reset:S}=await v({x:m,y:u,initialPlacement:o,placement:h,strategy:n,middlewareData:y,rects:d,platform:i,elements:{reference:e,floating:t}});m=b??m,u=j??u,y[w]={...y[w],...N},S&&p<Ag&&(p++,typeof S=="object"&&(S.placement&&(h=S.placement),S.rects&&(d=S.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:n}):S.rects),{x:m,y:u}=ni(d,h,c)),f=-1)}return{x:m,y:u,placement:h,strategy:n,middlewareData:y}},Tg=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:o,placement:n,rects:s,platform:l,elements:i,middlewareData:c}=t,{element:d,padding:m=0}=Jt(e,t)||{};if(d==null)return{};const u=xd(m),h={x:r,y:o},p=Ls(n),y=Fs(p),f=await l.getDimensions(d),g=p==="y",w=g?"top":"left",v=g?"bottom":"right",b=g?"clientHeight":"clientWidth",j=s.reference[y]+s.reference[p]-h[p]-s.floating[y],N=h[p]-s.reference[p],S=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d));let $=S?S[b]:0;(!$||!await(l.isElement==null?void 0:l.isElement(S)))&&($=i.floating[b]||s.floating[y]);const C=j/2-N/2,E=$/2-f[y]/2-1,A=ur(u[w],E),I=ur(u[v],E),M=A,T=$-f[y]-I,B=$/2-f[y]/2+C,q=Xn(M,B,T),W=!c.arrow&&ea(n)!=null&&B!==q&&s.reference[y]/2-(B<M?A:I)-f[y]/2<0,X=W?B<M?B-M:B-T:0;return{[p]:h[p]+X,data:{[p]:q,centerOffset:B-q-X,...W&&{alignmentOffset:X}},reset:W}}}),Rg=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,o;const{placement:n,middlewareData:s,rects:l,initialPlacement:i,platform:c,elements:d}=t,{mainAxis:m=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:y="none",flipAlignment:f=!0,...g}=Jt(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const w=Qt(n),v=zt(i),b=Qt(i)===i,j=await(c.isRTL==null?void 0:c.isRTL(d.floating)),N=h||(b||!f?[to(i)]:jg(i)),S=y!=="none";!h&&S&&N.push(...Sg(i,f,y,j));const $=[i,...N],C=await c.detectOverflow(t,g),E=[];let A=((o=s.flip)==null?void 0:o.overflows)||[];if(m&&E.push(C[w]),u){const B=wg(n,l,j);E.push(C[B[0]],C[B[1]])}if(A=[...A,{placement:n,overflows:E}],!E.every(B=>B<=0)){var I,M;const B=(((I=s.flip)==null?void 0:I.index)||0)+1,q=$[B];if(q&&(!(u==="alignment"&&v!==zt(q))||A.every(X=>zt(X.placement)===v?X.overflows[0]>0:!0)))return{data:{index:B,overflows:A},reset:{placement:q}};let W=(M=A.filter(X=>X.overflows[0]<=0).sort((X,V)=>X.overflows[1]-V.overflows[1])[0])==null?void 0:M.placement;if(!W)switch(p){case"bestFit":{var T;const X=(T=A.filter(V=>{if(S){const L=zt(V.placement);return L===v||L==="y"}return!0}).map(V=>[V.placement,V.overflows.filter(L=>L>0).reduce((L,P)=>L+P,0)]).sort((V,L)=>V[1]-L[1])[0])==null?void 0:T[0];X&&(W=X);break}case"initialPlacement":W=i;break}if(n!==W)return{reset:{placement:W}}}return{}}}};function si(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function li(e){return bg.some(t=>e[t]>=0)}const Dg=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:o}=t,{strategy:n="referenceHidden",...s}=Jt(e,t);switch(n){case"referenceHidden":{const l=await o.detectOverflow(t,{...s,elementContext:"reference"}),i=si(l,r.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:li(i)}}}case"escaped":{const l=await o.detectOverflow(t,{...s,altBoundary:!0}),i=si(l,r.floating);return{data:{escapedOffsets:i,escaped:li(i)}}}default:return{}}}}},gd=new Set(["left","top"]);async function Pg(e,t){const{placement:r,platform:o,elements:n}=e,s=await(o.isRTL==null?void 0:o.isRTL(n.floating)),l=Qt(r),i=ea(r),c=zt(r)==="y",d=gd.has(l)?-1:1,m=s&&c?-1:1,u=Jt(t,e);let{mainAxis:h,crossAxis:p,alignmentAxis:y}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return i&&typeof y=="number"&&(p=i==="end"?y*-1:y),c?{x:p*m,y:h*d}:{x:h*d,y:p*m}}const Og=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,o;const{x:n,y:s,placement:l,middlewareData:i}=t,c=await Pg(t,e);return l===((r=i.offset)==null?void 0:r.placement)&&(o=i.arrow)!=null&&o.alignmentOffset?{}:{x:n+c.x,y:s+c.y,data:{...c,placement:l}}}}},Ig=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:o,placement:n,platform:s}=t,{mainAxis:l=!0,crossAxis:i=!1,limiter:c={fn:w=>{let{x:v,y:b}=w;return{x:v,y:b}}},...d}=Jt(e,t),m={x:r,y:o},u=await s.detectOverflow(t,d),h=zt(Qt(n)),p=Is(h);let y=m[p],f=m[h];if(l){const w=p==="y"?"top":"left",v=p==="y"?"bottom":"right",b=y+u[w],j=y-u[v];y=Xn(b,y,j)}if(i){const w=h==="y"?"top":"left",v=h==="y"?"bottom":"right",b=f+u[w],j=f-u[v];f=Xn(b,f,j)}const g=c.fn({...t,[p]:y,[h]:f});return{...g,data:{x:g.x-r,y:g.y-o,enabled:{[p]:l,[h]:i}}}}}},Fg=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:o,placement:n,rects:s,middlewareData:l}=t,{offset:i=0,mainAxis:c=!0,crossAxis:d=!0}=Jt(e,t),m={x:r,y:o},u=zt(n),h=Is(u);let p=m[h],y=m[u];const f=Jt(i,t),g=typeof f=="number"?{mainAxis:f,crossAxis:0}:{mainAxis:0,crossAxis:0,...f};if(c){const b=h==="y"?"height":"width",j=s.reference[h]-s.floating[b]+g.mainAxis,N=s.reference[h]+s.reference[b]-g.mainAxis;p<j?p=j:p>N&&(p=N)}if(d){var w,v;const b=h==="y"?"width":"height",j=gd.has(Qt(n)),N=s.reference[u]-s.floating[b]+(j&&((w=l.offset)==null?void 0:w[u])||0)+(j?0:g.crossAxis),S=s.reference[u]+s.reference[b]+(j?0:((v=l.offset)==null?void 0:v[u])||0)-(j?g.crossAxis:0);y<N?y=N:y>S&&(y=S)}return{[h]:p,[u]:y}}}},Lg=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,o;const{placement:n,rects:s,platform:l,elements:i}=t,{apply:c=()=>{},...d}=Jt(e,t),m=await l.detectOverflow(t,d),u=Qt(n),h=ea(n),p=zt(n)==="y",{width:y,height:f}=s.floating;let g,w;u==="top"||u==="bottom"?(g=u,w=h===(await(l.isRTL==null?void 0:l.isRTL(i.floating))?"start":"end")?"left":"right"):(w=u,g=h==="end"?"top":"bottom");const v=f-m.top-m.bottom,b=y-m.left-m.right,j=ur(f-m[g],v),N=ur(y-m[w],b),S=!t.middlewareData.shift;let $=j,C=N;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(C=b),(o=t.middlewareData.shift)!=null&&o.enabled.y&&($=v),S&&!h){const A=ht(m.left,0),I=ht(m.right,0),M=ht(m.top,0),T=ht(m.bottom,0);p?C=y-2*(A!==0||I!==0?A+I:ht(m.left,m.right)):$=f-2*(M!==0||T!==0?M+T:ht(m.top,m.bottom))}await c({...t,availableWidth:C,availableHeight:$});const E=await l.getDimensions(i.floating);return y!==E.width||f!==E.height?{reset:{rects:!0}}:{}}}};function Eo(){return typeof window<"u"}function ta(e){return vd(e)?(e.nodeName||"").toLowerCase():"#document"}function vt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ht(e){var t;return(t=(vd(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function vd(e){return Eo()?e instanceof Node||e instanceof vt(e).Node:!1}function Ot(e){return Eo()?e instanceof Element||e instanceof vt(e).Element:!1}function er(e){return Eo()?e instanceof HTMLElement||e instanceof vt(e).HTMLElement:!1}function ii(e){return!Eo()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof vt(e).ShadowRoot}function ka(e){const{overflow:t,overflowX:r,overflowY:o,display:n}=It(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+r)&&n!=="inline"&&n!=="contents"}function Mg(e){return/^(table|td|th)$/.test(ta(e))}function Ao(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Vg=/transform|translate|scale|rotate|perspective|filter/,zg=/paint|layout|strict|content/,wr=e=>!!e&&e!=="none";let bn;function Ms(e){const t=Ot(e)?It(e):e;return wr(t.transform)||wr(t.translate)||wr(t.scale)||wr(t.rotate)||wr(t.perspective)||!Vs()&&(wr(t.backdropFilter)||wr(t.filter))||Vg.test(t.willChange||"")||zg.test(t.contain||"")}function Bg(e){let t=mr(e);for(;er(t)&&!Kr(t);){if(Ms(t))return t;if(Ao(t))return null;t=mr(t)}return null}function Vs(){return bn==null&&(bn=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),bn}function Kr(e){return/^(html|body|#document)$/.test(ta(e))}function It(e){return vt(e).getComputedStyle(e)}function _o(e){return Ot(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function mr(e){if(ta(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ii(e)&&e.host||Ht(e);return ii(t)?t.host:t}function bd(e){const t=mr(e);return Kr(t)?e.ownerDocument?e.ownerDocument.body:e.body:er(t)&&ka(t)?t:bd(t)}function ha(e,t,r){var o;t===void 0&&(t=[]),r===void 0&&(r=!0);const n=bd(e),s=n===((o=e.ownerDocument)==null?void 0:o.body),l=vt(n);if(s){const i=Kn(l);return t.concat(l,l.visualViewport||[],ka(n)?n:[],i&&r?ha(i):[])}else return t.concat(n,ha(n,[],r))}function Kn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function yd(e){const t=It(e);let r=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const n=er(e),s=n?e.offsetWidth:r,l=n?e.offsetHeight:o,i=eo(r)!==s||eo(o)!==l;return i&&(r=s,o=l),{width:r,height:o,$:i}}function zs(e){return Ot(e)?e:e.contextElement}function Wr(e){const t=zs(e);if(!er(t))return Bt(1);const r=t.getBoundingClientRect(),{width:o,height:n,$:s}=yd(t);let l=(s?eo(r.width):r.width)/o,i=(s?eo(r.height):r.height)/n;return(!l||!Number.isFinite(l))&&(l=1),(!i||!Number.isFinite(i))&&(i=1),{x:l,y:i}}const Ug=Bt(0);function wd(e){const t=vt(e);return!Vs()||!t.visualViewport?Ug:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Hg(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==vt(e)?!1:t}function Sr(e,t,r,o){t===void 0&&(t=!1),r===void 0&&(r=!1);const n=e.getBoundingClientRect(),s=zs(e);let l=Bt(1);t&&(o?Ot(o)&&(l=Wr(o)):l=Wr(e));const i=Hg(s,r,o)?wd(s):Bt(0);let c=(n.left+i.x)/l.x,d=(n.top+i.y)/l.y,m=n.width/l.x,u=n.height/l.y;if(s){const h=vt(s),p=o&&Ot(o)?vt(o):o;let y=h,f=Kn(y);for(;f&&o&&p!==y;){const g=Wr(f),w=f.getBoundingClientRect(),v=It(f),b=w.left+(f.clientLeft+parseFloat(v.paddingLeft))*g.x,j=w.top+(f.clientTop+parseFloat(v.paddingTop))*g.y;c*=g.x,d*=g.y,m*=g.x,u*=g.y,c+=b,d+=j,y=vt(f),f=Kn(y)}}return ro({width:m,height:u,x:c,y:d})}function To(e,t){const r=_o(e).scrollLeft;return t?t.left+r:Sr(Ht(e)).left+r}function jd(e,t){const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-To(e,r),n=r.top+t.scrollTop;return{x:o,y:n}}function Wg(e){let{elements:t,rect:r,offsetParent:o,strategy:n}=e;const s=n==="fixed",l=Ht(o),i=t?Ao(t.floating):!1;if(o===l||i&&s)return r;let c={scrollLeft:0,scrollTop:0},d=Bt(1);const m=Bt(0),u=er(o);if((u||!u&&!s)&&((ta(o)!=="body"||ka(l))&&(c=_o(o)),u)){const p=Sr(o);d=Wr(o),m.x=p.x+o.clientLeft,m.y=p.y+o.clientTop}const h=l&&!u&&!s?jd(l,c):Bt(0);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-c.scrollLeft*d.x+m.x+h.x,y:r.y*d.y-c.scrollTop*d.y+m.y+h.y}}function qg(e){return Array.from(e.getClientRects())}function Xg(e){const t=Ht(e),r=_o(e),o=e.ownerDocument.body,n=ht(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),s=ht(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let l=-r.scrollLeft+To(e);const i=-r.scrollTop;return It(o).direction==="rtl"&&(l+=ht(t.clientWidth,o.clientWidth)-n),{width:n,height:s,x:l,y:i}}const ci=25;function Gg(e,t){const r=vt(e),o=Ht(e),n=r.visualViewport;let s=o.clientWidth,l=o.clientHeight,i=0,c=0;if(n){s=n.width,l=n.height;const m=Vs();(!m||m&&t==="fixed")&&(i=n.offsetLeft,c=n.offsetTop)}const d=To(o);if(d<=0){const m=o.ownerDocument,u=m.body,h=getComputedStyle(u),p=m.compatMode==="CSS1Compat"&&parseFloat(h.marginLeft)+parseFloat(h.marginRight)||0,y=Math.abs(o.clientWidth-u.clientWidth-p);y<=ci&&(s-=y)}else d<=ci&&(s+=d);return{width:s,height:l,x:i,y:c}}function Kg(e,t){const r=Sr(e,!0,t==="fixed"),o=r.top+e.clientTop,n=r.left+e.clientLeft,s=er(e)?Wr(e):Bt(1),l=e.clientWidth*s.x,i=e.clientHeight*s.y,c=n*s.x,d=o*s.y;return{width:l,height:i,x:c,y:d}}function di(e,t,r){let o;if(t==="viewport")o=Gg(e,r);else if(t==="document")o=Xg(Ht(e));else if(Ot(t))o=Kg(t,r);else{const n=wd(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return ro(o)}function Nd(e,t){const r=mr(e);return r===t||!Ot(r)||Kr(r)?!1:It(r).position==="fixed"||Nd(r,t)}function Yg(e,t){const r=t.get(e);if(r)return r;let o=ha(e,[],!1).filter(i=>Ot(i)&&ta(i)!=="body"),n=null;const s=It(e).position==="fixed";let l=s?mr(e):e;for(;Ot(l)&&!Kr(l);){const i=It(l),c=Ms(l);!c&&i.position==="fixed"&&(n=null),(s?!c&&!n:!c&&i.position==="static"&&n&&(n.position==="absolute"||n.position==="fixed")||ka(l)&&!c&&Nd(e,l))?o=o.filter(d=>d!==l):n=i,l=mr(l)}return t.set(e,o),o}function Zg(e){let{element:t,boundary:r,rootBoundary:o,strategy:n}=e;const s=[...r==="clippingAncestors"?Ao(t)?[]:Yg(t,this._c):[].concat(r),o],l=di(t,s[0],n);let i=l.top,c=l.right,d=l.bottom,m=l.left;for(let u=1;u<s.length;u++){const h=di(t,s[u],n);i=ht(h.top,i),c=ur(h.right,c),d=ur(h.bottom,d),m=ht(h.left,m)}return{width:c-m,height:d-i,x:m,y:i}}function Jg(e){const{width:t,height:r}=yd(e);return{width:t,height:r}}function Qg(e,t,r){const o=er(t),n=Ht(t),s=r==="fixed",l=Sr(e,!0,s,t);let i={scrollLeft:0,scrollTop:0};const c=Bt(0);function d(){c.x=To(n)}if(o||!o&&!s)if((ta(t)!=="body"||ka(n))&&(i=_o(t)),o){const p=Sr(t,!0,s,t);c.x=p.x+t.clientLeft,c.y=p.y+t.clientTop}else n&&d();s&&!o&&n&&d();const m=n&&!o&&!s?jd(n,i):Bt(0),u=l.left+i.scrollLeft-c.x-m.x,h=l.top+i.scrollTop-c.y-m.y;return{x:u,y:h,width:l.width,height:l.height}}function yn(e){return It(e).position==="static"}function ui(e,t){if(!er(e)||It(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Ht(e)===r&&(r=r.ownerDocument.body),r}function Cd(e,t){const r=vt(e);if(Ao(e))return r;if(!er(e)){let n=mr(e);for(;n&&!Kr(n);){if(Ot(n)&&!yn(n))return n;n=mr(n)}return r}let o=ui(e,t);for(;o&&Mg(o)&&yn(o);)o=ui(o,t);return o&&Kr(o)&&yn(o)&&!Ms(o)?r:o||Bg(e)||r}const ev=async function(e){const t=this.getOffsetParent||Cd,r=this.getDimensions,o=await r(e.floating);return{reference:Qg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function tv(e){return It(e).direction==="rtl"}const rv={convertOffsetParentRelativeRectToViewportRelativeRect:Wg,getDocumentElement:Ht,getClippingRect:Zg,getOffsetParent:Cd,getElementRects:ev,getClientRects:qg,getDimensions:Jg,getScale:Wr,isElement:Ot,isRTL:tv};function kd(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function av(e,t){let r=null,o;const n=Ht(e);function s(){var i;clearTimeout(o),(i=r)==null||i.disconnect(),r=null}function l(i,c){i===void 0&&(i=!1),c===void 0&&(c=1),s();const d=e.getBoundingClientRect(),{left:m,top:u,width:h,height:p}=d;if(i||t(),!h||!p)return;const y=Ia(u),f=Ia(n.clientWidth-(m+h)),g=Ia(n.clientHeight-(u+p)),w=Ia(m),v={rootMargin:-y+"px "+-f+"px "+-g+"px "+-w+"px",threshold:ht(0,ur(1,c))||1};let b=!0;function j(N){const S=N[0].intersectionRatio;if(S!==c){if(!b)return l();S?l(!1,S):o=setTimeout(()=>{l(!1,1e-7)},1e3)}S===1&&!kd(d,e.getBoundingClientRect())&&l(),b=!1}try{r=new IntersectionObserver(j,{...v,root:n.ownerDocument})}catch{r=new IntersectionObserver(j,v)}r.observe(e)}return l(!0),s}function ov(e,t,r,o){o===void 0&&(o={});const{ancestorScroll:n=!0,ancestorResize:s=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:c=!1}=o,d=zs(e),m=n||s?[...d?ha(d):[],...t?ha(t):[]]:[];m.forEach(w=>{n&&w.addEventListener("scroll",r,{passive:!0}),s&&w.addEventListener("resize",r)});const u=d&&i?av(d,r):null;let h=-1,p=null;l&&(p=new ResizeObserver(w=>{let[v]=w;v&&v.target===d&&p&&t&&(p.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var b;(b=p)==null||b.observe(t)})),r()}),d&&!c&&p.observe(d),t&&p.observe(t));let y,f=c?Sr(e):null;c&&g();function g(){const w=Sr(e);f&&!kd(f,w)&&r(),f=w,y=requestAnimationFrame(g)}return r(),()=>{var w;m.forEach(v=>{n&&v.removeEventListener("scroll",r),s&&v.removeEventListener("resize",r)}),u==null||u(),(w=p)==null||w.disconnect(),p=null,c&&cancelAnimationFrame(y)}}const nv=Og,sv=Ig,lv=Rg,iv=Lg,cv=Dg,mi=Tg,dv=Fg,uv=(e,t,r)=>{const o=new Map,n={platform:rv,...r},s={...n.platform,_c:o};return _g(e,t,{...n,platform:s})};var mv=typeof document<"u",pv=function(){},Ka=mv?k.useLayoutEffect:pv;function ao(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,o,n;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(o=r;o--!==0;)if(!ao(e[o],t[o]))return!1;return!0}if(n=Object.keys(e),r=n.length,r!==Object.keys(t).length)return!1;for(o=r;o--!==0;)if(!{}.hasOwnProperty.call(t,n[o]))return!1;for(o=r;o--!==0;){const s=n[o];if(!(s==="_owner"&&e.$$typeof)&&!ao(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Sd(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pi(e,t){const r=Sd(e);return Math.round(t*r)/r}function wn(e){const t=x.useRef(e);return Ka(()=>{t.current=e}),t}function fv(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:o=[],platform:n,elements:{reference:s,floating:l}={},transform:i=!0,whileElementsMounted:c,open:d}=e,[m,u]=x.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[h,p]=x.useState(o);ao(h,o)||p(o);const[y,f]=x.useState(null),[g,w]=x.useState(null),v=x.useCallback(V=>{V!==S.current&&(S.current=V,f(V))},[]),b=x.useCallback(V=>{V!==$.current&&($.current=V,w(V))},[]),j=s||y,N=l||g,S=x.useRef(null),$=x.useRef(null),C=x.useRef(m),E=c!=null,A=wn(c),I=wn(n),M=wn(d),T=x.useCallback(()=>{if(!S.current||!$.current)return;const V={placement:t,strategy:r,middleware:h};I.current&&(V.platform=I.current),uv(S.current,$.current,V).then(L=>{const P={...L,isPositioned:M.current!==!1};B.current&&!ao(C.current,P)&&(C.current=P,bo.flushSync(()=>{u(P)}))})},[h,t,r,I,M]);Ka(()=>{d===!1&&C.current.isPositioned&&(C.current.isPositioned=!1,u(V=>({...V,isPositioned:!1})))},[d]);const B=x.useRef(!1);Ka(()=>(B.current=!0,()=>{B.current=!1}),[]),Ka(()=>{if(j&&(S.current=j),N&&($.current=N),j&&N){if(A.current)return A.current(j,N,T);T()}},[j,N,T,A,E]);const q=x.useMemo(()=>({reference:S,floating:$,setReference:v,setFloating:b}),[v,b]),W=x.useMemo(()=>({reference:j,floating:N}),[j,N]),X=x.useMemo(()=>{const V={position:r,left:0,top:0};if(!W.floating)return V;const L=pi(W.floating,m.x),P=pi(W.floating,m.y);return i?{...V,transform:"translate("+L+"px, "+P+"px)",...Sd(W.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:L,top:P}},[r,i,W.floating,m.x,m.y]);return x.useMemo(()=>({...m,update:T,refs:q,elements:W,floatingStyles:X}),[m,T,q,W,X])}const hv=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:o,padding:n}=typeof e=="function"?e(r):e;return o&&t(o)?o.current!=null?mi({element:o.current,padding:n}).fn(r):{}:o?mi({element:o,padding:n}).fn(r):{}}}},xv=(e,t)=>{const r=nv(e);return{name:r.name,fn:r.fn,options:[e,t]}},gv=(e,t)=>{const r=sv(e);return{name:r.name,fn:r.fn,options:[e,t]}},vv=(e,t)=>({fn:dv(e).fn,options:[e,t]}),bv=(e,t)=>{const r=lv(e);return{name:r.name,fn:r.fn,options:[e,t]}},yv=(e,t)=>{const r=iv(e);return{name:r.name,fn:r.fn,options:[e,t]}},wv=(e,t)=>{const r=cv(e);return{name:r.name,fn:r.fn,options:[e,t]}},jv=(e,t)=>{const r=hv(e);return{name:r.name,fn:r.fn,options:[e,t]}};var Nv="Arrow",$d=x.forwardRef((e,t)=>{const{children:r,width:o=10,height:n=5,...s}=e;return a.jsx(be.svg,{...s,ref:t,width:o,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});$d.displayName=Nv;var Cv=$d,Bs="Popper",[Ed,ra]=jt(Bs),[kv,Ad]=Ed(Bs),_d=e=>{const{__scopePopper:t,children:r}=e,[o,n]=x.useState(null);return a.jsx(kv,{scope:t,anchor:o,onAnchorChange:n,children:r})};_d.displayName=Bs;var Td="PopperAnchor",Rd=x.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:o,...n}=e,s=Ad(Td,r),l=x.useRef(null),i=je(t,l),c=x.useRef(null);return x.useEffect(()=>{const d=c.current;c.current=(o==null?void 0:o.current)||l.current,d!==c.current&&s.onAnchorChange(c.current)}),o?null:a.jsx(be.div,{...n,ref:i})});Rd.displayName=Td;var Us="PopperContent",[Sv,$v]=Ed(Us),Dd=x.forwardRef((e,t)=>{var r,o,n,s,l,i;const{__scopePopper:c,side:d="bottom",sideOffset:m=0,align:u="center",alignOffset:h=0,arrowPadding:p=0,avoidCollisions:y=!0,collisionBoundary:f=[],collisionPadding:g=0,sticky:w="partial",hideWhenDetached:v=!1,updatePositionStrategy:b="optimized",onPlaced:j,...N}=e,S=Ad(Us,c),[$,C]=x.useState(null),E=je(t,Ne=>C(Ne)),[A,I]=x.useState(null),M=wa(A),T=(M==null?void 0:M.width)??0,B=(M==null?void 0:M.height)??0,q=d+(u!=="center"?"-"+u:""),W=typeof g=="number"?g:{top:0,right:0,bottom:0,left:0,...g},X=Array.isArray(f)?f:[f],V=X.length>0,L={padding:W,boundary:X.filter(Av),altBoundary:V},{refs:P,floatingStyles:se,placement:U,isPositioned:Q,middlewareData:ee}=fv({strategy:"fixed",placement:q,whileElementsMounted:(...Ne)=>ov(...Ne,{animationFrame:b==="always"}),elements:{reference:S.anchor},middleware:[xv({mainAxis:m+B,alignmentAxis:h}),y&&gv({mainAxis:!0,crossAxis:!1,limiter:w==="partial"?vv():void 0,...L}),y&&bv({...L}),yv({...L,apply:({elements:Ne,rects:ye,availableWidth:Be,availableHeight:Ue})=>{const{width:Je,height:qt}=ye.reference,rt=Ne.floating.style;rt.setProperty("--radix-popper-available-width",`${Be}px`),rt.setProperty("--radix-popper-available-height",`${Ue}px`),rt.setProperty("--radix-popper-anchor-width",`${Je}px`),rt.setProperty("--radix-popper-anchor-height",`${qt}px`)}}),A&&jv({element:A,padding:p}),_v({arrowWidth:T,arrowHeight:B}),v&&wv({strategy:"referenceHidden",...L})]}),[H,K]=Id(U),G=ot(j);et(()=>{Q&&(G==null||G())},[Q,G]);const Y=(r=ee.arrow)==null?void 0:r.x,Z=(o=ee.arrow)==null?void 0:o.y,te=((n=ee.arrow)==null?void 0:n.centerOffset)!==0,[ue,ve]=x.useState();return et(()=>{$&&ve(window.getComputedStyle($).zIndex)},[$]),a.jsx("div",{ref:P.setFloating,"data-radix-popper-content-wrapper":"",style:{...se,transform:Q?se.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ue,"--radix-popper-transform-origin":[(s=ee.transformOrigin)==null?void 0:s.x,(l=ee.transformOrigin)==null?void 0:l.y].join(" "),...((i=ee.hide)==null?void 0:i.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:a.jsx(Sv,{scope:c,placedSide:H,onArrowChange:I,arrowX:Y,arrowY:Z,shouldHideArrow:te,children:a.jsx(be.div,{"data-side":H,"data-align":K,...N,ref:E,style:{...N.style,animation:Q?void 0:"none"}})})})});Dd.displayName=Us;var Pd="PopperArrow",Ev={top:"bottom",right:"left",bottom:"top",left:"right"},Od=x.forwardRef(function(e,t){const{__scopePopper:r,...o}=e,n=$v(Pd,r),s=Ev[n.placedSide];return a.jsx("span",{ref:n.onArrowChange,style:{position:"absolute",left:n.arrowX,top:n.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[n.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[n.placedSide],visibility:n.shouldHideArrow?"hidden":void 0},children:a.jsx(Cv,{...o,ref:t,style:{...o.style,display:"block"}})})});Od.displayName=Pd;function Av(e){return e!==null}var _v=e=>({name:"transformOrigin",options:e,fn(t){var r,o,n;const{placement:s,rects:l,middlewareData:i}=t,c=((r=i.arrow)==null?void 0:r.centerOffset)!==0,d=c?0:e.arrowWidth,m=c?0:e.arrowHeight,[u,h]=Id(s),p={start:"0%",center:"50%",end:"100%"}[h],y=(((o=i.arrow)==null?void 0:o.x)??0)+d/2,f=(((n=i.arrow)==null?void 0:n.y)??0)+m/2;let g="",w="";return u==="bottom"?(g=c?p:`${y}px`,w=`${-m}px`):u==="top"?(g=c?p:`${y}px`,w=`${l.floating.height+m}px`):u==="right"?(g=`${-m}px`,w=c?p:`${f}px`):u==="left"&&(g=`${l.floating.width+m}px`,w=c?p:`${f}px`),{data:{x:g,y:w}}}});function Id(e){const[t,r="center"]=e.split("-");return[t,r]}var Hs=_d,Ro=Rd,Ws=Dd,qs=Od,Tv="Portal",Do=x.forwardRef((e,t)=>{var r;const{container:o,...n}=e,[s,l]=x.useState(!1);et(()=>l(!0),[]);const i=o||s&&((r=globalThis==null?void 0:globalThis.document)==null?void 0:r.body);return i?vs.createPortal(a.jsx(be.div,{...n,ref:t}),i):null});Do.displayName=Tv;var Fd=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Rv="VisuallyHidden",Ld=x.forwardRef((e,t)=>a.jsx(be.span,{...e,ref:t,style:{...Fd,...e.style}}));Ld.displayName=Rv;var Dv=Ld,Pv=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Or=new WeakMap,Fa=new WeakMap,La={},jn=0,Md=function(e){return e&&(e.host||Md(e.parentNode))},Ov=function(e,t){return t.map(function(r){if(e.contains(r))return r;var o=Md(r);return o&&e.contains(o)?o:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Iv=function(e,t,r,o){var n=Ov(t,Array.isArray(e)?e:[e]);La[r]||(La[r]=new WeakMap);var s=La[r],l=[],i=new Set,c=new Set(n),d=function(u){!u||i.has(u)||(i.add(u),d(u.parentNode))};n.forEach(d);var m=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(h){if(i.has(h))m(h);else try{var p=h.getAttribute(o),y=p!==null&&p!=="false",f=(Or.get(h)||0)+1,g=(s.get(h)||0)+1;Or.set(h,f),s.set(h,g),l.push(h),f===1&&y&&Fa.set(h,!0),g===1&&h.setAttribute(r,"true"),y||h.setAttribute(o,"true")}catch(w){console.error("aria-hidden: cannot operate on ",h,w)}})};return m(t),i.clear(),jn++,function(){l.forEach(function(u){var h=Or.get(u)-1,p=s.get(u)-1;Or.set(u,h),s.set(u,p),h||(Fa.has(u)||u.removeAttribute(o),Fa.delete(u)),p||u.removeAttribute(r)}),jn--,jn||(Or=new WeakMap,Or=new WeakMap,Fa=new WeakMap,La={})}},Xs=function(e,t,r){r===void 0&&(r="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),n=Pv(e);return n?(o.push.apply(o,Array.from(n.querySelectorAll("[aria-live], script"))),Iv(o,n,r,"aria-hidden")):function(){return null}},Vt=function(){return Vt=Object.assign||function(e){for(var t,r=1,o=arguments.length;r<o;r++){t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e},Vt.apply(this,arguments)};function Vd(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]]);return r}function Fv(e,t,r){for(var o=0,n=t.length,s;o<n;o++)(s||!(o in t))&&(s||(s=Array.prototype.slice.call(t,0,o)),s[o]=t[o]);return e.concat(s||Array.prototype.slice.call(t))}var Ya="right-scroll-bar-position",Za="width-before-scroll-bar",Lv="with-scroll-bars-hidden",Mv="--removed-body-scroll-bar-size";function Nn(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Vv(e,t){var r=k.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(o){var n=r.value;n!==o&&(r.value=o,r.callback(o,n))}}}})[0];return r.callback=t,r.facade}var zv=typeof window<"u"?x.useLayoutEffect:x.useEffect,fi=new WeakMap;function Bv(e,t){var r=Vv(null,function(o){return e.forEach(function(n){return Nn(n,o)})});return zv(function(){var o=fi.get(r);if(o){var n=new Set(o),s=new Set(e),l=r.current;n.forEach(function(i){s.has(i)||Nn(i,null)}),s.forEach(function(i){n.has(i)||Nn(i,l)})}fi.set(r,e)},[e]),r}function Uv(e){return e}function Hv(e,t){t===void 0&&(t=Uv);var r=[],o=!1,n={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(s){var l=t(s,o);return r.push(l),function(){r=r.filter(function(i){return i!==l})}},assignSyncMedium:function(s){for(o=!0;r.length;){var l=r;r=[],l.forEach(s)}r={push:function(i){return s(i)},filter:function(){return r}}},assignMedium:function(s){o=!0;var l=[];if(r.length){var i=r;r=[],i.forEach(s),l=r}var c=function(){var m=l;l=[],m.forEach(s)},d=function(){return Promise.resolve().then(c)};d(),r={push:function(m){l.push(m),d()},filter:function(m){return l=l.filter(m),r}}}};return n}function Wv(e){e===void 0&&(e={});var t=Hv(null);return t.options=Vt({async:!0,ssr:!1},e),t}var zd=function(e){var t=e.sideCar,r=Vd(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=t.read();if(!o)throw new Error("Sidecar medium not found");return x.createElement(o,Vt({},r))};zd.isSideCarExport=!0;function qv(e,t){return e.useMedium(t),zd}var Bd=Wv(),Cn=function(){},Po=x.forwardRef(function(e,t){var r=x.useRef(null),o=x.useState({onScrollCapture:Cn,onWheelCapture:Cn,onTouchMoveCapture:Cn}),n=o[0],s=o[1],l=e.forwardProps,i=e.children,c=e.className,d=e.removeScrollBar,m=e.enabled,u=e.shards,h=e.sideCar,p=e.noRelative,y=e.noIsolation,f=e.inert,g=e.allowPinchZoom,w=e.as,v=w===void 0?"div":w,b=e.gapMode,j=Vd(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),N=h,S=Bv([r,t]),$=Vt(Vt({},j),n);return x.createElement(x.Fragment,null,m&&x.createElement(N,{sideCar:Bd,removeScrollBar:d,shards:u,noRelative:p,noIsolation:y,inert:f,setCallbacks:s,allowPinchZoom:!!g,lockRef:r,gapMode:b}),l?x.cloneElement(x.Children.only(i),Vt(Vt({},$),{ref:S})):x.createElement(v,Vt({},$,{className:c,ref:S}),i))});Po.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Po.classNames={fullWidth:Za,zeroRight:Ya};var Xv=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Gv(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Xv();return t&&e.setAttribute("nonce",t),e}function Kv(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Yv(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Zv=function(){var e=0,t=null;return{add:function(r){e==0&&(t=Gv())&&(Kv(t,r),Yv(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Jv=function(){var e=Zv();return function(t,r){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Ud=function(){var e=Jv(),t=function(r){var o=r.styles,n=r.dynamic;return e(o,n),null};return t},Qv={left:0,top:0,right:0,gap:0},kn=function(e){return parseInt(e||"",10)||0},eb=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],o=t[e==="padding"?"paddingTop":"marginTop"],n=t[e==="padding"?"paddingRight":"marginRight"];return[kn(r),kn(o),kn(n)]},tb=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Qv;var t=eb(e),r=document.documentElement.clientWidth,o=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,o-r+t[2]-t[0])}},rb=Ud(),qr="data-scroll-locked",ab=function(e,t,r,o){var n=e.left,s=e.top,l=e.right,i=e.gap;return r===void 0&&(r="margin"),`
31
+ .`.concat(Lv,` {
32
+ overflow: hidden `).concat(o,`;
33
+ padding-right: `).concat(i,"px ").concat(o,`;
36
34
  }
37
- body[`).concat(tr,`] {
38
- overflow: hidden `).concat(a,`;
35
+ body[`).concat(qr,`] {
36
+ overflow: hidden `).concat(o,`;
39
37
  overscroll-behavior: contain;
40
- `).concat([t&&"position: relative ".concat(a,";"),r==="margin"&&`
38
+ `).concat([t&&"position: relative ".concat(o,";"),r==="margin"&&`
41
39
  padding-left: `.concat(n,`px;
42
40
  padding-top: `).concat(s,`px;
43
- padding-right: `).concat(i,`px;
41
+ padding-right: `).concat(l,`px;
44
42
  margin-left:0;
45
43
  margin-top:0;
46
- margin-right: `).concat(l,"px ").concat(a,`;
47
- `),r==="padding"&&"padding-right: ".concat(l,"px ").concat(a,";")].filter(Boolean).join(""),`
44
+ margin-right: `).concat(i,"px ").concat(o,`;
45
+ `),r==="padding"&&"padding-right: ".concat(i,"px ").concat(o,";")].filter(Boolean).join(""),`
48
46
  }
49
47
 
50
- .`).concat(Zr,` {
51
- right: `).concat(l,"px ").concat(a,`;
48
+ .`).concat(Ya,` {
49
+ right: `).concat(i,"px ").concat(o,`;
52
50
  }
53
51
 
54
- .`).concat(Xr,` {
55
- margin-right: `).concat(l,"px ").concat(a,`;
52
+ .`).concat(Za,` {
53
+ margin-right: `).concat(i,"px ").concat(o,`;
56
54
  }
57
55
 
58
- .`).concat(Zr," .").concat(Zr,` {
59
- right: 0 `).concat(a,`;
56
+ .`).concat(Ya," .").concat(Ya,` {
57
+ right: 0 `).concat(o,`;
60
58
  }
61
59
 
62
- .`).concat(Xr," .").concat(Xr,` {
63
- margin-right: 0 `).concat(a,`;
60
+ .`).concat(Za," .").concat(Za,` {
61
+ margin-right: 0 `).concat(o,`;
64
62
  }
65
63
 
66
- body[`).concat(tr,`] {
67
- `).concat(lg,": ").concat(l,`px;
64
+ body[`).concat(qr,`] {
65
+ `).concat(Mv,": ").concat(i,`px;
68
66
  }
69
- `)},Ws=function(){var e=parseInt(document.body.getAttribute(tr)||"0",10);return isFinite(e)?e:0},_g=function(){h.useEffect(function(){return document.body.setAttribute(tr,(Ws()+1).toString()),function(){var e=Ws()-1;e<=0?document.body.removeAttribute(tr):document.body.setAttribute(tr,e.toString())}},[])},Eg=function(e){var t=e.noRelative,r=e.noImportant,a=e.gapMode,n=a===void 0?"margin":a;_g();var s=h.useMemo(function(){return Cg(n)},[n]);return h.createElement(Sg,{styles:kg(s,!t,n,r?"":"!important")})},Co=!1;if(typeof window<"u")try{var Vr=Object.defineProperty({},"passive",{get:function(){return Co=!0,!0}});window.addEventListener("test",Vr,Vr),window.removeEventListener("test",Vr,Vr)}catch{Co=!1}var Gt=Co?{passive:!1}:!1,Pg=function(e){return e.tagName==="TEXTAREA"},ec=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!Pg(e)&&r[t]==="visible")},Tg=function(e){return ec(e,"overflowY")},$g=function(e){return ec(e,"overflowX")},qs=function(e,t){var r=t.ownerDocument,a=t;do{typeof ShadowRoot<"u"&&a instanceof ShadowRoot&&(a=a.host);var n=tc(e,a);if(n){var s=rc(e,a),i=s[1],l=s[2];if(i>l)return!0}a=a.parentNode}while(a&&a!==r.body);return!1},Rg=function(e){var t=e.scrollTop,r=e.scrollHeight,a=e.clientHeight;return[t,r,a]},Og=function(e){var t=e.scrollLeft,r=e.scrollWidth,a=e.clientWidth;return[t,r,a]},tc=function(e,t){return e==="v"?Tg(t):$g(t)},rc=function(e,t){return e==="v"?Rg(t):Og(t)},Dg=function(e,t){return e==="h"&&t==="rtl"?-1:1},Ag=function(e,t,r,a,n){var s=Dg(e,window.getComputedStyle(t).direction),i=s*a,l=r.target,c=t.contains(l),d=!1,u=i>0,p=0,m=0;do{if(!l)break;var x=rc(e,l),g=x[0],f=x[1],v=x[2],b=f-v-s*g;(g||b)&&tc(e,l)&&(p+=b,m+=g);var j=l.parentNode;l=j&&j.nodeType===Node.DOCUMENT_FRAGMENT_NODE?j.host:j}while(!c&&l!==document.body||c&&(t.contains(l)||t===l));return(u&&Math.abs(p)<1||!u&&Math.abs(m)<1)&&(d=!0),d},Br=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Zs=function(e){return[e.deltaX,e.deltaY]},Xs=function(e){return e&&"current"in e?e.current:e},Ig=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Lg=function(e){return`
67
+ `)},hi=function(){var e=parseInt(document.body.getAttribute(qr)||"0",10);return isFinite(e)?e:0},ob=function(){x.useEffect(function(){return document.body.setAttribute(qr,(hi()+1).toString()),function(){var e=hi()-1;e<=0?document.body.removeAttribute(qr):document.body.setAttribute(qr,e.toString())}},[])},nb=function(e){var t=e.noRelative,r=e.noImportant,o=e.gapMode,n=o===void 0?"margin":o;ob();var s=x.useMemo(function(){return tb(n)},[n]);return x.createElement(rb,{styles:ab(s,!t,n,r?"":"!important")})},Yn=!1;if(typeof window<"u")try{var Ma=Object.defineProperty({},"passive",{get:function(){return Yn=!0,!0}});window.addEventListener("test",Ma,Ma),window.removeEventListener("test",Ma,Ma)}catch{Yn=!1}var Ir=Yn?{passive:!1}:!1,sb=function(e){return e.tagName==="TEXTAREA"},Hd=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!sb(e)&&r[t]==="visible")},lb=function(e){return Hd(e,"overflowY")},ib=function(e){return Hd(e,"overflowX")},xi=function(e,t){var r=t.ownerDocument,o=t;do{typeof ShadowRoot<"u"&&o instanceof ShadowRoot&&(o=o.host);var n=Wd(e,o);if(n){var s=qd(e,o),l=s[1],i=s[2];if(l>i)return!0}o=o.parentNode}while(o&&o!==r.body);return!1},cb=function(e){var t=e.scrollTop,r=e.scrollHeight,o=e.clientHeight;return[t,r,o]},db=function(e){var t=e.scrollLeft,r=e.scrollWidth,o=e.clientWidth;return[t,r,o]},Wd=function(e,t){return e==="v"?lb(t):ib(t)},qd=function(e,t){return e==="v"?cb(t):db(t)},ub=function(e,t){return e==="h"&&t==="rtl"?-1:1},mb=function(e,t,r,o,n){var s=ub(e,window.getComputedStyle(t).direction),l=s*o,i=r.target,c=t.contains(i),d=!1,m=l>0,u=0,h=0;do{if(!i)break;var p=qd(e,i),y=p[0],f=p[1],g=p[2],w=f-g-s*y;(y||w)&&Wd(e,i)&&(u+=w,h+=y);var v=i.parentNode;i=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!c&&i!==document.body||c&&(t.contains(i)||t===i));return(m&&Math.abs(u)<1||!m&&Math.abs(h)<1)&&(d=!0),d},Va=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},gi=function(e){return[e.deltaX,e.deltaY]},vi=function(e){return e&&"current"in e?e.current:e},pb=function(e,t){return e[0]===t[0]&&e[1]===t[1]},fb=function(e){return`
70
68
  .block-interactivity-`.concat(e,` {pointer-events: none;}
71
69
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
72
- `)},zg=0,Yt=[];function Mg(e){var t=h.useRef([]),r=h.useRef([0,0]),a=h.useRef(),n=h.useState(zg++)[0],s=h.useState(Ql)[0],i=h.useRef(e);h.useEffect(function(){i.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(n));var f=sg([e.lockRef.current],(e.shards||[]).map(Xs)).filter(Boolean);return f.forEach(function(v){return v.classList.add("allow-interactivity-".concat(n))}),function(){document.body.classList.remove("block-interactivity-".concat(n)),f.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(n))})}}},[e.inert,e.lockRef.current,e.shards]);var l=h.useCallback(function(f,v){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!i.current.allowPinchZoom;var b=Br(f),j=r.current,y="deltaX"in f?f.deltaX:j[0]-b[0],N="deltaY"in f?f.deltaY:j[1]-b[1],C,k=f.target,_=Math.abs(y)>Math.abs(N)?"h":"v";if("touches"in f&&_==="h"&&k.type==="range")return!1;var w=window.getSelection(),R=w&&w.anchorNode,A=R?R===k||R.contains(k):!1;if(A)return!1;var I=qs(_,k);if(!I)return!0;if(I?C=_:(C=_==="v"?"h":"v",I=qs(_,k)),!I)return!1;if(!a.current&&"changedTouches"in f&&(y||N)&&(a.current=C),!C)return!0;var F=a.current||C;return Ag(F,v,f,F==="h"?y:N)},[]),c=h.useCallback(function(f){var v=f;if(!(!Yt.length||Yt[Yt.length-1]!==s)){var b="deltaY"in v?Zs(v):Br(v),j=t.current.filter(function(C){return C.name===v.type&&(C.target===v.target||v.target===C.shadowParent)&&Ig(C.delta,b)})[0];if(j&&j.should){v.cancelable&&v.preventDefault();return}if(!j){var y=(i.current.shards||[]).map(Xs).filter(Boolean).filter(function(C){return C.contains(v.target)}),N=y.length>0?l(v,y[0]):!i.current.noIsolation;N&&v.cancelable&&v.preventDefault()}}},[]),d=h.useCallback(function(f,v,b,j){var y={name:f,delta:v,target:b,should:j,shadowParent:Fg(b)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(N){return N!==y})},1)},[]),u=h.useCallback(function(f){r.current=Br(f),a.current=void 0},[]),p=h.useCallback(function(f){d(f.type,Zs(f),f.target,l(f,e.lockRef.current))},[]),m=h.useCallback(function(f){d(f.type,Br(f),f.target,l(f,e.lockRef.current))},[]);h.useEffect(function(){return Yt.push(s),e.setCallbacks({onScrollCapture:p,onWheelCapture:p,onTouchMoveCapture:m}),document.addEventListener("wheel",c,Gt),document.addEventListener("touchmove",c,Gt),document.addEventListener("touchstart",u,Gt),function(){Yt=Yt.filter(function(f){return f!==s}),document.removeEventListener("wheel",c,Gt),document.removeEventListener("touchmove",c,Gt),document.removeEventListener("touchstart",u,Gt)}},[]);var x=e.removeScrollBar,g=e.inert;return h.createElement(h.Fragment,null,g?h.createElement(s,{styles:Lg(n)}):null,x?h.createElement(Eg,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Fg(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Vg=hg(Jl,Mg);var Ea=h.forwardRef(function(e,t){return h.createElement(_a,st({},e,{ref:t,sideCar:Vg}))});Ea.classNames=_a.classNames;var Bg=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Kt=new WeakMap,Ur=new WeakMap,Hr={},uo=0,ac=function(e){return e&&(e.host||ac(e.parentNode))},Ug=function(e,t){return t.map(function(r){if(e.contains(r))return r;var a=ac(r);return a&&e.contains(a)?a:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},Hg=function(e,t,r,a){var n=Ug(t,Array.isArray(e)?e:[e]);Hr[r]||(Hr[r]=new WeakMap);var s=Hr[r],i=[],l=new Set,c=new Set(n),d=function(p){!p||l.has(p)||(l.add(p),d(p.parentNode))};n.forEach(d);var u=function(p){!p||c.has(p)||Array.prototype.forEach.call(p.children,function(m){if(l.has(m))u(m);else try{var x=m.getAttribute(a),g=x!==null&&x!=="false",f=(Kt.get(m)||0)+1,v=(s.get(m)||0)+1;Kt.set(m,f),s.set(m,v),i.push(m),f===1&&g&&Ur.set(m,!0),v===1&&m.setAttribute(r,"true"),g||m.setAttribute(a,"true")}catch(b){console.error("aria-hidden: cannot operate on ",m,b)}})};return u(t),l.clear(),uo++,function(){i.forEach(function(p){var m=Kt.get(p)-1,x=s.get(p)-1;Kt.set(p,m),s.set(p,x),m||(Ur.has(p)||p.removeAttribute(a),Ur.delete(p)),x||p.removeAttribute(r)}),uo--,uo||(Kt=new WeakMap,Kt=new WeakMap,Ur=new WeakMap,Hr={})}},yn=function(e,t,r){r===void 0&&(r="data-aria-hidden");var a=Array.from(Array.isArray(e)?e:[e]),n=Bg(e);return n?(a.push.apply(a,Array.from(n.querySelectorAll("[aria-live], script"))),Hg(a,n,r,"aria-hidden")):function(){return null}},Pa="Dialog",[oc]=bt(Pa),[Wg,nt]=oc(Pa),nc=e=>{const{__scopeDialog:t,children:r,open:a,defaultOpen:n,onOpenChange:s,modal:i=!0}=e,l=h.useRef(null),c=h.useRef(null),[d,u]=Vt({prop:a,defaultProp:n??!1,onChange:s,caller:Pa});return o.jsx(Wg,{scope:t,triggerRef:l,contentRef:c,contentId:_t(),titleId:_t(),descriptionId:_t(),open:d,onOpenChange:u,onOpenToggle:h.useCallback(()=>u(p=>!p),[u]),modal:i,children:r})};nc.displayName=Pa;var sc="DialogTrigger",qg=h.forwardRef((e,t)=>{const{__scopeDialog:r,...a}=e,n=nt(sc,r),s=pe(t,n.triggerRef);return o.jsx(le.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":Nn(n.open),...a,ref:s,onClick:oe(e.onClick,n.onOpenToggle)})});qg.displayName=sc;var wn="DialogPortal",[Zg,ic]=oc(wn,{forceMount:void 0}),lc=e=>{const{__scopeDialog:t,forceMount:r,children:a,container:n}=e,s=nt(wn,t);return o.jsx(Zg,{scope:t,forceMount:r,children:h.Children.map(a,i=>o.jsx(Qe,{present:r||s.open,children:o.jsx(ka,{asChild:!0,container:n,children:i})}))})};lc.displayName=wn;var ta="DialogOverlay",cc=h.forwardRef((e,t)=>{const r=ic(ta,e.__scopeDialog),{forceMount:a=r.forceMount,...n}=e,s=nt(ta,e.__scopeDialog);return s.modal?o.jsx(Qe,{present:a||s.open,children:o.jsx(Gg,{...n,ref:t})}):null});cc.displayName=ta;var Xg=or("DialogOverlay.RemoveScroll"),Gg=h.forwardRef((e,t)=>{const{__scopeDialog:r,...a}=e,n=nt(ta,r);return o.jsx(Ea,{as:Xg,allowPinchZoom:!0,shards:[n.contentRef],children:o.jsx(le.div,{"data-state":Nn(n.open),...a,ref:t,style:{pointerEvents:"auto",...a.style}})})}),Bt="DialogContent",dc=h.forwardRef((e,t)=>{const r=ic(Bt,e.__scopeDialog),{forceMount:a=r.forceMount,...n}=e,s=nt(Bt,e.__scopeDialog);return o.jsx(Qe,{present:a||s.open,children:s.modal?o.jsx(Yg,{...n,ref:t}):o.jsx(Kg,{...n,ref:t})})});dc.displayName=Bt;var Yg=h.forwardRef((e,t)=>{const r=nt(Bt,e.__scopeDialog),a=h.useRef(null),n=pe(t,r.contentRef,a);return h.useEffect(()=>{const s=a.current;if(s)return yn(s)},[]),o.jsx(uc,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:oe(e.onCloseAutoFocus,s=>{var i;s.preventDefault(),(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:oe(e.onPointerDownOutside,s=>{const i=s.detail.originalEvent,l=i.button===0&&i.ctrlKey===!0;(i.button===2||l)&&s.preventDefault()}),onFocusOutside:oe(e.onFocusOutside,s=>s.preventDefault())})}),Kg=h.forwardRef((e,t)=>{const r=nt(Bt,e.__scopeDialog),a=h.useRef(!1),n=h.useRef(!1);return o.jsx(uc,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(a.current||(l=r.triggerRef.current)==null||l.focus(),s.preventDefault()),a.current=!1,n.current=!1},onInteractOutside:s=>{var i,l;(i=e.onInteractOutside)==null||i.call(e,s),s.defaultPrevented||(a.current=!0,s.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const c=s.target;(l=r.triggerRef.current)!=null&&l.contains(c)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&n.current&&s.preventDefault()}})}),uc=h.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:a,onOpenAutoFocus:n,onCloseAutoFocus:s,...i}=e,l=nt(Bt,r),c=h.useRef(null),d=pe(t,c);return bn(),o.jsxs(o.Fragment,{children:[o.jsx(Sa,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:n,onUnmountAutoFocus:s,children:o.jsx(kr,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Nn(l.open),...i,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),o.jsxs(o.Fragment,{children:[o.jsx(Jg,{titleId:l.titleId}),o.jsx(ev,{contentRef:c,descriptionId:l.descriptionId})]})]})}),jn="DialogTitle",pc=h.forwardRef((e,t)=>{const{__scopeDialog:r,...a}=e,n=nt(jn,r);return o.jsx(le.h2,{id:n.titleId,...a,ref:t})});pc.displayName=jn;var mc="DialogDescription",fc=h.forwardRef((e,t)=>{const{__scopeDialog:r,...a}=e,n=nt(mc,r);return o.jsx(le.p,{id:n.descriptionId,...a,ref:t})});fc.displayName=mc;var hc="DialogClose",xc=h.forwardRef((e,t)=>{const{__scopeDialog:r,...a}=e,n=nt(hc,r);return o.jsx(le.button,{type:"button",...a,ref:t,onClick:oe(e.onClick,()=>n.onOpenChange(!1))})});xc.displayName=hc;function Nn(e){return e?"open":"closed"}var gc="DialogTitleWarning",[Y0,vc]=lx(gc,{contentName:Bt,titleName:jn,docsSlug:"dialog"}),Jg=({titleId:e})=>{const t=vc(gc),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
73
-
74
- If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
75
-
76
- For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return h.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Qg="DialogDescriptionWarning",ev=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${vc(Qg).contentName}}.`;return h.useEffect(()=>{var a;const n=(a=e.current)==null?void 0:a.getAttribute("aria-describedby");t&&n&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},tv=nc,rv=lc,bc=cc,yc=dc,wc=pc,jc=fc,av=xc;const ov=tv,nv=rv,Nc=h.forwardRef(({className:e,...t},r)=>o.jsx(bc,{ref:r,className:G("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Nc.displayName=bc.displayName;const Cc=h.forwardRef(({className:e,children:t,...r},a)=>o.jsxs(nv,{children:[o.jsx(Nc,{}),o.jsxs(yc,{ref:a,className:G("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,o.jsxs(av,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[o.jsx(P.X,{className:"h-4 w-4"}),o.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Cc.displayName=yc.displayName;const Sc=({className:e,...t})=>o.jsx("div",{className:G("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Sc.displayName="DialogHeader";const kc=h.forwardRef(({className:e,...t},r)=>o.jsx(wc,{ref:r,className:G("text-lg font-semibold leading-none tracking-tight",e),...t}));kc.displayName=wc.displayName;const _c=h.forwardRef(({className:e,...t},r)=>o.jsx(jc,{ref:r,className:G("text-sm text-muted-foreground",e),...t}));_c.displayName=jc.displayName;function sv(e){if(!e)return null;if(e.includes("-")){const t=e.split("-").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("");return P.icons[t]??null}return P.icons[e]??null}const Gs=Object.entries(P.icons).map(([e,t])=>({name:e,kebab:e.replace(/([A-Z])/g,(r,a,n)=>n===0?a.toLowerCase():`-${a.toLowerCase()}`),component:t})),Ec=({value:e,onChange:t,label:r="Ícone (Lucide)",hideLabel:a=!1,className:n})=>{const[s,i]=E.useState(!1),[l,c]=E.useState(""),d=E.useMemo(()=>sv(e),[e]),u=E.useMemo(()=>{const x=l.toLowerCase();return x?Gs.filter(g=>g.name.toLowerCase().includes(x)||g.kebab.includes(x)):Gs},[l]),p=x=>{t(x),i(!1)},m=x=>{i(x),x||c("")};return o.jsxs("div",{className:`space-y-1 ${n??""}`,children:[!a&&o.jsx(W,{className:"text-xs",children:r}),o.jsx(ye,{type:"button",variant:"outline",className:"w-full h-8 justify-start text-xs font-normal gap-2",onClick:()=>i(!0),children:d?o.jsxs(o.Fragment,{children:[E.createElement(d,{className:"h-3.5 w-3.5 shrink-0"}),o.jsx("span",{className:"truncate",children:e})]}):o.jsx("span",{className:"text-muted-foreground",children:"Selecionar ícone…"})}),o.jsx(ov,{open:s,onOpenChange:m,children:o.jsxs(Cc,{className:"max-w-3xl max-h-[85vh] flex flex-col gap-0 p-0",children:[o.jsxs(Sc,{className:"px-4 pt-4 pb-2 border-b",children:[o.jsx(kc,{children:"Selecionar ícone"}),o.jsx(_c,{children:"Pesquise e clique em um ícone da biblioteca Lucide."})]}),o.jsx("div",{className:"px-4 py-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(P.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),o.jsx(ae,{autoFocus:!0,placeholder:"Buscar ícones…",value:l,onChange:x=>c(x.target.value),className:"pl-8 h-9 text-sm"})]})}),o.jsx(Ca,{className:"flex-1 px-4 py-2",children:o.jsxs("div",{className:"grid grid-cols-5 gap-2 sm:grid-cols-7 md:grid-cols-8 pb-2",children:[o.jsxs(ye,{type:"button",variant:e?"outline":"secondary",className:"flex flex-col items-center justify-center h-20 gap-1 p-1",onClick:()=>p(void 0),children:[o.jsx("div",{className:"h-6 w-6 rounded border-2 border-dashed border-muted-foreground/30"}),o.jsx("span",{className:"text-[10px] leading-tight text-center",children:"Nenhum"})]}),u.map(({name:x,component:g})=>o.jsxs(ye,{type:"button",variant:e===x?"secondary":"outline",className:"flex flex-col items-center justify-center h-20 gap-1 p-1 overflow-hidden",onClick:()=>p(x),children:[E.createElement(g,{size:24}),o.jsx("span",{className:"text-[9px] leading-tight text-center break-all line-clamp-2",children:x})]},x))]})})]})})]})},iv=["top","right","bottom","left"],Et=Math.min,Ve=Math.max,ra=Math.round,Wr=Math.floor,lt=e=>({x:e,y:e}),lv={left:"right",right:"left",bottom:"top",top:"bottom"};function So(e,t,r){return Ve(e,Et(t,r))}function gt(e,t){return typeof e=="function"?e(t):e}function vt(e){return e.split("-")[0]}function ur(e){return e.split("-")[1]}function Cn(e){return e==="x"?"y":"x"}function Sn(e){return e==="y"?"height":"width"}function it(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function kn(e){return Cn(it(e))}function cv(e,t,r){r===void 0&&(r=!1);const a=ur(e),n=kn(e),s=Sn(n);let i=n==="x"?a===(r?"end":"start")?"right":"left":a==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=aa(i)),[i,aa(i)]}function dv(e){const t=aa(e);return[ko(e),t,ko(t)]}function ko(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const Ys=["left","right"],Ks=["right","left"],uv=["top","bottom"],pv=["bottom","top"];function mv(e,t,r){switch(e){case"top":case"bottom":return r?t?Ks:Ys:t?Ys:Ks;case"left":case"right":return t?uv:pv;default:return[]}}function fv(e,t,r,a){const n=ur(e);let s=mv(vt(e),r==="start",a);return n&&(s=s.map(i=>i+"-"+n),t&&(s=s.concat(s.map(ko)))),s}function aa(e){const t=vt(e);return lv[t]+e.slice(t.length)}function hv(e){return{top:0,right:0,bottom:0,left:0,...e}}function Pc(e){return typeof e!="number"?hv(e):{top:e,right:e,bottom:e,left:e}}function oa(e){const{x:t,y:r,width:a,height:n}=e;return{width:a,height:n,top:r,left:t,right:t+a,bottom:r+n,x:t,y:r}}function Js(e,t,r){let{reference:a,floating:n}=e;const s=it(t),i=kn(t),l=Sn(i),c=vt(t),d=s==="y",u=a.x+a.width/2-n.width/2,p=a.y+a.height/2-n.height/2,m=a[l]/2-n[l]/2;let x;switch(c){case"top":x={x:u,y:a.y-n.height};break;case"bottom":x={x:u,y:a.y+a.height};break;case"right":x={x:a.x+a.width,y:p};break;case"left":x={x:a.x-n.width,y:p};break;default:x={x:a.x,y:a.y}}switch(ur(t)){case"start":x[i]-=m*(r&&d?-1:1);break;case"end":x[i]+=m*(r&&d?-1:1);break}return x}async function xv(e,t){var r;t===void 0&&(t={});const{x:a,y:n,platform:s,rects:i,elements:l,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:p="floating",altBoundary:m=!1,padding:x=0}=gt(t,e),g=Pc(x),f=l[m?p==="floating"?"reference":"floating":p],v=oa(await s.getClippingRect({element:(r=await(s.isElement==null?void 0:s.isElement(f)))==null||r?f:f.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:c})),b=p==="floating"?{x:a,y:n,width:i.floating.width,height:i.floating.height}:i.reference,j=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),y=await(s.isElement==null?void 0:s.isElement(j))?await(s.getScale==null?void 0:s.getScale(j))||{x:1,y:1}:{x:1,y:1},N=oa(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:b,offsetParent:j,strategy:c}):b);return{top:(v.top-N.top+g.top)/y.y,bottom:(N.bottom-v.bottom+g.bottom)/y.y,left:(v.left-N.left+g.left)/y.x,right:(N.right-v.right+g.right)/y.x}}const gv=50,vv=async(e,t,r)=>{const{placement:a="bottom",strategy:n="absolute",middleware:s=[],platform:i}=r,l=i.detectOverflow?i:{...i,detectOverflow:xv},c=await(i.isRTL==null?void 0:i.isRTL(t));let d=await i.getElementRects({reference:e,floating:t,strategy:n}),{x:u,y:p}=Js(d,a,c),m=a,x=0;const g={};for(let f=0;f<s.length;f++){const v=s[f];if(!v)continue;const{name:b,fn:j}=v,{x:y,y:N,data:C,reset:k}=await j({x:u,y:p,initialPlacement:a,placement:m,strategy:n,middlewareData:g,rects:d,platform:l,elements:{reference:e,floating:t}});u=y??u,p=N??p,g[b]={...g[b],...C},k&&x<gv&&(x++,typeof k=="object"&&(k.placement&&(m=k.placement),k.rects&&(d=k.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:n}):k.rects),{x:u,y:p}=Js(d,m,c)),f=-1)}return{x:u,y:p,placement:m,strategy:n,middlewareData:g}},bv=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:a,placement:n,rects:s,platform:i,elements:l,middlewareData:c}=t,{element:d,padding:u=0}=gt(e,t)||{};if(d==null)return{};const p=Pc(u),m={x:r,y:a},x=kn(n),g=Sn(x),f=await i.getDimensions(d),v=x==="y",b=v?"top":"left",j=v?"bottom":"right",y=v?"clientHeight":"clientWidth",N=s.reference[g]+s.reference[x]-m[x]-s.floating[g],C=m[x]-s.reference[x],k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(d));let _=k?k[y]:0;(!_||!await(i.isElement==null?void 0:i.isElement(k)))&&(_=l.floating[y]||s.floating[g]);const w=N/2-C/2,R=_/2-f[g]/2-1,A=Et(p[b],R),I=Et(p[j],R),F=A,V=_-f[g]-I,M=_/2-f[g]/2+w,U=So(F,M,V),$=!c.arrow&&ur(n)!=null&&M!==U&&s.reference[g]/2-(M<F?A:I)-f[g]/2<0,T=$?M<F?M-F:M-V:0;return{[x]:m[x]+T,data:{[x]:U,centerOffset:M-U-T,...$&&{alignmentOffset:T}},reset:$}}}),yv=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,a;const{placement:n,middlewareData:s,rects:i,initialPlacement:l,platform:c,elements:d}=t,{mainAxis:u=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:f=!0,...v}=gt(e,t);if((r=s.arrow)!=null&&r.alignmentOffset)return{};const b=vt(n),j=it(l),y=vt(l)===l,N=await(c.isRTL==null?void 0:c.isRTL(d.floating)),C=m||(y||!f?[aa(l)]:dv(l)),k=g!=="none";!m&&k&&C.push(...fv(l,f,g,N));const _=[l,...C],w=await c.detectOverflow(t,v),R=[];let A=((a=s.flip)==null?void 0:a.overflows)||[];if(u&&R.push(w[b]),p){const M=cv(n,i,N);R.push(w[M[0]],w[M[1]])}if(A=[...A,{placement:n,overflows:R}],!R.every(M=>M<=0)){var I,F;const M=(((I=s.flip)==null?void 0:I.index)||0)+1,U=_[M];if(U&&(!(p==="alignment"&&j!==it(U))||A.every(T=>it(T.placement)===j?T.overflows[0]>0:!0)))return{data:{index:M,overflows:A},reset:{placement:U}};let $=(F=A.filter(T=>T.overflows[0]<=0).sort((T,D)=>T.overflows[1]-D.overflows[1])[0])==null?void 0:F.placement;if(!$)switch(x){case"bestFit":{var V;const T=(V=A.filter(D=>{if(k){const z=it(D.placement);return z===j||z==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(z=>z>0).reduce((z,L)=>z+L,0)]).sort((D,z)=>D[1]-z[1])[0])==null?void 0:V[0];T&&($=T);break}case"initialPlacement":$=l;break}if(n!==$)return{reset:{placement:$}}}return{}}}};function Qs(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ei(e){return iv.some(t=>e[t]>=0)}const wv=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:a}=t,{strategy:n="referenceHidden",...s}=gt(e,t);switch(n){case"referenceHidden":{const i=await a.detectOverflow(t,{...s,elementContext:"reference"}),l=Qs(i,r.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:ei(l)}}}case"escaped":{const i=await a.detectOverflow(t,{...s,altBoundary:!0}),l=Qs(i,r.floating);return{data:{escapedOffsets:l,escaped:ei(l)}}}default:return{}}}}},Tc=new Set(["left","top"]);async function jv(e,t){const{placement:r,platform:a,elements:n}=e,s=await(a.isRTL==null?void 0:a.isRTL(n.floating)),i=vt(r),l=ur(r),c=it(r)==="y",d=Tc.has(i)?-1:1,u=s&&c?-1:1,p=gt(t,e);let{mainAxis:m,crossAxis:x,alignmentAxis:g}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return l&&typeof g=="number"&&(x=l==="end"?g*-1:g),c?{x:x*u,y:m*d}:{x:m*d,y:x*u}}const Nv=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,a;const{x:n,y:s,placement:i,middlewareData:l}=t,c=await jv(t,e);return i===((r=l.offset)==null?void 0:r.placement)&&(a=l.arrow)!=null&&a.alignmentOffset?{}:{x:n+c.x,y:s+c.y,data:{...c,placement:i}}}}},Cv=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:a,placement:n,platform:s}=t,{mainAxis:i=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x:j,y}=b;return{x:j,y}}},...d}=gt(e,t),u={x:r,y:a},p=await s.detectOverflow(t,d),m=it(vt(n)),x=Cn(m);let g=u[x],f=u[m];if(i){const b=x==="y"?"top":"left",j=x==="y"?"bottom":"right",y=g+p[b],N=g-p[j];g=So(y,g,N)}if(l){const b=m==="y"?"top":"left",j=m==="y"?"bottom":"right",y=f+p[b],N=f-p[j];f=So(y,f,N)}const v=c.fn({...t,[x]:g,[m]:f});return{...v,data:{x:v.x-r,y:v.y-a,enabled:{[x]:i,[m]:l}}}}}},Sv=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:a,placement:n,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=gt(e,t),u={x:r,y:a},p=it(n),m=Cn(p);let x=u[m],g=u[p];const f=gt(l,t),v=typeof f=="number"?{mainAxis:f,crossAxis:0}:{mainAxis:0,crossAxis:0,...f};if(c){const y=m==="y"?"height":"width",N=s.reference[m]-s.floating[y]+v.mainAxis,C=s.reference[m]+s.reference[y]-v.mainAxis;x<N?x=N:x>C&&(x=C)}if(d){var b,j;const y=m==="y"?"width":"height",N=Tc.has(vt(n)),C=s.reference[p]-s.floating[y]+(N&&((b=i.offset)==null?void 0:b[p])||0)+(N?0:v.crossAxis),k=s.reference[p]+s.reference[y]+(N?0:((j=i.offset)==null?void 0:j[p])||0)-(N?v.crossAxis:0);g<C?g=C:g>k&&(g=k)}return{[m]:x,[p]:g}}}},kv=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,a;const{placement:n,rects:s,platform:i,elements:l}=t,{apply:c=()=>{},...d}=gt(e,t),u=await i.detectOverflow(t,d),p=vt(n),m=ur(n),x=it(n)==="y",{width:g,height:f}=s.floating;let v,b;p==="top"||p==="bottom"?(v=p,b=m===(await(i.isRTL==null?void 0:i.isRTL(l.floating))?"start":"end")?"left":"right"):(b=p,v=m==="end"?"top":"bottom");const j=f-u.top-u.bottom,y=g-u.left-u.right,N=Et(f-u[v],j),C=Et(g-u[b],y),k=!t.middlewareData.shift;let _=N,w=C;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(w=y),(a=t.middlewareData.shift)!=null&&a.enabled.y&&(_=j),k&&!m){const A=Ve(u.left,0),I=Ve(u.right,0),F=Ve(u.top,0),V=Ve(u.bottom,0);x?w=g-2*(A!==0||I!==0?A+I:Ve(u.left,u.right)):_=f-2*(F!==0||V!==0?F+V:Ve(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:_});const R=await i.getDimensions(l.floating);return g!==R.width||f!==R.height?{reset:{rects:!0}}:{}}}};function Ta(){return typeof window<"u"}function pr(e){return $c(e)?(e.nodeName||"").toLowerCase():"#document"}function Ue(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function pt(e){var t;return(t=($c(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function $c(e){return Ta()?e instanceof Node||e instanceof Ue(e).Node:!1}function at(e){return Ta()?e instanceof Element||e instanceof Ue(e).Element:!1}function yt(e){return Ta()?e instanceof HTMLElement||e instanceof Ue(e).HTMLElement:!1}function ti(e){return!Ta()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ue(e).ShadowRoot}function _r(e){const{overflow:t,overflowX:r,overflowY:a,display:n}=ot(e);return/auto|scroll|overlay|hidden|clip/.test(t+a+r)&&n!=="inline"&&n!=="contents"}function _v(e){return/^(table|td|th)$/.test(pr(e))}function $a(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const Ev=/transform|translate|scale|rotate|perspective|filter/,Pv=/paint|layout|strict|content/,Lt=e=>!!e&&e!=="none";let po;function _n(e){const t=at(e)?ot(e):e;return Lt(t.transform)||Lt(t.translate)||Lt(t.scale)||Lt(t.rotate)||Lt(t.perspective)||!En()&&(Lt(t.backdropFilter)||Lt(t.filter))||Ev.test(t.willChange||"")||Pv.test(t.contain||"")}function Tv(e){let t=Pt(e);for(;yt(t)&&!sr(t);){if(_n(t))return t;if($a(t))return null;t=Pt(t)}return null}function En(){return po==null&&(po=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),po}function sr(e){return/^(html|body|#document)$/.test(pr(e))}function ot(e){return Ue(e).getComputedStyle(e)}function Ra(e){return at(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Pt(e){if(pr(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ti(e)&&e.host||pt(e);return ti(t)?t.host:t}function Rc(e){const t=Pt(e);return sr(t)?e.ownerDocument?e.ownerDocument.body:e.body:yt(t)&&_r(t)?t:Rc(t)}function jr(e,t,r){var a;t===void 0&&(t=[]),r===void 0&&(r=!0);const n=Rc(e),s=n===((a=e.ownerDocument)==null?void 0:a.body),i=Ue(n);if(s){const l=_o(i);return t.concat(i,i.visualViewport||[],_r(n)?n:[],l&&r?jr(l):[])}else return t.concat(n,jr(n,[],r))}function _o(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Oc(e){const t=ot(e);let r=parseFloat(t.width)||0,a=parseFloat(t.height)||0;const n=yt(e),s=n?e.offsetWidth:r,i=n?e.offsetHeight:a,l=ra(r)!==s||ra(a)!==i;return l&&(r=s,a=i),{width:r,height:a,$:l}}function Pn(e){return at(e)?e:e.contextElement}function rr(e){const t=Pn(e);if(!yt(t))return lt(1);const r=t.getBoundingClientRect(),{width:a,height:n,$:s}=Oc(t);let i=(s?ra(r.width):r.width)/a,l=(s?ra(r.height):r.height)/n;return(!i||!Number.isFinite(i))&&(i=1),(!l||!Number.isFinite(l))&&(l=1),{x:i,y:l}}const $v=lt(0);function Dc(e){const t=Ue(e);return!En()||!t.visualViewport?$v:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Rv(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Ue(e)?!1:t}function Ut(e,t,r,a){t===void 0&&(t=!1),r===void 0&&(r=!1);const n=e.getBoundingClientRect(),s=Pn(e);let i=lt(1);t&&(a?at(a)&&(i=rr(a)):i=rr(e));const l=Rv(s,r,a)?Dc(s):lt(0);let c=(n.left+l.x)/i.x,d=(n.top+l.y)/i.y,u=n.width/i.x,p=n.height/i.y;if(s){const m=Ue(s),x=a&&at(a)?Ue(a):a;let g=m,f=_o(g);for(;f&&a&&x!==g;){const v=rr(f),b=f.getBoundingClientRect(),j=ot(f),y=b.left+(f.clientLeft+parseFloat(j.paddingLeft))*v.x,N=b.top+(f.clientTop+parseFloat(j.paddingTop))*v.y;c*=v.x,d*=v.y,u*=v.x,p*=v.y,c+=y,d+=N,g=Ue(f),f=_o(g)}}return oa({width:u,height:p,x:c,y:d})}function Oa(e,t){const r=Ra(e).scrollLeft;return t?t.left+r:Ut(pt(e)).left+r}function Ac(e,t){const r=e.getBoundingClientRect(),a=r.left+t.scrollLeft-Oa(e,r),n=r.top+t.scrollTop;return{x:a,y:n}}function Ov(e){let{elements:t,rect:r,offsetParent:a,strategy:n}=e;const s=n==="fixed",i=pt(a),l=t?$a(t.floating):!1;if(a===i||l&&s)return r;let c={scrollLeft:0,scrollTop:0},d=lt(1);const u=lt(0),p=yt(a);if((p||!p&&!s)&&((pr(a)!=="body"||_r(i))&&(c=Ra(a)),p)){const x=Ut(a);d=rr(a),u.x=x.x+a.clientLeft,u.y=x.y+a.clientTop}const m=i&&!p&&!s?Ac(i,c):lt(0);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-c.scrollLeft*d.x+u.x+m.x,y:r.y*d.y-c.scrollTop*d.y+u.y+m.y}}function Dv(e){return Array.from(e.getClientRects())}function Av(e){const t=pt(e),r=Ra(e),a=e.ownerDocument.body,n=Ve(t.scrollWidth,t.clientWidth,a.scrollWidth,a.clientWidth),s=Ve(t.scrollHeight,t.clientHeight,a.scrollHeight,a.clientHeight);let i=-r.scrollLeft+Oa(e);const l=-r.scrollTop;return ot(a).direction==="rtl"&&(i+=Ve(t.clientWidth,a.clientWidth)-n),{width:n,height:s,x:i,y:l}}const ri=25;function Iv(e,t){const r=Ue(e),a=pt(e),n=r.visualViewport;let s=a.clientWidth,i=a.clientHeight,l=0,c=0;if(n){s=n.width,i=n.height;const u=En();(!u||u&&t==="fixed")&&(l=n.offsetLeft,c=n.offsetTop)}const d=Oa(a);if(d<=0){const u=a.ownerDocument,p=u.body,m=getComputedStyle(p),x=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,g=Math.abs(a.clientWidth-p.clientWidth-x);g<=ri&&(s-=g)}else d<=ri&&(s+=d);return{width:s,height:i,x:l,y:c}}function Lv(e,t){const r=Ut(e,!0,t==="fixed"),a=r.top+e.clientTop,n=r.left+e.clientLeft,s=yt(e)?rr(e):lt(1),i=e.clientWidth*s.x,l=e.clientHeight*s.y,c=n*s.x,d=a*s.y;return{width:i,height:l,x:c,y:d}}function ai(e,t,r){let a;if(t==="viewport")a=Iv(e,r);else if(t==="document")a=Av(pt(e));else if(at(t))a=Lv(t,r);else{const n=Dc(e);a={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return oa(a)}function Ic(e,t){const r=Pt(e);return r===t||!at(r)||sr(r)?!1:ot(r).position==="fixed"||Ic(r,t)}function zv(e,t){const r=t.get(e);if(r)return r;let a=jr(e,[],!1).filter(l=>at(l)&&pr(l)!=="body"),n=null;const s=ot(e).position==="fixed";let i=s?Pt(e):e;for(;at(i)&&!sr(i);){const l=ot(i),c=_n(i);!c&&l.position==="fixed"&&(n=null),(s?!c&&!n:!c&&l.position==="static"&&n&&(n.position==="absolute"||n.position==="fixed")||_r(i)&&!c&&Ic(e,i))?a=a.filter(d=>d!==i):n=l,i=Pt(i)}return t.set(e,a),a}function Mv(e){let{element:t,boundary:r,rootBoundary:a,strategy:n}=e;const s=[...r==="clippingAncestors"?$a(t)?[]:zv(t,this._c):[].concat(r),a],i=ai(t,s[0],n);let l=i.top,c=i.right,d=i.bottom,u=i.left;for(let p=1;p<s.length;p++){const m=ai(t,s[p],n);l=Ve(m.top,l),c=Et(m.right,c),d=Et(m.bottom,d),u=Ve(m.left,u)}return{width:c-u,height:d-l,x:u,y:l}}function Fv(e){const{width:t,height:r}=Oc(e);return{width:t,height:r}}function Vv(e,t,r){const a=yt(t),n=pt(t),s=r==="fixed",i=Ut(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const c=lt(0);function d(){c.x=Oa(n)}if(a||!a&&!s)if((pr(t)!=="body"||_r(n))&&(l=Ra(t)),a){const x=Ut(t,!0,s,t);c.x=x.x+t.clientLeft,c.y=x.y+t.clientTop}else n&&d();s&&!a&&n&&d();const u=n&&!a&&!s?Ac(n,l):lt(0),p=i.left+l.scrollLeft-c.x-u.x,m=i.top+l.scrollTop-c.y-u.y;return{x:p,y:m,width:i.width,height:i.height}}function mo(e){return ot(e).position==="static"}function oi(e,t){if(!yt(e)||ot(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return pt(e)===r&&(r=r.ownerDocument.body),r}function Lc(e,t){const r=Ue(e);if($a(e))return r;if(!yt(e)){let n=Pt(e);for(;n&&!sr(n);){if(at(n)&&!mo(n))return n;n=Pt(n)}return r}let a=oi(e,t);for(;a&&_v(a)&&mo(a);)a=oi(a,t);return a&&sr(a)&&mo(a)&&!_n(a)?r:a||Tv(e)||r}const Bv=async function(e){const t=this.getOffsetParent||Lc,r=this.getDimensions,a=await r(e.floating);return{reference:Vv(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:a.width,height:a.height}}};function Uv(e){return ot(e).direction==="rtl"}const Hv={convertOffsetParentRelativeRectToViewportRelativeRect:Ov,getDocumentElement:pt,getClippingRect:Mv,getOffsetParent:Lc,getElementRects:Bv,getClientRects:Dv,getDimensions:Fv,getScale:rr,isElement:at,isRTL:Uv};function zc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Wv(e,t){let r=null,a;const n=pt(e);function s(){var l;clearTimeout(a),(l=r)==null||l.disconnect(),r=null}function i(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),s();const d=e.getBoundingClientRect(),{left:u,top:p,width:m,height:x}=d;if(l||t(),!m||!x)return;const g=Wr(p),f=Wr(n.clientWidth-(u+m)),v=Wr(n.clientHeight-(p+x)),b=Wr(u),j={rootMargin:-g+"px "+-f+"px "+-v+"px "+-b+"px",threshold:Ve(0,Et(1,c))||1};let y=!0;function N(C){const k=C[0].intersectionRatio;if(k!==c){if(!y)return i();k?i(!1,k):a=setTimeout(()=>{i(!1,1e-7)},1e3)}k===1&&!zc(d,e.getBoundingClientRect())&&i(),y=!1}try{r=new IntersectionObserver(N,{...j,root:n.ownerDocument})}catch{r=new IntersectionObserver(N,j)}r.observe(e)}return i(!0),s}function qv(e,t,r,a){a===void 0&&(a={});const{ancestorScroll:n=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=a,d=Pn(e),u=n||s?[...d?jr(d):[],...t?jr(t):[]]:[];u.forEach(b=>{n&&b.addEventListener("scroll",r,{passive:!0}),s&&b.addEventListener("resize",r)});const p=d&&l?Wv(d,r):null;let m=-1,x=null;i&&(x=new ResizeObserver(b=>{let[j]=b;j&&j.target===d&&x&&t&&(x.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=x)==null||y.observe(t)})),r()}),d&&!c&&x.observe(d),t&&x.observe(t));let g,f=c?Ut(e):null;c&&v();function v(){const b=Ut(e);f&&!zc(f,b)&&r(),f=b,g=requestAnimationFrame(v)}return r(),()=>{var b;u.forEach(j=>{n&&j.removeEventListener("scroll",r),s&&j.removeEventListener("resize",r)}),p==null||p(),(b=x)==null||b.disconnect(),x=null,c&&cancelAnimationFrame(g)}}const Zv=Nv,Xv=Cv,Gv=yv,Yv=kv,Kv=wv,ni=bv,Jv=Sv,Qv=(e,t,r)=>{const a=new Map,n={platform:Hv,...r},s={...n.platform,_c:a};return vv(e,t,{...n,platform:s})};var eb=typeof document<"u",tb=function(){},Gr=eb?E.useLayoutEffect:tb;function na(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,a,n;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(a=r;a--!==0;)if(!na(e[a],t[a]))return!1;return!0}if(n=Object.keys(e),r=n.length,r!==Object.keys(t).length)return!1;for(a=r;a--!==0;)if(!{}.hasOwnProperty.call(t,n[a]))return!1;for(a=r;a--!==0;){const s=n[a];if(!(s==="_owner"&&e.$$typeof)&&!na(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Mc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function si(e,t){const r=Mc(e);return Math.round(t*r)/r}function fo(e){const t=h.useRef(e);return Gr(()=>{t.current=e}),t}function rb(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:a=[],platform:n,elements:{reference:s,floating:i}={},transform:l=!0,whileElementsMounted:c,open:d}=e,[u,p]=h.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[m,x]=h.useState(a);na(m,a)||x(a);const[g,f]=h.useState(null),[v,b]=h.useState(null),j=h.useCallback(D=>{D!==k.current&&(k.current=D,f(D))},[]),y=h.useCallback(D=>{D!==_.current&&(_.current=D,b(D))},[]),N=s||g,C=i||v,k=h.useRef(null),_=h.useRef(null),w=h.useRef(u),R=c!=null,A=fo(c),I=fo(n),F=fo(d),V=h.useCallback(()=>{if(!k.current||!_.current)return;const D={placement:t,strategy:r,middleware:m};I.current&&(D.platform=I.current),Qv(k.current,_.current,D).then(z=>{const L={...z,isPositioned:F.current!==!1};M.current&&!na(w.current,L)&&(w.current=L,da.flushSync(()=>{p(L)}))})},[m,t,r,I,F]);Gr(()=>{d===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,p(D=>({...D,isPositioned:!1})))},[d]);const M=h.useRef(!1);Gr(()=>(M.current=!0,()=>{M.current=!1}),[]),Gr(()=>{if(N&&(k.current=N),C&&(_.current=C),N&&C){if(A.current)return A.current(N,C,V);V()}},[N,C,V,A,R]);const U=h.useMemo(()=>({reference:k,floating:_,setReference:j,setFloating:y}),[j,y]),$=h.useMemo(()=>({reference:N,floating:C}),[N,C]),T=h.useMemo(()=>{const D={position:r,left:0,top:0};if(!$.floating)return D;const z=si($.floating,u.x),L=si($.floating,u.y);return l?{...D,transform:"translate("+z+"px, "+L+"px)",...Mc($.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:z,top:L}},[r,l,$.floating,u.x,u.y]);return h.useMemo(()=>({...u,update:V,refs:U,elements:$,floatingStyles:T}),[u,V,U,$,T])}const ab=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:a,padding:n}=typeof e=="function"?e(r):e;return a&&t(a)?a.current!=null?ni({element:a.current,padding:n}).fn(r):{}:a?ni({element:a,padding:n}).fn(r):{}}}},ob=(e,t)=>{const r=Zv(e);return{name:r.name,fn:r.fn,options:[e,t]}},nb=(e,t)=>{const r=Xv(e);return{name:r.name,fn:r.fn,options:[e,t]}},sb=(e,t)=>({fn:Jv(e).fn,options:[e,t]}),ib=(e,t)=>{const r=Gv(e);return{name:r.name,fn:r.fn,options:[e,t]}},lb=(e,t)=>{const r=Yv(e);return{name:r.name,fn:r.fn,options:[e,t]}},cb=(e,t)=>{const r=Kv(e);return{name:r.name,fn:r.fn,options:[e,t]}},db=(e,t)=>{const r=ab(e);return{name:r.name,fn:r.fn,options:[e,t]}};var ub="Arrow",Fc=h.forwardRef((e,t)=>{const{children:r,width:a=10,height:n=5,...s}=e;return o.jsx(le.svg,{...s,ref:t,width:a,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:o.jsx("polygon",{points:"0,0 30,0 15,10"})})});Fc.displayName=ub;var pb=Fc,Tn="Popper",[Vc,mr]=bt(Tn),[mb,Bc]=Vc(Tn),Uc=e=>{const{__scopePopper:t,children:r}=e,[a,n]=h.useState(null);return o.jsx(mb,{scope:t,anchor:a,onAnchorChange:n,children:r})};Uc.displayName=Tn;var Hc="PopperAnchor",Wc=h.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:a,...n}=e,s=Bc(Hc,r),i=h.useRef(null),l=pe(t,i),c=h.useRef(null);return h.useEffect(()=>{const d=c.current;c.current=(a==null?void 0:a.current)||i.current,d!==c.current&&s.onAnchorChange(c.current)}),a?null:o.jsx(le.div,{...n,ref:l})});Wc.displayName=Hc;var $n="PopperContent",[fb,hb]=Vc($n),qc=h.forwardRef((e,t)=>{var r,a,n,s,i,l;const{__scopePopper:c,side:d="bottom",sideOffset:u=0,align:p="center",alignOffset:m=0,arrowPadding:x=0,avoidCollisions:g=!0,collisionBoundary:f=[],collisionPadding:v=0,sticky:b="partial",hideWhenDetached:j=!1,updatePositionStrategy:y="optimized",onPlaced:N,...C}=e,k=Bc($n,c),[_,w]=h.useState(null),R=pe(t,we=>w(we)),[A,I]=h.useState(null),F=un(A),V=(F==null?void 0:F.width)??0,M=(F==null?void 0:F.height)??0,U=d+(p!=="center"?"-"+p:""),$=typeof v=="number"?v:{top:0,right:0,bottom:0,left:0,...v},T=Array.isArray(f)?f:[f],D=T.length>0,z={padding:$,boundary:T.filter(gb),altBoundary:D},{refs:L,floatingStyles:ee,placement:Y,isPositioned:J,middlewareData:q}=rb({strategy:"fixed",placement:U,whileElementsMounted:(...we)=>qv(...we,{animationFrame:y==="always"}),elements:{reference:k.anchor},middleware:[ob({mainAxis:u+M,alignmentAxis:m}),g&&nb({mainAxis:!0,crossAxis:!1,limiter:b==="partial"?sb():void 0,...z}),g&&ib({...z}),lb({...z,apply:({elements:we,rects:je,availableWidth:Me,availableHeight:Ae})=>{const{width:$r,height:Rr}=je.reference,mt=we.floating.style;mt.setProperty("--radix-popper-available-width",`${Me}px`),mt.setProperty("--radix-popper-available-height",`${Ae}px`),mt.setProperty("--radix-popper-anchor-width",`${$r}px`),mt.setProperty("--radix-popper-anchor-height",`${Rr}px`)}}),A&&db({element:A,padding:x}),vb({arrowWidth:V,arrowHeight:M}),j&&cb({strategy:"referenceHidden",...z})]}),[se,me]=Gc(Y),H=Le(N);Ee(()=>{J&&(H==null||H())},[J,H]);const ie=(r=q.arrow)==null?void 0:r.x,te=(a=q.arrow)==null?void 0:a.y,re=((n=q.arrow)==null?void 0:n.centerOffset)!==0,[Q,fe]=h.useState();return Ee(()=>{_&&fe(window.getComputedStyle(_).zIndex)},[_]),o.jsx("div",{ref:L.setFloating,"data-radix-popper-content-wrapper":"",style:{...ee,transform:J?ee.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Q,"--radix-popper-transform-origin":[(s=q.transformOrigin)==null?void 0:s.x,(i=q.transformOrigin)==null?void 0:i.y].join(" "),...((l=q.hide)==null?void 0:l.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:o.jsx(fb,{scope:c,placedSide:se,onArrowChange:I,arrowX:ie,arrowY:te,shouldHideArrow:re,children:o.jsx(le.div,{"data-side":se,"data-align":me,...C,ref:R,style:{...C.style,animation:J?void 0:"none"}})})})});qc.displayName=$n;var Zc="PopperArrow",xb={top:"bottom",right:"left",bottom:"top",left:"right"},Xc=h.forwardRef(function(e,t){const{__scopePopper:r,...a}=e,n=hb(Zc,r),s=xb[n.placedSide];return o.jsx("span",{ref:n.onArrowChange,style:{position:"absolute",left:n.arrowX,top:n.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[n.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[n.placedSide],visibility:n.shouldHideArrow?"hidden":void 0},children:o.jsx(pb,{...a,ref:t,style:{...a.style,display:"block"}})})});Xc.displayName=Zc;function gb(e){return e!==null}var vb=e=>({name:"transformOrigin",options:e,fn(t){var r,a,n;const{placement:s,rects:i,middlewareData:l}=t,c=((r=l.arrow)==null?void 0:r.centerOffset)!==0,d=c?0:e.arrowWidth,u=c?0:e.arrowHeight,[p,m]=Gc(s),x={start:"0%",center:"50%",end:"100%"}[m],g=(((a=l.arrow)==null?void 0:a.x)??0)+d/2,f=(((n=l.arrow)==null?void 0:n.y)??0)+u/2;let v="",b="";return p==="bottom"?(v=c?x:`${g}px`,b=`${-u}px`):p==="top"?(v=c?x:`${g}px`,b=`${i.floating.height+u}px`):p==="right"?(v=`${-u}px`,b=c?x:`${f}px`):p==="left"&&(v=`${i.floating.width+u}px`,b=c?x:`${f}px`),{data:{x:v,y:b}}}});function Gc(e){const[t,r="center"]=e.split("-");return[t,r]}var Rn=Uc,Da=Wc,On=qc,Dn=Xc,Aa="Popover",[Yc]=bt(Aa,[mr]),Er=mr(),[bb,Rt]=Yc(Aa),Kc=e=>{const{__scopePopover:t,children:r,open:a,defaultOpen:n,onOpenChange:s,modal:i=!1}=e,l=Er(t),c=h.useRef(null),[d,u]=h.useState(!1),[p,m]=Vt({prop:a,defaultProp:n??!1,onChange:s,caller:Aa});return o.jsx(Rn,{...l,children:o.jsx(bb,{scope:t,contentId:_t(),triggerRef:c,open:p,onOpenChange:m,onOpenToggle:h.useCallback(()=>m(x=>!x),[m]),hasCustomAnchor:d,onCustomAnchorAdd:h.useCallback(()=>u(!0),[]),onCustomAnchorRemove:h.useCallback(()=>u(!1),[]),modal:i,children:r})})};Kc.displayName=Aa;var Jc="PopoverAnchor",yb=h.forwardRef((e,t)=>{const{__scopePopover:r,...a}=e,n=Rt(Jc,r),s=Er(r),{onCustomAnchorAdd:i,onCustomAnchorRemove:l}=n;return h.useEffect(()=>(i(),()=>l()),[i,l]),o.jsx(Da,{...s,...a,ref:t})});yb.displayName=Jc;var Qc="PopoverTrigger",ed=h.forwardRef((e,t)=>{const{__scopePopover:r,...a}=e,n=Rt(Qc,r),s=Er(r),i=pe(t,n.triggerRef),l=o.jsx(le.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":nd(n.open),...a,ref:i,onClick:oe(e.onClick,n.onOpenToggle)});return n.hasCustomAnchor?l:o.jsx(Da,{asChild:!0,...s,children:l})});ed.displayName=Qc;var An="PopoverPortal",[wb,jb]=Yc(An,{forceMount:void 0}),td=e=>{const{__scopePopover:t,forceMount:r,children:a,container:n}=e,s=Rt(An,t);return o.jsx(wb,{scope:t,forceMount:r,children:o.jsx(Qe,{present:r||s.open,children:o.jsx(ka,{asChild:!0,container:n,children:a})})})};td.displayName=An;var ir="PopoverContent",rd=h.forwardRef((e,t)=>{const r=jb(ir,e.__scopePopover),{forceMount:a=r.forceMount,...n}=e,s=Rt(ir,e.__scopePopover);return o.jsx(Qe,{present:a||s.open,children:s.modal?o.jsx(Cb,{...n,ref:t}):o.jsx(Sb,{...n,ref:t})})});rd.displayName=ir;var Nb=or("PopoverContent.RemoveScroll"),Cb=h.forwardRef((e,t)=>{const r=Rt(ir,e.__scopePopover),a=h.useRef(null),n=pe(t,a),s=h.useRef(!1);return h.useEffect(()=>{const i=a.current;if(i)return yn(i)},[]),o.jsx(Ea,{as:Nb,allowPinchZoom:!0,children:o.jsx(ad,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:oe(e.onCloseAutoFocus,i=>{var l;i.preventDefault(),s.current||(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:oe(e.onPointerDownOutside,i=>{const l=i.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:oe(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),Sb=h.forwardRef((e,t)=>{const r=Rt(ir,e.__scopePopover),a=h.useRef(!1),n=h.useRef(!1);return o.jsx(ad,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var i,l;(i=e.onCloseAutoFocus)==null||i.call(e,s),s.defaultPrevented||(a.current||(l=r.triggerRef.current)==null||l.focus(),s.preventDefault()),a.current=!1,n.current=!1},onInteractOutside:s=>{var i,l;(i=e.onInteractOutside)==null||i.call(e,s),s.defaultPrevented||(a.current=!0,s.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const c=s.target;(l=r.triggerRef.current)!=null&&l.contains(c)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&n.current&&s.preventDefault()}})}),ad=h.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:a,onOpenAutoFocus:n,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:u,...p}=e,m=Rt(ir,r),x=Er(r);return bn(),o.jsx(Sa,{asChild:!0,loop:!0,trapped:a,onMountAutoFocus:n,onUnmountAutoFocus:s,children:o.jsx(kr,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),children:o.jsx(On,{"data-state":nd(m.open),role:"dialog",id:m.contentId,...x,...p,ref:t,style:{...p.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),od="PopoverClose",kb=h.forwardRef((e,t)=>{const{__scopePopover:r,...a}=e,n=Rt(od,r);return o.jsx(le.button,{type:"button",...a,ref:t,onClick:oe(e.onClick,()=>n.onOpenChange(!1))})});kb.displayName=od;var _b="PopoverArrow",Eb=h.forwardRef((e,t)=>{const{__scopePopover:r,...a}=e,n=Er(r);return o.jsx(Dn,{...n,...a,ref:t})});Eb.displayName=_b;function nd(e){return e?"open":"closed"}var Pb=Kc,Tb=ed,$b=td,sd=rd;const Ia=Pb,La=Tb,Pr=h.forwardRef(({className:e,align:t="center",sideOffset:r=4,...a},n)=>o.jsx($b,{children:o.jsx(sd,{ref:n,align:t,sideOffset:r,className:G("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));Pr.displayName=sd.displayName;const ht=({onInsert:e})=>{const[t,r]=E.useState(null),a=async n=>{const s=`{{${n}}}`;try{await navigator.clipboard.writeText(s)}catch{const i=document.createElement("textarea");i.value=s,i.style.position="fixed",i.style.opacity="0",document.body.appendChild(i),i.select(),document.execCommand("copy"),document.body.removeChild(i)}e&&e(s),r(n),setTimeout(()=>r(null),1500)};return o.jsxs(Ia,{children:[o.jsx(La,{asChild:!0,children:o.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 text-muted-foreground hover:text-primary",title:"Inserir variável do evento",children:o.jsx(P.Braces,{className:"h-3.5 w-3.5"})})}),o.jsxs(Pr,{className:"w-80 p-0",align:"end",side:"left",sideOffset:6,children:[o.jsxs("div",{className:"px-3 py-2 border-b border-border",children:[o.jsx("p",{className:"text-xs font-semibold text-foreground",children:"Variáveis do evento"}),o.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Clique para copiar. Use"," ",o.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"{{evento.xxx}}"})," ","em labels, placeholders e hints."]})]}),o.jsx("div",{className:"max-h-64 overflow-y-auto py-1",children:on.map(n=>{const s=t===n.key;return o.jsxs("button",{type:"button",onClick:()=>a(n.key),className:G("w-full flex items-center justify-between px-3 py-1.5 text-left hover:bg-accent transition-colors",s&&"bg-primary/10"),children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-xs font-medium truncate",children:n.label}),o.jsx("code",{className:"text-[10px] text-muted-foreground font-mono",children:`{{${n.key}}}`})]}),o.jsx("div",{className:"ml-2 shrink-0",children:s?o.jsx(P.Check,{className:"h-3.5 w-3.5 text-primary"}):o.jsx(P.Braces,{className:"h-3 w-3 text-muted-foreground/50"})})]},n.key)})})]})]})},Rb=({config:e,onUpdate:t})=>o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Label"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.label,onChange:r=>t({label:r.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Descrição"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do step"})]}),o.jsx(Ec,{value:e.icone,onChange:r=>t({icone:r})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"step-show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),o.jsx(W,{htmlFor:"step-show-label",className:"text-xs cursor-pointer",children:"Exibir título no formulário"})]})]});function id(e){const t=e+"CollectionProvider",[r,a]=bt(t),[n,s]=r(t,{collectionRef:{current:null},itemMap:new Map}),i=f=>{const{scope:v,children:b}=f,j=E.useRef(null),y=E.useRef(new Map).current;return o.jsx(n,{scope:v,itemMap:y,collectionRef:j,children:b})};i.displayName=t;const l=e+"CollectionSlot",c=or(l),d=E.forwardRef((f,v)=>{const{scope:b,children:j}=f,y=s(l,b),N=pe(v,y.collectionRef);return o.jsx(c,{ref:N,children:j})});d.displayName=l;const u=e+"CollectionItemSlot",p="data-radix-collection-item",m=or(u),x=E.forwardRef((f,v)=>{const{scope:b,children:j,...y}=f,N=E.useRef(null),C=pe(v,N),k=s(u,b);return E.useEffect(()=>(k.itemMap.set(N,{ref:N,...y}),()=>void k.itemMap.delete(N))),o.jsx(m,{[p]:"",ref:C,children:j})});x.displayName=u;function g(f){const v=s(e+"CollectionConsumer",f);return E.useCallback(()=>{const b=v.collectionRef.current;if(!b)return[];const j=Array.from(b.querySelectorAll(`[${p}]`));return Array.from(v.itemMap.values()).sort((y,N)=>j.indexOf(y.ref.current)-j.indexOf(N.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:d,ItemSlot:x},g,a]}var ld=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Ob="VisuallyHidden",cd=h.forwardRef((e,t)=>o.jsx(le.span,{...e,ref:t,style:{...ld,...e.style}}));cd.displayName=Ob;var Db=cd,Ab=[" ","Enter","ArrowUp","ArrowDown"],Ib=[" ","Enter"],Ht="Select",[za,Ma,Lb]=id(Ht),[fr]=bt(Ht,[Lb,mr]),Fa=mr(),[zb,Ot]=fr(Ht),[Mb,Fb]=fr(Ht),dd=e=>{const{__scopeSelect:t,children:r,open:a,defaultOpen:n,onOpenChange:s,value:i,defaultValue:l,onValueChange:c,dir:d,name:u,autoComplete:p,disabled:m,required:x,form:g}=e,f=Fa(t),[v,b]=h.useState(null),[j,y]=h.useState(null),[N,C]=h.useState(!1),k=fn(d),[_,w]=Vt({prop:a,defaultProp:n??!1,onChange:s,caller:Ht}),[R,A]=Vt({prop:i,defaultProp:l,onChange:c,caller:Ht}),I=h.useRef(null),F=v?g||!!v.closest("form"):!0,[V,M]=h.useState(new Set),U=Array.from(V).map($=>$.props.value).join(";");return o.jsx(Rn,{...f,children:o.jsxs(zb,{required:x,scope:t,trigger:v,onTriggerChange:b,valueNode:j,onValueNodeChange:y,valueNodeHasChildren:N,onValueNodeHasChildrenChange:C,contentId:_t(),value:R,onValueChange:A,open:_,onOpenChange:w,dir:k,triggerPointerDownPosRef:I,disabled:m,children:[o.jsx(za.Provider,{scope:t,children:o.jsx(Mb,{scope:e.__scopeSelect,onNativeOptionAdd:h.useCallback($=>{M(T=>new Set(T).add($))},[]),onNativeOptionRemove:h.useCallback($=>{M(T=>{const D=new Set(T);return D.delete($),D})},[]),children:r})}),F?o.jsxs(Dd,{"aria-hidden":!0,required:x,tabIndex:-1,name:u,autoComplete:p,value:R,onChange:$=>A($.target.value),disabled:m,form:g,children:[R===void 0?o.jsx("option",{value:""}):null,Array.from(V)]},U):null]})})};dd.displayName=Ht;var ud="SelectTrigger",pd=h.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:a=!1,...n}=e,s=Fa(r),i=Ot(ud,r),l=i.disabled||a,c=pe(t,i.onTriggerChange),d=Ma(r),u=h.useRef("touch"),[p,m,x]=Id(f=>{const v=d().filter(y=>!y.disabled),b=v.find(y=>y.value===i.value),j=Ld(v,f,b);j!==void 0&&i.onValueChange(j.value)}),g=f=>{l||(i.onOpenChange(!0),x()),f&&(i.triggerPointerDownPosRef.current={x:Math.round(f.pageX),y:Math.round(f.pageY)})};return o.jsx(Da,{asChild:!0,...s,children:o.jsx(le.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":Ad(i.value)?"":void 0,...n,ref:c,onClick:oe(n.onClick,f=>{f.currentTarget.focus(),u.current!=="mouse"&&g(f)}),onPointerDown:oe(n.onPointerDown,f=>{u.current=f.pointerType;const v=f.target;v.hasPointerCapture(f.pointerId)&&v.releasePointerCapture(f.pointerId),f.button===0&&f.ctrlKey===!1&&f.pointerType==="mouse"&&(g(f),f.preventDefault())}),onKeyDown:oe(n.onKeyDown,f=>{const v=p.current!=="";!(f.ctrlKey||f.altKey||f.metaKey)&&f.key.length===1&&m(f.key),!(v&&f.key===" ")&&Ab.includes(f.key)&&(g(),f.preventDefault())})})})});pd.displayName=ud;var md="SelectValue",fd=h.forwardRef((e,t)=>{const{__scopeSelect:r,className:a,style:n,children:s,placeholder:i="",...l}=e,c=Ot(md,r),{onValueNodeHasChildrenChange:d}=c,u=s!==void 0,p=pe(t,c.onValueNodeChange);return Ee(()=>{d(u)},[d,u]),o.jsx(le.span,{...l,ref:p,style:{pointerEvents:"none"},children:Ad(c.value)?o.jsx(o.Fragment,{children:i}):s})});fd.displayName=md;var Vb="SelectIcon",hd=h.forwardRef((e,t)=>{const{__scopeSelect:r,children:a,...n}=e;return o.jsx(le.span,{"aria-hidden":!0,...n,ref:t,children:a||"▼"})});hd.displayName=Vb;var Bb="SelectPortal",xd=e=>o.jsx(ka,{asChild:!0,...e});xd.displayName=Bb;var Wt="SelectContent",gd=h.forwardRef((e,t)=>{const r=Ot(Wt,e.__scopeSelect),[a,n]=h.useState();if(Ee(()=>{n(new DocumentFragment)},[]),!r.open){const s=a;return s?da.createPortal(o.jsx(vd,{scope:e.__scopeSelect,children:o.jsx(za.Slot,{scope:e.__scopeSelect,children:o.jsx("div",{children:e.children})})}),s):null}return o.jsx(bd,{...e,ref:t})});gd.displayName=Wt;var tt=10,[vd,Dt]=fr(Wt),Ub="SelectContentImpl",Hb=or("SelectContent.RemoveScroll"),bd=h.forwardRef((e,t)=>{const{__scopeSelect:r,position:a="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:s,onPointerDownOutside:i,side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:p,collisionBoundary:m,collisionPadding:x,sticky:g,hideWhenDetached:f,avoidCollisions:v,...b}=e,j=Ot(Wt,r),[y,N]=h.useState(null),[C,k]=h.useState(null),_=pe(t,H=>N(H)),[w,R]=h.useState(null),[A,I]=h.useState(null),F=Ma(r),[V,M]=h.useState(!1),U=h.useRef(!1);h.useEffect(()=>{if(y)return yn(y)},[y]),bn();const $=h.useCallback(H=>{const[ie,...te]=F().map(fe=>fe.ref.current),[re]=te.slice(-1),Q=document.activeElement;for(const fe of H)if(fe===Q||(fe==null||fe.scrollIntoView({block:"nearest"}),fe===ie&&C&&(C.scrollTop=0),fe===re&&C&&(C.scrollTop=C.scrollHeight),fe==null||fe.focus(),document.activeElement!==Q))return},[F,C]),T=h.useCallback(()=>$([w,y]),[$,w,y]);h.useEffect(()=>{V&&T()},[V,T]);const{onOpenChange:D,triggerPointerDownPosRef:z}=j;h.useEffect(()=>{if(y){let H={x:0,y:0};const ie=re=>{var Q,fe;H={x:Math.abs(Math.round(re.pageX)-(((Q=z.current)==null?void 0:Q.x)??0)),y:Math.abs(Math.round(re.pageY)-(((fe=z.current)==null?void 0:fe.y)??0))}},te=re=>{H.x<=10&&H.y<=10?re.preventDefault():y.contains(re.target)||D(!1),document.removeEventListener("pointermove",ie),z.current=null};return z.current!==null&&(document.addEventListener("pointermove",ie),document.addEventListener("pointerup",te,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ie),document.removeEventListener("pointerup",te,{capture:!0})}}},[y,D,z]),h.useEffect(()=>{const H=()=>D(!1);return window.addEventListener("blur",H),window.addEventListener("resize",H),()=>{window.removeEventListener("blur",H),window.removeEventListener("resize",H)}},[D]);const[L,ee]=Id(H=>{const ie=F().filter(Q=>!Q.disabled),te=ie.find(Q=>Q.ref.current===document.activeElement),re=Ld(ie,H,te);re&&setTimeout(()=>re.ref.current.focus())}),Y=h.useCallback((H,ie,te)=>{const re=!U.current&&!te;(j.value!==void 0&&j.value===ie||re)&&(R(H),re&&(U.current=!0))},[j.value]),J=h.useCallback(()=>y==null?void 0:y.focus(),[y]),q=h.useCallback((H,ie,te)=>{const re=!U.current&&!te;(j.value!==void 0&&j.value===ie||re)&&I(H)},[j.value]),se=a==="popper"?Eo:yd,me=se===Eo?{side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:p,collisionBoundary:m,collisionPadding:x,sticky:g,hideWhenDetached:f,avoidCollisions:v}:{};return o.jsx(vd,{scope:r,content:y,viewport:C,onViewportChange:k,itemRefCallback:Y,selectedItem:w,onItemLeave:J,itemTextRefCallback:q,focusSelectedItem:T,selectedItemText:A,position:a,isPositioned:V,searchRef:L,children:o.jsx(Ea,{as:Hb,allowPinchZoom:!0,children:o.jsx(Sa,{asChild:!0,trapped:j.open,onMountAutoFocus:H=>{H.preventDefault()},onUnmountAutoFocus:oe(n,H=>{var ie;(ie=j.trigger)==null||ie.focus({preventScroll:!0}),H.preventDefault()}),children:o.jsx(kr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:H=>H.preventDefault(),onDismiss:()=>j.onOpenChange(!1),children:o.jsx(se,{role:"listbox",id:j.contentId,"data-state":j.open?"open":"closed",dir:j.dir,onContextMenu:H=>H.preventDefault(),...b,...me,onPlaced:()=>M(!0),ref:_,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:oe(b.onKeyDown,H=>{const ie=H.ctrlKey||H.altKey||H.metaKey;if(H.key==="Tab"&&H.preventDefault(),!ie&&H.key.length===1&&ee(H.key),["ArrowUp","ArrowDown","Home","End"].includes(H.key)){let te=F().filter(re=>!re.disabled).map(re=>re.ref.current);if(["ArrowUp","End"].includes(H.key)&&(te=te.slice().reverse()),["ArrowUp","ArrowDown"].includes(H.key)){const re=H.target,Q=te.indexOf(re);te=te.slice(Q+1)}setTimeout(()=>$(te)),H.preventDefault()}})})})})})})});bd.displayName=Ub;var Wb="SelectItemAlignedPosition",yd=h.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:a,...n}=e,s=Ot(Wt,r),i=Dt(Wt,r),[l,c]=h.useState(null),[d,u]=h.useState(null),p=pe(t,_=>u(_)),m=Ma(r),x=h.useRef(!1),g=h.useRef(!0),{viewport:f,selectedItem:v,selectedItemText:b,focusSelectedItem:j}=i,y=h.useCallback(()=>{if(s.trigger&&s.valueNode&&l&&d&&f&&v&&b){const _=s.trigger.getBoundingClientRect(),w=d.getBoundingClientRect(),R=s.valueNode.getBoundingClientRect(),A=b.getBoundingClientRect();if(s.dir!=="rtl"){const re=A.left-w.left,Q=R.left-re,fe=_.left-Q,we=_.width+fe,je=Math.max(we,w.width),Me=window.innerWidth-tt,Ae=wr(Q,[tt,Math.max(tt,Me-je)]);l.style.minWidth=we+"px",l.style.left=Ae+"px"}else{const re=w.right-A.right,Q=window.innerWidth-R.right-re,fe=window.innerWidth-_.right-Q,we=_.width+fe,je=Math.max(we,w.width),Me=window.innerWidth-tt,Ae=wr(Q,[tt,Math.max(tt,Me-je)]);l.style.minWidth=we+"px",l.style.right=Ae+"px"}const I=m(),F=window.innerHeight-tt*2,V=f.scrollHeight,M=window.getComputedStyle(d),U=parseInt(M.borderTopWidth,10),$=parseInt(M.paddingTop,10),T=parseInt(M.borderBottomWidth,10),D=parseInt(M.paddingBottom,10),z=U+$+V+D+T,L=Math.min(v.offsetHeight*5,z),ee=window.getComputedStyle(f),Y=parseInt(ee.paddingTop,10),J=parseInt(ee.paddingBottom,10),q=_.top+_.height/2-tt,se=F-q,me=v.offsetHeight/2,H=v.offsetTop+me,ie=U+$+H,te=z-ie;if(ie<=q){const re=I.length>0&&v===I[I.length-1].ref.current;l.style.bottom="0px";const Q=d.clientHeight-f.offsetTop-f.offsetHeight,fe=Math.max(se,me+(re?J:0)+Q+T),we=ie+fe;l.style.height=we+"px"}else{const re=I.length>0&&v===I[0].ref.current;l.style.top="0px";const Q=Math.max(q,U+f.offsetTop+(re?Y:0)+me)+te;l.style.height=Q+"px",f.scrollTop=ie-q+f.offsetTop}l.style.margin=`${tt}px 0`,l.style.minHeight=L+"px",l.style.maxHeight=F+"px",a==null||a(),requestAnimationFrame(()=>x.current=!0)}},[m,s.trigger,s.valueNode,l,d,f,v,b,s.dir,a]);Ee(()=>y(),[y]);const[N,C]=h.useState();Ee(()=>{d&&C(window.getComputedStyle(d).zIndex)},[d]);const k=h.useCallback(_=>{_&&g.current===!0&&(y(),j==null||j(),g.current=!1)},[y,j]);return o.jsx(Zb,{scope:r,contentWrapper:l,shouldExpandOnScrollRef:x,onScrollButtonChange:k,children:o.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:o.jsx(le.div,{...n,ref:p,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});yd.displayName=Wb;var qb="SelectPopperPosition",Eo=h.forwardRef((e,t)=>{const{__scopeSelect:r,align:a="start",collisionPadding:n=tt,...s}=e,i=Fa(r);return o.jsx(On,{...i,...s,ref:t,align:a,collisionPadding:n,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Eo.displayName=qb;var[Zb,In]=fr(Wt,{}),Po="SelectViewport",wd=h.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:a,...n}=e,s=Dt(Po,r),i=In(Po,r),l=pe(t,s.onViewportChange),c=h.useRef(0);return o.jsxs(o.Fragment,{children:[o.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),o.jsx(za.Slot,{scope:r,children:o.jsx(le.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:oe(n.onScroll,d=>{const u=d.currentTarget,{contentWrapper:p,shouldExpandOnScrollRef:m}=i;if(m!=null&&m.current&&p){const x=Math.abs(c.current-u.scrollTop);if(x>0){const g=window.innerHeight-tt*2,f=parseFloat(p.style.minHeight),v=parseFloat(p.style.height),b=Math.max(f,v);if(b<g){const j=b+x,y=Math.min(g,j),N=j-y;p.style.height=y+"px",p.style.bottom==="0px"&&(u.scrollTop=N>0?N:0,p.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});wd.displayName=Po;var jd="SelectGroup",[Xb,Gb]=fr(jd),Yb=h.forwardRef((e,t)=>{const{__scopeSelect:r,...a}=e,n=_t();return o.jsx(Xb,{scope:r,id:n,children:o.jsx(le.div,{role:"group","aria-labelledby":n,...a,ref:t})})});Yb.displayName=jd;var Nd="SelectLabel",Cd=h.forwardRef((e,t)=>{const{__scopeSelect:r,...a}=e,n=Gb(Nd,r);return o.jsx(le.div,{id:n.id,...a,ref:t})});Cd.displayName=Nd;var sa="SelectItem",[Kb,Sd]=fr(sa),kd=h.forwardRef((e,t)=>{const{__scopeSelect:r,value:a,disabled:n=!1,textValue:s,...i}=e,l=Ot(sa,r),c=Dt(sa,r),d=l.value===a,[u,p]=h.useState(s??""),[m,x]=h.useState(!1),g=pe(t,j=>{var y;return(y=c.itemRefCallback)==null?void 0:y.call(c,j,a,n)}),f=_t(),v=h.useRef("touch"),b=()=>{n||(l.onValueChange(a),l.onOpenChange(!1))};if(a==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return o.jsx(Kb,{scope:r,value:a,disabled:n,textId:f,isSelected:d,onItemTextChange:h.useCallback(j=>{p(y=>y||((j==null?void 0:j.textContent)??"").trim())},[]),children:o.jsx(za.ItemSlot,{scope:r,value:a,disabled:n,textValue:u,children:o.jsx(le.div,{role:"option","aria-labelledby":f,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...i,ref:g,onFocus:oe(i.onFocus,()=>x(!0)),onBlur:oe(i.onBlur,()=>x(!1)),onClick:oe(i.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:oe(i.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:oe(i.onPointerDown,j=>{v.current=j.pointerType}),onPointerMove:oe(i.onPointerMove,j=>{var y;v.current=j.pointerType,n?(y=c.onItemLeave)==null||y.call(c):v.current==="mouse"&&j.currentTarget.focus({preventScroll:!0})}),onPointerLeave:oe(i.onPointerLeave,j=>{var y;j.currentTarget===document.activeElement&&((y=c.onItemLeave)==null||y.call(c))}),onKeyDown:oe(i.onKeyDown,j=>{var y;((y=c.searchRef)==null?void 0:y.current)!==""&&j.key===" "||(Ib.includes(j.key)&&b(),j.key===" "&&j.preventDefault())})})})})});kd.displayName=sa;var br="SelectItemText",_d=h.forwardRef((e,t)=>{const{__scopeSelect:r,className:a,style:n,...s}=e,i=Ot(br,r),l=Dt(br,r),c=Sd(br,r),d=Fb(br,r),[u,p]=h.useState(null),m=pe(t,b=>p(b),c.onItemTextChange,b=>{var j;return(j=l.itemTextRefCallback)==null?void 0:j.call(l,b,c.value,c.disabled)}),x=u==null?void 0:u.textContent,g=h.useMemo(()=>o.jsx("option",{value:c.value,disabled:c.disabled,children:x},c.value),[c.disabled,c.value,x]),{onNativeOptionAdd:f,onNativeOptionRemove:v}=d;return Ee(()=>(f(g),()=>v(g)),[f,v,g]),o.jsxs(o.Fragment,{children:[o.jsx(le.span,{id:c.textId,...s,ref:m}),c.isSelected&&i.valueNode&&!i.valueNodeHasChildren?da.createPortal(s.children,i.valueNode):null]})});_d.displayName=br;var Ed="SelectItemIndicator",Pd=h.forwardRef((e,t)=>{const{__scopeSelect:r,...a}=e;return Sd(Ed,r).isSelected?o.jsx(le.span,{"aria-hidden":!0,...a,ref:t}):null});Pd.displayName=Ed;var To="SelectScrollUpButton",Td=h.forwardRef((e,t)=>{const r=Dt(To,e.__scopeSelect),a=In(To,e.__scopeSelect),[n,s]=h.useState(!1),i=pe(t,a.onScrollButtonChange);return Ee(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollTop>0;s(d)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),n?o.jsx(Rd,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});Td.displayName=To;var $o="SelectScrollDownButton",$d=h.forwardRef((e,t)=>{const r=Dt($o,e.__scopeSelect),a=In($o,e.__scopeSelect),[n,s]=h.useState(!1),i=pe(t,a.onScrollButtonChange);return Ee(()=>{if(r.viewport&&r.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)<d;s(u)};const c=r.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[r.viewport,r.isPositioned]),n?o.jsx(Rd,{...e,ref:i,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=r;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});$d.displayName=$o;var Rd=h.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:a,...n}=e,s=Dt("SelectScrollButton",r),i=h.useRef(null),l=Ma(r),c=h.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return h.useEffect(()=>()=>c(),[c]),Ee(()=>{var d;const u=l().find(p=>p.ref.current===document.activeElement);(d=u==null?void 0:u.ref.current)==null||d.scrollIntoView({block:"nearest"})},[l]),o.jsx(le.div,{"aria-hidden":!0,...n,ref:t,style:{flexShrink:0,...n.style},onPointerDown:oe(n.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(a,50))}),onPointerMove:oe(n.onPointerMove,()=>{var d;(d=s.onItemLeave)==null||d.call(s),i.current===null&&(i.current=window.setInterval(a,50))}),onPointerLeave:oe(n.onPointerLeave,()=>{c()})})}),Jb="SelectSeparator",Od=h.forwardRef((e,t)=>{const{__scopeSelect:r,...a}=e;return o.jsx(le.div,{"aria-hidden":!0,...a,ref:t})});Od.displayName=Jb;var Ro="SelectArrow",Qb=h.forwardRef((e,t)=>{const{__scopeSelect:r,...a}=e,n=Fa(r),s=Ot(Ro,r),i=Dt(Ro,r);return s.open&&i.position==="popper"?o.jsx(Dn,{...n,...a,ref:t}):null});Qb.displayName=Ro;var ey="SelectBubbleInput",Dd=h.forwardRef(({__scopeSelect:e,value:t,...r},a)=>{const n=h.useRef(null),s=pe(a,n),i=dn(t);return h.useEffect(()=>{const l=n.current;if(!l)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const u=new Event("change",{bubbles:!0});d.call(l,t),l.dispatchEvent(u)}},[i,t]),o.jsx(le.select,{...r,style:{...ld,...r.style},ref:s,defaultValue:t})});Dd.displayName=ey;function Ad(e){return e===""||e===void 0}function Id(e){const t=Le(e),r=h.useRef(""),a=h.useRef(0),n=h.useCallback(i=>{const l=r.current+i;t(l),function c(d){r.current=d,window.clearTimeout(a.current),d!==""&&(a.current=window.setTimeout(()=>c(""),1e3))}(l)},[t]),s=h.useCallback(()=>{r.current="",window.clearTimeout(a.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(a.current),[]),[r,n,s]}function Ld(e,t,r){const a=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,n=r?e.indexOf(r):-1;let s=ty(e,Math.max(n,0));a.length===1&&(s=s.filter(l=>l!==r));const i=s.find(l=>l.textValue.toLowerCase().startsWith(a.toLowerCase()));return i!==r?i:void 0}function ty(e,t){return e.map((r,a)=>e[(t+a)%e.length])}var ry=dd,zd=pd,ay=fd,oy=hd,ny=xd,Md=gd,sy=wd,Fd=Cd,Vd=kd,iy=_d,ly=Pd,Bd=Td,Ud=$d,Hd=Od;const Ge=ry,Ye=ay,He=h.forwardRef(({className:e,children:t,...r},a)=>o.jsxs(zd,{ref:a,className:G("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,o.jsx(oy,{asChild:!0,children:o.jsx(P.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));He.displayName=zd.displayName;const Wd=h.forwardRef(({className:e,...t},r)=>o.jsx(Bd,{ref:r,className:G("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(P.ChevronUp,{className:"h-4 w-4"})}));Wd.displayName=Bd.displayName;const qd=h.forwardRef(({className:e,...t},r)=>o.jsx(Ud,{ref:r,className:G("flex cursor-default items-center justify-center py-1",e),...t,children:o.jsx(P.ChevronDown,{className:"h-4 w-4"})}));qd.displayName=Ud.displayName;const We=h.forwardRef(({className:e,children:t,position:r="popper",...a},n)=>o.jsx(ny,{children:o.jsxs(Md,{ref:n,className:G("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...a,children:[o.jsx(Wd,{}),o.jsx(sy,{className:G("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),o.jsx(qd,{})]})}));We.displayName=Md.displayName;const cy=h.forwardRef(({className:e,...t},r)=>o.jsx(Fd,{ref:r,className:G("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));cy.displayName=Fd.displayName;const Se=h.forwardRef(({className:e,children:t,...r},a)=>o.jsxs(Vd,{ref:a,className:G("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[o.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:o.jsx(ly,{children:o.jsx(P.Check,{className:"h-4 w-4"})})}),o.jsx(iy,{children:t})]}));Se.displayName=Vd.displayName;const dy=h.forwardRef(({className:e,...t},r)=>o.jsx(Hd,{ref:r,className:G("-mx-1 my-1 h-px bg-muted",e),...t}));dy.displayName=Hd.displayName;var Zd=["PageUp","PageDown"],Xd=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Gd={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},hr="Slider",[Oo,uy,py]=id(hr),[Yd]=bt(hr,[py]),[my,Va]=Yd(hr),Kd=h.forwardRef((e,t)=>{const{name:r,min:a=0,max:n=100,step:s=1,orientation:i="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[a],value:u,onValueChange:p=()=>{},onValueCommit:m=()=>{},inverted:x=!1,form:g,...f}=e,v=h.useRef(new Set),b=h.useRef(0),j=i==="horizontal"?fy:hy,[y=[],N]=Vt({prop:u,defaultProp:d,onChange:A=>{var I;(I=[...v.current][b.current])==null||I.focus(),p(A)}}),C=h.useRef(y);function k(A){const I=yy(y,A);R(A,I)}function _(A){R(A,b.current)}function w(){const A=C.current[b.current];y[b.current]!==A&&m(y)}function R(A,I,{commit:F}={commit:!1}){const V=Cy(s),M=Sy(Math.round((A-a)/s)*s+a,V),U=wr(M,[a,n]);N(($=[])=>{const T=vy($,U,I);if(Ny(T,c*s)){b.current=T.indexOf(U);const D=String(T)!==String($);return D&&F&&m(T),D?T:$}else return $})}return o.jsx(my,{scope:e.__scopeSlider,name:r,disabled:l,min:a,max:n,valueIndexToChangeRef:b,thumbs:v.current,values:y,orientation:i,form:g,children:o.jsx(Oo.Provider,{scope:e.__scopeSlider,children:o.jsx(Oo.Slot,{scope:e.__scopeSlider,children:o.jsx(j,{"aria-disabled":l,"data-disabled":l?"":void 0,...f,ref:t,onPointerDown:oe(f.onPointerDown,()=>{l||(C.current=y)}),min:a,max:n,inverted:x,onSlideStart:l?void 0:k,onSlideMove:l?void 0:_,onSlideEnd:l?void 0:w,onHomeKeyDown:()=>!l&&R(a,0,{commit:!0}),onEndKeyDown:()=>!l&&R(n,y.length-1,{commit:!0}),onStepKeyDown:({event:A,direction:I})=>{if(!l){const F=Zd.includes(A.key)||A.shiftKey&&Xd.includes(A.key)?10:1,V=b.current,M=y[V],U=s*F*I;R(M+U,V,{commit:!0})}}})})})})});Kd.displayName=hr;var[Jd,Qd]=Yd(hr,{startEdge:"left",endEdge:"right",size:"width",direction:1}),fy=h.forwardRef((e,t)=>{const{min:r,max:a,dir:n,inverted:s,onSlideStart:i,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...u}=e,[p,m]=h.useState(null),x=pe(t,y=>m(y)),g=h.useRef(void 0),f=fn(n),v=f==="ltr",b=v&&!s||!v&&s;function j(y){const N=g.current||p.getBoundingClientRect(),C=[0,N.width],k=Ln(C,b?[r,a]:[a,r]);return g.current=N,k(y-N.left)}return o.jsx(Jd,{scope:e.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:o.jsx(eu,{dir:f,"data-orientation":"horizontal",...u,ref:x,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:y=>{const N=j(y.clientX);i==null||i(N)},onSlideMove:y=>{const N=j(y.clientX);l==null||l(N)},onSlideEnd:()=>{g.current=void 0,c==null||c()},onStepKeyDown:y=>{const N=Gd[b?"from-left":"from-right"].includes(y.key);d==null||d({event:y,direction:N?-1:1})}})})}),hy=h.forwardRef((e,t)=>{const{min:r,max:a,inverted:n,onSlideStart:s,onSlideMove:i,onSlideEnd:l,onStepKeyDown:c,...d}=e,u=h.useRef(null),p=pe(t,u),m=h.useRef(void 0),x=!n;function g(f){const v=m.current||u.current.getBoundingClientRect(),b=[0,v.height],j=Ln(b,x?[a,r]:[r,a]);return m.current=v,j(f-v.top)}return o.jsx(Jd,{scope:e.__scopeSlider,startEdge:x?"bottom":"top",endEdge:x?"top":"bottom",size:"height",direction:x?1:-1,children:o.jsx(eu,{"data-orientation":"vertical",...d,ref:p,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:f=>{const v=g(f.clientY);s==null||s(v)},onSlideMove:f=>{const v=g(f.clientY);i==null||i(v)},onSlideEnd:()=>{m.current=void 0,l==null||l()},onStepKeyDown:f=>{const v=Gd[x?"from-bottom":"from-top"].includes(f.key);c==null||c({event:f,direction:v?-1:1})}})})}),eu=h.forwardRef((e,t)=>{const{__scopeSlider:r,onSlideStart:a,onSlideMove:n,onSlideEnd:s,onHomeKeyDown:i,onEndKeyDown:l,onStepKeyDown:c,...d}=e,u=Va(hr,r);return o.jsx(le.span,{...d,ref:t,onKeyDown:oe(e.onKeyDown,p=>{p.key==="Home"?(i(p),p.preventDefault()):p.key==="End"?(l(p),p.preventDefault()):Zd.concat(Xd).includes(p.key)&&(c(p),p.preventDefault())}),onPointerDown:oe(e.onPointerDown,p=>{const m=p.target;m.setPointerCapture(p.pointerId),p.preventDefault(),u.thumbs.has(m)?m.focus():a(p)}),onPointerMove:oe(e.onPointerMove,p=>{p.target.hasPointerCapture(p.pointerId)&&n(p)}),onPointerUp:oe(e.onPointerUp,p=>{const m=p.target;m.hasPointerCapture(p.pointerId)&&(m.releasePointerCapture(p.pointerId),s(p))})})}),tu="SliderTrack",ru=h.forwardRef((e,t)=>{const{__scopeSlider:r,...a}=e,n=Va(tu,r);return o.jsx(le.span,{"data-disabled":n.disabled?"":void 0,"data-orientation":n.orientation,...a,ref:t})});ru.displayName=tu;var Do="SliderRange",au=h.forwardRef((e,t)=>{const{__scopeSlider:r,...a}=e,n=Va(Do,r),s=Qd(Do,r),i=h.useRef(null),l=pe(t,i),c=n.values.length,d=n.values.map(m=>su(m,n.min,n.max)),u=c>1?Math.min(...d):0,p=100-Math.max(...d);return o.jsx(le.span,{"data-orientation":n.orientation,"data-disabled":n.disabled?"":void 0,...a,ref:l,style:{...e.style,[s.startEdge]:u+"%",[s.endEdge]:p+"%"}})});au.displayName=Do;var Ao="SliderThumb",ou=h.forwardRef((e,t)=>{const r=uy(e.__scopeSlider),[a,n]=h.useState(null),s=pe(t,l=>n(l)),i=h.useMemo(()=>a?r().findIndex(l=>l.ref.current===a):-1,[r,a]);return o.jsx(xy,{...e,ref:s,index:i})}),xy=h.forwardRef((e,t)=>{const{__scopeSlider:r,index:a,name:n,...s}=e,i=Va(Ao,r),l=Qd(Ao,r),[c,d]=h.useState(null),u=pe(t,j=>d(j)),p=c?i.form||!!c.closest("form"):!0,m=un(c),x=i.values[a],g=x===void 0?0:su(x,i.min,i.max),f=by(a,i.values.length),v=m==null?void 0:m[l.size],b=v?wy(v,g,l.direction):0;return h.useEffect(()=>{if(c)return i.thumbs.add(c),()=>{i.thumbs.delete(c)}},[c,i.thumbs]),o.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${g}% + ${b}px)`},children:[o.jsx(Oo.ItemSlot,{scope:e.__scopeSlider,children:o.jsx(le.span,{role:"slider","aria-label":e["aria-label"]||f,"aria-valuemin":i.min,"aria-valuenow":x,"aria-valuemax":i.max,"aria-orientation":i.orientation,"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,tabIndex:i.disabled?void 0:0,...s,ref:u,style:x===void 0?{display:"none"}:e.style,onFocus:oe(e.onFocus,()=>{i.valueIndexToChangeRef.current=a})})}),p&&o.jsx(nu,{name:n??(i.name?i.name+(i.values.length>1?"[]":""):void 0),form:i.form,value:x},a)]})});ou.displayName=Ao;var gy="RadioBubbleInput",nu=h.forwardRef(({__scopeSlider:e,value:t,...r},a)=>{const n=h.useRef(null),s=pe(n,a),i=dn(t);return h.useEffect(()=>{const l=n.current;if(!l)return;const c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(i!==t&&d){const u=new Event("input",{bubbles:!0});d.call(l,t),l.dispatchEvent(u)}},[i,t]),o.jsx(le.input,{style:{display:"none"},...r,ref:s,defaultValue:t})});nu.displayName=gy;function vy(e=[],t,r){const a=[...e];return a[r]=t,a.sort((n,s)=>n-s)}function su(e,t,r){const a=100/(r-t)*(e-t);return wr(a,[0,100])}function by(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function yy(e,t){if(e.length===1)return 0;const r=e.map(n=>Math.abs(n-t)),a=Math.min(...r);return r.indexOf(a)}function wy(e,t,r){const a=e/2,n=Ln([0,50],[0,a]);return(a-n(t)*r)*r}function jy(e){return e.slice(0,-1).map((t,r)=>e[r+1]-t)}function Ny(e,t){if(t>0){const r=jy(e);return Math.min(...r)>=t}return!0}function Ln(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const a=(t[1]-t[0])/(e[1]-e[0]);return t[0]+a*(r-e[0])}}function Cy(e){return(String(e).split(".")[1]||"").length}function Sy(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}var iu=Kd,ky=ru,_y=au,Ey=ou;const lu=h.forwardRef(({className:e,...t},r)=>o.jsxs(iu,{ref:r,className:G("relative flex w-full touch-none select-none items-center",e),...t,children:[o.jsx(ky,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:o.jsx(_y,{className:"absolute h-full bg-primary"})}),o.jsx(Ey,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));lu.displayName=iu.displayName;const Py=({inicioColuna:e,tamanho:t,onSelect:r})=>o.jsxs("div",{className:"space-y-2",children:[o.jsx(W,{className:"text-xs",children:"Posição no grid"}),o.jsx("div",{className:"flex gap-0.5",children:Array.from({length:12},(a,n)=>{const s=n+1,i=s>=e&&s<e+t;return o.jsx("button",{onClick:()=>r(s),className:G("flex-1 h-6 rounded-sm text-[8px] font-mono transition-all border",i?"bg-primary text-primary-foreground border-primary":"bg-muted/50 text-muted-foreground/50 border-border/50 hover:bg-muted hover:border-border"),children:s},s)})}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Início: col ",e," · Span: ",t]})]}),cu=({tamanho:e,inicioColuna:t,defaultTamanho:r=6,onTamanhoChange:a,onPositionChange:n})=>{const s=13-t;return o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsxs(W,{className:"text-xs",children:["Tamanho (",e,"/12 colunas)"]}),o.jsx(lu,{value:[e],onValueChange:([i])=>{const l=Math.min(i,s);a(l)},min:1,max:s,step:1,className:"py-1"}),o.jsxs("div",{className:"flex justify-between text-[9px] text-muted-foreground",children:[o.jsx("span",{children:"1"}),o.jsx("span",{children:"3"}),o.jsx("span",{children:"6"}),o.jsx("span",{children:"9"}),o.jsx("span",{children:"12"})]})]}),o.jsx(Py,{inicioColuna:t,tamanho:e,onSelect:i=>{const l=13-i,c=Math.min(e,l);n(i),c!==e&&a(c)}})]})},Ty=({config:e,onUpdate:t})=>o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Label"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.label,onChange:r=>t({label:r.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Descrição"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do container"})]}),o.jsx(Ec,{value:e.icone,onChange:r=>t({icone:r})}),o.jsx(cu,{tamanho:e.tamanho||12,inicioColuna:e.inicioColuna||1,defaultTamanho:12,onTamanhoChange:r=>t({tamanho:r}),onPositionChange:r=>t({inicioColuna:r})}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Colunas internas"}),o.jsxs(Ge,{value:String(e.columns||2),onValueChange:r=>t({columns:Number(r)}),children:[o.jsx(He,{className:"h-8 text-sm",children:o.jsx(Ye,{})}),o.jsxs(We,{children:[o.jsx(Se,{value:"1",children:"1 coluna"}),o.jsx(Se,{value:"2",children:"2 colunas"}),o.jsx(Se,{value:"3",children:"3 colunas"}),o.jsx(Se,{value:"4",children:"4 colunas"})]})]}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Grid interno simplificado para campos"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),o.jsx(W,{htmlFor:"show-label",className:"text-xs cursor-pointer",children:"Exibir label no formulário"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"show-as-card",checked:e.showAsCard||!1,onCheckedChange:r=>t({showAsCard:r===!0})}),o.jsx(W,{htmlFor:"show-as-card",className:"text-xs cursor-pointer",children:"Exibir como card"})]})]}),Ba=h.forwardRef(({className:e,...t},r)=>o.jsx("textarea",{className: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",e),ref:r,...t}));Ba.displayName="Textarea";function $y(e,t=[]){let r=[];function a(s,i){const l=h.createContext(i);l.displayName=s+"Context";const c=r.length;r=[...r,i];const d=p=>{var m;const{scope:x,children:g,...f}=p,v=((m=x==null?void 0:x[e])==null?void 0:m[c])||l,b=h.useMemo(()=>f,Object.values(f));return o.jsx(v.Provider,{value:b,children:g})};d.displayName=s+"Provider";function u(p,m){var x;const g=((x=m==null?void 0:m[e])==null?void 0:x[c])||l,f=h.useContext(g);if(f)return f;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[d,u]}const n=()=>{const s=r.map(i=>h.createContext(i));return function(i){const l=(i==null?void 0:i[e])||s;return h.useMemo(()=>({[`__scope${e}`]:{...i,[e]:l}}),[i,l])}};return n.scopeName=e,[a,Ry(n,...t)]}function Ry(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const a=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(n){const s=a.reduce((i,{useScope:l,scopeName:c})=>{const d=l(n)[`__scope${c}`];return{...i,...d}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var zn="Progress",Mn=100,[Oy]=$y(zn),[Dy,Ay]=Oy(zn),du=h.forwardRef((e,t)=>{const{__scopeProgress:r,value:a=null,max:n,getValueLabel:s=Iy,...i}=e;(n||n===0)&&!ii(n)&&console.error(Ly(`${n}`,"Progress"));const l=ii(n)?n:Mn;a!==null&&!li(a,l)&&console.error(zy(`${a}`,"Progress"));const c=li(a,l)?a:null,d=ia(c)?s(c,l):void 0;return o.jsx(Dy,{scope:r,value:c,max:l,children:o.jsx(ya.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":ia(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":mu(c,l),"data-value":c??void 0,"data-max":l,...i,ref:t})})});du.displayName=zn;var uu="ProgressIndicator",pu=h.forwardRef((e,t)=>{const{__scopeProgress:r,...a}=e,n=Ay(uu,r);return o.jsx(ya.div,{"data-state":mu(n.value,n.max),"data-value":n.value??void 0,"data-max":n.max,...a,ref:t})});pu.displayName=uu;function Iy(e,t){return`${Math.round(e/t*100)}%`}function mu(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function ia(e){return typeof e=="number"}function ii(e){return ia(e)&&!isNaN(e)&&e>0}function li(e,t){return ia(e)&&!isNaN(e)&&e<=t&&e>=0}function Ly(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Mn}\`.`}function zy(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
70
+ `)},hb=0,Fr=[];function xb(e){var t=x.useRef([]),r=x.useRef([0,0]),o=x.useRef(),n=x.useState(hb++)[0],s=x.useState(Ud)[0],l=x.useRef(e);x.useEffect(function(){l.current=e},[e]),x.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(n));var f=Fv([e.lockRef.current],(e.shards||[]).map(vi)).filter(Boolean);return f.forEach(function(g){return g.classList.add("allow-interactivity-".concat(n))}),function(){document.body.classList.remove("block-interactivity-".concat(n)),f.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(n))})}}},[e.inert,e.lockRef.current,e.shards]);var i=x.useCallback(function(f,g){if("touches"in f&&f.touches.length===2||f.type==="wheel"&&f.ctrlKey)return!l.current.allowPinchZoom;var w=Va(f),v=r.current,b="deltaX"in f?f.deltaX:v[0]-w[0],j="deltaY"in f?f.deltaY:v[1]-w[1],N,S=f.target,$=Math.abs(b)>Math.abs(j)?"h":"v";if("touches"in f&&$==="h"&&S.type==="range")return!1;var C=window.getSelection(),E=C&&C.anchorNode,A=E?E===S||E.contains(S):!1;if(A)return!1;var I=xi($,S);if(!I)return!0;if(I?N=$:(N=$==="v"?"h":"v",I=xi($,S)),!I)return!1;if(!o.current&&"changedTouches"in f&&(b||j)&&(o.current=N),!N)return!0;var M=o.current||N;return mb(M,g,f,M==="h"?b:j)},[]),c=x.useCallback(function(f){var g=f;if(!(!Fr.length||Fr[Fr.length-1]!==s)){var w="deltaY"in g?gi(g):Va(g),v=t.current.filter(function(N){return N.name===g.type&&(N.target===g.target||g.target===N.shadowParent)&&pb(N.delta,w)})[0];if(v&&v.should){g.cancelable&&g.preventDefault();return}if(!v){var b=(l.current.shards||[]).map(vi).filter(Boolean).filter(function(N){return N.contains(g.target)}),j=b.length>0?i(g,b[0]):!l.current.noIsolation;j&&g.cancelable&&g.preventDefault()}}},[]),d=x.useCallback(function(f,g,w,v){var b={name:f,delta:g,target:w,should:v,shadowParent:gb(w)};t.current.push(b),setTimeout(function(){t.current=t.current.filter(function(j){return j!==b})},1)},[]),m=x.useCallback(function(f){r.current=Va(f),o.current=void 0},[]),u=x.useCallback(function(f){d(f.type,gi(f),f.target,i(f,e.lockRef.current))},[]),h=x.useCallback(function(f){d(f.type,Va(f),f.target,i(f,e.lockRef.current))},[]);x.useEffect(function(){return Fr.push(s),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Ir),document.addEventListener("touchmove",c,Ir),document.addEventListener("touchstart",m,Ir),function(){Fr=Fr.filter(function(f){return f!==s}),document.removeEventListener("wheel",c,Ir),document.removeEventListener("touchmove",c,Ir),document.removeEventListener("touchstart",m,Ir)}},[]);var p=e.removeScrollBar,y=e.inert;return x.createElement(x.Fragment,null,y?x.createElement(s,{styles:fb(n)}):null,p?x.createElement(nb,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function gb(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const vb=qv(Bd,xb);var Oo=x.forwardRef(function(e,t){return x.createElement(Po,Vt({},e,{ref:t,sideCar:vb}))});Oo.classNames=Po.classNames;var bb=[" ","Enter","ArrowUp","ArrowDown"],yb=[" ","Enter"],$r="Select",[Io,Fo,wb]=_s($r),[aa]=jt($r,[wb,ra]),Lo=ra(),[jb,fr]=aa($r),[Nb,Cb]=aa($r),Xd=e=>{const{__scopeSelect:t,children:r,open:o,defaultOpen:n,onOpenChange:s,value:l,defaultValue:i,onValueChange:c,dir:d,name:m,autoComplete:u,disabled:h,required:p,form:y}=e,f=Lo(t),[g,w]=x.useState(null),[v,b]=x.useState(null),[j,N]=x.useState(!1),S=ja(d),[$,C]=Ut({prop:o,defaultProp:n??!1,onChange:s,caller:$r}),[E,A]=Ut({prop:l,defaultProp:i,onChange:c,caller:$r}),I=x.useRef(null),M=g?y||!!g.closest("form"):!0,[T,B]=x.useState(new Set),q=Array.from(T).map(W=>W.props.value).join(";");return a.jsx(Hs,{...f,children:a.jsxs(jb,{required:p,scope:t,trigger:g,onTriggerChange:w,valueNode:v,onValueNodeChange:b,valueNodeHasChildren:j,onValueNodeHasChildrenChange:N,contentId:Zt(),value:E,onValueChange:A,open:$,onOpenChange:C,dir:S,triggerPointerDownPosRef:I,disabled:h,children:[a.jsx(Io.Provider,{scope:t,children:a.jsx(Nb,{scope:e.__scopeSelect,onNativeOptionAdd:x.useCallback(W=>{B(X=>new Set(X).add(W))},[]),onNativeOptionRemove:x.useCallback(W=>{B(X=>{const V=new Set(X);return V.delete(W),V})},[]),children:r})}),M?a.jsxs(gu,{"aria-hidden":!0,required:p,tabIndex:-1,name:m,autoComplete:u,value:E,onChange:W=>A(W.target.value),disabled:h,form:y,children:[E===void 0?a.jsx("option",{value:""}):null,Array.from(T)]},q):null]})})};Xd.displayName=$r;var Gd="SelectTrigger",Kd=x.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:o=!1,...n}=e,s=Lo(r),l=fr(Gd,r),i=l.disabled||o,c=je(t,l.onTriggerChange),d=Fo(r),m=x.useRef("touch"),[u,h,p]=bu(f=>{const g=d().filter(b=>!b.disabled),w=g.find(b=>b.value===l.value),v=yu(g,f,w);v!==void 0&&l.onValueChange(v.value)}),y=f=>{i||(l.onOpenChange(!0),p()),f&&(l.triggerPointerDownPosRef.current={x:Math.round(f.pageX),y:Math.round(f.pageY)})};return a.jsx(Ro,{asChild:!0,...s,children:a.jsx(be.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:i,"data-disabled":i?"":void 0,"data-placeholder":vu(l.value)?"":void 0,...n,ref:c,onClick:xe(n.onClick,f=>{f.currentTarget.focus(),m.current!=="mouse"&&y(f)}),onPointerDown:xe(n.onPointerDown,f=>{m.current=f.pointerType;const g=f.target;g.hasPointerCapture(f.pointerId)&&g.releasePointerCapture(f.pointerId),f.button===0&&f.ctrlKey===!1&&f.pointerType==="mouse"&&(y(f),f.preventDefault())}),onKeyDown:xe(n.onKeyDown,f=>{const g=u.current!=="";!(f.ctrlKey||f.altKey||f.metaKey)&&f.key.length===1&&h(f.key),!(g&&f.key===" ")&&bb.includes(f.key)&&(y(),f.preventDefault())})})})});Kd.displayName=Gd;var Yd="SelectValue",Zd=x.forwardRef((e,t)=>{const{__scopeSelect:r,className:o,style:n,children:s,placeholder:l="",...i}=e,c=fr(Yd,r),{onValueNodeHasChildrenChange:d}=c,m=s!==void 0,u=je(t,c.onValueNodeChange);return et(()=>{d(m)},[d,m]),a.jsx(be.span,{...i,ref:u,style:{pointerEvents:"none"},children:vu(c.value)?a.jsx(a.Fragment,{children:l}):s})});Zd.displayName=Yd;var kb="SelectIcon",Jd=x.forwardRef((e,t)=>{const{__scopeSelect:r,children:o,...n}=e;return a.jsx(be.span,{"aria-hidden":!0,...n,ref:t,children:o||"▼"})});Jd.displayName=kb;var Sb="SelectPortal",Qd=e=>a.jsx(Do,{asChild:!0,...e});Qd.displayName=Sb;var Er="SelectContent",eu=x.forwardRef((e,t)=>{const r=fr(Er,e.__scopeSelect),[o,n]=x.useState();if(et(()=>{n(new DocumentFragment)},[]),!r.open){const s=o;return s?bo.createPortal(a.jsx(tu,{scope:e.__scopeSelect,children:a.jsx(Io.Slot,{scope:e.__scopeSelect,children:a.jsx("div",{children:e.children})})}),s):null}return a.jsx(ru,{...e,ref:t})});eu.displayName=Er;var Tt=10,[tu,hr]=aa(Er),$b="SelectContentImpl",Eb=Gr("SelectContent.RemoveScroll"),ru=x.forwardRef((e,t)=>{const{__scopeSelect:r,position:o="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:s,onPointerDownOutside:l,side:i,sideOffset:c,align:d,alignOffset:m,arrowPadding:u,collisionBoundary:h,collisionPadding:p,sticky:y,hideWhenDetached:f,avoidCollisions:g,...w}=e,v=fr(Er,r),[b,j]=x.useState(null),[N,S]=x.useState(null),$=je(t,G=>j(G)),[C,E]=x.useState(null),[A,I]=x.useState(null),M=Fo(r),[T,B]=x.useState(!1),q=x.useRef(!1);x.useEffect(()=>{if(b)return Xs(b)},[b]),Os();const W=x.useCallback(G=>{const[Y,...Z]=M().map(ve=>ve.ref.current),[te]=Z.slice(-1),ue=document.activeElement;for(const ve of G)if(ve===ue||(ve==null||ve.scrollIntoView({block:"nearest"}),ve===Y&&N&&(N.scrollTop=0),ve===te&&N&&(N.scrollTop=N.scrollHeight),ve==null||ve.focus(),document.activeElement!==ue))return},[M,N]),X=x.useCallback(()=>W([C,b]),[W,C,b]);x.useEffect(()=>{T&&X()},[T,X]);const{onOpenChange:V,triggerPointerDownPosRef:L}=v;x.useEffect(()=>{if(b){let G={x:0,y:0};const Y=te=>{var ue,ve;G={x:Math.abs(Math.round(te.pageX)-(((ue=L.current)==null?void 0:ue.x)??0)),y:Math.abs(Math.round(te.pageY)-(((ve=L.current)==null?void 0:ve.y)??0))}},Z=te=>{G.x<=10&&G.y<=10?te.preventDefault():b.contains(te.target)||V(!1),document.removeEventListener("pointermove",Y),L.current=null};return L.current!==null&&(document.addEventListener("pointermove",Y),document.addEventListener("pointerup",Z,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Y),document.removeEventListener("pointerup",Z,{capture:!0})}}},[b,V,L]),x.useEffect(()=>{const G=()=>V(!1);return window.addEventListener("blur",G),window.addEventListener("resize",G),()=>{window.removeEventListener("blur",G),window.removeEventListener("resize",G)}},[V]);const[P,se]=bu(G=>{const Y=M().filter(ue=>!ue.disabled),Z=Y.find(ue=>ue.ref.current===document.activeElement),te=yu(Y,G,Z);te&&setTimeout(()=>te.ref.current.focus())}),U=x.useCallback((G,Y,Z)=>{const te=!q.current&&!Z;(v.value!==void 0&&v.value===Y||te)&&(E(G),te&&(q.current=!0))},[v.value]),Q=x.useCallback(()=>b==null?void 0:b.focus(),[b]),ee=x.useCallback((G,Y,Z)=>{const te=!q.current&&!Z;(v.value!==void 0&&v.value===Y||te)&&I(G)},[v.value]),H=o==="popper"?Zn:au,K=H===Zn?{side:i,sideOffset:c,align:d,alignOffset:m,arrowPadding:u,collisionBoundary:h,collisionPadding:p,sticky:y,hideWhenDetached:f,avoidCollisions:g}:{};return a.jsx(tu,{scope:r,content:b,viewport:N,onViewportChange:S,itemRefCallback:U,selectedItem:C,onItemLeave:Q,itemTextRefCallback:ee,focusSelectedItem:X,selectedItemText:A,position:o,isPositioned:T,searchRef:P,children:a.jsx(Oo,{as:Eb,allowPinchZoom:!0,children:a.jsx($o,{asChild:!0,trapped:v.open,onMountAutoFocus:G=>{G.preventDefault()},onUnmountAutoFocus:xe(n,G=>{var Y;(Y=v.trigger)==null||Y.focus({preventScroll:!0}),G.preventDefault()}),children:a.jsx(Ca,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:G=>G.preventDefault(),onDismiss:()=>v.onOpenChange(!1),children:a.jsx(H,{role:"listbox",id:v.contentId,"data-state":v.open?"open":"closed",dir:v.dir,onContextMenu:G=>G.preventDefault(),...w,...K,onPlaced:()=>B(!0),ref:$,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:xe(w.onKeyDown,G=>{const Y=G.ctrlKey||G.altKey||G.metaKey;if(G.key==="Tab"&&G.preventDefault(),!Y&&G.key.length===1&&se(G.key),["ArrowUp","ArrowDown","Home","End"].includes(G.key)){let Z=M().filter(te=>!te.disabled).map(te=>te.ref.current);if(["ArrowUp","End"].includes(G.key)&&(Z=Z.slice().reverse()),["ArrowUp","ArrowDown"].includes(G.key)){const te=G.target,ue=Z.indexOf(te);Z=Z.slice(ue+1)}setTimeout(()=>W(Z)),G.preventDefault()}})})})})})})});ru.displayName=$b;var Ab="SelectItemAlignedPosition",au=x.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:o,...n}=e,s=fr(Er,r),l=hr(Er,r),[i,c]=x.useState(null),[d,m]=x.useState(null),u=je(t,$=>m($)),h=Fo(r),p=x.useRef(!1),y=x.useRef(!0),{viewport:f,selectedItem:g,selectedItemText:w,focusSelectedItem:v}=l,b=x.useCallback(()=>{if(s.trigger&&s.valueNode&&i&&d&&f&&g&&w){const $=s.trigger.getBoundingClientRect(),C=d.getBoundingClientRect(),E=s.valueNode.getBoundingClientRect(),A=w.getBoundingClientRect();if(s.dir!=="rtl"){const te=A.left-C.left,ue=E.left-te,ve=$.left-ue,Ne=$.width+ve,ye=Math.max(Ne,C.width),Be=window.innerWidth-Tt,Ue=fa(ue,[Tt,Math.max(Tt,Be-ye)]);i.style.minWidth=Ne+"px",i.style.left=Ue+"px"}else{const te=C.right-A.right,ue=window.innerWidth-E.right-te,ve=window.innerWidth-$.right-ue,Ne=$.width+ve,ye=Math.max(Ne,C.width),Be=window.innerWidth-Tt,Ue=fa(ue,[Tt,Math.max(Tt,Be-ye)]);i.style.minWidth=Ne+"px",i.style.right=Ue+"px"}const I=h(),M=window.innerHeight-Tt*2,T=f.scrollHeight,B=window.getComputedStyle(d),q=parseInt(B.borderTopWidth,10),W=parseInt(B.paddingTop,10),X=parseInt(B.borderBottomWidth,10),V=parseInt(B.paddingBottom,10),L=q+W+T+V+X,P=Math.min(g.offsetHeight*5,L),se=window.getComputedStyle(f),U=parseInt(se.paddingTop,10),Q=parseInt(se.paddingBottom,10),ee=$.top+$.height/2-Tt,H=M-ee,K=g.offsetHeight/2,G=g.offsetTop+K,Y=q+W+G,Z=L-Y;if(Y<=ee){const te=I.length>0&&g===I[I.length-1].ref.current;i.style.bottom="0px";const ue=d.clientHeight-f.offsetTop-f.offsetHeight,ve=Math.max(H,K+(te?Q:0)+ue+X),Ne=Y+ve;i.style.height=Ne+"px"}else{const te=I.length>0&&g===I[0].ref.current;i.style.top="0px";const ue=Math.max(ee,q+f.offsetTop+(te?U:0)+K)+Z;i.style.height=ue+"px",f.scrollTop=Y-ee+f.offsetTop}i.style.margin=`${Tt}px 0`,i.style.minHeight=P+"px",i.style.maxHeight=M+"px",o==null||o(),requestAnimationFrame(()=>p.current=!0)}},[h,s.trigger,s.valueNode,i,d,f,g,w,s.dir,o]);et(()=>b(),[b]);const[j,N]=x.useState();et(()=>{d&&N(window.getComputedStyle(d).zIndex)},[d]);const S=x.useCallback($=>{$&&y.current===!0&&(b(),v==null||v(),y.current=!1)},[b,v]);return a.jsx(Tb,{scope:r,contentWrapper:i,shouldExpandOnScrollRef:p,onScrollButtonChange:S,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:j},children:a.jsx(be.div,{...n,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});au.displayName=Ab;var _b="SelectPopperPosition",Zn=x.forwardRef((e,t)=>{const{__scopeSelect:r,align:o="start",collisionPadding:n=Tt,...s}=e,l=Lo(r);return a.jsx(Ws,{...l,...s,ref:t,align:o,collisionPadding:n,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Zn.displayName=_b;var[Tb,Gs]=aa(Er,{}),Jn="SelectViewport",ou=x.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:o,...n}=e,s=hr(Jn,r),l=Gs(Jn,r),i=je(t,s.onViewportChange),c=x.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),a.jsx(Io.Slot,{scope:r,children:a.jsx(be.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:i,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:xe(n.onScroll,d=>{const m=d.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:h}=l;if(h!=null&&h.current&&u){const p=Math.abs(c.current-m.scrollTop);if(p>0){const y=window.innerHeight-Tt*2,f=parseFloat(u.style.minHeight),g=parseFloat(u.style.height),w=Math.max(f,g);if(w<y){const v=w+p,b=Math.min(y,v),j=v-b;u.style.height=b+"px",u.style.bottom==="0px"&&(m.scrollTop=j>0?j:0,u.style.justifyContent="flex-end")}}}c.current=m.scrollTop})})})]})});ou.displayName=Jn;var nu="SelectGroup",[Rb,Db]=aa(nu),Pb=x.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e,n=Zt();return a.jsx(Rb,{scope:r,id:n,children:a.jsx(be.div,{role:"group","aria-labelledby":n,...o,ref:t})})});Pb.displayName=nu;var su="SelectLabel",lu=x.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e,n=Db(su,r);return a.jsx(be.div,{id:n.id,...o,ref:t})});lu.displayName=su;var oo="SelectItem",[Ob,iu]=aa(oo),cu=x.forwardRef((e,t)=>{const{__scopeSelect:r,value:o,disabled:n=!1,textValue:s,...l}=e,i=fr(oo,r),c=hr(oo,r),d=i.value===o,[m,u]=x.useState(s??""),[h,p]=x.useState(!1),y=je(t,v=>{var b;return(b=c.itemRefCallback)==null?void 0:b.call(c,v,o,n)}),f=Zt(),g=x.useRef("touch"),w=()=>{n||(i.onValueChange(o),i.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(Ob,{scope:r,value:o,disabled:n,textId:f,isSelected:d,onItemTextChange:x.useCallback(v=>{u(b=>b||((v==null?void 0:v.textContent)??"").trim())},[]),children:a.jsx(Io.ItemSlot,{scope:r,value:o,disabled:n,textValue:m,children:a.jsx(be.div,{role:"option","aria-labelledby":f,"data-highlighted":h?"":void 0,"aria-selected":d&&h,"data-state":d?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...l,ref:y,onFocus:xe(l.onFocus,()=>p(!0)),onBlur:xe(l.onBlur,()=>p(!1)),onClick:xe(l.onClick,()=>{g.current!=="mouse"&&w()}),onPointerUp:xe(l.onPointerUp,()=>{g.current==="mouse"&&w()}),onPointerDown:xe(l.onPointerDown,v=>{g.current=v.pointerType}),onPointerMove:xe(l.onPointerMove,v=>{var b;g.current=v.pointerType,n?(b=c.onItemLeave)==null||b.call(c):g.current==="mouse"&&v.currentTarget.focus({preventScroll:!0})}),onPointerLeave:xe(l.onPointerLeave,v=>{var b;v.currentTarget===document.activeElement&&((b=c.onItemLeave)==null||b.call(c))}),onKeyDown:xe(l.onKeyDown,v=>{var b;((b=c.searchRef)==null?void 0:b.current)!==""&&v.key===" "||(yb.includes(v.key)&&w(),v.key===" "&&v.preventDefault())})})})})});cu.displayName=oo;var ma="SelectItemText",du=x.forwardRef((e,t)=>{const{__scopeSelect:r,className:o,style:n,...s}=e,l=fr(ma,r),i=hr(ma,r),c=iu(ma,r),d=Cb(ma,r),[m,u]=x.useState(null),h=je(t,w=>u(w),c.onItemTextChange,w=>{var v;return(v=i.itemTextRefCallback)==null?void 0:v.call(i,w,c.value,c.disabled)}),p=m==null?void 0:m.textContent,y=x.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:f,onNativeOptionRemove:g}=d;return et(()=>(f(y),()=>g(y)),[f,g,y]),a.jsxs(a.Fragment,{children:[a.jsx(be.span,{id:c.textId,...s,ref:h}),c.isSelected&&l.valueNode&&!l.valueNodeHasChildren?bo.createPortal(s.children,l.valueNode):null]})});du.displayName=ma;var uu="SelectItemIndicator",mu=x.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e;return iu(uu,r).isSelected?a.jsx(be.span,{"aria-hidden":!0,...o,ref:t}):null});mu.displayName=uu;var Qn="SelectScrollUpButton",pu=x.forwardRef((e,t)=>{const r=hr(Qn,e.__scopeSelect),o=Gs(Qn,e.__scopeSelect),[n,s]=x.useState(!1),l=je(t,o.onScrollButtonChange);return et(()=>{if(r.viewport&&r.isPositioned){let i=function(){const d=c.scrollTop>0;s(d)};const c=r.viewport;return i(),c.addEventListener("scroll",i),()=>c.removeEventListener("scroll",i)}},[r.viewport,r.isPositioned]),n?a.jsx(hu,{...e,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=r;i&&c&&(i.scrollTop=i.scrollTop-c.offsetHeight)}}):null});pu.displayName=Qn;var es="SelectScrollDownButton",fu=x.forwardRef((e,t)=>{const r=hr(es,e.__scopeSelect),o=Gs(es,e.__scopeSelect),[n,s]=x.useState(!1),l=je(t,o.onScrollButtonChange);return et(()=>{if(r.viewport&&r.isPositioned){let i=function(){const d=c.scrollHeight-c.clientHeight,m=Math.ceil(c.scrollTop)<d;s(m)};const c=r.viewport;return i(),c.addEventListener("scroll",i),()=>c.removeEventListener("scroll",i)}},[r.viewport,r.isPositioned]),n?a.jsx(hu,{...e,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=r;i&&c&&(i.scrollTop=i.scrollTop+c.offsetHeight)}}):null});fu.displayName=es;var hu=x.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:o,...n}=e,s=hr("SelectScrollButton",r),l=x.useRef(null),i=Fo(r),c=x.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return x.useEffect(()=>()=>c(),[c]),et(()=>{var d;const m=i().find(u=>u.ref.current===document.activeElement);(d=m==null?void 0:m.ref.current)==null||d.scrollIntoView({block:"nearest"})},[i]),a.jsx(be.div,{"aria-hidden":!0,...n,ref:t,style:{flexShrink:0,...n.style},onPointerDown:xe(n.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(o,50))}),onPointerMove:xe(n.onPointerMove,()=>{var d;(d=s.onItemLeave)==null||d.call(s),l.current===null&&(l.current=window.setInterval(o,50))}),onPointerLeave:xe(n.onPointerLeave,()=>{c()})})}),Ib="SelectSeparator",xu=x.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e;return a.jsx(be.div,{"aria-hidden":!0,...o,ref:t})});xu.displayName=Ib;var ts="SelectArrow",Fb=x.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e,n=Lo(r),s=fr(ts,r),l=hr(ts,r);return s.open&&l.position==="popper"?a.jsx(qs,{...n,...o,ref:t}):null});Fb.displayName=ts;var Lb="SelectBubbleInput",gu=x.forwardRef(({__scopeSelect:e,value:t,...r},o)=>{const n=x.useRef(null),s=je(o,n),l=ya(t);return x.useEffect(()=>{const i=n.current;if(!i)return;const c=window.HTMLSelectElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(l!==t&&d){const m=new Event("change",{bubbles:!0});d.call(i,t),i.dispatchEvent(m)}},[l,t]),a.jsx(be.select,{...r,style:{...Fd,...r.style},ref:s,defaultValue:t})});gu.displayName=Lb;function vu(e){return e===""||e===void 0}function bu(e){const t=ot(e),r=x.useRef(""),o=x.useRef(0),n=x.useCallback(l=>{const i=r.current+l;t(i),function c(d){r.current=d,window.clearTimeout(o.current),d!==""&&(o.current=window.setTimeout(()=>c(""),1e3))}(i)},[t]),s=x.useCallback(()=>{r.current="",window.clearTimeout(o.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(o.current),[]),[r,n,s]}function yu(e,t,r){const o=t.length>1&&Array.from(t).every(i=>i===t[0])?t[0]:t,n=r?e.indexOf(r):-1;let s=Mb(e,Math.max(n,0));o.length===1&&(s=s.filter(i=>i!==r));const l=s.find(i=>i.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==r?l:void 0}function Mb(e,t){return e.map((r,o)=>e[(t+o)%e.length])}var Vb=Xd,wu=Kd,zb=Zd,Bb=Jd,Ub=Qd,ju=eu,Hb=ou,Nu=lu,Cu=cu,Wb=du,qb=mu,ku=pu,Su=fu,$u=xu;const $t=Vb,Et=zb,bt=x.forwardRef(({className:e,children:t,...r},o)=>a.jsxs(wu,{ref:o,className:J("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...r,children:[t,a.jsx(Bb,{asChild:!0,children:a.jsx(O.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));bt.displayName=wu.displayName;const Eu=x.forwardRef(({className:e,...t},r)=>a.jsx(ku,{ref:r,className:J("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(O.ChevronUp,{className:"h-4 w-4"})}));Eu.displayName=ku.displayName;const Au=x.forwardRef(({className:e,...t},r)=>a.jsx(Su,{ref:r,className:J("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(O.ChevronDown,{className:"h-4 w-4"})}));Au.displayName=Su.displayName;const yt=x.forwardRef(({className:e,children:t,position:r="popper",...o},n)=>a.jsx(Ub,{children:a.jsxs(ju,{ref:n,className:J("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,...o,children:[a.jsx(Eu,{}),a.jsx(Hb,{className:J("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(Au,{})]})}));yt.displayName=ju.displayName;const Xb=x.forwardRef(({className:e,...t},r)=>a.jsx(Nu,{ref:r,className:J("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));Xb.displayName=Nu.displayName;const ze=x.forwardRef(({className:e,children:t,...r},o)=>a.jsxs(Cu,{ref:o,className:J("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(qb,{children:a.jsx(O.Check,{className:"h-4 w-4"})})}),a.jsx(Wb,{children:t})]}));ze.displayName=Cu.displayName;const Gb=x.forwardRef(({className:e,...t},r)=>a.jsx($u,{ref:r,className:J("-mx-1 my-1 h-px bg-muted",e),...t}));Gb.displayName=$u.displayName;var _u=["PageUp","PageDown"],Tu=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Ru={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},oa="Slider",[rs,Kb,Yb]=_s(oa),[Du]=jt(oa,[Yb]),[Zb,Mo]=Du(oa),Pu=x.forwardRef((e,t)=>{const{name:r,min:o=0,max:n=100,step:s=1,orientation:l="horizontal",disabled:i=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[o],value:m,onValueChange:u=()=>{},onValueCommit:h=()=>{},inverted:p=!1,form:y,...f}=e,g=x.useRef(new Set),w=x.useRef(0),v=l==="horizontal"?Jb:Qb,[b=[],j]=Ut({prop:m,defaultProp:d,onChange:A=>{var I;(I=[...g.current][w.current])==null||I.focus(),u(A)}}),N=x.useRef(b);function S(A){const I=oy(b,A);E(A,I)}function $(A){E(A,w.current)}function C(){const A=N.current[w.current];b[w.current]!==A&&h(b)}function E(A,I,{commit:M}={commit:!1}){const T=iy(s),B=cy(Math.round((A-o)/s)*s+o,T),q=fa(B,[o,n]);j((W=[])=>{const X=ry(W,q,I);if(ly(X,c*s)){w.current=X.indexOf(q);const V=String(X)!==String(W);return V&&M&&h(X),V?X:W}else return W})}return a.jsx(Zb,{scope:e.__scopeSlider,name:r,disabled:i,min:o,max:n,valueIndexToChangeRef:w,thumbs:g.current,values:b,orientation:l,form:y,children:a.jsx(rs.Provider,{scope:e.__scopeSlider,children:a.jsx(rs.Slot,{scope:e.__scopeSlider,children:a.jsx(v,{"aria-disabled":i,"data-disabled":i?"":void 0,...f,ref:t,onPointerDown:xe(f.onPointerDown,()=>{i||(N.current=b)}),min:o,max:n,inverted:p,onSlideStart:i?void 0:S,onSlideMove:i?void 0:$,onSlideEnd:i?void 0:C,onHomeKeyDown:()=>!i&&E(o,0,{commit:!0}),onEndKeyDown:()=>!i&&E(n,b.length-1,{commit:!0}),onStepKeyDown:({event:A,direction:I})=>{if(!i){const M=_u.includes(A.key)||A.shiftKey&&Tu.includes(A.key)?10:1,T=w.current,B=b[T],q=s*M*I;E(B+q,T,{commit:!0})}}})})})})});Pu.displayName=oa;var[Ou,Iu]=Du(oa,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Jb=x.forwardRef((e,t)=>{const{min:r,max:o,dir:n,inverted:s,onSlideStart:l,onSlideMove:i,onSlideEnd:c,onStepKeyDown:d,...m}=e,[u,h]=x.useState(null),p=je(t,b=>h(b)),y=x.useRef(void 0),f=ja(n),g=f==="ltr",w=g&&!s||!g&&s;function v(b){const j=y.current||u.getBoundingClientRect(),N=[0,j.width],S=Ks(N,w?[r,o]:[o,r]);return y.current=j,S(b-j.left)}return a.jsx(Ou,{scope:e.__scopeSlider,startEdge:w?"left":"right",endEdge:w?"right":"left",direction:w?1:-1,size:"width",children:a.jsx(Fu,{dir:f,"data-orientation":"horizontal",...m,ref:p,style:{...m.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:b=>{const j=v(b.clientX);l==null||l(j)},onSlideMove:b=>{const j=v(b.clientX);i==null||i(j)},onSlideEnd:()=>{y.current=void 0,c==null||c()},onStepKeyDown:b=>{const j=Ru[w?"from-left":"from-right"].includes(b.key);d==null||d({event:b,direction:j?-1:1})}})})}),Qb=x.forwardRef((e,t)=>{const{min:r,max:o,inverted:n,onSlideStart:s,onSlideMove:l,onSlideEnd:i,onStepKeyDown:c,...d}=e,m=x.useRef(null),u=je(t,m),h=x.useRef(void 0),p=!n;function y(f){const g=h.current||m.current.getBoundingClientRect(),w=[0,g.height],v=Ks(w,p?[o,r]:[r,o]);return h.current=g,v(f-g.top)}return a.jsx(Ou,{scope:e.__scopeSlider,startEdge:p?"bottom":"top",endEdge:p?"top":"bottom",size:"height",direction:p?1:-1,children:a.jsx(Fu,{"data-orientation":"vertical",...d,ref:u,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:f=>{const g=y(f.clientY);s==null||s(g)},onSlideMove:f=>{const g=y(f.clientY);l==null||l(g)},onSlideEnd:()=>{h.current=void 0,i==null||i()},onStepKeyDown:f=>{const g=Ru[p?"from-bottom":"from-top"].includes(f.key);c==null||c({event:f,direction:g?-1:1})}})})}),Fu=x.forwardRef((e,t)=>{const{__scopeSlider:r,onSlideStart:o,onSlideMove:n,onSlideEnd:s,onHomeKeyDown:l,onEndKeyDown:i,onStepKeyDown:c,...d}=e,m=Mo(oa,r);return a.jsx(be.span,{...d,ref:t,onKeyDown:xe(e.onKeyDown,u=>{u.key==="Home"?(l(u),u.preventDefault()):u.key==="End"?(i(u),u.preventDefault()):_u.concat(Tu).includes(u.key)&&(c(u),u.preventDefault())}),onPointerDown:xe(e.onPointerDown,u=>{const h=u.target;h.setPointerCapture(u.pointerId),u.preventDefault(),m.thumbs.has(h)?h.focus():o(u)}),onPointerMove:xe(e.onPointerMove,u=>{u.target.hasPointerCapture(u.pointerId)&&n(u)}),onPointerUp:xe(e.onPointerUp,u=>{const h=u.target;h.hasPointerCapture(u.pointerId)&&(h.releasePointerCapture(u.pointerId),s(u))})})}),Lu="SliderTrack",Mu=x.forwardRef((e,t)=>{const{__scopeSlider:r,...o}=e,n=Mo(Lu,r);return a.jsx(be.span,{"data-disabled":n.disabled?"":void 0,"data-orientation":n.orientation,...o,ref:t})});Mu.displayName=Lu;var as="SliderRange",Vu=x.forwardRef((e,t)=>{const{__scopeSlider:r,...o}=e,n=Mo(as,r),s=Iu(as,r),l=x.useRef(null),i=je(t,l),c=n.values.length,d=n.values.map(h=>Uu(h,n.min,n.max)),m=c>1?Math.min(...d):0,u=100-Math.max(...d);return a.jsx(be.span,{"data-orientation":n.orientation,"data-disabled":n.disabled?"":void 0,...o,ref:i,style:{...e.style,[s.startEdge]:m+"%",[s.endEdge]:u+"%"}})});Vu.displayName=as;var os="SliderThumb",zu=x.forwardRef((e,t)=>{const r=Kb(e.__scopeSlider),[o,n]=x.useState(null),s=je(t,i=>n(i)),l=x.useMemo(()=>o?r().findIndex(i=>i.ref.current===o):-1,[r,o]);return a.jsx(ey,{...e,ref:s,index:l})}),ey=x.forwardRef((e,t)=>{const{__scopeSlider:r,index:o,name:n,...s}=e,l=Mo(os,r),i=Iu(os,r),[c,d]=x.useState(null),m=je(t,v=>d(v)),u=c?l.form||!!c.closest("form"):!0,h=wa(c),p=l.values[o],y=p===void 0?0:Uu(p,l.min,l.max),f=ay(o,l.values.length),g=h==null?void 0:h[i.size],w=g?ny(g,y,i.direction):0;return x.useEffect(()=>{if(c)return l.thumbs.add(c),()=>{l.thumbs.delete(c)}},[c,l.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[i.startEdge]:`calc(${y}% + ${w}px)`},children:[a.jsx(rs.ItemSlot,{scope:e.__scopeSlider,children:a.jsx(be.span,{role:"slider","aria-label":e["aria-label"]||f,"aria-valuemin":l.min,"aria-valuenow":p,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...s,ref:m,style:p===void 0?{display:"none"}:e.style,onFocus:xe(e.onFocus,()=>{l.valueIndexToChangeRef.current=o})})}),u&&a.jsx(Bu,{name:n??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:p},o)]})});zu.displayName=os;var ty="RadioBubbleInput",Bu=x.forwardRef(({__scopeSlider:e,value:t,...r},o)=>{const n=x.useRef(null),s=je(n,o),l=ya(t);return x.useEffect(()=>{const i=n.current;if(!i)return;const c=window.HTMLInputElement.prototype,d=Object.getOwnPropertyDescriptor(c,"value").set;if(l!==t&&d){const m=new Event("input",{bubbles:!0});d.call(i,t),i.dispatchEvent(m)}},[l,t]),a.jsx(be.input,{style:{display:"none"},...r,ref:s,defaultValue:t})});Bu.displayName=ty;function ry(e=[],t,r){const o=[...e];return o[r]=t,o.sort((n,s)=>n-s)}function Uu(e,t,r){const o=100/(r-t)*(e-t);return fa(o,[0,100])}function ay(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function oy(e,t){if(e.length===1)return 0;const r=e.map(n=>Math.abs(n-t)),o=Math.min(...r);return r.indexOf(o)}function ny(e,t,r){const o=e/2,n=Ks([0,50],[0,o]);return(o-n(t)*r)*r}function sy(e){return e.slice(0,-1).map((t,r)=>e[r+1]-t)}function ly(e,t){if(t>0){const r=sy(e);return Math.min(...r)>=t}return!0}function Ks(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const o=(t[1]-t[0])/(e[1]-e[0]);return t[0]+o*(r-e[0])}}function iy(e){return(String(e).split(".")[1]||"").length}function cy(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}var Hu=Pu,dy=Mu,uy=Vu,my=zu;const Vo=x.forwardRef(({className:e,...t},r)=>a.jsxs(Hu,{ref:r,className:J("relative flex w-full touch-none select-none items-center",e),...t,children:[a.jsx(dy,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(uy,{className:"absolute h-full bg-primary"})}),a.jsx(my,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));Vo.displayName=Hu.displayName;const py=x.forwardRef(({className:e,type:t="date",...r},o)=>a.jsx("input",{ref:o,type:t,className:J("flex h-10 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",e),...r}));py.displayName="DateInput";function fy(e,t=[]){let r=[];function o(s,l){const i=x.createContext(l);i.displayName=s+"Context";const c=r.length;r=[...r,l];const d=u=>{var h;const{scope:p,children:y,...f}=u,g=((h=p==null?void 0:p[e])==null?void 0:h[c])||i,w=x.useMemo(()=>f,Object.values(f));return a.jsx(g.Provider,{value:w,children:y})};d.displayName=s+"Provider";function m(u,h){var p;const y=((p=h==null?void 0:h[e])==null?void 0:p[c])||i,f=x.useContext(y);if(f)return f;if(l!==void 0)return l;throw new Error(`\`${u}\` must be used within \`${s}\``)}return[d,m]}const n=()=>{const s=r.map(l=>x.createContext(l));return function(l){const i=(l==null?void 0:l[e])||s;return x.useMemo(()=>({[`__scope${e}`]:{...l,[e]:i}}),[l,i])}};return n.scopeName=e,[o,hy(n,...t)]}function hy(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const o=e.map(n=>({useScope:n(),scopeName:n.scopeName}));return function(n){const s=o.reduce((l,{useScope:i,scopeName:c})=>{const d=i(n)[`__scope${c}`];return{...l,...d}},{});return x.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return r.scopeName=t.scopeName,r}var Ys="Progress",Zs=100,[xy]=fy(Ys),[gy,vy]=xy(Ys),Wu=x.forwardRef((e,t)=>{const{__scopeProgress:r,value:o=null,max:n,getValueLabel:s=by,...l}=e;(n||n===0)&&!bi(n)&&console.error(yy(`${n}`,"Progress"));const i=bi(n)?n:Zs;o!==null&&!yi(o,i)&&console.error(wy(`${o}`,"Progress"));const c=yi(o,i)?o:null,d=no(c)?s(c,i):void 0;return a.jsx(gy,{scope:r,value:c,max:i,children:a.jsx(No.div,{"aria-valuemax":i,"aria-valuemin":0,"aria-valuenow":no(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":Gu(c,i),"data-value":c??void 0,"data-max":i,...l,ref:t})})});Wu.displayName=Ys;var qu="ProgressIndicator",Xu=x.forwardRef((e,t)=>{const{__scopeProgress:r,...o}=e,n=vy(qu,r);return a.jsx(No.div,{"data-state":Gu(n.value,n.max),"data-value":n.value??void 0,"data-max":n.max,...o,ref:t})});Xu.displayName=qu;function by(e,t){return`${Math.round(e/t*100)}%`}function Gu(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function no(e){return typeof e=="number"}function bi(e){return no(e)&&!isNaN(e)&&e>0}function yi(e,t){return no(e)&&!isNaN(e)&&e<=t&&e>=0}function yy(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Zs}\`.`}function wy(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be:
77
71
  - a positive number
78
- - less than the value passed to \`max\` (or ${Mn} if no \`max\` prop is set)
72
+ - less than the value passed to \`max\` (or ${Zs} if no \`max\` prop is set)
79
73
  - \`null\` or \`undefined\` if the progress is indeterminate.
80
74
 
81
- Defaulting to \`null\`.`}var fu=du,My=pu;const hu=h.forwardRef(({className:e,value:t,...r},a)=>o.jsx(fu,{ref:a,className:G("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...r,children:o.jsx(My,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));hu.displayName=fu.displayName;var[Ua]=bt("Tooltip",[mr]),Ha=mr(),xu="TooltipProvider",Fy=700,Io="tooltip.open",[Vy,Fn]=Ua(xu),gu=e=>{const{__scopeTooltip:t,delayDuration:r=Fy,skipDelayDuration:a=300,disableHoverableContent:n=!1,children:s}=e,i=h.useRef(!0),l=h.useRef(!1),c=h.useRef(0);return h.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),o.jsx(Vy,{scope:t,isOpenDelayedRef:i,delayDuration:r,onOpen:h.useCallback(()=>{window.clearTimeout(c.current),i.current=!1},[]),onClose:h.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>i.current=!0,a)},[a]),isPointerInTransitRef:l,onPointerInTransitChange:h.useCallback(d=>{l.current=d},[]),disableHoverableContent:n,children:s})};gu.displayName=xu;var Nr="Tooltip",[By,Wa]=Ua(Nr),vu=e=>{const{__scopeTooltip:t,children:r,open:a,defaultOpen:n,onOpenChange:s,disableHoverableContent:i,delayDuration:l}=e,c=Fn(Nr,e.__scopeTooltip),d=Ha(t),[u,p]=h.useState(null),m=_t(),x=h.useRef(0),g=i??c.disableHoverableContent,f=l??c.delayDuration,v=h.useRef(!1),[b,j]=Vt({prop:a,defaultProp:n??!1,onChange:_=>{_?(c.onOpen(),document.dispatchEvent(new CustomEvent(Io))):c.onClose(),s==null||s(_)},caller:Nr}),y=h.useMemo(()=>b?v.current?"delayed-open":"instant-open":"closed",[b]),N=h.useCallback(()=>{window.clearTimeout(x.current),x.current=0,v.current=!1,j(!0)},[j]),C=h.useCallback(()=>{window.clearTimeout(x.current),x.current=0,j(!1)},[j]),k=h.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{v.current=!0,j(!0),x.current=0},f)},[f,j]);return h.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),o.jsx(Rn,{...d,children:o.jsx(By,{scope:t,contentId:m,open:b,stateAttribute:y,trigger:u,onTriggerChange:p,onTriggerEnter:h.useCallback(()=>{c.isOpenDelayedRef.current?k():N()},[c.isOpenDelayedRef,k,N]),onTriggerLeave:h.useCallback(()=>{g?C():(window.clearTimeout(x.current),x.current=0)},[C,g]),onOpen:N,onClose:C,disableHoverableContent:g,children:r})})};vu.displayName=Nr;var Lo="TooltipTrigger",bu=h.forwardRef((e,t)=>{const{__scopeTooltip:r,...a}=e,n=Wa(Lo,r),s=Fn(Lo,r),i=Ha(r),l=h.useRef(null),c=pe(t,l,n.onTriggerChange),d=h.useRef(!1),u=h.useRef(!1),p=h.useCallback(()=>d.current=!1,[]);return h.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),o.jsx(Da,{asChild:!0,...i,children:o.jsx(le.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...a,ref:c,onPointerMove:oe(e.onPointerMove,m=>{m.pointerType!=="touch"&&!u.current&&!s.isPointerInTransitRef.current&&(n.onTriggerEnter(),u.current=!0)}),onPointerLeave:oe(e.onPointerLeave,()=>{n.onTriggerLeave(),u.current=!1}),onPointerDown:oe(e.onPointerDown,()=>{n.open&&n.onClose(),d.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:oe(e.onFocus,()=>{d.current||n.onOpen()}),onBlur:oe(e.onBlur,n.onClose),onClick:oe(e.onClick,n.onClose)})})});bu.displayName=Lo;var Uy="TooltipPortal",[K0,Hy]=Ua(Uy,{forceMount:void 0}),lr="TooltipContent",yu=h.forwardRef((e,t)=>{const r=Hy(lr,e.__scopeTooltip),{forceMount:a=r.forceMount,side:n="top",...s}=e,i=Wa(lr,e.__scopeTooltip);return o.jsx(Qe,{present:a||i.open,children:i.disableHoverableContent?o.jsx(wu,{side:n,...s,ref:t}):o.jsx(Wy,{side:n,...s,ref:t})})}),Wy=h.forwardRef((e,t)=>{const r=Wa(lr,e.__scopeTooltip),a=Fn(lr,e.__scopeTooltip),n=h.useRef(null),s=pe(t,n),[i,l]=h.useState(null),{trigger:c,onClose:d}=r,u=n.current,{onPointerInTransitChange:p}=a,m=h.useCallback(()=>{l(null),p(!1)},[p]),x=h.useCallback((g,f)=>{const v=g.currentTarget,b={x:g.clientX,y:g.clientY},j=Yy(b,v.getBoundingClientRect()),y=Ky(b,j),N=Jy(f.getBoundingClientRect()),C=e0([...y,...N]);l(C),p(!0)},[p]);return h.useEffect(()=>()=>m(),[m]),h.useEffect(()=>{if(c&&u){const g=v=>x(v,u),f=v=>x(v,c);return c.addEventListener("pointerleave",g),u.addEventListener("pointerleave",f),()=>{c.removeEventListener("pointerleave",g),u.removeEventListener("pointerleave",f)}}},[c,u,x,m]),h.useEffect(()=>{if(i){const g=f=>{const v=f.target,b={x:f.clientX,y:f.clientY},j=(c==null?void 0:c.contains(v))||(u==null?void 0:u.contains(v)),y=!Qy(b,i);j?m():y&&(m(),d())};return document.addEventListener("pointermove",g),()=>document.removeEventListener("pointermove",g)}},[c,u,i,d,m]),o.jsx(wu,{...e,ref:s})}),[qy,Zy]=Ua(Nr,{isInside:!1}),Xy=gx("TooltipContent"),wu=h.forwardRef((e,t)=>{const{__scopeTooltip:r,children:a,"aria-label":n,onEscapeKeyDown:s,onPointerDownOutside:i,...l}=e,c=Wa(lr,r),d=Ha(r),{onClose:u}=c;return h.useEffect(()=>(document.addEventListener(Io,u),()=>document.removeEventListener(Io,u)),[u]),h.useEffect(()=>{if(c.trigger){const p=m=>{const x=m.target;x!=null&&x.contains(c.trigger)&&u()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[c.trigger,u]),o.jsx(kr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:p=>p.preventDefault(),onDismiss:u,children:o.jsxs(On,{"data-state":c.stateAttribute,...d,...l,ref:t,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[o.jsx(Xy,{children:a}),o.jsx(qy,{scope:r,isInside:!0,children:o.jsx(Db,{id:c.contentId,role:"tooltip",children:n||a})})]})})});yu.displayName=lr;var ju="TooltipArrow",Gy=h.forwardRef((e,t)=>{const{__scopeTooltip:r,...a}=e,n=Ha(r);return Zy(ju,r).isInside?null:o.jsx(Dn,{...n,...a,ref:t})});Gy.displayName=ju;function Yy(e,t){const r=Math.abs(t.top-e.y),a=Math.abs(t.bottom-e.y),n=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(r,a,n,s)){case s:return"left";case n:return"right";case r:return"top";case a:return"bottom";default:throw new Error("unreachable")}}function Ky(e,t,r=5){const a=[];switch(t){case"top":a.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":a.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":a.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":a.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return a}function Jy(e){const{top:t,right:r,bottom:a,left:n}=e;return[{x:n,y:t},{x:r,y:t},{x:r,y:a},{x:n,y:a}]}function Qy(e,t){const{x:r,y:a}=e;let n=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const l=t[s],c=t[i],d=l.x,u=l.y,p=c.x,m=c.y;u>a!=m>a&&r<(p-d)*(a-u)/(m-u)+d&&(n=!n)}return n}function e0(e){const t=e.slice();return t.sort((r,a)=>r.x<a.x?-1:r.x>a.x?1:r.y<a.y?-1:r.y>a.y?1:0),t0(t)}function t0(e){if(e.length<=1)return e.slice();const t=[];for(let a=0;a<e.length;a++){const n=e[a];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(n.y-i.y)>=(s.y-i.y)*(n.x-i.x))t.pop();else break}t.push(n)}t.pop();const r=[];for(let a=e.length-1;a>=0;a--){const n=e[a];for(;r.length>=2;){const s=r[r.length-1],i=r[r.length-2];if((s.x-i.x)*(n.y-i.y)>=(s.y-i.y)*(n.x-i.x))r.pop();else break}r.push(n)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var r0=gu,a0=vu,o0=bu,Nu=yu;const n0=r0,Cu=a0,Su=o0,Vn=h.forwardRef(({className:e,sideOffset:t=4,...r},a)=>o.jsx(Nu,{ref:a,sideOffset:t,className:G("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));Vn.displayName=Nu.displayName;const s0=cn("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground",success:"border-transparent bg-green-500 text-white shadow"}},defaultVariants:{variant:"default"}});function qa({className:e,variant:t,...r}){return o.jsx("div",{className:G(s0({variant:t}),e),...r})}const zo=[{category:"Texto básico",presets:[{pattern:"^[A-Za-z]+$",label:"Apenas letras",description:"Aceita somente letras de A-Z (maiúsculas e minúsculas), sem espaços, números ou especiais."},{pattern:"^[a-z]+$",label:"Apenas minúsculas",description:"Aceita somente letras minúsculas de a-z."},{pattern:"^[A-Z]+$",label:"Apenas maiúsculas",description:"Aceita somente letras maiúsculas de A-Z."},{pattern:"^[A-Za-zÀ-ÿ]+$",label:"Letras com acentos",description:"Aceita letras incluindo acentuadas (é, ã, ü, etc.)."},{pattern:"^[A-Za-zÀ-ÿ\\s]+$",label:"Letras, acentos e espaços",description:"Aceita letras com acentos e espaços — ideal para nomes completos."},{pattern:"^[A-Za-z0-9]+$",label:"Alfanumérico",description:"Apenas letras e números, sem espaços ou caracteres especiais."},{pattern:"^[A-Za-z0-9\\s]+$",label:"Alfanumérico com espaços",description:"Letras, números e espaços."},{pattern:"^[A-Za-z0-9_]+$",label:"Alfanumérico + underscore",description:"Letras, números e underscore (_). Padrão para usernames."},{pattern:"^[A-Za-z0-9_-]+$",label:"Slug-friendly",description:"Letras, números, underscore e hífen. Ideal para slugs de URL."},{pattern:"^\\S+$",label:"Sem espaços",description:"Aceita qualquer caractere exceto espaços em branco."},{pattern:"^.{1,}$",label:"Não vazio",description:"Exige pelo menos 1 caractere (qualquer um)."}]},{category:"Números",presets:[{pattern:"^[0-9]+$",label:"Apenas dígitos",description:"Aceita somente dígitos numéricos (0-9)."},{pattern:"^-?[0-9]+$",label:"Inteiro (com negativo)",description:"Número inteiro, opcionalmente negativo."},{pattern:"^[0-9]+\\.?[0-9]*$",label:"Decimal positivo",description:"Número decimal positivo (ex: 3.14, 42)."},{pattern:"^-?[0-9]+\\.?[0-9]*$",label:"Decimal (com negativo)",description:"Número decimal, opcionalmente negativo."},{pattern:"^\\d{1,3}(\\.\\d{3})*(,\\d{2})?$",label:"Formato BR (1.234,56)",description:"Número no formato brasileiro com pontos de milhar e vírgula decimal."},{pattern:"^\\d{1,3}(,\\d{3})*(\\.\\d{2})?$",label:"Formato US (1,234.56)",description:"Número no formato americano com vírgulas de milhar e ponto decimal."},{pattern:"^[01]+$",label:"Binário",description:"Aceita apenas 0 e 1 — representação binária."},{pattern:"^[0-9A-Fa-f]+$",label:"Hexadecimal",description:"Aceita dígitos hexadecimais (0-9, A-F)."},{pattern:"^0[xX][0-9A-Fa-f]+$",label:"Hex com prefixo 0x",description:"Hexadecimal com prefixo 0x (ex: 0xFF)."},{pattern:"^[0-7]+$",label:"Octal",description:"Aceita apenas dígitos octais (0-7)."},{pattern:"^\\d+(\\.\\d{1,2})?$",label:"Monetário (2 casas)",description:"Número com até 2 casas decimais — ideal para valores monetários."},{pattern:"^\\d+(\\.\\d{1,4})?$",label:"Até 4 casas decimais",description:"Número com até 4 casas decimais."}]},{category:"Documentos BR",presets:[{pattern:"^\\d{3}\\.\\d{3}\\.\\d{3}-\\d{2}$",label:"CPF (com máscara)",description:"CPF formatado: 123.456.789-00."},{pattern:"^\\d{11}$",label:"CPF (sem máscara)",description:"CPF apenas dígitos: 12345678900."},{pattern:"^\\d{2}\\.\\d{3}\\.\\d{3}/\\d{4}-\\d{2}$",label:"CNPJ (com máscara)",description:"CNPJ formatado: 12.345.678/0001-00."},{pattern:"^\\d{14}$",label:"CNPJ (sem máscara)",description:"CNPJ apenas dígitos: 12345678000100."},{pattern:"^\\d{5}-?\\d{3}$",label:"CEP",description:"CEP brasileiro: 12345-678 ou 12345678."},{pattern:"^\\d{1,2}\\.\\d{3}\\.\\d{3}[-]?\\d{1}$",label:"RG (formato comum)",description:"RG no formato mais comum: 1.234.567-8."},{pattern:"^\\d{11}$",label:"PIS/PASEP",description:"PIS/PASEP com 11 dígitos."},{pattern:"^\\d{3}\\.?\\d{7}-?\\d{1}$",label:"Título de eleitor",description:"Título de eleitor com 12 dígitos."},{pattern:"^[A-Z]{2}\\d{7}$",label:"Passaporte BR",description:"Passaporte brasileiro: 2 letras + 7 dígitos (ex: AB1234567)."},{pattern:"^\\d{11}$",label:"CNH (registro)",description:"Número de registro da CNH: 11 dígitos."},{pattern:"^\\d{10}$",label:"Certidão (matrícula)",description:"Matrícula de certidão de nascimento/casamento."},{pattern:"^\\d{3}\\.\\d{3}\\.\\d{3}-\\d{2}$|^\\d{2}\\.\\d{3}\\.\\d{3}/\\d{4}-\\d{2}$",label:"CPF ou CNPJ",description:"Aceita CPF (123.456.789-00) ou CNPJ (12.345.678/0001-00)."}]},{category:"Contato",presets:[{pattern:"^[\\w.-]+@[\\w.-]+\\.[A-Za-z]{2,}$",label:"E-mail simples",description:"Validação básica de e-mail: usuario@dominio.com."},{pattern:"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",label:"E-mail completo",description:"E-mail com mais caracteres aceitos no usuário."},{pattern:"^\\(\\d{2}\\)\\s?\\d{4,5}-\\d{4}$",label:"Telefone BR (com máscara)",description:"Telefone formatado: (11) 91234-5678 ou (11) 1234-5678."},{pattern:"^\\d{10,11}$",label:"Telefone BR (sem máscara)",description:"Telefone apenas dígitos: 11912345678."},{pattern:"^\\+\\d{1,3}\\s?\\d{2,3}\\s?\\d{4,5}[-]?\\d{4}$",label:"Telefone internacional",description:"Formato +55 11 91234-5678."},{pattern:"^\\+55\\d{10,11}$",label:"Celular BR (+55)",description:"Celular brasileiro com DDI: +5511912345678."},{pattern:"^\\d{4,5}-\\d{4}$",label:"Telefone (sem DDD)",description:"Número local: 1234-5678 ou 91234-5678."},{pattern:"^0800\\d{6,7}$",label:"0800",description:"Número 0800 (SAC): 0800XXXXXXX."}]},{category:"Internet / URLs",presets:[{pattern:"^https?://[\\w.-]+(:\\d+)?(/[\\w./-]*)*$",label:"URL HTTP/HTTPS",description:"URL completa com protocolo http ou https."},{pattern:"^(https?://)?[\\w.-]+\\.[A-Za-z]{2,}(/.*)?$",label:"URL (protocolo opcional)",description:"URL com ou sem http:// na frente."},{pattern:"^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*\\.[a-z]{2,}$",label:"Domínio",description:"Nome de domínio válido: exemplo.com.br."},{pattern:"^((25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$",label:"IPv4",description:"Endereço IPv4: 192.168.0.1."},{pattern:"^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$",label:"IPv6 (completo)",description:"Endereço IPv6 completo."},{pattern:"^[a-z][a-z0-9-]*$",label:"Subdomínio",description:"Nome de subdomínio válido (letra inicial, alfanumérico + hífen)."},{pattern:"^[A-Za-z][A-Za-z0-9+.-]*://.*$",label:"URI genérica",description:"Qualquer URI com esquema (ftp://, mailto:, tel:, etc.)."},{pattern:"^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",label:"Cor hex (#FFF)",description:"Código de cor hexadecimal: #FFF ou #FFFFFF."},{pattern:"^#[0-9A-Fa-f]{8}$",label:"Cor hex com alpha",description:"Cor hexadecimal com canal alpha: #FFFFFFFF."},{pattern:"^rgb\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)$",label:"Cor RGB",description:"Cor no formato rgb(255, 0, 0)."}]},{category:"Data e hora",presets:[{pattern:"^\\d{2}/\\d{2}/\\d{4}$",label:"Data DD/MM/AAAA",description:"Data no formato brasileiro: 25/12/2024."},{pattern:"^\\d{4}-\\d{2}-\\d{2}$",label:"Data ISO (AAAA-MM-DD)",description:"Data no formato ISO 8601: 2024-12-25."},{pattern:"^\\d{2}/\\d{2}/\\d{2}$",label:"Data DD/MM/AA",description:"Data com ano de 2 dígitos: 25/12/24."},{pattern:"^\\d{2}-\\d{2}-\\d{4}$",label:"Data DD-MM-AAAA",description:"Data com hífens: 25-12-2024."},{pattern:"^\\d{2}:\\d{2}$",label:"Hora HH:MM",description:"Horário 24h: 14:30."},{pattern:"^\\d{2}:\\d{2}:\\d{2}$",label:"Hora HH:MM:SS",description:"Horário com segundos: 14:30:59."},{pattern:"^(0[1-9]|1[0-2])/\\d{4}$",label:"Mês/Ano (MM/AAAA)",description:"Mês e ano: 12/2024."},{pattern:"^\\d{4}$",label:"Ano (4 dígitos)",description:"Ano com 4 dígitos: 2024."},{pattern:"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}$",label:"DateTime ISO (sem seg)",description:"Data e hora ISO: 2024-12-25T14:30."},{pattern:"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$",label:"DateTime ISO (com seg)",description:"Data e hora ISO com segundos."},{pattern:"^\\d{2}/\\d{2}/\\d{4}\\s\\d{2}:\\d{2}$",label:"DateTime BR",description:"Data e hora BR: 25/12/2024 14:30."}]},{category:"Senhas",presets:[{pattern:"^.{6,}$",label:"Mín. 6 caracteres",description:"Exige no mínimo 6 caracteres (qualquer tipo)."},{pattern:"^.{8,}$",label:"Mín. 8 caracteres",description:"Exige no mínimo 8 caracteres."},{pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).{8,}$",label:"Forte (letra+número)",description:"Mín. 8 chars com pelo menos 1 maiúscula, 1 minúscula e 1 número."},{pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[!@#$%^&*]).{8,}$",label:"Muito forte",description:"Mín. 8 chars com maiúscula, minúscula, número e caractere especial."},{pattern:"^(?=.*[A-Z])(?=.*\\d).{6,}$",label:"Média (maiúsc+número)",description:"Mín. 6 chars com pelo menos 1 maiúscula e 1 número."},{pattern:"^(?!.*\\s).{8,}$",label:"Sem espaços (mín. 8)",description:"Mín. 8 caracteres, sem espaços."}]},{category:"Nomes e texto formatado",presets:[{pattern:"^[A-Za-zÀ-ÿ]{2,}(\\s[A-Za-zÀ-ÿ]{2,})+$",label:"Nome completo",description:"Nome e sobrenome (mínimo 2 palavras, cada com 2+ letras)."},{pattern:"^[A-Za-zÀ-ÿ]{2,}$",label:"Primeiro nome",description:"Apenas o primeiro nome (mínimo 2 letras, com acentos)."},{pattern:"^[A-Za-zÀ-ÿ'\\-\\s]+$",label:"Nome com apóstrofo/hífen",description:"Nome que aceita D'Silva, Maria-José, etc."},{pattern:"^[A-Z][a-zà-ÿ]+(\\s[A-Z][a-zà-ÿ]+)*$",label:"Nome capitalizado",description:"Cada palavra inicia com maiúscula: João Silva."},{pattern:"^@[A-Za-z0-9_]{1,30}$",label:"Username (@handle)",description:"Username no estilo @usuario (letras, números, underscore, até 30 chars)."},{pattern:"^[a-z0-9_]{3,20}$",label:"Username simples",description:"Username minúsculo: 3-20 chars, letras, números e underscore."},{pattern:"^[A-Za-z0-9._%+-]+$",label:"Parte local do e-mail",description:"Parte antes do @ em endereços de e-mail."}]},{category:"Endereço",presets:[{pattern:"^[A-Za-zÀ-ÿ0-9\\s,./-]+$",label:"Endereço genérico",description:"Aceita letras, números, espaços, vírgulas, pontos, barras e hífens."},{pattern:"^\\d{1,6}$",label:"Número residencial",description:"Número do endereço: 1 a 6 dígitos."},{pattern:"^\\d{5}-?\\d{3}$",label:"CEP",description:"CEP: 12345-678 ou 12345678."},{pattern:"^[A-Z]{2}$",label:"UF (estado)",description:"Sigla do estado brasileiro: SP, RJ, MG, etc."},{pattern:"^(Rua|Av|Avenida|Travessa|Alameda|Praça|Rod|Rodovia)\\s.+$",label:"Logradouro BR",description:"Começa com tipo de via: Rua, Avenida, Travessa, etc."},{pattern:"^(Apt|Apto|Sala|Bloco|Lote|Casa)\\s?\\d+.*$",label:"Complemento",description:"Complemento: Apto 123, Bloco B, Sala 3, etc."}]},{category:"Financeiro",presets:[{pattern:"^R\\$\\s?\\d{1,3}(\\.\\d{3})*(,\\d{2})?$",label:"Moeda BRL (R$)",description:"Valor em reais: R$ 1.234,56."},{pattern:"^\\$\\d{1,3}(,\\d{3})*(\\.\\d{2})?$",label:"Moeda USD ($)",description:"Valor em dólares: $1,234.56."},{pattern:"^\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}$",label:"Cartão de crédito",description:"Número de cartão: 1234 5678 9012 3456."},{pattern:"^(0[1-9]|1[0-2])/\\d{2}$",label:"Validade cartão (MM/AA)",description:"Data de validade: 12/25."},{pattern:"^\\d{3,4}$",label:"CVV",description:"Código de segurança: 3 ou 4 dígitos."},{pattern:"^\\d{1,6}(-[0-9Xx])?$",label:"Agência bancária",description:"Número da agência: 1234-5 ou 1234."},{pattern:"^\\d{1,12}(-[0-9Xx])?$",label:"Conta bancária",description:"Número da conta: até 12 dígitos com dígito verificador."},{pattern:"^\\d{1,3}(\\.\\d{3})*(,\\d{2})$",label:"Valor BR sem símbolo",description:"Valor monetário sem R$: 1.234,56."}]},{category:"Veículos",presets:[{pattern:"^[A-Z]{3}-?\\d{4}$",label:"Placa antiga (ABC-1234)",description:"Placa veicular formato antigo: ABC-1234."},{pattern:"^[A-Z]{3}\\d[A-Z]\\d{2}$",label:"Placa Mercosul (ABC1D23)",description:"Placa veicular Mercosul: ABC1D23."},{pattern:"^[A-Z]{3}-?\\d{4}$|^[A-Z]{3}\\d[A-Z]\\d{2}$",label:"Placa (ambos formatos)",description:"Aceita placa antiga (ABC-1234) ou Mercosul (ABC1D23)."},{pattern:"^\\d{11}$",label:"RENAVAM",description:"RENAVAM: 11 dígitos numéricos."},{pattern:"^[A-Z0-9]{17}$",label:"Chassi (VIN)",description:"Número de chassi/VIN: 17 caracteres alfanuméricos maiúsculos."}]},{category:"Códigos e identificadores",presets:[{pattern:"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",label:"UUID v4",description:"UUID formato padrão: 550e8400-e29b-41d4-a716-446655440000."},{pattern:"^[A-Za-z0-9+/]+={0,2}$",label:"Base64",description:"String codificada em Base64."},{pattern:"^[A-Za-z0-9-_]+$",label:"Base64 URL-safe",description:"Base64 com caracteres seguros para URL."},{pattern:"^[0-9a-f]{32}$",label:"MD5 hash",description:"Hash MD5: 32 caracteres hexadecimais."},{pattern:"^[0-9a-f]{40}$",label:"SHA-1 hash",description:"Hash SHA-1: 40 caracteres hexadecimais."},{pattern:"^[0-9a-f]{64}$",label:"SHA-256 hash",description:"Hash SHA-256: 64 caracteres hexadecimais."},{pattern:"^\\d{8,14}$",label:"Código de barras",description:"Código de barras numérico: 8-14 dígitos."},{pattern:"^\\d{44}$",label:"Linha digitável boleto",description:"Linha digitável de boleto: 44 dígitos."},{pattern:"^[A-Z]{2}\\d{2}[A-Z0-9]{4}\\d{7}([A-Z0-9]?){0,16}\\d{2}$",label:"IBAN",description:"Código bancário internacional IBAN."},{pattern:"^[A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?$",label:"SWIFT/BIC",description:"Código SWIFT bancário: 8 ou 11 caracteres."}]},{category:"Saúde e governo",presets:[{pattern:"^\\d{15}$",label:"Cartão SUS",description:"Número do Cartão Nacional de Saúde: 15 dígitos."},{pattern:"^\\d{6,7}$",label:"CRM/CRO/CRP",description:"Número de registro profissional de saúde."},{pattern:"^\\d{3}\\.\\d{5}\\.\\d{2}-\\d$",label:"NIT/PIS",description:"Número de Identificação do Trabalhador."},{pattern:"^\\d{7}-?\\d{2}\\.\\d{4}\\.\\d\\.\\d{2}\\.\\d{4}$",label:"Processo judicial",description:"Número de processo judicial (formato CNJ)."},{pattern:"^\\d{12}$",label:"Inscrição estadual (genérica)",description:"Inscrição estadual genérica: 12 dígitos."},{pattern:"^\\d{11}$",label:"NIS/NIT",description:"Número de Identificação Social: 11 dígitos."}]},{category:"Redes sociais",presets:[{pattern:"^https?://(www\\.)?instagram\\.com/[A-Za-z0-9_.]+/?$",label:"Perfil Instagram",description:"URL de perfil do Instagram."},{pattern:"^https?://(www\\.)?facebook\\.com/.+$",label:"Perfil Facebook",description:"URL de perfil ou página do Facebook."},{pattern:"^https?://(www\\.)?linkedin\\.com/in/[A-Za-z0-9-]+/?$",label:"Perfil LinkedIn",description:"URL de perfil do LinkedIn."},{pattern:"^https?://(www\\.)?(twitter|x)\\.com/[A-Za-z0-9_]+/?$",label:"Perfil Twitter/X",description:"URL de perfil no Twitter/X."},{pattern:"^https?://(www\\.)?youtube\\.com/(c/|channel/|@)[A-Za-z0-9_-]+/?$",label:"Canal YouTube",description:"URL de canal do YouTube."},{pattern:"^https?://(www\\.)?github\\.com/[A-Za-z0-9_-]+/?$",label:"Perfil GitHub",description:"URL de perfil do GitHub."},{pattern:"^https?://(www\\.)?tiktok\\.com/@[A-Za-z0-9_.]+/?$",label:"Perfil TikTok",description:"URL de perfil do TikTok."}]},{category:"Programação",presets:[{pattern:"^[a-z][a-zA-Z0-9]*$",label:"camelCase",description:"Formato camelCase: minúscula inicial, sem espaços."},{pattern:"^[A-Z][a-zA-Z0-9]*$",label:"PascalCase",description:"Formato PascalCase: maiúscula inicial."},{pattern:"^[a-z]+(_[a-z]+)*$",label:"snake_case",description:"Formato snake_case: minúsculas separadas por underscore."},{pattern:"^[a-z]+(-[a-z]+)*$",label:"kebab-case",description:"Formato kebab-case: minúsculas separadas por hífen."},{pattern:"^[A-Z]+(_[A-Z]+)*$",label:"SCREAMING_SNAKE",description:"Constantes: MAIÚSCULAS_COM_UNDERSCORES."},{pattern:"^[a-zA-Z_$][a-zA-Z0-9_$]*$",label:"Variável JS válida",description:"Nome de variável JavaScript válido."},{pattern:"^v?\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.]+)?$",label:"Semver",description:"Versionamento semântico: v1.2.3 ou 1.2.3-beta.1."},{pattern:"^[a-z][a-z0-9]*(-[a-z][a-z0-9]*)*$",label:"Nome de pacote npm",description:"Nome válido de pacote npm."}]}],i0=zo.flatMap(e=>e.presets),l0=({value:e,message:t,onChange:r})=>{const[a,n]=E.useState(!1),[s,i]=E.useState(""),l=E.useMemo(()=>{if(!s.trim())return zo;const u=s.toLowerCase();return zo.map(p=>({...p,presets:p.presets.filter(m=>m.label.toLowerCase().includes(u)||m.description.toLowerCase().includes(u)||m.pattern.toLowerCase().includes(u))})).filter(p=>p.presets.length>0)},[s]),c=E.useMemo(()=>e?i0.find(u=>u.pattern===e):void 0,[e]),d=u=>{r(u.pattern,`${u.label}: formato inválido`),n(!1),i("")};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(W,{className:"text-[10px]",children:"Regex"}),o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(ae,{value:e??"",onChange:u=>r(u.target.value||void 0,t),className:"h-7 text-xs font-mono flex-1",placeholder:"Clique no botão ou digite..."}),e&&o.jsx(ye,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>{r(void 0,void 0)},children:o.jsx(P.X,{className:"h-3 w-3"})}),o.jsxs(Ia,{open:a,onOpenChange:n,children:[o.jsx(La,{asChild:!0,children:o.jsx(ye,{variant:"outline",size:"icon",className:"h-7 w-7 shrink-0",children:o.jsx(P.Regex,{className:"h-3.5 w-3.5"})})}),o.jsxs(Pr,{className:"w-[360px] p-0",side:"left",align:"start",sideOffset:8,children:[o.jsx("div",{className:"p-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(P.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(ae,{value:s,onChange:u=>i(u.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar regex (ex: CPF, e-mail, senha)...",autoFocus:!0})]})}),o.jsx(Ca,{className:"h-[360px]",children:o.jsxs("div",{className:"p-1",children:[l.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Nenhum regex encontrado"}),l.map(u=>o.jsxs("div",{className:"mb-1",children:[o.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide px-2 py-1.5 sticky top-0 bg-popover z-10",children:u.category}),u.presets.map(p=>o.jsxs(Cu,{children:[o.jsx(Su,{asChild:!0,children:o.jsxs("button",{onClick:()=>d(p),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-accent transition-colors group",children:[o.jsx(P.ChevronRight,{className:"h-3 w-3 text-muted-foreground/50 group-hover:text-primary shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-xs font-medium block truncate",children:p.label}),o.jsx("span",{className:"text-[10px] text-muted-foreground font-mono block truncate",children:p.pattern})]})]})}),o.jsxs(Vn,{side:"left",className:"max-w-[250px] text-xs",children:[o.jsx("p",{className:"font-semibold mb-1",children:p.label}),o.jsx("p",{children:p.description})]})]},p.pattern+p.label))]},u.category))]})})]})]})]}),c&&o.jsxs(qa,{variant:"secondary",className:"text-[10px] font-normal gap-1",children:[o.jsx(P.Regex,{className:"h-2.5 w-2.5"}),c.label]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Mensagem do regex"}),o.jsx(ae,{value:t??"",onChange:u=>r(e,u.target.value||void 0),className:"h-7 text-xs",placeholder:"Formato inválido"})]})]})},Mo=[{category:"Imagens",presets:[{value:"image/jpeg",label:"JPEG",description:"Imagem JPEG — formato mais comum para fotos. Boa compressão, perde qualidade."},{value:"image/png",label:"PNG",description:"Imagem PNG — suporta transparência, sem perda de qualidade. Arquivos maiores."},{value:"image/gif",label:"GIF",description:"Imagem GIF — suporta animações simples e transparência. Limitado a 256 cores."},{value:"image/webp",label:"WebP",description:"Formato moderno do Google — compressão superior ao JPEG e PNG."},{value:"image/svg+xml",label:"SVG",description:"Imagem vetorial XML — escalável sem perda. Ideal para logos e ícones."},{value:"image/bmp",label:"BMP",description:"Bitmap — sem compressão, arquivos muito grandes."},{value:"image/tiff",label:"TIFF",description:"Imagem TIFF — alta qualidade, usado em impressão profissional."},{value:"image/avif",label:"AVIF",description:"Formato moderno — melhor compressão que WebP, suporte crescente."},{value:"image/heic",label:"HEIC",description:"Formato padrão do iPhone — alta qualidade, tamanho reduzido."},{value:"image/*",label:"Qualquer imagem",description:"Aceita todos os formatos de imagem (JPEG, PNG, GIF, WebP, etc.)."}]},{category:"Documentos",presets:[{value:"application/pdf",label:"PDF",description:"Documento PDF — formato universal para documentos. Preserva formatação."},{value:"application/msword",label:"DOC (Word antigo)",description:"Microsoft Word 97-2003 (.doc)."},{value:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",label:"DOCX (Word)",description:"Microsoft Word moderno (.docx) — formato atual do Word."},{value:"application/vnd.ms-excel",label:"XLS (Excel antigo)",description:"Microsoft Excel 97-2003 (.xls)."},{value:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",label:"XLSX (Excel)",description:"Microsoft Excel moderno (.xlsx) — formato atual do Excel."},{value:"application/vnd.ms-powerpoint",label:"PPT (PowerPoint antigo)",description:"Microsoft PowerPoint 97-2003 (.ppt)."},{value:"application/vnd.openxmlformats-officedocument.presentationml.presentation",label:"PPTX (PowerPoint)",description:"Microsoft PowerPoint moderno (.pptx)."},{value:"application/vnd.oasis.opendocument.text",label:"ODT (LibreOffice)",description:"Documento de texto LibreOffice/OpenOffice (.odt)."},{value:"application/vnd.oasis.opendocument.spreadsheet",label:"ODS (LibreOffice)",description:"Planilha LibreOffice/OpenOffice (.ods)."},{value:"application/rtf",label:"RTF",description:"Rich Text Format — compatível com quase todos os editores de texto."},{value:"text/plain",label:"TXT",description:"Texto puro sem formatação (.txt)."},{value:"text/csv",label:"CSV",description:"Valores separados por vírgula — planilhas simples e dados tabulares."}]},{category:"Vídeos",presets:[{value:"video/mp4",label:"MP4",description:"Vídeo MP4 — formato mais compatível, boa compressão (H.264/H.265)."},{value:"video/webm",label:"WebM",description:"Vídeo WebM — formato aberto do Google, boa compressão."},{value:"video/quicktime",label:"MOV",description:"Vídeo QuickTime — formato padrão do macOS/iPhone."},{value:"video/x-msvideo",label:"AVI",description:"Vídeo AVI — formato antigo da Microsoft, arquivos grandes."},{value:"video/x-matroska",label:"MKV",description:"Matroska — contêiner flexível, suporta múltiplas faixas de áudio/legenda."},{value:"video/*",label:"Qualquer vídeo",description:"Aceita todos os formatos de vídeo."}]},{category:"Áudios",presets:[{value:"audio/mpeg",label:"MP3",description:"Áudio MP3 — formato mais popular, boa compressão com perda."},{value:"audio/wav",label:"WAV",description:"Áudio WAV — sem compressão, alta qualidade, arquivos grandes."},{value:"audio/ogg",label:"OGG",description:"Áudio OGG Vorbis — formato aberto, boa qualidade."},{value:"audio/aac",label:"AAC",description:"Áudio AAC — qualidade superior ao MP3 no mesmo bitrate."},{value:"audio/flac",label:"FLAC",description:"Áudio FLAC — compressão sem perda, alta fidelidade."},{value:"audio/webm",label:"WebM Áudio",description:"Áudio no contêiner WebM."},{value:"audio/*",label:"Qualquer áudio",description:"Aceita todos os formatos de áudio."}]},{category:"Compactados",presets:[{value:"application/zip",label:"ZIP",description:"Arquivo compactado ZIP — o mais universal."},{value:"application/x-rar-compressed",label:"RAR",description:"Arquivo compactado RAR — boa compressão, formato proprietário."},{value:"application/gzip",label:"GZ / GZIP",description:"Compactação GZIP — muito usado em ambientes Unix/Linux."},{value:"application/x-7z-compressed",label:"7Z",description:"Arquivo 7-Zip — excelente taxa de compressão."},{value:"application/x-tar",label:"TAR",description:"TAR — agrupa arquivos sem compressão (usado com gzip)."}]},{category:"Dados / Código",presets:[{value:"application/json",label:"JSON",description:"Dados JSON — formato leve para troca de dados."},{value:"application/xml",label:"XML",description:"Dados XML — formato de marcação extensível."},{value:"text/html",label:"HTML",description:"Página web HTML."},{value:"text/css",label:"CSS",description:"Folha de estilo CSS."},{value:"application/javascript",label:"JavaScript",description:"Código JavaScript (.js)."},{value:"application/x-yaml",label:"YAML",description:"Dados YAML — formato legível para configurações."},{value:"text/markdown",label:"Markdown",description:"Texto Markdown (.md) — formatação leve."}]},{category:"Fontes",presets:[{value:"font/ttf",label:"TTF",description:"Fonte TrueType — amplamente suportada."},{value:"font/otf",label:"OTF",description:"Fonte OpenType — recursos tipográficos avançados."},{value:"font/woff",label:"WOFF",description:"Web Open Font Format — otimizado para web."},{value:"font/woff2",label:"WOFF2",description:"WOFF2 — compressão superior ao WOFF."}]},{category:"Atalhos comuns",presets:[{value:"image/*",label:"Todas as imagens",description:"Aceita qualquer formato de imagem."},{value:"video/*",label:"Todos os vídeos",description:"Aceita qualquer formato de vídeo."},{value:"audio/*",label:"Todos os áudios",description:"Aceita qualquer formato de áudio."},{value:"_group_documentos",label:"Documentos comuns",description:"PDF + Word .doc e .docx.",group:["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"]},{value:"_group_imagens_web",label:"Imagens web",description:"JPEG, PNG e WebP — formatos mais usados na web.",group:["image/jpeg","image/png","image/webp"]},{value:"_group_planilhas",label:"Planilhas",description:"Excel .xls, .xlsx e CSV.",group:["application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","text/csv"]}]}],c0=Mo.flatMap(e=>e.presets),d0=({value:e,onChange:t})=>{const[r,a]=E.useState(!1),[n,s]=E.useState(""),[i,l]=E.useState(""),c=E.useMemo(()=>new Set(e??[]),[e]),d=E.useMemo(()=>{if(!n.trim())return Mo;const g=n.toLowerCase();return Mo.map(f=>({...f,presets:f.presets.filter(v=>v.label.toLowerCase().includes(g)||v.description.toLowerCase().includes(g)||v.value.toLowerCase().includes(g))})).filter(f=>f.presets.length>0)},[n]),u=g=>{const f=new Set(e??[]);g.group?g.group.every(v=>f.has(v))?g.group.forEach(v=>f.delete(v)):g.group.forEach(v=>f.add(v)):f.has(g.value)?f.delete(g.value):f.add(g.value),t(f.size>0?Array.from(f):void 0)},p=()=>{const g=i.trim();if(!g)return;const f=new Set(e??[]);f.add(g),t(Array.from(f)),l("")},m=g=>{const f=new Set(e??[]);f.delete(g),t(f.size>0?Array.from(f):void 0)},x=g=>{const f=c0.find(v=>v.value===g);return(f==null?void 0:f.label)??g};return o.jsxs("div",{className:"space-y-2",children:[o.jsx(W,{className:"text-[10px]",children:"Tipos de arquivo aceitos"}),((e==null?void 0:e.length)??0)>0&&o.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(g=>o.jsxs(qa,{variant:"secondary",className:"text-[10px] gap-1 pr-1",children:[x(g),o.jsx("button",{onClick:()=>m(g),className:"hover:text-destructive",children:o.jsx(P.X,{className:"h-2.5 w-2.5"})})]},g))}),o.jsxs(Ia,{open:r,onOpenChange:a,children:[o.jsx(La,{asChild:!0,children:o.jsxs(ye,{variant:"outline",className:"w-full h-8 text-xs justify-start gap-2",children:[o.jsx(P.FileType2,{className:"h-3.5 w-3.5"}),((e==null?void 0:e.length)??0)>0?`${e.length} tipo(s) selecionado(s)`:"Selecionar tipos de arquivo..."]})}),o.jsxs(Pr,{className:"w-[360px] p-0",side:"left",align:"start",sideOffset:8,children:[o.jsx("div",{className:"p-2 border-b",children:o.jsxs("div",{className:"relative",children:[o.jsx(P.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),o.jsx(ae,{value:n,onChange:g=>s(g.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar tipos (ex: PDF, imagem, vídeo)...",autoFocus:!0})]})}),o.jsxs("div",{className:"px-2 py-1.5 border-b flex gap-1",children:[o.jsx(ae,{value:i,onChange:g=>l(g.target.value),className:"h-7 text-xs font-mono flex-1",placeholder:"Tipo customizado (ex: .dwg)",onKeyDown:g=>g.key==="Enter"&&p()}),o.jsx(ye,{variant:"secondary",size:"sm",className:"h-7 text-xs shrink-0",onClick:p,disabled:!i.trim(),children:"Adicionar"})]}),o.jsx(Ca,{className:"h-[320px]",children:o.jsxs("div",{className:"p-1",children:[d.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Nenhum tipo encontrado"}),d.map(g=>o.jsxs("div",{className:"mb-1",children:[o.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide px-2 py-1.5 sticky top-0 bg-popover z-10",children:g.category}),g.presets.map(f=>{const v=f.group?f.group.every(j=>c.has(j)):c.has(f.value),b=f.group?f.group.some(j=>c.has(j))&&!v:!1;return o.jsxs(Cu,{children:[o.jsx(Su,{asChild:!0,children:o.jsxs("button",{onClick:()=>u(f),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-accent transition-colors",children:[o.jsx(Pe,{checked:b?"indeterminate":v,className:"h-3.5 w-3.5",tabIndex:-1}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-xs font-medium",children:f.label}),!f.group&&o.jsx("span",{className:"text-[10px] text-muted-foreground font-mono ml-2",children:f.value}),f.group&&o.jsxs("span",{className:"text-[10px] text-muted-foreground ml-2",children:[f.group.length," tipos"]})]}),o.jsx(P.Info,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"})]})}),o.jsxs(Vn,{side:"left",className:"max-w-[250px] text-xs",children:[o.jsx("p",{className:"font-semibold mb-1",children:f.label}),o.jsx("p",{children:f.description}),f.group&&o.jsx("ul",{className:"mt-1 space-y-0.5",children:f.group.map(j=>o.jsx("li",{className:"font-mono text-[10px] opacity-80",children:j},j))})]})]},f.value)})]},g.category))]})})]})]})]})},ku=1048576,la=1073741824;function ci(e){return e>=la&&e%la===0?"GB":"MB"}function di(e,t){return t==="GB"?e/la:e/ku}function ui(e,t){return Math.round(e*(t==="GB"?la:ku))}const u0=({value:e,onChange:t})=>{const r=E.useMemo(()=>e?ci(e):"MB",[]),[a,n]=E.useState(r),[s,i]=E.useState(e?String(di(e,r)):"");E.useEffect(()=>{if(e===void 0){i("");return}const d=ci(e);n(d),i(String(di(e,d)))},[e]);const l=d=>{i(d);const u=parseFloat(d);d.trim()===""||isNaN(u)||u<=0?t(void 0):t(ui(u,a))},c=d=>{n(d);const u=parseFloat(s);!isNaN(u)&&u>0&&t(ui(u,d))};return o.jsxs("div",{className:"space-y-1.5",children:[o.jsx(W,{className:"text-[10px]",children:"Tamanho máximo do arquivo"}),o.jsxs("div",{className:"flex gap-1.5",children:[o.jsx(ae,{type:"number",min:0,step:"any",value:s,onChange:d=>l(d.target.value),placeholder:"Ex: 10",className:"h-8 text-xs flex-1"}),o.jsxs(Ge,{value:a,onValueChange:d=>c(d),children:[o.jsx(He,{className:"w-[72px] h-8 text-xs",children:o.jsx(Ye,{})}),o.jsxs(We,{children:[o.jsx(Se,{value:"MB",children:"MB"}),o.jsx(Se,{value:"GB",children:"GB"})]})]})]}),e!==void 0&&o.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["= ",e.toLocaleString("pt-BR")," bytes"]})]})},p0=new Set(["texto","textarea","email","password","url","phone","tel","cpf","cnpj","cep","rg"]),m0=({fieldType:e,validation:t,onChange:r})=>{const a=(i,l)=>{const c=["minLength","maxLength","min","max","maxFileSize","minAge","maxAge"].includes(i)?l?Number(l):void 0:l||void 0;r({...t,[i]:c})},n=e==="file",s=p0.has(e);return o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Validação"}),s&&o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Min caracteres"}),o.jsx(ae,{type:"number",min:0,value:(t==null?void 0:t.minLength)??"",onChange:i=>a("minLength",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Max caracteres"}),o.jsx(ae,{type:"number",min:0,value:(t==null?void 0:t.maxLength)??"",onChange:i=>a("maxLength",i.target.value),className:"h-7 text-xs"})]})]}),e==="number"&&o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Valor mínimo"}),o.jsx(ae,{type:"number",value:(t==null?void 0:t.min)??"",onChange:i=>a("min",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Valor máximo"}),o.jsx(ae,{type:"number",value:(t==null?void 0:t.max)??"",onChange:i=>a("max",i.target.value),className:"h-7 text-xs"})]})]}),(e==="date"||e==="datetime")&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Data mínima"}),o.jsx(ae,{type:"date",value:(t==null?void 0:t.minDate)??"",onChange:i=>a("minDate",i.target.value),className:"h-7 text-xs"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Data máxima"}),o.jsx(ae,{type:"date",value:(t==null?void 0:t.maxDate)??"",onChange:i=>a("maxDate",i.target.value),className:"h-7 text-xs"})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Idade mínima (anos)"}),o.jsx(ae,{type:"number",min:0,value:(t==null?void 0:t.minAge)??"",onChange:i=>a("minAge",i.target.value),className:"h-7 text-xs",placeholder:"ex: 18"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Idade máxima (anos)"}),o.jsx(ae,{type:"number",min:0,value:(t==null?void 0:t.maxAge)??"",onChange:i=>a("maxAge",i.target.value),className:"h-7 text-xs",placeholder:"ex: 60"})]})]})]}),n&&o.jsxs("div",{className:"space-y-3",children:[o.jsx(d0,{value:t==null?void 0:t.fileTypes,onChange:i=>r({...t,fileTypes:i})}),o.jsx(u0,{value:t==null?void 0:t.maxFileSize,onChange:i=>r({...t,maxFileSize:i})})]}),!n&&o.jsx(l0,{value:(t==null?void 0:t.regex)??"",message:(t==null?void 0:t.regexMessage)??"",onChange:(i,l)=>r({...t,regex:i,regexMessage:l})})]})},_u=({options:e,onChange:t})=>{const r=E.useRef([]);if(r.current.length<e.length)for(let i=r.current.length;i<e.length;i++)r.current.push(`opt-${Math.random().toString(36).slice(2)}`);const a=E.useCallback((i,l,c)=>{const d=[...e];d[i]={...d[i],[l]:c},t(d)},[e,t]),n=E.useCallback(i=>{r.current.splice(i,1),t(e.filter((l,c)=>c!==i))},[e,t]),s=E.useCallback(()=>{t([...e,{value:"",label:""}])},[e,t]);return o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Opções"}),e.map((i,l)=>o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(P.GripVertical,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"}),o.jsx(ae,{value:i.value,onChange:c=>a(l,"value",c.target.value),className:"h-7 text-xs flex-1",placeholder:"Valor"}),o.jsxs("div",{className:"flex items-center gap-0.5 flex-1",children:[o.jsx(ae,{value:i.label,onChange:c=>a(l,"label",c.target.value),className:"h-7 text-xs flex-1",placeholder:"Label"}),o.jsx(ht,{})]}),o.jsx(ye,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>n(l),children:o.jsx(P.Trash2,{className:"h-3 w-3"})})]},r.current[l])),o.jsxs(ye,{variant:"outline",size:"sm",className:"w-full h-7 text-xs",onClick:s,children:[o.jsx(P.Plus,{className:"h-3 w-3 mr-1"})," Adicionar opção"]})]})},f0=[{value:"igual",label:"Igual a"},{value:"diferente",label:"Diferente de"},{value:"vazio",label:"Vazio"},{value:"naoVazio",label:"Não vazio"},{value:"contem",label:"Contém"},{value:"naoContem",label:"Não contém"},{value:"maiorQue",label:"Maior que"},{value:"menorQue",label:"Menor que"},{value:"maiorOuIgual",label:"Maior ou igual a"},{value:"menorOuIgual",label:"Menor ou igual a"}],h0=["vazio","naoVazio"],pi=({cond:e,selectedId:t,allFieldIds:r,getFieldLabel:a,onUpdate:n})=>o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Fonte"}),o.jsxs(Ge,{value:e.source||"campo",onValueChange:s=>n({source:s,when:""}),children:[o.jsx(He,{className:"h-7 text-xs",children:o.jsx(Ye,{})}),o.jsxs(We,{children:[o.jsx(Se,{value:"campo",children:"Campo do formulário"}),o.jsx(Se,{value:"evento",children:"Variável do evento"})]})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:e.source==="evento"?"Variável do evento":"Quando o campo"}),o.jsxs(Ge,{value:e.when||"",onValueChange:s=>n({when:s}),children:[o.jsx(He,{className:"h-7 text-xs",children:o.jsx(Ye,{placeholder:e.source==="evento"?"Selecione uma variável...":"Selecione um campo..."})}),o.jsx(We,{children:e.source==="evento"?on.map(s=>o.jsx(Se,{value:s.key,children:s.label},s.key)):r.filter(s=>s!==t).map(s=>o.jsxs(Se,{value:s,children:[a(s),o.jsxs("span",{className:"text-muted-foreground/50 ml-1 text-[9px] font-mono",children:["(",s,")"]})]},s))})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Operador"}),o.jsxs(Ge,{value:e.operator,onValueChange:s=>n({operator:s}),children:[o.jsx(He,{className:"h-7 text-xs",children:o.jsx(Ye,{})}),o.jsx(We,{children:f0.map(s=>o.jsx(Se,{value:s.value,children:s.label},s.value))})]})]}),!h0.includes(e.operator)&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Valor"}),o.jsx(ae,{value:e.value||"",onChange:s=>n({value:s.target.value}),className:"h-7 text-xs",placeholder:"Valor esperado"})]})]}),x0=({condition:e,selectedId:t,allFieldIds:r,getFieldLabel:a,onChange:n})=>{var s;const i=p=>{e&&n({...e,...p})},l=()=>{if(!e)return;const p=e.extraConditions??[];n({...e,logicOperator:e.logicOperator??"and",extraConditions:[...p,{when:"",operator:"igual",value:"",source:"campo"}]})},c=p=>{if(!e)return;const m=(e.extraConditions??[]).filter((x,g)=>g!==p);n({...e,extraConditions:m,logicOperator:m.length?e.logicOperator:void 0})},d=(p,m)=>{if(!e)return;const x=(e.extraConditions??[]).map((g,f)=>f===p?{...g,...m}:g);n({...e,extraConditions:x})},u=(((s=e==null?void 0:e.extraConditions)==null?void 0:s.length)??0)>0;return o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Condicional"}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"has-condition",checked:!!e,onCheckedChange:p=>{n(p?{when:"",operator:"igual",value:"",source:"campo"}:void 0)}}),o.jsx(W,{htmlFor:"has-condition",className:"text-xs cursor-pointer",children:"Exibir condicionalmente"})]}),e&&o.jsxs("div",{className:"space-y-2 pl-2 border-l-2 border-amber-500/30",children:[o.jsx(pi,{cond:e,selectedId:t,allFieldIds:r,getFieldLabel:a,onUpdate:i}),u&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Lógica"}),o.jsxs(Ge,{value:e.logicOperator??"and",onValueChange:p=>i({logicOperator:p}),children:[o.jsx(He,{className:"h-7 text-xs",children:o.jsx(Ye,{})}),o.jsxs(We,{children:[o.jsx(Se,{value:"and",children:"E (AND) — todas devem ser verdadeiras"}),o.jsx(Se,{value:"or",children:"OU (OR) — pelo menos uma deve ser verdadeira"})]})]})]}),(e.extraConditions??[]).map((p,m)=>o.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/40",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("span",{className:"text-[10px] text-muted-foreground font-medium uppercase",children:[e.logicOperator==="or"?"OU":"E"," — condição"," ",m+2]}),o.jsx(ye,{variant:"ghost",size:"sm",className:"h-5 px-1 text-[10px] text-destructive hover:text-destructive",onClick:()=>c(m),children:"Remover"})]}),o.jsx(pi,{cond:p,selectedId:t,allFieldIds:r,getFieldLabel:a,onUpdate:x=>d(m,x)})]},m)),o.jsx(ye,{variant:"outline",size:"sm",className:"h-6 text-[10px] w-full mt-1",onClick:l,children:"+ Adicionar condição"})]})]})},mi=[{value:"texto",label:"Texto"},{value:"textarea",label:"Área de texto"},{value:"number",label:"Número"},{value:"email",label:"E-mail"},{value:"telefone",label:"Telefone"},{value:"cpf",label:"CPF"},{value:"cep",label:"CEP"},{value:"date",label:"Data"},{value:"datetime",label:"Data e hora"},{value:"select",label:"Seleção"},{value:"radio",label:"Radio"},{value:"checkbox",label:"Checkbox"}],g0=({subFields:e,onChange:t})=>{const[r,a]=E.useState(null),n=(i,l)=>{const c=e.map((d,u)=>u===i?{...d,...l}:d);t(c)},s=i=>{t(e.filter((l,c)=>c!==i)),a(null)};return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs font-semibold",children:"Sub-campos"}),o.jsxs(ye,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs gap-1",onClick:()=>{const i={label:"Novo campo",name:`campo_${e.length+1}`,fieldType:"texto",required:!1};t([...e,i]),a(e.length)},children:[o.jsx(P.Plus,{className:"w-3 h-3"}),"Adicionar"]})]}),e.length===0&&o.jsx("p",{className:"text-[11px] text-muted-foreground italic py-1",children:"Nenhum sub-campo adicionado."}),e.map((i,l)=>{var c;return o.jsxs("div",{className:"border rounded-md text-xs overflow-hidden",children:[o.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 cursor-pointer hover:bg-muted/40 select-none",onClick:()=>a(r===l?null:l),children:[o.jsx(qa,{variant:"secondary",className:"h-4 text-[9px] px-1 shrink-0",children:l+1}),o.jsx("span",{className:"flex-1 truncate font-medium",children:i.label||i.name||"Campo sem nome"}),o.jsx("span",{className:"text-muted-foreground text-[10px] shrink-0",children:((c=mi.find(d=>d.value===i.fieldType))==null?void 0:c.label)??i.fieldType}),o.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 text-destructive hover:text-destructive shrink-0",onClick:d=>{d.stopPropagation(),s(l)},children:o.jsx(P.Trash2,{className:"w-3 h-3"})}),r===l?o.jsx(P.ChevronUp,{className:"w-3 h-3 text-muted-foreground shrink-0"}):o.jsx(P.ChevronDown,{className:"w-3 h-3 text-muted-foreground shrink-0"})]}),r===l&&o.jsxs("div",{className:"px-2 pb-2 space-y-2 border-t bg-muted/20",children:[o.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Label"}),o.jsx(ae,{value:i.label,onChange:d=>n(l,{label:d.target.value}),className:"h-7 text-xs",placeholder:"Ex: Nome"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Nome (campo)"}),o.jsx(ae,{value:i.name||"",onChange:d=>n(l,{name:d.target.value}),className:"h-7 text-xs",placeholder:"Ex: nome"})]})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Tipo de campo"}),o.jsxs(Ge,{value:i.fieldType,onValueChange:d=>n(l,{fieldType:d}),children:[o.jsx(He,{className:"h-7 text-xs",children:o.jsx(Ye,{})}),o.jsx(We,{children:mi.map(d=>o.jsx(Se,{value:d.value,className:"text-xs",children:d.label},d.value))})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Colunas (1-12)"}),o.jsx(ae,{type:"number",min:1,max:12,value:i.tamanho??"",onChange:d=>n(l,{tamanho:d.target.value?Number(d.target.value):void 0}),className:"h-7 text-xs",placeholder:"12"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-[10px]",children:"Placeholder"}),o.jsx(ae,{value:i.placeholder||"",onChange:d=>n(l,{placeholder:d.target.value}),className:"h-7 text-xs",placeholder:"Texto de exemplo..."})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:`sf-req-${l}`,checked:i.required||!1,onCheckedChange:d=>n(l,{required:d===!0})}),o.jsx(W,{htmlFor:`sf-req-${l}`,className:"text-[10px] cursor-pointer",children:"Obrigatório"})]}),["select","radio","checkbox_group"].includes(i.fieldType)&&o.jsx("div",{className:"pt-1",children:o.jsx(_u,{options:i.options||[],onChange:d=>n(l,{options:d})})})]})]},l)}),e.length>0&&o.jsx(Ze,{className:"mt-1"})]})},v0=({config:e,selectedId:t,allFieldIds:r,getFieldLabel:a,onUpdate:n})=>{const s=e.fieldType||"texto",i=["select","radio","checkbox_group","autocomplete"].includes(s),l=s==="field_array",c=e.locked===!0,d=s==="participation_type",u=s==="payment_method",p=s==="terms",m=s==="slider",x=s==="rating",g=s==="date_range",f=s==="sub_form",{schemaId:v,uploadTermsPdf:b}=Je(),[j,y]=E.useState(e.termoPdfUploadId?"upload":"link"),[N,C]=E.useState({status:"idle"}),k=E.useRef(null),_=E.useCallback(async w=>{if(!v){C({status:"error",message:"Salve o schema primeiro para habilitar o upload de PDF."});return}if(!b){C({status:"error",message:"Upload de PDF não configurado. Forneça a prop uploadTermsPdf ao BuilderProvider."});return}C({status:"uploading",fileName:w.name,progress:0});try{const R=await b(w,v);n({termoPdfUploadId:R,termoPdfUrl:void 0}),C({status:"idle"})}catch(R){C({status:"error",message:R instanceof Error?R.message:"Falha no upload do PDF."})}},[v,b,n]);return o.jsxs("div",{className:"space-y-4",children:[c&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-500/10 border border-amber-500/30 px-3 py-2",children:[o.jsx(P.Lock,{className:"h-4 w-4 text-amber-500 shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-amber-600 dark:text-amber-400",children:"Campo bloqueado"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tipo, nome e ID são fixos (integração automática)"})]})]}),d&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2",children:[o.jsx(P.Lock,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-primary",children:"Tipo de Participação"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Datas, preços e vagas são carregados automaticamente do evento"})]})]}),p&&o.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2",children:[o.jsx(P.ScrollText,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{children:[o.jsx("p",{className:"text-xs font-medium text-primary",children:"Termos e Condições"}),o.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Configure o texto ou URL do PDF abaixo"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Label"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.label,onChange:w=>n({label:w.target.value}),className:"h-8 text-sm"})]}),d||u?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Dica (hint)"}),o.jsx(ae,{value:e.hint||"",onChange:w=>n({hint:w.target.value}),className:"h-8 text-sm",placeholder:"Texto de ajuda abaixo do campo"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"req",checked:e.required||!1,onCheckedChange:w=>n({required:w===!0})}),o.jsx(W,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]})]}):p?o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Dica (hint)"}),o.jsx(ae,{value:e.hint||"",onChange:w=>n({hint:w.target.value}),className:"h-8 text-sm",placeholder:"Ex: Leia os termos antes de continuar"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"req",checked:e.required||!1,onCheckedChange:w=>n({required:w===!0})}),o.jsx(W,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),o.jsx(Ze,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Conteúdo dos termos"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Texto dos termos"}),o.jsx(Ba,{value:e.termoTexto||"",onChange:w=>n({termoTexto:w.target.value||void 0}),className:"text-sm min-h-[120px] resize-y",placeholder:"Escreva aqui os termos e condições que o usuário deverá ler e aceitar..."})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(W,{className:"text-xs",children:"PDF dos termos (opcional)"}),o.jsxs("div",{className:"flex gap-1 p-0.5 bg-muted rounded-md",children:[o.jsx("button",{type:"button",onClick:()=>y("link"),className:`flex-1 text-[11px] py-1 rounded transition-colors ${j==="link"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Link externo"}),o.jsx("button",{type:"button",onClick:()=>y("upload"),className:`flex-1 text-[11px] py-1 rounded transition-colors ${j==="upload"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Upload de PDF"})]}),j==="link"?o.jsxs("div",{className:"space-y-1",children:[o.jsx(ae,{value:e.termoPdfUrl||"",onChange:w=>n({termoPdfUrl:w.target.value||void 0}),className:"h-8 text-sm",placeholder:"https://exemplo.com/termos.pdf"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"URL pública de um PDF. Tem prioridade sobre o texto acima."})]}):o.jsxs("div",{className:"space-y-2",children:[e.termoPdfUploadId&&N.status==="idle"?o.jsxs("div",{className:"flex items-center gap-2 rounded border border-green-500/40 bg-green-500/10 px-2 py-1.5",children:[o.jsx(P.CheckCircle2,{className:"h-3.5 w-3.5 text-green-600 shrink-0"}),o.jsx("span",{className:"text-[11px] text-green-700 dark:text-green-400 flex-1",children:"PDF enviado ✓"}),o.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>{n({termoPdfUploadId:void 0})},children:o.jsx(P.X,{className:"h-3 w-3"})})]}):null,N.status==="uploading"?o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[o.jsx(P.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),o.jsx("span",{className:"truncate",children:N.fileName}),o.jsxs("span",{className:"ml-auto",children:[N.progress,"%"]})]}),o.jsx(hu,{value:N.progress,className:"h-1"})]}):null,N.status==="error"?o.jsxs("div",{className:"flex items-center gap-2 rounded border border-destructive/40 bg-destructive/10 px-2 py-1.5",children:[o.jsx(P.AlertCircle,{className:"h-3.5 w-3.5 text-destructive shrink-0"}),o.jsx("span",{className:"text-[11px] text-destructive",children:N.message}),o.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 ml-auto",onClick:()=>C({status:"idle"}),children:o.jsx(P.X,{className:"h-3 w-3"})})]}):null,N.status!=="uploading"?o.jsxs(o.Fragment,{children:[o.jsx("input",{ref:k,type:"file",accept:"application/pdf",className:"hidden",onChange:w=>{var R;const A=(R=w.target.files)==null?void 0:R[0];A&&_(A),w.target.value=""}}),o.jsxs(ye,{type:"button",variant:"outline",size:"sm",className:"w-full h-8 text-xs gap-1.5",disabled:!v,onClick:()=>{var w;return(w=k.current)==null?void 0:w.click()},children:[o.jsx(P.Upload,{className:"h-3.5 w-3.5"}),e.termoPdfUploadId?"Substituir PDF":"Selecionar PDF"]}),!v&&o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Salve o schema uma vez para habilitar o upload."})]}):null]})]})]})]}):o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Nome (chave)"}),o.jsx(ae,{value:e.name||t.replace(/^field_/,""),onChange:w=>!c&&n({name:w.target.value}),className:"h-8 text-xs font-mono",placeholder:"nome_do_campo",disabled:c}),c?o.jsx("p",{className:"text-[9px] text-amber-500",children:"ID fixo — necessário para auto-preenchimento"}):o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Usado como chave no JSON do formulário"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Tipo do campo"}),o.jsxs(Ge,{value:s,onValueChange:w=>!c&&n({fieldType:w}),disabled:c,children:[o.jsx(He,{className:"h-8 text-sm",children:o.jsx(Ye,{})}),o.jsx(We,{children:St.map(w=>o.jsx(Se,{value:w.component,children:w.label},w.component))})]})]}),o.jsx(cu,{tamanho:e.tamanho||6,inicioColuna:e.inicioColuna||1,defaultTamanho:6,onTamanhoChange:w=>n({tamanho:w}),onPositionChange:w=>n({inicioColuna:w})}),s!=="file"&&!l&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Placeholder"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.placeholder||"",onChange:w=>n({placeholder:w.target.value}),className:"h-8 text-sm",placeholder:"Texto de exemplo..."})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Dica (hint)"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.hint||"",onChange:w=>n({hint:w.target.value}),className:"h-8 text-sm",placeholder:"Texto de ajuda abaixo do campo"})]}),s!=="file"&&!l&&!f&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Valor padrão"}),o.jsx(ae,{value:e.defaultValue||"",onChange:w=>n({defaultValue:w.target.value}),className:"h-8 text-sm",placeholder:"Valor inicial do campo"})]}),s!=="file"&&!l&&!f&&o.jsxs("div",{className:"space-y-1",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx(W,{className:"text-xs",children:"Valor inicial (runtime)"}),o.jsx(ht,{})]}),o.jsx(ae,{value:e.initialValue||"",onChange:w=>n({initialValue:w.target.value||void 0}),className:"h-8 text-sm",placeholder:"{{evento.nome}} ou valor fixo"}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:['Sobrepõe "Valor padrão" — suporta variáveis'," ",o.jsx("code",{children:"{{evento.x}}"})]})]}),!l&&!f&&o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"req",checked:e.required||!1,onCheckedChange:w=>n({required:w===!0})}),o.jsx(W,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),!l&&!f&&!c&&o.jsxs("div",{className:"flex flex-col gap-1.5",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"readonly",checked:e.isReadOnly||!1,onCheckedChange:w=>n({isReadOnly:w===!0||void 0})}),o.jsx(W,{htmlFor:"readonly",className:"text-xs cursor-pointer",children:"Somente leitura"})]}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{id:"disabled",checked:e.isDisabled||!1,onCheckedChange:w=>n({isDisabled:w===!0||void 0})}),o.jsx(W,{htmlFor:"disabled",className:"text-xs cursor-pointer",children:"Desabilitado"})]})]}),m&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Slider"}),o.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Mínimo"}),o.jsx(ae,{type:"number",value:e.minValue??0,onChange:w=>n({minValue:Number(w.target.value)}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Máximo"}),o.jsx(ae,{type:"number",value:e.maxValue??100,onChange:w=>n({maxValue:Number(w.target.value)}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Passo"}),o.jsx(ae,{type:"number",min:1,value:e.step??1,onChange:w=>n({step:Number(w.target.value)}),className:"h-8 text-sm"})]})]})]})]}),x&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsxs("div",{className:"space-y-2",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Avaliação"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Número de estrelas"}),o.jsxs(Ge,{value:String(e.maxRating??5),onValueChange:w=>n({maxRating:Number(w)}),children:[o.jsx(He,{className:"h-8 text-sm",children:o.jsx(Ye,{})}),o.jsx(We,{children:[3,4,5,6,7,10].map(w=>o.jsxs(Se,{value:String(w),children:[w," estrelas"]},w))})]})]})]})]}),g&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Período"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Label da data inicial"}),o.jsx(ae,{value:e.dateRangeStartLabel??"Data inicial",onChange:w=>n({dateRangeStartLabel:w.target.value}),className:"h-8 text-sm"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Label da data final"}),o.jsx(ae,{value:e.dateRangeEndLabel??"Data final",onChange:w=>n({dateRangeEndLabel:w.target.value}),className:"h-8 text-sm"})]})]})]}),!l&&o.jsx(Ze,{}),!l&&o.jsx(m0,{fieldType:s,validation:e.validation,onChange:w=>n({validation:w})}),i&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),s==="radio"&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Estilo visual"}),o.jsxs(Ge,{value:e.visualStyle||"card",onValueChange:w=>n({visualStyle:w}),children:[o.jsx(He,{className:"h-8 text-sm",children:o.jsx(Ye,{})}),o.jsxs(We,{children:[o.jsx(Se,{value:"card",children:"Card (padrão)"}),o.jsx(Se,{value:"default",children:"Radio simples"})]})]})]}),o.jsx(_u,{options:e.options||[],onChange:w=>n({options:w})})]}),l&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Lista de itens"}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Mín. itens"}),o.jsx(ae,{type:"number",min:0,value:e.minItems??"",onChange:w=>n({minItems:w.target.value?Number(w.target.value):void 0}),className:"h-8 text-sm",placeholder:"0"})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Máx. itens"}),o.jsx(ae,{type:"number",min:0,value:e.maxItems??"",onChange:w=>n({maxItems:w.target.value?Number(w.target.value):void 0}),className:"h-8 text-sm",placeholder:"Sem limite"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Label do item"}),o.jsx(ae,{value:e.itemLabel||"",onChange:w=>n({itemLabel:w.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Contato"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:'Prefixo exibido em cada item (ex: "Contato 1", "Contato 2")'})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Label do botão adicionar"}),o.jsx(ae,{value:e.addLabel||"",onChange:w=>n({addLabel:w.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Adicionar contato"})]}),o.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2",children:o.jsx("p",{className:"text-[11px] text-amber-700 dark:text-amber-400",children:"Os sub-campos são configurados visualmente no canvas: arraste campos da paleta para dentro da caixa laranja."})})]})]}),f&&o.jsxs(o.Fragment,{children:[o.jsx(Ze,{}),o.jsxs("div",{className:"space-y-3",children:[o.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Sub-formulário"}),o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Título do grupo (opcional)"}),o.jsx(ae,{value:e.subSchemaTitle||"",onChange:w=>n({subSchemaTitle:w.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Endereço, Responsável..."})]}),o.jsx(g0,{subFields:e.subSchemaFields||[],onChange:w=>n({subSchemaFields:w})})]})]}),o.jsx(Ze,{}),o.jsx(x0,{condition:e.condition,selectedId:t,allFieldIds:r,getFieldLabel:a,onChange:w=>n({condition:w})}),e.condition&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs",children:"Valor ao ocultar (clearedValue)"}),o.jsx(ae,{value:e.clearedValue??"",onChange:w=>n({clearedValue:w.target.value||void 0}),className:"h-8 text-sm",placeholder:"Deixar vazio = não limpar"}),o.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Valor aplicado automaticamente quando o campo fica oculto."})]}),!l&&!f&&o.jsxs("div",{className:"space-y-1",children:[o.jsx(W,{className:"text-xs text-muted-foreground",children:"Resolver de props (avançado)"}),o.jsx(ae,{value:e.resolvePropsKey||"",onChange:w=>n({resolvePropsKey:w.target.value||void 0}),className:"h-8 text-xs font-mono",placeholder:"chaveDoResolver"}),o.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Registre este key em"," ",o.jsx("code",{children:"RendererContext.fieldResolvers"})," para opções dinâmicas."]})]})]})]})},b0=()=>{const{selectedId:e,getConfig:t,updateConfig:r,getAllFieldIds:a}=Je();if(!e)return o.jsx("div",{className:"rounded-xl border bg-card p-4 text-center text-sm text-muted-foreground",children:"Clique em um item para configurá-lo"});const n=t(e),s=Ne(e),i=c=>r(e,c),l=a().filter(c=>c!==e);return o.jsxs("div",{className:"rounded-xl border bg-card p-4 space-y-4 max-h-[calc(100vh-160px)] overflow-y-auto",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("h3",{className:"text-sm font-bold text-foreground",children:s==="step"?"Step":s==="container"?"Container":"Campo"}),o.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:e})]}),o.jsx(Ze,{}),s==="step"&&o.jsx(Rb,{config:n,onUpdate:i}),s==="container"&&o.jsx(Ty,{config:n,onUpdate:i}),s==="field"&&o.jsx(v0,{config:n,selectedId:e,allFieldIds:l,getFieldLabel:c=>t(c).label||c,onUpdate:i})]})},y0=(e,t)=>{var r,a,n,s,i,l;const c=((a=(r=e==null?void 0:e.containers)==null?void 0:r.root)==null?void 0:a.children)||[],d=[];for(const u of c){if(Ne(u)!=="step")continue;const p=((s=(n=e==null?void 0:e.containers)==null?void 0:n[u])==null?void 0:s.children)||[],m=[];for(const x of p){if(Ne(x)!=="container")continue;const g=(((l=(i=e==null?void 0:e.containers)==null?void 0:i[x])==null?void 0:l.children)||[]).filter(f=>Ne(f)==="field").map(f=>{var v,b;const j=t(f),y={id:f,config:j};if(j.fieldType==="field_array"){const N=((b=(v=e==null?void 0:e.containers)==null?void 0:v[f])==null?void 0:b.children)??[];y.subFields=N.filter(C=>Ne(C)==="field").map(C=>({id:C,config:t(C)}))}return y});m.push({id:x,config:t(x),fields:g})}d.push({id:u,config:t(u),containers:m})}return d},Za=(e,t,r)=>{var a;if(!e||!e.when)return!0;const n=e.source==="evento"?(r==null?void 0:r[e.when])||"":t[e.when]||"",s=parseFloat(n),i=parseFloat(e.value||"");let l;switch(e.operator){case"igual":l=n===(e.value||"");break;case"diferente":l=n!==(e.value||"");break;case"vazio":l=!n;break;case"naoVazio":l=!!n;break;case"contem":l=n.includes(e.value||"");break;case"naoContem":l=!n.includes(e.value||"");break;case"maiorQue":l=!isNaN(s)&&!isNaN(i)&&s>i;break;case"menorQue":l=!isNaN(s)&&!isNaN(i)&&s<i;break;case"maiorOuIgual":l=!isNaN(s)&&!isNaN(i)&&s>=i;break;case"menorOuIgual":l=!isNaN(s)&&!isNaN(i)&&s<=i;break;default:l=!0}if(e.logicOperator&&(a=e.extraConditions)!=null&&a.length){const c=e.extraConditions.map(d=>Za(d,t,r));return e.logicOperator==="and"?l&&c.every(Boolean):l||c.some(Boolean)}return l},fi=(e,t,r,a)=>{if(!Za(t.condition,r,a))return;const n=t.validation,s=t.fieldType||"texto";if(t.required&&!e)return"Campo obrigatório";if(e){if(n!=null&&n.minLength&&e.length<n.minLength)return`Mínimo ${n.minLength} caracteres`;if(n!=null&&n.maxLength&&e.length>n.maxLength)return`Máximo ${n.maxLength} caracteres`;if(s==="number"){const i=Number(e);if(!isNaN(i)){if((n==null?void 0:n.min)!==void 0&&i<n.min)return`Valor mínimo: ${n.min}`;if((n==null?void 0:n.max)!==void 0&&i>n.max)return`Valor máximo: ${n.max}`}}if((s==="date"||s==="datetime")&&e){if(n!=null&&n.minDate&&e<n.minDate)return`Data mínima: ${n.minDate}`;if(n!=null&&n.maxDate&&e>n.maxDate)return`Data máxima: ${n.maxDate}`}if(n!=null&&n.regex)try{if(!new RegExp(n.regex).test(e))return n.regexMessage||"Formato inválido"}catch{}}},hi={email:"teste@email.com",number:"123",telefone:"(11) 99999-9999",cpf:"123.456.789-00",cep:"01001-000",date:new Date().toISOString().slice(0,10),datetime:new Date().toISOString().slice(0,10),textarea:"Texto de teste para preview",checkbox:"true",hidden:"",participation_type:JSON.stringify({tipo:"todos_os_dias",data:null,genero:null}),payment_method:JSON.stringify({metodo:"pix",valorTotal:0}),terms:""},Eu=(e,t)=>{var r;const a=e.fieldType||"texto";if(a==="field_array"){const n=Math.max(e.minItems??1,1),s=Array.from({length:n},()=>{const i={};return t==null||t.forEach(l=>{i[l.id]=Eu(l.config)}),i});return JSON.stringify(s)}return hi[a]!==void 0?hi[a]:(a==="select"||a==="radio")&&(r=e.options)!=null&&r.length?e.options[0].value||"":"Teste"},w0={glassmorphism:"Glass",card:"Card",flat:"Flat",bordered:"Bordered"},j0=()=>{const{previewTemplateId:e,setPreviewTemplateId:t}=Je(),[r,a]=E.useState(!1),n=Object.values(zt),s=zt[e];return o.jsxs(Ia,{open:r,onOpenChange:a,children:[o.jsx(La,{asChild:!0,children:o.jsxs(ye,{variant:"outline",size:"sm",className:"gap-1.5",title:"Selecionar template visual",children:[o.jsx("span",{className:"w-3.5 h-3.5 rounded-full shrink-0 border border-white/20",style:{background:(s==null?void 0:s.colors.primary)??"#3b82f6"}}),o.jsx(P.Palette,{className:"w-3.5 h-3.5"}),o.jsx("span",{className:"hidden sm:inline",children:(s==null?void 0:s.displayName)??"Template"})]})}),o.jsxs(Pr,{side:"bottom",align:"end",className:"w-80 p-3",children:[o.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-2 uppercase tracking-wider",children:"Template de Preview"}),o.jsx("div",{className:"grid grid-cols-3 gap-1.5 max-h-72 overflow-y-auto pr-0.5",children:n.map(i=>{const l=i.id===e,c=wi(i),d=w0[i.layout.containerStyle]??"";return o.jsxs("button",{onClick:()=>{t(i.id),a(!1)},className:G("relative flex flex-col items-center gap-1.5 rounded-lg p-2 border text-center transition-all hover:scale-[1.02]",l?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[o.jsxs("div",{className:"w-full h-8 rounded-md flex items-center justify-center gap-0.5",style:{background:i.colors.background.startsWith("#")||i.colors.background.startsWith("rgba")?i.colors.background:void 0},"data-muted":!i.colors.background.startsWith("#")&&!i.colors.background.startsWith("rgba")?"true":void 0,children:[o.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:i.colors.primary}}),o.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:i.colors.accent}})]}),o.jsx("span",{className:"text-[10px] font-medium leading-tight line-clamp-2",children:i.displayName}),o.jsxs("div",{className:"flex items-center gap-0.5 flex-wrap justify-center",children:[c&&o.jsx("span",{className:"text-[9px] px-1 rounded bg-zinc-800 text-zinc-300",children:"dark"}),d&&o.jsx("span",{className:"text-[9px] px-1 rounded bg-muted text-muted-foreground",children:d})]}),l&&o.jsx("div",{className:"absolute top-1 right-1",children:o.jsx(P.Check,{className:"w-3 h-3 text-primary"})})]},i.id)})})]})]})},N0=({onFillMock:e,onClear:t})=>o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsx(j0,{}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsxs(ye,{variant:"outline",size:"sm",onClick:e,children:[o.jsx(P.FlaskConical,{className:"w-3.5 h-3.5 mr-1"}),"Preencher mock"]}),o.jsxs(ye,{variant:"ghost",size:"sm",onClick:t,children:[o.jsx(P.Eraser,{className:"w-3.5 h-3.5 mr-1"}),"Limpar"]})]})]}),C0={texto:"text",number:"number",email:"email",telefone:"tel",cpf:"text",cep:"text",date:"date",datetime:"datetime-local"},Pu=e=>C0[e]||"text",Jt=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,S0=({config:e,fieldId:t,subFields:r,tamanho:a,error:n,onChange:s,value:i})=>{const l=e.minItems??1,c=e.maxItems??10,d=e.itemLabel||"Item",u=e.addLabel||`Adicionar ${d}`,p=E.useRef(i||""),m=E.useCallback(()=>Object.fromEntries(r.map(C=>[C.id,""])),[r]),[x,g]=E.useState(()=>{if(i)try{const C=JSON.parse(i);if(Array.isArray(C)&&C.length>0)return C}catch{}return[m()]}),[f,v]=E.useState({});E.useEffect(()=>{if(i!==p.current){if(p.current=i||"",!i){g([m()]);return}try{const C=JSON.parse(i);Array.isArray(C)&&g(C)}catch{}}},[i,m]),E.useEffect(()=>{if(!n){v({});return}const C={};x.forEach((k,_)=>{r.forEach(w=>{const R=k[w.id]??"";w.config.required&&!R.trim()&&(C[`${_}.${w.id}`]="Campo obrigatório")})}),v(C)},[n,x,r]);const b=C=>{if(!s)return;const k=C.map(w=>{const R={};return r.forEach(A=>{R[A.id]=w[A.id]??""}),R}),_=JSON.stringify(k);p.current=_,s(_)},j=()=>{if(x.length>=c)return;const C=[...x,m()];g(C),b(C)},y=C=>{if(x.length<=l)return;const k=x.filter((_,w)=>w!==C);g(k),b(k)},N=(C,k,_)=>{const w=x.map((R,A)=>A===C?{...R,[k]:_}:R);g(w),b(w),v(R=>{const A={...R};return delete A[`${C}.${k}`],A})};return o.jsxs("div",{className:"space-y-2",style:{gridColumn:`span ${a}`},children:[e.label&&o.jsx(W,{className:"text-sm font-medium",children:e.label}),o.jsx("div",{className:"space-y-3",children:x.map((C,k)=>o.jsxs("div",{className:"rounded-xl border bg-card p-4 space-y-3 shadow-sm",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"inline-flex h-7 w-7 items-center justify-center rounded-full bg-orange-500 text-white text-xs font-bold shrink-0",children:k+1}),o.jsxs("span",{className:"text-sm font-semibold",children:[d," ",k+1]})]}),x.length>l&&o.jsx(ye,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive/60 hover:text-destructive",onClick:()=>y(k),children:o.jsx(P.Trash2,{className:"h-4 w-4"})})]}),r.length===0?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Sem sub-campos configurados"}):o.jsx("div",{className:"grid grid-cols-12 gap-3",children:r.map(_=>{const w=_.config.fieldType||"texto",R=_.config.tamanho||6,A=C[_.id]??"",I=V=>N(k,_.id,V),F=f[`${k}.${_.id}`];return o.jsxs("div",{className:"space-y-1",style:{gridColumn:`span ${R}`},children:[o.jsxs(W,{className:"text-xs font-medium",children:[_.config.label,_.config.required&&o.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),w==="textarea"?o.jsx(Ba,{placeholder:_.config.placeholder,className:F?"text-sm border-destructive":"text-sm",value:A,onChange:V=>I(V.target.value)}):w==="select"?o.jsxs(Ge,{value:A,onValueChange:I,children:[o.jsx(He,{className:F?"text-sm border-destructive":"text-sm",children:o.jsx(Ye,{placeholder:_.config.placeholder||"Selecione..."})}),o.jsx(We,{children:(_.config.options||[]).map((V,M)=>o.jsx(Se,{value:V.value||`__opt_${M}`,children:V.label},`${M}-${V.value}`))})]}):w==="checkbox"?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{checked:A==="true",onCheckedChange:V=>I(V?"true":"")}),o.jsx("span",{className:"text-sm text-muted-foreground",children:_.config.placeholder||_.config.label})]}):o.jsx(ae,{type:Pu(w),placeholder:_.config.placeholder,className:F?"text-sm border-destructive":"text-sm",value:A,onChange:V=>I(V.target.value)}),F&&o.jsxs("p",{className:"text-xs text-destructive flex items-center gap-1",children:[o.jsx(P.AlertCircle,{className:"h-3 w-3 shrink-0"}),F]})]},_.id)})})]},k))}),o.jsxs(ye,{type:"button",variant:"outline",className:"w-full border-dashed border-orange-500 text-orange-500 hover:bg-orange-500/10 hover:text-orange-500 font-semibold",onClick:j,disabled:x.length>=c,children:[o.jsx(P.Plus,{className:"h-4 w-4 mr-2"}),u]}),e.maxItems&&o.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",e.maxItems," ",d.toLowerCase(),e.maxItems!==1?"s":""]}),!e.maxItems&&e.hint&&o.jsx("p",{className:"text-xs text-muted-foreground",children:e.hint}),n&&o.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[o.jsx(P.AlertCircle,{className:"h-4 w-4 shrink-0"}),n]})]})},k0=({config:e,fieldId:t,value:r,onChange:a,visible:n,error:s,subFields:i,eventoData:l,allValues:c})=>{const d=e.fieldType||"texto",u=e.tamanho||6;if(!n)return null;if(d==="field_array")return o.jsx(S0,{config:e,fieldId:t,subFields:i??[],tamanho:u,error:s,onChange:a,value:r});const p=s?"border-destructive":"";return o.jsxs("div",{className:"space-y-1",style:{gridColumn:e.inicioColuna?`${e.inicioColuna} / span ${u}`:`span ${u}`},children:[d!=="terms"&&o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsxs(W,{className:"text-sm font-medium",children:[e.label,e.required&&o.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),e.condition&&o.jsxs(qa,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 border-amber-500/50 text-amber-600",children:[o.jsx(P.Zap,{className:"h-2.5 w-2.5 mr-0.5"}),"cond"]})]}),d==="textarea"?o.jsx(Ba,{placeholder:e.placeholder,className:G("text-sm",p),value:r,onChange:m=>a(m.target.value)}):d==="select"?o.jsxs(Ge,{value:r,onValueChange:a,children:[o.jsx(He,{className:G("text-sm",p),children:o.jsx(Ye,{placeholder:e.placeholder||"Selecione..."})}),o.jsx(We,{children:(e.options||[]).map((m,x)=>o.jsx(Se,{value:m.value||`__opt_${x}`,children:m.label},`${x}-${m.value}`))})]}):d==="checkbox"?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{checked:r==="true",onCheckedChange:m=>a(m?"true":"")}),o.jsx("span",{className:"text-sm text-muted-foreground",children:e.placeholder||e.label})]}):d==="checkbox_group"?o.jsx(_0,{config:e,value:r,onChange:a}):d==="radio"?o.jsx("div",{className:"space-y-2",children:(e.options||[{value:"1",label:"Opção 1"}]).map((m,x)=>e.visualStyle==="default"?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("input",{type:"radio",readOnly:!0,checked:r===m.value,className:"accent-orange-500"}),o.jsx("span",{className:"text-sm",children:m.label})]},`${x}-${m.value}`):o.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-xl border-2 transition-all cursor-pointer bg-card border-border",children:[o.jsx("input",{type:"radio",readOnly:!0,checked:r===m.value,className:"accent-orange-500"}),o.jsx("span",{className:"text-sm flex-1",children:m.label})]},`${x}-${m.value}`))}):d==="participation_type"?(()=>{const m=parseInt((l==null?void 0:l["evento.valor"])??"0")||0,x=parseInt((l==null?void 0:l["evento.valorPorDia"])??"0")||0,g=l==null?void 0:l["evento.vagasTotal"],f=l==null?void 0:l["evento.vagasPorDia"],v=l==null?void 0:l["evento.vagasMasculinas"],b=l==null?void 0:l["evento.vagasFemininas"],j=!!(v&&Number(v)>0)&&!!(b&&Number(b)>0),y=l==null?void 0:l["evento.dataInicioEvento"],N=l==null?void 0:l["evento.dataFimEvento"],C=T=>T?T.slice(8,10)+"/"+T.slice(5,7)+"/"+T.slice(0,4):"—",k=y&&N?`${C(y)} a ${C(N)}`:"Período do evento",_=(y&&N?Math.round((new Date(N.slice(0,10)+"T00:00:00Z").getTime()-new Date(y.slice(0,10)+"T00:00:00Z").getTime())/864e5)+1:0)>1;let w={};try{w=r?JSON.parse(r):{}}catch{}const R=w.tipo??null,A=w.data??null,I=w.genero??null,F=T=>a(JSON.stringify({tipo:T,data:null,...j?{genero:I}:{}})),V=T=>a(JSON.stringify({tipo:"por_dia",data:T,...j?{genero:I}:{}})),M=T=>a(JSON.stringify({tipo:R,data:A,genero:T})),U=[];if(_&&y&&N){const T=new Date(y.slice(0,10)+"T00:00:00Z"),D=new Date(N.slice(0,10)+"T00:00:00Z");let z=0;for(;T<=D&&z++<60;)U.push(T.toISOString().slice(0,10)),T.setUTCDate(T.getUTCDate()+1)}const $=T=>{const[D,z,L]=T.split("-").map(Number),ee=new Date(Date.UTC(D,z-1,L)),Y=String(L).padStart(2,"0"),J=String(z).padStart(2,"0"),q=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(ee);return`${Y}/${J} — ${q.charAt(0).toUpperCase()}${q.slice(1)}`};return o.jsxs("div",{className:"space-y-2",children:[j&&o.jsxs("div",{className:"flex items-center gap-2 px-1",children:[o.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Você é:"}),o.jsx("div",{className:"flex gap-2",children:["masculino","feminino"].map(T=>{const D=T==="masculino"?"Masculino":"Feminino";return o.jsx("button",{type:"button",onClick:()=>M(T),className:G("px-3 py-1 rounded-full text-xs font-medium border transition-all",I===T?"border-primary bg-primary text-primary-foreground":"border-border bg-card text-muted-foreground hover:border-primary/60"),children:D},T)})})]}),o.jsxs("button",{type:"button",onClick:()=>F("todos_os_dias"),className:G("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all bg-card",R==="todos_os_dias"?"border-primary bg-primary/10":"border-border hover:border-primary/40"),children:[o.jsx("div",{className:G("mt-0.5 p-2 rounded-lg shrink-0",R==="todos_os_dias"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:o.jsx(P.CalendarCheck2,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold",children:"Participar todos os dias"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:k})]}),o.jsxs("div",{className:"text-right shrink-0",children:[o.jsx("p",{className:G("text-sm font-bold",R==="todos_os_dias"?"text-primary":"text-foreground"),children:m>0?Jt(m):"R$ —,—"}),g&&o.jsxs("p",{className:"text-xs text-emerald-500 flex items-center justify-end gap-1",children:[o.jsx(P.Users,{className:"w-3 h-3"}),g," vagas"]})]})]}),_?o.jsxs("button",{type:"button",onClick:()=>F("por_dia"),className:G("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all bg-card",R==="por_dia"?"border-primary bg-primary/10":"border-border hover:border-primary/40"),children:[o.jsx("div",{className:G("mt-0.5 p-2 rounded-lg shrink-0",R==="por_dia"?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:o.jsx(P.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold",children:"Participar um dia"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:"Escolha o dia desejado"})]}),o.jsxs("div",{className:"text-right shrink-0",children:[o.jsx("p",{className:G("text-sm font-bold",R==="por_dia"?"text-primary":"text-foreground"),children:x>0?Jt(x):"R$ —,—"}),f&&o.jsxs("p",{className:"text-xs text-emerald-500 flex items-center justify-end gap-1",children:[o.jsx(P.Users,{className:"w-3 h-3"}),f," vagas/dia"]})]})]}):y?o.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg bg-muted/50 border border-border",children:[o.jsx(P.Info,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-muted-foreground"}),o.jsx("p",{className:"text-xs text-muted-foreground",children:'Evento de 1 dia — a opção "Participar um dia" não é exibida.'})]}):o.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl border-2 border-border bg-card opacity-40",children:[o.jsx("div",{className:"mt-0.5 p-2 rounded-lg shrink-0 bg-muted text-muted-foreground",children:o.jsx(P.CalendarDays,{className:"w-4 h-4"})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold",children:"Participar um dia"}),o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Visível se evento tiver 2+ dias"})]}),o.jsx("div",{className:"text-right shrink-0",children:o.jsx("p",{className:"text-sm font-bold text-primary",children:"R$ —,—"})})]}),R==="por_dia"&&U.length>0&&o.jsxs("div",{className:"pl-2 space-y-2",children:[o.jsx("p",{className:"text-xs font-semibold text-primary uppercase tracking-wide",children:"Selecione o dia:"}),U.map(T=>o.jsxs("button",{type:"button",onClick:()=>V(T),className:G("w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",A===T?"border-primary bg-primary/10 text-primary":"border-border bg-card hover:border-primary/40"),children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("span",{className:G("w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center",A===T?"border-primary bg-primary":"border-muted-foreground"),children:A===T&&o.jsx("span",{className:"w-2 h-2 rounded-full bg-primary-foreground"})}),o.jsx("span",{className:"text-sm",children:$(T)})]}),f&&o.jsxs("span",{className:"text-xs text-emerald-500",children:[f," vagas"]})]},T))]})]})})():d==="payment_method"?(()=>{const m=(c==null?void 0:c._participation_type_field)??"";let x={};try{x=m?JSON.parse(m):{}}catch{}const g=x.tipo??null,f=Number((l==null?void 0:l["evento.valor"])??0)||0,v=Number((l==null?void 0:l["evento.valorPorDia"])??0)||0,b=g==="por_dia"&&v>0?v:f,j=g==="por_dia"?(()=>{if(!x.data)return"Um dia";const[_,w,R]=x.data.split("-");return`${R}/${w}/${_}`})():"Todos os dias",y=g==="por_dia"?[{id:"pix",label:"PIX",desc:"Transferência instantânea (à vista)",taxa:0,parcelas:0},{id:"dinheiro",label:"Dinheiro",desc:"Pagamento em espécie",taxa:0,parcelas:0},{id:"cartao",label:"Cartão de Crédito",desc:"Débito ou crédito na maquininha",taxa:.0315,parcelas:0,taxaLabel:`Taxa InfinityPay: ${(.0315*100).toFixed(2).replace(".",",")}%`}]:[{id:"pix",label:"PIX à Vista",desc:"Pagamento instantâneo sem parcelamento",taxa:0,parcelas:0},{id:"pix_parcelado",label:"PIX Parcelado",desc:"Parcelado em até 7x sem juros",taxa:0,parcelas:7},{id:"cartao",label:"Cartão de Crédito",desc:"Parcelado em até 12x",taxa:.124,parcelas:12,taxaLabel:`Taxa InfinityPay: ${(.124*100).toFixed(2).replace(".",",")}%`},{id:"dinheiro",label:"Dinheiro",desc:"Pagamento em espécie",taxa:0,parcelas:0}];let N={};try{N=r?JSON.parse(r):{}}catch{}const C=N.metodo??null,k=_=>{const w=Math.round(b*(1+_.taxa)*100)/100,R={metodo:_.id,valorTotal:w};_.parcelas>1&&(R.parcelas=_.parcelas),a(JSON.stringify(R))};return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border bg-card px-4 py-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Tipo de participação"}),o.jsx("p",{className:"font-semibold",children:j})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("p",{className:"text-xs text-muted-foreground",children:"Valor base"}),o.jsx("p",{className:"text-lg font-bold text-primary",children:Jt(b)})]})]}),o.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-amber-500/40 bg-amber-500/10 px-3 py-2.5",children:[o.jsx(P.Info,{className:"h-4 w-4 text-amber-500 mt-0.5 shrink-0"}),o.jsxs("p",{className:"text-xs text-amber-200",children:[o.jsx("span",{className:"font-bold text-amber-400",children:"Importante:"})," ","Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."]})]}),o.jsx("p",{className:"text-sm font-semibold text-primary",children:"Selecione a forma de pagamento:"}),o.jsx("div",{className:"space-y-3",children:y.map(_=>{const w=C===_.id,R=Math.round(b*(1+_.taxa)*100)/100,A=_.parcelas>1,I=A?Math.round(R/_.parcelas*100)/100:null;return o.jsxs("button",{type:"button",onClick:()=>k(_),className:G("w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all bg-card",w?"border-primary bg-primary/10":"border-border hover:border-primary/50"),children:[o.jsx("div",{className:G("flex items-center justify-center w-10 h-10 rounded-lg shrink-0",w?"bg-primary/20":"bg-muted"),children:o.jsx(P.Wallet,{className:G("h-5 w-5",w?"text-primary":"text-muted-foreground")})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("p",{className:"font-semibold text-sm leading-tight",children:_.label}),o.jsx("p",{className:"text-xs text-muted-foreground",children:_.desc}),_.taxaLabel&&o.jsxs("p",{className:"text-xs text-amber-400 mt-0.5",children:["* ",_.taxaLabel]}),_.taxa>0&&o.jsxs("p",{className:"text-xs text-muted-foreground",children:["Total com taxa: ",Jt(R)]})]}),o.jsx("div",{className:"text-right shrink-0",children:A?o.jsxs(o.Fragment,{children:[o.jsxs("p",{className:"text-xs text-muted-foreground",children:[_.parcelas,"x de"]}),o.jsx("p",{className:"text-base font-bold text-primary",children:Jt(I)})]}):o.jsx("p",{className:"text-base font-bold text-primary",children:Jt(R)})})]},_.id)})})]})})():d==="terms"?(()=>{const m=r==="accepted",x=e.termoTexto,g=e.termoPdfUrl,f=!!e.termoPdfUploadId,v=!!(x||g||f);return o.jsxs("div",{className:G("rounded-lg border p-4 space-y-4 transition-colors",m?"border-green-500/40 bg-green-500/5":"border-border bg-muted/30"),children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(P.ScrollText,{className:"h-4 w-4 text-primary shrink-0"}),o.jsx("span",{className:"text-sm font-medium",children:e.label||"Termos e condições"})]}),v?o.jsxs("div",{className:"flex items-center gap-1.5",children:[f&&o.jsx("span",{className:"flex items-center gap-1 text-[10px] text-green-600 dark:text-green-400 font-medium border border-green-500/40 bg-green-500/10 rounded px-1.5 py-0.5",children:"PDF enviado ✓"}),o.jsxs(ye,{type:"button",variant:"outline",size:"sm",className:"h-7 gap-1.5 text-xs",onClick:()=>{},children:[o.jsx(P.ExternalLink,{className:"h-3 w-3"}),"Ler termos"]})]}):o.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Conteúdo não configurado"})]}),o.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[o.jsx(Pe,{checked:m,onCheckedChange:b=>a(b?"accepted":""),className:"mt-0.5"}),o.jsxs("span",{className:"text-sm leading-snug flex-1",children:["Li e aceito"," ",e.label?`"${e.label}"`:"os termos e condições"]}),m&&o.jsx(P.CheckCircle2,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"})]})]})})():d==="file"?o.jsx(ae,{type:"file",className:G("text-sm",p)}):d==="hidden"?o.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Campo oculto"}):o.jsx(ae,{type:Pu(d),placeholder:e.placeholder,className:G("text-sm",p),value:r,onChange:m=>a(m.target.value)}),s?o.jsxs("p",{className:"text-xs text-destructive flex items-center gap-1",children:[o.jsx(P.AlertCircle,{className:"h-3 w-3 shrink-0"}),s]}):e.hint?o.jsx("p",{className:"text-xs text-muted-foreground",children:e.hint}):null]})},_0=({config:e,value:t,onChange:r})=>{var a;const n=new Set(t?t.split(","):[]),s=(a=e.options)!=null&&a.length?e.options:[{value:"1",label:"Opção 1"}],i=l=>{const c=new Set(n);c.has(l)?c.delete(l):c.add(l),r(Array.from(c).join(","))};return o.jsx("div",{className:"space-y-1",children:s.map((l,c)=>o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(Pe,{checked:n.has(l.value),onCheckedChange:()=>i(l.value),disabled:l.disabled}),o.jsx("span",{className:"text-sm",children:l.label})]},`${c}-${l.value}`))})},E0=({step:e,stepIndex:t,formValues:r,errors:a,eventoData:n,onChange:s})=>o.jsxs("div",{className:"rounded-xl border bg-card p-5 space-y-5",children:[o.jsxs("div",{children:[e.config.showLabel!==!1&&o.jsxs("h2",{className:"text-base font-bold text-foreground",children:["Step ",t+1," — ",e.config.label]}),e.config.description&&o.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:e.config.description})]}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-4",children:e.containers.map(i=>o.jsxs("div",{className:G("space-y-3",i.config.showAsCard&&"rounded-lg border bg-card p-4 shadow-sm"),style:{gridColumn:i.config.inicioColuna?`${i.config.inicioColuna} / span ${i.config.tamanho||12}`:`span ${i.config.tamanho||12}`},children:[i.config.showLabel!==!1&&i.config.label!=="Novo Container"&&o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-semibold text-foreground",children:i.config.label}),i.config.description&&o.jsx("p",{className:"text-xs text-muted-foreground",children:i.config.description})]}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-12 gap-3",children:i.fields.map(l=>o.jsx(k0,{config:l.config,fieldId:l.id,subFields:l.subFields,value:r[l.id]||"",onChange:c=>s(l.id,c),visible:Za(l.config.condition,r,n),error:a[l.id],eventoData:n,allValues:r},l.id))})]},i.id))})]}),P0=({currentStep:e,isLastStep:t,onBack:r,onNext:a})=>o.jsxs("div",{className:"flex items-center justify-between gap-4",children:[o.jsxs(ye,{variant:"outline",onClick:r,disabled:e===0,children:[o.jsx(P.ChevronLeft,{className:"w-4 h-4 mr-1"}),"Voltar"]}),o.jsx(ye,{onClick:a,children:t?o.jsxs(o.Fragment,{children:[o.jsx(P.Check,{className:"w-4 h-4 mr-1"}),"Finalizar"]}):o.jsxs(o.Fragment,{children:[o.jsx(P.ChevronRight,{className:"w-4 h-4 mr-1"}),"Próximo"]})})]}),T0=({onRestart:e})=>o.jsxs("div",{className:"max-w-4xl mx-auto flex flex-col items-center justify-center py-16 space-y-4",children:[o.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:o.jsx(P.PartyPopper,{className:"w-8 h-8 text-primary"})}),o.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Formulário enviado!"}),o.jsx("p",{className:"text-sm text-muted-foreground",children:"Este é um preview simulado. Nenhum dado foi enviado."}),o.jsxs(ye,{variant:"outline",onClick:e,children:[o.jsx(P.RotateCcw,{className:"w-4 h-4 mr-1"}),"Recomeçar"]})]}),ca=e=>{if(e)return ct[e]},$0=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((a,n)=>o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(n),onKeyDown:s=>s.key==="Enter"&&(r==null?void 0:r(n)),className:G("w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:n===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:n<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:n<t?o.jsx(P.Check,{className:"w-4 h-4"}):n+1},a.id))}),R0=({steps:e,currentStep:t,onStepClick:r})=>o.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((a,n)=>{const s=ca(a.icone)??P.CircleDot;return o.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(n),onKeyDown:i=>i.key==="Enter"&&(r==null?void 0:r(n)),className:G("w-9 h-9 rounded-full flex items-center justify-center transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:n===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:n<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:n<t?o.jsx(P.Check,{className:"w-4 h-4"}):o.jsx(s,{className:"w-4 h-4"})},a.id)})}),O0=({steps:e,currentStep:t,position:r,orientation:a="horizontal",onStepClick:n})=>a==="vertical"?o.jsx("div",{className:"flex flex-col gap-0",children:e.map((s,i)=>{const l=ca(s.icone)??P.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:"flex items-start gap-3",children:[o.jsxs("div",{className:"flex flex-col items-center",children:[o.jsx("button",{type:"button",onClick:()=>n==null?void 0:n(i),className:G("w-8 h-8 rounded-full flex items-center justify-center transition-all shrink-0",n&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#fff",boxShadow:"0 0 10px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#fff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(P.Check,{className:"w-3.5 h-3.5"}):o.jsx(l,{className:"w-3.5 h-3.5"})}),!u&&o.jsx("div",{className:"w-[2px] my-1",style:{height:"24px",background:d?"#22c55e":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]}),o.jsx("span",{className:"text-sm font-medium leading-tight mt-1.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label})]},s.id)})}):o.jsx("div",{className:"w-full flex items-start",children:e.map((s,i)=>{const l=ca(s.icone)??P.CircleDot,c=i===t,d=i<t,u=i===e.length-1;return o.jsxs("div",{className:G("flex items-start",!u&&"flex-1"),children:[o.jsxs("div",{className:"flex flex-col items-center gap-1.5 w-[56px] shrink-0 mx-auto",children:[o.jsx("button",{type:"button",onClick:()=>n==null?void 0:n(i),className:G("w-10 h-10 rounded-full flex items-center justify-center transition-all shrink-0",n&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 12px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#ffffff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?o.jsx(P.Check,{className:"w-4 h-4"}):o.jsx(l,{className:"w-4 h-4"})}),o.jsx("span",{className:"text-[10px] font-medium text-center leading-tight line-clamp-2 px-0.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label})]}),!u&&o.jsx("div",{className:"flex-1 h-[1.5px] mt-5 mx-1",style:{background:d?"linear-gradient(90deg, var(--t-primary), color-mix(in srgb, var(--t-primary) 40%, transparent))":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]},s.id)})}),D0=({steps:e,currentStep:t,onStepClick:r,className:a})=>{const n=Wo(),{layout:s}=n;if(!s.showStepIndicators||e.length<=1)return null;const i=s.stepIndicatorVariant??"numbers",l=s.stepIndicatorPosition??"top-center",c=s.stepIndicatorOrientation??"horizontal",d=(t+1)/e.length*100,u=e[t],p=ca(u==null?void 0:u.icone)??P.CircleDot,m=o.jsx("div",{className:"h-1 rounded-full overflow-hidden",style:{background:"color-mix(in srgb, var(--t-primary) 15%, transparent)"},children:o.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${d}%`,background:"linear-gradient(90deg, var(--t-primary), var(--t-accent))"}})}),x=o.jsxs("div",{className:"block sm:hidden space-y-2",children:[o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:{background:"var(--t-primary)",color:"#fff"},children:o.jsx(p,{className:"w-5 h-5"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"text-sm font-semibold leading-tight truncate",style:{color:"var(--t-text)"},children:u==null?void 0:u.label}),o.jsxs("p",{className:"text-xs leading-tight",style:{color:"var(--t-text-muted)"},children:["Passo ",t+1," de ",e.length]})]})]}),m]}),g=o.jsxs("div",{className:"hidden sm:block",children:[i==="numbers"&&o.jsx($0,{steps:e,currentStep:t,onStepClick:r}),i==="icons"&&o.jsx(R0,{steps:e,currentStep:t,onStepClick:r}),i==="icons-labeled"&&o.jsx(O0,{steps:e,currentStep:t,position:l,orientation:c,onStepClick:r})]}),f=s.showProgressBar?o.jsx("div",{className:"hidden sm:block",children:m}):null;return c==="vertical"?o.jsxs("div",{className:G("flex gap-6 items-start",a),children:[x,o.jsxs("div",{className:"hidden sm:flex gap-6 items-start shrink-0",children:[g,f&&o.jsx("div",{className:"flex-1 pt-4",children:f})]})]}):o.jsxs("div",{className:G("space-y-3",a),children:[x,o.jsxs("div",{className:"hidden sm:block space-y-3",children:[g,f]})]})},A0=({eventoData:e})=>{const{getConfig:t,containers:r,previewTemplateId:a}=Je(),n=y0({containers:r},t),[s,i]=E.useState({}),[l,c]=E.useState(0),[d,u]=E.useState(!1),[p,m]=E.useState({}),[x,g]=E.useState(!1),f=Math.min(l,Math.max(n.length-1,0));E.useEffect(()=>{f!==l&&c(f)},[f,l,c]);const v=E.useCallback((I,F)=>{var V;if(i(M=>({...M,[I]:F})),x){const M=(V=n[f])==null?void 0:V.containers.flatMap(U=>U.fields).find(U=>U.id===I);if(M){const U=fi(F,M.config,{...s,[I]:F},e);m($=>{const T={...$};return U?T[I]=U:delete T[I],T})}}},[x,n,f,s,e,i,m]),b=E.useCallback(()=>{const I=n[f];if(!I)return!0;const F={};for(const M of I.containers)for(const U of M.fields){if(U.config.fieldType==="field_array"){let T=!1;try{const D=s[U.id],z=D?JSON.parse(D):[],L=U.config.minItems??1;if(z.length<L)F[U.id]=`Mínimo de ${L} item${L!==1?"s":""} obrigatório${L!==1?"s":""}`,T=!0;else{for(const ee of z){for(const Y of U.subFields??[]){const J=ee[Y.id]??"";if(Y.config.required&&!J.trim()){T=!0;break}}if(T)break}T&&(F[U.id]="Preencha todos os campos obrigatórios")}}catch{U.config.required&&(F[U.id]="Campo obrigatório")}continue}const $=fi(s[U.id]||"",U.config,s,e);$&&(F[U.id]=$)}m(F),g(!0);const V=Object.keys(F).length;return V>0?(console.warn(`Corrija ${V} campo(s) destacado(s) antes de continuar`),!1):!0},[n,f,s,e,m,g]),j=E.useCallback(()=>{b()&&(g(!1),m({}),f>=n.length-1?u(!0):c(I=>I+1))},[b,f,n.length,g,m,u,c]),y=E.useCallback(()=>{c(I=>I-1),g(!1),m({})},[c,g,m]),N=E.useCallback(()=>{const I={};for(const F of n)for(const V of F.containers)for(const M of V.fields)Za(M.config.condition,s,e)&&(I[M.id]=Eu(M.config,M.subFields));i(F=>({...F,...I}))},[n,s,e,i]),C=E.useCallback(()=>{i({}),m({}),g(!1)},[i,m,g]),k=E.useCallback(()=>{u(!1),c(0),C()},[u,c,C]);if(n.length===0)return o.jsx("div",{className:"rounded-lg border border-dashed border-border/40 p-6 text-center text-xs text-muted-foreground/50",children:"Adicione steps, containers e campos para ver o preview ao vivo"});if(d)return o.jsx(T0,{onRestart:k});const _=n[f],w=n.length,R=f===w-1,A=ua(a);return o.jsxs("div",{className:"space-y-3",children:[o.jsx("div",{className:"px-1",children:o.jsx(N0,{onFillMock:N,onClear:C})}),o.jsx(Ho,{config:A,className:A.wrapperClass,style:{minHeight:"100%",padding:"12px",borderRadius:"12px"},children:o.jsxs("div",{className:"max-w-4xl mx-auto space-y-4",children:[o.jsx(D0,{steps:n.map(I=>({id:I.id,label:I.config.label,icone:I.config.icone})),currentStep:f}),o.jsx(E0,{step:_,stepIndex:f,formValues:s,errors:p,eventoData:e,onChange:v}),o.jsx(P0,{currentStep:f,isLastStep:R,onBack:y,onNext:j})]})})]})},Tu=({id:e,currentTamanho:t,inicioColuna:r,onResize:a,pushSnapshot:n})=>{const s=E.useRef(null),[i,l]=E.useState(!1),[c,d]=E.useState(null),u=E.useRef(null);E.useEffect(()=>()=>{var m;(m=u.current)==null||m.call(u)},[]);const p=E.useCallback(m=>{m.preventDefault(),m.stopPropagation(),n==null||n();const x=s.current;if(!x)return;const g=x.parentElement;if(!g)return;const f=g.getBoundingClientRect().width,v=x.getBoundingClientRect().width,b=m.clientX,j=r?13-r:12;l(!0);const y=C=>{const k=C.clientX-b,_=(v+k)/f,w=Math.max(1,Math.min(j,Math.round(_*12)));d(w),a(w)},N=()=>{l(!1),d(null),u.current=null,window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",N)};u.current=()=>{l(!1),d(null),window.removeEventListener("mousemove",y),window.removeEventListener("mouseup",N)},window.addEventListener("mousemove",y),window.addEventListener("mouseup",N)},[r,a,n]);return{resizeRef:s,resizing:i,resizePreview:c,handleResizeStart:p}},I0=({id:e,elementRef:t,onPositionApply:r,setPositionDrag:a,setSelected:n,pushSnapshot:s})=>{const i=E.useRef(null);return E.useEffect(()=>()=>{var l;(l=i.current)==null||l.call(i)},[]),{handlePositionMouseDown:E.useCallback(l=>{l.preventDefault(),l.stopPropagation(),s==null||s(),n(e);const c=t.current;if(!c)return;const d=c.parentElement;if(!d)return;const u=d.getBoundingClientRect(),p=u.width/12,m=c.getBoundingClientRect(),x=Math.max(1,Math.round(m.width/p)),g=m.left-u.left,f=l.clientX-m.left,v=N=>{const C=N-u.left-f,k=Math.round(C/p)+1;return Math.max(1,Math.min(13-x,k))},b=Math.max(1,Math.min(12,Math.round(g/p)+1));a({itemId:e,ghostStart:b,ghostSpan:x,cursorX:l.clientX,cursorY:l.clientY});const j=N=>{a({itemId:e,ghostStart:v(N.clientX),ghostSpan:x,cursorX:N.clientX,cursorY:N.clientY})},y=N=>{r(v(N.clientX)),a(null),i.current=null,window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",y)};i.current=()=>{a(null),window.removeEventListener("mousemove",j),window.removeEventListener("mouseup",y)},window.addEventListener("mousemove",j),window.addEventListener("mouseup",y)},[e,t,r,a,n,s])}},Tr=({id:e,container:t})=>{const{attributes:r,listeners:a,setNodeRef:n,transform:s,transition:i,isDragging:l}=xt.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{selectedId:c,setSelected:d,getConfig:u,updateConfig:p,removeItem:m,setPositionDrag:x,positionDrag:g,pushSnapshot:f}=Je(),v=u(e),b=Ji(e),j=(b==null?void 0:b.icon)||P.Type,y=c===e,N=v.tamanho||6,C=(g==null?void 0:g.itemId)===e,[k,_]=E.useState(!1),w="var(--t-primary, hsl(var(--primary)))",R=y?w:k?`color-mix(in srgb, ${w} 60%, transparent)`:`color-mix(in srgb, ${w} 25%, transparent)`,A=y?`0 0 0 2px color-mix(in srgb, ${w} 30%, transparent)`:void 0,{resizeRef:I,resizing:F,resizePreview:V,handleResizeStart:M}=Tu({id:e,currentTamanho:N,inicioColuna:v.inicioColuna,onResize:$=>p(e,{tamanho:$}),pushSnapshot:f}),{handlePositionMouseDown:U}=I0({id:e,elementRef:I,onPositionApply:$=>p(e,{inicioColuna:$}),setPositionDrag:x,setSelected:d,pushSnapshot:f});return o.jsxs("div",{ref:$=>{n($),I.current=$},onClick:$=>{$.stopPropagation(),d(e)},"data-field-id":e,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),className:G("relative flex items-center gap-2 rounded border bg-card/80 backdrop-blur-sm px-2.5 pt-1.5 pb-3.5 cursor-pointer transition-all text-xs",F&&"ring-2 ring-blue-400/50",C&&"opacity-0 pointer-events-none"),style:{gridColumn:v.inicioColuna?`${v.inicioColuna} / span ${N}`:`span ${N}`,transform:Cr.CSS.Transform.toString(s),transition:i,opacity:l?0:1,borderColor:R,boxShadow:A},children:[o.jsx("div",{onMouseDown:U,onClick:$=>$.stopPropagation(),className:"cursor-ew-resize shrink-0 p-0.5 rounded hover:bg-primary/20 transition-colors",title:"Arrastar para mudar coluna",children:o.jsx(P.ArrowLeftRight,{className:"h-3 w-3 text-primary/60"})}),o.jsx("div",{...a,...r,className:"cursor-grab shrink-0",onClick:$=>$.stopPropagation(),children:o.jsx(P.GripVertical,{className:"h-3 w-3 text-primary"})}),o.jsx(j,{className:"h-3.5 w-3.5 text-primary shrink-0"}),o.jsx("span",{className:"font-medium truncate flex-1",children:v.label}),v.condition&&o.jsx(P.Zap,{className:"h-3 w-3 text-amber-500 shrink-0"}),v.required&&o.jsx("span",{className:"text-destructive font-bold",children:"*"}),o.jsxs("span",{className:"text-[9px] text-muted-foreground shrink-0",children:[V??N,"/12"]}),o.jsx("button",{onClick:$=>{$.stopPropagation(),m(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:k?1:0},children:o.jsx(P.Trash2,{className:"h-3 w-3 text-destructive"})}),o.jsx("div",{className:"absolute left-2 -bottom-0.5 font-mono truncate max-w-[90%] pointer-events-none text-[8px] text-muted-foreground/30",children:e}),o.jsx("div",{"data-resize":!0,onMouseDown:M,className:"cursor-col-resize absolute right-0 top-0 bottom-0 w-2 hover:bg-primary/20 transition-colors flex items-center justify-center",children:o.jsx(P.GripHorizontal,{className:"h-3 w-3 text-primary/40 rotate-90"})})]})},L0=({id:e,container:t})=>{var r;const{attributes:a,listeners:n,setNodeRef:s,transform:i,transition:l,isDragging:c}=xt.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{setNodeRef:d,isOver:u}=cr.useDroppable({id:`zone-${e}`}),{selectedId:p,setSelected:m,getConfig:x,removeItem:g,moveItem:f,containers:v}=Je(),b=x(e),j=(((r=v[e])==null?void 0:r.children)??[]).filter(C=>Ne(C)==="field"),y=p===e,N=b.tamanho||12;return o.jsxs("div",{ref:s,onClick:C=>{C.stopPropagation(),m(e)},className:G("group/fa relative rounded-lg border overflow-hidden transition-all",c&&"opacity-0 pointer-events-none",y?"border-amber-500 ring-2 ring-amber-500/20 shadow-lg":"border-amber-500/30 hover:border-amber-500/55"),style:{gridColumn:b.inicioColuna?`${b.inicioColuna} / span ${N}`:`span ${N}`,transform:Cr.CSS.Transform.toString(i),transition:l},children:[o.jsxs("div",{className:G("flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",y?"bg-amber-500/15 border-amber-500/30":"bg-amber-500/10 border-amber-500/20"),children:[o.jsx("div",{...n,...a,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-amber-500/20 transition-colors",onClick:C=>C.stopPropagation(),children:o.jsx(P.GripVertical,{className:"h-3.5 w-3.5 text-amber-500"})}),o.jsxs("div",{className:"flex flex-col -my-1 shrink-0",children:[o.jsx("button",{onClick:C=>{C.stopPropagation(),f(e,"up")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(P.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})}),o.jsx("button",{onClick:C=>{C.stopPropagation(),f(e,"down")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(P.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})})]}),o.jsx(P.List,{className:"h-3.5 w-3.5 text-amber-500 shrink-0"}),o.jsx("span",{className:"text-xs font-semibold truncate flex-1 text-amber-700 dark:text-amber-300",children:b.label}),o.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0 bg-amber-500/10 px-1.5 rounded",children:[b.itemLabel||"Item"," · ",j.length," campo",j.length!==1?"s":""]}),o.jsx("button",{onClick:C=>{C.stopPropagation(),g(e)},className:"opacity-0 group-hover/fa:opacity-100 transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",children:o.jsx(P.Trash2,{className:"h-3 w-3 text-destructive"})})]}),o.jsx("div",{className:"px-2 -mt-0.5 mb-0.5",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/30 font-mono",children:e})}),o.jsxs("div",{ref:d,className:G("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",u?"bg-amber-500/10 ring-2 ring-inset ring-amber-500/40":""),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[j.length===0&&o.jsx("p",{className:"text-[10px] text-muted-foreground/60 text-center py-2 italic",style:{gridColumn:"span 12"},children:"Arraste campos aqui"}),o.jsx(xt.SortableContext,{items:j,strategy:xt.rectSortingStrategy,children:j.map(C=>o.jsx(Tr,{id:C,container:e},C))})]})]})},xi=5,z0=({id:e,elementRef:t,tamanho:r,inicioColuna:a,onPositionApply:n,setPositionDrag:s,setSelected:i,reorderStrategy:l})=>{const c=E.useRef({inicioColuna:a,tamanho:r});c.current={inicioColuna:a,tamanho:r};const d=E.useRef(null);return E.useEffect(()=>()=>{var u;(u=d.current)==null||u.call(d)},[]),{handleGripMouseDown:E.useCallback(u=>{u.preventDefault(),u.stopPropagation(),i(e);const p=u.clientX,m=u.clientY;let x=!1;const g=()=>{d.current=null,window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",v)},f=y=>{const N=Math.abs(y.clientX-p),C=Math.abs(y.clientY-m);N<xi&&C<xi||(x=!0,g(),N>=C?b(y):j(y))},v=()=>{x||g()};window.addEventListener("mousemove",f),window.addEventListener("mouseup",v),d.current=g;const b=y=>{const N=t.current;if(!N)return;const C=N.parentElement;if(!C)return;const k=C.getBoundingClientRect(),_=k.width/12,{tamanho:w}=c.current,R=N.getBoundingClientRect(),A=R.left-k.left,I=Math.max(1,Math.min(12,Math.round(A/_)+1)),F=R.left;s({itemId:e,ghostStart:I,ghostSpan:w,cursorX:y.clientX,cursorY:y.clientY});const V=$=>{const T=$-F,D=Math.round(T/_)+1;return Math.max(1,Math.min(13-w,D))};s({itemId:e,ghostStart:V(y.clientX),ghostSpan:w,cursorX:y.clientX,cursorY:y.clientY});const M=$=>{s({itemId:e,ghostStart:V($.clientX),ghostSpan:w,cursorX:$.clientX,cursorY:$.clientY})},U=$=>{n(V($.clientX)),s(null),d.current=null,window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",U)};window.addEventListener("mousemove",M),window.addEventListener("mouseup",U),d.current=()=>{s(null),window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",U)}},j=y=>{const N=l,C=t.current;if(!C)return;const k=C.parentElement;if(!k)return;const _=N.dataAttribute||"data-container-id";N.pushSnapshot(),N.setReorderDrag({draggingId:e});let w=y.clientY;const R=I=>{const F=Array.from(k.children).filter(V=>V!==C&&V.getAttribute(_));for(const V of F){const M=V.getBoundingClientRect(),U=M.top+M.height/2;if(I.clientY<U&&I.clientY>M.top&&I.clientY<w){N.moveItemNoSnapshot(e,"up"),w=I.clientY;break}else if(I.clientY>U&&I.clientY<M.bottom&&I.clientY>w){N.moveItemNoSnapshot(e,"down"),w=I.clientY;break}}},A=()=>{N.setReorderDrag(null),d.current=null,window.removeEventListener("mousemove",R),window.removeEventListener("mouseup",A)};window.addEventListener("mousemove",R),window.addEventListener("mouseup",A),d.current=()=>{N.setReorderDrag(null),window.removeEventListener("mousemove",R),window.removeEventListener("mouseup",A)}}},[e,t,n,s,i,l])}},Bn=({showGuides:e,positionDrag:t})=>!e&&!t?null:o.jsxs(o.Fragment,{children:[e&&o.jsx("div",{className:"absolute inset-0 pointer-events-none z-10",style:{display:"grid",gridTemplateColumns:"repeat(12, 1fr)",padding:"inherit",gap:"inherit"},children:Array.from({length:12},(r,a)=>o.jsx("div",{className:"border border-dashed border-muted-foreground/20 rounded-sm flex items-end justify-center pb-1",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/40 font-mono",children:a+1})},a))}),t&&o.jsx("div",{className:"absolute pointer-events-none z-20 rounded-lg border-2 border-dashed border-destructive/60 bg-destructive/10",style:{top:"12px",bottom:"12px",left:`calc(${(t.ghostStart-1)/12*100}% + 12px)`,width:`calc(${t.ghostSpan/12*100}% - 8px)`,transition:"left 0.1s ease-out, width 0.1s ease-out"},children:o.jsxs("div",{className:"absolute -top-5 left-1/2 -translate-x-1/2 bg-destructive text-destructive-foreground text-[10px] font-bold px-2 py-0.5 rounded whitespace-nowrap",children:[t.ghostStart," →"," ",t.ghostStart+t.ghostSpan-1]})})]}),Un=({id:e,container:t})=>{var r;const{setNodeRef:a,isOver:n}=cr.useDroppable({id:`zone-${e}`}),{selectedId:s,setSelected:i,getConfig:l,updateConfig:c,removeItem:d,moveItem:u,moveItemNoSnapshot:p,setPositionDrag:m,positionDrag:x,reorderDrag:g,setReorderDrag:f,pushSnapshot:v,containers:b}=Je(),j=l(e),y=((r=b[e])==null?void 0:r.children)??[],N=y.filter(q=>Ne(q)==="field"),C=s===e,k=j.tamanho||12,_=(x==null?void 0:x.itemId)===e,w=(g==null?void 0:g.draggingId)===e,R=x&&y.includes(x.itemId),A=s&&y.includes(s)&&Ne(s)==="field",[I,F]=E.useState(!1),V="var(--t-primary, hsl(var(--primary)))",M=C?V:I?"rgba(59,130,246,0.55)":"rgba(59,130,246,0.3)",U=C?`color-mix(in srgb, ${V} 15%, transparent)`:I?"rgba(59,130,246,0.12)":"rgba(59,130,246,0.07)",$=C?`color-mix(in srgb, ${V} 30%, transparent)`:I?"rgba(59,130,246,0.28)":"rgba(59,130,246,0.18)",T=C?`0 0 0 3px color-mix(in srgb, ${V} 20%, transparent)`:I?"0 0 0 2px rgba(59,130,246,0.25)":void 0,{resizeRef:D,resizing:z,resizePreview:L,handleResizeStart:ee}=Tu({id:e,currentTamanho:k,inicioColuna:j.inicioColuna,onResize:q=>c(e,{tamanho:q}),pushSnapshot:v}),Y=E.useMemo(()=>({kind:"custom",moveItemNoSnapshot:p,pushSnapshot:v,setReorderDrag:f,dataAttribute:"data-container-id"}),[p,v,f]),{handleGripMouseDown:J}=z0({id:e,elementRef:D,tamanho:k,inicioColuna:j.inicioColuna||1,onPositionApply:q=>c(e,{inicioColuna:q}),setPositionDrag:m,setSelected:i,reorderStrategy:Y});return o.jsxs(o.Fragment,{children:[o.jsxs("div",{ref:q=>{D.current=q},onClick:q=>{q.stopPropagation(),i(e)},onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1),className:G("relative rounded-lg border overflow-hidden transition-all",z&&"ring-2 ring-blue-400/50",_&&"opacity-0 pointer-events-none",w&&"opacity-50"),"data-container-id":e,style:{gridColumn:j.inicioColuna?`${j.inicioColuna} / span ${k}`:`span ${k}`,minWidth:"80px",borderColor:M,boxShadow:T},children:[o.jsxs("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",style:{backgroundColor:U,borderColor:$},children:[o.jsx("div",{"data-grip":!0,onMouseDown:J,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-primary/20 transition-colors",children:o.jsx(P.GripVertical,{className:"h-3.5 w-3.5 text-blue-500"})}),o.jsxs("div",{className:"flex flex-col -my-1 shrink-0",children:[o.jsx("button",{onClick:q=>{q.stopPropagation(),u(e,"up")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para cima",children:o.jsx(P.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})}),o.jsx("button",{onClick:q=>{q.stopPropagation(),u(e,"down")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para baixo",children:o.jsx(P.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})})]}),o.jsx(P.BoxSelect,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"}),o.jsx("span",{className:G("text-xs font-semibold truncate flex-1",j.showLabel===!1?"text-blue-500/50 italic":"text-blue-700 dark:text-blue-300"),children:j.label}),j.showAsCard&&o.jsx(P.SquareStack,{className:"h-3 w-3 text-blue-400 shrink-0"}),j.showLabel===!1&&o.jsx(P.EyeOff,{className:"h-3 w-3 text-muted-foreground/50 shrink-0"}),o.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0 bg-blue-500/10 px-1.5 rounded",children:[L??k,"/12"]}),o.jsx("button",{onClick:q=>{q.stopPropagation(),d(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:I?1:0},children:o.jsx(P.Trash2,{className:"h-3 w-3 text-destructive"})})]}),o.jsx("div",{className:"px-2 -mt-0.5 mb-0.5",children:o.jsx("span",{className:"text-[8px] text-muted-foreground/30 font-mono",children:e})}),o.jsxs("div",{ref:a,className:G("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",n?"bg-primary/15 ring-2 ring-inset ring-primary/50":(R||A)&&"bg-muted/30"),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[o.jsx(Bn,{showGuides:!!R||!!A,positionDrag:R?x:null}),y.length===0&&o.jsx("p",{className:"text-[10px] text-muted-foreground/60 text-center py-2 italic",style:{gridColumn:"span 12"},children:"Arraste campos aqui"}),o.jsx(xt.SortableContext,{items:N,strategy:xt.rectSortingStrategy,children:y.filter(q=>Ne(q)==="field").map(q=>l(q).fieldType==="field_array"?o.jsx(L0,{id:q,container:e},q):o.jsx(Tr,{id:q,container:e},q))})]}),o.jsx("div",{onMouseDown:ee,className:"cursor-col-resize absolute right-0 top-0 bottom-0 w-2 hover:bg-blue-500/20 transition-colors flex items-center justify-center",children:o.jsx(P.GripHorizontal,{className:"h-3 w-3 text-blue-500/40 rotate-90"})})]}),_&&x&&Bo.createPortal(o.jsxs("div",{style:{position:"fixed",left:x.cursorX+14,top:x.cursorY-18,zIndex:9999,pointerEvents:"none"},className:"flex items-center gap-1 bg-foreground text-background text-[10px] font-mono px-2 py-0.5 rounded shadow-xl border border-border/20",children:[o.jsx(P.BoxSelect,{className:"h-2.5 w-2.5"}),"col ",x.ghostStart,"–",x.ghostStart+x.ghostSpan-1]}),document.body)," "]})},$u=({id:e,container:t,index:r})=>{var a;const{attributes:n,listeners:s,setNodeRef:i,transform:l,transition:c,isDragging:d}=xt.useSortable({id:e,data:{isCanvasItem:!0,type:"step",id:e}}),{setNodeRef:u,isOver:p}=cr.useDroppable({id:`zone-${e}`}),{selectedId:m,setSelected:x,getConfig:g,removeItem:f,containers:v,positionDrag:b}=Je(),j=g(e),y=((a=v[e])==null?void 0:a.children)??[],N=m===e,C=b&&y.includes(b.itemId),[k,_]=E.useState(!1),w="var(--t-primary, hsl(var(--primary)))",R=N?w:k?`color-mix(in srgb, ${w} 60%, transparent)`:`color-mix(in srgb, ${w} 25%, transparent)`,A=N?`color-mix(in srgb, ${w} 14%, transparent)`:k?`color-mix(in srgb, ${w} 10%, transparent)`:`color-mix(in srgb, ${w} 6%, transparent)`,I=N?`color-mix(in srgb, ${w} 28%, transparent)`:`color-mix(in srgb, ${w} 15%, transparent)`,F=N?`0 0 0 3px color-mix(in srgb, ${w} 20%, transparent)`:void 0,V={transform:Cr.CSS.Transform.toString(l),transition:c,opacity:d?0:1};return o.jsxs("div",{ref:i,style:{...V,borderWidth:"2px",borderStyle:"solid",borderColor:R,boxShadow:F},onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),onClick:M=>{M.stopPropagation(),x(e)},className:"group/step rounded-xl overflow-hidden transition-all",children:[o.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2",style:{backgroundColor:A,borderColor:I},children:[o.jsx("div",{...s,...n,className:"cursor-grab shrink-0",onClick:M=>M.stopPropagation(),children:o.jsx(P.GripVertical,{className:"h-3.5 w-3.5 text-primary"})}),o.jsx(P.Layers,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("span",{className:"text-sm font-bold truncate flex-1 text-primary",children:["Step ",r+1," — ",j.label]}),j.description&&o.jsx("span",{className:"text-[10px] text-muted-foreground truncate hidden md:block",children:j.description}),o.jsx("button",{onClick:M=>{M.stopPropagation(),f(e)},className:"transition-opacity shrink-0 p-1 rounded hover:bg-destructive/10",style:{opacity:k?1:0},children:o.jsx(P.Trash2,{className:"h-3.5 w-3.5 text-destructive"})})]}),o.jsxs("div",{ref:u,className:G("relative p-3 min-h-[80px] gap-2 items-start transition-all duration-150",p?"bg-blue-500/20 ring-2 ring-inset ring-blue-400/70 shadow-[inset_0_0_0_2px_theme(colors.blue.400/50%)]":""),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content",backgroundImage:"radial-gradient(circle, hsl(var(--muted-foreground) / 0.15) 1px, transparent 1px)",backgroundSize:"16px 16px"},children:[o.jsx(Bn,{showGuides:!!C,positionDrag:C?b:null}),y.length===0&&o.jsx("p",{className:"text-xs text-muted-foreground/50 text-center py-6 italic w-full",style:{gridColumn:"span 12"},children:"Arraste containers aqui"}),y.map(M=>Ne(M)==="container"?o.jsx(Un,{id:M,container:e},M):o.jsx(Tr,{id:M,container:e},M))]})]})},M0=()=>{var e;const{containers:t,setSelected:r}=Je(),a=((e=t.root)==null?void 0:e.children)??[],n=a.filter(l=>Ne(l)==="step"),{setNodeRef:s,isOver:i}=cr.useDroppable({id:"root"});return o.jsxs("div",{ref:s,onClick:()=>r(null),className:`min-h-[500px] rounded-xl border p-4 space-y-4 transition-all duration-150 ${i?"bg-primary/10 border-primary/60 ring-2 ring-primary/30 shadow-[0_0_0_4px_theme(colors.primary/10%)]":"border-border/40"}`,style:{backgroundImage:"radial-gradient(circle, hsl(var(--muted-foreground) / 0.12) 1px, transparent 1px)",backgroundSize:"20px 20px",backgroundColor:i?void 0:"hsl(var(--muted) / 0.3)"},children:[a.length===0&&o.jsx("div",{className:"flex items-center justify-center h-[400px]",children:o.jsxs("div",{className:"text-center space-y-2",children:[o.jsx(P.Layers,{className:"h-10 w-10 text-muted-foreground/30 mx-auto"}),o.jsxs("p",{className:"text-sm text-muted-foreground/50",children:["Arraste ",o.jsx("strong",{children:"Steps"})," da paleta para cá"]})]})}),o.jsx(xt.SortableContext,{items:n,strategy:xt.verticalListSortingStrategy,children:a.map((l,c)=>{const d=Ne(l);return d==="step"?o.jsx($u,{id:l,container:"root",index:c},l):d==="container"?o.jsx(Un,{id:l,container:"root"},l):o.jsx(Tr,{id:l,container:"root"},l)})})]})},F0={personal:"Pessoal",address:"Endereço",health:"Saúde",event:"Evento",payment:"Pagamento",emergency:"Emergência"},V0={texto:"Texto",selecao:"Seleção",range:"Numérico / Visual",data:"Data e Hora",contato:"Contato / Endereço",outros:"Arquivo / Outros"},B0=()=>{const e=St.reduce((t,r)=>{const a=r.group??"outros";return t[a]||(t[a]=[]),t[a].push(r),t},{});return o.jsxs("div",{className:"space-y-4",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx("h2",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Estrutura"}),an.map(t=>o.jsx(gi,{component:t.component,label:t.label,icon:t.icon,color:t.color},t.component))]}),Object.entries(e).map(([t,r])=>o.jsx(ho,{label:V0[t]??t,children:r.map(a=>o.jsx(gi,{component:a.component,label:a.label,icon:a.icon,color:"border-border"},a.component))},t)),o.jsx(ho,{label:"Blocos pré-configurados",defaultOpen:!1,children:pa.map(t=>o.jsx(U0,{block:t},t.id))}),o.jsx(ho,{label:"Blocos de steps",defaultOpen:!1,children:qo.map(t=>o.jsx(H0,{block:t},t.id))})]})},ho=({label:e,children:t,defaultOpen:r=!0})=>{const[a,n]=E.useState(r);return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("button",{type:"button",onClick:()=>n(s=>!s),className:"flex w-full items-center justify-between text-xs font-semibold text-muted-foreground uppercase tracking-wide hover:text-foreground transition-colors",children:[e,o.jsx(P.ChevronDown,{className:`h-3.5 w-3.5 transition-transform ${a?"":"-rotate-90"}`})]}),a&&o.jsx("div",{className:"space-y-1.5",children:t})]})},gi=({component:e,label:t,icon:r,color:a})=>{const{attributes:n,listeners:s,setNodeRef:i,transform:l,isDragging:c}=cr.useDraggable({id:`palette-${e}`,data:{isPaletteItem:!0,componentType:e}});return o.jsxs("div",{ref:i,...s,...n,className:`cursor-grab flex items-center gap-2 rounded-lg border px-3 py-2 select-none hover:bg-accent transition-colors ${a} ${c?"opacity-50":""}`,style:{transform:c?void 0:Cr.CSS.Translate.toString(l)},children:[o.jsx(P.GripVertical,{className:"h-4 w-4 text-muted-foreground"}),o.jsx(r,{className:"h-4 w-4"}),o.jsx("span",{className:"text-sm font-medium",children:t})]})},U0=({block:e})=>{const{attributes:t,listeners:r,setNodeRef:a,transform:n,isDragging:s}=cr.useDraggable({id:`preset-${e.id}`,data:{isPalettePreset:!0,presetId:e.id}}),i=e.icon?ct[e.icon]:void 0,l=F0[e.category]??e.category;return o.jsxs("div",{ref:a,...r,...t,className:`cursor-grab flex items-center gap-2 rounded-lg border border-primary/30 bg-primary/5 px-3 py-2 select-none hover:bg-primary/10 transition-colors ${s?"opacity-50":""}`,style:{transform:s?void 0:Cr.CSS.Translate.toString(n)},title:e.description,children:[o.jsx(P.GripVertical,{className:"h-4 w-4 text-muted-foreground shrink-0"}),i?o.jsx(i,{className:"h-4 w-4 text-primary shrink-0"}):o.jsx(ct.Blocks,{className:"h-4 w-4 text-primary shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-medium block truncate",children:e.name}),o.jsx("span",{className:"text-[10px] text-muted-foreground",children:l})]})]})},H0=({block:e})=>{const{addPresetStepBlock:t}=Je(),r=e.icon?ct[e.icon]:void 0;return o.jsxs("button",{type:"button",onClick:()=>t(e),className:"w-full flex items-center gap-2 rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 cursor-pointer select-none hover:bg-amber-500/15 transition-colors text-left",title:e.description,children:[r?o.jsx(r,{className:"h-4 w-4 text-amber-400 shrink-0"}):o.jsx(ct.Layers,{className:"h-4 w-4 text-amber-400 shrink-0"}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("span",{className:"text-sm font-medium block truncate",children:e.name}),o.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[e.steps.length," steps"]})]}),o.jsxs("span",{className:"text-[10px] text-amber-400 border border-amber-500/30 rounded px-1.5 py-0.5 shrink-0",children:["+",e.steps.length," steps"]})]})},xo=e=>({when:e.campoId,operator:e.operador,value:e.valor,source:e.source}),Ru=e=>{var t;const r={campoId:e.when,operador:e.operator,valor:e.value,source:e.source};if(e.logicOperator&&(t=e.extraConditions)!=null&&t.length){const a=e.extraConditions.map(s=>({campoId:s.when,operador:s.operator,valor:s.value,source:s.source})),n=[r,...a];return e.logicOperator==="or"?{or:n}:{and:n}}return r},Ou=e=>{if("campoId"in e)return xo(e);const t=("and"in e?e.and:e.or)??[];if(t.length===0)return;const r="and"in e?"and":"or",[a,...n]=t;if(!("campoId"in a))return;const s=xo(a);return n.length===0?s:{...s,logicOperator:r,extraConditions:n.filter(i=>"campoId"in i).map(xo)}},W0=(e,t,r)=>{var a,n;const s=l=>t[l]||{label:l,name:l},i=(((n=(a=e==null?void 0:e.containers)==null?void 0:a.root)==null?void 0:n.children)||[]).filter(l=>Ne(l)==="step").map((l,c)=>{var d,u;const p=s(l),m=(((u=(d=e==null?void 0:e.containers)==null?void 0:d[l])==null?void 0:u.children)||[]).filter(x=>Ne(x)==="container").map((x,g)=>{var f,v;const b=s(x),j=(((v=(f=e==null?void 0:e.containers)==null?void 0:f[x])==null?void 0:v.children)||[]).filter(N=>Ne(N)==="field").map((N,C)=>{var k,_;const w=s(N),R=Fo(w,N,C);if(R.tipo===O.FIELD_ARRAY){const A=((_=(k=e==null?void 0:e.containers)==null?void 0:k[N])==null?void 0:_.children)??[];R.subFields=A.filter(I=>Ne(I)==="field").map((I,F)=>Fo(s(I),I,F))}return R}),y={id:x,titulo:b.label||"Container",descricao:b.description,icone:b.icone,ordem:g,colunas:b.columns||2,tamanho:b.tamanho||12,inicioColuna:b.inicioColuna,showLabel:b.showLabel,showAsCard:b.showAsCard,campos:j};return b.condition&&(y.condicional=Ru(b.condition)),y});return{id:l,titulo:p.label||"Step",descricao:p.description,icone:p.icone,ordem:c,showLabel:p.showLabel,containers:m}});return{id:r.id||"",nome:r.nome,descricao:r.descricao,status:r.status,template:r.template??null,steps:i}},Fo=(e,t,r)=>{var a,n,s,i;const l={id:t,nome:e.name||t,label:e.label||"",tipo:e.fieldType||"texto",obrigatorio:e.required||!1,tamanho:e.tamanho||6,inicioColuna:e.inicioColuna,ordem:r,placeholder:e.placeholder,hint:e.hint,defaultValue:e.defaultValue,mascara:e.mascara,mascaraCustom:e.mascaraCustom,locked:e.locked||void 0,visualStyle:e.visualStyle,isReadOnly:e.isReadOnly||void 0,isDisabled:e.isDisabled||void 0,clearedValue:e.clearedValue!==void 0?e.clearedValue:void 0,initialValue:e.initialValue!==void 0?e.initialValue:void 0,resolvePropsKey:e.resolvePropsKey||void 0};if((a=e.validate)!=null&&a.length&&(l.validate=e.validate),(n=e.warn)!=null&&n.length&&(l.warn=e.warn),(s=e.options)!=null&&s.length&&(l.opcoes=e.options.map(c=>({valor:c.value,label:c.label,disabled:c.disabled}))),e.validation){const c=e.validation;l.validacao={},c.minLength!==void 0&&(l.validacao.minLength=c.minLength),c.maxLength!==void 0&&(l.validacao.maxLength=c.maxLength),c.min!==void 0&&(l.validacao.min=c.min),c.max!==void 0&&(l.validacao.max=c.max),c.regex&&(l.validacao.regex=c.regex),c.regexMessage&&(l.validacao.regexMessage=c.regexMessage),c.minDate&&(l.validacao.minDate=c.minDate),c.maxDate&&(l.validacao.maxDate=c.maxDate),c.minAge!==void 0&&(l.validacao.minAge=c.minAge),c.maxAge!==void 0&&(l.validacao.maxAge=c.maxAge),(i=c.fileTypes)!=null&&i.length&&(l.validacao.fileTypes=c.fileTypes),c.maxFileSize!==void 0&&(l.validacao.maxFileSize=c.maxFileSize)}if(l.tipo===O.FIELD_ARRAY&&(e.itemLabel&&(l.itemLabel=e.itemLabel),e.minItems!==void 0&&(l.minItems=e.minItems),e.maxItems!==void 0&&(l.maxItems=e.maxItems),e.addLabel&&(l.addLabel=e.addLabel)),l.tipo===O.TERMS&&(e.termoTexto&&(l.termoTexto=e.termoTexto),e.termoPdfUrl&&(l.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(l.termoPdfUploadId=e.termoPdfUploadId)),l.tipo===O.SLIDER&&(e.step!==void 0&&(l.step=e.step),e.minValue!==void 0&&(l.minValue=e.minValue),e.maxValue!==void 0&&(l.maxValue=e.maxValue)),l.tipo===O.RATING&&e.maxRating!==void 0&&(l.maxRating=e.maxRating),l.tipo===O.DATE_RANGE&&(e.dateRangeStartLabel&&(l.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(l.dateRangeEndLabel=e.dateRangeEndLabel)),l.tipo===O.SUB_FORM){const c=e.subSchemaFields??[];(c.length>0||e.subSchemaTitle)&&(l.subSchema={titulo:e.subSchemaTitle,fields:c.map((d,u)=>Fo(d,d.name??`subfield-${u}`,u))})}return e.condition&&(l.condicional=Ru(e.condition)),l},Du=e=>{const t={},r={root:{children:[]}},a=[...e.steps].sort((n,s)=>n.ordem-s.ordem);for(const n of a){const s=n.id||`step-${Fe()}`;r.root.children.push(s),t[s]={label:n.titulo,name:s,fieldType:"step",description:n.descricao,icone:n.icone,showLabel:n.showLabel};const i=[],l=[...n.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of l){const d=c.id||`container-${Fe()}`;i.push(d);const u=c.condicional?Ou(c.condicional):void 0;t[d]={label:c.titulo,name:d,fieldType:"container",description:c.descricao,icone:c.icone,columns:c.colunas,tamanho:c.tamanho||12,inicioColuna:c.inicioColuna,showLabel:c.showLabel,showAsCard:c.showAsCard,...u?{condition:u}:{}};const p=[],m=[...c.campos].sort((x,g)=>x.ordem-g.ordem);for(const x of m){const g=x.id||`${x.tipo}-${Fe()}`;if(p.push(g),t[g]=Vo(x),x.tipo===O.FIELD_ARRAY){const f=[];for(const v of x.subFields??[]){const b=v.id||`${v.tipo}-${Fe()}`;f.push(b),t[b]=Vo(v)}r[g]={children:f}}}r[d]={children:p}}r[s]={children:i}}return{dndState:{containers:r},configs:t,templateId:e.template??null}},Vo=(e,t)=>{var r,a,n,s;const i={label:e.label,name:e.nome,fieldType:e.tipo,required:e.obrigatorio,tamanho:e.tamanho,inicioColuna:e.inicioColuna,placeholder:e.placeholder,hint:e.hint,defaultValue:e.defaultValue,mascara:e.mascara,mascaraCustom:e.mascaraCustom,locked:e.locked||void 0,visualStyle:e.visualStyle,isReadOnly:e.isReadOnly||void 0,isDisabled:e.isDisabled||void 0,clearedValue:e.clearedValue!=null?String(e.clearedValue):void 0,initialValue:e.initialValue!==void 0?String(e.initialValue):void 0,resolvePropsKey:e.resolvePropsKey||void 0,validate:(r=e.validate)!=null&&r.length?e.validate:void 0,warn:(a=e.warn)!=null&&a.length?e.warn:void 0};if((n=e.opcoes)!=null&&n.length&&(i.options=e.opcoes.map(l=>({value:l.valor,label:l.label,disabled:l.disabled}))),e.validacao){const l=e.validacao;i.validation={},l.minLength!==void 0&&(i.validation.minLength=l.minLength),l.maxLength!==void 0&&(i.validation.maxLength=l.maxLength),l.min!==void 0&&(i.validation.min=l.min),l.max!==void 0&&(i.validation.max=l.max),l.regex&&(i.validation.regex=l.regex),l.regexMessage&&(i.validation.regexMessage=l.regexMessage),l.minDate&&(i.validation.minDate=l.minDate),l.maxDate&&(i.validation.maxDate=l.maxDate),l.minAge!==void 0&&(i.validation.minAge=l.minAge),l.maxAge!==void 0&&(i.validation.maxAge=l.maxAge),(s=l.fileTypes)!=null&&s.length&&(i.validation.fileTypes=l.fileTypes),l.maxFileSize!==void 0&&(i.validation.maxFileSize=l.maxFileSize)}if(e.tipo===O.FIELD_ARRAY&&(e.itemLabel&&(i.itemLabel=e.itemLabel),e.minItems!==void 0&&(i.minItems=e.minItems),e.maxItems!==void 0&&(i.maxItems=e.maxItems),e.addLabel&&(i.addLabel=e.addLabel)),e.tipo===O.TERMS&&(e.termoTexto&&(i.termoTexto=e.termoTexto),e.termoPdfUrl&&(i.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(i.termoPdfUploadId=e.termoPdfUploadId)),e.tipo===O.SLIDER&&(e.step!==void 0&&(i.step=e.step),e.minValue!==void 0&&(i.minValue=e.minValue),e.maxValue!==void 0&&(i.maxValue=e.maxValue)),e.tipo===O.RATING&&e.maxRating!==void 0&&(i.maxRating=e.maxRating),e.tipo===O.DATE_RANGE&&(e.dateRangeStartLabel&&(i.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(i.dateRangeEndLabel=e.dateRangeEndLabel)),e.tipo===O.SUB_FORM&&e.subSchema&&(i.subSchemaTitle=e.subSchema.titulo,i.subSchemaFields=e.subSchema.fields.map(l=>Vo(l,l.id))),e.condicional){const l=Ou(e.condicional);l&&(i.condition=l)}return i},q0=(e,t)=>{var r,a,n,s,i,l,c;const d=[],u=[],p=g=>t[g]||{label:g,name:g},m=((a=(r=e==null?void 0:e.containers)==null?void 0:r.root)==null?void 0:a.children)||[],x=new Set;for(const g of m){if(Ne(g)!=="step")continue;const f=p(g).label||g,v=((s=(n=e==null?void 0:e.containers)==null?void 0:n[g])==null?void 0:s.children)||[];if(v.length===0){u.push(`Step "${f}" está vazio (sem containers).`);continue}for(const b of v){if(Ne(b)!=="container")continue;const j=p(b).label||b,y=((l=(i=e==null?void 0:e.containers)==null?void 0:i[b])==null?void 0:l.children)||[],N=new Map;for(const C of y){if(Ne(C)!=="field")continue;x.add(C);const k=p(C).name||C;N.has(k)||N.set(k,[]),N.get(k).push(C)}for(const[C,k]of N.entries())k.length>1&&d.push(`Nome duplicado "${C}" no container "${j}" (IDs: ${k.join(", ")}).`)}}for(const[g,f]of Object.entries(t)){if(!((c=f.condition)!=null&&c.when))continue;const v=f.condition.when;if(!x.has(v)){const b=f.label||g;u.push(`Campo "${b}" referencia campo inexistente na condição (when: "${v}").`)}}return{errors:d,warnings:u}},Z0=[...an,...St],X0=({data:e})=>{const{getConfig:t}=Je();if(!e)return null;const r=e;if(r.isPalettePreset){const a=ji(r.presetId);return o.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary text-primary-foreground px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none",children:[o.jsx(ct.Blocks,{className:"h-3.5 w-3.5 shrink-0"}),(a==null?void 0:a.name)??"Bloco"]})}if(r.isPaletteItem){const a=Z0.find(s=>s.component===r.componentType),n=a==null?void 0:a.icon;return o.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary text-primary-foreground px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none",children:[n&&o.jsx(n,{className:"h-3.5 w-3.5 shrink-0"}),(a==null?void 0:a.label)??r.componentType]})}if(r.isCanvasItem){const{type:a,id:n}=r,s=t(n),i={step:"border-primary/80 bg-primary text-primary-foreground",container:"border-blue-600 bg-blue-600 text-white",field:"border-primary/80 bg-primary text-primary-foreground"},l={step:"Step",container:"Container",field:"Campo"};return o.jsxs("div",{className:G("flex items-center gap-2 rounded-full px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none min-w-[100px] max-w-[200px]",i[a]??"border-border bg-card"),children:[o.jsx(P.GripVertical,{className:"h-3 w-3 opacity-60 shrink-0"}),o.jsxs("span",{className:"opacity-70 shrink-0",children:[l[a]??a,":"]}),o.jsx("span",{className:"truncate",children:s.label||n})]})}return null},G0=({schema:e,children:t})=>{var r;const a=E.useMemo(()=>{var n;return(n=e==null?void 0:e.steps)!=null&&n.length?Du(e):null},[e]);return o.jsx(n0,{children:o.jsx(rl,{initialConfigs:a==null?void 0:a.configs,initialContainers:(r=a==null?void 0:a.dndState)==null?void 0:r.containers,initialTemplateId:(a==null?void 0:a.templateId)??void 0,schemaId:(e==null?void 0:e.id)??void 0,children:t})})};exports.BuilderProvider=rl;exports.BuilderWrapper=G0;exports.Canvas=M0;exports.ConfigPanel=b0;exports.ContainerRenderer=Gi;exports.DFCepField=rn;exports.DFCheckbox=va;exports.DFCheckboxGroup=Qo;exports.DFDateField=ar;exports.DFFieldArray=Mi;exports.DFFileUpload=tn;exports.DFHidden=ba;exports.DFMaskedInput=Ct;exports.DFParticipationType=Fi;exports.DFPaymentMethod=Ui;exports.DFRadioGroup=en;exports.DFSelect=ga;exports.DFTerms=Hi;exports.DFTextField=Be;exports.DFTextarea=xa;exports.DragGhost=X0;exports.DroppedContainer=Un;exports.DroppedField=Tr;exports.DroppedStep=$u;exports.EVENT_VARIABLES=on;exports.FIELD_TYPES=St;exports.FIELD_TYPE_ICONS=op;exports.FIELD_TYPE_LABELS=ap;exports.FieldType=O;exports.FormRenderer=th;exports.FormSchemaStatus=vi;exports.FormSpy=rh;exports.GridOverlay=Bn;exports.LivePreview=A0;exports.MaskType=bi;exports.OPCOES_POR_DIA=Vi;exports.OPCOES_TODOS_OS_DIAS=Bi;exports.PRESET_BLOCKS=pa;exports.PRESET_STEP_BLOCKS=qo;exports.Palette=B0;exports.RendererContext=Jo;exports.STRUCTURE_TYPES=an;exports.StepRenderer=Yi;exports.TEMPLATE_REGISTRY=zt;exports.TemplateProvider=Ho;exports.builderToFormSchema=W0;exports.evaluateFieldCondition=rt;exports.findParentContainer=tl;exports.formSchemaToBuilder=Du;exports.generateId=yi;exports.getAllTemplates=yp;exports.getFieldMeta=ah;exports.getFieldMetaById=Ji;exports.getItemType=Ne;exports.getPresetById=ji;exports.getPresetStepBlockById=Sp;exports.getPresetsByCategory=Cp;exports.getTemplateConfig=ua;exports.interpolate=Xe;exports.interpolateContainer=ha;exports.interpolateField=Ii;exports.interpolateStep=Li;exports.isDarkTemplate=wi;exports.isGlassmorphism=wp;exports.makeStepResolver=Di;exports.makeStepWarnComputer=Ai;exports.useBuilder=Je;exports.useField=Yf;exports.useFieldApi=Kf;exports.useFormApi=Gf;exports.useFormState=Ki;exports.useRendererContext=dt;exports.useTemplate=Wo;exports.v4Fallback=Fe;exports.validateBuilderIntegrity=q0;
75
+ Defaulting to \`null\`.`}var Ku=Wu,jy=Xu;const Js=x.forwardRef(({className:e,value:t,...r},o)=>a.jsx(Ku,{ref:o,className:J("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...r,children:a.jsx(jy,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));Js.displayName=Ku.displayName;const Ny=x.forwardRef(({value:e,onChange:t,uploadProgress:r,accept:o,disabled:n,multiple:s=!1,placeholder:l="Nenhum arquivo selecionado",className:i,buttonLabel:c="Selecionar arquivo"},d)=>{const m=x.useRef(null);x.useImperativeHandle(d,()=>m.current);const u=()=>{var f;n||(f=m.current)==null||f.click()},h=f=>{var g;const w=((g=f.target.files)==null?void 0:g[0])??null;t==null||t(w),f.target.value=""},p=f=>{f.stopPropagation(),t==null||t(null)},y=r!==void 0&&r>0&&r<100;return a.jsxs("div",{className:J("space-y-2",i),children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs($e,{type:"button",variant:"outline",size:"sm",onClick:u,disabled:n||y,className:"shrink-0 gap-1.5",children:[a.jsx(O.Upload,{className:"h-4 w-4"}),c]}),a.jsx("span",{className:"flex-1 truncate text-sm text-muted-foreground",children:e?e.name:l}),e&&!y&&a.jsx($e,{type:"button",variant:"ghost",size:"icon",onClick:p,disabled:n,className:"h-7 w-7 shrink-0","aria-label":"Remover arquivo",children:a.jsx(O.X,{className:"h-4 w-4"})})]}),y&&a.jsx(Js,{value:r,className:"h-1.5"}),a.jsx("input",{ref:m,type:"file",accept:o,multiple:s,disabled:n,onChange:h,className:"sr-only","aria-hidden":"true",tabIndex:-1})]})});Ny.displayName="FileInput";var zo="Dialog",[Yu]=jt(zo),[Cy,Ft]=Yu(zo),Zu=e=>{const{__scopeDialog:t,children:r,open:o,defaultOpen:n,onOpenChange:s,modal:l=!0}=e,i=x.useRef(null),c=x.useRef(null),[d,m]=Ut({prop:o,defaultProp:n??!1,onChange:s,caller:zo});return a.jsx(Cy,{scope:t,triggerRef:i,contentRef:c,contentId:Zt(),titleId:Zt(),descriptionId:Zt(),open:d,onOpenChange:m,onOpenToggle:x.useCallback(()=>m(u=>!u),[m]),modal:l,children:r})};Zu.displayName=zo;var Ju="DialogTrigger",ky=x.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Ft(Ju,r),s=je(t,n.triggerRef);return a.jsx(be.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":tl(n.open),...o,ref:s,onClick:xe(e.onClick,n.onOpenToggle)})});ky.displayName=Ju;var Qs="DialogPortal",[Sy,Qu]=Yu(Qs,{forceMount:void 0}),em=e=>{const{__scopeDialog:t,forceMount:r,children:o,container:n}=e,s=Ft(Qs,t);return a.jsx(Sy,{scope:t,forceMount:r,children:x.Children.map(o,l=>a.jsx(Nt,{present:r||s.open,children:a.jsx(Do,{asChild:!0,container:n,children:l})}))})};em.displayName=Qs;var so="DialogOverlay",tm=x.forwardRef((e,t)=>{const r=Qu(so,e.__scopeDialog),{forceMount:o=r.forceMount,...n}=e,s=Ft(so,e.__scopeDialog);return s.modal?a.jsx(Nt,{present:o||s.open,children:a.jsx(Ey,{...n,ref:t})}):null});tm.displayName=so;var $y=Gr("DialogOverlay.RemoveScroll"),Ey=x.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Ft(so,r);return a.jsx(Oo,{as:$y,allowPinchZoom:!0,shards:[n.contentRef],children:a.jsx(be.div,{"data-state":tl(n.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),Ar="DialogContent",rm=x.forwardRef((e,t)=>{const r=Qu(Ar,e.__scopeDialog),{forceMount:o=r.forceMount,...n}=e,s=Ft(Ar,e.__scopeDialog);return a.jsx(Nt,{present:o||s.open,children:s.modal?a.jsx(Ay,{...n,ref:t}):a.jsx(_y,{...n,ref:t})})});rm.displayName=Ar;var Ay=x.forwardRef((e,t)=>{const r=Ft(Ar,e.__scopeDialog),o=x.useRef(null),n=je(t,r.contentRef,o);return x.useEffect(()=>{const s=o.current;if(s)return Xs(s)},[]),a.jsx(am,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:xe(e.onCloseAutoFocus,s=>{var l;s.preventDefault(),(l=r.triggerRef.current)==null||l.focus()}),onPointerDownOutside:xe(e.onPointerDownOutside,s=>{const l=s.detail.originalEvent,i=l.button===0&&l.ctrlKey===!0;(l.button===2||i)&&s.preventDefault()}),onFocusOutside:xe(e.onFocusOutside,s=>s.preventDefault())})}),_y=x.forwardRef((e,t)=>{const r=Ft(Ar,e.__scopeDialog),o=x.useRef(!1),n=x.useRef(!1);return a.jsx(am,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var l,i;(l=e.onCloseAutoFocus)==null||l.call(e,s),s.defaultPrevented||(o.current||(i=r.triggerRef.current)==null||i.focus(),s.preventDefault()),o.current=!1,n.current=!1},onInteractOutside:s=>{var l,i;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const c=s.target;(i=r.triggerRef.current)!=null&&i.contains(c)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&n.current&&s.preventDefault()}})}),am=x.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:n,onCloseAutoFocus:s,...l}=e,i=Ft(Ar,r),c=x.useRef(null),d=je(t,c);return Os(),a.jsxs(a.Fragment,{children:[a.jsx($o,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:n,onUnmountAutoFocus:s,children:a.jsx(Ca,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":tl(i.open),...l,ref:d,onDismiss:()=>i.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(Ty,{titleId:i.titleId}),a.jsx(Dy,{contentRef:c,descriptionId:i.descriptionId})]})]})}),el="DialogTitle",om=x.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Ft(el,r);return a.jsx(be.h2,{id:n.titleId,...o,ref:t})});om.displayName=el;var nm="DialogDescription",sm=x.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Ft(nm,r);return a.jsx(be.p,{id:n.descriptionId,...o,ref:t})});sm.displayName=nm;var lm="DialogClose",im=x.forwardRef((e,t)=>{const{__scopeDialog:r,...o}=e,n=Ft(lm,r);return a.jsx(be.button,{type:"button",...o,ref:t,onClick:xe(e.onClick,()=>n.onOpenChange(!1))})});im.displayName=lm;function tl(e){return e?"open":"closed"}var cm="DialogTitleWarning",[d1,dm]=cx(cm,{contentName:Ar,titleName:el,docsSlug:"dialog"}),Ty=({titleId:e})=>{const t=dm(cm),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
76
+
77
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
78
+
79
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return x.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Ry="DialogDescriptionWarning",Dy=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${dm(Ry).contentName}}.`;return x.useEffect(()=>{var o;const n=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&n&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Py=Zu,Oy=em,um=tm,mm=rm,pm=om,fm=sm,Iy=im;const Fy=Py,Ly=Oy,hm=x.forwardRef(({className:e,...t},r)=>a.jsx(um,{ref:r,className:J("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));hm.displayName=um.displayName;const xm=x.forwardRef(({className:e,children:t,...r},o)=>a.jsxs(Ly,{children:[a.jsx(hm,{}),a.jsxs(mm,{ref:o,className:J("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...r,children:[t,a.jsxs(Iy,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[a.jsx(O.X,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));xm.displayName=mm.displayName;const gm=({className:e,...t})=>a.jsx("div",{className:J("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});gm.displayName="DialogHeader";const vm=x.forwardRef(({className:e,...t},r)=>a.jsx(pm,{ref:r,className:J("text-lg font-semibold leading-none tracking-tight",e),...t}));vm.displayName=pm.displayName;const bm=x.forwardRef(({className:e,...t},r)=>a.jsx(fm,{ref:r,className:J("text-sm text-muted-foreground",e),...t}));bm.displayName=fm.displayName;var Bo="Popover",[ym]=jt(Bo,[ra]),Sa=ra(),[My,xr]=ym(Bo),wm=e=>{const{__scopePopover:t,children:r,open:o,defaultOpen:n,onOpenChange:s,modal:l=!1}=e,i=Sa(t),c=x.useRef(null),[d,m]=x.useState(!1),[u,h]=Ut({prop:o,defaultProp:n??!1,onChange:s,caller:Bo});return a.jsx(Hs,{...i,children:a.jsx(My,{scope:t,contentId:Zt(),triggerRef:c,open:u,onOpenChange:h,onOpenToggle:x.useCallback(()=>h(p=>!p),[h]),hasCustomAnchor:d,onCustomAnchorAdd:x.useCallback(()=>m(!0),[]),onCustomAnchorRemove:x.useCallback(()=>m(!1),[]),modal:l,children:r})})};wm.displayName=Bo;var jm="PopoverAnchor",Vy=x.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=xr(jm,r),s=Sa(r),{onCustomAnchorAdd:l,onCustomAnchorRemove:i}=n;return x.useEffect(()=>(l(),()=>i()),[l,i]),a.jsx(Ro,{...s,...o,ref:t})});Vy.displayName=jm;var Nm="PopoverTrigger",Cm=x.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=xr(Nm,r),s=Sa(r),l=je(t,n.triggerRef),i=a.jsx(be.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":Am(n.open),...o,ref:l,onClick:xe(e.onClick,n.onOpenToggle)});return n.hasCustomAnchor?i:a.jsx(Ro,{asChild:!0,...s,children:i})});Cm.displayName=Nm;var rl="PopoverPortal",[zy,By]=ym(rl,{forceMount:void 0}),km=e=>{const{__scopePopover:t,forceMount:r,children:o,container:n}=e,s=xr(rl,t);return a.jsx(zy,{scope:t,forceMount:r,children:a.jsx(Nt,{present:r||s.open,children:a.jsx(Do,{asChild:!0,container:n,children:o})})})};km.displayName=rl;var Yr="PopoverContent",Sm=x.forwardRef((e,t)=>{const r=By(Yr,e.__scopePopover),{forceMount:o=r.forceMount,...n}=e,s=xr(Yr,e.__scopePopover);return a.jsx(Nt,{present:o||s.open,children:s.modal?a.jsx(Hy,{...n,ref:t}):a.jsx(Wy,{...n,ref:t})})});Sm.displayName=Yr;var Uy=Gr("PopoverContent.RemoveScroll"),Hy=x.forwardRef((e,t)=>{const r=xr(Yr,e.__scopePopover),o=x.useRef(null),n=je(t,o),s=x.useRef(!1);return x.useEffect(()=>{const l=o.current;if(l)return Xs(l)},[]),a.jsx(Oo,{as:Uy,allowPinchZoom:!0,children:a.jsx($m,{...e,ref:n,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:xe(e.onCloseAutoFocus,l=>{var i;l.preventDefault(),s.current||(i=r.triggerRef.current)==null||i.focus()}),onPointerDownOutside:xe(e.onPointerDownOutside,l=>{const i=l.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0,d=i.button===2||c;s.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:xe(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),Wy=x.forwardRef((e,t)=>{const r=xr(Yr,e.__scopePopover),o=x.useRef(!1),n=x.useRef(!1);return a.jsx($m,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{var l,i;(l=e.onCloseAutoFocus)==null||l.call(e,s),s.defaultPrevented||(o.current||(i=r.triggerRef.current)==null||i.focus(),s.preventDefault()),o.current=!1,n.current=!1},onInteractOutside:s=>{var l,i;(l=e.onInteractOutside)==null||l.call(e,s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const c=s.target;(i=r.triggerRef.current)!=null&&i.contains(c)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&n.current&&s.preventDefault()}})}),$m=x.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:o,onOpenAutoFocus:n,onCloseAutoFocus:s,disableOutsidePointerEvents:l,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:m,...u}=e,h=xr(Yr,r),p=Sa(r);return Os(),a.jsx($o,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:n,onUnmountAutoFocus:s,children:a.jsx(Ca,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:m,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>h.onOpenChange(!1),children:a.jsx(Ws,{"data-state":Am(h.open),role:"dialog",id:h.contentId,...p,...u,ref:t,style:{...u.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),Em="PopoverClose",qy=x.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=xr(Em,r);return a.jsx(be.button,{type:"button",...o,ref:t,onClick:xe(e.onClick,()=>n.onOpenChange(!1))})});qy.displayName=Em;var Xy="PopoverArrow",Gy=x.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=Sa(r);return a.jsx(qs,{...n,...o,ref:t})});Gy.displayName=Xy;function Am(e){return e?"open":"closed"}var Ky=wm,Yy=Cm,Zy=km,_m=Sm;const Uo=Ky,Ho=Yy,$a=x.forwardRef(({className:e,align:t="center",sideOffset:r=4,...o},n)=>a.jsx(Zy,{children:a.jsx(_m,{ref:n,align:t,sideOffset:r,className:J("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...o})}));$a.displayName=_m.displayName;var[Wo]=jt("Tooltip",[ra]),qo=ra(),Tm="TooltipProvider",Jy=700,ns="tooltip.open",[Qy,al]=Wo(Tm),Rm=e=>{const{__scopeTooltip:t,delayDuration:r=Jy,skipDelayDuration:o=300,disableHoverableContent:n=!1,children:s}=e,l=x.useRef(!0),i=x.useRef(!1),c=x.useRef(0);return x.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),a.jsx(Qy,{scope:t,isOpenDelayedRef:l,delayDuration:r,onOpen:x.useCallback(()=>{window.clearTimeout(c.current),l.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>l.current=!0,o)},[o]),isPointerInTransitRef:i,onPointerInTransitChange:x.useCallback(d=>{i.current=d},[]),disableHoverableContent:n,children:s})};Rm.displayName=Tm;var xa="Tooltip",[e0,Xo]=Wo(xa),Dm=e=>{const{__scopeTooltip:t,children:r,open:o,defaultOpen:n,onOpenChange:s,disableHoverableContent:l,delayDuration:i}=e,c=al(xa,e.__scopeTooltip),d=qo(t),[m,u]=x.useState(null),h=Zt(),p=x.useRef(0),y=l??c.disableHoverableContent,f=i??c.delayDuration,g=x.useRef(!1),[w,v]=Ut({prop:o,defaultProp:n??!1,onChange:$=>{$?(c.onOpen(),document.dispatchEvent(new CustomEvent(ns))):c.onClose(),s==null||s($)},caller:xa}),b=x.useMemo(()=>w?g.current?"delayed-open":"instant-open":"closed",[w]),j=x.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),N=x.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=x.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},f)},[f,v]);return x.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),a.jsx(Hs,{...d,children:a.jsx(e0,{scope:t,contentId:h,open:w,stateAttribute:b,trigger:m,onTriggerChange:u,onTriggerEnter:x.useCallback(()=>{c.isOpenDelayedRef.current?S():j()},[c.isOpenDelayedRef,S,j]),onTriggerLeave:x.useCallback(()=>{y?N():(window.clearTimeout(p.current),p.current=0)},[N,y]),onOpen:j,onClose:N,disableHoverableContent:y,children:r})})};Dm.displayName=xa;var ss="TooltipTrigger",Pm=x.forwardRef((e,t)=>{const{__scopeTooltip:r,...o}=e,n=Xo(ss,r),s=al(ss,r),l=qo(r),i=x.useRef(null),c=je(t,i,n.onTriggerChange),d=x.useRef(!1),m=x.useRef(!1),u=x.useCallback(()=>d.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",u),[u]),a.jsx(Ro,{asChild:!0,...l,children:a.jsx(be.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...o,ref:c,onPointerMove:xe(e.onPointerMove,h=>{h.pointerType!=="touch"&&!m.current&&!s.isPointerInTransitRef.current&&(n.onTriggerEnter(),m.current=!0)}),onPointerLeave:xe(e.onPointerLeave,()=>{n.onTriggerLeave(),m.current=!1}),onPointerDown:xe(e.onPointerDown,()=>{n.open&&n.onClose(),d.current=!0,document.addEventListener("pointerup",u,{once:!0})}),onFocus:xe(e.onFocus,()=>{d.current||n.onOpen()}),onBlur:xe(e.onBlur,n.onClose),onClick:xe(e.onClick,n.onClose)})})});Pm.displayName=ss;var t0="TooltipPortal",[u1,r0]=Wo(t0,{forceMount:void 0}),Zr="TooltipContent",Om=x.forwardRef((e,t)=>{const r=r0(Zr,e.__scopeTooltip),{forceMount:o=r.forceMount,side:n="top",...s}=e,l=Xo(Zr,e.__scopeTooltip);return a.jsx(Nt,{present:o||l.open,children:l.disableHoverableContent?a.jsx(Im,{side:n,...s,ref:t}):a.jsx(a0,{side:n,...s,ref:t})})}),a0=x.forwardRef((e,t)=>{const r=Xo(Zr,e.__scopeTooltip),o=al(Zr,e.__scopeTooltip),n=x.useRef(null),s=je(t,n),[l,i]=x.useState(null),{trigger:c,onClose:d}=r,m=n.current,{onPointerInTransitChange:u}=o,h=x.useCallback(()=>{i(null),u(!1)},[u]),p=x.useCallback((y,f)=>{const g=y.currentTarget,w={x:y.clientX,y:y.clientY},v=i0(w,g.getBoundingClientRect()),b=c0(w,v),j=d0(f.getBoundingClientRect()),N=m0([...b,...j]);i(N),u(!0)},[u]);return x.useEffect(()=>()=>h(),[h]),x.useEffect(()=>{if(c&&m){const y=g=>p(g,m),f=g=>p(g,c);return c.addEventListener("pointerleave",y),m.addEventListener("pointerleave",f),()=>{c.removeEventListener("pointerleave",y),m.removeEventListener("pointerleave",f)}}},[c,m,p,h]),x.useEffect(()=>{if(l){const y=f=>{const g=f.target,w={x:f.clientX,y:f.clientY},v=(c==null?void 0:c.contains(g))||(m==null?void 0:m.contains(g)),b=!u0(w,l);v?h():b&&(h(),d())};return document.addEventListener("pointermove",y),()=>document.removeEventListener("pointermove",y)}},[c,m,l,d,h]),a.jsx(Im,{...e,ref:s})}),[o0,n0]=Wo(xa,{isInside:!1}),s0=vx("TooltipContent"),Im=x.forwardRef((e,t)=>{const{__scopeTooltip:r,children:o,"aria-label":n,onEscapeKeyDown:s,onPointerDownOutside:l,...i}=e,c=Xo(Zr,r),d=qo(r),{onClose:m}=c;return x.useEffect(()=>(document.addEventListener(ns,m),()=>document.removeEventListener(ns,m)),[m]),x.useEffect(()=>{if(c.trigger){const u=h=>{const p=h.target;p!=null&&p.contains(c.trigger)&&m()};return window.addEventListener("scroll",u,{capture:!0}),()=>window.removeEventListener("scroll",u,{capture:!0})}},[c.trigger,m]),a.jsx(Ca,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:u=>u.preventDefault(),onDismiss:m,children:a.jsxs(Ws,{"data-state":c.stateAttribute,...d,...i,ref:t,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(s0,{children:o}),a.jsx(o0,{scope:r,isInside:!0,children:a.jsx(Dv,{id:c.contentId,role:"tooltip",children:n||o})})]})})});Om.displayName=Zr;var Fm="TooltipArrow",l0=x.forwardRef((e,t)=>{const{__scopeTooltip:r,...o}=e,n=qo(r);return n0(Fm,r).isInside?null:a.jsx(qs,{...n,...o,ref:t})});l0.displayName=Fm;function i0(e,t){const r=Math.abs(t.top-e.y),o=Math.abs(t.bottom-e.y),n=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(r,o,n,s)){case s:return"left";case n:return"right";case r:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function c0(e,t,r=5){const o=[];switch(t){case"top":o.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":o.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":o.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":o.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return o}function d0(e){const{top:t,right:r,bottom:o,left:n}=e;return[{x:n,y:t},{x:r,y:t},{x:r,y:o},{x:n,y:o}]}function u0(e,t){const{x:r,y:o}=e;let n=!1;for(let s=0,l=t.length-1;s<t.length;l=s++){const i=t[s],c=t[l],d=i.x,m=i.y,u=c.x,h=c.y;m>o!=h>o&&r<(u-d)*(o-m)/(h-m)+d&&(n=!n)}return n}function m0(e){const t=e.slice();return t.sort((r,o)=>r.x<o.x?-1:r.x>o.x?1:r.y<o.y?-1:r.y>o.y?1:0),p0(t)}function p0(e){if(e.length<=1)return e.slice();const t=[];for(let o=0;o<e.length;o++){const n=e[o];for(;t.length>=2;){const s=t[t.length-1],l=t[t.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))t.pop();else break}t.push(n)}t.pop();const r=[];for(let o=e.length-1;o>=0;o--){const n=e[o];for(;r.length>=2;){const s=r[r.length-1],l=r[r.length-2];if((s.x-l.x)*(n.y-l.y)>=(s.y-l.y)*(n.x-l.x))r.pop();else break}r.push(n)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var f0=Rm,h0=Dm,x0=Pm,Lm=Om;const g0=f0,Mm=h0,Vm=x0,ol=x.forwardRef(({className:e,sideOffset:t=4,...r},o)=>a.jsx(Lm,{ref:o,sideOffset:t,className:J("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...r}));ol.displayName=Lm.displayName;function v0(e,t){return x.useReducer((r,o)=>t[r][o]??r,e)}var nl="ScrollArea",[zm]=jt(nl),[b0,_t]=zm(nl),Bm=x.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:o="hover",dir:n,scrollHideDelay:s=600,...l}=e,[i,c]=x.useState(null),[d,m]=x.useState(null),[u,h]=x.useState(null),[p,y]=x.useState(null),[f,g]=x.useState(null),[w,v]=x.useState(0),[b,j]=x.useState(0),[N,S]=x.useState(!1),[$,C]=x.useState(!1),E=je(t,I=>c(I)),A=ja(n);return a.jsx(b0,{scope:r,type:o,dir:A,scrollHideDelay:s,scrollArea:i,viewport:d,onViewportChange:m,content:u,onContentChange:h,scrollbarX:p,onScrollbarXChange:y,scrollbarXEnabled:N,onScrollbarXEnabledChange:S,scrollbarY:f,onScrollbarYChange:g,scrollbarYEnabled:$,onScrollbarYEnabledChange:C,onCornerWidthChange:v,onCornerHeightChange:j,children:a.jsx(be.div,{dir:A,...l,ref:E,style:{position:"relative","--radix-scroll-area-corner-width":w+"px","--radix-scroll-area-corner-height":b+"px",...e.style}})})});Bm.displayName=nl;var Um="ScrollAreaViewport",Hm=x.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:o,nonce:n,...s}=e,l=_t(Um,r),i=x.useRef(null),c=je(t,i,l.onViewportChange);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:n}),a.jsx(be.div,{"data-radix-scroll-area-viewport":"",...s,ref:c,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:a.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});Hm.displayName=Um;var Wt="ScrollAreaScrollbar",sl=x.forwardRef((e,t)=>{const{forceMount:r,...o}=e,n=_t(Wt,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:l}=n,i=e.orientation==="horizontal";return x.useEffect(()=>(i?s(!0):l(!0),()=>{i?s(!1):l(!1)}),[i,s,l]),n.type==="hover"?a.jsx(y0,{...o,ref:t,forceMount:r}):n.type==="scroll"?a.jsx(w0,{...o,ref:t,forceMount:r}):n.type==="auto"?a.jsx(Wm,{...o,ref:t,forceMount:r}):n.type==="always"?a.jsx(ll,{...o,ref:t}):null});sl.displayName=Wt;var y0=x.forwardRef((e,t)=>{const{forceMount:r,...o}=e,n=_t(Wt,e.__scopeScrollArea),[s,l]=x.useState(!1);return x.useEffect(()=>{const i=n.scrollArea;let c=0;if(i){const d=()=>{window.clearTimeout(c),l(!0)},m=()=>{c=window.setTimeout(()=>l(!1),n.scrollHideDelay)};return i.addEventListener("pointerenter",d),i.addEventListener("pointerleave",m),()=>{window.clearTimeout(c),i.removeEventListener("pointerenter",d),i.removeEventListener("pointerleave",m)}}},[n.scrollArea,n.scrollHideDelay]),a.jsx(Nt,{present:r||s,children:a.jsx(Wm,{"data-state":s?"visible":"hidden",...o,ref:t})})}),w0=x.forwardRef((e,t)=>{const{forceMount:r,...o}=e,n=_t(Wt,e.__scopeScrollArea),s=e.orientation==="horizontal",l=Ko(()=>c("SCROLL_END"),100),[i,c]=v0("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return x.useEffect(()=>{if(i==="idle"){const d=window.setTimeout(()=>c("HIDE"),n.scrollHideDelay);return()=>window.clearTimeout(d)}},[i,n.scrollHideDelay,c]),x.useEffect(()=>{const d=n.viewport,m=s?"scrollLeft":"scrollTop";if(d){let u=d[m];const h=()=>{const p=d[m];u!==p&&(c("SCROLL"),l()),u=p};return d.addEventListener("scroll",h),()=>d.removeEventListener("scroll",h)}},[n.viewport,s,c,l]),a.jsx(Nt,{present:r||i!=="hidden",children:a.jsx(ll,{"data-state":i==="hidden"?"hidden":"visible",...o,ref:t,onPointerEnter:xe(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:xe(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Wm=x.forwardRef((e,t)=>{const r=_t(Wt,e.__scopeScrollArea),{forceMount:o,...n}=e,[s,l]=x.useState(!1),i=e.orientation==="horizontal",c=Ko(()=>{if(r.viewport){const d=r.viewport.offsetWidth<r.viewport.scrollWidth,m=r.viewport.offsetHeight<r.viewport.scrollHeight;l(i?d:m)}},10);return Jr(r.viewport,c),Jr(r.content,c),a.jsx(Nt,{present:o||s,children:a.jsx(ll,{"data-state":s?"visible":"hidden",...n,ref:t})})}),ll=x.forwardRef((e,t)=>{const{orientation:r="vertical",...o}=e,n=_t(Wt,e.__scopeScrollArea),s=x.useRef(null),l=x.useRef(0),[i,c]=x.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=Ym(i.viewport,i.content),m={...o,sizes:i,onSizesChange:c,hasThumb:d>0&&d<1,onThumbChange:h=>s.current=h,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:h=>l.current=h};function u(h,p){return $0(h,l.current,i,p)}return r==="horizontal"?a.jsx(j0,{...m,ref:t,onThumbPositionChange:()=>{if(n.viewport&&s.current){const h=n.viewport.scrollLeft,p=wi(h,i,n.dir);s.current.style.transform=`translate3d(${p}px, 0, 0)`}},onWheelScroll:h=>{n.viewport&&(n.viewport.scrollLeft=h)},onDragScroll:h=>{n.viewport&&(n.viewport.scrollLeft=u(h,n.dir))}}):r==="vertical"?a.jsx(N0,{...m,ref:t,onThumbPositionChange:()=>{if(n.viewport&&s.current){const h=n.viewport.scrollTop,p=wi(h,i);s.current.style.transform=`translate3d(0, ${p}px, 0)`}},onWheelScroll:h=>{n.viewport&&(n.viewport.scrollTop=h)},onDragScroll:h=>{n.viewport&&(n.viewport.scrollTop=u(h))}}):null}),j0=x.forwardRef((e,t)=>{const{sizes:r,onSizesChange:o,...n}=e,s=_t(Wt,e.__scopeScrollArea),[l,i]=x.useState(),c=x.useRef(null),d=je(t,c,s.onScrollbarXChange);return x.useEffect(()=>{c.current&&i(getComputedStyle(c.current))},[c]),a.jsx(Xm,{"data-orientation":"horizontal",...n,ref:d,sizes:r,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Go(r)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.x),onDragScroll:m=>e.onDragScroll(m.x),onWheelScroll:(m,u)=>{if(s.viewport){const h=s.viewport.scrollLeft+m.deltaX;e.onWheelScroll(h),Jm(h,u)&&m.preventDefault()}},onResize:()=>{c.current&&s.viewport&&l&&o({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:io(l.paddingLeft),paddingEnd:io(l.paddingRight)}})}})}),N0=x.forwardRef((e,t)=>{const{sizes:r,onSizesChange:o,...n}=e,s=_t(Wt,e.__scopeScrollArea),[l,i]=x.useState(),c=x.useRef(null),d=je(t,c,s.onScrollbarYChange);return x.useEffect(()=>{c.current&&i(getComputedStyle(c.current))},[c]),a.jsx(Xm,{"data-orientation":"vertical",...n,ref:d,sizes:r,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Go(r)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.y),onDragScroll:m=>e.onDragScroll(m.y),onWheelScroll:(m,u)=>{if(s.viewport){const h=s.viewport.scrollTop+m.deltaY;e.onWheelScroll(h),Jm(h,u)&&m.preventDefault()}},onResize:()=>{c.current&&s.viewport&&l&&o({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:io(l.paddingTop),paddingEnd:io(l.paddingBottom)}})}})}),[C0,qm]=zm(Wt),Xm=x.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:o,hasThumb:n,onThumbChange:s,onThumbPointerUp:l,onThumbPointerDown:i,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:m,onResize:u,...h}=e,p=_t(Wt,r),[y,f]=x.useState(null),g=je(t,E=>f(E)),w=x.useRef(null),v=x.useRef(""),b=p.viewport,j=o.content-o.viewport,N=ot(m),S=ot(c),$=Ko(u,10);function C(E){if(w.current){const A=E.clientX-w.current.left,I=E.clientY-w.current.top;d({x:A,y:I})}}return x.useEffect(()=>{const E=A=>{const I=A.target;y!=null&&y.contains(I)&&N(A,j)};return document.addEventListener("wheel",E,{passive:!1}),()=>document.removeEventListener("wheel",E,{passive:!1})},[b,y,j,N]),x.useEffect(S,[o,S]),Jr(y,$),Jr(p.content,$),a.jsx(C0,{scope:r,scrollbar:y,hasThumb:n,onThumbChange:ot(s),onThumbPointerUp:ot(l),onThumbPositionChange:S,onThumbPointerDown:ot(i),children:a.jsx(be.div,{...h,ref:g,style:{position:"absolute",...h.style},onPointerDown:xe(e.onPointerDown,E=>{E.button===0&&(E.target.setPointerCapture(E.pointerId),w.current=y.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),C(E))}),onPointerMove:xe(e.onPointerMove,C),onPointerUp:xe(e.onPointerUp,E=>{const A=E.target;A.hasPointerCapture(E.pointerId)&&A.releasePointerCapture(E.pointerId),document.body.style.webkitUserSelect=v.current,p.viewport&&(p.viewport.style.scrollBehavior=""),w.current=null})})})}),lo="ScrollAreaThumb",Gm=x.forwardRef((e,t)=>{const{forceMount:r,...o}=e,n=qm(lo,e.__scopeScrollArea);return a.jsx(Nt,{present:r||n.hasThumb,children:a.jsx(k0,{ref:t,...o})})}),k0=x.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:o,...n}=e,s=_t(lo,r),l=qm(lo,r),{onThumbPositionChange:i}=l,c=je(t,u=>l.onThumbChange(u)),d=x.useRef(void 0),m=Ko(()=>{d.current&&(d.current(),d.current=void 0)},100);return x.useEffect(()=>{const u=s.viewport;if(u){const h=()=>{if(m(),!d.current){const p=E0(u,i);d.current=p,i()}};return i(),u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[s.viewport,m,i]),a.jsx(be.div,{"data-state":l.hasThumb?"visible":"hidden",...n,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:xe(e.onPointerDownCapture,u=>{const h=u.target.getBoundingClientRect(),p=u.clientX-h.left,y=u.clientY-h.top;l.onThumbPointerDown({x:p,y})}),onPointerUp:xe(e.onPointerUp,l.onThumbPointerUp)})});Gm.displayName=lo;var il="ScrollAreaCorner",Km=x.forwardRef((e,t)=>{const r=_t(il,e.__scopeScrollArea),o=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&o?a.jsx(S0,{...e,ref:t}):null});Km.displayName=il;var S0=x.forwardRef((e,t)=>{const{__scopeScrollArea:r,...o}=e,n=_t(il,r),[s,l]=x.useState(0),[i,c]=x.useState(0),d=!!(s&&i);return Jr(n.scrollbarX,()=>{var m;const u=((m=n.scrollbarX)==null?void 0:m.offsetHeight)||0;n.onCornerHeightChange(u),c(u)}),Jr(n.scrollbarY,()=>{var m;const u=((m=n.scrollbarY)==null?void 0:m.offsetWidth)||0;n.onCornerWidthChange(u),l(u)}),d?a.jsx(be.div,{...o,ref:t,style:{width:s,height:i,position:"absolute",right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function io(e){return e?parseInt(e,10):0}function Ym(e,t){const r=e/t;return isNaN(r)?0:r}function Go(e){const t=Ym(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=(e.scrollbar.size-r)*t;return Math.max(o,18)}function $0(e,t,r,o="ltr"){const n=Go(r),s=n/2,l=t||s,i=n-l,c=r.scrollbar.paddingStart+l,d=r.scrollbar.size-r.scrollbar.paddingEnd-i,m=r.content-r.viewport,u=o==="ltr"?[0,m]:[m*-1,0];return Zm([c,d],u)(e)}function wi(e,t,r="ltr"){const o=Go(t),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-n,l=t.content-t.viewport,i=s-o,c=r==="ltr"?[0,l]:[l*-1,0],d=fa(e,c);return Zm([0,l],[0,i])(d)}function Zm(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const o=(t[1]-t[0])/(e[1]-e[0]);return t[0]+o*(r-e[0])}}function Jm(e,t){return e>0&&e<t}var E0=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},o=0;return function n(){const s={left:e.scrollLeft,top:e.scrollTop},l=r.left!==s.left,i=r.top!==s.top;(l||i)&&t(),r=s,o=window.requestAnimationFrame(n)}(),()=>window.cancelAnimationFrame(o)};function Ko(e,t){const r=ot(e),o=x.useRef(0);return x.useEffect(()=>()=>window.clearTimeout(o.current),[]),x.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(r,t)},[r,t])}function Jr(e,t){const r=ot(t);et(()=>{let o=0;if(e){const n=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(r)});return n.observe(e),()=>{window.cancelAnimationFrame(o),n.unobserve(e)}}},[e,r])}var Qm=Bm,A0=Hm,_0=Km;const Yo=x.forwardRef(({className:e,children:t,...r},o)=>a.jsxs(Qm,{ref:o,className:J("relative overflow-hidden",e),...r,children:[a.jsx(A0,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(ep,{}),a.jsx(_0,{})]}));Yo.displayName=Qm.displayName;const ep=x.forwardRef(({className:e,orientation:t="vertical",...r},o)=>a.jsx(sl,{ref:o,orientation:t,className:J("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:a.jsx(Gm,{className:"relative flex-1 rounded-full bg-border"})}));ep.displayName=sl.displayName;const ji=Object.entries(O.icons).map(([e,t])=>({name:e,kebab:e.replace(/([A-Z])/g,(r,o,n)=>n===0?o.toLowerCase():`-${o.toLowerCase()}`),component:t})),tp=({value:e,onChange:t,label:r="Ícone (Lucide)",hideLabel:o=!1,className:n})=>{const[s,l]=k.useState(!1),[i,c]=k.useState(""),d=k.useMemo(()=>qh(e),[e]),m=k.useMemo(()=>{const p=i.toLowerCase();return p?ji.filter(y=>y.name.toLowerCase().includes(p)||y.kebab.includes(p)):ji},[i]),u=p=>{t(p),l(!1)},h=p=>{l(p),p||c("")};return a.jsxs("div",{className:`space-y-1 ${n??""}`,children:[!o&&a.jsx(le,{className:"text-xs",children:r}),a.jsx($e,{type:"button",variant:"outline",className:"w-full h-8 justify-start text-xs font-normal gap-2",onClick:()=>l(!0),children:d?a.jsxs(a.Fragment,{children:[k.createElement(d,{className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{className:"truncate",children:e})]}):a.jsx("span",{className:"text-muted-foreground",children:"Selecionar ícone…"})}),a.jsx(Fy,{open:s,onOpenChange:h,children:a.jsxs(xm,{className:"max-w-3xl max-h-[85vh] flex flex-col gap-0 p-0",children:[a.jsxs(gm,{className:"px-4 pt-4 pb-2 border-b",children:[a.jsx(vm,{children:"Selecionar ícone"}),a.jsx(bm,{children:"Pesquise e clique em um ícone da biblioteca Lucide."})]}),a.jsx("div",{className:"px-4 py-2 border-b",children:a.jsxs("div",{className:"relative",children:[a.jsx(O.Search,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(de,{autoFocus:!0,placeholder:"Buscar ícones…",value:i,onChange:p=>c(p.target.value),className:"pl-8 h-9 text-sm"})]})}),a.jsx(Yo,{className:"flex-1 px-4 py-2",children:a.jsxs("div",{className:"grid grid-cols-5 gap-2 sm:grid-cols-7 md:grid-cols-8 pb-2",children:[a.jsxs($e,{type:"button",variant:e?"outline":"secondary",className:"flex flex-col items-center justify-center h-20 gap-1 p-1",onClick:()=>u(void 0),children:[a.jsx("div",{className:"h-6 w-6 rounded border-2 border-dashed border-muted-foreground/30"}),a.jsx("span",{className:"text-[10px] leading-tight text-center",children:"Nenhum"})]}),m.map(({name:p,component:y})=>a.jsxs($e,{type:"button",variant:e===p?"secondary":"outline",className:"flex flex-col items-center justify-center h-20 gap-1 p-1 overflow-hidden",onClick:()=>u(p),children:[k.createElement(y,{size:24}),a.jsx("span",{className:"text-[9px] leading-tight text-center break-all line-clamp-2",children:p})]},p))]})})]})})]})},co=k.createContext({}),tr=()=>k.useContext(co),Ke=(e,t,r={})=>{if(!e)return!0;if("and"in e||"or"in e){const d="and"in e&&Array.isArray(e.and)&&e.and.length>0,m="or"in e&&Array.isArray(e.or)&&e.or.length>0;return d&&m?(console.warn("[evaluateFieldCondition] FieldConditionGroup com `and` e `or` simultâneos — apenas `and` será avaliado."),e.and.every(u=>Ke(u,t,r))):d?e.and.every(u=>Ke(u,t,r)):m?e.or.some(u=>Ke(u,t,r)):!0}const o=e;if(!o.campoId)return!0;const n=o.source==="evento"?r[o.campoId]:t[o.campoId];if(Array.isArray(n)){const d=o.valor;switch(o.operador){case"contem":return n.includes(d);case"naoContem":return!n.includes(d);case"vazio":return n.length===0;case"naoVazio":return n.length>0;case"igual":return n.length===1&&n[0]===d;case"diferente":return!(n.length===1&&n[0]===d);default:return!0}}const s=n==null||n===!1?"":n===!0?"1":String(n),l=o.valor!==void 0?String(o.valor):"",i=Number(s),c=Number(l);switch(o.operador){case"igual":return s===l;case"diferente":return s!==l;case"vazio":return!s;case"naoVazio":return!!s;case"contem":return s.includes(l);case"naoContem":return!s.includes(l);case"maiorQue":return!isNaN(i)&&!isNaN(c)?i>c:s>l;case"menorQue":return!isNaN(i)&&!isNaN(c)?i<c:s<l;case"maiorOuIgual":return!isNaN(i)&&!isNaN(c)?i>=c:s>=l;case"menorOuIgual":return!isNaN(i)&&!isNaN(c)?i<=c:s<=l;default:return!0}},T0=/^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/,R0=/^\(?\d{2}\)?\s?\d{4,5}-?\d{4}$/,D0=/^\d{5}-?\d{3}$/,P0=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,O0=e=>{const t=e.replace(/\D/g,"");if(t.length!==11||/^(\d)\1{10}$/.test(t))return!1;const r=o=>{let n=0;for(let l=0;l<o;l++)n+=parseInt(t[l])*(o+1-l);const s=n*10%11;return s>=10?0:s};return r(9)===parseInt(t[9])&&r(10)===parseInt(t[10])},za=new Map,I0=e=>{if(za.has(e))return za.get(e);try{const t=e.startsWith("/")?e.replace(/\/g(?=[^\/]*$)/,"/"):e,r=new RegExp(t);return za.set(e,r),r}catch{return za.set(e,null),null}},Ba=(e,t,r={})=>{const o=e.validacao;if(e.tipo===_.CHECKBOX||e.tipo===_.SWITCH)return e.obrigatorio&&!t?"Campo obrigatório":void 0;if(e.tipo===_.SLIDER){const s=t!=null&&t!==""?Number(t):NaN;return e.obrigatorio&&isNaN(s)?"Campo obrigatório":isNaN(s)?void 0:(o==null?void 0:o.min)!==void 0&&s<o.min?`Valor mínimo: ${o.min}`:(o==null?void 0:o.max)!==void 0&&s>o.max?`Valor máximo: ${o.max}`:void 0}if(e.tipo===_.RATING){const s=t!==void 0?Number(t):0;return e.obrigatorio&&(!s||s<1)?"Avaliação obrigatória":void 0}if(e.tipo===_.DATE_RANGE){const s=t;if(e.obrigatorio){if(!(s!=null&&s.start))return"Data inicial obrigatória";if(!(s!=null&&s.end))return"Data final obrigatória"}return s!=null&&s.start&&s!=null&&s.end&&s.start>s.end?"A data inicial deve ser menor ou igual à data final":void 0}if(e.tipo===_.PARTICIPATION_TYPE){if(!e.obrigatorio)return;const s=t;return s!=null&&s.tipo?s.tipo==="por_dia"&&!s.data?"Selecione um dia para participar":"genero"in(s??{})&&!(s!=null&&s.genero)?"Selecione o sexo":void 0:"Selecione o tipo de participação"}if(e.tipo===_.CHECKBOX_GROUP){const s=Array.isArray(t)?t:[];return e.obrigatorio&&s.length===0?"Selecione pelo menos uma opção":void 0}if(e.tipo===_.FILE)return e.obrigatorio&&!t?"Arquivo obrigatório":void 0;if(e.tipo===_.TERMS)return e.obrigatorio&&t!=="accepted"?"Você precisa aceitar os termos para continuar":void 0;if(e.tipo===_.NUMBER){const s=t!=null?String(t):"";if(e.obrigatorio&&!s)return"Campo obrigatório";if(!s)return;const l=Number(s);return isNaN(l)?"Deve ser um número":(o==null?void 0:o.min)!==void 0&&l<o.min?`Valor mínimo: ${o.min}`:(o==null?void 0:o.max)!==void 0&&l>o.max?`Valor máximo: ${o.max}`:void 0}const n=t!=null?String(t):"";if(e.obrigatorio&&!n.trim())return"Campo obrigatório";if(n){if(e.tipo===_.EMAIL&&!P0.test(n))return"E-mail inválido";if(e.tipo===_.CPF&&(!T0.test(n)||!O0(n)))return"CPF inválido";if(e.tipo===_.TELEFONE&&!R0.test(n))return"Telefone inválido";if(e.tipo===_.CEP&&!D0.test(n))return"CEP inválido";if(o!=null&&o.minLength&&n.length<o.minLength)return`Mínimo ${o.minLength} caracteres`;if(o!=null&&o.maxLength&&n.length>o.maxLength)return`Máximo ${o.maxLength} caracteres`;if((e.tipo===_.DATE||e.tipo===_.DATETIME)&&n){if(o!=null&&o.minDate&&n<o.minDate)return`Data mínima: ${o.minDate}`;if(o!=null&&o.maxDate&&n>o.maxDate)return`Data máxima: ${o.maxDate}`}if((e.tipo===_.DATE||e.tipo===_.DATETIME)&&n&&((o==null?void 0:o.minAge)!=null||(o==null?void 0:o.maxAge)!=null)){const s=n.split("T")[0],l=new Date(s+"T00:00:00"),i=r["evento.dataInicioEvento"],c=i?new Date(i.split("T")[0]+"T00:00:00"):new Date;let d=c.getFullYear()-l.getFullYear();const m=c.getMonth()-l.getMonth();if((m<0||m===0&&c.getDate()<l.getDate())&&d--,o.minAge!=null&&d<o.minAge)return`Idade mínima: ${o.minAge} ano${o.minAge!==1?"s":""}`;if(o.maxAge!=null&&d>o.maxAge)return`Idade máxima: ${o.maxAge} ano${o.maxAge!==1?"s":""}`}if(o!=null&&o.regex){const s=I0(o.regex);if(s&&!s.test(n))return o.regexMessage||"Formato inválido"}}},Lr=(e,t,r)=>{const o=t.split(".");let n=e;for(let s=0;s<o.length-1;s++){const l=o[s];(n[l]==null||typeof n[l]!="object")&&(n[l]={}),n=n[l]}n[o[o.length-1]]=r},Br=async(e,t,r,o,n,s)=>{for(const l of e){const i=s[l.type];if(!i)continue;const c=await i(r,o,l,n);if(c)return l.message??c}},rp=(e,t={},r={})=>async o=>{var n,s,l,i,c;const d={},m=[...e.containers].sort((u,h)=>u.ordem-h.ordem);for(const u of m){if(u.repeatable||u.condicional&&!Ke(u.condicional,o,t))continue;const h=[...u.campos].sort((p,y)=>p.ordem-y.ordem);for(const p of h){if(!Ke(p.condicional,o,t)||p.tipo===_.HIDDEN||p.isDisabled||p.isReadOnly)continue;if(p.tipo===_.FIELD_ARRAY){const f=Array.isArray(o[p.nome])?o[p.nome]:[];p.obrigatorio&&f.length===0?d[p.nome]={type:"custom",message:"Adicione pelo menos um item"}:p.minItems&&f.length<p.minItems?d[p.nome]={type:"custom",message:`Mínimo de ${p.minItems} item${p.minItems!==1?"s":""}`}:p.maxItems&&f.length>p.maxItems&&(d[p.nome]={type:"custom",message:`Máximo de ${p.maxItems} item${p.maxItems!==1?"s":""}`});for(let g=0;g<f.length;g++){const w=f[g];for(const v of p.subFields??[]){if(v.isDisabled||v.isReadOnly||!Ke(v.condicional,w,t))continue;const b=Ba(v,w[v.nome],t);if(b){Lr(d,`${p.nome}.${g}.${v.nome}`,{type:"custom",message:b});continue}if((n=v.validate)!=null&&n.length){const j=await Br(v.validate,v.nome,w[v.nome],w,t,r);j&&Lr(d,`${p.nome}.${g}.${v.nome}`,{type:"custom",message:j})}}}continue}if(p.tipo===_.SUB_FORM){const f=o[p.nome]??{};p.obrigatorio&&Object.keys(f).length===0&&(d[p.nome]={type:"custom",message:"Campo obrigatório"});for(const g of((s=p.subSchema)==null?void 0:s.fields)??[]){if(g.isDisabled||g.isReadOnly)continue;const w=Ba(g,f[g.nome],t);if(w){Lr(d,`${p.nome}.${g.nome}`,{type:"custom",message:w});continue}if((l=g.validate)!=null&&l.length){const v=await Br(g.validate,g.nome,f[g.nome],f,t,r);v&&Lr(d,`${p.nome}.${g.nome}`,{type:"custom",message:v})}}continue}const y=Ba(p,o[p.nome],t);if(y&&(d[p.nome]={type:"custom",message:y}),!d[p.nome]&&(i=p.validate)!=null&&i.length){const f=await Br(p.validate,p.nome,o[p.nome],o,t,r);f&&(d[p.nome]={type:"custom",message:f})}}}for(const u of m){if(!u.repeatable||!u.nome||u.condicional&&!Ke(u.condicional,o,t))continue;const h=Array.isArray(o[u.nome])?o[u.nome]:[];u.minItems&&h.length<u.minItems?d[u.nome]={type:"custom",message:`Mínimo de ${u.minItems} ${u.itemLabel??"item"}${u.minItems!==1?"s":""}`}:u.maxItems&&h.length>u.maxItems&&(d[u.nome]={type:"custom",message:`Máximo de ${u.maxItems} ${u.itemLabel??"item"}${u.maxItems!==1?"s":""}`});for(let p=0;p<h.length;p++){const y=h[p];for(const f of u.campos){if(!Ke(f.condicional,y,t)||f.tipo===_.HIDDEN||f.isDisabled||f.isReadOnly)continue;const g=Ba(f,y[f.nome],t);if(g){Lr(d,`${u.nome}.${p}.${f.nome}`,{type:"custom",message:g});continue}if((c=f.validate)!=null&&c.length){const w=await Br(f.validate,f.nome,y[f.nome],y,t,r);w&&Lr(d,`${u.nome}.${p}.${f.nome}`,{type:"custom",message:w})}}}}return Object.keys(d).length>0?{values:{},errors:d}:{values:o,errors:{}}},ap=(e,t={},r={})=>async o=>{var n,s;const l={},i=[...e.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of i)if(!(c.condicional&&!Ke(c.condicional,o,t))){if(c.repeatable&&c.nome){const d=Array.isArray(o[c.nome])?o[c.nome]:[];for(let m=0;m<d.length;m++){const u=d[m];for(const h of[...c.campos].sort((p,y)=>p.ordem-y.ordem)){if(!((n=h.warn)!=null&&n.length)||!Ke(h.condicional,u,t))continue;const p=await Br(h.warn,h.nome,u[h.nome],u,t,r);p&&(l[`${c.nome}.${m}.${h.nome}`]=p)}}continue}for(const d of[...c.campos].sort((m,u)=>m.ordem-u.ordem)){if(!((s=d.warn)!=null&&s.length)||!Ke(d.condicional,o,t))continue;const m=await Br(d.warn,d.nome,o[d.nome],o,t,r);m&&(l[d.nome]=m)}}return l},F0=/\{\{\s*(?:event|evento)\.([a-zA-Z0-9_.]+)\s*\}\}/g,st=(e,t)=>e?e.replace(F0,(r,o)=>t[`evento.${o}`]??t[o]??r):e??"",L0=(e,t)=>({...e,label:st(e.label,t)}),op=(e,t)=>{var r;return{...e,label:st(e.label,t),placeholder:st(e.placeholder,t),hint:st(e.hint,t),defaultValue:typeof e.defaultValue=="string"?st(e.defaultValue,t):e.defaultValue,opcoes:(r=e.opcoes)==null?void 0:r.map(o=>L0(o,t))}},Zo=(e,t)=>({...e,titulo:st(e.titulo,t),descricao:st(e.descricao,t),campos:e.campos.map(r=>op(r,t))}),np=(e,t)=>({...e,titulo:st(e.titulo,t),descricao:st(e.descricao,t),containers:e.containers.map(r=>Zo(r,t))}),sp=()=>{const e=ba(),t=e.layout.containerStyle,r=e.layout.roundness??"rounded-xl",o=J("overflow-hidden",r,t==="card"?"border":"",t==="bordered"?"border":"",t==="glassmorphism"?"backdrop-blur-sm":""),n=t==="glassmorphism"?{background:"var(--t-surface)",borderColor:"var(--t-border)",borderWidth:"1px",borderStyle:"solid"}:{},s=J("border-b px-6 py-4",t==="flat"?"border-transparent":"");return{wrapperClass:o,wrapperStyle:n,headerClass:s,headerStyle:t==="glassmorphism"?{borderColor:"var(--t-border)"}:{},tmpl:e}},gt=({name:e,control:t,placeholder:r,type:o="text",disabled:n,readOnly:s})=>{var l;const{field:i,fieldState:c}=Se.useController({name:e,control:t}),d=!!c.error;return a.jsxs("div",{className:"space-y-1",children:[a.jsx(de,{...i,value:i.value??"",type:o,placeholder:r,disabled:n,readOnly:s,className:J(d&&"border-destructive focus-visible:ring-destructive")}),((l=c.error)==null?void 0:l.message)&&a.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Jo=({name:e,control:t,placeholder:r,disabled:o,readOnly:n})=>{var s;const{field:l,fieldState:i}=Se.useController({name:e,control:t});return a.jsxs("div",{className:"space-y-1",children:[a.jsx(jo,{...l,value:l.value??"",placeholder:r,disabled:o,readOnly:n,rows:3,className:J(i.error&&"border-destructive focus-visible:ring-destructive")}),((s=i.error)==null?void 0:s.message)&&a.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},Qo=({name:e,control:t,placeholder:r,options:o,disabled:n,readOnly:s})=>{var l;const{field:i,fieldState:c}=Se.useController({name:e,control:t});return a.jsxs("div",{className:"space-y-1",children:[a.jsxs($t,{value:i.value??"",onValueChange:d=>!s&&i.onChange(d),disabled:n||s,children:[a.jsx(bt,{className:J(c.error&&"border-destructive focus:ring-destructive"),onBlur:i.onBlur,children:a.jsx(Et,{placeholder:r??"Selecione..."})}),a.jsx(yt,{children:o.map(d=>a.jsx(ze,{value:d.valor,disabled:d.disabled,children:d.label},d.valor))})]}),((l=c.error)==null?void 0:l.message)&&a.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},en=({name:e,control:t,label:r,disabled:o,readOnly:n})=>{var s;const{field:l,fieldState:i}=Se.useController({name:e,control:t});return a.jsxs("div",{className:"space-y-1",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx(We,{name:l.name,checked:!!l.value,onCheckedChange:c=>!n&&l.onChange(!!c),onBlur:l.onBlur,disabled:o}),r&&a.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=i.error)==null?void 0:s.message)&&a.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},cl=({name:e,control:t,options:r,disabled:o})=>{var n;const{field:s,fieldState:l}=Se.useController({name:e,control:t}),i=Array.isArray(s.value)?s.value:[],c=d=>{const m=i.includes(d)?i.filter(u=>u!==d):[...i,d];s.onChange(m)};return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex flex-col gap-2",onBlur:s.onBlur,children:r.map(d=>a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx(We,{checked:i.includes(d.valor),onCheckedChange:()=>c(d.valor),disabled:o||d.disabled}),a.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((n=l.error)==null?void 0:n.message)&&a.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},dl=({name:e,control:t,options:r,visualStyle:o="default",disabled:n})=>{var s;const{field:l,fieldState:i}=Se.useController({name:e,control:t}),c=o==="card";return a.jsxs("div",{className:"space-y-1",onBlur:l.onBlur,children:[a.jsx(Rs,{value:l.value??"",onValueChange:l.onChange,className:J(c?"grid grid-cols-2 gap-2 sm:grid-cols-3":"flex flex-col gap-2"),children:r.map(d=>a.jsxs("label",{className:J("flex items-center gap-2 cursor-pointer",c&&"rounded-lg border p-3 transition-colors hover:bg-accent data-[selected=true]:border-primary data-[selected=true]:bg-primary/5",(n||d.disabled)&&"cursor-not-allowed opacity-50"),"data-selected":l.value===d.valor?"true":void 0,children:[a.jsx(Ds,{value:d.valor,disabled:n||d.disabled}),a.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((s=i.error)==null?void 0:s.message)&&a.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},lp=e=>{const t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${o}`},M0=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),lp(t)},V0=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),lp(t)},Qr=({name:e,control:t,isDatetime:r,disabled:o,readOnly:n,validacao:s})=>{var l;const{field:i,fieldState:c}=Se.useController({name:e,control:t}),d=r?"datetime-local":"date",m=p=>r?p+"T00:00":p,u=(s==null?void 0:s.minAge)!=null?m(M0(s.minAge)):(s==null?void 0:s.maxDate)!=null?m(s.maxDate):void 0,h=(s==null?void 0:s.maxAge)!=null?m(V0(s.maxAge)):(s==null?void 0:s.minDate)!=null?m(s.minDate):void 0;return a.jsxs("div",{className:"space-y-1",children:[a.jsx(de,{name:i.name,value:i.value??"",onChange:i.onChange,onBlur:i.onBlur,type:d,min:h,max:u,disabled:o,readOnly:n,className:J(c.error&&"border-destructive focus-visible:ring-destructive")}),((l=c.error)==null?void 0:l.message)&&a.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Ni=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,ul=({name:e,control:t,disabled:r,campo:o,fileTypes:n,maxFileSize:s})=>{var l;const{field:i,fieldState:c}=Se.useController({name:e,control:t}),{uploadFile:d}=tr(),[m,u]=k.useState({status:"idle"}),h=k.useRef(null),[p,y]=k.useState(!1),f=k.useRef(!0);k.useEffect(()=>()=>{f.current=!1},[]);const g=typeof i.value=="string"&&i.value?i.value:null,w=k.useCallback(async N=>{var S;if(n&&n.length>0){const $=((S=N.name.split(".").pop())==null?void 0:S.toLowerCase())??"",C=N.type.toLowerCase();if(!n.some(E=>{const A=E.toLowerCase();return!!(A===$||A===C||A.endsWith("/*")&&C.startsWith(A.slice(0,-1)))})){u({status:"error",message:`Tipo de arquivo não permitido. Permitidos: ${n.join(", ")}`});return}}if(s&&N.size>s){u({status:"error",message:`Arquivo muito grande. Tamanho máximo: ${Ni(s)}`});return}if(!d){u({status:"error",message:"Preview: upload não disponível sem configuração."});return}u({status:"uploading",fileName:N.name,progress:0});try{const $=await d(N,o??e,C=>{f.current&&u(E=>E.status==="uploading"?{...E,progress:Math.min(100,C)}:E)});if(!f.current)return;i.onChange($),u({status:"done",uploadId:$,fileName:N.name,size:N.size})}catch{if(!f.current)return;u({status:"error",message:"Falha no upload. Tente novamente."})}},[d,o,e,i,n,s]),v=k.useCallback(N=>{var S;const $=(S=N.target.files)==null?void 0:S[0];$&&w($),N.target.value=""},[w]),b=k.useCallback(()=>{i.onChange(""),u({status:"idle"}),h.current&&(h.current.value="")},[i]);if(m.status==="done"||m.status==="idle"&&g){const N=m.status==="done"?m.fileName:"Arquivo enviado",S=m.status==="done"?m.size:null;return a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-input bg-muted/20 px-4 py-3 gap-2",children:[a.jsx("span",{className:"text-sm font-medium truncate flex-1",children:N}),S!==null&&a.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:Ni(S)}),!r&&a.jsx("button",{type:"button",onClick:b,className:"ml-2 shrink-0 text-muted-foreground hover:text-destructive transition-colors","aria-label":"Remover arquivo",children:"✕"})]})}if(m.status==="uploading"){const{fileName:N,progress:S}=m;return a.jsxs("div",{className:"rounded-lg border border-input px-4 py-3 space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm font-medium truncate flex-1",children:N}),a.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:[S,"%"]})]}),a.jsx("div",{className:"h-2 rounded-full bg-muted overflow-hidden",children:a.jsx("div",{className:"h-full bg-primary transition-all duration-200 rounded-full",style:{width:`${S}%`}})})]})}const j=m.status==="error";return a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{role:"button",tabIndex:r?-1:0,"aria-label":"Selecionar arquivo",className:J("flex items-center justify-center rounded-lg border-2 border-dashed px-4 py-6 transition-colors cursor-pointer",p?"border-primary bg-primary/5":j||c.error?"border-destructive bg-destructive/5":"border-input hover:border-muted-foreground hover:bg-muted/20",r&&"opacity-50 cursor-not-allowed"),onClick:()=>{var N;return!r&&((N=h.current)==null?void 0:N.click())},onKeyDown:N=>{var S;(N.key==="Enter"||N.key===" ")&&((S=h.current)==null||S.click())},onDragOver:N=>{N.preventDefault(),r||y(!0)},onDragLeave:()=>y(!1),onDrop:r?void 0:N=>{var S;N.preventDefault(),y(!1);const $=(S=N.dataTransfer.files)==null?void 0:S[0];$&&w($)},onBlur:i.onBlur,children:[a.jsx("input",{ref:h,type:"file",onChange:v,disabled:r,className:"sr-only"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:p?"Solte o arquivo aqui":"Clique ou arraste um arquivo"})]}),j&&a.jsxs("p",{className:"text-sm text-destructive",children:[m.message," · ",a.jsx("button",{type:"button",className:"underline hover:no-underline",onClick:()=>u({status:"idle"}),children:"Tentar novamente"})]}),!j&&((l=c.error)==null?void 0:l.message)&&a.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},z0={cpf:e=>e.replace(/\D/g,"").slice(0,11).replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2"),telefone:e=>{const t=e.replace(/\D/g,"").slice(0,11);return t.length<=10?t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{4})(\d)/,"$1-$2"):t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2")},cep:e=>e.replace(/\D/g,"").slice(0,8).replace(/(\d{5})(\d)/,"$1-$2")},cr=({name:e,control:t,placeholder:r,maskType:o,disabled:n,readOnly:s})=>{var l;const{field:i,fieldState:c}=Se.useController({name:e,control:t}),d=z0[o||""],m=k.useCallback(u=>{i.onChange(d?d(u.target.value):u.target.value)},[i,d]);return a.jsxs("div",{className:"space-y-1",children:[a.jsx(de,{name:i.name,value:i.value||"",onChange:m,onBlur:i.onBlur,placeholder:r,disabled:n,readOnly:s,className:J(c.error&&"border-destructive focus-visible:ring-destructive")}),((l=c.error)==null?void 0:l.message)&&a.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},tn=({name:e,control:t})=>{const{field:r}=Se.useController({name:e,control:t});return a.jsx("input",{type:"hidden",...r,value:r.value??""})},ip=e=>e.replace(/\D/g,""),B0=e=>{const t=ip(e).slice(0,8);return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5)}`},U0=async(e,t)=>{const r=await fetch(`https://viacep.com.br/ws/${e}/json/`,{signal:t});if(!r.ok)throw new Error("Falha ao consultar CEP");return r.json()},ml=({name:e,control:t,placeholder:r="00000-000",disabled:o,readOnly:n,cepFillMap:s})=>{var l,i;const{field:c,fieldState:d}=Se.useController({name:e,control:t}),{setValue:m}=Se.useFormContext(),{cepLookup:u}=tr(),[h,p]=k.useState("idle"),[y,f]=k.useState(null),g=k.useRef(null),w=k.useRef(!0);k.useEffect(()=>()=>{var j;w.current=!1,(j=g.current)==null||j.abort()},[]);const v=k.useCallback(async()=>{var j;c.onBlur();const N=ip(c.value??"");if(N.length===8){(j=g.current)==null||j.abort(),g.current=new AbortController,p("loading"),f(null);try{let S;if(u){const E=g.current;if(S=await u(N,E.signal),E.signal.aborted||!w.current)return}else{const E=await U0(N,g.current.signal);if(!w.current)return;if(E.erro){p("error"),f("CEP não encontrado");return}S={logradouro:E.logradouro,bairro:E.bairro,cidade:E.localidade,estado:E.uf}}if(!w.current)return;if(S.erro){p("error"),f("CEP não encontrado");return}const $=e.includes(".")?`${e.substring(0,e.lastIndexOf("."))}.`:"",C=(E,A,I)=>{if(!I)return;const M=s!=null&&s[E]?`${$}${s[E]}`:`${$}${A}`;m(M,I,{shouldDirty:!0,shouldValidate:!0})};C("logradouro","_address_logradouro",S.logradouro),C("bairro","_address_bairro",S.bairro),C("cidade","_address_cidade",S.cidade),C("estado","_address_estado",S.estado),p("success")}catch(S){if(S instanceof Error&&S.name==="AbortError"||!w.current)return;p("error"),f("Erro ao buscar CEP")}}},[c,u,m,e,s]),b=k.useCallback(j=>{c.onChange(B0(j.target.value))},[c]);return a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"relative",children:[a.jsx(de,{name:c.name,value:c.value||"",onChange:b,onBlur:v,placeholder:r,disabled:o,readOnly:n,className:J("pr-9",d.error&&"border-destructive focus-visible:ring-destructive")}),a.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",children:[h==="loading"&&a.jsx(O.Loader2,{className:"h-4 w-4 animate-spin text-muted-foreground"}),h==="success"&&a.jsx(O.Check,{className:"h-4 w-4 text-green-500"}),h==="error"&&a.jsx(O.AlertCircle,{className:"h-4 w-4 text-destructive"})]})]}),(((l=d.error)==null?void 0:l.message)||y)&&a.jsx("p",{className:"text-sm text-destructive",children:((i=d.error)==null?void 0:i.message)||y})]})},H0=({field:e,control:t,nameOverride:r})=>{const o={name:r,control:t,placeholder:e.placeholder};switch(e.tipo){case _.TEXTO:return a.jsx(gt,{...o,type:"text"});case _.EMAIL:return a.jsx(gt,{...o,type:"email"});case _.NUMBER:return a.jsx(gt,{...o,type:"number"});case _.TEXTAREA:return a.jsx(Jo,{...o});case _.SELECT:return a.jsx(Qo,{...o,options:e.opcoes??[]});case _.RADIO:return a.jsx(dl,{...o,options:e.opcoes??[]});case _.CHECKBOX:return a.jsx(en,{name:r,control:t,label:e.label});case _.CHECKBOX_GROUP:return a.jsx(cl,{...o,options:e.opcoes??[]});case _.DATE:return a.jsx(Qr,{...o,validacao:e.validacao});case _.DATETIME:return a.jsx(Qr,{...o,isDatetime:!0,validacao:e.validacao});case _.FILE:return a.jsx(ul,{name:r,control:t});case _.TELEFONE:return a.jsx(cr,{...o,maskType:"telefone"});case _.CPF:return a.jsx(cr,{...o,maskType:"cpf"});case _.CEP:return a.jsx(ml,{name:r,control:t,placeholder:e.placeholder});case _.HIDDEN:return a.jsx(tn,{name:r,control:t});default:return console.error(`[DFFieldArray] Tipo de sub-campo "${e.tipo}" não suportado em FIELD_ARRAY. Usando DFTextField como fallback.`),a.jsx(gt,{...o,type:"text"})}},cp=({name:e,control:t,subFields:r=[],minItems:o=1,maxItems:n,itemLabel:s="Item",addLabel:l})=>{var i;const{fields:c,append:d,remove:m}=Se.useFieldArray({control:t,name:e}),{errors:u}=Se.useFormState({control:t}),h=(i=u[e])==null?void 0:i.message,p=k.useCallback(()=>{const w={};for(const v of r)v.initialValue!==void 0?w[v.nome]=v.initialValue:v.defaultValue!==void 0&&(w[v.nome]=v.defaultValue);return w},[r]);k.useEffect(()=>{if(c.length<o)for(let w=c.length;w<o;w++)d(p())},[o]);const y=[...r].sort((w,v)=>w.ordem-v.ordem),f=!n||c.length<n,g=l??`Adicionar ${s.toLowerCase()}`;return a.jsxs("div",{className:"space-y-3",children:[c.map((w,v)=>a.jsxs("div",{className:"rounded-lg border border-input p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary/10 text-xs font-bold text-primary shrink-0",children:v+1}),a.jsxs("span",{className:"text-sm font-semibold",children:[s," ",v+1]})]}),c.length>o&&a.jsx($e,{type:"button",variant:"ghost",size:"icon",onClick:()=>m(v),"aria-label":`Remover ${s.toLowerCase()} ${v+1}`,className:"text-muted-foreground hover:text-destructive",children:a.jsx(O.Trash2,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"grid grid-cols-12 gap-4",children:y.map(b=>{const j=`${e}.${v}.${b.nome}`,N=`span ${b.tamanho??12}`,S=a.jsx(H0,{field:b,control:t,nameOverride:j});return b.tipo===_.CHECKBOX||b.tipo===_.HIDDEN?a.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:N},children:S},b.id):a.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:N},children:[a.jsxs("label",{className:"font-medium flex items-center gap-1 text-sm text-foreground",children:[b.label,b.obrigatorio&&a.jsx("span",{className:"text-destructive",children:"*"})]}),S,b.hint&&a.jsx("p",{className:"text-xs text-muted-foreground",children:b.hint})]},b.id)})})]},w.id)),f&&a.jsxs($e,{type:"button",variant:"outline",className:"w-full",onClick:()=>d(p()),children:[a.jsx(O.Plus,{className:"w-4 h-4"}),g]}),n&&a.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",n," ",s.toLowerCase(),n>1?"s":""]}),h&&a.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[a.jsx(O.AlertCircle,{className:"w-4 h-4 shrink-0"}),h]})]})},Ci=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,W0=(e,t)=>{const r=new Date(e.slice(0,10)+"T00:00:00Z"),o=new Date(t.slice(0,10)+"T00:00:00Z");return Math.round((o.getTime()-r.getTime())/864e5)+1},q0=(e,t)=>{const r=[],o=new Date(e.slice(0,10)+"T00:00:00Z"),n=new Date(t.slice(0,10)+"T00:00:00Z");let s=0;for(;o<=n&&s<60;)r.push(o.toISOString().slice(0,10)),o.setUTCDate(o.getUTCDate()+1),s++;return r},X0=e=>{const[t,r,o]=e.split("-").map(Number),n=new Date(Date.UTC(t,r-1,o)),s=String(o).padStart(2,"0"),l=String(r).padStart(2,"0"),i=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(n),c=i.charAt(0).toUpperCase()+i.slice(1);return`${s}/${l} - ${c}`},G0=(e,t)=>{const r=o=>{const[n,s,l]=o.slice(0,10).split("-");return`${l}/${s}/${n}`};return`${r(e)} a ${r(t)}`},dp=({name:e,control:t})=>{var r;const{field:o,fieldState:n}=Se.useController({name:e,control:t}),{externalData:s={}}=tr(),l=o.value??null,i=(r=n.error)==null?void 0:r.message,c=V=>s[`evento.${V}`]??s[V],d=c("dataInicioEvento")??"",m=c("dataFimEvento")??"",u=Number(c("valor")??0),h=Number(c("valorPorDia")??0),p=c("vagasTotal"),y=c("vagasPorDia"),f=c("vagasMasculinas"),g=c("vagasFemininas"),w=p!=null?Number(p):null,v=y!=null?Number(y):null,b=f!=null?Number(f):null,j=g!=null?Number(g):null,N=d&&m?q0(d,m):[],S=(d&&m?W0(d,m):0)>1,$=b!=null&&b>0&&j!=null&&j>0,C=b!=null&&j==null?"masculino":j!=null&&b==null?"feminino":null,E=(l==null?void 0:l.tipo)??null,A=(l==null?void 0:l.data)??null,I=(l==null?void 0:l.genero)??null,M=k.useRef(l);M.current=l;const T=k.useRef(o.onChange);T.current=o.onChange,k.useEffect(()=>{var V,L,P;C&&((V=M.current)==null?void 0:V.genero)!==C&&T.current({tipo:((L=M.current)==null?void 0:L.tipo)??null,data:((P=M.current)==null?void 0:P.data)??null,genero:C})},[C]);const B=V=>{const L={tipo:V,data:null};($||C)&&(L.genero=I??C??void 0),o.onChange(L)},q=V=>{const L={tipo:"por_dia",data:V};($||C)&&(L.genero=I??C??void 0),o.onChange(L)},W=V=>{o.onChange({tipo:E,data:A,genero:V})},X=V=>E===V;return a.jsxs("div",{className:"space-y-3",children:[$&&a.jsxs("div",{className:"flex items-center gap-2 px-1",children:[a.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Você é:"}),a.jsx("div",{className:"flex gap-2",children:["masculino","feminino"].map(V=>a.jsx("button",{type:"button",onClick:()=>W(V),className:J("px-3 py-1 rounded-full text-xs font-medium border transition-all",I===V?"border-primary bg-primary/10 text-primary":"border-input text-muted-foreground hover:border-primary/50"),children:V==="masculino"?"Masculino":"Feminino"},V))})]}),a.jsxs("button",{type:"button",onClick:()=>B("todos_os_dias"),className:J("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",X("todos_os_dias")?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[a.jsx("div",{className:J("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",X("todos_os_dias")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:a.jsx(O.CalendarCheck2,{className:"w-4 h-4"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-semibold text-sm",children:"Participar todos os dias"}),d&&m?a.jsx("p",{className:"text-xs text-muted-foreground",children:G0(d,m)}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Datas do evento"})]}),a.jsxs("div",{className:"text-right shrink-0",children:[u>0&&a.jsx("p",{className:J("font-bold text-sm",X("todos_os_dias")?"text-primary":"text-foreground"),children:Ci(u)}),w!=null&&w>0&&a.jsxs("p",{className:"text-xs flex items-center justify-end gap-1 text-muted-foreground",children:[a.jsx(O.Users,{className:"w-3 h-3"}),w," vagas disponíveis"]})]})]}),S?a.jsxs("button",{type:"button",onClick:()=>B("por_dia"),className:J("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",X("por_dia")?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[a.jsx("div",{className:J("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",X("por_dia")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:a.jsx(O.CalendarDays,{className:"w-4 h-4"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-semibold text-sm",children:"Participar um dia"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Escolha o dia desejado abaixo"})]}),a.jsxs("div",{className:"text-right shrink-0",children:[h>0&&a.jsx("p",{className:J("font-bold text-sm",X("por_dia")?"text-primary":"text-foreground"),children:Ci(h)}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"por dia"})]})]}):d?a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg border border-input bg-muted/30",children:[a.jsx(O.Info,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-muted-foreground"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'Este evento ocorre em apenas 1 dia — a opção "Participar um dia" não é necessária.'})]}):null,E==="por_dia"&&a.jsxs("div",{className:"pl-2 space-y-2",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-primary",children:"Selecione o dia:"}),N.length===0?a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Nenhuma data configurada no evento"}):N.map(V=>a.jsxs("button",{type:"button",onClick:()=>q(V),className:J("w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",A===V?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:J("w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center transition-colors",A===V?"border-primary bg-primary":"border-input"),children:A===V&&a.jsx("span",{className:"w-2 h-2 rounded-full bg-white"})}),a.jsx("span",{className:"text-sm",children:X0(V)})]}),v!=null&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:[v," vagas"]})]},V))]}),i&&a.jsx("p",{className:"text-sm text-destructive",children:i})]})},ki=.0315,Si=.124,$i=7,Ei=12,up=[{id:"pix",label:"PIX",description:"Transferência instantânea (à vista)",Icon:O.Smartphone,taxa:0},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:O.Banknote,taxa:0},{id:"cartao",label:"Cartão de Crédito",description:"Débito ou crédito na maquininha",Icon:O.CreditCard,taxa:ki,taxaLabel:`Taxa: ${(ki*100).toFixed(2).replace(".",",")}%`}],mp=[{id:"pix",label:"PIX à Vista",description:"Pagamento instantâneo sem parcelamento",Icon:O.Smartphone,taxa:0},{id:"pix_parcelado",label:"PIX Parcelado",description:`Parcelado em até ${$i}x sem juros`,Icon:O.Smartphone,taxa:0,parcelas:$i},{id:"cartao",label:"Cartão de Crédito",description:`Parcelado em até ${Ei}x`,Icon:O.CreditCard,taxa:Si,parcelas:Ei,taxaLabel:`Taxa: ${(Si*100).toFixed(2).replace(".",",")}%`},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:O.Banknote,taxa:0}],Ua=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,Ai=(e,t)=>Math.round(e*(1+t)*100)/100,K0=(e,t)=>Math.round(e/t*100)/100,pp=({name:e,control:t,relatedFieldName:r="tipo_participacao"})=>{var o;const{field:n,fieldState:s}=Se.useController({name:e,control:t}),{externalData:l={},paymentMethodOptions:i}=tr(),c=n.value??null,d=(o=s.error)==null?void 0:o.message,m=Se.useWatch({control:t,name:r}),u=(m==null?void 0:m.tipo)??null,h=b=>l[`evento.${b}`]??l[b],p=Number(h("valor")??0),y=Number(h("valorPorDia")??0),f=u==="por_dia"&&y>0?y:p,g=u==="por_dia"?(i==null?void 0:i.porDia)??up:(i==null?void 0:i.todosOsDias)??mp,w=u==="por_dia"?(()=>{if(!(m!=null&&m.data))return"Um dia";const b=m.data.split("-");if(b.length===3){const[j,N,S]=b;return`${S}/${N}/${j}`}return m.data})():"Todos os dias",v=b=>{if(b.disabled)return;const j=Ai(f,b.taxa),N={metodo:b.id,valorTotal:j};b.parcelas&&(N.parcelas=b.parcelas),n.onChange(N)};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-input px-4 py-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Tipo de participação"}),a.jsx("p",{className:"font-semibold",children:w})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Valor base"}),a.jsx("p",{className:"text-lg font-bold text-primary",children:Ua(f)})]})]}),a.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-input bg-muted/30 px-3 py-2.5",children:[a.jsx(O.Info,{className:"h-4 w-4 mt-0.5 shrink-0 text-muted-foreground"}),a.jsxs("p",{className:"text-xs",children:[a.jsx("span",{className:"font-bold",children:"Importante:"})," Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."]})]}),a.jsx("p",{className:"text-sm font-semibold text-primary",children:"Selecione a forma de pagamento:"}),a.jsx("div",{className:"space-y-3",children:g.map(b=>{const{Icon:j}=b,N=(c==null?void 0:c.metodo)===b.id,S=Ai(f,b.taxa),$=!!b.parcelas&&b.parcelas>1,C=$?K0(S,b.parcelas):null;return a.jsxs("button",{type:"button",disabled:b.disabled,onClick:()=>v(b),className:J("w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all",N?"border-primary bg-primary/5":"border-input hover:border-primary/50",b.disabled&&"opacity-50 cursor-not-allowed"),children:[a.jsx("div",{className:J("flex items-center justify-center w-10 h-10 rounded-lg shrink-0 transition-colors",N?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:a.jsx(j,{className:"h-5 w-5"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-semibold text-sm leading-tight",children:b.label}),a.jsx("p",{className:"text-xs text-muted-foreground",children:b.description}),b.taxaLabel&&a.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["* ",b.taxaLabel]}),b.taxa>0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Total com taxa: ",Ua(S)]})]}),a.jsx("div",{className:"text-right shrink-0",children:$?a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"text-xs text-muted-foreground",children:[b.parcelas,"x de"]}),a.jsx("p",{className:"text-base font-bold text-primary",children:Ua(C)})]}):a.jsx("p",{className:"text-base font-bold text-primary",children:Ua(S)})})]},b.id)})}),d&&a.jsx("p",{className:"text-xs text-destructive",children:d})]})},fp=({name:e,control:t,label:r,termoTexto:o,termoPdfUrl:n,termoPdfUploadId:s})=>{var l;const{field:i,fieldState:c}=Se.useController({name:e,control:t}),{resolveTermsUploadUrl:d}=tr(),m=!!c.error,u=(l=c.error)==null?void 0:l.message,[h,p]=k.useState(null),[y,f]=k.useState(!1),[g,w]=k.useState(!1),v=k.useRef(null);k.useEffect(()=>{var $;g&&(($=v.current)==null||$.focus())},[g]),k.useEffect(()=>{if(!s||!d){p(null);return}let $=!1;return f(!0),d(s).then(C=>{$||p(C)}).catch(()=>{$||p(null)}).finally(()=>{$||f(!1)}),()=>{$=!0}},[s,d]);const b=i.value==="accepted",j=h||n||null,N=!!(o||j||s),S=!!j;return a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:J("rounded-lg border p-4 space-y-4 transition-colors",m?"border-destructive bg-destructive/5":b?"border-green-500 bg-green-500/5":"border-input"),children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(O.ScrollText,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{className:"text-sm font-medium",children:r||"Termos e condições"})]}),N?a.jsxs($e,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",disabled:y,onClick:()=>w(!0),children:[y?a.jsx(O.Loader2,{className:"h-3 w-3 animate-spin"}):a.jsx(O.ExternalLink,{className:"h-3 w-3"}),"Ler termos"]}):a.jsx("span",{className:"text-xs text-muted-foreground italic",children:s&&y?"Carregando PDF...":"Conteúdo não configurado"})]}),a.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[a.jsx(We,{className:"mt-0.5",checked:b,onCheckedChange:$=>i.onChange($?"accepted":"")}),a.jsxs("span",{className:"text-sm leading-snug flex-1",children:["Li e aceito ",r?`"${r}"`:"os termos e condições"]}),b&&a.jsx(O.CheckCircle2,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"})]})]}),m&&a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[a.jsx(O.AlertCircle,{className:"h-3.5 w-3.5 shrink-0"}),u||"Você precisa aceitar os termos para continuar"]}),g&&a.jsx("div",{ref:v,role:"dialog","aria-modal":"true","aria-label":"Termos e condições",tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 outline-none",onClick:()=>w(!1),onKeyDown:$=>{$.key==="Escape"&&w(!1)},children:a.jsxs("div",{className:"relative w-full max-w-2xl max-h-[90vh] rounded-xl overflow-hidden flex flex-col bg-background shadow-xl",onClick:$=>$.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-input",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(O.ScrollText,{className:"h-4 w-4"}),a.jsx("span",{className:"font-semibold",children:"Termos e condições"})]}),a.jsx($e,{type:"button",variant:"ghost",size:"icon",onClick:()=>w(!1),children:a.jsx(O.X,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"flex-1 overflow-auto p-4",children:S?a.jsx("iframe",{src:j,className:"w-full rounded border",style:{height:"62vh"},title:"Termos e condições",sandbox:"allow-same-origin"}):a.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:o})})]})})]})},Y0=({name:e,control:t,placeholder:r,disabled:o,readOnly:n})=>{var s;const{field:l,fieldState:i}=Se.useController({name:e,control:t}),[c,d]=k.useState(!1),m=!!i.error;return a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"relative",children:[a.jsx(de,{...l,value:l.value??"",type:c?"text":"password",placeholder:r,disabled:o,readOnly:n,className:J("pr-10",m&&"border-destructive focus-visible:ring-destructive")}),a.jsx("button",{type:"button",tabIndex:-1,onClick:()=>d(u=>!u),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors","aria-label":c?"Ocultar senha":"Mostrar senha",children:c?a.jsx(O.EyeOff,{size:16}):a.jsx(O.Eye,{size:16})})]}),((s=i.error)==null?void 0:s.message)&&a.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},hp=({name:e,control:t,label:r,disabled:o,readOnly:n})=>{var s;const{field:l,fieldState:i}=Se.useController({name:e,control:t}),c=!!l.value;return a.jsxs("div",{className:"space-y-1",children:[a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none",children:[a.jsx(Ps,{checked:c,onCheckedChange:d=>!n&&l.onChange(d),disabled:o||n,onBlur:l.onBlur}),a.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=i.error)==null?void 0:s.message)&&a.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},Z0=({name:e,control:t,minValue:r=0,maxValue:o=100,step:n=1,disabled:s,readOnly:l})=>{var i;const{field:c,fieldState:d}=Se.useController({name:e,control:t}),m=c.value??r;return k.useEffect(()=>{(c.value===void 0||c.value===null)&&c.onChange(r)},[]),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Vo,{min:r,max:o,step:n,value:[m],onValueChange:u=>!l&&c.onChange(u[0]),disabled:s||l,className:"flex-1"}),a.jsx("span",{className:"text-sm font-medium text-primary min-w-[3rem] text-right tabular-nums",children:m})]}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:r}),a.jsx("span",{children:o})]}),((i=d.error)==null?void 0:i.message)&&a.jsx("p",{className:"text-sm text-destructive",children:d.error.message})]})},Sn=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),J0=({name:e,control:t,disabled:r,readOnly:o})=>{var n;const{field:s,fieldState:l}=Se.useController({name:e,control:t}),i=s.value||"#000000",[c,d]=k.useState(i);return k.useEffect(()=>{d(i)},[i]),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"color",value:Sn(i)?i:"#000000",disabled:r||o,onChange:m=>s.onChange(m.target.value),className:"h-10 w-14 cursor-pointer rounded-lg border border-input bg-transparent p-1 disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx(de,{type:"text",value:c,readOnly:o,disabled:r,onChange:m=>{const u=m.target.value;d(u),Sn(u)&&s.onChange(u.toUpperCase())},onBlur:()=>{Sn(c)||d(i),s.onBlur()},className:J("flex-1 font-mono uppercase",l.error&&"border-destructive focus-visible:ring-destructive"),maxLength:7,placeholder:"#000000"})]}),((n=l.error)==null?void 0:n.message)&&a.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},Q0=({name:e,control:t,options:r,placeholder:o,disabled:n,readOnly:s})=>{var l,i;const{field:c,fieldState:d}=Se.useController({name:e,control:t}),[m,u]=k.useState(""),[h,p]=k.useState(!1),[y,f]=k.useState(-1),g=k.useRef(null),w=k.useRef(null),v=`autocomplete-${e}-listbox`,b=((l=r.find(A=>A.valor===c.value))==null?void 0:l.label)??"",j=m.length>0?r.filter(A=>A.label.toLowerCase().includes(m.toLowerCase())):r;k.useEffect(()=>{const A=I=>{g.current&&!g.current.contains(I.target)&&(p(!1),u(""),f(-1))};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);const N=()=>{p(!1),u(""),f(-1)};k.useEffect(()=>{if(y<0||!w.current)return;const A=w.current.querySelector(`[id="${v}-option-${y}"]`);A==null||A.scrollIntoView({block:"nearest"})},[y,v]);const S=A=>{A.disabled||(c.onChange(A.valor),N())},$=()=>{c.onChange(""),u(""),f(-1)},C=A=>{if(!h){(A.key==="ArrowDown"||A.key==="ArrowUp")&&(A.preventDefault(),p(!0),f(0));return}switch(A.key){case"ArrowDown":A.preventDefault(),f(I=>I<j.length-1?I+1:I);break;case"ArrowUp":A.preventDefault(),f(I=>I>0?I-1:0);break;case"Enter":A.preventDefault(),y>=0&&j[y]&&!j[y].disabled&&S(j[y]);break;case"Escape":A.preventDefault(),N();break;case"Tab":N();break}},E=h&&y>=0?`${v}-option-${y}`:void 0;return a.jsxs("div",{className:"space-y-1",ref:g,children:[a.jsxs("div",{className:"relative",children:[a.jsx(de,{type:"text",role:"combobox","aria-expanded":h,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-controls":v,"aria-activedescendant":E,value:h?m:b,placeholder:o??"Buscar...",disabled:n,readOnly:s,onChange:A=>{u(A.target.value),f(-1),p(!0)},onFocus:()=>!s&&p(!0),onKeyDown:C,className:J("pr-8",d.error&&"border-destructive focus-visible:ring-destructive"),autoComplete:"off"}),a.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",children:c.value?a.jsx("button",{type:"button",onClick:$,className:"text-[var(--t-text-muted)] hover:text-[var(--t-text)]",tabIndex:-1,"aria-label":"Limpar seleção",children:a.jsx(O.X,{size:14})}):a.jsx(O.ChevronDown,{size:16,className:"text-muted-foreground pointer-events-none","aria-hidden":"true"})}),h&&!n&&!s&&a.jsx("ul",{role:"listbox",id:v,ref:w,"aria-label":"Opções disponíveis",className:"absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg border border-input bg-popover shadow-lg",children:j.length===0?a.jsx("li",{role:"option","aria-selected":!1,className:"px-3 py-2 text-sm text-muted-foreground",children:"Nenhuma opção encontrada"}):j.map((A,I)=>a.jsx("li",{id:`${v}-option-${I}`,role:"option","aria-selected":c.value===A.valor,"aria-disabled":A.disabled,onMouseDown:()=>S(A),className:["flex cursor-pointer items-center px-3 py-2 text-sm",A.disabled?"cursor-not-allowed opacity-40":I===y?"bg-accent":"hover:bg-accent",c.value===A.valor?"font-medium text-primary":"text-foreground"].join(" "),children:A.label},A.valor))})]}),((i=d.error)==null?void 0:i.message)&&a.jsx("p",{className:"text-sm text-destructive",role:"alert",children:d.error.message})]})},xp=({name:e,control:t,placeholder:r,disabled:o,readOnly:n})=>{var s;const{field:l,fieldState:i}=Se.useController({name:e,control:t}),c=!!i.error;return a.jsxs("div",{className:"space-y-1",children:[a.jsx(de,{...l,value:l.value??"",type:"time",placeholder:r,disabled:o,readOnly:n,className:J(c&&"border-destructive focus-visible:ring-destructive")}),((s=i.error)==null?void 0:s.message)&&a.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},ew=({name:e,control:t,startLabel:r="Data inicial",endLabel:o="Data final",disabled:n,readOnly:s})=>{var l;const{field:i,fieldState:c}=Se.useController({name:e,control:t}),d=i.value??{},m=(h,p)=>{i.onChange({...d,[h]:p})},u=!!c.error;return a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{children:r}),a.jsx(de,{type:"date",value:d.start??"",disabled:n,readOnly:s,onChange:h=>m("start",h.target.value),max:d.end??void 0,className:J(u&&"border-destructive focus-visible:ring-destructive")})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{children:o}),a.jsx(de,{type:"date",value:d.end??"",disabled:n,readOnly:s,onChange:h=>m("end",h.target.value),min:d.start??void 0,className:J(u&&"border-destructive focus-visible:ring-destructive")})]})]}),((l=c.error)==null?void 0:l.message)&&a.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},tw=({name:e,control:t,maxRating:r=5,disabled:o,readOnly:n})=>{var s;const{field:l,fieldState:i}=Se.useController({name:e,control:t}),c=l.value??0,d=Array.from({length:r},(m,u)=>u+1);return a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[d.map(m=>a.jsx("button",{type:"button",disabled:o||n,onClick:()=>l.onChange(m===c?0:m),className:"transition-transform hover:scale-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":`${m} estrela${m>1?"s":""}`,children:a.jsx(O.Star,{size:24,className:"transition-colors",fill:m<=c?"var(--color-primary)":"transparent",stroke:m<=c?"var(--color-primary)":"currentColor"})},m)),c>0&&a.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[c,"/",r]})]}),((s=i.error)==null?void 0:s.message)&&a.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},rw=({field:e,name:t,control:r,disabled:o,readOnly:n})=>{const s=o||e.isDisabled,l=n||e.isReadOnly;switch(e.tipo){case _.EMAIL:return a.jsx(gt,{name:t,control:r,type:"email",placeholder:e.placeholder,disabled:s,readOnly:l});case _.NUMBER:return a.jsx(gt,{name:t,control:r,type:"number",placeholder:e.placeholder,disabled:s,readOnly:l});case _.PASSWORD:return a.jsx(gt,{name:t,control:r,type:"password",placeholder:e.placeholder,disabled:s,readOnly:l});case _.TELEFONE:return a.jsx(cr,{name:t,control:r,maskType:"telefone",placeholder:e.placeholder??"(00) 00000-0000",disabled:s,readOnly:l});case _.CPF:return a.jsx(cr,{name:t,control:r,maskType:"cpf",placeholder:e.placeholder??"000.000.000-00",disabled:s,readOnly:l});case _.CEP:return a.jsx(cr,{name:t,control:r,maskType:"cep",placeholder:e.placeholder??"00000-000",disabled:s,readOnly:l});case _.TEXTAREA:return a.jsx(Jo,{name:t,control:r,placeholder:e.placeholder,disabled:s,readOnly:l});case _.SELECT:return a.jsx(Qo,{name:t,control:r,options:e.opcoes??[],placeholder:e.placeholder,disabled:s,readOnly:l});case _.CHECKBOX:return a.jsx(en,{name:t,control:r,label:e.label??"",disabled:s,readOnly:l});case _.SWITCH:return a.jsx(hp,{name:t,control:r,label:e.label??"",disabled:s,readOnly:l});case _.DATE:return a.jsx(Qr,{name:t,control:r,disabled:s,readOnly:l});case _.TIME:return a.jsx(xp,{name:t,control:r,disabled:s,readOnly:l});case _.HIDDEN:return a.jsx(tn,{name:t,control:r});default:return a.jsx(gt,{name:t,control:r,type:"text",placeholder:e.placeholder,disabled:s,readOnly:l})}},aw=({name:e,control:t,subSchema:r,disabled:o,readOnly:n})=>{if(!r||r.fields.length===0)return null;const s=[...r.fields].sort((l,i)=>l.ordem-i.ordem);return a.jsxs("div",{className:"rounded-xl border border-input bg-muted/30 p-4 space-y-4",children:[r.titulo&&a.jsx("h4",{className:"text-sm font-semibold text-muted-foreground",children:r.titulo}),a.jsx("div",{className:"grid grid-cols-12 gap-4",children:s.map(l=>{const i=`${e}.${l.nome}`,c=l.tipo===_.CHECKBOX||l.tipo===_.SWITCH||l.tipo===_.HIDDEN,d=l.tamanho??6;return a.jsxs("div",{className:`col-span-${d}`,children:[!c&&a.jsxs("label",{className:"mb-1 block text-sm font-medium text-foreground",children:[l.label,l.obrigatorio&&a.jsx("span",{className:"text-destructive",children:" *"})]}),a.jsx(rw,{field:l,name:i,control:t,disabled:o,readOnly:n})]},l.id)})})]})},gp=({field:e,control:t,nameOverride:r})=>{var o,n;const s=r??e.nome,{componentMapper:l}=tr(),i=l==null?void 0:l[e.tipo];if(i)return a.jsx(i,{name:s,control:t,field:e});const c={name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly};switch(e.tipo){case _.TEXTO:return a.jsx(gt,{...c,type:"text"});case _.EMAIL:return a.jsx(gt,{...c,type:"email"});case _.NUMBER:return a.jsx(gt,{...c,type:"number"});case _.PASSWORD:return a.jsx(Y0,{...c});case _.TEXTAREA:return a.jsx(Jo,{...c});case _.SELECT:return a.jsx(Qo,{...c,options:e.opcoes??[]});case _.AUTOCOMPLETE:return a.jsx(Q0,{...c,options:e.opcoes??[]});case _.SWITCH:return a.jsx(hp,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.SLIDER:return a.jsx(Z0,{name:s,control:t,minValue:e.minValue,maxValue:e.maxValue,step:e.step,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.RATING:return a.jsx(tw,{name:s,control:t,maxRating:e.maxRating,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.COLOR:return a.jsx(J0,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.TIME:return a.jsx(xp,{...c});case _.DATE_RANGE:return a.jsx(ew,{name:s,control:t,startLabel:e.dateRangeStartLabel,endLabel:e.dateRangeEndLabel,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.RADIO:return a.jsx(dl,{...c,options:e.opcoes??[]});case _.CHECKBOX:return a.jsx(en,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.CHECKBOX_GROUP:return a.jsx(cl,{...c,options:e.opcoes??[]});case _.DATE:return a.jsx(Qr,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case _.DATETIME:return a.jsx(Qr,{name:s,control:t,isDatetime:!0,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case _.FILE:return a.jsx(ul,{name:s,control:t,disabled:e.isDisabled,fileTypes:(o=e.validacao)==null?void 0:o.fileTypes,maxFileSize:(n=e.validacao)==null?void 0:n.maxFileSize});case _.TELEFONE:return a.jsx(cr,{...c,maskType:"telefone"});case _.CPF:return a.jsx(cr,{...c,maskType:"cpf"});case _.CEP:return a.jsx(ml,{name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly,cepFillMap:e.cepFillMap});case _.HIDDEN:return a.jsx(tn,{name:s,control:t});case _.PARTICIPATION_TYPE:return a.jsx(dp,{name:s,control:t});case _.PAYMENT_METHOD:return a.jsx(pp,{name:s,control:t,relatedFieldName:e.relatedFieldName});case _.TERMS:return a.jsx(fp,{name:s,control:t,label:e.label,termoTexto:e.termoTexto,termoPdfUrl:e.termoPdfUrl,termoPdfUploadId:e.termoPdfUploadId});case _.FIELD_ARRAY:return a.jsx(cp,{name:s,control:t,subFields:e.subFields,minItems:e.minItems,maxItems:e.maxItems,itemLabel:e.itemLabel,addLabel:e.addLabel});case _.SUB_FORM:return a.jsx(aw,{name:s,control:t,subSchema:e.subSchema,disabled:e.isDisabled,readOnly:e.isReadOnly});default:return a.jsx(gt,{...c,type:"text"})}},ow=({container:e,control:t})=>{var r;const{externalData:o={},fieldResolvers:n}=tr(),s=e.icone?wt[e.icone]:void 0,l=o,i=k.useMemo(()=>Zo(e,l),[e,JSON.stringify(l)]),c=k.useMemo(()=>[...i.campos].sort((g,w)=>g.ordem-w.ordem),[i.campos]),d=Se.useWatch({control:t}),{wrapperClass:m,wrapperStyle:u,headerClass:h,headerStyle:p,tmpl:y}=sp(),f=g=>{if(!Ke(g.condicional,d,o))return null;let w=g;if(g.resolvePropsKey&&n!=null&&n[g.resolvePropsKey]){const S=n[g.resolvePropsKey](g,d,o);w={...g,...S}}if(w.opcoesFromVar){const S=o[w.opcoesFromVar];Array.isArray(S)&&(w={...w,opcoes:S.map($=>typeof $=="string"?{valor:$,label:$}:$&&typeof $=="object"&&"valor"in $&&"label"in $?$:{valor:String($),label:String($)})})}const v=w.tamanho??12,b=w.inicioColuna,j=b?`${b} / span ${v}`:`span ${v}`,N=a.jsx(gp,{field:w,control:t});return w.tipo===_.CHECKBOX||w.tipo===_.HIDDEN||w.tipo===_.SWITCH?a.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:j},children:N},w.id):a.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:j},children:[a.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[w.label,w.obrigatorio&&a.jsx("span",{className:"text-destructive",children:"*"})]}),N,w.hint&&a.jsx("p",{className:"text-xs text-muted-foreground",children:w.hint})]},w.id)};return a.jsxs("div",{className:m,style:u,children:[(i.titulo||s)&&a.jsx("div",{className:h,style:p,children:a.jsxs("div",{className:"flex items-center gap-3",children:[s&&a.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:a.jsx(s,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),a.jsxs("div",{children:[a.jsx("h3",{className:((r=y.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:i.titulo}),i.descricao&&a.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:i.descricao})]})]})}),a.jsx("div",{className:"p-6 grid grid-cols-12 gap-4",children:c.map(f)})]})},nw=({container:e,control:t})=>{var r;const{externalData:o={}}=tr(),n=e.nome??"__invalid__",s=e.minItems??1,l=e.maxItems,i=e.itemLabel??"Item",c=e.icone?wt[e.icone]:void 0,d=o,m=k.useMemo(()=>Zo(e,d),[e,JSON.stringify(d)]),u=k.useMemo(()=>[...m.campos].sort((C,E)=>C.ordem-E.ordem),[m.campos]),h=k.useCallback(()=>{const C={};for(const E of u)E.initialValue!==void 0?C[E.nome]=typeof E.initialValue=="string"?st(E.initialValue,d):E.initialValue:E.defaultValue!==void 0&&(C[E.nome]=E.defaultValue);return C},[u,d]),{fields:p,append:y,remove:f}=Se.useFieldArray({control:t,name:n});k.useEffect(()=>{if(e.nome&&p.length<s)for(let C=p.length;C<s;C++)y(h())},[s]);const g=Se.useWatch({control:t}),w=k.useMemo(()=>{const C=g[n];return Array.isArray(C)?C:[]},[g,n]),{wrapperClass:v,wrapperStyle:b,headerClass:j,headerStyle:N,tmpl:S}=sp();if(!e.nome)return console.error("[RepeatableContainerRenderer] container.nome é obrigatório para containers repetíveis. Container id:",e.id),null;const $=(C,E)=>{const A=w[E]??{};if(!Ke(C.condicional,A,o))return null;const I=`${n}.${E}.${C.nome}`,M=C.tamanho??12,T=C.inicioColuna,B=T?`${T} / span ${M}`:`span ${M}`,q=a.jsx(gp,{field:C,control:t,nameOverride:I});return C.tipo===_.CHECKBOX||C.tipo===_.HIDDEN?a.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:B},children:q},`${C.id}-${E}`):a.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:B},children:[a.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[C.label,C.obrigatorio&&a.jsx("span",{className:"text-destructive",children:"*"})]}),q,C.hint&&a.jsx("p",{className:"text-xs text-muted-foreground",children:C.hint})]},`${C.id}-${E}`)};return a.jsxs("div",{className:v,style:b,children:[(m.titulo||c)&&a.jsx("div",{className:j,style:N,children:a.jsxs("div",{className:"flex items-center gap-3",children:[c&&a.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:a.jsx(c,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),a.jsxs("div",{children:[a.jsx("h3",{className:((r=S.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:m.titulo}),m.descricao&&a.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:m.descricao})]})]})}),a.jsxs("div",{className:"p-6 space-y-4",children:[p.map((C,E)=>a.jsxs("div",{className:"border border-input rounded-lg p-4 bg-muted/30",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0 bg-primary text-primary-foreground",children:E+1}),a.jsxs("span",{className:"text-sm font-semibold",children:[i," ",E+1]})]}),p.length>s&&a.jsx("button",{type:"button",onClick:()=>f(E),className:"inline-flex items-center justify-center rounded-md p-1.5 text-destructive hover:bg-destructive/10 transition-colors","aria-label":"Remover item",children:a.jsx(O.Trash2,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"grid grid-cols-12 gap-4",children:u.map(A=>$(A,E))})]},C.id)),(!l||p.length<l)&&a.jsxs("button",{type:"button",className:"w-full flex items-center justify-center gap-2 py-2 px-4 border border-input rounded-lg text-sm hover:bg-accent transition-colors",onClick:()=>y(h()),children:[a.jsx(O.Plus,{className:"w-4 h-4"}),"Adicionar ",i.toLowerCase()]}),l&&a.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",l," ",i.toLowerCase(),l>1?"s":""]})]})]})},vp=e=>e.container.repeatable&&e.container.nome?a.jsx(nw,{...e}):a.jsx(ow,{...e}),bp=({step:e,control:t,externalData:r={}})=>{const o=k.useMemo(()=>[...e.containers].sort((s,l)=>s.ordem-l.ordem),[e.containers]),n=Se.useWatch({control:t});return a.jsx("div",{className:"grid grid-cols-12 gap-4",children:o.map(s=>{if(s.condicional&&!Ke(s.condicional,n,r))return null;const l=s.tamanho??12,i=s.inicioColuna,c=i?`${i} / span ${l}`:`span ${l}`;return a.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:c},children:a.jsx(vp,{container:s,control:t})},s.id)})})},Ea=k.createContext({submitting:!1,warnings:{},requestSubmit:()=>{}}),sw=Ea.Provider,lw=()=>{const e=wp("useFormApi"),t=k.useContext(Ea);return{change:(r,o)=>e.setValue(r,o,{shouldValidate:!0,shouldDirty:!0}),reset:r=>e.reset(r),submit:t.requestSubmit,getState:()=>{const{errors:r,isDirty:o,isValid:n}=e.formState;return{values:e.getValues(),errors:Object.fromEntries(Object.entries(r).map(([s,l])=>[s,l==null?void 0:l.message])),warnings:t.warnings,dirty:o,valid:n,submitting:t.submitting}}}},yp=()=>{const e=wp("useFormState"),t=k.useContext(Ea),r=Se.useWatch({control:e.control}),{errors:o,isDirty:n,isValid:s}=e.formState;return{values:r,errors:Object.fromEntries(Object.entries(o).map(([l,i])=>[l,i==null?void 0:i.message])),warnings:t.warnings,dirty:n,valid:s,submitting:t.submitting}},iw=e=>{var t;const r=Se.useFormContext(),{warnings:o}=k.useContext(Ea),n=Se.useWatch({control:r.control,name:e}),s=r.getFieldState(e,r.formState);return{value:n,error:(t=s.error)==null?void 0:t.message,warning:o[e],dirty:s.isDirty,touched:s.isTouched,valid:!s.error}},cw=e=>{var t;const{control:r}=Se.useFormContext(),{warnings:o}=k.useContext(Ea),{field:n,fieldState:s}=Se.useController({name:e,control:r});return{input:{name:n.name,value:n.value,onChange:n.onChange,onBlur:n.onBlur,ref:n.ref},meta:{error:(t=s.error)==null?void 0:t.message,warning:o[e],touched:s.isTouched,dirty:s.isDirty,valid:!s.error}}},wp=e=>{const t=Se.useFormContext();if(!t)throw new Error(`[SchemaForms] O hook '${e}' foi chamado fora de um <FormRenderer />. Certifique-se de que o componente está dentro da árvore de renderização do formulário.`);return t},_i=({stepIndex:e,totalSteps:t,step:r,defaultValues:o,externalData:n,fieldErrors:s,isSubmitting:l,submitError:i,validatorMapper:c={},onWarningsChange:d,onValuesChange:m,onSubmit:u,onBack:h})=>{const p=e===t-1,y=k.useMemo(()=>JSON.stringify(n),[n]),f=k.useMemo(()=>rp(r,n,c),[r.id,y]),g=k.useMemo(()=>ap(r,n,c),[r.id,y]),[w,v]=k.useState({}),b=k.useRef(d);b.current=d;const j=n,N=k.useMemo(()=>np(r,j),[r,y]),S=Se.useForm({resolver:f,defaultValues:o,mode:"onTouched"}),{control:$,handleSubmit:C,setError:E,clearErrors:A,setValue:I}=S;k.useEffect(()=>{A();for(const[U,Q]of Object.entries(s))E(U,{type:"server",message:Q})},[s,E,A]);const M=k.useMemo(()=>r.containers.filter(U=>!U.repeatable).flatMap(U=>U.campos).filter(U=>!!U.condicional),[r.containers]),T=k.useMemo(()=>r.containers.filter(U=>!!U.condicional),[r.containers]),B=k.useMemo(()=>r.containers.filter(U=>!U.repeatable).flatMap(U=>U.campos).filter(U=>{var Q;return U.condicional&&((Q=U.setValues)==null?void 0:Q.length)}),[r.containers]),q=k.useMemo(()=>r.containers.filter(U=>U.repeatable&&!!U.nome).map(U=>({container:U,fields:U.campos.filter(Q=>!!Q.condicional)})).filter(U=>U.fields.length>0),[r.containers]),W=k.useRef({}),X=k.useRef(!0),V=Se.useWatch({control:$}),L=k.useRef(m);L.current=m,k.useEffect(()=>{var U;(U=L.current)==null||U.call(L,V)},[V]),k.useEffect(()=>{let U=!1;return g(V).then(Q=>{var ee;U||(v(Q),(ee=b.current)==null||ee.call(b,Q))}).catch(Q=>{U||console.error("[StepForm] warnComputer error:",Q)}),()=>{U=!0}},[V,g]),k.useEffect(()=>{var U;if(!M.length&&!B.length&&!T.length&&!q.length)return;const Q=V;for(const H of M)if(!Ke(H.condicional,Q,n)){if(A(H.nome),H.tipo===_.FIELD_ARRAY){const K=Q[H.nome];Array.isArray(K)&&K.forEach((G,Y)=>{(H.subFields??[]).forEach(Z=>A(`${H.nome}.${Y}.${Z.nome}`))})}if(H.clearedValue!==void 0){const K=H.clearedValue??"";Q[H.nome]!==K&&I(H.nome,K,{shouldValidate:!1})}}for(const H of T)if(!Ke(H.condicional,Q,n))if(H.repeatable&&H.nome)(Array.isArray(Q[H.nome])?Q[H.nome]:[]).forEach((K,G)=>{for(const Y of H.campos)A(`${H.nome}.${G}.${Y.nome}`)});else for(const K of H.campos){A(K.nome);const G=K.clearedValue!==void 0?K.clearedValue:void 0;G!==void 0&&Q[K.nome]!==G&&I(K.nome,G,{shouldValidate:!1})}for(const{container:H,fields:K}of q){const G=H.nome,Y=Array.isArray(Q[G])?Q[G]:[];for(let Z=0;Z<Y.length;Z++){const te=Y[Z];for(const ue of K)if(!Ke(ue.condicional,te,n)&&(A(`${G}.${Z}.${ue.nome}`),ue.clearedValue!==void 0)){const ve=ue.clearedValue??"";te[ue.nome]!==ve&&I(`${G}.${Z}.${ue.nome}`,ve,{shouldValidate:!1})}}}const ee=X.current;for(const H of B){const K=Ke(H.condicional,Q,n),G=ee?K:W.current[H.nome]??!1;if(K&&!G&&(U=H.setValues)!=null&&U.length)for(const Y of H.setValues){const Z=typeof Y.valor=="string"?st(Y.valor,j):Y.valor;I(Y.campo,Z,{shouldValidate:!1})}W.current[H.nome]=K}X.current=!1},[V,M,B,T,q,n,I,A]);const P=N.icone?wt[N.icone]:void 0,se=k.useMemo(()=>()=>{S.handleSubmit(u)()},[u]);return a.jsx(Se.FormProvider,{...S,children:a.jsx(sw,{value:{submitting:l,warnings:w,requestSubmit:se},children:a.jsx("form",{onSubmit:C(u),noValidate:!0,onKeyDown:U=>{U.key==="Enter"&&U.target.tagName==="INPUT"&&U.preventDefault()},children:a.jsxs("div",{className:"space-y-6",children:[N.showLabel!==!1&&a.jsxs("div",{className:"text-center space-y-2",children:[P&&a.jsx("div",{className:"w-12 h-12 mx-auto rounded-xl flex items-center justify-center",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:a.jsx(P,{className:"w-6 h-6",style:{color:"var(--t-primary)"}})}),a.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:N.titulo}),N.descricao&&a.jsx("p",{className:"text-sm text-muted-foreground",children:N.descricao})]}),a.jsx(bp,{step:N,control:$,externalData:n}),a.jsxs("div",{className:"flex items-center justify-between gap-4 pt-6 pb-2",children:[a.jsxs($e,{type:"button",variant:"outline",onClick:h,disabled:e===0,className:J(e>0&&"border-primary/40 text-primary hover:bg-primary/5"),children:[a.jsx(O.ChevronLeft,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Anterior"})]}),a.jsxs("span",{className:"text-xs font-semibold tabular-nums sm:hidden text-muted-foreground",children:[e+1,"/",t]}),a.jsxs($e,{type:"submit",disabled:l,children:[l?a.jsx(O.Loader2,{className:"w-4 h-4 animate-spin"}):p?a.jsx(O.Check,{className:"w-4 h-4"}):a.jsx(O.ChevronRight,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:p?"Finalizar":"Próximo"})]})]}),i&&a.jsx("p",{className:"text-sm text-destructive mt-2 text-center",children:i})]})})})})},uo=e=>{if(e)return wt[e]},dw=({steps:e,currentStep:t,onStepClick:r})=>a.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((o,n)=>a.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(n),onKeyDown:s=>s.key==="Enter"&&(r==null?void 0:r(n)),className:J("w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:n===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:n<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:n<t?a.jsx(O.Check,{className:"w-4 h-4"}):n+1},o.id))}),uw=({steps:e,currentStep:t,onStepClick:r})=>a.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((o,n)=>{const s=uo(o.icone)??O.CircleDot;return a.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(n),onKeyDown:l=>l.key==="Enter"&&(r==null?void 0:r(n)),className:J("w-9 h-9 rounded-full flex items-center justify-center transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:n===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:n<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:n<t?a.jsx(O.Check,{className:"w-4 h-4"}):a.jsx(s,{className:"w-4 h-4"})},o.id)})}),mw=({steps:e,currentStep:t,position:r,orientation:o="horizontal",onStepClick:n})=>o==="vertical"?a.jsx("div",{className:"flex flex-col gap-0",children:e.map((s,l)=>{const i=uo(s.icone)??O.CircleDot,c=l===t,d=l<t,m=l===e.length-1;return a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsxs("div",{className:"flex flex-col items-center",children:[a.jsx("button",{type:"button",onClick:()=>n==null?void 0:n(l),className:J("w-8 h-8 rounded-full flex items-center justify-center transition-all shrink-0",n&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#fff",boxShadow:"0 0 10px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#fff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?a.jsx(O.Check,{className:"w-3.5 h-3.5"}):a.jsx(i,{className:"w-3.5 h-3.5"})}),!m&&a.jsx("div",{className:"w-[2px] my-1",style:{height:"24px",background:d?"#22c55e":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]}),a.jsx("span",{className:"text-sm font-medium leading-tight mt-1.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]},s.id)})}):a.jsx("div",{className:"w-full flex items-start",children:e.map((s,l)=>{const i=uo(s.icone)??O.CircleDot,c=l===t,d=l<t,m=l===e.length-1;return a.jsxs("div",{className:J("flex items-start",!m&&"flex-1"),children:[a.jsxs("div",{className:"flex flex-col items-center gap-1.5 w-[56px] shrink-0 mx-auto",children:[a.jsx("button",{type:"button",onClick:()=>n==null?void 0:n(l),className:J("w-10 h-10 rounded-full flex items-center justify-center transition-all shrink-0",n&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 12px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#ffffff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?a.jsx(O.Check,{className:"w-4 h-4"}):a.jsx(i,{className:"w-4 h-4"})}),a.jsx("span",{className:"text-[10px] font-medium text-center leading-tight line-clamp-2 px-0.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]}),!m&&a.jsx("div",{className:"flex-1 h-[1.5px] mt-5 mx-1",style:{background:d?"linear-gradient(90deg, var(--t-primary), color-mix(in srgb, var(--t-primary) 40%, transparent))":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]},s.id)})}),jp=({steps:e,currentStep:t,onStepClick:r,className:o,forceShow:n})=>{const s=ba(),{layout:l}=s;if(!l.showStepIndicators||e.length<=1&&!n)return null;const i=l.stepIndicatorVariant??"numbers",c=l.stepIndicatorPosition??"top-center",d=l.stepIndicatorOrientation??"horizontal",m=(t+1)/e.length*100,u=e[t],h=uo(u==null?void 0:u.icone)??O.CircleDot,p=a.jsx("div",{className:"h-1 rounded-full overflow-hidden",style:{background:"color-mix(in srgb, var(--t-primary) 15%, transparent)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${m}%`,background:"linear-gradient(90deg, var(--t-primary), var(--t-accent))"}})}),y=a.jsxs("div",{className:"block sm:hidden space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:{background:"var(--t-primary)",color:"#fff"},children:a.jsx(h,{className:"w-5 h-5"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-semibold leading-tight truncate",style:{color:"var(--t-text)"},children:(u==null?void 0:u.label)??(u==null?void 0:u.id)}),a.jsxs("p",{className:"text-xs leading-tight",style:{color:"var(--t-text-muted)"},children:["Passo ",t+1," de ",e.length]})]})]}),p]}),f=a.jsxs("div",{className:"hidden sm:block",children:[i==="numbers"&&a.jsx(dw,{steps:e,currentStep:t,onStepClick:r}),i==="icons"&&a.jsx(uw,{steps:e,currentStep:t,onStepClick:r}),i==="icons-labeled"&&a.jsx(mw,{steps:e,currentStep:t,position:c,orientation:d,onStepClick:r})]}),g=l.showProgressBar?a.jsx("div",{className:"hidden sm:block",children:p}):null;return d==="vertical"?a.jsxs("div",{className:J("flex gap-6 items-start",o),children:[y,a.jsxs("div",{className:"hidden sm:flex gap-6 items-start shrink-0",children:[f,g&&a.jsx("div",{className:"flex-1 pt-4",children:g})]})]}):a.jsxs("div",{className:J("space-y-3",o),children:[y,a.jsxs("div",{className:"hidden sm:block space-y-3",children:[f,g]})]})},pw=(e,t,r)=>{var o;const n={...t},s=r;for(const l of e.containers){for(const i of l.campos)if(n[i.nome]===void 0&&(i.initialValue!==void 0?n[i.nome]=typeof i.initialValue=="string"?st(i.initialValue,s):i.initialValue:i.defaultValue!==void 0&&(n[i.nome]=i.defaultValue)),i.tipo===_.FIELD_ARRAY&&(o=i.subFields)!=null&&o.length){const c=n[i.nome];Array.isArray(c)&&c.length>0&&(n[i.nome]=c.map(d=>{const m={...d};for(const u of i.subFields)m[u.nome]===void 0&&(u.initialValue!==void 0?m[u.nome]=typeof u.initialValue=="string"?st(u.initialValue,s):u.initialValue:u.defaultValue!==void 0&&(m[u.nome]=u.defaultValue));return m}))}if(l.repeatable&&l.nome){const i=n[l.nome];Array.isArray(i)&&i.length>0&&(n[l.nome]=i.map(c=>{const d={...c};for(const m of l.campos)d[m.nome]===void 0&&(m.initialValue!==void 0?d[m.nome]=typeof m.initialValue=="string"?st(m.initialValue,s):m.initialValue:m.defaultValue!==void 0&&(d[m.nome]=m.defaultValue));return d}))}}return n},fw=({schema:e,initialValues:t={},initialStep:r=0,onSubmitStep:o,onComplete:n,template:s,formTitle:l,externalData:i={},fieldErrors:c={},uploadFile:d,cepLookup:m,resolveTermsUploadUrl:u,fieldResolvers:h,validatorMapper:p,componentMapper:y,paymentMethodOptions:f,onValuesChange:g,className:w,StepIndicator:v=jp})=>{const[b,j]=k.useState(()=>r),[N,S]=k.useState({...t}),[$,C]=k.useState(()=>r),[E,A]=k.useState(!1),[I,M]=k.useState(null),[T,B]=k.useState({}),q=k.useMemo(()=>JSON.stringify(i),[i]),W=k.useMemo(()=>JSON.stringify(e.stepConfig),[e.stepConfig]),X=k.useMemo(()=>{const Y=yo(s);return e.stepConfig?{...Y,layout:{...Y.layout,...e.stepConfig}}:Y},[s,W]),V=k.useMemo(()=>[...e.steps].sort((Y,Z)=>Y.ordem-Z.ordem),[e.steps]),L=V.length,P=L>0?V[Math.min(b,L-1)]:null,se=k.useMemo(()=>P?pw(P,N,i):{},[P,N,q]),U=k.useMemo(()=>({uploadFile:d,cepLookup:m,resolveTermsUploadUrl:u,externalData:i,fieldResolvers:h,validatorMapper:p,fieldWarnings:T,componentMapper:y,paymentMethodOptions:f}),[d,m,u,h,p,T,y,f,q]),Q=k.useCallback(async Y=>{if(!E){A(!0),M(null);try{const Z={...N,...Y};if(S(Z),o&&await o(b,Y),b===L-1)n&&await n(Z);else{const te=b+1;j(te),C(ue=>Math.max(ue,te))}}catch(Z){console.error("[FormRenderer] Submit error:",Z);const te=Z instanceof Error?Z.message:"Ocorreu um erro. Tente novamente.";M(te)}finally{A(!1)}}},[b,N,E,L,o,n]),ee=k.useCallback(()=>{b>0&&j(Y=>Y-1)},[b]);if(!P)return a.jsx(co.Provider,{value:U,children:a.jsx(pa,{config:X,className:`min-h-dvh ${X.wrapperClass??""} ${w??""}`,renderWrapper:!0,children:a.jsx("div",{className:"w-full max-w-4xl mx-auto px-4 py-6 sm:px-6 text-center text-muted-foreground",children:"Nenhum step configurado."})})});const H=X.layout.eventTitleStyle??"bar",K=(X.layout.stepIndicatorOrientation??"horizontal")==="vertical",G=L>=1?a.jsx(v,{steps:V.map(Y=>({id:Y.id,label:Y.titulo,icone:Y.icone})),currentStep:b,onStepClick:Y=>{Y!==b&&Y<=$&&j(Y)}}):null;return a.jsx(co.Provider,{value:U,children:a.jsx(pa,{config:X,className:`min-h-dvh ${X.wrapperClass??""} ${w??""}`,renderWrapper:!0,children:a.jsxs("div",{className:"w-full max-w-4xl mx-auto px-4 py-6 sm:px-6",children:[l&&H==="bar"&&a.jsx("div",{className:"w-full text-center text-sm font-medium py-2.5 px-4 mb-6 rounded-lg border border-input text-muted-foreground bg-muted/30",children:l}),l&&H==="inline"&&a.jsxs("div",{className:"text-center mb-6",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest mb-1",style:{color:"var(--t-text-muted)"},children:"Inscrição"}),a.jsx("h1",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:l}),a.jsx("div",{className:"h-0.5 w-12 mx-auto mt-3 rounded-full",style:{background:"var(--t-primary)"}})]}),K?a.jsxs("div",{className:"flex gap-6 items-start",children:[a.jsx("div",{className:"hidden sm:block shrink-0 w-44 pt-1",children:G}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"sm:hidden mb-6",children:G}),a.jsx(_i,{stepIndex:b,totalSteps:L,step:P,defaultValues:se,externalData:i,fieldErrors:c,isSubmitting:E,submitError:I,validatorMapper:p,onWarningsChange:B,onValuesChange:g,onSubmit:Q,onBack:ee},b)]})]}):a.jsxs(a.Fragment,{children:[G&&a.jsx("div",{className:"mb-8",children:G}),a.jsx(_i,{stepIndex:b,totalSteps:L,step:P,defaultValues:se,externalData:i,fieldErrors:c,isSubmitting:E,submitError:I,validatorMapper:p,onWarningsChange:B,onValuesChange:g,onSubmit:Q,onBack:ee},b)]})]})})})},hw=({children:e,render:t,onChange:r})=>{const o=yp(),n=k.useRef(r);return n.current=r,k.useEffect(()=>{var s;(s=n.current)==null||s.call(n,o)},[o.values,o.dirty,o.valid,o.submitting,o.errors,o.warnings]),t?a.jsx(a.Fragment,{children:t(o)}):typeof e=="function"?a.jsx(a.Fragment,{children:e(o)}):e!==void 0?a.jsx(a.Fragment,{children:e}):null},dr=[{component:"texto",label:"Texto",icon:O.Type,group:"texto"},{component:"textarea",label:"Área de texto",icon:O.AlignLeft,group:"texto"},{component:"number",label:"Número",icon:O.Hash,group:"texto"},{component:"email",label:"E-mail",icon:O.Mail,group:"texto"},{component:"password",label:"Senha",icon:O.Lock,group:"texto"},{component:"select",label:"Seleção",icon:O.ChevronDown,group:"selecao"},{component:"autocomplete",label:"Autocomplete",icon:O.Search,group:"selecao"},{component:"radio",label:"Radio",icon:O.CircleDot,group:"selecao"},{component:"checkbox",label:"Checkbox",icon:O.CheckSquare,group:"selecao"},{component:"checkbox_group",label:"Grupo de checkboxes",icon:O.ListChecks,group:"selecao"},{component:"switch",label:"Switch (toggle)",icon:O.ToggleLeft,group:"selecao"},{component:"slider",label:"Slider",icon:O.SlidersHorizontal,group:"range"},{component:"rating",label:"Avaliação (estrelas)",icon:O.Star,group:"range"},{component:"color",label:"Cor",icon:O.Palette,group:"range"},{component:"date",label:"Data",icon:O.Calendar,group:"data"},{component:"datetime",label:"Data e hora",icon:O.Clock,group:"data"},{component:"time",label:"Horário",icon:O.Timer,group:"data"},{component:"date_range",label:"Período",icon:O.CalendarRange,group:"data"},{component:"telefone",label:"Telefone",icon:O.Phone,group:"contato"},{component:"cpf",label:"CPF",icon:O.CreditCard,group:"contato"},{component:"cep",label:"CEP",icon:O.MapPin,group:"contato"},{component:"file",label:"Arquivo",icon:O.Upload,group:"outros"},{component:"hidden",label:"Oculto",icon:O.EyeOff,group:"outros"},{component:"field_array",label:"Lista de itens",icon:O.List,group:"outros"},{component:"terms",label:"Termos e condições",icon:O.ScrollText,group:"outros"},{component:"sub_form",label:"Sub-formulário",icon:O.LayoutList,group:"outros"}],pl=[{component:"step",label:"Step",icon:O.Layers,color:"border-primary/40 bg-primary/5"},{component:"container",label:"Container",icon:O.BoxSelect,color:"border-blue-500/40 bg-blue-500/5"}],fl=[{key:"evento.nome",label:"Nome do evento",type:"string"},{key:"evento.descricao",label:"Descrição",type:"string"},{key:"evento.valor",label:"Valor (centavos)",type:"number"},{key:"evento.valorPorDia",label:"Valor por dia",type:"number"},{key:"evento.vagasTotal",label:"Vagas totais",type:"number"},{key:"evento.vagasPorDia",label:"Vagas por dia",type:"number"},{key:"evento.vagasMasculinas",label:"Vagas masculinas",type:"number"},{key:"evento.vagasFemininas",label:"Vagas femininas",type:"number"},{key:"evento.dataInicioEvento",label:"Data início",type:"date"},{key:"evento.dataFimEvento",label:"Data fim",type:"date"},{key:"evento.dataAberturaInscricoes",label:"Abertura inscrições",type:"date"},{key:"evento.localNome",label:"Local - Nome",type:"string"},{key:"evento.localEndereco",label:"Local - Endereço",type:"string"},{key:"evento.localTelefone",label:"Local - Telefone",type:"string"},{key:"evento.localMapUrl",label:"Local - URL do mapa",type:"string"},{key:"evento.localMapLink",label:"Local - Link do mapa",type:"string"},{key:"evento.status",label:"Status do evento",type:"string"},{key:"evento.publicId",label:"ID público (URL)",type:"string"},{key:"evento.fotoCapa",label:"URL da foto de capa",type:"string"},{key:"evento.template",label:"Template visual",type:"string"}],Ve=e=>e.startsWith("step-")||e==="step"?"step":e.startsWith("container-")||e==="container"?"container":"field",xw=e=>dr.find(t=>t.component===e),Np=e=>{const t=dr.map(o=>o.component).filter(o=>o.includes("_"));for(const o of t)if(e.startsWith(o))return dr.find(n=>n.component===o);const r=e.split("-")[0];return dr.find(o=>o.component===r)},Cp=k.createContext(null),gw=e=>{if(e.startsWith("step"))return"step";if(e.startsWith("container"))return"container";const t=e.match(/^([a-z_]+)-/);return t?t[1]:e.split("-")[0]},$n=(e,t)=>{const r=t||gw(e),o=r==="step",n=r==="container",s=r==="field_array";return{label:o?"Novo Step":n?"Novo Container":s?"Lista de itens":r||e,name:e,fieldType:r||"texto",required:!1,columns:2,tamanho:n||s?12:o?void 0:6,showLabel:n?!0:void 0,itemLabel:s?"Item":void 0}},En=e=>typeof structuredClone=="function"?{containers:structuredClone(e.containers),configs:structuredClone(e.configs)}:{containers:JSON.parse(JSON.stringify(e.containers)),configs:JSON.parse(JSON.stringify(e.configs))},kp=(e,t)=>{const r=[e],o=t[e];if(o!=null&&o.children)for(const n of o.children)r.push(...kp(n,t));return r},hl=(e,t)=>{for(const[r,o]of Object.entries(t))if(o.children.includes(e))return r;return null},Sp=({children:e,initialConfigs:t,initialContainers:r,initialTemplateId:o,initialStepConfig:n,schemaId:s,uploadTermsPdf:l,deleteTermsPdf:i})=>{const[c,d]=k.useState({selectedId:null,configs:t||{},showPreview:!1,containers:r??{root:{children:[]}},previewTemplateId:o||"moderno",stepConfig:n??{}}),[m,u]=k.useState(null),[h,p]=k.useState(null),y=k.useRef([]),f=k.useRef([]),g=L=>{y.current=[...y.current.slice(-49),En(L)],f.current=[]},w=k.useCallback(()=>{d(L=>(g(L),{...L}))},[]),v=k.useCallback(()=>{y.current.length!==0&&d(L=>{f.current=[...f.current,En(L)];const P=y.current.pop();return{...L,containers:P.containers,configs:P.configs}})},[]),b=k.useCallback(()=>{f.current.length!==0&&d(L=>{y.current=[...y.current,En(L)];const P=f.current.pop();return{...L,containers:P.containers,configs:P.configs}})},[]);k.useEffect(()=>{const L=P=>{const se=P.metaKey||P.ctrlKey;se&&P.key==="z"&&!P.shiftKey&&(P.preventDefault(),v()),se&&P.key==="z"&&P.shiftKey&&(P.preventDefault(),b()),se&&P.key==="y"&&(P.preventDefault(),b())};return window.addEventListener("keydown",L),()=>window.removeEventListener("keydown",L)},[v,b]);const j=k.useCallback(L=>c.configs[L]??$n(L),[c.configs]),N=k.useCallback(()=>{const L=[],P=se=>{var U;const Q=((U=c.containers[se])==null?void 0:U.children)??[];for(const ee of Q)Ve(ee)==="field"?L.push(ee):c.containers[ee]&&P(ee)};return P("root"),L},[c.containers]),S=k.useCallback(L=>{d(P=>({...P,selectedId:L}))},[]),$=k.useCallback(L=>{d(P=>({...P,showPreview:L}))},[]),C=k.useCallback(L=>{d(P=>({...P,previewTemplateId:L}))},[]),E=k.useCallback(L=>{d(P=>({...P,stepConfig:{...P.stepConfig,...L}}))},[]),A=k.useCallback((L,P)=>{d(se=>({...se,configs:{...se.configs,[L]:{...se.configs[L]??$n(L),...P}}}))},[]),I=k.useCallback((L,P,se)=>{const U=`${L}-${pt()}`,Q=Ve(U);return d(ee=>{var H;g(ee);const K={...ee.containers};(Q==="step"||Q==="container"||L==="field_array")&&(K[U]={children:[]});const G=[...((H=K[P])==null?void 0:H.children)??[]];return se!==void 0&&se>=0?G.splice(se,0,U):G.push(U),K[P]={children:G},{...ee,containers:K,configs:{...ee.configs,[U]:$n(U,L)},selectedId:U}}),U},[]),M=k.useCallback((L,P)=>{const se=`container-${pt()}`;return d(U=>{var Q,ee,H;g(U);const K={...U.containers},G={...U.configs},Y=[];for(const te of L.containerTemplate.campos){const ue=te.locked&&te.id?te.id:`${String(te.tipo).toLowerCase()}-${pt()}`;if(Y.push(ue),G[ue]={label:te.label,name:te.locked?te.id:te.nome,fieldType:te.tipo,required:te.obrigatorio||!1,placeholder:te.placeholder,hint:te.hint,tamanho:te.tamanho||6,inicioColuna:te.inicioColuna,defaultValue:te.defaultValue!=null?String(te.defaultValue):void 0,locked:te.locked||!1,options:(Q=te.opcoes)==null?void 0:Q.map(ve=>({value:ve.valor,label:ve.label})),...te.tipo==="field_array"&&{itemLabel:te.itemLabel,minItems:te.minItems,maxItems:te.maxItems,addLabel:te.addLabel}},te.tipo==="field_array"){const ve=[];for(const Ne of te.subFields??[]){const ye=`${String(Ne.tipo).toLowerCase()}-${pt()}`;ve.push(ye),G[ye]={label:Ne.label,name:Ne.nome,fieldType:Ne.tipo,required:Ne.obrigatorio||!1,placeholder:Ne.placeholder,hint:Ne.hint,tamanho:Ne.tamanho||6,inicioColuna:Ne.inicioColuna,options:(ee=Ne.opcoes)==null?void 0:ee.map(Be=>({value:Be.valor,label:Be.label}))}}K[ue]={children:ve}}}K[se]={children:Y},G[se]={label:L.containerTemplate.titulo||L.name,description:L.containerTemplate.descricao,icone:L.containerTemplate.icone,tamanho:L.containerTemplate.tamanho||12,inicioColuna:L.containerTemplate.inicioColuna,showLabel:!0};const Z=[...((H=K[P])==null?void 0:H.children)??[]];return Z.push(se),K[P]={children:Z},{...U,containers:K,configs:G,selectedId:se}}),se},[]),T=k.useCallback(L=>{const P=[];return d(se=>{var U,Q,ee;g(se);const H={...se.containers},K={...se.configs};for(const G of L.steps){const Y=`step-${pt()}`;P.push(Y);const Z=[];for(const ue of G.containers){const ve=`container-${pt()}`;Z.push(ve);const Ne=[];for(const ye of ue.campos){const Be=ye.locked&&ye.id?ye.id:`${String(ye.tipo).toLowerCase()}-${pt()}`;if(Ne.push(Be),K[Be]={label:ye.label,name:ye.locked?ye.id:ye.nome,fieldType:ye.tipo,required:ye.obrigatorio||!1,placeholder:ye.placeholder,hint:ye.hint,tamanho:ye.tamanho||12,inicioColuna:ye.inicioColuna,defaultValue:ye.defaultValue!=null?String(ye.defaultValue):void 0,locked:ye.locked||!1,options:(U=ye.opcoes)==null?void 0:U.map(Ue=>({value:Ue.valor,label:Ue.label})),...ye.tipo==="field_array"&&{itemLabel:ye.itemLabel,minItems:ye.minItems,maxItems:ye.maxItems,addLabel:ye.addLabel}},ye.tipo==="field_array"){const Ue=[];for(const Je of ye.subFields??[]){const qt=`${String(Je.tipo).toLowerCase()}-${pt()}`;Ue.push(qt),K[qt]={label:Je.label,name:Je.nome,fieldType:Je.tipo,required:Je.obrigatorio||!1,placeholder:Je.placeholder,hint:Je.hint,tamanho:Je.tamanho||6,inicioColuna:Je.inicioColuna,options:(Q=Je.opcoes)==null?void 0:Q.map(rt=>({value:rt.valor,label:rt.label}))}}H[Be]={children:Ue}}}H[ve]={children:Ne},K[ve]={label:ue.titulo,description:ue.descricao,icone:ue.icone,tamanho:ue.tamanho||12,showLabel:!0}}H[Y]={children:Z},K[Y]={label:G.titulo,description:G.descricao,icone:G.icone};const te=[...((ee=H.root)==null?void 0:ee.children)??[],Y];H.root={children:te}}return{...se,containers:H,configs:K,selectedId:P[0]??se.selectedId}}),P},[]),B=k.useCallback((L,P,se,U)=>{d(Q=>{var ee,H;g(Q);const K={...Q.containers},G=(((ee=K[P])==null?void 0:ee.children)??[]).filter(te=>te!==L);K[P]={children:G};const Y=[...(((H=K[se])==null?void 0:H.children)??[]).filter(te=>te!==L)],Z=Math.max(0,Math.min(U,Y.length));return Y.splice(Z,0,L),K[se]={children:Y},{...Q,containers:K}})},[]),q=k.useCallback((L,P)=>{d(se=>(g(se),{...se,containers:{...se.containers,[L]:{children:P}}}))},[]),W=k.useCallback(L=>{d(P=>{g(P);const se=kp(L,P.containers),U={};for(const[ee,H]of Object.entries(P.containers))se.includes(ee)||(U[ee]={children:H.children.filter(K=>!se.includes(K))});const Q={...P.configs};for(const ee of se)delete Q[ee];return{...P,containers:U,configs:Q,selectedId:se.includes(P.selectedId??"")?null:P.selectedId}})},[]),X=k.useCallback((L,P)=>{d(se=>{const U=hl(L,se.containers);if(!U)return se;const Q=[...se.containers[U].children],ee=Q.indexOf(L),H=P==="up"?ee-1:ee+1;return H<0||H>=Q.length?se:([Q[ee],Q[H]]=[Q[H],Q[ee]],{...se,containers:{...se.containers,[U]:{children:Q}}})})},[]),V=k.useCallback((L,P)=>{w(),X(L,P)},[X,w]);return a.jsx(Cp.Provider,{value:{selectedId:c.selectedId,configs:c.configs,showPreview:c.showPreview,containers:c.containers,positionDrag:m,reorderDrag:h,canUndo:y.current.length>0,canRedo:f.current.length>0,schemaId:s,uploadTermsPdf:l,deleteTermsPdf:i,previewTemplateId:c.previewTemplateId,setPreviewTemplateId:C,stepConfig:c.stepConfig,updateStepConfig:E,getConfig:j,getAllFieldIds:N,setSelected:S,updateConfig:A,setShowPreview:$,addItem:I,addPresetBlock:M,addPresetStepBlock:T,moveCanvasItem:B,reorderInContainer:q,removeItem:W,moveItem:V,moveItemNoSnapshot:X,setPositionDrag:u,setReorderDrag:p,undo:v,redo:b,pushSnapshot:w},children:e})},mt=()=>{const e=k.useContext(Cp);if(!e)throw new Error("useBuilder must be inside BuilderProvider");return e};function $p(e){var t,r,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(t=0;t<n;t++)e[t]&&(r=$p(e[t]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function vw(){for(var e,t,r=0,o="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=$p(e))&&(o&&(o+=" "),o+=t);return o}const bw=(e,t)=>{const r=new Array(e.length+t.length);for(let o=0;o<e.length;o++)r[o]=e[o];for(let o=0;o<t.length;o++)r[e.length+o]=t[o];return r},yw=(e,t)=>({classGroupId:e,validator:t}),Ep=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),mo="-",Ti=[],ww="arbitrary..",jw=e=>{const t=Cw(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:n=>{if(n.startsWith("[")&&n.endsWith("]"))return Nw(n);const s=n.split(mo),l=s[0]===""&&s.length>1?1:0;return Ap(s,l,t)},getConflictingClassGroupIds:(n,s)=>{if(s){const l=o[n],i=r[n];return l?i?bw(i,l):l:i||Ti}return r[n]||Ti}}},Ap=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const o=e[t],n=r.nextPart.get(o);if(n){const c=Ap(e,t+1,n);if(c)return c}const s=r.validators;if(s===null)return;const l=t===0?e.join(mo):e.slice(t).join(mo),i=s.length;for(let c=0;c<i;c++){const d=s[c];if(d.validator(l))return d.classGroupId}},Nw=e=>e.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),o=t.slice(0,r);return o?ww+o:void 0})(),Cw=e=>{const{theme:t,classGroups:r}=e;return kw(r,t)},kw=(e,t)=>{const r=Ep();for(const o in e){const n=e[o];xl(n,r,o,t)}return r},xl=(e,t,r,o)=>{const n=e.length;for(let s=0;s<n;s++){const l=e[s];Sw(l,t,r,o)}},Sw=(e,t,r,o)=>{if(typeof e=="string"){$w(e,t,r);return}if(typeof e=="function"){Ew(e,t,r,o);return}Aw(e,t,r,o)},$w=(e,t,r)=>{const o=e===""?t:_p(t,e);o.classGroupId=r},Ew=(e,t,r,o)=>{if(_w(e)){xl(e(o),t,r,o);return}t.validators===null&&(t.validators=[]),t.validators.push(yw(r,e))},Aw=(e,t,r,o)=>{const n=Object.entries(e),s=n.length;for(let l=0;l<s;l++){const[i,c]=n[l];xl(c,_p(t,i),r,o)}},_p=(e,t)=>{let r=e;const o=t.split(mo),n=o.length;for(let s=0;s<n;s++){const l=o[s];let i=r.nextPart.get(l);i||(i=Ep(),r.nextPart.set(l,i)),r=i}return r},_w=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,Tw=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),o=Object.create(null);const n=(s,l)=>{r[s]=l,t++,t>e&&(t=0,o=r,r=Object.create(null))};return{get(s){let l=r[s];if(l!==void 0)return l;if((l=o[s])!==void 0)return n(s,l),l},set(s,l){s in r?r[s]=l:n(s,l)}}},ls="!",Ri=":",Rw=[],Di=(e,t,r,o,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:o,isExternal:n}),Dw=e=>{const{prefix:t,experimentalParseClassName:r}=e;let o=n=>{const s=[];let l=0,i=0,c=0,d;const m=n.length;for(let f=0;f<m;f++){const g=n[f];if(l===0&&i===0){if(g===Ri){s.push(n.slice(c,f)),c=f+1;continue}if(g==="/"){d=f;continue}}g==="["?l++:g==="]"?l--:g==="("?i++:g===")"&&i--}const u=s.length===0?n:n.slice(c);let h=u,p=!1;u.endsWith(ls)?(h=u.slice(0,-1),p=!0):u.startsWith(ls)&&(h=u.slice(1),p=!0);const y=d&&d>c?d-c:void 0;return Di(s,p,h,y)};if(t){const n=t+Ri,s=o;o=l=>l.startsWith(n)?s(l.slice(n.length)):Di(Rw,!1,l,void 0,!0)}if(r){const n=o;o=s=>r({className:s,parseClassName:n})}return o},Pw=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,o)=>{t.set(r,1e6+o)}),r=>{const o=[];let n=[];for(let s=0;s<r.length;s++){const l=r[s],i=l[0]==="[",c=t.has(l);i||c?(n.length>0&&(n.sort(),o.push(...n),n=[]),o.push(l)):n.push(l)}return n.length>0&&(n.sort(),o.push(...n)),o}},Ow=e=>({cache:Tw(e.cacheSize),parseClassName:Dw(e),sortModifiers:Pw(e),...jw(e)}),Iw=/\s+/,Fw=(e,t)=>{const{parseClassName:r,getClassGroupId:o,getConflictingClassGroupIds:n,sortModifiers:s}=t,l=[],i=e.trim().split(Iw);let c="";for(let d=i.length-1;d>=0;d-=1){const m=i[d],{isExternal:u,modifiers:h,hasImportantModifier:p,baseClassName:y,maybePostfixModifierPosition:f}=r(m);if(u){c=m+(c.length>0?" "+c:c);continue}let g=!!f,w=o(g?y.substring(0,f):y);if(!w){if(!g){c=m+(c.length>0?" "+c:c);continue}if(w=o(y),!w){c=m+(c.length>0?" "+c:c);continue}g=!1}const v=h.length===0?"":h.length===1?h[0]:s(h).join(":"),b=p?v+ls:v,j=b+w;if(l.indexOf(j)>-1)continue;l.push(j);const N=n(w,g);for(let S=0;S<N.length;++S){const $=N[S];l.push(b+$)}c=m+(c.length>0?" "+c:c)}return c},Lw=(...e)=>{let t=0,r,o,n="";for(;t<e.length;)(r=e[t++])&&(o=Tp(r))&&(n&&(n+=" "),n+=o);return n},Tp=e=>{if(typeof e=="string")return e;let t,r="";for(let o=0;o<e.length;o++)e[o]&&(t=Tp(e[o]))&&(r&&(r+=" "),r+=t);return r},Mw=(e,...t)=>{let r,o,n,s;const l=c=>{const d=t.reduce((m,u)=>u(m),e());return r=Ow(d),o=r.cache.get,n=r.cache.set,s=i,i(c)},i=c=>{const d=o(c);if(d)return d;const m=Fw(c,r);return n(c,m),m};return s=l,(...c)=>s(Lw(...c))},Vw=[],Ge=e=>{const t=r=>r[e]||Vw;return t.isThemeGetter=!0,t},Rp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Dp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,zw=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Bw=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Uw=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Hw=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ww=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,qw=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,or=e=>zw.test(e),ke=e=>!!e&&!Number.isNaN(Number(e)),nr=e=>!!e&&Number.isInteger(Number(e)),An=e=>e.endsWith("%")&&ke(e.slice(0,-1)),Gt=e=>Bw.test(e),Pp=()=>!0,Xw=e=>Uw.test(e)&&!Hw.test(e),gl=()=>!1,Gw=e=>Ww.test(e),Kw=e=>qw.test(e),Yw=e=>!pe(e)&&!he(e),Zw=e=>gr(e,Fp,gl),pe=e=>Rp.test(e),jr=e=>gr(e,Lp,Xw),Pi=e=>gr(e,nj,ke),Jw=e=>gr(e,Vp,Pp),Qw=e=>gr(e,Mp,gl),Oi=e=>gr(e,Op,gl),ej=e=>gr(e,Ip,Kw),Ha=e=>gr(e,zp,Gw),he=e=>Dp.test(e),da=e=>Tr(e,Lp),tj=e=>Tr(e,Mp),Ii=e=>Tr(e,Op),rj=e=>Tr(e,Fp),aj=e=>Tr(e,Ip),Wa=e=>Tr(e,zp,!0),oj=e=>Tr(e,Vp,!0),gr=(e,t,r)=>{const o=Rp.exec(e);return o?o[1]?t(o[1]):r(o[2]):!1},Tr=(e,t,r=!1)=>{const o=Dp.exec(e);return o?o[1]?t(o[1]):r:!1},Op=e=>e==="position"||e==="percentage",Ip=e=>e==="image"||e==="url",Fp=e=>e==="length"||e==="size"||e==="bg-size",Lp=e=>e==="length",nj=e=>e==="number",Mp=e=>e==="family-name",Vp=e=>e==="number"||e==="weight",zp=e=>e==="shadow",sj=()=>{const e=Ge("color"),t=Ge("font"),r=Ge("text"),o=Ge("font-weight"),n=Ge("tracking"),s=Ge("leading"),l=Ge("breakpoint"),i=Ge("container"),c=Ge("spacing"),d=Ge("radius"),m=Ge("shadow"),u=Ge("inset-shadow"),h=Ge("text-shadow"),p=Ge("drop-shadow"),y=Ge("blur"),f=Ge("perspective"),g=Ge("aspect"),w=Ge("ease"),v=Ge("animate"),b=()=>["auto","avoid","all","avoid-page","page","left","right","column"],j=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],N=()=>[...j(),he,pe],S=()=>["auto","hidden","clip","visible","scroll"],$=()=>["auto","contain","none"],C=()=>[he,pe,c],E=()=>[or,"full","auto",...C()],A=()=>[nr,"none","subgrid",he,pe],I=()=>["auto",{span:["full",nr,he,pe]},nr,he,pe],M=()=>[nr,"auto",he,pe],T=()=>["auto","min","max","fr",he,pe],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],q=()=>["start","end","center","stretch","center-safe","end-safe"],W=()=>["auto",...C()],X=()=>[or,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...C()],V=()=>[or,"screen","full","dvw","lvw","svw","min","max","fit",...C()],L=()=>[or,"screen","full","lh","dvh","lvh","svh","min","max","fit",...C()],P=()=>[e,he,pe],se=()=>[...j(),Ii,Oi,{position:[he,pe]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Q=()=>["auto","cover","contain",rj,Zw,{size:[he,pe]}],ee=()=>[An,da,jr],H=()=>["","none","full",d,he,pe],K=()=>["",ke,da,jr],G=()=>["solid","dashed","dotted","double"],Y=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>[ke,An,Ii,Oi],te=()=>["","none",y,he,pe],ue=()=>["none",ke,he,pe],ve=()=>["none",ke,he,pe],Ne=()=>[ke,he,pe],ye=()=>[or,"full",...C()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Gt],breakpoint:[Gt],color:[Pp],container:[Gt],"drop-shadow":[Gt],ease:["in","out","in-out"],font:[Yw],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Gt],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Gt],shadow:[Gt],spacing:["px",ke],text:[Gt],"text-shadow":[Gt],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",or,pe,he,g]}],container:["container"],columns:[{columns:[ke,pe,he,i]}],"break-after":[{"break-after":b()}],"break-before":[{"break-before":b()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:N()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:E()}],"inset-x":[{"inset-x":E()}],"inset-y":[{"inset-y":E()}],start:[{"inset-s":E(),start:E()}],end:[{"inset-e":E(),end:E()}],"inset-bs":[{"inset-bs":E()}],"inset-be":[{"inset-be":E()}],top:[{top:E()}],right:[{right:E()}],bottom:[{bottom:E()}],left:[{left:E()}],visibility:["visible","invisible","collapse"],z:[{z:[nr,"auto",he,pe]}],basis:[{basis:[or,"full","auto",i,...C()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[ke,or,"auto","initial","none",pe]}],grow:[{grow:["",ke,he,pe]}],shrink:[{shrink:["",ke,he,pe]}],order:[{order:[nr,"first","last","none",he,pe]}],"grid-cols":[{"grid-cols":A()}],"col-start-end":[{col:I()}],"col-start":[{"col-start":M()}],"col-end":[{"col-end":M()}],"grid-rows":[{"grid-rows":A()}],"row-start-end":[{row:I()}],"row-start":[{"row-start":M()}],"row-end":[{"row-end":M()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":T()}],"auto-rows":[{"auto-rows":T()}],gap:[{gap:C()}],"gap-x":[{"gap-x":C()}],"gap-y":[{"gap-y":C()}],"justify-content":[{justify:[...B(),"normal"]}],"justify-items":[{"justify-items":[...q(),"normal"]}],"justify-self":[{"justify-self":["auto",...q()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...q(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...q(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...q(),"baseline"]}],"place-self":[{"place-self":["auto",...q()]}],p:[{p:C()}],px:[{px:C()}],py:[{py:C()}],ps:[{ps:C()}],pe:[{pe:C()}],pbs:[{pbs:C()}],pbe:[{pbe:C()}],pt:[{pt:C()}],pr:[{pr:C()}],pb:[{pb:C()}],pl:[{pl:C()}],m:[{m:W()}],mx:[{mx:W()}],my:[{my:W()}],ms:[{ms:W()}],me:[{me:W()}],mbs:[{mbs:W()}],mbe:[{mbe:W()}],mt:[{mt:W()}],mr:[{mr:W()}],mb:[{mb:W()}],ml:[{ml:W()}],"space-x":[{"space-x":C()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":C()}],"space-y-reverse":["space-y-reverse"],size:[{size:X()}],"inline-size":[{inline:["auto",...V()]}],"min-inline-size":[{"min-inline":["auto",...V()]}],"max-inline-size":[{"max-inline":["none",...V()]}],"block-size":[{block:["auto",...L()]}],"min-block-size":[{"min-block":["auto",...L()]}],"max-block-size":[{"max-block":["none",...L()]}],w:[{w:[i,"screen",...X()]}],"min-w":[{"min-w":[i,"screen","none",...X()]}],"max-w":[{"max-w":[i,"screen","none","prose",{screen:[l]},...X()]}],h:[{h:["screen","lh",...X()]}],"min-h":[{"min-h":["screen","lh","none",...X()]}],"max-h":[{"max-h":["screen","lh",...X()]}],"font-size":[{text:["base",r,da,jr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,oj,Jw]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",An,pe]}],"font-family":[{font:[tj,Qw,t]}],"font-features":[{"font-features":[pe]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[n,he,pe]}],"line-clamp":[{"line-clamp":[ke,"none",he,Pi]}],leading:[{leading:[s,...C()]}],"list-image":[{"list-image":["none",he,pe]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",he,pe]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:P()}],"text-color":[{text:P()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...G(),"wavy"]}],"text-decoration-thickness":[{decoration:[ke,"from-font","auto",he,jr]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[ke,"auto",he,pe]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:C()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",he,pe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",he,pe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:se()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:Q()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},nr,he,pe],radial:["",he,pe],conic:[nr,he,pe]},aj,ej]}],"bg-color":[{bg:P()}],"gradient-from-pos":[{from:ee()}],"gradient-via-pos":[{via:ee()}],"gradient-to-pos":[{to:ee()}],"gradient-from":[{from:P()}],"gradient-via":[{via:P()}],"gradient-to":[{to:P()}],rounded:[{rounded:H()}],"rounded-s":[{"rounded-s":H()}],"rounded-e":[{"rounded-e":H()}],"rounded-t":[{"rounded-t":H()}],"rounded-r":[{"rounded-r":H()}],"rounded-b":[{"rounded-b":H()}],"rounded-l":[{"rounded-l":H()}],"rounded-ss":[{"rounded-ss":H()}],"rounded-se":[{"rounded-se":H()}],"rounded-ee":[{"rounded-ee":H()}],"rounded-es":[{"rounded-es":H()}],"rounded-tl":[{"rounded-tl":H()}],"rounded-tr":[{"rounded-tr":H()}],"rounded-br":[{"rounded-br":H()}],"rounded-bl":[{"rounded-bl":H()}],"border-w":[{border:K()}],"border-w-x":[{"border-x":K()}],"border-w-y":[{"border-y":K()}],"border-w-s":[{"border-s":K()}],"border-w-e":[{"border-e":K()}],"border-w-bs":[{"border-bs":K()}],"border-w-be":[{"border-be":K()}],"border-w-t":[{"border-t":K()}],"border-w-r":[{"border-r":K()}],"border-w-b":[{"border-b":K()}],"border-w-l":[{"border-l":K()}],"divide-x":[{"divide-x":K()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":K()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...G(),"hidden","none"]}],"divide-style":[{divide:[...G(),"hidden","none"]}],"border-color":[{border:P()}],"border-color-x":[{"border-x":P()}],"border-color-y":[{"border-y":P()}],"border-color-s":[{"border-s":P()}],"border-color-e":[{"border-e":P()}],"border-color-bs":[{"border-bs":P()}],"border-color-be":[{"border-be":P()}],"border-color-t":[{"border-t":P()}],"border-color-r":[{"border-r":P()}],"border-color-b":[{"border-b":P()}],"border-color-l":[{"border-l":P()}],"divide-color":[{divide:P()}],"outline-style":[{outline:[...G(),"none","hidden"]}],"outline-offset":[{"outline-offset":[ke,he,pe]}],"outline-w":[{outline:["",ke,da,jr]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",m,Wa,Ha]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",u,Wa,Ha]}],"inset-shadow-color":[{"inset-shadow":P()}],"ring-w":[{ring:K()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:P()}],"ring-offset-w":[{"ring-offset":[ke,jr]}],"ring-offset-color":[{"ring-offset":P()}],"inset-ring-w":[{"inset-ring":K()}],"inset-ring-color":[{"inset-ring":P()}],"text-shadow":[{"text-shadow":["none",h,Wa,Ha]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[ke,he,pe]}],"mix-blend":[{"mix-blend":[...Y(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":Y()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[ke]}],"mask-image-linear-from-pos":[{"mask-linear-from":Z()}],"mask-image-linear-to-pos":[{"mask-linear-to":Z()}],"mask-image-linear-from-color":[{"mask-linear-from":P()}],"mask-image-linear-to-color":[{"mask-linear-to":P()}],"mask-image-t-from-pos":[{"mask-t-from":Z()}],"mask-image-t-to-pos":[{"mask-t-to":Z()}],"mask-image-t-from-color":[{"mask-t-from":P()}],"mask-image-t-to-color":[{"mask-t-to":P()}],"mask-image-r-from-pos":[{"mask-r-from":Z()}],"mask-image-r-to-pos":[{"mask-r-to":Z()}],"mask-image-r-from-color":[{"mask-r-from":P()}],"mask-image-r-to-color":[{"mask-r-to":P()}],"mask-image-b-from-pos":[{"mask-b-from":Z()}],"mask-image-b-to-pos":[{"mask-b-to":Z()}],"mask-image-b-from-color":[{"mask-b-from":P()}],"mask-image-b-to-color":[{"mask-b-to":P()}],"mask-image-l-from-pos":[{"mask-l-from":Z()}],"mask-image-l-to-pos":[{"mask-l-to":Z()}],"mask-image-l-from-color":[{"mask-l-from":P()}],"mask-image-l-to-color":[{"mask-l-to":P()}],"mask-image-x-from-pos":[{"mask-x-from":Z()}],"mask-image-x-to-pos":[{"mask-x-to":Z()}],"mask-image-x-from-color":[{"mask-x-from":P()}],"mask-image-x-to-color":[{"mask-x-to":P()}],"mask-image-y-from-pos":[{"mask-y-from":Z()}],"mask-image-y-to-pos":[{"mask-y-to":Z()}],"mask-image-y-from-color":[{"mask-y-from":P()}],"mask-image-y-to-color":[{"mask-y-to":P()}],"mask-image-radial":[{"mask-radial":[he,pe]}],"mask-image-radial-from-pos":[{"mask-radial-from":Z()}],"mask-image-radial-to-pos":[{"mask-radial-to":Z()}],"mask-image-radial-from-color":[{"mask-radial-from":P()}],"mask-image-radial-to-color":[{"mask-radial-to":P()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":j()}],"mask-image-conic-pos":[{"mask-conic":[ke]}],"mask-image-conic-from-pos":[{"mask-conic-from":Z()}],"mask-image-conic-to-pos":[{"mask-conic-to":Z()}],"mask-image-conic-from-color":[{"mask-conic-from":P()}],"mask-image-conic-to-color":[{"mask-conic-to":P()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:se()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:Q()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",he,pe]}],filter:[{filter:["","none",he,pe]}],blur:[{blur:te()}],brightness:[{brightness:[ke,he,pe]}],contrast:[{contrast:[ke,he,pe]}],"drop-shadow":[{"drop-shadow":["","none",p,Wa,Ha]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",ke,he,pe]}],"hue-rotate":[{"hue-rotate":[ke,he,pe]}],invert:[{invert:["",ke,he,pe]}],saturate:[{saturate:[ke,he,pe]}],sepia:[{sepia:["",ke,he,pe]}],"backdrop-filter":[{"backdrop-filter":["","none",he,pe]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[ke,he,pe]}],"backdrop-contrast":[{"backdrop-contrast":[ke,he,pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ke,he,pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ke,he,pe]}],"backdrop-invert":[{"backdrop-invert":["",ke,he,pe]}],"backdrop-opacity":[{"backdrop-opacity":[ke,he,pe]}],"backdrop-saturate":[{"backdrop-saturate":[ke,he,pe]}],"backdrop-sepia":[{"backdrop-sepia":["",ke,he,pe]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":C()}],"border-spacing-x":[{"border-spacing-x":C()}],"border-spacing-y":[{"border-spacing-y":C()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",he,pe]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[ke,"initial",he,pe]}],ease:[{ease:["linear","initial",w,he,pe]}],delay:[{delay:[ke,he,pe]}],animate:[{animate:["none",v,he,pe]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[f,he,pe]}],"perspective-origin":[{"perspective-origin":N()}],rotate:[{rotate:ue()}],"rotate-x":[{"rotate-x":ue()}],"rotate-y":[{"rotate-y":ue()}],"rotate-z":[{"rotate-z":ue()}],scale:[{scale:ve()}],"scale-x":[{"scale-x":ve()}],"scale-y":[{"scale-y":ve()}],"scale-z":[{"scale-z":ve()}],"scale-3d":["scale-3d"],skew:[{skew:Ne()}],"skew-x":[{"skew-x":Ne()}],"skew-y":[{"skew-y":Ne()}],transform:[{transform:[he,pe,"","none","gpu","cpu"]}],"transform-origin":[{origin:N()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:ye()}],"translate-x":[{"translate-x":ye()}],"translate-y":[{"translate-y":ye()}],"translate-z":[{"translate-z":ye()}],"translate-none":["translate-none"],accent:[{accent:P()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:P()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",he,pe]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":C()}],"scroll-mx":[{"scroll-mx":C()}],"scroll-my":[{"scroll-my":C()}],"scroll-ms":[{"scroll-ms":C()}],"scroll-me":[{"scroll-me":C()}],"scroll-mbs":[{"scroll-mbs":C()}],"scroll-mbe":[{"scroll-mbe":C()}],"scroll-mt":[{"scroll-mt":C()}],"scroll-mr":[{"scroll-mr":C()}],"scroll-mb":[{"scroll-mb":C()}],"scroll-ml":[{"scroll-ml":C()}],"scroll-p":[{"scroll-p":C()}],"scroll-px":[{"scroll-px":C()}],"scroll-py":[{"scroll-py":C()}],"scroll-ps":[{"scroll-ps":C()}],"scroll-pe":[{"scroll-pe":C()}],"scroll-pbs":[{"scroll-pbs":C()}],"scroll-pbe":[{"scroll-pbe":C()}],"scroll-pt":[{"scroll-pt":C()}],"scroll-pr":[{"scroll-pr":C()}],"scroll-pb":[{"scroll-pb":C()}],"scroll-pl":[{"scroll-pl":C()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",he,pe]}],fill:[{fill:["none",...P()]}],"stroke-w":[{stroke:[ke,da,jr,Pi]}],stroke:[{stroke:["none",...P()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},lj=Mw(sj);function At(...e){return lj(vw(e))}const Yt=({onInsert:e})=>{const[t,r]=k.useState(null),o=async n=>{const s=`{{${n}}}`;try{await navigator.clipboard.writeText(s)}catch{const l=document.createElement("textarea");l.value=s,l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l),l.select(),document.execCommand("copy"),document.body.removeChild(l)}e&&e(s),r(n),setTimeout(()=>r(null),1500)};return a.jsxs(Uo,{children:[a.jsx(Ho,{asChild:!0,children:a.jsx($e,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 shrink-0 text-muted-foreground hover:text-primary",title:"Inserir variável do evento",children:a.jsx(O.Braces,{className:"h-3.5 w-3.5"})})}),a.jsxs($a,{className:"w-80 p-0",align:"end",side:"left",sideOffset:6,children:[a.jsxs("div",{className:"px-3 py-2 border-b border-border",children:[a.jsx("p",{className:"text-xs font-semibold text-foreground",children:"Variáveis do evento"}),a.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["Clique para copiar. Use"," ",a.jsx("code",{className:"bg-muted px-1 rounded text-[10px]",children:"{{evento.xxx}}"})," ","em labels, placeholders e hints."]})]}),a.jsx("div",{className:"max-h-64 overflow-y-auto py-1",children:fl.map(n=>{const s=t===n.key;return a.jsxs("button",{type:"button",onClick:()=>o(n.key),className:At("w-full flex items-center justify-between px-3 py-1.5 text-left hover:bg-accent transition-colors",s&&"bg-primary/10"),children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-xs font-medium truncate",children:n.label}),a.jsx("code",{className:"text-[10px] text-muted-foreground font-mono",children:`{{${n.key}}}`})]}),a.jsx("div",{className:"ml-2 shrink-0",children:s?a.jsx(O.Check,{className:"h-3.5 w-3.5 text-primary"}):a.jsx(O.Braces,{className:"h-3 w-3 text-muted-foreground/50"})})]},n.key)})})]})]})},ij=({config:e,onUpdate:t})=>a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(le,{className:"text-xs",children:"Label"}),a.jsx(Yt,{})]}),a.jsx(de,{value:e.label,onChange:r=>t({label:r.target.value}),className:"h-8 text-sm"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(le,{className:"text-xs",children:"Descrição"}),a.jsx(Yt,{})]}),a.jsx(de,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do step"})]}),a.jsx(tp,{value:e.icone,onChange:r=>t({icone:r})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(We,{id:"step-show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),a.jsx(le,{htmlFor:"step-show-label",className:"text-xs cursor-pointer",children:"Exibir título no formulário"})]})]}),cj=({inicioColuna:e,tamanho:t,onSelect:r})=>a.jsxs("div",{className:"space-y-2",children:[a.jsx(le,{className:"text-xs",children:"Posição no grid"}),a.jsx("div",{className:"flex gap-0.5",children:Array.from({length:12},(o,n)=>{const s=n+1,l=s>=e&&s<e+t;return a.jsx("button",{onClick:()=>r(s),className:At("flex-1 h-6 rounded-sm text-[8px] font-mono transition-all border",l?"bg-primary text-primary-foreground border-primary":"bg-muted/50 text-muted-foreground/50 border-border/50 hover:bg-muted hover:border-border"),children:s},s)})}),a.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Início: col ",e," · Span: ",t]})]}),Bp=({tamanho:e,inicioColuna:t,defaultTamanho:r=6,onTamanhoChange:o,onPositionChange:n})=>{const s=13-t;return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs(le,{className:"text-xs",children:["Tamanho (",e,"/12 colunas)"]}),a.jsx(Vo,{value:[e],onValueChange:([l])=>{const i=Math.min(l,s);o(i)},min:1,max:s,step:1,className:"py-1"}),a.jsxs("div",{className:"flex justify-between text-[9px] text-muted-foreground",children:[a.jsx("span",{children:"1"}),a.jsx("span",{children:"3"}),a.jsx("span",{children:"6"}),a.jsx("span",{children:"9"}),a.jsx("span",{children:"12"})]})]}),a.jsx(cj,{inicioColuna:t,tamanho:e,onSelect:l=>{const i=13-l,c=Math.min(e,i);n(l),c!==e&&o(c)}})]})},dj=({config:e,onUpdate:t})=>a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(le,{className:"text-xs",children:"Label"}),a.jsx(Yt,{})]}),a.jsx(de,{value:e.label,onChange:r=>t({label:r.target.value}),className:"h-8 text-sm"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(le,{className:"text-xs",children:"Descrição"}),a.jsx(Yt,{})]}),a.jsx(de,{value:e.description||"",onChange:r=>t({description:r.target.value}),className:"h-8 text-sm",placeholder:"Descrição do container"})]}),a.jsx(tp,{value:e.icone,onChange:r=>t({icone:r})}),a.jsx(Bp,{tamanho:e.tamanho||12,inicioColuna:e.inicioColuna||1,defaultTamanho:12,onTamanhoChange:r=>t({tamanho:r}),onPositionChange:r=>t({inicioColuna:r})}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Colunas internas"}),a.jsxs($t,{value:String(e.columns||2),onValueChange:r=>t({columns:Number(r)}),children:[a.jsx(bt,{className:"h-8 text-sm",children:a.jsx(Et,{})}),a.jsxs(yt,{children:[a.jsx(ze,{value:"1",children:"1 coluna"}),a.jsx(ze,{value:"2",children:"2 colunas"}),a.jsx(ze,{value:"3",children:"3 colunas"}),a.jsx(ze,{value:"4",children:"4 colunas"})]})]}),a.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Grid interno simplificado para campos"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(We,{id:"show-label",checked:e.showLabel!==!1,onCheckedChange:r=>t({showLabel:r===!0})}),a.jsx(le,{htmlFor:"show-label",className:"text-xs cursor-pointer",children:"Exibir label no formulário"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(We,{id:"show-as-card",checked:e.showAsCard||!1,onCheckedChange:r=>t({showAsCard:r===!0})}),a.jsx(le,{htmlFor:"show-as-card",className:"text-xs cursor-pointer",children:"Exibir como card"})]})]}),is=[{category:"Texto básico",presets:[{pattern:"^[A-Za-z]+$",label:"Apenas letras",description:"Aceita somente letras de A-Z (maiúsculas e minúsculas), sem espaços, números ou especiais."},{pattern:"^[a-z]+$",label:"Apenas minúsculas",description:"Aceita somente letras minúsculas de a-z."},{pattern:"^[A-Z]+$",label:"Apenas maiúsculas",description:"Aceita somente letras maiúsculas de A-Z."},{pattern:"^[A-Za-zÀ-ÿ]+$",label:"Letras com acentos",description:"Aceita letras incluindo acentuadas (é, ã, ü, etc.)."},{pattern:"^[A-Za-zÀ-ÿ\\s]+$",label:"Letras, acentos e espaços",description:"Aceita letras com acentos e espaços — ideal para nomes completos."},{pattern:"^[A-Za-z0-9]+$",label:"Alfanumérico",description:"Apenas letras e números, sem espaços ou caracteres especiais."},{pattern:"^[A-Za-z0-9\\s]+$",label:"Alfanumérico com espaços",description:"Letras, números e espaços."},{pattern:"^[A-Za-z0-9_]+$",label:"Alfanumérico + underscore",description:"Letras, números e underscore (_). Padrão para usernames."},{pattern:"^[A-Za-z0-9_-]+$",label:"Slug-friendly",description:"Letras, números, underscore e hífen. Ideal para slugs de URL."},{pattern:"^\\S+$",label:"Sem espaços",description:"Aceita qualquer caractere exceto espaços em branco."},{pattern:"^.{1,}$",label:"Não vazio",description:"Exige pelo menos 1 caractere (qualquer um)."}]},{category:"Números",presets:[{pattern:"^[0-9]+$",label:"Apenas dígitos",description:"Aceita somente dígitos numéricos (0-9)."},{pattern:"^-?[0-9]+$",label:"Inteiro (com negativo)",description:"Número inteiro, opcionalmente negativo."},{pattern:"^[0-9]+\\.?[0-9]*$",label:"Decimal positivo",description:"Número decimal positivo (ex: 3.14, 42)."},{pattern:"^-?[0-9]+\\.?[0-9]*$",label:"Decimal (com negativo)",description:"Número decimal, opcionalmente negativo."},{pattern:"^\\d{1,3}(\\.\\d{3})*(,\\d{2})?$",label:"Formato BR (1.234,56)",description:"Número no formato brasileiro com pontos de milhar e vírgula decimal."},{pattern:"^\\d{1,3}(,\\d{3})*(\\.\\d{2})?$",label:"Formato US (1,234.56)",description:"Número no formato americano com vírgulas de milhar e ponto decimal."},{pattern:"^[01]+$",label:"Binário",description:"Aceita apenas 0 e 1 — representação binária."},{pattern:"^[0-9A-Fa-f]+$",label:"Hexadecimal",description:"Aceita dígitos hexadecimais (0-9, A-F)."},{pattern:"^0[xX][0-9A-Fa-f]+$",label:"Hex com prefixo 0x",description:"Hexadecimal com prefixo 0x (ex: 0xFF)."},{pattern:"^[0-7]+$",label:"Octal",description:"Aceita apenas dígitos octais (0-7)."},{pattern:"^\\d+(\\.\\d{1,2})?$",label:"Monetário (2 casas)",description:"Número com até 2 casas decimais — ideal para valores monetários."},{pattern:"^\\d+(\\.\\d{1,4})?$",label:"Até 4 casas decimais",description:"Número com até 4 casas decimais."}]},{category:"Documentos BR",presets:[{pattern:"^\\d{3}\\.\\d{3}\\.\\d{3}-\\d{2}$",label:"CPF (com máscara)",description:"CPF formatado: 123.456.789-00."},{pattern:"^\\d{11}$",label:"CPF (sem máscara)",description:"CPF apenas dígitos: 12345678900."},{pattern:"^\\d{2}\\.\\d{3}\\.\\d{3}/\\d{4}-\\d{2}$",label:"CNPJ (com máscara)",description:"CNPJ formatado: 12.345.678/0001-00."},{pattern:"^\\d{14}$",label:"CNPJ (sem máscara)",description:"CNPJ apenas dígitos: 12345678000100."},{pattern:"^\\d{5}-?\\d{3}$",label:"CEP",description:"CEP brasileiro: 12345-678 ou 12345678."},{pattern:"^\\d{1,2}\\.\\d{3}\\.\\d{3}[-]?\\d{1}$",label:"RG (formato comum)",description:"RG no formato mais comum: 1.234.567-8."},{pattern:"^\\d{11}$",label:"PIS/PASEP",description:"PIS/PASEP com 11 dígitos."},{pattern:"^\\d{3}\\.?\\d{7}-?\\d{1}$",label:"Título de eleitor",description:"Título de eleitor com 12 dígitos."},{pattern:"^[A-Z]{2}\\d{7}$",label:"Passaporte BR",description:"Passaporte brasileiro: 2 letras + 7 dígitos (ex: AB1234567)."},{pattern:"^\\d{11}$",label:"CNH (registro)",description:"Número de registro da CNH: 11 dígitos."},{pattern:"^\\d{10}$",label:"Certidão (matrícula)",description:"Matrícula de certidão de nascimento/casamento."},{pattern:"^\\d{3}\\.\\d{3}\\.\\d{3}-\\d{2}$|^\\d{2}\\.\\d{3}\\.\\d{3}/\\d{4}-\\d{2}$",label:"CPF ou CNPJ",description:"Aceita CPF (123.456.789-00) ou CNPJ (12.345.678/0001-00)."}]},{category:"Contato",presets:[{pattern:"^[\\w.-]+@[\\w.-]+\\.[A-Za-z]{2,}$",label:"E-mail simples",description:"Validação básica de e-mail: usuario@dominio.com."},{pattern:"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$",label:"E-mail completo",description:"E-mail com mais caracteres aceitos no usuário."},{pattern:"^\\(\\d{2}\\)\\s?\\d{4,5}-\\d{4}$",label:"Telefone BR (com máscara)",description:"Telefone formatado: (11) 91234-5678 ou (11) 1234-5678."},{pattern:"^\\d{10,11}$",label:"Telefone BR (sem máscara)",description:"Telefone apenas dígitos: 11912345678."},{pattern:"^\\+\\d{1,3}\\s?\\d{2,3}\\s?\\d{4,5}[-]?\\d{4}$",label:"Telefone internacional",description:"Formato +55 11 91234-5678."},{pattern:"^\\+55\\d{10,11}$",label:"Celular BR (+55)",description:"Celular brasileiro com DDI: +5511912345678."},{pattern:"^\\d{4,5}-\\d{4}$",label:"Telefone (sem DDD)",description:"Número local: 1234-5678 ou 91234-5678."},{pattern:"^0800\\d{6,7}$",label:"0800",description:"Número 0800 (SAC): 0800XXXXXXX."}]},{category:"Internet / URLs",presets:[{pattern:"^https?://[\\w.-]+(:\\d+)?(/[\\w./-]*)*$",label:"URL HTTP/HTTPS",description:"URL completa com protocolo http ou https."},{pattern:"^(https?://)?[\\w.-]+\\.[A-Za-z]{2,}(/.*)?$",label:"URL (protocolo opcional)",description:"URL com ou sem http:// na frente."},{pattern:"^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*\\.[a-z]{2,}$",label:"Domínio",description:"Nome de domínio válido: exemplo.com.br."},{pattern:"^((25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}(25[0-5]|2[0-4]\\d|[01]?\\d\\d?)$",label:"IPv4",description:"Endereço IPv4: 192.168.0.1."},{pattern:"^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$",label:"IPv6 (completo)",description:"Endereço IPv6 completo."},{pattern:"^[a-z][a-z0-9-]*$",label:"Subdomínio",description:"Nome de subdomínio válido (letra inicial, alfanumérico + hífen)."},{pattern:"^[A-Za-z][A-Za-z0-9+.-]*://.*$",label:"URI genérica",description:"Qualquer URI com esquema (ftp://, mailto:, tel:, etc.)."},{pattern:"^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$",label:"Cor hex (#FFF)",description:"Código de cor hexadecimal: #FFF ou #FFFFFF."},{pattern:"^#[0-9A-Fa-f]{8}$",label:"Cor hex com alpha",description:"Cor hexadecimal com canal alpha: #FFFFFFFF."},{pattern:"^rgb\\(\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*,\\s*\\d{1,3}\\s*\\)$",label:"Cor RGB",description:"Cor no formato rgb(255, 0, 0)."}]},{category:"Data e hora",presets:[{pattern:"^\\d{2}/\\d{2}/\\d{4}$",label:"Data DD/MM/AAAA",description:"Data no formato brasileiro: 25/12/2024."},{pattern:"^\\d{4}-\\d{2}-\\d{2}$",label:"Data ISO (AAAA-MM-DD)",description:"Data no formato ISO 8601: 2024-12-25."},{pattern:"^\\d{2}/\\d{2}/\\d{2}$",label:"Data DD/MM/AA",description:"Data com ano de 2 dígitos: 25/12/24."},{pattern:"^\\d{2}-\\d{2}-\\d{4}$",label:"Data DD-MM-AAAA",description:"Data com hífens: 25-12-2024."},{pattern:"^\\d{2}:\\d{2}$",label:"Hora HH:MM",description:"Horário 24h: 14:30."},{pattern:"^\\d{2}:\\d{2}:\\d{2}$",label:"Hora HH:MM:SS",description:"Horário com segundos: 14:30:59."},{pattern:"^(0[1-9]|1[0-2])/\\d{4}$",label:"Mês/Ano (MM/AAAA)",description:"Mês e ano: 12/2024."},{pattern:"^\\d{4}$",label:"Ano (4 dígitos)",description:"Ano com 4 dígitos: 2024."},{pattern:"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}$",label:"DateTime ISO (sem seg)",description:"Data e hora ISO: 2024-12-25T14:30."},{pattern:"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$",label:"DateTime ISO (com seg)",description:"Data e hora ISO com segundos."},{pattern:"^\\d{2}/\\d{2}/\\d{4}\\s\\d{2}:\\d{2}$",label:"DateTime BR",description:"Data e hora BR: 25/12/2024 14:30."}]},{category:"Senhas",presets:[{pattern:"^.{6,}$",label:"Mín. 6 caracteres",description:"Exige no mínimo 6 caracteres (qualquer tipo)."},{pattern:"^.{8,}$",label:"Mín. 8 caracteres",description:"Exige no mínimo 8 caracteres."},{pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).{8,}$",label:"Forte (letra+número)",description:"Mín. 8 chars com pelo menos 1 maiúscula, 1 minúscula e 1 número."},{pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[!@#$%^&*]).{8,}$",label:"Muito forte",description:"Mín. 8 chars com maiúscula, minúscula, número e caractere especial."},{pattern:"^(?=.*[A-Z])(?=.*\\d).{6,}$",label:"Média (maiúsc+número)",description:"Mín. 6 chars com pelo menos 1 maiúscula e 1 número."},{pattern:"^(?!.*\\s).{8,}$",label:"Sem espaços (mín. 8)",description:"Mín. 8 caracteres, sem espaços."}]},{category:"Nomes e texto formatado",presets:[{pattern:"^[A-Za-zÀ-ÿ]{2,}(\\s[A-Za-zÀ-ÿ]{2,})+$",label:"Nome completo",description:"Nome e sobrenome (mínimo 2 palavras, cada com 2+ letras)."},{pattern:"^[A-Za-zÀ-ÿ]{2,}$",label:"Primeiro nome",description:"Apenas o primeiro nome (mínimo 2 letras, com acentos)."},{pattern:"^[A-Za-zÀ-ÿ'\\-\\s]+$",label:"Nome com apóstrofo/hífen",description:"Nome que aceita D'Silva, Maria-José, etc."},{pattern:"^[A-Z][a-zà-ÿ]+(\\s[A-Z][a-zà-ÿ]+)*$",label:"Nome capitalizado",description:"Cada palavra inicia com maiúscula: João Silva."},{pattern:"^@[A-Za-z0-9_]{1,30}$",label:"Username (@handle)",description:"Username no estilo @usuario (letras, números, underscore, até 30 chars)."},{pattern:"^[a-z0-9_]{3,20}$",label:"Username simples",description:"Username minúsculo: 3-20 chars, letras, números e underscore."},{pattern:"^[A-Za-z0-9._%+-]+$",label:"Parte local do e-mail",description:"Parte antes do @ em endereços de e-mail."}]},{category:"Endereço",presets:[{pattern:"^[A-Za-zÀ-ÿ0-9\\s,./-]+$",label:"Endereço genérico",description:"Aceita letras, números, espaços, vírgulas, pontos, barras e hífens."},{pattern:"^\\d{1,6}$",label:"Número residencial",description:"Número do endereço: 1 a 6 dígitos."},{pattern:"^\\d{5}-?\\d{3}$",label:"CEP",description:"CEP: 12345-678 ou 12345678."},{pattern:"^[A-Z]{2}$",label:"UF (estado)",description:"Sigla do estado brasileiro: SP, RJ, MG, etc."},{pattern:"^(Rua|Av|Avenida|Travessa|Alameda|Praça|Rod|Rodovia)\\s.+$",label:"Logradouro BR",description:"Começa com tipo de via: Rua, Avenida, Travessa, etc."},{pattern:"^(Apt|Apto|Sala|Bloco|Lote|Casa)\\s?\\d+.*$",label:"Complemento",description:"Complemento: Apto 123, Bloco B, Sala 3, etc."}]},{category:"Financeiro",presets:[{pattern:"^R\\$\\s?\\d{1,3}(\\.\\d{3})*(,\\d{2})?$",label:"Moeda BRL (R$)",description:"Valor em reais: R$ 1.234,56."},{pattern:"^\\$\\d{1,3}(,\\d{3})*(\\.\\d{2})?$",label:"Moeda USD ($)",description:"Valor em dólares: $1,234.56."},{pattern:"^\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}[\\s-]?\\d{4}$",label:"Cartão de crédito",description:"Número de cartão: 1234 5678 9012 3456."},{pattern:"^(0[1-9]|1[0-2])/\\d{2}$",label:"Validade cartão (MM/AA)",description:"Data de validade: 12/25."},{pattern:"^\\d{3,4}$",label:"CVV",description:"Código de segurança: 3 ou 4 dígitos."},{pattern:"^\\d{1,6}(-[0-9Xx])?$",label:"Agência bancária",description:"Número da agência: 1234-5 ou 1234."},{pattern:"^\\d{1,12}(-[0-9Xx])?$",label:"Conta bancária",description:"Número da conta: até 12 dígitos com dígito verificador."},{pattern:"^\\d{1,3}(\\.\\d{3})*(,\\d{2})$",label:"Valor BR sem símbolo",description:"Valor monetário sem R$: 1.234,56."}]},{category:"Veículos",presets:[{pattern:"^[A-Z]{3}-?\\d{4}$",label:"Placa antiga (ABC-1234)",description:"Placa veicular formato antigo: ABC-1234."},{pattern:"^[A-Z]{3}\\d[A-Z]\\d{2}$",label:"Placa Mercosul (ABC1D23)",description:"Placa veicular Mercosul: ABC1D23."},{pattern:"^[A-Z]{3}-?\\d{4}$|^[A-Z]{3}\\d[A-Z]\\d{2}$",label:"Placa (ambos formatos)",description:"Aceita placa antiga (ABC-1234) ou Mercosul (ABC1D23)."},{pattern:"^\\d{11}$",label:"RENAVAM",description:"RENAVAM: 11 dígitos numéricos."},{pattern:"^[A-Z0-9]{17}$",label:"Chassi (VIN)",description:"Número de chassi/VIN: 17 caracteres alfanuméricos maiúsculos."}]},{category:"Códigos e identificadores",presets:[{pattern:"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",label:"UUID v4",description:"UUID formato padrão: 550e8400-e29b-41d4-a716-446655440000."},{pattern:"^[A-Za-z0-9+/]+={0,2}$",label:"Base64",description:"String codificada em Base64."},{pattern:"^[A-Za-z0-9-_]+$",label:"Base64 URL-safe",description:"Base64 com caracteres seguros para URL."},{pattern:"^[0-9a-f]{32}$",label:"MD5 hash",description:"Hash MD5: 32 caracteres hexadecimais."},{pattern:"^[0-9a-f]{40}$",label:"SHA-1 hash",description:"Hash SHA-1: 40 caracteres hexadecimais."},{pattern:"^[0-9a-f]{64}$",label:"SHA-256 hash",description:"Hash SHA-256: 64 caracteres hexadecimais."},{pattern:"^\\d{8,14}$",label:"Código de barras",description:"Código de barras numérico: 8-14 dígitos."},{pattern:"^\\d{44}$",label:"Linha digitável boleto",description:"Linha digitável de boleto: 44 dígitos."},{pattern:"^[A-Z]{2}\\d{2}[A-Z0-9]{4}\\d{7}([A-Z0-9]?){0,16}\\d{2}$",label:"IBAN",description:"Código bancário internacional IBAN."},{pattern:"^[A-Z]{4}[A-Z]{2}[A-Z0-9]{2}([A-Z0-9]{3})?$",label:"SWIFT/BIC",description:"Código SWIFT bancário: 8 ou 11 caracteres."}]},{category:"Saúde e governo",presets:[{pattern:"^\\d{15}$",label:"Cartão SUS",description:"Número do Cartão Nacional de Saúde: 15 dígitos."},{pattern:"^\\d{6,7}$",label:"CRM/CRO/CRP",description:"Número de registro profissional de saúde."},{pattern:"^\\d{3}\\.\\d{5}\\.\\d{2}-\\d$",label:"NIT/PIS",description:"Número de Identificação do Trabalhador."},{pattern:"^\\d{7}-?\\d{2}\\.\\d{4}\\.\\d\\.\\d{2}\\.\\d{4}$",label:"Processo judicial",description:"Número de processo judicial (formato CNJ)."},{pattern:"^\\d{12}$",label:"Inscrição estadual (genérica)",description:"Inscrição estadual genérica: 12 dígitos."},{pattern:"^\\d{11}$",label:"NIS/NIT",description:"Número de Identificação Social: 11 dígitos."}]},{category:"Redes sociais",presets:[{pattern:"^https?://(www\\.)?instagram\\.com/[A-Za-z0-9_.]+/?$",label:"Perfil Instagram",description:"URL de perfil do Instagram."},{pattern:"^https?://(www\\.)?facebook\\.com/.+$",label:"Perfil Facebook",description:"URL de perfil ou página do Facebook."},{pattern:"^https?://(www\\.)?linkedin\\.com/in/[A-Za-z0-9-]+/?$",label:"Perfil LinkedIn",description:"URL de perfil do LinkedIn."},{pattern:"^https?://(www\\.)?(twitter|x)\\.com/[A-Za-z0-9_]+/?$",label:"Perfil Twitter/X",description:"URL de perfil no Twitter/X."},{pattern:"^https?://(www\\.)?youtube\\.com/(c/|channel/|@)[A-Za-z0-9_-]+/?$",label:"Canal YouTube",description:"URL de canal do YouTube."},{pattern:"^https?://(www\\.)?github\\.com/[A-Za-z0-9_-]+/?$",label:"Perfil GitHub",description:"URL de perfil do GitHub."},{pattern:"^https?://(www\\.)?tiktok\\.com/@[A-Za-z0-9_.]+/?$",label:"Perfil TikTok",description:"URL de perfil do TikTok."}]},{category:"Programação",presets:[{pattern:"^[a-z][a-zA-Z0-9]*$",label:"camelCase",description:"Formato camelCase: minúscula inicial, sem espaços."},{pattern:"^[A-Z][a-zA-Z0-9]*$",label:"PascalCase",description:"Formato PascalCase: maiúscula inicial."},{pattern:"^[a-z]+(_[a-z]+)*$",label:"snake_case",description:"Formato snake_case: minúsculas separadas por underscore."},{pattern:"^[a-z]+(-[a-z]+)*$",label:"kebab-case",description:"Formato kebab-case: minúsculas separadas por hífen."},{pattern:"^[A-Z]+(_[A-Z]+)*$",label:"SCREAMING_SNAKE",description:"Constantes: MAIÚSCULAS_COM_UNDERSCORES."},{pattern:"^[a-zA-Z_$][a-zA-Z0-9_$]*$",label:"Variável JS válida",description:"Nome de variável JavaScript válido."},{pattern:"^v?\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.]+)?$",label:"Semver",description:"Versionamento semântico: v1.2.3 ou 1.2.3-beta.1."},{pattern:"^[a-z][a-z0-9]*(-[a-z][a-z0-9]*)*$",label:"Nome de pacote npm",description:"Nome válido de pacote npm."}]}],uj=is.flatMap(e=>e.presets),mj=({value:e,message:t,onChange:r})=>{const[o,n]=k.useState(!1),[s,l]=k.useState(""),i=k.useMemo(()=>{if(!s.trim())return is;const m=s.toLowerCase();return is.map(u=>({...u,presets:u.presets.filter(h=>h.label.toLowerCase().includes(m)||h.description.toLowerCase().includes(m)||h.pattern.toLowerCase().includes(m))})).filter(u=>u.presets.length>0)},[s]),c=k.useMemo(()=>e?uj.find(m=>m.pattern===e):void 0,[e]),d=m=>{r(m.pattern,`${m.label}: formato inválido`),n(!1),l("")};return a.jsxs("div",{className:"space-y-2",children:[a.jsx(le,{className:"text-[10px]",children:"Regex"}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(de,{value:e??"",onChange:m=>r(m.target.value||void 0,t),className:"h-7 text-xs font-mono flex-1",placeholder:"Clique no botão ou digite..."}),e&&a.jsx($e,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>{r(void 0,void 0)},children:a.jsx(O.X,{className:"h-3 w-3"})}),a.jsxs(Uo,{open:o,onOpenChange:n,children:[a.jsx(Ho,{asChild:!0,children:a.jsx($e,{variant:"outline",size:"icon",className:"h-7 w-7 shrink-0",children:a.jsx(O.Regex,{className:"h-3.5 w-3.5"})})}),a.jsxs($a,{className:"w-[360px] p-0",side:"left",align:"start",sideOffset:8,children:[a.jsx("div",{className:"p-2 border-b",children:a.jsxs("div",{className:"relative",children:[a.jsx(O.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),a.jsx(de,{value:s,onChange:m=>l(m.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar regex (ex: CPF, e-mail, senha)...",autoFocus:!0})]})}),a.jsx(Yo,{className:"h-[360px]",children:a.jsxs("div",{className:"p-1",children:[i.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Nenhum regex encontrado"}),i.map(m=>a.jsxs("div",{className:"mb-1",children:[a.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide px-2 py-1.5 sticky top-0 bg-popover z-10",children:m.category}),m.presets.map(u=>a.jsxs(Mm,{children:[a.jsx(Vm,{asChild:!0,children:a.jsxs("button",{onClick:()=>d(u),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-accent transition-colors group",children:[a.jsx(O.ChevronRight,{className:"h-3 w-3 text-muted-foreground/50 group-hover:text-primary shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-xs font-medium block truncate",children:u.label}),a.jsx("span",{className:"text-[10px] text-muted-foreground font-mono block truncate",children:u.pattern})]})]})}),a.jsxs(ol,{side:"left",className:"max-w-[250px] text-xs",children:[a.jsx("p",{className:"font-semibold mb-1",children:u.label}),a.jsx("p",{children:u.description})]})]},u.pattern+u.label))]},m.category))]})})]})]})]}),c&&a.jsxs($s,{variant:"secondary",className:"text-[10px] font-normal gap-1",children:[a.jsx(O.Regex,{className:"h-2.5 w-2.5"}),c.label]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:"Mensagem do regex"}),a.jsx(de,{value:t??"",onChange:m=>r(e,m.target.value||void 0),className:"h-7 text-xs",placeholder:"Formato inválido"})]})]})},cs=[{category:"Imagens",presets:[{value:"image/jpeg",label:"JPEG",description:"Imagem JPEG — formato mais comum para fotos. Boa compressão, perde qualidade."},{value:"image/png",label:"PNG",description:"Imagem PNG — suporta transparência, sem perda de qualidade. Arquivos maiores."},{value:"image/gif",label:"GIF",description:"Imagem GIF — suporta animações simples e transparência. Limitado a 256 cores."},{value:"image/webp",label:"WebP",description:"Formato moderno do Google — compressão superior ao JPEG e PNG."},{value:"image/svg+xml",label:"SVG",description:"Imagem vetorial XML — escalável sem perda. Ideal para logos e ícones."},{value:"image/bmp",label:"BMP",description:"Bitmap — sem compressão, arquivos muito grandes."},{value:"image/tiff",label:"TIFF",description:"Imagem TIFF — alta qualidade, usado em impressão profissional."},{value:"image/avif",label:"AVIF",description:"Formato moderno — melhor compressão que WebP, suporte crescente."},{value:"image/heic",label:"HEIC",description:"Formato padrão do iPhone — alta qualidade, tamanho reduzido."},{value:"image/*",label:"Qualquer imagem",description:"Aceita todos os formatos de imagem (JPEG, PNG, GIF, WebP, etc.)."}]},{category:"Documentos",presets:[{value:"application/pdf",label:"PDF",description:"Documento PDF — formato universal para documentos. Preserva formatação."},{value:"application/msword",label:"DOC (Word antigo)",description:"Microsoft Word 97-2003 (.doc)."},{value:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",label:"DOCX (Word)",description:"Microsoft Word moderno (.docx) — formato atual do Word."},{value:"application/vnd.ms-excel",label:"XLS (Excel antigo)",description:"Microsoft Excel 97-2003 (.xls)."},{value:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",label:"XLSX (Excel)",description:"Microsoft Excel moderno (.xlsx) — formato atual do Excel."},{value:"application/vnd.ms-powerpoint",label:"PPT (PowerPoint antigo)",description:"Microsoft PowerPoint 97-2003 (.ppt)."},{value:"application/vnd.openxmlformats-officedocument.presentationml.presentation",label:"PPTX (PowerPoint)",description:"Microsoft PowerPoint moderno (.pptx)."},{value:"application/vnd.oasis.opendocument.text",label:"ODT (LibreOffice)",description:"Documento de texto LibreOffice/OpenOffice (.odt)."},{value:"application/vnd.oasis.opendocument.spreadsheet",label:"ODS (LibreOffice)",description:"Planilha LibreOffice/OpenOffice (.ods)."},{value:"application/rtf",label:"RTF",description:"Rich Text Format — compatível com quase todos os editores de texto."},{value:"text/plain",label:"TXT",description:"Texto puro sem formatação (.txt)."},{value:"text/csv",label:"CSV",description:"Valores separados por vírgula — planilhas simples e dados tabulares."}]},{category:"Vídeos",presets:[{value:"video/mp4",label:"MP4",description:"Vídeo MP4 — formato mais compatível, boa compressão (H.264/H.265)."},{value:"video/webm",label:"WebM",description:"Vídeo WebM — formato aberto do Google, boa compressão."},{value:"video/quicktime",label:"MOV",description:"Vídeo QuickTime — formato padrão do macOS/iPhone."},{value:"video/x-msvideo",label:"AVI",description:"Vídeo AVI — formato antigo da Microsoft, arquivos grandes."},{value:"video/x-matroska",label:"MKV",description:"Matroska — contêiner flexível, suporta múltiplas faixas de áudio/legenda."},{value:"video/*",label:"Qualquer vídeo",description:"Aceita todos os formatos de vídeo."}]},{category:"Áudios",presets:[{value:"audio/mpeg",label:"MP3",description:"Áudio MP3 — formato mais popular, boa compressão com perda."},{value:"audio/wav",label:"WAV",description:"Áudio WAV — sem compressão, alta qualidade, arquivos grandes."},{value:"audio/ogg",label:"OGG",description:"Áudio OGG Vorbis — formato aberto, boa qualidade."},{value:"audio/aac",label:"AAC",description:"Áudio AAC — qualidade superior ao MP3 no mesmo bitrate."},{value:"audio/flac",label:"FLAC",description:"Áudio FLAC — compressão sem perda, alta fidelidade."},{value:"audio/webm",label:"WebM Áudio",description:"Áudio no contêiner WebM."},{value:"audio/*",label:"Qualquer áudio",description:"Aceita todos os formatos de áudio."}]},{category:"Compactados",presets:[{value:"application/zip",label:"ZIP",description:"Arquivo compactado ZIP — o mais universal."},{value:"application/x-rar-compressed",label:"RAR",description:"Arquivo compactado RAR — boa compressão, formato proprietário."},{value:"application/gzip",label:"GZ / GZIP",description:"Compactação GZIP — muito usado em ambientes Unix/Linux."},{value:"application/x-7z-compressed",label:"7Z",description:"Arquivo 7-Zip — excelente taxa de compressão."},{value:"application/x-tar",label:"TAR",description:"TAR — agrupa arquivos sem compressão (usado com gzip)."}]},{category:"Dados / Código",presets:[{value:"application/json",label:"JSON",description:"Dados JSON — formato leve para troca de dados."},{value:"application/xml",label:"XML",description:"Dados XML — formato de marcação extensível."},{value:"text/html",label:"HTML",description:"Página web HTML."},{value:"text/css",label:"CSS",description:"Folha de estilo CSS."},{value:"application/javascript",label:"JavaScript",description:"Código JavaScript (.js)."},{value:"application/x-yaml",label:"YAML",description:"Dados YAML — formato legível para configurações."},{value:"text/markdown",label:"Markdown",description:"Texto Markdown (.md) — formatação leve."}]},{category:"Fontes",presets:[{value:"font/ttf",label:"TTF",description:"Fonte TrueType — amplamente suportada."},{value:"font/otf",label:"OTF",description:"Fonte OpenType — recursos tipográficos avançados."},{value:"font/woff",label:"WOFF",description:"Web Open Font Format — otimizado para web."},{value:"font/woff2",label:"WOFF2",description:"WOFF2 — compressão superior ao WOFF."}]},{category:"Atalhos comuns",presets:[{value:"image/*",label:"Todas as imagens",description:"Aceita qualquer formato de imagem."},{value:"video/*",label:"Todos os vídeos",description:"Aceita qualquer formato de vídeo."},{value:"audio/*",label:"Todos os áudios",description:"Aceita qualquer formato de áudio."},{value:"_group_documentos",label:"Documentos comuns",description:"PDF + Word .doc e .docx.",group:["application/pdf","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document"]},{value:"_group_imagens_web",label:"Imagens web",description:"JPEG, PNG e WebP — formatos mais usados na web.",group:["image/jpeg","image/png","image/webp"]},{value:"_group_planilhas",label:"Planilhas",description:"Excel .xls, .xlsx e CSV.",group:["application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","text/csv"]}]}],pj=cs.flatMap(e=>e.presets),fj=({value:e,onChange:t})=>{const[r,o]=k.useState(!1),[n,s]=k.useState(""),[l,i]=k.useState(""),c=k.useMemo(()=>new Set(e??[]),[e]),d=k.useMemo(()=>{if(!n.trim())return cs;const y=n.toLowerCase();return cs.map(f=>({...f,presets:f.presets.filter(g=>g.label.toLowerCase().includes(y)||g.description.toLowerCase().includes(y)||g.value.toLowerCase().includes(y))})).filter(f=>f.presets.length>0)},[n]),m=y=>{const f=new Set(e??[]);y.group?y.group.every(g=>f.has(g))?y.group.forEach(g=>f.delete(g)):y.group.forEach(g=>f.add(g)):f.has(y.value)?f.delete(y.value):f.add(y.value),t(f.size>0?Array.from(f):void 0)},u=()=>{const y=l.trim();if(!y)return;const f=new Set(e??[]);f.add(y),t(Array.from(f)),i("")},h=y=>{const f=new Set(e??[]);f.delete(y),t(f.size>0?Array.from(f):void 0)},p=y=>{const f=pj.find(g=>g.value===y);return(f==null?void 0:f.label)??y};return a.jsxs("div",{className:"space-y-2",children:[a.jsx(le,{className:"text-[10px]",children:"Tipos de arquivo aceitos"}),((e==null?void 0:e.length)??0)>0&&a.jsx("div",{className:"flex flex-wrap gap-1",children:e.map(y=>a.jsxs($s,{variant:"secondary",className:"text-[10px] gap-1 pr-1",children:[p(y),a.jsx("button",{onClick:()=>h(y),className:"hover:text-destructive",children:a.jsx(O.X,{className:"h-2.5 w-2.5"})})]},y))}),a.jsxs(Uo,{open:r,onOpenChange:o,children:[a.jsx(Ho,{asChild:!0,children:a.jsxs($e,{variant:"outline",className:"w-full h-8 text-xs justify-start gap-2",children:[a.jsx(O.FileType2,{className:"h-3.5 w-3.5"}),((e==null?void 0:e.length)??0)>0?`${e.length} tipo(s) selecionado(s)`:"Selecionar tipos de arquivo..."]})}),a.jsxs($a,{className:"w-[360px] p-0",side:"left",align:"start",sideOffset:8,children:[a.jsx("div",{className:"p-2 border-b",children:a.jsxs("div",{className:"relative",children:[a.jsx(O.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),a.jsx(de,{value:n,onChange:y=>s(y.target.value),className:"h-8 text-xs pl-7",placeholder:"Buscar tipos (ex: PDF, imagem, vídeo)...",autoFocus:!0})]})}),a.jsxs("div",{className:"px-2 py-1.5 border-b flex gap-1",children:[a.jsx(de,{value:l,onChange:y=>i(y.target.value),className:"h-7 text-xs font-mono flex-1",placeholder:"Tipo customizado (ex: .dwg)",onKeyDown:y=>y.key==="Enter"&&u()}),a.jsx($e,{variant:"secondary",size:"sm",className:"h-7 text-xs shrink-0",onClick:u,disabled:!l.trim(),children:"Adicionar"})]}),a.jsx(Yo,{className:"h-[320px]",children:a.jsxs("div",{className:"p-1",children:[d.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Nenhum tipo encontrado"}),d.map(y=>a.jsxs("div",{className:"mb-1",children:[a.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide px-2 py-1.5 sticky top-0 bg-popover z-10",children:y.category}),y.presets.map(f=>{const g=f.group?f.group.every(v=>c.has(v)):c.has(f.value),w=f.group?f.group.some(v=>c.has(v))&&!g:!1;return a.jsxs(Mm,{children:[a.jsx(Vm,{asChild:!0,children:a.jsxs("button",{onClick:()=>m(f),className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md text-left hover:bg-accent transition-colors",children:[a.jsx(We,{checked:w?"indeterminate":g,className:"h-3.5 w-3.5",tabIndex:-1}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-xs font-medium",children:f.label}),!f.group&&a.jsx("span",{className:"text-[10px] text-muted-foreground font-mono ml-2",children:f.value}),f.group&&a.jsxs("span",{className:"text-[10px] text-muted-foreground ml-2",children:[f.group.length," tipos"]})]}),a.jsx(O.Info,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"})]})}),a.jsxs(ol,{side:"left",className:"max-w-[250px] text-xs",children:[a.jsx("p",{className:"font-semibold mb-1",children:f.label}),a.jsx("p",{children:f.description}),f.group&&a.jsx("ul",{className:"mt-1 space-y-0.5",children:f.group.map(v=>a.jsx("li",{className:"font-mono text-[10px] opacity-80",children:v},v))})]})]},f.value)})]},y.category))]})})]})]})]})},Up=1048576,po=1073741824;function Fi(e){return e>=po&&e%po===0?"GB":"MB"}function Li(e,t){return t==="GB"?e/po:e/Up}function Mi(e,t){return Math.round(e*(t==="GB"?po:Up))}const hj=({value:e,onChange:t})=>{const r=k.useMemo(()=>e?Fi(e):"MB",[]),[o,n]=k.useState(r),[s,l]=k.useState(e?String(Li(e,r)):"");k.useEffect(()=>{if(e===void 0){l("");return}const d=Fi(e);n(d),l(String(Li(e,d)))},[e]);const i=d=>{l(d);const m=parseFloat(d);d.trim()===""||isNaN(m)||m<=0?t(void 0):t(Mi(m,o))},c=d=>{n(d);const m=parseFloat(s);!isNaN(m)&&m>0&&t(Mi(m,d))};return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(le,{className:"text-[10px]",children:"Tamanho máximo do arquivo"}),a.jsxs("div",{className:"flex gap-1.5",children:[a.jsx(de,{type:"number",min:0,step:"any",value:s,onChange:d=>i(d.target.value),placeholder:"Ex: 10",className:"h-8 text-xs flex-1"}),a.jsxs($t,{value:o,onValueChange:d=>c(d),children:[a.jsx(bt,{className:"w-[72px] h-8 text-xs",children:a.jsx(Et,{})}),a.jsxs(yt,{children:[a.jsx(ze,{value:"MB",children:"MB"}),a.jsx(ze,{value:"GB",children:"GB"})]})]})]}),e!==void 0&&a.jsxs("p",{className:"text-[10px] text-muted-foreground",children:["= ",e.toLocaleString("pt-BR")," bytes"]})]})},xj=new Set(["texto","textarea","email","password","url","phone","tel","cpf","cnpj","cep","rg"]),gj=({fieldType:e,validation:t,onChange:r})=>{const o=(l,i)=>{const c=["minLength","maxLength","min","max","maxFileSize","minAge","maxAge"].includes(l)?i?Number(i):void 0:i||void 0;r({...t,[l]:c})},n=e==="file",s=xj.has(e);return a.jsxs("div",{className:"space-y-3",children:[a.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Validação"}),s&&a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:"Min caracteres"}),a.jsx(de,{type:"number",min:0,value:(t==null?void 0:t.minLength)??"",onChange:l=>o("minLength",l.target.value),className:"h-7 text-xs"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:"Max caracteres"}),a.jsx(de,{type:"number",min:0,value:(t==null?void 0:t.maxLength)??"",onChange:l=>o("maxLength",l.target.value),className:"h-7 text-xs"})]})]}),e==="number"&&a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:"Valor mínimo"}),a.jsx(de,{type:"number",value:(t==null?void 0:t.min)??"",onChange:l=>o("min",l.target.value),className:"h-7 text-xs"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:"Valor máximo"}),a.jsx(de,{type:"number",value:(t==null?void 0:t.max)??"",onChange:l=>o("max",l.target.value),className:"h-7 text-xs"})]})]}),(e==="date"||e==="datetime")&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:"Data mínima"}),a.jsx(de,{type:"date",value:(t==null?void 0:t.minDate)??"",onChange:l=>o("minDate",l.target.value),className:"h-7 text-xs"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:"Data máxima"}),a.jsx(de,{type:"date",value:(t==null?void 0:t.maxDate)??"",onChange:l=>o("maxDate",l.target.value),className:"h-7 text-xs"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:"Idade mínima (anos)"}),a.jsx(de,{type:"number",min:0,value:(t==null?void 0:t.minAge)??"",onChange:l=>o("minAge",l.target.value),className:"h-7 text-xs",placeholder:"ex: 18"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:"Idade máxima (anos)"}),a.jsx(de,{type:"number",min:0,value:(t==null?void 0:t.maxAge)??"",onChange:l=>o("maxAge",l.target.value),className:"h-7 text-xs",placeholder:"ex: 60"})]})]})]}),n&&a.jsxs("div",{className:"space-y-3",children:[a.jsx(fj,{value:t==null?void 0:t.fileTypes,onChange:l=>r({...t,fileTypes:l})}),a.jsx(hj,{value:t==null?void 0:t.maxFileSize,onChange:l=>r({...t,maxFileSize:l})})]}),!n&&a.jsx(mj,{value:(t==null?void 0:t.regex)??"",message:(t==null?void 0:t.regexMessage)??"",onChange:(l,i)=>r({...t,regex:l,regexMessage:i})})]})},Hp=({options:e,onChange:t})=>{const r=k.useRef([]);if(r.current.length<e.length)for(let l=r.current.length;l<e.length;l++)r.current.push(`opt-${Math.random().toString(36).slice(2)}`);const o=k.useCallback((l,i,c)=>{const d=[...e];d[l]={...d[l],[i]:c},t(d)},[e,t]),n=k.useCallback(l=>{r.current.splice(l,1),t(e.filter((i,c)=>c!==l))},[e,t]),s=k.useCallback(()=>{t([...e,{value:"",label:""}])},[e,t]);return a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Opções"}),e.map((l,i)=>a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(O.GripVertical,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"}),a.jsx(de,{value:l.value,onChange:c=>o(i,"value",c.target.value),className:"h-7 text-xs flex-1",placeholder:"Valor"}),a.jsxs("div",{className:"flex items-center gap-0.5 flex-1",children:[a.jsx(de,{value:l.label,onChange:c=>o(i,"label",c.target.value),className:"h-7 text-xs flex-1",placeholder:"Label"}),a.jsx(Yt,{})]}),a.jsx($e,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>n(i),children:a.jsx(O.Trash2,{className:"h-3 w-3"})})]},r.current[i])),a.jsxs($e,{variant:"outline",size:"sm",className:"w-full h-7 text-xs",onClick:s,children:[a.jsx(O.Plus,{className:"h-3 w-3 mr-1"})," Adicionar opção"]})]})},vj=[{value:"igual",label:"Igual a"},{value:"diferente",label:"Diferente de"},{value:"vazio",label:"Vazio"},{value:"naoVazio",label:"Não vazio"},{value:"contem",label:"Contém"},{value:"naoContem",label:"Não contém"},{value:"maiorQue",label:"Maior que"},{value:"menorQue",label:"Menor que"},{value:"maiorOuIgual",label:"Maior ou igual a"},{value:"menorOuIgual",label:"Menor ou igual a"}],bj=["vazio","naoVazio"],Vi=({cond:e,selectedId:t,allFieldIds:r,getFieldLabel:o,onUpdate:n})=>a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:"Fonte"}),a.jsxs($t,{value:e.source||"campo",onValueChange:s=>n({source:s,when:""}),children:[a.jsx(bt,{className:"h-7 text-xs",children:a.jsx(Et,{})}),a.jsxs(yt,{children:[a.jsx(ze,{value:"campo",children:"Campo do formulário"}),a.jsx(ze,{value:"evento",children:"Variável do evento"})]})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:e.source==="evento"?"Variável do evento":"Quando o campo"}),a.jsxs($t,{value:e.when||"",onValueChange:s=>n({when:s}),children:[a.jsx(bt,{className:"h-7 text-xs",children:a.jsx(Et,{placeholder:e.source==="evento"?"Selecione uma variável...":"Selecione um campo..."})}),a.jsx(yt,{children:e.source==="evento"?fl.map(s=>a.jsx(ze,{value:s.key,children:s.label},s.key)):r.filter(s=>s!==t).map(s=>a.jsxs(ze,{value:s,children:[o(s),a.jsxs("span",{className:"text-muted-foreground/50 ml-1 text-[9px] font-mono",children:["(",s,")"]})]},s))})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:"Operador"}),a.jsxs($t,{value:e.operator,onValueChange:s=>n({operator:s}),children:[a.jsx(bt,{className:"h-7 text-xs",children:a.jsx(Et,{})}),a.jsx(yt,{children:vj.map(s=>a.jsx(ze,{value:s.value,children:s.label},s.value))})]})]}),!bj.includes(e.operator)&&a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:"Valor"}),a.jsx(de,{value:e.value||"",onChange:s=>n({value:s.target.value}),className:"h-7 text-xs",placeholder:"Valor esperado"})]})]}),yj=({condition:e,selectedId:t,allFieldIds:r,getFieldLabel:o,onChange:n})=>{var s;const l=u=>{e&&n({...e,...u})},i=()=>{if(!e)return;const u=e.extraConditions??[];n({...e,logicOperator:e.logicOperator??"and",extraConditions:[...u,{when:"",operator:"igual",value:"",source:"campo"}]})},c=u=>{if(!e)return;const h=(e.extraConditions??[]).filter((p,y)=>y!==u);n({...e,extraConditions:h,logicOperator:h.length?e.logicOperator:void 0})},d=(u,h)=>{if(!e)return;const p=(e.extraConditions??[]).map((y,f)=>f===u?{...y,...h}:y);n({...e,extraConditions:p})},m=(((s=e==null?void 0:e.extraConditions)==null?void 0:s.length)??0)>0;return a.jsxs("div",{className:"space-y-3",children:[a.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Condicional"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(We,{id:"has-condition",checked:!!e,onCheckedChange:u=>{n(u?{when:"",operator:"igual",value:"",source:"campo"}:void 0)}}),a.jsx(le,{htmlFor:"has-condition",className:"text-xs cursor-pointer",children:"Exibir condicionalmente"})]}),e&&a.jsxs("div",{className:"space-y-2 pl-2 border-l-2 border-amber-500/30",children:[a.jsx(Vi,{cond:e,selectedId:t,allFieldIds:r,getFieldLabel:o,onUpdate:l}),m&&a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:"Lógica"}),a.jsxs($t,{value:e.logicOperator??"and",onValueChange:u=>l({logicOperator:u}),children:[a.jsx(bt,{className:"h-7 text-xs",children:a.jsx(Et,{})}),a.jsxs(yt,{children:[a.jsx(ze,{value:"and",children:"E (AND) — todas devem ser verdadeiras"}),a.jsx(ze,{value:"or",children:"OU (OR) — pelo menos uma deve ser verdadeira"})]})]})]}),(e.extraConditions??[]).map((u,h)=>a.jsxs("div",{className:"space-y-2 pt-2 border-t border-border/40",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-[10px] text-muted-foreground font-medium uppercase",children:[e.logicOperator==="or"?"OU":"E"," — condição"," ",h+2]}),a.jsx($e,{variant:"ghost",size:"sm",className:"h-5 px-1 text-[10px] text-destructive hover:text-destructive",onClick:()=>c(h),children:"Remover"})]}),a.jsx(Vi,{cond:u,selectedId:t,allFieldIds:r,getFieldLabel:o,onUpdate:p=>d(h,p)})]},h)),a.jsx($e,{variant:"outline",size:"sm",className:"h-6 text-[10px] w-full mt-1",onClick:i,children:"+ Adicionar condição"})]})]})},zi=[{value:"texto",label:"Texto"},{value:"textarea",label:"Área de texto"},{value:"number",label:"Número"},{value:"email",label:"E-mail"},{value:"telefone",label:"Telefone"},{value:"cpf",label:"CPF"},{value:"cep",label:"CEP"},{value:"date",label:"Data"},{value:"datetime",label:"Data e hora"},{value:"select",label:"Seleção"},{value:"radio",label:"Radio"},{value:"checkbox",label:"Checkbox"}],wj=({subFields:e,onChange:t})=>{const[r,o]=k.useState(null),n=(l,i)=>{const c=e.map((d,m)=>m===l?{...d,...i}:d);t(c)},s=l=>{t(e.filter((i,c)=>c!==l)),o(null)};return a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(le,{className:"text-xs font-semibold",children:"Sub-campos"}),a.jsxs($e,{type:"button",variant:"ghost",size:"sm",className:"h-6 px-2 text-xs gap-1",onClick:()=>{const l={label:"Novo campo",name:`campo_${e.length+1}`,fieldType:"texto",required:!1};t([...e,l]),o(e.length)},children:[a.jsx(O.Plus,{className:"w-3 h-3"}),"Adicionar"]})]}),e.length===0&&a.jsx("p",{className:"text-[11px] text-muted-foreground italic py-1",children:"Nenhum sub-campo adicionado."}),e.map((l,i)=>{var c;return a.jsxs("div",{className:"border rounded-md text-xs overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-2 py-1.5 cursor-pointer hover:bg-muted/40 select-none",onClick:()=>o(r===i?null:i),children:[a.jsx($s,{variant:"secondary",className:"h-4 text-[9px] px-1 shrink-0",children:i+1}),a.jsx("span",{className:"flex-1 truncate font-medium",children:l.label||l.name||"Campo sem nome"}),a.jsx("span",{className:"text-muted-foreground text-[10px] shrink-0",children:((c=zi.find(d=>d.value===l.fieldType))==null?void 0:c.label)??l.fieldType}),a.jsx($e,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 text-destructive hover:text-destructive shrink-0",onClick:d=>{d.stopPropagation(),s(i)},children:a.jsx(O.Trash2,{className:"w-3 h-3"})}),r===i?a.jsx(O.ChevronUp,{className:"w-3 h-3 text-muted-foreground shrink-0"}):a.jsx(O.ChevronDown,{className:"w-3 h-3 text-muted-foreground shrink-0"})]}),r===i&&a.jsxs("div",{className:"px-2 pb-2 space-y-2 border-t bg-muted/20",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2 pt-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:"Label"}),a.jsx(de,{value:l.label,onChange:d=>n(i,{label:d.target.value}),className:"h-7 text-xs",placeholder:"Ex: Nome"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:"Nome (campo)"}),a.jsx(de,{value:l.name||"",onChange:d=>n(i,{name:d.target.value}),className:"h-7 text-xs",placeholder:"Ex: nome"})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:"Tipo de campo"}),a.jsxs($t,{value:l.fieldType,onValueChange:d=>n(i,{fieldType:d}),children:[a.jsx(bt,{className:"h-7 text-xs",children:a.jsx(Et,{})}),a.jsx(yt,{children:zi.map(d=>a.jsx(ze,{value:d.value,className:"text-xs",children:d.label},d.value))})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:"Colunas (1-12)"}),a.jsx(de,{type:"number",min:1,max:12,value:l.tamanho??"",onChange:d=>n(i,{tamanho:d.target.value?Number(d.target.value):void 0}),className:"h-7 text-xs",placeholder:"12"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-[10px]",children:"Placeholder"}),a.jsx(de,{value:l.placeholder||"",onChange:d=>n(i,{placeholder:d.target.value}),className:"h-7 text-xs",placeholder:"Texto de exemplo..."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(We,{id:`sf-req-${i}`,checked:l.required||!1,onCheckedChange:d=>n(i,{required:d===!0})}),a.jsx(le,{htmlFor:`sf-req-${i}`,className:"text-[10px] cursor-pointer",children:"Obrigatório"})]}),["select","radio","checkbox_group"].includes(l.fieldType)&&a.jsx("div",{className:"pt-1",children:a.jsx(Hp,{options:l.options||[],onChange:d=>n(i,{options:d})})})]})]},i)}),e.length>0&&a.jsx(Qe,{className:"mt-1"})]})},jj=({config:e,selectedId:t,allFieldIds:r,getFieldLabel:o,onUpdate:n})=>{const s=e.fieldType||"texto",l=["select","radio","checkbox_group","autocomplete"].includes(s),i=s==="field_array",c=e.locked===!0,d=s==="participation_type",m=s==="payment_method",u=s==="terms",h=s==="file",p=s==="slider",y=!!(e.isDisabled||e.isReadOnly),f=s==="rating",g=s==="date_range",w=s==="sub_form",{schemaId:v,uploadTermsPdf:b,deleteTermsPdf:j}=mt(),[N,S]=k.useState(e.termoPdfUploadId?"upload":"link"),[$,C]=k.useState({status:"idle"}),E=k.useRef(null),A=k.useRef(!0);k.useEffect(()=>()=>{A.current=!1},[]);const I=k.useCallback(async T=>{if(n({termoPdfUploadId:void 0}),j&&v)try{await j(T,v)}catch{}},[j,v,n]),M=k.useCallback(async T=>{if(T.type!=="application/pdf"){C({status:"error",message:"Apenas arquivos PDF são permitidos."});return}if(!v){C({status:"error",message:"Salve o schema primeiro para habilitar o upload de PDF."});return}if(!b){C({status:"error",message:"Upload de PDF não configurado. Forneça a prop uploadTermsPdf ao BuilderProvider."});return}const B=e.termoPdfUploadId;C({status:"uploading",fileName:T.name,progress:0});try{const q=await b(T,v,W=>C(X=>X.status==="uploading"?{...X,progress:W}:X));if(!A.current)return;if(B&&j)try{await j(B,v)}catch{}if(!A.current)return;n({termoPdfUploadId:q,termoPdfUrl:void 0}),C({status:"idle"})}catch(q){if(!A.current)return;C({status:"error",message:q instanceof Error?q.message:"Falha no upload do PDF."})}},[v,b,j,e.termoPdfUploadId,n]);return a.jsxs("div",{className:"space-y-4",children:[c&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-500/10 border border-amber-500/30 px-3 py-2",children:[a.jsx(O.Lock,{className:"h-4 w-4 text-amber-500 shrink-0"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-medium text-amber-600 dark:text-amber-400",children:"Campo bloqueado"}),a.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Tipo, nome e ID são fixos (integração automática)"})]})]}),d&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2",children:[a.jsx(O.Lock,{className:"h-4 w-4 text-primary shrink-0"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-medium text-primary",children:"Tipo de Participação"}),a.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Datas, preços e vagas são carregados automaticamente do evento"})]})]}),u&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-primary/5 border border-primary/30 px-3 py-2",children:[a.jsx(O.ScrollText,{className:"h-4 w-4 text-primary shrink-0"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-medium text-primary",children:"Termos e Condições"}),a.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Configure o texto ou URL do PDF abaixo"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(le,{className:"text-xs",children:"Label"}),a.jsx(Yt,{})]}),a.jsx(de,{value:e.label,onChange:T=>n({label:T.target.value}),className:"h-8 text-sm"})]}),d||m?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Dica (hint)"}),a.jsx(de,{value:e.hint||"",onChange:T=>n({hint:T.target.value}),className:"h-8 text-sm",placeholder:"Texto de ajuda abaixo do campo"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(We,{id:"req",checked:e.required||!1,onCheckedChange:T=>n({required:T===!0})}),a.jsx(le,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]})]}):u?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Dica (hint)"}),a.jsx(de,{value:e.hint||"",onChange:T=>n({hint:T.target.value}),className:"h-8 text-sm",placeholder:"Ex: Leia os termos antes de continuar"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(We,{id:"req",checked:e.required||!1,onCheckedChange:T=>n({required:T===!0})}),a.jsx(le,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),a.jsx(Qe,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Conteúdo dos termos"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Texto dos termos"}),a.jsx(jo,{value:e.termoTexto||"",onChange:T=>n({termoTexto:T.target.value||void 0}),className:"text-sm min-h-[120px] resize-y",placeholder:"Escreva aqui os termos e condições que o usuário deverá ler e aceitar..."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(le,{className:"text-xs",children:"PDF dos termos (opcional)"}),a.jsxs("div",{className:"flex gap-1 p-0.5 bg-muted rounded-md",children:[a.jsx("button",{type:"button",onClick:()=>S("link"),className:`flex-1 text-[11px] py-1 rounded transition-colors ${N==="link"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Link externo"}),a.jsx("button",{type:"button",onClick:()=>S("upload"),className:`flex-1 text-[11px] py-1 rounded transition-colors ${N==="upload"?"bg-background shadow-sm font-medium":"text-muted-foreground hover:text-foreground"}`,children:"Upload de PDF"})]}),N==="link"?a.jsxs("div",{className:"space-y-1",children:[a.jsx(de,{value:e.termoPdfUrl||"",onChange:T=>n({termoPdfUrl:T.target.value||void 0}),className:"h-8 text-sm",placeholder:"https://exemplo.com/termos.pdf"}),a.jsx("p",{className:"text-[9px] text-muted-foreground",children:"URL pública de um PDF. Tem prioridade sobre o texto acima."})]}):a.jsxs("div",{className:"space-y-2",children:[e.termoPdfUploadId&&$.status==="idle"?a.jsxs("div",{className:"flex items-center gap-2 rounded border border-green-500/40 bg-green-500/10 px-2 py-1.5",children:[a.jsx(O.CheckCircle2,{className:"h-3.5 w-3.5 text-green-600 shrink-0"}),a.jsx("span",{className:"text-[11px] text-green-700 dark:text-green-400 flex-1",children:"PDF enviado ✓"}),a.jsx($e,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5",onClick:()=>I(e.termoPdfUploadId),children:a.jsx(O.X,{className:"h-3 w-3"})})]}):null,$.status==="uploading"?a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2 text-[11px] text-muted-foreground",children:[a.jsx(O.Loader2,{className:"h-3.5 w-3.5 animate-spin"}),a.jsx("span",{className:"truncate",children:$.fileName}),a.jsxs("span",{className:"ml-auto",children:[$.progress,"%"]})]}),a.jsx(Js,{value:$.progress,className:"h-1"})]}):null,$.status==="error"?a.jsxs("div",{className:"flex items-center gap-2 rounded border border-destructive/40 bg-destructive/10 px-2 py-1.5",children:[a.jsx(O.AlertCircle,{className:"h-3.5 w-3.5 text-destructive shrink-0"}),a.jsx("span",{className:"text-[11px] text-destructive",children:$.message}),a.jsx($e,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 ml-auto",onClick:()=>C({status:"idle"}),children:a.jsx(O.X,{className:"h-3 w-3"})})]}):null,$.status!=="uploading"?a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:E,type:"file",accept:"application/pdf",className:"hidden",onChange:T=>{var B;const q=(B=T.target.files)==null?void 0:B[0];q&&M(q),T.target.value=""}}),a.jsxs($e,{type:"button",variant:"outline",size:"sm",className:"w-full h-8 text-xs gap-1.5",disabled:!v,onClick:()=>{var T;return(T=E.current)==null?void 0:T.click()},children:[a.jsx(O.Upload,{className:"h-3.5 w-3.5"}),e.termoPdfUploadId?"Substituir PDF":"Selecionar PDF"]}),!v&&a.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Salve o schema uma vez para habilitar o upload."})]}):null]})]})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Nome (chave)"}),a.jsx(de,{value:e.name||t.replace(/^field_/,""),onChange:T=>!c&&n({name:T.target.value}),className:"h-8 text-xs font-mono",placeholder:"nome_do_campo",disabled:c}),c?a.jsx("p",{className:"text-[9px] text-amber-500",children:"ID fixo — necessário para auto-preenchimento"}):a.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Usado como chave no JSON do formulário"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Tipo do campo"}),a.jsxs($t,{value:s,onValueChange:T=>!c&&n({fieldType:T}),disabled:c,children:[a.jsx(bt,{className:"h-8 text-sm",children:a.jsx(Et,{})}),a.jsx(yt,{children:dr.map(T=>a.jsx(ze,{value:T.component,children:T.label},T.component))})]})]}),a.jsx(Bp,{tamanho:e.tamanho||6,inicioColuna:e.inicioColuna||1,defaultTamanho:6,onTamanhoChange:T=>n({tamanho:T}),onPositionChange:T=>n({inicioColuna:T})}),s!=="file"&&!i&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(le,{className:"text-xs",children:"Placeholder"}),a.jsx(Yt,{})]}),a.jsx(de,{value:e.placeholder||"",onChange:T=>n({placeholder:T.target.value}),className:"h-8 text-sm",placeholder:"Texto de exemplo..."})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(le,{className:"text-xs",children:"Dica (hint)"}),a.jsx(Yt,{})]}),a.jsx(de,{value:e.hint||"",onChange:T=>n({hint:T.target.value}),className:"h-8 text-sm",placeholder:"Texto de ajuda abaixo do campo"})]}),s!=="file"&&!i&&!w&&a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Valor padrão"}),a.jsx(de,{value:e.defaultValue||"",onChange:T=>n({defaultValue:T.target.value}),className:"h-8 text-sm",placeholder:"Valor inicial do campo"})]}),s!=="file"&&!i&&!w&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(le,{className:"text-xs",children:"Valor inicial (runtime)"}),a.jsx(Yt,{})]}),a.jsx(de,{value:e.initialValue||"",onChange:T=>n({initialValue:T.target.value||void 0}),className:"h-8 text-sm",placeholder:"{{evento.nome}} ou valor fixo"}),a.jsxs("p",{className:"text-[9px] text-muted-foreground",children:['Sobrepõe "Valor padrão" — suporta variáveis'," ",a.jsx("code",{children:"{{evento.x}}"})]})]}),!i&&!w&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(We,{id:"req",checked:e.required||!1,onCheckedChange:T=>n({required:T===!0})}),a.jsx(le,{htmlFor:"req",className:"text-xs cursor-pointer",children:"Campo obrigatório"})]}),!i&&!w&&!c&&!h&&a.jsxs("div",{className:"flex flex-col gap-1.5",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(We,{id:"readonly",checked:e.isReadOnly||!1,onCheckedChange:T=>n({isReadOnly:T===!0||void 0})}),a.jsx(le,{htmlFor:"readonly",className:"text-xs cursor-pointer",children:"Somente leitura"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(We,{id:"disabled",checked:e.isDisabled||!1,onCheckedChange:T=>n({isDisabled:T===!0||void 0})}),a.jsx(le,{htmlFor:"disabled",className:"text-xs cursor-pointer",children:"Desabilitado"})]})]}),p&&a.jsxs(a.Fragment,{children:[a.jsx(Qe,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Slider"}),a.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Mínimo"}),a.jsx(de,{type:"number",value:e.minValue??0,onChange:T=>n({minValue:Number(T.target.value)}),className:"h-8 text-sm"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Máximo"}),a.jsx(de,{type:"number",value:e.maxValue??100,onChange:T=>n({maxValue:Number(T.target.value)}),className:"h-8 text-sm"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Passo"}),a.jsx(de,{type:"number",min:1,value:e.step??1,onChange:T=>n({step:Number(T.target.value)}),className:"h-8 text-sm"})]})]})]})]}),f&&a.jsxs(a.Fragment,{children:[a.jsx(Qe,{}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Avaliação"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Número de estrelas"}),a.jsxs($t,{value:String(e.maxRating??5),onValueChange:T=>n({maxRating:Number(T)}),children:[a.jsx(bt,{className:"h-8 text-sm",children:a.jsx(Et,{})}),a.jsx(yt,{children:[3,4,5,6,7,10].map(T=>a.jsxs(ze,{value:String(T),children:[T," estrelas"]},T))})]})]})]})]}),g&&a.jsxs(a.Fragment,{children:[a.jsx(Qe,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Período"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Label da data inicial"}),a.jsx(de,{value:e.dateRangeStartLabel??"Data inicial",onChange:T=>n({dateRangeStartLabel:T.target.value}),className:"h-8 text-sm"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Label da data final"}),a.jsx(de,{value:e.dateRangeEndLabel??"Data final",onChange:T=>n({dateRangeEndLabel:T.target.value}),className:"h-8 text-sm"})]})]})]}),!i&&a.jsx(Qe,{}),!i&&!u&&!y&&a.jsx(gj,{fieldType:s,validation:e.validation,onChange:T=>n({validation:T})}),l&&a.jsxs(a.Fragment,{children:[a.jsx(Qe,{}),s==="radio"&&a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Estilo visual"}),a.jsxs($t,{value:e.visualStyle||"card",onValueChange:T=>n({visualStyle:T}),children:[a.jsx(bt,{className:"h-8 text-sm",children:a.jsx(Et,{})}),a.jsxs(yt,{children:[a.jsx(ze,{value:"card",children:"Card (padrão)"}),a.jsx(ze,{value:"default",children:"Radio simples"})]})]})]}),a.jsx(Hp,{options:e.options||[],onChange:T=>n({options:T})})]}),i&&a.jsxs(a.Fragment,{children:[a.jsx(Qe,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase",children:"Lista de itens"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Mín. itens"}),a.jsx(de,{type:"number",min:0,value:e.minItems??"",onChange:T=>n({minItems:T.target.value?Number(T.target.value):void 0}),className:"h-8 text-sm",placeholder:"0"})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Máx. itens"}),a.jsx(de,{type:"number",min:0,value:e.maxItems??"",onChange:T=>n({maxItems:T.target.value?Number(T.target.value):void 0}),className:"h-8 text-sm",placeholder:"Sem limite"})]})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Label do item"}),a.jsx(de,{value:e.itemLabel||"",onChange:T=>n({itemLabel:T.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Contato"}),a.jsx("p",{className:"text-[9px] text-muted-foreground",children:'Prefixo exibido em cada item (ex: "Contato 1", "Contato 2")'})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Label do botão adicionar"}),a.jsx(de,{value:e.addLabel||"",onChange:T=>n({addLabel:T.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Adicionar contato"})]}),a.jsx("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/5 px-3 py-2",children:a.jsx("p",{className:"text-[11px] text-amber-700 dark:text-amber-400",children:"Os sub-campos são configurados visualmente no canvas: arraste campos da paleta para dentro da caixa laranja."})})]})]}),w&&a.jsxs(a.Fragment,{children:[a.jsx(Qe,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("h4",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Sub-formulário"}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Título do grupo (opcional)"}),a.jsx(de,{value:e.subSchemaTitle||"",onChange:T=>n({subSchemaTitle:T.target.value||void 0}),className:"h-8 text-sm",placeholder:"Ex: Endereço, Responsável..."})]}),a.jsx(wj,{subFields:e.subSchemaFields||[],onChange:T=>n({subSchemaFields:T})})]})]}),!y&&!u&&a.jsxs(a.Fragment,{children:[a.jsx(Qe,{}),a.jsx(yj,{condition:e.condition,selectedId:t,allFieldIds:r,getFieldLabel:o,onChange:T=>n({condition:T})})]}),!y&&!u&&e.condition&&a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs",children:"Valor ao ocultar (clearedValue)"}),a.jsx(de,{value:e.clearedValue??"",onChange:T=>n({clearedValue:T.target.value||void 0}),className:"h-8 text-sm",placeholder:"Deixar vazio = não limpar"}),a.jsx("p",{className:"text-[9px] text-muted-foreground",children:"Valor aplicado automaticamente quando o campo fica oculto."})]}),!i&&!w&&a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{className:"text-xs text-muted-foreground",children:"Resolver de props (avançado)"}),a.jsx(de,{value:e.resolvePropsKey||"",onChange:T=>n({resolvePropsKey:T.target.value||void 0}),className:"h-8 text-xs font-mono",placeholder:"chaveDoResolver"}),a.jsxs("p",{className:"text-[9px] text-muted-foreground",children:["Registre este key em"," ",a.jsx("code",{children:"RendererContext.fieldResolvers"})," para opções dinâmicas."]})]})]})]})},Nj={glassmorphism:"Glass",card:"Card",flat:"Flat",bordered:"Bordered"},Wp=()=>{const{previewTemplateId:e,setPreviewTemplateId:t}=mt(),[r,o]=k.useState(!1),n=Object.values(Cr),s=Cr[e];return a.jsxs(Uo,{open:r,onOpenChange:o,children:[a.jsx(Ho,{asChild:!0,children:a.jsxs($e,{variant:"outline",size:"sm",className:"gap-1.5",title:"Selecionar template visual",children:[a.jsx("span",{className:"w-3.5 h-3.5 rounded-full shrink-0 border border-white/20",style:{background:(s==null?void 0:s.colors.primary)??"#3b82f6"}}),a.jsx(O.Palette,{className:"w-3.5 h-3.5"}),a.jsx("span",{className:"hidden sm:inline",children:(s==null?void 0:s.displayName)??"Template"})]})}),a.jsxs($a,{side:"bottom",align:"end",className:"w-80 p-3",children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-2 uppercase tracking-wider",children:"Template de Preview"}),a.jsx("div",{className:"grid grid-cols-3 gap-1.5 max-h-72 overflow-y-auto pr-0.5",children:n.map(l=>{const i=l.id===e,c=dc(l),d=Nj[l.layout.containerStyle]??"";return a.jsxs("button",{onClick:()=>{t(l.id),o(!1)},className:At("relative flex flex-col items-center gap-1.5 rounded-lg p-2 border text-center transition-all hover:scale-[1.02]",i?"border-primary ring-1 ring-primary":"border-border hover:border-muted-foreground/40"),children:[a.jsxs("div",{className:"w-full h-8 rounded-md flex items-center justify-center gap-0.5",style:{background:l.colors.background.startsWith("#")||l.colors.background.startsWith("rgba")?l.colors.background:void 0},"data-muted":!l.colors.background.startsWith("#")&&!l.colors.background.startsWith("rgba")?"true":void 0,children:[a.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:l.colors.primary}}),a.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:l.colors.accent}})]}),a.jsx("span",{className:"text-[10px] font-medium leading-tight line-clamp-2",children:l.displayName}),a.jsxs("div",{className:"flex items-center gap-0.5 flex-wrap justify-center",children:[c&&a.jsx("span",{className:"text-[9px] px-1 rounded bg-zinc-800 text-zinc-300",children:"dark"}),d&&a.jsx("span",{className:"text-[9px] px-1 rounded bg-muted text-muted-foreground",children:d})]}),i&&a.jsx("div",{className:"absolute top-1 right-1",children:a.jsx(O.Check,{className:"w-3 h-3 text-primary"})})]},l.id)})})]})]})},Cj=[{value:"numbers",label:"Números"},{value:"icons",label:"Ícones"},{value:"icons-labeled",label:"Ícones + rótulo"}],kj=[{value:"top-center",label:"Centralizado"},{value:"top-left",label:"Esquerda"}],Sj=[{value:"horizontal",label:"Horizontal"},{value:"vertical",label:"Vertical (sidebar)"}],$j=()=>{const{stepConfig:e,updateStepConfig:t}=mt();return a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Template visual"}),a.jsx(Wp,{})]}),a.jsx(Qe,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Indicador de steps"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(We,{id:"sc-show-indicators",checked:e.showStepIndicators!==!1,onCheckedChange:r=>t({showStepIndicators:r===!0})}),a.jsx(le,{htmlFor:"sc-show-indicators",className:"text-xs cursor-pointer",children:"Exibir indicador de steps"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(We,{id:"sc-show-progress",checked:e.showProgressBar===!0,onCheckedChange:r=>t({showProgressBar:r===!0})}),a.jsx(le,{htmlFor:"sc-show-progress",className:"text-xs cursor-pointer",children:"Exibir barra de progresso"})]})]}),a.jsx(Qe,{}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(le,{className:"text-xs",children:"Variante visual"}),a.jsx("div",{className:"flex flex-col gap-1.5",children:Cj.map(r=>a.jsx("button",{type:"button",onClick:()=>t({stepIndicatorVariant:r.value}),className:`text-left text-xs px-3 py-1.5 rounded-md border transition-colors ${e.stepIndicatorVariant===r.value?"border-primary bg-primary/10 text-primary font-medium":"border-border bg-muted/30 text-muted-foreground hover:bg-muted/60"}`,children:r.label},r.value))}),!e.stepIndicatorVariant&&a.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Herdado do template"})]}),a.jsx(Qe,{}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(le,{className:"text-xs",children:"Orientação"}),a.jsx("div",{className:"flex gap-2",children:Sj.map(r=>a.jsx("button",{type:"button",onClick:()=>t({stepIndicatorOrientation:r.value}),className:`flex-1 text-xs px-2 py-1.5 rounded-md border transition-colors ${e.stepIndicatorOrientation===r.value?"border-primary bg-primary/10 text-primary font-medium":"border-border bg-muted/30 text-muted-foreground hover:bg-muted/60"}`,children:r.label},r.value))}),!e.stepIndicatorOrientation&&a.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Herdado do template"})]}),a.jsx(Qe,{}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(le,{className:"text-xs",children:"Posição (desktop)"}),a.jsx("div",{className:"flex gap-2",children:kj.map(r=>a.jsx("button",{type:"button",onClick:()=>t({stepIndicatorPosition:r.value}),className:`flex-1 text-xs px-2 py-1.5 rounded-md border transition-colors ${e.stepIndicatorPosition===r.value?"border-primary bg-primary/10 text-primary font-medium":"border-border bg-muted/30 text-muted-foreground hover:bg-muted/60"}`,children:r.label},r.value))}),!e.stepIndicatorPosition&&a.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Herdado do template"})]})]})},Ej=()=>{const{selectedId:e,getConfig:t,updateConfig:r,getAllFieldIds:o}=mt();if(!e)return a.jsxs("div",{className:"rounded-xl border bg-card p-4 space-y-4 max-h-[calc(100vh-160px)] overflow-y-auto",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Formulário"})}),a.jsx(Qe,{}),a.jsx($j,{})]});const n=t(e),s=Ve(e),l=c=>r(e,c),i=o().filter(c=>c!==e);return a.jsxs("div",{className:"rounded-xl border bg-card p-4 space-y-4 max-h-[calc(100vh-160px)] overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-bold text-foreground",children:s==="step"?"Step":s==="container"?"Container":"Campo"}),a.jsx("span",{className:"text-[10px] font-mono text-muted-foreground",children:e})]}),a.jsx(Qe,{}),s==="step"&&a.jsx(ij,{config:n,onUpdate:l}),s==="container"&&a.jsx(dj,{config:n,onUpdate:l}),s==="field"&&a.jsx(jj,{config:n,selectedId:e,allFieldIds:i,getFieldLabel:c=>t(c).label||c,onUpdate:l})]})},_n=e=>({when:e.campoId,operator:e.operador,value:e.valor,source:e.source}),qp=e=>{var t;const r={campoId:e.when,operador:e.operator,valor:e.value,source:e.source};if(e.logicOperator&&(t=e.extraConditions)!=null&&t.length){const o=e.extraConditions.map(s=>({campoId:s.when,operador:s.operator,valor:s.value,source:s.source})),n=[r,...o];return e.logicOperator==="or"?{or:n}:{and:n}}return r},Xp=e=>{if("campoId"in e)return _n(e);const t=("and"in e?e.and:e.or)??[];if(t.length===0)return;const r="and"in e?"and":"or",[o,...n]=t;if(!("campoId"in o)){console.warn("[formSchemaToBuilder] Condicional com grupo aninhado detectada — não suportado no editor visual. A condicional será removida.",e);return}const s=_n(o);return n.length===0?s:{...s,logicOperator:r,extraConditions:n.filter(l=>"campoId"in l).map(_n)}},fo=(e,t)=>{var r;if("campoId"in e){const o=(r=t[e.campoId])==null?void 0:r.name;return o?{...e,campoId:o}:e}return"and"in e&&Array.isArray(e.and)?{and:e.and.map(o=>fo(o,t))}:"or"in e&&Array.isArray(e.or)?{or:e.or.map(o=>fo(o,t))}:e},Gp=(e,t,r)=>{var o,n;const s=i=>t[i]||{label:i,name:i},l=(((n=(o=e==null?void 0:e.containers)==null?void 0:o.root)==null?void 0:n.children)||[]).filter(i=>Ve(i)==="step").map((i,c)=>{var d,m;const u=s(i),h=(((m=(d=e==null?void 0:e.containers)==null?void 0:d[i])==null?void 0:m.children)||[]).filter(p=>Ve(p)==="container").map((p,y)=>{var f,g;const w=s(p),v=(((g=(f=e==null?void 0:e.containers)==null?void 0:f[p])==null?void 0:g.children)||[]).filter(j=>Ve(j)==="field").map((j,N)=>{var S,$;const C=s(j),E=ds(C,j,N);if(E.condicional&&(E.condicional=fo(E.condicional,t)),E.tipo===_.FIELD_ARRAY){const A=(($=(S=e==null?void 0:e.containers)==null?void 0:S[j])==null?void 0:$.children)??[];E.subFields=A.filter(I=>Ve(I)==="field").map((I,M)=>ds(s(I),I,M))}return E}),b={id:p,titulo:w.label||"Container",descricao:w.description,icone:w.icone,ordem:y,colunas:w.columns||2,tamanho:w.tamanho||12,inicioColuna:w.inicioColuna,showLabel:w.showLabel,showAsCard:w.showAsCard,campos:v};return w.condition&&(b.condicional=fo(qp(w.condition),t)),b});return{id:i,titulo:u.label||"Step",descricao:u.description,icone:u.icone,ordem:c,showLabel:u.showLabel,containers:h}});return{id:r.id||"",nome:r.nome,descricao:r.descricao,status:r.status,template:r.template??null,stepConfig:r.stepConfig&&Object.keys(r.stepConfig).length>0?r.stepConfig:void 0,steps:l}},ds=(e,t,r)=>{var o,n,s,l;const i={id:t,nome:e.name||t,label:e.label||"",tipo:e.fieldType||"texto",obrigatorio:e.required||!1,tamanho:e.tamanho||6,inicioColuna:e.inicioColuna,ordem:r,placeholder:e.placeholder,hint:e.hint,defaultValue:e.defaultValue,mascara:e.mascara,mascaraCustom:e.mascaraCustom,locked:e.locked||void 0,visualStyle:e.visualStyle,isReadOnly:e.isReadOnly||void 0,isDisabled:e.isDisabled||void 0,clearedValue:e.clearedValue!==void 0?e.clearedValue:void 0,initialValue:e.initialValue!==void 0?e.initialValue:void 0,resolvePropsKey:e.resolvePropsKey||void 0};if((o=e.validate)!=null&&o.length&&(i.validate=e.validate),(n=e.warn)!=null&&n.length&&(i.warn=e.warn),(s=e.options)!=null&&s.length&&(i.opcoes=e.options.map(c=>({valor:c.value,label:c.label,disabled:c.disabled}))),e.validation){const c=e.validation;i.validacao={},c.minLength!==void 0&&(i.validacao.minLength=c.minLength),c.maxLength!==void 0&&(i.validacao.maxLength=c.maxLength),c.min!==void 0&&(i.validacao.min=c.min),c.max!==void 0&&(i.validacao.max=c.max),c.regex&&(i.validacao.regex=c.regex),c.regexMessage&&(i.validacao.regexMessage=c.regexMessage),c.minDate&&(i.validacao.minDate=c.minDate),c.maxDate&&(i.validacao.maxDate=c.maxDate),c.minAge!==void 0&&(i.validacao.minAge=c.minAge),c.maxAge!==void 0&&(i.validacao.maxAge=c.maxAge),(l=c.fileTypes)!=null&&l.length&&(i.validacao.fileTypes=c.fileTypes),c.maxFileSize!==void 0&&(i.validacao.maxFileSize=c.maxFileSize)}if(i.tipo===_.FIELD_ARRAY&&(e.itemLabel&&(i.itemLabel=e.itemLabel),e.minItems!==void 0&&(i.minItems=e.minItems),e.maxItems!==void 0&&(i.maxItems=e.maxItems),e.addLabel&&(i.addLabel=e.addLabel)),i.tipo===_.TERMS&&(e.termoTexto&&(i.termoTexto=e.termoTexto),e.termoPdfUrl&&(i.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(i.termoPdfUploadId=e.termoPdfUploadId)),i.tipo===_.SLIDER&&(e.step!==void 0&&(i.step=e.step),e.minValue!==void 0&&(i.minValue=e.minValue),e.maxValue!==void 0&&(i.maxValue=e.maxValue)),i.tipo===_.RATING&&e.maxRating!==void 0&&(i.maxRating=e.maxRating),i.tipo===_.DATE_RANGE&&(e.dateRangeStartLabel&&(i.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(i.dateRangeEndLabel=e.dateRangeEndLabel)),i.tipo===_.SUB_FORM){const c=e.subSchemaFields??[];(c.length>0||e.subSchemaTitle)&&(i.subSchema={titulo:e.subSchemaTitle,fields:c.map((d,m)=>ds(d,d.name??`subfield-${m}`,m))})}return e.condition&&(i.condicional=qp(e.condition)),i},Kp=e=>{const t={},r={root:{children:[]}},o=[...e.steps].sort((n,s)=>n.ordem-s.ordem);for(const n of o){const s=n.id||`step-${pt()}`;r.root.children.push(s),t[s]={label:n.titulo,name:s,fieldType:"step",description:n.descricao,icone:n.icone,showLabel:n.showLabel};const l=[],i=[...n.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of i){const d=c.id||`container-${pt()}`;l.push(d);const m=c.condicional?Xp(c.condicional):void 0;t[d]={label:c.titulo,name:d,fieldType:"container",description:c.descricao,icone:c.icone,columns:c.colunas,tamanho:c.tamanho||12,inicioColuna:c.inicioColuna,showLabel:c.showLabel,showAsCard:c.showAsCard,...m?{condition:m}:{}};const u=[],h=[...c.campos].sort((p,y)=>p.ordem-y.ordem);for(const p of h){const y=p.id||`${p.tipo}-${pt()}`;if(u.push(y),t[y]=us(p),p.tipo===_.FIELD_ARRAY){const f=[];for(const g of p.subFields??[]){const w=g.id||`${g.tipo}-${pt()}`;f.push(w),t[w]=us(g)}r[y]={children:f}}}r[d]={children:u}}r[s]={children:l}}return{dndState:{containers:r},configs:t,templateId:e.template??null,stepConfig:e.stepConfig}},us=(e,t)=>{var r,o,n,s;const l={label:e.label,name:e.nome,fieldType:e.tipo,required:e.obrigatorio,tamanho:e.tamanho,inicioColuna:e.inicioColuna,placeholder:e.placeholder,hint:e.hint,defaultValue:e.defaultValue,mascara:e.mascara,mascaraCustom:e.mascaraCustom,locked:e.locked||void 0,visualStyle:e.visualStyle,isReadOnly:e.isReadOnly||void 0,isDisabled:e.isDisabled||void 0,clearedValue:e.clearedValue!==void 0?String(e.clearedValue??""):void 0,initialValue:e.initialValue!==void 0?String(e.initialValue):void 0,resolvePropsKey:e.resolvePropsKey||void 0,validate:(r=e.validate)!=null&&r.length?e.validate:void 0,warn:(o=e.warn)!=null&&o.length?e.warn:void 0};if((n=e.opcoes)!=null&&n.length&&(l.options=e.opcoes.map(i=>({value:i.valor,label:i.label,disabled:i.disabled}))),e.validacao){const i=e.validacao;l.validation={},i.minLength!==void 0&&(l.validation.minLength=i.minLength),i.maxLength!==void 0&&(l.validation.maxLength=i.maxLength),i.min!==void 0&&(l.validation.min=i.min),i.max!==void 0&&(l.validation.max=i.max),i.regex&&(l.validation.regex=i.regex),i.regexMessage&&(l.validation.regexMessage=i.regexMessage),i.minDate&&(l.validation.minDate=i.minDate),i.maxDate&&(l.validation.maxDate=i.maxDate),i.minAge!==void 0&&(l.validation.minAge=i.minAge),i.maxAge!==void 0&&(l.validation.maxAge=i.maxAge),(s=i.fileTypes)!=null&&s.length&&(l.validation.fileTypes=i.fileTypes),i.maxFileSize!==void 0&&(l.validation.maxFileSize=i.maxFileSize)}if(e.tipo===_.FIELD_ARRAY&&(e.itemLabel&&(l.itemLabel=e.itemLabel),e.minItems!==void 0&&(l.minItems=e.minItems),e.maxItems!==void 0&&(l.maxItems=e.maxItems),e.addLabel&&(l.addLabel=e.addLabel)),e.tipo===_.TERMS&&(e.termoTexto&&(l.termoTexto=e.termoTexto),e.termoPdfUrl&&(l.termoPdfUrl=e.termoPdfUrl),e.termoPdfUploadId&&(l.termoPdfUploadId=e.termoPdfUploadId)),e.tipo===_.SLIDER&&(e.step!==void 0&&(l.step=e.step),e.minValue!==void 0&&(l.minValue=e.minValue),e.maxValue!==void 0&&(l.maxValue=e.maxValue)),e.tipo===_.RATING&&e.maxRating!==void 0&&(l.maxRating=e.maxRating),e.tipo===_.DATE_RANGE&&(e.dateRangeStartLabel&&(l.dateRangeStartLabel=e.dateRangeStartLabel),e.dateRangeEndLabel&&(l.dateRangeEndLabel=e.dateRangeEndLabel)),e.tipo===_.SUB_FORM&&e.subSchema&&(l.subSchemaTitle=e.subSchema.titulo,l.subSchemaFields=e.subSchema.fields.map(i=>us(i,i.id))),e.condicional){const i=Xp(e.condicional);i&&(l.condition=i)}return l},Aj=(e,t)=>{var r,o,n,s,l,i,c,d,m,u,h;const p=[],y=[],f=v=>t[v]||{label:v,name:v},g=((o=(r=e==null?void 0:e.containers)==null?void 0:r.root)==null?void 0:o.children)||[],w=new Set;for(const v of g){if(Ve(v)!=="step")continue;const b=f(v).label||v,j=((s=(n=e==null?void 0:e.containers)==null?void 0:n[v])==null?void 0:s.children)||[];if(j.length===0){y.push(`Step "${b}" está vazio (sem containers).`);continue}for(const N of j){if(Ve(N)!=="container")continue;const S=f(N).label||N,$=((i=(l=e==null?void 0:e.containers)==null?void 0:l[N])==null?void 0:i.children)||[],C=new Map;for(const E of $){if(Ve(E)!=="field")continue;w.add(E);const A=f(E).name;(!A||!A.trim())&&p.push(`Campo "${f(E).label||E}" (${E}) no container "${S}" não tem nome definido.`);const I=A||E;C.has(I)||C.set(I,[]),C.get(I).push(E)}for(const[E,A]of C.entries())A.length>1&&p.push(`Nome duplicado "${E}" no container "${S}" (IDs: ${A.join(", ")}).`)}}for(const[v,b]of Object.entries(t)){if(!((c=b.condition)!=null&&c.when))continue;const j=b.condition.when;if(!w.has(j)){const N=b.label||v;y.push(`Campo "${N}" referencia campo inexistente na condição (when: "${j}").`)}}for(const v of g){if(Ve(v)!=="step")continue;const b=f(v).label||v,j=((m=(d=e==null?void 0:e.containers)==null?void 0:d[v])==null?void 0:m.children)||[],N=new Map;for(const S of j){if(Ve(S)!=="container")continue;const $=((h=(u=e==null?void 0:e.containers)==null?void 0:u[S])==null?void 0:h.children)||[];for(const C of $){if(Ve(C)!=="field")continue;const E=f(C).name||C;N.has(E)||N.set(E,new Set),N.get(E).add(S)}}for(const[S,$]of N.entries())$.size>1&&p.push(`Nome duplicado "${S}" no step "${b}" em containers diferentes (containers: ${[...$].join(", ")}). Isso causa colisão no formulário.`)}return{errors:p,warnings:y}};var Aa=e=>e.type==="checkbox",Nr=e=>e instanceof Date,it=e=>e==null;const Yp=e=>typeof e=="object";var qe=e=>!it(e)&&!Array.isArray(e)&&Yp(e)&&!Nr(e),Zp=e=>qe(e)&&e.target?Aa(e.target)?e.target.checked:e.target.value:e,_j=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Jp=(e,t)=>e.has(_j(t)),Tj=e=>{const t=e.constructor&&e.constructor.prototype;return qe(t)&&t.hasOwnProperty("isPrototypeOf")},vl=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Ie(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(vl&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(qe(e)&&Tj(e)))return e;const o=r?[]:Object.create(Object.getPrototypeOf(e));for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(o[n]=Ie(e[n]));return o}var rn=e=>/^\w*$/.test(e),Pe=e=>e===void 0,an=e=>Array.isArray(e)?e.filter(Boolean):[],bl=e=>an(e.replace(/["|']|\]/g,"").split(/\.|\[/)),oe=(e,t,r)=>{if(!t||!qe(e))return r;const o=(rn(t)?[t]:bl(t)).reduce((n,s)=>it(n)?n:n[s],e);return Pe(o)||o===e?Pe(e[t])?r:e[t]:o},ft=e=>typeof e=="boolean",nt=e=>typeof e=="function",De=(e,t,r)=>{let o=-1;const n=rn(t)?[t]:bl(t),s=n.length,l=s-1;for(;++o<s;){const i=n[o];let c=r;if(o!==l){const d=e[i];c=qe(d)||Array.isArray(d)?d:isNaN(+n[o+1])?{}:[]}if(i==="__proto__"||i==="constructor"||i==="prototype")return;e[i]=c,e=e[i]}};const ho={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},kt={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Kt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},yl=k.createContext(null);yl.displayName="HookFormControlContext";const on=()=>k.useContext(yl);var Qp=(e,t,r,o=!0)=>{const n={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(n,s,{get:()=>{const l=s;return t._proxyFormState[l]!==kt.all&&(t._proxyFormState[l]=!o||kt.all),r&&(r[l]=!0),e[l]}});return n};const nn=typeof window<"u"?k.useLayoutEffect:k.useEffect;function ef(e){const t=on(),{control:r=t,disabled:o,name:n,exact:s}=e||{},[l,i]=k.useState(r._formState),c=k.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return nn(()=>r._subscribe({name:n,formState:c.current,exact:s,callback:d=>{!o&&i({...r._formState,...d})}}),[n,o,s]),k.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),k.useMemo(()=>Qp(l,r,c.current,!1),[l,r])}var xt=e=>typeof e=="string",ms=(e,t,r,o,n)=>xt(e)?(o&&t.watch.add(e),oe(r,e,n)):Array.isArray(e)?e.map(s=>(o&&t.watch.add(s),oe(r,s))):(o&&(t.watchAll=!0),r),ps=e=>it(e)||!Yp(e);function Dt(e,t,r=new WeakSet){if(ps(e)||ps(t))return Object.is(e,t);if(Nr(e)&&Nr(t))return Object.is(e.getTime(),t.getTime());const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const s of o){const l=e[s];if(!n.includes(s))return!1;if(s!=="ref"){const i=t[s];if(Nr(l)&&Nr(i)||qe(l)&&qe(i)||Array.isArray(l)&&Array.isArray(i)?!Dt(l,i,r):!Object.is(l,i))return!1}}return!0}function na(e){const t=on(),{control:r=t,name:o,defaultValue:n,disabled:s,exact:l,compute:i}=e||{},c=k.useRef(n),d=k.useRef(i),m=k.useRef(void 0),u=k.useRef(r),h=k.useRef(o);d.current=i;const[p,y]=k.useState(()=>{const j=r._getWatch(o,c.current);return d.current?d.current(j):j}),f=k.useCallback(j=>{const N=ms(o,r._names,j||r._formValues,!1,c.current);return d.current?d.current(N):N},[r._formValues,r._names,o]),g=k.useCallback(j=>{if(!s){const N=ms(o,r._names,j||r._formValues,!1,c.current);if(d.current){const S=d.current(N);Dt(S,m.current)||(y(S),m.current=S)}else y(N)}},[r._formValues,r._names,s,o]);nn(()=>((u.current!==r||!Dt(h.current,o))&&(u.current=r,h.current=o,g()),r._subscribe({name:o,formState:{values:!0},exact:l,callback:j=>{g(j.values)}})),[r,l,o,g]),k.useEffect(()=>r._removeUnmounted());const w=u.current!==r,v=h.current,b=k.useMemo(()=>{if(s)return null;const j=!w&&!Dt(v,o);return w||j?f():null},[s,w,o,v,f]);return b!==null?b:p}function Fe(e){const t=on(),{name:r,disabled:o,control:n=t,shouldUnregister:s,defaultValue:l,exact:i=!0}=e,c=Jp(n._names.array,r),d=k.useMemo(()=>oe(n._formValues,r,oe(n._defaultValues,r,l)),[n,r,l]),m=na({control:n,name:r,defaultValue:d,exact:i}),u=ef({control:n,name:r,exact:i}),h=k.useRef(e),p=k.useRef(void 0),y=k.useRef(n.register(r,{...e.rules,value:m,...ft(e.disabled)?{disabled:e.disabled}:{}}));h.current=e;const f=k.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!oe(u.errors,r)},isDirty:{enumerable:!0,get:()=>!!oe(u.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!oe(u.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!oe(u.validatingFields,r)},error:{enumerable:!0,get:()=>oe(u.errors,r)}}),[u,r]),g=k.useCallback(j=>y.current.onChange({target:{value:Zp(j),name:r},type:ho.CHANGE}),[r]),w=k.useCallback(()=>y.current.onBlur({target:{value:oe(n._formValues,r),name:r},type:ho.BLUR}),[r,n._formValues]),v=k.useCallback(j=>{const N=oe(n._fields,r);N&&N._f&&j&&(N._f.ref={focus:()=>nt(j.focus)&&j.focus(),select:()=>nt(j.select)&&j.select(),setCustomValidity:S=>nt(j.setCustomValidity)&&j.setCustomValidity(S),reportValidity:()=>nt(j.reportValidity)&&j.reportValidity()})},[n._fields,r]),b=k.useMemo(()=>({name:r,value:m,...ft(o)||u.disabled?{disabled:u.disabled||o}:{},onChange:g,onBlur:w,ref:v}),[r,o,u.disabled,g,w,v,m]);return k.useEffect(()=>{const j=n._options.shouldUnregister||s,N=p.current;N&&N!==r&&!c&&n.unregister(N),n.register(r,{...h.current.rules,...ft(h.current.disabled)?{disabled:h.current.disabled}:{}});const S=($,C)=>{const E=oe(n._fields,$);E&&E._f&&(E._f.mount=C)};if(S(r,!0),j){const $=Ie(oe(n._options.defaultValues,r,h.current.defaultValue));De(n._defaultValues,r,$),Pe(oe(n._formValues,r))&&De(n._formValues,r,$)}return!c&&n.register(r),p.current=r,()=>{(c?j&&!n._state.action:j)?n.unregister(r):S(r,!1)}},[r,n,c,s]),k.useEffect(()=>{n._setDisabledField({disabled:o,name:r})},[o,r,n]),k.useMemo(()=>({field:b,formState:u,fieldState:f}),[b,u,f])}const wl=k.createContext(null);wl.displayName="HookFormContext";const Rj=()=>k.useContext(wl),Dj=e=>{const{children:t,watch:r,getValues:o,getFieldState:n,setError:s,clearErrors:l,setValue:i,trigger:c,formState:d,resetField:m,reset:u,handleSubmit:h,unregister:p,control:y,register:f,setFocus:g,subscribe:w}=e;return k.createElement(wl.Provider,{value:k.useMemo(()=>({watch:r,getValues:o,getFieldState:n,setError:s,clearErrors:l,setValue:i,trigger:c,formState:d,resetField:m,reset:u,handleSubmit:h,unregister:p,control:y,register:f,setFocus:g,subscribe:w}),[l,y,d,n,o,h,f,u,m,s,g,i,w,c,p,r])},k.createElement(yl.Provider,{value:y},t))};var Pj=(e,t,r,o,n)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[o]:n||!0}}:{},ct=e=>Array.isArray(e)?e:[e],Bi=()=>{let e=[];return{get observers(){return e},next:t=>{for(const r of e)r.next&&r.next(t)},subscribe:t=>(e.push(t),{unsubscribe:()=>{e=e.filter(r=>r!==t)}}),unsubscribe:()=>{e=[]}}};function tf(e,t){const r={};for(const o in e)if(e.hasOwnProperty(o)){const n=e[o],s=t[o];if(n&&qe(n)&&s){const l=tf(n,s);qe(l)&&(r[o]=l)}else e[o]&&(r[o]=s)}return r}var tt=e=>qe(e)&&!Object.keys(e).length,jl=e=>e.type==="file",xo=e=>{if(!vl)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},rf=e=>e.type==="select-multiple",Nl=e=>e.type==="radio",Oj=e=>Nl(e)||Aa(e),Tn=e=>xo(e)&&e.isConnected;function Ij(e,t){const r=t.slice(0,-1).length;let o=0;for(;o<r;)e=Pe(e)?o++:e[t[o++]];return e}function Fj(e){for(const t in e)if(e.hasOwnProperty(t)&&!Pe(e[t]))return!1;return!0}function Me(e,t){const r=Array.isArray(t)?t:rn(t)?[t]:bl(t),o=r.length===1?e:Ij(e,r),n=r.length-1,s=r[n];return o&&delete o[s],n!==0&&(qe(o)&&tt(o)||Array.isArray(o)&&Fj(o))&&Me(e,r.slice(0,-1)),e}var Lj=e=>{for(const t in e)if(nt(e[t]))return!0;return!1};function af(e){return Array.isArray(e)||qe(e)&&!Lj(e)}function fs(e,t={}){for(const r in e){const o=e[r];af(o)?(t[r]=Array.isArray(o)?[]:{},fs(o,t[r])):Pe(o)||(t[r]=!0)}return t}function zr(e,t,r){r||(r=fs(t));for(const o in e){const n=e[o];if(af(n))Pe(t)||ps(r[o])?r[o]=fs(n,Array.isArray(n)?[]:{}):zr(n,it(t)?{}:t[o],r[o]);else{const s=t[o];r[o]=!Dt(n,s)}}return r}const Ui={value:!1,isValid:!1},Hi={value:!0,isValid:!0};var of=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Pe(e[0].attributes.value)?Pe(e[0].value)||e[0].value===""?Hi:{value:e[0].value,isValid:!0}:Hi:Ui}return Ui},nf=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:o})=>Pe(e)?e:t?e===""?NaN:e&&+e:r&&xt(e)?new Date(e):o?o(e):e;const Wi={isValid:!1,value:null};var sf=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Wi):Wi;function qi(e){const t=e.ref;return jl(t)?t.files:Nl(t)?sf(e.refs).value:rf(t)?[...t.selectedOptions].map(({value:r})=>r):Aa(t)?of(e.refs).value:nf(Pe(t.value)?e.ref.value:t.value,e)}var Mj=(e,t,r,o)=>{const n={};for(const s of e){const l=oe(t,s);l&&De(n,s,l._f)}return{criteriaMode:r,names:[...e],fields:n,shouldUseNativeValidation:o}},go=e=>e instanceof RegExp,ua=e=>Pe(e)?e:go(e)?e.source:qe(e)?go(e.value)?e.value.source:e.value:e,Ur=e=>({isOnSubmit:!e||e===kt.onSubmit,isOnBlur:e===kt.onBlur,isOnChange:e===kt.onChange,isOnAll:e===kt.all,isOnTouch:e===kt.onTouched});const Xi="AsyncFunction";var Vj=e=>!!e&&!!e.validate&&!!(nt(e.validate)&&e.validate.constructor.name===Xi||qe(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Xi)),zj=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),hs=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(o=>e.startsWith(o)&&/^\.\w+/.test(e.slice(o.length))));const Xr=(e,t,r,o)=>{for(const n of r||Object.keys(e)){const s=oe(e,n);if(s){const{_f:l,...i}=s;if(l){if(l.refs&&l.refs[0]&&t(l.refs[0],n)&&!o||l.ref&&t(l.ref,l.name)&&!o)return!0;if(Xr(i,t))break}else if(qe(i)&&Xr(i,t))break}}};function Gi(e,t,r){const o=oe(e,r);if(o||rn(r))return{error:o,name:r};const n=r.split(".");for(;n.length;){const s=n.join("."),l=oe(t,s),i=oe(e,s);if(l&&!Array.isArray(l)&&r!==s)return{name:r};if(i&&i.type)return{name:s,error:i};if(i&&i.root&&i.root.type)return{name:`${s}.root`,error:i.root};n.pop()}return{name:r}}var Bj=(e,t,r,o)=>{r(e);const{name:n,...s}=e;return tt(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(l=>t[l]===(!o||kt.all))},Uj=(e,t,r)=>!e||!t||e===t||ct(e).some(o=>o&&(r?o===t:o.startsWith(t)||t.startsWith(o))),Hj=(e,t,r,o,n)=>n.isOnAll?!1:!r&&n.isOnTouch?!(t||e):(r?o.isOnBlur:n.isOnBlur)?!e:(r?o.isOnChange:n.isOnChange)?e:!0,Wj=(e,t)=>!an(oe(e,t)).length&&Me(e,t),lf=(e,t,r)=>{const o=ct(oe(e,r));return De(o,"root",t[r]),De(e,r,o),e};function Ki(e,t,r="validate"){if(xt(e)||Array.isArray(e)&&e.every(xt)||ft(e)&&!e)return{type:r,message:xt(e)?e:"",ref:t}}var Mr=e=>qe(e)&&!go(e)?e:{value:e,message:""},xs=async(e,t,r,o,n,s)=>{const{ref:l,refs:i,required:c,maxLength:d,minLength:m,min:u,max:h,pattern:p,validate:y,name:f,valueAsNumber:g,mount:w}=e._f,v=oe(r,f);if(!w||t.has(f))return{};const b=i?i[0]:l,j=M=>{n&&b.reportValidity&&(b.setCustomValidity(ft(M)?"":M||""),b.reportValidity())},N={},S=Nl(l),$=Aa(l),C=S||$,E=(g||jl(l))&&Pe(l.value)&&Pe(v)||xo(l)&&l.value===""||v===""||Array.isArray(v)&&!v.length,A=Pj.bind(null,f,o,N),I=(M,T,B,q=Kt.maxLength,W=Kt.minLength)=>{const X=M?T:B;N[f]={type:M?q:W,message:X,ref:l,...A(M?q:W,X)}};if(s?!Array.isArray(v)||!v.length:c&&(!C&&(E||it(v))||ft(v)&&!v||$&&!of(i).isValid||S&&!sf(i).isValid)){const{value:M,message:T}=xt(c)?{value:!!c,message:c}:Mr(c);if(M&&(N[f]={type:Kt.required,message:T,ref:b,...A(Kt.required,T)},!o))return j(T),N}if(!E&&(!it(u)||!it(h))){let M,T;const B=Mr(h),q=Mr(u);if(!it(v)&&!isNaN(v)){const W=l.valueAsNumber||v&&+v;it(B.value)||(M=W>B.value),it(q.value)||(T=W<q.value)}else{const W=l.valueAsDate||new Date(v),X=P=>new Date(new Date().toDateString()+" "+P),V=l.type=="time",L=l.type=="week";xt(B.value)&&v&&(M=V?X(v)>X(B.value):L?v>B.value:W>new Date(B.value)),xt(q.value)&&v&&(T=V?X(v)<X(q.value):L?v<q.value:W<new Date(q.value))}if((M||T)&&(I(!!M,B.message,q.message,Kt.max,Kt.min),!o))return j(N[f].message),N}if((d||m)&&!E&&(xt(v)||s&&Array.isArray(v))){const M=Mr(d),T=Mr(m),B=!it(M.value)&&v.length>+M.value,q=!it(T.value)&&v.length<+T.value;if((B||q)&&(I(B,M.message,T.message),!o))return j(N[f].message),N}if(p&&!E&&xt(v)){const{value:M,message:T}=Mr(p);if(go(M)&&!v.match(M)&&(N[f]={type:Kt.pattern,message:T,ref:l,...A(Kt.pattern,T)},!o))return j(T),N}if(y){if(nt(y)){const M=await y(v,r),T=Ki(M,b);if(T&&(N[f]={...T,...A(Kt.validate,T.message)},!o))return j(T.message),N}else if(qe(y)){let M={};for(const T in y){if(!tt(M)&&!o)break;const B=Ki(await y[T](v,r),b,T);B&&(M={...B,...A(T,B.message)},j(B.message),o&&(N[f]=M))}if(!tt(M)&&(N[f]={ref:b,...M},!o))return N}}return j(!0),N};const qj={mode:kt.onSubmit,reValidateMode:kt.onChange,shouldFocusError:!0};function Xj(e={}){let t={...qj,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:nt(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},o={},n=qe(t.defaultValues)||qe(t.values)?Ie(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:Ie(n),l={action:!1,mount:!1,watch:!1,keepIsValid:!1},i={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const m={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},u={...m};let h={...u};const p={array:Bi(),state:Bi()},y=t.criteriaMode===kt.all,f=D=>F=>{clearTimeout(d),d=setTimeout(D,F)},g=async D=>{if(!l.keepIsValid&&!t.disabled&&(u.isValid||h.isValid||D)){let F;t.resolver?(F=tt((await C()).errors),w()):F=await A(o,!0),F!==r.isValid&&p.state.next({isValid:F})}},w=(D,F)=>{!t.disabled&&(u.isValidating||u.validatingFields||h.isValidating||h.validatingFields)&&((D||Array.from(i.mount)).forEach(z=>{z&&(F?De(r.validatingFields,z,F):Me(r.validatingFields,z))}),p.state.next({validatingFields:r.validatingFields,isValidating:!tt(r.validatingFields)}))},v=(D,F=[],z,ie,ne=!0,ae=!0)=>{if(ie&&z&&!t.disabled){if(l.action=!0,ae&&Array.isArray(oe(o,D))){const ge=z(oe(o,D),ie.argA,ie.argB);ne&&De(o,D,ge)}if(ae&&Array.isArray(oe(r.errors,D))){const ge=z(oe(r.errors,D),ie.argA,ie.argB);ne&&De(r.errors,D,ge),Wj(r.errors,D)}if((u.touchedFields||h.touchedFields)&&ae&&Array.isArray(oe(r.touchedFields,D))){const ge=z(oe(r.touchedFields,D),ie.argA,ie.argB);ne&&De(r.touchedFields,D,ge)}(u.dirtyFields||h.dirtyFields)&&(r.dirtyFields=zr(n,s)),p.state.next({name:D,isDirty:M(D,F),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else De(s,D,F)},b=(D,F)=>{De(r.errors,D,F),p.state.next({errors:r.errors})},j=D=>{r.errors=D,p.state.next({errors:r.errors,isValid:!1})},N=(D,F,z,ie)=>{const ne=oe(o,D);if(ne){const ae=oe(s,D,Pe(z)?oe(n,D):z);Pe(ae)||ie&&ie.defaultChecked||F?De(s,D,F?ae:qi(ne._f)):q(D,ae),l.mount&&!l.action&&g()}},S=(D,F,z,ie,ne)=>{let ae=!1,ge=!1;const _e={name:D};if(!t.disabled){if(!z||ie){(u.isDirty||h.isDirty)&&(ge=r.isDirty,r.isDirty=_e.isDirty=M(),ae=ge!==_e.isDirty);const Te=Dt(oe(n,D),F);ge=!!oe(r.dirtyFields,D),Te?Me(r.dirtyFields,D):De(r.dirtyFields,D,!0),_e.dirtyFields=r.dirtyFields,ae=ae||(u.dirtyFields||h.dirtyFields)&&ge!==!Te}if(z){const Te=oe(r.touchedFields,D);Te||(De(r.touchedFields,D,z),_e.touchedFields=r.touchedFields,ae=ae||(u.touchedFields||h.touchedFields)&&Te!==z)}ae&&ne&&p.state.next(_e)}return ae?_e:{}},$=(D,F,z,ie)=>{const ne=oe(r.errors,D),ae=(u.isValid||h.isValid)&&ft(F)&&r.isValid!==F;if(t.delayError&&z?(c=f(()=>b(D,z)),c(t.delayError)):(clearTimeout(d),c=null,z?De(r.errors,D,z):Me(r.errors,D)),(z?!Dt(ne,z):ne)||!tt(ie)||ae){const ge={...ie,...ae&&ft(F)?{isValid:F}:{},errors:r.errors,name:D};r={...r,...ge},p.state.next(ge)}},C=async D=>(w(D,!0),await t.resolver(s,t.context,Mj(D||i.mount,o,t.criteriaMode,t.shouldUseNativeValidation))),E=async D=>{const{errors:F}=await C(D);if(w(D),D)for(const z of D){const ie=oe(F,z);ie?De(r.errors,z,ie):Me(r.errors,z)}else r.errors=F;return F},A=async(D,F,z={valid:!0})=>{for(const ie in D){const ne=D[ie];if(ne){const{_f:ae,...ge}=ne;if(ae){const _e=i.array.has(ae.name),Te=ne._f&&Vj(ne._f);Te&&u.validatingFields&&w([ae.name],!0);const Ye=await xs(ne,i.disabled,s,y,t.shouldUseNativeValidation&&!F,_e);if(Te&&u.validatingFields&&w([ae.name]),Ye[ae.name]&&(z.valid=!1,F||e.shouldUseNativeValidation))break;!F&&(oe(Ye,ae.name)?_e?lf(r.errors,Ye,ae.name):De(r.errors,ae.name,Ye[ae.name]):Me(r.errors,ae.name))}!tt(ge)&&await A(ge,F,z)}}return z.valid},I=()=>{for(const D of i.unMount){const F=oe(o,D);F&&(F._f.refs?F._f.refs.every(z=>!Tn(z)):!Tn(F._f.ref))&&Y(D)}i.unMount=new Set},M=(D,F)=>!t.disabled&&(D&&F&&De(s,D,F),!Dt(se(),n)),T=(D,F,z)=>ms(D,i,{...l.mount?s:Pe(F)?n:xt(D)?{[D]:F}:F},z,F),B=D=>an(oe(l.mount?s:n,D,t.shouldUnregister?oe(n,D,[]):[])),q=(D,F,z={})=>{const ie=oe(o,D);let ne=F;if(ie){const ae=ie._f;ae&&(!ae.disabled&&De(s,D,nf(F,ae)),ne=xo(ae.ref)&&it(F)?"":F,rf(ae.ref)?[...ae.ref.options].forEach(ge=>ge.selected=ne.includes(ge.value)):ae.refs?Aa(ae.ref)?ae.refs.forEach(ge=>{(!ge.defaultChecked||!ge.disabled)&&(Array.isArray(ne)?ge.checked=!!ne.find(_e=>_e===ge.value):ge.checked=ne===ge.value||!!ne)}):ae.refs.forEach(ge=>ge.checked=ge.value===ne):jl(ae.ref)?ae.ref.value="":(ae.ref.value=ne,ae.ref.type||p.state.next({name:D,values:Ie(s)})))}(z.shouldDirty||z.shouldTouch)&&S(D,ne,z.shouldTouch,z.shouldDirty,!0),z.shouldValidate&&P(D)},W=(D,F,z)=>{for(const ie in F){if(!F.hasOwnProperty(ie))return;const ne=F[ie],ae=D+"."+ie,ge=oe(o,ae);(i.array.has(D)||qe(ne)||ge&&!ge._f)&&!Nr(ne)?W(ae,ne,z):q(ae,ne,z)}},X=(D,F,z={})=>{const ie=oe(o,D),ne=i.array.has(D),ae=Ie(F);De(s,D,ae),ne?(p.array.next({name:D,values:Ie(s)}),(u.isDirty||u.dirtyFields||h.isDirty||h.dirtyFields)&&z.shouldDirty&&p.state.next({name:D,dirtyFields:zr(n,s),isDirty:M(D,ae)})):ie&&!ie._f&&!it(ae)?W(D,ae,z):q(D,ae,z),hs(D,i)?p.state.next({...r,name:D,values:Ie(s)}):p.state.next({name:l.mount?D:void 0,values:Ie(s)})},V=async D=>{l.mount=!0;const F=D.target;let z=F.name,ie=!0;const ne=oe(o,z),ae=Te=>{ie=Number.isNaN(Te)||Nr(Te)&&isNaN(Te.getTime())||Dt(Te,oe(s,z,Te))},ge=Ur(t.mode),_e=Ur(t.reValidateMode);if(ne){let Te,Ye;const Lt=F.type?qi(ne._f):Zp(D),Mt=D.type===ho.BLUR||D.type===ho.FOCUS_OUT,sn=!zj(ne._f)&&!t.resolver&&!oe(r.errors,z)&&!ne._f.deps||Hj(Mt,oe(r.touchedFields,z),r.isSubmitted,_e,ge),sa=hs(z,i,Mt);De(s,z,Lt),Mt?(!F||!F.readOnly)&&(ne._f.onBlur&&ne._f.onBlur(D),c&&c(0)):ne._f.onChange&&ne._f.onChange(D);const la=S(z,Lt,Mt),ln=!tt(la)||sa;if(!Mt&&p.state.next({name:z,type:D.type,values:Ie(s)}),sn)return(u.isValid||h.isValid)&&(t.mode==="onBlur"?Mt&&g():Mt||g()),ln&&p.state.next({name:z,...sa?{}:la});if(!Mt&&sa&&p.state.next({...r}),t.resolver){const{errors:Ta}=await C([z]);if(w([z]),ae(Lt),ie){const cn=Gi(r.errors,o,z),Rr=Gi(Ta,o,cn.name||z);Te=Rr.error,z=Rr.name,Ye=tt(Ta)}}else w([z],!0),Te=(await xs(ne,i.disabled,s,y,t.shouldUseNativeValidation))[z],w([z]),ae(Lt),ie&&(Te?Ye=!1:(u.isValid||h.isValid)&&(Ye=await A(o,!0)));ie&&(ne._f.deps&&(!Array.isArray(ne._f.deps)||ne._f.deps.length>0)&&P(ne._f.deps),$(z,Ye,Te,la))}},L=(D,F)=>{if(oe(r.errors,F)&&D.focus)return D.focus(),1},P=async(D,F={})=>{let z,ie;const ne=ct(D);if(t.resolver){const ae=await E(Pe(D)?D:ne);z=tt(ae),ie=D?!ne.some(ge=>oe(ae,ge)):z}else D?(ie=(await Promise.all(ne.map(async ae=>{const ge=oe(o,ae);return await A(ge&&ge._f?{[ae]:ge}:ge)}))).every(Boolean),!(!ie&&!r.isValid)&&g()):ie=z=await A(o);return p.state.next({...!xt(D)||(u.isValid||h.isValid)&&z!==r.isValid?{}:{name:D},...t.resolver||!D?{isValid:z}:{},errors:r.errors}),F.shouldFocus&&!ie&&Xr(o,L,D?ne:i.mount),ie},se=(D,F)=>{let z={...l.mount?s:n};return F&&(z=tf(F.dirtyFields?r.dirtyFields:r.touchedFields,z)),Pe(D)?z:xt(D)?oe(z,D):D.map(ie=>oe(z,ie))},U=(D,F)=>({invalid:!!oe((F||r).errors,D),isDirty:!!oe((F||r).dirtyFields,D),error:oe((F||r).errors,D),isValidating:!!oe(r.validatingFields,D),isTouched:!!oe((F||r).touchedFields,D)}),Q=D=>{const F=D?ct(D):void 0;F==null||F.forEach(z=>Me(r.errors,z)),F?F.forEach(z=>{p.state.next({name:z,errors:r.errors})}):p.state.next({errors:{}})},ee=(D,F,z)=>{const ie=(oe(o,D,{_f:{}})._f||{}).ref,ne=oe(r.errors,D)||{},{ref:ae,message:ge,type:_e,...Te}=ne;De(r.errors,D,{...Te,...F,ref:ie}),p.state.next({name:D,errors:r.errors,isValid:!1}),z&&z.shouldFocus&&ie&&ie.focus&&ie.focus()},H=(D,F)=>nt(D)?p.state.subscribe({next:z=>"values"in z&&D(T(void 0,F),z)}):T(D,F,!0),K=D=>p.state.subscribe({next:F=>{Uj(D.name,F.name,D.exact)&&Bj(F,D.formState||u,qt,D.reRenderRoot)&&D.callback({values:{...s},...r,...F,defaultValues:n})}}).unsubscribe,G=D=>(l.mount=!0,h={...h,...D.formState},K({...D,formState:{...m,...D.formState}})),Y=(D,F={})=>{for(const z of D?ct(D):i.mount)i.mount.delete(z),i.array.delete(z),F.keepValue||(Me(o,z),Me(s,z)),!F.keepError&&Me(r.errors,z),!F.keepDirty&&Me(r.dirtyFields,z),!F.keepTouched&&Me(r.touchedFields,z),!F.keepIsValidating&&Me(r.validatingFields,z),!t.shouldUnregister&&!F.keepDefaultValue&&Me(n,z);p.state.next({values:Ie(s)}),p.state.next({...r,...F.keepDirty?{isDirty:M()}:{}}),!F.keepIsValid&&g()},Z=({disabled:D,name:F})=>{if(ft(D)&&l.mount||D||i.disabled.has(F)){const z=i.disabled.has(F)!==!!D;D?i.disabled.add(F):i.disabled.delete(F),z&&l.mount&&!l.action&&g()}},te=(D,F={})=>{let z=oe(o,D);const ie=ft(F.disabled)||ft(t.disabled);return De(o,D,{...z||{},_f:{...z&&z._f?z._f:{ref:{name:D}},name:D,mount:!0,...F}}),i.mount.add(D),z?Z({disabled:ft(F.disabled)?F.disabled:t.disabled,name:D}):N(D,!0,F.value),{...ie?{disabled:F.disabled||t.disabled}:{},...t.progressive?{required:!!F.required,min:ua(F.min),max:ua(F.max),minLength:ua(F.minLength),maxLength:ua(F.maxLength),pattern:ua(F.pattern)}:{},name:D,onChange:V,onBlur:V,ref:ne=>{if(ne){te(D,F),z=oe(o,D);const ae=Pe(ne.value)&&ne.querySelectorAll&&ne.querySelectorAll("input,select,textarea")[0]||ne,ge=Oj(ae),_e=z._f.refs||[];if(ge?_e.find(Te=>Te===ae):ae===z._f.ref)return;De(o,D,{_f:{...z._f,...ge?{refs:[..._e.filter(Tn),ae,...Array.isArray(oe(n,D))?[{}]:[]],ref:{type:ae.type,name:D}}:{ref:ae}}}),N(D,!1,void 0,ae)}else z=oe(o,D,{}),z._f&&(z._f.mount=!1),(t.shouldUnregister||F.shouldUnregister)&&!(Jp(i.array,D)&&l.action)&&i.unMount.add(D)}}},ue=()=>t.shouldFocusError&&Xr(o,L,i.mount),ve=D=>{ft(D)&&(p.state.next({disabled:D}),Xr(o,(F,z)=>{const ie=oe(o,z);ie&&(F.disabled=ie._f.disabled||D,Array.isArray(ie._f.refs)&&ie._f.refs.forEach(ne=>{ne.disabled=ie._f.disabled||D}))},0,!1))},Ne=(D,F)=>async z=>{let ie;z&&(z.preventDefault&&z.preventDefault(),z.persist&&z.persist());let ne=Ie(s);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:ae,values:ge}=await C();w(),r.errors=ae,ne=Ie(ge)}else await A(o);if(i.disabled.size)for(const ae of i.disabled)Me(ne,ae);if(Me(r.errors,"root"),tt(r.errors)){p.state.next({errors:{}});try{await D(ne,z)}catch(ae){ie=ae}}else F&&await F({...r.errors},z),ue(),setTimeout(ue);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:tt(r.errors)&&!ie,submitCount:r.submitCount+1,errors:r.errors}),ie)throw ie},ye=(D,F={})=>{oe(o,D)&&(Pe(F.defaultValue)?X(D,Ie(oe(n,D))):(X(D,F.defaultValue),De(n,D,Ie(F.defaultValue))),F.keepTouched||Me(r.touchedFields,D),F.keepDirty||(Me(r.dirtyFields,D),r.isDirty=F.defaultValue?M(D,Ie(oe(n,D))):M()),F.keepError||(Me(r.errors,D),u.isValid&&g()),p.state.next({...r}))},Be=(D,F={})=>{const z=D?Ie(D):n,ie=Ie(z),ne=tt(D),ae=ne?n:ie;if(F.keepDefaultValues||(n=z),!F.keepValues){if(F.keepDirtyValues){const ge=new Set([...i.mount,...Object.keys(zr(n,s))]);for(const _e of Array.from(ge)){const Te=oe(r.dirtyFields,_e),Ye=oe(s,_e),Lt=oe(ae,_e);Te&&!Pe(Ye)?De(ae,_e,Ye):!Te&&!Pe(Lt)&&X(_e,Lt)}}else{if(vl&&Pe(D))for(const ge of i.mount){const _e=oe(o,ge);if(_e&&_e._f){const Te=Array.isArray(_e._f.refs)?_e._f.refs[0]:_e._f.ref;if(xo(Te)){const Ye=Te.closest("form");if(Ye){Ye.reset();break}}}}if(F.keepFieldsRef)for(const ge of i.mount)X(ge,oe(ae,ge));else o={}}s=t.shouldUnregister?F.keepDefaultValues?Ie(n):{}:Ie(ae),p.array.next({values:{...ae}}),p.state.next({values:{...ae}})}i={mount:F.keepDirtyValues?i.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!u.isValid||!!F.keepIsValid||!!F.keepDirtyValues||!t.shouldUnregister&&!tt(ae),l.watch=!!t.shouldUnregister,l.keepIsValid=!!F.keepIsValid,l.action=!1,F.keepErrors||(r.errors={}),p.state.next({submitCount:F.keepSubmitCount?r.submitCount:0,isDirty:ne?!1:F.keepDirty?r.isDirty:!!(F.keepDefaultValues&&!Dt(D,n)),isSubmitted:F.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:ne?{}:F.keepDirtyValues?F.keepDefaultValues&&s?zr(n,s):r.dirtyFields:F.keepDefaultValues&&D?zr(n,D):F.keepDirty?r.dirtyFields:{},touchedFields:F.keepTouched?r.touchedFields:{},errors:F.keepErrors?r.errors:{},isSubmitSuccessful:F.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:n})},Ue=(D,F)=>Be(nt(D)?D(s):D,{...t.resetOptions,...F}),Je=(D,F={})=>{const z=oe(o,D),ie=z&&z._f;if(ie){const ne=ie.refs?ie.refs[0]:ie.ref;ne.focus&&setTimeout(()=>{ne.focus(),F.shouldSelect&&nt(ne.select)&&ne.select()})}},qt=D=>{r={...r,...D}},rt={control:{register:te,unregister:Y,getFieldState:U,handleSubmit:Ne,setError:ee,_subscribe:K,_runSchema:C,_updateIsValidating:w,_focusError:ue,_getWatch:T,_getDirty:M,_setValid:g,_setFieldArray:v,_setDisabledField:Z,_setErrors:j,_getFieldArray:B,_reset:Be,_resetDefaultValues:()=>nt(t.defaultValues)&&t.defaultValues().then(D=>{Ue(D,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:I,_disableForm:ve,_subjects:p,_proxyFormState:u,get _fields(){return o},get _formValues(){return s},get _state(){return l},set _state(D){l=D},get _defaultValues(){return n},get _names(){return i},set _names(D){i=D},get _formState(){return r},get _options(){return t},set _options(D){t={...t,...D}}},subscribe:G,trigger:P,register:te,handleSubmit:Ne,watch:H,setValue:X,getValues:se,reset:Ue,resetField:ye,clearErrors:Q,unregister:Y,setError:ee,setFocus:Je,getFieldState:U};return{...rt,formControl:rt}}var sr=()=>{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID();const e=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const r=(Math.random()*16+e)%16|0;return(t=="x"?r:r&3|8).toString(16)})},Rn=(e,t,r={})=>r.shouldFocus||Pe(r.shouldFocus)?r.focusName||`${e}.${Pe(r.focusIndex)?t:r.focusIndex}.`:"",Dn=(e,t)=>[...e,...ct(t)],Pn=e=>Array.isArray(e)?e.map(()=>{}):void 0;function On(e,t,r){return[...e.slice(0,t),...ct(r),...e.slice(t)]}var In=(e,t,r)=>Array.isArray(e)?(Pe(e[r])&&(e[r]=void 0),e.splice(r,0,e.splice(t,1)[0]),e):[],Fn=(e,t)=>[...ct(t),...ct(e)];function Gj(e,t){let r=0;const o=[...e];for(const n of t)o.splice(n-r,1),r++;return an(o).length?o:[]}var Ln=(e,t)=>Pe(t)?[]:Gj(e,ct(t).sort((r,o)=>r-o)),Mn=(e,t,r)=>{[e[t],e[r]]=[e[r],e[t]]},Yi=(e,t,r)=>(e[t]=r,e);function cf(e){const t=on(),{control:r=t,name:o,keyName:n="id",shouldUnregister:s,rules:l}=e,[i,c]=k.useState(r._getFieldArray(o)),d=k.useRef(r._getFieldArray(o).map(sr)),m=k.useRef(!1);r._names.array.add(o),k.useMemo(()=>l&&i.length>=0&&r.register(o,l),[r,o,i.length,l]),nn(()=>r._subjects.array.subscribe({next:({values:j,name:N})=>{if(N===o||!N){const S=oe(j,o);Array.isArray(S)&&(c(S),d.current=S.map(sr))}}}).unsubscribe,[r,o]);const u=k.useCallback(j=>{m.current=!0,r._setFieldArray(o,j)},[r,o]),h=(j,N)=>{const S=ct(Ie(j)),$=Dn(r._getFieldArray(o),S);r._names.focus=Rn(o,$.length-1,N),d.current=Dn(d.current,S.map(sr)),u($),c($),r._setFieldArray(o,$,Dn,{argA:Pn(j)})},p=(j,N)=>{const S=ct(Ie(j)),$=Fn(r._getFieldArray(o),S);r._names.focus=Rn(o,0,N),d.current=Fn(d.current,S.map(sr)),u($),c($),r._setFieldArray(o,$,Fn,{argA:Pn(j)})},y=j=>{const N=Ln(r._getFieldArray(o),j);d.current=Ln(d.current,j),u(N),c(N),!Array.isArray(oe(r._fields,o))&&De(r._fields,o,void 0),r._setFieldArray(o,N,Ln,{argA:j})},f=(j,N,S)=>{const $=ct(Ie(N)),C=On(r._getFieldArray(o),j,$);r._names.focus=Rn(o,j,S),d.current=On(d.current,j,$.map(sr)),u(C),c(C),r._setFieldArray(o,C,On,{argA:j,argB:Pn(N)})},g=(j,N)=>{const S=r._getFieldArray(o);Mn(S,j,N),Mn(d.current,j,N),u(S),c(S),r._setFieldArray(o,S,Mn,{argA:j,argB:N},!1)},w=(j,N)=>{const S=r._getFieldArray(o);In(S,j,N),In(d.current,j,N),u(S),c(S),r._setFieldArray(o,S,In,{argA:j,argB:N},!1)},v=(j,N)=>{const S=Ie(N),$=Yi(r._getFieldArray(o),j,S);d.current=[...$].map((C,E)=>!C||E===j?sr():d.current[E]),u($),c([...$]),r._setFieldArray(o,$,Yi,{argA:j,argB:S},!0,!1)},b=j=>{const N=ct(Ie(j));d.current=N.map(sr),u([...N]),c([...N]),r._setFieldArray(o,[...N],S=>S,{},!0,!1)};return k.useEffect(()=>{if(r._state.action=!1,hs(o,r._names)&&r._subjects.state.next({...r._formState}),m.current&&(!Ur(r._options.mode).isOnSubmit||r._formState.isSubmitted)&&!Ur(r._options.reValidateMode).isOnSubmit)if(r._options.resolver)r._runSchema([o]).then(j=>{r._updateIsValidating([o]);const N=oe(j.errors,o),S=oe(r._formState.errors,o);(S?!N&&S.type||N&&(S.type!==N.type||S.message!==N.message):N&&N.type)&&(N?De(r._formState.errors,o,N):Me(r._formState.errors,o),r._subjects.state.next({errors:r._formState.errors}))});else{const j=oe(r._fields,o);j&&j._f&&!(Ur(r._options.reValidateMode).isOnSubmit&&Ur(r._options.mode).isOnSubmit)&&xs(j,r._names.disabled,r._formValues,r._options.criteriaMode===kt.all,r._options.shouldUseNativeValidation,!0).then(N=>!tt(N)&&r._subjects.state.next({errors:lf(r._formState.errors,N,o)}))}r._subjects.state.next({name:o,values:Ie(r._formValues)}),r._names.focus&&Xr(r._fields,(j,N)=>{if(r._names.focus&&N.startsWith(r._names.focus)&&j.focus)return j.focus(),1}),r._names.focus="",r._setValid(),m.current=!1},[i,o,r]),k.useEffect(()=>(!oe(r._formValues,o)&&r._setFieldArray(o),()=>{const j=(N,S)=>{const $=oe(r._fields,N);$&&$._f&&($._f.mount=S)};r._options.shouldUnregister||s?r.unregister(o):j(o,!1)}),[o,r,n,s]),{swap:k.useCallback(g,[u,o,r]),move:k.useCallback(w,[u,o,r]),prepend:k.useCallback(p,[u,o,r]),append:k.useCallback(h,[u,o,r]),remove:k.useCallback(y,[u,o,r]),insert:k.useCallback(f,[u,o,r]),update:k.useCallback(v,[u,o,r]),replace:k.useCallback(b,[u,o,r]),fields:k.useMemo(()=>i.map((j,N)=>({...j,[n]:d.current[N]||sr()})),[i,n])}}function Kj(e={}){const t=k.useRef(void 0),r=k.useRef(void 0),[o,n]=k.useState({isDirty:!1,isValidating:!1,isLoading:nt(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:nt(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:o},e.defaultValues&&!nt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...i}=Xj(e);t.current={...i,formState:o}}const s=t.current.control;return s._options=e,nn(()=>{const l=s._subscribe({formState:s._proxyFormState,callback:()=>n({...s._formState}),reRenderRoot:!0});return n(i=>({...i,isReady:!0})),s._formState.isReady=!0,l},[s]),k.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),k.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),k.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),k.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),k.useEffect(()=>{if(s._proxyFormState.isDirty){const l=s._getDirty();l!==o.isDirty&&s._subjects.state.next({isDirty:l})}},[s,o.isDirty]),k.useEffect(()=>{var l;e.values&&!Dt(e.values,r.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),!((l=s._options.resetOptions)===null||l===void 0)&&l.keepIsValid||s._setValid(),r.current=e.values,n(i=>({...i}))):s._resetDefaultValues()},[s,e.values]),k.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=k.useMemo(()=>Qp(o,s),[s,o]),t.current}const gs=k.createContext({}),vr=()=>k.useContext(gs),Ze=(e,t,r={})=>{if(!e)return!0;if("and"in e||"or"in e){const d="and"in e&&Array.isArray(e.and)&&e.and.length>0,m="or"in e&&Array.isArray(e.or)&&e.or.length>0;return d&&m?(console.warn("[evaluateFieldCondition] FieldConditionGroup com `and` e `or` simultâneos — apenas `and` será avaliado."),e.and.every(u=>Ze(u,t,r))):d?e.and.every(u=>Ze(u,t,r)):m?e.or.some(u=>Ze(u,t,r)):!0}const o=e;if(!o.campoId)return!0;const n=o.source==="evento"?r[o.campoId]:t[o.campoId];if(Array.isArray(n)){const d=o.valor;switch(o.operador){case"contem":return n.includes(d);case"naoContem":return!n.includes(d);case"vazio":return n.length===0;case"naoVazio":return n.length>0;case"igual":return n.length===1&&n[0]===d;case"diferente":return!(n.length===1&&n[0]===d);default:return!0}}const s=n==null||n===!1?"":n===!0?"1":String(n),l=o.valor!==void 0?String(o.valor):"",i=Number(s),c=Number(l);switch(o.operador){case"igual":return s===l;case"diferente":return s!==l;case"vazio":return!s;case"naoVazio":return!!s;case"contem":return s.includes(l);case"naoContem":return!s.includes(l);case"maiorQue":return!isNaN(i)&&!isNaN(c)?i>c:s>l;case"menorQue":return!isNaN(i)&&!isNaN(c)?i<c:s<l;case"maiorOuIgual":return!isNaN(i)&&!isNaN(c)?i>=c:s>=l;case"menorOuIgual":return!isNaN(i)&&!isNaN(c)?i<=c:s<=l;default:return!0}},Yj=/^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/,Zj=/^\(?\d{2}\)?\s?\d{4,5}-?\d{4}$/,Jj=/^\d{5}-?\d{3}$/,Qj=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,eN=e=>{const t=e.replace(/\D/g,"");if(t.length!==11||/^(\d)\1{10}$/.test(t))return!1;const r=o=>{let n=0;for(let l=0;l<o;l++)n+=parseInt(t[l])*(o+1-l);const s=n*10%11;return s>=10?0:s};return r(9)===parseInt(t[9])&&r(10)===parseInt(t[10])},qa=new Map,tN=e=>{if(qa.has(e))return qa.get(e);try{const t=e.startsWith("/")?e.replace(/\/g(?=[^\/]*$)/,"/"):e,r=new RegExp(t);return qa.set(e,r),r}catch{return qa.set(e,null),null}},Xa=(e,t,r={})=>{const o=e.validacao;if(e.tipo===_.CHECKBOX||e.tipo===_.SWITCH)return e.obrigatorio&&!t?"Campo obrigatório":void 0;if(e.tipo===_.SLIDER){const s=t!=null&&t!==""?Number(t):NaN;return e.obrigatorio&&isNaN(s)?"Campo obrigatório":isNaN(s)?void 0:(o==null?void 0:o.min)!==void 0&&s<o.min?`Valor mínimo: ${o.min}`:(o==null?void 0:o.max)!==void 0&&s>o.max?`Valor máximo: ${o.max}`:void 0}if(e.tipo===_.RATING){const s=t!==void 0?Number(t):0;return e.obrigatorio&&(!s||s<1)?"Avaliação obrigatória":void 0}if(e.tipo===_.DATE_RANGE){const s=t;if(e.obrigatorio){if(!(s!=null&&s.start))return"Data inicial obrigatória";if(!(s!=null&&s.end))return"Data final obrigatória"}return s!=null&&s.start&&s!=null&&s.end&&s.start>s.end?"A data inicial deve ser menor ou igual à data final":void 0}if(e.tipo===_.PARTICIPATION_TYPE){if(!e.obrigatorio)return;const s=t;return s!=null&&s.tipo?s.tipo==="por_dia"&&!s.data?"Selecione um dia para participar":"genero"in(s??{})&&!(s!=null&&s.genero)?"Selecione o sexo":void 0:"Selecione o tipo de participação"}if(e.tipo===_.CHECKBOX_GROUP){const s=Array.isArray(t)?t:[];return e.obrigatorio&&s.length===0?"Selecione pelo menos uma opção":void 0}if(e.tipo===_.FILE)return e.obrigatorio&&!t?"Arquivo obrigatório":void 0;if(e.tipo===_.TERMS)return e.obrigatorio&&t!=="accepted"?"Você precisa aceitar os termos para continuar":void 0;if(e.tipo===_.NUMBER){const s=t!=null?String(t):"";if(e.obrigatorio&&!s)return"Campo obrigatório";if(!s)return;const l=Number(s);return isNaN(l)?"Deve ser um número":(o==null?void 0:o.min)!==void 0&&l<o.min?`Valor mínimo: ${o.min}`:(o==null?void 0:o.max)!==void 0&&l>o.max?`Valor máximo: ${o.max}`:void 0}const n=t!=null?String(t):"";if(e.obrigatorio&&!n.trim())return"Campo obrigatório";if(n){if(e.tipo===_.EMAIL&&!Qj.test(n))return"E-mail inválido";if(e.tipo===_.CPF&&(!Yj.test(n)||!eN(n)))return"CPF inválido";if(e.tipo===_.TELEFONE&&!Zj.test(n))return"Telefone inválido";if(e.tipo===_.CEP&&!Jj.test(n))return"CEP inválido";if(o!=null&&o.minLength&&n.length<o.minLength)return`Mínimo ${o.minLength} caracteres`;if(o!=null&&o.maxLength&&n.length>o.maxLength)return`Máximo ${o.maxLength} caracteres`;if((e.tipo===_.DATE||e.tipo===_.DATETIME)&&n){if(o!=null&&o.minDate&&n<o.minDate)return`Data mínima: ${o.minDate}`;if(o!=null&&o.maxDate&&n>o.maxDate)return`Data máxima: ${o.maxDate}`}if((e.tipo===_.DATE||e.tipo===_.DATETIME)&&n&&((o==null?void 0:o.minAge)!=null||(o==null?void 0:o.maxAge)!=null)){const s=n.split("T")[0],l=new Date(s+"T00:00:00"),i=r["evento.dataInicioEvento"],c=i?new Date(i.split("T")[0]+"T00:00:00"):new Date;let d=c.getFullYear()-l.getFullYear();const m=c.getMonth()-l.getMonth();if((m<0||m===0&&c.getDate()<l.getDate())&&d--,o.minAge!=null&&d<o.minAge)return`Idade mínima: ${o.minAge} ano${o.minAge!==1?"s":""}`;if(o.maxAge!=null&&d>o.maxAge)return`Idade máxima: ${o.maxAge} ano${o.maxAge!==1?"s":""}`}if(o!=null&&o.regex){const s=tN(o.regex);if(s&&!s.test(n))return o.regexMessage||"Formato inválido"}}},Vr=(e,t,r)=>{const o=t.split(".");let n=e;for(let s=0;s<o.length-1;s++){const l=o[s];(n[l]==null||typeof n[l]!="object")&&(n[l]={}),n=n[l]}n[o[o.length-1]]=r},Hr=async(e,t,r,o,n,s)=>{for(const l of e){const i=s[l.type];if(!i)continue;const c=await i(r,o,l,n);if(c)return l.message??c}},rN=(e,t={},r={})=>async o=>{var n,s,l,i,c;const d={},m=[...e.containers].sort((u,h)=>u.ordem-h.ordem);for(const u of m){if(u.repeatable||u.condicional&&!Ze(u.condicional,o,t))continue;const h=[...u.campos].sort((p,y)=>p.ordem-y.ordem);for(const p of h){if(!Ze(p.condicional,o,t)||p.tipo===_.HIDDEN||p.isDisabled||p.isReadOnly)continue;if(p.tipo===_.FIELD_ARRAY){const f=Array.isArray(o[p.nome])?o[p.nome]:[];p.obrigatorio&&f.length===0?d[p.nome]={type:"custom",message:"Adicione pelo menos um item"}:p.minItems&&f.length<p.minItems?d[p.nome]={type:"custom",message:`Mínimo de ${p.minItems} item${p.minItems!==1?"s":""}`}:p.maxItems&&f.length>p.maxItems&&(d[p.nome]={type:"custom",message:`Máximo de ${p.maxItems} item${p.maxItems!==1?"s":""}`});for(let g=0;g<f.length;g++){const w=f[g];for(const v of p.subFields??[]){if(v.isDisabled||v.isReadOnly||!Ze(v.condicional,w,t))continue;const b=Xa(v,w[v.nome],t);if(b){Vr(d,`${p.nome}.${g}.${v.nome}`,{type:"custom",message:b});continue}if((n=v.validate)!=null&&n.length){const j=await Hr(v.validate,v.nome,w[v.nome],w,t,r);j&&Vr(d,`${p.nome}.${g}.${v.nome}`,{type:"custom",message:j})}}}continue}if(p.tipo===_.SUB_FORM){const f=o[p.nome]??{};p.obrigatorio&&Object.keys(f).length===0&&(d[p.nome]={type:"custom",message:"Campo obrigatório"});for(const g of((s=p.subSchema)==null?void 0:s.fields)??[]){if(g.isDisabled||g.isReadOnly)continue;const w=Xa(g,f[g.nome],t);if(w){Vr(d,`${p.nome}.${g.nome}`,{type:"custom",message:w});continue}if((l=g.validate)!=null&&l.length){const v=await Hr(g.validate,g.nome,f[g.nome],f,t,r);v&&Vr(d,`${p.nome}.${g.nome}`,{type:"custom",message:v})}}continue}const y=Xa(p,o[p.nome],t);if(y&&(d[p.nome]={type:"custom",message:y}),!d[p.nome]&&(i=p.validate)!=null&&i.length){const f=await Hr(p.validate,p.nome,o[p.nome],o,t,r);f&&(d[p.nome]={type:"custom",message:f})}}}for(const u of m){if(!u.repeatable||!u.nome||u.condicional&&!Ze(u.condicional,o,t))continue;const h=Array.isArray(o[u.nome])?o[u.nome]:[];u.minItems&&h.length<u.minItems?d[u.nome]={type:"custom",message:`Mínimo de ${u.minItems} ${u.itemLabel??"item"}${u.minItems!==1?"s":""}`}:u.maxItems&&h.length>u.maxItems&&(d[u.nome]={type:"custom",message:`Máximo de ${u.maxItems} ${u.itemLabel??"item"}${u.maxItems!==1?"s":""}`});for(let p=0;p<h.length;p++){const y=h[p];for(const f of u.campos){if(!Ze(f.condicional,y,t)||f.tipo===_.HIDDEN||f.isDisabled||f.isReadOnly)continue;const g=Xa(f,y[f.nome],t);if(g){Vr(d,`${u.nome}.${p}.${f.nome}`,{type:"custom",message:g});continue}if((c=f.validate)!=null&&c.length){const w=await Hr(f.validate,f.nome,y[f.nome],y,t,r);w&&Vr(d,`${u.nome}.${p}.${f.nome}`,{type:"custom",message:w})}}}}return Object.keys(d).length>0?{values:{},errors:d}:{values:o,errors:{}}},aN=(e,t={},r={})=>async o=>{var n,s;const l={},i=[...e.containers].sort((c,d)=>c.ordem-d.ordem);for(const c of i)if(!(c.condicional&&!Ze(c.condicional,o,t))){if(c.repeatable&&c.nome){const d=Array.isArray(o[c.nome])?o[c.nome]:[];for(let m=0;m<d.length;m++){const u=d[m];for(const h of[...c.campos].sort((p,y)=>p.ordem-y.ordem)){if(!((n=h.warn)!=null&&n.length)||!Ze(h.condicional,u,t))continue;const p=await Hr(h.warn,h.nome,u[h.nome],u,t,r);p&&(l[`${c.nome}.${m}.${h.nome}`]=p)}}continue}for(const d of[...c.campos].sort((m,u)=>m.ordem-u.ordem)){if(!((s=d.warn)!=null&&s.length)||!Ze(d.condicional,o,t))continue;const m=await Hr(d.warn,d.nome,o[d.nome],o,t,r);m&&(l[d.nome]=m)}}return l},oN=/\{\{\s*(?:event|evento)\.([a-zA-Z0-9_.]+)\s*\}\}/g,dt=(e,t)=>e?e.replace(oN,(r,o)=>t[`evento.${o}`]??t[o]??r):e??"",nN=(e,t)=>({...e,label:dt(e.label,t)}),sN=(e,t)=>{var r;return{...e,label:dt(e.label,t),placeholder:dt(e.placeholder,t),hint:dt(e.hint,t),defaultValue:typeof e.defaultValue=="string"?dt(e.defaultValue,t):e.defaultValue,opcoes:(r=e.opcoes)==null?void 0:r.map(o=>nN(o,t))}},Cl=(e,t)=>({...e,titulo:dt(e.titulo,t),descricao:dt(e.descricao,t),campos:e.campos.map(r=>sN(r,t))}),lN=(e,t)=>({...e,titulo:dt(e.titulo,t),descricao:dt(e.descricao,t),containers:e.containers.map(r=>Cl(r,t))}),df=()=>{const e=ba(),t=e.layout.containerStyle,r=e.layout.roundness??"rounded-xl",o=J("overflow-hidden",r,t==="card"?"border":"",t==="bordered"?"border":"",t==="glassmorphism"?"backdrop-blur-sm":""),n=t==="glassmorphism"?{background:"var(--t-surface)",borderColor:"var(--t-border)",borderWidth:"1px",borderStyle:"solid"}:{},s=J("border-b px-6 py-4",t==="flat"?"border-transparent":"");return{wrapperClass:o,wrapperStyle:n,headerClass:s,headerStyle:t==="glassmorphism"?{borderColor:"var(--t-border)"}:{},tmpl:e}},St=({name:e,control:t,placeholder:r,type:o="text",disabled:n,readOnly:s})=>{var l;const{field:i,fieldState:c}=Fe({name:e,control:t}),d=!!c.error;return a.jsxs("div",{className:"space-y-1",children:[a.jsx(de,{...i,value:i.value??"",type:o,placeholder:r,disabled:n,readOnly:s,className:J(d&&"border-destructive focus-visible:ring-destructive")}),((l=c.error)==null?void 0:l.message)&&a.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},kl=({name:e,control:t,placeholder:r,disabled:o,readOnly:n})=>{var s;const{field:l,fieldState:i}=Fe({name:e,control:t});return a.jsxs("div",{className:"space-y-1",children:[a.jsx(jo,{...l,value:l.value??"",placeholder:r,disabled:o,readOnly:n,rows:3,className:J(i.error&&"border-destructive focus-visible:ring-destructive")}),((s=i.error)==null?void 0:s.message)&&a.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},Sl=({name:e,control:t,placeholder:r,options:o,disabled:n,readOnly:s})=>{var l;const{field:i,fieldState:c}=Fe({name:e,control:t});return a.jsxs("div",{className:"space-y-1",children:[a.jsxs($t,{value:i.value??"",onValueChange:d=>!s&&i.onChange(d),disabled:n||s,children:[a.jsx(bt,{className:J(c.error&&"border-destructive focus:ring-destructive"),onBlur:i.onBlur,children:a.jsx(Et,{placeholder:r??"Selecione..."})}),a.jsx(yt,{children:o.map(d=>a.jsx(ze,{value:d.valor,disabled:d.disabled,children:d.label},d.valor))})]}),((l=c.error)==null?void 0:l.message)&&a.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},$l=({name:e,control:t,label:r,disabled:o,readOnly:n})=>{var s;const{field:l,fieldState:i}=Fe({name:e,control:t});return a.jsxs("div",{className:"space-y-1",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx(We,{name:l.name,checked:!!l.value,onCheckedChange:c=>!n&&l.onChange(!!c),onBlur:l.onBlur,disabled:o}),r&&a.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=i.error)==null?void 0:s.message)&&a.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},uf=({name:e,control:t,options:r,disabled:o})=>{var n;const{field:s,fieldState:l}=Fe({name:e,control:t}),i=Array.isArray(s.value)?s.value:[],c=d=>{const m=i.includes(d)?i.filter(u=>u!==d):[...i,d];s.onChange(m)};return a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"flex flex-col gap-2",onBlur:s.onBlur,children:r.map(d=>a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx(We,{checked:i.includes(d.valor),onCheckedChange:()=>c(d.valor),disabled:o||d.disabled}),a.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((n=l.error)==null?void 0:n.message)&&a.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},mf=({name:e,control:t,options:r,visualStyle:o="default",disabled:n})=>{var s;const{field:l,fieldState:i}=Fe({name:e,control:t}),c=o==="card";return a.jsxs("div",{className:"space-y-1",onBlur:l.onBlur,children:[a.jsx(Rs,{value:l.value??"",onValueChange:l.onChange,className:J(c?"grid grid-cols-2 gap-2 sm:grid-cols-3":"flex flex-col gap-2"),children:r.map(d=>a.jsxs("label",{className:J("flex items-center gap-2 cursor-pointer",c&&"rounded-lg border p-3 transition-colors hover:bg-accent data-[selected=true]:border-primary data-[selected=true]:bg-primary/5",(n||d.disabled)&&"cursor-not-allowed opacity-50"),"data-selected":l.value===d.valor?"true":void 0,children:[a.jsx(Ds,{value:d.valor,disabled:n||d.disabled}),a.jsx("span",{className:"text-sm leading-none",children:d.label})]},d.valor))}),((s=i.error)==null?void 0:s.message)&&a.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},pf=e=>{const t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${o}`},iN=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),pf(t)},cN=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),pf(t)},ga=({name:e,control:t,isDatetime:r,disabled:o,readOnly:n,validacao:s})=>{var l;const{field:i,fieldState:c}=Fe({name:e,control:t}),d=r?"datetime-local":"date",m=p=>r?p+"T00:00":p,u=(s==null?void 0:s.minAge)!=null?m(iN(s.minAge)):(s==null?void 0:s.maxDate)!=null?m(s.maxDate):void 0,h=(s==null?void 0:s.maxAge)!=null?m(cN(s.maxAge)):(s==null?void 0:s.minDate)!=null?m(s.minDate):void 0;return a.jsxs("div",{className:"space-y-1",children:[a.jsx(de,{name:i.name,value:i.value??"",onChange:i.onChange,onBlur:i.onBlur,type:d,min:h,max:u,disabled:o,readOnly:n,className:J(c.error&&"border-destructive focus-visible:ring-destructive")}),((l=c.error)==null?void 0:l.message)&&a.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},Zi=e=>e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`,ff=({name:e,control:t,disabled:r,campo:o,fileTypes:n,maxFileSize:s})=>{var l;const{field:i,fieldState:c}=Fe({name:e,control:t}),{uploadFile:d}=vr(),[m,u]=k.useState({status:"idle"}),h=k.useRef(null),[p,y]=k.useState(!1),f=k.useRef(!0);k.useEffect(()=>()=>{f.current=!1},[]);const g=typeof i.value=="string"&&i.value?i.value:null,w=k.useCallback(async N=>{var S;if(n&&n.length>0){const $=((S=N.name.split(".").pop())==null?void 0:S.toLowerCase())??"",C=N.type.toLowerCase();if(!n.some(E=>{const A=E.toLowerCase();return!!(A===$||A===C||A.endsWith("/*")&&C.startsWith(A.slice(0,-1)))})){u({status:"error",message:`Tipo de arquivo não permitido. Permitidos: ${n.join(", ")}`});return}}if(s&&N.size>s){u({status:"error",message:`Arquivo muito grande. Tamanho máximo: ${Zi(s)}`});return}if(!d){u({status:"error",message:"Preview: upload não disponível sem configuração."});return}u({status:"uploading",fileName:N.name,progress:0});try{const $=await d(N,o??e,C=>{f.current&&u(E=>E.status==="uploading"?{...E,progress:Math.min(100,C)}:E)});if(!f.current)return;i.onChange($),u({status:"done",uploadId:$,fileName:N.name,size:N.size})}catch{if(!f.current)return;u({status:"error",message:"Falha no upload. Tente novamente."})}},[d,o,e,i,n,s]),v=k.useCallback(N=>{var S;const $=(S=N.target.files)==null?void 0:S[0];$&&w($),N.target.value=""},[w]),b=k.useCallback(()=>{i.onChange(""),u({status:"idle"}),h.current&&(h.current.value="")},[i]);if(m.status==="done"||m.status==="idle"&&g){const N=m.status==="done"?m.fileName:"Arquivo enviado",S=m.status==="done"?m.size:null;return a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-input bg-muted/20 px-4 py-3 gap-2",children:[a.jsx("span",{className:"text-sm font-medium truncate flex-1",children:N}),S!==null&&a.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:Zi(S)}),!r&&a.jsx("button",{type:"button",onClick:b,className:"ml-2 shrink-0 text-muted-foreground hover:text-destructive transition-colors","aria-label":"Remover arquivo",children:"✕"})]})}if(m.status==="uploading"){const{fileName:N,progress:S}=m;return a.jsxs("div",{className:"rounded-lg border border-input px-4 py-3 space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm font-medium truncate flex-1",children:N}),a.jsxs("span",{className:"text-xs text-muted-foreground ml-2",children:[S,"%"]})]}),a.jsx("div",{className:"h-2 rounded-full bg-muted overflow-hidden",children:a.jsx("div",{className:"h-full bg-primary transition-all duration-200 rounded-full",style:{width:`${S}%`}})})]})}const j=m.status==="error";return a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{role:"button",tabIndex:r?-1:0,"aria-label":"Selecionar arquivo",className:J("flex items-center justify-center rounded-lg border-2 border-dashed px-4 py-6 transition-colors cursor-pointer",p?"border-primary bg-primary/5":j||c.error?"border-destructive bg-destructive/5":"border-input hover:border-muted-foreground hover:bg-muted/20",r&&"opacity-50 cursor-not-allowed"),onClick:()=>{var N;return!r&&((N=h.current)==null?void 0:N.click())},onKeyDown:N=>{var S;(N.key==="Enter"||N.key===" ")&&((S=h.current)==null||S.click())},onDragOver:N=>{N.preventDefault(),r||y(!0)},onDragLeave:()=>y(!1),onDrop:r?void 0:N=>{var S;N.preventDefault(),y(!1);const $=(S=N.dataTransfer.files)==null?void 0:S[0];$&&w($)},onBlur:i.onBlur,children:[a.jsx("input",{ref:h,type:"file",onChange:v,disabled:r,className:"sr-only"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:p?"Solte o arquivo aqui":"Clique ou arraste um arquivo"})]}),j&&a.jsxs("p",{className:"text-sm text-destructive",children:[m.message," · ",a.jsx("button",{type:"button",className:"underline hover:no-underline",onClick:()=>u({status:"idle"}),children:"Tentar novamente"})]}),!j&&((l=c.error)==null?void 0:l.message)&&a.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},dN={cpf:e=>e.replace(/\D/g,"").slice(0,11).replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d)/,"$1.$2").replace(/(\d{3})(\d{1,2})$/,"$1-$2"),telefone:e=>{const t=e.replace(/\D/g,"").slice(0,11);return t.length<=10?t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{4})(\d)/,"$1-$2"):t.replace(/(\d{2})(\d)/,"($1) $2").replace(/(\d{5})(\d)/,"$1-$2")},cep:e=>e.replace(/\D/g,"").slice(0,8).replace(/(\d{5})(\d)/,"$1-$2")},kr=({name:e,control:t,placeholder:r,maskType:o,disabled:n,readOnly:s})=>{var l;const{field:i,fieldState:c}=Fe({name:e,control:t}),d=dN[o||""],m=k.useCallback(u=>{i.onChange(d?d(u.target.value):u.target.value)},[i,d]);return a.jsxs("div",{className:"space-y-1",children:[a.jsx(de,{name:i.name,value:i.value||"",onChange:m,onBlur:i.onBlur,placeholder:r,disabled:n,readOnly:s,className:J(c.error&&"border-destructive focus-visible:ring-destructive")}),((l=c.error)==null?void 0:l.message)&&a.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},El=({name:e,control:t})=>{const{field:r}=Fe({name:e,control:t});return a.jsx("input",{type:"hidden",...r,value:r.value??""})},hf=e=>e.replace(/\D/g,""),uN=e=>{const t=hf(e).slice(0,8);return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5)}`},mN=async(e,t)=>{const r=await fetch(`https://viacep.com.br/ws/${e}/json/`,{signal:t});if(!r.ok)throw new Error("Falha ao consultar CEP");return r.json()},xf=({name:e,control:t,placeholder:r="00000-000",disabled:o,readOnly:n,cepFillMap:s})=>{var l,i;const{field:c,fieldState:d}=Fe({name:e,control:t}),{setValue:m}=Rj(),{cepLookup:u}=vr(),[h,p]=k.useState("idle"),[y,f]=k.useState(null),g=k.useRef(null),w=k.useRef(!0);k.useEffect(()=>()=>{var j;w.current=!1,(j=g.current)==null||j.abort()},[]);const v=k.useCallback(async()=>{var j;c.onBlur();const N=hf(c.value??"");if(N.length===8){(j=g.current)==null||j.abort(),g.current=new AbortController,p("loading"),f(null);try{let S;if(u){const E=g.current;if(S=await u(N,E.signal),E.signal.aborted||!w.current)return}else{const E=await mN(N,g.current.signal);if(!w.current)return;if(E.erro){p("error"),f("CEP não encontrado");return}S={logradouro:E.logradouro,bairro:E.bairro,cidade:E.localidade,estado:E.uf}}if(!w.current)return;if(S.erro){p("error"),f("CEP não encontrado");return}const $=e.includes(".")?`${e.substring(0,e.lastIndexOf("."))}.`:"",C=(E,A,I)=>{if(!I)return;const M=s!=null&&s[E]?`${$}${s[E]}`:`${$}${A}`;m(M,I,{shouldDirty:!0,shouldValidate:!0})};C("logradouro","_address_logradouro",S.logradouro),C("bairro","_address_bairro",S.bairro),C("cidade","_address_cidade",S.cidade),C("estado","_address_estado",S.estado),p("success")}catch(S){if(S instanceof Error&&S.name==="AbortError"||!w.current)return;p("error"),f("Erro ao buscar CEP")}}},[c,u,m,e,s]),b=k.useCallback(j=>{c.onChange(uN(j.target.value))},[c]);return a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"relative",children:[a.jsx(de,{name:c.name,value:c.value||"",onChange:b,onBlur:v,placeholder:r,disabled:o,readOnly:n,className:J("pr-9",d.error&&"border-destructive focus-visible:ring-destructive")}),a.jsxs("div",{className:"absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",children:[h==="loading"&&a.jsx(O.Loader2,{className:"h-4 w-4 animate-spin text-muted-foreground"}),h==="success"&&a.jsx(O.Check,{className:"h-4 w-4 text-green-500"}),h==="error"&&a.jsx(O.AlertCircle,{className:"h-4 w-4 text-destructive"})]})]}),(((l=d.error)==null?void 0:l.message)||y)&&a.jsx("p",{className:"text-sm text-destructive",children:((i=d.error)==null?void 0:i.message)||y})]})},pN=({field:e,control:t,nameOverride:r})=>{const o={name:r,control:t,placeholder:e.placeholder};switch(e.tipo){case _.TEXTO:return a.jsx(St,{...o,type:"text"});case _.EMAIL:return a.jsx(St,{...o,type:"email"});case _.NUMBER:return a.jsx(St,{...o,type:"number"});case _.TEXTAREA:return a.jsx(kl,{...o});case _.SELECT:return a.jsx(Sl,{...o,options:e.opcoes??[]});case _.RADIO:return a.jsx(mf,{...o,options:e.opcoes??[]});case _.CHECKBOX:return a.jsx($l,{name:r,control:t,label:e.label});case _.CHECKBOX_GROUP:return a.jsx(uf,{...o,options:e.opcoes??[]});case _.DATE:return a.jsx(ga,{...o,validacao:e.validacao});case _.DATETIME:return a.jsx(ga,{...o,isDatetime:!0,validacao:e.validacao});case _.FILE:return a.jsx(ff,{name:r,control:t});case _.TELEFONE:return a.jsx(kr,{...o,maskType:"telefone"});case _.CPF:return a.jsx(kr,{...o,maskType:"cpf"});case _.CEP:return a.jsx(xf,{name:r,control:t,placeholder:e.placeholder});case _.HIDDEN:return a.jsx(El,{name:r,control:t});default:return console.error(`[DFFieldArray] Tipo de sub-campo "${e.tipo}" não suportado em FIELD_ARRAY. Usando DFTextField como fallback.`),a.jsx(St,{...o,type:"text"})}},fN=({name:e,control:t,subFields:r=[],minItems:o=1,maxItems:n,itemLabel:s="Item",addLabel:l})=>{var i;const{fields:c,append:d,remove:m}=cf({control:t,name:e}),{errors:u}=ef({control:t}),h=(i=u[e])==null?void 0:i.message,p=k.useCallback(()=>{const w={};for(const v of r)v.initialValue!==void 0?w[v.nome]=v.initialValue:v.defaultValue!==void 0&&(w[v.nome]=v.defaultValue);return w},[r]);k.useEffect(()=>{if(c.length<o)for(let w=c.length;w<o;w++)d(p())},[o]);const y=[...r].sort((w,v)=>w.ordem-v.ordem),f=!n||c.length<n,g=l??`Adicionar ${s.toLowerCase()}`;return a.jsxs("div",{className:"space-y-3",children:[c.map((w,v)=>a.jsxs("div",{className:"rounded-lg border border-input p-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary/10 text-xs font-bold text-primary shrink-0",children:v+1}),a.jsxs("span",{className:"text-sm font-semibold",children:[s," ",v+1]})]}),c.length>o&&a.jsx($e,{type:"button",variant:"ghost",size:"icon",onClick:()=>m(v),"aria-label":`Remover ${s.toLowerCase()} ${v+1}`,className:"text-muted-foreground hover:text-destructive",children:a.jsx(O.Trash2,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"grid grid-cols-12 gap-4",children:y.map(b=>{const j=`${e}.${v}.${b.nome}`,N=`span ${b.tamanho??12}`,S=a.jsx(pN,{field:b,control:t,nameOverride:j});return b.tipo===_.CHECKBOX||b.tipo===_.HIDDEN?a.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:N},children:S},b.id):a.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:N},children:[a.jsxs("label",{className:"font-medium flex items-center gap-1 text-sm text-foreground",children:[b.label,b.obrigatorio&&a.jsx("span",{className:"text-destructive",children:"*"})]}),S,b.hint&&a.jsx("p",{className:"text-xs text-muted-foreground",children:b.hint})]},b.id)})})]},w.id)),f&&a.jsxs($e,{type:"button",variant:"outline",className:"w-full",onClick:()=>d(p()),children:[a.jsx(O.Plus,{className:"w-4 h-4"}),g]}),n&&a.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",n," ",s.toLowerCase(),n>1?"s":""]}),h&&a.jsxs("p",{className:"text-sm text-destructive flex items-center gap-1",children:[a.jsx(O.AlertCircle,{className:"w-4 h-4 shrink-0"}),h]})]})},Ji=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,hN=(e,t)=>{const r=new Date(e.slice(0,10)+"T00:00:00Z"),o=new Date(t.slice(0,10)+"T00:00:00Z");return Math.round((o.getTime()-r.getTime())/864e5)+1},xN=(e,t)=>{const r=[],o=new Date(e.slice(0,10)+"T00:00:00Z"),n=new Date(t.slice(0,10)+"T00:00:00Z");let s=0;for(;o<=n&&s<60;)r.push(o.toISOString().slice(0,10)),o.setUTCDate(o.getUTCDate()+1),s++;return r},gN=e=>{const[t,r,o]=e.split("-").map(Number),n=new Date(Date.UTC(t,r-1,o)),s=String(o).padStart(2,"0"),l=String(r).padStart(2,"0"),i=new Intl.DateTimeFormat("pt-BR",{weekday:"long",timeZone:"UTC"}).format(n),c=i.charAt(0).toUpperCase()+i.slice(1);return`${s}/${l} - ${c}`},vN=(e,t)=>{const r=o=>{const[n,s,l]=o.slice(0,10).split("-");return`${l}/${s}/${n}`};return`${r(e)} a ${r(t)}`},bN=({name:e,control:t})=>{var r;const{field:o,fieldState:n}=Fe({name:e,control:t}),{externalData:s={}}=vr(),l=o.value??null,i=(r=n.error)==null?void 0:r.message,c=V=>s[`evento.${V}`]??s[V],d=c("dataInicioEvento")??"",m=c("dataFimEvento")??"",u=Number(c("valor")??0),h=Number(c("valorPorDia")??0),p=c("vagasTotal"),y=c("vagasPorDia"),f=c("vagasMasculinas"),g=c("vagasFemininas"),w=p!=null?Number(p):null,v=y!=null?Number(y):null,b=f!=null?Number(f):null,j=g!=null?Number(g):null,N=d&&m?xN(d,m):[],S=(d&&m?hN(d,m):0)>1,$=b!=null&&b>0&&j!=null&&j>0,C=b!=null&&j==null?"masculino":j!=null&&b==null?"feminino":null,E=(l==null?void 0:l.tipo)??null,A=(l==null?void 0:l.data)??null,I=(l==null?void 0:l.genero)??null,M=k.useRef(l);M.current=l;const T=k.useRef(o.onChange);T.current=o.onChange,k.useEffect(()=>{var V,L,P;C&&((V=M.current)==null?void 0:V.genero)!==C&&T.current({tipo:((L=M.current)==null?void 0:L.tipo)??null,data:((P=M.current)==null?void 0:P.data)??null,genero:C})},[C]);const B=V=>{const L={tipo:V,data:null};($||C)&&(L.genero=I??C??void 0),o.onChange(L)},q=V=>{const L={tipo:"por_dia",data:V};($||C)&&(L.genero=I??C??void 0),o.onChange(L)},W=V=>{o.onChange({tipo:E,data:A,genero:V})},X=V=>E===V;return a.jsxs("div",{className:"space-y-3",children:[$&&a.jsxs("div",{className:"flex items-center gap-2 px-1",children:[a.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Você é:"}),a.jsx("div",{className:"flex gap-2",children:["masculino","feminino"].map(V=>a.jsx("button",{type:"button",onClick:()=>W(V),className:J("px-3 py-1 rounded-full text-xs font-medium border transition-all",I===V?"border-primary bg-primary/10 text-primary":"border-input text-muted-foreground hover:border-primary/50"),children:V==="masculino"?"Masculino":"Feminino"},V))})]}),a.jsxs("button",{type:"button",onClick:()=>B("todos_os_dias"),className:J("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",X("todos_os_dias")?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[a.jsx("div",{className:J("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",X("todos_os_dias")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:a.jsx(O.CalendarCheck2,{className:"w-4 h-4"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-semibold text-sm",children:"Participar todos os dias"}),d&&m?a.jsx("p",{className:"text-xs text-muted-foreground",children:vN(d,m)}):a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Datas do evento"})]}),a.jsxs("div",{className:"text-right shrink-0",children:[u>0&&a.jsx("p",{className:J("font-bold text-sm",X("todos_os_dias")?"text-primary":"text-foreground"),children:Ji(u)}),w!=null&&w>0&&a.jsxs("p",{className:"text-xs flex items-center justify-end gap-1 text-muted-foreground",children:[a.jsx(O.Users,{className:"w-3 h-3"}),w," vagas disponíveis"]})]})]}),S?a.jsxs("button",{type:"button",onClick:()=>B("por_dia"),className:J("w-full text-left flex items-start gap-3 p-4 rounded-xl border-2 transition-all",X("por_dia")?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[a.jsx("div",{className:J("mt-0.5 p-2 rounded-lg shrink-0 transition-colors",X("por_dia")?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:a.jsx(O.CalendarDays,{className:"w-4 h-4"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-semibold text-sm",children:"Participar um dia"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Escolha o dia desejado abaixo"})]}),a.jsxs("div",{className:"text-right shrink-0",children:[h>0&&a.jsx("p",{className:J("font-bold text-sm",X("por_dia")?"text-primary":"text-foreground"),children:Ji(h)}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"por dia"})]})]}):d?a.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 rounded-lg border border-input bg-muted/30",children:[a.jsx(O.Info,{className:"w-3.5 h-3.5 mt-0.5 shrink-0 text-muted-foreground"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'Este evento ocorre em apenas 1 dia — a opção "Participar um dia" não é necessária.'})]}):null,E==="por_dia"&&a.jsxs("div",{className:"pl-2 space-y-2",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-primary",children:"Selecione o dia:"}),N.length===0?a.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Nenhuma data configurada no evento"}):N.map(V=>a.jsxs("button",{type:"button",onClick:()=>q(V),className:J("w-full text-left flex items-center justify-between px-4 py-3 rounded-lg border transition-all",A===V?"border-primary bg-primary/5":"border-input hover:border-primary/50"),children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:J("w-4 h-4 rounded-full border-2 shrink-0 flex items-center justify-center transition-colors",A===V?"border-primary bg-primary":"border-input"),children:A===V&&a.jsx("span",{className:"w-2 h-2 rounded-full bg-white"})}),a.jsx("span",{className:"text-sm",children:gN(V)})]}),v!=null&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:[v," vagas"]})]},V))]}),i&&a.jsx("p",{className:"text-sm text-destructive",children:i})]})},Qi=.0315,ec=.124,tc=7,rc=12,yN=[{id:"pix",label:"PIX",description:"Transferência instantânea (à vista)",Icon:O.Smartphone,taxa:0},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:O.Banknote,taxa:0},{id:"cartao",label:"Cartão de Crédito",description:"Débito ou crédito na maquininha",Icon:O.CreditCard,taxa:Qi,taxaLabel:`Taxa: ${(Qi*100).toFixed(2).replace(".",",")}%`}],wN=[{id:"pix",label:"PIX à Vista",description:"Pagamento instantâneo sem parcelamento",Icon:O.Smartphone,taxa:0},{id:"pix_parcelado",label:"PIX Parcelado",description:`Parcelado em até ${tc}x sem juros`,Icon:O.Smartphone,taxa:0,parcelas:tc},{id:"cartao",label:"Cartão de Crédito",description:`Parcelado em até ${rc}x`,Icon:O.CreditCard,taxa:ec,parcelas:rc,taxaLabel:`Taxa: ${(ec*100).toFixed(2).replace(".",",")}%`},{id:"dinheiro",label:"Dinheiro",description:"Pagamento em espécie",Icon:O.Banknote,taxa:0}],Ga=e=>`R$ ${(e/100).toFixed(2).replace(".",",")}`,ac=(e,t)=>Math.round(e*(1+t)*100)/100,jN=(e,t)=>Math.round(e/t*100)/100,NN=({name:e,control:t,relatedFieldName:r="tipo_participacao"})=>{var o;const{field:n,fieldState:s}=Fe({name:e,control:t}),{externalData:l={},paymentMethodOptions:i}=vr(),c=n.value??null,d=(o=s.error)==null?void 0:o.message,m=na({control:t,name:r}),u=(m==null?void 0:m.tipo)??null,h=b=>l[`evento.${b}`]??l[b],p=Number(h("valor")??0),y=Number(h("valorPorDia")??0),f=u==="por_dia"&&y>0?y:p,g=u==="por_dia"?(i==null?void 0:i.porDia)??yN:(i==null?void 0:i.todosOsDias)??wN,w=u==="por_dia"?(()=>{if(!(m!=null&&m.data))return"Um dia";const b=m.data.split("-");if(b.length===3){const[j,N,S]=b;return`${S}/${N}/${j}`}return m.data})():"Todos os dias",v=b=>{if(b.disabled)return;const j=ac(f,b.taxa),N={metodo:b.id,valorTotal:j};b.parcelas&&(N.parcelas=b.parcelas),n.onChange(N)};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-input px-4 py-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Tipo de participação"}),a.jsx("p",{className:"font-semibold",children:w})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Valor base"}),a.jsx("p",{className:"text-lg font-bold text-primary",children:Ga(f)})]})]}),a.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-input bg-muted/30 px-3 py-2.5",children:[a.jsx(O.Info,{className:"h-4 w-4 mt-0.5 shrink-0 text-muted-foreground"}),a.jsxs("p",{className:"text-xs",children:[a.jsx("span",{className:"font-bold",children:"Importante:"})," Para validar a inscrição e garantir sua vaga, o pagamento deve ser realizado no ato da inscrição."]})]}),a.jsx("p",{className:"text-sm font-semibold text-primary",children:"Selecione a forma de pagamento:"}),a.jsx("div",{className:"space-y-3",children:g.map(b=>{const{Icon:j}=b,N=(c==null?void 0:c.metodo)===b.id,S=ac(f,b.taxa),$=!!b.parcelas&&b.parcelas>1,C=$?jN(S,b.parcelas):null;return a.jsxs("button",{type:"button",disabled:b.disabled,onClick:()=>v(b),className:J("w-full text-left flex items-center gap-4 px-4 py-3 rounded-xl border-2 transition-all",N?"border-primary bg-primary/5":"border-input hover:border-primary/50",b.disabled&&"opacity-50 cursor-not-allowed"),children:[a.jsx("div",{className:J("flex items-center justify-center w-10 h-10 rounded-lg shrink-0 transition-colors",N?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:a.jsx(j,{className:"h-5 w-5"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"font-semibold text-sm leading-tight",children:b.label}),a.jsx("p",{className:"text-xs text-muted-foreground",children:b.description}),b.taxaLabel&&a.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:["* ",b.taxaLabel]}),b.taxa>0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Total com taxa: ",Ga(S)]})]}),a.jsx("div",{className:"text-right shrink-0",children:$?a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"text-xs text-muted-foreground",children:[b.parcelas,"x de"]}),a.jsx("p",{className:"text-base font-bold text-primary",children:Ga(C)})]}):a.jsx("p",{className:"text-base font-bold text-primary",children:Ga(S)})})]},b.id)})}),d&&a.jsx("p",{className:"text-xs text-destructive",children:d})]})},CN=({name:e,control:t,label:r,termoTexto:o,termoPdfUrl:n,termoPdfUploadId:s})=>{var l;const{field:i,fieldState:c}=Fe({name:e,control:t}),{resolveTermsUploadUrl:d}=vr(),m=!!c.error,u=(l=c.error)==null?void 0:l.message,[h,p]=k.useState(null),[y,f]=k.useState(!1),[g,w]=k.useState(!1),v=k.useRef(null);k.useEffect(()=>{var $;g&&(($=v.current)==null||$.focus())},[g]),k.useEffect(()=>{if(!s||!d){p(null);return}let $=!1;return f(!0),d(s).then(C=>{$||p(C)}).catch(()=>{$||p(null)}).finally(()=>{$||f(!1)}),()=>{$=!0}},[s,d]);const b=i.value==="accepted",j=h||n||null,N=!!(o||j||s),S=!!j;return a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:J("rounded-lg border p-4 space-y-4 transition-colors",m?"border-destructive bg-destructive/5":b?"border-green-500 bg-green-500/5":"border-input"),children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(O.ScrollText,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{className:"text-sm font-medium",children:r||"Termos e condições"})]}),N?a.jsxs($e,{type:"button",variant:"outline",size:"sm",className:"h-7 px-2 text-xs",disabled:y,onClick:()=>w(!0),children:[y?a.jsx(O.Loader2,{className:"h-3 w-3 animate-spin"}):a.jsx(O.ExternalLink,{className:"h-3 w-3"}),"Ler termos"]}):a.jsx("span",{className:"text-xs text-muted-foreground italic",children:s&&y?"Carregando PDF...":"Conteúdo não configurado"})]}),a.jsxs("label",{className:"flex items-start gap-3 cursor-pointer select-none",children:[a.jsx(We,{className:"mt-0.5",checked:b,onCheckedChange:$=>i.onChange($?"accepted":"")}),a.jsxs("span",{className:"text-sm leading-snug flex-1",children:["Li e aceito ",r?`"${r}"`:"os termos e condições"]}),b&&a.jsx(O.CheckCircle2,{className:"h-4 w-4 text-green-500 shrink-0 mt-0.5"})]})]}),m&&a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-destructive",children:[a.jsx(O.AlertCircle,{className:"h-3.5 w-3.5 shrink-0"}),u||"Você precisa aceitar os termos para continuar"]}),g&&a.jsx("div",{ref:v,role:"dialog","aria-modal":"true","aria-label":"Termos e condições",tabIndex:-1,className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/60 outline-none",onClick:()=>w(!1),onKeyDown:$=>{$.key==="Escape"&&w(!1)},children:a.jsxs("div",{className:"relative w-full max-w-2xl max-h-[90vh] rounded-xl overflow-hidden flex flex-col bg-background shadow-xl",onClick:$=>$.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-input",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(O.ScrollText,{className:"h-4 w-4"}),a.jsx("span",{className:"font-semibold",children:"Termos e condições"})]}),a.jsx($e,{type:"button",variant:"ghost",size:"icon",onClick:()=>w(!1),children:a.jsx(O.X,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"flex-1 overflow-auto p-4",children:S?a.jsx("iframe",{src:j,className:"w-full rounded border",style:{height:"62vh"},title:"Termos e condições",sandbox:"allow-same-origin"}):a.jsx("p",{className:"text-sm whitespace-pre-wrap leading-relaxed",children:o})})]})})]})},kN=({name:e,control:t,placeholder:r,disabled:o,readOnly:n})=>{var s;const{field:l,fieldState:i}=Fe({name:e,control:t}),[c,d]=k.useState(!1),m=!!i.error;return a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"relative",children:[a.jsx(de,{...l,value:l.value??"",type:c?"text":"password",placeholder:r,disabled:o,readOnly:n,className:J("pr-10",m&&"border-destructive focus-visible:ring-destructive")}),a.jsx("button",{type:"button",tabIndex:-1,onClick:()=>d(u=>!u),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors","aria-label":c?"Ocultar senha":"Mostrar senha",children:c?a.jsx(O.EyeOff,{size:16}):a.jsx(O.Eye,{size:16})})]}),((s=i.error)==null?void 0:s.message)&&a.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},gf=({name:e,control:t,label:r,disabled:o,readOnly:n})=>{var s;const{field:l,fieldState:i}=Fe({name:e,control:t}),c=!!l.value;return a.jsxs("div",{className:"space-y-1",children:[a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer select-none",children:[a.jsx(Ps,{checked:c,onCheckedChange:d=>!n&&l.onChange(d),disabled:o||n,onBlur:l.onBlur}),a.jsx("span",{className:"text-sm leading-none",children:r})]}),((s=i.error)==null?void 0:s.message)&&a.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},SN=({name:e,control:t,minValue:r=0,maxValue:o=100,step:n=1,disabled:s,readOnly:l})=>{var i;const{field:c,fieldState:d}=Fe({name:e,control:t}),m=c.value??r;return k.useEffect(()=>{(c.value===void 0||c.value===null)&&c.onChange(r)},[]),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Vo,{min:r,max:o,step:n,value:[m],onValueChange:u=>!l&&c.onChange(u[0]),disabled:s||l,className:"flex-1"}),a.jsx("span",{className:"text-sm font-medium text-primary min-w-[3rem] text-right tabular-nums",children:m})]}),a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:r}),a.jsx("span",{children:o})]}),((i=d.error)==null?void 0:i.message)&&a.jsx("p",{className:"text-sm text-destructive",children:d.error.message})]})},Vn=e=>/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(e),$N=({name:e,control:t,disabled:r,readOnly:o})=>{var n;const{field:s,fieldState:l}=Fe({name:e,control:t}),i=s.value||"#000000",[c,d]=k.useState(i);return k.useEffect(()=>{d(i)},[i]),a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("input",{type:"color",value:Vn(i)?i:"#000000",disabled:r||o,onChange:m=>s.onChange(m.target.value),className:"h-10 w-14 cursor-pointer rounded-lg border border-input bg-transparent p-1 disabled:cursor-not-allowed disabled:opacity-50"}),a.jsx(de,{type:"text",value:c,readOnly:o,disabled:r,onChange:m=>{const u=m.target.value;d(u),Vn(u)&&s.onChange(u.toUpperCase())},onBlur:()=>{Vn(c)||d(i),s.onBlur()},className:J("flex-1 font-mono uppercase",l.error&&"border-destructive focus-visible:ring-destructive"),maxLength:7,placeholder:"#000000"})]}),((n=l.error)==null?void 0:n.message)&&a.jsx("p",{className:"text-sm text-destructive",children:l.error.message})]})},EN=({name:e,control:t,options:r,placeholder:o,disabled:n,readOnly:s})=>{var l,i;const{field:c,fieldState:d}=Fe({name:e,control:t}),[m,u]=k.useState(""),[h,p]=k.useState(!1),[y,f]=k.useState(-1),g=k.useRef(null),w=k.useRef(null),v=`autocomplete-${e}-listbox`,b=((l=r.find(A=>A.valor===c.value))==null?void 0:l.label)??"",j=m.length>0?r.filter(A=>A.label.toLowerCase().includes(m.toLowerCase())):r;k.useEffect(()=>{const A=I=>{g.current&&!g.current.contains(I.target)&&(p(!1),u(""),f(-1))};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]);const N=()=>{p(!1),u(""),f(-1)};k.useEffect(()=>{if(y<0||!w.current)return;const A=w.current.querySelector(`[id="${v}-option-${y}"]`);A==null||A.scrollIntoView({block:"nearest"})},[y,v]);const S=A=>{A.disabled||(c.onChange(A.valor),N())},$=()=>{c.onChange(""),u(""),f(-1)},C=A=>{if(!h){(A.key==="ArrowDown"||A.key==="ArrowUp")&&(A.preventDefault(),p(!0),f(0));return}switch(A.key){case"ArrowDown":A.preventDefault(),f(I=>I<j.length-1?I+1:I);break;case"ArrowUp":A.preventDefault(),f(I=>I>0?I-1:0);break;case"Enter":A.preventDefault(),y>=0&&j[y]&&!j[y].disabled&&S(j[y]);break;case"Escape":A.preventDefault(),N();break;case"Tab":N();break}},E=h&&y>=0?`${v}-option-${y}`:void 0;return a.jsxs("div",{className:"space-y-1",ref:g,children:[a.jsxs("div",{className:"relative",children:[a.jsx(de,{type:"text",role:"combobox","aria-expanded":h,"aria-haspopup":"listbox","aria-autocomplete":"list","aria-controls":v,"aria-activedescendant":E,value:h?m:b,placeholder:o??"Buscar...",disabled:n,readOnly:s,onChange:A=>{u(A.target.value),f(-1),p(!0)},onFocus:()=>!s&&p(!0),onKeyDown:C,className:J("pr-8",d.error&&"border-destructive focus-visible:ring-destructive"),autoComplete:"off"}),a.jsx("div",{className:"absolute right-2 top-1/2 -translate-y-1/2 flex items-center gap-1",children:c.value?a.jsx("button",{type:"button",onClick:$,className:"text-[var(--t-text-muted)] hover:text-[var(--t-text)]",tabIndex:-1,"aria-label":"Limpar seleção",children:a.jsx(O.X,{size:14})}):a.jsx(O.ChevronDown,{size:16,className:"text-muted-foreground pointer-events-none","aria-hidden":"true"})}),h&&!n&&!s&&a.jsx("ul",{role:"listbox",id:v,ref:w,"aria-label":"Opções disponíveis",className:"absolute z-50 mt-1 max-h-60 w-full overflow-auto rounded-lg border border-input bg-popover shadow-lg",children:j.length===0?a.jsx("li",{role:"option","aria-selected":!1,className:"px-3 py-2 text-sm text-muted-foreground",children:"Nenhuma opção encontrada"}):j.map((A,I)=>a.jsx("li",{id:`${v}-option-${I}`,role:"option","aria-selected":c.value===A.valor,"aria-disabled":A.disabled,onMouseDown:()=>S(A),className:["flex cursor-pointer items-center px-3 py-2 text-sm",A.disabled?"cursor-not-allowed opacity-40":I===y?"bg-accent":"hover:bg-accent",c.value===A.valor?"font-medium text-primary":"text-foreground"].join(" "),children:A.label},A.valor))})]}),((i=d.error)==null?void 0:i.message)&&a.jsx("p",{className:"text-sm text-destructive",role:"alert",children:d.error.message})]})},vf=({name:e,control:t,placeholder:r,disabled:o,readOnly:n})=>{var s;const{field:l,fieldState:i}=Fe({name:e,control:t}),c=!!i.error;return a.jsxs("div",{className:"space-y-1",children:[a.jsx(de,{...l,value:l.value??"",type:"time",placeholder:r,disabled:o,readOnly:n,className:J(c&&"border-destructive focus-visible:ring-destructive")}),((s=i.error)==null?void 0:s.message)&&a.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},AN=({name:e,control:t,startLabel:r="Data inicial",endLabel:o="Data final",disabled:n,readOnly:s})=>{var l;const{field:i,fieldState:c}=Fe({name:e,control:t}),d=i.value??{},m=(h,p)=>{i.onChange({...d,[h]:p})},u=!!c.error;return a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{children:r}),a.jsx(de,{type:"date",value:d.start??"",disabled:n,readOnly:s,onChange:h=>m("start",h.target.value),max:d.end??void 0,className:J(u&&"border-destructive focus-visible:ring-destructive")})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(le,{children:o}),a.jsx(de,{type:"date",value:d.end??"",disabled:n,readOnly:s,onChange:h=>m("end",h.target.value),min:d.start??void 0,className:J(u&&"border-destructive focus-visible:ring-destructive")})]})]}),((l=c.error)==null?void 0:l.message)&&a.jsx("p",{className:"text-sm text-destructive",children:c.error.message})]})},_N=({name:e,control:t,maxRating:r=5,disabled:o,readOnly:n})=>{var s;const{field:l,fieldState:i}=Fe({name:e,control:t}),c=l.value??0,d=Array.from({length:r},(m,u)=>u+1);return a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[d.map(m=>a.jsx("button",{type:"button",disabled:o||n,onClick:()=>l.onChange(m===c?0:m),className:"transition-transform hover:scale-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","aria-label":`${m} estrela${m>1?"s":""}`,children:a.jsx(O.Star,{size:24,className:"transition-colors",fill:m<=c?"var(--color-primary)":"transparent",stroke:m<=c?"var(--color-primary)":"currentColor"})},m)),c>0&&a.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:[c,"/",r]})]}),((s=i.error)==null?void 0:s.message)&&a.jsx("p",{className:"text-sm text-destructive",children:i.error.message})]})},TN=({field:e,name:t,control:r,disabled:o,readOnly:n})=>{const s=o||e.isDisabled,l=n||e.isReadOnly;switch(e.tipo){case _.EMAIL:return a.jsx(St,{name:t,control:r,type:"email",placeholder:e.placeholder,disabled:s,readOnly:l});case _.NUMBER:return a.jsx(St,{name:t,control:r,type:"number",placeholder:e.placeholder,disabled:s,readOnly:l});case _.PASSWORD:return a.jsx(St,{name:t,control:r,type:"password",placeholder:e.placeholder,disabled:s,readOnly:l});case _.TELEFONE:return a.jsx(kr,{name:t,control:r,maskType:"telefone",placeholder:e.placeholder??"(00) 00000-0000",disabled:s,readOnly:l});case _.CPF:return a.jsx(kr,{name:t,control:r,maskType:"cpf",placeholder:e.placeholder??"000.000.000-00",disabled:s,readOnly:l});case _.CEP:return a.jsx(kr,{name:t,control:r,maskType:"cep",placeholder:e.placeholder??"00000-000",disabled:s,readOnly:l});case _.TEXTAREA:return a.jsx(kl,{name:t,control:r,placeholder:e.placeholder,disabled:s,readOnly:l});case _.SELECT:return a.jsx(Sl,{name:t,control:r,options:e.opcoes??[],placeholder:e.placeholder,disabled:s,readOnly:l});case _.CHECKBOX:return a.jsx($l,{name:t,control:r,label:e.label??"",disabled:s,readOnly:l});case _.SWITCH:return a.jsx(gf,{name:t,control:r,label:e.label??"",disabled:s,readOnly:l});case _.DATE:return a.jsx(ga,{name:t,control:r,disabled:s,readOnly:l});case _.TIME:return a.jsx(vf,{name:t,control:r,disabled:s,readOnly:l});case _.HIDDEN:return a.jsx(El,{name:t,control:r});default:return a.jsx(St,{name:t,control:r,type:"text",placeholder:e.placeholder,disabled:s,readOnly:l})}},RN=({name:e,control:t,subSchema:r,disabled:o,readOnly:n})=>{if(!r||r.fields.length===0)return null;const s=[...r.fields].sort((l,i)=>l.ordem-i.ordem);return a.jsxs("div",{className:"rounded-xl border border-input bg-muted/30 p-4 space-y-4",children:[r.titulo&&a.jsx("h4",{className:"text-sm font-semibold text-muted-foreground",children:r.titulo}),a.jsx("div",{className:"grid grid-cols-12 gap-4",children:s.map(l=>{const i=`${e}.${l.nome}`,c=l.tipo===_.CHECKBOX||l.tipo===_.SWITCH||l.tipo===_.HIDDEN,d=l.tamanho??6;return a.jsxs("div",{className:`col-span-${d}`,children:[!c&&a.jsxs("label",{className:"mb-1 block text-sm font-medium text-foreground",children:[l.label,l.obrigatorio&&a.jsx("span",{className:"text-destructive",children:" *"})]}),a.jsx(TN,{field:l,name:i,control:t,disabled:o,readOnly:n})]},l.id)})})]})},bf=({field:e,control:t,nameOverride:r})=>{var o,n;const s=r??e.nome,{componentMapper:l}=vr(),i=l==null?void 0:l[e.tipo];if(i)return a.jsx(i,{name:s,control:t,field:e});const c={name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly};switch(e.tipo){case _.TEXTO:return a.jsx(St,{...c,type:"text"});case _.EMAIL:return a.jsx(St,{...c,type:"email"});case _.NUMBER:return a.jsx(St,{...c,type:"number"});case _.PASSWORD:return a.jsx(kN,{...c});case _.TEXTAREA:return a.jsx(kl,{...c});case _.SELECT:return a.jsx(Sl,{...c,options:e.opcoes??[]});case _.AUTOCOMPLETE:return a.jsx(EN,{...c,options:e.opcoes??[]});case _.SWITCH:return a.jsx(gf,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.SLIDER:return a.jsx(SN,{name:s,control:t,minValue:e.minValue,maxValue:e.maxValue,step:e.step,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.RATING:return a.jsx(_N,{name:s,control:t,maxRating:e.maxRating,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.COLOR:return a.jsx($N,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.TIME:return a.jsx(vf,{...c});case _.DATE_RANGE:return a.jsx(AN,{name:s,control:t,startLabel:e.dateRangeStartLabel,endLabel:e.dateRangeEndLabel,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.RADIO:return a.jsx(mf,{...c,options:e.opcoes??[]});case _.CHECKBOX:return a.jsx($l,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.CHECKBOX_GROUP:return a.jsx(uf,{...c,options:e.opcoes??[]});case _.DATE:return a.jsx(ga,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case _.DATETIME:return a.jsx(ga,{name:s,control:t,isDatetime:!0,disabled:e.isDisabled,readOnly:e.isReadOnly,validacao:e.validacao});case _.FILE:return a.jsx(ff,{name:s,control:t,disabled:e.isDisabled,fileTypes:(o=e.validacao)==null?void 0:o.fileTypes,maxFileSize:(n=e.validacao)==null?void 0:n.maxFileSize});case _.TELEFONE:return a.jsx(kr,{...c,maskType:"telefone"});case _.CPF:return a.jsx(kr,{...c,maskType:"cpf"});case _.CEP:return a.jsx(xf,{name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly,cepFillMap:e.cepFillMap});case _.HIDDEN:return a.jsx(El,{name:s,control:t});case _.PARTICIPATION_TYPE:return a.jsx(bN,{name:s,control:t});case _.PAYMENT_METHOD:return a.jsx(NN,{name:s,control:t,relatedFieldName:e.relatedFieldName});case _.TERMS:return a.jsx(CN,{name:s,control:t,label:e.label,termoTexto:e.termoTexto,termoPdfUrl:e.termoPdfUrl,termoPdfUploadId:e.termoPdfUploadId});case _.FIELD_ARRAY:return a.jsx(fN,{name:s,control:t,subFields:e.subFields,minItems:e.minItems,maxItems:e.maxItems,itemLabel:e.itemLabel,addLabel:e.addLabel});case _.SUB_FORM:return a.jsx(RN,{name:s,control:t,subSchema:e.subSchema,disabled:e.isDisabled,readOnly:e.isReadOnly});default:return a.jsx(St,{...c,type:"text"})}},DN=({container:e,control:t})=>{var r;const{externalData:o={},fieldResolvers:n}=vr(),s=e.icone?wt[e.icone]:void 0,l=o,i=k.useMemo(()=>Cl(e,l),[e,JSON.stringify(l)]),c=k.useMemo(()=>[...i.campos].sort((g,w)=>g.ordem-w.ordem),[i.campos]),d=na({control:t}),{wrapperClass:m,wrapperStyle:u,headerClass:h,headerStyle:p,tmpl:y}=df(),f=g=>{if(!Ze(g.condicional,d,o))return null;let w=g;if(g.resolvePropsKey&&n!=null&&n[g.resolvePropsKey]){const S=n[g.resolvePropsKey](g,d,o);w={...g,...S}}if(w.opcoesFromVar){const S=o[w.opcoesFromVar];Array.isArray(S)&&(w={...w,opcoes:S.map($=>typeof $=="string"?{valor:$,label:$}:$&&typeof $=="object"&&"valor"in $&&"label"in $?$:{valor:String($),label:String($)})})}const v=w.tamanho??12,b=w.inicioColuna,j=b?`${b} / span ${v}`:`span ${v}`,N=a.jsx(bf,{field:w,control:t});return w.tipo===_.CHECKBOX||w.tipo===_.HIDDEN||w.tipo===_.SWITCH?a.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:j},children:N},w.id):a.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:j},children:[a.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[w.label,w.obrigatorio&&a.jsx("span",{className:"text-destructive",children:"*"})]}),N,w.hint&&a.jsx("p",{className:"text-xs text-muted-foreground",children:w.hint})]},w.id)};return a.jsxs("div",{className:m,style:u,children:[(i.titulo||s)&&a.jsx("div",{className:h,style:p,children:a.jsxs("div",{className:"flex items-center gap-3",children:[s&&a.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:a.jsx(s,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),a.jsxs("div",{children:[a.jsx("h3",{className:((r=y.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:i.titulo}),i.descricao&&a.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:i.descricao})]})]})}),a.jsx("div",{className:"p-6 grid grid-cols-12 gap-4",children:c.map(f)})]})},PN=({container:e,control:t})=>{var r;const{externalData:o={}}=vr(),n=e.nome??"__invalid__",s=e.minItems??1,l=e.maxItems,i=e.itemLabel??"Item",c=e.icone?wt[e.icone]:void 0,d=o,m=k.useMemo(()=>Cl(e,d),[e,JSON.stringify(d)]),u=k.useMemo(()=>[...m.campos].sort((C,E)=>C.ordem-E.ordem),[m.campos]),h=k.useCallback(()=>{const C={};for(const E of u)E.initialValue!==void 0?C[E.nome]=typeof E.initialValue=="string"?dt(E.initialValue,d):E.initialValue:E.defaultValue!==void 0&&(C[E.nome]=E.defaultValue);return C},[u,d]),{fields:p,append:y,remove:f}=cf({control:t,name:n});k.useEffect(()=>{if(e.nome&&p.length<s)for(let C=p.length;C<s;C++)y(h())},[s]);const g=na({control:t}),w=k.useMemo(()=>{const C=g[n];return Array.isArray(C)?C:[]},[g,n]),{wrapperClass:v,wrapperStyle:b,headerClass:j,headerStyle:N,tmpl:S}=df();if(!e.nome)return console.error("[RepeatableContainerRenderer] container.nome é obrigatório para containers repetíveis. Container id:",e.id),null;const $=(C,E)=>{const A=w[E]??{};if(!Ze(C.condicional,A,o))return null;const I=`${n}.${E}.${C.nome}`,M=C.tamanho??12,T=C.inicioColuna,B=T?`${T} / span ${M}`:`span ${M}`,q=a.jsx(bf,{field:C,control:t,nameOverride:I});return C.tipo===_.CHECKBOX||C.tipo===_.HIDDEN?a.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:B},children:q},`${C.id}-${E}`):a.jsxs("div",{className:"max-sm:!col-span-12 space-y-2",style:{gridColumn:B},children:[a.jsxs("label",{className:"font-medium flex items-center gap-1",style:{color:"var(--t-text)"},children:[C.label,C.obrigatorio&&a.jsx("span",{className:"text-destructive",children:"*"})]}),q,C.hint&&a.jsx("p",{className:"text-xs text-muted-foreground",children:C.hint})]},`${C.id}-${E}`)};return a.jsxs("div",{className:v,style:b,children:[(m.titulo||c)&&a.jsx("div",{className:j,style:N,children:a.jsxs("div",{className:"flex items-center gap-3",children:[c&&a.jsx("div",{className:"p-2 rounded-xl",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:a.jsx(c,{className:"w-5 h-5",style:{color:"var(--t-primary)"}})}),a.jsxs("div",{children:[a.jsx("h3",{className:((r=S.typography)==null?void 0:r.stepTitleClass)??"text-lg font-semibold",style:{color:"var(--t-text)"},children:m.titulo}),m.descricao&&a.jsx("p",{className:"text-sm",style:{color:"var(--t-text-muted)"},children:m.descricao})]})]})}),a.jsxs("div",{className:"p-6 space-y-4",children:[p.map((C,E)=>a.jsxs("div",{className:"border border-input rounded-lg p-4 bg-muted/30",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"w-6 h-6 rounded-full flex items-center justify-center text-xs font-bold shrink-0 bg-primary text-primary-foreground",children:E+1}),a.jsxs("span",{className:"text-sm font-semibold",children:[i," ",E+1]})]}),p.length>s&&a.jsx("button",{type:"button",onClick:()=>f(E),className:"inline-flex items-center justify-center rounded-md p-1.5 text-destructive hover:bg-destructive/10 transition-colors","aria-label":"Remover item",children:a.jsx(O.Trash2,{className:"w-4 h-4"})})]}),a.jsx("div",{className:"grid grid-cols-12 gap-4",children:u.map(A=>$(A,E))})]},C.id)),(!l||p.length<l)&&a.jsxs("button",{type:"button",className:"w-full flex items-center justify-center gap-2 py-2 px-4 border border-input rounded-lg text-sm hover:bg-accent transition-colors",onClick:()=>y(h()),children:[a.jsx(O.Plus,{className:"w-4 h-4"}),"Adicionar ",i.toLowerCase()]}),l&&a.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["Máximo de ",l," ",i.toLowerCase(),l>1?"s":""]})]})]})},ON=e=>e.container.repeatable&&e.container.nome?a.jsx(PN,{...e}):a.jsx(DN,{...e}),IN=({step:e,control:t,externalData:r={}})=>{const o=k.useMemo(()=>[...e.containers].sort((s,l)=>s.ordem-l.ordem),[e.containers]),n=na({control:t});return a.jsx("div",{className:"grid grid-cols-12 gap-4",children:o.map(s=>{if(s.condicional&&!Ze(s.condicional,n,r))return null;const l=s.tamanho??12,i=s.inicioColuna,c=i?`${i} / span ${l}`:`span ${l}`;return a.jsx("div",{className:"max-sm:!col-span-12",style:{gridColumn:c},children:a.jsx(ON,{container:s,control:t})},s.id)})})},FN=k.createContext({submitting:!1,warnings:{},requestSubmit:()=>{}}),LN=FN.Provider,oc=({stepIndex:e,totalSteps:t,step:r,defaultValues:o,externalData:n,fieldErrors:s,isSubmitting:l,submitError:i,validatorMapper:c={},onWarningsChange:d,onValuesChange:m,onSubmit:u,onBack:h})=>{const p=e===t-1,y=k.useMemo(()=>JSON.stringify(n),[n]),f=k.useMemo(()=>rN(r,n,c),[r.id,y]),g=k.useMemo(()=>aN(r,n,c),[r.id,y]),[w,v]=k.useState({}),b=k.useRef(d);b.current=d;const j=n,N=k.useMemo(()=>lN(r,j),[r,y]),S=Kj({resolver:f,defaultValues:o,mode:"onTouched"}),{control:$,handleSubmit:C,setError:E,clearErrors:A,setValue:I}=S;k.useEffect(()=>{A();for(const[U,Q]of Object.entries(s))E(U,{type:"server",message:Q})},[s,E,A]);const M=k.useMemo(()=>r.containers.filter(U=>!U.repeatable).flatMap(U=>U.campos).filter(U=>!!U.condicional),[r.containers]),T=k.useMemo(()=>r.containers.filter(U=>!!U.condicional),[r.containers]),B=k.useMemo(()=>r.containers.filter(U=>!U.repeatable).flatMap(U=>U.campos).filter(U=>{var Q;return U.condicional&&((Q=U.setValues)==null?void 0:Q.length)}),[r.containers]),q=k.useMemo(()=>r.containers.filter(U=>U.repeatable&&!!U.nome).map(U=>({container:U,fields:U.campos.filter(Q=>!!Q.condicional)})).filter(U=>U.fields.length>0),[r.containers]),W=k.useRef({}),X=k.useRef(!0),V=na({control:$}),L=k.useRef(m);L.current=m,k.useEffect(()=>{var U;(U=L.current)==null||U.call(L,V)},[V]),k.useEffect(()=>{let U=!1;return g(V).then(Q=>{var ee;U||(v(Q),(ee=b.current)==null||ee.call(b,Q))}).catch(Q=>{U||console.error("[StepForm] warnComputer error:",Q)}),()=>{U=!0}},[V,g]),k.useEffect(()=>{var U;if(!M.length&&!B.length&&!T.length&&!q.length)return;const Q=V;for(const H of M)if(!Ze(H.condicional,Q,n)){if(A(H.nome),H.tipo===_.FIELD_ARRAY){const K=Q[H.nome];Array.isArray(K)&&K.forEach((G,Y)=>{(H.subFields??[]).forEach(Z=>A(`${H.nome}.${Y}.${Z.nome}`))})}if(H.clearedValue!==void 0){const K=H.clearedValue??"";Q[H.nome]!==K&&I(H.nome,K,{shouldValidate:!1})}}for(const H of T)if(!Ze(H.condicional,Q,n))if(H.repeatable&&H.nome)(Array.isArray(Q[H.nome])?Q[H.nome]:[]).forEach((K,G)=>{for(const Y of H.campos)A(`${H.nome}.${G}.${Y.nome}`)});else for(const K of H.campos){A(K.nome);const G=K.clearedValue!==void 0?K.clearedValue:void 0;G!==void 0&&Q[K.nome]!==G&&I(K.nome,G,{shouldValidate:!1})}for(const{container:H,fields:K}of q){const G=H.nome,Y=Array.isArray(Q[G])?Q[G]:[];for(let Z=0;Z<Y.length;Z++){const te=Y[Z];for(const ue of K)if(!Ze(ue.condicional,te,n)&&(A(`${G}.${Z}.${ue.nome}`),ue.clearedValue!==void 0)){const ve=ue.clearedValue??"";te[ue.nome]!==ve&&I(`${G}.${Z}.${ue.nome}`,ve,{shouldValidate:!1})}}}const ee=X.current;for(const H of B){const K=Ze(H.condicional,Q,n),G=ee?K:W.current[H.nome]??!1;if(K&&!G&&(U=H.setValues)!=null&&U.length)for(const Y of H.setValues){const Z=typeof Y.valor=="string"?dt(Y.valor,j):Y.valor;I(Y.campo,Z,{shouldValidate:!1})}W.current[H.nome]=K}X.current=!1},[V,M,B,T,q,n,I,A]);const P=N.icone?wt[N.icone]:void 0,se=k.useMemo(()=>()=>{S.handleSubmit(u)()},[u]);return a.jsx(Dj,{...S,children:a.jsx(LN,{value:{submitting:l,warnings:w,requestSubmit:se},children:a.jsx("form",{onSubmit:C(u),noValidate:!0,onKeyDown:U=>{U.key==="Enter"&&U.target.tagName==="INPUT"&&U.preventDefault()},children:a.jsxs("div",{className:"space-y-6",children:[N.showLabel!==!1&&a.jsxs("div",{className:"text-center space-y-2",children:[P&&a.jsx("div",{className:"w-12 h-12 mx-auto rounded-xl flex items-center justify-center",style:{background:"color-mix(in srgb, var(--t-primary) 12%, transparent)"},children:a.jsx(P,{className:"w-6 h-6",style:{color:"var(--t-primary)"}})}),a.jsx("h2",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:N.titulo}),N.descricao&&a.jsx("p",{className:"text-sm text-muted-foreground",children:N.descricao})]}),a.jsx(IN,{step:N,control:$,externalData:n}),a.jsxs("div",{className:"flex items-center justify-between gap-4 pt-6 pb-2",children:[a.jsxs($e,{type:"button",variant:"outline",onClick:h,disabled:e===0,className:J(e>0&&"border-primary/40 text-primary hover:bg-primary/5"),children:[a.jsx(O.ChevronLeft,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Anterior"})]}),a.jsxs("span",{className:"text-xs font-semibold tabular-nums sm:hidden text-muted-foreground",children:[e+1,"/",t]}),a.jsxs($e,{type:"submit",disabled:l,children:[l?a.jsx(O.Loader2,{className:"w-4 h-4 animate-spin"}):p?a.jsx(O.Check,{className:"w-4 h-4"}):a.jsx(O.ChevronRight,{className:"w-4 h-4"}),a.jsx("span",{className:"hidden sm:inline",children:p?"Finalizar":"Próximo"})]})]}),i&&a.jsx("p",{className:"text-sm text-destructive mt-2 text-center",children:i})]})})})})},vo=e=>{if(e)return wt[e]},MN=({steps:e,currentStep:t,onStepClick:r})=>a.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((o,n)=>a.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(n),onKeyDown:s=>s.key==="Enter"&&(r==null?void 0:r(n)),className:J("w-8 h-8 rounded-full flex items-center justify-center text-xs font-bold transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:n===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:n<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:n<t?a.jsx(O.Check,{className:"w-4 h-4"}):n+1},o.id))}),VN=({steps:e,currentStep:t,onStepClick:r})=>a.jsx("div",{className:"flex items-center justify-center gap-2 flex-wrap",children:e.map((o,n)=>{const s=vo(o.icone)??O.CircleDot;return a.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:()=>r==null?void 0:r(n),onKeyDown:l=>l.key==="Enter"&&(r==null?void 0:r(n)),className:J("w-9 h-9 rounded-full flex items-center justify-center transition-all shrink-0",r&&"cursor-pointer hover:opacity-80"),style:n===t?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 0 3px color-mix(in srgb, var(--t-primary) 30%, transparent)"}:n<t?{background:"#22c55e",color:"#ffffff"}:{background:"hsl(var(--muted))",color:"hsl(var(--muted-foreground))"},children:n<t?a.jsx(O.Check,{className:"w-4 h-4"}):a.jsx(s,{className:"w-4 h-4"})},o.id)})}),zN=({steps:e,currentStep:t,position:r,orientation:o="horizontal",onStepClick:n})=>o==="vertical"?a.jsx("div",{className:"flex flex-col gap-0",children:e.map((s,l)=>{const i=vo(s.icone)??O.CircleDot,c=l===t,d=l<t,m=l===e.length-1;return a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsxs("div",{className:"flex flex-col items-center",children:[a.jsx("button",{type:"button",onClick:()=>n==null?void 0:n(l),className:J("w-8 h-8 rounded-full flex items-center justify-center transition-all shrink-0",n&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#fff",boxShadow:"0 0 10px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#fff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?a.jsx(O.Check,{className:"w-3.5 h-3.5"}):a.jsx(i,{className:"w-3.5 h-3.5"})}),!m&&a.jsx("div",{className:"w-[2px] my-1",style:{height:"24px",background:d?"#22c55e":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]}),a.jsx("span",{className:"text-sm font-medium leading-tight mt-1.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]},s.id)})}):a.jsx("div",{className:"w-full flex items-start",children:e.map((s,l)=>{const i=vo(s.icone)??O.CircleDot,c=l===t,d=l<t,m=l===e.length-1;return a.jsxs("div",{className:J("flex items-start",!m&&"flex-1"),children:[a.jsxs("div",{className:"flex flex-col items-center gap-1.5 w-[56px] shrink-0 mx-auto",children:[a.jsx("button",{type:"button",onClick:()=>n==null?void 0:n(l),className:J("w-10 h-10 rounded-full flex items-center justify-center transition-all shrink-0",n&&"cursor-pointer hover:opacity-80"),style:c?{background:"var(--t-primary)",color:"#ffffff",boxShadow:"0 0 12px color-mix(in srgb, var(--t-primary) 50%, transparent)"}:d?{background:"#22c55e",color:"#ffffff"}:{background:"color-mix(in srgb, var(--t-text) 8%, transparent)",color:"var(--t-text-muted)",border:"1.5px solid color-mix(in srgb, var(--t-border) 60%, transparent)"},children:d?a.jsx(O.Check,{className:"w-4 h-4"}):a.jsx(i,{className:"w-4 h-4"})}),a.jsx("span",{className:"text-[10px] font-medium text-center leading-tight line-clamp-2 px-0.5",style:c?{color:"var(--t-primary)"}:d?{color:"#16a34a"}:{color:"var(--t-text-muted)"},children:s.label??s.id})]}),!m&&a.jsx("div",{className:"flex-1 h-[1.5px] mt-5 mx-1",style:{background:d?"linear-gradient(90deg, var(--t-primary), color-mix(in srgb, var(--t-primary) 40%, transparent))":"color-mix(in srgb, var(--t-border) 50%, transparent)"}})]},s.id)})}),yf=({steps:e,currentStep:t,onStepClick:r,className:o,forceShow:n})=>{const s=ba(),{layout:l}=s;if(!l.showStepIndicators||e.length<=1&&!n)return null;const i=l.stepIndicatorVariant??"numbers",c=l.stepIndicatorPosition??"top-center",d=l.stepIndicatorOrientation??"horizontal",m=(t+1)/e.length*100,u=e[t],h=vo(u==null?void 0:u.icone)??O.CircleDot,p=a.jsx("div",{className:"h-1 rounded-full overflow-hidden",style:{background:"color-mix(in srgb, var(--t-primary) 15%, transparent)"},children:a.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${m}%`,background:"linear-gradient(90deg, var(--t-primary), var(--t-accent))"}})}),y=a.jsxs("div",{className:"block sm:hidden space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"w-10 h-10 rounded-full flex items-center justify-center shrink-0",style:{background:"var(--t-primary)",color:"#fff"},children:a.jsx(h,{className:"w-5 h-5"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-semibold leading-tight truncate",style:{color:"var(--t-text)"},children:(u==null?void 0:u.label)??(u==null?void 0:u.id)}),a.jsxs("p",{className:"text-xs leading-tight",style:{color:"var(--t-text-muted)"},children:["Passo ",t+1," de ",e.length]})]})]}),p]}),f=a.jsxs("div",{className:"hidden sm:block",children:[i==="numbers"&&a.jsx(MN,{steps:e,currentStep:t,onStepClick:r}),i==="icons"&&a.jsx(VN,{steps:e,currentStep:t,onStepClick:r}),i==="icons-labeled"&&a.jsx(zN,{steps:e,currentStep:t,position:c,orientation:d,onStepClick:r})]}),g=l.showProgressBar?a.jsx("div",{className:"hidden sm:block",children:p}):null;return d==="vertical"?a.jsxs("div",{className:J("flex gap-6 items-start",o),children:[y,a.jsxs("div",{className:"hidden sm:flex gap-6 items-start shrink-0",children:[f,g&&a.jsx("div",{className:"flex-1 pt-4",children:g})]})]}):a.jsxs("div",{className:J("space-y-3",o),children:[y,a.jsxs("div",{className:"hidden sm:block space-y-3",children:[f,g]})]})},BN=(e,t,r)=>{var o;const n={...t},s=r;for(const l of e.containers){for(const i of l.campos)if(n[i.nome]===void 0&&(i.initialValue!==void 0?n[i.nome]=typeof i.initialValue=="string"?dt(i.initialValue,s):i.initialValue:i.defaultValue!==void 0&&(n[i.nome]=i.defaultValue)),i.tipo===_.FIELD_ARRAY&&(o=i.subFields)!=null&&o.length){const c=n[i.nome];Array.isArray(c)&&c.length>0&&(n[i.nome]=c.map(d=>{const m={...d};for(const u of i.subFields)m[u.nome]===void 0&&(u.initialValue!==void 0?m[u.nome]=typeof u.initialValue=="string"?dt(u.initialValue,s):u.initialValue:u.defaultValue!==void 0&&(m[u.nome]=u.defaultValue));return m}))}if(l.repeatable&&l.nome){const i=n[l.nome];Array.isArray(i)&&i.length>0&&(n[l.nome]=i.map(c=>{const d={...c};for(const m of l.campos)d[m.nome]===void 0&&(m.initialValue!==void 0?d[m.nome]=typeof m.initialValue=="string"?dt(m.initialValue,s):m.initialValue:m.defaultValue!==void 0&&(d[m.nome]=m.defaultValue));return d}))}}return n},UN=({schema:e,initialValues:t={},initialStep:r=0,onSubmitStep:o,onComplete:n,template:s,formTitle:l,externalData:i={},fieldErrors:c={},uploadFile:d,cepLookup:m,resolveTermsUploadUrl:u,fieldResolvers:h,validatorMapper:p,componentMapper:y,paymentMethodOptions:f,onValuesChange:g,className:w,StepIndicator:v=yf})=>{const[b,j]=k.useState(()=>r),[N,S]=k.useState({...t}),[$,C]=k.useState(()=>r),[E,A]=k.useState(!1),[I,M]=k.useState(null),[T,B]=k.useState({}),q=k.useMemo(()=>JSON.stringify(i),[i]),W=k.useMemo(()=>JSON.stringify(e.stepConfig),[e.stepConfig]),X=k.useMemo(()=>{const Y=yo(s);return e.stepConfig?{...Y,layout:{...Y.layout,...e.stepConfig}}:Y},[s,W]),V=k.useMemo(()=>[...e.steps].sort((Y,Z)=>Y.ordem-Z.ordem),[e.steps]),L=V.length,P=L>0?V[Math.min(b,L-1)]:null,se=k.useMemo(()=>P?BN(P,N,i):{},[P,N,q]),U=k.useMemo(()=>({uploadFile:d,cepLookup:m,resolveTermsUploadUrl:u,externalData:i,fieldResolvers:h,validatorMapper:p,fieldWarnings:T,componentMapper:y,paymentMethodOptions:f}),[d,m,u,h,p,T,y,f,q]),Q=k.useCallback(async Y=>{if(!E){A(!0),M(null);try{const Z={...N,...Y};if(S(Z),o&&await o(b,Y),b===L-1)n&&await n(Z);else{const te=b+1;j(te),C(ue=>Math.max(ue,te))}}catch(Z){console.error("[FormRenderer] Submit error:",Z);const te=Z instanceof Error?Z.message:"Ocorreu um erro. Tente novamente.";M(te)}finally{A(!1)}}},[b,N,E,L,o,n]),ee=k.useCallback(()=>{b>0&&j(Y=>Y-1)},[b]);if(!P)return a.jsx(gs.Provider,{value:U,children:a.jsx(pa,{config:X,className:`min-h-dvh ${X.wrapperClass??""} ${w??""}`,renderWrapper:!0,children:a.jsx("div",{className:"w-full max-w-4xl mx-auto px-4 py-6 sm:px-6 text-center text-muted-foreground",children:"Nenhum step configurado."})})});const H=X.layout.eventTitleStyle??"bar",K=(X.layout.stepIndicatorOrientation??"horizontal")==="vertical",G=L>=1?a.jsx(v,{steps:V.map(Y=>({id:Y.id,label:Y.titulo,icone:Y.icone})),currentStep:b,onStepClick:Y=>{Y!==b&&Y<=$&&j(Y)}}):null;return a.jsx(gs.Provider,{value:U,children:a.jsx(pa,{config:X,className:`min-h-dvh ${X.wrapperClass??""} ${w??""}`,renderWrapper:!0,children:a.jsxs("div",{className:"w-full max-w-4xl mx-auto px-4 py-6 sm:px-6",children:[l&&H==="bar"&&a.jsx("div",{className:"w-full text-center text-sm font-medium py-2.5 px-4 mb-6 rounded-lg border border-input text-muted-foreground bg-muted/30",children:l}),l&&H==="inline"&&a.jsxs("div",{className:"text-center mb-6",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest mb-1",style:{color:"var(--t-text-muted)"},children:"Inscrição"}),a.jsx("h1",{className:"text-2xl font-bold",style:{color:"var(--t-text)"},children:l}),a.jsx("div",{className:"h-0.5 w-12 mx-auto mt-3 rounded-full",style:{background:"var(--t-primary)"}})]}),K?a.jsxs("div",{className:"flex gap-6 items-start",children:[a.jsx("div",{className:"hidden sm:block shrink-0 w-44 pt-1",children:G}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("div",{className:"sm:hidden mb-6",children:G}),a.jsx(oc,{stepIndex:b,totalSteps:L,step:P,defaultValues:se,externalData:i,fieldErrors:c,isSubmitting:E,submitError:I,validatorMapper:p,onWarningsChange:B,onValuesChange:g,onSubmit:Q,onBack:ee},b)]})]}):a.jsxs(a.Fragment,{children:[G&&a.jsx("div",{className:"mb-8",children:G}),a.jsx(oc,{stepIndex:b,totalSteps:L,step:P,defaultValues:se,externalData:i,fieldErrors:c,isSubmitting:E,submitError:I,validatorMapper:p,onWarningsChange:B,onValuesChange:g,onSubmit:Q,onBack:ee},b)]})]})})})},HN=({onFillMock:e,onClear:t})=>a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx(Wp,{}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs($e,{variant:"outline",size:"sm",onClick:e,children:[a.jsx(O.FlaskConical,{className:"w-3.5 h-3.5 mr-1"}),"Preencher mock"]}),a.jsxs($e,{variant:"ghost",size:"sm",onClick:t,children:[a.jsx(O.Eraser,{className:"w-3.5 h-3.5 mr-1"}),"Limpar"]})]})]}),WN=({onRestart:e})=>a.jsxs("div",{className:"max-w-4xl mx-auto flex flex-col items-center justify-center py-16 space-y-4",children:[a.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center",children:a.jsx(O.PartyPopper,{className:"w-8 h-8 text-primary"})}),a.jsx("h2",{className:"text-xl font-bold text-foreground",children:"Formulário enviado!"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Este é um preview simulado. Nenhum dado foi enviado."}),a.jsxs($e,{variant:"outline",onClick:e,children:[a.jsx(O.RotateCcw,{className:"w-4 h-4 mr-1"}),"Recomeçar"]})]}),qN=e=>a.jsx(yf,{...e,forceShow:!0}),XN=async(e,t,r)=>{for(let o=20;o<=100;o+=20)await new Promise(n=>setTimeout(n,80)),r==null||r(o);return`mock-upload-${Date.now()}`},GN=async e=>({}),nc={texto:"Texto de teste",textarea:"Texto longo de exemplo para preview do formulário.",email:"teste@email.com",number:42,telefone:"(11) 99999-9999",cpf:"123.456.789-00",cep:"01001-000",date:new Date().toISOString().slice(0,10),datetime:new Date().toISOString().slice(0,10),time:"10:30",password:"Senha123!",masked:"123456",checkbox:!0,switch:!0,slider:50,rating:4,color:"#3B82F6",participation_type:{tipo:"todos_os_dias",data:null,genero:null},payment_method:{metodo:"pix",valorTotal:0},date_range:{start:new Date().toISOString().slice(0,10),end:new Date().toISOString().slice(0,10)},file:"mock-upload-preview"};function KN(e){var t,r;const o=e.tipo;if(!(o==="hidden"||o==="terms"||o==="field_array"))return nc[o]!==void 0?nc[o]:(o==="select"||o==="radio"||o==="autocomplete")&&(t=e.opcoes)!=null&&t.length?e.opcoes[0].valor:o==="checkbox_group"&&(r=e.opcoes)!=null&&r.length?[e.opcoes[0].valor]:"Teste"}function YN(e){const t={};for(const r of e.steps)for(const o of r.containers)for(const n of o.campos){const s=KN(n);s!==void 0&&(t[n.nome]=s)}return t}const ZN=({eventoData:e})=>{const{containers:t,configs:r,previewTemplateId:o,stepConfig:n}=mt(),s=k.useMemo(()=>Gp({containers:t},r,{nome:"Preview",status:ys.RASCUNHO,template:o,stepConfig:n}),[t,r,o,n]),[l,i]=k.useState(0),[c,d]=k.useState({}),[m,u]=k.useState(!1),h=k.useCallback(()=>{d(YN(s)),i(f=>f+1),u(!1)},[s]),p=k.useCallback(()=>{d({}),i(f=>f+1),u(!1)},[]),y=k.useCallback(()=>{d({}),i(f=>f+1),u(!1)},[]);return s.steps.length===0?a.jsx("div",{className:"rounded-lg border border-dashed border-border/40 p-6 text-center text-xs text-muted-foreground/50",children:"Adicione steps, containers e campos para ver o preview ao vivo"}):m?a.jsx(WN,{onRestart:y}):a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"px-1",children:a.jsx(HN,{onFillMock:h,onClear:p})}),a.jsx(UN,{schema:s,initialValues:c,template:o,externalData:e,uploadFile:XN,cepLookup:GN,onComplete:async()=>u(!0),StepIndicator:qN},l)]})},wf=({id:e,currentTamanho:t,inicioColuna:r,onResize:o,pushSnapshot:n})=>{const s=k.useRef(null),[l,i]=k.useState(!1),[c,d]=k.useState(null),m=k.useRef(null);k.useEffect(()=>()=>{var h;(h=m.current)==null||h.call(m)},[]);const u=k.useCallback(h=>{h.preventDefault(),h.stopPropagation(),n==null||n();const p=s.current;if(!p)return;const y=p.parentElement;if(!y)return;const f=y.getBoundingClientRect().width,g=p.getBoundingClientRect().width,w=h.clientX,v=r?13-r:12;i(!0);const b=N=>{const S=N.clientX-w,$=(g+S)/f,C=Math.max(1,Math.min(v,Math.round($*12)));d(C),o(C)},j=()=>{i(!1),d(null),m.current=null,window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",j)};m.current=()=>{i(!1),d(null),window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",j)},window.addEventListener("mousemove",b),window.addEventListener("mouseup",j)},[r,o,n]);return{resizeRef:s,resizing:l,resizePreview:c,handleResizeStart:u}},JN=({id:e,elementRef:t,onPositionApply:r,setPositionDrag:o,setSelected:n,pushSnapshot:s})=>{const l=k.useRef(null);return k.useEffect(()=>()=>{var i;(i=l.current)==null||i.call(l)},[]),{handlePositionMouseDown:k.useCallback(i=>{i.preventDefault(),i.stopPropagation(),s==null||s(),n(e);const c=t.current;if(!c)return;const d=c.parentElement;if(!d)return;const m=d.getBoundingClientRect(),u=m.width/12,h=c.getBoundingClientRect(),p=Math.max(1,Math.round(h.width/u)),y=h.left-m.left,f=i.clientX-h.left,g=j=>{const N=j-m.left-f,S=Math.round(N/u)+1;return Math.max(1,Math.min(13-p,S))},w=Math.max(1,Math.min(12,Math.round(y/u)+1));o({itemId:e,ghostStart:w,ghostSpan:p,cursorX:i.clientX,cursorY:i.clientY});const v=j=>{o({itemId:e,ghostStart:g(j.clientX),ghostSpan:p,cursorX:j.clientX,cursorY:j.clientY})},b=j=>{r(g(j.clientX)),o(null),l.current=null,window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",b)};l.current=()=>{o(null),window.removeEventListener("mousemove",v),window.removeEventListener("mouseup",b)},window.addEventListener("mousemove",v),window.addEventListener("mouseup",b)},[e,t,r,o,n,s])}},_a=({id:e,container:t})=>{const{attributes:r,listeners:o,setNodeRef:n,transform:s,transition:l,isDragging:i}=Pt.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{selectedId:c,setSelected:d,getConfig:m,updateConfig:u,removeItem:h,setPositionDrag:p,positionDrag:y,pushSnapshot:f}=mt(),g=m(e),w=Np(e),v=(w==null?void 0:w.icon)||O.Type,b=c===e,j=g.tamanho||6,N=(y==null?void 0:y.itemId)===e,[S,$]=k.useState(!1),C="var(--t-primary, hsl(var(--primary)))",E=b?C:S?`color-mix(in srgb, ${C} 60%, transparent)`:`color-mix(in srgb, ${C} 25%, transparent)`,A=b?`0 0 0 2px color-mix(in srgb, ${C} 30%, transparent)`:void 0,{resizeRef:I,resizing:M,resizePreview:T,handleResizeStart:B}=wf({id:e,currentTamanho:j,inicioColuna:g.inicioColuna,onResize:W=>u(e,{tamanho:W}),pushSnapshot:f}),{handlePositionMouseDown:q}=JN({id:e,elementRef:I,onPositionApply:W=>u(e,{inicioColuna:W}),setPositionDrag:p,setSelected:d,pushSnapshot:f});return a.jsxs("div",{ref:W=>{n(W),I.current=W},onClick:W=>{W.stopPropagation(),d(e)},"data-field-id":e,onMouseEnter:()=>$(!0),onMouseLeave:()=>$(!1),className:At("relative flex items-center gap-2 rounded border bg-card/80 backdrop-blur-sm px-2.5 pt-1.5 pb-3.5 cursor-pointer transition-all text-xs",M&&"ring-2 ring-blue-400/50",N&&"opacity-0 pointer-events-none"),style:{gridColumn:g.inicioColuna?`${g.inicioColuna} / span ${j}`:`span ${j}`,transform:va.CSS.Transform.toString(s),transition:l,opacity:i?0:1,borderColor:E,boxShadow:A},children:[a.jsx("div",{onMouseDown:q,onClick:W=>W.stopPropagation(),className:"cursor-ew-resize shrink-0 p-0.5 rounded hover:bg-primary/20 transition-colors",title:"Arrastar para mudar coluna",children:a.jsx(O.ArrowLeftRight,{className:"h-3 w-3 text-primary/60"})}),a.jsx("div",{...o,...r,className:"cursor-grab shrink-0",onClick:W=>W.stopPropagation(),children:a.jsx(O.GripVertical,{className:"h-3 w-3 text-primary"})}),a.jsx(v,{className:"h-3.5 w-3.5 text-primary shrink-0"}),a.jsx("span",{className:"font-medium truncate flex-1",children:g.label}),g.condition&&a.jsx(O.Zap,{className:"h-3 w-3 text-amber-500 shrink-0"}),g.required&&a.jsx("span",{className:"text-destructive font-bold",children:"*"}),a.jsxs("span",{className:"text-[9px] text-muted-foreground shrink-0",children:[T??j,"/12"]}),a.jsx("button",{onClick:W=>{W.stopPropagation(),h(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:S?1:0},children:a.jsx(O.Trash2,{className:"h-3 w-3 text-destructive"})}),a.jsx("div",{className:"absolute left-2 -bottom-0.5 font-mono truncate max-w-[90%] pointer-events-none text-[8px] text-muted-foreground/30",children:e}),a.jsx("div",{"data-resize":!0,onMouseDown:B,className:"cursor-col-resize absolute right-0 top-0 bottom-0 w-2 hover:bg-primary/20 transition-colors flex items-center justify-center",children:a.jsx(O.GripHorizontal,{className:"h-3 w-3 text-primary/40 rotate-90"})})]})},QN=({id:e,container:t})=>{var r;const{attributes:o,listeners:n,setNodeRef:s,transform:l,transition:i,isDragging:c}=Pt.useSortable({id:e,data:{isCanvasItem:!0,type:"field",id:e,fromContainer:t}}),{setNodeRef:d,isOver:m}=Rt.useDroppable({id:`zone-${e}`}),{selectedId:u,setSelected:h,getConfig:p,removeItem:y,moveItem:f,containers:g}=mt(),w=p(e),v=(((r=g[e])==null?void 0:r.children)??[]).filter(N=>Ve(N)==="field"),b=u===e,j=w.tamanho||12;return a.jsxs("div",{ref:s,onClick:N=>{N.stopPropagation(),h(e)},className:At("group/fa relative rounded-lg border overflow-hidden transition-all",c&&"opacity-0 pointer-events-none",b?"border-amber-500 ring-2 ring-amber-500/20 shadow-lg":"border-amber-500/30 hover:border-amber-500/55"),style:{gridColumn:w.inicioColuna?`${w.inicioColuna} / span ${j}`:`span ${j}`,transform:va.CSS.Transform.toString(l),transition:i},children:[a.jsxs("div",{className:At("flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",b?"bg-amber-500/15 border-amber-500/30":"bg-amber-500/10 border-amber-500/20"),children:[a.jsx("div",{...n,...o,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-amber-500/20 transition-colors",onClick:N=>N.stopPropagation(),children:a.jsx(O.GripVertical,{className:"h-3.5 w-3.5 text-amber-500"})}),a.jsxs("div",{className:"flex flex-col -my-1 shrink-0",children:[a.jsx("button",{onClick:N=>{N.stopPropagation(),f(e,"up")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para cima",children:a.jsx(O.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})}),a.jsx("button",{onClick:N=>{N.stopPropagation(),f(e,"down")},className:"p-0 hover:bg-amber-500/10 rounded transition-colors",title:"Mover para baixo",children:a.jsx(O.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-amber-500"})})]}),a.jsx(O.List,{className:"h-3.5 w-3.5 text-amber-500 shrink-0"}),a.jsx("span",{className:"text-xs font-semibold truncate flex-1 text-amber-700 dark:text-amber-300",children:w.label}),a.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0 bg-amber-500/10 px-1.5 rounded",children:[w.itemLabel||"Item"," · ",v.length," campo",v.length!==1?"s":""]}),a.jsx("button",{onClick:N=>{N.stopPropagation(),y(e)},className:"opacity-0 group-hover/fa:opacity-100 transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",children:a.jsx(O.Trash2,{className:"h-3 w-3 text-destructive"})})]}),a.jsx("div",{className:"px-2 -mt-0.5 mb-0.5",children:a.jsx("span",{className:"text-[8px] text-muted-foreground/30 font-mono",children:e})}),a.jsxs("div",{ref:d,className:At("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",m?"bg-amber-500/10 ring-2 ring-inset ring-amber-500/40":""),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[v.length===0&&a.jsx("p",{className:"text-[10px] text-muted-foreground/60 text-center py-2 italic",style:{gridColumn:"span 12"},children:"Arraste campos aqui"}),a.jsx(Pt.SortableContext,{items:v,strategy:Pt.rectSortingStrategy,children:v.map(N=>a.jsx(_a,{id:N,container:e},N))})]})]})},sc=5,e1=({id:e,elementRef:t,tamanho:r,inicioColuna:o,onPositionApply:n,setPositionDrag:s,setSelected:l,reorderStrategy:i})=>{const c=k.useRef({inicioColuna:o,tamanho:r});c.current={inicioColuna:o,tamanho:r};const d=k.useRef(null);return k.useEffect(()=>()=>{var m;(m=d.current)==null||m.call(d)},[]),{handleGripMouseDown:k.useCallback(m=>{m.preventDefault(),m.stopPropagation(),l(e);const u=m.clientX,h=m.clientY;let p=!1;const y=()=>{d.current=null,window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",g)},f=b=>{const j=Math.abs(b.clientX-u),N=Math.abs(b.clientY-h);j<sc&&N<sc||(p=!0,y(),j>=N?w(b):v(b))},g=()=>{p||y()};window.addEventListener("mousemove",f),window.addEventListener("mouseup",g),d.current=y;const w=b=>{const j=t.current;if(!j)return;const N=j.parentElement;if(!N)return;const S=N.getBoundingClientRect(),$=S.width/12,{tamanho:C}=c.current,E=j.getBoundingClientRect(),A=E.left-S.left,I=Math.max(1,Math.min(12,Math.round(A/$)+1)),M=E.left;s({itemId:e,ghostStart:I,ghostSpan:C,cursorX:b.clientX,cursorY:b.clientY});const T=W=>{const X=W-M,V=Math.round(X/$)+1;return Math.max(1,Math.min(13-C,V))};s({itemId:e,ghostStart:T(b.clientX),ghostSpan:C,cursorX:b.clientX,cursorY:b.clientY});const B=W=>{s({itemId:e,ghostStart:T(W.clientX),ghostSpan:C,cursorX:W.clientX,cursorY:W.clientY})},q=W=>{n(T(W.clientX)),s(null),d.current=null,window.removeEventListener("mousemove",B),window.removeEventListener("mouseup",q)};window.addEventListener("mousemove",B),window.addEventListener("mouseup",q),d.current=()=>{s(null),window.removeEventListener("mousemove",B),window.removeEventListener("mouseup",q)}},v=b=>{const j=i,N=t.current;if(!N)return;const S=N.parentElement;if(!S)return;const $=j.dataAttribute||"data-container-id";j.pushSnapshot(),j.setReorderDrag({draggingId:e});let C=b.clientY;const E=I=>{const M=Array.from(S.children).filter(T=>T!==N&&T.getAttribute($));for(const T of M){const B=T.getBoundingClientRect(),q=B.top+B.height/2;if(I.clientY<q&&I.clientY>B.top&&I.clientY<C){j.moveItemNoSnapshot(e,"up"),C=I.clientY;break}else if(I.clientY>q&&I.clientY<B.bottom&&I.clientY>C){j.moveItemNoSnapshot(e,"down"),C=I.clientY;break}}},A=()=>{j.setReorderDrag(null),d.current=null,window.removeEventListener("mousemove",E),window.removeEventListener("mouseup",A)};window.addEventListener("mousemove",E),window.addEventListener("mouseup",A),d.current=()=>{j.setReorderDrag(null),window.removeEventListener("mousemove",E),window.removeEventListener("mouseup",A)}}},[e,t,n,s,l,i])}},Al=({showGuides:e,positionDrag:t})=>!e&&!t?null:a.jsxs(a.Fragment,{children:[e&&a.jsx("div",{className:"absolute inset-0 pointer-events-none z-10",style:{display:"grid",gridTemplateColumns:"repeat(12, 1fr)",padding:"inherit",gap:"inherit"},children:Array.from({length:12},(r,o)=>a.jsx("div",{className:"border border-dashed border-muted-foreground/20 rounded-sm flex items-end justify-center pb-1",children:a.jsx("span",{className:"text-[8px] text-muted-foreground/40 font-mono",children:o+1})},o))}),t&&a.jsx("div",{className:"absolute pointer-events-none z-20 rounded-lg border-2 border-dashed border-destructive/60 bg-destructive/10",style:{top:"12px",bottom:"12px",left:`calc(${(t.ghostStart-1)/12*100}% + 12px)`,width:`calc(${t.ghostSpan/12*100}% - 8px)`,transition:"left 0.1s ease-out, width 0.1s ease-out"},children:a.jsxs("div",{className:"absolute -top-5 left-1/2 -translate-x-1/2 bg-destructive text-destructive-foreground text-[10px] font-bold px-2 py-0.5 rounded whitespace-nowrap",children:[t.ghostStart," →"," ",t.ghostStart+t.ghostSpan-1]})})]}),_l=({id:e,container:t})=>{var r;const{setNodeRef:o,isOver:n}=Rt.useDroppable({id:`zone-${e}`}),{selectedId:s,setSelected:l,getConfig:i,updateConfig:c,removeItem:d,moveItem:m,moveItemNoSnapshot:u,setPositionDrag:h,positionDrag:p,reorderDrag:y,setReorderDrag:f,pushSnapshot:g,containers:w}=mt(),v=i(e),b=((r=w[e])==null?void 0:r.children)??[],j=b.filter(ee=>Ve(ee)==="field"),N=s===e,S=v.tamanho||12,$=(p==null?void 0:p.itemId)===e,C=(y==null?void 0:y.draggingId)===e,E=p&&b.includes(p.itemId),A=s&&b.includes(s)&&Ve(s)==="field",[I,M]=k.useState(!1),T="var(--t-primary, hsl(var(--primary)))",B=N?T:I?"rgba(59,130,246,0.55)":"rgba(59,130,246,0.3)",q=N?`color-mix(in srgb, ${T} 15%, transparent)`:I?"rgba(59,130,246,0.12)":"rgba(59,130,246,0.07)",W=N?`color-mix(in srgb, ${T} 30%, transparent)`:I?"rgba(59,130,246,0.28)":"rgba(59,130,246,0.18)",X=N?`0 0 0 3px color-mix(in srgb, ${T} 20%, transparent)`:I?"0 0 0 2px rgba(59,130,246,0.25)":void 0,{resizeRef:V,resizing:L,resizePreview:P,handleResizeStart:se}=wf({id:e,currentTamanho:S,inicioColuna:v.inicioColuna,onResize:ee=>c(e,{tamanho:ee}),pushSnapshot:g}),U=k.useMemo(()=>({kind:"custom",moveItemNoSnapshot:u,pushSnapshot:g,setReorderDrag:f,dataAttribute:"data-container-id"}),[u,g,f]),{handleGripMouseDown:Q}=e1({id:e,elementRef:V,tamanho:S,inicioColuna:v.inicioColuna||1,onPositionApply:ee=>c(e,{inicioColuna:ee}),setPositionDrag:h,setSelected:l,reorderStrategy:U});return a.jsxs(a.Fragment,{children:[a.jsxs("div",{ref:ee=>{V.current=ee},onClick:ee=>{ee.stopPropagation(),l(e)},onMouseEnter:()=>M(!0),onMouseLeave:()=>M(!1),className:At("relative rounded-lg border overflow-hidden transition-all",L&&"ring-2 ring-blue-400/50",$&&"opacity-0 pointer-events-none",C&&"opacity-50"),"data-container-id":e,style:{gridColumn:v.inicioColuna?`${v.inicioColuna} / span ${S}`:`span ${S}`,minWidth:"80px",borderColor:B,boxShadow:X},children:[a.jsxs("div",{className:"flex items-center gap-1.5 border-b px-2 py-1.5 transition-colors",style:{backgroundColor:q,borderColor:W},children:[a.jsx("div",{"data-grip":!0,onMouseDown:Q,className:"cursor-grab shrink-0 p-1 -ml-1 rounded hover:bg-primary/20 transition-colors",children:a.jsx(O.GripVertical,{className:"h-3.5 w-3.5 text-blue-500"})}),a.jsxs("div",{className:"flex flex-col -my-1 shrink-0",children:[a.jsx("button",{onClick:ee=>{ee.stopPropagation(),m(e,"up")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para cima",children:a.jsx(O.ChevronUp,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})}),a.jsx("button",{onClick:ee=>{ee.stopPropagation(),m(e,"down")},className:"p-0 hover:bg-primary/10 rounded transition-colors",title:"Mover para baixo",children:a.jsx(O.ChevronDown,{className:"h-3 w-3 text-muted-foreground hover:text-primary"})})]}),a.jsx(O.BoxSelect,{className:"h-3.5 w-3.5 text-blue-500 shrink-0"}),a.jsx("span",{className:At("text-xs font-semibold truncate flex-1",v.showLabel===!1?"text-blue-500/50 italic":"text-blue-700 dark:text-blue-300"),children:v.label}),v.showAsCard&&a.jsx(O.SquareStack,{className:"h-3 w-3 text-blue-400 shrink-0"}),v.showLabel===!1&&a.jsx(O.EyeOff,{className:"h-3 w-3 text-muted-foreground/50 shrink-0"}),a.jsxs("span",{className:"text-[10px] text-muted-foreground shrink-0 bg-blue-500/10 px-1.5 rounded",children:[P??S,"/12"]}),a.jsx("button",{onClick:ee=>{ee.stopPropagation(),d(e)},className:"transition-opacity shrink-0 p-0.5 rounded hover:bg-destructive/10",style:{opacity:I?1:0},children:a.jsx(O.Trash2,{className:"h-3 w-3 text-destructive"})})]}),a.jsx("div",{className:"px-2 -mt-0.5 mb-0.5",children:a.jsx("span",{className:"text-[8px] text-muted-foreground/30 font-mono",children:e})}),a.jsxs("div",{ref:o,className:At("relative p-2 min-h-[40px] gap-1.5 transition-all duration-150",n?"bg-primary/15 ring-2 ring-inset ring-primary/50":(E||A)&&"bg-muted/30"),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[a.jsx(Al,{showGuides:!!E||!!A,positionDrag:E?p:null}),b.length===0&&a.jsx("p",{className:"text-[10px] text-muted-foreground/60 text-center py-2 italic",style:{gridColumn:"span 12"},children:"Arraste campos aqui"}),a.jsx(Pt.SortableContext,{items:j,strategy:Pt.rectSortingStrategy,children:b.filter(ee=>Ve(ee)==="field").map(ee=>i(ee).fieldType==="field_array"?a.jsx(QN,{id:ee,container:e},ee):a.jsx(_a,{id:ee,container:e},ee))})]}),a.jsx("div",{onMouseDown:se,className:"cursor-col-resize absolute right-0 top-0 bottom-0 w-2 hover:bg-blue-500/20 transition-colors flex items-center justify-center",children:a.jsx(O.GripHorizontal,{className:"h-3 w-3 text-blue-500/40 rotate-90"})})]}),$&&p&&vs.createPortal(a.jsxs("div",{style:{position:"fixed",left:p.cursorX+14,top:p.cursorY-18,zIndex:9999,pointerEvents:"none"},className:"flex items-center gap-1 bg-foreground text-background text-[10px] font-mono px-2 py-0.5 rounded shadow-xl border border-border/20",children:[a.jsx(O.BoxSelect,{className:"h-2.5 w-2.5"}),"col ",p.ghostStart,"–",p.ghostStart+p.ghostSpan-1]}),document.body)," "]})},jf=({id:e,container:t,index:r})=>{var o;const{attributes:n,listeners:s,setNodeRef:l,transform:i,transition:c,isDragging:d}=Pt.useSortable({id:e,data:{isCanvasItem:!0,type:"step",id:e}}),{setNodeRef:m,isOver:u}=Rt.useDroppable({id:`zone-${e}`}),{selectedId:h,setSelected:p,getConfig:y,removeItem:f,containers:g,positionDrag:w}=mt(),v=y(e),b=((o=g[e])==null?void 0:o.children)??[],j=h===e,N=w&&b.includes(w.itemId),[S,$]=k.useState(!1),C="var(--t-primary, hsl(var(--primary)))",E=j?C:S?`color-mix(in srgb, ${C} 60%, transparent)`:`color-mix(in srgb, ${C} 25%, transparent)`,A=j?`color-mix(in srgb, ${C} 14%, transparent)`:S?`color-mix(in srgb, ${C} 10%, transparent)`:`color-mix(in srgb, ${C} 6%, transparent)`,I=j?`color-mix(in srgb, ${C} 28%, transparent)`:`color-mix(in srgb, ${C} 15%, transparent)`,M=j?`0 0 0 3px color-mix(in srgb, ${C} 20%, transparent)`:void 0,T={transform:va.CSS.Transform.toString(i),transition:c,opacity:d?0:1};return a.jsxs("div",{ref:l,style:{...T,borderWidth:"2px",borderStyle:"solid",borderColor:E,boxShadow:M},onMouseEnter:()=>$(!0),onMouseLeave:()=>$(!1),onClick:B=>{B.stopPropagation(),p(e)},className:"group/step rounded-xl overflow-hidden transition-all",children:[a.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2",style:{backgroundColor:A,borderColor:I},children:[a.jsx("div",{...s,...n,className:"cursor-grab shrink-0",onClick:B=>B.stopPropagation(),children:a.jsx(O.GripVertical,{className:"h-3.5 w-3.5 text-primary"})}),a.jsx(O.Layers,{className:"h-4 w-4 text-primary shrink-0"}),a.jsxs("span",{className:"text-sm font-bold truncate flex-1 text-primary",children:["Step ",r+1," — ",v.label]}),v.description&&a.jsx("span",{className:"text-[10px] text-muted-foreground truncate hidden md:block",children:v.description}),a.jsx("button",{onClick:B=>{B.stopPropagation(),f(e)},className:"transition-opacity shrink-0 p-1 rounded hover:bg-destructive/10",style:{opacity:S?1:0},children:a.jsx(O.Trash2,{className:"h-3.5 w-3.5 text-destructive"})})]}),a.jsxs("div",{ref:m,className:At("relative p-3 min-h-[80px] gap-2 items-start transition-all duration-150",u?"bg-blue-500/20 ring-2 ring-inset ring-blue-400/70 shadow-[inset_0_0_0_2px_theme(colors.blue.400/50%)]":""),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content",backgroundImage:"radial-gradient(circle, hsl(var(--muted-foreground) / 0.15) 1px, transparent 1px)",backgroundSize:"16px 16px"},children:[a.jsx(Al,{showGuides:!!N,positionDrag:N?w:null}),b.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground/50 text-center py-6 italic w-full",style:{gridColumn:"span 12"},children:"Arraste containers aqui"}),b.map(B=>Ve(B)==="container"?a.jsx(_l,{id:B,container:e},B):a.jsx(_a,{id:B,container:e},B))]})]})},t1=()=>{var e;const{containers:t,setSelected:r}=mt(),o=((e=t.root)==null?void 0:e.children)??[],n=o.filter(i=>Ve(i)==="step"),{setNodeRef:s,isOver:l}=Rt.useDroppable({id:"root"});return a.jsxs("div",{ref:s,onClick:()=>r(null),className:`min-h-[500px] rounded-xl border p-4 space-y-4 transition-all duration-150 ${l?"bg-primary/10 border-primary/60 ring-2 ring-primary/30 shadow-[0_0_0_4px_theme(colors.primary/10%)]":"border-border/40"}`,style:{backgroundImage:"radial-gradient(circle, hsl(var(--muted-foreground) / 0.12) 1px, transparent 1px)",backgroundSize:"20px 20px",backgroundColor:l?void 0:"hsl(var(--muted) / 0.3)"},children:[o.length===0&&a.jsx("div",{className:"flex items-center justify-center h-[400px]",children:a.jsxs("div",{className:"text-center space-y-2",children:[a.jsx(O.Layers,{className:"h-10 w-10 text-muted-foreground/30 mx-auto"}),a.jsxs("p",{className:"text-sm text-muted-foreground/50",children:["Arraste ",a.jsx("strong",{children:"Steps"})," da paleta para cá"]})]})}),a.jsx(Pt.SortableContext,{items:n,strategy:Pt.verticalListSortingStrategy,children:o.map((i,c)=>{const d=Ve(i);return d==="step"?a.jsx(jf,{id:i,container:"root",index:c},i):d==="container"?a.jsx(_l,{id:i,container:"root"},i):a.jsx(_a,{id:i,container:"root"},i)})})]})},r1={personal:"Pessoal",address:"Endereço",health:"Saúde",event:"Evento",payment:"Pagamento",emergency:"Emergência"},a1={texto:"Texto",selecao:"Seleção",range:"Numérico / Visual",data:"Data e Hora",contato:"Contato / Endereço",outros:"Arquivo / Outros"},o1=()=>{const e=dr.reduce((t,r)=>{const o=r.group??"outros";return t[o]||(t[o]=[]),t[o].push(r),t},{});return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("h2",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Estrutura"}),pl.map(t=>a.jsx(lc,{component:t.component,label:t.label,icon:t.icon,color:t.color},t.component))]}),Object.entries(e).map(([t,r])=>a.jsx(zn,{label:a1[t]??t,children:r.map(o=>a.jsx(lc,{component:o.component,label:o.label,icon:o.icon,color:"border-border"},o.component))},t)),a.jsx(zn,{label:"Blocos pré-configurados",defaultOpen:!1,children:wo.map(t=>a.jsx(n1,{block:t},t.id))}),a.jsx(zn,{label:"Blocos de steps",defaultOpen:!1,children:js.map(t=>a.jsx(s1,{block:t},t.id))})]})},zn=({label:e,children:t,defaultOpen:r=!0})=>{const[o,n]=k.useState(r);return a.jsxs("div",{className:"space-y-2",children:[a.jsxs("button",{type:"button",onClick:()=>n(s=>!s),className:"flex w-full items-center justify-between text-xs font-semibold text-muted-foreground uppercase tracking-wide hover:text-foreground transition-colors",children:[e,a.jsx(O.ChevronDown,{className:`h-3.5 w-3.5 transition-transform ${o?"":"-rotate-90"}`})]}),o&&a.jsx("div",{className:"space-y-1.5",children:t})]})},lc=({component:e,label:t,icon:r,color:o})=>{const{attributes:n,listeners:s,setNodeRef:l,transform:i,isDragging:c}=Rt.useDraggable({id:`palette-${e}`,data:{isPaletteItem:!0,componentType:e}});return a.jsxs("div",{ref:l,...s,...n,className:`cursor-grab flex items-center gap-2 rounded-lg border px-3 py-2 select-none hover:bg-accent transition-colors ${o} ${c?"opacity-50":""}`,style:{transform:c?void 0:va.CSS.Translate.toString(i)},children:[a.jsx(O.GripVertical,{className:"h-4 w-4 text-muted-foreground"}),a.jsx(r,{className:"h-4 w-4"}),a.jsx("span",{className:"text-sm font-medium",children:t})]})},n1=({block:e})=>{const{attributes:t,listeners:r,setNodeRef:o,transform:n,isDragging:s}=Rt.useDraggable({id:`preset-${e.id}`,data:{isPalettePreset:!0,presetId:e.id}}),l=e.icon?wt[e.icon]:void 0,i=r1[e.category]??e.category;return a.jsxs("div",{ref:o,...r,...t,className:`cursor-grab flex items-center gap-2 rounded-lg border border-primary/30 bg-primary/5 px-3 py-2 select-none hover:bg-primary/10 transition-colors ${s?"opacity-50":""}`,style:{transform:s?void 0:va.CSS.Translate.toString(n)},title:e.description,children:[a.jsx(O.GripVertical,{className:"h-4 w-4 text-muted-foreground shrink-0"}),l?a.jsx(l,{className:"h-4 w-4 text-primary shrink-0"}):a.jsx(wt.Blocks,{className:"h-4 w-4 text-primary shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-sm font-medium block truncate",children:e.name}),a.jsx("span",{className:"text-[10px] text-muted-foreground",children:i})]})]})},s1=({block:e})=>{const{addPresetStepBlock:t}=mt(),r=e.icon?wt[e.icon]:void 0;return a.jsxs("button",{type:"button",onClick:()=>t(e),className:"w-full flex items-center gap-2 rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 cursor-pointer select-none hover:bg-amber-500/15 transition-colors text-left",title:e.description,children:[r?a.jsx(r,{className:"h-4 w-4 text-amber-400 shrink-0"}):a.jsx(wt.Layers,{className:"h-4 w-4 text-amber-400 shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("span",{className:"text-sm font-medium block truncate",children:e.name}),a.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[e.steps.length," steps"]})]}),a.jsxs("span",{className:"text-[10px] text-amber-400 border border-amber-500/30 rounded px-1.5 py-0.5 shrink-0",children:["+",e.steps.length," steps"]})]})},l1=[...pl,...dr],Nf=({data:e})=>{const{getConfig:t}=mt();if(!e)return null;const r=e;if(r.isPalettePreset){const o=ws(r.presetId);return a.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary text-primary-foreground px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none",children:[a.jsx(wt.Blocks,{className:"h-3.5 w-3.5 shrink-0"}),(o==null?void 0:o.name)??"Bloco"]})}if(r.isPaletteItem){const o=l1.find(s=>s.component===r.componentType),n=o==null?void 0:o.icon;return a.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-primary text-primary-foreground px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none",children:[n&&a.jsx(n,{className:"h-3.5 w-3.5 shrink-0"}),(o==null?void 0:o.label)??r.componentType]})}if(r.isCanvasItem){const{type:o,id:n}=r,s=t(n),l={step:"border-primary/80 bg-primary text-primary-foreground",container:"border-blue-600 bg-blue-600 text-white",field:"border-primary/80 bg-primary text-primary-foreground"},i={step:"Step",container:"Container",field:"Campo"};return a.jsxs("div",{className:At("flex items-center gap-2 rounded-full px-3 py-1.5 shadow-2xl text-xs font-semibold cursor-grabbing pointer-events-none min-w-[100px] max-w-[200px]",l[o]??"border-border bg-card"),children:[a.jsx(O.GripVertical,{className:"h-3 w-3 opacity-60 shrink-0"}),a.jsxs("span",{className:"opacity-70 shrink-0",children:[i[o]??o,":"]}),a.jsx("span",{className:"truncate",children:s.label||n})]})}return null},i1=({schema:e,children:t,uploadTermsPdf:r,deleteTermsPdf:o})=>{var n;const s=k.useMemo(()=>{var l;return(l=e==null?void 0:e.steps)!=null&&l.length?Kp(e):null},[e]);return a.jsx(g0,{children:a.jsx(Sp,{initialConfigs:s==null?void 0:s.configs,initialContainers:(n=s==null?void 0:s.dndState)==null?void 0:n.containers,initialTemplateId:(s==null?void 0:s.templateId)??void 0,initialStepConfig:s==null?void 0:s.stepConfig,schemaId:(e==null?void 0:e.id)??void 0,uploadTermsPdf:r,deleteTermsPdf:o,children:t})})},c1=({children:e,onError:t})=>{const{containers:r,addItem:o,addPresetBlock:n,moveCanvasItem:s,reorderInContainer:l}=mt(),i=Rt.useSensors(Rt.useSensor(Rt.PointerSensor,{activationConstraint:{distance:5}})),[c,d]=k.useState(null);return a.jsxs(Rt.DndContext,{sensors:i,onDragStart:m=>{d({data:m.active.data.current})},onDragEnd:m=>{var u,h,p,y,f;d(null);const{active:g,over:w}=m;if(!w)return;const v=g.data.current,b=String(w.id);if(v!=null&&v.isPalettePreset){const{presetId:j}=v,N=ws(j);if(!N)return;if(b.startsWith("zone-")){const S=b.slice(5);n(N,S)}else b==="root"&&(t==null||t("Arraste o bloco sobre um step existente."));return}if(v!=null&&v.isPaletteItem){const{componentType:j}=v;b==="root"?o(j,"root"):b.startsWith("zone-")&&o(j,b.slice(5));return}if(v!=null&&v.isCanvasItem){const{type:j,id:N}=v;if(j==="step"){const S=((u=r.root)==null?void 0:u.children)??[],$=S.indexOf(N),C=S.indexOf(b);$!==-1&&C!==-1&&$!==C&&l("root",Pt.arrayMove(S,$,C));return}if(j==="field"){const S=v.fromContainer;let $=S,C=null;if(b.startsWith("zone-"))$=b.slice(5);else{const E=hl(b,r);E&&($=E,C=b)}if($===S&&C){const E=((h=r[S])==null?void 0:h.children)??[],A=E.indexOf(N),I=E.indexOf(C);A!==-1&&I!==-1&&A!==I&&l(S,Pt.arrayMove(E,A,I))}else if($!==S){const E=C?(((p=r[$])==null?void 0:p.children)??[]).indexOf(C):-1;s(N,S,$,E>=0?E:((f=(y=r[$])==null?void 0:y.children)==null?void 0:f.length)??0)}}}},children:[e,a.jsx(Rt.DragOverlay,{dropAnimation:null,children:c?a.jsx(Nf,{data:c.data}):null})]})};exports.BuilderDndContext=c1;exports.BuilderProvider=Sp;exports.BuilderWrapper=i1;exports.Canvas=t1;exports.ConfigPanel=Ej;exports.ContainerRenderer=vp;exports.DFCepField=ml;exports.DFCheckbox=en;exports.DFCheckboxGroup=cl;exports.DFDateField=Qr;exports.DFFieldArray=cp;exports.DFFileUpload=ul;exports.DFHidden=tn;exports.DFMaskedInput=cr;exports.DFParticipationType=dp;exports.DFPaymentMethod=pp;exports.DFRadioGroup=dl;exports.DFSelect=Qo;exports.DFTerms=fp;exports.DFTextField=gt;exports.DFTextarea=Jo;exports.DefaultStepIndicator=jp;exports.DragGhost=Nf;exports.DroppedContainer=_l;exports.DroppedField=_a;exports.DroppedStep=jf;exports.EVENT_VARIABLES=fl;exports.FIELD_TYPES=dr;exports.FIELD_TYPE_ICONS=Of;exports.FIELD_TYPE_LABELS=Pf;exports.FieldType=_;exports.FormRenderer=fw;exports.FormSchemaStatus=ys;exports.FormSpy=hw;exports.GridOverlay=Al;exports.LivePreview=ZN;exports.MaskType=ic;exports.OPCOES_POR_DIA=up;exports.OPCOES_TODOS_OS_DIAS=mp;exports.PRESET_BLOCKS=wo;exports.PRESET_STEP_BLOCKS=js;exports.Palette=o1;exports.RendererContext=co;exports.STRUCTURE_TYPES=pl;exports.StepRenderer=bp;exports.TEMPLATE_REGISTRY=Cr;exports.TemplateProvider=pa;exports.builderToFormSchema=Gp;exports.evaluateFieldCondition=Ke;exports.findParentContainer=hl;exports.formSchemaToBuilder=Kp;exports.generateId=cc;exports.getAllTemplates=Zf;exports.getFieldMeta=xw;exports.getFieldMetaById=Np;exports.getItemType=Ve;exports.getPresetById=ws;exports.getPresetStepBlockById=rh;exports.getPresetsByCategory=th;exports.getTemplateConfig=yo;exports.interpolate=st;exports.interpolateContainer=Zo;exports.interpolateField=op;exports.interpolateStep=np;exports.isDarkTemplate=dc;exports.isGlassmorphism=Jf;exports.makeStepResolver=rp;exports.makeStepWarnComputer=ap;exports.useBuilder=mt;exports.useField=iw;exports.useFieldApi=cw;exports.useFormApi=lw;exports.useFormState=yp;exports.useRendererContext=tr;exports.useTemplate=ba;exports.v4Fallback=pt;exports.validateBuilderIntegrity=Aj;