@schema-forms-data/react 4.0.0 → 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.
- package/README.md +1 -1
- package/dist/index.cjs +15 -15
- package/dist/index.js +1359 -1352
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react"),a=require("react/jsx-runtime"),Ce=require("react-hook-form"),O=require("lucide-react"),vs=require("react-dom"),Pt=require("@dnd-kit/sortable"),va=require("@dnd-kit/utilities"),Dt=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 Rf={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"},Pf={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))"},Of={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"},If={...ut,primary:"#18181b",primaryHover:"#27272a",accent:"#71717a",border:"#e4e4e7"},Ff={...ut,primary:"#1e3a5f",primaryHover:"#162d4a",accent:"#c9a84c"},Lf={...ut,primary:"#ec4899",primaryHover:"#db2777",accent:"#8b5cf6",background:"#0f0f1a",text:"#ffffff",textMuted:"#a78bfa"},Mf={...ut,primary:"#059669",primaryHover:"#047857",accent:"#6ee7b7"},Vf={...ut,primary:"#0ea5e9",primaryHover:"#0284c7",accent:"#38bdf8"},zf={...ut,primary:"#6366f1",primaryHover:"#4f46e5",accent:"#818cf8"},Bf={...ut,primary:"#d97706",primaryHover:"#b45309",accent:"#fbbf24"},Uf={...ut,primary:"#10b981",primaryHover:"#059669",accent:"#34d399"},Hf={...ut,primary:"#b45309",primaryHover:"#92400e",accent:"#f59e0b",background:"#0c0c0c",text:"#fafafa",textMuted:"#d4af37"},Wf={...ut,primary:"#dc2626",primaryHover:"#b91c1c",accent:"#f97316"},qf={...ut,primary:"#7c3aed",primaryHover:"#6d28d9",accent:"#a78bfa"},Xf={primary:"#374151",primaryHover:"#1f2937",accent:"#6b7280",background:"#ffffff",surface:"#f9fafb",text:"#111827",textMuted:"#6b7280",border:"#e5e7eb",error:"#ef4444"},Gf={primary:"#16a34a",primaryHover:"#15803d",accent:"#4ade80",background:"#fefce8",surface:"#ffffff",text:"#1c1917",textMuted:"#78716c",border:"#d6d3d1",error:"#dc2626"},Kf={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:If,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:Of,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:Ff,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:Lf,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-[#0f0f1a]"},webinar:{id:"webinar",displayName:"Webinar",colors:Vf,layout:{stepNavigation:"tabs",containerStyle:"card",spacing:"compact",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},retiro:{id:"retiro",displayName:"Retiro",colors:Mf,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:zf,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},social:{id:"social",displayName:"Social",colors:Uf,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},workshop:{id:"workshop",displayName:"Workshop",colors:Bf,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:Hf,layout:{stepNavigation:"wizard",containerStyle:"glassmorphism",spacing:"relaxed",roundness:"rounded-2xl",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-[#0c0c0c]"},acao:{id:"acao",displayName:"Ação",colors:Wf,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"compact",roundness:"rounded-lg",showProgressBar:!0,showStepIndicators:!0},wrapperClass:"bg-background"},podcast:{id:"podcast",displayName:"Podcast",colors:qf,layout:{stepNavigation:"wizard",containerStyle:"card",spacing:"normal",roundness:"rounded-xl",showProgressBar:!1,showStepIndicators:!0},wrapperClass:"bg-background"},classico:{id:"classico",displayName:"Clássico",colors:Xf,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:Gf,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:Kf,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,Yf=()=>Object.values(Cr),Zf=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={};/**
|
|
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 Ll;function
|
|
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,21 +14,21 @@
|
|
|
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 Ml;function
|
|
18
|
-
`+G+
|
|
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
19
|
`),at=we.stack.split(`
|
|
20
|
-
`),Le
|
|
21
|
-
|
|
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 \``+
|
|
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 <`+ce+">.")}return re}}function Pl(
|
|
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} />`,mn,br,Tf,br),Il[br+mn]=!0}}return D===o?Sf(He):kf(He),He}}function Ef(D,re,ce){return Fl(D,re,ce,!0)}function $f(D,re,ce){return Fl(D,re,ce,!1)}var Af=$f,_f=Ef;Da.Fragment=o,Da.jsx=Af,Da.jsxs=_f}()),Da}process.env.NODE_ENV==="production"?Bn.exports=Jf():Bn.exports=Qf();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}]}}],eh=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"}]}]}]}],th=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 rh=(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},ah=(e,t)=>({classGroupId:e,validator:t}),pc=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Ja="-",Vl=[],oh="arbitrary..",nh=e=>{const t=lh(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:n=>{if(n.startsWith("[")&&n.endsWith("]"))return sh(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?rh(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}},sh=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?oh+o:void 0})(),lh=e=>{const{theme:t,classGroups:r}=e;return ih(r,t)},ih=(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];ch(l,t,r,o)}},ch=(e,t,r,o)=>{if(typeof e=="string"){dh(e,t,r);return}if(typeof e=="function"){uh(e,t,r,o);return}mh(e,t,r,o)},dh=(e,t,r)=>{const o=e===""?t:hc(t,e);o.classGroupId=r},uh=(e,t,r,o)=>{if(ph(e)){Ns(e(o),t,r,o);return}t.validators===null&&(t.validators=[]),t.validators.push(ah(r,e))},mh=(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},ph=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,fh=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=":",hh=[],Bl=(e,t,r,o,n)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:o,isExternal:n}),xh=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(hh,!1,l,void 0,!0)}if(r){const n=o;o=s=>r({className:s,parseClassName:n})}return o},gh=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}},vh=e=>({cache:fh(e.cacheSize),parseClassName:xh(e),sortModifiers:gh(e),...nh(e)}),bh=/\s+/,yh=(e,t)=>{const{parseClassName:r,getClassGroupId:o,getConflictingClassGroupIds:n,sortModifiers:s}=t,l=[],i=e.trim().split(bh);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 E=N[S];l.push(b+E)}c=m+(c.length>0?" "+c:c)}return c},wh=(...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},jh=(e,...t)=>{let r,o,n,s;const l=c=>{const d=t.reduce((m,u)=>u(m),e());return r=vh(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=yh(c,r);return n(c,m),m};return s=l,(...c)=>s(wh(...c))},Nh=[],Xe=e=>{const t=r=>r[e]||Nh;return t.isThemeGetter=!0,t},gc=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,vc=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ch=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,kh=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Sh=/\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)\(.+\)$/,$h=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ah=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,rr=e=>Ch.test(e),ke=e=>!!e&&!Number.isNaN(Number(e)),ar=e=>!!e&&Number.isInteger(Number(e)),fn=e=>e.endsWith("%")&&ke(e.slice(0,-1)),Xt=e=>kh.test(e),bc=()=>!0,_h=e=>Sh.test(e)&&!Eh.test(e),Cs=()=>!1,Th=e=>$h.test(e),Dh=e=>Ah.test(e),Rh=e=>!me(e)&&!fe(e),Ph=e=>pr(e,jc,Cs),me=e=>gc.test(e),yr=e=>pr(e,Nc,_h),Ul=e=>pr(e,Bh,ke),Oh=e=>pr(e,kc,bc),Ih=e=>pr(e,Cc,Cs),Hl=e=>pr(e,yc,Cs),Fh=e=>pr(e,wc,Dh),Ra=e=>pr(e,Sc,Th),fe=e=>vc.test(e),ca=e=>_r(e,Nc),Lh=e=>_r(e,Cc),Wl=e=>_r(e,yc),Mh=e=>_r(e,jc),Vh=e=>_r(e,wc),Pa=e=>_r(e,Sc,!0),zh=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",Bh=e=>e==="number",Cc=e=>e==="family-name",kc=e=>e==="number"||e==="weight",Sc=e=>e==="shadow",Uh=()=>{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"],E=()=>["auto","contain","none"],C=()=>[fe,me,c],$=()=>[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",Mh,Ph,{size:[fe,me]}],ee=()=>[fn,ca,yr],H=()=>["","none","full",d,fe,me],K=()=>["",ke,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=()=>[ke,fn,Wl,Hl],te=()=>["","none",y,fe,me],ue=()=>["none",ke,fe,me],ve=()=>["none",ke,fe,me],Ne=()=>[ke,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:[Rh],"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",ke],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:[ke,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:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:$()}],"inset-x":[{"inset-x":$()}],"inset-y":[{"inset-y":$()}],start:[{"inset-s":$(),start:$()}],end:[{"inset-e":$(),end:$()}],"inset-bs":[{"inset-bs":$()}],"inset-be":[{"inset-be":$()}],top:[{top:$()}],right:[{right:$()}],bottom:[{bottom:$()}],left:[{left:$()}],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:[ke,rr,"auto","initial","none",me]}],grow:[{grow:["",ke,fe,me]}],shrink:[{shrink:["",ke,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,zh,Oh]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",fn,me]}],"font-family":[{font:[Lh,Ih,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":[ke,"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:[ke,"from-font","auto",fe,yr]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[ke,"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]},Vh,Fh]}],"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,fe,me]}],"outline-w":[{outline:["",ke,ca,yr]}],"outline-color":[{outline:P()}],shadow:[{shadow:["","none",m,Pa,Ra]}],"shadow-color":[{shadow:P()}],"inset-shadow":[{"inset-shadow":["none",u,Pa,Ra]}],"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,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,Ra]}],"text-shadow-color":[{"text-shadow":P()}],opacity:[{opacity:[ke,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":[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":[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":[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",fe,me]}],filter:[{filter:["","none",fe,me]}],blur:[{blur:te()}],brightness:[{brightness:[ke,fe,me]}],contrast:[{contrast:[ke,fe,me]}],"drop-shadow":[{"drop-shadow":["","none",p,Pa,Ra]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",ke,fe,me]}],"hue-rotate":[{"hue-rotate":[ke,fe,me]}],invert:[{invert:["",ke,fe,me]}],saturate:[{saturate:[ke,fe,me]}],sepia:[{sepia:["",ke,fe,me]}],"backdrop-filter":[{"backdrop-filter":["","none",fe,me]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[ke,fe,me]}],"backdrop-contrast":[{"backdrop-contrast":[ke,fe,me]}],"backdrop-grayscale":[{"backdrop-grayscale":["",ke,fe,me]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[ke,fe,me]}],"backdrop-invert":[{"backdrop-invert":["",ke,fe,me]}],"backdrop-opacity":[{"backdrop-opacity":[ke,fe,me]}],"backdrop-saturate":[{"backdrop-saturate":[ke,fe,me]}],"backdrop-sepia":[{"backdrop-sepia":["",ke,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:[ke,"initial",fe,me]}],ease:[{ease:["linear","initial",w,fe,me]}],delay:[{delay:[ke,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:[ke,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"]}},Hh=jh(Uh);function J(...e){return Hh(mc(e))}function Wh(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 qh=Symbol.for("react.lazy"),Qa=x[" use ".trim().toString()];function Xh(e){return typeof e=="object"&&e!==null&&"then"in e}function Ec(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===qh&&"_payload"in e&&Xh(e._payload)}function $c(e){const t=Kh(e),r=x.forwardRef((o,n)=>{let{children:s,...l}=o;Ec(s)&&typeof Qa=="function"&&(s=Qa(s._payload));const i=x.Children.toArray(s),c=i.find(Zh);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 Gh=$c("Slot");function Kh(e){const t=x.forwardRef((r,o)=>{let{children:n,...s}=r;if(Ec(n)&&typeof Qa=="function"&&(n=Qa(n._payload)),x.isValidElement(n)){const l=Qh(n),i=Jh(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 Yh=Symbol("radix.slottable");function Zh(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Yh}function Jh(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 Qh(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)},ex=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"}}),Ee=x.forwardRef(({className:e,variant:t,size:r,asChild:o=!1,...n},s)=>a.jsx(o?Gh:"button",{className:J(ex({variant:t,size:r,className:e})),ref:s,...n}));Ee.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 tx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],No=tx.reduce((e,t)=>{const r=$c(`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}},{}),rx="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=rx;var _c=Ac;const ax=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(ax(),e),...t}));le.displayName=_c.displayName;const ox=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 Es({className:e,variant:t,...r}){return a.jsx("div",{className:J(ox({variant:t}),e),...r})}var nx="Separator",Kl="horizontal",sx=["horizontal","vertical"],Tc=x.forwardRef((e,t)=>{const{decorative:r,orientation:o=Kl,...n}=e,s=lx(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=nx;function lx(e){return sx.includes(e)}var Dc=Tc;const Qe=x.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...o},n)=>a.jsx(Dc,{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=Dc.displayName;function ix(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,cx(n,...t)]}function cx(...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:()=>{},dx=x[" useInsertionEffect ".trim().toString()]||et;function Ut({prop:e,defaultProp:t,onChange:r=()=>{},caller:o}){const[n,s,l]=ux({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=mx(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 ux({defaultProp:e,onChange:t}){const[r,o]=x.useState(e),n=x.useRef(r),s=x.useRef(t);return dx(()=>{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 mx(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 px(e,t){return x.useReducer((r,o)=>t[r][o]??r,e)}var Nt=e=>{const{present:t,children:r}=e,o=fx(t),n=typeof r=="function"?r({present:o.isPresent}):x.Children.only(r),s=je(o.ref,hx(n));return typeof r=="function"||o.isPresent?x.cloneElement(n,{ref:s}):null};Nt.displayName="Presence";function fx(e){const[t,r]=x.useState(),o=x.useRef(null),n=x.useRef(e),s=x.useRef("none"),l=e?"mounted":"unmounted",[i,c]=px(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 hx(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=xx(e),r=x.forwardRef((o,n)=>{const{children:s,...l}=o,i=x.Children.toArray(s),c=i.find(vx);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 xx(e){const t=x.forwardRef((r,o)=>{const{children:n,...s}=r;if(x.isValidElement(n)){const l=yx(n),i=bx(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 Rc=Symbol("radix.slottable");function gx(e){const t=({children:r})=>a.jsx(a.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=Rc,t}function vx(e){return x.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Rc}function bx(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 yx(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 wx=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],be=wx.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 jx(e,t){e&&bo.flushSync(()=>e.dispatchEvent(t))}var Co="Checkbox",[Nx]=jt(Co),[Cx,$s]=Nx(Co);function kx(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(Cx,{scope:t,...j,children:Sx(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}=$s(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(kx,{__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=$s(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}=$s(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 Sx(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()]||(()=>{}),$x=0;function Zt(e){const[t,r]=x.useState(Ex());return et(()=>{r(o=>o??String($x++))},[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 Ax=x.createContext(void 0);function ja(e){const t=x.useContext(Ax);return e||t||"ltr"}var hn="rovingFocusGroup.onEntryFocus",_x={bubbles:!1,cancelable:!0},Na="RovingFocusGroup",[Wn,zc,Tx]=_s(Na),[Dx,Bc]=jt(Na,[Tx]),[Rx,Px]=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(Ox,{...e,ref:t})})}));Uc.displayName=Na;var Ox=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,E]=x.useState(0);return x.useEffect(()=>{const C=h.current;if(C)return C.addEventListener(hn,b),()=>C.removeEventListener(hn,b)},[b]),a.jsx(Rx,{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(()=>E(C=>C+1),[]),onFocusableItemRemove:x.useCallback(()=>E(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 $=!N.current;if(C.target===C.currentTarget&&$&&!w){const A=new CustomEvent(hn,_x);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=Px(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=Lx(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?Mx(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 Ix={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Fx(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Lx(e,t,r){const o=Fx(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return Ix[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 Mx(e,t){return e.map((r,o)=>e[(t+o)%e.length])}var Vx=Uc,zx=Wc,Ts="Radio",[Bx,Xc]=jt(Ts),[Ux,Hx]=Bx(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(Ux,{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=Hx(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 Wx="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=Wx;function Jc(e){return e?"checked":"unchecked"}var qx=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],ko="RadioGroup",[Xx]=jt(ko,[Bc,Xc]),Qc=Bc(),ed=Xc(),[Gx,Kx]=Xx(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(Gx,{scope:r,name:o,required:l,disabled:i,value:f,onValueChange:g,children:a.jsx(Vx,{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=Kx(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=>{qx.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(zx,{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 Yx="RadioGroupIndicator",od=x.forwardRef((e,t)=>{const{__scopeRadioGroup:r,...o}=e,n=ed(r);return a.jsx(Yc,{...n,...o,ref:t})});od.displayName=Yx;var nd=td,sd=ad,Zx=od;const Ds=x.forwardRef(({className:e,...t},r)=>a.jsx(nd,{className:J("grid gap-2",e),...t,ref:r}));Ds.displayName=nd.displayName;const Rs=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(Zx,{className:"flex items-center justify-center",children:a.jsx(O.Circle,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Rs.displayName=sd.displayName;var So="Switch",[Jx]=jt(So),[Qx,eg]=Jx(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(Qx,{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=eg(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 tg="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=tg;function ud(e){return e?"checked":"unchecked"}var md=ld,rg=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(rg,{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 ag(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 og="DismissableLayer",qn="dismissableLayer.update",ng="dismissableLayer.pointerDownOutside",sg="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,E=>u(E)),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=cg(E=>{const C=E.target,$=[...d.branches].some(A=>A.contains(C));!j||$||(n==null||n(E),l==null||l(E),E.defaultPrevented||i==null||i())},h),S=dg(E=>{const C=E.target;[...d.branches].some($=>$.contains(C))||(s==null||s(E),l==null||l(E),E.defaultPrevented||i==null||i())},h);return ag(E=>{v===d.layers.size-1&&(o==null||o(E),!E.defaultPrevented&&i&&(E.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 E=()=>p({});return document.addEventListener(qn,E),()=>document.removeEventListener(qn,E)},[]),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=og;var lg="DismissableLayerBranch",ig=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})});ig.displayName=lg;function cg(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(ng,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 dg(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(sg,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?jx(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},ug="FocusScope",Eo=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||(mg(gg(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]=pg(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})});Eo.displayName=ug;function mg(e,{select:t=!1}={}){const r=document.activeElement;for(const o of e)if(lr(o,{select:t}),document.activeElement!==r)return}function pg(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(!fg(r,{upTo:t}))return r}function fg(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 hg(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&&hg(e)&&t&&e.select()}}var ti=xg();function xg(){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 gg(e){return e.filter(t=>t.tagName!=="A")}const vg=["top","right","bottom","left"],ur=Math.min,ht=Math.max,eo=Math.round,Ia=Math.floor,Bt=e=>({x:e,y:e}),bg={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 yg(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 wg(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"],jg=["top","bottom"],Ng=["bottom","top"];function Cg(e,t,r){switch(e){case"top":case"bottom":return r?t?oi:ai:t?ai:oi;case"left":case"right":return t?jg:Ng;default:return[]}}function kg(e,t,r,o){const n=ea(e);let s=Cg(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 bg[t]+e.slice(t.length)}function Sg(e){return{top:0,right:0,bottom:0,left:0,...e}}function xd(e){return typeof e!="number"?Sg(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 $g=50,Ag=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<$g&&(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}},_g=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 E=S?S[b]:0;(!E||!await(l.isElement==null?void 0:l.isElement(S)))&&(E=i.floating[b]||s.floating[y]);const C=j/2-N/2,$=E/2-f[y]/2-1,A=ur(u[w],$),I=ur(u[v],$),M=A,T=E-f[y]-I,B=E/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}}}),Tg=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)]:wg(i)),S=y!=="none";!h&&S&&N.push(...kg(i,f,y,j));const E=[i,...N],C=await c.detectOverflow(t,g),$=[];let A=((o=s.flip)==null?void 0:o.overflows)||[];if(m&&$.push(C[w]),u){const B=yg(n,l,j);$.push(C[B[0]],C[B[1]])}if(A=[...A,{placement:n,overflows:$}],!$.every(B=>B<=0)){var I,M;const B=(((I=s.flip)==null?void 0:I.index)||0)+1,q=E[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 vg.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 Rg(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 Pg=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 Rg(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}}}}},Og=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}}}}}},Ig=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}}}},Fg=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 E=j,C=N;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(C=b),(o=t.middlewareData.shift)!=null&&o.enabled.y&&(E=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)):E=f-2*(M!==0||T!==0?M+T:ht(m.top,m.bottom))}await c({...t,availableWidth:C,availableHeight:E});const $=await l.getDimensions(i.floating);return y!==$.width||f!==$.height?{reset:{rects:!0}}:{}}}};function $o(){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 $o()?e instanceof Node||e instanceof vt(e).Node:!1}function Ot(e){return $o()?e instanceof Element||e instanceof vt(e).Element:!1}function er(e){return $o()?e instanceof HTMLElement||e instanceof vt(e).HTMLElement:!1}function ii(e){return!$o()||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 Lg(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 Mg=/transform|translate|scale|rotate|perspective|filter/,Vg=/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))||Mg.test(t.willChange||"")||Vg.test(t.contain||"")}function zg(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 Bg=Bt(0);function wd(e){const t=vt(e);return!Vs()||!t.visualViewport?Bg:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ug(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=Ug(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 Hg(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 Wg(e){return Array.from(e.getClientRects())}function qg(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 Xg(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 Gg(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=Xg(e,r);else if(t==="document")o=qg(Ht(e));else if(Ot(t))o=Gg(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 Kg(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 Yg(e){let{element:t,boundary:r,rootBoundary:o,strategy:n}=e;const s=[...r==="clippingAncestors"?Ao(t)?[]:Kg(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 Zg(e){const{width:t,height:r}=yd(e);return{width:t,height:r}}function Jg(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&&Lg(o)&&yn(o);)o=ui(o,t);return o&&Kr(o)&&yn(o)&&!Ms(o)?r:o||zg(e)||r}const Qg=async function(e){const t=this.getOffsetParent||Cd,r=this.getDimensions,o=await r(e.floating);return{reference:Jg(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function ev(e){return It(e).direction==="rtl"}const tv={convertOffsetParentRelativeRectToViewportRelativeRect:Hg,getDocumentElement:Ht,getClippingRect:Yg,getOffsetParent:Cd,getElementRects:Qg,getClientRects:Wg,getDimensions:Zg,getScale:Wr,isElement:Ot,isRTL:ev};function kd(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function rv(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 av(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?rv(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 ov=Pg,nv=Og,sv=Tg,lv=Fg,iv=Dg,mi=_g,cv=Ig,dv=(e,t,r)=>{const o=new Map,n={platform:tv,...r},s={...n.platform,_c:o};return Ag(e,t,{...n,platform:s})};var uv=typeof document<"u",mv=function(){},Ka=uv?k.useLayoutEffect:mv;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 pv(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!==E.current&&(E.current=V,w(V))},[]),j=s||y,N=l||g,S=x.useRef(null),E=x.useRef(null),C=x.useRef(m),$=c!=null,A=wn(c),I=wn(n),M=wn(d),T=x.useCallback(()=>{if(!S.current||!E.current)return;const V={placement:t,strategy:r,middleware:h};I.current&&(V.platform=I.current),dv(S.current,E.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&&(E.current=N),j&&N){if(A.current)return A.current(j,N,T);T()}},[j,N,T,A,$]);const q=x.useMemo(()=>({reference:S,floating:E,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 fv=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):{}}}},hv=(e,t)=>{const r=ov(e);return{name:r.name,fn:r.fn,options:[e,t]}},xv=(e,t)=>{const r=nv(e);return{name:r.name,fn:r.fn,options:[e,t]}},gv=(e,t)=>({fn:cv(e).fn,options:[e,t]}),vv=(e,t)=>{const r=sv(e);return{name:r.name,fn:r.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=fv(e);return{name:r.name,fn:r.fn,options:[e,t]}};var jv="Arrow",Ed=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"})})});Ed.displayName=jv;var Nv=Ed,Bs="Popper",[$d,ra]=jt(Bs),[Cv,Ad]=$d(Bs),_d=e=>{const{__scopePopper:t,children:r}=e,[o,n]=x.useState(null);return a.jsx(Cv,{scope:t,anchor:o,onAnchorChange:n,children:r})};_d.displayName=Bs;var Td="PopperAnchor",Dd=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})});Dd.displayName=Td;var Us="PopperContent",[kv,Sv]=$d(Us),Rd=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),[E,C]=x.useState(null),$=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($v),altBoundary:V},{refs:P,floatingStyles:se,placement:U,isPositioned:Q,middlewareData:ee}=pv({strategy:"fixed",placement:q,whileElementsMounted:(...Ne)=>av(...Ne,{animationFrame:b==="always"}),elements:{reference:S.anchor},middleware:[hv({mainAxis:m+B,alignmentAxis:h}),y&&xv({mainAxis:!0,crossAxis:!1,limiter:w==="partial"?gv():void 0,...L}),y&&vv({...L}),bv({...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&&wv({element:A,padding:p}),Av({arrowWidth:T,arrowHeight:B}),v&&yv({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(()=>{E&&ve(window.getComputedStyle(E).zIndex)},[E]),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(kv,{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:$,style:{...N.style,animation:Q?void 0:"none"}})})})});Rd.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=Sv(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(Nv,{...o,ref:t,style:{...o.style,display:"block"}})})});Od.displayName=Pd;function $v(e){return e!==null}var Av=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,Do=Dd,Ws=Rd,qs=Od,_v="Portal",Ro=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});Ro.displayName=_v;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"}),Tv="VisuallyHidden",Ld=x.forwardRef((e,t)=>a.jsx(be.span,{...e,ref:t,style:{...Fd,...e.style}}));Ld.displayName=Tv;var Dv=Ld,Rv=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))},Pv=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})},Ov=function(e,t,r,o){var n=Pv(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=Rv(e);return n?(o.push.apply(o,Array.from(n.querySelectorAll("[aria-live], script"))),Ov(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 Iv(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",Fv="with-scroll-bars-hidden",Lv="--removed-body-scroll-bar-size";function Nn(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Mv(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 Vv=typeof window<"u"?x.useLayoutEffect:x.useEffect,fi=new WeakMap;function zv(e,t){var r=Mv(null,function(o){return e.forEach(function(n){return Nn(n,o)})});return Vv(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 Bv(e){return e}function Uv(e,t){t===void 0&&(t=Bv);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 Hv(e){e===void 0&&(e={});var t=Uv(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 Wv(e,t){return e.useMedium(t),zd}var Bd=Hv(),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=zv([r,t]),E=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({},E),{ref:S})):x.createElement(v,Vt({},E,{className:c,ref:S}),i))});Po.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Po.classNames={fullWidth:Za,zeroRight:Ya};var qv=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Xv(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=qv();return t&&e.setAttribute("nonce",t),e}function Gv(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Kv(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Yv=function(){var e=0,t=null;return{add:function(r){e==0&&(t=Xv())&&(Gv(t,r),Kv(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Zv=function(){var e=Yv();return function(t,r){x.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Ud=function(){var e=Zv(),t=function(r){var o=r.styles,n=r.dynamic;return e(o,n),null};return t},Jv={left:0,top:0,right:0,gap:0},kn=function(e){return parseInt(e||"",10)||0},Qv=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)]},eb=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Jv;var t=Qv(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])}},tb=Ud(),qr="data-scroll-locked",rb=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(
|
|
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
32
|
overflow: hidden `).concat(o,`;
|
|
33
33
|
padding-right: `).concat(i,"px ").concat(o,`;
|
|
34
34
|
}
|
|
@@ -62,18 +62,18 @@ React keys must be passed directly to JSX without using spread:
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
body[`).concat(qr,`] {
|
|
65
|
-
`).concat(
|
|
65
|
+
`).concat(Mv,": ").concat(i,`px;
|
|
66
66
|
}
|
|
67
|
-
`)},hi=function(){var e=parseInt(document.body.getAttribute(qr)||"0",10);return isFinite(e)?e:0},
|
|
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`
|
|
68
68
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
69
69
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
70
|
-
`)},fb=0,Fr=[];function hb(e){var t=x.useRef([]),r=x.useRef([0,0]),o=x.useRef(),n=x.useState(fb++)[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=Iv([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,E=Math.abs(b)>Math.abs(j)?"h":"v";if("touches"in f&&E==="h"&&S.type==="range")return!1;var C=window.getSelection(),$=C&&C.anchorNode,A=$?$===S||$.contains(S):!1;if(A)return!1;var I=xi(E,S);if(!I)return!0;if(I?N=E:(N=E==="v"?"h":"v",I=xi(E,S)),!I)return!1;if(!o.current&&"changedTouches"in f&&(b||j)&&(o.current=N),!N)return!0;var M=o.current||N;return ub(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)&&mb(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:xb(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:pb(n)}):null,p?x.createElement(ob,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function xb(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const gb=Wv(Bd,hb);var Oo=x.forwardRef(function(e,t){return x.createElement(Po,Vt({},e,{ref:t,sideCar:gb}))});Oo.classNames=Po.classNames;var vb=[" ","Enter","ArrowUp","ArrowDown"],bb=[" ","Enter"],Er="Select",[Io,Fo,yb]=_s(Er),[aa]=jt(Er,[yb,ra]),Lo=ra(),[wb,fr]=aa(Er),[jb,Nb]=aa(Er),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),[E,C]=Ut({prop:o,defaultProp:n??!1,onChange:s,caller:Er}),[$,A]=Ut({prop:l,defaultProp:i,onChange:c,caller:Er}),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(wb,{required:p,scope:t,trigger:g,onTriggerChange:w,valueNode:v,onValueNodeChange:b,valueNodeHasChildren:j,onValueNodeHasChildrenChange:N,contentId:Zt(),value:$,onValueChange:A,open:E,onOpenChange:C,dir:S,triggerPointerDownPosRef:I,disabled:h,children:[a.jsx(Io.Provider,{scope:t,children:a.jsx(jb,{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:$,onChange:W=>A(W.target.value),disabled:h,form:y,children:[$===void 0?a.jsx("option",{value:""}):null,Array.from(T)]},q):null]})})};Xd.displayName=Er;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(Do,{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===" ")&&vb.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 Cb="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=Cb;var kb="SelectPortal",Qd=e=>a.jsx(Ro,{asChild:!0,...e});Qd.displayName=kb;var $r="SelectContent",eu=x.forwardRef((e,t)=>{const r=fr($r,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=$r;var Tt=10,[tu,hr]=aa($r),Sb="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($r,r),[b,j]=x.useState(null),[N,S]=x.useState(null),E=je(t,G=>j(G)),[C,$]=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)&&($(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(Eo,{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:E,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=Sb;var $b="SelectItemAlignedPosition",au=x.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:o,...n}=e,s=fr($r,r),l=hr($r,r),[i,c]=x.useState(null),[d,m]=x.useState(null),u=je(t,E=>m(E)),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 E=s.trigger.getBoundingClientRect(),C=d.getBoundingClientRect(),$=s.valueNode.getBoundingClientRect(),A=w.getBoundingClientRect();if(s.dir!=="rtl"){const te=A.left-C.left,ue=$.left-te,ve=E.left-ue,Ne=E.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-$.right-te,ve=window.innerWidth-E.right-ue,Ne=E.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=E.top+E.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(E=>{E&&y.current===!0&&(b(),v==null||v(),y.current=!1)},[b,v]);return a.jsx(_b,{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=$b;var Ab="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=Ab;var[_b,Gs]=aa($r,{}),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",[Tb,Db]=aa(nu),Rb=x.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e,n=Zt();return a.jsx(Tb,{scope:r,id:n,children:a.jsx(be.div,{role:"group","aria-labelledby":n,...o,ref:t})})});Rb.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",[Pb,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(Pb,{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===" "||(bb.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=Nb(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()})})}),Ob="SelectSeparator",xu=x.forwardRef((e,t)=>{const{__scopeSelect:r,...o}=e;return a.jsx(be.div,{"aria-hidden":!0,...o,ref:t})});xu.displayName=Ob;var ts="SelectArrow",Ib=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});Ib.displayName=ts;var Fb="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=Fb;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=Lb(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 Lb(e,t){return e.map((r,o)=>e[(t+o)%e.length])}var Mb=Xd,wu=Kd,Vb=Zd,zb=Jd,Bb=Qd,ju=eu,Ub=ou,Nu=lu,Cu=cu,Hb=du,Wb=mu,ku=pu,Su=fu,Eu=xu;const Et=Mb,$t=Vb,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(zb,{asChild:!0,children:a.jsx(O.ChevronDown,{className:"h-4 w-4 opacity-50"})})]}));bt.displayName=wu.displayName;const $u=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"})}));$u.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(Bb,{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($u,{}),a.jsx(Ub,{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 qb=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}));qb.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(Wb,{children:a.jsx(O.Check,{className:"h-4 w-4"})})}),a.jsx(Hb,{children:t})]}));ze.displayName=Cu.displayName;const Xb=x.forwardRef(({className:e,...t},r)=>a.jsx(Eu,{ref:r,className:J("-mx-1 my-1 h-px bg-muted",e),...t}));Xb.displayName=Eu.displayName;var _u=["PageUp","PageDown"],Tu=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Du={"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,Gb,Kb]=_s(oa),[Ru]=jt(oa,[Kb]),[Yb,Mo]=Ru(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"?Zb:Jb,[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=ay(b,A);$(A,I)}function E(A){$(A,w.current)}function C(){const A=N.current[w.current];b[w.current]!==A&&h(b)}function $(A,I,{commit:M}={commit:!1}){const T=ly(s),B=iy(Math.round((A-o)/s)*s+o,T),q=fa(B,[o,n]);j((W=[])=>{const X=ty(W,q,I);if(sy(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(Yb,{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:E,onSlideEnd:i?void 0:C,onHomeKeyDown:()=>!i&&$(o,0,{commit:!0}),onEndKeyDown:()=>!i&&$(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;$(B+q,T,{commit:!0})}}})})})})});Pu.displayName=oa;var[Ou,Iu]=Ru(oa,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Zb=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=Du[w?"from-left":"from-right"].includes(b.key);d==null||d({event:b,direction:j?-1:1})}})})}),Jb=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=Du[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=Gb(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(Qb,{...e,ref:s,index:l})}),Qb=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=ry(o,l.values.length),g=h==null?void 0:h[i.size],w=g?oy(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 ey="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=ey;function ty(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 ry(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function ay(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 oy(e,t,r){const o=e/2,n=Ks([0,50],[0,o]);return(o-n(t)*r)*r}function ny(e){return e.slice(0,-1).map((t,r)=>e[r+1]-t)}function sy(e,t){if(t>0){const r=ny(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 ly(e){return(String(e).split(".")[1]||"").length}function iy(e,t){const r=Math.pow(10,t);return Math.round(e*r)/r}var Hu=Pu,cy=Mu,dy=Vu,uy=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(cy,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(dy,{className:"absolute h-full bg-primary"})}),a.jsx(uy,{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 my=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}));my.displayName="DateInput";function py(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,fy(n,...t)]}function fy(...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,[hy]=py(Ys),[xy,gy]=hy(Ys),Wu=x.forwardRef((e,t)=>{const{__scopeProgress:r,value:o=null,max:n,getValueLabel:s=vy,...l}=e;(n||n===0)&&!bi(n)&&console.error(by(`${n}`,"Progress"));const i=bi(n)?n:Zs;o!==null&&!yi(o,i)&&console.error(yy(`${o}`,"Progress"));const c=yi(o,i)?o:null,d=no(c)?s(c,i):void 0;return a.jsx(xy,{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=gy(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 vy(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 by(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 yy(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:
|
|
71
71
|
- a positive number
|
|
72
72
|
- less than the value passed to \`max\` (or ${Zs} if no \`max\` prop is set)
|
|
73
73
|
- \`null\` or \`undefined\` if the progress is indeterminate.
|
|
74
74
|
|
|
75
|
-
Defaulting to \`null\`.`}var Ku=Wu,
|
|
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
76
|
|
|
77
77
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
78
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},Ty="DialogDescriptionWarning",Dy=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${dm(Ty).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},Ry=Zu,Py=em,um=tm,mm=rm,pm=om,fm=sm,Oy=im;const Iy=Ry,Fy=Py,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(Fy,{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(Oy,{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(),[Ly,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(Ly,{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",My=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(Do,{...s,...o,ref:t})});My.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(Do,{asChild:!0,...s,children:i})});Cm.displayName=Nm;var rl="PopoverPortal",[Vy,zy]=ym(rl,{forceMount:void 0}),km=e=>{const{__scopePopover:t,forceMount:r,children:o,container:n}=e,s=xr(rl,t);return a.jsx(Vy,{scope:t,forceMount:r,children:a.jsx(Nt,{present:r||s.open,children:a.jsx(Ro,{asChild:!0,container:n,children:o})})})};km.displayName=rl;var Yr="PopoverContent",Sm=x.forwardRef((e,t)=>{const r=zy(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(Uy,{...n,ref:t}):a.jsx(Hy,{...n,ref:t})})});Sm.displayName=Yr;var By=Gr("PopoverContent.RemoveScroll"),Uy=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:By,allowPinchZoom:!0,children:a.jsx(Em,{...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})})})}),Hy=x.forwardRef((e,t)=>{const r=xr(Yr,e.__scopePopover),o=x.useRef(!1),n=x.useRef(!1);return a.jsx(Em,{...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()}})}),Em=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(Eo,{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)"}})})})}),$m="PopoverClose",Wy=x.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=xr($m,r);return a.jsx(be.button,{type:"button",...o,ref:t,onClick:xe(e.onClick,()=>n.onOpenChange(!1))})});Wy.displayName=$m;var qy="PopoverArrow",Xy=x.forwardRef((e,t)=>{const{__scopePopover:r,...o}=e,n=Sa(r);return a.jsx(qs,{...n,...o,ref:t})});Xy.displayName=qy;function Am(e){return e?"open":"closed"}var Gy=wm,Ky=Cm,Yy=km,_m=Sm;const Uo=Gy,Ho=Ky,Ea=x.forwardRef(({className:e,align:t="center",sideOffset:r=4,...o},n)=>a.jsx(Yy,{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})}));Ea.displayName=_m.displayName;var[Wo]=jt("Tooltip",[ra]),qo=ra(),Tm="TooltipProvider",Zy=700,ns="tooltip.open",[Jy,al]=Wo(Tm),Dm=e=>{const{__scopeTooltip:t,delayDuration:r=Zy,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(Jy,{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})};Dm.displayName=Tm;var xa="Tooltip",[Qy,Xo]=Wo(xa),Rm=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:E=>{E?(c.onOpen(),document.dispatchEvent(new CustomEvent(ns))):c.onClose(),s==null||s(E)},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(Qy,{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})})};Rm.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(Do,{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 e0="TooltipPortal",[d1,t0]=Wo(e0,{forceMount:void 0}),Zr="TooltipContent",Om=x.forwardRef((e,t)=>{const r=t0(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(r0,{side:n,...s,ref:t})})}),r0=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=l0(w,g.getBoundingClientRect()),b=i0(w,v),j=c0(f.getBoundingClientRect()),N=u0([...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=!d0(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})}),[a0,o0]=Wo(xa,{isInside:!1}),n0=gx("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(n0,{children:o}),a.jsx(a0,{scope:r,isInside:!0,children:a.jsx(Dv,{id:c.contentId,role:"tooltip",children:n||o})})]})})});Om.displayName=Zr;var Fm="TooltipArrow",s0=x.forwardRef((e,t)=>{const{__scopeTooltip:r,...o}=e,n=qo(r);return o0(Fm,r).isInside?null:a.jsx(qs,{...n,...o,ref:t})});s0.displayName=Fm;function l0(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 i0(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 c0(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 d0(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 u0(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),m0(t)}function m0(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 p0=Dm,f0=Rm,h0=Pm,Lm=Om;const x0=p0,Mm=f0,Vm=h0,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 g0(e,t){return x.useReducer((r,o)=>t[r][o]??r,e)}var nl="ScrollArea",[zm]=jt(nl),[v0,_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),[E,C]=x.useState(!1),$=je(t,I=>c(I)),A=ja(n);return a.jsx(v0,{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:E,onScrollbarYEnabledChange:C,onCornerWidthChange:v,onCornerHeightChange:j,children:a.jsx(be.div,{dir:A,...l,ref:$,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(b0,{...o,ref:t,forceMount:r}):n.type==="scroll"?a.jsx(y0,{...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 b0=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})})}),y0=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]=g0("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 S0(h,l.current,i,p)}return r==="horizontal"?a.jsx(w0,{...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(j0,{...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}),w0=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)}})}})}),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.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)}})}})}),[N0,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,$=>f($)),w=x.useRef(null),v=x.useRef(""),b=p.viewport,j=o.content-o.viewport,N=ot(m),S=ot(c),E=Ko(u,10);function C($){if(w.current){const A=$.clientX-w.current.left,I=$.clientY-w.current.top;d({x:A,y:I})}}return x.useEffect(()=>{const $=A=>{const I=A.target;y!=null&&y.contains(I)&&N(A,j)};return document.addEventListener("wheel",$,{passive:!1}),()=>document.removeEventListener("wheel",$,{passive:!1})},[b,y,j,N]),x.useEffect(S,[o,S]),Jr(y,E),Jr(p.content,E),a.jsx(N0,{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,$=>{$.button===0&&($.target.setPointerCapture($.pointerId),w.current=y.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",p.viewport&&(p.viewport.style.scrollBehavior="auto"),C($))}),onPointerMove:xe(e.onPointerMove,C),onPointerUp:xe(e.onPointerUp,$=>{const A=$.target;A.hasPointerCapture($.pointerId)&&A.releasePointerCapture($.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(C0,{ref:t,...o})})}),C0=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(k0,{...e,ref:t}):null});Km.displayName=il;var k0=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 S0(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,$0=Hm,A0=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($0,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(ep,{}),a.jsx(A0,{})]}));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(()=>Wh(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(Ee,{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(Iy,{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(Ee,{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(Ee,{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}},_0=/^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/,T0=/^\(?\d{2}\)?\s?\d{4,5}-?\d{4}$/,D0=/^\d{5}-?\d{3}$/,R0=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,P0=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,O0=e=>{if(za.has(e))return za.get(e);try{const t=new RegExp(e);return za.set(e,t),t}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&&!R0.test(n))return"E-mail inválido";if(e.tipo===_.CPF&&(!_0.test(n)||!P0(n)))return"CPF inválido";if(e.tipo===_.TELEFONE&&!T0.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=O0(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},I0=/\{\{\s*(?:event|evento)\.([a-zA-Z0-9_.]+)\s*\}\}/g,st=(e,t)=>e?e.replace(I0,(r,o)=>t[`evento.${o}`]??t[o]??r):e??"",F0=(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=>F0(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}=Ce.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}=Ce.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}=Ce.useController({name:e,control:t});return a.jsxs("div",{className:"space-y-1",children:[a.jsxs(Et,{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($t,{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}=Ce.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}=Ce.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}=Ce.useController({name:e,control:t}),c=o==="card";return a.jsxs("div",{className:"space-y-1",onBlur:l.onBlur,children:[a.jsx(Ds,{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(Rs,{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}`},L0=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),lp(t)},M0=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}=Ce.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(L0(s.minAge)):(s==null?void 0:s.maxDate)!=null?m(s.maxDate):void 0,h=(s==null?void 0:s.maxAge)!=null?m(M0(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}=Ce.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 E=((S=N.name.split(".").pop())==null?void 0:S.toLowerCase())??"",C=N.type.toLowerCase();if(!n.some($=>{const A=$.toLowerCase();return!!(A===E||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 E=await d(N,o??e,C=>{f.current&&u($=>$.status==="uploading"?{...$,progress:Math.min(100,C)}:$)});if(!f.current)return;i.onChange(E),u({status:"done",uploadId:E,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 E=(S=N.target.files)==null?void 0:S[0];E&&w(E),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 E=(S=N.dataTransfer.files)==null?void 0:S[0];E&&w(E)},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})]})},V0={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}=Ce.useController({name:e,control:t}),d=V0[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}=Ce.useController({name:e,control:t});return a.jsx("input",{type:"hidden",...r,value:r.value??""})},ip=e=>e.replace(/\D/g,""),z0=e=>{const t=ip(e).slice(0,8);return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5)}`},B0=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}=Ce.useController({name:e,control:t}),{setValue:m}=Ce.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 $=g.current;if(S=await u(N,$.signal),$.signal.aborted||!w.current)return}else{const $=await B0(N,g.current.signal);if(!w.current)return;if($.erro){p("error"),f("CEP não encontrado");return}S={logradouro:$.logradouro,bairro:$.bairro,cidade:$.localidade,estado:$.uf}}if(!w.current)return;if(S.erro){p("error"),f("CEP não encontrado");return}const E=e.includes(".")?`${e.substring(0,e.lastIndexOf("."))}.`:"",C=($,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(z0(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})]})},U0=({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}=Ce.useFieldArray({control:t,name:e}),{errors:u}=Ce.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(Ee,{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(U0,{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(Ee,{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(".",",")}`,H0=(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},W0=(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},q0=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}`},X0=(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}=Ce.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?W0(d,m):[],S=(d&&m?H0(d,m):0)>1,E=b!=null&&b>0&&j!=null&&j>0,C=b!=null&&j==null?"masculino":j!=null&&b==null?"feminino":null,$=(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};(E||C)&&(L.genero=I??C??void 0),o.onChange(L)},q=V=>{const L={tipo:"por_dia",data:V};(E||C)&&(L.genero=I??C??void 0),o.onChange(L)},W=V=>{o.onChange({tipo:$,data:A,genero:V})},X=V=>$===V;return a.jsxs("div",{className:"space-y-3",children:[E&&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:X0(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,$==="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:q0(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,Ei=7,$i=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é ${Ei}x sem juros`,Icon:O.Smartphone,taxa:0,parcelas:Ei},{id:"cartao",label:"Cartão de Crédito",description:`Parcelado em até ${$i}x`,Icon:O.CreditCard,taxa:Si,parcelas:$i,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,G0=(e,t)=>Math.round(e/t*100)/100,pp=({name:e,control:t,relatedFieldName:r="tipo_participacao"})=>{var o;const{field:n,fieldState:s}=Ce.useController({name:e,control:t}),{externalData:l={},paymentMethodOptions:i}=tr(),c=n.value??null,d=(o=s.error)==null?void 0:o.message,m=Ce.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),E=!!b.parcelas&&b.parcelas>1,C=E?G0(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:E?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}=Ce.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 E;g&&((E=v.current)==null||E.focus())},[g]),k.useEffect(()=>{if(!s||!d){p(null);return}let E=!1;return f(!0),d(s).then(C=>{E||p(C)}).catch(()=>{E||p(null)}).finally(()=>{E||f(!1)}),()=>{E=!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(Ee,{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:E=>i.onChange(E?"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:E=>{E.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:E=>E.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(Ee,{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})})]})})]})},K0=({name:e,control:t,placeholder:r,disabled:o,readOnly:n})=>{var s;const{field:l,fieldState:i}=Ce.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}=Ce.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})]})},Y0=({name:e,control:t,minValue:r=0,maxValue:o=100,step:n=1,disabled:s,readOnly:l})=>{var i;const{field:c,fieldState:d}=Ce.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),Z0=({name:e,control:t,disabled:r,readOnly:o})=>{var n;const{field:s,fieldState:l}=Ce.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})]})},J0=({name:e,control:t,options:r,placeholder:o,disabled:n,readOnly:s})=>{var l,i;const{field:c,fieldState:d}=Ce.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())},E=()=>{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}},$=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":$,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:E,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}=Ce.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})]})},Q0=({name:e,control:t,startLabel:r="Data inicial",endLabel:o="Data final",disabled:n,readOnly:s})=>{var l;const{field:i,fieldState:c}=Ce.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})]})},ew=({name:e,control:t,maxRating:r=5,disabled:o,readOnly:n})=>{var s;const{field:l,fieldState:i}=Ce.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})]})},tw=({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})}},rw=({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(tw,{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(K0,{...c});case _.TEXTAREA:return a.jsx(Jo,{...c});case _.SELECT:return a.jsx(Qo,{...c,options:e.opcoes??[]});case _.AUTOCOMPLETE:return a.jsx(J0,{...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(Y0,{name:s,control:t,minValue:e.minValue,maxValue:e.maxValue,step:e.step,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.RATING:return a.jsx(ew,{name:s,control:t,maxRating:e.maxRating,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.COLOR:return a.jsx(Z0,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.TIME:return a.jsx(xp,{...c});case _.DATE_RANGE:return a.jsx(Q0,{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(rw,{name:s,control:t,subSchema:e.subSchema,disabled:e.isDisabled,readOnly:e.isReadOnly});default:return a.jsx(gt,{...c,type:"text"})}},aw=({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=Ce.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(E=>typeof E=="string"?{valor:E,label:E}:E&&typeof E=="object"&&"valor"in E&&"label"in E?E:{valor:String(E),label:String(E)})})}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)})]})},ow=({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,$)=>C.ordem-$.ordem),[m.campos]),h=k.useCallback(()=>{const C={};for(const $ of u)$.initialValue!==void 0?C[$.nome]=typeof $.initialValue=="string"?st($.initialValue,d):$.initialValue:$.defaultValue!==void 0&&(C[$.nome]=$.defaultValue);return C},[u,d]),{fields:p,append:y,remove:f}=Ce.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=Ce.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 E=(C,$)=>{const A=w[$]??{};if(!Ke(C.condicional,A,o))return null;const I=`${n}.${$}.${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}-${$}`):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}-${$}`)};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,$)=>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:$+1}),a.jsxs("span",{className:"text-sm font-semibold",children:[i," ",$+1]})]}),p.length>s&&a.jsx("button",{type:"button",onClick:()=>f($),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=>E(A,$))})]},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(ow,{...e}):a.jsx(aw,{...e}),bp=({step:e,control:t,externalData:r={}})=>{const o=k.useMemo(()=>[...e.containers].sort((s,l)=>s.ordem-l.ordem),[e.containers]),n=Ce.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)})})},$a=k.createContext({submitting:!1,warnings:{},requestSubmit:()=>{}}),nw=$a.Provider,sw=()=>{const e=Ce.useFormContext(),t=k.useContext($a);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=Ce.useFormContext(),t=k.useContext($a),r=Ce.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}},lw=e=>{var t;const r=Ce.useFormContext(),{warnings:o}=k.useContext($a),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:o[e],dirty:s.isDirty,touched:s.isTouched,valid:!s.error}},iw=e=>{var t;const{control:r}=Ce.useFormContext(),{warnings:o}=k.useContext($a),{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:o[e],touched:s.isTouched,dirty:s.isDirty,valid:!s.error}}},_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=Ce.useForm({resolver:f,defaultValues:o,mode:"onTouched"}),{control:E,handleSubmit:C,setError:$,clearErrors:A,setValue:I}=S;k.useEffect(()=>{A();for(const[U,Q]of Object.entries(s))$(U,{type:"server",message:Q})},[s,$,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=Ce.useWatch({control:E}),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(Ce.FormProvider,{...S,children:a.jsx(nw,{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:E,externalData:n}),a.jsxs("div",{className:"flex items-center justify-between gap-4 pt-6 pb-2",children:[a.jsxs(Ee,{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(Ee,{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]},cw=({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))}),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)=>{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)})}),uw=({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)})}),wp=({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(cw,{steps:e,currentStep:t,onStepClick:r}),i==="icons"&&a.jsx(dw,{steps:e,currentStep:t,onStepClick:r}),i==="icons-labeled"&&a.jsx(uw,{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]})]})},mw=(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},pw=({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=wp})=>{const[b,j]=k.useState(()=>r),[N,S]=k.useState({...t}),[E,C]=k.useState(()=>r),[$,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?mw(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(!$){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,$,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<=E&&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:$,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:$,submitError:I,validatorMapper:p,onWarningsChange:B,onValuesChange:g,onSubmit:Q,onBack:ee},b)]})]})})})},fw=({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",hw=e=>dr.find(t=>t.component===e),jp=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)},Np=k.createContext(null),xw=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]},En=(e,t)=>{const r=t||xw(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}},$n=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))},Cp=(e,t)=>{const r=[e],o=t[e];if(o!=null&&o.children)for(const n of o.children)r.push(...Cp(n,t));return r},hl=(e,t)=>{for(const[r,o]of Object.entries(t))if(o.children.includes(e))return r;return null},kp=({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),$n(L)],f.current=[]},w=k.useCallback(()=>{d(L=>(g(L),{...L}))},[]),v=k.useCallback(()=>{y.current.length!==0&&d(L=>{f.current=[...f.current,$n(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,$n(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]??En(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}))},[]),E=k.useCallback(L=>{d(P=>({...P,showPreview:L}))},[]),C=k.useCallback(L=>{d(P=>({...P,previewTemplateId:L}))},[]),$=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]??En(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]:En(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=Cp(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(Np.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:$,getConfig:j,getAllFieldIds:N,setSelected:S,updateConfig:A,setShowPreview:E,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(Np);if(!e)throw new Error("useBuilder must be inside BuilderProvider");return e};function Sp(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=Sp(e[t]))&&(o&&(o+=" "),o+=r)}else for(r in e)e[r]&&(o&&(o+=" "),o+=r);return o}function gw(){for(var e,t,r=0,o="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=Sp(e))&&(o&&(o+=" "),o+=t);return o}const vw=(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},bw=(e,t)=>({classGroupId:e,validator:t}),Ep=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),mo="-",Ti=[],yw="arbitrary..",ww=e=>{const t=Nw(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:o}=e;return{getClassGroupId:n=>{if(n.startsWith("[")&&n.endsWith("]"))return jw(n);const s=n.split(mo),l=s[0]===""&&s.length>1?1:0;return $p(s,l,t)},getConflictingClassGroupIds:(n,s)=>{if(s){const l=o[n],i=r[n];return l?i?vw(i,l):l:i||Ti}return r[n]||Ti}}},$p=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const o=e[t],n=r.nextPart.get(o);if(n){const c=$p(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}},jw=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?yw+o:void 0})(),Nw=e=>{const{theme:t,classGroups:r}=e;return Cw(r,t)},Cw=(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];kw(l,t,r,o)}},kw=(e,t,r,o)=>{if(typeof e=="string"){Sw(e,t,r);return}if(typeof e=="function"){Ew(e,t,r,o);return}$w(e,t,r,o)},Sw=(e,t,r)=>{const o=e===""?t:Ap(t,e);o.classGroupId=r},Ew=(e,t,r,o)=>{if(Aw(e)){xl(e(o),t,r,o);return}t.validators===null&&(t.validators=[]),t.validators.push(bw(r,e))},$w=(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,Ap(t,i),r,o)}},Ap=(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},Aw=e=>"isThemeGetter"in e&&e.isThemeGetter===!0,_w=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="!",Di=":",Tw=[],Ri=(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===Di){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 Ri(s,p,h,y)};if(t){const n=t+Di,s=o;o=l=>l.startsWith(n)?s(l.slice(n.length)):Ri(Tw,!1,l,void 0,!0)}if(r){const n=o;o=s=>r({className:s,parseClassName:n})}return o},Rw=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}},Pw=e=>({cache:_w(e.cacheSize),parseClassName:Dw(e),sortModifiers:Rw(e),...ww(e)}),Ow=/\s+/,Iw=(e,t)=>{const{parseClassName:r,getClassGroupId:o,getConflictingClassGroupIds:n,sortModifiers:s}=t,l=[],i=e.trim().split(Ow);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 E=N[S];l.push(b+E)}c=m+(c.length>0?" "+c:c)}return c},Fw=(...e)=>{let t=0,r,o,n="";for(;t<e.length;)(r=e[t++])&&(o=_p(r))&&(n&&(n+=" "),n+=o);return n},_p=e=>{if(typeof e=="string")return e;let t,r="";for(let o=0;o<e.length;o++)e[o]&&(t=_p(e[o]))&&(r&&(r+=" "),r+=t);return r},Lw=(e,...t)=>{let r,o,n,s;const l=c=>{const d=t.reduce((m,u)=>u(m),e());return r=Pw(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=Iw(c,r);return n(c,m),m};return s=l,(...c)=>s(Fw(...c))},Mw=[],Ge=e=>{const t=r=>r[e]||Mw;return t.isThemeGetter=!0,t},Tp=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,Dp=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Vw=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,zw=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Bw=/\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$/,Uw=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Hw=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ww=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,or=e=>Vw.test(e),Se=e=>!!e&&!Number.isNaN(Number(e)),nr=e=>!!e&&Number.isInteger(Number(e)),An=e=>e.endsWith("%")&&Se(e.slice(0,-1)),Gt=e=>zw.test(e),Rp=()=>!0,qw=e=>Bw.test(e)&&!Uw.test(e),gl=()=>!1,Xw=e=>Hw.test(e),Gw=e=>Ww.test(e),Kw=e=>!pe(e)&&!he(e),Yw=e=>gr(e,Ip,gl),pe=e=>Tp.test(e),jr=e=>gr(e,Fp,qw),Pi=e=>gr(e,oj,Se),Zw=e=>gr(e,Mp,Rp),Jw=e=>gr(e,Lp,gl),Oi=e=>gr(e,Pp,gl),Qw=e=>gr(e,Op,Gw),Ha=e=>gr(e,Vp,Xw),he=e=>Dp.test(e),da=e=>Tr(e,Fp),ej=e=>Tr(e,Lp),Ii=e=>Tr(e,Pp),tj=e=>Tr(e,Ip),rj=e=>Tr(e,Op),Wa=e=>Tr(e,Vp,!0),aj=e=>Tr(e,Mp,!0),gr=(e,t,r)=>{const o=Tp.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},Pp=e=>e==="position"||e==="percentage",Op=e=>e==="image"||e==="url",Ip=e=>e==="length"||e==="size"||e==="bg-size",Fp=e=>e==="length",oj=e=>e==="number",Lp=e=>e==="family-name",Mp=e=>e==="number"||e==="weight",Vp=e=>e==="shadow",nj=()=>{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"],E=()=>["auto","contain","none"],C=()=>[he,pe,c],$=()=>[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",tj,Yw,{size:[he,pe]}],ee=()=>[An,da,jr],H=()=>["","none","full",d,he,pe],K=()=>["",Se,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=()=>[Se,An,Ii,Oi],te=()=>["","none",y,he,pe],ue=()=>["none",Se,he,pe],ve=()=>["none",Se,he,pe],Ne=()=>[Se,he,pe],ye=()=>[or,"full",...C()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Gt],breakpoint:[Gt],color:[Rp],container:[Gt],"drop-shadow":[Gt],ease:["in","out","in-out"],font:[Kw],"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",Se],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:[Se,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:E()}],"overscroll-x":[{"overscroll-x":E()}],"overscroll-y":[{"overscroll-y":E()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:$()}],"inset-x":[{"inset-x":$()}],"inset-y":[{"inset-y":$()}],start:[{"inset-s":$(),start:$()}],end:[{"inset-e":$(),end:$()}],"inset-bs":[{"inset-bs":$()}],"inset-be":[{"inset-be":$()}],top:[{top:$()}],right:[{right:$()}],bottom:[{bottom:$()}],left:[{left:$()}],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:[Se,or,"auto","initial","none",pe]}],grow:[{grow:["",Se,he,pe]}],shrink:[{shrink:["",Se,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,aj,Zw]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",An,pe]}],"font-family":[{font:[ej,Jw,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":[Se,"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:[Se,"from-font","auto",he,jr]}],"text-decoration-color":[{decoration:P()}],"underline-offset":[{"underline-offset":[Se,"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]},rj,Qw]}],"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":[Se,he,pe]}],"outline-w":[{outline:["",Se,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":[Se,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:[Se,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":[Se]}],"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":[Se]}],"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:[Se,he,pe]}],contrast:[{contrast:[Se,he,pe]}],"drop-shadow":[{"drop-shadow":["","none",p,Wa,Ha]}],"drop-shadow-color":[{"drop-shadow":P()}],grayscale:[{grayscale:["",Se,he,pe]}],"hue-rotate":[{"hue-rotate":[Se,he,pe]}],invert:[{invert:["",Se,he,pe]}],saturate:[{saturate:[Se,he,pe]}],sepia:[{sepia:["",Se,he,pe]}],"backdrop-filter":[{"backdrop-filter":["","none",he,pe]}],"backdrop-blur":[{"backdrop-blur":te()}],"backdrop-brightness":[{"backdrop-brightness":[Se,he,pe]}],"backdrop-contrast":[{"backdrop-contrast":[Se,he,pe]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Se,he,pe]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Se,he,pe]}],"backdrop-invert":[{"backdrop-invert":["",Se,he,pe]}],"backdrop-opacity":[{"backdrop-opacity":[Se,he,pe]}],"backdrop-saturate":[{"backdrop-saturate":[Se,he,pe]}],"backdrop-sepia":[{"backdrop-sepia":["",Se,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:[Se,"initial",he,pe]}],ease:[{ease:["linear","initial",w,he,pe]}],delay:[{delay:[Se,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:[Se,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"]}},sj=Lw(nj);function At(...e){return sj(gw(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(Ee,{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(Ea,{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)})})]})]})},lj=({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"})]})]}),ij=({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]})]}),zp=({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(ij,{inicioColuna:t,tamanho:e,onSelect:l=>{const i=13-l,c=Math.min(e,i);n(l),c!==e&&o(c)}})]})},cj=({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(zp,{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(Et,{value:String(e.columns||2),onValueChange:r=>t({columns:Number(r)}),children:[a.jsx(bt,{className:"h-8 text-sm",children:a.jsx($t,{})}),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."}]}],dj=is.flatMap(e=>e.presets),uj=({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?dj.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(Ee,{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(Ee,{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(Ea,{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(Es,{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"]}]}],mj=cs.flatMap(e=>e.presets),pj=({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=mj.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(Es,{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(Ee,{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(Ea,{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(Ee,{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))]})})]})]})]})},Bp=1048576,po=1073741824;function Fi(e){return e>=po&&e%po===0?"GB":"MB"}function Li(e,t){return t==="GB"?e/po:e/Bp}function Mi(e,t){return Math.round(e*(t==="GB"?po:Bp))}const fj=({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(Et,{value:o,onValueChange:d=>c(d),children:[a.jsx(bt,{className:"w-[72px] h-8 text-xs",children:a.jsx($t,{})}),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"]})]})},hj=new Set(["texto","textarea","email","password","url","phone","tel","cpf","cnpj","cep","rg"]),xj=({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=hj.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(pj,{value:t==null?void 0:t.fileTypes,onChange:l=>r({...t,fileTypes:l})}),a.jsx(fj,{value:t==null?void 0:t.maxFileSize,onChange:l=>r({...t,maxFileSize:l})})]}),!n&&a.jsx(uj,{value:(t==null?void 0:t.regex)??"",message:(t==null?void 0:t.regexMessage)??"",onChange:(l,i)=>r({...t,regex:l,regexMessage:i})})]})},Up=({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(Ee,{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(Ee,{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"]})]})},gj=[{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"}],vj=["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(Et,{value:e.source||"campo",onValueChange:s=>n({source:s,when:""}),children:[a.jsx(bt,{className:"h-7 text-xs",children:a.jsx($t,{})}),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(Et,{value:e.when||"",onValueChange:s=>n({when:s}),children:[a.jsx(bt,{className:"h-7 text-xs",children:a.jsx($t,{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(Et,{value:e.operator,onValueChange:s=>n({operator:s}),children:[a.jsx(bt,{className:"h-7 text-xs",children:a.jsx($t,{})}),a.jsx(yt,{children:gj.map(s=>a.jsx(ze,{value:s.value,children:s.label},s.value))})]})]}),!vj.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"})]})]}),bj=({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(Et,{value:e.logicOperator??"and",onValueChange:u=>l({logicOperator:u}),children:[a.jsx(bt,{className:"h-7 text-xs",children:a.jsx($t,{})}),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(Ee,{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(Ee,{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"}],yj=({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(Ee,{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(Es,{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(Ee,{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(Et,{value:l.fieldType,onValueChange:d=>n(i,{fieldType:d}),children:[a.jsx(bt,{className:"h-7 text-xs",children:a.jsx($t,{})}),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(Up,{options:l.options||[],onChange:d=>n(i,{options:d})})})]})]},i)}),e.length>0&&a.jsx(Qe,{className:"mt-1"})]})},wj=({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"),[E,C]=k.useState({status:"idle"}),$=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&&E.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(Ee,{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,E.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:E.fileName}),a.jsxs("span",{className:"ml-auto",children:[E.progress,"%"]})]}),a.jsx(Js,{value:E.progress,className:"h-1"})]}):null,E.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:E.message}),a.jsx(Ee,{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,E.status!=="uploading"?a.jsxs(a.Fragment,{children:[a.jsx("input",{ref:$,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(Ee,{type:"button",variant:"outline",size:"sm",className:"w-full h-8 text-xs gap-1.5",disabled:!v,onClick:()=>{var T;return(T=$.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(Et,{value:s,onValueChange:T=>!c&&n({fieldType:T}),disabled:c,children:[a.jsx(bt,{className:"h-8 text-sm",children:a.jsx($t,{})}),a.jsx(yt,{children:dr.map(T=>a.jsx(ze,{value:T.component,children:T.label},T.component))})]})]}),a.jsx(zp,{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(Et,{value:String(e.maxRating??5),onValueChange:T=>n({maxRating:Number(T)}),children:[a.jsx(bt,{className:"h-8 text-sm",children:a.jsx($t,{})}),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(xj,{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(Et,{value:e.visualStyle||"card",onValueChange:T=>n({visualStyle:T}),children:[a.jsx(bt,{className:"h-8 text-sm",children:a.jsx($t,{})}),a.jsxs(yt,{children:[a.jsx(ze,{value:"card",children:"Card (padrão)"}),a.jsx(ze,{value:"default",children:"Radio simples"})]})]})]}),a.jsx(Up,{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(yj,{subFields:e.subSchemaFields||[],onChange:T=>n({subSchemaFields:T})})]})]}),!y&&!u&&a.jsxs(a.Fragment,{children:[a.jsx(Qe,{}),a.jsx(bj,{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."]})]})]})]})},jj={glassmorphism:"Glass",card:"Card",flat:"Flat",bordered:"Bordered"},Hp=()=>{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(Ee,{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(Ea,{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=jj[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)})})]})]})},Nj=[{value:"numbers",label:"Números"},{value:"icons",label:"Ícones"},{value:"icons-labeled",label:"Ícones + rótulo"}],Cj=[{value:"top-center",label:"Centralizado"},{value:"top-left",label:"Esquerda"}],kj=[{value:"horizontal",label:"Horizontal"},{value:"vertical",label:"Vertical (sidebar)"}],Sj=()=>{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(Hp,{})]}),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:Nj.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:kj.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:Cj.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(Sj,{})]});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(lj,{config:n,onUpdate:l}),s==="container"&&a.jsx(cj,{config:n,onUpdate:l}),s==="field"&&a.jsx(wj,{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}),Wp=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},qp=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},Xp=(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,E;const C=s(j),$=ds(C,j,N);if($.condicional&&($.condicional=fo($.condicional,t)),$.tipo===_.FIELD_ARRAY){const A=((E=(S=e==null?void 0:e.containers)==null?void 0:S[j])==null?void 0:E.children)??[];$.subFields=A.filter(I=>Ve(I)==="field").map((I,M)=>ds(s(I),I,M))}return $}),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(Wp(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=Wp(e.condition)),i},Gp=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?qp(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=qp(e.condicional);i&&(l.condition=i)}return l},$j=(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,E=((i=(l=e==null?void 0:e.containers)==null?void 0:l[N])==null?void 0:i.children)||[],C=new Map;for(const $ of E){if(Ve($)!=="field")continue;w.add($);const A=f($).name;(!A||!A.trim())&&p.push(`Campo "${f($).label||$}" (${$}) no container "${S}" não tem nome definido.`);const I=A||$;C.has(I)||C.set(I,[]),C.get(I).push($)}for(const[$,A]of C.entries())A.length>1&&p.push(`Nome duplicado "${$}" 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 E=((h=(u=e==null?void 0:e.containers)==null?void 0:u[S])==null?void 0:h.children)||[];for(const C of E){if(Ve(C)!=="field")continue;const $=f(C).name||C;N.has($)||N.set($,new Set),N.get($).add(S)}}for(const[S,E]of N.entries())E.size>1&&p.push(`Nome duplicado "${S}" no step "${b}" em containers diferentes (containers: ${[...E].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 Kp=e=>typeof e=="object";var qe=e=>!it(e)&&!Array.isArray(e)&&Kp(e)&&!Nr(e),Yp=e=>qe(e)&&e.target?Aa(e.target)?e.target.checked:e.target.value:e,Aj=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,Zp=(e,t)=>e.has(Aj(t)),_j=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)&&_j(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",Re=(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 Jp=(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 Qp(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(()=>Jp(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)||!Kp(e);function Rt(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)?!Rt(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);Rt(S,m.current)||(y(S),m.current=S)}else y(N)}},[r._formValues,r._names,s,o]);nn(()=>((u.current!==r||!Rt(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&&!Rt(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=Zp(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=Qp({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:Yp(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=(E,C)=>{const $=oe(n._fields,E);$&&$._f&&($._f.mount=C)};if(S(r,!0),j){const E=Ie(oe(n._options.defaultValues,r,h.current.defaultValue));Re(n._defaultValues,r,E),Pe(oe(n._formValues,r))&&Re(n._formValues,r,E)}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 Tj=()=>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 Rj=(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 ef(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=ef(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)},tf=e=>e.type==="select-multiple",Nl=e=>e.type==="radio",Pj=e=>Nl(e)||Aa(e),Tn=e=>xo(e)&&e.isConnected;function Oj(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 Ij(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:Oj(e,r),n=r.length-1,s=r[n];return o&&delete o[s],n!==0&&(qe(o)&&tt(o)||Array.isArray(o)&&Ij(o))&&Me(e,r.slice(0,-1)),e}var Fj=e=>{for(const t in e)if(nt(e[t]))return!0;return!1};function rf(e){return Array.isArray(e)||qe(e)&&!Fj(e)}function fs(e,t={}){for(const r in e){const o=e[r];rf(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(rf(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]=!Rt(n,s)}}return r}const Ui={value:!1,isValid:!1},Hi={value:!0,isValid:!0};var af=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},of=(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 nf=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)?nf(e.refs).value:tf(t)?[...t.selectedOptions].map(({value:r})=>r):Aa(t)?af(e.refs).value:of(Pe(t.value)?e.ref.value:t.value,e)}var Lj=(e,t,r,o)=>{const n={};for(const s of e){const l=oe(t,s);l&&Re(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 Mj=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)),Vj=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 zj=(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))},Bj=(e,t,r)=>!e||!t||e===t||ct(e).some(o=>o&&(r?o===t:o.startsWith(t)||t.startsWith(o))),Uj=(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,Hj=(e,t)=>!an(oe(e,t)).length&&Me(e,t),sf=(e,t,r)=>{const o=ct(oe(e,r));return Re(o,"root",t[r]),Re(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),E=Aa(l),C=S||E,$=(g||jl(l))&&Pe(l.value)&&Pe(v)||xo(l)&&l.value===""||v===""||Array.isArray(v)&&!v.length,A=Rj.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&&($||it(v))||ft(v)&&!v||E&&!af(i).isValid||S&&!nf(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(!$&&(!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)&&!$&&(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&&!$&&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 Wj={mode:kt.onSubmit,reValidateMode:kt.onChange,shouldFocusError:!0};function qj(e={}){let t={...Wj,...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=R=>F=>{clearTimeout(d),d=setTimeout(R,F)},g=async R=>{if(!l.keepIsValid&&!t.disabled&&(u.isValid||h.isValid||R)){let F;t.resolver?(F=tt((await C()).errors),w()):F=await A(o,!0),F!==r.isValid&&p.state.next({isValid:F})}},w=(R,F)=>{!t.disabled&&(u.isValidating||u.validatingFields||h.isValidating||h.validatingFields)&&((R||Array.from(i.mount)).forEach(z=>{z&&(F?Re(r.validatingFields,z,F):Me(r.validatingFields,z))}),p.state.next({validatingFields:r.validatingFields,isValidating:!tt(r.validatingFields)}))},v=(R,F=[],z,ie,ne=!0,ae=!0)=>{if(ie&&z&&!t.disabled){if(l.action=!0,ae&&Array.isArray(oe(o,R))){const ge=z(oe(o,R),ie.argA,ie.argB);ne&&Re(o,R,ge)}if(ae&&Array.isArray(oe(r.errors,R))){const ge=z(oe(r.errors,R),ie.argA,ie.argB);ne&&Re(r.errors,R,ge),Hj(r.errors,R)}if((u.touchedFields||h.touchedFields)&&ae&&Array.isArray(oe(r.touchedFields,R))){const ge=z(oe(r.touchedFields,R),ie.argA,ie.argB);ne&&Re(r.touchedFields,R,ge)}(u.dirtyFields||h.dirtyFields)&&(r.dirtyFields=zr(n,s)),p.state.next({name:R,isDirty:M(R,F),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else Re(s,R,F)},b=(R,F)=>{Re(r.errors,R,F),p.state.next({errors:r.errors})},j=R=>{r.errors=R,p.state.next({errors:r.errors,isValid:!1})},N=(R,F,z,ie)=>{const ne=oe(o,R);if(ne){const ae=oe(s,R,Pe(z)?oe(n,R):z);Pe(ae)||ie&&ie.defaultChecked||F?Re(s,R,F?ae:qi(ne._f)):q(R,ae),l.mount&&!l.action&&g()}},S=(R,F,z,ie,ne)=>{let ae=!1,ge=!1;const _e={name:R};if(!t.disabled){if(!z||ie){(u.isDirty||h.isDirty)&&(ge=r.isDirty,r.isDirty=_e.isDirty=M(),ae=ge!==_e.isDirty);const Te=Rt(oe(n,R),F);ge=!!oe(r.dirtyFields,R),Te?Me(r.dirtyFields,R):Re(r.dirtyFields,R,!0),_e.dirtyFields=r.dirtyFields,ae=ae||(u.dirtyFields||h.dirtyFields)&&ge!==!Te}if(z){const Te=oe(r.touchedFields,R);Te||(Re(r.touchedFields,R,z),_e.touchedFields=r.touchedFields,ae=ae||(u.touchedFields||h.touchedFields)&&Te!==z)}ae&&ne&&p.state.next(_e)}return ae?_e:{}},E=(R,F,z,ie)=>{const ne=oe(r.errors,R),ae=(u.isValid||h.isValid)&&ft(F)&&r.isValid!==F;if(t.delayError&&z?(c=f(()=>b(R,z)),c(t.delayError)):(clearTimeout(d),c=null,z?Re(r.errors,R,z):Me(r.errors,R)),(z?!Rt(ne,z):ne)||!tt(ie)||ae){const ge={...ie,...ae&&ft(F)?{isValid:F}:{},errors:r.errors,name:R};r={...r,...ge},p.state.next(ge)}},C=async R=>(w(R,!0),await t.resolver(s,t.context,Lj(R||i.mount,o,t.criteriaMode,t.shouldUseNativeValidation))),$=async R=>{const{errors:F}=await C(R);if(w(R),R)for(const z of R){const ie=oe(F,z);ie?Re(r.errors,z,ie):Me(r.errors,z)}else r.errors=F;return F},A=async(R,F,z={valid:!0})=>{for(const ie in R){const ne=R[ie];if(ne){const{_f:ae,...ge}=ne;if(ae){const _e=i.array.has(ae.name),Te=ne._f&&Mj(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?sf(r.errors,Ye,ae.name):Re(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 R of i.unMount){const F=oe(o,R);F&&(F._f.refs?F._f.refs.every(z=>!Tn(z)):!Tn(F._f.ref))&&Y(R)}i.unMount=new Set},M=(R,F)=>!t.disabled&&(R&&F&&Re(s,R,F),!Rt(se(),n)),T=(R,F,z)=>ms(R,i,{...l.mount?s:Pe(F)?n:xt(R)?{[R]:F}:F},z,F),B=R=>an(oe(l.mount?s:n,R,t.shouldUnregister?oe(n,R,[]):[])),q=(R,F,z={})=>{const ie=oe(o,R);let ne=F;if(ie){const ae=ie._f;ae&&(!ae.disabled&&Re(s,R,of(F,ae)),ne=xo(ae.ref)&&it(F)?"":F,tf(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:R,values:Ie(s)})))}(z.shouldDirty||z.shouldTouch)&&S(R,ne,z.shouldTouch,z.shouldDirty,!0),z.shouldValidate&&P(R)},W=(R,F,z)=>{for(const ie in F){if(!F.hasOwnProperty(ie))return;const ne=F[ie],ae=R+"."+ie,ge=oe(o,ae);(i.array.has(R)||qe(ne)||ge&&!ge._f)&&!Nr(ne)?W(ae,ne,z):q(ae,ne,z)}},X=(R,F,z={})=>{const ie=oe(o,R),ne=i.array.has(R),ae=Ie(F);Re(s,R,ae),ne?(p.array.next({name:R,values:Ie(s)}),(u.isDirty||u.dirtyFields||h.isDirty||h.dirtyFields)&&z.shouldDirty&&p.state.next({name:R,dirtyFields:zr(n,s),isDirty:M(R,ae)})):ie&&!ie._f&&!it(ae)?W(R,ae,z):q(R,ae,z),hs(R,i)?p.state.next({...r,name:R,values:Ie(s)}):p.state.next({name:l.mount?R:void 0,values:Ie(s)})},V=async R=>{l.mount=!0;const F=R.target;let z=F.name,ie=!0;const ne=oe(o,z),ae=Te=>{ie=Number.isNaN(Te)||Nr(Te)&&isNaN(Te.getTime())||Rt(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):Yp(R),Mt=R.type===ho.BLUR||R.type===ho.FOCUS_OUT,sn=!Vj(ne._f)&&!t.resolver&&!oe(r.errors,z)&&!ne._f.deps||Uj(Mt,oe(r.touchedFields,z),r.isSubmitted,_e,ge),sa=hs(z,i,Mt);Re(s,z,Lt),Mt?(!F||!F.readOnly)&&(ne._f.onBlur&&ne._f.onBlur(R),c&&c(0)):ne._f.onChange&&ne._f.onChange(R);const la=S(z,Lt,Mt),ln=!tt(la)||sa;if(!Mt&&p.state.next({name:z,type:R.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),Dr=Gi(Ta,o,cn.name||z);Te=Dr.error,z=Dr.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),E(z,Ye,Te,la))}},L=(R,F)=>{if(oe(r.errors,F)&&R.focus)return R.focus(),1},P=async(R,F={})=>{let z,ie;const ne=ct(R);if(t.resolver){const ae=await $(Pe(R)?R:ne);z=tt(ae),ie=R?!ne.some(ge=>oe(ae,ge)):z}else R?(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(R)||(u.isValid||h.isValid)&&z!==r.isValid?{}:{name:R},...t.resolver||!R?{isValid:z}:{},errors:r.errors}),F.shouldFocus&&!ie&&Xr(o,L,R?ne:i.mount),ie},se=(R,F)=>{let z={...l.mount?s:n};return F&&(z=ef(F.dirtyFields?r.dirtyFields:r.touchedFields,z)),Pe(R)?z:xt(R)?oe(z,R):R.map(ie=>oe(z,ie))},U=(R,F)=>({invalid:!!oe((F||r).errors,R),isDirty:!!oe((F||r).dirtyFields,R),error:oe((F||r).errors,R),isValidating:!!oe(r.validatingFields,R),isTouched:!!oe((F||r).touchedFields,R)}),Q=R=>{const F=R?ct(R):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=(R,F,z)=>{const ie=(oe(o,R,{_f:{}})._f||{}).ref,ne=oe(r.errors,R)||{},{ref:ae,message:ge,type:_e,...Te}=ne;Re(r.errors,R,{...Te,...F,ref:ie}),p.state.next({name:R,errors:r.errors,isValid:!1}),z&&z.shouldFocus&&ie&&ie.focus&&ie.focus()},H=(R,F)=>nt(R)?p.state.subscribe({next:z=>"values"in z&&R(T(void 0,F),z)}):T(R,F,!0),K=R=>p.state.subscribe({next:F=>{Bj(R.name,F.name,R.exact)&&zj(F,R.formState||u,qt,R.reRenderRoot)&&R.callback({values:{...s},...r,...F,defaultValues:n})}}).unsubscribe,G=R=>(l.mount=!0,h={...h,...R.formState},K({...R,formState:{...m,...R.formState}})),Y=(R,F={})=>{for(const z of R?ct(R):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:R,name:F})=>{if(ft(R)&&l.mount||R||i.disabled.has(F)){const z=i.disabled.has(F)!==!!R;R?i.disabled.add(F):i.disabled.delete(F),z&&l.mount&&!l.action&&g()}},te=(R,F={})=>{let z=oe(o,R);const ie=ft(F.disabled)||ft(t.disabled);return Re(o,R,{...z||{},_f:{...z&&z._f?z._f:{ref:{name:R}},name:R,mount:!0,...F}}),i.mount.add(R),z?Z({disabled:ft(F.disabled)?F.disabled:t.disabled,name:R}):N(R,!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:R,onChange:V,onBlur:V,ref:ne=>{if(ne){te(R,F),z=oe(o,R);const ae=Pe(ne.value)&&ne.querySelectorAll&&ne.querySelectorAll("input,select,textarea")[0]||ne,ge=Pj(ae),_e=z._f.refs||[];if(ge?_e.find(Te=>Te===ae):ae===z._f.ref)return;Re(o,R,{_f:{...z._f,...ge?{refs:[..._e.filter(Tn),ae,...Array.isArray(oe(n,R))?[{}]:[]],ref:{type:ae.type,name:R}}:{ref:ae}}}),N(R,!1,void 0,ae)}else z=oe(o,R,{}),z._f&&(z._f.mount=!1),(t.shouldUnregister||F.shouldUnregister)&&!(Zp(i.array,R)&&l.action)&&i.unMount.add(R)}}},ue=()=>t.shouldFocusError&&Xr(o,L,i.mount),ve=R=>{ft(R)&&(p.state.next({disabled:R}),Xr(o,(F,z)=>{const ie=oe(o,z);ie&&(F.disabled=ie._f.disabled||R,Array.isArray(ie._f.refs)&&ie._f.refs.forEach(ne=>{ne.disabled=ie._f.disabled||R}))},0,!1))},Ne=(R,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 R(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=(R,F={})=>{oe(o,R)&&(Pe(F.defaultValue)?X(R,Ie(oe(n,R))):(X(R,F.defaultValue),Re(n,R,Ie(F.defaultValue))),F.keepTouched||Me(r.touchedFields,R),F.keepDirty||(Me(r.dirtyFields,R),r.isDirty=F.defaultValue?M(R,Ie(oe(n,R))):M()),F.keepError||(Me(r.errors,R),u.isValid&&g()),p.state.next({...r}))},Be=(R,F={})=>{const z=R?Ie(R):n,ie=Ie(z),ne=tt(R),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)?Re(ae,_e,Ye):!Te&&!Pe(Lt)&&X(_e,Lt)}}else{if(vl&&Pe(R))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&&!Rt(R,n)),isSubmitted:F.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:ne?{}:F.keepDirtyValues?F.keepDefaultValues&&s?zr(n,s):r.dirtyFields:F.keepDefaultValues&&R?zr(n,R):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=(R,F)=>Be(nt(R)?R(s):R,{...t.resetOptions,...F}),Je=(R,F={})=>{const z=oe(o,R),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=R=>{r={...r,...R}},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(R=>{Ue(R,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(R){l=R},get _defaultValues(){return n},get _names(){return i},set _names(R){i=R},get _formState(){return r},get _options(){return t},set _options(R){t={...t,...R}}},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)})},Dn=(e,t,r={})=>r.shouldFocus||Pe(r.shouldFocus)?r.focusName||`${e}.${Pe(r.focusIndex)?t:r.focusIndex}.`:"",Rn=(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 Xj(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)?[]:Xj(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 lf(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)),E=Rn(r._getFieldArray(o),S);r._names.focus=Dn(o,E.length-1,N),d.current=Rn(d.current,S.map(sr)),u(E),c(E),r._setFieldArray(o,E,Rn,{argA:Pn(j)})},p=(j,N)=>{const S=ct(Ie(j)),E=Fn(r._getFieldArray(o),S);r._names.focus=Dn(o,0,N),d.current=Fn(d.current,S.map(sr)),u(E),c(E),r._setFieldArray(o,E,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))&&Re(r._fields,o,void 0),r._setFieldArray(o,N,Ln,{argA:j})},f=(j,N,S)=>{const E=ct(Ie(N)),C=On(r._getFieldArray(o),j,E);r._names.focus=Dn(o,j,S),d.current=On(d.current,j,E.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),E=Yi(r._getFieldArray(o),j,S);d.current=[...E].map((C,$)=>!C||$===j?sr():d.current[$]),u(E),c([...E]),r._setFieldArray(o,E,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?Re(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:sf(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 E=oe(r._fields,N);E&&E._f&&(E._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 Gj(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}=qj(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&&!Rt(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(()=>Jp(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}},Kj=/^\d{3}\.?\d{3}\.?\d{3}-?\d{2}$/,Yj=/^\(?\d{2}\)?\s?\d{4,5}-?\d{4}$/,Zj=/^\d{5}-?\d{3}$/,Jj=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Qj=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,eN=e=>{if(qa.has(e))return qa.get(e);try{const t=new RegExp(e);return qa.set(e,t),t}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&&!Jj.test(n))return"E-mail inválido";if(e.tipo===_.CPF&&(!Kj.test(n)||!Qj(n)))return"CPF inválido";if(e.tipo===_.TELEFONE&&!Yj.test(n))return"Telefone inválido";if(e.tipo===_.CEP&&!Zj.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=eN(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}},tN=(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:{}}},rN=(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},aN=/\{\{\s*(?:event|evento)\.([a-zA-Z0-9_.]+)\s*\}\}/g,dt=(e,t)=>e?e.replace(aN,(r,o)=>t[`evento.${o}`]??t[o]??r):e??"",oN=(e,t)=>({...e,label:dt(e.label,t)}),nN=(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=>oN(o,t))}},Cl=(e,t)=>({...e,titulo:dt(e.titulo,t),descricao:dt(e.descricao,t),campos:e.campos.map(r=>nN(r,t))}),sN=(e,t)=>({...e,titulo:dt(e.titulo,t),descricao:dt(e.descricao,t),containers:e.containers.map(r=>Cl(r,t))}),cf=()=>{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(Et,{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($t,{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})]})},El=({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})]})},df=({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})]})},uf=({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(Ds,{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(Rs,{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})]})},mf=e=>{const t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${o}`},lN=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),mf(t)},iN=e=>{const t=new Date;return t.setFullYear(t.getFullYear()-e),mf(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(lN(s.minAge)):(s==null?void 0:s.maxDate)!=null?m(s.maxDate):void 0,h=(s==null?void 0:s.maxAge)!=null?m(iN(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`,pf=({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 E=((S=N.name.split(".").pop())==null?void 0:S.toLowerCase())??"",C=N.type.toLowerCase();if(!n.some($=>{const A=$.toLowerCase();return!!(A===E||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 E=await d(N,o??e,C=>{f.current&&u($=>$.status==="uploading"?{...$,progress:Math.min(100,C)}:$)});if(!f.current)return;i.onChange(E),u({status:"done",uploadId:E,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 E=(S=N.target.files)==null?void 0:S[0];E&&w(E),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 E=(S=N.dataTransfer.files)==null?void 0:S[0];E&&w(E)},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})]})},cN={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=cN[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})]})},$l=({name:e,control:t})=>{const{field:r}=Fe({name:e,control:t});return a.jsx("input",{type:"hidden",...r,value:r.value??""})},ff=e=>e.replace(/\D/g,""),dN=e=>{const t=ff(e).slice(0,8);return t.length<=5?t:`${t.slice(0,5)}-${t.slice(5)}`},uN=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()},hf=({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}=Tj(),{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=ff(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 $=g.current;if(S=await u(N,$.signal),$.signal.aborted||!w.current)return}else{const $=await uN(N,g.current.signal);if(!w.current)return;if($.erro){p("error"),f("CEP não encontrado");return}S={logradouro:$.logradouro,bairro:$.bairro,cidade:$.localidade,estado:$.uf}}if(!w.current)return;if(S.erro){p("error"),f("CEP não encontrado");return}const E=e.includes(".")?`${e.substring(0,e.lastIndexOf("."))}.`:"",C=($,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(dN(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})]})},mN=({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(uf,{...o,options:e.opcoes??[]});case _.CHECKBOX:return a.jsx(El,{name:r,control:t,label:e.label});case _.CHECKBOX_GROUP:return a.jsx(df,{...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(pf,{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(hf,{name:r,control:t,placeholder:e.placeholder});case _.HIDDEN:return a.jsx($l,{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"})}},pN=({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}=lf({control:t,name:e}),{errors:u}=Qp({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(Ee,{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(mN,{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(Ee,{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(".",",")}`,fN=(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},hN=(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},xN=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}`},gN=(e,t)=>{const r=o=>{const[n,s,l]=o.slice(0,10).split("-");return`${l}/${s}/${n}`};return`${r(e)} a ${r(t)}`},vN=({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?hN(d,m):[],S=(d&&m?fN(d,m):0)>1,E=b!=null&&b>0&&j!=null&&j>0,C=b!=null&&j==null?"masculino":j!=null&&b==null?"feminino":null,$=(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};(E||C)&&(L.genero=I??C??void 0),o.onChange(L)},q=V=>{const L={tipo:"por_dia",data:V};(E||C)&&(L.genero=I??C??void 0),o.onChange(L)},W=V=>{o.onChange({tipo:$,data:A,genero:V})},X=V=>$===V;return a.jsxs("div",{className:"space-y-3",children:[E&&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:gN(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,$==="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:xN(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,bN=[{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(".",",")}%`}],yN=[{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,wN=(e,t)=>Math.round(e/t*100)/100,jN=({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)??bN:(i==null?void 0:i.todosOsDias)??yN,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),E=!!b.parcelas&&b.parcelas>1,C=E?wN(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:E?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})]})},NN=({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 E;g&&((E=v.current)==null||E.focus())},[g]),k.useEffect(()=>{if(!s||!d){p(null);return}let E=!1;return f(!0),d(s).then(C=>{E||p(C)}).catch(()=>{E||p(null)}).finally(()=>{E||f(!1)}),()=>{E=!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(Ee,{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:E=>i.onChange(E?"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:E=>{E.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:E=>E.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(Ee,{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})})]})})]})},CN=({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})]})},xf=({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})]})},kN=({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),SN=({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())},E=()=>{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}},$=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":$,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:E,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})]})},gf=({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})]})},$N=({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})]})},AN=({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})]})},_N=({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(El,{name:t,control:r,label:e.label??"",disabled:s,readOnly:l});case _.SWITCH:return a.jsx(xf,{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(gf,{name:t,control:r,disabled:s,readOnly:l});case _.HIDDEN:return a.jsx($l,{name:t,control:r});default:return a.jsx(St,{name:t,control:r,type:"text",placeholder:e.placeholder,disabled:s,readOnly:l})}},TN=({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(_N,{field:l,name:i,control:t,disabled:o,readOnly:n})]},l.id)})})]})},vf=({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(CN,{...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(xf,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.SLIDER:return a.jsx(kN,{name:s,control:t,minValue:e.minValue,maxValue:e.maxValue,step:e.step,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.RATING:return a.jsx(AN,{name:s,control:t,maxRating:e.maxRating,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.COLOR:return a.jsx(SN,{name:s,control:t,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.TIME:return a.jsx(gf,{...c});case _.DATE_RANGE:return a.jsx($N,{name:s,control:t,startLabel:e.dateRangeStartLabel,endLabel:e.dateRangeEndLabel,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.RADIO:return a.jsx(uf,{...c,options:e.opcoes??[]});case _.CHECKBOX:return a.jsx(El,{name:s,control:t,label:e.label,disabled:e.isDisabled,readOnly:e.isReadOnly});case _.CHECKBOX_GROUP:return a.jsx(df,{...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(pf,{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(hf,{name:s,control:t,placeholder:e.placeholder,disabled:e.isDisabled,readOnly:e.isReadOnly,cepFillMap:e.cepFillMap});case _.HIDDEN:return a.jsx($l,{name:s,control:t});case _.PARTICIPATION_TYPE:return a.jsx(vN,{name:s,control:t});case _.PAYMENT_METHOD:return a.jsx(jN,{name:s,control:t,relatedFieldName:e.relatedFieldName});case _.TERMS:return a.jsx(NN,{name:s,control:t,label:e.label,termoTexto:e.termoTexto,termoPdfUrl:e.termoPdfUrl,termoPdfUploadId:e.termoPdfUploadId});case _.FIELD_ARRAY:return a.jsx(pN,{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(TN,{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}=cf(),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(E=>typeof E=="string"?{valor:E,label:E}:E&&typeof E=="object"&&"valor"in E&&"label"in E?E:{valor:String(E),label:String(E)})})}const v=w.tamanho??12,b=w.inicioColuna,j=b?`${b} / span ${v}`:`span ${v}`,N=a.jsx(vf,{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)})]})},RN=({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,$)=>C.ordem-$.ordem),[m.campos]),h=k.useCallback(()=>{const C={};for(const $ of u)$.initialValue!==void 0?C[$.nome]=typeof $.initialValue=="string"?dt($.initialValue,d):$.initialValue:$.defaultValue!==void 0&&(C[$.nome]=$.defaultValue);return C},[u,d]),{fields:p,append:y,remove:f}=lf({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}=cf();if(!e.nome)return console.error("[RepeatableContainerRenderer] container.nome é obrigatório para containers repetíveis. Container id:",e.id),null;const E=(C,$)=>{const A=w[$]??{};if(!Ze(C.condicional,A,o))return null;const I=`${n}.${$}.${C.nome}`,M=C.tamanho??12,T=C.inicioColuna,B=T?`${T} / span ${M}`:`span ${M}`,q=a.jsx(vf,{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}-${$}`):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}-${$}`)};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,$)=>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:$+1}),a.jsxs("span",{className:"text-sm font-semibold",children:[i," ",$+1]})]}),p.length>s&&a.jsx("button",{type:"button",onClick:()=>f($),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=>E(A,$))})]},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":""]})]})]})},PN=e=>e.container.repeatable&&e.container.nome?a.jsx(RN,{...e}):a.jsx(DN,{...e}),ON=({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(PN,{container:s,control:t})},s.id)})})},IN=k.createContext({submitting:!1,warnings:{},requestSubmit:()=>{}}),FN=IN.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(()=>tN(r,n,c),[r.id,y]),g=k.useMemo(()=>rN(r,n,c),[r.id,y]),[w,v]=k.useState({}),b=k.useRef(d);b.current=d;const j=n,N=k.useMemo(()=>sN(r,j),[r,y]),S=Gj({resolver:f,defaultValues:o,mode:"onTouched"}),{control:E,handleSubmit:C,setError:$,clearErrors:A,setValue:I}=S;k.useEffect(()=>{A();for(const[U,Q]of Object.entries(s))$(U,{type:"server",message:Q})},[s,$,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:E}),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(FN,{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(ON,{step:N,control:E,externalData:n}),a.jsxs("div",{className:"flex items-center justify-between gap-4 pt-6 pb-2",children:[a.jsxs(Ee,{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(Ee,{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]},LN=({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))}),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)=>{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)})}),VN=({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)})}),bf=({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(LN,{steps:e,currentStep:t,onStepClick:r}),i==="icons"&&a.jsx(MN,{steps:e,currentStep:t,onStepClick:r}),i==="icons-labeled"&&a.jsx(VN,{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]})]})},zN=(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},BN=({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=bf})=>{const[b,j]=k.useState(()=>r),[N,S]=k.useState({...t}),[E,C]=k.useState(()=>r),[$,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?zN(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(!$){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,$,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<=E&&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:$,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:$,submitError:I,validatorMapper:p,onWarningsChange:B,onValuesChange:g,onSubmit:Q,onBack:ee},b)]})]})})})},UN=({onFillMock:e,onClear:t})=>a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx(Hp,{}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Ee,{variant:"outline",size:"sm",onClick:e,children:[a.jsx(O.FlaskConical,{className:"w-3.5 h-3.5 mr-1"}),"Preencher mock"]}),a.jsxs(Ee,{variant:"ghost",size:"sm",onClick:t,children:[a.jsx(O.Eraser,{className:"w-3.5 h-3.5 mr-1"}),"Limpar"]})]})]}),HN=({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(Ee,{variant:"outline",onClick:e,children:[a.jsx(O.RotateCcw,{className:"w-4 h-4 mr-1"}),"Recomeçar"]})]}),WN=e=>a.jsx(bf,{...e,forceShow:!0}),qN=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()}`},XN=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 GN(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 KN(e){const t={};for(const r of e.steps)for(const o of r.containers)for(const n of o.campos){const s=GN(n);s!==void 0&&(t[n.nome]=s)}return t}const YN=({eventoData:e})=>{const{containers:t,configs:r,previewTemplateId:o,stepConfig:n}=mt(),s=k.useMemo(()=>Xp({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(KN(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(HN,{onRestart:y}):a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"px-1",children:a.jsx(UN,{onFillMock:h,onClear:p})}),a.jsx(BN,{schema:s,initialValues:c,template:o,externalData:e,uploadFile:qN,cepLookup:XN,onComplete:async()=>u(!0),StepIndicator:WN},l)]})},yf=({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,E=(g+S)/f,C=Math.max(1,Math.min(v,Math.round(E*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}},ZN=({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=jp(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,E]=k.useState(!1),C="var(--t-primary, hsl(var(--primary)))",$=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}=yf({id:e,currentTamanho:j,inicioColuna:g.inicioColuna,onResize:W=>u(e,{tamanho:W}),pushSnapshot:f}),{handlePositionMouseDown:q}=ZN({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:()=>E(!0),onMouseLeave:()=>E(!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:$,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"})})]})},JN=({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}=Dt.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,QN=({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(),E=S.width/12,{tamanho:C}=c.current,$=j.getBoundingClientRect(),A=$.left-S.left,I=Math.max(1,Math.min(12,Math.round(A/E)+1)),M=$.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/E)+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 E=j.dataAttribute||"data-container-id";j.pushSnapshot(),j.setReorderDrag({draggingId:e});let C=b.clientY;const $=I=>{const M=Array.from(S.children).filter(T=>T!==N&&T.getAttribute(E));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",$),window.removeEventListener("mouseup",A)};window.addEventListener("mousemove",$),window.addEventListener("mouseup",A),d.current=()=>{j.setReorderDrag(null),window.removeEventListener("mousemove",$),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}=Dt.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,E=(p==null?void 0:p.itemId)===e,C=(y==null?void 0:y.draggingId)===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}=yf({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}=QN({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",E&&"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":($||A)&&"bg-muted/30"),style:{display:"grid",gridTemplateColumns:"repeat(12, minmax(0, 1fr))",gridAutoRows:"min-content"},children:[a.jsx(Al,{showGuides:!!$||!!A,positionDrag:$?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(JN,{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"})})]}),E&&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)," "]})},wf=({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}=Dt.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,E]=k.useState(!1),C="var(--t-primary, hsl(var(--primary)))",$=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:$,boxShadow:M},onMouseEnter:()=>E(!0),onMouseLeave:()=>E(!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))]})]})},e1=()=>{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}=Dt.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(wf,{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)})})]})},t1={personal:"Pessoal",address:"Endereço",health:"Saúde",event:"Evento",payment:"Pagamento",emergency:"Emergência"},r1={texto:"Texto",selecao:"Seleção",range:"Numérico / Visual",data:"Data e Hora",contato:"Contato / Endereço",outros:"Arquivo / Outros"},a1=()=>{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:r1[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(o1,{block:t},t.id))}),a.jsx(zn,{label:"Blocos de steps",defaultOpen:!1,children:js.map(t=>a.jsx(n1,{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}=Dt.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})]})},o1=({block:e})=>{const{attributes:t,listeners:r,setNodeRef:o,transform:n,isDragging:s}=Dt.useDraggable({id:`preset-${e.id}`,data:{isPalettePreset:!0,presetId:e.id}}),l=e.icon?wt[e.icon]:void 0,i=t1[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})]})]})},n1=({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"]})]})},s1=[...pl,...dr],jf=({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=s1.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},l1=({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?Gp(e):null},[e]);return a.jsx(x0,{children:a.jsx(kp,{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})})},i1=({children:e,onError:t})=>{const{containers:r,addItem:o,addPresetBlock:n,moveCanvasItem:s,reorderInContainer:l}=mt(),i=Dt.useSensors(Dt.useSensor(Dt.PointerSensor,{activationConstraint:{distance:5}})),[c,d]=k.useState(null);return a.jsxs(Dt.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)??[],E=S.indexOf(N),C=S.indexOf(b);E!==-1&&C!==-1&&E!==C&&l("root",Pt.arrayMove(S,E,C));return}if(j==="field"){const S=v.fromContainer;let E=S,C=null;if(b.startsWith("zone-"))E=b.slice(5);else{const $=hl(b,r);$&&(E=$,C=b)}if(E===S&&C){const $=((h=r[S])==null?void 0:h.children)??[],A=$.indexOf(N),I=$.indexOf(C);A!==-1&&I!==-1&&A!==I&&l(S,Pt.arrayMove($,A,I))}else if(E!==S){const $=C?(((p=r[E])==null?void 0:p.children)??[]).indexOf(C):-1;s(N,S,E,$>=0?$:((f=(y=r[E])==null?void 0:y.children)==null?void 0:f.length)??0)}}}},children:[e,a.jsx(Dt.DragOverlay,{dropAnimation:null,children:c?a.jsx(jf,{data:c.data}):null})]})};exports.BuilderDndContext=i1;exports.BuilderProvider=kp;exports.BuilderWrapper=l1;exports.Canvas=e1;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=wp;exports.DragGhost=jf;exports.DroppedContainer=_l;exports.DroppedField=_a;exports.DroppedStep=wf;exports.EVENT_VARIABLES=fl;exports.FIELD_TYPES=dr;exports.FIELD_TYPE_ICONS=Pf;exports.FIELD_TYPE_LABELS=Rf;exports.FieldType=_;exports.FormRenderer=pw;exports.FormSchemaStatus=ys;exports.FormSpy=fw;exports.GridOverlay=Al;exports.LivePreview=YN;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=a1;exports.RendererContext=co;exports.STRUCTURE_TYPES=pl;exports.StepRenderer=bp;exports.TEMPLATE_REGISTRY=Cr;exports.TemplateProvider=pa;exports.builderToFormSchema=Xp;exports.evaluateFieldCondition=Ke;exports.findParentContainer=hl;exports.formSchemaToBuilder=Gp;exports.generateId=cc;exports.getAllTemplates=Yf;exports.getFieldMeta=hw;exports.getFieldMetaById=jp;exports.getItemType=Ve;exports.getPresetById=ws;exports.getPresetStepBlockById=th;exports.getPresetsByCategory=eh;exports.getTemplateConfig=yo;exports.interpolate=st;exports.interpolateContainer=Zo;exports.interpolateField=op;exports.interpolateStep=np;exports.isDarkTemplate=dc;exports.isGlassmorphism=Zf;exports.makeStepResolver=rp;exports.makeStepWarnComputer=ap;exports.useBuilder=mt;exports.useField=lw;exports.useFieldApi=iw;exports.useFormApi=sw;exports.useFormState=yp;exports.useRendererContext=tr;exports.useTemplate=ba;exports.v4Fallback=pt;exports.validateBuilderIntegrity=$j;
|
|
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;
|